Skip to main content
summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
-rw-r--r--assembly/features/org.eclipse.jpt.assembly.feature/.cvsignore2
-rw-r--r--assembly/features/org.eclipse.jpt.assembly.feature/.project17
-rw-r--r--assembly/features/org.eclipse.jpt.assembly.feature/build.properties16
-rw-r--r--assembly/features/org.eclipse.jpt.assembly.feature/eclipse_update_120.jpgbin21695 -> 0 bytes
-rw-r--r--assembly/features/org.eclipse.jpt.assembly.feature/epl-v10.html328
-rw-r--r--assembly/features/org.eclipse.jpt.assembly.feature/feature.properties144
-rw-r--r--assembly/features/org.eclipse.jpt.assembly.feature/feature.xml34
-rw-r--r--assembly/features/org.eclipse.jpt.assembly.feature/license.html93
-rw-r--r--assembly/features/org.eclipse.jpt.patch/.project17
-rw-r--r--assembly/features/org.eclipse.jpt.patch/build.properties10
-rw-r--r--assembly/features/org.eclipse.jpt.patch/buildnotes_org.eclipse.jpt.patch.html20
-rw-r--r--assembly/features/org.eclipse.jpt.patch/eclipse_update_120.jpgbin21695 -> 0 bytes
-rw-r--r--assembly/features/org.eclipse.jpt.patch/epl-v10.html328
-rw-r--r--assembly/features/org.eclipse.jpt.patch/feature.properties143
-rw-r--r--assembly/features/org.eclipse.jpt.patch/feature.xml35
-rw-r--r--assembly/features/org.eclipse.jpt.patch/license.html93
-rw-r--r--assembly/features/org.eclipse.jpt.sdk/.cvsignore4
-rw-r--r--assembly/features/org.eclipse.jpt.sdk/.project17
-rw-r--r--assembly/features/org.eclipse.jpt.sdk/build.properties15
-rw-r--r--assembly/features/org.eclipse.jpt.sdk/eclipse_update_120.jpgbin21695 -> 0 bytes
-rw-r--r--assembly/features/org.eclipse.jpt.sdk/epl-v10.html328
-rw-r--r--assembly/features/org.eclipse.jpt.sdk/feature.properties145
-rw-r--r--assembly/features/org.eclipse.jpt.sdk/feature.xml42
-rw-r--r--assembly/features/org.eclipse.jpt.sdk/license.html98
-rw-r--r--assembly/features/org.eclipse.jpt.tests.assembly.feature/.cvsignore3
-rw-r--r--assembly/features/org.eclipse.jpt.tests.assembly.feature/.project17
-rw-r--r--assembly/features/org.eclipse.jpt.tests.assembly.feature/.settings/org.eclipse.core.resources.prefs3
-rw-r--r--assembly/features/org.eclipse.jpt.tests.assembly.feature/build.properties5
-rw-r--r--assembly/features/org.eclipse.jpt.tests.assembly.feature/eclipse_update_120.jpgbin21695 -> 0 bytes
-rw-r--r--assembly/features/org.eclipse.jpt.tests.assembly.feature/epl-v10.html328
-rw-r--r--assembly/features/org.eclipse.jpt.tests.assembly.feature/feature.properties145
-rw-r--r--assembly/features/org.eclipse.jpt.tests.assembly.feature/feature.xml28
-rw-r--r--assembly/features/org.eclipse.jpt.tests.assembly.feature/license.html98
-rw-r--r--assembly/features/org.eclipse.jpt.tests/.cvsignore3
-rw-r--r--assembly/features/org.eclipse.jpt.tests/.project17
-rw-r--r--assembly/features/org.eclipse.jpt.tests/.settings/org.eclipse.core.resources.prefs3
-rw-r--r--assembly/features/org.eclipse.jpt.tests/build.properties5
-rw-r--r--assembly/features/org.eclipse.jpt.tests/eclipse_update_120.jpgbin21695 -> 0 bytes
-rw-r--r--assembly/features/org.eclipse.jpt.tests/epl-v10.html328
-rw-r--r--assembly/features/org.eclipse.jpt.tests/feature.properties145
-rw-r--r--assembly/features/org.eclipse.jpt.tests/feature.xml28
-rw-r--r--assembly/features/org.eclipse.jpt.tests/license.html98
-rw-r--r--assembly/features/org.eclipse.jpt/.cvsignore2
-rw-r--r--assembly/features/org.eclipse.jpt/.project17
-rw-r--r--assembly/features/org.eclipse.jpt/build.properties16
-rw-r--r--assembly/features/org.eclipse.jpt/eclipse_update_120.jpgbin21695 -> 0 bytes
-rw-r--r--assembly/features/org.eclipse.jpt/epl-v10.html328
-rw-r--r--assembly/features/org.eclipse.jpt/feature.properties144
-rw-r--r--assembly/features/org.eclipse.jpt/feature.xml42
-rw-r--r--assembly/features/org.eclipse.jpt/license.html93
-rw-r--r--assembly/features/org.eclipse.jpt_sdk.assembly.feature/.cvsignore4
-rw-r--r--assembly/features/org.eclipse.jpt_sdk.assembly.feature/.project17
-rw-r--r--assembly/features/org.eclipse.jpt_sdk.assembly.feature/build.properties15
-rw-r--r--assembly/features/org.eclipse.jpt_sdk.assembly.feature/eclipse_update_120.jpgbin21695 -> 0 bytes
-rw-r--r--assembly/features/org.eclipse.jpt_sdk.assembly.feature/epl-v10.html328
-rw-r--r--assembly/features/org.eclipse.jpt_sdk.assembly.feature/feature.properties145
-rw-r--r--assembly/features/org.eclipse.jpt_sdk.assembly.feature/feature.xml34
-rw-r--r--assembly/features/org.eclipse.jpt_sdk.assembly.feature/license.html98
-rw-r--r--assembly/plugins/org.eclipse.jpt/.cvsignore2
-rw-r--r--assembly/plugins/org.eclipse.jpt/.project22
-rw-r--r--assembly/plugins/org.eclipse.jpt/.settings/org.eclipse.core.resources.prefs3
-rw-r--r--assembly/plugins/org.eclipse.jpt/META-INF/MANIFEST.MF7
-rw-r--r--assembly/plugins/org.eclipse.jpt/about.html34
-rw-r--r--assembly/plugins/org.eclipse.jpt/about.ini44
-rw-r--r--assembly/plugins/org.eclipse.jpt/about.mappings6
-rw-r--r--assembly/plugins/org.eclipse.jpt/about.properties24
-rw-r--r--assembly/plugins/org.eclipse.jpt/build.properties19
-rw-r--r--assembly/plugins/org.eclipse.jpt/component.xml12
-rw-r--r--assembly/plugins/org.eclipse.jpt/eclipse32.gifbin1706 -> 0 bytes
-rw-r--r--assembly/plugins/org.eclipse.jpt/eclipse32.pngbin4594 -> 0 bytes
-rw-r--r--assembly/plugins/org.eclipse.jpt/plugin.properties13
-rw-r--r--jpa/features/org.eclipse.jpt.eclipselink.feature/.cvsignore1
-rw-r--r--jpa/features/org.eclipse.jpt.eclipselink.feature/.project17
-rw-r--r--jpa/features/org.eclipse.jpt.eclipselink.feature/.settings/org.eclipse.core.resources.prefs3
-rw-r--r--jpa/features/org.eclipse.jpt.eclipselink.feature/build.properties15
-rw-r--r--jpa/features/org.eclipse.jpt.eclipselink.feature/eclipse_update_120.jpgbin21695 -> 0 bytes
-rw-r--r--jpa/features/org.eclipse.jpt.eclipselink.feature/epl-v10.html328
-rw-r--r--jpa/features/org.eclipse.jpt.eclipselink.feature/feature.properties140
-rw-r--r--jpa/features/org.eclipse.jpt.eclipselink.feature/feature.xml59
-rw-r--r--jpa/features/org.eclipse.jpt.eclipselink.feature/license.html98
-rw-r--r--jpa/features/org.eclipse.jpt.eclipselink.feature/sourceTemplateBundle/about.html27
-rw-r--r--jpa/features/org.eclipse.jpt.eclipselink.feature/sourceTemplateBundle/about.ini31
-rw-r--r--jpa/features/org.eclipse.jpt.eclipselink.feature/sourceTemplateBundle/about.mappings6
-rw-r--r--jpa/features/org.eclipse.jpt.eclipselink.feature/sourceTemplateBundle/about.properties26
-rw-r--r--jpa/features/org.eclipse.jpt.eclipselink.feature/sourceTemplateBundle/build.properties21
-rw-r--r--jpa/features/org.eclipse.jpt.eclipselink.feature/sourceTemplateBundle/eclipse32.gifbin1706 -> 0 bytes
-rw-r--r--jpa/features/org.eclipse.jpt.eclipselink.feature/sourceTemplateBundle/eclipse32.pngbin4634 -> 0 bytes
-rw-r--r--jpa/features/org.eclipse.jpt.eclipselink.feature/sourceTemplateBundle/eclipse_update_120.jpgbin21695 -> 0 bytes
-rw-r--r--jpa/features/org.eclipse.jpt.eclipselink.feature/sourceTemplateBundle/epl-v10.html328
-rw-r--r--jpa/features/org.eclipse.jpt.eclipselink.feature/sourceTemplateBundle/license.html83
-rw-r--r--jpa/features/org.eclipse.jpt.eclipselink.feature/sourceTemplateBundle/plugin.properties13
-rw-r--r--jpa/features/org.eclipse.jpt.eclipselink.feature/sourceTemplateFeature/build.properties16
-rw-r--r--jpa/features/org.eclipse.jpt.eclipselink.feature/sourceTemplateFeature/eclipse_update_120.jpgbin21695 -> 0 bytes
-rw-r--r--jpa/features/org.eclipse.jpt.eclipselink.feature/sourceTemplateFeature/epl-v10.html328
-rw-r--r--jpa/features/org.eclipse.jpt.eclipselink.feature/sourceTemplateFeature/feature.properties145
-rw-r--r--jpa/features/org.eclipse.jpt.eclipselink.feature/sourceTemplateFeature/license.html82
-rw-r--r--jpa/features/org.eclipse.jpt.eclipselink.feature/sourceTemplatePlugin/about.html27
-rw-r--r--jpa/features/org.eclipse.jpt.eclipselink.feature/sourceTemplatePlugin/about.ini31
-rw-r--r--jpa/features/org.eclipse.jpt.eclipselink.feature/sourceTemplatePlugin/about.mappings6
-rw-r--r--jpa/features/org.eclipse.jpt.eclipselink.feature/sourceTemplatePlugin/about.properties26
-rw-r--r--jpa/features/org.eclipse.jpt.eclipselink.feature/sourceTemplatePlugin/build.properties21
-rw-r--r--jpa/features/org.eclipse.jpt.eclipselink.feature/sourceTemplatePlugin/eclipse32.gifbin1706 -> 0 bytes
-rw-r--r--jpa/features/org.eclipse.jpt.eclipselink.feature/sourceTemplatePlugin/eclipse32.pngbin4634 -> 0 bytes
-rw-r--r--jpa/features/org.eclipse.jpt.eclipselink.feature/sourceTemplatePlugin/eclipse_update_120.jpgbin21695 -> 0 bytes
-rw-r--r--jpa/features/org.eclipse.jpt.eclipselink.feature/sourceTemplatePlugin/epl-v10.html328
-rw-r--r--jpa/features/org.eclipse.jpt.eclipselink.feature/sourceTemplatePlugin/license.html83
-rw-r--r--jpa/features/org.eclipse.jpt.eclipselink.feature/sourceTemplatePlugin/plugin.properties13
-rw-r--r--jpa/features/org.eclipse.jpt.eclipselink_sdk.feature/.cvsignore3
-rw-r--r--jpa/features/org.eclipse.jpt.eclipselink_sdk.feature/.project17
-rw-r--r--jpa/features/org.eclipse.jpt.eclipselink_sdk.feature/.settings/org.eclipse.core.resources.prefs3
-rw-r--r--jpa/features/org.eclipse.jpt.eclipselink_sdk.feature/build.properties7
-rw-r--r--jpa/features/org.eclipse.jpt.eclipselink_sdk.feature/eclipse_update_120.jpgbin21695 -> 0 bytes
-rw-r--r--jpa/features/org.eclipse.jpt.eclipselink_sdk.feature/epl-v10.html328
-rw-r--r--jpa/features/org.eclipse.jpt.eclipselink_sdk.feature/feature.properties140
-rw-r--r--jpa/features/org.eclipse.jpt.eclipselink_sdk.feature/feature.xml28
-rw-r--r--jpa/features/org.eclipse.jpt.eclipselink_sdk.feature/license.html98
-rw-r--r--jpa/features/org.eclipse.jpt.feature/.cvsignore1
-rw-r--r--jpa/features/org.eclipse.jpt.feature/.project17
-rw-r--r--jpa/features/org.eclipse.jpt.feature/.settings/org.eclipse.core.resources.prefs3
-rw-r--r--jpa/features/org.eclipse.jpt.feature/build.properties15
-rw-r--r--jpa/features/org.eclipse.jpt.feature/eclipse_update_120.jpgbin21695 -> 0 bytes
-rw-r--r--jpa/features/org.eclipse.jpt.feature/epl-v10.html328
-rw-r--r--jpa/features/org.eclipse.jpt.feature/feature.properties140
-rw-r--r--jpa/features/org.eclipse.jpt.feature/feature.xml118
-rw-r--r--jpa/features/org.eclipse.jpt.feature/license.html98
-rw-r--r--jpa/features/org.eclipse.jpt.feature/sourceTemplateBundle/about.html27
-rw-r--r--jpa/features/org.eclipse.jpt.feature/sourceTemplateBundle/about.ini31
-rw-r--r--jpa/features/org.eclipse.jpt.feature/sourceTemplateBundle/about.mappings6
-rw-r--r--jpa/features/org.eclipse.jpt.feature/sourceTemplateBundle/about.properties26
-rw-r--r--jpa/features/org.eclipse.jpt.feature/sourceTemplateBundle/build.properties12
-rw-r--r--jpa/features/org.eclipse.jpt.feature/sourceTemplateBundle/eclipse32.gifbin1706 -> 0 bytes
-rw-r--r--jpa/features/org.eclipse.jpt.feature/sourceTemplateBundle/eclipse32.pngbin4634 -> 0 bytes
-rw-r--r--jpa/features/org.eclipse.jpt.feature/sourceTemplateBundle/eclipse_update_120.jpgbin21695 -> 0 bytes
-rw-r--r--jpa/features/org.eclipse.jpt.feature/sourceTemplateBundle/epl-v10.html328
-rw-r--r--jpa/features/org.eclipse.jpt.feature/sourceTemplateBundle/license.html83
-rw-r--r--jpa/features/org.eclipse.jpt.feature/sourceTemplateBundle/plugin.properties13
-rw-r--r--jpa/features/org.eclipse.jpt.feature/sourceTemplateFeature/build.properties16
-rw-r--r--jpa/features/org.eclipse.jpt.feature/sourceTemplateFeature/eclipse_update_120.jpgbin21695 -> 0 bytes
-rw-r--r--jpa/features/org.eclipse.jpt.feature/sourceTemplateFeature/epl-v10.html328
-rw-r--r--jpa/features/org.eclipse.jpt.feature/sourceTemplateFeature/feature.properties145
-rw-r--r--jpa/features/org.eclipse.jpt.feature/sourceTemplateFeature/license.html82
-rw-r--r--jpa/features/org.eclipse.jpt.feature/sourceTemplatePlugin/about.html27
-rw-r--r--jpa/features/org.eclipse.jpt.feature/sourceTemplatePlugin/about.ini31
-rw-r--r--jpa/features/org.eclipse.jpt.feature/sourceTemplatePlugin/about.mappings6
-rw-r--r--jpa/features/org.eclipse.jpt.feature/sourceTemplatePlugin/about.properties26
-rw-r--r--jpa/features/org.eclipse.jpt.feature/sourceTemplatePlugin/build.properties12
-rw-r--r--jpa/features/org.eclipse.jpt.feature/sourceTemplatePlugin/eclipse32.gifbin1706 -> 0 bytes
-rw-r--r--jpa/features/org.eclipse.jpt.feature/sourceTemplatePlugin/eclipse32.pngbin4634 -> 0 bytes
-rw-r--r--jpa/features/org.eclipse.jpt.feature/sourceTemplatePlugin/eclipse_update_120.jpgbin21695 -> 0 bytes
-rw-r--r--jpa/features/org.eclipse.jpt.feature/sourceTemplatePlugin/epl-v10.html328
-rw-r--r--jpa/features/org.eclipse.jpt.feature/sourceTemplatePlugin/license.html83
-rw-r--r--jpa/features/org.eclipse.jpt.feature/sourceTemplatePlugin/plugin.properties13
-rw-r--r--jpa/features/org.eclipse.jpt.tests.feature/.cvsignore1
-rw-r--r--jpa/features/org.eclipse.jpt.tests.feature/.project17
-rw-r--r--jpa/features/org.eclipse.jpt.tests.feature/.settings/org.eclipse.core.resources.prefs3
-rw-r--r--jpa/features/org.eclipse.jpt.tests.feature/build.properties10
-rw-r--r--jpa/features/org.eclipse.jpt.tests.feature/eclipse_update_120.jpgbin21695 -> 0 bytes
-rw-r--r--jpa/features/org.eclipse.jpt.tests.feature/epl-v10.html328
-rw-r--r--jpa/features/org.eclipse.jpt.tests.feature/feature.properties145
-rw-r--r--jpa/features/org.eclipse.jpt.tests.feature/feature.xml44
-rw-r--r--jpa/features/org.eclipse.jpt.tests.feature/license.html98
-rw-r--r--jpa/features/org.eclipse.jpt_sdk.feature/.cvsignore3
-rw-r--r--jpa/features/org.eclipse.jpt_sdk.feature/.project17
-rw-r--r--jpa/features/org.eclipse.jpt_sdk.feature/.settings/org.eclipse.core.resources.prefs3
-rw-r--r--jpa/features/org.eclipse.jpt_sdk.feature/build.properties7
-rw-r--r--jpa/features/org.eclipse.jpt_sdk.feature/eclipse_update_120.jpgbin21695 -> 0 bytes
-rw-r--r--jpa/features/org.eclipse.jpt_sdk.feature/epl-v10.html328
-rw-r--r--jpa/features/org.eclipse.jpt_sdk.feature/feature.properties140
-rw-r--r--jpa/features/org.eclipse.jpt_sdk.feature/feature.xml35
-rw-r--r--jpa/features/org.eclipse.jpt_sdk.feature/license.html98
-rw-r--r--jpa/plugins/org.eclipse.jpt.branding/.cvsignore2
-rw-r--r--jpa/plugins/org.eclipse.jpt.branding/.project22
-rw-r--r--jpa/plugins/org.eclipse.jpt.branding/.settings/org.eclipse.core.resources.prefs3
-rw-r--r--jpa/plugins/org.eclipse.jpt.branding/META-INF/MANIFEST.MF7
-rw-r--r--jpa/plugins/org.eclipse.jpt.branding/about.html34
-rw-r--r--jpa/plugins/org.eclipse.jpt.branding/about.ini44
-rw-r--r--jpa/plugins/org.eclipse.jpt.branding/about.mappings6
-rw-r--r--jpa/plugins/org.eclipse.jpt.branding/about.properties24
-rw-r--r--jpa/plugins/org.eclipse.jpt.branding/build.properties18
-rw-r--r--jpa/plugins/org.eclipse.jpt.branding/component.xml12
-rw-r--r--jpa/plugins/org.eclipse.jpt.branding/icons/WTP_icon_x32_v2.pngbin5616 -> 0 bytes
-rw-r--r--jpa/plugins/org.eclipse.jpt.branding/plugin.properties13
-rw-r--r--jpa/plugins/org.eclipse.jpt.db.ui/.classpath7
-rw-r--r--jpa/plugins/org.eclipse.jpt.db.ui/.cvsignore6
-rw-r--r--jpa/plugins/org.eclipse.jpt.db.ui/.project28
-rw-r--r--jpa/plugins/org.eclipse.jpt.db.ui/.settings/org.eclipse.core.resources.prefs3
-rw-r--r--jpa/plugins/org.eclipse.jpt.db.ui/.settings/org.eclipse.jdt.core.prefs7
-rw-r--r--jpa/plugins/org.eclipse.jpt.db.ui/META-INF/MANIFEST.MF15
-rw-r--r--jpa/plugins/org.eclipse.jpt.db.ui/about.html34
-rw-r--r--jpa/plugins/org.eclipse.jpt.db.ui/build.properties17
-rw-r--r--jpa/plugins/org.eclipse.jpt.db.ui/component.xml1
-rw-r--r--jpa/plugins/org.eclipse.jpt.db.ui/plugin.properties25
-rw-r--r--jpa/plugins/org.eclipse.jpt.db.ui/src/org/eclipse/jpt/db/ui/internal/DTPUiTools.java106
-rw-r--r--jpa/plugins/org.eclipse.jpt.db/.classpath7
-rw-r--r--jpa/plugins/org.eclipse.jpt.db/.cvsignore6
-rw-r--r--jpa/plugins/org.eclipse.jpt.db/.project28
-rw-r--r--jpa/plugins/org.eclipse.jpt.db/.settings/org.eclipse.core.resources.prefs3
-rw-r--r--jpa/plugins/org.eclipse.jpt.db/.settings/org.eclipse.jdt.core.prefs7
-rw-r--r--jpa/plugins/org.eclipse.jpt.db/META-INF/MANIFEST.MF20
-rw-r--r--jpa/plugins/org.eclipse.jpt.db/about.html34
-rw-r--r--jpa/plugins/org.eclipse.jpt.db/build.properties19
-rw-r--r--jpa/plugins/org.eclipse.jpt.db/component.xml1
-rw-r--r--jpa/plugins/org.eclipse.jpt.db/plugin.properties25
-rw-r--r--jpa/plugins/org.eclipse.jpt.db/src/org/eclipse/jpt/db/Catalog.java27
-rw-r--r--jpa/plugins/org.eclipse.jpt.db/src/org/eclipse/jpt/db/Column.java123
-rw-r--r--jpa/plugins/org.eclipse.jpt.db/src/org/eclipse/jpt/db/ConnectionAdapter.java72
-rw-r--r--jpa/plugins/org.eclipse.jpt.db/src/org/eclipse/jpt/db/ConnectionListener.java42
-rw-r--r--jpa/plugins/org.eclipse.jpt.db/src/org/eclipse/jpt/db/ConnectionProfile.java206
-rw-r--r--jpa/plugins/org.eclipse.jpt.db/src/org/eclipse/jpt/db/ConnectionProfileAdapter.java35
-rw-r--r--jpa/plugins/org.eclipse.jpt.db/src/org/eclipse/jpt/db/ConnectionProfileFactory.java67
-rw-r--r--jpa/plugins/org.eclipse.jpt.db/src/org/eclipse/jpt/db/ConnectionProfileListener.java44
-rw-r--r--jpa/plugins/org.eclipse.jpt.db/src/org/eclipse/jpt/db/Database.java137
-rw-r--r--jpa/plugins/org.eclipse.jpt.db/src/org/eclipse/jpt/db/DatabaseFinder.java96
-rw-r--r--jpa/plugins/org.eclipse.jpt.db/src/org/eclipse/jpt/db/DatabaseObject.java58
-rw-r--r--jpa/plugins/org.eclipse.jpt.db/src/org/eclipse/jpt/db/ForeignKey.java139
-rw-r--r--jpa/plugins/org.eclipse.jpt.db/src/org/eclipse/jpt/db/JptDbPlugin.java80
-rw-r--r--jpa/plugins/org.eclipse.jpt.db/src/org/eclipse/jpt/db/Schema.java100
-rw-r--r--jpa/plugins/org.eclipse.jpt.db/src/org/eclipse/jpt/db/SchemaContainer.java76
-rw-r--r--jpa/plugins/org.eclipse.jpt.db/src/org/eclipse/jpt/db/Sequence.java32
-rw-r--r--jpa/plugins/org.eclipse.jpt.db/src/org/eclipse/jpt/db/Table.java130
-rw-r--r--jpa/plugins/org.eclipse.jpt.db/src/org/eclipse/jpt/db/internal/DTPCatalogWrapper.java100
-rw-r--r--jpa/plugins/org.eclipse.jpt.db/src/org/eclipse/jpt/db/internal/DTPColumnWrapper.java241
-rw-r--r--jpa/plugins/org.eclipse.jpt.db/src/org/eclipse/jpt/db/internal/DTPConnectionProfileFactory.java165
-rw-r--r--jpa/plugins/org.eclipse.jpt.db/src/org/eclipse/jpt/db/internal/DTPConnectionProfileWrapper.java557
-rw-r--r--jpa/plugins/org.eclipse.jpt.db/src/org/eclipse/jpt/db/internal/DTPDatabaseObject.java24
-rw-r--r--jpa/plugins/org.eclipse.jpt.db/src/org/eclipse/jpt/db/internal/DTPDatabaseObjectWrapper.java190
-rw-r--r--jpa/plugins/org.eclipse.jpt.db/src/org/eclipse/jpt/db/internal/DTPDatabaseWrapper.java382
-rw-r--r--jpa/plugins/org.eclipse.jpt.db/src/org/eclipse/jpt/db/internal/DTPForeignKeyWrapper.java339
-rw-r--r--jpa/plugins/org.eclipse.jpt.db/src/org/eclipse/jpt/db/internal/DTPSchemaContainerWrapper.java222
-rw-r--r--jpa/plugins/org.eclipse.jpt.db/src/org/eclipse/jpt/db/internal/DTPSchemaWrapper.java307
-rw-r--r--jpa/plugins/org.eclipse.jpt.db/src/org/eclipse/jpt/db/internal/DTPSequenceWrapper.java72
-rw-r--r--jpa/plugins/org.eclipse.jpt.db/src/org/eclipse/jpt/db/internal/DTPTableWrapper.java420
-rw-r--r--jpa/plugins/org.eclipse.jpt.db/src/org/eclipse/jpt/db/internal/vendor/AbstractVendor.java290
-rw-r--r--jpa/plugins/org.eclipse.jpt.db/src/org/eclipse/jpt/db/internal/vendor/CatalogStrategy.java38
-rw-r--r--jpa/plugins/org.eclipse.jpt.db/src/org/eclipse/jpt/db/internal/vendor/DB2.java62
-rw-r--r--jpa/plugins/org.eclipse.jpt.db/src/org/eclipse/jpt/db/internal/vendor/Derby.java71
-rw-r--r--jpa/plugins/org.eclipse.jpt.db/src/org/eclipse/jpt/db/internal/vendor/FauxCatalogStrategy.java73
-rw-r--r--jpa/plugins/org.eclipse.jpt.db/src/org/eclipse/jpt/db/internal/vendor/FoldingStrategy.java34
-rw-r--r--jpa/plugins/org.eclipse.jpt.db/src/org/eclipse/jpt/db/internal/vendor/HSQLDB.java57
-rw-r--r--jpa/plugins/org.eclipse.jpt.db/src/org/eclipse/jpt/db/internal/vendor/Informix.java59
-rw-r--r--jpa/plugins/org.eclipse.jpt.db/src/org/eclipse/jpt/db/internal/vendor/LowerCaseFoldingStrategy.java57
-rw-r--r--jpa/plugins/org.eclipse.jpt.db/src/org/eclipse/jpt/db/internal/vendor/MaxDB.java59
-rw-r--r--jpa/plugins/org.eclipse.jpt.db/src/org/eclipse/jpt/db/internal/vendor/MySQL.java109
-rw-r--r--jpa/plugins/org.eclipse.jpt.db/src/org/eclipse/jpt/db/internal/vendor/NoCatalogStrategy.java56
-rw-r--r--jpa/plugins/org.eclipse.jpt.db/src/org/eclipse/jpt/db/internal/vendor/NonFoldingStrategy.java66
-rw-r--r--jpa/plugins/org.eclipse.jpt.db/src/org/eclipse/jpt/db/internal/vendor/Oracle.java53
-rw-r--r--jpa/plugins/org.eclipse.jpt.db/src/org/eclipse/jpt/db/internal/vendor/PostgreSQL.java101
-rw-r--r--jpa/plugins/org.eclipse.jpt.db/src/org/eclipse/jpt/db/internal/vendor/SQLServer.java87
-rw-r--r--jpa/plugins/org.eclipse.jpt.db/src/org/eclipse/jpt/db/internal/vendor/SimpleCatalogStrategy.java57
-rw-r--r--jpa/plugins/org.eclipse.jpt.db/src/org/eclipse/jpt/db/internal/vendor/Sybase.java103
-rw-r--r--jpa/plugins/org.eclipse.jpt.db/src/org/eclipse/jpt/db/internal/vendor/UnknownCatalogStrategy.java87
-rw-r--r--jpa/plugins/org.eclipse.jpt.db/src/org/eclipse/jpt/db/internal/vendor/UnrecognizedVendor.java58
-rw-r--r--jpa/plugins/org.eclipse.jpt.db/src/org/eclipse/jpt/db/internal/vendor/UpperCaseFoldingStrategy.java57
-rw-r--r--jpa/plugins/org.eclipse.jpt.db/src/org/eclipse/jpt/db/internal/vendor/Vendor.java83
-rw-r--r--jpa/plugins/org.eclipse.jpt.db/src/org/eclipse/jpt/db/internal/vendor/VendorRepository.java78
-rw-r--r--jpa/plugins/org.eclipse.jpt.doc.user/.project22
-rw-r--r--jpa/plugins/org.eclipse.jpt.doc.user/META-INF/MANIFEST.MF9
-rw-r--r--jpa/plugins/org.eclipse.jpt.doc.user/about.htm43
-rw-r--r--jpa/plugins/org.eclipse.jpt.doc.user/about.html42
-rw-r--r--jpa/plugins/org.eclipse.jpt.doc.user/build.properties127
-rw-r--r--jpa/plugins/org.eclipse.jpt.doc.user/cheatsheets/add_persistence.xml63
-rw-r--r--jpa/plugins/org.eclipse.jpt.doc.user/cheatsheets/create_entity.xml44
-rw-r--r--jpa/plugins/org.eclipse.jpt.doc.user/cheatsheets/map_entity.xml88
-rw-r--r--jpa/plugins/org.eclipse.jpt.doc.user/concept_mapping.htm46
-rw-r--r--jpa/plugins/org.eclipse.jpt.doc.user/concept_persistence.htm41
-rw-r--r--jpa/plugins/org.eclipse.jpt.doc.user/concepts.htm63
-rw-r--r--jpa/plugins/org.eclipse.jpt.doc.user/concepts001.htm43
-rw-r--r--jpa/plugins/org.eclipse.jpt.doc.user/concepts002.htm58
-rw-r--r--jpa/plugins/org.eclipse.jpt.doc.user/concepts003.htm60
-rw-r--r--jpa/plugins/org.eclipse.jpt.doc.user/contexts.xml613
-rw-r--r--jpa/plugins/org.eclipse.jpt.doc.user/dcommon/css/blafdoc.css21
-rw-r--r--jpa/plugins/org.eclipse.jpt.doc.user/dcommon/html/cpyr.htm11
-rw-r--r--jpa/plugins/org.eclipse.jpt.doc.user/getting_started.htm47
-rw-r--r--jpa/plugins/org.eclipse.jpt.doc.user/getting_started001.htm80
-rw-r--r--jpa/plugins/org.eclipse.jpt.doc.user/getting_started002.htm49
-rw-r--r--jpa/plugins/org.eclipse.jpt.doc.user/getting_started003.htm105
-rw-r--r--jpa/plugins/org.eclipse.jpt.doc.user/getting_started004.htm204
-rw-r--r--jpa/plugins/org.eclipse.jpt.doc.user/img/address.java_jpa_details.pngbin13804 -> 0 bytes
-rw-r--r--jpa/plugins/org.eclipse.jpt.doc.user/img/address_id_details_quickstart.pngbin11473 -> 0 bytes
-rw-r--r--jpa/plugins/org.eclipse.jpt.doc.user/img/address_java_JPA_structure_quickstart.pngbin4148 -> 0 bytes
-rw-r--r--jpa/plugins/org.eclipse.jpt.doc.user/img/create_jpa_entity_wizard.pngbin21428 -> 0 bytes
-rw-r--r--jpa/plugins/org.eclipse.jpt.doc.user/img/create_jpa_fields.pngbin21454 -> 0 bytes
-rw-r--r--jpa/plugins/org.eclipse.jpt.doc.user/img/customize_default_entity_generation.pngbin27589 -> 0 bytes
-rw-r--r--jpa/plugins/org.eclipse.jpt.doc.user/img/customize_individual_entities.pngbin24998 -> 0 bytes
-rw-r--r--jpa/plugins/org.eclipse.jpt.doc.user/img/details_entitymappings.pngbin5647 -> 0 bytes
-rw-r--r--jpa/plugins/org.eclipse.jpt.doc.user/img/error_sample.pngbin13762 -> 0 bytes
-rw-r--r--jpa/plugins/org.eclipse.jpt.doc.user/img/generate_entities.pngbin11583 -> 0 bytes
-rw-r--r--jpa/plugins/org.eclipse.jpt.doc.user/img/icon_basicmapmappings.pngbin361 -> 0 bytes
-rw-r--r--jpa/plugins/org.eclipse.jpt.doc.user/img/inheritance_join.pngbin11615 -> 0 bytes
-rw-r--r--jpa/plugins/org.eclipse.jpt.doc.user/img/inheritance_single.pngbin3359 -> 0 bytes
-rw-r--r--jpa/plugins/org.eclipse.jpt.doc.user/img/inheritance_tab.pngbin8101 -> 0 bytes
-rw-r--r--jpa/plugins/org.eclipse.jpt.doc.user/img/java_editor_address.pngbin8380 -> 0 bytes
-rw-r--r--jpa/plugins/org.eclipse.jpt.doc.user/img/jpa_wizard_create_fields.pngbin7864 -> 0 bytes
-rw-r--r--jpa/plugins/org.eclipse.jpt.doc.user/img/mapped_entity_type_link.pngbin14896 -> 0 bytes
-rw-r--r--jpa/plugins/org.eclipse.jpt.doc.user/img/mapping_file_new.pngbin19392 -> 0 bytes
-rw-r--r--jpa/plugins/org.eclipse.jpt.doc.user/img/mapping_type_selection_embed.pngbin15081 -> 0 bytes
-rw-r--r--jpa/plugins/org.eclipse.jpt.doc.user/img/mapping_type_selection_entity.pngbin14963 -> 0 bytes
-rw-r--r--jpa/plugins/org.eclipse.jpt.doc.user/img/mapping_type_selection_superclass.pngbin15145 -> 0 bytes
-rw-r--r--jpa/plugins/org.eclipse.jpt.doc.user/img/modify_faceted_project.pngbin29455 -> 0 bytes
-rw-r--r--jpa/plugins/org.eclipse.jpt.doc.user/img/new_icon_basicmappings.pngbin332 -> 0 bytes
-rw-r--r--jpa/plugins/org.eclipse.jpt.doc.user/img/new_icon_embeddableentitymapping.pngbin700 -> 0 bytes
-rw-r--r--jpa/plugins/org.eclipse.jpt.doc.user/img/new_icon_embeddedidmapping.pngbin477 -> 0 bytes
-rw-r--r--jpa/plugins/org.eclipse.jpt.doc.user/img/new_icon_embeddedmapping.pngbin321 -> 0 bytes
-rw-r--r--jpa/plugins/org.eclipse.jpt.doc.user/img/new_icon_idmapping.pngbin461 -> 0 bytes
-rw-r--r--jpa/plugins/org.eclipse.jpt.doc.user/img/new_icon_manytomanymapping.pngbin311 -> 0 bytes
-rw-r--r--jpa/plugins/org.eclipse.jpt.doc.user/img/new_icon_manytoonemapping.pngbin316 -> 0 bytes
-rw-r--r--jpa/plugins/org.eclipse.jpt.doc.user/img/new_icon_mappedentity.pngbin682 -> 0 bytes
-rw-r--r--jpa/plugins/org.eclipse.jpt.doc.user/img/new_icon_mappedsuperclass.pngbin681 -> 0 bytes
-rw-r--r--jpa/plugins/org.eclipse.jpt.doc.user/img/new_icon_onetomanymapping.pngbin325 -> 0 bytes
-rw-r--r--jpa/plugins/org.eclipse.jpt.doc.user/img/new_icon_onetoonemapping.pngbin270 -> 0 bytes
-rw-r--r--jpa/plugins/org.eclipse.jpt.doc.user/img/new_icon_transientmapping.pngbin303 -> 0 bytes
-rw-r--r--jpa/plugins/org.eclipse.jpt.doc.user/img/new_icon_versionmapping.pngbin373 -> 0 bytes
-rw-r--r--jpa/plugins/org.eclipse.jpt.doc.user/img/new_jpa_facet_task.pngbin27810 -> 0 bytes
-rw-r--r--jpa/plugins/org.eclipse.jpt.doc.user/img/new_jpa_perspective_button.pngbin387 -> 0 bytes
-rw-r--r--jpa/plugins/org.eclipse.jpt.doc.user/img/new_jpa_project_task.pngbin26097 -> 0 bytes
-rw-r--r--jpa/plugins/org.eclipse.jpt.doc.user/img/ngrelc.pngbin667 -> 0 bytes
-rw-r--r--jpa/plugins/org.eclipse.jpt.doc.user/img/ngrelr.pngbin615 -> 0 bytes
-rw-r--r--jpa/plugins/org.eclipse.jpt.doc.user/img/ngrelt.pngbin568 -> 0 bytes
-rw-r--r--jpa/plugins/org.eclipse.jpt.doc.user/img/persistence_outline_view.pngbin8746 -> 0 bytes
-rw-r--r--jpa/plugins/org.eclipse.jpt.doc.user/img/project_properties_tasks.pngbin27611 -> 0 bytes
-rw-r--r--jpa/plugins/org.eclipse.jpt.doc.user/img/quickstart_project.pngbin9676 -> 0 bytes
-rw-r--r--jpa/plugins/org.eclipse.jpt.doc.user/img/secondary_tables.pngbin4408 -> 0 bytes
-rw-r--r--jpa/plugins/org.eclipse.jpt.doc.user/img/select_a_wizard_entity.pngbin20222 -> 0 bytes
-rw-r--r--jpa/plugins/org.eclipse.jpt.doc.user/img/select_a_wizard_jpa_project.pngbin20446 -> 0 bytes
-rw-r--r--jpa/plugins/org.eclipse.jpt.doc.user/img/select_a_wizard_mapping.pngbin22231 -> 0 bytes
-rw-r--r--jpa/plugins/org.eclipse.jpt.doc.user/img/select_tables.pngbin21639 -> 0 bytes
-rw-r--r--jpa/plugins/org.eclipse.jpt.doc.user/img/synchornize_classes.pngbin10643 -> 0 bytes
-rw-r--r--jpa/plugins/org.eclipse.jpt.doc.user/img/table_associations.pngbin26207 -> 0 bytes
-rw-r--r--jpa/plugins/org.eclipse.jpt.doc.user/img/table_entity.pngbin9169 -> 0 bytes
-rw-r--r--jpa/plugins/org.eclipse.jpt.doc.user/img/task_entering_query.pngbin8657 -> 0 bytes
-rw-r--r--jpa/plugins/org.eclipse.jpt.doc.user/index.xml315
-rw-r--r--jpa/plugins/org.eclipse.jpt.doc.user/legal.htm40
-rw-r--r--jpa/plugins/org.eclipse.jpt.doc.user/plugin.properties32
-rw-r--r--jpa/plugins/org.eclipse.jpt.doc.user/plugin.xml37
-rw-r--r--jpa/plugins/org.eclipse.jpt.doc.user/ref_EntityClassPage.htm115
-rw-r--r--jpa/plugins/org.eclipse.jpt.doc.user/ref_EntityPropertiesPage.htm117
-rw-r--r--jpa/plugins/org.eclipse.jpt.doc.user/ref_add_converter.htm78
-rw-r--r--jpa/plugins/org.eclipse.jpt.doc.user/ref_association_cardinality.htm65
-rw-r--r--jpa/plugins/org.eclipse.jpt.doc.user/ref_association_table.htm74
-rw-r--r--jpa/plugins/org.eclipse.jpt.doc.user/ref_create_custom_entities_wizard.htm53
-rw-r--r--jpa/plugins/org.eclipse.jpt.doc.user/ref_create_jpa_entity_wizard.htm46
-rw-r--r--jpa/plugins/org.eclipse.jpt.doc.user/ref_create_new_association_wizard.htm50
-rw-r--r--jpa/plugins/org.eclipse.jpt.doc.user/ref_customizIndividualEntities.htm89
-rw-r--r--jpa/plugins/org.eclipse.jpt.doc.user/ref_customizeDefaultEntityGeneration.htm96
-rw-r--r--jpa/plugins/org.eclipse.jpt.doc.user/ref_details_orm.htm56
-rw-r--r--jpa/plugins/org.eclipse.jpt.doc.user/ref_eclipselink_mapping_file.htm81
-rw-r--r--jpa/plugins/org.eclipse.jpt.doc.user/ref_java_page.htm74
-rw-r--r--jpa/plugins/org.eclipse.jpt.doc.user/ref_join_columns.htm50
-rw-r--r--jpa/plugins/org.eclipse.jpt.doc.user/ref_jpa_facet.htm122
-rw-r--r--jpa/plugins/org.eclipse.jpt.doc.user/ref_mapping_general.htm266
-rw-r--r--jpa/plugins/org.eclipse.jpt.doc.user/ref_new_jpa_project.htm104
-rw-r--r--jpa/plugins/org.eclipse.jpt.doc.user/ref_new_jpa_project_wizard.htm49
-rw-r--r--jpa/plugins/org.eclipse.jpt.doc.user/ref_persistence_general.htm119
-rw-r--r--jpa/plugins/org.eclipse.jpt.doc.user/ref_persistence_map_view.htm52
-rw-r--r--jpa/plugins/org.eclipse.jpt.doc.user/ref_persistence_outline.htm49
-rw-r--r--jpa/plugins/org.eclipse.jpt.doc.user/ref_persistence_perspective.htm56
-rw-r--r--jpa/plugins/org.eclipse.jpt.doc.user/ref_persistence_prop_view.htm52
-rw-r--r--jpa/plugins/org.eclipse.jpt.doc.user/ref_persistence_xmll_editor.htm82
-rw-r--r--jpa/plugins/org.eclipse.jpt.doc.user/ref_primary_key.htm142
-rw-r--r--jpa/plugins/org.eclipse.jpt.doc.user/ref_project_properties.htm108
-rw-r--r--jpa/plugins/org.eclipse.jpt.doc.user/ref_selectTables.htm79
-rw-r--r--jpa/plugins/org.eclipse.jpt.doc.user/ref_select_cascade_dialog.htm40
-rw-r--r--jpa/plugins/org.eclipse.jpt.doc.user/ref_tableAssociations.htm78
-rw-r--r--jpa/plugins/org.eclipse.jpt.doc.user/reference.htm60
-rw-r--r--jpa/plugins/org.eclipse.jpt.doc.user/reference001.htm55
-rw-r--r--jpa/plugins/org.eclipse.jpt.doc.user/reference002.htm39
-rw-r--r--jpa/plugins/org.eclipse.jpt.doc.user/reference003.htm134
-rw-r--r--jpa/plugins/org.eclipse.jpt.doc.user/reference004.htm49
-rw-r--r--jpa/plugins/org.eclipse.jpt.doc.user/reference005.htm52
-rw-r--r--jpa/plugins/org.eclipse.jpt.doc.user/reference006.htm102
-rw-r--r--jpa/plugins/org.eclipse.jpt.doc.user/reference007.htm80
-rw-r--r--jpa/plugins/org.eclipse.jpt.doc.user/reference008.htm48
-rw-r--r--jpa/plugins/org.eclipse.jpt.doc.user/reference009.htm113
-rw-r--r--jpa/plugins/org.eclipse.jpt.doc.user/reference010.htm47
-rw-r--r--jpa/plugins/org.eclipse.jpt.doc.user/reference011.htm82
-rw-r--r--jpa/plugins/org.eclipse.jpt.doc.user/reference012.htm71
-rw-r--r--jpa/plugins/org.eclipse.jpt.doc.user/reference013.htm98
-rw-r--r--jpa/plugins/org.eclipse.jpt.doc.user/reference014.htm106
-rw-r--r--jpa/plugins/org.eclipse.jpt.doc.user/reference015.htm95
-rw-r--r--jpa/plugins/org.eclipse.jpt.doc.user/reference016.htm76
-rw-r--r--jpa/plugins/org.eclipse.jpt.doc.user/reference017.htm46
-rw-r--r--jpa/plugins/org.eclipse.jpt.doc.user/reference018.htm183
-rw-r--r--jpa/plugins/org.eclipse.jpt.doc.user/reference019.htm221
-rw-r--r--jpa/plugins/org.eclipse.jpt.doc.user/reference020.htm185
-rw-r--r--jpa/plugins/org.eclipse.jpt.doc.user/reference021.htm241
-rw-r--r--jpa/plugins/org.eclipse.jpt.doc.user/reference022.htm170
-rw-r--r--jpa/plugins/org.eclipse.jpt.doc.user/reference023.htm143
-rw-r--r--jpa/plugins/org.eclipse.jpt.doc.user/reference024.htm41
-rw-r--r--jpa/plugins/org.eclipse.jpt.doc.user/reference025.htm46
-rw-r--r--jpa/plugins/org.eclipse.jpt.doc.user/reference026.htm43
-rw-r--r--jpa/plugins/org.eclipse.jpt.doc.user/reference027.htm49
-rw-r--r--jpa/plugins/org.eclipse.jpt.doc.user/reference028.htm67
-rw-r--r--jpa/plugins/org.eclipse.jpt.doc.user/reference029.htm46
-rw-r--r--jpa/plugins/org.eclipse.jpt.doc.user/reference030.htm125
-rw-r--r--jpa/plugins/org.eclipse.jpt.doc.user/reference031.htm62
-rw-r--r--jpa/plugins/org.eclipse.jpt.doc.user/reference032.htm53
-rw-r--r--jpa/plugins/org.eclipse.jpt.doc.user/task_add_persistence.htm60
-rw-r--r--jpa/plugins/org.eclipse.jpt.doc.user/task_additonal_tables.htm84
-rw-r--r--jpa/plugins/org.eclipse.jpt.doc.user/task_create_jpa_entity.htm160
-rw-r--r--jpa/plugins/org.eclipse.jpt.doc.user/task_create_new_project.htm141
-rw-r--r--jpa/plugins/org.eclipse.jpt.doc.user/task_inheritance.htm138
-rw-r--r--jpa/plugins/org.eclipse.jpt.doc.user/task_manage_orm.htm64
-rw-r--r--jpa/plugins/org.eclipse.jpt.doc.user/task_manage_persistence.htm224
-rw-r--r--jpa/plugins/org.eclipse.jpt.doc.user/task_mapping.htm74
-rw-r--r--jpa/plugins/org.eclipse.jpt.doc.user/tasks.htm75
-rw-r--r--jpa/plugins/org.eclipse.jpt.doc.user/tasks001.htm85
-rw-r--r--jpa/plugins/org.eclipse.jpt.doc.user/tasks002.htm75
-rw-r--r--jpa/plugins/org.eclipse.jpt.doc.user/tasks003.htm58
-rw-r--r--jpa/plugins/org.eclipse.jpt.doc.user/tasks004.htm66
-rw-r--r--jpa/plugins/org.eclipse.jpt.doc.user/tasks005.htm96
-rw-r--r--jpa/plugins/org.eclipse.jpt.doc.user/tasks006.htm70
-rw-r--r--jpa/plugins/org.eclipse.jpt.doc.user/tasks007.htm84
-rw-r--r--jpa/plugins/org.eclipse.jpt.doc.user/tasks008.htm65
-rw-r--r--jpa/plugins/org.eclipse.jpt.doc.user/tasks009.htm185
-rw-r--r--jpa/plugins/org.eclipse.jpt.doc.user/tasks010.htm111
-rw-r--r--jpa/plugins/org.eclipse.jpt.doc.user/tasks011.htm91
-rw-r--r--jpa/plugins/org.eclipse.jpt.doc.user/tasks012.htm176
-rw-r--r--jpa/plugins/org.eclipse.jpt.doc.user/tasks013.htm179
-rw-r--r--jpa/plugins/org.eclipse.jpt.doc.user/tasks014.htm167
-rw-r--r--jpa/plugins/org.eclipse.jpt.doc.user/tasks015.htm197
-rw-r--r--jpa/plugins/org.eclipse.jpt.doc.user/tasks016.htm146
-rw-r--r--jpa/plugins/org.eclipse.jpt.doc.user/tasks017.htm66
-rw-r--r--jpa/plugins/org.eclipse.jpt.doc.user/tasks018.htm137
-rw-r--r--jpa/plugins/org.eclipse.jpt.doc.user/tasks019.htm95
-rw-r--r--jpa/plugins/org.eclipse.jpt.doc.user/tasks020.htm61
-rw-r--r--jpa/plugins/org.eclipse.jpt.doc.user/tasks021.htm54
-rw-r--r--jpa/plugins/org.eclipse.jpt.doc.user/tasks022.htm92
-rw-r--r--jpa/plugins/org.eclipse.jpt.doc.user/tasks023.htm50
-rw-r--r--jpa/plugins/org.eclipse.jpt.doc.user/tasks024.htm63
-rw-r--r--jpa/plugins/org.eclipse.jpt.doc.user/tips_and_tricks.htm68
-rw-r--r--jpa/plugins/org.eclipse.jpt.doc.user/toc.xml145
-rw-r--r--jpa/plugins/org.eclipse.jpt.doc.user/whats_new.htm50
-rw-r--r--jpa/plugins/org.eclipse.jpt.doc.user/whats_new001.htm41
-rw-r--r--jpa/plugins/org.eclipse.jpt.doc.user/whats_new002.htm41
-rw-r--r--jpa/plugins/org.eclipse.jpt.doc.user/whats_new003.htm41
-rw-r--r--jpa/plugins/org.eclipse.jpt.doc.user/whats_new004.htm49
-rw-r--r--jpa/plugins/org.eclipse.jpt.doc.user/whats_new005.htm39
-rw-r--r--jpa/plugins/org.eclipse.jpt.eclipselink.branding/.cvsignore1
-rw-r--r--jpa/plugins/org.eclipse.jpt.eclipselink.branding/.project22
-rw-r--r--jpa/plugins/org.eclipse.jpt.eclipselink.branding/.settings/org.eclipse.core.resources.prefs3
-rw-r--r--jpa/plugins/org.eclipse.jpt.eclipselink.branding/META-INF/MANIFEST.MF7
-rw-r--r--jpa/plugins/org.eclipse.jpt.eclipselink.branding/about.html34
-rw-r--r--jpa/plugins/org.eclipse.jpt.eclipselink.branding/about.ini44
-rw-r--r--jpa/plugins/org.eclipse.jpt.eclipselink.branding/about.mappings6
-rw-r--r--jpa/plugins/org.eclipse.jpt.eclipselink.branding/about.properties24
-rw-r--r--jpa/plugins/org.eclipse.jpt.eclipselink.branding/build.properties17
-rw-r--r--jpa/plugins/org.eclipse.jpt.eclipselink.branding/icons/WTP_icon_x32_v2.pngbin5616 -> 0 bytes
-rw-r--r--jpa/plugins/org.eclipse.jpt.eclipselink.branding/plugin.properties13
-rw-r--r--jpa/plugins/org.eclipse.jpt.eclipselink.core.ddlgen/.classpath8
-rw-r--r--jpa/plugins/org.eclipse.jpt.eclipselink.core.ddlgen/.cvsignore1
-rw-r--r--jpa/plugins/org.eclipse.jpt.eclipselink.core.ddlgen/.project28
-rw-r--r--jpa/plugins/org.eclipse.jpt.eclipselink.core.ddlgen/.settings/org.eclipse.jdt.core.prefs7
-rw-r--r--jpa/plugins/org.eclipse.jpt.eclipselink.core.ddlgen/META-INF/MANIFEST.MF13
-rw-r--r--jpa/plugins/org.eclipse.jpt.eclipselink.core.ddlgen/about.html47
-rw-r--r--jpa/plugins/org.eclipse.jpt.eclipselink.core.ddlgen/build.properties20
-rw-r--r--jpa/plugins/org.eclipse.jpt.eclipselink.core.ddlgen/lib/persistence.jarbin46465 -> 0 bytes
-rw-r--r--jpa/plugins/org.eclipse.jpt.eclipselink.core.ddlgen/plugin.properties24
-rw-r--r--jpa/plugins/org.eclipse.jpt.eclipselink.core.ddlgen/src/org/eclipse/jpt/eclipselink/core/ddlgen/Main.java217
-rw-r--r--jpa/plugins/org.eclipse.jpt.eclipselink.ui/.classpath15
-rw-r--r--jpa/plugins/org.eclipse.jpt.eclipselink.ui/.cvsignore3
-rw-r--r--jpa/plugins/org.eclipse.jpt.eclipselink.ui/.project28
-rw-r--r--jpa/plugins/org.eclipse.jpt.eclipselink.ui/.settings/org.eclipse.core.resources.prefs3
-rw-r--r--jpa/plugins/org.eclipse.jpt.eclipselink.ui/.settings/org.eclipse.jdt.core.prefs7
-rw-r--r--jpa/plugins/org.eclipse.jpt.eclipselink.ui/META-INF/MANIFEST.MF50
-rw-r--r--jpa/plugins/org.eclipse.jpt.eclipselink.ui/about.html34
-rw-r--r--jpa/plugins/org.eclipse.jpt.eclipselink.ui/build.properties20
-rw-r--r--jpa/plugins/org.eclipse.jpt.eclipselink.ui/plugin.properties30
-rw-r--r--jpa/plugins/org.eclipse.jpt.eclipselink.ui/plugin.xml157
-rw-r--r--jpa/plugins/org.eclipse.jpt.eclipselink.ui/property_files/eclipselink_ui.properties334
-rw-r--r--jpa/plugins/org.eclipse.jpt.eclipselink.ui/property_files/eclipselink_ui_mappings.properties153
-rw-r--r--jpa/plugins/org.eclipse.jpt.eclipselink.ui/src/org/eclipse/jpt/eclipselink/ui/JptEclipseLinkUiPlugin.java98
-rw-r--r--jpa/plugins/org.eclipse.jpt.eclipselink.ui/src/org/eclipse/jpt/eclipselink/ui/internal/EclipseLinkHelpContextIds.java57
-rw-r--r--jpa/plugins/org.eclipse.jpt.eclipselink.ui/src/org/eclipse/jpt/eclipselink/ui/internal/EclipseLinkJpaUiFactory.java262
-rw-r--r--jpa/plugins/org.eclipse.jpt.eclipselink.ui/src/org/eclipse/jpt/eclipselink/ui/internal/EclipseLinkUiMessages.java354
-rw-r--r--jpa/plugins/org.eclipse.jpt.eclipselink.ui/src/org/eclipse/jpt/eclipselink/ui/internal/ddlgen/EclipseLinkDDLGeneratorUi.java167
-rw-r--r--jpa/plugins/org.eclipse.jpt.eclipselink.ui/src/org/eclipse/jpt/eclipselink/ui/internal/ddlgen/wizards/GenerateDDLWizard.java56
-rw-r--r--jpa/plugins/org.eclipse.jpt.eclipselink.ui/src/org/eclipse/jpt/eclipselink/ui/internal/java/details/ConvertersComposite.java271
-rw-r--r--jpa/plugins/org.eclipse.jpt.eclipselink.ui/src/org/eclipse/jpt/eclipselink/ui/internal/java/details/DefaultOneToManyMappingUiProvider.java85
-rw-r--r--jpa/plugins/org.eclipse.jpt.eclipselink.ui/src/org/eclipse/jpt/eclipselink/ui/internal/java/details/DefaultOneToOneMappingUiProvider.java85
-rw-r--r--jpa/plugins/org.eclipse.jpt.eclipselink.ui/src/org/eclipse/jpt/eclipselink/ui/internal/java/details/DefaultVariableOneToOneMappingUiProvider.java81
-rw-r--r--jpa/plugins/org.eclipse.jpt.eclipselink.ui/src/org/eclipse/jpt/eclipselink/ui/internal/java/details/EclipseLinkJavaBasicCollectionMappingUiProvider.java56
-rw-r--r--jpa/plugins/org.eclipse.jpt.eclipselink.ui/src/org/eclipse/jpt/eclipselink/ui/internal/java/details/EclipseLinkJavaBasicMapMappingUiProvider.java56
-rw-r--r--jpa/plugins/org.eclipse.jpt.eclipselink.ui/src/org/eclipse/jpt/eclipselink/ui/internal/java/details/EclipseLinkJavaEmbeddableComposite.java79
-rw-r--r--jpa/plugins/org.eclipse.jpt.eclipselink.ui/src/org/eclipse/jpt/eclipselink/ui/internal/java/details/EclipseLinkJavaEntityComposite.java119
-rw-r--r--jpa/plugins/org.eclipse.jpt.eclipselink.ui/src/org/eclipse/jpt/eclipselink/ui/internal/java/details/EclipseLinkJavaMappedSuperclassComposite.java103
-rw-r--r--jpa/plugins/org.eclipse.jpt.eclipselink.ui/src/org/eclipse/jpt/eclipselink/ui/internal/java/details/EclipseLinkJavaTransformationMappingUiProvider.java57
-rw-r--r--jpa/plugins/org.eclipse.jpt.eclipselink.ui/src/org/eclipse/jpt/eclipselink/ui/internal/java/details/EclipseLinkJavaVariableOneToOneMappingUiProvider.java56
-rw-r--r--jpa/plugins/org.eclipse.jpt.eclipselink.ui/src/org/eclipse/jpt/eclipselink/ui/internal/java/details/JavaCachingComposite.java62
-rw-r--r--jpa/plugins/org.eclipse.jpt.eclipselink.ui/src/org/eclipse/jpt/eclipselink/ui/internal/java/details/JavaExistenceCheckingComposite.java128
-rw-r--r--jpa/plugins/org.eclipse.jpt.eclipselink.ui/src/org/eclipse/jpt/eclipselink/ui/internal/mappings/EclipseLinkUiMappingsMessages.java169
-rw-r--r--jpa/plugins/org.eclipse.jpt.eclipselink.ui/src/org/eclipse/jpt/eclipselink/ui/internal/mappings/details/AlwaysRefreshComposite.java102
-rw-r--r--jpa/plugins/org.eclipse.jpt.eclipselink.ui/src/org/eclipse/jpt/eclipselink/ui/internal/mappings/details/BasicCollectionMappingComposite.java45
-rw-r--r--jpa/plugins/org.eclipse.jpt.eclipselink.ui/src/org/eclipse/jpt/eclipselink/ui/internal/mappings/details/BasicMapMappingComposite.java45
-rw-r--r--jpa/plugins/org.eclipse.jpt.eclipselink.ui/src/org/eclipse/jpt/eclipselink/ui/internal/mappings/details/CacheCoordinationTypeComposite.java106
-rw-r--r--jpa/plugins/org.eclipse.jpt.eclipselink.ui/src/org/eclipse/jpt/eclipselink/ui/internal/mappings/details/CacheSizeComposite.java94
-rw-r--r--jpa/plugins/org.eclipse.jpt.eclipselink.ui/src/org/eclipse/jpt/eclipselink/ui/internal/mappings/details/CacheTypeComposite.java106
-rw-r--r--jpa/plugins/org.eclipse.jpt.eclipselink.ui/src/org/eclipse/jpt/eclipselink/ui/internal/mappings/details/CachingComposite.java170
-rw-r--r--jpa/plugins/org.eclipse.jpt.eclipselink.ui/src/org/eclipse/jpt/eclipselink/ui/internal/mappings/details/ChangeTrackingComposite.java108
-rw-r--r--jpa/plugins/org.eclipse.jpt.eclipselink.ui/src/org/eclipse/jpt/eclipselink/ui/internal/mappings/details/ConversionValueDialog.java210
-rw-r--r--jpa/plugins/org.eclipse.jpt.eclipselink.ui/src/org/eclipse/jpt/eclipselink/ui/internal/mappings/details/ConversionValueStateObject.java138
-rw-r--r--jpa/plugins/org.eclipse.jpt.eclipselink.ui/src/org/eclipse/jpt/eclipselink/ui/internal/mappings/details/ConvertComposite.java361
-rw-r--r--jpa/plugins/org.eclipse.jpt.eclipselink.ui/src/org/eclipse/jpt/eclipselink/ui/internal/mappings/details/CustomConverterComposite.java156
-rw-r--r--jpa/plugins/org.eclipse.jpt.eclipselink.ui/src/org/eclipse/jpt/eclipselink/ui/internal/mappings/details/CustomizerComposite.java105
-rw-r--r--jpa/plugins/org.eclipse.jpt.eclipselink.ui/src/org/eclipse/jpt/eclipselink/ui/internal/mappings/details/DisableHitsComposite.java101
-rw-r--r--jpa/plugins/org.eclipse.jpt.eclipselink.ui/src/org/eclipse/jpt/eclipselink/ui/internal/mappings/details/EclipseLinkBasicCollectionMappingUiProvider.java42
-rw-r--r--jpa/plugins/org.eclipse.jpt.eclipselink.ui/src/org/eclipse/jpt/eclipselink/ui/internal/mappings/details/EclipseLinkBasicMapMappingUiProvider.java44
-rw-r--r--jpa/plugins/org.eclipse.jpt.eclipselink.ui/src/org/eclipse/jpt/eclipselink/ui/internal/mappings/details/EclipseLinkBasicMappingComposite.java282
-rw-r--r--jpa/plugins/org.eclipse.jpt.eclipselink.ui/src/org/eclipse/jpt/eclipselink/ui/internal/mappings/details/EclipseLinkEmbeddableAdvancedComposite.java59
-rw-r--r--jpa/plugins/org.eclipse.jpt.eclipselink.ui/src/org/eclipse/jpt/eclipselink/ui/internal/mappings/details/EclipseLinkEntityAdvancedComposite.java70
-rw-r--r--jpa/plugins/org.eclipse.jpt.eclipselink.ui/src/org/eclipse/jpt/eclipselink/ui/internal/mappings/details/EclipseLinkIdMappingComposite.java252
-rw-r--r--jpa/plugins/org.eclipse.jpt.eclipselink.ui/src/org/eclipse/jpt/eclipselink/ui/internal/mappings/details/EclipseLinkManyToManyMappingComposite.java133
-rw-r--r--jpa/plugins/org.eclipse.jpt.eclipselink.ui/src/org/eclipse/jpt/eclipselink/ui/internal/mappings/details/EclipseLinkManyToOneMappingComposite.java132
-rw-r--r--jpa/plugins/org.eclipse.jpt.eclipselink.ui/src/org/eclipse/jpt/eclipselink/ui/internal/mappings/details/EclipseLinkMappedSuperclassAdvancedComposite.java70
-rw-r--r--jpa/plugins/org.eclipse.jpt.eclipselink.ui/src/org/eclipse/jpt/eclipselink/ui/internal/mappings/details/EclipseLinkOneToManyJoiningStrategyPane.java48
-rw-r--r--jpa/plugins/org.eclipse.jpt.eclipselink.ui/src/org/eclipse/jpt/eclipselink/ui/internal/mappings/details/EclipseLinkOneToManyMappingComposite.java148
-rw-r--r--jpa/plugins/org.eclipse.jpt.eclipselink.ui/src/org/eclipse/jpt/eclipselink/ui/internal/mappings/details/EclipseLinkOneToOneMappingComposite.java103
-rw-r--r--jpa/plugins/org.eclipse.jpt.eclipselink.ui/src/org/eclipse/jpt/eclipselink/ui/internal/mappings/details/EclipseLinkTransformationMappingUiProvider.java43
-rw-r--r--jpa/plugins/org.eclipse.jpt.eclipselink.ui/src/org/eclipse/jpt/eclipselink/ui/internal/mappings/details/EclipseLinkVariableOneToOneMappingUiProvider.java42
-rw-r--r--jpa/plugins/org.eclipse.jpt.eclipselink.ui/src/org/eclipse/jpt/eclipselink/ui/internal/mappings/details/EclipseLinkVersionMappingComposite.java246
-rw-r--r--jpa/plugins/org.eclipse.jpt.eclipselink.ui/src/org/eclipse/jpt/eclipselink/ui/internal/mappings/details/ExpiryComposite.java326
-rw-r--r--jpa/plugins/org.eclipse.jpt.eclipselink.ui/src/org/eclipse/jpt/eclipselink/ui/internal/mappings/details/JoinFetchComposite.java113
-rw-r--r--jpa/plugins/org.eclipse.jpt.eclipselink.ui/src/org/eclipse/jpt/eclipselink/ui/internal/mappings/details/MutableComposite.java101
-rw-r--r--jpa/plugins/org.eclipse.jpt.eclipselink.ui/src/org/eclipse/jpt/eclipselink/ui/internal/mappings/details/ObjectTypeConverterComposite.java482
-rw-r--r--jpa/plugins/org.eclipse.jpt.eclipselink.ui/src/org/eclipse/jpt/eclipselink/ui/internal/mappings/details/PrivateOwnedComposite.java67
-rw-r--r--jpa/plugins/org.eclipse.jpt.eclipselink.ui/src/org/eclipse/jpt/eclipselink/ui/internal/mappings/details/ReadOnlyComposite.java103
-rw-r--r--jpa/plugins/org.eclipse.jpt.eclipselink.ui/src/org/eclipse/jpt/eclipselink/ui/internal/mappings/details/RefreshOnlyIfNewerComposite.java103
-rw-r--r--jpa/plugins/org.eclipse.jpt.eclipselink.ui/src/org/eclipse/jpt/eclipselink/ui/internal/mappings/details/StructConverterComposite.java152
-rw-r--r--jpa/plugins/org.eclipse.jpt.eclipselink.ui/src/org/eclipse/jpt/eclipselink/ui/internal/mappings/details/TransformationMappingComposite.java45
-rw-r--r--jpa/plugins/org.eclipse.jpt.eclipselink.ui/src/org/eclipse/jpt/eclipselink/ui/internal/mappings/details/TypeConverterComposite.java199
-rw-r--r--jpa/plugins/org.eclipse.jpt.eclipselink.ui/src/org/eclipse/jpt/eclipselink/ui/internal/mappings/details/VariableOneToOneMappingComposite.java45
-rw-r--r--jpa/plugins/org.eclipse.jpt.eclipselink.ui/src/org/eclipse/jpt/eclipselink/ui/internal/orm/details/ConvertersComposite.java407
-rw-r--r--jpa/plugins/org.eclipse.jpt.eclipselink.ui/src/org/eclipse/jpt/eclipselink/ui/internal/orm/details/EclipseLinkConverterDialog.java195
-rw-r--r--jpa/plugins/org.eclipse.jpt.eclipselink.ui/src/org/eclipse/jpt/eclipselink/ui/internal/orm/details/EclipseLinkConverterStateObject.java125
-rw-r--r--jpa/plugins/org.eclipse.jpt.eclipselink.ui/src/org/eclipse/jpt/eclipselink/ui/internal/orm/details/EclipseLinkEntityMappingsDetailsProvider.java64
-rw-r--r--jpa/plugins/org.eclipse.jpt.eclipselink.ui/src/org/eclipse/jpt/eclipselink/ui/internal/orm/details/EclipseLinkOrmBasicCollectionMappingUiProvider.java56
-rw-r--r--jpa/plugins/org.eclipse.jpt.eclipselink.ui/src/org/eclipse/jpt/eclipselink/ui/internal/orm/details/EclipseLinkOrmBasicMapMappingUiProvider.java56
-rw-r--r--jpa/plugins/org.eclipse.jpt.eclipselink.ui/src/org/eclipse/jpt/eclipselink/ui/internal/orm/details/EclipseLinkOrmBasicMappingComposite.java44
-rw-r--r--jpa/plugins/org.eclipse.jpt.eclipselink.ui/src/org/eclipse/jpt/eclipselink/ui/internal/orm/details/EclipseLinkOrmBasicMappingUiProvider.java57
-rw-r--r--jpa/plugins/org.eclipse.jpt.eclipselink.ui/src/org/eclipse/jpt/eclipselink/ui/internal/orm/details/EclipseLinkOrmEmbeddableComposite.java100
-rw-r--r--jpa/plugins/org.eclipse.jpt.eclipselink.ui/src/org/eclipse/jpt/eclipselink/ui/internal/orm/details/EclipseLinkOrmEmbeddableUiProvider.java57
-rw-r--r--jpa/plugins/org.eclipse.jpt.eclipselink.ui/src/org/eclipse/jpt/eclipselink/ui/internal/orm/details/EclipseLinkOrmEmbeddedIdMappingUiProvider.java57
-rw-r--r--jpa/plugins/org.eclipse.jpt.eclipselink.ui/src/org/eclipse/jpt/eclipselink/ui/internal/orm/details/EclipseLinkOrmEmbeddedMappingUiProvider.java57
-rw-r--r--jpa/plugins/org.eclipse.jpt.eclipselink.ui/src/org/eclipse/jpt/eclipselink/ui/internal/orm/details/EclipseLinkOrmEntityComposite.java127
-rw-r--r--jpa/plugins/org.eclipse.jpt.eclipselink.ui/src/org/eclipse/jpt/eclipselink/ui/internal/orm/details/EclipseLinkOrmEntityUiProvider.java57
-rw-r--r--jpa/plugins/org.eclipse.jpt.eclipselink.ui/src/org/eclipse/jpt/eclipselink/ui/internal/orm/details/EclipseLinkOrmIdMappingComposite.java43
-rw-r--r--jpa/plugins/org.eclipse.jpt.eclipselink.ui/src/org/eclipse/jpt/eclipselink/ui/internal/orm/details/EclipseLinkOrmIdMappingUiProvider.java56
-rw-r--r--jpa/plugins/org.eclipse.jpt.eclipselink.ui/src/org/eclipse/jpt/eclipselink/ui/internal/orm/details/EclipseLinkOrmManyToManyMappingUiProvider.java57
-rw-r--r--jpa/plugins/org.eclipse.jpt.eclipselink.ui/src/org/eclipse/jpt/eclipselink/ui/internal/orm/details/EclipseLinkOrmManyToOneMappingUiProvider.java57
-rw-r--r--jpa/plugins/org.eclipse.jpt.eclipselink.ui/src/org/eclipse/jpt/eclipselink/ui/internal/orm/details/EclipseLinkOrmMappedSuperclassComposite.java108
-rw-r--r--jpa/plugins/org.eclipse.jpt.eclipselink.ui/src/org/eclipse/jpt/eclipselink/ui/internal/orm/details/EclipseLinkOrmMappedSuperclassUiProvider.java53
-rw-r--r--jpa/plugins/org.eclipse.jpt.eclipselink.ui/src/org/eclipse/jpt/eclipselink/ui/internal/orm/details/EclipseLinkOrmOneToManyMappingUiProvider.java57
-rw-r--r--jpa/plugins/org.eclipse.jpt.eclipselink.ui/src/org/eclipse/jpt/eclipselink/ui/internal/orm/details/EclipseLinkOrmOneToOneMappingUiProvider.java57
-rw-r--r--jpa/plugins/org.eclipse.jpt.eclipselink.ui/src/org/eclipse/jpt/eclipselink/ui/internal/orm/details/EclipseLinkOrmTransformationMappingUiProvider.java57
-rw-r--r--jpa/plugins/org.eclipse.jpt.eclipselink.ui/src/org/eclipse/jpt/eclipselink/ui/internal/orm/details/EclipseLinkOrmTransientMappingUiProvider.java57
-rw-r--r--jpa/plugins/org.eclipse.jpt.eclipselink.ui/src/org/eclipse/jpt/eclipselink/ui/internal/orm/details/EclipseLinkOrmVariableOneToOneMappingUiProvider.java56
-rw-r--r--jpa/plugins/org.eclipse.jpt.eclipselink.ui/src/org/eclipse/jpt/eclipselink/ui/internal/orm/details/EclipseLinkOrmVersionMappingComposite.java45
-rw-r--r--jpa/plugins/org.eclipse.jpt.eclipselink.ui/src/org/eclipse/jpt/eclipselink/ui/internal/orm/details/EclipseLinkOrmVersionMappingUiProvider.java56
-rw-r--r--jpa/plugins/org.eclipse.jpt.eclipselink.ui/src/org/eclipse/jpt/eclipselink/ui/internal/orm/details/EntityMappingsDetailsPage.java167
-rw-r--r--jpa/plugins/org.eclipse.jpt.eclipselink.ui/src/org/eclipse/jpt/eclipselink/ui/internal/orm/details/OrmCachingComposite.java62
-rw-r--r--jpa/plugins/org.eclipse.jpt.eclipselink.ui/src/org/eclipse/jpt/eclipselink/ui/internal/orm/details/OrmConvertComposite.java220
-rw-r--r--jpa/plugins/org.eclipse.jpt.eclipselink.ui/src/org/eclipse/jpt/eclipselink/ui/internal/orm/details/OrmExistenceCheckingComposite.java106
-rw-r--r--jpa/plugins/org.eclipse.jpt.eclipselink.ui/src/org/eclipse/jpt/eclipselink/ui/internal/persistence/caching/CacheSizeComposite.java109
-rw-r--r--jpa/plugins/org.eclipse.jpt.eclipselink.ui/src/org/eclipse/jpt/eclipselink/ui/internal/persistence/caching/CacheTypeComposite.java170
-rw-r--r--jpa/plugins/org.eclipse.jpt.eclipselink.ui/src/org/eclipse/jpt/eclipselink/ui/internal/persistence/caching/DefaultCacheSizeComposite.java87
-rw-r--r--jpa/plugins/org.eclipse.jpt.eclipselink.ui/src/org/eclipse/jpt/eclipselink/ui/internal/persistence/caching/DefaultCacheTypeComposite.java91
-rw-r--r--jpa/plugins/org.eclipse.jpt.eclipselink.ui/src/org/eclipse/jpt/eclipselink/ui/internal/persistence/caching/DefaultSharedCacheComposite.java95
-rw-r--r--jpa/plugins/org.eclipse.jpt.eclipselink.ui/src/org/eclipse/jpt/eclipselink/ui/internal/persistence/caching/EclipseLinkCachingComposite.java60
-rw-r--r--jpa/plugins/org.eclipse.jpt.eclipselink.ui/src/org/eclipse/jpt/eclipselink/ui/internal/persistence/caching/EntityCachingPropertyComposite.java53
-rw-r--r--jpa/plugins/org.eclipse.jpt.eclipselink.ui/src/org/eclipse/jpt/eclipselink/ui/internal/persistence/caching/EntityListComposite.java218
-rw-r--r--jpa/plugins/org.eclipse.jpt.eclipselink.ui/src/org/eclipse/jpt/eclipselink/ui/internal/persistence/caching/FlushClearCacheComposite.java91
-rw-r--r--jpa/plugins/org.eclipse.jpt.eclipselink.ui/src/org/eclipse/jpt/eclipselink/ui/internal/persistence/caching/PersistenceXmlCachingTab.java87
-rw-r--r--jpa/plugins/org.eclipse.jpt.eclipselink.ui/src/org/eclipse/jpt/eclipselink/ui/internal/persistence/caching/SharedCacheComposite.java163
-rw-r--r--jpa/plugins/org.eclipse.jpt.eclipselink.ui/src/org/eclipse/jpt/eclipselink/ui/internal/persistence/connection/BatchWritingComposite.java87
-rw-r--r--jpa/plugins/org.eclipse.jpt.eclipselink.ui/src/org/eclipse/jpt/eclipselink/ui/internal/persistence/connection/CacheStatementsPropertiesComposite.java132
-rw-r--r--jpa/plugins/org.eclipse.jpt.eclipselink.ui/src/org/eclipse/jpt/eclipselink/ui/internal/persistence/connection/ConnectionPropertiesComposite.java38
-rw-r--r--jpa/plugins/org.eclipse.jpt.eclipselink.ui/src/org/eclipse/jpt/eclipselink/ui/internal/persistence/connection/DataSourcePropertiesComposite.java152
-rw-r--r--jpa/plugins/org.eclipse.jpt.eclipselink.ui/src/org/eclipse/jpt/eclipselink/ui/internal/persistence/connection/EclipseLinkConnectionComposite.java55
-rw-r--r--jpa/plugins/org.eclipse.jpt.eclipselink.ui/src/org/eclipse/jpt/eclipselink/ui/internal/persistence/connection/JdbcBindParametersComposite.java96
-rw-r--r--jpa/plugins/org.eclipse.jpt.eclipselink.ui/src/org/eclipse/jpt/eclipselink/ui/internal/persistence/connection/JdbcConnectionPropertiesComposite.java340
-rw-r--r--jpa/plugins/org.eclipse.jpt.eclipselink.ui/src/org/eclipse/jpt/eclipselink/ui/internal/persistence/connection/JdbcDriverComposite.java93
-rw-r--r--jpa/plugins/org.eclipse.jpt.eclipselink.ui/src/org/eclipse/jpt/eclipselink/ui/internal/persistence/connection/JdbcPropertiesComposite.java86
-rw-r--r--jpa/plugins/org.eclipse.jpt.eclipselink.ui/src/org/eclipse/jpt/eclipselink/ui/internal/persistence/connection/JdbcReadConnectionPropertiesComposite.java52
-rw-r--r--jpa/plugins/org.eclipse.jpt.eclipselink.ui/src/org/eclipse/jpt/eclipselink/ui/internal/persistence/connection/JdbcReadConnectionsMaxComposite.java86
-rw-r--r--jpa/plugins/org.eclipse.jpt.eclipselink.ui/src/org/eclipse/jpt/eclipselink/ui/internal/persistence/connection/JdbcReadConnectionsMinComposite.java85
-rw-r--r--jpa/plugins/org.eclipse.jpt.eclipselink.ui/src/org/eclipse/jpt/eclipselink/ui/internal/persistence/connection/JdbcReadConnectionsSharedComposite.java97
-rw-r--r--jpa/plugins/org.eclipse.jpt.eclipselink.ui/src/org/eclipse/jpt/eclipselink/ui/internal/persistence/connection/JdbcWriteConnectionPropertiesComposite.java58
-rw-r--r--jpa/plugins/org.eclipse.jpt.eclipselink.ui/src/org/eclipse/jpt/eclipselink/ui/internal/persistence/connection/JdbcWriteConnectionsMaxComposite.java85
-rw-r--r--jpa/plugins/org.eclipse.jpt.eclipselink.ui/src/org/eclipse/jpt/eclipselink/ui/internal/persistence/connection/JdbcWriteConnectionsMinComposite.java85
-rw-r--r--jpa/plugins/org.eclipse.jpt.eclipselink.ui/src/org/eclipse/jpt/eclipselink/ui/internal/persistence/connection/NativeSqlComposite.java97
-rw-r--r--jpa/plugins/org.eclipse.jpt.eclipselink.ui/src/org/eclipse/jpt/eclipselink/ui/internal/persistence/connection/PersistenceXmlConnectionTab.java84
-rw-r--r--jpa/plugins/org.eclipse.jpt.eclipselink.ui/src/org/eclipse/jpt/eclipselink/ui/internal/persistence/connection/TransactionTypeComposite.java127
-rw-r--r--jpa/plugins/org.eclipse.jpt.eclipselink.ui/src/org/eclipse/jpt/eclipselink/ui/internal/persistence/customization/CustomizerComposite.java103
-rw-r--r--jpa/plugins/org.eclipse.jpt.eclipselink.ui/src/org/eclipse/jpt/eclipselink/ui/internal/persistence/customization/EclipseLinkCustomizationComposite.java86
-rw-r--r--jpa/plugins/org.eclipse.jpt.eclipselink.ui/src/org/eclipse/jpt/eclipselink/ui/internal/persistence/customization/EntityCustomizationPropertyComposite.java47
-rw-r--r--jpa/plugins/org.eclipse.jpt.eclipselink.ui/src/org/eclipse/jpt/eclipselink/ui/internal/persistence/customization/EntityListComposite.java227
-rw-r--r--jpa/plugins/org.eclipse.jpt.eclipselink.ui/src/org/eclipse/jpt/eclipselink/ui/internal/persistence/customization/ExceptionHandlerComposite.java93
-rw-r--r--jpa/plugins/org.eclipse.jpt.eclipselink.ui/src/org/eclipse/jpt/eclipselink/ui/internal/persistence/customization/PersistenceXmlCustomizationTab.java88
-rw-r--r--jpa/plugins/org.eclipse.jpt.eclipselink.ui/src/org/eclipse/jpt/eclipselink/ui/internal/persistence/customization/ProfilerComposite.java207
-rw-r--r--jpa/plugins/org.eclipse.jpt.eclipselink.ui/src/org/eclipse/jpt/eclipselink/ui/internal/persistence/customization/SessionCustomizersComposite.java213
-rw-r--r--jpa/plugins/org.eclipse.jpt.eclipselink.ui/src/org/eclipse/jpt/eclipselink/ui/internal/persistence/customization/ThrowExceptionsComposite.java96
-rw-r--r--jpa/plugins/org.eclipse.jpt.eclipselink.ui/src/org/eclipse/jpt/eclipselink/ui/internal/persistence/customization/ValidationOnlyComposite.java96
-rw-r--r--jpa/plugins/org.eclipse.jpt.eclipselink.ui/src/org/eclipse/jpt/eclipselink/ui/internal/persistence/customization/WeavingChangeTrackingComposite.java96
-rw-r--r--jpa/plugins/org.eclipse.jpt.eclipselink.ui/src/org/eclipse/jpt/eclipselink/ui/internal/persistence/customization/WeavingComposite.java87
-rw-r--r--jpa/plugins/org.eclipse.jpt.eclipselink.ui/src/org/eclipse/jpt/eclipselink/ui/internal/persistence/customization/WeavingEagerComposite.java96
-rw-r--r--jpa/plugins/org.eclipse.jpt.eclipselink.ui/src/org/eclipse/jpt/eclipselink/ui/internal/persistence/customization/WeavingFetchGroupsComposite.java96
-rw-r--r--jpa/plugins/org.eclipse.jpt.eclipselink.ui/src/org/eclipse/jpt/eclipselink/ui/internal/persistence/customization/WeavingInternalComposite.java97
-rw-r--r--jpa/plugins/org.eclipse.jpt.eclipselink.ui/src/org/eclipse/jpt/eclipselink/ui/internal/persistence/customization/WeavingLazyComposite.java96
-rw-r--r--jpa/plugins/org.eclipse.jpt.eclipselink.ui/src/org/eclipse/jpt/eclipselink/ui/internal/persistence/general/EclipseLinkPersistenceUnitGeneralComposite.java68
-rw-r--r--jpa/plugins/org.eclipse.jpt.eclipselink.ui/src/org/eclipse/jpt/eclipselink/ui/internal/persistence/general/EclipseLinkPersistenceUnitJarFilesComposite.java53
-rw-r--r--jpa/plugins/org.eclipse.jpt.eclipselink.ui/src/org/eclipse/jpt/eclipselink/ui/internal/persistence/general/EclipseLinkPersistenceUnitMappingFilesComposite.java123
-rw-r--r--jpa/plugins/org.eclipse.jpt.eclipselink.ui/src/org/eclipse/jpt/eclipselink/ui/internal/persistence/logging/EclipseLinkLoggingComposite.java77
-rw-r--r--jpa/plugins/org.eclipse.jpt.eclipselink.ui/src/org/eclipse/jpt/eclipselink/ui/internal/persistence/logging/ExceptionsComposite.java96
-rw-r--r--jpa/plugins/org.eclipse.jpt.eclipselink.ui/src/org/eclipse/jpt/eclipselink/ui/internal/persistence/logging/LoggerComposite.java207
-rw-r--r--jpa/plugins/org.eclipse.jpt.eclipselink.ui/src/org/eclipse/jpt/eclipselink/ui/internal/persistence/logging/LoggingFileLocationComposite.java92
-rw-r--r--jpa/plugins/org.eclipse.jpt.eclipselink.ui/src/org/eclipse/jpt/eclipselink/ui/internal/persistence/logging/LoggingLevelComposite.java90
-rw-r--r--jpa/plugins/org.eclipse.jpt.eclipselink.ui/src/org/eclipse/jpt/eclipselink/ui/internal/persistence/logging/PersistenceXmlLoggingTab.java84
-rw-r--r--jpa/plugins/org.eclipse.jpt.eclipselink.ui/src/org/eclipse/jpt/eclipselink/ui/internal/persistence/logging/SessionComposite.java97
-rw-r--r--jpa/plugins/org.eclipse.jpt.eclipselink.ui/src/org/eclipse/jpt/eclipselink/ui/internal/persistence/logging/ThreadComposite.java96
-rw-r--r--jpa/plugins/org.eclipse.jpt.eclipselink.ui/src/org/eclipse/jpt/eclipselink/ui/internal/persistence/logging/TimestampComposite.java95
-rw-r--r--jpa/plugins/org.eclipse.jpt.eclipselink.ui/src/org/eclipse/jpt/eclipselink/ui/internal/persistence/options/EclipseLinkOptionsComposite.java83
-rw-r--r--jpa/plugins/org.eclipse.jpt.eclipselink.ui/src/org/eclipse/jpt/eclipselink/ui/internal/persistence/options/EventListenerComposite.java93
-rw-r--r--jpa/plugins/org.eclipse.jpt.eclipselink.ui/src/org/eclipse/jpt/eclipselink/ui/internal/persistence/options/IncludeDescriptorQueriesComposite.java96
-rw-r--r--jpa/plugins/org.eclipse.jpt.eclipselink.ui/src/org/eclipse/jpt/eclipselink/ui/internal/persistence/options/PersistenceXmlOptionsTab.java84
-rw-r--r--jpa/plugins/org.eclipse.jpt.eclipselink.ui/src/org/eclipse/jpt/eclipselink/ui/internal/persistence/options/SessionNameComposite.java111
-rw-r--r--jpa/plugins/org.eclipse.jpt.eclipselink.ui/src/org/eclipse/jpt/eclipselink/ui/internal/persistence/options/SessionsXmlComposite.java111
-rw-r--r--jpa/plugins/org.eclipse.jpt.eclipselink.ui/src/org/eclipse/jpt/eclipselink/ui/internal/persistence/options/TargetDatabaseComposite.java187
-rw-r--r--jpa/plugins/org.eclipse.jpt.eclipselink.ui/src/org/eclipse/jpt/eclipselink/ui/internal/persistence/options/TargetServerComposite.java187
-rw-r--r--jpa/plugins/org.eclipse.jpt.eclipselink.ui/src/org/eclipse/jpt/eclipselink/ui/internal/persistence/options/TemporalMutableComposite.java96
-rw-r--r--jpa/plugins/org.eclipse.jpt.eclipselink.ui/src/org/eclipse/jpt/eclipselink/ui/internal/persistence/schema/generation/CreateDdlFileNameComposite.java111
-rw-r--r--jpa/plugins/org.eclipse.jpt.eclipselink.ui/src/org/eclipse/jpt/eclipselink/ui/internal/persistence/schema/generation/DdlGenerationLocationComposite.java92
-rw-r--r--jpa/plugins/org.eclipse.jpt.eclipselink.ui/src/org/eclipse/jpt/eclipselink/ui/internal/persistence/schema/generation/DdlGenerationTypeComposite.java87
-rw-r--r--jpa/plugins/org.eclipse.jpt.eclipselink.ui/src/org/eclipse/jpt/eclipselink/ui/internal/persistence/schema/generation/DropDdlFileNameComposite.java111
-rw-r--r--jpa/plugins/org.eclipse.jpt.eclipselink.ui/src/org/eclipse/jpt/eclipselink/ui/internal/persistence/schema/generation/EclipseLinkSchemaGenerationComposite.java49
-rw-r--r--jpa/plugins/org.eclipse.jpt.eclipselink.ui/src/org/eclipse/jpt/eclipselink/ui/internal/persistence/schema/generation/OutputModeComposite.java85
-rw-r--r--jpa/plugins/org.eclipse.jpt.eclipselink.ui/src/org/eclipse/jpt/eclipselink/ui/internal/persistence/schema/generation/PersistenceXmlSchemaGenerationTab.java56
-rw-r--r--jpa/plugins/org.eclipse.jpt.eclipselink.ui/src/org/eclipse/jpt/eclipselink/ui/internal/persistencexml/details/EclipseLinkNavigatorItemContentProviderFactory.java94
-rw-r--r--jpa/plugins/org.eclipse.jpt.eclipselink.ui/src/org/eclipse/jpt/eclipselink/ui/internal/persistencexml/details/EclipseLinkNavigatorItemLabelProviderFactory.java23
-rw-r--r--jpa/plugins/org.eclipse.jpt.eclipselink.ui/src/org/eclipse/jpt/eclipselink/ui/internal/platform/EclipseLinkJpaPlatformUi.java40
-rw-r--r--jpa/plugins/org.eclipse.jpt.eclipselink.ui/src/org/eclipse/jpt/eclipselink/ui/internal/platform/EclipseLinkJpaPlatformUiFactory.java39
-rw-r--r--jpa/plugins/org.eclipse.jpt.eclipselink.ui/src/org/eclipse/jpt/eclipselink/ui/internal/platform/EclipseLinkJpaPlatformUiProvider.java132
-rw-r--r--jpa/plugins/org.eclipse.jpt.eclipselink.ui/src/org/eclipse/jpt/eclipselink/ui/internal/platform/EclipseLinkNavigatorProvider.java34
-rw-r--r--jpa/plugins/org.eclipse.jpt.eclipselink.ui/src/org/eclipse/jpt/eclipselink/ui/internal/structure/EclipseLinkOrmResourceModelStructureProvider.java52
-rw-r--r--jpa/plugins/org.eclipse.jpt.eclipselink.ui/src/org/eclipse/jpt/eclipselink/ui/internal/structure/EclipseLinkPersistenceItemContentProviderFactory.java137
-rw-r--r--jpa/plugins/org.eclipse.jpt.eclipselink.ui/src/org/eclipse/jpt/eclipselink/ui/internal/structure/EclipseLinkPersistenceResourceModelStructureProvider.java51
-rw-r--r--jpa/plugins/org.eclipse.jpt.eclipselink.ui/src/org/eclipse/jpt/eclipselink/ui/internal/wizards/EclipseLinkMappingFileWizard.java46
-rw-r--r--jpa/plugins/org.eclipse.jpt.eclipselink.ui/src/org/eclipse/jpt/eclipselink/ui/internal/wizards/EclipseLinkMappingFileWizardPage.java24
-rw-r--r--jpa/plugins/org.eclipse.jpt.eclipselink.ui/src/org/eclipse/jpt/eclipselink1_1/ui/internal/EclipseLink1_1JpaUiFactory.java54
-rw-r--r--jpa/plugins/org.eclipse.jpt.eclipselink.ui/src/org/eclipse/jpt/eclipselink1_1/ui/internal/java/details/EclipseLink1_1JavaEmbeddableComposite.java98
-rw-r--r--jpa/plugins/org.eclipse.jpt.eclipselink.ui/src/org/eclipse/jpt/eclipselink1_1/ui/internal/java/details/EclipseLink1_1JavaEntityComposite.java147
-rw-r--r--jpa/plugins/org.eclipse.jpt.eclipselink.ui/src/org/eclipse/jpt/eclipselink1_1/ui/internal/java/details/EclipseLink1_1JavaMappedSuperclassComposite.java123
-rw-r--r--jpa/plugins/org.eclipse.jpt.eclipselink.ui/src/org/eclipse/jpt/eclipselink1_1/ui/internal/orm/details/EclipseLink1_1OrmBasicCollectionMappingComposite.java57
-rw-r--r--jpa/plugins/org.eclipse.jpt.eclipselink.ui/src/org/eclipse/jpt/eclipselink1_1/ui/internal/orm/details/EclipseLink1_1OrmBasicCollectionMappingUiProvider.java55
-rw-r--r--jpa/plugins/org.eclipse.jpt.eclipselink.ui/src/org/eclipse/jpt/eclipselink1_1/ui/internal/orm/details/EclipseLink1_1OrmBasicMapMappingComposite.java57
-rw-r--r--jpa/plugins/org.eclipse.jpt.eclipselink.ui/src/org/eclipse/jpt/eclipselink1_1/ui/internal/orm/details/EclipseLink1_1OrmBasicMapMappingUiProvider.java55
-rw-r--r--jpa/plugins/org.eclipse.jpt.eclipselink.ui/src/org/eclipse/jpt/eclipselink1_1/ui/internal/orm/details/EclipseLink1_1OrmBasicMappingComposite.java67
-rw-r--r--jpa/plugins/org.eclipse.jpt.eclipselink.ui/src/org/eclipse/jpt/eclipselink1_1/ui/internal/orm/details/EclipseLink1_1OrmBasicMappingUiProvider.java57
-rw-r--r--jpa/plugins/org.eclipse.jpt.eclipselink.ui/src/org/eclipse/jpt/eclipselink1_1/ui/internal/orm/details/EclipseLink1_1OrmEmbeddableComposite.java101
-rw-r--r--jpa/plugins/org.eclipse.jpt.eclipselink.ui/src/org/eclipse/jpt/eclipselink1_1/ui/internal/orm/details/EclipseLink1_1OrmEmbeddableUiProvider.java58
-rw-r--r--jpa/plugins/org.eclipse.jpt.eclipselink.ui/src/org/eclipse/jpt/eclipselink1_1/ui/internal/orm/details/EclipseLink1_1OrmEmbeddedIdMappingComposite.java75
-rw-r--r--jpa/plugins/org.eclipse.jpt.eclipselink.ui/src/org/eclipse/jpt/eclipselink1_1/ui/internal/orm/details/EclipseLink1_1OrmEmbeddedIdMappingUiProvider.java57
-rw-r--r--jpa/plugins/org.eclipse.jpt.eclipselink.ui/src/org/eclipse/jpt/eclipselink1_1/ui/internal/orm/details/EclipseLink1_1OrmEmbeddedMappingComposite.java76
-rw-r--r--jpa/plugins/org.eclipse.jpt.eclipselink.ui/src/org/eclipse/jpt/eclipselink1_1/ui/internal/orm/details/EclipseLink1_1OrmEmbeddedMappingUiProvider.java57
-rw-r--r--jpa/plugins/org.eclipse.jpt.eclipselink.ui/src/org/eclipse/jpt/eclipselink1_1/ui/internal/orm/details/EclipseLink1_1OrmEntityUiProvider.java58
-rw-r--r--jpa/plugins/org.eclipse.jpt.eclipselink.ui/src/org/eclipse/jpt/eclipselink1_1/ui/internal/orm/details/EclipseLink1_1OrmIdMappingComposite.java62
-rw-r--r--jpa/plugins/org.eclipse.jpt.eclipselink.ui/src/org/eclipse/jpt/eclipselink1_1/ui/internal/orm/details/EclipseLink1_1OrmIdMappingUiProvider.java56
-rw-r--r--jpa/plugins/org.eclipse.jpt.eclipselink.ui/src/org/eclipse/jpt/eclipselink1_1/ui/internal/orm/details/EclipseLink1_1OrmManyToManyMappingComposite.java106
-rw-r--r--jpa/plugins/org.eclipse.jpt.eclipselink.ui/src/org/eclipse/jpt/eclipselink1_1/ui/internal/orm/details/EclipseLink1_1OrmManyToManyMappingUiProvider.java56
-rw-r--r--jpa/plugins/org.eclipse.jpt.eclipselink.ui/src/org/eclipse/jpt/eclipselink1_1/ui/internal/orm/details/EclipseLink1_1OrmManyToOneMappingComposite.java107
-rw-r--r--jpa/plugins/org.eclipse.jpt.eclipselink.ui/src/org/eclipse/jpt/eclipselink1_1/ui/internal/orm/details/EclipseLink1_1OrmManyToOneMappingUiProvider.java56
-rw-r--r--jpa/plugins/org.eclipse.jpt.eclipselink.ui/src/org/eclipse/jpt/eclipselink1_1/ui/internal/orm/details/EclipseLink1_1OrmMappedSuperclassUiProvider.java54
-rw-r--r--jpa/plugins/org.eclipse.jpt.eclipselink.ui/src/org/eclipse/jpt/eclipselink1_1/ui/internal/orm/details/EclipseLink1_1OrmOneToManyMappingComposite.java61
-rw-r--r--jpa/plugins/org.eclipse.jpt.eclipselink.ui/src/org/eclipse/jpt/eclipselink1_1/ui/internal/orm/details/EclipseLink1_1OrmOneToManyMappingUiProvider.java56
-rw-r--r--jpa/plugins/org.eclipse.jpt.eclipselink.ui/src/org/eclipse/jpt/eclipselink1_1/ui/internal/orm/details/EclipseLink1_1OrmOneToOneMappingComposite.java114
-rw-r--r--jpa/plugins/org.eclipse.jpt.eclipselink.ui/src/org/eclipse/jpt/eclipselink1_1/ui/internal/orm/details/EclipseLink1_1OrmOneToOneMappingUiProvider.java56
-rw-r--r--jpa/plugins/org.eclipse.jpt.eclipselink.ui/src/org/eclipse/jpt/eclipselink1_1/ui/internal/orm/details/EclipseLink1_1OrmTransformationMappingUiProvider.java57
-rw-r--r--jpa/plugins/org.eclipse.jpt.eclipselink.ui/src/org/eclipse/jpt/eclipselink1_1/ui/internal/orm/details/EclipseLink1_1OrmTransientMappingUiProvider.java57
-rw-r--r--jpa/plugins/org.eclipse.jpt.eclipselink.ui/src/org/eclipse/jpt/eclipselink1_1/ui/internal/orm/details/EclipseLink1_1OrmVariableOneToOneMappingUiProvider.java56
-rw-r--r--jpa/plugins/org.eclipse.jpt.eclipselink.ui/src/org/eclipse/jpt/eclipselink1_1/ui/internal/orm/details/EclipseLink1_1OrmVersionMappingComposite.java61
-rw-r--r--jpa/plugins/org.eclipse.jpt.eclipselink.ui/src/org/eclipse/jpt/eclipselink1_1/ui/internal/orm/details/EclipseLink1_1OrmVersionMappingUiProvider.java56
-rw-r--r--jpa/plugins/org.eclipse.jpt.eclipselink.ui/src/org/eclipse/jpt/eclipselink1_1/ui/internal/platform/EclipseLink1_1JpaPlatformUiFactory.java46
-rw-r--r--jpa/plugins/org.eclipse.jpt.eclipselink.ui/src/org/eclipse/jpt/eclipselink1_1/ui/internal/platform/EclipseLink1_1JpaPlatformUiProvider.java116
-rw-r--r--jpa/plugins/org.eclipse.jpt.eclipselink.ui/src/org/eclipse/jpt/eclipselink1_1/ui/internal/structure/EclipseLink1_1OrmResourceModelStructureProvider.java52
-rw-r--r--jpa/plugins/org.eclipse.jpt.eclipselink.ui/src/org/eclipse/jpt/eclipselink1_1/ui/internal/wizards/EclipseLink1_1MappingFileWizard.java47
-rw-r--r--jpa/tests/org.eclipse.jpt.core.tests.extension.resource/.classpath12
-rw-r--r--jpa/tests/org.eclipse.jpt.core.tests.extension.resource/.cvsignore6
-rw-r--r--jpa/tests/org.eclipse.jpt.core.tests.extension.resource/.project28
-rw-r--r--jpa/tests/org.eclipse.jpt.core.tests.extension.resource/.settings/org.eclipse.core.resources.prefs3
-rw-r--r--jpa/tests/org.eclipse.jpt.core.tests.extension.resource/META-INF/MANIFEST.MF22
-rw-r--r--jpa/tests/org.eclipse.jpt.core.tests.extension.resource/about.html34
-rw-r--r--jpa/tests/org.eclipse.jpt.core.tests.extension.resource/build.properties19
-rw-r--r--jpa/tests/org.eclipse.jpt.core.tests.extension.resource/plugin.properties24
-rw-r--r--jpa/tests/org.eclipse.jpt.core.tests.extension.resource/plugin.xml27
-rw-r--r--jpa/tests/org.eclipse.jpt.core.tests.extension.resource/src/org/eclipse/jpt/core/tests/extension/resource/ExtensionTestPlugin.java55
-rw-r--r--jpa/tests/org.eclipse.jpt.core.tests.extension.resource/src/org/eclipse/jpt/core/tests/extension/resource/JavaTestAttributeMapping.java39
-rw-r--r--jpa/tests/org.eclipse.jpt.core.tests.extension.resource/src/org/eclipse/jpt/core/tests/extension/resource/JavaTestAttributeMappingProvider.java48
-rw-r--r--jpa/tests/org.eclipse.jpt.core.tests.extension.resource/src/org/eclipse/jpt/core/tests/extension/resource/JavaTestTypeMapping.java50
-rw-r--r--jpa/tests/org.eclipse.jpt.core.tests.extension.resource/src/org/eclipse/jpt/core/tests/extension/resource/JavaTestTypeMappingProvider.java51
-rw-r--r--jpa/tests/org.eclipse.jpt.core.tests.extension.resource/src/org/eclipse/jpt/core/tests/extension/resource/TestJavaBasicMapping.java20
-rw-r--r--jpa/tests/org.eclipse.jpt.core.tests.extension.resource/src/org/eclipse/jpt/core/tests/extension/resource/TestJavaEntity.java20
-rw-r--r--jpa/tests/org.eclipse.jpt.core.tests.extension.resource/src/org/eclipse/jpt/core/tests/extension/resource/TestJpaFactory.java37
-rw-r--r--jpa/tests/org.eclipse.jpt.core.tests.extension.resource/src/org/eclipse/jpt/core/tests/extension/resource/TestJpaPlatformFactory.java63
-rw-r--r--jpa/tests/org.eclipse.jpt.core.tests.extension.resource/src/org/eclipse/jpt/core/tests/extension/resource/TestJpaPlatformProvider.java79
-rw-r--r--jpa/tests/org.eclipse.jpt.core.tests.extension.resource/src/org/eclipse/jpt/core/tests/extension/resource/TestJpaPlatformUiFactory.java36
-rw-r--r--jpa/tests/org.eclipse.jpt.core.tests.extension.resource/src/org/eclipse/jpt/core/tests/extension/resource/TestJpaUiFactory.java27
-rw-r--r--jpa/tests/org.eclipse.jpt.core.tests/.classpath14
-rw-r--r--jpa/tests/org.eclipse.jpt.core.tests/.cvsignore5
-rw-r--r--jpa/tests/org.eclipse.jpt.core.tests/.project28
-rw-r--r--jpa/tests/org.eclipse.jpt.core.tests/.settings/org.eclipse.core.resources.prefs3
-rw-r--r--jpa/tests/org.eclipse.jpt.core.tests/.settings/org.eclipse.jdt.core.prefs7
-rw-r--r--jpa/tests/org.eclipse.jpt.core.tests/META-INF/MANIFEST.MF39
-rw-r--r--jpa/tests/org.eclipse.jpt.core.tests/about.html34
-rw-r--r--jpa/tests/org.eclipse.jpt.core.tests/build.properties18
-rw-r--r--jpa/tests/org.eclipse.jpt.core.tests/plugin.properties22
-rw-r--r--jpa/tests/org.eclipse.jpt.core.tests/src/org/eclipse/jpt/core/tests/internal/JptCoreTests.java83
-rw-r--r--jpa/tests/org.eclipse.jpt.core.tests/src/org/eclipse/jpt/core/tests/internal/context/ContextModelTestCase.java187
-rw-r--r--jpa/tests/org.eclipse.jpt.core.tests/src/org/eclipse/jpt/core/tests/internal/context/JpaFileTests.java398
-rw-r--r--jpa/tests/org.eclipse.jpt.core.tests/src/org/eclipse/jpt/core/tests/internal/context/JpaProjectTests.java147
-rw-r--r--jpa/tests/org.eclipse.jpt.core.tests/src/org/eclipse/jpt/core/tests/internal/context/JptCoreContextModelTests.java40
-rw-r--r--jpa/tests/org.eclipse.jpt.core.tests/src/org/eclipse/jpt/core/tests/internal/context/java/GenericJavaPersistentAttributeTests.java237
-rw-r--r--jpa/tests/org.eclipse.jpt.core.tests/src/org/eclipse/jpt/core/tests/internal/context/java/GenericJavaPersistentTypeTests.java759
-rw-r--r--jpa/tests/org.eclipse.jpt.core.tests/src/org/eclipse/jpt/core/tests/internal/context/java/JavaAssociationOverrideTests.java407
-rw-r--r--jpa/tests/org.eclipse.jpt.core.tests/src/org/eclipse/jpt/core/tests/internal/context/java/JavaAttributeOverrideTests.java246
-rw-r--r--jpa/tests/org.eclipse.jpt.core.tests/src/org/eclipse/jpt/core/tests/internal/context/java/JavaBasicMappingTests.java978
-rw-r--r--jpa/tests/org.eclipse.jpt.core.tests/src/org/eclipse/jpt/core/tests/internal/context/java/JavaColumnTests.java816
-rw-r--r--jpa/tests/org.eclipse.jpt.core.tests/src/org/eclipse/jpt/core/tests/internal/context/java/JavaDiscriminatorColumnTests.java450
-rw-r--r--jpa/tests/org.eclipse.jpt.core.tests/src/org/eclipse/jpt/core/tests/internal/context/java/JavaEmbeddableTests.java177
-rw-r--r--jpa/tests/org.eclipse.jpt.core.tests/src/org/eclipse/jpt/core/tests/internal/context/java/JavaEmbeddedIdMappingTests.java635
-rw-r--r--jpa/tests/org.eclipse.jpt.core.tests/src/org/eclipse/jpt/core/tests/internal/context/java/JavaEmbeddedMappingTests.java680
-rw-r--r--jpa/tests/org.eclipse.jpt.core.tests/src/org/eclipse/jpt/core/tests/internal/context/java/JavaEntityTests.java3240
-rw-r--r--jpa/tests/org.eclipse.jpt.core.tests/src/org/eclipse/jpt/core/tests/internal/context/java/JavaGeneratedValueTests.java147
-rw-r--r--jpa/tests/org.eclipse.jpt.core.tests/src/org/eclipse/jpt/core/tests/internal/context/java/JavaIdMappingTests.java707
-rw-r--r--jpa/tests/org.eclipse.jpt.core.tests/src/org/eclipse/jpt/core/tests/internal/context/java/JavaJoinColumnTests.java533
-rw-r--r--jpa/tests/org.eclipse.jpt.core.tests/src/org/eclipse/jpt/core/tests/internal/context/java/JavaJoinTableTests.java970
-rw-r--r--jpa/tests/org.eclipse.jpt.core.tests/src/org/eclipse/jpt/core/tests/internal/context/java/JavaManyToManyMappingTests.java966
-rw-r--r--jpa/tests/org.eclipse.jpt.core.tests/src/org/eclipse/jpt/core/tests/internal/context/java/JavaManyToOneMappingTests.java904
-rw-r--r--jpa/tests/org.eclipse.jpt.core.tests/src/org/eclipse/jpt/core/tests/internal/context/java/JavaMappedSuperclassTests.java245
-rw-r--r--jpa/tests/org.eclipse.jpt.core.tests/src/org/eclipse/jpt/core/tests/internal/context/java/JavaNamedNativeQueryTests.java425
-rw-r--r--jpa/tests/org.eclipse.jpt.core.tests/src/org/eclipse/jpt/core/tests/internal/context/java/JavaNamedQueryTests.java324
-rw-r--r--jpa/tests/org.eclipse.jpt.core.tests/src/org/eclipse/jpt/core/tests/internal/context/java/JavaOneToManyMappingTests.java942
-rw-r--r--jpa/tests/org.eclipse.jpt.core.tests/src/org/eclipse/jpt/core/tests/internal/context/java/JavaOneToOneMappingTests.java1332
-rw-r--r--jpa/tests/org.eclipse.jpt.core.tests/src/org/eclipse/jpt/core/tests/internal/context/java/JavaPrimaryKeyJoinColumnTests.java295
-rw-r--r--jpa/tests/org.eclipse.jpt.core.tests/src/org/eclipse/jpt/core/tests/internal/context/java/JavaQueryHintTests.java143
-rw-r--r--jpa/tests/org.eclipse.jpt.core.tests/src/org/eclipse/jpt/core/tests/internal/context/java/JavaSecondaryTableTests.java734
-rw-r--r--jpa/tests/org.eclipse.jpt.core.tests/src/org/eclipse/jpt/core/tests/internal/context/java/JavaSequenceGeneratorTests.java256
-rw-r--r--jpa/tests/org.eclipse.jpt.core.tests/src/org/eclipse/jpt/core/tests/internal/context/java/JavaTableGeneratorTests.java701
-rw-r--r--jpa/tests/org.eclipse.jpt.core.tests/src/org/eclipse/jpt/core/tests/internal/context/java/JavaTableTests.java599
-rw-r--r--jpa/tests/org.eclipse.jpt.core.tests/src/org/eclipse/jpt/core/tests/internal/context/java/JavaTransientMappingTests.java248
-rw-r--r--jpa/tests/org.eclipse.jpt.core.tests/src/org/eclipse/jpt/core/tests/internal/context/java/JavaVersionMappingTests.java398
-rw-r--r--jpa/tests/org.eclipse.jpt.core.tests/src/org/eclipse/jpt/core/tests/internal/context/java/JptCoreContextJavaModelTests.java58
-rw-r--r--jpa/tests/org.eclipse.jpt.core.tests/src/org/eclipse/jpt/core/tests/internal/context/orm/EntityMappingsTests.java1066
-rw-r--r--jpa/tests/org.eclipse.jpt.core.tests/src/org/eclipse/jpt/core/tests/internal/context/orm/GenericOrmPersistentAttributeTests.java316
-rw-r--r--jpa/tests/org.eclipse.jpt.core.tests/src/org/eclipse/jpt/core/tests/internal/context/orm/GenericOrmPersistentTypeTests.java577
-rw-r--r--jpa/tests/org.eclipse.jpt.core.tests/src/org/eclipse/jpt/core/tests/internal/context/orm/JptCoreOrmContextModelTests.java62
-rw-r--r--jpa/tests/org.eclipse.jpt.core.tests/src/org/eclipse/jpt/core/tests/internal/context/orm/OrmAssociationOverrideTests.java255
-rw-r--r--jpa/tests/org.eclipse.jpt.core.tests/src/org/eclipse/jpt/core/tests/internal/context/orm/OrmAttributeOverrideTests.java96
-rw-r--r--jpa/tests/org.eclipse.jpt.core.tests/src/org/eclipse/jpt/core/tests/internal/context/orm/OrmBasicMappingTests.java709
-rw-r--r--jpa/tests/org.eclipse.jpt.core.tests/src/org/eclipse/jpt/core/tests/internal/context/orm/OrmCascadeTests.java280
-rw-r--r--jpa/tests/org.eclipse.jpt.core.tests/src/org/eclipse/jpt/core/tests/internal/context/orm/OrmColumnTests.java820
-rw-r--r--jpa/tests/org.eclipse.jpt.core.tests/src/org/eclipse/jpt/core/tests/internal/context/orm/OrmDiscriminatorColumnTests.java456
-rw-r--r--jpa/tests/org.eclipse.jpt.core.tests/src/org/eclipse/jpt/core/tests/internal/context/orm/OrmEmbeddableTests.java295
-rw-r--r--jpa/tests/org.eclipse.jpt.core.tests/src/org/eclipse/jpt/core/tests/internal/context/orm/OrmEmbeddedIdMappingTests.java903
-rw-r--r--jpa/tests/org.eclipse.jpt.core.tests/src/org/eclipse/jpt/core/tests/internal/context/orm/OrmEmbeddedMappingTests.java773
-rw-r--r--jpa/tests/org.eclipse.jpt.core.tests/src/org/eclipse/jpt/core/tests/internal/context/orm/OrmEntityTests.java2699
-rw-r--r--jpa/tests/org.eclipse.jpt.core.tests/src/org/eclipse/jpt/core/tests/internal/context/orm/OrmGeneratedValueTests.java135
-rw-r--r--jpa/tests/org.eclipse.jpt.core.tests/src/org/eclipse/jpt/core/tests/internal/context/orm/OrmIdMappingTests.java744
-rw-r--r--jpa/tests/org.eclipse.jpt.core.tests/src/org/eclipse/jpt/core/tests/internal/context/orm/OrmJoinColumnTests.java506
-rw-r--r--jpa/tests/org.eclipse.jpt.core.tests/src/org/eclipse/jpt/core/tests/internal/context/orm/OrmJoinTableTests.java1156
-rw-r--r--jpa/tests/org.eclipse.jpt.core.tests/src/org/eclipse/jpt/core/tests/internal/context/orm/OrmManyToManyMappingTests.java592
-rw-r--r--jpa/tests/org.eclipse.jpt.core.tests/src/org/eclipse/jpt/core/tests/internal/context/orm/OrmManyToOneMappingTests.java548
-rw-r--r--jpa/tests/org.eclipse.jpt.core.tests/src/org/eclipse/jpt/core/tests/internal/context/orm/OrmMappedSuperclassTests.java345
-rw-r--r--jpa/tests/org.eclipse.jpt.core.tests/src/org/eclipse/jpt/core/tests/internal/context/orm/OrmNamedNativeQueryTests.java358
-rw-r--r--jpa/tests/org.eclipse.jpt.core.tests/src/org/eclipse/jpt/core/tests/internal/context/orm/OrmNamedQueryTests.java273
-rw-r--r--jpa/tests/org.eclipse.jpt.core.tests/src/org/eclipse/jpt/core/tests/internal/context/orm/OrmOneToManyMappingTests.java612
-rw-r--r--jpa/tests/org.eclipse.jpt.core.tests/src/org/eclipse/jpt/core/tests/internal/context/orm/OrmOneToOneMappingTests.java969
-rw-r--r--jpa/tests/org.eclipse.jpt.core.tests/src/org/eclipse/jpt/core/tests/internal/context/orm/OrmPrimaryKeyJoinColumnTests.java253
-rw-r--r--jpa/tests/org.eclipse.jpt.core.tests/src/org/eclipse/jpt/core/tests/internal/context/orm/OrmQueryHintTests.java122
-rw-r--r--jpa/tests/org.eclipse.jpt.core.tests/src/org/eclipse/jpt/core/tests/internal/context/orm/OrmSecondaryTableTests.java764
-rw-r--r--jpa/tests/org.eclipse.jpt.core.tests/src/org/eclipse/jpt/core/tests/internal/context/orm/OrmSequenceGeneratorTests.java172
-rw-r--r--jpa/tests/org.eclipse.jpt.core.tests/src/org/eclipse/jpt/core/tests/internal/context/orm/OrmTableGeneratorTests.java604
-rw-r--r--jpa/tests/org.eclipse.jpt.core.tests/src/org/eclipse/jpt/core/tests/internal/context/orm/OrmTableTests.java827
-rw-r--r--jpa/tests/org.eclipse.jpt.core.tests/src/org/eclipse/jpt/core/tests/internal/context/orm/OrmTransientMappingTests.java302
-rw-r--r--jpa/tests/org.eclipse.jpt.core.tests/src/org/eclipse/jpt/core/tests/internal/context/orm/OrmVersionMappingTests.java486
-rw-r--r--jpa/tests/org.eclipse.jpt.core.tests/src/org/eclipse/jpt/core/tests/internal/context/orm/OrmXmlTests.java113
-rw-r--r--jpa/tests/org.eclipse.jpt.core.tests/src/org/eclipse/jpt/core/tests/internal/context/orm/PersistenceUnitDefaultsTests.java369
-rw-r--r--jpa/tests/org.eclipse.jpt.core.tests/src/org/eclipse/jpt/core/tests/internal/context/orm/PersistenceUnitMetadataTests.java104
-rw-r--r--jpa/tests/org.eclipse.jpt.core.tests/src/org/eclipse/jpt/core/tests/internal/context/persistence/ClassRefTests.java112
-rw-r--r--jpa/tests/org.eclipse.jpt.core.tests/src/org/eclipse/jpt/core/tests/internal/context/persistence/JptCorePersistenceContextModelTests.java33
-rw-r--r--jpa/tests/org.eclipse.jpt.core.tests/src/org/eclipse/jpt/core/tests/internal/context/persistence/MappingFileRefTests.java97
-rw-r--r--jpa/tests/org.eclipse.jpt.core.tests/src/org/eclipse/jpt/core/tests/internal/context/persistence/PersistenceTests.java134
-rw-r--r--jpa/tests/org.eclipse.jpt.core.tests/src/org/eclipse/jpt/core/tests/internal/context/persistence/PersistenceUnitTests.java1211
-rw-r--r--jpa/tests/org.eclipse.jpt.core.tests/src/org/eclipse/jpt/core/tests/internal/context/persistence/PersistenceXmlTests.java98
-rw-r--r--jpa/tests/org.eclipse.jpt.core.tests/src/org/eclipse/jpt/core/tests/internal/context/persistence/RootContextNodeTests.java50
-rw-r--r--jpa/tests/org.eclipse.jpt.core.tests/src/org/eclipse/jpt/core/tests/internal/model/JpaModelTests.java227
-rw-r--r--jpa/tests/org.eclipse.jpt.core.tests/src/org/eclipse/jpt/core/tests/internal/model/JptCoreModelTests.java28
-rw-r--r--jpa/tests/org.eclipse.jpt.core.tests/src/org/eclipse/jpt/core/tests/internal/platform/BaseJpaPlatformTests.java76
-rw-r--r--jpa/tests/org.eclipse.jpt.core.tests/src/org/eclipse/jpt/core/tests/internal/platform/JpaPlatformExtensionTests.java92
-rw-r--r--jpa/tests/org.eclipse.jpt.core.tests/src/org/eclipse/jpt/core/tests/internal/platform/JpaPlatformTests.java120
-rw-r--r--jpa/tests/org.eclipse.jpt.core.tests/src/org/eclipse/jpt/core/tests/internal/projects/TestFacetedProject.java80
-rw-r--r--jpa/tests/org.eclipse.jpt.core.tests/src/org/eclipse/jpt/core/tests/internal/projects/TestJavaProject.java123
-rw-r--r--jpa/tests/org.eclipse.jpt.core.tests/src/org/eclipse/jpt/core/tests/internal/projects/TestJpaProject.java92
-rw-r--r--jpa/tests/org.eclipse.jpt.core.tests/src/org/eclipse/jpt/core/tests/internal/projects/TestPlatformProject.java78
-rw-r--r--jpa/tests/org.eclipse.jpt.core.tests/src/org/eclipse/jpt/core/tests/internal/resource/JptCoreResourceModelTests.java32
-rw-r--r--jpa/tests/org.eclipse.jpt.core.tests/src/org/eclipse/jpt/core/tests/internal/resource/java/AssociationOverrideTests.java253
-rw-r--r--jpa/tests/org.eclipse.jpt.core.tests/src/org/eclipse/jpt/core/tests/internal/resource/java/AssociationOverridesTests.java320
-rw-r--r--jpa/tests/org.eclipse.jpt.core.tests/src/org/eclipse/jpt/core/tests/internal/resource/java/AttributeOverrideTests.java155
-rw-r--r--jpa/tests/org.eclipse.jpt.core.tests/src/org/eclipse/jpt/core/tests/internal/resource/java/AttributeOverridesTests.java272
-rw-r--r--jpa/tests/org.eclipse.jpt.core.tests/src/org/eclipse/jpt/core/tests/internal/resource/java/BasicTests.java151
-rw-r--r--jpa/tests/org.eclipse.jpt.core.tests/src/org/eclipse/jpt/core/tests/internal/resource/java/ColumnTests.java404
-rw-r--r--jpa/tests/org.eclipse.jpt.core.tests/src/org/eclipse/jpt/core/tests/internal/resource/java/DiscriminatorColumnTests.java212
-rw-r--r--jpa/tests/org.eclipse.jpt.core.tests/src/org/eclipse/jpt/core/tests/internal/resource/java/DiscriminatorValueTests.java83
-rw-r--r--jpa/tests/org.eclipse.jpt.core.tests/src/org/eclipse/jpt/core/tests/internal/resource/java/EmbeddableTests.java74
-rw-r--r--jpa/tests/org.eclipse.jpt.core.tests/src/org/eclipse/jpt/core/tests/internal/resource/java/EmbeddedIdTests.java50
-rw-r--r--jpa/tests/org.eclipse.jpt.core.tests/src/org/eclipse/jpt/core/tests/internal/resource/java/EmbeddedTests.java50
-rw-r--r--jpa/tests/org.eclipse.jpt.core.tests/src/org/eclipse/jpt/core/tests/internal/resource/java/EntityTests.java125
-rw-r--r--jpa/tests/org.eclipse.jpt.core.tests/src/org/eclipse/jpt/core/tests/internal/resource/java/EnumeratedTests.java89
-rw-r--r--jpa/tests/org.eclipse.jpt.core.tests/src/org/eclipse/jpt/core/tests/internal/resource/java/GeneratedValueTests.java133
-rw-r--r--jpa/tests/org.eclipse.jpt.core.tests/src/org/eclipse/jpt/core/tests/internal/resource/java/IdClassTests.java106
-rw-r--r--jpa/tests/org.eclipse.jpt.core.tests/src/org/eclipse/jpt/core/tests/internal/resource/java/IdTests.java50
-rw-r--r--jpa/tests/org.eclipse.jpt.core.tests/src/org/eclipse/jpt/core/tests/internal/resource/java/InheritanceTests.java83
-rw-r--r--jpa/tests/org.eclipse.jpt.core.tests/src/org/eclipse/jpt/core/tests/internal/resource/java/JPTToolsTests.java479
-rw-r--r--jpa/tests/org.eclipse.jpt.core.tests/src/org/eclipse/jpt/core/tests/internal/resource/java/JavaResourceModelTestCase.java171
-rw-r--r--jpa/tests/org.eclipse.jpt.core.tests/src/org/eclipse/jpt/core/tests/internal/resource/java/JavaResourcePersistentAttributeTests.java859
-rw-r--r--jpa/tests/org.eclipse.jpt.core.tests/src/org/eclipse/jpt/core/tests/internal/resource/java/JavaResourcePersistentTypeTests.java921
-rw-r--r--jpa/tests/org.eclipse.jpt.core.tests/src/org/eclipse/jpt/core/tests/internal/resource/java/JoinColumnTests.java352
-rw-r--r--jpa/tests/org.eclipse.jpt.core.tests/src/org/eclipse/jpt/core/tests/internal/resource/java/JoinColumnsTests.java421
-rw-r--r--jpa/tests/org.eclipse.jpt.core.tests/src/org/eclipse/jpt/core/tests/internal/resource/java/JoinTableTests.java656
-rw-r--r--jpa/tests/org.eclipse.jpt.core.tests/src/org/eclipse/jpt/core/tests/internal/resource/java/JptJavaResourceTests.java75
-rw-r--r--jpa/tests/org.eclipse.jpt.core.tests/src/org/eclipse/jpt/core/tests/internal/resource/java/LobTests.java49
-rw-r--r--jpa/tests/org.eclipse.jpt.core.tests/src/org/eclipse/jpt/core/tests/internal/resource/java/ManyToManyTests.java394
-rw-r--r--jpa/tests/org.eclipse.jpt.core.tests/src/org/eclipse/jpt/core/tests/internal/resource/java/ManyToOneTests.java387
-rw-r--r--jpa/tests/org.eclipse.jpt.core.tests/src/org/eclipse/jpt/core/tests/internal/resource/java/MapKeyTests.java88
-rw-r--r--jpa/tests/org.eclipse.jpt.core.tests/src/org/eclipse/jpt/core/tests/internal/resource/java/MappedSuperclassTests.java74
-rw-r--r--jpa/tests/org.eclipse.jpt.core.tests/src/org/eclipse/jpt/core/tests/internal/resource/java/NamedNativeQueriesTests.java421
-rw-r--r--jpa/tests/org.eclipse.jpt.core.tests/src/org/eclipse/jpt/core/tests/internal/resource/java/NamedNativeQueryTests.java341
-rw-r--r--jpa/tests/org.eclipse.jpt.core.tests/src/org/eclipse/jpt/core/tests/internal/resource/java/NamedQueriesTests.java331
-rw-r--r--jpa/tests/org.eclipse.jpt.core.tests/src/org/eclipse/jpt/core/tests/internal/resource/java/NamedQueryTests.java259
-rw-r--r--jpa/tests/org.eclipse.jpt.core.tests/src/org/eclipse/jpt/core/tests/internal/resource/java/OneToManyTests.java397
-rw-r--r--jpa/tests/org.eclipse.jpt.core.tests/src/org/eclipse/jpt/core/tests/internal/resource/java/OneToOneTests.java447
-rw-r--r--jpa/tests/org.eclipse.jpt.core.tests/src/org/eclipse/jpt/core/tests/internal/resource/java/OrderByTests.java87
-rw-r--r--jpa/tests/org.eclipse.jpt.core.tests/src/org/eclipse/jpt/core/tests/internal/resource/java/PrimaryKeyJoinColumnTests.java187
-rw-r--r--jpa/tests/org.eclipse.jpt.core.tests/src/org/eclipse/jpt/core/tests/internal/resource/java/PrimaryKeyJoinColumnsTests.java252
-rw-r--r--jpa/tests/org.eclipse.jpt.core.tests/src/org/eclipse/jpt/core/tests/internal/resource/java/QueryHintTests.java65
-rw-r--r--jpa/tests/org.eclipse.jpt.core.tests/src/org/eclipse/jpt/core/tests/internal/resource/java/SecondaryTableTests.java436
-rw-r--r--jpa/tests/org.eclipse.jpt.core.tests/src/org/eclipse/jpt/core/tests/internal/resource/java/SecondaryTablesTests.java503
-rw-r--r--jpa/tests/org.eclipse.jpt.core.tests/src/org/eclipse/jpt/core/tests/internal/resource/java/SequenceGeneratorTests.java234
-rw-r--r--jpa/tests/org.eclipse.jpt.core.tests/src/org/eclipse/jpt/core/tests/internal/resource/java/TableGeneratorTests.java501
-rw-r--r--jpa/tests/org.eclipse.jpt.core.tests/src/org/eclipse/jpt/core/tests/internal/resource/java/TableTests.java346
-rw-r--r--jpa/tests/org.eclipse.jpt.core.tests/src/org/eclipse/jpt/core/tests/internal/resource/java/TemporalTests.java88
-rw-r--r--jpa/tests/org.eclipse.jpt.core.tests/src/org/eclipse/jpt/core/tests/internal/resource/java/TransientTests.java50
-rw-r--r--jpa/tests/org.eclipse.jpt.core.tests/src/org/eclipse/jpt/core/tests/internal/resource/java/VersionTests.java49
-rw-r--r--jpa/tests/org.eclipse.jpt.core.tests/src/org/eclipse/jpt/core/tests/internal/utility/jdt/AnnotationTestCase.java512
-rw-r--r--jpa/tests/org.eclipse.jpt.core.tests/src/org/eclipse/jpt/core/tests/internal/utility/jdt/CombinationIndexedDeclarationAnnotationAdapterTests.java733
-rw-r--r--jpa/tests/org.eclipse.jpt.core.tests/src/org/eclipse/jpt/core/tests/internal/utility/jdt/DefaultAnnotationEditFormatterTests.java74
-rw-r--r--jpa/tests/org.eclipse.jpt.core.tests/src/org/eclipse/jpt/core/tests/internal/utility/jdt/JDTToolsTests.java87
-rw-r--r--jpa/tests/org.eclipse.jpt.core.tests/src/org/eclipse/jpt/core/tests/internal/utility/jdt/JptCoreUtilityJdtTests.java35
-rw-r--r--jpa/tests/org.eclipse.jpt.core.tests/src/org/eclipse/jpt/core/tests/internal/utility/jdt/MemberAnnotationElementAdapterTests.java1297
-rw-r--r--jpa/tests/org.eclipse.jpt.core.tests/src/org/eclipse/jpt/core/tests/internal/utility/jdt/MiscTests.java48
-rw-r--r--jpa/tests/org.eclipse.jpt.core.tests/src/org/eclipse/jpt/core/tests/internal/utility/jdt/NestedDeclarationAnnotationAdapterTests.java765
-rw-r--r--jpa/tests/org.eclipse.jpt.core.tests/src/org/eclipse/jpt/core/tests/internal/utility/jdt/NestedIndexedDeclarationAnnotationAdapterTests.java2229
-rw-r--r--jpa/tests/org.eclipse.jpt.core.tests/src/org/eclipse/jpt/core/tests/internal/utility/jdt/SimpleDeclarationAnnotationAdapterTests.java274
-rw-r--r--jpa/tests/org.eclipse.jpt.core.tests/src/org/eclipse/jpt/core/tests/internal/utility/jdt/TypeTests.java51
-rw-r--r--jpa/tests/org.eclipse.jpt.core.tests/src/org/eclipse/jpt2_0/core/tests/internal/context/java/Generic2_0ContextModelTestCase.java35
-rw-r--r--jpa/tests/org.eclipse.jpt.core.tests/src/org/eclipse/jpt2_0/core/tests/internal/context/java/Generic2_0JavaContextModelTests.java32
-rw-r--r--jpa/tests/org.eclipse.jpt.core.tests/src/org/eclipse/jpt2_0/core/tests/internal/context/java/Generic2_0JavaPersistentAttributeTests.java110
-rw-r--r--jpa/tests/org.eclipse.jpt.core.tests/src/org/eclipse/jpt2_0/core/tests/internal/context/java/Generic2_0JavaPersistentTypeTests.java853
-rw-r--r--jpa/tests/org.eclipse.jpt.core.tests/src/org/eclipse/jpt2_0/core/tests/internal/context/java/Generic2_0JavaSequenceGeneratorTests.java208
-rw-r--r--jpa/tests/org.eclipse.jpt.core.tests/src/org/eclipse/jpt2_0/core/tests/internal/context/orm/Generic2_0OrmContextModelTestCase.java85
-rw-r--r--jpa/tests/org.eclipse.jpt.core.tests/src/org/eclipse/jpt2_0/core/tests/internal/context/orm/Generic2_0OrmContextModelTests.java32
-rw-r--r--jpa/tests/org.eclipse.jpt.core.tests/src/org/eclipse/jpt2_0/core/tests/internal/context/orm/Generic2_0OrmPersistentAttributeTests.java549
-rw-r--r--jpa/tests/org.eclipse.jpt.core.tests/src/org/eclipse/jpt2_0/core/tests/internal/context/orm/Generic2_0OrmPersistentTypeTests.java280
-rw-r--r--jpa/tests/org.eclipse.jpt.core.tests/src/org/eclipse/jpt2_0/core/tests/internal/context/orm/Generic2_0OrmSequenceGeneratorTests.java88
-rw-r--r--jpa/tests/org.eclipse.jpt.core.tests/src/org/eclipse/jpt2_0/core/tests/internal/resource/java/AccessAnnotationTests.java178
-rw-r--r--jpa/tests/org.eclipse.jpt.core.tests/src/org/eclipse/jpt2_0/core/tests/internal/resource/java/AssociationOverride2_0Tests.java885
-rw-r--r--jpa/tests/org.eclipse.jpt.core.tests/src/org/eclipse/jpt2_0/core/tests/internal/resource/java/AssociationOverrides2_0Tests.java988
-rw-r--r--jpa/tests/org.eclipse.jpt.core.tests/src/org/eclipse/jpt2_0/core/tests/internal/resource/java/Generic2_0JavaResourceModelTestCase.java29
-rw-r--r--jpa/tests/org.eclipse.jpt.core.tests/src/org/eclipse/jpt2_0/core/tests/internal/resource/java/Generic2_0JavaResourceTests.java33
-rw-r--r--jpa/tests/org.eclipse.jpt.core.tests/src/org/eclipse/jpt2_0/core/tests/internal/resource/java/SequenceGenerator2_0Tests.java123
-rw-r--r--jpa/tests/org.eclipse.jpt.core.tests/test.xml47
-rw-r--r--jpa/tests/org.eclipse.jpt.db.tests/.classpath11
-rw-r--r--jpa/tests/org.eclipse.jpt.db.tests/.cvsignore1
-rw-r--r--jpa/tests/org.eclipse.jpt.db.tests/.project28
-rw-r--r--jpa/tests/org.eclipse.jpt.db.tests/.settings/org.eclipse.core.resources.prefs3
-rw-r--r--jpa/tests/org.eclipse.jpt.db.tests/META-INF/MANIFEST.MF19
-rw-r--r--jpa/tests/org.eclipse.jpt.db.tests/about.html34
-rw-r--r--jpa/tests/org.eclipse.jpt.db.tests/build.properties15
-rw-r--r--jpa/tests/org.eclipse.jpt.db.tests/config/derby.properties24
-rw-r--r--jpa/tests/org.eclipse.jpt.db.tests/config/mysql.properties23
-rw-r--r--jpa/tests/org.eclipse.jpt.db.tests/config/oracle10g.properties24
-rw-r--r--jpa/tests/org.eclipse.jpt.db.tests/config/oracle10gXE.properties24
-rw-r--r--jpa/tests/org.eclipse.jpt.db.tests/config/oracle9i.properties24
-rw-r--r--jpa/tests/org.eclipse.jpt.db.tests/config/postgresql.properties23
-rw-r--r--jpa/tests/org.eclipse.jpt.db.tests/config/sqlserver.properties24
-rw-r--r--jpa/tests/org.eclipse.jpt.db.tests/config/sybase.properties24
-rw-r--r--jpa/tests/org.eclipse.jpt.db.tests/plugin.properties25
-rw-r--r--jpa/tests/org.eclipse.jpt.db.tests/src/org/eclipse/jpt/db/tests/internal/JDBCTests.java135
-rw-r--r--jpa/tests/org.eclipse.jpt.db.tests/src/org/eclipse/jpt/db/tests/internal/JDBCTools.java105
-rw-r--r--jpa/tests/org.eclipse.jpt.db.tests/src/org/eclipse/jpt/db/tests/internal/JptDbTests.java34
-rw-r--r--jpa/tests/org.eclipse.jpt.db.tests/src/org/eclipse/jpt/db/tests/internal/JptDbTestsPlugin.java56
-rw-r--r--jpa/tests/org.eclipse.jpt.db.tests/src/org/eclipse/jpt/db/tests/internal/platforms/AllPlatformTests.java37
-rw-r--r--jpa/tests/org.eclipse.jpt.db.tests/src/org/eclipse/jpt/db/tests/internal/platforms/DTPPlatformTests.java1020
-rw-r--r--jpa/tests/org.eclipse.jpt.db.tests/src/org/eclipse/jpt/db/tests/internal/platforms/DerbyTests.java482
-rw-r--r--jpa/tests/org.eclipse.jpt.db.tests/src/org/eclipse/jpt/db/tests/internal/platforms/MySQLTests.java404
-rw-r--r--jpa/tests/org.eclipse.jpt.db.tests/src/org/eclipse/jpt/db/tests/internal/platforms/Oracle10gTests.java397
-rw-r--r--jpa/tests/org.eclipse.jpt.db.tests/src/org/eclipse/jpt/db/tests/internal/platforms/Oracle10gXETests.java79
-rw-r--r--jpa/tests/org.eclipse.jpt.db.tests/src/org/eclipse/jpt/db/tests/internal/platforms/Oracle9iTests.java79
-rw-r--r--jpa/tests/org.eclipse.jpt.db.tests/src/org/eclipse/jpt/db/tests/internal/platforms/PostgreSQLTests.java486
-rw-r--r--jpa/tests/org.eclipse.jpt.db.tests/src/org/eclipse/jpt/db/tests/internal/platforms/SQLServerTests.java83
-rw-r--r--jpa/tests/org.eclipse.jpt.db.tests/src/org/eclipse/jpt/db/tests/internal/platforms/SybaseTests.java443
-rw-r--r--jpa/tests/org.eclipse.jpt.eclipselink.core.tests/.classpath13
-rw-r--r--jpa/tests/org.eclipse.jpt.eclipselink.core.tests/.cvsignore5
-rw-r--r--jpa/tests/org.eclipse.jpt.eclipselink.core.tests/.project28
-rw-r--r--jpa/tests/org.eclipse.jpt.eclipselink.core.tests/.settings/org.eclipse.core.resources.prefs3
-rw-r--r--jpa/tests/org.eclipse.jpt.eclipselink.core.tests/META-INF/MANIFEST.MF39
-rw-r--r--jpa/tests/org.eclipse.jpt.eclipselink.core.tests/about.html34
-rw-r--r--jpa/tests/org.eclipse.jpt.eclipselink.core.tests/build.properties19
-rw-r--r--jpa/tests/org.eclipse.jpt.eclipselink.core.tests/plugin.properties22
-rw-r--r--jpa/tests/org.eclipse.jpt.eclipselink.core.tests/src/org/eclipse/jpt/eclipselink/core/tests/internal/JptEclipseLinkCoreTests.java101
-rw-r--r--jpa/tests/org.eclipse.jpt.eclipselink.core.tests/src/org/eclipse/jpt/eclipselink/core/tests/internal/context/EclipseLinkContextModelTestCase.java52
-rw-r--r--jpa/tests/org.eclipse.jpt.eclipselink.core.tests/src/org/eclipse/jpt/eclipselink/core/tests/internal/context/EclipseLinkJpaProjectTests.java134
-rw-r--r--jpa/tests/org.eclipse.jpt.eclipselink.core.tests/src/org/eclipse/jpt/eclipselink/core/tests/internal/context/JptEclipseLinkCoreContextModelTests.java39
-rw-r--r--jpa/tests/org.eclipse.jpt.eclipselink.core.tests/src/org/eclipse/jpt/eclipselink/core/tests/internal/context/java/EclipseLinkJavaBasicMappingTests.java315
-rw-r--r--jpa/tests/org.eclipse.jpt.eclipselink.core.tests/src/org/eclipse/jpt/eclipselink/core/tests/internal/context/java/EclipseLinkJavaCachingTests.java632
-rw-r--r--jpa/tests/org.eclipse.jpt.eclipselink.core.tests/src/org/eclipse/jpt/eclipselink/core/tests/internal/context/java/EclipseLinkJavaConvertTests.java221
-rw-r--r--jpa/tests/org.eclipse.jpt.eclipselink.core.tests/src/org/eclipse/jpt/eclipselink/core/tests/internal/context/java/EclipseLinkJavaConverterTests.java214
-rw-r--r--jpa/tests/org.eclipse.jpt.eclipselink.core.tests/src/org/eclipse/jpt/eclipselink/core/tests/internal/context/java/EclipseLinkJavaEmbeddableTests.java251
-rw-r--r--jpa/tests/org.eclipse.jpt.eclipselink.core.tests/src/org/eclipse/jpt/eclipselink/core/tests/internal/context/java/EclipseLinkJavaEntityTests.java338
-rw-r--r--jpa/tests/org.eclipse.jpt.eclipselink.core.tests/src/org/eclipse/jpt/eclipselink/core/tests/internal/context/java/EclipseLinkJavaIdMappingTests.java316
-rw-r--r--jpa/tests/org.eclipse.jpt.eclipselink.core.tests/src/org/eclipse/jpt/eclipselink/core/tests/internal/context/java/EclipseLinkJavaManyToManyMappingTests.java145
-rw-r--r--jpa/tests/org.eclipse.jpt.eclipselink.core.tests/src/org/eclipse/jpt/eclipselink/core/tests/internal/context/java/EclipseLinkJavaManyToOneMappingTests.java144
-rw-r--r--jpa/tests/org.eclipse.jpt.eclipselink.core.tests/src/org/eclipse/jpt/eclipselink/core/tests/internal/context/java/EclipseLinkJavaMappedSuperclassTests.java336
-rw-r--r--jpa/tests/org.eclipse.jpt.eclipselink.core.tests/src/org/eclipse/jpt/eclipselink/core/tests/internal/context/java/EclipseLinkJavaObjectTypeConverterTests.java621
-rw-r--r--jpa/tests/org.eclipse.jpt.eclipselink.core.tests/src/org/eclipse/jpt/eclipselink/core/tests/internal/context/java/EclipseLinkJavaOneToManyMappingTests.java436
-rw-r--r--jpa/tests/org.eclipse.jpt.eclipselink.core.tests/src/org/eclipse/jpt/eclipselink/core/tests/internal/context/java/EclipseLinkJavaOneToOneMappingTests.java435
-rw-r--r--jpa/tests/org.eclipse.jpt.eclipselink.core.tests/src/org/eclipse/jpt/eclipselink/core/tests/internal/context/java/EclipseLinkJavaStructConverterTests.java213
-rw-r--r--jpa/tests/org.eclipse.jpt.eclipselink.core.tests/src/org/eclipse/jpt/eclipselink/core/tests/internal/context/java/EclipseLinkJavaTypeConverterTests.java301
-rw-r--r--jpa/tests/org.eclipse.jpt.eclipselink.core.tests/src/org/eclipse/jpt/eclipselink/core/tests/internal/context/java/EclipseLinkJavaVersionMappingTests.java315
-rw-r--r--jpa/tests/org.eclipse.jpt.eclipselink.core.tests/src/org/eclipse/jpt/eclipselink/core/tests/internal/context/java/JptEclipseLinkCoreJavaContextModelTests.java48
-rw-r--r--jpa/tests/org.eclipse.jpt.eclipselink.core.tests/src/org/eclipse/jpt/eclipselink/core/tests/internal/context/orm/EclipseLinkEntityMappingsTests.java675
-rw-r--r--jpa/tests/org.eclipse.jpt.eclipselink.core.tests/src/org/eclipse/jpt/eclipselink/core/tests/internal/context/orm/EclipseLinkOrmBasicMappingTests.java389
-rw-r--r--jpa/tests/org.eclipse.jpt.eclipselink.core.tests/src/org/eclipse/jpt/eclipselink/core/tests/internal/context/orm/EclipseLinkOrmContextModelTestCase.java84
-rw-r--r--jpa/tests/org.eclipse.jpt.eclipselink.core.tests/src/org/eclipse/jpt/eclipselink/core/tests/internal/context/orm/EclipseLinkOrmConverterTests.java195
-rw-r--r--jpa/tests/org.eclipse.jpt.eclipselink.core.tests/src/org/eclipse/jpt/eclipselink/core/tests/internal/context/orm/EclipseLinkOrmEmbeddableTests.java1034
-rw-r--r--jpa/tests/org.eclipse.jpt.eclipselink.core.tests/src/org/eclipse/jpt/eclipselink/core/tests/internal/context/orm/EclipseLinkOrmEntityTests.java2393
-rw-r--r--jpa/tests/org.eclipse.jpt.eclipselink.core.tests/src/org/eclipse/jpt/eclipselink/core/tests/internal/context/orm/EclipseLinkOrmIdMappingTests.java388
-rw-r--r--jpa/tests/org.eclipse.jpt.eclipselink.core.tests/src/org/eclipse/jpt/eclipselink/core/tests/internal/context/orm/EclipseLinkOrmManyToManyMappingTests.java248
-rw-r--r--jpa/tests/org.eclipse.jpt.eclipselink.core.tests/src/org/eclipse/jpt/eclipselink/core/tests/internal/context/orm/EclipseLinkOrmManyToOneMappingTests.java185
-rw-r--r--jpa/tests/org.eclipse.jpt.eclipselink.core.tests/src/org/eclipse/jpt/eclipselink/core/tests/internal/context/orm/EclipseLinkOrmMappedSuperclassTests.java2146
-rw-r--r--jpa/tests/org.eclipse.jpt.eclipselink.core.tests/src/org/eclipse/jpt/eclipselink/core/tests/internal/context/orm/EclipseLinkOrmObjectTypeConverterTests.java572
-rw-r--r--jpa/tests/org.eclipse.jpt.eclipselink.core.tests/src/org/eclipse/jpt/eclipselink/core/tests/internal/context/orm/EclipseLinkOrmOneToManyMappingTests.java308
-rw-r--r--jpa/tests/org.eclipse.jpt.eclipselink.core.tests/src/org/eclipse/jpt/eclipselink/core/tests/internal/context/orm/EclipseLinkOrmOneToOneMappingTests.java244
-rw-r--r--jpa/tests/org.eclipse.jpt.eclipselink.core.tests/src/org/eclipse/jpt/eclipselink/core/tests/internal/context/orm/EclipseLinkOrmPersistentAttributeTests.java314
-rw-r--r--jpa/tests/org.eclipse.jpt.eclipselink.core.tests/src/org/eclipse/jpt/eclipselink/core/tests/internal/context/orm/EclipseLinkOrmStructConverterTests.java200
-rw-r--r--jpa/tests/org.eclipse.jpt.eclipselink.core.tests/src/org/eclipse/jpt/eclipselink/core/tests/internal/context/orm/EclipseLinkOrmTransientMappingTests.java63
-rw-r--r--jpa/tests/org.eclipse.jpt.eclipselink.core.tests/src/org/eclipse/jpt/eclipselink/core/tests/internal/context/orm/EclipseLinkOrmTypeConverterTests.java269
-rw-r--r--jpa/tests/org.eclipse.jpt.eclipselink.core.tests/src/org/eclipse/jpt/eclipselink/core/tests/internal/context/orm/EclipseLinkOrmVersionMappingTests.java388
-rw-r--r--jpa/tests/org.eclipse.jpt.eclipselink.core.tests/src/org/eclipse/jpt/eclipselink/core/tests/internal/context/orm/EclipseLinkPersistenceUnitDefaultsTests.java369
-rw-r--r--jpa/tests/org.eclipse.jpt.eclipselink.core.tests/src/org/eclipse/jpt/eclipselink/core/tests/internal/context/orm/EclipseLinkPersistenceUnitMetadataTests.java105
-rw-r--r--jpa/tests/org.eclipse.jpt.eclipselink.core.tests/src/org/eclipse/jpt/eclipselink/core/tests/internal/context/orm/JptEclipseLinkCoreOrmContextModelTests.java51
-rw-r--r--jpa/tests/org.eclipse.jpt.eclipselink.core.tests/src/org/eclipse/jpt/eclipselink/core/tests/internal/context/persistence/EclipseLinkPersistenceUnitTests.java109
-rw-r--r--jpa/tests/org.eclipse.jpt.eclipselink.core.tests/src/org/eclipse/jpt/eclipselink/core/tests/internal/context/persistence/JptEclipseLinkCorePersistenceContextModelTests.java37
-rw-r--r--jpa/tests/org.eclipse.jpt.eclipselink.core.tests/src/org/eclipse/jpt/eclipselink/core/tests/internal/context/persistence/PersistenceUnitTestCase.java373
-rw-r--r--jpa/tests/org.eclipse.jpt.eclipselink.core.tests/src/org/eclipse/jpt/eclipselink/core/tests/internal/context/persistence/caching/CachingAdapterTests.java444
-rw-r--r--jpa/tests/org.eclipse.jpt.eclipselink.core.tests/src/org/eclipse/jpt/eclipselink/core/tests/internal/context/persistence/caching/CachingValueModelTests.java444
-rw-r--r--jpa/tests/org.eclipse.jpt.eclipselink.core.tests/src/org/eclipse/jpt/eclipselink/core/tests/internal/context/persistence/caching/JptEclipseLinkPersistenceCachingTests.java33
-rw-r--r--jpa/tests/org.eclipse.jpt.eclipselink.core.tests/src/org/eclipse/jpt/eclipselink/core/tests/internal/context/persistence/connection/ConnectionAdapterTests.java485
-rw-r--r--jpa/tests/org.eclipse.jpt.eclipselink.core.tests/src/org/eclipse/jpt/eclipselink/core/tests/internal/context/persistence/connection/JptEclipseLinkPersistenceConnectionTests.java33
-rw-r--r--jpa/tests/org.eclipse.jpt.eclipselink.core.tests/src/org/eclipse/jpt/eclipselink/core/tests/internal/context/persistence/customization/CustomizationAdapterTests.java713
-rw-r--r--jpa/tests/org.eclipse.jpt.eclipselink.core.tests/src/org/eclipse/jpt/eclipselink/core/tests/internal/context/persistence/customization/CustomizationValueModelTests.java204
-rw-r--r--jpa/tests/org.eclipse.jpt.eclipselink.core.tests/src/org/eclipse/jpt/eclipselink/core/tests/internal/context/persistence/customization/JptEclipseLinkPersistenceCustomizationTests.java33
-rw-r--r--jpa/tests/org.eclipse.jpt.eclipselink.core.tests/src/org/eclipse/jpt/eclipselink/core/tests/internal/context/persistence/general/GeneralPropertiesAdapterTests.java105
-rw-r--r--jpa/tests/org.eclipse.jpt.eclipselink.core.tests/src/org/eclipse/jpt/eclipselink/core/tests/internal/context/persistence/general/GeneralPropertiesValueModelTests.java162
-rw-r--r--jpa/tests/org.eclipse.jpt.eclipselink.core.tests/src/org/eclipse/jpt/eclipselink/core/tests/internal/context/persistence/general/JptEclipseLinkPersistenceGeneralTests.java33
-rw-r--r--jpa/tests/org.eclipse.jpt.eclipselink.core.tests/src/org/eclipse/jpt/eclipselink/core/tests/internal/context/persistence/logging/JptEclipseLinkPersistenceLoggingTests.java33
-rw-r--r--jpa/tests/org.eclipse.jpt.eclipselink.core.tests/src/org/eclipse/jpt/eclipselink/core/tests/internal/context/persistence/logging/LoggingAdapterTests.java325
-rw-r--r--jpa/tests/org.eclipse.jpt.eclipselink.core.tests/src/org/eclipse/jpt/eclipselink/core/tests/internal/context/persistence/logging/LoggingValueModelTests.java162
-rw-r--r--jpa/tests/org.eclipse.jpt.eclipselink.core.tests/src/org/eclipse/jpt/eclipselink/core/tests/internal/context/persistence/options/JptEclipseLinkPersistenceOptionsTests.java33
-rw-r--r--jpa/tests/org.eclipse.jpt.eclipselink.core.tests/src/org/eclipse/jpt/eclipselink/core/tests/internal/context/persistence/options/OptionsAdapterTests.java379
-rw-r--r--jpa/tests/org.eclipse.jpt.eclipselink.core.tests/src/org/eclipse/jpt/eclipselink/core/tests/internal/context/persistence/options/OptionsValueModelTests.java161
-rw-r--r--jpa/tests/org.eclipse.jpt.eclipselink.core.tests/src/org/eclipse/jpt/eclipselink/core/tests/internal/context/persistence/schema/generation/JptEclipseLinkPersistenceSchemaGenerationTests.java35
-rw-r--r--jpa/tests/org.eclipse.jpt.eclipselink.core.tests/src/org/eclipse/jpt/eclipselink/core/tests/internal/context/persistence/schema/generation/SchemaGenerationAdapterTests.java239
-rw-r--r--jpa/tests/org.eclipse.jpt.eclipselink.core.tests/src/org/eclipse/jpt/eclipselink/core/tests/internal/context/persistence/schema/generation/SchemaGenerationBasicAdapterTests.java153
-rw-r--r--jpa/tests/org.eclipse.jpt.eclipselink.core.tests/src/org/eclipse/jpt/eclipselink/core/tests/internal/context/persistence/schema/generation/SchemaGenerationValueModelTests.java232
-rw-r--r--jpa/tests/org.eclipse.jpt.eclipselink.core.tests/src/org/eclipse/jpt/eclipselink/core/tests/internal/resource/JptEclipselinkCoreResourceModelTests.java34
-rw-r--r--jpa/tests/org.eclipse.jpt.eclipselink.core.tests/src/org/eclipse/jpt/eclipselink/core/tests/internal/resource/java/CacheTests.java447
-rw-r--r--jpa/tests/org.eclipse.jpt.eclipselink.core.tests/src/org/eclipse/jpt/eclipselink/core/tests/internal/resource/java/ChangeTrackingTests.java88
-rw-r--r--jpa/tests/org.eclipse.jpt.eclipselink.core.tests/src/org/eclipse/jpt/eclipselink/core/tests/internal/resource/java/ConversionValueAnnotationTests.java131
-rw-r--r--jpa/tests/org.eclipse.jpt.eclipselink.core.tests/src/org/eclipse/jpt/eclipselink/core/tests/internal/resource/java/ConvertAnnotationTests.java105
-rw-r--r--jpa/tests/org.eclipse.jpt.eclipselink.core.tests/src/org/eclipse/jpt/eclipselink/core/tests/internal/resource/java/ConverterAnnotationTests.java155
-rw-r--r--jpa/tests/org.eclipse.jpt.eclipselink.core.tests/src/org/eclipse/jpt/eclipselink/core/tests/internal/resource/java/CustomizerAnnotationTests.java99
-rw-r--r--jpa/tests/org.eclipse.jpt.eclipselink.core.tests/src/org/eclipse/jpt/eclipselink/core/tests/internal/resource/java/EclipseLinkJavaResourceModelTestCase.java34
-rw-r--r--jpa/tests/org.eclipse.jpt.eclipselink.core.tests/src/org/eclipse/jpt/eclipselink/core/tests/internal/resource/java/ExistenceCheckingTests.java88
-rw-r--r--jpa/tests/org.eclipse.jpt.eclipselink.core.tests/src/org/eclipse/jpt/eclipselink/core/tests/internal/resource/java/JoinFetchTests.java92
-rw-r--r--jpa/tests/org.eclipse.jpt.eclipselink.core.tests/src/org/eclipse/jpt/eclipselink/core/tests/internal/resource/java/JptEclipseLinkCoreJavaResourceModelTests.java50
-rw-r--r--jpa/tests/org.eclipse.jpt.eclipselink.core.tests/src/org/eclipse/jpt/eclipselink/core/tests/internal/resource/java/MutableAnnotationTests.java111
-rw-r--r--jpa/tests/org.eclipse.jpt.eclipselink.core.tests/src/org/eclipse/jpt/eclipselink/core/tests/internal/resource/java/ObjectTypeConverterAnnotationTests.java426
-rw-r--r--jpa/tests/org.eclipse.jpt.eclipselink.core.tests/src/org/eclipse/jpt/eclipselink/core/tests/internal/resource/java/PrivateOwnedTests.java49
-rw-r--r--jpa/tests/org.eclipse.jpt.eclipselink.core.tests/src/org/eclipse/jpt/eclipselink/core/tests/internal/resource/java/ReadOnlyTests.java47
-rw-r--r--jpa/tests/org.eclipse.jpt.eclipselink.core.tests/src/org/eclipse/jpt/eclipselink/core/tests/internal/resource/java/ReadTransformerAnnotationTests.java155
-rw-r--r--jpa/tests/org.eclipse.jpt.eclipselink.core.tests/src/org/eclipse/jpt/eclipselink/core/tests/internal/resource/java/StructConverterAnnotationTests.java155
-rw-r--r--jpa/tests/org.eclipse.jpt.eclipselink.core.tests/src/org/eclipse/jpt/eclipselink/core/tests/internal/resource/java/TimeOfDayTests.java220
-rw-r--r--jpa/tests/org.eclipse.jpt.eclipselink.core.tests/src/org/eclipse/jpt/eclipselink/core/tests/internal/resource/java/TransformationAnnotationTests.java157
-rw-r--r--jpa/tests/org.eclipse.jpt.eclipselink.core.tests/src/org/eclipse/jpt/eclipselink/core/tests/internal/resource/java/TypeConverterAnnotationTests.java214
-rw-r--r--jpa/tests/org.eclipse.jpt.eclipselink.core.tests/src/org/eclipse/jpt/eclipselink/core/tests/internal/resource/java/WriteTransformerAnnotationTests.java219
-rw-r--r--jpa/tests/org.eclipse.jpt.eclipselink.core.tests/src/org/eclipse/jpt/eclipselink1_1/core/tests/internal/context/EclipseLink1_1ContextModelTestCase.java35
-rw-r--r--jpa/tests/org.eclipse.jpt.eclipselink.core.tests/src/org/eclipse/jpt/eclipselink1_1/core/tests/internal/context/EclipseLink1_1JpaProjectTests.java164
-rw-r--r--jpa/tests/org.eclipse.jpt.eclipselink.core.tests/src/org/eclipse/jpt/eclipselink1_1/core/tests/internal/context/JptEclipseLink1_1CoreContextModelTests.java36
-rw-r--r--jpa/tests/org.eclipse.jpt.eclipselink.core.tests/src/org/eclipse/jpt/eclipselink1_1/core/tests/internal/context/orm/EclipseLink1_1OrmContextModelTestCase.java88
-rw-r--r--jpa/tests/org.eclipse.jpt.eclipselink.core.tests/src/org/eclipse/jpt/eclipselink1_1/core/tests/internal/context/orm/EclipseLink1_1OrmPersistentAttributeTests.java435
-rw-r--r--jpa/tests/org.eclipse.jpt.eclipselink.core.tests/src/org/eclipse/jpt/eclipselink1_1/core/tests/internal/context/orm/EclipseLink1_1OrmPersistentTypeTests.java306
-rw-r--r--jpa/tests/org.eclipse.jpt.eclipselink.core.tests/src/org/eclipse/jpt/eclipselink1_1/core/tests/internal/context/orm/EclipseLink1_1OrmTransientMappingTests.java63
-rw-r--r--jpa/tests/org.eclipse.jpt.eclipselink.core.tests/src/org/eclipse/jpt/eclipselink1_1/core/tests/internal/context/orm/JptEclipseLink1_1CoreOrmContextModelTests.java37
-rw-r--r--jpa/tests/org.eclipse.jpt.eclipselink.core.tests/test.xml47
-rw-r--r--jpa/tests/org.eclipse.jpt.gen.tests/.classpath11
-rw-r--r--jpa/tests/org.eclipse.jpt.gen.tests/.project28
-rw-r--r--jpa/tests/org.eclipse.jpt.gen.tests/.settings/org.eclipse.jdt.core.prefs7
-rw-r--r--jpa/tests/org.eclipse.jpt.gen.tests/META-INF/MANIFEST.MF14
-rw-r--r--jpa/tests/org.eclipse.jpt.gen.tests/about.html34
-rw-r--r--jpa/tests/org.eclipse.jpt.gen.tests/build.properties18
-rw-r--r--jpa/tests/org.eclipse.jpt.gen.tests/plugin.properties22
-rw-r--r--jpa/tests/org.eclipse.jpt.gen.tests/src/org/eclipse/jpt/gen/tests/internal/EntityGenToolsTests.java144
-rw-r--r--jpa/tests/org.eclipse.jpt.gen.tests/src/org/eclipse/jpt/gen/tests/internal/JptGenTests.java32
-rw-r--r--jpa/tests/org.eclipse.jpt.gen.tests/test.xml40
-rw-r--r--jpa/tests/org.eclipse.jpt.ui.tests/.classpath13
-rw-r--r--jpa/tests/org.eclipse.jpt.ui.tests/.project28
-rw-r--r--jpa/tests/org.eclipse.jpt.ui.tests/.settings/org.eclipse.core.resources.prefs3
-rw-r--r--jpa/tests/org.eclipse.jpt.ui.tests/META-INF/MANIFEST.MF24
-rw-r--r--jpa/tests/org.eclipse.jpt.ui.tests/build.properties4
-rw-r--r--jpa/tests/org.eclipse.jpt.ui.tests/plugin.properties22
-rw-r--r--jpa/tests/org.eclipse.jpt.ui.tests/src/org/eclipse/jpt/ui/tests/JptUiTests.java36
-rw-r--r--jpa/tests/org.eclipse.jpt.ui.tests/src/org/eclipse/jpt/ui/tests/internal/jface/DelegatingLabelProviderUiTest.java603
-rw-r--r--jpa/tests/org.eclipse.jpt.ui.tests/src/org/eclipse/jpt/ui/tests/internal/jface/DelegatingTreeContentProviderUiTest.java566
-rw-r--r--jpa/tests/org.eclipse.jpt.ui.tests/src/org/eclipse/jpt/ui/tests/internal/platform/JpaPlatformUiExtensionTests.java56
-rw-r--r--jpa/tests/org.eclipse.jpt.ui.tests/src/org/eclipse/jpt/ui/tests/internal/platform/JptUiPlatformTests.java27
-rw-r--r--jpa/tests/org.eclipse.jpt.ui.tests/src/org/eclipse/jpt/ui/tests/internal/swt/AbstractComboModelAdapterTest.java773
-rw-r--r--jpa/tests/org.eclipse.jpt.ui.tests/src/org/eclipse/jpt/ui/tests/internal/swt/CComboModelAdapterTest.java75
-rw-r--r--jpa/tests/org.eclipse.jpt.ui.tests/src/org/eclipse/jpt/ui/tests/internal/swt/CheckBoxModelAdapterUITest.java318
-rw-r--r--jpa/tests/org.eclipse.jpt.ui.tests/src/org/eclipse/jpt/ui/tests/internal/swt/ComboModelAdapterTest.java78
-rw-r--r--jpa/tests/org.eclipse.jpt.ui.tests/src/org/eclipse/jpt/ui/tests/internal/swt/JptUiSWTTests.java39
-rw-r--r--jpa/tests/org.eclipse.jpt.ui.tests/src/org/eclipse/jpt/ui/tests/internal/swt/ListBoxModelAdapterUITest.java640
-rw-r--r--jpa/tests/org.eclipse.jpt.ui.tests/src/org/eclipse/jpt/ui/tests/internal/swt/SpinnerModelAdapterTest.java340
-rw-r--r--jpa/tests/org.eclipse.jpt.ui.tests/src/org/eclipse/jpt/ui/tests/internal/swt/TableModelAdapterTest.java1203
-rw-r--r--jpa/tests/org.eclipse.jpt.ui.tests/src/org/eclipse/jpt/ui/tests/internal/swt/TextFieldModelAdapterUITest.java252
-rw-r--r--jpa/tests/org.eclipse.jpt.ui.tests/src/org/eclipse/jpt/ui/tests/internal/swt/TriStateCheckBoxModelAdapterUITest.java320
-rw-r--r--jpa/tests/org.eclipse.jpt.ui.tests/src/org/eclipse/jpt/ui/tests/internal/util/ControlAlignerTest.java800
-rw-r--r--jpa/tests/org.eclipse.jpt.ui.tests/src/org/eclipse/jpt/ui/tests/internal/util/ControlEnablerTest.java84
-rw-r--r--jpa/tests/org.eclipse.jpt.ui.tests/src/org/eclipse/jpt/ui/tests/internal/util/ControlSwitcherTest.java187
-rw-r--r--jpa/tests/org.eclipse.jpt.ui.tests/src/org/eclipse/jpt/ui/tests/internal/util/ControlVisibilityEnablerTest.java84
-rw-r--r--jpa/tests/org.eclipse.jpt.ui.tests/src/org/eclipse/jpt/ui/tests/internal/util/JptUiUtilTests.java44
-rw-r--r--jpa/tests/org.eclipse.jpt.ui.tests/src/org/eclipse/jpt/ui/tests/internal/util/LabeledButtonTest.java122
-rw-r--r--jpa/tests/org.eclipse.jpt.ui.tests/src/org/eclipse/jpt/ui/tests/internal/util/LabeledControlUpdaterTest.java124
-rw-r--r--jpa/tests/org.eclipse.jpt.ui.tests/src/org/eclipse/jpt/ui/tests/internal/util/LabeledLabelTest.java122
-rw-r--r--jpa/tests/org.eclipse.jpt.ui.tests/src/org/eclipse/jpt/ui/tests/internal/util/PaneEnablerTest.java93
-rw-r--r--jpa/tests/org.eclipse.jpt.ui.tests/src/org/eclipse/jpt/ui/tests/internal/util/PaneVisibilityEnablerTest.java93
1053 files changed, 0 insertions, 156830 deletions
diff --git a/assembly/features/org.eclipse.jpt.assembly.feature/.cvsignore b/assembly/features/org.eclipse.jpt.assembly.feature/.cvsignore
deleted file mode 100644
index de8b73fb72..0000000000
--- a/assembly/features/org.eclipse.jpt.assembly.feature/.cvsignore
+++ /dev/null
@@ -1,2 +0,0 @@
-build.xml
-org.eclipse.jpt_1.0.0.*
diff --git a/assembly/features/org.eclipse.jpt.assembly.feature/.project b/assembly/features/org.eclipse.jpt.assembly.feature/.project
deleted file mode 100644
index 1e211aff8d..0000000000
--- a/assembly/features/org.eclipse.jpt.assembly.feature/.project
+++ /dev/null
@@ -1,17 +0,0 @@
-<?xml version="1.0" encoding="UTF-8"?>
-<projectDescription>
- <name>org.eclipse.jpt.assembly.feature</name>
- <comment></comment>
- <projects>
- </projects>
- <buildSpec>
- <buildCommand>
- <name>org.eclipse.pde.FeatureBuilder</name>
- <arguments>
- </arguments>
- </buildCommand>
- </buildSpec>
- <natures>
- <nature>org.eclipse.pde.FeatureNature</nature>
- </natures>
-</projectDescription>
diff --git a/assembly/features/org.eclipse.jpt.assembly.feature/build.properties b/assembly/features/org.eclipse.jpt.assembly.feature/build.properties
deleted file mode 100644
index 470b4bcb63..0000000000
--- a/assembly/features/org.eclipse.jpt.assembly.feature/build.properties
+++ /dev/null
@@ -1,16 +0,0 @@
-###############################################################################
-# Copyright (c) 2006 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
-#
-# Contributors:
-# Oracle. - initial API and implementation
-###############################################################################
-bin.includes = feature.xml,\
- eclipse_update_120.jpg,\
- epl-v10.html,\
- license.html,\
- feature.properties
- \ No newline at end of file
diff --git a/assembly/features/org.eclipse.jpt.assembly.feature/eclipse_update_120.jpg b/assembly/features/org.eclipse.jpt.assembly.feature/eclipse_update_120.jpg
deleted file mode 100644
index bfdf708ad6..0000000000
--- a/assembly/features/org.eclipse.jpt.assembly.feature/eclipse_update_120.jpg
+++ /dev/null
Binary files differ
diff --git a/assembly/features/org.eclipse.jpt.assembly.feature/epl-v10.html b/assembly/features/org.eclipse.jpt.assembly.feature/epl-v10.html
deleted file mode 100644
index ed4b196655..0000000000
--- a/assembly/features/org.eclipse.jpt.assembly.feature/epl-v10.html
+++ /dev/null
@@ -1,328 +0,0 @@
-<html xmlns:o="urn:schemas-microsoft-com:office:office"
-xmlns:w="urn:schemas-microsoft-com:office:word"
-xmlns="http://www.w3.org/TR/REC-html40">
-
-<head>
-<meta http-equiv=Content-Type content="text/html; charset=windows-1252">
-<meta name=ProgId content=Word.Document>
-<meta name=Generator content="Microsoft Word 9">
-<meta name=Originator content="Microsoft Word 9">
-<link rel=File-List
-href="./Eclipse%20EPL%202003_11_10%20Final_files/filelist.xml">
-<title>Eclipse Public License - Version 1.0</title>
-<!--[if gte mso 9]><xml>
- <o:DocumentProperties>
- <o:Revision>2</o:Revision>
- <o:TotalTime>3</o:TotalTime>
- <o:Created>2004-03-05T23:03:00Z</o:Created>
- <o:LastSaved>2004-03-05T23:03:00Z</o:LastSaved>
- <o:Pages>4</o:Pages>
- <o:Words>1626</o:Words>
- <o:Characters>9270</o:Characters>
- <o:Lines>77</o:Lines>
- <o:Paragraphs>18</o:Paragraphs>
- <o:CharactersWithSpaces>11384</o:CharactersWithSpaces>
- <o:Version>9.4402</o:Version>
- </o:DocumentProperties>
-</xml><![endif]--><!--[if gte mso 9]><xml>
- <w:WordDocument>
- <w:TrackRevisions/>
- </w:WordDocument>
-</xml><![endif]-->
-<style>
-<!--
- /* Font Definitions */
-@font-face
- {font-family:Tahoma;
- panose-1:2 11 6 4 3 5 4 4 2 4;
- mso-font-charset:0;
- mso-generic-font-family:swiss;
- mso-font-pitch:variable;
- mso-font-signature:553679495 -2147483648 8 0 66047 0;}
- /* Style Definitions */
-p.MsoNormal, li.MsoNormal, div.MsoNormal
- {mso-style-parent:"";
- margin:0in;
- margin-bottom:.0001pt;
- mso-pagination:widow-orphan;
- font-size:12.0pt;
- font-family:"Times New Roman";
- mso-fareast-font-family:"Times New Roman";}
-p
- {margin-right:0in;
- mso-margin-top-alt:auto;
- mso-margin-bottom-alt:auto;
- margin-left:0in;
- mso-pagination:widow-orphan;
- font-size:12.0pt;
- font-family:"Times New Roman";
- mso-fareast-font-family:"Times New Roman";}
-p.BalloonText, li.BalloonText, div.BalloonText
- {mso-style-name:"Balloon Text";
- margin:0in;
- margin-bottom:.0001pt;
- mso-pagination:widow-orphan;
- font-size:8.0pt;
- font-family:Tahoma;
- mso-fareast-font-family:"Times New Roman";}
-@page Section1
- {size:8.5in 11.0in;
- margin:1.0in 1.25in 1.0in 1.25in;
- mso-header-margin:.5in;
- mso-footer-margin:.5in;
- mso-paper-source:0;}
-div.Section1
- {page:Section1;}
--->
-</style>
-</head>
-
-<body lang=EN-US style='tab-interval:.5in'>
-
-<div class=Section1>
-
-<p align=center style='text-align:center'><b>Eclipse Public License - v 1.0</b>
-</p>
-
-<p><span style='font-size:10.0pt'>THE ACCOMPANYING PROGRAM IS PROVIDED UNDER
-THE TERMS OF THIS ECLIPSE PUBLIC LICENSE (&quot;AGREEMENT&quot;). ANY USE,
-REPRODUCTION OR DISTRIBUTION OF THE PROGRAM CONSTITUTES RECIPIENT'S ACCEPTANCE
-OF THIS AGREEMENT.</span> </p>
-
-<p><b><span style='font-size:10.0pt'>1. DEFINITIONS</span></b> </p>
-
-<p><span style='font-size:10.0pt'>&quot;Contribution&quot; means:</span> </p>
-
-<p class=MsoNormal style='margin-left:.5in'><span style='font-size:10.0pt'>a)
-in the case of the initial Contributor, the initial code and documentation
-distributed under this Agreement, and<br clear=left>
-b) in the case of each subsequent Contributor:</span></p>
-
-<p class=MsoNormal style='margin-left:.5in'><span style='font-size:10.0pt'>i)
-changes to the Program, and</span></p>
-
-<p class=MsoNormal style='margin-left:.5in'><span style='font-size:10.0pt'>ii)
-additions to the Program;</span></p>
-
-<p class=MsoNormal style='margin-left:.5in'><span style='font-size:10.0pt'>where
-such changes and/or additions to the Program originate from and are distributed
-by that particular Contributor. A Contribution 'originates' from a Contributor
-if it was added to the Program by such Contributor itself or anyone acting on
-such Contributor's behalf. Contributions do not include additions to the
-Program which: (i) are separate modules of software distributed in conjunction
-with the Program under their own license agreement, and (ii) are not derivative
-works of the Program. </span></p>
-
-<p><span style='font-size:10.0pt'>&quot;Contributor&quot; means any person or
-entity that distributes the Program.</span> </p>
-
-<p><span style='font-size:10.0pt'>&quot;Licensed Patents &quot; mean patent
-claims licensable by a Contributor which are necessarily infringed by the use
-or sale of its Contribution alone or when combined with the Program. </span></p>
-
-<p><span style='font-size:10.0pt'>&quot;Program&quot; means the Contributions
-distributed in accordance with this Agreement.</span> </p>
-
-<p><span style='font-size:10.0pt'>&quot;Recipient&quot; means anyone who
-receives the Program under this Agreement, including all Contributors.</span> </p>
-
-<p><b><span style='font-size:10.0pt'>2. GRANT OF RIGHTS</span></b> </p>
-
-<p class=MsoNormal style='margin-left:.5in'><span style='font-size:10.0pt'>a)
-Subject to the terms of this Agreement, each Contributor hereby grants Recipient
-a non-exclusive, worldwide, royalty-free copyright license to<span
-style='color:red'> </span>reproduce, prepare derivative works of, publicly
-display, publicly perform, distribute and sublicense the Contribution of such
-Contributor, if any, and such derivative works, in source code and object code
-form.</span></p>
-
-<p class=MsoNormal style='margin-left:.5in'><span style='font-size:10.0pt'>b)
-Subject to the terms of this Agreement, each Contributor hereby grants
-Recipient a non-exclusive, worldwide,<span style='color:green'> </span>royalty-free
-patent license under Licensed Patents to make, use, sell, offer to sell, import
-and otherwise transfer the Contribution of such Contributor, if any, in source
-code and object code form. This patent license shall apply to the combination
-of the Contribution and the Program if, at the time the Contribution is added
-by the Contributor, such addition of the Contribution causes such combination
-to be covered by the Licensed Patents. The patent license shall not apply to
-any other combinations which include the Contribution. No hardware per se is
-licensed hereunder. </span></p>
-
-<p class=MsoNormal style='margin-left:.5in'><span style='font-size:10.0pt'>c)
-Recipient understands that although each Contributor grants the licenses to its
-Contributions set forth herein, no assurances are provided by any Contributor
-that the Program does not infringe the patent or other intellectual property
-rights of any other entity. Each Contributor disclaims any liability to Recipient
-for claims brought by any other entity based on infringement of intellectual
-property rights or otherwise. As a condition to exercising the rights and
-licenses granted hereunder, each Recipient hereby assumes sole responsibility
-to secure any other intellectual property rights needed, if any. For example,
-if a third party patent license is required to allow Recipient to distribute
-the Program, it is Recipient's responsibility to acquire that license before
-distributing the Program.</span></p>
-
-<p class=MsoNormal style='margin-left:.5in'><span style='font-size:10.0pt'>d)
-Each Contributor represents that to its knowledge it has sufficient copyright
-rights in its Contribution, if any, to grant the copyright license set forth in
-this Agreement. </span></p>
-
-<p><b><span style='font-size:10.0pt'>3. REQUIREMENTS</span></b> </p>
-
-<p><span style='font-size:10.0pt'>A Contributor may choose to distribute the
-Program in object code form under its own license agreement, provided that:</span>
-</p>
-
-<p class=MsoNormal style='margin-left:.5in'><span style='font-size:10.0pt'>a)
-it complies with the terms and conditions of this Agreement; and</span></p>
-
-<p class=MsoNormal style='margin-left:.5in'><span style='font-size:10.0pt'>b)
-its license agreement:</span></p>
-
-<p class=MsoNormal style='margin-left:.5in'><span style='font-size:10.0pt'>i)
-effectively disclaims on behalf of all Contributors all warranties and
-conditions, express and implied, including warranties or conditions of title
-and non-infringement, and implied warranties or conditions of merchantability
-and fitness for a particular purpose; </span></p>
-
-<p class=MsoNormal style='margin-left:.5in'><span style='font-size:10.0pt'>ii)
-effectively excludes on behalf of all Contributors all liability for damages,
-including direct, indirect, special, incidental and consequential damages, such
-as lost profits; </span></p>
-
-<p class=MsoNormal style='margin-left:.5in'><span style='font-size:10.0pt'>iii)
-states that any provisions which differ from this Agreement are offered by that
-Contributor alone and not by any other party; and</span></p>
-
-<p class=MsoNormal style='margin-left:.5in'><span style='font-size:10.0pt'>iv)
-states that source code for the Program is available from such Contributor, and
-informs licensees how to obtain it in a reasonable manner on or through a
-medium customarily used for software exchange.<span style='color:blue'> </span></span></p>
-
-<p><span style='font-size:10.0pt'>When the Program is made available in source
-code form:</span> </p>
-
-<p class=MsoNormal style='margin-left:.5in'><span style='font-size:10.0pt'>a)
-it must be made available under this Agreement; and </span></p>
-
-<p class=MsoNormal style='margin-left:.5in'><span style='font-size:10.0pt'>b) a
-copy of this Agreement must be included with each copy of the Program. </span></p>
-
-<p><span style='font-size:10.0pt'>Contributors may not remove or alter any
-copyright notices contained within the Program. </span></p>
-
-<p><span style='font-size:10.0pt'>Each Contributor must identify itself as the
-originator of its Contribution, if any, in a manner that reasonably allows
-subsequent Recipients to identify the originator of the Contribution. </span></p>
-
-<p><b><span style='font-size:10.0pt'>4. COMMERCIAL DISTRIBUTION</span></b> </p>
-
-<p><span style='font-size:10.0pt'>Commercial distributors of software may
-accept certain responsibilities with respect to end users, business partners
-and the like. While this license is intended to facilitate the commercial use
-of the Program, the Contributor who includes the Program in a commercial
-product offering should do so in a manner which does not create potential
-liability for other Contributors. Therefore, if a Contributor includes the
-Program in a commercial product offering, such Contributor (&quot;Commercial
-Contributor&quot;) hereby agrees to defend and indemnify every other
-Contributor (&quot;Indemnified Contributor&quot;) against any losses, damages and
-costs (collectively &quot;Losses&quot;) arising from claims, lawsuits and other
-legal actions brought by a third party against the Indemnified Contributor to
-the extent caused by the acts or omissions of such Commercial Contributor in
-connection with its distribution of the Program in a commercial product
-offering. The obligations in this section do not apply to any claims or Losses
-relating to any actual or alleged intellectual property infringement. In order
-to qualify, an Indemnified Contributor must: a) promptly notify the Commercial
-Contributor in writing of such claim, and b) allow the Commercial Contributor
-to control, and cooperate with the Commercial Contributor in, the defense and
-any related settlement negotiations. The Indemnified Contributor may participate
-in any such claim at its own expense.</span> </p>
-
-<p><span style='font-size:10.0pt'>For example, a Contributor might include the
-Program in a commercial product offering, Product X. That Contributor is then a
-Commercial Contributor. If that Commercial Contributor then makes performance
-claims, or offers warranties related to Product X, those performance claims and
-warranties are such Commercial Contributor's responsibility alone. Under this
-section, the Commercial Contributor would have to defend claims against the
-other Contributors related to those performance claims and warranties, and if a
-court requires any other Contributor to pay any damages as a result, the
-Commercial Contributor must pay those damages.</span> </p>
-
-<p><b><span style='font-size:10.0pt'>5. NO WARRANTY</span></b> </p>
-
-<p><span style='font-size:10.0pt'>EXCEPT AS EXPRESSLY SET FORTH IN THIS
-AGREEMENT, THE PROGRAM IS PROVIDED ON AN &quot;AS IS&quot; BASIS, WITHOUT
-WARRANTIES OR CONDITIONS OF ANY KIND, EITHER EXPRESS OR IMPLIED INCLUDING,
-WITHOUT LIMITATION, ANY WARRANTIES OR CONDITIONS OF TITLE, NON-INFRINGEMENT,
-MERCHANTABILITY OR FITNESS FOR A PARTICULAR PURPOSE. Each Recipient is solely
-responsible for determining the appropriateness of using and distributing the
-Program and assumes all risks associated with its exercise of rights under this
-Agreement , including but not limited to the risks and costs of program errors,
-compliance with applicable laws, damage to or loss of data, programs or
-equipment, and unavailability or interruption of operations. </span></p>
-
-<p><b><span style='font-size:10.0pt'>6. DISCLAIMER OF LIABILITY</span></b> </p>
-
-<p><span style='font-size:10.0pt'>EXCEPT AS EXPRESSLY SET FORTH IN THIS
-AGREEMENT, NEITHER RECIPIENT NOR ANY CONTRIBUTORS SHALL HAVE ANY LIABILITY FOR
-ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES
-(INCLUDING WITHOUT LIMITATION LOST PROFITS), HOWEVER CAUSED AND ON ANY THEORY
-OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING
-NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OR DISTRIBUTION OF
-THE PROGRAM OR THE EXERCISE OF ANY RIGHTS GRANTED HEREUNDER, EVEN IF ADVISED OF
-THE POSSIBILITY OF SUCH DAMAGES.</span> </p>
-
-<p><b><span style='font-size:10.0pt'>7. GENERAL</span></b> </p>
-
-<p><span style='font-size:10.0pt'>If any provision of this Agreement is invalid
-or unenforceable under applicable law, it shall not affect the validity or
-enforceability of the remainder of the terms of this Agreement, and without
-further action by the parties hereto, such provision shall be reformed to the
-minimum extent necessary to make such provision valid and enforceable.</span> </p>
-
-<p><span style='font-size:10.0pt'>If Recipient institutes patent litigation
-against any entity (including a cross-claim or counterclaim in a lawsuit)
-alleging that the Program itself (excluding combinations of the Program with
-other software or hardware) infringes such Recipient's patent(s), then such
-Recipient's rights granted under Section 2(b) shall terminate as of the date
-such litigation is filed. </span></p>
-
-<p><span style='font-size:10.0pt'>All Recipient's rights under this Agreement
-shall terminate if it fails to comply with any of the material terms or
-conditions of this Agreement and does not cure such failure in a reasonable
-period of time after becoming aware of such noncompliance. If all Recipient's
-rights under this Agreement terminate, Recipient agrees to cease use and
-distribution of the Program as soon as reasonably practicable. However,
-Recipient's obligations under this Agreement and any licenses granted by
-Recipient relating to the Program shall continue and survive. </span></p>
-
-<p><span style='font-size:10.0pt'>Everyone is permitted to copy and distribute
-copies of this Agreement, but in order to avoid inconsistency the Agreement is
-copyrighted and may only be modified in the following manner. The Agreement
-Steward reserves the right to publish new versions (including revisions) of
-this Agreement from time to time. No one other than the Agreement Steward has
-the right to modify this Agreement. The Eclipse Foundation is the initial
-Agreement Steward. The Eclipse Foundation may assign the responsibility to
-serve as the Agreement Steward to a suitable separate entity. Each new version
-of the Agreement will be given a distinguishing version number. The Program
-(including Contributions) may always be distributed subject to the version of
-the Agreement under which it was received. In addition, after a new version of
-the Agreement is published, Contributor may elect to distribute the Program
-(including its Contributions) under the new version. Except as expressly stated
-in Sections 2(a) and 2(b) above, Recipient receives no rights or licenses to
-the intellectual property of any Contributor under this Agreement, whether
-expressly, by implication, estoppel or otherwise. All rights in the Program not
-expressly granted under this Agreement are reserved.</span> </p>
-
-<p><span style='font-size:10.0pt'>This Agreement is governed by the laws of the
-State of New York and the intellectual property laws of the United States of
-America. No party to this Agreement will bring a legal action under this
-Agreement more than one year after the cause of action arose. Each party waives
-its rights to a jury trial in any resulting litigation.</span> </p>
-
-<p class=MsoNormal><![if !supportEmptyParas]>&nbsp;<![endif]><o:p></o:p></p>
-
-</div>
-
-</body>
-
-</html> \ No newline at end of file
diff --git a/assembly/features/org.eclipse.jpt.assembly.feature/feature.properties b/assembly/features/org.eclipse.jpt.assembly.feature/feature.properties
deleted file mode 100644
index 5771e2672f..0000000000
--- a/assembly/features/org.eclipse.jpt.assembly.feature/feature.properties
+++ /dev/null
@@ -1,144 +0,0 @@
-###############################################################################
-# Copyright (c) 2006 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
-#
-# Contributors:
-# Oracle. - initial API and implementation
-###############################################################################
-# feature.properties
-# contains externalized strings for feature.xml
-# "%foo" in feature.xml corresponds to the key "foo" in this file
-# java.io.Properties file (ISO 8859-1 with "\" escapes)
-# This file should be translated.
-
-# "featureName" property - name of the feature
-featureName=Dali Java Persistence Tools
-
-# "providerName" property - name of the company that provides the feature
-providerName=Eclipse Web Tools Platform
-
-# "updateSiteName" property - label for the update site
-updateSiteName=The Eclipse Web Tools Platform (WTP) Project update site
-
-# "description" property - description of the feature
-description=Dali Java Persistence Tools - Runtime
-
-# "copyright" property - text of the "Feature Update Copyright"
-copyright=\
-Copyright (c) 2006 Oracle Corporation.\n\
-All rights reserved. This program and the accompanying materials\n\
-are made available under the terms of the Eclipse Public License v1.0\n\
-which accompanies this distribution, and is available at\n\
-http://www.eclipse.org/legal/epl-v10.html\n\
-\n\
-Contributors:\n\
- Oracle - initial API and implementation\n
-################ end of copyright property ####################################
-
-# "licenseURL" property - URL of the "Feature License"
-# do not translate value - just change to point to a locale-specific HTML page
-licenseURL=license.html
-
-# "license" property - text of the "Feature Update License"
-# should be plain text version of license agreement pointed to be "licenseURL"
-license=\
-ECLIPSE FOUNDATION SOFTWARE USER AGREEMENT\n\
-March 17, 2005\n\
-\n\
-Usage Of Content\n\
-\n\
-THE ECLIPSE FOUNDATION MAKES AVAILABLE SOFTWARE, DOCUMENTATION, INFORMATION AND/OR\n\
-OTHER MATERIALS FOR OPEN SOURCE PROJECTS (COLLECTIVELY "CONTENT").\n\
-USE OF THE CONTENT IS GOVERNED BY THE TERMS AND CONDITIONS OF THIS\n\
-AGREEMENT AND/OR THE TERMS AND CONDITIONS OF LICENSE AGREEMENTS OR\n\
-NOTICES INDICATED OR REFERENCED BELOW. BY USING THE CONTENT, YOU\n\
-AGREE THAT YOUR USE OF THE CONTENT IS GOVERNED BY THIS AGREEMENT\n\
-AND/OR THE TERMS AND CONDITIONS OF ANY APPLICABLE LICENSE AGREEMENTS\n\
-OR NOTICES INDICATED OR REFERENCED BELOW. IF YOU DO NOT AGREE TO THE\n\
-TERMS AND CONDITIONS OF THIS AGREEMENT AND THE TERMS AND CONDITIONS\n\
-OF ANY APPLICABLE LICENSE AGREEMENTS OR NOTICES INDICATED OR REFERENCED\n\
-BELOW, THEN YOU MAY NOT USE THE CONTENT.\n\
-\n\
-Applicable Licenses\n\
-\n\
-Unless otherwise indicated, all Content made available by the Eclipse Foundation\n\
-is provided to you under the terms and conditions of the Eclipse Public\n\
-License Version 1.0 ("EPL"). A copy of the EPL is provided with this\n\
-Content and is also available at http://www.eclipse.org/legal/epl-v10.html.\n\
-For purposes of the EPL, "Program" will mean the Content.\n\
-\n\
-Content includes, but is not limited to, source code, object code,\n\
-documentation and other files maintained in the Eclipse.org CVS\n\
-repository ("Repository") in CVS modules ("Modules") and made available\n\
-as downloadable archives ("Downloads").\n\
-\n\
- - Content may be structured and packaged into modules to facilitate delivering,\n\
- extending, and upgrading the Content. Typical modules may include plug-ins ("Plug-ins"),\n\
- plug-in fragments ("Fragments"), and features ("Features").\n\
- - Each Plug-in or Fragment may be packaged as a sub-directory or JAR (Java? ARchive)\n\
- in a directory named "plugins".\n\
- - A Feature is a bundle of one or more Plug-ins and/or Fragments and associated material.\n\
- Each Feature may be packaged as a sub-directory in a directory named "features".\n\
- Within a Feature, files named "feature.xml" may contain a list of the names and version\n\
- numbers of the Plug-ins and/or Fragments associated with that Feature.\n\
- - Features may also include other Features ("Included Features"). Within a Feature, files\n\
- named "feature.xml" may contain a list of the names and version numbers of Included Features.\n\
-\n\
-Features may also include other Features ("Included Features"). Files named\n\
-"feature.xml" may contain a list of the names and version numbers of\n\
-Included Features.\n\
-\n\
-The terms and conditions governing Plug-ins and Fragments should be\n\
-contained in files named "about.html" ("Abouts"). The terms and\n\
-conditions governing Features and Included Features should be contained\n\
-in files named "license.html" ("Feature Licenses"). Abouts and Feature\n\
-Licenses may be located in any directory of a Download or Module\n\
-including, but not limited to the following locations:\n\
-\n\
- - The top-level (root) directory\n\
- - Plug-in and Fragment directories\n\
- - Inside Plug-ins and Fragments packaged as JARs\n\
- - Sub-directories of the directory named "src" of certain Plug-ins\n\
- - Feature directories\n\
-\n\
-Note: if a Feature made available by the Eclipse Foundation is installed using the\n\
-Eclipse Update Manager, you must agree to a license ("Feature Update\n\
-License") during the installation process. If the Feature contains\n\
-Included Features, the Feature Update License should either provide you\n\
-with the terms and conditions governing the Included Features or inform\n\
-you where you can locate them. Feature Update Licenses may be found in\n\
-the "license" property of files named "feature.properties". Such Abouts,\n\
-Feature Licenses and Feature Update Licenses contain the terms and\n\
-conditions (or references to such terms and conditions) that govern your\n\
-use of the associated Content in that directory.\n\
-\n\
-THE ABOUTS, FEATURE LICENSES AND FEATURE UPDATE LICENSES MAY REFER\n\
-TO THE EPL OR OTHER LICENSE AGREEMENTS, NOTICES OR TERMS AND CONDITIONS.\n\
-SOME OF THESE OTHER LICENSE AGREEMENTS MAY INCLUDE (BUT ARE NOT LIMITED TO):\n\
-\n\
- - Common Public License Version 1.0 (available at http://www.eclipse.org/legal/cpl-v10.html)\n\
- - Apache Software License 1.1 (available at http://www.apache.org/licenses/LICENSE)\n\
- - Apache Software License 2.0 (available at http://www.apache.org/licenses/LICENSE-2.0)\n\
- - IBM Public License 1.0 (available at http://oss.software.ibm.com/developerworks/opensource/license10.html)\n\
- - Metro Link Public License 1.00 (available at http://www.opengroup.org/openmotif/supporters/metrolink/license.html)\n\
- - Mozilla Public License Version 1.1 (available at http://www.mozilla.org/MPL/MPL-1.1.html)\n\
-\n\
-IT IS YOUR OBLIGATION TO READ AND ACCEPT ALL SUCH TERMS AND CONDITIONS PRIOR\n\
-TO USE OF THE CONTENT. If no About, Feature License or Feature Update License\n\
-is provided, please contact the Eclipse Foundation to determine what terms and conditions\n\
-govern that particular Content.\n\
-\n\
-Cryptography\n\
-\n\
-Content may contain encryption software. The country in which you are\n\
-currently may have restrictions on the import, possession, and use,\n\
-and/or re-export to another country, of encryption software. BEFORE\n\
-using any encryption software, please check the country's laws,\n\
-regulations and policies concerning the import, possession, or use,\n\
-and re-export of encryption software, to see if this is permitted.\n\
-\n\
-Java and all Java-based trademarks are trademarks of Sun Microsystems, Inc. in the United States, other countries, or both.\n
-########### end of license property ##########################################
diff --git a/assembly/features/org.eclipse.jpt.assembly.feature/feature.xml b/assembly/features/org.eclipse.jpt.assembly.feature/feature.xml
deleted file mode 100644
index 51482ec6ad..0000000000
--- a/assembly/features/org.eclipse.jpt.assembly.feature/feature.xml
+++ /dev/null
@@ -1,34 +0,0 @@
-<?xml version="1.0" encoding="UTF-8"?>
-<feature
- id="org.eclipse.jpt.assembly.feature"
- label="%featureName"
- version="2.2.0.qualifier"
- provider-name="%providerName"
- image="eclipse_update_120.jpg">
-
- <description>
- %description
- </description>
-
- <copyright>
- %copyright
- </copyright>
-
- <license url="license.html">
- %license
- </license>
-
- <url>
- <update label="%updateSiteName" url="http://download.eclipse.org/webtools/updates"/>
- <discovery label="Web Tools Platform (WTP) Updates" url="http://download.eclipse.org/webtools/updates"/>
- </url>
-
- <includes
- id="org.eclipse.jpt.feature"
- version="0.0.0"/>
-
- <includes
- id="org.eclipse.jpt.eclipselink.feature"
- version="0.0.0"/>
-
-</feature>
diff --git a/assembly/features/org.eclipse.jpt.assembly.feature/license.html b/assembly/features/org.eclipse.jpt.assembly.feature/license.html
deleted file mode 100644
index 2347060ef3..0000000000
--- a/assembly/features/org.eclipse.jpt.assembly.feature/license.html
+++ /dev/null
@@ -1,93 +0,0 @@
-<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN" "http://www.w3c.org/TR/1999/REC-html401-19991224/loose.dtd">
-<!-- saved from url=(0044)http://www.eclipse.org/legal/epl/notice.html -->
-<HTML><HEAD><TITLE>Eclipse.org Software User Agreement</TITLE>
-<META http-equiv=Content-Type content="text/html; charset=iso-8859-1">
-<META content="MSHTML 6.00.2800.1479" name=GENERATOR></HEAD>
-<BODY lang=EN-US vLink=purple link=blue>
-<H2>Eclipse Foundation Software User Agreement</H2>
-<P>January 28, 2005</P>
-<H3>Usage Of Content</H3>
-<P>THE ECLIPSE FOUNDATION MAKES AVAILABLE SOFTWARE, DOCUMENTATION, INFORMATION
-AND/OR OTHER MATERIALS FOR OPEN SOURCE PROJECTS (COLLECTIVELY "CONTENT"). USE OF
-THE CONTENT IS GOVERNED BY THE TERMS AND CONDITIONS OF THIS AGREEMENT AND/OR THE
-TERMS AND CONDITIONS OF LICENSE AGREEMENTS OR NOTICES INDICATED OR REFERENCED
-BELOW. BY USING THE CONTENT, YOU AGREE THAT YOUR USE OF THE CONTENT IS GOVERNED
-BY THIS AGREEMENT AND/OR THE TERMS AND CONDITIONS OF ANY APPLICABLE LICENSE
-AGREEMENTS OR NOTICES INDICATED OR REFERENCED BELOW. IF YOU DO NOT AGREE TO THE
-TERMS AND CONDITIONS OF THIS AGREEMENT AND THE TERMS AND CONDITIONS OF ANY
-APPLICABLE LICENSE AGREEMENTS OR NOTICES INDICATED OR REFERENCED BELOW, THEN YOU
-MAY NOT USE THE CONTENT.</P>
-<H3>Applicable Licenses</H3>
-<P>Unless otherwise indicated, all Content made available by the Eclipse
-Foundation is provided to you under the terms and conditions of the Eclipse
-Public License Version 1.0 ("EPL"). A copy of the EPL is provided with this
-Content and is also available at <A
-href="http://www.eclipse.org/legal/epl-v10.html">http://www.eclipse.org/legal/epl-v10.html</A>.
-For purposes of the EPL, "Program" will mean the Content.</P>
-<P>Content includes, but is not limited to, source code, object code,
-documentation and other files maintained in the Eclipse.org CVS repository
-("Repository") in CVS modules ("Modules") and made available as downloadable
-archives ("Downloads").</P>
-<P>Content may be apportioned into plug-ins ("Plug-ins"), plug-in fragments
-("Fragments"), and features ("Features"). A Feature is a bundle of one or more
-Plug-ins and/or Fragments and associated material. Files named "feature.xml" may
-contain a list of the names and version numbers of the Plug-ins and/or Fragments
-associated with a Feature. Plug-ins and Fragments are located in directories
-named "plugins" and Features are located in directories named "features".</P>
-<P>Features may also include other Features ("Included Features"). Files named
-"feature.xml" may contain a list of the names and version numbers of Included
-Features.</P>
-<P>The terms and conditions governing Plug-ins and Fragments should be contained
-in files named "about.html" ("Abouts"). The terms and conditions governing
-Features and Included Features should be contained in files named "license.html"
-("Feature Licenses"). Abouts and Feature Licenses may be located in any
-directory of a Download or Module including, but not limited to the following
-locations:</P>
-<UL>
- <LI>The top-level (root) directory
- <LI>Plug-in and Fragment directories
- <LI>Subdirectories of the directory named "src" of certain Plug-ins
- <LI>Feature directories </LI></UL>
-<P>Note: if a Feature made available by the Eclipse Foundation is installed
-using the Eclipse Update Manager, you must agree to a license ("Feature Update
-License") during the installation process. If the Feature contains Included
-Features, the Feature Update License should either provide you with the terms
-and conditions governing the Included Features or inform you where you can
-locate them. Feature Update Licenses may be found in the "license" property of
-files named "feature.properties". Such Abouts, Feature Licenses and Feature
-Update Licenses contain the terms and conditions (or references to such terms
-and conditions) that govern your use of the associated Content in that
-directory.</P>
-<P>THE ABOUTS, FEATURE LICENSES AND FEATURE UPDATE LICENSES MAY REFER TO THE EPL
-OR OTHER LICENSE AGREEMENTS, NOTICES OR TERMS AND CONDITIONS. SOME OF THESE
-OTHER LICENSE AGREEMENTS MAY INCLUDE (BUT ARE NOT LIMITED TO):</P>
-<UL>
- <LI>Common Public License Version 1.0 (available at <A
- href="http://www.eclipse.org/legal/cpl-v10.html">http://www.eclipse.org/legal/cpl-v10.html</A>)
-
- <LI>Apache Software License 1.1 (available at <A
- href="http://www.apache.org/licenses/LICENSE">http://www.apache.org/licenses/LICENSE</A>)
-
- <LI>Apache Software License 2.0 (available at <A
- href="http://www.apache.org/licenses/LICENSE-2.0">http://www.apache.org/licenses/LICENSE-2.0</A>)
-
- <LI>IBM Public License 1.0 (available at <A
- href="http://oss.software.ibm.com/developerworks/opensource/license10.html">http://oss.software.ibm.com/developerworks/opensource/license10.html</A>)
-
- <LI>Metro Link Public License 1.00 (available at <A
- href="http://www.opengroup.org/openmotif/supporters/metrolink/license.html">http://www.opengroup.org/openmotif/supporters/metrolink/license.html</A>)
-
- <LI>Mozilla Public License Version 1.1 (available at <A
- href="http://www.mozilla.org/MPL/MPL-1.1.html">http://www.mozilla.org/MPL/MPL-1.1.html</A>)
- </LI></UL>
-<P>IT IS YOUR OBLIGATION TO READ AND ACCEPT ALL SUCH TERMS AND CONDITIONS PRIOR
-TO USE OF THE CONTENT. If no About, Feature License or Feature Update License is
-provided, please contact the Eclipse Foundation to determine what terms and
-conditions govern that particular Content.</P>
-<H3>Cryptography</H3>
-<P>Content may contain encryption software. The country in which you are
-currently may have restrictions on the import, possession, and use, and/or
-re-export to another country, of encryption software. BEFORE using any
-encryption software, please check the country's laws, regulations and policies
-concerning the import, possession, or use, and re-export of encryption software,
-to see if this is permitted.</P></BODY></HTML>
diff --git a/assembly/features/org.eclipse.jpt.patch/.project b/assembly/features/org.eclipse.jpt.patch/.project
deleted file mode 100644
index b7a2bf552d..0000000000
--- a/assembly/features/org.eclipse.jpt.patch/.project
+++ /dev/null
@@ -1,17 +0,0 @@
-<?xml version="1.0" encoding="UTF-8"?>
-<projectDescription>
- <name>org.eclipse.jpt.patch</name>
- <comment></comment>
- <projects>
- </projects>
- <buildSpec>
- <buildCommand>
- <name>org.eclipse.pde.FeatureBuilder</name>
- <arguments>
- </arguments>
- </buildCommand>
- </buildSpec>
- <natures>
- <nature>org.eclipse.pde.FeatureNature</nature>
- </natures>
-</projectDescription>
diff --git a/assembly/features/org.eclipse.jpt.patch/build.properties b/assembly/features/org.eclipse.jpt.patch/build.properties
deleted file mode 100644
index c381fb22bb..0000000000
--- a/assembly/features/org.eclipse.jpt.patch/build.properties
+++ /dev/null
@@ -1,10 +0,0 @@
-bin.includes = feature.xml,\
- license.html,\
- feature.properties,\
- epl-v10.html,\
- eclipse_update_120.jpg
-src.includes = eclipse_update_120.jpg,\
- epl-v10.html,\
- feature.properties,\
- feature.xml,\
- license.html
diff --git a/assembly/features/org.eclipse.jpt.patch/buildnotes_org.eclipse.jpt.patch.html b/assembly/features/org.eclipse.jpt.patch/buildnotes_org.eclipse.jpt.patch.html
deleted file mode 100644
index 0d115f43fb..0000000000
--- a/assembly/features/org.eclipse.jpt.patch/buildnotes_org.eclipse.jpt.patch.html
+++ /dev/null
@@ -1,20 +0,0 @@
-<!doctype html public "-//w3c//dtd html 4.0 transitional//en">
-<html>
-
-<head>
- <meta http-equiv="Content-Type" content="text/html; charset=iso-8859-1">
- <meta name="Build" content="Build">
- <title>Java Persistence Tools (JTP) 1.0.2 Patches</title>
-</head>
-
-<body>
-
-<h1>JTP 2.0.2 Patches</h1>
-
-<h2>Feature Patched: org.eclipse.jpt.patch</h2>
-<h3>Plugin(s) replaced:</h3>
-<ul><li>org.eclipse.jpt.gen</li></ul>
-<p>Bug <a href='https://bugs.eclipse.org/220297'>220297</a>. Entity generation creates Embeddables with compile errors in some cases.</p>
-
-
-</body></html> \ No newline at end of file
diff --git a/assembly/features/org.eclipse.jpt.patch/eclipse_update_120.jpg b/assembly/features/org.eclipse.jpt.patch/eclipse_update_120.jpg
deleted file mode 100644
index bfdf708ad6..0000000000
--- a/assembly/features/org.eclipse.jpt.patch/eclipse_update_120.jpg
+++ /dev/null
Binary files differ
diff --git a/assembly/features/org.eclipse.jpt.patch/epl-v10.html b/assembly/features/org.eclipse.jpt.patch/epl-v10.html
deleted file mode 100644
index ed4b196655..0000000000
--- a/assembly/features/org.eclipse.jpt.patch/epl-v10.html
+++ /dev/null
@@ -1,328 +0,0 @@
-<html xmlns:o="urn:schemas-microsoft-com:office:office"
-xmlns:w="urn:schemas-microsoft-com:office:word"
-xmlns="http://www.w3.org/TR/REC-html40">
-
-<head>
-<meta http-equiv=Content-Type content="text/html; charset=windows-1252">
-<meta name=ProgId content=Word.Document>
-<meta name=Generator content="Microsoft Word 9">
-<meta name=Originator content="Microsoft Word 9">
-<link rel=File-List
-href="./Eclipse%20EPL%202003_11_10%20Final_files/filelist.xml">
-<title>Eclipse Public License - Version 1.0</title>
-<!--[if gte mso 9]><xml>
- <o:DocumentProperties>
- <o:Revision>2</o:Revision>
- <o:TotalTime>3</o:TotalTime>
- <o:Created>2004-03-05T23:03:00Z</o:Created>
- <o:LastSaved>2004-03-05T23:03:00Z</o:LastSaved>
- <o:Pages>4</o:Pages>
- <o:Words>1626</o:Words>
- <o:Characters>9270</o:Characters>
- <o:Lines>77</o:Lines>
- <o:Paragraphs>18</o:Paragraphs>
- <o:CharactersWithSpaces>11384</o:CharactersWithSpaces>
- <o:Version>9.4402</o:Version>
- </o:DocumentProperties>
-</xml><![endif]--><!--[if gte mso 9]><xml>
- <w:WordDocument>
- <w:TrackRevisions/>
- </w:WordDocument>
-</xml><![endif]-->
-<style>
-<!--
- /* Font Definitions */
-@font-face
- {font-family:Tahoma;
- panose-1:2 11 6 4 3 5 4 4 2 4;
- mso-font-charset:0;
- mso-generic-font-family:swiss;
- mso-font-pitch:variable;
- mso-font-signature:553679495 -2147483648 8 0 66047 0;}
- /* Style Definitions */
-p.MsoNormal, li.MsoNormal, div.MsoNormal
- {mso-style-parent:"";
- margin:0in;
- margin-bottom:.0001pt;
- mso-pagination:widow-orphan;
- font-size:12.0pt;
- font-family:"Times New Roman";
- mso-fareast-font-family:"Times New Roman";}
-p
- {margin-right:0in;
- mso-margin-top-alt:auto;
- mso-margin-bottom-alt:auto;
- margin-left:0in;
- mso-pagination:widow-orphan;
- font-size:12.0pt;
- font-family:"Times New Roman";
- mso-fareast-font-family:"Times New Roman";}
-p.BalloonText, li.BalloonText, div.BalloonText
- {mso-style-name:"Balloon Text";
- margin:0in;
- margin-bottom:.0001pt;
- mso-pagination:widow-orphan;
- font-size:8.0pt;
- font-family:Tahoma;
- mso-fareast-font-family:"Times New Roman";}
-@page Section1
- {size:8.5in 11.0in;
- margin:1.0in 1.25in 1.0in 1.25in;
- mso-header-margin:.5in;
- mso-footer-margin:.5in;
- mso-paper-source:0;}
-div.Section1
- {page:Section1;}
--->
-</style>
-</head>
-
-<body lang=EN-US style='tab-interval:.5in'>
-
-<div class=Section1>
-
-<p align=center style='text-align:center'><b>Eclipse Public License - v 1.0</b>
-</p>
-
-<p><span style='font-size:10.0pt'>THE ACCOMPANYING PROGRAM IS PROVIDED UNDER
-THE TERMS OF THIS ECLIPSE PUBLIC LICENSE (&quot;AGREEMENT&quot;). ANY USE,
-REPRODUCTION OR DISTRIBUTION OF THE PROGRAM CONSTITUTES RECIPIENT'S ACCEPTANCE
-OF THIS AGREEMENT.</span> </p>
-
-<p><b><span style='font-size:10.0pt'>1. DEFINITIONS</span></b> </p>
-
-<p><span style='font-size:10.0pt'>&quot;Contribution&quot; means:</span> </p>
-
-<p class=MsoNormal style='margin-left:.5in'><span style='font-size:10.0pt'>a)
-in the case of the initial Contributor, the initial code and documentation
-distributed under this Agreement, and<br clear=left>
-b) in the case of each subsequent Contributor:</span></p>
-
-<p class=MsoNormal style='margin-left:.5in'><span style='font-size:10.0pt'>i)
-changes to the Program, and</span></p>
-
-<p class=MsoNormal style='margin-left:.5in'><span style='font-size:10.0pt'>ii)
-additions to the Program;</span></p>
-
-<p class=MsoNormal style='margin-left:.5in'><span style='font-size:10.0pt'>where
-such changes and/or additions to the Program originate from and are distributed
-by that particular Contributor. A Contribution 'originates' from a Contributor
-if it was added to the Program by such Contributor itself or anyone acting on
-such Contributor's behalf. Contributions do not include additions to the
-Program which: (i) are separate modules of software distributed in conjunction
-with the Program under their own license agreement, and (ii) are not derivative
-works of the Program. </span></p>
-
-<p><span style='font-size:10.0pt'>&quot;Contributor&quot; means any person or
-entity that distributes the Program.</span> </p>
-
-<p><span style='font-size:10.0pt'>&quot;Licensed Patents &quot; mean patent
-claims licensable by a Contributor which are necessarily infringed by the use
-or sale of its Contribution alone or when combined with the Program. </span></p>
-
-<p><span style='font-size:10.0pt'>&quot;Program&quot; means the Contributions
-distributed in accordance with this Agreement.</span> </p>
-
-<p><span style='font-size:10.0pt'>&quot;Recipient&quot; means anyone who
-receives the Program under this Agreement, including all Contributors.</span> </p>
-
-<p><b><span style='font-size:10.0pt'>2. GRANT OF RIGHTS</span></b> </p>
-
-<p class=MsoNormal style='margin-left:.5in'><span style='font-size:10.0pt'>a)
-Subject to the terms of this Agreement, each Contributor hereby grants Recipient
-a non-exclusive, worldwide, royalty-free copyright license to<span
-style='color:red'> </span>reproduce, prepare derivative works of, publicly
-display, publicly perform, distribute and sublicense the Contribution of such
-Contributor, if any, and such derivative works, in source code and object code
-form.</span></p>
-
-<p class=MsoNormal style='margin-left:.5in'><span style='font-size:10.0pt'>b)
-Subject to the terms of this Agreement, each Contributor hereby grants
-Recipient a non-exclusive, worldwide,<span style='color:green'> </span>royalty-free
-patent license under Licensed Patents to make, use, sell, offer to sell, import
-and otherwise transfer the Contribution of such Contributor, if any, in source
-code and object code form. This patent license shall apply to the combination
-of the Contribution and the Program if, at the time the Contribution is added
-by the Contributor, such addition of the Contribution causes such combination
-to be covered by the Licensed Patents. The patent license shall not apply to
-any other combinations which include the Contribution. No hardware per se is
-licensed hereunder. </span></p>
-
-<p class=MsoNormal style='margin-left:.5in'><span style='font-size:10.0pt'>c)
-Recipient understands that although each Contributor grants the licenses to its
-Contributions set forth herein, no assurances are provided by any Contributor
-that the Program does not infringe the patent or other intellectual property
-rights of any other entity. Each Contributor disclaims any liability to Recipient
-for claims brought by any other entity based on infringement of intellectual
-property rights or otherwise. As a condition to exercising the rights and
-licenses granted hereunder, each Recipient hereby assumes sole responsibility
-to secure any other intellectual property rights needed, if any. For example,
-if a third party patent license is required to allow Recipient to distribute
-the Program, it is Recipient's responsibility to acquire that license before
-distributing the Program.</span></p>
-
-<p class=MsoNormal style='margin-left:.5in'><span style='font-size:10.0pt'>d)
-Each Contributor represents that to its knowledge it has sufficient copyright
-rights in its Contribution, if any, to grant the copyright license set forth in
-this Agreement. </span></p>
-
-<p><b><span style='font-size:10.0pt'>3. REQUIREMENTS</span></b> </p>
-
-<p><span style='font-size:10.0pt'>A Contributor may choose to distribute the
-Program in object code form under its own license agreement, provided that:</span>
-</p>
-
-<p class=MsoNormal style='margin-left:.5in'><span style='font-size:10.0pt'>a)
-it complies with the terms and conditions of this Agreement; and</span></p>
-
-<p class=MsoNormal style='margin-left:.5in'><span style='font-size:10.0pt'>b)
-its license agreement:</span></p>
-
-<p class=MsoNormal style='margin-left:.5in'><span style='font-size:10.0pt'>i)
-effectively disclaims on behalf of all Contributors all warranties and
-conditions, express and implied, including warranties or conditions of title
-and non-infringement, and implied warranties or conditions of merchantability
-and fitness for a particular purpose; </span></p>
-
-<p class=MsoNormal style='margin-left:.5in'><span style='font-size:10.0pt'>ii)
-effectively excludes on behalf of all Contributors all liability for damages,
-including direct, indirect, special, incidental and consequential damages, such
-as lost profits; </span></p>
-
-<p class=MsoNormal style='margin-left:.5in'><span style='font-size:10.0pt'>iii)
-states that any provisions which differ from this Agreement are offered by that
-Contributor alone and not by any other party; and</span></p>
-
-<p class=MsoNormal style='margin-left:.5in'><span style='font-size:10.0pt'>iv)
-states that source code for the Program is available from such Contributor, and
-informs licensees how to obtain it in a reasonable manner on or through a
-medium customarily used for software exchange.<span style='color:blue'> </span></span></p>
-
-<p><span style='font-size:10.0pt'>When the Program is made available in source
-code form:</span> </p>
-
-<p class=MsoNormal style='margin-left:.5in'><span style='font-size:10.0pt'>a)
-it must be made available under this Agreement; and </span></p>
-
-<p class=MsoNormal style='margin-left:.5in'><span style='font-size:10.0pt'>b) a
-copy of this Agreement must be included with each copy of the Program. </span></p>
-
-<p><span style='font-size:10.0pt'>Contributors may not remove or alter any
-copyright notices contained within the Program. </span></p>
-
-<p><span style='font-size:10.0pt'>Each Contributor must identify itself as the
-originator of its Contribution, if any, in a manner that reasonably allows
-subsequent Recipients to identify the originator of the Contribution. </span></p>
-
-<p><b><span style='font-size:10.0pt'>4. COMMERCIAL DISTRIBUTION</span></b> </p>
-
-<p><span style='font-size:10.0pt'>Commercial distributors of software may
-accept certain responsibilities with respect to end users, business partners
-and the like. While this license is intended to facilitate the commercial use
-of the Program, the Contributor who includes the Program in a commercial
-product offering should do so in a manner which does not create potential
-liability for other Contributors. Therefore, if a Contributor includes the
-Program in a commercial product offering, such Contributor (&quot;Commercial
-Contributor&quot;) hereby agrees to defend and indemnify every other
-Contributor (&quot;Indemnified Contributor&quot;) against any losses, damages and
-costs (collectively &quot;Losses&quot;) arising from claims, lawsuits and other
-legal actions brought by a third party against the Indemnified Contributor to
-the extent caused by the acts or omissions of such Commercial Contributor in
-connection with its distribution of the Program in a commercial product
-offering. The obligations in this section do not apply to any claims or Losses
-relating to any actual or alleged intellectual property infringement. In order
-to qualify, an Indemnified Contributor must: a) promptly notify the Commercial
-Contributor in writing of such claim, and b) allow the Commercial Contributor
-to control, and cooperate with the Commercial Contributor in, the defense and
-any related settlement negotiations. The Indemnified Contributor may participate
-in any such claim at its own expense.</span> </p>
-
-<p><span style='font-size:10.0pt'>For example, a Contributor might include the
-Program in a commercial product offering, Product X. That Contributor is then a
-Commercial Contributor. If that Commercial Contributor then makes performance
-claims, or offers warranties related to Product X, those performance claims and
-warranties are such Commercial Contributor's responsibility alone. Under this
-section, the Commercial Contributor would have to defend claims against the
-other Contributors related to those performance claims and warranties, and if a
-court requires any other Contributor to pay any damages as a result, the
-Commercial Contributor must pay those damages.</span> </p>
-
-<p><b><span style='font-size:10.0pt'>5. NO WARRANTY</span></b> </p>
-
-<p><span style='font-size:10.0pt'>EXCEPT AS EXPRESSLY SET FORTH IN THIS
-AGREEMENT, THE PROGRAM IS PROVIDED ON AN &quot;AS IS&quot; BASIS, WITHOUT
-WARRANTIES OR CONDITIONS OF ANY KIND, EITHER EXPRESS OR IMPLIED INCLUDING,
-WITHOUT LIMITATION, ANY WARRANTIES OR CONDITIONS OF TITLE, NON-INFRINGEMENT,
-MERCHANTABILITY OR FITNESS FOR A PARTICULAR PURPOSE. Each Recipient is solely
-responsible for determining the appropriateness of using and distributing the
-Program and assumes all risks associated with its exercise of rights under this
-Agreement , including but not limited to the risks and costs of program errors,
-compliance with applicable laws, damage to or loss of data, programs or
-equipment, and unavailability or interruption of operations. </span></p>
-
-<p><b><span style='font-size:10.0pt'>6. DISCLAIMER OF LIABILITY</span></b> </p>
-
-<p><span style='font-size:10.0pt'>EXCEPT AS EXPRESSLY SET FORTH IN THIS
-AGREEMENT, NEITHER RECIPIENT NOR ANY CONTRIBUTORS SHALL HAVE ANY LIABILITY FOR
-ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES
-(INCLUDING WITHOUT LIMITATION LOST PROFITS), HOWEVER CAUSED AND ON ANY THEORY
-OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING
-NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OR DISTRIBUTION OF
-THE PROGRAM OR THE EXERCISE OF ANY RIGHTS GRANTED HEREUNDER, EVEN IF ADVISED OF
-THE POSSIBILITY OF SUCH DAMAGES.</span> </p>
-
-<p><b><span style='font-size:10.0pt'>7. GENERAL</span></b> </p>
-
-<p><span style='font-size:10.0pt'>If any provision of this Agreement is invalid
-or unenforceable under applicable law, it shall not affect the validity or
-enforceability of the remainder of the terms of this Agreement, and without
-further action by the parties hereto, such provision shall be reformed to the
-minimum extent necessary to make such provision valid and enforceable.</span> </p>
-
-<p><span style='font-size:10.0pt'>If Recipient institutes patent litigation
-against any entity (including a cross-claim or counterclaim in a lawsuit)
-alleging that the Program itself (excluding combinations of the Program with
-other software or hardware) infringes such Recipient's patent(s), then such
-Recipient's rights granted under Section 2(b) shall terminate as of the date
-such litigation is filed. </span></p>
-
-<p><span style='font-size:10.0pt'>All Recipient's rights under this Agreement
-shall terminate if it fails to comply with any of the material terms or
-conditions of this Agreement and does not cure such failure in a reasonable
-period of time after becoming aware of such noncompliance. If all Recipient's
-rights under this Agreement terminate, Recipient agrees to cease use and
-distribution of the Program as soon as reasonably practicable. However,
-Recipient's obligations under this Agreement and any licenses granted by
-Recipient relating to the Program shall continue and survive. </span></p>
-
-<p><span style='font-size:10.0pt'>Everyone is permitted to copy and distribute
-copies of this Agreement, but in order to avoid inconsistency the Agreement is
-copyrighted and may only be modified in the following manner. The Agreement
-Steward reserves the right to publish new versions (including revisions) of
-this Agreement from time to time. No one other than the Agreement Steward has
-the right to modify this Agreement. The Eclipse Foundation is the initial
-Agreement Steward. The Eclipse Foundation may assign the responsibility to
-serve as the Agreement Steward to a suitable separate entity. Each new version
-of the Agreement will be given a distinguishing version number. The Program
-(including Contributions) may always be distributed subject to the version of
-the Agreement under which it was received. In addition, after a new version of
-the Agreement is published, Contributor may elect to distribute the Program
-(including its Contributions) under the new version. Except as expressly stated
-in Sections 2(a) and 2(b) above, Recipient receives no rights or licenses to
-the intellectual property of any Contributor under this Agreement, whether
-expressly, by implication, estoppel or otherwise. All rights in the Program not
-expressly granted under this Agreement are reserved.</span> </p>
-
-<p><span style='font-size:10.0pt'>This Agreement is governed by the laws of the
-State of New York and the intellectual property laws of the United States of
-America. No party to this Agreement will bring a legal action under this
-Agreement more than one year after the cause of action arose. Each party waives
-its rights to a jury trial in any resulting litigation.</span> </p>
-
-<p class=MsoNormal><![if !supportEmptyParas]>&nbsp;<![endif]><o:p></o:p></p>
-
-</div>
-
-</body>
-
-</html> \ No newline at end of file
diff --git a/assembly/features/org.eclipse.jpt.patch/feature.properties b/assembly/features/org.eclipse.jpt.patch/feature.properties
deleted file mode 100644
index a8457ea0cc..0000000000
--- a/assembly/features/org.eclipse.jpt.patch/feature.properties
+++ /dev/null
@@ -1,143 +0,0 @@
-###############################################################################
-# Copyright (c) 2006 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
-#
-# Contributors:
-# Oracle - initial API and implementation
-###############################################################################
-
-# "featureName" property - name of the feature
-featureName=Java Persistence Tools (JTP) Patches
-
-# "providerName" property - name of the company that provides the feature
-providerName=Eclipse.org
-
-# "updateSiteName" property - label for the update site
-updateSiteName=The Eclipse Web Tools Platform (WTP) Project update site
-
-# "description" property - description of the feature
-description=\
-Patch(s) for Java Persistence API (JPA) Tools. \n\
-See bug 220297 (https://bugs.eclipse.org/bugs/220297) Entity generation creates Embeddables with compile errors in some cases \n\
-
-
-# "copyright" property - text of the "Feature Update Copyright"
-copyright=\
-Copyright (c) 2006-08 Oracle Corporation.\n\
-All rights reserved. This program and the accompanying materials\n\
-are made available under the terms of the Eclipse Public License v1.0\n\
-which accompanies this distribution, and is available at\n\
-http://www.eclipse.org/legal/epl-v10.html\n\
-\n\
-Contributors:\n\
- Oracle - initial API and implementation\n
-################ end of copyright property ####################################
-
-# "licenseURL" property - URL of the "Feature License"
-# do not translate value - just change to point to a locale-specific HTML page
-licenseURL=license.html
-
-# "license" property - text of the "Feature Update License"
-# should be plain text version of license agreement pointed to be "licenseURL"
-license=\
-ECLIPSE FOUNDATION SOFTWARE USER AGREEMENT\n\
-June 06, 2007\n\
-\n\
-Usage Of Content\n\
-\n\
-THE ECLIPSE FOUNDATION MAKES AVAILABLE SOFTWARE, DOCUMENTATION, INFORMATION AND/OR\n\
-OTHER MATERIALS FOR OPEN SOURCE PROJECTS (COLLECTIVELY "CONTENT").\n\
-USE OF THE CONTENT IS GOVERNED BY THE TERMS AND CONDITIONS OF THIS\n\
-AGREEMENT AND/OR THE TERMS AND CONDITIONS OF LICENSE AGREEMENTS OR\n\
-NOTICES INDICATED OR REFERENCED BELOW. BY USING THE CONTENT, YOU\n\
-AGREE THAT YOUR USE OF THE CONTENT IS GOVERNED BY THIS AGREEMENT\n\
-AND/OR THE TERMS AND CONDITIONS OF ANY APPLICABLE LICENSE AGREEMENTS\n\
-OR NOTICES INDICATED OR REFERENCED BELOW. IF YOU DO NOT AGREE TO THE\n\
-TERMS AND CONDITIONS OF THIS AGREEMENT AND THE TERMS AND CONDITIONS\n\
-OF ANY APPLICABLE LICENSE AGREEMENTS OR NOTICES INDICATED OR REFERENCED\n\
-BELOW, THEN YOU MAY NOT USE THE CONTENT.\n\
-\n\
-Applicable Licenses\n\
-\n\
-Unless otherwise indicated, all Content made available by the Eclipse Foundation\n\
-is provided to you under the terms and conditions of the Eclipse Public\n\
-License Version 1.0 ("EPL"). A copy of the EPL is provided with this\n\
-Content and is also available at http://www.eclipse.org/legal/epl-v10.html.\n\
-For purposes of the EPL, "Program" will mean the Content.\n\
-\n\
-Content includes, but is not limited to, source code, object code,\n\
-documentation and other files maintained in the Eclipse.org CVS\n\
-repository ("Repository") in CVS modules ("Modules") and made available\n\
-as downloadable archives ("Downloads").\n\
-\n\
- - Content may be structured and packaged into modules to facilitate delivering,\n\
- extending, and upgrading the Content. Typical modules may include plug-ins ("Plug-ins"),\n\
- plug-in fragments ("Fragments"), and features ("Features").\n\
- - Each Plug-in or Fragment may be packaged as a sub-directory or JAR (Java? ARchive)\n\
- in a directory named "plugins".\n\
- - A Feature is a bundle of one or more Plug-ins and/or Fragments and associated material.\n\
- Each Feature may be packaged as a sub-directory in a directory named "features".\n\
- Within a Feature, files named "feature.xml" may contain a list of the names and version\n\
- numbers of the Plug-ins and/or Fragments associated with that Feature.\n\
- - Features may also include other Features ("Included Features"). Within a Feature, files\n\
- named "feature.xml" may contain a list of the names and version numbers of Included Features.\n\
-\n\
-Features may also include other Features ("Included Features"). Files named\n\
-"feature.xml" may contain a list of the names and version numbers of\n\
-Included Features.\n\
-\n\
-The terms and conditions governing Plug-ins and Fragments should be\n\
-contained in files named "about.html" ("Abouts"). The terms and\n\
-conditions governing Features and Included Features should be contained\n\
-in files named "license.html" ("Feature Licenses"). Abouts and Feature\n\
-Licenses may be located in any directory of a Download or Module\n\
-including, but not limited to the following locations:\n\
-\n\
- - The top-level (root) directory\n\
- - Plug-in and Fragment directories\n\
- - Inside Plug-ins and Fragments packaged as JARs\n\
- - Sub-directories of the directory named "src" of certain Plug-ins\n\
- - Feature directories\n\
-\n\
-Note: if a Feature made available by the Eclipse Foundation is installed using the\n\
-Eclipse Update Manager, you must agree to a license ("Feature Update\n\
-License") during the installation process. If the Feature contains\n\
-Included Features, the Feature Update License should either provide you\n\
-with the terms and conditions governing the Included Features or inform\n\
-you where you can locate them. Feature Update Licenses may be found in\n\
-the "license" property of files named "feature.properties". Such Abouts,\n\
-Feature Licenses and Feature Update Licenses contain the terms and\n\
-conditions (or references to such terms and conditions) that govern your\n\
-use of the associated Content in that directory.\n\
-\n\
-THE ABOUTS, FEATURE LICENSES AND FEATURE UPDATE LICENSES MAY REFER\n\
-TO THE EPL OR OTHER LICENSE AGREEMENTS, NOTICES OR TERMS AND CONDITIONS.\n\
-SOME OF THESE OTHER LICENSE AGREEMENTS MAY INCLUDE (BUT ARE NOT LIMITED TO):\n\
-\n\
- - Common Public License Version 1.0 (available at http://www.eclipse.org/legal/cpl-v10.html)\n\
- - Apache Software License 1.1 (available at http://www.apache.org/licenses/LICENSE)\n\
- - Apache Software License 2.0 (available at http://www.apache.org/licenses/LICENSE-2.0)\n\
- - IBM Public License 1.0 (available at http://oss.software.ibm.com/developerworks/opensource/license10.html)\n\
- - Metro Link Public License 1.00 (available at http://www.opengroup.org/openmotif/supporters/metrolink/license.html)\n\
- - Mozilla Public License Version 1.1 (available at http://www.mozilla.org/MPL/MPL-1.1.html)\n\
- - Common Development and Distribution License (CDDL) Version 1.0 (available at http://www.sun.com/cddl/cddl.html)\n\
-\n\
-IT IS YOUR OBLIGATION TO READ AND ACCEPT ALL SUCH TERMS AND CONDITIONS PRIOR\n\
-TO USE OF THE CONTENT. If no About, Feature License or Feature Update License\n\
-is provided, please contact the Eclipse Foundation to determine what terms and conditions\n\
-govern that particular Content.\n\
-\n\
-Cryptography\n\
-\n\
-Content may contain encryption software. The country in which you are\n\
-currently may have restrictions on the import, possession, and use,\n\
-and/or re-export to another country, of encryption software. BEFORE\n\
-using any encryption software, please check the country's laws,\n\
-regulations and policies concerning the import, possession, or use,\n\
-and re-export of encryption software, to see if this is permitted.\n\
-\n\
-Java and all Java-based trademarks are trademarks of Sun Microsystems, Inc. in the United States, other countries, or both.\n
-########### end of license property ##########################################
diff --git a/assembly/features/org.eclipse.jpt.patch/feature.xml b/assembly/features/org.eclipse.jpt.patch/feature.xml
deleted file mode 100644
index 4fae92b5fa..0000000000
--- a/assembly/features/org.eclipse.jpt.patch/feature.xml
+++ /dev/null
@@ -1,35 +0,0 @@
-<?xml version="1.0" encoding="UTF-8"?>
-<feature
- id="org.eclipse.jpt.patch"
- label="%featureName"
- version="1.0.2.qualifier"
- provider-name="%providerName">
-
- <description url="http://download.eclipse.org/webtools/patches/">
- %description
- </description>
-
- <copyright>
- %copyright
- </copyright>
-
- <license url="%licenseURL">
- %license
- </license>
-
- <url>
- <update label="Web Tools Platform (WTP) Patches" url="http://download.eclipse.org/webtools/patches/"/>
- </url>
-
- <requires>
- <import feature="org.eclipse.jpt.feature" version="1.0.2.v200802140100-77-7_CYQCD2CaLYCHCD" patch="true"/>
- </requires>
-
- <plugin
- id="org.eclipse.jpt.gen"
- download-size="0"
- install-size="0"
- version="0.0.0"
- unpack="false"/>
-
-</feature>
diff --git a/assembly/features/org.eclipse.jpt.patch/license.html b/assembly/features/org.eclipse.jpt.patch/license.html
deleted file mode 100644
index 2347060ef3..0000000000
--- a/assembly/features/org.eclipse.jpt.patch/license.html
+++ /dev/null
@@ -1,93 +0,0 @@
-<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN" "http://www.w3c.org/TR/1999/REC-html401-19991224/loose.dtd">
-<!-- saved from url=(0044)http://www.eclipse.org/legal/epl/notice.html -->
-<HTML><HEAD><TITLE>Eclipse.org Software User Agreement</TITLE>
-<META http-equiv=Content-Type content="text/html; charset=iso-8859-1">
-<META content="MSHTML 6.00.2800.1479" name=GENERATOR></HEAD>
-<BODY lang=EN-US vLink=purple link=blue>
-<H2>Eclipse Foundation Software User Agreement</H2>
-<P>January 28, 2005</P>
-<H3>Usage Of Content</H3>
-<P>THE ECLIPSE FOUNDATION MAKES AVAILABLE SOFTWARE, DOCUMENTATION, INFORMATION
-AND/OR OTHER MATERIALS FOR OPEN SOURCE PROJECTS (COLLECTIVELY "CONTENT"). USE OF
-THE CONTENT IS GOVERNED BY THE TERMS AND CONDITIONS OF THIS AGREEMENT AND/OR THE
-TERMS AND CONDITIONS OF LICENSE AGREEMENTS OR NOTICES INDICATED OR REFERENCED
-BELOW. BY USING THE CONTENT, YOU AGREE THAT YOUR USE OF THE CONTENT IS GOVERNED
-BY THIS AGREEMENT AND/OR THE TERMS AND CONDITIONS OF ANY APPLICABLE LICENSE
-AGREEMENTS OR NOTICES INDICATED OR REFERENCED BELOW. IF YOU DO NOT AGREE TO THE
-TERMS AND CONDITIONS OF THIS AGREEMENT AND THE TERMS AND CONDITIONS OF ANY
-APPLICABLE LICENSE AGREEMENTS OR NOTICES INDICATED OR REFERENCED BELOW, THEN YOU
-MAY NOT USE THE CONTENT.</P>
-<H3>Applicable Licenses</H3>
-<P>Unless otherwise indicated, all Content made available by the Eclipse
-Foundation is provided to you under the terms and conditions of the Eclipse
-Public License Version 1.0 ("EPL"). A copy of the EPL is provided with this
-Content and is also available at <A
-href="http://www.eclipse.org/legal/epl-v10.html">http://www.eclipse.org/legal/epl-v10.html</A>.
-For purposes of the EPL, "Program" will mean the Content.</P>
-<P>Content includes, but is not limited to, source code, object code,
-documentation and other files maintained in the Eclipse.org CVS repository
-("Repository") in CVS modules ("Modules") and made available as downloadable
-archives ("Downloads").</P>
-<P>Content may be apportioned into plug-ins ("Plug-ins"), plug-in fragments
-("Fragments"), and features ("Features"). A Feature is a bundle of one or more
-Plug-ins and/or Fragments and associated material. Files named "feature.xml" may
-contain a list of the names and version numbers of the Plug-ins and/or Fragments
-associated with a Feature. Plug-ins and Fragments are located in directories
-named "plugins" and Features are located in directories named "features".</P>
-<P>Features may also include other Features ("Included Features"). Files named
-"feature.xml" may contain a list of the names and version numbers of Included
-Features.</P>
-<P>The terms and conditions governing Plug-ins and Fragments should be contained
-in files named "about.html" ("Abouts"). The terms and conditions governing
-Features and Included Features should be contained in files named "license.html"
-("Feature Licenses"). Abouts and Feature Licenses may be located in any
-directory of a Download or Module including, but not limited to the following
-locations:</P>
-<UL>
- <LI>The top-level (root) directory
- <LI>Plug-in and Fragment directories
- <LI>Subdirectories of the directory named "src" of certain Plug-ins
- <LI>Feature directories </LI></UL>
-<P>Note: if a Feature made available by the Eclipse Foundation is installed
-using the Eclipse Update Manager, you must agree to a license ("Feature Update
-License") during the installation process. If the Feature contains Included
-Features, the Feature Update License should either provide you with the terms
-and conditions governing the Included Features or inform you where you can
-locate them. Feature Update Licenses may be found in the "license" property of
-files named "feature.properties". Such Abouts, Feature Licenses and Feature
-Update Licenses contain the terms and conditions (or references to such terms
-and conditions) that govern your use of the associated Content in that
-directory.</P>
-<P>THE ABOUTS, FEATURE LICENSES AND FEATURE UPDATE LICENSES MAY REFER TO THE EPL
-OR OTHER LICENSE AGREEMENTS, NOTICES OR TERMS AND CONDITIONS. SOME OF THESE
-OTHER LICENSE AGREEMENTS MAY INCLUDE (BUT ARE NOT LIMITED TO):</P>
-<UL>
- <LI>Common Public License Version 1.0 (available at <A
- href="http://www.eclipse.org/legal/cpl-v10.html">http://www.eclipse.org/legal/cpl-v10.html</A>)
-
- <LI>Apache Software License 1.1 (available at <A
- href="http://www.apache.org/licenses/LICENSE">http://www.apache.org/licenses/LICENSE</A>)
-
- <LI>Apache Software License 2.0 (available at <A
- href="http://www.apache.org/licenses/LICENSE-2.0">http://www.apache.org/licenses/LICENSE-2.0</A>)
-
- <LI>IBM Public License 1.0 (available at <A
- href="http://oss.software.ibm.com/developerworks/opensource/license10.html">http://oss.software.ibm.com/developerworks/opensource/license10.html</A>)
-
- <LI>Metro Link Public License 1.00 (available at <A
- href="http://www.opengroup.org/openmotif/supporters/metrolink/license.html">http://www.opengroup.org/openmotif/supporters/metrolink/license.html</A>)
-
- <LI>Mozilla Public License Version 1.1 (available at <A
- href="http://www.mozilla.org/MPL/MPL-1.1.html">http://www.mozilla.org/MPL/MPL-1.1.html</A>)
- </LI></UL>
-<P>IT IS YOUR OBLIGATION TO READ AND ACCEPT ALL SUCH TERMS AND CONDITIONS PRIOR
-TO USE OF THE CONTENT. If no About, Feature License or Feature Update License is
-provided, please contact the Eclipse Foundation to determine what terms and
-conditions govern that particular Content.</P>
-<H3>Cryptography</H3>
-<P>Content may contain encryption software. The country in which you are
-currently may have restrictions on the import, possession, and use, and/or
-re-export to another country, of encryption software. BEFORE using any
-encryption software, please check the country's laws, regulations and policies
-concerning the import, possession, or use, and re-export of encryption software,
-to see if this is permitted.</P></BODY></HTML>
diff --git a/assembly/features/org.eclipse.jpt.sdk/.cvsignore b/assembly/features/org.eclipse.jpt.sdk/.cvsignore
deleted file mode 100644
index bc2abf75c1..0000000000
--- a/assembly/features/org.eclipse.jpt.sdk/.cvsignore
+++ /dev/null
@@ -1,4 +0,0 @@
-*.bin.dist.zip
-build.xml
-features
-plugins
diff --git a/assembly/features/org.eclipse.jpt.sdk/.project b/assembly/features/org.eclipse.jpt.sdk/.project
deleted file mode 100644
index 821d453136..0000000000
--- a/assembly/features/org.eclipse.jpt.sdk/.project
+++ /dev/null
@@ -1,17 +0,0 @@
-<?xml version="1.0" encoding="UTF-8"?>
-<projectDescription>
- <name>org.eclipse.jpt.sdk</name>
- <comment></comment>
- <projects>
- </projects>
- <buildSpec>
- <buildCommand>
- <name>org.eclipse.pde.FeatureBuilder</name>
- <arguments>
- </arguments>
- </buildCommand>
- </buildSpec>
- <natures>
- <nature>org.eclipse.pde.FeatureNature</nature>
- </natures>
-</projectDescription>
diff --git a/assembly/features/org.eclipse.jpt.sdk/build.properties b/assembly/features/org.eclipse.jpt.sdk/build.properties
deleted file mode 100644
index 7200939aca..0000000000
--- a/assembly/features/org.eclipse.jpt.sdk/build.properties
+++ /dev/null
@@ -1,15 +0,0 @@
-###############################################################################
-# Copyright (c) 2006 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
-#
-# Contributors:
-# Oracle. - initial API and implementation
-###############################################################################
-bin.includes = feature.xml,\
- eclipse_update_120.jpg,\
- epl-v10.html,\
- license.html,\
- feature.properties
diff --git a/assembly/features/org.eclipse.jpt.sdk/eclipse_update_120.jpg b/assembly/features/org.eclipse.jpt.sdk/eclipse_update_120.jpg
deleted file mode 100644
index bfdf708ad6..0000000000
--- a/assembly/features/org.eclipse.jpt.sdk/eclipse_update_120.jpg
+++ /dev/null
Binary files differ
diff --git a/assembly/features/org.eclipse.jpt.sdk/epl-v10.html b/assembly/features/org.eclipse.jpt.sdk/epl-v10.html
deleted file mode 100644
index ed4b196655..0000000000
--- a/assembly/features/org.eclipse.jpt.sdk/epl-v10.html
+++ /dev/null
@@ -1,328 +0,0 @@
-<html xmlns:o="urn:schemas-microsoft-com:office:office"
-xmlns:w="urn:schemas-microsoft-com:office:word"
-xmlns="http://www.w3.org/TR/REC-html40">
-
-<head>
-<meta http-equiv=Content-Type content="text/html; charset=windows-1252">
-<meta name=ProgId content=Word.Document>
-<meta name=Generator content="Microsoft Word 9">
-<meta name=Originator content="Microsoft Word 9">
-<link rel=File-List
-href="./Eclipse%20EPL%202003_11_10%20Final_files/filelist.xml">
-<title>Eclipse Public License - Version 1.0</title>
-<!--[if gte mso 9]><xml>
- <o:DocumentProperties>
- <o:Revision>2</o:Revision>
- <o:TotalTime>3</o:TotalTime>
- <o:Created>2004-03-05T23:03:00Z</o:Created>
- <o:LastSaved>2004-03-05T23:03:00Z</o:LastSaved>
- <o:Pages>4</o:Pages>
- <o:Words>1626</o:Words>
- <o:Characters>9270</o:Characters>
- <o:Lines>77</o:Lines>
- <o:Paragraphs>18</o:Paragraphs>
- <o:CharactersWithSpaces>11384</o:CharactersWithSpaces>
- <o:Version>9.4402</o:Version>
- </o:DocumentProperties>
-</xml><![endif]--><!--[if gte mso 9]><xml>
- <w:WordDocument>
- <w:TrackRevisions/>
- </w:WordDocument>
-</xml><![endif]-->
-<style>
-<!--
- /* Font Definitions */
-@font-face
- {font-family:Tahoma;
- panose-1:2 11 6 4 3 5 4 4 2 4;
- mso-font-charset:0;
- mso-generic-font-family:swiss;
- mso-font-pitch:variable;
- mso-font-signature:553679495 -2147483648 8 0 66047 0;}
- /* Style Definitions */
-p.MsoNormal, li.MsoNormal, div.MsoNormal
- {mso-style-parent:"";
- margin:0in;
- margin-bottom:.0001pt;
- mso-pagination:widow-orphan;
- font-size:12.0pt;
- font-family:"Times New Roman";
- mso-fareast-font-family:"Times New Roman";}
-p
- {margin-right:0in;
- mso-margin-top-alt:auto;
- mso-margin-bottom-alt:auto;
- margin-left:0in;
- mso-pagination:widow-orphan;
- font-size:12.0pt;
- font-family:"Times New Roman";
- mso-fareast-font-family:"Times New Roman";}
-p.BalloonText, li.BalloonText, div.BalloonText
- {mso-style-name:"Balloon Text";
- margin:0in;
- margin-bottom:.0001pt;
- mso-pagination:widow-orphan;
- font-size:8.0pt;
- font-family:Tahoma;
- mso-fareast-font-family:"Times New Roman";}
-@page Section1
- {size:8.5in 11.0in;
- margin:1.0in 1.25in 1.0in 1.25in;
- mso-header-margin:.5in;
- mso-footer-margin:.5in;
- mso-paper-source:0;}
-div.Section1
- {page:Section1;}
--->
-</style>
-</head>
-
-<body lang=EN-US style='tab-interval:.5in'>
-
-<div class=Section1>
-
-<p align=center style='text-align:center'><b>Eclipse Public License - v 1.0</b>
-</p>
-
-<p><span style='font-size:10.0pt'>THE ACCOMPANYING PROGRAM IS PROVIDED UNDER
-THE TERMS OF THIS ECLIPSE PUBLIC LICENSE (&quot;AGREEMENT&quot;). ANY USE,
-REPRODUCTION OR DISTRIBUTION OF THE PROGRAM CONSTITUTES RECIPIENT'S ACCEPTANCE
-OF THIS AGREEMENT.</span> </p>
-
-<p><b><span style='font-size:10.0pt'>1. DEFINITIONS</span></b> </p>
-
-<p><span style='font-size:10.0pt'>&quot;Contribution&quot; means:</span> </p>
-
-<p class=MsoNormal style='margin-left:.5in'><span style='font-size:10.0pt'>a)
-in the case of the initial Contributor, the initial code and documentation
-distributed under this Agreement, and<br clear=left>
-b) in the case of each subsequent Contributor:</span></p>
-
-<p class=MsoNormal style='margin-left:.5in'><span style='font-size:10.0pt'>i)
-changes to the Program, and</span></p>
-
-<p class=MsoNormal style='margin-left:.5in'><span style='font-size:10.0pt'>ii)
-additions to the Program;</span></p>
-
-<p class=MsoNormal style='margin-left:.5in'><span style='font-size:10.0pt'>where
-such changes and/or additions to the Program originate from and are distributed
-by that particular Contributor. A Contribution 'originates' from a Contributor
-if it was added to the Program by such Contributor itself or anyone acting on
-such Contributor's behalf. Contributions do not include additions to the
-Program which: (i) are separate modules of software distributed in conjunction
-with the Program under their own license agreement, and (ii) are not derivative
-works of the Program. </span></p>
-
-<p><span style='font-size:10.0pt'>&quot;Contributor&quot; means any person or
-entity that distributes the Program.</span> </p>
-
-<p><span style='font-size:10.0pt'>&quot;Licensed Patents &quot; mean patent
-claims licensable by a Contributor which are necessarily infringed by the use
-or sale of its Contribution alone or when combined with the Program. </span></p>
-
-<p><span style='font-size:10.0pt'>&quot;Program&quot; means the Contributions
-distributed in accordance with this Agreement.</span> </p>
-
-<p><span style='font-size:10.0pt'>&quot;Recipient&quot; means anyone who
-receives the Program under this Agreement, including all Contributors.</span> </p>
-
-<p><b><span style='font-size:10.0pt'>2. GRANT OF RIGHTS</span></b> </p>
-
-<p class=MsoNormal style='margin-left:.5in'><span style='font-size:10.0pt'>a)
-Subject to the terms of this Agreement, each Contributor hereby grants Recipient
-a non-exclusive, worldwide, royalty-free copyright license to<span
-style='color:red'> </span>reproduce, prepare derivative works of, publicly
-display, publicly perform, distribute and sublicense the Contribution of such
-Contributor, if any, and such derivative works, in source code and object code
-form.</span></p>
-
-<p class=MsoNormal style='margin-left:.5in'><span style='font-size:10.0pt'>b)
-Subject to the terms of this Agreement, each Contributor hereby grants
-Recipient a non-exclusive, worldwide,<span style='color:green'> </span>royalty-free
-patent license under Licensed Patents to make, use, sell, offer to sell, import
-and otherwise transfer the Contribution of such Contributor, if any, in source
-code and object code form. This patent license shall apply to the combination
-of the Contribution and the Program if, at the time the Contribution is added
-by the Contributor, such addition of the Contribution causes such combination
-to be covered by the Licensed Patents. The patent license shall not apply to
-any other combinations which include the Contribution. No hardware per se is
-licensed hereunder. </span></p>
-
-<p class=MsoNormal style='margin-left:.5in'><span style='font-size:10.0pt'>c)
-Recipient understands that although each Contributor grants the licenses to its
-Contributions set forth herein, no assurances are provided by any Contributor
-that the Program does not infringe the patent or other intellectual property
-rights of any other entity. Each Contributor disclaims any liability to Recipient
-for claims brought by any other entity based on infringement of intellectual
-property rights or otherwise. As a condition to exercising the rights and
-licenses granted hereunder, each Recipient hereby assumes sole responsibility
-to secure any other intellectual property rights needed, if any. For example,
-if a third party patent license is required to allow Recipient to distribute
-the Program, it is Recipient's responsibility to acquire that license before
-distributing the Program.</span></p>
-
-<p class=MsoNormal style='margin-left:.5in'><span style='font-size:10.0pt'>d)
-Each Contributor represents that to its knowledge it has sufficient copyright
-rights in its Contribution, if any, to grant the copyright license set forth in
-this Agreement. </span></p>
-
-<p><b><span style='font-size:10.0pt'>3. REQUIREMENTS</span></b> </p>
-
-<p><span style='font-size:10.0pt'>A Contributor may choose to distribute the
-Program in object code form under its own license agreement, provided that:</span>
-</p>
-
-<p class=MsoNormal style='margin-left:.5in'><span style='font-size:10.0pt'>a)
-it complies with the terms and conditions of this Agreement; and</span></p>
-
-<p class=MsoNormal style='margin-left:.5in'><span style='font-size:10.0pt'>b)
-its license agreement:</span></p>
-
-<p class=MsoNormal style='margin-left:.5in'><span style='font-size:10.0pt'>i)
-effectively disclaims on behalf of all Contributors all warranties and
-conditions, express and implied, including warranties or conditions of title
-and non-infringement, and implied warranties or conditions of merchantability
-and fitness for a particular purpose; </span></p>
-
-<p class=MsoNormal style='margin-left:.5in'><span style='font-size:10.0pt'>ii)
-effectively excludes on behalf of all Contributors all liability for damages,
-including direct, indirect, special, incidental and consequential damages, such
-as lost profits; </span></p>
-
-<p class=MsoNormal style='margin-left:.5in'><span style='font-size:10.0pt'>iii)
-states that any provisions which differ from this Agreement are offered by that
-Contributor alone and not by any other party; and</span></p>
-
-<p class=MsoNormal style='margin-left:.5in'><span style='font-size:10.0pt'>iv)
-states that source code for the Program is available from such Contributor, and
-informs licensees how to obtain it in a reasonable manner on or through a
-medium customarily used for software exchange.<span style='color:blue'> </span></span></p>
-
-<p><span style='font-size:10.0pt'>When the Program is made available in source
-code form:</span> </p>
-
-<p class=MsoNormal style='margin-left:.5in'><span style='font-size:10.0pt'>a)
-it must be made available under this Agreement; and </span></p>
-
-<p class=MsoNormal style='margin-left:.5in'><span style='font-size:10.0pt'>b) a
-copy of this Agreement must be included with each copy of the Program. </span></p>
-
-<p><span style='font-size:10.0pt'>Contributors may not remove or alter any
-copyright notices contained within the Program. </span></p>
-
-<p><span style='font-size:10.0pt'>Each Contributor must identify itself as the
-originator of its Contribution, if any, in a manner that reasonably allows
-subsequent Recipients to identify the originator of the Contribution. </span></p>
-
-<p><b><span style='font-size:10.0pt'>4. COMMERCIAL DISTRIBUTION</span></b> </p>
-
-<p><span style='font-size:10.0pt'>Commercial distributors of software may
-accept certain responsibilities with respect to end users, business partners
-and the like. While this license is intended to facilitate the commercial use
-of the Program, the Contributor who includes the Program in a commercial
-product offering should do so in a manner which does not create potential
-liability for other Contributors. Therefore, if a Contributor includes the
-Program in a commercial product offering, such Contributor (&quot;Commercial
-Contributor&quot;) hereby agrees to defend and indemnify every other
-Contributor (&quot;Indemnified Contributor&quot;) against any losses, damages and
-costs (collectively &quot;Losses&quot;) arising from claims, lawsuits and other
-legal actions brought by a third party against the Indemnified Contributor to
-the extent caused by the acts or omissions of such Commercial Contributor in
-connection with its distribution of the Program in a commercial product
-offering. The obligations in this section do not apply to any claims or Losses
-relating to any actual or alleged intellectual property infringement. In order
-to qualify, an Indemnified Contributor must: a) promptly notify the Commercial
-Contributor in writing of such claim, and b) allow the Commercial Contributor
-to control, and cooperate with the Commercial Contributor in, the defense and
-any related settlement negotiations. The Indemnified Contributor may participate
-in any such claim at its own expense.</span> </p>
-
-<p><span style='font-size:10.0pt'>For example, a Contributor might include the
-Program in a commercial product offering, Product X. That Contributor is then a
-Commercial Contributor. If that Commercial Contributor then makes performance
-claims, or offers warranties related to Product X, those performance claims and
-warranties are such Commercial Contributor's responsibility alone. Under this
-section, the Commercial Contributor would have to defend claims against the
-other Contributors related to those performance claims and warranties, and if a
-court requires any other Contributor to pay any damages as a result, the
-Commercial Contributor must pay those damages.</span> </p>
-
-<p><b><span style='font-size:10.0pt'>5. NO WARRANTY</span></b> </p>
-
-<p><span style='font-size:10.0pt'>EXCEPT AS EXPRESSLY SET FORTH IN THIS
-AGREEMENT, THE PROGRAM IS PROVIDED ON AN &quot;AS IS&quot; BASIS, WITHOUT
-WARRANTIES OR CONDITIONS OF ANY KIND, EITHER EXPRESS OR IMPLIED INCLUDING,
-WITHOUT LIMITATION, ANY WARRANTIES OR CONDITIONS OF TITLE, NON-INFRINGEMENT,
-MERCHANTABILITY OR FITNESS FOR A PARTICULAR PURPOSE. Each Recipient is solely
-responsible for determining the appropriateness of using and distributing the
-Program and assumes all risks associated with its exercise of rights under this
-Agreement , including but not limited to the risks and costs of program errors,
-compliance with applicable laws, damage to or loss of data, programs or
-equipment, and unavailability or interruption of operations. </span></p>
-
-<p><b><span style='font-size:10.0pt'>6. DISCLAIMER OF LIABILITY</span></b> </p>
-
-<p><span style='font-size:10.0pt'>EXCEPT AS EXPRESSLY SET FORTH IN THIS
-AGREEMENT, NEITHER RECIPIENT NOR ANY CONTRIBUTORS SHALL HAVE ANY LIABILITY FOR
-ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES
-(INCLUDING WITHOUT LIMITATION LOST PROFITS), HOWEVER CAUSED AND ON ANY THEORY
-OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING
-NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OR DISTRIBUTION OF
-THE PROGRAM OR THE EXERCISE OF ANY RIGHTS GRANTED HEREUNDER, EVEN IF ADVISED OF
-THE POSSIBILITY OF SUCH DAMAGES.</span> </p>
-
-<p><b><span style='font-size:10.0pt'>7. GENERAL</span></b> </p>
-
-<p><span style='font-size:10.0pt'>If any provision of this Agreement is invalid
-or unenforceable under applicable law, it shall not affect the validity or
-enforceability of the remainder of the terms of this Agreement, and without
-further action by the parties hereto, such provision shall be reformed to the
-minimum extent necessary to make such provision valid and enforceable.</span> </p>
-
-<p><span style='font-size:10.0pt'>If Recipient institutes patent litigation
-against any entity (including a cross-claim or counterclaim in a lawsuit)
-alleging that the Program itself (excluding combinations of the Program with
-other software or hardware) infringes such Recipient's patent(s), then such
-Recipient's rights granted under Section 2(b) shall terminate as of the date
-such litigation is filed. </span></p>
-
-<p><span style='font-size:10.0pt'>All Recipient's rights under this Agreement
-shall terminate if it fails to comply with any of the material terms or
-conditions of this Agreement and does not cure such failure in a reasonable
-period of time after becoming aware of such noncompliance. If all Recipient's
-rights under this Agreement terminate, Recipient agrees to cease use and
-distribution of the Program as soon as reasonably practicable. However,
-Recipient's obligations under this Agreement and any licenses granted by
-Recipient relating to the Program shall continue and survive. </span></p>
-
-<p><span style='font-size:10.0pt'>Everyone is permitted to copy and distribute
-copies of this Agreement, but in order to avoid inconsistency the Agreement is
-copyrighted and may only be modified in the following manner. The Agreement
-Steward reserves the right to publish new versions (including revisions) of
-this Agreement from time to time. No one other than the Agreement Steward has
-the right to modify this Agreement. The Eclipse Foundation is the initial
-Agreement Steward. The Eclipse Foundation may assign the responsibility to
-serve as the Agreement Steward to a suitable separate entity. Each new version
-of the Agreement will be given a distinguishing version number. The Program
-(including Contributions) may always be distributed subject to the version of
-the Agreement under which it was received. In addition, after a new version of
-the Agreement is published, Contributor may elect to distribute the Program
-(including its Contributions) under the new version. Except as expressly stated
-in Sections 2(a) and 2(b) above, Recipient receives no rights or licenses to
-the intellectual property of any Contributor under this Agreement, whether
-expressly, by implication, estoppel or otherwise. All rights in the Program not
-expressly granted under this Agreement are reserved.</span> </p>
-
-<p><span style='font-size:10.0pt'>This Agreement is governed by the laws of the
-State of New York and the intellectual property laws of the United States of
-America. No party to this Agreement will bring a legal action under this
-Agreement more than one year after the cause of action arose. Each party waives
-its rights to a jury trial in any resulting litigation.</span> </p>
-
-<p class=MsoNormal><![if !supportEmptyParas]>&nbsp;<![endif]><o:p></o:p></p>
-
-</div>
-
-</body>
-
-</html> \ No newline at end of file
diff --git a/assembly/features/org.eclipse.jpt.sdk/feature.properties b/assembly/features/org.eclipse.jpt.sdk/feature.properties
deleted file mode 100644
index f9e4474871..0000000000
--- a/assembly/features/org.eclipse.jpt.sdk/feature.properties
+++ /dev/null
@@ -1,145 +0,0 @@
-###############################################################################
-# Copyright (c) 2006 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
-#
-# Contributors:
-# Oracle. - initial API and implementation
-###############################################################################
-# feature.properties
-# contains externalized strings for feature.xml
-# "%foo" in feature.xml corresponds to the key "foo" in this file
-# java.io.Properties file (ISO 8859-1 with "\" escapes)
-# This file should be translated.
-
-# "featureName" property - name of the feature
-featureName=Dali Java Persistence Tools project SDK
-
-# "providerName" property - name of the company that provides the feature
-providerName=Eclipse.org
-
-# "updateSiteName" property - label for the update site
-updateSiteName=The Eclipse Web Tools Platform (WTP) Project update site
-
-# "description" property - description of the feature
-description=Dali Java Persistence Tools project SDK
-
-# "copyright" property - text of the "Feature Update Copyright"
-copyright=\
-Copyright (c) 2006 Oracle Corporation.\n\
-All rights reserved. This program and the accompanying materials\n\
-are made available under the terms of the Eclipse Public License v1.0\n\
-which accompanies this distribution, and is available at\n\
-http://www.eclipse.org/legal/epl-v10.html\n\
-\n\
-Contributors:\n\
- Oracle - initial API and implementation\n
-################ end of copyright property ####################################
-
-# "licenseURL" property - URL of the "Feature License"
-# do not translate value - just change to point to a locale-specific HTML page
-licenseURL=license.html
-
-# "license" property - text of the "Feature Update License"
-# should be plain text version of license agreement pointed to be "licenseURL"
-license=\
-ECLIPSE FOUNDATION SOFTWARE USER AGREEMENT\n\
-June 06, 2007\n\
-\n\
-Usage Of Content\n\
-\n\
-THE ECLIPSE FOUNDATION MAKES AVAILABLE SOFTWARE, DOCUMENTATION, INFORMATION AND/OR\n\
-OTHER MATERIALS FOR OPEN SOURCE PROJECTS (COLLECTIVELY "CONTENT").\n\
-USE OF THE CONTENT IS GOVERNED BY THE TERMS AND CONDITIONS OF THIS\n\
-AGREEMENT AND/OR THE TERMS AND CONDITIONS OF LICENSE AGREEMENTS OR\n\
-NOTICES INDICATED OR REFERENCED BELOW. BY USING THE CONTENT, YOU\n\
-AGREE THAT YOUR USE OF THE CONTENT IS GOVERNED BY THIS AGREEMENT\n\
-AND/OR THE TERMS AND CONDITIONS OF ANY APPLICABLE LICENSE AGREEMENTS\n\
-OR NOTICES INDICATED OR REFERENCED BELOW. IF YOU DO NOT AGREE TO THE\n\
-TERMS AND CONDITIONS OF THIS AGREEMENT AND THE TERMS AND CONDITIONS\n\
-OF ANY APPLICABLE LICENSE AGREEMENTS OR NOTICES INDICATED OR REFERENCED\n\
-BELOW, THEN YOU MAY NOT USE THE CONTENT.\n\
-\n\
-Applicable Licenses\n\
-\n\
-Unless otherwise indicated, all Content made available by the Eclipse Foundation\n\
-is provided to you under the terms and conditions of the Eclipse Public\n\
-License Version 1.0 ("EPL"). A copy of the EPL is provided with this\n\
-Content and is also available at http://www.eclipse.org/legal/epl-v10.html.\n\
-For purposes of the EPL, "Program" will mean the Content.\n\
-\n\
-Content includes, but is not limited to, source code, object code,\n\
-documentation and other files maintained in the Eclipse.org CVS\n\
-repository ("Repository") in CVS modules ("Modules") and made available\n\
-as downloadable archives ("Downloads").\n\
-\n\
- - Content may be structured and packaged into modules to facilitate delivering,\n\
- extending, and upgrading the Content. Typical modules may include plug-ins ("Plug-ins"),\n\
- plug-in fragments ("Fragments"), and features ("Features").\n\
- - Each Plug-in or Fragment may be packaged as a sub-directory or JAR (Java? ARchive)\n\
- in a directory named "plugins".\n\
- - A Feature is a bundle of one or more Plug-ins and/or Fragments and associated material.\n\
- Each Feature may be packaged as a sub-directory in a directory named "features".\n\
- Within a Feature, files named "feature.xml" may contain a list of the names and version\n\
- numbers of the Plug-ins and/or Fragments associated with that Feature.\n\
- - Features may also include other Features ("Included Features"). Within a Feature, files\n\
- named "feature.xml" may contain a list of the names and version numbers of Included Features.\n\
-\n\
-Features may also include other Features ("Included Features"). Files named\n\
-"feature.xml" may contain a list of the names and version numbers of\n\
-Included Features.\n\
-\n\
-The terms and conditions governing Plug-ins and Fragments should be\n\
-contained in files named "about.html" ("Abouts"). The terms and\n\
-conditions governing Features and Included Features should be contained\n\
-in files named "license.html" ("Feature Licenses"). Abouts and Feature\n\
-Licenses may be located in any directory of a Download or Module\n\
-including, but not limited to the following locations:\n\
-\n\
- - The top-level (root) directory\n\
- - Plug-in and Fragment directories\n\
- - Inside Plug-ins and Fragments packaged as JARs\n\
- - Sub-directories of the directory named "src" of certain Plug-ins\n\
- - Feature directories\n\
-\n\
-Note: if a Feature made available by the Eclipse Foundation is installed using the\n\
-Eclipse Update Manager, you must agree to a license ("Feature Update\n\
-License") during the installation process. If the Feature contains\n\
-Included Features, the Feature Update License should either provide you\n\
-with the terms and conditions governing the Included Features or inform\n\
-you where you can locate them. Feature Update Licenses may be found in\n\
-the "license" property of files named "feature.properties". Such Abouts,\n\
-Feature Licenses and Feature Update Licenses contain the terms and\n\
-conditions (or references to such terms and conditions) that govern your\n\
-use of the associated Content in that directory.\n\
-\n\
-THE ABOUTS, FEATURE LICENSES AND FEATURE UPDATE LICENSES MAY REFER\n\
-TO THE EPL OR OTHER LICENSE AGREEMENTS, NOTICES OR TERMS AND CONDITIONS.\n\
-SOME OF THESE OTHER LICENSE AGREEMENTS MAY INCLUDE (BUT ARE NOT LIMITED TO):\n\
-\n\
- - Common Public License Version 1.0 (available at http://www.eclipse.org/legal/cpl-v10.html)\n\
- - Apache Software License 1.1 (available at http://www.apache.org/licenses/LICENSE)\n\
- - Apache Software License 2.0 (available at http://www.apache.org/licenses/LICENSE-2.0)\n\
- - IBM Public License 1.0 (available at http://oss.software.ibm.com/developerworks/opensource/license10.html)\n\
- - Metro Link Public License 1.00 (available at http://www.opengroup.org/openmotif/supporters/metrolink/license.html)\n\
- - Mozilla Public License Version 1.1 (available at http://www.mozilla.org/MPL/MPL-1.1.html)\n\
- - Common Development and Distribution License (CDDL) Version 1.0 (available at http://www.sun.com/cddl/cddl.html)\n\
-\n\
-IT IS YOUR OBLIGATION TO READ AND ACCEPT ALL SUCH TERMS AND CONDITIONS PRIOR\n\
-TO USE OF THE CONTENT. If no About, Feature License or Feature Update License\n\
-is provided, please contact the Eclipse Foundation to determine what terms and conditions\n\
-govern that particular Content.\n\
-\n\
-Cryptography\n\
-\n\
-Content may contain encryption software. The country in which you are\n\
-currently may have restrictions on the import, possession, and use,\n\
-and/or re-export to another country, of encryption software. BEFORE\n\
-using any encryption software, please check the country's laws,\n\
-regulations and policies concerning the import, possession, or use,\n\
-and re-export of encryption software, to see if this is permitted.\n\
-\n\
-Java and all Java-based trademarks are trademarks of Sun Microsystems, Inc. in the United States, other countries, or both.\n
-########### end of license property ##########################################
diff --git a/assembly/features/org.eclipse.jpt.sdk/feature.xml b/assembly/features/org.eclipse.jpt.sdk/feature.xml
deleted file mode 100644
index c7f1fe5f0c..0000000000
--- a/assembly/features/org.eclipse.jpt.sdk/feature.xml
+++ /dev/null
@@ -1,42 +0,0 @@
-<?xml version="1.0" encoding="UTF-8"?>
-<feature
- id="org.eclipse.jpt.sdk"
- label="%featureName"
- version="2.1.0.qualifier"
- provider-name="%providerName"
- plugin="org.eclipse.jpt"
- image="eclipse_update_120.jpg">
-
- <description>
- %description
- </description>
-
- <copyright>
- %copyright
- </copyright>
-
- <license url="license.html">
- %license
- </license>
-
- <url>
- <update label="%updateSiteName" url="http://download.eclipse.org/webtools/updates"/>
- <discovery label="Web Tools Platform (WTP) Updates" url="http://download.eclipse.org/webtools/updates"/>
- </url>
-
- <includes
- id="org.eclipse.jpt_sdk.feature"
- version="0.0.0"/>
-
- <includes
- id="org.eclipse.jpt.eclipselink_sdk.feature"
- version="0.0.0"/>
-
- <plugin
- id="org.eclipse.jpt"
- download-size="0"
- install-size="0"
- version="0.0.0"
- unpack="false"/>
-
-</feature>
diff --git a/assembly/features/org.eclipse.jpt.sdk/license.html b/assembly/features/org.eclipse.jpt.sdk/license.html
deleted file mode 100644
index 76abfb4621..0000000000
--- a/assembly/features/org.eclipse.jpt.sdk/license.html
+++ /dev/null
@@ -1,98 +0,0 @@
-<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN" "http://www.w3c.org/TR/1999/REC-html401-19991224/loose.dtd">
-<!-- saved from url=(0044)http://www.eclipse.org/legal/epl/notice.html -->
-<HTML><HEAD><TITLE>Eclipse.org Software User Agreement</TITLE>
-<META http-equiv=Content-Type content="text/html; charset=iso-8859-1">
-<META content="MSHTML 6.00.2800.1479" name=GENERATOR></HEAD>
-<BODY lang=EN-US vLink=purple link=blue>
-<H2>Eclipse Foundation Software User Agreement</H2>
-<P>June 06, 2007</P>
-<H3>Usage Of Content</H3>
-<P>THE ECLIPSE FOUNDATION MAKES AVAILABLE SOFTWARE, DOCUMENTATION, INFORMATION
-AND/OR OTHER MATERIALS FOR OPEN SOURCE PROJECTS (COLLECTIVELY "CONTENT"). USE OF
-THE CONTENT IS GOVERNED BY THE TERMS AND CONDITIONS OF THIS AGREEMENT AND/OR THE
-TERMS AND CONDITIONS OF LICENSE AGREEMENTS OR NOTICES INDICATED OR REFERENCED
-BELOW. BY USING THE CONTENT, YOU AGREE THAT YOUR USE OF THE CONTENT IS GOVERNED
-BY THIS AGREEMENT AND/OR THE TERMS AND CONDITIONS OF ANY APPLICABLE LICENSE
-AGREEMENTS OR NOTICES INDICATED OR REFERENCED BELOW. IF YOU DO NOT AGREE TO THE
-TERMS AND CONDITIONS OF THIS AGREEMENT AND THE TERMS AND CONDITIONS OF ANY
-APPLICABLE LICENSE AGREEMENTS OR NOTICES INDICATED OR REFERENCED BELOW, THEN YOU
-MAY NOT USE THE CONTENT.</P>
-<H3>Applicable Licenses</H3>
-<P>Unless otherwise indicated, all Content made available by the Eclipse
-Foundation is provided to you under the terms and conditions of the Eclipse
-Public License Version 1.0 ("EPL"). A copy of the EPL is provided with this
-Content and is also available at <A
-href="http://www.eclipse.org/legal/epl-v10.html">http://www.eclipse.org/legal/epl-v10.html</A>.
-For purposes of the EPL, "Program" will mean the Content.</P>
-<P>Content includes, but is not limited to, source code, object code,
-documentation and other files maintained in the Eclipse.org CVS repository
-("Repository") in CVS modules ("Modules") and made available as downloadable
-archives ("Downloads").</P>
-<P>Content may be apportioned into plug-ins ("Plug-ins"), plug-in fragments
-("Fragments"), and features ("Features"). A Feature is a bundle of one or more
-Plug-ins and/or Fragments and associated material. Files named "feature.xml" may
-contain a list of the names and version numbers of the Plug-ins and/or Fragments
-associated with a Feature. Plug-ins and Fragments are located in directories
-named "plugins" and Features are located in directories named "features".</P>
-<P>Features may also include other Features ("Included Features"). Files named
-"feature.xml" may contain a list of the names and version numbers of Included
-Features.</P>
-<P>The terms and conditions governing Plug-ins and Fragments should be contained
-in files named "about.html" ("Abouts"). The terms and conditions governing
-Features and Included Features should be contained in files named "license.html"
-("Feature Licenses"). Abouts and Feature Licenses may be located in any
-directory of a Download or Module including, but not limited to the following
-locations:</P>
-<UL>
- <LI>The top-level (root) directory
- <LI>Plug-in and Fragment directories
- <LI>Subdirectories of the directory named "src" of certain Plug-ins
- <LI>Feature directories </LI></UL>
-<P>Note: if a Feature made available by the Eclipse Foundation is installed
-using the Eclipse Update Manager, you must agree to a license ("Feature Update
-License") during the installation process. If the Feature contains Included
-Features, the Feature Update License should either provide you with the terms
-and conditions governing the Included Features or inform you where you can
-locate them. Feature Update Licenses may be found in the "license" property of
-files named "feature.properties". Such Abouts, Feature Licenses and Feature
-Update Licenses contain the terms and conditions (or references to such terms
-and conditions) that govern your use of the associated Content in that
-directory.</P>
-<P>THE ABOUTS, FEATURE LICENSES AND FEATURE UPDATE LICENSES MAY REFER TO THE EPL
-OR OTHER LICENSE AGREEMENTS, NOTICES OR TERMS AND CONDITIONS. SOME OF THESE
-OTHER LICENSE AGREEMENTS MAY INCLUDE (BUT ARE NOT LIMITED TO):</P>
-<UL>
- <LI>Common Public License Version 1.0 (available at <A
- href="http://www.eclipse.org/legal/cpl-v10.html">http://www.eclipse.org/legal/cpl-v10.html</A>)
-
- <LI>Apache Software License 1.1 (available at <A
- href="http://www.apache.org/licenses/LICENSE">http://www.apache.org/licenses/LICENSE</A>)
-
- <LI>Apache Software License 2.0 (available at <A
- href="http://www.apache.org/licenses/LICENSE-2.0">http://www.apache.org/licenses/LICENSE-2.0</A>)
-
- <LI>IBM Public License 1.0 (available at <A
- href="http://oss.software.ibm.com/developerworks/opensource/license10.html">http://oss.software.ibm.com/developerworks/opensource/license10.html</A>)
-
- <LI>Metro Link Public License 1.00 (available at <A
- href="http://www.opengroup.org/openmotif/supporters/metrolink/license.html">http://www.opengroup.org/openmotif/supporters/metrolink/license.html</A>)
-
- <LI>Mozilla Public License Version 1.1 (available at <A
- href="http://www.mozilla.org/MPL/MPL-1.1.html">http://www.mozilla.org/MPL/MPL-1.1.html</A>)
- </LI>
-
- <LI>Common Development and Distribution License (CDDL) Version 1.0 (available at <A
- href="http://www.sun.com/cddl/cddl.html">http://www.sun.com/cddl/cddl.html)</A>
- </LI>
-</UL>
-<P>IT IS YOUR OBLIGATION TO READ AND ACCEPT ALL SUCH TERMS AND CONDITIONS PRIOR
-TO USE OF THE CONTENT. If no About, Feature License or Feature Update License is
-provided, please contact the Eclipse Foundation to determine what terms and
-conditions govern that particular Content.</P>
-<H3>Cryptography</H3>
-<P>Content may contain encryption software. The country in which you are
-currently may have restrictions on the import, possession, and use, and/or
-re-export to another country, of encryption software. BEFORE using any
-encryption software, please check the country's laws, regulations and policies
-concerning the import, possession, or use, and re-export of encryption software,
-to see if this is permitted.</P></BODY></HTML>
diff --git a/assembly/features/org.eclipse.jpt.tests.assembly.feature/.cvsignore b/assembly/features/org.eclipse.jpt.tests.assembly.feature/.cvsignore
deleted file mode 100644
index 2544693f86..0000000000
--- a/assembly/features/org.eclipse.jpt.tests.assembly.feature/.cvsignore
+++ /dev/null
@@ -1,3 +0,0 @@
-*.bin.dist.zip
-build.xml
-org.eclipse.jpt.tests_1.0.0.* \ No newline at end of file
diff --git a/assembly/features/org.eclipse.jpt.tests.assembly.feature/.project b/assembly/features/org.eclipse.jpt.tests.assembly.feature/.project
deleted file mode 100644
index f34899cb8b..0000000000
--- a/assembly/features/org.eclipse.jpt.tests.assembly.feature/.project
+++ /dev/null
@@ -1,17 +0,0 @@
-<?xml version="1.0" encoding="UTF-8"?>
-<projectDescription>
- <name>org.eclipse.jpt.tests.assembly.feature</name>
- <comment></comment>
- <projects>
- </projects>
- <buildSpec>
- <buildCommand>
- <name>org.eclipse.pde.FeatureBuilder</name>
- <arguments>
- </arguments>
- </buildCommand>
- </buildSpec>
- <natures>
- <nature>org.eclipse.pde.FeatureNature</nature>
- </natures>
-</projectDescription>
diff --git a/assembly/features/org.eclipse.jpt.tests.assembly.feature/.settings/org.eclipse.core.resources.prefs b/assembly/features/org.eclipse.jpt.tests.assembly.feature/.settings/org.eclipse.core.resources.prefs
deleted file mode 100644
index 17acb651a8..0000000000
--- a/assembly/features/org.eclipse.jpt.tests.assembly.feature/.settings/org.eclipse.core.resources.prefs
+++ /dev/null
@@ -1,3 +0,0 @@
-#Sun May 27 15:11:05 EDT 2007
-eclipse.preferences.version=1
-encoding/<project>=ISO-8859-1
diff --git a/assembly/features/org.eclipse.jpt.tests.assembly.feature/build.properties b/assembly/features/org.eclipse.jpt.tests.assembly.feature/build.properties
deleted file mode 100644
index 7f47694aab..0000000000
--- a/assembly/features/org.eclipse.jpt.tests.assembly.feature/build.properties
+++ /dev/null
@@ -1,5 +0,0 @@
-bin.includes = feature.xml,\
- eclipse_update_120.jpg,\
- epl-v10.html,\
- license.html,\
- feature.properties
diff --git a/assembly/features/org.eclipse.jpt.tests.assembly.feature/eclipse_update_120.jpg b/assembly/features/org.eclipse.jpt.tests.assembly.feature/eclipse_update_120.jpg
deleted file mode 100644
index bfdf708ad6..0000000000
--- a/assembly/features/org.eclipse.jpt.tests.assembly.feature/eclipse_update_120.jpg
+++ /dev/null
Binary files differ
diff --git a/assembly/features/org.eclipse.jpt.tests.assembly.feature/epl-v10.html b/assembly/features/org.eclipse.jpt.tests.assembly.feature/epl-v10.html
deleted file mode 100644
index ed4b196655..0000000000
--- a/assembly/features/org.eclipse.jpt.tests.assembly.feature/epl-v10.html
+++ /dev/null
@@ -1,328 +0,0 @@
-<html xmlns:o="urn:schemas-microsoft-com:office:office"
-xmlns:w="urn:schemas-microsoft-com:office:word"
-xmlns="http://www.w3.org/TR/REC-html40">
-
-<head>
-<meta http-equiv=Content-Type content="text/html; charset=windows-1252">
-<meta name=ProgId content=Word.Document>
-<meta name=Generator content="Microsoft Word 9">
-<meta name=Originator content="Microsoft Word 9">
-<link rel=File-List
-href="./Eclipse%20EPL%202003_11_10%20Final_files/filelist.xml">
-<title>Eclipse Public License - Version 1.0</title>
-<!--[if gte mso 9]><xml>
- <o:DocumentProperties>
- <o:Revision>2</o:Revision>
- <o:TotalTime>3</o:TotalTime>
- <o:Created>2004-03-05T23:03:00Z</o:Created>
- <o:LastSaved>2004-03-05T23:03:00Z</o:LastSaved>
- <o:Pages>4</o:Pages>
- <o:Words>1626</o:Words>
- <o:Characters>9270</o:Characters>
- <o:Lines>77</o:Lines>
- <o:Paragraphs>18</o:Paragraphs>
- <o:CharactersWithSpaces>11384</o:CharactersWithSpaces>
- <o:Version>9.4402</o:Version>
- </o:DocumentProperties>
-</xml><![endif]--><!--[if gte mso 9]><xml>
- <w:WordDocument>
- <w:TrackRevisions/>
- </w:WordDocument>
-</xml><![endif]-->
-<style>
-<!--
- /* Font Definitions */
-@font-face
- {font-family:Tahoma;
- panose-1:2 11 6 4 3 5 4 4 2 4;
- mso-font-charset:0;
- mso-generic-font-family:swiss;
- mso-font-pitch:variable;
- mso-font-signature:553679495 -2147483648 8 0 66047 0;}
- /* Style Definitions */
-p.MsoNormal, li.MsoNormal, div.MsoNormal
- {mso-style-parent:"";
- margin:0in;
- margin-bottom:.0001pt;
- mso-pagination:widow-orphan;
- font-size:12.0pt;
- font-family:"Times New Roman";
- mso-fareast-font-family:"Times New Roman";}
-p
- {margin-right:0in;
- mso-margin-top-alt:auto;
- mso-margin-bottom-alt:auto;
- margin-left:0in;
- mso-pagination:widow-orphan;
- font-size:12.0pt;
- font-family:"Times New Roman";
- mso-fareast-font-family:"Times New Roman";}
-p.BalloonText, li.BalloonText, div.BalloonText
- {mso-style-name:"Balloon Text";
- margin:0in;
- margin-bottom:.0001pt;
- mso-pagination:widow-orphan;
- font-size:8.0pt;
- font-family:Tahoma;
- mso-fareast-font-family:"Times New Roman";}
-@page Section1
- {size:8.5in 11.0in;
- margin:1.0in 1.25in 1.0in 1.25in;
- mso-header-margin:.5in;
- mso-footer-margin:.5in;
- mso-paper-source:0;}
-div.Section1
- {page:Section1;}
--->
-</style>
-</head>
-
-<body lang=EN-US style='tab-interval:.5in'>
-
-<div class=Section1>
-
-<p align=center style='text-align:center'><b>Eclipse Public License - v 1.0</b>
-</p>
-
-<p><span style='font-size:10.0pt'>THE ACCOMPANYING PROGRAM IS PROVIDED UNDER
-THE TERMS OF THIS ECLIPSE PUBLIC LICENSE (&quot;AGREEMENT&quot;). ANY USE,
-REPRODUCTION OR DISTRIBUTION OF THE PROGRAM CONSTITUTES RECIPIENT'S ACCEPTANCE
-OF THIS AGREEMENT.</span> </p>
-
-<p><b><span style='font-size:10.0pt'>1. DEFINITIONS</span></b> </p>
-
-<p><span style='font-size:10.0pt'>&quot;Contribution&quot; means:</span> </p>
-
-<p class=MsoNormal style='margin-left:.5in'><span style='font-size:10.0pt'>a)
-in the case of the initial Contributor, the initial code and documentation
-distributed under this Agreement, and<br clear=left>
-b) in the case of each subsequent Contributor:</span></p>
-
-<p class=MsoNormal style='margin-left:.5in'><span style='font-size:10.0pt'>i)
-changes to the Program, and</span></p>
-
-<p class=MsoNormal style='margin-left:.5in'><span style='font-size:10.0pt'>ii)
-additions to the Program;</span></p>
-
-<p class=MsoNormal style='margin-left:.5in'><span style='font-size:10.0pt'>where
-such changes and/or additions to the Program originate from and are distributed
-by that particular Contributor. A Contribution 'originates' from a Contributor
-if it was added to the Program by such Contributor itself or anyone acting on
-such Contributor's behalf. Contributions do not include additions to the
-Program which: (i) are separate modules of software distributed in conjunction
-with the Program under their own license agreement, and (ii) are not derivative
-works of the Program. </span></p>
-
-<p><span style='font-size:10.0pt'>&quot;Contributor&quot; means any person or
-entity that distributes the Program.</span> </p>
-
-<p><span style='font-size:10.0pt'>&quot;Licensed Patents &quot; mean patent
-claims licensable by a Contributor which are necessarily infringed by the use
-or sale of its Contribution alone or when combined with the Program. </span></p>
-
-<p><span style='font-size:10.0pt'>&quot;Program&quot; means the Contributions
-distributed in accordance with this Agreement.</span> </p>
-
-<p><span style='font-size:10.0pt'>&quot;Recipient&quot; means anyone who
-receives the Program under this Agreement, including all Contributors.</span> </p>
-
-<p><b><span style='font-size:10.0pt'>2. GRANT OF RIGHTS</span></b> </p>
-
-<p class=MsoNormal style='margin-left:.5in'><span style='font-size:10.0pt'>a)
-Subject to the terms of this Agreement, each Contributor hereby grants Recipient
-a non-exclusive, worldwide, royalty-free copyright license to<span
-style='color:red'> </span>reproduce, prepare derivative works of, publicly
-display, publicly perform, distribute and sublicense the Contribution of such
-Contributor, if any, and such derivative works, in source code and object code
-form.</span></p>
-
-<p class=MsoNormal style='margin-left:.5in'><span style='font-size:10.0pt'>b)
-Subject to the terms of this Agreement, each Contributor hereby grants
-Recipient a non-exclusive, worldwide,<span style='color:green'> </span>royalty-free
-patent license under Licensed Patents to make, use, sell, offer to sell, import
-and otherwise transfer the Contribution of such Contributor, if any, in source
-code and object code form. This patent license shall apply to the combination
-of the Contribution and the Program if, at the time the Contribution is added
-by the Contributor, such addition of the Contribution causes such combination
-to be covered by the Licensed Patents. The patent license shall not apply to
-any other combinations which include the Contribution. No hardware per se is
-licensed hereunder. </span></p>
-
-<p class=MsoNormal style='margin-left:.5in'><span style='font-size:10.0pt'>c)
-Recipient understands that although each Contributor grants the licenses to its
-Contributions set forth herein, no assurances are provided by any Contributor
-that the Program does not infringe the patent or other intellectual property
-rights of any other entity. Each Contributor disclaims any liability to Recipient
-for claims brought by any other entity based on infringement of intellectual
-property rights or otherwise. As a condition to exercising the rights and
-licenses granted hereunder, each Recipient hereby assumes sole responsibility
-to secure any other intellectual property rights needed, if any. For example,
-if a third party patent license is required to allow Recipient to distribute
-the Program, it is Recipient's responsibility to acquire that license before
-distributing the Program.</span></p>
-
-<p class=MsoNormal style='margin-left:.5in'><span style='font-size:10.0pt'>d)
-Each Contributor represents that to its knowledge it has sufficient copyright
-rights in its Contribution, if any, to grant the copyright license set forth in
-this Agreement. </span></p>
-
-<p><b><span style='font-size:10.0pt'>3. REQUIREMENTS</span></b> </p>
-
-<p><span style='font-size:10.0pt'>A Contributor may choose to distribute the
-Program in object code form under its own license agreement, provided that:</span>
-</p>
-
-<p class=MsoNormal style='margin-left:.5in'><span style='font-size:10.0pt'>a)
-it complies with the terms and conditions of this Agreement; and</span></p>
-
-<p class=MsoNormal style='margin-left:.5in'><span style='font-size:10.0pt'>b)
-its license agreement:</span></p>
-
-<p class=MsoNormal style='margin-left:.5in'><span style='font-size:10.0pt'>i)
-effectively disclaims on behalf of all Contributors all warranties and
-conditions, express and implied, including warranties or conditions of title
-and non-infringement, and implied warranties or conditions of merchantability
-and fitness for a particular purpose; </span></p>
-
-<p class=MsoNormal style='margin-left:.5in'><span style='font-size:10.0pt'>ii)
-effectively excludes on behalf of all Contributors all liability for damages,
-including direct, indirect, special, incidental and consequential damages, such
-as lost profits; </span></p>
-
-<p class=MsoNormal style='margin-left:.5in'><span style='font-size:10.0pt'>iii)
-states that any provisions which differ from this Agreement are offered by that
-Contributor alone and not by any other party; and</span></p>
-
-<p class=MsoNormal style='margin-left:.5in'><span style='font-size:10.0pt'>iv)
-states that source code for the Program is available from such Contributor, and
-informs licensees how to obtain it in a reasonable manner on or through a
-medium customarily used for software exchange.<span style='color:blue'> </span></span></p>
-
-<p><span style='font-size:10.0pt'>When the Program is made available in source
-code form:</span> </p>
-
-<p class=MsoNormal style='margin-left:.5in'><span style='font-size:10.0pt'>a)
-it must be made available under this Agreement; and </span></p>
-
-<p class=MsoNormal style='margin-left:.5in'><span style='font-size:10.0pt'>b) a
-copy of this Agreement must be included with each copy of the Program. </span></p>
-
-<p><span style='font-size:10.0pt'>Contributors may not remove or alter any
-copyright notices contained within the Program. </span></p>
-
-<p><span style='font-size:10.0pt'>Each Contributor must identify itself as the
-originator of its Contribution, if any, in a manner that reasonably allows
-subsequent Recipients to identify the originator of the Contribution. </span></p>
-
-<p><b><span style='font-size:10.0pt'>4. COMMERCIAL DISTRIBUTION</span></b> </p>
-
-<p><span style='font-size:10.0pt'>Commercial distributors of software may
-accept certain responsibilities with respect to end users, business partners
-and the like. While this license is intended to facilitate the commercial use
-of the Program, the Contributor who includes the Program in a commercial
-product offering should do so in a manner which does not create potential
-liability for other Contributors. Therefore, if a Contributor includes the
-Program in a commercial product offering, such Contributor (&quot;Commercial
-Contributor&quot;) hereby agrees to defend and indemnify every other
-Contributor (&quot;Indemnified Contributor&quot;) against any losses, damages and
-costs (collectively &quot;Losses&quot;) arising from claims, lawsuits and other
-legal actions brought by a third party against the Indemnified Contributor to
-the extent caused by the acts or omissions of such Commercial Contributor in
-connection with its distribution of the Program in a commercial product
-offering. The obligations in this section do not apply to any claims or Losses
-relating to any actual or alleged intellectual property infringement. In order
-to qualify, an Indemnified Contributor must: a) promptly notify the Commercial
-Contributor in writing of such claim, and b) allow the Commercial Contributor
-to control, and cooperate with the Commercial Contributor in, the defense and
-any related settlement negotiations. The Indemnified Contributor may participate
-in any such claim at its own expense.</span> </p>
-
-<p><span style='font-size:10.0pt'>For example, a Contributor might include the
-Program in a commercial product offering, Product X. That Contributor is then a
-Commercial Contributor. If that Commercial Contributor then makes performance
-claims, or offers warranties related to Product X, those performance claims and
-warranties are such Commercial Contributor's responsibility alone. Under this
-section, the Commercial Contributor would have to defend claims against the
-other Contributors related to those performance claims and warranties, and if a
-court requires any other Contributor to pay any damages as a result, the
-Commercial Contributor must pay those damages.</span> </p>
-
-<p><b><span style='font-size:10.0pt'>5. NO WARRANTY</span></b> </p>
-
-<p><span style='font-size:10.0pt'>EXCEPT AS EXPRESSLY SET FORTH IN THIS
-AGREEMENT, THE PROGRAM IS PROVIDED ON AN &quot;AS IS&quot; BASIS, WITHOUT
-WARRANTIES OR CONDITIONS OF ANY KIND, EITHER EXPRESS OR IMPLIED INCLUDING,
-WITHOUT LIMITATION, ANY WARRANTIES OR CONDITIONS OF TITLE, NON-INFRINGEMENT,
-MERCHANTABILITY OR FITNESS FOR A PARTICULAR PURPOSE. Each Recipient is solely
-responsible for determining the appropriateness of using and distributing the
-Program and assumes all risks associated with its exercise of rights under this
-Agreement , including but not limited to the risks and costs of program errors,
-compliance with applicable laws, damage to or loss of data, programs or
-equipment, and unavailability or interruption of operations. </span></p>
-
-<p><b><span style='font-size:10.0pt'>6. DISCLAIMER OF LIABILITY</span></b> </p>
-
-<p><span style='font-size:10.0pt'>EXCEPT AS EXPRESSLY SET FORTH IN THIS
-AGREEMENT, NEITHER RECIPIENT NOR ANY CONTRIBUTORS SHALL HAVE ANY LIABILITY FOR
-ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES
-(INCLUDING WITHOUT LIMITATION LOST PROFITS), HOWEVER CAUSED AND ON ANY THEORY
-OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING
-NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OR DISTRIBUTION OF
-THE PROGRAM OR THE EXERCISE OF ANY RIGHTS GRANTED HEREUNDER, EVEN IF ADVISED OF
-THE POSSIBILITY OF SUCH DAMAGES.</span> </p>
-
-<p><b><span style='font-size:10.0pt'>7. GENERAL</span></b> </p>
-
-<p><span style='font-size:10.0pt'>If any provision of this Agreement is invalid
-or unenforceable under applicable law, it shall not affect the validity or
-enforceability of the remainder of the terms of this Agreement, and without
-further action by the parties hereto, such provision shall be reformed to the
-minimum extent necessary to make such provision valid and enforceable.</span> </p>
-
-<p><span style='font-size:10.0pt'>If Recipient institutes patent litigation
-against any entity (including a cross-claim or counterclaim in a lawsuit)
-alleging that the Program itself (excluding combinations of the Program with
-other software or hardware) infringes such Recipient's patent(s), then such
-Recipient's rights granted under Section 2(b) shall terminate as of the date
-such litigation is filed. </span></p>
-
-<p><span style='font-size:10.0pt'>All Recipient's rights under this Agreement
-shall terminate if it fails to comply with any of the material terms or
-conditions of this Agreement and does not cure such failure in a reasonable
-period of time after becoming aware of such noncompliance. If all Recipient's
-rights under this Agreement terminate, Recipient agrees to cease use and
-distribution of the Program as soon as reasonably practicable. However,
-Recipient's obligations under this Agreement and any licenses granted by
-Recipient relating to the Program shall continue and survive. </span></p>
-
-<p><span style='font-size:10.0pt'>Everyone is permitted to copy and distribute
-copies of this Agreement, but in order to avoid inconsistency the Agreement is
-copyrighted and may only be modified in the following manner. The Agreement
-Steward reserves the right to publish new versions (including revisions) of
-this Agreement from time to time. No one other than the Agreement Steward has
-the right to modify this Agreement. The Eclipse Foundation is the initial
-Agreement Steward. The Eclipse Foundation may assign the responsibility to
-serve as the Agreement Steward to a suitable separate entity. Each new version
-of the Agreement will be given a distinguishing version number. The Program
-(including Contributions) may always be distributed subject to the version of
-the Agreement under which it was received. In addition, after a new version of
-the Agreement is published, Contributor may elect to distribute the Program
-(including its Contributions) under the new version. Except as expressly stated
-in Sections 2(a) and 2(b) above, Recipient receives no rights or licenses to
-the intellectual property of any Contributor under this Agreement, whether
-expressly, by implication, estoppel or otherwise. All rights in the Program not
-expressly granted under this Agreement are reserved.</span> </p>
-
-<p><span style='font-size:10.0pt'>This Agreement is governed by the laws of the
-State of New York and the intellectual property laws of the United States of
-America. No party to this Agreement will bring a legal action under this
-Agreement more than one year after the cause of action arose. Each party waives
-its rights to a jury trial in any resulting litigation.</span> </p>
-
-<p class=MsoNormal><![if !supportEmptyParas]>&nbsp;<![endif]><o:p></o:p></p>
-
-</div>
-
-</body>
-
-</html> \ No newline at end of file
diff --git a/assembly/features/org.eclipse.jpt.tests.assembly.feature/feature.properties b/assembly/features/org.eclipse.jpt.tests.assembly.feature/feature.properties
deleted file mode 100644
index c98fef25cb..0000000000
--- a/assembly/features/org.eclipse.jpt.tests.assembly.feature/feature.properties
+++ /dev/null
@@ -1,145 +0,0 @@
-###############################################################################
-# Copyright (c) 2006 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
-#
-# Contributors:
-# Oracle. - initial API and implementation
-###############################################################################
-# feature.properties
-# contains externalized strings for feature.xml
-# "%foo" in feature.xml corresponds to the key "foo" in this file
-# java.io.Properties file (ISO 8859-1 with "\" escapes)
-# This file should be translated.
-
-# "featureName" property - name of the feature
-featureName=Dali Java Persistence Tools Tests
-
-# "providerName" property - name of the company that provides the feature
-providerName=Eclipse Web Tools Platform
-
-# "updateSiteName" property - label for the update site
-updateSiteName=The Eclipse Web Tools Platform (WTP) Project update site
-
-# "description" property - description of the feature
-description=Dali Java Persistence Tools project Tests
-
-# "copyright" property - text of the "Feature Update Copyright"
-copyright=\
-Copyright (c) 2006 Oracle Corporation.\n\
-All rights reserved. This program and the accompanying materials\n\
-are made available under the terms of the Eclipse Public License v1.0\n\
-which accompanies this distribution, and is available at\n\
-http://www.eclipse.org/legal/epl-v10.html\n\
-\n\
-Contributors:\n\
- Oracle - initial API and implementation\n
-################ end of copyright property ####################################
-
-# "licenseURL" property - URL of the "Feature License"
-# do not translate value - just change to point to a locale-specific HTML page
-licenseURL=license.html
-
-# "license" property - text of the "Feature Update License"
-# should be plain text version of license agreement pointed to be "licenseURL"
-license=\
-ECLIPSE FOUNDATION SOFTWARE USER AGREEMENT\n\
-June 06, 2007\n\
-\n\
-Usage Of Content\n\
-\n\
-THE ECLIPSE FOUNDATION MAKES AVAILABLE SOFTWARE, DOCUMENTATION, INFORMATION AND/OR\n\
-OTHER MATERIALS FOR OPEN SOURCE PROJECTS (COLLECTIVELY "CONTENT").\n\
-USE OF THE CONTENT IS GOVERNED BY THE TERMS AND CONDITIONS OF THIS\n\
-AGREEMENT AND/OR THE TERMS AND CONDITIONS OF LICENSE AGREEMENTS OR\n\
-NOTICES INDICATED OR REFERENCED BELOW. BY USING THE CONTENT, YOU\n\
-AGREE THAT YOUR USE OF THE CONTENT IS GOVERNED BY THIS AGREEMENT\n\
-AND/OR THE TERMS AND CONDITIONS OF ANY APPLICABLE LICENSE AGREEMENTS\n\
-OR NOTICES INDICATED OR REFERENCED BELOW. IF YOU DO NOT AGREE TO THE\n\
-TERMS AND CONDITIONS OF THIS AGREEMENT AND THE TERMS AND CONDITIONS\n\
-OF ANY APPLICABLE LICENSE AGREEMENTS OR NOTICES INDICATED OR REFERENCED\n\
-BELOW, THEN YOU MAY NOT USE THE CONTENT.\n\
-\n\
-Applicable Licenses\n\
-\n\
-Unless otherwise indicated, all Content made available by the Eclipse Foundation\n\
-is provided to you under the terms and conditions of the Eclipse Public\n\
-License Version 1.0 ("EPL"). A copy of the EPL is provided with this\n\
-Content and is also available at http://www.eclipse.org/legal/epl-v10.html.\n\
-For purposes of the EPL, "Program" will mean the Content.\n\
-\n\
-Content includes, but is not limited to, source code, object code,\n\
-documentation and other files maintained in the Eclipse.org CVS\n\
-repository ("Repository") in CVS modules ("Modules") and made available\n\
-as downloadable archives ("Downloads").\n\
-\n\
- - Content may be structured and packaged into modules to facilitate delivering,\n\
- extending, and upgrading the Content. Typical modules may include plug-ins ("Plug-ins"),\n\
- plug-in fragments ("Fragments"), and features ("Features").\n\
- - Each Plug-in or Fragment may be packaged as a sub-directory or JAR (Java? ARchive)\n\
- in a directory named "plugins".\n\
- - A Feature is a bundle of one or more Plug-ins and/or Fragments and associated material.\n\
- Each Feature may be packaged as a sub-directory in a directory named "features".\n\
- Within a Feature, files named "feature.xml" may contain a list of the names and version\n\
- numbers of the Plug-ins and/or Fragments associated with that Feature.\n\
- - Features may also include other Features ("Included Features"). Within a Feature, files\n\
- named "feature.xml" may contain a list of the names and version numbers of Included Features.\n\
-\n\
-Features may also include other Features ("Included Features"). Files named\n\
-"feature.xml" may contain a list of the names and version numbers of\n\
-Included Features.\n\
-\n\
-The terms and conditions governing Plug-ins and Fragments should be\n\
-contained in files named "about.html" ("Abouts"). The terms and\n\
-conditions governing Features and Included Features should be contained\n\
-in files named "license.html" ("Feature Licenses"). Abouts and Feature\n\
-Licenses may be located in any directory of a Download or Module\n\
-including, but not limited to the following locations:\n\
-\n\
- - The top-level (root) directory\n\
- - Plug-in and Fragment directories\n\
- - Inside Plug-ins and Fragments packaged as JARs\n\
- - Sub-directories of the directory named "src" of certain Plug-ins\n\
- - Feature directories\n\
-\n\
-Note: if a Feature made available by the Eclipse Foundation is installed using the\n\
-Eclipse Update Manager, you must agree to a license ("Feature Update\n\
-License") during the installation process. If the Feature contains\n\
-Included Features, the Feature Update License should either provide you\n\
-with the terms and conditions governing the Included Features or inform\n\
-you where you can locate them. Feature Update Licenses may be found in\n\
-the "license" property of files named "feature.properties". Such Abouts,\n\
-Feature Licenses and Feature Update Licenses contain the terms and\n\
-conditions (or references to such terms and conditions) that govern your\n\
-use of the associated Content in that directory.\n\
-\n\
-THE ABOUTS, FEATURE LICENSES AND FEATURE UPDATE LICENSES MAY REFER\n\
-TO THE EPL OR OTHER LICENSE AGREEMENTS, NOTICES OR TERMS AND CONDITIONS.\n\
-SOME OF THESE OTHER LICENSE AGREEMENTS MAY INCLUDE (BUT ARE NOT LIMITED TO):\n\
-\n\
- - Common Public License Version 1.0 (available at http://www.eclipse.org/legal/cpl-v10.html)\n\
- - Apache Software License 1.1 (available at http://www.apache.org/licenses/LICENSE)\n\
- - Apache Software License 2.0 (available at http://www.apache.org/licenses/LICENSE-2.0)\n\
- - IBM Public License 1.0 (available at http://oss.software.ibm.com/developerworks/opensource/license10.html)\n\
- - Metro Link Public License 1.00 (available at http://www.opengroup.org/openmotif/supporters/metrolink/license.html)\n\
- - Mozilla Public License Version 1.1 (available at http://www.mozilla.org/MPL/MPL-1.1.html)\n\
- - Common Development and Distribution License (CDDL) Version 1.0 (available at http://www.sun.com/cddl/cddl.html)\n\
-\n\
-IT IS YOUR OBLIGATION TO READ AND ACCEPT ALL SUCH TERMS AND CONDITIONS PRIOR\n\
-TO USE OF THE CONTENT. If no About, Feature License or Feature Update License\n\
-is provided, please contact the Eclipse Foundation to determine what terms and conditions\n\
-govern that particular Content.\n\
-\n\
-Cryptography\n\
-\n\
-Content may contain encryption software. The country in which you are\n\
-currently may have restrictions on the import, possession, and use,\n\
-and/or re-export to another country, of encryption software. BEFORE\n\
-using any encryption software, please check the country's laws,\n\
-regulations and policies concerning the import, possession, or use,\n\
-and re-export of encryption software, to see if this is permitted.\n\
-\n\
-Java and all Java-based trademarks are trademarks of Sun Microsystems, Inc. in the United States, other countries, or both.\n
-########### end of license property ##########################################
diff --git a/assembly/features/org.eclipse.jpt.tests.assembly.feature/feature.xml b/assembly/features/org.eclipse.jpt.tests.assembly.feature/feature.xml
deleted file mode 100644
index 93b0372f80..0000000000
--- a/assembly/features/org.eclipse.jpt.tests.assembly.feature/feature.xml
+++ /dev/null
@@ -1,28 +0,0 @@
-<?xml version="1.0" encoding="UTF-8"?>
-<feature
- id="org.eclipse.jpt.tests.assembly.feature"
- label="%featureName"
- version="2.2.0.qualifier"
- provider-name="%providerName">
-
- <description>
- %description
- </description>
-
- <copyright>
- %copyright
- </copyright>
-
- <license url="license.html">
- %license
- </license>
-
- <url>
- <update label="%updateSiteName" url="http://download.eclipse.org/webtools/updates/"/>
- </url>
-
- <includes
- id="org.eclipse.jpt.tests.feature"
- version="0.0.0"/>
-
-</feature>
diff --git a/assembly/features/org.eclipse.jpt.tests.assembly.feature/license.html b/assembly/features/org.eclipse.jpt.tests.assembly.feature/license.html
deleted file mode 100644
index 56445985d9..0000000000
--- a/assembly/features/org.eclipse.jpt.tests.assembly.feature/license.html
+++ /dev/null
@@ -1,98 +0,0 @@
-<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN" "http://www.w3c.org/TR/1999/REC-html401-19991224/loose.dtd">
-<!-- saved from url=(0044)http://www.eclipse.org/legal/epl/notice.html -->
-<HTML><HEAD><TITLE>Eclipse.org Software User Agreement</TITLE>
-<META http-equiv=Content-Type content="text/html; charset=iso-8859-1">
-<META content="MSHTML 6.00.2800.1479" name=GENERATOR></HEAD>
-<BODY lang=EN-US vLink=purple link=blue>
-<H2>Eclipse Foundation Software User Agreement</H2>
-<P>June 06, 2007</P>
-<H3>Usage Of Content</H3>
-<P>THE ECLIPSE FOUNDATION MAKES AVAILABLE SOFTWARE, DOCUMENTATION, INFORMATION
-AND/OR OTHER MATERIALS FOR OPEN SOURCE PROJECTS (COLLECTIVELY "CONTENT"). USE OF
-THE CONTENT IS GOVERNED BY THE TERMS AND CONDITIONS OF THIS AGREEMENT AND/OR THE
-TERMS AND CONDITIONS OF LICENSE AGREEMENTS OR NOTICES INDICATED OR REFERENCED
-BELOW. BY USING THE CONTENT, YOU AGREE THAT YOUR USE OF THE CONTENT IS GOVERNED
-BY THIS AGREEMENT AND/OR THE TERMS AND CONDITIONS OF ANY APPLICABLE LICENSE
-AGREEMENTS OR NOTICES INDICATED OR REFERENCED BELOW. IF YOU DO NOT AGREE TO THE
-TERMS AND CONDITIONS OF THIS AGREEMENT AND THE TERMS AND CONDITIONS OF ANY
-APPLICABLE LICENSE AGREEMENTS OR NOTICES INDICATED OR REFERENCED BELOW, THEN YOU
-MAY NOT USE THE CONTENT.</P>
-<H3>Applicable Licenses</H3>
-<P>Unless otherwise indicated, all Content made available by the Eclipse
-Foundation is provided to you under the terms and conditions of the Eclipse
-Public License Version 1.0 ("EPL"). A copy of the EPL is provided with this
-Content and is also available at <A
-href="http://www.eclipse.org/legal/epl-v10.html">http://www.eclipse.org/legal/epl-v10.html</A>.
-For purposes of the EPL, "Program" will mean the Content.</P>
-<P>Content includes, but is not limited to, source code, object code,
-documentation and other files maintained in the Eclipse.org CVS repository
-("Repository") in CVS modules ("Modules") and made available as downloadable
-archives ("Downloads").</P>
-<P>Content may be apportioned into plug-ins ("Plug-ins"), plug-in fragments
-("Fragments"), and features ("Features"). A Feature is a bundle of one or more
-Plug-ins and/or Fragments and associated material. Files named "feature.xml" may
-contain a list of the names and version numbers of the Plug-ins and/or Fragments
-associated with a Feature. Plug-ins and Fragments are located in directories
-named "plugins" and Features are located in directories named "features".</P>
-<P>Features may also include other Features ("Included Features"). Files named
-"feature.xml" may contain a list of the names and version numbers of Included
-Features.</P>
-<P>The terms and conditions governing Plug-ins and Fragments should be contained
-in files named "about.html" ("Abouts"). The terms and conditions governing
-Features and Included Features should be contained in files named "license.html"
-("Feature Licenses"). Abouts and Feature Licenses may be located in any
-directory of a Download or Module including, but not limited to the following
-locations:</P>
-<UL>
- <LI>The top-level (root) directory
- <LI>Plug-in and Fragment directories
- <LI>Subdirectories of the directory named "src" of certain Plug-ins
- <LI>Feature directories </LI></UL>
-<P>Note: if a Feature made available by the Eclipse Foundation is installed
-using the Eclipse Update Manager, you must agree to a license ("Feature Update
-License") during the installation process. If the Feature contains Included
-Features, the Feature Update License should either provide you with the terms
-and conditions governing the Included Features or inform you where you can
-locate them. Feature Update Licenses may be found in the "license" property of
-files named "feature.properties". Such Abouts, Feature Licenses and Feature
-Update Licenses contain the terms and conditions (or references to such terms
-and conditions) that govern your use of the associated Content in that
-directory.</P>
-<P>THE ABOUTS, FEATURE LICENSES AND FEATURE UPDATE LICENSES MAY REFER TO THE EPL
-OR OTHER LICENSE AGREEMENTS, NOTICES OR TERMS AND CONDITIONS. SOME OF THESE
-OTHER LICENSE AGREEMENTS MAY INCLUDE (BUT ARE NOT LIMITED TO):</P>
-<UL>
- <LI>Common Public License Version 1.0 (available at <A
- href="http://www.eclipse.org/legal/cpl-v10.html">http://www.eclipse.org/legal/cpl-v10.html</A>)
-
- <LI>Apache Software License 1.1 (available at <A
- href="http://www.apache.org/licenses/LICENSE">http://www.apache.org/licenses/LICENSE</A>)
-
- <LI>Apache Software License 2.0 (available at <A
- href="http://www.apache.org/licenses/LICENSE-2.0">http://www.apache.org/licenses/LICENSE-2.0</A>)
-
- <LI>IBM Public License 1.0 (available at <A
- href="http://oss.software.ibm.com/developerworks/opensource/license10.html">http://oss.software.ibm.com/developerworks/opensource/license10.html</A>)
-
- <LI>Metro Link Public License 1.00 (available at <A
- href="http://www.opengroup.org/openmotif/supporters/metrolink/license.html">http://www.opengroup.org/openmotif/supporters/metrolink/license.html</A>)
-
- <LI>Mozilla Public License Version 1.1 (available at <A
- href="http://www.mozilla.org/MPL/MPL-1.1.html">http://www.mozilla.org/MPL/MPL-1.1.html</A>)
- </LI>
-
- <LI>Common Development and Distribution License (CDDL) Version 1.0 (available at <A
- href="http://www.sun.com/cddl/cddl.html">http://www.sun.com/cddl/cddl.html)</A>
- </LI>
-</UL>
-<P>IT IS YOUR OBLIGATION TO READ AND ACCEPT ALL SUCH TERMS AND CONDITIONS PRIOR
-TO USE OF THE CONTENT. If no About, Feature License or Feature Update License is
-provided, please contact the Eclipse Foundation to determine what terms and
-conditions govern that particular Content.</P>
-<H3>Cryptography</H3>
-<P>Content may contain encryption software. The country in which you are
-currently may have restrictions on the import, possession, and use, and/or
-re-export to another country, of encryption software. BEFORE using any
-encryption software, please check the country's laws, regulations and policies
-concerning the import, possession, or use, and re-export of encryption software,
-to see if this is permitted.</P></BODY></HTML>
diff --git a/assembly/features/org.eclipse.jpt.tests/.cvsignore b/assembly/features/org.eclipse.jpt.tests/.cvsignore
deleted file mode 100644
index 2544693f86..0000000000
--- a/assembly/features/org.eclipse.jpt.tests/.cvsignore
+++ /dev/null
@@ -1,3 +0,0 @@
-*.bin.dist.zip
-build.xml
-org.eclipse.jpt.tests_1.0.0.* \ No newline at end of file
diff --git a/assembly/features/org.eclipse.jpt.tests/.project b/assembly/features/org.eclipse.jpt.tests/.project
deleted file mode 100644
index 3d1dde631a..0000000000
--- a/assembly/features/org.eclipse.jpt.tests/.project
+++ /dev/null
@@ -1,17 +0,0 @@
-<?xml version="1.0" encoding="UTF-8"?>
-<projectDescription>
- <name>org.eclipse.jpt.tests</name>
- <comment></comment>
- <projects>
- </projects>
- <buildSpec>
- <buildCommand>
- <name>org.eclipse.pde.FeatureBuilder</name>
- <arguments>
- </arguments>
- </buildCommand>
- </buildSpec>
- <natures>
- <nature>org.eclipse.pde.FeatureNature</nature>
- </natures>
-</projectDescription>
diff --git a/assembly/features/org.eclipse.jpt.tests/.settings/org.eclipse.core.resources.prefs b/assembly/features/org.eclipse.jpt.tests/.settings/org.eclipse.core.resources.prefs
deleted file mode 100644
index 17acb651a8..0000000000
--- a/assembly/features/org.eclipse.jpt.tests/.settings/org.eclipse.core.resources.prefs
+++ /dev/null
@@ -1,3 +0,0 @@
-#Sun May 27 15:11:05 EDT 2007
-eclipse.preferences.version=1
-encoding/<project>=ISO-8859-1
diff --git a/assembly/features/org.eclipse.jpt.tests/build.properties b/assembly/features/org.eclipse.jpt.tests/build.properties
deleted file mode 100644
index 7f47694aab..0000000000
--- a/assembly/features/org.eclipse.jpt.tests/build.properties
+++ /dev/null
@@ -1,5 +0,0 @@
-bin.includes = feature.xml,\
- eclipse_update_120.jpg,\
- epl-v10.html,\
- license.html,\
- feature.properties
diff --git a/assembly/features/org.eclipse.jpt.tests/eclipse_update_120.jpg b/assembly/features/org.eclipse.jpt.tests/eclipse_update_120.jpg
deleted file mode 100644
index bfdf708ad6..0000000000
--- a/assembly/features/org.eclipse.jpt.tests/eclipse_update_120.jpg
+++ /dev/null
Binary files differ
diff --git a/assembly/features/org.eclipse.jpt.tests/epl-v10.html b/assembly/features/org.eclipse.jpt.tests/epl-v10.html
deleted file mode 100644
index ed4b196655..0000000000
--- a/assembly/features/org.eclipse.jpt.tests/epl-v10.html
+++ /dev/null
@@ -1,328 +0,0 @@
-<html xmlns:o="urn:schemas-microsoft-com:office:office"
-xmlns:w="urn:schemas-microsoft-com:office:word"
-xmlns="http://www.w3.org/TR/REC-html40">
-
-<head>
-<meta http-equiv=Content-Type content="text/html; charset=windows-1252">
-<meta name=ProgId content=Word.Document>
-<meta name=Generator content="Microsoft Word 9">
-<meta name=Originator content="Microsoft Word 9">
-<link rel=File-List
-href="./Eclipse%20EPL%202003_11_10%20Final_files/filelist.xml">
-<title>Eclipse Public License - Version 1.0</title>
-<!--[if gte mso 9]><xml>
- <o:DocumentProperties>
- <o:Revision>2</o:Revision>
- <o:TotalTime>3</o:TotalTime>
- <o:Created>2004-03-05T23:03:00Z</o:Created>
- <o:LastSaved>2004-03-05T23:03:00Z</o:LastSaved>
- <o:Pages>4</o:Pages>
- <o:Words>1626</o:Words>
- <o:Characters>9270</o:Characters>
- <o:Lines>77</o:Lines>
- <o:Paragraphs>18</o:Paragraphs>
- <o:CharactersWithSpaces>11384</o:CharactersWithSpaces>
- <o:Version>9.4402</o:Version>
- </o:DocumentProperties>
-</xml><![endif]--><!--[if gte mso 9]><xml>
- <w:WordDocument>
- <w:TrackRevisions/>
- </w:WordDocument>
-</xml><![endif]-->
-<style>
-<!--
- /* Font Definitions */
-@font-face
- {font-family:Tahoma;
- panose-1:2 11 6 4 3 5 4 4 2 4;
- mso-font-charset:0;
- mso-generic-font-family:swiss;
- mso-font-pitch:variable;
- mso-font-signature:553679495 -2147483648 8 0 66047 0;}
- /* Style Definitions */
-p.MsoNormal, li.MsoNormal, div.MsoNormal
- {mso-style-parent:"";
- margin:0in;
- margin-bottom:.0001pt;
- mso-pagination:widow-orphan;
- font-size:12.0pt;
- font-family:"Times New Roman";
- mso-fareast-font-family:"Times New Roman";}
-p
- {margin-right:0in;
- mso-margin-top-alt:auto;
- mso-margin-bottom-alt:auto;
- margin-left:0in;
- mso-pagination:widow-orphan;
- font-size:12.0pt;
- font-family:"Times New Roman";
- mso-fareast-font-family:"Times New Roman";}
-p.BalloonText, li.BalloonText, div.BalloonText
- {mso-style-name:"Balloon Text";
- margin:0in;
- margin-bottom:.0001pt;
- mso-pagination:widow-orphan;
- font-size:8.0pt;
- font-family:Tahoma;
- mso-fareast-font-family:"Times New Roman";}
-@page Section1
- {size:8.5in 11.0in;
- margin:1.0in 1.25in 1.0in 1.25in;
- mso-header-margin:.5in;
- mso-footer-margin:.5in;
- mso-paper-source:0;}
-div.Section1
- {page:Section1;}
--->
-</style>
-</head>
-
-<body lang=EN-US style='tab-interval:.5in'>
-
-<div class=Section1>
-
-<p align=center style='text-align:center'><b>Eclipse Public License - v 1.0</b>
-</p>
-
-<p><span style='font-size:10.0pt'>THE ACCOMPANYING PROGRAM IS PROVIDED UNDER
-THE TERMS OF THIS ECLIPSE PUBLIC LICENSE (&quot;AGREEMENT&quot;). ANY USE,
-REPRODUCTION OR DISTRIBUTION OF THE PROGRAM CONSTITUTES RECIPIENT'S ACCEPTANCE
-OF THIS AGREEMENT.</span> </p>
-
-<p><b><span style='font-size:10.0pt'>1. DEFINITIONS</span></b> </p>
-
-<p><span style='font-size:10.0pt'>&quot;Contribution&quot; means:</span> </p>
-
-<p class=MsoNormal style='margin-left:.5in'><span style='font-size:10.0pt'>a)
-in the case of the initial Contributor, the initial code and documentation
-distributed under this Agreement, and<br clear=left>
-b) in the case of each subsequent Contributor:</span></p>
-
-<p class=MsoNormal style='margin-left:.5in'><span style='font-size:10.0pt'>i)
-changes to the Program, and</span></p>
-
-<p class=MsoNormal style='margin-left:.5in'><span style='font-size:10.0pt'>ii)
-additions to the Program;</span></p>
-
-<p class=MsoNormal style='margin-left:.5in'><span style='font-size:10.0pt'>where
-such changes and/or additions to the Program originate from and are distributed
-by that particular Contributor. A Contribution 'originates' from a Contributor
-if it was added to the Program by such Contributor itself or anyone acting on
-such Contributor's behalf. Contributions do not include additions to the
-Program which: (i) are separate modules of software distributed in conjunction
-with the Program under their own license agreement, and (ii) are not derivative
-works of the Program. </span></p>
-
-<p><span style='font-size:10.0pt'>&quot;Contributor&quot; means any person or
-entity that distributes the Program.</span> </p>
-
-<p><span style='font-size:10.0pt'>&quot;Licensed Patents &quot; mean patent
-claims licensable by a Contributor which are necessarily infringed by the use
-or sale of its Contribution alone or when combined with the Program. </span></p>
-
-<p><span style='font-size:10.0pt'>&quot;Program&quot; means the Contributions
-distributed in accordance with this Agreement.</span> </p>
-
-<p><span style='font-size:10.0pt'>&quot;Recipient&quot; means anyone who
-receives the Program under this Agreement, including all Contributors.</span> </p>
-
-<p><b><span style='font-size:10.0pt'>2. GRANT OF RIGHTS</span></b> </p>
-
-<p class=MsoNormal style='margin-left:.5in'><span style='font-size:10.0pt'>a)
-Subject to the terms of this Agreement, each Contributor hereby grants Recipient
-a non-exclusive, worldwide, royalty-free copyright license to<span
-style='color:red'> </span>reproduce, prepare derivative works of, publicly
-display, publicly perform, distribute and sublicense the Contribution of such
-Contributor, if any, and such derivative works, in source code and object code
-form.</span></p>
-
-<p class=MsoNormal style='margin-left:.5in'><span style='font-size:10.0pt'>b)
-Subject to the terms of this Agreement, each Contributor hereby grants
-Recipient a non-exclusive, worldwide,<span style='color:green'> </span>royalty-free
-patent license under Licensed Patents to make, use, sell, offer to sell, import
-and otherwise transfer the Contribution of such Contributor, if any, in source
-code and object code form. This patent license shall apply to the combination
-of the Contribution and the Program if, at the time the Contribution is added
-by the Contributor, such addition of the Contribution causes such combination
-to be covered by the Licensed Patents. The patent license shall not apply to
-any other combinations which include the Contribution. No hardware per se is
-licensed hereunder. </span></p>
-
-<p class=MsoNormal style='margin-left:.5in'><span style='font-size:10.0pt'>c)
-Recipient understands that although each Contributor grants the licenses to its
-Contributions set forth herein, no assurances are provided by any Contributor
-that the Program does not infringe the patent or other intellectual property
-rights of any other entity. Each Contributor disclaims any liability to Recipient
-for claims brought by any other entity based on infringement of intellectual
-property rights or otherwise. As a condition to exercising the rights and
-licenses granted hereunder, each Recipient hereby assumes sole responsibility
-to secure any other intellectual property rights needed, if any. For example,
-if a third party patent license is required to allow Recipient to distribute
-the Program, it is Recipient's responsibility to acquire that license before
-distributing the Program.</span></p>
-
-<p class=MsoNormal style='margin-left:.5in'><span style='font-size:10.0pt'>d)
-Each Contributor represents that to its knowledge it has sufficient copyright
-rights in its Contribution, if any, to grant the copyright license set forth in
-this Agreement. </span></p>
-
-<p><b><span style='font-size:10.0pt'>3. REQUIREMENTS</span></b> </p>
-
-<p><span style='font-size:10.0pt'>A Contributor may choose to distribute the
-Program in object code form under its own license agreement, provided that:</span>
-</p>
-
-<p class=MsoNormal style='margin-left:.5in'><span style='font-size:10.0pt'>a)
-it complies with the terms and conditions of this Agreement; and</span></p>
-
-<p class=MsoNormal style='margin-left:.5in'><span style='font-size:10.0pt'>b)
-its license agreement:</span></p>
-
-<p class=MsoNormal style='margin-left:.5in'><span style='font-size:10.0pt'>i)
-effectively disclaims on behalf of all Contributors all warranties and
-conditions, express and implied, including warranties or conditions of title
-and non-infringement, and implied warranties or conditions of merchantability
-and fitness for a particular purpose; </span></p>
-
-<p class=MsoNormal style='margin-left:.5in'><span style='font-size:10.0pt'>ii)
-effectively excludes on behalf of all Contributors all liability for damages,
-including direct, indirect, special, incidental and consequential damages, such
-as lost profits; </span></p>
-
-<p class=MsoNormal style='margin-left:.5in'><span style='font-size:10.0pt'>iii)
-states that any provisions which differ from this Agreement are offered by that
-Contributor alone and not by any other party; and</span></p>
-
-<p class=MsoNormal style='margin-left:.5in'><span style='font-size:10.0pt'>iv)
-states that source code for the Program is available from such Contributor, and
-informs licensees how to obtain it in a reasonable manner on or through a
-medium customarily used for software exchange.<span style='color:blue'> </span></span></p>
-
-<p><span style='font-size:10.0pt'>When the Program is made available in source
-code form:</span> </p>
-
-<p class=MsoNormal style='margin-left:.5in'><span style='font-size:10.0pt'>a)
-it must be made available under this Agreement; and </span></p>
-
-<p class=MsoNormal style='margin-left:.5in'><span style='font-size:10.0pt'>b) a
-copy of this Agreement must be included with each copy of the Program. </span></p>
-
-<p><span style='font-size:10.0pt'>Contributors may not remove or alter any
-copyright notices contained within the Program. </span></p>
-
-<p><span style='font-size:10.0pt'>Each Contributor must identify itself as the
-originator of its Contribution, if any, in a manner that reasonably allows
-subsequent Recipients to identify the originator of the Contribution. </span></p>
-
-<p><b><span style='font-size:10.0pt'>4. COMMERCIAL DISTRIBUTION</span></b> </p>
-
-<p><span style='font-size:10.0pt'>Commercial distributors of software may
-accept certain responsibilities with respect to end users, business partners
-and the like. While this license is intended to facilitate the commercial use
-of the Program, the Contributor who includes the Program in a commercial
-product offering should do so in a manner which does not create potential
-liability for other Contributors. Therefore, if a Contributor includes the
-Program in a commercial product offering, such Contributor (&quot;Commercial
-Contributor&quot;) hereby agrees to defend and indemnify every other
-Contributor (&quot;Indemnified Contributor&quot;) against any losses, damages and
-costs (collectively &quot;Losses&quot;) arising from claims, lawsuits and other
-legal actions brought by a third party against the Indemnified Contributor to
-the extent caused by the acts or omissions of such Commercial Contributor in
-connection with its distribution of the Program in a commercial product
-offering. The obligations in this section do not apply to any claims or Losses
-relating to any actual or alleged intellectual property infringement. In order
-to qualify, an Indemnified Contributor must: a) promptly notify the Commercial
-Contributor in writing of such claim, and b) allow the Commercial Contributor
-to control, and cooperate with the Commercial Contributor in, the defense and
-any related settlement negotiations. The Indemnified Contributor may participate
-in any such claim at its own expense.</span> </p>
-
-<p><span style='font-size:10.0pt'>For example, a Contributor might include the
-Program in a commercial product offering, Product X. That Contributor is then a
-Commercial Contributor. If that Commercial Contributor then makes performance
-claims, or offers warranties related to Product X, those performance claims and
-warranties are such Commercial Contributor's responsibility alone. Under this
-section, the Commercial Contributor would have to defend claims against the
-other Contributors related to those performance claims and warranties, and if a
-court requires any other Contributor to pay any damages as a result, the
-Commercial Contributor must pay those damages.</span> </p>
-
-<p><b><span style='font-size:10.0pt'>5. NO WARRANTY</span></b> </p>
-
-<p><span style='font-size:10.0pt'>EXCEPT AS EXPRESSLY SET FORTH IN THIS
-AGREEMENT, THE PROGRAM IS PROVIDED ON AN &quot;AS IS&quot; BASIS, WITHOUT
-WARRANTIES OR CONDITIONS OF ANY KIND, EITHER EXPRESS OR IMPLIED INCLUDING,
-WITHOUT LIMITATION, ANY WARRANTIES OR CONDITIONS OF TITLE, NON-INFRINGEMENT,
-MERCHANTABILITY OR FITNESS FOR A PARTICULAR PURPOSE. Each Recipient is solely
-responsible for determining the appropriateness of using and distributing the
-Program and assumes all risks associated with its exercise of rights under this
-Agreement , including but not limited to the risks and costs of program errors,
-compliance with applicable laws, damage to or loss of data, programs or
-equipment, and unavailability or interruption of operations. </span></p>
-
-<p><b><span style='font-size:10.0pt'>6. DISCLAIMER OF LIABILITY</span></b> </p>
-
-<p><span style='font-size:10.0pt'>EXCEPT AS EXPRESSLY SET FORTH IN THIS
-AGREEMENT, NEITHER RECIPIENT NOR ANY CONTRIBUTORS SHALL HAVE ANY LIABILITY FOR
-ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES
-(INCLUDING WITHOUT LIMITATION LOST PROFITS), HOWEVER CAUSED AND ON ANY THEORY
-OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING
-NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OR DISTRIBUTION OF
-THE PROGRAM OR THE EXERCISE OF ANY RIGHTS GRANTED HEREUNDER, EVEN IF ADVISED OF
-THE POSSIBILITY OF SUCH DAMAGES.</span> </p>
-
-<p><b><span style='font-size:10.0pt'>7. GENERAL</span></b> </p>
-
-<p><span style='font-size:10.0pt'>If any provision of this Agreement is invalid
-or unenforceable under applicable law, it shall not affect the validity or
-enforceability of the remainder of the terms of this Agreement, and without
-further action by the parties hereto, such provision shall be reformed to the
-minimum extent necessary to make such provision valid and enforceable.</span> </p>
-
-<p><span style='font-size:10.0pt'>If Recipient institutes patent litigation
-against any entity (including a cross-claim or counterclaim in a lawsuit)
-alleging that the Program itself (excluding combinations of the Program with
-other software or hardware) infringes such Recipient's patent(s), then such
-Recipient's rights granted under Section 2(b) shall terminate as of the date
-such litigation is filed. </span></p>
-
-<p><span style='font-size:10.0pt'>All Recipient's rights under this Agreement
-shall terminate if it fails to comply with any of the material terms or
-conditions of this Agreement and does not cure such failure in a reasonable
-period of time after becoming aware of such noncompliance. If all Recipient's
-rights under this Agreement terminate, Recipient agrees to cease use and
-distribution of the Program as soon as reasonably practicable. However,
-Recipient's obligations under this Agreement and any licenses granted by
-Recipient relating to the Program shall continue and survive. </span></p>
-
-<p><span style='font-size:10.0pt'>Everyone is permitted to copy and distribute
-copies of this Agreement, but in order to avoid inconsistency the Agreement is
-copyrighted and may only be modified in the following manner. The Agreement
-Steward reserves the right to publish new versions (including revisions) of
-this Agreement from time to time. No one other than the Agreement Steward has
-the right to modify this Agreement. The Eclipse Foundation is the initial
-Agreement Steward. The Eclipse Foundation may assign the responsibility to
-serve as the Agreement Steward to a suitable separate entity. Each new version
-of the Agreement will be given a distinguishing version number. The Program
-(including Contributions) may always be distributed subject to the version of
-the Agreement under which it was received. In addition, after a new version of
-the Agreement is published, Contributor may elect to distribute the Program
-(including its Contributions) under the new version. Except as expressly stated
-in Sections 2(a) and 2(b) above, Recipient receives no rights or licenses to
-the intellectual property of any Contributor under this Agreement, whether
-expressly, by implication, estoppel or otherwise. All rights in the Program not
-expressly granted under this Agreement are reserved.</span> </p>
-
-<p><span style='font-size:10.0pt'>This Agreement is governed by the laws of the
-State of New York and the intellectual property laws of the United States of
-America. No party to this Agreement will bring a legal action under this
-Agreement more than one year after the cause of action arose. Each party waives
-its rights to a jury trial in any resulting litigation.</span> </p>
-
-<p class=MsoNormal><![if !supportEmptyParas]>&nbsp;<![endif]><o:p></o:p></p>
-
-</div>
-
-</body>
-
-</html> \ No newline at end of file
diff --git a/assembly/features/org.eclipse.jpt.tests/feature.properties b/assembly/features/org.eclipse.jpt.tests/feature.properties
deleted file mode 100644
index 6b58fe6a33..0000000000
--- a/assembly/features/org.eclipse.jpt.tests/feature.properties
+++ /dev/null
@@ -1,145 +0,0 @@
-###############################################################################
-# Copyright (c) 2006 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
-#
-# Contributors:
-# Oracle. - initial API and implementation
-###############################################################################
-# feature.properties
-# contains externalized strings for feature.xml
-# "%foo" in feature.xml corresponds to the key "foo" in this file
-# java.io.Properties file (ISO 8859-1 with "\" escapes)
-# This file should be translated.
-
-# "featureName" property - name of the feature
-featureName=Dali Java Persistence API (JPA) project Tests
-
-# "providerName" property - name of the company that provides the feature
-providerName=Eclipse.org
-
-# "updateSiteName" property - label for the update site
-updateSiteName=The Eclipse Web Tools Platform (WTP) Project update site
-
-# "description" property - description of the feature
-description=Dali Java Persistence API (JPA) project Tests
-
-# "copyright" property - text of the "Feature Update Copyright"
-copyright=\
-Copyright (c) 2006 Oracle Corporation.\n\
-All rights reserved. This program and the accompanying materials\n\
-are made available under the terms of the Eclipse Public License v1.0\n\
-which accompanies this distribution, and is available at\n\
-http://www.eclipse.org/legal/epl-v10.html\n\
-\n\
-Contributors:\n\
- Oracle - initial API and implementation\n
-################ end of copyright property ####################################
-
-# "licenseURL" property - URL of the "Feature License"
-# do not translate value - just change to point to a locale-specific HTML page
-licenseURL=license.html
-
-# "license" property - text of the "Feature Update License"
-# should be plain text version of license agreement pointed to be "licenseURL"
-license=\
-ECLIPSE FOUNDATION SOFTWARE USER AGREEMENT\n\
-June 06, 2007\n\
-\n\
-Usage Of Content\n\
-\n\
-THE ECLIPSE FOUNDATION MAKES AVAILABLE SOFTWARE, DOCUMENTATION, INFORMATION AND/OR\n\
-OTHER MATERIALS FOR OPEN SOURCE PROJECTS (COLLECTIVELY "CONTENT").\n\
-USE OF THE CONTENT IS GOVERNED BY THE TERMS AND CONDITIONS OF THIS\n\
-AGREEMENT AND/OR THE TERMS AND CONDITIONS OF LICENSE AGREEMENTS OR\n\
-NOTICES INDICATED OR REFERENCED BELOW. BY USING THE CONTENT, YOU\n\
-AGREE THAT YOUR USE OF THE CONTENT IS GOVERNED BY THIS AGREEMENT\n\
-AND/OR THE TERMS AND CONDITIONS OF ANY APPLICABLE LICENSE AGREEMENTS\n\
-OR NOTICES INDICATED OR REFERENCED BELOW. IF YOU DO NOT AGREE TO THE\n\
-TERMS AND CONDITIONS OF THIS AGREEMENT AND THE TERMS AND CONDITIONS\n\
-OF ANY APPLICABLE LICENSE AGREEMENTS OR NOTICES INDICATED OR REFERENCED\n\
-BELOW, THEN YOU MAY NOT USE THE CONTENT.\n\
-\n\
-Applicable Licenses\n\
-\n\
-Unless otherwise indicated, all Content made available by the Eclipse Foundation\n\
-is provided to you under the terms and conditions of the Eclipse Public\n\
-License Version 1.0 ("EPL"). A copy of the EPL is provided with this\n\
-Content and is also available at http://www.eclipse.org/legal/epl-v10.html.\n\
-For purposes of the EPL, "Program" will mean the Content.\n\
-\n\
-Content includes, but is not limited to, source code, object code,\n\
-documentation and other files maintained in the Eclipse.org CVS\n\
-repository ("Repository") in CVS modules ("Modules") and made available\n\
-as downloadable archives ("Downloads").\n\
-\n\
- - Content may be structured and packaged into modules to facilitate delivering,\n\
- extending, and upgrading the Content. Typical modules may include plug-ins ("Plug-ins"),\n\
- plug-in fragments ("Fragments"), and features ("Features").\n\
- - Each Plug-in or Fragment may be packaged as a sub-directory or JAR (Java? ARchive)\n\
- in a directory named "plugins".\n\
- - A Feature is a bundle of one or more Plug-ins and/or Fragments and associated material.\n\
- Each Feature may be packaged as a sub-directory in a directory named "features".\n\
- Within a Feature, files named "feature.xml" may contain a list of the names and version\n\
- numbers of the Plug-ins and/or Fragments associated with that Feature.\n\
- - Features may also include other Features ("Included Features"). Within a Feature, files\n\
- named "feature.xml" may contain a list of the names and version numbers of Included Features.\n\
-\n\
-Features may also include other Features ("Included Features"). Files named\n\
-"feature.xml" may contain a list of the names and version numbers of\n\
-Included Features.\n\
-\n\
-The terms and conditions governing Plug-ins and Fragments should be\n\
-contained in files named "about.html" ("Abouts"). The terms and\n\
-conditions governing Features and Included Features should be contained\n\
-in files named "license.html" ("Feature Licenses"). Abouts and Feature\n\
-Licenses may be located in any directory of a Download or Module\n\
-including, but not limited to the following locations:\n\
-\n\
- - The top-level (root) directory\n\
- - Plug-in and Fragment directories\n\
- - Inside Plug-ins and Fragments packaged as JARs\n\
- - Sub-directories of the directory named "src" of certain Plug-ins\n\
- - Feature directories\n\
-\n\
-Note: if a Feature made available by the Eclipse Foundation is installed using the\n\
-Eclipse Update Manager, you must agree to a license ("Feature Update\n\
-License") during the installation process. If the Feature contains\n\
-Included Features, the Feature Update License should either provide you\n\
-with the terms and conditions governing the Included Features or inform\n\
-you where you can locate them. Feature Update Licenses may be found in\n\
-the "license" property of files named "feature.properties". Such Abouts,\n\
-Feature Licenses and Feature Update Licenses contain the terms and\n\
-conditions (or references to such terms and conditions) that govern your\n\
-use of the associated Content in that directory.\n\
-\n\
-THE ABOUTS, FEATURE LICENSES AND FEATURE UPDATE LICENSES MAY REFER\n\
-TO THE EPL OR OTHER LICENSE AGREEMENTS, NOTICES OR TERMS AND CONDITIONS.\n\
-SOME OF THESE OTHER LICENSE AGREEMENTS MAY INCLUDE (BUT ARE NOT LIMITED TO):\n\
-\n\
- - Common Public License Version 1.0 (available at http://www.eclipse.org/legal/cpl-v10.html)\n\
- - Apache Software License 1.1 (available at http://www.apache.org/licenses/LICENSE)\n\
- - Apache Software License 2.0 (available at http://www.apache.org/licenses/LICENSE-2.0)\n\
- - IBM Public License 1.0 (available at http://oss.software.ibm.com/developerworks/opensource/license10.html)\n\
- - Metro Link Public License 1.00 (available at http://www.opengroup.org/openmotif/supporters/metrolink/license.html)\n\
- - Mozilla Public License Version 1.1 (available at http://www.mozilla.org/MPL/MPL-1.1.html)\n\
- - Common Development and Distribution License (CDDL) Version 1.0 (available at http://www.sun.com/cddl/cddl.html)\n\
-\n\
-IT IS YOUR OBLIGATION TO READ AND ACCEPT ALL SUCH TERMS AND CONDITIONS PRIOR\n\
-TO USE OF THE CONTENT. If no About, Feature License or Feature Update License\n\
-is provided, please contact the Eclipse Foundation to determine what terms and conditions\n\
-govern that particular Content.\n\
-\n\
-Cryptography\n\
-\n\
-Content may contain encryption software. The country in which you are\n\
-currently may have restrictions on the import, possession, and use,\n\
-and/or re-export to another country, of encryption software. BEFORE\n\
-using any encryption software, please check the country's laws,\n\
-regulations and policies concerning the import, possession, or use,\n\
-and re-export of encryption software, to see if this is permitted.\n\
-\n\
-Java and all Java-based trademarks are trademarks of Sun Microsystems, Inc. in the United States, other countries, or both.\n
-########### end of license property ##########################################
diff --git a/assembly/features/org.eclipse.jpt.tests/feature.xml b/assembly/features/org.eclipse.jpt.tests/feature.xml
deleted file mode 100644
index 020fa447a7..0000000000
--- a/assembly/features/org.eclipse.jpt.tests/feature.xml
+++ /dev/null
@@ -1,28 +0,0 @@
-<?xml version="1.0" encoding="UTF-8"?>
-<feature
- id="org.eclipse.jpt.tests"
- label="%featureName"
- version="2.1.0.qualifier"
- provider-name="%providerName">
-
- <description>
- %description
- </description>
-
- <copyright>
- %copyright
- </copyright>
-
- <license url="license.html">
- %license
- </license>
-
- <url>
- <update label="%updateSiteName" url="http://download.eclipse.org/webtools/updates/"/>
- </url>
-
- <includes
- id="org.eclipse.jpt.tests.feature"
- version="0.0.0"/>
-
-</feature>
diff --git a/assembly/features/org.eclipse.jpt.tests/license.html b/assembly/features/org.eclipse.jpt.tests/license.html
deleted file mode 100644
index 56445985d9..0000000000
--- a/assembly/features/org.eclipse.jpt.tests/license.html
+++ /dev/null
@@ -1,98 +0,0 @@
-<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN" "http://www.w3c.org/TR/1999/REC-html401-19991224/loose.dtd">
-<!-- saved from url=(0044)http://www.eclipse.org/legal/epl/notice.html -->
-<HTML><HEAD><TITLE>Eclipse.org Software User Agreement</TITLE>
-<META http-equiv=Content-Type content="text/html; charset=iso-8859-1">
-<META content="MSHTML 6.00.2800.1479" name=GENERATOR></HEAD>
-<BODY lang=EN-US vLink=purple link=blue>
-<H2>Eclipse Foundation Software User Agreement</H2>
-<P>June 06, 2007</P>
-<H3>Usage Of Content</H3>
-<P>THE ECLIPSE FOUNDATION MAKES AVAILABLE SOFTWARE, DOCUMENTATION, INFORMATION
-AND/OR OTHER MATERIALS FOR OPEN SOURCE PROJECTS (COLLECTIVELY "CONTENT"). USE OF
-THE CONTENT IS GOVERNED BY THE TERMS AND CONDITIONS OF THIS AGREEMENT AND/OR THE
-TERMS AND CONDITIONS OF LICENSE AGREEMENTS OR NOTICES INDICATED OR REFERENCED
-BELOW. BY USING THE CONTENT, YOU AGREE THAT YOUR USE OF THE CONTENT IS GOVERNED
-BY THIS AGREEMENT AND/OR THE TERMS AND CONDITIONS OF ANY APPLICABLE LICENSE
-AGREEMENTS OR NOTICES INDICATED OR REFERENCED BELOW. IF YOU DO NOT AGREE TO THE
-TERMS AND CONDITIONS OF THIS AGREEMENT AND THE TERMS AND CONDITIONS OF ANY
-APPLICABLE LICENSE AGREEMENTS OR NOTICES INDICATED OR REFERENCED BELOW, THEN YOU
-MAY NOT USE THE CONTENT.</P>
-<H3>Applicable Licenses</H3>
-<P>Unless otherwise indicated, all Content made available by the Eclipse
-Foundation is provided to you under the terms and conditions of the Eclipse
-Public License Version 1.0 ("EPL"). A copy of the EPL is provided with this
-Content and is also available at <A
-href="http://www.eclipse.org/legal/epl-v10.html">http://www.eclipse.org/legal/epl-v10.html</A>.
-For purposes of the EPL, "Program" will mean the Content.</P>
-<P>Content includes, but is not limited to, source code, object code,
-documentation and other files maintained in the Eclipse.org CVS repository
-("Repository") in CVS modules ("Modules") and made available as downloadable
-archives ("Downloads").</P>
-<P>Content may be apportioned into plug-ins ("Plug-ins"), plug-in fragments
-("Fragments"), and features ("Features"). A Feature is a bundle of one or more
-Plug-ins and/or Fragments and associated material. Files named "feature.xml" may
-contain a list of the names and version numbers of the Plug-ins and/or Fragments
-associated with a Feature. Plug-ins and Fragments are located in directories
-named "plugins" and Features are located in directories named "features".</P>
-<P>Features may also include other Features ("Included Features"). Files named
-"feature.xml" may contain a list of the names and version numbers of Included
-Features.</P>
-<P>The terms and conditions governing Plug-ins and Fragments should be contained
-in files named "about.html" ("Abouts"). The terms and conditions governing
-Features and Included Features should be contained in files named "license.html"
-("Feature Licenses"). Abouts and Feature Licenses may be located in any
-directory of a Download or Module including, but not limited to the following
-locations:</P>
-<UL>
- <LI>The top-level (root) directory
- <LI>Plug-in and Fragment directories
- <LI>Subdirectories of the directory named "src" of certain Plug-ins
- <LI>Feature directories </LI></UL>
-<P>Note: if a Feature made available by the Eclipse Foundation is installed
-using the Eclipse Update Manager, you must agree to a license ("Feature Update
-License") during the installation process. If the Feature contains Included
-Features, the Feature Update License should either provide you with the terms
-and conditions governing the Included Features or inform you where you can
-locate them. Feature Update Licenses may be found in the "license" property of
-files named "feature.properties". Such Abouts, Feature Licenses and Feature
-Update Licenses contain the terms and conditions (or references to such terms
-and conditions) that govern your use of the associated Content in that
-directory.</P>
-<P>THE ABOUTS, FEATURE LICENSES AND FEATURE UPDATE LICENSES MAY REFER TO THE EPL
-OR OTHER LICENSE AGREEMENTS, NOTICES OR TERMS AND CONDITIONS. SOME OF THESE
-OTHER LICENSE AGREEMENTS MAY INCLUDE (BUT ARE NOT LIMITED TO):</P>
-<UL>
- <LI>Common Public License Version 1.0 (available at <A
- href="http://www.eclipse.org/legal/cpl-v10.html">http://www.eclipse.org/legal/cpl-v10.html</A>)
-
- <LI>Apache Software License 1.1 (available at <A
- href="http://www.apache.org/licenses/LICENSE">http://www.apache.org/licenses/LICENSE</A>)
-
- <LI>Apache Software License 2.0 (available at <A
- href="http://www.apache.org/licenses/LICENSE-2.0">http://www.apache.org/licenses/LICENSE-2.0</A>)
-
- <LI>IBM Public License 1.0 (available at <A
- href="http://oss.software.ibm.com/developerworks/opensource/license10.html">http://oss.software.ibm.com/developerworks/opensource/license10.html</A>)
-
- <LI>Metro Link Public License 1.00 (available at <A
- href="http://www.opengroup.org/openmotif/supporters/metrolink/license.html">http://www.opengroup.org/openmotif/supporters/metrolink/license.html</A>)
-
- <LI>Mozilla Public License Version 1.1 (available at <A
- href="http://www.mozilla.org/MPL/MPL-1.1.html">http://www.mozilla.org/MPL/MPL-1.1.html</A>)
- </LI>
-
- <LI>Common Development and Distribution License (CDDL) Version 1.0 (available at <A
- href="http://www.sun.com/cddl/cddl.html">http://www.sun.com/cddl/cddl.html)</A>
- </LI>
-</UL>
-<P>IT IS YOUR OBLIGATION TO READ AND ACCEPT ALL SUCH TERMS AND CONDITIONS PRIOR
-TO USE OF THE CONTENT. If no About, Feature License or Feature Update License is
-provided, please contact the Eclipse Foundation to determine what terms and
-conditions govern that particular Content.</P>
-<H3>Cryptography</H3>
-<P>Content may contain encryption software. The country in which you are
-currently may have restrictions on the import, possession, and use, and/or
-re-export to another country, of encryption software. BEFORE using any
-encryption software, please check the country's laws, regulations and policies
-concerning the import, possession, or use, and re-export of encryption software,
-to see if this is permitted.</P></BODY></HTML>
diff --git a/assembly/features/org.eclipse.jpt/.cvsignore b/assembly/features/org.eclipse.jpt/.cvsignore
deleted file mode 100644
index de8b73fb72..0000000000
--- a/assembly/features/org.eclipse.jpt/.cvsignore
+++ /dev/null
@@ -1,2 +0,0 @@
-build.xml
-org.eclipse.jpt_1.0.0.*
diff --git a/assembly/features/org.eclipse.jpt/.project b/assembly/features/org.eclipse.jpt/.project
deleted file mode 100644
index b7aaec2f54..0000000000
--- a/assembly/features/org.eclipse.jpt/.project
+++ /dev/null
@@ -1,17 +0,0 @@
-<?xml version="1.0" encoding="UTF-8"?>
-<projectDescription>
- <name>org.eclipse.jpt</name>
- <comment></comment>
- <projects>
- </projects>
- <buildSpec>
- <buildCommand>
- <name>org.eclipse.pde.FeatureBuilder</name>
- <arguments>
- </arguments>
- </buildCommand>
- </buildSpec>
- <natures>
- <nature>org.eclipse.pde.FeatureNature</nature>
- </natures>
-</projectDescription>
diff --git a/assembly/features/org.eclipse.jpt/build.properties b/assembly/features/org.eclipse.jpt/build.properties
deleted file mode 100644
index 470b4bcb63..0000000000
--- a/assembly/features/org.eclipse.jpt/build.properties
+++ /dev/null
@@ -1,16 +0,0 @@
-###############################################################################
-# Copyright (c) 2006 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
-#
-# Contributors:
-# Oracle. - initial API and implementation
-###############################################################################
-bin.includes = feature.xml,\
- eclipse_update_120.jpg,\
- epl-v10.html,\
- license.html,\
- feature.properties
- \ No newline at end of file
diff --git a/assembly/features/org.eclipse.jpt/eclipse_update_120.jpg b/assembly/features/org.eclipse.jpt/eclipse_update_120.jpg
deleted file mode 100644
index bfdf708ad6..0000000000
--- a/assembly/features/org.eclipse.jpt/eclipse_update_120.jpg
+++ /dev/null
Binary files differ
diff --git a/assembly/features/org.eclipse.jpt/epl-v10.html b/assembly/features/org.eclipse.jpt/epl-v10.html
deleted file mode 100644
index ed4b196655..0000000000
--- a/assembly/features/org.eclipse.jpt/epl-v10.html
+++ /dev/null
@@ -1,328 +0,0 @@
-<html xmlns:o="urn:schemas-microsoft-com:office:office"
-xmlns:w="urn:schemas-microsoft-com:office:word"
-xmlns="http://www.w3.org/TR/REC-html40">
-
-<head>
-<meta http-equiv=Content-Type content="text/html; charset=windows-1252">
-<meta name=ProgId content=Word.Document>
-<meta name=Generator content="Microsoft Word 9">
-<meta name=Originator content="Microsoft Word 9">
-<link rel=File-List
-href="./Eclipse%20EPL%202003_11_10%20Final_files/filelist.xml">
-<title>Eclipse Public License - Version 1.0</title>
-<!--[if gte mso 9]><xml>
- <o:DocumentProperties>
- <o:Revision>2</o:Revision>
- <o:TotalTime>3</o:TotalTime>
- <o:Created>2004-03-05T23:03:00Z</o:Created>
- <o:LastSaved>2004-03-05T23:03:00Z</o:LastSaved>
- <o:Pages>4</o:Pages>
- <o:Words>1626</o:Words>
- <o:Characters>9270</o:Characters>
- <o:Lines>77</o:Lines>
- <o:Paragraphs>18</o:Paragraphs>
- <o:CharactersWithSpaces>11384</o:CharactersWithSpaces>
- <o:Version>9.4402</o:Version>
- </o:DocumentProperties>
-</xml><![endif]--><!--[if gte mso 9]><xml>
- <w:WordDocument>
- <w:TrackRevisions/>
- </w:WordDocument>
-</xml><![endif]-->
-<style>
-<!--
- /* Font Definitions */
-@font-face
- {font-family:Tahoma;
- panose-1:2 11 6 4 3 5 4 4 2 4;
- mso-font-charset:0;
- mso-generic-font-family:swiss;
- mso-font-pitch:variable;
- mso-font-signature:553679495 -2147483648 8 0 66047 0;}
- /* Style Definitions */
-p.MsoNormal, li.MsoNormal, div.MsoNormal
- {mso-style-parent:"";
- margin:0in;
- margin-bottom:.0001pt;
- mso-pagination:widow-orphan;
- font-size:12.0pt;
- font-family:"Times New Roman";
- mso-fareast-font-family:"Times New Roman";}
-p
- {margin-right:0in;
- mso-margin-top-alt:auto;
- mso-margin-bottom-alt:auto;
- margin-left:0in;
- mso-pagination:widow-orphan;
- font-size:12.0pt;
- font-family:"Times New Roman";
- mso-fareast-font-family:"Times New Roman";}
-p.BalloonText, li.BalloonText, div.BalloonText
- {mso-style-name:"Balloon Text";
- margin:0in;
- margin-bottom:.0001pt;
- mso-pagination:widow-orphan;
- font-size:8.0pt;
- font-family:Tahoma;
- mso-fareast-font-family:"Times New Roman";}
-@page Section1
- {size:8.5in 11.0in;
- margin:1.0in 1.25in 1.0in 1.25in;
- mso-header-margin:.5in;
- mso-footer-margin:.5in;
- mso-paper-source:0;}
-div.Section1
- {page:Section1;}
--->
-</style>
-</head>
-
-<body lang=EN-US style='tab-interval:.5in'>
-
-<div class=Section1>
-
-<p align=center style='text-align:center'><b>Eclipse Public License - v 1.0</b>
-</p>
-
-<p><span style='font-size:10.0pt'>THE ACCOMPANYING PROGRAM IS PROVIDED UNDER
-THE TERMS OF THIS ECLIPSE PUBLIC LICENSE (&quot;AGREEMENT&quot;). ANY USE,
-REPRODUCTION OR DISTRIBUTION OF THE PROGRAM CONSTITUTES RECIPIENT'S ACCEPTANCE
-OF THIS AGREEMENT.</span> </p>
-
-<p><b><span style='font-size:10.0pt'>1. DEFINITIONS</span></b> </p>
-
-<p><span style='font-size:10.0pt'>&quot;Contribution&quot; means:</span> </p>
-
-<p class=MsoNormal style='margin-left:.5in'><span style='font-size:10.0pt'>a)
-in the case of the initial Contributor, the initial code and documentation
-distributed under this Agreement, and<br clear=left>
-b) in the case of each subsequent Contributor:</span></p>
-
-<p class=MsoNormal style='margin-left:.5in'><span style='font-size:10.0pt'>i)
-changes to the Program, and</span></p>
-
-<p class=MsoNormal style='margin-left:.5in'><span style='font-size:10.0pt'>ii)
-additions to the Program;</span></p>
-
-<p class=MsoNormal style='margin-left:.5in'><span style='font-size:10.0pt'>where
-such changes and/or additions to the Program originate from and are distributed
-by that particular Contributor. A Contribution 'originates' from a Contributor
-if it was added to the Program by such Contributor itself or anyone acting on
-such Contributor's behalf. Contributions do not include additions to the
-Program which: (i) are separate modules of software distributed in conjunction
-with the Program under their own license agreement, and (ii) are not derivative
-works of the Program. </span></p>
-
-<p><span style='font-size:10.0pt'>&quot;Contributor&quot; means any person or
-entity that distributes the Program.</span> </p>
-
-<p><span style='font-size:10.0pt'>&quot;Licensed Patents &quot; mean patent
-claims licensable by a Contributor which are necessarily infringed by the use
-or sale of its Contribution alone or when combined with the Program. </span></p>
-
-<p><span style='font-size:10.0pt'>&quot;Program&quot; means the Contributions
-distributed in accordance with this Agreement.</span> </p>
-
-<p><span style='font-size:10.0pt'>&quot;Recipient&quot; means anyone who
-receives the Program under this Agreement, including all Contributors.</span> </p>
-
-<p><b><span style='font-size:10.0pt'>2. GRANT OF RIGHTS</span></b> </p>
-
-<p class=MsoNormal style='margin-left:.5in'><span style='font-size:10.0pt'>a)
-Subject to the terms of this Agreement, each Contributor hereby grants Recipient
-a non-exclusive, worldwide, royalty-free copyright license to<span
-style='color:red'> </span>reproduce, prepare derivative works of, publicly
-display, publicly perform, distribute and sublicense the Contribution of such
-Contributor, if any, and such derivative works, in source code and object code
-form.</span></p>
-
-<p class=MsoNormal style='margin-left:.5in'><span style='font-size:10.0pt'>b)
-Subject to the terms of this Agreement, each Contributor hereby grants
-Recipient a non-exclusive, worldwide,<span style='color:green'> </span>royalty-free
-patent license under Licensed Patents to make, use, sell, offer to sell, import
-and otherwise transfer the Contribution of such Contributor, if any, in source
-code and object code form. This patent license shall apply to the combination
-of the Contribution and the Program if, at the time the Contribution is added
-by the Contributor, such addition of the Contribution causes such combination
-to be covered by the Licensed Patents. The patent license shall not apply to
-any other combinations which include the Contribution. No hardware per se is
-licensed hereunder. </span></p>
-
-<p class=MsoNormal style='margin-left:.5in'><span style='font-size:10.0pt'>c)
-Recipient understands that although each Contributor grants the licenses to its
-Contributions set forth herein, no assurances are provided by any Contributor
-that the Program does not infringe the patent or other intellectual property
-rights of any other entity. Each Contributor disclaims any liability to Recipient
-for claims brought by any other entity based on infringement of intellectual
-property rights or otherwise. As a condition to exercising the rights and
-licenses granted hereunder, each Recipient hereby assumes sole responsibility
-to secure any other intellectual property rights needed, if any. For example,
-if a third party patent license is required to allow Recipient to distribute
-the Program, it is Recipient's responsibility to acquire that license before
-distributing the Program.</span></p>
-
-<p class=MsoNormal style='margin-left:.5in'><span style='font-size:10.0pt'>d)
-Each Contributor represents that to its knowledge it has sufficient copyright
-rights in its Contribution, if any, to grant the copyright license set forth in
-this Agreement. </span></p>
-
-<p><b><span style='font-size:10.0pt'>3. REQUIREMENTS</span></b> </p>
-
-<p><span style='font-size:10.0pt'>A Contributor may choose to distribute the
-Program in object code form under its own license agreement, provided that:</span>
-</p>
-
-<p class=MsoNormal style='margin-left:.5in'><span style='font-size:10.0pt'>a)
-it complies with the terms and conditions of this Agreement; and</span></p>
-
-<p class=MsoNormal style='margin-left:.5in'><span style='font-size:10.0pt'>b)
-its license agreement:</span></p>
-
-<p class=MsoNormal style='margin-left:.5in'><span style='font-size:10.0pt'>i)
-effectively disclaims on behalf of all Contributors all warranties and
-conditions, express and implied, including warranties or conditions of title
-and non-infringement, and implied warranties or conditions of merchantability
-and fitness for a particular purpose; </span></p>
-
-<p class=MsoNormal style='margin-left:.5in'><span style='font-size:10.0pt'>ii)
-effectively excludes on behalf of all Contributors all liability for damages,
-including direct, indirect, special, incidental and consequential damages, such
-as lost profits; </span></p>
-
-<p class=MsoNormal style='margin-left:.5in'><span style='font-size:10.0pt'>iii)
-states that any provisions which differ from this Agreement are offered by that
-Contributor alone and not by any other party; and</span></p>
-
-<p class=MsoNormal style='margin-left:.5in'><span style='font-size:10.0pt'>iv)
-states that source code for the Program is available from such Contributor, and
-informs licensees how to obtain it in a reasonable manner on or through a
-medium customarily used for software exchange.<span style='color:blue'> </span></span></p>
-
-<p><span style='font-size:10.0pt'>When the Program is made available in source
-code form:</span> </p>
-
-<p class=MsoNormal style='margin-left:.5in'><span style='font-size:10.0pt'>a)
-it must be made available under this Agreement; and </span></p>
-
-<p class=MsoNormal style='margin-left:.5in'><span style='font-size:10.0pt'>b) a
-copy of this Agreement must be included with each copy of the Program. </span></p>
-
-<p><span style='font-size:10.0pt'>Contributors may not remove or alter any
-copyright notices contained within the Program. </span></p>
-
-<p><span style='font-size:10.0pt'>Each Contributor must identify itself as the
-originator of its Contribution, if any, in a manner that reasonably allows
-subsequent Recipients to identify the originator of the Contribution. </span></p>
-
-<p><b><span style='font-size:10.0pt'>4. COMMERCIAL DISTRIBUTION</span></b> </p>
-
-<p><span style='font-size:10.0pt'>Commercial distributors of software may
-accept certain responsibilities with respect to end users, business partners
-and the like. While this license is intended to facilitate the commercial use
-of the Program, the Contributor who includes the Program in a commercial
-product offering should do so in a manner which does not create potential
-liability for other Contributors. Therefore, if a Contributor includes the
-Program in a commercial product offering, such Contributor (&quot;Commercial
-Contributor&quot;) hereby agrees to defend and indemnify every other
-Contributor (&quot;Indemnified Contributor&quot;) against any losses, damages and
-costs (collectively &quot;Losses&quot;) arising from claims, lawsuits and other
-legal actions brought by a third party against the Indemnified Contributor to
-the extent caused by the acts or omissions of such Commercial Contributor in
-connection with its distribution of the Program in a commercial product
-offering. The obligations in this section do not apply to any claims or Losses
-relating to any actual or alleged intellectual property infringement. In order
-to qualify, an Indemnified Contributor must: a) promptly notify the Commercial
-Contributor in writing of such claim, and b) allow the Commercial Contributor
-to control, and cooperate with the Commercial Contributor in, the defense and
-any related settlement negotiations. The Indemnified Contributor may participate
-in any such claim at its own expense.</span> </p>
-
-<p><span style='font-size:10.0pt'>For example, a Contributor might include the
-Program in a commercial product offering, Product X. That Contributor is then a
-Commercial Contributor. If that Commercial Contributor then makes performance
-claims, or offers warranties related to Product X, those performance claims and
-warranties are such Commercial Contributor's responsibility alone. Under this
-section, the Commercial Contributor would have to defend claims against the
-other Contributors related to those performance claims and warranties, and if a
-court requires any other Contributor to pay any damages as a result, the
-Commercial Contributor must pay those damages.</span> </p>
-
-<p><b><span style='font-size:10.0pt'>5. NO WARRANTY</span></b> </p>
-
-<p><span style='font-size:10.0pt'>EXCEPT AS EXPRESSLY SET FORTH IN THIS
-AGREEMENT, THE PROGRAM IS PROVIDED ON AN &quot;AS IS&quot; BASIS, WITHOUT
-WARRANTIES OR CONDITIONS OF ANY KIND, EITHER EXPRESS OR IMPLIED INCLUDING,
-WITHOUT LIMITATION, ANY WARRANTIES OR CONDITIONS OF TITLE, NON-INFRINGEMENT,
-MERCHANTABILITY OR FITNESS FOR A PARTICULAR PURPOSE. Each Recipient is solely
-responsible for determining the appropriateness of using and distributing the
-Program and assumes all risks associated with its exercise of rights under this
-Agreement , including but not limited to the risks and costs of program errors,
-compliance with applicable laws, damage to or loss of data, programs or
-equipment, and unavailability or interruption of operations. </span></p>
-
-<p><b><span style='font-size:10.0pt'>6. DISCLAIMER OF LIABILITY</span></b> </p>
-
-<p><span style='font-size:10.0pt'>EXCEPT AS EXPRESSLY SET FORTH IN THIS
-AGREEMENT, NEITHER RECIPIENT NOR ANY CONTRIBUTORS SHALL HAVE ANY LIABILITY FOR
-ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES
-(INCLUDING WITHOUT LIMITATION LOST PROFITS), HOWEVER CAUSED AND ON ANY THEORY
-OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING
-NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OR DISTRIBUTION OF
-THE PROGRAM OR THE EXERCISE OF ANY RIGHTS GRANTED HEREUNDER, EVEN IF ADVISED OF
-THE POSSIBILITY OF SUCH DAMAGES.</span> </p>
-
-<p><b><span style='font-size:10.0pt'>7. GENERAL</span></b> </p>
-
-<p><span style='font-size:10.0pt'>If any provision of this Agreement is invalid
-or unenforceable under applicable law, it shall not affect the validity or
-enforceability of the remainder of the terms of this Agreement, and without
-further action by the parties hereto, such provision shall be reformed to the
-minimum extent necessary to make such provision valid and enforceable.</span> </p>
-
-<p><span style='font-size:10.0pt'>If Recipient institutes patent litigation
-against any entity (including a cross-claim or counterclaim in a lawsuit)
-alleging that the Program itself (excluding combinations of the Program with
-other software or hardware) infringes such Recipient's patent(s), then such
-Recipient's rights granted under Section 2(b) shall terminate as of the date
-such litigation is filed. </span></p>
-
-<p><span style='font-size:10.0pt'>All Recipient's rights under this Agreement
-shall terminate if it fails to comply with any of the material terms or
-conditions of this Agreement and does not cure such failure in a reasonable
-period of time after becoming aware of such noncompliance. If all Recipient's
-rights under this Agreement terminate, Recipient agrees to cease use and
-distribution of the Program as soon as reasonably practicable. However,
-Recipient's obligations under this Agreement and any licenses granted by
-Recipient relating to the Program shall continue and survive. </span></p>
-
-<p><span style='font-size:10.0pt'>Everyone is permitted to copy and distribute
-copies of this Agreement, but in order to avoid inconsistency the Agreement is
-copyrighted and may only be modified in the following manner. The Agreement
-Steward reserves the right to publish new versions (including revisions) of
-this Agreement from time to time. No one other than the Agreement Steward has
-the right to modify this Agreement. The Eclipse Foundation is the initial
-Agreement Steward. The Eclipse Foundation may assign the responsibility to
-serve as the Agreement Steward to a suitable separate entity. Each new version
-of the Agreement will be given a distinguishing version number. The Program
-(including Contributions) may always be distributed subject to the version of
-the Agreement under which it was received. In addition, after a new version of
-the Agreement is published, Contributor may elect to distribute the Program
-(including its Contributions) under the new version. Except as expressly stated
-in Sections 2(a) and 2(b) above, Recipient receives no rights or licenses to
-the intellectual property of any Contributor under this Agreement, whether
-expressly, by implication, estoppel or otherwise. All rights in the Program not
-expressly granted under this Agreement are reserved.</span> </p>
-
-<p><span style='font-size:10.0pt'>This Agreement is governed by the laws of the
-State of New York and the intellectual property laws of the United States of
-America. No party to this Agreement will bring a legal action under this
-Agreement more than one year after the cause of action arose. Each party waives
-its rights to a jury trial in any resulting litigation.</span> </p>
-
-<p class=MsoNormal><![if !supportEmptyParas]>&nbsp;<![endif]><o:p></o:p></p>
-
-</div>
-
-</body>
-
-</html> \ No newline at end of file
diff --git a/assembly/features/org.eclipse.jpt/feature.properties b/assembly/features/org.eclipse.jpt/feature.properties
deleted file mode 100644
index 4b8dfd72d6..0000000000
--- a/assembly/features/org.eclipse.jpt/feature.properties
+++ /dev/null
@@ -1,144 +0,0 @@
-###############################################################################
-# Copyright (c) 2006 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
-#
-# Contributors:
-# Oracle. - initial API and implementation
-###############################################################################
-# feature.properties
-# contains externalized strings for feature.xml
-# "%foo" in feature.xml corresponds to the key "foo" in this file
-# java.io.Properties file (ISO 8859-1 with "\" escapes)
-# This file should be translated.
-
-# "featureName" property - name of the feature
-featureName=Dali Java Persistence Tools
-
-# "providerName" property - name of the company that provides the feature
-providerName=Eclipse Web Tools Platform Project
-
-# "updateSiteName" property - label for the update site
-updateSiteName=The Eclipse Web Tools Platform (WTP) Project update site
-
-# "description" property - description of the feature
-description=Eclipse Web Tools Platform Project Tools - Runtime
-
-# "copyright" property - text of the "Feature Update Copyright"
-copyright=\
-Copyright (c) 2006-2009 Oracle Corporation.\n\
-All rights reserved. This program and the accompanying materials\n\
-are made available under the terms of the Eclipse Public License v1.0\n\
-which accompanies this distribution, and is available at\n\
-http://www.eclipse.org/legal/epl-v10.html\n\
-\n\
-Contributors:\n\
- Oracle - initial API and implementation\n
-################ end of copyright property ####################################
-
-# "licenseURL" property - URL of the "Feature License"
-# do not translate value - just change to point to a locale-specific HTML page
-licenseURL=license.html
-
-# "license" property - text of the "Feature Update License"
-# should be plain text version of license agreement pointed to be "licenseURL"
-license=\
-ECLIPSE FOUNDATION SOFTWARE USER AGREEMENT\n\
-March 17, 2005\n\
-\n\
-Usage Of Content\n\
-\n\
-THE ECLIPSE FOUNDATION MAKES AVAILABLE SOFTWARE, DOCUMENTATION, INFORMATION AND/OR\n\
-OTHER MATERIALS FOR OPEN SOURCE PROJECTS (COLLECTIVELY "CONTENT").\n\
-USE OF THE CONTENT IS GOVERNED BY THE TERMS AND CONDITIONS OF THIS\n\
-AGREEMENT AND/OR THE TERMS AND CONDITIONS OF LICENSE AGREEMENTS OR\n\
-NOTICES INDICATED OR REFERENCED BELOW. BY USING THE CONTENT, YOU\n\
-AGREE THAT YOUR USE OF THE CONTENT IS GOVERNED BY THIS AGREEMENT\n\
-AND/OR THE TERMS AND CONDITIONS OF ANY APPLICABLE LICENSE AGREEMENTS\n\
-OR NOTICES INDICATED OR REFERENCED BELOW. IF YOU DO NOT AGREE TO THE\n\
-TERMS AND CONDITIONS OF THIS AGREEMENT AND THE TERMS AND CONDITIONS\n\
-OF ANY APPLICABLE LICENSE AGREEMENTS OR NOTICES INDICATED OR REFERENCED\n\
-BELOW, THEN YOU MAY NOT USE THE CONTENT.\n\
-\n\
-Applicable Licenses\n\
-\n\
-Unless otherwise indicated, all Content made available by the Eclipse Foundation\n\
-is provided to you under the terms and conditions of the Eclipse Public\n\
-License Version 1.0 ("EPL"). A copy of the EPL is provided with this\n\
-Content and is also available at http://www.eclipse.org/legal/epl-v10.html.\n\
-For purposes of the EPL, "Program" will mean the Content.\n\
-\n\
-Content includes, but is not limited to, source code, object code,\n\
-documentation and other files maintained in the Eclipse.org CVS\n\
-repository ("Repository") in CVS modules ("Modules") and made available\n\
-as downloadable archives ("Downloads").\n\
-\n\
- - Content may be structured and packaged into modules to facilitate delivering,\n\
- extending, and upgrading the Content. Typical modules may include plug-ins ("Plug-ins"),\n\
- plug-in fragments ("Fragments"), and features ("Features").\n\
- - Each Plug-in or Fragment may be packaged as a sub-directory or JAR (Java? ARchive)\n\
- in a directory named "plugins".\n\
- - A Feature is a bundle of one or more Plug-ins and/or Fragments and associated material.\n\
- Each Feature may be packaged as a sub-directory in a directory named "features".\n\
- Within a Feature, files named "feature.xml" may contain a list of the names and version\n\
- numbers of the Plug-ins and/or Fragments associated with that Feature.\n\
- - Features may also include other Features ("Included Features"). Within a Feature, files\n\
- named "feature.xml" may contain a list of the names and version numbers of Included Features.\n\
-\n\
-Features may also include other Features ("Included Features"). Files named\n\
-"feature.xml" may contain a list of the names and version numbers of\n\
-Included Features.\n\
-\n\
-The terms and conditions governing Plug-ins and Fragments should be\n\
-contained in files named "about.html" ("Abouts"). The terms and\n\
-conditions governing Features and Included Features should be contained\n\
-in files named "license.html" ("Feature Licenses"). Abouts and Feature\n\
-Licenses may be located in any directory of a Download or Module\n\
-including, but not limited to the following locations:\n\
-\n\
- - The top-level (root) directory\n\
- - Plug-in and Fragment directories\n\
- - Inside Plug-ins and Fragments packaged as JARs\n\
- - Sub-directories of the directory named "src" of certain Plug-ins\n\
- - Feature directories\n\
-\n\
-Note: if a Feature made available by the Eclipse Foundation is installed using the\n\
-Eclipse Update Manager, you must agree to a license ("Feature Update\n\
-License") during the installation process. If the Feature contains\n\
-Included Features, the Feature Update License should either provide you\n\
-with the terms and conditions governing the Included Features or inform\n\
-you where you can locate them. Feature Update Licenses may be found in\n\
-the "license" property of files named "feature.properties". Such Abouts,\n\
-Feature Licenses and Feature Update Licenses contain the terms and\n\
-conditions (or references to such terms and conditions) that govern your\n\
-use of the associated Content in that directory.\n\
-\n\
-THE ABOUTS, FEATURE LICENSES AND FEATURE UPDATE LICENSES MAY REFER\n\
-TO THE EPL OR OTHER LICENSE AGREEMENTS, NOTICES OR TERMS AND CONDITIONS.\n\
-SOME OF THESE OTHER LICENSE AGREEMENTS MAY INCLUDE (BUT ARE NOT LIMITED TO):\n\
-\n\
- - Common Public License Version 1.0 (available at http://www.eclipse.org/legal/cpl-v10.html)\n\
- - Apache Software License 1.1 (available at http://www.apache.org/licenses/LICENSE)\n\
- - Apache Software License 2.0 (available at http://www.apache.org/licenses/LICENSE-2.0)\n\
- - IBM Public License 1.0 (available at http://oss.software.ibm.com/developerworks/opensource/license10.html)\n\
- - Metro Link Public License 1.00 (available at http://www.opengroup.org/openmotif/supporters/metrolink/license.html)\n\
- - Mozilla Public License Version 1.1 (available at http://www.mozilla.org/MPL/MPL-1.1.html)\n\
-\n\
-IT IS YOUR OBLIGATION TO READ AND ACCEPT ALL SUCH TERMS AND CONDITIONS PRIOR\n\
-TO USE OF THE CONTENT. If no About, Feature License or Feature Update License\n\
-is provided, please contact the Eclipse Foundation to determine what terms and conditions\n\
-govern that particular Content.\n\
-\n\
-Cryptography\n\
-\n\
-Content may contain encryption software. The country in which you are\n\
-currently may have restrictions on the import, possession, and use,\n\
-and/or re-export to another country, of encryption software. BEFORE\n\
-using any encryption software, please check the country's laws,\n\
-regulations and policies concerning the import, possession, or use,\n\
-and re-export of encryption software, to see if this is permitted.\n\
-\n\
-Java and all Java-based trademarks are trademarks of Sun Microsystems, Inc. in the United States, other countries, or both.\n
-########### end of license property ##########################################
diff --git a/assembly/features/org.eclipse.jpt/feature.xml b/assembly/features/org.eclipse.jpt/feature.xml
deleted file mode 100644
index d33f93fb1b..0000000000
--- a/assembly/features/org.eclipse.jpt/feature.xml
+++ /dev/null
@@ -1,42 +0,0 @@
-<?xml version="1.0" encoding="UTF-8"?>
-<feature
- id="org.eclipse.jpt"
- label="%featureName"
- version="2.1.0.qualifier"
- provider-name="%providerName"
- plugin="org.eclipse.jpt"
- image="eclipse_update_120.jpg">
-
- <description>
- %description
- </description>
-
- <copyright>
- %copyright
- </copyright>
-
- <license url="license.html">
- %license
- </license>
-
- <url>
- <update label="%updateSiteName" url="http://download.eclipse.org/webtools/updates"/>
- <discovery label="Web Tools Platform (WTP) Updates" url="http://download.eclipse.org/webtools/updates"/>
- </url>
-
- <includes
- id="org.eclipse.jpt.feature"
- version="0.0.0"/>
-
- <includes
- id="org.eclipse.jpt.eclipselink.feature"
- version="0.0.0"/>
-
- <plugin
- id="org.eclipse.jpt"
- download-size="0"
- install-size="0"
- version="0.0.0"
- unpack="false"/>
-
-</feature>
diff --git a/assembly/features/org.eclipse.jpt/license.html b/assembly/features/org.eclipse.jpt/license.html
deleted file mode 100644
index 2347060ef3..0000000000
--- a/assembly/features/org.eclipse.jpt/license.html
+++ /dev/null
@@ -1,93 +0,0 @@
-<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN" "http://www.w3c.org/TR/1999/REC-html401-19991224/loose.dtd">
-<!-- saved from url=(0044)http://www.eclipse.org/legal/epl/notice.html -->
-<HTML><HEAD><TITLE>Eclipse.org Software User Agreement</TITLE>
-<META http-equiv=Content-Type content="text/html; charset=iso-8859-1">
-<META content="MSHTML 6.00.2800.1479" name=GENERATOR></HEAD>
-<BODY lang=EN-US vLink=purple link=blue>
-<H2>Eclipse Foundation Software User Agreement</H2>
-<P>January 28, 2005</P>
-<H3>Usage Of Content</H3>
-<P>THE ECLIPSE FOUNDATION MAKES AVAILABLE SOFTWARE, DOCUMENTATION, INFORMATION
-AND/OR OTHER MATERIALS FOR OPEN SOURCE PROJECTS (COLLECTIVELY "CONTENT"). USE OF
-THE CONTENT IS GOVERNED BY THE TERMS AND CONDITIONS OF THIS AGREEMENT AND/OR THE
-TERMS AND CONDITIONS OF LICENSE AGREEMENTS OR NOTICES INDICATED OR REFERENCED
-BELOW. BY USING THE CONTENT, YOU AGREE THAT YOUR USE OF THE CONTENT IS GOVERNED
-BY THIS AGREEMENT AND/OR THE TERMS AND CONDITIONS OF ANY APPLICABLE LICENSE
-AGREEMENTS OR NOTICES INDICATED OR REFERENCED BELOW. IF YOU DO NOT AGREE TO THE
-TERMS AND CONDITIONS OF THIS AGREEMENT AND THE TERMS AND CONDITIONS OF ANY
-APPLICABLE LICENSE AGREEMENTS OR NOTICES INDICATED OR REFERENCED BELOW, THEN YOU
-MAY NOT USE THE CONTENT.</P>
-<H3>Applicable Licenses</H3>
-<P>Unless otherwise indicated, all Content made available by the Eclipse
-Foundation is provided to you under the terms and conditions of the Eclipse
-Public License Version 1.0 ("EPL"). A copy of the EPL is provided with this
-Content and is also available at <A
-href="http://www.eclipse.org/legal/epl-v10.html">http://www.eclipse.org/legal/epl-v10.html</A>.
-For purposes of the EPL, "Program" will mean the Content.</P>
-<P>Content includes, but is not limited to, source code, object code,
-documentation and other files maintained in the Eclipse.org CVS repository
-("Repository") in CVS modules ("Modules") and made available as downloadable
-archives ("Downloads").</P>
-<P>Content may be apportioned into plug-ins ("Plug-ins"), plug-in fragments
-("Fragments"), and features ("Features"). A Feature is a bundle of one or more
-Plug-ins and/or Fragments and associated material. Files named "feature.xml" may
-contain a list of the names and version numbers of the Plug-ins and/or Fragments
-associated with a Feature. Plug-ins and Fragments are located in directories
-named "plugins" and Features are located in directories named "features".</P>
-<P>Features may also include other Features ("Included Features"). Files named
-"feature.xml" may contain a list of the names and version numbers of Included
-Features.</P>
-<P>The terms and conditions governing Plug-ins and Fragments should be contained
-in files named "about.html" ("Abouts"). The terms and conditions governing
-Features and Included Features should be contained in files named "license.html"
-("Feature Licenses"). Abouts and Feature Licenses may be located in any
-directory of a Download or Module including, but not limited to the following
-locations:</P>
-<UL>
- <LI>The top-level (root) directory
- <LI>Plug-in and Fragment directories
- <LI>Subdirectories of the directory named "src" of certain Plug-ins
- <LI>Feature directories </LI></UL>
-<P>Note: if a Feature made available by the Eclipse Foundation is installed
-using the Eclipse Update Manager, you must agree to a license ("Feature Update
-License") during the installation process. If the Feature contains Included
-Features, the Feature Update License should either provide you with the terms
-and conditions governing the Included Features or inform you where you can
-locate them. Feature Update Licenses may be found in the "license" property of
-files named "feature.properties". Such Abouts, Feature Licenses and Feature
-Update Licenses contain the terms and conditions (or references to such terms
-and conditions) that govern your use of the associated Content in that
-directory.</P>
-<P>THE ABOUTS, FEATURE LICENSES AND FEATURE UPDATE LICENSES MAY REFER TO THE EPL
-OR OTHER LICENSE AGREEMENTS, NOTICES OR TERMS AND CONDITIONS. SOME OF THESE
-OTHER LICENSE AGREEMENTS MAY INCLUDE (BUT ARE NOT LIMITED TO):</P>
-<UL>
- <LI>Common Public License Version 1.0 (available at <A
- href="http://www.eclipse.org/legal/cpl-v10.html">http://www.eclipse.org/legal/cpl-v10.html</A>)
-
- <LI>Apache Software License 1.1 (available at <A
- href="http://www.apache.org/licenses/LICENSE">http://www.apache.org/licenses/LICENSE</A>)
-
- <LI>Apache Software License 2.0 (available at <A
- href="http://www.apache.org/licenses/LICENSE-2.0">http://www.apache.org/licenses/LICENSE-2.0</A>)
-
- <LI>IBM Public License 1.0 (available at <A
- href="http://oss.software.ibm.com/developerworks/opensource/license10.html">http://oss.software.ibm.com/developerworks/opensource/license10.html</A>)
-
- <LI>Metro Link Public License 1.00 (available at <A
- href="http://www.opengroup.org/openmotif/supporters/metrolink/license.html">http://www.opengroup.org/openmotif/supporters/metrolink/license.html</A>)
-
- <LI>Mozilla Public License Version 1.1 (available at <A
- href="http://www.mozilla.org/MPL/MPL-1.1.html">http://www.mozilla.org/MPL/MPL-1.1.html</A>)
- </LI></UL>
-<P>IT IS YOUR OBLIGATION TO READ AND ACCEPT ALL SUCH TERMS AND CONDITIONS PRIOR
-TO USE OF THE CONTENT. If no About, Feature License or Feature Update License is
-provided, please contact the Eclipse Foundation to determine what terms and
-conditions govern that particular Content.</P>
-<H3>Cryptography</H3>
-<P>Content may contain encryption software. The country in which you are
-currently may have restrictions on the import, possession, and use, and/or
-re-export to another country, of encryption software. BEFORE using any
-encryption software, please check the country's laws, regulations and policies
-concerning the import, possession, or use, and re-export of encryption software,
-to see if this is permitted.</P></BODY></HTML>
diff --git a/assembly/features/org.eclipse.jpt_sdk.assembly.feature/.cvsignore b/assembly/features/org.eclipse.jpt_sdk.assembly.feature/.cvsignore
deleted file mode 100644
index bc2abf75c1..0000000000
--- a/assembly/features/org.eclipse.jpt_sdk.assembly.feature/.cvsignore
+++ /dev/null
@@ -1,4 +0,0 @@
-*.bin.dist.zip
-build.xml
-features
-plugins
diff --git a/assembly/features/org.eclipse.jpt_sdk.assembly.feature/.project b/assembly/features/org.eclipse.jpt_sdk.assembly.feature/.project
deleted file mode 100644
index e901372085..0000000000
--- a/assembly/features/org.eclipse.jpt_sdk.assembly.feature/.project
+++ /dev/null
@@ -1,17 +0,0 @@
-<?xml version="1.0" encoding="UTF-8"?>
-<projectDescription>
- <name>org.eclipse.jpt_sdk.assembly.feature</name>
- <comment></comment>
- <projects>
- </projects>
- <buildSpec>
- <buildCommand>
- <name>org.eclipse.pde.FeatureBuilder</name>
- <arguments>
- </arguments>
- </buildCommand>
- </buildSpec>
- <natures>
- <nature>org.eclipse.pde.FeatureNature</nature>
- </natures>
-</projectDescription>
diff --git a/assembly/features/org.eclipse.jpt_sdk.assembly.feature/build.properties b/assembly/features/org.eclipse.jpt_sdk.assembly.feature/build.properties
deleted file mode 100644
index 7200939aca..0000000000
--- a/assembly/features/org.eclipse.jpt_sdk.assembly.feature/build.properties
+++ /dev/null
@@ -1,15 +0,0 @@
-###############################################################################
-# Copyright (c) 2006 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
-#
-# Contributors:
-# Oracle. - initial API and implementation
-###############################################################################
-bin.includes = feature.xml,\
- eclipse_update_120.jpg,\
- epl-v10.html,\
- license.html,\
- feature.properties
diff --git a/assembly/features/org.eclipse.jpt_sdk.assembly.feature/eclipse_update_120.jpg b/assembly/features/org.eclipse.jpt_sdk.assembly.feature/eclipse_update_120.jpg
deleted file mode 100644
index bfdf708ad6..0000000000
--- a/assembly/features/org.eclipse.jpt_sdk.assembly.feature/eclipse_update_120.jpg
+++ /dev/null
Binary files differ
diff --git a/assembly/features/org.eclipse.jpt_sdk.assembly.feature/epl-v10.html b/assembly/features/org.eclipse.jpt_sdk.assembly.feature/epl-v10.html
deleted file mode 100644
index ed4b196655..0000000000
--- a/assembly/features/org.eclipse.jpt_sdk.assembly.feature/epl-v10.html
+++ /dev/null
@@ -1,328 +0,0 @@
-<html xmlns:o="urn:schemas-microsoft-com:office:office"
-xmlns:w="urn:schemas-microsoft-com:office:word"
-xmlns="http://www.w3.org/TR/REC-html40">
-
-<head>
-<meta http-equiv=Content-Type content="text/html; charset=windows-1252">
-<meta name=ProgId content=Word.Document>
-<meta name=Generator content="Microsoft Word 9">
-<meta name=Originator content="Microsoft Word 9">
-<link rel=File-List
-href="./Eclipse%20EPL%202003_11_10%20Final_files/filelist.xml">
-<title>Eclipse Public License - Version 1.0</title>
-<!--[if gte mso 9]><xml>
- <o:DocumentProperties>
- <o:Revision>2</o:Revision>
- <o:TotalTime>3</o:TotalTime>
- <o:Created>2004-03-05T23:03:00Z</o:Created>
- <o:LastSaved>2004-03-05T23:03:00Z</o:LastSaved>
- <o:Pages>4</o:Pages>
- <o:Words>1626</o:Words>
- <o:Characters>9270</o:Characters>
- <o:Lines>77</o:Lines>
- <o:Paragraphs>18</o:Paragraphs>
- <o:CharactersWithSpaces>11384</o:CharactersWithSpaces>
- <o:Version>9.4402</o:Version>
- </o:DocumentProperties>
-</xml><![endif]--><!--[if gte mso 9]><xml>
- <w:WordDocument>
- <w:TrackRevisions/>
- </w:WordDocument>
-</xml><![endif]-->
-<style>
-<!--
- /* Font Definitions */
-@font-face
- {font-family:Tahoma;
- panose-1:2 11 6 4 3 5 4 4 2 4;
- mso-font-charset:0;
- mso-generic-font-family:swiss;
- mso-font-pitch:variable;
- mso-font-signature:553679495 -2147483648 8 0 66047 0;}
- /* Style Definitions */
-p.MsoNormal, li.MsoNormal, div.MsoNormal
- {mso-style-parent:"";
- margin:0in;
- margin-bottom:.0001pt;
- mso-pagination:widow-orphan;
- font-size:12.0pt;
- font-family:"Times New Roman";
- mso-fareast-font-family:"Times New Roman";}
-p
- {margin-right:0in;
- mso-margin-top-alt:auto;
- mso-margin-bottom-alt:auto;
- margin-left:0in;
- mso-pagination:widow-orphan;
- font-size:12.0pt;
- font-family:"Times New Roman";
- mso-fareast-font-family:"Times New Roman";}
-p.BalloonText, li.BalloonText, div.BalloonText
- {mso-style-name:"Balloon Text";
- margin:0in;
- margin-bottom:.0001pt;
- mso-pagination:widow-orphan;
- font-size:8.0pt;
- font-family:Tahoma;
- mso-fareast-font-family:"Times New Roman";}
-@page Section1
- {size:8.5in 11.0in;
- margin:1.0in 1.25in 1.0in 1.25in;
- mso-header-margin:.5in;
- mso-footer-margin:.5in;
- mso-paper-source:0;}
-div.Section1
- {page:Section1;}
--->
-</style>
-</head>
-
-<body lang=EN-US style='tab-interval:.5in'>
-
-<div class=Section1>
-
-<p align=center style='text-align:center'><b>Eclipse Public License - v 1.0</b>
-</p>
-
-<p><span style='font-size:10.0pt'>THE ACCOMPANYING PROGRAM IS PROVIDED UNDER
-THE TERMS OF THIS ECLIPSE PUBLIC LICENSE (&quot;AGREEMENT&quot;). ANY USE,
-REPRODUCTION OR DISTRIBUTION OF THE PROGRAM CONSTITUTES RECIPIENT'S ACCEPTANCE
-OF THIS AGREEMENT.</span> </p>
-
-<p><b><span style='font-size:10.0pt'>1. DEFINITIONS</span></b> </p>
-
-<p><span style='font-size:10.0pt'>&quot;Contribution&quot; means:</span> </p>
-
-<p class=MsoNormal style='margin-left:.5in'><span style='font-size:10.0pt'>a)
-in the case of the initial Contributor, the initial code and documentation
-distributed under this Agreement, and<br clear=left>
-b) in the case of each subsequent Contributor:</span></p>
-
-<p class=MsoNormal style='margin-left:.5in'><span style='font-size:10.0pt'>i)
-changes to the Program, and</span></p>
-
-<p class=MsoNormal style='margin-left:.5in'><span style='font-size:10.0pt'>ii)
-additions to the Program;</span></p>
-
-<p class=MsoNormal style='margin-left:.5in'><span style='font-size:10.0pt'>where
-such changes and/or additions to the Program originate from and are distributed
-by that particular Contributor. A Contribution 'originates' from a Contributor
-if it was added to the Program by such Contributor itself or anyone acting on
-such Contributor's behalf. Contributions do not include additions to the
-Program which: (i) are separate modules of software distributed in conjunction
-with the Program under their own license agreement, and (ii) are not derivative
-works of the Program. </span></p>
-
-<p><span style='font-size:10.0pt'>&quot;Contributor&quot; means any person or
-entity that distributes the Program.</span> </p>
-
-<p><span style='font-size:10.0pt'>&quot;Licensed Patents &quot; mean patent
-claims licensable by a Contributor which are necessarily infringed by the use
-or sale of its Contribution alone or when combined with the Program. </span></p>
-
-<p><span style='font-size:10.0pt'>&quot;Program&quot; means the Contributions
-distributed in accordance with this Agreement.</span> </p>
-
-<p><span style='font-size:10.0pt'>&quot;Recipient&quot; means anyone who
-receives the Program under this Agreement, including all Contributors.</span> </p>
-
-<p><b><span style='font-size:10.0pt'>2. GRANT OF RIGHTS</span></b> </p>
-
-<p class=MsoNormal style='margin-left:.5in'><span style='font-size:10.0pt'>a)
-Subject to the terms of this Agreement, each Contributor hereby grants Recipient
-a non-exclusive, worldwide, royalty-free copyright license to<span
-style='color:red'> </span>reproduce, prepare derivative works of, publicly
-display, publicly perform, distribute and sublicense the Contribution of such
-Contributor, if any, and such derivative works, in source code and object code
-form.</span></p>
-
-<p class=MsoNormal style='margin-left:.5in'><span style='font-size:10.0pt'>b)
-Subject to the terms of this Agreement, each Contributor hereby grants
-Recipient a non-exclusive, worldwide,<span style='color:green'> </span>royalty-free
-patent license under Licensed Patents to make, use, sell, offer to sell, import
-and otherwise transfer the Contribution of such Contributor, if any, in source
-code and object code form. This patent license shall apply to the combination
-of the Contribution and the Program if, at the time the Contribution is added
-by the Contributor, such addition of the Contribution causes such combination
-to be covered by the Licensed Patents. The patent license shall not apply to
-any other combinations which include the Contribution. No hardware per se is
-licensed hereunder. </span></p>
-
-<p class=MsoNormal style='margin-left:.5in'><span style='font-size:10.0pt'>c)
-Recipient understands that although each Contributor grants the licenses to its
-Contributions set forth herein, no assurances are provided by any Contributor
-that the Program does not infringe the patent or other intellectual property
-rights of any other entity. Each Contributor disclaims any liability to Recipient
-for claims brought by any other entity based on infringement of intellectual
-property rights or otherwise. As a condition to exercising the rights and
-licenses granted hereunder, each Recipient hereby assumes sole responsibility
-to secure any other intellectual property rights needed, if any. For example,
-if a third party patent license is required to allow Recipient to distribute
-the Program, it is Recipient's responsibility to acquire that license before
-distributing the Program.</span></p>
-
-<p class=MsoNormal style='margin-left:.5in'><span style='font-size:10.0pt'>d)
-Each Contributor represents that to its knowledge it has sufficient copyright
-rights in its Contribution, if any, to grant the copyright license set forth in
-this Agreement. </span></p>
-
-<p><b><span style='font-size:10.0pt'>3. REQUIREMENTS</span></b> </p>
-
-<p><span style='font-size:10.0pt'>A Contributor may choose to distribute the
-Program in object code form under its own license agreement, provided that:</span>
-</p>
-
-<p class=MsoNormal style='margin-left:.5in'><span style='font-size:10.0pt'>a)
-it complies with the terms and conditions of this Agreement; and</span></p>
-
-<p class=MsoNormal style='margin-left:.5in'><span style='font-size:10.0pt'>b)
-its license agreement:</span></p>
-
-<p class=MsoNormal style='margin-left:.5in'><span style='font-size:10.0pt'>i)
-effectively disclaims on behalf of all Contributors all warranties and
-conditions, express and implied, including warranties or conditions of title
-and non-infringement, and implied warranties or conditions of merchantability
-and fitness for a particular purpose; </span></p>
-
-<p class=MsoNormal style='margin-left:.5in'><span style='font-size:10.0pt'>ii)
-effectively excludes on behalf of all Contributors all liability for damages,
-including direct, indirect, special, incidental and consequential damages, such
-as lost profits; </span></p>
-
-<p class=MsoNormal style='margin-left:.5in'><span style='font-size:10.0pt'>iii)
-states that any provisions which differ from this Agreement are offered by that
-Contributor alone and not by any other party; and</span></p>
-
-<p class=MsoNormal style='margin-left:.5in'><span style='font-size:10.0pt'>iv)
-states that source code for the Program is available from such Contributor, and
-informs licensees how to obtain it in a reasonable manner on or through a
-medium customarily used for software exchange.<span style='color:blue'> </span></span></p>
-
-<p><span style='font-size:10.0pt'>When the Program is made available in source
-code form:</span> </p>
-
-<p class=MsoNormal style='margin-left:.5in'><span style='font-size:10.0pt'>a)
-it must be made available under this Agreement; and </span></p>
-
-<p class=MsoNormal style='margin-left:.5in'><span style='font-size:10.0pt'>b) a
-copy of this Agreement must be included with each copy of the Program. </span></p>
-
-<p><span style='font-size:10.0pt'>Contributors may not remove or alter any
-copyright notices contained within the Program. </span></p>
-
-<p><span style='font-size:10.0pt'>Each Contributor must identify itself as the
-originator of its Contribution, if any, in a manner that reasonably allows
-subsequent Recipients to identify the originator of the Contribution. </span></p>
-
-<p><b><span style='font-size:10.0pt'>4. COMMERCIAL DISTRIBUTION</span></b> </p>
-
-<p><span style='font-size:10.0pt'>Commercial distributors of software may
-accept certain responsibilities with respect to end users, business partners
-and the like. While this license is intended to facilitate the commercial use
-of the Program, the Contributor who includes the Program in a commercial
-product offering should do so in a manner which does not create potential
-liability for other Contributors. Therefore, if a Contributor includes the
-Program in a commercial product offering, such Contributor (&quot;Commercial
-Contributor&quot;) hereby agrees to defend and indemnify every other
-Contributor (&quot;Indemnified Contributor&quot;) against any losses, damages and
-costs (collectively &quot;Losses&quot;) arising from claims, lawsuits and other
-legal actions brought by a third party against the Indemnified Contributor to
-the extent caused by the acts or omissions of such Commercial Contributor in
-connection with its distribution of the Program in a commercial product
-offering. The obligations in this section do not apply to any claims or Losses
-relating to any actual or alleged intellectual property infringement. In order
-to qualify, an Indemnified Contributor must: a) promptly notify the Commercial
-Contributor in writing of such claim, and b) allow the Commercial Contributor
-to control, and cooperate with the Commercial Contributor in, the defense and
-any related settlement negotiations. The Indemnified Contributor may participate
-in any such claim at its own expense.</span> </p>
-
-<p><span style='font-size:10.0pt'>For example, a Contributor might include the
-Program in a commercial product offering, Product X. That Contributor is then a
-Commercial Contributor. If that Commercial Contributor then makes performance
-claims, or offers warranties related to Product X, those performance claims and
-warranties are such Commercial Contributor's responsibility alone. Under this
-section, the Commercial Contributor would have to defend claims against the
-other Contributors related to those performance claims and warranties, and if a
-court requires any other Contributor to pay any damages as a result, the
-Commercial Contributor must pay those damages.</span> </p>
-
-<p><b><span style='font-size:10.0pt'>5. NO WARRANTY</span></b> </p>
-
-<p><span style='font-size:10.0pt'>EXCEPT AS EXPRESSLY SET FORTH IN THIS
-AGREEMENT, THE PROGRAM IS PROVIDED ON AN &quot;AS IS&quot; BASIS, WITHOUT
-WARRANTIES OR CONDITIONS OF ANY KIND, EITHER EXPRESS OR IMPLIED INCLUDING,
-WITHOUT LIMITATION, ANY WARRANTIES OR CONDITIONS OF TITLE, NON-INFRINGEMENT,
-MERCHANTABILITY OR FITNESS FOR A PARTICULAR PURPOSE. Each Recipient is solely
-responsible for determining the appropriateness of using and distributing the
-Program and assumes all risks associated with its exercise of rights under this
-Agreement , including but not limited to the risks and costs of program errors,
-compliance with applicable laws, damage to or loss of data, programs or
-equipment, and unavailability or interruption of operations. </span></p>
-
-<p><b><span style='font-size:10.0pt'>6. DISCLAIMER OF LIABILITY</span></b> </p>
-
-<p><span style='font-size:10.0pt'>EXCEPT AS EXPRESSLY SET FORTH IN THIS
-AGREEMENT, NEITHER RECIPIENT NOR ANY CONTRIBUTORS SHALL HAVE ANY LIABILITY FOR
-ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES
-(INCLUDING WITHOUT LIMITATION LOST PROFITS), HOWEVER CAUSED AND ON ANY THEORY
-OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING
-NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OR DISTRIBUTION OF
-THE PROGRAM OR THE EXERCISE OF ANY RIGHTS GRANTED HEREUNDER, EVEN IF ADVISED OF
-THE POSSIBILITY OF SUCH DAMAGES.</span> </p>
-
-<p><b><span style='font-size:10.0pt'>7. GENERAL</span></b> </p>
-
-<p><span style='font-size:10.0pt'>If any provision of this Agreement is invalid
-or unenforceable under applicable law, it shall not affect the validity or
-enforceability of the remainder of the terms of this Agreement, and without
-further action by the parties hereto, such provision shall be reformed to the
-minimum extent necessary to make such provision valid and enforceable.</span> </p>
-
-<p><span style='font-size:10.0pt'>If Recipient institutes patent litigation
-against any entity (including a cross-claim or counterclaim in a lawsuit)
-alleging that the Program itself (excluding combinations of the Program with
-other software or hardware) infringes such Recipient's patent(s), then such
-Recipient's rights granted under Section 2(b) shall terminate as of the date
-such litigation is filed. </span></p>
-
-<p><span style='font-size:10.0pt'>All Recipient's rights under this Agreement
-shall terminate if it fails to comply with any of the material terms or
-conditions of this Agreement and does not cure such failure in a reasonable
-period of time after becoming aware of such noncompliance. If all Recipient's
-rights under this Agreement terminate, Recipient agrees to cease use and
-distribution of the Program as soon as reasonably practicable. However,
-Recipient's obligations under this Agreement and any licenses granted by
-Recipient relating to the Program shall continue and survive. </span></p>
-
-<p><span style='font-size:10.0pt'>Everyone is permitted to copy and distribute
-copies of this Agreement, but in order to avoid inconsistency the Agreement is
-copyrighted and may only be modified in the following manner. The Agreement
-Steward reserves the right to publish new versions (including revisions) of
-this Agreement from time to time. No one other than the Agreement Steward has
-the right to modify this Agreement. The Eclipse Foundation is the initial
-Agreement Steward. The Eclipse Foundation may assign the responsibility to
-serve as the Agreement Steward to a suitable separate entity. Each new version
-of the Agreement will be given a distinguishing version number. The Program
-(including Contributions) may always be distributed subject to the version of
-the Agreement under which it was received. In addition, after a new version of
-the Agreement is published, Contributor may elect to distribute the Program
-(including its Contributions) under the new version. Except as expressly stated
-in Sections 2(a) and 2(b) above, Recipient receives no rights or licenses to
-the intellectual property of any Contributor under this Agreement, whether
-expressly, by implication, estoppel or otherwise. All rights in the Program not
-expressly granted under this Agreement are reserved.</span> </p>
-
-<p><span style='font-size:10.0pt'>This Agreement is governed by the laws of the
-State of New York and the intellectual property laws of the United States of
-America. No party to this Agreement will bring a legal action under this
-Agreement more than one year after the cause of action arose. Each party waives
-its rights to a jury trial in any resulting litigation.</span> </p>
-
-<p class=MsoNormal><![if !supportEmptyParas]>&nbsp;<![endif]><o:p></o:p></p>
-
-</div>
-
-</body>
-
-</html> \ No newline at end of file
diff --git a/assembly/features/org.eclipse.jpt_sdk.assembly.feature/feature.properties b/assembly/features/org.eclipse.jpt_sdk.assembly.feature/feature.properties
deleted file mode 100644
index 1f4dd698f5..0000000000
--- a/assembly/features/org.eclipse.jpt_sdk.assembly.feature/feature.properties
+++ /dev/null
@@ -1,145 +0,0 @@
-###############################################################################
-# Copyright (c) 2006 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
-#
-# Contributors:
-# Oracle. - initial API and implementation
-###############################################################################
-# feature.properties
-# contains externalized strings for feature.xml
-# "%foo" in feature.xml corresponds to the key "foo" in this file
-# java.io.Properties file (ISO 8859-1 with "\" escapes)
-# This file should be translated.
-
-# "featureName" property - name of the feature
-featureName=Dali Java Persistence Tools SDK
-
-# "providerName" property - name of the company that provides the feature
-providerName=Eclipse Web Tools Platform
-
-# "updateSiteName" property - label for the update site
-updateSiteName=The Eclipse Web Tools Platform (WTP) Project update site
-
-# "description" property - description of the feature
-description=Dali Java Persistence Tools project SDK
-
-# "copyright" property - text of the "Feature Update Copyright"
-copyright=\
-Copyright (c) 2006 Oracle Corporation.\n\
-All rights reserved. This program and the accompanying materials\n\
-are made available under the terms of the Eclipse Public License v1.0\n\
-which accompanies this distribution, and is available at\n\
-http://www.eclipse.org/legal/epl-v10.html\n\
-\n\
-Contributors:\n\
- Oracle - initial API and implementation\n
-################ end of copyright property ####################################
-
-# "licenseURL" property - URL of the "Feature License"
-# do not translate value - just change to point to a locale-specific HTML page
-licenseURL=license.html
-
-# "license" property - text of the "Feature Update License"
-# should be plain text version of license agreement pointed to be "licenseURL"
-license=\
-ECLIPSE FOUNDATION SOFTWARE USER AGREEMENT\n\
-June 06, 2007\n\
-\n\
-Usage Of Content\n\
-\n\
-THE ECLIPSE FOUNDATION MAKES AVAILABLE SOFTWARE, DOCUMENTATION, INFORMATION AND/OR\n\
-OTHER MATERIALS FOR OPEN SOURCE PROJECTS (COLLECTIVELY "CONTENT").\n\
-USE OF THE CONTENT IS GOVERNED BY THE TERMS AND CONDITIONS OF THIS\n\
-AGREEMENT AND/OR THE TERMS AND CONDITIONS OF LICENSE AGREEMENTS OR\n\
-NOTICES INDICATED OR REFERENCED BELOW. BY USING THE CONTENT, YOU\n\
-AGREE THAT YOUR USE OF THE CONTENT IS GOVERNED BY THIS AGREEMENT\n\
-AND/OR THE TERMS AND CONDITIONS OF ANY APPLICABLE LICENSE AGREEMENTS\n\
-OR NOTICES INDICATED OR REFERENCED BELOW. IF YOU DO NOT AGREE TO THE\n\
-TERMS AND CONDITIONS OF THIS AGREEMENT AND THE TERMS AND CONDITIONS\n\
-OF ANY APPLICABLE LICENSE AGREEMENTS OR NOTICES INDICATED OR REFERENCED\n\
-BELOW, THEN YOU MAY NOT USE THE CONTENT.\n\
-\n\
-Applicable Licenses\n\
-\n\
-Unless otherwise indicated, all Content made available by the Eclipse Foundation\n\
-is provided to you under the terms and conditions of the Eclipse Public\n\
-License Version 1.0 ("EPL"). A copy of the EPL is provided with this\n\
-Content and is also available at http://www.eclipse.org/legal/epl-v10.html.\n\
-For purposes of the EPL, "Program" will mean the Content.\n\
-\n\
-Content includes, but is not limited to, source code, object code,\n\
-documentation and other files maintained in the Eclipse.org CVS\n\
-repository ("Repository") in CVS modules ("Modules") and made available\n\
-as downloadable archives ("Downloads").\n\
-\n\
- - Content may be structured and packaged into modules to facilitate delivering,\n\
- extending, and upgrading the Content. Typical modules may include plug-ins ("Plug-ins"),\n\
- plug-in fragments ("Fragments"), and features ("Features").\n\
- - Each Plug-in or Fragment may be packaged as a sub-directory or JAR (Java? ARchive)\n\
- in a directory named "plugins".\n\
- - A Feature is a bundle of one or more Plug-ins and/or Fragments and associated material.\n\
- Each Feature may be packaged as a sub-directory in a directory named "features".\n\
- Within a Feature, files named "feature.xml" may contain a list of the names and version\n\
- numbers of the Plug-ins and/or Fragments associated with that Feature.\n\
- - Features may also include other Features ("Included Features"). Within a Feature, files\n\
- named "feature.xml" may contain a list of the names and version numbers of Included Features.\n\
-\n\
-Features may also include other Features ("Included Features"). Files named\n\
-"feature.xml" may contain a list of the names and version numbers of\n\
-Included Features.\n\
-\n\
-The terms and conditions governing Plug-ins and Fragments should be\n\
-contained in files named "about.html" ("Abouts"). The terms and\n\
-conditions governing Features and Included Features should be contained\n\
-in files named "license.html" ("Feature Licenses"). Abouts and Feature\n\
-Licenses may be located in any directory of a Download or Module\n\
-including, but not limited to the following locations:\n\
-\n\
- - The top-level (root) directory\n\
- - Plug-in and Fragment directories\n\
- - Inside Plug-ins and Fragments packaged as JARs\n\
- - Sub-directories of the directory named "src" of certain Plug-ins\n\
- - Feature directories\n\
-\n\
-Note: if a Feature made available by the Eclipse Foundation is installed using the\n\
-Eclipse Update Manager, you must agree to a license ("Feature Update\n\
-License") during the installation process. If the Feature contains\n\
-Included Features, the Feature Update License should either provide you\n\
-with the terms and conditions governing the Included Features or inform\n\
-you where you can locate them. Feature Update Licenses may be found in\n\
-the "license" property of files named "feature.properties". Such Abouts,\n\
-Feature Licenses and Feature Update Licenses contain the terms and\n\
-conditions (or references to such terms and conditions) that govern your\n\
-use of the associated Content in that directory.\n\
-\n\
-THE ABOUTS, FEATURE LICENSES AND FEATURE UPDATE LICENSES MAY REFER\n\
-TO THE EPL OR OTHER LICENSE AGREEMENTS, NOTICES OR TERMS AND CONDITIONS.\n\
-SOME OF THESE OTHER LICENSE AGREEMENTS MAY INCLUDE (BUT ARE NOT LIMITED TO):\n\
-\n\
- - Common Public License Version 1.0 (available at http://www.eclipse.org/legal/cpl-v10.html)\n\
- - Apache Software License 1.1 (available at http://www.apache.org/licenses/LICENSE)\n\
- - Apache Software License 2.0 (available at http://www.apache.org/licenses/LICENSE-2.0)\n\
- - IBM Public License 1.0 (available at http://oss.software.ibm.com/developerworks/opensource/license10.html)\n\
- - Metro Link Public License 1.00 (available at http://www.opengroup.org/openmotif/supporters/metrolink/license.html)\n\
- - Mozilla Public License Version 1.1 (available at http://www.mozilla.org/MPL/MPL-1.1.html)\n\
- - Common Development and Distribution License (CDDL) Version 1.0 (available at http://www.sun.com/cddl/cddl.html)\n\
-\n\
-IT IS YOUR OBLIGATION TO READ AND ACCEPT ALL SUCH TERMS AND CONDITIONS PRIOR\n\
-TO USE OF THE CONTENT. If no About, Feature License or Feature Update License\n\
-is provided, please contact the Eclipse Foundation to determine what terms and conditions\n\
-govern that particular Content.\n\
-\n\
-Cryptography\n\
-\n\
-Content may contain encryption software. The country in which you are\n\
-currently may have restrictions on the import, possession, and use,\n\
-and/or re-export to another country, of encryption software. BEFORE\n\
-using any encryption software, please check the country's laws,\n\
-regulations and policies concerning the import, possession, or use,\n\
-and re-export of encryption software, to see if this is permitted.\n\
-\n\
-Java and all Java-based trademarks are trademarks of Sun Microsystems, Inc. in the United States, other countries, or both.\n
-########### end of license property ##########################################
diff --git a/assembly/features/org.eclipse.jpt_sdk.assembly.feature/feature.xml b/assembly/features/org.eclipse.jpt_sdk.assembly.feature/feature.xml
deleted file mode 100644
index a83e3728ab..0000000000
--- a/assembly/features/org.eclipse.jpt_sdk.assembly.feature/feature.xml
+++ /dev/null
@@ -1,34 +0,0 @@
-<?xml version="1.0" encoding="UTF-8"?>
-<feature
- id="org.eclipse.jpt_sdk.assembly.feature"
- label="%featureName"
- version="2.2.0.qualifier"
- provider-name="%providerName"
- image="eclipse_update_120.jpg">
-
- <description>
- %description
- </description>
-
- <copyright>
- %copyright
- </copyright>
-
- <license url="license.html">
- %license
- </license>
-
- <url>
- <update label="%updateSiteName" url="http://download.eclipse.org/webtools/updates"/>
- <discovery label="Web Tools Platform (WTP) Updates" url="http://download.eclipse.org/webtools/updates"/>
- </url>
-
- <includes
- id="org.eclipse.jpt_sdk.feature"
- version="0.0.0"/>
-
- <includes
- id="org.eclipse.jpt.eclipselink_sdk.feature"
- version="0.0.0"/>
-
-</feature>
diff --git a/assembly/features/org.eclipse.jpt_sdk.assembly.feature/license.html b/assembly/features/org.eclipse.jpt_sdk.assembly.feature/license.html
deleted file mode 100644
index 76abfb4621..0000000000
--- a/assembly/features/org.eclipse.jpt_sdk.assembly.feature/license.html
+++ /dev/null
@@ -1,98 +0,0 @@
-<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN" "http://www.w3c.org/TR/1999/REC-html401-19991224/loose.dtd">
-<!-- saved from url=(0044)http://www.eclipse.org/legal/epl/notice.html -->
-<HTML><HEAD><TITLE>Eclipse.org Software User Agreement</TITLE>
-<META http-equiv=Content-Type content="text/html; charset=iso-8859-1">
-<META content="MSHTML 6.00.2800.1479" name=GENERATOR></HEAD>
-<BODY lang=EN-US vLink=purple link=blue>
-<H2>Eclipse Foundation Software User Agreement</H2>
-<P>June 06, 2007</P>
-<H3>Usage Of Content</H3>
-<P>THE ECLIPSE FOUNDATION MAKES AVAILABLE SOFTWARE, DOCUMENTATION, INFORMATION
-AND/OR OTHER MATERIALS FOR OPEN SOURCE PROJECTS (COLLECTIVELY "CONTENT"). USE OF
-THE CONTENT IS GOVERNED BY THE TERMS AND CONDITIONS OF THIS AGREEMENT AND/OR THE
-TERMS AND CONDITIONS OF LICENSE AGREEMENTS OR NOTICES INDICATED OR REFERENCED
-BELOW. BY USING THE CONTENT, YOU AGREE THAT YOUR USE OF THE CONTENT IS GOVERNED
-BY THIS AGREEMENT AND/OR THE TERMS AND CONDITIONS OF ANY APPLICABLE LICENSE
-AGREEMENTS OR NOTICES INDICATED OR REFERENCED BELOW. IF YOU DO NOT AGREE TO THE
-TERMS AND CONDITIONS OF THIS AGREEMENT AND THE TERMS AND CONDITIONS OF ANY
-APPLICABLE LICENSE AGREEMENTS OR NOTICES INDICATED OR REFERENCED BELOW, THEN YOU
-MAY NOT USE THE CONTENT.</P>
-<H3>Applicable Licenses</H3>
-<P>Unless otherwise indicated, all Content made available by the Eclipse
-Foundation is provided to you under the terms and conditions of the Eclipse
-Public License Version 1.0 ("EPL"). A copy of the EPL is provided with this
-Content and is also available at <A
-href="http://www.eclipse.org/legal/epl-v10.html">http://www.eclipse.org/legal/epl-v10.html</A>.
-For purposes of the EPL, "Program" will mean the Content.</P>
-<P>Content includes, but is not limited to, source code, object code,
-documentation and other files maintained in the Eclipse.org CVS repository
-("Repository") in CVS modules ("Modules") and made available as downloadable
-archives ("Downloads").</P>
-<P>Content may be apportioned into plug-ins ("Plug-ins"), plug-in fragments
-("Fragments"), and features ("Features"). A Feature is a bundle of one or more
-Plug-ins and/or Fragments and associated material. Files named "feature.xml" may
-contain a list of the names and version numbers of the Plug-ins and/or Fragments
-associated with a Feature. Plug-ins and Fragments are located in directories
-named "plugins" and Features are located in directories named "features".</P>
-<P>Features may also include other Features ("Included Features"). Files named
-"feature.xml" may contain a list of the names and version numbers of Included
-Features.</P>
-<P>The terms and conditions governing Plug-ins and Fragments should be contained
-in files named "about.html" ("Abouts"). The terms and conditions governing
-Features and Included Features should be contained in files named "license.html"
-("Feature Licenses"). Abouts and Feature Licenses may be located in any
-directory of a Download or Module including, but not limited to the following
-locations:</P>
-<UL>
- <LI>The top-level (root) directory
- <LI>Plug-in and Fragment directories
- <LI>Subdirectories of the directory named "src" of certain Plug-ins
- <LI>Feature directories </LI></UL>
-<P>Note: if a Feature made available by the Eclipse Foundation is installed
-using the Eclipse Update Manager, you must agree to a license ("Feature Update
-License") during the installation process. If the Feature contains Included
-Features, the Feature Update License should either provide you with the terms
-and conditions governing the Included Features or inform you where you can
-locate them. Feature Update Licenses may be found in the "license" property of
-files named "feature.properties". Such Abouts, Feature Licenses and Feature
-Update Licenses contain the terms and conditions (or references to such terms
-and conditions) that govern your use of the associated Content in that
-directory.</P>
-<P>THE ABOUTS, FEATURE LICENSES AND FEATURE UPDATE LICENSES MAY REFER TO THE EPL
-OR OTHER LICENSE AGREEMENTS, NOTICES OR TERMS AND CONDITIONS. SOME OF THESE
-OTHER LICENSE AGREEMENTS MAY INCLUDE (BUT ARE NOT LIMITED TO):</P>
-<UL>
- <LI>Common Public License Version 1.0 (available at <A
- href="http://www.eclipse.org/legal/cpl-v10.html">http://www.eclipse.org/legal/cpl-v10.html</A>)
-
- <LI>Apache Software License 1.1 (available at <A
- href="http://www.apache.org/licenses/LICENSE">http://www.apache.org/licenses/LICENSE</A>)
-
- <LI>Apache Software License 2.0 (available at <A
- href="http://www.apache.org/licenses/LICENSE-2.0">http://www.apache.org/licenses/LICENSE-2.0</A>)
-
- <LI>IBM Public License 1.0 (available at <A
- href="http://oss.software.ibm.com/developerworks/opensource/license10.html">http://oss.software.ibm.com/developerworks/opensource/license10.html</A>)
-
- <LI>Metro Link Public License 1.00 (available at <A
- href="http://www.opengroup.org/openmotif/supporters/metrolink/license.html">http://www.opengroup.org/openmotif/supporters/metrolink/license.html</A>)
-
- <LI>Mozilla Public License Version 1.1 (available at <A
- href="http://www.mozilla.org/MPL/MPL-1.1.html">http://www.mozilla.org/MPL/MPL-1.1.html</A>)
- </LI>
-
- <LI>Common Development and Distribution License (CDDL) Version 1.0 (available at <A
- href="http://www.sun.com/cddl/cddl.html">http://www.sun.com/cddl/cddl.html)</A>
- </LI>
-</UL>
-<P>IT IS YOUR OBLIGATION TO READ AND ACCEPT ALL SUCH TERMS AND CONDITIONS PRIOR
-TO USE OF THE CONTENT. If no About, Feature License or Feature Update License is
-provided, please contact the Eclipse Foundation to determine what terms and
-conditions govern that particular Content.</P>
-<H3>Cryptography</H3>
-<P>Content may contain encryption software. The country in which you are
-currently may have restrictions on the import, possession, and use, and/or
-re-export to another country, of encryption software. BEFORE using any
-encryption software, please check the country's laws, regulations and policies
-concerning the import, possession, or use, and re-export of encryption software,
-to see if this is permitted.</P></BODY></HTML>
diff --git a/assembly/plugins/org.eclipse.jpt/.cvsignore b/assembly/plugins/org.eclipse.jpt/.cvsignore
deleted file mode 100644
index c9401a2c83..0000000000
--- a/assembly/plugins/org.eclipse.jpt/.cvsignore
+++ /dev/null
@@ -1,2 +0,0 @@
-build.xml
-org.eclipse.jpt_1.0.0.* \ No newline at end of file
diff --git a/assembly/plugins/org.eclipse.jpt/.project b/assembly/plugins/org.eclipse.jpt/.project
deleted file mode 100644
index f51b04cc90..0000000000
--- a/assembly/plugins/org.eclipse.jpt/.project
+++ /dev/null
@@ -1,22 +0,0 @@
-<?xml version="1.0" encoding="UTF-8"?>
-<projectDescription>
- <name>org.eclipse.jpt</name>
- <comment></comment>
- <projects>
- </projects>
- <buildSpec>
- <buildCommand>
- <name>org.eclipse.pde.ManifestBuilder</name>
- <arguments>
- </arguments>
- </buildCommand>
- <buildCommand>
- <name>org.eclipse.pde.SchemaBuilder</name>
- <arguments>
- </arguments>
- </buildCommand>
- </buildSpec>
- <natures>
- <nature>org.eclipse.pde.PluginNature</nature>
- </natures>
-</projectDescription>
diff --git a/assembly/plugins/org.eclipse.jpt/.settings/org.eclipse.core.resources.prefs b/assembly/plugins/org.eclipse.jpt/.settings/org.eclipse.core.resources.prefs
deleted file mode 100644
index 4aec29d1cd..0000000000
--- a/assembly/plugins/org.eclipse.jpt/.settings/org.eclipse.core.resources.prefs
+++ /dev/null
@@ -1,3 +0,0 @@
-#Sun May 27 15:10:09 EDT 2007
-eclipse.preferences.version=1
-encoding/<project>=ISO-8859-1
diff --git a/assembly/plugins/org.eclipse.jpt/META-INF/MANIFEST.MF b/assembly/plugins/org.eclipse.jpt/META-INF/MANIFEST.MF
deleted file mode 100644
index 94e3bbd5b3..0000000000
--- a/assembly/plugins/org.eclipse.jpt/META-INF/MANIFEST.MF
+++ /dev/null
@@ -1,7 +0,0 @@
-Manifest-Version: 1.0
-Bundle-ManifestVersion: 2
-Bundle-Name: %pluginName
-Bundle-SymbolicName: org.eclipse.jpt; singleton:=true
-Bundle-Version: 2.1.0.qualifier
-Bundle-Localization: plugin
-Bundle-Vendor: %providerName
diff --git a/assembly/plugins/org.eclipse.jpt/about.html b/assembly/plugins/org.eclipse.jpt/about.html
deleted file mode 100644
index ca606b1bb5..0000000000
--- a/assembly/plugins/org.eclipse.jpt/about.html
+++ /dev/null
@@ -1,34 +0,0 @@
-<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.0//EN">
-<HTML>
-
-<head>
-<title>About</title>
-<meta http-equiv=Content-Type content="text/html; charset=ISO-8859-1">
-</head>
-
-<BODY lang="EN-US">
-
-<H3>About This Content</H3>
-
-<P>June 06, 2007</P>
-
-<H3>License</H3>
-
-<P>The Eclipse Foundation makes available all content in this plug-in
-("Content"). Unless otherwise indicated below, the Content is provided to you
-under the terms and conditions of the Eclipse Public License Version 1.0
-("EPL"). A copy of the EPL is available at
-<A href="http://www.eclipse.org/org/documents/epl-v10.php">http://www.eclipse.org/org/documents/epl-v10.php</A>.
-For purposes of the EPL, "Program" will mean the Content.</P>
-
-<P>If you did not receive this Content directly from the Eclipse Foundation, the
-Content is being redistributed by another party ("Redistributor") and different
-terms and conditions may apply to your use of any object code in the Content.
-Check the Redistributor's license that was provided with the Content. If no such
-license exists, contact the Redistributor. Unless otherwise indicated below, the
-terms and conditions of the EPL still apply to any source code in the Content
-and such source code may be obtained at
-<A href="http://www.eclipse.org/">http://www.eclipse.org/</A>.</P>
-
-</BODY>
-</HTML> \ No newline at end of file
diff --git a/assembly/plugins/org.eclipse.jpt/about.ini b/assembly/plugins/org.eclipse.jpt/about.ini
deleted file mode 100644
index 588a325a8f..0000000000
--- a/assembly/plugins/org.eclipse.jpt/about.ini
+++ /dev/null
@@ -1,44 +0,0 @@
-###############################################################################
-# Copyright (c) 2006 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
-#
-# Contributors:
-# Oracle. - initial API and implementation
-###############################################################################
-
-# about.ini
-# contains information about a feature
-# java.io.Properties file (ISO 8859-1 with "\" escapes)
-# "%key" are externalized strings defined in about.properties
-# This file does not need to be translated.
-
-# Property "aboutText" contains blurb for "About" dialog (translated)
-aboutText=%blurb
-
-# Property "windowImage" contains path to window icon (16x16)
-# needed for primary features only
-
-# Property "featureImage" contains path to feature image (32x32)
-featureImage=eclipse32.gif
-
-# Property "aboutImage" contains path to product image (500x330 or 115x164)
-# needed for primary features only
-
-# Property "appName" contains name of the application (translated)
-# needed for primary features only
-
-# Property "welcomePage" contains path to welcome page (special XML-based format)
-# optional
-
-# Property "welcomePerspective" contains the id of the perspective in which the
-# welcome page is to be opened.
-# optional
-
-# Property "tipsAndTricksHref" contains the Help topic href to a tips and tricks page
-# optional
-tipsAndTricksHref=/org.eclipse.jpt.doc.user/tips_and_tricks.htm
-
-
diff --git a/assembly/plugins/org.eclipse.jpt/about.mappings b/assembly/plugins/org.eclipse.jpt/about.mappings
deleted file mode 100644
index bddaab4310..0000000000
--- a/assembly/plugins/org.eclipse.jpt/about.mappings
+++ /dev/null
@@ -1,6 +0,0 @@
-# about.mappings
-# contains fill-ins for about.properties
-# java.io.Properties file (ISO 8859-1 with "\" escapes)
-# This file does not need to be translated.
-
-0=@build@ \ No newline at end of file
diff --git a/assembly/plugins/org.eclipse.jpt/about.properties b/assembly/plugins/org.eclipse.jpt/about.properties
deleted file mode 100644
index c74a186a13..0000000000
--- a/assembly/plugins/org.eclipse.jpt/about.properties
+++ /dev/null
@@ -1,24 +0,0 @@
-###############################################################################
-# Copyright (c) 2006 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
-#
-# Contributors:
-# Oracle. - initial API and implementation
-###############################################################################
-
-# about.properties
-# contains externalized strings for about.ini
-# java.io.Properties file (ISO 8859-1 with "\" escapes)
-# fill-ins are supplied by about.mappings
-# This file should be translated.
-
-blurb=Dali Java Persistence Tools\n\
-\n\
-Version: {featureVersion}\n\
-Build id: {0}\n\
-\n\
-(c) Copyright Eclipse contributors and others 2006. All rights reserved.\n\
-Visit http://www.eclipse.org/webtools
diff --git a/assembly/plugins/org.eclipse.jpt/build.properties b/assembly/plugins/org.eclipse.jpt/build.properties
deleted file mode 100644
index 0ccfb0ebb8..0000000000
--- a/assembly/plugins/org.eclipse.jpt/build.properties
+++ /dev/null
@@ -1,19 +0,0 @@
-###############################################################################
-# Copyright (c) 2006, 2007 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
-#
-# Contributors:
-# Oracle. - initial API and implementation
-###############################################################################
-bin.includes = META-INF/,\
- about.ini,\
- about.html,\
- about.mappings,\
- about.properties,\
- eclipse32.gif,\
- eclipse32.png,\
- plugin.properties,\
- component.xml
diff --git a/assembly/plugins/org.eclipse.jpt/component.xml b/assembly/plugins/org.eclipse.jpt/component.xml
deleted file mode 100644
index 11f133f65a..0000000000
--- a/assembly/plugins/org.eclipse.jpt/component.xml
+++ /dev/null
@@ -1,12 +0,0 @@
-<?xml version="1.0" encoding="UTF-8"?>
-<component xmlns="http://eclipse.org/wtp/releng/tools/component-model" name="org.eclipse.jpt">
-<description url=""></description>
-<component-depends unrestricted="true"></component-depends>
-<plugin id="org.eclipse.jpt" fragment="false"/>
-<plugin id="org.eclipse.jpt.core" fragment="false"/>
-<plugin id="org.eclipse.jpt.db" fragment="false"/>
-<plugin id="org.eclipse.jpt.db.ui" fragment="false"/>
-<plugin id="org.eclipse.jpt.gen" fragment="false"/>
-<plugin id="org.eclipse.jpt.ui" fragment="false"/>
-<plugin id="org.eclipse.jpt.utility" fragment="false"/>
-</component> \ No newline at end of file
diff --git a/assembly/plugins/org.eclipse.jpt/eclipse32.gif b/assembly/plugins/org.eclipse.jpt/eclipse32.gif
deleted file mode 100644
index e6ad7ccd75..0000000000
--- a/assembly/plugins/org.eclipse.jpt/eclipse32.gif
+++ /dev/null
Binary files differ
diff --git a/assembly/plugins/org.eclipse.jpt/eclipse32.png b/assembly/plugins/org.eclipse.jpt/eclipse32.png
deleted file mode 100644
index 568fac1d05..0000000000
--- a/assembly/plugins/org.eclipse.jpt/eclipse32.png
+++ /dev/null
Binary files differ
diff --git a/assembly/plugins/org.eclipse.jpt/plugin.properties b/assembly/plugins/org.eclipse.jpt/plugin.properties
deleted file mode 100644
index c3c055a778..0000000000
--- a/assembly/plugins/org.eclipse.jpt/plugin.properties
+++ /dev/null
@@ -1,13 +0,0 @@
-###############################################################################
-# Copyright (c) 2006 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
-#
-# Contributors:
-# Oracle. - initial API and implementation
-###############################################################################
-
-pluginName = Dali Java Persistence Tools
-providerName = Eclipse.org
diff --git a/jpa/features/org.eclipse.jpt.eclipselink.feature/.cvsignore b/jpa/features/org.eclipse.jpt.eclipselink.feature/.cvsignore
deleted file mode 100644
index c14487ceac..0000000000
--- a/jpa/features/org.eclipse.jpt.eclipselink.feature/.cvsignore
+++ /dev/null
@@ -1 +0,0 @@
-build.xml
diff --git a/jpa/features/org.eclipse.jpt.eclipselink.feature/.project b/jpa/features/org.eclipse.jpt.eclipselink.feature/.project
deleted file mode 100644
index 93f19b18a8..0000000000
--- a/jpa/features/org.eclipse.jpt.eclipselink.feature/.project
+++ /dev/null
@@ -1,17 +0,0 @@
-<?xml version="1.0" encoding="UTF-8"?>
-<projectDescription>
- <name>org.eclipse.jpt.eclipselink.feature</name>
- <comment></comment>
- <projects>
- </projects>
- <buildSpec>
- <buildCommand>
- <name>org.eclipse.pde.FeatureBuilder</name>
- <arguments>
- </arguments>
- </buildCommand>
- </buildSpec>
- <natures>
- <nature>org.eclipse.pde.FeatureNature</nature>
- </natures>
-</projectDescription>
diff --git a/jpa/features/org.eclipse.jpt.eclipselink.feature/.settings/org.eclipse.core.resources.prefs b/jpa/features/org.eclipse.jpt.eclipselink.feature/.settings/org.eclipse.core.resources.prefs
deleted file mode 100644
index dab5837cb6..0000000000
--- a/jpa/features/org.eclipse.jpt.eclipselink.feature/.settings/org.eclipse.core.resources.prefs
+++ /dev/null
@@ -1,3 +0,0 @@
-#Sun May 27 15:10:47 EDT 2007
-eclipse.preferences.version=1
-encoding/<project>=ISO-8859-1
diff --git a/jpa/features/org.eclipse.jpt.eclipselink.feature/build.properties b/jpa/features/org.eclipse.jpt.eclipselink.feature/build.properties
deleted file mode 100644
index 7200939aca..0000000000
--- a/jpa/features/org.eclipse.jpt.eclipselink.feature/build.properties
+++ /dev/null
@@ -1,15 +0,0 @@
-###############################################################################
-# Copyright (c) 2006 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
-#
-# Contributors:
-# Oracle. - initial API and implementation
-###############################################################################
-bin.includes = feature.xml,\
- eclipse_update_120.jpg,\
- epl-v10.html,\
- license.html,\
- feature.properties
diff --git a/jpa/features/org.eclipse.jpt.eclipselink.feature/eclipse_update_120.jpg b/jpa/features/org.eclipse.jpt.eclipselink.feature/eclipse_update_120.jpg
deleted file mode 100644
index bfdf708ad6..0000000000
--- a/jpa/features/org.eclipse.jpt.eclipselink.feature/eclipse_update_120.jpg
+++ /dev/null
Binary files differ
diff --git a/jpa/features/org.eclipse.jpt.eclipselink.feature/epl-v10.html b/jpa/features/org.eclipse.jpt.eclipselink.feature/epl-v10.html
deleted file mode 100644
index ed4b196655..0000000000
--- a/jpa/features/org.eclipse.jpt.eclipselink.feature/epl-v10.html
+++ /dev/null
@@ -1,328 +0,0 @@
-<html xmlns:o="urn:schemas-microsoft-com:office:office"
-xmlns:w="urn:schemas-microsoft-com:office:word"
-xmlns="http://www.w3.org/TR/REC-html40">
-
-<head>
-<meta http-equiv=Content-Type content="text/html; charset=windows-1252">
-<meta name=ProgId content=Word.Document>
-<meta name=Generator content="Microsoft Word 9">
-<meta name=Originator content="Microsoft Word 9">
-<link rel=File-List
-href="./Eclipse%20EPL%202003_11_10%20Final_files/filelist.xml">
-<title>Eclipse Public License - Version 1.0</title>
-<!--[if gte mso 9]><xml>
- <o:DocumentProperties>
- <o:Revision>2</o:Revision>
- <o:TotalTime>3</o:TotalTime>
- <o:Created>2004-03-05T23:03:00Z</o:Created>
- <o:LastSaved>2004-03-05T23:03:00Z</o:LastSaved>
- <o:Pages>4</o:Pages>
- <o:Words>1626</o:Words>
- <o:Characters>9270</o:Characters>
- <o:Lines>77</o:Lines>
- <o:Paragraphs>18</o:Paragraphs>
- <o:CharactersWithSpaces>11384</o:CharactersWithSpaces>
- <o:Version>9.4402</o:Version>
- </o:DocumentProperties>
-</xml><![endif]--><!--[if gte mso 9]><xml>
- <w:WordDocument>
- <w:TrackRevisions/>
- </w:WordDocument>
-</xml><![endif]-->
-<style>
-<!--
- /* Font Definitions */
-@font-face
- {font-family:Tahoma;
- panose-1:2 11 6 4 3 5 4 4 2 4;
- mso-font-charset:0;
- mso-generic-font-family:swiss;
- mso-font-pitch:variable;
- mso-font-signature:553679495 -2147483648 8 0 66047 0;}
- /* Style Definitions */
-p.MsoNormal, li.MsoNormal, div.MsoNormal
- {mso-style-parent:"";
- margin:0in;
- margin-bottom:.0001pt;
- mso-pagination:widow-orphan;
- font-size:12.0pt;
- font-family:"Times New Roman";
- mso-fareast-font-family:"Times New Roman";}
-p
- {margin-right:0in;
- mso-margin-top-alt:auto;
- mso-margin-bottom-alt:auto;
- margin-left:0in;
- mso-pagination:widow-orphan;
- font-size:12.0pt;
- font-family:"Times New Roman";
- mso-fareast-font-family:"Times New Roman";}
-p.BalloonText, li.BalloonText, div.BalloonText
- {mso-style-name:"Balloon Text";
- margin:0in;
- margin-bottom:.0001pt;
- mso-pagination:widow-orphan;
- font-size:8.0pt;
- font-family:Tahoma;
- mso-fareast-font-family:"Times New Roman";}
-@page Section1
- {size:8.5in 11.0in;
- margin:1.0in 1.25in 1.0in 1.25in;
- mso-header-margin:.5in;
- mso-footer-margin:.5in;
- mso-paper-source:0;}
-div.Section1
- {page:Section1;}
--->
-</style>
-</head>
-
-<body lang=EN-US style='tab-interval:.5in'>
-
-<div class=Section1>
-
-<p align=center style='text-align:center'><b>Eclipse Public License - v 1.0</b>
-</p>
-
-<p><span style='font-size:10.0pt'>THE ACCOMPANYING PROGRAM IS PROVIDED UNDER
-THE TERMS OF THIS ECLIPSE PUBLIC LICENSE (&quot;AGREEMENT&quot;). ANY USE,
-REPRODUCTION OR DISTRIBUTION OF THE PROGRAM CONSTITUTES RECIPIENT'S ACCEPTANCE
-OF THIS AGREEMENT.</span> </p>
-
-<p><b><span style='font-size:10.0pt'>1. DEFINITIONS</span></b> </p>
-
-<p><span style='font-size:10.0pt'>&quot;Contribution&quot; means:</span> </p>
-
-<p class=MsoNormal style='margin-left:.5in'><span style='font-size:10.0pt'>a)
-in the case of the initial Contributor, the initial code and documentation
-distributed under this Agreement, and<br clear=left>
-b) in the case of each subsequent Contributor:</span></p>
-
-<p class=MsoNormal style='margin-left:.5in'><span style='font-size:10.0pt'>i)
-changes to the Program, and</span></p>
-
-<p class=MsoNormal style='margin-left:.5in'><span style='font-size:10.0pt'>ii)
-additions to the Program;</span></p>
-
-<p class=MsoNormal style='margin-left:.5in'><span style='font-size:10.0pt'>where
-such changes and/or additions to the Program originate from and are distributed
-by that particular Contributor. A Contribution 'originates' from a Contributor
-if it was added to the Program by such Contributor itself or anyone acting on
-such Contributor's behalf. Contributions do not include additions to the
-Program which: (i) are separate modules of software distributed in conjunction
-with the Program under their own license agreement, and (ii) are not derivative
-works of the Program. </span></p>
-
-<p><span style='font-size:10.0pt'>&quot;Contributor&quot; means any person or
-entity that distributes the Program.</span> </p>
-
-<p><span style='font-size:10.0pt'>&quot;Licensed Patents &quot; mean patent
-claims licensable by a Contributor which are necessarily infringed by the use
-or sale of its Contribution alone or when combined with the Program. </span></p>
-
-<p><span style='font-size:10.0pt'>&quot;Program&quot; means the Contributions
-distributed in accordance with this Agreement.</span> </p>
-
-<p><span style='font-size:10.0pt'>&quot;Recipient&quot; means anyone who
-receives the Program under this Agreement, including all Contributors.</span> </p>
-
-<p><b><span style='font-size:10.0pt'>2. GRANT OF RIGHTS</span></b> </p>
-
-<p class=MsoNormal style='margin-left:.5in'><span style='font-size:10.0pt'>a)
-Subject to the terms of this Agreement, each Contributor hereby grants Recipient
-a non-exclusive, worldwide, royalty-free copyright license to<span
-style='color:red'> </span>reproduce, prepare derivative works of, publicly
-display, publicly perform, distribute and sublicense the Contribution of such
-Contributor, if any, and such derivative works, in source code and object code
-form.</span></p>
-
-<p class=MsoNormal style='margin-left:.5in'><span style='font-size:10.0pt'>b)
-Subject to the terms of this Agreement, each Contributor hereby grants
-Recipient a non-exclusive, worldwide,<span style='color:green'> </span>royalty-free
-patent license under Licensed Patents to make, use, sell, offer to sell, import
-and otherwise transfer the Contribution of such Contributor, if any, in source
-code and object code form. This patent license shall apply to the combination
-of the Contribution and the Program if, at the time the Contribution is added
-by the Contributor, such addition of the Contribution causes such combination
-to be covered by the Licensed Patents. The patent license shall not apply to
-any other combinations which include the Contribution. No hardware per se is
-licensed hereunder. </span></p>
-
-<p class=MsoNormal style='margin-left:.5in'><span style='font-size:10.0pt'>c)
-Recipient understands that although each Contributor grants the licenses to its
-Contributions set forth herein, no assurances are provided by any Contributor
-that the Program does not infringe the patent or other intellectual property
-rights of any other entity. Each Contributor disclaims any liability to Recipient
-for claims brought by any other entity based on infringement of intellectual
-property rights or otherwise. As a condition to exercising the rights and
-licenses granted hereunder, each Recipient hereby assumes sole responsibility
-to secure any other intellectual property rights needed, if any. For example,
-if a third party patent license is required to allow Recipient to distribute
-the Program, it is Recipient's responsibility to acquire that license before
-distributing the Program.</span></p>
-
-<p class=MsoNormal style='margin-left:.5in'><span style='font-size:10.0pt'>d)
-Each Contributor represents that to its knowledge it has sufficient copyright
-rights in its Contribution, if any, to grant the copyright license set forth in
-this Agreement. </span></p>
-
-<p><b><span style='font-size:10.0pt'>3. REQUIREMENTS</span></b> </p>
-
-<p><span style='font-size:10.0pt'>A Contributor may choose to distribute the
-Program in object code form under its own license agreement, provided that:</span>
-</p>
-
-<p class=MsoNormal style='margin-left:.5in'><span style='font-size:10.0pt'>a)
-it complies with the terms and conditions of this Agreement; and</span></p>
-
-<p class=MsoNormal style='margin-left:.5in'><span style='font-size:10.0pt'>b)
-its license agreement:</span></p>
-
-<p class=MsoNormal style='margin-left:.5in'><span style='font-size:10.0pt'>i)
-effectively disclaims on behalf of all Contributors all warranties and
-conditions, express and implied, including warranties or conditions of title
-and non-infringement, and implied warranties or conditions of merchantability
-and fitness for a particular purpose; </span></p>
-
-<p class=MsoNormal style='margin-left:.5in'><span style='font-size:10.0pt'>ii)
-effectively excludes on behalf of all Contributors all liability for damages,
-including direct, indirect, special, incidental and consequential damages, such
-as lost profits; </span></p>
-
-<p class=MsoNormal style='margin-left:.5in'><span style='font-size:10.0pt'>iii)
-states that any provisions which differ from this Agreement are offered by that
-Contributor alone and not by any other party; and</span></p>
-
-<p class=MsoNormal style='margin-left:.5in'><span style='font-size:10.0pt'>iv)
-states that source code for the Program is available from such Contributor, and
-informs licensees how to obtain it in a reasonable manner on or through a
-medium customarily used for software exchange.<span style='color:blue'> </span></span></p>
-
-<p><span style='font-size:10.0pt'>When the Program is made available in source
-code form:</span> </p>
-
-<p class=MsoNormal style='margin-left:.5in'><span style='font-size:10.0pt'>a)
-it must be made available under this Agreement; and </span></p>
-
-<p class=MsoNormal style='margin-left:.5in'><span style='font-size:10.0pt'>b) a
-copy of this Agreement must be included with each copy of the Program. </span></p>
-
-<p><span style='font-size:10.0pt'>Contributors may not remove or alter any
-copyright notices contained within the Program. </span></p>
-
-<p><span style='font-size:10.0pt'>Each Contributor must identify itself as the
-originator of its Contribution, if any, in a manner that reasonably allows
-subsequent Recipients to identify the originator of the Contribution. </span></p>
-
-<p><b><span style='font-size:10.0pt'>4. COMMERCIAL DISTRIBUTION</span></b> </p>
-
-<p><span style='font-size:10.0pt'>Commercial distributors of software may
-accept certain responsibilities with respect to end users, business partners
-and the like. While this license is intended to facilitate the commercial use
-of the Program, the Contributor who includes the Program in a commercial
-product offering should do so in a manner which does not create potential
-liability for other Contributors. Therefore, if a Contributor includes the
-Program in a commercial product offering, such Contributor (&quot;Commercial
-Contributor&quot;) hereby agrees to defend and indemnify every other
-Contributor (&quot;Indemnified Contributor&quot;) against any losses, damages and
-costs (collectively &quot;Losses&quot;) arising from claims, lawsuits and other
-legal actions brought by a third party against the Indemnified Contributor to
-the extent caused by the acts or omissions of such Commercial Contributor in
-connection with its distribution of the Program in a commercial product
-offering. The obligations in this section do not apply to any claims or Losses
-relating to any actual or alleged intellectual property infringement. In order
-to qualify, an Indemnified Contributor must: a) promptly notify the Commercial
-Contributor in writing of such claim, and b) allow the Commercial Contributor
-to control, and cooperate with the Commercial Contributor in, the defense and
-any related settlement negotiations. The Indemnified Contributor may participate
-in any such claim at its own expense.</span> </p>
-
-<p><span style='font-size:10.0pt'>For example, a Contributor might include the
-Program in a commercial product offering, Product X. That Contributor is then a
-Commercial Contributor. If that Commercial Contributor then makes performance
-claims, or offers warranties related to Product X, those performance claims and
-warranties are such Commercial Contributor's responsibility alone. Under this
-section, the Commercial Contributor would have to defend claims against the
-other Contributors related to those performance claims and warranties, and if a
-court requires any other Contributor to pay any damages as a result, the
-Commercial Contributor must pay those damages.</span> </p>
-
-<p><b><span style='font-size:10.0pt'>5. NO WARRANTY</span></b> </p>
-
-<p><span style='font-size:10.0pt'>EXCEPT AS EXPRESSLY SET FORTH IN THIS
-AGREEMENT, THE PROGRAM IS PROVIDED ON AN &quot;AS IS&quot; BASIS, WITHOUT
-WARRANTIES OR CONDITIONS OF ANY KIND, EITHER EXPRESS OR IMPLIED INCLUDING,
-WITHOUT LIMITATION, ANY WARRANTIES OR CONDITIONS OF TITLE, NON-INFRINGEMENT,
-MERCHANTABILITY OR FITNESS FOR A PARTICULAR PURPOSE. Each Recipient is solely
-responsible for determining the appropriateness of using and distributing the
-Program and assumes all risks associated with its exercise of rights under this
-Agreement , including but not limited to the risks and costs of program errors,
-compliance with applicable laws, damage to or loss of data, programs or
-equipment, and unavailability or interruption of operations. </span></p>
-
-<p><b><span style='font-size:10.0pt'>6. DISCLAIMER OF LIABILITY</span></b> </p>
-
-<p><span style='font-size:10.0pt'>EXCEPT AS EXPRESSLY SET FORTH IN THIS
-AGREEMENT, NEITHER RECIPIENT NOR ANY CONTRIBUTORS SHALL HAVE ANY LIABILITY FOR
-ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES
-(INCLUDING WITHOUT LIMITATION LOST PROFITS), HOWEVER CAUSED AND ON ANY THEORY
-OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING
-NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OR DISTRIBUTION OF
-THE PROGRAM OR THE EXERCISE OF ANY RIGHTS GRANTED HEREUNDER, EVEN IF ADVISED OF
-THE POSSIBILITY OF SUCH DAMAGES.</span> </p>
-
-<p><b><span style='font-size:10.0pt'>7. GENERAL</span></b> </p>
-
-<p><span style='font-size:10.0pt'>If any provision of this Agreement is invalid
-or unenforceable under applicable law, it shall not affect the validity or
-enforceability of the remainder of the terms of this Agreement, and without
-further action by the parties hereto, such provision shall be reformed to the
-minimum extent necessary to make such provision valid and enforceable.</span> </p>
-
-<p><span style='font-size:10.0pt'>If Recipient institutes patent litigation
-against any entity (including a cross-claim or counterclaim in a lawsuit)
-alleging that the Program itself (excluding combinations of the Program with
-other software or hardware) infringes such Recipient's patent(s), then such
-Recipient's rights granted under Section 2(b) shall terminate as of the date
-such litigation is filed. </span></p>
-
-<p><span style='font-size:10.0pt'>All Recipient's rights under this Agreement
-shall terminate if it fails to comply with any of the material terms or
-conditions of this Agreement and does not cure such failure in a reasonable
-period of time after becoming aware of such noncompliance. If all Recipient's
-rights under this Agreement terminate, Recipient agrees to cease use and
-distribution of the Program as soon as reasonably practicable. However,
-Recipient's obligations under this Agreement and any licenses granted by
-Recipient relating to the Program shall continue and survive. </span></p>
-
-<p><span style='font-size:10.0pt'>Everyone is permitted to copy and distribute
-copies of this Agreement, but in order to avoid inconsistency the Agreement is
-copyrighted and may only be modified in the following manner. The Agreement
-Steward reserves the right to publish new versions (including revisions) of
-this Agreement from time to time. No one other than the Agreement Steward has
-the right to modify this Agreement. The Eclipse Foundation is the initial
-Agreement Steward. The Eclipse Foundation may assign the responsibility to
-serve as the Agreement Steward to a suitable separate entity. Each new version
-of the Agreement will be given a distinguishing version number. The Program
-(including Contributions) may always be distributed subject to the version of
-the Agreement under which it was received. In addition, after a new version of
-the Agreement is published, Contributor may elect to distribute the Program
-(including its Contributions) under the new version. Except as expressly stated
-in Sections 2(a) and 2(b) above, Recipient receives no rights or licenses to
-the intellectual property of any Contributor under this Agreement, whether
-expressly, by implication, estoppel or otherwise. All rights in the Program not
-expressly granted under this Agreement are reserved.</span> </p>
-
-<p><span style='font-size:10.0pt'>This Agreement is governed by the laws of the
-State of New York and the intellectual property laws of the United States of
-America. No party to this Agreement will bring a legal action under this
-Agreement more than one year after the cause of action arose. Each party waives
-its rights to a jury trial in any resulting litigation.</span> </p>
-
-<p class=MsoNormal><![if !supportEmptyParas]>&nbsp;<![endif]><o:p></o:p></p>
-
-</div>
-
-</body>
-
-</html> \ No newline at end of file
diff --git a/jpa/features/org.eclipse.jpt.eclipselink.feature/feature.properties b/jpa/features/org.eclipse.jpt.eclipselink.feature/feature.properties
deleted file mode 100644
index 1e14e38b9b..0000000000
--- a/jpa/features/org.eclipse.jpt.eclipselink.feature/feature.properties
+++ /dev/null
@@ -1,140 +0,0 @@
-###############################################################################
-# Copyright (c) 2006 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
-#
-# Contributors:
-# Oracle - initial API and implementation
-###############################################################################
-
-# "featureName" property - name of the feature
-featureName=Dali Java Persistence Tools - EclipseLink Support (Optional)
-
-# "providerName" property - name of the company that provides the feature
-providerName=Eclipse Web Tools Platform
-
-# "updateSiteName" property - label for the update site
-updateSiteName=The Eclipse Web Tools Platform (WTP) Project update site
-
-# "description" property - description of the feature
-description=Dali Java Persistence Tools - EclipseLink Support
-
-# "copyright" property - text of the "Feature Update Copyright"
-copyright=\
-Copyright (c) 2006, 2009 Oracle Corporation.\n\
-All rights reserved. This program and the accompanying materials\n\
-are made available under the terms of the Eclipse Public License v1.0\n\
-which accompanies this distribution, and is available at\n\
-http://www.eclipse.org/legal/epl-v10.html\n\
-\n\
-Contributors:\n\
- Oracle - initial API and implementation\n
-################ end of copyright property ####################################
-
-# "licenseURL" property - URL of the "Feature License"
-# do not translate value - just change to point to a locale-specific HTML page
-licenseURL=license.html
-
-# "license" property - text of the "Feature Update License"
-# should be plain text version of license agreement pointed to be "licenseURL"
-license=\
-ECLIPSE FOUNDATION SOFTWARE USER AGREEMENT\n\
-June 06, 2007\n\
-\n\
-Usage Of Content\n\
-\n\
-THE ECLIPSE FOUNDATION MAKES AVAILABLE SOFTWARE, DOCUMENTATION, INFORMATION AND/OR\n\
-OTHER MATERIALS FOR OPEN SOURCE PROJECTS (COLLECTIVELY "CONTENT").\n\
-USE OF THE CONTENT IS GOVERNED BY THE TERMS AND CONDITIONS OF THIS\n\
-AGREEMENT AND/OR THE TERMS AND CONDITIONS OF LICENSE AGREEMENTS OR\n\
-NOTICES INDICATED OR REFERENCED BELOW. BY USING THE CONTENT, YOU\n\
-AGREE THAT YOUR USE OF THE CONTENT IS GOVERNED BY THIS AGREEMENT\n\
-AND/OR THE TERMS AND CONDITIONS OF ANY APPLICABLE LICENSE AGREEMENTS\n\
-OR NOTICES INDICATED OR REFERENCED BELOW. IF YOU DO NOT AGREE TO THE\n\
-TERMS AND CONDITIONS OF THIS AGREEMENT AND THE TERMS AND CONDITIONS\n\
-OF ANY APPLICABLE LICENSE AGREEMENTS OR NOTICES INDICATED OR REFERENCED\n\
-BELOW, THEN YOU MAY NOT USE THE CONTENT.\n\
-\n\
-Applicable Licenses\n\
-\n\
-Unless otherwise indicated, all Content made available by the Eclipse Foundation\n\
-is provided to you under the terms and conditions of the Eclipse Public\n\
-License Version 1.0 ("EPL"). A copy of the EPL is provided with this\n\
-Content and is also available at http://www.eclipse.org/legal/epl-v10.html.\n\
-For purposes of the EPL, "Program" will mean the Content.\n\
-\n\
-Content includes, but is not limited to, source code, object code,\n\
-documentation and other files maintained in the Eclipse.org CVS\n\
-repository ("Repository") in CVS modules ("Modules") and made available\n\
-as downloadable archives ("Downloads").\n\
-\n\
- - Content may be structured and packaged into modules to facilitate delivering,\n\
- extending, and upgrading the Content. Typical modules may include plug-ins ("Plug-ins"),\n\
- plug-in fragments ("Fragments"), and features ("Features").\n\
- - Each Plug-in or Fragment may be packaged as a sub-directory or JAR (Java? ARchive)\n\
- in a directory named "plugins".\n\
- - A Feature is a bundle of one or more Plug-ins and/or Fragments and associated material.\n\
- Each Feature may be packaged as a sub-directory in a directory named "features".\n\
- Within a Feature, files named "feature.xml" may contain a list of the names and version\n\
- numbers of the Plug-ins and/or Fragments associated with that Feature.\n\
- - Features may also include other Features ("Included Features"). Within a Feature, files\n\
- named "feature.xml" may contain a list of the names and version numbers of Included Features.\n\
-\n\
-Features may also include other Features ("Included Features"). Files named\n\
-"feature.xml" may contain a list of the names and version numbers of\n\
-Included Features.\n\
-\n\
-The terms and conditions governing Plug-ins and Fragments should be\n\
-contained in files named "about.html" ("Abouts"). The terms and\n\
-conditions governing Features and Included Features should be contained\n\
-in files named "license.html" ("Feature Licenses"). Abouts and Feature\n\
-Licenses may be located in any directory of a Download or Module\n\
-including, but not limited to the following locations:\n\
-\n\
- - The top-level (root) directory\n\
- - Plug-in and Fragment directories\n\
- - Inside Plug-ins and Fragments packaged as JARs\n\
- - Sub-directories of the directory named "src" of certain Plug-ins\n\
- - Feature directories\n\
-\n\
-Note: if a Feature made available by the Eclipse Foundation is installed using the\n\
-Eclipse Update Manager, you must agree to a license ("Feature Update\n\
-License") during the installation process. If the Feature contains\n\
-Included Features, the Feature Update License should either provide you\n\
-with the terms and conditions governing the Included Features or inform\n\
-you where you can locate them. Feature Update Licenses may be found in\n\
-the "license" property of files named "feature.properties". Such Abouts,\n\
-Feature Licenses and Feature Update Licenses contain the terms and\n\
-conditions (or references to such terms and conditions) that govern your\n\
-use of the associated Content in that directory.\n\
-\n\
-THE ABOUTS, FEATURE LICENSES AND FEATURE UPDATE LICENSES MAY REFER\n\
-TO THE EPL OR OTHER LICENSE AGREEMENTS, NOTICES OR TERMS AND CONDITIONS.\n\
-SOME OF THESE OTHER LICENSE AGREEMENTS MAY INCLUDE (BUT ARE NOT LIMITED TO):\n\
-\n\
- - Common Public License Version 1.0 (available at http://www.eclipse.org/legal/cpl-v10.html)\n\
- - Apache Software License 1.1 (available at http://www.apache.org/licenses/LICENSE)\n\
- - Apache Software License 2.0 (available at http://www.apache.org/licenses/LICENSE-2.0)\n\
- - IBM Public License 1.0 (available at http://oss.software.ibm.com/developerworks/opensource/license10.html)\n\
- - Metro Link Public License 1.00 (available at http://www.opengroup.org/openmotif/supporters/metrolink/license.html)\n\
- - Mozilla Public License Version 1.1 (available at http://www.mozilla.org/MPL/MPL-1.1.html)\n\
- - Common Development and Distribution License (CDDL) Version 1.0 (available at http://www.sun.com/cddl/cddl.html)\n\
-\n\
-IT IS YOUR OBLIGATION TO READ AND ACCEPT ALL SUCH TERMS AND CONDITIONS PRIOR\n\
-TO USE OF THE CONTENT. If no About, Feature License or Feature Update License\n\
-is provided, please contact the Eclipse Foundation to determine what terms and conditions\n\
-govern that particular Content.\n\
-\n\
-Cryptography\n\
-\n\
-Content may contain encryption software. The country in which you are\n\
-currently may have restrictions on the import, possession, and use,\n\
-and/or re-export to another country, of encryption software. BEFORE\n\
-using any encryption software, please check the country's laws,\n\
-regulations and policies concerning the import, possession, or use,\n\
-and re-export of encryption software, to see if this is permitted.\n\
-\n\
-Java and all Java-based trademarks are trademarks of Sun Microsystems, Inc. in the United States, other countries, or both.\n
-########### end of license property ##########################################
diff --git a/jpa/features/org.eclipse.jpt.eclipselink.feature/feature.xml b/jpa/features/org.eclipse.jpt.eclipselink.feature/feature.xml
deleted file mode 100644
index 4a7bb50eb1..0000000000
--- a/jpa/features/org.eclipse.jpt.eclipselink.feature/feature.xml
+++ /dev/null
@@ -1,59 +0,0 @@
-<?xml version="1.0" encoding="UTF-8"?>
-<feature
- id="org.eclipse.jpt.eclipselink.feature"
- label="%featureName"
- version="2.2.0.qualifier"
- provider-name="%providerName"
- plugin="org.eclipse.jpt.eclipselink.branding">
-
- <description>
- %description
- </description>
-
- <copyright>
- %copyright
- </copyright>
-
- <license url="license.html">
- %license
- </license>
-
- <url>
- <update label="Web Tools Platform (WTP) Updates" url="http://download.eclipse.org/webtools/updates"/>
- <discovery label="Web Tools Platform (WTP) Updates" url="http://download.eclipse.org/webtools/updates"/>
- <discovery label="Dali Java Persistence Tools Updates" url="http://download.eclipse.org/webtools/updates/"/>
- </url>
-
- <requires>
- <import feature="org.eclipse.jpt.feature" version="2.2.0"/>
- </requires>
-
- <plugin
- id="org.eclipse.jpt.eclipselink.core"
- download-size="0"
- install-size="0"
- version="0.0.0"
- unpack="false"/>
-
- <plugin
- id="org.eclipse.jpt.eclipselink.ui"
- download-size="0"
- install-size="0"
- version="0.0.0"
- unpack="false"/>
-
- <plugin
- id="org.eclipse.jpt.eclipselink.core.ddlgen"
- download-size="0"
- install-size="0"
- version="0.0.0"
- unpack="false"/>
-
- <plugin
- id="org.eclipse.jpt.eclipselink.branding"
- download-size="0"
- install-size="0"
- version="0.0.0"
- unpack="false"/>
-
-</feature>
diff --git a/jpa/features/org.eclipse.jpt.eclipselink.feature/license.html b/jpa/features/org.eclipse.jpt.eclipselink.feature/license.html
deleted file mode 100644
index fc77372d46..0000000000
--- a/jpa/features/org.eclipse.jpt.eclipselink.feature/license.html
+++ /dev/null
@@ -1,98 +0,0 @@
-<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN" "http://www.w3c.org/TR/1999/REC-html401-19991224/loose.dtd">
-<!-- saved from url=(0044)http://www.eclipse.org/legal/epl/notice.html -->
-<HTML><HEAD><TITLE>Eclipse.org Software User Agreement</TITLE>
-<META http-equiv=Content-Type content="text/html; charset=iso-8859-1">
-<META content="MSHTML 6.00.2800.1479" name=GENERATOR></HEAD>
-<BODY lang=EN-US vLink=purple link=blue>
-<H2>Eclipse Foundation Software User Agreement</H2>
-<P>June 06, 2007</P>
-<H3>Usage Of Content</H3>
-<P>THE ECLIPSE FOUNDATION MAKES AVAILABLE SOFTWARE, DOCUMENTATION, INFORMATION
-AND/OR OTHER MATERIALS FOR OPEN SOURCE PROJECTS (COLLECTIVELY "CONTENT"). USE OF
-THE CONTENT IS GOVERNED BY THE TERMS AND CONDITIONS OF THIS AGREEMENT AND/OR THE
-TERMS AND CONDITIONS OF LICENSE AGREEMENTS OR NOTICES INDICATED OR REFERENCED
-BELOW. BY USING THE CONTENT, YOU AGREE THAT YOUR USE OF THE CONTENT IS GOVERNED
-BY THIS AGREEMENT AND/OR THE TERMS AND CONDITIONS OF ANY APPLICABLE LICENSE
-AGREEMENTS OR NOTICES INDICATED OR REFERENCED BELOW. IF YOU DO NOT AGREE TO THE
-TERMS AND CONDITIONS OF THIS AGREEMENT AND THE TERMS AND CONDITIONS OF ANY
-APPLICABLE LICENSE AGREEMENTS OR NOTICES INDICATED OR REFERENCED BELOW, THEN YOU
-MAY NOT USE THE CONTENT.</P>
-<H3>Applicable Licenses</H3>
-<P>Unless otherwise indicated, all Content made available by the Eclipse
-Foundation is provided to you under the terms and conditions of the Eclipse
-Public License Version 1.0 ("EPL"). A copy of the EPL is provided with this
-Content and is also available at <A
-href="http://www.eclipse.org/legal/epl-v10.html">http://www.eclipse.org/legal/epl-v10.html</A>.
-For purposes of the EPL, "Program" will mean the Content.</P>
-<P>Content includes, but is not limited to, source code, object code,
-documentation and other files maintained in the Eclipse.org CVS repository
-("Repository") in CVS modules ("Modules") and made available as downloadable
-archives ("Downloads").</P>
-<P>Content may be apportioned into plug-ins ("Plug-ins"), plug-in fragments
-("Fragments"), and features ("Features"). A Feature is a bundle of one or more
-Plug-ins and/or Fragments and associated material. Files named "feature.xml" may
-contain a list of the names and version numbers of the Plug-ins and/or Fragments
-associated with a Feature. Plug-ins and Fragments are located in directories
-named "plugins" and Features are located in directories named "features".</P>
-<P>Features may also include other Features ("Included Features"). Files named
-"feature.xml" may contain a list of the names and version numbers of Included
-Features.</P>
-<P>The terms and conditions governing Plug-ins and Fragments should be contained
-in files named "about.html" ("Abouts"). The terms and conditions governing
-Features and Included Features should be contained in files named "license.html"
-("Feature Licenses"). Abouts and Feature Licenses may be located in any
-directory of a Download or Module including, but not limited to the following
-locations:</P>
-<UL>
- <LI>The top-level (root) directory
- <LI>Plug-in and Fragment directories
- <LI>Subdirectories of the directory named "src" of certain Plug-ins
- <LI>Feature directories </LI></UL>
-<P>Note: if a Feature made available by the Eclipse Foundation is installed
-using the Eclipse Update Manager, you must agree to a license ("Feature Update
-License") during the installation process. If the Feature contains Included
-Features, the Feature Update License should either provide you with the terms
-and conditions governing the Included Features or inform you where you can
-locate them. Feature Update Licenses may be found in the "license" property of
-files named "feature.properties". Such Abouts, Feature Licenses and Feature
-Update Licenses contain the terms and conditions (or references to such terms
-and conditions) that govern your use of the associated Content in that
-directory.</P>
-<P>THE ABOUTS, FEATURE LICENSES AND FEATURE UPDATE LICENSES MAY REFER TO THE EPL
-OR OTHER LICENSE AGREEMENTS, NOTICES OR TERMS AND CONDITIONS. SOME OF THESE
-OTHER LICENSE AGREEMENTS MAY INCLUDE (BUT ARE NOT LIMITED TO):</P>
-<UL>
- <LI>Common Public License Version 1.0 (available at <A
- href="http://www.eclipse.org/legal/cpl-v10.html">http://www.eclipse.org/legal/cpl-v10.html</A>)
-
- <LI>Apache Software License 1.1 (available at <A
- href="http://www.apache.org/licenses/LICENSE">http://www.apache.org/licenses/LICENSE</A>)
-
- <LI>Apache Software License 2.0 (available at <A
- href="http://www.apache.org/licenses/LICENSE-2.0">http://www.apache.org/licenses/LICENSE-2.0</A>)
-
- <LI>IBM Public License 1.0 (available at <A
- href="http://oss.software.ibm.com/developerworks/opensource/license10.html">http://oss.software.ibm.com/developerworks/opensource/license10.html</A>)
-
- <LI>Metro Link Public License 1.00 (available at <A
- href="http://www.opengroup.org/openmotif/supporters/metrolink/license.html">http://www.opengroup.org/openmotif/supporters/metrolink/license.html</A>)
-
- <LI>Mozilla Public License Version 1.1 (available at <A
- href="http://www.mozilla.org/MPL/MPL-1.1.html">http://www.mozilla.org/MPL/MPL-1.1.html</A>)
- </LI>
-
- <LI>Common Development and Distribution License (CDDL) Version 1.0 (available at <A
- href="http://www.sun.com/cddl/cddl.html">http://www.sun.com/cddl/cddl.html)</A>
- </LI>
-</UL>
-<P>IT IS YOUR OBLIGATION TO READ AND ACCEPT ALL SUCH TERMS AND CONDITIONS PRIOR
-TO USE OF THE CONTENT. If no About, Feature License or Feature Update License is
-provided, please contact the Eclipse Foundation to determine what terms and
-conditions govern that particular Content.</P>
-<H3>Cryptography</H3>
-<P>Content may contain encryption software. The country in which you are
-currently may have restrictions on the import, possession, and use, and/or
-re-export to another country, of encryption software. BEFORE using any
-encryption software, please check the country's laws, regulations and policies
-concerning the import, possession, or use, and re-export of encryption software,
-to see if this is permitted.</P></BODY></HTML>
diff --git a/jpa/features/org.eclipse.jpt.eclipselink.feature/sourceTemplateBundle/about.html b/jpa/features/org.eclipse.jpt.eclipselink.feature/sourceTemplateBundle/about.html
deleted file mode 100644
index d4916df475..0000000000
--- a/jpa/features/org.eclipse.jpt.eclipselink.feature/sourceTemplateBundle/about.html
+++ /dev/null
@@ -1,27 +0,0 @@
-<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.0//EN">
-<html>
-<head>
-<title>About</title>
-<meta http-equiv=Content-Type content="text/html; charset=ISO-8859-1">
-</head>
-<body lang="EN-US">
-<h2>About This Content</h2>
-
-<p>June 06, 2007</p>
-<h3>License</h3>
-
-<p>The Eclipse Foundation makes available all content in this plug-in (&quot;Content&quot;). Unless otherwise indicated below, the Content is provided to you under the terms and conditions of the
-Eclipse Public License Version 1.0 (&quot;EPL&quot;). A copy of the EPL is available at <a href="http://www.eclipse.org/legal/epl-v10.html">http://www.eclipse.org/legal/epl-v10.html</a>.
-For purposes of the EPL, &quot;Program&quot; will mean the Content.</p>
-
-<p>If you did not receive this Content directly from the Eclipse Foundation, the Content is being redistributed by another party (&quot;Redistributor&quot;) and different terms and conditions may
-apply to your use of any object code in the Content. Check the Redistributor's license that was provided with the Content. If no such license exists, contact the Redistributor. Unless otherwise
-indicated below, the terms and conditions of the EPL still apply to any source code in the Content.</p>
-
-<h3>Source Code</h3>
-<p>This plug-in contains source code zip files (&quot;Source Zips&quot;) that correspond to binary content in other plug-ins. These Source Zips may be distributed under different license
-agreements and/or notices. Details about these license agreements and notices are contained in &quot;about.html&quot; files (&quot;Abouts&quot;) located in sub-directories in the
-src/ directory of this plug-in. Such Abouts govern your use of the Source Zips in that directory, not the EPL.</p>
-
-</body>
-</html>
diff --git a/jpa/features/org.eclipse.jpt.eclipselink.feature/sourceTemplateBundle/about.ini b/jpa/features/org.eclipse.jpt.eclipselink.feature/sourceTemplateBundle/about.ini
deleted file mode 100644
index 2dee36a2e2..0000000000
--- a/jpa/features/org.eclipse.jpt.eclipselink.feature/sourceTemplateBundle/about.ini
+++ /dev/null
@@ -1,31 +0,0 @@
-# about.ini
-# contains information about a feature
-# java.io.Properties file (ISO 8859-1 with "\" escapes)
-# "%key" are externalized strings defined in about.properties
-# This file does not need to be translated.
-
-# Property "aboutText" contains blurb for "About" dialog (translated)
-aboutText=%blurb
-
-# Property "windowImage" contains path to window icon (16x16)
-# needed for primary features only
-
-# Property "featureImage" contains path to feature image (32x32)
-featureImage=eclipse32.gif
-
-# Property "aboutImage" contains path to product image (500x330 or 115x164)
-# needed for primary features only
-
-# Property "appName" contains name of the application (not translated)
-# needed for primary features only
-
-# Property "welcomePage" contains path to welcome page (special XML-based format)
-# optional
-
-# Property "welcomePerspective" contains the id of the perspective in which the
-# welcome page is to be opened.
-# optional
-
-
-
-
diff --git a/jpa/features/org.eclipse.jpt.eclipselink.feature/sourceTemplateBundle/about.mappings b/jpa/features/org.eclipse.jpt.eclipselink.feature/sourceTemplateBundle/about.mappings
deleted file mode 100644
index a28390a75e..0000000000
--- a/jpa/features/org.eclipse.jpt.eclipselink.feature/sourceTemplateBundle/about.mappings
+++ /dev/null
@@ -1,6 +0,0 @@
-# about.mappings
-# contains fill-ins for about.properties
-# java.io.Properties file (ISO 8859-1 with "\" escapes)
-# This file does not need to be translated.
-
-0=@build@
diff --git a/jpa/features/org.eclipse.jpt.eclipselink.feature/sourceTemplateBundle/about.properties b/jpa/features/org.eclipse.jpt.eclipselink.feature/sourceTemplateBundle/about.properties
deleted file mode 100644
index 50c0a9ef9c..0000000000
--- a/jpa/features/org.eclipse.jpt.eclipselink.feature/sourceTemplateBundle/about.properties
+++ /dev/null
@@ -1,26 +0,0 @@
-###############################################################################
-# Copyright (c) 2008 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
-#
-# Contributors:
-# Oracle - initial API and implementation
-###############################################################################
-# about.properties
-# contains externalized strings for about.ini
-# java.io.Properties file (ISO 8859-1 with "\" escapes)
-# fill-ins are supplied by about.mappings
-# This file should be translated.
-#
-# Do not translate any values surrounded by {}
-
-blurb=Java Persistence API Tools - EclipseLink Support Source\n\
-\n\
-Version: {featureVersion}\n\
-Build id: {0}\n\
-\n\
-(c) Copyright Eclipse contributors and others 2005. All rights reserved.\n\
-Visit http://www.eclipse.org/webtools
-
diff --git a/jpa/features/org.eclipse.jpt.eclipselink.feature/sourceTemplateBundle/build.properties b/jpa/features/org.eclipse.jpt.eclipselink.feature/sourceTemplateBundle/build.properties
deleted file mode 100644
index 6dcfcd6269..0000000000
--- a/jpa/features/org.eclipse.jpt.eclipselink.feature/sourceTemplateBundle/build.properties
+++ /dev/null
@@ -1,21 +0,0 @@
-###############################################################################
-# Copyright (c) 2008 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
-#
-# Contributors:
-# Oracle - initial API and implementation
-###############################################################################
-bin.includes = \
- about.html,\
- about.ini,\
- about.mappings,\
- about.properties,\
- eclipse32.gif,\
- plugin.properties,\
- plugin.xml,\
- src/**,\
- META-INF/
-sourcePlugin = true
diff --git a/jpa/features/org.eclipse.jpt.eclipselink.feature/sourceTemplateBundle/eclipse32.gif b/jpa/features/org.eclipse.jpt.eclipselink.feature/sourceTemplateBundle/eclipse32.gif
deleted file mode 100644
index e6ad7ccd75..0000000000
--- a/jpa/features/org.eclipse.jpt.eclipselink.feature/sourceTemplateBundle/eclipse32.gif
+++ /dev/null
Binary files differ
diff --git a/jpa/features/org.eclipse.jpt.eclipselink.feature/sourceTemplateBundle/eclipse32.png b/jpa/features/org.eclipse.jpt.eclipselink.feature/sourceTemplateBundle/eclipse32.png
deleted file mode 100644
index 50ae49de24..0000000000
--- a/jpa/features/org.eclipse.jpt.eclipselink.feature/sourceTemplateBundle/eclipse32.png
+++ /dev/null
Binary files differ
diff --git a/jpa/features/org.eclipse.jpt.eclipselink.feature/sourceTemplateBundle/eclipse_update_120.jpg b/jpa/features/org.eclipse.jpt.eclipselink.feature/sourceTemplateBundle/eclipse_update_120.jpg
deleted file mode 100644
index bfdf708ad6..0000000000
--- a/jpa/features/org.eclipse.jpt.eclipselink.feature/sourceTemplateBundle/eclipse_update_120.jpg
+++ /dev/null
Binary files differ
diff --git a/jpa/features/org.eclipse.jpt.eclipselink.feature/sourceTemplateBundle/epl-v10.html b/jpa/features/org.eclipse.jpt.eclipselink.feature/sourceTemplateBundle/epl-v10.html
deleted file mode 100644
index 022ad2955b..0000000000
--- a/jpa/features/org.eclipse.jpt.eclipselink.feature/sourceTemplateBundle/epl-v10.html
+++ /dev/null
@@ -1,328 +0,0 @@
-<html xmlns:o="urn:schemas-microsoft-com:office:office"
-xmlns:w="urn:schemas-microsoft-com:office:word"
-xmlns="http://www.w3.org/TR/REC-html40">
-
-<head>
-<meta http-equiv=Content-Type content="text/html; charset=windows-1252">
-<meta name=ProgId content=Word.Document>
-<meta name=Generator content="Microsoft Word 9">
-<meta name=Originator content="Microsoft Word 9">
-<link rel=File-List
-href="./Eclipse%20EPL%202003_11_10%20Final_files/filelist.xml">
-<title>Eclipse Public License - Version 1.0</title>
-<!--[if gte mso 9]><xml>
- <o:DocumentProperties>
- <o:Revision>2</o:Revision>
- <o:TotalTime>3</o:TotalTime>
- <o:Created>2004-03-05T23:03:00Z</o:Created>
- <o:LastSaved>2004-03-05T23:03:00Z</o:LastSaved>
- <o:Pages>4</o:Pages>
- <o:Words>1626</o:Words>
- <o:Characters>9270</o:Characters>
- <o:Lines>77</o:Lines>
- <o:Paragraphs>18</o:Paragraphs>
- <o:CharactersWithSpaces>11384</o:CharactersWithSpaces>
- <o:Version>9.4402</o:Version>
- </o:DocumentProperties>
-</xml><![endif]--><!--[if gte mso 9]><xml>
- <w:WordDocument>
- <w:TrackRevisions/>
- </w:WordDocument>
-</xml><![endif]-->
-<style>
-<!--
- /* Font Definitions */
-@font-face
- {font-family:Tahoma;
- panose-1:2 11 6 4 3 5 4 4 2 4;
- mso-font-charset:0;
- mso-generic-font-family:swiss;
- mso-font-pitch:variable;
- mso-font-signature:553679495 -2147483648 8 0 66047 0;}
- /* Style Definitions */
-p.MsoNormal, li.MsoNormal, div.MsoNormal
- {mso-style-parent:"";
- margin:0in;
- margin-bottom:.0001pt;
- mso-pagination:widow-orphan;
- font-size:12.0pt;
- font-family:"Times New Roman";
- mso-fareast-font-family:"Times New Roman";}
-p
- {margin-right:0in;
- mso-margin-top-alt:auto;
- mso-margin-bottom-alt:auto;
- margin-left:0in;
- mso-pagination:widow-orphan;
- font-size:12.0pt;
- font-family:"Times New Roman";
- mso-fareast-font-family:"Times New Roman";}
-p.BalloonText, li.BalloonText, div.BalloonText
- {mso-style-name:"Balloon Text";
- margin:0in;
- margin-bottom:.0001pt;
- mso-pagination:widow-orphan;
- font-size:8.0pt;
- font-family:Tahoma;
- mso-fareast-font-family:"Times New Roman";}
-@page Section1
- {size:8.5in 11.0in;
- margin:1.0in 1.25in 1.0in 1.25in;
- mso-header-margin:.5in;
- mso-footer-margin:.5in;
- mso-paper-source:0;}
-div.Section1
- {page:Section1;}
--->
-</style>
-</head>
-
-<body lang=EN-US style='tab-interval:.5in'>
-
-<div class=Section1>
-
-<p align=center style='text-align:center'><b>Eclipse Public License - v 1.0</b>
-</p>
-
-<p><span style='font-size:10.0pt'>THE ACCOMPANYING PROGRAM IS PROVIDED UNDER
-THE TERMS OF THIS ECLIPSE PUBLIC LICENSE (&quot;AGREEMENT&quot;). ANY USE,
-REPRODUCTION OR DISTRIBUTION OF THE PROGRAM CONSTITUTES RECIPIENT'S ACCEPTANCE
-OF THIS AGREEMENT.</span> </p>
-
-<p><b><span style='font-size:10.0pt'>1. DEFINITIONS</span></b> </p>
-
-<p><span style='font-size:10.0pt'>&quot;Contribution&quot; means:</span> </p>
-
-<p class=MsoNormal style='margin-left:.5in'><span style='font-size:10.0pt'>a)
-in the case of the initial Contributor, the initial code and documentation
-distributed under this Agreement, and<br clear=left>
-b) in the case of each subsequent Contributor:</span></p>
-
-<p class=MsoNormal style='margin-left:.5in'><span style='font-size:10.0pt'>i)
-changes to the Program, and</span></p>
-
-<p class=MsoNormal style='margin-left:.5in'><span style='font-size:10.0pt'>ii)
-additions to the Program;</span></p>
-
-<p class=MsoNormal style='margin-left:.5in'><span style='font-size:10.0pt'>where
-such changes and/or additions to the Program originate from and are distributed
-by that particular Contributor. A Contribution 'originates' from a Contributor
-if it was added to the Program by such Contributor itself or anyone acting on
-such Contributor's behalf. Contributions do not include additions to the
-Program which: (i) are separate modules of software distributed in conjunction
-with the Program under their own license agreement, and (ii) are not derivative
-works of the Program. </span></p>
-
-<p><span style='font-size:10.0pt'>&quot;Contributor&quot; means any person or
-entity that distributes the Program.</span> </p>
-
-<p><span style='font-size:10.0pt'>&quot;Licensed Patents &quot; mean patent
-claims licensable by a Contributor which are necessarily infringed by the use
-or sale of its Contribution alone or when combined with the Program. </span></p>
-
-<p><span style='font-size:10.0pt'>&quot;Program&quot; means the Contributions
-distributed in accordance with this Agreement.</span> </p>
-
-<p><span style='font-size:10.0pt'>&quot;Recipient&quot; means anyone who
-receives the Program under this Agreement, including all Contributors.</span> </p>
-
-<p><b><span style='font-size:10.0pt'>2. GRANT OF RIGHTS</span></b> </p>
-
-<p class=MsoNormal style='margin-left:.5in'><span style='font-size:10.0pt'>a)
-Subject to the terms of this Agreement, each Contributor hereby grants Recipient
-a non-exclusive, worldwide, royalty-free copyright license to<span
-style='color:red'> </span>reproduce, prepare derivative works of, publicly
-display, publicly perform, distribute and sublicense the Contribution of such
-Contributor, if any, and such derivative works, in source code and object code
-form.</span></p>
-
-<p class=MsoNormal style='margin-left:.5in'><span style='font-size:10.0pt'>b)
-Subject to the terms of this Agreement, each Contributor hereby grants
-Recipient a non-exclusive, worldwide,<span style='color:green'> </span>royalty-free
-patent license under Licensed Patents to make, use, sell, offer to sell, import
-and otherwise transfer the Contribution of such Contributor, if any, in source
-code and object code form. This patent license shall apply to the combination
-of the Contribution and the Program if, at the time the Contribution is added
-by the Contributor, such addition of the Contribution causes such combination
-to be covered by the Licensed Patents. The patent license shall not apply to
-any other combinations which include the Contribution. No hardware per se is
-licensed hereunder. </span></p>
-
-<p class=MsoNormal style='margin-left:.5in'><span style='font-size:10.0pt'>c)
-Recipient understands that although each Contributor grants the licenses to its
-Contributions set forth herein, no assurances are provided by any Contributor
-that the Program does not infringe the patent or other intellectual property
-rights of any other entity. Each Contributor disclaims any liability to Recipient
-for claims brought by any other entity based on infringement of intellectual
-property rights or otherwise. As a condition to exercising the rights and
-licenses granted hereunder, each Recipient hereby assumes sole responsibility
-to secure any other intellectual property rights needed, if any. For example,
-if a third party patent license is required to allow Recipient to distribute
-the Program, it is Recipient's responsibility to acquire that license before
-distributing the Program.</span></p>
-
-<p class=MsoNormal style='margin-left:.5in'><span style='font-size:10.0pt'>d)
-Each Contributor represents that to its knowledge it has sufficient copyright
-rights in its Contribution, if any, to grant the copyright license set forth in
-this Agreement. </span></p>
-
-<p><b><span style='font-size:10.0pt'>3. REQUIREMENTS</span></b> </p>
-
-<p><span style='font-size:10.0pt'>A Contributor may choose to distribute the
-Program in object code form under its own license agreement, provided that:</span>
-</p>
-
-<p class=MsoNormal style='margin-left:.5in'><span style='font-size:10.0pt'>a)
-it complies with the terms and conditions of this Agreement; and</span></p>
-
-<p class=MsoNormal style='margin-left:.5in'><span style='font-size:10.0pt'>b)
-its license agreement:</span></p>
-
-<p class=MsoNormal style='margin-left:.5in'><span style='font-size:10.0pt'>i)
-effectively disclaims on behalf of all Contributors all warranties and
-conditions, express and implied, including warranties or conditions of title
-and non-infringement, and implied warranties or conditions of merchantability
-and fitness for a particular purpose; </span></p>
-
-<p class=MsoNormal style='margin-left:.5in'><span style='font-size:10.0pt'>ii)
-effectively excludes on behalf of all Contributors all liability for damages,
-including direct, indirect, special, incidental and consequential damages, such
-as lost profits; </span></p>
-
-<p class=MsoNormal style='margin-left:.5in'><span style='font-size:10.0pt'>iii)
-states that any provisions which differ from this Agreement are offered by that
-Contributor alone and not by any other party; and</span></p>
-
-<p class=MsoNormal style='margin-left:.5in'><span style='font-size:10.0pt'>iv)
-states that source code for the Program is available from such Contributor, and
-informs licensees how to obtain it in a reasonable manner on or through a
-medium customarily used for software exchange.<span style='color:blue'> </span></span></p>
-
-<p><span style='font-size:10.0pt'>When the Program is made available in source
-code form:</span> </p>
-
-<p class=MsoNormal style='margin-left:.5in'><span style='font-size:10.0pt'>a)
-it must be made available under this Agreement; and </span></p>
-
-<p class=MsoNormal style='margin-left:.5in'><span style='font-size:10.0pt'>b) a
-copy of this Agreement must be included with each copy of the Program. </span></p>
-
-<p><span style='font-size:10.0pt'>Contributors may not remove or alter any
-copyright notices contained within the Program. </span></p>
-
-<p><span style='font-size:10.0pt'>Each Contributor must identify itself as the
-originator of its Contribution, if any, in a manner that reasonably allows
-subsequent Recipients to identify the originator of the Contribution. </span></p>
-
-<p><b><span style='font-size:10.0pt'>4. COMMERCIAL DISTRIBUTION</span></b> </p>
-
-<p><span style='font-size:10.0pt'>Commercial distributors of software may
-accept certain responsibilities with respect to end users, business partners
-and the like. While this license is intended to facilitate the commercial use
-of the Program, the Contributor who includes the Program in a commercial
-product offering should do so in a manner which does not create potential
-liability for other Contributors. Therefore, if a Contributor includes the
-Program in a commercial product offering, such Contributor (&quot;Commercial
-Contributor&quot;) hereby agrees to defend and indemnify every other
-Contributor (&quot;Indemnified Contributor&quot;) against any losses, damages and
-costs (collectively &quot;Losses&quot;) arising from claims, lawsuits and other
-legal actions brought by a third party against the Indemnified Contributor to
-the extent caused by the acts or omissions of such Commercial Contributor in
-connection with its distribution of the Program in a commercial product
-offering. The obligations in this section do not apply to any claims or Losses
-relating to any actual or alleged intellectual property infringement. In order
-to qualify, an Indemnified Contributor must: a) promptly notify the Commercial
-Contributor in writing of such claim, and b) allow the Commercial Contributor
-to control, and cooperate with the Commercial Contributor in, the defense and
-any related settlement negotiations. The Indemnified Contributor may participate
-in any such claim at its own expense.</span> </p>
-
-<p><span style='font-size:10.0pt'>For example, a Contributor might include the
-Program in a commercial product offering, Product X. That Contributor is then a
-Commercial Contributor. If that Commercial Contributor then makes performance
-claims, or offers warranties related to Product X, those performance claims and
-warranties are such Commercial Contributor's responsibility alone. Under this
-section, the Commercial Contributor would have to defend claims against the
-other Contributors related to those performance claims and warranties, and if a
-court requires any other Contributor to pay any damages as a result, the
-Commercial Contributor must pay those damages.</span> </p>
-
-<p><b><span style='font-size:10.0pt'>5. NO WARRANTY</span></b> </p>
-
-<p><span style='font-size:10.0pt'>EXCEPT AS EXPRESSLY SET FORTH IN THIS
-AGREEMENT, THE PROGRAM IS PROVIDED ON AN &quot;AS IS&quot; BASIS, WITHOUT
-WARRANTIES OR CONDITIONS OF ANY KIND, EITHER EXPRESS OR IMPLIED INCLUDING,
-WITHOUT LIMITATION, ANY WARRANTIES OR CONDITIONS OF TITLE, NON-INFRINGEMENT,
-MERCHANTABILITY OR FITNESS FOR A PARTICULAR PURPOSE. Each Recipient is solely
-responsible for determining the appropriateness of using and distributing the
-Program and assumes all risks associated with its exercise of rights under this
-Agreement , including but not limited to the risks and costs of program errors,
-compliance with applicable laws, damage to or loss of data, programs or
-equipment, and unavailability or interruption of operations. </span></p>
-
-<p><b><span style='font-size:10.0pt'>6. DISCLAIMER OF LIABILITY</span></b> </p>
-
-<p><span style='font-size:10.0pt'>EXCEPT AS EXPRESSLY SET FORTH IN THIS
-AGREEMENT, NEITHER RECIPIENT NOR ANY CONTRIBUTORS SHALL HAVE ANY LIABILITY FOR
-ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES
-(INCLUDING WITHOUT LIMITATION LOST PROFITS), HOWEVER CAUSED AND ON ANY THEORY
-OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING
-NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OR DISTRIBUTION OF
-THE PROGRAM OR THE EXERCISE OF ANY RIGHTS GRANTED HEREUNDER, EVEN IF ADVISED OF
-THE POSSIBILITY OF SUCH DAMAGES.</span> </p>
-
-<p><b><span style='font-size:10.0pt'>7. GENERAL</span></b> </p>
-
-<p><span style='font-size:10.0pt'>If any provision of this Agreement is invalid
-or unenforceable under applicable law, it shall not affect the validity or
-enforceability of the remainder of the terms of this Agreement, and without
-further action by the parties hereto, such provision shall be reformed to the
-minimum extent necessary to make such provision valid and enforceable.</span> </p>
-
-<p><span style='font-size:10.0pt'>If Recipient institutes patent litigation
-against any entity (including a cross-claim or counterclaim in a lawsuit)
-alleging that the Program itself (excluding combinations of the Program with
-other software or hardware) infringes such Recipient's patent(s), then such
-Recipient's rights granted under Section 2(b) shall terminate as of the date
-such litigation is filed. </span></p>
-
-<p><span style='font-size:10.0pt'>All Recipient's rights under this Agreement
-shall terminate if it fails to comply with any of the material terms or
-conditions of this Agreement and does not cure such failure in a reasonable
-period of time after becoming aware of such noncompliance. If all Recipient's
-rights under this Agreement terminate, Recipient agrees to cease use and
-distribution of the Program as soon as reasonably practicable. However,
-Recipient's obligations under this Agreement and any licenses granted by
-Recipient relating to the Program shall continue and survive. </span></p>
-
-<p><span style='font-size:10.0pt'>Everyone is permitted to copy and distribute
-copies of this Agreement, but in order to avoid inconsistency the Agreement is
-copyrighted and may only be modified in the following manner. The Agreement
-Steward reserves the right to publish new versions (including revisions) of
-this Agreement from time to time. No one other than the Agreement Steward has
-the right to modify this Agreement. The Eclipse Foundation is the initial
-Agreement Steward. The Eclipse Foundation may assign the responsibility to
-serve as the Agreement Steward to a suitable separate entity. Each new version
-of the Agreement will be given a distinguishing version number. The Program
-(including Contributions) may always be distributed subject to the version of
-the Agreement under which it was received. In addition, after a new version of
-the Agreement is published, Contributor may elect to distribute the Program
-(including its Contributions) under the new version. Except as expressly stated
-in Sections 2(a) and 2(b) above, Recipient receives no rights or licenses to
-the intellectual property of any Contributor under this Agreement, whether
-expressly, by implication, estoppel or otherwise. All rights in the Program not
-expressly granted under this Agreement are reserved.</span> </p>
-
-<p><span style='font-size:10.0pt'>This Agreement is governed by the laws of the
-State of New York and the intellectual property laws of the United States of
-America. No party to this Agreement will bring a legal action under this
-Agreement more than one year after the cause of action arose. Each party waives
-its rights to a jury trial in any resulting litigation.</span> </p>
-
-<p class=MsoNormal><![if !supportEmptyParas]>&nbsp;<![endif]><o:p></o:p></p>
-
-</div>
-
-</body>
-
-</html>
diff --git a/jpa/features/org.eclipse.jpt.eclipselink.feature/sourceTemplateBundle/license.html b/jpa/features/org.eclipse.jpt.eclipselink.feature/sourceTemplateBundle/license.html
deleted file mode 100644
index 14b1d50265..0000000000
--- a/jpa/features/org.eclipse.jpt.eclipselink.feature/sourceTemplateBundle/license.html
+++ /dev/null
@@ -1,83 +0,0 @@
-<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.0//EN">
-<html>
-<head>
-<meta http-equiv=Content-Type content="text/html; charset=iso-8859-1">
-<title>Eclipse.org Software User Agreement</title>
-</head>
-
-<body lang="EN-US" link=blue vlink=purple>
-<h2>Eclipse Foundation Software User Agreement</h2>
-<p>June 06, 2007</p>
-
-<h3>Usage Of Content</h3>
-
-<p>THE ECLIPSE FOUNDATION MAKES AVAILABLE SOFTWARE, DOCUMENTATION, INFORMATION AND/OR OTHER MATERIALS FOR OPEN SOURCE PROJECTS
- (COLLECTIVELY &quot;CONTENT&quot;). USE OF THE CONTENT IS GOVERNED BY THE TERMS AND CONDITIONS OF THIS AGREEMENT AND/OR THE TERMS AND
- CONDITIONS OF LICENSE AGREEMENTS OR NOTICES INDICATED OR REFERENCED BELOW. BY USING THE CONTENT, YOU AGREE THAT YOUR USE
- OF THE CONTENT IS GOVERNED BY THIS AGREEMENT AND/OR THE TERMS AND CONDITIONS OF ANY APPLICABLE LICENSE AGREEMENTS OR
- NOTICES INDICATED OR REFERENCED BELOW. IF YOU DO NOT AGREE TO THE TERMS AND CONDITIONS OF THIS AGREEMENT AND THE TERMS AND
- CONDITIONS OF ANY APPLICABLE LICENSE AGREEMENTS OR NOTICES INDICATED OR REFERENCED BELOW, THEN YOU MAY NOT USE THE CONTENT.</p>
-
-<h3>Applicable Licenses</h3>
-
-<p>Unless otherwise indicated, all Content made available by the Eclipse Foundation is provided to you under the terms and conditions of the Eclipse Public License Version 1.0
- (&quot;EPL&quot;). A copy of the EPL is provided with this Content and is also available at <a href="http://www.eclipse.org/legal/epl-v10.html">http://www.eclipse.org/legal/epl-v10.html</a>.
- For purposes of the EPL, &quot;Program&quot; will mean the Content.</p>
-
-<p>Content includes, but is not limited to, source code, object code, documentation and other files maintained in the Eclipse.org CVS repository (&quot;Repository&quot;) in CVS
- modules (&quot;Modules&quot;) and made available as downloadable archives (&quot;Downloads&quot;).</p>
-
-<ul>
- <li>Content may be structured and packaged into modules to facilitate delivering, extending, and upgrading the Content. Typical modules may include plug-ins (&quot;Plug-ins&quot;), plug-in fragments (&quot;Fragments&quot;), and features (&quot;Features&quot;).</li>
- <li>Each Plug-in or Fragment may be packaged as a sub-directory or JAR (Java&trade; ARchive) in a directory named &quot;plugins&quot;.</li>
- <li>A Feature is a bundle of one or more Plug-ins and/or Fragments and associated material. Each Feature may be packaged as a sub-directory in a directory named &quot;features&quot;. Within a Feature, files named &quot;feature.xml&quot; may contain a list of the names and version numbers of the Plug-ins
- and/or Fragments associated with that Feature.</li>
- <li>Features may also include other Features (&quot;Included Features&quot;). Within a Feature, files named &quot;feature.xml&quot; may contain a list of the names and version numbers of Included Features.</li>
-</ul>
-
-<p>The terms and conditions governing Plug-ins and Fragments should be contained in files named &quot;about.html&quot; (&quot;Abouts&quot;). The terms and conditions governing Features and
-Included Features should be contained in files named &quot;license.html&quot; (&quot;Feature Licenses&quot;). Abouts and Feature Licenses may be located in any directory of a Download or Module
-including, but not limited to the following locations:</p>
-
-<ul>
- <li>The top-level (root) directory</li>
- <li>Plug-in and Fragment directories</li>
- <li>Inside Plug-ins and Fragments packaged as JARs</li>
- <li>Sub-directories of the directory named &quot;src&quot; of certain Plug-ins</li>
- <li>Feature directories</li>
-</ul>
-
-<p>Note: if a Feature made available by the Eclipse Foundation is installed using the Eclipse Update Manager, you must agree to a license (&quot;Feature Update License&quot;) during the
-installation process. If the Feature contains Included Features, the Feature Update License should either provide you with the terms and conditions governing the Included Features or
-inform you where you can locate them. Feature Update Licenses may be found in the &quot;license&quot; property of files named &quot;feature.properties&quot; found within a Feature.
-Such Abouts, Feature Licenses, and Feature Update Licenses contain the terms and conditions (or references to such terms and conditions) that govern your use of the associated Content in
-that directory.</p>
-
-<p>THE ABOUTS, FEATURE LICENSES, AND FEATURE UPDATE LICENSES MAY REFER TO THE EPL OR OTHER LICENSE AGREEMENTS, NOTICES OR TERMS AND CONDITIONS. SOME OF THESE
-OTHER LICENSE AGREEMENTS MAY INCLUDE (BUT ARE NOT LIMITED TO):</p>
-
-<ul>
- <li>Common Public License Version 1.0 (available at <a href="http://www.eclipse.org/legal/cpl-v10.html">http://www.eclipse.org/legal/cpl-v10.html</a>)</li>
- <li>Apache Software License 1.1 (available at <a href="http://www.apache.org/licenses/LICENSE">http://www.apache.org/licenses/LICENSE</a>)</li>
- <li>Apache Software License 2.0 (available at <a href="http://www.apache.org/licenses/LICENSE-2.0">http://www.apache.org/licenses/LICENSE-2.0</a>)</li>
- <li>IBM Public License 1.0 (available at <a href="http://oss.software.ibm.com/developerworks/opensource/license10.html">http://oss.software.ibm.com/developerworks/opensource/license10.html</a>)</li>
- <li>Metro Link Public License 1.00 (available at <a href="http://www.opengroup.org/openmotif/supporters/metrolink/license.html">http://www.opengroup.org/openmotif/supporters/metrolink/license.html</a>)</li>
- <li>Mozilla Public License Version 1.1 (available at <a href="http://www.mozilla.org/MPL/MPL-1.1.html">http://www.mozilla.org/MPL/MPL-1.1.html</a>)</li>
-
- <LI>Common Development and Distribution License (CDDL) Version 1.0 (available at <A
- href="http://www.sun.com/cddl/cddl.html">http://www.sun.com/cddl/cddl.html)</A>
- </LI>
-</UL>
-
-<p>IT IS YOUR OBLIGATION TO READ AND ACCEPT ALL SUCH TERMS AND CONDITIONS PRIOR TO USE OF THE CONTENT. If no About, Feature License, or Feature Update License is provided, please
-contact the Eclipse Foundation to determine what terms and conditions govern that particular Content.</p>
-
-<h3>Cryptography</h3>
-
-<p>Content may contain encryption software. The country in which you are currently may have restrictions on the import, possession, and use, and/or re-export to
- another country, of encryption software. BEFORE using any encryption software, please check the country's laws, regulations and policies concerning the import,
- possession, or use, and re-export of encryption software, to see if this is permitted.</p>
-
-<small>Java and all Java-based trademarks are trademarks of Sun Microsystems, Inc. in the United States, other countries, or both.</small>
-</body>
-</html>
diff --git a/jpa/features/org.eclipse.jpt.eclipselink.feature/sourceTemplateBundle/plugin.properties b/jpa/features/org.eclipse.jpt.eclipselink.feature/sourceTemplateBundle/plugin.properties
deleted file mode 100644
index d0d5f1c727..0000000000
--- a/jpa/features/org.eclipse.jpt.eclipselink.feature/sourceTemplateBundle/plugin.properties
+++ /dev/null
@@ -1,13 +0,0 @@
-###############################################################################
-# Copyright (c) 2008 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
-#
-# Contributors:
-# Oracle. - initial API and implementation
-###############################################################################
-
-pluginName = Java Persistence API Tools - EclipseLink Support
-providerName = Eclipse.org
diff --git a/jpa/features/org.eclipse.jpt.eclipselink.feature/sourceTemplateFeature/build.properties b/jpa/features/org.eclipse.jpt.eclipselink.feature/sourceTemplateFeature/build.properties
deleted file mode 100644
index 53abe6605b..0000000000
--- a/jpa/features/org.eclipse.jpt.eclipselink.feature/sourceTemplateFeature/build.properties
+++ /dev/null
@@ -1,16 +0,0 @@
-###############################################################################
-# Copyright (c) 2008 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
-#
-# Contributors:
-# Oracle - initial API and implementation
-###############################################################################
-bin.includes = \
- epl-v10.html,\
- eclipse_update_120.jpg,\
- feature.xml,\
- feature.properties,\
- license.html
diff --git a/jpa/features/org.eclipse.jpt.eclipselink.feature/sourceTemplateFeature/eclipse_update_120.jpg b/jpa/features/org.eclipse.jpt.eclipselink.feature/sourceTemplateFeature/eclipse_update_120.jpg
deleted file mode 100644
index bfdf708ad6..0000000000
--- a/jpa/features/org.eclipse.jpt.eclipselink.feature/sourceTemplateFeature/eclipse_update_120.jpg
+++ /dev/null
Binary files differ
diff --git a/jpa/features/org.eclipse.jpt.eclipselink.feature/sourceTemplateFeature/epl-v10.html b/jpa/features/org.eclipse.jpt.eclipselink.feature/sourceTemplateFeature/epl-v10.html
deleted file mode 100644
index 022ad2955b..0000000000
--- a/jpa/features/org.eclipse.jpt.eclipselink.feature/sourceTemplateFeature/epl-v10.html
+++ /dev/null
@@ -1,328 +0,0 @@
-<html xmlns:o="urn:schemas-microsoft-com:office:office"
-xmlns:w="urn:schemas-microsoft-com:office:word"
-xmlns="http://www.w3.org/TR/REC-html40">
-
-<head>
-<meta http-equiv=Content-Type content="text/html; charset=windows-1252">
-<meta name=ProgId content=Word.Document>
-<meta name=Generator content="Microsoft Word 9">
-<meta name=Originator content="Microsoft Word 9">
-<link rel=File-List
-href="./Eclipse%20EPL%202003_11_10%20Final_files/filelist.xml">
-<title>Eclipse Public License - Version 1.0</title>
-<!--[if gte mso 9]><xml>
- <o:DocumentProperties>
- <o:Revision>2</o:Revision>
- <o:TotalTime>3</o:TotalTime>
- <o:Created>2004-03-05T23:03:00Z</o:Created>
- <o:LastSaved>2004-03-05T23:03:00Z</o:LastSaved>
- <o:Pages>4</o:Pages>
- <o:Words>1626</o:Words>
- <o:Characters>9270</o:Characters>
- <o:Lines>77</o:Lines>
- <o:Paragraphs>18</o:Paragraphs>
- <o:CharactersWithSpaces>11384</o:CharactersWithSpaces>
- <o:Version>9.4402</o:Version>
- </o:DocumentProperties>
-</xml><![endif]--><!--[if gte mso 9]><xml>
- <w:WordDocument>
- <w:TrackRevisions/>
- </w:WordDocument>
-</xml><![endif]-->
-<style>
-<!--
- /* Font Definitions */
-@font-face
- {font-family:Tahoma;
- panose-1:2 11 6 4 3 5 4 4 2 4;
- mso-font-charset:0;
- mso-generic-font-family:swiss;
- mso-font-pitch:variable;
- mso-font-signature:553679495 -2147483648 8 0 66047 0;}
- /* Style Definitions */
-p.MsoNormal, li.MsoNormal, div.MsoNormal
- {mso-style-parent:"";
- margin:0in;
- margin-bottom:.0001pt;
- mso-pagination:widow-orphan;
- font-size:12.0pt;
- font-family:"Times New Roman";
- mso-fareast-font-family:"Times New Roman";}
-p
- {margin-right:0in;
- mso-margin-top-alt:auto;
- mso-margin-bottom-alt:auto;
- margin-left:0in;
- mso-pagination:widow-orphan;
- font-size:12.0pt;
- font-family:"Times New Roman";
- mso-fareast-font-family:"Times New Roman";}
-p.BalloonText, li.BalloonText, div.BalloonText
- {mso-style-name:"Balloon Text";
- margin:0in;
- margin-bottom:.0001pt;
- mso-pagination:widow-orphan;
- font-size:8.0pt;
- font-family:Tahoma;
- mso-fareast-font-family:"Times New Roman";}
-@page Section1
- {size:8.5in 11.0in;
- margin:1.0in 1.25in 1.0in 1.25in;
- mso-header-margin:.5in;
- mso-footer-margin:.5in;
- mso-paper-source:0;}
-div.Section1
- {page:Section1;}
--->
-</style>
-</head>
-
-<body lang=EN-US style='tab-interval:.5in'>
-
-<div class=Section1>
-
-<p align=center style='text-align:center'><b>Eclipse Public License - v 1.0</b>
-</p>
-
-<p><span style='font-size:10.0pt'>THE ACCOMPANYING PROGRAM IS PROVIDED UNDER
-THE TERMS OF THIS ECLIPSE PUBLIC LICENSE (&quot;AGREEMENT&quot;). ANY USE,
-REPRODUCTION OR DISTRIBUTION OF THE PROGRAM CONSTITUTES RECIPIENT'S ACCEPTANCE
-OF THIS AGREEMENT.</span> </p>
-
-<p><b><span style='font-size:10.0pt'>1. DEFINITIONS</span></b> </p>
-
-<p><span style='font-size:10.0pt'>&quot;Contribution&quot; means:</span> </p>
-
-<p class=MsoNormal style='margin-left:.5in'><span style='font-size:10.0pt'>a)
-in the case of the initial Contributor, the initial code and documentation
-distributed under this Agreement, and<br clear=left>
-b) in the case of each subsequent Contributor:</span></p>
-
-<p class=MsoNormal style='margin-left:.5in'><span style='font-size:10.0pt'>i)
-changes to the Program, and</span></p>
-
-<p class=MsoNormal style='margin-left:.5in'><span style='font-size:10.0pt'>ii)
-additions to the Program;</span></p>
-
-<p class=MsoNormal style='margin-left:.5in'><span style='font-size:10.0pt'>where
-such changes and/or additions to the Program originate from and are distributed
-by that particular Contributor. A Contribution 'originates' from a Contributor
-if it was added to the Program by such Contributor itself or anyone acting on
-such Contributor's behalf. Contributions do not include additions to the
-Program which: (i) are separate modules of software distributed in conjunction
-with the Program under their own license agreement, and (ii) are not derivative
-works of the Program. </span></p>
-
-<p><span style='font-size:10.0pt'>&quot;Contributor&quot; means any person or
-entity that distributes the Program.</span> </p>
-
-<p><span style='font-size:10.0pt'>&quot;Licensed Patents &quot; mean patent
-claims licensable by a Contributor which are necessarily infringed by the use
-or sale of its Contribution alone or when combined with the Program. </span></p>
-
-<p><span style='font-size:10.0pt'>&quot;Program&quot; means the Contributions
-distributed in accordance with this Agreement.</span> </p>
-
-<p><span style='font-size:10.0pt'>&quot;Recipient&quot; means anyone who
-receives the Program under this Agreement, including all Contributors.</span> </p>
-
-<p><b><span style='font-size:10.0pt'>2. GRANT OF RIGHTS</span></b> </p>
-
-<p class=MsoNormal style='margin-left:.5in'><span style='font-size:10.0pt'>a)
-Subject to the terms of this Agreement, each Contributor hereby grants Recipient
-a non-exclusive, worldwide, royalty-free copyright license to<span
-style='color:red'> </span>reproduce, prepare derivative works of, publicly
-display, publicly perform, distribute and sublicense the Contribution of such
-Contributor, if any, and such derivative works, in source code and object code
-form.</span></p>
-
-<p class=MsoNormal style='margin-left:.5in'><span style='font-size:10.0pt'>b)
-Subject to the terms of this Agreement, each Contributor hereby grants
-Recipient a non-exclusive, worldwide,<span style='color:green'> </span>royalty-free
-patent license under Licensed Patents to make, use, sell, offer to sell, import
-and otherwise transfer the Contribution of such Contributor, if any, in source
-code and object code form. This patent license shall apply to the combination
-of the Contribution and the Program if, at the time the Contribution is added
-by the Contributor, such addition of the Contribution causes such combination
-to be covered by the Licensed Patents. The patent license shall not apply to
-any other combinations which include the Contribution. No hardware per se is
-licensed hereunder. </span></p>
-
-<p class=MsoNormal style='margin-left:.5in'><span style='font-size:10.0pt'>c)
-Recipient understands that although each Contributor grants the licenses to its
-Contributions set forth herein, no assurances are provided by any Contributor
-that the Program does not infringe the patent or other intellectual property
-rights of any other entity. Each Contributor disclaims any liability to Recipient
-for claims brought by any other entity based on infringement of intellectual
-property rights or otherwise. As a condition to exercising the rights and
-licenses granted hereunder, each Recipient hereby assumes sole responsibility
-to secure any other intellectual property rights needed, if any. For example,
-if a third party patent license is required to allow Recipient to distribute
-the Program, it is Recipient's responsibility to acquire that license before
-distributing the Program.</span></p>
-
-<p class=MsoNormal style='margin-left:.5in'><span style='font-size:10.0pt'>d)
-Each Contributor represents that to its knowledge it has sufficient copyright
-rights in its Contribution, if any, to grant the copyright license set forth in
-this Agreement. </span></p>
-
-<p><b><span style='font-size:10.0pt'>3. REQUIREMENTS</span></b> </p>
-
-<p><span style='font-size:10.0pt'>A Contributor may choose to distribute the
-Program in object code form under its own license agreement, provided that:</span>
-</p>
-
-<p class=MsoNormal style='margin-left:.5in'><span style='font-size:10.0pt'>a)
-it complies with the terms and conditions of this Agreement; and</span></p>
-
-<p class=MsoNormal style='margin-left:.5in'><span style='font-size:10.0pt'>b)
-its license agreement:</span></p>
-
-<p class=MsoNormal style='margin-left:.5in'><span style='font-size:10.0pt'>i)
-effectively disclaims on behalf of all Contributors all warranties and
-conditions, express and implied, including warranties or conditions of title
-and non-infringement, and implied warranties or conditions of merchantability
-and fitness for a particular purpose; </span></p>
-
-<p class=MsoNormal style='margin-left:.5in'><span style='font-size:10.0pt'>ii)
-effectively excludes on behalf of all Contributors all liability for damages,
-including direct, indirect, special, incidental and consequential damages, such
-as lost profits; </span></p>
-
-<p class=MsoNormal style='margin-left:.5in'><span style='font-size:10.0pt'>iii)
-states that any provisions which differ from this Agreement are offered by that
-Contributor alone and not by any other party; and</span></p>
-
-<p class=MsoNormal style='margin-left:.5in'><span style='font-size:10.0pt'>iv)
-states that source code for the Program is available from such Contributor, and
-informs licensees how to obtain it in a reasonable manner on or through a
-medium customarily used for software exchange.<span style='color:blue'> </span></span></p>
-
-<p><span style='font-size:10.0pt'>When the Program is made available in source
-code form:</span> </p>
-
-<p class=MsoNormal style='margin-left:.5in'><span style='font-size:10.0pt'>a)
-it must be made available under this Agreement; and </span></p>
-
-<p class=MsoNormal style='margin-left:.5in'><span style='font-size:10.0pt'>b) a
-copy of this Agreement must be included with each copy of the Program. </span></p>
-
-<p><span style='font-size:10.0pt'>Contributors may not remove or alter any
-copyright notices contained within the Program. </span></p>
-
-<p><span style='font-size:10.0pt'>Each Contributor must identify itself as the
-originator of its Contribution, if any, in a manner that reasonably allows
-subsequent Recipients to identify the originator of the Contribution. </span></p>
-
-<p><b><span style='font-size:10.0pt'>4. COMMERCIAL DISTRIBUTION</span></b> </p>
-
-<p><span style='font-size:10.0pt'>Commercial distributors of software may
-accept certain responsibilities with respect to end users, business partners
-and the like. While this license is intended to facilitate the commercial use
-of the Program, the Contributor who includes the Program in a commercial
-product offering should do so in a manner which does not create potential
-liability for other Contributors. Therefore, if a Contributor includes the
-Program in a commercial product offering, such Contributor (&quot;Commercial
-Contributor&quot;) hereby agrees to defend and indemnify every other
-Contributor (&quot;Indemnified Contributor&quot;) against any losses, damages and
-costs (collectively &quot;Losses&quot;) arising from claims, lawsuits and other
-legal actions brought by a third party against the Indemnified Contributor to
-the extent caused by the acts or omissions of such Commercial Contributor in
-connection with its distribution of the Program in a commercial product
-offering. The obligations in this section do not apply to any claims or Losses
-relating to any actual or alleged intellectual property infringement. In order
-to qualify, an Indemnified Contributor must: a) promptly notify the Commercial
-Contributor in writing of such claim, and b) allow the Commercial Contributor
-to control, and cooperate with the Commercial Contributor in, the defense and
-any related settlement negotiations. The Indemnified Contributor may participate
-in any such claim at its own expense.</span> </p>
-
-<p><span style='font-size:10.0pt'>For example, a Contributor might include the
-Program in a commercial product offering, Product X. That Contributor is then a
-Commercial Contributor. If that Commercial Contributor then makes performance
-claims, or offers warranties related to Product X, those performance claims and
-warranties are such Commercial Contributor's responsibility alone. Under this
-section, the Commercial Contributor would have to defend claims against the
-other Contributors related to those performance claims and warranties, and if a
-court requires any other Contributor to pay any damages as a result, the
-Commercial Contributor must pay those damages.</span> </p>
-
-<p><b><span style='font-size:10.0pt'>5. NO WARRANTY</span></b> </p>
-
-<p><span style='font-size:10.0pt'>EXCEPT AS EXPRESSLY SET FORTH IN THIS
-AGREEMENT, THE PROGRAM IS PROVIDED ON AN &quot;AS IS&quot; BASIS, WITHOUT
-WARRANTIES OR CONDITIONS OF ANY KIND, EITHER EXPRESS OR IMPLIED INCLUDING,
-WITHOUT LIMITATION, ANY WARRANTIES OR CONDITIONS OF TITLE, NON-INFRINGEMENT,
-MERCHANTABILITY OR FITNESS FOR A PARTICULAR PURPOSE. Each Recipient is solely
-responsible for determining the appropriateness of using and distributing the
-Program and assumes all risks associated with its exercise of rights under this
-Agreement , including but not limited to the risks and costs of program errors,
-compliance with applicable laws, damage to or loss of data, programs or
-equipment, and unavailability or interruption of operations. </span></p>
-
-<p><b><span style='font-size:10.0pt'>6. DISCLAIMER OF LIABILITY</span></b> </p>
-
-<p><span style='font-size:10.0pt'>EXCEPT AS EXPRESSLY SET FORTH IN THIS
-AGREEMENT, NEITHER RECIPIENT NOR ANY CONTRIBUTORS SHALL HAVE ANY LIABILITY FOR
-ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES
-(INCLUDING WITHOUT LIMITATION LOST PROFITS), HOWEVER CAUSED AND ON ANY THEORY
-OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING
-NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OR DISTRIBUTION OF
-THE PROGRAM OR THE EXERCISE OF ANY RIGHTS GRANTED HEREUNDER, EVEN IF ADVISED OF
-THE POSSIBILITY OF SUCH DAMAGES.</span> </p>
-
-<p><b><span style='font-size:10.0pt'>7. GENERAL</span></b> </p>
-
-<p><span style='font-size:10.0pt'>If any provision of this Agreement is invalid
-or unenforceable under applicable law, it shall not affect the validity or
-enforceability of the remainder of the terms of this Agreement, and without
-further action by the parties hereto, such provision shall be reformed to the
-minimum extent necessary to make such provision valid and enforceable.</span> </p>
-
-<p><span style='font-size:10.0pt'>If Recipient institutes patent litigation
-against any entity (including a cross-claim or counterclaim in a lawsuit)
-alleging that the Program itself (excluding combinations of the Program with
-other software or hardware) infringes such Recipient's patent(s), then such
-Recipient's rights granted under Section 2(b) shall terminate as of the date
-such litigation is filed. </span></p>
-
-<p><span style='font-size:10.0pt'>All Recipient's rights under this Agreement
-shall terminate if it fails to comply with any of the material terms or
-conditions of this Agreement and does not cure such failure in a reasonable
-period of time after becoming aware of such noncompliance. If all Recipient's
-rights under this Agreement terminate, Recipient agrees to cease use and
-distribution of the Program as soon as reasonably practicable. However,
-Recipient's obligations under this Agreement and any licenses granted by
-Recipient relating to the Program shall continue and survive. </span></p>
-
-<p><span style='font-size:10.0pt'>Everyone is permitted to copy and distribute
-copies of this Agreement, but in order to avoid inconsistency the Agreement is
-copyrighted and may only be modified in the following manner. The Agreement
-Steward reserves the right to publish new versions (including revisions) of
-this Agreement from time to time. No one other than the Agreement Steward has
-the right to modify this Agreement. The Eclipse Foundation is the initial
-Agreement Steward. The Eclipse Foundation may assign the responsibility to
-serve as the Agreement Steward to a suitable separate entity. Each new version
-of the Agreement will be given a distinguishing version number. The Program
-(including Contributions) may always be distributed subject to the version of
-the Agreement under which it was received. In addition, after a new version of
-the Agreement is published, Contributor may elect to distribute the Program
-(including its Contributions) under the new version. Except as expressly stated
-in Sections 2(a) and 2(b) above, Recipient receives no rights or licenses to
-the intellectual property of any Contributor under this Agreement, whether
-expressly, by implication, estoppel or otherwise. All rights in the Program not
-expressly granted under this Agreement are reserved.</span> </p>
-
-<p><span style='font-size:10.0pt'>This Agreement is governed by the laws of the
-State of New York and the intellectual property laws of the United States of
-America. No party to this Agreement will bring a legal action under this
-Agreement more than one year after the cause of action arose. Each party waives
-its rights to a jury trial in any resulting litigation.</span> </p>
-
-<p class=MsoNormal><![if !supportEmptyParas]>&nbsp;<![endif]><o:p></o:p></p>
-
-</div>
-
-</body>
-
-</html>
diff --git a/jpa/features/org.eclipse.jpt.eclipselink.feature/sourceTemplateFeature/feature.properties b/jpa/features/org.eclipse.jpt.eclipselink.feature/sourceTemplateFeature/feature.properties
deleted file mode 100644
index 3eab125085..0000000000
--- a/jpa/features/org.eclipse.jpt.eclipselink.feature/sourceTemplateFeature/feature.properties
+++ /dev/null
@@ -1,145 +0,0 @@
-###############################################################################
-# Copyright (c) 2008 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
-#
-# Contributors:
-# Oracle - initial API and implementation
-###############################################################################
-# feature.properties
-# contains externalized strings for feature.xml
-# "%foo" in feature.xml corresponds to the key "foo" in this file
-# java.io.Properties file (ISO 8859-1 with "\" escapes)
-# This file should be translated.
-
-# "featureName" property - name of the feature
-featureName=Dali Java Persistence Tools - EclipseLink Support (Optional)
-
-# "providerName" property - name of the company that provides the feature
-providerName=Eclipse Web Tools Platform
-
-# "updateSiteName" property - label for the update site
-updateSiteName=The Eclipse Web Tools Platform (WTP) Project update site
-
-# "description" property - description of the feature
-description=Source code zips for JPA EclipseLink Support
-
-# "copyright" property - text of the "Feature Update Copyright"
-copyright=\
-Copyright (c) 2006, 2008 Oracle Corporation.\n\
-All rights reserved. This program and the accompanying materials\n\
-are made available under the terms of the Eclipse Public License v1.0\n\
-which accompanies this distribution, and is available at\n\
-http://www.eclipse.org/legal/epl-v10.html\n\
-\n\
-Contributors:\n\
- Oracle - initial API and implementation\n
-################ end of copyright property ####################################
-
-# "licenseURL" property - URL of the "Feature License"
-# do not translate value - just change to point to a locale-specific HTML page
-licenseURL=license.html
-
-# "license" property - text of the "Feature Update License"
-# should be plain text version of license agreement pointed to be "licenseURL"
-license=\
-ECLIPSE FOUNDATION SOFTWARE USER AGREEMENT\n\
-June 06, 2007\n\
-\n\
-Usage Of Content\n\
-\n\
-THE ECLIPSE FOUNDATION MAKES AVAILABLE SOFTWARE, DOCUMENTATION, INFORMATION AND/OR\n\
-OTHER MATERIALS FOR OPEN SOURCE PROJECTS (COLLECTIVELY "CONTENT").\n\
-USE OF THE CONTENT IS GOVERNED BY THE TERMS AND CONDITIONS OF THIS\n\
-AGREEMENT AND/OR THE TERMS AND CONDITIONS OF LICENSE AGREEMENTS OR\n\
-NOTICES INDICATED OR REFERENCED BELOW. BY USING THE CONTENT, YOU\n\
-AGREE THAT YOUR USE OF THE CONTENT IS GOVERNED BY THIS AGREEMENT\n\
-AND/OR THE TERMS AND CONDITIONS OF ANY APPLICABLE LICENSE AGREEMENTS\n\
-OR NOTICES INDICATED OR REFERENCED BELOW. IF YOU DO NOT AGREE TO THE\n\
-TERMS AND CONDITIONS OF THIS AGREEMENT AND THE TERMS AND CONDITIONS\n\
-OF ANY APPLICABLE LICENSE AGREEMENTS OR NOTICES INDICATED OR REFERENCED\n\
-BELOW, THEN YOU MAY NOT USE THE CONTENT.\n\
-\n\
-Applicable Licenses\n\
-\n\
-Unless otherwise indicated, all Content made available by the Eclipse Foundation\n\
-is provided to you under the terms and conditions of the Eclipse Public\n\
-License Version 1.0 ("EPL"). A copy of the EPL is provided with this\n\
-Content and is also available at http://www.eclipse.org/legal/epl-v10.html.\n\
-For purposes of the EPL, "Program" will mean the Content.\n\
-\n\
-Content includes, but is not limited to, source code, object code,\n\
-documentation and other files maintained in the Eclipse.org CVS\n\
-repository ("Repository") in CVS modules ("Modules") and made available\n\
-as downloadable archives ("Downloads").\n\
-\n\
- - Content may be structured and packaged into modules to facilitate delivering,\n\
- extending, and upgrading the Content. Typical modules may include plug-ins ("Plug-ins"),\n\
- plug-in fragments ("Fragments"), and features ("Features").\n\
- - Each Plug-in or Fragment may be packaged as a sub-directory or JAR (Java? ARchive)\n\
- in a directory named "plugins".\n\
- - A Feature is a bundle of one or more Plug-ins and/or Fragments and associated material.\n\
- Each Feature may be packaged as a sub-directory in a directory named "features".\n\
- Within a Feature, files named "feature.xml" may contain a list of the names and version\n\
- numbers of the Plug-ins and/or Fragments associated with that Feature.\n\
- - Features may also include other Features ("Included Features"). Within a Feature, files\n\
- named "feature.xml" may contain a list of the names and version numbers of Included Features.\n\
-\n\
-Features may also include other Features ("Included Features"). Files named\n\
-"feature.xml" may contain a list of the names and version numbers of\n\
-Included Features.\n\
-\n\
-The terms and conditions governing Plug-ins and Fragments should be\n\
-contained in files named "about.html" ("Abouts"). The terms and\n\
-conditions governing Features and Included Features should be contained\n\
-in files named "license.html" ("Feature Licenses"). Abouts and Feature\n\
-Licenses may be located in any directory of a Download or Module\n\
-including, but not limited to the following locations:\n\
-\n\
- - The top-level (root) directory\n\
- - Plug-in and Fragment directories\n\
- - Inside Plug-ins and Fragments packaged as JARs\n\
- - Sub-directories of the directory named "src" of certain Plug-ins\n\
- - Feature directories\n\
-\n\
-Note: if a Feature made available by the Eclipse Foundation is installed using the\n\
-Eclipse Update Manager, you must agree to a license ("Feature Update\n\
-License") during the installation process. If the Feature contains\n\
-Included Features, the Feature Update License should either provide you\n\
-with the terms and conditions governing the Included Features or inform\n\
-you where you can locate them. Feature Update Licenses may be found in\n\
-the "license" property of files named "feature.properties". Such Abouts,\n\
-Feature Licenses and Feature Update Licenses contain the terms and\n\
-conditions (or references to such terms and conditions) that govern your\n\
-use of the associated Content in that directory.\n\
-\n\
-THE ABOUTS, FEATURE LICENSES AND FEATURE UPDATE LICENSES MAY REFER\n\
-TO THE EPL OR OTHER LICENSE AGREEMENTS, NOTICES OR TERMS AND CONDITIONS.\n\
-SOME OF THESE OTHER LICENSE AGREEMENTS MAY INCLUDE (BUT ARE NOT LIMITED TO):\n\
-\n\
- - Common Public License Version 1.0 (available at http://www.eclipse.org/legal/cpl-v10.html)\n\
- - Apache Software License 1.1 (available at http://www.apache.org/licenses/LICENSE)\n\
- - Apache Software License 2.0 (available at http://www.apache.org/licenses/LICENSE-2.0)\n\
- - IBM Public License 1.0 (available at http://oss.software.ibm.com/developerworks/opensource/license10.html)\n\
- - Metro Link Public License 1.00 (available at http://www.opengroup.org/openmotif/supporters/metrolink/license.html)\n\
- - Mozilla Public License Version 1.1 (available at http://www.mozilla.org/MPL/MPL-1.1.html)\n\
- - Common Development and Distribution License (CDDL) Version 1.0 (available at http://www.sun.com/cddl/cddl.html)\n\
-\n\
-IT IS YOUR OBLIGATION TO READ AND ACCEPT ALL SUCH TERMS AND CONDITIONS PRIOR\n\
-TO USE OF THE CONTENT. If no About, Feature License or Feature Update License\n\
-is provided, please contact the Eclipse Foundation to determine what terms and conditions\n\
-govern that particular Content.\n\
-\n\
-Cryptography\n\
-\n\
-Content may contain encryption software. The country in which you are\n\
-currently may have restrictions on the import, possession, and use,\n\
-and/or re-export to another country, of encryption software. BEFORE\n\
-using any encryption software, please check the country's laws,\n\
-regulations and policies concerning the import, possession, or use,\n\
-and re-export of encryption software, to see if this is permitted.\n\
-\n\
-Java and all Java-based trademarks are trademarks of Sun Microsystems, Inc. in the United States, other countries, or both.\n
-########### end of license property ##########################################
diff --git a/jpa/features/org.eclipse.jpt.eclipselink.feature/sourceTemplateFeature/license.html b/jpa/features/org.eclipse.jpt.eclipselink.feature/sourceTemplateFeature/license.html
deleted file mode 100644
index fec4a489ad..0000000000
--- a/jpa/features/org.eclipse.jpt.eclipselink.feature/sourceTemplateFeature/license.html
+++ /dev/null
@@ -1,82 +0,0 @@
-<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.0//EN">
-<html>
-<head>
-<meta http-equiv=Content-Type content="text/html; charset=iso-8859-1">
-<title>Eclipse.org Software User Agreement</title>
-</head>
-
-<body lang="EN-US" link=blue vlink=purple>
-<h2>Eclipse Foundation Software User Agreement</h2>
-<p>June 06, 2007</p>
-
-<h3>Usage Of Content</h3>
-
-<p>THE ECLIPSE FOUNDATION MAKES AVAILABLE SOFTWARE, DOCUMENTATION, INFORMATION AND/OR OTHER MATERIALS FOR OPEN SOURCE PROJECTS
- (COLLECTIVELY &quot;CONTENT&quot;). USE OF THE CONTENT IS GOVERNED BY THE TERMS AND CONDITIONS OF THIS AGREEMENT AND/OR THE TERMS AND
- CONDITIONS OF LICENSE AGREEMENTS OR NOTICES INDICATED OR REFERENCED BELOW. BY USING THE CONTENT, YOU AGREE THAT YOUR USE
- OF THE CONTENT IS GOVERNED BY THIS AGREEMENT AND/OR THE TERMS AND CONDITIONS OF ANY APPLICABLE LICENSE AGREEMENTS OR
- NOTICES INDICATED OR REFERENCED BELOW. IF YOU DO NOT AGREE TO THE TERMS AND CONDITIONS OF THIS AGREEMENT AND THE TERMS AND
- CONDITIONS OF ANY APPLICABLE LICENSE AGREEMENTS OR NOTICES INDICATED OR REFERENCED BELOW, THEN YOU MAY NOT USE THE CONTENT.</p>
-
-<h3>Applicable Licenses</h3>
-
-<p>Unless otherwise indicated, all Content made available by the Eclipse Foundation is provided to you under the terms and conditions of the Eclipse Public License Version 1.0
- (&quot;EPL&quot;). A copy of the EPL is provided with this Content and is also available at <a href="http://www.eclipse.org/legal/epl-v10.html">http://www.eclipse.org/legal/epl-v10.html</a>.
- For purposes of the EPL, &quot;Program&quot; will mean the Content.</p>
-
-<p>Content includes, but is not limited to, source code, object code, documentation and other files maintained in the Eclipse.org CVS repository (&quot;Repository&quot;) in CVS
- modules (&quot;Modules&quot;) and made available as downloadable archives (&quot;Downloads&quot;).</p>
-
-<ul>
- <li>Content may be structured and packaged into modules to facilitate delivering, extending, and upgrading the Content. Typical modules may include plug-ins (&quot;Plug-ins&quot;), plug-in fragments (&quot;Fragments&quot;), and features (&quot;Features&quot;).</li>
- <li>Each Plug-in or Fragment may be packaged as a sub-directory or JAR (Java&trade; ARchive) in a directory named &quot;plugins&quot;.</li>
- <li>A Feature is a bundle of one or more Plug-ins and/or Fragments and associated material. Each Feature may be packaged as a sub-directory in a directory named &quot;features&quot;. Within a Feature, files named &quot;feature.xml&quot; may contain a list of the names and version numbers of the Plug-ins
- and/or Fragments associated with that Feature.</li>
- <li>Features may also include other Features (&quot;Included Features&quot;). Within a Feature, files named &quot;feature.xml&quot; may contain a list of the names and version numbers of Included Features.</li>
-</ul>
-
-<p>The terms and conditions governing Plug-ins and Fragments should be contained in files named &quot;about.html&quot; (&quot;Abouts&quot;). The terms and conditions governing Features and
-Included Features should be contained in files named &quot;license.html&quot; (&quot;Feature Licenses&quot;). Abouts and Feature Licenses may be located in any directory of a Download or Module
-including, but not limited to the following locations:</p>
-
-<ul>
- <li>The top-level (root) directory</li>
- <li>Plug-in and Fragment directories</li>
- <li>Inside Plug-ins and Fragments packaged as JARs</li>
- <li>Sub-directories of the directory named &quot;src&quot; of certain Plug-ins</li>
- <li>Feature directories</li>
-</ul>
-
-<p>Note: if a Feature made available by the Eclipse Foundation is installed using the Eclipse Update Manager, you must agree to a license (&quot;Feature Update License&quot;) during the
-installation process. If the Feature contains Included Features, the Feature Update License should either provide you with the terms and conditions governing the Included Features or
-inform you where you can locate them. Feature Update Licenses may be found in the &quot;license&quot; property of files named &quot;feature.properties&quot; found within a Feature.
-Such Abouts, Feature Licenses, and Feature Update Licenses contain the terms and conditions (or references to such terms and conditions) that govern your use of the associated Content in
-that directory.</p>
-
-<p>THE ABOUTS, FEATURE LICENSES, AND FEATURE UPDATE LICENSES MAY REFER TO THE EPL OR OTHER LICENSE AGREEMENTS, NOTICES OR TERMS AND CONDITIONS. SOME OF THESE
-OTHER LICENSE AGREEMENTS MAY INCLUDE (BUT ARE NOT LIMITED TO):</p>
-
-<ul>
- <li>Common Public License Version 1.0 (available at <a href="http://www.eclipse.org/legal/cpl-v10.html">http://www.eclipse.org/legal/cpl-v10.html</a>)</li>
- <li>Apache Software License 1.1 (available at <a href="http://www.apache.org/licenses/LICENSE">http://www.apache.org/licenses/LICENSE</a>)</li>
- <li>Apache Software License 2.0 (available at <a href="http://www.apache.org/licenses/LICENSE-2.0">http://www.apache.org/licenses/LICENSE-2.0</a>)</li>
- <li>IBM Public License 1.0 (available at <a href="http://oss.software.ibm.com/developerworks/opensource/license10.html">http://oss.software.ibm.com/developerworks/opensource/license10.html</a>)</li>
- <li>Metro Link Public License 1.00 (available at <a href="http://www.opengroup.org/openmotif/supporters/metrolink/license.html">http://www.opengroup.org/openmotif/supporters/metrolink/license.html</a>)</li>
- <li>Mozilla Public License Version 1.1 (available at <a href="http://www.mozilla.org/MPL/MPL-1.1.html">http://www.mozilla.org/MPL/MPL-1.1.html</a>)</li>
- <LI>Common Development and Distribution License (CDDL) Version 1.0 (available at <A
- href="http://www.sun.com/cddl/cddl.html">http://www.sun.com/cddl/cddl.html)</A>
- </LI>
-</UL>
-
-<p>IT IS YOUR OBLIGATION TO READ AND ACCEPT ALL SUCH TERMS AND CONDITIONS PRIOR TO USE OF THE CONTENT. If no About, Feature License, or Feature Update License is provided, please
-contact the Eclipse Foundation to determine what terms and conditions govern that particular Content.</p>
-
-<h3>Cryptography</h3>
-
-<p>Content may contain encryption software. The country in which you are currently may have restrictions on the import, possession, and use, and/or re-export to
- another country, of encryption software. BEFORE using any encryption software, please check the country's laws, regulations and policies concerning the import,
- possession, or use, and re-export of encryption software, to see if this is permitted.</p>
-
-<small>Java and all Java-based trademarks are trademarks of Sun Microsystems, Inc. in the United States, other countries, or both.</small>
-</body>
-</html>
diff --git a/jpa/features/org.eclipse.jpt.eclipselink.feature/sourceTemplatePlugin/about.html b/jpa/features/org.eclipse.jpt.eclipselink.feature/sourceTemplatePlugin/about.html
deleted file mode 100644
index d4916df475..0000000000
--- a/jpa/features/org.eclipse.jpt.eclipselink.feature/sourceTemplatePlugin/about.html
+++ /dev/null
@@ -1,27 +0,0 @@
-<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.0//EN">
-<html>
-<head>
-<title>About</title>
-<meta http-equiv=Content-Type content="text/html; charset=ISO-8859-1">
-</head>
-<body lang="EN-US">
-<h2>About This Content</h2>
-
-<p>June 06, 2007</p>
-<h3>License</h3>
-
-<p>The Eclipse Foundation makes available all content in this plug-in (&quot;Content&quot;). Unless otherwise indicated below, the Content is provided to you under the terms and conditions of the
-Eclipse Public License Version 1.0 (&quot;EPL&quot;). A copy of the EPL is available at <a href="http://www.eclipse.org/legal/epl-v10.html">http://www.eclipse.org/legal/epl-v10.html</a>.
-For purposes of the EPL, &quot;Program&quot; will mean the Content.</p>
-
-<p>If you did not receive this Content directly from the Eclipse Foundation, the Content is being redistributed by another party (&quot;Redistributor&quot;) and different terms and conditions may
-apply to your use of any object code in the Content. Check the Redistributor's license that was provided with the Content. If no such license exists, contact the Redistributor. Unless otherwise
-indicated below, the terms and conditions of the EPL still apply to any source code in the Content.</p>
-
-<h3>Source Code</h3>
-<p>This plug-in contains source code zip files (&quot;Source Zips&quot;) that correspond to binary content in other plug-ins. These Source Zips may be distributed under different license
-agreements and/or notices. Details about these license agreements and notices are contained in &quot;about.html&quot; files (&quot;Abouts&quot;) located in sub-directories in the
-src/ directory of this plug-in. Such Abouts govern your use of the Source Zips in that directory, not the EPL.</p>
-
-</body>
-</html>
diff --git a/jpa/features/org.eclipse.jpt.eclipselink.feature/sourceTemplatePlugin/about.ini b/jpa/features/org.eclipse.jpt.eclipselink.feature/sourceTemplatePlugin/about.ini
deleted file mode 100644
index 2dee36a2e2..0000000000
--- a/jpa/features/org.eclipse.jpt.eclipselink.feature/sourceTemplatePlugin/about.ini
+++ /dev/null
@@ -1,31 +0,0 @@
-# about.ini
-# contains information about a feature
-# java.io.Properties file (ISO 8859-1 with "\" escapes)
-# "%key" are externalized strings defined in about.properties
-# This file does not need to be translated.
-
-# Property "aboutText" contains blurb for "About" dialog (translated)
-aboutText=%blurb
-
-# Property "windowImage" contains path to window icon (16x16)
-# needed for primary features only
-
-# Property "featureImage" contains path to feature image (32x32)
-featureImage=eclipse32.gif
-
-# Property "aboutImage" contains path to product image (500x330 or 115x164)
-# needed for primary features only
-
-# Property "appName" contains name of the application (not translated)
-# needed for primary features only
-
-# Property "welcomePage" contains path to welcome page (special XML-based format)
-# optional
-
-# Property "welcomePerspective" contains the id of the perspective in which the
-# welcome page is to be opened.
-# optional
-
-
-
-
diff --git a/jpa/features/org.eclipse.jpt.eclipselink.feature/sourceTemplatePlugin/about.mappings b/jpa/features/org.eclipse.jpt.eclipselink.feature/sourceTemplatePlugin/about.mappings
deleted file mode 100644
index a28390a75e..0000000000
--- a/jpa/features/org.eclipse.jpt.eclipselink.feature/sourceTemplatePlugin/about.mappings
+++ /dev/null
@@ -1,6 +0,0 @@
-# about.mappings
-# contains fill-ins for about.properties
-# java.io.Properties file (ISO 8859-1 with "\" escapes)
-# This file does not need to be translated.
-
-0=@build@
diff --git a/jpa/features/org.eclipse.jpt.eclipselink.feature/sourceTemplatePlugin/about.properties b/jpa/features/org.eclipse.jpt.eclipselink.feature/sourceTemplatePlugin/about.properties
deleted file mode 100644
index 50c0a9ef9c..0000000000
--- a/jpa/features/org.eclipse.jpt.eclipselink.feature/sourceTemplatePlugin/about.properties
+++ /dev/null
@@ -1,26 +0,0 @@
-###############################################################################
-# Copyright (c) 2008 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
-#
-# Contributors:
-# Oracle - initial API and implementation
-###############################################################################
-# about.properties
-# contains externalized strings for about.ini
-# java.io.Properties file (ISO 8859-1 with "\" escapes)
-# fill-ins are supplied by about.mappings
-# This file should be translated.
-#
-# Do not translate any values surrounded by {}
-
-blurb=Java Persistence API Tools - EclipseLink Support Source\n\
-\n\
-Version: {featureVersion}\n\
-Build id: {0}\n\
-\n\
-(c) Copyright Eclipse contributors and others 2005. All rights reserved.\n\
-Visit http://www.eclipse.org/webtools
-
diff --git a/jpa/features/org.eclipse.jpt.eclipselink.feature/sourceTemplatePlugin/build.properties b/jpa/features/org.eclipse.jpt.eclipselink.feature/sourceTemplatePlugin/build.properties
deleted file mode 100644
index 6dcfcd6269..0000000000
--- a/jpa/features/org.eclipse.jpt.eclipselink.feature/sourceTemplatePlugin/build.properties
+++ /dev/null
@@ -1,21 +0,0 @@
-###############################################################################
-# Copyright (c) 2008 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
-#
-# Contributors:
-# Oracle - initial API and implementation
-###############################################################################
-bin.includes = \
- about.html,\
- about.ini,\
- about.mappings,\
- about.properties,\
- eclipse32.gif,\
- plugin.properties,\
- plugin.xml,\
- src/**,\
- META-INF/
-sourcePlugin = true
diff --git a/jpa/features/org.eclipse.jpt.eclipselink.feature/sourceTemplatePlugin/eclipse32.gif b/jpa/features/org.eclipse.jpt.eclipselink.feature/sourceTemplatePlugin/eclipse32.gif
deleted file mode 100644
index e6ad7ccd75..0000000000
--- a/jpa/features/org.eclipse.jpt.eclipselink.feature/sourceTemplatePlugin/eclipse32.gif
+++ /dev/null
Binary files differ
diff --git a/jpa/features/org.eclipse.jpt.eclipselink.feature/sourceTemplatePlugin/eclipse32.png b/jpa/features/org.eclipse.jpt.eclipselink.feature/sourceTemplatePlugin/eclipse32.png
deleted file mode 100644
index 50ae49de24..0000000000
--- a/jpa/features/org.eclipse.jpt.eclipselink.feature/sourceTemplatePlugin/eclipse32.png
+++ /dev/null
Binary files differ
diff --git a/jpa/features/org.eclipse.jpt.eclipselink.feature/sourceTemplatePlugin/eclipse_update_120.jpg b/jpa/features/org.eclipse.jpt.eclipselink.feature/sourceTemplatePlugin/eclipse_update_120.jpg
deleted file mode 100644
index bfdf708ad6..0000000000
--- a/jpa/features/org.eclipse.jpt.eclipselink.feature/sourceTemplatePlugin/eclipse_update_120.jpg
+++ /dev/null
Binary files differ
diff --git a/jpa/features/org.eclipse.jpt.eclipselink.feature/sourceTemplatePlugin/epl-v10.html b/jpa/features/org.eclipse.jpt.eclipselink.feature/sourceTemplatePlugin/epl-v10.html
deleted file mode 100644
index 022ad2955b..0000000000
--- a/jpa/features/org.eclipse.jpt.eclipselink.feature/sourceTemplatePlugin/epl-v10.html
+++ /dev/null
@@ -1,328 +0,0 @@
-<html xmlns:o="urn:schemas-microsoft-com:office:office"
-xmlns:w="urn:schemas-microsoft-com:office:word"
-xmlns="http://www.w3.org/TR/REC-html40">
-
-<head>
-<meta http-equiv=Content-Type content="text/html; charset=windows-1252">
-<meta name=ProgId content=Word.Document>
-<meta name=Generator content="Microsoft Word 9">
-<meta name=Originator content="Microsoft Word 9">
-<link rel=File-List
-href="./Eclipse%20EPL%202003_11_10%20Final_files/filelist.xml">
-<title>Eclipse Public License - Version 1.0</title>
-<!--[if gte mso 9]><xml>
- <o:DocumentProperties>
- <o:Revision>2</o:Revision>
- <o:TotalTime>3</o:TotalTime>
- <o:Created>2004-03-05T23:03:00Z</o:Created>
- <o:LastSaved>2004-03-05T23:03:00Z</o:LastSaved>
- <o:Pages>4</o:Pages>
- <o:Words>1626</o:Words>
- <o:Characters>9270</o:Characters>
- <o:Lines>77</o:Lines>
- <o:Paragraphs>18</o:Paragraphs>
- <o:CharactersWithSpaces>11384</o:CharactersWithSpaces>
- <o:Version>9.4402</o:Version>
- </o:DocumentProperties>
-</xml><![endif]--><!--[if gte mso 9]><xml>
- <w:WordDocument>
- <w:TrackRevisions/>
- </w:WordDocument>
-</xml><![endif]-->
-<style>
-<!--
- /* Font Definitions */
-@font-face
- {font-family:Tahoma;
- panose-1:2 11 6 4 3 5 4 4 2 4;
- mso-font-charset:0;
- mso-generic-font-family:swiss;
- mso-font-pitch:variable;
- mso-font-signature:553679495 -2147483648 8 0 66047 0;}
- /* Style Definitions */
-p.MsoNormal, li.MsoNormal, div.MsoNormal
- {mso-style-parent:"";
- margin:0in;
- margin-bottom:.0001pt;
- mso-pagination:widow-orphan;
- font-size:12.0pt;
- font-family:"Times New Roman";
- mso-fareast-font-family:"Times New Roman";}
-p
- {margin-right:0in;
- mso-margin-top-alt:auto;
- mso-margin-bottom-alt:auto;
- margin-left:0in;
- mso-pagination:widow-orphan;
- font-size:12.0pt;
- font-family:"Times New Roman";
- mso-fareast-font-family:"Times New Roman";}
-p.BalloonText, li.BalloonText, div.BalloonText
- {mso-style-name:"Balloon Text";
- margin:0in;
- margin-bottom:.0001pt;
- mso-pagination:widow-orphan;
- font-size:8.0pt;
- font-family:Tahoma;
- mso-fareast-font-family:"Times New Roman";}
-@page Section1
- {size:8.5in 11.0in;
- margin:1.0in 1.25in 1.0in 1.25in;
- mso-header-margin:.5in;
- mso-footer-margin:.5in;
- mso-paper-source:0;}
-div.Section1
- {page:Section1;}
--->
-</style>
-</head>
-
-<body lang=EN-US style='tab-interval:.5in'>
-
-<div class=Section1>
-
-<p align=center style='text-align:center'><b>Eclipse Public License - v 1.0</b>
-</p>
-
-<p><span style='font-size:10.0pt'>THE ACCOMPANYING PROGRAM IS PROVIDED UNDER
-THE TERMS OF THIS ECLIPSE PUBLIC LICENSE (&quot;AGREEMENT&quot;). ANY USE,
-REPRODUCTION OR DISTRIBUTION OF THE PROGRAM CONSTITUTES RECIPIENT'S ACCEPTANCE
-OF THIS AGREEMENT.</span> </p>
-
-<p><b><span style='font-size:10.0pt'>1. DEFINITIONS</span></b> </p>
-
-<p><span style='font-size:10.0pt'>&quot;Contribution&quot; means:</span> </p>
-
-<p class=MsoNormal style='margin-left:.5in'><span style='font-size:10.0pt'>a)
-in the case of the initial Contributor, the initial code and documentation
-distributed under this Agreement, and<br clear=left>
-b) in the case of each subsequent Contributor:</span></p>
-
-<p class=MsoNormal style='margin-left:.5in'><span style='font-size:10.0pt'>i)
-changes to the Program, and</span></p>
-
-<p class=MsoNormal style='margin-left:.5in'><span style='font-size:10.0pt'>ii)
-additions to the Program;</span></p>
-
-<p class=MsoNormal style='margin-left:.5in'><span style='font-size:10.0pt'>where
-such changes and/or additions to the Program originate from and are distributed
-by that particular Contributor. A Contribution 'originates' from a Contributor
-if it was added to the Program by such Contributor itself or anyone acting on
-such Contributor's behalf. Contributions do not include additions to the
-Program which: (i) are separate modules of software distributed in conjunction
-with the Program under their own license agreement, and (ii) are not derivative
-works of the Program. </span></p>
-
-<p><span style='font-size:10.0pt'>&quot;Contributor&quot; means any person or
-entity that distributes the Program.</span> </p>
-
-<p><span style='font-size:10.0pt'>&quot;Licensed Patents &quot; mean patent
-claims licensable by a Contributor which are necessarily infringed by the use
-or sale of its Contribution alone or when combined with the Program. </span></p>
-
-<p><span style='font-size:10.0pt'>&quot;Program&quot; means the Contributions
-distributed in accordance with this Agreement.</span> </p>
-
-<p><span style='font-size:10.0pt'>&quot;Recipient&quot; means anyone who
-receives the Program under this Agreement, including all Contributors.</span> </p>
-
-<p><b><span style='font-size:10.0pt'>2. GRANT OF RIGHTS</span></b> </p>
-
-<p class=MsoNormal style='margin-left:.5in'><span style='font-size:10.0pt'>a)
-Subject to the terms of this Agreement, each Contributor hereby grants Recipient
-a non-exclusive, worldwide, royalty-free copyright license to<span
-style='color:red'> </span>reproduce, prepare derivative works of, publicly
-display, publicly perform, distribute and sublicense the Contribution of such
-Contributor, if any, and such derivative works, in source code and object code
-form.</span></p>
-
-<p class=MsoNormal style='margin-left:.5in'><span style='font-size:10.0pt'>b)
-Subject to the terms of this Agreement, each Contributor hereby grants
-Recipient a non-exclusive, worldwide,<span style='color:green'> </span>royalty-free
-patent license under Licensed Patents to make, use, sell, offer to sell, import
-and otherwise transfer the Contribution of such Contributor, if any, in source
-code and object code form. This patent license shall apply to the combination
-of the Contribution and the Program if, at the time the Contribution is added
-by the Contributor, such addition of the Contribution causes such combination
-to be covered by the Licensed Patents. The patent license shall not apply to
-any other combinations which include the Contribution. No hardware per se is
-licensed hereunder. </span></p>
-
-<p class=MsoNormal style='margin-left:.5in'><span style='font-size:10.0pt'>c)
-Recipient understands that although each Contributor grants the licenses to its
-Contributions set forth herein, no assurances are provided by any Contributor
-that the Program does not infringe the patent or other intellectual property
-rights of any other entity. Each Contributor disclaims any liability to Recipient
-for claims brought by any other entity based on infringement of intellectual
-property rights or otherwise. As a condition to exercising the rights and
-licenses granted hereunder, each Recipient hereby assumes sole responsibility
-to secure any other intellectual property rights needed, if any. For example,
-if a third party patent license is required to allow Recipient to distribute
-the Program, it is Recipient's responsibility to acquire that license before
-distributing the Program.</span></p>
-
-<p class=MsoNormal style='margin-left:.5in'><span style='font-size:10.0pt'>d)
-Each Contributor represents that to its knowledge it has sufficient copyright
-rights in its Contribution, if any, to grant the copyright license set forth in
-this Agreement. </span></p>
-
-<p><b><span style='font-size:10.0pt'>3. REQUIREMENTS</span></b> </p>
-
-<p><span style='font-size:10.0pt'>A Contributor may choose to distribute the
-Program in object code form under its own license agreement, provided that:</span>
-</p>
-
-<p class=MsoNormal style='margin-left:.5in'><span style='font-size:10.0pt'>a)
-it complies with the terms and conditions of this Agreement; and</span></p>
-
-<p class=MsoNormal style='margin-left:.5in'><span style='font-size:10.0pt'>b)
-its license agreement:</span></p>
-
-<p class=MsoNormal style='margin-left:.5in'><span style='font-size:10.0pt'>i)
-effectively disclaims on behalf of all Contributors all warranties and
-conditions, express and implied, including warranties or conditions of title
-and non-infringement, and implied warranties or conditions of merchantability
-and fitness for a particular purpose; </span></p>
-
-<p class=MsoNormal style='margin-left:.5in'><span style='font-size:10.0pt'>ii)
-effectively excludes on behalf of all Contributors all liability for damages,
-including direct, indirect, special, incidental and consequential damages, such
-as lost profits; </span></p>
-
-<p class=MsoNormal style='margin-left:.5in'><span style='font-size:10.0pt'>iii)
-states that any provisions which differ from this Agreement are offered by that
-Contributor alone and not by any other party; and</span></p>
-
-<p class=MsoNormal style='margin-left:.5in'><span style='font-size:10.0pt'>iv)
-states that source code for the Program is available from such Contributor, and
-informs licensees how to obtain it in a reasonable manner on or through a
-medium customarily used for software exchange.<span style='color:blue'> </span></span></p>
-
-<p><span style='font-size:10.0pt'>When the Program is made available in source
-code form:</span> </p>
-
-<p class=MsoNormal style='margin-left:.5in'><span style='font-size:10.0pt'>a)
-it must be made available under this Agreement; and </span></p>
-
-<p class=MsoNormal style='margin-left:.5in'><span style='font-size:10.0pt'>b) a
-copy of this Agreement must be included with each copy of the Program. </span></p>
-
-<p><span style='font-size:10.0pt'>Contributors may not remove or alter any
-copyright notices contained within the Program. </span></p>
-
-<p><span style='font-size:10.0pt'>Each Contributor must identify itself as the
-originator of its Contribution, if any, in a manner that reasonably allows
-subsequent Recipients to identify the originator of the Contribution. </span></p>
-
-<p><b><span style='font-size:10.0pt'>4. COMMERCIAL DISTRIBUTION</span></b> </p>
-
-<p><span style='font-size:10.0pt'>Commercial distributors of software may
-accept certain responsibilities with respect to end users, business partners
-and the like. While this license is intended to facilitate the commercial use
-of the Program, the Contributor who includes the Program in a commercial
-product offering should do so in a manner which does not create potential
-liability for other Contributors. Therefore, if a Contributor includes the
-Program in a commercial product offering, such Contributor (&quot;Commercial
-Contributor&quot;) hereby agrees to defend and indemnify every other
-Contributor (&quot;Indemnified Contributor&quot;) against any losses, damages and
-costs (collectively &quot;Losses&quot;) arising from claims, lawsuits and other
-legal actions brought by a third party against the Indemnified Contributor to
-the extent caused by the acts or omissions of such Commercial Contributor in
-connection with its distribution of the Program in a commercial product
-offering. The obligations in this section do not apply to any claims or Losses
-relating to any actual or alleged intellectual property infringement. In order
-to qualify, an Indemnified Contributor must: a) promptly notify the Commercial
-Contributor in writing of such claim, and b) allow the Commercial Contributor
-to control, and cooperate with the Commercial Contributor in, the defense and
-any related settlement negotiations. The Indemnified Contributor may participate
-in any such claim at its own expense.</span> </p>
-
-<p><span style='font-size:10.0pt'>For example, a Contributor might include the
-Program in a commercial product offering, Product X. That Contributor is then a
-Commercial Contributor. If that Commercial Contributor then makes performance
-claims, or offers warranties related to Product X, those performance claims and
-warranties are such Commercial Contributor's responsibility alone. Under this
-section, the Commercial Contributor would have to defend claims against the
-other Contributors related to those performance claims and warranties, and if a
-court requires any other Contributor to pay any damages as a result, the
-Commercial Contributor must pay those damages.</span> </p>
-
-<p><b><span style='font-size:10.0pt'>5. NO WARRANTY</span></b> </p>
-
-<p><span style='font-size:10.0pt'>EXCEPT AS EXPRESSLY SET FORTH IN THIS
-AGREEMENT, THE PROGRAM IS PROVIDED ON AN &quot;AS IS&quot; BASIS, WITHOUT
-WARRANTIES OR CONDITIONS OF ANY KIND, EITHER EXPRESS OR IMPLIED INCLUDING,
-WITHOUT LIMITATION, ANY WARRANTIES OR CONDITIONS OF TITLE, NON-INFRINGEMENT,
-MERCHANTABILITY OR FITNESS FOR A PARTICULAR PURPOSE. Each Recipient is solely
-responsible for determining the appropriateness of using and distributing the
-Program and assumes all risks associated with its exercise of rights under this
-Agreement , including but not limited to the risks and costs of program errors,
-compliance with applicable laws, damage to or loss of data, programs or
-equipment, and unavailability or interruption of operations. </span></p>
-
-<p><b><span style='font-size:10.0pt'>6. DISCLAIMER OF LIABILITY</span></b> </p>
-
-<p><span style='font-size:10.0pt'>EXCEPT AS EXPRESSLY SET FORTH IN THIS
-AGREEMENT, NEITHER RECIPIENT NOR ANY CONTRIBUTORS SHALL HAVE ANY LIABILITY FOR
-ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES
-(INCLUDING WITHOUT LIMITATION LOST PROFITS), HOWEVER CAUSED AND ON ANY THEORY
-OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING
-NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OR DISTRIBUTION OF
-THE PROGRAM OR THE EXERCISE OF ANY RIGHTS GRANTED HEREUNDER, EVEN IF ADVISED OF
-THE POSSIBILITY OF SUCH DAMAGES.</span> </p>
-
-<p><b><span style='font-size:10.0pt'>7. GENERAL</span></b> </p>
-
-<p><span style='font-size:10.0pt'>If any provision of this Agreement is invalid
-or unenforceable under applicable law, it shall not affect the validity or
-enforceability of the remainder of the terms of this Agreement, and without
-further action by the parties hereto, such provision shall be reformed to the
-minimum extent necessary to make such provision valid and enforceable.</span> </p>
-
-<p><span style='font-size:10.0pt'>If Recipient institutes patent litigation
-against any entity (including a cross-claim or counterclaim in a lawsuit)
-alleging that the Program itself (excluding combinations of the Program with
-other software or hardware) infringes such Recipient's patent(s), then such
-Recipient's rights granted under Section 2(b) shall terminate as of the date
-such litigation is filed. </span></p>
-
-<p><span style='font-size:10.0pt'>All Recipient's rights under this Agreement
-shall terminate if it fails to comply with any of the material terms or
-conditions of this Agreement and does not cure such failure in a reasonable
-period of time after becoming aware of such noncompliance. If all Recipient's
-rights under this Agreement terminate, Recipient agrees to cease use and
-distribution of the Program as soon as reasonably practicable. However,
-Recipient's obligations under this Agreement and any licenses granted by
-Recipient relating to the Program shall continue and survive. </span></p>
-
-<p><span style='font-size:10.0pt'>Everyone is permitted to copy and distribute
-copies of this Agreement, but in order to avoid inconsistency the Agreement is
-copyrighted and may only be modified in the following manner. The Agreement
-Steward reserves the right to publish new versions (including revisions) of
-this Agreement from time to time. No one other than the Agreement Steward has
-the right to modify this Agreement. The Eclipse Foundation is the initial
-Agreement Steward. The Eclipse Foundation may assign the responsibility to
-serve as the Agreement Steward to a suitable separate entity. Each new version
-of the Agreement will be given a distinguishing version number. The Program
-(including Contributions) may always be distributed subject to the version of
-the Agreement under which it was received. In addition, after a new version of
-the Agreement is published, Contributor may elect to distribute the Program
-(including its Contributions) under the new version. Except as expressly stated
-in Sections 2(a) and 2(b) above, Recipient receives no rights or licenses to
-the intellectual property of any Contributor under this Agreement, whether
-expressly, by implication, estoppel or otherwise. All rights in the Program not
-expressly granted under this Agreement are reserved.</span> </p>
-
-<p><span style='font-size:10.0pt'>This Agreement is governed by the laws of the
-State of New York and the intellectual property laws of the United States of
-America. No party to this Agreement will bring a legal action under this
-Agreement more than one year after the cause of action arose. Each party waives
-its rights to a jury trial in any resulting litigation.</span> </p>
-
-<p class=MsoNormal><![if !supportEmptyParas]>&nbsp;<![endif]><o:p></o:p></p>
-
-</div>
-
-</body>
-
-</html>
diff --git a/jpa/features/org.eclipse.jpt.eclipselink.feature/sourceTemplatePlugin/license.html b/jpa/features/org.eclipse.jpt.eclipselink.feature/sourceTemplatePlugin/license.html
deleted file mode 100644
index 14b1d50265..0000000000
--- a/jpa/features/org.eclipse.jpt.eclipselink.feature/sourceTemplatePlugin/license.html
+++ /dev/null
@@ -1,83 +0,0 @@
-<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.0//EN">
-<html>
-<head>
-<meta http-equiv=Content-Type content="text/html; charset=iso-8859-1">
-<title>Eclipse.org Software User Agreement</title>
-</head>
-
-<body lang="EN-US" link=blue vlink=purple>
-<h2>Eclipse Foundation Software User Agreement</h2>
-<p>June 06, 2007</p>
-
-<h3>Usage Of Content</h3>
-
-<p>THE ECLIPSE FOUNDATION MAKES AVAILABLE SOFTWARE, DOCUMENTATION, INFORMATION AND/OR OTHER MATERIALS FOR OPEN SOURCE PROJECTS
- (COLLECTIVELY &quot;CONTENT&quot;). USE OF THE CONTENT IS GOVERNED BY THE TERMS AND CONDITIONS OF THIS AGREEMENT AND/OR THE TERMS AND
- CONDITIONS OF LICENSE AGREEMENTS OR NOTICES INDICATED OR REFERENCED BELOW. BY USING THE CONTENT, YOU AGREE THAT YOUR USE
- OF THE CONTENT IS GOVERNED BY THIS AGREEMENT AND/OR THE TERMS AND CONDITIONS OF ANY APPLICABLE LICENSE AGREEMENTS OR
- NOTICES INDICATED OR REFERENCED BELOW. IF YOU DO NOT AGREE TO THE TERMS AND CONDITIONS OF THIS AGREEMENT AND THE TERMS AND
- CONDITIONS OF ANY APPLICABLE LICENSE AGREEMENTS OR NOTICES INDICATED OR REFERENCED BELOW, THEN YOU MAY NOT USE THE CONTENT.</p>
-
-<h3>Applicable Licenses</h3>
-
-<p>Unless otherwise indicated, all Content made available by the Eclipse Foundation is provided to you under the terms and conditions of the Eclipse Public License Version 1.0
- (&quot;EPL&quot;). A copy of the EPL is provided with this Content and is also available at <a href="http://www.eclipse.org/legal/epl-v10.html">http://www.eclipse.org/legal/epl-v10.html</a>.
- For purposes of the EPL, &quot;Program&quot; will mean the Content.</p>
-
-<p>Content includes, but is not limited to, source code, object code, documentation and other files maintained in the Eclipse.org CVS repository (&quot;Repository&quot;) in CVS
- modules (&quot;Modules&quot;) and made available as downloadable archives (&quot;Downloads&quot;).</p>
-
-<ul>
- <li>Content may be structured and packaged into modules to facilitate delivering, extending, and upgrading the Content. Typical modules may include plug-ins (&quot;Plug-ins&quot;), plug-in fragments (&quot;Fragments&quot;), and features (&quot;Features&quot;).</li>
- <li>Each Plug-in or Fragment may be packaged as a sub-directory or JAR (Java&trade; ARchive) in a directory named &quot;plugins&quot;.</li>
- <li>A Feature is a bundle of one or more Plug-ins and/or Fragments and associated material. Each Feature may be packaged as a sub-directory in a directory named &quot;features&quot;. Within a Feature, files named &quot;feature.xml&quot; may contain a list of the names and version numbers of the Plug-ins
- and/or Fragments associated with that Feature.</li>
- <li>Features may also include other Features (&quot;Included Features&quot;). Within a Feature, files named &quot;feature.xml&quot; may contain a list of the names and version numbers of Included Features.</li>
-</ul>
-
-<p>The terms and conditions governing Plug-ins and Fragments should be contained in files named &quot;about.html&quot; (&quot;Abouts&quot;). The terms and conditions governing Features and
-Included Features should be contained in files named &quot;license.html&quot; (&quot;Feature Licenses&quot;). Abouts and Feature Licenses may be located in any directory of a Download or Module
-including, but not limited to the following locations:</p>
-
-<ul>
- <li>The top-level (root) directory</li>
- <li>Plug-in and Fragment directories</li>
- <li>Inside Plug-ins and Fragments packaged as JARs</li>
- <li>Sub-directories of the directory named &quot;src&quot; of certain Plug-ins</li>
- <li>Feature directories</li>
-</ul>
-
-<p>Note: if a Feature made available by the Eclipse Foundation is installed using the Eclipse Update Manager, you must agree to a license (&quot;Feature Update License&quot;) during the
-installation process. If the Feature contains Included Features, the Feature Update License should either provide you with the terms and conditions governing the Included Features or
-inform you where you can locate them. Feature Update Licenses may be found in the &quot;license&quot; property of files named &quot;feature.properties&quot; found within a Feature.
-Such Abouts, Feature Licenses, and Feature Update Licenses contain the terms and conditions (or references to such terms and conditions) that govern your use of the associated Content in
-that directory.</p>
-
-<p>THE ABOUTS, FEATURE LICENSES, AND FEATURE UPDATE LICENSES MAY REFER TO THE EPL OR OTHER LICENSE AGREEMENTS, NOTICES OR TERMS AND CONDITIONS. SOME OF THESE
-OTHER LICENSE AGREEMENTS MAY INCLUDE (BUT ARE NOT LIMITED TO):</p>
-
-<ul>
- <li>Common Public License Version 1.0 (available at <a href="http://www.eclipse.org/legal/cpl-v10.html">http://www.eclipse.org/legal/cpl-v10.html</a>)</li>
- <li>Apache Software License 1.1 (available at <a href="http://www.apache.org/licenses/LICENSE">http://www.apache.org/licenses/LICENSE</a>)</li>
- <li>Apache Software License 2.0 (available at <a href="http://www.apache.org/licenses/LICENSE-2.0">http://www.apache.org/licenses/LICENSE-2.0</a>)</li>
- <li>IBM Public License 1.0 (available at <a href="http://oss.software.ibm.com/developerworks/opensource/license10.html">http://oss.software.ibm.com/developerworks/opensource/license10.html</a>)</li>
- <li>Metro Link Public License 1.00 (available at <a href="http://www.opengroup.org/openmotif/supporters/metrolink/license.html">http://www.opengroup.org/openmotif/supporters/metrolink/license.html</a>)</li>
- <li>Mozilla Public License Version 1.1 (available at <a href="http://www.mozilla.org/MPL/MPL-1.1.html">http://www.mozilla.org/MPL/MPL-1.1.html</a>)</li>
-
- <LI>Common Development and Distribution License (CDDL) Version 1.0 (available at <A
- href="http://www.sun.com/cddl/cddl.html">http://www.sun.com/cddl/cddl.html)</A>
- </LI>
-</UL>
-
-<p>IT IS YOUR OBLIGATION TO READ AND ACCEPT ALL SUCH TERMS AND CONDITIONS PRIOR TO USE OF THE CONTENT. If no About, Feature License, or Feature Update License is provided, please
-contact the Eclipse Foundation to determine what terms and conditions govern that particular Content.</p>
-
-<h3>Cryptography</h3>
-
-<p>Content may contain encryption software. The country in which you are currently may have restrictions on the import, possession, and use, and/or re-export to
- another country, of encryption software. BEFORE using any encryption software, please check the country's laws, regulations and policies concerning the import,
- possession, or use, and re-export of encryption software, to see if this is permitted.</p>
-
-<small>Java and all Java-based trademarks are trademarks of Sun Microsystems, Inc. in the United States, other countries, or both.</small>
-</body>
-</html>
diff --git a/jpa/features/org.eclipse.jpt.eclipselink.feature/sourceTemplatePlugin/plugin.properties b/jpa/features/org.eclipse.jpt.eclipselink.feature/sourceTemplatePlugin/plugin.properties
deleted file mode 100644
index d0d5f1c727..0000000000
--- a/jpa/features/org.eclipse.jpt.eclipselink.feature/sourceTemplatePlugin/plugin.properties
+++ /dev/null
@@ -1,13 +0,0 @@
-###############################################################################
-# Copyright (c) 2008 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
-#
-# Contributors:
-# Oracle. - initial API and implementation
-###############################################################################
-
-pluginName = Java Persistence API Tools - EclipseLink Support
-providerName = Eclipse.org
diff --git a/jpa/features/org.eclipse.jpt.eclipselink_sdk.feature/.cvsignore b/jpa/features/org.eclipse.jpt.eclipselink_sdk.feature/.cvsignore
deleted file mode 100644
index 6365d3dc51..0000000000
--- a/jpa/features/org.eclipse.jpt.eclipselink_sdk.feature/.cvsignore
+++ /dev/null
@@ -1,3 +0,0 @@
-feature.temp.folder
-build.xml
-org.eclipse.jpt_sdk.feature_1.0.1.*
diff --git a/jpa/features/org.eclipse.jpt.eclipselink_sdk.feature/.project b/jpa/features/org.eclipse.jpt.eclipselink_sdk.feature/.project
deleted file mode 100644
index 15f9157901..0000000000
--- a/jpa/features/org.eclipse.jpt.eclipselink_sdk.feature/.project
+++ /dev/null
@@ -1,17 +0,0 @@
-<?xml version="1.0" encoding="UTF-8"?>
-<projectDescription>
- <name>org.eclipse.jpt.eclipselink_sdk.feature</name>
- <comment></comment>
- <projects>
- </projects>
- <buildSpec>
- <buildCommand>
- <name>org.eclipse.pde.FeatureBuilder</name>
- <arguments>
- </arguments>
- </buildCommand>
- </buildSpec>
- <natures>
- <nature>org.eclipse.pde.FeatureNature</nature>
- </natures>
-</projectDescription>
diff --git a/jpa/features/org.eclipse.jpt.eclipselink_sdk.feature/.settings/org.eclipse.core.resources.prefs b/jpa/features/org.eclipse.jpt.eclipselink_sdk.feature/.settings/org.eclipse.core.resources.prefs
deleted file mode 100644
index 6cc7d4b4cd..0000000000
--- a/jpa/features/org.eclipse.jpt.eclipselink_sdk.feature/.settings/org.eclipse.core.resources.prefs
+++ /dev/null
@@ -1,3 +0,0 @@
-#Sun May 27 15:09:59 EDT 2007
-eclipse.preferences.version=1
-encoding/<project>=ISO-8859-1
diff --git a/jpa/features/org.eclipse.jpt.eclipselink_sdk.feature/build.properties b/jpa/features/org.eclipse.jpt.eclipselink_sdk.feature/build.properties
deleted file mode 100644
index b479ccbeeb..0000000000
--- a/jpa/features/org.eclipse.jpt.eclipselink_sdk.feature/build.properties
+++ /dev/null
@@ -1,7 +0,0 @@
-bin.includes = feature.xml,\
- license.html,\
- feature.properties,\
- epl-v10.html,\
- eclipse_update_120.jpg
-
-generate.feature@org.eclipse.jpt.eclipselink.feature.source=org.eclipse.jpt.eclipselink.feature
diff --git a/jpa/features/org.eclipse.jpt.eclipselink_sdk.feature/eclipse_update_120.jpg b/jpa/features/org.eclipse.jpt.eclipselink_sdk.feature/eclipse_update_120.jpg
deleted file mode 100644
index bfdf708ad6..0000000000
--- a/jpa/features/org.eclipse.jpt.eclipselink_sdk.feature/eclipse_update_120.jpg
+++ /dev/null
Binary files differ
diff --git a/jpa/features/org.eclipse.jpt.eclipselink_sdk.feature/epl-v10.html b/jpa/features/org.eclipse.jpt.eclipselink_sdk.feature/epl-v10.html
deleted file mode 100644
index ed4b196655..0000000000
--- a/jpa/features/org.eclipse.jpt.eclipselink_sdk.feature/epl-v10.html
+++ /dev/null
@@ -1,328 +0,0 @@
-<html xmlns:o="urn:schemas-microsoft-com:office:office"
-xmlns:w="urn:schemas-microsoft-com:office:word"
-xmlns="http://www.w3.org/TR/REC-html40">
-
-<head>
-<meta http-equiv=Content-Type content="text/html; charset=windows-1252">
-<meta name=ProgId content=Word.Document>
-<meta name=Generator content="Microsoft Word 9">
-<meta name=Originator content="Microsoft Word 9">
-<link rel=File-List
-href="./Eclipse%20EPL%202003_11_10%20Final_files/filelist.xml">
-<title>Eclipse Public License - Version 1.0</title>
-<!--[if gte mso 9]><xml>
- <o:DocumentProperties>
- <o:Revision>2</o:Revision>
- <o:TotalTime>3</o:TotalTime>
- <o:Created>2004-03-05T23:03:00Z</o:Created>
- <o:LastSaved>2004-03-05T23:03:00Z</o:LastSaved>
- <o:Pages>4</o:Pages>
- <o:Words>1626</o:Words>
- <o:Characters>9270</o:Characters>
- <o:Lines>77</o:Lines>
- <o:Paragraphs>18</o:Paragraphs>
- <o:CharactersWithSpaces>11384</o:CharactersWithSpaces>
- <o:Version>9.4402</o:Version>
- </o:DocumentProperties>
-</xml><![endif]--><!--[if gte mso 9]><xml>
- <w:WordDocument>
- <w:TrackRevisions/>
- </w:WordDocument>
-</xml><![endif]-->
-<style>
-<!--
- /* Font Definitions */
-@font-face
- {font-family:Tahoma;
- panose-1:2 11 6 4 3 5 4 4 2 4;
- mso-font-charset:0;
- mso-generic-font-family:swiss;
- mso-font-pitch:variable;
- mso-font-signature:553679495 -2147483648 8 0 66047 0;}
- /* Style Definitions */
-p.MsoNormal, li.MsoNormal, div.MsoNormal
- {mso-style-parent:"";
- margin:0in;
- margin-bottom:.0001pt;
- mso-pagination:widow-orphan;
- font-size:12.0pt;
- font-family:"Times New Roman";
- mso-fareast-font-family:"Times New Roman";}
-p
- {margin-right:0in;
- mso-margin-top-alt:auto;
- mso-margin-bottom-alt:auto;
- margin-left:0in;
- mso-pagination:widow-orphan;
- font-size:12.0pt;
- font-family:"Times New Roman";
- mso-fareast-font-family:"Times New Roman";}
-p.BalloonText, li.BalloonText, div.BalloonText
- {mso-style-name:"Balloon Text";
- margin:0in;
- margin-bottom:.0001pt;
- mso-pagination:widow-orphan;
- font-size:8.0pt;
- font-family:Tahoma;
- mso-fareast-font-family:"Times New Roman";}
-@page Section1
- {size:8.5in 11.0in;
- margin:1.0in 1.25in 1.0in 1.25in;
- mso-header-margin:.5in;
- mso-footer-margin:.5in;
- mso-paper-source:0;}
-div.Section1
- {page:Section1;}
--->
-</style>
-</head>
-
-<body lang=EN-US style='tab-interval:.5in'>
-
-<div class=Section1>
-
-<p align=center style='text-align:center'><b>Eclipse Public License - v 1.0</b>
-</p>
-
-<p><span style='font-size:10.0pt'>THE ACCOMPANYING PROGRAM IS PROVIDED UNDER
-THE TERMS OF THIS ECLIPSE PUBLIC LICENSE (&quot;AGREEMENT&quot;). ANY USE,
-REPRODUCTION OR DISTRIBUTION OF THE PROGRAM CONSTITUTES RECIPIENT'S ACCEPTANCE
-OF THIS AGREEMENT.</span> </p>
-
-<p><b><span style='font-size:10.0pt'>1. DEFINITIONS</span></b> </p>
-
-<p><span style='font-size:10.0pt'>&quot;Contribution&quot; means:</span> </p>
-
-<p class=MsoNormal style='margin-left:.5in'><span style='font-size:10.0pt'>a)
-in the case of the initial Contributor, the initial code and documentation
-distributed under this Agreement, and<br clear=left>
-b) in the case of each subsequent Contributor:</span></p>
-
-<p class=MsoNormal style='margin-left:.5in'><span style='font-size:10.0pt'>i)
-changes to the Program, and</span></p>
-
-<p class=MsoNormal style='margin-left:.5in'><span style='font-size:10.0pt'>ii)
-additions to the Program;</span></p>
-
-<p class=MsoNormal style='margin-left:.5in'><span style='font-size:10.0pt'>where
-such changes and/or additions to the Program originate from and are distributed
-by that particular Contributor. A Contribution 'originates' from a Contributor
-if it was added to the Program by such Contributor itself or anyone acting on
-such Contributor's behalf. Contributions do not include additions to the
-Program which: (i) are separate modules of software distributed in conjunction
-with the Program under their own license agreement, and (ii) are not derivative
-works of the Program. </span></p>
-
-<p><span style='font-size:10.0pt'>&quot;Contributor&quot; means any person or
-entity that distributes the Program.</span> </p>
-
-<p><span style='font-size:10.0pt'>&quot;Licensed Patents &quot; mean patent
-claims licensable by a Contributor which are necessarily infringed by the use
-or sale of its Contribution alone or when combined with the Program. </span></p>
-
-<p><span style='font-size:10.0pt'>&quot;Program&quot; means the Contributions
-distributed in accordance with this Agreement.</span> </p>
-
-<p><span style='font-size:10.0pt'>&quot;Recipient&quot; means anyone who
-receives the Program under this Agreement, including all Contributors.</span> </p>
-
-<p><b><span style='font-size:10.0pt'>2. GRANT OF RIGHTS</span></b> </p>
-
-<p class=MsoNormal style='margin-left:.5in'><span style='font-size:10.0pt'>a)
-Subject to the terms of this Agreement, each Contributor hereby grants Recipient
-a non-exclusive, worldwide, royalty-free copyright license to<span
-style='color:red'> </span>reproduce, prepare derivative works of, publicly
-display, publicly perform, distribute and sublicense the Contribution of such
-Contributor, if any, and such derivative works, in source code and object code
-form.</span></p>
-
-<p class=MsoNormal style='margin-left:.5in'><span style='font-size:10.0pt'>b)
-Subject to the terms of this Agreement, each Contributor hereby grants
-Recipient a non-exclusive, worldwide,<span style='color:green'> </span>royalty-free
-patent license under Licensed Patents to make, use, sell, offer to sell, import
-and otherwise transfer the Contribution of such Contributor, if any, in source
-code and object code form. This patent license shall apply to the combination
-of the Contribution and the Program if, at the time the Contribution is added
-by the Contributor, such addition of the Contribution causes such combination
-to be covered by the Licensed Patents. The patent license shall not apply to
-any other combinations which include the Contribution. No hardware per se is
-licensed hereunder. </span></p>
-
-<p class=MsoNormal style='margin-left:.5in'><span style='font-size:10.0pt'>c)
-Recipient understands that although each Contributor grants the licenses to its
-Contributions set forth herein, no assurances are provided by any Contributor
-that the Program does not infringe the patent or other intellectual property
-rights of any other entity. Each Contributor disclaims any liability to Recipient
-for claims brought by any other entity based on infringement of intellectual
-property rights or otherwise. As a condition to exercising the rights and
-licenses granted hereunder, each Recipient hereby assumes sole responsibility
-to secure any other intellectual property rights needed, if any. For example,
-if a third party patent license is required to allow Recipient to distribute
-the Program, it is Recipient's responsibility to acquire that license before
-distributing the Program.</span></p>
-
-<p class=MsoNormal style='margin-left:.5in'><span style='font-size:10.0pt'>d)
-Each Contributor represents that to its knowledge it has sufficient copyright
-rights in its Contribution, if any, to grant the copyright license set forth in
-this Agreement. </span></p>
-
-<p><b><span style='font-size:10.0pt'>3. REQUIREMENTS</span></b> </p>
-
-<p><span style='font-size:10.0pt'>A Contributor may choose to distribute the
-Program in object code form under its own license agreement, provided that:</span>
-</p>
-
-<p class=MsoNormal style='margin-left:.5in'><span style='font-size:10.0pt'>a)
-it complies with the terms and conditions of this Agreement; and</span></p>
-
-<p class=MsoNormal style='margin-left:.5in'><span style='font-size:10.0pt'>b)
-its license agreement:</span></p>
-
-<p class=MsoNormal style='margin-left:.5in'><span style='font-size:10.0pt'>i)
-effectively disclaims on behalf of all Contributors all warranties and
-conditions, express and implied, including warranties or conditions of title
-and non-infringement, and implied warranties or conditions of merchantability
-and fitness for a particular purpose; </span></p>
-
-<p class=MsoNormal style='margin-left:.5in'><span style='font-size:10.0pt'>ii)
-effectively excludes on behalf of all Contributors all liability for damages,
-including direct, indirect, special, incidental and consequential damages, such
-as lost profits; </span></p>
-
-<p class=MsoNormal style='margin-left:.5in'><span style='font-size:10.0pt'>iii)
-states that any provisions which differ from this Agreement are offered by that
-Contributor alone and not by any other party; and</span></p>
-
-<p class=MsoNormal style='margin-left:.5in'><span style='font-size:10.0pt'>iv)
-states that source code for the Program is available from such Contributor, and
-informs licensees how to obtain it in a reasonable manner on or through a
-medium customarily used for software exchange.<span style='color:blue'> </span></span></p>
-
-<p><span style='font-size:10.0pt'>When the Program is made available in source
-code form:</span> </p>
-
-<p class=MsoNormal style='margin-left:.5in'><span style='font-size:10.0pt'>a)
-it must be made available under this Agreement; and </span></p>
-
-<p class=MsoNormal style='margin-left:.5in'><span style='font-size:10.0pt'>b) a
-copy of this Agreement must be included with each copy of the Program. </span></p>
-
-<p><span style='font-size:10.0pt'>Contributors may not remove or alter any
-copyright notices contained within the Program. </span></p>
-
-<p><span style='font-size:10.0pt'>Each Contributor must identify itself as the
-originator of its Contribution, if any, in a manner that reasonably allows
-subsequent Recipients to identify the originator of the Contribution. </span></p>
-
-<p><b><span style='font-size:10.0pt'>4. COMMERCIAL DISTRIBUTION</span></b> </p>
-
-<p><span style='font-size:10.0pt'>Commercial distributors of software may
-accept certain responsibilities with respect to end users, business partners
-and the like. While this license is intended to facilitate the commercial use
-of the Program, the Contributor who includes the Program in a commercial
-product offering should do so in a manner which does not create potential
-liability for other Contributors. Therefore, if a Contributor includes the
-Program in a commercial product offering, such Contributor (&quot;Commercial
-Contributor&quot;) hereby agrees to defend and indemnify every other
-Contributor (&quot;Indemnified Contributor&quot;) against any losses, damages and
-costs (collectively &quot;Losses&quot;) arising from claims, lawsuits and other
-legal actions brought by a third party against the Indemnified Contributor to
-the extent caused by the acts or omissions of such Commercial Contributor in
-connection with its distribution of the Program in a commercial product
-offering. The obligations in this section do not apply to any claims or Losses
-relating to any actual or alleged intellectual property infringement. In order
-to qualify, an Indemnified Contributor must: a) promptly notify the Commercial
-Contributor in writing of such claim, and b) allow the Commercial Contributor
-to control, and cooperate with the Commercial Contributor in, the defense and
-any related settlement negotiations. The Indemnified Contributor may participate
-in any such claim at its own expense.</span> </p>
-
-<p><span style='font-size:10.0pt'>For example, a Contributor might include the
-Program in a commercial product offering, Product X. That Contributor is then a
-Commercial Contributor. If that Commercial Contributor then makes performance
-claims, or offers warranties related to Product X, those performance claims and
-warranties are such Commercial Contributor's responsibility alone. Under this
-section, the Commercial Contributor would have to defend claims against the
-other Contributors related to those performance claims and warranties, and if a
-court requires any other Contributor to pay any damages as a result, the
-Commercial Contributor must pay those damages.</span> </p>
-
-<p><b><span style='font-size:10.0pt'>5. NO WARRANTY</span></b> </p>
-
-<p><span style='font-size:10.0pt'>EXCEPT AS EXPRESSLY SET FORTH IN THIS
-AGREEMENT, THE PROGRAM IS PROVIDED ON AN &quot;AS IS&quot; BASIS, WITHOUT
-WARRANTIES OR CONDITIONS OF ANY KIND, EITHER EXPRESS OR IMPLIED INCLUDING,
-WITHOUT LIMITATION, ANY WARRANTIES OR CONDITIONS OF TITLE, NON-INFRINGEMENT,
-MERCHANTABILITY OR FITNESS FOR A PARTICULAR PURPOSE. Each Recipient is solely
-responsible for determining the appropriateness of using and distributing the
-Program and assumes all risks associated with its exercise of rights under this
-Agreement , including but not limited to the risks and costs of program errors,
-compliance with applicable laws, damage to or loss of data, programs or
-equipment, and unavailability or interruption of operations. </span></p>
-
-<p><b><span style='font-size:10.0pt'>6. DISCLAIMER OF LIABILITY</span></b> </p>
-
-<p><span style='font-size:10.0pt'>EXCEPT AS EXPRESSLY SET FORTH IN THIS
-AGREEMENT, NEITHER RECIPIENT NOR ANY CONTRIBUTORS SHALL HAVE ANY LIABILITY FOR
-ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES
-(INCLUDING WITHOUT LIMITATION LOST PROFITS), HOWEVER CAUSED AND ON ANY THEORY
-OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING
-NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OR DISTRIBUTION OF
-THE PROGRAM OR THE EXERCISE OF ANY RIGHTS GRANTED HEREUNDER, EVEN IF ADVISED OF
-THE POSSIBILITY OF SUCH DAMAGES.</span> </p>
-
-<p><b><span style='font-size:10.0pt'>7. GENERAL</span></b> </p>
-
-<p><span style='font-size:10.0pt'>If any provision of this Agreement is invalid
-or unenforceable under applicable law, it shall not affect the validity or
-enforceability of the remainder of the terms of this Agreement, and without
-further action by the parties hereto, such provision shall be reformed to the
-minimum extent necessary to make such provision valid and enforceable.</span> </p>
-
-<p><span style='font-size:10.0pt'>If Recipient institutes patent litigation
-against any entity (including a cross-claim or counterclaim in a lawsuit)
-alleging that the Program itself (excluding combinations of the Program with
-other software or hardware) infringes such Recipient's patent(s), then such
-Recipient's rights granted under Section 2(b) shall terminate as of the date
-such litigation is filed. </span></p>
-
-<p><span style='font-size:10.0pt'>All Recipient's rights under this Agreement
-shall terminate if it fails to comply with any of the material terms or
-conditions of this Agreement and does not cure such failure in a reasonable
-period of time after becoming aware of such noncompliance. If all Recipient's
-rights under this Agreement terminate, Recipient agrees to cease use and
-distribution of the Program as soon as reasonably practicable. However,
-Recipient's obligations under this Agreement and any licenses granted by
-Recipient relating to the Program shall continue and survive. </span></p>
-
-<p><span style='font-size:10.0pt'>Everyone is permitted to copy and distribute
-copies of this Agreement, but in order to avoid inconsistency the Agreement is
-copyrighted and may only be modified in the following manner. The Agreement
-Steward reserves the right to publish new versions (including revisions) of
-this Agreement from time to time. No one other than the Agreement Steward has
-the right to modify this Agreement. The Eclipse Foundation is the initial
-Agreement Steward. The Eclipse Foundation may assign the responsibility to
-serve as the Agreement Steward to a suitable separate entity. Each new version
-of the Agreement will be given a distinguishing version number. The Program
-(including Contributions) may always be distributed subject to the version of
-the Agreement under which it was received. In addition, after a new version of
-the Agreement is published, Contributor may elect to distribute the Program
-(including its Contributions) under the new version. Except as expressly stated
-in Sections 2(a) and 2(b) above, Recipient receives no rights or licenses to
-the intellectual property of any Contributor under this Agreement, whether
-expressly, by implication, estoppel or otherwise. All rights in the Program not
-expressly granted under this Agreement are reserved.</span> </p>
-
-<p><span style='font-size:10.0pt'>This Agreement is governed by the laws of the
-State of New York and the intellectual property laws of the United States of
-America. No party to this Agreement will bring a legal action under this
-Agreement more than one year after the cause of action arose. Each party waives
-its rights to a jury trial in any resulting litigation.</span> </p>
-
-<p class=MsoNormal><![if !supportEmptyParas]>&nbsp;<![endif]><o:p></o:p></p>
-
-</div>
-
-</body>
-
-</html> \ No newline at end of file
diff --git a/jpa/features/org.eclipse.jpt.eclipselink_sdk.feature/feature.properties b/jpa/features/org.eclipse.jpt.eclipselink_sdk.feature/feature.properties
deleted file mode 100644
index afca039e6d..0000000000
--- a/jpa/features/org.eclipse.jpt.eclipselink_sdk.feature/feature.properties
+++ /dev/null
@@ -1,140 +0,0 @@
-###############################################################################
-# Copyright (c) 2006, 2008 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
-#
-# Contributors:
-# Oracle. - initial API and implementation
-###############################################################################
-
-# "featureName" property - name of the feature
-featureName=Dali Java Persistence Tools - EclipseLink Support SDK (Optional)
-
-# "providerName" property - name of the company that provides the feature
-providerName=Eclipse Web Tools Platform Project
-
-# "updateSiteName" property - label for the update site
-updateSiteName=The Eclipse Web Tools Platform (WTP) Project update site
-
-# "description" property - description of the feature
-description=Source code archives for Dali Java Persistence - EclipseLink Support
-
-# "copyright" property - text of the "Feature Update Copyright"
-copyright=\
-Copyright (c) 2006-09 Oracle Corporation.\n\
-All rights reserved. This program and the accompanying materials\n\
-are made available under the terms of the Eclipse Public License v1.0\n\
-which accompanies this distribution, and is available at\n\
-http://www.eclipse.org/legal/epl-v10.html\n\
-\n\
-Contributors:\n\
- Oracle - initial API and implementation\n
-################ end of copyright property ####################################
-
-# "licenseURL" property - URL of the "Feature License"
-# do not translate value - just change to point to a locale-specific HTML page
-licenseURL=license.html
-
-# "license" property - text of the "Feature Update License"
-# should be plain text version of license agreement pointed to be "licenseURL"
-license=\
-ECLIPSE FOUNDATION SOFTWARE USER AGREEMENT\n\
-June 06, 2007\n\
-\n\
-Usage Of Content\n\
-\n\
-THE ECLIPSE FOUNDATION MAKES AVAILABLE SOFTWARE, DOCUMENTATION, INFORMATION AND/OR\n\
-OTHER MATERIALS FOR OPEN SOURCE PROJECTS (COLLECTIVELY "CONTENT").\n\
-USE OF THE CONTENT IS GOVERNED BY THE TERMS AND CONDITIONS OF THIS\n\
-AGREEMENT AND/OR THE TERMS AND CONDITIONS OF LICENSE AGREEMENTS OR\n\
-NOTICES INDICATED OR REFERENCED BELOW. BY USING THE CONTENT, YOU\n\
-AGREE THAT YOUR USE OF THE CONTENT IS GOVERNED BY THIS AGREEMENT\n\
-AND/OR THE TERMS AND CONDITIONS OF ANY APPLICABLE LICENSE AGREEMENTS\n\
-OR NOTICES INDICATED OR REFERENCED BELOW. IF YOU DO NOT AGREE TO THE\n\
-TERMS AND CONDITIONS OF THIS AGREEMENT AND THE TERMS AND CONDITIONS\n\
-OF ANY APPLICABLE LICENSE AGREEMENTS OR NOTICES INDICATED OR REFERENCED\n\
-BELOW, THEN YOU MAY NOT USE THE CONTENT.\n\
-\n\
-Applicable Licenses\n\
-\n\
-Unless otherwise indicated, all Content made available by the Eclipse Foundation\n\
-is provided to you under the terms and conditions of the Eclipse Public\n\
-License Version 1.0 ("EPL"). A copy of the EPL is provided with this\n\
-Content and is also available at http://www.eclipse.org/legal/epl-v10.html.\n\
-For purposes of the EPL, "Program" will mean the Content.\n\
-\n\
-Content includes, but is not limited to, source code, object code,\n\
-documentation and other files maintained in the Eclipse.org CVS\n\
-repository ("Repository") in CVS modules ("Modules") and made available\n\
-as downloadable archives ("Downloads").\n\
-\n\
- - Content may be structured and packaged into modules to facilitate delivering,\n\
- extending, and upgrading the Content. Typical modules may include plug-ins ("Plug-ins"),\n\
- plug-in fragments ("Fragments"), and features ("Features").\n\
- - Each Plug-in or Fragment may be packaged as a sub-directory or JAR (Java? ARchive)\n\
- in a directory named "plugins".\n\
- - A Feature is a bundle of one or more Plug-ins and/or Fragments and associated material.\n\
- Each Feature may be packaged as a sub-directory in a directory named "features".\n\
- Within a Feature, files named "feature.xml" may contain a list of the names and version\n\
- numbers of the Plug-ins and/or Fragments associated with that Feature.\n\
- - Features may also include other Features ("Included Features"). Within a Feature, files\n\
- named "feature.xml" may contain a list of the names and version numbers of Included Features.\n\
-\n\
-Features may also include other Features ("Included Features"). Files named\n\
-"feature.xml" may contain a list of the names and version numbers of\n\
-Included Features.\n\
-\n\
-The terms and conditions governing Plug-ins and Fragments should be\n\
-contained in files named "about.html" ("Abouts"). The terms and\n\
-conditions governing Features and Included Features should be contained\n\
-in files named "license.html" ("Feature Licenses"). Abouts and Feature\n\
-Licenses may be located in any directory of a Download or Module\n\
-including, but not limited to the following locations:\n\
-\n\
- - The top-level (root) directory\n\
- - Plug-in and Fragment directories\n\
- - Inside Plug-ins and Fragments packaged as JARs\n\
- - Sub-directories of the directory named "src" of certain Plug-ins\n\
- - Feature directories\n\
-\n\
-Note: if a Feature made available by the Eclipse Foundation is installed using the\n\
-Eclipse Update Manager, you must agree to a license ("Feature Update\n\
-License") during the installation process. If the Feature contains\n\
-Included Features, the Feature Update License should either provide you\n\
-with the terms and conditions governing the Included Features or inform\n\
-you where you can locate them. Feature Update Licenses may be found in\n\
-the "license" property of files named "feature.properties". Such Abouts,\n\
-Feature Licenses and Feature Update Licenses contain the terms and\n\
-conditions (or references to such terms and conditions) that govern your\n\
-use of the associated Content in that directory.\n\
-\n\
-THE ABOUTS, FEATURE LICENSES AND FEATURE UPDATE LICENSES MAY REFER\n\
-TO THE EPL OR OTHER LICENSE AGREEMENTS, NOTICES OR TERMS AND CONDITIONS.\n\
-SOME OF THESE OTHER LICENSE AGREEMENTS MAY INCLUDE (BUT ARE NOT LIMITED TO):\n\
-\n\
- - Common Public License Version 1.0 (available at http://www.eclipse.org/legal/cpl-v10.html)\n\
- - Apache Software License 1.1 (available at http://www.apache.org/licenses/LICENSE)\n\
- - Apache Software License 2.0 (available at http://www.apache.org/licenses/LICENSE-2.0)\n\
- - IBM Public License 1.0 (available at http://oss.software.ibm.com/developerworks/opensource/license10.html)\n\
- - Metro Link Public License 1.00 (available at http://www.opengroup.org/openmotif/supporters/metrolink/license.html)\n\
- - Mozilla Public License Version 1.1 (available at http://www.mozilla.org/MPL/MPL-1.1.html)\n\
- - Common Development and Distribution License (CDDL) Version 1.0 (available at http://www.sun.com/cddl/cddl.html)\n\
-\n\
-IT IS YOUR OBLIGATION TO READ AND ACCEPT ALL SUCH TERMS AND CONDITIONS PRIOR\n\
-TO USE OF THE CONTENT. If no About, Feature License or Feature Update License\n\
-is provided, please contact the Eclipse Foundation to determine what terms and conditions\n\
-govern that particular Content.\n\
-\n\
-Cryptography\n\
-\n\
-Content may contain encryption software. The country in which you are\n\
-currently may have restrictions on the import, possession, and use,\n\
-and/or re-export to another country, of encryption software. BEFORE\n\
-using any encryption software, please check the country's laws,\n\
-regulations and policies concerning the import, possession, or use,\n\
-and re-export of encryption software, to see if this is permitted.\n\
-\n\
-Java and all Java-based trademarks are trademarks of Sun Microsystems, Inc. in the United States, other countries, or both.\n
-########### end of license property ##########################################
diff --git a/jpa/features/org.eclipse.jpt.eclipselink_sdk.feature/feature.xml b/jpa/features/org.eclipse.jpt.eclipselink_sdk.feature/feature.xml
deleted file mode 100644
index c35050563a..0000000000
--- a/jpa/features/org.eclipse.jpt.eclipselink_sdk.feature/feature.xml
+++ /dev/null
@@ -1,28 +0,0 @@
-<?xml version="1.0" encoding="UTF-8"?>
-<feature
- id="org.eclipse.jpt.eclipselink_sdk.feature"
- label="%featureName"
- version="2.2.0.qualifier"
- provider-name="%providerName">
-
- <description>
- %description
- </description>
-
- <copyright>
- %copyright
- </copyright>
-
- <license url="license.html">
- %license
- </license>
-
- <includes
- id="org.eclipse.jpt.eclipselink.feature"
- version="0.0.0"/>
-
- <includes
- id="org.eclipse.jpt.eclipselink.feature.source"
- version="0.0.0"/>
-
-</feature>
diff --git a/jpa/features/org.eclipse.jpt.eclipselink_sdk.feature/license.html b/jpa/features/org.eclipse.jpt.eclipselink_sdk.feature/license.html
deleted file mode 100644
index fc77372d46..0000000000
--- a/jpa/features/org.eclipse.jpt.eclipselink_sdk.feature/license.html
+++ /dev/null
@@ -1,98 +0,0 @@
-<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN" "http://www.w3c.org/TR/1999/REC-html401-19991224/loose.dtd">
-<!-- saved from url=(0044)http://www.eclipse.org/legal/epl/notice.html -->
-<HTML><HEAD><TITLE>Eclipse.org Software User Agreement</TITLE>
-<META http-equiv=Content-Type content="text/html; charset=iso-8859-1">
-<META content="MSHTML 6.00.2800.1479" name=GENERATOR></HEAD>
-<BODY lang=EN-US vLink=purple link=blue>
-<H2>Eclipse Foundation Software User Agreement</H2>
-<P>June 06, 2007</P>
-<H3>Usage Of Content</H3>
-<P>THE ECLIPSE FOUNDATION MAKES AVAILABLE SOFTWARE, DOCUMENTATION, INFORMATION
-AND/OR OTHER MATERIALS FOR OPEN SOURCE PROJECTS (COLLECTIVELY "CONTENT"). USE OF
-THE CONTENT IS GOVERNED BY THE TERMS AND CONDITIONS OF THIS AGREEMENT AND/OR THE
-TERMS AND CONDITIONS OF LICENSE AGREEMENTS OR NOTICES INDICATED OR REFERENCED
-BELOW. BY USING THE CONTENT, YOU AGREE THAT YOUR USE OF THE CONTENT IS GOVERNED
-BY THIS AGREEMENT AND/OR THE TERMS AND CONDITIONS OF ANY APPLICABLE LICENSE
-AGREEMENTS OR NOTICES INDICATED OR REFERENCED BELOW. IF YOU DO NOT AGREE TO THE
-TERMS AND CONDITIONS OF THIS AGREEMENT AND THE TERMS AND CONDITIONS OF ANY
-APPLICABLE LICENSE AGREEMENTS OR NOTICES INDICATED OR REFERENCED BELOW, THEN YOU
-MAY NOT USE THE CONTENT.</P>
-<H3>Applicable Licenses</H3>
-<P>Unless otherwise indicated, all Content made available by the Eclipse
-Foundation is provided to you under the terms and conditions of the Eclipse
-Public License Version 1.0 ("EPL"). A copy of the EPL is provided with this
-Content and is also available at <A
-href="http://www.eclipse.org/legal/epl-v10.html">http://www.eclipse.org/legal/epl-v10.html</A>.
-For purposes of the EPL, "Program" will mean the Content.</P>
-<P>Content includes, but is not limited to, source code, object code,
-documentation and other files maintained in the Eclipse.org CVS repository
-("Repository") in CVS modules ("Modules") and made available as downloadable
-archives ("Downloads").</P>
-<P>Content may be apportioned into plug-ins ("Plug-ins"), plug-in fragments
-("Fragments"), and features ("Features"). A Feature is a bundle of one or more
-Plug-ins and/or Fragments and associated material. Files named "feature.xml" may
-contain a list of the names and version numbers of the Plug-ins and/or Fragments
-associated with a Feature. Plug-ins and Fragments are located in directories
-named "plugins" and Features are located in directories named "features".</P>
-<P>Features may also include other Features ("Included Features"). Files named
-"feature.xml" may contain a list of the names and version numbers of Included
-Features.</P>
-<P>The terms and conditions governing Plug-ins and Fragments should be contained
-in files named "about.html" ("Abouts"). The terms and conditions governing
-Features and Included Features should be contained in files named "license.html"
-("Feature Licenses"). Abouts and Feature Licenses may be located in any
-directory of a Download or Module including, but not limited to the following
-locations:</P>
-<UL>
- <LI>The top-level (root) directory
- <LI>Plug-in and Fragment directories
- <LI>Subdirectories of the directory named "src" of certain Plug-ins
- <LI>Feature directories </LI></UL>
-<P>Note: if a Feature made available by the Eclipse Foundation is installed
-using the Eclipse Update Manager, you must agree to a license ("Feature Update
-License") during the installation process. If the Feature contains Included
-Features, the Feature Update License should either provide you with the terms
-and conditions governing the Included Features or inform you where you can
-locate them. Feature Update Licenses may be found in the "license" property of
-files named "feature.properties". Such Abouts, Feature Licenses and Feature
-Update Licenses contain the terms and conditions (or references to such terms
-and conditions) that govern your use of the associated Content in that
-directory.</P>
-<P>THE ABOUTS, FEATURE LICENSES AND FEATURE UPDATE LICENSES MAY REFER TO THE EPL
-OR OTHER LICENSE AGREEMENTS, NOTICES OR TERMS AND CONDITIONS. SOME OF THESE
-OTHER LICENSE AGREEMENTS MAY INCLUDE (BUT ARE NOT LIMITED TO):</P>
-<UL>
- <LI>Common Public License Version 1.0 (available at <A
- href="http://www.eclipse.org/legal/cpl-v10.html">http://www.eclipse.org/legal/cpl-v10.html</A>)
-
- <LI>Apache Software License 1.1 (available at <A
- href="http://www.apache.org/licenses/LICENSE">http://www.apache.org/licenses/LICENSE</A>)
-
- <LI>Apache Software License 2.0 (available at <A
- href="http://www.apache.org/licenses/LICENSE-2.0">http://www.apache.org/licenses/LICENSE-2.0</A>)
-
- <LI>IBM Public License 1.0 (available at <A
- href="http://oss.software.ibm.com/developerworks/opensource/license10.html">http://oss.software.ibm.com/developerworks/opensource/license10.html</A>)
-
- <LI>Metro Link Public License 1.00 (available at <A
- href="http://www.opengroup.org/openmotif/supporters/metrolink/license.html">http://www.opengroup.org/openmotif/supporters/metrolink/license.html</A>)
-
- <LI>Mozilla Public License Version 1.1 (available at <A
- href="http://www.mozilla.org/MPL/MPL-1.1.html">http://www.mozilla.org/MPL/MPL-1.1.html</A>)
- </LI>
-
- <LI>Common Development and Distribution License (CDDL) Version 1.0 (available at <A
- href="http://www.sun.com/cddl/cddl.html">http://www.sun.com/cddl/cddl.html)</A>
- </LI>
-</UL>
-<P>IT IS YOUR OBLIGATION TO READ AND ACCEPT ALL SUCH TERMS AND CONDITIONS PRIOR
-TO USE OF THE CONTENT. If no About, Feature License or Feature Update License is
-provided, please contact the Eclipse Foundation to determine what terms and
-conditions govern that particular Content.</P>
-<H3>Cryptography</H3>
-<P>Content may contain encryption software. The country in which you are
-currently may have restrictions on the import, possession, and use, and/or
-re-export to another country, of encryption software. BEFORE using any
-encryption software, please check the country's laws, regulations and policies
-concerning the import, possession, or use, and re-export of encryption software,
-to see if this is permitted.</P></BODY></HTML>
diff --git a/jpa/features/org.eclipse.jpt.feature/.cvsignore b/jpa/features/org.eclipse.jpt.feature/.cvsignore
deleted file mode 100644
index c14487ceac..0000000000
--- a/jpa/features/org.eclipse.jpt.feature/.cvsignore
+++ /dev/null
@@ -1 +0,0 @@
-build.xml
diff --git a/jpa/features/org.eclipse.jpt.feature/.project b/jpa/features/org.eclipse.jpt.feature/.project
deleted file mode 100644
index c8eb2f0481..0000000000
--- a/jpa/features/org.eclipse.jpt.feature/.project
+++ /dev/null
@@ -1,17 +0,0 @@
-<?xml version="1.0" encoding="UTF-8"?>
-<projectDescription>
- <name>org.eclipse.jpt.feature</name>
- <comment></comment>
- <projects>
- </projects>
- <buildSpec>
- <buildCommand>
- <name>org.eclipse.pde.FeatureBuilder</name>
- <arguments>
- </arguments>
- </buildCommand>
- </buildSpec>
- <natures>
- <nature>org.eclipse.pde.FeatureNature</nature>
- </natures>
-</projectDescription>
diff --git a/jpa/features/org.eclipse.jpt.feature/.settings/org.eclipse.core.resources.prefs b/jpa/features/org.eclipse.jpt.feature/.settings/org.eclipse.core.resources.prefs
deleted file mode 100644
index dab5837cb6..0000000000
--- a/jpa/features/org.eclipse.jpt.feature/.settings/org.eclipse.core.resources.prefs
+++ /dev/null
@@ -1,3 +0,0 @@
-#Sun May 27 15:10:47 EDT 2007
-eclipse.preferences.version=1
-encoding/<project>=ISO-8859-1
diff --git a/jpa/features/org.eclipse.jpt.feature/build.properties b/jpa/features/org.eclipse.jpt.feature/build.properties
deleted file mode 100644
index 7200939aca..0000000000
--- a/jpa/features/org.eclipse.jpt.feature/build.properties
+++ /dev/null
@@ -1,15 +0,0 @@
-###############################################################################
-# Copyright (c) 2006 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
-#
-# Contributors:
-# Oracle. - initial API and implementation
-###############################################################################
-bin.includes = feature.xml,\
- eclipse_update_120.jpg,\
- epl-v10.html,\
- license.html,\
- feature.properties
diff --git a/jpa/features/org.eclipse.jpt.feature/eclipse_update_120.jpg b/jpa/features/org.eclipse.jpt.feature/eclipse_update_120.jpg
deleted file mode 100644
index bfdf708ad6..0000000000
--- a/jpa/features/org.eclipse.jpt.feature/eclipse_update_120.jpg
+++ /dev/null
Binary files differ
diff --git a/jpa/features/org.eclipse.jpt.feature/epl-v10.html b/jpa/features/org.eclipse.jpt.feature/epl-v10.html
deleted file mode 100644
index ed4b196655..0000000000
--- a/jpa/features/org.eclipse.jpt.feature/epl-v10.html
+++ /dev/null
@@ -1,328 +0,0 @@
-<html xmlns:o="urn:schemas-microsoft-com:office:office"
-xmlns:w="urn:schemas-microsoft-com:office:word"
-xmlns="http://www.w3.org/TR/REC-html40">
-
-<head>
-<meta http-equiv=Content-Type content="text/html; charset=windows-1252">
-<meta name=ProgId content=Word.Document>
-<meta name=Generator content="Microsoft Word 9">
-<meta name=Originator content="Microsoft Word 9">
-<link rel=File-List
-href="./Eclipse%20EPL%202003_11_10%20Final_files/filelist.xml">
-<title>Eclipse Public License - Version 1.0</title>
-<!--[if gte mso 9]><xml>
- <o:DocumentProperties>
- <o:Revision>2</o:Revision>
- <o:TotalTime>3</o:TotalTime>
- <o:Created>2004-03-05T23:03:00Z</o:Created>
- <o:LastSaved>2004-03-05T23:03:00Z</o:LastSaved>
- <o:Pages>4</o:Pages>
- <o:Words>1626</o:Words>
- <o:Characters>9270</o:Characters>
- <o:Lines>77</o:Lines>
- <o:Paragraphs>18</o:Paragraphs>
- <o:CharactersWithSpaces>11384</o:CharactersWithSpaces>
- <o:Version>9.4402</o:Version>
- </o:DocumentProperties>
-</xml><![endif]--><!--[if gte mso 9]><xml>
- <w:WordDocument>
- <w:TrackRevisions/>
- </w:WordDocument>
-</xml><![endif]-->
-<style>
-<!--
- /* Font Definitions */
-@font-face
- {font-family:Tahoma;
- panose-1:2 11 6 4 3 5 4 4 2 4;
- mso-font-charset:0;
- mso-generic-font-family:swiss;
- mso-font-pitch:variable;
- mso-font-signature:553679495 -2147483648 8 0 66047 0;}
- /* Style Definitions */
-p.MsoNormal, li.MsoNormal, div.MsoNormal
- {mso-style-parent:"";
- margin:0in;
- margin-bottom:.0001pt;
- mso-pagination:widow-orphan;
- font-size:12.0pt;
- font-family:"Times New Roman";
- mso-fareast-font-family:"Times New Roman";}
-p
- {margin-right:0in;
- mso-margin-top-alt:auto;
- mso-margin-bottom-alt:auto;
- margin-left:0in;
- mso-pagination:widow-orphan;
- font-size:12.0pt;
- font-family:"Times New Roman";
- mso-fareast-font-family:"Times New Roman";}
-p.BalloonText, li.BalloonText, div.BalloonText
- {mso-style-name:"Balloon Text";
- margin:0in;
- margin-bottom:.0001pt;
- mso-pagination:widow-orphan;
- font-size:8.0pt;
- font-family:Tahoma;
- mso-fareast-font-family:"Times New Roman";}
-@page Section1
- {size:8.5in 11.0in;
- margin:1.0in 1.25in 1.0in 1.25in;
- mso-header-margin:.5in;
- mso-footer-margin:.5in;
- mso-paper-source:0;}
-div.Section1
- {page:Section1;}
--->
-</style>
-</head>
-
-<body lang=EN-US style='tab-interval:.5in'>
-
-<div class=Section1>
-
-<p align=center style='text-align:center'><b>Eclipse Public License - v 1.0</b>
-</p>
-
-<p><span style='font-size:10.0pt'>THE ACCOMPANYING PROGRAM IS PROVIDED UNDER
-THE TERMS OF THIS ECLIPSE PUBLIC LICENSE (&quot;AGREEMENT&quot;). ANY USE,
-REPRODUCTION OR DISTRIBUTION OF THE PROGRAM CONSTITUTES RECIPIENT'S ACCEPTANCE
-OF THIS AGREEMENT.</span> </p>
-
-<p><b><span style='font-size:10.0pt'>1. DEFINITIONS</span></b> </p>
-
-<p><span style='font-size:10.0pt'>&quot;Contribution&quot; means:</span> </p>
-
-<p class=MsoNormal style='margin-left:.5in'><span style='font-size:10.0pt'>a)
-in the case of the initial Contributor, the initial code and documentation
-distributed under this Agreement, and<br clear=left>
-b) in the case of each subsequent Contributor:</span></p>
-
-<p class=MsoNormal style='margin-left:.5in'><span style='font-size:10.0pt'>i)
-changes to the Program, and</span></p>
-
-<p class=MsoNormal style='margin-left:.5in'><span style='font-size:10.0pt'>ii)
-additions to the Program;</span></p>
-
-<p class=MsoNormal style='margin-left:.5in'><span style='font-size:10.0pt'>where
-such changes and/or additions to the Program originate from and are distributed
-by that particular Contributor. A Contribution 'originates' from a Contributor
-if it was added to the Program by such Contributor itself or anyone acting on
-such Contributor's behalf. Contributions do not include additions to the
-Program which: (i) are separate modules of software distributed in conjunction
-with the Program under their own license agreement, and (ii) are not derivative
-works of the Program. </span></p>
-
-<p><span style='font-size:10.0pt'>&quot;Contributor&quot; means any person or
-entity that distributes the Program.</span> </p>
-
-<p><span style='font-size:10.0pt'>&quot;Licensed Patents &quot; mean patent
-claims licensable by a Contributor which are necessarily infringed by the use
-or sale of its Contribution alone or when combined with the Program. </span></p>
-
-<p><span style='font-size:10.0pt'>&quot;Program&quot; means the Contributions
-distributed in accordance with this Agreement.</span> </p>
-
-<p><span style='font-size:10.0pt'>&quot;Recipient&quot; means anyone who
-receives the Program under this Agreement, including all Contributors.</span> </p>
-
-<p><b><span style='font-size:10.0pt'>2. GRANT OF RIGHTS</span></b> </p>
-
-<p class=MsoNormal style='margin-left:.5in'><span style='font-size:10.0pt'>a)
-Subject to the terms of this Agreement, each Contributor hereby grants Recipient
-a non-exclusive, worldwide, royalty-free copyright license to<span
-style='color:red'> </span>reproduce, prepare derivative works of, publicly
-display, publicly perform, distribute and sublicense the Contribution of such
-Contributor, if any, and such derivative works, in source code and object code
-form.</span></p>
-
-<p class=MsoNormal style='margin-left:.5in'><span style='font-size:10.0pt'>b)
-Subject to the terms of this Agreement, each Contributor hereby grants
-Recipient a non-exclusive, worldwide,<span style='color:green'> </span>royalty-free
-patent license under Licensed Patents to make, use, sell, offer to sell, import
-and otherwise transfer the Contribution of such Contributor, if any, in source
-code and object code form. This patent license shall apply to the combination
-of the Contribution and the Program if, at the time the Contribution is added
-by the Contributor, such addition of the Contribution causes such combination
-to be covered by the Licensed Patents. The patent license shall not apply to
-any other combinations which include the Contribution. No hardware per se is
-licensed hereunder. </span></p>
-
-<p class=MsoNormal style='margin-left:.5in'><span style='font-size:10.0pt'>c)
-Recipient understands that although each Contributor grants the licenses to its
-Contributions set forth herein, no assurances are provided by any Contributor
-that the Program does not infringe the patent or other intellectual property
-rights of any other entity. Each Contributor disclaims any liability to Recipient
-for claims brought by any other entity based on infringement of intellectual
-property rights or otherwise. As a condition to exercising the rights and
-licenses granted hereunder, each Recipient hereby assumes sole responsibility
-to secure any other intellectual property rights needed, if any. For example,
-if a third party patent license is required to allow Recipient to distribute
-the Program, it is Recipient's responsibility to acquire that license before
-distributing the Program.</span></p>
-
-<p class=MsoNormal style='margin-left:.5in'><span style='font-size:10.0pt'>d)
-Each Contributor represents that to its knowledge it has sufficient copyright
-rights in its Contribution, if any, to grant the copyright license set forth in
-this Agreement. </span></p>
-
-<p><b><span style='font-size:10.0pt'>3. REQUIREMENTS</span></b> </p>
-
-<p><span style='font-size:10.0pt'>A Contributor may choose to distribute the
-Program in object code form under its own license agreement, provided that:</span>
-</p>
-
-<p class=MsoNormal style='margin-left:.5in'><span style='font-size:10.0pt'>a)
-it complies with the terms and conditions of this Agreement; and</span></p>
-
-<p class=MsoNormal style='margin-left:.5in'><span style='font-size:10.0pt'>b)
-its license agreement:</span></p>
-
-<p class=MsoNormal style='margin-left:.5in'><span style='font-size:10.0pt'>i)
-effectively disclaims on behalf of all Contributors all warranties and
-conditions, express and implied, including warranties or conditions of title
-and non-infringement, and implied warranties or conditions of merchantability
-and fitness for a particular purpose; </span></p>
-
-<p class=MsoNormal style='margin-left:.5in'><span style='font-size:10.0pt'>ii)
-effectively excludes on behalf of all Contributors all liability for damages,
-including direct, indirect, special, incidental and consequential damages, such
-as lost profits; </span></p>
-
-<p class=MsoNormal style='margin-left:.5in'><span style='font-size:10.0pt'>iii)
-states that any provisions which differ from this Agreement are offered by that
-Contributor alone and not by any other party; and</span></p>
-
-<p class=MsoNormal style='margin-left:.5in'><span style='font-size:10.0pt'>iv)
-states that source code for the Program is available from such Contributor, and
-informs licensees how to obtain it in a reasonable manner on or through a
-medium customarily used for software exchange.<span style='color:blue'> </span></span></p>
-
-<p><span style='font-size:10.0pt'>When the Program is made available in source
-code form:</span> </p>
-
-<p class=MsoNormal style='margin-left:.5in'><span style='font-size:10.0pt'>a)
-it must be made available under this Agreement; and </span></p>
-
-<p class=MsoNormal style='margin-left:.5in'><span style='font-size:10.0pt'>b) a
-copy of this Agreement must be included with each copy of the Program. </span></p>
-
-<p><span style='font-size:10.0pt'>Contributors may not remove or alter any
-copyright notices contained within the Program. </span></p>
-
-<p><span style='font-size:10.0pt'>Each Contributor must identify itself as the
-originator of its Contribution, if any, in a manner that reasonably allows
-subsequent Recipients to identify the originator of the Contribution. </span></p>
-
-<p><b><span style='font-size:10.0pt'>4. COMMERCIAL DISTRIBUTION</span></b> </p>
-
-<p><span style='font-size:10.0pt'>Commercial distributors of software may
-accept certain responsibilities with respect to end users, business partners
-and the like. While this license is intended to facilitate the commercial use
-of the Program, the Contributor who includes the Program in a commercial
-product offering should do so in a manner which does not create potential
-liability for other Contributors. Therefore, if a Contributor includes the
-Program in a commercial product offering, such Contributor (&quot;Commercial
-Contributor&quot;) hereby agrees to defend and indemnify every other
-Contributor (&quot;Indemnified Contributor&quot;) against any losses, damages and
-costs (collectively &quot;Losses&quot;) arising from claims, lawsuits and other
-legal actions brought by a third party against the Indemnified Contributor to
-the extent caused by the acts or omissions of such Commercial Contributor in
-connection with its distribution of the Program in a commercial product
-offering. The obligations in this section do not apply to any claims or Losses
-relating to any actual or alleged intellectual property infringement. In order
-to qualify, an Indemnified Contributor must: a) promptly notify the Commercial
-Contributor in writing of such claim, and b) allow the Commercial Contributor
-to control, and cooperate with the Commercial Contributor in, the defense and
-any related settlement negotiations. The Indemnified Contributor may participate
-in any such claim at its own expense.</span> </p>
-
-<p><span style='font-size:10.0pt'>For example, a Contributor might include the
-Program in a commercial product offering, Product X. That Contributor is then a
-Commercial Contributor. If that Commercial Contributor then makes performance
-claims, or offers warranties related to Product X, those performance claims and
-warranties are such Commercial Contributor's responsibility alone. Under this
-section, the Commercial Contributor would have to defend claims against the
-other Contributors related to those performance claims and warranties, and if a
-court requires any other Contributor to pay any damages as a result, the
-Commercial Contributor must pay those damages.</span> </p>
-
-<p><b><span style='font-size:10.0pt'>5. NO WARRANTY</span></b> </p>
-
-<p><span style='font-size:10.0pt'>EXCEPT AS EXPRESSLY SET FORTH IN THIS
-AGREEMENT, THE PROGRAM IS PROVIDED ON AN &quot;AS IS&quot; BASIS, WITHOUT
-WARRANTIES OR CONDITIONS OF ANY KIND, EITHER EXPRESS OR IMPLIED INCLUDING,
-WITHOUT LIMITATION, ANY WARRANTIES OR CONDITIONS OF TITLE, NON-INFRINGEMENT,
-MERCHANTABILITY OR FITNESS FOR A PARTICULAR PURPOSE. Each Recipient is solely
-responsible for determining the appropriateness of using and distributing the
-Program and assumes all risks associated with its exercise of rights under this
-Agreement , including but not limited to the risks and costs of program errors,
-compliance with applicable laws, damage to or loss of data, programs or
-equipment, and unavailability or interruption of operations. </span></p>
-
-<p><b><span style='font-size:10.0pt'>6. DISCLAIMER OF LIABILITY</span></b> </p>
-
-<p><span style='font-size:10.0pt'>EXCEPT AS EXPRESSLY SET FORTH IN THIS
-AGREEMENT, NEITHER RECIPIENT NOR ANY CONTRIBUTORS SHALL HAVE ANY LIABILITY FOR
-ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES
-(INCLUDING WITHOUT LIMITATION LOST PROFITS), HOWEVER CAUSED AND ON ANY THEORY
-OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING
-NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OR DISTRIBUTION OF
-THE PROGRAM OR THE EXERCISE OF ANY RIGHTS GRANTED HEREUNDER, EVEN IF ADVISED OF
-THE POSSIBILITY OF SUCH DAMAGES.</span> </p>
-
-<p><b><span style='font-size:10.0pt'>7. GENERAL</span></b> </p>
-
-<p><span style='font-size:10.0pt'>If any provision of this Agreement is invalid
-or unenforceable under applicable law, it shall not affect the validity or
-enforceability of the remainder of the terms of this Agreement, and without
-further action by the parties hereto, such provision shall be reformed to the
-minimum extent necessary to make such provision valid and enforceable.</span> </p>
-
-<p><span style='font-size:10.0pt'>If Recipient institutes patent litigation
-against any entity (including a cross-claim or counterclaim in a lawsuit)
-alleging that the Program itself (excluding combinations of the Program with
-other software or hardware) infringes such Recipient's patent(s), then such
-Recipient's rights granted under Section 2(b) shall terminate as of the date
-such litigation is filed. </span></p>
-
-<p><span style='font-size:10.0pt'>All Recipient's rights under this Agreement
-shall terminate if it fails to comply with any of the material terms or
-conditions of this Agreement and does not cure such failure in a reasonable
-period of time after becoming aware of such noncompliance. If all Recipient's
-rights under this Agreement terminate, Recipient agrees to cease use and
-distribution of the Program as soon as reasonably practicable. However,
-Recipient's obligations under this Agreement and any licenses granted by
-Recipient relating to the Program shall continue and survive. </span></p>
-
-<p><span style='font-size:10.0pt'>Everyone is permitted to copy and distribute
-copies of this Agreement, but in order to avoid inconsistency the Agreement is
-copyrighted and may only be modified in the following manner. The Agreement
-Steward reserves the right to publish new versions (including revisions) of
-this Agreement from time to time. No one other than the Agreement Steward has
-the right to modify this Agreement. The Eclipse Foundation is the initial
-Agreement Steward. The Eclipse Foundation may assign the responsibility to
-serve as the Agreement Steward to a suitable separate entity. Each new version
-of the Agreement will be given a distinguishing version number. The Program
-(including Contributions) may always be distributed subject to the version of
-the Agreement under which it was received. In addition, after a new version of
-the Agreement is published, Contributor may elect to distribute the Program
-(including its Contributions) under the new version. Except as expressly stated
-in Sections 2(a) and 2(b) above, Recipient receives no rights or licenses to
-the intellectual property of any Contributor under this Agreement, whether
-expressly, by implication, estoppel or otherwise. All rights in the Program not
-expressly granted under this Agreement are reserved.</span> </p>
-
-<p><span style='font-size:10.0pt'>This Agreement is governed by the laws of the
-State of New York and the intellectual property laws of the United States of
-America. No party to this Agreement will bring a legal action under this
-Agreement more than one year after the cause of action arose. Each party waives
-its rights to a jury trial in any resulting litigation.</span> </p>
-
-<p class=MsoNormal><![if !supportEmptyParas]>&nbsp;<![endif]><o:p></o:p></p>
-
-</div>
-
-</body>
-
-</html> \ No newline at end of file
diff --git a/jpa/features/org.eclipse.jpt.feature/feature.properties b/jpa/features/org.eclipse.jpt.feature/feature.properties
deleted file mode 100644
index b8df909b7b..0000000000
--- a/jpa/features/org.eclipse.jpt.feature/feature.properties
+++ /dev/null
@@ -1,140 +0,0 @@
-###############################################################################
-# Copyright (c) 2006, 2009 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
-#
-# Contributors:
-# Oracle - initial API and implementation
-###############################################################################
-
-# "featureName" property - name of the feature
-featureName=Dali Java Persistence Tools
-
-# "providerName" property - name of the company that provides the feature
-providerName=Eclipse Web Tools Platform
-
-# "updateSiteName" property - label for the update site
-updateSiteName=The Eclipse Web Tools Platform (WTP) Project update site
-
-# "description" property - description of the feature
-description=Dali Java Persistence Tools
-
-# "copyright" property - text of the "Feature Update Copyright"
-copyright=\
-Copyright (c) 2006, 2009 Oracle Corporation.\n\
-All rights reserved. This program and the accompanying materials\n\
-are made available under the terms of the Eclipse Public License v1.0\n\
-which accompanies this distribution, and is available at\n\
-http://www.eclipse.org/legal/epl-v10.html\n\
-\n\
-Contributors:\n\
- Oracle - initial API and implementation\n
-################ end of copyright property ####################################
-
-# "licenseURL" property - URL of the "Feature License"
-# do not translate value - just change to point to a locale-specific HTML page
-licenseURL=license.html
-
-# "license" property - text of the "Feature Update License"
-# should be plain text version of license agreement pointed to be "licenseURL"
-license=\
-ECLIPSE FOUNDATION SOFTWARE USER AGREEMENT\n\
-June 06, 2007\n\
-\n\
-Usage Of Content\n\
-\n\
-THE ECLIPSE FOUNDATION MAKES AVAILABLE SOFTWARE, DOCUMENTATION, INFORMATION AND/OR\n\
-OTHER MATERIALS FOR OPEN SOURCE PROJECTS (COLLECTIVELY "CONTENT").\n\
-USE OF THE CONTENT IS GOVERNED BY THE TERMS AND CONDITIONS OF THIS\n\
-AGREEMENT AND/OR THE TERMS AND CONDITIONS OF LICENSE AGREEMENTS OR\n\
-NOTICES INDICATED OR REFERENCED BELOW. BY USING THE CONTENT, YOU\n\
-AGREE THAT YOUR USE OF THE CONTENT IS GOVERNED BY THIS AGREEMENT\n\
-AND/OR THE TERMS AND CONDITIONS OF ANY APPLICABLE LICENSE AGREEMENTS\n\
-OR NOTICES INDICATED OR REFERENCED BELOW. IF YOU DO NOT AGREE TO THE\n\
-TERMS AND CONDITIONS OF THIS AGREEMENT AND THE TERMS AND CONDITIONS\n\
-OF ANY APPLICABLE LICENSE AGREEMENTS OR NOTICES INDICATED OR REFERENCED\n\
-BELOW, THEN YOU MAY NOT USE THE CONTENT.\n\
-\n\
-Applicable Licenses\n\
-\n\
-Unless otherwise indicated, all Content made available by the Eclipse Foundation\n\
-is provided to you under the terms and conditions of the Eclipse Public\n\
-License Version 1.0 ("EPL"). A copy of the EPL is provided with this\n\
-Content and is also available at http://www.eclipse.org/legal/epl-v10.html.\n\
-For purposes of the EPL, "Program" will mean the Content.\n\
-\n\
-Content includes, but is not limited to, source code, object code,\n\
-documentation and other files maintained in the Eclipse.org CVS\n\
-repository ("Repository") in CVS modules ("Modules") and made available\n\
-as downloadable archives ("Downloads").\n\
-\n\
- - Content may be structured and packaged into modules to facilitate delivering,\n\
- extending, and upgrading the Content. Typical modules may include plug-ins ("Plug-ins"),\n\
- plug-in fragments ("Fragments"), and features ("Features").\n\
- - Each Plug-in or Fragment may be packaged as a sub-directory or JAR (Java? ARchive)\n\
- in a directory named "plugins".\n\
- - A Feature is a bundle of one or more Plug-ins and/or Fragments and associated material.\n\
- Each Feature may be packaged as a sub-directory in a directory named "features".\n\
- Within a Feature, files named "feature.xml" may contain a list of the names and version\n\
- numbers of the Plug-ins and/or Fragments associated with that Feature.\n\
- - Features may also include other Features ("Included Features"). Within a Feature, files\n\
- named "feature.xml" may contain a list of the names and version numbers of Included Features.\n\
-\n\
-Features may also include other Features ("Included Features"). Files named\n\
-"feature.xml" may contain a list of the names and version numbers of\n\
-Included Features.\n\
-\n\
-The terms and conditions governing Plug-ins and Fragments should be\n\
-contained in files named "about.html" ("Abouts"). The terms and\n\
-conditions governing Features and Included Features should be contained\n\
-in files named "license.html" ("Feature Licenses"). Abouts and Feature\n\
-Licenses may be located in any directory of a Download or Module\n\
-including, but not limited to the following locations:\n\
-\n\
- - The top-level (root) directory\n\
- - Plug-in and Fragment directories\n\
- - Inside Plug-ins and Fragments packaged as JARs\n\
- - Sub-directories of the directory named "src" of certain Plug-ins\n\
- - Feature directories\n\
-\n\
-Note: if a Feature made available by the Eclipse Foundation is installed using the\n\
-Eclipse Update Manager, you must agree to a license ("Feature Update\n\
-License") during the installation process. If the Feature contains\n\
-Included Features, the Feature Update License should either provide you\n\
-with the terms and conditions governing the Included Features or inform\n\
-you where you can locate them. Feature Update Licenses may be found in\n\
-the "license" property of files named "feature.properties". Such Abouts,\n\
-Feature Licenses and Feature Update Licenses contain the terms and\n\
-conditions (or references to such terms and conditions) that govern your\n\
-use of the associated Content in that directory.\n\
-\n\
-THE ABOUTS, FEATURE LICENSES AND FEATURE UPDATE LICENSES MAY REFER\n\
-TO THE EPL OR OTHER LICENSE AGREEMENTS, NOTICES OR TERMS AND CONDITIONS.\n\
-SOME OF THESE OTHER LICENSE AGREEMENTS MAY INCLUDE (BUT ARE NOT LIMITED TO):\n\
-\n\
- - Common Public License Version 1.0 (available at http://www.eclipse.org/legal/cpl-v10.html)\n\
- - Apache Software License 1.1 (available at http://www.apache.org/licenses/LICENSE)\n\
- - Apache Software License 2.0 (available at http://www.apache.org/licenses/LICENSE-2.0)\n\
- - IBM Public License 1.0 (available at http://oss.software.ibm.com/developerworks/opensource/license10.html)\n\
- - Metro Link Public License 1.00 (available at http://www.opengroup.org/openmotif/supporters/metrolink/license.html)\n\
- - Mozilla Public License Version 1.1 (available at http://www.mozilla.org/MPL/MPL-1.1.html)\n\
- - Common Development and Distribution License (CDDL) Version 1.0 (available at http://www.sun.com/cddl/cddl.html)\n\
-\n\
-IT IS YOUR OBLIGATION TO READ AND ACCEPT ALL SUCH TERMS AND CONDITIONS PRIOR\n\
-TO USE OF THE CONTENT. If no About, Feature License or Feature Update License\n\
-is provided, please contact the Eclipse Foundation to determine what terms and conditions\n\
-govern that particular Content.\n\
-\n\
-Cryptography\n\
-\n\
-Content may contain encryption software. The country in which you are\n\
-currently may have restrictions on the import, possession, and use,\n\
-and/or re-export to another country, of encryption software. BEFORE\n\
-using any encryption software, please check the country's laws,\n\
-regulations and policies concerning the import, possession, or use,\n\
-and re-export of encryption software, to see if this is permitted.\n\
-\n\
-Java and all Java-based trademarks are trademarks of Sun Microsystems, Inc. in the United States, other countries, or both.\n
-########### end of license property ##########################################
diff --git a/jpa/features/org.eclipse.jpt.feature/feature.xml b/jpa/features/org.eclipse.jpt.feature/feature.xml
deleted file mode 100644
index 8d625d45e9..0000000000
--- a/jpa/features/org.eclipse.jpt.feature/feature.xml
+++ /dev/null
@@ -1,118 +0,0 @@
-<?xml version="1.0" encoding="UTF-8"?>
-<feature
- id="org.eclipse.jpt.feature"
- label="%featureName"
- version="2.2.0.qualifier"
- provider-name="%providerName"
- plugin="org.eclipse.jpt.branding">
-
- <description>
- %description
- </description>
-
- <copyright>
- %copyright
- </copyright>
-
- <license url="license.html">
- %license
- </license>
-
- <url>
- <update label="Web Tools Platform (WTP) Updates" url="http://download.eclipse.org/webtools/updates"/>
- <discovery label="Web Tools Platform (WTP) Updates" url="http://download.eclipse.org/webtools/updates"/>
- <discovery label="Dali Java Persistence Tools Updates" url="http://download.eclipse.org/webtools/updates/"/>
- </url>
-
- <plugin
- id="org.eclipse.jpt.utility"
- download-size="0"
- install-size="0"
- version="0.0.0"
- unpack="false"/>
-
- <plugin
- id="org.eclipse.jpt.db"
- download-size="0"
- install-size="0"
- version="0.0.0"
- unpack="false"/>
-
- <plugin
- id="org.eclipse.jpt.db.ui"
- download-size="0"
- install-size="0"
- version="0.0.0"
- unpack="false"/>
-
- <plugin
- id="org.eclipse.jpt.gen"
- download-size="0"
- install-size="0"
- version="0.0.0"
- unpack="false"/>
-
- <plugin
- id="org.eclipse.jpt.core"
- download-size="0"
- install-size="0"
- version="0.0.0"
- unpack="false"/>
-
- <plugin
- id="org.eclipse.jpt.ui"
- download-size="0"
- install-size="0"
- version="0.0.0"
- unpack="false"/>
-
- <plugin
- id="org.eclipse.jpt.doc.user"
- download-size="0"
- install-size="0"
- version="0.0.0"
- unpack="false"/>
-
- <plugin
- id="org.apache.commons.collections"
- download-size="0"
- install-size="0"
- version="3.2.0.qualifier"
- unpack="false"/>
-
- <plugin
- id="org.apache.commons.lang"
- download-size="0"
- install-size="0"
- version="2.1.0.qualifier"
- unpack="false"/>
-
- <plugin
- id="org.apache.oro"
- download-size="0"
- install-size="0"
- version="2.0.8.qualifier"
- unpack="false"/>
-
- <plugin
- id="org.jdom"
- download-size="0"
- install-size="0"
- version="1.0.0.qualifier"
- unpack="false"/>
-
- <plugin
- id="org.apache.velocity"
- download-size="0"
- install-size="0"
- version="1.5.0.qualifier"
- unpack="false"/>
-
- <plugin
- id="org.eclipse.jpt.branding"
- download-size="0"
- install-size="0"
- version="0.0.0"
- unpack="false"/>
-
-</feature>
diff --git a/jpa/features/org.eclipse.jpt.feature/license.html b/jpa/features/org.eclipse.jpt.feature/license.html
deleted file mode 100644
index fc77372d46..0000000000
--- a/jpa/features/org.eclipse.jpt.feature/license.html
+++ /dev/null
@@ -1,98 +0,0 @@
-<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN" "http://www.w3c.org/TR/1999/REC-html401-19991224/loose.dtd">
-<!-- saved from url=(0044)http://www.eclipse.org/legal/epl/notice.html -->
-<HTML><HEAD><TITLE>Eclipse.org Software User Agreement</TITLE>
-<META http-equiv=Content-Type content="text/html; charset=iso-8859-1">
-<META content="MSHTML 6.00.2800.1479" name=GENERATOR></HEAD>
-<BODY lang=EN-US vLink=purple link=blue>
-<H2>Eclipse Foundation Software User Agreement</H2>
-<P>June 06, 2007</P>
-<H3>Usage Of Content</H3>
-<P>THE ECLIPSE FOUNDATION MAKES AVAILABLE SOFTWARE, DOCUMENTATION, INFORMATION
-AND/OR OTHER MATERIALS FOR OPEN SOURCE PROJECTS (COLLECTIVELY "CONTENT"). USE OF
-THE CONTENT IS GOVERNED BY THE TERMS AND CONDITIONS OF THIS AGREEMENT AND/OR THE
-TERMS AND CONDITIONS OF LICENSE AGREEMENTS OR NOTICES INDICATED OR REFERENCED
-BELOW. BY USING THE CONTENT, YOU AGREE THAT YOUR USE OF THE CONTENT IS GOVERNED
-BY THIS AGREEMENT AND/OR THE TERMS AND CONDITIONS OF ANY APPLICABLE LICENSE
-AGREEMENTS OR NOTICES INDICATED OR REFERENCED BELOW. IF YOU DO NOT AGREE TO THE
-TERMS AND CONDITIONS OF THIS AGREEMENT AND THE TERMS AND CONDITIONS OF ANY
-APPLICABLE LICENSE AGREEMENTS OR NOTICES INDICATED OR REFERENCED BELOW, THEN YOU
-MAY NOT USE THE CONTENT.</P>
-<H3>Applicable Licenses</H3>
-<P>Unless otherwise indicated, all Content made available by the Eclipse
-Foundation is provided to you under the terms and conditions of the Eclipse
-Public License Version 1.0 ("EPL"). A copy of the EPL is provided with this
-Content and is also available at <A
-href="http://www.eclipse.org/legal/epl-v10.html">http://www.eclipse.org/legal/epl-v10.html</A>.
-For purposes of the EPL, "Program" will mean the Content.</P>
-<P>Content includes, but is not limited to, source code, object code,
-documentation and other files maintained in the Eclipse.org CVS repository
-("Repository") in CVS modules ("Modules") and made available as downloadable
-archives ("Downloads").</P>
-<P>Content may be apportioned into plug-ins ("Plug-ins"), plug-in fragments
-("Fragments"), and features ("Features"). A Feature is a bundle of one or more
-Plug-ins and/or Fragments and associated material. Files named "feature.xml" may
-contain a list of the names and version numbers of the Plug-ins and/or Fragments
-associated with a Feature. Plug-ins and Fragments are located in directories
-named "plugins" and Features are located in directories named "features".</P>
-<P>Features may also include other Features ("Included Features"). Files named
-"feature.xml" may contain a list of the names and version numbers of Included
-Features.</P>
-<P>The terms and conditions governing Plug-ins and Fragments should be contained
-in files named "about.html" ("Abouts"). The terms and conditions governing
-Features and Included Features should be contained in files named "license.html"
-("Feature Licenses"). Abouts and Feature Licenses may be located in any
-directory of a Download or Module including, but not limited to the following
-locations:</P>
-<UL>
- <LI>The top-level (root) directory
- <LI>Plug-in and Fragment directories
- <LI>Subdirectories of the directory named "src" of certain Plug-ins
- <LI>Feature directories </LI></UL>
-<P>Note: if a Feature made available by the Eclipse Foundation is installed
-using the Eclipse Update Manager, you must agree to a license ("Feature Update
-License") during the installation process. If the Feature contains Included
-Features, the Feature Update License should either provide you with the terms
-and conditions governing the Included Features or inform you where you can
-locate them. Feature Update Licenses may be found in the "license" property of
-files named "feature.properties". Such Abouts, Feature Licenses and Feature
-Update Licenses contain the terms and conditions (or references to such terms
-and conditions) that govern your use of the associated Content in that
-directory.</P>
-<P>THE ABOUTS, FEATURE LICENSES AND FEATURE UPDATE LICENSES MAY REFER TO THE EPL
-OR OTHER LICENSE AGREEMENTS, NOTICES OR TERMS AND CONDITIONS. SOME OF THESE
-OTHER LICENSE AGREEMENTS MAY INCLUDE (BUT ARE NOT LIMITED TO):</P>
-<UL>
- <LI>Common Public License Version 1.0 (available at <A
- href="http://www.eclipse.org/legal/cpl-v10.html">http://www.eclipse.org/legal/cpl-v10.html</A>)
-
- <LI>Apache Software License 1.1 (available at <A
- href="http://www.apache.org/licenses/LICENSE">http://www.apache.org/licenses/LICENSE</A>)
-
- <LI>Apache Software License 2.0 (available at <A
- href="http://www.apache.org/licenses/LICENSE-2.0">http://www.apache.org/licenses/LICENSE-2.0</A>)
-
- <LI>IBM Public License 1.0 (available at <A
- href="http://oss.software.ibm.com/developerworks/opensource/license10.html">http://oss.software.ibm.com/developerworks/opensource/license10.html</A>)
-
- <LI>Metro Link Public License 1.00 (available at <A
- href="http://www.opengroup.org/openmotif/supporters/metrolink/license.html">http://www.opengroup.org/openmotif/supporters/metrolink/license.html</A>)
-
- <LI>Mozilla Public License Version 1.1 (available at <A
- href="http://www.mozilla.org/MPL/MPL-1.1.html">http://www.mozilla.org/MPL/MPL-1.1.html</A>)
- </LI>
-
- <LI>Common Development and Distribution License (CDDL) Version 1.0 (available at <A
- href="http://www.sun.com/cddl/cddl.html">http://www.sun.com/cddl/cddl.html)</A>
- </LI>
-</UL>
-<P>IT IS YOUR OBLIGATION TO READ AND ACCEPT ALL SUCH TERMS AND CONDITIONS PRIOR
-TO USE OF THE CONTENT. If no About, Feature License or Feature Update License is
-provided, please contact the Eclipse Foundation to determine what terms and
-conditions govern that particular Content.</P>
-<H3>Cryptography</H3>
-<P>Content may contain encryption software. The country in which you are
-currently may have restrictions on the import, possession, and use, and/or
-re-export to another country, of encryption software. BEFORE using any
-encryption software, please check the country's laws, regulations and policies
-concerning the import, possession, or use, and re-export of encryption software,
-to see if this is permitted.</P></BODY></HTML>
diff --git a/jpa/features/org.eclipse.jpt.feature/sourceTemplateBundle/about.html b/jpa/features/org.eclipse.jpt.feature/sourceTemplateBundle/about.html
deleted file mode 100644
index d4916df475..0000000000
--- a/jpa/features/org.eclipse.jpt.feature/sourceTemplateBundle/about.html
+++ /dev/null
@@ -1,27 +0,0 @@
-<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.0//EN">
-<html>
-<head>
-<title>About</title>
-<meta http-equiv=Content-Type content="text/html; charset=ISO-8859-1">
-</head>
-<body lang="EN-US">
-<h2>About This Content</h2>
-
-<p>June 06, 2007</p>
-<h3>License</h3>
-
-<p>The Eclipse Foundation makes available all content in this plug-in (&quot;Content&quot;). Unless otherwise indicated below, the Content is provided to you under the terms and conditions of the
-Eclipse Public License Version 1.0 (&quot;EPL&quot;). A copy of the EPL is available at <a href="http://www.eclipse.org/legal/epl-v10.html">http://www.eclipse.org/legal/epl-v10.html</a>.
-For purposes of the EPL, &quot;Program&quot; will mean the Content.</p>
-
-<p>If you did not receive this Content directly from the Eclipse Foundation, the Content is being redistributed by another party (&quot;Redistributor&quot;) and different terms and conditions may
-apply to your use of any object code in the Content. Check the Redistributor's license that was provided with the Content. If no such license exists, contact the Redistributor. Unless otherwise
-indicated below, the terms and conditions of the EPL still apply to any source code in the Content.</p>
-
-<h3>Source Code</h3>
-<p>This plug-in contains source code zip files (&quot;Source Zips&quot;) that correspond to binary content in other plug-ins. These Source Zips may be distributed under different license
-agreements and/or notices. Details about these license agreements and notices are contained in &quot;about.html&quot; files (&quot;Abouts&quot;) located in sub-directories in the
-src/ directory of this plug-in. Such Abouts govern your use of the Source Zips in that directory, not the EPL.</p>
-
-</body>
-</html>
diff --git a/jpa/features/org.eclipse.jpt.feature/sourceTemplateBundle/about.ini b/jpa/features/org.eclipse.jpt.feature/sourceTemplateBundle/about.ini
deleted file mode 100644
index 2dee36a2e2..0000000000
--- a/jpa/features/org.eclipse.jpt.feature/sourceTemplateBundle/about.ini
+++ /dev/null
@@ -1,31 +0,0 @@
-# about.ini
-# contains information about a feature
-# java.io.Properties file (ISO 8859-1 with "\" escapes)
-# "%key" are externalized strings defined in about.properties
-# This file does not need to be translated.
-
-# Property "aboutText" contains blurb for "About" dialog (translated)
-aboutText=%blurb
-
-# Property "windowImage" contains path to window icon (16x16)
-# needed for primary features only
-
-# Property "featureImage" contains path to feature image (32x32)
-featureImage=eclipse32.gif
-
-# Property "aboutImage" contains path to product image (500x330 or 115x164)
-# needed for primary features only
-
-# Property "appName" contains name of the application (not translated)
-# needed for primary features only
-
-# Property "welcomePage" contains path to welcome page (special XML-based format)
-# optional
-
-# Property "welcomePerspective" contains the id of the perspective in which the
-# welcome page is to be opened.
-# optional
-
-
-
-
diff --git a/jpa/features/org.eclipse.jpt.feature/sourceTemplateBundle/about.mappings b/jpa/features/org.eclipse.jpt.feature/sourceTemplateBundle/about.mappings
deleted file mode 100644
index a28390a75e..0000000000
--- a/jpa/features/org.eclipse.jpt.feature/sourceTemplateBundle/about.mappings
+++ /dev/null
@@ -1,6 +0,0 @@
-# about.mappings
-# contains fill-ins for about.properties
-# java.io.Properties file (ISO 8859-1 with "\" escapes)
-# This file does not need to be translated.
-
-0=@build@
diff --git a/jpa/features/org.eclipse.jpt.feature/sourceTemplateBundle/about.properties b/jpa/features/org.eclipse.jpt.feature/sourceTemplateBundle/about.properties
deleted file mode 100644
index 15417ff15a..0000000000
--- a/jpa/features/org.eclipse.jpt.feature/sourceTemplateBundle/about.properties
+++ /dev/null
@@ -1,26 +0,0 @@
-###############################################################################
-# Copyright (c) 2006, 2008 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
-#
-# Contributors:
-# Oracle - initial API and implementation
-###############################################################################
-# about.properties
-# contains externalized strings for about.ini
-# java.io.Properties file (ISO 8859-1 with "\" escapes)
-# fill-ins are supplied by about.mappings
-# This file should be translated.
-#
-# Do not translate any values surrounded by {}
-
-blurb=Dali Java Persistence API (JPA) Tools Source\n\
-\n\
-Version: {featureVersion}\n\
-Build id: {0}\n\
-\n\
-(c) Copyright Eclipse contributors and others 2008. All rights reserved.\n\
-Visit http://www.eclipse.org/webtools
-
diff --git a/jpa/features/org.eclipse.jpt.feature/sourceTemplateBundle/build.properties b/jpa/features/org.eclipse.jpt.feature/sourceTemplateBundle/build.properties
deleted file mode 100644
index ce9529be74..0000000000
--- a/jpa/features/org.eclipse.jpt.feature/sourceTemplateBundle/build.properties
+++ /dev/null
@@ -1,12 +0,0 @@
-###############################################################################
-# Copyright (c) 2006, 2008 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
-#
-# Contributors:
-# Oracle - initial API and implementation
-###############################################################################
-bin.includes = about.html, about.ini, about.mappings, about.properties, eclipse32.gif, plugin.properties, plugin.xml, src/**, META-INF/
-sourcePlugin = true
diff --git a/jpa/features/org.eclipse.jpt.feature/sourceTemplateBundle/eclipse32.gif b/jpa/features/org.eclipse.jpt.feature/sourceTemplateBundle/eclipse32.gif
deleted file mode 100644
index e6ad7ccd75..0000000000
--- a/jpa/features/org.eclipse.jpt.feature/sourceTemplateBundle/eclipse32.gif
+++ /dev/null
Binary files differ
diff --git a/jpa/features/org.eclipse.jpt.feature/sourceTemplateBundle/eclipse32.png b/jpa/features/org.eclipse.jpt.feature/sourceTemplateBundle/eclipse32.png
deleted file mode 100644
index 50ae49de24..0000000000
--- a/jpa/features/org.eclipse.jpt.feature/sourceTemplateBundle/eclipse32.png
+++ /dev/null
Binary files differ
diff --git a/jpa/features/org.eclipse.jpt.feature/sourceTemplateBundle/eclipse_update_120.jpg b/jpa/features/org.eclipse.jpt.feature/sourceTemplateBundle/eclipse_update_120.jpg
deleted file mode 100644
index bfdf708ad6..0000000000
--- a/jpa/features/org.eclipse.jpt.feature/sourceTemplateBundle/eclipse_update_120.jpg
+++ /dev/null
Binary files differ
diff --git a/jpa/features/org.eclipse.jpt.feature/sourceTemplateBundle/epl-v10.html b/jpa/features/org.eclipse.jpt.feature/sourceTemplateBundle/epl-v10.html
deleted file mode 100644
index 022ad2955b..0000000000
--- a/jpa/features/org.eclipse.jpt.feature/sourceTemplateBundle/epl-v10.html
+++ /dev/null
@@ -1,328 +0,0 @@
-<html xmlns:o="urn:schemas-microsoft-com:office:office"
-xmlns:w="urn:schemas-microsoft-com:office:word"
-xmlns="http://www.w3.org/TR/REC-html40">
-
-<head>
-<meta http-equiv=Content-Type content="text/html; charset=windows-1252">
-<meta name=ProgId content=Word.Document>
-<meta name=Generator content="Microsoft Word 9">
-<meta name=Originator content="Microsoft Word 9">
-<link rel=File-List
-href="./Eclipse%20EPL%202003_11_10%20Final_files/filelist.xml">
-<title>Eclipse Public License - Version 1.0</title>
-<!--[if gte mso 9]><xml>
- <o:DocumentProperties>
- <o:Revision>2</o:Revision>
- <o:TotalTime>3</o:TotalTime>
- <o:Created>2004-03-05T23:03:00Z</o:Created>
- <o:LastSaved>2004-03-05T23:03:00Z</o:LastSaved>
- <o:Pages>4</o:Pages>
- <o:Words>1626</o:Words>
- <o:Characters>9270</o:Characters>
- <o:Lines>77</o:Lines>
- <o:Paragraphs>18</o:Paragraphs>
- <o:CharactersWithSpaces>11384</o:CharactersWithSpaces>
- <o:Version>9.4402</o:Version>
- </o:DocumentProperties>
-</xml><![endif]--><!--[if gte mso 9]><xml>
- <w:WordDocument>
- <w:TrackRevisions/>
- </w:WordDocument>
-</xml><![endif]-->
-<style>
-<!--
- /* Font Definitions */
-@font-face
- {font-family:Tahoma;
- panose-1:2 11 6 4 3 5 4 4 2 4;
- mso-font-charset:0;
- mso-generic-font-family:swiss;
- mso-font-pitch:variable;
- mso-font-signature:553679495 -2147483648 8 0 66047 0;}
- /* Style Definitions */
-p.MsoNormal, li.MsoNormal, div.MsoNormal
- {mso-style-parent:"";
- margin:0in;
- margin-bottom:.0001pt;
- mso-pagination:widow-orphan;
- font-size:12.0pt;
- font-family:"Times New Roman";
- mso-fareast-font-family:"Times New Roman";}
-p
- {margin-right:0in;
- mso-margin-top-alt:auto;
- mso-margin-bottom-alt:auto;
- margin-left:0in;
- mso-pagination:widow-orphan;
- font-size:12.0pt;
- font-family:"Times New Roman";
- mso-fareast-font-family:"Times New Roman";}
-p.BalloonText, li.BalloonText, div.BalloonText
- {mso-style-name:"Balloon Text";
- margin:0in;
- margin-bottom:.0001pt;
- mso-pagination:widow-orphan;
- font-size:8.0pt;
- font-family:Tahoma;
- mso-fareast-font-family:"Times New Roman";}
-@page Section1
- {size:8.5in 11.0in;
- margin:1.0in 1.25in 1.0in 1.25in;
- mso-header-margin:.5in;
- mso-footer-margin:.5in;
- mso-paper-source:0;}
-div.Section1
- {page:Section1;}
--->
-</style>
-</head>
-
-<body lang=EN-US style='tab-interval:.5in'>
-
-<div class=Section1>
-
-<p align=center style='text-align:center'><b>Eclipse Public License - v 1.0</b>
-</p>
-
-<p><span style='font-size:10.0pt'>THE ACCOMPANYING PROGRAM IS PROVIDED UNDER
-THE TERMS OF THIS ECLIPSE PUBLIC LICENSE (&quot;AGREEMENT&quot;). ANY USE,
-REPRODUCTION OR DISTRIBUTION OF THE PROGRAM CONSTITUTES RECIPIENT'S ACCEPTANCE
-OF THIS AGREEMENT.</span> </p>
-
-<p><b><span style='font-size:10.0pt'>1. DEFINITIONS</span></b> </p>
-
-<p><span style='font-size:10.0pt'>&quot;Contribution&quot; means:</span> </p>
-
-<p class=MsoNormal style='margin-left:.5in'><span style='font-size:10.0pt'>a)
-in the case of the initial Contributor, the initial code and documentation
-distributed under this Agreement, and<br clear=left>
-b) in the case of each subsequent Contributor:</span></p>
-
-<p class=MsoNormal style='margin-left:.5in'><span style='font-size:10.0pt'>i)
-changes to the Program, and</span></p>
-
-<p class=MsoNormal style='margin-left:.5in'><span style='font-size:10.0pt'>ii)
-additions to the Program;</span></p>
-
-<p class=MsoNormal style='margin-left:.5in'><span style='font-size:10.0pt'>where
-such changes and/or additions to the Program originate from and are distributed
-by that particular Contributor. A Contribution 'originates' from a Contributor
-if it was added to the Program by such Contributor itself or anyone acting on
-such Contributor's behalf. Contributions do not include additions to the
-Program which: (i) are separate modules of software distributed in conjunction
-with the Program under their own license agreement, and (ii) are not derivative
-works of the Program. </span></p>
-
-<p><span style='font-size:10.0pt'>&quot;Contributor&quot; means any person or
-entity that distributes the Program.</span> </p>
-
-<p><span style='font-size:10.0pt'>&quot;Licensed Patents &quot; mean patent
-claims licensable by a Contributor which are necessarily infringed by the use
-or sale of its Contribution alone or when combined with the Program. </span></p>
-
-<p><span style='font-size:10.0pt'>&quot;Program&quot; means the Contributions
-distributed in accordance with this Agreement.</span> </p>
-
-<p><span style='font-size:10.0pt'>&quot;Recipient&quot; means anyone who
-receives the Program under this Agreement, including all Contributors.</span> </p>
-
-<p><b><span style='font-size:10.0pt'>2. GRANT OF RIGHTS</span></b> </p>
-
-<p class=MsoNormal style='margin-left:.5in'><span style='font-size:10.0pt'>a)
-Subject to the terms of this Agreement, each Contributor hereby grants Recipient
-a non-exclusive, worldwide, royalty-free copyright license to<span
-style='color:red'> </span>reproduce, prepare derivative works of, publicly
-display, publicly perform, distribute and sublicense the Contribution of such
-Contributor, if any, and such derivative works, in source code and object code
-form.</span></p>
-
-<p class=MsoNormal style='margin-left:.5in'><span style='font-size:10.0pt'>b)
-Subject to the terms of this Agreement, each Contributor hereby grants
-Recipient a non-exclusive, worldwide,<span style='color:green'> </span>royalty-free
-patent license under Licensed Patents to make, use, sell, offer to sell, import
-and otherwise transfer the Contribution of such Contributor, if any, in source
-code and object code form. This patent license shall apply to the combination
-of the Contribution and the Program if, at the time the Contribution is added
-by the Contributor, such addition of the Contribution causes such combination
-to be covered by the Licensed Patents. The patent license shall not apply to
-any other combinations which include the Contribution. No hardware per se is
-licensed hereunder. </span></p>
-
-<p class=MsoNormal style='margin-left:.5in'><span style='font-size:10.0pt'>c)
-Recipient understands that although each Contributor grants the licenses to its
-Contributions set forth herein, no assurances are provided by any Contributor
-that the Program does not infringe the patent or other intellectual property
-rights of any other entity. Each Contributor disclaims any liability to Recipient
-for claims brought by any other entity based on infringement of intellectual
-property rights or otherwise. As a condition to exercising the rights and
-licenses granted hereunder, each Recipient hereby assumes sole responsibility
-to secure any other intellectual property rights needed, if any. For example,
-if a third party patent license is required to allow Recipient to distribute
-the Program, it is Recipient's responsibility to acquire that license before
-distributing the Program.</span></p>
-
-<p class=MsoNormal style='margin-left:.5in'><span style='font-size:10.0pt'>d)
-Each Contributor represents that to its knowledge it has sufficient copyright
-rights in its Contribution, if any, to grant the copyright license set forth in
-this Agreement. </span></p>
-
-<p><b><span style='font-size:10.0pt'>3. REQUIREMENTS</span></b> </p>
-
-<p><span style='font-size:10.0pt'>A Contributor may choose to distribute the
-Program in object code form under its own license agreement, provided that:</span>
-</p>
-
-<p class=MsoNormal style='margin-left:.5in'><span style='font-size:10.0pt'>a)
-it complies with the terms and conditions of this Agreement; and</span></p>
-
-<p class=MsoNormal style='margin-left:.5in'><span style='font-size:10.0pt'>b)
-its license agreement:</span></p>
-
-<p class=MsoNormal style='margin-left:.5in'><span style='font-size:10.0pt'>i)
-effectively disclaims on behalf of all Contributors all warranties and
-conditions, express and implied, including warranties or conditions of title
-and non-infringement, and implied warranties or conditions of merchantability
-and fitness for a particular purpose; </span></p>
-
-<p class=MsoNormal style='margin-left:.5in'><span style='font-size:10.0pt'>ii)
-effectively excludes on behalf of all Contributors all liability for damages,
-including direct, indirect, special, incidental and consequential damages, such
-as lost profits; </span></p>
-
-<p class=MsoNormal style='margin-left:.5in'><span style='font-size:10.0pt'>iii)
-states that any provisions which differ from this Agreement are offered by that
-Contributor alone and not by any other party; and</span></p>
-
-<p class=MsoNormal style='margin-left:.5in'><span style='font-size:10.0pt'>iv)
-states that source code for the Program is available from such Contributor, and
-informs licensees how to obtain it in a reasonable manner on or through a
-medium customarily used for software exchange.<span style='color:blue'> </span></span></p>
-
-<p><span style='font-size:10.0pt'>When the Program is made available in source
-code form:</span> </p>
-
-<p class=MsoNormal style='margin-left:.5in'><span style='font-size:10.0pt'>a)
-it must be made available under this Agreement; and </span></p>
-
-<p class=MsoNormal style='margin-left:.5in'><span style='font-size:10.0pt'>b) a
-copy of this Agreement must be included with each copy of the Program. </span></p>
-
-<p><span style='font-size:10.0pt'>Contributors may not remove or alter any
-copyright notices contained within the Program. </span></p>
-
-<p><span style='font-size:10.0pt'>Each Contributor must identify itself as the
-originator of its Contribution, if any, in a manner that reasonably allows
-subsequent Recipients to identify the originator of the Contribution. </span></p>
-
-<p><b><span style='font-size:10.0pt'>4. COMMERCIAL DISTRIBUTION</span></b> </p>
-
-<p><span style='font-size:10.0pt'>Commercial distributors of software may
-accept certain responsibilities with respect to end users, business partners
-and the like. While this license is intended to facilitate the commercial use
-of the Program, the Contributor who includes the Program in a commercial
-product offering should do so in a manner which does not create potential
-liability for other Contributors. Therefore, if a Contributor includes the
-Program in a commercial product offering, such Contributor (&quot;Commercial
-Contributor&quot;) hereby agrees to defend and indemnify every other
-Contributor (&quot;Indemnified Contributor&quot;) against any losses, damages and
-costs (collectively &quot;Losses&quot;) arising from claims, lawsuits and other
-legal actions brought by a third party against the Indemnified Contributor to
-the extent caused by the acts or omissions of such Commercial Contributor in
-connection with its distribution of the Program in a commercial product
-offering. The obligations in this section do not apply to any claims or Losses
-relating to any actual or alleged intellectual property infringement. In order
-to qualify, an Indemnified Contributor must: a) promptly notify the Commercial
-Contributor in writing of such claim, and b) allow the Commercial Contributor
-to control, and cooperate with the Commercial Contributor in, the defense and
-any related settlement negotiations. The Indemnified Contributor may participate
-in any such claim at its own expense.</span> </p>
-
-<p><span style='font-size:10.0pt'>For example, a Contributor might include the
-Program in a commercial product offering, Product X. That Contributor is then a
-Commercial Contributor. If that Commercial Contributor then makes performance
-claims, or offers warranties related to Product X, those performance claims and
-warranties are such Commercial Contributor's responsibility alone. Under this
-section, the Commercial Contributor would have to defend claims against the
-other Contributors related to those performance claims and warranties, and if a
-court requires any other Contributor to pay any damages as a result, the
-Commercial Contributor must pay those damages.</span> </p>
-
-<p><b><span style='font-size:10.0pt'>5. NO WARRANTY</span></b> </p>
-
-<p><span style='font-size:10.0pt'>EXCEPT AS EXPRESSLY SET FORTH IN THIS
-AGREEMENT, THE PROGRAM IS PROVIDED ON AN &quot;AS IS&quot; BASIS, WITHOUT
-WARRANTIES OR CONDITIONS OF ANY KIND, EITHER EXPRESS OR IMPLIED INCLUDING,
-WITHOUT LIMITATION, ANY WARRANTIES OR CONDITIONS OF TITLE, NON-INFRINGEMENT,
-MERCHANTABILITY OR FITNESS FOR A PARTICULAR PURPOSE. Each Recipient is solely
-responsible for determining the appropriateness of using and distributing the
-Program and assumes all risks associated with its exercise of rights under this
-Agreement , including but not limited to the risks and costs of program errors,
-compliance with applicable laws, damage to or loss of data, programs or
-equipment, and unavailability or interruption of operations. </span></p>
-
-<p><b><span style='font-size:10.0pt'>6. DISCLAIMER OF LIABILITY</span></b> </p>
-
-<p><span style='font-size:10.0pt'>EXCEPT AS EXPRESSLY SET FORTH IN THIS
-AGREEMENT, NEITHER RECIPIENT NOR ANY CONTRIBUTORS SHALL HAVE ANY LIABILITY FOR
-ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES
-(INCLUDING WITHOUT LIMITATION LOST PROFITS), HOWEVER CAUSED AND ON ANY THEORY
-OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING
-NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OR DISTRIBUTION OF
-THE PROGRAM OR THE EXERCISE OF ANY RIGHTS GRANTED HEREUNDER, EVEN IF ADVISED OF
-THE POSSIBILITY OF SUCH DAMAGES.</span> </p>
-
-<p><b><span style='font-size:10.0pt'>7. GENERAL</span></b> </p>
-
-<p><span style='font-size:10.0pt'>If any provision of this Agreement is invalid
-or unenforceable under applicable law, it shall not affect the validity or
-enforceability of the remainder of the terms of this Agreement, and without
-further action by the parties hereto, such provision shall be reformed to the
-minimum extent necessary to make such provision valid and enforceable.</span> </p>
-
-<p><span style='font-size:10.0pt'>If Recipient institutes patent litigation
-against any entity (including a cross-claim or counterclaim in a lawsuit)
-alleging that the Program itself (excluding combinations of the Program with
-other software or hardware) infringes such Recipient's patent(s), then such
-Recipient's rights granted under Section 2(b) shall terminate as of the date
-such litigation is filed. </span></p>
-
-<p><span style='font-size:10.0pt'>All Recipient's rights under this Agreement
-shall terminate if it fails to comply with any of the material terms or
-conditions of this Agreement and does not cure such failure in a reasonable
-period of time after becoming aware of such noncompliance. If all Recipient's
-rights under this Agreement terminate, Recipient agrees to cease use and
-distribution of the Program as soon as reasonably practicable. However,
-Recipient's obligations under this Agreement and any licenses granted by
-Recipient relating to the Program shall continue and survive. </span></p>
-
-<p><span style='font-size:10.0pt'>Everyone is permitted to copy and distribute
-copies of this Agreement, but in order to avoid inconsistency the Agreement is
-copyrighted and may only be modified in the following manner. The Agreement
-Steward reserves the right to publish new versions (including revisions) of
-this Agreement from time to time. No one other than the Agreement Steward has
-the right to modify this Agreement. The Eclipse Foundation is the initial
-Agreement Steward. The Eclipse Foundation may assign the responsibility to
-serve as the Agreement Steward to a suitable separate entity. Each new version
-of the Agreement will be given a distinguishing version number. The Program
-(including Contributions) may always be distributed subject to the version of
-the Agreement under which it was received. In addition, after a new version of
-the Agreement is published, Contributor may elect to distribute the Program
-(including its Contributions) under the new version. Except as expressly stated
-in Sections 2(a) and 2(b) above, Recipient receives no rights or licenses to
-the intellectual property of any Contributor under this Agreement, whether
-expressly, by implication, estoppel or otherwise. All rights in the Program not
-expressly granted under this Agreement are reserved.</span> </p>
-
-<p><span style='font-size:10.0pt'>This Agreement is governed by the laws of the
-State of New York and the intellectual property laws of the United States of
-America. No party to this Agreement will bring a legal action under this
-Agreement more than one year after the cause of action arose. Each party waives
-its rights to a jury trial in any resulting litigation.</span> </p>
-
-<p class=MsoNormal><![if !supportEmptyParas]>&nbsp;<![endif]><o:p></o:p></p>
-
-</div>
-
-</body>
-
-</html>
diff --git a/jpa/features/org.eclipse.jpt.feature/sourceTemplateBundle/license.html b/jpa/features/org.eclipse.jpt.feature/sourceTemplateBundle/license.html
deleted file mode 100644
index 14b1d50265..0000000000
--- a/jpa/features/org.eclipse.jpt.feature/sourceTemplateBundle/license.html
+++ /dev/null
@@ -1,83 +0,0 @@
-<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.0//EN">
-<html>
-<head>
-<meta http-equiv=Content-Type content="text/html; charset=iso-8859-1">
-<title>Eclipse.org Software User Agreement</title>
-</head>
-
-<body lang="EN-US" link=blue vlink=purple>
-<h2>Eclipse Foundation Software User Agreement</h2>
-<p>June 06, 2007</p>
-
-<h3>Usage Of Content</h3>
-
-<p>THE ECLIPSE FOUNDATION MAKES AVAILABLE SOFTWARE, DOCUMENTATION, INFORMATION AND/OR OTHER MATERIALS FOR OPEN SOURCE PROJECTS
- (COLLECTIVELY &quot;CONTENT&quot;). USE OF THE CONTENT IS GOVERNED BY THE TERMS AND CONDITIONS OF THIS AGREEMENT AND/OR THE TERMS AND
- CONDITIONS OF LICENSE AGREEMENTS OR NOTICES INDICATED OR REFERENCED BELOW. BY USING THE CONTENT, YOU AGREE THAT YOUR USE
- OF THE CONTENT IS GOVERNED BY THIS AGREEMENT AND/OR THE TERMS AND CONDITIONS OF ANY APPLICABLE LICENSE AGREEMENTS OR
- NOTICES INDICATED OR REFERENCED BELOW. IF YOU DO NOT AGREE TO THE TERMS AND CONDITIONS OF THIS AGREEMENT AND THE TERMS AND
- CONDITIONS OF ANY APPLICABLE LICENSE AGREEMENTS OR NOTICES INDICATED OR REFERENCED BELOW, THEN YOU MAY NOT USE THE CONTENT.</p>
-
-<h3>Applicable Licenses</h3>
-
-<p>Unless otherwise indicated, all Content made available by the Eclipse Foundation is provided to you under the terms and conditions of the Eclipse Public License Version 1.0
- (&quot;EPL&quot;). A copy of the EPL is provided with this Content and is also available at <a href="http://www.eclipse.org/legal/epl-v10.html">http://www.eclipse.org/legal/epl-v10.html</a>.
- For purposes of the EPL, &quot;Program&quot; will mean the Content.</p>
-
-<p>Content includes, but is not limited to, source code, object code, documentation and other files maintained in the Eclipse.org CVS repository (&quot;Repository&quot;) in CVS
- modules (&quot;Modules&quot;) and made available as downloadable archives (&quot;Downloads&quot;).</p>
-
-<ul>
- <li>Content may be structured and packaged into modules to facilitate delivering, extending, and upgrading the Content. Typical modules may include plug-ins (&quot;Plug-ins&quot;), plug-in fragments (&quot;Fragments&quot;), and features (&quot;Features&quot;).</li>
- <li>Each Plug-in or Fragment may be packaged as a sub-directory or JAR (Java&trade; ARchive) in a directory named &quot;plugins&quot;.</li>
- <li>A Feature is a bundle of one or more Plug-ins and/or Fragments and associated material. Each Feature may be packaged as a sub-directory in a directory named &quot;features&quot;. Within a Feature, files named &quot;feature.xml&quot; may contain a list of the names and version numbers of the Plug-ins
- and/or Fragments associated with that Feature.</li>
- <li>Features may also include other Features (&quot;Included Features&quot;). Within a Feature, files named &quot;feature.xml&quot; may contain a list of the names and version numbers of Included Features.</li>
-</ul>
-
-<p>The terms and conditions governing Plug-ins and Fragments should be contained in files named &quot;about.html&quot; (&quot;Abouts&quot;). The terms and conditions governing Features and
-Included Features should be contained in files named &quot;license.html&quot; (&quot;Feature Licenses&quot;). Abouts and Feature Licenses may be located in any directory of a Download or Module
-including, but not limited to the following locations:</p>
-
-<ul>
- <li>The top-level (root) directory</li>
- <li>Plug-in and Fragment directories</li>
- <li>Inside Plug-ins and Fragments packaged as JARs</li>
- <li>Sub-directories of the directory named &quot;src&quot; of certain Plug-ins</li>
- <li>Feature directories</li>
-</ul>
-
-<p>Note: if a Feature made available by the Eclipse Foundation is installed using the Eclipse Update Manager, you must agree to a license (&quot;Feature Update License&quot;) during the
-installation process. If the Feature contains Included Features, the Feature Update License should either provide you with the terms and conditions governing the Included Features or
-inform you where you can locate them. Feature Update Licenses may be found in the &quot;license&quot; property of files named &quot;feature.properties&quot; found within a Feature.
-Such Abouts, Feature Licenses, and Feature Update Licenses contain the terms and conditions (or references to such terms and conditions) that govern your use of the associated Content in
-that directory.</p>
-
-<p>THE ABOUTS, FEATURE LICENSES, AND FEATURE UPDATE LICENSES MAY REFER TO THE EPL OR OTHER LICENSE AGREEMENTS, NOTICES OR TERMS AND CONDITIONS. SOME OF THESE
-OTHER LICENSE AGREEMENTS MAY INCLUDE (BUT ARE NOT LIMITED TO):</p>
-
-<ul>
- <li>Common Public License Version 1.0 (available at <a href="http://www.eclipse.org/legal/cpl-v10.html">http://www.eclipse.org/legal/cpl-v10.html</a>)</li>
- <li>Apache Software License 1.1 (available at <a href="http://www.apache.org/licenses/LICENSE">http://www.apache.org/licenses/LICENSE</a>)</li>
- <li>Apache Software License 2.0 (available at <a href="http://www.apache.org/licenses/LICENSE-2.0">http://www.apache.org/licenses/LICENSE-2.0</a>)</li>
- <li>IBM Public License 1.0 (available at <a href="http://oss.software.ibm.com/developerworks/opensource/license10.html">http://oss.software.ibm.com/developerworks/opensource/license10.html</a>)</li>
- <li>Metro Link Public License 1.00 (available at <a href="http://www.opengroup.org/openmotif/supporters/metrolink/license.html">http://www.opengroup.org/openmotif/supporters/metrolink/license.html</a>)</li>
- <li>Mozilla Public License Version 1.1 (available at <a href="http://www.mozilla.org/MPL/MPL-1.1.html">http://www.mozilla.org/MPL/MPL-1.1.html</a>)</li>
-
- <LI>Common Development and Distribution License (CDDL) Version 1.0 (available at <A
- href="http://www.sun.com/cddl/cddl.html">http://www.sun.com/cddl/cddl.html)</A>
- </LI>
-</UL>
-
-<p>IT IS YOUR OBLIGATION TO READ AND ACCEPT ALL SUCH TERMS AND CONDITIONS PRIOR TO USE OF THE CONTENT. If no About, Feature License, or Feature Update License is provided, please
-contact the Eclipse Foundation to determine what terms and conditions govern that particular Content.</p>
-
-<h3>Cryptography</h3>
-
-<p>Content may contain encryption software. The country in which you are currently may have restrictions on the import, possession, and use, and/or re-export to
- another country, of encryption software. BEFORE using any encryption software, please check the country's laws, regulations and policies concerning the import,
- possession, or use, and re-export of encryption software, to see if this is permitted.</p>
-
-<small>Java and all Java-based trademarks are trademarks of Sun Microsystems, Inc. in the United States, other countries, or both.</small>
-</body>
-</html>
diff --git a/jpa/features/org.eclipse.jpt.feature/sourceTemplateBundle/plugin.properties b/jpa/features/org.eclipse.jpt.feature/sourceTemplateBundle/plugin.properties
deleted file mode 100644
index f948547000..0000000000
--- a/jpa/features/org.eclipse.jpt.feature/sourceTemplateBundle/plugin.properties
+++ /dev/null
@@ -1,13 +0,0 @@
-###############################################################################
-# Copyright (c) 2006, 2008 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
-#
-# Contributors:
-# Oracle - initial API and implementation
-###############################################################################
-
-pluginName = Dali Java Persistence API (JPA) Tools
-providerName = Eclipse.org
diff --git a/jpa/features/org.eclipse.jpt.feature/sourceTemplateFeature/build.properties b/jpa/features/org.eclipse.jpt.feature/sourceTemplateFeature/build.properties
deleted file mode 100644
index f60dad3f94..0000000000
--- a/jpa/features/org.eclipse.jpt.feature/sourceTemplateFeature/build.properties
+++ /dev/null
@@ -1,16 +0,0 @@
-###############################################################################
-# Copyright (c) 2006, 2008 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
-#
-# Contributors:
-# Oracle - initial API and implementation
-###############################################################################
-bin.includes = \
- epl-v10.html,\
- eclipse_update_120.jpg,\
- feature.xml,\
- feature.properties,\
- license.html
diff --git a/jpa/features/org.eclipse.jpt.feature/sourceTemplateFeature/eclipse_update_120.jpg b/jpa/features/org.eclipse.jpt.feature/sourceTemplateFeature/eclipse_update_120.jpg
deleted file mode 100644
index bfdf708ad6..0000000000
--- a/jpa/features/org.eclipse.jpt.feature/sourceTemplateFeature/eclipse_update_120.jpg
+++ /dev/null
Binary files differ
diff --git a/jpa/features/org.eclipse.jpt.feature/sourceTemplateFeature/epl-v10.html b/jpa/features/org.eclipse.jpt.feature/sourceTemplateFeature/epl-v10.html
deleted file mode 100644
index 022ad2955b..0000000000
--- a/jpa/features/org.eclipse.jpt.feature/sourceTemplateFeature/epl-v10.html
+++ /dev/null
@@ -1,328 +0,0 @@
-<html xmlns:o="urn:schemas-microsoft-com:office:office"
-xmlns:w="urn:schemas-microsoft-com:office:word"
-xmlns="http://www.w3.org/TR/REC-html40">
-
-<head>
-<meta http-equiv=Content-Type content="text/html; charset=windows-1252">
-<meta name=ProgId content=Word.Document>
-<meta name=Generator content="Microsoft Word 9">
-<meta name=Originator content="Microsoft Word 9">
-<link rel=File-List
-href="./Eclipse%20EPL%202003_11_10%20Final_files/filelist.xml">
-<title>Eclipse Public License - Version 1.0</title>
-<!--[if gte mso 9]><xml>
- <o:DocumentProperties>
- <o:Revision>2</o:Revision>
- <o:TotalTime>3</o:TotalTime>
- <o:Created>2004-03-05T23:03:00Z</o:Created>
- <o:LastSaved>2004-03-05T23:03:00Z</o:LastSaved>
- <o:Pages>4</o:Pages>
- <o:Words>1626</o:Words>
- <o:Characters>9270</o:Characters>
- <o:Lines>77</o:Lines>
- <o:Paragraphs>18</o:Paragraphs>
- <o:CharactersWithSpaces>11384</o:CharactersWithSpaces>
- <o:Version>9.4402</o:Version>
- </o:DocumentProperties>
-</xml><![endif]--><!--[if gte mso 9]><xml>
- <w:WordDocument>
- <w:TrackRevisions/>
- </w:WordDocument>
-</xml><![endif]-->
-<style>
-<!--
- /* Font Definitions */
-@font-face
- {font-family:Tahoma;
- panose-1:2 11 6 4 3 5 4 4 2 4;
- mso-font-charset:0;
- mso-generic-font-family:swiss;
- mso-font-pitch:variable;
- mso-font-signature:553679495 -2147483648 8 0 66047 0;}
- /* Style Definitions */
-p.MsoNormal, li.MsoNormal, div.MsoNormal
- {mso-style-parent:"";
- margin:0in;
- margin-bottom:.0001pt;
- mso-pagination:widow-orphan;
- font-size:12.0pt;
- font-family:"Times New Roman";
- mso-fareast-font-family:"Times New Roman";}
-p
- {margin-right:0in;
- mso-margin-top-alt:auto;
- mso-margin-bottom-alt:auto;
- margin-left:0in;
- mso-pagination:widow-orphan;
- font-size:12.0pt;
- font-family:"Times New Roman";
- mso-fareast-font-family:"Times New Roman";}
-p.BalloonText, li.BalloonText, div.BalloonText
- {mso-style-name:"Balloon Text";
- margin:0in;
- margin-bottom:.0001pt;
- mso-pagination:widow-orphan;
- font-size:8.0pt;
- font-family:Tahoma;
- mso-fareast-font-family:"Times New Roman";}
-@page Section1
- {size:8.5in 11.0in;
- margin:1.0in 1.25in 1.0in 1.25in;
- mso-header-margin:.5in;
- mso-footer-margin:.5in;
- mso-paper-source:0;}
-div.Section1
- {page:Section1;}
--->
-</style>
-</head>
-
-<body lang=EN-US style='tab-interval:.5in'>
-
-<div class=Section1>
-
-<p align=center style='text-align:center'><b>Eclipse Public License - v 1.0</b>
-</p>
-
-<p><span style='font-size:10.0pt'>THE ACCOMPANYING PROGRAM IS PROVIDED UNDER
-THE TERMS OF THIS ECLIPSE PUBLIC LICENSE (&quot;AGREEMENT&quot;). ANY USE,
-REPRODUCTION OR DISTRIBUTION OF THE PROGRAM CONSTITUTES RECIPIENT'S ACCEPTANCE
-OF THIS AGREEMENT.</span> </p>
-
-<p><b><span style='font-size:10.0pt'>1. DEFINITIONS</span></b> </p>
-
-<p><span style='font-size:10.0pt'>&quot;Contribution&quot; means:</span> </p>
-
-<p class=MsoNormal style='margin-left:.5in'><span style='font-size:10.0pt'>a)
-in the case of the initial Contributor, the initial code and documentation
-distributed under this Agreement, and<br clear=left>
-b) in the case of each subsequent Contributor:</span></p>
-
-<p class=MsoNormal style='margin-left:.5in'><span style='font-size:10.0pt'>i)
-changes to the Program, and</span></p>
-
-<p class=MsoNormal style='margin-left:.5in'><span style='font-size:10.0pt'>ii)
-additions to the Program;</span></p>
-
-<p class=MsoNormal style='margin-left:.5in'><span style='font-size:10.0pt'>where
-such changes and/or additions to the Program originate from and are distributed
-by that particular Contributor. A Contribution 'originates' from a Contributor
-if it was added to the Program by such Contributor itself or anyone acting on
-such Contributor's behalf. Contributions do not include additions to the
-Program which: (i) are separate modules of software distributed in conjunction
-with the Program under their own license agreement, and (ii) are not derivative
-works of the Program. </span></p>
-
-<p><span style='font-size:10.0pt'>&quot;Contributor&quot; means any person or
-entity that distributes the Program.</span> </p>
-
-<p><span style='font-size:10.0pt'>&quot;Licensed Patents &quot; mean patent
-claims licensable by a Contributor which are necessarily infringed by the use
-or sale of its Contribution alone or when combined with the Program. </span></p>
-
-<p><span style='font-size:10.0pt'>&quot;Program&quot; means the Contributions
-distributed in accordance with this Agreement.</span> </p>
-
-<p><span style='font-size:10.0pt'>&quot;Recipient&quot; means anyone who
-receives the Program under this Agreement, including all Contributors.</span> </p>
-
-<p><b><span style='font-size:10.0pt'>2. GRANT OF RIGHTS</span></b> </p>
-
-<p class=MsoNormal style='margin-left:.5in'><span style='font-size:10.0pt'>a)
-Subject to the terms of this Agreement, each Contributor hereby grants Recipient
-a non-exclusive, worldwide, royalty-free copyright license to<span
-style='color:red'> </span>reproduce, prepare derivative works of, publicly
-display, publicly perform, distribute and sublicense the Contribution of such
-Contributor, if any, and such derivative works, in source code and object code
-form.</span></p>
-
-<p class=MsoNormal style='margin-left:.5in'><span style='font-size:10.0pt'>b)
-Subject to the terms of this Agreement, each Contributor hereby grants
-Recipient a non-exclusive, worldwide,<span style='color:green'> </span>royalty-free
-patent license under Licensed Patents to make, use, sell, offer to sell, import
-and otherwise transfer the Contribution of such Contributor, if any, in source
-code and object code form. This patent license shall apply to the combination
-of the Contribution and the Program if, at the time the Contribution is added
-by the Contributor, such addition of the Contribution causes such combination
-to be covered by the Licensed Patents. The patent license shall not apply to
-any other combinations which include the Contribution. No hardware per se is
-licensed hereunder. </span></p>
-
-<p class=MsoNormal style='margin-left:.5in'><span style='font-size:10.0pt'>c)
-Recipient understands that although each Contributor grants the licenses to its
-Contributions set forth herein, no assurances are provided by any Contributor
-that the Program does not infringe the patent or other intellectual property
-rights of any other entity. Each Contributor disclaims any liability to Recipient
-for claims brought by any other entity based on infringement of intellectual
-property rights or otherwise. As a condition to exercising the rights and
-licenses granted hereunder, each Recipient hereby assumes sole responsibility
-to secure any other intellectual property rights needed, if any. For example,
-if a third party patent license is required to allow Recipient to distribute
-the Program, it is Recipient's responsibility to acquire that license before
-distributing the Program.</span></p>
-
-<p class=MsoNormal style='margin-left:.5in'><span style='font-size:10.0pt'>d)
-Each Contributor represents that to its knowledge it has sufficient copyright
-rights in its Contribution, if any, to grant the copyright license set forth in
-this Agreement. </span></p>
-
-<p><b><span style='font-size:10.0pt'>3. REQUIREMENTS</span></b> </p>
-
-<p><span style='font-size:10.0pt'>A Contributor may choose to distribute the
-Program in object code form under its own license agreement, provided that:</span>
-</p>
-
-<p class=MsoNormal style='margin-left:.5in'><span style='font-size:10.0pt'>a)
-it complies with the terms and conditions of this Agreement; and</span></p>
-
-<p class=MsoNormal style='margin-left:.5in'><span style='font-size:10.0pt'>b)
-its license agreement:</span></p>
-
-<p class=MsoNormal style='margin-left:.5in'><span style='font-size:10.0pt'>i)
-effectively disclaims on behalf of all Contributors all warranties and
-conditions, express and implied, including warranties or conditions of title
-and non-infringement, and implied warranties or conditions of merchantability
-and fitness for a particular purpose; </span></p>
-
-<p class=MsoNormal style='margin-left:.5in'><span style='font-size:10.0pt'>ii)
-effectively excludes on behalf of all Contributors all liability for damages,
-including direct, indirect, special, incidental and consequential damages, such
-as lost profits; </span></p>
-
-<p class=MsoNormal style='margin-left:.5in'><span style='font-size:10.0pt'>iii)
-states that any provisions which differ from this Agreement are offered by that
-Contributor alone and not by any other party; and</span></p>
-
-<p class=MsoNormal style='margin-left:.5in'><span style='font-size:10.0pt'>iv)
-states that source code for the Program is available from such Contributor, and
-informs licensees how to obtain it in a reasonable manner on or through a
-medium customarily used for software exchange.<span style='color:blue'> </span></span></p>
-
-<p><span style='font-size:10.0pt'>When the Program is made available in source
-code form:</span> </p>
-
-<p class=MsoNormal style='margin-left:.5in'><span style='font-size:10.0pt'>a)
-it must be made available under this Agreement; and </span></p>
-
-<p class=MsoNormal style='margin-left:.5in'><span style='font-size:10.0pt'>b) a
-copy of this Agreement must be included with each copy of the Program. </span></p>
-
-<p><span style='font-size:10.0pt'>Contributors may not remove or alter any
-copyright notices contained within the Program. </span></p>
-
-<p><span style='font-size:10.0pt'>Each Contributor must identify itself as the
-originator of its Contribution, if any, in a manner that reasonably allows
-subsequent Recipients to identify the originator of the Contribution. </span></p>
-
-<p><b><span style='font-size:10.0pt'>4. COMMERCIAL DISTRIBUTION</span></b> </p>
-
-<p><span style='font-size:10.0pt'>Commercial distributors of software may
-accept certain responsibilities with respect to end users, business partners
-and the like. While this license is intended to facilitate the commercial use
-of the Program, the Contributor who includes the Program in a commercial
-product offering should do so in a manner which does not create potential
-liability for other Contributors. Therefore, if a Contributor includes the
-Program in a commercial product offering, such Contributor (&quot;Commercial
-Contributor&quot;) hereby agrees to defend and indemnify every other
-Contributor (&quot;Indemnified Contributor&quot;) against any losses, damages and
-costs (collectively &quot;Losses&quot;) arising from claims, lawsuits and other
-legal actions brought by a third party against the Indemnified Contributor to
-the extent caused by the acts or omissions of such Commercial Contributor in
-connection with its distribution of the Program in a commercial product
-offering. The obligations in this section do not apply to any claims or Losses
-relating to any actual or alleged intellectual property infringement. In order
-to qualify, an Indemnified Contributor must: a) promptly notify the Commercial
-Contributor in writing of such claim, and b) allow the Commercial Contributor
-to control, and cooperate with the Commercial Contributor in, the defense and
-any related settlement negotiations. The Indemnified Contributor may participate
-in any such claim at its own expense.</span> </p>
-
-<p><span style='font-size:10.0pt'>For example, a Contributor might include the
-Program in a commercial product offering, Product X. That Contributor is then a
-Commercial Contributor. If that Commercial Contributor then makes performance
-claims, or offers warranties related to Product X, those performance claims and
-warranties are such Commercial Contributor's responsibility alone. Under this
-section, the Commercial Contributor would have to defend claims against the
-other Contributors related to those performance claims and warranties, and if a
-court requires any other Contributor to pay any damages as a result, the
-Commercial Contributor must pay those damages.</span> </p>
-
-<p><b><span style='font-size:10.0pt'>5. NO WARRANTY</span></b> </p>
-
-<p><span style='font-size:10.0pt'>EXCEPT AS EXPRESSLY SET FORTH IN THIS
-AGREEMENT, THE PROGRAM IS PROVIDED ON AN &quot;AS IS&quot; BASIS, WITHOUT
-WARRANTIES OR CONDITIONS OF ANY KIND, EITHER EXPRESS OR IMPLIED INCLUDING,
-WITHOUT LIMITATION, ANY WARRANTIES OR CONDITIONS OF TITLE, NON-INFRINGEMENT,
-MERCHANTABILITY OR FITNESS FOR A PARTICULAR PURPOSE. Each Recipient is solely
-responsible for determining the appropriateness of using and distributing the
-Program and assumes all risks associated with its exercise of rights under this
-Agreement , including but not limited to the risks and costs of program errors,
-compliance with applicable laws, damage to or loss of data, programs or
-equipment, and unavailability or interruption of operations. </span></p>
-
-<p><b><span style='font-size:10.0pt'>6. DISCLAIMER OF LIABILITY</span></b> </p>
-
-<p><span style='font-size:10.0pt'>EXCEPT AS EXPRESSLY SET FORTH IN THIS
-AGREEMENT, NEITHER RECIPIENT NOR ANY CONTRIBUTORS SHALL HAVE ANY LIABILITY FOR
-ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES
-(INCLUDING WITHOUT LIMITATION LOST PROFITS), HOWEVER CAUSED AND ON ANY THEORY
-OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING
-NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OR DISTRIBUTION OF
-THE PROGRAM OR THE EXERCISE OF ANY RIGHTS GRANTED HEREUNDER, EVEN IF ADVISED OF
-THE POSSIBILITY OF SUCH DAMAGES.</span> </p>
-
-<p><b><span style='font-size:10.0pt'>7. GENERAL</span></b> </p>
-
-<p><span style='font-size:10.0pt'>If any provision of this Agreement is invalid
-or unenforceable under applicable law, it shall not affect the validity or
-enforceability of the remainder of the terms of this Agreement, and without
-further action by the parties hereto, such provision shall be reformed to the
-minimum extent necessary to make such provision valid and enforceable.</span> </p>
-
-<p><span style='font-size:10.0pt'>If Recipient institutes patent litigation
-against any entity (including a cross-claim or counterclaim in a lawsuit)
-alleging that the Program itself (excluding combinations of the Program with
-other software or hardware) infringes such Recipient's patent(s), then such
-Recipient's rights granted under Section 2(b) shall terminate as of the date
-such litigation is filed. </span></p>
-
-<p><span style='font-size:10.0pt'>All Recipient's rights under this Agreement
-shall terminate if it fails to comply with any of the material terms or
-conditions of this Agreement and does not cure such failure in a reasonable
-period of time after becoming aware of such noncompliance. If all Recipient's
-rights under this Agreement terminate, Recipient agrees to cease use and
-distribution of the Program as soon as reasonably practicable. However,
-Recipient's obligations under this Agreement and any licenses granted by
-Recipient relating to the Program shall continue and survive. </span></p>
-
-<p><span style='font-size:10.0pt'>Everyone is permitted to copy and distribute
-copies of this Agreement, but in order to avoid inconsistency the Agreement is
-copyrighted and may only be modified in the following manner. The Agreement
-Steward reserves the right to publish new versions (including revisions) of
-this Agreement from time to time. No one other than the Agreement Steward has
-the right to modify this Agreement. The Eclipse Foundation is the initial
-Agreement Steward. The Eclipse Foundation may assign the responsibility to
-serve as the Agreement Steward to a suitable separate entity. Each new version
-of the Agreement will be given a distinguishing version number. The Program
-(including Contributions) may always be distributed subject to the version of
-the Agreement under which it was received. In addition, after a new version of
-the Agreement is published, Contributor may elect to distribute the Program
-(including its Contributions) under the new version. Except as expressly stated
-in Sections 2(a) and 2(b) above, Recipient receives no rights or licenses to
-the intellectual property of any Contributor under this Agreement, whether
-expressly, by implication, estoppel or otherwise. All rights in the Program not
-expressly granted under this Agreement are reserved.</span> </p>
-
-<p><span style='font-size:10.0pt'>This Agreement is governed by the laws of the
-State of New York and the intellectual property laws of the United States of
-America. No party to this Agreement will bring a legal action under this
-Agreement more than one year after the cause of action arose. Each party waives
-its rights to a jury trial in any resulting litigation.</span> </p>
-
-<p class=MsoNormal><![if !supportEmptyParas]>&nbsp;<![endif]><o:p></o:p></p>
-
-</div>
-
-</body>
-
-</html>
diff --git a/jpa/features/org.eclipse.jpt.feature/sourceTemplateFeature/feature.properties b/jpa/features/org.eclipse.jpt.feature/sourceTemplateFeature/feature.properties
deleted file mode 100644
index 215a046c43..0000000000
--- a/jpa/features/org.eclipse.jpt.feature/sourceTemplateFeature/feature.properties
+++ /dev/null
@@ -1,145 +0,0 @@
-###############################################################################
-# Copyright (c) 2006, 2008 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
-#
-# Contributors:
-# Oracle - initial API and implementation
-###############################################################################
-# feature.properties
-# contains externalized strings for feature.xml
-# "%foo" in feature.xml corresponds to the key "foo" in this file
-# java.io.Properties file (ISO 8859-1 with "\" escapes)
-# This file should be translated.
-
-# "featureName" property - name of the feature
-featureName=Dali Java Persistence Tools
-
-# "providerName" property - name of the company that provides the feature
-providerName=Eclipse Web Tools Platform
-
-# "updateSiteName" property - label for the update site
-updateSiteName=The Eclipse Web Tools Platform (WTP) Project update site
-
-# "description" property - description of the feature
-description=Dali Java Persistence API (JPA) Tools
-
-# "copyright" property - text of the "Feature Update Copyright"
-copyright=\
-Copyright (c) 2006 2008 Oracle Corporation.\n\
-All rights reserved. This program and the accompanying materials\n\
-are made available under the terms of the Eclipse Public License v1.0\n\
-which accompanies this distribution, and is available at\n\
-http://www.eclipse.org/legal/epl-v10.html\n\
-\n\
-Contributors:\n\
- Oracle - initial API and implementation\n
-################ end of copyright property ####################################
-
-# "licenseURL" property - URL of the "Feature License"
-# do not translate value - just change to point to a locale-specific HTML page
-licenseURL=license.html
-
-# "license" property - text of the "Feature Update License"
-# should be plain text version of license agreement pointed to be "licenseURL"
-license=\
-ECLIPSE FOUNDATION SOFTWARE USER AGREEMENT\n\
-June 06, 2007\n\
-\n\
-Usage Of Content\n\
-\n\
-THE ECLIPSE FOUNDATION MAKES AVAILABLE SOFTWARE, DOCUMENTATION, INFORMATION AND/OR\n\
-OTHER MATERIALS FOR OPEN SOURCE PROJECTS (COLLECTIVELY "CONTENT").\n\
-USE OF THE CONTENT IS GOVERNED BY THE TERMS AND CONDITIONS OF THIS\n\
-AGREEMENT AND/OR THE TERMS AND CONDITIONS OF LICENSE AGREEMENTS OR\n\
-NOTICES INDICATED OR REFERENCED BELOW. BY USING THE CONTENT, YOU\n\
-AGREE THAT YOUR USE OF THE CONTENT IS GOVERNED BY THIS AGREEMENT\n\
-AND/OR THE TERMS AND CONDITIONS OF ANY APPLICABLE LICENSE AGREEMENTS\n\
-OR NOTICES INDICATED OR REFERENCED BELOW. IF YOU DO NOT AGREE TO THE\n\
-TERMS AND CONDITIONS OF THIS AGREEMENT AND THE TERMS AND CONDITIONS\n\
-OF ANY APPLICABLE LICENSE AGREEMENTS OR NOTICES INDICATED OR REFERENCED\n\
-BELOW, THEN YOU MAY NOT USE THE CONTENT.\n\
-\n\
-Applicable Licenses\n\
-\n\
-Unless otherwise indicated, all Content made available by the Eclipse Foundation\n\
-is provided to you under the terms and conditions of the Eclipse Public\n\
-License Version 1.0 ("EPL"). A copy of the EPL is provided with this\n\
-Content and is also available at http://www.eclipse.org/legal/epl-v10.html.\n\
-For purposes of the EPL, "Program" will mean the Content.\n\
-\n\
-Content includes, but is not limited to, source code, object code,\n\
-documentation and other files maintained in the Eclipse.org CVS\n\
-repository ("Repository") in CVS modules ("Modules") and made available\n\
-as downloadable archives ("Downloads").\n\
-\n\
- - Content may be structured and packaged into modules to facilitate delivering,\n\
- extending, and upgrading the Content. Typical modules may include plug-ins ("Plug-ins"),\n\
- plug-in fragments ("Fragments"), and features ("Features").\n\
- - Each Plug-in or Fragment may be packaged as a sub-directory or JAR (Java? ARchive)\n\
- in a directory named "plugins".\n\
- - A Feature is a bundle of one or more Plug-ins and/or Fragments and associated material.\n\
- Each Feature may be packaged as a sub-directory in a directory named "features".\n\
- Within a Feature, files named "feature.xml" may contain a list of the names and version\n\
- numbers of the Plug-ins and/or Fragments associated with that Feature.\n\
- - Features may also include other Features ("Included Features"). Within a Feature, files\n\
- named "feature.xml" may contain a list of the names and version numbers of Included Features.\n\
-\n\
-Features may also include other Features ("Included Features"). Files named\n\
-"feature.xml" may contain a list of the names and version numbers of\n\
-Included Features.\n\
-\n\
-The terms and conditions governing Plug-ins and Fragments should be\n\
-contained in files named "about.html" ("Abouts"). The terms and\n\
-conditions governing Features and Included Features should be contained\n\
-in files named "license.html" ("Feature Licenses"). Abouts and Feature\n\
-Licenses may be located in any directory of a Download or Module\n\
-including, but not limited to the following locations:\n\
-\n\
- - The top-level (root) directory\n\
- - Plug-in and Fragment directories\n\
- - Inside Plug-ins and Fragments packaged as JARs\n\
- - Sub-directories of the directory named "src" of certain Plug-ins\n\
- - Feature directories\n\
-\n\
-Note: if a Feature made available by the Eclipse Foundation is installed using the\n\
-Eclipse Update Manager, you must agree to a license ("Feature Update\n\
-License") during the installation process. If the Feature contains\n\
-Included Features, the Feature Update License should either provide you\n\
-with the terms and conditions governing the Included Features or inform\n\
-you where you can locate them. Feature Update Licenses may be found in\n\
-the "license" property of files named "feature.properties". Such Abouts,\n\
-Feature Licenses and Feature Update Licenses contain the terms and\n\
-conditions (or references to such terms and conditions) that govern your\n\
-use of the associated Content in that directory.\n\
-\n\
-THE ABOUTS, FEATURE LICENSES AND FEATURE UPDATE LICENSES MAY REFER\n\
-TO THE EPL OR OTHER LICENSE AGREEMENTS, NOTICES OR TERMS AND CONDITIONS.\n\
-SOME OF THESE OTHER LICENSE AGREEMENTS MAY INCLUDE (BUT ARE NOT LIMITED TO):\n\
-\n\
- - Common Public License Version 1.0 (available at http://www.eclipse.org/legal/cpl-v10.html)\n\
- - Apache Software License 1.1 (available at http://www.apache.org/licenses/LICENSE)\n\
- - Apache Software License 2.0 (available at http://www.apache.org/licenses/LICENSE-2.0)\n\
- - IBM Public License 1.0 (available at http://oss.software.ibm.com/developerworks/opensource/license10.html)\n\
- - Metro Link Public License 1.00 (available at http://www.opengroup.org/openmotif/supporters/metrolink/license.html)\n\
- - Mozilla Public License Version 1.1 (available at http://www.mozilla.org/MPL/MPL-1.1.html)\n\
- - Common Development and Distribution License (CDDL) Version 1.0 (available at http://www.sun.com/cddl/cddl.html)\n\
-\n\
-IT IS YOUR OBLIGATION TO READ AND ACCEPT ALL SUCH TERMS AND CONDITIONS PRIOR\n\
-TO USE OF THE CONTENT. If no About, Feature License or Feature Update License\n\
-is provided, please contact the Eclipse Foundation to determine what terms and conditions\n\
-govern that particular Content.\n\
-\n\
-Cryptography\n\
-\n\
-Content may contain encryption software. The country in which you are\n\
-currently may have restrictions on the import, possession, and use,\n\
-and/or re-export to another country, of encryption software. BEFORE\n\
-using any encryption software, please check the country's laws,\n\
-regulations and policies concerning the import, possession, or use,\n\
-and re-export of encryption software, to see if this is permitted.\n\
-\n\
-Java and all Java-based trademarks are trademarks of Sun Microsystems, Inc. in the United States, other countries, or both.\n
-########### end of license property ##########################################
diff --git a/jpa/features/org.eclipse.jpt.feature/sourceTemplateFeature/license.html b/jpa/features/org.eclipse.jpt.feature/sourceTemplateFeature/license.html
deleted file mode 100644
index fec4a489ad..0000000000
--- a/jpa/features/org.eclipse.jpt.feature/sourceTemplateFeature/license.html
+++ /dev/null
@@ -1,82 +0,0 @@
-<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.0//EN">
-<html>
-<head>
-<meta http-equiv=Content-Type content="text/html; charset=iso-8859-1">
-<title>Eclipse.org Software User Agreement</title>
-</head>
-
-<body lang="EN-US" link=blue vlink=purple>
-<h2>Eclipse Foundation Software User Agreement</h2>
-<p>June 06, 2007</p>
-
-<h3>Usage Of Content</h3>
-
-<p>THE ECLIPSE FOUNDATION MAKES AVAILABLE SOFTWARE, DOCUMENTATION, INFORMATION AND/OR OTHER MATERIALS FOR OPEN SOURCE PROJECTS
- (COLLECTIVELY &quot;CONTENT&quot;). USE OF THE CONTENT IS GOVERNED BY THE TERMS AND CONDITIONS OF THIS AGREEMENT AND/OR THE TERMS AND
- CONDITIONS OF LICENSE AGREEMENTS OR NOTICES INDICATED OR REFERENCED BELOW. BY USING THE CONTENT, YOU AGREE THAT YOUR USE
- OF THE CONTENT IS GOVERNED BY THIS AGREEMENT AND/OR THE TERMS AND CONDITIONS OF ANY APPLICABLE LICENSE AGREEMENTS OR
- NOTICES INDICATED OR REFERENCED BELOW. IF YOU DO NOT AGREE TO THE TERMS AND CONDITIONS OF THIS AGREEMENT AND THE TERMS AND
- CONDITIONS OF ANY APPLICABLE LICENSE AGREEMENTS OR NOTICES INDICATED OR REFERENCED BELOW, THEN YOU MAY NOT USE THE CONTENT.</p>
-
-<h3>Applicable Licenses</h3>
-
-<p>Unless otherwise indicated, all Content made available by the Eclipse Foundation is provided to you under the terms and conditions of the Eclipse Public License Version 1.0
- (&quot;EPL&quot;). A copy of the EPL is provided with this Content and is also available at <a href="http://www.eclipse.org/legal/epl-v10.html">http://www.eclipse.org/legal/epl-v10.html</a>.
- For purposes of the EPL, &quot;Program&quot; will mean the Content.</p>
-
-<p>Content includes, but is not limited to, source code, object code, documentation and other files maintained in the Eclipse.org CVS repository (&quot;Repository&quot;) in CVS
- modules (&quot;Modules&quot;) and made available as downloadable archives (&quot;Downloads&quot;).</p>
-
-<ul>
- <li>Content may be structured and packaged into modules to facilitate delivering, extending, and upgrading the Content. Typical modules may include plug-ins (&quot;Plug-ins&quot;), plug-in fragments (&quot;Fragments&quot;), and features (&quot;Features&quot;).</li>
- <li>Each Plug-in or Fragment may be packaged as a sub-directory or JAR (Java&trade; ARchive) in a directory named &quot;plugins&quot;.</li>
- <li>A Feature is a bundle of one or more Plug-ins and/or Fragments and associated material. Each Feature may be packaged as a sub-directory in a directory named &quot;features&quot;. Within a Feature, files named &quot;feature.xml&quot; may contain a list of the names and version numbers of the Plug-ins
- and/or Fragments associated with that Feature.</li>
- <li>Features may also include other Features (&quot;Included Features&quot;). Within a Feature, files named &quot;feature.xml&quot; may contain a list of the names and version numbers of Included Features.</li>
-</ul>
-
-<p>The terms and conditions governing Plug-ins and Fragments should be contained in files named &quot;about.html&quot; (&quot;Abouts&quot;). The terms and conditions governing Features and
-Included Features should be contained in files named &quot;license.html&quot; (&quot;Feature Licenses&quot;). Abouts and Feature Licenses may be located in any directory of a Download or Module
-including, but not limited to the following locations:</p>
-
-<ul>
- <li>The top-level (root) directory</li>
- <li>Plug-in and Fragment directories</li>
- <li>Inside Plug-ins and Fragments packaged as JARs</li>
- <li>Sub-directories of the directory named &quot;src&quot; of certain Plug-ins</li>
- <li>Feature directories</li>
-</ul>
-
-<p>Note: if a Feature made available by the Eclipse Foundation is installed using the Eclipse Update Manager, you must agree to a license (&quot;Feature Update License&quot;) during the
-installation process. If the Feature contains Included Features, the Feature Update License should either provide you with the terms and conditions governing the Included Features or
-inform you where you can locate them. Feature Update Licenses may be found in the &quot;license&quot; property of files named &quot;feature.properties&quot; found within a Feature.
-Such Abouts, Feature Licenses, and Feature Update Licenses contain the terms and conditions (or references to such terms and conditions) that govern your use of the associated Content in
-that directory.</p>
-
-<p>THE ABOUTS, FEATURE LICENSES, AND FEATURE UPDATE LICENSES MAY REFER TO THE EPL OR OTHER LICENSE AGREEMENTS, NOTICES OR TERMS AND CONDITIONS. SOME OF THESE
-OTHER LICENSE AGREEMENTS MAY INCLUDE (BUT ARE NOT LIMITED TO):</p>
-
-<ul>
- <li>Common Public License Version 1.0 (available at <a href="http://www.eclipse.org/legal/cpl-v10.html">http://www.eclipse.org/legal/cpl-v10.html</a>)</li>
- <li>Apache Software License 1.1 (available at <a href="http://www.apache.org/licenses/LICENSE">http://www.apache.org/licenses/LICENSE</a>)</li>
- <li>Apache Software License 2.0 (available at <a href="http://www.apache.org/licenses/LICENSE-2.0">http://www.apache.org/licenses/LICENSE-2.0</a>)</li>
- <li>IBM Public License 1.0 (available at <a href="http://oss.software.ibm.com/developerworks/opensource/license10.html">http://oss.software.ibm.com/developerworks/opensource/license10.html</a>)</li>
- <li>Metro Link Public License 1.00 (available at <a href="http://www.opengroup.org/openmotif/supporters/metrolink/license.html">http://www.opengroup.org/openmotif/supporters/metrolink/license.html</a>)</li>
- <li>Mozilla Public License Version 1.1 (available at <a href="http://www.mozilla.org/MPL/MPL-1.1.html">http://www.mozilla.org/MPL/MPL-1.1.html</a>)</li>
- <LI>Common Development and Distribution License (CDDL) Version 1.0 (available at <A
- href="http://www.sun.com/cddl/cddl.html">http://www.sun.com/cddl/cddl.html)</A>
- </LI>
-</UL>
-
-<p>IT IS YOUR OBLIGATION TO READ AND ACCEPT ALL SUCH TERMS AND CONDITIONS PRIOR TO USE OF THE CONTENT. If no About, Feature License, or Feature Update License is provided, please
-contact the Eclipse Foundation to determine what terms and conditions govern that particular Content.</p>
-
-<h3>Cryptography</h3>
-
-<p>Content may contain encryption software. The country in which you are currently may have restrictions on the import, possession, and use, and/or re-export to
- another country, of encryption software. BEFORE using any encryption software, please check the country's laws, regulations and policies concerning the import,
- possession, or use, and re-export of encryption software, to see if this is permitted.</p>
-
-<small>Java and all Java-based trademarks are trademarks of Sun Microsystems, Inc. in the United States, other countries, or both.</small>
-</body>
-</html>
diff --git a/jpa/features/org.eclipse.jpt.feature/sourceTemplatePlugin/about.html b/jpa/features/org.eclipse.jpt.feature/sourceTemplatePlugin/about.html
deleted file mode 100644
index d4916df475..0000000000
--- a/jpa/features/org.eclipse.jpt.feature/sourceTemplatePlugin/about.html
+++ /dev/null
@@ -1,27 +0,0 @@
-<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.0//EN">
-<html>
-<head>
-<title>About</title>
-<meta http-equiv=Content-Type content="text/html; charset=ISO-8859-1">
-</head>
-<body lang="EN-US">
-<h2>About This Content</h2>
-
-<p>June 06, 2007</p>
-<h3>License</h3>
-
-<p>The Eclipse Foundation makes available all content in this plug-in (&quot;Content&quot;). Unless otherwise indicated below, the Content is provided to you under the terms and conditions of the
-Eclipse Public License Version 1.0 (&quot;EPL&quot;). A copy of the EPL is available at <a href="http://www.eclipse.org/legal/epl-v10.html">http://www.eclipse.org/legal/epl-v10.html</a>.
-For purposes of the EPL, &quot;Program&quot; will mean the Content.</p>
-
-<p>If you did not receive this Content directly from the Eclipse Foundation, the Content is being redistributed by another party (&quot;Redistributor&quot;) and different terms and conditions may
-apply to your use of any object code in the Content. Check the Redistributor's license that was provided with the Content. If no such license exists, contact the Redistributor. Unless otherwise
-indicated below, the terms and conditions of the EPL still apply to any source code in the Content.</p>
-
-<h3>Source Code</h3>
-<p>This plug-in contains source code zip files (&quot;Source Zips&quot;) that correspond to binary content in other plug-ins. These Source Zips may be distributed under different license
-agreements and/or notices. Details about these license agreements and notices are contained in &quot;about.html&quot; files (&quot;Abouts&quot;) located in sub-directories in the
-src/ directory of this plug-in. Such Abouts govern your use of the Source Zips in that directory, not the EPL.</p>
-
-</body>
-</html>
diff --git a/jpa/features/org.eclipse.jpt.feature/sourceTemplatePlugin/about.ini b/jpa/features/org.eclipse.jpt.feature/sourceTemplatePlugin/about.ini
deleted file mode 100644
index 2dee36a2e2..0000000000
--- a/jpa/features/org.eclipse.jpt.feature/sourceTemplatePlugin/about.ini
+++ /dev/null
@@ -1,31 +0,0 @@
-# about.ini
-# contains information about a feature
-# java.io.Properties file (ISO 8859-1 with "\" escapes)
-# "%key" are externalized strings defined in about.properties
-# This file does not need to be translated.
-
-# Property "aboutText" contains blurb for "About" dialog (translated)
-aboutText=%blurb
-
-# Property "windowImage" contains path to window icon (16x16)
-# needed for primary features only
-
-# Property "featureImage" contains path to feature image (32x32)
-featureImage=eclipse32.gif
-
-# Property "aboutImage" contains path to product image (500x330 or 115x164)
-# needed for primary features only
-
-# Property "appName" contains name of the application (not translated)
-# needed for primary features only
-
-# Property "welcomePage" contains path to welcome page (special XML-based format)
-# optional
-
-# Property "welcomePerspective" contains the id of the perspective in which the
-# welcome page is to be opened.
-# optional
-
-
-
-
diff --git a/jpa/features/org.eclipse.jpt.feature/sourceTemplatePlugin/about.mappings b/jpa/features/org.eclipse.jpt.feature/sourceTemplatePlugin/about.mappings
deleted file mode 100644
index a28390a75e..0000000000
--- a/jpa/features/org.eclipse.jpt.feature/sourceTemplatePlugin/about.mappings
+++ /dev/null
@@ -1,6 +0,0 @@
-# about.mappings
-# contains fill-ins for about.properties
-# java.io.Properties file (ISO 8859-1 with "\" escapes)
-# This file does not need to be translated.
-
-0=@build@
diff --git a/jpa/features/org.eclipse.jpt.feature/sourceTemplatePlugin/about.properties b/jpa/features/org.eclipse.jpt.feature/sourceTemplatePlugin/about.properties
deleted file mode 100644
index 15417ff15a..0000000000
--- a/jpa/features/org.eclipse.jpt.feature/sourceTemplatePlugin/about.properties
+++ /dev/null
@@ -1,26 +0,0 @@
-###############################################################################
-# Copyright (c) 2006, 2008 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
-#
-# Contributors:
-# Oracle - initial API and implementation
-###############################################################################
-# about.properties
-# contains externalized strings for about.ini
-# java.io.Properties file (ISO 8859-1 with "\" escapes)
-# fill-ins are supplied by about.mappings
-# This file should be translated.
-#
-# Do not translate any values surrounded by {}
-
-blurb=Dali Java Persistence API (JPA) Tools Source\n\
-\n\
-Version: {featureVersion}\n\
-Build id: {0}\n\
-\n\
-(c) Copyright Eclipse contributors and others 2008. All rights reserved.\n\
-Visit http://www.eclipse.org/webtools
-
diff --git a/jpa/features/org.eclipse.jpt.feature/sourceTemplatePlugin/build.properties b/jpa/features/org.eclipse.jpt.feature/sourceTemplatePlugin/build.properties
deleted file mode 100644
index ce9529be74..0000000000
--- a/jpa/features/org.eclipse.jpt.feature/sourceTemplatePlugin/build.properties
+++ /dev/null
@@ -1,12 +0,0 @@
-###############################################################################
-# Copyright (c) 2006, 2008 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
-#
-# Contributors:
-# Oracle - initial API and implementation
-###############################################################################
-bin.includes = about.html, about.ini, about.mappings, about.properties, eclipse32.gif, plugin.properties, plugin.xml, src/**, META-INF/
-sourcePlugin = true
diff --git a/jpa/features/org.eclipse.jpt.feature/sourceTemplatePlugin/eclipse32.gif b/jpa/features/org.eclipse.jpt.feature/sourceTemplatePlugin/eclipse32.gif
deleted file mode 100644
index e6ad7ccd75..0000000000
--- a/jpa/features/org.eclipse.jpt.feature/sourceTemplatePlugin/eclipse32.gif
+++ /dev/null
Binary files differ
diff --git a/jpa/features/org.eclipse.jpt.feature/sourceTemplatePlugin/eclipse32.png b/jpa/features/org.eclipse.jpt.feature/sourceTemplatePlugin/eclipse32.png
deleted file mode 100644
index 50ae49de24..0000000000
--- a/jpa/features/org.eclipse.jpt.feature/sourceTemplatePlugin/eclipse32.png
+++ /dev/null
Binary files differ
diff --git a/jpa/features/org.eclipse.jpt.feature/sourceTemplatePlugin/eclipse_update_120.jpg b/jpa/features/org.eclipse.jpt.feature/sourceTemplatePlugin/eclipse_update_120.jpg
deleted file mode 100644
index bfdf708ad6..0000000000
--- a/jpa/features/org.eclipse.jpt.feature/sourceTemplatePlugin/eclipse_update_120.jpg
+++ /dev/null
Binary files differ
diff --git a/jpa/features/org.eclipse.jpt.feature/sourceTemplatePlugin/epl-v10.html b/jpa/features/org.eclipse.jpt.feature/sourceTemplatePlugin/epl-v10.html
deleted file mode 100644
index 022ad2955b..0000000000
--- a/jpa/features/org.eclipse.jpt.feature/sourceTemplatePlugin/epl-v10.html
+++ /dev/null
@@ -1,328 +0,0 @@
-<html xmlns:o="urn:schemas-microsoft-com:office:office"
-xmlns:w="urn:schemas-microsoft-com:office:word"
-xmlns="http://www.w3.org/TR/REC-html40">
-
-<head>
-<meta http-equiv=Content-Type content="text/html; charset=windows-1252">
-<meta name=ProgId content=Word.Document>
-<meta name=Generator content="Microsoft Word 9">
-<meta name=Originator content="Microsoft Word 9">
-<link rel=File-List
-href="./Eclipse%20EPL%202003_11_10%20Final_files/filelist.xml">
-<title>Eclipse Public License - Version 1.0</title>
-<!--[if gte mso 9]><xml>
- <o:DocumentProperties>
- <o:Revision>2</o:Revision>
- <o:TotalTime>3</o:TotalTime>
- <o:Created>2004-03-05T23:03:00Z</o:Created>
- <o:LastSaved>2004-03-05T23:03:00Z</o:LastSaved>
- <o:Pages>4</o:Pages>
- <o:Words>1626</o:Words>
- <o:Characters>9270</o:Characters>
- <o:Lines>77</o:Lines>
- <o:Paragraphs>18</o:Paragraphs>
- <o:CharactersWithSpaces>11384</o:CharactersWithSpaces>
- <o:Version>9.4402</o:Version>
- </o:DocumentProperties>
-</xml><![endif]--><!--[if gte mso 9]><xml>
- <w:WordDocument>
- <w:TrackRevisions/>
- </w:WordDocument>
-</xml><![endif]-->
-<style>
-<!--
- /* Font Definitions */
-@font-face
- {font-family:Tahoma;
- panose-1:2 11 6 4 3 5 4 4 2 4;
- mso-font-charset:0;
- mso-generic-font-family:swiss;
- mso-font-pitch:variable;
- mso-font-signature:553679495 -2147483648 8 0 66047 0;}
- /* Style Definitions */
-p.MsoNormal, li.MsoNormal, div.MsoNormal
- {mso-style-parent:"";
- margin:0in;
- margin-bottom:.0001pt;
- mso-pagination:widow-orphan;
- font-size:12.0pt;
- font-family:"Times New Roman";
- mso-fareast-font-family:"Times New Roman";}
-p
- {margin-right:0in;
- mso-margin-top-alt:auto;
- mso-margin-bottom-alt:auto;
- margin-left:0in;
- mso-pagination:widow-orphan;
- font-size:12.0pt;
- font-family:"Times New Roman";
- mso-fareast-font-family:"Times New Roman";}
-p.BalloonText, li.BalloonText, div.BalloonText
- {mso-style-name:"Balloon Text";
- margin:0in;
- margin-bottom:.0001pt;
- mso-pagination:widow-orphan;
- font-size:8.0pt;
- font-family:Tahoma;
- mso-fareast-font-family:"Times New Roman";}
-@page Section1
- {size:8.5in 11.0in;
- margin:1.0in 1.25in 1.0in 1.25in;
- mso-header-margin:.5in;
- mso-footer-margin:.5in;
- mso-paper-source:0;}
-div.Section1
- {page:Section1;}
--->
-</style>
-</head>
-
-<body lang=EN-US style='tab-interval:.5in'>
-
-<div class=Section1>
-
-<p align=center style='text-align:center'><b>Eclipse Public License - v 1.0</b>
-</p>
-
-<p><span style='font-size:10.0pt'>THE ACCOMPANYING PROGRAM IS PROVIDED UNDER
-THE TERMS OF THIS ECLIPSE PUBLIC LICENSE (&quot;AGREEMENT&quot;). ANY USE,
-REPRODUCTION OR DISTRIBUTION OF THE PROGRAM CONSTITUTES RECIPIENT'S ACCEPTANCE
-OF THIS AGREEMENT.</span> </p>
-
-<p><b><span style='font-size:10.0pt'>1. DEFINITIONS</span></b> </p>
-
-<p><span style='font-size:10.0pt'>&quot;Contribution&quot; means:</span> </p>
-
-<p class=MsoNormal style='margin-left:.5in'><span style='font-size:10.0pt'>a)
-in the case of the initial Contributor, the initial code and documentation
-distributed under this Agreement, and<br clear=left>
-b) in the case of each subsequent Contributor:</span></p>
-
-<p class=MsoNormal style='margin-left:.5in'><span style='font-size:10.0pt'>i)
-changes to the Program, and</span></p>
-
-<p class=MsoNormal style='margin-left:.5in'><span style='font-size:10.0pt'>ii)
-additions to the Program;</span></p>
-
-<p class=MsoNormal style='margin-left:.5in'><span style='font-size:10.0pt'>where
-such changes and/or additions to the Program originate from and are distributed
-by that particular Contributor. A Contribution 'originates' from a Contributor
-if it was added to the Program by such Contributor itself or anyone acting on
-such Contributor's behalf. Contributions do not include additions to the
-Program which: (i) are separate modules of software distributed in conjunction
-with the Program under their own license agreement, and (ii) are not derivative
-works of the Program. </span></p>
-
-<p><span style='font-size:10.0pt'>&quot;Contributor&quot; means any person or
-entity that distributes the Program.</span> </p>
-
-<p><span style='font-size:10.0pt'>&quot;Licensed Patents &quot; mean patent
-claims licensable by a Contributor which are necessarily infringed by the use
-or sale of its Contribution alone or when combined with the Program. </span></p>
-
-<p><span style='font-size:10.0pt'>&quot;Program&quot; means the Contributions
-distributed in accordance with this Agreement.</span> </p>
-
-<p><span style='font-size:10.0pt'>&quot;Recipient&quot; means anyone who
-receives the Program under this Agreement, including all Contributors.</span> </p>
-
-<p><b><span style='font-size:10.0pt'>2. GRANT OF RIGHTS</span></b> </p>
-
-<p class=MsoNormal style='margin-left:.5in'><span style='font-size:10.0pt'>a)
-Subject to the terms of this Agreement, each Contributor hereby grants Recipient
-a non-exclusive, worldwide, royalty-free copyright license to<span
-style='color:red'> </span>reproduce, prepare derivative works of, publicly
-display, publicly perform, distribute and sublicense the Contribution of such
-Contributor, if any, and such derivative works, in source code and object code
-form.</span></p>
-
-<p class=MsoNormal style='margin-left:.5in'><span style='font-size:10.0pt'>b)
-Subject to the terms of this Agreement, each Contributor hereby grants
-Recipient a non-exclusive, worldwide,<span style='color:green'> </span>royalty-free
-patent license under Licensed Patents to make, use, sell, offer to sell, import
-and otherwise transfer the Contribution of such Contributor, if any, in source
-code and object code form. This patent license shall apply to the combination
-of the Contribution and the Program if, at the time the Contribution is added
-by the Contributor, such addition of the Contribution causes such combination
-to be covered by the Licensed Patents. The patent license shall not apply to
-any other combinations which include the Contribution. No hardware per se is
-licensed hereunder. </span></p>
-
-<p class=MsoNormal style='margin-left:.5in'><span style='font-size:10.0pt'>c)
-Recipient understands that although each Contributor grants the licenses to its
-Contributions set forth herein, no assurances are provided by any Contributor
-that the Program does not infringe the patent or other intellectual property
-rights of any other entity. Each Contributor disclaims any liability to Recipient
-for claims brought by any other entity based on infringement of intellectual
-property rights or otherwise. As a condition to exercising the rights and
-licenses granted hereunder, each Recipient hereby assumes sole responsibility
-to secure any other intellectual property rights needed, if any. For example,
-if a third party patent license is required to allow Recipient to distribute
-the Program, it is Recipient's responsibility to acquire that license before
-distributing the Program.</span></p>
-
-<p class=MsoNormal style='margin-left:.5in'><span style='font-size:10.0pt'>d)
-Each Contributor represents that to its knowledge it has sufficient copyright
-rights in its Contribution, if any, to grant the copyright license set forth in
-this Agreement. </span></p>
-
-<p><b><span style='font-size:10.0pt'>3. REQUIREMENTS</span></b> </p>
-
-<p><span style='font-size:10.0pt'>A Contributor may choose to distribute the
-Program in object code form under its own license agreement, provided that:</span>
-</p>
-
-<p class=MsoNormal style='margin-left:.5in'><span style='font-size:10.0pt'>a)
-it complies with the terms and conditions of this Agreement; and</span></p>
-
-<p class=MsoNormal style='margin-left:.5in'><span style='font-size:10.0pt'>b)
-its license agreement:</span></p>
-
-<p class=MsoNormal style='margin-left:.5in'><span style='font-size:10.0pt'>i)
-effectively disclaims on behalf of all Contributors all warranties and
-conditions, express and implied, including warranties or conditions of title
-and non-infringement, and implied warranties or conditions of merchantability
-and fitness for a particular purpose; </span></p>
-
-<p class=MsoNormal style='margin-left:.5in'><span style='font-size:10.0pt'>ii)
-effectively excludes on behalf of all Contributors all liability for damages,
-including direct, indirect, special, incidental and consequential damages, such
-as lost profits; </span></p>
-
-<p class=MsoNormal style='margin-left:.5in'><span style='font-size:10.0pt'>iii)
-states that any provisions which differ from this Agreement are offered by that
-Contributor alone and not by any other party; and</span></p>
-
-<p class=MsoNormal style='margin-left:.5in'><span style='font-size:10.0pt'>iv)
-states that source code for the Program is available from such Contributor, and
-informs licensees how to obtain it in a reasonable manner on or through a
-medium customarily used for software exchange.<span style='color:blue'> </span></span></p>
-
-<p><span style='font-size:10.0pt'>When the Program is made available in source
-code form:</span> </p>
-
-<p class=MsoNormal style='margin-left:.5in'><span style='font-size:10.0pt'>a)
-it must be made available under this Agreement; and </span></p>
-
-<p class=MsoNormal style='margin-left:.5in'><span style='font-size:10.0pt'>b) a
-copy of this Agreement must be included with each copy of the Program. </span></p>
-
-<p><span style='font-size:10.0pt'>Contributors may not remove or alter any
-copyright notices contained within the Program. </span></p>
-
-<p><span style='font-size:10.0pt'>Each Contributor must identify itself as the
-originator of its Contribution, if any, in a manner that reasonably allows
-subsequent Recipients to identify the originator of the Contribution. </span></p>
-
-<p><b><span style='font-size:10.0pt'>4. COMMERCIAL DISTRIBUTION</span></b> </p>
-
-<p><span style='font-size:10.0pt'>Commercial distributors of software may
-accept certain responsibilities with respect to end users, business partners
-and the like. While this license is intended to facilitate the commercial use
-of the Program, the Contributor who includes the Program in a commercial
-product offering should do so in a manner which does not create potential
-liability for other Contributors. Therefore, if a Contributor includes the
-Program in a commercial product offering, such Contributor (&quot;Commercial
-Contributor&quot;) hereby agrees to defend and indemnify every other
-Contributor (&quot;Indemnified Contributor&quot;) against any losses, damages and
-costs (collectively &quot;Losses&quot;) arising from claims, lawsuits and other
-legal actions brought by a third party against the Indemnified Contributor to
-the extent caused by the acts or omissions of such Commercial Contributor in
-connection with its distribution of the Program in a commercial product
-offering. The obligations in this section do not apply to any claims or Losses
-relating to any actual or alleged intellectual property infringement. In order
-to qualify, an Indemnified Contributor must: a) promptly notify the Commercial
-Contributor in writing of such claim, and b) allow the Commercial Contributor
-to control, and cooperate with the Commercial Contributor in, the defense and
-any related settlement negotiations. The Indemnified Contributor may participate
-in any such claim at its own expense.</span> </p>
-
-<p><span style='font-size:10.0pt'>For example, a Contributor might include the
-Program in a commercial product offering, Product X. That Contributor is then a
-Commercial Contributor. If that Commercial Contributor then makes performance
-claims, or offers warranties related to Product X, those performance claims and
-warranties are such Commercial Contributor's responsibility alone. Under this
-section, the Commercial Contributor would have to defend claims against the
-other Contributors related to those performance claims and warranties, and if a
-court requires any other Contributor to pay any damages as a result, the
-Commercial Contributor must pay those damages.</span> </p>
-
-<p><b><span style='font-size:10.0pt'>5. NO WARRANTY</span></b> </p>
-
-<p><span style='font-size:10.0pt'>EXCEPT AS EXPRESSLY SET FORTH IN THIS
-AGREEMENT, THE PROGRAM IS PROVIDED ON AN &quot;AS IS&quot; BASIS, WITHOUT
-WARRANTIES OR CONDITIONS OF ANY KIND, EITHER EXPRESS OR IMPLIED INCLUDING,
-WITHOUT LIMITATION, ANY WARRANTIES OR CONDITIONS OF TITLE, NON-INFRINGEMENT,
-MERCHANTABILITY OR FITNESS FOR A PARTICULAR PURPOSE. Each Recipient is solely
-responsible for determining the appropriateness of using and distributing the
-Program and assumes all risks associated with its exercise of rights under this
-Agreement , including but not limited to the risks and costs of program errors,
-compliance with applicable laws, damage to or loss of data, programs or
-equipment, and unavailability or interruption of operations. </span></p>
-
-<p><b><span style='font-size:10.0pt'>6. DISCLAIMER OF LIABILITY</span></b> </p>
-
-<p><span style='font-size:10.0pt'>EXCEPT AS EXPRESSLY SET FORTH IN THIS
-AGREEMENT, NEITHER RECIPIENT NOR ANY CONTRIBUTORS SHALL HAVE ANY LIABILITY FOR
-ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES
-(INCLUDING WITHOUT LIMITATION LOST PROFITS), HOWEVER CAUSED AND ON ANY THEORY
-OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING
-NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OR DISTRIBUTION OF
-THE PROGRAM OR THE EXERCISE OF ANY RIGHTS GRANTED HEREUNDER, EVEN IF ADVISED OF
-THE POSSIBILITY OF SUCH DAMAGES.</span> </p>
-
-<p><b><span style='font-size:10.0pt'>7. GENERAL</span></b> </p>
-
-<p><span style='font-size:10.0pt'>If any provision of this Agreement is invalid
-or unenforceable under applicable law, it shall not affect the validity or
-enforceability of the remainder of the terms of this Agreement, and without
-further action by the parties hereto, such provision shall be reformed to the
-minimum extent necessary to make such provision valid and enforceable.</span> </p>
-
-<p><span style='font-size:10.0pt'>If Recipient institutes patent litigation
-against any entity (including a cross-claim or counterclaim in a lawsuit)
-alleging that the Program itself (excluding combinations of the Program with
-other software or hardware) infringes such Recipient's patent(s), then such
-Recipient's rights granted under Section 2(b) shall terminate as of the date
-such litigation is filed. </span></p>
-
-<p><span style='font-size:10.0pt'>All Recipient's rights under this Agreement
-shall terminate if it fails to comply with any of the material terms or
-conditions of this Agreement and does not cure such failure in a reasonable
-period of time after becoming aware of such noncompliance. If all Recipient's
-rights under this Agreement terminate, Recipient agrees to cease use and
-distribution of the Program as soon as reasonably practicable. However,
-Recipient's obligations under this Agreement and any licenses granted by
-Recipient relating to the Program shall continue and survive. </span></p>
-
-<p><span style='font-size:10.0pt'>Everyone is permitted to copy and distribute
-copies of this Agreement, but in order to avoid inconsistency the Agreement is
-copyrighted and may only be modified in the following manner. The Agreement
-Steward reserves the right to publish new versions (including revisions) of
-this Agreement from time to time. No one other than the Agreement Steward has
-the right to modify this Agreement. The Eclipse Foundation is the initial
-Agreement Steward. The Eclipse Foundation may assign the responsibility to
-serve as the Agreement Steward to a suitable separate entity. Each new version
-of the Agreement will be given a distinguishing version number. The Program
-(including Contributions) may always be distributed subject to the version of
-the Agreement under which it was received. In addition, after a new version of
-the Agreement is published, Contributor may elect to distribute the Program
-(including its Contributions) under the new version. Except as expressly stated
-in Sections 2(a) and 2(b) above, Recipient receives no rights or licenses to
-the intellectual property of any Contributor under this Agreement, whether
-expressly, by implication, estoppel or otherwise. All rights in the Program not
-expressly granted under this Agreement are reserved.</span> </p>
-
-<p><span style='font-size:10.0pt'>This Agreement is governed by the laws of the
-State of New York and the intellectual property laws of the United States of
-America. No party to this Agreement will bring a legal action under this
-Agreement more than one year after the cause of action arose. Each party waives
-its rights to a jury trial in any resulting litigation.</span> </p>
-
-<p class=MsoNormal><![if !supportEmptyParas]>&nbsp;<![endif]><o:p></o:p></p>
-
-</div>
-
-</body>
-
-</html>
diff --git a/jpa/features/org.eclipse.jpt.feature/sourceTemplatePlugin/license.html b/jpa/features/org.eclipse.jpt.feature/sourceTemplatePlugin/license.html
deleted file mode 100644
index 14b1d50265..0000000000
--- a/jpa/features/org.eclipse.jpt.feature/sourceTemplatePlugin/license.html
+++ /dev/null
@@ -1,83 +0,0 @@
-<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.0//EN">
-<html>
-<head>
-<meta http-equiv=Content-Type content="text/html; charset=iso-8859-1">
-<title>Eclipse.org Software User Agreement</title>
-</head>
-
-<body lang="EN-US" link=blue vlink=purple>
-<h2>Eclipse Foundation Software User Agreement</h2>
-<p>June 06, 2007</p>
-
-<h3>Usage Of Content</h3>
-
-<p>THE ECLIPSE FOUNDATION MAKES AVAILABLE SOFTWARE, DOCUMENTATION, INFORMATION AND/OR OTHER MATERIALS FOR OPEN SOURCE PROJECTS
- (COLLECTIVELY &quot;CONTENT&quot;). USE OF THE CONTENT IS GOVERNED BY THE TERMS AND CONDITIONS OF THIS AGREEMENT AND/OR THE TERMS AND
- CONDITIONS OF LICENSE AGREEMENTS OR NOTICES INDICATED OR REFERENCED BELOW. BY USING THE CONTENT, YOU AGREE THAT YOUR USE
- OF THE CONTENT IS GOVERNED BY THIS AGREEMENT AND/OR THE TERMS AND CONDITIONS OF ANY APPLICABLE LICENSE AGREEMENTS OR
- NOTICES INDICATED OR REFERENCED BELOW. IF YOU DO NOT AGREE TO THE TERMS AND CONDITIONS OF THIS AGREEMENT AND THE TERMS AND
- CONDITIONS OF ANY APPLICABLE LICENSE AGREEMENTS OR NOTICES INDICATED OR REFERENCED BELOW, THEN YOU MAY NOT USE THE CONTENT.</p>
-
-<h3>Applicable Licenses</h3>
-
-<p>Unless otherwise indicated, all Content made available by the Eclipse Foundation is provided to you under the terms and conditions of the Eclipse Public License Version 1.0
- (&quot;EPL&quot;). A copy of the EPL is provided with this Content and is also available at <a href="http://www.eclipse.org/legal/epl-v10.html">http://www.eclipse.org/legal/epl-v10.html</a>.
- For purposes of the EPL, &quot;Program&quot; will mean the Content.</p>
-
-<p>Content includes, but is not limited to, source code, object code, documentation and other files maintained in the Eclipse.org CVS repository (&quot;Repository&quot;) in CVS
- modules (&quot;Modules&quot;) and made available as downloadable archives (&quot;Downloads&quot;).</p>
-
-<ul>
- <li>Content may be structured and packaged into modules to facilitate delivering, extending, and upgrading the Content. Typical modules may include plug-ins (&quot;Plug-ins&quot;), plug-in fragments (&quot;Fragments&quot;), and features (&quot;Features&quot;).</li>
- <li>Each Plug-in or Fragment may be packaged as a sub-directory or JAR (Java&trade; ARchive) in a directory named &quot;plugins&quot;.</li>
- <li>A Feature is a bundle of one or more Plug-ins and/or Fragments and associated material. Each Feature may be packaged as a sub-directory in a directory named &quot;features&quot;. Within a Feature, files named &quot;feature.xml&quot; may contain a list of the names and version numbers of the Plug-ins
- and/or Fragments associated with that Feature.</li>
- <li>Features may also include other Features (&quot;Included Features&quot;). Within a Feature, files named &quot;feature.xml&quot; may contain a list of the names and version numbers of Included Features.</li>
-</ul>
-
-<p>The terms and conditions governing Plug-ins and Fragments should be contained in files named &quot;about.html&quot; (&quot;Abouts&quot;). The terms and conditions governing Features and
-Included Features should be contained in files named &quot;license.html&quot; (&quot;Feature Licenses&quot;). Abouts and Feature Licenses may be located in any directory of a Download or Module
-including, but not limited to the following locations:</p>
-
-<ul>
- <li>The top-level (root) directory</li>
- <li>Plug-in and Fragment directories</li>
- <li>Inside Plug-ins and Fragments packaged as JARs</li>
- <li>Sub-directories of the directory named &quot;src&quot; of certain Plug-ins</li>
- <li>Feature directories</li>
-</ul>
-
-<p>Note: if a Feature made available by the Eclipse Foundation is installed using the Eclipse Update Manager, you must agree to a license (&quot;Feature Update License&quot;) during the
-installation process. If the Feature contains Included Features, the Feature Update License should either provide you with the terms and conditions governing the Included Features or
-inform you where you can locate them. Feature Update Licenses may be found in the &quot;license&quot; property of files named &quot;feature.properties&quot; found within a Feature.
-Such Abouts, Feature Licenses, and Feature Update Licenses contain the terms and conditions (or references to such terms and conditions) that govern your use of the associated Content in
-that directory.</p>
-
-<p>THE ABOUTS, FEATURE LICENSES, AND FEATURE UPDATE LICENSES MAY REFER TO THE EPL OR OTHER LICENSE AGREEMENTS, NOTICES OR TERMS AND CONDITIONS. SOME OF THESE
-OTHER LICENSE AGREEMENTS MAY INCLUDE (BUT ARE NOT LIMITED TO):</p>
-
-<ul>
- <li>Common Public License Version 1.0 (available at <a href="http://www.eclipse.org/legal/cpl-v10.html">http://www.eclipse.org/legal/cpl-v10.html</a>)</li>
- <li>Apache Software License 1.1 (available at <a href="http://www.apache.org/licenses/LICENSE">http://www.apache.org/licenses/LICENSE</a>)</li>
- <li>Apache Software License 2.0 (available at <a href="http://www.apache.org/licenses/LICENSE-2.0">http://www.apache.org/licenses/LICENSE-2.0</a>)</li>
- <li>IBM Public License 1.0 (available at <a href="http://oss.software.ibm.com/developerworks/opensource/license10.html">http://oss.software.ibm.com/developerworks/opensource/license10.html</a>)</li>
- <li>Metro Link Public License 1.00 (available at <a href="http://www.opengroup.org/openmotif/supporters/metrolink/license.html">http://www.opengroup.org/openmotif/supporters/metrolink/license.html</a>)</li>
- <li>Mozilla Public License Version 1.1 (available at <a href="http://www.mozilla.org/MPL/MPL-1.1.html">http://www.mozilla.org/MPL/MPL-1.1.html</a>)</li>
-
- <LI>Common Development and Distribution License (CDDL) Version 1.0 (available at <A
- href="http://www.sun.com/cddl/cddl.html">http://www.sun.com/cddl/cddl.html)</A>
- </LI>
-</UL>
-
-<p>IT IS YOUR OBLIGATION TO READ AND ACCEPT ALL SUCH TERMS AND CONDITIONS PRIOR TO USE OF THE CONTENT. If no About, Feature License, or Feature Update License is provided, please
-contact the Eclipse Foundation to determine what terms and conditions govern that particular Content.</p>
-
-<h3>Cryptography</h3>
-
-<p>Content may contain encryption software. The country in which you are currently may have restrictions on the import, possession, and use, and/or re-export to
- another country, of encryption software. BEFORE using any encryption software, please check the country's laws, regulations and policies concerning the import,
- possession, or use, and re-export of encryption software, to see if this is permitted.</p>
-
-<small>Java and all Java-based trademarks are trademarks of Sun Microsystems, Inc. in the United States, other countries, or both.</small>
-</body>
-</html>
diff --git a/jpa/features/org.eclipse.jpt.feature/sourceTemplatePlugin/plugin.properties b/jpa/features/org.eclipse.jpt.feature/sourceTemplatePlugin/plugin.properties
deleted file mode 100644
index f948547000..0000000000
--- a/jpa/features/org.eclipse.jpt.feature/sourceTemplatePlugin/plugin.properties
+++ /dev/null
@@ -1,13 +0,0 @@
-###############################################################################
-# Copyright (c) 2006, 2008 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
-#
-# Contributors:
-# Oracle - initial API and implementation
-###############################################################################
-
-pluginName = Dali Java Persistence API (JPA) Tools
-providerName = Eclipse.org
diff --git a/jpa/features/org.eclipse.jpt.tests.feature/.cvsignore b/jpa/features/org.eclipse.jpt.tests.feature/.cvsignore
deleted file mode 100644
index c14487ceac..0000000000
--- a/jpa/features/org.eclipse.jpt.tests.feature/.cvsignore
+++ /dev/null
@@ -1 +0,0 @@
-build.xml
diff --git a/jpa/features/org.eclipse.jpt.tests.feature/.project b/jpa/features/org.eclipse.jpt.tests.feature/.project
deleted file mode 100644
index 91760f21b4..0000000000
--- a/jpa/features/org.eclipse.jpt.tests.feature/.project
+++ /dev/null
@@ -1,17 +0,0 @@
-<?xml version="1.0" encoding="UTF-8"?>
-<projectDescription>
- <name>org.eclipse.jpt.tests.feature</name>
- <comment></comment>
- <projects>
- </projects>
- <buildSpec>
- <buildCommand>
- <name>org.eclipse.pde.FeatureBuilder</name>
- <arguments>
- </arguments>
- </buildCommand>
- </buildSpec>
- <natures>
- <nature>org.eclipse.pde.FeatureNature</nature>
- </natures>
-</projectDescription>
diff --git a/jpa/features/org.eclipse.jpt.tests.feature/.settings/org.eclipse.core.resources.prefs b/jpa/features/org.eclipse.jpt.tests.feature/.settings/org.eclipse.core.resources.prefs
deleted file mode 100644
index 235b84ae83..0000000000
--- a/jpa/features/org.eclipse.jpt.tests.feature/.settings/org.eclipse.core.resources.prefs
+++ /dev/null
@@ -1,3 +0,0 @@
-#Sun May 27 15:11:17 EDT 2007
-eclipse.preferences.version=1
-encoding/<project>=ISO-8859-1
diff --git a/jpa/features/org.eclipse.jpt.tests.feature/build.properties b/jpa/features/org.eclipse.jpt.tests.feature/build.properties
deleted file mode 100644
index d6a4dce096..0000000000
--- a/jpa/features/org.eclipse.jpt.tests.feature/build.properties
+++ /dev/null
@@ -1,10 +0,0 @@
-bin.includes = feature.xml,\
- eclipse_update_120.jpg,\
- epl-v10.html,\
- license.html,\
- feature.properties
-src.includes = license.html,\
- feature.xml,\
- epl-v10.html,\
- eclipse_update_120.jpg,\
- build.properties
diff --git a/jpa/features/org.eclipse.jpt.tests.feature/eclipse_update_120.jpg b/jpa/features/org.eclipse.jpt.tests.feature/eclipse_update_120.jpg
deleted file mode 100644
index bfdf708ad6..0000000000
--- a/jpa/features/org.eclipse.jpt.tests.feature/eclipse_update_120.jpg
+++ /dev/null
Binary files differ
diff --git a/jpa/features/org.eclipse.jpt.tests.feature/epl-v10.html b/jpa/features/org.eclipse.jpt.tests.feature/epl-v10.html
deleted file mode 100644
index ed4b196655..0000000000
--- a/jpa/features/org.eclipse.jpt.tests.feature/epl-v10.html
+++ /dev/null
@@ -1,328 +0,0 @@
-<html xmlns:o="urn:schemas-microsoft-com:office:office"
-xmlns:w="urn:schemas-microsoft-com:office:word"
-xmlns="http://www.w3.org/TR/REC-html40">
-
-<head>
-<meta http-equiv=Content-Type content="text/html; charset=windows-1252">
-<meta name=ProgId content=Word.Document>
-<meta name=Generator content="Microsoft Word 9">
-<meta name=Originator content="Microsoft Word 9">
-<link rel=File-List
-href="./Eclipse%20EPL%202003_11_10%20Final_files/filelist.xml">
-<title>Eclipse Public License - Version 1.0</title>
-<!--[if gte mso 9]><xml>
- <o:DocumentProperties>
- <o:Revision>2</o:Revision>
- <o:TotalTime>3</o:TotalTime>
- <o:Created>2004-03-05T23:03:00Z</o:Created>
- <o:LastSaved>2004-03-05T23:03:00Z</o:LastSaved>
- <o:Pages>4</o:Pages>
- <o:Words>1626</o:Words>
- <o:Characters>9270</o:Characters>
- <o:Lines>77</o:Lines>
- <o:Paragraphs>18</o:Paragraphs>
- <o:CharactersWithSpaces>11384</o:CharactersWithSpaces>
- <o:Version>9.4402</o:Version>
- </o:DocumentProperties>
-</xml><![endif]--><!--[if gte mso 9]><xml>
- <w:WordDocument>
- <w:TrackRevisions/>
- </w:WordDocument>
-</xml><![endif]-->
-<style>
-<!--
- /* Font Definitions */
-@font-face
- {font-family:Tahoma;
- panose-1:2 11 6 4 3 5 4 4 2 4;
- mso-font-charset:0;
- mso-generic-font-family:swiss;
- mso-font-pitch:variable;
- mso-font-signature:553679495 -2147483648 8 0 66047 0;}
- /* Style Definitions */
-p.MsoNormal, li.MsoNormal, div.MsoNormal
- {mso-style-parent:"";
- margin:0in;
- margin-bottom:.0001pt;
- mso-pagination:widow-orphan;
- font-size:12.0pt;
- font-family:"Times New Roman";
- mso-fareast-font-family:"Times New Roman";}
-p
- {margin-right:0in;
- mso-margin-top-alt:auto;
- mso-margin-bottom-alt:auto;
- margin-left:0in;
- mso-pagination:widow-orphan;
- font-size:12.0pt;
- font-family:"Times New Roman";
- mso-fareast-font-family:"Times New Roman";}
-p.BalloonText, li.BalloonText, div.BalloonText
- {mso-style-name:"Balloon Text";
- margin:0in;
- margin-bottom:.0001pt;
- mso-pagination:widow-orphan;
- font-size:8.0pt;
- font-family:Tahoma;
- mso-fareast-font-family:"Times New Roman";}
-@page Section1
- {size:8.5in 11.0in;
- margin:1.0in 1.25in 1.0in 1.25in;
- mso-header-margin:.5in;
- mso-footer-margin:.5in;
- mso-paper-source:0;}
-div.Section1
- {page:Section1;}
--->
-</style>
-</head>
-
-<body lang=EN-US style='tab-interval:.5in'>
-
-<div class=Section1>
-
-<p align=center style='text-align:center'><b>Eclipse Public License - v 1.0</b>
-</p>
-
-<p><span style='font-size:10.0pt'>THE ACCOMPANYING PROGRAM IS PROVIDED UNDER
-THE TERMS OF THIS ECLIPSE PUBLIC LICENSE (&quot;AGREEMENT&quot;). ANY USE,
-REPRODUCTION OR DISTRIBUTION OF THE PROGRAM CONSTITUTES RECIPIENT'S ACCEPTANCE
-OF THIS AGREEMENT.</span> </p>
-
-<p><b><span style='font-size:10.0pt'>1. DEFINITIONS</span></b> </p>
-
-<p><span style='font-size:10.0pt'>&quot;Contribution&quot; means:</span> </p>
-
-<p class=MsoNormal style='margin-left:.5in'><span style='font-size:10.0pt'>a)
-in the case of the initial Contributor, the initial code and documentation
-distributed under this Agreement, and<br clear=left>
-b) in the case of each subsequent Contributor:</span></p>
-
-<p class=MsoNormal style='margin-left:.5in'><span style='font-size:10.0pt'>i)
-changes to the Program, and</span></p>
-
-<p class=MsoNormal style='margin-left:.5in'><span style='font-size:10.0pt'>ii)
-additions to the Program;</span></p>
-
-<p class=MsoNormal style='margin-left:.5in'><span style='font-size:10.0pt'>where
-such changes and/or additions to the Program originate from and are distributed
-by that particular Contributor. A Contribution 'originates' from a Contributor
-if it was added to the Program by such Contributor itself or anyone acting on
-such Contributor's behalf. Contributions do not include additions to the
-Program which: (i) are separate modules of software distributed in conjunction
-with the Program under their own license agreement, and (ii) are not derivative
-works of the Program. </span></p>
-
-<p><span style='font-size:10.0pt'>&quot;Contributor&quot; means any person or
-entity that distributes the Program.</span> </p>
-
-<p><span style='font-size:10.0pt'>&quot;Licensed Patents &quot; mean patent
-claims licensable by a Contributor which are necessarily infringed by the use
-or sale of its Contribution alone or when combined with the Program. </span></p>
-
-<p><span style='font-size:10.0pt'>&quot;Program&quot; means the Contributions
-distributed in accordance with this Agreement.</span> </p>
-
-<p><span style='font-size:10.0pt'>&quot;Recipient&quot; means anyone who
-receives the Program under this Agreement, including all Contributors.</span> </p>
-
-<p><b><span style='font-size:10.0pt'>2. GRANT OF RIGHTS</span></b> </p>
-
-<p class=MsoNormal style='margin-left:.5in'><span style='font-size:10.0pt'>a)
-Subject to the terms of this Agreement, each Contributor hereby grants Recipient
-a non-exclusive, worldwide, royalty-free copyright license to<span
-style='color:red'> </span>reproduce, prepare derivative works of, publicly
-display, publicly perform, distribute and sublicense the Contribution of such
-Contributor, if any, and such derivative works, in source code and object code
-form.</span></p>
-
-<p class=MsoNormal style='margin-left:.5in'><span style='font-size:10.0pt'>b)
-Subject to the terms of this Agreement, each Contributor hereby grants
-Recipient a non-exclusive, worldwide,<span style='color:green'> </span>royalty-free
-patent license under Licensed Patents to make, use, sell, offer to sell, import
-and otherwise transfer the Contribution of such Contributor, if any, in source
-code and object code form. This patent license shall apply to the combination
-of the Contribution and the Program if, at the time the Contribution is added
-by the Contributor, such addition of the Contribution causes such combination
-to be covered by the Licensed Patents. The patent license shall not apply to
-any other combinations which include the Contribution. No hardware per se is
-licensed hereunder. </span></p>
-
-<p class=MsoNormal style='margin-left:.5in'><span style='font-size:10.0pt'>c)
-Recipient understands that although each Contributor grants the licenses to its
-Contributions set forth herein, no assurances are provided by any Contributor
-that the Program does not infringe the patent or other intellectual property
-rights of any other entity. Each Contributor disclaims any liability to Recipient
-for claims brought by any other entity based on infringement of intellectual
-property rights or otherwise. As a condition to exercising the rights and
-licenses granted hereunder, each Recipient hereby assumes sole responsibility
-to secure any other intellectual property rights needed, if any. For example,
-if a third party patent license is required to allow Recipient to distribute
-the Program, it is Recipient's responsibility to acquire that license before
-distributing the Program.</span></p>
-
-<p class=MsoNormal style='margin-left:.5in'><span style='font-size:10.0pt'>d)
-Each Contributor represents that to its knowledge it has sufficient copyright
-rights in its Contribution, if any, to grant the copyright license set forth in
-this Agreement. </span></p>
-
-<p><b><span style='font-size:10.0pt'>3. REQUIREMENTS</span></b> </p>
-
-<p><span style='font-size:10.0pt'>A Contributor may choose to distribute the
-Program in object code form under its own license agreement, provided that:</span>
-</p>
-
-<p class=MsoNormal style='margin-left:.5in'><span style='font-size:10.0pt'>a)
-it complies with the terms and conditions of this Agreement; and</span></p>
-
-<p class=MsoNormal style='margin-left:.5in'><span style='font-size:10.0pt'>b)
-its license agreement:</span></p>
-
-<p class=MsoNormal style='margin-left:.5in'><span style='font-size:10.0pt'>i)
-effectively disclaims on behalf of all Contributors all warranties and
-conditions, express and implied, including warranties or conditions of title
-and non-infringement, and implied warranties or conditions of merchantability
-and fitness for a particular purpose; </span></p>
-
-<p class=MsoNormal style='margin-left:.5in'><span style='font-size:10.0pt'>ii)
-effectively excludes on behalf of all Contributors all liability for damages,
-including direct, indirect, special, incidental and consequential damages, such
-as lost profits; </span></p>
-
-<p class=MsoNormal style='margin-left:.5in'><span style='font-size:10.0pt'>iii)
-states that any provisions which differ from this Agreement are offered by that
-Contributor alone and not by any other party; and</span></p>
-
-<p class=MsoNormal style='margin-left:.5in'><span style='font-size:10.0pt'>iv)
-states that source code for the Program is available from such Contributor, and
-informs licensees how to obtain it in a reasonable manner on or through a
-medium customarily used for software exchange.<span style='color:blue'> </span></span></p>
-
-<p><span style='font-size:10.0pt'>When the Program is made available in source
-code form:</span> </p>
-
-<p class=MsoNormal style='margin-left:.5in'><span style='font-size:10.0pt'>a)
-it must be made available under this Agreement; and </span></p>
-
-<p class=MsoNormal style='margin-left:.5in'><span style='font-size:10.0pt'>b) a
-copy of this Agreement must be included with each copy of the Program. </span></p>
-
-<p><span style='font-size:10.0pt'>Contributors may not remove or alter any
-copyright notices contained within the Program. </span></p>
-
-<p><span style='font-size:10.0pt'>Each Contributor must identify itself as the
-originator of its Contribution, if any, in a manner that reasonably allows
-subsequent Recipients to identify the originator of the Contribution. </span></p>
-
-<p><b><span style='font-size:10.0pt'>4. COMMERCIAL DISTRIBUTION</span></b> </p>
-
-<p><span style='font-size:10.0pt'>Commercial distributors of software may
-accept certain responsibilities with respect to end users, business partners
-and the like. While this license is intended to facilitate the commercial use
-of the Program, the Contributor who includes the Program in a commercial
-product offering should do so in a manner which does not create potential
-liability for other Contributors. Therefore, if a Contributor includes the
-Program in a commercial product offering, such Contributor (&quot;Commercial
-Contributor&quot;) hereby agrees to defend and indemnify every other
-Contributor (&quot;Indemnified Contributor&quot;) against any losses, damages and
-costs (collectively &quot;Losses&quot;) arising from claims, lawsuits and other
-legal actions brought by a third party against the Indemnified Contributor to
-the extent caused by the acts or omissions of such Commercial Contributor in
-connection with its distribution of the Program in a commercial product
-offering. The obligations in this section do not apply to any claims or Losses
-relating to any actual or alleged intellectual property infringement. In order
-to qualify, an Indemnified Contributor must: a) promptly notify the Commercial
-Contributor in writing of such claim, and b) allow the Commercial Contributor
-to control, and cooperate with the Commercial Contributor in, the defense and
-any related settlement negotiations. The Indemnified Contributor may participate
-in any such claim at its own expense.</span> </p>
-
-<p><span style='font-size:10.0pt'>For example, a Contributor might include the
-Program in a commercial product offering, Product X. That Contributor is then a
-Commercial Contributor. If that Commercial Contributor then makes performance
-claims, or offers warranties related to Product X, those performance claims and
-warranties are such Commercial Contributor's responsibility alone. Under this
-section, the Commercial Contributor would have to defend claims against the
-other Contributors related to those performance claims and warranties, and if a
-court requires any other Contributor to pay any damages as a result, the
-Commercial Contributor must pay those damages.</span> </p>
-
-<p><b><span style='font-size:10.0pt'>5. NO WARRANTY</span></b> </p>
-
-<p><span style='font-size:10.0pt'>EXCEPT AS EXPRESSLY SET FORTH IN THIS
-AGREEMENT, THE PROGRAM IS PROVIDED ON AN &quot;AS IS&quot; BASIS, WITHOUT
-WARRANTIES OR CONDITIONS OF ANY KIND, EITHER EXPRESS OR IMPLIED INCLUDING,
-WITHOUT LIMITATION, ANY WARRANTIES OR CONDITIONS OF TITLE, NON-INFRINGEMENT,
-MERCHANTABILITY OR FITNESS FOR A PARTICULAR PURPOSE. Each Recipient is solely
-responsible for determining the appropriateness of using and distributing the
-Program and assumes all risks associated with its exercise of rights under this
-Agreement , including but not limited to the risks and costs of program errors,
-compliance with applicable laws, damage to or loss of data, programs or
-equipment, and unavailability or interruption of operations. </span></p>
-
-<p><b><span style='font-size:10.0pt'>6. DISCLAIMER OF LIABILITY</span></b> </p>
-
-<p><span style='font-size:10.0pt'>EXCEPT AS EXPRESSLY SET FORTH IN THIS
-AGREEMENT, NEITHER RECIPIENT NOR ANY CONTRIBUTORS SHALL HAVE ANY LIABILITY FOR
-ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES
-(INCLUDING WITHOUT LIMITATION LOST PROFITS), HOWEVER CAUSED AND ON ANY THEORY
-OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING
-NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OR DISTRIBUTION OF
-THE PROGRAM OR THE EXERCISE OF ANY RIGHTS GRANTED HEREUNDER, EVEN IF ADVISED OF
-THE POSSIBILITY OF SUCH DAMAGES.</span> </p>
-
-<p><b><span style='font-size:10.0pt'>7. GENERAL</span></b> </p>
-
-<p><span style='font-size:10.0pt'>If any provision of this Agreement is invalid
-or unenforceable under applicable law, it shall not affect the validity or
-enforceability of the remainder of the terms of this Agreement, and without
-further action by the parties hereto, such provision shall be reformed to the
-minimum extent necessary to make such provision valid and enforceable.</span> </p>
-
-<p><span style='font-size:10.0pt'>If Recipient institutes patent litigation
-against any entity (including a cross-claim or counterclaim in a lawsuit)
-alleging that the Program itself (excluding combinations of the Program with
-other software or hardware) infringes such Recipient's patent(s), then such
-Recipient's rights granted under Section 2(b) shall terminate as of the date
-such litigation is filed. </span></p>
-
-<p><span style='font-size:10.0pt'>All Recipient's rights under this Agreement
-shall terminate if it fails to comply with any of the material terms or
-conditions of this Agreement and does not cure such failure in a reasonable
-period of time after becoming aware of such noncompliance. If all Recipient's
-rights under this Agreement terminate, Recipient agrees to cease use and
-distribution of the Program as soon as reasonably practicable. However,
-Recipient's obligations under this Agreement and any licenses granted by
-Recipient relating to the Program shall continue and survive. </span></p>
-
-<p><span style='font-size:10.0pt'>Everyone is permitted to copy and distribute
-copies of this Agreement, but in order to avoid inconsistency the Agreement is
-copyrighted and may only be modified in the following manner. The Agreement
-Steward reserves the right to publish new versions (including revisions) of
-this Agreement from time to time. No one other than the Agreement Steward has
-the right to modify this Agreement. The Eclipse Foundation is the initial
-Agreement Steward. The Eclipse Foundation may assign the responsibility to
-serve as the Agreement Steward to a suitable separate entity. Each new version
-of the Agreement will be given a distinguishing version number. The Program
-(including Contributions) may always be distributed subject to the version of
-the Agreement under which it was received. In addition, after a new version of
-the Agreement is published, Contributor may elect to distribute the Program
-(including its Contributions) under the new version. Except as expressly stated
-in Sections 2(a) and 2(b) above, Recipient receives no rights or licenses to
-the intellectual property of any Contributor under this Agreement, whether
-expressly, by implication, estoppel or otherwise. All rights in the Program not
-expressly granted under this Agreement are reserved.</span> </p>
-
-<p><span style='font-size:10.0pt'>This Agreement is governed by the laws of the
-State of New York and the intellectual property laws of the United States of
-America. No party to this Agreement will bring a legal action under this
-Agreement more than one year after the cause of action arose. Each party waives
-its rights to a jury trial in any resulting litigation.</span> </p>
-
-<p class=MsoNormal><![if !supportEmptyParas]>&nbsp;<![endif]><o:p></o:p></p>
-
-</div>
-
-</body>
-
-</html> \ No newline at end of file
diff --git a/jpa/features/org.eclipse.jpt.tests.feature/feature.properties b/jpa/features/org.eclipse.jpt.tests.feature/feature.properties
deleted file mode 100644
index 46a4c431f3..0000000000
--- a/jpa/features/org.eclipse.jpt.tests.feature/feature.properties
+++ /dev/null
@@ -1,145 +0,0 @@
-###############################################################################
-# Copyright (c) 2006 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
-#
-# Contributors:
-# Oracle - initial API and implementation
-###############################################################################
-# feature.properties
-# contains externalized strings for feature.xml
-# "%foo" in feature.xml corresponds to the key "foo" in this file
-# java.io.Properties file (ISO 8859-1 with "\" escapes)
-# This file should be translated.
-
-# "featureName" property - name of the feature
-
-# "providerName" property - name of the company that provides the feature
-providerName=Eclipse Web Tools Platform
-
-# "updateSiteName" property - label for the update site
-# TOREVIEW - updateSiteName
-updateSiteName=Web Tools Platform (WTP) Updates
-
-# "description" property - description of the feature
-description=Dali Java Persistence Tools Tools
-
-# "copyright" property - text of the "Feature Update Copyright"
-copyright=\
-Copyright (c) 2006 Oracle Corporation.\n\
-All rights reserved. This program and the accompanying materials\n\
-are made available under the terms of the Eclipse Public License v1.0\n\
-which accompanies this distribution, and is available at\n\
-http://www.eclipse.org/legal/epl-v10.html\n\
-\n\
-Contributors:\n\
- Oracle - initial API and implementation\n
-################ end of copyright property ####################################
-
-# "licenseURL" property - URL of the "Feature License"
-# do not translate value - just change to point to a locale-specific HTML page
-licenseURL=license.html
-
-# "license" property - text of the "Feature Update License"
-# should be plain text version of license agreement pointed to be "licenseURL"
-license=\
-ECLIPSE FOUNDATION SOFTWARE USER AGREEMENT\n\
-June 06, 2007\n\
-\n\
-Usage Of Content\n\
-\n\
-THE ECLIPSE FOUNDATION MAKES AVAILABLE SOFTWARE, DOCUMENTATION, INFORMATION AND/OR\n\
-OTHER MATERIALS FOR OPEN SOURCE PROJECTS (COLLECTIVELY "CONTENT").\n\
-USE OF THE CONTENT IS GOVERNED BY THE TERMS AND CONDITIONS OF THIS\n\
-AGREEMENT AND/OR THE TERMS AND CONDITIONS OF LICENSE AGREEMENTS OR\n\
-NOTICES INDICATED OR REFERENCED BELOW. BY USING THE CONTENT, YOU\n\
-AGREE THAT YOUR USE OF THE CONTENT IS GOVERNED BY THIS AGREEMENT\n\
-AND/OR THE TERMS AND CONDITIONS OF ANY APPLICABLE LICENSE AGREEMENTS\n\
-OR NOTICES INDICATED OR REFERENCED BELOW. IF YOU DO NOT AGREE TO THE\n\
-TERMS AND CONDITIONS OF THIS AGREEMENT AND THE TERMS AND CONDITIONS\n\
-OF ANY APPLICABLE LICENSE AGREEMENTS OR NOTICES INDICATED OR REFERENCED\n\
-BELOW, THEN YOU MAY NOT USE THE CONTENT.\n\
-\n\
-Applicable Licenses\n\
-\n\
-Unless otherwise indicated, all Content made available by the Eclipse Foundation\n\
-is provided to you under the terms and conditions of the Eclipse Public\n\
-License Version 1.0 ("EPL"). A copy of the EPL is provided with this\n\
-Content and is also available at http://www.eclipse.org/legal/epl-v10.html.\n\
-For purposes of the EPL, "Program" will mean the Content.\n\
-\n\
-Content includes, but is not limited to, source code, object code,\n\
-documentation and other files maintained in the Eclipse.org CVS\n\
-repository ("Repository") in CVS modules ("Modules") and made available\n\
-as downloadable archives ("Downloads").\n\
-\n\
- - Content may be structured and packaged into modules to facilitate delivering,\n\
- extending, and upgrading the Content. Typical modules may include plug-ins ("Plug-ins"),\n\
- plug-in fragments ("Fragments"), and features ("Features").\n\
- - Each Plug-in or Fragment may be packaged as a sub-directory or JAR (Java? ARchive)\n\
- in a directory named "plugins".\n\
- - A Feature is a bundle of one or more Plug-ins and/or Fragments and associated material.\n\
- Each Feature may be packaged as a sub-directory in a directory named "features".\n\
- Within a Feature, files named "feature.xml" may contain a list of the names and version\n\
- numbers of the Plug-ins and/or Fragments associated with that Feature.\n\
- - Features may also include other Features ("Included Features"). Within a Feature, files\n\
- named "feature.xml" may contain a list of the names and version numbers of Included Features.\n\
-\n\
-Features may also include other Features ("Included Features"). Files named\n\
-"feature.xml" may contain a list of the names and version numbers of\n\
-Included Features.\n\
-\n\
-The terms and conditions governing Plug-ins and Fragments should be\n\
-contained in files named "about.html" ("Abouts"). The terms and\n\
-conditions governing Features and Included Features should be contained\n\
-in files named "license.html" ("Feature Licenses"). Abouts and Feature\n\
-Licenses may be located in any directory of a Download or Module\n\
-including, but not limited to the following locations:\n\
-\n\
- - The top-level (root) directory\n\
- - Plug-in and Fragment directories\n\
- - Inside Plug-ins and Fragments packaged as JARs\n\
- - Sub-directories of the directory named "src" of certain Plug-ins\n\
- - Feature directories\n\
-\n\
-Note: if a Feature made available by the Eclipse Foundation is installed using the\n\
-Eclipse Update Manager, you must agree to a license ("Feature Update\n\
-License") during the installation process. If the Feature contains\n\
-Included Features, the Feature Update License should either provide you\n\
-with the terms and conditions governing the Included Features or inform\n\
-you where you can locate them. Feature Update Licenses may be found in\n\
-the "license" property of files named "feature.properties". Such Abouts,\n\
-Feature Licenses and Feature Update Licenses contain the terms and\n\
-conditions (or references to such terms and conditions) that govern your\n\
-use of the associated Content in that directory.\n\
-\n\
-THE ABOUTS, FEATURE LICENSES AND FEATURE UPDATE LICENSES MAY REFER\n\
-TO THE EPL OR OTHER LICENSE AGREEMENTS, NOTICES OR TERMS AND CONDITIONS.\n\
-SOME OF THESE OTHER LICENSE AGREEMENTS MAY INCLUDE (BUT ARE NOT LIMITED TO):\n\
-\n\
- - Common Public License Version 1.0 (available at http://www.eclipse.org/legal/cpl-v10.html)\n\
- - Apache Software License 1.1 (available at http://www.apache.org/licenses/LICENSE)\n\
- - Apache Software License 2.0 (available at http://www.apache.org/licenses/LICENSE-2.0)\n\
- - IBM Public License 1.0 (available at http://oss.software.ibm.com/developerworks/opensource/license10.html)\n\
- - Metro Link Public License 1.00 (available at http://www.opengroup.org/openmotif/supporters/metrolink/license.html)\n\
- - Mozilla Public License Version 1.1 (available at http://www.mozilla.org/MPL/MPL-1.1.html)\n\
- - Common Development and Distribution License (CDDL) Version 1.0 (available at http://www.sun.com/cddl/cddl.html)\n\
-\n\
-IT IS YOUR OBLIGATION TO READ AND ACCEPT ALL SUCH TERMS AND CONDITIONS PRIOR\n\
-TO USE OF THE CONTENT. If no About, Feature License or Feature Update License\n\
-is provided, please contact the Eclipse Foundation to determine what terms and conditions\n\
-govern that particular Content.\n\
-\n\
-Cryptography\n\
-\n\
-Content may contain encryption software. The country in which you are\n\
-currently may have restrictions on the import, possession, and use,\n\
-and/or re-export to another country, of encryption software. BEFORE\n\
-using any encryption software, please check the country's laws,\n\
-regulations and policies concerning the import, possession, or use,\n\
-and re-export of encryption software, to see if this is permitted.\n\
-\n\
-Java and all Java-based trademarks are trademarks of Sun Microsystems, Inc. in the United States, other countries, or both.\n
-########### end of license property ##########################################
diff --git a/jpa/features/org.eclipse.jpt.tests.feature/feature.xml b/jpa/features/org.eclipse.jpt.tests.feature/feature.xml
deleted file mode 100644
index 41ca1798f0..0000000000
--- a/jpa/features/org.eclipse.jpt.tests.feature/feature.xml
+++ /dev/null
@@ -1,44 +0,0 @@
-<?xml version="1.0" encoding="UTF-8"?>
-<feature
- id="org.eclipse.jpt.tests.feature"
- label="Dali Java Persistence Tools JUnit Tests"
- version="2.2.0.qualifier"
- provider-name="Eclipse.org">
-
- <description>
- %description
- </description>
-
- <copyright>
- %copyright
- </copyright>
-
- <license url="license.html">
- %license
- </license>
-
- <plugin
- id="org.eclipse.jpt.utility.tests"
- download-size="0"
- install-size="0"
- version="0.0.0"/>
-
- <plugin
- id="org.eclipse.jpt.core.tests"
- download-size="0"
- install-size="0"
- version="0.0.0"/>
-
- <plugin
- id="org.eclipse.jpt.core.tests.extension.resource"
- download-size="0"
- install-size="0"
- version="0.0.0"/>
-
- <plugin
- id="org.eclipse.jpt.eclipselink.core.tests"
- download-size="0"
- install-size="0"
- version="0.0.0"/>
-
-</feature>
diff --git a/jpa/features/org.eclipse.jpt.tests.feature/license.html b/jpa/features/org.eclipse.jpt.tests.feature/license.html
deleted file mode 100644
index 56445985d9..0000000000
--- a/jpa/features/org.eclipse.jpt.tests.feature/license.html
+++ /dev/null
@@ -1,98 +0,0 @@
-<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN" "http://www.w3c.org/TR/1999/REC-html401-19991224/loose.dtd">
-<!-- saved from url=(0044)http://www.eclipse.org/legal/epl/notice.html -->
-<HTML><HEAD><TITLE>Eclipse.org Software User Agreement</TITLE>
-<META http-equiv=Content-Type content="text/html; charset=iso-8859-1">
-<META content="MSHTML 6.00.2800.1479" name=GENERATOR></HEAD>
-<BODY lang=EN-US vLink=purple link=blue>
-<H2>Eclipse Foundation Software User Agreement</H2>
-<P>June 06, 2007</P>
-<H3>Usage Of Content</H3>
-<P>THE ECLIPSE FOUNDATION MAKES AVAILABLE SOFTWARE, DOCUMENTATION, INFORMATION
-AND/OR OTHER MATERIALS FOR OPEN SOURCE PROJECTS (COLLECTIVELY "CONTENT"). USE OF
-THE CONTENT IS GOVERNED BY THE TERMS AND CONDITIONS OF THIS AGREEMENT AND/OR THE
-TERMS AND CONDITIONS OF LICENSE AGREEMENTS OR NOTICES INDICATED OR REFERENCED
-BELOW. BY USING THE CONTENT, YOU AGREE THAT YOUR USE OF THE CONTENT IS GOVERNED
-BY THIS AGREEMENT AND/OR THE TERMS AND CONDITIONS OF ANY APPLICABLE LICENSE
-AGREEMENTS OR NOTICES INDICATED OR REFERENCED BELOW. IF YOU DO NOT AGREE TO THE
-TERMS AND CONDITIONS OF THIS AGREEMENT AND THE TERMS AND CONDITIONS OF ANY
-APPLICABLE LICENSE AGREEMENTS OR NOTICES INDICATED OR REFERENCED BELOW, THEN YOU
-MAY NOT USE THE CONTENT.</P>
-<H3>Applicable Licenses</H3>
-<P>Unless otherwise indicated, all Content made available by the Eclipse
-Foundation is provided to you under the terms and conditions of the Eclipse
-Public License Version 1.0 ("EPL"). A copy of the EPL is provided with this
-Content and is also available at <A
-href="http://www.eclipse.org/legal/epl-v10.html">http://www.eclipse.org/legal/epl-v10.html</A>.
-For purposes of the EPL, "Program" will mean the Content.</P>
-<P>Content includes, but is not limited to, source code, object code,
-documentation and other files maintained in the Eclipse.org CVS repository
-("Repository") in CVS modules ("Modules") and made available as downloadable
-archives ("Downloads").</P>
-<P>Content may be apportioned into plug-ins ("Plug-ins"), plug-in fragments
-("Fragments"), and features ("Features"). A Feature is a bundle of one or more
-Plug-ins and/or Fragments and associated material. Files named "feature.xml" may
-contain a list of the names and version numbers of the Plug-ins and/or Fragments
-associated with a Feature. Plug-ins and Fragments are located in directories
-named "plugins" and Features are located in directories named "features".</P>
-<P>Features may also include other Features ("Included Features"). Files named
-"feature.xml" may contain a list of the names and version numbers of Included
-Features.</P>
-<P>The terms and conditions governing Plug-ins and Fragments should be contained
-in files named "about.html" ("Abouts"). The terms and conditions governing
-Features and Included Features should be contained in files named "license.html"
-("Feature Licenses"). Abouts and Feature Licenses may be located in any
-directory of a Download or Module including, but not limited to the following
-locations:</P>
-<UL>
- <LI>The top-level (root) directory
- <LI>Plug-in and Fragment directories
- <LI>Subdirectories of the directory named "src" of certain Plug-ins
- <LI>Feature directories </LI></UL>
-<P>Note: if a Feature made available by the Eclipse Foundation is installed
-using the Eclipse Update Manager, you must agree to a license ("Feature Update
-License") during the installation process. If the Feature contains Included
-Features, the Feature Update License should either provide you with the terms
-and conditions governing the Included Features or inform you where you can
-locate them. Feature Update Licenses may be found in the "license" property of
-files named "feature.properties". Such Abouts, Feature Licenses and Feature
-Update Licenses contain the terms and conditions (or references to such terms
-and conditions) that govern your use of the associated Content in that
-directory.</P>
-<P>THE ABOUTS, FEATURE LICENSES AND FEATURE UPDATE LICENSES MAY REFER TO THE EPL
-OR OTHER LICENSE AGREEMENTS, NOTICES OR TERMS AND CONDITIONS. SOME OF THESE
-OTHER LICENSE AGREEMENTS MAY INCLUDE (BUT ARE NOT LIMITED TO):</P>
-<UL>
- <LI>Common Public License Version 1.0 (available at <A
- href="http://www.eclipse.org/legal/cpl-v10.html">http://www.eclipse.org/legal/cpl-v10.html</A>)
-
- <LI>Apache Software License 1.1 (available at <A
- href="http://www.apache.org/licenses/LICENSE">http://www.apache.org/licenses/LICENSE</A>)
-
- <LI>Apache Software License 2.0 (available at <A
- href="http://www.apache.org/licenses/LICENSE-2.0">http://www.apache.org/licenses/LICENSE-2.0</A>)
-
- <LI>IBM Public License 1.0 (available at <A
- href="http://oss.software.ibm.com/developerworks/opensource/license10.html">http://oss.software.ibm.com/developerworks/opensource/license10.html</A>)
-
- <LI>Metro Link Public License 1.00 (available at <A
- href="http://www.opengroup.org/openmotif/supporters/metrolink/license.html">http://www.opengroup.org/openmotif/supporters/metrolink/license.html</A>)
-
- <LI>Mozilla Public License Version 1.1 (available at <A
- href="http://www.mozilla.org/MPL/MPL-1.1.html">http://www.mozilla.org/MPL/MPL-1.1.html</A>)
- </LI>
-
- <LI>Common Development and Distribution License (CDDL) Version 1.0 (available at <A
- href="http://www.sun.com/cddl/cddl.html">http://www.sun.com/cddl/cddl.html)</A>
- </LI>
-</UL>
-<P>IT IS YOUR OBLIGATION TO READ AND ACCEPT ALL SUCH TERMS AND CONDITIONS PRIOR
-TO USE OF THE CONTENT. If no About, Feature License or Feature Update License is
-provided, please contact the Eclipse Foundation to determine what terms and
-conditions govern that particular Content.</P>
-<H3>Cryptography</H3>
-<P>Content may contain encryption software. The country in which you are
-currently may have restrictions on the import, possession, and use, and/or
-re-export to another country, of encryption software. BEFORE using any
-encryption software, please check the country's laws, regulations and policies
-concerning the import, possession, or use, and re-export of encryption software,
-to see if this is permitted.</P></BODY></HTML>
diff --git a/jpa/features/org.eclipse.jpt_sdk.feature/.cvsignore b/jpa/features/org.eclipse.jpt_sdk.feature/.cvsignore
deleted file mode 100644
index 6365d3dc51..0000000000
--- a/jpa/features/org.eclipse.jpt_sdk.feature/.cvsignore
+++ /dev/null
@@ -1,3 +0,0 @@
-feature.temp.folder
-build.xml
-org.eclipse.jpt_sdk.feature_1.0.1.*
diff --git a/jpa/features/org.eclipse.jpt_sdk.feature/.project b/jpa/features/org.eclipse.jpt_sdk.feature/.project
deleted file mode 100644
index 33da750336..0000000000
--- a/jpa/features/org.eclipse.jpt_sdk.feature/.project
+++ /dev/null
@@ -1,17 +0,0 @@
-<?xml version="1.0" encoding="UTF-8"?>
-<projectDescription>
- <name>org.eclipse.jpt_sdk.feature</name>
- <comment></comment>
- <projects>
- </projects>
- <buildSpec>
- <buildCommand>
- <name>org.eclipse.pde.FeatureBuilder</name>
- <arguments>
- </arguments>
- </buildCommand>
- </buildSpec>
- <natures>
- <nature>org.eclipse.pde.FeatureNature</nature>
- </natures>
-</projectDescription>
diff --git a/jpa/features/org.eclipse.jpt_sdk.feature/.settings/org.eclipse.core.resources.prefs b/jpa/features/org.eclipse.jpt_sdk.feature/.settings/org.eclipse.core.resources.prefs
deleted file mode 100644
index 6cc7d4b4cd..0000000000
--- a/jpa/features/org.eclipse.jpt_sdk.feature/.settings/org.eclipse.core.resources.prefs
+++ /dev/null
@@ -1,3 +0,0 @@
-#Sun May 27 15:09:59 EDT 2007
-eclipse.preferences.version=1
-encoding/<project>=ISO-8859-1
diff --git a/jpa/features/org.eclipse.jpt_sdk.feature/build.properties b/jpa/features/org.eclipse.jpt_sdk.feature/build.properties
deleted file mode 100644
index 2d7ab8d203..0000000000
--- a/jpa/features/org.eclipse.jpt_sdk.feature/build.properties
+++ /dev/null
@@ -1,7 +0,0 @@
-bin.includes = feature.xml,\
- license.html,\
- feature.properties,\
- epl-v10.html,\
- eclipse_update_120.jpg
-
-generate.feature@org.eclipse.jpt.feature.source=org.eclipse.jpt.feature
diff --git a/jpa/features/org.eclipse.jpt_sdk.feature/eclipse_update_120.jpg b/jpa/features/org.eclipse.jpt_sdk.feature/eclipse_update_120.jpg
deleted file mode 100644
index bfdf708ad6..0000000000
--- a/jpa/features/org.eclipse.jpt_sdk.feature/eclipse_update_120.jpg
+++ /dev/null
Binary files differ
diff --git a/jpa/features/org.eclipse.jpt_sdk.feature/epl-v10.html b/jpa/features/org.eclipse.jpt_sdk.feature/epl-v10.html
deleted file mode 100644
index ed4b196655..0000000000
--- a/jpa/features/org.eclipse.jpt_sdk.feature/epl-v10.html
+++ /dev/null
@@ -1,328 +0,0 @@
-<html xmlns:o="urn:schemas-microsoft-com:office:office"
-xmlns:w="urn:schemas-microsoft-com:office:word"
-xmlns="http://www.w3.org/TR/REC-html40">
-
-<head>
-<meta http-equiv=Content-Type content="text/html; charset=windows-1252">
-<meta name=ProgId content=Word.Document>
-<meta name=Generator content="Microsoft Word 9">
-<meta name=Originator content="Microsoft Word 9">
-<link rel=File-List
-href="./Eclipse%20EPL%202003_11_10%20Final_files/filelist.xml">
-<title>Eclipse Public License - Version 1.0</title>
-<!--[if gte mso 9]><xml>
- <o:DocumentProperties>
- <o:Revision>2</o:Revision>
- <o:TotalTime>3</o:TotalTime>
- <o:Created>2004-03-05T23:03:00Z</o:Created>
- <o:LastSaved>2004-03-05T23:03:00Z</o:LastSaved>
- <o:Pages>4</o:Pages>
- <o:Words>1626</o:Words>
- <o:Characters>9270</o:Characters>
- <o:Lines>77</o:Lines>
- <o:Paragraphs>18</o:Paragraphs>
- <o:CharactersWithSpaces>11384</o:CharactersWithSpaces>
- <o:Version>9.4402</o:Version>
- </o:DocumentProperties>
-</xml><![endif]--><!--[if gte mso 9]><xml>
- <w:WordDocument>
- <w:TrackRevisions/>
- </w:WordDocument>
-</xml><![endif]-->
-<style>
-<!--
- /* Font Definitions */
-@font-face
- {font-family:Tahoma;
- panose-1:2 11 6 4 3 5 4 4 2 4;
- mso-font-charset:0;
- mso-generic-font-family:swiss;
- mso-font-pitch:variable;
- mso-font-signature:553679495 -2147483648 8 0 66047 0;}
- /* Style Definitions */
-p.MsoNormal, li.MsoNormal, div.MsoNormal
- {mso-style-parent:"";
- margin:0in;
- margin-bottom:.0001pt;
- mso-pagination:widow-orphan;
- font-size:12.0pt;
- font-family:"Times New Roman";
- mso-fareast-font-family:"Times New Roman";}
-p
- {margin-right:0in;
- mso-margin-top-alt:auto;
- mso-margin-bottom-alt:auto;
- margin-left:0in;
- mso-pagination:widow-orphan;
- font-size:12.0pt;
- font-family:"Times New Roman";
- mso-fareast-font-family:"Times New Roman";}
-p.BalloonText, li.BalloonText, div.BalloonText
- {mso-style-name:"Balloon Text";
- margin:0in;
- margin-bottom:.0001pt;
- mso-pagination:widow-orphan;
- font-size:8.0pt;
- font-family:Tahoma;
- mso-fareast-font-family:"Times New Roman";}
-@page Section1
- {size:8.5in 11.0in;
- margin:1.0in 1.25in 1.0in 1.25in;
- mso-header-margin:.5in;
- mso-footer-margin:.5in;
- mso-paper-source:0;}
-div.Section1
- {page:Section1;}
--->
-</style>
-</head>
-
-<body lang=EN-US style='tab-interval:.5in'>
-
-<div class=Section1>
-
-<p align=center style='text-align:center'><b>Eclipse Public License - v 1.0</b>
-</p>
-
-<p><span style='font-size:10.0pt'>THE ACCOMPANYING PROGRAM IS PROVIDED UNDER
-THE TERMS OF THIS ECLIPSE PUBLIC LICENSE (&quot;AGREEMENT&quot;). ANY USE,
-REPRODUCTION OR DISTRIBUTION OF THE PROGRAM CONSTITUTES RECIPIENT'S ACCEPTANCE
-OF THIS AGREEMENT.</span> </p>
-
-<p><b><span style='font-size:10.0pt'>1. DEFINITIONS</span></b> </p>
-
-<p><span style='font-size:10.0pt'>&quot;Contribution&quot; means:</span> </p>
-
-<p class=MsoNormal style='margin-left:.5in'><span style='font-size:10.0pt'>a)
-in the case of the initial Contributor, the initial code and documentation
-distributed under this Agreement, and<br clear=left>
-b) in the case of each subsequent Contributor:</span></p>
-
-<p class=MsoNormal style='margin-left:.5in'><span style='font-size:10.0pt'>i)
-changes to the Program, and</span></p>
-
-<p class=MsoNormal style='margin-left:.5in'><span style='font-size:10.0pt'>ii)
-additions to the Program;</span></p>
-
-<p class=MsoNormal style='margin-left:.5in'><span style='font-size:10.0pt'>where
-such changes and/or additions to the Program originate from and are distributed
-by that particular Contributor. A Contribution 'originates' from a Contributor
-if it was added to the Program by such Contributor itself or anyone acting on
-such Contributor's behalf. Contributions do not include additions to the
-Program which: (i) are separate modules of software distributed in conjunction
-with the Program under their own license agreement, and (ii) are not derivative
-works of the Program. </span></p>
-
-<p><span style='font-size:10.0pt'>&quot;Contributor&quot; means any person or
-entity that distributes the Program.</span> </p>
-
-<p><span style='font-size:10.0pt'>&quot;Licensed Patents &quot; mean patent
-claims licensable by a Contributor which are necessarily infringed by the use
-or sale of its Contribution alone or when combined with the Program. </span></p>
-
-<p><span style='font-size:10.0pt'>&quot;Program&quot; means the Contributions
-distributed in accordance with this Agreement.</span> </p>
-
-<p><span style='font-size:10.0pt'>&quot;Recipient&quot; means anyone who
-receives the Program under this Agreement, including all Contributors.</span> </p>
-
-<p><b><span style='font-size:10.0pt'>2. GRANT OF RIGHTS</span></b> </p>
-
-<p class=MsoNormal style='margin-left:.5in'><span style='font-size:10.0pt'>a)
-Subject to the terms of this Agreement, each Contributor hereby grants Recipient
-a non-exclusive, worldwide, royalty-free copyright license to<span
-style='color:red'> </span>reproduce, prepare derivative works of, publicly
-display, publicly perform, distribute and sublicense the Contribution of such
-Contributor, if any, and such derivative works, in source code and object code
-form.</span></p>
-
-<p class=MsoNormal style='margin-left:.5in'><span style='font-size:10.0pt'>b)
-Subject to the terms of this Agreement, each Contributor hereby grants
-Recipient a non-exclusive, worldwide,<span style='color:green'> </span>royalty-free
-patent license under Licensed Patents to make, use, sell, offer to sell, import
-and otherwise transfer the Contribution of such Contributor, if any, in source
-code and object code form. This patent license shall apply to the combination
-of the Contribution and the Program if, at the time the Contribution is added
-by the Contributor, such addition of the Contribution causes such combination
-to be covered by the Licensed Patents. The patent license shall not apply to
-any other combinations which include the Contribution. No hardware per se is
-licensed hereunder. </span></p>
-
-<p class=MsoNormal style='margin-left:.5in'><span style='font-size:10.0pt'>c)
-Recipient understands that although each Contributor grants the licenses to its
-Contributions set forth herein, no assurances are provided by any Contributor
-that the Program does not infringe the patent or other intellectual property
-rights of any other entity. Each Contributor disclaims any liability to Recipient
-for claims brought by any other entity based on infringement of intellectual
-property rights or otherwise. As a condition to exercising the rights and
-licenses granted hereunder, each Recipient hereby assumes sole responsibility
-to secure any other intellectual property rights needed, if any. For example,
-if a third party patent license is required to allow Recipient to distribute
-the Program, it is Recipient's responsibility to acquire that license before
-distributing the Program.</span></p>
-
-<p class=MsoNormal style='margin-left:.5in'><span style='font-size:10.0pt'>d)
-Each Contributor represents that to its knowledge it has sufficient copyright
-rights in its Contribution, if any, to grant the copyright license set forth in
-this Agreement. </span></p>
-
-<p><b><span style='font-size:10.0pt'>3. REQUIREMENTS</span></b> </p>
-
-<p><span style='font-size:10.0pt'>A Contributor may choose to distribute the
-Program in object code form under its own license agreement, provided that:</span>
-</p>
-
-<p class=MsoNormal style='margin-left:.5in'><span style='font-size:10.0pt'>a)
-it complies with the terms and conditions of this Agreement; and</span></p>
-
-<p class=MsoNormal style='margin-left:.5in'><span style='font-size:10.0pt'>b)
-its license agreement:</span></p>
-
-<p class=MsoNormal style='margin-left:.5in'><span style='font-size:10.0pt'>i)
-effectively disclaims on behalf of all Contributors all warranties and
-conditions, express and implied, including warranties or conditions of title
-and non-infringement, and implied warranties or conditions of merchantability
-and fitness for a particular purpose; </span></p>
-
-<p class=MsoNormal style='margin-left:.5in'><span style='font-size:10.0pt'>ii)
-effectively excludes on behalf of all Contributors all liability for damages,
-including direct, indirect, special, incidental and consequential damages, such
-as lost profits; </span></p>
-
-<p class=MsoNormal style='margin-left:.5in'><span style='font-size:10.0pt'>iii)
-states that any provisions which differ from this Agreement are offered by that
-Contributor alone and not by any other party; and</span></p>
-
-<p class=MsoNormal style='margin-left:.5in'><span style='font-size:10.0pt'>iv)
-states that source code for the Program is available from such Contributor, and
-informs licensees how to obtain it in a reasonable manner on or through a
-medium customarily used for software exchange.<span style='color:blue'> </span></span></p>
-
-<p><span style='font-size:10.0pt'>When the Program is made available in source
-code form:</span> </p>
-
-<p class=MsoNormal style='margin-left:.5in'><span style='font-size:10.0pt'>a)
-it must be made available under this Agreement; and </span></p>
-
-<p class=MsoNormal style='margin-left:.5in'><span style='font-size:10.0pt'>b) a
-copy of this Agreement must be included with each copy of the Program. </span></p>
-
-<p><span style='font-size:10.0pt'>Contributors may not remove or alter any
-copyright notices contained within the Program. </span></p>
-
-<p><span style='font-size:10.0pt'>Each Contributor must identify itself as the
-originator of its Contribution, if any, in a manner that reasonably allows
-subsequent Recipients to identify the originator of the Contribution. </span></p>
-
-<p><b><span style='font-size:10.0pt'>4. COMMERCIAL DISTRIBUTION</span></b> </p>
-
-<p><span style='font-size:10.0pt'>Commercial distributors of software may
-accept certain responsibilities with respect to end users, business partners
-and the like. While this license is intended to facilitate the commercial use
-of the Program, the Contributor who includes the Program in a commercial
-product offering should do so in a manner which does not create potential
-liability for other Contributors. Therefore, if a Contributor includes the
-Program in a commercial product offering, such Contributor (&quot;Commercial
-Contributor&quot;) hereby agrees to defend and indemnify every other
-Contributor (&quot;Indemnified Contributor&quot;) against any losses, damages and
-costs (collectively &quot;Losses&quot;) arising from claims, lawsuits and other
-legal actions brought by a third party against the Indemnified Contributor to
-the extent caused by the acts or omissions of such Commercial Contributor in
-connection with its distribution of the Program in a commercial product
-offering. The obligations in this section do not apply to any claims or Losses
-relating to any actual or alleged intellectual property infringement. In order
-to qualify, an Indemnified Contributor must: a) promptly notify the Commercial
-Contributor in writing of such claim, and b) allow the Commercial Contributor
-to control, and cooperate with the Commercial Contributor in, the defense and
-any related settlement negotiations. The Indemnified Contributor may participate
-in any such claim at its own expense.</span> </p>
-
-<p><span style='font-size:10.0pt'>For example, a Contributor might include the
-Program in a commercial product offering, Product X. That Contributor is then a
-Commercial Contributor. If that Commercial Contributor then makes performance
-claims, or offers warranties related to Product X, those performance claims and
-warranties are such Commercial Contributor's responsibility alone. Under this
-section, the Commercial Contributor would have to defend claims against the
-other Contributors related to those performance claims and warranties, and if a
-court requires any other Contributor to pay any damages as a result, the
-Commercial Contributor must pay those damages.</span> </p>
-
-<p><b><span style='font-size:10.0pt'>5. NO WARRANTY</span></b> </p>
-
-<p><span style='font-size:10.0pt'>EXCEPT AS EXPRESSLY SET FORTH IN THIS
-AGREEMENT, THE PROGRAM IS PROVIDED ON AN &quot;AS IS&quot; BASIS, WITHOUT
-WARRANTIES OR CONDITIONS OF ANY KIND, EITHER EXPRESS OR IMPLIED INCLUDING,
-WITHOUT LIMITATION, ANY WARRANTIES OR CONDITIONS OF TITLE, NON-INFRINGEMENT,
-MERCHANTABILITY OR FITNESS FOR A PARTICULAR PURPOSE. Each Recipient is solely
-responsible for determining the appropriateness of using and distributing the
-Program and assumes all risks associated with its exercise of rights under this
-Agreement , including but not limited to the risks and costs of program errors,
-compliance with applicable laws, damage to or loss of data, programs or
-equipment, and unavailability or interruption of operations. </span></p>
-
-<p><b><span style='font-size:10.0pt'>6. DISCLAIMER OF LIABILITY</span></b> </p>
-
-<p><span style='font-size:10.0pt'>EXCEPT AS EXPRESSLY SET FORTH IN THIS
-AGREEMENT, NEITHER RECIPIENT NOR ANY CONTRIBUTORS SHALL HAVE ANY LIABILITY FOR
-ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES
-(INCLUDING WITHOUT LIMITATION LOST PROFITS), HOWEVER CAUSED AND ON ANY THEORY
-OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING
-NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OR DISTRIBUTION OF
-THE PROGRAM OR THE EXERCISE OF ANY RIGHTS GRANTED HEREUNDER, EVEN IF ADVISED OF
-THE POSSIBILITY OF SUCH DAMAGES.</span> </p>
-
-<p><b><span style='font-size:10.0pt'>7. GENERAL</span></b> </p>
-
-<p><span style='font-size:10.0pt'>If any provision of this Agreement is invalid
-or unenforceable under applicable law, it shall not affect the validity or
-enforceability of the remainder of the terms of this Agreement, and without
-further action by the parties hereto, such provision shall be reformed to the
-minimum extent necessary to make such provision valid and enforceable.</span> </p>
-
-<p><span style='font-size:10.0pt'>If Recipient institutes patent litigation
-against any entity (including a cross-claim or counterclaim in a lawsuit)
-alleging that the Program itself (excluding combinations of the Program with
-other software or hardware) infringes such Recipient's patent(s), then such
-Recipient's rights granted under Section 2(b) shall terminate as of the date
-such litigation is filed. </span></p>
-
-<p><span style='font-size:10.0pt'>All Recipient's rights under this Agreement
-shall terminate if it fails to comply with any of the material terms or
-conditions of this Agreement and does not cure such failure in a reasonable
-period of time after becoming aware of such noncompliance. If all Recipient's
-rights under this Agreement terminate, Recipient agrees to cease use and
-distribution of the Program as soon as reasonably practicable. However,
-Recipient's obligations under this Agreement and any licenses granted by
-Recipient relating to the Program shall continue and survive. </span></p>
-
-<p><span style='font-size:10.0pt'>Everyone is permitted to copy and distribute
-copies of this Agreement, but in order to avoid inconsistency the Agreement is
-copyrighted and may only be modified in the following manner. The Agreement
-Steward reserves the right to publish new versions (including revisions) of
-this Agreement from time to time. No one other than the Agreement Steward has
-the right to modify this Agreement. The Eclipse Foundation is the initial
-Agreement Steward. The Eclipse Foundation may assign the responsibility to
-serve as the Agreement Steward to a suitable separate entity. Each new version
-of the Agreement will be given a distinguishing version number. The Program
-(including Contributions) may always be distributed subject to the version of
-the Agreement under which it was received. In addition, after a new version of
-the Agreement is published, Contributor may elect to distribute the Program
-(including its Contributions) under the new version. Except as expressly stated
-in Sections 2(a) and 2(b) above, Recipient receives no rights or licenses to
-the intellectual property of any Contributor under this Agreement, whether
-expressly, by implication, estoppel or otherwise. All rights in the Program not
-expressly granted under this Agreement are reserved.</span> </p>
-
-<p><span style='font-size:10.0pt'>This Agreement is governed by the laws of the
-State of New York and the intellectual property laws of the United States of
-America. No party to this Agreement will bring a legal action under this
-Agreement more than one year after the cause of action arose. Each party waives
-its rights to a jury trial in any resulting litigation.</span> </p>
-
-<p class=MsoNormal><![if !supportEmptyParas]>&nbsp;<![endif]><o:p></o:p></p>
-
-</div>
-
-</body>
-
-</html> \ No newline at end of file
diff --git a/jpa/features/org.eclipse.jpt_sdk.feature/feature.properties b/jpa/features/org.eclipse.jpt_sdk.feature/feature.properties
deleted file mode 100644
index 5db55361b5..0000000000
--- a/jpa/features/org.eclipse.jpt_sdk.feature/feature.properties
+++ /dev/null
@@ -1,140 +0,0 @@
-###############################################################################
-# Copyright (c) 2006 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
-#
-# Contributors:
-# Oracle. - initial API and implementation
-###############################################################################
-
-# "featureName" property - name of the feature
-featureName=Dali Java Persistence Tools Plug-in SDK
-
-# "providerName" property - name of the company that provides the feature
-providerName=Eclipse Web Tools Platform Project
-
-# "updateSiteName" property - label for the update site
-updateSiteName=The Eclipse Web Tools Platform (WTP) Project update site
-
-# "description" property - description of the feature
-description=Source code archives for Dali Java Persistence Tools
-
-# "copyright" property - text of the "Feature Update Copyright"
-copyright=\
-Copyright (c) 2006-09 Oracle Corporation.\n\
-All rights reserved. This program and the accompanying materials\n\
-are made available under the terms of the Eclipse Public License v1.0\n\
-which accompanies this distribution, and is available at\n\
-http://www.eclipse.org/legal/epl-v10.html\n\
-\n\
-Contributors:\n\
- Oracle - initial API and implementation\n
-################ end of copyright property ####################################
-
-# "licenseURL" property - URL of the "Feature License"
-# do not translate value - just change to point to a locale-specific HTML page
-licenseURL=license.html
-
-# "license" property - text of the "Feature Update License"
-# should be plain text version of license agreement pointed to be "licenseURL"
-license=\
-ECLIPSE FOUNDATION SOFTWARE USER AGREEMENT\n\
-June 06, 2007\n\
-\n\
-Usage Of Content\n\
-\n\
-THE ECLIPSE FOUNDATION MAKES AVAILABLE SOFTWARE, DOCUMENTATION, INFORMATION AND/OR\n\
-OTHER MATERIALS FOR OPEN SOURCE PROJECTS (COLLECTIVELY "CONTENT").\n\
-USE OF THE CONTENT IS GOVERNED BY THE TERMS AND CONDITIONS OF THIS\n\
-AGREEMENT AND/OR THE TERMS AND CONDITIONS OF LICENSE AGREEMENTS OR\n\
-NOTICES INDICATED OR REFERENCED BELOW. BY USING THE CONTENT, YOU\n\
-AGREE THAT YOUR USE OF THE CONTENT IS GOVERNED BY THIS AGREEMENT\n\
-AND/OR THE TERMS AND CONDITIONS OF ANY APPLICABLE LICENSE AGREEMENTS\n\
-OR NOTICES INDICATED OR REFERENCED BELOW. IF YOU DO NOT AGREE TO THE\n\
-TERMS AND CONDITIONS OF THIS AGREEMENT AND THE TERMS AND CONDITIONS\n\
-OF ANY APPLICABLE LICENSE AGREEMENTS OR NOTICES INDICATED OR REFERENCED\n\
-BELOW, THEN YOU MAY NOT USE THE CONTENT.\n\
-\n\
-Applicable Licenses\n\
-\n\
-Unless otherwise indicated, all Content made available by the Eclipse Foundation\n\
-is provided to you under the terms and conditions of the Eclipse Public\n\
-License Version 1.0 ("EPL"). A copy of the EPL is provided with this\n\
-Content and is also available at http://www.eclipse.org/legal/epl-v10.html.\n\
-For purposes of the EPL, "Program" will mean the Content.\n\
-\n\
-Content includes, but is not limited to, source code, object code,\n\
-documentation and other files maintained in the Eclipse.org CVS\n\
-repository ("Repository") in CVS modules ("Modules") and made available\n\
-as downloadable archives ("Downloads").\n\
-\n\
- - Content may be structured and packaged into modules to facilitate delivering,\n\
- extending, and upgrading the Content. Typical modules may include plug-ins ("Plug-ins"),\n\
- plug-in fragments ("Fragments"), and features ("Features").\n\
- - Each Plug-in or Fragment may be packaged as a sub-directory or JAR (Java? ARchive)\n\
- in a directory named "plugins".\n\
- - A Feature is a bundle of one or more Plug-ins and/or Fragments and associated material.\n\
- Each Feature may be packaged as a sub-directory in a directory named "features".\n\
- Within a Feature, files named "feature.xml" may contain a list of the names and version\n\
- numbers of the Plug-ins and/or Fragments associated with that Feature.\n\
- - Features may also include other Features ("Included Features"). Within a Feature, files\n\
- named "feature.xml" may contain a list of the names and version numbers of Included Features.\n\
-\n\
-Features may also include other Features ("Included Features"). Files named\n\
-"feature.xml" may contain a list of the names and version numbers of\n\
-Included Features.\n\
-\n\
-The terms and conditions governing Plug-ins and Fragments should be\n\
-contained in files named "about.html" ("Abouts"). The terms and\n\
-conditions governing Features and Included Features should be contained\n\
-in files named "license.html" ("Feature Licenses"). Abouts and Feature\n\
-Licenses may be located in any directory of a Download or Module\n\
-including, but not limited to the following locations:\n\
-\n\
- - The top-level (root) directory\n\
- - Plug-in and Fragment directories\n\
- - Inside Plug-ins and Fragments packaged as JARs\n\
- - Sub-directories of the directory named "src" of certain Plug-ins\n\
- - Feature directories\n\
-\n\
-Note: if a Feature made available by the Eclipse Foundation is installed using the\n\
-Eclipse Update Manager, you must agree to a license ("Feature Update\n\
-License") during the installation process. If the Feature contains\n\
-Included Features, the Feature Update License should either provide you\n\
-with the terms and conditions governing the Included Features or inform\n\
-you where you can locate them. Feature Update Licenses may be found in\n\
-the "license" property of files named "feature.properties". Such Abouts,\n\
-Feature Licenses and Feature Update Licenses contain the terms and\n\
-conditions (or references to such terms and conditions) that govern your\n\
-use of the associated Content in that directory.\n\
-\n\
-THE ABOUTS, FEATURE LICENSES AND FEATURE UPDATE LICENSES MAY REFER\n\
-TO THE EPL OR OTHER LICENSE AGREEMENTS, NOTICES OR TERMS AND CONDITIONS.\n\
-SOME OF THESE OTHER LICENSE AGREEMENTS MAY INCLUDE (BUT ARE NOT LIMITED TO):\n\
-\n\
- - Common Public License Version 1.0 (available at http://www.eclipse.org/legal/cpl-v10.html)\n\
- - Apache Software License 1.1 (available at http://www.apache.org/licenses/LICENSE)\n\
- - Apache Software License 2.0 (available at http://www.apache.org/licenses/LICENSE-2.0)\n\
- - IBM Public License 1.0 (available at http://oss.software.ibm.com/developerworks/opensource/license10.html)\n\
- - Metro Link Public License 1.00 (available at http://www.opengroup.org/openmotif/supporters/metrolink/license.html)\n\
- - Mozilla Public License Version 1.1 (available at http://www.mozilla.org/MPL/MPL-1.1.html)\n\
- - Common Development and Distribution License (CDDL) Version 1.0 (available at http://www.sun.com/cddl/cddl.html)\n\
-\n\
-IT IS YOUR OBLIGATION TO READ AND ACCEPT ALL SUCH TERMS AND CONDITIONS PRIOR\n\
-TO USE OF THE CONTENT. If no About, Feature License or Feature Update License\n\
-is provided, please contact the Eclipse Foundation to determine what terms and conditions\n\
-govern that particular Content.\n\
-\n\
-Cryptography\n\
-\n\
-Content may contain encryption software. The country in which you are\n\
-currently may have restrictions on the import, possession, and use,\n\
-and/or re-export to another country, of encryption software. BEFORE\n\
-using any encryption software, please check the country's laws,\n\
-regulations and policies concerning the import, possession, or use,\n\
-and re-export of encryption software, to see if this is permitted.\n\
-\n\
-Java and all Java-based trademarks are trademarks of Sun Microsystems, Inc. in the United States, other countries, or both.\n
-########### end of license property ##########################################
diff --git a/jpa/features/org.eclipse.jpt_sdk.feature/feature.xml b/jpa/features/org.eclipse.jpt_sdk.feature/feature.xml
deleted file mode 100644
index 320d431ce3..0000000000
--- a/jpa/features/org.eclipse.jpt_sdk.feature/feature.xml
+++ /dev/null
@@ -1,35 +0,0 @@
-<?xml version="1.0" encoding="UTF-8"?>
-<feature
- id="org.eclipse.jpt_sdk.feature"
- label="%featureName"
- version="2.2.0.qualifier"
- provider-name="%providerName">
-
- <description>
- %description
- </description>
-
- <copyright>
- %copyright
- </copyright>
-
- <license url="license.html">
- %license
- </license>
-
- <includes
- id="org.eclipse.jpt.feature"
- version="0.0.0"/>
-
- <includes
- id="org.eclipse.jpt.feature.source"
- version="0.0.0"/>
-
- <plugin
- id="org.eclipse.jpt.doc.isv"
- download-size="0"
- install-size="0"
- version="0.0.0"
- unpack="false"/>
-
-</feature>
diff --git a/jpa/features/org.eclipse.jpt_sdk.feature/license.html b/jpa/features/org.eclipse.jpt_sdk.feature/license.html
deleted file mode 100644
index fc77372d46..0000000000
--- a/jpa/features/org.eclipse.jpt_sdk.feature/license.html
+++ /dev/null
@@ -1,98 +0,0 @@
-<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN" "http://www.w3c.org/TR/1999/REC-html401-19991224/loose.dtd">
-<!-- saved from url=(0044)http://www.eclipse.org/legal/epl/notice.html -->
-<HTML><HEAD><TITLE>Eclipse.org Software User Agreement</TITLE>
-<META http-equiv=Content-Type content="text/html; charset=iso-8859-1">
-<META content="MSHTML 6.00.2800.1479" name=GENERATOR></HEAD>
-<BODY lang=EN-US vLink=purple link=blue>
-<H2>Eclipse Foundation Software User Agreement</H2>
-<P>June 06, 2007</P>
-<H3>Usage Of Content</H3>
-<P>THE ECLIPSE FOUNDATION MAKES AVAILABLE SOFTWARE, DOCUMENTATION, INFORMATION
-AND/OR OTHER MATERIALS FOR OPEN SOURCE PROJECTS (COLLECTIVELY "CONTENT"). USE OF
-THE CONTENT IS GOVERNED BY THE TERMS AND CONDITIONS OF THIS AGREEMENT AND/OR THE
-TERMS AND CONDITIONS OF LICENSE AGREEMENTS OR NOTICES INDICATED OR REFERENCED
-BELOW. BY USING THE CONTENT, YOU AGREE THAT YOUR USE OF THE CONTENT IS GOVERNED
-BY THIS AGREEMENT AND/OR THE TERMS AND CONDITIONS OF ANY APPLICABLE LICENSE
-AGREEMENTS OR NOTICES INDICATED OR REFERENCED BELOW. IF YOU DO NOT AGREE TO THE
-TERMS AND CONDITIONS OF THIS AGREEMENT AND THE TERMS AND CONDITIONS OF ANY
-APPLICABLE LICENSE AGREEMENTS OR NOTICES INDICATED OR REFERENCED BELOW, THEN YOU
-MAY NOT USE THE CONTENT.</P>
-<H3>Applicable Licenses</H3>
-<P>Unless otherwise indicated, all Content made available by the Eclipse
-Foundation is provided to you under the terms and conditions of the Eclipse
-Public License Version 1.0 ("EPL"). A copy of the EPL is provided with this
-Content and is also available at <A
-href="http://www.eclipse.org/legal/epl-v10.html">http://www.eclipse.org/legal/epl-v10.html</A>.
-For purposes of the EPL, "Program" will mean the Content.</P>
-<P>Content includes, but is not limited to, source code, object code,
-documentation and other files maintained in the Eclipse.org CVS repository
-("Repository") in CVS modules ("Modules") and made available as downloadable
-archives ("Downloads").</P>
-<P>Content may be apportioned into plug-ins ("Plug-ins"), plug-in fragments
-("Fragments"), and features ("Features"). A Feature is a bundle of one or more
-Plug-ins and/or Fragments and associated material. Files named "feature.xml" may
-contain a list of the names and version numbers of the Plug-ins and/or Fragments
-associated with a Feature. Plug-ins and Fragments are located in directories
-named "plugins" and Features are located in directories named "features".</P>
-<P>Features may also include other Features ("Included Features"). Files named
-"feature.xml" may contain a list of the names and version numbers of Included
-Features.</P>
-<P>The terms and conditions governing Plug-ins and Fragments should be contained
-in files named "about.html" ("Abouts"). The terms and conditions governing
-Features and Included Features should be contained in files named "license.html"
-("Feature Licenses"). Abouts and Feature Licenses may be located in any
-directory of a Download or Module including, but not limited to the following
-locations:</P>
-<UL>
- <LI>The top-level (root) directory
- <LI>Plug-in and Fragment directories
- <LI>Subdirectories of the directory named "src" of certain Plug-ins
- <LI>Feature directories </LI></UL>
-<P>Note: if a Feature made available by the Eclipse Foundation is installed
-using the Eclipse Update Manager, you must agree to a license ("Feature Update
-License") during the installation process. If the Feature contains Included
-Features, the Feature Update License should either provide you with the terms
-and conditions governing the Included Features or inform you where you can
-locate them. Feature Update Licenses may be found in the "license" property of
-files named "feature.properties". Such Abouts, Feature Licenses and Feature
-Update Licenses contain the terms and conditions (or references to such terms
-and conditions) that govern your use of the associated Content in that
-directory.</P>
-<P>THE ABOUTS, FEATURE LICENSES AND FEATURE UPDATE LICENSES MAY REFER TO THE EPL
-OR OTHER LICENSE AGREEMENTS, NOTICES OR TERMS AND CONDITIONS. SOME OF THESE
-OTHER LICENSE AGREEMENTS MAY INCLUDE (BUT ARE NOT LIMITED TO):</P>
-<UL>
- <LI>Common Public License Version 1.0 (available at <A
- href="http://www.eclipse.org/legal/cpl-v10.html">http://www.eclipse.org/legal/cpl-v10.html</A>)
-
- <LI>Apache Software License 1.1 (available at <A
- href="http://www.apache.org/licenses/LICENSE">http://www.apache.org/licenses/LICENSE</A>)
-
- <LI>Apache Software License 2.0 (available at <A
- href="http://www.apache.org/licenses/LICENSE-2.0">http://www.apache.org/licenses/LICENSE-2.0</A>)
-
- <LI>IBM Public License 1.0 (available at <A
- href="http://oss.software.ibm.com/developerworks/opensource/license10.html">http://oss.software.ibm.com/developerworks/opensource/license10.html</A>)
-
- <LI>Metro Link Public License 1.00 (available at <A
- href="http://www.opengroup.org/openmotif/supporters/metrolink/license.html">http://www.opengroup.org/openmotif/supporters/metrolink/license.html</A>)
-
- <LI>Mozilla Public License Version 1.1 (available at <A
- href="http://www.mozilla.org/MPL/MPL-1.1.html">http://www.mozilla.org/MPL/MPL-1.1.html</A>)
- </LI>
-
- <LI>Common Development and Distribution License (CDDL) Version 1.0 (available at <A
- href="http://www.sun.com/cddl/cddl.html">http://www.sun.com/cddl/cddl.html)</A>
- </LI>
-</UL>
-<P>IT IS YOUR OBLIGATION TO READ AND ACCEPT ALL SUCH TERMS AND CONDITIONS PRIOR
-TO USE OF THE CONTENT. If no About, Feature License or Feature Update License is
-provided, please contact the Eclipse Foundation to determine what terms and
-conditions govern that particular Content.</P>
-<H3>Cryptography</H3>
-<P>Content may contain encryption software. The country in which you are
-currently may have restrictions on the import, possession, and use, and/or
-re-export to another country, of encryption software. BEFORE using any
-encryption software, please check the country's laws, regulations and policies
-concerning the import, possession, or use, and re-export of encryption software,
-to see if this is permitted.</P></BODY></HTML>
diff --git a/jpa/plugins/org.eclipse.jpt.branding/.cvsignore b/jpa/plugins/org.eclipse.jpt.branding/.cvsignore
deleted file mode 100644
index c9401a2c83..0000000000
--- a/jpa/plugins/org.eclipse.jpt.branding/.cvsignore
+++ /dev/null
@@ -1,2 +0,0 @@
-build.xml
-org.eclipse.jpt_1.0.0.* \ No newline at end of file
diff --git a/jpa/plugins/org.eclipse.jpt.branding/.project b/jpa/plugins/org.eclipse.jpt.branding/.project
deleted file mode 100644
index e1a9beda8b..0000000000
--- a/jpa/plugins/org.eclipse.jpt.branding/.project
+++ /dev/null
@@ -1,22 +0,0 @@
-<?xml version="1.0" encoding="UTF-8"?>
-<projectDescription>
- <name>org.eclipse.jpt.branding</name>
- <comment></comment>
- <projects>
- </projects>
- <buildSpec>
- <buildCommand>
- <name>org.eclipse.pde.ManifestBuilder</name>
- <arguments>
- </arguments>
- </buildCommand>
- <buildCommand>
- <name>org.eclipse.pde.SchemaBuilder</name>
- <arguments>
- </arguments>
- </buildCommand>
- </buildSpec>
- <natures>
- <nature>org.eclipse.pde.PluginNature</nature>
- </natures>
-</projectDescription>
diff --git a/jpa/plugins/org.eclipse.jpt.branding/.settings/org.eclipse.core.resources.prefs b/jpa/plugins/org.eclipse.jpt.branding/.settings/org.eclipse.core.resources.prefs
deleted file mode 100644
index 4aec29d1cd..0000000000
--- a/jpa/plugins/org.eclipse.jpt.branding/.settings/org.eclipse.core.resources.prefs
+++ /dev/null
@@ -1,3 +0,0 @@
-#Sun May 27 15:10:09 EDT 2007
-eclipse.preferences.version=1
-encoding/<project>=ISO-8859-1
diff --git a/jpa/plugins/org.eclipse.jpt.branding/META-INF/MANIFEST.MF b/jpa/plugins/org.eclipse.jpt.branding/META-INF/MANIFEST.MF
deleted file mode 100644
index 743617c6d4..0000000000
--- a/jpa/plugins/org.eclipse.jpt.branding/META-INF/MANIFEST.MF
+++ /dev/null
@@ -1,7 +0,0 @@
-Manifest-Version: 1.0
-Bundle-ManifestVersion: 2
-Bundle-Name: %pluginName
-Bundle-SymbolicName: org.eclipse.jpt.branding;singleton:=true
-Bundle-Version: 2.2.0.qualifier
-Bundle-Localization: plugin
-Bundle-Vendor: %providerName
diff --git a/jpa/plugins/org.eclipse.jpt.branding/about.html b/jpa/plugins/org.eclipse.jpt.branding/about.html
deleted file mode 100644
index ca606b1bb5..0000000000
--- a/jpa/plugins/org.eclipse.jpt.branding/about.html
+++ /dev/null
@@ -1,34 +0,0 @@
-<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.0//EN">
-<HTML>
-
-<head>
-<title>About</title>
-<meta http-equiv=Content-Type content="text/html; charset=ISO-8859-1">
-</head>
-
-<BODY lang="EN-US">
-
-<H3>About This Content</H3>
-
-<P>June 06, 2007</P>
-
-<H3>License</H3>
-
-<P>The Eclipse Foundation makes available all content in this plug-in
-("Content"). Unless otherwise indicated below, the Content is provided to you
-under the terms and conditions of the Eclipse Public License Version 1.0
-("EPL"). A copy of the EPL is available at
-<A href="http://www.eclipse.org/org/documents/epl-v10.php">http://www.eclipse.org/org/documents/epl-v10.php</A>.
-For purposes of the EPL, "Program" will mean the Content.</P>
-
-<P>If you did not receive this Content directly from the Eclipse Foundation, the
-Content is being redistributed by another party ("Redistributor") and different
-terms and conditions may apply to your use of any object code in the Content.
-Check the Redistributor's license that was provided with the Content. If no such
-license exists, contact the Redistributor. Unless otherwise indicated below, the
-terms and conditions of the EPL still apply to any source code in the Content
-and such source code may be obtained at
-<A href="http://www.eclipse.org/">http://www.eclipse.org/</A>.</P>
-
-</BODY>
-</HTML> \ No newline at end of file
diff --git a/jpa/plugins/org.eclipse.jpt.branding/about.ini b/jpa/plugins/org.eclipse.jpt.branding/about.ini
deleted file mode 100644
index 7d88b9d396..0000000000
--- a/jpa/plugins/org.eclipse.jpt.branding/about.ini
+++ /dev/null
@@ -1,44 +0,0 @@
-###############################################################################
-# Copyright (c) 2006, 2009 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
-#
-# Contributors:
-# Oracle. - initial API and implementation
-###############################################################################
-
-# about.ini
-# contains information about a feature
-# java.io.Properties file (ISO 8859-1 with "\" escapes)
-# "%key" are externalized strings defined in about.properties
-# This file does not need to be translated.
-
-# Property "aboutText" contains blurb for "About" dialog (translated)
-aboutText=%blurb
-
-# Property "windowImage" contains path to window icon (16x16)
-# needed for primary features only
-
-# Property "featureImage" contains path to feature image (32x32)
-featureImage=icons/WTP_icon_x32_v2.png
-
-# Property "aboutImage" contains path to product image (500x330 or 115x164)
-# needed for primary features only
-
-# Property "appName" contains name of the application (translated)
-# needed for primary features only
-
-# Property "welcomePage" contains path to welcome page (special XML-based format)
-# optional
-
-# Property "welcomePerspective" contains the id of the perspective in which the
-# welcome page is to be opened.
-# optional
-
-# Property "tipsAndTricksHref" contains the Help topic href to a tips and tricks page
-# optional
-tipsAndTricksHref=/org.eclipse.jpt.doc.user/tips_and_tricks.htm
-
-
diff --git a/jpa/plugins/org.eclipse.jpt.branding/about.mappings b/jpa/plugins/org.eclipse.jpt.branding/about.mappings
deleted file mode 100644
index bddaab4310..0000000000
--- a/jpa/plugins/org.eclipse.jpt.branding/about.mappings
+++ /dev/null
@@ -1,6 +0,0 @@
-# about.mappings
-# contains fill-ins for about.properties
-# java.io.Properties file (ISO 8859-1 with "\" escapes)
-# This file does not need to be translated.
-
-0=@build@ \ No newline at end of file
diff --git a/jpa/plugins/org.eclipse.jpt.branding/about.properties b/jpa/plugins/org.eclipse.jpt.branding/about.properties
deleted file mode 100644
index 4b821e2ac7..0000000000
--- a/jpa/plugins/org.eclipse.jpt.branding/about.properties
+++ /dev/null
@@ -1,24 +0,0 @@
-###############################################################################
-# Copyright (c) 2006, 2009 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
-#
-# Contributors:
-# Oracle. - initial API and implementation
-###############################################################################
-
-# about.properties
-# contains externalized strings for about.ini
-# java.io.Properties file (ISO 8859-1 with "\" escapes)
-# fill-ins are supplied by about.mappings
-# This file should be translated.
-
-blurb=Dali Java Persistence Tools\n\
-\n\
-Version: {featureVersion}\n\
-Build id: {0}\n\
-\n\
-(c) Copyright Oracle contributors and others 2006, 2009. All rights reserved.\n\
-Visit http://www.eclipse.org/webtools
diff --git a/jpa/plugins/org.eclipse.jpt.branding/build.properties b/jpa/plugins/org.eclipse.jpt.branding/build.properties
deleted file mode 100644
index 4e089bbd76..0000000000
--- a/jpa/plugins/org.eclipse.jpt.branding/build.properties
+++ /dev/null
@@ -1,18 +0,0 @@
-###############################################################################
-# Copyright (c) 2006, 2009 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
-#
-# Contributors:
-# Oracle. - initial API and implementation
-###############################################################################
-bin.includes = META-INF/,\
- about.ini,\
- about.html,\
- about.mappings,\
- about.properties,\
- icons/,\
- plugin.properties,\
- component.xml
diff --git a/jpa/plugins/org.eclipse.jpt.branding/component.xml b/jpa/plugins/org.eclipse.jpt.branding/component.xml
deleted file mode 100644
index ce301ae210..0000000000
--- a/jpa/plugins/org.eclipse.jpt.branding/component.xml
+++ /dev/null
@@ -1,12 +0,0 @@
-<?xml version="1.0" encoding="UTF-8"?>
-<component xmlns="http://eclipse.org/wtp/releng/tools/component-model" name="org.eclipse.jpt.branding">
-<description url=""></description>
-<component-depends unrestricted="true"></component-depends>
-<plugin id="org.eclipse.jpt.branding" fragment="false"/>
-<plugin id="org.eclipse.jpt.core" fragment="false"/>
-<plugin id="org.eclipse.jpt.db" fragment="false"/>
-<plugin id="org.eclipse.jpt.db.ui" fragment="false"/>
-<plugin id="org.eclipse.jpt.gen" fragment="false"/>
-<plugin id="org.eclipse.jpt.ui" fragment="false"/>
-<plugin id="org.eclipse.jpt.utility" fragment="false"/>
-</component> \ No newline at end of file
diff --git a/jpa/plugins/org.eclipse.jpt.branding/icons/WTP_icon_x32_v2.png b/jpa/plugins/org.eclipse.jpt.branding/icons/WTP_icon_x32_v2.png
deleted file mode 100644
index 6f09c2a700..0000000000
--- a/jpa/plugins/org.eclipse.jpt.branding/icons/WTP_icon_x32_v2.png
+++ /dev/null
Binary files differ
diff --git a/jpa/plugins/org.eclipse.jpt.branding/plugin.properties b/jpa/plugins/org.eclipse.jpt.branding/plugin.properties
deleted file mode 100644
index 0cadd22a37..0000000000
--- a/jpa/plugins/org.eclipse.jpt.branding/plugin.properties
+++ /dev/null
@@ -1,13 +0,0 @@
-###############################################################################
-# Copyright (c) 2006, 2009 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
-#
-# Contributors:
-# Oracle. - initial API and implementation
-###############################################################################
-
-pluginName = Dali Java Persistence Tools
-providerName = Eclipse Web Tools Platform
diff --git a/jpa/plugins/org.eclipse.jpt.db.ui/.classpath b/jpa/plugins/org.eclipse.jpt.db.ui/.classpath
deleted file mode 100644
index 304e86186a..0000000000
--- a/jpa/plugins/org.eclipse.jpt.db.ui/.classpath
+++ /dev/null
@@ -1,7 +0,0 @@
-<?xml version="1.0" encoding="UTF-8"?>
-<classpath>
- <classpathentry kind="src" path="src"/>
- <classpathentry kind="con" path="org.eclipse.jdt.launching.JRE_CONTAINER/org.eclipse.jdt.internal.debug.ui.launcher.StandardVMType/J2SE-1.5"/>
- <classpathentry kind="con" path="org.eclipse.pde.core.requiredPlugins"/>
- <classpathentry kind="output" path="bin"/>
-</classpath>
diff --git a/jpa/plugins/org.eclipse.jpt.db.ui/.cvsignore b/jpa/plugins/org.eclipse.jpt.db.ui/.cvsignore
deleted file mode 100644
index a196dd7686..0000000000
--- a/jpa/plugins/org.eclipse.jpt.db.ui/.cvsignore
+++ /dev/null
@@ -1,6 +0,0 @@
-bin
-@dot
-temp.folder
-build.xml
-javaCompiler...args
-javaCompiler...args.* \ No newline at end of file
diff --git a/jpa/plugins/org.eclipse.jpt.db.ui/.project b/jpa/plugins/org.eclipse.jpt.db.ui/.project
deleted file mode 100644
index 88ea5da610..0000000000
--- a/jpa/plugins/org.eclipse.jpt.db.ui/.project
+++ /dev/null
@@ -1,28 +0,0 @@
-<?xml version="1.0" encoding="UTF-8"?>
-<projectDescription>
- <name>org.eclipse.jpt.db.ui</name>
- <comment></comment>
- <projects>
- </projects>
- <buildSpec>
- <buildCommand>
- <name>org.eclipse.jdt.core.javabuilder</name>
- <arguments>
- </arguments>
- </buildCommand>
- <buildCommand>
- <name>org.eclipse.pde.ManifestBuilder</name>
- <arguments>
- </arguments>
- </buildCommand>
- <buildCommand>
- <name>org.eclipse.pde.SchemaBuilder</name>
- <arguments>
- </arguments>
- </buildCommand>
- </buildSpec>
- <natures>
- <nature>org.eclipse.pde.PluginNature</nature>
- <nature>org.eclipse.jdt.core.javanature</nature>
- </natures>
-</projectDescription>
diff --git a/jpa/plugins/org.eclipse.jpt.db.ui/.settings/org.eclipse.core.resources.prefs b/jpa/plugins/org.eclipse.jpt.db.ui/.settings/org.eclipse.core.resources.prefs
deleted file mode 100644
index 8fa7db1fac..0000000000
--- a/jpa/plugins/org.eclipse.jpt.db.ui/.settings/org.eclipse.core.resources.prefs
+++ /dev/null
@@ -1,3 +0,0 @@
-#Tue Jan 15 11:11:22 EST 2008
-eclipse.preferences.version=1
-encoding/<project>=ISO-8859-1
diff --git a/jpa/plugins/org.eclipse.jpt.db.ui/.settings/org.eclipse.jdt.core.prefs b/jpa/plugins/org.eclipse.jpt.db.ui/.settings/org.eclipse.jdt.core.prefs
deleted file mode 100644
index 842c286bb1..0000000000
--- a/jpa/plugins/org.eclipse.jpt.db.ui/.settings/org.eclipse.jdt.core.prefs
+++ /dev/null
@@ -1,7 +0,0 @@
-#Sun May 27 14:59:42 EDT 2007
-eclipse.preferences.version=1
-org.eclipse.jdt.core.compiler.codegen.targetPlatform=1.5
-org.eclipse.jdt.core.compiler.compliance=1.5
-org.eclipse.jdt.core.compiler.problem.assertIdentifier=error
-org.eclipse.jdt.core.compiler.problem.enumIdentifier=error
-org.eclipse.jdt.core.compiler.source=1.5
diff --git a/jpa/plugins/org.eclipse.jpt.db.ui/META-INF/MANIFEST.MF b/jpa/plugins/org.eclipse.jpt.db.ui/META-INF/MANIFEST.MF
deleted file mode 100644
index 7492bb6f66..0000000000
--- a/jpa/plugins/org.eclipse.jpt.db.ui/META-INF/MANIFEST.MF
+++ /dev/null
@@ -1,15 +0,0 @@
-Manifest-Version: 1.0
-Bundle-ManifestVersion: 2
-Bundle-Name: %pluginName
-Bundle-Vendor: %providerName
-Bundle-SymbolicName: org.eclipse.jpt.db.ui
-Bundle-Version: 1.1.100.qualifier
-Bundle-ClassPath: .
-Bundle-Localization: plugin
-Export-Package: org.eclipse.jpt.db.ui.internal; x-friends:="org.eclipse.jpt.ui"
-Require-Bundle: org.eclipse.ui;bundle-version="[3.4.0,4.0.0)",
- org.eclipse.jpt.db;bundle-version="[1.2.0,2.0.0)",
- org.eclipse.datatools.connectivity.ui;bundle-version="[1.1.0,1.2.0)",
- org.eclipse.datatools.sqltools.editor.core;bundle-version="[1.0.0,2.0.0)",
- org.eclipse.datatools.connectivity.db.generic.ui;bundle-version="[1.0.1,2.0.0)"
-Bundle-RequiredExecutionEnvironment: J2SE-1.5
diff --git a/jpa/plugins/org.eclipse.jpt.db.ui/about.html b/jpa/plugins/org.eclipse.jpt.db.ui/about.html
deleted file mode 100644
index be534ba44f..0000000000
--- a/jpa/plugins/org.eclipse.jpt.db.ui/about.html
+++ /dev/null
@@ -1,34 +0,0 @@
-<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.0//EN">
-<HTML>
-
-<head>
-<title>About</title>
-<meta http-equiv=Content-Type content="text/html; charset=ISO-8859-1">
-</head>
-
-<BODY lang="EN-US">
-
-<H3>About This Content</H3>
-
-<P>May 02, 2008</P>
-
-<H3>License</H3>
-
-<P>The Eclipse Foundation makes available all content in this plug-in
-("Content"). Unless otherwise indicated below, the Content is provided to you
-under the terms and conditions of the Eclipse Public License Version 1.0
-("EPL"). A copy of the EPL is available at
-<A href="http://www.eclipse.org/org/documents/epl-v10.php">http://www.eclipse.org/org/documents/epl-v10.php</A>.
-For purposes of the EPL, "Program" will mean the Content.</P>
-
-<P>If you did not receive this Content directly from the Eclipse Foundation, the
-Content is being redistributed by another party ("Redistributor") and different
-terms and conditions may apply to your use of any object code in the Content.
-Check the Redistributor's license that was provided with the Content. If no such
-license exists, contact the Redistributor. Unless otherwise indicated below, the
-terms and conditions of the EPL still apply to any source code in the Content
-and such source code may be obtained at
-<A href="http://www.eclipse.org/">http://www.eclipse.org/</A>.</P>
-
-</BODY>
-</HTML>
diff --git a/jpa/plugins/org.eclipse.jpt.db.ui/build.properties b/jpa/plugins/org.eclipse.jpt.db.ui/build.properties
deleted file mode 100644
index 0d56981f21..0000000000
--- a/jpa/plugins/org.eclipse.jpt.db.ui/build.properties
+++ /dev/null
@@ -1,17 +0,0 @@
-###############################################################################
-# Copyright (c) 2006, 2007 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
-#
-# Contributors:
-# Oracle. - initial API and implementation
-###############################################################################
-source.. = src/
-output.. = bin/
-bin.includes = .,\
- META-INF/,\
- about.html,\
- plugin.properties
-jars.compile.order = .
diff --git a/jpa/plugins/org.eclipse.jpt.db.ui/component.xml b/jpa/plugins/org.eclipse.jpt.db.ui/component.xml
deleted file mode 100644
index bf648aaa4f..0000000000
--- a/jpa/plugins/org.eclipse.jpt.db.ui/component.xml
+++ /dev/null
@@ -1 +0,0 @@
-<?xml version="1.0" encoding="UTF-8"?><component xmlns="http://eclipse.org/wtp/releng/tools/component-model" name="org.eclipse.jpt.db.ui"><description url=""></description><component-depends unrestricted="true"></component-depends><plugin id="org.eclipse.jpt.db.ui" fragment="false"/></component> \ No newline at end of file
diff --git a/jpa/plugins/org.eclipse.jpt.db.ui/plugin.properties b/jpa/plugins/org.eclipse.jpt.db.ui/plugin.properties
deleted file mode 100644
index eb7c17a143..0000000000
--- a/jpa/plugins/org.eclipse.jpt.db.ui/plugin.properties
+++ /dev/null
@@ -1,25 +0,0 @@
-###############################################################################
-# Copyright (c) 2006 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
-#
-# Contributors:
-# Oracle. - initial API and implementation
-###############################################################################
-# ====================================================================
-# To code developer:
-# Do NOT change the properties between this line and the
-# "%%% END OF TRANSLATED PROPERTIES %%%" line.
-# Make a new property name, append to the end of the file and change
-# the code to use the new property.
-# ====================================================================
-
-# ====================================================================
-# %%% END OF TRANSLATED PROPERTIES %%%
-# ====================================================================
-
-pluginName = Dali Java Persistence Tools - DB UI
-providerName = Eclipse Web Tools Platform
-
diff --git a/jpa/plugins/org.eclipse.jpt.db.ui/src/org/eclipse/jpt/db/ui/internal/DTPUiTools.java b/jpa/plugins/org.eclipse.jpt.db.ui/src/org/eclipse/jpt/db/ui/internal/DTPUiTools.java
deleted file mode 100644
index 9a2b81e5cc..0000000000
--- a/jpa/plugins/org.eclipse.jpt.db.ui/src/org/eclipse/jpt/db/ui/internal/DTPUiTools.java
+++ /dev/null
@@ -1,106 +0,0 @@
-/*******************************************************************************
-* Copyright (c) 2007, 2008 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.
-*
-* Contributors:
-* Oracle - initial API and implementation
-*******************************************************************************/
-package org.eclipse.jpt.db.ui.internal;
-
-import org.eclipse.datatools.connectivity.IConnectionProfile;
-import org.eclipse.datatools.connectivity.IProfileListener;
-import org.eclipse.datatools.connectivity.ProfileManager;
-import org.eclipse.datatools.connectivity.db.generic.ui.wizard.NewJDBCFilteredCPWizard;
-import org.eclipse.jface.window.Window;
-import org.eclipse.jface.wizard.WizardDialog;
-import org.eclipse.swt.widgets.Display;
-
-/**
- * DTP UI tools
- */
-public class DTPUiTools {
-
- /**
- * Launch the DTP New Connection Profile wizard to create a new database connection profile.
- *
- * Returns the name of the added profile, or null if the wizard was cancelled.
- * The name can be used to build a Dali connection profile from
- * JptDbPlugin.getConnectionProfileFactory().buildConnectionProfile(String).
- */
- public static String createNewConnectionProfile() {
- // Filter datasource category
- NewJDBCFilteredCPWizard wizard = new NewJDBCFilteredCPWizard();
- WizardDialog wizardDialog = new WizardDialog(Display.getCurrent().getActiveShell(), wizard);
- wizardDialog.setBlockOnOpen(true);
-
- LocalProfileListener listener = new LocalProfileListener();
- ProfileManager.getInstance().addProfileListener(listener);
-
- String newCPName = null;
- if (wizardDialog.open() == Window.OK) {
- // assume the last added profile is the one we want
- newCPName = listener.addedProfile.getName();
- }
- ProfileManager.getInstance().removeProfileListener(listener);
-
- return newCPName;
- }
-
-
- // ********** DTP profile listener **********
-
- /**
- * This listener simply holds on to the most recently added connection
- * profile.
- */
- static class LocalProfileListener implements IProfileListener {
- IConnectionProfile addedProfile;
-
- public void profileAdded(IConnectionProfile profile) {
- this.addedProfile = profile;
- }
-
- public void profileChanged(IConnectionProfile profile) {
- // do nothing
- }
-
- public void profileDeleted(IConnectionProfile profile) {
- // do nothing
- }
- }
-
-
-// // ********** viewer filter **********
-//
-// static class LocalViewerFilter extends ViewerFilter {
-//
-// private static final String DATABASE_CATEGORY_ID = "org.eclipse.datatools.connectivity.db.category"; //$NON-NLS-1$
-//
-// LocalViewerFilter() {
-// super();
-// }
-//
-// @Override
-// public boolean select(Viewer viewer, Object parentElement, Object element) {
-// CPWizardNode wizardNode = (CPWizardNode) element;
-// IProfileWizardProvider wizardProvider = wizardNode.getProvider();
-// if (wizardProvider instanceof IWizardCategoryProvider) {
-// return false;
-// }
-// ICategory category = ConnectionProfileManager.getInstance().getProvider(
-// ((ProfileWizardProvider) wizardProvider).getProfile()).getCategory();
-//
-// // Only display wizards belong to database category
-// while (category != null) {
-// if (category.getId().equals(DATABASE_CATEGORY_ID)) {
-// return true;
-// }
-// category = category.getParent();
-// }
-// return false;
-// }
-// }
-
-}
diff --git a/jpa/plugins/org.eclipse.jpt.db/.classpath b/jpa/plugins/org.eclipse.jpt.db/.classpath
deleted file mode 100644
index 304e86186a..0000000000
--- a/jpa/plugins/org.eclipse.jpt.db/.classpath
+++ /dev/null
@@ -1,7 +0,0 @@
-<?xml version="1.0" encoding="UTF-8"?>
-<classpath>
- <classpathentry kind="src" path="src"/>
- <classpathentry kind="con" path="org.eclipse.jdt.launching.JRE_CONTAINER/org.eclipse.jdt.internal.debug.ui.launcher.StandardVMType/J2SE-1.5"/>
- <classpathentry kind="con" path="org.eclipse.pde.core.requiredPlugins"/>
- <classpathentry kind="output" path="bin"/>
-</classpath>
diff --git a/jpa/plugins/org.eclipse.jpt.db/.cvsignore b/jpa/plugins/org.eclipse.jpt.db/.cvsignore
deleted file mode 100644
index a196dd7686..0000000000
--- a/jpa/plugins/org.eclipse.jpt.db/.cvsignore
+++ /dev/null
@@ -1,6 +0,0 @@
-bin
-@dot
-temp.folder
-build.xml
-javaCompiler...args
-javaCompiler...args.* \ No newline at end of file
diff --git a/jpa/plugins/org.eclipse.jpt.db/.project b/jpa/plugins/org.eclipse.jpt.db/.project
deleted file mode 100644
index 5675a48e3a..0000000000
--- a/jpa/plugins/org.eclipse.jpt.db/.project
+++ /dev/null
@@ -1,28 +0,0 @@
-<?xml version="1.0" encoding="UTF-8"?>
-<projectDescription>
- <name>org.eclipse.jpt.db</name>
- <comment></comment>
- <projects>
- </projects>
- <buildSpec>
- <buildCommand>
- <name>org.eclipse.jdt.core.javabuilder</name>
- <arguments>
- </arguments>
- </buildCommand>
- <buildCommand>
- <name>org.eclipse.pde.ManifestBuilder</name>
- <arguments>
- </arguments>
- </buildCommand>
- <buildCommand>
- <name>org.eclipse.pde.SchemaBuilder</name>
- <arguments>
- </arguments>
- </buildCommand>
- </buildSpec>
- <natures>
- <nature>org.eclipse.pde.PluginNature</nature>
- <nature>org.eclipse.jdt.core.javanature</nature>
- </natures>
-</projectDescription>
diff --git a/jpa/plugins/org.eclipse.jpt.db/.settings/org.eclipse.core.resources.prefs b/jpa/plugins/org.eclipse.jpt.db/.settings/org.eclipse.core.resources.prefs
deleted file mode 100644
index 84ebb5c739..0000000000
--- a/jpa/plugins/org.eclipse.jpt.db/.settings/org.eclipse.core.resources.prefs
+++ /dev/null
@@ -1,3 +0,0 @@
-#Tue Jan 15 11:11:02 EST 2008
-eclipse.preferences.version=1
-encoding/<project>=ISO-8859-1
diff --git a/jpa/plugins/org.eclipse.jpt.db/.settings/org.eclipse.jdt.core.prefs b/jpa/plugins/org.eclipse.jpt.db/.settings/org.eclipse.jdt.core.prefs
deleted file mode 100644
index 929d54536d..0000000000
--- a/jpa/plugins/org.eclipse.jpt.db/.settings/org.eclipse.jdt.core.prefs
+++ /dev/null
@@ -1,7 +0,0 @@
-#Sun May 27 14:59:18 EDT 2007
-eclipse.preferences.version=1
-org.eclipse.jdt.core.compiler.codegen.targetPlatform=1.5
-org.eclipse.jdt.core.compiler.compliance=1.5
-org.eclipse.jdt.core.compiler.problem.assertIdentifier=error
-org.eclipse.jdt.core.compiler.problem.enumIdentifier=error
-org.eclipse.jdt.core.compiler.source=1.5
diff --git a/jpa/plugins/org.eclipse.jpt.db/META-INF/MANIFEST.MF b/jpa/plugins/org.eclipse.jpt.db/META-INF/MANIFEST.MF
deleted file mode 100644
index 19b127c829..0000000000
--- a/jpa/plugins/org.eclipse.jpt.db/META-INF/MANIFEST.MF
+++ /dev/null
@@ -1,20 +0,0 @@
-Manifest-Version: 1.0
-Bundle-ManifestVersion: 2
-Bundle-Name: %pluginName
-Bundle-Vendor: %providerName
-Bundle-SymbolicName: org.eclipse.jpt.db
-Bundle-Version: 1.2.100.qualifier
-Bundle-Activator: org.eclipse.jpt.db.JptDbPlugin
-Bundle-ActivationPolicy: lazy
-Bundle-ClassPath: .
-Bundle-Localization: plugin
-Bundle-RequiredExecutionEnvironment: J2SE-1.5
-Require-Bundle: org.eclipse.core.runtime;bundle-version="[3.4.0,4.0.0)",
- org.eclipse.datatools.enablement.jdt.classpath;bundle-version="[1.0.1,2.0.0)",
- org.eclipse.datatools.sqltools.editor.core;bundle-version="[1.0.0,2.0.0)",
- org.eclipse.jdt.core;bundle-version="[3.4.0,4.0.0)",
- org.eclipse.jpt.utility;bundle-version="[1.2.0,2.0.0)"
-Export-Package: org.eclipse.jpt.db,
- org.eclipse.jpt.db.internal;x-internal:=true,
- org.eclipse.jpt.db.internal.vendor;x-internal:=true
-Import-Package: com.ibm.icu.text;version="4.0.1"
diff --git a/jpa/plugins/org.eclipse.jpt.db/about.html b/jpa/plugins/org.eclipse.jpt.db/about.html
deleted file mode 100644
index be534ba44f..0000000000
--- a/jpa/plugins/org.eclipse.jpt.db/about.html
+++ /dev/null
@@ -1,34 +0,0 @@
-<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.0//EN">
-<HTML>
-
-<head>
-<title>About</title>
-<meta http-equiv=Content-Type content="text/html; charset=ISO-8859-1">
-</head>
-
-<BODY lang="EN-US">
-
-<H3>About This Content</H3>
-
-<P>May 02, 2008</P>
-
-<H3>License</H3>
-
-<P>The Eclipse Foundation makes available all content in this plug-in
-("Content"). Unless otherwise indicated below, the Content is provided to you
-under the terms and conditions of the Eclipse Public License Version 1.0
-("EPL"). A copy of the EPL is available at
-<A href="http://www.eclipse.org/org/documents/epl-v10.php">http://www.eclipse.org/org/documents/epl-v10.php</A>.
-For purposes of the EPL, "Program" will mean the Content.</P>
-
-<P>If you did not receive this Content directly from the Eclipse Foundation, the
-Content is being redistributed by another party ("Redistributor") and different
-terms and conditions may apply to your use of any object code in the Content.
-Check the Redistributor's license that was provided with the Content. If no such
-license exists, contact the Redistributor. Unless otherwise indicated below, the
-terms and conditions of the EPL still apply to any source code in the Content
-and such source code may be obtained at
-<A href="http://www.eclipse.org/">http://www.eclipse.org/</A>.</P>
-
-</BODY>
-</HTML>
diff --git a/jpa/plugins/org.eclipse.jpt.db/build.properties b/jpa/plugins/org.eclipse.jpt.db/build.properties
deleted file mode 100644
index 974eadac6b..0000000000
--- a/jpa/plugins/org.eclipse.jpt.db/build.properties
+++ /dev/null
@@ -1,19 +0,0 @@
-###############################################################################
-# Copyright (c) 2006, 2007 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
-#
-# Contributors:
-# Oracle. - initial API and implementation
-###############################################################################
-javacSource=1.5
-javacTarget=1.5
-source.. = src/
-output.. = bin/
-bin.includes = .,\
- META-INF/,\
- about.html,\
- plugin.properties
-jars.compile.order = .
diff --git a/jpa/plugins/org.eclipse.jpt.db/component.xml b/jpa/plugins/org.eclipse.jpt.db/component.xml
deleted file mode 100644
index 644c396149..0000000000
--- a/jpa/plugins/org.eclipse.jpt.db/component.xml
+++ /dev/null
@@ -1 +0,0 @@
-<?xml version="1.0" encoding="UTF-8"?><component xmlns="http://eclipse.org/wtp/releng/tools/component-model" name="org.eclipse.jpt.db"><description url=""></description><component-depends unrestricted="true"></component-depends><plugin id="org.eclipse.jpt.db" fragment="false"/></component> \ No newline at end of file
diff --git a/jpa/plugins/org.eclipse.jpt.db/plugin.properties b/jpa/plugins/org.eclipse.jpt.db/plugin.properties
deleted file mode 100644
index c334a30550..0000000000
--- a/jpa/plugins/org.eclipse.jpt.db/plugin.properties
+++ /dev/null
@@ -1,25 +0,0 @@
-###############################################################################
-# Copyright (c) 2006 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
-#
-# Contributors:
-# Oracle. - initial API and implementation
-###############################################################################
-# ====================================================================
-# To code developer:
-# Do NOT change the properties between this line and the
-# "%%% END OF TRANSLATED PROPERTIES %%%" line.
-# Make a new property name, append to the end of the file and change
-# the code to use the new property.
-# ====================================================================
-
-# ====================================================================
-# %%% END OF TRANSLATED PROPERTIES %%%
-# ====================================================================
-
-pluginName = Dali Java Persistence Tools - DB
-providerName = Eclipse Web Tools Platform
-
diff --git a/jpa/plugins/org.eclipse.jpt.db/src/org/eclipse/jpt/db/Catalog.java b/jpa/plugins/org.eclipse.jpt.db/src/org/eclipse/jpt/db/Catalog.java
deleted file mode 100644
index 5c6da7058d..0000000000
--- a/jpa/plugins/org.eclipse.jpt.db/src/org/eclipse/jpt/db/Catalog.java
+++ /dev/null
@@ -1,27 +0,0 @@
-/*******************************************************************************
- * Copyright (c) 2008 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.
- *
- * Contributors:
- * Oracle - initial API and implementation
- ******************************************************************************/
-package org.eclipse.jpt.db;
-
-/**
- * Database catalog
- *
- * Provisional API: This interface is part of an interim API that is still
- * under development and expected to change significantly before reaching
- * stability. It is available at this early stage to solicit feedback from
- * pioneering adopters on the understanding that any code that uses this API
- * will almost certainly be broken (repeatedly) as the API evolves.
- *
- * This interface is not intended to be implemented by clients.
- */
-public interface Catalog
- extends SchemaContainer, Comparable<Catalog>
-{
- // nothing yet
-}
diff --git a/jpa/plugins/org.eclipse.jpt.db/src/org/eclipse/jpt/db/Column.java b/jpa/plugins/org.eclipse.jpt.db/src/org/eclipse/jpt/db/Column.java
deleted file mode 100644
index b502f61ca6..0000000000
--- a/jpa/plugins/org.eclipse.jpt.db/src/org/eclipse/jpt/db/Column.java
+++ /dev/null
@@ -1,123 +0,0 @@
-/*******************************************************************************
- * Copyright (c) 2008 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.
- *
- * Contributors:
- * Oracle - initial API and implementation
- ******************************************************************************/
-package org.eclipse.jpt.db;
-
-import org.eclipse.jpt.utility.JavaType;
-
-/**
- * Database column
- *
- * Provisional API: This interface is part of an interim API that is still
- * under development and expected to change significantly before reaching
- * stability. It is available at this early stage to solicit feedback from
- * pioneering adopters on the understanding that any code that uses this API
- * will almost certainly be broken (repeatedly) as the API evolves.
- *
- * This interface is not intended to be implemented by clients.
- */
-public interface Column
- extends DatabaseObject, Comparable<Column>
-{
- /**
- * Return the column's table.
- */
- Table getTable();
-
-
- // ********** constraints **********
-
- /**
- * Return whether the column is part of it's table's primary key.
- */
- boolean isPartOfPrimaryKey();
-
- /**
- * Return whether the column is part of one of it's table's foreign keys.
- */
- boolean isPartOfForeignKey();
-
- /**
- * Return whether the column is part of a unique constraint defined for its
- * table.
- */
- boolean isPartOfUniqueConstraint();
-
- /**
- * Return whether the column is nullable.
- */
- boolean isNullable();
-
-
- // ********** data type **********
-
- /**
- * Return the name of the column's datatype.
- */
- String getDataTypeName();
-
- /**
- * Return whether the column's type is numeric.
- */
- boolean isNumeric();
-
- /**
- * Return the column's precision if it is a NumericalDataType;
- * otherwise, return -1.
- */
- public int getPrecision();
-
- /**
- * Return the column's scale if it is an ExactNumericDataType;
- * otherwise, return -1.
- */
- public int getScale();
-
- /**
- * If the column is a CharacterStringDataType, return its length;
- * otherwise, return -1.
- */
- public int getLength();
-
- /**
- * Return whether the column's datatype is a LOB type
- * (i.e. BLOB, CLOB, or NCLOB).
- */
- boolean isLOB();
-
-
- // ********** Java type **********
-
- /**
- * Return a Java type declaration that is reasonably
- * similar to the column's data type.
- */
- String getJavaTypeDeclaration();
-
- /**
- * Return a Java type that is reasonably
- * similar to the column's data type.
- */
- JavaType getJavaType();
-
- /**
- * Return a Java type declaration that is reasonably
- * similar to the column's data type and suitable for use as a
- * primary key field.
- */
- String getPrimaryKeyJavaTypeDeclaration();
-
- /**
- * Return a Java type that is reasonably
- * similar to the column's data type and suitable for use as a
- * primary key field.
- */
- JavaType getPrimaryKeyJavaType();
-
-}
diff --git a/jpa/plugins/org.eclipse.jpt.db/src/org/eclipse/jpt/db/ConnectionAdapter.java b/jpa/plugins/org.eclipse.jpt.db/src/org/eclipse/jpt/db/ConnectionAdapter.java
deleted file mode 100644
index 972848965c..0000000000
--- a/jpa/plugins/org.eclipse.jpt.db/src/org/eclipse/jpt/db/ConnectionAdapter.java
+++ /dev/null
@@ -1,72 +0,0 @@
-/*******************************************************************************
- * Copyright (c) 2008 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.
- *
- * Contributors:
- * Oracle - initial API and implementation
- ******************************************************************************/
-package org.eclipse.jpt.db;
-
-
-/**
- * An empty implementation of ConnectionListener.
- *
- * Provisional API: This class is part of an interim API that is still
- * under development and expected to change significantly before reaching
- * stability. It is available at this early stage to solicit feedback from
- * pioneering adopters on the understanding that any code that uses this API
- * will almost certainly be broken (repeatedly) as the API evolves.
- */
-public class ConnectionAdapter implements ConnectionListener {
-
- public void aboutToClose(ConnectionProfile profile) {
- // do nothing
- }
-
- public void closed(ConnectionProfile profile) {
- // do nothing
- }
-
- public void databaseChanged(ConnectionProfile profile, Database database) {
- // do nothing
- }
-
- public void modified(ConnectionProfile profile) {
- // do nothing
- }
-
- public boolean okToClose(ConnectionProfile profile) {
- return true;
- }
-
- public void opened(ConnectionProfile profile) {
- // do nothing
- }
-
- public void catalogChanged(ConnectionProfile profile, Catalog catalog) {
- // do nothing
- }
-
- public void schemaChanged(ConnectionProfile profile, Schema schema) {
- // do nothing
- }
-
- public void sequenceChanged(ConnectionProfile profile, Sequence sequence) {
- // do nothing
- }
-
- public void tableChanged(ConnectionProfile profile, Table table) {
- // do nothing
- }
-
- public void columnChanged(ConnectionProfile profile, Column column) {
- // do nothing
- }
-
- public void foreignKeyChanged(ConnectionProfile profile, ForeignKey foreignKey) {
- // do nothing
- }
-
-}
diff --git a/jpa/plugins/org.eclipse.jpt.db/src/org/eclipse/jpt/db/ConnectionListener.java b/jpa/plugins/org.eclipse.jpt.db/src/org/eclipse/jpt/db/ConnectionListener.java
deleted file mode 100644
index 4f3b09bae8..0000000000
--- a/jpa/plugins/org.eclipse.jpt.db/src/org/eclipse/jpt/db/ConnectionListener.java
+++ /dev/null
@@ -1,42 +0,0 @@
-/*******************************************************************************
- * Copyright (c) 2006, 2008 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.
- *
- * Contributors:
- * Oracle - initial API and implementation
- ******************************************************************************/
-package org.eclipse.jpt.db;
-
-import java.util.EventListener;
-
-
-/**
- * A ConnectionListener is notified of any changes to a connection.
- *
- * @see org.eclipse.datatools.connectivity.IManagedConnectionListener
- *
- * Provisional API: This interface is part of an interim API that is still
- * under development and expected to change significantly before reaching
- * stability. It is available at this early stage to solicit feedback from
- * pioneering adopters on the understanding that any code that uses this API
- * will almost certainly be broken (repeatedly) as the API evolves.
- */
-public interface ConnectionListener extends EventListener {
-
- public void opened(ConnectionProfile profile);
- public void modified(ConnectionProfile profile);
- public boolean okToClose(ConnectionProfile profile);
- public void aboutToClose(ConnectionProfile profile);
- public void closed(ConnectionProfile profile);
-
- public void databaseChanged(ConnectionProfile profile, Database database);
- public void catalogChanged(ConnectionProfile profile, Catalog catalog);
- public void schemaChanged(ConnectionProfile profile, Schema schema);
- public void sequenceChanged(ConnectionProfile profile, Sequence sequence);
- public void tableChanged(ConnectionProfile profile, Table table);
- public void columnChanged(ConnectionProfile profile, Column column);
- public void foreignKeyChanged(ConnectionProfile profile, ForeignKey foreignKey);
-
-}
diff --git a/jpa/plugins/org.eclipse.jpt.db/src/org/eclipse/jpt/db/ConnectionProfile.java b/jpa/plugins/org.eclipse.jpt.db/src/org/eclipse/jpt/db/ConnectionProfile.java
deleted file mode 100644
index c15db7aa7f..0000000000
--- a/jpa/plugins/org.eclipse.jpt.db/src/org/eclipse/jpt/db/ConnectionProfile.java
+++ /dev/null
@@ -1,206 +0,0 @@
-/*******************************************************************************
- * Copyright (c) 2008 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.
- *
- * Contributors:
- * Oracle - initial API and implementation
- ******************************************************************************/
-package org.eclipse.jpt.db;
-
-import org.eclipse.core.runtime.IStatus;
-import org.eclipse.datatools.connectivity.drivers.jdbc.IJDBCDriverDefinitionConstants;
-
-/**
- * Database connection profile
- *
- * Provisional API: This interface is part of an interim API that is still
- * under development and expected to change significantly before reaching
- * stability. It is available at this early stage to solicit feedback from
- * pioneering adopters on the understanding that any code that uses this API
- * will almost certainly be broken (repeatedly) as the API evolves.
- *
- * This interface is not intended to be implemented by clients.
- */
-public interface ConnectionProfile
- extends DatabaseObject, Comparable<ConnectionProfile>
-{
-
- // ********** properties **********
-
- /**
- * Return the connection profile's database.
- * Return null if the connection profile is inactive.
- */
- Database getDatabase();
-
- /**
- * Return ID of the provider managing the DTP profile.
- */
- String getProviderID();
-
- /**
- * Return the connection profile's static ID.
- */
- String getInstanceID();
-
- /**
- * Return the default database name.
- */
- String getDatabaseName();
-
- /**
- * Return the database product name.
- */
- String getDatabaseProduct();
-
- /**
- * Return the database vendor.
- */
- String getDatabaseVendor();
-
- /**
- * Return the database version.
- */
- String getDatabaseVersion();
-
- /**
- * Return the driver class name.
- */
- String getDriverClassName();
-
- /**
- * Return the default connection URL.
- */
- String getURL();
-
- /**
- * Return the default user name.
- */
- String getUserName();
-
- /**
- * Return the default user password.
- */
- String getUserPassword();
-
- /**
- * Return the ID of the associated Driver definition.
- */
- String getDriverDefinitionID();
-
- /**
- * Return the jar list for the associated Driver as a
- * comma-delimited string.
- */
- String getDriverJarList();
-
- /**
- * Return the name of the associated Driver definition.
- */
- String getDriverName();
-
- // ********** connection **********
-
- /**
- * Return whether the profile is either connected to a live database
- * session or working off-line (i.e. it has access to meta-data).
- * @see isConnected()
- * @see isWorkingOffline()
- */
- boolean isActive();
-
- /**
- * Return whether the profile is neither connected to a live database
- * session nor working off-line (i.e. it has access to meta-data).
- * @see isActive()
- */
- boolean isInactive();
-
- /**
- * Return whether the profile is connected to a live database session
- * (i.e. the meta-data comes from the database), as opposed to working
- * off-line.
- * @see #isActive()
- */
- boolean isConnected();
-
- /**
- * Return whether the profile is not connected to a live database session
- * (i.e. the meta-data comes from the database), as opposed to working
- * off-line.
- * @see #isConnected()
- */
- boolean isDisconnected();
-
- /**
- * Connect to the database.
- * @see #disconnect()
- */
- void connect();
-
- /**
- * Disconnect from the database.
- * @see #connect()
- */
- void disconnect();
-
-
- // ********** off-line support **********
-
- /**
- * Return whether the profile is working off-line (i.e. the meta-data
- * comes from a local cache), as opposed to connected to a live
- * database session.
- * @see #isActive()
- */
- boolean isWorkingOffline();
-
- /**
- * Return whether the connection factories associated with the
- * connection profile's provider support working offline.
- */
- boolean supportsWorkOfflineMode();
-
- /**
- * Save the state of the connection profile for working in an offline mode.
- * If the connection profile does not support working in an offline mode, no
- * exception is thrown and the method will return immediately.
- */
- IStatus saveWorkOfflineData();
-
- /**
- * Return whether the connection profile supports working offline and data
- * has been saved for working offline.
- */
- boolean canWorkOffline();
-
- /**
- * Begin working off-line.
- */
- IStatus workOffline();
-
-
- // ********** listeners **********
-
- /**
- * Add the specified connection listener to the connection profile.
- */
- void addConnectionListener(ConnectionListener listener);
-
- /**
- * Remove the specified connection listener from the connection profile.
- */
- void removeConnectionListener(ConnectionListener listener);
-
-
- // ********** constants **********
-
- String CONNECTION_PROFILE_TYPE = "org.eclipse.datatools.connectivity.db.generic.connectionProfile"; //$NON-NLS-1$
- String DRIVER_DEFINITION_PROP_ID = "org.eclipse.datatools.connectivity.driverDefinitionID"; //$NON-NLS-1$
- String DRIVER_DEFINITION_TYPE_PROP_ID = "org.eclipse.datatools.connectivity.drivers.defnType"; //$NON-NLS-1$
- String DRIVER_JAR_LIST_PROP_ID = "jarList"; //$NON-NLS-1$
- String DATABASE_SAVE_PWD_PROP_ID = IJDBCDriverDefinitionConstants.PROP_PREFIX + "savePWD"; //$NON-NLS-1$
-
-}
diff --git a/jpa/plugins/org.eclipse.jpt.db/src/org/eclipse/jpt/db/ConnectionProfileAdapter.java b/jpa/plugins/org.eclipse.jpt.db/src/org/eclipse/jpt/db/ConnectionProfileAdapter.java
deleted file mode 100644
index 648daa5bf6..0000000000
--- a/jpa/plugins/org.eclipse.jpt.db/src/org/eclipse/jpt/db/ConnectionProfileAdapter.java
+++ /dev/null
@@ -1,35 +0,0 @@
-/*******************************************************************************
- * Copyright (c) 2008 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.
- *
- * Contributors:
- * Oracle - initial API and implementation
- ******************************************************************************/
-package org.eclipse.jpt.db;
-
-/**
- * An empty implementation of ProfileListener.
- *
- * Provisional API: This class is part of an interim API that is still
- * under development and expected to change significantly before reaching
- * stability. It is available at this early stage to solicit feedback from
- * pioneering adopters on the understanding that any code that uses this API
- * will almost certainly be broken (repeatedly) as the API evolves.
- */
-public class ConnectionProfileAdapter implements ConnectionProfileListener {
-
- public void connectionProfileAdded(String name) {
- // do nothing
- }
-
- public void connectionProfileRemoved(String name) {
- // do nothing
- }
-
- public void connectionProfileRenamed(String oldName, String newName) {
- // do nothing
- }
-
-}
diff --git a/jpa/plugins/org.eclipse.jpt.db/src/org/eclipse/jpt/db/ConnectionProfileFactory.java b/jpa/plugins/org.eclipse.jpt.db/src/org/eclipse/jpt/db/ConnectionProfileFactory.java
deleted file mode 100644
index e44773953a..0000000000
--- a/jpa/plugins/org.eclipse.jpt.db/src/org/eclipse/jpt/db/ConnectionProfileFactory.java
+++ /dev/null
@@ -1,67 +0,0 @@
-/*******************************************************************************
- * Copyright (c) 2008 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.
- *
- * Contributors:
- * Oracle - initial API and implementation
- ******************************************************************************/
-package org.eclipse.jpt.db;
-
-import java.util.Iterator;
-
-/**
- * Database connection profile factory
- *
- * Provisional API: This interface is part of an interim API that is still
- * under development and expected to change significantly before reaching
- * stability. It is available at this early stage to solicit feedback from
- * pioneering adopters on the understanding that any code that uses this API
- * will almost certainly be broken (repeatedly) as the API evolves.
- *
- * This interface is not intended to be implemented by clients.
- */
-public interface ConnectionProfileFactory {
-
- /**
- * Return the names of the DTP connection profiles the factory can wrap with
- * new connection profiles.
- */
- Iterator<String> connectionProfileNames();
-
- /**
- * Build and return a connection profile that wraps the DTP connection
- * profile with the specified name.
- * Return null if there is no DTP connection profile with the specified
- * name.
- * Use the specified database finder to allow clients to control how
- * database objects are found based on their names.
- */
- ConnectionProfile buildConnectionProfile(String name, DatabaseFinder finder);
-
- /**
- * Build and return a connection profile that wraps the DTP connection
- * profile with the specified name.
- * Return null if there is no DTP connection profile with the specified
- * name.
- * Clients should use this method when a JPA platform is unavailable
- * (e.g. during project creation). The returned connection profile will
- * not be able to search for database objects by any names other than
- * those supplied by the factory (i.e. lookups cannot be performed with
- * "identifiers").
- */
- ConnectionProfile buildConnectionProfile(String name);
-
- /**
- * Add a listener that will be notified of changes to the DTP
- * connection profiles.
- */
- void addConnectionProfileListener(ConnectionProfileListener listener);
-
- /**
- * Remove the specified listener.
- */
- void removeConnectionProfileListener(ConnectionProfileListener listener);
-
-}
diff --git a/jpa/plugins/org.eclipse.jpt.db/src/org/eclipse/jpt/db/ConnectionProfileListener.java b/jpa/plugins/org.eclipse.jpt.db/src/org/eclipse/jpt/db/ConnectionProfileListener.java
deleted file mode 100644
index f020c5505d..0000000000
--- a/jpa/plugins/org.eclipse.jpt.db/src/org/eclipse/jpt/db/ConnectionProfileListener.java
+++ /dev/null
@@ -1,44 +0,0 @@
-/*******************************************************************************
- * Copyright (c) 2006, 2008 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.
- *
- * Contributors:
- * Oracle - initial API and implementation
- ******************************************************************************/
-package org.eclipse.jpt.db;
-
-import java.util.EventListener;
-
-/**
- * A ProfileListener is notified of any changes to the DTP connection profiles.
- *
- * @see org.eclipse.datatools.connectivity.IProfileListener
- *
- * Provisional API: This interface is part of an interim API that is still
- * under development and expected to change significantly before reaching
- * stability. It is available at this early stage to solicit feedback from
- * pioneering adopters on the understanding that any code that uses this API
- * will almost certainly be broken (repeatedly) as the API evolves.
- */
-public interface ConnectionProfileListener
- extends EventListener
-{
-
- /**
- * The specified profile has been added.
- */
- public void connectionProfileAdded(String name);
-
- /**
- * The specified profile has been removed.
- */
- public void connectionProfileRemoved(String name);
-
- /**
- * The specified profile has been renamed.
- */
- public void connectionProfileRenamed(String oldName, String newName);
-
-}
diff --git a/jpa/plugins/org.eclipse.jpt.db/src/org/eclipse/jpt/db/Database.java b/jpa/plugins/org.eclipse.jpt.db/src/org/eclipse/jpt/db/Database.java
deleted file mode 100644
index 62fcfade7b..0000000000
--- a/jpa/plugins/org.eclipse.jpt.db/src/org/eclipse/jpt/db/Database.java
+++ /dev/null
@@ -1,137 +0,0 @@
-/*******************************************************************************
- * Copyright (c) 2008, 2009 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.
- *
- * Contributors:
- * Oracle - initial API and implementation
- ******************************************************************************/
-package org.eclipse.jpt.db;
-
-import java.util.Iterator;
-
-/**
- * Database
- *
- * Provisional API: This interface is part of an interim API that is still
- * under development and expected to change significantly before reaching
- * stability. It is available at this early stage to solicit feedback from
- * pioneering adopters on the understanding that any code that uses this API
- * will almost certainly be broken (repeatedly) as the API evolves.
- *
- * This interface is not intended to be implemented by clients.
- */
-public interface Database
- extends SchemaContainer, Comparable<Database>
-{
-
- // ********** properties **********
-
- /**
- * Return the name of the database's vendor.
- */
- String getVendorName();
-
- /**
- * Return the database's version.
- */
- String getVersion();
-
-
- // ********** catalogs **********
-
- /**
- * Return whether the database supports catalogs. If it does, all database
- * objects are contained by the database's catalogs; otherwise all database
- * objects are contained by the database's schemata.
- *
- * Practically speaking:
- * if #supportsCatalogs() returns 'true'
- * #catalogs() returns catalogs that contain the database's schemata
- * #schemata() returns an empty iterator
- * else
- * #catalogs() returns an empty iterator
- * #schemata() returns the database's schemata
- * This is complicated by the presence of a "default" catalog that clients can
- * use to allow the specification of a catalog to be optional; but clients
- * must manage this explicitly.
- *
- * @see #catalogs()
- * @see #schemata()
- */
- boolean supportsCatalogs();
-
- /**
- * Return the database's catalogs.
- * Return an empty iterator if the database does not support catalogs.
- * @see #supportsCatalogs()
- */
- Iterator<Catalog> catalogs();
-
- /**
- * Return the number of catalogs the database contains.
- * Return zero if the database does not support catalogs.
- * @see #supportsCatalogs()
- */
- int catalogsSize();
-
- /**
- * Return the database's catalog names, sorted.
- * Return an empty iterator if the database does not support catalogs.
- * This is useful when the user is selecting a catalog from a read-only
- * combo-box (e.g. in a wizard).
- */
- Iterator<String> sortedCatalogNames();
-
- /**
- * Return the catalog with specified name. The name must be an exact match
- * of the catalog's name.
- * Return null if the database does not support catalogs.
- * @see #supportsCatalogs()
- * @see #getCatalogForIdentifier(String)
- */
- Catalog getCatalogNamed(String name);
-
- /**
- * Return the database's catalog identifiers, sorted by name.
- * Return an empty iterator if the database does not support catalogs.
- * This is useful when the user is selecting an identifier that will be
- * placed in a text file (e.g. in a Java annotation).
- */
- Iterator<String> sortedCatalogIdentifiers();
-
- /**
- * Return the catalog for the specified identifier. The identifier should
- * be an SQL identifier (i.e. quoted when case-sensitive or containing
- * special characters, unquoted otherwise).
- * Return null if the database does not support catalogs.
- * @see #supportsCatalogs()
- * @see #getCatalogNamed(String)
- */
- Catalog getCatalogForIdentifier(String identifier);
-
- /**
- * Return the database's "default" catalog.
- * Return null if the database does not support catalogs.
- * @see #supportsCatalogs()
- */
- Catalog getDefaultCatalog();
-
-
- // ********** utility methods **********
-
- /**
- * Select and return from the specified list of database objects the
- * database object identified by the specified identifier.
- * The identifier should be an SQL identifier (i.e. delimited when
- * non-"normal").
- */
- <T extends DatabaseObject> T selectDatabaseObjectForIdentifier(T[] databaseObjects, String identifier);
-
- /**
- * Convert the specified name to a database-appropriate SQL identifier.
- */
- String convertNameToIdentifier(String name);
-
-}
diff --git a/jpa/plugins/org.eclipse.jpt.db/src/org/eclipse/jpt/db/DatabaseFinder.java b/jpa/plugins/org.eclipse.jpt.db/src/org/eclipse/jpt/db/DatabaseFinder.java
deleted file mode 100644
index e7806e7933..0000000000
--- a/jpa/plugins/org.eclipse.jpt.db/src/org/eclipse/jpt/db/DatabaseFinder.java
+++ /dev/null
@@ -1,96 +0,0 @@
-/*******************************************************************************
- * Copyright (c) 2008 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.
- *
- * Contributors:
- * Oracle - initial API and implementation
- ******************************************************************************/
-package org.eclipse.jpt.db;
-
-/**
- * This interface allows clients of the Dali db package to plug in a custom
- * strategy for comparing an identifier to the names of a collection of
- * database objects.
- *
- * Provisional API: This interface is part of an interim API that is still
- * under development and expected to change significantly before reaching
- * stability. It is available at this early stage to solicit feedback from
- * pioneering adopters on the understanding that any code that uses this API
- * will almost certainly be broken (repeatedly) as the API evolves.
- *
- * This interface is not intended to be implemented by clients.
- */
-public interface DatabaseFinder {
-
- /**
- * Select and return from the specified list of database objects the
- * database object identified by the specified identifier.
- */
- <T extends DatabaseObject> T selectDatabaseObjectForIdentifier(T[] databaseObjects, String identifier, DefaultCallback defaultCallback);
-
- /**
- * The platform-provided finder is passed a "default" callback that can be
- * used if appropriate.
- */
- interface DefaultCallback {
-
- /**
- * Select and return from the specified list of database objects the
- * database object identified by the specified identifier.
- */
- <T extends DatabaseObject> T selectDatabaseObjectForIdentifier(T[] databaseObjects, String identifier);
-
- }
-
- /**
- * This finder searches for an exact match.
- */
- final class Simple implements DatabaseFinder {
- public static final DatabaseFinder INSTANCE = new Simple();
- public static DatabaseFinder instance() {
- return INSTANCE;
- }
- // ensure single instance
- private Simple() {
- super();
- }
- // search for an exact match on the name
- public <T extends DatabaseObject> T selectDatabaseObjectForIdentifier(T[] databaseObjects, String identifier, DefaultCallback defaultCallback) {
- for (T databaseObject : databaseObjects) {
- if (databaseObject.getName().equals(identifier)) {
- return databaseObject;
- }
- }
- return null;
- }
- @Override
- public String toString() {
- return "DatabaseFinder.Default"; //$NON-NLS-1$
- }
- }
-
- /**
- * This finder uses the passed in callback to search the list of database objects.
- */
- final class Default implements DatabaseFinder {
- public static final DatabaseFinder INSTANCE = new Default();
- public static DatabaseFinder instance() {
- return INSTANCE;
- }
- // ensure single instance
- private Default() {
- super();
- }
- // simply use the callback
- public <T extends DatabaseObject> T selectDatabaseObjectForIdentifier(T[] databaseObjects, String identifier, DefaultCallback defaultCallback) {
- return defaultCallback.selectDatabaseObjectForIdentifier(databaseObjects, identifier);
- }
- @Override
- public String toString() {
- return "DatabaseFinder.Default"; //$NON-NLS-1$
- }
- }
-
-}
diff --git a/jpa/plugins/org.eclipse.jpt.db/src/org/eclipse/jpt/db/DatabaseObject.java b/jpa/plugins/org.eclipse.jpt.db/src/org/eclipse/jpt/db/DatabaseObject.java
deleted file mode 100644
index e9f755dbb0..0000000000
--- a/jpa/plugins/org.eclipse.jpt.db/src/org/eclipse/jpt/db/DatabaseObject.java
+++ /dev/null
@@ -1,58 +0,0 @@
-/*******************************************************************************
- * Copyright (c) 2008 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.
- *
- * Contributors:
- * Oracle - initial API and implementation
- ******************************************************************************/
-package org.eclipse.jpt.db;
-
-/**
- * Common behavior to all database objects
- *
- * Provisional API: This interface is part of an interim API that is still
- * under development and expected to change significantly before reaching
- * stability. It is available at this early stage to solicit feedback from
- * pioneering adopters on the understanding that any code that uses this API
- * will almost certainly be broken (repeatedly) as the API evolves.
- *
- * This interface is not intended to be implemented by clients.
- */
-public interface DatabaseObject {
-
- /**
- * Return the database object's name.
- */
- String getName();
-
- /**
- * Return the database object's "identifier", which is the object's name
- * modified so it can be used in an SQL statement (e.g. if the name contains
- * special characters or is mixed case, it will be delimited, typically by
- * double-quotes).
- * Return null if the database object's identifier matches the specified
- * "default name".
- */
- String getIdentifier(String defaultName);
-
- /**
- * Return the database object's "identifier", which is the object's name
- * modified so it can be used in an SQL statement (e.g. if the name contains
- * special characters or is mixed case, it will be delimited, typically by
- * double-quotes).
- */
- String getIdentifier();
-
- /**
- * Return the database object's database.
- */
- Database getDatabase();
-
- /**
- * Return the database object's connection profile.
- */
- ConnectionProfile getConnectionProfile();
-
-}
diff --git a/jpa/plugins/org.eclipse.jpt.db/src/org/eclipse/jpt/db/ForeignKey.java b/jpa/plugins/org.eclipse.jpt.db/src/org/eclipse/jpt/db/ForeignKey.java
deleted file mode 100644
index 0406b42eba..0000000000
--- a/jpa/plugins/org.eclipse.jpt.db/src/org/eclipse/jpt/db/ForeignKey.java
+++ /dev/null
@@ -1,139 +0,0 @@
-/*******************************************************************************
- * Copyright (c) 2008 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.
- *
- * Contributors:
- * Oracle - initial API and implementation
- ******************************************************************************/
-package org.eclipse.jpt.db;
-
-import java.util.Iterator;
-
-/**
- * Database foreign key
- *
- * Provisional API: This interface is part of an interim API that is still
- * under development and expected to change significantly before reaching
- * stability. It is available at this early stage to solicit feedback from
- * pioneering adopters on the understanding that any code that uses this API
- * will almost certainly be broken (repeatedly) as the API evolves.
- *
- * This interface is not intended to be implemented by clients.
- */
-public interface ForeignKey
- extends DatabaseObject, Comparable<ForeignKey>
-{
-
- // ********** tables **********
-
- /**
- * Return the foreign key's "base" table.
- */
- Table getBaseTable();
-
- /**
- * Return the foreign key's "referenced" table.
- */
- Table getReferencedTable();
-
-
- // ********** column pairs **********
-
- /**
- * Return the foreign key's column pairs.
- */
- Iterator<ColumnPair> columnPairs();
-
- /**
- * Return the size of the foreign key's column pairs.
- */
- int columnPairsSize();
-
- /**
- * Return the foreign key's single column pair. Throw an
- * IllegalStateException if the foreign key has more than one column pair.
- */
- ColumnPair getColumnPair();
-
- /**
- * Return the foreign key's "base" columns.
- */
- Iterator<Column> baseColumns();
-
- /**
- * Return the foreign key's "base" columns that are not part of the base
- * table's primary key. (The non-primary key base columns are not used to
- * generate basic attributes during entity generation.)
- */
- Iterator<Column> nonPrimaryKeyBaseColumns();
-
- /**
- * Return the foreign key's "referenced" columns.
- */
- Iterator<Column> referencedColumns();
-
- /**
- * Return whether the foreign key references the primary key of the
- * "referenced" table and that primary key has only a single column.
- * This can be used when determining JPA defaults.
- */
- boolean referencesSingleColumnPrimaryKey();
-
-
- // ********** JPA support **********
-
- /**
- * Return an appropriate name for an attribute that holds the entity
- * mapped to the foreign key's "referenced" table.
- */
- String getAttributeName();
-
- /**
- * If the name of the "base" column adheres to the JPA spec for a
- * default mapping (i.e. it ends with an underscore followed by the name
- * of the "referenced" column, and the "referenced" column is the single
- * primary key column of the "referenced" table), return the corresponding
- * default attribute name:
- * ForeignKey(EMP.CUBICLE_ID => CUBICLE.ID) => "CUBICLE"
- * Return a null if it does not adhere to the JPA spec:
- * ForeignKey(EMP.CUBICLE_ID => CUBICLE.CUBICLE_ID) => null
- * ForeignKey(EMP.CUBICLE => CUBICLE.ID) => null
- */
- String getDefaultAttributeName();
-
- /**
- * Given the name of an attribute (field or property) that is mapped to the
- * foreign key,
- * build and return a string to be used as the value for the attribute's
- * JoinColumn annotation's 'name' element. Return null if the attribute
- * maps to the join column by default.
- * Precondition: The foreign key consists of a single column pair whose
- * referenced column is the single-column primary key of the foreign
- * key's referenced table.
- */
- String getJoinColumnAnnotationIdentifier(String attributeName);
-
- // ********** column pair interface **********
-
- /**
- * Pair up the foreign key's column pairs, matching each "base" column with
- * the appropriate "referenced" column.
- * @see #columnPairs()
- */
- interface ColumnPair extends Comparable<ColumnPair> {
-
- /**
- * Return the column pair's "base" column.
- */
- Column getBaseColumn();
-
- /**
- * Return the column pair's "referenced" column.
- */
- Column getReferencedColumn();
-
- }
-
-}
diff --git a/jpa/plugins/org.eclipse.jpt.db/src/org/eclipse/jpt/db/JptDbPlugin.java b/jpa/plugins/org.eclipse.jpt.db/src/org/eclipse/jpt/db/JptDbPlugin.java
deleted file mode 100644
index 041ac8d3bb..0000000000
--- a/jpa/plugins/org.eclipse.jpt.db/src/org/eclipse/jpt/db/JptDbPlugin.java
+++ /dev/null
@@ -1,80 +0,0 @@
-/*******************************************************************************
- * Copyright (c) 2006, 2008 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.
- *
- * Contributors:
- * Oracle - initial API and implementation
- ******************************************************************************/
-package org.eclipse.jpt.db;
-
-import org.eclipse.core.runtime.Plugin;
-import org.eclipse.datatools.enablement.jdt.classpath.DriverClasspathContainer;
-import org.eclipse.jdt.core.IClasspathContainer;
-import org.eclipse.jpt.db.internal.DTPConnectionProfileFactory;
-import org.osgi.framework.BundleContext;
-
-/**
- * The JPT DB plug-in lifecycle implementation.
- * Globally available connection profile factory.
- *
- * Provisional API: This class is part of an interim API that is still
- * under development and expected to change significantly before reaching
- * stability. It is available at this early stage to solicit feedback from
- * pioneering adopters on the understanding that any code that uses this API
- * will almost certainly be broken (repeatedly) as the API evolves.
- */
-public class JptDbPlugin extends Plugin {
- private DTPConnectionProfileFactory connectionProfileFactory;
-
- private static JptDbPlugin INSTANCE; // sorta-final
-
- /**
- * Return the singleton JPT DB plug-in.
- */
- public static JptDbPlugin instance() {
- return INSTANCE;
- }
-
- /**
- * The constructor
- */
- public JptDbPlugin() {
- super();
- INSTANCE = this;
- }
-
- /**
- * This method is called upon plug-in activation
- */
- @Override
- public void start(BundleContext context) throws Exception {
- super.start(context);
- this.connectionProfileFactory = DTPConnectionProfileFactory.instance();
- this.connectionProfileFactory.start();
- }
-
- /**
- * This method is called when the plug-in is stopped
- */
- @Override
- public void stop(BundleContext context) throws Exception {
- this.connectionProfileFactory.stop();
- this.connectionProfileFactory = null;
- INSTANCE = null;
- super.stop(context);
- }
-
- public ConnectionProfileFactory getConnectionProfileFactory() {
- return this.connectionProfileFactory;
- }
-
- /**
- * Creates a jar list container for the given DTP driver.
- */
- public IClasspathContainer buildDriverClasspathContainerFor(String driverName) {
- return new DriverClasspathContainer(driverName);
- }
-
-}
diff --git a/jpa/plugins/org.eclipse.jpt.db/src/org/eclipse/jpt/db/Schema.java b/jpa/plugins/org.eclipse.jpt.db/src/org/eclipse/jpt/db/Schema.java
deleted file mode 100644
index 984dfb537a..0000000000
--- a/jpa/plugins/org.eclipse.jpt.db/src/org/eclipse/jpt/db/Schema.java
+++ /dev/null
@@ -1,100 +0,0 @@
-/*******************************************************************************
- * Copyright (c) 2008 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.
- *
- * Contributors:
- * Oracle - initial API and implementation
- ******************************************************************************/
-package org.eclipse.jpt.db;
-
-import java.util.Iterator;
-
-
-/**
- * Database schema
- *
- * Provisional API: This interface is part of an interim API that is still
- * under development and expected to change significantly before reaching
- * stability. It is available at this early stage to solicit feedback from
- * pioneering adopters on the understanding that any code that uses this API
- * will almost certainly be broken (repeatedly) as the API evolves.
- *
- * This interface is not intended to be implemented by clients.
- */
-public interface Schema
- extends DatabaseObject, Comparable<Schema>
-{
- /**
- * Return the schema's container; either a catalog or a database.
- */
- SchemaContainer getContainer();
-
-
- // ********** tables **********
-
- /**
- * Return the schema's tables.
- */
- Iterator<Table> tables();
-
- /**
- * Return the number of tables the schema contains.
- */
- int tablesSize();
-
- /**
- * Return the table with specified name. The name must be an exact match
- * of the table's name.
- * @see #getTableForIdentifier(String)
- */
- Table getTableNamed(String name);
-
- /**
- * Return the schema's table identifiers, sorted by name.
- */
- Iterator<String> sortedTableIdentifiers();
-
- /**
- * Return the table for the specified identifier. The identifier should
- * be an SQL identifier (i.e. quoted when case-sensitive or containing
- * special characters, unquoted otherwise).
- * @see #getTableNamed(String)
- */
- Table getTableForIdentifier(String identifier);
-
-
- // ********** sequences **********
-
- /**
- * Return the schema's sequences.
- */
- Iterator<Sequence> sequences();
-
- /**
- * Return the number of sequences the schema contains.
- */
- int sequencesSize();
-
- /**
- * Return the sequence with specified name. The name must be an exact match
- * of the sequence's name.
- * @see #getSequenceForIdentifier(String)
- */
- Sequence getSequenceNamed(String name);
-
- /**
- * Return the schema's sequence identifers, sorted by name.
- */
- Iterator<String> sortedSequenceIdentifiers();
-
- /**
- * Return the sequence for the specified identifier. The identifier should
- * be an SQL identifier (i.e. quoted when case-sensitive or containing
- * special characters, unquoted otherwise).
- * @see #getSequenceNamed(String)
- */
- Sequence getSequenceForIdentifier(String identifier);
-
-}
diff --git a/jpa/plugins/org.eclipse.jpt.db/src/org/eclipse/jpt/db/SchemaContainer.java b/jpa/plugins/org.eclipse.jpt.db/src/org/eclipse/jpt/db/SchemaContainer.java
deleted file mode 100644
index bde243a43d..0000000000
--- a/jpa/plugins/org.eclipse.jpt.db/src/org/eclipse/jpt/db/SchemaContainer.java
+++ /dev/null
@@ -1,76 +0,0 @@
-/*******************************************************************************
- * Copyright (c) 2008, 2009 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.
- *
- * Contributors:
- * Oracle - initial API and implementation
- ******************************************************************************/
-package org.eclipse.jpt.db;
-
-import java.util.Iterator;
-
-/**
- * Schema "container" (i.e. Database or Catalog)
- *
- * Provisional API: This interface is part of an interim API that is still
- * under development and expected to change significantly before reaching
- * stability. It is available at this early stage to solicit feedback from
- * pioneering adopters on the understanding that any code that uses this API
- * will almost certainly be broken (repeatedly) as the API evolves.
- *
- * This interface is not intended to be implemented by clients.
- */
-public interface SchemaContainer
- extends DatabaseObject
-{
-
- /**
- * Return the container's schemata.
- */
- Iterator<Schema> schemata();
-
- /**
- * Return the number of schemata in the container.
- */
- int schemataSize();
-
- /**
- * Return the container's schema names, sorted.
- * This is useful when the user is selecting a schema from a read-only
- * combo-box (e.g. in a wizard).
- */
- Iterator<String> sortedSchemaNames();
-
- /**
- * Return the schema with specified name. The name must be an exact match
- * of the schema's name.
- * @see #schemaNames()
- * @see #getSchemaForIdentifier(String)
- */
- Schema getSchemaNamed(String name);
-
- /**
- * Return the container's schema identifiers, sorted by name.
- * This is useful when the user is selecting an identifier that will be
- * placed in a text file (e.g. in a Java annotation).
- */
- Iterator<String> sortedSchemaIdentifiers();
-
- /**
- * Return the schema for the specified identifier. The identifier should
- * be an SQL identifier (i.e. quoted when case-sensitive or containing
- * special characters, unquoted otherwise).
- * @see #schemaIdentifiers()
- * @see #getSchemaNamed(String)
- */
- Schema getSchemaForIdentifier(String identifier);
-
- /**
- * Return the container's default schema, as defined by the database vendor.
- * In most cases the default schema's name will match the user name.
- */
- Schema getDefaultSchema();
-
-}
diff --git a/jpa/plugins/org.eclipse.jpt.db/src/org/eclipse/jpt/db/Sequence.java b/jpa/plugins/org.eclipse.jpt.db/src/org/eclipse/jpt/db/Sequence.java
deleted file mode 100644
index f4ccaa78f9..0000000000
--- a/jpa/plugins/org.eclipse.jpt.db/src/org/eclipse/jpt/db/Sequence.java
+++ /dev/null
@@ -1,32 +0,0 @@
-/*******************************************************************************
- * Copyright (c) 2008 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.
- *
- * Contributors:
- * Oracle - initial API and implementation
- ******************************************************************************/
-package org.eclipse.jpt.db;
-
-/**
- * Database sequence
- *
- * Provisional API: This interface is part of an interim API that is still
- * under development and expected to change significantly before reaching
- * stability. It is available at this early stage to solicit feedback from
- * pioneering adopters on the understanding that any code that uses this API
- * will almost certainly be broken (repeatedly) as the API evolves.
- *
- * This interface is not intended to be implemented by clients.
- */
-public interface Sequence
- extends DatabaseObject, Comparable<Sequence>
-{
-
- /**
- * Return the sequence's schema.
- */
- Schema getSchema();
-
-}
diff --git a/jpa/plugins/org.eclipse.jpt.db/src/org/eclipse/jpt/db/Table.java b/jpa/plugins/org.eclipse.jpt.db/src/org/eclipse/jpt/db/Table.java
deleted file mode 100644
index ef4d334af0..0000000000
--- a/jpa/plugins/org.eclipse.jpt.db/src/org/eclipse/jpt/db/Table.java
+++ /dev/null
@@ -1,130 +0,0 @@
-/*******************************************************************************
- * Copyright (c) 2008 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.
- *
- * Contributors:
- * Oracle - initial API and implementation
- ******************************************************************************/
-package org.eclipse.jpt.db;
-
-import java.util.Iterator;
-
-/**
- * Database table
- *
- * Provisional API: This interface is part of an interim API that is still
- * under development and expected to change significantly before reaching
- * stability. It is available at this early stage to solicit feedback from
- * pioneering adopters on the understanding that any code that uses this API
- * will almost certainly be broken (repeatedly) as the API evolves.
- *
- * This interface is not intended to be implemented by clients.
- */
-public interface Table
- extends DatabaseObject, Comparable<Table>
-{
-
- /**
- * Return the table's schema.
- */
- Schema getSchema();
-
-
- // ********** columns **********
-
- /**
- * Return the table's columns.
- */
- Iterator<Column> columns();
-
- /**
- * Return the number of columns the table contains.
- */
- int columnsSize();
-
- /**
- * Return the column with specified name. The name must be an exact match
- * of the column's name.
- * @see #getColumnForIdentifier(String)
- */
- Column getColumnNamed(String name);
-
- /**
- * Return the table's column identifers, sorted by name.
- */
- Iterator<String> sortedColumnIdentifiers();
-
- /**
- * Return the column for the specified identifier. The identifier should
- * be an SQL identifier (i.e. quoted when case-sensitive or containing
- * special characters, unquoted otherwise).
- * @see #getColumnNamed(String)
- */
- Column getColumnForIdentifier(String identifier);
-
-
- // ********** primary key columns **********
-
- /**
- * Return the table's primary key columns.
- */
- Iterator<Column> primaryKeyColumns();
-
- /**
- * Return the number of primary key columns the table contains.
- */
- int primaryKeyColumnsSize();
-
- /**
- * Return the table's single primary key column. Throw an
- * IllegalStateException if the table has more than one primary key column.
- */
- Column getPrimaryKeyColumn();
-
-
- // ********** foreign keys **********
-
- /**
- * Return the table's foreign keys.
- */
- Iterator<ForeignKey> foreignKeys();
-
- /**
- * Return the number of foreign keys the table contains.
- */
- int foreignKeysSize();
-
-
- // ********** join table support **********
-
- /**
- * Return whether the table is possibly a "join" table
- * (i.e. it contains only 2 foreign keys). Whether the table *actually* is
- * a "join" table is determined by the semantics of the database design.
- */
- boolean isPossibleJoinTable();
-
- /**
- * Assuming the table is a "join" table, return the foreign key to the
- * "owning" table.
- * @see #isPossibleJoinTable()
- */
- ForeignKey getJoinTableOwningForeignKey();
-
- /**
- * Assuming the table is a "join" table, return the foreign key to the
- * "non-owning" table.
- * @see #isPossibleJoinTable()
- */
- ForeignKey getJoinTableNonOwningForeignKey();
-
- /**
- * Assuming the table is a "join" table, return whether its name matches
- * the JPA default (i.e. "OWNINGTABLE_NONOWNINGTABLE").
- * @see #isPossibleJoinTable()
- */
- boolean joinTableNameIsDefault();
-
-}
diff --git a/jpa/plugins/org.eclipse.jpt.db/src/org/eclipse/jpt/db/internal/DTPCatalogWrapper.java b/jpa/plugins/org.eclipse.jpt.db/src/org/eclipse/jpt/db/internal/DTPCatalogWrapper.java
deleted file mode 100644
index e519d22ada..0000000000
--- a/jpa/plugins/org.eclipse.jpt.db/src/org/eclipse/jpt/db/internal/DTPCatalogWrapper.java
+++ /dev/null
@@ -1,100 +0,0 @@
-/*******************************************************************************
- * Copyright (c) 2007, 2008 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.
- *
- * Contributors:
- * Oracle - initial API and implementation
- ******************************************************************************/
-package org.eclipse.jpt.db.internal;
-
-import com.ibm.icu.text.Collator;
-import java.util.List;
-import org.eclipse.jpt.db.Catalog;
-
-/**
- * Wrap a DTP Catalog
- */
-final class DTPCatalogWrapper
- extends DTPSchemaContainerWrapper
- implements Catalog
-{
- // the wrapped DTP catalog
- private final org.eclipse.datatools.modelbase.sql.schema.Catalog dtpCatalog;
-
-
- // ********** constructor **********
-
- DTPCatalogWrapper(DTPDatabaseWrapper database, org.eclipse.datatools.modelbase.sql.schema.Catalog dtpCatalog) {
- super(database, dtpCatalog);
- this.dtpCatalog = dtpCatalog;
- }
-
-
- // ********** DTPWrapper implementation **********
-
- @Override
- synchronized void catalogObjectChanged() {
- super.catalogObjectChanged();
- this.getConnectionProfile().catalogChanged(this);
- }
-
-
- // ********** DTPSchemaContainerWrapper implementation **********
-
- @Override
- @SuppressWarnings("unchecked")
- List<org.eclipse.datatools.modelbase.sql.schema.Schema> getDTPSchemata() {
- return this.dtpCatalog.getSchemas();
- }
-
- @Override
- DTPSchemaWrapper getSchema(org.eclipse.datatools.modelbase.sql.schema.Schema dtpSchema) {
- // try to short-circuit the search
- return this.wraps(dtpSchema.getCatalog()) ?
- this.getSchema_(dtpSchema)
- :
- this.getDatabase().getSchemaFromCatalogs(dtpSchema);
- }
-
- @Override
- DTPTableWrapper getTable(org.eclipse.datatools.modelbase.sql.tables.Table dtpTable) {
- // try to short-circuit the search
- return this.wraps(dtpTable.getSchema().getCatalog()) ?
- this.getTable_(dtpTable)
- :
- this.getDatabase().getTableFromCatalogs(dtpTable);
- }
-
- @Override
- DTPColumnWrapper getColumn(org.eclipse.datatools.modelbase.sql.tables.Column dtpColumn) {
- // try to short-circuit the search
- return this.wraps(dtpColumn.getTable().getSchema().getCatalog()) ?
- this.getColumn_(dtpColumn)
- :
- this.getDatabase().getColumnFromCatalogs(dtpColumn);
- }
-
-
- // ********** DatabaseObject implementation **********
-
- public String getName() {
- return this.dtpCatalog.getName();
- }
-
-
- // ********** Comparable implementation **********
-
- public int compareTo(Catalog catalog) {
- return Collator.getInstance().compare(this.getName(), catalog.getName());
- }
-
-
- // ********** internal methods **********
-
- boolean wraps(org.eclipse.datatools.modelbase.sql.schema.Catalog catalog) {
- return this.dtpCatalog == catalog;
- }
-
-}
diff --git a/jpa/plugins/org.eclipse.jpt.db/src/org/eclipse/jpt/db/internal/DTPColumnWrapper.java b/jpa/plugins/org.eclipse.jpt.db/src/org/eclipse/jpt/db/internal/DTPColumnWrapper.java
deleted file mode 100644
index c7590f34ff..0000000000
--- a/jpa/plugins/org.eclipse.jpt.db/src/org/eclipse/jpt/db/internal/DTPColumnWrapper.java
+++ /dev/null
@@ -1,241 +0,0 @@
-/*******************************************************************************
- * Copyright (c) 2006, 2008 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.
- *
- * Contributors:
- * Oracle - initial API and implementation
- ******************************************************************************/
-package org.eclipse.jpt.db.internal;
-
-import com.ibm.icu.text.Collator;
-import org.eclipse.datatools.modelbase.dbdefinition.PredefinedDataTypeDefinition;
-import org.eclipse.datatools.modelbase.sql.datatypes.CharacterStringDataType;
-import org.eclipse.datatools.modelbase.sql.datatypes.DataType;
-import org.eclipse.datatools.modelbase.sql.datatypes.ExactNumericDataType;
-import org.eclipse.datatools.modelbase.sql.datatypes.NumericalDataType;
-import org.eclipse.datatools.modelbase.sql.datatypes.PredefinedDataType;
-import org.eclipse.datatools.modelbase.sql.datatypes.PrimitiveType;
-import org.eclipse.jpt.db.Column;
-import org.eclipse.jpt.utility.JavaType;
-import org.eclipse.jpt.utility.internal.ClassTools;
-import org.eclipse.jpt.utility.internal.SimpleJavaType;
-
-/**
- * Wrap a DTP Column
- */
-final class DTPColumnWrapper
- extends DTPDatabaseObjectWrapper
- implements Column
-{
- // the wrapped DTP column
- private final org.eclipse.datatools.modelbase.sql.tables.Column dtpColumn;
-
-
- // ********** constructor **********
-
- DTPColumnWrapper(DTPTableWrapper table, org.eclipse.datatools.modelbase.sql.tables.Column dtpColumn) {
- super(table, dtpColumn);
- this.dtpColumn = dtpColumn;
- }
-
-
- // ********** DTPWrapper implementation **********
-
- @Override
- synchronized void catalogObjectChanged() {
- super.catalogObjectChanged();
- this.getConnectionProfile().columnChanged(this);
- }
-
-
- // ********** Column implementation **********
-
- public String getName() {
- return this.dtpColumn.getName();
- }
-
- public DTPTableWrapper getTable() {
- return (DTPTableWrapper) this.getParent();
- }
-
- public boolean isPartOfPrimaryKey() {
- return this.getTable().primaryKeyColumnsContains(this);
- }
-
- public boolean isPartOfForeignKey() {
- return this.getTable().foreignKeyBaseColumnsContains(this);
- }
-
- public boolean isPartOfUniqueConstraint() {
- return this.dtpColumn.isPartOfUniqueConstraint();
- }
-
- public boolean isNullable() {
- return this.dtpColumn.isNullable();
- }
-
- public String getDataTypeName() {
- DataType dataType = this.dtpColumn.getDataType();
- return (dataType == null) ? null : dataType.getName();
- }
-
- public boolean isNumeric() {
- return this.dtpColumn.getDataType() instanceof NumericalDataType;
- }
-
- public int getPrecision() {
- DataType dataType = this.dtpColumn.getDataType();
- return (dataType instanceof NumericalDataType) ?
- ((NumericalDataType) dataType).getPrecision()
- :
- -1;
- }
-
- public int getScale(){
- DataType dataType = this.dtpColumn.getDataType();
- return (dataType instanceof ExactNumericDataType) ?
- ((ExactNumericDataType) dataType).getScale()
- :
- -1;
- }
-
- public int getLength() {
- DataType dataType = this.dtpColumn.getDataType();
- return (dataType instanceof CharacterStringDataType) ?
- ((CharacterStringDataType) dataType).getLength()
- :
- -1;
- }
-
- public boolean isLOB() {
- DataType dataType = this.dtpColumn.getDataType();
- return (dataType instanceof PredefinedDataType) ?
- primitiveTypeIsLob(((PredefinedDataType) dataType).getPrimitiveType())
- :
- false;
- }
-
- public String getJavaTypeDeclaration() {
- return this.getJavaType().declaration();
- }
-
- public JavaType getJavaType() {
- DataType dataType = this.dtpColumn.getDataType();
- return (dataType instanceof PredefinedDataType) ?
- convertToJPAJavaType(this.getJavaType((PredefinedDataType) dataType))
- :
- DEFAULT_JAVA_TYPE;
- }
-
- public String getPrimaryKeyJavaTypeDeclaration() {
- return this.getPrimaryKeyJavaType().declaration();
- }
-
- public JavaType getPrimaryKeyJavaType() {
- return convertToJPAPrimaryKeyJavaType(this.getJavaType());
- }
-
- private JavaType getJavaType(PredefinedDataType dataType) {
- // this is just a bit hacky: moving from a type declaration to a class name to a type declaration...
- String dtpJavaClassName = this.getDefinition(dataType).getJavaClassName();
- return new SimpleJavaType(ClassTools.classNameForTypeDeclaration(dtpJavaClassName));
- }
-
- private PredefinedDataTypeDefinition getDefinition(PredefinedDataType dataType) {
- return this.getDatabase().getDTPDefinition().getPredefinedDataTypeDefinition(dataType.getName());
- }
-
-
- // ********** Comparable implementation **********
-
- public int compareTo(Column column) {
- return Collator.getInstance().compare(this.getName(), column.getName());
- }
-
-
- // ********** internal methods **********
-
- boolean wraps(org.eclipse.datatools.modelbase.sql.tables.Column column) {
- return this.dtpColumn == column;
- }
-
- @Override
- void clear() {
- // no state to clear
- }
-
-
- // ********** static methods **********
-
- /**
- * The JDBC spec says JDBC drivers should be able to map BLOBs and CLOBs
- * directly, but the JPA spec does not allow them.
- */
- private static JavaType convertToJPAJavaType(JavaType javaType) {
- if (javaType.equals(BLOB_JAVA_TYPE)) {
- return BYTE_ARRAY_JAVA_TYPE;
- }
- if (javaType.equals(CLOB_JAVA_TYPE)) {
- return STRING_JAVA_TYPE;
- }
- return javaType;
- }
-
- /**
- * The JPA spec [2.1.4] says only the following types are allowed in
- * primary key fields:
- * [variable] primitives
- * [variable] primitive wrappers
- * java.lang.String
- * java.util.Date
- * java.sql.Date
- */
- private static JavaType convertToJPAPrimaryKeyJavaType(JavaType javaType) {
- if (javaType.isVariablePrimitive()
- || javaType.isVariablePrimitiveWrapper()
- || javaType.equals(STRING_JAVA_TYPE)
- || javaType.equals(UTIL_DATE_JAVA_TYPE)
- || javaType.equals(SQL_DATE_JAVA_TYPE)) {
- return javaType;
- }
- if (javaType.equals(BIG_DECIMAL_JAVA_TYPE)) {
- return LONG_JAVA_TYPE; // ??
- }
- if (javaType.equals(SQL_TIME_JAVA_TYPE)) {
- return UTIL_DATE_JAVA_TYPE; // ???
- }
- if (javaType.equals(SQL_TIMESTAMP_JAVA_TYPE)) {
- return UTIL_DATE_JAVA_TYPE; // ???
- }
- // all the other typical types are pretty much un-mappable - return String(?)
- return STRING_JAVA_TYPE;
- }
-
- private static boolean primitiveTypeIsLob(PrimitiveType primitiveType) {
- return (primitiveType == PrimitiveType.BINARY_LARGE_OBJECT_LITERAL)
- || (primitiveType == PrimitiveType.CHARACTER_LARGE_OBJECT_LITERAL)
- || (primitiveType == PrimitiveType.NATIONAL_CHARACTER_LARGE_OBJECT_LITERAL);
- }
-
-
- // ***** some constants used when converting the column to a Java attribute
- // TODO Object is the default?
- private static final JavaType DEFAULT_JAVA_TYPE = new SimpleJavaType(java.lang.Object.class);
-
- private static final JavaType BLOB_JAVA_TYPE = new SimpleJavaType(java.sql.Blob.class);
- private static final JavaType BYTE_ARRAY_JAVA_TYPE = new SimpleJavaType(byte[].class);
-
- private static final JavaType CLOB_JAVA_TYPE = new SimpleJavaType(java.sql.Clob.class);
- private static final JavaType STRING_JAVA_TYPE = new SimpleJavaType(java.lang.String.class);
-
- private static final JavaType UTIL_DATE_JAVA_TYPE = new SimpleJavaType(java.util.Date.class);
- private static final JavaType SQL_DATE_JAVA_TYPE = new SimpleJavaType(java.sql.Date.class);
- private static final JavaType SQL_TIME_JAVA_TYPE = new SimpleJavaType(java.sql.Time.class);
- private static final JavaType SQL_TIMESTAMP_JAVA_TYPE = new SimpleJavaType(java.sql.Timestamp.class);
-
- private static final JavaType BIG_DECIMAL_JAVA_TYPE = new SimpleJavaType(java.math.BigDecimal.class);
- private static final JavaType LONG_JAVA_TYPE = new SimpleJavaType(long.class);
-
-}
diff --git a/jpa/plugins/org.eclipse.jpt.db/src/org/eclipse/jpt/db/internal/DTPConnectionProfileFactory.java b/jpa/plugins/org.eclipse.jpt.db/src/org/eclipse/jpt/db/internal/DTPConnectionProfileFactory.java
deleted file mode 100644
index 6e5df2860a..0000000000
--- a/jpa/plugins/org.eclipse.jpt.db/src/org/eclipse/jpt/db/internal/DTPConnectionProfileFactory.java
+++ /dev/null
@@ -1,165 +0,0 @@
-/*******************************************************************************
- * Copyright (c) 2006, 2008 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.
- *
- * Contributors:
- * Oracle - initial API and implementation
- ******************************************************************************/
-package org.eclipse.jpt.db.internal;
-
-import java.util.Iterator;
-
-import org.eclipse.datatools.connectivity.IConnectionProfile;
-import org.eclipse.datatools.connectivity.IProfileListener1;
-import org.eclipse.datatools.connectivity.ProfileManager;
-import org.eclipse.jpt.db.ConnectionProfile;
-import org.eclipse.jpt.db.ConnectionProfileFactory;
-import org.eclipse.jpt.db.ConnectionProfileListener;
-import org.eclipse.jpt.db.DatabaseFinder;
-import org.eclipse.jpt.utility.internal.ListenerList;
-import org.eclipse.jpt.utility.internal.iterators.ArrayIterator;
-import org.eclipse.jpt.utility.internal.iterators.TransformationIterator;
-
-/**
- * Wrap the DTP ProfileManager in yet another singleton.
- */
-public final class DTPConnectionProfileFactory
- implements ConnectionProfileFactory
-{
- private ProfileManager dtpProfileManager;
-
- private LocalProfileListener profileListener;
-
-
- // ********** singleton **********
-
- private static final DTPConnectionProfileFactory INSTANCE = new DTPConnectionProfileFactory();
-
- public static DTPConnectionProfileFactory instance() {
- return INSTANCE;
- }
-
- /**
- * 'private' to ensure singleton
- */
- private DTPConnectionProfileFactory() {
- super();
- }
-
-
- // ********** lifecycle **********
-
- /**
- * called by plug-in
- */
- public synchronized void start() {
- this.dtpProfileManager = ProfileManager.getInstance();
- this.profileListener = new LocalProfileListener();
- this.dtpProfileManager.addProfileListener(this.profileListener);
- }
-
- /**
- * called by plug-in
- */
- public synchronized void stop() {
- this.dtpProfileManager.removeProfileListener(this.profileListener);
- this.profileListener = null;
- this.dtpProfileManager = null;
- }
-
-
- // ********** connection profiles **********
-
- public ConnectionProfile buildConnectionProfile(String name, DatabaseFinder finder) {
- for (IConnectionProfile dtpProfile : this.dtpProfileManager.getProfiles()) {
- if (dtpProfile.getName().equals(name)) {
- return new DTPConnectionProfileWrapper(dtpProfile, finder);
- }
- }
- return null;
- }
-
- public ConnectionProfile buildConnectionProfile(String name) {
- return this.buildConnectionProfile(name, DatabaseFinder.Simple.instance());
- }
-
- public Iterator<String> connectionProfileNames() {
- return new TransformationIterator<IConnectionProfile, String>(this.dtpConnectionProfiles()) {
- @Override
- protected String transform(IConnectionProfile dtpProfile) {
- return dtpProfile.getName();
- }
- };
- }
-
- private Iterator<IConnectionProfile> dtpConnectionProfiles() {
- return new ArrayIterator<IConnectionProfile>(this.dtpProfileManager.getProfiles());
- }
-
-
- // ********** listeners **********
-
- public void addConnectionProfileListener(ConnectionProfileListener listener) {
- this.profileListener.addConnectionProfileListener(listener);
- }
-
- public void removeConnectionProfileListener(ConnectionProfileListener listener) {
- this.profileListener.removeConnectionProfileListener(listener);
- }
-
-
- // ********** listener **********
-
- /**
- * Forward events to the factory's listeners.
- */
- private class LocalProfileListener implements IProfileListener1 {
- private ListenerList<ConnectionProfileListener> listenerList = new ListenerList<ConnectionProfileListener>(ConnectionProfileListener.class);
-
- LocalProfileListener() {
- super();
- }
-
- void addConnectionProfileListener(ConnectionProfileListener listener) {
- this.listenerList.add(listener);
- }
-
- void removeConnectionProfileListener(ConnectionProfileListener listener) {
- this.listenerList.remove(listener);
- }
-
- // ********** IProfileListener implementation **********
-
- public void profileAdded(IConnectionProfile dtpProfile) {
- String name = dtpProfile.getName();
- for (ConnectionProfileListener listener : this.listenerList.getListeners()) {
- listener.connectionProfileAdded(name);
- }
- }
-
- public void profileChanged(IConnectionProfile dtpProfile, String oldName, String oldDescription, Boolean oldAutoConnect) {
- String newName = dtpProfile.getName();
- if ( ! newName.equals(oldName)) {
- for (ConnectionProfileListener listener : this.listenerList.getListeners()) {
- listener.connectionProfileRenamed(oldName, newName);
- }
- }
- }
-
- public void profileChanged(IConnectionProfile dtpProfile) {
- // this method shouldn't be called on IProfileListener1
- throw new UnsupportedOperationException();
- }
-
- public void profileDeleted(IConnectionProfile dtpProfile) {
- String name = dtpProfile.getName();
- for (ConnectionProfileListener listener : this.listenerList.getListeners()) {
- listener.connectionProfileRemoved(name);
- }
- }
-
- }
-
-}
diff --git a/jpa/plugins/org.eclipse.jpt.db/src/org/eclipse/jpt/db/internal/DTPConnectionProfileWrapper.java b/jpa/plugins/org.eclipse.jpt.db/src/org/eclipse/jpt/db/internal/DTPConnectionProfileWrapper.java
deleted file mode 100644
index c230504664..0000000000
--- a/jpa/plugins/org.eclipse.jpt.db/src/org/eclipse/jpt/db/internal/DTPConnectionProfileWrapper.java
+++ /dev/null
@@ -1,557 +0,0 @@
-/*******************************************************************************
- * Copyright (c) 2006, 2008 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.
- *
- * Contributors:
- * Oracle - initial API and implementation
- ******************************************************************************/
-package org.eclipse.jpt.db.internal;
-
-import com.ibm.icu.text.Collator;
-
-import org.eclipse.core.runtime.IStatus;
-import org.eclipse.datatools.connectivity.ConnectEvent;
-import org.eclipse.datatools.connectivity.IConnectionProfile;
-import org.eclipse.datatools.connectivity.IManagedConnection;
-import org.eclipse.datatools.connectivity.IManagedConnectionOfflineListener;
-import org.eclipse.datatools.connectivity.drivers.DriverManager;
-import org.eclipse.datatools.connectivity.drivers.jdbc.IJDBCDriverDefinitionConstants;
-import org.eclipse.datatools.connectivity.sqm.core.connection.ConnectionInfo;
-import org.eclipse.datatools.sqltools.core.DatabaseIdentifier;
-import org.eclipse.datatools.sqltools.core.profile.ProfileUtil;
-import org.eclipse.jpt.db.ConnectionListener;
-import org.eclipse.jpt.db.ConnectionProfile;
-import org.eclipse.jpt.db.DatabaseFinder;
-import org.eclipse.jpt.db.DatabaseObject;
-import org.eclipse.jpt.utility.internal.ListenerList;
-import org.eclipse.jpt.utility.internal.StringTools;
-
-/**
- * Wrap a DTP ConnectionProfile
- */
-final class DTPConnectionProfileWrapper
- implements DTPDatabaseObject, ConnectionProfile
-{
- // the wrapped DTP connection profile
- private final IConnectionProfile dtpConnectionProfile;
-
- // finder supplied by the JPA platform (determines case-sensitivity, etc.)
- private final DatabaseFinder finder;
-
- // callback passed to the finder
- private final DatabaseFinder.DefaultCallback databaseFinderCallback;
-
- // the DTP managed connection we listen to
- private final IManagedConnection dtpManagedConnection;
-
- // forward events from the DTP managed connection above;
- // we listen and propagate events iff we have listeners ourselves
- private final LocalConnectionListener connectionListener;
-
- // lazy-initialized, and deleted at disconnect
- private DTPDatabaseWrapper database;
-
-
- // ********** constants **********
-
- private static final String LIVE_DTP_CONNECTION_TYPE = "java.sql.Connection"; //$NON-NLS-1$
-
- private static final String OFFLINE_DTP_CONNECTION_TYPE = ConnectionInfo.class.getName();
-
- private static final String DATABASE_PRODUCT_PROP_ID = "org.eclipse.datatools.connectivity.server.version"; //$NON-NLS-1$
-
-
- // ********** constructor **********
-
- DTPConnectionProfileWrapper(IConnectionProfile dtpConnectionProfile, DatabaseFinder finder) {
- super();
- this.dtpConnectionProfile = dtpConnectionProfile;
- this.finder = finder;
- this.databaseFinderCallback = new DatabaseFinderCallback();
- this.dtpManagedConnection = this.buildDTPManagedConnection();
- this.connectionListener = new LocalConnectionListener();
- // don't listen to the managed connection yet
- }
-
- private IManagedConnection buildDTPManagedConnection() {
- String connectionType = this.dtpConnectionProfile.supportsWorkOfflineMode() ?
- OFFLINE_DTP_CONNECTION_TYPE : LIVE_DTP_CONNECTION_TYPE;
- return this.dtpConnectionProfile.getManagedConnection(connectionType);
- }
-
-
- // ********** DatabaseObject implementation **********
-
- public String getName() {
- return this.dtpConnectionProfile.getName();
- }
-
- public String getIdentifier(String javaIdentifier) {
- // connection profiles do not have "identifiers"
- throw new UnsupportedOperationException();
- }
-
- public String getIdentifier() {
- // connection profiles do not have "identifiers"
- throw new UnsupportedOperationException();
- }
-
-
- // ********** DTPDatabaseObject implementation **********
-
- public DTPConnectionProfileWrapper getConnectionProfile() {
- return this;
- }
-
- public synchronized DTPDatabaseWrapper getDatabase() {
- if (this.database == null) {
- this.database = this.buildDatabase();
- }
- return this.database;
- }
-
-
- // ********** ConnectionProfile implementation **********
-
- // ***** properties
- public String getProviderID() {
- return this.dtpConnectionProfile.getProviderId();
- }
-
- public String getInstanceID() {
- return this.dtpConnectionProfile.getInstanceID();
- }
-
- public String getDatabaseName() {
- return this.getProperty(IJDBCDriverDefinitionConstants.DATABASE_NAME_PROP_ID);
- }
-
- public String getDatabaseProduct() {
- return this.getProperty(DATABASE_PRODUCT_PROP_ID);
- }
-
- public String getDatabaseVendor() {
- return this.getProperty(IJDBCDriverDefinitionConstants.DATABASE_VENDOR_PROP_ID);
- }
-
- public String getDatabaseVersion() {
- return this.getProperty(IJDBCDriverDefinitionConstants.DATABASE_VERSION_PROP_ID);
- }
-
- public String getDriverClassName() {
- return this.getProperty(IJDBCDriverDefinitionConstants.DRIVER_CLASS_PROP_ID);
- }
-
- public String getURL() {
- return this.getProperty(IJDBCDriverDefinitionConstants.URL_PROP_ID);
- }
-
- /**
- * Returns the user name.
- * Allows user name composed by more than one word.
- * If the user name contains a keyword, it returns the first word only.
- */
- public String getUserName() {
- String userName = this.getProperty(IJDBCDriverDefinitionConstants.USERNAME_PROP_ID);
- userName = userName.trim();
- String[] names = userName.split("\\s+"); //$NON-NLS-1$
- if(names.length == 3) { // 208946 handle username like "sys as sysdba" on Oracle
- if(this.nameIsKeyword(names[1])) {
- return names[0];
- }
- }
- return userName;
- }
-
- public String getUserPassword() {
- return this.getProperty(IJDBCDriverDefinitionConstants.PASSWORD_PROP_ID);
- }
-
- public String getDriverDefinitionID() {
- return this.getProperty(DRIVER_DEFINITION_PROP_ID);
- }
-
- public String getDriverJarList() {
- return DriverManager.getInstance().getDriverInstanceByID(this.getDriverDefinitionID()).getJarList();
- }
-
- public String getDriverName() {
- return DriverManager.getInstance().getDriverInstanceByID(this.getDriverDefinitionID()).getName();
- }
-
- // ***** connection
- public boolean isActive() {
- return this.isConnected() || this.isWorkingOffline();
- }
-
- public boolean isInactive() {
- return ! this.isActive();
- }
-
- public boolean isConnected() {
- return this.dtpManagedConnection.isConnected()
- && ! this.dtpManagedConnection.isWorkingOffline();
- }
-
- public boolean isDisconnected() {
- return ! this.isConnected();
- }
-
- public void connect() {
- if (this.isDisconnected()) {
- this.checkStatus(this.dtpConnectionProfile.connect());
- }
- }
-
- public void disconnect() {
- this.checkStatus(this.dtpConnectionProfile.disconnect());
- }
-
- // ***** off-line support
- public boolean isWorkingOffline() {
- return this.dtpManagedConnection.isWorkingOffline();
- }
-
- public boolean supportsWorkOfflineMode() {
- return this.dtpConnectionProfile.supportsWorkOfflineMode();
- }
-
- public IStatus saveWorkOfflineData() {
- return this.dtpConnectionProfile.saveWorkOfflineData();
- }
-
- public boolean canWorkOffline() {
- return this.dtpConnectionProfile.canWorkOffline();
- }
-
- public IStatus workOffline() {
- return this.dtpConnectionProfile.workOffline();
- }
-
- // ***** listeners
- public synchronized void addConnectionListener(ConnectionListener listener) {
- if (this.hasNoListeners()) { // first listener added
- this.startListening();
- }
- this.connectionListener.addConnectionListener(listener);
- }
-
- private void startListening() {
- this.dtpManagedConnection.addConnectionListener(this.connectionListener);
- if (this.database != null) { // don't trigger database creation
- if (this.isConnected()) { // DTP does not change when off-line
- this.database.startListening();
- }
- }
- }
-
- public synchronized void removeConnectionListener(ConnectionListener listener) {
- this.connectionListener.removeConnectionListener(listener);
- if (this.hasNoListeners()) { // last listener removed
- this.stopListening();
- }
- }
-
- private void stopListening() {
- if (this.database != null) { // don't trigger database creation
- if (this.isConnected()) { // DTP does not change when off-line
- this.database.stopListening();
- }
- }
- this.dtpManagedConnection.removeConnectionListener(this.connectionListener);
- }
-
- boolean hasNoListeners() {
- return this.connectionListener.hasNoListeners();
- }
-
- boolean hasAnyListeners() {
- return this.connectionListener.hasAnyListeners();
- }
-
-
- // ********** internal methods **********
-
- private void checkStatus(IStatus status) {
- if (status.isOK()) {
- return;
- }
- if (status.isMultiStatus()) {
- for (IStatus child : status.getChildren()) {
- this.checkStatus(child); // recurse, looking for the first error
- }
- }
- throw new RuntimeException(status.getMessage(), status.getException());
- }
-
- private DTPDatabaseWrapper buildDatabase() {
- if (this.isInactive()) {
- return null;
- }
-
- if (this.isWorkingOffline()) {
- ConnectionInfo connectionInfo = (ConnectionInfo) this.dtpManagedConnection.getConnection().getRawConnection();
- return new DTPDatabaseWrapper(this, connectionInfo.getSharedDatabase());
- }
-
- // TODO see DTP bug 202306
- // pass connect=true in to ProfileUtil.getDatabase()
- // there is a bug mentioned in a comment:
- // "during the profile connected event notification,
- // IManagedConnection is connected while IConnectionProfile is not"
- // so, some hackery here to handle hackery there
- return new DTPDatabaseWrapper(this, ProfileUtil.getDatabase(new DatabaseIdentifier(this.getName(), this.getDatabaseName()), true));
- }
-
- synchronized void clearDatabase() {
- if (this.database != null) {
- if (this.isConnected()) { // DTP does not change when off-line
- this.database.stopListening();
- }
- this.database = null;
- }
- }
-
- /**
- * This is called whenever we need to find a component by identifier
- * (e.g. Table.getColumnForIdentifier(String)). We channel all the calls to here
- * and then we delegate to the JPA platform-supplied "database finder".
- */
- <T extends DatabaseObject> T selectDatabaseObjectForIdentifier(T[] databaseObjects, String identifier) {
- return this.finder.selectDatabaseObjectForIdentifier(databaseObjects, identifier, this.databaseFinderCallback);
- }
-
- /**
- * The default "database finder" calls back to here so we can delegate to
- * the database, which contains all the information necessary to properly
- * match identifiers.
- */
- <T extends DatabaseObject> T selectDatabaseObjectForIdentifier_(T[] databaseObjects, String identifier) {
- // the database should not be null here - call its internal method
- return this.database.selectDatabaseObjectForIdentifier_(databaseObjects, identifier);
- }
-
- void databaseChanged(DTPDatabaseWrapper db) {
- this.connectionListener.databaseChanged(db);
- }
-
- void catalogChanged(DTPCatalogWrapper catalog) {
- this.connectionListener.catalogChanged(catalog);
- }
-
- void schemaChanged(DTPSchemaWrapper schema) {
- this.connectionListener.schemaChanged(schema);
- }
-
- void sequenceChanged(DTPSequenceWrapper sequence) {
- this.connectionListener.sequenceChanged(sequence);
- }
-
- void tableChanged(DTPTableWrapper table) {
- this.connectionListener.tableChanged(table);
- }
-
- void columnChanged(DTPColumnWrapper column) {
- this.connectionListener.columnChanged(column);
- }
-
- void foreignKeyChanged(DTPForeignKeyWrapper foreignKey) {
- this.connectionListener.foreignKeyChanged(foreignKey);
- }
-
- private String getProperty(String propertyName) {
- return this.dtpConnectionProfile.getBaseProperties().getProperty(propertyName);
- }
-
- private boolean nameIsKeyword(String name) {
- return name.equalsIgnoreCase("as"); //$NON-NLS-1$
- }
-
-
- // ********** Comparable implementation **********
-
- public int compareTo(ConnectionProfile connectionProfile) {
- return Collator.getInstance().compare(this.getName(), connectionProfile.getName());
- }
-
-
- // ********** overrides **********
-
- @Override
- public String toString() {
- return StringTools.buildToStringFor(this, this.getName());
- }
-
-
- // ********** DTP connection listener **********
-
- /**
- * This listener translates and forwards IManagedConnectionListener and
- * IManagedConnectionOfflineListener events to ConnectionListeners.
- */
- class LocalConnectionListener implements IManagedConnectionOfflineListener {
- private ListenerList<ConnectionListener> listenerList = new ListenerList<ConnectionListener>(ConnectionListener.class);
-
- LocalConnectionListener() {
- super();
- }
-
- void addConnectionListener(ConnectionListener listener) {
- this.listenerList.add(listener);
- }
-
- void removeConnectionListener(ConnectionListener listener) {
- this.listenerList.remove(listener);
- }
-
- boolean hasNoListeners() {
- return this.listenerList.isEmpty();
- }
-
- boolean hasAnyListeners() {
- return ! this.listenerList.isEmpty();
- }
-
-
- // ********** IManagedConnectionListener implementation **********
-
- // off-line or inactive => live
- public void opened(ConnectEvent event) {
- // do not build the database here - it is built on-demand
- // forward event to listeners
- for (ConnectionListener listener : this.listenerList.getListeners()) {
- listener.opened(DTPConnectionProfileWrapper.this);
- }
- }
-
- /**
- * This method is never called from the base DTP code.
- * Perhaps DTP extenders call it....
- * @see ManagedConnection#fireModifiedEvent(Object)
- * which is never called...
- */
- public void modified(ConnectEvent event) {
- // forward event to listeners
- for (ConnectionListener listener : this.listenerList.getListeners()) {
- listener.modified(DTPConnectionProfileWrapper.this);
- }
- }
-
- public boolean okToClose(ConnectEvent event) {
- // forward event to listeners
- for (ConnectionListener listener : this.listenerList.getListeners()) {
- if ( ! listener.okToClose(DTPConnectionProfileWrapper.this)) {
- return false;
- }
- }
- return true;
- }
-
- public void aboutToClose(ConnectEvent event) {
- // forward event to listeners
- for (ConnectionListener listener : this.listenerList.getListeners()) {
- listener.aboutToClose(DTPConnectionProfileWrapper.this);
- }
- }
-
- // live or off-line => inactive
- public void closed(ConnectEvent event) {
- // clear the database
- DTPConnectionProfileWrapper.this.clearDatabase();
- // forward event to listeners
- for (ConnectionListener listener : this.listenerList.getListeners()) {
- listener.closed(DTPConnectionProfileWrapper.this);
- }
- }
-
-
- // ********** IManagedConnectionOfflineListener implementation **********
-
- // live => off-line
- public boolean okToDetach(ConnectEvent event) {
- // convert the event to an "ok to close" event;
- // we are "closing" the live connection
- return this.okToClose(event);
- }
-
- // live => off-line
- public void aboutToDetach(ConnectEvent event) {
- // convert the event to a "close" event;
- // we are "closing" the live connection
- this.closed(event);
- }
-
- // inactive or live => off-line
- public void workingOffline(ConnectEvent event) {
- // convert the event to an "open" event;
- // we are "opening" the off-line connection
- this.opened(event);
- }
-
- // off-line => live
- public void aboutToAttach(ConnectEvent event) {
- // convert the event to an "close" event;
- // we are "closing" the off-line connection
- this.closed(event);
- }
-
-
- // ********** internal methods **********
-
- void databaseChanged(DTPDatabaseWrapper db) {
- for (ConnectionListener listener : this.listenerList.getListeners()) {
- listener.databaseChanged(DTPConnectionProfileWrapper.this, db);
- }
- }
-
- void catalogChanged(DTPCatalogWrapper catalog) {
- for (ConnectionListener listener : this.listenerList.getListeners()) {
- listener.catalogChanged(DTPConnectionProfileWrapper.this, catalog);
- }
- }
-
- void schemaChanged(DTPSchemaWrapper schema) {
- for (ConnectionListener listener : this.listenerList.getListeners()) {
- listener.schemaChanged(DTPConnectionProfileWrapper.this, schema);
- }
- }
-
- void sequenceChanged(DTPSequenceWrapper sequence) {
- for (ConnectionListener listener : this.listenerList.getListeners()) {
- listener.sequenceChanged(DTPConnectionProfileWrapper.this, sequence);
- }
- }
-
- void tableChanged(DTPTableWrapper table) {
- for (ConnectionListener listener : this.listenerList.getListeners()) {
- listener.tableChanged(DTPConnectionProfileWrapper.this, table);
- }
- }
-
- void columnChanged(DTPColumnWrapper column) {
- for (ConnectionListener listener : this.listenerList.getListeners()) {
- listener.columnChanged(DTPConnectionProfileWrapper.this, column);
- }
- }
-
- void foreignKeyChanged(DTPForeignKeyWrapper foreignKey) {
- for (ConnectionListener listener : this.listenerList.getListeners()) {
- listener.foreignKeyChanged(DTPConnectionProfileWrapper.this, foreignKey);
- }
- }
-
- }
-
-
- // ********** default DatabaseFinder **********
-
- class DatabaseFinderCallback implements DatabaseFinder.DefaultCallback {
- public <T extends DatabaseObject> T selectDatabaseObjectForIdentifier(T[] databaseObjects, String identifier) {
- // call back to the internal method
- return DTPConnectionProfileWrapper.this.selectDatabaseObjectForIdentifier_(databaseObjects, identifier);
- }
- }
-
-}
diff --git a/jpa/plugins/org.eclipse.jpt.db/src/org/eclipse/jpt/db/internal/DTPDatabaseObject.java b/jpa/plugins/org.eclipse.jpt.db/src/org/eclipse/jpt/db/internal/DTPDatabaseObject.java
deleted file mode 100644
index c976fe4b39..0000000000
--- a/jpa/plugins/org.eclipse.jpt.db/src/org/eclipse/jpt/db/internal/DTPDatabaseObject.java
+++ /dev/null
@@ -1,24 +0,0 @@
-/*******************************************************************************
- * Copyright (c) 2008 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.
- *
- * Contributors:
- * Oracle - initial API and implementation
- ******************************************************************************/
-package org.eclipse.jpt.db.internal;
-
-import org.eclipse.jpt.db.DatabaseObject;
-
-/**
- * DTP database object
- */
-public interface DTPDatabaseObject extends DatabaseObject {
-
- /**
- * covariant override
- */
- DTPConnectionProfileWrapper getConnectionProfile();
-
-}
diff --git a/jpa/plugins/org.eclipse.jpt.db/src/org/eclipse/jpt/db/internal/DTPDatabaseObjectWrapper.java b/jpa/plugins/org.eclipse.jpt.db/src/org/eclipse/jpt/db/internal/DTPDatabaseObjectWrapper.java
deleted file mode 100644
index 86d2d2cce3..0000000000
--- a/jpa/plugins/org.eclipse.jpt.db/src/org/eclipse/jpt/db/internal/DTPDatabaseObjectWrapper.java
+++ /dev/null
@@ -1,190 +0,0 @@
-/*******************************************************************************
- * Copyright (c) 2006, 2009 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.
- *
- * Contributors:
- * Oracle - initial API and implementation
- ******************************************************************************/
-package org.eclipse.jpt.db.internal;
-
-import org.eclipse.datatools.connectivity.sqm.core.rte.ICatalogObject;
-import org.eclipse.datatools.connectivity.sqm.core.rte.ICatalogObjectListener;
-import org.eclipse.datatools.connectivity.sqm.core.rte.RefreshManager;
-import org.eclipse.jpt.db.DatabaseObject;
-import org.eclipse.jpt.utility.internal.StringTools;
-
-/**
- * DTP Catalog Object Wrapper base class
- */
-abstract class DTPDatabaseObjectWrapper
- implements DTPDatabaseObject
-{
- // we need a way to get to the connection profile
- private final DTPDatabaseObject parent;
-
- // listen for the "catalog object" being refreshed
- private final ICatalogObjectListener catalogObjectListener;
-
- // listen for this DTP catalog object to refresh
- final ICatalogObject catalogObject;
-
-
- // ********** construction/initialization **********
-
- DTPDatabaseObjectWrapper(DTPDatabaseObject parent, Object dtpObject) {
- super();
- this.parent = parent;
- if (this.getConnectionProfile().isConnected()) {
- // we only listen to "live" connections (as opposed to "off-line" connections);
- // and the model is rebuilt when the connection connects or disconnects
- this.catalogObject = (ICatalogObject) dtpObject;
- this.catalogObjectListener = this.buildCatalogObjectListener();
- if (this.getConnectionProfile().hasAnyListeners()) {
- this.startListening();
- }
- } else {
- this.catalogObject = null;
- this.catalogObjectListener = null;
- }
- }
-
- private ICatalogObjectListener buildCatalogObjectListener() {
- return new ICatalogObjectListener() {
- public void notifyChanged(ICatalogObject dmElement, int eventType) {
- if (dmElement == DTPDatabaseObjectWrapper.this.catalogObject) {
- // 'eventType' doesn't seem to be very useful, so drop it
- DTPDatabaseObjectWrapper.this.catalogObjectChanged();
- }
- }
- };
- }
-
- // typically, notify the connection profile something has changed
- void catalogObjectChanged() {
- this.clear();
- }
-
- /**
- * The DTP object has changed, clear the wrapper's state so it will be
- * synchronized on-demand.
- */
- abstract void clear();
-
-
-
- // ********** queries **********
-
- DTPDatabaseObject getParent() {
- return this.parent;
- }
-
- public DTPConnectionProfileWrapper getConnectionProfile() {
- return this.parent.getConnectionProfile();
- }
-
- public DTPDatabaseWrapper getDatabase() {
- return this.getConnectionProfile().getDatabase();
- }
-
- /**
- * This is called by whenever we need to find a component by identifier
- * (e.g. Table.getColumnForIdentifier(String)). We channel all the calls to the
- * connection profile, which then delegates to the JPA platform-supplied
- * "database finder".
- */
- <T extends DatabaseObject> T selectDatabaseObjectForIdentifier(T[] databaseObjects, String identifier) {
- return this.getConnectionProfile().selectDatabaseObjectForIdentifier(databaseObjects, identifier);
- }
-
- /**
- * Convenience method.
- */
- <T extends DatabaseObject> T selectDatabaseObjectNamed(T[] databaseObjects, String name) {
- for (T dbObject : databaseObjects) {
- if (dbObject.getName().equals(name)) {
- return dbObject;
- }
- }
- return null;
- }
-
- /**
- * Examples:
- * Oracle etc.
- * Table(FOO) vs. "Foo" => null
- * Table(BAR) vs. "Foo" => "BAR"
- * Table(Foo) vs. "Foo" => "\"Foo\""
- * Table(Bar) vs. "Foo" => "\"Bar\""
- *
- * PostgreSQL etc.
- * Table(foo) vs. "Foo" => null
- * Table(bar) vs. "Foo" => "bar"
- * Table(Foo) vs. "Foo" => "\"Foo\""
- * Table(Bar) vs. "Foo" => "\"Bar\""
- *
- * SQL Server etc.
- * Table(Foo) vs. "Foo" => null
- * Table(foo) vs. "Foo" => "foo"
- * Table(bar) vs. "Foo" => "bar"
- * Table(Bar) vs. "Foo" => "Bar"
- */
- public String getIdentifier(String defaultName) {
- return this.getDatabase().convertNameToIdentifier(this.getName(), defaultName);
- }
-
- /**
- * Examples:
- * Oracle etc.
- * Table(FOO) => "FOO"
- * Table(Foo) => "\"Foo\""
- * Table(foo) => "\"foo\""
- * Table(foo++) => "\"foo++\""
- * Table(f"o) => "\"f\"\"o++\"" (i.e. "f""o")
- *
- * PostgreSQL etc.
- * Table(FOO) => "\"FOO\""
- * Table(Foo) => "\"Foo\""
- * Table(foo) => "foo"
- * Table(foo++) => "\"foo++\""
- * Table(f"o) => "\"f\"\"o++\"" (i.e. "f""o")
- *
- * SQL Server etc.
- * Table(FOO) => "FOO"
- * Table(Foo) => "Foo"
- * Table(foo) => "foo"
- * Table(foo++) => "\"foo++\""
- * Table(f"o) => "\"f\"\"o++\"" (i.e. "f""o")
- */
- public String getIdentifier() {
- return this.getDatabase().convertNameToIdentifier(this.getName());
- }
-
- @Override
- public String toString() {
- return StringTools.buildToStringFor(this, this.getName());
- }
-
-
- // ********** listening to DTP database object **********
-
- // this should only be called when the connection profile is "live" and has listeners
- void startListening() {
- this.checkListener();
- RefreshManager.getInstance().AddListener(this.catalogObject, this.catalogObjectListener);
- }
-
- // this should only be called when the connection profile is "live" and has no listeners
- void stopListening() {
- this.checkListener();
- RefreshManager.getInstance().removeListener(this.catalogObject, this.catalogObjectListener);
- }
-
- private void checkListener() {
- if (this.catalogObjectListener == null) {
- throw new IllegalStateException("the catalog listener is null"); //$NON-NLS-1$
- }
- }
-
-}
diff --git a/jpa/plugins/org.eclipse.jpt.db/src/org/eclipse/jpt/db/internal/DTPDatabaseWrapper.java b/jpa/plugins/org.eclipse.jpt.db/src/org/eclipse/jpt/db/internal/DTPDatabaseWrapper.java
deleted file mode 100644
index a21bb3eefa..0000000000
--- a/jpa/plugins/org.eclipse.jpt.db/src/org/eclipse/jpt/db/internal/DTPDatabaseWrapper.java
+++ /dev/null
@@ -1,382 +0,0 @@
-/*******************************************************************************
- * Copyright (c) 2006, 2009 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.
- *
- * Contributors:
- * Oracle - initial API and implementation
- ******************************************************************************/
-package org.eclipse.jpt.db.internal;
-
-import com.ibm.icu.text.Collator;
-import java.util.Iterator;
-import java.util.List;
-
-import org.eclipse.datatools.connectivity.sqm.core.definition.DatabaseDefinition;
-import org.eclipse.datatools.connectivity.sqm.internal.core.RDBCorePlugin;
-import org.eclipse.jpt.db.Catalog;
-import org.eclipse.jpt.db.Database;
-import org.eclipse.jpt.db.DatabaseObject;
-import org.eclipse.jpt.db.internal.vendor.Vendor;
-import org.eclipse.jpt.db.internal.vendor.VendorRepository;
-import org.eclipse.jpt.utility.internal.CollectionTools;
-import org.eclipse.jpt.utility.internal.iterators.ArrayIterator;
-import org.eclipse.jpt.utility.internal.iterators.TransformationIterator;
-
-/**
- * Wrap a DTP Database.
- *
- * Catalogs vs. Schemata:
- * Typically, if a DTP database does not support "catalogs",
- * o.e.datatools.modelbase.sql.schema.Database#getCatalogs() will return a
- * single catalog without a name (actually, it's an empty string). This catalog
- * will contain all the database's schemata. We try to ignore this catalog and
- * return the schemata from the database directly.
- *
- * Catalog Note 1:
- * As of Jan 2009, the DTP MySQL driver is not consistent with this pattern.
- * A DTP MySQL database has *no* catalogs; it holds a single schema
- * directly, and that schema has the same name as the database. See bug 249013.
- *
- * Catalog Note 2:
- * As of Jan 2009, the PostgreSQL JDBC driver complicates this pattern a bit.
- * Even though PostgreSQL does not support "catalogs", its JDBC driver
- * returns a single catalog that has the same name as the database specified
- * in the JDBC connection URL. The DTP PostgreSQL driver simply replicates this
- * behavior. Unfortunately, this catalog can be unnamed; i.e. its name is an
- * empty string....
- *
- * (Yet Another) Note:
- * We use "name" when dealing with the unmodified name of a database object
- * as supplied by the database itself (i.e. it is not delimited and it is always
- * case-sensitive).
- * We use "identifier" when dealing with a string representation of a database
- * object name (i.e. it may be delimited and, depending on the vendor, it may
- * be case-insensitive).
- */
-final class DTPDatabaseWrapper
- extends DTPSchemaContainerWrapper
- implements Database
-{
- // the wrapped DTP database
- private final org.eclipse.datatools.modelbase.sql.schema.Database dtpDatabase;
-
- // vendor-specific behavior
- private final Vendor vendor;
-
- // lazy-initialized, sorted
- private DTPCatalogWrapper[] catalogs;
-
-
- // ********** constructor **********
-
- DTPDatabaseWrapper(DTPConnectionProfileWrapper connectionProfile, org.eclipse.datatools.modelbase.sql.schema.Database dtpDatabase) {
- super(connectionProfile, dtpDatabase);
- this.dtpDatabase = dtpDatabase;
- this.vendor = VendorRepository.instance().getVendor(this.getVendorName());
- }
-
-
- // ********** DTPWrapper implementation **********
-
- /* TODO
- * We might want to listen to the "virtual" catalog; but that's probably
- * not necessary since there is no easy way for the user to refresh it
- * (i.e. it is not displayed in the DTP UI).
- */
- @Override
- synchronized void catalogObjectChanged() {
- super.catalogObjectChanged();
- this.getConnectionProfile().databaseChanged(this);
- }
-
- @Override
- public DTPDatabaseWrapper getDatabase() {
- return this;
- }
-
-
- // ********** DTPSchemaContainerWrapper implementation **********
-
- @Override
- List<org.eclipse.datatools.modelbase.sql.schema.Schema> getDTPSchemata() {
- return this.vendor.getSchemas(this.dtpDatabase);
- }
-
- @Override
- DTPSchemaWrapper getSchema(org.eclipse.datatools.modelbase.sql.schema.Schema dtpSchema) {
- return this.getSchema_(dtpSchema);
- }
-
- DTPSchemaWrapper getSchemaFromCatalogs(org.eclipse.datatools.modelbase.sql.schema.Schema dtpSchema) {
- return this.getCatalog(dtpSchema.getCatalog()).getSchema_(dtpSchema);
- }
-
- /**
- * this is only called from a schema when the database is the schema
- * container, so we know we don't have any catalogs
- */
- @Override
- DTPTableWrapper getTable(org.eclipse.datatools.modelbase.sql.tables.Table dtpTable) {
- return this.getTable_(dtpTable);
- }
-
- /**
- * this is only called from a catalog, so we know we have catalogs;
- * i.e. the search has to descend through catalogs, then to schemata
- */
- DTPTableWrapper getTableFromCatalogs(org.eclipse.datatools.modelbase.sql.tables.Table dtpTable) {
- return this.getCatalog(dtpTable.getSchema().getCatalog()).getTable_(dtpTable);
- }
-
- /**
- * this is only called from a schema when the database is the schema
- * container, so we know we don't have any catalogs
- */
- @Override
- DTPColumnWrapper getColumn(org.eclipse.datatools.modelbase.sql.tables.Column dtpColumn) {
- return this.getColumn_(dtpColumn);
- }
-
- /**
- * this is only called from a catalog, so we know we have catalogs;
- * i.e. the search has to descend through catalogs, then to schemata
- */
- DTPColumnWrapper getColumnFromCatalogs(org.eclipse.datatools.modelbase.sql.tables.Column dtpColumn) {
- return this.getCatalog(dtpColumn.getTable().getSchema().getCatalog()).getColumn_(dtpColumn);
- }
-
-
- // ********** DatabaseObject implementation **********
-
- public String getName() {
- return this.dtpDatabase.getName();
- }
-
-
- // ********** Database implementation **********
-
- public String getVendorName() {
- return this.dtpDatabase.getVendor();
- }
-
- public String getVersion() {
- return this.dtpDatabase.getVersion();
- }
-
- // override to make method public since it's in the Database interface
- @Override
- public <T extends DatabaseObject> T selectDatabaseObjectForIdentifier(T[] databaseObjects, String identifier) {
- return super.selectDatabaseObjectForIdentifier(databaseObjects, identifier);
- }
-
- // ***** catalogs
-
- public boolean supportsCatalogs() {
- return this.vendor.supportsCatalogs(this.dtpDatabase);
- }
-
- public Iterator<Catalog> catalogs() {
- return new ArrayIterator<Catalog>(this.getCatalogs());
- }
-
- private Iterator<DTPCatalogWrapper> catalogWrappers() {
- return new ArrayIterator<DTPCatalogWrapper>(this.getCatalogs());
- }
-
- private synchronized DTPCatalogWrapper[] getCatalogs() {
- if (this.catalogs == null) {
- this.catalogs = this.buildCatalogs();
- }
- return this.catalogs;
- }
-
- private DTPCatalogWrapper[] buildCatalogs() {
- List<org.eclipse.datatools.modelbase.sql.schema.Catalog> dtpCatalogs = this.getDTPCatalogs();
- DTPCatalogWrapper[] result = new DTPCatalogWrapper[dtpCatalogs.size()];
- for (int i = result.length; i-- > 0;) {
- result[i] = new DTPCatalogWrapper(this, dtpCatalogs.get(i));
- }
- return CollectionTools.sort(result);
- }
-
- private List<org.eclipse.datatools.modelbase.sql.schema.Catalog> getDTPCatalogs() {
- return this.vendor.getCatalogs(this.dtpDatabase);
- }
-
- public int catalogsSize() {
- return this.getCatalogs().length;
- }
-
- /**
- * return the catalog for the specified DTP catalog
- */
- DTPCatalogWrapper getCatalog(org.eclipse.datatools.modelbase.sql.schema.Catalog dtpCatalog) {
- for (DTPCatalogWrapper catalog : this.getCatalogs()) {
- if (catalog.wraps(dtpCatalog)) {
- return catalog;
- }
- }
- throw new IllegalArgumentException("invalid DTP catalog: " + dtpCatalog); //$NON-NLS-1$
- }
-
- public Iterator<String> sortedCatalogNames() {
- // the catalogs are already sorted
- return new TransformationIterator<DTPCatalogWrapper, String>(this.catalogWrappers()) {
- @Override
- protected String transform(DTPCatalogWrapper next) {
- return next.getName();
- }
- };
- }
-
- public DTPCatalogWrapper getCatalogNamed(String name) {
- return this.selectDatabaseObjectNamed(this.getCatalogs(), name);
- }
-
- public Iterator<String> sortedCatalogIdentifiers() {
- // the catalogs are already sorted
- return new TransformationIterator<DTPCatalogWrapper, String>(this.catalogWrappers()) {
- @Override
- protected String transform(DTPCatalogWrapper next) {
- return next.getIdentifier();
- }
- };
- }
-
- public DTPCatalogWrapper getCatalogForIdentifier(String identifier) {
- return this.selectDatabaseObjectForIdentifier(this.getCatalogs(), identifier);
- }
-
- public synchronized DTPCatalogWrapper getDefaultCatalog() {
- return this.getCatalogForIdentifiers(this.getDefaultCatalogIdentifiers());
- }
-
- private List<String> getDefaultCatalogIdentifiers() {
- return this.vendor.getDefaultCatalogIdentifiers(this.dtpDatabase, this.getConnectionProfile().getUserName());
- }
-
- /**
- * Return the first catalog found.
- */
- private DTPCatalogWrapper getCatalogForIdentifiers(List<String> identifiers) {
- for (String identifier : identifiers) {
- DTPCatalogWrapper catalog = this.getCatalogForIdentifier(identifier);
- if (catalog != null) {
- return catalog;
- }
- }
- return null;
- }
-
- // ***** schemata
-
- List<String> getDefaultSchemaIdentifiers() {
- return this.vendor.getDefaultSchemaIdentifiers(this.dtpDatabase, this.getConnectionProfile().getUserName());
- }
-
-
- // ********** names vs. identifiers **********
-
- /**
- * Convert the specified name to an identifier. Return null if the resulting
- * identifier matches the specified default name.
- */
- String convertNameToIdentifier(String name, String defaultName) {
- return this.vendor.convertNameToIdentifier(name, defaultName);
- }
-
- /**
- * Convert the specified name to an identifier.
- */
- public String convertNameToIdentifier(String name) {
- return this.vendor.convertNameToIdentifier(name);
- }
-
- /**
- * Return the database object identified by the specified identifier. If
- * the identifier is "delimited" (typically with double-quotes), it will be
- * used without any folding. If the name is "normal" (i.e. not delimited),
- * it will be folded to the appropriate case (typically uppercase).
- *
- * Since the database has the appropriate state to compare identifiers and
- * names, the connection profile delegates to here when using the default
- * "database finder".
- */
- <T extends DatabaseObject> T selectDatabaseObjectForIdentifier_(T[] databaseObjects, String identifier) {
- return this.selectDatabaseObjectNamed(databaseObjects, this.convertIdentifierToName(identifier));
- }
-
- /**
- * Convert the specified identifier to a name.
- */
- String convertIdentifierToName(String identifier) {
- return this.vendor.convertIdentifierToName(identifier);
- }
-
-
- // ********** Comparable implementation **********
-
- public int compareTo(Database database) {
- return Collator.getInstance().compare(this.getName(), database.getName());
- }
-
-
- // ********** internal methods **********
-
- DatabaseDefinition getDTPDefinition() {
- return RDBCorePlugin.getDefault().getDatabaseDefinitionRegistry().getDefinition(this.dtpDatabase);
- }
-
-
- // ********** listening **********
-
- @Override
- synchronized void startListening() {
- if (this.catalogs != null) {
- this.startCatalogs();
- }
- super.startListening();
- }
-
- private void startCatalogs() {
- for (DTPCatalogWrapper catalog : this.catalogs) {
- catalog.startListening();
- }
- }
-
- @Override
- synchronized void stopListening() {
- if (this.catalogs != null) {
- this.stopCatalogs();
- }
- super.stopListening();
- }
-
- private void stopCatalogs() {
- for (DTPCatalogWrapper catalog : this.catalogs) {
- catalog.stopListening();
- }
- }
-
-
- // ********** clear **********
-
- @Override
- synchronized void clear() {
- if (this.catalogs != null) {
- this.clearCatalogs();
- }
- super.clear();
- }
-
- private void clearCatalogs() {
- this.stopCatalogs();
- for (DTPCatalogWrapper catalog : this.catalogs) {
- catalog.clear();
- }
- this.catalogs = null;
- }
-
-}
diff --git a/jpa/plugins/org.eclipse.jpt.db/src/org/eclipse/jpt/db/internal/DTPForeignKeyWrapper.java b/jpa/plugins/org.eclipse.jpt.db/src/org/eclipse/jpt/db/internal/DTPForeignKeyWrapper.java
deleted file mode 100644
index ea455d1bae..0000000000
--- a/jpa/plugins/org.eclipse.jpt.db/src/org/eclipse/jpt/db/internal/DTPForeignKeyWrapper.java
+++ /dev/null
@@ -1,339 +0,0 @@
-/*******************************************************************************
- * Copyright (c) 2006, 2008 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.
- *
- * Contributors:
- * Oracle - initial API and implementation
- ******************************************************************************/
-package org.eclipse.jpt.db.internal;
-
-import com.ibm.icu.text.Collator;
-import java.util.Arrays;
-import java.util.Iterator;
-import java.util.List;
-import org.eclipse.jpt.db.Column;
-import org.eclipse.jpt.db.ForeignKey;
-import org.eclipse.jpt.utility.internal.CollectionTools;
-import org.eclipse.jpt.utility.internal.StringTools;
-import org.eclipse.jpt.utility.internal.iterators.ArrayIterator;
-import org.eclipse.jpt.utility.internal.iterators.FilteringIterator;
-import org.eclipse.jpt.utility.internal.iterators.TransformationIterator;
-
-/**
- * Wrap a DTP ForeignKey
- */
-final class DTPForeignKeyWrapper
- extends DTPDatabaseObjectWrapper
- implements ForeignKey
-{
- // the wrapped DTP foreign key
- private final org.eclipse.datatools.modelbase.sql.constraints.ForeignKey dtpForeignKey;
-
- // lazy-initialized
- private DTPTableWrapper referencedTable;
-
- // lazy-initialized
- private LocalColumnPair[] columnPairs;
-
- // lazy-initialized - but it can be 'null' so we use a flag
- private String defaultAttributeName;
- private boolean defaultAttributeNameCalculated = false;
-
-
- // ********** constructor **********
-
- DTPForeignKeyWrapper(DTPTableWrapper baseTable, org.eclipse.datatools.modelbase.sql.constraints.ForeignKey dtpForeignKey) {
- super(baseTable, dtpForeignKey);
- this.dtpForeignKey = dtpForeignKey;
- }
-
-
- // ********** DTPWrapper implementation **********
-
- @Override
- synchronized void catalogObjectChanged() {
- super.catalogObjectChanged();
- this.getConnectionProfile().foreignKeyChanged(this);
- }
-
- @Override
- public String toString() {
- return StringTools.buildToStringFor(this, this.getName() + ": " + Arrays.asList(this.getColumnPairs())); //$NON-NLS-1$
- }
-
-
- // ********** ForeignKey implementation **********
-
- public String getName() {
- return this.dtpForeignKey.getName();
- }
-
- public DTPTableWrapper getBaseTable() {
- return (DTPTableWrapper) this.getParent();
- }
-
- public synchronized DTPTableWrapper getReferencedTable() {
- if (this.referencedTable == null) {
- this.referencedTable = this.getBaseTable().getTable(this.dtpForeignKey.getUniqueConstraint().getBaseTable());
- }
- return this.referencedTable;
- }
-
- public boolean referencesSingleColumnPrimaryKey() {
- if (this.columnPairsSize() != 1) {
- return false;
- }
- if (this.getReferencedTable().primaryKeyColumnsSize() != 1) {
- return false;
- }
- return this.getColumnPair().getReferencedColumn() == this.getReferencedTable().getPrimaryKeyColumn();
- }
-
- // ***** column pairs
-
- public Iterator<ColumnPair> columnPairs() {
- return new ArrayIterator<ColumnPair>(this.getColumnPairs());
- }
-
- public LocalColumnPair getColumnPair() {
- LocalColumnPair[] pairs = this.getColumnPairs();
- if (pairs.length != 1) {
- throw new IllegalStateException("multiple column pairs: " + pairs.length); //$NON-NLS-1$
- }
- return pairs[0];
- }
-
- private Iterator<LocalColumnPair> localColumnPairs() {
- return new ArrayIterator<LocalColumnPair>(this.getColumnPairs());
- }
-
- private synchronized LocalColumnPair[] getColumnPairs() {
- if (this.columnPairs == null) {
- this.columnPairs = this.buildColumnPairs();
- }
- return this.columnPairs;
- }
-
- private LocalColumnPair[] buildColumnPairs() {
- List<org.eclipse.datatools.modelbase.sql.tables.Column> baseColumns = this.getDTPBaseColumns();
- int size = baseColumns.size();
- List<org.eclipse.datatools.modelbase.sql.tables.Column> refColumns = this.getDTPReferenceColumns();
- if (refColumns.size() != size) {
- throw new IllegalStateException(this.getBaseTable().getName() + '.' + this.getName() +
- " - mismatched sizes: " + size + " vs. " + refColumns.size()); //$NON-NLS-1$ //$NON-NLS-2$
- }
- LocalColumnPair[] result = new LocalColumnPair[baseColumns.size()];
- for (int i = baseColumns.size(); i-- > 0; ) {
- result[i] = new LocalColumnPair(
- this.getBaseTable().getColumn(baseColumns.get(i)),
- this.getBaseTable().getColumn(refColumns.get(i))
- );
- }
- return result;
- }
-
- // minimize scope of suppressed warnings
- @SuppressWarnings("unchecked")
- private List<org.eclipse.datatools.modelbase.sql.tables.Column> getDTPBaseColumns() {
- return this.dtpForeignKey.getMembers();
- }
-
- // minimize scope of suppressed warnings
- @SuppressWarnings("unchecked")
- private List<org.eclipse.datatools.modelbase.sql.tables.Column> getDTPReferenceColumns() {
- return this.dtpForeignKey.getUniqueConstraint().getMembers();
- }
-
- public int columnPairsSize() {
- return this.getColumnPairs().length;
- }
-
- public Iterator<Column> baseColumns() {
- return new TransformationIterator<LocalColumnPair, Column>(this.localColumnPairs()) {
- @Override
- protected Column transform(LocalColumnPair pair) {
- return pair.getBaseColumn();
- }
- };
- }
-
- boolean baseColumnsContains(Column column) {
- return CollectionTools.contains(this.baseColumns(), column);
- }
-
- public Iterator<Column> nonPrimaryKeyBaseColumns() {
- return new FilteringIterator<Column, Column>(this.baseColumns()) {
- @Override
- protected boolean accept(Column column) {
- return ! column.isPartOfPrimaryKey();
- }
- };
- }
-
- public Iterator<Column> referencedColumns() {
- return new TransformationIterator<LocalColumnPair, Column>(this.localColumnPairs()) {
- @Override
- protected Column transform(LocalColumnPair columnPair) {
- return columnPair.getReferencedColumn();
- }
- };
- }
-
- // ***** attribute name
-
- public String getAttributeName() {
- String defaultName = this.getDefaultAttributeName();
- return (defaultName != null) ? defaultName : this.getNonDefaultAttributeName();
- }
-
- public synchronized String getDefaultAttributeName() {
- if ( ! this.defaultAttributeNameCalculated) {
- this.defaultAttributeNameCalculated = true;
- this.defaultAttributeName = this.buildDefaultAttributeName();
- }
- return this.defaultAttributeName;
- }
-
- private String buildDefaultAttributeName() {
- if ( ! this.referencesSingleColumnPrimaryKey()) {
- return null;
- }
- LocalColumnPair columnPair = this.getColumnPair();
- String baseColName = columnPair.getBaseColumn().getName();
- String refColName = columnPair.getReferencedColumn().getName();
- if (baseColName.length() <= (refColName.length() + 1)) {
- return null;
- }
- if ( ! baseColName.endsWith(refColName)) {
- return null;
- }
- int _index = baseColName.length() - refColName.length() - 1;
- if (baseColName.charAt(_index) != '_') {
- return null;
- }
- return baseColName.substring(0, _index);
- }
-
- /**
- * If this is a simple (single-column) foreign key, use the name of the
- * single base column to build a name. If this is a compound foreign key,
- * return the name of the referenced table.
- */
- // TODO if there is only one FK to a given table, use the table's name instead of the column's name?
- private String getNonDefaultAttributeName() {
- return (this.columnPairsSize() == 1) ?
- this.getNonDefaultAttributeNameFromBaseColumn()
- :
- this.getReferencedTable().getName();
- }
-
- /**
- * The underscore check is helpful when the referenced column is NOT the
- * primary key of the referenced table (i.e. it has only a UNIQUE constraint).
- * ForeignKey(EMP.CUBICLE_ID => CUBICLE.ID) => "CUBICLE"
- * ForeignKey(EMP.CUBICLEID => CUBICLE.ID) => "CUBICLE"
- * ForeignKey(EMP.CUBICLE_PK => CUBICLE.ID) => "CUBICLE_PK"
- */
- private String getNonDefaultAttributeNameFromBaseColumn() {
- LocalColumnPair columnPair = this.getColumnPair();
- String baseColName = columnPair.getBaseColumn().getName();
- String refColName = columnPair.getReferencedColumn().getName();
- int len = baseColName.length();
- int refLen = refColName.length();
- if ((len > refLen) && baseColName.endsWith(refColName)) {
- len = len - refLen;
- if ((len > 1) && baseColName.charAt(len - 1) == '_') {
- len = len - 1;
- }
- }
- return baseColName.substring(0, len);
- }
-
- /**
- * Examples:
- * Oracle etc.
- * ForeignKey(FOO_ID => ID) vs. "foo" => null
- * ForeignKey(FOO_ID => FOO_ID) vs. "foo" => "FOO_ID"
- * ForeignKey(FOO => ID) vs. "foo" => "FOO"
- * ForeignKey(Foo_ID => ID) vs. "foo" => "\"Foo_ID\""
- *
- * PostgreSQL etc.
- * ForeignKey(foo_id => id) vs. "foo" => null
- * ForeignKey(foo_id => foo_id) vs. "foo" => "foo_id"
- * ForeignKey(foo => id) vs. "foo" => "foo"
- * ForeignKey(Foo_ID => ID) vs. "foo" => "\"Foo_ID\""
- *
- * SQL Server etc.
- * ForeignKey(foo_ID => ID) vs. "foo" => null
- * ForeignKey(FOO_ID => FOO_ID) vs. "foo" => "FOO_ID"
- * ForeignKey(FOO => ID) vs. "foo" => "FOO"
- * ForeignKey(Foo_ID => ID) vs. "foo" => "Foo_ID"
- */
- public String getJoinColumnAnnotationIdentifier(String attributeName) {
- String baseColumnName = this.getColumnPair().getBaseColumn().getName();
- String defaultBaseColumnName = attributeName + '_' + this.getReferencedTable().getPrimaryKeyColumn().getName();
- return this.getDatabase().convertNameToIdentifier(baseColumnName, defaultBaseColumnName);
- }
-
-
- // ********** Comparable implementation **********
-
- public int compareTo(ForeignKey foreignKey) {
- return Collator.getInstance().compare(this.getName(), foreignKey.getName());
- }
-
-
- // ********** internal methods **********
-
- boolean wraps(org.eclipse.datatools.modelbase.sql.constraints.ForeignKey foreignKey) {
- return this.dtpForeignKey == foreignKey;
- }
-
- @Override
- void clear() {
- // the foreign key does not "contain" any other objects,
- // so we don't need to forward the #clear()
- this.defaultAttributeNameCalculated = false;
- this.defaultAttributeName = null;
- this.columnPairs = null;
- this.referencedTable = null;
- }
-
-
- // ********** column pair implementation **********
-
- private static class LocalColumnPair implements ColumnPair {
- private final DTPColumnWrapper baseColumn;
- private final DTPColumnWrapper referencedColumn;
-
- LocalColumnPair(DTPColumnWrapper baseColumn, DTPColumnWrapper referencedColumn) {
- super();
- if ((baseColumn == null) || (referencedColumn == null)) {
- throw new NullPointerException();
- }
- this.baseColumn = baseColumn;
- this.referencedColumn = referencedColumn;
- }
-
- public DTPColumnWrapper getBaseColumn() {
- return this.baseColumn;
- }
-
- public DTPColumnWrapper getReferencedColumn() {
- return this.referencedColumn;
- }
-
- public int compareTo(ColumnPair columnPair) {
- return Collator.getInstance().compare(this.getBaseColumn().getName(), columnPair.getBaseColumn().getName());
- }
-
- @Override
- public String toString() {
- return StringTools.buildToStringFor(this, this.baseColumn.getName() + "=>" + this.referencedColumn.getName()); //$NON-NLS-1$
- }
-
- }
-
-}
diff --git a/jpa/plugins/org.eclipse.jpt.db/src/org/eclipse/jpt/db/internal/DTPSchemaContainerWrapper.java b/jpa/plugins/org.eclipse.jpt.db/src/org/eclipse/jpt/db/internal/DTPSchemaContainerWrapper.java
deleted file mode 100644
index 630d34624b..0000000000
--- a/jpa/plugins/org.eclipse.jpt.db/src/org/eclipse/jpt/db/internal/DTPSchemaContainerWrapper.java
+++ /dev/null
@@ -1,222 +0,0 @@
-/*******************************************************************************
- * Copyright (c) 2006, 2009 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.
- *
- * Contributors:
- * Oracle - initial API and implementation
- ******************************************************************************/
-package org.eclipse.jpt.db.internal;
-
-import java.util.Iterator;
-import java.util.List;
-import org.eclipse.jpt.db.Schema;
-import org.eclipse.jpt.db.SchemaContainer;
-import org.eclipse.jpt.utility.internal.CollectionTools;
-import org.eclipse.jpt.utility.internal.iterators.ArrayIterator;
-import org.eclipse.jpt.utility.internal.iterators.TransformationIterator;
-
-/**
- * Coalesce behavior for a schema container (i.e. database or catalog).
- */
-abstract class DTPSchemaContainerWrapper
- extends DTPDatabaseObjectWrapper
- implements SchemaContainer
-{
- // lazy-initialized
- private DTPSchemaWrapper[] schemata;
-
-
- // ********** constructor **********
-
- DTPSchemaContainerWrapper(DTPDatabaseObject parent, Object dtpSchemaContainer) {
- super(parent, dtpSchemaContainer);
- }
-
-
- // ********** DTPWrapper implementation **********
-
- @Override
- synchronized void catalogObjectChanged() {
- super.catalogObjectChanged();
- }
-
-
- // ********** abstract methods **********
-
- /**
- * return the schema container's DTP schemata
- */
- abstract List<org.eclipse.datatools.modelbase.sql.schema.Schema> getDTPSchemata();
-
- /**
- * return the schema for the specified DTP schema
- */
- abstract DTPSchemaWrapper getSchema(org.eclipse.datatools.modelbase.sql.schema.Schema dtpSchema);
-
- /**
- * assume the schema container (database or catalog) contains
- * the specified schema
- */
- DTPSchemaWrapper getSchema_(org.eclipse.datatools.modelbase.sql.schema.Schema dtpSchema) {
- for (DTPSchemaWrapper schema : this.getSchemata()) {
- if (schema.wraps(dtpSchema)) {
- return schema;
- }
- }
- throw new IllegalArgumentException("invalid DTP schema: " + dtpSchema); //$NON-NLS-1$
- }
-
- /**
- * return the table for the specified DTP table;
- * this is only called from a schema (to its container)
- */
- abstract DTPTableWrapper getTable(org.eclipse.datatools.modelbase.sql.tables.Table dtpTable);
-
- /**
- * assume the schema container contains the specified table
- */
- DTPTableWrapper getTable_(org.eclipse.datatools.modelbase.sql.tables.Table dtpTable) {
- return this.getSchema_(dtpTable.getSchema()).getTable_(dtpTable);
- }
-
- /**
- * return the column for the specified DTP column;
- * this is only called from a schema (to its container)
- */
- abstract DTPColumnWrapper getColumn(org.eclipse.datatools.modelbase.sql.tables.Column dtpColumn);
-
- /**
- * assume the schema container contains the specified column
- */
- DTPColumnWrapper getColumn_(org.eclipse.datatools.modelbase.sql.tables.Column dtpColumn) {
- return this.getTable_(dtpColumn.getTable()).getColumn_(dtpColumn);
- }
-
-
- // ********** schemata **********
-
- public Iterator<Schema> schemata() {
- return new ArrayIterator<Schema>(this.getSchemata());
- }
-
- Iterator<DTPSchemaWrapper> schemaWrappers() {
- return new ArrayIterator<DTPSchemaWrapper>(this.getSchemata());
- }
-
- synchronized DTPSchemaWrapper[] getSchemata() {
- if (this.schemata == null) {
- this.schemata = this.buildSchemata();
- }
- return this.schemata;
- }
-
- private DTPSchemaWrapper[] buildSchemata() {
- List<org.eclipse.datatools.modelbase.sql.schema.Schema> dtpSchemata = this.getDTPSchemata();
- DTPSchemaWrapper[] result = new DTPSchemaWrapper[dtpSchemata.size()];
- for (int i = result.length; i-- > 0; ) {
- result[i] = new DTPSchemaWrapper(this, dtpSchemata.get(i));
- }
- return CollectionTools.sort(result);
- }
-
- public int schemataSize() {
- return this.getSchemata().length;
- }
-
- public Iterator<String> sortedSchemaNames() {
- // the schemata are already sorted
- return new TransformationIterator<DTPSchemaWrapper, String>(this.schemaWrappers()) {
- @Override
- protected String transform(DTPSchemaWrapper next) {
- return next.getName();
- }
- };
- }
-
- public DTPSchemaWrapper getSchemaNamed(String name) {
- return this.selectDatabaseObjectNamed(this.getSchemata(), name);
- }
-
- public Iterator<String> sortedSchemaIdentifiers() {
- // the schemata are already sorted
- return new TransformationIterator<DTPSchemaWrapper, String>(this.schemaWrappers()) {
- @Override
- protected String transform(DTPSchemaWrapper next) {
- return next.getIdentifier();
- }
- };
- }
-
- public DTPSchemaWrapper getSchemaForIdentifier(String identifier) {
- return this.selectDatabaseObjectForIdentifier(this.getSchemata(), identifier);
- }
-
- public DTPSchemaWrapper getDefaultSchema() {
- return this.getSchemaForIdentifiers(this.getDatabase().getDefaultSchemaIdentifiers());
- }
-
- /**
- * Return the first schema found.
- */
- DTPSchemaWrapper getSchemaForIdentifiers(List<String> identifiers) {
- for (String identifier : identifiers) {
- DTPSchemaWrapper schema = this.getSchemaForIdentifier(identifier);
- if (schema != null) {
- return schema;
- }
- }
- return null;
- }
-
-
- // ********** listening **********
-
- @Override
- synchronized void startListening() {
- if (this.schemata != null) {
- this.startSchemata();
- }
- super.startListening();
- }
-
- private void startSchemata() {
- for (DTPSchemaWrapper schema : this.schemata) {
- schema.startListening();
- }
- }
-
- @Override
- synchronized void stopListening() {
- if (this.schemata != null) {
- this.stopSchemata();
- }
- super.stopListening();
- }
-
- private void stopSchemata() {
- for (DTPSchemaWrapper schema : this.schemata) {
- schema.stopListening();
- }
- }
-
-
- // ********** clear **********
-
- @Override
- synchronized void clear() {
- if (this.schemata != null) {
- this.clearSchemata();
- }
- }
-
- private void clearSchemata() {
- this.stopSchemata();
- for (DTPSchemaWrapper schema : this.schemata) {
- schema.clear();
- }
- this.schemata = null;
- }
-
-}
diff --git a/jpa/plugins/org.eclipse.jpt.db/src/org/eclipse/jpt/db/internal/DTPSchemaWrapper.java b/jpa/plugins/org.eclipse.jpt.db/src/org/eclipse/jpt/db/internal/DTPSchemaWrapper.java
deleted file mode 100644
index 0fb39f04db..0000000000
--- a/jpa/plugins/org.eclipse.jpt.db/src/org/eclipse/jpt/db/internal/DTPSchemaWrapper.java
+++ /dev/null
@@ -1,307 +0,0 @@
-/*******************************************************************************
- * Copyright (c) 2006, 2008 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.
- *
- * Contributors:
- * Oracle - initial API and implementation
- ******************************************************************************/
-package org.eclipse.jpt.db.internal;
-
-import com.ibm.icu.text.Collator;
-import java.util.Iterator;
-import java.util.List;
-import org.eclipse.jpt.db.Schema;
-import org.eclipse.jpt.db.Sequence;
-import org.eclipse.jpt.db.Table;
-import org.eclipse.jpt.utility.internal.CollectionTools;
-import org.eclipse.jpt.utility.internal.iterators.ArrayIterator;
-import org.eclipse.jpt.utility.internal.iterators.TransformationIterator;
-
-/**
- * Wrap a DTP Schema
- */
-final class DTPSchemaWrapper
- extends DTPDatabaseObjectWrapper
- implements Schema
-{
- // the wrapped DTP schema
- private final org.eclipse.datatools.modelbase.sql.schema.Schema dtpSchema;
-
- // lazy-initialized
- private DTPTableWrapper[] tables;
-
- // lazy-initialized
- private DTPSequenceWrapper[] sequences;
-
-
- // ********** constructor **********
-
- DTPSchemaWrapper(DTPSchemaContainerWrapper container, org.eclipse.datatools.modelbase.sql.schema.Schema dtpSchema) {
- super(container, dtpSchema);
- this.dtpSchema = dtpSchema;
- }
-
-
- // ********** DTPWrapper implementation **********
-
- @Override
- synchronized void catalogObjectChanged() {
- super.catalogObjectChanged();
- this.getConnectionProfile().schemaChanged(this);
- }
-
-
- // ********** Schema implementation **********
-
- public String getName() {
- return this.dtpSchema.getName();
- }
-
- public DTPSchemaContainerWrapper getContainer() {
- return (DTPSchemaContainerWrapper) this.getParent();
- }
-
- // ***** tables
-
- public Iterator<Table> tables() {
- return new ArrayIterator<Table>(this.getTables());
- }
-
- private Iterator<DTPTableWrapper> tableWrappers() {
- return new ArrayIterator<DTPTableWrapper>(this.getTables());
- }
-
- private synchronized DTPTableWrapper[] getTables() {
- if (this.tables == null) {
- this.tables = this.buildTables();
- }
- return this.tables;
- }
-
- private DTPTableWrapper[] buildTables() {
- List<org.eclipse.datatools.modelbase.sql.tables.Table> dtpTables = this.getDTPTables();
- DTPTableWrapper[] result = new DTPTableWrapper[dtpTables.size()];
- for (int i = result.length; i-- > 0;) {
- result[i] = new DTPTableWrapper(this, dtpTables.get(i));
- }
- return CollectionTools.sort(result);
- }
-
- // minimize scope of suppressed warnings
- @SuppressWarnings("unchecked")
- private List<org.eclipse.datatools.modelbase.sql.tables.Table> getDTPTables() {
- return this.dtpSchema.getTables();
- }
-
- public int tablesSize() {
- return this.getTables().length;
- }
-
- /**
- * return the table for the specified DTP table
- */
- DTPTableWrapper getTable(org.eclipse.datatools.modelbase.sql.tables.Table dtpTable) {
- // try to short-circuit the search
- return this.wraps(dtpTable.getSchema()) ?
- this.getTable_(dtpTable)
- :
- this.getContainer().getTable(dtpTable);
- }
-
- /**
- * assume the schema contains the specified table
- */
- DTPTableWrapper getTable_(org.eclipse.datatools.modelbase.sql.tables.Table dtpTable) {
- for (DTPTableWrapper table : this.getTables()) {
- if (table.wraps(dtpTable)) {
- return table;
- }
- }
- throw new IllegalArgumentException("invalid DTP table: " + dtpTable); //$NON-NLS-1$
- }
-
- public DTPTableWrapper getTableNamed(String name) {
- return this.selectDatabaseObjectNamed(this.getTables(), name);
- }
-
- public Iterator<String> sortedTableIdentifiers() {
- // the tables are already sorted
- return new TransformationIterator<DTPTableWrapper, String>(this.tableWrappers()) {
- @Override
- protected String transform(DTPTableWrapper table) {
- return table.getIdentifier();
- }
- };
- }
-
- public DTPTableWrapper getTableForIdentifier(String identifier) {
- return this.selectDatabaseObjectForIdentifier(this.getTables(), identifier);
- }
-
- // ***** sequences
-
- public Iterator<Sequence> sequences() {
- return new ArrayIterator<Sequence>(this.getSequences());
- }
-
- private Iterator<DTPSequenceWrapper> sequenceWrappers() {
- return new ArrayIterator<DTPSequenceWrapper>(this.getSequences());
- }
-
- private synchronized DTPSequenceWrapper[] getSequences() {
- if (this.sequences == null) {
- this.sequences = this.buildSequences();
- }
- return this.sequences;
- }
-
- private DTPSequenceWrapper[] buildSequences() {
- List<org.eclipse.datatools.modelbase.sql.schema.Sequence> dtpSequences = this.getDTPSequences();
- DTPSequenceWrapper[] result = new DTPSequenceWrapper[dtpSequences.size()];
- for (int i = result.length; i-- > 0;) {
- result[i] = new DTPSequenceWrapper(this, dtpSequences.get(i));
- }
- return CollectionTools.sort(result);
- }
-
- // minimize scope of suppressed warnings
- @SuppressWarnings("unchecked")
- private List<org.eclipse.datatools.modelbase.sql.schema.Sequence> getDTPSequences() {
- return this.dtpSchema.getSequences();
- }
-
- public int sequencesSize() {
- return this.getSequences().length;
- }
-
- public DTPSequenceWrapper getSequenceNamed(String name) {
- return this.selectDatabaseObjectNamed(this.getSequences(), name);
- }
-
- public Iterator<String> sortedSequenceIdentifiers() {
- // the sequences are already sorted
- return new TransformationIterator<DTPSequenceWrapper, String>(this.sequenceWrappers()) {
- @Override
- protected String transform(DTPSequenceWrapper sequence) {
- return sequence.getIdentifier();
- }
- };
- }
-
- public DTPSequenceWrapper getSequenceForIdentifier(String identifier) {
- return this.selectDatabaseObjectForIdentifier(this.getSequences(), identifier);
- }
-
-
- // ********** Comparable implementation **********
-
- public int compareTo(Schema schema) {
- return Collator.getInstance().compare(this.getName(), schema.getName());
- }
-
-
- // ********** internal methods **********
-
- boolean wraps(org.eclipse.datatools.modelbase.sql.schema.Schema schema) {
- return this.dtpSchema == schema;
- }
-
- /**
- * return the column for the specified DTP column
- */
- DTPColumnWrapper getColumn(org.eclipse.datatools.modelbase.sql.tables.Column dtpColumn) {
- // try to short-circuit the search
- return this.wraps(dtpColumn.getTable().getSchema()) ?
- this.getColumn_(dtpColumn)
- :
- this.getContainer().getColumn(dtpColumn);
- }
-
- /**
- * assume the schema contains the specified column
- */
- DTPColumnWrapper getColumn_(org.eclipse.datatools.modelbase.sql.tables.Column dtpColumn) {
- return this.getTable_(dtpColumn.getTable()).getColumn_(dtpColumn);
- }
-
-
- // ********** listening **********
-
- @Override
- synchronized void startListening() {
- if (this.sequences != null) {
- this.startSequences();
- }
- if (this.tables != null) {
- this.startTables();
- }
- super.startListening();
- }
-
- private void startSequences() {
- for (DTPSequenceWrapper sequence : this.sequences) {
- sequence.startListening();
- }
- }
-
- private void startTables() {
- for (DTPTableWrapper table : this.tables) {
- table.startListening();
- }
- }
-
- @Override
- synchronized void stopListening() {
- if (this.sequences != null) {
- this.stopSequences();
- }
- if (this.tables != null) {
- this.stopTables();
- }
- super.stopListening();
- }
-
- private void stopSequences() {
- for (DTPSequenceWrapper sequence : this.sequences) {
- sequence.stopListening();
- }
- }
-
- private void stopTables() {
- for (DTPTableWrapper table : this.tables) {
- table.stopListening();
- }
- }
-
-
- // ********** clear **********
-
- @Override
- synchronized void clear() {
- if (this.sequences != null) {
- this.clearSequences();
- }
- if (this.tables != null) {
- this.clearTables();
- }
- }
-
- private void clearSequences() {
- this.stopSequences();
- for (DTPSequenceWrapper sequence : this.sequences) {
- sequence.clear();
- }
- this.sequences = null;
- }
-
- private void clearTables() {
- this.stopTables();
- for (DTPTableWrapper table : this.tables) {
- table.clear();
- }
- this.tables = null;
- }
-
-}
diff --git a/jpa/plugins/org.eclipse.jpt.db/src/org/eclipse/jpt/db/internal/DTPSequenceWrapper.java b/jpa/plugins/org.eclipse.jpt.db/src/org/eclipse/jpt/db/internal/DTPSequenceWrapper.java
deleted file mode 100644
index 6778fca5c1..0000000000
--- a/jpa/plugins/org.eclipse.jpt.db/src/org/eclipse/jpt/db/internal/DTPSequenceWrapper.java
+++ /dev/null
@@ -1,72 +0,0 @@
-/*******************************************************************************
- * Copyright (c) 2006, 2008 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.
- *
- * Contributors:
- * Oracle - initial API and implementation
- ******************************************************************************/
-package org.eclipse.jpt.db.internal;
-
-import com.ibm.icu.text.Collator;
-import org.eclipse.jpt.db.Sequence;
-
-/**
- * Wrap a DTP Sequence
- */
-final class DTPSequenceWrapper
- extends DTPDatabaseObjectWrapper
- implements Sequence
-{
- // the wrapped DTP sequence
- private final org.eclipse.datatools.modelbase.sql.schema.Sequence dtpSequence;
-
-
- // ********** constructor **********
-
- DTPSequenceWrapper(DTPSchemaWrapper schema, org.eclipse.datatools.modelbase.sql.schema.Sequence dtpSequence) {
- super(schema, dtpSequence);
- this.dtpSequence = dtpSequence;
- }
-
-
- // ********** DTPWrapper implementation **********
-
- @Override
- synchronized void catalogObjectChanged() {
- super.catalogObjectChanged();
- this.getConnectionProfile().sequenceChanged(this);
- }
-
-
- // ********** Sequence implementation **********
-
- public String getName() {
- return this.dtpSequence.getName();
- }
-
- public DTPSchemaWrapper getSchema() {
- return (DTPSchemaWrapper) this.getParent();
- }
-
-
- // ********** Comparable implementation **********
-
- public int compareTo(Sequence sequence) {
- return Collator.getInstance().compare(this.getName(), sequence.getName());
- }
-
-
- // ********** internal methods **********
-
- boolean wraps(org.eclipse.datatools.modelbase.sql.schema.Sequence sequence) {
- return this.dtpSequence == sequence;
- }
-
- @Override
- void clear() {
- // no state to clear
- }
-
-}
diff --git a/jpa/plugins/org.eclipse.jpt.db/src/org/eclipse/jpt/db/internal/DTPTableWrapper.java b/jpa/plugins/org.eclipse.jpt.db/src/org/eclipse/jpt/db/internal/DTPTableWrapper.java
deleted file mode 100644
index 64ba0fc7d7..0000000000
--- a/jpa/plugins/org.eclipse.jpt.db/src/org/eclipse/jpt/db/internal/DTPTableWrapper.java
+++ /dev/null
@@ -1,420 +0,0 @@
-/*******************************************************************************
- * Copyright (c) 2006, 2008 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.
- *
- * Contributors:
- * Oracle - initial API and implementation
- ******************************************************************************/
-package org.eclipse.jpt.db.internal;
-
-import com.ibm.icu.text.Collator;
-import java.util.Iterator;
-import java.util.List;
-import org.eclipse.datatools.modelbase.sql.constraints.PrimaryKey;
-import org.eclipse.datatools.modelbase.sql.tables.BaseTable;
-import org.eclipse.jpt.db.Column;
-import org.eclipse.jpt.db.ForeignKey;
-import org.eclipse.jpt.db.Table;
-import org.eclipse.jpt.utility.internal.CollectionTools;
-import org.eclipse.jpt.utility.internal.iterators.ArrayIterator;
-import org.eclipse.jpt.utility.internal.iterators.TransformationIterator;
-
-/**
- * Wrap a DTP Table
- */
-final class DTPTableWrapper
- extends DTPDatabaseObjectWrapper
- implements Table
-{
- // the wrapped DTP table
- private final org.eclipse.datatools.modelbase.sql.tables.Table dtpTable;
-
- // lazy-initialized
- private DTPColumnWrapper[] columns;
-
- // lazy-initialized
- private DTPColumnWrapper[] primaryKeyColumns;
-
- // lazy-initialized
- private DTPForeignKeyWrapper[] foreignKeys;
-
-
- private static final DTPColumnWrapper[] EMPTY_COLUMNS = new DTPColumnWrapper[0];
- private static final DTPForeignKeyWrapper[] EMPTY_FOREIGN_KEYS = new DTPForeignKeyWrapper[0];
-
-
- // ********** constructor **********
-
- DTPTableWrapper(DTPSchemaWrapper schema, org.eclipse.datatools.modelbase.sql.tables.Table dtpTable) {
- super(schema, dtpTable);
- this.dtpTable = dtpTable;
- }
-
-
- // ********** DTPWrapper implementation **********
-
- @Override
- synchronized void catalogObjectChanged() {
- super.catalogObjectChanged();
- this.getConnectionProfile().tableChanged(this);
- }
-
-
- // ********** Table implementation **********
-
- public String getName() {
- return this.dtpTable.getName();
- }
-
- public DTPSchemaWrapper getSchema() {
- return (DTPSchemaWrapper) this.getParent();
- }
-
- // ***** columns
-
- public Iterator<Column> columns() {
- return new ArrayIterator<Column>(this.getColumns());
- }
-
- private Iterator<DTPColumnWrapper> columnWrappers() {
- return new ArrayIterator<DTPColumnWrapper>(this.getColumns());
- }
-
- private synchronized DTPColumnWrapper[] getColumns() {
- if (this.columns == null) {
- this.columns = this.buildColumns();
- }
- return this.columns;
- }
-
- private DTPColumnWrapper[] buildColumns() {
- List<org.eclipse.datatools.modelbase.sql.tables.Column> dtpColumns = this.getDTPColumns();
- DTPColumnWrapper[] result = new DTPColumnWrapper[dtpColumns.size()];
- for (int i = result.length; i-- > 0;) {
- result[i] = new DTPColumnWrapper(this, dtpColumns.get(i));
- }
- return CollectionTools.sort(result);
- }
-
- // minimize scope of suppressed warnings
- @SuppressWarnings("unchecked")
- private List<org.eclipse.datatools.modelbase.sql.tables.Column> getDTPColumns() {
- return this.dtpTable.getColumns();
- }
-
- public int columnsSize() {
- return this.getColumns().length;
- }
-
- public DTPColumnWrapper getColumnNamed(String name) {
- return this.selectDatabaseObjectNamed(this.getColumns(), name);
- }
-
- /**
- * return the column for the specified DTP column
- */
- DTPColumnWrapper getColumn(org.eclipse.datatools.modelbase.sql.tables.Column dtpColumn) {
- // try to short-circuit the search
- return this.wraps(dtpColumn.getTable()) ?
- this.getColumn_(dtpColumn)
- :
- this.getSchema().getColumn(dtpColumn);
- }
-
- /**
- * assume the table contains the specified column
- */
- DTPColumnWrapper getColumn_(org.eclipse.datatools.modelbase.sql.tables.Column dtpColumn) {
- for (DTPColumnWrapper column : this.getColumns()) {
- if (column.wraps(dtpColumn)) {
- return column;
- }
- }
- throw new IllegalArgumentException("invalid DTP column: " + dtpColumn); //$NON-NLS-1$
- }
-
- public Iterator<String> sortedColumnIdentifiers() {
- // the columns are already sorted
- return new TransformationIterator<DTPColumnWrapper, String>(this.columnWrappers()) {
- @Override
- protected String transform(DTPColumnWrapper next) {
- return next.getIdentifier();
- }
- };
- }
-
- public DTPColumnWrapper getColumnForIdentifier(String identifier) {
- return this.selectDatabaseObjectForIdentifier(this.getColumns(), identifier);
- }
-
- // ***** primaryKeyColumns
-
- public Iterator<Column> primaryKeyColumns() {
- return new ArrayIterator<Column>(this.getPrimaryKeyColumns());
- }
-
- public DTPColumnWrapper getPrimaryKeyColumn() {
- DTPColumnWrapper[] pkColumns = this.getPrimaryKeyColumns();
- if (pkColumns.length != 1) {
- throw new IllegalStateException("multiple primary key columns: " + pkColumns.length); //$NON-NLS-1$
- }
- return pkColumns[0];
- }
-
- private synchronized DTPColumnWrapper[] getPrimaryKeyColumns() {
- if (this.primaryKeyColumns == null) {
- this.primaryKeyColumns = this.buildPrimaryKeyColumns();
- }
- return this.primaryKeyColumns;
- }
-
- private DTPColumnWrapper[] buildPrimaryKeyColumns() {
- if ( ! (this.dtpTable instanceof BaseTable)) {
- return EMPTY_COLUMNS;
- }
- PrimaryKey pk = ((BaseTable) this.dtpTable).getPrimaryKey();
- if (pk == null) {
- // no PK was defined
- return EMPTY_COLUMNS;
- }
- List<org.eclipse.datatools.modelbase.sql.tables.Column> pkColumns = this.getColumns(pk);
- DTPColumnWrapper[] result = new DTPColumnWrapper[pkColumns.size()];
- for (int i = result.length; i-- > 0;) {
- result[i] = this.getColumn(pkColumns.get(i));
- }
- return result;
- }
-
- // minimize scope of suppressed warnings
- @SuppressWarnings("unchecked")
- private List<org.eclipse.datatools.modelbase.sql.tables.Column> getColumns(PrimaryKey pk) {
- return pk.getMembers();
- }
-
- public int primaryKeyColumnsSize() {
- return this.getPrimaryKeyColumns().length;
- }
-
- boolean primaryKeyColumnsContains(Column column) {
- return CollectionTools.contains(this.getPrimaryKeyColumns(), column);
- }
-
- // ***** foreignKeys
-
- public Iterator<ForeignKey> foreignKeys() {
- return new ArrayIterator<ForeignKey>(this.getForeignKeys());
- }
-
- private synchronized DTPForeignKeyWrapper[] getForeignKeys() {
- if (this.foreignKeys == null) {
- this.foreignKeys = this.buildForeignKeys();
- }
- return this.foreignKeys;
- }
-
- private DTPForeignKeyWrapper[] buildForeignKeys() {
- if ( ! (this.dtpTable instanceof BaseTable)) {
- return EMPTY_FOREIGN_KEYS;
- }
- List<org.eclipse.datatools.modelbase.sql.constraints.ForeignKey> dtpForeignKeys = this.getDTPForeignKeys();
- DTPForeignKeyWrapper[] result = new DTPForeignKeyWrapper[dtpForeignKeys.size()];
- for (int i = result.length; i-- > 0;) {
- result[i] = new DTPForeignKeyWrapper(this, dtpForeignKeys.get(i));
- }
- return result;
- }
-
- @SuppressWarnings("unchecked")
- private List<org.eclipse.datatools.modelbase.sql.constraints.ForeignKey> getDTPForeignKeys() {
- return ((BaseTable) this.dtpTable).getForeignKeys();
- }
-
- public int foreignKeysSize() {
- return this.getForeignKeys().length;
- }
-
- /**
- * return whether the specified column is a base column for at least one
- * of the the table's foreign keys
- */
- boolean foreignKeyBaseColumnsContains(Column column) {
- for (DTPForeignKeyWrapper fkWrapper : this.getForeignKeys()) {
- if (fkWrapper.baseColumnsContains(column)) {
- return true;
- }
- }
- return false;
- }
-
- // ***** join table
-
- public boolean isPossibleJoinTable() {
- if (this.getForeignKeys().length != 2) {
- return false; // the table must have exactly 2 foreign keys
- }
- for (Column column : this.getColumns()) {
- if ( ! this.foreignKeyBaseColumnsContains(column)) {
- return false; // all the table's columns must belong to one (or both) of the 2 foreign keys
- }
- }
- return true;
- }
-
- /**
- * If the table name is FOO_BAR and it joins tables FOO and BAR,
- * return the foreign key to FOO;
- * if the table name is BAR_FOO and it joins tables FOO and BAR,
- * return the foreign key to BAR;
- * otherwise simply return the first foreign key in the array.
- */
- public ForeignKey getJoinTableOwningForeignKey() {
- ForeignKey fk0 = this.getForeignKeys()[0];
- String name0 = fk0.getReferencedTable().getName();
-
- ForeignKey fk1 = this.getForeignKeys()[1];
- String name1 = fk1.getReferencedTable().getName();
-
- return this.getName().equals(name1 + '_' + name0) ? fk1 : fk0;
- }
-
- public ForeignKey getJoinTableNonOwningForeignKey() {
- ForeignKey fk0 = this.getForeignKeys()[0];
- ForeignKey fk1 = this.getForeignKeys()[1];
- ForeignKey ofk = this.getJoinTableOwningForeignKey();
- return (ofk == fk0) ? fk1 : fk0;
- }
-
- /**
- * Hmmm....
- * We might want to go to the platform to allow a vendor-specific
- * comparison here;
- * but, since all the names are coming directly from the database
- * (i.e. there are no conversions to Java identifiers etc.), it seems
- * like we can just compare them directly and ignore case-sensitivity
- * issues.... ~bjv
- */
- public boolean joinTableNameIsDefault() {
- return this.getName().equals(this.buildDefaultJoinTableName());
- }
-
- private String buildDefaultJoinTableName() {
- return this.getJoinTableOwningTable().getName()
- + '_'
- + this.getJoinTableNonOwningTable().getName();
- }
-
- private Table getJoinTableOwningTable() {
- return this.getJoinTableOwningForeignKey().getReferencedTable();
- }
-
- private Table getJoinTableNonOwningTable() {
- return this.getJoinTableNonOwningForeignKey().getReferencedTable();
- }
-
-
- // ********** Comparable implementation **********
-
- public int compareTo(Table table) {
- return Collator.getInstance().compare(this.getName(), table.getName());
- }
-
-
- // ********** internal methods **********
-
- boolean wraps(org.eclipse.datatools.modelbase.sql.tables.Table table) {
- return this.dtpTable == table;
- }
-
- /**
- * return the table for the specified DTP table
- */
- DTPTableWrapper getTable(org.eclipse.datatools.modelbase.sql.tables.Table table) {
- // try to short-circuit the search
- return this.wraps(table) ? this : this.getSchema().getTable(table);
- }
-
-
- // ********** listening **********
-
- @Override
- synchronized void startListening() {
- if (this.foreignKeys != null) {
- this.startForeignKeys();
- }
- if (this.columns != null) {
- this.startColumns();
- }
- super.startListening();
- }
-
- private void startForeignKeys() {
- for (DTPForeignKeyWrapper foreignKey : this.foreignKeys) {
- foreignKey.startListening();
- }
- }
-
- private void startColumns() {
- for (DTPColumnWrapper column : this.columns) {
- column.startListening();
- }
- }
-
- @Override
- synchronized void stopListening() {
- if (this.foreignKeys != null) {
- this.stopForeignKeys();
- }
- if (this.columns != null) {
- this.stopColumns();
- }
- super.stopListening();
- }
-
- private void stopForeignKeys() {
- for (DTPForeignKeyWrapper foreignKey : this.foreignKeys) {
- foreignKey.stopListening();
- }
- }
-
- private void stopColumns() {
- for (DTPColumnWrapper column : this.columns) {
- column.stopListening();
- }
- }
-
-
- // ********** clear **********
-
- @Override
- void clear() {
- if (this.foreignKeys != null) {
- this.clearForeignKeys();
- }
-
- // the table does not "contain" the pk columns, so no need to forward #clear()
- this.primaryKeyColumns = null;
-
- if (this.columns != null) {
- this.clearColumns();
- }
- }
-
- private void clearForeignKeys() {
- this.stopForeignKeys();
- for (DTPForeignKeyWrapper foreignKey : this.foreignKeys) {
- foreignKey.clear();
- }
- this.foreignKeys = null;
- }
-
- private void clearColumns() {
- this.stopColumns();
- for (DTPColumnWrapper column : this.columns) {
- column.clear();
- }
- this.columns = null;
- }
-
-}
diff --git a/jpa/plugins/org.eclipse.jpt.db/src/org/eclipse/jpt/db/internal/vendor/AbstractVendor.java b/jpa/plugins/org.eclipse.jpt.db/src/org/eclipse/jpt/db/internal/vendor/AbstractVendor.java
deleted file mode 100644
index 7001e9da71..0000000000
--- a/jpa/plugins/org.eclipse.jpt.db/src/org/eclipse/jpt/db/internal/vendor/AbstractVendor.java
+++ /dev/null
@@ -1,290 +0,0 @@
-/*******************************************************************************
- * Copyright (c) 2009 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.
- *
- * Contributors:
- * Oracle - initial API and implementation
- ******************************************************************************/
-package org.eclipse.jpt.db.internal.vendor;
-
-import java.util.ArrayList;
-import java.util.List;
-
-import org.eclipse.datatools.modelbase.sql.schema.Catalog;
-import org.eclipse.datatools.modelbase.sql.schema.Database;
-import org.eclipse.datatools.modelbase.sql.schema.Schema;
-import org.eclipse.jpt.utility.internal.CollectionTools;
-import org.eclipse.jpt.utility.internal.StringTools;
-
-/**
- * Consolidate the behavior common to the typical vendors.
- */
-abstract class AbstractVendor
- implements Vendor
-{
-
- AbstractVendor() {
- super();
- }
-
- public abstract String getDTPVendorName();
-
-
- // ********** catalog and schema support **********
-
- abstract CatalogStrategy getCatalogStrategy();
-
- public boolean supportsCatalogs(Database database) {
- return this.getCatalogStrategy().supportsCatalogs(database);
- }
-
- public List<Catalog> getCatalogs(Database database) {
- return this.getCatalogStrategy().getCatalogs(database);
- }
-
- public List<Schema> getSchemas(Database database) {
- try {
- return this.getCatalogStrategy().getSchemas(database);
- } catch (Exception ex) {
- throw new RuntimeException("vendor: " + this, ex); //$NON-NLS-1$
- }
- }
-
- /**
- * Typically, the name of the default catalog is the user name.
- */
- public final List<String> getDefaultCatalogIdentifiers(Database database, String userName) {
- ArrayList<String> identifiers = new ArrayList<String>();
- this.addDefaultCatalogIdentifiersTo(database, userName, identifiers);
- return identifiers;
- }
-
- void addDefaultCatalogIdentifiersTo(@SuppressWarnings("unused") Database database, String userName, ArrayList<String> identifiers) {
- identifiers.add(this.convertNameToIdentifier(userName));
- }
-
- /**
- * Typically, the name of the default schema is the user name.
- */
- public final List<String> getDefaultSchemaIdentifiers(Database database, String userName) {
- ArrayList<String> identifiers = new ArrayList<String>();
- this.addDefaultSchemaIdentifiersTo(database, userName, identifiers);
- return identifiers;
- }
-
- /**
- * The user name passed in here was retrieved from DTP.
- * DTP stores the user name that was passed to it during the connection
- * to the database. As a result, this user name is an "identifier" not a "name".
- * If the user name were retrieved from the JDBC connection it would probably
- * be a "name". For example, you can connect to an Oracle database with the
- * user name "scott", but that identifer is folded to the actual user name
- * "SCOTT". DTP stores the original string "scott", while the Oracle JDBC
- * driver stores the folded string "SCOTT".
- */
- void addDefaultSchemaIdentifiersTo(@SuppressWarnings("unused") Database database, String userName, ArrayList<String> identifiers) {
- identifiers.add(userName);
- }
-
-
- // ********** folding strategy used to convert names and identifiers **********
-
- /**
- * The SQL spec says a "normal" (non-delimited) identifier should be
- * folded to uppercase; but some databases do otherwise (e.g. Sybase).
- */
- abstract FoldingStrategy getFoldingStrategy();
-
-
- // ********** name -> identifier **********
-
- public String convertNameToIdentifier(String name, String defaultName) {
- return this.nameRequiresDelimiters(name) ? this.delimitName(name)
- : this.normalNamesMatch(name, defaultName) ? null : name;
- }
-
- public String convertNameToIdentifier(String name) {
- return this.nameRequiresDelimiters(name) ? this.delimitName(name) : name;
- }
-
- /**
- * Return whether the specified database object name must be delimited
- * when used in an SQL statement.
- * If the name has any "special" characters (as opposed to letters,
- * digits, and other allowed characters [e.g. underscores]), it requires
- * delimiters.
- * If the name is mixed case and the database folds undelimited names
- * (to either uppercase or lowercase), it requires delimiters.
- */
- boolean nameRequiresDelimiters(String name) {
- return (name.length() == 0) // an empty string must be delimited(?)
- || this.nameContainsAnyNonNormalCharacters(name)
- || this.nameIsNotFolded(name);
- }
-
- /**
- * Return whether the specified name contains any "non-normal" characters
- * that require the name to be delimited.
- * Pre-condition: the specified name is not empty
- */
- boolean nameContainsAnyNonNormalCharacters(String name) {
- char[] string = name.toCharArray();
- if (this.characterIsNonNormalNameStart(string[0])) {
- return true;
- }
- for (int i = string.length; i-- > 1; ) { // note: stop at 1
- if (this.characterIsNonNormalNamePart(string[i])) {
- return true;
- }
- }
- return false;
- }
-
- /**
- * Return whether the specified character is "non-normal" for the first
- * character of a name.
- * Typically, databases are more restrictive about what characters can
- * be used to *start* an identifier (as opposed to the characters
- * allowed for the remainder of the identifier).
- */
- boolean characterIsNonNormalNameStart(char c) {
- return ! this.characterIsNormalNameStart(c);
- }
-
- /**
- * Return whether the specified character is "normal" for the first
- * character of a name.
- * The first character of an identifier can be:
- * - a letter
- * - any of the extended, vendor-specific, "normal" start characters
- */
- boolean characterIsNormalNameStart(char c) {
- // all vendors allow a letter
- return Character.isLetter(c)
- || this.characterIsExtendedNormalNameStart(c);
- }
-
- boolean characterIsExtendedNormalNameStart(char c) {
- return arrayContains(this.getExtendedNormalNameStartCharacters(), c);
- }
-
- /**
- * Return the "normal" characters, beyond letters, for the
- * first character of a name.
- * Return null if there are no "extended" characters.
- */
- char[] getExtendedNormalNameStartCharacters() {
- return null;
- }
-
- /**
- * Return whether the specified character is "non-normal" for the second
- * and subsequent characters of a name.
- */
- boolean characterIsNonNormalNamePart(char c) {
- return ! this.characterIsNormalNamePart(c);
- }
-
- /**
- * Return whether the specified character is "normal" for the second and
- * subsequent characters of a name.
- * The second and subsequent characters of a "normal" name can be:
- * - a letter
- * - a digit
- * - any of the extended, vendor-specific, "normal" start characters
- * - any of the extended, vendor-specific, "normal" part characters
- */
- boolean characterIsNormalNamePart(char c) {
- // all vendors allow a letter or digit
- return Character.isLetterOrDigit(c)
- || this.characterIsExtendedNormalNameStart(c)
- || this.characterIsExtendedNormalNamePart(c);
- }
-
- boolean characterIsExtendedNormalNamePart(char c) {
- return arrayContains(this.getExtendedNormalNamePartCharacters(), c);
- }
-
- /**
- * Return the "normal" characters, beyond letters and digits and the
- * "normal" first characters, for the second and subsequent characters
- * of an identifier. Return null if there are no additional characters.
- */
- char[] getExtendedNormalNamePartCharacters() {
- return null;
- }
-
- /**
- * Return whether the specified name is not folded to the database's
- * case, requiring it to be delimited.
- */
- boolean nameIsNotFolded(String name) {
- return ! this.getFoldingStrategy().nameIsFolded(name);
- }
-
- /**
- * Return whether the specified "normal" names match.
- */
- boolean normalNamesMatch(String name1, String name2) {
- return this.normalIdentifiersAreCaseSensitive() ?
- name1.equals(name2)
- :
- name1.equalsIgnoreCase(name2);
- }
-
- /**
- * Typically, "normal" identifiers are case-insensitive.
- */
- boolean normalIdentifiersAreCaseSensitive() {
- return this.getFoldingStrategy().normalIdentifiersAreCaseSensitive();
- }
-
- /**
- * Wrap the specified name in delimiters (typically double-quotes),
- * converting it to an identifier.
- */
- String delimitName(String name) {
- return StringTools.quote(name);
- }
-
-
- // ********** identifier -> name **********
-
- // not sure how to handle an empty string:
- // both "" and "\"\"" are converted to "" ...
- // convert "" to 'null' since empty strings must be delimited?
- public String convertIdentifierToName(String identifier) {
- return (identifier == null) ? null :
- this.identifierIsDelimited(identifier) ?
- StringTools.undelimit(identifier)
- :
- this.getFoldingStrategy().fold(identifier);
- }
-
- /**
- * Return whether the specified identifier is "delimited".
- * The SQL-92 spec says identifiers should be delimited by
- * double-quotes; but some databases allow otherwise (e.g. Sybase).
- */
- boolean identifierIsDelimited(String identifier) {
- return StringTools.stringIsQuoted(identifier);
- }
-
-
- // ********** misc **********
-
- @Override
- public String toString() {
- return this.getDTPVendorName();
- }
-
- /**
- * static convenience method - array null check
- */
- static boolean arrayContains(char[] array, char c) {
- return (array != null) && CollectionTools.contains(array, c);
- }
-
-}
diff --git a/jpa/plugins/org.eclipse.jpt.db/src/org/eclipse/jpt/db/internal/vendor/CatalogStrategy.java b/jpa/plugins/org.eclipse.jpt.db/src/org/eclipse/jpt/db/internal/vendor/CatalogStrategy.java
deleted file mode 100644
index 9c7a4b59c8..0000000000
--- a/jpa/plugins/org.eclipse.jpt.db/src/org/eclipse/jpt/db/internal/vendor/CatalogStrategy.java
+++ /dev/null
@@ -1,38 +0,0 @@
-/*******************************************************************************
- * Copyright (c) 2009 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.
- *
- * Contributors:
- * Oracle - initial API and implementation
- ******************************************************************************/
-package org.eclipse.jpt.db.internal.vendor;
-
-import java.util.List;
-
-import org.eclipse.datatools.modelbase.sql.schema.Catalog;
-import org.eclipse.datatools.modelbase.sql.schema.Database;
-import org.eclipse.datatools.modelbase.sql.schema.Schema;
-
-/**
- * Handle the variety of catalog (and schema) configurations generated by DTP.
- */
-interface CatalogStrategy {
-
- /**
- * Return whether the DTP database has real catalogs.
- */
- boolean supportsCatalogs(Database database);
-
- /**
- * Return the specified database's catalogs.
- */
- List<Catalog> getCatalogs(Database database);
-
- /**
- * Return the specified database's schemas.
- */
- List<Schema> getSchemas(Database database);
-
-}
diff --git a/jpa/plugins/org.eclipse.jpt.db/src/org/eclipse/jpt/db/internal/vendor/DB2.java b/jpa/plugins/org.eclipse.jpt.db/src/org/eclipse/jpt/db/internal/vendor/DB2.java
deleted file mode 100644
index 259d039185..0000000000
--- a/jpa/plugins/org.eclipse.jpt.db/src/org/eclipse/jpt/db/internal/vendor/DB2.java
+++ /dev/null
@@ -1,62 +0,0 @@
-/*******************************************************************************
- * Copyright (c) 2009 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.
- *
- * Contributors:
- * Oracle - initial API and implementation
- ******************************************************************************/
-package org.eclipse.jpt.db.internal.vendor;
-
-class DB2
- extends AbstractVendor
-{
- private final String dtpVendorName;
-
- private static final Vendor UDB = new DB2("DB2 UDB"); //$NON-NLS-1$
- private static final Vendor UDB_I_SERIES = new DB2("DB2 UDB iSeries"); //$NON-NLS-1$
- private static final Vendor UDB_Z_SERIES = new DB2("DB2 UDB zSeries"); //$NON-NLS-1$
-
- static Vendor udb() {
- return UDB;
- }
-
- static Vendor udbISeries() {
- return UDB_I_SERIES;
- }
-
- static Vendor udbZSeries() {
- return UDB_Z_SERIES;
- }
-
- /**
- * Ensure only static instances.
- */
- private DB2(String dtpVendorName) {
- super();
- this.dtpVendorName = dtpVendorName;
- }
-
- @Override
- public String getDTPVendorName() {
- return this.dtpVendorName;
- }
-
- @Override
- CatalogStrategy getCatalogStrategy() {
- return UnknownCatalogStrategy.instance(); // not verified yet...
- }
-
- @Override
- FoldingStrategy getFoldingStrategy() {
- return UpperCaseFoldingStrategy.instance();
- }
-
- @Override
- char[] getExtendedNormalNamePartCharacters() {
- return EXTENDED_NORMAL_NAME_PART_CHARACTERS;
- }
- private static final char[] EXTENDED_NORMAL_NAME_PART_CHARACTERS = new char[] { '_' };
-
-}
diff --git a/jpa/plugins/org.eclipse.jpt.db/src/org/eclipse/jpt/db/internal/vendor/Derby.java b/jpa/plugins/org.eclipse.jpt.db/src/org/eclipse/jpt/db/internal/vendor/Derby.java
deleted file mode 100644
index 01bce02199..0000000000
--- a/jpa/plugins/org.eclipse.jpt.db/src/org/eclipse/jpt/db/internal/vendor/Derby.java
+++ /dev/null
@@ -1,71 +0,0 @@
-/*******************************************************************************
- * Copyright (c) 2009 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.
- *
- * Contributors:
- * Oracle - initial API and implementation
- ******************************************************************************/
-package org.eclipse.jpt.db.internal.vendor;
-
-import java.util.ArrayList;
-
-import org.eclipse.datatools.modelbase.sql.schema.Database;
-
-class Derby
- extends AbstractVendor
-{
- // singleton
- private static final Vendor INSTANCE = new Derby();
-
- /**
- * Return the singleton.
- */
- static Vendor instance() {
- return INSTANCE;
- }
-
- /**
- * Ensure single instance.
- */
- private Derby() {
- super();
- }
-
- @Override
- public String getDTPVendorName() {
- return "Derby"; //$NON-NLS-1$
- }
-
- @Override
- CatalogStrategy getCatalogStrategy() {
- return FauxCatalogStrategy.instance();
- }
-
- @Override
- FoldingStrategy getFoldingStrategy() {
- return UpperCaseFoldingStrategy.instance();
- }
-
- @Override
- void addDefaultSchemaIdentifiersTo(Database database, String userName, ArrayList<String> identifiers) {
- identifiers.add(this.buildDefaultSchemaIdentifier(userName));
- }
-
- /**
- * The default user name on Derby is "APP" when the user connects without
- * a user name.
- */
- private String buildDefaultSchemaIdentifier(String userName) {
- return ((userName != null) && (userName.length() != 0)) ? userName : DEFAULT_USER_IDENTIFIER;
- }
- private static final String DEFAULT_USER_IDENTIFIER = "APP"; //$NON-NLS-1$
-
- @Override
- char[] getExtendedNormalNamePartCharacters() {
- return EXTENDED_NORMAL_NAME_PART_CHARACTERS;
- }
- private static final char[] EXTENDED_NORMAL_NAME_PART_CHARACTERS = new char[] { '_' };
-
-}
diff --git a/jpa/plugins/org.eclipse.jpt.db/src/org/eclipse/jpt/db/internal/vendor/FauxCatalogStrategy.java b/jpa/plugins/org.eclipse.jpt.db/src/org/eclipse/jpt/db/internal/vendor/FauxCatalogStrategy.java
deleted file mode 100644
index b5b5b4218d..0000000000
--- a/jpa/plugins/org.eclipse.jpt.db/src/org/eclipse/jpt/db/internal/vendor/FauxCatalogStrategy.java
+++ /dev/null
@@ -1,73 +0,0 @@
-/*******************************************************************************
- * Copyright (c) 2009 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.
- *
- * Contributors:
- * Oracle - initial API and implementation
- ******************************************************************************/
-package org.eclipse.jpt.db.internal.vendor;
-
-import java.util.Collections;
-import java.util.List;
-
-import org.eclipse.datatools.modelbase.sql.schema.Catalog;
-import org.eclipse.datatools.modelbase.sql.schema.Database;
-import org.eclipse.datatools.modelbase.sql.schema.Schema;
-
-/**
- * Catalog strategy for DTP databases that build a "virtual" catalog (that has
- * no name) because the underlying JDBC driver does not return any catalogs
- * (e.g. Oracle).
- * @see java.sql.DatabaseMetaData#getCatalogs()
- */
-class FauxCatalogStrategy
- implements CatalogStrategy
-{
- // singleton
- private static final CatalogStrategy INSTANCE = new FauxCatalogStrategy();
-
- /**
- * Return the singleton.
- */
- static CatalogStrategy instance() {
- return INSTANCE;
- }
-
- /**
- * Ensure single instance.
- */
- private FauxCatalogStrategy() {
- super();
- }
-
- public boolean supportsCatalogs(Database database) {
- return false;
- }
-
- public List<Catalog> getCatalogs(Database database) {
- return Collections.emptyList();
- }
-
- @SuppressWarnings("unchecked")
- public List<Schema> getSchemas(Database database) {
- return this.getFauxCatalog(database.getCatalogs()).getSchemas();
- }
-
- private Catalog getFauxCatalog(List<Catalog> catalogs) {
- if (catalogs == null) {
- throw new IllegalStateException();
- }
- if (catalogs.size() != 1) {
- throw new IllegalStateException("not a single catalog: " + catalogs.size()); //$NON-NLS-1$
- }
-
- Catalog catalog = catalogs.get(0);
- if (catalog.getName().length() != 0) {
- throw new IllegalStateException("illegal name: " + catalog.getName()); //$NON-NLS-1$
- }
- return catalog;
- }
-
-}
diff --git a/jpa/plugins/org.eclipse.jpt.db/src/org/eclipse/jpt/db/internal/vendor/FoldingStrategy.java b/jpa/plugins/org.eclipse.jpt.db/src/org/eclipse/jpt/db/internal/vendor/FoldingStrategy.java
deleted file mode 100644
index 9527f568e2..0000000000
--- a/jpa/plugins/org.eclipse.jpt.db/src/org/eclipse/jpt/db/internal/vendor/FoldingStrategy.java
+++ /dev/null
@@ -1,34 +0,0 @@
-/*******************************************************************************
- * Copyright (c) 2009 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.
- *
- * Contributors:
- * Oracle - initial API and implementation
- ******************************************************************************/
-package org.eclipse.jpt.db.internal.vendor;
-
-/**
- * Handle database-specific identifier-folding issues.
- */
-interface FoldingStrategy {
-
- /**
- * Fold the specified name.
- */
- String fold(String name);
-
- /**
- * Return whether the specified database object name is already folded,
- * meaning, if it has no special characters, it requires no delimiters.
- */
- boolean nameIsFolded(String name);
-
- /**
- * Return whether the database is case-sensitive when using "normal"
- * (i.e. non-delimited) identifiers.
- */
- boolean normalIdentifiersAreCaseSensitive();
-
-}
diff --git a/jpa/plugins/org.eclipse.jpt.db/src/org/eclipse/jpt/db/internal/vendor/HSQLDB.java b/jpa/plugins/org.eclipse.jpt.db/src/org/eclipse/jpt/db/internal/vendor/HSQLDB.java
deleted file mode 100644
index 45f51b79b3..0000000000
--- a/jpa/plugins/org.eclipse.jpt.db/src/org/eclipse/jpt/db/internal/vendor/HSQLDB.java
+++ /dev/null
@@ -1,57 +0,0 @@
-/*******************************************************************************
- * Copyright (c) 2009 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.
- *
- * Contributors:
- * Oracle - initial API and implementation
- ******************************************************************************/
-package org.eclipse.jpt.db.internal.vendor;
-
-import java.util.ArrayList;
-
-import org.eclipse.datatools.modelbase.sql.schema.Database;
-
-class HSQLDB
- extends AbstractVendor
-{
- // singleton
- private static final Vendor INSTANCE = new HSQLDB();
-
- /**
- * Return the singleton.
- */
- static Vendor instance() {
- return INSTANCE;
- }
-
- /**
- * Ensure single instance.
- */
- private HSQLDB() {
- super();
- }
-
- @Override
- public String getDTPVendorName() {
- return "HSQLDB"; //$NON-NLS-1$
- }
-
- @Override
- CatalogStrategy getCatalogStrategy() {
- return UnknownCatalogStrategy.instance(); // not verified yet...
- }
-
- @Override
- FoldingStrategy getFoldingStrategy() {
- return UpperCaseFoldingStrategy.instance();
- }
-
- @Override
- void addDefaultSchemaIdentifiersTo(Database database, String userName, ArrayList<String> identifiers) {
- identifiers.add(PUBLIC_SCHEMA_IDENTIFIER);
- }
- private static final String PUBLIC_SCHEMA_IDENTIFIER = "PUBLIC"; //$NON-NLS-1$
-
-}
diff --git a/jpa/plugins/org.eclipse.jpt.db/src/org/eclipse/jpt/db/internal/vendor/Informix.java b/jpa/plugins/org.eclipse.jpt.db/src/org/eclipse/jpt/db/internal/vendor/Informix.java
deleted file mode 100644
index 200c4b2de4..0000000000
--- a/jpa/plugins/org.eclipse.jpt.db/src/org/eclipse/jpt/db/internal/vendor/Informix.java
+++ /dev/null
@@ -1,59 +0,0 @@
-/*******************************************************************************
- * Copyright (c) 2009 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.
- *
- * Contributors:
- * Oracle - initial API and implementation
- ******************************************************************************/
-package org.eclipse.jpt.db.internal.vendor;
-
-class Informix
- extends AbstractVendor
-{
- // singleton
- private static final Vendor INSTANCE = new Informix();
-
- /**
- * Return the singleton.
- */
- static Vendor instance() {
- return INSTANCE;
- }
-
- /**
- * Ensure single instance.
- */
- private Informix() {
- super();
- }
-
- @Override
- public String getDTPVendorName() {
- return "Informix"; //$NON-NLS-1$
- }
-
- @Override
- CatalogStrategy getCatalogStrategy() {
- return UnknownCatalogStrategy.instance(); // not verified yet...
- }
-
- @Override
- FoldingStrategy getFoldingStrategy() {
- return LowerCaseFoldingStrategy.instance();
- }
-
- @Override
- char[] getExtendedNormalNameStartCharacters() {
- return EXTENDED_NORMAL_NAME_START_CHARACTERS;
- }
- private static final char[] EXTENDED_NORMAL_NAME_START_CHARACTERS = new char[] { '_' };
-
- @Override
- char[] getExtendedNormalNamePartCharacters() {
- return EXTENDED_NORMAL_NAME_PART_CHARACTERS;
- }
- private static final char[] EXTENDED_NORMAL_NAME_PART_CHARACTERS = new char[] { '$' };
-
-}
diff --git a/jpa/plugins/org.eclipse.jpt.db/src/org/eclipse/jpt/db/internal/vendor/LowerCaseFoldingStrategy.java b/jpa/plugins/org.eclipse.jpt.db/src/org/eclipse/jpt/db/internal/vendor/LowerCaseFoldingStrategy.java
deleted file mode 100644
index 833c70f1d2..0000000000
--- a/jpa/plugins/org.eclipse.jpt.db/src/org/eclipse/jpt/db/internal/vendor/LowerCaseFoldingStrategy.java
+++ /dev/null
@@ -1,57 +0,0 @@
-/*******************************************************************************
- * Copyright (c) 2009 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.
- *
- * Contributors:
- * Oracle - initial API and implementation
- ******************************************************************************/
-package org.eclipse.jpt.db.internal.vendor;
-
-import org.eclipse.jpt.utility.internal.ClassTools;
-import org.eclipse.jpt.utility.internal.StringTools;
-
-/**
- * Fold "normal" identifiers to lower case.
- * Ignore the case of "normal" identifiers.
- */
-class LowerCaseFoldingStrategy
- implements FoldingStrategy
-{
-
- // singleton
- private static final FoldingStrategy INSTANCE = new LowerCaseFoldingStrategy();
-
- /**
- * Return the singleton.
- */
- static FoldingStrategy instance() {
- return INSTANCE;
- }
-
- /**
- * Ensure single instance.
- */
- private LowerCaseFoldingStrategy() {
- super();
- }
-
- public String fold(String name) {
- return name.toLowerCase();
- }
-
- public boolean nameIsFolded(String name) {
- return StringTools.stringIsLowercase(name);
- }
-
- public boolean normalIdentifiersAreCaseSensitive() {
- return false;
- }
-
- @Override
- public String toString() {
- return ClassTools.toStringClassNameForObject(this);
- }
-
-}
diff --git a/jpa/plugins/org.eclipse.jpt.db/src/org/eclipse/jpt/db/internal/vendor/MaxDB.java b/jpa/plugins/org.eclipse.jpt.db/src/org/eclipse/jpt/db/internal/vendor/MaxDB.java
deleted file mode 100644
index 7d0818c7d8..0000000000
--- a/jpa/plugins/org.eclipse.jpt.db/src/org/eclipse/jpt/db/internal/vendor/MaxDB.java
+++ /dev/null
@@ -1,59 +0,0 @@
-/*******************************************************************************
- * Copyright (c) 2009 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.
- *
- * Contributors:
- * Oracle - initial API and implementation
- ******************************************************************************/
-package org.eclipse.jpt.db.internal.vendor;
-
-class MaxDB
- extends AbstractVendor
-{
- // singleton
- private static final Vendor INSTANCE = new MaxDB();
-
- /**
- * Return the singleton.
- */
- static Vendor instance() {
- return INSTANCE;
- }
-
- /**
- * Ensure single instance.
- */
- private MaxDB() {
- super();
- }
-
- @Override
- public String getDTPVendorName() {
- return "MaxDB"; //$NON-NLS-1$
- }
-
- @Override
- CatalogStrategy getCatalogStrategy() {
- return UnknownCatalogStrategy.instance(); // not verified yet...
- }
-
- @Override
- FoldingStrategy getFoldingStrategy() {
- return UpperCaseFoldingStrategy.instance();
- }
-
- @Override
- char[] getExtendedNormalNameStartCharacters() {
- return EXTENDED_NORMAL_NAME_START_CHARACTERS;
- }
- private static final char[] EXTENDED_NORMAL_NAME_START_CHARACTERS = new char[] { '#', '@', '$' };
-
- @Override
- char[] getExtendedNormalNamePartCharacters() {
- return EXTENDED_NORMAL_NAME_PART_CHARACTERS;
- }
- private static final char[] EXTENDED_NORMAL_NAME_PART_CHARACTERS = new char[] { '_' };
-
-}
diff --git a/jpa/plugins/org.eclipse.jpt.db/src/org/eclipse/jpt/db/internal/vendor/MySQL.java b/jpa/plugins/org.eclipse.jpt.db/src/org/eclipse/jpt/db/internal/vendor/MySQL.java
deleted file mode 100644
index e2ba75c1a3..0000000000
--- a/jpa/plugins/org.eclipse.jpt.db/src/org/eclipse/jpt/db/internal/vendor/MySQL.java
+++ /dev/null
@@ -1,109 +0,0 @@
-/*******************************************************************************
- * Copyright (c) 2009 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.
- *
- * Contributors:
- * Oracle - initial API and implementation
- ******************************************************************************/
-package org.eclipse.jpt.db.internal.vendor;
-
-import java.util.ArrayList;
-
-import org.eclipse.datatools.modelbase.sql.schema.Database;
-import org.eclipse.jpt.utility.internal.StringTools;
-
-class MySQL
- extends AbstractVendor
-{
- // singleton
- private static final Vendor INSTANCE = new MySQL();
-
- /**
- * Return the singleton.
- */
- static Vendor instance() {
- return INSTANCE;
- }
-
- /**
- * Ensure single instance.
- */
- private MySQL() {
- super();
- }
-
- @Override
- public String getDTPVendorName() {
- return "MySql"; //$NON-NLS-1$
- }
-
- /**
- * The DTP model for MySQL has a database that contains no catalogs;
- * but, instead, directly holds a single schema with the same name as
- * the database. (This is hard-coded in MySqlCatalogDatabase.getSchemas().)
- * Although you can qualify identifiers with a database name
- * in MySQL, only the database specified at login seems to be available
- * in the DTP model....
- *
- * NB: In MySQL DDL, SCHEMA is a synonym for DATABASE; but the JDBC
- * method DatabaseMetaData.getSchemas() returns an empty list,
- * while getCatalogs() returns a list of the available databases.
- * You can also use the JDBC method Connection.setCatalog(String) to
- * set the default database.
- */
- @Override
- CatalogStrategy getCatalogStrategy() {
- return NoCatalogStrategy.instance();
- }
-
- /**
- * MySQL is a bit unusual, so we force exact matches.
- * (e.g. MySQL folds database and table names to lowercase on Windows
- * by default; but that default can be changed by the
- * 'lower_case_table_names' system variable. This is because databases are
- * stored as directories and tables are stored as files in the underlying
- * O/S; and the case-sensitivity of the names is determined by the behavior
- * of filenames on the O/S. Then, to complicate things,
- * none of the other identifiers, like table and column names, are folded;
- * but they are case-insensitive, unless delimited. See
- * http://dev.mysql.com/doc/refman/6.0/en/identifier-case-sensitivity.html.)
- */
- @Override
- FoldingStrategy getFoldingStrategy() {
- return NonFoldingStrategy.instance();
- }
-
- @Override
- void addDefaultSchemaIdentifiersTo(Database database, String userName, ArrayList<String> identifiers) {
- identifiers.add(this.convertNameToIdentifier(database.getName())); // hmmm... ~bjv
- }
-
- /**
- * MySQL is the only vendor that allows a digit.
- * Although, the name cannnot be *all* digits.
- */
- @Override
- boolean characterIsNormalNameStart(char c) {
- return Character.isDigit(c) || super.characterIsNormalNameStart(c);
- }
-
- @Override
- char[] getExtendedNormalNameStartCharacters() {
- return EXTENDED_NORMAL_NAME_START_CHARACTERS;
- }
- private static final char[] EXTENDED_NORMAL_NAME_START_CHARACTERS = new char[] { '_', '$' };
-
- /**
- * By default, MySQL delimits identifiers with backticks (`); but it
- * can also be configured to use double-quotes.
- */
- @Override
- boolean identifierIsDelimited(String identifier) {
- return StringTools.stringIsDelimited(identifier, BACKTICK)
- || super.identifierIsDelimited(identifier);
- }
- private static final char BACKTICK = '`';
-
-}
diff --git a/jpa/plugins/org.eclipse.jpt.db/src/org/eclipse/jpt/db/internal/vendor/NoCatalogStrategy.java b/jpa/plugins/org.eclipse.jpt.db/src/org/eclipse/jpt/db/internal/vendor/NoCatalogStrategy.java
deleted file mode 100644
index a7fb79d9ba..0000000000
--- a/jpa/plugins/org.eclipse.jpt.db/src/org/eclipse/jpt/db/internal/vendor/NoCatalogStrategy.java
+++ /dev/null
@@ -1,56 +0,0 @@
-/*******************************************************************************
- * Copyright (c) 2009 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.
- *
- * Contributors:
- * Oracle - initial API and implementation
- ******************************************************************************/
-package org.eclipse.jpt.db.internal.vendor;
-
-import java.util.Collections;
-import java.util.List;
-
-import org.eclipse.datatools.modelbase.sql.schema.Catalog;
-import org.eclipse.datatools.modelbase.sql.schema.Database;
-import org.eclipse.datatools.modelbase.sql.schema.Schema;
-
-/**
- * Catalog strategy for DTP databases that do not have catalogs
- * (e.g. MySQL see bug 249013).
- */
-class NoCatalogStrategy
- implements CatalogStrategy
-{
- // singleton
- private static final CatalogStrategy INSTANCE = new NoCatalogStrategy();
-
- /**
- * Return the singleton.
- */
- static CatalogStrategy instance() {
- return INSTANCE;
- }
-
- /**
- * Ensure single instance.
- */
- private NoCatalogStrategy() {
- super();
- }
-
- public boolean supportsCatalogs(Database database) {
- return false;
- }
-
- public List<Catalog> getCatalogs(Database database) {
- return Collections.emptyList();
- }
-
- @SuppressWarnings("unchecked")
- public List<Schema> getSchemas(Database database) {
- return database.getSchemas();
- }
-
-}
diff --git a/jpa/plugins/org.eclipse.jpt.db/src/org/eclipse/jpt/db/internal/vendor/NonFoldingStrategy.java b/jpa/plugins/org.eclipse.jpt.db/src/org/eclipse/jpt/db/internal/vendor/NonFoldingStrategy.java
deleted file mode 100644
index e63c1ad71d..0000000000
--- a/jpa/plugins/org.eclipse.jpt.db/src/org/eclipse/jpt/db/internal/vendor/NonFoldingStrategy.java
+++ /dev/null
@@ -1,66 +0,0 @@
-/*******************************************************************************
- * Copyright (c) 2009 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.
- *
- * Contributors:
- * Oracle - initial API and implementation
- ******************************************************************************/
-package org.eclipse.jpt.db.internal.vendor;
-
-import org.eclipse.jpt.utility.internal.ClassTools;
-
-/**
- * Do not fold "normal" identifiers.
- * Respect the case of "normal" identifiers.
- */
-class NonFoldingStrategy
- implements FoldingStrategy
-{
-
- // singleton
- private static final FoldingStrategy INSTANCE = new NonFoldingStrategy();
-
- /**
- * Return the singleton.
- */
- static FoldingStrategy instance() {
- return INSTANCE;
- }
-
- /**
- * Ensure single instance.
- */
- private NonFoldingStrategy() {
- super();
- }
-
- /**
- * Since identifiers are not folded to upper- or lower-case, the name is
- * already "folded".
- */
- public String fold(String name) {
- return name;
- }
-
- /**
- * Since identifiers are not folded to upper- or lower-case, the name is
- * already "folded".
- * (Non-folding databases do not require delimiters around mixed-case
- * "normal" identifiers.)
- */
- public boolean nameIsFolded(String name) {
- return true;
- }
-
- public boolean normalIdentifiersAreCaseSensitive() {
- return true;
- }
-
- @Override
- public String toString() {
- return ClassTools.toStringClassNameForObject(this);
- }
-
-}
diff --git a/jpa/plugins/org.eclipse.jpt.db/src/org/eclipse/jpt/db/internal/vendor/Oracle.java b/jpa/plugins/org.eclipse.jpt.db/src/org/eclipse/jpt/db/internal/vendor/Oracle.java
deleted file mode 100644
index cb04f9f36c..0000000000
--- a/jpa/plugins/org.eclipse.jpt.db/src/org/eclipse/jpt/db/internal/vendor/Oracle.java
+++ /dev/null
@@ -1,53 +0,0 @@
-/*******************************************************************************
- * Copyright (c) 2009 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.
- *
- * Contributors:
- * Oracle - initial API and implementation
- ******************************************************************************/
-package org.eclipse.jpt.db.internal.vendor;
-
-class Oracle
- extends AbstractVendor
-{
- // singleton
- private static final Vendor INSTANCE = new Oracle();
-
- /**
- * Return the singleton.
- */
- static Vendor instance() {
- return INSTANCE;
- }
-
- /**
- * Ensure single instance.
- */
- private Oracle() {
- super();
- }
-
- @Override
- public String getDTPVendorName() {
- return "Oracle"; //$NON-NLS-1$
- }
-
- @Override
- CatalogStrategy getCatalogStrategy() {
- return FauxCatalogStrategy.instance();
- }
-
- @Override
- FoldingStrategy getFoldingStrategy() {
- return UpperCaseFoldingStrategy.instance();
- }
-
- @Override
- char[] getExtendedNormalNamePartCharacters() {
- return EXTENDED_NORMAL_NAME_PART_CHARACTERS;
- }
- private static final char[] EXTENDED_NORMAL_NAME_PART_CHARACTERS = new char[] { '_', '$', '#' };
-
-}
diff --git a/jpa/plugins/org.eclipse.jpt.db/src/org/eclipse/jpt/db/internal/vendor/PostgreSQL.java b/jpa/plugins/org.eclipse.jpt.db/src/org/eclipse/jpt/db/internal/vendor/PostgreSQL.java
deleted file mode 100644
index 3ecad54899..0000000000
--- a/jpa/plugins/org.eclipse.jpt.db/src/org/eclipse/jpt/db/internal/vendor/PostgreSQL.java
+++ /dev/null
@@ -1,101 +0,0 @@
-/*******************************************************************************
- * Copyright (c) 2009 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.
- *
- * Contributors:
- * Oracle - initial API and implementation
- ******************************************************************************/
-package org.eclipse.jpt.db.internal.vendor;
-
-import java.util.ArrayList;
-
-import org.eclipse.datatools.modelbase.sql.schema.Catalog;
-import org.eclipse.datatools.modelbase.sql.schema.Database;
-
-class PostgreSQL
- extends AbstractVendor
-{
- // singleton
- private static final Vendor INSTANCE = new PostgreSQL();
-
- /**
- * Return the singleton.
- */
- static Vendor instance() {
- return INSTANCE;
- }
-
- /**
- * Ensure single instance.
- */
- private PostgreSQL() {
- super();
- }
-
- @Override
- public String getDTPVendorName() {
- return "postgres"; //$NON-NLS-1$
- }
-
- /**
- * The PostgreSQL JDBC driver returns a single catalog from the call to
- * DatabaseMetaData.getCatalogs() that has the same name as the
- * database initially specified by the connection (in the JDBC URL).
- * DTP uses this configuration unmodified. Unfortunately, the DTP
- * database's name is not the same as the PostgreSQL database's
- * name.
- */
- @Override
- CatalogStrategy getCatalogStrategy() {
- return SimpleCatalogStrategy.instance();
- }
-
- @Override
- FoldingStrategy getFoldingStrategy() {
- return LowerCaseFoldingStrategy.instance();
- }
-
- /**
- * The PostgreSQL database holds a single catalog that has the same name as
- * the database.
- */
- @Override
- void addDefaultCatalogIdentifiersTo(Database database, String userName, ArrayList<String> identifiers) {
- identifiers.add(this.buildDefaultCatalogIdentifier(database));
- }
-
- private String buildDefaultCatalogIdentifier(Database database) {
- return this.convertNameToIdentifier(this.buildDefaultCatalogName(database));
- }
-
- private String buildDefaultCatalogName(Database database) {
- return ((Catalog) database.getCatalogs().get(0)).getName();
- }
-
- /**
- * PostgreSQL has a "schema search path". The default is:
- * "$user",public
- * If the "$user" schema is not found, use the "public" schema.
- */
- @Override
- void addDefaultSchemaIdentifiersTo(Database database, String userName, ArrayList<String> identifiers) {
- super.addDefaultSchemaIdentifiersTo(database, userName, identifiers);
- identifiers.add(PUBLIC_SCHEMA_IDENTIFIER);
- }
- private static final String PUBLIC_SCHEMA_IDENTIFIER = "public"; //$NON-NLS-1$
-
- @Override
- char[] getExtendedNormalNameStartCharacters() {
- return EXTENDED_NORMAL_NAME_START_CHARACTERS;
- }
- private static final char[] EXTENDED_NORMAL_NAME_START_CHARACTERS = new char[] { '_' };
-
- @Override
- char[] getExtendedNormalNamePartCharacters() {
- return EXTENDED_NORMAL_NAME_PART_CHARACTERS;
- }
- private static final char[] EXTENDED_NORMAL_NAME_PART_CHARACTERS = new char[] { '$' };
-
-}
diff --git a/jpa/plugins/org.eclipse.jpt.db/src/org/eclipse/jpt/db/internal/vendor/SQLServer.java b/jpa/plugins/org.eclipse.jpt.db/src/org/eclipse/jpt/db/internal/vendor/SQLServer.java
deleted file mode 100644
index 0afe3b1e86..0000000000
--- a/jpa/plugins/org.eclipse.jpt.db/src/org/eclipse/jpt/db/internal/vendor/SQLServer.java
+++ /dev/null
@@ -1,87 +0,0 @@
-/*******************************************************************************
- * Copyright (c) 2009 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.
- *
- * Contributors:
- * Oracle - initial API and implementation
- ******************************************************************************/
-package org.eclipse.jpt.db.internal.vendor;
-
-import java.util.ArrayList;
-
-import org.eclipse.datatools.modelbase.sql.schema.Database;
-import org.eclipse.jpt.utility.internal.StringTools;
-
-class SQLServer
- extends AbstractVendor
-{
- // singleton
- private static final Vendor INSTANCE = new SQLServer();
-
- /**
- * Return the singleton.
- */
- static Vendor instance() {
- return INSTANCE;
- }
-
- /**
- * Ensure single instance.
- */
- private SQLServer() {
- super();
- }
-
- @Override
- public String getDTPVendorName() {
- return "SQL Server"; //$NON-NLS-1$
- }
-
- @Override
- CatalogStrategy getCatalogStrategy() {
- return SimpleCatalogStrategy.instance();
- }
-
- /**
- * By default, SQL Server identifiers are case-sensitive, even without
- * delimiters. This can depend on the collation setting....
- */
- @Override
- FoldingStrategy getFoldingStrategy() {
- return NonFoldingStrategy.instance();
- }
-
- /**
- * The default schema on SQL Server for any database (catalog) is 'dbo'.
- */
- @Override
- void addDefaultSchemaIdentifiersTo(Database database, String userName, ArrayList<String> identifiers) {
- identifiers.add(DEFAULT_SCHEMA_IDENTIFIER);
- }
- private static final String DEFAULT_SCHEMA_IDENTIFIER = "dbo"; //$NON-NLS-1$
-
- @Override
- char[] getExtendedNormalNameStartCharacters() {
- return EXTENDED_NORMAL_NAME_START_CHARACTERS;
- }
- private static final char[] EXTENDED_NORMAL_NAME_START_CHARACTERS = new char[] { '_', '@', '#' };
-
- @Override
- char[] getExtendedNormalNamePartCharacters() {
- return EXTENDED_NORMAL_NAME_PART_CHARACTERS;
- }
- private static final char[] EXTENDED_NORMAL_NAME_PART_CHARACTERS = new char[] { '$' };
-
- /**
- * By default, SQL Server delimits identifiers with brackets ([]); but it
- * can also be configured to use double-quotes.
- */
- @Override
- boolean identifierIsDelimited(String identifier) {
- return StringTools.stringIsBracketed(identifier)
- || super.identifierIsDelimited(identifier);
- }
-
-}
diff --git a/jpa/plugins/org.eclipse.jpt.db/src/org/eclipse/jpt/db/internal/vendor/SimpleCatalogStrategy.java b/jpa/plugins/org.eclipse.jpt.db/src/org/eclipse/jpt/db/internal/vendor/SimpleCatalogStrategy.java
deleted file mode 100644
index 8a1a04129e..0000000000
--- a/jpa/plugins/org.eclipse.jpt.db/src/org/eclipse/jpt/db/internal/vendor/SimpleCatalogStrategy.java
+++ /dev/null
@@ -1,57 +0,0 @@
-/*******************************************************************************
- * Copyright (c) 2009 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.
- *
- * Contributors:
- * Oracle - initial API and implementation
- ******************************************************************************/
-package org.eclipse.jpt.db.internal.vendor;
-
-import java.util.Collections;
-import java.util.List;
-
-import org.eclipse.datatools.modelbase.sql.schema.Catalog;
-import org.eclipse.datatools.modelbase.sql.schema.Database;
-import org.eclipse.datatools.modelbase.sql.schema.Schema;
-
-/**
- * Catalog strategy for DTP databases that simply model the catalogs returned
- * by the underlying JDBC driver (e.g. Sybase).
- * @see java.sql.DatabaseMetaData#getCatalogs()
- */
-class SimpleCatalogStrategy
- implements CatalogStrategy
-{
- // singleton
- private static final CatalogStrategy INSTANCE = new SimpleCatalogStrategy();
-
- /**
- * Return the singleton.
- */
- static CatalogStrategy instance() {
- return INSTANCE;
- }
-
- /**
- * Ensure single instance.
- */
- private SimpleCatalogStrategy() {
- super();
- }
-
- public boolean supportsCatalogs(Database database) {
- return true;
- }
-
- @SuppressWarnings("unchecked")
- public List<Catalog> getCatalogs(Database database) {
- return database.getCatalogs();
- }
-
- public List<Schema> getSchemas(Database database) {
- return Collections.emptyList();
- }
-
-}
diff --git a/jpa/plugins/org.eclipse.jpt.db/src/org/eclipse/jpt/db/internal/vendor/Sybase.java b/jpa/plugins/org.eclipse.jpt.db/src/org/eclipse/jpt/db/internal/vendor/Sybase.java
deleted file mode 100644
index 1433e920fb..0000000000
--- a/jpa/plugins/org.eclipse.jpt.db/src/org/eclipse/jpt/db/internal/vendor/Sybase.java
+++ /dev/null
@@ -1,103 +0,0 @@
-/*******************************************************************************
- * Copyright (c) 2009 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.
- *
- * Contributors:
- * Oracle - initial API and implementation
- ******************************************************************************/
-package org.eclipse.jpt.db.internal.vendor;
-
-import java.util.ArrayList;
-
-import org.eclipse.datatools.modelbase.sql.schema.Database;
-import org.eclipse.jpt.utility.internal.StringTools;
-
-class Sybase
- extends AbstractVendor
-{
- private final String dtpVendorName;
-
- static final Vendor ASA = new Sybase("Sybase_ASA"); //$NON-NLS-1$
- static final Vendor ASE = new Sybase("Sybase_ASE"); //$NON-NLS-1$
-
- static Vendor asa() {
- return ASA;
- }
-
- static Vendor ase() {
- return ASE;
- }
-
- /**
- * Ensure only static instances.
- */
- private Sybase(String dtpVendorName) {
- super();
- this.dtpVendorName = dtpVendorName;
- }
-
- @Override
- public String getDTPVendorName() {
- return this.dtpVendorName;
- }
-
- @Override
- CatalogStrategy getCatalogStrategy() {
- return SimpleCatalogStrategy.instance();
- }
-
- /**
- * By default, Sybase identifiers are case-sensitive, even without
- * delimiters. This can depend on the collation setting....
- */
- @Override
- FoldingStrategy getFoldingStrategy() {
- return NonFoldingStrategy.instance();
- }
-
- /**
- * The typical default schema on Sybase for any database (catalog) is
- * 'dbo'.
- *
- * Actually, the default schema is more like a search path:
- * The server looks for a schema object (e.g. a table) first in the user's
- * schema, then it looks for the schema object in the database owner's
- * schema (dbo). As a result, it's really not possible to specify
- * the "default" schema without knowing the schema object we are
- * looking for.
- *
- * (Note: the current 'user' is not the same thing as the current
- * 'login' - see sp_adduser and sp_addlogin; so we probably can't
- * use ConnectionProfile#getUserName().)
- */
- @Override
- void addDefaultSchemaIdentifiersTo(Database database, String userName, ArrayList<String> identifiers) {
- identifiers.add(DEFAULT_SCHEMA_IDENTIFIER);
- }
- private static final String DEFAULT_SCHEMA_IDENTIFIER = "dbo"; //$NON-NLS-1$
-
- @Override
- char[] getExtendedNormalNameStartCharacters() {
- return EXTENDED_NORMAL_NAME_START_CHARACTERS;
- }
- private static final char[] EXTENDED_NORMAL_NAME_START_CHARACTERS = new char[] { '_', '@' };
-
- @Override
- char[] getExtendedNormalNamePartCharacters() {
- return EXTENDED_NORMAL_NAME_PART_CHARACTERS;
- }
- private static final char[] EXTENDED_NORMAL_NAME_PART_CHARACTERS = new char[] { '$', '¥', '£', '#' };
-
- /**
- * By default, Sybase delimits identifiers with brackets ([]); but it
- * can also be configured to use double-quotes.
- */
- @Override
- boolean identifierIsDelimited(String identifier) {
- return StringTools.stringIsBracketed(identifier)
- || super.identifierIsDelimited(identifier);
- }
-
-}
diff --git a/jpa/plugins/org.eclipse.jpt.db/src/org/eclipse/jpt/db/internal/vendor/UnknownCatalogStrategy.java b/jpa/plugins/org.eclipse.jpt.db/src/org/eclipse/jpt/db/internal/vendor/UnknownCatalogStrategy.java
deleted file mode 100644
index ea9a729e35..0000000000
--- a/jpa/plugins/org.eclipse.jpt.db/src/org/eclipse/jpt/db/internal/vendor/UnknownCatalogStrategy.java
+++ /dev/null
@@ -1,87 +0,0 @@
-/*******************************************************************************
- * Copyright (c) 2009 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.
- *
- * Contributors:
- * Oracle - initial API and implementation
- ******************************************************************************/
-package org.eclipse.jpt.db.internal.vendor;
-
-import java.util.Collections;
-import java.util.List;
-
-import org.eclipse.datatools.modelbase.sql.schema.Catalog;
-import org.eclipse.datatools.modelbase.sql.schema.Database;
-import org.eclipse.datatools.modelbase.sql.schema.Schema;
-
-/**
- * Catalog strategy for unknown DTP databases.
- * @see java.sql.DatabaseMetaData#getCatalogs()
- */
-class UnknownCatalogStrategy
- implements CatalogStrategy
-{
- // singleton
- private static final CatalogStrategy INSTANCE = new UnknownCatalogStrategy();
-
- /**
- * Return the singleton.
- */
- static CatalogStrategy instance() {
- return INSTANCE;
- }
-
- /**
- * Ensure single instance.
- */
- private UnknownCatalogStrategy() {
- super();
- }
-
- @SuppressWarnings("unchecked")
- public boolean supportsCatalogs(Database database) {
- List<Catalog> catalogs = database.getCatalogs();
- if ((catalogs == null) || catalogs.isEmpty()) {
- return false;
- }
-
- return this.getFauxCatalog(catalogs) == null;
- }
-
- @SuppressWarnings("unchecked")
- public List<Catalog> getCatalogs(Database database) {
- List<Catalog> catalogs = database.getCatalogs();
- // if there are no catalogs, the database must hold the schemata directly
- if ((catalogs == null) || catalogs.isEmpty()) {
- return Collections.emptyList();
- }
-
- Catalog fauxCatalog = this.getFauxCatalog(catalogs);
- return (fauxCatalog == null) ? catalogs : Collections.<Catalog>emptyList();
- }
-
- @SuppressWarnings("unchecked")
- public List<Schema> getSchemas(Database database) {
- List<Catalog> catalogs = database.getCatalogs();
- // if there are no catalogs, the database must hold the schemata directly
- if ((catalogs == null) || catalogs.isEmpty()) {
- return database.getSchemas();
- }
-
- Catalog fauxCatalog = this.getFauxCatalog(catalogs);
- return (fauxCatalog != null) ? fauxCatalog.getSchemas() : Collections.emptyList();
- }
-
- private Catalog getFauxCatalog(List<Catalog> catalogs) {
- if (catalogs.size() == 1) {
- Catalog catalog = catalogs.get(0);
- if (catalog.getName().equals("")) { //$NON-NLS-1$
- return catalog;
- }
- }
- return null;
- }
-
-}
diff --git a/jpa/plugins/org.eclipse.jpt.db/src/org/eclipse/jpt/db/internal/vendor/UnrecognizedVendor.java b/jpa/plugins/org.eclipse.jpt.db/src/org/eclipse/jpt/db/internal/vendor/UnrecognizedVendor.java
deleted file mode 100644
index f5751232ff..0000000000
--- a/jpa/plugins/org.eclipse.jpt.db/src/org/eclipse/jpt/db/internal/vendor/UnrecognizedVendor.java
+++ /dev/null
@@ -1,58 +0,0 @@
-/*******************************************************************************
- * Copyright (c) 2009 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.
- *
- * Contributors:
- * Oracle - initial API and implementation
- ******************************************************************************/
-package org.eclipse.jpt.db.internal.vendor;
-
-/**
- *
- */
-class UnrecognizedVendor
- extends AbstractVendor
-{
- // singleton
- private static final Vendor INSTANCE = new UnrecognizedVendor();
-
- /**
- * Return the singleton.
- */
- static Vendor instance() {
- return INSTANCE;
- }
-
- /**
- * Ensure single instance.
- */
- private UnrecognizedVendor() {
- super();
- }
-
- @Override
- public String getDTPVendorName() {
- return "Unrecognized Vendor"; //$NON-NLS-1$
- }
-
- /**
- * Not sure what to do here....
- * Assume the DTP database is organized into one or more catalogs and
- * the schemata are contained by those catalogs. This appears to be the
- * default way DTP builds models these days (i.e. a database with at
- * least one catalog, instead of the database holding schemata
- * directly).
- */
- @Override
- CatalogStrategy getCatalogStrategy() {
- return UnknownCatalogStrategy.instance();
- }
-
- @Override
- FoldingStrategy getFoldingStrategy() {
- return UpperCaseFoldingStrategy.instance();
- }
-
-}
diff --git a/jpa/plugins/org.eclipse.jpt.db/src/org/eclipse/jpt/db/internal/vendor/UpperCaseFoldingStrategy.java b/jpa/plugins/org.eclipse.jpt.db/src/org/eclipse/jpt/db/internal/vendor/UpperCaseFoldingStrategy.java
deleted file mode 100644
index 748d4dd162..0000000000
--- a/jpa/plugins/org.eclipse.jpt.db/src/org/eclipse/jpt/db/internal/vendor/UpperCaseFoldingStrategy.java
+++ /dev/null
@@ -1,57 +0,0 @@
-/*******************************************************************************
- * Copyright (c) 2009 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.
- *
- * Contributors:
- * Oracle - initial API and implementation
- ******************************************************************************/
-package org.eclipse.jpt.db.internal.vendor;
-
-import org.eclipse.jpt.utility.internal.ClassTools;
-import org.eclipse.jpt.utility.internal.StringTools;
-
-/**
- * Fold "normal" identifiers to upper case.
- * Ignore the case of "normal" identifiers.
- */
-class UpperCaseFoldingStrategy
- implements FoldingStrategy
-{
-
- // singleton
- private static final FoldingStrategy INSTANCE = new UpperCaseFoldingStrategy();
-
- /**
- * Return the singleton.
- */
- static FoldingStrategy instance() {
- return INSTANCE;
- }
-
- /**
- * Ensure single instance.
- */
- private UpperCaseFoldingStrategy() {
- super();
- }
-
- public String fold(String name) {
- return name.toUpperCase();
- }
-
- public boolean nameIsFolded(String name) {
- return StringTools.stringIsUppercase(name);
- }
-
- public boolean normalIdentifiersAreCaseSensitive() {
- return false;
- }
-
- @Override
- public String toString() {
- return ClassTools.toStringClassNameForObject(this);
- }
-
-}
diff --git a/jpa/plugins/org.eclipse.jpt.db/src/org/eclipse/jpt/db/internal/vendor/Vendor.java b/jpa/plugins/org.eclipse.jpt.db/src/org/eclipse/jpt/db/internal/vendor/Vendor.java
deleted file mode 100644
index c73d774eb0..0000000000
--- a/jpa/plugins/org.eclipse.jpt.db/src/org/eclipse/jpt/db/internal/vendor/Vendor.java
+++ /dev/null
@@ -1,83 +0,0 @@
-/*******************************************************************************
- * Copyright (c) 2009 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.
- *
- * Contributors:
- * Oracle - initial API and implementation
- ******************************************************************************/
-package org.eclipse.jpt.db.internal.vendor;
-
-import java.util.List;
-
-import org.eclipse.datatools.modelbase.sql.schema.Catalog;
-import org.eclipse.datatools.modelbase.sql.schema.Database;
-import org.eclipse.datatools.modelbase.sql.schema.Schema;
-
-/**
- * Delegate vendor-specific behavior to implementations of this interface:
- * - catalog support
- * - default catalog and schema
- * - converting names to identifiers and vice-versa
- *
- * Note:
- * We use "name" when dealing with the unmodified name of a database object
- * as supplied by the database itself (i.e. it is not delimited and it is always
- * case-sensitive).
- * We use "identifier" when dealing with a string representation of a database
- * object name (i.e. it may be delimited and, depending on the vendor, it may
- * be case-insensitive).
- */
-public interface Vendor {
-
- /**
- * This must match the DTP vendor name.
- * @see org.eclipse.datatools.modelbase.sql.schema.Database#getVendor()
- */
- String getDTPVendorName();
-
- /**
- * Return whether the vendor supports "real" catalogs (e.g. Sybase).
- */
- boolean supportsCatalogs(Database database);
-
- /**
- * Return the specified database's catalogs.
- */
- List<Catalog> getCatalogs(Database database);
-
- /**
- * Return the specified database's default catalog identifiers for the
- * specified user.
- */
- List<String> getDefaultCatalogIdentifiers(Database database, String userName);
-
- /**
- * Return the specified database's schemas.
- */
- List<Schema> getSchemas(Database database);
-
- /**
- * Return the specified database's default schema identifiers for the
- * specified user.
- */
- List<String> getDefaultSchemaIdentifiers(Database database, String userName);
-
- /**
- * Convert the specified database object name to a vendor identifier.
- * Return null if the identifier matches the specified default name.
- */
- String convertNameToIdentifier(String name, String defaultName);
-
- /**
- * Convert the specified database object name to a vendor identifier.
- */
- String convertNameToIdentifier(String name);
-
- /**
- * Convert the specified database object identifier to a vendor name.
- */
- String convertIdentifierToName(String identifier);
-
-}
diff --git a/jpa/plugins/org.eclipse.jpt.db/src/org/eclipse/jpt/db/internal/vendor/VendorRepository.java b/jpa/plugins/org.eclipse.jpt.db/src/org/eclipse/jpt/db/internal/vendor/VendorRepository.java
deleted file mode 100644
index 468f09ea44..0000000000
--- a/jpa/plugins/org.eclipse.jpt.db/src/org/eclipse/jpt/db/internal/vendor/VendorRepository.java
+++ /dev/null
@@ -1,78 +0,0 @@
-/*******************************************************************************
- * Copyright (c) 2009 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.
- *
- * Contributors:
- * Oracle - initial API and implementation
- ******************************************************************************/
-package org.eclipse.jpt.db.internal.vendor;
-
-import java.util.ArrayList;
-import java.util.Iterator;
-
-public class VendorRepository {
- private final Vendor[] vendors;
-
- // singleton
- private static final VendorRepository INSTANCE = new VendorRepository();
-
- /**
- * Return the singleton.
- */
- public static VendorRepository instance() {
- return INSTANCE;
- }
-
- /**
- * Ensure single instance.
- */
- private VendorRepository() {
- super();
- this.vendors = this.buildVendors();
- }
-
- private Vendor[] buildVendors() {
- ArrayList<Vendor> list = new ArrayList<Vendor>();
- this.addVendorsTo(list);
- return list.toArray(new Vendor[list.size()]);
- }
-
- private void addVendorsTo(ArrayList<Vendor> list) {
- this.addVendorTo(DB2.udb(), list);
- this.addVendorTo(DB2.udbISeries(), list);
- this.addVendorTo(DB2.udbZSeries(), list);
- this.addVendorTo(Derby.instance(), list);
- this.addVendorTo(HSQLDB.instance(), list);
- this.addVendorTo(Informix.instance(), list);
- this.addVendorTo(MaxDB.instance(), list);
- this.addVendorTo(MySQL.instance(), list);
- this.addVendorTo(Oracle.instance(), list);
- this.addVendorTo(PostgreSQL.instance(), list);
- this.addVendorTo(SQLServer.instance(), list);
- this.addVendorTo(Sybase.asa(), list);
- this.addVendorTo(Sybase.ase(), list);
- }
-
- private void addVendorTo(Vendor vendor, ArrayList<Vendor> list) {
- String name = vendor.getDTPVendorName();
- for (Iterator<Vendor> stream = list.iterator(); stream.hasNext(); ) {
- if (stream.next().getDTPVendorName().equals(name)) {
- throw new IllegalArgumentException("Duplicate vendor: " + name); //$NON-NLS-1$
- }
- }
- list.add(vendor);
- }
-
- public Vendor getVendor(String dtpVendorName) {
- for (int i = this.vendors.length; i-- > 0;) {
- Vendor vendor = this.vendors[i];
- if (vendor.getDTPVendorName().equals(dtpVendorName)) {
- return vendor;
- }
- }
- return UnrecognizedVendor.instance();
- }
-
-}
diff --git a/jpa/plugins/org.eclipse.jpt.doc.user/.project b/jpa/plugins/org.eclipse.jpt.doc.user/.project
deleted file mode 100644
index 61670ff4fc..0000000000
--- a/jpa/plugins/org.eclipse.jpt.doc.user/.project
+++ /dev/null
@@ -1,22 +0,0 @@
-<?xml version="1.0" encoding="UTF-8"?>
-<projectDescription>
- <name>org.eclipse.jpt.doc.user</name>
- <comment></comment>
- <projects>
- </projects>
- <buildSpec>
- <buildCommand>
- <name>org.eclipse.pde.ManifestBuilder</name>
- <arguments>
- </arguments>
- </buildCommand>
- <buildCommand>
- <name>org.eclipse.pde.SchemaBuilder</name>
- <arguments>
- </arguments>
- </buildCommand>
- </buildSpec>
- <natures>
- <nature>org.eclipse.pde.PluginNature</nature>
- </natures>
-</projectDescription>
diff --git a/jpa/plugins/org.eclipse.jpt.doc.user/META-INF/MANIFEST.MF b/jpa/plugins/org.eclipse.jpt.doc.user/META-INF/MANIFEST.MF
deleted file mode 100644
index 7ebc2cb9f4..0000000000
--- a/jpa/plugins/org.eclipse.jpt.doc.user/META-INF/MANIFEST.MF
+++ /dev/null
@@ -1,9 +0,0 @@
-Manifest-Version: 1.0
-Bundle-ManifestVersion: 2
-Bundle-Name: %pluginName
-Bundle-Vendor: %providerName
-Bundle-SymbolicName: org.eclipse.jpt.doc.user;singleton:=true
-Bundle-Version: 1.1.0.qualifier
-Bundle-Localization: plugin
-Require-Bundle: org.eclipse.help;bundle-version="[3.3.100,4.0.0)",
- org.eclipse.ui.cheatsheets;bundle-version="[3.3.100,4.0.0)"
diff --git a/jpa/plugins/org.eclipse.jpt.doc.user/about.htm b/jpa/plugins/org.eclipse.jpt.doc.user/about.htm
deleted file mode 100644
index 6f6a7fb93e..0000000000
--- a/jpa/plugins/org.eclipse.jpt.doc.user/about.htm
+++ /dev/null
@@ -1,43 +0,0 @@
-<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN"
- "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
-<html xmlns="http://www.w3.org/1999/xhtml" xml:lang="en" lang="en">
-<head>
-<meta http-equiv="Content-Type" content="text/html; charset=us-ascii" />
-
-<meta http-equiv="Content-Style-Type" content="text/css" />
-<meta http-equiv="Content-Script-Type" content="text/javascript" />
-<title>About this content</title>
-<meta name="generator" content="Oracle DARB XHTML Converter (Mode = ohj/ohw) - Version 5.1.1 Build 004" />
-<meta name="date" content="2009-05-01T8:12:54Z" />
-<meta name="robots" content="noarchive" />
-<meta name="doctitle" content="About this content" />
-<meta name="relnum" content="Release 2.2" />
-<meta name="copyright" content="Copyright (c) 2000, 2008 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. Contributors: Oracle - initial API and implementation" />
-<link rel="copyright" href="dcommon/html/cpyr.htm" title="Copyright" type="text/html" />
-<link rel="stylesheet" href="dcommon/css/blafdoc.css" title="Oracle BLAFDoc" type="text/css" />
-<!-- contents -->
-</head>
-<body>
-<div class="sect1"><!-- infolevel="all" infotype="General" --><a id="sthref288" name="sthref288"></a>
-<h1>About this content</h1>
-<p>December, 2008</p>
-<a id="sthref289" name="sthref289"></a>
-<p class="subhead2">License</p>
-<p>The Eclipse Foundation makes available all content in this plug-in ("Content"). Unless otherwise indicated below, the Content is provided to you under the terms and conditions of the Eclipse Public License Version 1.0 ("EPL"). A copy of the EPL is available at <code><a href="http://www.eclipse.org/legal/epl-v10.html">http://www.eclipse.org/legal/epl-v10.html</a></code>. For purposes of the EPL, "Program" will mean the Content.</p>
-<p>If you did not receive this Content directly from the Eclipse Foundation, the Content is being redistributed by another party ("Redistributor") and different terms and conditions may apply to your use of any object code in the Content. Check the Redistributor's license that was provided with the Content. If no such license exists, contact the Redistributor. Unless otherwise indicated below, the terms and conditions of the EPL still apply to any source code in the Content and such source code may be obtained at <code><a href="http://www.eclipse.org">http://www.eclipse.org</a></code>.</p>
-</div>
-<!-- class="sect1" -->
-<!-- Start Footer -->
-<div class="footer">
-<table class="simple oac_no_warn" summary="" cellspacing="0" cellpadding="0" width="100%">
-<col width="86%" />
-<col width="*" />
-<tr>
-<td align="left"><span class="copyrightlogo">Copyright&nbsp;&copy;&nbsp;2006, 2009,&nbsp;Oracle&nbsp;and/or&nbsp;its&nbsp;affiliates.&nbsp;All&nbsp;rights&nbsp;reserved.</span><br />
-<a href="dcommon/html/cpyr.htm"><span class="copyrightlogo">Legal Notices</span></a></td>
-</tr>
-</table>
-</div>
-<!-- class="footer" -->
-</body>
-</html>
diff --git a/jpa/plugins/org.eclipse.jpt.doc.user/about.html b/jpa/plugins/org.eclipse.jpt.doc.user/about.html
deleted file mode 100644
index 6c3af6e2fe..0000000000
--- a/jpa/plugins/org.eclipse.jpt.doc.user/about.html
+++ /dev/null
@@ -1,42 +0,0 @@
-<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN"
- "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
-<html xmlns="http://www.w3.org/1999/xhtml" xml:lang="en" lang="en">
-<head>
-<!-- Run date = July 23, 2008 8:59:55 -->
-<meta http-equiv="Content-Type" content="text/html; charset=us-ascii" />
-<title>About this content</title>
-
-<meta http-equiv="Content-Style-Type" content="text/css" />
-<meta http-equiv="Content-Script-Type" content="text/javascript" />
-<meta name="generator" content="Oracle DARB XHTML Converter (Mode = ohj/ohw) - Version 5.0" />
-<meta name="date" content="2005-07-10T12:57:20+08:00" />
-<meta name="robots" content="noarchive" />
-<meta name="doctitle" content="About this content" />
-<meta name="relnum" content="Release 2.0" />
-<meta name="copyright" content="Copyright (c) 2000, 2008 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. Contributors: Oracle - initial API and implementation" />
-<link rel="copyright" href="dcommon/html/cpyr.htm" title="Copyright" type="text/html" />
-<link rel="stylesheet" href="dcommon/css/blafdoc.css" title="Oracle BLAFDoc" type="text/css" />
-<!-- start-->
-<!-- contents -->
-</head>
-<body>
-<div class="sect1"><!-- infolevel="all" infotype="General" --><a id="sthref257" name="sthref257"></a>
-<h1>About this content</h1>
-<p>January, 2008</p>
-<a id="sthref258" name="sthref258"></a>
-<p class="subhead2">License</p>
-<p>The Eclipse Foundation makes available all content in this plug-in ("Content"). Unless otherwise indicated below, the Content is provided to you under the terms and conditions of the Eclipse Public License Version 1.0 ("EPL"). A copy of the EPL is available at <code><a href="http://www.eclipse.org/legal/epl-v10.html">http://www.eclipse.org/legal/epl-v10.html</a></code>. For purposes of the EPL, "Program" will mean the Content.</p>
-<p>If you did not receive this Content directly from the Eclipse Foundation, the Content is being redistributed by another party ("Redistributor") and different terms and conditions may apply to your use of any object code in the Content. Check the Redistributor's license that was provided with the Content. If no such license exists, contact the Redistributor. Unless otherwise indicated below, the terms and conditions of the EPL still apply to any source code in the Content and such source code may be obtained at <code><a href="http://www.eclipse.org">http://www.eclipse.org</a></code>.</p>
-</div>
-<!-- class="sect1" -->
-<!-- Start Footer -->
-<div class="footer">
-<table class="simple oac_no_warn" summary="" cellspacing="0" cellpadding="0" width="100%">
-<tr>
-<td align="left" width="86%"><a href="dcommon/html/cpyr.htm"><span class="copyrightlogo">Copyright&nbsp;&copy;&nbsp;2006, 2008,&nbsp;Oracle.&nbsp;All&nbsp;rights&nbsp;reserved.</span></a></td>
-</tr>
-</table>
-</div>
-<!-- class="footer" -->
-</body>
-</html>
diff --git a/jpa/plugins/org.eclipse.jpt.doc.user/build.properties b/jpa/plugins/org.eclipse.jpt.doc.user/build.properties
deleted file mode 100644
index e2c8808fe3..0000000000
--- a/jpa/plugins/org.eclipse.jpt.doc.user/build.properties
+++ /dev/null
@@ -1,127 +0,0 @@
-bin.includes = cheatsheets/,\
- dcommon/,\
- img/,\
- META-INF/,\
- about.html,\
- build.properties,\
- concept_mapping.htm,\
- concept_persistence.htm,\
- concepts.htm,\
- concepts001.htm,\
- concepts002.htm,\
- concepts003.htm,\
- contexts.xml,\
- getting_started.htm,\
- getting_started001.htm,\
- getting_started002.htm,\
- getting_started003.htm,\
- getting_started004.htm,\
- index.xml,\
- legal.htm,\
- plugin.properties,\
- plugin.xml,\
- ref_details_orm.htm,\
- ref_jpa_facet.htm,\
- ref_mapping_general.htm,\
- ref_new_jpa_project.htm,\
- ref_new_jpa_project_wizard.htm,\
- ref_persistence_map_view.htm,\
- ref_persistence_outline.htm,\
- ref_persistence_perspective.htm,\
- ref_persistence_prop_view.htm,\
- ref_primary_key.htm,\
- ref_project_properties.htm,\
- reference.htm,\
- reference001.htm,\
- reference002.htm,\
- reference003.htm,\
- reference004.htm,\
- reference005.htm,\
- reference006.htm,\
- reference007.htm,\
- reference008.htm,\
- reference009.htm,\
- reference010.htm,\
- reference011.htm,\
- reference012.htm,\
- reference013.htm,\
- reference014.htm,\
- reference015.htm,\
- reference016.htm,\
- reference017.htm,\
- reference018.htm,\
- task_add_persistence.htm,\
- task_additonal_tables.htm,\
- task_create_new_project.htm,\
- task_inheritance.htm,\
- task_manage_orm.htm,\
- task_manage_persistence.htm,\
- task_mapping.htm,\
- tasks.htm,\
- tasks001.htm,\
- tasks002.htm,\
- tasks003.htm,\
- tasks004.htm,\
- tasks005.htm,\
- tasks006.htm,\
- tasks007.htm,\
- tasks008.htm,\
- tasks009.htm,\
- tasks010.htm,\
- tasks011.htm,\
- tasks012.htm,\
- tasks013.htm,\
- tasks014.htm,\
- tasks015.htm,\
- tasks016.htm,\
- tasks017.htm,\
- tasks018.htm,\
- tasks019.htm,\
- tasks020.htm,\
- tasks021.htm,\
- tasks022.htm,\
- tips_and_tricks.htm,\
- toc.xml,\
- whats_new.htm,\
- whats_new001.htm,\
- whats_new002.htm,\
- whats_new003.htm,\
- about.htm,\
- reference019.htm,\
- reference020.htm,\
- reference021.htm,\
- reference022.htm,\
- reference023.htm,\
- reference024.htm,\
- reference025.htm,\
- reference026.htm,\
- reference027.htm,\
- reference028.htm,\
- reference030.htm,\
- reference029.htm,\
- reference031.htm,\
- reference032.htm,\
- tasks023.htm,\
- tasks024.htm,\
- whats_new004.htm,\
- whats_new005.htm,\
- ref_persistence_xmll_editor.htm,\
- ref_EntityClassPage.htm,\
- ref_EntityPropertiesPage.htm,\
- ref_add_converter.htm,\
- ref_association_cardinality.htm,\
- ref_association_table.htm,\
- ref_create_custom_entities_wizard.htm,\
- ref_create_jpa_entity_wizard.htm,\
- ref_create_new_association_wizard.htm,\
- ref_customizIndividualEntities.htm,\
- ref_customizeDefaultEntityGeneration.htm,\
- ref_eclipselink_mapping_file.htm,\
- ref_java_page.htm,\
- ref_join_columns.htm,\
- ref_persistence_general.htm,\
- ref_selectTables.htm,\
- ref_select_cascade_dialog.htm,\
- ref_tableAssociations.htm,\
- task_create_jpa_entity.htm
-generateSourceBundle=false
diff --git a/jpa/plugins/org.eclipse.jpt.doc.user/cheatsheets/add_persistence.xml b/jpa/plugins/org.eclipse.jpt.doc.user/cheatsheets/add_persistence.xml
deleted file mode 100644
index 6dbeedbeca..0000000000
--- a/jpa/plugins/org.eclipse.jpt.doc.user/cheatsheets/add_persistence.xml
+++ /dev/null
@@ -1,63 +0,0 @@
-<?xml version="1.0" encoding="UTF-8"?>
-<cheatsheet title="Create a JPA Project">
- <intro href="/org.eclipse.platform.doc.user/reference/ref-cheatsheets.htm">
- <description>
- This cheat sheet will automatically launch wizards, perform actions, and guide you through the steps to create a JPA project.
-
-To learn more about using cheat sheets, or to see a list of available cheat sheets, click Help (?).
-To start work working on this cheat sheet click the &quot;Click to Begin&quot; button below.
-
-Let&apos;s get started!
- </description>
- </intro>
- <item title="Setup the Environment" dialog="false" skip="true" href="/org.eclipse.datatools.doc.user/c_database_development_setup.html">
- <description>
- Your environment must be set up before you can perform the steps in this cheat sheet.
-
-Create a database profile and connect to the database.
-
-The Database Connection dialog automatically appears when you click the &quot;Click to Perform&quot; button.
- </description>
- <command serialization="org.eclipse.datatools.sqltools.sqleditor.attachProfileAction" confirm="false">
- </command>
- </item>
- <item title="Create a JPA Project" dialog="false" skip="false" href="/org.eclipse.jpt.doc.user/task_create_new_project.htm">
- <description>
- Use the New Project Wizard to create a JPA project.
-Select <b>File-&gt;New-&gt;Project...</b> and choose <b>JPA-&gt;JPA Project</b> in the list.
-
-On the first page of the wizard, enter a project name and location, select your target runtime, and select a predefined project configuration.
-
-Click <b>Next</b> to display the next page of the wizard.
-
-The &quot;New JPA Project&quot; wizard is automatically displayed when you click the &quot;Click to Perform&quot; button.
- </description>
- <action class="org.eclipse.jdt.internal.ui.wizards.OpenProjectWizardAction" pluginId="org.eclipse.jdt.ui" confirm="false">
- </action>
- </item>
- <item title="Select Project Facet" dialog="false" skip="false" href="/org.eclipse.jst.j2ee.doc.user/topics/ph-projects.html">
- <description>
- Use the Project Facet page to select a predefined project configuration or specific specific facets to include in the project.
-
-Click &quot;Next&quot; to display the next page of the wizard.
- </description>
- </item>
- <item title="Specify the JPA Facet" dialog="false" skip="false" href="/org.eclipse.jdt.doc.user/ref_jpa_facet.htm">
- <description>
- Use the JPA Facet page to specify the the vendor-specific JPA platform, the database connection to use, and the specific JPA implementation library.
-
-You can also specify if Dali should create an orm.xml file.
-
-If you do not have an active database connection, click <b>Add Connections</b> to create one.
-
-If you do not have a defined JPA implementation library, click <b>Configure default JPA implementation library</b> or <b>Configure user libraries</b> to define one.
-
-Click <b>Finish</b> to complete the wizard and open the open the project.
- </description>
- </item>
- <item title="Finish" dialog="false" skip="false">
- <description>
- Congratulations! You have successfully created a JPA project. Complete the additional cheat sheets to add Java persistent entities and map those entities to database tables.
- </description>
- </item>
-</cheatsheet>
diff --git a/jpa/plugins/org.eclipse.jpt.doc.user/cheatsheets/create_entity.xml b/jpa/plugins/org.eclipse.jpt.doc.user/cheatsheets/create_entity.xml
deleted file mode 100644
index b64e8afdee..0000000000
--- a/jpa/plugins/org.eclipse.jpt.doc.user/cheatsheets/create_entity.xml
+++ /dev/null
@@ -1,44 +0,0 @@
-<?xml version="1.0" encoding="UTF-8"?>
-<cheatsheet title="Create a Persistent Entity">
- <intro href="/org.eclipse.platform.doc.user/reference/ref-cheatsheets.htm">
- <description>
-This cheat sheet will automatically launch wizards, perform actions, and guide you through the steps to add a Java persistent entity to your Java project.
-To learn more about using cheat sheets or to see a list of available cheat sheets, click Help (?).
-To start work working on this cheat sheet, click the <b>Click to Begin</b> button below.
-Let's get started!
- </description>
- </intro>
- <item title="Create a JPA Project" skip="true">
- <description>
-To create a Persistent entity, you must create a JPA project. If you already have a JPA project, you may skip this step by clicking the "Click to Skip" button.
-If not, select <b>File->New->Project...</b> and choose <b>JPA->JPA Project</b> in the list. Complete each page of the Create JPA Project wizard to create a new JPA project.
- </description>
- </item>
- <item title="Open the JPA Development Perspective" skip="true" href="/org.eclipse.jpt.doc.user/ref_persistence_perspective.htm">
- <action pluginId="org.eclipse.ui.cheatsheets" class="org.eclipse.ui.internal.cheatsheets.actions.OpenPerspective" param1="org.eclipse.jpt.ui.PersistencePerspective"/>
- <description>
-When working with JPA persistence, you should use the Persistence perspective. If you already have the Persistence perspective active, you may skip this step by clicking the "Click to Skip" button.
-If not, select <b>Window->Open Perspective->Other</b> in the menubar at the top of the workbench. In the Select Perspectives dialog, select <b>JPA Development</b> and click OK. This step changes the perspective to set up the Eclipse workbench for JPA development.
-You can click the "Click to Perform" button to have the "Persistence" perspective opened automatically.
- </description>
- </item>
- <item title="Create a Java Class">
- <description>
-The next step is to create a new Java class. In the main toolbar again, click on <b>New Java Class</b> button (or the link below).
-The Java editor will automatically open showing your new class.
- </description>
- </item>
- <item title="Create a Persistent Entity">
- <description>
-Finally we will make the Java class a persistent entity.
-In the JPA Structure view select the Java class.
-In the JPA Details view, use the "Map As" field to select <b>Entity</b>. Dali automatically adds the @Entity annotation to the class in the Java editor.
-Use the Table, Catalog, and Schema fields to associate the entity with a specific table in the database.
- </description>
- </item>
- <item title="Finish">
- <description>
-Congratulations! You have successfully added a JPA entity to your JPA project. Complete the additional cheat sheets to map the entity's fields to database tables.
- </description>
- </item>
-</cheatsheet>
diff --git a/jpa/plugins/org.eclipse.jpt.doc.user/cheatsheets/map_entity.xml b/jpa/plugins/org.eclipse.jpt.doc.user/cheatsheets/map_entity.xml
deleted file mode 100644
index 63307f226e..0000000000
--- a/jpa/plugins/org.eclipse.jpt.doc.user/cheatsheets/map_entity.xml
+++ /dev/null
@@ -1,88 +0,0 @@
-<?xml version="1.0" encoding="UTF-8"?>
-<cheatsheet title="Map a Java Persistent Entity">
- <intro href="/org.eclipse.platform.doc.user/reference/ref-cheatsheets.htm">
- <description>
- This cheat sheet will automatically launch wizards, perform actions, and guide you through the steps to map the fields of a JPA entity entity to your database.
-
-To learn more about using cheat sheets or to see a list of available cheat sheets, click Help (?).
-To start work working on this cheat sheet, click the &quot;Click to Begin&quot; button below.
-
-Let&apos;s get started!
- </description>
- </intro>
- <item title="Setup the Environment" dialog="false" skip="true" href="/org.eclipse.datatools.doc.user/c_database_development_setup.html">
- <description>
- Your environment must be set up before you can perform the steps in this cheat sheet.
-
-Create a database profile and connect to the database.
-
-If you already have (and are connected to) a database connection, you may skip this step by clicking the &quot;Click to Skip&quot; button.
-
-The Database Connection dialog automatically appears when you click the &quot;Click to Perform&quot; button.
- </description>
- <command serialization="org.eclipse.datatools.sqltools.sqleditor.attachProfileAction" confirm="false">
- </command>
- </item>
- <item title="Create a JPA Project" dialog="false" skip="true" href="/org.eclipse.jpt.doc.user/task_create_new_project.htm">
- <description>
- Use the New Project Wizard to create a JPA project.
-Select <b>File-&gt;New-&gt;Project...</b> and choose <b>JPA-&gt;JPA Project</b> in the list.
-
-Complete each page of the wizard to create a new JPA project.
-
-The &quot;New JPA Project&quot; wizard is automatically displayed when you click the &quot;Click to Perform&quot; button.
-
-If you already have a JPA project, you may skip this step by clicking the &quot;Click to Skip&quot; button.
- </description>
- <action class="org.eclipse.jdt.internal.ui.wizards.OpenProjectWizardAction" pluginId="org.eclipse.jdt.ui" confirm="false">
- </action>
- </item>
- <item title="Open the JPA Development Perspective" dialog="false" skip="true" href="/org.eclipse.jpt.doc.user/ref_persistence_perspective.htm">
- <description>
- When working with JPA persistence, you should use the Persistence perspective. If you already have the Persistence perspective active, you may skip this step by clicking the &quot;Click to Skip&quot; button.
-If not, select <b>Window-&gt;Open Perspective-&gt;Other</b> in the menubar at the top of the workbench. In the Select Perspectives dialog, select <b>JPA Development</b> and click OK. This step changes the perspective to set up the Eclipse workbench for JPA development.
-You can click the &quot;Click to Perform&quot; button to have the &quot;Persistence&quot; perspective opened automatically.
- </description>
- <action class="org.eclipse.ui.internal.cheatsheets.actions.OpenPerspective" pluginId="org.eclipse.ui.cheatsheets" confirm="false" param1="org.eclipse.jpt.ui.PersistencePerspective">
- </action>
- </item>
- <item title="Create a Java Class" dialog="false" skip="false">
- <description>
- The next step is to create a new Java class. In the main toolbar again, click on <b>New Java Class</b> button (or the link below).
-The Java editor will automatically open showing your new class.
- </description>
- </item>
- <item title="Create a Persistent Entity" dialog="false" skip="false">
- <description>
- Finally we will make the Java class a persistent entity.
-In the JPA Structure view select the Java class.
-In the JPA Details view, use the &quot;Map As&quot; field to select <b>Entity</b>. Dali automatically adds the @Entity annotation to the class in the Java editor.
-Use the Table, Catalog, and Schema fields to associate the entity with a specific table in the database.
- </description>
- </item>
- <item title="Add Fields to the Class" dialog="false" skip="true">
- <description>
- Now you will add some fields to the entity to map to rows in the database table.
-
-If your persistent entity already has fields to map, you may skip this step by clicking the &quot;Click to Skip&quot; button. If not, use the Java editor to add fields to the entity.
- </description>
- <action class="org.eclipse.ui.internal.cheatsheets.actions.OpenPerspective" pluginId="org.eclipse.ui.cheatsheets" confirm="false" param1="org.eclipse.dali.ui.PersistencePerspective">
- </action>
- </item>
- <item title="Create the Mapping" dialog="false" skip="false" href="/org.eclipse.dali.doc.user/ref_entity_page.htm">
- <description>
- Now you are ready to map the entity fields to columns in the database table. In the Package Explorer, select the Java class.
-
-In the JPA Structure view, expand the persistent entity to display the fields. Select a field.
-
-The JPA Details view displays the information for the field. Use the Map As field to select the Basic mapping. Use the Column field to select a column from the database table.
- </description>
- <action class="org.eclipse.ui.internal.cheatsheets.actions.OpenPerspective" pluginId="org.eclipse.ui.cheatsheets" confirm="false" param1="org.eclipse.dali.ui.PersistencePerspective">
- </action>
- </item>
- <item title="Finish" dialog="false" skip="false">
- <description>
- Congratulations! You have successfully mapped the fields from a Java persistent entity to a column in a database table.
- </description>
- </item>
-</cheatsheet>
diff --git a/jpa/plugins/org.eclipse.jpt.doc.user/concept_mapping.htm b/jpa/plugins/org.eclipse.jpt.doc.user/concept_mapping.htm
deleted file mode 100644
index 845216db68..0000000000
--- a/jpa/plugins/org.eclipse.jpt.doc.user/concept_mapping.htm
+++ /dev/null
@@ -1,46 +0,0 @@
-<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN"
- "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
-<html xmlns="http://www.w3.org/1999/xhtml" xml:lang="en" lang="en">
-<head>
-<meta http-equiv="Content-Type" content="text/html; charset=us-ascii" />
-
-<meta http-equiv="Content-Style-Type" content="text/css" />
-<meta http-equiv="Content-Script-Type" content="text/javascript" />
-<title>Understanding OR mappings</title>
-<meta name="generator" content="Oracle DARB XHTML Converter (Mode = ohj/ohw) - Version 5.1.1 Build 004" />
-<meta name="date" content="2009-05-01T8:12:41Z" />
-<meta name="robots" content="noarchive" />
-<meta name="doctitle" content="Understanding OR mappings" />
-<meta name="relnum" content="Release 2.2" />
-<meta name="copyright" content="Copyright (c) 2000, 2008 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. Contributors: Oracle - initial API and implementation" />
-<link rel="copyright" href="dcommon/html/cpyr.htm" title="Copyright" type="text/html" />
-<link rel="stylesheet" href="dcommon/css/blafdoc.css" title="Oracle BLAFDoc" type="text/css" />
-<!-- contents -->
-</head>
-<body>
-<p><a id="BABBDJFI" name="BABBDJFI"></a></p>
-<div class="sect1">
-<h1>Understanding OR mappings</h1>
-<p><a id="sthref21" name="sthref21"></a><a id="sthref22" name="sthref22"></a>The Dali OR (object-relational) Mapping Tool allows you to describe how your entity objects <span class="italic">map</span> to the data source (or other objects). This approach isolates persistence information from the object model&ndash;developers are free to design their ideal object model, and DBAs are free to design their ideal schema.</p>
-<p>These mappings transform an object data member type to a corresponding relational database data source representation. These OR mappings can also transform object data members that reference other domain objects stored in other tables in the database and are related through foreign keys.</p>
-<p>You can use these mappings to map simple data types including primitives (such as <code>int</code>), JDK classes (such as <code>String</code>), and large object (LOB) values. You can also use them to transform object data members that reference other domain objects by way of association where data source representations require object identity maintenance (such as sequencing and back references) and possess various types of multiplicity and navigability. The appropriate mapping class is chosen primarily by the cardinality of the relationship.</p>
-<img src="img/ngrelt.png" alt="Related task" title="Related task" /><br />
-<br />
-<a href="task_mapping.htm#BABDGBIJ">Mapping an entity</a>
-<p>&nbsp;</p>
-</div>
-<!-- class="sect1" -->
-<!-- Start Footer -->
-<div class="footer">
-<table class="simple oac_no_warn" summary="" cellspacing="0" cellpadding="0" width="100%">
-<col width="86%" />
-<col width="*" />
-<tr>
-<td align="left"><span class="copyrightlogo">Copyright&nbsp;&copy;&nbsp;2006, 2009,&nbsp;Oracle&nbsp;and/or&nbsp;its&nbsp;affiliates.&nbsp;All&nbsp;rights&nbsp;reserved.</span><br />
-<a href="dcommon/html/cpyr.htm"><span class="copyrightlogo">Legal Notices</span></a></td>
-</tr>
-</table>
-</div>
-<!-- class="footer" -->
-</body>
-</html>
diff --git a/jpa/plugins/org.eclipse.jpt.doc.user/concept_persistence.htm b/jpa/plugins/org.eclipse.jpt.doc.user/concept_persistence.htm
deleted file mode 100644
index ccc22cb40d..0000000000
--- a/jpa/plugins/org.eclipse.jpt.doc.user/concept_persistence.htm
+++ /dev/null
@@ -1,41 +0,0 @@
-<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN"
- "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
-<html xmlns="http://www.w3.org/1999/xhtml" xml:lang="en" lang="en">
-<head>
-<meta http-equiv="Content-Type" content="text/html; charset=us-ascii" />
-
-<meta http-equiv="Content-Style-Type" content="text/css" />
-<meta http-equiv="Content-Script-Type" content="text/javascript" />
-<title>Understanding Java persistence</title>
-<meta name="generator" content="Oracle DARB XHTML Converter (Mode = ohj/ohw) - Version 5.1.1 Build 004" />
-<meta name="date" content="2009-05-01T8:12:41Z" />
-<meta name="robots" content="noarchive" />
-<meta name="doctitle" content="Understanding Java persistence" />
-<meta name="relnum" content="Release 2.2" />
-<meta name="copyright" content="Copyright (c) 2000, 2008 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. Contributors: Oracle - initial API and implementation" />
-<link rel="copyright" href="dcommon/html/cpyr.htm" title="Copyright" type="text/html" />
-<link rel="stylesheet" href="dcommon/css/blafdoc.css" title="Oracle BLAFDoc" type="text/css" />
-<!-- contents -->
-</head>
-<body>
-<p><a id="BABCAHIC" name="BABCAHIC"></a></p>
-<div class="sect1">
-<h1>Understanding Java persistence</h1>
-<p><a id="sthref19" name="sthref19"></a><span class="italic">Persistence</span> refers to the ability to store objects in a database and use those objects with transactional integrity. In a J2EE application, data is typically stored and persisted in the data tier, in a relational database.</p>
-<p><a id="sthref20" name="sthref20"></a><span class="italic">Entity beans</span> are enterprise beans that contain persistent data and that can be saved in various persistent data stores. The entity beans represent data from a database; each entity bean carries its own identity. Entity beans can be deployed using <span class="italic">application-managed persistence</span> or <span class="italic">container-managed persistence</span>.</p>
-</div>
-<!-- class="sect1" -->
-<!-- Start Footer -->
-<div class="footer">
-<table class="simple oac_no_warn" summary="" cellspacing="0" cellpadding="0" width="100%">
-<col width="86%" />
-<col width="*" />
-<tr>
-<td align="left"><span class="copyrightlogo">Copyright&nbsp;&copy;&nbsp;2006, 2009,&nbsp;Oracle&nbsp;and/or&nbsp;its&nbsp;affiliates.&nbsp;All&nbsp;rights&nbsp;reserved.</span><br />
-<a href="dcommon/html/cpyr.htm"><span class="copyrightlogo">Legal Notices</span></a></td>
-</tr>
-</table>
-</div>
-<!-- class="footer" -->
-</body>
-</html>
diff --git a/jpa/plugins/org.eclipse.jpt.doc.user/concepts.htm b/jpa/plugins/org.eclipse.jpt.doc.user/concepts.htm
deleted file mode 100644
index 00475a3b48..0000000000
--- a/jpa/plugins/org.eclipse.jpt.doc.user/concepts.htm
+++ /dev/null
@@ -1,63 +0,0 @@
-<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN"
- "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
-<html xmlns="http://www.w3.org/1999/xhtml" xml:lang="en" lang="en">
-<head>
-<meta http-equiv="Content-Type" content="text/html; charset=us-ascii" />
-
-<meta http-equiv="Content-Style-Type" content="text/css" />
-<meta http-equiv="Content-Script-Type" content="text/javascript" />
-<title>Concepts</title>
-<meta name="generator" content="Oracle DARB XHTML Converter (Mode = ohj/ohw) - Version 5.1.1 Build 004" />
-<meta name="date" content="2009-05-01T8:12:41Z" />
-<meta name="robots" content="noarchive" />
-<meta name="doctitle" content=" Concepts" />
-<meta name="relnum" content="Release 2.2" />
-<meta name="copyright" content="Copyright (c) 2000, 2008 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. Contributors: Oracle - initial API and implementation" />
-<link rel="copyright" href="dcommon/html/cpyr.htm" title="Copyright" type="text/html" />
-<link rel="stylesheet" href="dcommon/css/blafdoc.css" title="Oracle BLAFDoc" type="text/css" />
-<!-- contents -->
-</head>
-<body>
-<p><a id="sthref18" name="sthref18"></a></p>
-<h1>Concepts</h1>
-<p>This section contains an overview of concepts you should be familiar with when using Dali to create mappings for Java persistent entities.</p>
-<ul>
-<li>
-<p><a href="concept_persistence.htm#BABCAHIC">Understanding Java persistence</a></p>
-</li>
-<li>
-<p><a href="concept_mapping.htm#BABBDJFI">Understanding OR mappings</a></p>
-</li>
-<li>
-<p><a href="concepts001.htm#BABBGFJG">Understanding EJB 3.0 Java Persistence API</a></p>
-</li>
-</ul>
-<p>In addition to these sections, you should review the following resources for additional information:</p>
-<ul>
-<li>
-<p>Eclipse Dali project: <code><a href="http://www.eclipse.org/webtools/dali">http://www.eclipse.org/webtools/dali</a></code></p>
-</li>
-<li>
-<p>Eclipse Web Tools Platform project: <code><a href="http://www.eclipse.org/webtools">http://www.eclipse.org/webtools</a></code></p>
-</li>
-<li>
-<p>JSR 220 EJB 3.0 specification: <code><a href="http://www.jcp.org/en/jsr/detail?id=220">http://www.jcp.org/en/jsr/detail?id=220</a></code></p>
-</li>
-<li>
-<p>EclipseLink project: <code><a href="http://www.eclipse.org/eclipselink">http://www.eclipse.org/eclipselink</a></code></p>
-</li>
-</ul>
-<!-- Start Footer -->
-<div class="footer">
-<table class="simple oac_no_warn" summary="" cellspacing="0" cellpadding="0" width="100%">
-<col width="86%" />
-<col width="*" />
-<tr>
-<td align="left"><span class="copyrightlogo">Copyright&nbsp;&copy;&nbsp;2006, 2009,&nbsp;Oracle&nbsp;and/or&nbsp;its&nbsp;affiliates.&nbsp;All&nbsp;rights&nbsp;reserved.</span><br />
-<a href="dcommon/html/cpyr.htm"><span class="copyrightlogo">Legal Notices</span></a></td>
-</tr>
-</table>
-</div>
-<!-- class="footer" -->
-</body>
-</html>
diff --git a/jpa/plugins/org.eclipse.jpt.doc.user/concepts001.htm b/jpa/plugins/org.eclipse.jpt.doc.user/concepts001.htm
deleted file mode 100644
index 57e25c00ec..0000000000
--- a/jpa/plugins/org.eclipse.jpt.doc.user/concepts001.htm
+++ /dev/null
@@ -1,43 +0,0 @@
-<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN"
- "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
-<html xmlns="http://www.w3.org/1999/xhtml" xml:lang="en" lang="en">
-<head>
-<meta http-equiv="Content-Type" content="text/html; charset=us-ascii" />
-
-<meta http-equiv="Content-Style-Type" content="text/css" />
-<meta http-equiv="Content-Script-Type" content="text/javascript" />
-<title>Understanding EJB 3.0 Java Persistence API</title>
-<meta name="generator" content="Oracle DARB XHTML Converter (Mode = ohj/ohw) - Version 5.1.1 Build 004" />
-<meta name="date" content="2009-05-01T8:12:41Z" />
-<meta name="robots" content="noarchive" />
-<meta name="doctitle" content="Understanding EJB 3.0 Java Persistence API" />
-<meta name="relnum" content="Release 2.2" />
-<meta name="copyright" content="Copyright (c) 2000, 2008 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. Contributors: Oracle - initial API and implementation" />
-<link rel="copyright" href="dcommon/html/cpyr.htm" title="Copyright" type="text/html" />
-<link rel="stylesheet" href="dcommon/css/blafdoc.css" title="Oracle BLAFDoc" type="text/css" />
-<!-- contents -->
-</head>
-<body>
-<p><a id="BABBGFJG" name="BABBGFJG"></a></p>
-<div class="sect1">
-<h1>Understanding EJB 3.0 Java Persistence API</h1>
-<p>The Java 2 Enterprise Edition(J2EE) Enterprise JavaBeans (EJB) are a component architecture that you use to develop and deploy object-oriented, distributed, enterprise-scale applications. An application written according to the Enterprise JavaBeans architecture is scalable, transactional, and secure.</p>
-<p>The EJB 3.0 Java Persistence API (JPA) improves the EJB architecture by reducing its complexity through the use of metadata (annotations) and specifying programmatic defaults of that metadata.</p>
-<img src="img/ngrelt.png" alt="Related task" title="Related task" /><br />
-<br />
-<a href="task_mapping.htm#BABDGBIJ">Mapping an entity</a>
-<p>&nbsp;</p>
-<!-- Start Footer -->
-<div class="footer">
-<table class="simple oac_no_warn" summary="" cellspacing="0" cellpadding="0" width="100%">
-<col width="86%" />
-<col width="*" />
-<tr>
-<td align="left"><span class="copyrightlogo">Copyright&nbsp;&copy;&nbsp;2006, 2009,&nbsp;Oracle&nbsp;and/or&nbsp;its&nbsp;affiliates.&nbsp;All&nbsp;rights&nbsp;reserved.</span><br />
-<a href="dcommon/html/cpyr.htm"><span class="copyrightlogo">Legal Notices</span></a></td>
-</tr>
-</table>
-</div>
-<!-- class="footer" --></div>
-</body>
-</html>
diff --git a/jpa/plugins/org.eclipse.jpt.doc.user/concepts002.htm b/jpa/plugins/org.eclipse.jpt.doc.user/concepts002.htm
deleted file mode 100644
index e47e3cdf1f..0000000000
--- a/jpa/plugins/org.eclipse.jpt.doc.user/concepts002.htm
+++ /dev/null
@@ -1,58 +0,0 @@
-<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN"
- "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
-<html xmlns="http://www.w3.org/1999/xhtml" xml:lang="en" lang="en">
-<head>
-<meta http-equiv="Content-Type" content="text/html; charset=us-ascii" />
-
-<meta http-equiv="Content-Style-Type" content="text/css" />
-<meta http-equiv="Content-Script-Type" content="text/javascript" />
-<title>The persistence.xml file</title>
-<meta name="generator" content="Oracle DARB XHTML Converter (Mode = ohj/ohw) - Version 5.1.1 Build 004" />
-<meta name="date" content="2009-05-01T8:12:41Z" />
-<meta name="robots" content="noarchive" />
-<meta name="doctitle" content="The persistence.xml file" />
-<meta name="relnum" content="Release 2.2" />
-<meta name="copyright" content="Copyright (c) 2000, 2008 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. Contributors: Oracle - initial API and implementation" />
-<link rel="copyright" href="dcommon/html/cpyr.htm" title="Copyright" type="text/html" />
-<link rel="stylesheet" href="dcommon/css/blafdoc.css" title="Oracle BLAFDoc" type="text/css" />
-<!-- contents -->
-</head>
-<body>
-<p><a id="CHDHAGIH" name="CHDHAGIH"></a></p>
-<div class="sect2"><!-- infolevel="all" infotype="General" -->
-<h1><a id="sthref23" name="sthref23"></a>The persistence.xml file</h1>
-<p>The JPA specification requires the use of a <code>persistence.xml</code> file for deployment. This file defines the database and entity manager options, and may contain more than one persistence unit. To enable you to easily edit this information, Dali provides the <a href="ref_persistence_xmll_editor.htm#CIACCHID">persistence.xml Editor</a>. Alternatively, you can use the Eclipse XML Editor to create and maintain this information. See <a href="task_manage_persistence.htm#CIHDAJID">"Managing the persistence.xml file"</a> for more information.</p>
-<div align="center">
-<div class="inftblnotealso"><br />
-<table class="NoteAlso oac_no_warn" summary="" cellpadding="3" cellspacing="0">
-<tbody>
-<tr>
-<td align="left">
-<p class="notep1">Tip:</p>
-To work with multiple persistence units, comment out all but one persistence unit in <code>persistence.xml</code>.</td>
-</tr>
-</tbody>
-</table>
-<br /></div>
-<!-- class="inftblnotealso" --></div>
-<img src="img/ngrelt.png" alt="Related task" title="Related task" /><br />
-<br />
-<a href="task_manage_persistence.htm#CIHDAJID">Managing the persistence.xml file</a><br />
-<a href="task_create_new_project.htm#CIHHEJCJ">Creating a new JPA project</a>
-<p>&nbsp;</p>
-</div>
-<!-- class="sect2" -->
-<!-- Start Footer -->
-<div class="footer">
-<table class="simple oac_no_warn" summary="" cellspacing="0" cellpadding="0" width="100%">
-<col width="86%" />
-<col width="*" />
-<tr>
-<td align="left"><span class="copyrightlogo">Copyright&nbsp;&copy;&nbsp;2006, 2009,&nbsp;Oracle&nbsp;and/or&nbsp;its&nbsp;affiliates.&nbsp;All&nbsp;rights&nbsp;reserved.</span><br />
-<a href="dcommon/html/cpyr.htm"><span class="copyrightlogo">Legal Notices</span></a></td>
-</tr>
-</table>
-</div>
-<!-- class="footer" -->
-</body>
-</html>
diff --git a/jpa/plugins/org.eclipse.jpt.doc.user/concepts003.htm b/jpa/plugins/org.eclipse.jpt.doc.user/concepts003.htm
deleted file mode 100644
index 115447116b..0000000000
--- a/jpa/plugins/org.eclipse.jpt.doc.user/concepts003.htm
+++ /dev/null
@@ -1,60 +0,0 @@
-<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN"
- "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
-<html xmlns="http://www.w3.org/1999/xhtml" xml:lang="en" lang="en">
-<head>
-<meta http-equiv="Content-Type" content="text/html; charset=us-ascii" />
-
-<meta http-equiv="Content-Style-Type" content="text/css" />
-<meta http-equiv="Content-Script-Type" content="text/javascript" />
-<title>The orm.xml file</title>
-<meta name="generator" content="Oracle DARB XHTML Converter (Mode = ohj/ohw) - Version 5.1.1 Build 004" />
-<meta name="date" content="2009-05-01T8:12:42Z" />
-<meta name="robots" content="noarchive" />
-<meta name="doctitle" content="The orm.xml file" />
-<meta name="relnum" content="Release 2.2" />
-<meta name="copyright" content="Copyright (c) 2000, 2008 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. Contributors: Oracle - initial API and implementation" />
-<link rel="copyright" href="dcommon/html/cpyr.htm" title="Copyright" type="text/html" />
-<link rel="stylesheet" href="dcommon/css/blafdoc.css" title="Oracle BLAFDoc" type="text/css" />
-<!-- contents -->
-</head>
-<body>
-<p><a id="CHDBIJAC" name="CHDBIJAC"></a></p>
-<div class="sect2"><!-- infolevel="all" infotype="General" -->
-<h1><a id="sthref24" name="sthref24"></a>The orm.xml file</h1>
-<p>Although the JPA specification emphasizes the use of annotations to specify persistence, you can also use the <code>orm.xml</code> file to store this metadata. Dali enables you to create a stub <code>orm.xml</code> file for a JPA project using the <a href="reference002.htm#CIAIJCCE">Mapping File Wizard</a>. See <a href="task_manage_orm.htm#CIHDGDCD">"Managing the orm.xml file"</a> for more information.</p>
-<div align="center">
-<div class="inftblnote"><br />
-<table class="Note oac_no_warn" summary="" cellpadding="3" cellspacing="0">
-<tbody>
-<tr>
-<td align="left">
-<p class="notep1">Note:</p>
-The metadata must match the XSD specification of your selected JPA implementation.</td>
-</tr>
-</tbody>
-</table>
-<br /></div>
-<!-- class="inftblnote" --></div>
-<p>Dali provides comprehensive support for configuring XML mapping files through the <a href="ref_details_orm.htm#CACGDGHC">JPA Details view (for orm.xml)</a> that is nearly identical to the annotation-based configuration in the Java source. Alternatively, you can also use the Eclipse XML Editor to create and maintain the metadata information in <code>orm.xml</code>.</p>
-<img src="img/ngrelt.png" alt="Related task" title="Related task" /><br />
-<br />
-<a href="task_manage_orm.htm#CIHDGDCD">Managing the orm.xml file</a><br />
-<a href="task_create_new_project.htm#CIHHEJCJ">Creating a new JPA project</a><br />
-<p>&nbsp;</p>
-</div>
-<!-- class="sect2" -->
-<!-- class="sect1" -->
-<!-- Start Footer -->
-<div class="footer">
-<table class="simple oac_no_warn" summary="" cellspacing="0" cellpadding="0" width="100%">
-<col width="86%" />
-<col width="*" />
-<tr>
-<td align="left"><span class="copyrightlogo">Copyright&nbsp;&copy;&nbsp;2006, 2009,&nbsp;Oracle&nbsp;and/or&nbsp;its&nbsp;affiliates.&nbsp;All&nbsp;rights&nbsp;reserved.</span><br />
-<a href="dcommon/html/cpyr.htm"><span class="copyrightlogo">Legal Notices</span></a></td>
-</tr>
-</table>
-</div>
-<!-- class="footer" -->
-</body>
-</html>
diff --git a/jpa/plugins/org.eclipse.jpt.doc.user/contexts.xml b/jpa/plugins/org.eclipse.jpt.doc.user/contexts.xml
deleted file mode 100644
index 8e22daf6ca..0000000000
--- a/jpa/plugins/org.eclipse.jpt.doc.user/contexts.xml
+++ /dev/null
@@ -1,613 +0,0 @@
-<?xml version="1.0" encoding="UTF-8"?>
-<?NLS TYPE="org.eclipse.help.contexts"?>
-<contexts>
- <context id="entity_accessType">
- <description>Specify how the variable is accessed: Property (default) or Field.</description>
- <topic label="JPA Details" href="ref_persistence_prop_view.htm"/>
- <topic label="Adding persistence to a class" href="task_add_persistence.htm"/>
- <topic label="Understanding persistence" href="concept_persistence.htm"/>
- </context>
- <context id="entity_name">
- <description>The name of this entity. By default, the class name is used as the entity name.</description>
- <topic label="JPA Details" href="ref_persistence_prop_view.htm"/>
- <topic label="Adding persistence to a class" href="task_add_persistence.htm"/>
- <topic label="Understanding persistence" href="concept_persistence.htm"/>
- </context>
- <context id="entity_table">
- <description>The database table assigned to this entity. By default, the class name is used as the database table name.</description>
- <topic label="JPA Details" href="ref_persistence_prop_view.htm"/>
- <topic label="Adding persistence to a class" href="task_add_persistence.htm"/>
- <topic label="Adding persistence to a class" href="task_add_persistence.htm"/>
- <topic label="Understanding persistence" href="concept_persistence.htm"/>
- </context>
- <context id="entity_attributeOverrides">
- <description>Specify a property or field to be overridden (from the default mappings).</description>
- <topic label="JPA Details" href="ref_persistence_prop_view.htm"/>
- <topic label="Adding persistence to a class" href="task_add_persistence.htm"/>
- <topic label="Understanding persistence" href="concept_persistence.htm"/>
- </context>
- <context id="entity_attributeOverridesName">
- <description>Name of the database column.</description>
- <topic label="JPA Details" href="ref_persistence_prop_view.htm"/>
- <topic label="Adding persistence to a class" href="task_add_persistence.htm"/>
- <topic label="Understanding persistence" href="concept_persistence.htm"/>
- </context>
- <context id="entity_attributeOverridesColumn">
- <description>The database column that overrides a property or field.</description>
- <topic label="JPA Details" href="ref_persistence_prop_view.htm"/>
- <topic label="Adding persistence to a class" href="task_add_persistence.htm"/>
- <topic label="Understanding persistence" href="concept_persistence.htm"/>
- </context>
- <context id="entity_attributeOverridesInsertable">
- <description>Specifies if the column is always included in SQL INSERT statements.</description>
- <topic label="JPA Details" href="ref_persistence_prop_view.htm"/>
- <topic label="Adding persistence to a class" href="task_add_persistence.htm"/>
- <topic label="Understanding persistence" href="concept_persistence.htm"/>
- </context>
- <context id="entity_attributeOverridesUpdatable">
- <description>Specifies if the column is always included in SQL UPDATE statements.</description>
- <topic label="JPA Details" href="ref_persistence_prop_view.htm"/>
- <topic label="Adding persistence to a class" href="task_add_persistence.htm"/>
- <topic label="Understanding persistence" href="concept_persistence.htm"/>
- </context>
- <context id="mapping_mapAs">
- <description>Specify how this attribute maps to the database.</description>
- <topic label="JPA Details" href="ref_persistence_map_view.htm"/>
- <topic label="Mapping an entity" href="task_mapping.htm"/>
- <topic label="Understanding OR mappings" href="concept_mapping.htm"/>
- </context>
- <context id="mapping_column">
- <description>The database column that contains the value for the attribute.</description>
- <topic label="JPA Details" href="ref_persistence_map_view.htm"/>
- <topic label="Mapping an entity" href="task_mapping.htm"/>
- <topic label="Understanding OR mappings" href="concept_mapping.htm"/>
- </context>
- <context id="mapping_columnTable">
- <description>Name of the database table that contains the selected column.</description>
- <topic label="JPA Details" href="ref_persistence_map_view.htm"/>
- <topic label="Mapping an entity" href="task_mapping.htm"/>
- <topic label="Understanding OR mappings" href="concept_mapping.htm"/>
- </context>
- <context id="mapping_columnInsertable">
- <description>Specifies if the column is always included in SQL INSERT statements.</description>
- <topic label="JPA Details" href="ref_persistence_map_view.htm"/>
- <topic label="Mapping an entity" href="task_mapping.htm"/>
- <topic label="Understanding OR mappings" href="concept_mapping.htm"/>
- </context>
- <context id="mapping_columnUpdatable">
- <description>Specifies if the column is always included in SQL UPDATE statements.</description>
- <topic label="JPA Details" href="ref_persistence_map_view.htm"/>
- <topic label="Mapping an entity" href="task_mapping.htm"/>
- <topic label="Understanding OR mappings" href="concept_mapping.htm"/>
- </context>
- <context id="mapping_fetchType">
- <description>Defines how data is loaded from the database: Eager (default) or Lazy</description>
- <topic label="JPA Details" href="ref_persistence_map_view.htm"/>
- <topic label="Mapping an entity" href="task_mapping.htm"/>
- <topic label="Understanding OR mappings" href="concept_mapping.htm"/>
- </context>
- <context id="mapping_optional">
- <description>Specifies if this field is can be null.</description>
- <topic label="JPA Details" href="ref_persistence_map_view.htm"/>
- <topic label="Mapping an entity" href="task_mapping.htm"/>
- <topic label="Understanding OR mappings" href="concept_mapping.htm"/>
- </context>
- <context id="mapping_generatedValueStrategy">
- <description>Determines how the primary key is generated: Auto (default), Sequence, Identity, or Table.</description>
- <topic label="JPA Details" href="ref_persistence_map_view.htm"/>
- <topic label="Mapping an entity" href="task_mapping.htm"/>
- <topic label="Understanding OR mappings" href="concept_mapping.htm"/>
- </context>
- <context id="mapping_generatedValueGeneratorName">
- <description>Unique name of the generator.</description>
- <topic label="JPA Details" href="ref_persistence_map_view.htm"/>
- <topic label="Mapping an entity" href="task_mapping.htm"/>
- <topic label="Understanding OR mappings" href="concept_mapping.htm"/>
- </context>
- <context id="mapping_targetEntity">
- <description>The entity to which this attribute is mapped. </description>
- <topic label="JPA Details" href="ref_persistence_map_view.htm"/>
- <topic label="Mapping an entity" href="task_mapping.htm"/>
- <topic label="Understanding OR mappings" href="concept_mapping.htm"/>
- </context>
- <context id="mapping_cascadeType">
- <description>Specify which operations are propagated throughout the entity: All, Persist, Merge, or Move.</description>
- <topic label="JPA Details" href="ref_persistence_map_view.htm"/>
- <topic label="Mapping an entity" href="task_mapping.htm"/>
- <topic label="Understanding OR mappings" href="concept_mapping.htm"/>
- </context>
- <context id="mapping_mappedBy">
- <description>The field in the database table that owns the relationship.</description>
- <topic label="JPA Details" href="ref_persistence_map_view.htm"/>
- <topic label="Mapping an entity" href="task_mapping.htm"/>
- <topic label="Understanding OR mappings" href="concept_mapping.htm"/>
- </context>
- <context id="mapping_joinColumnName">
- <description>The name of the database column that contains the foreign key reference for the entity association.</description>
- <topic label="JPA Details" href="ref_persistence_map_view.htm"/>
- <topic label="Mapping an entity" href="task_mapping.htm"/>
- <topic label="Understanding OR mappings" href="concept_mapping.htm"/>
- </context>
- <context id="mapping_joinReferencedColumn">
- <description>Name of the join table that contains the foreign key column.</description>
- <topic label="JPA Details" href="ref_persistence_map_view.htm"/>
- <topic label="Mapping an entity" href="task_mapping.htm"/>
- <topic label="Understanding OR mappings" href="concept_mapping.htm"/>
- </context>
- <context id="mapping_embeddedAttributeOverrides">
- <description>Specify to override the default mapping of an entity’s attribute.</description>
- <topic label="JPA Details" href="ref_persistence_map_view.htm"/>
- <topic label="Mapping an entity" href="task_mapping.htm"/>
- <topic label="Understanding OR mappings" href="concept_mapping.htm"/>
- </context>
- <context id="mapping_embeddedAttributeOverridesColumn">
- <description>The database column that is being mapped to the entity’s attribute.</description>
- <topic label="JPA Details" href="ref_persistence_map_view.htm"/>
- <topic label="Mapping an entity" href="task_mapping.htm"/>
- <topic label="Understanding OR mappings" href="concept_mapping.htm"/>
- </context>
- <context id="entity_mapAs">
- <description>Specify the type of persistent domain object for the Java class: Persistent, Embedded, or Mapped Superclass.</description>
- <topic label="Adding persistence to a class" href="task_add_persistence.htm"/>
- <topic label="JPA Details" href="ref_persistence_prop_view.htm"/>
- <topic label="Understanding persistence" href="concept_persistence.htm"/>
- </context>
- <context id="entity_inheritanceStrategy">
- <description>Specify how an entity may inherit properties from other entities: Single table, One table per class, or Joined tables.</description>
- <topic label="Specifying inheritance" href="task_inheritance.htm"/>
- <topic label="JPA Details" href="ref_persistence_prop_view.htm"/>
- </context>
- <context id="entity_inheritanceDiscriminatorColumn">
- <description>Use to specify the name of the discriminator column when using a Single or Joined inheritance strategy.</description>
- <topic label="Specifying inheritance" href="task_inheritance.htm"/>
- <topic label="JPA Details" href="ref_persistence_prop_view.htm"/>
- </context>
- <context id="entity_inheritanceDiscriminatorType">
- <description>Use this field to set the discriminator type to CHAR or INTEGER (instead of its default: String). The discriminator value must conform to this type.</description>
- <topic label="Specifying inheritance" href="task_inheritance.htm"/>
- <topic label="JPA Details" href="ref_persistence_prop_view.htm"/>
- </context>
- <context id="entity_inheritanceDiscriminatorValue">
- <description>Specify the discriminator value used to differentiate an entity in this inheritance hierarchy. The value must conform to the specified discriminator type.</description>
- <topic label="Specifying inheritance" href="task_inheritance.htm"/>
- <topic label="JPA Details" href="ref_persistence_prop_view.htm"/>
- </context>
- <context id="mapping_orderBy">
- <description>Specify the default order for objects returned from a query.</description>
- <topic label="JPA Details" href="ref_persistence_prop_view.htm"/>
- <topic label="Mapping an Entity" href="task_mapping.htm"/>
- </context>
- <context id="mapping_joinTableName">
- <description>Specify the name of the database table that defines the foreign key for a many-to-many or a unidirectional one-to-many association. You can configure the join table with a specific catalog or schema, configure one or more join table columns with a unique constraint, and use multiple join columns per entity.</description>
- <topic label="JPA Details" href="ref_persistence_prop_view.htm"/>
- <topic label="Mapping an entity" href="task_mapping.htm"/>
- </context>
- <context id="mapping_joinTableJoinColumns">
- <description>Specify two or more join columns (that is, a composite primary key).</description>
- <topic label="JPA Details" href="ref_persistence_prop_view.htm"/>
- <topic label="Mapping an entity" href="task_mapping.htm"/>
- </context>
- <context id="mapping_joinTableInverseJoinColumns">
- <description>Specify the join column on the owned (or inverse side) of the association: the owned entity's primary key column. </description>
- <topic label="JPA Details" href="ref_persistence_prop_view.htm"/>
- <topic label="Mapping an entity" href="task_mapping.htm"/>
- </context>
- <context id="properties_javaPersistence">
- <description>Use the Java Persistence options on the Properties page to select the database connection to use with the project.</description>
- <topic label="Project properties" href="ref_project_properties"/>
- <topic label="Adding persistence" href="ref_add_persistence.htm"/>
- <topic label="Understanding persistence" href="concept_persistence.htm"/>
- </context>
- <context id="properties_javaPersistenceConnection">
- <description>The database connection used to map the persistent entities.</description>
- <topic label="Project properties" href="ref_project_properties"/>
- <topic label="Understanding persistence" href="concept_persistence.htm"/>
- </context>
- <context id="properties_javaPersistenceSchema">
- <description>The database schema used to map the persistent entities.</description>
- <topic label="Project properties" href="ref_project_properties"/>
- <topic label="Understanding persistence" href="concept_persistence.htm"/>
- </context>
- <context id="dialog_addPersistence">
- <description>Use the Add Persistence dialog to define the database connection use to store the persistence entities.</description>
- <topic label="Adding persistence" href="ref_add_persistence.htm"/>
- <topic label="Understanding persistence" href="concept_persistence.htm"/>
- </context>
- <context id="persistenceOutline">
- <description>The JPA Structure view displays an outline of the structure (its attributes and mappings) of the entity that is currently selected or opened in the editor.</description>
- <topic label="JPA Structure view" href="ref_persistence_outline.htm"/>
- <topic label="Mapping an entity" href="task_mapping.htm"/>
- </context>
- <context id="dialog_generateEntities">
- <description>Use the Generate Entities dialog to create Java persistent entities based on your database tables.</description>
- <topic label="Generating entities from tables" href="task_generate_entities.htm.htm" />
- <topic label="Project properties" href="ref_project_properties"/>
- </context>
- <context id="dialog_generateEntities_source">
- <description>The project folder name in which to generate the Java persistent entities. Click Browse to select an existing folder.</description>
- <topic label="Generating entities from tables" href="task_generate_entities.htm"/>
- </context>
- <context id="dialog_generateEntities_package">
- <description>The package in which to generate the Java persistent entities, or click Browse to select an existing package.</description>
- <topic label="Generating entities from tables" href="task_generate_entities.htm"/>
- </context>
- <context id="dialog_generateEntities_tables">
- <description>Select the tables from which to create Java persistent entities.</description>
- <topic label="Generating entities from tables" href="task_generate_entities.htm"/>
- <topic label="Project properties" href="ref_project_properties"/>
- </context>
- <context id="dialog_addJavaPersistence">
- <description>Use this dialog to define the database connection used to store the persistence entities and to create the persistence.xml file.</description>
- <topic label="Add Persistence dialog" href="ref_add_persistence.htm" />
- <topic label="Adding persistence to a project" href="task_add_persistence" />
- <topic label="Managing the persistence.xml file" href="task_manage_persistence.htm" />
- </context>
- <context id="dialog_newJPAProject">
- <description>Use this dialog to define the new JPA project name, its location, target runtime, and other configuration settings.</description>
- <topic label="New JPA Project page" href="ref_new_jpa_project.htm" />
- <topic label="New JPA Project wizard" href="ref_new_jpa_project_wizard" />
- <topic label="Adding persistence to a project" href="task_add_persistence" />
- <topic label="Creating a new JPA project" href="task_create_new_project.htm" />
- </context>
- <context id="dialog_addJavaPersistence_database">
- <description>Use these fields to define the database connection used to store the persistent entities.</description>
- <topic label="Add Persistence dialog" href="ref_add_persistence.htm" />
- <topic label="Adding persistence to a project" href="task_add_persistence" />
- </context>
- <context id="dialog_addJavaPersistence_classpath">
- <description>Use this option to add libraries or JARs that contain the Java Persistence API (JPA) and entities to the project’s Java Build Path.</description>
- <topic label="Add Persistence dialog" href="ref_add_persistence.htm" />
- <topic label="Adding persistence to a project" href="task_add_persistence" />
- </context>
- <context id="dialog_addJavaPersistence_packaging">
- <description>Use these fields to create the persistence.xml file. Select the persistence version, the name of the JPA provider, and a unique name to identify the persistence unit.</description>
- <topic label="Add Persistence dialog" href="ref_add_persistence.htm" />
- <topic label="Managing the persistence.xml file" href="task_manage_persistence.htm" />
- </context>
- <context id="wizard_generateDDL_options ">
- <description>Use this page to select which script options will be included in the generated script.</description>
- <topic label="Generating tables (DDL) from entities " href="task_generate_ddl.htm" />
- <topic label="Options page " href="ref_options.htm" />
- </context>
- <context id="wizard_generateDDL_objects ">
- <description>Use this page to select which elements will be included in the generated script.</description>
- <topic label="Generating tables (DDL) from entities " href="task_generate_ddl.htm" />
- <topic label="Objects page " href="ref_objects.htm" />
- </context>
- <context id="wizard_generateDDL_save ">
- <description>Use this page to select the filename and location of the generated script. You can also preview the script and specify to run or continue editing the script after generation.</description>
- <topic label="Generating tables (DDL) from entities " href="task_generate_ddl.htm" />
- <topic label="Save and Run DDL page " href="ref_save_and_run.htm" />
- </context>
- <context id="wizard_generateDDL_summary ">
- <description>This page shows the settings that you selected for the generated DDL. To change any option click "Back" or click "Finish" to continue.</description>
- <topic label="Generating tables (DDL) from entities " href="task_generate_ddl.htm" />
- </context>
- <context id="mapping_tableGeneratorName">
- <description>The name of the table sequence generator. This name is global to to the persistence unit (across all generator types).</description>
- <topic label="JPA Details" href="ref_persistence_map_view.htm"/>
- <topic label="Mapping an entity" href="task_mapping.htm"/>
- </context>
- <context id="mapping_tableGeneratorTable">
- <description>The database table that stores the generated ID values. </description>
- <topic label="JPA Details" href="ref_persistence_map_view.htm"/>
- <topic label="Mapping an entity" href="task_mapping.htm"/>
- </context>
- <context id="mapping_tableGeneratorPrimaryKeyColumn">
- <description>The database column of the generator table that stores the generated ID values.</description>
- <topic label="JPA Details" href="ref_persistence_map_view.htm"/>
- <topic label="Mapping an entity" href="task_mapping.htm"/>
- </context>
- <context id="mapping_tableGeneratorValueColumn">
- <description>The name for the column that stores the generated ID values.</description>
- <topic label="JPA Details" href="ref_persistence_map_view.htm"/>
- <topic label="Mapping an entity" href="task_mapping.htm"/>
- </context>
- <context id="mapping_tableGeneratorPrimaryKeyColumnValue">
- <description>The database column of the generator table that defines the primary key value.</description>
- <topic label="JPA Details" href="ref_persistence_map_view.htm"/>
- <topic label="Mapping an entity" href="task_mapping.htm"/>
- </context>
- <context id="dialog_databaseAuthorization">
- <description>Use to connect (log in) to a database connection to use with your Java persistent entities.
- You must have a defined database connection (and be connected) to add persistence. </description>
- <topic label="Add persistence to a Java project" href="task_add_persistence_project.htm"/>
- </context>
- <context id="mapping_temporal">
- <description>Specify if the mapped field contains a Date (java.sql.Date), Time (java.sql.Time), or Timestamp (java.sql.Timestamp) value.</description>
- <topic label="JPA Details" href="ref_persistence_map_view.htm"/>
- <topic label="Mapping an entity" href="task_mapping.htm"/>
- </context>
- <context id="mapping_primaryKeyGeneration">
- <description>Define how the primary key is generated</description>
- <topic label="Primary Key Generation information" href="ref_primary_key.htm"/>
- <topic label="JPA Details" href="ref_persistence_map_view.htm"/>
- <topic label="Mapping an entity" href="task_mapping.htm"/>
- </context>
- <context id="mapping_tableGenerator">
- <description>Specify to use a specific database table for generating the primary key.</description>
- <topic label="Primary Key Generation information" href="ref_primary_key.htm"/>
- <topic label="JPA Details" href="ref_persistence_map_view.htm"/>
- <topic label="Mapping an entity" href="task_mapping.htm"/>
- </context>
- <context id="mapping_sequenceGenerator">
- <description>Specify to use a specific sequence for generating the primary key.</description>
- <topic label="Primary Key Generation information" href="ref_primary_key.htm"/>
- <topic label="JPA Details" href="ref_persistence_map_view.htm"/>
- <topic label="Mapping an entity" href="task_mapping.htm"/>
- </context>
- <context id="mapping_sequenceGeneratorName">
- <description>Name of the sequence.</description>
- <topic label="Primary Key Generation information" href="ref_primary_key.htm"/>
- <topic label="JPA Details" href="ref_persistence_map_view.htm"/>
- <topic label="Mapping an entity" href="task_mapping.htm"/>
- </context>
- <context id="mapping_sequenceGeneratorSequence">
- <description> </description>
- <topic label="Primary Key Generation information" href="ref_primary_key.htm"/>
- <topic label="JPA Details" href="ref_persistence_map_view.htm"/>
- <topic label="Mapping an entity" href="task_mapping.htm"/>
- </context>
- <context id="mapping_lob">
- <description>Specify if the field is mapped to java.sql.Clob or java.sql.Blob.</description>
- <topic label="General information" href="ref_mapping_general.htm"/>
- <topic label="JPA Details" href="ref_persistence_map_view.htm"/>
- <topic label="Mapping an entity" href="task_mapping.htm"/>
- </context>
- <context id="mapping_enumerated">
- <description>Specify how to persist enumerated constraints if the String value suits your application requirements or to match an existing database schema.</description>
- <topic label="General information" href="ref_mapping_general.htm"/>
- <topic label="JPA Details" href="ref_persistence_map_view.htm"/>
- <topic label="Mapping an entity" href="task_mapping.htm"/>
- </context>
- <context id="dialog_editInverseJoinColumn">
- <description>.</description>
- <topic label="Mapping an entity" href="task_mapping.htm"/>
- </context>
- <context id="entity_catalog">
- <description>The database catalog that contains the Table. This field overrides the defaults in the orm.xml file.</description>
- <topic label="JPA Details" href="ref_persistence_prop_view.htm"/>
- <topic label="Adding persistence to a class" href="task_add_persistence.htm"/>
- <topic label="Understanding persistence" href="concept_persistence.htm"/>
- </context>
- <context id="entity_schema">
- <description>The database schema that contains the Table. This field overrides the defaults in the orm.xml file.</description>
- <topic label="JPA Details" href="ref_persistence_prop_view.htm"/>
- <topic label="Adding persistence to a class" href="task_add_persistence.htm"/>
- <topic label="Understanding persistence" href="concept_persistence.htm"/>
- </context>
- <context id="orm_package">
- <description>The Java package that contains the persistent entities to which the orm.xml file applies.</description>
- <topic label="Managing the orm.xml file" href="task_manage_orm.htm"/>
- <topic label="JPA Details" href="ref_details_orm.htm"/>
- </context>
- <context id="orm_schema">
- <description>The database schema to use as the default for all entities managed by this persistence unit.</description>
- <topic label="Managing the orm.xml file" href="task_manage_orm.htm"/>
- <topic label="JPA Details" href="ref_details_orm.htm"/>
- </context>
- <context id="orm_catalog">
- <description>The database catalog to use as the default for all entities managed by this persistence unit.</description>
- <topic label="Managing the orm.xml file" href="task_manage_orm.htm"/>
- <topic label="JPA Details" href="ref_details_orm.htm"/>
- </context>
- <context id="orm_access">
- <description>The default access method for variables in this project: Property or Field.</description>
- <topic label="Managing the orm.xml file" href="task_manage_orm.htm"/>
- <topic label="JPA Details" href="ref_details_orm.htm"/>
- </context>
- <context id="orm_cascade">
- <description>Adds cascade-persist to the set of cascade options in entity relationships of the persistence unit.</description>
- <topic label="Managing the orm.xml file" href="task_manage_orm.htm"/>
- <topic label="JPA Details" href="ref_details_orm.htm"/>
- </context>
- <context id="orm_xml">
- <description>Specifies that the Java classes in this persistence unit are fully specified by their metadata. Any annotations will be ignored.</description>
- <topic label="Managing the orm.xml file" href="task_manage_orm.htm"/>
- <topic label="JPA Details" href="ref_details_orm.htm"/>
- </context>
- <context id="dialog_JPAPlatform">
- <description>Specify the vendor-specific JPA implementation.Default is Generic..</description>
- <topic label="JPA Facet page" href="ref_jpa_facet.htm"/>
- </context>
- <context id="dialog_createORM">
- <description>Create an initial orm.xml file. Use this file to specify project and persistence unit defaults.</description>
- <topic label="Managing the orm.xml file" href="task_manage_orm.htm"/>
- <topic label="JPA Facet page" href="ref_jpa_facet.htm"/>
- </context>
-
- <context id="caching_defaultType">
- <description>Select the default caching strategy for the project. The default is Weak with Soft Subcache.</description>
- <topic label="persistence.xml editor" href="ref_persistence_xml_editor" />
- <topic label="Managing the persistence.xml file" href="task_manage_persistence" />
- </context>
- <context id="caching_defaultSize">
- <description>Select the default size of the cache. The default is 100 items.</description>
- <topic label="persistence.xml editor" href="ref_persistence_xml_editor" />
- <topic label="Managing the persistence.xml file" href="task_manage_persistence" />
- </context>
- <context id="caching_defaultShared">
- <description>Specify if cached instances should be in the shared cache or in a client isolated cache.</description>
- <topic label="persistence.xml editor" href="ref_persistence_xml_editor" />
- <topic label="Managing the persistence.xml file" href="task_manage_persistence" />
- </context>
- <context id="logging_level">
- <description>Specifies the amount and detail of log output by selecting the log level. Default is Info level.</description>
- <topic label="persistence.xml editor" href="ref_persistence_xml_editor" />
- <topic label="Managing the persistence.xml file" href="task_manage_persistence" />
- </context>
- <context id="logging_timeStamp">
- <description>Control whether the timestamp is logged in each log entry. Default is True.</description>
- <topic label="persistence.xml editor" href="ref_persistence_xml_editor" />
- <topic label="Managing the persistence.xml file" href="task_manage_persistence" />
- </context>
- <context id="logging_thread">
- <description>Control whether a thread identifier is logged in each log entry. Default is True.</description>
- <topic label="persistence.xml editor" href="ref_persistence_xml_editor" />
- <topic label="Managing the persistence.xml file" href="task_manage_persistence" />
- </context>
- <context id="logging_session">
- <description>Control whether an EclipseLink session identifier is logged in each log entry. Default is True.</description>
- <topic label="persistence.xml editor" href="ref_persistence_xml_editor" />
- <topic label="Managing the persistence.xml file" href="task_manage_persistence" />
- </context>
- <context id="logging_exceptions">
- <description>Control whether the exceptions thrown from within the code are logged prior to returning the exception to the calling application. Ensures that all exceptions are logged and not masked by the application code.. Default is False.</description>
- <topic label="persistence.xml editor" href="ref_persistence_xml_editor" />
- <topic label="Managing the persistence.xml file" href="task_manage_persistence" />
- </context>
- <context id="options_sessionName">
- <description>Specify the name by which the EclipseLink session is stored in the static session manager.</description>
- <topic label="persistence.xml editor" href="ref_persistence_xml_editor" />
- <topic label="Managing the persistence.xml file" href="task_manage_persistence" />
- </context>
- <context id="options_sessionsXml">
- <description>Specify persistence information loaded from the EclipseLink session configuration file. You can use this option as an alternative to annotations and deployment XML.</description>
- <topic label="persistence.xml editor" href="ref_persistence_xml_editor" />
- <topic label="Managing the persistence.xml file" href="task_manage_persistence" />
- </context>
- <context id="options_targetDatabase">
- <description></description>
- <topic label="persistence.xml editor" href="ref_persistence_xml_editor" />
- <topic label="Managing the persistence.xml file" href="task_manage_persistence" />
- </context>
- <context id="options_targetServer">
- <description> </description>
- <topic label="persistence.xml editor" href="ref_persistence_xml_editor" />
- <topic label="Managing the persistence.xml file" href="task_manage_persistence" />
- </context>
- <context id="dialog_newJPAProjectJava">
- <description>Use this dialog to include existing Java source files in this project.</description>
- <topic label="Java page" href="ref_java_page.htm" />
- <topic label="New JPA Project wizard" href="ref_new_jpa_project_wizard" />
- <topic label="Creating a new JPA project" href="task_create_new_project.htm" />
- </context>
- <context id="dialog_newJPAProjectFacet">
- <description>Use this dialog to specify your vender-specific platform, JPA implementation library, and database connection.</description>
- <topic label="JPA Facet page" href="ref_jpa_facet.htm" />
- <topic label="New JPA Project wizard" href="ref_new_jpa_project_wizard" />
- <topic label="Creating a new JPA project" href="task_create_new_project.htm" />
- </context>
- <context id="dialog_entityClassPage">
- <description>Use this dialog to specify package, class name, and inheritance properties of the entity to create.</description>
- <topic label="Entity Class page" href="ref_EntityClassPage.htm" />
- <topic label="New JPA Entity wizard" href="ref_create_jpa_entity_wizard.htm" />
- <topic label="Creating a new JPA entity" href="task_create_jpa_entity.htm" />
- </context>
- <context id="dialog_entityPropertiesPage">
- <description>Use this dialog to specify the entity name, associated table, and mapped fields.</description>
- <topic label="Entity Properties page" href="ref_EntityPropertiesPage.htm" />
- <topic label="New JPA Entity wizard" href="ref_create_jpa_entity_wizard.htm" />
- <topic label="Creating a new JPA entity" href="task_create_jpa_entity.htm" />
- </context>
- <context id="dialog_selectTablesPage">
- <description>Use this dialog to specify the database tables from which to generate entities.</description>
- <topic label="Select Tables page" href="ref_selectTables.htm" />
- <topic label="Generate Custom Entities wizard" href="ref_create_custom_entities_wizard.htm" />
- </context>
- <context id="dialog_tableAssociationsPage">
- <description>Use this dialog to create or edit the association between the database table and entity.</description>
- <topic label="Table Associations page" href="ref_tableAssociations.htm" />
- <topic label="Generate Custom Entities wizard" href="ref_create_custom_entities_wizard.htm" />
- </context>
- <context id="dialog_customizeDefaultEntityGeneration">
- <description>Use this dialog to specify the table mapping and domain class information for the generated entity.</description>
- <topic label="Customize Default Entity Generation page" href="ref_customizeDefaultEntityGeneration.htm" />
- <topic label="Generate Custom Entities wizard" href="ref_create_custom_entities_wizard.htm" />
- </context>
- <context id="dialog_customizeIndividualEntities">
- <description>Use this dialog to specify the table mapping and domain class information for the generated entity.</description>
- <topic label="Customize Individual Entities page" href="ref_customizIndividualEntities.htm" />
- <topic label="Generate Custom Entities wizard" href="ref_create_custom_entities_wizard.htm" />
- </context>
-
- <context id="dialog_associationTablesPage">
- <description>Use this dialog to specify the association tables for an entity.</description>
- <topic label="Association Tables page" href="ref_association_tables.htm" />
- <topic label="Create New Association wizard" href="ref_create_new_association_wizard.htm" />
- </context>
- <context id="dialog_joinColumnsPage">
- <description>Use this dialog to specify the join columns of an association table.</description>
- <topic label="Join Columns page" href="ref_join_columns.htm" />
- <topic label="Create New Association wizard" href="ref_create_new_association_wizard.htm" />
- </context>
- <context id="dialog_associationCardinalityPage">
- <description>Use this dialog to specify cardinality of an association table.</description>
- <topic label="Association Cardinality page" href="ref_association_cardinality.htm" />
- <topic label="Create New Association wizard" href="ref_create_new_association_wizard.htm" />
- </context>
- <context id="dialog_selectCascade">
- <description>Specify which operations are propagated throughout the association: All, Persist, Merge, Remove, or Refresh.</description>
- <topic label="Select Cascade page" href="ref_select_cascade_dialog.htm"/>
- <topic label="JPA Details" href="ref_persistence_map_view.htm"/>
- <topic label="Mapping an entity" href="task_mapping.htm"/>
- <topic label="Understanding OR mappings" href="concept_mapping.htm"/>
- </context>
- <context id="persistence_general">
- <description>Specify the general persistence options.</description>
- <topic label="General page" href="ref_persistence_general" />
- <topic label="persistence.xml editor" href="ref_persistence_xml_editor" />
- <topic label="Managing the persistence.xml file" href="task_manage_persistence" />
- </context>
- <context id="persistence_connection">
- <description>Specify the data source or JDBC connection properties.</description>
- <topic label="Connection page" href="ref_persistence_connection" />
- <topic label="persistence.xml editor" href="ref_persistence_xml_editor" />
- <topic label="Managing the persistence.xml file" href="task_manage_persistence" />
- </context>
- <context id="persistence_customization">
- <description>Specify the default or entity specific EclipseLink customization and validation properties.</description>
- <topic label="Customization page" href="ref_persistence_connection" />
- <topic label="persistence.xml editor" href="ref_persistence_xml_editor" />
- <topic label="Managing the persistence.xml file" href="task_manage_persistence" />
- </context>
- <context id="persistence_caching">
- <description>Configure the session or entity specific EclipseLink caching properties.</description>
- <topic label="Caching page" href="ref_persistence_caching" />
- <topic label="persistence.xml editor" href="ref_persistence_xml_editor" />
- <topic label="Managing the persistence.xml file" href="task_manage_persistence" />
- </context>
- <context id="persistence_logging">
- <description>Configure the EclipseLink logging properties.</description>
- <topic label="Logging page" href="ref_persistence_logging" />
- <topic label="persistence.xml editor" href="ref_persistence_xml_editor" />
- <topic label="Managing the persistence.xml file" href="task_manage_persistence" />
- </context>
- <context id="persistence_options">
- <description>Configure the EclipseLink session and miscellanous options.</description>
- <topic label="Options page" href="ref_persistence_options" />
- <topic label="persistence.xml editor" href="ref_persistence_xml_editor" />
- <topic label="Managing the persistence.xml file" href="task_manage_persistence" />
- </context>
- <context id="persistence_schemaGeneration">
- <description>Configure the schema generation properties.</description>
- <topic label="Schema Generation page" href="ref_persistence_schemaGeneration" />
- <topic label="persistence.xml editor" href="ref_persistence_xml_editor" />
- <topic label="Managing the persistence.xml file" href="task_manage_persistence" />
- </context>
- <context id="persistence_properties">
- <description>Configure the properties defined for the persistence unit.</description>
- <topic label="Properties page" href="ref_persistence_properties" />
- <topic label="persistence.xml editor" href="ref_persistence_xml_editor" />
- <topic label="Managing the persistence.xml file" href="task_manage_persistence" />
- </context>
- <context id="persistence_source">
- <description>Configure the properties defined for the persistence unit.</description>
- <topic label="Properties page" href="ref_persistence_properties" />
- <topic label="persistence.xml editor" href="ref_persistence_xml_editor" />
- <topic label="Managing the persistence.xml file" href="task_manage_persistence" />
- </context>
- <context id="dialog_eclipselink_mapping_file">
- <description>Configure the properties defined for the persistence unit.</description>
- <topic label="New EclipseLink Mapping File page" href="ref_eclipselink_mapping_file" />
- <topic label="persistence.xml editor" href="ref_persistence_xml_editor" />
- <topic label="Managing the orm.xml file" href="task_manage_orm" />
- </context>
- <context id="dialog_create_new_converters">
- <description>Use this dialog to create a new EclipseLink conveter.</description>
- <topic label="Add Converter dialog" href="ref_add_converter" />
- <topic label="Managing the orm.xml file" href="task_manage_orm" />
- </context>
-
-
-</contexts>
diff --git a/jpa/plugins/org.eclipse.jpt.doc.user/dcommon/css/blafdoc.css b/jpa/plugins/org.eclipse.jpt.doc.user/dcommon/css/blafdoc.css
deleted file mode 100644
index baf6127928..0000000000
--- a/jpa/plugins/org.eclipse.jpt.doc.user/dcommon/css/blafdoc.css
+++ /dev/null
@@ -1,21 +0,0 @@
-@import "../../../PRODUCT_PLUGIN/book.css";
-
-span.control, span.gui-object-action, p.subhead2, span.bold, p.notep1 {
- font-weight: bold;
-}
-
-span.name, p.titleinfigure, span.italic {
- font-style: italic;
-}
-
-p.titleinfigure, p.subhead2 {
- padding-top: 10px;
-}
-
-span.code {
- font-family: monospace;
-}
-
-span.copyrightlogo {font-size: 0.8em}
-
-.footer {margin-top: 2em;border-top:1px solid #cccccc;padding-top:1em;} \ No newline at end of file
diff --git a/jpa/plugins/org.eclipse.jpt.doc.user/dcommon/html/cpyr.htm b/jpa/plugins/org.eclipse.jpt.doc.user/dcommon/html/cpyr.htm
deleted file mode 100644
index 382ec67619..0000000000
--- a/jpa/plugins/org.eclipse.jpt.doc.user/dcommon/html/cpyr.htm
+++ /dev/null
@@ -1,11 +0,0 @@
-<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN"
- "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
-<html xmlns="http://www.w3.org/1999/xhtml" xml:lang="en" lang="en">
-
-<head>
-<!-- <meta http-equiv="refresh" content="0;url=../../legal.htm"> -->
-</head>
-<body>
-<p><a href="../../legal.htm">License Information</a></p>
-</body>
-</html>
diff --git a/jpa/plugins/org.eclipse.jpt.doc.user/getting_started.htm b/jpa/plugins/org.eclipse.jpt.doc.user/getting_started.htm
deleted file mode 100644
index feced4c2a7..0000000000
--- a/jpa/plugins/org.eclipse.jpt.doc.user/getting_started.htm
+++ /dev/null
@@ -1,47 +0,0 @@
-<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN"
- "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
-<html xmlns="http://www.w3.org/1999/xhtml" xml:lang="en" lang="en">
-<head>
-<meta http-equiv="Content-Type" content="text/html; charset=us-ascii" />
-
-<meta http-equiv="Content-Style-Type" content="text/css" />
-<meta http-equiv="Content-Script-Type" content="text/javascript" />
-<title>Getting started</title>
-<meta name="generator" content="Oracle DARB XHTML Converter (Mode = ohj/ohw) - Version 5.1.1 Build 004" />
-<meta name="date" content="2009-05-01T8:12:41Z" />
-<meta name="robots" content="noarchive" />
-<meta name="doctitle" content=" Getting started" />
-<meta name="relnum" content="Release 2.2" />
-<meta name="copyright" content="Copyright (c) 2000, 2008 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. Contributors: Oracle - initial API and implementation" />
-<link rel="copyright" href="dcommon/html/cpyr.htm" title="Copyright" type="text/html" />
-<link rel="stylesheet" href="dcommon/css/blafdoc.css" title="Oracle BLAFDoc" type="text/css" />
-<!-- contents -->
-</head>
-<body>
-<p><a id="sthref2" name="sthref2"></a></p>
-<h1>Getting started</h1>
-<p>This section provides information on getting started with the Java Persistence Tools.</p>
-<ul>
-<li>
-<p><a href="getting_started001.htm#BABEFHCD">Requirements and installation</a></p>
-</li>
-<li>
-<p><a href="getting_started002.htm#BABIGCJA">Dali quick start</a></p>
-</li>
-</ul>
-<p>For additional information, please visit the Dali home page at:</p>
-<p><code><a href="http://www.eclipse.org/webtools/dali/main.php">http://www.eclipse.org/webtools/dali/main.php</a></code>.</p>
-<!-- Start Footer -->
-<div class="footer">
-<table class="simple oac_no_warn" summary="" cellspacing="0" cellpadding="0" width="100%">
-<col width="86%" />
-<col width="*" />
-<tr>
-<td align="left"><span class="copyrightlogo">Copyright&nbsp;&copy;&nbsp;2006, 2009,&nbsp;Oracle&nbsp;and/or&nbsp;its&nbsp;affiliates.&nbsp;All&nbsp;rights&nbsp;reserved.</span><br />
-<a href="dcommon/html/cpyr.htm"><span class="copyrightlogo">Legal Notices</span></a></td>
-</tr>
-</table>
-</div>
-<!-- class="footer" -->
-</body>
-</html>
diff --git a/jpa/plugins/org.eclipse.jpt.doc.user/getting_started001.htm b/jpa/plugins/org.eclipse.jpt.doc.user/getting_started001.htm
deleted file mode 100644
index 0862190dab..0000000000
--- a/jpa/plugins/org.eclipse.jpt.doc.user/getting_started001.htm
+++ /dev/null
@@ -1,80 +0,0 @@
-<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN"
- "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
-<html xmlns="http://www.w3.org/1999/xhtml" xml:lang="en" lang="en">
-<head>
-<meta http-equiv="Content-Type" content="text/html; charset=us-ascii" />
-
-<meta http-equiv="Content-Style-Type" content="text/css" />
-<meta http-equiv="Content-Script-Type" content="text/javascript" />
-<title>Requirements and installation</title>
-<meta name="generator" content="Oracle DARB XHTML Converter (Mode = ohj/ohw) - Version 5.1.1 Build 004" />
-<meta name="date" content="2009-05-01T8:12:41Z" />
-<meta name="robots" content="noarchive" />
-<meta name="doctitle" content="Requirements and installation" />
-<meta name="relnum" content="Release 2.2" />
-<meta name="copyright" content="Copyright (c) 2000, 2008 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. Contributors: Oracle - initial API and implementation" />
-<link rel="copyright" href="dcommon/html/cpyr.htm" title="Copyright" type="text/html" />
-<link rel="stylesheet" href="dcommon/css/blafdoc.css" title="Oracle BLAFDoc" type="text/css" />
-<!-- contents -->
-</head>
-<body>
-<p><a id="BABEFHCD" name="BABEFHCD"></a></p>
-<div class="sect1"><!-- infolevel="all" infotype="General" -->
-<h1>Requirements and installation<a id="sthref3" name="sthref3"></a><a id="sthref4" name="sthref4"></a></h1>
-<p>Before installing Dali, ensure that your environment meets the following <span class="italic">minimum</span> requirements:</p>
-<ul>
-<li>
-<p>Eclipse 3.5 (<code><a href="http://www.eclipse.org/downloads">http://www.eclipse.org/downloads</a></code>)</p>
-</li>
-<li>
-<p>Java Runtime Environment (JRE) 1.5 (<code><a href="http://java.com">http://java.com</a></code>)</p>
-</li>
-<li>
-<p>Eclipse Web Tools Platform (WTP) 3.1 (<code><a href="http://www.eclipse.org/webtools">http://www.eclipse.org/webtools</a></code>)</p>
-</li>
-<li>
-<p>Java Persistence API (JPA) for Java EE 5. For example, the EclipseLink implementation for JPA can be obtained from: <code><a href="http://www.eclipse.org/eclipselink/">http://www.eclipse.org/eclipselink/</a></code></p>
-</li>
-</ul>
-<p>Refer to <code><a href="http://www.eclipse.org/webtools/dali/gettingstarted_main.html">http://www.eclipse.org/webtools/dali/gettingstarted_main.html</a></code> for additional installation information.</p>
-<p><a id="sthref5" name="sthref5"></a>Dali is included as part of WTP 3.1. No additional installation or configuration is required.</p>
-<a id="sthref6" name="sthref6"></a>
-<p class="subhead2">Accessibility Features</p>
-<p>Dali supports the standard accessibility features in Eclipse, including the following:</p>
-<ul>
-<li>
-<p>Navigating the user interface using the keyboard.</p>
-</li>
-<li>
-<p>Specifying general accessibility preferences for the editor.</p>
-</li>
-</ul>
-<p>See <a href="../org.eclipse.platform.doc.user/concepts/accessibility/accessmain.htm">Accessibility Features in Eclipse</a> in the <span class="italic">Workbench User Guide</span> for details.</p>
-<a id="sthref7" name="sthref7"></a>
-<p class="subhead2">Help Accessibility</p>
-<p>The documentation and help contains markup to facilitate access by the disabled community. See <a href="../org.eclipse.platform.doc.user/tasks/help_accessibility.htm">Help Accessibility</a> in the <span class="italic">Workbench User Guide</span> for details.</p>
-<p>When using the help, be aware of the following:</p>
-<ul>
-<li>
-<p>Screen readers may not always correctly read the code examples in this document. The conventions for writing code require that closing braces should appear on an otherwise empty line; however, some screen readers may not always read a line of text that consists solely of a bracket or brace.</p>
-</li>
-<li>
-<p>This documentation may contain links to Web sites of other companies or organizations that we do not control. We neither evaluate nor make any representations regarding the accessibility of these Web sites.</p>
-</li>
-</ul>
-</div>
-<!-- class="sect1" -->
-<!-- Start Footer -->
-<div class="footer">
-<table class="simple oac_no_warn" summary="" cellspacing="0" cellpadding="0" width="100%">
-<col width="86%" />
-<col width="*" />
-<tr>
-<td align="left"><span class="copyrightlogo">Copyright&nbsp;&copy;&nbsp;2006, 2009,&nbsp;Oracle&nbsp;and/or&nbsp;its&nbsp;affiliates.&nbsp;All&nbsp;rights&nbsp;reserved.</span><br />
-<a href="dcommon/html/cpyr.htm"><span class="copyrightlogo">Legal Notices</span></a></td>
-</tr>
-</table>
-</div>
-<!-- class="footer" -->
-</body>
-</html>
diff --git a/jpa/plugins/org.eclipse.jpt.doc.user/getting_started002.htm b/jpa/plugins/org.eclipse.jpt.doc.user/getting_started002.htm
deleted file mode 100644
index 4d49797eac..0000000000
--- a/jpa/plugins/org.eclipse.jpt.doc.user/getting_started002.htm
+++ /dev/null
@@ -1,49 +0,0 @@
-<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN"
- "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
-<html xmlns="http://www.w3.org/1999/xhtml" xml:lang="en" lang="en">
-<head>
-<meta http-equiv="Content-Type" content="text/html; charset=us-ascii" />
-
-<meta http-equiv="Content-Style-Type" content="text/css" />
-<meta http-equiv="Content-Script-Type" content="text/javascript" />
-<title>Dali quick start</title>
-<meta name="generator" content="Oracle DARB XHTML Converter (Mode = ohj/ohw) - Version 5.1.1 Build 004" />
-<meta name="date" content="2009-05-01T8:12:41Z" />
-<meta name="robots" content="noarchive" />
-<meta name="doctitle" content="Dali quick start" />
-<meta name="relnum" content="Release 2.2" />
-<meta name="copyright" content="Copyright (c) 2000, 2008 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. Contributors: Oracle - initial API and implementation" />
-<link rel="copyright" href="dcommon/html/cpyr.htm" title="Copyright" type="text/html" />
-<link rel="stylesheet" href="dcommon/css/blafdoc.css" title="Oracle BLAFDoc" type="text/css" />
-<!-- contents -->
-</head>
-<body>
-<p><a id="BABIGCJA" name="BABIGCJA"></a></p>
-<div class="sect1"><!-- infolevel="all" infotype="General" -->
-<h1>Dali quick start</h1>
-<p><a id="sthref8" name="sthref8"></a>This section includes information to help you quickly start using Dali to create relational mappings between Java persistent entities and database tables.</p>
-<ul>
-<li>
-<p><a href="getting_started003.htm#BABDFHDA">Creating a new JPA project</a></p>
-</li>
-<li>
-<p><a href="getting_started004.htm#BABFGDDG">Creating a Java persistent entity with persistent fields</a></p>
-</li>
-</ul>
-<img src="img/ngrelr.png" alt="Related reference" title="Related reference" /><br />
-<br />
-<a href="tips_and_tricks.htm#CHDHGHBF">Tips and tricks</a><br />
-<!-- Start Footer -->
-<div class="footer">
-<table class="simple oac_no_warn" summary="" cellspacing="0" cellpadding="0" width="100%">
-<col width="86%" />
-<col width="*" />
-<tr>
-<td align="left"><span class="copyrightlogo">Copyright&nbsp;&copy;&nbsp;2006, 2009,&nbsp;Oracle&nbsp;and/or&nbsp;its&nbsp;affiliates.&nbsp;All&nbsp;rights&nbsp;reserved.</span><br />
-<a href="dcommon/html/cpyr.htm"><span class="copyrightlogo">Legal Notices</span></a></td>
-</tr>
-</table>
-</div>
-<!-- class="footer" --></div>
-</body>
-</html>
diff --git a/jpa/plugins/org.eclipse.jpt.doc.user/getting_started003.htm b/jpa/plugins/org.eclipse.jpt.doc.user/getting_started003.htm
deleted file mode 100644
index 4d9aa084a6..0000000000
--- a/jpa/plugins/org.eclipse.jpt.doc.user/getting_started003.htm
+++ /dev/null
@@ -1,105 +0,0 @@
-<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN"
- "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
-<html xmlns="http://www.w3.org/1999/xhtml" xml:lang="en" lang="en">
-<head>
-<meta http-equiv="Content-Type" content="text/html; charset=us-ascii" />
-
-<meta http-equiv="Content-Style-Type" content="text/css" />
-<meta http-equiv="Content-Script-Type" content="text/javascript" />
-<title>Creating a new JPA project</title>
-<meta name="generator" content="Oracle DARB XHTML Converter (Mode = ohj/ohw) - Version 5.1.1 Build 004" />
-<meta name="date" content="2009-05-01T8:12:41Z" />
-<meta name="robots" content="noarchive" />
-<meta name="doctitle" content="Creating a new JPA project" />
-<meta name="relnum" content="Release 2.2" />
-<meta name="copyright" content="Copyright (c) 2000, 2008 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. Contributors: Oracle - initial API and implementation" />
-<link rel="copyright" href="dcommon/html/cpyr.htm" title="Copyright" type="text/html" />
-<link rel="stylesheet" href="dcommon/css/blafdoc.css" title="Oracle BLAFDoc" type="text/css" />
-<!-- contents -->
-</head>
-<body>
-<p><a id="BABDFHDA" name="BABDFHDA"></a></p>
-<div class="sect2"><!-- infolevel="all" infotype="General" -->
-<h1>Creating a new JPA project</h1>
-<p><a id="sthref9" name="sthref9"></a>This quick start shows how to create a new JPA project.</p>
-<ol>
-<li>
-<p><span class="bold">Select File &gt; New &gt; Project</span>. The Select a Wizard dialog appears.</p>
-<div align="center">
-<div class="inftblnotealso"><br />
-<table class="NoteAlso oac_no_warn" summary="" cellpadding="3" cellspacing="0">
-<tbody>
-<tr>
-<td align="left">
-<p class="notep1">Tip:</p>
-You can also select the JPA perspective and then select <span class="bold">File &gt; New &gt; JPA Project</span>.</td>
-</tr>
-</tbody>
-</table>
-<br /></div>
-<!-- class="inftblnotealso" --></div>
-</li>
-<li>
-<p>Select <span class="bold">JPA Project</span> and then click <span class="bold">Next</span>. The <a href="ref_new_jpa_project.htm#CACBJAGC">New JPA Project page</a> appears.</p>
-</li>
-<li>
-<p>Enter a <span class="gui-object-action">Project name</span> (such as <code>QuickStart</code>).</p>
-</li>
-<li>
-<p>If needed, select the <span class="bold">Target Runtime</span> (such as <code>Apache Tomcat</code>) and configuration, such as <span class="bold">Utility JPA Project with Java 5.0</span> and then click <span class="bold">Next</span>. The Java source page appears.</p>
-<div align="center">
-<div class="inftblnote"><br />
-<table class="Note oac_no_warn" summary="" cellpadding="3" cellspacing="0">
-<tbody>
-<tr>
-<td align="left">
-<p class="notep1">Note:</p>
-The Target Runtime is not required for Java SE development.</td>
-</tr>
-</tbody>
-</table>
-<br /></div>
-<!-- class="inftblnote" --></div>
-</li>
-<li>
-<p>If you have existing Java source files, add them to your classpath and then click <span class="bold">Next</span>. The <a href="ref_jpa_facet.htm#CACIFDIF">JPA Facet page</a> appears.</p>
-</li>
-<li>
-<p>On the JPA Facet dialog, select your vendor-specific JPA platform (or select <span class="bold">Generic</span>), database connection (or create a new connection), JPA implementation library (such as EclipseLink), define how Dali should manage persistent classes, and then click <span class="bold">Finish</span>.</p>
-<div align="center">
-<div class="inftblnotealso"><br />
-<table class="NoteAlso oac_no_warn" summary="" cellpadding="3" cellspacing="0">
-<tbody>
-<tr>
-<td align="left">
-<p class="notep1">Tip:</p>
-Select <span class="bold">Override the Default Schema for Connection</span> if you require a schema other than the one that Dali derives from the connection information, which may be incorrect in some cases. Using this option, you can select a development time schema for defaults and validation.</td>
-</tr>
-</tbody>
-</table>
-<br /></div>
-<!-- class="inftblnotealso" --></div>
-</li>
-</ol>
-<p>Eclipse adds the project to the workbench and opens the JPA perspective.</p>
-<div class="figure"><a id="sthref10" name="sthref10"></a>
-<p class="titleinfigure">JPA Project in Project Explorer</p>
-<img src="img/quickstart_project.png" alt="Package Explorer showing the JPA project." title="Package Explorer showing the JPA project." /><br /></div>
-<!-- class="figure" -->
-<p>Now that you have created a project with persistence, you can continue with <a href="getting_started004.htm#BABFGDDG">Creating a Java persistent entity with persistent fields</a>.</p>
-</div>
-<!-- class="sect2" -->
-<!-- Start Footer -->
-<div class="footer">
-<table class="simple oac_no_warn" summary="" cellspacing="0" cellpadding="0" width="100%">
-<col width="86%" />
-<col width="*" />
-<tr>
-<td align="left"><span class="copyrightlogo">Copyright&nbsp;&copy;&nbsp;2006, 2009,&nbsp;Oracle&nbsp;and/or&nbsp;its&nbsp;affiliates.&nbsp;All&nbsp;rights&nbsp;reserved.</span><br />
-<a href="dcommon/html/cpyr.htm"><span class="copyrightlogo">Legal Notices</span></a></td>
-</tr>
-</table>
-</div>
-<!-- class="footer" -->
-</body>
-</html>
diff --git a/jpa/plugins/org.eclipse.jpt.doc.user/getting_started004.htm b/jpa/plugins/org.eclipse.jpt.doc.user/getting_started004.htm
deleted file mode 100644
index e12cb631b3..0000000000
--- a/jpa/plugins/org.eclipse.jpt.doc.user/getting_started004.htm
+++ /dev/null
@@ -1,204 +0,0 @@
-<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN"
- "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
-<html xmlns="http://www.w3.org/1999/xhtml" xml:lang="en" lang="en">
-<head>
-<meta http-equiv="Content-Type" content="text/html; charset=us-ascii" />
-
-<meta http-equiv="Content-Style-Type" content="text/css" />
-<meta http-equiv="Content-Script-Type" content="text/javascript" />
-<title>Creating a Java persistent entity with persistent fields</title>
-<meta name="generator" content="Oracle DARB XHTML Converter (Mode = ohj/ohw) - Version 5.1.1 Build 004" />
-<meta name="date" content="2009-05-01T8:12:41Z" />
-<meta name="robots" content="noarchive" />
-<meta name="doctitle" content="Creating a Java persistent entity with persistent fields" />
-<meta name="relnum" content="Release 2.2" />
-<meta name="copyright" content="Copyright (c) 2000, 2008 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. Contributors: Oracle - initial API and implementation" />
-<link rel="copyright" href="dcommon/html/cpyr.htm" title="Copyright" type="text/html" />
-<link rel="stylesheet" href="dcommon/css/blafdoc.css" title="Oracle BLAFDoc" type="text/css" />
-<!-- contents -->
-</head>
-<body>
-<p><a id="BABFGDDG" name="BABFGDDG"></a></p>
-<div class="sect2"><!-- infolevel="all" infotype="General" -->
-<h1>Creating a Java persistent entity with persistent fields</h1>
-<p><a id="sthref11" name="sthref11"></a>This quick start shows how to create a new persistent Java entity. We will create an entity to associate with a database table. You will also need to add the ADDRESS table to your database.</p>
-<ol>
-<li>
-<p>Select the JPA project in the Navigator or Project Explorer and then click <span class="bold">New &gt; Other</span>. The Select a Wizard dialog appears.</p>
-</li>
-<li>
-<p>Select <span class="bold">JPA &gt; Entity</span> and then click <span class="bold">Next</span>. The <a href="ref_EntityClassPage.htm#CIAFEIGF">Entity Class page</a> appears.</p>
-</li>
-<li>
-<p>Enter the package name (such as <code>quickstart.demo.model</code>), the class name (such as <code>Address</code>) and then click <span class="bold">Next</span>. The <a href="ref_EntityPropertiesPage.htm#CIADECIA">Entity Properties page</a> appears, which enables you to define the persistence fields, which you will map to the columns of a database table.</p>
-</li>
-<li>
-<p><a id="sthref12" name="sthref12"></a><a id="sthref13" name="sthref13"></a>Use the Entity Fields dialog (invoked by clicking <span class="bold">Add</span>) to add persistence fields to the Address class:</p>
-<pre xml:space="preserve" class="oac_no_warn">
-private Long id;
-private String city;
-private String country;
-private String stateOrProvince;
-private String postalCode;
-private String street;
-</pre>
-<div align="center">
-<div class="inftblnote"><br />
-<table class="Note oac_no_warn" summary="" cellpadding="3" cellspacing="0">
-<tbody>
-<tr>
-<td align="left">
-<p class="notep1">Note:</p>
-You will also need to add the following columns to the ADDRESS database table:
-<pre xml:space="preserve" class="oac_no_warn">
-NUMBER(10,0) ADDRESS_ID (primary key)
-VARCHAR2(80) PROVINCE
-VARCHAR2(80) COUNTRY
-VARCHAR2(20) P_CODE
-VARCHAR2(80) STREET
-VARCHAR2(80) CITY
-</pre>
-<pre xml:space="preserve" class="oac_no_warn">
-</pre></td>
-</tr>
-</tbody>
-</table>
-<br /></div>
-<!-- class="inftblnote" --></div>
-</li>
-<li>
-<p>Click <span class="bold">Finish</span>. With the Create JPA Entity completed, Eclipse displays the <span class="bold">Address</span> entity in the JPA Structure view.</p>
-<p>Address.java includes the <code>@Entity</code> annotation, the persistence fields, as well as <code>getter</code> and <code>setter</code> methods for each of the fields.</p>
-</li>
-</ol>
-<div class="figure"><a id="sthref14" name="sthref14"></a>
-<p class="titleinfigure">Address Entity in Address.java</p>
-<img src="img/java_editor_address.png" alt="Java editor with the Address entity." title="Java editor with the Address entity." /><br /></div>
-<!-- class="figure" -->
-<p>Eclipse also displays the <span class="bold">Address</span> entity in the JPA Structure view:</p>
-<div class="figure"><a id="sthref15" name="sthref15"></a>
-<p class="titleinfigure">Address Entity in the JPA Structure View</p>
-<img src="img/address_java_JPA_structure_quickstart.png" alt="Address.java in the JPA Structure View." title="Address.java in the JPA Structure View." /><br /></div>
-<!-- class="figure" -->
-<ol>
-<li>
-<p>Select the <span class="gui-object-action">Address</span> class in the Project Explorer view.</p>
-</li>
-<li>
-<p>In the <span class="gui-object-title">JPA Details</span> view, notice that Dali has automatically associated the ADDRESS database table with the entity because they are named identically.</p>
-<div align="center">
-<div class="inftblnote"><br />
-<table class="Note oac_no_warn" summary="" cellpadding="3" cellspacing="0">
-<tbody>
-<tr>
-<td align="left">
-<p class="notep1">Note:</p>
-Depending on your database connection type, you may need to specify the <span class="bold">Schema</span>.</td>
-</tr>
-</tbody>
-</table>
-<br /></div>
-<!-- class="inftblnote" --></div>
-<div class="figure"><a id="sthref16" name="sthref16"></a>
-<p class="titleinfigure">JPA Details View for Address Entity</p>
-<img src="img/address.java_jpa_details.png" alt="Address.java in the JPA Details view." title="Address.java in the JPA Details view." /><br /></div>
-<!-- class="figure" --></li>
-</ol>
-<div align="center">
-<div class="inftblnotealso"><br />
-<table class="NoteAlso oac_no_warn" summary="" cellpadding="3" cellspacing="0">
-<tbody>
-<tr>
-<td align="left">
-<p class="notep1">Tip:</p>
-After associating the entity with the database table, you should update the <code>persistence.xml</code> file to include this JPA entity.
-<p>Right-click the <code>persistence.xml</code> file in the Project Explorer and select <span class="bold">JPA Tools &gt; Synchronize Classes</span>. Dali adds the following to the <code>persistence.xml</code> file:</p>
-<p><code>&lt;class&gt;quickstart.demo.model.Address&lt;/class&gt;</code></p>
-</td>
-</tr>
-</tbody>
-</table>
-<br /></div>
-<!-- class="inftblnotealso" --></div>
-<p>Now we are ready to map each fields in the Address class to a column in the database table.</p>
-<ol>
-<li>
-<p>Select the <span class="gui-object-action">id</span> field in the JPA Details view.</p>
-</li>
-<li>
-<p>Right click id and then select <span class="bold">Map As &gt; id</span>.</p>
-</li>
-<li>
-<p>In the JPA Details view, select <span class="bold">ADDRESS_ID</span> in the Name field:</p>
-<div class="figure"><a id="sthref17" name="sthref17"></a>
-<p class="titleinfigure">JPA Details View for the addressId Field</p>
-<img src="img/address_id_details_quickstart.png" alt="The JPA Details view for the Address entity&rsquo;s id attribute." title="The JPA Details view for the Address entity&rsquo;s id attribute." /><br /></div>
-<!-- class="figure" -->
-<p>Eclipse adds the following annotations to the Address entity:</p>
-<pre xml:space="preserve" class="oac_no_warn">
-@Id
-@Column(name="ADDRESS_ID")
-</pre></li>
-<li>
-<p>Map each of the following fields (as <span class="bold">Basic</span> mappings) to the appropriate database column:</p>
-<div class="inftblhruleinformal">
-<table class="HRuleInformal" title="This table describes the mappings for each of the fields in the Address entity." summary="This table describes the mappings for each of the fields in the Address entity." dir="ltr" border="1" width="100%" frame="border" rules="all" cellpadding="3" cellspacing="0">
-<col width="*" />
-<col width="33%" />
-<col width="33%" />
-<thead>
-<tr align="left" valign="top">
-<th align="left" valign="bottom" id="r1c1-t8">Field</th>
-<th align="left" valign="bottom" id="r1c2-t8">Map As</th>
-<th align="left" valign="bottom" id="r1c3-t8">Database Column</th>
-</tr>
-</thead>
-<tbody>
-<tr align="left" valign="top">
-<td align="left" id="r2c1-t8" headers="r1c1-t8">city</td>
-<td align="left" headers="r2c1-t8 r1c2-t8">Basic</td>
-<td align="left" headers="r2c1-t8 r1c3-t8">CITY</td>
-</tr>
-<tr align="left" valign="top">
-<td align="left" id="r3c1-t8" headers="r1c1-t8">country</td>
-<td align="left" headers="r3c1-t8 r1c2-t8">Basic</td>
-<td align="left" headers="r3c1-t8 r1c3-t8">COUNTRY</td>
-</tr>
-<tr align="left" valign="top">
-<td align="left" id="r4c1-t8" headers="r1c1-t8">postalCode</td>
-<td align="left" headers="r4c1-t8 r1c2-t8">Basic</td>
-<td align="left" headers="r4c1-t8 r1c3-t8">P_CODE</td>
-</tr>
-<tr align="left" valign="top">
-<td align="left" id="r5c1-t8" headers="r1c1-t8">provinceOrState</td>
-<td align="left" headers="r5c1-t8 r1c2-t8">Basic</td>
-<td align="left" headers="r5c1-t8 r1c3-t8">PROVINCE</td>
-</tr>
-<tr align="left" valign="top">
-<td align="left" id="r6c1-t8" headers="r1c1-t8">street</td>
-<td align="left" headers="r6c1-t8 r1c2-t8">Basic</td>
-<td align="left" headers="r6c1-t8 r1c3-t8">STREET</td>
-</tr>
-</tbody>
-</table>
-<br /></div>
-<!-- class="inftblhruleinformal" --></li>
-</ol>
-<p>Dali automatically maps some fields to the correct database column (such as the city field to the City column) if the names are identical.</p>
-</div>
-<!-- class="sect2" -->
-<!-- class="sect1" -->
-<!-- Start Footer -->
-<div class="footer">
-<table class="simple oac_no_warn" summary="" cellspacing="0" cellpadding="0" width="100%">
-<col width="86%" />
-<col width="*" />
-<tr>
-<td align="left"><span class="copyrightlogo">Copyright&nbsp;&copy;&nbsp;2006, 2009,&nbsp;Oracle&nbsp;and/or&nbsp;its&nbsp;affiliates.&nbsp;All&nbsp;rights&nbsp;reserved.</span><br />
-<a href="dcommon/html/cpyr.htm"><span class="copyrightlogo">Legal Notices</span></a></td>
-</tr>
-</table>
-</div>
-<!-- class="footer" -->
-</body>
-</html>
diff --git a/jpa/plugins/org.eclipse.jpt.doc.user/img/address.java_jpa_details.png b/jpa/plugins/org.eclipse.jpt.doc.user/img/address.java_jpa_details.png
deleted file mode 100644
index 77ce80ae3a..0000000000
--- a/jpa/plugins/org.eclipse.jpt.doc.user/img/address.java_jpa_details.png
+++ /dev/null
Binary files differ
diff --git a/jpa/plugins/org.eclipse.jpt.doc.user/img/address_id_details_quickstart.png b/jpa/plugins/org.eclipse.jpt.doc.user/img/address_id_details_quickstart.png
deleted file mode 100644
index 7ef40cf6c6..0000000000
--- a/jpa/plugins/org.eclipse.jpt.doc.user/img/address_id_details_quickstart.png
+++ /dev/null
Binary files differ
diff --git a/jpa/plugins/org.eclipse.jpt.doc.user/img/address_java_JPA_structure_quickstart.png b/jpa/plugins/org.eclipse.jpt.doc.user/img/address_java_JPA_structure_quickstart.png
deleted file mode 100644
index 1af51a9f9b..0000000000
--- a/jpa/plugins/org.eclipse.jpt.doc.user/img/address_java_JPA_structure_quickstart.png
+++ /dev/null
Binary files differ
diff --git a/jpa/plugins/org.eclipse.jpt.doc.user/img/create_jpa_entity_wizard.png b/jpa/plugins/org.eclipse.jpt.doc.user/img/create_jpa_entity_wizard.png
deleted file mode 100644
index 0360e0a86c..0000000000
--- a/jpa/plugins/org.eclipse.jpt.doc.user/img/create_jpa_entity_wizard.png
+++ /dev/null
Binary files differ
diff --git a/jpa/plugins/org.eclipse.jpt.doc.user/img/create_jpa_fields.png b/jpa/plugins/org.eclipse.jpt.doc.user/img/create_jpa_fields.png
deleted file mode 100644
index 69797a803c..0000000000
--- a/jpa/plugins/org.eclipse.jpt.doc.user/img/create_jpa_fields.png
+++ /dev/null
Binary files differ
diff --git a/jpa/plugins/org.eclipse.jpt.doc.user/img/customize_default_entity_generation.png b/jpa/plugins/org.eclipse.jpt.doc.user/img/customize_default_entity_generation.png
deleted file mode 100644
index 9567616b7c..0000000000
--- a/jpa/plugins/org.eclipse.jpt.doc.user/img/customize_default_entity_generation.png
+++ /dev/null
Binary files differ
diff --git a/jpa/plugins/org.eclipse.jpt.doc.user/img/customize_individual_entities.png b/jpa/plugins/org.eclipse.jpt.doc.user/img/customize_individual_entities.png
deleted file mode 100644
index 237bdee290..0000000000
--- a/jpa/plugins/org.eclipse.jpt.doc.user/img/customize_individual_entities.png
+++ /dev/null
Binary files differ
diff --git a/jpa/plugins/org.eclipse.jpt.doc.user/img/details_entitymappings.png b/jpa/plugins/org.eclipse.jpt.doc.user/img/details_entitymappings.png
deleted file mode 100644
index 5bd48850fd..0000000000
--- a/jpa/plugins/org.eclipse.jpt.doc.user/img/details_entitymappings.png
+++ /dev/null
Binary files differ
diff --git a/jpa/plugins/org.eclipse.jpt.doc.user/img/error_sample.png b/jpa/plugins/org.eclipse.jpt.doc.user/img/error_sample.png
deleted file mode 100644
index 3a4964632c..0000000000
--- a/jpa/plugins/org.eclipse.jpt.doc.user/img/error_sample.png
+++ /dev/null
Binary files differ
diff --git a/jpa/plugins/org.eclipse.jpt.doc.user/img/generate_entities.png b/jpa/plugins/org.eclipse.jpt.doc.user/img/generate_entities.png
deleted file mode 100644
index 4daa25c7c5..0000000000
--- a/jpa/plugins/org.eclipse.jpt.doc.user/img/generate_entities.png
+++ /dev/null
Binary files differ
diff --git a/jpa/plugins/org.eclipse.jpt.doc.user/img/icon_basicmapmappings.png b/jpa/plugins/org.eclipse.jpt.doc.user/img/icon_basicmapmappings.png
deleted file mode 100644
index 86eef3abe4..0000000000
--- a/jpa/plugins/org.eclipse.jpt.doc.user/img/icon_basicmapmappings.png
+++ /dev/null
Binary files differ
diff --git a/jpa/plugins/org.eclipse.jpt.doc.user/img/inheritance_join.png b/jpa/plugins/org.eclipse.jpt.doc.user/img/inheritance_join.png
deleted file mode 100644
index 22b6875f4d..0000000000
--- a/jpa/plugins/org.eclipse.jpt.doc.user/img/inheritance_join.png
+++ /dev/null
Binary files differ
diff --git a/jpa/plugins/org.eclipse.jpt.doc.user/img/inheritance_single.png b/jpa/plugins/org.eclipse.jpt.doc.user/img/inheritance_single.png
deleted file mode 100644
index 3146482609..0000000000
--- a/jpa/plugins/org.eclipse.jpt.doc.user/img/inheritance_single.png
+++ /dev/null
Binary files differ
diff --git a/jpa/plugins/org.eclipse.jpt.doc.user/img/inheritance_tab.png b/jpa/plugins/org.eclipse.jpt.doc.user/img/inheritance_tab.png
deleted file mode 100644
index b76dd9faf3..0000000000
--- a/jpa/plugins/org.eclipse.jpt.doc.user/img/inheritance_tab.png
+++ /dev/null
Binary files differ
diff --git a/jpa/plugins/org.eclipse.jpt.doc.user/img/java_editor_address.png b/jpa/plugins/org.eclipse.jpt.doc.user/img/java_editor_address.png
deleted file mode 100644
index 47428906e8..0000000000
--- a/jpa/plugins/org.eclipse.jpt.doc.user/img/java_editor_address.png
+++ /dev/null
Binary files differ
diff --git a/jpa/plugins/org.eclipse.jpt.doc.user/img/jpa_wizard_create_fields.png b/jpa/plugins/org.eclipse.jpt.doc.user/img/jpa_wizard_create_fields.png
deleted file mode 100644
index 30550ea033..0000000000
--- a/jpa/plugins/org.eclipse.jpt.doc.user/img/jpa_wizard_create_fields.png
+++ /dev/null
Binary files differ
diff --git a/jpa/plugins/org.eclipse.jpt.doc.user/img/mapped_entity_type_link.png b/jpa/plugins/org.eclipse.jpt.doc.user/img/mapped_entity_type_link.png
deleted file mode 100644
index 2b616033dd..0000000000
--- a/jpa/plugins/org.eclipse.jpt.doc.user/img/mapped_entity_type_link.png
+++ /dev/null
Binary files differ
diff --git a/jpa/plugins/org.eclipse.jpt.doc.user/img/mapping_file_new.png b/jpa/plugins/org.eclipse.jpt.doc.user/img/mapping_file_new.png
deleted file mode 100644
index 3355741af7..0000000000
--- a/jpa/plugins/org.eclipse.jpt.doc.user/img/mapping_file_new.png
+++ /dev/null
Binary files differ
diff --git a/jpa/plugins/org.eclipse.jpt.doc.user/img/mapping_type_selection_embed.png b/jpa/plugins/org.eclipse.jpt.doc.user/img/mapping_type_selection_embed.png
deleted file mode 100644
index fb3d1b263f..0000000000
--- a/jpa/plugins/org.eclipse.jpt.doc.user/img/mapping_type_selection_embed.png
+++ /dev/null
Binary files differ
diff --git a/jpa/plugins/org.eclipse.jpt.doc.user/img/mapping_type_selection_entity.png b/jpa/plugins/org.eclipse.jpt.doc.user/img/mapping_type_selection_entity.png
deleted file mode 100644
index 7a653db355..0000000000
--- a/jpa/plugins/org.eclipse.jpt.doc.user/img/mapping_type_selection_entity.png
+++ /dev/null
Binary files differ
diff --git a/jpa/plugins/org.eclipse.jpt.doc.user/img/mapping_type_selection_superclass.png b/jpa/plugins/org.eclipse.jpt.doc.user/img/mapping_type_selection_superclass.png
deleted file mode 100644
index 6ef54378f0..0000000000
--- a/jpa/plugins/org.eclipse.jpt.doc.user/img/mapping_type_selection_superclass.png
+++ /dev/null
Binary files differ
diff --git a/jpa/plugins/org.eclipse.jpt.doc.user/img/modify_faceted_project.png b/jpa/plugins/org.eclipse.jpt.doc.user/img/modify_faceted_project.png
deleted file mode 100644
index ad494d545a..0000000000
--- a/jpa/plugins/org.eclipse.jpt.doc.user/img/modify_faceted_project.png
+++ /dev/null
Binary files differ
diff --git a/jpa/plugins/org.eclipse.jpt.doc.user/img/new_icon_basicmappings.png b/jpa/plugins/org.eclipse.jpt.doc.user/img/new_icon_basicmappings.png
deleted file mode 100644
index 1b0b7ff4bd..0000000000
--- a/jpa/plugins/org.eclipse.jpt.doc.user/img/new_icon_basicmappings.png
+++ /dev/null
Binary files differ
diff --git a/jpa/plugins/org.eclipse.jpt.doc.user/img/new_icon_embeddableentitymapping.png b/jpa/plugins/org.eclipse.jpt.doc.user/img/new_icon_embeddableentitymapping.png
deleted file mode 100644
index 48294edaf6..0000000000
--- a/jpa/plugins/org.eclipse.jpt.doc.user/img/new_icon_embeddableentitymapping.png
+++ /dev/null
Binary files differ
diff --git a/jpa/plugins/org.eclipse.jpt.doc.user/img/new_icon_embeddedidmapping.png b/jpa/plugins/org.eclipse.jpt.doc.user/img/new_icon_embeddedidmapping.png
deleted file mode 100644
index abe9dc8d20..0000000000
--- a/jpa/plugins/org.eclipse.jpt.doc.user/img/new_icon_embeddedidmapping.png
+++ /dev/null
Binary files differ
diff --git a/jpa/plugins/org.eclipse.jpt.doc.user/img/new_icon_embeddedmapping.png b/jpa/plugins/org.eclipse.jpt.doc.user/img/new_icon_embeddedmapping.png
deleted file mode 100644
index 44d52b8bc4..0000000000
--- a/jpa/plugins/org.eclipse.jpt.doc.user/img/new_icon_embeddedmapping.png
+++ /dev/null
Binary files differ
diff --git a/jpa/plugins/org.eclipse.jpt.doc.user/img/new_icon_idmapping.png b/jpa/plugins/org.eclipse.jpt.doc.user/img/new_icon_idmapping.png
deleted file mode 100644
index fdefb5d781..0000000000
--- a/jpa/plugins/org.eclipse.jpt.doc.user/img/new_icon_idmapping.png
+++ /dev/null
Binary files differ
diff --git a/jpa/plugins/org.eclipse.jpt.doc.user/img/new_icon_manytomanymapping.png b/jpa/plugins/org.eclipse.jpt.doc.user/img/new_icon_manytomanymapping.png
deleted file mode 100644
index eb8022e16c..0000000000
--- a/jpa/plugins/org.eclipse.jpt.doc.user/img/new_icon_manytomanymapping.png
+++ /dev/null
Binary files differ
diff --git a/jpa/plugins/org.eclipse.jpt.doc.user/img/new_icon_manytoonemapping.png b/jpa/plugins/org.eclipse.jpt.doc.user/img/new_icon_manytoonemapping.png
deleted file mode 100644
index ccacc19f1e..0000000000
--- a/jpa/plugins/org.eclipse.jpt.doc.user/img/new_icon_manytoonemapping.png
+++ /dev/null
Binary files differ
diff --git a/jpa/plugins/org.eclipse.jpt.doc.user/img/new_icon_mappedentity.png b/jpa/plugins/org.eclipse.jpt.doc.user/img/new_icon_mappedentity.png
deleted file mode 100644
index 398ea2c11f..0000000000
--- a/jpa/plugins/org.eclipse.jpt.doc.user/img/new_icon_mappedentity.png
+++ /dev/null
Binary files differ
diff --git a/jpa/plugins/org.eclipse.jpt.doc.user/img/new_icon_mappedsuperclass.png b/jpa/plugins/org.eclipse.jpt.doc.user/img/new_icon_mappedsuperclass.png
deleted file mode 100644
index fc97ceb1fb..0000000000
--- a/jpa/plugins/org.eclipse.jpt.doc.user/img/new_icon_mappedsuperclass.png
+++ /dev/null
Binary files differ
diff --git a/jpa/plugins/org.eclipse.jpt.doc.user/img/new_icon_onetomanymapping.png b/jpa/plugins/org.eclipse.jpt.doc.user/img/new_icon_onetomanymapping.png
deleted file mode 100644
index 5ddc989dfd..0000000000
--- a/jpa/plugins/org.eclipse.jpt.doc.user/img/new_icon_onetomanymapping.png
+++ /dev/null
Binary files differ
diff --git a/jpa/plugins/org.eclipse.jpt.doc.user/img/new_icon_onetoonemapping.png b/jpa/plugins/org.eclipse.jpt.doc.user/img/new_icon_onetoonemapping.png
deleted file mode 100644
index 74d9bbd66c..0000000000
--- a/jpa/plugins/org.eclipse.jpt.doc.user/img/new_icon_onetoonemapping.png
+++ /dev/null
Binary files differ
diff --git a/jpa/plugins/org.eclipse.jpt.doc.user/img/new_icon_transientmapping.png b/jpa/plugins/org.eclipse.jpt.doc.user/img/new_icon_transientmapping.png
deleted file mode 100644
index 750488f49d..0000000000
--- a/jpa/plugins/org.eclipse.jpt.doc.user/img/new_icon_transientmapping.png
+++ /dev/null
Binary files differ
diff --git a/jpa/plugins/org.eclipse.jpt.doc.user/img/new_icon_versionmapping.png b/jpa/plugins/org.eclipse.jpt.doc.user/img/new_icon_versionmapping.png
deleted file mode 100644
index a87371215b..0000000000
--- a/jpa/plugins/org.eclipse.jpt.doc.user/img/new_icon_versionmapping.png
+++ /dev/null
Binary files differ
diff --git a/jpa/plugins/org.eclipse.jpt.doc.user/img/new_jpa_facet_task.png b/jpa/plugins/org.eclipse.jpt.doc.user/img/new_jpa_facet_task.png
deleted file mode 100644
index 7607808317..0000000000
--- a/jpa/plugins/org.eclipse.jpt.doc.user/img/new_jpa_facet_task.png
+++ /dev/null
Binary files differ
diff --git a/jpa/plugins/org.eclipse.jpt.doc.user/img/new_jpa_perspective_button.png b/jpa/plugins/org.eclipse.jpt.doc.user/img/new_jpa_perspective_button.png
deleted file mode 100644
index 07425ad08a..0000000000
--- a/jpa/plugins/org.eclipse.jpt.doc.user/img/new_jpa_perspective_button.png
+++ /dev/null
Binary files differ
diff --git a/jpa/plugins/org.eclipse.jpt.doc.user/img/new_jpa_project_task.png b/jpa/plugins/org.eclipse.jpt.doc.user/img/new_jpa_project_task.png
deleted file mode 100644
index 572f91d64f..0000000000
--- a/jpa/plugins/org.eclipse.jpt.doc.user/img/new_jpa_project_task.png
+++ /dev/null
Binary files differ
diff --git a/jpa/plugins/org.eclipse.jpt.doc.user/img/ngrelc.png b/jpa/plugins/org.eclipse.jpt.doc.user/img/ngrelc.png
deleted file mode 100644
index 88381a5a80..0000000000
--- a/jpa/plugins/org.eclipse.jpt.doc.user/img/ngrelc.png
+++ /dev/null
Binary files differ
diff --git a/jpa/plugins/org.eclipse.jpt.doc.user/img/ngrelr.png b/jpa/plugins/org.eclipse.jpt.doc.user/img/ngrelr.png
deleted file mode 100644
index 4bbc744806..0000000000
--- a/jpa/plugins/org.eclipse.jpt.doc.user/img/ngrelr.png
+++ /dev/null
Binary files differ
diff --git a/jpa/plugins/org.eclipse.jpt.doc.user/img/ngrelt.png b/jpa/plugins/org.eclipse.jpt.doc.user/img/ngrelt.png
deleted file mode 100644
index 60af21f5ea..0000000000
--- a/jpa/plugins/org.eclipse.jpt.doc.user/img/ngrelt.png
+++ /dev/null
Binary files differ
diff --git a/jpa/plugins/org.eclipse.jpt.doc.user/img/persistence_outline_view.png b/jpa/plugins/org.eclipse.jpt.doc.user/img/persistence_outline_view.png
deleted file mode 100644
index 769aa825e5..0000000000
--- a/jpa/plugins/org.eclipse.jpt.doc.user/img/persistence_outline_view.png
+++ /dev/null
Binary files differ
diff --git a/jpa/plugins/org.eclipse.jpt.doc.user/img/project_properties_tasks.png b/jpa/plugins/org.eclipse.jpt.doc.user/img/project_properties_tasks.png
deleted file mode 100644
index d40a88855f..0000000000
--- a/jpa/plugins/org.eclipse.jpt.doc.user/img/project_properties_tasks.png
+++ /dev/null
Binary files differ
diff --git a/jpa/plugins/org.eclipse.jpt.doc.user/img/quickstart_project.png b/jpa/plugins/org.eclipse.jpt.doc.user/img/quickstart_project.png
deleted file mode 100644
index 48ca05099b..0000000000
--- a/jpa/plugins/org.eclipse.jpt.doc.user/img/quickstart_project.png
+++ /dev/null
Binary files differ
diff --git a/jpa/plugins/org.eclipse.jpt.doc.user/img/secondary_tables.png b/jpa/plugins/org.eclipse.jpt.doc.user/img/secondary_tables.png
deleted file mode 100644
index a41f9f53ed..0000000000
--- a/jpa/plugins/org.eclipse.jpt.doc.user/img/secondary_tables.png
+++ /dev/null
Binary files differ
diff --git a/jpa/plugins/org.eclipse.jpt.doc.user/img/select_a_wizard_entity.png b/jpa/plugins/org.eclipse.jpt.doc.user/img/select_a_wizard_entity.png
deleted file mode 100644
index 2cebe90add..0000000000
--- a/jpa/plugins/org.eclipse.jpt.doc.user/img/select_a_wizard_entity.png
+++ /dev/null
Binary files differ
diff --git a/jpa/plugins/org.eclipse.jpt.doc.user/img/select_a_wizard_jpa_project.png b/jpa/plugins/org.eclipse.jpt.doc.user/img/select_a_wizard_jpa_project.png
deleted file mode 100644
index 182350246d..0000000000
--- a/jpa/plugins/org.eclipse.jpt.doc.user/img/select_a_wizard_jpa_project.png
+++ /dev/null
Binary files differ
diff --git a/jpa/plugins/org.eclipse.jpt.doc.user/img/select_a_wizard_mapping.png b/jpa/plugins/org.eclipse.jpt.doc.user/img/select_a_wizard_mapping.png
deleted file mode 100644
index 049c9d15b5..0000000000
--- a/jpa/plugins/org.eclipse.jpt.doc.user/img/select_a_wizard_mapping.png
+++ /dev/null
Binary files differ
diff --git a/jpa/plugins/org.eclipse.jpt.doc.user/img/select_tables.png b/jpa/plugins/org.eclipse.jpt.doc.user/img/select_tables.png
deleted file mode 100644
index a57c9314c7..0000000000
--- a/jpa/plugins/org.eclipse.jpt.doc.user/img/select_tables.png
+++ /dev/null
Binary files differ
diff --git a/jpa/plugins/org.eclipse.jpt.doc.user/img/synchornize_classes.png b/jpa/plugins/org.eclipse.jpt.doc.user/img/synchornize_classes.png
deleted file mode 100644
index a359f64651..0000000000
--- a/jpa/plugins/org.eclipse.jpt.doc.user/img/synchornize_classes.png
+++ /dev/null
Binary files differ
diff --git a/jpa/plugins/org.eclipse.jpt.doc.user/img/table_associations.png b/jpa/plugins/org.eclipse.jpt.doc.user/img/table_associations.png
deleted file mode 100644
index b5b40be797..0000000000
--- a/jpa/plugins/org.eclipse.jpt.doc.user/img/table_associations.png
+++ /dev/null
Binary files differ
diff --git a/jpa/plugins/org.eclipse.jpt.doc.user/img/table_entity.png b/jpa/plugins/org.eclipse.jpt.doc.user/img/table_entity.png
deleted file mode 100644
index 1aa1dbe059..0000000000
--- a/jpa/plugins/org.eclipse.jpt.doc.user/img/table_entity.png
+++ /dev/null
Binary files differ
diff --git a/jpa/plugins/org.eclipse.jpt.doc.user/img/task_entering_query.png b/jpa/plugins/org.eclipse.jpt.doc.user/img/task_entering_query.png
deleted file mode 100644
index f07bfb00ad..0000000000
--- a/jpa/plugins/org.eclipse.jpt.doc.user/img/task_entering_query.png
+++ /dev/null
Binary files differ
diff --git a/jpa/plugins/org.eclipse.jpt.doc.user/index.xml b/jpa/plugins/org.eclipse.jpt.doc.user/index.xml
deleted file mode 100644
index 86b7d103e3..0000000000
--- a/jpa/plugins/org.eclipse.jpt.doc.user/index.xml
+++ /dev/null
@@ -1,315 +0,0 @@
-<?xml version='1.0' encoding='iso-8859-1'?>
-<index version="1.0">
-<entry keyword="@Basic, Basic mapping"><topic href="tasks009.htm#sthref115" /></entry>
-<entry keyword="@Column, General information"><topic href="ref_mapping_general.htm#sthref230" /></entry>
- <entry keyword="@DiscriminatorColumn">
-<entry keyword="Specifying entity inheritance"><topic href="task_inheritance.htm#sthref95" /></entry>
-<entry keyword="Inheritance information"><topic href="reference009.htm#sthref224" /></entry>
- </entry>
- <entry keyword="@DiscriminatorValue">
-<entry keyword="Specifying entity inheritance"><topic href="task_inheritance.htm#sthref97" /></entry>
-<entry keyword="Inheritance information"><topic href="reference009.htm#sthref222" /></entry>
- </entry>
-<entry keyword="@Embeddable, Embeddable"><topic href="tasks006.htm#sthref80" /></entry>
-<entry keyword="@Embedded, Embedded mapping"><topic href="tasks010.htm#sthref119" /></entry>
-<entry keyword="@EmbeddedId, Embedded ID mapping"><topic href="tasks011.htm#sthref123" /></entry>
-<entry keyword="@Entity, Entity"><topic href="tasks005.htm#sthref73" /></entry>
-<entry keyword="@Enumerated, General information"><topic href="ref_mapping_general.htm#sthref240" /></entry>
-<entry keyword="@GeneratedValue, Primary Key Generation information"><topic href="ref_primary_key.htm#sthref249" /></entry>
-<entry keyword="@Id, ID mapping"><topic href="tasks012.htm#sthref127" /></entry>
-<entry keyword="@Inheritance, Specifying entity inheritance"><topic href="task_inheritance.htm#sthref93" /></entry>
- <entry keyword="@JoinColumn">
-<entry keyword="Many-to-one mapping"><topic href="tasks014.htm#sthref138" /></entry>
-<entry keyword="One-to-one mapping"><topic href="tasks016.htm#sthref148" /></entry>
-<entry keyword="Join Table Information"><topic href="reference011.htm#sthref245" /></entry>
-<entry keyword="Join Columns Information"><topic href="reference012.htm#sthref248" /></entry>
- </entry>
-<entry keyword="@Lob, General information"><topic href="ref_mapping_general.htm#sthref235" /></entry>
-<entry keyword="@ManyToMany, Many-to-many mapping"><topic href="tasks013.htm#sthref131" /></entry>
-<entry keyword="@ManyToOne, Many-to-one mapping"><topic href="tasks014.htm#sthref136" /></entry>
-<entry keyword="@MappedSuperclass, Mapped superclass"><topic href="tasks007.htm#sthref87" /></entry>
-<entry keyword="@NamedQuery, Creating Named Queries"><topic href="tasks008.htm#sthref107" /></entry>
-<entry keyword="@OneToMany, One-to-many mapping"><topic href="tasks015.htm#sthref141" /></entry>
-<entry keyword="@OneToOne, One-to-one mapping"><topic href="tasks016.htm#sthref145" /></entry>
-<entry keyword="@OrderBy, General information"><topic href="ref_mapping_general.htm#sthref243" /></entry>
-<entry keyword="@SequenceGenerator, Primary Key Generation information"><topic href="ref_primary_key.htm#sthref251" /></entry>
-<entry keyword="@Temporal, General information"><topic href="ref_mapping_general.htm#sthref237" /></entry>
-<entry keyword="@Transient, Transient mapping"><topic href="tasks017.htm#sthref151" /></entry>
-<entry keyword="@Version, Version mapping"><topic href="tasks018.htm#sthref155" /></entry>
-<entry keyword="architecture of Dali feature, Dali Developer Documentation"><topic href="reference032.htm#sthref283" /></entry>
-<entry keyword="association tables, Create New Association"><topic href="ref_create_new_association_wizard.htm#sthref206" /></entry>
-<entry keyword="attribute overrides, Attribute overrides"><topic href="reference007.htm#sthref213" /></entry>
-<entry keyword="Attribute Overrides - in Java Details view, Attribute overrides"><topic href="reference007.htm#sthref215" /></entry>
- <entry keyword="attributes">
-<entry keyword="JPA Details view, JPA Details view (for attributes)"><topic href="ref_persistence_map_view.htm#sthref229" /></entry>
-<entry keyword="mapping, Understanding OR mappings"><topic href="concept_mapping.htm#sthref21" /></entry>
- </entry>
- <entry keyword="basic mapping">
-<entry keyword="@Basic, Basic mapping"><topic href="tasks009.htm#sthref116" /></entry>
-<entry keyword="about, Basic mapping"><topic href="tasks009.htm#sthref114" /></entry>
- <entry keyword="(See also mappings)"></entry>
- </entry>
-<entry keyword="caching, Caching"><topic href="reference020.htm#sthref262" /></entry>
-<entry keyword="cardinality - association tables, Association Cardinality"><topic href="ref_association_cardinality.htm#sthref209" /></entry>
- <entry keyword="classes">
-<entry keyword="adding persistence to, Adding persistence to a class"><topic href="task_add_persistence.htm#sthref68" /></entry>
-<entry keyword="embeddable, Embeddable"><topic href="tasks006.htm#sthref79" /></entry>
-<entry keyword="entity, Entity"><topic href="tasks005.htm#sthref71" /></entry>
-<entry keyword="managed, Managing the persistence.xml file"><topic href="task_manage_persistence.htm#sthref50" /></entry>
-<entry keyword="managing persistent classes, JPA Facet page"><topic href="ref_jpa_facet.htm#sthref192" /></entry>
-<entry keyword="mapped superclass, Mapped superclass"><topic href="tasks007.htm#sthref85" /></entry>
-<entry keyword="synchronizing, Synchronizing classes"><topic href="tasks002.htm#sthref53" /></entry>
- </entry>
- <entry keyword="columns">
- <entry keyword="discriminator">
-<entry keyword="Specifying entity inheritance"><topic href="task_inheritance.htm#sthref96" /></entry>
-<entry keyword="Inheritance information"><topic href="reference009.htm#sthref225" /></entry>
- </entry>
- <entry keyword="join">
-<entry keyword="Many-to-one mapping"><topic href="tasks014.htm#sthref137" /></entry>
-<entry keyword="One-to-one mapping"><topic href="tasks016.htm#sthref147" /></entry>
-<entry keyword="Join Table Information"><topic href="reference011.htm#sthref244" /></entry>
-<entry keyword="Join Columns Information"><topic href="reference012.htm#sthref247" /></entry>
- </entry>
-<entry keyword="mapping to, General information"><topic href="ref_mapping_general.htm#sthref231" /></entry>
- <entry keyword="value">
-<entry keyword="Specifying entity inheritance"><topic href="task_inheritance.htm#sthref98" /></entry>
-<entry keyword="Inheritance information"><topic href="reference009.htm#sthref223" /></entry>
- </entry>
- </entry>
-<entry keyword="connection pool, Managing the persistence.xml file"><topic href="task_manage_persistence.htm#sthref52" /></entry>
-<entry keyword="converting Java project to JPA, Converting a Java Project to a JPA Project"><topic href="tasks001.htm#sthref37" /></entry>
-<entry keyword="Create a JPA Project Wizard, Creating a new JPA project"><topic href="task_create_new_project.htm#sthref29" /></entry>
-<entry keyword="Create New JPA Project wizard, Create New JPA Project wizard"><topic href="ref_new_jpa_project_wizard.htm#sthref189" /></entry>
- <entry keyword="database tables">
-<entry keyword="generating entities from, Generating entities from tables"><topic href="tasks019.htm#sthref160" /></entry>
- </entry>
- <entry keyword="database - persistence">
-<entry keyword="connection, Project Properties page - Java Persistence Options"><topic href="ref_project_properties.htm#sthref275" /></entry>
-<entry keyword="schema, Project Properties page - Java Persistence Options"><topic href="ref_project_properties.htm#sthref277" /></entry>
- </entry>
-<entry keyword="developer documentation - Dali, Dali Developer Documentation"><topic href="reference032.htm#sthref282" /></entry>
-<entry keyword="eager fetch, General information"><topic href="ref_mapping_general.htm#sthref233" /></entry>
-<entry keyword="EclipseLink XML mapping file, Managing the persistence.xml file"><topic href="task_manage_persistence.htm#sthref51" /></entry>
- <entry keyword="embeddable class">
-<entry keyword="@Embeddable, Embeddable"><topic href="tasks006.htm#sthref81" /></entry>
-<entry keyword="about, Embeddable"><topic href="tasks006.htm#sthref78" /></entry>
- </entry>
- <entry keyword="embedded ID mapping">
-<entry keyword="@EmbeddedId, Embedded ID mapping"><topic href="tasks011.htm#sthref124" /></entry>
-<entry keyword="about, Embedded ID mapping"><topic href="tasks011.htm#sthref122" /></entry>
- </entry>
- <entry keyword="embedded mapping">
-<entry keyword="@Embedded, Embedded mapping"><topic href="tasks010.htm#sthref120" /></entry>
-<entry keyword="about, Embedded mapping"><topic href="tasks010.htm#sthref118" /></entry>
- </entry>
- <entry keyword="entities">
-<entry keyword="@Entity annotation, Entity"><topic href="tasks005.htm#sthref74" /></entry>
-<entry keyword="about, Understanding Java persistence"><topic href="concept_persistence.htm#sthref20" /></entry>
-<entry keyword="creating, Creating a JPA Entity"><topic href="task_create_jpa_entity.htm#sthref40" /></entry>
-<entry keyword="customizing, Customize Individual Entities"><topic href="ref_customizIndividualEntities.htm#sthref205" /></entry>
-<entry keyword="embeddable, Embeddable"><topic href="tasks006.htm#sthref82" /></entry>
- <entry keyword="from tables">
-<entry keyword="Generating entities from tables"><topic href="tasks019.htm#sthref157" /></entry>
-<entry keyword="Select Tables"><topic href="ref_selectTables.htm#sthref201" /></entry>
- </entry>
-<entry keyword="generating, Customize Default Entity Generation"><topic href="ref_customizeDefaultEntityGeneration.htm#sthref204" /></entry>
-<entry keyword="JPA Details view, JPA Details view (for entities)"><topic href="ref_persistence_prop_view.htm#sthref212" /></entry>
-<entry keyword="mapped superclass, Mapped superclass"><topic href="tasks007.htm#sthref88" /></entry>
-<entry keyword="mapping, Creating a Java persistent entity with persistent fields"><topic href="getting_started004.htm#sthref13" /></entry>
-<entry keyword="persistence, Creating a Java persistent entity with persistent fields"><topic href="getting_started004.htm#sthref11" /></entry>
- <entry keyword="persistent">
-<entry keyword="Entity"><topic href="tasks005.htm#sthref69" /></entry>
-<entry keyword="Entity"><topic href="tasks005.htm#sthref75" /></entry>
- </entry>
-<entry keyword="secondary tables, Secondary table information"><topic href="reference008.htm#sthref218" /></entry>
- </entry>
-<entry keyword="Entity Class page, Selecting the Create a JPA Entity Wizard"><topic href="task_create_jpa_entity.htm#sthref43" /></entry>
-<entry keyword="Entity Properties page, &lt;a id=&quot;sthref43&quot; name=&quot;sthref43&quot;&gt;&lt;/a&gt;The Entity Class Page"><topic href="task_create_jpa_entity.htm#sthref45" /></entry>
- <entry keyword="enumerated">
-<entry keyword="General information"><topic href="ref_mapping_general.htm#sthref239" /></entry>
-<entry keyword="General information"><topic href="ref_mapping_general.htm#sthref241" /></entry>
- </entry>
- <entry keyword="error messages - Dali">
-<entry keyword="Validating mappings and reporting problems"><topic href="tasks021.htm#sthref166" /></entry>
-<entry keyword="Error messages"><topic href="tasks022.htm#sthref171" /></entry>
- </entry>
-<entry keyword="extension points - Dali feature, Dali Developer Documentation"><topic href="reference032.htm#sthref284" /></entry>
-<entry keyword="fetch type, General information"><topic href="ref_mapping_general.htm#sthref232" /></entry>
- <entry keyword="Generate Entities from Tables dialog">
-<entry keyword="Generating entities from tables"><topic href="tasks019.htm#sthref159" /></entry>
-<entry keyword="Select Tables"><topic href="ref_selectTables.htm#sthref200" /></entry>
- </entry>
- <entry keyword="generated values">
-<entry keyword="ID mappings, Primary Key Generation information"><topic href="ref_primary_key.htm#sthref250" /></entry>
-<entry keyword="sequence, Primary Key Generation information"><topic href="ref_primary_key.htm#sthref252" /></entry>
- </entry>
-<entry keyword="hints - query, Creating Named Queries"><topic href="tasks008.htm#sthref109" /></entry>
- <entry keyword="ID mapping">
-<entry keyword="@Id, ID mapping"><topic href="tasks012.htm#sthref128" /></entry>
-<entry keyword="about, ID mapping"><topic href="tasks012.htm#sthref126" /></entry>
- </entry>
- <entry keyword="inheritance">
- <entry keyword="entity">
-<entry keyword="Specifying entity inheritance"><topic href="task_inheritance.htm#sthref92" /></entry>
-<entry keyword="Entity Class page"><topic href="ref_EntityClassPage.htm#sthref194" /></entry>
-<entry keyword="Inheritance information"><topic href="reference009.htm#sthref221" /></entry>
- </entry>
-<entry keyword="joined tables, Single Table Inheritance"><topic href="task_inheritance.htm#sthref104" /></entry>
-<entry keyword="single table, Specifying entity inheritance"><topic href="task_inheritance.htm#sthref99" /></entry>
- </entry>
-<entry keyword="Inheritance - in Java Details view, Inheritance information"><topic href="reference009.htm#sthref220" /></entry>
-<entry keyword="installation - Dali, Requirements and installation"><topic href="getting_started001.htm#sthref3" /></entry>
-<entry keyword="Java project - converting to JPA, Converting a Java Project to a JPA Project"><topic href="tasks001.htm#sthref35" /></entry>
- <entry keyword="join columns">
-<entry keyword="Join Columns"><topic href="ref_join_columns.htm#sthref208" /></entry>
-<entry keyword="Join Columns Information"><topic href="reference012.htm#sthref246" /></entry>
- </entry>
-<entry keyword="joined tables - inheritance, Single Table Inheritance"><topic href="task_inheritance.htm#sthref105" /></entry>
- <entry keyword="JPA Details view">
-<entry keyword="attributes, JPA Details view (for attributes)"><topic href="ref_persistence_map_view.htm#sthref227" /></entry>
-<entry keyword="entities, JPA Details view (for entities)"><topic href="ref_persistence_prop_view.htm#sthref210" /></entry>
- </entry>
-<entry keyword="JPA Development perspective, JPA Development perspective"><topic href="ref_persistence_perspective.htm#sthref280" /></entry>
-<entry keyword="JPA Facet page, The Java Source Page"><topic href="task_create_new_project.htm#sthref34" /></entry>
- <entry keyword="JPA project">
-<entry keyword="converting from Java, Converting a Java Project to a JPA Project"><topic href="tasks001.htm#sthref36" /></entry>
-<entry keyword="creating new, Creating a new JPA project"><topic href="task_create_new_project.htm#sthref27" /></entry>
-<entry keyword="implementation, JPA Facet page"><topic href="ref_jpa_facet.htm#sthref190" /></entry>
-<entry keyword="page, &lt;a id=&quot;sthref29&quot; name=&quot;sthref29&quot;&gt;&lt;/a&gt;Selecting the Create a JPA Project wizard"><topic href="task_create_new_project.htm#sthref31" /></entry>
-<entry keyword="platform, Project Properties page - Java Persistence Options"><topic href="ref_project_properties.htm#sthref274" /></entry>
- </entry>
-<entry keyword="JPA Structure view, JPA Structure view"><topic href="ref_persistence_outline.htm#sthref254" /></entry>
-<entry keyword="lazy fetch, General information"><topic href="ref_mapping_general.htm#sthref234" /></entry>
-<entry keyword="library - JPA, JPA Facet page"><topic href="ref_jpa_facet.htm#sthref191" /></entry>
- <entry keyword="many-to-many mapping">
-<entry keyword="@ManyToMany, Many-to-many mapping"><topic href="tasks013.htm#sthref132" /></entry>
-<entry keyword="about, Many-to-many mapping"><topic href="tasks013.htm#sthref130" /></entry>
- </entry>
- <entry keyword="many-to-one mapping">
-<entry keyword="@ManyToOne, Many-to-one mapping"><topic href="tasks014.htm#sthref135" /></entry>
-<entry keyword="about, Many-to-one mapping"><topic href="tasks014.htm#sthref134" /></entry>
- </entry>
- <entry keyword="mapped superclass">
-<entry keyword="@MappedSuperclass, Mapped superclass"><topic href="tasks007.htm#sthref86" /></entry>
-<entry keyword="about, Mapped superclass"><topic href="tasks007.htm#sthref84" /></entry>
- </entry>
-<entry keyword="mapping entities, Creating a Java persistent entity with persistent fields"><topic href="getting_started004.htm#sthref12" /></entry>
- <entry keyword="mapping file">
-<entry keyword="&lt;a id=&quot;sthref57&quot; name=&quot;sthref57&quot;&gt;&lt;/a&gt;Managing the orm.xml file"><topic href="tasks003.htm#sthref60" /></entry>
-<entry keyword="Entity Class page"><topic href="ref_EntityClassPage.htm#sthref195" /></entry>
- </entry>
- <entry keyword="mappings">
-<entry keyword="about, Understanding OR mappings"><topic href="concept_mapping.htm#sthref22" /></entry>
-<entry keyword="basic, Basic mapping"><topic href="tasks009.htm#sthref113" /></entry>
-<entry keyword="embedded, Embedded mapping"><topic href="tasks010.htm#sthref117" /></entry>
-<entry keyword="embedded ID, Embedded ID mapping"><topic href="tasks011.htm#sthref121" /></entry>
-<entry keyword="ID, ID mapping"><topic href="tasks012.htm#sthref125" /></entry>
-<entry keyword="many-to-many, Many-to-many mapping"><topic href="tasks013.htm#sthref129" /></entry>
-<entry keyword="many-to-one, Many-to-one mapping"><topic href="tasks014.htm#sthref133" /></entry>
-<entry keyword="one-to-many, One-to-many mapping"><topic href="tasks015.htm#sthref139" /></entry>
-<entry keyword="one-to-one, One-to-one mapping"><topic href="tasks016.htm#sthref143" /></entry>
-<entry keyword="problems, Validating mappings and reporting problems"><topic href="tasks021.htm#sthref169" /></entry>
-<entry keyword="transient, Transient mapping"><topic href="tasks017.htm#sthref149" /></entry>
-<entry keyword="version, Version mapping"><topic href="tasks018.htm#sthref153" /></entry>
- </entry>
- <entry keyword="named queries">
-<entry keyword="entity, Creating Named Queries"><topic href="tasks008.htm#sthref106" /></entry>
-<entry keyword="hints, Creating Named Queries"><topic href="tasks008.htm#sthref110" /></entry>
- </entry>
-<entry keyword="native queries, Creating Named Queries"><topic href="tasks008.htm#sthref111" /></entry>
- <entry keyword="nonpersistent">
-<entry keyword="classes, Adding persistence to a class"><topic href="task_add_persistence.htm#sthref67" /></entry>
- <entry keyword="fields. See transient"></entry>
- </entry>
- <entry keyword="one-to-many mapping">
-<entry keyword="@OneToMany, One-to-many mapping"><topic href="tasks015.htm#sthref142" /></entry>
-<entry keyword="about, One-to-many mapping"><topic href="tasks015.htm#sthref140" /></entry>
- </entry>
- <entry keyword="one-to-one mapping">
-<entry keyword="@OneToOne, One-to-one mapping"><topic href="tasks016.htm#sthref146" /></entry>
-<entry keyword="about, One-to-one mapping"><topic href="tasks016.htm#sthref144" /></entry>
- </entry>
-<entry keyword="ordering, General information"><topic href="ref_mapping_general.htm#sthref242" /></entry>
- <entry keyword="orm.xml file">
-<entry keyword="about, The orm.xml file"><topic href="concepts003.htm#sthref24" /></entry>
-<entry keyword="creating, JPA Facet page"><topic href="ref_jpa_facet.htm#sthref193" /></entry>
-<entry keyword="managing, Managing the orm.xml file"><topic href="task_manage_orm.htm#sthref57" /></entry>
-<entry keyword="sample, Managing the orm.xml file"><topic href="task_manage_orm.htm#sthref58" /></entry>
- </entry>
-<entry keyword="overrides - JPA attributes, Attribute overrides"><topic href="reference007.htm#sthref214" /></entry>
- <entry keyword="persistence">
-<entry keyword="about, Understanding Java persistence"><topic href="concept_persistence.htm#sthref19" /></entry>
-<entry keyword="database connection, Project Properties page - Java Persistence Options"><topic href="ref_project_properties.htm#sthref276" /></entry>
-<entry keyword="database schema, Project Properties page - Java Persistence Options"><topic href="ref_project_properties.htm#sthref279" /></entry>
-<entry keyword="entity class, Adding persistence to a class"><topic href="task_add_persistence.htm#sthref66" /></entry>
-<entry keyword="options, Project Properties page - Java Persistence Options"><topic href="ref_project_properties.htm#sthref271" /></entry>
-<entry keyword="provider, Managing the persistence.xml file"><topic href="task_manage_persistence.htm#sthref49" /></entry>
- </entry>
- <entry keyword="persistence.xml file">
-<entry keyword="about, The persistence.xml file"><topic href="concepts002.htm#sthref23" /></entry>
- <entry keyword="managing">
-<entry keyword="Managing the persistence.xml file"><topic href="task_manage_persistence.htm#sthref47" /></entry>
-<entry keyword="Working with orm.xml file"><topic href="tasks004.htm#sthref64" /></entry>
- </entry>
-<entry keyword="sample, Managing the persistence.xml file"><topic href="task_manage_persistence.htm#sthref48" /></entry>
-<entry keyword="synchronizing with classes, Synchronizing classes"><topic href="tasks002.htm#sthref54" /></entry>
- </entry>
-<entry keyword="persistent entity, Entity"><topic href="tasks005.htm#sthref70" /></entry>
-<entry keyword="perspective - JPA Development, JPA Development perspective"><topic href="ref_persistence_perspective.htm#sthref281" /></entry>
-<entry keyword="platform - JPA, Project Properties page - Java Persistence Options"><topic href="ref_project_properties.htm#sthref273" /></entry>
-<entry keyword="problems, Validating mappings and reporting problems"><topic href="tasks021.htm#sthref168" /></entry>
- <entry keyword="projects - JPA">
- <entry keyword="creating new">
-<entry keyword="Creating a new JPA project"><topic href="getting_started003.htm#sthref9" /></entry>
-<entry keyword="Creating a new JPA project"><topic href="task_create_new_project.htm#sthref26" /></entry>
- </entry>
-<entry keyword="options, Project Properties page - Java Persistence Options"><topic href="ref_project_properties.htm#sthref272" /></entry>
- </entry>
-<entry keyword="query hints, Creating Named Queries"><topic href="tasks008.htm#sthref108" /></entry>
-<entry keyword="quick start - Dali, Dali quick start"><topic href="getting_started002.htm#sthref8" /></entry>
- <entry keyword="requirements">
-<entry keyword="Dali Java Persistence Tools, Requirements and installation"><topic href="getting_started001.htm#sthref4" /></entry>
-<entry keyword="persistent entities, Entity"><topic href="tasks005.htm#sthref72" /></entry>
- </entry>
-<entry keyword="schema - database, Project Properties page - Java Persistence Options"><topic href="ref_project_properties.htm#sthref278" /></entry>
-<entry keyword="secondary tables, Secondary table information"><topic href="reference008.htm#sthref216" /></entry>
-<entry keyword="Secondary Tables - in Java Details view, Secondary table information"><topic href="reference008.htm#sthref219" /></entry>
-<entry keyword="single table inheritance, Specifying entity inheritance"><topic href="task_inheritance.htm#sthref100" /></entry>
-<entry keyword="superclass, Mapped superclass"><topic href="tasks007.htm#sthref89" /></entry>
-<entry keyword="synchronizing classes with persistence.xml file, Synchronizing classes"><topic href="tasks002.htm#sthref55" /></entry>
- <entry keyword="tables">
- <entry keyword="associations">
-<entry keyword="Table Associations"><topic href="ref_tableAssociations.htm#sthref203" /></entry>
-<entry keyword="Create New Association"><topic href="ref_create_new_association_wizard.htm#sthref207" /></entry>
- </entry>
- <entry keyword="creating entities from">
-<entry keyword="Generating entities from tables"><topic href="tasks019.htm#sthref158" /></entry>
-<entry keyword="Select Tables"><topic href="ref_selectTables.htm#sthref202" /></entry>
- </entry>
-<entry keyword="inheritance, Specifying entity inheritance"><topic href="task_inheritance.htm#sthref101" /></entry>
-<entry keyword="secondary, Secondary table information"><topic href="reference008.htm#sthref217" /></entry>
- </entry>
- <entry keyword="temporal">
-<entry keyword="General information"><topic href="ref_mapping_general.htm#sthref236" /></entry>
-<entry keyword="General information"><topic href="ref_mapping_general.htm#sthref238" /></entry>
- </entry>
- <entry keyword="transient mapping">
-<entry keyword="@Transient, Transient mapping"><topic href="tasks017.htm#sthref152" /></entry>
-<entry keyword="about, Transient mapping"><topic href="tasks017.htm#sthref150" /></entry>
- </entry>
- <entry keyword="version mapping">
-<entry keyword="@Version, Version mapping"><topic href="tasks018.htm#sthref156" /></entry>
-<entry keyword="about, Version mapping"><topic href="tasks018.htm#sthref154" /></entry>
- </entry>
- <entry keyword="views">
- <entry keyword="JPA Details view">
-<entry keyword="JPA Details view (for entities)"><topic href="ref_persistence_prop_view.htm#sthref211" /></entry>
-<entry keyword="JPA Details view (for attributes)"><topic href="ref_persistence_map_view.htm#sthref228" /></entry>
- </entry>
-<entry keyword="JPA Structure view, JPA Structure view"><topic href="ref_persistence_outline.htm#sthref253" /></entry>
- </entry>
-<entry keyword="warning messages - Dali, Validating mappings and reporting problems"><topic href="tasks021.htm#sthref167" /></entry>
-<entry keyword="Web Tools Platform (WTP), Requirements and installation"><topic href="getting_started001.htm#sthref5" /></entry>
-<entry keyword="XML editor, Working with orm.xml file"><topic href="tasks004.htm#sthref63" /></entry>
-</index> \ No newline at end of file
diff --git a/jpa/plugins/org.eclipse.jpt.doc.user/legal.htm b/jpa/plugins/org.eclipse.jpt.doc.user/legal.htm
deleted file mode 100644
index 0ebdba1a70..0000000000
--- a/jpa/plugins/org.eclipse.jpt.doc.user/legal.htm
+++ /dev/null
@@ -1,40 +0,0 @@
-<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN"
- "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
-<html xmlns="http://www.w3.org/1999/xhtml" xml:lang="en" lang="en">
-<head>
-<meta http-equiv="Content-Type" content="text/html; charset=us-ascii" />
-
-<meta http-equiv="Content-Style-Type" content="text/css" />
-<meta http-equiv="Content-Script-Type" content="text/javascript" />
-<title>Legal</title>
-<meta name="generator" content="Oracle DARB XHTML Converter (Mode = ohj/ohw) - Version 5.1.1 Build 004" />
-<meta name="date" content="2009-05-01T8:12:54Z" />
-<meta name="robots" content="noarchive" />
-<meta name="doctitle" content=" Legal" />
-<meta name="relnum" content="Release 2.2" />
-<meta name="copyright" content="Copyright (c) 2000, 2008 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. Contributors: Oracle - initial API and implementation" />
-<link rel="copyright" href="dcommon/html/cpyr.htm" title="Copyright" type="text/html" />
-<link rel="stylesheet" href="dcommon/css/blafdoc.css" title="Oracle BLAFDoc" type="text/css" />
-<!-- contents -->
-</head>
-<body>
-<p><a id="sthref287" name="sthref287"></a></p>
-<h1>Legal</h1>
-<p>Copyright &copy; 2006, 2009, Oracle. All rights reserved.</p>
-<p>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:</p>
-<p><code><a href="http://www.eclipse.org/legal/epl-v10.html">http://www.eclipse.org/legal/epl-v10.html</a></code></p>
-<p><a href="about.htm">Terms and conditions regarding the use of this guide.</a></p>
-<!-- Start Footer -->
-<div class="footer">
-<table class="simple oac_no_warn" summary="" cellspacing="0" cellpadding="0" width="100%">
-<col width="86%" />
-<col width="*" />
-<tr>
-<td align="left"><span class="copyrightlogo">Copyright&nbsp;&copy;&nbsp;2006, 2009,&nbsp;Oracle&nbsp;and/or&nbsp;its&nbsp;affiliates.&nbsp;All&nbsp;rights&nbsp;reserved.</span><br />
-<a href="dcommon/html/cpyr.htm"><span class="copyrightlogo">Legal Notices</span></a></td>
-</tr>
-</table>
-</div>
-<!-- class="footer" -->
-</body>
-</html>
diff --git a/jpa/plugins/org.eclipse.jpt.doc.user/plugin.properties b/jpa/plugins/org.eclipse.jpt.doc.user/plugin.properties
deleted file mode 100644
index 865c0824a8..0000000000
--- a/jpa/plugins/org.eclipse.jpt.doc.user/plugin.properties
+++ /dev/null
@@ -1,32 +0,0 @@
-###############################################################################
-# Copyright (c) 2007 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
-#
-# Contributors:
-# Oracle. - initial API and implementation
-###############################################################################
-# ====================================================================
-# To code developer:
-# Do NOT change the properties between this line and the
-# "%%% END OF TRANSLATED PROPERTIES %%%" line.
-# Make a new property name, append to the end of the file and change
-# the code to use the new property.
-# ====================================================================
-
-# ====================================================================
-# %%% END OF TRANSLATED PROPERTIES %%%
-# ====================================================================
-
-pluginName = Java Persistence Documentation - Doc
-providerName = Eclipse.org
-
-jpaDevelopment=JPA Development
-createAJpaProject=Create a JPA project
-createAJpaProjectDescription=This cheat sheet helps you create a JPA project.
-createAPersistentEntity=Create a persistent entity
-createAPersistentEntityDescription=This cheat sheet helps you create a Java persistent entity.
-MapAPersistentEntity=Map a persistent entity
-MapAPersistentEntityDescription=This cheat sheet helps you map the a Java persistent entity to a database table.
diff --git a/jpa/plugins/org.eclipse.jpt.doc.user/plugin.xml b/jpa/plugins/org.eclipse.jpt.doc.user/plugin.xml
deleted file mode 100644
index 516d3e1a71..0000000000
--- a/jpa/plugins/org.eclipse.jpt.doc.user/plugin.xml
+++ /dev/null
@@ -1,37 +0,0 @@
-<?xml version="1.0" encoding="UTF-8"?>
-<?eclipse version="3.0"?>
-<plugin>
- <!-- =========== -->
- <!-- Define TOC -->
- <!-- =========== -->
- <extension point="org.eclipse.help.toc">
- <toc file="toc.xml" primary="true"/>
- </extension>
- <!-- =========== -->
- <!-- Define F1 -->
- <!-- =========== -->
- <extension point="org.eclipse.help.contexts">
- <contexts file="contexts.xml" plugin="org.eclipse.jpt.ui"/>
- </extension>
- <!-- ==================== -->
- <!-- Define Keyword Index -->
- <!-- ==================== -->
- <extension point="org.eclipse.help.index">
- <index file="index.xml"/>
- </extension>
- <!-- =========== -->
- <!-- Cheatsheets -->
- <!-- =========== -->
- <extension point="org.eclipse.ui.cheatsheets.cheatSheetContent">
- <category name="JPA Development" id="com.jpa.category"/>
- <cheatsheet name="%createAJpaProject" category="com.jpa.category" contentFile="$nl$/cheatsheets/add_persistence.xml" id="org.eclipse.jpa.cheatsheet.createproject1">
- <description>%createAJpaProjectDescription</description>
- </cheatsheet>
- <cheatsheet name="%createAPersistentEntity" category="com.jpa.category" contentFile="$nl$/cheatsheets/create_entity.xml" id="org.eclipse.jpa.cheatsheet.addentity">
- <description>%createAPersistentEntityDescription</description>
- </cheatsheet>
- <cheatsheet name="%MapAPersistentEntity" category="com.jpa.category" contentFile="$nl$/cheatsheets/map_entity.xml" id="org.eclipse.jpa.cheatsheet.mapentity">
- <description>%MapAPersistentEntityDescription</description>
- </cheatsheet>
- </extension>
-</plugin>
diff --git a/jpa/plugins/org.eclipse.jpt.doc.user/ref_EntityClassPage.htm b/jpa/plugins/org.eclipse.jpt.doc.user/ref_EntityClassPage.htm
deleted file mode 100644
index a1a22ceca2..0000000000
--- a/jpa/plugins/org.eclipse.jpt.doc.user/ref_EntityClassPage.htm
+++ /dev/null
@@ -1,115 +0,0 @@
-<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN"
- "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
-<html xmlns="http://www.w3.org/1999/xhtml" xml:lang="en" lang="en">
-<head>
-<meta http-equiv="Content-Type" content="text/html; charset=us-ascii" />
-
-<meta http-equiv="Content-Style-Type" content="text/css" />
-<meta http-equiv="Content-Script-Type" content="text/javascript" />
-<title>Entity Class page</title>
-<meta name="generator" content="Oracle DARB XHTML Converter (Mode = ohj/ohw) - Version 5.1.1 Build 004" />
-<meta name="date" content="2009-05-01T8:12:49Z" />
-<meta name="robots" content="noarchive" />
-<meta name="doctitle" content="Entity Class page" />
-<meta name="relnum" content="Release 2.2" />
-<meta name="copyright" content="Copyright (c) 2000, 2008 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. Contributors: Oracle - initial API and implementation" />
-<link rel="copyright" href="dcommon/html/cpyr.htm" title="Copyright" type="text/html" />
-<link rel="stylesheet" href="dcommon/css/blafdoc.css" title="Oracle BLAFDoc" type="text/css" />
-<!-- contents -->
-</head>
-<body>
-<p><a id="CIAFEIGF" name="CIAFEIGF"></a></p>
-<div class="sect3"><!-- infolevel="all" infotype="General" -->
-<h1>Entity Class page</h1>
-<p>This table lists the properties of the Entity Class page of the <a href="ref_create_jpa_entity_wizard.htm#CIAGGGDF">Create JPA Entity wizard</a>.</p>
-<div class="inftblruleinformal">
-<table class="RuleInformal" summary="This table lists the properties of the Entity Class page of the Create JPA Entity wizard." dir="ltr" border="1" width="100%" frame="border" rules="all" cellpadding="3" cellspacing="0">
-<col width="22%" />
-<col width="*" />
-<col width="17%" />
-<thead>
-<tr align="left" valign="top">
-<th align="left" valign="bottom" id="r1c1-t5">Property</th>
-<th align="left" valign="bottom" id="r1c2-t5">Description</th>
-<th align="left" valign="bottom" id="r1c3-t5">Default</th>
-</tr>
-</thead>
-<tbody>
-<tr align="left" valign="top">
-<td align="left" id="r2c1-t5" headers="r1c1-t5">Project</td>
-<td align="left" headers="r2c1-t5 r1c2-t5">The name of the JPA project.</td>
-<td align="left" headers="r2c1-t5 r1c3-t5"><br /></td>
-</tr>
-<tr align="left" valign="top">
-<td align="left" id="r3c1-t5" headers="r1c1-t5">Source Folder</td>
-<td align="left" headers="r3c1-t5 r1c2-t5">The location of the JPA project's src folder.</td>
-<td align="left" headers="r3c1-t5 r1c3-t5"><br /></td>
-</tr>
-<tr align="left" valign="top">
-<td align="left" id="r4c1-t5" headers="r1c1-t5">Java Package</td>
-<td align="left" headers="r4c1-t5 r1c2-t5">The name of the class package.</td>
-<td align="left" headers="r4c1-t5 r1c3-t5"><br /></td>
-</tr>
-<tr align="left" valign="top">
-<td align="left" id="r5c1-t5" headers="r1c1-t5">Class name</td>
-<td align="left" headers="r5c1-t5 r1c2-t5">The name of the Java class.</td>
-<td align="left" headers="r5c1-t5 r1c3-t5"><br /></td>
-</tr>
-<tr align="left" valign="top">
-<td align="left" id="r6c1-t5" headers="r1c1-t5">Superclass</td>
-<td align="left" headers="r6c1-t5 r1c2-t5">Select the superclass.</td>
-<td align="left" headers="r6c1-t5 r1c3-t5"><br /></td>
-</tr>
-<tr align="left" valign="top">
-<td align="left" id="r7c1-t5" headers="r1c1-t5"><a id="sthref194" name="sthref194"></a>Inheritance</td>
-<td align="left" headers="r7c1-t5 r1c2-t5">Because the wizard creates a Java class with an <code>@Entity</code> notation, the <span class="bold">Entity</span> option is selected by default.
-<p>Select <span class="bold">Mapped Superclass</span> if you defined a superclass.</p>
-<p>To add an <code>@Inheritance</code> notation to the entity, select <span class="bold">Inheritance</span> and then select one of the inheritance mapping strategies (described in JSR 220):</p>
-<ul>
-<li>
-<p>SINGLE_TABLE -- All classes in a hierarchy as mapped to a single table. This annotation is without an attribute for the inheritance strategy.</p>
-</li>
-<li>
-<p>TABLE_PER_CLASS -- Each class is mapped to a separate table.</p>
-</li>
-<li>
-<p>JOINED -- The root of the class hierarchy is represented by a single table. Each subclass is represented by a separate table that contains those fields that are specific to the subclass (not inherited from its superclass), as well as the column(s) that represent its primary key. The primary key column(s) of the subclass table serves as a foreign key to the primary key of the superclass table.</p>
-</li>
-</ul>
-</td>
-<td align="left" headers="r7c1-t5 r1c3-t5">Entity</td>
-</tr>
-<tr align="left" valign="top">
-<td align="left" id="r8c1-t5" headers="r1c1-t5"><a id="sthref195" name="sthref195"></a>XML Entity Mappings</td>
-<td align="left" headers="r8c1-t5 r1c2-t5">Select <span class="bold">Add to entity mappings in XML</span> to create XML mappings in <code>orm.xml</code>, rather than annotations.
-<p>Use the <span class="bold">Mapping file</span> field to specify the file to use. By default, mappings are stored in the <code>META-INF/orm.xml</code> file.</p>
-</td>
-<td align="left" headers="r8c1-t5 r1c3-t5"><br /></td>
-</tr>
-</tbody>
-</table>
-<br /></div>
-<!-- class="inftblruleinformal" -->
-<p>&nbsp;</p>
-<img src="img/ngrelt.png" alt="Related task" title="Related task" /><br />
-<br />
-<a href="task_create_jpa_entity.htm#BABFBJBG">Creating a JPA Entity</a>
-<p>&nbsp;</p>
-<img src="img/ngrelr.png" alt="Related task" title="Related task" /><br />
-<br />
-<a href="ref_create_jpa_entity_wizard.htm#CIAGGGDF">Create JPA Entity wizard</a></div>
-<!-- class="sect3" -->
-<!-- Start Footer -->
-<div class="footer">
-<table class="simple oac_no_warn" summary="" cellspacing="0" cellpadding="0" width="100%">
-<col width="86%" />
-<col width="*" />
-<tr>
-<td align="left"><span class="copyrightlogo">Copyright&nbsp;&copy;&nbsp;2006, 2009,&nbsp;Oracle&nbsp;and/or&nbsp;its&nbsp;affiliates.&nbsp;All&nbsp;rights&nbsp;reserved.</span><br />
-<a href="dcommon/html/cpyr.htm"><span class="copyrightlogo">Legal Notices</span></a></td>
-</tr>
-</table>
-</div>
-<!-- class="footer" -->
-</body>
-</html>
diff --git a/jpa/plugins/org.eclipse.jpt.doc.user/ref_EntityPropertiesPage.htm b/jpa/plugins/org.eclipse.jpt.doc.user/ref_EntityPropertiesPage.htm
deleted file mode 100644
index ffaccaf059..0000000000
--- a/jpa/plugins/org.eclipse.jpt.doc.user/ref_EntityPropertiesPage.htm
+++ /dev/null
@@ -1,117 +0,0 @@
-<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN"
- "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
-<html xmlns="http://www.w3.org/1999/xhtml" xml:lang="en" lang="en">
-<head>
-<meta http-equiv="Content-Type" content="text/html; charset=us-ascii" />
-
-<meta http-equiv="Content-Style-Type" content="text/css" />
-<meta http-equiv="Content-Script-Type" content="text/javascript" />
-<title>Entity Properties page</title>
-<meta name="generator" content="Oracle DARB XHTML Converter (Mode = ohj/ohw) - Version 5.1.1 Build 004" />
-<meta name="date" content="2009-05-01T8:12:49Z" />
-<meta name="robots" content="noarchive" />
-<meta name="doctitle" content="Entity Properties page" />
-<meta name="relnum" content="Release 2.2" />
-<meta name="copyright" content="Copyright (c) 2000, 2008 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. Contributors: Oracle - initial API and implementation" />
-<link rel="copyright" href="dcommon/html/cpyr.htm" title="Copyright" type="text/html" />
-<link rel="stylesheet" href="dcommon/css/blafdoc.css" title="Oracle BLAFDoc" type="text/css" />
-<!-- contents -->
-</head>
-<body>
-<p><a id="CIADECIA" name="CIADECIA"></a></p>
-<div class="sect3"><!-- infolevel="all" infotype="General" -->
-<h1>Entity Properties page</h1>
-<p>This table lists the properties of the Entity Properties page of the <a href="ref_create_jpa_entity_wizard.htm#CIAGGGDF">Create JPA Entity wizard</a>.</p>
-<div class="tblformal"><a id="sthref196" name="sthref196"></a><a id="sthref197" name="sthref197"></a>
-<p class="titleintable">&nbsp;</p>
-<table class="Formal" title="" summary="This table to be converted to informal." dir="ltr" border="1" width="100%" frame="hsides" rules="groups" cellpadding="3" cellspacing="0">
-<col width="24%" />
-<col width="*" />
-<col width="24%" />
-<thead>
-<tr align="left" valign="top">
-<th align="left" valign="bottom" id="r1c1-t6">Property</th>
-<th align="left" valign="bottom" id="r1c2-t6">Description</th>
-<th align="left" valign="bottom" id="r1c3-t6">Default</th>
-</tr>
-</thead>
-<tbody>
-<tr align="left" valign="top">
-<td align="left" id="r2c1-t6" headers="r1c1-t6">
-<p>Entity Name</p>
-</td>
-<td align="left" headers="r2c1-t6 r1c2-t6">
-<p>The name of the entity. By default, this value is the same as the one entered as the class name. If the entity name differs from the class name, then the entity name is added as an attribute. For example: <code>@Entity(name="EntityName")</code>.</p>
-</td>
-<td align="left" headers="r2c1-t6 r1c3-t6">
-<p>Determined by server.</p>
-</td>
-</tr>
-<tr align="left" valign="top">
-<td align="left" id="r3c1-t6" headers="r1c1-t6">
-<p>Table Name</p>
-</td>
-<td align="left" headers="r3c1-t6 r1c2-t6">
-<p>Select <span class="bold">Use default</span> to match the name of the mapped table name to the entity name. Otherwise, clear the <span class="bold">Use default</span> option and enter the name in the <span class="italic">Table Name</span> field. These options result in the addition of the <code>@Table</code> option to the Java class file.</p>
-</td>
-<td align="left" headers="r3c1-t6 r1c3-t6">
-<p>Use default.</p>
-</td>
-</tr>
-<tr align="left" valign="top">
-<td align="left" id="r4c1-t6" headers="r1c1-t6">
-<p>Entity Fields</p>
-</td>
-<td align="left" headers="r4c1-t6 r1c2-t6">
-<p>Click the <span class="bold">Add</span> button to add persistence fields using the Entity Fields dialog. This dialog enable you to build a field by entering a field name and selecting among persistence types. The <span class="bold">Key</span> option enables you to mark a field as a primary key. The dialog's <span class="bold">Browse</span> function enables you to add other persistence types described in the JPA specification. The <span class="bold">Edit</span> button enables you to change the name or type set for a persistent field.</p>
-</td>
-<td align="left" headers="r4c1-t6 r1c3-t6"><br /></td>
-</tr>
-<tr align="left" valign="top">
-<td align="left" id="r5c1-t6" headers="r1c1-t6">
-<p>Access Type</p>
-</td>
-<td align="left" headers="r5c1-t6 r1c2-t6">
-<p>Select whether the entity's access to instance variables is field-based or property-based, as defined in the JPA specification.</p>
-<ul>
-<li>
-<p><span class="bold">Field</span> &ndash; Instance variables are accessed directly. All non-transient instance variables are persistent.</p>
-</li>
-<li>
-<p><span class="bold">Property</span> &ndash; Persistent state accessed through the property accessor methods. The property accessor methods must be <span class="bold">public</span> or <span class="bold">private</span>.</p>
-</li>
-</ul>
-</td>
-<td align="left" headers="r5c1-t6 r1c3-t6">
-<p>Field</p>
-</td>
-</tr>
-</tbody>
-</table>
-<br /></div>
-<!-- class="tblformal" -->
-<p>&nbsp;</p>
-<img src="img/ngrelt.png" alt="Related task" title="Related task" /><br />
-<br />
-<a href="task_create_jpa_entity.htm#BABFBJBG">Creating a JPA Entity</a><br />
-<a href="task_add_persistence.htm#BABHICAI">Adding persistence to a class</a>
-<p>&nbsp;</p>
-<img src="img/ngrelr.png" alt="Related reference" title="Related reference" /><br />
-<br />
-<a href="ref_persistence_prop_view.htm#BABFAEBB">JPA Details view (for entities)</a></div>
-<!-- class="sect3" -->
-<!-- class="sect2" -->
-<!-- Start Footer -->
-<div class="footer">
-<table class="simple oac_no_warn" summary="" cellspacing="0" cellpadding="0" width="100%">
-<col width="86%" />
-<col width="*" />
-<tr>
-<td align="left"><span class="copyrightlogo">Copyright&nbsp;&copy;&nbsp;2006, 2009,&nbsp;Oracle&nbsp;and/or&nbsp;its&nbsp;affiliates.&nbsp;All&nbsp;rights&nbsp;reserved.</span><br />
-<a href="dcommon/html/cpyr.htm"><span class="copyrightlogo">Legal Notices</span></a></td>
-</tr>
-</table>
-</div>
-<!-- class="footer" -->
-</body>
-</html>
diff --git a/jpa/plugins/org.eclipse.jpt.doc.user/ref_add_converter.htm b/jpa/plugins/org.eclipse.jpt.doc.user/ref_add_converter.htm
deleted file mode 100644
index b848fed9b5..0000000000
--- a/jpa/plugins/org.eclipse.jpt.doc.user/ref_add_converter.htm
+++ /dev/null
@@ -1,78 +0,0 @@
-<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN"
- "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
-<html xmlns="http://www.w3.org/1999/xhtml" xml:lang="en" lang="en">
-<head>
-<meta http-equiv="Content-Type" content="text/html; charset=us-ascii" />
-
-<meta http-equiv="Content-Style-Type" content="text/css" />
-<meta http-equiv="Content-Script-Type" content="text/javascript" />
-<title>Add Converter dialog</title>
-<meta name="generator" content="Oracle DARB XHTML Converter (Mode = ohj/ohw) - Version 5.1.1 Build 004" />
-<meta name="date" content="2009-05-01T8:12:52Z" />
-<meta name="robots" content="noarchive" />
-<meta name="doctitle" content="Add Converter dialog" />
-<meta name="relnum" content="Release 2.2" />
-<meta name="copyright" content="Copyright (c) 2000, 2008 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. Contributors: Oracle - initial API and implementation" />
-<link rel="copyright" href="dcommon/html/cpyr.htm" title="Copyright" type="text/html" />
-<link rel="stylesheet" href="dcommon/css/blafdoc.css" title="Oracle BLAFDoc" type="text/css" />
-<!-- contents -->
-</head>
-<body>
-<p><a id="CIAGCGIJ" name="CIAGCGIJ"></a></p>
-<div class="sect2"><!-- infolevel="all" infotype="General" -->
-<h1>Add Converter dialog</h1>
-<p>Use this dialog to create a new EclipseLink converter.</p>
-<div class="inftblhruleinformalmax">
-<table class="HRuleInformalMax" summary="This table lists the options on the New EclipseLink Mapping File dialog." dir="ltr" border="1" width="100%" frame="hsides" rules="rows" cellpadding="3" cellspacing="0">
-<col width="24%" />
-<col width="*" />
-<thead>
-<tr align="left" valign="top">
-<th align="left" valign="bottom" id="r1c1-t39">Property</th>
-<th align="left" valign="bottom" id="r1c2-t39">Description</th>
-</tr>
-</thead>
-<tbody>
-<tr align="left" valign="top">
-<td align="left" id="r2c1-t39" headers="r1c1-t39">Name</td>
-<td align="left" headers="r2c1-t39 r1c2-t39">Enter the name for this converter</td>
-</tr>
-<tr align="left" valign="top">
-<td align="left" id="r3c1-t39" headers="r1c1-t39">Type</td>
-<td align="left" headers="r3c1-t39 r1c2-t39">Select the converter type:
-<ul>
-<li>
-<p>Custom</p>
-</li>
-<li>
-<p>Object type</p>
-</li>
-<li>
-<p>Struct</p>
-</li>
-<li>
-<p>Type</p>
-</li>
-</ul>
-</td>
-</tr>
-</tbody>
-</table>
-<br /></div>
-<!-- class="inftblhruleinformalmax" --></div>
-<!-- class="sect2" -->
-<!-- class="sect1" -->
-<!-- Start Footer -->
-<div class="footer">
-<table class="simple oac_no_warn" summary="" cellspacing="0" cellpadding="0" width="100%">
-<col width="86%" />
-<col width="*" />
-<tr>
-<td align="left"><span class="copyrightlogo">Copyright&nbsp;&copy;&nbsp;2006, 2009,&nbsp;Oracle&nbsp;and/or&nbsp;its&nbsp;affiliates.&nbsp;All&nbsp;rights&nbsp;reserved.</span><br />
-<a href="dcommon/html/cpyr.htm"><span class="copyrightlogo">Legal Notices</span></a></td>
-</tr>
-</table>
-</div>
-<!-- class="footer" -->
-</body>
-</html>
diff --git a/jpa/plugins/org.eclipse.jpt.doc.user/ref_association_cardinality.htm b/jpa/plugins/org.eclipse.jpt.doc.user/ref_association_cardinality.htm
deleted file mode 100644
index fda639c152..0000000000
--- a/jpa/plugins/org.eclipse.jpt.doc.user/ref_association_cardinality.htm
+++ /dev/null
@@ -1,65 +0,0 @@
-<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN"
- "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
-<html xmlns="http://www.w3.org/1999/xhtml" xml:lang="en" lang="en">
-<head>
-<meta http-equiv="Content-Type" content="text/html; charset=us-ascii" />
-
-<meta http-equiv="Content-Style-Type" content="text/css" />
-<meta http-equiv="Content-Script-Type" content="text/javascript" />
-<title>Association Cardinality</title>
-<meta name="generator" content="Oracle DARB XHTML Converter (Mode = ohj/ohw) - Version 5.1.1 Build 004" />
-<meta name="date" content="2009-05-01T8:12:50Z" />
-<meta name="robots" content="noarchive" />
-<meta name="doctitle" content="Association Cardinality" />
-<meta name="relnum" content="Release 2.2" />
-<meta name="copyright" content="Copyright (c) 2000, 2008 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. Contributors: Oracle - initial API and implementation" />
-<link rel="copyright" href="dcommon/html/cpyr.htm" title="Copyright" type="text/html" />
-<link rel="stylesheet" href="dcommon/css/blafdoc.css" title="Oracle BLAFDoc" type="text/css" />
-<!-- contents -->
-</head>
-<body>
-<p><a id="CIAFIIFH" name="CIAFIIFH"></a></p>
-<div class="sect3"><!-- infolevel="all" infotype="General" -->
-<h1>Association Cardinality</h1>
-<p><a id="sthref209" name="sthref209"></a>Use this dialog to specify cardinality of an association table. Depending on the <span class="bold">Association Kind</span> and <span class="bold">Join Columns</span> that you selected previously, some associations may not be available.</p>
-<ul>
-<li>
-<p>Many to one</p>
-</li>
-<li>
-<p>One to many</p>
-</li>
-<li>
-<p>One to one</p>
-</li>
-<li>
-<p>Many to many</p>
-</li>
-</ul>
-<p>&nbsp;</p>
-<img src="img/ngrelt.png" alt="Related task" title="Related task" /><br />
-<br />
-<a href="ref_create_new_association_wizard.htm#CIAFGHIF">Create New Association</a><br />
-<a href="tasks019.htm#BABBAGFI">Generating entities from tables</a><br />
-<a href="ref_persistence_prop_view.htm#BABFAEBB">JPA Details view (for entities)</a>
-<p>&nbsp;</p>
-<img src="img/ngrelr.png" alt="Related reference" title="Related reference" /><br />
-<br />
-<a href="ref_create_custom_entities_wizard.htm#CIAGBFJE">Generate Entities from Tables Wizard</a></div>
-<!-- class="sect3" -->
-<!-- class="sect2" -->
-<!-- class="sect1" -->
-<!-- Start Footer -->
-<div class="footer">
-<table class="simple oac_no_warn" summary="" cellspacing="0" cellpadding="0" width="100%">
-<col width="86%" />
-<col width="*" />
-<tr>
-<td align="left"><span class="copyrightlogo">Copyright&nbsp;&copy;&nbsp;2006, 2009,&nbsp;Oracle&nbsp;and/or&nbsp;its&nbsp;affiliates.&nbsp;All&nbsp;rights&nbsp;reserved.</span><br />
-<a href="dcommon/html/cpyr.htm"><span class="copyrightlogo">Legal Notices</span></a></td>
-</tr>
-</table>
-</div>
-<!-- class="footer" -->
-</body>
-</html>
diff --git a/jpa/plugins/org.eclipse.jpt.doc.user/ref_association_table.htm b/jpa/plugins/org.eclipse.jpt.doc.user/ref_association_table.htm
deleted file mode 100644
index 888c998447..0000000000
--- a/jpa/plugins/org.eclipse.jpt.doc.user/ref_association_table.htm
+++ /dev/null
@@ -1,74 +0,0 @@
-<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN"
- "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
-<html xmlns="http://www.w3.org/1999/xhtml" xml:lang="en" lang="en">
-<head>
-<meta http-equiv="Content-Type" content="text/html; charset=us-ascii" />
-
-<meta http-equiv="Content-Style-Type" content="text/css" />
-<meta http-equiv="Content-Script-Type" content="text/javascript" />
-<title>Association Tables</title>
-<meta name="generator" content="Oracle DARB XHTML Converter (Mode = ohj/ohw) - Version 5.1.1 Build 004" />
-<meta name="date" content="2009-05-01T8:12:50Z" />
-<meta name="robots" content="noarchive" />
-<meta name="doctitle" content="Association Tables" />
-<meta name="relnum" content="Release 2.2" />
-<meta name="copyright" content="Copyright (c) 2000, 2008 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. Contributors: Oracle - initial API and implementation" />
-<link rel="copyright" href="dcommon/html/cpyr.htm" title="Copyright" type="text/html" />
-<link rel="stylesheet" href="dcommon/css/blafdoc.css" title="Oracle BLAFDoc" type="text/css" />
-<!-- contents -->
-</head>
-<body>
-<p><a id="CIAGJHDC" name="CIAGJHDC"></a></p>
-<div class="sect3"><!-- infolevel="all" infotype="General" -->
-<h1>Association Tables</h1>
-<p>Use this page to specify the association tables for an entity.</p>
-<div class="inftblinformal">
-<table class="Informal" title="This table describes the options on the Association Tables dialog." summary="This table describes the options on the Association Tables dialog." dir="ltr" border="1" width="100%" frame="border" rules="all" cellpadding="3" cellspacing="0">
-<col width="32%" />
-<col width="*" />
-<thead>
-<tr align="left" valign="top">
-<th align="left" valign="bottom" id="r1c1-t12">Property</th>
-<th align="left" valign="bottom" id="r1c2-t12">Description</th>
-</tr>
-</thead>
-<tbody>
-<tr align="left" valign="top">
-<td align="left" id="r2c1-t12" headers="r1c1-t12">Association kind</td>
-<td align="left" headers="r2c1-t12 r1c2-t12">Specify if the association is <span class="bold">Simple</span> (1:M) or <span class="bold">Many to Many</span> (M:M).</td>
-</tr>
-<tr align="left" valign="top">
-<td align="left" id="r3c1-t12" headers="r1c1-t12">Association tables</td>
-<td align="left" headers="r3c1-t12 r1c2-t12">Click <span class="bold">Table Selection</span>, then select the two tables to associate.
-<p>When creating a <span class="bold">Many to Many</span> association, you can select a <span class="bold">Join Table</span> for the association.</p>
-</td>
-</tr>
-</tbody>
-</table>
-<br /></div>
-<!-- class="inftblinformal" -->
-<p>&nbsp;</p>
-<img src="img/ngrelt.png" alt="Related task" title="Related task" /><br />
-<br />
-<a href="ref_create_new_association_wizard.htm#CIAFGHIF">Create New Association</a><br />
-<a href="tasks019.htm#BABBAGFI">Generating entities from tables</a><br />
-<a href="ref_persistence_prop_view.htm#BABFAEBB">JPA Details view (for entities)</a>
-<p>&nbsp;</p>
-<img src="img/ngrelr.png" alt="Related reference" title="Related reference" /><br />
-<br />
-<a href="ref_create_custom_entities_wizard.htm#CIAGBFJE">Generate Entities from Tables Wizard</a></div>
-<!-- class="sect3" -->
-<!-- Start Footer -->
-<div class="footer">
-<table class="simple oac_no_warn" summary="" cellspacing="0" cellpadding="0" width="100%">
-<col width="86%" />
-<col width="*" />
-<tr>
-<td align="left"><span class="copyrightlogo">Copyright&nbsp;&copy;&nbsp;2006, 2009,&nbsp;Oracle&nbsp;and/or&nbsp;its&nbsp;affiliates.&nbsp;All&nbsp;rights&nbsp;reserved.</span><br />
-<a href="dcommon/html/cpyr.htm"><span class="copyrightlogo">Legal Notices</span></a></td>
-</tr>
-</table>
-</div>
-<!-- class="footer" -->
-</body>
-</html>
diff --git a/jpa/plugins/org.eclipse.jpt.doc.user/ref_create_custom_entities_wizard.htm b/jpa/plugins/org.eclipse.jpt.doc.user/ref_create_custom_entities_wizard.htm
deleted file mode 100644
index 176e819a10..0000000000
--- a/jpa/plugins/org.eclipse.jpt.doc.user/ref_create_custom_entities_wizard.htm
+++ /dev/null
@@ -1,53 +0,0 @@
-<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN"
- "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
-<html xmlns="http://www.w3.org/1999/xhtml" xml:lang="en" lang="en">
-<head>
-<meta http-equiv="Content-Type" content="text/html; charset=us-ascii" />
-
-<meta http-equiv="Content-Style-Type" content="text/css" />
-<meta http-equiv="Content-Script-Type" content="text/javascript" />
-<title>Generate Entities from Tables Wizard</title>
-<meta name="generator" content="Oracle DARB XHTML Converter (Mode = ohj/ohw) - Version 5.1.1 Build 004" />
-<meta name="date" content="2009-05-01T8:12:50Z" />
-<meta name="robots" content="noarchive" />
-<meta name="doctitle" content="Generate Entities from Tables Wizard" />
-<meta name="relnum" content="Release 2.2" />
-<meta name="copyright" content="Copyright (c) 2000, 2008 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. Contributors: Oracle - initial API and implementation" />
-<link rel="copyright" href="dcommon/html/cpyr.htm" title="Copyright" type="text/html" />
-<link rel="stylesheet" href="dcommon/css/blafdoc.css" title="Oracle BLAFDoc" type="text/css" />
-<!-- contents -->
-</head>
-<body>
-<p><a id="CIAGBFJE" name="CIAGBFJE"></a></p>
-<div class="sect2"><!-- infolevel="all" infotype="General" -->
-<h1>Generate Entities from Tables Wizard</h1>
-<p>Use the Generate Custom Entities Wizard to create entities from your database tables.</p>
-<p>The wizard consists of the following pages:</p>
-<ul>
-<li>
-<p><a href="ref_selectTables.htm#CIAHCGEE">Select Tables</a></p>
-</li>
-<li>
-<p><a href="ref_tableAssociations.htm#CIACDICB">Table Associations</a></p>
-</li>
-<li>
-<p><a href="ref_customizeDefaultEntityGeneration.htm#CIAEJDBE">Customize Default Entity Generation</a></p>
-</li>
-<li>
-<p><a href="ref_customizIndividualEntities.htm#CIACIGEE">Customize Individual Entities</a></p>
-</li>
-</ul>
-<!-- Start Footer -->
-<div class="footer">
-<table class="simple oac_no_warn" summary="" cellspacing="0" cellpadding="0" width="100%">
-<col width="86%" />
-<col width="*" />
-<tr>
-<td align="left"><span class="copyrightlogo">Copyright&nbsp;&copy;&nbsp;2006, 2009,&nbsp;Oracle&nbsp;and/or&nbsp;its&nbsp;affiliates.&nbsp;All&nbsp;rights&nbsp;reserved.</span><br />
-<a href="dcommon/html/cpyr.htm"><span class="copyrightlogo">Legal Notices</span></a></td>
-</tr>
-</table>
-</div>
-<!-- class="footer" --></div>
-</body>
-</html>
diff --git a/jpa/plugins/org.eclipse.jpt.doc.user/ref_create_jpa_entity_wizard.htm b/jpa/plugins/org.eclipse.jpt.doc.user/ref_create_jpa_entity_wizard.htm
deleted file mode 100644
index ec5befdba0..0000000000
--- a/jpa/plugins/org.eclipse.jpt.doc.user/ref_create_jpa_entity_wizard.htm
+++ /dev/null
@@ -1,46 +0,0 @@
-<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN"
- "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
-<html xmlns="http://www.w3.org/1999/xhtml" xml:lang="en" lang="en">
-<head>
-<meta http-equiv="Content-Type" content="text/html; charset=us-ascii" />
-
-<meta http-equiv="Content-Style-Type" content="text/css" />
-<meta http-equiv="Content-Script-Type" content="text/javascript" />
-<title>Create JPA Entity wizard</title>
-<meta name="generator" content="Oracle DARB XHTML Converter (Mode = ohj/ohw) - Version 5.1.1 Build 004" />
-<meta name="date" content="2009-05-01T8:12:49Z" />
-<meta name="robots" content="noarchive" />
-<meta name="doctitle" content="Create JPA Entity wizard" />
-<meta name="relnum" content="Release 2.2" />
-<meta name="copyright" content="Copyright (c) 2000, 2008 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. Contributors: Oracle - initial API and implementation" />
-<link rel="copyright" href="dcommon/html/cpyr.htm" title="Copyright" type="text/html" />
-<link rel="stylesheet" href="dcommon/css/blafdoc.css" title="Oracle BLAFDoc" type="text/css" />
-<!-- contents -->
-</head>
-<body>
-<p><a id="CIAGGGDF" name="CIAGGGDF"></a></p>
-<div class="sect2"><!-- infolevel="all" infotype="General" -->
-<h1>Create JPA Entity wizard</h1>
-<p>The Create JPA wizard enables you to quickly add an entity and also add persistence fields to that entity. In addition, this wizard adds the accessor methods (<code>getter</code> and <code>setter</code>) in the class file. The wizard consists of the following pages:</p>
-<ul>
-<li>
-<p><a href="ref_EntityClassPage.htm#CIAFEIGF">Entity Class page</a></p>
-</li>
-<li>
-<p><a href="ref_EntityPropertiesPage.htm#CIADECIA">Entity Properties page</a></p>
-</li>
-</ul>
-<!-- Start Footer -->
-<div class="footer">
-<table class="simple oac_no_warn" summary="" cellspacing="0" cellpadding="0" width="100%">
-<col width="86%" />
-<col width="*" />
-<tr>
-<td align="left"><span class="copyrightlogo">Copyright&nbsp;&copy;&nbsp;2006, 2009,&nbsp;Oracle&nbsp;and/or&nbsp;its&nbsp;affiliates.&nbsp;All&nbsp;rights&nbsp;reserved.</span><br />
-<a href="dcommon/html/cpyr.htm"><span class="copyrightlogo">Legal Notices</span></a></td>
-</tr>
-</table>
-</div>
-<!-- class="footer" --></div>
-</body>
-</html>
diff --git a/jpa/plugins/org.eclipse.jpt.doc.user/ref_create_new_association_wizard.htm b/jpa/plugins/org.eclipse.jpt.doc.user/ref_create_new_association_wizard.htm
deleted file mode 100644
index b01d116f39..0000000000
--- a/jpa/plugins/org.eclipse.jpt.doc.user/ref_create_new_association_wizard.htm
+++ /dev/null
@@ -1,50 +0,0 @@
-<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN"
- "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
-<html xmlns="http://www.w3.org/1999/xhtml" xml:lang="en" lang="en">
-<head>
-<meta http-equiv="Content-Type" content="text/html; charset=us-ascii" />
-
-<meta http-equiv="Content-Style-Type" content="text/css" />
-<meta http-equiv="Content-Script-Type" content="text/javascript" />
-<title>Create New Association</title>
-<meta name="generator" content="Oracle DARB XHTML Converter (Mode = ohj/ohw) - Version 5.1.1 Build 004" />
-<meta name="date" content="2009-05-01T8:12:50Z" />
-<meta name="robots" content="noarchive" />
-<meta name="doctitle" content="Create New Association" />
-<meta name="relnum" content="Release 2.2" />
-<meta name="copyright" content="Copyright (c) 2000, 2008 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. Contributors: Oracle - initial API and implementation" />
-<link rel="copyright" href="dcommon/html/cpyr.htm" title="Copyright" type="text/html" />
-<link rel="stylesheet" href="dcommon/css/blafdoc.css" title="Oracle BLAFDoc" type="text/css" />
-<!-- contents -->
-</head>
-<body>
-<p><a id="CIAFGHIF" name="CIAFGHIF"></a></p>
-<div class="sect2"><!-- infolevel="all" infotype="General" -->
-<h1>Create New Association</h1>
-<p><a id="sthref206" name="sthref206"></a><a id="sthref207" name="sthref207"></a>Use the Create New Association wizard to specify association tables when generating an entity.</p>
-<p>The wizard consists of the following pages:</p>
-<ul>
-<li>
-<p><a href="ref_association_table.htm#CIAGJHDC">Association Tables</a></p>
-</li>
-<li>
-<p><a href="ref_join_columns.htm#CIAEGEEG">Join Columns</a></p>
-</li>
-<li>
-<p><a href="ref_association_cardinality.htm#CIAFIIFH">Association Cardinality</a></p>
-</li>
-</ul>
-<!-- Start Footer -->
-<div class="footer">
-<table class="simple oac_no_warn" summary="" cellspacing="0" cellpadding="0" width="100%">
-<col width="86%" />
-<col width="*" />
-<tr>
-<td align="left"><span class="copyrightlogo">Copyright&nbsp;&copy;&nbsp;2006, 2009,&nbsp;Oracle&nbsp;and/or&nbsp;its&nbsp;affiliates.&nbsp;All&nbsp;rights&nbsp;reserved.</span><br />
-<a href="dcommon/html/cpyr.htm"><span class="copyrightlogo">Legal Notices</span></a></td>
-</tr>
-</table>
-</div>
-<!-- class="footer" --></div>
-</body>
-</html>
diff --git a/jpa/plugins/org.eclipse.jpt.doc.user/ref_customizIndividualEntities.htm b/jpa/plugins/org.eclipse.jpt.doc.user/ref_customizIndividualEntities.htm
deleted file mode 100644
index 1970e429b1..0000000000
--- a/jpa/plugins/org.eclipse.jpt.doc.user/ref_customizIndividualEntities.htm
+++ /dev/null
@@ -1,89 +0,0 @@
-<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN"
- "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
-<html xmlns="http://www.w3.org/1999/xhtml" xml:lang="en" lang="en">
-<head>
-<meta http-equiv="Content-Type" content="text/html; charset=us-ascii" />
-
-<meta http-equiv="Content-Style-Type" content="text/css" />
-<meta http-equiv="Content-Script-Type" content="text/javascript" />
-<title>Customize Individual Entities</title>
-<meta name="generator" content="Oracle DARB XHTML Converter (Mode = ohj/ohw) - Version 5.1.1 Build 004" />
-<meta name="date" content="2009-05-01T8:12:50Z" />
-<meta name="robots" content="noarchive" />
-<meta name="doctitle" content="Customize Individual Entities" />
-<meta name="relnum" content="Release 2.2" />
-<meta name="copyright" content="Copyright (c) 2000, 2008 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. Contributors: Oracle - initial API and implementation" />
-<link rel="copyright" href="dcommon/html/cpyr.htm" title="Copyright" type="text/html" />
-<link rel="stylesheet" href="dcommon/css/blafdoc.css" title="Oracle BLAFDoc" type="text/css" />
-<!-- contents -->
-</head>
-<body>
-<p><a id="CIACIGEE" name="CIACIGEE"></a></p>
-<div class="sect3"><!-- infolevel="all" infotype="General" -->
-<h1>Customize Individual Entities</h1>
-<p><a id="sthref205" name="sthref205"></a>Use this page to customize each generated entity. Select an item in the Table and columns area, then complete the following fields for each item.</p>
-<div class="inftblinformal">
-<table class="Informal" title="This table describes the options on the Individual Entities dialog." summary="This table describes the options on the Individual Entities dialog." dir="ltr" border="1" width="100%" frame="border" rules="all" cellpadding="3" cellspacing="0">
-<col width="32%" />
-<col width="*" />
-<thead>
-<tr align="left" valign="top">
-<th align="left" valign="bottom" id="r1c1-t11">Property</th>
-<th align="left" valign="bottom" id="r1c2-t11">Description</th>
-</tr>
-</thead>
-<tbody>
-<tr align="left" valign="top">
-<td align="left" id="r2c1-t11" headers="r1c1-t11">Table Mapping</td>
-<td align="left" headers="r2c1-t11 r1c2-t11">Use these options to define the table mapping information for the entity.</td>
-</tr>
-<tr align="left" valign="top">
-<td align="left" id="r3c1-t11" headers="r1c1-t11">&nbsp;&nbsp;Key&nbsp;generator</td>
-<td align="left" headers="r3c1-t11 r1c2-t11">Select the generator used for this mapping.</td>
-</tr>
-<tr align="left" valign="top">
-<td align="left" id="r4c1-t11" headers="r1c1-t11">&nbsp;&nbsp;Sequence&nbsp;name</td>
-<td align="left" headers="r4c1-t11 r1c2-t11">Enter a name for the sequence.
-<p>You can use <span class="bold">$table</span> and <span class="bold">$pk</span> as variables in the name. These will be replaced by the table name and primary key column name (respectively) when Dali generates a table mapping.</p>
-</td>
-</tr>
-<tr align="left" valign="top">
-<td align="left" id="r5c1-t11" headers="r1c1-t11">&nbsp;&nbsp;Entity&nbsp;access</td>
-<td align="left" headers="r5c1-t11 r1c2-t11">Specify the default entity access method: <span class="bold">Field</span> (default) or <span class="bold">Property</span>.</td>
-</tr>
-<tr align="left" valign="top">
-<td align="left" id="r6c1-t11" headers="r1c1-t11">Domain Java Class</td>
-<td align="left" headers="r6c1-t11 r1c2-t11">Use these options to define the class information (<span class="bold">Superclass</span> and <span class="bold">Interfaces</span>) for the entity.</td>
-</tr>
-</tbody>
-</table>
-<br /></div>
-<!-- class="inftblinformal" -->
-<p>&nbsp;</p>
-<img src="img/ngrelt.png" alt="Related task" title="Related task" /><br />
-<br />
-<a href="task_create_jpa_entity.htm#BABFBJBG">Creating a JPA Entity</a><br />
-<a href="tasks019.htm#BABBAGFI">Generating entities from tables</a><br />
-<a href="ref_persistence_prop_view.htm#BABFAEBB">JPA Details view (for entities)</a>
-<p>&nbsp;</p>
-<img src="img/ngrelr.png" alt="Related reference" title="Related reference" /><br />
-<br />
-<a href="ref_create_custom_entities_wizard.htm#CIAGBFJE">Generate Entities from Tables Wizard</a>
-<p>&nbsp;</p>
-</div>
-<!-- class="sect3" -->
-<!-- class="sect2" -->
-<!-- Start Footer -->
-<div class="footer">
-<table class="simple oac_no_warn" summary="" cellspacing="0" cellpadding="0" width="100%">
-<col width="86%" />
-<col width="*" />
-<tr>
-<td align="left"><span class="copyrightlogo">Copyright&nbsp;&copy;&nbsp;2006, 2009,&nbsp;Oracle&nbsp;and/or&nbsp;its&nbsp;affiliates.&nbsp;All&nbsp;rights&nbsp;reserved.</span><br />
-<a href="dcommon/html/cpyr.htm"><span class="copyrightlogo">Legal Notices</span></a></td>
-</tr>
-</table>
-</div>
-<!-- class="footer" -->
-</body>
-</html>
diff --git a/jpa/plugins/org.eclipse.jpt.doc.user/ref_customizeDefaultEntityGeneration.htm b/jpa/plugins/org.eclipse.jpt.doc.user/ref_customizeDefaultEntityGeneration.htm
deleted file mode 100644
index a3164669da..0000000000
--- a/jpa/plugins/org.eclipse.jpt.doc.user/ref_customizeDefaultEntityGeneration.htm
+++ /dev/null
@@ -1,96 +0,0 @@
-<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN"
- "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
-<html xmlns="http://www.w3.org/1999/xhtml" xml:lang="en" lang="en">
-<head>
-<meta http-equiv="Content-Type" content="text/html; charset=us-ascii" />
-
-<meta http-equiv="Content-Style-Type" content="text/css" />
-<meta http-equiv="Content-Script-Type" content="text/javascript" />
-<title>Customize Default Entity Generation</title>
-<meta name="generator" content="Oracle DARB XHTML Converter (Mode = ohj/ohw) - Version 5.1.1 Build 004" />
-<meta name="date" content="2009-05-01T8:12:50Z" />
-<meta name="robots" content="noarchive" />
-<meta name="doctitle" content="Customize Default Entity Generation" />
-<meta name="relnum" content="Release 2.2" />
-<meta name="copyright" content="Copyright (c) 2000, 2008 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. Contributors: Oracle - initial API and implementation" />
-<link rel="copyright" href="dcommon/html/cpyr.htm" title="Copyright" type="text/html" />
-<link rel="stylesheet" href="dcommon/css/blafdoc.css" title="Oracle BLAFDoc" type="text/css" />
-<!-- contents -->
-</head>
-<body>
-<p><a id="CIAEJDBE" name="CIAEJDBE"></a></p>
-<div class="sect3"><!-- infolevel="all" infotype="General" -->
-<h1>Customize Default Entity Generation</h1>
-<p><a id="sthref204" name="sthref204"></a>Use this page to specify the default information Dali will use when generating the entities from the database tables. You will be able to override this information for specific entities.</p>
-<div class="inftblinformal">
-<table class="Informal" title="This table describes the options on the Generate Entities dialog." summary="This table describes the options on the Custom Default Entity Generation dialog." dir="ltr" border="1" width="100%" frame="border" rules="all" cellpadding="3" cellspacing="0">
-<col width="32%" />
-<col width="*" />
-<thead>
-<tr align="left" valign="top">
-<th align="left" valign="bottom" id="r1c1-t10">Property</th>
-<th align="left" valign="bottom" id="r1c2-t10">Description</th>
-</tr>
-</thead>
-<tbody>
-<tr align="left" valign="top">
-<td align="left" id="r2c1-t10" headers="r1c1-t10">Table Mapping</td>
-<td align="left" headers="r2c1-t10 r1c2-t10">Use these options to define the table mapping information for the entity.</td>
-</tr>
-<tr align="left" valign="top">
-<td align="left" id="r3c1-t10" headers="r1c1-t10">&nbsp;&nbsp;Key&nbsp;generator</td>
-<td align="left" headers="r3c1-t10 r1c2-t10">Select the generator used for this mapping.</td>
-</tr>
-<tr align="left" valign="top">
-<td align="left" id="r4c1-t10" headers="r1c1-t10">&nbsp;&nbsp;Sequence&nbsp;name</td>
-<td align="left" headers="r4c1-t10 r1c2-t10">Enter a name for the sequence.
-<p>You can use <span class="bold">$table</span> and <span class="bold">$pk</span> as variables in the name. These will be replaced by the table name and primary key column name (respectively) when Dali generates a table mapping.</p>
-</td>
-</tr>
-<tr align="left" valign="top">
-<td align="left" id="r5c1-t10" headers="r1c1-t10">&nbsp;&nbsp;Entity&nbsp;access</td>
-<td align="left" headers="r5c1-t10 r1c2-t10">Specify the default entity access method: <span class="bold">Field</span> (default) or <span class="bold">Property</span>.</td>
-</tr>
-<tr align="left" valign="top">
-<td align="left" id="r6c1-t10" headers="r1c1-t10">&nbsp;&nbsp;Associations&nbsp;fetch</td>
-<td align="left" headers="r6c1-t10 r1c2-t10">Specify the default fetch mode for associations: <span class="bold">Default</span>, as defined by the application (default), or <span class="bold">Lazy</span>.</td>
-</tr>
-<tr align="left" valign="top">
-<td align="left" id="r7c1-t10" headers="r1c1-t10">&nbsp;&nbsp;Collection&nbsp;type</td>
-<td align="left" headers="r7c1-t10 r1c2-t10">Specify if the collection properties are a <span class="bold">Set</span> or <span class="bold">List</span>.
-<p>Enable the <span class="bold">Always generate optional JPA annotations and DDL parameters</span> option to have Dali include this information in the entity.</p>
-</td>
-</tr>
-<tr align="left" valign="top">
-<td align="left" id="r8c1-t10" headers="r1c1-t10">Domain Java Class</td>
-<td align="left" headers="r8c1-t10 r1c2-t10">Use these options to define the class information (<span class="bold">Package</span>, <span class="bold">Superclass</span>, and <span class="bold">Interfaces</span>) for the entity.</td>
-</tr>
-</tbody>
-</table>
-<br /></div>
-<!-- class="inftblinformal" -->
-<p>&nbsp;</p>
-<img src="img/ngrelt.png" alt="Related task" title="Related task" /><br />
-<br />
-<a href="task_create_jpa_entity.htm#BABFBJBG">Creating a JPA Entity</a><br />
-<a href="tasks019.htm#BABBAGFI">Generating entities from tables</a><br />
-<a href="ref_persistence_prop_view.htm#BABFAEBB">JPA Details view (for entities)</a>
-<p>&nbsp;</p>
-<img src="img/ngrelr.png" alt="Related reference" title="Related reference" /><br />
-<br />
-<a href="ref_create_custom_entities_wizard.htm#CIAGBFJE">Generate Entities from Tables Wizard</a></div>
-<!-- class="sect3" -->
-<!-- Start Footer -->
-<div class="footer">
-<table class="simple oac_no_warn" summary="" cellspacing="0" cellpadding="0" width="100%">
-<col width="86%" />
-<col width="*" />
-<tr>
-<td align="left"><span class="copyrightlogo">Copyright&nbsp;&copy;&nbsp;2006, 2009,&nbsp;Oracle&nbsp;and/or&nbsp;its&nbsp;affiliates.&nbsp;All&nbsp;rights&nbsp;reserved.</span><br />
-<a href="dcommon/html/cpyr.htm"><span class="copyrightlogo">Legal Notices</span></a></td>
-</tr>
-</table>
-</div>
-<!-- class="footer" -->
-</body>
-</html>
diff --git a/jpa/plugins/org.eclipse.jpt.doc.user/ref_details_orm.htm b/jpa/plugins/org.eclipse.jpt.doc.user/ref_details_orm.htm
deleted file mode 100644
index 6c0b85759d..0000000000
--- a/jpa/plugins/org.eclipse.jpt.doc.user/ref_details_orm.htm
+++ /dev/null
@@ -1,56 +0,0 @@
-<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN"
- "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
-<html xmlns="http://www.w3.org/1999/xhtml" xml:lang="en" lang="en">
-<head>
-<meta http-equiv="Content-Type" content="text/html; charset=us-ascii" />
-
-<meta http-equiv="Content-Style-Type" content="text/css" />
-<meta http-equiv="Content-Script-Type" content="text/javascript" />
-<title>JPA Details view (for orm.xml)</title>
-<meta name="generator" content="Oracle DARB XHTML Converter (Mode = ohj/ohw) - Version 5.1.1 Build 004" />
-<meta name="date" content="2009-05-01T8:12:51Z" />
-<meta name="robots" content="noarchive" />
-<meta name="doctitle" content="JPA Details view (for orm.xml)" />
-<meta name="relnum" content="Release 2.2" />
-<meta name="copyright" content="Copyright (c) 2000, 2008 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. Contributors: Oracle - initial API and implementation" />
-<link rel="copyright" href="dcommon/html/cpyr.htm" title="Copyright" type="text/html" />
-<link rel="stylesheet" href="dcommon/css/blafdoc.css" title="Oracle BLAFDoc" type="text/css" />
-<!-- contents -->
-</head>
-<body>
-<p><a id="CACGDGHC" name="CACGDGHC"></a></p>
-<div class="sect2"><!-- infolevel="all" infotype="General" -->
-<h1>JPA Details view (for orm.xml)</h1>
-<p>The <span class="gui-object-title">JPA Details</span> view displays the default mapping and persistence information for the project and contains the following areas:</p>
-<ul>
-<li>
-<p><a href="reference013.htm#CACCACGH">General information</a></p>
-</li>
-<li>
-<p><a href="reference014.htm#CACEAGBG">Persistence Unit information</a></p>
-</li>
-<li>
-<p><a href="reference015.htm#CIAFGAIJ">Generators</a></p>
-</li>
-<li>
-<p><a href="reference016.htm#CIAIBAAJ">Queries</a></p>
-</li>
-<li>
-<p><a href="reference017.htm#CIADGCID">Converters</a> (when using EclipseLink)</p>
-</li>
-</ul>
-<p>These defaults can be overridden by the settings on a specific entity or mapping.</p>
-<!-- Start Footer -->
-<div class="footer">
-<table class="simple oac_no_warn" summary="" cellspacing="0" cellpadding="0" width="100%">
-<col width="86%" />
-<col width="*" />
-<tr>
-<td align="left"><span class="copyrightlogo">Copyright&nbsp;&copy;&nbsp;2006, 2009,&nbsp;Oracle&nbsp;and/or&nbsp;its&nbsp;affiliates.&nbsp;All&nbsp;rights&nbsp;reserved.</span><br />
-<a href="dcommon/html/cpyr.htm"><span class="copyrightlogo">Legal Notices</span></a></td>
-</tr>
-</table>
-</div>
-<!-- class="footer" --></div>
-</body>
-</html>
diff --git a/jpa/plugins/org.eclipse.jpt.doc.user/ref_eclipselink_mapping_file.htm b/jpa/plugins/org.eclipse.jpt.doc.user/ref_eclipselink_mapping_file.htm
deleted file mode 100644
index a5939b0348..0000000000
--- a/jpa/plugins/org.eclipse.jpt.doc.user/ref_eclipselink_mapping_file.htm
+++ /dev/null
@@ -1,81 +0,0 @@
-<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN"
- "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
-<html xmlns="http://www.w3.org/1999/xhtml" xml:lang="en" lang="en">
-<head>
-<meta http-equiv="Content-Type" content="text/html; charset=us-ascii" />
-
-<meta http-equiv="Content-Style-Type" content="text/css" />
-<meta http-equiv="Content-Script-Type" content="text/javascript" />
-<title>New EclipseLink Mapping File dialog</title>
-<meta name="generator" content="Oracle DARB XHTML Converter (Mode = ohj/ohw) - Version 5.1.1 Build 004" />
-<meta name="date" content="2009-05-01T8:12:52Z" />
-<meta name="robots" content="noarchive" />
-<meta name="doctitle" content="New EclipseLink Mapping File dialog" />
-<meta name="relnum" content="Release 2.2" />
-<meta name="copyright" content="Copyright (c) 2000, 2008 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. Contributors: Oracle - initial API and implementation" />
-<link rel="copyright" href="dcommon/html/cpyr.htm" title="Copyright" type="text/html" />
-<link rel="stylesheet" href="dcommon/css/blafdoc.css" title="Oracle BLAFDoc" type="text/css" />
-<!-- contents -->
-</head>
-<body>
-<p><a id="CIAEDEJF" name="CIAEDEJF"></a></p>
-<div class="sect2"><!-- infolevel="all" infotype="General" -->
-<h1>New EclipseLink Mapping File dialog</h1>
-<p>Specify the location and properties of the EclipseLink mapping file (<code>eclispelink-orm.xml</code>).</p>
-<div class="inftblhruleinformalmax">
-<table class="HRuleInformalMax" summary="This table lists the options on the New EclipseLink Mapping File dialog." dir="ltr" border="1" width="100%" frame="hsides" rules="rows" cellpadding="3" cellspacing="0">
-<col width="24%" />
-<col width="*" />
-<thead>
-<tr align="left" valign="top">
-<th align="left" valign="bottom" id="r1c1-t38">Property</th>
-<th align="left" valign="bottom" id="r1c2-t38">Description</th>
-</tr>
-</thead>
-<tbody>
-<tr align="left" valign="top">
-<td align="left" id="r2c1-t38" headers="r1c1-t38">Project</td>
-<td align="left" headers="r2c1-t38 r1c2-t38">Select the project in which to add the mapping file.</td>
-</tr>
-<tr align="left" valign="top">
-<td align="left" id="r3c1-t38" headers="r1c1-t38">Source folder</td>
-<td align="left" headers="r3c1-t38 r1c2-t38">Click <span class="bold">Browse</span> and select the source file in which to add the mapping file. The default is <code>../</code><code><span class="codeinlineitalic">&lt;PROJECT&gt;</span></code><code>/src</code>.</td>
-</tr>
-<tr align="left" valign="top">
-<td align="left" id="r4c1-t38" headers="r1c1-t38">File path</td>
-<td align="left" headers="r4c1-t38 r1c2-t38">Enter the filename and path of the mapping file. The default is <code>META-INF/eclipselink-orm.xml</code>.</td>
-</tr>
-<tr align="left" valign="top">
-<td align="left" id="r5c1-t38" headers="r1c1-t38">Default access</td>
-<td align="left" headers="r5c1-t38 r1c2-t38">Select whether the entity's access to instance variables is <span class="bold">field</span>-based or <span class="bold">property</span>-based, as defined in the JPA specification.</td>
-</tr>
-<tr align="left" valign="top">
-<td align="left" id="r6c1-t38" headers="r1c1-t38">Add to persistence unit</td>
-<td align="left" headers="r6c1-t38 r1c2-t38">Specify if this mapping file should be added to the persistence unit (<code>persistence.xml</code>).</td>
-</tr>
-<tr align="left" valign="top">
-<td align="left" id="r7c1-t38" headers="r1c1-t38">&nbsp;&nbsp;Persistence&nbsp;Unit</td>
-<td align="left" headers="r7c1-t38 r1c2-t38">Select the persistence unit in which to add the mapping file.</td>
-</tr>
-</tbody>
-</table>
-<br /></div>
-<!-- class="inftblhruleinformalmax" -->
-<img src="img/ngrelr.png" alt="Related reference" title="Related reference" /><br />
-<br />
-<a href="reference003.htm#CIAJEIDJ">Mapping File</a></div>
-<!-- class="sect2" -->
-<!-- Start Footer -->
-<div class="footer">
-<table class="simple oac_no_warn" summary="" cellspacing="0" cellpadding="0" width="100%">
-<col width="86%" />
-<col width="*" />
-<tr>
-<td align="left"><span class="copyrightlogo">Copyright&nbsp;&copy;&nbsp;2006, 2009,&nbsp;Oracle&nbsp;and/or&nbsp;its&nbsp;affiliates.&nbsp;All&nbsp;rights&nbsp;reserved.</span><br />
-<a href="dcommon/html/cpyr.htm"><span class="copyrightlogo">Legal Notices</span></a></td>
-</tr>
-</table>
-</div>
-<!-- class="footer" -->
-</body>
-</html>
diff --git a/jpa/plugins/org.eclipse.jpt.doc.user/ref_java_page.htm b/jpa/plugins/org.eclipse.jpt.doc.user/ref_java_page.htm
deleted file mode 100644
index 154e4fccdd..0000000000
--- a/jpa/plugins/org.eclipse.jpt.doc.user/ref_java_page.htm
+++ /dev/null
@@ -1,74 +0,0 @@
-<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN"
- "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
-<html xmlns="http://www.w3.org/1999/xhtml" xml:lang="en" lang="en">
-<head>
-<meta http-equiv="Content-Type" content="text/html; charset=us-ascii" />
-
-<meta http-equiv="Content-Style-Type" content="text/css" />
-<meta http-equiv="Content-Script-Type" content="text/javascript" />
-<title>Java Page</title>
-<meta name="generator" content="Oracle DARB XHTML Converter (Mode = ohj/ohw) - Version 5.1.1 Build 004" />
-<meta name="date" content="2009-05-01T8:12:49Z" />
-<meta name="robots" content="noarchive" />
-<meta name="doctitle" content="Java Page" />
-<meta name="relnum" content="Release 2.2" />
-<meta name="copyright" content="Copyright (c) 2000, 2008 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. Contributors: Oracle - initial API and implementation" />
-<link rel="copyright" href="dcommon/html/cpyr.htm" title="Copyright" type="text/html" />
-<link rel="stylesheet" href="dcommon/css/blafdoc.css" title="Oracle BLAFDoc" type="text/css" />
-<!-- contents -->
-</head>
-<body>
-<p><a id="CIAGEBAA" name="CIAGEBAA"></a></p>
-<div class="sect3"><!-- infolevel="all" infotype="General" -->
-<h1>Java Page</h1>
-<p>This table lists the properties available on the Java page of the <a href="ref_new_jpa_project_wizard.htm#CACBJGBG">Create New JPA Project wizard</a>.</p>
-<div class="inftblinformal">
-<table class="Informal" title="This table describes the options on the Generate DDL - Objects page." summary="This table describes the options on the Generate DDL - Objects page." dir="ltr" border="1" width="100%" frame="border" rules="all" cellpadding="3" cellspacing="0">
-<col width="24%" />
-<col width="*" />
-<col width="25%" />
-<thead>
-<tr align="left" valign="top">
-<th align="left" valign="bottom" id="r1c1-t3">Property</th>
-<th align="left" valign="bottom" id="r1c2-t3">Description</th>
-<th align="left" valign="bottom" id="r1c3-t3">Default</th>
-</tr>
-</thead>
-<tbody>
-<tr align="left" valign="top">
-<td align="left" id="r2c1-t3" headers="r1c1-t3">Source folders on build path</td>
-<td align="left" headers="r2c1-t3 r1c2-t3">Click <span class="bold">Add Folder</span> to select an existing Java source folder to add to this project.</td>
-<td align="left" headers="r2c1-t3 r1c3-t3">EclipseLink</td>
-</tr>
-<tr align="left" valign="top">
-<td align="left" id="r3c1-t3" headers="r1c1-t3">Default output folder</td>
-<td align="left" headers="r3c1-t3 r1c2-t3">Specify the location of the&nbsp;<code>.class</code> files.</td>
-<td align="left" headers="r3c1-t3 r1c3-t3">build\classes</td>
-</tr>
-</tbody>
-</table>
-<br /></div>
-<!-- class="inftblinformal" -->
-<p>&nbsp;</p>
-<img src="img/ngrelt.png" alt="Related task" title="Related task" /><br />
-<br />
-<a href="task_create_new_project.htm#CIHHEJCJ">Creating a new JPA project</a>
-<p>&nbsp;</p>
-<img src="img/ngrelr.png" alt="Related task" title="Related task" /><br />
-<br />
-<a href="ref_new_jpa_project_wizard.htm#CACBJGBG">Create New JPA Project wizard</a></div>
-<!-- class="sect3" -->
-<!-- Start Footer -->
-<div class="footer">
-<table class="simple oac_no_warn" summary="" cellspacing="0" cellpadding="0" width="100%">
-<col width="86%" />
-<col width="*" />
-<tr>
-<td align="left"><span class="copyrightlogo">Copyright&nbsp;&copy;&nbsp;2006, 2009,&nbsp;Oracle&nbsp;and/or&nbsp;its&nbsp;affiliates.&nbsp;All&nbsp;rights&nbsp;reserved.</span><br />
-<a href="dcommon/html/cpyr.htm"><span class="copyrightlogo">Legal Notices</span></a></td>
-</tr>
-</table>
-</div>
-<!-- class="footer" -->
-</body>
-</html>
diff --git a/jpa/plugins/org.eclipse.jpt.doc.user/ref_join_columns.htm b/jpa/plugins/org.eclipse.jpt.doc.user/ref_join_columns.htm
deleted file mode 100644
index 414ae8de50..0000000000
--- a/jpa/plugins/org.eclipse.jpt.doc.user/ref_join_columns.htm
+++ /dev/null
@@ -1,50 +0,0 @@
-<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN"
- "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
-<html xmlns="http://www.w3.org/1999/xhtml" xml:lang="en" lang="en">
-<head>
-<meta http-equiv="Content-Type" content="text/html; charset=us-ascii" />
-
-<meta http-equiv="Content-Style-Type" content="text/css" />
-<meta http-equiv="Content-Script-Type" content="text/javascript" />
-<title>Join Columns</title>
-<meta name="generator" content="Oracle DARB XHTML Converter (Mode = ohj/ohw) - Version 5.1.1 Build 004" />
-<meta name="date" content="2009-05-01T8:12:50Z" />
-<meta name="robots" content="noarchive" />
-<meta name="doctitle" content="Join Columns" />
-<meta name="relnum" content="Release 2.2" />
-<meta name="copyright" content="Copyright (c) 2000, 2008 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. Contributors: Oracle - initial API and implementation" />
-<link rel="copyright" href="dcommon/html/cpyr.htm" title="Copyright" type="text/html" />
-<link rel="stylesheet" href="dcommon/css/blafdoc.css" title="Oracle BLAFDoc" type="text/css" />
-<!-- contents -->
-</head>
-<body>
-<p><a id="CIAEGEEG" name="CIAEGEEG"></a></p>
-<div class="sect3"><!-- infolevel="all" infotype="General" -->
-<h1>Join Columns</h1>
-<p><a id="sthref208" name="sthref208"></a>Use this dialog to specify the join columns of an association table.</p>
-<p>Click Add to specify the join columns between the two tables.</p>
-<p>&nbsp;</p>
-<img src="img/ngrelt.png" alt="Related task" title="Related task" /><br />
-<br />
-<a href="ref_create_new_association_wizard.htm#CIAFGHIF">Create New Association</a><br />
-<a href="tasks019.htm#BABBAGFI">Generating entities from tables</a><br />
-<a href="ref_persistence_prop_view.htm#BABFAEBB">JPA Details view (for entities)</a>
-<p>&nbsp;</p>
-<img src="img/ngrelr.png" alt="Related reference" title="Related reference" /><br />
-<br />
-<a href="ref_create_custom_entities_wizard.htm#CIAGBFJE">Generate Entities from Tables Wizard</a></div>
-<!-- class="sect3" -->
-<!-- Start Footer -->
-<div class="footer">
-<table class="simple oac_no_warn" summary="" cellspacing="0" cellpadding="0" width="100%">
-<col width="86%" />
-<col width="*" />
-<tr>
-<td align="left"><span class="copyrightlogo">Copyright&nbsp;&copy;&nbsp;2006, 2009,&nbsp;Oracle&nbsp;and/or&nbsp;its&nbsp;affiliates.&nbsp;All&nbsp;rights&nbsp;reserved.</span><br />
-<a href="dcommon/html/cpyr.htm"><span class="copyrightlogo">Legal Notices</span></a></td>
-</tr>
-</table>
-</div>
-<!-- class="footer" -->
-</body>
-</html>
diff --git a/jpa/plugins/org.eclipse.jpt.doc.user/ref_jpa_facet.htm b/jpa/plugins/org.eclipse.jpt.doc.user/ref_jpa_facet.htm
deleted file mode 100644
index 46b152fa0b..0000000000
--- a/jpa/plugins/org.eclipse.jpt.doc.user/ref_jpa_facet.htm
+++ /dev/null
@@ -1,122 +0,0 @@
-<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN"
- "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
-<html xmlns="http://www.w3.org/1999/xhtml" xml:lang="en" lang="en">
-<head>
-<meta http-equiv="Content-Type" content="text/html; charset=us-ascii" />
-
-<meta http-equiv="Content-Style-Type" content="text/css" />
-<meta http-equiv="Content-Script-Type" content="text/javascript" />
-<title>JPA Facet page</title>
-<meta name="generator" content="Oracle DARB XHTML Converter (Mode = ohj/ohw) - Version 5.1.1 Build 004" />
-<meta name="date" content="2009-05-01T8:12:49Z" />
-<meta name="robots" content="noarchive" />
-<meta name="doctitle" content="JPA Facet page" />
-<meta name="relnum" content="Release 2.2" />
-<meta name="copyright" content="Copyright (c) 2000, 2008 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. Contributors: Oracle - initial API and implementation" />
-<link rel="copyright" href="dcommon/html/cpyr.htm" title="Copyright" type="text/html" />
-<link rel="stylesheet" href="dcommon/css/blafdoc.css" title="Oracle BLAFDoc" type="text/css" />
-<!-- contents -->
-</head>
-<body>
-<p><a id="CACIFDIF" name="CACIFDIF"></a></p>
-<div class="sect3"><!-- infolevel="all" infotype="General" -->
-<h1>JPA Facet page</h1>
-<p>This table lists the properties available on the JPA Facet page of the <a href="ref_new_jpa_project_wizard.htm#CACBJGBG">Create New JPA Project wizard</a>.</p>
-<div class="inftblinformal">
-<table class="Informal" title="This table describes the options on the Generate DDL - Objects page." summary="This table describes the options on the Generate DDL - Objects page." dir="ltr" border="1" width="100%" frame="border" rules="all" cellpadding="3" cellspacing="0">
-<col width="24%" />
-<col width="*" />
-<col width="25%" />
-<thead>
-<tr align="left" valign="top">
-<th align="left" valign="bottom" id="r1c1-t4">Property</th>
-<th align="left" valign="bottom" id="r1c2-t4">Description</th>
-<th align="left" valign="bottom" id="r1c3-t4">Default</th>
-</tr>
-</thead>
-<tbody>
-<tr align="left" valign="top">
-<td align="left" id="r2c1-t4" headers="r1c1-t4">Platform</td>
-<td align="left" headers="r2c1-t4 r1c2-t4">Vendor-specific JPA implementation.</td>
-<td align="left" headers="r2c1-t4 r1c3-t4">EclipseLink</td>
-</tr>
-<tr align="left" valign="top">
-<td align="left" id="r3c1-t4" headers="r1c1-t4"><a id="sthref190" name="sthref190"></a><a id="sthref191" name="sthref191"></a>JPA Implementation</td>
-<td align="left" headers="r3c1-t4 r1c2-t4">Select a specific JPA library configuration.
-<p>Click <span class="bold">Manage libraries</span> to create or update a user library.</p>
-<p>Click <span class="bold">Download libraries</span> to download a specific library configuration.</p>
-</td>
-<td align="left" headers="r3c1-t4 r1c3-t4"><br /></td>
-</tr>
-<tr align="left" valign="top">
-<td align="left" id="r4c1-t4" headers="r1c1-t4">&nbsp;&nbsp;Type</td>
-<td align="left" headers="r4c1-t4 r1c2-t4">Select <span class="bold">User Library</span> to select from the available user-defined or downloaded libraries.
-<p>If you select Disable, you must manually include the JPA implementation library on the project classpath.</p>
-</td>
-<td align="left" headers="r4c1-t4 r1c3-t4">User Library</td>
-</tr>
-<tr align="left" valign="top">
-<td align="left" id="r5c1-t4" headers="r1c1-t4">&nbsp;&nbsp;Include libraries with this application</td>
-<td align="left" headers="r5c1-t4 r1c2-t4">Specify if the selected libraries are included when deploying the application.</td>
-<td align="left" headers="r5c1-t4 r1c3-t4">Selected</td>
-</tr>
-<tr align="left" valign="top">
-<td align="left" id="r6c1-t4" headers="r1c1-t4">Connection</td>
-<td align="left" headers="r6c1-t4 r1c2-t4">Select the database connection to use with the project. Dali requires an active database connection to use and validate the persistent entities and mappings.
-<p>Click <span class="bold">Add connection</span> to create a new database connection.</p>
-</td>
-<td align="left" headers="r6c1-t4 r1c3-t4"><br /></td>
-</tr>
-<tr align="left" valign="top">
-<td align="left" id="r7c1-t4" headers="r1c1-t4">&nbsp;&nbsp;Override&nbsp;default schema from connection</td>
-<td align="left" headers="r7c1-t4 r1c2-t4">Select a schema other than the default one that is derived from the connection information. Use this option if the default schema cannot be used. For example, use this option when the deployment login differs from the design-time login.</td>
-<td align="left" headers="r7c1-t4 r1c3-t4">The value calculated by Dali.</td>
-</tr>
-<tr align="left" valign="top">
-<td align="left" id="r8c1-t4" headers="r1c1-t4">JPA Implementation</td>
-<td align="left" headers="r8c1-t4 r1c2-t4">Select to use the <span class="bold">JPA implementation provided by the server at runtime</span>, or select a specific <span class="bold">implementation library</span> that contain the Java Persistence API (JPA) and entities to be added to the project's Java Build Path.
-<p>Click <span class="bold">Configure default JPA implementation library</span> to create a default library for the project or click <span class="bold">Configure user libraries</span> to define additional libraries.</p>
-<p>Depending on your JPA implementation (for example, Generic or EclipseLink), different options may be available when working with JPA projects.</p>
-</td>
-<td align="left" headers="r8c1-t4 r1c3-t4">Determined by server.</td>
-</tr>
-<tr align="left" valign="top">
-<td align="left" id="r9c1-t4" headers="r1c1-t4"><a id="sthref192" name="sthref192"></a>Persistent class management</td>
-<td align="left" headers="r9c1-t4 r1c2-t4">Specify if Dali will <span class="bold">discover annotated classes automatically</span>, or if the <span class="bold">annotated classes must be listed in the persistence.xml</span> file.
-<p><span class="bold">Note</span>: To insure application portability, you should explicitly list the managed persistence classes that are included in the persistence unit.</p>
-</td>
-<td align="left" headers="r9c1-t4 r1c3-t4">Determined by server.</td>
-</tr>
-<tr align="left" valign="top">
-<td align="left" id="r10c1-t4" headers="r1c1-t4"><a id="sthref193" name="sthref193"></a>Create <code>orm.xml</code></td>
-<td align="left" headers="r10c1-t4 r1c2-t4">Specify if Dali should create a default <code>orm.xml</code> file for your entity mappings and persistence unit defaults.</td>
-<td align="left" headers="r10c1-t4 r1c3-t4">Selected</td>
-</tr>
-</tbody>
-</table>
-<br /></div>
-<!-- class="inftblinformal" -->
-<p>&nbsp;</p>
-<img src="img/ngrelt.png" alt="Related task" title="Related task" /><br />
-<br />
-<a href="task_create_new_project.htm#CIHHEJCJ">Creating a new JPA project</a>
-<p>&nbsp;</p>
-<img src="img/ngrelr.png" alt="Related task" title="Related task" /><br />
-<br />
-<a href="ref_new_jpa_project_wizard.htm#CACBJGBG">Create New JPA Project wizard</a></div>
-<!-- class="sect3" -->
-<!-- class="sect2" -->
-<!-- Start Footer -->
-<div class="footer">
-<table class="simple oac_no_warn" summary="" cellspacing="0" cellpadding="0" width="100%">
-<col width="86%" />
-<col width="*" />
-<tr>
-<td align="left"><span class="copyrightlogo">Copyright&nbsp;&copy;&nbsp;2006, 2009,&nbsp;Oracle&nbsp;and/or&nbsp;its&nbsp;affiliates.&nbsp;All&nbsp;rights&nbsp;reserved.</span><br />
-<a href="dcommon/html/cpyr.htm"><span class="copyrightlogo">Legal Notices</span></a></td>
-</tr>
-</table>
-</div>
-<!-- class="footer" -->
-</body>
-</html>
diff --git a/jpa/plugins/org.eclipse.jpt.doc.user/ref_mapping_general.htm b/jpa/plugins/org.eclipse.jpt.doc.user/ref_mapping_general.htm
deleted file mode 100644
index d097c323b7..0000000000
--- a/jpa/plugins/org.eclipse.jpt.doc.user/ref_mapping_general.htm
+++ /dev/null
@@ -1,266 +0,0 @@
-<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN"
- "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
-<html xmlns="http://www.w3.org/1999/xhtml" xml:lang="en" lang="en">
-<head>
-<meta http-equiv="Content-Type" content="text/html; charset=us-ascii" />
-
-<meta http-equiv="Content-Style-Type" content="text/css" />
-<meta http-equiv="Content-Script-Type" content="text/javascript" />
-<title>General information</title>
-<meta name="generator" content="Oracle DARB XHTML Converter (Mode = ohj/ohw) - Version 5.1.1 Build 004" />
-<meta name="date" content="2009-05-01T8:12:51Z" />
-<meta name="robots" content="noarchive" />
-<meta name="doctitle" content="General information" />
-<meta name="relnum" content="Release 2.2" />
-<meta name="copyright" content="Copyright (c) 2000, 2008 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. Contributors: Oracle - initial API and implementation" />
-<link rel="copyright" href="dcommon/html/cpyr.htm" title="Copyright" type="text/html" />
-<link rel="stylesheet" href="dcommon/css/blafdoc.css" title="Oracle BLAFDoc" type="text/css" />
-<!-- contents -->
-</head>
-<body>
-<p><a id="CACBHFIJ" name="CACBHFIJ"></a></p>
-<div class="sect3"><!-- infolevel="all" infotype="General" -->
-<h1>General information</h1>
-<p>This table lists the General properties available in the <span class="gui-object-title">Java Details view</span> for each mapping type.</p>
-<div class="inftblruleinformal">
-<table class="RuleInformal" title="This table describes the options on the Persistence Properties view." summary="This table describes the options on the Persistence Properties view." dir="ltr" border="1" width="100%" frame="border" rules="all" cellpadding="3" cellspacing="0">
-<col width="21%" />
-<col width="*" />
-<col width="27%" />
-<col width="21%" />
-<thead>
-<tr align="left" valign="top">
-<th align="left" valign="bottom" id="r1c1-t16">Property</th>
-<th align="left" valign="bottom" id="r1c2-t16">Description</th>
-<th align="left" valign="bottom" id="r1c3-t16">Default</th>
-<th align="left" valign="bottom" id="r1c4-t16">Available for Mapping Type</th>
-</tr>
-</thead>
-<tbody>
-<tr align="left" valign="top">
-<td align="left" id="r2c1-t16" headers="r1c1-t16">Mapping Type Hyperlink</td>
-<td align="left" headers="r2c1-t16 r1c2-t16">Clicking the name of the mapping type, which is represented as a hyperlink, invokes the Mapping Type Selection dialog. Use this dialog to specify the type of attribute.</td>
-<td align="left" headers="r2c1-t16 r1c3-t16">Basic</td>
-<td align="left" headers="r2c1-t16 r1c4-t16">All mapping types</td>
-</tr>
-<tr align="left" valign="top">
-<td align="left" id="r3c1-t16" headers="r1c1-t16"><a id="CACGCBHB" name="CACGCBHB"></a>Column</td>
-<td align="left" headers="r3c1-t16 r1c2-t16"><a id="sthref230" name="sthref230"></a><a id="sthref231" name="sthref231"></a>The database column that contains the value for the attribute. This field corresponds to the <code>@Column</code> annotation.</td>
-<td align="left" headers="r3c1-t16 r1c3-t16">By default, the Column is assumed to be named identically to the attribute.</td>
-<td align="left" headers="r3c1-t16 r1c4-t16"><a href="tasks009.htm#BABBABCE">Basic mapping</a>, <a href="tasks010.htm#BABCBHDF">Embedded mapping</a>, <a href="tasks012.htm#BABGCBHG">ID mapping</a>, <a href="tasks018.htm#BABHIBII">Version mapping</a></td>
-</tr>
-<tr align="left" valign="top">
-<td align="left" id="r4c1-t16" headers="r1c1-t16">&nbsp;&nbsp;Name</td>
-<td align="left" headers="r4c1-t16 r1c2-t16">Name of the database column.
-<p>This field corresponds to the <code>@Column</code> annotation.</p>
-</td>
-<td align="left" headers="r4c1-t16 r1c3-t16"><br /></td>
-<td align="left" headers="r4c1-t16 r1c4-t16"><a href="tasks009.htm#BABBABCE">Basic mapping</a>, <a href="tasks010.htm#BABCBHDF">Embedded mapping</a>, <a href="tasks012.htm#BABGCBHG">ID mapping</a></td>
-</tr>
-<tr align="left" valign="top">
-<td align="left" id="r5c1-t16" headers="r1c1-t16">&nbsp;&nbsp;Table</td>
-<td align="left" headers="r5c1-t16 r1c2-t16">Name of the database table that contains the selected column.</td>
-<td align="left" headers="r5c1-t16 r1c3-t16"><br /></td>
-<td align="left" headers="r5c1-t16 r1c4-t16"><a href="tasks009.htm#BABBABCE">Basic mapping</a>, <a href="tasks010.htm#BABCBHDF">Embedded mapping</a>, <a href="tasks012.htm#BABGCBHG">ID mapping</a></td>
-</tr>
-<tr align="left" valign="top">
-<td align="left" id="r6c1-t16" headers="r1c1-t16">&nbsp;&nbsp;Insertable</td>
-<td align="left" headers="r6c1-t16 r1c2-t16">Specifies if the column is always included in <code>SQL INSERT</code> statements.</td>
-<td align="left" headers="r6c1-t16 r1c3-t16">True</td>
-<td align="left" headers="r6c1-t16 r1c4-t16"><a href="tasks009.htm#BABBABCE">Basic mapping</a>, <a href="tasks010.htm#BABCBHDF">Embedded mapping</a>, <a href="tasks012.htm#BABGCBHG">ID mapping</a></td>
-</tr>
-<tr align="left" valign="top">
-<td align="left" id="r7c1-t16" headers="r1c1-t16">&nbsp;&nbsp;Updatable</td>
-<td align="left" headers="r7c1-t16 r1c2-t16">Specifies if this column is always included in <code>SQL UPDATE</code> statements.</td>
-<td align="left" headers="r7c1-t16 r1c3-t16">True</td>
-<td align="left" headers="r7c1-t16 r1c4-t16"><a href="tasks009.htm#BABBABCE">Basic mapping</a>, <a href="tasks010.htm#BABCBHDF">Embedded mapping</a>, <a href="tasks012.htm#BABGCBHG">ID mapping</a></td>
-</tr>
-<tr align="left" valign="top">
-<td align="left" id="r8c1-t16" headers="r1c1-t16">&nbsp;&nbsp;Unique</td>
-<td align="left" headers="r8c1-t16 r1c2-t16">Sets the <code>UNIQUE</code> constraint for the column.</td>
-<td align="left" headers="r8c1-t16 r1c3-t16">False</td>
-<td align="left" headers="r8c1-t16 r1c4-t16"><a href="tasks009.htm#BABBABCE">Basic mapping</a>, <a href="tasks010.htm#BABCBHDF">Embedded mapping</a>, <a href="tasks012.htm#BABGCBHG">ID mapping</a></td>
-</tr>
-<tr align="left" valign="top">
-<td align="left" id="r9c1-t16" headers="r1c1-t16">&nbsp;&nbsp;Nullable</td>
-<td align="left" headers="r9c1-t16 r1c2-t16">Specifies if the column allows null values.</td>
-<td align="left" headers="r9c1-t16 r1c3-t16">True</td>
-<td align="left" headers="r9c1-t16 r1c4-t16"><a href="tasks009.htm#BABBABCE">Basic mapping</a>, <a href="tasks010.htm#BABCBHDF">Embedded mapping</a>, <a href="tasks012.htm#BABGCBHG">ID mapping</a></td>
-</tr>
-<tr align="left" valign="top">
-<td align="left" id="r10c1-t16" headers="r1c1-t16">&nbsp;&nbsp;Length</td>
-<td align="left" headers="r10c1-t16 r1c2-t16">Sets the column length.</td>
-<td align="left" headers="r10c1-t16 r1c3-t16">255</td>
-<td align="left" headers="r10c1-t16 r1c4-t16"><a href="tasks009.htm#BABBABCE">Basic mapping</a>, <a href="tasks010.htm#BABCBHDF">Embedded mapping</a>, <a href="tasks012.htm#BABGCBHG">ID mapping</a></td>
-</tr>
-<tr align="left" valign="top">
-<td align="left" id="r11c1-t16" headers="r1c1-t16">&nbsp;&nbsp;Precision</td>
-<td align="left" headers="r11c1-t16 r1c2-t16">Sets the precision for the column values.</td>
-<td align="left" headers="r11c1-t16 r1c3-t16">0</td>
-<td align="left" headers="r11c1-t16 r1c4-t16"><a href="tasks009.htm#BABBABCE">Basic mapping</a>, <a href="tasks010.htm#BABCBHDF">Embedded mapping</a>, <a href="tasks012.htm#BABGCBHG">ID mapping</a></td>
-</tr>
-<tr align="left" valign="top">
-<td align="left" id="r12c1-t16" headers="r1c1-t16">&nbsp;&nbsp;Scale</td>
-<td align="left" headers="r12c1-t16 r1c2-t16">Sets the number of digits that appear to the right of the decimal point.</td>
-<td align="left" headers="r12c1-t16 r1c3-t16">0</td>
-<td align="left" headers="r12c1-t16 r1c4-t16"><a href="tasks009.htm#BABBABCE">Basic mapping</a>, <a href="tasks010.htm#BABCBHDF">Embedded mapping</a>, <a href="tasks012.htm#BABGCBHG">ID mapping</a></td>
-</tr>
-<tr align="left" valign="top">
-<td align="left" id="r13c1-t16" headers="r1c1-t16">&nbsp;&nbsp;Column Definition</td>
-<td align="left" headers="r13c1-t16 r1c2-t16">Define the DDL for a column. This is used when a table is being generated.</td>
-<td align="left" headers="r13c1-t16 r1c3-t16"><br /></td>
-<td align="left" headers="r13c1-t16 r1c4-t16"><a href="tasks009.htm#BABBABCE">Basic mapping</a>, <a href="tasks010.htm#BABCBHDF">Embedded mapping</a>, <a href="tasks012.htm#BABGCBHG">ID mapping</a></td>
-</tr>
-<tr align="left" valign="top">
-<td align="left" id="r14c1-t16" headers="r1c1-t16"><a id="CACGGGHB" name="CACGGGHB"></a><a id="sthref232" name="sthref232"></a><a id="sthref233" name="sthref233"></a><a id="sthref234" name="sthref234"></a>Fetch Type</td>
-<td align="left" headers="r14c1-t16 r1c2-t16">Defines how data is loaded from the database:
-<ul>
-<li>
-<p>Eager &ndash; Data is loaded in before it is actually needed.</p>
-</li>
-<li>
-<p>Lazy &ndash; Data is loaded only when required by the transaction.</p>
-</li>
-</ul>
-</td>
-<td align="left" headers="r14c1-t16 r1c3-t16">Eager</td>
-<td align="left" headers="r14c1-t16 r1c4-t16"><a href="tasks009.htm#BABBABCE">Basic mapping</a>, <a href="tasks016.htm#BABFHBCJ">One-to-one mapping</a>, <a href="tasks013.htm#BABEIEGD">Many-to-many mapping</a>, <a href="tasks014.htm#BABHFAFJ">Many-to-one mapping</a></td>
-</tr>
-<tr align="left" valign="top">
-<td align="left" id="r15c1-t16" headers="r1c1-t16">Optional</td>
-<td align="left" headers="r15c1-t16 r1c2-t16">Specifies if this field is can be null.</td>
-<td align="left" headers="r15c1-t16 r1c3-t16">Yes</td>
-<td align="left" headers="r15c1-t16 r1c4-t16"><a href="tasks009.htm#BABBABCE">Basic mapping</a>, <a href="tasks016.htm#BABFHBCJ">One-to-one mapping</a>, <a href="tasks014.htm#BABHFAFJ">Many-to-one mapping</a></td>
-</tr>
-<tr align="left" valign="top">
-<td align="left" id="r16c1-t16" headers="r1c1-t16"><a id="CACBBIBI" name="CACBBIBI"></a><a id="sthref235" name="sthref235"></a>Lob</td>
-<td align="left" headers="r16c1-t16 r1c2-t16">Specify if the field is mapped to <code>java.sql.Clob</code> or <code>java.sql.Blob</code>.
-<p>This field corresponds to the <code>@Lob</code> annotation.</p>
-</td>
-<td align="left" headers="r16c1-t16 r1c3-t16"><br /></td>
-<td align="left" headers="r16c1-t16 r1c4-t16"><a href="tasks009.htm#BABBABCE">Basic mapping</a><br /></td>
-</tr>
-<tr align="left" valign="top">
-<td align="left" id="r17c1-t16" headers="r1c1-t16"><a id="CACEAJGD" name="CACEAJGD"></a><a id="sthref236" name="sthref236"></a><a id="sthref237" name="sthref237"></a><a id="sthref238" name="sthref238"></a>Temporal</td>
-<td align="left" headers="r17c1-t16 r1c2-t16">Specifies if this field is one of the following:
-<ul>
-<li>
-<p>Date &ndash; <code>java.sql.Date</code></p>
-</li>
-<li>
-<p>Time &ndash; <code>java.sql.Time</code></p>
-</li>
-<li>
-<p>Timestamp &ndash; <code>java.sql.Timestamp</code></p>
-</li>
-</ul>
-<p>This field corresponds to the <code>@Temporal</code> annotation.</p>
-</td>
-<td align="left" headers="r17c1-t16 r1c3-t16"><br /></td>
-<td align="left" headers="r17c1-t16 r1c4-t16"><a href="tasks009.htm#BABBABCE">Basic mapping</a>, <a href="tasks012.htm#BABGCBHG">ID mapping</a></td>
-</tr>
-<tr align="left" valign="top">
-<td align="left" id="r18c1-t16" headers="r1c1-t16"><a id="sthref239" name="sthref239"></a><a id="sthref240" name="sthref240"></a><a id="sthref241" name="sthref241"></a>Enumerated</td>
-<td align="left" headers="r18c1-t16 r1c2-t16">Specify how to persist enumerated constraints if the <code>String</code> value suits your application requirements or to match an existing database schema.
-<ul>
-<li>
-<p>ordinal</p>
-</li>
-<li>
-<p><code>String</code></p>
-</li>
-</ul>
-<p>This field corresponds to the <code>@Enumerated</code> annotation.</p>
-</td>
-<td align="left" headers="r18c1-t16 r1c3-t16">Ordinal</td>
-<td align="left" headers="r18c1-t16 r1c4-t16"><br /></td>
-</tr>
-<tr align="left" valign="top">
-<td align="left" id="r19c1-t16" headers="r1c1-t16">Target Entity</td>
-<td align="left" headers="r19c1-t16 r1c2-t16">The persistent entity to which the attribute is mapped.</td>
-<td align="left" headers="r19c1-t16 r1c3-t16"><br /></td>
-<td align="left" headers="r19c1-t16 r1c4-t16"><a href="tasks016.htm#BABFHBCJ">One-to-one mapping</a>, <a href="tasks015.htm#BABHGEBD">One-to-many mapping</a> <a href="tasks013.htm#BABEIEGD">Many-to-many mapping</a>, <a href="tasks014.htm#BABHFAFJ">Many-to-one mapping</a></td>
-</tr>
-<tr align="left" valign="top">
-<td align="left" id="r20c1-t16" headers="r1c1-t16"><a id="CACJAIHB" name="CACJAIHB"></a>Cascade Type</td>
-<td align="left" headers="r20c1-t16 r1c2-t16">Specify which operations are propagated throughout the entity.
-<ul>
-<li>
-<p>All &ndash; All operations</p>
-</li>
-<li>
-<p>Persist</p>
-</li>
-<li>
-<p>Merge</p>
-</li>
-<li>
-<p>Move</p>
-</li>
-<li>
-<p>Remove</p>
-</li>
-<li>
-<p>Refresh</p>
-</li>
-</ul>
-</td>
-<td align="left" headers="r20c1-t16 r1c3-t16"><br /></td>
-<td align="left" headers="r20c1-t16 r1c4-t16"><a href="tasks016.htm#BABFHBCJ">One-to-one mapping</a>, <a href="tasks015.htm#BABHGEBD">One-to-many mapping</a>, <a href="tasks013.htm#BABEIEGD">Many-to-many mapping</a>, <a href="tasks014.htm#BABHFAFJ">Many-to-one mapping</a></td>
-</tr>
-<tr align="left" valign="top">
-<td align="left" id="r21c1-t16" headers="r1c1-t16"><a id="CACJDJJA" name="CACJDJJA"></a>Mapped By</td>
-<td align="left" headers="r21c1-t16 r1c2-t16">The field in the database table that "owns" the relationship. This field is required only on the non-owning side of the relationship.</td>
-<td align="left" headers="r21c1-t16 r1c3-t16"><br /></td>
-<td align="left" headers="r21c1-t16 r1c4-t16"><a href="tasks016.htm#BABFHBCJ">One-to-one mapping</a>, <a href="tasks015.htm#BABHGEBD">One-to-many mapping</a></td>
-</tr>
-<tr align="left" valign="top">
-<td align="left" id="r22c1-t16" headers="r1c1-t16"><a id="CACDADIH" name="CACDADIH"></a><a id="sthref242" name="sthref242"></a><a id="sthref243" name="sthref243"></a>Order By</td>
-<td align="left" headers="r22c1-t16 r1c2-t16">Specify the default order for objects returned from a query:
-<ul>
-<li>
-<p>No ordering</p>
-</li>
-<li>
-<p>Primary key</p>
-</li>
-<li>
-<p>Custom ordering</p>
-</li>
-</ul>
-<p>This field corresponds to the <code>@OrderBy</code> annotation.</p>
-</td>
-<td align="left" headers="r22c1-t16 r1c3-t16">Primary key</td>
-<td align="left" headers="r22c1-t16 r1c4-t16"><a href="tasks015.htm#BABHGEBD">One-to-many mapping</a>. <a href="tasks013.htm#BABEIEGD">Many-to-many mapping</a>, <a href="tasks014.htm#BABHFAFJ">Many-to-one mapping</a></td>
-</tr>
-<tr align="left" valign="top">
-<td align="left" id="r23c1-t16" headers="r1c1-t16">Attribute Overrides</td>
-<td align="left" headers="r23c1-t16 r1c2-t16">Overrides <span class="bold">Basic</span> mappings of a mapped superclass (for example, if the inherited column name is incompatible with a pre-existing data model, or invalid as a column name in your database).</td>
-<td align="left" headers="r23c1-t16 r1c3-t16"><br /></td>
-<td align="left" headers="r23c1-t16 r1c4-t16"><a href="tasks010.htm#BABCBHDF">Embedded mapping</a>
-<p><a href="tasks010.htm#BABCBHDF">Embedded mapping</a></p>
-<br /></td>
-</tr>
-</tbody>
-</table>
-<br /></div>
-<!-- class="inftblruleinformal" -->
-<p>&nbsp;</p>
-<img src="img/ngrelt.png" alt="Related task" title="Related task" /><br />
-<br />
-<a href="task_mapping.htm#BABDGBIJ">Mapping an entity</a></div>
-<!-- class="sect3" -->
-<!-- Start Footer -->
-<div class="footer">
-<table class="simple oac_no_warn" summary="" cellspacing="0" cellpadding="0" width="100%">
-<col width="86%" />
-<col width="*" />
-<tr>
-<td align="left"><span class="copyrightlogo">Copyright&nbsp;&copy;&nbsp;2006, 2009,&nbsp;Oracle&nbsp;and/or&nbsp;its&nbsp;affiliates.&nbsp;All&nbsp;rights&nbsp;reserved.</span><br />
-<a href="dcommon/html/cpyr.htm"><span class="copyrightlogo">Legal Notices</span></a></td>
-</tr>
-</table>
-</div>
-<!-- class="footer" -->
-</body>
-</html>
diff --git a/jpa/plugins/org.eclipse.jpt.doc.user/ref_new_jpa_project.htm b/jpa/plugins/org.eclipse.jpt.doc.user/ref_new_jpa_project.htm
deleted file mode 100644
index 4f2e4a2998..0000000000
--- a/jpa/plugins/org.eclipse.jpt.doc.user/ref_new_jpa_project.htm
+++ /dev/null
@@ -1,104 +0,0 @@
-<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN"
- "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
-<html xmlns="http://www.w3.org/1999/xhtml" xml:lang="en" lang="en">
-<head>
-<meta http-equiv="Content-Type" content="text/html; charset=us-ascii" />
-
-<meta http-equiv="Content-Style-Type" content="text/css" />
-<meta http-equiv="Content-Script-Type" content="text/javascript" />
-<title>New JPA Project page</title>
-<meta name="generator" content="Oracle DARB XHTML Converter (Mode = ohj/ohw) - Version 5.1.1 Build 004" />
-<meta name="date" content="2009-05-01T8:12:49Z" />
-<meta name="robots" content="noarchive" />
-<meta name="doctitle" content="New JPA Project page" />
-<meta name="relnum" content="Release 2.2" />
-<meta name="copyright" content="Copyright (c) 2000, 2008 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. Contributors: Oracle - initial API and implementation" />
-<link rel="copyright" href="dcommon/html/cpyr.htm" title="Copyright" type="text/html" />
-<link rel="stylesheet" href="dcommon/css/blafdoc.css" title="Oracle BLAFDoc" type="text/css" />
-<!-- contents -->
-</head>
-<body>
-<p><a id="CACBJAGC" name="CACBJAGC"></a></p>
-<div class="sect3"><!-- infolevel="all" infotype="General" -->
-<h1>New JPA Project page</h1>
-<p>This table lists the properties available on the New JPA Project page of the <a href="ref_new_jpa_project_wizard.htm#CACBJGBG">Create New JPA Project wizard</a>.</p>
-<div class="inftblinformal">
-<table class="Informal" title="This table describes the options on the Generate DDL - Objects page." summary="This table describes the options on the Generate DDL - Objects page." dir="ltr" border="1" width="100%" frame="border" rules="all" cellpadding="3" cellspacing="0">
-<col width="24%" />
-<col width="*" />
-<col width="25%" />
-<thead>
-<tr align="left" valign="top">
-<th align="left" valign="bottom" id="r1c1-t2">Property</th>
-<th align="left" valign="bottom" id="r1c2-t2">Description</th>
-<th align="left" valign="bottom" id="r1c3-t2">Default</th>
-</tr>
-</thead>
-<tbody>
-<tr align="left" valign="top">
-<td align="left" id="r2c1-t2" headers="r1c1-t2">Project name</td>
-<td align="left" headers="r2c1-t2 r1c2-t2">Name of the Eclipse JPA project.</td>
-<td align="left" headers="r2c1-t2 r1c3-t2"><br /></td>
-</tr>
-<tr align="left" valign="top">
-<td align="left" id="r3c1-t2" headers="r1c1-t2">Project contents</td>
-<td align="left" headers="r3c1-t2 r1c2-t2">Location of the workspace in which to save the project.
-<p>Unselect The <span class="bold">Use Default</span> option and click <span class="bold">Browse</span> to select a new location.</p>
-</td>
-<td align="left" headers="r3c1-t2 r1c3-t2">Current workspace</td>
-</tr>
-<tr align="left" valign="top">
-<td align="left" id="r4c1-t2" headers="r1c1-t2">Target runtime</td>
-<td align="left" headers="r4c1-t2 r1c2-t2">Select a pre-defined target for the project.
-<p>Click <span class="bold">New</span> to create a new environment with the New Server Runtime wizard.</p>
-</td>
-<td align="left" headers="r4c1-t2 r1c3-t2"><br /></td>
-</tr>
-<tr align="left" valign="top">
-<td align="left" id="r5c1-t2" headers="r1c1-t2">Configurations</td>
-<td align="left" headers="r5c1-t2 r1c2-t2">Select a project configuration with pre-defined facets.
-<p>Select <span class="bold">&lt;custom&gt;</span> to manually select the facets for this project.</p>
-</td>
-<td align="left" headers="r5c1-t2 r1c3-t2">Utility JPA project with Java 5.0</td>
-</tr>
-<tr align="left" valign="top">
-<td align="left" id="r6c1-t2" headers="r1c1-t2">EAR membership</td>
-<td align="left" headers="r6c1-t2 r1c2-t2">Specify if this project should be included in an EAR file for deployment.
-<p>Select the <span class="bold">EAR Project Name</span>, or click <span class="bold">New</span> to create a new EAR project.</p>
-</td>
-<td align="left" headers="r6c1-t2 r1c3-t2"><br /></td>
-</tr>
-<tr align="left" valign="top">
-<td align="left" id="r7c1-t2" headers="r1c1-t2">Working sets</td>
-<td align="left" headers="r7c1-t2 r1c2-t2">Specify if this project should be included in an existing working set. The drop down field shows a list of previous selected working sets.
-<p>Select <span class="bold">Add project to working sets</span>, then select a working set in which to add this project.</p>
-</td>
-<td align="left" headers="r7c1-t2 r1c3-t2"><br /></td>
-</tr>
-</tbody>
-</table>
-<br /></div>
-<!-- class="inftblinformal" -->
-<p>&nbsp;</p>
-<img src="img/ngrelt.png" alt="Related task" title="Related task" /><br />
-<br />
-<a href="task_create_new_project.htm#CIHHEJCJ">Creating a new JPA project</a>
-<p>&nbsp;</p>
-<img src="img/ngrelr.png" alt="Related task" title="Related task" /><br />
-<br />
-<a href="ref_new_jpa_project_wizard.htm#CACBJGBG">Create New JPA Project wizard</a></div>
-<!-- class="sect3" -->
-<!-- Start Footer -->
-<div class="footer">
-<table class="simple oac_no_warn" summary="" cellspacing="0" cellpadding="0" width="100%">
-<col width="86%" />
-<col width="*" />
-<tr>
-<td align="left"><span class="copyrightlogo">Copyright&nbsp;&copy;&nbsp;2006, 2009,&nbsp;Oracle&nbsp;and/or&nbsp;its&nbsp;affiliates.&nbsp;All&nbsp;rights&nbsp;reserved.</span><br />
-<a href="dcommon/html/cpyr.htm"><span class="copyrightlogo">Legal Notices</span></a></td>
-</tr>
-</table>
-</div>
-<!-- class="footer" -->
-</body>
-</html>
diff --git a/jpa/plugins/org.eclipse.jpt.doc.user/ref_new_jpa_project_wizard.htm b/jpa/plugins/org.eclipse.jpt.doc.user/ref_new_jpa_project_wizard.htm
deleted file mode 100644
index 3192c83290..0000000000
--- a/jpa/plugins/org.eclipse.jpt.doc.user/ref_new_jpa_project_wizard.htm
+++ /dev/null
@@ -1,49 +0,0 @@
-<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN"
- "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
-<html xmlns="http://www.w3.org/1999/xhtml" xml:lang="en" lang="en">
-<head>
-<meta http-equiv="Content-Type" content="text/html; charset=us-ascii" />
-
-<meta http-equiv="Content-Style-Type" content="text/css" />
-<meta http-equiv="Content-Script-Type" content="text/javascript" />
-<title>Create New JPA Project wizard</title>
-<meta name="generator" content="Oracle DARB XHTML Converter (Mode = ohj/ohw) - Version 5.1.1 Build 004" />
-<meta name="date" content="2009-05-01T8:12:49Z" />
-<meta name="robots" content="noarchive" />
-<meta name="doctitle" content="Create New JPA Project wizard" />
-<meta name="relnum" content="Release 2.2" />
-<meta name="copyright" content="Copyright (c) 2000, 2008 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. Contributors: Oracle - initial API and implementation" />
-<link rel="copyright" href="dcommon/html/cpyr.htm" title="Copyright" type="text/html" />
-<link rel="stylesheet" href="dcommon/css/blafdoc.css" title="Oracle BLAFDoc" type="text/css" />
-<!-- contents -->
-</head>
-<body>
-<p><a id="CACBJGBG" name="CACBJGBG"></a></p>
-<div class="sect2"><!-- infolevel="all" infotype="General" -->
-<h1>Create New JPA Project wizard</h1>
-<p><a id="sthref189" name="sthref189"></a>The Create New JPA Project wizard allows you to create a new Java project using JPA. The wizard consists of the following pages:</p>
-<ul>
-<li>
-<p><a href="ref_new_jpa_project.htm#CACBJAGC">New JPA Project page</a></p>
-</li>
-<li>
-<p><a href="ref_java_page.htm#CIAGEBAA">Java Page</a></p>
-</li>
-<li>
-<p><a href="ref_jpa_facet.htm#CACIFDIF">JPA Facet page</a></p>
-</li>
-</ul>
-<!-- Start Footer -->
-<div class="footer">
-<table class="simple oac_no_warn" summary="" cellspacing="0" cellpadding="0" width="100%">
-<col width="86%" />
-<col width="*" />
-<tr>
-<td align="left"><span class="copyrightlogo">Copyright&nbsp;&copy;&nbsp;2006, 2009,&nbsp;Oracle&nbsp;and/or&nbsp;its&nbsp;affiliates.&nbsp;All&nbsp;rights&nbsp;reserved.</span><br />
-<a href="dcommon/html/cpyr.htm"><span class="copyrightlogo">Legal Notices</span></a></td>
-</tr>
-</table>
-</div>
-<!-- class="footer" --></div>
-</body>
-</html>
diff --git a/jpa/plugins/org.eclipse.jpt.doc.user/ref_persistence_general.htm b/jpa/plugins/org.eclipse.jpt.doc.user/ref_persistence_general.htm
deleted file mode 100644
index 10bfb40f96..0000000000
--- a/jpa/plugins/org.eclipse.jpt.doc.user/ref_persistence_general.htm
+++ /dev/null
@@ -1,119 +0,0 @@
-<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN"
- "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
-<html xmlns="http://www.w3.org/1999/xhtml" xml:lang="en" lang="en">
-<head>
-<meta http-equiv="Content-Type" content="text/html; charset=us-ascii" />
-
-<meta http-equiv="Content-Style-Type" content="text/css" />
-<meta http-equiv="Content-Script-Type" content="text/javascript" />
-<title>General</title>
-<meta name="generator" content="Oracle DARB XHTML Converter (Mode = ohj/ohw) - Version 5.1.1 Build 004" />
-<meta name="date" content="2009-05-01T8:12:52Z" />
-<meta name="robots" content="noarchive" />
-<meta name="doctitle" content="General" />
-<meta name="relnum" content="Release 2.2" />
-<meta name="copyright" content="Copyright (c) 2000, 2008 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. Contributors: Oracle - initial API and implementation" />
-<link rel="copyright" href="dcommon/html/cpyr.htm" title="Copyright" type="text/html" />
-<link rel="stylesheet" href="dcommon/css/blafdoc.css" title="Oracle BLAFDoc" type="text/css" />
-<!-- contents -->
-</head>
-<body>
-<p><a id="CIACIFGJ" name="CIACIFGJ"></a></p>
-<div class="sect3"><!-- infolevel="all" infotype="General" -->
-<h1>General</h1>
-<p>The following table lists properties available in the General page of the <a href="ref_persistence_xmll_editor.htm#CIACCHID">persistence.xml Editor</a>.</p>
-<div class="tblformal"><a id="sthref256" name="sthref256"></a><a id="sthref257" name="sthref257"></a>
-<p class="titleintable">Properties of the General Page</p>
-<table class="Formal" title="Properties of the General Page" summary="This table describes the properties of the persistence.xml&rsquo;s General page." dir="ltr" border="1" width="100%" frame="hsides" rules="groups" cellpadding="3" cellspacing="0">
-<col width="24%" />
-<col width="*" />
-<col width="24%" />
-<thead>
-<tr align="left" valign="top">
-<th align="left" valign="bottom" id="r1c1-t24">Property</th>
-<th align="left" valign="bottom" id="r1c2-t24">Description</th>
-<th align="left" valign="bottom" id="r1c3-t24">Default</th>
-</tr>
-</thead>
-<tbody>
-<tr align="left" valign="top">
-<td align="left" id="r2c1-t24" headers="r1c1-t24">
-<p>Name</p>
-</td>
-<td align="left" headers="r2c1-t24 r1c2-t24">
-<p>Enter the name of the persistence unit.</p>
-</td>
-<td align="left" headers="r2c1-t24 r1c3-t24">
-<p>The project name.</p>
-</td>
-</tr>
-<tr align="left" valign="top">
-<td align="left" id="r3c1-t24" headers="r1c1-t24">
-<p>Persistence Provider</p>
-</td>
-<td align="left" headers="r3c1-t24 r1c2-t24">
-<p>Enter the name of the persistence provider.</p>
-</td>
-<td align="left" headers="r3c1-t24 r1c3-t24">
-<p>Determined by the server.</p>
-</td>
-</tr>
-<tr align="left" valign="top">
-<td align="left" id="r4c1-t24" headers="r1c1-t24">
-<p>Description</p>
-</td>
-<td align="left" headers="r4c1-t24 r1c2-t24">
-<p>Enter a description for this persistence unit. This is an optional property.</p>
-</td>
-<td align="left" headers="r4c1-t24 r1c3-t24"><br /></td>
-</tr>
-<tr align="left" valign="top">
-<td align="left" id="r5c1-t24" headers="r1c1-t24">
-<p>Managed Classes</p>
-</td>
-<td align="left" headers="r5c1-t24 r1c2-t24">
-<p>Add or remove the classes managed through the persistence unit.</p>
-</td>
-<td align="left" headers="r5c1-t24 r1c3-t24"><br /></td>
-</tr>
-<tr align="left" valign="top">
-<td align="left" id="r6c1-t24" headers="r1c1-t24">
-<p>Exclude Unlisted Classes</p>
-</td>
-<td align="left" headers="r6c1-t24 r1c2-t24">
-<p>Select to include all annotated entity classes in the root of the persistence unit.</p>
-</td>
-<td align="left" headers="r6c1-t24 r1c3-t24">
-<p>False</p>
-</td>
-</tr>
-<tr align="left" valign="top">
-<td align="left" id="r7c1-t24" headers="r1c1-t24">
-<p>XML Mapping Files</p>
-</td>
-<td align="left" headers="r7c1-t24 r1c2-t24">
-<p>Add or remove the object/relational mapping XML files that define the classes to be managed by the persistence unit.</p>
-</td>
-<td align="left" headers="r7c1-t24 r1c3-t24">
-<p>Meta-INF\orm.xml</p>
-</td>
-</tr>
-</tbody>
-</table>
-<br /></div>
-<!-- class="tblformal" --></div>
-<!-- class="sect3" -->
-<!-- Start Footer -->
-<div class="footer">
-<table class="simple oac_no_warn" summary="" cellspacing="0" cellpadding="0" width="100%">
-<col width="86%" />
-<col width="*" />
-<tr>
-<td align="left"><span class="copyrightlogo">Copyright&nbsp;&copy;&nbsp;2006, 2009,&nbsp;Oracle&nbsp;and/or&nbsp;its&nbsp;affiliates.&nbsp;All&nbsp;rights&nbsp;reserved.</span><br />
-<a href="dcommon/html/cpyr.htm"><span class="copyrightlogo">Legal Notices</span></a></td>
-</tr>
-</table>
-</div>
-<!-- class="footer" -->
-</body>
-</html>
diff --git a/jpa/plugins/org.eclipse.jpt.doc.user/ref_persistence_map_view.htm b/jpa/plugins/org.eclipse.jpt.doc.user/ref_persistence_map_view.htm
deleted file mode 100644
index 8ff575f0af..0000000000
--- a/jpa/plugins/org.eclipse.jpt.doc.user/ref_persistence_map_view.htm
+++ /dev/null
@@ -1,52 +0,0 @@
-<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN"
- "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
-<html xmlns="http://www.w3.org/1999/xhtml" xml:lang="en" lang="en">
-<head>
-<meta http-equiv="Content-Type" content="text/html; charset=us-ascii" />
-
-<meta http-equiv="Content-Style-Type" content="text/css" />
-<meta http-equiv="Content-Script-Type" content="text/javascript" />
-<title>JPA Details view (for attributes)</title>
-<meta name="generator" content="Oracle DARB XHTML Converter (Mode = ohj/ohw) - Version 5.1.1 Build 004" />
-<meta name="date" content="2009-05-01T8:12:51Z" />
-<meta name="robots" content="noarchive" />
-<meta name="doctitle" content="JPA Details view (for attributes)" />
-<meta name="relnum" content="Release 2.2" />
-<meta name="copyright" content="Copyright (c) 2000, 2008 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. Contributors: Oracle - initial API and implementation" />
-<link rel="copyright" href="dcommon/html/cpyr.htm" title="Copyright" type="text/html" />
-<link rel="stylesheet" href="dcommon/css/blafdoc.css" title="Oracle BLAFDoc" type="text/css" />
-<!-- contents -->
-</head>
-<body>
-<p><a id="BABIFBAF" name="BABIFBAF"></a></p>
-<div class="sect2"><!-- infolevel="all" infotype="General" -->
-<h1>JPA Details view (for attributes)</h1>
-<p><a id="sthref227" name="sthref227"></a><a id="sthref228" name="sthref228"></a><a id="sthref229" name="sthref229"></a>The <span class="gui-object-title">JPA Details</span> view displays the persistence information for the currently selected mapped attribute and contains the following areas:</p>
-<ul>
-<li>
-<p><a href="ref_mapping_general.htm#CACBHFIJ">General information</a></p>
-</li>
-<li>
-<p><a href="reference011.htm#CACBAEBC">Join Table Information</a></p>
-</li>
-<li>
-<p><a href="reference012.htm#CACFCEJC">Join Columns Information</a></p>
-</li>
-<li>
-<p><a href="ref_primary_key.htm#CACFCCAB">Primary Key Generation information</a></p>
-</li>
-</ul>
-<!-- Start Footer -->
-<div class="footer">
-<table class="simple oac_no_warn" summary="" cellspacing="0" cellpadding="0" width="100%">
-<col width="86%" />
-<col width="*" />
-<tr>
-<td align="left"><span class="copyrightlogo">Copyright&nbsp;&copy;&nbsp;2006, 2009,&nbsp;Oracle&nbsp;and/or&nbsp;its&nbsp;affiliates.&nbsp;All&nbsp;rights&nbsp;reserved.</span><br />
-<a href="dcommon/html/cpyr.htm"><span class="copyrightlogo">Legal Notices</span></a></td>
-</tr>
-</table>
-</div>
-<!-- class="footer" --></div>
-</body>
-</html>
diff --git a/jpa/plugins/org.eclipse.jpt.doc.user/ref_persistence_outline.htm b/jpa/plugins/org.eclipse.jpt.doc.user/ref_persistence_outline.htm
deleted file mode 100644
index c2426f38bd..0000000000
--- a/jpa/plugins/org.eclipse.jpt.doc.user/ref_persistence_outline.htm
+++ /dev/null
@@ -1,49 +0,0 @@
-<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN"
- "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
-<html xmlns="http://www.w3.org/1999/xhtml" xml:lang="en" lang="en">
-<head>
-<meta http-equiv="Content-Type" content="text/html; charset=us-ascii" />
-
-<meta http-equiv="Content-Style-Type" content="text/css" />
-<meta http-equiv="Content-Script-Type" content="text/javascript" />
-<title>JPA Structure view</title>
-<meta name="generator" content="Oracle DARB XHTML Converter (Mode = ohj/ohw) - Version 5.1.1 Build 004" />
-<meta name="date" content="2009-05-01T8:12:52Z" />
-<meta name="robots" content="noarchive" />
-<meta name="doctitle" content="JPA Structure view" />
-<meta name="relnum" content="Release 2.2" />
-<meta name="copyright" content="Copyright (c) 2000, 2008 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. Contributors: Oracle - initial API and implementation" />
-<link rel="copyright" href="dcommon/html/cpyr.htm" title="Copyright" type="text/html" />
-<link rel="stylesheet" href="dcommon/css/blafdoc.css" title="Oracle BLAFDoc" type="text/css" />
-<!-- contents -->
-</head>
-<body>
-<p><a id="BABEGGFE" name="BABEGGFE"></a></p>
-<div class="sect2"><!-- infolevel="all" infotype="General" -->
-<h1>JPA Structure view</h1>
-<p><a id="sthref253" name="sthref253"></a><a id="sthref254" name="sthref254"></a>The <span class="gui-object-title">JPA Structure</span> view displays an outline of the structure (its attributes and mappings) of the entity that is currently selected or opened in the editor. The structural elements shown in the outline are the entity and its fields.</p>
-<div class="figure"><a id="sthref255" name="sthref255"></a>
-<p class="titleinfigure">Sample JPA Structure View</p>
-<img src="img/persistence_outline_view.png" alt="Sample JPA Structure view for an entity." title="Sample JPA Structure view for an entity." /><br /></div>
-<!-- class="figure" -->
-<p>&nbsp;</p>
-<img src="img/ngrelr.png" alt="Related reference" title="Related reference" /><br />
-<br />
-<a href="ref_persistence_perspective.htm#BABIFBDB">JPA Development perspective</a>
-<p>&nbsp;</p>
-</div>
-<!-- class="sect2" -->
-<!-- Start Footer -->
-<div class="footer">
-<table class="simple oac_no_warn" summary="" cellspacing="0" cellpadding="0" width="100%">
-<col width="86%" />
-<col width="*" />
-<tr>
-<td align="left"><span class="copyrightlogo">Copyright&nbsp;&copy;&nbsp;2006, 2009,&nbsp;Oracle&nbsp;and/or&nbsp;its&nbsp;affiliates.&nbsp;All&nbsp;rights&nbsp;reserved.</span><br />
-<a href="dcommon/html/cpyr.htm"><span class="copyrightlogo">Legal Notices</span></a></td>
-</tr>
-</table>
-</div>
-<!-- class="footer" -->
-</body>
-</html>
diff --git a/jpa/plugins/org.eclipse.jpt.doc.user/ref_persistence_perspective.htm b/jpa/plugins/org.eclipse.jpt.doc.user/ref_persistence_perspective.htm
deleted file mode 100644
index bf43ac376c..0000000000
--- a/jpa/plugins/org.eclipse.jpt.doc.user/ref_persistence_perspective.htm
+++ /dev/null
@@ -1,56 +0,0 @@
-<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN"
- "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
-<html xmlns="http://www.w3.org/1999/xhtml" xml:lang="en" lang="en">
-<head>
-<meta http-equiv="Content-Type" content="text/html; charset=us-ascii" />
-
-<meta http-equiv="Content-Style-Type" content="text/css" />
-<meta http-equiv="Content-Script-Type" content="text/javascript" />
-<title>JPA Development perspective</title>
-<meta name="generator" content="Oracle DARB XHTML Converter (Mode = ohj/ohw) - Version 5.1.1 Build 004" />
-<meta name="date" content="2009-05-01T8:12:52Z" />
-<meta name="robots" content="noarchive" />
-<meta name="doctitle" content="JPA Development perspective" />
-<meta name="relnum" content="Release 2.2" />
-<meta name="copyright" content="Copyright (c) 2000, 2008 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. Contributors: Oracle - initial API and implementation" />
-<link rel="copyright" href="dcommon/html/cpyr.htm" title="Copyright" type="text/html" />
-<link rel="stylesheet" href="dcommon/css/blafdoc.css" title="Oracle BLAFDoc" type="text/css" />
-<!-- contents -->
-</head>
-<body>
-<p><a id="BABIFBDB" name="BABIFBDB"></a></p>
-<div class="sect1"><!-- infolevel="all" infotype="General" -->
-<h1>JPA Development perspective</h1>
-<p><a id="sthref280" name="sthref280"></a><a id="sthref281" name="sthref281"></a>The <span class="bold">JPA Development perspective</span> defines the initial set and layout of views in the Workbench window when using Dali. By default, the <span class="gui-object-title">JPA Development perspective</span> includes the following views:</p>
-<ul>
-<li>
-<p><a href="ref_persistence_outline.htm#BABEGGFE">JPA Structure view</a></p>
-</li>
-<li>
-<p><a href="ref_persistence_prop_view.htm#BABFAEBB">JPA Details view (for entities)</a></p>
-</li>
-<li>
-<p><a href="ref_persistence_map_view.htm#BABIFBAF">JPA Details view (for attributes)</a></p>
-</li>
-<li>
-<p><a href="ref_details_orm.htm#CACGDGHC">JPA Details view (for orm.xml)</a></p>
-</li>
-</ul>
-<img src="img/ngrelc.png" alt="Related concept" title="Related concept" /><br />
-<p><a href="../org.eclipse.platform.doc.user/concepts/concepts-4.htm">Perspectives</a></p>
-</div>
-<!-- class="sect1" -->
-<!-- Start Footer -->
-<div class="footer">
-<table class="simple oac_no_warn" summary="" cellspacing="0" cellpadding="0" width="100%">
-<col width="86%" />
-<col width="*" />
-<tr>
-<td align="left"><span class="copyrightlogo">Copyright&nbsp;&copy;&nbsp;2006, 2009,&nbsp;Oracle&nbsp;and/or&nbsp;its&nbsp;affiliates.&nbsp;All&nbsp;rights&nbsp;reserved.</span><br />
-<a href="dcommon/html/cpyr.htm"><span class="copyrightlogo">Legal Notices</span></a></td>
-</tr>
-</table>
-</div>
-<!-- class="footer" -->
-</body>
-</html>
diff --git a/jpa/plugins/org.eclipse.jpt.doc.user/ref_persistence_prop_view.htm b/jpa/plugins/org.eclipse.jpt.doc.user/ref_persistence_prop_view.htm
deleted file mode 100644
index 107977280c..0000000000
--- a/jpa/plugins/org.eclipse.jpt.doc.user/ref_persistence_prop_view.htm
+++ /dev/null
@@ -1,52 +0,0 @@
-<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN"
- "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
-<html xmlns="http://www.w3.org/1999/xhtml" xml:lang="en" lang="en">
-<head>
-<meta http-equiv="Content-Type" content="text/html; charset=us-ascii" />
-
-<meta http-equiv="Content-Style-Type" content="text/css" />
-<meta http-equiv="Content-Script-Type" content="text/javascript" />
-<title>JPA Details view (for entities)</title>
-<meta name="generator" content="Oracle DARB XHTML Converter (Mode = ohj/ohw) - Version 5.1.1 Build 004" />
-<meta name="date" content="2009-05-01T8:12:50Z" />
-<meta name="robots" content="noarchive" />
-<meta name="doctitle" content="JPA Details view (for entities)" />
-<meta name="relnum" content="Release 2.2" />
-<meta name="copyright" content="Copyright (c) 2000, 2008 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. Contributors: Oracle - initial API and implementation" />
-<link rel="copyright" href="dcommon/html/cpyr.htm" title="Copyright" type="text/html" />
-<link rel="stylesheet" href="dcommon/css/blafdoc.css" title="Oracle BLAFDoc" type="text/css" />
-<!-- contents -->
-</head>
-<body>
-<p><a id="BABFAEBB" name="BABFAEBB"></a></p>
-<div class="sect2"><!-- infolevel="all" infotype="General" -->
-<h1>JPA Details view (for entities)</h1>
-<p><a id="sthref210" name="sthref210"></a><a id="sthref211" name="sthref211"></a><a id="sthref212" name="sthref212"></a>The <span class="gui-object-title">JPA Details</span> view displays the persistence information for the currently selected entity and contains the following tabs:</p>
-<ul>
-<li>
-<p><a href="reference006.htm#CACCAGGC">General information</a></p>
-</li>
-<li>
-<p><a href="reference007.htm#CACIJBGH">Attribute overrides</a></p>
-</li>
-<li>
-<p><a href="reference008.htm#CACBHIDA">Secondary table information</a></p>
-</li>
-<li>
-<p><a href="reference009.htm#CACFHGHE">Inheritance information</a></p>
-</li>
-</ul>
-<!-- Start Footer -->
-<div class="footer">
-<table class="simple oac_no_warn" summary="" cellspacing="0" cellpadding="0" width="100%">
-<col width="86%" />
-<col width="*" />
-<tr>
-<td align="left"><span class="copyrightlogo">Copyright&nbsp;&copy;&nbsp;2006, 2009,&nbsp;Oracle&nbsp;and/or&nbsp;its&nbsp;affiliates.&nbsp;All&nbsp;rights&nbsp;reserved.</span><br />
-<a href="dcommon/html/cpyr.htm"><span class="copyrightlogo">Legal Notices</span></a></td>
-</tr>
-</table>
-</div>
-<!-- class="footer" --></div>
-</body>
-</html>
diff --git a/jpa/plugins/org.eclipse.jpt.doc.user/ref_persistence_xmll_editor.htm b/jpa/plugins/org.eclipse.jpt.doc.user/ref_persistence_xmll_editor.htm
deleted file mode 100644
index cee6ee043c..0000000000
--- a/jpa/plugins/org.eclipse.jpt.doc.user/ref_persistence_xmll_editor.htm
+++ /dev/null
@@ -1,82 +0,0 @@
-<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN"
- "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
-<html xmlns="http://www.w3.org/1999/xhtml" xml:lang="en" lang="en">
-<head>
-<meta http-equiv="Content-Type" content="text/html; charset=us-ascii" />
-
-<meta http-equiv="Content-Style-Type" content="text/css" />
-<meta http-equiv="Content-Script-Type" content="text/javascript" />
-<title>persistence.xml Editor</title>
-<meta name="generator" content="Oracle DARB XHTML Converter (Mode = ohj/ohw) - Version 5.1.1 Build 004" />
-<meta name="date" content="2009-05-01T8:12:52Z" />
-<meta name="robots" content="noarchive" />
-<meta name="doctitle" content="persistence.xml Editor" />
-<meta name="relnum" content="Release 2.2" />
-<meta name="copyright" content="Copyright (c) 2000, 2008 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. Contributors: Oracle - initial API and implementation" />
-<link rel="copyright" href="dcommon/html/cpyr.htm" title="Copyright" type="text/html" />
-<link rel="stylesheet" href="dcommon/css/blafdoc.css" title="Oracle BLAFDoc" type="text/css" />
-<!-- contents -->
-</head>
-<body>
-<p><a id="CIACCHID" name="CIACCHID"></a></p>
-<div class="sect2"><!-- infolevel="all" infotype="General" -->
-<h1>persistence.xml Editor</h1>
-<p>The persistence.xml Editor provides an interface that enables you to update the persistence.xml file. For projects using the EclipseLink platform, the perisistence.xml Editor consists of the following pages:</p>
-<ul>
-<li>
-<p><a href="ref_persistence_general.htm#CIACIFGJ">General</a></p>
-</li>
-<li>
-<p><a href="reference018.htm#CIAFFJIE">Connection</a></p>
-</li>
-<li>
-<p><a href="reference019.htm#CIAJAFEG">Customization</a></p>
-</li>
-<li>
-<p><a href="reference020.htm#CIABEDCH">Caching</a></p>
-</li>
-<li>
-<p><a href="reference021.htm#CIABGHHI">Logging</a></p>
-</li>
-<li>
-<p><a href="reference022.htm#CIAFJCHE">Options</a></p>
-</li>
-<li>
-<p><a href="reference023.htm#CIACCFCB">Schema Generation</a></p>
-</li>
-<li>
-<p><a href="reference024.htm#CIAHJDFF">Properties</a></p>
-</li>
-<li>
-<p><a href="reference025.htm#CIAHCJAH">Source</a></p>
-</li>
-</ul>
-<p>For projects using the Generic platform, the following subset of these pages is available:</p>
-<ul>
-<li>
-<p><a href="ref_persistence_general.htm#CIACIFGJ">General</a></p>
-</li>
-<li>
-<p><a href="reference018.htm#CIAFFJIE">Connection</a></p>
-</li>
-<li>
-<p><a href="reference024.htm#CIAHJDFF">Properties</a></p>
-</li>
-<li>
-<p><a href="reference025.htm#CIAHCJAH">Source</a></p>
-</li>
-</ul>
-<!-- Start Footer -->
-<div class="footer">
-<table class="simple oac_no_warn" summary="" cellspacing="0" cellpadding="0" width="100%">
-<col width="86%" />
-<col width="*" />
-<tr>
-<td align="left"><span class="copyrightlogo">Copyright&nbsp;&copy;&nbsp;2006, 2009,&nbsp;Oracle&nbsp;and/or&nbsp;its&nbsp;affiliates.&nbsp;All&nbsp;rights&nbsp;reserved.</span><br />
-<a href="dcommon/html/cpyr.htm"><span class="copyrightlogo">Legal Notices</span></a></td>
-</tr>
-</table>
-</div>
-<!-- class="footer" --></div>
-</body>
-</html>
diff --git a/jpa/plugins/org.eclipse.jpt.doc.user/ref_primary_key.htm b/jpa/plugins/org.eclipse.jpt.doc.user/ref_primary_key.htm
deleted file mode 100644
index e9983540d8..0000000000
--- a/jpa/plugins/org.eclipse.jpt.doc.user/ref_primary_key.htm
+++ /dev/null
@@ -1,142 +0,0 @@
-<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN"
- "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
-<html xmlns="http://www.w3.org/1999/xhtml" xml:lang="en" lang="en">
-<head>
-<meta http-equiv="Content-Type" content="text/html; charset=us-ascii" />
-
-<meta http-equiv="Content-Style-Type" content="text/css" />
-<meta http-equiv="Content-Script-Type" content="text/javascript" />
-<title>Primary Key Generation information</title>
-<meta name="generator" content="Oracle DARB XHTML Converter (Mode = ohj/ohw) - Version 5.1.1 Build 004" />
-<meta name="date" content="2009-05-01T8:12:51Z" />
-<meta name="robots" content="noarchive" />
-<meta name="doctitle" content="Primary Key Generation information" />
-<meta name="relnum" content="Release 2.2" />
-<meta name="copyright" content="Copyright (c) 2000, 2008 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. Contributors: Oracle - initial API and implementation" />
-<link rel="copyright" href="dcommon/html/cpyr.htm" title="Copyright" type="text/html" />
-<link rel="stylesheet" href="dcommon/css/blafdoc.css" title="Oracle BLAFDoc" type="text/css" />
-<!-- contents -->
-</head>
-<body>
-<p><a id="CACFCCAB" name="CACFCCAB"></a></p>
-<div class="sect3"><!-- infolevel="all" infotype="General" -->
-<h1>Primary Key Generation information</h1>
-<p>This table lists the fields available in the <span class="gui-object-title">Primary Key Generation</span> area in JPA Details view for <a href="tasks012.htm#BABGCBHG">ID mapping</a> types.</p>
-<div class="inftblruleinformal">
-<table class="RuleInformal" title="This table describes the options on the Join Columns tab." summary="This table describes the options on the Join Columns tab." dir="ltr" border="1" width="100%" frame="border" rules="all" cellpadding="3" cellspacing="0">
-<col width="26%" />
-<col width="*" />
-<col width="34%" />
-<thead>
-<tr align="left" valign="top">
-<th align="left" valign="bottom" id="r1c1-t19">Property</th>
-<th align="left" valign="bottom" id="r1c2-t19">Description</th>
-<th align="left" valign="bottom" id="r1c3-t19">Default</th>
-</tr>
-</thead>
-<tbody>
-<tr align="left" valign="top">
-<td align="left" id="r2c1-t19" headers="r1c1-t19"><a id="CACBAJBC" name="CACBAJBC"></a>Primary Key Generation</td>
-<td align="left" headers="r2c1-t19 r1c2-t19"><a id="sthref249" name="sthref249"></a><a id="sthref250" name="sthref250"></a>These fields define how the primary key is generated. These fields correspond to the <code>@GeneratedValue</code> annotation.</td>
-<td align="left" headers="r2c1-t19 r1c3-t19">Generated Value</td>
-</tr>
-<tr align="left" valign="top">
-<td align="left" id="r3c1-t19" headers="r1c1-t19"><a id="CACJEEEC" name="CACJEEEC"></a>&nbsp;&nbsp;&nbsp;Strategy</td>
-<td align="left" headers="r3c1-t19 r1c2-t19">
-<ul>
-<li>Auto</li>
-<li>
-<p>Identity &ndash; Values are assigned by the database's <span class="bold">Identity</span> column.</p>
-</li>
-<li>
-<p>Sequence &ndash; Values are assigned by a sequence table (see <a href="#CACFFHEH">Sequence&nbsp;Generator</a>).</p>
-</li>
-<li>
-<p>Table &ndash; Values are assigned by a database table (see <a href="#CACGFEAH">Table Generator</a>).</p>
-</li>
-</ul>
-</td>
-<td align="left" headers="r3c1-t19 r1c3-t19">Auto</td>
-</tr>
-<tr align="left" valign="top">
-<td align="left" id="r4c1-t19" headers="r1c1-t19"><a id="BABEEAHJ" name="BABEEAHJ"></a>&nbsp;&nbsp;Generator Name</td>
-<td align="left" headers="r4c1-t19 r1c2-t19">Unique name of the generated value.</td>
-<td align="left" headers="r4c1-t19 r1c3-t19"><br /></td>
-</tr>
-<tr align="left" valign="top">
-<td align="left" id="r5c1-t19" headers="r1c1-t19"><a id="CACGFEAH" name="CACGFEAH"></a>Table Generator</td>
-<td align="left" headers="r5c1-t19 r1c2-t19">These fields define the database table used for generating the primary key and correspond to the <code>@TableGenerator</code> annotation.
-<p>These fields apply only when <span class="bold">Strategy</span>&nbsp;=&nbsp;<span class="bold">Table</span>.</p>
-</td>
-<td align="left" headers="r5c1-t19 r1c3-t19"><br /></td>
-</tr>
-<tr align="left" valign="top">
-<td align="left" id="r6c1-t19" headers="r1c1-t19">&nbsp;&nbsp;Name</td>
-<td align="left" headers="r6c1-t19 r1c2-t19">Unique name of the generator.</td>
-<td align="left" headers="r6c1-t19 r1c3-t19"><br /></td>
-</tr>
-<tr align="left" valign="top">
-<td align="left" id="r7c1-t19" headers="r1c1-t19">&nbsp;&nbsp;Table</td>
-<td align="left" headers="r7c1-t19 r1c2-t19">Database table that stores the generated ID values.</td>
-<td align="left" headers="r7c1-t19 r1c3-t19"><br /></td>
-</tr>
-<tr align="left" valign="top">
-<td align="left" id="r8c1-t19" headers="r1c1-t19">&nbsp;&nbsp;Primary Key Column</td>
-<td align="left" headers="r8c1-t19 r1c2-t19">The column in the table generator's <span class="bold">Table</span> that contains the primary key.</td>
-<td align="left" headers="r8c1-t19 r1c3-t19"><br /></td>
-</tr>
-<tr align="left" valign="top">
-<td align="left" id="r9c1-t19" headers="r1c1-t19">&nbsp;&nbsp;Value Column</td>
-<td align="left" headers="r9c1-t19 r1c2-t19">The column that stores the generated ID values.</td>
-<td align="left" headers="r9c1-t19 r1c3-t19"><br /></td>
-</tr>
-<tr align="left" valign="top">
-<td align="left" id="r10c1-t19" headers="r1c1-t19">&nbsp;&nbsp;Primary Key Column Value</td>
-<td align="left" headers="r10c1-t19 r1c2-t19">The value for the <span class="bold">Primary Key Column</span> in the generator table.</td>
-<td align="left" headers="r10c1-t19 r1c3-t19"><br /></td>
-</tr>
-<tr align="left" valign="top">
-<td align="left" id="r11c1-t19" headers="r1c1-t19"><a id="CACFFHEH" name="CACFFHEH"></a>Sequence&nbsp;Generator</td>
-<td align="left" headers="r11c1-t19 r1c2-t19"><a id="sthref251" name="sthref251"></a><a id="sthref252" name="sthref252"></a>These fields define the specific sequence used for generating the primary key and correspond to the <code>@SequenceGenerator</code> annotation.
-<p>These fields apply only when <span class="bold">Strategy</span> = <span class="bold">Sequence</span>.</p>
-</td>
-<td align="left" headers="r11c1-t19 r1c3-t19"><br /></td>
-</tr>
-<tr align="left" valign="top">
-<td align="left" id="r12c1-t19" headers="r1c1-t19">&nbsp;&nbsp;Name</td>
-<td align="left" headers="r12c1-t19 r1c2-t19">Name of the sequence table to use for defining primary key values.</td>
-<td align="left" headers="r12c1-t19 r1c3-t19"><br /></td>
-</tr>
-<tr align="left" valign="top">
-<td align="left" id="r13c1-t19" headers="r1c1-t19">&nbsp;&nbsp;Sequence</td>
-<td align="left" headers="r13c1-t19 r1c2-t19">Unique name of the sequence.</td>
-<td align="left" headers="r13c1-t19 r1c3-t19"><br /></td>
-</tr>
-</tbody>
-</table>
-<br /></div>
-<!-- class="inftblruleinformal" -->
-<p>&nbsp;</p>
-<img src="img/ngrelt.png" alt="Related task" title="Related task" /><br />
-<br />
-<a href="tasks012.htm#BABGCBHG">ID mapping</a>
-<p>&nbsp;</p>
-<img src="img/ngrelr.png" alt="Related task" title="Related task" /><br />
-<br />
-<a href="ref_persistence_map_view.htm#BABIFBAF">JPA Details view (for attributes)</a></div>
-<!-- class="sect3" -->
-<!-- class="sect2" -->
-<!-- Start Footer -->
-<div class="footer">
-<table class="simple oac_no_warn" summary="" cellspacing="0" cellpadding="0" width="100%">
-<col width="86%" />
-<col width="*" />
-<tr>
-<td align="left"><span class="copyrightlogo">Copyright&nbsp;&copy;&nbsp;2006, 2009,&nbsp;Oracle&nbsp;and/or&nbsp;its&nbsp;affiliates.&nbsp;All&nbsp;rights&nbsp;reserved.</span><br />
-<a href="dcommon/html/cpyr.htm"><span class="copyrightlogo">Legal Notices</span></a></td>
-</tr>
-</table>
-</div>
-<!-- class="footer" -->
-</body>
-</html>
diff --git a/jpa/plugins/org.eclipse.jpt.doc.user/ref_project_properties.htm b/jpa/plugins/org.eclipse.jpt.doc.user/ref_project_properties.htm
deleted file mode 100644
index e0c5dadd28..0000000000
--- a/jpa/plugins/org.eclipse.jpt.doc.user/ref_project_properties.htm
+++ /dev/null
@@ -1,108 +0,0 @@
-<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN"
- "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
-<html xmlns="http://www.w3.org/1999/xhtml" xml:lang="en" lang="en">
-<head>
-<meta http-equiv="Content-Type" content="text/html; charset=us-ascii" />
-
-<meta http-equiv="Content-Style-Type" content="text/css" />
-<meta http-equiv="Content-Script-Type" content="text/javascript" />
-<title>Project Properties page &ndash; Java Persistence Options</title>
-<meta name="generator" content="Oracle DARB XHTML Converter (Mode = ohj/ohw) - Version 5.1.1 Build 004" />
-<meta name="date" content="2009-05-01T8:12:52Z" />
-<meta name="robots" content="noarchive" />
-<meta name="doctitle" content="Project Properties page &ndash; Java Persistence Options" />
-<meta name="relnum" content="Release 2.2" />
-<meta name="copyright" content="Copyright (c) 2000, 2008 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. Contributors: Oracle - initial API and implementation" />
-<link rel="copyright" href="dcommon/html/cpyr.htm" title="Copyright" type="text/html" />
-<link rel="stylesheet" href="dcommon/css/blafdoc.css" title="Oracle BLAFDoc" type="text/css" />
-<!-- contents -->
-</head>
-<body>
-<p><a id="BABJHBCI" name="BABJHBCI"></a></p>
-<div class="sect2"><!-- infolevel="all" infotype="General" -->
-<h1>Project Properties page &ndash; Java Persistence Options</h1>
-<p><a id="sthref271" name="sthref271"></a><a id="sthref272" name="sthref272"></a>Use the <span class="gui-object-title">Java Persistence</span> options on the <span class="gui-object-title">Properties</span> page to select the database connection to use with the project.</p>
-<p>This table lists the properties available in the <span class="gui-object-title">JPA Details page</span>.</p>
-<div class="inftblinformal">
-<table class="Informal" title="This table describes the options on the Persistence Properties page." summary="This table describes the options on the Persistence Properties page." dir="ltr" border="1" width="100%" frame="border" rules="all" cellpadding="3" cellspacing="0">
-<col width="32%" />
-<col width="*" />
-<thead>
-<tr align="left" valign="top">
-<th align="left" valign="bottom" id="r1c1-t36">Property</th>
-<th align="left" valign="bottom" id="r1c2-t36">Description</th>
-</tr>
-</thead>
-<tbody>
-<tr align="left" valign="top">
-<td align="left" id="r2c1-t36" headers="r1c1-t36"><a id="sthref273" name="sthref273"></a><a id="sthref274" name="sthref274"></a><a id="sthref275" name="sthref275"></a><a id="sthref276" name="sthref276"></a>Platform</td>
-<td align="left" headers="r2c1-t36 r1c2-t36">Select the vendor-specific platform.</td>
-</tr>
-<tr align="left" valign="top">
-<td align="left" id="r3c1-t36" headers="r1c1-t36">Library</td>
-<td align="left" headers="r3c1-t36 r1c2-t36">Select a specific JPA library configuration.
-<p>Click <span class="bold">Manage libraries</span> to create or update a user library.</p>
-<p>Click <span class="bold">Download libraries</span> to download a specific library configuration.</p>
-</td>
-</tr>
-<tr align="left" valign="top">
-<td align="left" id="r4c1-t36" headers="r1c1-t36">&nbsp;&nbsp;Type</td>
-<td align="left" headers="r4c1-t36 r1c2-t36">Select <span class="bold">User Library</span> to select from the available user-defined or downloaded libraries.
-<p>If you select Disable, you must manually include the JPA implementation library on the project classpath.</p>
-</td>
-</tr>
-<tr align="left" valign="top">
-<td align="left" id="r5c1-t36" headers="r1c1-t36">&nbsp;&nbsp;Include&nbsp;libraries&nbsp;with&nbsp;this&nbsp;application</td>
-<td align="left" headers="r5c1-t36 r1c2-t36">Specify if the selected libraries are included when deploying the application.</td>
-</tr>
-<tr align="left" valign="top">
-<td align="left" id="r6c1-t36" headers="r1c1-t36"><a id="sthref277" name="sthref277"></a><a id="sthref278" name="sthref278"></a><a id="sthref279" name="sthref279"></a>Connection</td>
-<td align="left" headers="r6c1-t36 r1c2-t36">The database connection used to map the persistent entities.
-<ul>
-<li>
-<p>To create a new connection, click <span class="bold">Add Connections</span>.</p>
-</li>
-<li>
-<p>To reconnect to an existing connection, click <span class="bold">Reconnect</span>.</p>
-</li>
-</ul>
-</td>
-</tr>
-<tr align="left" valign="top">
-<td align="left" id="r7c1-t36" headers="r1c1-t36">&nbsp;&nbsp;Override&nbsp;default&nbsp;catalog&nbsp;from&nbsp;connection</td>
-<td align="left" headers="r7c1-t36 r1c2-t36">Select a catalog other than the default one derived from the connection information. Use this option if the default catalog is incorrect or cannot be used.</td>
-</tr>
-<tr align="left" valign="top">
-<td align="left" id="r8c1-t36" headers="r1c1-t36">&nbsp;&nbsp;Override&nbsp;default&nbsp;schema&nbsp;from&nbsp;connection</td>
-<td align="left" headers="r8c1-t36 r1c2-t36">Select a schema other than the default one derived from the connection information. Use this option if the default schema is incorrect or cannot be used. For example, use this option when the deployment login differs from the design-time login.</td>
-</tr>
-<tr align="left" valign="top">
-<td align="left" id="r9c1-t36" headers="r1c1-t36">Persistent Class Management</td>
-<td align="left" headers="r9c1-t36 r1c2-t36">Specify if Dali will <span class="bold">discover annotated classes automatically</span>, or if the <span class="bold">annotated classes must be listed in the persistence.xml</span> file.
-<p><span class="bold">Note</span>: To insure application portability, you should explicitly list the managed persistence classes that are included in the persistence unit.</p>
-</td>
-</tr>
-</tbody>
-</table>
-<br /></div>
-<!-- class="inftblinformal" -->
-<p>&nbsp;</p>
-<img src="img/ngrelt.png" alt="Related task" title="Related task" /><br />
-<br />
-<a href="tasks024.htm#BABDBCBI">Modifying persistent project properties</a></div>
-<!-- class="sect2" -->
-<!-- class="sect1" -->
-<!-- Start Footer -->
-<div class="footer">
-<table class="simple oac_no_warn" summary="" cellspacing="0" cellpadding="0" width="100%">
-<col width="86%" />
-<col width="*" />
-<tr>
-<td align="left"><span class="copyrightlogo">Copyright&nbsp;&copy;&nbsp;2006, 2009,&nbsp;Oracle&nbsp;and/or&nbsp;its&nbsp;affiliates.&nbsp;All&nbsp;rights&nbsp;reserved.</span><br />
-<a href="dcommon/html/cpyr.htm"><span class="copyrightlogo">Legal Notices</span></a></td>
-</tr>
-</table>
-</div>
-<!-- class="footer" -->
-</body>
-</html>
diff --git a/jpa/plugins/org.eclipse.jpt.doc.user/ref_selectTables.htm b/jpa/plugins/org.eclipse.jpt.doc.user/ref_selectTables.htm
deleted file mode 100644
index 83e9cba92b..0000000000
--- a/jpa/plugins/org.eclipse.jpt.doc.user/ref_selectTables.htm
+++ /dev/null
@@ -1,79 +0,0 @@
-<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN"
- "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
-<html xmlns="http://www.w3.org/1999/xhtml" xml:lang="en" lang="en">
-<head>
-<meta http-equiv="Content-Type" content="text/html; charset=us-ascii" />
-
-<meta http-equiv="Content-Style-Type" content="text/css" />
-<meta http-equiv="Content-Script-Type" content="text/javascript" />
-<title>Select Tables</title>
-<meta name="generator" content="Oracle DARB XHTML Converter (Mode = ohj/ohw) - Version 5.1.1 Build 004" />
-<meta name="date" content="2009-05-01T8:12:50Z" />
-<meta name="robots" content="noarchive" />
-<meta name="doctitle" content="Select Tables" />
-<meta name="relnum" content="Release 2.2" />
-<meta name="copyright" content="Copyright (c) 2000, 2008 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. Contributors: Oracle - initial API and implementation" />
-<link rel="copyright" href="dcommon/html/cpyr.htm" title="Copyright" type="text/html" />
-<link rel="stylesheet" href="dcommon/css/blafdoc.css" title="Oracle BLAFDoc" type="text/css" />
-<!-- contents -->
-</head>
-<body>
-<p><a id="CIAHCGEE" name="CIAHCGEE"></a></p>
-<div class="sect3"><!-- infolevel="all" infotype="General" -->
-<h1>Select Tables</h1>
-<p><a id="sthref200" name="sthref200"></a><a id="sthref201" name="sthref201"></a><a id="sthref202" name="sthref202"></a>Use the <span class="gui-object-title">Select Tables</span> dialog to specify the database connection and tables from which to create entities.</p>
-<div class="inftblinformal">
-<table class="Informal" title="This table describes the options on the Generate Entities dialog." summary="This table describes the options on the Generate Entities dialog." dir="ltr" border="1" width="100%" frame="border" rules="all" cellpadding="3" cellspacing="0">
-<col width="32%" />
-<col width="*" />
-<thead>
-<tr align="left" valign="top">
-<th align="left" valign="bottom" id="r1c1-t8">Property</th>
-<th align="left" valign="bottom" id="r1c2-t8">Description</th>
-</tr>
-</thead>
-<tbody>
-<tr align="left" valign="top">
-<td align="left" id="r2c1-t8" headers="r1c1-t8">Connection</td>
-<td align="left" headers="r2c1-t8 r1c2-t8">Select a database connection or click <span class="bold">Add Connection</span> to create a new connection.</td>
-</tr>
-<tr align="left" valign="top">
-<td align="left" id="r3c1-t8" headers="r1c1-t8">Schema</td>
-<td align="left" headers="r3c1-t8 r1c2-t8">Select the database schema from which to select tables.</td>
-</tr>
-<tr align="left" valign="top">
-<td align="left" id="r4c1-t8" headers="r1c1-t8">Tables</td>
-<td align="left" headers="r4c1-t8 r1c2-t8">Select the tables from which to create Java persistent entities. The tables shown are determined by the database connection and schema selections.</td>
-</tr>
-<tr align="left" valign="top">
-<td align="left" id="r5c1-t8" headers="r1c1-t8">Synchronize Classes listed in persistence.xml</td>
-<td align="left" headers="r5c1-t8 r1c2-t8">Specify if Dali should update the <code>persistence.xml</code> file to include the generated classes.</td>
-</tr>
-</tbody>
-</table>
-<br /></div>
-<!-- class="inftblinformal" -->
-<p>&nbsp;</p>
-<img src="img/ngrelt.png" alt="Related task" title="Related task" /><br />
-<br />
-<a href="task_create_jpa_entity.htm#BABFBJBG">Creating a JPA Entity</a><br />
-<a href="tasks019.htm#BABBAGFI">Generating entities from tables</a>
-<p>&nbsp;</p>
-<img src="img/ngrelr.png" alt="Related reference" title="Related reference" /><br />
-<br />
-<a href="ref_create_custom_entities_wizard.htm#CIAGBFJE">Generate Entities from Tables Wizard</a></div>
-<!-- class="sect3" -->
-<!-- Start Footer -->
-<div class="footer">
-<table class="simple oac_no_warn" summary="" cellspacing="0" cellpadding="0" width="100%">
-<col width="86%" />
-<col width="*" />
-<tr>
-<td align="left"><span class="copyrightlogo">Copyright&nbsp;&copy;&nbsp;2006, 2009,&nbsp;Oracle&nbsp;and/or&nbsp;its&nbsp;affiliates.&nbsp;All&nbsp;rights&nbsp;reserved.</span><br />
-<a href="dcommon/html/cpyr.htm"><span class="copyrightlogo">Legal Notices</span></a></td>
-</tr>
-</table>
-</div>
-<!-- class="footer" -->
-</body>
-</html>
diff --git a/jpa/plugins/org.eclipse.jpt.doc.user/ref_select_cascade_dialog.htm b/jpa/plugins/org.eclipse.jpt.doc.user/ref_select_cascade_dialog.htm
deleted file mode 100644
index 4c5d1c20c7..0000000000
--- a/jpa/plugins/org.eclipse.jpt.doc.user/ref_select_cascade_dialog.htm
+++ /dev/null
@@ -1,40 +0,0 @@
-<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN"
- "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
-<html xmlns="http://www.w3.org/1999/xhtml" xml:lang="en" lang="en">
-<head>
-<meta http-equiv="Content-Type" content="text/html; charset=us-ascii" />
-
-<meta http-equiv="Content-Style-Type" content="text/css" />
-<meta http-equiv="Content-Script-Type" content="text/javascript" />
-<title>Select Cascade dialog</title>
-<meta name="generator" content="Oracle DARB XHTML Converter (Mode = ohj/ohw) - Version 5.1.1 Build 004" />
-<meta name="date" content="2009-05-01T8:12:52Z" />
-<meta name="robots" content="noarchive" />
-<meta name="doctitle" content="Select Cascade dialog" />
-<meta name="relnum" content="Release 2.2" />
-<meta name="copyright" content="Copyright (c) 2000, 2008 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. Contributors: Oracle - initial API and implementation" />
-<link rel="copyright" href="dcommon/html/cpyr.htm" title="Copyright" type="text/html" />
-<link rel="stylesheet" href="dcommon/css/blafdoc.css" title="Oracle BLAFDoc" type="text/css" />
-<!-- contents -->
-</head>
-<body>
-<p><a id="CIAFDGIJ" name="CIAFDGIJ"></a></p>
-<div class="sect2"><!-- infolevel="all" infotype="General" -->
-<h1>Select Cascade dialog</h1>
-<p>Specify which operations are propagated throughout the association: All, Persist, Merge, Remove, or Refresh.</p>
-</div>
-<!-- class="sect2" -->
-<!-- Start Footer -->
-<div class="footer">
-<table class="simple oac_no_warn" summary="" cellspacing="0" cellpadding="0" width="100%">
-<col width="86%" />
-<col width="*" />
-<tr>
-<td align="left"><span class="copyrightlogo">Copyright&nbsp;&copy;&nbsp;2006, 2009,&nbsp;Oracle&nbsp;and/or&nbsp;its&nbsp;affiliates.&nbsp;All&nbsp;rights&nbsp;reserved.</span><br />
-<a href="dcommon/html/cpyr.htm"><span class="copyrightlogo">Legal Notices</span></a></td>
-</tr>
-</table>
-</div>
-<!-- class="footer" -->
-</body>
-</html>
diff --git a/jpa/plugins/org.eclipse.jpt.doc.user/ref_tableAssociations.htm b/jpa/plugins/org.eclipse.jpt.doc.user/ref_tableAssociations.htm
deleted file mode 100644
index a0842f196b..0000000000
--- a/jpa/plugins/org.eclipse.jpt.doc.user/ref_tableAssociations.htm
+++ /dev/null
@@ -1,78 +0,0 @@
-<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN"
- "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
-<html xmlns="http://www.w3.org/1999/xhtml" xml:lang="en" lang="en">
-<head>
-<meta http-equiv="Content-Type" content="text/html; charset=us-ascii" />
-
-<meta http-equiv="Content-Style-Type" content="text/css" />
-<meta http-equiv="Content-Script-Type" content="text/javascript" />
-<title>Table Associations</title>
-<meta name="generator" content="Oracle DARB XHTML Converter (Mode = ohj/ohw) - Version 5.1.1 Build 004" />
-<meta name="date" content="2009-05-01T8:12:50Z" />
-<meta name="robots" content="noarchive" />
-<meta name="doctitle" content="Table Associations" />
-<meta name="relnum" content="Release 2.2" />
-<meta name="copyright" content="Copyright (c) 2000, 2008 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. Contributors: Oracle - initial API and implementation" />
-<link rel="copyright" href="dcommon/html/cpyr.htm" title="Copyright" type="text/html" />
-<link rel="stylesheet" href="dcommon/css/blafdoc.css" title="Oracle BLAFDoc" type="text/css" />
-<!-- contents -->
-</head>
-<body>
-<p><a id="CIACDICB" name="CIACDICB"></a></p>
-<div class="sect3"><!-- infolevel="all" infotype="General" -->
-<h1>Table Associations</h1>
-<p><a id="sthref203" name="sthref203"></a>Use this page to create or edit the association between the database table and entity.</p>
-<div class="inftblinformal">
-<table class="Informal" title="This table describes the options on the Generate Entities dialog." summary="This table describes the options on the Table Associations dialog." dir="ltr" border="1" width="100%" frame="border" rules="all" cellpadding="3" cellspacing="0">
-<col width="32%" />
-<col width="*" />
-<thead>
-<tr align="left" valign="top">
-<th align="left" valign="bottom" id="r1c1-t9">Property</th>
-<th align="left" valign="bottom" id="r1c2-t9">Description</th>
-</tr>
-</thead>
-<tbody>
-<tr align="left" valign="top">
-<td align="left" id="r2c1-t9" headers="r1c1-t9">Table associations</td>
-<td align="left" headers="r2c1-t9 r1c2-t9">Select an association to modify or click to create a new table association with the <a href="ref_create_new_association_wizard.htm#CIAFGHIF">Create New Association</a> wizard.</td>
-</tr>
-<tr align="left" valign="top">
-<td align="left" id="r3c1-t9" headers="r1c1-t9">Generate this association</td>
-<td align="left" headers="r3c1-t9 r1c2-t9">Specify if Dali should create the selected association. If enabled, you can specify the Cardinality and Join table for the table association.</td>
-</tr>
-<tr align="left" valign="top">
-<td align="left" id="r4c1-t9" headers="r1c1-t9">Generate a reference to <span class="italic">&lt;ROW&gt;</span> in <span class="italic">&lt;TABLE&gt;</span></td>
-<td align="left" headers="r4c1-t9 r1c2-t9">Specify if the entity should contain a reference to the specified table.
-<p>If enabled, you can also enter the <span class="bold">Property</span> name and select the <span class="bold">Cascade</span> method (all, persist, merge, remove, or refresh) for the reference.</p>
-</td>
-</tr>
-</tbody>
-</table>
-<br /></div>
-<!-- class="inftblinformal" -->
-<p>&nbsp;</p>
-<img src="img/ngrelt.png" alt="Related task" title="Related task" /><br />
-<br />
-<a href="task_create_jpa_entity.htm#BABFBJBG">Creating a JPA Entity</a><br />
-<a href="tasks019.htm#BABBAGFI">Generating entities from tables</a><br />
-<a href="ref_create_new_association_wizard.htm#CIAFGHIF">Create New Association</a>
-<p>&nbsp;</p>
-<img src="img/ngrelr.png" alt="Related reference" title="Related reference" /><br />
-<br />
-<a href="ref_create_custom_entities_wizard.htm#CIAGBFJE">Generate Entities from Tables Wizard</a></div>
-<!-- class="sect3" -->
-<!-- Start Footer -->
-<div class="footer">
-<table class="simple oac_no_warn" summary="" cellspacing="0" cellpadding="0" width="100%">
-<col width="86%" />
-<col width="*" />
-<tr>
-<td align="left"><span class="copyrightlogo">Copyright&nbsp;&copy;&nbsp;2006, 2009,&nbsp;Oracle&nbsp;and/or&nbsp;its&nbsp;affiliates.&nbsp;All&nbsp;rights&nbsp;reserved.</span><br />
-<a href="dcommon/html/cpyr.htm"><span class="copyrightlogo">Legal Notices</span></a></td>
-</tr>
-</table>
-</div>
-<!-- class="footer" -->
-</body>
-</html>
diff --git a/jpa/plugins/org.eclipse.jpt.doc.user/reference.htm b/jpa/plugins/org.eclipse.jpt.doc.user/reference.htm
deleted file mode 100644
index 84c3c9a98d..0000000000
--- a/jpa/plugins/org.eclipse.jpt.doc.user/reference.htm
+++ /dev/null
@@ -1,60 +0,0 @@
-<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN"
- "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
-<html xmlns="http://www.w3.org/1999/xhtml" xml:lang="en" lang="en">
-<head>
-<meta http-equiv="Content-Type" content="text/html; charset=us-ascii" />
-
-<meta http-equiv="Content-Style-Type" content="text/css" />
-<meta http-equiv="Content-Script-Type" content="text/javascript" />
-<title>Reference</title>
-<meta name="generator" content="Oracle DARB XHTML Converter (Mode = ohj/ohw) - Version 5.1.1 Build 004" />
-<meta name="date" content="2009-05-01T8:12:49Z" />
-<meta name="robots" content="noarchive" />
-<meta name="doctitle" content=" Reference" />
-<meta name="relnum" content="Release 2.2" />
-<meta name="copyright" content="Copyright (c) 2000, 2008 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. Contributors: Oracle - initial API and implementation" />
-<link rel="copyright" href="dcommon/html/cpyr.htm" title="Copyright" type="text/html" />
-<link rel="stylesheet" href="dcommon/css/blafdoc.css" title="Oracle BLAFDoc" type="text/css" />
-<!-- contents -->
-</head>
-<body>
-<p><a id="sthref188" name="sthref188"></a></p>
-<h1>Reference</h1>
-<p>This section includes detailed help information for each of the following elements in the Dali OR Mapping Tool:</p>
-<ul>
-<li>
-<p><a href="reference001.htm#CACJJJJH">Wizards</a></p>
-</li>
-<li>
-<p><a href="reference005.htm#CACDJIIG">Property pages</a></p>
-</li>
-<li>
-<p><a href="reference026.htm#CACDEIEE">Preferences</a></p>
-</li>
-<li>
-<p><a href="reference027.htm#CACGEJDA">Dialogs</a></p>
-</li>
-<li>
-<p><a href="ref_persistence_perspective.htm#BABIFBDB">JPA Development perspective</a></p>
-</li>
-<li>
-<p><a href="reference029.htm#CACDHCIA">Icons and buttons</a></p>
-</li>
-<li>
-<p><a href="reference032.htm#CACBBDIB">Dali Developer Documentation</a></p>
-</li>
-</ul>
-<!-- Start Footer -->
-<div class="footer">
-<table class="simple oac_no_warn" summary="" cellspacing="0" cellpadding="0" width="100%">
-<col width="86%" />
-<col width="*" />
-<tr>
-<td align="left"><span class="copyrightlogo">Copyright&nbsp;&copy;&nbsp;2006, 2009,&nbsp;Oracle&nbsp;and/or&nbsp;its&nbsp;affiliates.&nbsp;All&nbsp;rights&nbsp;reserved.</span><br />
-<a href="dcommon/html/cpyr.htm"><span class="copyrightlogo">Legal Notices</span></a></td>
-</tr>
-</table>
-</div>
-<!-- class="footer" -->
-</body>
-</html>
diff --git a/jpa/plugins/org.eclipse.jpt.doc.user/reference001.htm b/jpa/plugins/org.eclipse.jpt.doc.user/reference001.htm
deleted file mode 100644
index d2277c8a66..0000000000
--- a/jpa/plugins/org.eclipse.jpt.doc.user/reference001.htm
+++ /dev/null
@@ -1,55 +0,0 @@
-<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN"
- "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
-<html xmlns="http://www.w3.org/1999/xhtml" xml:lang="en" lang="en">
-<head>
-<meta http-equiv="Content-Type" content="text/html; charset=us-ascii" />
-
-<meta http-equiv="Content-Style-Type" content="text/css" />
-<meta http-equiv="Content-Script-Type" content="text/javascript" />
-<title>Wizards</title>
-<meta name="generator" content="Oracle DARB XHTML Converter (Mode = ohj/ohw) - Version 5.1.1 Build 004" />
-<meta name="date" content="2009-05-01T8:12:49Z" />
-<meta name="robots" content="noarchive" />
-<meta name="doctitle" content="Wizards" />
-<meta name="relnum" content="Release 2.2" />
-<meta name="copyright" content="Copyright (c) 2000, 2008 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. Contributors: Oracle - initial API and implementation" />
-<link rel="copyright" href="dcommon/html/cpyr.htm" title="Copyright" type="text/html" />
-<link rel="stylesheet" href="dcommon/css/blafdoc.css" title="Oracle BLAFDoc" type="text/css" />
-<!-- contents -->
-</head>
-<body>
-<p><a id="CACJJJJH" name="CACJJJJH"></a></p>
-<div class="sect1"><!-- infolevel="all" infotype="General" -->
-<h1>Wizards</h1>
-<p>This section includes information on the following wizards:</p>
-<ul>
-<li>
-<p><a href="ref_new_jpa_project_wizard.htm#CACBJGBG">Create New JPA Project wizard</a></p>
-</li>
-<li>
-<p><a href="ref_create_jpa_entity_wizard.htm#CIAGGGDF">Create JPA Entity wizard</a></p>
-</li>
-<li>
-<p><a href="reference004.htm#CIAGHCGA">Generate Tables from Entities Wizard</a></p>
-</li>
-<li>
-<p><a href="ref_create_custom_entities_wizard.htm#CIAGBFJE">Generate Entities from Tables Wizard</a></p>
-</li>
-<li>
-<p><a href="ref_create_new_association_wizard.htm#CIAFGHIF">Create New Association</a></p>
-</li>
-</ul>
-<!-- Start Footer -->
-<div class="footer">
-<table class="simple oac_no_warn" summary="" cellspacing="0" cellpadding="0" width="100%">
-<col width="86%" />
-<col width="*" />
-<tr>
-<td align="left"><span class="copyrightlogo">Copyright&nbsp;&copy;&nbsp;2006, 2009,&nbsp;Oracle&nbsp;and/or&nbsp;its&nbsp;affiliates.&nbsp;All&nbsp;rights&nbsp;reserved.</span><br />
-<a href="dcommon/html/cpyr.htm"><span class="copyrightlogo">Legal Notices</span></a></td>
-</tr>
-</table>
-</div>
-<!-- class="footer" --></div>
-</body>
-</html>
diff --git a/jpa/plugins/org.eclipse.jpt.doc.user/reference002.htm b/jpa/plugins/org.eclipse.jpt.doc.user/reference002.htm
deleted file mode 100644
index ad018c9711..0000000000
--- a/jpa/plugins/org.eclipse.jpt.doc.user/reference002.htm
+++ /dev/null
@@ -1,39 +0,0 @@
-<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN"
- "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
-<html xmlns="http://www.w3.org/1999/xhtml" xml:lang="en" lang="en">
-<head>
-<meta http-equiv="Content-Type" content="text/html; charset=us-ascii" />
-
-<meta http-equiv="Content-Style-Type" content="text/css" />
-<meta http-equiv="Content-Script-Type" content="text/javascript" />
-<title>Mapping File Wizard</title>
-<meta name="generator" content="Oracle DARB XHTML Converter (Mode = ohj/ohw) - Version 5.1.1 Build 004" />
-<meta name="date" content="2009-05-01T8:12:49Z" />
-<meta name="robots" content="noarchive" />
-<meta name="doctitle" content="Mapping File Wizard" />
-<meta name="relnum" content="Release 2.2" />
-<meta name="copyright" content="Copyright (c) 2000, 2008 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. Contributors: Oracle - initial API and implementation" />
-<link rel="copyright" href="dcommon/html/cpyr.htm" title="Copyright" type="text/html" />
-<link rel="stylesheet" href="dcommon/css/blafdoc.css" title="Oracle BLAFDoc" type="text/css" />
-<!-- contents -->
-</head>
-<body>
-<p><a id="CIAIJCCE" name="CIAIJCCE"></a></p>
-<div class="sect2"><!-- infolevel="all" infotype="General" -->
-<h1>Mapping File Wizard</h1>
-<p>The Mapping File wizard enables you to add an <code>orm.xml</code> file to a JPA project if no object map exists at the location specified. For example, if you cleared the <span class="bold">Create orm.xml</span> option on the <a href="ref_jpa_facet.htm#CACIFDIF">JPA Facet page</a>, you can later add the <code>orm.xml</code> file to the src file of the project using this wizard.</p>
-<p>The <a href="#CIAIJCCE">Mapping File Wizard</a> consists of the Mapping File page.</p>
-<!-- Start Footer -->
-<div class="footer">
-<table class="simple oac_no_warn" summary="" cellspacing="0" cellpadding="0" width="100%">
-<col width="86%" />
-<col width="*" />
-<tr>
-<td align="left"><span class="copyrightlogo">Copyright&nbsp;&copy;&nbsp;2006, 2009,&nbsp;Oracle&nbsp;and/or&nbsp;its&nbsp;affiliates.&nbsp;All&nbsp;rights&nbsp;reserved.</span><br />
-<a href="dcommon/html/cpyr.htm"><span class="copyrightlogo">Legal Notices</span></a></td>
-</tr>
-</table>
-</div>
-<!-- class="footer" --></div>
-</body>
-</html>
diff --git a/jpa/plugins/org.eclipse.jpt.doc.user/reference003.htm b/jpa/plugins/org.eclipse.jpt.doc.user/reference003.htm
deleted file mode 100644
index 2774291de6..0000000000
--- a/jpa/plugins/org.eclipse.jpt.doc.user/reference003.htm
+++ /dev/null
@@ -1,134 +0,0 @@
-<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN"
- "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
-<html xmlns="http://www.w3.org/1999/xhtml" xml:lang="en" lang="en">
-<head>
-<meta http-equiv="Content-Type" content="text/html; charset=us-ascii" />
-
-<meta http-equiv="Content-Style-Type" content="text/css" />
-<meta http-equiv="Content-Script-Type" content="text/javascript" />
-<title>Mapping File</title>
-<meta name="generator" content="Oracle DARB XHTML Converter (Mode = ohj/ohw) - Version 5.1.1 Build 004" />
-<meta name="date" content="2009-05-01T8:12:49Z" />
-<meta name="robots" content="noarchive" />
-<meta name="doctitle" content="Mapping File" />
-<meta name="relnum" content="Release 2.2" />
-<meta name="copyright" content="Copyright (c) 2000, 2008 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. Contributors: Oracle - initial API and implementation" />
-<link rel="copyright" href="dcommon/html/cpyr.htm" title="Copyright" type="text/html" />
-<link rel="stylesheet" href="dcommon/css/blafdoc.css" title="Oracle BLAFDoc" type="text/css" />
-<!-- contents -->
-</head>
-<body>
-<p><a id="CIAJEIDJ" name="CIAJEIDJ"></a></p>
-<div class="sect3"><!-- infolevel="all" infotype="General" -->
-<h1>Mapping File</h1>
-<p>This table lists the properties of the <a href="reference002.htm#CIAIJCCE">Mapping File Wizard</a>.</p>
-<div class="tblformal"><a id="sthref198" name="sthref198"></a><a id="sthref199" name="sthref199"></a>
-<p class="titleintable">Mapping File Wizard Properties</p>
-<table class="Formal" title="Mapping File Wizard Properties" summary="This table lists the properties of the Mapping File Wizard." dir="ltr" border="1" width="100%" frame="hsides" rules="groups" cellpadding="3" cellspacing="0">
-<col width="24%" />
-<col width="*" />
-<col width="24%" />
-<thead>
-<tr align="left" valign="top">
-<th align="left" valign="bottom" id="r1c1-t7">Property</th>
-<th align="left" valign="bottom" id="r1c2-t7">Description</th>
-<th align="left" valign="bottom" id="r1c3-t7">Default</th>
-</tr>
-</thead>
-<tbody>
-<tr align="left" valign="top">
-<td align="left" id="r2c1-t7" headers="r1c1-t7">
-<p>Project</p>
-</td>
-<td align="left" headers="r2c1-t7 r1c2-t7">
-<p>The name of the JPA project.</p>
-</td>
-<td align="left" headers="r2c1-t7 r1c3-t7">
-<p>Selected.</p>
-</td>
-</tr>
-<tr align="left" valign="top">
-<td align="left" id="r3c1-t7" headers="r1c1-t7">
-<p>Source folder</p>
-</td>
-<td align="left" headers="r3c1-t7 r1c2-t7">
-<p>The location of the project's src folder. If needed, click <span class="bold">Browse</span> to point the wizard to the src file's location.</p>
-</td>
-<td align="left" headers="r3c1-t7 r1c3-t7">
-<p>Selected.</p>
-</td>
-</tr>
-<tr align="left" valign="top">
-<td align="left" id="r4c1-t7" headers="r1c1-t7">
-<p>File Path</p>
-</td>
-<td align="left" headers="r4c1-t7 r1c2-t7">
-<p>The location for the new <code>orm.xml</code> file.</p>
-</td>
-<td align="left" headers="r4c1-t7 r1c3-t7">
-<p>Selected.</p>
-</td>
-</tr>
-<tr align="left" valign="top">
-<td align="left" id="r5c1-t7" headers="r1c1-t7">
-<p>Default Access</p>
-</td>
-<td align="left" headers="r5c1-t7 r1c2-t7">
-<p>Select whether the access to the entity is field-based or property-based, as defined in JPA specification.</p>
-<ul>
-<li>
-<p>None &ndash; No access type specified.</p>
-</li>
-<li>
-<p><span class="bold">Property-based</span> &ndash; Persistent state accessed through the property accessor methods. The property accessor methods must be <span class="bold">public</span> or <span class="bold">private</span>.</p>
-</li>
-<li>
-<p><span class="bold">Field-based</span> &ndash; Instance variables are accessed directly. All non-transient instance variables are persistent.</p>
-</li>
-</ul>
-</td>
-<td align="left" headers="r5c1-t7 r1c3-t7">
-<p>None</p>
-</td>
-</tr>
-<tr align="left" valign="top">
-<td align="left" id="r6c1-t7" headers="r1c1-t7">
-<p>Add to persistence unit</p>
-</td>
-<td align="left" headers="r6c1-t7 r1c2-t7">
-<p>Designates the persistence unit for this object map file.</p>
-</td>
-<td align="left" headers="r6c1-t7 r1c3-t7">
-<p>Selected.</p>
-</td>
-</tr>
-</tbody>
-</table>
-<br /></div>
-<!-- class="tblformal" -->
-<p>&nbsp;</p>
-<img src="img/ngrelt.png" alt="Related task" title="Related task" /><br />
-<br />
-<a href="task_create_new_project.htm#CIHHEJCJ">Creating a new JPA project</a><br />
-<a href="task_create_jpa_entity.htm#BABFBJBG">Creating a JPA Entity</a><br />
-<a href="task_mapping.htm#BABDGBIJ">Mapping an entity</a>
-<p>&nbsp;</p>
-<img src="img/ngrelr.png" alt="Related task" title="Related task" /><br />
-<br />
-<a href="reference002.htm#CIAIJCCE">Mapping File Wizard</a><br /></div>
-<!-- class="sect3" -->
-<!-- class="sect2" -->
-<!-- Start Footer -->
-<div class="footer">
-<table class="simple oac_no_warn" summary="" cellspacing="0" cellpadding="0" width="100%">
-<col width="86%" />
-<col width="*" />
-<tr>
-<td align="left"><span class="copyrightlogo">Copyright&nbsp;&copy;&nbsp;2006, 2009,&nbsp;Oracle&nbsp;and/or&nbsp;its&nbsp;affiliates.&nbsp;All&nbsp;rights&nbsp;reserved.</span><br />
-<a href="dcommon/html/cpyr.htm"><span class="copyrightlogo">Legal Notices</span></a></td>
-</tr>
-</table>
-</div>
-<!-- class="footer" -->
-</body>
-</html>
diff --git a/jpa/plugins/org.eclipse.jpt.doc.user/reference004.htm b/jpa/plugins/org.eclipse.jpt.doc.user/reference004.htm
deleted file mode 100644
index af6dd02911..0000000000
--- a/jpa/plugins/org.eclipse.jpt.doc.user/reference004.htm
+++ /dev/null
@@ -1,49 +0,0 @@
-<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN"
- "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
-<html xmlns="http://www.w3.org/1999/xhtml" xml:lang="en" lang="en">
-<head>
-<meta http-equiv="Content-Type" content="text/html; charset=us-ascii" />
-
-<meta http-equiv="Content-Style-Type" content="text/css" />
-<meta http-equiv="Content-Script-Type" content="text/javascript" />
-<title>Generate Tables from Entities Wizard</title>
-<meta name="generator" content="Oracle DARB XHTML Converter (Mode = ohj/ohw) - Version 5.1.1 Build 004" />
-<meta name="date" content="2009-05-01T8:12:49Z" />
-<meta name="robots" content="noarchive" />
-<meta name="doctitle" content="Generate Tables from Entities Wizard" />
-<meta name="relnum" content="Release 2.2" />
-<meta name="copyright" content="Copyright (c) 2000, 2008 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. Contributors: Oracle - initial API and implementation" />
-<link rel="copyright" href="dcommon/html/cpyr.htm" title="Copyright" type="text/html" />
-<link rel="stylesheet" href="dcommon/css/blafdoc.css" title="Oracle BLAFDoc" type="text/css" />
-<!-- contents -->
-</head>
-<body>
-<p><a id="CIAGHCGA" name="CIAGHCGA"></a></p>
-<div class="sect2"><!-- infolevel="all" infotype="General" -->
-<h1>Generate Tables from Entities Wizard</h1>
-<p>Use the Generate DDL from Entities Wizard to quickly create DDL scripts from your persistent entities. Dali automatically creates the necessary primary and foreign keys, based on the entity mappings.</p>
-<p>&nbsp;</p>
-<img src="img/ngrelt.png" alt="Related task" title="Related task" /><br />
-<br />
-<a href="tasks019.htm#BABBAGFI">Generating entities from tables</a><br />
-<a href="task_create_jpa_entity.htm#BABFBJBG">Creating a JPA Entity</a><br />
-<a href="task_mapping.htm#BABDGBIJ">Mapping an entity</a>
-<p>&nbsp;</p>
-<img src="img/ngrelr.png" alt="Related task" title="Related task" /><br />
-<br />
-<a href="ref_create_jpa_entity_wizard.htm#CIAGGGDF">Create JPA Entity wizard</a><br /></div>
-<!-- class="sect2" -->
-<!-- Start Footer -->
-<div class="footer">
-<table class="simple oac_no_warn" summary="" cellspacing="0" cellpadding="0" width="100%">
-<col width="86%" />
-<col width="*" />
-<tr>
-<td align="left"><span class="copyrightlogo">Copyright&nbsp;&copy;&nbsp;2006, 2009,&nbsp;Oracle&nbsp;and/or&nbsp;its&nbsp;affiliates.&nbsp;All&nbsp;rights&nbsp;reserved.</span><br />
-<a href="dcommon/html/cpyr.htm"><span class="copyrightlogo">Legal Notices</span></a></td>
-</tr>
-</table>
-</div>
-<!-- class="footer" -->
-</body>
-</html>
diff --git a/jpa/plugins/org.eclipse.jpt.doc.user/reference005.htm b/jpa/plugins/org.eclipse.jpt.doc.user/reference005.htm
deleted file mode 100644
index 7e0d83cd2c..0000000000
--- a/jpa/plugins/org.eclipse.jpt.doc.user/reference005.htm
+++ /dev/null
@@ -1,52 +0,0 @@
-<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN"
- "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
-<html xmlns="http://www.w3.org/1999/xhtml" xml:lang="en" lang="en">
-<head>
-<meta http-equiv="Content-Type" content="text/html; charset=us-ascii" />
-
-<meta http-equiv="Content-Style-Type" content="text/css" />
-<meta http-equiv="Content-Script-Type" content="text/javascript" />
-<title>Property pages</title>
-<meta name="generator" content="Oracle DARB XHTML Converter (Mode = ohj/ohw) - Version 5.1.1 Build 004" />
-<meta name="date" content="2009-05-01T8:12:50Z" />
-<meta name="robots" content="noarchive" />
-<meta name="doctitle" content="Property pages" />
-<meta name="relnum" content="Release 2.2" />
-<meta name="copyright" content="Copyright (c) 2000, 2008 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. Contributors: Oracle - initial API and implementation" />
-<link rel="copyright" href="dcommon/html/cpyr.htm" title="Copyright" type="text/html" />
-<link rel="stylesheet" href="dcommon/css/blafdoc.css" title="Oracle BLAFDoc" type="text/css" />
-<!-- contents -->
-</head>
-<body>
-<p><a id="CACDJIIG" name="CACDJIIG"></a></p>
-<div class="sect1"><!-- infolevel="all" infotype="General" -->
-<h1>Property pages</h1>
-<p>This section includes information on the following:</p>
-<ul>
-<li>
-<p><a href="ref_persistence_prop_view.htm#BABFAEBB">JPA Details view (for entities)</a></p>
-</li>
-<li>
-<p><a href="ref_persistence_map_view.htm#BABIFBAF">JPA Details view (for attributes)</a></p>
-</li>
-<li>
-<p><a href="ref_details_orm.htm#CACGDGHC">JPA Details view (for orm.xml)</a></p>
-</li>
-<li>
-<p><a href="ref_persistence_outline.htm#BABEGGFE">JPA Structure view</a></p>
-</li>
-</ul>
-<!-- Start Footer -->
-<div class="footer">
-<table class="simple oac_no_warn" summary="" cellspacing="0" cellpadding="0" width="100%">
-<col width="86%" />
-<col width="*" />
-<tr>
-<td align="left"><span class="copyrightlogo">Copyright&nbsp;&copy;&nbsp;2006, 2009,&nbsp;Oracle&nbsp;and/or&nbsp;its&nbsp;affiliates.&nbsp;All&nbsp;rights&nbsp;reserved.</span><br />
-<a href="dcommon/html/cpyr.htm"><span class="copyrightlogo">Legal Notices</span></a></td>
-</tr>
-</table>
-</div>
-<!-- class="footer" --></div>
-</body>
-</html>
diff --git a/jpa/plugins/org.eclipse.jpt.doc.user/reference006.htm b/jpa/plugins/org.eclipse.jpt.doc.user/reference006.htm
deleted file mode 100644
index 584a0dd34f..0000000000
--- a/jpa/plugins/org.eclipse.jpt.doc.user/reference006.htm
+++ /dev/null
@@ -1,102 +0,0 @@
-<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN"
- "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
-<html xmlns="http://www.w3.org/1999/xhtml" xml:lang="en" lang="en">
-<head>
-<meta http-equiv="Content-Type" content="text/html; charset=us-ascii" />
-
-<meta http-equiv="Content-Style-Type" content="text/css" />
-<meta http-equiv="Content-Script-Type" content="text/javascript" />
-<title>General information</title>
-<meta name="generator" content="Oracle DARB XHTML Converter (Mode = ohj/ohw) - Version 5.1.1 Build 004" />
-<meta name="date" content="2009-05-01T8:12:50Z" />
-<meta name="robots" content="noarchive" />
-<meta name="doctitle" content="General information" />
-<meta name="relnum" content="Release 2.2" />
-<meta name="copyright" content="Copyright (c) 2000, 2008 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. Contributors: Oracle - initial API and implementation" />
-<link rel="copyright" href="dcommon/html/cpyr.htm" title="Copyright" type="text/html" />
-<link rel="stylesheet" href="dcommon/css/blafdoc.css" title="Oracle BLAFDoc" type="text/css" />
-<!-- contents -->
-</head>
-<body>
-<p><a id="CACCAGGC" name="CACCAGGC"></a></p>
-<div class="sect3"><!-- infolevel="all" infotype="General" -->
-<h1>General information</h1>
-<p>This table lists the General information fields available in the <span class="gui-object-title">JPA Details</span> view for each entity type.</p>
-<div class="inftblinformal">
-<table class="Informal" title="This table describes the options on the Persistence Properties view, General tab." summary="This table describes the options on the Persistence Properties view, General tab." dir="ltr" border="1" width="100%" frame="border" rules="all" cellpadding="3" cellspacing="0">
-<col width="16%" />
-<col width="*" />
-<col width="17%" />
-<col width="25%" />
-<thead>
-<tr align="left" valign="top">
-<th align="left" valign="bottom" id="r1c1-t13">Property</th>
-<th align="left" valign="bottom" id="r1c2-t13">Description</th>
-<th align="left" valign="bottom" id="r1c3-t13">Default</th>
-<th align="left" valign="bottom" id="r1c4-t13">Available for Entity&nbsp;Type</th>
-</tr>
-</thead>
-<tbody>
-<tr align="left" valign="top">
-<td align="left" id="r2c1-t13" headers="r1c1-t13">Mapping Type Hyperlink</td>
-<td align="left" headers="r2c1-t13 r1c2-t13">Clicking the name of the mapping type, which is represented as a hyperlink, invokes the Mapping Type Selection dialog. Use this dialog to specify the type of entity: Mapped Superclass, Embeddable or the default mapping type.</td>
-<td align="left" headers="r2c1-t13 r1c3-t13">Entity</td>
-<td align="left" headers="r2c1-t13 r1c4-t13"><a href="tasks005.htm#BABGBIEE">Entity</a>, <a href="tasks006.htm#BABFEICE">Embeddable</a>, and <a href="tasks007.htm#BABDAGCI">Mapped superclass</a></td>
-</tr>
-<tr align="left" valign="top">
-<td align="left" id="r3c1-t13" headers="r1c1-t13">Name</td>
-<td align="left" headers="r3c1-t13 r1c2-t13">The name of this entity. By default, the class name is used as the entity name.</td>
-<td align="left" headers="r3c1-t13 r1c3-t13"><br /></td>
-<td align="left" headers="r3c1-t13 r1c4-t13"><a href="tasks005.htm#BABGBIEE">Entity</a><br /></td>
-</tr>
-<tr align="left" valign="top">
-<td align="left" id="r4c1-t13" headers="r1c1-t13">Table</td>
-<td align="left" headers="r4c1-t13 r1c2-t13">The default database table information for this entity. These fields can be overridden by the information in the <a href="reference007.htm#CACIJBGH">Attribute overrides</a> area.</td>
-<td align="left" headers="r4c1-t13 r1c3-t13"><br /></td>
-<td align="left" headers="r4c1-t13 r1c4-t13"><a href="tasks005.htm#BABGBIEE">Entity</a><br /></td>
-</tr>
-<tr align="left" valign="top">
-<td align="left" id="r5c1-t13" headers="r1c1-t13">&nbsp;&nbsp;Name</td>
-<td align="left" headers="r5c1-t13 r1c2-t13">The name of the primary database table associated with the entity.</td>
-<td align="left" headers="r5c1-t13 r1c3-t13"><br /></td>
-<td align="left" headers="r5c1-t13 r1c4-t13"><a href="tasks005.htm#BABGBIEE">Entity</a><br /></td>
-</tr>
-<tr align="left" valign="top">
-<td align="left" id="r6c1-t13" headers="r1c1-t13">&nbsp;&nbsp;Catalog</td>
-<td align="left" headers="r6c1-t13 r1c2-t13">The database catalog that contains the <span class="bold">Table</span>.</td>
-<td align="left" headers="r6c1-t13 r1c3-t13">As defined in <code>orm.xml</code>.</td>
-<td align="left" headers="r6c1-t13 r1c4-t13"><a href="tasks005.htm#BABGBIEE">Entity</a><br /></td>
-</tr>
-<tr align="left" valign="top">
-<td align="left" id="r7c1-t13" headers="r1c1-t13">&nbsp;&nbsp;Schema</td>
-<td align="left" headers="r7c1-t13 r1c2-t13">The database schema that contains the <span class="bold">Table</span>.</td>
-<td align="left" headers="r7c1-t13 r1c3-t13">As defined in <code>orm.xml</code>.</td>
-<td align="left" headers="r7c1-t13 r1c4-t13"><a href="tasks005.htm#BABGBIEE">Entity</a><br /></td>
-</tr>
-</tbody>
-</table>
-<br /></div>
-<!-- class="inftblinformal" -->
-<p>&nbsp;</p>
-<img src="img/ngrelt.png" alt="Related task" title="Related task" /><br />
-<br />
-<a href="task_add_persistence.htm#BABHICAI">Adding persistence to a class</a>
-<p>&nbsp;</p>
-<img src="img/ngrelr.png" alt="Related reference" title="Related reference" /><br />
-<br />
-<a href="ref_persistence_prop_view.htm#BABFAEBB">JPA Details view (for entities)</a></div>
-<!-- class="sect3" -->
-<!-- Start Footer -->
-<div class="footer">
-<table class="simple oac_no_warn" summary="" cellspacing="0" cellpadding="0" width="100%">
-<col width="86%" />
-<col width="*" />
-<tr>
-<td align="left"><span class="copyrightlogo">Copyright&nbsp;&copy;&nbsp;2006, 2009,&nbsp;Oracle&nbsp;and/or&nbsp;its&nbsp;affiliates.&nbsp;All&nbsp;rights&nbsp;reserved.</span><br />
-<a href="dcommon/html/cpyr.htm"><span class="copyrightlogo">Legal Notices</span></a></td>
-</tr>
-</table>
-</div>
-<!-- class="footer" -->
-</body>
-</html>
diff --git a/jpa/plugins/org.eclipse.jpt.doc.user/reference007.htm b/jpa/plugins/org.eclipse.jpt.doc.user/reference007.htm
deleted file mode 100644
index 522bd43871..0000000000
--- a/jpa/plugins/org.eclipse.jpt.doc.user/reference007.htm
+++ /dev/null
@@ -1,80 +0,0 @@
-<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN"
- "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
-<html xmlns="http://www.w3.org/1999/xhtml" xml:lang="en" lang="en">
-<head>
-<meta http-equiv="Content-Type" content="text/html; charset=us-ascii" />
-
-<meta http-equiv="Content-Style-Type" content="text/css" />
-<meta http-equiv="Content-Script-Type" content="text/javascript" />
-<title>Attribute overrides</title>
-<meta name="generator" content="Oracle DARB XHTML Converter (Mode = ohj/ohw) - Version 5.1.1 Build 004" />
-<meta name="date" content="2009-05-01T8:12:51Z" />
-<meta name="robots" content="noarchive" />
-<meta name="doctitle" content="Attribute overrides" />
-<meta name="relnum" content="Release 2.2" />
-<meta name="copyright" content="Copyright (c) 2000, 2008 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. Contributors: Oracle - initial API and implementation" />
-<link rel="copyright" href="dcommon/html/cpyr.htm" title="Copyright" type="text/html" />
-<link rel="stylesheet" href="dcommon/css/blafdoc.css" title="Oracle BLAFDoc" type="text/css" />
-<!-- contents -->
-</head>
-<body>
-<p><a id="CACIJBGH" name="CACIJBGH"></a></p>
-<div class="sect3"><!-- infolevel="all" infotype="General" -->
-<h1>Attribute overrides</h1>
-<p><a id="sthref213" name="sthref213"></a><a id="sthref214" name="sthref214"></a><a id="sthref215" name="sthref215"></a>Use the <span class="gui-object-title">Attribute Overrides</span> area in the <span class="gui-object-title">JPA Details</span> view to override the default settings specified in the <a href="reference006.htm#CACCAGGC">General information</a> area of an attribute. Attribute overrides generally override/configure attributes that are inherited or embedded.</p>
-<p>This table lists the Attribute override fields available in the <span class="gui-object-title">JPA Details</span> view for each entity type.</p>
-<div class="inftblinformal">
-<table class="Informal" title="This table describes the options on the Persistence Properties view, General tab." summary="This table describes the options on the Persistence Properties view, General tab." dir="ltr" border="1" width="100%" frame="border" rules="all" cellpadding="3" cellspacing="0">
-<col width="16%" />
-<col width="*" />
-<col width="17%" />
-<col width="25%" />
-<thead>
-<tr align="left" valign="top">
-<th align="left" valign="bottom" id="r1c1-t14">Property</th>
-<th align="left" valign="bottom" id="r1c2-t14">Description</th>
-<th align="left" valign="bottom" id="r1c3-t14">Default</th>
-<th align="left" valign="bottom" id="r1c4-t14">Available for Entity&nbsp;Type</th>
-</tr>
-</thead>
-<tbody>
-<tr align="left" valign="top">
-<td align="left" id="r2c1-t14" headers="r1c1-t14">Attribute Overrides</td>
-<td align="left" headers="r2c1-t14 r1c2-t14">Specify a property or field to be overridden (from the default mappings). Select <span class="bold">Override Default</span>.</td>
-<td align="left" headers="r2c1-t14 r1c3-t14"><br /></td>
-<td align="left" headers="r2c1-t14 r1c4-t14"><a href="tasks005.htm#BABGBIEE">Entity</a><br /></td>
-</tr>
-<tr align="left" valign="top">
-<td align="left" id="r3c1-t14" headers="r1c1-t14">Join Columns</td>
-<td align="left" headers="r3c1-t14 r1c2-t14"><br /></td>
-<td align="left" headers="r3c1-t14 r1c3-t14"><br /></td>
-<td align="left" headers="r3c1-t14 r1c4-t14"><a href="tasks005.htm#BABGBIEE">Entity</a><br /></td>
-</tr>
-</tbody>
-</table>
-<br /></div>
-<!-- class="inftblinformal" -->
-<p>&nbsp;</p>
-<img src="img/ngrelt.png" alt="Related task" title="Related task" /><br />
-<br />
-<a href="reference006.htm#CACCAGGC">General information</a><br />
-<a href="task_add_persistence.htm#BABHICAI">Adding persistence to a class</a>
-<p>&nbsp;</p>
-<img src="img/ngrelr.png" alt="Related reference" title="Related reference" /><br />
-<br />
-<a href="ref_persistence_prop_view.htm#BABFAEBB">JPA Details view (for entities)</a></div>
-<!-- class="sect3" -->
-<!-- Start Footer -->
-<div class="footer">
-<table class="simple oac_no_warn" summary="" cellspacing="0" cellpadding="0" width="100%">
-<col width="86%" />
-<col width="*" />
-<tr>
-<td align="left"><span class="copyrightlogo">Copyright&nbsp;&copy;&nbsp;2006, 2009,&nbsp;Oracle&nbsp;and/or&nbsp;its&nbsp;affiliates.&nbsp;All&nbsp;rights&nbsp;reserved.</span><br />
-<a href="dcommon/html/cpyr.htm"><span class="copyrightlogo">Legal Notices</span></a></td>
-</tr>
-</table>
-</div>
-<!-- class="footer" -->
-</body>
-</html>
diff --git a/jpa/plugins/org.eclipse.jpt.doc.user/reference008.htm b/jpa/plugins/org.eclipse.jpt.doc.user/reference008.htm
deleted file mode 100644
index d7e0a4fc6d..0000000000
--- a/jpa/plugins/org.eclipse.jpt.doc.user/reference008.htm
+++ /dev/null
@@ -1,48 +0,0 @@
-<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN"
- "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
-<html xmlns="http://www.w3.org/1999/xhtml" xml:lang="en" lang="en">
-<head>
-<meta http-equiv="Content-Type" content="text/html; charset=us-ascii" />
-
-<meta http-equiv="Content-Style-Type" content="text/css" />
-<meta http-equiv="Content-Script-Type" content="text/javascript" />
-<title>Secondary table information</title>
-<meta name="generator" content="Oracle DARB XHTML Converter (Mode = ohj/ohw) - Version 5.1.1 Build 004" />
-<meta name="date" content="2009-05-01T8:12:51Z" />
-<meta name="robots" content="noarchive" />
-<meta name="doctitle" content="Secondary table information" />
-<meta name="relnum" content="Release 2.2" />
-<meta name="copyright" content="Copyright (c) 2000, 2008 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. Contributors: Oracle - initial API and implementation" />
-<link rel="copyright" href="dcommon/html/cpyr.htm" title="Copyright" type="text/html" />
-<link rel="stylesheet" href="dcommon/css/blafdoc.css" title="Oracle BLAFDoc" type="text/css" />
-<!-- contents -->
-</head>
-<body>
-<p><a id="CACBHIDA" name="CACBHIDA"></a></p>
-<div class="sect3"><!-- infolevel="all" infotype="General" -->
-<h1>Secondary table information</h1>
-<p><a id="sthref216" name="sthref216"></a><a id="sthref217" name="sthref217"></a><a id="sthref218" name="sthref218"></a><a id="sthref219" name="sthref219"></a>Use the <span class="gui-object-title">Secondary Tables</span> area in the <span class="gui-object-title">JPA Details</span> view to associate additional tables with an entity. Use this area if the data associated with an entity is spread across multiple tables.</p>
-<p>&nbsp;</p>
-<img src="img/ngrelt.png" alt="Related task" title="Related task" /><br />
-<br />
-<a href="task_additonal_tables.htm#CIHGBIEI">Specifying additional tables</a><br />
-<a href="task_add_persistence.htm#BABHICAI">Adding persistence to a class</a>
-<p>&nbsp;</p>
-<img src="img/ngrelr.png" alt="Related reference" title="Related reference" /><br />
-<br />
-<a href="ref_persistence_prop_view.htm#BABFAEBB">JPA Details view (for entities)</a></div>
-<!-- class="sect3" -->
-<!-- Start Footer -->
-<div class="footer">
-<table class="simple oac_no_warn" summary="" cellspacing="0" cellpadding="0" width="100%">
-<col width="86%" />
-<col width="*" />
-<tr>
-<td align="left"><span class="copyrightlogo">Copyright&nbsp;&copy;&nbsp;2006, 2009,&nbsp;Oracle&nbsp;and/or&nbsp;its&nbsp;affiliates.&nbsp;All&nbsp;rights&nbsp;reserved.</span><br />
-<a href="dcommon/html/cpyr.htm"><span class="copyrightlogo">Legal Notices</span></a></td>
-</tr>
-</table>
-</div>
-<!-- class="footer" -->
-</body>
-</html>
diff --git a/jpa/plugins/org.eclipse.jpt.doc.user/reference009.htm b/jpa/plugins/org.eclipse.jpt.doc.user/reference009.htm
deleted file mode 100644
index 22ad6518d2..0000000000
--- a/jpa/plugins/org.eclipse.jpt.doc.user/reference009.htm
+++ /dev/null
@@ -1,113 +0,0 @@
-<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN"
- "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
-<html xmlns="http://www.w3.org/1999/xhtml" xml:lang="en" lang="en">
-<head>
-<meta http-equiv="Content-Type" content="text/html; charset=us-ascii" />
-
-<meta http-equiv="Content-Style-Type" content="text/css" />
-<meta http-equiv="Content-Script-Type" content="text/javascript" />
-<title>Inheritance information</title>
-<meta name="generator" content="Oracle DARB XHTML Converter (Mode = ohj/ohw) - Version 5.1.1 Build 004" />
-<meta name="date" content="2009-05-01T8:12:51Z" />
-<meta name="robots" content="noarchive" />
-<meta name="doctitle" content="Inheritance information" />
-<meta name="relnum" content="Release 2.2" />
-<meta name="copyright" content="Copyright (c) 2000, 2008 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. Contributors: Oracle - initial API and implementation" />
-<link rel="copyright" href="dcommon/html/cpyr.htm" title="Copyright" type="text/html" />
-<link rel="stylesheet" href="dcommon/css/blafdoc.css" title="Oracle BLAFDoc" type="text/css" />
-<!-- contents -->
-</head>
-<body>
-<p><a id="CACFHGHE" name="CACFHGHE"></a></p>
-<div class="sect3"><!-- infolevel="all" infotype="General" -->
-<h1>Inheritance information</h1>
-<p><a id="sthref220" name="sthref220"></a><a id="sthref221" name="sthref221"></a>This table lists the fields available on the <span class="gui-object-title">Inheritance</span> area in the <span class="gui-object-title">JPA Details</span> view for each entity type.</p>
-<div class="inftblruleinformal">
-<table class="RuleInformal" title="This table describes the options on the Persistence Properties view, Inheritance tab." summary="This table describes the options on the Persistence Properties view, Inheritance tab." dir="ltr" border="1" width="100%" frame="border" rules="all" cellpadding="3" cellspacing="0">
-<col width="24%" />
-<col width="*" />
-<col width="23%" />
-<thead>
-<tr align="left" valign="top">
-<th align="left" valign="bottom" id="r1c1-t15">Property</th>
-<th align="left" valign="bottom" id="r1c2-t15">Description</th>
-<th align="left" valign="bottom" id="r1c3-t15">Default</th>
-</tr>
-</thead>
-<tbody>
-<tr align="left" valign="top">
-<td align="left" id="r2c1-t15" headers="r1c1-t15">Strategy</td>
-<td align="left" headers="r2c1-t15 r1c2-t15">Specify the strategy to use when mapping a class or class hierarchy:
-<ul>
-<li>
-<p>Single table &ndash; All classes in the hierarchy are mapped to a single table.</p>
-</li>
-<li>
-<p>Joined &ndash; The root of the hierarchy is mapped to a single table; each child maps to its own table.</p>
-</li>
-<li>
-<p>Table per class &ndash; Each class is mapped to a separate table.</p>
-</li>
-</ul>
-<p>This field corresponds to the <code>@Inheritance</code> annotation.</p>
-</td>
-<td align="left" headers="r2c1-t15 r1c3-t15">Single table</td>
-</tr>
-<tr align="left" valign="top">
-<td align="left" id="r3c1-t15" headers="r1c1-t15"><a id="sthref222" name="sthref222"></a><a id="sthref223" name="sthref223"></a>Discriminator Value</td>
-<td align="left" headers="r3c1-t15 r1c2-t15">Specify the discriminator value used to differentiate an entity in this inheritance hierarchy. The value must conform to the specified <span class="bold">Discriminator Type</span>.</td>
-<td align="left" headers="r3c1-t15 r1c3-t15"><br /></td>
-</tr>
-<tr align="left" valign="top">
-<td align="left" id="r4c1-t15" headers="r1c1-t15"><a id="sthref224" name="sthref224"></a><a id="sthref225" name="sthref225"></a>Discriminator Column</td>
-<td align="left" headers="r4c1-t15 r1c2-t15">These fields are available when using a <span class="bold">Single</span> or <span class="bold">Joined</span> inheritance strategy.
-<p>This field corresponds to the <code>@DiscriminatorColumn</code> annotation.</p>
-<p>Use the <span class="bold">Details</span> area to define the <span class="bold">Length</span> and <span class="bold">Column definition</span> of this Discriminator Column.</p>
-</td>
-<td align="left" headers="r4c1-t15 r1c3-t15"><br /></td>
-</tr>
-<tr align="left" valign="top">
-<td align="left" id="r5c1-t15" headers="r1c1-t15">&nbsp;&nbsp;Name</td>
-<td align="left" headers="r5c1-t15 r1c2-t15">Name of the discriminator column</td>
-<td align="left" headers="r5c1-t15 r1c3-t15"><br /></td>
-</tr>
-<tr align="left" valign="top">
-<td align="left" id="r6c1-t15" headers="r1c1-t15">&nbsp;&nbsp;Type</td>
-<td align="left" headers="r6c1-t15 r1c2-t15">Set this field to set the discriminator type to <code>Char</code> or <code>Integer</code> (instead of its default: <code>String</code>). The <span class="bold">Discriminator Value</span> must conform to this type.</td>
-<td align="left" headers="r6c1-t15 r1c3-t15">String</td>
-</tr>
-<tr align="left" valign="top">
-<td align="left" id="r7c1-t15" headers="r1c1-t15">Primary Key Join Columns</td>
-<td align="left" headers="r7c1-t15 r1c2-t15">Use to override the default primary key join columns. Select <span class="bold">Override Default</span>, then click <span class="bold">Add</span> to select new Join Column.
-<p>This field corresponds with @PrimaryKeyJoinColumn annotation.</p>
-</td>
-<td align="left" headers="r7c1-t15 r1c3-t15"><br /></td>
-</tr>
-</tbody>
-</table>
-<br /></div>
-<!-- class="inftblruleinformal" -->
-<p>&nbsp;</p>
-<img src="img/ngrelt.png" alt="Related task" title="Related task" /><br />
-<br />
-<a href="task_inheritance.htm#CIHCCCJD">Specifying entity inheritance</a><br />
-<a href="task_add_persistence.htm#BABHICAI">Adding persistence to a class</a>
-<p>&nbsp;</p>
-<img src="img/ngrelr.png" alt="Related reference" title="Related reference" /><br />
-<br />
-<a href="ref_persistence_prop_view.htm#BABFAEBB">JPA Details view (for entities)</a></div>
-<!-- class="sect3" -->
-<!-- Start Footer -->
-<div class="footer">
-<table class="simple oac_no_warn" summary="" cellspacing="0" cellpadding="0" width="100%">
-<col width="86%" />
-<col width="*" />
-<tr>
-<td align="left"><span class="copyrightlogo">Copyright&nbsp;&copy;&nbsp;2006, 2009,&nbsp;Oracle&nbsp;and/or&nbsp;its&nbsp;affiliates.&nbsp;All&nbsp;rights&nbsp;reserved.</span><br />
-<a href="dcommon/html/cpyr.htm"><span class="copyrightlogo">Legal Notices</span></a></td>
-</tr>
-</table>
-</div>
-<!-- class="footer" -->
-</body>
-</html>
diff --git a/jpa/plugins/org.eclipse.jpt.doc.user/reference010.htm b/jpa/plugins/org.eclipse.jpt.doc.user/reference010.htm
deleted file mode 100644
index d0fad851e0..0000000000
--- a/jpa/plugins/org.eclipse.jpt.doc.user/reference010.htm
+++ /dev/null
@@ -1,47 +0,0 @@
-<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN"
- "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
-<html xmlns="http://www.w3.org/1999/xhtml" xml:lang="en" lang="en">
-<head>
-<meta http-equiv="Content-Type" content="text/html; charset=us-ascii" />
-
-<meta http-equiv="Content-Style-Type" content="text/css" />
-<meta http-equiv="Content-Script-Type" content="text/javascript" />
-<title>Queries</title>
-<meta name="generator" content="Oracle DARB XHTML Converter (Mode = ohj/ohw) - Version 5.1.1 Build 004" />
-<meta name="date" content="2009-05-01T8:12:51Z" />
-<meta name="robots" content="noarchive" />
-<meta name="doctitle" content="Queries" />
-<meta name="relnum" content="Release 2.2" />
-<meta name="copyright" content="Copyright (c) 2000, 2008 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. Contributors: Oracle - initial API and implementation" />
-<link rel="copyright" href="dcommon/html/cpyr.htm" title="Copyright" type="text/html" />
-<link rel="stylesheet" href="dcommon/css/blafdoc.css" title="Oracle BLAFDoc" type="text/css" />
-<!-- contents -->
-</head>
-<body>
-<div class="sect3"><!-- infolevel="all" infotype="General" --><a id="sthref226" name="sthref226"></a>
-<h1>Queries</h1>
-<p>Use the queries area of the JPA Details view to create named queries and named native queries. Refer to <a href="tasks008.htm#BABIGBGG">"Creating Named Queries"</a> for additional information.</p>
-<p>&nbsp;</p>
-<img src="img/ngrelt.png" alt="Related task" title="Related task" /><br />
-<br />
-<a href="tasks008.htm#BABIGBGG">Creating Named Queries</a>
-<p>&nbsp;</p>
-<img src="img/ngrelr.png" alt="Related reference" title="Related reference" /><br />
-<br />
-<a href="ref_persistence_prop_view.htm#BABFAEBB">JPA Details view (for entities)</a></div>
-<!-- class="sect3" -->
-<!-- class="sect2" -->
-<!-- Start Footer -->
-<div class="footer">
-<table class="simple oac_no_warn" summary="" cellspacing="0" cellpadding="0" width="100%">
-<col width="86%" />
-<col width="*" />
-<tr>
-<td align="left"><span class="copyrightlogo">Copyright&nbsp;&copy;&nbsp;2006, 2009,&nbsp;Oracle&nbsp;and/or&nbsp;its&nbsp;affiliates.&nbsp;All&nbsp;rights&nbsp;reserved.</span><br />
-<a href="dcommon/html/cpyr.htm"><span class="copyrightlogo">Legal Notices</span></a></td>
-</tr>
-</table>
-</div>
-<!-- class="footer" -->
-</body>
-</html>
diff --git a/jpa/plugins/org.eclipse.jpt.doc.user/reference011.htm b/jpa/plugins/org.eclipse.jpt.doc.user/reference011.htm
deleted file mode 100644
index bf92c5d1c6..0000000000
--- a/jpa/plugins/org.eclipse.jpt.doc.user/reference011.htm
+++ /dev/null
@@ -1,82 +0,0 @@
-<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN"
- "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
-<html xmlns="http://www.w3.org/1999/xhtml" xml:lang="en" lang="en">
-<head>
-<meta http-equiv="Content-Type" content="text/html; charset=us-ascii" />
-
-<meta http-equiv="Content-Style-Type" content="text/css" />
-<meta http-equiv="Content-Script-Type" content="text/javascript" />
-<title>Join Table Information</title>
-<meta name="generator" content="Oracle DARB XHTML Converter (Mode = ohj/ohw) - Version 5.1.1 Build 004" />
-<meta name="date" content="2009-05-01T8:12:51Z" />
-<meta name="robots" content="noarchive" />
-<meta name="doctitle" content="Join Table Information" />
-<meta name="relnum" content="Release 2.2" />
-<meta name="copyright" content="Copyright (c) 2000, 2008 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. Contributors: Oracle - initial API and implementation" />
-<link rel="copyright" href="dcommon/html/cpyr.htm" title="Copyright" type="text/html" />
-<link rel="stylesheet" href="dcommon/css/blafdoc.css" title="Oracle BLAFDoc" type="text/css" />
-<!-- contents -->
-</head>
-<body>
-<p><a id="CACBAEBC" name="CACBAEBC"></a></p>
-<div class="sect3"><!-- infolevel="all" infotype="General" -->
-<h1>Join Table Information</h1>
-<p>Use area to specify a mapped column for joining an entity association. By default, the mapping is assumed to have a single join.</p>
-<p>This table lists the fields available on the <span class="gui-object-title">Join Table</span> area in <span class="gui-object-title">the JPA Details</span> view for <a href="tasks015.htm#BABHGEBD">One-to-many mapping</a> and <a href="tasks013.htm#BABEIEGD">Many-to-many mapping</a> mapping types.</p>
-<div class="inftblruleinformal">
-<table class="RuleInformal" title="This table describes the options on the Join Table tab." summary="This table describes the options on the Join Table tab." dir="ltr" border="1" width="100%" frame="border" rules="all" cellpadding="3" cellspacing="0">
-<col width="26%" />
-<col width="*" />
-<col width="34%" />
-<thead>
-<tr align="left" valign="top">
-<th align="left" valign="bottom" id="r1c1-t17">Property</th>
-<th align="left" valign="bottom" id="r1c2-t17">Description</th>
-<th align="left" valign="bottom" id="r1c3-t17">Default</th>
-</tr>
-</thead>
-<tbody>
-<tr align="left" valign="top">
-<td align="left" id="r2c1-t17" headers="r1c1-t17">Name</td>
-<td align="left" headers="r2c1-t17 r1c2-t17">Name of the join table that contains the foreign key column.</td>
-<td align="left" headers="r2c1-t17 r1c3-t17">By default, the name is assumed to be the primary tables associated with the entities concatenated with an underscore.</td>
-</tr>
-<tr align="left" valign="top">
-<td align="left" id="r3c1-t17" headers="r1c1-t17"><a id="CACBBDFG" name="CACBBDFG"></a>Join Columns</td>
-<td align="left" headers="r3c1-t17 r1c2-t17"><a id="sthref244" name="sthref244"></a><a id="sthref245" name="sthref245"></a>Specify a mapped column for joining an entity association. This field corresponds to the <code>@JoinColum</code> attribute.
-<p>Select <span class="bold">Override Default</span>, then Add, Edit, or Remove the join columns.</p>
-</td>
-<td align="left" headers="r3c1-t17 r1c3-t17">By default, the mapping is assumed to have a single join.</td>
-</tr>
-<tr align="left" valign="top">
-<td align="left" id="r4c1-t17" headers="r1c1-t17">Inverse Join Columns</td>
-<td align="left" headers="r4c1-t17 r1c2-t17">Select <span class="bold">Override Default</span>, then Add, Edit, or Remove the join columns.</td>
-<td align="left" headers="r4c1-t17 r1c3-t17"><br /></td>
-</tr>
-</tbody>
-</table>
-<br /></div>
-<!-- class="inftblruleinformal" -->
-<p>&nbsp;</p>
-<img src="img/ngrelt.png" alt="Related task" title="Related task" /><br />
-<br />
-<a href="task_mapping.htm#BABDGBIJ">Mapping an entity</a>
-<p>&nbsp;</p>
-<img src="img/ngrelr.png" alt="Related task" title="Related task" /><br />
-<br />
-<a href="reference028.htm#CACCGEHC">Edit Join Columns Dialog</a></div>
-<!-- class="sect3" -->
-<!-- Start Footer -->
-<div class="footer">
-<table class="simple oac_no_warn" summary="" cellspacing="0" cellpadding="0" width="100%">
-<col width="86%" />
-<col width="*" />
-<tr>
-<td align="left"><span class="copyrightlogo">Copyright&nbsp;&copy;&nbsp;2006, 2009,&nbsp;Oracle&nbsp;and/or&nbsp;its&nbsp;affiliates.&nbsp;All&nbsp;rights&nbsp;reserved.</span><br />
-<a href="dcommon/html/cpyr.htm"><span class="copyrightlogo">Legal Notices</span></a></td>
-</tr>
-</table>
-</div>
-<!-- class="footer" -->
-</body>
-</html>
diff --git a/jpa/plugins/org.eclipse.jpt.doc.user/reference012.htm b/jpa/plugins/org.eclipse.jpt.doc.user/reference012.htm
deleted file mode 100644
index 108c284bae..0000000000
--- a/jpa/plugins/org.eclipse.jpt.doc.user/reference012.htm
+++ /dev/null
@@ -1,71 +0,0 @@
-<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN"
- "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
-<html xmlns="http://www.w3.org/1999/xhtml" xml:lang="en" lang="en">
-<head>
-<meta http-equiv="Content-Type" content="text/html; charset=us-ascii" />
-
-<meta http-equiv="Content-Style-Type" content="text/css" />
-<meta http-equiv="Content-Script-Type" content="text/javascript" />
-<title>Join Columns Information</title>
-<meta name="generator" content="Oracle DARB XHTML Converter (Mode = ohj/ohw) - Version 5.1.1 Build 004" />
-<meta name="date" content="2009-05-01T8:12:51Z" />
-<meta name="robots" content="noarchive" />
-<meta name="doctitle" content="Join Columns Information" />
-<meta name="relnum" content="Release 2.2" />
-<meta name="copyright" content="Copyright (c) 2000, 2008 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. Contributors: Oracle - initial API and implementation" />
-<link rel="copyright" href="dcommon/html/cpyr.htm" title="Copyright" type="text/html" />
-<link rel="stylesheet" href="dcommon/css/blafdoc.css" title="Oracle BLAFDoc" type="text/css" />
-<!-- contents -->
-</head>
-<body>
-<p><a id="CACFCEJC" name="CACFCEJC"></a></p>
-<div class="sect3"><!-- infolevel="all" infotype="General" -->
-<h1>Join Columns Information</h1>
-<p><a id="sthref246" name="sthref246"></a>This table lists the fields available in the <span class="gui-object-title">Join Table</span> area in <span class="gui-object-title">JPA Details</span> view for <a href="tasks014.htm#BABHFAFJ">Many-to-one mapping</a> and <a href="tasks016.htm#BABFHBCJ">One-to-one mapping</a> mapping types.</p>
-<div class="inftblruleinformal">
-<table class="RuleInformal" title="This table describes the options on the Join Columns tab." summary="This table describes the options on the Join Columns tab." dir="ltr" border="1" width="100%" frame="border" rules="all" cellpadding="3" cellspacing="0">
-<col width="26%" />
-<col width="*" />
-<col width="34%" />
-<thead>
-<tr align="left" valign="top">
-<th align="left" valign="bottom" id="r1c1-t18">Property</th>
-<th align="left" valign="bottom" id="r1c2-t18">Description</th>
-<th align="left" valign="bottom" id="r1c3-t18">Default</th>
-</tr>
-</thead>
-<tbody>
-<tr align="left" valign="top">
-<td align="left" id="r2c1-t18" headers="r1c1-t18">Join Column</td>
-<td align="left" headers="r2c1-t18 r1c2-t18"><a id="sthref247" name="sthref247"></a><a id="sthref248" name="sthref248"></a>Specify a mapped column for joining an entity association. This field corresponds to the <code>@JoinColum</code> attribute.
-<p>Select <span class="bold">Override Default</span>, then Add, Edit, or Remove the join columns.</p>
-</td>
-<td align="left" headers="r2c1-t18 r1c3-t18">By default, the mapping is assumed to have a single join.</td>
-</tr>
-</tbody>
-</table>
-<br /></div>
-<!-- class="inftblruleinformal" -->
-<p>&nbsp;</p>
-<img src="img/ngrelt.png" alt="Related task" title="Related task" /><br />
-<br />
-<a href="task_mapping.htm#BABDGBIJ">Mapping an entity</a>
-<p>&nbsp;</p>
-<img src="img/ngrelr.png" alt="Related task" title="Related task" /><br />
-<br />
-<a href="reference028.htm#CACCGEHC">Edit Join Columns Dialog</a></div>
-<!-- class="sect3" -->
-<!-- Start Footer -->
-<div class="footer">
-<table class="simple oac_no_warn" summary="" cellspacing="0" cellpadding="0" width="100%">
-<col width="86%" />
-<col width="*" />
-<tr>
-<td align="left"><span class="copyrightlogo">Copyright&nbsp;&copy;&nbsp;2006, 2009,&nbsp;Oracle&nbsp;and/or&nbsp;its&nbsp;affiliates.&nbsp;All&nbsp;rights&nbsp;reserved.</span><br />
-<a href="dcommon/html/cpyr.htm"><span class="copyrightlogo">Legal Notices</span></a></td>
-</tr>
-</table>
-</div>
-<!-- class="footer" -->
-</body>
-</html>
diff --git a/jpa/plugins/org.eclipse.jpt.doc.user/reference013.htm b/jpa/plugins/org.eclipse.jpt.doc.user/reference013.htm
deleted file mode 100644
index ccc78a41c1..0000000000
--- a/jpa/plugins/org.eclipse.jpt.doc.user/reference013.htm
+++ /dev/null
@@ -1,98 +0,0 @@
-<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN"
- "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
-<html xmlns="http://www.w3.org/1999/xhtml" xml:lang="en" lang="en">
-<head>
-<meta http-equiv="Content-Type" content="text/html; charset=us-ascii" />
-
-<meta http-equiv="Content-Style-Type" content="text/css" />
-<meta http-equiv="Content-Script-Type" content="text/javascript" />
-<title>General information</title>
-<meta name="generator" content="Oracle DARB XHTML Converter (Mode = ohj/ohw) - Version 5.1.1 Build 004" />
-<meta name="date" content="2009-05-01T8:12:51Z" />
-<meta name="robots" content="noarchive" />
-<meta name="doctitle" content="General information" />
-<meta name="relnum" content="Release 2.2" />
-<meta name="copyright" content="Copyright (c) 2000, 2008 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. Contributors: Oracle - initial API and implementation" />
-<link rel="copyright" href="dcommon/html/cpyr.htm" title="Copyright" type="text/html" />
-<link rel="stylesheet" href="dcommon/css/blafdoc.css" title="Oracle BLAFDoc" type="text/css" />
-<!-- contents -->
-</head>
-<body>
-<p><a id="CACCACGH" name="CACCACGH"></a></p>
-<div class="sect3"><!-- infolevel="all" infotype="General" -->
-<h1>General information</h1>
-<p>This table lists the General information fields available in the <span class="gui-object-title">JPA Details</span> view for each entity type.</p>
-<div class="inftblruleinformal">
-<table class="RuleInformal" title="This table describes the options on the Persistence Properties view, General tab." summary="This table describes the options on the Persistence Properties view, General tab." dir="ltr" border="1" width="100%" frame="border" rules="all" cellpadding="3" cellspacing="0">
-<col width="21%" />
-<col width="*" />
-<col width="22%" />
-<thead>
-<tr align="left" valign="top">
-<th align="left" valign="bottom" id="r1c1-t20">Property</th>
-<th align="left" valign="bottom" id="r1c2-t20">Description</th>
-<th align="left" valign="bottom" id="r1c3-t20">Default</th>
-</tr>
-</thead>
-<tbody>
-<tr align="left" valign="top">
-<td align="left" id="r2c1-t20" headers="r1c1-t20">Package</td>
-<td align="left" headers="r2c1-t20 r1c2-t20">The Java package that contains the persistent entities. Click <span class="bold">Browse</span> and select the package</td>
-<td align="left" headers="r2c1-t20 r1c3-t20"><br /></td>
-</tr>
-<tr align="left" valign="top">
-<td align="left" id="r3c1-t20" headers="r1c1-t20">Schema</td>
-<td align="left" headers="r3c1-t20 r1c2-t20">The database schema that contains the <span class="bold">Table</span>.
-<p>This field corresponds to the <code>&lt;schema&gt;</code> element in the <code>orm.xml</code> file.</p>
-</td>
-<td align="left" headers="r3c1-t20 r1c3-t20"><br /></td>
-</tr>
-<tr align="left" valign="top">
-<td align="left" id="r4c1-t20" headers="r1c1-t20">Catalog</td>
-<td align="left" headers="r4c1-t20 r1c2-t20">The database catalog that contains the <span class="bold">Table</span>.
-<p>This field corresponds to the <code>&lt;catalog&gt;</code> element in the <code>orm.xml</code> file.</p>
-</td>
-<td align="left" headers="r4c1-t20 r1c3-t20"><br /></td>
-</tr>
-<tr align="left" valign="top">
-<td align="left" id="r5c1-t20" headers="r1c1-t20">Access</td>
-<td align="left" headers="r5c1-t20 r1c2-t20">Specify the default access method for the variables in the project:
-<ul>
-<li>
-<p>Property</p>
-</li>
-<li>
-<p>Field</p>
-</li>
-</ul>
-<p>This field corresponds to the <code>&lt;access&gt;</code> element in the <code>orm.xml</code> file.</p>
-</td>
-<td align="left" headers="r5c1-t20 r1c3-t20"><br /></td>
-</tr>
-</tbody>
-</table>
-<br /></div>
-<!-- class="inftblruleinformal" -->
-<p>&nbsp;</p>
-<img src="img/ngrelt.png" alt="Related task" title="Related task" /><br />
-<br />
-<a href="task_add_persistence.htm#BABHICAI">Adding persistence to a class</a>
-<p>&nbsp;</p>
-<img src="img/ngrelr.png" alt="Related reference" title="Related reference" /><br />
-<br />
-<a href="ref_persistence_prop_view.htm#BABFAEBB">JPA Details view (for entities)</a></div>
-<!-- class="sect3" -->
-<!-- Start Footer -->
-<div class="footer">
-<table class="simple oac_no_warn" summary="" cellspacing="0" cellpadding="0" width="100%">
-<col width="86%" />
-<col width="*" />
-<tr>
-<td align="left"><span class="copyrightlogo">Copyright&nbsp;&copy;&nbsp;2006, 2009,&nbsp;Oracle&nbsp;and/or&nbsp;its&nbsp;affiliates.&nbsp;All&nbsp;rights&nbsp;reserved.</span><br />
-<a href="dcommon/html/cpyr.htm"><span class="copyrightlogo">Legal Notices</span></a></td>
-</tr>
-</table>
-</div>
-<!-- class="footer" -->
-</body>
-</html>
diff --git a/jpa/plugins/org.eclipse.jpt.doc.user/reference014.htm b/jpa/plugins/org.eclipse.jpt.doc.user/reference014.htm
deleted file mode 100644
index 9395b34614..0000000000
--- a/jpa/plugins/org.eclipse.jpt.doc.user/reference014.htm
+++ /dev/null
@@ -1,106 +0,0 @@
-<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN"
- "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
-<html xmlns="http://www.w3.org/1999/xhtml" xml:lang="en" lang="en">
-<head>
-<meta http-equiv="Content-Type" content="text/html; charset=us-ascii" />
-
-<meta http-equiv="Content-Style-Type" content="text/css" />
-<meta http-equiv="Content-Script-Type" content="text/javascript" />
-<title>Persistence Unit information</title>
-<meta name="generator" content="Oracle DARB XHTML Converter (Mode = ohj/ohw) - Version 5.1.1 Build 004" />
-<meta name="date" content="2009-05-01T8:12:52Z" />
-<meta name="robots" content="noarchive" />
-<meta name="doctitle" content="Persistence Unit information" />
-<meta name="relnum" content="Release 2.2" />
-<meta name="copyright" content="Copyright (c) 2000, 2008 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. Contributors: Oracle - initial API and implementation" />
-<link rel="copyright" href="dcommon/html/cpyr.htm" title="Copyright" type="text/html" />
-<link rel="stylesheet" href="dcommon/css/blafdoc.css" title="Oracle BLAFDoc" type="text/css" />
-<!-- contents -->
-</head>
-<body>
-<p><a id="CACEAGBG" name="CACEAGBG"></a></p>
-<div class="sect3"><!-- infolevel="all" infotype="General" -->
-<h1>Persistence Unit information</h1>
-<p>This table lists the Persistence Unit information fields available in the <span class="gui-object-title">JPA Details</span> view for each entity type. These fields are contained in the <code>&lt;persistence-unit-metadata&gt;</code> element in the <code>orm.xml</code> file.</p>
-<div class="inftblruleinformal">
-<table class="RuleInformal" title="This table describes the options on the Persistence Properties view, General tab." summary="This table describes the options on the Persistence Properties view, General tab." dir="ltr" border="1" width="100%" frame="border" rules="all" cellpadding="3" cellspacing="0">
-<col width="21%" />
-<col width="*" />
-<col width="22%" />
-<thead>
-<tr align="left" valign="top">
-<th align="left" valign="bottom" id="r1c1-t21">Property</th>
-<th align="left" valign="bottom" id="r1c2-t21">Description</th>
-<th align="left" valign="bottom" id="r1c3-t21">Default</th>
-</tr>
-</thead>
-<tbody>
-<tr align="left" valign="top">
-<td align="left" id="r2c1-t21" headers="r1c1-t21">XML Mapping Data Complete</td>
-<td align="left" headers="r2c1-t21 r1c2-t21">Specifies that the Java classes in this persistence unit are fully specified by their metadata. Any annotations will be ignored.
-<p>This field corresponds to the <code>&lt;xml-mapping-metadata-complete&gt;</code> element in the <code>orm.xml</code> file.</p>
-</td>
-<td align="left" headers="r2c1-t21 r1c3-t21"><br /></td>
-</tr>
-<tr align="left" valign="top">
-<td align="left" id="r3c1-t21" headers="r1c1-t21">Schema</td>
-<td align="left" headers="r3c1-t21 r1c2-t21">The database schema that contains the <span class="bold">Table</span>.
-<p>This field corresponds to the <code>&lt;schema&gt;</code> element in the <code>orm.xml</code> file.</p>
-</td>
-<td align="left" headers="r3c1-t21 r1c3-t21"><br /></td>
-</tr>
-<tr align="left" valign="top">
-<td align="left" id="r4c1-t21" headers="r1c1-t21">Catalog</td>
-<td align="left" headers="r4c1-t21 r1c2-t21">The database catalog that contains the <span class="bold">Table</span>.
-<p>This field corresponds to the <code>&lt;catalog&gt;</code> element in the <code>orm.xml</code> file.</p>
-</td>
-<td align="left" headers="r4c1-t21 r1c3-t21"><br /></td>
-</tr>
-<tr align="left" valign="top">
-<td align="left" id="r5c1-t21" headers="r1c1-t21">Access</td>
-<td align="left" headers="r5c1-t21 r1c2-t21">Specify how the entity its access instance variables.
-<ul>
-<li>
-<p>Property &ndash; Persistent state accessed through the property accessor methods. The property accessor methods must be <span class="bold">public</span> or <span class="bold">private</span>.</p>
-</li>
-<li>
-<p>Field &ndash; Instance variables are accessed directly. All non-transient instance variables are persistent.</p>
-</li>
-</ul>
-</td>
-<td align="left" headers="r5c1-t21 r1c3-t21">Property</td>
-</tr>
-<tr align="left" valign="top">
-<td align="left" id="r6c1-t21" headers="r1c1-t21">Cascade Persist</td>
-<td align="left" headers="r6c1-t21 r1c2-t21">Adds cascade-persist to the set of cascade options in entity relationships of the persistence unit.
-<p>This field corresponds to the <code>&lt;cascade-persist&gt;</code> element in the <code>orm.xml</code> file.</p>
-</td>
-<td align="left" headers="r6c1-t21 r1c3-t21"><br /></td>
-</tr>
-</tbody>
-</table>
-<br /></div>
-<!-- class="inftblruleinformal" -->
-<p>&nbsp;</p>
-<img src="img/ngrelt.png" alt="Related task" title="Related task" /><br />
-<br />
-<a href="task_add_persistence.htm#BABHICAI">Adding persistence to a class</a>
-<p>&nbsp;</p>
-<img src="img/ngrelr.png" alt="Related reference" title="Related reference" /><br />
-<br />
-<a href="ref_persistence_prop_view.htm#BABFAEBB">JPA Details view (for entities)</a></div>
-<!-- class="sect3" -->
-<!-- Start Footer -->
-<div class="footer">
-<table class="simple oac_no_warn" summary="" cellspacing="0" cellpadding="0" width="100%">
-<col width="86%" />
-<col width="*" />
-<tr>
-<td align="left"><span class="copyrightlogo">Copyright&nbsp;&copy;&nbsp;2006, 2009,&nbsp;Oracle&nbsp;and/or&nbsp;its&nbsp;affiliates.&nbsp;All&nbsp;rights&nbsp;reserved.</span><br />
-<a href="dcommon/html/cpyr.htm"><span class="copyrightlogo">Legal Notices</span></a></td>
-</tr>
-</table>
-</div>
-<!-- class="footer" -->
-</body>
-</html>
diff --git a/jpa/plugins/org.eclipse.jpt.doc.user/reference015.htm b/jpa/plugins/org.eclipse.jpt.doc.user/reference015.htm
deleted file mode 100644
index f8459ce82a..0000000000
--- a/jpa/plugins/org.eclipse.jpt.doc.user/reference015.htm
+++ /dev/null
@@ -1,95 +0,0 @@
-<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN"
- "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
-<html xmlns="http://www.w3.org/1999/xhtml" xml:lang="en" lang="en">
-<head>
-<meta http-equiv="Content-Type" content="text/html; charset=us-ascii" />
-
-<meta http-equiv="Content-Style-Type" content="text/css" />
-<meta http-equiv="Content-Script-Type" content="text/javascript" />
-<title>Generators</title>
-<meta name="generator" content="Oracle DARB XHTML Converter (Mode = ohj/ohw) - Version 5.1.1 Build 004" />
-<meta name="date" content="2009-05-01T8:12:52Z" />
-<meta name="robots" content="noarchive" />
-<meta name="doctitle" content="Generators" />
-<meta name="relnum" content="Release 2.2" />
-<meta name="copyright" content="Copyright (c) 2000, 2008 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. Contributors: Oracle - initial API and implementation" />
-<link rel="copyright" href="dcommon/html/cpyr.htm" title="Copyright" type="text/html" />
-<link rel="stylesheet" href="dcommon/css/blafdoc.css" title="Oracle BLAFDoc" type="text/css" />
-<!-- contents -->
-</head>
-<body>
-<p><a id="CIAFGAIJ" name="CIAFGAIJ"></a></p>
-<div class="sect3"><!-- infolevel="all" infotype="General" -->
-<h1>Generators</h1>
-<p>This table lists the Generator information fields available in the <span class="gui-object-title">JPA Details</span> view for the <code>orm.xml</code> file.</p>
-<div class="inftblruleinformal">
-<table class="RuleInformal" title="This table describes the options on the Persistence Properties view, General tab." summary="This table describes the options on the Persistence Properties view, General tab." dir="ltr" border="1" width="100%" frame="border" rules="all" cellpadding="3" cellspacing="0">
-<col width="21%" />
-<col width="*" />
-<thead>
-<tr align="left" valign="top">
-<th align="left" valign="bottom" id="r1c1-t22">Property</th>
-<th align="left" valign="bottom" id="r1c2-t22">Description</th>
-</tr>
-</thead>
-<tbody>
-<tr align="left" valign="top">
-<td align="left" id="r2c1-t22" headers="r1c1-t22">Generator</td>
-<td align="left" headers="r2c1-t22 r1c2-t22">Displays the existing Sequence and Table generators.
-<p>Click <span class="bold">Add Sequence</span> or <span class="bold">Add Table</span> to add a new generator.</p>
-<p>For sequence generators, you must complete the following fields:</p>
-<ul>
-<li>
-<p>Name</p>
-</li>
-<li>
-<p>Sequence</p>
-</li>
-</ul>
-<p>For table generators, you must complete the following fields:</p>
-<ul>
-<li>
-<p>Name</p>
-</li>
-<li>
-<p>Table</p>
-</li>
-<li>
-<p>Primary key column</p>
-</li>
-<li>
-<p>Value column</p>
-</li>
-<li>
-<p>Primary key column value</p>
-</li>
-</ul>
-</td>
-</tr>
-</tbody>
-</table>
-<br /></div>
-<!-- class="inftblruleinformal" -->
-<p>&nbsp;</p>
-<img src="img/ngrelt.png" alt="Related task" title="Related task" /><br />
-<br />
-<a href="task_add_persistence.htm#BABHICAI">Adding persistence to a class</a>
-<p>&nbsp;</p>
-<img src="img/ngrelr.png" alt="Related reference" title="Related reference" /><br />
-<br />
-<a href="ref_details_orm.htm#CACGDGHC">JPA Details view (for orm.xml)</a></div>
-<!-- class="sect3" -->
-<!-- Start Footer -->
-<div class="footer">
-<table class="simple oac_no_warn" summary="" cellspacing="0" cellpadding="0" width="100%">
-<col width="86%" />
-<col width="*" />
-<tr>
-<td align="left"><span class="copyrightlogo">Copyright&nbsp;&copy;&nbsp;2006, 2009,&nbsp;Oracle&nbsp;and/or&nbsp;its&nbsp;affiliates.&nbsp;All&nbsp;rights&nbsp;reserved.</span><br />
-<a href="dcommon/html/cpyr.htm"><span class="copyrightlogo">Legal Notices</span></a></td>
-</tr>
-</table>
-</div>
-<!-- class="footer" -->
-</body>
-</html>
diff --git a/jpa/plugins/org.eclipse.jpt.doc.user/reference016.htm b/jpa/plugins/org.eclipse.jpt.doc.user/reference016.htm
deleted file mode 100644
index 715d76b60b..0000000000
--- a/jpa/plugins/org.eclipse.jpt.doc.user/reference016.htm
+++ /dev/null
@@ -1,76 +0,0 @@
-<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN"
- "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
-<html xmlns="http://www.w3.org/1999/xhtml" xml:lang="en" lang="en">
-<head>
-<meta http-equiv="Content-Type" content="text/html; charset=us-ascii" />
-
-<meta http-equiv="Content-Style-Type" content="text/css" />
-<meta http-equiv="Content-Script-Type" content="text/javascript" />
-<title>Queries</title>
-<meta name="generator" content="Oracle DARB XHTML Converter (Mode = ohj/ohw) - Version 5.1.1 Build 004" />
-<meta name="date" content="2009-05-01T8:12:52Z" />
-<meta name="robots" content="noarchive" />
-<meta name="doctitle" content="Queries" />
-<meta name="relnum" content="Release 2.2" />
-<meta name="copyright" content="Copyright (c) 2000, 2008 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. Contributors: Oracle - initial API and implementation" />
-<link rel="copyright" href="dcommon/html/cpyr.htm" title="Copyright" type="text/html" />
-<link rel="stylesheet" href="dcommon/css/blafdoc.css" title="Oracle BLAFDoc" type="text/css" />
-<!-- contents -->
-</head>
-<body>
-<p><a id="CIAIBAAJ" name="CIAIBAAJ"></a></p>
-<div class="sect3"><!-- infolevel="all" infotype="General" -->
-<h1>Queries</h1>
-<p>This table lists the Query information fields available in the <span class="gui-object-title">JPA Details</span> view for the <code>orm.xml</code> file.</p>
-<div class="inftblruleinformal">
-<table class="RuleInformal" title="This table describes the options on the Persistence Properties view, General tab." summary="This table describes the options on the Persistence Properties view, General tab." dir="ltr" border="1" width="100%" frame="border" rules="all" cellpadding="3" cellspacing="0">
-<col width="21%" />
-<col width="*" />
-<thead>
-<tr align="left" valign="top">
-<th align="left" valign="bottom" id="r1c1-t23">Property</th>
-<th align="left" valign="bottom" id="r1c2-t23">Description</th>
-</tr>
-</thead>
-<tbody>
-<tr align="left" valign="top">
-<td align="left" id="r2c1-t23" headers="r1c1-t23">Queries</td>
-<td align="left" headers="r2c1-t23 r1c2-t23">Displays the existing Named and Native queries.
-<p>Click <span class="bold">Add</span> to add a named query, or <span class="bold">Add Native</span> for a native query.</p>
-<p>For named queries, enter the query in the Query field.</p>
-<p>For native queries, select a result class, then enter the query in the Query field.</p>
-</td>
-</tr>
-<tr align="left" valign="top">
-<td align="left" id="r3c1-t23" headers="r1c1-t23">Query Hints</td>
-<td align="left" headers="r3c1-t23 r1c2-t23">Displays the existing query hints (Name and Value).
-<p>Click <span class="bold">Add</span> to add a new query hint.</p>
-</td>
-</tr>
-</tbody>
-</table>
-<br /></div>
-<!-- class="inftblruleinformal" -->
-<p>&nbsp;</p>
-<img src="img/ngrelt.png" alt="Related task" title="Related task" /><br />
-<br />
-<a href="tasks008.htm#BABIGBGG">Creating Named Queries</a>
-<p>&nbsp;</p>
-<img src="img/ngrelr.png" alt="Related reference" title="Related reference" /><br />
-<br />
-<a href="ref_details_orm.htm#CACGDGHC">JPA Details view (for orm.xml)</a></div>
-<!-- class="sect3" -->
-<!-- Start Footer -->
-<div class="footer">
-<table class="simple oac_no_warn" summary="" cellspacing="0" cellpadding="0" width="100%">
-<col width="86%" />
-<col width="*" />
-<tr>
-<td align="left"><span class="copyrightlogo">Copyright&nbsp;&copy;&nbsp;2006, 2009,&nbsp;Oracle&nbsp;and/or&nbsp;its&nbsp;affiliates.&nbsp;All&nbsp;rights&nbsp;reserved.</span><br />
-<a href="dcommon/html/cpyr.htm"><span class="copyrightlogo">Legal Notices</span></a></td>
-</tr>
-</table>
-</div>
-<!-- class="footer" -->
-</body>
-</html>
diff --git a/jpa/plugins/org.eclipse.jpt.doc.user/reference017.htm b/jpa/plugins/org.eclipse.jpt.doc.user/reference017.htm
deleted file mode 100644
index 743078007e..0000000000
--- a/jpa/plugins/org.eclipse.jpt.doc.user/reference017.htm
+++ /dev/null
@@ -1,46 +0,0 @@
-<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN"
- "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
-<html xmlns="http://www.w3.org/1999/xhtml" xml:lang="en" lang="en">
-<head>
-<meta http-equiv="Content-Type" content="text/html; charset=us-ascii" />
-
-<meta http-equiv="Content-Style-Type" content="text/css" />
-<meta http-equiv="Content-Script-Type" content="text/javascript" />
-<title>Converters</title>
-<meta name="generator" content="Oracle DARB XHTML Converter (Mode = ohj/ohw) - Version 5.1.1 Build 004" />
-<meta name="date" content="2009-05-01T8:12:52Z" />
-<meta name="robots" content="noarchive" />
-<meta name="doctitle" content="Converters" />
-<meta name="relnum" content="Release 2.2" />
-<meta name="copyright" content="Copyright (c) 2000, 2008 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. Contributors: Oracle - initial API and implementation" />
-<link rel="copyright" href="dcommon/html/cpyr.htm" title="Copyright" type="text/html" />
-<link rel="stylesheet" href="dcommon/css/blafdoc.css" title="Oracle BLAFDoc" type="text/css" />
-<!-- contents -->
-</head>
-<body>
-<p><a id="CIADGCID" name="CIADGCID"></a></p>
-<div class="sect3"><!-- infolevel="all" infotype="General" -->
-<h1>Converters</h1>
-<p>The Converters information in the JPA Details view applies only when using EclipseLink</p>
-<p>Click <span class="bold">Add</span> to create a new converter, using the <a href="ref_add_converter.htm#CIAGCGIJ">Add Converter dialog</a>.</p>
-<p>&nbsp;</p>
-<p>&nbsp;</p>
-<img src="img/ngrelr.png" alt="Related reference" title="Related reference" /><br />
-<br />
-<a href="ref_details_orm.htm#CACGDGHC">JPA Details view (for orm.xml)</a></div>
-<!-- class="sect3" -->
-<!-- class="sect2" -->
-<!-- Start Footer -->
-<div class="footer">
-<table class="simple oac_no_warn" summary="" cellspacing="0" cellpadding="0" width="100%">
-<col width="86%" />
-<col width="*" />
-<tr>
-<td align="left"><span class="copyrightlogo">Copyright&nbsp;&copy;&nbsp;2006, 2009,&nbsp;Oracle&nbsp;and/or&nbsp;its&nbsp;affiliates.&nbsp;All&nbsp;rights&nbsp;reserved.</span><br />
-<a href="dcommon/html/cpyr.htm"><span class="copyrightlogo">Legal Notices</span></a></td>
-</tr>
-</table>
-</div>
-<!-- class="footer" -->
-</body>
-</html>
diff --git a/jpa/plugins/org.eclipse.jpt.doc.user/reference018.htm b/jpa/plugins/org.eclipse.jpt.doc.user/reference018.htm
deleted file mode 100644
index 7d68189385..0000000000
--- a/jpa/plugins/org.eclipse.jpt.doc.user/reference018.htm
+++ /dev/null
@@ -1,183 +0,0 @@
-<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN"
- "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
-<html xmlns="http://www.w3.org/1999/xhtml" xml:lang="en" lang="en">
-<head>
-<meta http-equiv="Content-Type" content="text/html; charset=us-ascii" />
-
-<meta http-equiv="Content-Style-Type" content="text/css" />
-<meta http-equiv="Content-Script-Type" content="text/javascript" />
-<title>Connection</title>
-<meta name="generator" content="Oracle DARB XHTML Converter (Mode = ohj/ohw) - Version 5.1.1 Build 004" />
-<meta name="date" content="2009-05-01T8:12:52Z" />
-<meta name="robots" content="noarchive" />
-<meta name="doctitle" content="Connection" />
-<meta name="relnum" content="Release 2.2" />
-<meta name="copyright" content="Copyright (c) 2000, 2008 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. Contributors: Oracle - initial API and implementation" />
-<link rel="copyright" href="dcommon/html/cpyr.htm" title="Copyright" type="text/html" />
-<link rel="stylesheet" href="dcommon/css/blafdoc.css" title="Oracle BLAFDoc" type="text/css" />
-<!-- contents -->
-</head>
-<body>
-<p><a id="CIAFFJIE" name="CIAFFJIE"></a></p>
-<div class="sect3"><!-- infolevel="all" infotype="General" -->
-<h1>Connection</h1>
-<p>The following table lists the properties available in the Connection page of the <a href="ref_persistence_xmll_editor.htm#CIACCHID">persistence.xml Editor</a>.</p>
-<div class="tblformal"><a id="sthref258" name="sthref258"></a><a id="sthref259" name="sthref259"></a>
-<p class="titleintable">Properties of the Connection Page</p>
-<table class="Formal" title="Properties of the Connection Page" summary="This table lists the properties for the persistence.xml editor&rsquo;s connection page." dir="ltr" border="1" width="100%" frame="hsides" rules="groups" cellpadding="3" cellspacing="0">
-<col width="24%" />
-<col width="*" />
-<col width="24%" />
-<thead>
-<tr align="left" valign="top">
-<th align="left" valign="bottom" id="r1c1-t25">Property</th>
-<th align="left" valign="bottom" id="r1c2-t25">Description</th>
-<th align="left" valign="bottom" id="r1c3-t25">Default</th>
-</tr>
-</thead>
-<tbody>
-<tr align="left" valign="top">
-<td align="left" id="r2c1-t25" headers="r1c1-t25">
-<p>Transaction Type</p>
-</td>
-<td align="left" headers="r2c1-t25 r1c2-t25">
-<p>Specify if the connection for this persistence unit uses one of the following transaction types:</p>
-<ul>
-<li>
-<p><span class="bold">Default</span> -- Select to use the container used by the container.</p>
-</li>
-<li>
-<p><span class="bold">JTA</span> (Java Transaction API) -- Transactions of the Java EE server.</p>
-</li>
-<li>
-<p><span class="bold">Resource Local</span> -- Native actions of a JDBC driver that are referenced by a persistence unit.</p>
-</li>
-</ul>
-</td>
-<td align="left" headers="r2c1-t25 r1c3-t25"><br /></td>
-</tr>
-<tr align="left" valign="top">
-<td align="left" id="r3c1-t25" headers="r1c1-t25">
-<p>Batch Writing</p>
-</td>
-<td align="left" headers="r3c1-t25 r1c2-t25">
-<p>Specify the use of batch writing to optimize transactions with multiple write operations.</p>
-<p>Set the value of this property into the session at deployment time.</p>
-<p>Note: This property applies when used both in a Java SE and Java EE environment.</p>
-<p>The following are the valid values for oracle.toplink.config.BatchWriting:</p>
-<ul>
-<li>
-<p><span class="bold">JDBC</span>&ndash;Use JDBC batch writing.</p>
-</li>
-<li>
-<p><span class="bold">Buffered</span>&ndash;Do not use either JDBC batch writing nor native platform batch writing.</p>
-</li>
-<li>
-<p><span class="bold">OracleJDBC</span>&ndash;Use both JDBC batch writing and Oracle native platform batch writing.</p>
-</li>
-<li>
-<p><span class="bold">None</span>&ndash;Do not use batch writing (turn it off).</p>
-</li>
-</ul>
-</td>
-<td align="left" headers="r3c1-t25 r1c3-t25">
-<p>None</p>
-</td>
-</tr>
-<tr align="left" valign="top">
-<td align="left" id="r4c1-t25" headers="r1c1-t25">
-<p>Statement caching</p>
-</td>
-<td align="left" headers="r4c1-t25 r1c2-t25"><br /></td>
-<td align="left" headers="r4c1-t25 r1c3-t25"><br /></td>
-</tr>
-<tr align="left" valign="top">
-<td align="left" id="r5c1-t25" headers="r1c1-t25">
-<p>Native SQL</p>
-</td>
-<td align="left" headers="r5c1-t25 r1c2-t25"><br /></td>
-<td align="left" headers="r5c1-t25 r1c3-t25">
-<p>False</p>
-</td>
-</tr>
-<tr align="left" valign="top">
-<td align="left" id="r6c1-t25" headers="r1c1-t25">
-<p>JTA Data Source Name</p>
-</td>
-<td align="left" headers="r6c1-t25 r1c2-t25">
-<p>If you selected <span class="bold">JTA</span> as the transaction type, then enter the name of the default JTA data source for the persistence unit.</p>
-</td>
-<td align="left" headers="r6c1-t25 r1c3-t25"><br /></td>
-</tr>
-<tr align="left" valign="top">
-<td align="left" id="r7c1-t25" headers="r1c1-t25">
-<p>Non-JTA Data Source Name</p>
-</td>
-<td align="left" headers="r7c1-t25 r1c2-t25">
-<p>If you selected <span class="bold">Resource Local</span> as the transaction type, then enter the name of the non-JTA data source.</p>
-<p>This property is not available for projects using the Generic platform.</p>
-</td>
-<td align="left" headers="r7c1-t25 r1c3-t25"><br /></td>
-</tr>
-<tr align="left" valign="top">
-<td align="left" id="r8c1-t25" headers="r1c1-t25">
-<p>&nbsp;&nbsp;Bind&nbsp;Parameters</p>
-</td>
-<td align="left" headers="r8c1-t25 r1c2-t25">
-<p>Control whether or not the query uses parameter binding.</p>
-<p>Note: This property applies when used in a Java SE environment.</p>
-<p>This property is not available for projects using the Generic platform.</p>
-</td>
-<td align="left" headers="r8c1-t25 r1c3-t25"><br /></td>
-</tr>
-<tr align="left" valign="top">
-<td align="left" id="r9c1-t25" headers="r1c1-t25">
-<p>EclipseLink Connection Pool</p>
-</td>
-<td align="left" headers="r9c1-t25 r1c2-t25">
-<p>Define the connection pool driver, URL, user name and password.</p>
-<p>These properties are note available for projects using the Generic platform.</p>
-</td>
-<td align="left" headers="r9c1-t25 r1c3-t25"><br /></td>
-</tr>
-<tr align="left" valign="top">
-<td align="left" id="r10c1-t25" headers="r1c1-t25">
-<p>&nbsp;&nbsp;Read&nbsp;Connection</p>
-</td>
-<td align="left" headers="r10c1-t25 r1c2-t25">
-<p>The maximum and minimum number of connections allowed in the JDBC read connection pool.</p>
-<p>Note: These property apply when used in a Java SE environment.</p>
-<p>These properties are not available for projects using the Generic platform</p>
-</td>
-<td align="left" headers="r10c1-t25 r1c3-t25"><br /></td>
-</tr>
-<tr align="left" valign="top">
-<td align="left" id="r11c1-t25" headers="r1c1-t25">
-<p>&nbsp;&nbsp;Write&nbsp;Connection</p>
-</td>
-<td align="left" headers="r11c1-t25 r1c2-t25">
-<p>The maximum and minimum number of connections allowed in the JDBC read connection pool.</p>
-<p>Note: These property apply when used in a Java SE environment.</p>
-<p>These properties are not available for projects using the Generic platform</p>
-</td>
-<td align="left" headers="r11c1-t25 r1c3-t25"><br /></td>
-</tr>
-</tbody>
-</table>
-<br /></div>
-<!-- class="tblformal" --></div>
-<!-- class="sect3" -->
-<!-- Start Footer -->
-<div class="footer">
-<table class="simple oac_no_warn" summary="" cellspacing="0" cellpadding="0" width="100%">
-<col width="86%" />
-<col width="*" />
-<tr>
-<td align="left"><span class="copyrightlogo">Copyright&nbsp;&copy;&nbsp;2006, 2009,&nbsp;Oracle&nbsp;and/or&nbsp;its&nbsp;affiliates.&nbsp;All&nbsp;rights&nbsp;reserved.</span><br />
-<a href="dcommon/html/cpyr.htm"><span class="copyrightlogo">Legal Notices</span></a></td>
-</tr>
-</table>
-</div>
-<!-- class="footer" -->
-</body>
-</html>
diff --git a/jpa/plugins/org.eclipse.jpt.doc.user/reference019.htm b/jpa/plugins/org.eclipse.jpt.doc.user/reference019.htm
deleted file mode 100644
index ae132d2cdd..0000000000
--- a/jpa/plugins/org.eclipse.jpt.doc.user/reference019.htm
+++ /dev/null
@@ -1,221 +0,0 @@
-<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN"
- "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
-<html xmlns="http://www.w3.org/1999/xhtml" xml:lang="en" lang="en">
-<head>
-<meta http-equiv="Content-Type" content="text/html; charset=us-ascii" />
-
-<meta http-equiv="Content-Style-Type" content="text/css" />
-<meta http-equiv="Content-Script-Type" content="text/javascript" />
-<title>Customization</title>
-<meta name="generator" content="Oracle DARB XHTML Converter (Mode = ohj/ohw) - Version 5.1.1 Build 004" />
-<meta name="date" content="2009-05-01T8:12:52Z" />
-<meta name="robots" content="noarchive" />
-<meta name="doctitle" content="Customization" />
-<meta name="relnum" content="Release 2.2" />
-<meta name="copyright" content="Copyright (c) 2000, 2008 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. Contributors: Oracle - initial API and implementation" />
-<link rel="copyright" href="dcommon/html/cpyr.htm" title="Copyright" type="text/html" />
-<link rel="stylesheet" href="dcommon/css/blafdoc.css" title="Oracle BLAFDoc" type="text/css" />
-<!-- contents -->
-</head>
-<body>
-<p><a id="CIAJAFEG" name="CIAJAFEG"></a></p>
-<div class="sect3"><!-- infolevel="all" infotype="General" -->
-<h1>Customization</h1>
-<p>The following table lists the properties available in the Customization page of the <a href="ref_persistence_xmll_editor.htm#CIACCHID">persistence.xml Editor</a>.</p>
-<div class="tblformal"><a id="sthref260" name="sthref260"></a><a id="sthref261" name="sthref261"></a>
-<p class="titleintable">Properties of the Customization Page</p>
-<table class="Formal" title="Properties of the Customization Page" summary="This table lists the properties of the persistence.xml Editor&rsquo;s Customization page." dir="ltr" border="1" width="100%" frame="hsides" rules="groups" cellpadding="3" cellspacing="0">
-<col width="24%" />
-<col width="*" />
-<col width="23%" />
-<thead>
-<tr align="left" valign="top">
-<th align="left" valign="bottom" id="r1c1-t26">Property</th>
-<th align="left" valign="bottom" id="r1c2-t26">Description</th>
-<th align="left" valign="bottom" id="r1c3-t26">Default</th>
-</tr>
-</thead>
-<tbody>
-<tr align="left" valign="top">
-<td align="left" id="r2c1-t26" headers="r1c1-t26">
-<p>Weaving</p>
-</td>
-<td align="left" headers="r2c1-t26 r1c2-t26">
-<p>Specifies if weaving of the entity classes is performed. The EclipseLink JPA persistence provider uses weaving to enhance JPA entities for such properties as lazy loading, change tracking, fetch groups, and internal optimizations. Select from the following options:</p>
-<ul>
-<li>
-<p><span class="bold">No Weaving</span></p>
-</li>
-<li>
-<p><span class="bold">Weave Dynamically</span></p>
-</li>
-<li>
-<p><span class="bold">Weave Statically</span> -- Use this option if you plan to execute your application outside of a Java EE 5 container in an environment that does not permit the use of <code>-javaagent:eclipselink.jar</code> on the JVM command line. This assumes that classes have already been statically woven. Run the static weaver on the classes before deploying them.</p>
-</li>
-</ul>
-</td>
-<td align="left" headers="r2c1-t26 r1c3-t26">
-<p>Weave Dynamically</p>
-</td>
-</tr>
-<tr align="left" valign="top">
-<td align="left" id="r3c1-t26" headers="r1c1-t26">
-<p>&nbsp;&nbsp;Weaving&nbsp;Lazy</p>
-</td>
-<td align="left" headers="r3c1-t26 r1c2-t26">
-<p>Select this option to enable lazy weaving.</p>
-</td>
-<td align="left" headers="r3c1-t26 r1c3-t26">
-<p>True</p>
-</td>
-</tr>
-<tr align="left" valign="top">
-<td align="left" id="r4c1-t26" headers="r1c1-t26">
-<p>&nbsp;&nbsp;Weaving&nbsp;Fetch&nbsp;Groups</p>
-</td>
-<td align="left" headers="r4c1-t26 r1c2-t26">
-<p>Select this option to enable fetch groups through weaving. Set this option to false if:</p>
-<ul>
-<li>
-<p>There is no weaving.</p>
-</li>
-<li>
-<p>Classes should not be changed during weaving (for example, when debugging).</p>
-</li>
-</ul>
-<p>Set this property to false for platforms where it is not supported.</p>
-</td>
-<td align="left" headers="r4c1-t26 r1c3-t26">
-<p>True</p>
-</td>
-</tr>
-<tr align="left" valign="top">
-<td align="left" id="r5c1-t26" headers="r1c1-t26">
-<p>Weaving&nbsp;internal</p>
-</td>
-<td align="left" headers="r5c1-t26 r1c2-t26"><br /></td>
-<td align="left" headers="r5c1-t26 r1c3-t26">
-<p>True</p>
-</td>
-</tr>
-<tr align="left" valign="top">
-<td align="left" id="r6c1-t26" headers="r1c1-t26">
-<p>Weaving&nbsp;eager</p>
-</td>
-<td align="left" headers="r6c1-t26 r1c2-t26"><br /></td>
-<td align="left" headers="r6c1-t26 r1c3-t26">
-<p>False</p>
-</td>
-</tr>
-<tr align="left" valign="top">
-<td align="left" id="r7c1-t26" headers="r1c1-t26">
-<p>&nbsp;&nbsp;Weaving&nbsp;Change&nbsp;Tracking</p>
-</td>
-<td align="left" headers="r7c1-t26 r1c2-t26">
-<p>Select this option to use weaving to detect which fields or properties of the object change.</p>
-</td>
-<td align="left" headers="r7c1-t26 r1c3-t26">
-<p>True</p>
-</td>
-</tr>
-<tr align="left" valign="top">
-<td align="left" id="r8c1-t26" headers="r1c1-t26">
-<p>&nbsp;&nbsp;Throw&nbsp;Exceptions</p>
-</td>
-<td align="left" headers="r8c1-t26 r1c2-t26">
-<p>Select this option to set EclipseLink to throw an exception or log a warning when it encounters a problem with any of the files listed in a <span class="bold">persistence.xml</span> file <code>&lt;mapping-file&gt;</code> element.</p>
-</td>
-<td align="left" headers="r8c1-t26 r1c3-t26">
-<p>True</p>
-</td>
-</tr>
-<tr align="left" valign="top">
-<td align="left" id="r9c1-t26" headers="r1c1-t26">
-<p>Exception handler</p>
-</td>
-<td align="left" headers="r9c1-t26 r1c2-t26">
-<p>Select (or create) a Java class to handle excpetions.</p>
-</td>
-<td align="left" headers="r9c1-t26 r1c3-t26"><br /></td>
-</tr>
-<tr align="left" valign="top">
-<td align="left" id="r10c1-t26" headers="r1c1-t26">
-<p>Session Customizer</p>
-</td>
-<td align="left" headers="r10c1-t26 r1c2-t26">
-<p>Select a session customizer class: a Java class that implements the <code>eclipselink.tools.sessionconfiguration.SessionCustomizer</code> interface and provides a default (zero-argument) constructor. Use this class' <code>customize</code> method, which takes an <code>eclipselink.sessions.Session</code>, to programmatically access advanced EclipseLink session API.</p>
-</td>
-<td align="left" headers="r10c1-t26 r1c3-t26"><br /></td>
-</tr>
-<tr align="left" valign="top">
-<td align="left" id="r11c1-t26" headers="r1c1-t26">
-<p>Descriptor Customizer</p>
-</td>
-<td align="left" headers="r11c1-t26 r1c2-t26">
-<p>Select an EclipseLink descriptor customizer class&ndash;a Java class that implements the <code>eclipselink.tools.sessionconfiguration.DescriptorCustomizer</code> interface and provides a default (zero-argument) constructor. Use this class's <code>customize</code> method, which takes an <code>eclipselink.descriptors.ClassDescriptor</code>, to programmatically access advanced EclipseLink descriptor and mapping API for the descriptor associated with the JPA entity named <code>&lt;ENTITY&gt;</code>.</p>
-</td>
-<td align="left" headers="r11c1-t26 r1c3-t26"><br /></td>
-</tr>
-<tr align="left" valign="top">
-<td align="left" id="r12c1-t26" headers="r1c1-t26">
-<p>Validation only</p>
-</td>
-<td align="left" headers="r12c1-t26 r1c2-t26"><br /></td>
-<td align="left" headers="r12c1-t26 r1c3-t26">
-<p>True</p>
-</td>
-</tr>
-<tr align="left" valign="top">
-<td align="left" id="r13c1-t26" headers="r1c1-t26">
-<p>Profiler</p>
-</td>
-<td align="left" headers="r13c1-t26 r1c2-t26">
-<ul>
-<li>
-<p>No Profiler</p>
-</li>
-<li>
-<p>Performance Profiler</p>
-</li>
-<li>
-<p>Query Monitor</p>
-</li>
-</ul>
-</td>
-<td align="left" headers="r13c1-t26 r1c3-t26">
-<p>NoProfiler</p>
-</td>
-</tr>
-</tbody>
-</table>
-<br /></div>
-<!-- class="tblformal" -->
-<div align="center">
-<div class="inftblnote"><br />
-<table class="Note oac_no_warn" summary="" cellpadding="3" cellspacing="0">
-<tbody>
-<tr>
-<td align="left">
-<p class="notep1">Note:</p>
-This page is not available for projects using the <span class="bold">Generic</span> platform.</td>
-</tr>
-</tbody>
-</table>
-<br /></div>
-<!-- class="inftblnote" --></div>
-</div>
-<!-- class="sect3" -->
-<!-- Start Footer -->
-<div class="footer">
-<table class="simple oac_no_warn" summary="" cellspacing="0" cellpadding="0" width="100%">
-<col width="86%" />
-<col width="*" />
-<tr>
-<td align="left"><span class="copyrightlogo">Copyright&nbsp;&copy;&nbsp;2006, 2009,&nbsp;Oracle&nbsp;and/or&nbsp;its&nbsp;affiliates.&nbsp;All&nbsp;rights&nbsp;reserved.</span><br />
-<a href="dcommon/html/cpyr.htm"><span class="copyrightlogo">Legal Notices</span></a></td>
-</tr>
-</table>
-</div>
-<!-- class="footer" -->
-</body>
-</html>
diff --git a/jpa/plugins/org.eclipse.jpt.doc.user/reference020.htm b/jpa/plugins/org.eclipse.jpt.doc.user/reference020.htm
deleted file mode 100644
index c26c971f5b..0000000000
--- a/jpa/plugins/org.eclipse.jpt.doc.user/reference020.htm
+++ /dev/null
@@ -1,185 +0,0 @@
-<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN"
- "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
-<html xmlns="http://www.w3.org/1999/xhtml" xml:lang="en" lang="en">
-<head>
-<meta http-equiv="Content-Type" content="text/html; charset=us-ascii" />
-
-<meta http-equiv="Content-Style-Type" content="text/css" />
-<meta http-equiv="Content-Script-Type" content="text/javascript" />
-<title>Caching</title>
-<meta name="generator" content="Oracle DARB XHTML Converter (Mode = ohj/ohw) - Version 5.1.1 Build 004" />
-<meta name="date" content="2009-05-01T8:12:52Z" />
-<meta name="robots" content="noarchive" />
-<meta name="doctitle" content="Caching" />
-<meta name="relnum" content="Release 2.2" />
-<meta name="copyright" content="Copyright (c) 2000, 2008 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. Contributors: Oracle - initial API and implementation" />
-<link rel="copyright" href="dcommon/html/cpyr.htm" title="Copyright" type="text/html" />
-<link rel="stylesheet" href="dcommon/css/blafdoc.css" title="Oracle BLAFDoc" type="text/css" />
-<!-- contents -->
-</head>
-<body>
-<p><a id="CIABEDCH" name="CIABEDCH"></a></p>
-<div class="sect3"><!-- infolevel="all" infotype="General" -->
-<h1><a id="sthref262" name="sthref262"></a>Caching</h1>
-<p>This table lists the properties of the Caching page of the <a href="ref_persistence_xmll_editor.htm#CIACCHID">persistence.xml Editor</a>.</p>
-<div class="tblformal"><a id="sthref263" name="sthref263"></a><a id="sthref264" name="sthref264"></a>
-<p class="titleintable">Properties of the Caching Page</p>
-<table class="Formal" title="Properties of the Caching Page" summary="This table lists the properties of the persistence.xml&rsquo;s Caching page." dir="ltr" border="1" width="100%" frame="hsides" rules="groups" cellpadding="3" cellspacing="0">
-<col width="24%" />
-<col width="*" />
-<col width="24%" />
-<thead>
-<tr align="left" valign="top">
-<th align="left" valign="bottom" id="r1c1-t28">Property</th>
-<th align="left" valign="bottom" id="r1c2-t28">Description</th>
-<th align="left" valign="bottom" id="r1c3-t28">Default</th>
-</tr>
-</thead>
-<tbody>
-<tr align="left" valign="top">
-<td align="left" id="r2c1-t28" headers="r1c1-t28">
-<p>Default Cache Type</p>
-</td>
-<td align="left" headers="r2c1-t28 r1c2-t28">
-<p>Select one of the following as the Default Cache Type:</p>
-<ul>
-<li>
-<p><span class="bold">Soft with Weak Subcache</span>&ndash;This option is similar to <span class="bold">Weak with Hard Subcache</span> except that it maintains a most frequently used subcache that uses soft references. The size of the subcache is proportional to the size of the identity map. The subcache uses soft references to ensure that these objects are garbage-collected only if the system is low on memory.</p>
-<p>Use this identity map in most circumstances as a means to control memory used by the cache.</p>
-</li>
-<li>
-<p><span class="bold">Week with Hard Subcache</span>&ndash;This option is similar to <span class="bold">Soft with Weak</span> subcache except that it maintains a most frequently used subcache that uses hard references. Use this identity map if soft references are not suitable for your platform.</p>
-</li>
-<li>
-<p><span class="bold">Weak</span>&ndash;This option is similar to <span class="bold">Full</span>, except that objects are referenced using weak references. This option uses less memory than <span class="bold">Full</span>, allows complete garbage collection and provides full caching and guaranteed identity.</p>
-<p>Use this identity map for transactions that, once started, stay on the server side.</p>
-</li>
-<li>
-<p><span class="bold">Soft</span>&ndash;This option is similar to <span class="bold">Weak</span> except that the map holds the objects using soft references. This identity map enables full garbage collection when memory is low. It provides full caching and guaranteed identity.</p>
-</li>
-<li>
-<p><span class="bold">Full</span>&ndash;This option provides full caching and guaranteed identity: all objects are cached and not removed.</p>
-<p>Note: This process may be memory-intensive when many objects are read.</p>
-</li>
-<li>
-<p><span class="bold">None</span>&ndash;This option does not preserve object identity and does not cache objects.This option is not recommended.</p>
-</li>
-</ul>
-</td>
-<td align="left" headers="r2c1-t28 r1c3-t28">
-<p>Weak with hard subcache</p>
-</td>
-</tr>
-<tr align="left" valign="top">
-<td align="left" id="r3c1-t28" headers="r1c1-t28">
-<p>Default Cache Size</p>
-</td>
-<td align="left" headers="r3c1-t28 r1c2-t28">
-<p>Set the size (maximum number of objects) of the cache.</p>
-</td>
-<td align="left" headers="r3c1-t28 r1c3-t28">
-<p>100</p>
-</td>
-</tr>
-<tr align="left" valign="top">
-<td align="left" id="r4c1-t28" headers="r1c1-t28">
-<p>Default Shared Cache</p>
-</td>
-<td align="left" headers="r4c1-t28 r1c2-t28">
-<p>Specifies if cached instances should be in the shared cache or in a client isolated cache.</p>
-</td>
-<td align="left" headers="r4c1-t28 r1c3-t28">
-<p>True</p>
-</td>
-</tr>
-<tr align="left" valign="top">
-<td align="left" id="r5c1-t28" headers="r1c1-t28">
-<p>Entity Caching</p>
-</td>
-<td align="left" headers="r5c1-t28 r1c2-t28">
-<p>Specify the entity-specific caching information.</p>
-</td>
-<td align="left" headers="r5c1-t28 r1c3-t28"><br /></td>
-</tr>
-<tr align="left" valign="top">
-<td align="left" id="r6c1-t28" headers="r1c1-t28">
-<p>&nbsp;&nbsp;Cache&nbsp;Type</p>
-</td>
-<td align="left" headers="r6c1-t28 r1c2-t28">
-<p>See <span class="italic">Default Cache Type.</span></p>
-</td>
-<td align="left" headers="r6c1-t28 r1c3-t28"><br /></td>
-</tr>
-<tr align="left" valign="top">
-<td align="left" id="r7c1-t28" headers="r1c1-t28">
-<p>&nbsp;&nbsp;Cache&nbsp;Size</p>
-</td>
-<td align="left" headers="r7c1-t28 r1c2-t28">
-<p>See <span class="italic">Default Cache Size.</span></p>
-</td>
-<td align="left" headers="r7c1-t28 r1c3-t28"><br /></td>
-</tr>
-<tr align="left" valign="top">
-<td align="left" id="r8c1-t28" headers="r1c1-t28">
-<p>&nbsp;&nbsp;Shared&nbsp;Cache</p>
-</td>
-<td align="left" headers="r8c1-t28 r1c2-t28">
-<p>See <span class="italic">Default Shared Cache</span>.</p>
-</td>
-<td align="left" headers="r8c1-t28 r1c3-t28"><br /></td>
-</tr>
-<tr align="left" valign="top">
-<td align="left" id="r9c1-t28" headers="r1c1-t28">
-<p>Flush clear cache</p>
-</td>
-<td align="left" headers="r9c1-t28 r1c2-t28">
-<p>Select one of the following as the Default Cache Type:</p>
-<ul>
-<li>
-<p><span class="bold">Drop</span> &ndash; This mode is the fastest and uses the least memory. However, after commit the shared cache might potentially contain stale data.</p>
-</li>
-<li>
-<p><span class="bold">Drop Invalidate</span> &ndash; Classes that have at least one object updated or deleted are invalidated in the shared cache at commit time. This mode is slower than <span class="bold">Drop</span>, but as efficient memory usage-wise, and prevents stale data.</p>
-</li>
-<li>
-<p><span class="bold">Merge</span> &ndash; Drop classes from the EntityManager's cache of objects that have not been flushed. This mode leaves the shared cache in a perfect state after commit. However, it is the least memory-efficient mode; the memory might even run out in a very large transaction.</p>
-</li>
-</ul>
-</td>
-<td align="left" headers="r9c1-t28 r1c3-t28">
-<p>Drop Invalidate</p>
-</td>
-</tr>
-</tbody>
-</table>
-<br /></div>
-<!-- class="tblformal" -->
-<div align="center">
-<div class="inftblnote"><br />
-<table class="Note oac_no_warn" summary="" cellpadding="3" cellspacing="0">
-<tbody>
-<tr>
-<td align="left">
-<p class="notep1">Note:</p>
-This page is not available for projects using the <span class="bold">Generic</span> platform.</td>
-</tr>
-</tbody>
-</table>
-<br /></div>
-<!-- class="inftblnote" --></div>
-</div>
-<!-- class="sect3" -->
-<!-- Start Footer -->
-<div class="footer">
-<table class="simple oac_no_warn" summary="" cellspacing="0" cellpadding="0" width="100%">
-<col width="86%" />
-<col width="*" />
-<tr>
-<td align="left"><span class="copyrightlogo">Copyright&nbsp;&copy;&nbsp;2006, 2009,&nbsp;Oracle&nbsp;and/or&nbsp;its&nbsp;affiliates.&nbsp;All&nbsp;rights&nbsp;reserved.</span><br />
-<a href="dcommon/html/cpyr.htm"><span class="copyrightlogo">Legal Notices</span></a></td>
-</tr>
-</table>
-</div>
-<!-- class="footer" -->
-</body>
-</html>
diff --git a/jpa/plugins/org.eclipse.jpt.doc.user/reference021.htm b/jpa/plugins/org.eclipse.jpt.doc.user/reference021.htm
deleted file mode 100644
index ccfeeded9b..0000000000
--- a/jpa/plugins/org.eclipse.jpt.doc.user/reference021.htm
+++ /dev/null
@@ -1,241 +0,0 @@
-<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN"
- "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
-<html xmlns="http://www.w3.org/1999/xhtml" xml:lang="en" lang="en">
-<head>
-<meta http-equiv="Content-Type" content="text/html; charset=us-ascii" />
-
-<meta http-equiv="Content-Style-Type" content="text/css" />
-<meta http-equiv="Content-Script-Type" content="text/javascript" />
-<title>Logging</title>
-<meta name="generator" content="Oracle DARB XHTML Converter (Mode = ohj/ohw) - Version 5.1.1 Build 004" />
-<meta name="date" content="2009-05-01T8:12:52Z" />
-<meta name="robots" content="noarchive" />
-<meta name="doctitle" content="Logging" />
-<meta name="relnum" content="Release 2.2" />
-<meta name="copyright" content="Copyright (c) 2000, 2008 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. Contributors: Oracle - initial API and implementation" />
-<link rel="copyright" href="dcommon/html/cpyr.htm" title="Copyright" type="text/html" />
-<link rel="stylesheet" href="dcommon/css/blafdoc.css" title="Oracle BLAFDoc" type="text/css" />
-<!-- contents -->
-</head>
-<body>
-<p><a id="CIABGHHI" name="CIABGHHI"></a></p>
-<div class="sect3"><!-- infolevel="all" infotype="General" -->
-<h1>Logging</h1>
-<p>This table lists the properties of the Logging page of the <a href="ref_persistence_xmll_editor.htm#CIACCHID">persistence.xml Editor</a>.</p>
-<div align="center">
-<div class="inftblnote"><br />
-<table class="Note oac_no_warn" summary="" cellpadding="3" cellspacing="0">
-<tbody>
-<tr>
-<td align="left">
-<p class="notep1">Note:</p>
-This page is not available for projects using the <span class="bold">Generic</span> platform.</td>
-</tr>
-</tbody>
-</table>
-<br /></div>
-<!-- class="inftblnote" --></div>
-<div class="tblformal"><a id="sthref265" name="sthref265"></a><a id="sthref266" name="sthref266"></a>
-<p class="titleintable">Properties of the Logging Page</p>
-<table class="Formal" title="Properties of the Logging Page" summary="This table lists the properties of the Logging page of the persistence.xml Editor." dir="ltr" border="1" width="100%" frame="hsides" rules="groups" cellpadding="3" cellspacing="0">
-<col width="24%" />
-<col width="*" />
-<col width="24%" />
-<thead>
-<tr align="left" valign="top">
-<th align="left" valign="bottom" id="r1c1-t31">Property</th>
-<th align="left" valign="bottom" id="r1c2-t31">Description</th>
-<th align="left" valign="bottom" id="r1c3-t31">Default</th>
-</tr>
-</thead>
-<tbody>
-<tr align="left" valign="top">
-<td align="left" id="r2c1-t31" headers="r1c1-t31">
-<p>Logging Level</p>
-</td>
-<td align="left" headers="r2c1-t31 r1c2-t31">
-<p>Specifies the amount and detail of log output by selecting the log level (in ascending order of information):</p>
-<p>The following are the valid values for the <code>java.util.logging.Level</code>:</p>
-<ul>
-<li>
-<p><span class="bold">OFF</span>&ndash;disables logging</p>
-</li>
-<li>
-<p><span class="bold">SEVERE</span>&ndash;logs exceptions indicating TopLink cannot continue, as well as any exceptions generated during login. This includes a stack trace.</p>
-</li>
-<li>
-<p><span class="bold">WARNING</span>&ndash;logs exceptions that do not force TopLink to stop, including all exceptions not logged with severe level. This does not include a stack trace.</p>
-</li>
-<li>
-<p><span class="bold">INFO</span>&ndash;logs the login/logout per sever session, including the user name. After acquiring the session, detailed information is logged.</p>
-</li>
-<li>
-<p><span class="bold">CONFIG</span>&ndash;logs only login, JDBC connection, and database information.</p>
-</li>
-<li>
-<p><span class="bold">FINE</span>&ndash;logs SQL.</p>
-</li>
-<li>
-<p><span class="bold">FINER</span>&ndash;similar to warning. Includes stack trace.</p>
-</li>
-<li>
-<p><span class="bold">FINEST</span>&ndash;includes additional low level information.</p>
-</li>
-</ul>
-<p><span class="bold">Example</span>: <code>persistence.xml</code> file</p>
-<pre xml:space="preserve" class="oac_no_warn">
-&lt;property name="eclipselink.logging.level" value="INFO"/&gt;
-</pre></td>
-<td align="left" headers="r2c1-t31 r1c3-t31">
-<p>Info</p>
-</td>
-</tr>
-<tr align="left" valign="top">
-<td align="left" id="r3c1-t31" headers="r1c1-t31">
-<p>&nbsp;&nbsp;Timestamp</p>
-</td>
-<td align="left" headers="r3c1-t31 r1c2-t31">
-<p>Control whether the timestamp is logged in each log entry.</p>
-<p>The following are the valid values:</p>
-<ul>
-<li>
-<p><span class="bold">true</span>&ndash;log a timestamp.</p>
-</li>
-<li>
-<p><span class="bold">false</span>&ndash;do not log a timestamp.</p>
-</li>
-</ul>
-<p><span class="bold">Example</span>: <code>persistence.xml</code> file</p>
-<pre xml:space="preserve" class="oac_no_warn">
-&lt;property name="eclipselink.logging.timestamp" value="false"/&gt;
-</pre></td>
-<td align="left" headers="r3c1-t31 r1c3-t31">
-<p>true</p>
-</td>
-</tr>
-<tr align="left" valign="top">
-<td align="left" id="r4c1-t31" headers="r1c1-t31">
-<p>&nbsp;&nbsp;Thread</p>
-</td>
-<td align="left" headers="r4c1-t31 r1c2-t31">
-<p>Control whether a thread identifier is logged in each log entry.</p>
-<p>The following are the valid values:</p>
-<ul>
-<li>
-<p><span class="bold">true</span>&ndash;log a thread identifier.</p>
-</li>
-<li>
-<p><span class="bold">false</span>&ndash;do not log a thread identifier.</p>
-</li>
-</ul>
-</td>
-<td align="left" headers="r4c1-t31 r1c3-t31">
-<p>true</p>
-</td>
-</tr>
-<tr align="left" valign="top">
-<td align="left" id="r5c1-t31" headers="r1c1-t31">
-<p>&nbsp;&nbsp;Session</p>
-</td>
-<td align="left" headers="r5c1-t31 r1c2-t31">
-<p>Control whether an EclipseLink session identifier is logged in each log entry.</p>
-<p>The following are the valid values:</p>
-<ul>
-<li>
-<p><span class="bold">true</span>&ndash;log a EclipseLink session identifier.</p>
-</li>
-<li>
-<p><span class="bold">false</span>&ndash;do not log a EclipseLink session identifier.</p>
-</li>
-</ul>
-<p><span class="bold">Example</span>: <code>persistence.xml</code> file</p>
-<pre xml:space="preserve" class="oac_no_warn">
-&lt;property name="eclipselink.logging.session" value="false"/&gt;
-</pre></td>
-<td align="left" headers="r5c1-t31 r1c3-t31">
-<p>true</p>
-</td>
-</tr>
-<tr align="left" valign="top">
-<td align="left" id="r6c1-t31" headers="r1c1-t31">
-<p>&nbsp;&nbsp;Exceptions</p>
-</td>
-<td align="left" headers="r6c1-t31 r1c2-t31">
-<p>Control whether the exceptions thrown from within the EclipseLink code are logged prior to returning the exception to the calling application. Ensures that all exceptions are logged and not masked by the application code.</p>
-<p>The following are the valid values:</p>
-<ul>
-<li>
-<p><span class="bold">true</span>&ndash;log all exceptions.</p>
-</li>
-<li>
-<p><span class="bold">false</span>&ndash;do not log exceptions.</p>
-</li>
-</ul>
-<p><span class="bold">Example</span>: <code>persistence.xml</code> file</p>
-<pre xml:space="preserve" class="oac_no_warn">
-&lt;property name="eclipselink.logging.exceptions" value="true"/&gt;
-</pre></td>
-<td align="left" headers="r6c1-t31 r1c3-t31">
-<p>false</p>
-</td>
-</tr>
-<tr align="left" valign="top">
-<td align="left" id="r7c1-t31" headers="r1c1-t31">
-<p>Log file</p>
-</td>
-<td align="left" headers="r7c1-t31 r1c2-t31">
-<p>Specify a file location for the log output (instead of the standard out).</p>
-<p><span class="bold">Example</span>: <code>persistence.xml</code> file</p>
-<pre xml:space="preserve" class="oac_no_warn">
-&lt;property name="eclipselink.logging.file" value="C:\myout\" /&gt;
-</pre></td>
-<td align="left" headers="r7c1-t31 r1c3-t31"><br /></td>
-</tr>
-<tr align="left" valign="top">
-<td align="left" id="r8c1-t31" headers="r1c1-t31">
-<p>Logger</p>
-</td>
-<td align="left" headers="r8c1-t31 r1c2-t31">
-<p>Select the type of logger to use:</p>
-<p>The following are the valid values:</p>
-<ul>
-<li>
-<p><span class="bold">DefaultLogger</span>&ndash;the EclipseLink native logger <code>eclipselink.logging.DefaultSessionLog</code>.</p>
-</li>
-<li>
-<p><span class="bold">JavaLogger</span>&ndash;the <code>java.util.logging</code> logger <code>eclipselink.logging.JavaLog</code>.</p>
-</li>
-<li>
-<p><span class="bold">ServerLogger</span>&ndash;the <code>java.util.logging</code> logger <code>eclipselink.platform.server.ServerLog</code>. Integrates with the application server's logging as define in the <code>eclipselink.platform.server.ServerPlatform.</code></p>
-</li>
-<li>
-<p>Fully qualified class name of a custom logger. The custom logger must implement the <code>eclipselink.logging.SessionLog</code> interface.</p>
-</li>
-</ul>
-<p><span class="bold">Example</span>: <code>persistence.xml</code> file</p>
-<pre xml:space="preserve" class="oac_no_warn">
-&lt;property name="eclipselink.logging.logger" value="acme.loggers.MyCustomLogger" /&gt;
-</pre></td>
-<td align="left" headers="r8c1-t31 r1c3-t31">
-<p>DefaultLogger</p>
-</td>
-</tr>
-</tbody>
-</table>
-<br /></div>
-<!-- class="tblformal" --></div>
-<!-- class="sect3" -->
-<!-- Start Footer -->
-<div class="footer">
-<table class="simple oac_no_warn" summary="" cellspacing="0" cellpadding="0" width="100%">
-<col width="86%" />
-<col width="*" />
-<tr>
-<td align="left"><span class="copyrightlogo">Copyright&nbsp;&copy;&nbsp;2006, 2009,&nbsp;Oracle&nbsp;and/or&nbsp;its&nbsp;affiliates.&nbsp;All&nbsp;rights&nbsp;reserved.</span><br />
-<a href="dcommon/html/cpyr.htm"><span class="copyrightlogo">Legal Notices</span></a></td>
-</tr>
-</table>
-</div>
-<!-- class="footer" -->
-</body>
-</html>
diff --git a/jpa/plugins/org.eclipse.jpt.doc.user/reference022.htm b/jpa/plugins/org.eclipse.jpt.doc.user/reference022.htm
deleted file mode 100644
index 47f4da1019..0000000000
--- a/jpa/plugins/org.eclipse.jpt.doc.user/reference022.htm
+++ /dev/null
@@ -1,170 +0,0 @@
-<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN"
- "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
-<html xmlns="http://www.w3.org/1999/xhtml" xml:lang="en" lang="en">
-<head>
-<meta http-equiv="Content-Type" content="text/html; charset=us-ascii" />
-
-<meta http-equiv="Content-Style-Type" content="text/css" />
-<meta http-equiv="Content-Script-Type" content="text/javascript" />
-<title>Options</title>
-<meta name="generator" content="Oracle DARB XHTML Converter (Mode = ohj/ohw) - Version 5.1.1 Build 004" />
-<meta name="date" content="2009-05-01T8:12:52Z" />
-<meta name="robots" content="noarchive" />
-<meta name="doctitle" content="Options" />
-<meta name="relnum" content="Release 2.2" />
-<meta name="copyright" content="Copyright (c) 2000, 2008 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. Contributors: Oracle - initial API and implementation" />
-<link rel="copyright" href="dcommon/html/cpyr.htm" title="Copyright" type="text/html" />
-<link rel="stylesheet" href="dcommon/css/blafdoc.css" title="Oracle BLAFDoc" type="text/css" />
-<!-- contents -->
-</head>
-<body>
-<p><a id="CIAFJCHE" name="CIAFJCHE"></a></p>
-<div class="sect3"><!-- infolevel="all" infotype="General" -->
-<h1>Options</h1>
-<p>This table lists the properties of the Options page of the <a href="ref_persistence_xmll_editor.htm#CIACCHID">persistence.xml Editor</a>.</p>
-<div align="center">
-<div class="inftblnote"><br />
-<table class="Note oac_no_warn" summary="" cellpadding="3" cellspacing="0">
-<tbody>
-<tr>
-<td align="left">
-<p class="notep1">Note:</p>
-This page is not available for projects using the <span class="bold">Generic</span> platform.</td>
-</tr>
-</tbody>
-</table>
-<br /></div>
-<!-- class="inftblnote" --></div>
-<div class="tblformal"><a id="sthref267" name="sthref267"></a><a id="sthref268" name="sthref268"></a>
-<p class="titleintable">Properties of the Options Page</p>
-<table class="Formal" title="Properties of the Options Page" summary="Properties of the Options Page" dir="ltr" border="1" width="100%" frame="hsides" rules="groups" cellpadding="3" cellspacing="0">
-<col width="24%" />
-<col width="*" />
-<col width="24%" />
-<thead>
-<tr align="left" valign="top">
-<th align="left" valign="bottom" id="r1c1-t33">Property</th>
-<th align="left" valign="bottom" id="r1c2-t33">Description</th>
-<th align="left" valign="bottom" id="r1c3-t33">Default</th>
-</tr>
-</thead>
-<tbody>
-<tr align="left" valign="top">
-<td align="left" id="r2c1-t33" headers="r1c1-t33">
-<p>Session Name</p>
-</td>
-<td align="left" headers="r2c1-t33 r1c2-t33">
-<p>Specify the name by which the EclipseLink session is stored in the static session manager. Use this option if you need to access the EclipseLink shared session outside of the context of the JPA or to use a pre-existing EclipseLink session configured through a EclipseLink <code>sessions.xml</code> file</p>
-<p>Valid values: a valid EclipseLink session name that is unique in a server deployment.</p>
-<p><span class="bold">Example</span>: <code>persistence.xml</code> file</p>
-<pre xml:space="preserve" class="oac_no_warn">
-&lt;property name="eclipselink.session-name" value="MySession"/&gt;
-</pre></td>
-<td align="left" headers="r2c1-t33 r1c3-t33"><br /></td>
-</tr>
-<tr align="left" valign="top">
-<td align="left" id="r3c1-t33" headers="r1c1-t33">
-<p>Sessions XML</p>
-</td>
-<td align="left" headers="r3c1-t33 r1c2-t33">
-<p>Specify persistence information loaded from the EclipseLink session configuration file (<code>sessions.xml</code>).</p>
-<p>You can use this option as an alternative to annotations and deployment XML. If you specify this property, EclipseLink will override all class annotation and the object relational mapping from the <code>persistence.xml</code>, as well as <code>ORM.xml</code> and other mapping files, if present.</p>
-<p>Indicate the session by setting the <code>eclipselink.session-name</code> property.</p>
-<p>Note: If you do not specify the value for this property, <code>sessions.xml</code> file will not be used.</p>
-<p>Valid values: the resource name of the sessions XML file.</p>
-<p><span class="bold">Example</span>: <code>persistence.xml</code> file</p>
-<pre xml:space="preserve" class="oac_no_warn">
-&lt;property name="toplink.session-xml" value="mysession.xml"/&gt;
-</pre></td>
-<td align="left" headers="r3c1-t33 r1c3-t33"><br /></td>
-</tr>
-<tr align="left" valign="top">
-<td align="left" id="r4c1-t33" headers="r1c1-t33">
-<p>Target Database</p>
-</td>
-<td align="left" headers="r4c1-t33 r1c2-t33">
-<p>Select the target database. You can also set the value to the fully qualified classname of a subclass of the <code>org.eclipse.persistence.platform.DatabasePlatform class</code>.</p>
-<p><span class="bold">Example</span>: <code>persistence.xml</code> file</p>
-<pre xml:space="preserve" class="oac_no_warn">
-&lt;property name="eclipselink.target-database" value="Oracle"/&gt;
-</pre></td>
-<td align="left" headers="r4c1-t33 r1c3-t33">
-<p>Auto</p>
-</td>
-</tr>
-<tr align="left" valign="top">
-<td align="left" id="r5c1-t33" headers="r1c1-t33">
-<p>Target Server</p>
-</td>
-<td align="left" headers="r5c1-t33 r1c2-t33">
-<p>Select the target server for your JPA application.</p>
-<p><span class="bold">Example</span>: <code>persistence.xml</code> file</p>
-<pre xml:space="preserve" class="oac_no_warn">
-&lt;property name="eclipselink.target-server" value="OC4J_10_1_3"/&gt;
-</pre></td>
-<td align="left" headers="r5c1-t33 r1c3-t33">
-<p>None</p>
-</td>
-</tr>
-<tr align="left" valign="top">
-<td align="left" id="r6c1-t33" headers="r1c1-t33">
-<p>Event Listener</p>
-</td>
-<td align="left" headers="r6c1-t33 r1c2-t33">
-<p>Specify a descriptor event listener to be added during bootstrapping.</p>
-<p>Valid values: qualified class name for a class that implements the <code>eclipselink.sessions.SessionEventListener</code> interface.</p>
-<p><span class="bold">Example</span>: <code>persistence.xml</code> file</p>
-<pre xml:space="preserve" class="oac_no_warn">
-&lt;property name="eclipselink.session-event-listener" value="mypackage.MyClass.class"/&gt;
-</pre></td>
-<td align="left" headers="r6c1-t33 r1c3-t33"><br /></td>
-</tr>
-<tr align="left" valign="top">
-<td align="left" id="r7c1-t33" headers="r1c1-t33">
-<p>Include Descriptor Queries</p>
-</td>
-<td align="left" headers="r7c1-t33 r1c2-t33">
-<p>Enable or disable the default copying of all named queries from the descriptors to the session. These queries include the ones defined using EclipseLink API, descriptor amendment methods, and so on.</p>
-</td>
-<td align="left" headers="r7c1-t33 r1c3-t33"><br /></td>
-</tr>
-<tr align="left" valign="top">
-<td align="left" id="r8c1-t33" headers="r1c1-t33">
-<p>Miscellaneous Options</p>
-</td>
-<td align="left" headers="r8c1-t33 r1c2-t33"><br /></td>
-<td align="left" headers="r8c1-t33 r1c3-t33"><br /></td>
-</tr>
-<tr align="left" valign="top">
-<td align="left" id="r9c1-t33" headers="r1c1-t33">
-<p>&nbsp;&nbsp;Temporal mutable</p>
-</td>
-<td align="left" headers="r9c1-t33 r1c2-t33">
-<p>Specify if all <code>Date</code> and <code>Calendar</code> persistent fields should be handled as mutable objects.</p>
-<p><span class="bold">Example</span>: <code>persistence.xml</code> file</p>
-<pre xml:space="preserve" class="oac_no_warn">
-&lt;property name="eclipselink.temporal.mutable" value="true"/&gt;
-</pre></td>
-<td align="left" headers="r9c1-t33 r1c3-t33">
-<p>False</p>
-</td>
-</tr>
-</tbody>
-</table>
-<br /></div>
-<!-- class="tblformal" --></div>
-<!-- class="sect3" -->
-<!-- Start Footer -->
-<div class="footer">
-<table class="simple oac_no_warn" summary="" cellspacing="0" cellpadding="0" width="100%">
-<col width="86%" />
-<col width="*" />
-<tr>
-<td align="left"><span class="copyrightlogo">Copyright&nbsp;&copy;&nbsp;2006, 2009,&nbsp;Oracle&nbsp;and/or&nbsp;its&nbsp;affiliates.&nbsp;All&nbsp;rights&nbsp;reserved.</span><br />
-<a href="dcommon/html/cpyr.htm"><span class="copyrightlogo">Legal Notices</span></a></td>
-</tr>
-</table>
-</div>
-<!-- class="footer" -->
-</body>
-</html>
diff --git a/jpa/plugins/org.eclipse.jpt.doc.user/reference023.htm b/jpa/plugins/org.eclipse.jpt.doc.user/reference023.htm
deleted file mode 100644
index 18577b4690..0000000000
--- a/jpa/plugins/org.eclipse.jpt.doc.user/reference023.htm
+++ /dev/null
@@ -1,143 +0,0 @@
-<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN"
- "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
-<html xmlns="http://www.w3.org/1999/xhtml" xml:lang="en" lang="en">
-<head>
-<meta http-equiv="Content-Type" content="text/html; charset=us-ascii" />
-
-<meta http-equiv="Content-Style-Type" content="text/css" />
-<meta http-equiv="Content-Script-Type" content="text/javascript" />
-<title>Schema Generation</title>
-<meta name="generator" content="Oracle DARB XHTML Converter (Mode = ohj/ohw) - Version 5.1.1 Build 004" />
-<meta name="date" content="2009-05-01T8:12:52Z" />
-<meta name="robots" content="noarchive" />
-<meta name="doctitle" content="Schema Generation" />
-<meta name="relnum" content="Release 2.2" />
-<meta name="copyright" content="Copyright (c) 2000, 2008 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. Contributors: Oracle - initial API and implementation" />
-<link rel="copyright" href="dcommon/html/cpyr.htm" title="Copyright" type="text/html" />
-<link rel="stylesheet" href="dcommon/css/blafdoc.css" title="Oracle BLAFDoc" type="text/css" />
-<!-- contents -->
-</head>
-<body>
-<p><a id="CIACCFCB" name="CIACCFCB"></a></p>
-<div class="sect3"><!-- infolevel="all" infotype="General" -->
-<h1>Schema Generation</h1>
-<p>This table lists the properties of the Schema Generation page of the <a href="ref_persistence_xmll_editor.htm#CIACCHID">persistence.xml Editor</a>.</p>
-<div align="center">
-<div class="inftblnote"><br />
-<table class="Note oac_no_warn" summary="" cellpadding="3" cellspacing="0">
-<tbody>
-<tr>
-<td align="left">
-<p class="notep1">Note:</p>
-This page is not available for projects using the <span class="bold">Generic</span> platform.</td>
-</tr>
-</tbody>
-</table>
-<br /></div>
-<!-- class="inftblnote" --></div>
-<div class="tblformal"><a id="sthref269" name="sthref269"></a><a id="sthref270" name="sthref270"></a>
-<p class="titleintable">&nbsp;</p>
-<table class="Formal" title="" summary="This table lists the properties of the persistence.xml Editor&rsquo;s Schema Generation page." dir="ltr" border="1" width="100%" frame="hsides" rules="groups" cellpadding="3" cellspacing="0">
-<col width="24%" />
-<col width="*" />
-<col width="24%" />
-<thead>
-<tr align="left" valign="top">
-<th align="left" valign="bottom" id="r1c1-t35">Property</th>
-<th align="left" valign="bottom" id="r1c2-t35">Description</th>
-<th align="left" valign="bottom" id="r1c3-t35">Default</th>
-</tr>
-</thead>
-<tbody>
-<tr align="left" valign="top">
-<td align="left" id="r2c1-t35" headers="r1c1-t35">
-<p>DDL Generation Type</p>
-</td>
-<td align="left" headers="r2c1-t35 r1c2-t35">
-<p>Select the type of DDL generation:</p>
-<ul>
-<li>
-<p><span class="bold">None</span> -- Do not generate DDL; no schema is generated.</p>
-</li>
-<li>
-<p><span class="bold">Create Tables</span> -- Create DDL for non-existent tables; leave existing tables unchanged.</p>
-</li>
-<li>
-<p><span class="bold">Drop and Create Tables</span> -- Create DDL for all tables; drop all existing tables.</p>
-</li>
-</ul>
-</td>
-<td align="left" headers="r2c1-t35 r1c3-t35">
-<p>None</p>
-</td>
-</tr>
-<tr align="left" valign="top">
-<td align="left" id="r3c1-t35" headers="r1c1-t35">
-<p>Output Mode</p>
-</td>
-<td align="left" headers="r3c1-t35 r1c2-t35">
-<p>Select the DDL generation target:</p>
-<ul>
-<li>
-<p><span class="bold">Both</span> -- Generate SQL files and execute them on the database.</p>
-</li>
-<li>
-<p><span class="bold">Database</span> -- Execute SQL on the database only (do not generate SQL files).</p>
-</li>
-<li>
-<p><span class="bold">SQL Script</span> -- Generate SQL files only (do not execute them on the database).</p>
-</li>
-</ul>
-</td>
-<td align="left" headers="r3c1-t35 r1c3-t35"><br /></td>
-</tr>
-<tr align="left" valign="top">
-<td align="left" id="r4c1-t35" headers="r1c1-t35">
-<p>DDL Generation Location</p>
-</td>
-<td align="left" headers="r4c1-t35 r1c2-t35">
-<p>Specify where EclipseLink writes DDL output. Specify a file specification to a directory in which you have write access. The file specification may be relative to your current working directory or absolute. If it does not end in a file separator, then EclipseLink appends one that is valid for your operating system.</p>
-</td>
-<td align="left" headers="r4c1-t35 r1c3-t35"><br /></td>
-</tr>
-<tr align="left" valign="top">
-<td align="left" id="r5c1-t35" headers="r1c1-t35">
-<p>Create DDL File Name</p>
-</td>
-<td align="left" headers="r5c1-t35 r1c2-t35">
-<p>Specify the file name of the DDL file that EclipseLink generates that contains SQL statements for creating tables for JPA entities. Specify a file name valid for your operating system.</p>
-</td>
-<td align="left" headers="r5c1-t35 r1c3-t35">
-<p>createDDL.jdbc</p>
-</td>
-</tr>
-<tr align="left" valign="top">
-<td align="left" id="r6c1-t35" headers="r1c1-t35">
-<p>Drop DDL File Name</p>
-</td>
-<td align="left" headers="r6c1-t35 r1c2-t35">
-<p>Specify the file name of the DDL file that EclipseLink generates that contains SQL statements for dropping tables for JPA entities.</p>
-</td>
-<td align="left" headers="r6c1-t35 r1c3-t35">
-<p>dropDDL.jdbc</p>
-</td>
-</tr>
-</tbody>
-</table>
-<br /></div>
-<!-- class="tblformal" --></div>
-<!-- class="sect3" -->
-<!-- Start Footer -->
-<div class="footer">
-<table class="simple oac_no_warn" summary="" cellspacing="0" cellpadding="0" width="100%">
-<col width="86%" />
-<col width="*" />
-<tr>
-<td align="left"><span class="copyrightlogo">Copyright&nbsp;&copy;&nbsp;2006, 2009,&nbsp;Oracle&nbsp;and/or&nbsp;its&nbsp;affiliates.&nbsp;All&nbsp;rights&nbsp;reserved.</span><br />
-<a href="dcommon/html/cpyr.htm"><span class="copyrightlogo">Legal Notices</span></a></td>
-</tr>
-</table>
-</div>
-<!-- class="footer" -->
-</body>
-</html>
diff --git a/jpa/plugins/org.eclipse.jpt.doc.user/reference024.htm b/jpa/plugins/org.eclipse.jpt.doc.user/reference024.htm
deleted file mode 100644
index b0b5ffa8b0..0000000000
--- a/jpa/plugins/org.eclipse.jpt.doc.user/reference024.htm
+++ /dev/null
@@ -1,41 +0,0 @@
-<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN"
- "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
-<html xmlns="http://www.w3.org/1999/xhtml" xml:lang="en" lang="en">
-<head>
-<meta http-equiv="Content-Type" content="text/html; charset=us-ascii" />
-
-<meta http-equiv="Content-Style-Type" content="text/css" />
-<meta http-equiv="Content-Script-Type" content="text/javascript" />
-<title>Properties</title>
-<meta name="generator" content="Oracle DARB XHTML Converter (Mode = ohj/ohw) - Version 5.1.1 Build 004" />
-<meta name="date" content="2009-05-01T8:12:52Z" />
-<meta name="robots" content="noarchive" />
-<meta name="doctitle" content="Properties" />
-<meta name="relnum" content="Release 2.2" />
-<meta name="copyright" content="Copyright (c) 2000, 2008 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. Contributors: Oracle - initial API and implementation" />
-<link rel="copyright" href="dcommon/html/cpyr.htm" title="Copyright" type="text/html" />
-<link rel="stylesheet" href="dcommon/css/blafdoc.css" title="Oracle BLAFDoc" type="text/css" />
-<!-- contents -->
-</head>
-<body>
-<p><a id="CIAHJDFF" name="CIAHJDFF"></a></p>
-<div class="sect3"><!-- infolevel="all" infotype="General" -->
-<h1>Properties</h1>
-<p>This page enables you to add or remove the vendor-specific <code>&lt;properties&gt;</code> elements of <code>persistence.xml</code>.</p>
-<p>To add a property, click <span class="bold">Add</span> then enter the property <span class="bold">Name</span> and <span class="bold">Value</span>.</p>
-</div>
-<!-- class="sect3" -->
-<!-- Start Footer -->
-<div class="footer">
-<table class="simple oac_no_warn" summary="" cellspacing="0" cellpadding="0" width="100%">
-<col width="86%" />
-<col width="*" />
-<tr>
-<td align="left"><span class="copyrightlogo">Copyright&nbsp;&copy;&nbsp;2006, 2009,&nbsp;Oracle&nbsp;and/or&nbsp;its&nbsp;affiliates.&nbsp;All&nbsp;rights&nbsp;reserved.</span><br />
-<a href="dcommon/html/cpyr.htm"><span class="copyrightlogo">Legal Notices</span></a></td>
-</tr>
-</table>
-</div>
-<!-- class="footer" -->
-</body>
-</html>
diff --git a/jpa/plugins/org.eclipse.jpt.doc.user/reference025.htm b/jpa/plugins/org.eclipse.jpt.doc.user/reference025.htm
deleted file mode 100644
index 2af38698b4..0000000000
--- a/jpa/plugins/org.eclipse.jpt.doc.user/reference025.htm
+++ /dev/null
@@ -1,46 +0,0 @@
-<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN"
- "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
-<html xmlns="http://www.w3.org/1999/xhtml" xml:lang="en" lang="en">
-<head>
-<meta http-equiv="Content-Type" content="text/html; charset=us-ascii" />
-
-<meta http-equiv="Content-Style-Type" content="text/css" />
-<meta http-equiv="Content-Script-Type" content="text/javascript" />
-<title>Source</title>
-<meta name="generator" content="Oracle DARB XHTML Converter (Mode = ohj/ohw) - Version 5.1.1 Build 004" />
-<meta name="date" content="2009-05-01T8:12:52Z" />
-<meta name="robots" content="noarchive" />
-<meta name="doctitle" content="Source" />
-<meta name="relnum" content="Release 2.2" />
-<meta name="copyright" content="Copyright (c) 2000, 2008 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. Contributors: Oracle - initial API and implementation" />
-<link rel="copyright" href="dcommon/html/cpyr.htm" title="Copyright" type="text/html" />
-<link rel="stylesheet" href="dcommon/css/blafdoc.css" title="Oracle BLAFDoc" type="text/css" />
-<!-- contents -->
-</head>
-<body>
-<p><a id="CIAHCJAH" name="CIAHCJAH"></a></p>
-<div class="sect3"><!-- infolevel="all" infotype="General" -->
-<h1>Source</h1>
-<p>Using this page, you can manually edit the <code>persistence.xml</code> file.</p>
-<p>See <a href="task_manage_persistence.htm#CIHDAJID">"Managing the persistence.xml file"</a> for additional information.</p>
-<p>&nbsp;</p>
-<img src="img/ngrelt.png" alt="Related task" title="Related task" /><br />
-<br />
-<a href="task_manage_persistence.htm#CIHDAJID">Managing the persistence.xml file</a></div>
-<!-- class="sect3" -->
-<!-- class="sect2" -->
-<!-- class="sect1" -->
-<!-- Start Footer -->
-<div class="footer">
-<table class="simple oac_no_warn" summary="" cellspacing="0" cellpadding="0" width="100%">
-<col width="86%" />
-<col width="*" />
-<tr>
-<td align="left"><span class="copyrightlogo">Copyright&nbsp;&copy;&nbsp;2006, 2009,&nbsp;Oracle&nbsp;and/or&nbsp;its&nbsp;affiliates.&nbsp;All&nbsp;rights&nbsp;reserved.</span><br />
-<a href="dcommon/html/cpyr.htm"><span class="copyrightlogo">Legal Notices</span></a></td>
-</tr>
-</table>
-</div>
-<!-- class="footer" -->
-</body>
-</html>
diff --git a/jpa/plugins/org.eclipse.jpt.doc.user/reference026.htm b/jpa/plugins/org.eclipse.jpt.doc.user/reference026.htm
deleted file mode 100644
index 1de4850b5e..0000000000
--- a/jpa/plugins/org.eclipse.jpt.doc.user/reference026.htm
+++ /dev/null
@@ -1,43 +0,0 @@
-<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN"
- "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
-<html xmlns="http://www.w3.org/1999/xhtml" xml:lang="en" lang="en">
-<head>
-<meta http-equiv="Content-Type" content="text/html; charset=us-ascii" />
-
-<meta http-equiv="Content-Style-Type" content="text/css" />
-<meta http-equiv="Content-Script-Type" content="text/javascript" />
-<title>Preferences</title>
-<meta name="generator" content="Oracle DARB XHTML Converter (Mode = ohj/ohw) - Version 5.1.1 Build 004" />
-<meta name="date" content="2009-05-01T8:12:52Z" />
-<meta name="robots" content="noarchive" />
-<meta name="doctitle" content="Preferences" />
-<meta name="relnum" content="Release 2.2" />
-<meta name="copyright" content="Copyright (c) 2000, 2008 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. Contributors: Oracle - initial API and implementation" />
-<link rel="copyright" href="dcommon/html/cpyr.htm" title="Copyright" type="text/html" />
-<link rel="stylesheet" href="dcommon/css/blafdoc.css" title="Oracle BLAFDoc" type="text/css" />
-<!-- contents -->
-</head>
-<body>
-<p><a id="CACDEIEE" name="CACDEIEE"></a></p>
-<div class="sect1"><!-- infolevel="all" infotype="General" -->
-<h1>Preferences</h1>
-<p>This section includes information on the following preference pages:</p>
-<ul>
-<li>
-<p><a href="ref_project_properties.htm#BABJHBCI">Project Properties page &ndash; Java Persistence Options</a></p>
-</li>
-</ul>
-<!-- Start Footer -->
-<div class="footer">
-<table class="simple oac_no_warn" summary="" cellspacing="0" cellpadding="0" width="100%">
-<col width="86%" />
-<col width="*" />
-<tr>
-<td align="left"><span class="copyrightlogo">Copyright&nbsp;&copy;&nbsp;2006, 2009,&nbsp;Oracle&nbsp;and/or&nbsp;its&nbsp;affiliates.&nbsp;All&nbsp;rights&nbsp;reserved.</span><br />
-<a href="dcommon/html/cpyr.htm"><span class="copyrightlogo">Legal Notices</span></a></td>
-</tr>
-</table>
-</div>
-<!-- class="footer" --></div>
-</body>
-</html>
diff --git a/jpa/plugins/org.eclipse.jpt.doc.user/reference027.htm b/jpa/plugins/org.eclipse.jpt.doc.user/reference027.htm
deleted file mode 100644
index 2217c80833..0000000000
--- a/jpa/plugins/org.eclipse.jpt.doc.user/reference027.htm
+++ /dev/null
@@ -1,49 +0,0 @@
-<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN"
- "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
-<html xmlns="http://www.w3.org/1999/xhtml" xml:lang="en" lang="en">
-<head>
-<meta http-equiv="Content-Type" content="text/html; charset=us-ascii" />
-
-<meta http-equiv="Content-Style-Type" content="text/css" />
-<meta http-equiv="Content-Script-Type" content="text/javascript" />
-<title>Dialogs</title>
-<meta name="generator" content="Oracle DARB XHTML Converter (Mode = ohj/ohw) - Version 5.1.1 Build 004" />
-<meta name="date" content="2009-05-01T8:12:52Z" />
-<meta name="robots" content="noarchive" />
-<meta name="doctitle" content="Dialogs" />
-<meta name="relnum" content="Release 2.2" />
-<meta name="copyright" content="Copyright (c) 2000, 2008 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. Contributors: Oracle - initial API and implementation" />
-<link rel="copyright" href="dcommon/html/cpyr.htm" title="Copyright" type="text/html" />
-<link rel="stylesheet" href="dcommon/css/blafdoc.css" title="Oracle BLAFDoc" type="text/css" />
-<!-- contents -->
-</head>
-<body>
-<p><a id="CACGEJDA" name="CACGEJDA"></a></p>
-<div class="sect1"><!-- infolevel="all" infotype="General" -->
-<h1>Dialogs</h1>
-<p>This section includes information on the following preference pages:</p>
-<ul>
-<li>
-<p><a href="reference028.htm#CACCGEHC">Edit Join Columns Dialog</a></p>
-</li>
-<li>
-<p><a href="ref_select_cascade_dialog.htm#CIAFDGIJ">Select Cascade dialog</a></p>
-</li>
-<li>
-<p><a href="ref_eclipselink_mapping_file.htm#CIAEDEJF">New EclipseLink Mapping File dialog</a></p>
-</li>
-</ul>
-<!-- Start Footer -->
-<div class="footer">
-<table class="simple oac_no_warn" summary="" cellspacing="0" cellpadding="0" width="100%">
-<col width="86%" />
-<col width="*" />
-<tr>
-<td align="left"><span class="copyrightlogo">Copyright&nbsp;&copy;&nbsp;2006, 2009,&nbsp;Oracle&nbsp;and/or&nbsp;its&nbsp;affiliates.&nbsp;All&nbsp;rights&nbsp;reserved.</span><br />
-<a href="dcommon/html/cpyr.htm"><span class="copyrightlogo">Legal Notices</span></a></td>
-</tr>
-</table>
-</div>
-<!-- class="footer" --></div>
-</body>
-</html>
diff --git a/jpa/plugins/org.eclipse.jpt.doc.user/reference028.htm b/jpa/plugins/org.eclipse.jpt.doc.user/reference028.htm
deleted file mode 100644
index 4b29c726e8..0000000000
--- a/jpa/plugins/org.eclipse.jpt.doc.user/reference028.htm
+++ /dev/null
@@ -1,67 +0,0 @@
-<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN"
- "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
-<html xmlns="http://www.w3.org/1999/xhtml" xml:lang="en" lang="en">
-<head>
-<meta http-equiv="Content-Type" content="text/html; charset=us-ascii" />
-
-<meta http-equiv="Content-Style-Type" content="text/css" />
-<meta http-equiv="Content-Script-Type" content="text/javascript" />
-<title>Edit Join Columns Dialog</title>
-<meta name="generator" content="Oracle DARB XHTML Converter (Mode = ohj/ohw) - Version 5.1.1 Build 004" />
-<meta name="date" content="2009-05-01T8:12:52Z" />
-<meta name="robots" content="noarchive" />
-<meta name="doctitle" content="Edit Join Columns Dialog" />
-<meta name="relnum" content="Release 2.2" />
-<meta name="copyright" content="Copyright (c) 2000, 2008 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. Contributors: Oracle - initial API and implementation" />
-<link rel="copyright" href="dcommon/html/cpyr.htm" title="Copyright" type="text/html" />
-<link rel="stylesheet" href="dcommon/css/blafdoc.css" title="Oracle BLAFDoc" type="text/css" />
-<!-- contents -->
-</head>
-<body>
-<p><a id="CACCGEHC" name="CACCGEHC"></a></p>
-<div class="sect2"><!-- infolevel="all" infotype="General" -->
-<h1>Edit Join Columns Dialog</h1>
-<p>Use the <span class="gui-object-title">Join Columns</span> dialog to create or modify the join tables and columns in relationship mappings.</p>
-<p>This table lists the properties available in the <span class="gui-object-title">Join Columns</span> dialog.</p>
-<div class="inftblinformal">
-<table class="Informal" title="This table describes the options on the Join Columns dialog." summary="This table describes the options on the Join Columns dialog." dir="ltr" border="1" width="100%" frame="border" rules="all" cellpadding="3" cellspacing="0">
-<col width="32%" />
-<col width="*" />
-<thead>
-<tr align="left" valign="top">
-<th align="left" valign="bottom" id="r1c1-t37">Property</th>
-<th align="left" valign="bottom" id="r1c2-t37">Description</th>
-</tr>
-</thead>
-<tbody>
-<tr align="left" valign="top">
-<td align="left" id="r2c1-t37" headers="r1c1-t37">Name</td>
-<td align="left" headers="r2c1-t37 r1c2-t37">Name of the joint table column that contains the foreign key column.</td>
-</tr>
-<tr align="left" valign="top">
-<td align="left" id="r3c1-t37" headers="r1c1-t37">Referenced Column Name</td>
-<td align="left" headers="r3c1-t37 r1c2-t37">Name of the database column that contains the foreign key reference for the entity relationship.</td>
-</tr>
-</tbody>
-</table>
-<br /></div>
-<!-- class="inftblinformal" -->
-<img src="img/ngrelr.png" alt="Related reference" title="Related reference" /><br />
-<br />
-<a href="reference011.htm#CACBAEBC">Join Table Information</a><br />
-<a href="reference012.htm#CACFCEJC">Join Columns Information</a></div>
-<!-- class="sect2" -->
-<!-- Start Footer -->
-<div class="footer">
-<table class="simple oac_no_warn" summary="" cellspacing="0" cellpadding="0" width="100%">
-<col width="86%" />
-<col width="*" />
-<tr>
-<td align="left"><span class="copyrightlogo">Copyright&nbsp;&copy;&nbsp;2006, 2009,&nbsp;Oracle&nbsp;and/or&nbsp;its&nbsp;affiliates.&nbsp;All&nbsp;rights&nbsp;reserved.</span><br />
-<a href="dcommon/html/cpyr.htm"><span class="copyrightlogo">Legal Notices</span></a></td>
-</tr>
-</table>
-</div>
-<!-- class="footer" -->
-</body>
-</html>
diff --git a/jpa/plugins/org.eclipse.jpt.doc.user/reference029.htm b/jpa/plugins/org.eclipse.jpt.doc.user/reference029.htm
deleted file mode 100644
index 1dad1de5f2..0000000000
--- a/jpa/plugins/org.eclipse.jpt.doc.user/reference029.htm
+++ /dev/null
@@ -1,46 +0,0 @@
-<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN"
- "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
-<html xmlns="http://www.w3.org/1999/xhtml" xml:lang="en" lang="en">
-<head>
-<meta http-equiv="Content-Type" content="text/html; charset=us-ascii" />
-
-<meta http-equiv="Content-Style-Type" content="text/css" />
-<meta http-equiv="Content-Script-Type" content="text/javascript" />
-<title>Icons and buttons</title>
-<meta name="generator" content="Oracle DARB XHTML Converter (Mode = ohj/ohw) - Version 5.1.1 Build 004" />
-<meta name="date" content="2009-05-01T8:12:53Z" />
-<meta name="robots" content="noarchive" />
-<meta name="doctitle" content="Icons and buttons" />
-<meta name="relnum" content="Release 2.2" />
-<meta name="copyright" content="Copyright (c) 2000, 2008 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. Contributors: Oracle - initial API and implementation" />
-<link rel="copyright" href="dcommon/html/cpyr.htm" title="Copyright" type="text/html" />
-<link rel="stylesheet" href="dcommon/css/blafdoc.css" title="Oracle BLAFDoc" type="text/css" />
-<!-- contents -->
-</head>
-<body>
-<p><a id="CACDHCIA" name="CACDHCIA"></a></p>
-<div class="sect1"><!-- infolevel="all" infotype="General" -->
-<h1>Icons and buttons</h1>
-<p>This section includes information on each of the icons and buttons used in the Dali OR Mapping Tool.</p>
-<ul>
-<li>
-<p><a href="reference030.htm#CACGEACG">Icons</a></p>
-</li>
-<li>
-<p><a href="reference031.htm#CACDJCEI">Buttons</a></p>
-</li>
-</ul>
-<!-- Start Footer -->
-<div class="footer">
-<table class="simple oac_no_warn" summary="" cellspacing="0" cellpadding="0" width="100%">
-<col width="86%" />
-<col width="*" />
-<tr>
-<td align="left"><span class="copyrightlogo">Copyright&nbsp;&copy;&nbsp;2006, 2009,&nbsp;Oracle&nbsp;and/or&nbsp;its&nbsp;affiliates.&nbsp;All&nbsp;rights&nbsp;reserved.</span><br />
-<a href="dcommon/html/cpyr.htm"><span class="copyrightlogo">Legal Notices</span></a></td>
-</tr>
-</table>
-</div>
-<!-- class="footer" --></div>
-</body>
-</html>
diff --git a/jpa/plugins/org.eclipse.jpt.doc.user/reference030.htm b/jpa/plugins/org.eclipse.jpt.doc.user/reference030.htm
deleted file mode 100644
index 22637b3354..0000000000
--- a/jpa/plugins/org.eclipse.jpt.doc.user/reference030.htm
+++ /dev/null
@@ -1,125 +0,0 @@
-<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN"
- "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
-<html xmlns="http://www.w3.org/1999/xhtml" xml:lang="en" lang="en">
-<head>
-<meta http-equiv="Content-Type" content="text/html; charset=us-ascii" />
-
-<meta http-equiv="Content-Style-Type" content="text/css" />
-<meta http-equiv="Content-Script-Type" content="text/javascript" />
-<title>Icons</title>
-<meta name="generator" content="Oracle DARB XHTML Converter (Mode = ohj/ohw) - Version 5.1.1 Build 004" />
-<meta name="date" content="2009-05-01T8:12:53Z" />
-<meta name="robots" content="noarchive" />
-<meta name="doctitle" content="Icons" />
-<meta name="relnum" content="Release 2.2" />
-<meta name="copyright" content="Copyright (c) 2000, 2008 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. Contributors: Oracle - initial API and implementation" />
-<link rel="copyright" href="dcommon/html/cpyr.htm" title="Copyright" type="text/html" />
-<link rel="stylesheet" href="dcommon/css/blafdoc.css" title="Oracle BLAFDoc" type="text/css" />
-<!-- contents -->
-</head>
-<body>
-<p><a id="CACGEACG" name="CACGEACG"></a></p>
-<div class="sect2"><!-- infolevel="all" infotype="General" -->
-<h1>Icons</h1>
-<p>The following icons are used throughout the Dali OR Mapping Tool.</p>
-<div class="inftblruleinformal">
-<table class="RuleInformal" title="This table describes the icons used in the Dali plug-in." summary="This table describes the icons used in the Dali plug-in." dir="ltr" border="1" width="100%" frame="border" rules="all" cellpadding="3" cellspacing="0">
-<col width="23%" />
-<col width="*" />
-<thead>
-<tr align="left" valign="top">
-<th align="left" valign="bottom" id="r1c1-t40">Icon</th>
-<th align="left" valign="bottom" id="r1c2-t40">Description</th>
-</tr>
-</thead>
-<tbody>
-<tr align="left" valign="top">
-<td align="left" id="r2c1-t40" headers="r1c1-t40"><img src="img/new_icon_mappedentity.png" alt="" title="" /><br /></td>
-<td align="left" headers="r2c1-t40 r1c2-t40"><a href="tasks005.htm#BABGBIEE">Entity</a><br /></td>
-</tr>
-<tr align="left" valign="top">
-<td align="left" id="r3c1-t40" headers="r1c1-t40"><img src="img/new_icon_embeddableentitymapping.png" alt="Embeddable entity icon" title="Embeddable entity icon" /><br /></td>
-<td align="left" headers="r3c1-t40 r1c2-t40"><a href="tasks006.htm#BABFEICE">Embeddable</a> entity</td>
-</tr>
-<tr align="left" valign="top">
-<td align="left" id="r4c1-t40" headers="r1c1-t40"><img src="img/new_icon_mappedsuperclass.png" alt="Mapped superclass icon" title="Mapped superclass icon" /><br /></td>
-<td align="left" headers="r4c1-t40 r1c2-t40"><a href="tasks007.htm#BABDAGCI">Mapped superclass</a></td>
-</tr>
-<tr align="left" valign="top">
-<td align="left" id="r5c1-t40" headers="r1c1-t40"><img src="img/new_icon_basicmappings.png" alt="Basic mapping icon" title="Basic mapping icon" /><br /></td>
-<td align="left" headers="r5c1-t40 r1c2-t40"><a href="tasks009.htm#BABBABCE">Basic mapping</a><br /></td>
-</tr>
-<tr align="left" valign="top">
-<td align="left" id="r6c1-t40" headers="r1c1-t40"><img src="img/icon_basicmapmappings.png" alt="Basic mapping icon" title="Basic mapping icon" /><br /></td>
-<td align="left" headers="r6c1-t40 r1c2-t40">Basic collection mapping</td>
-</tr>
-<tr align="left" valign="top">
-<td align="left" id="r7c1-t40" headers="r1c1-t40"><img src="img/icon_basicmapmappings.png" alt="Basic mapping icon" title="Basic mapping icon" /><br /></td>
-<td align="left" headers="r7c1-t40 r1c2-t40">Basic map mapping</td>
-</tr>
-<tr align="left" valign="top">
-<td align="left" id="r8c1-t40" headers="r1c1-t40"><img src="img/new_icon_embeddedidmapping.png" alt="Embedded mapping icon" title="Embedded mapping icon" /><br /></td>
-<td align="left" headers="r8c1-t40 r1c2-t40"><a href="tasks010.htm#BABCBHDF">Embedded mapping</a><br /></td>
-</tr>
-<tr align="left" valign="top">
-<td align="left" id="r9c1-t40" headers="r1c1-t40"><img src="img/new_icon_embeddedmapping.png" alt="Embedded ID mapping icon" title="Embedded ID mapping icon" /><br /></td>
-<td align="left" headers="r9c1-t40 r1c2-t40"><a href="tasks011.htm#CIHDIAEE">Embedded ID mapping</a><br /></td>
-</tr>
-<tr align="left" valign="top">
-<td align="left" id="r10c1-t40" headers="r1c1-t40"><img src="img/new_icon_idmapping.png" alt="ID mapping icon" title="ID mapping icon" /><br /></td>
-<td align="left" headers="r10c1-t40 r1c2-t40"><a href="tasks012.htm#BABGCBHG">ID mapping</a><br /></td>
-</tr>
-<tr align="left" valign="top">
-<td align="left" id="r11c1-t40" headers="r1c1-t40"><img src="img/new_icon_manytomanymapping.png" alt="Many-to-many mapping icon" title="Many-to-many mapping icon" /><br /></td>
-<td align="left" headers="r11c1-t40 r1c2-t40"><a href="tasks013.htm#BABEIEGD">Many-to-many mapping</a><br /></td>
-</tr>
-<tr align="left" valign="top">
-<td align="left" id="r12c1-t40" headers="r1c1-t40"><img src="img/new_icon_manytoonemapping.png" alt="Many-to-one mapping icon." title="Many-to-one mapping icon." /><br /></td>
-<td align="left" headers="r12c1-t40 r1c2-t40"><a href="tasks014.htm#BABHFAFJ">Many-to-one mapping</a><br /></td>
-</tr>
-<tr align="left" valign="top">
-<td align="left" id="r13c1-t40" headers="r1c1-t40"><img src="img/new_icon_onetomanymapping.png" alt="One-to-many mapping icon" title="One-to-many mapping icon" /><br /></td>
-<td align="left" headers="r13c1-t40 r1c2-t40"><a href="tasks015.htm#BABHGEBD">One-to-many mapping</a><br /></td>
-</tr>
-<tr align="left" valign="top">
-<td align="left" id="r14c1-t40" headers="r1c1-t40"><img src="img/new_icon_onetoonemapping.png" alt="One-to-one mapping icon." title="One-to-one mapping icon." /><br /></td>
-<td align="left" headers="r14c1-t40 r1c2-t40"><a href="tasks016.htm#BABFHBCJ">One-to-one mapping</a><br /></td>
-</tr>
-<tr align="left" valign="top">
-<td align="left" id="r15c1-t40" headers="r1c1-t40"><img src="img/icon_basicmapmappings.png" alt="Basic mapping icon" title="Basic mapping icon" /><br /></td>
-<td align="left" headers="r15c1-t40 r1c2-t40">Transformation mappings</td>
-</tr>
-<tr align="left" valign="top">
-<td align="left" id="r16c1-t40" headers="r1c1-t40"><img src="img/new_icon_transientmapping.png" alt="Transient mapping icon." title="Transient mapping icon." /><br /></td>
-<td align="left" headers="r16c1-t40 r1c2-t40"><a href="tasks017.htm#BABHFHEI">Transient mapping</a><br /></td>
-</tr>
-<tr align="left" valign="top">
-<td align="left" id="r17c1-t40" headers="r1c1-t40"><img src="img/icon_basicmapmappings.png" alt="Basic mapping icon" title="Basic mapping icon" /><br /></td>
-<td align="left" headers="r17c1-t40 r1c2-t40">Variable one-to-one mappings</td>
-</tr>
-<tr align="left" valign="top">
-<td align="left" id="r18c1-t40" headers="r1c1-t40"><img src="img/new_icon_versionmapping.png" alt="Version mapping icon." title="Version mapping icon." /><br /></td>
-<td align="left" headers="r18c1-t40 r1c2-t40"><a href="tasks018.htm#BABHIBII">Version mapping</a><br /></td>
-</tr>
-</tbody>
-</table>
-<br /></div>
-<!-- class="inftblruleinformal" -->
-<img src="img/ngrelc.png" alt="Related concept" title="Related concept" /><br />
-<p><a href="reference029.htm#CACDHCIA">Icons and buttons</a></p>
-</div>
-<!-- class="sect2" -->
-<!-- Start Footer -->
-<div class="footer">
-<table class="simple oac_no_warn" summary="" cellspacing="0" cellpadding="0" width="100%">
-<col width="86%" />
-<col width="*" />
-<tr>
-<td align="left"><span class="copyrightlogo">Copyright&nbsp;&copy;&nbsp;2006, 2009,&nbsp;Oracle&nbsp;and/or&nbsp;its&nbsp;affiliates.&nbsp;All&nbsp;rights&nbsp;reserved.</span><br />
-<a href="dcommon/html/cpyr.htm"><span class="copyrightlogo">Legal Notices</span></a></td>
-</tr>
-</table>
-</div>
-<!-- class="footer" -->
-</body>
-</html>
diff --git a/jpa/plugins/org.eclipse.jpt.doc.user/reference031.htm b/jpa/plugins/org.eclipse.jpt.doc.user/reference031.htm
deleted file mode 100644
index 0e5faa8471..0000000000
--- a/jpa/plugins/org.eclipse.jpt.doc.user/reference031.htm
+++ /dev/null
@@ -1,62 +0,0 @@
-<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN"
- "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
-<html xmlns="http://www.w3.org/1999/xhtml" xml:lang="en" lang="en">
-<head>
-<meta http-equiv="Content-Type" content="text/html; charset=us-ascii" />
-
-<meta http-equiv="Content-Style-Type" content="text/css" />
-<meta http-equiv="Content-Script-Type" content="text/javascript" />
-<title>Buttons</title>
-<meta name="generator" content="Oracle DARB XHTML Converter (Mode = ohj/ohw) - Version 5.1.1 Build 004" />
-<meta name="date" content="2009-05-01T8:12:54Z" />
-<meta name="robots" content="noarchive" />
-<meta name="doctitle" content="Buttons" />
-<meta name="relnum" content="Release 2.2" />
-<meta name="copyright" content="Copyright (c) 2000, 2008 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. Contributors: Oracle - initial API and implementation" />
-<link rel="copyright" href="dcommon/html/cpyr.htm" title="Copyright" type="text/html" />
-<link rel="stylesheet" href="dcommon/css/blafdoc.css" title="Oracle BLAFDoc" type="text/css" />
-<!-- contents -->
-</head>
-<body>
-<p><a id="CACDJCEI" name="CACDJCEI"></a></p>
-<div class="sect2"><!-- infolevel="all" infotype="General" -->
-<h1>Buttons</h1>
-<p>The following buttons are used throughout the Dali OR Mapping Tool.</p>
-<div class="inftblruleinformal">
-<table class="RuleInformal" title="This table describes the buttons used in the Dali plug-in." summary="This table describes the buttons used in the Dali plug-in." dir="ltr" border="1" width="100%" frame="border" rules="all" cellpadding="3" cellspacing="0">
-<col width="27%" />
-<col width="*" />
-<thead>
-<tr align="left" valign="top">
-<th align="left" valign="bottom" id="r1c1-t41">Icon</th>
-<th align="left" valign="bottom" id="r1c2-t41">Description</th>
-</tr>
-</thead>
-<tbody>
-<tr align="left" valign="top">
-<td align="left" id="r2c1-t41" headers="r1c1-t41"><img src="img/new_jpa_perspective_button.png" alt="The JPA Perspective icon" title="The JPA Perspective icon" /><br /></td>
-<td align="left" headers="r2c1-t41 r1c2-t41">JPA Development perspective</td>
-</tr>
-</tbody>
-</table>
-<br /></div>
-<!-- class="inftblruleinformal" -->
-<img src="img/ngrelc.png" alt="Related concept" title="Related concept" /><br />
-<p><a href="reference029.htm#CACDHCIA">Icons and buttons</a></p>
-</div>
-<!-- class="sect2" -->
-<!-- class="sect1" -->
-<!-- Start Footer -->
-<div class="footer">
-<table class="simple oac_no_warn" summary="" cellspacing="0" cellpadding="0" width="100%">
-<col width="86%" />
-<col width="*" />
-<tr>
-<td align="left"><span class="copyrightlogo">Copyright&nbsp;&copy;&nbsp;2006, 2009,&nbsp;Oracle&nbsp;and/or&nbsp;its&nbsp;affiliates.&nbsp;All&nbsp;rights&nbsp;reserved.</span><br />
-<a href="dcommon/html/cpyr.htm"><span class="copyrightlogo">Legal Notices</span></a></td>
-</tr>
-</table>
-</div>
-<!-- class="footer" -->
-</body>
-</html>
diff --git a/jpa/plugins/org.eclipse.jpt.doc.user/reference032.htm b/jpa/plugins/org.eclipse.jpt.doc.user/reference032.htm
deleted file mode 100644
index 969a73e066..0000000000
--- a/jpa/plugins/org.eclipse.jpt.doc.user/reference032.htm
+++ /dev/null
@@ -1,53 +0,0 @@
-<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN"
- "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
-<html xmlns="http://www.w3.org/1999/xhtml" xml:lang="en" lang="en">
-<head>
-<meta http-equiv="Content-Type" content="text/html; charset=us-ascii" />
-
-<meta http-equiv="Content-Style-Type" content="text/css" />
-<meta http-equiv="Content-Script-Type" content="text/javascript" />
-<title>Dali Developer Documentation</title>
-<meta name="generator" content="Oracle DARB XHTML Converter (Mode = ohj/ohw) - Version 5.1.1 Build 004" />
-<meta name="date" content="2009-05-01T8:12:54Z" />
-<meta name="robots" content="noarchive" />
-<meta name="doctitle" content="Dali Developer Documentation" />
-<meta name="relnum" content="Release 2.2" />
-<meta name="copyright" content="Copyright (c) 2000, 2008 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. Contributors: Oracle - initial API and implementation" />
-<link rel="copyright" href="dcommon/html/cpyr.htm" title="Copyright" type="text/html" />
-<link rel="stylesheet" href="dcommon/css/blafdoc.css" title="Oracle BLAFDoc" type="text/css" />
-<!-- contents -->
-</head>
-<body>
-<p><a id="CACBBDIB" name="CACBBDIB"></a></p>
-<div class="sect1"><!-- infolevel="all" infotype="General" -->
-<h1>Dali Developer Documentation</h1>
-<p><a id="sthref282" name="sthref282"></a><a id="sthref283" name="sthref283"></a><a id="sthref284" name="sthref284"></a>Additional Dali documentation is available online at:</p>
-<p><code><a href="http://wiki.eclipse.org/index.php/Dali_Developer_Documentation">http://wiki.eclipse.org/index.php/Dali_Developer_Documentation</a></code></p>
-<p>This developer documentation includes information about:</p>
-<ul>
-<li>
-<p>Dali architecture</p>
-</li>
-<li>
-<p>Plugins that comprise the Dali JPA Eclipse feature</p>
-</li>
-<li>
-<p>Extension points</p>
-</li>
-</ul>
-</div>
-<!-- class="sect1" -->
-<!-- Start Footer -->
-<div class="footer">
-<table class="simple oac_no_warn" summary="" cellspacing="0" cellpadding="0" width="100%">
-<col width="86%" />
-<col width="*" />
-<tr>
-<td align="left"><span class="copyrightlogo">Copyright&nbsp;&copy;&nbsp;2006, 2009,&nbsp;Oracle&nbsp;and/or&nbsp;its&nbsp;affiliates.&nbsp;All&nbsp;rights&nbsp;reserved.</span><br />
-<a href="dcommon/html/cpyr.htm"><span class="copyrightlogo">Legal Notices</span></a></td>
-</tr>
-</table>
-</div>
-<!-- class="footer" -->
-</body>
-</html>
diff --git a/jpa/plugins/org.eclipse.jpt.doc.user/task_add_persistence.htm b/jpa/plugins/org.eclipse.jpt.doc.user/task_add_persistence.htm
deleted file mode 100644
index 90e86cf461..0000000000
--- a/jpa/plugins/org.eclipse.jpt.doc.user/task_add_persistence.htm
+++ /dev/null
@@ -1,60 +0,0 @@
-<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN"
- "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
-<html xmlns="http://www.w3.org/1999/xhtml" xml:lang="en" lang="en">
-<head>
-<meta http-equiv="Content-Type" content="text/html; charset=us-ascii" />
-
-<meta http-equiv="Content-Style-Type" content="text/css" />
-<meta http-equiv="Content-Script-Type" content="text/javascript" />
-<title>Adding persistence to a class</title>
-<meta name="generator" content="Oracle DARB XHTML Converter (Mode = ohj/ohw) - Version 5.1.1 Build 004" />
-<meta name="date" content="2009-05-01T8:12:44Z" />
-<meta name="robots" content="noarchive" />
-<meta name="doctitle" content="Adding persistence to a class" />
-<meta name="relnum" content="Release 2.2" />
-<meta name="copyright" content="Copyright (c) 2000, 2008 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. Contributors: Oracle - initial API and implementation" />
-<link rel="copyright" href="dcommon/html/cpyr.htm" title="Copyright" type="text/html" />
-<link rel="stylesheet" href="dcommon/css/blafdoc.css" title="Oracle BLAFDoc" type="text/css" />
-<!-- contents -->
-</head>
-<body>
-<p><a id="BABHICAI" name="BABHICAI"></a></p>
-<div class="sect1">
-<h1>Adding persistence to a class</h1>
-<p><a id="sthref66" name="sthref66"></a><a id="sthref67" name="sthref67"></a><a id="sthref68" name="sthref68"></a>You can make a Java class into one of the following persistent types:</p>
-<ul>
-<li>
-<p><a href="tasks005.htm#BABGBIEE">Entity</a></p>
-</li>
-<li>
-<p><a href="tasks006.htm#BABFEICE">Embeddable</a></p>
-</li>
-<li>
-<p><a href="tasks007.htm#BABDAGCI">Mapped superclass</a></p>
-</li>
-</ul>
-<p>&nbsp;</p>
-<img src="img/ngrelt.png" alt="Related tasks" title="Related tasks" /><br />
-<br />
-<a href="task_additonal_tables.htm#CIHGBIEI">Specifying additional tables</a><br />
-<a href="task_inheritance.htm#CIHCCCJD">Specifying entity inheritance</a><br />
-<a href="task_mapping.htm#BABDGBIJ">Mapping an entity</a>
-<p>&nbsp;</p>
-<img src="img/ngrelc.png" alt="Related concept" title="Related concept" /><br />
-<br />
-<a href="concept_persistence.htm#BABCAHIC">Understanding Java persistence</a><br />
-<a href="concepts003.htm#CHDBIJAC">The orm.xml file</a><br />
-<a href="concepts002.htm#CHDHAGIH">The persistence.xml file</a> <!-- Start Footer -->
-<div class="footer">
-<table class="simple oac_no_warn" summary="" cellspacing="0" cellpadding="0" width="100%">
-<col width="86%" />
-<col width="*" />
-<tr>
-<td align="left"><span class="copyrightlogo">Copyright&nbsp;&copy;&nbsp;2006, 2009,&nbsp;Oracle&nbsp;and/or&nbsp;its&nbsp;affiliates.&nbsp;All&nbsp;rights&nbsp;reserved.</span><br />
-<a href="dcommon/html/cpyr.htm"><span class="copyrightlogo">Legal Notices</span></a></td>
-</tr>
-</table>
-</div>
-<!-- class="footer" --></div>
-</body>
-</html>
diff --git a/jpa/plugins/org.eclipse.jpt.doc.user/task_additonal_tables.htm b/jpa/plugins/org.eclipse.jpt.doc.user/task_additonal_tables.htm
deleted file mode 100644
index 2155ba27fe..0000000000
--- a/jpa/plugins/org.eclipse.jpt.doc.user/task_additonal_tables.htm
+++ /dev/null
@@ -1,84 +0,0 @@
-<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN"
- "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
-<html xmlns="http://www.w3.org/1999/xhtml" xml:lang="en" lang="en">
-<head>
-<meta http-equiv="Content-Type" content="text/html; charset=us-ascii" />
-
-<meta http-equiv="Content-Style-Type" content="text/css" />
-<meta http-equiv="Content-Script-Type" content="text/javascript" />
-<title>Specifying additional tables</title>
-<meta name="generator" content="Oracle DARB XHTML Converter (Mode = ohj/ohw) - Version 5.1.1 Build 004" />
-<meta name="date" content="2009-05-01T8:12:45Z" />
-<meta name="robots" content="noarchive" />
-<meta name="doctitle" content="Specifying additional tables" />
-<meta name="relnum" content="Release 2.2" />
-<meta name="copyright" content="Copyright (c) 2000, 2008 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. Contributors: Oracle - initial API and implementation" />
-<link rel="copyright" href="dcommon/html/cpyr.htm" title="Copyright" type="text/html" />
-<link rel="stylesheet" href="dcommon/css/blafdoc.css" title="Oracle BLAFDoc" type="text/css" />
-<!-- contents -->
-</head>
-<body>
-<p><a id="CIHGBIEI" name="CIHGBIEI"></a></p>
-<div class="sect1"><!-- infolevel="all" infotype="General" -->
-<h1>Specifying additional tables</h1>
-<p>Add a secondary table annotation to an entity if its data is split across more than one table.</p>
-<p>To add a secondary table to the entity,</p>
-<ol>
-<li>
-<p>Select the entity in the <span class="gui-object-title">Project Explorer</span>.</p>
-</li>
-<li>
-<p>In the <span class="gui-object-title">JPA Details</span> view, select the <span class="gui-object-action">Secondary Tables</span> information.</p>
-<div class="figure"><a id="sthref91" name="sthref91"></a>
-<p class="titleinfigure">Specifying Secondary Tables</p>
-<img src="img/secondary_tables.png" alt="Secondary Tables area on the JPA Details view." title="Secondary Tables area on the JPA Details view." /><br /></div>
-<!-- class="figure" --></li>
-<li>
-<p>Click <span class="bold">Add</span> to associate an additional table with the entity. The Edit Secondary Table dialog appears</p>
-</li>
-<li>
-<p>Select the <span class="bold">Name</span>, <span class="bold">Catalog</span>, and <span class="bold">Schema</span> of the additional table to associate with the entity.</p>
-</li>
-</ol>
-<p>Eclipse adds the following annotations the entity:</p>
-<pre xml:space="preserve" class="oac_no_warn">
-@SecondaryTable(name="NAME", catalog = "CATALOG", schema = "SCHEMA")
-
-</pre>
-<p>To override the default primary key:</p>
-<ol>
-<li>
-<p>Enable the <span class="bold">Overwrite default</span> option, then click <span class="bold">Add</span> to specify a new primary key join column. The Create New Primary Key Join Column appears.</p>
-</li>
-<li>
-<p>Select the <span class="bold">Name</span>, <span class="bold">Referenced column name</span>, <span class="bold">Table</span>, and <span class="bold">Column definition</span> of the primary key for the entity.</p>
-<p>Eclipse adds the following annotations the entity:</p>
-<pre xml:space="preserve" class="oac_no_warn">
-@SecondaryTable(name="NAME", catalog = "CATALOG", schema = "SCHEMA", pkJoinColumns = {@PrimaryKeyJoinColumn(name="id", referencedColumnName = "id"),@PrimaryKeyJoinColumn(name="NAME", referencedColumnName = "REFERENCED COLUMN NAME", columnDefinition = "COLUMN DEFINITION")})
-
-</pre></li>
-</ol>
-<br />
-<p>&nbsp;</p>
-<img src="img/ngrelt.png" alt="Related task" title="Related task" /><br />
-<br />
-<a href="task_add_persistence.htm#BABHICAI">Adding persistence to a class</a>
-<p>&nbsp;</p>
-<img src="img/ngrelc.png" alt="Related concept" title="Related concept" /><br />
-<br />
-<a href="concept_persistence.htm#BABCAHIC">Understanding Java persistence</a><br /></div>
-<!-- class="sect1" -->
-<!-- Start Footer -->
-<div class="footer">
-<table class="simple oac_no_warn" summary="" cellspacing="0" cellpadding="0" width="100%">
-<col width="86%" />
-<col width="*" />
-<tr>
-<td align="left"><span class="copyrightlogo">Copyright&nbsp;&copy;&nbsp;2006, 2009,&nbsp;Oracle&nbsp;and/or&nbsp;its&nbsp;affiliates.&nbsp;All&nbsp;rights&nbsp;reserved.</span><br />
-<a href="dcommon/html/cpyr.htm"><span class="copyrightlogo">Legal Notices</span></a></td>
-</tr>
-</table>
-</div>
-<!-- class="footer" -->
-</body>
-</html>
diff --git a/jpa/plugins/org.eclipse.jpt.doc.user/task_create_jpa_entity.htm b/jpa/plugins/org.eclipse.jpt.doc.user/task_create_jpa_entity.htm
deleted file mode 100644
index 8d48c4f597..0000000000
--- a/jpa/plugins/org.eclipse.jpt.doc.user/task_create_jpa_entity.htm
+++ /dev/null
@@ -1,160 +0,0 @@
-<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN"
- "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
-<html xmlns="http://www.w3.org/1999/xhtml" xml:lang="en" lang="en">
-<head>
-<meta http-equiv="Content-Type" content="text/html; charset=us-ascii" />
-
-<meta http-equiv="Content-Style-Type" content="text/css" />
-<meta http-equiv="Content-Script-Type" content="text/javascript" />
-<title>Creating a JPA Entity</title>
-<meta name="generator" content="Oracle DARB XHTML Converter (Mode = ohj/ohw) - Version 5.1.1 Build 004" />
-<meta name="date" content="2009-05-01T8:12:42Z" />
-<meta name="robots" content="noarchive" />
-<meta name="doctitle" content="Creating a JPA Entity" />
-<meta name="relnum" content="Release 2.2" />
-<meta name="copyright" content="Copyright (c) 2000, 2008 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. Contributors: Oracle - initial API and implementation" />
-<link rel="copyright" href="dcommon/html/cpyr.htm" title="Copyright" type="text/html" />
-<link rel="stylesheet" href="dcommon/css/blafdoc.css" title="Oracle BLAFDoc" type="text/css" />
-<!-- contents -->
-</head>
-<body>
-<p><a id="BABFBJBG" name="BABFBJBG"></a></p>
-<div class="sect1"><!-- infolevel="all" infotype="General" -->
-<h1><a id="sthref40" name="sthref40"></a>Creating a JPA Entity</h1>
-<p>Use this procedure to create a JPA entity:</p>
-<ol>
-<li>
-<p>From the Navigator or Project Explorer, select the JPA project and then <span class="bold">File &gt; New &gt; Other</span>. The Select a Wizard dialog appears.</p>
-<div class="figure"><a id="sthref41" name="sthref41"></a>
-<p class="titleinfigure">Selecting the Create a JPA Entity Wizard</p>
-<img src="img/select_a_wizard_entity.png" alt="The Select a Wizard dialog with Entity selected." title="The Select a Wizard dialog with Entity selected." /><br /></div>
-<!-- class="figure" --></li>
-<li>
-<p>Select <span class="bold">JPA &gt; Entity</span> and then click <span class="bold">Next</span>. The <a href="ref_EntityClassPage.htm#CIAFEIGF">Entity Class page</a> appears.</p>
-<div class="figure"><a id="sthref42" name="sthref42"></a>
-<p class="titleinfigure"><a id="sthref43" name="sthref43"></a>The Entity Class Page</p>
-<img src="img/create_jpa_entity_wizard.png" alt="The Entity Class page of the Create a JPA Entity wizard." title="The Entity Class page of the Create a JPA Entity wizard." /><br /></div>
-<!-- class="figure" -->
-<p>Complete this page as follows:</p>
-<ul>
-<li>
-<p>Select the JPA project in the <span class="bold">Project</span> field.</p>
-</li>
-<li>
-<p>In the <span class="bold">Source Folder</span> field, select, or enter, the location of the JPA project's <code>src</code> folder.</p>
-</li>
-<li>
-<p>Select, or enter, the name of the class package for this entity in the <span class="bold">Java Package</span> field.</p>
-</li>
-<li>
-<p>Enter the name of the Java class in the <span class="bold">Class name</span> field.</p>
-</li>
-<li>
-<p>If needed, enter, or select a superclass.</p>
-</li>
-<li>
-<p>If needed, complete the Inheritance section as follows (these properties are optional):</p>
-<ul>
-<li>
-<p>Accept the <span class="bold">Entity</span> option (the default) to create a Java class with the <code>@Entity</code> option.</p>
-</li>
-<li>
-<p>Alternatively, select <a href="tasks007.htm#BABDAGCI">Mapped superclass</a> (if you defined a super class).</p>
-</li>
-<li>
-<p>Select <span class="bold">Inheritance</span> and then select one of the JSR 220 inheritance mapping strategies (SINGLE_TABLE, TABLE_PER_CLASS, JOINED).</p>
-</li>
-<li>
-<p>Select <span class="bold">Add to entity mappings in XML</span> to create XML mappings in <code>orm.xml</code>, rather than annotations.</p>
-</li>
-</ul>
-</li>
-</ul>
-</li>
-<li>
-<p>Click <span class="bold">Next</span> to proceed to the <a href="ref_EntityPropertiesPage.htm#CIADECIA">Entity Properties page</a> where you define the persistent fields for the entity.</p>
-<div class="figure"><a id="sthref44" name="sthref44"></a>
-<p class="titleinfigure"><a id="sthref45" name="sthref45"></a>The Entity Properties Page</p>
-<img src="img/create_jpa_fields.png" alt="The Entity Properties page of the Create JPA Entity wizard." title="The Entity Properties page of the Create JPA Entity wizard." /><br /></div>
-<!-- class="figure" -->
-<p>Alternatively, click <span class="bold">Finish</span> to complete the entity.</p>
-</li>
-<li>
-<p>Complete the page as follows:</p>
-<ol>
-<li>
-<p>If needed, enter a new name for the entity. Doing so results in adding a <code>name</code> attribute to the <code>@Entity</code> notation (<code>@Entity(name="EntityName")</code>).</p>
-</li>
-<li>
-<p>Accept <span class="bold">Use default</span> (the default setting) to use the default value for the name of the mapped table. Entering a different name results in adding the <code>@Table</code> notation with its <code>name</code> attribute defined as the new table (<code>@Table(name="TableName")</code>).</p>
-<div align="center">
-<div class="inftblnote"><br />
-<table class="Note oac_no_warn" summary="" cellpadding="3" cellspacing="0">
-<tbody>
-<tr>
-<td align="left">
-<p class="notep1">Note:</p>
-The Entity Name-related options are not available if you selected <a href="tasks007.htm#BABDAGCI">Mapped superclass</a> on the <a href="ref_EntityClassPage.htm#CIAFEIGF">Entity Class page</a></td>
-</tr>
-</tbody>
-</table>
-<br /></div>
-<!-- class="inftblnote" --></div>
-</li>
-<li>
-<p>Add persistence fields to the entity by clicking <span class="bold">Add</span>. The Entity Fields dialog appears.</p>
-<div class="figure"><a id="sthref46" name="sthref46"></a>
-<p class="titleinfigure">The Entity Fields Dialog</p>
-<img src="img/jpa_wizard_create_fields.png" alt="The Entity Fields dialog." title="The Entity Fields dialog." /><br /></div>
-<!-- class="figure" --></li>
-<li>
-<p>Select a persistence type from the Type list. You can retrieve additional types using the <span class="bold">Browse</span> function.</p>
-</li>
-<li>
-<p>Enter the field name and then click <span class="bold">OK</span>. Repeat this procedure for each field.</p>
-</li>
-<li>
-<p>If needed, select <span class="bold">Key</span> to designate the field as a primary key.</p>
-</li>
-<li>
-<p>Select either the <span class="bold">Field-based</span> access type (the default) or <span class="bold">Property-based</span> access type.</p>
-</li>
-</ol>
-</li>
-<li>
-<p>Click <span class="bold">Finish</span>. Eclipse adds the entity to your project.</p>
-</li>
-</ol>
-<p>&nbsp;</p>
-<img src="img/ngrelr.png" alt="Related reference" title="Related reference" /><br />
-<br />
-<a href="ref_create_jpa_entity_wizard.htm#CIAGGGDF">Create JPA Entity wizard</a><br />
-<a href="ref_new_jpa_project_wizard.htm#CACBJGBG">Create New JPA Project wizard</a><br />
-<a href="ref_persistence_perspective.htm#BABIFBDB">JPA Development perspective</a>
-<p>&nbsp;</p>
-<img src="img/ngrelt.png" alt="Related tasks" title="Related tasks" /><br />
-<br />
-<a href="task_manage_persistence.htm#CIHDAJID">Managing the persistence.xml file</a><br />
-<a href="task_add_persistence.htm#BABHICAI">Adding persistence to a class</a>
-<p>&nbsp;</p>
-<img src="img/ngrelc.png" alt="Related concept" title="Related concept" /><br />
-<br />
-<a href="concept_persistence.htm#BABCAHIC">Understanding Java persistence</a><br />
-<a href="concepts002.htm#CHDHAGIH">The persistence.xml file</a><br />
-<p>&nbsp;</p>
-</div>
-<!-- class="sect1" -->
-<!-- Start Footer -->
-<div class="footer">
-<table class="simple oac_no_warn" summary="" cellspacing="0" cellpadding="0" width="100%">
-<col width="86%" />
-<col width="*" />
-<tr>
-<td align="left"><span class="copyrightlogo">Copyright&nbsp;&copy;&nbsp;2006, 2009,&nbsp;Oracle&nbsp;and/or&nbsp;its&nbsp;affiliates.&nbsp;All&nbsp;rights&nbsp;reserved.</span><br />
-<a href="dcommon/html/cpyr.htm"><span class="copyrightlogo">Legal Notices</span></a></td>
-</tr>
-</table>
-</div>
-<!-- class="footer" -->
-</body>
-</html>
diff --git a/jpa/plugins/org.eclipse.jpt.doc.user/task_create_new_project.htm b/jpa/plugins/org.eclipse.jpt.doc.user/task_create_new_project.htm
deleted file mode 100644
index 9d5aa5f3dd..0000000000
--- a/jpa/plugins/org.eclipse.jpt.doc.user/task_create_new_project.htm
+++ /dev/null
@@ -1,141 +0,0 @@
-<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN"
- "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
-<html xmlns="http://www.w3.org/1999/xhtml" xml:lang="en" lang="en">
-<head>
-<meta http-equiv="Content-Type" content="text/html; charset=us-ascii" />
-
-<meta http-equiv="Content-Style-Type" content="text/css" />
-<meta http-equiv="Content-Script-Type" content="text/javascript" />
-<title>Creating a new JPA project</title>
-<meta name="generator" content="Oracle DARB XHTML Converter (Mode = ohj/ohw) - Version 5.1.1 Build 004" />
-<meta name="date" content="2009-05-01T8:12:42Z" />
-<meta name="robots" content="noarchive" />
-<meta name="doctitle" content="Creating a new JPA project" />
-<meta name="relnum" content="Release 2.2" />
-<meta name="copyright" content="Copyright (c) 2000, 2008 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. Contributors: Oracle - initial API and implementation" />
-<link rel="copyright" href="dcommon/html/cpyr.htm" title="Copyright" type="text/html" />
-<link rel="stylesheet" href="dcommon/css/blafdoc.css" title="Oracle BLAFDoc" type="text/css" />
-<!-- contents -->
-</head>
-<body>
-<p><a id="CIHHEJCJ" name="CIHHEJCJ"></a></p>
-<div class="sect1"><!-- infolevel="all" infotype="General" -->
-<h1>Creating a new JPA project</h1>
-<p><a id="sthref26" name="sthref26"></a><a id="sthref27" name="sthref27"></a>Use this procedure to create a new JPA project.</p>
-<ol>
-<li>
-<p>From the Navigator or Project Explorer, select <span class="bold">File &gt; New &gt; Project</span>. The Select a wizard dialog appears.</p>
-<div align="center">
-<div class="inftblnotealso"><br />
-<table class="NoteAlso oac_no_warn" summary="" cellpadding="3" cellspacing="0">
-<tbody>
-<tr>
-<td align="left">
-<p class="notep1">Tip:</p>
-You can also select the JPA perspective and then select <span class="bold">File &gt; New &gt; JPA Project</span>.</td>
-</tr>
-</tbody>
-</table>
-<br /></div>
-<!-- class="inftblnotealso" --></div>
-<div class="figure"><a id="sthref28" name="sthref28"></a>
-<p class="titleinfigure"><a id="sthref29" name="sthref29"></a>Selecting the Create a JPA Project wizard</p>
-<img src="img/select_a_wizard_jpa_project.png" alt="The Select a Wizard dialog with JPA project selected." title="The Select a Wizard dialog with JPA project selected." /><br /></div>
-<!-- class="figure" --></li>
-<li>
-<p>Select <span class="bold">JPA Project</span> and then click <span class="bold">Next</span>. The <a href="ref_new_jpa_project.htm#CACBJAGC">New JPA Project page</a> appears.</p>
-<div class="figure"><a id="sthref30" name="sthref30"></a>
-<p class="titleinfigure"><a id="sthref31" name="sthref31"></a>The JPA Project Page</p>
-<img src="img/new_jpa_project_task.png" alt="The JPA Project page of the Create a JPA Project wizard." title="The JPA Project page of the Create a JPA Project wizard." /><br /></div>
-<!-- class="figure" --></li>
-<li>
-<p>Complete the fields on the <a href="ref_new_jpa_project.htm#CACBJAGC">New JPA Project page</a> to specify the project name and location, target runtime, and pre-defined configuration.</p>
-<div align="center">
-<div class="inftblnote"><br />
-<table class="Note oac_no_warn" summary="" cellpadding="3" cellspacing="0">
-<tbody>
-<tr>
-<td align="left">
-<p class="notep1">Note:</p>
-The Target Runtime is not required for Java SE development.</td>
-</tr>
-</tbody>
-</table>
-<br /></div>
-<!-- class="inftblnote" --></div>
-</li>
-<li>
-<p>Click <span class="bold">Next</span>. The Java source page appears.</p>
-<div class="figure"><a id="sthref32" name="sthref32"></a>
-<p class="titleinfigure">The Java Source Page</p>
-<img src="img/java_editor_address.png" alt="The JPA Facet page of the Create a JPA Project wizard." title="The JPA Facet page of the Create a JPA Project wizard." /><br /></div>
-<!-- class="figure" --></li>
-<li>
-<p>Click <span class="bold">Add Folder</span> to add existing Java source files to the project.</p>
-</li>
-<li>
-<p>Click <span class="bold">Next</span>. <a href="ref_jpa_facet.htm#CACIFDIF">JPA Facet page</a> appears.</p>
-<div class="figure"><a id="sthref33" name="sthref33"></a>
-<p class="titleinfigure"><a id="sthref34" name="sthref34"></a>The JPA Facet Page</p>
-<img src="img/new_jpa_facet_task.png" alt="The JPA Facet page of the Create a JPA Project wizard." title="The JPA Facet page of the Create a JPA Project wizard." /><br /></div>
-<!-- class="figure" --></li>
-<li>
-<p>Complete the fields on the <a href="ref_jpa_facet.htm#CACIFDIF">JPA Facet page</a> to specify your vender-specific platform, JPA implementation library, and database connection.</p>
-<p>Click <span class="bold">Manage libraries</span> to create or update your JPA user libraries. Click <span class="bold">Download libraries</span> to obtain additional JPA implementation libraries.</p>
-<p>If Dali derives the incorrect schema, select <span class="bold">Override the Default Schema for Connection</span>. Using this option, you can select a development time schema for defaults and validation.</p>
-<p>If you clear the <span class="bold">Create orm.xml</span> option (which is selected by default), you can later add a mapping file to the project using the <a href="reference002.htm#CIAIJCCE">Mapping File Wizard</a>.</p>
-<div align="center">
-<div class="inftblnote"><br />
-<table class="Note oac_no_warn" summary="" cellpadding="3" cellspacing="0">
-<tbody>
-<tr>
-<td align="left">
-<p class="notep1">Note:</p>
-If the server runtime does not provide a JPA implementation, you must explicitly select a JPA implementation library.
-<p>To insure the portability of your application, you must explicitly list the managed persistence classes that are included in the persistence unit. If the server supports EJB 3.0, the persistent classes will be discovered automatically.</p>
-<p>Depending on your JPA implementation (for example, Generic or EclipseLink), different options may be available when creating JPA projects.</p>
-</td>
-</tr>
-</tbody>
-</table>
-<br /></div>
-<!-- class="inftblnote" --></div>
-</li>
-<li>
-<p>Click <span class="bold">Finish</span>. You should now open the <a href="ref_persistence_perspective.htm#BABIFBDB">JPA Development perspective</a>.</p>
-</li>
-</ol>
-<p>&nbsp;</p>
-<img src="img/ngrelr.png" alt="Related reference" title="Related reference" /><br />
-<br />
-<a href="ref_new_jpa_project_wizard.htm#CACBJGBG">Create New JPA Project wizard</a><br />
-<a href="ref_persistence_perspective.htm#BABIFBDB">JPA Development perspective</a><br />
-<a href="reference002.htm#CIAIJCCE">Mapping File Wizard</a>
-<p>&nbsp;</p>
-<img src="img/ngrelt.png" alt="Related tasks" title="Related tasks" /><br />
-<br />
-<a href="task_manage_persistence.htm#CIHDAJID">Managing the persistence.xml file</a><br />
-<a href="task_add_persistence.htm#BABHICAI">Adding persistence to a class</a><br />
-<a href="tasks001.htm#BEIBADHH">Converting a Java Project to a JPA Project</a>
-<p>&nbsp;</p>
-<img src="img/ngrelc.png" alt="Related concept" title="Related concept" /><br />
-<br />
-<a href="concept_persistence.htm#BABCAHIC">Understanding Java persistence</a><br />
-<a href="concepts002.htm#CHDHAGIH">The persistence.xml file</a>
-<p>&nbsp;</p>
-</div>
-<!-- class="sect1" -->
-<!-- Start Footer -->
-<div class="footer">
-<table class="simple oac_no_warn" summary="" cellspacing="0" cellpadding="0" width="100%">
-<col width="86%" />
-<col width="*" />
-<tr>
-<td align="left"><span class="copyrightlogo">Copyright&nbsp;&copy;&nbsp;2006, 2009,&nbsp;Oracle&nbsp;and/or&nbsp;its&nbsp;affiliates.&nbsp;All&nbsp;rights&nbsp;reserved.</span><br />
-<a href="dcommon/html/cpyr.htm"><span class="copyrightlogo">Legal Notices</span></a></td>
-</tr>
-</table>
-</div>
-<!-- class="footer" -->
-</body>
-</html>
diff --git a/jpa/plugins/org.eclipse.jpt.doc.user/task_inheritance.htm b/jpa/plugins/org.eclipse.jpt.doc.user/task_inheritance.htm
deleted file mode 100644
index f213fa119d..0000000000
--- a/jpa/plugins/org.eclipse.jpt.doc.user/task_inheritance.htm
+++ /dev/null
@@ -1,138 +0,0 @@
-<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN"
- "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
-<html xmlns="http://www.w3.org/1999/xhtml" xml:lang="en" lang="en">
-<head>
-<meta http-equiv="Content-Type" content="text/html; charset=us-ascii" />
-
-<meta http-equiv="Content-Style-Type" content="text/css" />
-<meta http-equiv="Content-Script-Type" content="text/javascript" />
-<title>Specifying entity inheritance</title>
-<meta name="generator" content="Oracle DARB XHTML Converter (Mode = ohj/ohw) - Version 5.1.1 Build 004" />
-<meta name="date" content="2009-05-01T8:12:45Z" />
-<meta name="robots" content="noarchive" />
-<meta name="doctitle" content="Specifying entity inheritance" />
-<meta name="relnum" content="Release 2.2" />
-<meta name="copyright" content="Copyright (c) 2000, 2008 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. Contributors: Oracle - initial API and implementation" />
-<link rel="copyright" href="dcommon/html/cpyr.htm" title="Copyright" type="text/html" />
-<link rel="stylesheet" href="dcommon/css/blafdoc.css" title="Oracle BLAFDoc" type="text/css" />
-<!-- contents -->
-</head>
-<body>
-<p><a id="CIHCCCJD" name="CIHCCCJD"></a></p>
-<div class="sect1"><!-- infolevel="all" infotype="General" -->
-<h1>Specifying entity inheritance</h1>
-<p><a id="sthref92" name="sthref92"></a><a id="sthref93" name="sthref93"></a>An entity may inherit properties from other entities. You can specify a specific strategy to use for inheritance.</p>
-<p>Use this procedure to specify inheritance (<code>@Inheritance)</code> for an existing entity (<code>@Entity</code>):</p>
-<ol>
-<li>
-<p>Select the entity in the <span class="gui-object-title">Project Explorer</span>.</p>
-</li>
-<li>
-<p>In the <span class="gui-object-title">JPA Details</span> view, select the <span class="gui-object-action">Inheritance</span> information.</p>
-<div class="figure"><a id="sthref94" name="sthref94"></a>
-<p class="titleinfigure">Specifying Inheritance</p>
-<img src="img/inheritance_tab.png" alt="Selecting the Inheritance area on the JPA Details view." title="Selecting the Inheritance area on the JPA Details view." /><br /></div>
-<!-- class="figure" --></li>
-<li>
-<p>In the <span class="bold">Strategy</span> list, select one of the following the inheritance strategies:</p>
-<ul>
-<li>
-<p>A single table (default)</p>
-</li>
-<li>
-<p>Joined table</p>
-</li>
-<li>
-<p>One table per class</p>
-</li>
-</ul>
-</li>
-<li>
-<p>Use the following table to complete the remaining fields on the tab. See <a href="reference009.htm#CACFHGHE">"Inheritance information"</a> for additional details.</p>
-<div class="inftblruleinformal">
-<table class="RuleInformal" title="This table describes the options on the Persistence Properties view, Inheritance tab." summary="This table describes the options on the Persistence Properties view, Inheritance tab." dir="ltr" border="1" width="100%" frame="border" rules="all" cellpadding="3" cellspacing="0">
-<col width="24%" />
-<col width="*" />
-<col width="23%" />
-<thead>
-<tr align="left" valign="top">
-<th align="left" valign="bottom" id="r1c1-t13">Property</th>
-<th align="left" valign="bottom" id="r1c2-t13">Description</th>
-<th align="left" valign="bottom" id="r1c3-t13">Default</th>
-</tr>
-</thead>
-<tbody>
-<tr align="left" valign="top">
-<td align="left" id="r2c1-t13" headers="r1c1-t13"><a id="sthref95" name="sthref95"></a><a id="sthref96" name="sthref96"></a>Discriminator Column</td>
-<td align="left" headers="r2c1-t13 r1c2-t13">Name of the discriminator column when using a <span class="bold">Single</span> or <span class="bold">Joined</span> inheritance strategy.
-<p>This field corresponds to the <code>@DiscriminatorColumn</code> annotation.</p>
-</td>
-<td align="left" headers="r2c1-t13 r1c3-t13"><br /></td>
-</tr>
-<tr align="left" valign="top">
-<td align="left" id="r3c1-t13" headers="r1c1-t13">Discriminator Type</td>
-<td align="left" headers="r3c1-t13 r1c2-t13">Set the discriminator type to <code>Char</code> or <code>Integer</code> (instead of its default: <code>String</code>). The <span class="bold">Discriminator Value</span> must conform to this type.</td>
-<td align="left" headers="r3c1-t13 r1c3-t13">String</td>
-</tr>
-<tr align="left" valign="top">
-<td align="left" id="r4c1-t13" headers="r1c1-t13"><a id="sthref97" name="sthref97"></a><a id="sthref98" name="sthref98"></a>Discriminator Value</td>
-<td align="left" headers="r4c1-t13 r1c2-t13">Specify the discriminator value used to differentiate an entity in this inheritance hierarchy. The value must conform to the specified <span class="bold">Discriminator Type</span>.
-<p>This field corresponds to the <code>@DiscriminatorValue</code> annotation.</p>
-</td>
-<td align="left" headers="r4c1-t13 r1c3-t13"><br /></td>
-</tr>
-<tr align="left" valign="top">
-<td align="left" id="r5c1-t13" headers="r1c1-t13">Override Default</td>
-<td align="left" headers="r5c1-t13 r1c2-t13">Use this field to specify custom primary key join columns.
-<p>This field corresponds to the <code>@PrimaryKeyJoinClumn</code> annotation.</p>
-</td>
-<td align="left" headers="r5c1-t13 r1c3-t13"><br /></td>
-</tr>
-</tbody>
-</table>
-<br /></div>
-<!-- class="inftblruleinformal" --></li>
-</ol>
-<p>Eclipse adds the following annotations the entity field:</p>
-<pre xml:space="preserve" class="oac_no_warn">
-@Inheritance(strategy=InheritanceType.<span class="italic">&lt;INHERITANCE_STRATEGY&gt;</span>)
-@DiscriminatorColumn(name="<span class="italic">&lt;DISCRIMINATOR_COLUMN&gt;</span>",
- discriminatorType=<span class="italic">&lt;DISCRIMINATOR_TYPE&gt;</span>)
-@DiscriminatorValue(value-"<span class="italic">&lt;DISCRIMINATOR_VALUE&gt;</span>")
-@PrimaryKeyJoinColumn(name="<span class="italic">&lt;JOIN_COLUMN_NAME&gt;</span>",
- referencedColumnName = "<span class="italic">&lt;REFERENCED_COLUMN_NAME&gt;</span>")
-
-</pre>
-<p><a id="sthref99" name="sthref99"></a><a id="sthref100" name="sthref100"></a><a id="sthref101" name="sthref101"></a>The following figures illustrates the different inheritance strategies.</p>
-<div class="figure"><a id="sthref102" name="sthref102"></a>
-<p class="titleinfigure">Single Table Inheritance</p>
-<img src="img/inheritance_single.png" alt="This figure illustrates entity inheritance in a single table." title="This figure illustrates entity inheritance in a single table." /><br /></div>
-<!-- class="figure" -->
-<div class="figure"><a id="sthref103" name="sthref103"></a>
-<p class="titleinfigure"><a id="sthref104" name="sthref104"></a><a id="sthref105" name="sthref105"></a>Joined Table Inheritance</p>
-<img src="img/inheritance_join.png" alt="This figure illustrates a joined subclass inheritance strategy." title="This figure illustrates a joined subclass inheritance strategy." /><br /></div>
-<!-- class="figure" -->
-<br />
-<p>&nbsp;</p>
-<img src="img/ngrelt.png" alt="Related task" title="Related task" /><br />
-<br />
-<a href="task_add_persistence.htm#BABHICAI">Adding persistence to a class</a>
-<p>&nbsp;</p>
-<img src="img/ngrelc.png" alt="Related concept" title="Related concept" /><br />
-<br />
-<a href="concept_persistence.htm#BABCAHIC">Understanding Java persistence</a><br /></div>
-<!-- class="sect1" -->
-<!-- Start Footer -->
-<div class="footer">
-<table class="simple oac_no_warn" summary="" cellspacing="0" cellpadding="0" width="100%">
-<col width="86%" />
-<col width="*" />
-<tr>
-<td align="left"><span class="copyrightlogo">Copyright&nbsp;&copy;&nbsp;2006, 2009,&nbsp;Oracle&nbsp;and/or&nbsp;its&nbsp;affiliates.&nbsp;All&nbsp;rights&nbsp;reserved.</span><br />
-<a href="dcommon/html/cpyr.htm"><span class="copyrightlogo">Legal Notices</span></a></td>
-</tr>
-</table>
-</div>
-<!-- class="footer" -->
-</body>
-</html>
diff --git a/jpa/plugins/org.eclipse.jpt.doc.user/task_manage_orm.htm b/jpa/plugins/org.eclipse.jpt.doc.user/task_manage_orm.htm
deleted file mode 100644
index fa5c8de674..0000000000
--- a/jpa/plugins/org.eclipse.jpt.doc.user/task_manage_orm.htm
+++ /dev/null
@@ -1,64 +0,0 @@
-<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN"
- "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
-<html xmlns="http://www.w3.org/1999/xhtml" xml:lang="en" lang="en">
-<head>
-<meta http-equiv="Content-Type" content="text/html; charset=us-ascii" />
-
-<meta http-equiv="Content-Style-Type" content="text/css" />
-<meta http-equiv="Content-Script-Type" content="text/javascript" />
-<title>Managing the orm.xml file</title>
-<meta name="generator" content="Oracle DARB XHTML Converter (Mode = ohj/ohw) - Version 5.1.1 Build 004" />
-<meta name="date" content="2009-05-01T8:12:44Z" />
-<meta name="robots" content="noarchive" />
-<meta name="doctitle" content="Managing the orm.xml file" />
-<meta name="relnum" content="Release 2.2" />
-<meta name="copyright" content="Copyright (c) 2000, 2008 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. Contributors: Oracle - initial API and implementation" />
-<link rel="copyright" href="dcommon/html/cpyr.htm" title="Copyright" type="text/html" />
-<link rel="stylesheet" href="dcommon/css/blafdoc.css" title="Oracle BLAFDoc" type="text/css" />
-<!-- contents -->
-</head>
-<body>
-<p><a id="CIHDGDCD" name="CIHDGDCD"></a></p>
-<div class="sect1"><!-- infolevel="all" infotype="General" -->
-<h1><a id="sthref57" name="sthref57"></a>Managing the orm.xml file</h1>
-<p>When creating a JPA project, (see <a href="task_create_new_project.htm#CIHHEJCJ">"Creating a new JPA project"</a>) you can also create the <code>orm.xml</code> file that defines the mapping metadata and defaults.</p>
-<p><a id="sthref58" name="sthref58"></a>Eclipse creates the <code>META-INF\orm.xml</code> file in your project's directory:</p>
-<pre xml:space="preserve" class="oac_no_warn">
-&lt;?xml version="1.0" encoding="UTF-8"?&gt;
-&lt;persistence version="<span class="italic">&lt;PERSISTENCE_VERSION&gt;</span>"
- xmlns="http://java.sun.com/xml/ns/persistence"
- xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
- xsi:schemaLocation="http://java.sun.com/xml/ns/persistence
- http://java.sun.com/xml/ns/persistence/persistence_1_0.xsd"&gt;
- &lt;persistence-unit name="<span class="italic">&lt;PERSISTENCE_UNIT_NAME&gt;</span>"&gt;
- &lt;provider="<span class="italic">&lt;PERSISTENCE_PROVIDER&gt;</span>" /&gt;
- &lt;/persistence-unit&gt;
-&lt;/persistence&gt;
-</pre>
-<p>&nbsp;</p>
-<img src="img/ngrelr.png" alt="Related reference" title="Related reference" /><br />
-<br />
-<a href="ref_new_jpa_project_wizard.htm#CACBJGBG">Create New JPA Project wizard</a><br />
-<a href="ref_eclipselink_mapping_file.htm#CIAEDEJF">New EclipseLink Mapping File dialog</a>
-<p>&nbsp;</p>
-<img src="img/ngrelt.png" alt="Related task" title="Related task" /><br />
-<br />
-<a href="tasks004.htm#CIHBCDCE">Working with orm.xml file</a><br />
-<p>&nbsp;</p>
-<img src="img/ngrelc.png" alt="Related concept" title="Related concept" /><br />
-<br />
-<a href="concepts003.htm#CHDBIJAC">The orm.xml file</a><br />
-<!-- Start Footer -->
-<div class="footer">
-<table class="simple oac_no_warn" summary="" cellspacing="0" cellpadding="0" width="100%">
-<col width="86%" />
-<col width="*" />
-<tr>
-<td align="left"><span class="copyrightlogo">Copyright&nbsp;&copy;&nbsp;2006, 2009,&nbsp;Oracle&nbsp;and/or&nbsp;its&nbsp;affiliates.&nbsp;All&nbsp;rights&nbsp;reserved.</span><br />
-<a href="dcommon/html/cpyr.htm"><span class="copyrightlogo">Legal Notices</span></a></td>
-</tr>
-</table>
-</div>
-<!-- class="footer" --></div>
-</body>
-</html>
diff --git a/jpa/plugins/org.eclipse.jpt.doc.user/task_manage_persistence.htm b/jpa/plugins/org.eclipse.jpt.doc.user/task_manage_persistence.htm
deleted file mode 100644
index 2427daf920..0000000000
--- a/jpa/plugins/org.eclipse.jpt.doc.user/task_manage_persistence.htm
+++ /dev/null
@@ -1,224 +0,0 @@
-<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN"
- "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
-<html xmlns="http://www.w3.org/1999/xhtml" xml:lang="en" lang="en">
-<head>
-<meta http-equiv="Content-Type" content="text/html; charset=us-ascii" />
-
-<meta http-equiv="Content-Style-Type" content="text/css" />
-<meta http-equiv="Content-Script-Type" content="text/javascript" />
-<title>Managing the persistence.xml file</title>
-<meta name="generator" content="Oracle DARB XHTML Converter (Mode = ohj/ohw) - Version 5.1.1 Build 004" />
-<meta name="date" content="2009-05-01T8:12:43Z" />
-<meta name="robots" content="noarchive" />
-<meta name="doctitle" content="Managing the persistence.xml file" />
-<meta name="relnum" content="Release 2.2" />
-<meta name="copyright" content="Copyright (c) 2000, 2008 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. Contributors: Oracle - initial API and implementation" />
-<link rel="copyright" href="dcommon/html/cpyr.htm" title="Copyright" type="text/html" />
-<link rel="stylesheet" href="dcommon/css/blafdoc.css" title="Oracle BLAFDoc" type="text/css" />
-<!-- contents -->
-</head>
-<body>
-<p><a id="CIHDAJID" name="CIHDAJID"></a></p>
-<div class="sect1"><!-- infolevel="all" infotype="General" -->
-<h1><a id="sthref47" name="sthref47"></a>Managing the persistence.xml file</h1>
-<p><a id="sthref48" name="sthref48"></a>When you create a project, Eclipse creates the <code>META-INF\persistence.xml</code> file in the project's directory.</p>
-<p>You can create a stub <code>persistence.xml</code> file in the META-INF directory when you create a JPA project (see <a href="task_create_new_project.htm#CIHHEJCJ">"Creating a new JPA project"</a>). You can manage this file either through the XML editor (see ) or through the <a href="ref_persistence_xmll_editor.htm#CIACCHID">persistence.xml Editor</a>.</p>
-<div align="center">
-<div class="inftblnote"><br />
-<table class="Note oac_no_warn" summary="" cellpadding="3" cellspacing="0">
-<tbody>
-<tr>
-<td align="left">
-<p class="notep1">Note:</p>
-Depending on your JPA implementation (for example, EclipseLink), the following additional pages may be available in the persistence.xml Editor:
-<ul>
-<li>
-<p><a href="reference019.htm#CIAJAFEG">Customization</a></p>
-<p>Use this page to define change-tracking and session customizer-related properties.</p>
-</li>
-<li>
-<p><a href="reference020.htm#CIABEDCH">Caching</a></p>
-<p>Use this page to define caching properties.</p>
-</li>
-<li>
-<p><a href="reference021.htm#CIABGHHI">Logging</a></p>
-<p>Use this page to define logging properties.</p>
-</li>
-<li>
-<p><a href="reference022.htm#CIAFJCHE">Options</a></p>
-<p>Use this page to define session and target database properties.</p>
-</li>
-<li>
-<p><a href="reference023.htm#CIACCFCB">Schema Generation</a></p>
-<p>Use this page to define DDL-related properties.</p>
-</li>
-</ul>
-<p>For projects using the EclipseLink JPA implementation, the Connections page also includes JDBC connection pool properties.</p>
-<p>If the project uses the Generic platform, then only the <a href="ref_persistence_general.htm#CIACIFGJ">General</a>, <a href="reference018.htm#CIAFFJIE">Connection</a>, <a href="reference024.htm#CIAHJDFF">Properties</a> and <a href="reference025.htm#CIAHCJAH">Source</a> pages are available.</p>
-</td>
-</tr>
-</tbody>
-</table>
-<br /></div>
-<!-- class="inftblnote" --></div>
-<p>To use the <code>persistence.xml</code> Editor:</p>
-<ol>
-<li>
-<p>Open the <code>peristence.xml</code> file. The <a href="ref_persistence_general.htm#CIACIFGJ">General</a> page of the editor appears.</p>
-</li>
-<li>
-<p>Use the <span class="bold">General</span> page to define the <code>persistence.xml</code> files <code>&lt;persistent-unit&gt;</code>-related attributes as well as the <code>&lt;provider&gt;</code>, and <code>&lt;class&gt;</code> elements (described in the following table).</p>
-<div align="center">
-<div class="inftblnotealso"><br />
-<table class="NoteAlso oac_no_warn" summary="" cellpadding="3" cellspacing="0">
-<tbody>
-<tr>
-<td align="left">
-<p class="notep1">Tip:</p>
-The persistence.xml Editor's Source page enables you to view and edit the raw XML file.</td>
-</tr>
-</tbody>
-</table>
-<br /></div>
-<!-- class="inftblnotealso" --></div>
-<div class="inftblinformal">
-<table class="Informal" summary="This table lists the properties of the persistence.xml editor." dir="ltr" border="1" width="100%" frame="hsides" rules="groups" cellpadding="3" cellspacing="0">
-<col width="29%" />
-<col width="29%" />
-<col width="*" />
-<thead>
-<tr align="left" valign="top">
-<th align="left" valign="bottom" id="r1c1-t8">Property</th>
-<th align="left" valign="bottom" id="r1c2-t8">Description</th>
-<th align="left" valign="bottom" id="r1c3-t8">Element Defined</th>
-</tr>
-</thead>
-<tbody>
-<tr align="left" valign="top">
-<td align="left" id="r2c1-t8" headers="r1c1-t8">Name</td>
-<td align="left" headers="r2c1-t8 r1c2-t8">Enter the name of the persistence unit.</td>
-<td align="left" headers="r2c1-t8 r1c3-t8"><code>&lt;persistence-unit name = "&lt;Name&gt;"&gt;</code></td>
-</tr>
-<tr align="left" valign="top">
-<td align="left" id="r3c1-t8" headers="r1c1-t8"><a id="sthref49" name="sthref49"></a>Persistence Provider</td>
-<td align="left" headers="r3c1-t8 r1c2-t8">Enter the name of the persistence provider.</td>
-<td align="left" headers="r3c1-t8 r1c3-t8"><code>&lt;provider&gt;</code></td>
-</tr>
-<tr align="left" valign="top">
-<td align="left" id="r4c1-t8" headers="r1c1-t8">Description</td>
-<td align="left" headers="r4c1-t8 r1c2-t8">Enter a description for this persistence unit. This is an optional property.</td>
-<td align="left" headers="r4c1-t8 r1c3-t8"><code>&lt;description&gt;</code></td>
-</tr>
-<tr align="left" valign="top">
-<td align="left" id="r5c1-t8" headers="r1c1-t8"><a id="sthref50" name="sthref50"></a>Managed Classes</td>
-<td align="left" headers="r5c1-t8 r1c2-t8">Add or remove the classes managed through the persistence unit.</td>
-<td align="left" headers="r5c1-t8 r1c3-t8"><code>&lt;class&gt;</code></td>
-</tr>
-<tr align="left" valign="top">
-<td align="left" id="r6c1-t8" headers="r1c1-t8">&nbsp;&nbsp;Exclude&nbsp;Unlisted&nbsp;Classes</td>
-<td align="left" headers="r6c1-t8 r1c2-t8">Select to include all annotated entity classes in the root of the persistence unit.</td>
-<td align="left" headers="r6c1-t8 r1c3-t8"><code>&lt;exclude-unlisted-classes&gt;</code></td>
-</tr>
-<tr align="left" valign="top">
-<td align="left" id="r7c1-t8" headers="r1c1-t8">XML&nbsp;Mapping&nbsp;Files</td>
-<td align="left" headers="r7c1-t8 r1c2-t8">Add or remove the object/relational mapping XML files define the classes managed through the persistence unit.</td>
-<td align="left" headers="r7c1-t8 r1c3-t8"><code>&lt;mapping-file&gt;</code></td>
-</tr>
-<tr align="left" valign="top">
-<td align="left" id="r8c1-t8" headers="r1c1-t8"><a id="sthref51" name="sthref51"></a>&nbsp;&nbsp;Exclude&nbsp;Unlisted&nbsp;EclipseLink&nbsp;XML&nbsp;Mapping&nbsp;File</td>
-<td align="left" headers="r8c1-t8 r1c2-t8">Select to include all annotated EclipseLink mapping files.
-<p><span class="bold">Note</span>: This field applies only when using EclipseLink JPA implementation</p>
-</td>
-<td align="left" headers="r8c1-t8 r1c3-t8"><code>&lt;property name="eclipselink.exclude-eclipselink-orm" value="true"/&gt;</code></td>
-</tr>
-</tbody>
-</table>
-<br /></div>
-<!-- class="inftblinformal" --></li>
-<li>
-<p>Use the <a href="reference018.htm#CIAFFJIE">Connection</a> page to define the <code>&lt;jta-data-source&gt;</code> and <code>&lt;non-jta-data-source&gt;</code> elements as follows:</p>
-<p>To configure the JTA (Java Transaction API) source used by the persistence provider:</p>
-<ol>
-<li>
-<p>Select <span class="bold">JTA</span> from the Transaction Type list.</p>
-</li>
-<li>
-<p>Enter the global JNDI name of the data source.</p>
-</li>
-</ol>
-<p>To configure a non-JTA data source:</p>
-<ol>
-<li>
-<p>Select <span class="bold">Resource Local</span> from the Transaction Type list.</p>
-</li>
-<li>
-<p>Enter the global JNDI name of the data source.</p>
-<div align="center">
-<div class="inftblnote"><br />
-<table class="Note oac_no_warn" summary="" cellpadding="3" cellspacing="0">
-<tbody>
-<tr>
-<td align="left">
-<p class="notep1">Note:</p>
-Select <span class="bold">Default()</span> to use the data source provided by the container.</td>
-</tr>
-</tbody>
-</table>
-<br /></div>
-<!-- class="inftblnote" --></div>
-</li>
-</ol>
-<p><a id="sthref52" name="sthref52"></a>For projects using the Generic platform, you can also define the EclipseLink connection pool driver, connection pool driver, URL, user name and password.</p>
-</li>
-<li>
-<p>Use the table in the Properties page to set the vendor-specific <code>&lt;properties&gt;</code> element.</p>
-<p>To add <code>&lt;property&gt;</code> elements:</p>
-<ol>
-<li>
-<p>Click <span class="bold">Add</span>.</p>
-</li>
-<li>
-<p>Enter the <code>&lt;name&gt;</code> and <code>&lt;value&gt;</code> attributes for the <code>&lt;property&gt;</code> element using the table's Name and Value fields.</p>
-</li>
-</ol>
-<p>To remove a <code>&lt;property&gt;</code> element, select a defined property in the table and then click <span class="bold">Remove</span>.</p>
-<div align="center">
-<div class="inftblnote"><br />
-<table class="Note oac_no_warn" summary="" cellpadding="3" cellspacing="0">
-<tbody>
-<tr>
-<td align="left">
-<p class="notep1">Note:</p>
-If the project uses the EclipseLink platform, the connection page also includes parameters for JDBC connection pooling.</td>
-</tr>
-</tbody>
-</table>
-<br /></div>
-<!-- class="inftblnote" --></div>
-</li>
-</ol>
-<img src="img/ngrelr.png" alt="Related reference" title="Related reference" /><br />
-<br />
-<a href="ref_persistence_xmll_editor.htm#CIACCHID">persistence.xml Editor</a>
-<p>&nbsp;</p>
-<img src="img/ngrelt.png" alt="Related task" title="Related task" /><br />
-<br />
-<a href="tasks002.htm#CIHFEBAI">Synchronizing classes</a><br />
-<p>&nbsp;</p>
-<img src="img/ngrelc.png" alt="Related concept" title="Related concept" /><br />
-<br />
-<a href="concepts002.htm#CHDHAGIH">The persistence.xml file</a><br />
-<!-- Start Footer -->
-<div class="footer">
-<table class="simple oac_no_warn" summary="" cellspacing="0" cellpadding="0" width="100%">
-<col width="86%" />
-<col width="*" />
-<tr>
-<td align="left"><span class="copyrightlogo">Copyright&nbsp;&copy;&nbsp;2006, 2009,&nbsp;Oracle&nbsp;and/or&nbsp;its&nbsp;affiliates.&nbsp;All&nbsp;rights&nbsp;reserved.</span><br />
-<a href="dcommon/html/cpyr.htm"><span class="copyrightlogo">Legal Notices</span></a></td>
-</tr>
-</table>
-</div>
-<!-- class="footer" --></div>
-</body>
-</html>
diff --git a/jpa/plugins/org.eclipse.jpt.doc.user/task_mapping.htm b/jpa/plugins/org.eclipse.jpt.doc.user/task_mapping.htm
deleted file mode 100644
index 74ae6aeb65..0000000000
--- a/jpa/plugins/org.eclipse.jpt.doc.user/task_mapping.htm
+++ /dev/null
@@ -1,74 +0,0 @@
-<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN"
- "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
-<html xmlns="http://www.w3.org/1999/xhtml" xml:lang="en" lang="en">
-<head>
-<meta http-equiv="Content-Type" content="text/html; charset=us-ascii" />
-
-<meta http-equiv="Content-Style-Type" content="text/css" />
-<meta http-equiv="Content-Script-Type" content="text/javascript" />
-<title>Mapping an entity</title>
-<meta name="generator" content="Oracle DARB XHTML Converter (Mode = ohj/ohw) - Version 5.1.1 Build 004" />
-<meta name="date" content="2009-05-01T8:12:45Z" />
-<meta name="robots" content="noarchive" />
-<meta name="doctitle" content="Mapping an entity" />
-<meta name="relnum" content="Release 2.2" />
-<meta name="copyright" content="Copyright (c) 2000, 2008 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. Contributors: Oracle - initial API and implementation" />
-<link rel="copyright" href="dcommon/html/cpyr.htm" title="Copyright" type="text/html" />
-<link rel="stylesheet" href="dcommon/css/blafdoc.css" title="Oracle BLAFDoc" type="text/css" />
-<!-- contents -->
-</head>
-<body>
-<p><a id="BABDGBIJ" name="BABDGBIJ"></a></p>
-<div class="sect1">
-<h1>Mapping an entity</h1>
-<p>Dali supports the following mapping types for Java persistent entities:</p>
-<ul>
-<li>
-<p><a href="tasks009.htm#BABBABCE">Basic mapping</a></p>
-</li>
-<li>
-<p><a href="tasks010.htm#BABCBHDF">Embedded mapping</a></p>
-</li>
-<li>
-<p><a href="tasks011.htm#CIHDIAEE">Embedded ID mapping</a></p>
-</li>
-<li>
-<p><a href="tasks012.htm#BABGCBHG">ID mapping</a></p>
-</li>
-<li>
-<p><a href="tasks013.htm#BABEIEGD">Many-to-many mapping</a></p>
-</li>
-<li>
-<p><a href="tasks014.htm#BABHFAFJ">Many-to-one mapping</a></p>
-</li>
-<li>
-<p><a href="tasks015.htm#BABHGEBD">One-to-many mapping</a></p>
-</li>
-<li>
-<p><a href="tasks016.htm#BABFHBCJ">One-to-one mapping</a></p>
-</li>
-<li>
-<p><a href="tasks017.htm#BABHFHEI">Transient mapping</a></p>
-</li>
-<li>
-<p><a href="tasks018.htm#BABHIBII">Version mapping</a></p>
-</li>
-</ul>
-<p>Additional mapping types (such as Basic Collection mappings) may be available when using Dali with EclipseLink.</p>
-<p>&nbsp;</p>
-<img src="img/ngrelc.png" alt="Related concept" title="Related concept" /><br />
-<br />
-<a href="concept_mapping.htm#BABBDJFI">Understanding OR mappings</a> <!-- Start Footer -->
-<div class="footer">
-<table class="simple oac_no_warn" summary="" cellspacing="0" cellpadding="0" width="100%">
-<col width="86%" />
-<col width="*" />
-<tr>
-<td align="left"><span class="copyrightlogo">Copyright&nbsp;&copy;&nbsp;2006, 2009,&nbsp;Oracle&nbsp;and/or&nbsp;its&nbsp;affiliates.&nbsp;All&nbsp;rights&nbsp;reserved.</span><br />
-<a href="dcommon/html/cpyr.htm"><span class="copyrightlogo">Legal Notices</span></a></td>
-</tr>
-</table>
-</div>
-<!-- class="footer" --></div>
-</body>
-</html>
diff --git a/jpa/plugins/org.eclipse.jpt.doc.user/tasks.htm b/jpa/plugins/org.eclipse.jpt.doc.user/tasks.htm
deleted file mode 100644
index 372ee65463..0000000000
--- a/jpa/plugins/org.eclipse.jpt.doc.user/tasks.htm
+++ /dev/null
@@ -1,75 +0,0 @@
-<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN"
- "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
-<html xmlns="http://www.w3.org/1999/xhtml" xml:lang="en" lang="en">
-<head>
-<meta http-equiv="Content-Type" content="text/html; charset=us-ascii" />
-
-<meta http-equiv="Content-Style-Type" content="text/css" />
-<meta http-equiv="Content-Script-Type" content="text/javascript" />
-<title>Tasks</title>
-<meta name="generator" content="Oracle DARB XHTML Converter (Mode = ohj/ohw) - Version 5.1.1 Build 004" />
-<meta name="date" content="2009-05-01T8:12:42Z" />
-<meta name="robots" content="noarchive" />
-<meta name="doctitle" content=" Tasks" />
-<meta name="relnum" content="Release 2.2" />
-<meta name="copyright" content="Copyright (c) 2000, 2008 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. Contributors: Oracle - initial API and implementation" />
-<link rel="copyright" href="dcommon/html/cpyr.htm" title="Copyright" type="text/html" />
-<link rel="stylesheet" href="dcommon/css/blafdoc.css" title="Oracle BLAFDoc" type="text/css" />
-<!-- contents -->
-</head>
-<body>
-<p><a id="sthref25" name="sthref25"></a></p>
-<h1>Tasks</h1>
-<p>This section includes detailed step-by-step procedures for accessing the Dali OR mapping tool functionality.</p>
-<ul>
-<li>
-<p><a href="task_create_new_project.htm#CIHHEJCJ">Creating a new JPA project</a></p>
-</li>
-<li>
-<p><a href="tasks001.htm#BEIBADHH">Converting a Java Project to a JPA Project</a></p>
-</li>
-<li>
-<p><a href="task_create_jpa_entity.htm#BABFBJBG">Creating a JPA Entity</a></p>
-</li>
-<li>
-<p><a href="task_manage_persistence.htm#CIHDAJID">Managing the persistence.xml file</a></p>
-</li>
-<li>
-<p><a href="task_manage_orm.htm#CIHDGDCD">Managing the orm.xml file</a></p>
-</li>
-<li>
-<p><a href="task_add_persistence.htm#BABHICAI">Adding persistence to a class</a></p>
-</li>
-<li>
-<p><a href="task_additonal_tables.htm#CIHGBIEI">Specifying additional tables</a></p>
-</li>
-<li>
-<p><a href="task_inheritance.htm#CIHCCCJD">Specifying entity inheritance</a></p>
-</li>
-<li>
-<p><a href="task_mapping.htm#BABDGBIJ">Mapping an entity</a></p>
-</li>
-<li>
-<p><a href="tasks019.htm#BABBAGFI">Generating entities from tables</a></p>
-</li>
-<li>
-<p><a href="tasks021.htm#BABFAIBA">Validating mappings and reporting problems</a></p>
-</li>
-<li>
-<p><a href="tasks024.htm#BABDBCBI">Modifying persistent project properties</a></p>
-</li>
-</ul>
-<!-- Start Footer -->
-<div class="footer">
-<table class="simple oac_no_warn" summary="" cellspacing="0" cellpadding="0" width="100%">
-<col width="86%" />
-<col width="*" />
-<tr>
-<td align="left"><span class="copyrightlogo">Copyright&nbsp;&copy;&nbsp;2006, 2009,&nbsp;Oracle&nbsp;and/or&nbsp;its&nbsp;affiliates.&nbsp;All&nbsp;rights&nbsp;reserved.</span><br />
-<a href="dcommon/html/cpyr.htm"><span class="copyrightlogo">Legal Notices</span></a></td>
-</tr>
-</table>
-</div>
-<!-- class="footer" -->
-</body>
-</html>
diff --git a/jpa/plugins/org.eclipse.jpt.doc.user/tasks001.htm b/jpa/plugins/org.eclipse.jpt.doc.user/tasks001.htm
deleted file mode 100644
index 64a4fc34d6..0000000000
--- a/jpa/plugins/org.eclipse.jpt.doc.user/tasks001.htm
+++ /dev/null
@@ -1,85 +0,0 @@
-<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN"
- "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
-<html xmlns="http://www.w3.org/1999/xhtml" xml:lang="en" lang="en">
-<head>
-<meta http-equiv="Content-Type" content="text/html; charset=us-ascii" />
-
-<meta http-equiv="Content-Style-Type" content="text/css" />
-<meta http-equiv="Content-Script-Type" content="text/javascript" />
-<title>Converting a Java Project to a JPA Project</title>
-<meta name="generator" content="Oracle DARB XHTML Converter (Mode = ohj/ohw) - Version 5.1.1 Build 004" />
-<meta name="date" content="2009-05-01T8:12:42Z" />
-<meta name="robots" content="noarchive" />
-<meta name="doctitle" content="Converting a Java Project to a JPA Project" />
-<meta name="relnum" content="Release 2.2" />
-<meta name="copyright" content="Copyright (c) 2000, 2008 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. Contributors: Oracle - initial API and implementation" />
-<link rel="copyright" href="dcommon/html/cpyr.htm" title="Copyright" type="text/html" />
-<link rel="stylesheet" href="dcommon/css/blafdoc.css" title="Oracle BLAFDoc" type="text/css" />
-<!-- contents -->
-</head>
-<body>
-<p><a id="BEIBADHH" name="BEIBADHH"></a></p>
-<div class="sect1"><!-- infolevel="all" infotype="General" -->
-<h1>Converting a Java Project to a JPA Project</h1>
-<p><a id="sthref35" name="sthref35"></a><a id="sthref36" name="sthref36"></a><a id="sthref37" name="sthref37"></a>Use this procedure to convert an existing Java project to a JPA project.</p>
-<ol>
-<li>
-<p>From the Navigator or Project explorer, right-click the Java project and then select <span class="bold">Configure &gt; Convert to JPA Project.</span> The Project Facets page of the Modify Faceted Project wizard appears.</p>
-<div class="figure"><a id="sthref38" name="sthref38"></a>
-<p class="titleinfigure">Modify Faceted Project Page</p>
-<img src="img/modify_faceted_project.png" alt="" title="" /><br /></div>
-<!-- class="figure" --></li>
-<li>
-<p>Change the <span class="bold">Configuration</span> to <span class="bold">Utility JPA project</span>.</p>
-</li>
-<li>
-<p>Click <span class="bold">Next</span>. <a href="ref_jpa_facet.htm#CACIFDIF">JPA Facet page</a> appears.</p>
-<div class="figure"><a id="sthref39" name="sthref39"></a>
-<p class="titleinfigure">JPA Facet Page</p>
-<img src="img/new_jpa_facet_task.png" alt="" title="" /><br /></div>
-<!-- class="figure" --></li>
-<li>
-<p>Complete the fields on the <a href="ref_jpa_facet.htm#CACIFDIF">JPA Facet page</a> to specify your vender-specific platform, JPA implementation library, and database connection.</p>
-<p>Click <span class="bold">Manage libraries</span> to create or update your JPA user libraries. Click <span class="bold">Download libraries</span> to obtain additional JPA implementation libraries.</p>
-<p>If Dali derives the incorrect schema, select <span class="bold">Override the Default Schema for Connection</span>. Using this option, you can select a development time schema for defaults and validation.</p>
-<p>If you clear the <span class="bold">Create orm.xml</span> option (which is selected by default), you can later add a mapping file to the project using the <a href="reference002.htm#CIAIJCCE">Mapping File Wizard</a>.</p>
-</li>
-<li>
-<p>Click <span class="bold">Finish</span>.</p>
-</li>
-</ol>
-<p>The Dali OR Mapping Tool adds the JPA implementation libraries to your project and creates the necessary <code>orm.xml</code> and <code>perisistence.xml</code> files.</p>
-<p>&nbsp;</p>
-<img src="img/ngrelr.png" alt="Related reference" title="Related reference" /><br />
-<br />
-<a href="ref_new_jpa_project_wizard.htm#CACBJGBG">Create New JPA Project wizard</a><br />
-<a href="ref_persistence_perspective.htm#BABIFBDB">JPA Development perspective</a><br />
-<a href="reference002.htm#CIAIJCCE">Mapping File Wizard</a>
-<p>&nbsp;</p>
-<img src="img/ngrelt.png" alt="Related tasks" title="Related tasks" /><br />
-<br />
-<a href="task_manage_persistence.htm#CIHDAJID">Managing the persistence.xml file</a><br />
-<a href="task_add_persistence.htm#BABHICAI">Adding persistence to a class</a><br />
-<a href="task_create_new_project.htm#CIHHEJCJ">Creating a new JPA project</a>
-<p>&nbsp;</p>
-<img src="img/ngrelc.png" alt="Related concept" title="Related concept" /><br />
-<br />
-<a href="concept_persistence.htm#BABCAHIC">Understanding Java persistence</a><br />
-<a href="concepts002.htm#CHDHAGIH">The persistence.xml file</a>
-<p>&nbsp;</p>
-</div>
-<!-- class="sect1" -->
-<!-- Start Footer -->
-<div class="footer">
-<table class="simple oac_no_warn" summary="" cellspacing="0" cellpadding="0" width="100%">
-<col width="86%" />
-<col width="*" />
-<tr>
-<td align="left"><span class="copyrightlogo">Copyright&nbsp;&copy;&nbsp;2006, 2009,&nbsp;Oracle&nbsp;and/or&nbsp;its&nbsp;affiliates.&nbsp;All&nbsp;rights&nbsp;reserved.</span><br />
-<a href="dcommon/html/cpyr.htm"><span class="copyrightlogo">Legal Notices</span></a></td>
-</tr>
-</table>
-</div>
-<!-- class="footer" -->
-</body>
-</html>
diff --git a/jpa/plugins/org.eclipse.jpt.doc.user/tasks002.htm b/jpa/plugins/org.eclipse.jpt.doc.user/tasks002.htm
deleted file mode 100644
index 78621933ba..0000000000
--- a/jpa/plugins/org.eclipse.jpt.doc.user/tasks002.htm
+++ /dev/null
@@ -1,75 +0,0 @@
-<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN"
- "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
-<html xmlns="http://www.w3.org/1999/xhtml" xml:lang="en" lang="en">
-<head>
-<meta http-equiv="Content-Type" content="text/html; charset=us-ascii" />
-
-<meta http-equiv="Content-Style-Type" content="text/css" />
-<meta http-equiv="Content-Script-Type" content="text/javascript" />
-<title>Synchronizing classes</title>
-<meta name="generator" content="Oracle DARB XHTML Converter (Mode = ohj/ohw) - Version 5.1.1 Build 004" />
-<meta name="date" content="2009-05-01T8:12:44Z" />
-<meta name="robots" content="noarchive" />
-<meta name="doctitle" content="Synchronizing classes" />
-<meta name="relnum" content="Release 2.2" />
-<meta name="copyright" content="Copyright (c) 2000, 2008 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. Contributors: Oracle - initial API and implementation" />
-<link rel="copyright" href="dcommon/html/cpyr.htm" title="Copyright" type="text/html" />
-<link rel="stylesheet" href="dcommon/css/blafdoc.css" title="Oracle BLAFDoc" type="text/css" />
-<!-- contents -->
-</head>
-<body>
-<p><a id="CIHFEBAI" name="CIHFEBAI"></a></p>
-<div class="sect2"><!-- infolevel="all" infotype="General" -->
-<h1>Synchronizing classes</h1>
-<p>As you work with the classes in your Java project, you will need to update the <code>persistence.xml</code> file to reflect the changes. <a id="sthref53" name="sthref53"></a><a id="sthref54" name="sthref54"></a><a id="sthref55" name="sthref55"></a></p>
-<p>Use this procedure to synchronize the <code>persistence.xml</code> file:</p>
-<ol>
-<li>
-<p>Right-click the <code>persistence.xml</code> file in the <span class="gui-object-title">Project Explorer</span> and select <span class="gui-object-action">Synchronize Classes</span>.</p>
-<div align="center">
-<div class="inftblnote"><br />
-<table class="Note oac_no_warn" summary="" cellpadding="3" cellspacing="0">
-<tbody>
-<tr>
-<td align="left">
-<p class="notep1">Note:</p>
-Use this function if you selected <span class="bold">Annotated classes must be listed in the persistence.xml option</span> in the <a href="ref_jpa_facet.htm#CACIFDIF">JPA Facet page</a>. In general, you do not have to use this function within the container.</td>
-</tr>
-</tbody>
-</table>
-<br /></div>
-<!-- class="inftblnote" --></div>
-<div class="figure"><a id="sthref56" name="sthref56"></a>
-<p class="titleinfigure">Synchronizing the persistence.xml File</p>
-<img src="img/synchornize_classes.png" alt="This figure shows the JPA Tools &gt; Synchronize Classes option." title="This figure shows the JPA Tools &gt; Synchronize Classes option." /><br /></div>
-<!-- class="figure" -->
-<p>Dali adds the necessary <code>&lt;class&gt;</code> elements to the <code>persistence.xml</code> file.</p>
-</li>
-<li>
-<p>Use the <span class="gui-object-title">Persistence XML Editor</span> to continue editing the <code>persistence.xml</code> file.</p>
-</li>
-</ol>
-<img src="img/ngrelt.png" alt="Related task" title="Related task" /><br />
-<br />
-<a href="task_manage_persistence.htm#CIHDAJID">Managing the persistence.xml file</a>
-<p>&nbsp;</p>
-<img src="img/ngrelc.png" alt="Related concept" title="Related concept" /><br />
-<br />
-<a href="concepts002.htm#CHDHAGIH">The persistence.xml file</a><br />
-<br /></div>
-<!-- class="sect2" -->
-<!-- class="sect1" -->
-<!-- Start Footer -->
-<div class="footer">
-<table class="simple oac_no_warn" summary="" cellspacing="0" cellpadding="0" width="100%">
-<col width="86%" />
-<col width="*" />
-<tr>
-<td align="left"><span class="copyrightlogo">Copyright&nbsp;&copy;&nbsp;2006, 2009,&nbsp;Oracle&nbsp;and/or&nbsp;its&nbsp;affiliates.&nbsp;All&nbsp;rights&nbsp;reserved.</span><br />
-<a href="dcommon/html/cpyr.htm"><span class="copyrightlogo">Legal Notices</span></a></td>
-</tr>
-</table>
-</div>
-<!-- class="footer" -->
-</body>
-</html>
diff --git a/jpa/plugins/org.eclipse.jpt.doc.user/tasks003.htm b/jpa/plugins/org.eclipse.jpt.doc.user/tasks003.htm
deleted file mode 100644
index e849d070be..0000000000
--- a/jpa/plugins/org.eclipse.jpt.doc.user/tasks003.htm
+++ /dev/null
@@ -1,58 +0,0 @@
-<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN"
- "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
-<html xmlns="http://www.w3.org/1999/xhtml" xml:lang="en" lang="en">
-<head>
-<meta http-equiv="Content-Type" content="text/html; charset=us-ascii" />
-
-<meta http-equiv="Content-Style-Type" content="text/css" />
-<meta http-equiv="Content-Script-Type" content="text/javascript" />
-<title>Creating an orm.xml file</title>
-<meta name="generator" content="Oracle DARB XHTML Converter (Mode = ohj/ohw) - Version 5.1.1 Build 004" />
-<meta name="date" content="2009-05-01T8:12:44Z" />
-<meta name="robots" content="noarchive" />
-<meta name="doctitle" content="Creating an orm.xml file" />
-<meta name="relnum" content="Release 2.2" />
-<meta name="copyright" content="Copyright (c) 2000, 2008 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. Contributors: Oracle - initial API and implementation" />
-<link rel="copyright" href="dcommon/html/cpyr.htm" title="Copyright" type="text/html" />
-<link rel="stylesheet" href="dcommon/css/blafdoc.css" title="Oracle BLAFDoc" type="text/css" />
-<!-- contents -->
-</head>
-<body>
-<div class="sect2"><!-- infolevel="all" infotype="General" --><a id="sthref59" name="sthref59"></a>
-<h1>Creating an orm.xml file</h1>
-<p><a id="sthref60" name="sthref60"></a>If you opt not to create an <code>orm.xml</code> file when you create a JPA project, you can create one using the <a href="reference002.htm#CIAIJCCE">Mapping File Wizard</a>.</p>
-<p>Use this procedure to create an <code>orm.xml</code> file:</p>
-<ol>
-<li>
-<p>From the Navigator or Project Explorer, select <span class="bold">File &gt; New &gt; Other</span>. The Select a Wizard dialog appears.</p>
-<div class="figure"><a id="sthref61" name="sthref61"></a>
-<p class="titleinfigure">The Select a Wizard Dialog</p>
-<img src="img/select_a_wizard_mapping.png" alt="The Select a Wizard dialog with Mapping file selected." title="The Select a Wizard dialog with Mapping file selected." /><br /></div>
-<!-- class="figure" --></li>
-<li>
-<p>Select <span class="bold">Mapping File</span> and then click <span class="bold">Next</span>. The Mapping File page appears.</p>
-<p>If you are using EclipseLink, you can select <span class="bold">EclipseLink &gt; EclipseLink Mapping File</span>.</p>
-<div class="figure"><a id="sthref62" name="sthref62"></a>
-<p class="titleinfigure">The Mapping File Page</p>
-<img src="img/mapping_file_new.png" alt="The Mapping File page." title="The Mapping File page." /><br /></div>
-<!-- class="figure" --></li>
-<li>
-<p>Define the properties in the page and click <span class="bold">Finish</span>. The <code>orm.xml</code> file appears in the src directory of the selected JPA project. You can manage the orm.xml file using the JPA Details view or through the XML Editor. See also <a href="ref_details_orm.htm#CACGDGHC">JPA Details view (for orm.xml)</a>.</p>
-</li>
-</ol>
-</div>
-<!-- class="sect2" -->
-<!-- Start Footer -->
-<div class="footer">
-<table class="simple oac_no_warn" summary="" cellspacing="0" cellpadding="0" width="100%">
-<col width="86%" />
-<col width="*" />
-<tr>
-<td align="left"><span class="copyrightlogo">Copyright&nbsp;&copy;&nbsp;2006, 2009,&nbsp;Oracle&nbsp;and/or&nbsp;its&nbsp;affiliates.&nbsp;All&nbsp;rights&nbsp;reserved.</span><br />
-<a href="dcommon/html/cpyr.htm"><span class="copyrightlogo">Legal Notices</span></a></td>
-</tr>
-</table>
-</div>
-<!-- class="footer" -->
-</body>
-</html>
diff --git a/jpa/plugins/org.eclipse.jpt.doc.user/tasks004.htm b/jpa/plugins/org.eclipse.jpt.doc.user/tasks004.htm
deleted file mode 100644
index f28cb3e552..0000000000
--- a/jpa/plugins/org.eclipse.jpt.doc.user/tasks004.htm
+++ /dev/null
@@ -1,66 +0,0 @@
-<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN"
- "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
-<html xmlns="http://www.w3.org/1999/xhtml" xml:lang="en" lang="en">
-<head>
-<meta http-equiv="Content-Type" content="text/html; charset=us-ascii" />
-
-<meta http-equiv="Content-Style-Type" content="text/css" />
-<meta http-equiv="Content-Script-Type" content="text/javascript" />
-<title>Working with orm.xml file</title>
-<meta name="generator" content="Oracle DARB XHTML Converter (Mode = ohj/ohw) - Version 5.1.1 Build 004" />
-<meta name="date" content="2009-05-01T8:12:44Z" />
-<meta name="robots" content="noarchive" />
-<meta name="doctitle" content="Working with orm.xml file" />
-<meta name="relnum" content="Release 2.2" />
-<meta name="copyright" content="Copyright (c) 2000, 2008 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. Contributors: Oracle - initial API and implementation" />
-<link rel="copyright" href="dcommon/html/cpyr.htm" title="Copyright" type="text/html" />
-<link rel="stylesheet" href="dcommon/css/blafdoc.css" title="Oracle BLAFDoc" type="text/css" />
-<!-- contents -->
-</head>
-<body>
-<p><a id="CIHBCDCE" name="CIHBCDCE"></a></p>
-<div class="sect2"><!-- infolevel="all" infotype="General" -->
-<h1>Working with orm.xml file</h1>
-<p><a id="sthref63" name="sthref63"></a><a id="sthref64" name="sthref64"></a>You can work with the <code>orm.xml</code> by using the JPA Details view.</p>
-<p>Use this procedure to work with the <code>orm.xml</code> file:</p>
-<ol>
-<li>
-<p>Right-click the <code>orm.xml</code> file in the <span class="gui-object-title">Project Explorer</span> and select <span class="gui-object-action">Open</span>.</p>
-</li>
-<li>
-<p>In the JPA Structure view, select <span class="bold">EntityMappings</span>.</p>
-</li>
-<li>
-<p>Use the JPA Details view to configure the entity mapping and persistence unit defaults.</p>
-<div class="figure"><a id="sthref65" name="sthref65"></a>
-<p class="titleinfigure">JPA Details view for EntityMappings (orm.xml)</p>
-<img src="img/details_entitymappings.png" alt="JPA Details view for orm.xml file." title="JPA Details view for orm.xml file." /><br /></div>
-<!-- class="figure" --></li>
-</ol>
-<img src="img/ngrelr.png" alt="Related task" title="Related task" /><br />
-<br />
-<a href="ref_details_orm.htm#CACGDGHC">JPA Details view (for orm.xml)</a><br />
-<img src="img/ngrelt.png" alt="Related task" title="Related task" /><br />
-<br />
-<a href="#CIHBCDCE">Working with orm.xml file</a><br />
-<a href="../org.eclipse.wst.xmleditor.doc.user/topics/cworkXML.html">Working with XML Files</a><br />
-<p>&nbsp;</p>
-<img src="img/ngrelc.png" alt="Related concept" title="Related concept" /><br />
-<br />
-<a href="concepts003.htm#CHDBIJAC">The orm.xml file</a><br /></div>
-<!-- class="sect2" -->
-<!-- class="sect1" -->
-<!-- Start Footer -->
-<div class="footer">
-<table class="simple oac_no_warn" summary="" cellspacing="0" cellpadding="0" width="100%">
-<col width="86%" />
-<col width="*" />
-<tr>
-<td align="left"><span class="copyrightlogo">Copyright&nbsp;&copy;&nbsp;2006, 2009,&nbsp;Oracle&nbsp;and/or&nbsp;its&nbsp;affiliates.&nbsp;All&nbsp;rights&nbsp;reserved.</span><br />
-<a href="dcommon/html/cpyr.htm"><span class="copyrightlogo">Legal Notices</span></a></td>
-</tr>
-</table>
-</div>
-<!-- class="footer" -->
-</body>
-</html>
diff --git a/jpa/plugins/org.eclipse.jpt.doc.user/tasks005.htm b/jpa/plugins/org.eclipse.jpt.doc.user/tasks005.htm
deleted file mode 100644
index 656a284634..0000000000
--- a/jpa/plugins/org.eclipse.jpt.doc.user/tasks005.htm
+++ /dev/null
@@ -1,96 +0,0 @@
-<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN"
- "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
-<html xmlns="http://www.w3.org/1999/xhtml" xml:lang="en" lang="en">
-<head>
-<meta http-equiv="Content-Type" content="text/html; charset=us-ascii" />
-
-<meta http-equiv="Content-Style-Type" content="text/css" />
-<meta http-equiv="Content-Script-Type" content="text/javascript" />
-<title>Entity</title>
-<meta name="generator" content="Oracle DARB XHTML Converter (Mode = ohj/ohw) - Version 5.1.1 Build 004" />
-<meta name="date" content="2009-05-01T8:12:44Z" />
-<meta name="robots" content="noarchive" />
-<meta name="doctitle" content="Entity" />
-<meta name="relnum" content="Release 2.2" />
-<meta name="copyright" content="Copyright (c) 2000, 2008 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. Contributors: Oracle - initial API and implementation" />
-<link rel="copyright" href="dcommon/html/cpyr.htm" title="Copyright" type="text/html" />
-<link rel="stylesheet" href="dcommon/css/blafdoc.css" title="Oracle BLAFDoc" type="text/css" />
-<!-- contents -->
-</head>
-<body>
-<p><a id="BABGBIEE" name="BABGBIEE"></a></p>
-<div class="sect2"><!-- infolevel="all" infotype="General" -->
-<h1>Entity</h1>
-<p><a id="sthref69" name="sthref69"></a><a id="sthref70" name="sthref70"></a><a id="sthref71" name="sthref71"></a><a id="sthref72" name="sthref72"></a>An <span class="bold">Entity</span> is a persistent domain object.</p>
-<p>An entity <span class="italic">can be</span>:</p>
-<ul>
-<li>
-<p>Abstract or concrete classes. Entities may also extend non-entity classes as well as entity classes, and non-entity classes may extend entity classes.</p>
-</li>
-</ul>
-<p>An entity <span class="italic">must have</span>:</p>
-<ul>
-<li>
-<p>A no-arg constructor (public or protected); the entity class may have other constructors as well.</p>
-</li>
-</ul>
-<p><a id="sthref73" name="sthref73"></a><a id="sthref74" name="sthref74"></a><a id="sthref75" name="sthref75"></a>Each persistent entity must be mapped to a database table and contain a primary key. Persistent entities are identified by the <code>@Entity</code> annotation.</p>
-<p>Use this procedure to add persistence to an existing entity:</p>
-<ol>
-<li>
-<p>Open the Java class in the <span class="gui-object-title">Project Explorer.</span></p>
-</li>
-<li>
-<p>Select the class in the JPA Structure view.</p>
-</li>
-<li>
-<p>In the JPA Details view, click the mapping type hyperlink to access the Mapping Type Selection dialog. In the following figure, clicking <span class="italic">entity</span> invokes the dialog from the JPA Details View.</p>
-<div class="figure"><a id="sthref76" name="sthref76"></a>
-<p class="titleinfigure">The Mapping Type Hyperlink</p>
-<img src="img/mapped_entity_type_link.png" alt="The JPA Details view for an entity showing the mapping type hyperlink." title="The JPA Details view for an entity showing the mapping type hyperlink." /><br /></div>
-<!-- class="figure" -->
-<div align="center">
-<div class="inftblnotealso"><br />
-<table class="NoteAlso oac_no_warn" summary="" cellpadding="3" cellspacing="0">
-<tbody>
-<tr>
-<td align="left">
-<p class="notep1">Tip:</p>
-You can also change (or add) persistence for an entity by right-clicking the class in the JPA Structure View and then clicking <span class="bold">Map As &gt; Entity</span>.</td>
-</tr>
-</tbody>
-</table>
-<br /></div>
-<!-- class="inftblnotealso" --></div>
-</li>
-<li>
-<p>Select <span class="bold">Entity</span> from the Mapping Type Selection dialog and then click <span class="bold">OK</span>.</p>
-<div class="figure"><a id="sthref77" name="sthref77"></a>
-<p class="titleinfigure">The Mapping Type Selection Dialog</p>
-<img src="img/mapping_type_selection_entity.png" alt="The Mapping Type selection dialog with Enity selected." title="The Mapping Type selection dialog with Enity selected." /><br /></div>
-<!-- class="figure" --></li>
-<li>
-<p>Complete the remaining <a href="ref_persistence_prop_view.htm#BABFAEBB">JPA Details view (for entities)</a>.</p>
-</li>
-</ol>
-<p>&nbsp;</p>
-<img src="img/ngrelt.png" alt="Related tasks" title="Related tasks" /><br />
-<br />
-<a href="task_add_persistence.htm#BABHICAI">Adding persistence to a class</a><br />
-<a href="task_additonal_tables.htm#CIHGBIEI">Specifying additional tables</a><br />
-<a href="task_inheritance.htm#CIHCCCJD">Specifying entity inheritance</a><br /></div>
-<!-- class="sect2" -->
-<!-- Start Footer -->
-<div class="footer">
-<table class="simple oac_no_warn" summary="" cellspacing="0" cellpadding="0" width="100%">
-<col width="86%" />
-<col width="*" />
-<tr>
-<td align="left"><span class="copyrightlogo">Copyright&nbsp;&copy;&nbsp;2006, 2009,&nbsp;Oracle&nbsp;and/or&nbsp;its&nbsp;affiliates.&nbsp;All&nbsp;rights&nbsp;reserved.</span><br />
-<a href="dcommon/html/cpyr.htm"><span class="copyrightlogo">Legal Notices</span></a></td>
-</tr>
-</table>
-</div>
-<!-- class="footer" -->
-</body>
-</html>
diff --git a/jpa/plugins/org.eclipse.jpt.doc.user/tasks006.htm b/jpa/plugins/org.eclipse.jpt.doc.user/tasks006.htm
deleted file mode 100644
index 852f9131ea..0000000000
--- a/jpa/plugins/org.eclipse.jpt.doc.user/tasks006.htm
+++ /dev/null
@@ -1,70 +0,0 @@
-<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN"
- "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
-<html xmlns="http://www.w3.org/1999/xhtml" xml:lang="en" lang="en">
-<head>
-<meta http-equiv="Content-Type" content="text/html; charset=us-ascii" />
-
-<meta http-equiv="Content-Style-Type" content="text/css" />
-<meta http-equiv="Content-Script-Type" content="text/javascript" />
-<title>Embeddable</title>
-<meta name="generator" content="Oracle DARB XHTML Converter (Mode = ohj/ohw) - Version 5.1.1 Build 004" />
-<meta name="date" content="2009-05-01T8:12:45Z" />
-<meta name="robots" content="noarchive" />
-<meta name="doctitle" content="Embeddable" />
-<meta name="relnum" content="Release 2.2" />
-<meta name="copyright" content="Copyright (c) 2000, 2008 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. Contributors: Oracle - initial API and implementation" />
-<link rel="copyright" href="dcommon/html/cpyr.htm" title="Copyright" type="text/html" />
-<link rel="stylesheet" href="dcommon/css/blafdoc.css" title="Oracle BLAFDoc" type="text/css" />
-<!-- contents -->
-</head>
-<body>
-<p><a id="BABFEICE" name="BABFEICE"></a></p>
-<div class="sect2"><!-- infolevel="all" infotype="General" -->
-<h1>Embeddable</h1>
-<p><a id="sthref78" name="sthref78"></a><a id="sthref79" name="sthref79"></a>An <span class="bold">Embedded</span> class is a class whose instances are stored as part of an owning entity; it shares the identity of the owning entity. Each field of the embedded class is mapped to the database table associated with the owning entity.</p>
-<p>To override the mapping information for a specific subclass, use the <code>@AttributeOverride</code> annotation for that specific class.</p>
-<p><a id="sthref80" name="sthref80"></a><a id="sthref81" name="sthref81"></a><a id="sthref82" name="sthref82"></a>An embeddable entity is identified by the <code>@Embeddable</code> annotation.</p>
-<p>Use this procedure to add embeddable persistence to an existing entity:</p>
-<ol>
-<li>
-<p>Open the Java class in the <span class="gui-object-title">Project Explorer</span>.</p>
-</li>
-<li>
-<p>Select the class in the JPA Structure view.</p>
-</li>
-<li>
-<p>Click the mapping type hyperlink to open the Mapping Type Selection dialog.</p>
-</li>
-<li>
-<p>Select <span class="bold">Embeddable</span> and then click <span class="bold">OK</span>.</p>
-<div class="figure"><a id="sthref83" name="sthref83"></a>
-<p class="titleinfigure">Mapping Type Selection Dialog (Embeddable)</p>
-<img src="img/mapping_type_selection_embed.png" alt="The Mapping Type Selection dialog with Embeddable selected." title="The Mapping Type Selection dialog with Embeddable selected." /><br /></div>
-<!-- class="figure" --></li>
-<li>
-<p>Complete the remaining <a href="ref_persistence_prop_view.htm#BABFAEBB">JPA Details view (for entities)</a>.</p>
-</li>
-</ol>
-<p>&nbsp;</p>
-<img src="img/ngrelt.png" alt="Related tasks" title="Related tasks" /><br />
-<dl>
-<dd><a href="task_add_persistence.htm#BABHICAI">Adding persistence to a class</a></dd>
-<dd><a href="task_additonal_tables.htm#CIHGBIEI">Specifying additional tables</a></dd>
-<dd><a href="task_inheritance.htm#CIHCCCJD">Specifying entity inheritance</a></dd>
-</dl>
-</div>
-<!-- class="sect2" -->
-<!-- Start Footer -->
-<div class="footer">
-<table class="simple oac_no_warn" summary="" cellspacing="0" cellpadding="0" width="100%">
-<col width="86%" />
-<col width="*" />
-<tr>
-<td align="left"><span class="copyrightlogo">Copyright&nbsp;&copy;&nbsp;2006, 2009,&nbsp;Oracle&nbsp;and/or&nbsp;its&nbsp;affiliates.&nbsp;All&nbsp;rights&nbsp;reserved.</span><br />
-<a href="dcommon/html/cpyr.htm"><span class="copyrightlogo">Legal Notices</span></a></td>
-</tr>
-</table>
-</div>
-<!-- class="footer" -->
-</body>
-</html>
diff --git a/jpa/plugins/org.eclipse.jpt.doc.user/tasks007.htm b/jpa/plugins/org.eclipse.jpt.doc.user/tasks007.htm
deleted file mode 100644
index c5d6d2c309..0000000000
--- a/jpa/plugins/org.eclipse.jpt.doc.user/tasks007.htm
+++ /dev/null
@@ -1,84 +0,0 @@
-<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN"
- "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
-<html xmlns="http://www.w3.org/1999/xhtml" xml:lang="en" lang="en">
-<head>
-<meta http-equiv="Content-Type" content="text/html; charset=us-ascii" />
-
-<meta http-equiv="Content-Style-Type" content="text/css" />
-<meta http-equiv="Content-Script-Type" content="text/javascript" />
-<title>Mapped superclass</title>
-<meta name="generator" content="Oracle DARB XHTML Converter (Mode = ohj/ohw) - Version 5.1.1 Build 004" />
-<meta name="date" content="2009-05-01T8:12:45Z" />
-<meta name="robots" content="noarchive" />
-<meta name="doctitle" content="Mapped superclass" />
-<meta name="relnum" content="Release 2.2" />
-<meta name="copyright" content="Copyright (c) 2000, 2008 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. Contributors: Oracle - initial API and implementation" />
-<link rel="copyright" href="dcommon/html/cpyr.htm" title="Copyright" type="text/html" />
-<link rel="stylesheet" href="dcommon/css/blafdoc.css" title="Oracle BLAFDoc" type="text/css" />
-<!-- contents -->
-</head>
-<body>
-<p><a id="BABDAGCI" name="BABDAGCI"></a></p>
-<div class="sect2"><!-- infolevel="all" infotype="General" -->
-<h1>Mapped superclass</h1>
-<p><a id="sthref84" name="sthref84"></a><a id="sthref85" name="sthref85"></a>An entity that extends a <span class="bold">Mapped Superclass</span> class inherits the persistent state and mapping information from a superclass. You should use a mapped superclass to define mapping information that is common to multiple entity classes.</p>
-<p>A mapped superclass <span class="italic">can be</span>:</p>
-<ul>
-<li>
-<p>Abstract or concrete classes</p>
-</li>
-</ul>
-<p>A mapped superclass <span class="italic">cannot be</span>:</p>
-<ul>
-<li>
-<p>Be queried or passed as an argument to Entity-Manager or Query operations</p>
-</li>
-<li>
-<p>Be the target of a persistent relationship</p>
-</li>
-</ul>
-<p>A mapped superclass does not have a defined database table. Instead, its mapping information is derived from its superclass. To override the mapping information for a specific subclass, use the <code>@AttributeOverride</code> annotation for that specific class.</p>
-<p><a id="sthref86" name="sthref86"></a><a id="sthref87" name="sthref87"></a><a id="sthref88" name="sthref88"></a><a id="sthref89" name="sthref89"></a>A mapped superclass is identified by the <code>@MappedSuperclass</code> annotation.</p>
-<p>Use this procedure to add Mapped Superclass persistence to an existing entity:</p>
-<ol>
-<li>
-<p>Open the Java class in the <span class="gui-object-title">Project Explorer</span>.</p>
-</li>
-<li>
-<p>Select the class in the JPA Structure view.</p>
-</li>
-<li>
-<p>In the JPA Details view, click the mapping type hyperlink to open the Mapping Type Selection dialog.</p>
-</li>
-<li>
-<p>Select <span class="bold">Mapped Superclass</span> and then <span class="bold">OK</span>.</p>
-<div class="figure"><a id="sthref90" name="sthref90"></a>
-<p class="titleinfigure">Mapping Type Selection Dialog (Mapped Superclass)</p>
-<img src="img/mapping_type_selection_superclass.png" alt="The Mapping Type Selection dialog with Mapped Superclass selected." title="The Mapping Type Selection dialog with Mapped Superclass selected." /><br /></div>
-<!-- class="figure" --></li>
-<li>
-<p>Complete the remaining <a href="ref_persistence_prop_view.htm#BABFAEBB">JPA Details view (for entities)</a>.</p>
-</li>
-</ol>
-<p>&nbsp;</p>
-<img src="img/ngrelt.png" alt="Related tasks" title="Related tasks" /><br />
-<br />
-<a href="task_add_persistence.htm#BABHICAI">Adding persistence to a class</a><br />
-<a href="task_additonal_tables.htm#CIHGBIEI">Specifying additional tables</a><br />
-<a href="task_inheritance.htm#CIHCCCJD">Specifying entity inheritance</a><br /></div>
-<!-- class="sect2" -->
-<!-- class="sect1" -->
-<!-- Start Footer -->
-<div class="footer">
-<table class="simple oac_no_warn" summary="" cellspacing="0" cellpadding="0" width="100%">
-<col width="86%" />
-<col width="*" />
-<tr>
-<td align="left"><span class="copyrightlogo">Copyright&nbsp;&copy;&nbsp;2006, 2009,&nbsp;Oracle&nbsp;and/or&nbsp;its&nbsp;affiliates.&nbsp;All&nbsp;rights&nbsp;reserved.</span><br />
-<a href="dcommon/html/cpyr.htm"><span class="copyrightlogo">Legal Notices</span></a></td>
-</tr>
-</table>
-</div>
-<!-- class="footer" -->
-</body>
-</html>
diff --git a/jpa/plugins/org.eclipse.jpt.doc.user/tasks008.htm b/jpa/plugins/org.eclipse.jpt.doc.user/tasks008.htm
deleted file mode 100644
index 8819d4189a..0000000000
--- a/jpa/plugins/org.eclipse.jpt.doc.user/tasks008.htm
+++ /dev/null
@@ -1,65 +0,0 @@
-<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN"
- "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
-<html xmlns="http://www.w3.org/1999/xhtml" xml:lang="en" lang="en">
-<head>
-<meta http-equiv="Content-Type" content="text/html; charset=us-ascii" />
-
-<meta http-equiv="Content-Style-Type" content="text/css" />
-<meta http-equiv="Content-Script-Type" content="text/javascript" />
-<title>Creating Named Queries</title>
-<meta name="generator" content="Oracle DARB XHTML Converter (Mode = ohj/ohw) - Version 5.1.1 Build 004" />
-<meta name="date" content="2009-05-01T8:12:45Z" />
-<meta name="robots" content="noarchive" />
-<meta name="doctitle" content="Creating Named Queries" />
-<meta name="relnum" content="Release 2.2" />
-<meta name="copyright" content="Copyright (c) 2000, 2008 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. Contributors: Oracle - initial API and implementation" />
-<link rel="copyright" href="dcommon/html/cpyr.htm" title="Copyright" type="text/html" />
-<link rel="stylesheet" href="dcommon/css/blafdoc.css" title="Oracle BLAFDoc" type="text/css" />
-<!-- contents -->
-</head>
-<body>
-<p><a id="BABIGBGG" name="BABIGBGG"></a></p>
-<div class="sect1"><!-- infolevel="all" infotype="General" -->
-<h1>Creating Named Queries</h1>
-<p><a id="sthref106" name="sthref106"></a><a id="sthref107" name="sthref107"></a>Named queries improve application performance because they are prepared once and they (and all of their associated supporting objects) can be efficiently reused thereafter, making them well suited for complex and frequently executed operations. Named queries use the JPA query language for portable execution on any underlying database; named native queries use the SQL language native to the underlying database.</p>
-<p>Use this procedure to add <code>@NamedQuery</code> and <code>@NamedNativeQuery</code> annotations to the entity.</p>
-<p>To create a named query:</p>
-<ol>
-<li>
-<p>Select the entity in the Project Explorer.</p>
-</li>
-<li>
-<p>In the JPA Details view, expand Queries.</p>
-</li>
-<li>
-<p>Click <span class="bold">Add</span> for a named query, or <span class="bold">Add Native</span> for a native query.</p>
-</li>
-<li>
-<p>In the dialog that appears, enter the name of the query in the Name field and then click OK.</p>
-</li>
-<li>
-<p>Enter the query in the Query field.</p>
-</li>
-<li>
-<p><a id="sthref108" name="sthref108"></a><a id="sthref109" name="sthref109"></a><a id="sthref110" name="sthref110"></a><a id="sthref111" name="sthref111"></a>To add a Query hint, click <span class="bold">Add</span>.</p>
-<div class="figure"><a id="sthref112" name="sthref112"></a>
-<p class="titleinfigure">Entering a Named Query</p>
-<img src="img/task_entering_query.png" alt="The Queries section of the JPA Details view." title="The Queries section of the JPA Details view." /><br /></div>
-<!-- class="figure" --></li>
-</ol>
-</div>
-<!-- class="sect1" -->
-<!-- Start Footer -->
-<div class="footer">
-<table class="simple oac_no_warn" summary="" cellspacing="0" cellpadding="0" width="100%">
-<col width="86%" />
-<col width="*" />
-<tr>
-<td align="left"><span class="copyrightlogo">Copyright&nbsp;&copy;&nbsp;2006, 2009,&nbsp;Oracle&nbsp;and/or&nbsp;its&nbsp;affiliates.&nbsp;All&nbsp;rights&nbsp;reserved.</span><br />
-<a href="dcommon/html/cpyr.htm"><span class="copyrightlogo">Legal Notices</span></a></td>
-</tr>
-</table>
-</div>
-<!-- class="footer" -->
-</body>
-</html>
diff --git a/jpa/plugins/org.eclipse.jpt.doc.user/tasks009.htm b/jpa/plugins/org.eclipse.jpt.doc.user/tasks009.htm
deleted file mode 100644
index c23d06dfc5..0000000000
--- a/jpa/plugins/org.eclipse.jpt.doc.user/tasks009.htm
+++ /dev/null
@@ -1,185 +0,0 @@
-<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN"
- "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
-<html xmlns="http://www.w3.org/1999/xhtml" xml:lang="en" lang="en">
-<head>
-<meta http-equiv="Content-Type" content="text/html; charset=us-ascii" />
-
-<meta http-equiv="Content-Style-Type" content="text/css" />
-<meta http-equiv="Content-Script-Type" content="text/javascript" />
-<title>Basic mapping</title>
-<meta name="generator" content="Oracle DARB XHTML Converter (Mode = ohj/ohw) - Version 5.1.1 Build 004" />
-<meta name="date" content="2009-05-01T8:12:45Z" />
-<meta name="robots" content="noarchive" />
-<meta name="doctitle" content="Basic mapping" />
-<meta name="relnum" content="Release 2.2" />
-<meta name="copyright" content="Copyright (c) 2000, 2008 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. Contributors: Oracle - initial API and implementation" />
-<link rel="copyright" href="dcommon/html/cpyr.htm" title="Copyright" type="text/html" />
-<link rel="stylesheet" href="dcommon/css/blafdoc.css" title="Oracle BLAFDoc" type="text/css" />
-<!-- contents -->
-</head>
-<body>
-<p><a id="BABBABCE" name="BABBABCE"></a></p>
-<div class="sect2"><!-- infolevel="all" infotype="General" -->
-<h1>Basic mapping</h1>
-<p><a id="sthref113" name="sthref113"></a><a id="sthref114" name="sthref114"></a><a id="sthref115" name="sthref115"></a><a id="sthref116" name="sthref116"></a>Use a <span class="bold">Basic Mapping</span> to map an attribute directly to a database column. Basic mappings may be used only with the following attribute types:</p>
-<ul>
-<li>
-<p>Java primitive types and wrappers of the primitive types</p>
-</li>
-<li>
-<p><code>java.lang.String, java.math.BigInteger</code></p>
-</li>
-<li>
-<p><code>java.math.BigDecimal</code></p>
-</li>
-<li>
-<p><code>java.util.Date</code></p>
-</li>
-<li>
-<p><code>java.util.Calendar, java.sql.Date</code></p>
-</li>
-<li>
-<p><code>java.sql.Time</code></p>
-</li>
-<li>
-<p><code>java.sql.Timestamp</code></p>
-</li>
-<li>
-<p><code>byte[]</code></p>
-</li>
-<li>
-<p><code>Byte[]</code></p>
-</li>
-<li>
-<p><code>char[]</code></p>
-</li>
-<li>
-<p><code>Character[]</code></p>
-</li>
-<li>
-<p>enums</p>
-</li>
-<li>
-<p>any other type that implements <code>Serializable</code></p>
-</li>
-</ul>
-<p>To create a basic mapping:</p>
-<ol>
-<li>
-<p>In the <a href="ref_persistence_outline.htm#BABEGGFE">JPA Structure view</a>, right-click the field to map. Select <span class="bold">Map As &gt; Basic</span>. The <a href="ref_persistence_map_view.htm#BABIFBAF">JPA Details view (for attributes)</a> displays the properties for the selected field.</p>
-</li>
-<li>
-<p>Use this table to complete the remaining fields on the <span class="gui-object-title">JPA Details</span> view.</p>
-<div class="inftblruleinformal">
-<table class="RuleInformal" title="This table lists the fields in the Persistence Properties view for this mapping." summary="This table lists the fields in the Persistence Properties view for this mapping." dir="ltr" border="1" width="100%" frame="border" rules="all" cellpadding="3" cellspacing="0">
-<col width="19%" />
-<col width="*" />
-<col width="41%" />
-<thead>
-<tr align="left" valign="top">
-<th align="left" valign="bottom" id="r1c1-t14">Property</th>
-<th align="left" valign="bottom" id="r1c2-t14">Description</th>
-<th align="left" valign="bottom" id="r1c3-t14">Default</th>
-</tr>
-</thead>
-<tbody>
-<tr align="left" valign="top">
-<td align="left" id="r2c1-t14" headers="r1c1-t14">Entity Map Hyperlink</td>
-<td align="left" headers="r2c1-t14 r1c2-t14">Defines this mapping as a <span class="bold">Basic Mapping</span>.
-<p>This corresponds to the <code>@Basic</code> annotation.</p>
-</td>
-<td align="left" headers="r2c1-t14 r1c3-t14">Basic</td>
-</tr>
-<tr align="left" valign="top">
-<td align="left" id="r3c1-t14" headers="r1c1-t14">Column</td>
-<td align="left" headers="r3c1-t14 r1c2-t14">The database column mapped to the entity attribute. See <a href="ref_mapping_general.htm#CACGCBHB">"Column"</a> for details.</td>
-<td align="left" headers="r3c1-t14 r1c3-t14">By default, the Column is assumed to be named identically to the attribute and always included in the <code>INSERT</code> and <code>UPDATE</code> statements.</td>
-</tr>
-<tr align="left" valign="top">
-<td align="left" id="r4c1-t14" headers="r1c1-t14">Table</td>
-<td align="left" headers="r4c1-t14 r1c2-t14">Name of the database table.</td>
-<td align="left" headers="r4c1-t14 r1c3-t14"><br /></td>
-</tr>
-<tr align="left" valign="top">
-<td align="left" id="r5c1-t14" headers="r1c1-t14">Fetch</td>
-<td align="left" headers="r5c1-t14 r1c2-t14">Defines how data is loaded from the database. See <a href="ref_mapping_general.htm#CACGGGHB">"Fetch Type"</a> for details.
-<ul>
-<li>
-<p>Eager</p>
-</li>
-<li>
-<p>Lazy</p>
-</li>
-</ul>
-</td>
-<td align="left" headers="r5c1-t14 r1c3-t14">Eager</td>
-</tr>
-<tr align="left" valign="top">
-<td align="left" id="r6c1-t14" headers="r1c1-t14">Optional</td>
-<td align="left" headers="r6c1-t14 r1c2-t14">Specifies if this field is can be null.</td>
-<td align="left" headers="r6c1-t14 r1c3-t14">Yes</td>
-</tr>
-<tr align="left" valign="top">
-<td align="left" id="r7c1-t14" headers="r1c1-t14">Temporal</td>
-<td align="left" headers="r7c1-t14 r1c2-t14">Specifies the type of data. See <a href="ref_mapping_general.htm#CACEAJGD">"Temporal"</a> for details.
-<ul>
-<li>
-<p>Date</p>
-</li>
-<li>
-<p>Time</p>
-</li>
-<li>
-<p>Timestamp</p>
-</li>
-</ul>
-</td>
-<td align="left" headers="r7c1-t14 r1c3-t14"><br /></td>
-</tr>
-<tr align="left" valign="top">
-<td align="left" id="r8c1-t14" headers="r1c1-t14">Lob</td>
-<td align="left" headers="r8c1-t14 r1c2-t14">Specifies if this is a large objects (BLOB or CLOB). See <a href="ref_mapping_general.htm#CACBBIBI">"Lob"</a> for details.</td>
-<td align="left" headers="r8c1-t14 r1c3-t14"><br /></td>
-</tr>
-</tbody>
-</table>
-<br /></div>
-<!-- class="inftblruleinformal" --></li>
-</ol>
-<p>Eclipse adds the following annotations to the field:</p>
-<pre xml:space="preserve" class="oac_no_warn">
-@Column(name="<span class="italic">&lt;COLUMN_NAME&gt;</span>", table="<span class="italic">&lt;COLUMN_TABLE&gt;</span>",
- insertable=<span class="italic">&lt;INSERTABLE&gt;</span>, updatable=<span class="italic">&lt;UPDATABLE&gt;</span>)
-@Basic(fetch=FetchType.<span class="italic">&lt;FETCH_TYPE&gt;</span>, optional = <span class="italic">&lt;OPTIONAL&gt;</span>)
-@Temporal(TemporalType.<span class="italic">&lt;TEMPORAL&gt;</span>)
-
-</pre>
-<p>&nbsp;</p>
-<img src="img/ngrelt.png" alt="Related task" title="Related task" /><br />
-<br />
-<a href="task_mapping.htm#BABDGBIJ">Mapping an entity</a>
-<p>&nbsp;</p>
-<img src="img/ngrelr.png" alt="Related reference" title="Related reference" /><br />
-<br />
-<a href="ref_persistence_outline.htm#BABEGGFE">JPA Structure view</a><br />
-<a href="ref_persistence_map_view.htm#BABIFBAF">JPA Details view (for attributes)</a>
-<p>&nbsp;</p>
-<img src="img/ngrelc.png" alt="Related concept" title="Related concept" /><br />
-<br />
-<a href="concept_mapping.htm#BABBDJFI">Understanding OR mappings</a><br />
-<a href="concepts001.htm#BABBGFJG">Understanding EJB 3.0 Java Persistence API</a></div>
-<!-- class="sect2" -->
-<!-- Start Footer -->
-<div class="footer">
-<table class="simple oac_no_warn" summary="" cellspacing="0" cellpadding="0" width="100%">
-<col width="86%" />
-<col width="*" />
-<tr>
-<td align="left"><span class="copyrightlogo">Copyright&nbsp;&copy;&nbsp;2006, 2009,&nbsp;Oracle&nbsp;and/or&nbsp;its&nbsp;affiliates.&nbsp;All&nbsp;rights&nbsp;reserved.</span><br />
-<a href="dcommon/html/cpyr.htm"><span class="copyrightlogo">Legal Notices</span></a></td>
-</tr>
-</table>
-</div>
-<!-- class="footer" -->
-</body>
-</html>
diff --git a/jpa/plugins/org.eclipse.jpt.doc.user/tasks010.htm b/jpa/plugins/org.eclipse.jpt.doc.user/tasks010.htm
deleted file mode 100644
index 1542e88e04..0000000000
--- a/jpa/plugins/org.eclipse.jpt.doc.user/tasks010.htm
+++ /dev/null
@@ -1,111 +0,0 @@
-<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN"
- "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
-<html xmlns="http://www.w3.org/1999/xhtml" xml:lang="en" lang="en">
-<head>
-<meta http-equiv="Content-Type" content="text/html; charset=us-ascii" />
-
-<meta http-equiv="Content-Style-Type" content="text/css" />
-<meta http-equiv="Content-Script-Type" content="text/javascript" />
-<title>Embedded mapping</title>
-<meta name="generator" content="Oracle DARB XHTML Converter (Mode = ohj/ohw) - Version 5.1.1 Build 004" />
-<meta name="date" content="2009-05-01T8:12:46Z" />
-<meta name="robots" content="noarchive" />
-<meta name="doctitle" content="Embedded mapping" />
-<meta name="relnum" content="Release 2.2" />
-<meta name="copyright" content="Copyright (c) 2000, 2008 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. Contributors: Oracle - initial API and implementation" />
-<link rel="copyright" href="dcommon/html/cpyr.htm" title="Copyright" type="text/html" />
-<link rel="stylesheet" href="dcommon/css/blafdoc.css" title="Oracle BLAFDoc" type="text/css" />
-<!-- contents -->
-</head>
-<body>
-<p><a id="BABCBHDF" name="BABCBHDF"></a></p>
-<div class="sect2"><!-- infolevel="all" infotype="General" -->
-<h1>Embedded mapping</h1>
-<p><a id="sthref117" name="sthref117"></a><a id="sthref118" name="sthref118"></a><a id="sthref119" name="sthref119"></a><a id="sthref120" name="sthref120"></a>Use an <span class="bold">Embedded Mapping</span> to specify a persistent field or property of an entity whose value is an instance of an embeddable class.</p>
-<ol>
-<li>
-<p>In the <a href="ref_persistence_outline.htm#BABEGGFE">JPA Structure view</a>, right-click the field to map.</p>
-</li>
-<li>
-<p>Select <span class="bold">Map as &gt; Embedded</span>. The <a href="ref_persistence_map_view.htm#BABIFBAF">JPA Details view (for attributes)</a> displays the properties for the selected field.</p>
-</li>
-<li>
-<p>Use this table to complete the remaining fields on the <span class="gui-object-title">JPA Details</span> view.</p>
-<div class="inftblruleinformal">
-<table class="RuleInformal" title="This table lists the fields in the Persistence Properties view for this mapping." summary="This table lists the fields in the Persistence Properties view for this mapping." dir="ltr" border="1" width="100%" frame="border" rules="all" cellpadding="3" cellspacing="0">
-<col width="19%" />
-<col width="*" />
-<col width="38%" />
-<thead>
-<tr align="left" valign="top">
-<th align="left" valign="bottom" id="r1c1-t15">Property</th>
-<th align="left" valign="bottom" id="r1c2-t15">Description</th>
-<th align="left" valign="bottom" id="r1c3-t15">Default</th>
-</tr>
-</thead>
-<tbody>
-<tr align="left" valign="top">
-<td align="left" id="r2c1-t15" headers="r1c1-t15">Entity Mapping Hyperlink</td>
-<td align="left" headers="r2c1-t15 r1c2-t15">Defines this mapping as a <span class="bold">Embedded</span>.
-<p>This corresponds to the <code>@Embedded</code> annotation.</p>
-</td>
-<td align="left" headers="r2c1-t15 r1c3-t15">Embedded</td>
-</tr>
-<tr align="left" valign="top">
-<td align="left" id="r3c1-t15" headers="r1c1-t15">Attribute Overrides</td>
-<td align="left" headers="r3c1-t15 r1c2-t15">Specify to override the default mapping of an entity's attribute. Select <span class="bold">Override Default</span>.</td>
-<td align="left" headers="r3c1-t15 r1c3-t15"><br /></td>
-</tr>
-<tr align="left" valign="top">
-<td align="left" id="r4c1-t15" headers="r1c1-t15">Columns</td>
-<td align="left" headers="r4c1-t15 r1c2-t15">The database column (and its table) mapped to the entity attribute. See <a href="ref_mapping_general.htm#CACGCBHB">"Column"</a> for details.
-<ul>
-<li>
-<p>Name &ndash; Name of the database column.</p>
-</li>
-<li>
-<p>Table &ndash; Name of the database table.</p>
-</li>
-</ul>
-</td>
-<td align="left" headers="r4c1-t15 r1c3-t15"><br /></td>
-</tr>
-</tbody>
-</table>
-<br /></div>
-<!-- class="inftblruleinformal" --></li>
-</ol>
-<p>Eclipse adds the following annotations to the field:</p>
-<pre xml:space="preserve" class="oac_no_warn">
-@Embedded
-@AttributeOverride(column=@Column(table="<span class="italic">&lt;COLUMN_TABLE&gt;</span>", name = "<span class="italic">&lt;COLUMN_NAME&gt;</span>"))
-</pre>
-<p>&nbsp;</p>
-<img src="img/ngrelt.png" alt="Related task" title="Related task" /><br />
-<br />
-<a href="task_mapping.htm#BABDGBIJ">Mapping an entity</a>
-<p>&nbsp;</p>
-<img src="img/ngrelr.png" alt="Related reference" title="Related reference" /><br />
-<br />
-<a href="ref_persistence_outline.htm#BABEGGFE">JPA Structure view</a><br />
-<a href="ref_persistence_map_view.htm#BABIFBAF">JPA Details view (for attributes)</a>
-<p>&nbsp;</p>
-<img src="img/ngrelc.png" alt="Related concept" title="Related concept" /><br />
-<br />
-<a href="concept_mapping.htm#BABBDJFI">Understanding OR mappings</a><br />
-<a href="concepts001.htm#BABBGFJG">Understanding EJB 3.0 Java Persistence API</a></div>
-<!-- class="sect2" -->
-<!-- Start Footer -->
-<div class="footer">
-<table class="simple oac_no_warn" summary="" cellspacing="0" cellpadding="0" width="100%">
-<col width="86%" />
-<col width="*" />
-<tr>
-<td align="left"><span class="copyrightlogo">Copyright&nbsp;&copy;&nbsp;2006, 2009,&nbsp;Oracle&nbsp;and/or&nbsp;its&nbsp;affiliates.&nbsp;All&nbsp;rights&nbsp;reserved.</span><br />
-<a href="dcommon/html/cpyr.htm"><span class="copyrightlogo">Legal Notices</span></a></td>
-</tr>
-</table>
-</div>
-<!-- class="footer" -->
-</body>
-</html>
diff --git a/jpa/plugins/org.eclipse.jpt.doc.user/tasks011.htm b/jpa/plugins/org.eclipse.jpt.doc.user/tasks011.htm
deleted file mode 100644
index 9d62eabd60..0000000000
--- a/jpa/plugins/org.eclipse.jpt.doc.user/tasks011.htm
+++ /dev/null
@@ -1,91 +0,0 @@
-<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN"
- "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
-<html xmlns="http://www.w3.org/1999/xhtml" xml:lang="en" lang="en">
-<head>
-<meta http-equiv="Content-Type" content="text/html; charset=us-ascii" />
-
-<meta http-equiv="Content-Style-Type" content="text/css" />
-<meta http-equiv="Content-Script-Type" content="text/javascript" />
-<title>Embedded ID mapping</title>
-<meta name="generator" content="Oracle DARB XHTML Converter (Mode = ohj/ohw) - Version 5.1.1 Build 004" />
-<meta name="date" content="2009-05-01T8:12:46Z" />
-<meta name="robots" content="noarchive" />
-<meta name="doctitle" content="Embedded ID mapping" />
-<meta name="relnum" content="Release 2.2" />
-<meta name="copyright" content="Copyright (c) 2000, 2008 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. Contributors: Oracle - initial API and implementation" />
-<link rel="copyright" href="dcommon/html/cpyr.htm" title="Copyright" type="text/html" />
-<link rel="stylesheet" href="dcommon/css/blafdoc.css" title="Oracle BLAFDoc" type="text/css" />
-<!-- contents -->
-</head>
-<body>
-<p><a id="CIHDIAEE" name="CIHDIAEE"></a></p>
-<div class="sect2"><!-- infolevel="all" infotype="General" -->
-<h1>Embedded ID mapping</h1>
-<p><a id="sthref121" name="sthref121"></a><a id="sthref122" name="sthref122"></a><a id="sthref123" name="sthref123"></a><a id="sthref124" name="sthref124"></a>Use an <span class="bold">Embedded ID Mapping</span> to specify the primary key of an embedded ID. These mappings may be used with a <a href="tasks006.htm#BABFEICE">Embeddable</a> entities.</p>
-<ol>
-<li>
-<p>In the <a href="ref_persistence_outline.htm#BABEGGFE">JPA Structure view</a>, select the field to map.</p>
-</li>
-<li>
-<p>Right-click the field and then select <span class="bold">Map As &gt; Embedded Id</span>. The <a href="ref_persistence_map_view.htm#BABIFBAF">JPA Details view (for attributes)</a> displays the properties for the selected field.</p>
-</li>
-<li>
-<p>Use this table to complete the remaining fields on the <span class="gui-object-title">JPA Details</span> view.</p>
-<div class="inftblruleinformal">
-<table class="RuleInformal" title="This table lists the fields in the Persistence Properties view for this mapping." summary="This table lists the fields in the Persistence Properties view for this mapping." dir="ltr" border="1" width="100%" frame="border" rules="all" cellpadding="3" cellspacing="0">
-<col width="19%" />
-<col width="*" />
-<col width="38%" />
-<thead>
-<tr align="left" valign="top">
-<th align="left" valign="bottom" id="r1c1-t16">Property</th>
-<th align="left" valign="bottom" id="r1c2-t16">Description</th>
-<th align="left" valign="bottom" id="r1c3-t16">Default</th>
-</tr>
-</thead>
-<tbody>
-<tr align="left" valign="top">
-<td align="left" id="r2c1-t16" headers="r1c1-t16">Entity Mapping Hyperlink</td>
-<td align="left" headers="r2c1-t16 r1c2-t16">Defines this mapping as a <span class="bold">Embedded Id</span>.
-<p>This corresponds to the <code>@EmbeddedId</code> annotation.</p>
-</td>
-<td align="left" headers="r2c1-t16 r1c3-t16">Embedded Id</td>
-</tr>
-</tbody>
-</table>
-<br /></div>
-<!-- class="inftblruleinformal" --></li>
-</ol>
-<p>Eclipse adds the following annotations to the field:</p>
-<pre xml:space="preserve" class="oac_no_warn">
-@EmbeddedId
-</pre>
-<p>&nbsp;</p>
-<img src="img/ngrelt.png" alt="Related task" title="Related task" /><br />
-<br />
-<a href="task_mapping.htm#BABDGBIJ">Mapping an entity</a>
-<p>&nbsp;</p>
-<img src="img/ngrelr.png" alt="Related reference" title="Related reference" /><br />
-<br />
-<a href="ref_persistence_outline.htm#BABEGGFE">JPA Structure view</a><br />
-<a href="ref_persistence_map_view.htm#BABIFBAF">JPA Details view (for attributes)</a>
-<p>&nbsp;</p>
-<img src="img/ngrelc.png" alt="Related concept" title="Related concept" /><br />
-<br />
-<a href="concept_mapping.htm#BABBDJFI">Understanding OR mappings</a><br />
-<a href="concepts001.htm#BABBGFJG">Understanding EJB 3.0 Java Persistence API</a></div>
-<!-- class="sect2" -->
-<!-- Start Footer -->
-<div class="footer">
-<table class="simple oac_no_warn" summary="" cellspacing="0" cellpadding="0" width="100%">
-<col width="86%" />
-<col width="*" />
-<tr>
-<td align="left"><span class="copyrightlogo">Copyright&nbsp;&copy;&nbsp;2006, 2009,&nbsp;Oracle&nbsp;and/or&nbsp;its&nbsp;affiliates.&nbsp;All&nbsp;rights&nbsp;reserved.</span><br />
-<a href="dcommon/html/cpyr.htm"><span class="copyrightlogo">Legal Notices</span></a></td>
-</tr>
-</table>
-</div>
-<!-- class="footer" -->
-</body>
-</html>
diff --git a/jpa/plugins/org.eclipse.jpt.doc.user/tasks012.htm b/jpa/plugins/org.eclipse.jpt.doc.user/tasks012.htm
deleted file mode 100644
index 47fcb6f4c6..0000000000
--- a/jpa/plugins/org.eclipse.jpt.doc.user/tasks012.htm
+++ /dev/null
@@ -1,176 +0,0 @@
-<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN"
- "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
-<html xmlns="http://www.w3.org/1999/xhtml" xml:lang="en" lang="en">
-<head>
-<meta http-equiv="Content-Type" content="text/html; charset=us-ascii" />
-
-<meta http-equiv="Content-Style-Type" content="text/css" />
-<meta http-equiv="Content-Script-Type" content="text/javascript" />
-<title>ID mapping</title>
-<meta name="generator" content="Oracle DARB XHTML Converter (Mode = ohj/ohw) - Version 5.1.1 Build 004" />
-<meta name="date" content="2009-05-01T8:12:46Z" />
-<meta name="robots" content="noarchive" />
-<meta name="doctitle" content="ID mapping" />
-<meta name="relnum" content="Release 2.2" />
-<meta name="copyright" content="Copyright (c) 2000, 2008 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. Contributors: Oracle - initial API and implementation" />
-<link rel="copyright" href="dcommon/html/cpyr.htm" title="Copyright" type="text/html" />
-<link rel="stylesheet" href="dcommon/css/blafdoc.css" title="Oracle BLAFDoc" type="text/css" />
-<!-- contents -->
-</head>
-<body>
-<p><a id="BABGCBHG" name="BABGCBHG"></a></p>
-<div class="sect2"><!-- infolevel="all" infotype="General" -->
-<h1>ID mapping</h1>
-<p><a id="sthref125" name="sthref125"></a><a id="sthref126" name="sthref126"></a><a id="sthref127" name="sthref127"></a><a id="sthref128" name="sthref128"></a>Use an <span class="bold">ID Mapping</span> to specify the primary key of an entity. ID mappings may be used with a <a href="tasks005.htm#BABGBIEE">Entity</a> or <a href="tasks007.htm#BABDAGCI">Mapped superclass</a>. Each <a href="tasks005.htm#BABGBIEE">Entity</a> must have an ID mapping.</p>
-<ol>
-<li>
-<p>In the <a href="ref_persistence_outline.htm#BABEGGFE">JPA Structure view</a>, select the field to map.</p>
-</li>
-<li>
-<p>Right click the filed and then select <span class="bold">Map as &gt; ID</span>. The <a href="ref_persistence_map_view.htm#BABIFBAF">JPA Details view (for attributes)</a> displays the properties for the selected.</p>
-</li>
-<li>
-<p>Use this table to complete the <a href="ref_mapping_general.htm#CACBHFIJ">General information</a> fields in the <span class="gui-object-title">JPA Details</span> view.</p>
-<div class="inftblruleinformal">
-<table class="RuleInformal" title="This table lists the fields in the Persistence Properties view for this mapping." summary="This table lists the fields in the Persistence Properties view for this mapping." dir="ltr" border="1" width="100%" frame="border" rules="all" cellpadding="3" cellspacing="0">
-<col width="22%" />
-<col width="*" />
-<col width="35%" />
-<thead>
-<tr align="left" valign="top">
-<th align="left" valign="bottom" id="r1c1-t17">Property</th>
-<th align="left" valign="bottom" id="r1c2-t17">Description</th>
-<th align="left" valign="bottom" id="r1c3-t17">Default</th>
-</tr>
-</thead>
-<tbody>
-<tr align="left" valign="top">
-<td align="left" id="r2c1-t17" headers="r1c1-t17">Entity Mapping Hyperlink</td>
-<td align="left" headers="r2c1-t17 r1c2-t17">Defines this mapping as an <span class="bold">ID Mapping</span>.
-<p>This field corresponds to the <code>@Id</code> annotation.</p>
-</td>
-<td align="left" headers="r2c1-t17 r1c3-t17">ID</td>
-</tr>
-<tr align="left" valign="top">
-<td align="left" id="r3c1-t17" headers="r1c1-t17">Column</td>
-<td align="left" headers="r3c1-t17 r1c2-t17">The database column mapped to the entity attribute. See <a href="ref_mapping_general.htm#CACGCBHB">"Column"</a> for details.</td>
-<td align="left" headers="r3c1-t17 r1c3-t17">By default, the Column is assumed to be named identically to the attribute.</td>
-</tr>
-<tr align="left" valign="top">
-<td align="left" id="r4c1-t17" headers="r1c1-t17">Table</td>
-<td align="left" headers="r4c1-t17 r1c2-t17">The database table mapped to the entity attribute.</td>
-<td align="left" headers="r4c1-t17 r1c3-t17">By default, the Table is assumed to be identical to the table associated with the entity.</td>
-</tr>
-<tr align="left" valign="top">
-<td align="left" id="r5c1-t17" headers="r1c1-t17">Temporal</td>
-<td align="left" headers="r5c1-t17 r1c2-t17">Specifies the type of data. See <a href="ref_mapping_general.htm#CACEAJGD">"Temporal"</a> for details.
-<ul>
-<li>
-<p>Date</p>
-</li>
-<li>
-<p>Time</p>
-</li>
-<li>
-<p>Timestamp</p>
-</li>
-</ul>
-</td>
-<td align="left" headers="r5c1-t17 r1c3-t17"><br /></td>
-</tr>
-</tbody>
-</table>
-<br /></div>
-<!-- class="inftblruleinformal" --></li>
-<li>
-<p>Use this table to complete the fields in <a href="ref_primary_key.htm#CACFCCAB">Primary Key Generation information</a> area in the <span class="gui-object-title">JPA Details</span> view.</p>
-<div class="inftblruleinformal">
-<table class="RuleInformal" title="This table lists the fields in the PK Generation tab." summary="This table lists the fields in the PK Generation tab." dir="ltr" border="1" width="100%" frame="border" rules="all" cellpadding="3" cellspacing="0">
-<col width="22%" />
-<col width="*" />
-<col width="35%" />
-<thead>
-<tr align="left" valign="top">
-<th align="left" valign="bottom" id="r1c1-t18">Property</th>
-<th align="left" valign="bottom" id="r1c2-t18">Description</th>
-<th align="left" valign="bottom" id="r1c3-t18">Default</th>
-</tr>
-</thead>
-<tbody>
-<tr align="left" valign="top">
-<td align="left" id="r2c1-t18" headers="r1c1-t18">Primary Key Generation</td>
-<td align="left" headers="r2c1-t18 r1c2-t18">These fields define how the primary key is generated.</td>
-<td align="left" headers="r2c1-t18 r1c3-t18"><br /></td>
-</tr>
-<tr align="left" valign="top">
-<td align="left" id="r3c1-t18" headers="r1c1-t18">&nbsp;&nbsp;Strategy</td>
-<td align="left" headers="r3c1-t18 r1c2-t18">See <a href="ref_primary_key.htm#CACBAJBC">"Primary Key Generation"</a> for details.
-<ul>
-<li>
-<p>Auto</p>
-</li>
-<li>
-<p>Sequence</p>
-</li>
-<li>
-<p>Identity</p>
-</li>
-<li>
-<p>Table</p>
-</li>
-</ul>
-</td>
-<td align="left" headers="r3c1-t18 r1c3-t18">Auto</td>
-</tr>
-<tr align="left" valign="top">
-<td align="left" id="r4c1-t18" headers="r1c1-t18">&nbsp;&nbsp;Generator&nbsp;Name</td>
-<td align="left" headers="r4c1-t18 r1c2-t18">Name of the primary key generator specified in the <span class="bold">Strategy</span></td>
-<td align="left" headers="r4c1-t18 r1c3-t18"><br /></td>
-</tr>
-</tbody>
-</table>
-<br /></div>
-<!-- class="inftblruleinformal" --></li>
-</ol>
-<p>Additional fields will appear in the <a href="ref_primary_key.htm#CACFCCAB">Primary Key Generation information</a> area, depending on the selected Strategy. See <a href="ref_persistence_map_view.htm#BABIFBAF">"JPA Details view (for attributes)"</a> for additional information.</p>
-<p>Eclipse adds the following annotations to the field:</p>
-<pre xml:space="preserve" class="oac_no_warn">
-@Id
-@Column(name="<span class="italic">&lt;COLUMN_NAME&gt;</span>", table="<span class="italic">&lt;TABLE_NAME&gt;</span>", insertable=<span class="italic">&lt;INSERTABLE&gt;</span>,
- updatable=<span class="italic">&lt;UPDATABLE&gt;</span>)
-@Temporal(<span class="italic">&lt;TEMPORAL&gt;</span>)
-@GeneratedValue(strategy=GeneratorType.<span class="italic">&lt;STRATEGY&gt;</span>, generator="<span class="italic">&lt;GENERATOR_NAME&gt;</span>")@TableGenerator(name="<span class="italic">&lt;TABLE_GENERATOR_NAME&gt;</span>", table = "<span class="italic">&lt;TABLE_GENERATOR_TABLE&gt;</span>",
- pkColumnName = "<span class="italic">&lt;TABLE_GENERATOR_PK&gt;</span>",
- valueColumnName = "<span class="italic">&lt;TABLE_GENERATOR_VALUE_COLUMN&gt;</span>",
- pkColumnValue = "<span class="italic">&lt;TABLE_GENERATOR_PK_COLUMN_VALUE&gt;</span>")@SequenceGenerator(name="<span class="italic">&lt;SEQUENCE_GENERATOR_NAME&gt;</span>",
- sequenceName="<span class="italic">&lt;SEQUENCE_GENERATOR_SEQUENCE&gt;</span>")
-</pre>
-<p>&nbsp;</p>
-<img src="img/ngrelt.png" alt="Related task" title="Related task" /><br />
-<br />
-<a href="task_mapping.htm#BABDGBIJ">Mapping an entity</a>
-<p>&nbsp;</p>
-<img src="img/ngrelr.png" alt="Related reference" title="Related reference" /><br />
-<br />
-<a href="ref_persistence_outline.htm#BABEGGFE">JPA Structure view</a><br />
-<a href="ref_persistence_map_view.htm#BABIFBAF">JPA Details view (for attributes)</a>
-<p>&nbsp;</p>
-<img src="img/ngrelc.png" alt="Related concept" title="Related concept" /><br />
-<br />
-<a href="concept_mapping.htm#BABBDJFI">Understanding OR mappings</a><br />
-<a href="concepts001.htm#BABBGFJG">Understanding EJB 3.0 Java Persistence API</a></div>
-<!-- class="sect2" -->
-<!-- Start Footer -->
-<div class="footer">
-<table class="simple oac_no_warn" summary="" cellspacing="0" cellpadding="0" width="100%">
-<col width="86%" />
-<col width="*" />
-<tr>
-<td align="left"><span class="copyrightlogo">Copyright&nbsp;&copy;&nbsp;2006, 2009,&nbsp;Oracle&nbsp;and/or&nbsp;its&nbsp;affiliates.&nbsp;All&nbsp;rights&nbsp;reserved.</span><br />
-<a href="dcommon/html/cpyr.htm"><span class="copyrightlogo">Legal Notices</span></a></td>
-</tr>
-</table>
-</div>
-<!-- class="footer" -->
-</body>
-</html>
diff --git a/jpa/plugins/org.eclipse.jpt.doc.user/tasks013.htm b/jpa/plugins/org.eclipse.jpt.doc.user/tasks013.htm
deleted file mode 100644
index 8d27772458..0000000000
--- a/jpa/plugins/org.eclipse.jpt.doc.user/tasks013.htm
+++ /dev/null
@@ -1,179 +0,0 @@
-<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN"
- "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
-<html xmlns="http://www.w3.org/1999/xhtml" xml:lang="en" lang="en">
-<head>
-<meta http-equiv="Content-Type" content="text/html; charset=us-ascii" />
-
-<meta http-equiv="Content-Style-Type" content="text/css" />
-<meta http-equiv="Content-Script-Type" content="text/javascript" />
-<title>Many-to-many mapping</title>
-<meta name="generator" content="Oracle DARB XHTML Converter (Mode = ohj/ohw) - Version 5.1.1 Build 004" />
-<meta name="date" content="2009-05-01T8:12:46Z" />
-<meta name="robots" content="noarchive" />
-<meta name="doctitle" content="Many-to-many mapping" />
-<meta name="relnum" content="Release 2.2" />
-<meta name="copyright" content="Copyright (c) 2000, 2008 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. Contributors: Oracle - initial API and implementation" />
-<link rel="copyright" href="dcommon/html/cpyr.htm" title="Copyright" type="text/html" />
-<link rel="stylesheet" href="dcommon/css/blafdoc.css" title="Oracle BLAFDoc" type="text/css" />
-<!-- contents -->
-</head>
-<body>
-<p><a id="BABEIEGD" name="BABEIEGD"></a></p>
-<div class="sect2"><!-- infolevel="all" infotype="General" -->
-<h1>Many-to-many mapping</h1>
-<p><a id="sthref129" name="sthref129"></a><a id="sthref130" name="sthref130"></a><a id="sthref131" name="sthref131"></a><a id="sthref132" name="sthref132"></a>Use a <span class="bold">Many-to-Many Mapping</span> to define a many-valued association with many-to-many multiplicity. A many-to-many mapping has two sides: the <span class="italic">owning side</span> and <span class="italic">non-owning side</span>. You must specify the join table on the owning side. For bidirectional mappings, either side may be the owning side.</p>
-<ol>
-<li>
-<p>In the <a href="ref_persistence_outline.htm#BABEGGFE">JPA Structure view</a>, select the field to map.</p>
-</li>
-<li>
-<p>Right-click the field and then select <span class="bold">Map As &gt; Many-to-Many</span>. The <a href="ref_persistence_map_view.htm#BABIFBAF">JPA Details view (for attributes)</a> displays the properties for the selected field.</p>
-</li>
-<li>
-<p>Use this table to complete the <a href="ref_mapping_general.htm#CACBHFIJ">General information</a> fields of the <span class="gui-object-title">JPA Details</span> view.</p>
-<div class="inftblruleinformal">
-<table class="RuleInformal" title="This table lists the fields in the Persistence Properties view for this mapping." summary="This table lists the fields in the Persistence Properties view for this mapping." dir="ltr" border="1" width="100%" frame="border" rules="all" cellpadding="3" cellspacing="0">
-<col width="19%" />
-<col width="*" />
-<col width="41%" />
-<thead>
-<tr align="left" valign="top">
-<th align="left" valign="bottom" id="r1c1-t19">Property</th>
-<th align="left" valign="bottom" id="r1c2-t19">Description</th>
-<th align="left" valign="bottom" id="r1c3-t19">Default</th>
-</tr>
-</thead>
-<tbody>
-<tr align="left" valign="top">
-<td align="left" id="r2c1-t19" headers="r1c1-t19">Mapping Entity Hyperlink</td>
-<td align="left" headers="r2c1-t19 r1c2-t19">Defines this mapping as a <span class="bold">Many to Many Mapping</span>.
-<p>This field corresponds to the <code>@ManyToMany</code> annotation.</p>
-</td>
-<td align="left" headers="r2c1-t19 r1c3-t19">Many to Many</td>
-</tr>
-<tr align="left" valign="top">
-<td align="left" id="r3c1-t19" headers="r1c1-t19">Target Entity</td>
-<td align="left" headers="r3c1-t19 r1c2-t19">The entity to which this attribute is mapped.</td>
-<td align="left" headers="r3c1-t19 r1c3-t19">null
-<p>You do not need to explicitly specify the target entity, since it can be inferred from the type of object being referenced.</p>
-</td>
-</tr>
-<tr align="left" valign="top">
-<td align="left" id="r4c1-t19" headers="r1c1-t19">Fetch</td>
-<td align="left" headers="r4c1-t19 r1c2-t19">Defines how data is loaded from the database. See <a href="ref_mapping_general.htm#CACGGGHB">"Fetch Type"</a> for details.
-<ul>
-<li>
-<p>Eager</p>
-</li>
-<li>
-<p>Lazy</p>
-</li>
-</ul>
-</td>
-<td align="left" headers="r4c1-t19 r1c3-t19">Lazy</td>
-</tr>
-<tr align="left" valign="top">
-<td align="left" id="r5c1-t19" headers="r1c1-t19">Mapped By</td>
-<td align="left" headers="r5c1-t19 r1c2-t19">The database field that owns the relationship.</td>
-<td align="left" headers="r5c1-t19 r1c3-t19"><br /></td>
-</tr>
-<tr align="left" valign="top">
-<td align="left" id="r6c1-t19" headers="r1c1-t19">Order By</td>
-<td align="left" headers="r6c1-t19 r1c2-t19">Specify the default order for objects returned from a query. See <a href="ref_mapping_general.htm#CACDADIH">"Order By"</a> for details.
-<ul>
-<li>
-<p>No ordering</p>
-</li>
-<li>
-<p>Primary key</p>
-</li>
-<li>
-<p>Custom</p>
-</li>
-</ul>
-</td>
-<td align="left" headers="r6c1-t19 r1c3-t19">No ordering</td>
-</tr>
-</tbody>
-</table>
-<br /></div>
-<!-- class="inftblruleinformal" --></li>
-<li>
-<p>Use this table to complete the fields in the <a href="reference011.htm#CACBAEBC">Join Table Information</a> area in the <span class="gui-object-title">JPA Details</span> view.</p>
-<div class="inftblruleinformal">
-<table class="RuleInformal" title="This table lists the fields in the Join Table tab of the Persistence Properties view for this mapping." summary="This table lists the fields in the Join Table tab of the Persistence Properties view for this mapping." dir="ltr" border="1" width="100%" frame="border" rules="all" cellpadding="3" cellspacing="0">
-<col width="19%" />
-<col width="*" />
-<col width="38%" />
-<thead>
-<tr align="left" valign="top">
-<th align="left" valign="bottom" id="r1c1-t20">Property</th>
-<th align="left" valign="bottom" id="r1c2-t20">Description</th>
-<th align="left" valign="bottom" id="r1c3-t20">Default</th>
-</tr>
-</thead>
-<tbody>
-<tr align="left" valign="top">
-<td align="left" id="r2c1-t20" headers="r1c1-t20">Name</td>
-<td align="left" headers="r2c1-t20 r1c2-t20">Name of the join table that contains the foreign key column.</td>
-<td align="left" headers="r2c1-t20 r1c3-t20">You must specify the join table on the owning side.
-<p>By default, the name is assumed to be the primary tables associated with the entities concatenated with an underscore.</p>
-</td>
-</tr>
-<tr align="left" valign="top">
-<td align="left" id="r3c1-t20" headers="r1c1-t20">Join Columns</td>
-<td align="left" headers="r3c1-t20 r1c2-t20">Select <span class="bold">Override Default</span>, then Add, Edit, or Remove the join columns.</td>
-<td align="left" headers="r3c1-t20 r1c3-t20">By default, the name is assumed to be the primary tables associated with the entities concatenated with an underscore.</td>
-</tr>
-<tr align="left" valign="top">
-<td align="left" id="r4c1-t20" headers="r1c1-t20">Inverse Join Columns</td>
-<td align="left" headers="r4c1-t20 r1c2-t20">Select <span class="bold">Override Default</span>, then Add, Edit, or Remove the join columns.</td>
-<td align="left" headers="r4c1-t20 r1c3-t20">By default, the mapping is assumed to have a single join.</td>
-</tr>
-</tbody>
-</table>
-<br /></div>
-<!-- class="inftblruleinformal" --></li>
-<li>
-<p>To add a new Join or Inverse Join Column, click <span class="gui-object-action">Add</span>.</p>
-<p>To edit an existing Join or Inverse Join Column, select the field to and click <span class="gui-object-action">Edit</span>.</p>
-</li>
-</ol>
-<p>Eclipse adds the following annotations to the field:</p>
-<pre xml:space="preserve" class="oac_no_warn">
-@JoinTable(joinColumns=@JoinColumn(name="<span class="italic">&lt;JOIN_COLUMN&gt;</span>"),
- name = "<span class="italic">&lt;JOIN_TABLE_NAME&gt;</span>")
-@ManyToMany(cascade=CascadeType.<span class="italic">&lt;CASCADE_TYPE&gt;</span>, fetch=FetchType.<span class="italic">&lt;FETCH_TYPE&gt;</span>,
- targetEntity=<span class="italic">&lt;TARGET_ENTITY&gt;</span>, mappedBy = "<span class="italic">&lt;MAPPED_BY&gt;</span>")
-@OrderBy("<span class="italic">&lt;ORDER_BY&gt;</span>")
-
-</pre>
-<p>&nbsp;</p>
-<img src="img/ngrelt.png" alt="Related task" title="Related task" /><br />
-<br />
-<a href="task_mapping.htm#BABDGBIJ">Mapping an entity</a>
-<p>&nbsp;</p>
-<img src="img/ngrelr.png" alt="Related reference" title="Related reference" /><br />
-<br />
-<a href="ref_persistence_outline.htm#BABEGGFE">JPA Structure view</a><br />
-<a href="ref_persistence_map_view.htm#BABIFBAF">JPA Details view (for attributes)</a>
-<p>&nbsp;</p>
-<img src="img/ngrelc.png" alt="Related concept" title="Related concept" /><br />
-<br />
-<a href="concept_mapping.htm#BABBDJFI">Understanding OR mappings</a><br />
-<a href="concepts001.htm#BABBGFJG">Understanding EJB 3.0 Java Persistence API</a></div>
-<!-- class="sect2" -->
-<!-- Start Footer -->
-<div class="footer">
-<table class="simple oac_no_warn" summary="" cellspacing="0" cellpadding="0" width="100%">
-<col width="86%" />
-<col width="*" />
-<tr>
-<td align="left"><span class="copyrightlogo">Copyright&nbsp;&copy;&nbsp;2006, 2009,&nbsp;Oracle&nbsp;and/or&nbsp;its&nbsp;affiliates.&nbsp;All&nbsp;rights&nbsp;reserved.</span><br />
-<a href="dcommon/html/cpyr.htm"><span class="copyrightlogo">Legal Notices</span></a></td>
-</tr>
-</table>
-</div>
-<!-- class="footer" -->
-</body>
-</html>
diff --git a/jpa/plugins/org.eclipse.jpt.doc.user/tasks014.htm b/jpa/plugins/org.eclipse.jpt.doc.user/tasks014.htm
deleted file mode 100644
index 9425bb7bbf..0000000000
--- a/jpa/plugins/org.eclipse.jpt.doc.user/tasks014.htm
+++ /dev/null
@@ -1,167 +0,0 @@
-<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN"
- "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
-<html xmlns="http://www.w3.org/1999/xhtml" xml:lang="en" lang="en">
-<head>
-<meta http-equiv="Content-Type" content="text/html; charset=us-ascii" />
-
-<meta http-equiv="Content-Style-Type" content="text/css" />
-<meta http-equiv="Content-Script-Type" content="text/javascript" />
-<title>Many-to-one mapping</title>
-<meta name="generator" content="Oracle DARB XHTML Converter (Mode = ohj/ohw) - Version 5.1.1 Build 004" />
-<meta name="date" content="2009-05-01T8:12:46Z" />
-<meta name="robots" content="noarchive" />
-<meta name="doctitle" content="Many-to-one mapping" />
-<meta name="relnum" content="Release 2.2" />
-<meta name="copyright" content="Copyright (c) 2000, 2008 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. Contributors: Oracle - initial API and implementation" />
-<link rel="copyright" href="dcommon/html/cpyr.htm" title="Copyright" type="text/html" />
-<link rel="stylesheet" href="dcommon/css/blafdoc.css" title="Oracle BLAFDoc" type="text/css" />
-<!-- contents -->
-</head>
-<body>
-<p><a id="BABHFAFJ" name="BABHFAFJ"></a></p>
-<div class="sect2"><!-- infolevel="all" infotype="General" -->
-<h1>Many-to-one mapping</h1>
-<p><a id="sthref133" name="sthref133"></a><a id="sthref134" name="sthref134"></a><a id="sthref135" name="sthref135"></a><a id="sthref136" name="sthref136"></a>Use a <span class="bold">Many-to-One</span> mapping to defines a single-valued association to another entity class that has many-to-one multiplicity.</p>
-<ol>
-<li>
-<p>In the <a href="ref_persistence_outline.htm#BABEGGFE">JPA Structure view</a>, select the field to map.</p>
-</li>
-<li>
-<p>Right click the field and then select <span class="bold">Map As &gt; Many-to-One</span>. The <a href="ref_persistence_map_view.htm#BABIFBAF">JPA Details view (for attributes)</a> displays the properties for the selected.</p>
-</li>
-<li>
-<p>Use this table to complete the <a href="ref_mapping_general.htm#CACBHFIJ">General information</a> fields JPA Details view.</p>
-<div class="inftblruleinformal">
-<table class="RuleInformal" title="This table lists the fields ion the General tab for this mapping." summary="This table lists the fields ion the General tab for this mapping." dir="ltr" border="1" width="100%" frame="border" rules="all" cellpadding="3" cellspacing="0">
-<col width="19%" />
-<col width="*" />
-<col width="41%" />
-<thead>
-<tr align="left" valign="top">
-<th align="left" valign="bottom" id="r1c1-t21">Property</th>
-<th align="left" valign="bottom" id="r1c2-t21">Description</th>
-<th align="left" valign="bottom" id="r1c3-t21">Default</th>
-</tr>
-</thead>
-<tbody>
-<tr align="left" valign="top">
-<td align="left" id="r2c1-t21" headers="r1c1-t21">Mapping Entity Hyperlink</td>
-<td align="left" headers="r2c1-t21 r1c2-t21">Defines mapping as <span class="bold">Many-to-One</span>. This corresponds to the <code>@ManyToOne</code> annotation.</td>
-<td align="left" headers="r2c1-t21 r1c3-t21">Many-to-One</td>
-</tr>
-<tr align="left" valign="top">
-<td align="left" id="r3c1-t21" headers="r1c1-t21">Target Entity</td>
-<td align="left" headers="r3c1-t21 r1c2-t21">The entity to which this attribute is mapped.</td>
-<td align="left" headers="r3c1-t21 r1c3-t21">null
-<p>You do not need to explicitly specify the target entity, since it can be inferred from the type of object being referenced.</p>
-</td>
-</tr>
-<tr align="left" valign="top">
-<td align="left" id="r4c1-t21" headers="r1c1-t21">Fetch</td>
-<td align="left" headers="r4c1-t21 r1c2-t21">Defines how data is loaded from the database. See <a href="ref_mapping_general.htm#CACGGGHB">"Fetch Type"</a> for details.
-<ul>
-<li>
-<p>Eager</p>
-</li>
-<li>
-<p>Lazy</p>
-</li>
-</ul>
-</td>
-<td align="left" headers="r4c1-t21 r1c3-t21">Eager</td>
-</tr>
-<tr align="left" valign="top">
-<td align="left" id="r5c1-t21" headers="r1c1-t21">Cascade</td>
-<td align="left" headers="r5c1-t21 r1c2-t21">See <a href="ref_mapping_general.htm#CACJAIHB">"Cascade Type"</a> for details.
-<ul>
-<li>
-<p>Default</p>
-</li>
-<li>
-<p>All</p>
-</li>
-<li>
-<p>Persist</p>
-</li>
-<li>
-<p>Merge</p>
-</li>
-<li>
-<p>Remove</p>
-</li>
-</ul>
-</td>
-<td align="left" headers="r5c1-t21 r1c3-t21">Default</td>
-</tr>
-<tr align="left" valign="top">
-<td align="left" id="r6c1-t21" headers="r1c1-t21">Optional</td>
-<td align="left" headers="r6c1-t21 r1c2-t21">Specifies if this field is can be null.</td>
-<td align="left" headers="r6c1-t21 r1c3-t21">Yes</td>
-</tr>
-</tbody>
-</table>
-<br /></div>
-<!-- class="inftblruleinformal" --></li>
-<li>
-<p>Use this table to complete the fields on the <a href="reference012.htm#CACFCEJC">Join Columns Information</a> tab in the <span class="gui-object-title">JPA Details</span> view.</p>
-<div class="inftblruleinformal">
-<table class="RuleInformal" title="This table lists the fields in the Persistence Properties view for this mapping." summary="This table lists the fields in the Persistence Properties view for this mapping." dir="ltr" border="1" width="100%" frame="border" rules="all" cellpadding="3" cellspacing="0">
-<col width="19%" />
-<col width="*" />
-<col width="41%" />
-<thead>
-<tr align="left" valign="top">
-<th align="left" valign="bottom" id="r1c1-t22">Property</th>
-<th align="left" valign="bottom" id="r1c2-t22">Description</th>
-<th align="left" valign="bottom" id="r1c3-t22">Default</th>
-</tr>
-</thead>
-<tbody>
-<tr align="left" valign="top">
-<td align="left" id="r2c1-t22" headers="r1c1-t22">Join Column</td>
-<td align="left" headers="r2c1-t22 r1c2-t22"><a id="sthref137" name="sthref137"></a><a id="sthref138" name="sthref138"></a>Specify a mapped column for joining an entity association. This field corresponds to the <code>@JoinColum</code> attribute.
-<p>Select <span class="bold">Override Default</span>, then Add, Edit, or Remove the join columns.</p>
-</td>
-<td align="left" headers="r2c1-t22 r1c3-t22">By default, the mapping is assumed to have a single join.</td>
-</tr>
-</tbody>
-</table>
-<br /></div>
-<!-- class="inftblruleinformal" --></li>
-</ol>
-<p>Eclipse adds the following annotations to the field:</p>
-<pre xml:space="preserve" class="oac_no_warn">
-@JoinTable(joinColumns=@JoinColumn(name="<span class="italic">&lt;JOIN_COLUMN&gt;</span>"),
- name = "<span class="italic">&lt;JOIN_TABLE_NAME&gt;</span>")
-@ManyToOne(targetEntity=<span class="italic">&lt;TARGET_ENTITY&gt;</span>, fetch=<span class="italic">&lt;FETCH_TYPE&gt;</span>,
- cascade=<span class="italic">&lt;CASCADE_TYPE&gt;</span>)
-</pre>
-<p>&nbsp;</p>
-<img src="img/ngrelt.png" alt="Related task" title="Related task" /><br />
-<br />
-<a href="task_mapping.htm#BABDGBIJ">Mapping an entity</a>
-<p>&nbsp;</p>
-<img src="img/ngrelr.png" alt="Related reference" title="Related reference" /><br />
-<br />
-<a href="ref_persistence_outline.htm#BABEGGFE">JPA Structure view</a><br />
-<a href="ref_persistence_map_view.htm#BABIFBAF">JPA Details view (for attributes)</a>
-<p>&nbsp;</p>
-<img src="img/ngrelc.png" alt="Related concept" title="Related concept" /><br />
-<br />
-<a href="concept_mapping.htm#BABBDJFI">Understanding OR mappings</a><br />
-<a href="concepts001.htm#BABBGFJG">Understanding EJB 3.0 Java Persistence API</a></div>
-<!-- class="sect2" -->
-<!-- Start Footer -->
-<div class="footer">
-<table class="simple oac_no_warn" summary="" cellspacing="0" cellpadding="0" width="100%">
-<col width="86%" />
-<col width="*" />
-<tr>
-<td align="left"><span class="copyrightlogo">Copyright&nbsp;&copy;&nbsp;2006, 2009,&nbsp;Oracle&nbsp;and/or&nbsp;its&nbsp;affiliates.&nbsp;All&nbsp;rights&nbsp;reserved.</span><br />
-<a href="dcommon/html/cpyr.htm"><span class="copyrightlogo">Legal Notices</span></a></td>
-</tr>
-</table>
-</div>
-<!-- class="footer" -->
-</body>
-</html>
diff --git a/jpa/plugins/org.eclipse.jpt.doc.user/tasks015.htm b/jpa/plugins/org.eclipse.jpt.doc.user/tasks015.htm
deleted file mode 100644
index 0ac5834bee..0000000000
--- a/jpa/plugins/org.eclipse.jpt.doc.user/tasks015.htm
+++ /dev/null
@@ -1,197 +0,0 @@
-<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN"
- "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
-<html xmlns="http://www.w3.org/1999/xhtml" xml:lang="en" lang="en">
-<head>
-<meta http-equiv="Content-Type" content="text/html; charset=us-ascii" />
-
-<meta http-equiv="Content-Style-Type" content="text/css" />
-<meta http-equiv="Content-Script-Type" content="text/javascript" />
-<title>One-to-many mapping</title>
-<meta name="generator" content="Oracle DARB XHTML Converter (Mode = ohj/ohw) - Version 5.1.1 Build 004" />
-<meta name="date" content="2009-05-01T8:12:47Z" />
-<meta name="robots" content="noarchive" />
-<meta name="doctitle" content="One-to-many mapping" />
-<meta name="relnum" content="Release 2.2" />
-<meta name="copyright" content="Copyright (c) 2000, 2008 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. Contributors: Oracle - initial API and implementation" />
-<link rel="copyright" href="dcommon/html/cpyr.htm" title="Copyright" type="text/html" />
-<link rel="stylesheet" href="dcommon/css/blafdoc.css" title="Oracle BLAFDoc" type="text/css" />
-<!-- contents -->
-</head>
-<body>
-<p><a id="BABHGEBD" name="BABHGEBD"></a></p>
-<div class="sect2"><!-- infolevel="all" infotype="General" -->
-<h1>One-to-many mapping</h1>
-<p><a id="sthref139" name="sthref139"></a><a id="sthref140" name="sthref140"></a><a id="sthref141" name="sthref141"></a><a id="sthref142" name="sthref142"></a>Use a <span class="bold">One-to-Many Mapping</span> to define a relationship with one-to-many multiplicity.</p>
-<ol>
-<li>
-<p>In the <a href="ref_persistence_outline.htm#BABEGGFE">JPA Structure view</a>, select the field to map.</p>
-</li>
-<li>
-<p>Right-click the field and then select <span class="bold">Map As &gt; One-to-many</span>. The <a href="ref_persistence_map_view.htm#BABIFBAF">JPA Details view (for attributes)</a> displays the properties for the selected.</p>
-</li>
-<li>
-<p>Use this table to complete the <a href="ref_mapping_general.htm#CACBHFIJ">General information</a> fields JPA Details view.</p>
-<div class="inftblruleinformal">
-<table class="RuleInformal" title="This table lists the fields in the General tab of the Persistence Properties view for this mapping." summary="This table lists the fields in the General tab of the Persistence Properties view for this mapping." dir="ltr" border="1" width="100%" frame="border" rules="all" cellpadding="3" cellspacing="0">
-<col width="19%" />
-<col width="*" />
-<col width="38%" />
-<thead>
-<tr align="left" valign="top">
-<th align="left" valign="bottom" id="r1c1-t23">Property</th>
-<th align="left" valign="bottom" id="r1c2-t23">Description</th>
-<th align="left" valign="bottom" id="r1c3-t23">Default</th>
-</tr>
-</thead>
-<tbody>
-<tr align="left" valign="top">
-<td align="left" id="r2c1-t23" headers="r1c1-t23">Mapping Entity Type Hyperlink</td>
-<td align="left" headers="r2c1-t23 r1c2-t23">Defines mapping as <span class="bold">One-to-Many</span>. This corresponds to the <code>@OneToMany</code> annotation.</td>
-<td align="left" headers="r2c1-t23 r1c3-t23">One-to-Many</td>
-</tr>
-<tr align="left" valign="top">
-<td align="left" id="r3c1-t23" headers="r1c1-t23">Target Entity</td>
-<td align="left" headers="r3c1-t23 r1c2-t23">The entity to which this attribute is mapped.</td>
-<td align="left" headers="r3c1-t23 r1c3-t23"><br /></td>
-</tr>
-<tr align="left" valign="top">
-<td align="left" id="r4c1-t23" headers="r1c1-t23">Cascade</td>
-<td align="left" headers="r4c1-t23 r1c2-t23">See <a href="ref_mapping_general.htm#CACJAIHB">"Cascade Type"</a> for details.
-<ul>
-<li>
-<p>Default</p>
-</li>
-<li>
-<p>All</p>
-</li>
-<li>
-<p>Persist</p>
-</li>
-<li>
-<p>Merge</p>
-</li>
-<li>
-<p>Remove</p>
-</li>
-</ul>
-</td>
-<td align="left" headers="r4c1-t23 r1c3-t23"><br /></td>
-</tr>
-<tr align="left" valign="top">
-<td align="left" id="r5c1-t23" headers="r1c1-t23">Fetch</td>
-<td align="left" headers="r5c1-t23 r1c2-t23">Defines how data is loaded from the database. See <a href="ref_mapping_general.htm#CACGGGHB">"Fetch Type"</a> for details.
-<ul>
-<li>
-<p>Eager</p>
-</li>
-<li>
-<p>Lazy</p>
-</li>
-</ul>
-</td>
-<td align="left" headers="r5c1-t23 r1c3-t23">Eager</td>
-</tr>
-<tr align="left" valign="top">
-<td align="left" id="r6c1-t23" headers="r1c1-t23">Mapped By</td>
-<td align="left" headers="r6c1-t23 r1c2-t23">The database field that owns the relationship.</td>
-<td align="left" headers="r6c1-t23 r1c3-t23"><br /></td>
-</tr>
-<tr align="left" valign="top">
-<td align="left" id="r7c1-t23" headers="r1c1-t23">Order By</td>
-<td align="left" headers="r7c1-t23 r1c2-t23">Specify the default order for objects returned from a query. See <a href="ref_mapping_general.htm#CACDADIH">"Order By"</a> for details.
-<ul>
-<li>
-<p>No ordering</p>
-</li>
-<li>
-<p>Primary key</p>
-</li>
-<li>
-<p>Custom</p>
-</li>
-</ul>
-</td>
-<td align="left" headers="r7c1-t23 r1c3-t23">No ordering</td>
-</tr>
-</tbody>
-</table>
-<br /></div>
-<!-- class="inftblruleinformal" --></li>
-<li>
-<p>Use this table to complete the <a href="reference011.htm#CACBAEBC">Join Table Information</a> fields in the JPA Details view.</p>
-<div class="inftblruleinformal">
-<table class="RuleInformal" title="This table lists the fields in the Join Table tab of the Persistence Properties view for this mapping." summary="This table lists the fields in the Join Table tab of the Persistence Properties view for this mapping." dir="ltr" border="1" width="100%" frame="border" rules="all" cellpadding="3" cellspacing="0">
-<col width="19%" />
-<col width="*" />
-<col width="38%" />
-<thead>
-<tr align="left" valign="top">
-<th align="left" valign="bottom" id="r1c1-t24">Property</th>
-<th align="left" valign="bottom" id="r1c2-t24">Description</th>
-<th align="left" valign="bottom" id="r1c3-t24">Default</th>
-</tr>
-</thead>
-<tbody>
-<tr align="left" valign="top">
-<td align="left" id="r2c1-t24" headers="r1c1-t24">Name</td>
-<td align="left" headers="r2c1-t24 r1c2-t24">Name of the join table</td>
-<td align="left" headers="r2c1-t24 r1c3-t24">By default, the name is assumed to be the primary tables associated with the entities concatenated with an underscore.</td>
-</tr>
-<tr align="left" valign="top">
-<td align="left" id="r3c1-t24" headers="r1c1-t24">Join Columns</td>
-<td align="left" headers="r3c1-t24 r1c2-t24">Specify two or more join columns (that is, a primary key).</td>
-<td align="left" headers="r3c1-t24 r1c3-t24"><br /></td>
-</tr>
-<tr align="left" valign="top">
-<td align="left" id="r4c1-t24" headers="r1c1-t24">Inverse Join Columns</td>
-<td align="left" headers="r4c1-t24 r1c2-t24">The join column on the owned (or inverse) side of the association: the owned entity's primary key column.</td>
-<td align="left" headers="r4c1-t24 r1c3-t24"><br /></td>
-</tr>
-</tbody>
-</table>
-<br /></div>
-<!-- class="inftblruleinformal" --></li>
-</ol>
-<p>Eclipse adds the following annotations to the field:</p>
-<pre xml:space="preserve" class="oac_no_warn">
-@OneToMany(targetEntity=<span class="italic">&lt;TARGET_ENTITY&gt;</span>)
-@Column(name="<span class="italic">&lt;COLUMN&gt;</span>")
-
-
-@OneToMany(targetEntity=<span class="italic">&lt;TARGET_ENTITY&gt;</span>.class, cascade=CascadeType.<span class="italic">&lt;CASCADE_TYPE&gt;</span>,
- fetch = FetchType.<span class="italic">&lt;FETCH_TYPE&gt;</span>, mappedBy = "<span class="italic">&lt;MAPPED_BY&gt;</span>")@OrderBy("<span class="italic">&lt;ORDER_BY&gt;</span>")
-@JoinTable(name="<span class="italic">&lt;JOIN_TABLE_NAME&gt;</span>", joinColumns=@JoinColumn(name=
- "<span class="italic">&lt;JOIN_COLUMN_NAME&gt;</span>", referencedColumnName="<span class="italic">&lt;JOIN_COLUMN_REFERENCED_COLUMN&gt;</span>"),
- inverseJoinColumns=@JoinColumn(name="<span class="italic">&lt;INVERSE_JOIN_COLUMN_NAME&gt;</span>",
- referencedColumnName="<span class="italic">&lt;INVERSE_JOIN_COLUMN_REFERENCED_COLUMN&gt;</span>"))
-
-</pre>
-<p>&nbsp;</p>
-<img src="img/ngrelt.png" alt="Related task" title="Related task" /><br />
-<br />
-<a href="task_mapping.htm#BABDGBIJ">Mapping an entity</a>
-<p>&nbsp;</p>
-<img src="img/ngrelr.png" alt="Related reference" title="Related reference" /><br />
-<br />
-<a href="ref_persistence_outline.htm#BABEGGFE">JPA Structure view</a><br />
-<a href="ref_persistence_map_view.htm#BABIFBAF">JPA Details view (for attributes)</a>
-<p>&nbsp;</p>
-<img src="img/ngrelc.png" alt="Related concept" title="Related concept" /><br />
-<br />
-<a href="concept_mapping.htm#BABBDJFI">Understanding OR mappings</a><br />
-<a href="concepts001.htm#BABBGFJG">Understanding EJB 3.0 Java Persistence API</a></div>
-<!-- class="sect2" -->
-<!-- Start Footer -->
-<div class="footer">
-<table class="simple oac_no_warn" summary="" cellspacing="0" cellpadding="0" width="100%">
-<col width="86%" />
-<col width="*" />
-<tr>
-<td align="left"><span class="copyrightlogo">Copyright&nbsp;&copy;&nbsp;2006, 2009,&nbsp;Oracle&nbsp;and/or&nbsp;its&nbsp;affiliates.&nbsp;All&nbsp;rights&nbsp;reserved.</span><br />
-<a href="dcommon/html/cpyr.htm"><span class="copyrightlogo">Legal Notices</span></a></td>
-</tr>
-</table>
-</div>
-<!-- class="footer" -->
-</body>
-</html>
diff --git a/jpa/plugins/org.eclipse.jpt.doc.user/tasks016.htm b/jpa/plugins/org.eclipse.jpt.doc.user/tasks016.htm
deleted file mode 100644
index e10677d86c..0000000000
--- a/jpa/plugins/org.eclipse.jpt.doc.user/tasks016.htm
+++ /dev/null
@@ -1,146 +0,0 @@
-<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN"
- "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
-<html xmlns="http://www.w3.org/1999/xhtml" xml:lang="en" lang="en">
-<head>
-<meta http-equiv="Content-Type" content="text/html; charset=us-ascii" />
-
-<meta http-equiv="Content-Style-Type" content="text/css" />
-<meta http-equiv="Content-Script-Type" content="text/javascript" />
-<title>One-to-one mapping</title>
-<meta name="generator" content="Oracle DARB XHTML Converter (Mode = ohj/ohw) - Version 5.1.1 Build 004" />
-<meta name="date" content="2009-05-01T8:12:47Z" />
-<meta name="robots" content="noarchive" />
-<meta name="doctitle" content="One-to-one mapping" />
-<meta name="relnum" content="Release 2.2" />
-<meta name="copyright" content="Copyright (c) 2000, 2008 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. Contributors: Oracle - initial API and implementation" />
-<link rel="copyright" href="dcommon/html/cpyr.htm" title="Copyright" type="text/html" />
-<link rel="stylesheet" href="dcommon/css/blafdoc.css" title="Oracle BLAFDoc" type="text/css" />
-<!-- contents -->
-</head>
-<body>
-<p><a id="BABFHBCJ" name="BABFHBCJ"></a></p>
-<div class="sect2"><!-- infolevel="all" infotype="General" -->
-<h1>One-to-one mapping</h1>
-<p><a id="sthref143" name="sthref143"></a><a id="sthref144" name="sthref144"></a><a id="sthref145" name="sthref145"></a><a id="sthref146" name="sthref146"></a>Use a <span class="bold">One-to-One Mapping</span> to define a relationship with one-to-many multiplicity.</p>
-<ol>
-<li>
-<p>In the <a href="ref_persistence_outline.htm#BABEGGFE">JPA Structure view</a>, select the field to map.</p>
-</li>
-<li>
-<p>Right-click the field and then select <span class="bold">Map As &gt; One-to-One</span>. The <a href="ref_persistence_map_view.htm#BABIFBAF">JPA Details view (for attributes)</a> displays the properties for the selected.</p>
-</li>
-<li>
-<p>Use this table to complete the <a href="ref_mapping_general.htm#CACBHFIJ">General information</a> fields in the JPA Details view.</p>
-<div class="inftblruleinformal">
-<table class="RuleInformal" title="This table lists the fields in the Persistence Properties view for this mapping." summary="This table lists the fields in the Persistence Properties view for this mapping." dir="ltr" border="1" width="100%" frame="border" rules="all" cellpadding="3" cellspacing="0">
-<col width="19%" />
-<col width="*" />
-<col width="41%" />
-<thead>
-<tr align="left" valign="top">
-<th align="left" valign="bottom" id="r1c1-t25">Property</th>
-<th align="left" valign="bottom" id="r1c2-t25">Description</th>
-<th align="left" valign="bottom" id="r1c3-t25">Default</th>
-</tr>
-</thead>
-<tbody>
-<tr align="left" valign="top">
-<td align="left" id="r2c1-t25" headers="r1c1-t25">Mapped Entity Hyperlink</td>
-<td align="left" headers="r2c1-t25 r1c2-t25">Defines mapping as <span class="bold">One-to-One</span>. This corresponds to the <code>@OneToOne</code> annotation.</td>
-<td align="left" headers="r2c1-t25 r1c3-t25">One-to-One</td>
-</tr>
-<tr align="left" valign="top">
-<td align="left" id="r3c1-t25" headers="r1c1-t25">Target Entity</td>
-<td align="left" headers="r3c1-t25 r1c2-t25">The entity to which this attribute is mapped.</td>
-<td align="left" headers="r3c1-t25 r1c3-t25">null
-<p>You do not need to explicitly specify the target entity, since it can be inferred from the type of object being referenced.</p>
-</td>
-</tr>
-<tr align="left" valign="top">
-<td align="left" id="r4c1-t25" headers="r1c1-t25">Fetch Type</td>
-<td align="left" headers="r4c1-t25 r1c2-t25">Defines how data is loaded from the database. See <a href="ref_mapping_general.htm#CACGGGHB">"Fetch Type"</a> for details.
-<ul>
-<li>
-<p>Eager</p>
-</li>
-<li>
-<p>Lazy</p>
-</li>
-</ul>
-</td>
-<td align="left" headers="r4c1-t25 r1c3-t25">Eager</td>
-</tr>
-<tr align="left" valign="top">
-<td align="left" id="r5c1-t25" headers="r1c1-t25">Mapped By</td>
-<td align="left" headers="r5c1-t25 r1c2-t25">The database field that owns the relationship.</td>
-<td align="left" headers="r5c1-t25 r1c3-t25"><br /></td>
-</tr>
-</tbody>
-</table>
-<br /></div>
-<!-- class="inftblruleinformal" --></li>
-<li>
-<p>Use this table to complete the <a href="reference012.htm#CACFCEJC">Join Columns Information</a> fields in the <span class="gui-object-title">JPA Details</span> view.</p>
-<div class="inftblruleinformal">
-<table class="RuleInformal" title="This table lists the fields in the Persistence Properties view for this mapping." summary="This table lists the fields in the Persistence Properties view for this mapping." dir="ltr" border="1" width="100%" frame="border" rules="all" cellpadding="3" cellspacing="0">
-<col width="19%" />
-<col width="*" />
-<col width="41%" />
-<thead>
-<tr align="left" valign="top">
-<th align="left" valign="bottom" id="r1c1-t26">Property</th>
-<th align="left" valign="bottom" id="r1c2-t26">Description</th>
-<th align="left" valign="bottom" id="r1c3-t26">Default</th>
-</tr>
-</thead>
-<tbody>
-<tr align="left" valign="top">
-<td align="left" id="r2c1-t26" headers="r1c1-t26">Join Column</td>
-<td align="left" headers="r2c1-t26 r1c2-t26"><a id="sthref147" name="sthref147"></a><a id="sthref148" name="sthref148"></a>Specify a mapped column for joining an entity association. This field corresponds to the <code>@JoinColum</code> attribute.
-<p>Select <span class="bold">Override Default</span>, then Add, Edit, or Remove the join columns.</p>
-</td>
-<td align="left" headers="r2c1-t26 r1c3-t26">By default, the mapping is assumed to have a single join.</td>
-</tr>
-</tbody>
-</table>
-<br /></div>
-<!-- class="inftblruleinformal" --></li>
-</ol>
-<p>Eclipse adds the following annotations to the field:</p>
-<pre xml:space="preserve" class="oac_no_warn">
-@OneToOne(targetEntity=<span class="italic">&lt;TARGET_ENTITY&gt;</span>, cascade=CascadeType.<span class="italic">&lt;CASCADE_TYPE&gt;</span>,
- fetch = FetchType.<span class="italic">&lt;FETCH_TYPE&gt;</span>, mappedBy = "<span class="italic">&lt;MAPPED_BY&gt;</span>")
-@JoinColumn(name="<span class="italic">&lt;JOIN_COLUMN_NAME&gt;</span>", referencedColumnName=
- "<span class="italic">&lt;JOIN_COLUMN_REFERENCED_COLUMN&gt;</span>", insertable = <span class="italic">&lt;INSERTABLE&gt;</span>,
- updatable = <span class="italic">&lt;UPDATABLE&gt;</span>)
-
-</pre>
-<p>&nbsp;</p>
-<img src="img/ngrelt.png" alt="Related task" title="Related task" /><br />
-<br />
-<a href="task_mapping.htm#BABDGBIJ">Mapping an entity</a>
-<p>&nbsp;</p>
-<img src="img/ngrelr.png" alt="Related reference" title="Related reference" /><br />
-<br />
-<a href="ref_persistence_outline.htm#BABEGGFE">JPA Structure view</a><br />
-<a href="ref_persistence_map_view.htm#BABIFBAF">JPA Details view (for attributes)</a>
-<p>&nbsp;</p>
-<img src="img/ngrelc.png" alt="Related concept" title="Related concept" /><br />
-<br />
-<a href="concept_mapping.htm#BABBDJFI">Understanding OR mappings</a><br />
-<a href="concepts001.htm#BABBGFJG">Understanding EJB 3.0 Java Persistence API</a></div>
-<!-- class="sect2" -->
-<!-- Start Footer -->
-<div class="footer">
-<table class="simple oac_no_warn" summary="" cellspacing="0" cellpadding="0" width="100%">
-<col width="86%" />
-<col width="*" />
-<tr>
-<td align="left"><span class="copyrightlogo">Copyright&nbsp;&copy;&nbsp;2006, 2009,&nbsp;Oracle&nbsp;and/or&nbsp;its&nbsp;affiliates.&nbsp;All&nbsp;rights&nbsp;reserved.</span><br />
-<a href="dcommon/html/cpyr.htm"><span class="copyrightlogo">Legal Notices</span></a></td>
-</tr>
-</table>
-</div>
-<!-- class="footer" -->
-</body>
-</html>
diff --git a/jpa/plugins/org.eclipse.jpt.doc.user/tasks017.htm b/jpa/plugins/org.eclipse.jpt.doc.user/tasks017.htm
deleted file mode 100644
index 5495245398..0000000000
--- a/jpa/plugins/org.eclipse.jpt.doc.user/tasks017.htm
+++ /dev/null
@@ -1,66 +0,0 @@
-<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN"
- "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
-<html xmlns="http://www.w3.org/1999/xhtml" xml:lang="en" lang="en">
-<head>
-<meta http-equiv="Content-Type" content="text/html; charset=us-ascii" />
-
-<meta http-equiv="Content-Style-Type" content="text/css" />
-<meta http-equiv="Content-Script-Type" content="text/javascript" />
-<title>Transient mapping</title>
-<meta name="generator" content="Oracle DARB XHTML Converter (Mode = ohj/ohw) - Version 5.1.1 Build 004" />
-<meta name="date" content="2009-05-01T8:12:47Z" />
-<meta name="robots" content="noarchive" />
-<meta name="doctitle" content="Transient mapping" />
-<meta name="relnum" content="Release 2.2" />
-<meta name="copyright" content="Copyright (c) 2000, 2008 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. Contributors: Oracle - initial API and implementation" />
-<link rel="copyright" href="dcommon/html/cpyr.htm" title="Copyright" type="text/html" />
-<link rel="stylesheet" href="dcommon/css/blafdoc.css" title="Oracle BLAFDoc" type="text/css" />
-<!-- contents -->
-</head>
-<body>
-<p><a id="BABHFHEI" name="BABHFHEI"></a></p>
-<div class="sect2"><!-- infolevel="all" infotype="General" -->
-<h1>Transient mapping</h1>
-<p><a id="sthref149" name="sthref149"></a><a id="sthref150" name="sthref150"></a><a id="sthref151" name="sthref151"></a><a id="sthref152" name="sthref152"></a>Use the Transient Mapping to specify a field of the entity class that <span class="italic">is not</span> persistent.</p>
-<p>To create a transient mapping:</p>
-<ol>
-<li>
-<p>In the <a href="ref_persistence_outline.htm#BABEGGFE">JPA Structure view</a>, select the field to map.</p>
-</li>
-<li>
-<p>Right-click the field and then select <span class="bold">Map As Transient</span>. The <a href="ref_persistence_map_view.htm#BABIFBAF">JPA Details view (for attributes)</a> displays the properties for the selected.</p>
-</li>
-</ol>
-<p>Eclipse adds the following annotation to the field:</p>
-<pre xml:space="preserve" class="oac_no_warn">
-@Transient
-</pre>
-<p>&nbsp;</p>
-<img src="img/ngrelt.png" alt="Related task" title="Related task" /><br />
-<br />
-<a href="task_mapping.htm#BABDGBIJ">Mapping an entity</a>
-<p>&nbsp;</p>
-<img src="img/ngrelr.png" alt="Related reference" title="Related reference" /><br />
-<br />
-<a href="ref_persistence_outline.htm#BABEGGFE">JPA Structure view</a><br />
-<a href="ref_persistence_map_view.htm#BABIFBAF">JPA Details view (for attributes)</a>
-<p>&nbsp;</p>
-<img src="img/ngrelc.png" alt="Related concept" title="Related concept" /><br />
-<br />
-<a href="concept_mapping.htm#BABBDJFI">Understanding OR mappings</a><br />
-<a href="concepts001.htm#BABBGFJG">Understanding EJB 3.0 Java Persistence API</a></div>
-<!-- class="sect2" -->
-<!-- Start Footer -->
-<div class="footer">
-<table class="simple oac_no_warn" summary="" cellspacing="0" cellpadding="0" width="100%">
-<col width="86%" />
-<col width="*" />
-<tr>
-<td align="left"><span class="copyrightlogo">Copyright&nbsp;&copy;&nbsp;2006, 2009,&nbsp;Oracle&nbsp;and/or&nbsp;its&nbsp;affiliates.&nbsp;All&nbsp;rights&nbsp;reserved.</span><br />
-<a href="dcommon/html/cpyr.htm"><span class="copyrightlogo">Legal Notices</span></a></td>
-</tr>
-</table>
-</div>
-<!-- class="footer" -->
-</body>
-</html>
diff --git a/jpa/plugins/org.eclipse.jpt.doc.user/tasks018.htm b/jpa/plugins/org.eclipse.jpt.doc.user/tasks018.htm
deleted file mode 100644
index 511bd392a7..0000000000
--- a/jpa/plugins/org.eclipse.jpt.doc.user/tasks018.htm
+++ /dev/null
@@ -1,137 +0,0 @@
-<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN"
- "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
-<html xmlns="http://www.w3.org/1999/xhtml" xml:lang="en" lang="en">
-<head>
-<meta http-equiv="Content-Type" content="text/html; charset=us-ascii" />
-
-<meta http-equiv="Content-Style-Type" content="text/css" />
-<meta http-equiv="Content-Script-Type" content="text/javascript" />
-<title>Version mapping</title>
-<meta name="generator" content="Oracle DARB XHTML Converter (Mode = ohj/ohw) - Version 5.1.1 Build 004" />
-<meta name="date" content="2009-05-01T8:12:47Z" />
-<meta name="robots" content="noarchive" />
-<meta name="doctitle" content="Version mapping" />
-<meta name="relnum" content="Release 2.2" />
-<meta name="copyright" content="Copyright (c) 2000, 2008 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. Contributors: Oracle - initial API and implementation" />
-<link rel="copyright" href="dcommon/html/cpyr.htm" title="Copyright" type="text/html" />
-<link rel="stylesheet" href="dcommon/css/blafdoc.css" title="Oracle BLAFDoc" type="text/css" />
-<!-- contents -->
-</head>
-<body>
-<p><a id="BABHIBII" name="BABHIBII"></a></p>
-<div class="sect2"><!-- infolevel="all" infotype="General" -->
-<h1>Version mapping</h1>
-<p><a id="sthref153" name="sthref153"></a><a id="sthref154" name="sthref154"></a><a id="sthref155" name="sthref155"></a><a id="sthref156" name="sthref156"></a>Use a <span class="bold">Version Mapping</span> to specify the field used for optimistic locking. If the entity is associated with multiple tables, you should use a version mapping only with the primary table. You should have only a single version mapping per persistent entity. Version mappings may be used only with the following attribute types:</p>
-<ul>
-<li>
-<p><code>int</code></p>
-</li>
-<li>
-<p><code>Integer</code></p>
-</li>
-<li>
-<p><code>short, Short</code></p>
-</li>
-<li>
-<p><code>long, Long</code></p>
-</li>
-<li>
-<p><code>Timestamp</code></p>
-</li>
-</ul>
-<p>To create a version mapping:</p>
-<ol>
-<li>
-<p>In the <a href="ref_persistence_outline.htm#BABEGGFE">JPA Structure view</a>, select the field to map.</p>
-</li>
-<li>
-<p>Right-click the field and then select <span class="bold">Map As &gt; Version</span>. The <a href="ref_persistence_map_view.htm#BABIFBAF">JPA Details view (for attributes)</a> displays the properties for the selected.</p>
-</li>
-<li>
-<p>Use this table to complete the remaining fields in the JPA Details view.</p>
-<div class="inftblruleinformal">
-<table class="RuleInformal" title="This table lists the fields in the Persistence Properties view for this mapping." summary="This table lists the fields in the Persistence Properties view for this mapping." dir="ltr" border="1" width="100%" frame="border" rules="all" cellpadding="3" cellspacing="0">
-<col width="19%" />
-<col width="*" />
-<col width="38%" />
-<thead>
-<tr align="left" valign="top">
-<th align="left" valign="bottom" id="r1c1-t27">Property</th>
-<th align="left" valign="bottom" id="r1c2-t27">Description</th>
-<th align="left" valign="bottom" id="r1c3-t27">Default</th>
-</tr>
-</thead>
-<tbody>
-<tr align="left" valign="top">
-<td align="left" id="r2c1-t27" headers="r1c1-t27">Mapped Entity Hyperlink</td>
-<td align="left" headers="r2c1-t27 r1c2-t27">Defines the mapping as Version. This corresponds to the <code>@Version</code> annotation.</td>
-<td align="left" headers="r2c1-t27 r1c3-t27">Version</td>
-</tr>
-<tr align="left" valign="top">
-<td align="left" id="r3c1-t27" headers="r1c1-t27">Column</td>
-<td align="left" headers="r3c1-t27 r1c2-t27">The database column mapped to the entity attribute. See <a href="ref_mapping_general.htm#CACGCBHB">"Column"</a> for details.</td>
-<td align="left" headers="r3c1-t27 r1c3-t27">By default, the Column is assumed to be named identically to the attribute and always included in the <code>INSERT</code> and <code>UPDATE</code> statements.</td>
-</tr>
-<tr align="left" valign="top">
-<td align="left" id="r4c1-t27" headers="r1c1-t27">Table</td>
-<td align="left" headers="r4c1-t27 r1c2-t27">Name of the database table. This must be the primary table associated with the attribute's entity.</td>
-<td align="left" headers="r4c1-t27 r1c3-t27"><br /></td>
-</tr>
-<tr align="left" valign="top">
-<td align="left" id="r5c1-t27" headers="r1c1-t27">Temporal</td>
-<td align="left" headers="r5c1-t27 r1c2-t27">Specifies the type of data. See <a href="ref_mapping_general.htm#CACEAJGD">"Temporal"</a> for details.
-<ul>
-<li>
-<p>Date</p>
-</li>
-<li>
-<p>Time</p>
-</li>
-<li>
-<p>Timestamp</p>
-</li>
-</ul>
-</td>
-<td align="left" headers="r5c1-t27 r1c3-t27"><br /></td>
-</tr>
-</tbody>
-</table>
-<br /></div>
-<!-- class="inftblruleinformal" --></li>
-</ol>
-<p>Eclipse adds the following annotations to the field:</p>
-<pre xml:space="preserve" class="oac_no_warn">
-@Version
-@Column(table="<span class="italic">&lt;COLUMN_TABLE&gt;</span>", name="&lt;<span class="italic">COLUMN_NAME</span>&gt;")
-
-</pre>
-<p>&nbsp;</p>
-<img src="img/ngrelt.png" alt="Related task" title="Related task" /><br />
-<br />
-<a href="task_mapping.htm#BABDGBIJ">Mapping an entity</a>
-<p>&nbsp;</p>
-<img src="img/ngrelr.png" alt="Related reference" title="Related reference" /><br />
-<br />
-<a href="ref_persistence_outline.htm#BABEGGFE">JPA Structure view</a><br />
-<a href="ref_persistence_map_view.htm#BABIFBAF">JPA Details view (for attributes)</a>
-<p>&nbsp;</p>
-<img src="img/ngrelc.png" alt="Related concept" title="Related concept" /><br />
-<br />
-<a href="concept_mapping.htm#BABBDJFI">Understanding OR mappings</a><br />
-<a href="concepts001.htm#BABBGFJG">Understanding EJB 3.0 Java Persistence API</a></div>
-<!-- class="sect2" -->
-<!-- class="sect1" -->
-<!-- Start Footer -->
-<div class="footer">
-<table class="simple oac_no_warn" summary="" cellspacing="0" cellpadding="0" width="100%">
-<col width="86%" />
-<col width="*" />
-<tr>
-<td align="left"><span class="copyrightlogo">Copyright&nbsp;&copy;&nbsp;2006, 2009,&nbsp;Oracle&nbsp;and/or&nbsp;its&nbsp;affiliates.&nbsp;All&nbsp;rights&nbsp;reserved.</span><br />
-<a href="dcommon/html/cpyr.htm"><span class="copyrightlogo">Legal Notices</span></a></td>
-</tr>
-</table>
-</div>
-<!-- class="footer" -->
-</body>
-</html>
diff --git a/jpa/plugins/org.eclipse.jpt.doc.user/tasks019.htm b/jpa/plugins/org.eclipse.jpt.doc.user/tasks019.htm
deleted file mode 100644
index 3ebdbf7825..0000000000
--- a/jpa/plugins/org.eclipse.jpt.doc.user/tasks019.htm
+++ /dev/null
@@ -1,95 +0,0 @@
-<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN"
- "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
-<html xmlns="http://www.w3.org/1999/xhtml" xml:lang="en" lang="en">
-<head>
-<meta http-equiv="Content-Type" content="text/html; charset=us-ascii" />
-
-<meta http-equiv="Content-Style-Type" content="text/css" />
-<meta http-equiv="Content-Script-Type" content="text/javascript" />
-<title>Generating entities from tables</title>
-<meta name="generator" content="Oracle DARB XHTML Converter (Mode = ohj/ohw) - Version 5.1.1 Build 004" />
-<meta name="date" content="2009-05-01T8:12:47Z" />
-<meta name="robots" content="noarchive" />
-<meta name="doctitle" content="Generating entities from tables" />
-<meta name="relnum" content="Release 2.2" />
-<meta name="copyright" content="Copyright (c) 2000, 2008 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. Contributors: Oracle - initial API and implementation" />
-<link rel="copyright" href="dcommon/html/cpyr.htm" title="Copyright" type="text/html" />
-<link rel="stylesheet" href="dcommon/css/blafdoc.css" title="Oracle BLAFDoc" type="text/css" />
-<!-- contents -->
-</head>
-<body>
-<p><a id="BABBAGFI" name="BABBAGFI"></a></p>
-<div class="sect1">
-<h1>Generating entities from tables</h1>
-<p><a id="sthref157" name="sthref157"></a><a id="sthref158" name="sthref158"></a>Use this procedure to generate Java persistent entities from database tables. You must create a JPA project and establish a database connection <span class="italic">before</span> generating persistent entities. See <a href="task_create_new_project.htm#CIHHEJCJ">"Creating a new JPA project"</a> for more information.<a id="sthref159" name="sthref159"></a><a id="sthref160" name="sthref160"></a></p>
-<ol>
-<li>
-<p>Right-click the JPA project in the <span class="gui-object-title">Project Explorer</span> and select <span class="gui-object-action">JPA Tools &gt; Generate Entities from Tables</span>.</p>
-<div class="figure"><a id="sthref161" name="sthref161"></a>
-<p class="titleinfigure">Generating Entities</p>
-<img src="img/generate_entities.png" alt="Using the JPA Tools &gt; Generate Entities menu option." title="Using the JPA Tools &gt; Generate Entities menu option." /><br /></div>
-<!-- class="figure" --></li>
-<li>
-<p>On the <a href="ref_selectTables.htm#CIAHCGEE">Select Tables</a> page, select your database connection and schema.</p>
-<p>To create a new database connection, click <span class="bold">Add connection</span>.</p>
-<p>If you are not currently connected to the database, the Database Connection page appears. Select your database connection and schema, and click <span class="bold">Reconnect</span>.</p>
-<div class="figure"><a id="sthref162" name="sthref162"></a>
-<p class="titleinfigure">Select Tables</p>
-<img src="img/select_tables.png" alt="" title="" /><br /></div>
-<!-- class="figure" --></li>
-<li>
-<p>After selecting a schema, select the tables from which to generate Java persistent entities and click <span class="bold">Next</span>.</p>
-</li>
-<li>
-<p>On the <a href="ref_tableAssociations.htm#CIACDICB">Table Associations</a> page, select the associations to generate. You can specify to generate specific references for each association.</p>
-<p>To create a new association, click <span class="bold">Add Association</span>. Use the <a href="ref_create_new_association_wizard.htm#CIAFGHIF">Create New Association</a> wizard to define the association.</p>
-<div class="figure"><a id="sthref163" name="sthref163"></a>
-<p class="titleinfigure">Table Associations</p>
-<img src="img/table_associations.png" alt="" title="" /><br /></div>
-<!-- class="figure" --></li>
-<li>
-<p>After editing the table associations, click <span class="bold">Next</span>.</p>
-</li>
-<li>
-<p>On the <a href="ref_customizeDefaultEntityGeneration.htm#CIAEJDBE">Customize Default Entity Generation</a> page, customize the mapping and class information for each generated entity.</p>
-<div class="figure"><a id="sthref164" name="sthref164"></a>
-<p class="titleinfigure">Customize Default Entity Generation</p>
-<img src="img/customize_default_entity_generation.png" alt="" title="" /><br /></div>
-<!-- class="figure" --></li>
-<li>
-<p>After customizing the mappings, click <span class="bold">Next</span>.</p>
-</li>
-<li>
-<p>On the <a href="ref_customizIndividualEntities.htm#CIACIGEE">Customize Individual Entities</a> page, review the mapping and class information for each entity that will be generated, then click <span class="bold">Finish</span>.</p>
-<div class="figure"><a id="sthref165" name="sthref165"></a>
-<p class="titleinfigure">Customize Individual Entities</p>
-<img src="img/customize_individual_entities.png" alt="" title="" /><br /></div>
-<!-- class="figure" --></li>
-</ol>
-<p>Eclipse creates a Java persistent entity for each database table. Each entity contains fields based on the table's columns. Eclipse will also generate entity relationships (such as one-to-one) based on the table constraints. <a href="#CIHJIJJC">Figure: Generating Entities from Tables</a> illustrates how Eclipse generates entities from tables.</p>
-<div class="figure"><a id="CIHJIJJC" name="CIHJIJJC"></a>
-<p class="titleinfigure">Generating Entities from Tables</p>
-<img src="img/table_entity.png" alt="This figure shows the EMPLOYEE and ADDRESS entities generated from database tables." title="This figure shows the EMPLOYEE and ADDRESS entities generated from database tables." /><br /></div>
-<!-- class="figure" -->
-<p>&nbsp;</p>
-<img src="img/ngrelt.png" alt="Related task" title="Related task" /><br />
-<p><a href="task_create_new_project.htm#CIHHEJCJ">Creating a new JPA project</a></p>
-<p>&nbsp;</p>
-<img src="img/ngrelr.png" alt="Related reference" title="Related reference" /><br />
-<br />
-<a href="ref_project_properties.htm#BABJHBCI">Project Properties page &ndash; Java Persistence Options</a></div>
-<!-- class="sect1" -->
-<!-- Start Footer -->
-<div class="footer">
-<table class="simple oac_no_warn" summary="" cellspacing="0" cellpadding="0" width="100%">
-<col width="86%" />
-<col width="*" />
-<tr>
-<td align="left"><span class="copyrightlogo">Copyright&nbsp;&copy;&nbsp;2006, 2009,&nbsp;Oracle&nbsp;and/or&nbsp;its&nbsp;affiliates.&nbsp;All&nbsp;rights&nbsp;reserved.</span><br />
-<a href="dcommon/html/cpyr.htm"><span class="copyrightlogo">Legal Notices</span></a></td>
-</tr>
-</table>
-</div>
-<!-- class="footer" -->
-</body>
-</html>
diff --git a/jpa/plugins/org.eclipse.jpt.doc.user/tasks020.htm b/jpa/plugins/org.eclipse.jpt.doc.user/tasks020.htm
deleted file mode 100644
index 0b90ecb85f..0000000000
--- a/jpa/plugins/org.eclipse.jpt.doc.user/tasks020.htm
+++ /dev/null
@@ -1,61 +0,0 @@
-<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN"
- "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
-<html xmlns="http://www.w3.org/1999/xhtml" xml:lang="en" lang="en">
-<head>
-<meta http-equiv="Content-Type" content="text/html; charset=us-ascii" />
-
-<meta http-equiv="Content-Style-Type" content="text/css" />
-<meta http-equiv="Content-Script-Type" content="text/javascript" />
-<title>Generating tables from entities</title>
-<meta name="generator" content="Oracle DARB XHTML Converter (Mode = ohj/ohw) - Version 5.1.1 Build 004" />
-<meta name="date" content="2009-05-01T8:12:48Z" />
-<meta name="robots" content="noarchive" />
-<meta name="doctitle" content="Generating tables from entities" />
-<meta name="relnum" content="Release 2.2" />
-<meta name="copyright" content="Copyright (c) 2000, 2008 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. Contributors: Oracle - initial API and implementation" />
-<link rel="copyright" href="dcommon/html/cpyr.htm" title="Copyright" type="text/html" />
-<link rel="stylesheet" href="dcommon/css/blafdoc.css" title="Oracle BLAFDoc" type="text/css" />
-<!-- contents -->
-</head>
-<body>
-<p><a id="CIHJIGBE" name="CIHJIGBE"></a></p>
-<div class="sect1"><!-- infolevel="all" infotype="General" -->
-<h1>Generating tables from entities</h1>
-<p>When using a vendor-specific platform, you can create a DDL script from your persistent entities.</p>
-<div align="center">
-<div class="inftblnote"><br />
-<table class="Note oac_no_warn" summary="" cellpadding="3" cellspacing="0">
-<tbody>
-<tr>
-<td align="left">
-<p class="notep1">Note:</p>
-The DDL script with DROP existing tables on the database and CREATE new tables, based on the entities in your project.</td>
-</tr>
-</tbody>
-</table>
-<br /></div>
-<!-- class="inftblnote" --></div>
-<p>To generate a DDL script:</p>
-<p>Right-click the JPA project in the <span class="gui-object-title">Project Explorer</span> and select <span class="gui-object-action">JPA Tools &gt; Generate Tables from Entities</span>.</p>
-<p>&nbsp;</p>
-<img src="img/ngrelt.png" alt="Related task" title="Related task" /><br />
-<p><a href="task_create_jpa_entity.htm#BABFBJBG">Creating a JPA Entity</a></p>
-<p>&nbsp;</p>
-<img src="img/ngrelr.png" alt="Related reference" title="Related reference" /><br />
-<br />
-<a href="ref_project_properties.htm#BABJHBCI">Project Properties page &ndash; Java Persistence Options</a></div>
-<!-- class="sect1" -->
-<!-- Start Footer -->
-<div class="footer">
-<table class="simple oac_no_warn" summary="" cellspacing="0" cellpadding="0" width="100%">
-<col width="86%" />
-<col width="*" />
-<tr>
-<td align="left"><span class="copyrightlogo">Copyright&nbsp;&copy;&nbsp;2006, 2009,&nbsp;Oracle&nbsp;and/or&nbsp;its&nbsp;affiliates.&nbsp;All&nbsp;rights&nbsp;reserved.</span><br />
-<a href="dcommon/html/cpyr.htm"><span class="copyrightlogo">Legal Notices</span></a></td>
-</tr>
-</table>
-</div>
-<!-- class="footer" -->
-</body>
-</html>
diff --git a/jpa/plugins/org.eclipse.jpt.doc.user/tasks021.htm b/jpa/plugins/org.eclipse.jpt.doc.user/tasks021.htm
deleted file mode 100644
index ec63a3e27f..0000000000
--- a/jpa/plugins/org.eclipse.jpt.doc.user/tasks021.htm
+++ /dev/null
@@ -1,54 +0,0 @@
-<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN"
- "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
-<html xmlns="http://www.w3.org/1999/xhtml" xml:lang="en" lang="en">
-<head>
-<meta http-equiv="Content-Type" content="text/html; charset=us-ascii" />
-
-<meta http-equiv="Content-Style-Type" content="text/css" />
-<meta http-equiv="Content-Script-Type" content="text/javascript" />
-<title>Validating mappings and reporting problems</title>
-<meta name="generator" content="Oracle DARB XHTML Converter (Mode = ohj/ohw) - Version 5.1.1 Build 004" />
-<meta name="date" content="2009-05-01T8:12:48Z" />
-<meta name="robots" content="noarchive" />
-<meta name="doctitle" content="Validating mappings and reporting problems" />
-<meta name="relnum" content="Release 2.2" />
-<meta name="copyright" content="Copyright (c) 2000, 2008 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. Contributors: Oracle - initial API and implementation" />
-<link rel="copyright" href="dcommon/html/cpyr.htm" title="Copyright" type="text/html" />
-<link rel="stylesheet" href="dcommon/css/blafdoc.css" title="Oracle BLAFDoc" type="text/css" />
-<!-- contents -->
-</head>
-<body>
-<p><a id="BABFAIBA" name="BABFAIBA"></a></p>
-<div class="sect1">
-<h1>Validating mappings and reporting problems</h1>
-<p><a id="sthref166" name="sthref166"></a><a id="sthref167" name="sthref167"></a><a id="sthref168" name="sthref168"></a><a id="sthref169" name="sthref169"></a>Errors and warnings on persistent entities and mappings are indicated with a red error or yellow warning next to the resource with the error, as well as the parent containers up to the project.</p>
-<div class="figure"><a id="sthref170" name="sthref170"></a>
-<p class="titleinfigure">Sample Errors and Warnings</p>
-<img src="img/error_sample.png" alt="This figure shows sample error and warning icons in the Explorer view." title="This figure shows sample error and warning icons in the Explorer view." /><br /></div>
-<!-- class="figure" -->
-<p>This section contains information on the following:</p>
-<ul>
-<li>
-<p><a href="tasks022.htm#CIHFEDEI">Error messages</a></p>
-</li>
-<li>
-<p><a href="tasks023.htm#CIHGEAIJ">Warning messages</a></p>
-</li>
-</ul>
-<p>&nbsp;</p>
-<img src="img/ngrelc.png" alt="Related concept" title="Related concept" /><br />
-<p><a href="../org.eclipse.platform.doc.user/concepts/cprbview.htm">Problems view</a></p>
-<!-- Start Footer -->
-<div class="footer">
-<table class="simple oac_no_warn" summary="" cellspacing="0" cellpadding="0" width="100%">
-<col width="86%" />
-<col width="*" />
-<tr>
-<td align="left"><span class="copyrightlogo">Copyright&nbsp;&copy;&nbsp;2006, 2009,&nbsp;Oracle&nbsp;and/or&nbsp;its&nbsp;affiliates.&nbsp;All&nbsp;rights&nbsp;reserved.</span><br />
-<a href="dcommon/html/cpyr.htm"><span class="copyrightlogo">Legal Notices</span></a></td>
-</tr>
-</table>
-</div>
-<!-- class="footer" --></div>
-</body>
-</html>
diff --git a/jpa/plugins/org.eclipse.jpt.doc.user/tasks022.htm b/jpa/plugins/org.eclipse.jpt.doc.user/tasks022.htm
deleted file mode 100644
index 3e39f76c7f..0000000000
--- a/jpa/plugins/org.eclipse.jpt.doc.user/tasks022.htm
+++ /dev/null
@@ -1,92 +0,0 @@
-<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN"
- "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
-<html xmlns="http://www.w3.org/1999/xhtml" xml:lang="en" lang="en">
-<head>
-<meta http-equiv="Content-Type" content="text/html; charset=us-ascii" />
-
-<meta http-equiv="Content-Style-Type" content="text/css" />
-<meta http-equiv="Content-Script-Type" content="text/javascript" />
-<title>Error messages</title>
-<meta name="generator" content="Oracle DARB XHTML Converter (Mode = ohj/ohw) - Version 5.1.1 Build 004" />
-<meta name="date" content="2009-05-01T8:12:48Z" />
-<meta name="robots" content="noarchive" />
-<meta name="doctitle" content="Error messages" />
-<meta name="relnum" content="Release 2.2" />
-<meta name="copyright" content="Copyright (c) 2000, 2008 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. Contributors: Oracle - initial API and implementation" />
-<link rel="copyright" href="dcommon/html/cpyr.htm" title="Copyright" type="text/html" />
-<link rel="stylesheet" href="dcommon/css/blafdoc.css" title="Oracle BLAFDoc" type="text/css" />
-<!-- contents -->
-</head>
-<body>
-<p><a id="CIHFEDEI" name="CIHFEDEI"></a></p>
-<div class="sect2"><!-- infolevel="all" infotype="General" -->
-<h1>Error messages<a id="sthref171" name="sthref171"></a></h1>
-<p>This section contains information on error messages (including how to resolve the issue) you may encounter while working with Dali.</p>
-<a id="sthref172" name="sthref172"></a>
-<p class="subhead2">Attribute "<span class="italic">&lt;ATTRIBUTE__NAME&gt;</span>" has invalid mapping type in this context</p>
-<p>The mapped attribute is invalid. Either change the mapping type or change the entity type.</p>
-<p>See <a href="task_mapping.htm#BABDGBIJ">"Mapping an entity"</a> for more information.</p>
-<a id="sthref173" name="sthref173"></a>
-<p class="subhead2">Attribute "<span class="italic">&lt;ATTRIBUTE_NAME&gt;</span>" cannot be resolved.</p>
-<p>Dali cannot map the attribute to a database table and column. Verify that you database connection information is correct.</p>
-<p>See <a href="task_create_new_project.htm#CIHHEJCJ">"Creating a new JPA project"</a> for more information.</p>
-<a id="sthref174" name="sthref174"></a>
-<p class="subhead2">Class "<span class="italic">&lt;CLASS_NAME&gt;</span>" is not annotated as a persistent class.</p>
-<p>The class has not been identified as a persistent class. Configure the class as an Entity, Mapped Superclass, or Embeddable persistent entity.</p>
-<p>See <a href="task_add_persistence.htm#BABHICAI">"Adding persistence to a class"</a>.</p>
-<a id="sthref175" name="sthref175"></a>
-<p class="subhead2">Column "<span class="italic">&lt;COLUMN_NAME&gt;</span>" cannot be resolved.</p>
-<p>You mapped an entity's field to an incorrect or invalid column in the database table. By default, Dali will attempt to map each field in the entity with an identically named row in the database table. If the field's name differs from the row's name, you must explicitly create the mapping.</p>
-<p>Map the field to a valid row in the database table as shown in <a href="task_mapping.htm#BABDGBIJ">"Mapping an entity"</a>.</p>
-<a id="sthref176" name="sthref176"></a>
-<p class="subhead2">Duplicate class "<span class="italic">&lt;CLASS_NAME&gt;</span>".</p>
-<p>You created to persistence classes with the same name. Each Java class must have a unique name. See <a href="task_add_persistence.htm#BABHICAI">"Adding persistence to a class"</a> for more information.</p>
-<a id="sthref177" name="sthref177"></a>
-<p class="subhead2">Entity does not have an Id or Embedded Id.</p>
-<p>You created a persistent entity without identifying its primary key. A persistent entity must have a primary key field designated with an <code>@Id</code> or <code>@EmbeddedId</code> annotation.</p>
-<p>Add an ID mapping to the entity as shown in <a href="tasks012.htm#BABGCBHG">"ID mapping"</a> or <a href="tasks011.htm#CIHDIAEE">"Embedded ID mapping"</a>.</p>
-<a id="sthref178" name="sthref178"></a>
-<p class="subhead2">Multiple persistence.xml files in project.</p>
-<p>You created a JPA project with more than one <code>persistence.xml</code> file. Each JPA project must contain a <span class="italic">single</span> <code>persistence.xml</code> file.</p>
-<p>See <a href="task_manage_persistence.htm#CIHDAJID">"Managing the persistence.xml file"</a> for more information.</p>
-<a id="sthref179" name="sthref179"></a>
-<p class="subhead2">No persistence unit defined.</p>
-<p>There is no persistence unit defined in the <code>persistence.xml</code> file. Use the &lt;persistence-unit name="<span class="italic">&lt;PERSISTENCE_UNIT_NAME&gt;</span>" tag to define the persistent unit.</p>
-<p>See <a href="task_manage_orm.htm#CIHDGDCD">"Managing the orm.xml file"</a> for more information.</p>
-<a id="sthref180" name="sthref180"></a>
-<p class="subhead2">No persistence.xml file in project.</p>
-<p>You created a JPA project without a <code>persistence.xml</code> file. Each JPA project must contain a <span class="italic">single</span> <code>persistence.xml</code> file.</p>
-<p>See <a href="task_manage_persistence.htm#CIHDAJID">"Managing the persistence.xml file"</a> for more information.</p>
-<a id="sthref181" name="sthref181"></a>
-<p class="subhead2">Referenced column "<span class="italic">&lt;COLUMN_NAME&gt;</span>" in join column "<span class="italic">&lt;COLUMN_NAME&gt;</span>" cannot be resolved.</p>
-<p>The column that you selected to join a relationship mapping does not exist on the database table. Either select a different column on the <a href="reference011.htm#CACBAEBC">Join Table Information</a> or create the necessary column on the database table.</p>
-<p>See <a href="ref_persistence_map_view.htm#BABIFBAF">"JPA Details view (for attributes)"</a> for more information.</p>
-<a id="sthref182" name="sthref182"></a>
-<p class="subhead2">Schema "&lt;<span class="italic">SCHEMA_NAME</span>&gt;" cannot be resolved for table/join table "&lt;<span class="italic">TABLE_NAME</span>&gt;".</p>
-<p>Define the default database schema information in the persistence unit.</p>
-<p>See <a href="task_manage_orm.htm#CIHDGDCD">"Managing the orm.xml file"</a> for more information.</p>
-<a id="sthref183" name="sthref183"></a>
-<p class="subhead2">Table "<span class="italic">&lt;TABLE_NAME&gt;</span>" cannot be resolved.</p>
-<p>You associated a persistent entity to an incorrect or invalid database table. By default, Dali will attempt to associate each persistent entity with an identically named database table. If the entity's name differs from the table's name, you must explicitly create the association.</p>
-<p>Associate the entity with a valid database table as shown in <a href="task_add_persistence.htm#BABHICAI">"Adding persistence to a class"</a>.</p>
-<a id="sthref184" name="sthref184"></a>
-<p class="subhead2">Unresolved generator "<span class="italic">&lt;GENERATOR_NAME&gt;</span>" is defined in persistence unit.</p>
-<p>You created a persistence entity that uses sequencing or a table generator, but did not define the generator in the persistence unit. Either define the generator by using an annotation or including it in the XML mapping file.</p>
-<img src="img/ngrelc.png" alt="Related concept" title="Related concept" /><br />
-<p><a href="../org.eclipse.platform.doc.user/concepts/cprbview.htm">Problems view</a></p>
-</div>
-<!-- class="sect2" -->
-<!-- Start Footer -->
-<div class="footer">
-<table class="simple oac_no_warn" summary="" cellspacing="0" cellpadding="0" width="100%">
-<col width="86%" />
-<col width="*" />
-<tr>
-<td align="left"><span class="copyrightlogo">Copyright&nbsp;&copy;&nbsp;2006, 2009,&nbsp;Oracle&nbsp;and/or&nbsp;its&nbsp;affiliates.&nbsp;All&nbsp;rights&nbsp;reserved.</span><br />
-<a href="dcommon/html/cpyr.htm"><span class="copyrightlogo">Legal Notices</span></a></td>
-</tr>
-</table>
-</div>
-<!-- class="footer" -->
-</body>
-</html>
diff --git a/jpa/plugins/org.eclipse.jpt.doc.user/tasks023.htm b/jpa/plugins/org.eclipse.jpt.doc.user/tasks023.htm
deleted file mode 100644
index eda5a889f4..0000000000
--- a/jpa/plugins/org.eclipse.jpt.doc.user/tasks023.htm
+++ /dev/null
@@ -1,50 +0,0 @@
-<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN"
- "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
-<html xmlns="http://www.w3.org/1999/xhtml" xml:lang="en" lang="en">
-<head>
-<meta http-equiv="Content-Type" content="text/html; charset=us-ascii" />
-
-<meta http-equiv="Content-Style-Type" content="text/css" />
-<meta http-equiv="Content-Script-Type" content="text/javascript" />
-<title>Warning messages</title>
-<meta name="generator" content="Oracle DARB XHTML Converter (Mode = ohj/ohw) - Version 5.1.1 Build 004" />
-<meta name="date" content="2009-05-01T8:12:48Z" />
-<meta name="robots" content="noarchive" />
-<meta name="doctitle" content="Warning messages" />
-<meta name="relnum" content="Release 2.2" />
-<meta name="copyright" content="Copyright (c) 2000, 2008 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. Contributors: Oracle - initial API and implementation" />
-<link rel="copyright" href="dcommon/html/cpyr.htm" title="Copyright" type="text/html" />
-<link rel="stylesheet" href="dcommon/css/blafdoc.css" title="Oracle BLAFDoc" type="text/css" />
-<!-- contents -->
-</head>
-<body>
-<p><a id="CIHGEAIJ" name="CIHGEAIJ"></a></p>
-<div class="sect2"><!-- infolevel="all" infotype="General" -->
-<h1>Warning messages</h1>
-<p>This section contains information on warning messages (including how to resolve the issue) you may encounter while working with Dali.</p>
-<a id="sthref185" name="sthref185"></a>
-<p class="subhead2">Connection "<span class="italic">&lt;CONNECTION_NAME&gt;</span>" is not active. No validation will be done against the data source.</p>
-<p>The database connection you specified to use with the JPA project is not active. The JPA project requires an active connection.</p>
-<a id="sthref186" name="sthref186"></a>
-<p class="subhead2">No connection specified for the project. No data-specific validation will be performed.</p>
-<p>You created a JPA project without specifying a database connection. The JPA project requires an active connection.</p>
-<p>See <a href="task_create_new_project.htm#CIHHEJCJ">"Creating a new JPA project"</a> or <a href="tasks024.htm#BABDBCBI">"Modifying persistent project properties"</a> for information on specifying a database connection.</p>
-<img src="img/ngrelc.png" alt="Related concept" title="Related concept" /><br />
-<p><a href="../org.eclipse.platform.doc.user/concepts/cprbview.htm">Problems view</a></p>
-</div>
-<!-- class="sect2" -->
-<!-- class="sect1" -->
-<!-- Start Footer -->
-<div class="footer">
-<table class="simple oac_no_warn" summary="" cellspacing="0" cellpadding="0" width="100%">
-<col width="86%" />
-<col width="*" />
-<tr>
-<td align="left"><span class="copyrightlogo">Copyright&nbsp;&copy;&nbsp;2006, 2009,&nbsp;Oracle&nbsp;and/or&nbsp;its&nbsp;affiliates.&nbsp;All&nbsp;rights&nbsp;reserved.</span><br />
-<a href="dcommon/html/cpyr.htm"><span class="copyrightlogo">Legal Notices</span></a></td>
-</tr>
-</table>
-</div>
-<!-- class="footer" -->
-</body>
-</html>
diff --git a/jpa/plugins/org.eclipse.jpt.doc.user/tasks024.htm b/jpa/plugins/org.eclipse.jpt.doc.user/tasks024.htm
deleted file mode 100644
index cd5657bd0f..0000000000
--- a/jpa/plugins/org.eclipse.jpt.doc.user/tasks024.htm
+++ /dev/null
@@ -1,63 +0,0 @@
-<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN"
- "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
-<html xmlns="http://www.w3.org/1999/xhtml" xml:lang="en" lang="en">
-<head>
-<meta http-equiv="Content-Type" content="text/html; charset=us-ascii" />
-
-<meta http-equiv="Content-Style-Type" content="text/css" />
-<meta http-equiv="Content-Script-Type" content="text/javascript" />
-<title>Modifying persistent project properties</title>
-<meta name="generator" content="Oracle DARB XHTML Converter (Mode = ohj/ohw) - Version 5.1.1 Build 004" />
-<meta name="date" content="2009-05-01T8:12:48Z" />
-<meta name="robots" content="noarchive" />
-<meta name="doctitle" content="Modifying persistent project properties" />
-<meta name="relnum" content="Release 2.2" />
-<meta name="copyright" content="Copyright (c) 2000, 2008 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. Contributors: Oracle - initial API and implementation" />
-<link rel="copyright" href="dcommon/html/cpyr.htm" title="Copyright" type="text/html" />
-<link rel="stylesheet" href="dcommon/css/blafdoc.css" title="Oracle BLAFDoc" type="text/css" />
-<!-- contents -->
-</head>
-<body>
-<p><a id="BABDBCBI" name="BABDBCBI"></a></p>
-<div class="sect1"><!-- infolevel="all" infotype="General" -->
-<h1>Modifying persistent project properties</h1>
-<p>Each persistent project must be associated with a database connection. To create a new database connection, click <span class="gui-object-action">Database Connection</span> use the New Connection wizard.</p>
-<p>Use this procedure to modify the vender-specific platform and database connection associated with your JPA project.</p>
-<ol>
-<li>
-<p>Right-click the project in the <span class="gui-object-title">Explorer</span> view and select <span class="gui-object-action">Properties</span>. The Properties page appears.</p>
-<div class="figure"><a id="sthref187" name="sthref187"></a>
-<p class="titleinfigure">The Properties Page</p>
-<img src="img/project_properties_tasks.png" alt="The Persistence page." title="The Persistence page." /><br /></div>
-<!-- class="figure" --></li>
-<li>
-<p>Complete each field on the <a href="ref_project_properties.htm#BABJHBCI">Project Properties page &ndash; Java Persistence Options</a> click <span class="bold">OK</span>.</p>
-</li>
-</ol>
-<p>&nbsp;</p>
-<img src="img/ngrelt.png" alt="Related task" title="Related task" /><br />
-<br />
-<a href="task_create_new_project.htm#CIHHEJCJ">Creating a new JPA project</a>
-<p>&nbsp;</p>
-<img src="img/ngrelr.png" alt="Related reference" title="Related reference" /><br />
-<br />
-<a href="ref_project_properties.htm#BABJHBCI">Project Properties page &ndash; Java Persistence Options</a>
-<p>&nbsp;</p>
-<img src="img/ngrelc.png" alt="Related concept" title="Related concept" /><br />
-<br />
-<a href="concept_persistence.htm#BABCAHIC">Understanding Java persistence</a></div>
-<!-- class="sect1" -->
-<!-- Start Footer -->
-<div class="footer">
-<table class="simple oac_no_warn" summary="" cellspacing="0" cellpadding="0" width="100%">
-<col width="86%" />
-<col width="*" />
-<tr>
-<td align="left"><span class="copyrightlogo">Copyright&nbsp;&copy;&nbsp;2006, 2009,&nbsp;Oracle&nbsp;and/or&nbsp;its&nbsp;affiliates.&nbsp;All&nbsp;rights&nbsp;reserved.</span><br />
-<a href="dcommon/html/cpyr.htm"><span class="copyrightlogo">Legal Notices</span></a></td>
-</tr>
-</table>
-</div>
-<!-- class="footer" -->
-</body>
-</html>
diff --git a/jpa/plugins/org.eclipse.jpt.doc.user/tips_and_tricks.htm b/jpa/plugins/org.eclipse.jpt.doc.user/tips_and_tricks.htm
deleted file mode 100644
index a528f1c72e..0000000000
--- a/jpa/plugins/org.eclipse.jpt.doc.user/tips_and_tricks.htm
+++ /dev/null
@@ -1,68 +0,0 @@
-<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN"
- "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
-<html xmlns="http://www.w3.org/1999/xhtml" xml:lang="en" lang="en">
-<head>
-<meta http-equiv="Content-Type" content="text/html; charset=us-ascii" />
-
-<meta http-equiv="Content-Style-Type" content="text/css" />
-<meta http-equiv="Content-Script-Type" content="text/javascript" />
-<title>Tips and tricks</title>
-<meta name="generator" content="Oracle DARB XHTML Converter (Mode = ohj/ohw) - Version 5.1.1 Build 004" />
-<meta name="date" content="2009-05-01T8:12:54Z" />
-<meta name="robots" content="noarchive" />
-<meta name="doctitle" content=" Tips and tricks" />
-<meta name="relnum" content="Release 2.2" />
-<meta name="copyright" content="Copyright (c) 2000, 2008 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. Contributors: Oracle - initial API and implementation" />
-<link rel="copyright" href="dcommon/html/cpyr.htm" title="Copyright" type="text/html" />
-<link rel="stylesheet" href="dcommon/css/blafdoc.css" title="Oracle BLAFDoc" type="text/css" />
-<!-- contents -->
-</head>
-<body>
-<p><a id="CHDHGHBF" name="CHDHGHBF"></a></p>
-<h1>Tips and tricks</h1>
-<p>The following tips and tricks give some helpful ideas for increasing your productivity.</p>
-<ul>
-<li>
-<p><a href="#BABFIIHA"><span class="bold">Database Connections</span></a></p>
-</li>
-<li>
-<p><a href="#BABCHAHF"><span class="bold">Schema-based persistence.xml</span></a></p>
-</li>
-</ul>
-<div class="inftblruleinformal">
-<table class="RuleInformal" title="This table lists the tips and tricks in this category." summary="This table lists the tips and tricks in this category." dir="ltr" border="1" width="100%" frame="border" rules="all" cellpadding="3" cellspacing="0">
-<col width="27%" />
-<col width="*" />
-<thead>
-<tr align="left" valign="top">
-<th align="left" valign="bottom" id="r1c1-t2">Tip</th>
-<th align="left" valign="bottom" id="r1c2-t2">Description</th>
-</tr>
-</thead>
-<tbody>
-<tr align="left" valign="top">
-<td align="left" id="r2c1-t2" headers="r1c1-t2"><a id="BABFIIHA" name="BABFIIHA"></a><span class="bold">Database Connections</span></td>
-<td align="left" headers="r2c1-t2 r1c2-t2">When starting a new workbench session, be sure to <a href="../org.eclipse.datatools.doc.user/projects/workspace/dmp/en/source/c_database_development_setup.html">reconnect to your database</a> (if you are working online). This allows Dali to provide database-related mapping assistance and validation.</td>
-</tr>
-<tr align="left" valign="top">
-<td align="left" id="r3c1-t2" headers="r1c1-t2"><a id="BABCHAHF" name="BABCHAHF"></a><span class="bold">Schema-based persistence.xml</span></td>
-<td align="left" headers="r3c1-t2 r1c2-t2">If you are behind a firewall, you may need to configure your Eclipse workspace proxy in the <a href="../org.eclipse.platform.doc.user/reference/ref-72.htm">Preferences dialog</a> (<span class="gui-object-action">Preferences &gt; Internet &gt; Proxy Settings</span>) to properly validate a schema-based <code>persistence.xml</code> file.</td>
-</tr>
-</tbody>
-</table>
-<br /></div>
-<!-- class="inftblruleinformal" -->
-<!-- Start Footer -->
-<div class="footer">
-<table class="simple oac_no_warn" summary="" cellspacing="0" cellpadding="0" width="100%">
-<col width="86%" />
-<col width="*" />
-<tr>
-<td align="left"><span class="copyrightlogo">Copyright&nbsp;&copy;&nbsp;2006, 2009,&nbsp;Oracle&nbsp;and/or&nbsp;its&nbsp;affiliates.&nbsp;All&nbsp;rights&nbsp;reserved.</span><br />
-<a href="dcommon/html/cpyr.htm"><span class="copyrightlogo">Legal Notices</span></a></td>
-</tr>
-</table>
-</div>
-<!-- class="footer" -->
-</body>
-</html>
diff --git a/jpa/plugins/org.eclipse.jpt.doc.user/toc.xml b/jpa/plugins/org.eclipse.jpt.doc.user/toc.xml
deleted file mode 100644
index 8251cc9b93..0000000000
--- a/jpa/plugins/org.eclipse.jpt.doc.user/toc.xml
+++ /dev/null
@@ -1,145 +0,0 @@
-<?xml version='1.0' encoding='iso-8859-1'?>
-<!-- User Guide -->
- <toc label="Dali Java Persistence Tools User Guide">
- <topic href="getting_started.htm" label="Getting started">
- <topic href="getting_started001.htm#BABEFHCD" label="Requirements and installation" />
- <topic href="getting_started002.htm#BABIGCJA" label="Dali quick start">
- <topic href="getting_started003.htm#BABDFHDA" label="Creating a new JPA project" />
- <topic href="getting_started004.htm#BABFGDDG" label="Creating a Java persistent entity with persistent fields" />
- </topic>
- </topic>
- <topic href="concepts.htm" label=" Concepts">
- <topic href="concept_persistence.htm#BABCAHIC" label="Understanding Java persistence" />
- <topic href="concept_mapping.htm#BABBDJFI" label="Understanding OR mappings" />
- <topic href="concepts001.htm#BABBGFJG" label="Understanding EJB 3.0 Java Persistence API">
- <topic href="concepts002.htm#CHDHAGIH" label="The persistence.xml file" />
- <topic href="concepts003.htm#CHDBIJAC" label="The orm.xml file" />
- </topic>
- </topic>
- <topic href="tasks.htm" label=" Tasks">
- <topic href="task_create_new_project.htm#CIHHEJCJ" label="Creating a new JPA project" />
- <topic href="tasks001.htm#BEIBADHH" label="Converting a Java Project to a JPA Project" />
- <topic href="task_create_jpa_entity.htm#BABFBJBG" label="Creating a JPA Entity" />
- <topic href="task_manage_persistence.htm#CIHDAJID" label="Managing the persistence.xml file">
- <topic href="tasks002.htm#CIHFEBAI" label="Synchronizing classes" />
- </topic>
- <topic href="task_manage_orm.htm#CIHDGDCD" label="Managing the orm.xml file">
- <topic href="tasks003.htm#sthref59" label="Creating an orm.xml file" />
- <topic href="tasks004.htm#CIHBCDCE" label="Working with orm.xml file" />
- </topic>
- <topic href="task_add_persistence.htm#BABHICAI" label="Adding persistence to a class">
- <topic href="tasks005.htm#BABGBIEE" label="Entity" />
- <topic href="tasks006.htm#BABFEICE" label="Embeddable" />
- <topic href="tasks007.htm#BABDAGCI" label="Mapped superclass" />
- </topic>
- <topic href="task_additonal_tables.htm#CIHGBIEI" label="Specifying additional tables" />
- <topic href="task_inheritance.htm#CIHCCCJD" label="Specifying entity inheritance" />
- <topic href="tasks008.htm#BABIGBGG" label="Creating Named Queries" />
- <topic href="task_mapping.htm#BABDGBIJ" label="Mapping an entity">
- <topic href="tasks009.htm#BABBABCE" label="Basic mapping" />
- <topic href="tasks010.htm#BABCBHDF" label="Embedded mapping" />
- <topic href="tasks011.htm#CIHDIAEE" label="Embedded ID mapping" />
- <topic href="tasks012.htm#BABGCBHG" label="ID mapping" />
- <topic href="tasks013.htm#BABEIEGD" label="Many-to-many mapping" />
- <topic href="tasks014.htm#BABHFAFJ" label="Many-to-one mapping" />
- <topic href="tasks015.htm#BABHGEBD" label="One-to-many mapping" />
- <topic href="tasks016.htm#BABFHBCJ" label="One-to-one mapping" />
- <topic href="tasks017.htm#BABHFHEI" label="Transient mapping" />
- <topic href="tasks018.htm#BABHIBII" label="Version mapping" />
- </topic>
- <topic href="tasks019.htm#BABBAGFI" label="Generating entities from tables" />
- <topic href="tasks020.htm#CIHJIGBE" label="Generating tables from entities" />
- <topic href="tasks021.htm#BABFAIBA" label="Validating mappings and reporting problems">
- <topic href="tasks022.htm#CIHFEDEI" label="Error messages" />
- <topic href="tasks023.htm#CIHGEAIJ" label="Warning messages" />
- </topic>
- <topic href="tasks024.htm#BABDBCBI" label="Modifying persistent project properties" />
- </topic>
- <topic label=" Reference">
- <topic label="Wizards">
- <topic href="ref_new_jpa_project_wizard.htm#CACBJGBG" label="Create New JPA Project wizard">
- <topic href="ref_new_jpa_project.htm#CACBJAGC" label="New JPA Project page" />
- <topic href="ref_java_page.htm#CIAGEBAA" label="Java Page" />
- <topic href="ref_jpa_facet.htm#CACIFDIF" label="JPA Facet page" />
- </topic>
- <topic href="ref_create_jpa_entity_wizard.htm#CIAGGGDF" label="Create JPA Entity wizard">
- <topic href="ref_EntityClassPage.htm#CIAFEIGF" label="Entity Class page" />
- <topic href="ref_EntityPropertiesPage.htm#CIADECIA" label="Entity Properties page" />
- </topic>
- <topic href="reference002.htm#CIAIJCCE" label="Mapping File Wizard">
- <topic href="reference003.htm#CIAJEIDJ" label="Mapping File" />
- </topic>
- <topic href="reference004.htm#CIAGHCGA" label="Generate Tables from Entities Wizard" />
- <topic href="ref_create_custom_entities_wizard.htm#CIAGBFJE" label="Generate Entities from Tables Wizard">
- <topic href="ref_selectTables.htm#CIAHCGEE" label="Select Tables" />
- <topic href="ref_tableAssociations.htm#CIACDICB" label="Table Associations" />
- <topic href="ref_customizeDefaultEntityGeneration.htm#CIAEJDBE" label="Customize Default Entity Generation" />
- <topic href="ref_customizIndividualEntities.htm#CIACIGEE" label="Customize Individual Entities" />
- </topic>
- <topic href="ref_create_new_association_wizard.htm#CIAFGHIF" label="Create New Association">
- <topic href="ref_association_table.htm#CIAGJHDC" label="Association Tables" />
- <topic href="ref_join_columns.htm#CIAEGEEG" label="Join Columns" />
- <topic href="ref_association_cardinality.htm#CIAFIIFH" label="Association Cardinality" />
- </topic>
- </topic>
- <topic label="Property pages">
- <topic href="ref_persistence_prop_view.htm#BABFAEBB" label="JPA Details view (for entities)">
- <topic href="reference006.htm#CACCAGGC" label="General information" />
- <topic href="reference007.htm#CACIJBGH" label="Attribute overrides" />
- <topic href="reference008.htm#CACBHIDA" label="Secondary table information" />
- <topic href="reference009.htm#CACFHGHE" label="Inheritance information" />
- <topic href="reference010.htm#sthref226" label="Queries" />
- </topic>
- <topic href="ref_persistence_map_view.htm#BABIFBAF" label="JPA Details view (for attributes)">
- <topic href="ref_mapping_general.htm#CACBHFIJ" label="General information" />
- <topic href="reference011.htm#CACBAEBC" label="Join Table Information" />
- <topic href="reference012.htm#CACFCEJC" label="Join Columns Information" />
- <topic href="ref_primary_key.htm#CACFCCAB" label="Primary Key Generation information" />
- </topic>
- <topic href="ref_details_orm.htm#CACGDGHC" label="JPA Details view (for orm.xml)">
- <topic href="reference013.htm#CACCACGH" label="General information" />
- <topic href="reference014.htm#CACEAGBG" label="Persistence Unit information" />
- <topic href="reference015.htm#CIAFGAIJ" label="Generators" />
- <topic href="reference016.htm#CIAIBAAJ" label="Queries" />
- <topic href="reference017.htm#CIADGCID" label="Converters" />
- </topic>
- <topic href="ref_persistence_outline.htm#BABEGGFE" label="JPA Structure view" />
- <topic href="ref_persistence_xmll_editor.htm#CIACCHID" label="persistence.xml Editor">
- <topic href="ref_persistence_general.htm#CIACIFGJ" label="General" />
- <topic href="reference018.htm#CIAFFJIE" label="Connection" />
- <topic href="reference019.htm#CIAJAFEG" label="Customization" />
- <topic href="reference020.htm#CIABEDCH" label="Caching" />
- <topic href="reference021.htm#CIABGHHI" label="Logging" />
- <topic href="reference022.htm#CIAFJCHE" label="Options" />
- <topic href="reference023.htm#CIACCFCB" label="Schema Generation" />
- <topic href="reference024.htm#CIAHJDFF" label="Properties" />
- <topic href="reference025.htm#CIAHCJAH" label="Source" />
- </topic>
- </topic>
- <topic label="Preferences">
- <topic href="ref_project_properties.htm#BABJHBCI" label="Project Properties page - Java Persistence Options" />
- </topic>
- <topic label="Dialogs">
- <topic href="reference028.htm#CACCGEHC" label="Edit Join Columns Dialog" />
- <topic href="ref_select_cascade_dialog.htm#CIAFDGIJ" label="Select Cascade dialog" />
- <topic href="ref_eclipselink_mapping_file.htm#CIAEDEJF" label="New EclipseLink Mapping File dialog" />
- <topic href="ref_add_converter.htm#CIAGCGIJ" label="Add Converter dialog" />
- </topic>
- <topic href="ref_persistence_perspective.htm#BABIFBDB" label="JPA Development perspective" />
- <topic label="Icons and buttons">
- <topic href="reference030.htm#CACGEACG" label="Icons" />
- <topic href="reference031.htm#CACDJCEI" label="Buttons" />
- </topic>
- <topic href="reference032.htm#CACBBDIB" label="Dali Developer Documentation" />
- </topic>
- <topic href="tips_and_tricks.htm" label="Tips and tricks">
- <topic href="whats_new001.htm#CJACEDDE" label="JPA Library Management" />
- <topic href="whats_new002.htm#CJADIFHJ" label="New Generate Entities from Tables Wizard" />
- <topic href="whats_new003.htm#CJABIJEC" label="Conversion of Java Projects to JPA Projects" />
- <topic href="whats_new004.htm#CJACJBDA" label="EclipseLink 1.1 Support" />
- <topic href="whats_new005.htm#sthref286" label="Table-per-Concrete-Class Inheritance" />
- </topic>
- <topic href="legal.htm" label=" Legal">
- <topic href="about.htm#sthref288" label="About this content" />
- </topic>
-</toc>
diff --git a/jpa/plugins/org.eclipse.jpt.doc.user/whats_new.htm b/jpa/plugins/org.eclipse.jpt.doc.user/whats_new.htm
deleted file mode 100644
index c70aacc538..0000000000
--- a/jpa/plugins/org.eclipse.jpt.doc.user/whats_new.htm
+++ /dev/null
@@ -1,50 +0,0 @@
-<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN"
- "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
-<html xmlns="http://www.w3.org/1999/xhtml" xml:lang="en" lang="en">
-<head>
-<meta http-equiv="Content-Type" content="text/html; charset=us-ascii" />
-
-<meta http-equiv="Content-Style-Type" content="text/css" />
-<meta http-equiv="Content-Script-Type" content="text/javascript" />
-<title>What's new</title>
-<meta name="generator" content="Oracle DARB XHTML Converter (Mode = ohj/ohw) - Version 5.1.1 Build 004" />
-<meta name="date" content="2009-05-01T8:12:54Z" />
-<meta name="robots" content="noarchive" />
-<meta name="doctitle" content=" What's new" />
-<meta name="relnum" content="Release 2.2" />
-<meta name="copyright" content="Copyright (c) 2000, 2008 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. Contributors: Oracle - initial API and implementation" />
-<link rel="copyright" href="dcommon/html/cpyr.htm" title="Copyright" type="text/html" />
-<link rel="stylesheet" href="dcommon/css/blafdoc.css" title="Oracle BLAFDoc" type="text/css" />
-<!-- contents -->
-</head>
-<body>
-<p><a id="sthref285" name="sthref285"></a> What's new</p>
-<p>This section contains descriptions of the following new features and significant changes made to the Dali OR Mapping Tool for Release 2.2:</p>
-<ul>
-<li>
-<p><a href="whats_new001.htm#CJACEDDE">JPA Library Management</a></p>
-</li>
-<li>
-<p><a href="whats_new002.htm#CJADIFHJ">New Generate Entities from Tables Wizard</a></p>
-</li>
-<li>
-<p><a href="whats_new003.htm#CJABIJEC">Conversion of Java Projects to JPA Projects</a></p>
-</li>
-<li>
-<p><a href="whats_new004.htm#CJACJBDA">EclipseLink 1.1 Support</a></p>
-</li>
-</ul>
-<!-- Start Footer -->
-<div class="footer">
-<table class="simple oac_no_warn" summary="" cellspacing="0" cellpadding="0" width="100%">
-<col width="86%" />
-<col width="*" />
-<tr>
-<td align="left"><span class="copyrightlogo">Copyright&nbsp;&copy;&nbsp;2006, 2009,&nbsp;Oracle&nbsp;and/or&nbsp;its&nbsp;affiliates.&nbsp;All&nbsp;rights&nbsp;reserved.</span><br />
-<a href="dcommon/html/cpyr.htm"><span class="copyrightlogo">Legal Notices</span></a></td>
-</tr>
-</table>
-</div>
-<!-- class="footer" -->
-</body>
-</html>
diff --git a/jpa/plugins/org.eclipse.jpt.doc.user/whats_new001.htm b/jpa/plugins/org.eclipse.jpt.doc.user/whats_new001.htm
deleted file mode 100644
index db4d103848..0000000000
--- a/jpa/plugins/org.eclipse.jpt.doc.user/whats_new001.htm
+++ /dev/null
@@ -1,41 +0,0 @@
-<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN"
- "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
-<html xmlns="http://www.w3.org/1999/xhtml" xml:lang="en" lang="en">
-<head>
-<meta http-equiv="Content-Type" content="text/html; charset=us-ascii" />
-
-<meta http-equiv="Content-Style-Type" content="text/css" />
-<meta http-equiv="Content-Script-Type" content="text/javascript" />
-<title>JPA Library Management</title>
-<meta name="generator" content="Oracle DARB XHTML Converter (Mode = ohj/ohw) - Version 5.1.1 Build 004" />
-<meta name="date" content="2009-05-01T8:12:54Z" />
-<meta name="robots" content="noarchive" />
-<meta name="doctitle" content="JPA Library Management" />
-<meta name="relnum" content="Release 2.2" />
-<meta name="copyright" content="Copyright (c) 2000, 2008 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. Contributors: Oracle - initial API and implementation" />
-<link rel="copyright" href="dcommon/html/cpyr.htm" title="Copyright" type="text/html" />
-<link rel="stylesheet" href="dcommon/css/blafdoc.css" title="Oracle BLAFDoc" type="text/css" />
-<!-- contents -->
-</head>
-<body>
-<p><a id="CJACEDDE" name="CJACEDDE"></a></p>
-<div class="sect1"><!-- infolevel="all" infotype="General" -->
-<h1>JPA Library Management</h1>
-<p>Use the new <a href="ref_jpa_facet.htm#CACIFDIF">JPA Facet page</a> to create and manage JPA libraries when creating a new JPA project. You can specify a JPA library configuration from a selected JPA implementation, or create a custom library.</p>
-<p>The Dali OR Mapping Tool will automatically validate the library to ensure that the correct classes are available for a given platform.</p>
-</div>
-<!-- class="sect1" -->
-<!-- Start Footer -->
-<div class="footer">
-<table class="simple oac_no_warn" summary="" cellspacing="0" cellpadding="0" width="100%">
-<col width="86%" />
-<col width="*" />
-<tr>
-<td align="left"><span class="copyrightlogo">Copyright&nbsp;&copy;&nbsp;2006, 2009,&nbsp;Oracle&nbsp;and/or&nbsp;its&nbsp;affiliates.&nbsp;All&nbsp;rights&nbsp;reserved.</span><br />
-<a href="dcommon/html/cpyr.htm"><span class="copyrightlogo">Legal Notices</span></a></td>
-</tr>
-</table>
-</div>
-<!-- class="footer" -->
-</body>
-</html>
diff --git a/jpa/plugins/org.eclipse.jpt.doc.user/whats_new002.htm b/jpa/plugins/org.eclipse.jpt.doc.user/whats_new002.htm
deleted file mode 100644
index abdaeb3c7b..0000000000
--- a/jpa/plugins/org.eclipse.jpt.doc.user/whats_new002.htm
+++ /dev/null
@@ -1,41 +0,0 @@
-<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN"
- "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
-<html xmlns="http://www.w3.org/1999/xhtml" xml:lang="en" lang="en">
-<head>
-<meta http-equiv="Content-Type" content="text/html; charset=us-ascii" />
-
-<meta http-equiv="Content-Style-Type" content="text/css" />
-<meta http-equiv="Content-Script-Type" content="text/javascript" />
-<title>New Generate Entities from Tables Wizard</title>
-<meta name="generator" content="Oracle DARB XHTML Converter (Mode = ohj/ohw) - Version 5.1.1 Build 004" />
-<meta name="date" content="2009-05-01T8:12:54Z" />
-<meta name="robots" content="noarchive" />
-<meta name="doctitle" content="New Generate Entities from Tables Wizard" />
-<meta name="relnum" content="Release 2.2" />
-<meta name="copyright" content="Copyright (c) 2000, 2008 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. Contributors: Oracle - initial API and implementation" />
-<link rel="copyright" href="dcommon/html/cpyr.htm" title="Copyright" type="text/html" />
-<link rel="stylesheet" href="dcommon/css/blafdoc.css" title="Oracle BLAFDoc" type="text/css" />
-<!-- contents -->
-</head>
-<body>
-<p><a id="CJADIFHJ" name="CJADIFHJ"></a></p>
-<div class="sect1"><!-- infolevel="all" infotype="General" -->
-<h1>New Generate Entities from Tables Wizard</h1>
-<p>Use the new <a href="ref_create_custom_entities_wizard.htm#CIAGBFJE">Generate Entities from Tables Wizard</a> to create JPA entities from your database tables.</p>
-<p>The Dali OR Mapping Tool allows you to select the tables from which to generate entities, the table associations, and default entity properties. You can then customize each individual entity being generated.</p>
-</div>
-<!-- class="sect1" -->
-<!-- Start Footer -->
-<div class="footer">
-<table class="simple oac_no_warn" summary="" cellspacing="0" cellpadding="0" width="100%">
-<col width="86%" />
-<col width="*" />
-<tr>
-<td align="left"><span class="copyrightlogo">Copyright&nbsp;&copy;&nbsp;2006, 2009,&nbsp;Oracle&nbsp;and/or&nbsp;its&nbsp;affiliates.&nbsp;All&nbsp;rights&nbsp;reserved.</span><br />
-<a href="dcommon/html/cpyr.htm"><span class="copyrightlogo">Legal Notices</span></a></td>
-</tr>
-</table>
-</div>
-<!-- class="footer" -->
-</body>
-</html>
diff --git a/jpa/plugins/org.eclipse.jpt.doc.user/whats_new003.htm b/jpa/plugins/org.eclipse.jpt.doc.user/whats_new003.htm
deleted file mode 100644
index e13a1864f0..0000000000
--- a/jpa/plugins/org.eclipse.jpt.doc.user/whats_new003.htm
+++ /dev/null
@@ -1,41 +0,0 @@
-<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN"
- "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
-<html xmlns="http://www.w3.org/1999/xhtml" xml:lang="en" lang="en">
-<head>
-<meta http-equiv="Content-Type" content="text/html; charset=us-ascii" />
-
-<meta http-equiv="Content-Style-Type" content="text/css" />
-<meta http-equiv="Content-Script-Type" content="text/javascript" />
-<title>Conversion of Java Projects to JPA Projects</title>
-<meta name="generator" content="Oracle DARB XHTML Converter (Mode = ohj/ohw) - Version 5.1.1 Build 004" />
-<meta name="date" content="2009-05-01T8:12:54Z" />
-<meta name="robots" content="noarchive" />
-<meta name="doctitle" content="Conversion of Java Projects to JPA Projects" />
-<meta name="relnum" content="Release 2.2" />
-<meta name="copyright" content="Copyright (c) 2000, 2008 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. Contributors: Oracle - initial API and implementation" />
-<link rel="copyright" href="dcommon/html/cpyr.htm" title="Copyright" type="text/html" />
-<link rel="stylesheet" href="dcommon/css/blafdoc.css" title="Oracle BLAFDoc" type="text/css" />
-<!-- contents -->
-</head>
-<body>
-<p><a id="CJABIJEC" name="CJABIJEC"></a></p>
-<div class="sect1"><!-- infolevel="all" infotype="General" -->
-<h1>Conversion of Java Projects to JPA Projects</h1>
-<p>The Dali OR Mapping Tool now uses the Eclipse <span class="bold">Configure</span> menu to convert existing Java projects to JPA projects.</p>
-<p>See <a href="tasks001.htm#BEIBADHH">"Converting a Java Project to a JPA Project"</a> for more information.</p>
-</div>
-<!-- class="sect1" -->
-<!-- Start Footer -->
-<div class="footer">
-<table class="simple oac_no_warn" summary="" cellspacing="0" cellpadding="0" width="100%">
-<col width="86%" />
-<col width="*" />
-<tr>
-<td align="left"><span class="copyrightlogo">Copyright&nbsp;&copy;&nbsp;2006, 2009,&nbsp;Oracle&nbsp;and/or&nbsp;its&nbsp;affiliates.&nbsp;All&nbsp;rights&nbsp;reserved.</span><br />
-<a href="dcommon/html/cpyr.htm"><span class="copyrightlogo">Legal Notices</span></a></td>
-</tr>
-</table>
-</div>
-<!-- class="footer" -->
-</body>
-</html>
diff --git a/jpa/plugins/org.eclipse.jpt.doc.user/whats_new004.htm b/jpa/plugins/org.eclipse.jpt.doc.user/whats_new004.htm
deleted file mode 100644
index 4a4273bd7a..0000000000
--- a/jpa/plugins/org.eclipse.jpt.doc.user/whats_new004.htm
+++ /dev/null
@@ -1,49 +0,0 @@
-<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN"
- "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
-<html xmlns="http://www.w3.org/1999/xhtml" xml:lang="en" lang="en">
-<head>
-<meta http-equiv="Content-Type" content="text/html; charset=us-ascii" />
-
-<meta http-equiv="Content-Style-Type" content="text/css" />
-<meta http-equiv="Content-Script-Type" content="text/javascript" />
-<title>EclipseLink 1.1 Support</title>
-<meta name="generator" content="Oracle DARB XHTML Converter (Mode = ohj/ohw) - Version 5.1.1 Build 004" />
-<meta name="date" content="2009-05-01T8:12:54Z" />
-<meta name="robots" content="noarchive" />
-<meta name="doctitle" content="EclipseLink 1.1 Support" />
-<meta name="relnum" content="Release 2.2" />
-<meta name="copyright" content="Copyright (c) 2000, 2008 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. Contributors: Oracle - initial API and implementation" />
-<link rel="copyright" href="dcommon/html/cpyr.htm" title="Copyright" type="text/html" />
-<link rel="stylesheet" href="dcommon/css/blafdoc.css" title="Oracle BLAFDoc" type="text/css" />
-<!-- contents -->
-</head>
-<body>
-<p><a id="CJACJBDA" name="CJACJBDA"></a></p>
-<div class="sect1"><!-- infolevel="all" infotype="General" -->
-<h1>EclipseLink 1.1 Support</h1>
-<p>Release 2.2 provides support of the following EclipseLink 1.1 features.</p>
-<ul>
-<li>
-<p>EclipseLink XML mapping file and its configuration options</p>
-</li>
-<li>
-<p>One-to-Many mapping <span class="italic">without</span> a join table.</p>
-</li>
-</ul>
-<p>EclipseLink (the Eclipse Persistence Services Project) is a complete persistence frame work. Refer to <code><a href="http://www.eclipse.org/eclipselink/">http://www.eclipse.org/eclipselink/</a></code> for more information.</p>
-</div>
-<!-- class="sect1" -->
-<!-- Start Footer -->
-<div class="footer">
-<table class="simple oac_no_warn" summary="" cellspacing="0" cellpadding="0" width="100%">
-<col width="86%" />
-<col width="*" />
-<tr>
-<td align="left"><span class="copyrightlogo">Copyright&nbsp;&copy;&nbsp;2006, 2009,&nbsp;Oracle&nbsp;and/or&nbsp;its&nbsp;affiliates.&nbsp;All&nbsp;rights&nbsp;reserved.</span><br />
-<a href="dcommon/html/cpyr.htm"><span class="copyrightlogo">Legal Notices</span></a></td>
-</tr>
-</table>
-</div>
-<!-- class="footer" -->
-</body>
-</html>
diff --git a/jpa/plugins/org.eclipse.jpt.doc.user/whats_new005.htm b/jpa/plugins/org.eclipse.jpt.doc.user/whats_new005.htm
deleted file mode 100644
index ecca4861d9..0000000000
--- a/jpa/plugins/org.eclipse.jpt.doc.user/whats_new005.htm
+++ /dev/null
@@ -1,39 +0,0 @@
-<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN"
- "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
-<html xmlns="http://www.w3.org/1999/xhtml" xml:lang="en" lang="en">
-<head>
-<meta http-equiv="Content-Type" content="text/html; charset=us-ascii" />
-
-<meta http-equiv="Content-Style-Type" content="text/css" />
-<meta http-equiv="Content-Script-Type" content="text/javascript" />
-<title>Table-per-Concrete-Class Inheritance</title>
-<meta name="generator" content="Oracle DARB XHTML Converter (Mode = ohj/ohw) - Version 5.1.1 Build 004" />
-<meta name="date" content="2009-05-01T8:12:54Z" />
-<meta name="robots" content="noarchive" />
-<meta name="doctitle" content="Table-per-Concrete-Class Inheritance" />
-<meta name="relnum" content="Release 2.2" />
-<meta name="copyright" content="Copyright (c) 2000, 2008 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. Contributors: Oracle - initial API and implementation" />
-<link rel="copyright" href="dcommon/html/cpyr.htm" title="Copyright" type="text/html" />
-<link rel="stylesheet" href="dcommon/css/blafdoc.css" title="Oracle BLAFDoc" type="text/css" />
-<!-- contents -->
-</head>
-<body>
-<div class="sect1"><!-- infolevel="all" infotype="General" --><a id="sthref286" name="sthref286"></a>
-<h1>Table-per-Concrete-Class Inheritance</h1>
-<p>The Dali OR Mapping Tool now supports the JPA 1.0-optional table-per-concrete-class inheritance option. This functionality may be required in JPA 2.0.</p>
-</div>
-<!-- class="sect1" -->
-<!-- Start Footer -->
-<div class="footer">
-<table class="simple oac_no_warn" summary="" cellspacing="0" cellpadding="0" width="100%">
-<col width="86%" />
-<col width="*" />
-<tr>
-<td align="left"><span class="copyrightlogo">Copyright&nbsp;&copy;&nbsp;2006, 2009,&nbsp;Oracle&nbsp;and/or&nbsp;its&nbsp;affiliates.&nbsp;All&nbsp;rights&nbsp;reserved.</span><br />
-<a href="dcommon/html/cpyr.htm"><span class="copyrightlogo">Legal Notices</span></a></td>
-</tr>
-</table>
-</div>
-<!-- class="footer" -->
-</body>
-</html>
diff --git a/jpa/plugins/org.eclipse.jpt.eclipselink.branding/.cvsignore b/jpa/plugins/org.eclipse.jpt.eclipselink.branding/.cvsignore
deleted file mode 100644
index c14487ceac..0000000000
--- a/jpa/plugins/org.eclipse.jpt.eclipselink.branding/.cvsignore
+++ /dev/null
@@ -1 +0,0 @@
-build.xml
diff --git a/jpa/plugins/org.eclipse.jpt.eclipselink.branding/.project b/jpa/plugins/org.eclipse.jpt.eclipselink.branding/.project
deleted file mode 100644
index e29a7c662f..0000000000
--- a/jpa/plugins/org.eclipse.jpt.eclipselink.branding/.project
+++ /dev/null
@@ -1,22 +0,0 @@
-<?xml version="1.0" encoding="UTF-8"?>
-<projectDescription>
- <name>org.eclipse.jpt.eclipselink.branding</name>
- <comment></comment>
- <projects>
- </projects>
- <buildSpec>
- <buildCommand>
- <name>org.eclipse.pde.ManifestBuilder</name>
- <arguments>
- </arguments>
- </buildCommand>
- <buildCommand>
- <name>org.eclipse.pde.SchemaBuilder</name>
- <arguments>
- </arguments>
- </buildCommand>
- </buildSpec>
- <natures>
- <nature>org.eclipse.pde.PluginNature</nature>
- </natures>
-</projectDescription>
diff --git a/jpa/plugins/org.eclipse.jpt.eclipselink.branding/.settings/org.eclipse.core.resources.prefs b/jpa/plugins/org.eclipse.jpt.eclipselink.branding/.settings/org.eclipse.core.resources.prefs
deleted file mode 100644
index 4aec29d1cd..0000000000
--- a/jpa/plugins/org.eclipse.jpt.eclipselink.branding/.settings/org.eclipse.core.resources.prefs
+++ /dev/null
@@ -1,3 +0,0 @@
-#Sun May 27 15:10:09 EDT 2007
-eclipse.preferences.version=1
-encoding/<project>=ISO-8859-1
diff --git a/jpa/plugins/org.eclipse.jpt.eclipselink.branding/META-INF/MANIFEST.MF b/jpa/plugins/org.eclipse.jpt.eclipselink.branding/META-INF/MANIFEST.MF
deleted file mode 100644
index 1436c7fd3c..0000000000
--- a/jpa/plugins/org.eclipse.jpt.eclipselink.branding/META-INF/MANIFEST.MF
+++ /dev/null
@@ -1,7 +0,0 @@
-Manifest-Version: 1.0
-Bundle-ManifestVersion: 2
-Bundle-Name: %pluginName
-Bundle-SymbolicName: org.eclipse.jpt.eclipselink.branding;singleton:=true
-Bundle-Version: 2.2.0.qualifier
-Bundle-Localization: plugin
-Bundle-Vendor: %providerName
diff --git a/jpa/plugins/org.eclipse.jpt.eclipselink.branding/about.html b/jpa/plugins/org.eclipse.jpt.eclipselink.branding/about.html
deleted file mode 100644
index ca606b1bb5..0000000000
--- a/jpa/plugins/org.eclipse.jpt.eclipselink.branding/about.html
+++ /dev/null
@@ -1,34 +0,0 @@
-<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.0//EN">
-<HTML>
-
-<head>
-<title>About</title>
-<meta http-equiv=Content-Type content="text/html; charset=ISO-8859-1">
-</head>
-
-<BODY lang="EN-US">
-
-<H3>About This Content</H3>
-
-<P>June 06, 2007</P>
-
-<H3>License</H3>
-
-<P>The Eclipse Foundation makes available all content in this plug-in
-("Content"). Unless otherwise indicated below, the Content is provided to you
-under the terms and conditions of the Eclipse Public License Version 1.0
-("EPL"). A copy of the EPL is available at
-<A href="http://www.eclipse.org/org/documents/epl-v10.php">http://www.eclipse.org/org/documents/epl-v10.php</A>.
-For purposes of the EPL, "Program" will mean the Content.</P>
-
-<P>If you did not receive this Content directly from the Eclipse Foundation, the
-Content is being redistributed by another party ("Redistributor") and different
-terms and conditions may apply to your use of any object code in the Content.
-Check the Redistributor's license that was provided with the Content. If no such
-license exists, contact the Redistributor. Unless otherwise indicated below, the
-terms and conditions of the EPL still apply to any source code in the Content
-and such source code may be obtained at
-<A href="http://www.eclipse.org/">http://www.eclipse.org/</A>.</P>
-
-</BODY>
-</HTML> \ No newline at end of file
diff --git a/jpa/plugins/org.eclipse.jpt.eclipselink.branding/about.ini b/jpa/plugins/org.eclipse.jpt.eclipselink.branding/about.ini
deleted file mode 100644
index 7d88b9d396..0000000000
--- a/jpa/plugins/org.eclipse.jpt.eclipselink.branding/about.ini
+++ /dev/null
@@ -1,44 +0,0 @@
-###############################################################################
-# Copyright (c) 2006, 2009 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
-#
-# Contributors:
-# Oracle. - initial API and implementation
-###############################################################################
-
-# about.ini
-# contains information about a feature
-# java.io.Properties file (ISO 8859-1 with "\" escapes)
-# "%key" are externalized strings defined in about.properties
-# This file does not need to be translated.
-
-# Property "aboutText" contains blurb for "About" dialog (translated)
-aboutText=%blurb
-
-# Property "windowImage" contains path to window icon (16x16)
-# needed for primary features only
-
-# Property "featureImage" contains path to feature image (32x32)
-featureImage=icons/WTP_icon_x32_v2.png
-
-# Property "aboutImage" contains path to product image (500x330 or 115x164)
-# needed for primary features only
-
-# Property "appName" contains name of the application (translated)
-# needed for primary features only
-
-# Property "welcomePage" contains path to welcome page (special XML-based format)
-# optional
-
-# Property "welcomePerspective" contains the id of the perspective in which the
-# welcome page is to be opened.
-# optional
-
-# Property "tipsAndTricksHref" contains the Help topic href to a tips and tricks page
-# optional
-tipsAndTricksHref=/org.eclipse.jpt.doc.user/tips_and_tricks.htm
-
-
diff --git a/jpa/plugins/org.eclipse.jpt.eclipselink.branding/about.mappings b/jpa/plugins/org.eclipse.jpt.eclipselink.branding/about.mappings
deleted file mode 100644
index bddaab4310..0000000000
--- a/jpa/plugins/org.eclipse.jpt.eclipselink.branding/about.mappings
+++ /dev/null
@@ -1,6 +0,0 @@
-# about.mappings
-# contains fill-ins for about.properties
-# java.io.Properties file (ISO 8859-1 with "\" escapes)
-# This file does not need to be translated.
-
-0=@build@ \ No newline at end of file
diff --git a/jpa/plugins/org.eclipse.jpt.eclipselink.branding/about.properties b/jpa/plugins/org.eclipse.jpt.eclipselink.branding/about.properties
deleted file mode 100644
index af0e36f3e0..0000000000
--- a/jpa/plugins/org.eclipse.jpt.eclipselink.branding/about.properties
+++ /dev/null
@@ -1,24 +0,0 @@
-###############################################################################
-# Copyright (c) 2006, 2009 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
-#
-# Contributors:
-# Oracle. - initial API and implementation
-###############################################################################
-
-# about.properties
-# contains externalized strings for about.ini
-# java.io.Properties file (ISO 8859-1 with "\" escapes)
-# fill-ins are supplied by about.mappings
-# This file should be translated.
-
-blurb=Dali Java Persistence Tools - EclipseLink Support\n\
-\n\
-Version: {featureVersion}\n\
-Build id: {0}\n\
-\n\
-(c) Copyright Oracle contributors and others 2006, 2009. All rights reserved.\n\
-Visit http://www.eclipse.org/webtools
diff --git a/jpa/plugins/org.eclipse.jpt.eclipselink.branding/build.properties b/jpa/plugins/org.eclipse.jpt.eclipselink.branding/build.properties
deleted file mode 100644
index 8ce4550c10..0000000000
--- a/jpa/plugins/org.eclipse.jpt.eclipselink.branding/build.properties
+++ /dev/null
@@ -1,17 +0,0 @@
-###############################################################################
-# Copyright (c) 2006, 2009 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
-#
-# Contributors:
-# Oracle. - initial API and implementation
-###############################################################################
-bin.includes = META-INF/,\
- about.ini,\
- about.html,\
- about.mappings,\
- about.properties,\
- icons/,\
- plugin.properties
diff --git a/jpa/plugins/org.eclipse.jpt.eclipselink.branding/icons/WTP_icon_x32_v2.png b/jpa/plugins/org.eclipse.jpt.eclipselink.branding/icons/WTP_icon_x32_v2.png
deleted file mode 100644
index 6f09c2a700..0000000000
--- a/jpa/plugins/org.eclipse.jpt.eclipselink.branding/icons/WTP_icon_x32_v2.png
+++ /dev/null
Binary files differ
diff --git a/jpa/plugins/org.eclipse.jpt.eclipselink.branding/plugin.properties b/jpa/plugins/org.eclipse.jpt.eclipselink.branding/plugin.properties
deleted file mode 100644
index 33c60d39c3..0000000000
--- a/jpa/plugins/org.eclipse.jpt.eclipselink.branding/plugin.properties
+++ /dev/null
@@ -1,13 +0,0 @@
-###############################################################################
-# Copyright (c) 2006, 2009 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
-#
-# Contributors:
-# Oracle. - initial API and implementation
-###############################################################################
-
-pluginName = Dali Java Persistence Tools - EclipseLink Support
-providerName = Eclipse Web Tools Platform
diff --git a/jpa/plugins/org.eclipse.jpt.eclipselink.core.ddlgen/.classpath b/jpa/plugins/org.eclipse.jpt.eclipselink.core.ddlgen/.classpath
deleted file mode 100644
index 9600ce84df..0000000000
--- a/jpa/plugins/org.eclipse.jpt.eclipselink.core.ddlgen/.classpath
+++ /dev/null
@@ -1,8 +0,0 @@
-<?xml version="1.0" encoding="UTF-8"?>
-<classpath>
- <classpathentry kind="con" path="org.eclipse.jdt.launching.JRE_CONTAINER/org.eclipse.jdt.internal.debug.ui.launcher.StandardVMType/J2SE-1.5"/>
- <classpathentry kind="con" path="org.eclipse.pde.core.requiredPlugins"/>
- <classpathentry kind="src" path="src"/>
- <classpathentry exported="true" kind="lib" path="lib/persistence.jar" sourcepath="org.eclipse.jpt.eclipselink.core.ddlgensrc.zip"/>
- <classpathentry kind="output" path="bin"/>
-</classpath>
diff --git a/jpa/plugins/org.eclipse.jpt.eclipselink.core.ddlgen/.cvsignore b/jpa/plugins/org.eclipse.jpt.eclipselink.core.ddlgen/.cvsignore
deleted file mode 100644
index c5e82d7458..0000000000
--- a/jpa/plugins/org.eclipse.jpt.eclipselink.core.ddlgen/.cvsignore
+++ /dev/null
@@ -1 +0,0 @@
-bin \ No newline at end of file
diff --git a/jpa/plugins/org.eclipse.jpt.eclipselink.core.ddlgen/.project b/jpa/plugins/org.eclipse.jpt.eclipselink.core.ddlgen/.project
deleted file mode 100644
index 376311f646..0000000000
--- a/jpa/plugins/org.eclipse.jpt.eclipselink.core.ddlgen/.project
+++ /dev/null
@@ -1,28 +0,0 @@
-<?xml version="1.0" encoding="UTF-8"?>
-<projectDescription>
- <name>org.eclipse.jpt.eclipselink.core.ddlgen</name>
- <comment></comment>
- <projects>
- </projects>
- <buildSpec>
- <buildCommand>
- <name>org.eclipse.jdt.core.javabuilder</name>
- <arguments>
- </arguments>
- </buildCommand>
- <buildCommand>
- <name>org.eclipse.pde.ManifestBuilder</name>
- <arguments>
- </arguments>
- </buildCommand>
- <buildCommand>
- <name>org.eclipse.pde.SchemaBuilder</name>
- <arguments>
- </arguments>
- </buildCommand>
- </buildSpec>
- <natures>
- <nature>org.eclipse.jdt.core.javanature</nature>
- <nature>org.eclipse.pde.PluginNature</nature>
- </natures>
-</projectDescription>
diff --git a/jpa/plugins/org.eclipse.jpt.eclipselink.core.ddlgen/.settings/org.eclipse.jdt.core.prefs b/jpa/plugins/org.eclipse.jpt.eclipselink.core.ddlgen/.settings/org.eclipse.jdt.core.prefs
deleted file mode 100644
index 8041bc2076..0000000000
--- a/jpa/plugins/org.eclipse.jpt.eclipselink.core.ddlgen/.settings/org.eclipse.jdt.core.prefs
+++ /dev/null
@@ -1,7 +0,0 @@
-#Wed Apr 30 17:24:41 EDT 2008
-eclipse.preferences.version=1
-org.eclipse.jdt.core.compiler.codegen.targetPlatform=1.5
-org.eclipse.jdt.core.compiler.compliance=1.5
-org.eclipse.jdt.core.compiler.problem.assertIdentifier=error
-org.eclipse.jdt.core.compiler.problem.enumIdentifier=error
-org.eclipse.jdt.core.compiler.source=1.5
diff --git a/jpa/plugins/org.eclipse.jpt.eclipselink.core.ddlgen/META-INF/MANIFEST.MF b/jpa/plugins/org.eclipse.jpt.eclipselink.core.ddlgen/META-INF/MANIFEST.MF
deleted file mode 100644
index 27a32d3cf9..0000000000
--- a/jpa/plugins/org.eclipse.jpt.eclipselink.core.ddlgen/META-INF/MANIFEST.MF
+++ /dev/null
@@ -1,13 +0,0 @@
-Manifest-Version: 1.0
-Bundle-ManifestVersion: 2
-Bundle-Name: %pluginName
-Bundle-Vendor: %providerName
-Bundle-SymbolicName: org.eclipse.jpt.eclipselink.core.ddlgen;singleton:=true
-Bundle-Version: 1.0.200.qualifier
-Bundle-ClassPath: lib/persistence.jar
-Bundle-Localization: plugin
-Require-Bundle: org.eclipse.jpt.eclipselink.core;bundle-version="[1.0.0,2.0.0)"
-Export-Package: javax.persistence,
- javax.persistence.spi,
- org.eclipse.jpt.eclipselink.core.ddlgen
-Bundle-RequiredExecutionEnvironment: J2SE-1.5
diff --git a/jpa/plugins/org.eclipse.jpt.eclipselink.core.ddlgen/about.html b/jpa/plugins/org.eclipse.jpt.eclipselink.core.ddlgen/about.html
deleted file mode 100644
index 071f586b21..0000000000
--- a/jpa/plugins/org.eclipse.jpt.eclipselink.core.ddlgen/about.html
+++ /dev/null
@@ -1,47 +0,0 @@
-<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.0//EN">
-<HTML>
-
-<head>
-<title>About</title>
-<meta http-equiv=Content-Type content="text/html; charset=ISO-8859-1">
-</head>
-
-<BODY lang="EN-US">
-
-<H2>About This Content</H2>
-
-<P>May 02, 2008</P>
-
-<H3>License</H3>
-
-<P>The Eclipse Foundation makes available all content in this plug-in
-("Content"). Unless otherwise indicated below, the Content is provided to you
-under the terms and conditions of the Eclipse Public License Version 1.0
-("EPL"). A copy of the EPL is available at
-<A href="http://www.eclipse.org/org/documents/epl-v10.php">http://www.eclipse.org/org/documents/epl-v10.php</A>.
-For purposes of the EPL, "Program" will mean the Content.</P>
-
-<P>If you did not receive this Content directly from the Eclipse Foundation, the
-Content is being redistributed by another party ("Redistributor") and different
-terms and conditions may apply to your use of any object code in the Content.
-Check the Redistributor's license that was provided with the Content. If no such
-license exists, contact the Redistributor. Unless otherwise indicated below, the
-terms and conditions of the EPL still apply to any source code in the Content
-and such source code may be obtained at
-<A href="http://www.eclipse.org/">http://www.eclipse.org/</A>.</P>
-
-<h3>Third Party Content</h3>
-<p>The Content includes items that have been sourced from third parties as set
- out below. If you did not receive this Content directly from the Eclipse Foundation,
- the following is provided for informational purposes only, and you should look
- to the Redistributor&#8217;s license for terms and conditions of use.</p>
-
-<h4><a name="JPA" id="JPA"></a>Java Persistence API (JPA) v1.0</h4>
-
-<blockquote>
- <p>The Java Persistence API (JPA) which is distributed under <a href="https://glassfish.dev.java.net/public/CDDLv1.0.html">CDDL
- v1.0</a> is required by the Dali Java Persistence Tools Project in order
- to support this standard.</p>
-</blockquote>
-</BODY>
-</HTML>
diff --git a/jpa/plugins/org.eclipse.jpt.eclipselink.core.ddlgen/build.properties b/jpa/plugins/org.eclipse.jpt.eclipselink.core.ddlgen/build.properties
deleted file mode 100644
index 0f7bce31e6..0000000000
--- a/jpa/plugins/org.eclipse.jpt.eclipselink.core.ddlgen/build.properties
+++ /dev/null
@@ -1,20 +0,0 @@
-###############################################################################
-# Copyright (c) 2006, 2008 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
-#
-# Contributors:
-# Oracle. - initial API and implementation
-###############################################################################
-javacSource=1.5
-javacTarget=1.5
-source.. = src/
-output.. = bin/
-bin.includes = .,\
- META-INF/,\
- lib/persistence.jar,\
- about.html,\
- plugin.properties
-jars.compile.order = .
diff --git a/jpa/plugins/org.eclipse.jpt.eclipselink.core.ddlgen/lib/persistence.jar b/jpa/plugins/org.eclipse.jpt.eclipselink.core.ddlgen/lib/persistence.jar
deleted file mode 100644
index 1a1b232921..0000000000
--- a/jpa/plugins/org.eclipse.jpt.eclipselink.core.ddlgen/lib/persistence.jar
+++ /dev/null
Binary files differ
diff --git a/jpa/plugins/org.eclipse.jpt.eclipselink.core.ddlgen/plugin.properties b/jpa/plugins/org.eclipse.jpt.eclipselink.core.ddlgen/plugin.properties
deleted file mode 100644
index ea3ef1dcee..0000000000
--- a/jpa/plugins/org.eclipse.jpt.eclipselink.core.ddlgen/plugin.properties
+++ /dev/null
@@ -1,24 +0,0 @@
-###############################################################################
-# Copyright (c) 2006, 2008 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
-#
-# Contributors:
-# Oracle. - initial API and implementation
-###############################################################################
-# ====================================================================
-# To code developer:
-# Do NOT change the properties between this line and the
-# "%%% END OF TRANSLATED PROPERTIES %%%" line.
-# Make a new property name, append to the end of the file and change
-# the code to use the new property.
-# ====================================================================
-
-# ====================================================================
-# %%% END OF TRANSLATED PROPERTIES %%%
-# ====================================================================
-
-pluginName = Dali Java Persistence Tools - EclipseLink Support - DDL Generation
-providerName = Eclipse Web Tools Platform
diff --git a/jpa/plugins/org.eclipse.jpt.eclipselink.core.ddlgen/src/org/eclipse/jpt/eclipselink/core/ddlgen/Main.java b/jpa/plugins/org.eclipse.jpt.eclipselink.core.ddlgen/src/org/eclipse/jpt/eclipselink/core/ddlgen/Main.java
deleted file mode 100644
index c1b91c325b..0000000000
--- a/jpa/plugins/org.eclipse.jpt.eclipselink.core.ddlgen/src/org/eclipse/jpt/eclipselink/core/ddlgen/Main.java
+++ /dev/null
@@ -1,217 +0,0 @@
-/*******************************************************************************
-* Copyright (c) 2007, 2008 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.
-*
-* Contributors:
-* Oracle - initial API and implementation
-*******************************************************************************/
-package org.eclipse.jpt.eclipselink.core.ddlgen;
-
-import java.io.File;
-import java.io.FileInputStream;
-import java.io.IOException;
-import java.util.HashMap;
-import java.util.Map;
-import java.util.Properties;
-import java.util.Set;
-import java.util.Map.Entry;
-import javax.persistence.EntityManagerFactory;
-import javax.persistence.Persistence;
-import org.eclipse.jpt.eclipselink.core.internal.context.persistence.schema.generation.SchemaGeneration;
-
-/**
- * This class creates a EclipseLink <code>EntityManagerFactory</code>,
- * and executes the DDL generator with the command set in the properties:
- * <code>eclipselink.ddl-generation.output-mode</code>
- * <code>eclipselink.application-location</code>
- *
- * Current command-line arguments:
- * [-pu puName] - persistence unit name
- * [-p propertiesFilePath] - properties for EclipseLink EntityManager
- *
- * Example of a properties file:
- * eclipselink.jdbc.bind-parameters=false
- * eclipselink.jdbc.driver=org.apache.derby.jdbc.EmbeddedDriver
- * eclipselink.jdbc.url=jdbc\:derby\:c\:/derbydb/testdb;create\=true
- * eclipselink.jdbc.user=tran
- * eclipselink.jdbc.password=
- * eclipselink.logging.level=FINEST
- * eclipselink.logging.timestamp=false
- * eclipselink.logging.thread=false
- * eclipselink.logging.session=false
- * eclipselink.logging.exceptions=true
- * eclipselink.orm.throw.exceptions=true
- * eclipselink.ddl-generation.output-mode=database
- * eclipselink.ddl-generation=drop-and-create-tables
- * eclipselink.application-location=c\:/_Projects_/ExampleDDL
- */
-public class Main
-{
- protected EntityManagerFactory emf;
- private Map<String, String> eclipseLinkProperties;
- private String createDDLFileName;
- private String dropDDLFileName;
- private String appLocation;
- private String eclipseLinkPropertiesPath;
- private boolean isDebugMode;
-
- // ********** constructors **********
-
- public static void main(String[] args) {
- new Main().execute(args);
- }
-
- private Main() {
- super();
- }
-
- // ********** behavior **********
-
- protected void execute(String[] args) {
- this.initializeWith(args);
-
- this.emf = Persistence.createEntityManagerFactory(this.getPUName(args), this.eclipseLinkProperties);
- this.perform();
- this.closeEntityManagerFactory();
-
- this.dispose();
- return;
- }
-
- protected void perform() {
- // create an EM to generate schema.
- this.emf.createEntityManager().close();
- }
-
- protected void closeEntityManagerFactory() {
- this.emf.close();
- }
-
- private void initializeWith(String[] args) {
-
- this.eclipseLinkPropertiesPath = this.getEclipseLinkPropertiesPath(args);
- this.eclipseLinkProperties = this.getProperties(this.eclipseLinkPropertiesPath);
-
- this.createDDLFileName = this.getConfigPropertyAsString(
- SchemaGeneration.ECLIPSELINK_CREATE_FILE_NAME,
- this.eclipseLinkProperties,
- SchemaGeneration.DEFAULT_SCHEMA_GENERATION_CREATE_FILE_NAME);
-
- this.dropDDLFileName = this.getConfigPropertyAsString(
- SchemaGeneration.ECLIPSELINK_DROP_FILE_NAME,
- this.eclipseLinkProperties,
- SchemaGeneration.DEFAULT_SCHEMA_GENERATION_DROP_FILE_NAME);
-
- this.appLocation = this.eclipseLinkProperties.get(
- SchemaGeneration.ECLIPSELINK_APPLICATION_LOCATION);
-
- this.isDebugMode = this.getDebugMode(args);
- }
-
- private void dispose() {
-
- if( ! this.isDebugMode) {
- new File(this.appLocation + "/" + this.createDDLFileName).delete();
- new File(this.appLocation + "/" + this.dropDDLFileName).delete();
- new File(this.eclipseLinkPropertiesPath).delete();
- }
- }
-
- private Map<String, String> getProperties(String eclipseLinkPropertiesPath) {
-
- Set<Entry<Object, Object>> propertiesSet = null;
- try {
- propertiesSet = this.loadEclipseLinkProperties(eclipseLinkPropertiesPath);
- }
- catch (IOException e) {
- throw new RuntimeException("Missing: " + eclipseLinkPropertiesPath, e);
- }
-
- Map<String, String> properties = new HashMap<String, String>();
- for(Entry<Object, Object> property : propertiesSet) {
- properties.put((String)property.getKey(), (String)property.getValue());
- }
- return properties;
- }
-
- private Set<Entry<Object, Object>> loadEclipseLinkProperties(String eclipseLinkPropertiesPath) throws IOException {
-
- FileInputStream stream = new FileInputStream(eclipseLinkPropertiesPath);
-
- Properties properties = new Properties();
- properties.load(stream);
-
- return properties.entrySet();
- }
-
- // ********** argument queries **********
-
- private String getPUName(String[] args) {
-
- return this.getArgumentValue("-pu", args);
- }
-
- private String getEclipseLinkPropertiesPath(String[] args) {
-
- return this.getArgumentValue("-p", args);
- }
-
- private boolean getDebugMode(String[] args) {
-
- return this.argumentExists("-debug", args);
- }
-
- private String getArgumentValue(String argument, String[] args) {
- for (int i = 0; i < args.length; i++) {
- String arg = args[i];
- if (arg.toLowerCase().equals(argument)) {
- int j = i + 1;
- if (j < args.length) {
- return args[j];
- }
- }
- }
- return null;
- }
-
- private boolean argumentExists(String argument, String[] args) {
- for (int i = 0; i < args.length; i++) {
- String arg = args[i];
- if (arg.toLowerCase().equals(argument)) {
- return true;
- }
- }
- return false;
- }
-
- // ****** utility methods *******
-
- /**
- * Check the provided map for an object with the given key. If that object is not available, check the
- * System properties. If it is not available from either location, return the default value.
- * @param propertyKey
- * @param map
- * @param defaultValue
- * @return
- */
- protected String getConfigPropertyAsString(String propertyKey, Map<String, String> overrides, String defaultValue){
- String value = this.getConfigPropertyAsString(propertyKey, overrides);
- if (value == null){
- value = defaultValue;
- }
- return value;
- }
-
- protected String getConfigPropertyAsString(String propertyKey, Map<String, String> overrides){
- String value = null;
- if (overrides != null){
- value = (String)overrides.get(propertyKey);
- }
- if (value == null){
- value = System.getProperty(propertyKey);
- }
- return value;
- }
-}
diff --git a/jpa/plugins/org.eclipse.jpt.eclipselink.ui/.classpath b/jpa/plugins/org.eclipse.jpt.eclipselink.ui/.classpath
deleted file mode 100644
index fcf07989bf..0000000000
--- a/jpa/plugins/org.eclipse.jpt.eclipselink.ui/.classpath
+++ /dev/null
@@ -1,15 +0,0 @@
-<?xml version="1.0" encoding="UTF-8"?>
-<classpath>
- <classpathentry kind="src" path="src"/>
- <classpathentry kind="src" path="property_files"/>
- <classpathentry kind="con" path="org.eclipse.jdt.launching.JRE_CONTAINER/org.eclipse.jdt.internal.debug.ui.launcher.StandardVMType/J2SE-1.5"/>
- <classpathentry kind="con" path="org.eclipse.pde.core.requiredPlugins">
- <accessrules>
- <accessrule kind="accessible" pattern="org/eclipse/jpt/utility/**"/>
- <accessrule kind="accessible" pattern="org/eclipse/jpt/core/**"/>
- <accessrule kind="accessible" pattern="org/eclipse/jpt/eclipselink/core/**"/>
- <accessrule kind="accessible" pattern="org/eclipse/jpt/ui/**"/>
- </accessrules>
- </classpathentry>
- <classpathentry kind="output" path="bin"/>
-</classpath>
diff --git a/jpa/plugins/org.eclipse.jpt.eclipselink.ui/.cvsignore b/jpa/plugins/org.eclipse.jpt.eclipselink.ui/.cvsignore
deleted file mode 100644
index 76e64421ad..0000000000
--- a/jpa/plugins/org.eclipse.jpt.eclipselink.ui/.cvsignore
+++ /dev/null
@@ -1,3 +0,0 @@
-bin
-@dot
-temp.folder
diff --git a/jpa/plugins/org.eclipse.jpt.eclipselink.ui/.project b/jpa/plugins/org.eclipse.jpt.eclipselink.ui/.project
deleted file mode 100644
index e572be1b93..0000000000
--- a/jpa/plugins/org.eclipse.jpt.eclipselink.ui/.project
+++ /dev/null
@@ -1,28 +0,0 @@
-<?xml version="1.0" encoding="UTF-8"?>
-<projectDescription>
- <name>org.eclipse.jpt.eclipselink.ui</name>
- <comment></comment>
- <projects>
- </projects>
- <buildSpec>
- <buildCommand>
- <name>org.eclipse.jdt.core.javabuilder</name>
- <arguments>
- </arguments>
- </buildCommand>
- <buildCommand>
- <name>org.eclipse.pde.ManifestBuilder</name>
- <arguments>
- </arguments>
- </buildCommand>
- <buildCommand>
- <name>org.eclipse.pde.SchemaBuilder</name>
- <arguments>
- </arguments>
- </buildCommand>
- </buildSpec>
- <natures>
- <nature>org.eclipse.pde.PluginNature</nature>
- <nature>org.eclipse.jdt.core.javanature</nature>
- </natures>
-</projectDescription>
diff --git a/jpa/plugins/org.eclipse.jpt.eclipselink.ui/.settings/org.eclipse.core.resources.prefs b/jpa/plugins/org.eclipse.jpt.eclipselink.ui/.settings/org.eclipse.core.resources.prefs
deleted file mode 100644
index 2fdb2b173d..0000000000
--- a/jpa/plugins/org.eclipse.jpt.eclipselink.ui/.settings/org.eclipse.core.resources.prefs
+++ /dev/null
@@ -1,3 +0,0 @@
-#Mon Apr 07 14:26:59 EDT 2008
-eclipse.preferences.version=1
-encoding/<project>=ISO-8859-1
diff --git a/jpa/plugins/org.eclipse.jpt.eclipselink.ui/.settings/org.eclipse.jdt.core.prefs b/jpa/plugins/org.eclipse.jpt.eclipselink.ui/.settings/org.eclipse.jdt.core.prefs
deleted file mode 100644
index 9dd4c3641c..0000000000
--- a/jpa/plugins/org.eclipse.jpt.eclipselink.ui/.settings/org.eclipse.jdt.core.prefs
+++ /dev/null
@@ -1,7 +0,0 @@
-#Sun Feb 24 21:27:01 EST 2008
-eclipse.preferences.version=1
-org.eclipse.jdt.core.compiler.codegen.targetPlatform=1.5
-org.eclipse.jdt.core.compiler.compliance=1.5
-org.eclipse.jdt.core.compiler.problem.assertIdentifier=error
-org.eclipse.jdt.core.compiler.problem.enumIdentifier=error
-org.eclipse.jdt.core.compiler.source=1.5
diff --git a/jpa/plugins/org.eclipse.jpt.eclipselink.ui/META-INF/MANIFEST.MF b/jpa/plugins/org.eclipse.jpt.eclipselink.ui/META-INF/MANIFEST.MF
deleted file mode 100644
index 7dad5d5933..0000000000
--- a/jpa/plugins/org.eclipse.jpt.eclipselink.ui/META-INF/MANIFEST.MF
+++ /dev/null
@@ -1,50 +0,0 @@
-Manifest-Version: 1.0
-Bundle-ManifestVersion: 2
-Bundle-Name: %pluginName
-Bundle-Vendor: %providerName
-Bundle-SymbolicName: org.eclipse.jpt.eclipselink.ui;singleton:=true
-Bundle-Version: 1.2.0.qualifier
-Bundle-Activator: org.eclipse.jpt.eclipselink.ui.JptEclipseLinkUiPlugin
-Bundle-ActivationPolicy: lazy
-Bundle-ClassPath: .
-Bundle-Localization: plugin
-Require-Bundle: org.eclipse.core.resources;bundle-version="[3.4.0,4.0.0)",
- org.eclipse.core.runtime;bundle-version="[3.4.0,4.0.0)",
- org.eclipse.jdt.core;bundle-version="[3.4.0,4.0.0)",
- org.eclipse.jdt.ui;bundle-version="[3.4.0,4.0.0)",
- org.eclipse.jpt.core;bundle-version="[2.0.0,3.0.0)",
- org.eclipse.jpt.db;bundle-version="[1.2.0,2.0.0)",
- org.eclipse.jpt.eclipselink.core;bundle-version="[1.0.0,2.0.0)",
- org.eclipse.jpt.ui;bundle-version="[2.0.0,3.0.0)",
- org.eclipse.jpt.utility;bundle-version="[1.2.0,2.0.0)",
- org.eclipse.ui;bundle-version="[3.4.0,4.0.0)",
- org.eclipse.ui.forms;bundle-version="[3.4.0,4.0.0)",
- org.eclipse.wst.common.frameworks;bundle-version="[1.1.200,2.0.0)",
- org.eclipse.wst.common.frameworks.ui;bundle-version="[1.1.200,2.0.0)"
-Export-Package: org.eclipse.jpt.eclipselink.ui,
- org.eclipse.jpt.eclipselink.ui.internal;x-internal:=true,
- org.eclipse.jpt.eclipselink.ui.internal.ddlgen;x-internal:=true,
- org.eclipse.jpt.eclipselink.ui.internal.ddlgen.wizards;x-internal:=true,
- org.eclipse.jpt.eclipselink.ui.internal.java.details;x-internal:=true,
- org.eclipse.jpt.eclipselink.ui.internal.mappings;x-internal:=true,
- org.eclipse.jpt.eclipselink.ui.internal.mappings.details;x-internal:=true,
- org.eclipse.jpt.eclipselink.ui.internal.orm.details;x-internal:=true,
- org.eclipse.jpt.eclipselink.ui.internal.persistence.caching;x-internal:=true,
- org.eclipse.jpt.eclipselink.ui.internal.persistence.connection;x-internal:=true,
- org.eclipse.jpt.eclipselink.ui.internal.persistence.customization;x-internal:=true,
- org.eclipse.jpt.eclipselink.ui.internal.persistence.general;x-internal:=true,
- org.eclipse.jpt.eclipselink.ui.internal.persistence.logging;x-internal:=true,
- org.eclipse.jpt.eclipselink.ui.internal.persistence.options;x-internal:=true,
- org.eclipse.jpt.eclipselink.ui.internal.persistence.schema.generation;x-internal:=true,
- org.eclipse.jpt.eclipselink.ui.internal.persistencexml.details;x-internal:=true,
- org.eclipse.jpt.eclipselink.ui.internal.platform;x-internal:=true,
- org.eclipse.jpt.eclipselink.ui.internal.structure;x-internal:=true,
- org.eclipse.jpt.eclipselink.ui.internal.wizards;x-internal:=true,
- org.eclipse.jpt.eclipselink1_1.ui.internal;x-internal:=true,
- org.eclipse.jpt.eclipselink1_1.ui.internal.java.details;x-internal:=true,
- org.eclipse.jpt.eclipselink1_1.ui.internal.orm.details;x-internal:=true,
- org.eclipse.jpt.eclipselink1_1.ui.internal.platform;x-internal:=true,
- org.eclipse.jpt.eclipselink1_1.ui.internal.structure;x-internal:=true,
- org.eclipse.jpt.eclipselink1_1.ui.internal.wizards;x-internal:=true
-Bundle-RequiredExecutionEnvironment: J2SE-1.5
-Import-Package: com.ibm.icu.text;version="4.0.1"
diff --git a/jpa/plugins/org.eclipse.jpt.eclipselink.ui/about.html b/jpa/plugins/org.eclipse.jpt.eclipselink.ui/about.html
deleted file mode 100644
index be534ba44f..0000000000
--- a/jpa/plugins/org.eclipse.jpt.eclipselink.ui/about.html
+++ /dev/null
@@ -1,34 +0,0 @@
-<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.0//EN">
-<HTML>
-
-<head>
-<title>About</title>
-<meta http-equiv=Content-Type content="text/html; charset=ISO-8859-1">
-</head>
-
-<BODY lang="EN-US">
-
-<H3>About This Content</H3>
-
-<P>May 02, 2008</P>
-
-<H3>License</H3>
-
-<P>The Eclipse Foundation makes available all content in this plug-in
-("Content"). Unless otherwise indicated below, the Content is provided to you
-under the terms and conditions of the Eclipse Public License Version 1.0
-("EPL"). A copy of the EPL is available at
-<A href="http://www.eclipse.org/org/documents/epl-v10.php">http://www.eclipse.org/org/documents/epl-v10.php</A>.
-For purposes of the EPL, "Program" will mean the Content.</P>
-
-<P>If you did not receive this Content directly from the Eclipse Foundation, the
-Content is being redistributed by another party ("Redistributor") and different
-terms and conditions may apply to your use of any object code in the Content.
-Check the Redistributor's license that was provided with the Content. If no such
-license exists, contact the Redistributor. Unless otherwise indicated below, the
-terms and conditions of the EPL still apply to any source code in the Content
-and such source code may be obtained at
-<A href="http://www.eclipse.org/">http://www.eclipse.org/</A>.</P>
-
-</BODY>
-</HTML>
diff --git a/jpa/plugins/org.eclipse.jpt.eclipselink.ui/build.properties b/jpa/plugins/org.eclipse.jpt.eclipselink.ui/build.properties
deleted file mode 100644
index 213a2e2c4d..0000000000
--- a/jpa/plugins/org.eclipse.jpt.eclipselink.ui/build.properties
+++ /dev/null
@@ -1,20 +0,0 @@
-################################################################################
-# Copyright (c) 2006, 2008 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.
-#
-# Contributors:
-# Oracle - initial API and implementation
-################################################################################
-javacSource = 1.5
-javacTarget = 1.5
-source.. = src/,\
- property_files/
-output.. = bin/
-bin.includes = .,\
- META-INF/,\
- about.html,\
- plugin.xml,\
- plugin.properties
-jars.compile.order = .
diff --git a/jpa/plugins/org.eclipse.jpt.eclipselink.ui/plugin.properties b/jpa/plugins/org.eclipse.jpt.eclipselink.ui/plugin.properties
deleted file mode 100644
index 1759e9533a..0000000000
--- a/jpa/plugins/org.eclipse.jpt.eclipselink.ui/plugin.properties
+++ /dev/null
@@ -1,30 +0,0 @@
-###############################################################################
-# Copyright (c) 2006, 2008 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.
-#
-# Contributors:
-# Oracle - initial API and implementation
-###############################################################################
-
-# ====================================================================
-# To code developer:
-# Do NOT change the properties between this line and the
-# "%%% END OF TRANSLATED PROPERTIES %%%" line.
-# Make a new property name, append to the end of the file and change
-# the code to use the new property.
-# ====================================================================
-
-# ====================================================================
-# %%% END OF TRANSLATED PROPERTIES %%%
-# ====================================================================
-pluginName= Dali Java Persistence Tools - EclipseLink Support - UI
-providerName=Eclipse Web Tools Platform
-
-eclipseLinkWizardCategoryName=EclipseLink
-newEclipseLinkMappingFileWizardName=EclipseLink Mapping File
-newEclipseLinkJpaMappingFileWizardDesc=Create an EclipseLink specific mapping file
-
-newEclipseLink1_1MappingFileWizardName=EclipseLink 1.1 Mapping File
-newEclipseLink1_1JpaMappingFileWizardDesc=Create an EclipseLink 1.1 specific mapping file \ No newline at end of file
diff --git a/jpa/plugins/org.eclipse.jpt.eclipselink.ui/plugin.xml b/jpa/plugins/org.eclipse.jpt.eclipselink.ui/plugin.xml
deleted file mode 100644
index b931c8441e..0000000000
--- a/jpa/plugins/org.eclipse.jpt.eclipselink.ui/plugin.xml
+++ /dev/null
@@ -1,157 +0,0 @@
-<?xml version="1.0" encoding="UTF-8"?>
-<?eclipse version="3.2"?>
-<plugin>
-
- <extension
- point="org.eclipse.jpt.ui.jpaPlatformUis">
-
- <jpaPlatformUi
- id="org.eclipse.eclipselink.platform.ui"
- jpaPlatform="org.eclipse.eclipselink.platform"
- factoryClass="org.eclipse.jpt.eclipselink.ui.internal.platform.EclipseLinkJpaPlatformUiFactory"/>
-
- <jpaPlatformUi
- id="eclipselink1_1.ui"
- jpaPlatform="eclipselink1_1"
- factoryClass="org.eclipse.jpt.eclipselink1_1.ui.internal.platform.EclipseLink1_1JpaPlatformUiFactory"/>
-
- </extension>
-
-
- <extension
- point="org.eclipse.ui.newWizards">
-
- <category
- id="org.eclipse.jpt.eclipselink"
- name="%eclipseLinkWizardCategoryName"
- parentCategory="org.eclipse.jpt"/>
-
- <wizard
- id="org.eclipse.jpt.eclipselink.ui.wizard.newEclipseLinkMappingFile"
- name="%newEclipseLinkMappingFileWizardName"
- icon="platform:/plugin/org.eclipse.jpt.ui/icons/full/etool16/new_jpa_file_wiz.gif"
- category="org.eclipse.jpt/org.eclipse.jpt.eclipselink">
- <description>%newEclipseLinkJpaMappingFileWizardDesc</description>
- <class class="org.eclipse.jpt.eclipselink.ui.internal.wizards.EclipseLinkMappingFileWizard">
- <parameter name="javaeeartifact" value="true"/>
- <parameter name="menuIndex" value="40" />
- <parameter name="jptartifact" value="true"/>
- </class>
- </wizard>
- <wizard
- category="org.eclipse.jpt/org.eclipse.jpt.eclipselink"
- icon="platform:/plugin/org.eclipse.jpt.ui/icons/full/etool16/new_jpa_file_wiz.gif"
- id="org.eclipse.jpt.eclipselink.ui.wizard.newEclipseLink1_1MappingFile"
- name="%newEclipseLink1_1MappingFileWizardName">
- <description>
- %newEclipseLink1_1JpaMappingFileWizardDesc
- </description>
- <class
- class="org.eclipse.jpt.eclipselink1_1.ui.internal.wizards.EclipseLink1_1MappingFileWizard">
- <parameter
- name="javaeeartifact"
- value="true">
- </parameter>
- <parameter
- name="menuIndex"
- value="40">
- </parameter>
- <parameter
- name="jptartifact"
- value="true">
- </parameter>
- </class>
- </wizard>
-
- </extension>
-
-
- <extension
- point="org.eclipse.ui.navigator.navigatorContent">
-
- <commonWizard
- menuGroupId="org.eclipse.jpt.ui"
- type="new"
- wizardId="org.eclipse.jpt.eclipselink.ui.wizard.newEclipseLinkMappingFile">
- <enablement>
- <and>
- <or>
- <instanceof value="org.eclipse.core.resources.IProject"/>
- <instanceof value="org.eclipse.core.resources.IFolder"/>
- <instanceof value="org.eclipse.jdt.core.IPackageFragmentRoot"/>
- <instanceof value="org.eclipse.jdt.core.IPackageFragment"/>
- </or>
- <adapt type="org.eclipse.core.resources.IResource">
- <test
- forcePluginActivation="true"
- property="org.eclipse.wst.common.project.facet.core.projectFacet"
- value="jpt.jpa" />
- </adapt>
- <or>
- <test
- property="org.eclipse.jpt.core.jpaPlatform"
- value="org.eclipse.eclipselink.platform">
- </test>
- <test
- property="org.eclipse.jpt.core.jpaPlatform"
- value="eclipselink1_1">
- </test>
- </or>
- </and>
- </enablement>
- </commonWizard>
- <commonWizard
- menuGroupId="org.eclipse.jpt.ui"
- type="new"
- wizardId="org.eclipse.jpt.eclipselink.ui.wizard.newEclipseLink1_1MappingFile">
- <enablement>
- <and>
- <or>
- <instanceof
- value="org.eclipse.core.resources.IProject">
- </instanceof>
- <instanceof
- value="org.eclipse.core.resources.IFolder">
- </instanceof>
- <instanceof
- value="org.eclipse.jdt.core.IPackageFragmentRoot">
- </instanceof>
- <instanceof
- value="org.eclipse.jdt.core.IPackageFragment">
- </instanceof>
- </or>
- <adapt
- type="org.eclipse.core.resources.IResource">
- <test
- forcePluginActivation="true"
- property="org.eclipse.wst.common.project.facet.core.projectFacet"
- value="jpt.jpa">
- </test>
- </adapt>
- <test
- property="org.eclipse.jpt.core.jpaPlatform"
- value="eclipselink1_1">
- </test>
- </and>
- </enablement>
- </commonWizard>
-
- </extension>
-
-
- <extension
- point="org.eclipse.ui.perspectiveExtensions">
-
- <perspectiveExtension
- targetID="org.eclipse.jpt.ui.jpaPerspective">
- <newWizardShortcut
- id="org.eclipse.jpt.eclipselink.ui.wizard.newEclipseLinkMappingFile">
- </newWizardShortcut>
- <newWizardShortcut
- id="org.eclipse.jpt.eclipselink.ui.wizard.newEclipseLink1_1MappingFile">
- </newWizardShortcut>
- </perspectiveExtension>
-
- </extension>
-
-</plugin>
diff --git a/jpa/plugins/org.eclipse.jpt.eclipselink.ui/property_files/eclipselink_ui.properties b/jpa/plugins/org.eclipse.jpt.eclipselink.ui/property_files/eclipselink_ui.properties
deleted file mode 100644
index cd2a9845f3..0000000000
--- a/jpa/plugins/org.eclipse.jpt.eclipselink.ui/property_files/eclipselink_ui.properties
+++ /dev/null
@@ -1,334 +0,0 @@
-################################################################################
-# Copyright (c) 2007, 2008 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.
-#
-# Contributors:
-# Oracle - initial API and implementation
-################################################################################
-
-MappingFileWizard_title=New EclipseLink Mapping File
-MappingFileWizardPage_title=EclipseLink mapping file
-MappingFileWizardPage_desc=Specify EclipseLink mapping file location and properties
-
-EclipseLink1_1MappingFileWizard_title=New EclipseLink 1.1 Mapping File
-EclipseLink1_1MappingFileWizardPage_title=EclipseLink 1.1 mapping file
-EclipseLink1_1MappingFileWizardPage_desc=Specify EclipseLink 1.1 mapping file location and properties
-
-Boolean_True = True
-Boolean_False = False
-
-DefaultWithoutValue=Default ()
-DefaultWithValue=Default ({0})
-
-PersistenceXmlTabFolder_defaultEmpty = Default ()
-PersistenceXmlTabFolder_defaultWithOneParam = Default ({0})
-
-PersistenceXmlGeneralTab_name = Name:
-PersistenceXmlGeneralTab_provider = Provider:
-PersistenceXmlGeneralTab_browse = Browse...
-PersistenceXmlGeneralTab_description = Description:
-
-# General
-PersistenceXmlGeneralTab_title = General
-PersistenceXmlGeneralTab_generalSectionTitle = General
-PersistenceXmlGeneralTab_mappedClassesSectionTitle = Managed Classes
-PersistenceXmlGeneralTab_mappedClassesSectionDescription=Specify the list of classes to be managed in this persistence unit.
-PersistenceXmlGeneralTab_xmlMappingFilesSectionTitle = XML Mapping Files
-PersistenceXmlGeneralTab_xmlMappingFilesSectionDescription=Specify the XML mapping files for this persistence unit.
-
-PersistenceXmlGeneralTab_nameLabel = Name:
-PersistenceXmlGeneralTab_persistenceProviderLabel = Persistence Provider:
-PersistenceXmlGeneralTab_descriptionLabel = Description:
-
-PersistenceXmlGeneralTab_excludeUnlistedMappedClasses=Exclude unlisted classes
-PersistenceXmlGeneralTab_excludeUnlistedMappedClassesWithDefault=Exclude unlisted classes ({0})
-PersistenceXmlGeneralTab_mappedClassesNoName=<name not set>
-PersistenceXmlGeneralTab_open=Open
-
-PersistenceXmlGeneralTab_xmlMappingFilesDialog_title=JPA XML Mapping File Selection
-PersistenceXmlGeneralTab_xmlMappingFilesDialog_message=Choose the XML mapping files to be added to the persistence unit.
-PersistenceXmlGeneralTab_ormNoName=<name not set>
-PersistenceXmlGeneralTab_excludeEclipselinkOrm=Exclude unlisted EclipseLink XML mapping file
-PersistenceXmlGeneralTab_excludeEclipselinkOrmWithDefault=Exclude unlisted EclipseLink XML mapping file ({0})
-
-# Connection
-PersistenceXmlConnectionTab_title = Connection
-PersistenceXmlConnectionTab_sectionTitle = Persistence Unit Connection
-PersistenceXmlConnectionTab_sectionDescription = Configure the data source or JDBC connection properties.
-PersistenceXmlConnectionTab_defaultWithOneParam = Default ({0})
-PersistenceXmlConnectionTab_defaultEmpty = Default ()
-
-PersistenceXmlConnectionTab_transactionTypeLabel = Transaction type:
-
-TransactionTypeComposite_jta = JTA
-TransactionTypeComposite_resource_local = Resource Local
-
-PersistenceXmlConnectionTab_nativeSqlLabel = Native SQL
-PersistenceXmlConnectionTab_nativeSqlLabelDefault = Native SQL ({0})
-
-PersistenceXmlConnectionTab_batchWritingLabel = Batch writing:
-
-BatchWritingComposite_none = None
-BatchWritingComposite_jdbc = JDBC
-BatchWritingComposite_buffered = Buffered
-BatchWritingComposite_oracle_jdbc = Oracle JDBC
-
-PersistenceXmlConnectionTab_cacheStatementsLabel = Statement caching:
-
-PersistenceXmlConnectionTab_jtaDataSourceLabel = JTA data source:
-PersistenceXmlConnectionTab_nonJtaDataSourceLabel = Non-JTA data source:
-
-PersistenceXmlConnectionTab_driverLabel = Driver:
-PersistenceXmlConnectionTab_urlLabel = URL:
-PersistenceXmlConnectionTab_userLabel = User:
-PersistenceXmlConnectionTab_passwordLabel = Password:
-PersistenceXmlConnectionTab_bindParametersLabel = Bind parameters
-PersistenceXmlConnectionTab_bindParametersLabelDefault = Bind parameters ({0})
-
-PersistenceXmlConnectionTab_readConnectionsSharedLabel = Shared
-PersistenceXmlConnectionTab_readConnectionsSharedLabelDefault = Shared ({0})
-PersistenceXmlConnectionTab_readConnectionsSectionTitle = Read Connection
-PersistenceXmlConnectionTab_readConnectionsMinLabel = Minimum:
-PersistenceXmlConnectionTab_readConnectionsMaxLabel = Maximum:
-PersistenceXmlConnectionTab_writeConnectionsSectionTitle = Write Connection
-PersistenceXmlConnectionTab_writeConnectionsMinLabel = Minimum:
-PersistenceXmlConnectionTab_writeConnectionsMaxLabel = Maximum:
-
-ConnectionPropertiesComposite_Database_GroupBox=Database
-
-JdbcPropertiesComposite_EclipseLinkConnectionPool_GroupBox=EclipseLink Connection Pool
-
-JdbcConnectionPropertiesComposite_ConnectionDialog_Message=&Enter connection name or pattern (*, ?, or camel case):
-JdbcConnectionPropertiesComposite_ConnectionDialog_Title=Connection Selection
-
-# SchemaGeneration
-PersistenceXmlSchemaGenerationTab_title = Schema Generation
-PersistenceXmlSchemaGenerationTab_sectionTitle = Persistence Unit Schema Generation
-PersistenceXmlSchemaGenerationTab_sectionDescription = Configure the EclipseLink schema generation properties.
-PersistenceXmlSchemaGenerationTab_defaultWithOneParam = Default ({0})
-PersistenceXmlSchemaGenerationTab_defaultEmpty = Default ()
-
-PersistenceXmlSchemaGenerationTab_ddlGenerationTypeLabel = DDL generation type:
-PersistenceXmlSchemaGenerationTab_outputModeLabel = Output mode:
-PersistenceXmlSchemaGenerationTab_createDdlFileNameLabel = Create DDL file name:
-PersistenceXmlSchemaGenerationTab_dropDdlFileNameLabel = Drop DDL file name:
-
-OutputModeComposite_both = Both
-OutputModeComposite_sql_script = Sql-script
-OutputModeComposite_database = Database
-
-DdlGenerationTypeComposite_none = None
-DdlGenerationTypeComposite_create_tables = Create Tables
-DdlGenerationTypeComposite_drop_and_create_tables = Drop and Create Tables
-
-PersistenceXmlSchemaGenerationTab_ddlGenerationLocationLabel = DDL generation location:
-
-DdlGenerationLocationComposite_dialogTitle = Generation Location
-DdlGenerationLocationComposite_dialogMessage = Choose a folder for the generated DDL files:
-
-# Caching
-PersistenceXmlCachingTab_title = Caching
-PersistenceXmlCachingTab_sectionTitle = Persistence Unit Caching
-PersistenceXmlCachingTab_sectionDescription = Configure the session or entity specific EclipseLink caching properties.
-
-PersistenceXmlCachingTab_defaultCacheTypeLabel = Default cache type:
-PersistenceXmlCachingTab_cacheTypeLabel = Cache type:
-
-PersistenceXmlCachingTab_defaultSharedCacheLabel = Shared cache ({0})
-PersistenceXmlCachingTab_sharedCacheLabel = Shared cache
-
-PersistenceXmlCachingTab_defaultSharedCacheDefaultLabel = Default shared cache ({0})
-PersistenceXmlCachingTab_sharedCacheDefaultLabel = Default shared cache
-
-CacheSizeComposite_cacheSize=Cache size:
-
-CacheTypeComposite_full = Full
-CacheTypeComposite_hard_weak = Weak with Hard Subcache
-CacheTypeComposite_none = None
-CacheTypeComposite_soft = Soft
-CacheTypeComposite_soft_weak = Weak with Soft Subcache
-CacheTypeComposite_weak = Weak
-
-DefaultCacheSizeComposite_defaultCacheSize=Default cache size:
-
-DefaultCacheTypeComposite_full = Full
-DefaultCacheTypeComposite_hard_weak = Weak With Hard Subcache
-DefaultCacheTypeComposite_none = None
-DefaultCacheTypeComposite_soft = Soft
-DefaultCacheTypeComposite_soft_weak = Weak with Soft Subcache
-DefaultCacheTypeComposite_weak = Weak
-
-EntityDialog_selectEntity = Select an Entity
-EntityDialog_name = Name:
-
-CachingEntityListComposite_groupTitle = Entity caching
-CachingEntityListComposite_editButton = Edit...
-
-CachingEntityListComposite_dialogMessage=&Enter type name prefix or pattern (*, ?, or camel case):
-CachingEntityListComposite_dialogTitle=Entity Selection
-
-PersistenceXmlCachingTab_FlushClearCacheLabel = Flush clear cache:
-
-FlushClearCacheComposite_drop = Drop
-FlushClearCacheComposite_drop_invalidate = Drop Invalidate
-FlushClearCacheComposite_merge = Merge
-
-# Customization
-PersistenceXmlCustomizationTab_title = Customization
-PersistenceXmlCustomizationTab_sectionTitle = Persistence Unit Customization
-PersistenceXmlCustomizationTab_sectionDescription = Set default or entity specific EclipseLink customization and validation properties.
-PersistenceXmlCustomizationTab_defaultWithOneParam = Default ({0})
-PersistenceXmlCustomizationTab_defaultEmpty = Default ()
-
-PersistenceXmlCustomizationTab_weavingLabel = Weaving:
-
-PersistenceXmlCustomizationTab_weavingLazyLabelDefault = Weaving lazy ({0})
-PersistenceXmlCustomizationTab_weavingLazyLabel = Weaving lazy
-
-PersistenceXmlCustomizationTab_weavingChangeTrackingLabelDefault = Weaving change tracking ({0})
-PersistenceXmlCustomizationTab_weavingChangeTrackingLabel = Weaving change tracking
-
-PersistenceXmlCustomizationTab_weavingFetchGroupsLabelDefault = Weaving fetch groups ({0})
-PersistenceXmlCustomizationTab_weavingFetchGroupsLabel = Weaving fetch groups
-
-PersistenceXmlCustomizationTab_weavingInternalLabel = Weaving internal
-PersistenceXmlCustomizationTab_weavingInternalLabelDefault = Weaving internal ({0})
-
-PersistenceXmlCustomizationTab_weavingEagerLabel = Weaving eager
-PersistenceXmlCustomizationTab_weavingEagerLabelDefault = Weaving eager ({0})
-
-PersistenceXmlCustomizationTab_throwExceptionsLabelDefault = Throw exceptions ({0})
-PersistenceXmlCustomizationTab_throwExceptionsLabel = Throw exceptions
-
-PersistenceXmlCustomizationTab_exceptionHandlerLabel = Exception handler:
-
-WeavingComposite_true_ = Weave Dynamically
-WeavingComposite_false_ = No Weaving
-WeavingComposite_static_ = Weave Statically
-
-CustomizationEntityListComposite_groupTitle = Descriptor customizers
-CustomizationEntityListComposite_editButton = Edit...
-
-CustomizationEntityListComposite_dialogMessage=&Enter type name prefix or pattern (*, ?, or camel case):
-CustomizationEntityListComposite_dialogTitle=Entity Selection
-
-PersistenceXmlCustomizationTab_customizerLabel = Customizer:
-PersistenceXmlCustomizationTab_sessionCustomizerLabel = Session customizers
-
-PersistenceXmlCustomizationTab_noName=<name not set>
-
-PersistenceXmlCustomizationTab_validationOnlyLabel = Validation only
-PersistenceXmlCustomizationTab_validationOnlyLabelDefault = Validation only ({0})
-
-PersistenceXmlCustomizationTab_profilerLabel = Profiler:
-PersistenceXmlCustomizationTab_browse = Browse...
-
-ProfilerComposite_performance_profiler = Performance Profiler
-ProfilerComposite_query_monitor = Query Monitor
-ProfilerComposite_no_profiler = No Profiler
-
-# Logging
-PersistenceXmlLoggingTab_title = Logging
-PersistenceXmlLoggingTab_sectionTitle = Persistence Unit Logging
-PersistenceXmlLoggingTab_sectionDescription = Configure the EclipseLink logging properties.
-PersistenceXmlLoggingTab_defaultWithOneParam = Default ({0})
-PersistenceXmlLoggingTab_defaultEmpty = Default ()
-
-PersistenceXmlLoggingTab_loggingLevelLabel = Logging level:
-
-LoggingLevelComposite_off = Off
-LoggingLevelComposite_severe = Severe
-LoggingLevelComposite_warning = Warning
-LoggingLevelComposite_info = Info
-LoggingLevelComposite_config = Config
-LoggingLevelComposite_fine = Fine
-LoggingLevelComposite_finer = Finer
-LoggingLevelComposite_finest = Finest
-LoggingLevelComposite_all = All
-
-PersistenceXmlLoggingTab_loggerLabel = Logger:
-PersistenceXmlLoggingTab_browse = Browse...
-LoggerComposite_default_logger = Default Logger
-LoggerComposite_java_logger = Java Logger
-LoggerComposite_server_logger = Server Logger
-
-PersistenceXmlLoggingTab_timestampLabel = Timestamp
-PersistenceXmlLoggingTab_timestampLabelDefault = Timestamp ({0})
-PersistenceXmlLoggingTab_threadLabel = Thread
-PersistenceXmlLoggingTab_threadLabelDefault = Thread ({0})
-PersistenceXmlLoggingTab_sessionLabel = Session
-PersistenceXmlLoggingTab_sessionLabelDefault = Session ({0})
-PersistenceXmlLoggingTab_exceptionsLabel = Exceptions
-PersistenceXmlLoggingTab_exceptionsLabelDefault = Exceptions ({0})
-
-PersistenceXmlLoggingTab_loggersLabel = Loggers:
-
-PersistenceXmlLoggingTab_loggingFileLabel = Log file:
-
-LoggingFileLocationComposite_dialogTitle = Log File Location
-LoggingFileLocationComposite_dialogMessage = Choose a folder for the log file:
-
-# Options
-PersistenceXmlOptionsTab_title = Options
-PersistenceXmlOptionsTab_sessionSectionTitle = EclipseLink Session Options
-PersistenceXmlOptionsTab_sessionSectionDescription = Configure the EclipseLink session options.
-PersistenceXmlOptionsTab_defaultWithOneParam = Default ({0})
-PersistenceXmlOptionsTab_defaultEmpty = Default ()
-
-PersistenceXmlOptionsTab_sessionName = Session name:
-PersistenceXmlOptionsTab_sessionsXml = Sessions XML:
-
-PersistenceXmlOptionsTab_includeDescriptorQueriesLabel = Include descriptor queries
-PersistenceXmlOptionsTab_includeDescriptorQueriesLabelDefault = Include descriptor queries ({0})
-
-PersistenceXmlOptionsTab_eventListenerLabel = Event listener:
-PersistenceXmlOptionsTab_targetDatabaseLabel = Target database:
-
-PersistenceXmlOptionsTab_miscellaneousSectionTitle = Miscellaneous Options
-PersistenceXmlOptionsTab_miscellaneousSectionDescription = Configure the miscellaneous options.
-
-PersistenceXmlOptionsTab_temporalMutableLabel = Temporal mutable
-PersistenceXmlOptionsTab_temporalMutableLabelDefault = Temporal mutable ({0})
-
-TargetDatabaseComposite_attunity = Attunity
-TargetDatabaseComposite_auto = Auto
-TargetDatabaseComposite_cloudscape = Cloudscape
-TargetDatabaseComposite_database = Database
-TargetDatabaseComposite_db2 = DB2
-TargetDatabaseComposite_db2mainframe = DB2Mainframe
-TargetDatabaseComposite_dbase = DBase
-TargetDatabaseComposite_derby = Derby
-TargetDatabaseComposite_hsql = HSQL
-TargetDatabaseComposite_informix = Informix
-TargetDatabaseComposite_javadb = JavaDB
-TargetDatabaseComposite_mysql = MySQL
-TargetDatabaseComposite_oracle = Oracle
-TargetDatabaseComposite_oracle11 = Oracle11
-TargetDatabaseComposite_oracle10 = Oracle10g
-TargetDatabaseComposite_oracle9 = Oracle9i
-TargetDatabaseComposite_oracle8 = Oracle8i
-TargetDatabaseComposite_pointbase = PointBase
-TargetDatabaseComposite_postgresql = PostgreSQL
-TargetDatabaseComposite_sqlanywhere = SQLAnywhere
-TargetDatabaseComposite_sqlserver = SQLServer
-TargetDatabaseComposite_sybase = Sybase
-TargetDatabaseComposite_timesten = TimesTen
-
-PersistenceXmlOptionsTab_targetServerLabel = Target server:
-
-TargetServerComposite_none = None
-TargetServerComposite_oc4j = OC4J
-TargetServerComposite_sunas9 = SunAS9
-TargetServerComposite_websphere = WebSphere
-TargetServerComposite_websphere_6_1 = WebSphere 6.1
-TargetServerComposite_weblogic = WebLogic
-TargetServerComposite_weblogic_9 = WebLogic 9
-TargetServerComposite_weblogic_10 = WebLogic 10
-TargetServerComposite_jboss = JBoss
-
-# DDLGeneration
-EclipseLinkDDLGeneratorUi_generatingDDLWarningTitle = Generating DDL
-EclipseLinkDDLGeneratorUi_generatingDDLWarningMessage = Warning: Generating DDL will DROP existing tables and{0}CREATE new tables based on the Entities in your project.{1}Are you sure you want to continue?
-EclipseLinkDDLGeneratorUi_error = Error
diff --git a/jpa/plugins/org.eclipse.jpt.eclipselink.ui/property_files/eclipselink_ui_mappings.properties b/jpa/plugins/org.eclipse.jpt.eclipselink.ui/property_files/eclipselink_ui_mappings.properties
deleted file mode 100644
index 92d1e47c9a..0000000000
--- a/jpa/plugins/org.eclipse.jpt.eclipselink.ui/property_files/eclipselink_ui_mappings.properties
+++ /dev/null
@@ -1,153 +0,0 @@
-################################################################################
-# Copyright (c) 2008 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.
-#
-# Contributors:
-# Oracle - initial API and implementation
-################################################################################
-
-BasicCollectionMappingUiProvider_label = Basic Collection
-BasicCollectionMappingUiProvider_linkLabel = basic collection
-
-BasicMapMappingUiProvider_label = Basic Map
-BasicMapMappingUiProvider_linkLabel = basic map
-
-TransformationMappingUiProvider_label = Transformation
-TransformationMappingUiProvider_linkLabel = transformation
-
-VariableOneToOneMappingUiProvider_label = Variable One to One
-VariableOneToOneMappingUiProvider_linkLabel = variable one to one
-
-CacheTypeComposite_label = Type:
-CacheTypeComposite_full = Full
-CacheTypeComposite_weak = Weak
-CacheTypeComposite_soft = Soft
-CacheTypeComposite_soft_weak = Weak with Soft Subcache
-CacheTypeComposite_hard_weak = Weak with Hard Subcache
-CacheTypeComposite_cache = Cache
-CacheTypeComposite_none = None
-
-CacheSizeComposite_size = Size:
-
-CacheCoordinationTypeComposite_label = Coordination type:
-CacheCoordinationTypeComposite_send_object_changes = Send Object Changes
-CacheCoordinationTypeComposite_invalidate_changed_objects = Invalidate Changed Objects
-CacheCoordinationTypeComposite_send_new_objects_with_changes = Send New Objects with Changes
-CacheCoordinationTypeComposite_none = None
-
-CachingComposite_sharedLabelDefault = Shared ({0})
-CachingComposite_sharedLabel = Shared
-CachingComposite_advanced = Advanced
-
-ChangeTrackingComposite_label = Change tracking:
-ChangeTrackingComposite_attribute = Attribute
-ChangeTrackingComposite_object = Object
-ChangeTrackingComposite_deferred = Deferred
-ChangeTrackingComposite_auto = Auto
-
-ConvertComposite_converterNameLabel = Converter name:
-ConvertComposite_defineConverterSection = Define Converter
-ConvertComposite_default = Default
-ConvertComposite_custom = Custom
-ConvertComposite_type = Type
-ConvertComposite_objectType = Object type
-ConvertComposite_struct = Struct
-
-ConverterComposite_nameTextLabel = Name:
-ConverterComposite_classLabel = Class:
-
-CustomizerComposite_classLabel = Customizer class:
-
-ConvertersComposite_customConverter = Custom
-ConvertersComposite_objectTypeConverter = Object type
-ConvertersComposite_structConverter = Struct
-ConvertersComposite_typeConverter = Type
-
-AlwaysRefreshComposite_alwaysRefreshDefault = Always refresh ({0})
-AlwaysRefreshComposite_alwaysRefreshLabel = Always refresh
-RefreshOnlyIfNewerComposite_refreshOnlyIfNewerDefault = Refresh only if newer ({0})
-RefreshOnlyIfNewerComposite_refreshOnlyIfNewerLabel = Refresh only if newer
-DisableHitsComposite_disableHitsDefault = Disable hits ({0})
-DisableHitsComposite_disableHitsLabel = Disable hits
-
-TypeSection_converted = Converted
-
-EclipseLinkTypeMappingComposite_advanced = Advanced
-EclipseLinkTypeMappingComposite_caching = Caching
-EclipseLinkTypeMappingComposite_converters = Converters
-
-ExistenceCheckingComposite_label = Existence checking:
-JavaExistenceCheckingComposite_check_cache = Check Cache
-JavaExistenceCheckingComposite_check_database = Check Cache then Database
-JavaExistenceCheckingComposite_assume_existence = Assume Existence
-JavaExistenceCheckingComposite_assume_non_existence = Assume Non-Existence
-OrmExistenceCheckingComposite_check_cache = Check Cache
-OrmExistenceCheckingComposite_check_database = Check Cache then Database
-OrmExistenceCheckingComposite_assume_existence = Assume Existence
-OrmExistenceCheckingComposite_assume_non_existence = Assume Non-Existence
-
-ExpiryComposite_expirySection = Expiry
-
-ExpiryComposite_noExpiry = No expiry
-ExpiryComposite_timeToLiveExpiry = Time to live expiry
-ExpiryComposite_timeToLiveExpiryExpireAfter = Expire after
-ExpiryComposite_timeToLiveExpiryMilliseconds = milliseconds
-ExpiryComposite_dailyExpiry = Daily expiry
-ExpiryComposite_timeOfDayExpiryExpireAt = Expire at
-
-
-JoinFetchComposite_label = Join fetch:
-JoinFetchComposite_inner = Inner
-JoinFetchComposite_outer = Outer
-
-MutableComposite_mutableLabel=Mutable
-MutableComposite_mutableLabelDefault=Mutable ({0})
-MutableComposite_true=True
-MutableComposite_false=False
-
-ObjectTypeConverterComposite_dataTypeLabel = Data type:
-ObjectTypeConverterComposite_objectTypeLabel = Object type:
-ObjectTypeConverterComposite_conversionValueEdit = Edit...
-ObjectTypeConverterComposite_conversionValuesDataValueColumn = Data Value
-ObjectTypeConverterComposite_conversionValuesObjectValueColumn = Object Value
-ObjectTypeConverterComposite_defaultObjectValueLabel = Default object value:
-ObjectTypeConverterComposite_conversionValuesGroupTitle = Conversion values
-ConversionValueDialog_addConversionValue = Add Conversion Value
-ConversionValueDialog_editConversionValue = Edit Conversion Value
-ConversionValueDialog_addConversionValueDescriptionTitle = Create new conversion value
-ConversionValueDialog_addConversionValueDescription = Create a new conversion value setting both the 'data value' and the 'object value'
-ConversionValueDialog_editConversionValueDescriptionTitle = Edit conversion value
-ConversionValueDialog_editConversionValueDescription = Edit the conversion value, changing the 'data value' or 'object value'
-
-ConversionValueDialog_dataValue = Data value:
-ConversionValueDialog_objectValue = Object value:
-ConversionValueStateObject_dataValueMustBeSpecified = A data value must be specified.
-ConversionValueStateObject_objectValueMustBeSpecified = An object value must be specified.
-ConversionValueStateObject_dataValueAlreadyExists = This data value is already specified, cannot map multiple object values to the same data value.
-
-
-PrivateOwnedComposite_privateOwnedLabel = Private owned
-ReadOnlyComposite_readOnlyLabel = Read-only
-ReadOnlyComposite_readOnlyWithDefault = Read-only ({0})
-TypeConverterComposite_dataTypeLabel = Data type:
-TypeConverterComposite_objectTypeLabel = Object type:
-
-DefaultOneToOneMappingUiProvider_label=Default (One to One)
-DefaultVariableOneToOneMappingUiProvider_label=Default (Variable One to One)
-DefaultOneToManyMappingUiProvider_label=Default (One to Many)
-DefaultOneToOneMappingUiProvider_linkLabel=default (one to one)
-DefaultVariableOneToOneMappingUiProvider_linkLabel=default (variable one to one)
-DefaultOneToManyMappingUiProvider_linkLabel=default (one to many)
-
-ConvertersComposite_Label=Converters
-
-EclipseLinkConverterDialog_name=Name:
-EclipseLinkConverterDialog_converterType=Type:
-EclipseLinkConverterDialog_addConverter=Add Converter
-EclipseLinkConverterDialog_addConverterDescriptionTitle=Create new converter
-EclipseLinkConverterDialog_addConverterDescription=Create a new converter setting both the 'name' and the 'type'
-EclipseLinkConverterStateObject_nameMustBeSpecified = A name must be specified.
-EclipseLinkConverterStateObject_typeMustBeSpecified = A converter type must be specified.
-
diff --git a/jpa/plugins/org.eclipse.jpt.eclipselink.ui/src/org/eclipse/jpt/eclipselink/ui/JptEclipseLinkUiPlugin.java b/jpa/plugins/org.eclipse.jpt.eclipselink.ui/src/org/eclipse/jpt/eclipselink/ui/JptEclipseLinkUiPlugin.java
deleted file mode 100644
index d9b480236c..0000000000
--- a/jpa/plugins/org.eclipse.jpt.eclipselink.ui/src/org/eclipse/jpt/eclipselink/ui/JptEclipseLinkUiPlugin.java
+++ /dev/null
@@ -1,98 +0,0 @@
-/*******************************************************************************
- * Copyright (c) 2008, 2009 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.
- *
- * Contributors:
- * Oracle - initial API and implementation
- *******************************************************************************/
-package org.eclipse.jpt.eclipselink.ui;
-
-import org.eclipse.core.runtime.IStatus;
-import org.eclipse.core.runtime.Status;
-import org.eclipse.jface.resource.ImageDescriptor;
-import org.eclipse.swt.graphics.Image;
-import org.eclipse.ui.plugin.AbstractUIPlugin;
-import org.osgi.framework.BundleContext;
-
-/**
- * The activator class controls the plug-in life cycle
- *
- *
- * Provisional API: This interface is part of an interim API that is still
- * under development and expected to change significantly before reaching
- * stability. It is available at this early stage to solicit feedback from
- * pioneering adopters on the understanding that any code that uses this API
- * will almost certainly be broken (repeatedly) as the API evolves.
- */
-public class JptEclipseLinkUiPlugin extends AbstractUIPlugin
-{
-
- // The plug-in ID
- public static final String PLUGIN_ID = "org.eclipse.jpt.eclipselink.ui"; //$NON-NLS-1$
-
-
- // ********** singleton **********
- private static JptEclipseLinkUiPlugin INSTANCE;
-
- /**
- * Returns the singleton Plugin
- */
- public static JptEclipseLinkUiPlugin instance() {
- return INSTANCE;
- }
-
- public static void log(IStatus status) {
- INSTANCE.getLog().log(status);
- }
-
- public static void log(String msg) {
- log(new Status(IStatus.ERROR, PLUGIN_ID, IStatus.OK, msg, null));
- }
-
- public static void log(Throwable throwable) {
- log(new Status(IStatus.ERROR, PLUGIN_ID, IStatus.OK, throwable.getLocalizedMessage(), throwable));
- }
-
- // ********** Image API **********
- /**
- * This gets a .gif from the icons folder.
- */
- public static ImageDescriptor getImageDescriptor(String key) {
- if (! key.startsWith("icons/")) {
- key = "icons/" + key;
- }
- if (! key.endsWith(".gif")) {
- key = key + ".gif";
- }
- return imageDescriptorFromPlugin(PLUGIN_ID, key);
- }
-
- /**
- * This returns an image for a .gif from the icons folder
- */
- public static Image getImage(String key) {
- ImageDescriptor desc = getImageDescriptor(key);
- return (desc == null) ? null : desc.createImage();
- }
-
-
-
- // ********** constructors **********
- public JptEclipseLinkUiPlugin() {
- super();
- INSTANCE = this;
- }
-
- @Override
- public void start(BundleContext context) throws Exception {
- super.start(context);
- INSTANCE = this;
- }
- @Override
- public void stop(BundleContext context) throws Exception {
- INSTANCE = null;
- super.stop(context);
- }
-}
diff --git a/jpa/plugins/org.eclipse.jpt.eclipselink.ui/src/org/eclipse/jpt/eclipselink/ui/internal/EclipseLinkHelpContextIds.java b/jpa/plugins/org.eclipse.jpt.eclipselink.ui/src/org/eclipse/jpt/eclipselink/ui/internal/EclipseLinkHelpContextIds.java
deleted file mode 100644
index 3832c21f0a..0000000000
--- a/jpa/plugins/org.eclipse.jpt.eclipselink.ui/src/org/eclipse/jpt/eclipselink/ui/internal/EclipseLinkHelpContextIds.java
+++ /dev/null
@@ -1,57 +0,0 @@
-/*******************************************************************************
- * Copyright (c) 2009 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.
- *
- * Contributors:
- * Oracle - initial API and implementation
- ******************************************************************************/
-package org.eclipse.jpt.eclipselink.ui.internal;
-
-import org.eclipse.jpt.ui.JptUiPlugin;
-
-/**
- * Help context ids for the Dali EclipseLink UI.
- * <p>
- * This interface contains constants only; it is not intended to be
- * implemented.
- * </p>
- */
-@SuppressWarnings("nls")
-public interface EclipseLinkHelpContextIds {
-
- //ContextID prefix
- public static final String PREFIX = JptUiPlugin.PLUGIN_ID + ".";
-
- //Persistent Type composites
- public static final String CACHING_ALWAYS_REFRESH = PREFIX + "caching_alwaysRefresh";
- public static final String CACHING_CACHE_COORDINATION_TYPE = PREFIX + "caching_cacheCoordinationType";
- public static final String CACHING_CACHE_TYPE = PREFIX + "caching_cacheType";
- public static final String CACHING_DISABLE_HITS = PREFIX + "caching_disableHits";
- public static final String CACHING_REFRESH_ONLY_IF_NEWER = PREFIX + "caching_refreshOnlyIfNewer";
- public static final String CACHING_SHARED = PREFIX + "caching_shared";
-
- //Persistence Xml Editor
- public static final String PERSISTENCE_CACHING = PREFIX + "persistence_caching";
- public static final String PERSISTENCE_CUSTOMIZATION = PREFIX + "persistence_customization";
- public static final String PERSISTENCE_LOGGING = PREFIX + "persistence_logging";
- public static final String PERSISTENCE_OPTIONS = PREFIX + "persistence_options";
- public static final String PERSISTENCE_SCHEMA_GENERATION = PREFIX + "persistence_schemaGeneration";
-
- public static final String PERSISTENCE_CACHING_DEFAULT_SHARED = PREFIX + "caching_defaultShared";
- public static final String PERSISTENCE_CACHING_DEFAULT_SIZE = PREFIX + "caching_defaultSize";
- public static final String PERSISTENCE_CACHING_DEFAULT_TYPE = PREFIX + "caching_defaultType";
-
- public static final String PERSISTENCE_LOGGING_EXCEPTIONS = PREFIX + "logging_exceptions";
- public static final String PERSISTENCE_LOGGING_LEVEL = PREFIX + "logging_level";
- public static final String PERSISTENCE_LOGGING_SESSION = PREFIX + "logging_session";
- public static final String PERSISTENCE_LOGGING_THREAD = PREFIX + "logging_thread";
- public static final String PERSISTENCE_LOGGING_TIMESTAMP = PREFIX + "logging_timeStamp";
-
- public static final String PERSISTENCE_OPTIONS_SESSION_NAME = PREFIX + "options_sessionName";
- public static final String PERSISTENCE_OPTIONS_SESSIONS_XML = PREFIX + "options_sessionsXml";
- public static final String PERSISTENCE_OPTIONS_TARGET_DATABASE = PREFIX + "options_targetDatabase";
- public static final String PERSISTENCE_OPTIONS_TARGET_SERVER = PREFIX + "options_targetServer";
-
-}
diff --git a/jpa/plugins/org.eclipse.jpt.eclipselink.ui/src/org/eclipse/jpt/eclipselink/ui/internal/EclipseLinkJpaUiFactory.java b/jpa/plugins/org.eclipse.jpt.eclipselink.ui/src/org/eclipse/jpt/eclipselink/ui/internal/EclipseLinkJpaUiFactory.java
deleted file mode 100644
index f6600f06b2..0000000000
--- a/jpa/plugins/org.eclipse.jpt.eclipselink.ui/src/org/eclipse/jpt/eclipselink/ui/internal/EclipseLinkJpaUiFactory.java
+++ /dev/null
@@ -1,262 +0,0 @@
-/*******************************************************************************
- * Copyright (c) 2008, 2009 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.
- *
- * Contributors:
- * Oracle - initial API and implementation
- *******************************************************************************/
-package org.eclipse.jpt.eclipselink.ui.internal;
-
-import java.util.ArrayList;
-import java.util.ListIterator;
-import org.eclipse.jpt.core.context.java.JavaBasicMapping;
-import org.eclipse.jpt.core.context.java.JavaEmbeddable;
-import org.eclipse.jpt.core.context.java.JavaEntity;
-import org.eclipse.jpt.core.context.java.JavaIdMapping;
-import org.eclipse.jpt.core.context.java.JavaManyToManyMapping;
-import org.eclipse.jpt.core.context.java.JavaManyToOneMapping;
-import org.eclipse.jpt.core.context.java.JavaMappedSuperclass;
-import org.eclipse.jpt.core.context.java.JavaOneToManyMapping;
-import org.eclipse.jpt.core.context.java.JavaOneToOneMapping;
-import org.eclipse.jpt.core.context.java.JavaVersionMapping;
-import org.eclipse.jpt.core.context.persistence.PersistenceUnit;
-import org.eclipse.jpt.eclipselink.core.internal.context.java.EclipseLinkJavaOneToManyMapping;
-import org.eclipse.jpt.eclipselink.core.internal.context.persistence.EclipseLinkPersistenceUnit;
-import org.eclipse.jpt.eclipselink.core.internal.context.persistence.caching.Caching;
-import org.eclipse.jpt.eclipselink.core.internal.context.persistence.connection.Connection;
-import org.eclipse.jpt.eclipselink.core.internal.context.persistence.customization.Customization;
-import org.eclipse.jpt.eclipselink.core.internal.context.persistence.logging.Logging;
-import org.eclipse.jpt.eclipselink.core.internal.context.persistence.options.Options;
-import org.eclipse.jpt.eclipselink.core.internal.context.persistence.schema.generation.SchemaGeneration;
-import org.eclipse.jpt.eclipselink.ui.internal.java.details.EclipseLinkJavaEmbeddableComposite;
-import org.eclipse.jpt.eclipselink.ui.internal.java.details.EclipseLinkJavaEntityComposite;
-import org.eclipse.jpt.eclipselink.ui.internal.java.details.EclipseLinkJavaMappedSuperclassComposite;
-import org.eclipse.jpt.eclipselink.ui.internal.mappings.details.EclipseLinkBasicMappingComposite;
-import org.eclipse.jpt.eclipselink.ui.internal.mappings.details.EclipseLinkIdMappingComposite;
-import org.eclipse.jpt.eclipselink.ui.internal.mappings.details.EclipseLinkManyToManyMappingComposite;
-import org.eclipse.jpt.eclipselink.ui.internal.mappings.details.EclipseLinkManyToOneMappingComposite;
-import org.eclipse.jpt.eclipselink.ui.internal.mappings.details.EclipseLinkOneToManyMappingComposite;
-import org.eclipse.jpt.eclipselink.ui.internal.mappings.details.EclipseLinkOneToOneMappingComposite;
-import org.eclipse.jpt.eclipselink.ui.internal.mappings.details.EclipseLinkVersionMappingComposite;
-import org.eclipse.jpt.eclipselink.ui.internal.persistence.caching.PersistenceXmlCachingTab;
-import org.eclipse.jpt.eclipselink.ui.internal.persistence.connection.PersistenceXmlConnectionTab;
-import org.eclipse.jpt.eclipselink.ui.internal.persistence.customization.PersistenceXmlCustomizationTab;
-import org.eclipse.jpt.eclipselink.ui.internal.persistence.general.EclipseLinkPersistenceUnitGeneralComposite;
-import org.eclipse.jpt.eclipselink.ui.internal.persistence.logging.PersistenceXmlLoggingTab;
-import org.eclipse.jpt.eclipselink.ui.internal.persistence.options.PersistenceXmlOptionsTab;
-import org.eclipse.jpt.eclipselink.ui.internal.persistence.schema.generation.PersistenceXmlSchemaGenerationTab;
-import org.eclipse.jpt.ui.WidgetFactory;
-import org.eclipse.jpt.ui.details.JpaComposite;
-import org.eclipse.jpt.ui.details.JpaPageComposite;
-import org.eclipse.jpt.ui.internal.BaseJpaUiFactory;
-import org.eclipse.jpt.ui.internal.persistence.details.PersistenceUnitPropertiesComposite;
-import org.eclipse.jpt.utility.internal.model.value.TransformationPropertyValueModel;
-import org.eclipse.jpt.utility.model.value.PropertyValueModel;
-import org.eclipse.swt.widgets.Composite;
-
-public class EclipseLinkJpaUiFactory extends BaseJpaUiFactory
-{
- public EclipseLinkJpaUiFactory() {
- super();
- }
-
-
- // **************** persistence unit composites ****************************
-
- @Override
- public ListIterator<JpaPageComposite> createPersistenceUnitComposites(
- PropertyValueModel<PersistenceUnit> subjectHolder,
- Composite parent,
- WidgetFactory widgetFactory) {
-
- PropertyValueModel<EclipseLinkPersistenceUnit> eclipseLinkPersistenceUnitHolder =
- this.buildEclipseLinkPersistenceUnitHolder(subjectHolder);
- ArrayList<JpaPageComposite> pages =
- new ArrayList<JpaPageComposite>(8);
-
- pages.add(new EclipseLinkPersistenceUnitGeneralComposite(eclipseLinkPersistenceUnitHolder, parent, widgetFactory));
-
- PropertyValueModel<Connection> connectionHolder =
- this.buildConnectionHolder(eclipseLinkPersistenceUnitHolder);
- pages.add(new PersistenceXmlConnectionTab(connectionHolder, parent, widgetFactory));
-
- PropertyValueModel<Customization> customizationHolder =
- this.buildCustomizationHolder(eclipseLinkPersistenceUnitHolder);
- pages.add(new PersistenceXmlCustomizationTab(customizationHolder, parent, widgetFactory));
-
- PropertyValueModel<Caching> cachingHolder =
- this.buildCachingHolder(eclipseLinkPersistenceUnitHolder);
- pages.add(new PersistenceXmlCachingTab(cachingHolder, parent, widgetFactory));
-
- PropertyValueModel<Logging> loggingHolder =
- this.buildLoggingHolder(eclipseLinkPersistenceUnitHolder);
- pages.add(new PersistenceXmlLoggingTab(loggingHolder, parent, widgetFactory));
-
- PropertyValueModel<Options> optionsHolder =
- this.buildOptionsHolder(eclipseLinkPersistenceUnitHolder);
- pages.add(new PersistenceXmlOptionsTab(optionsHolder, parent, widgetFactory));
-
- PropertyValueModel<SchemaGeneration> schemaGenHolder =
- this.buildSchemaGenerationHolder(eclipseLinkPersistenceUnitHolder);
- pages.add(new PersistenceXmlSchemaGenerationTab(schemaGenHolder, parent, widgetFactory));
-
- pages.add(new PersistenceUnitPropertiesComposite(subjectHolder, parent, widgetFactory));
-
- return pages.listIterator();
- }
-
- private PropertyValueModel<EclipseLinkPersistenceUnit> buildEclipseLinkPersistenceUnitHolder(
- PropertyValueModel<PersistenceUnit> subjectHolder) {
- return new TransformationPropertyValueModel<PersistenceUnit, EclipseLinkPersistenceUnit>(subjectHolder) {
- @Override
- protected EclipseLinkPersistenceUnit transform_(PersistenceUnit value) {
- return (EclipseLinkPersistenceUnit) value;
- }
- };
- }
-
- private PropertyValueModel<Connection> buildConnectionHolder(
- PropertyValueModel<EclipseLinkPersistenceUnit> subjectHolder) {
- return new TransformationPropertyValueModel<EclipseLinkPersistenceUnit, Connection>(subjectHolder) {
- @Override
- protected Connection transform_(EclipseLinkPersistenceUnit value) {
- return value.getConnection();
- }
- };
- }
-
- private PropertyValueModel<Customization> buildCustomizationHolder(
- PropertyValueModel<EclipseLinkPersistenceUnit> subjectHolder) {
- return new TransformationPropertyValueModel<EclipseLinkPersistenceUnit, Customization>(subjectHolder) {
- @Override
- protected Customization transform_(EclipseLinkPersistenceUnit value) {
- return value.getCustomization();
- }
- };
- }
-
- private PropertyValueModel<Caching> buildCachingHolder(
- PropertyValueModel<EclipseLinkPersistenceUnit> subjectHolder) {
- return new TransformationPropertyValueModel<EclipseLinkPersistenceUnit, Caching>(subjectHolder) {
- @Override
- protected Caching transform_(EclipseLinkPersistenceUnit value) {
- return value.getCaching();
- }
- };
- }
-
- private PropertyValueModel<Logging> buildLoggingHolder(
- PropertyValueModel<EclipseLinkPersistenceUnit> subjectHolder) {
- return new TransformationPropertyValueModel<EclipseLinkPersistenceUnit, Logging>(subjectHolder) {
- @Override
- protected Logging transform_(EclipseLinkPersistenceUnit value) {
- return value.getLogging();
- }
- };
- }
-
- private PropertyValueModel<Options> buildOptionsHolder(
- PropertyValueModel<EclipseLinkPersistenceUnit> subjectHolder) {
- return new TransformationPropertyValueModel<EclipseLinkPersistenceUnit, Options>(subjectHolder) {
- @Override
- protected Options transform_(EclipseLinkPersistenceUnit value) {
- return value.getOptions();
- }
- };
- }
-
- private PropertyValueModel<SchemaGeneration> buildSchemaGenerationHolder(
- PropertyValueModel<EclipseLinkPersistenceUnit> subjectHolder) {
- return new TransformationPropertyValueModel<EclipseLinkPersistenceUnit, SchemaGeneration>(subjectHolder) {
- @Override
- protected SchemaGeneration transform_(EclipseLinkPersistenceUnit value) {
- return value.getSchemaGeneration();
- }
- };
- }
-
-
- // **************** java type mapping composites ***************************
-
- @Override
- public JpaComposite createJavaMappedSuperclassComposite(
- PropertyValueModel<JavaMappedSuperclass> subjectHolder,
- Composite parent, WidgetFactory widgetFactory) {
- return new EclipseLinkJavaMappedSuperclassComposite(subjectHolder, parent, widgetFactory);
- }
-
- @Override
- public JpaComposite createJavaEntityComposite(
- PropertyValueModel<JavaEntity> subjectHolder,
- Composite parent, WidgetFactory widgetFactory) {
- return new EclipseLinkJavaEntityComposite(subjectHolder, parent, widgetFactory);
- }
-
- @Override
- public JpaComposite createJavaEmbeddableComposite(
- PropertyValueModel<JavaEmbeddable> subjectHolder,
- Composite parent, WidgetFactory widgetFactory) {
- return new EclipseLinkJavaEmbeddableComposite(subjectHolder, parent, widgetFactory);
- }
-
-
- // **************** java attribute mapping composites **********************
-
- @Override
- public JpaComposite createJavaIdMappingComposite(
- PropertyValueModel<JavaIdMapping> subjectHolder,
- Composite parent,
- WidgetFactory widgetFactory) {
- return new EclipseLinkIdMappingComposite(subjectHolder, parent, widgetFactory);
- }
-
- @Override
- public JpaComposite createJavaBasicMappingComposite(
- PropertyValueModel<JavaBasicMapping> subjectHolder,
- Composite parent,
- WidgetFactory widgetFactory) {
- return new EclipseLinkBasicMappingComposite(subjectHolder, parent, widgetFactory);
- }
-
- @Override
- public JpaComposite createJavaVersionMappingComposite(
- PropertyValueModel<JavaVersionMapping> subjectHolder,
- Composite parent,
- WidgetFactory widgetFactory) {
- return new EclipseLinkVersionMappingComposite(subjectHolder, parent, widgetFactory);
- }
-
- @Override
- public JpaComposite createJavaManyToOneMappingComposite(
- PropertyValueModel<JavaManyToOneMapping> subjectHolder,
- Composite parent,
- WidgetFactory widgetFactory) {
- return new EclipseLinkManyToOneMappingComposite(subjectHolder, parent, widgetFactory);
- }
-
- @Override
- public JpaComposite createJavaOneToManyMappingComposite(
- PropertyValueModel<? extends JavaOneToManyMapping> subjectHolder,
- Composite parent,
- WidgetFactory widgetFactory) {
- return new EclipseLinkOneToManyMappingComposite((PropertyValueModel<EclipseLinkJavaOneToManyMapping>) subjectHolder, parent, widgetFactory);
- }
-
- @Override
- public JpaComposite createJavaOneToOneMappingComposite(
- PropertyValueModel<JavaOneToOneMapping> subjectHolder,
- Composite parent,
- WidgetFactory widgetFactory) {
- return new EclipseLinkOneToOneMappingComposite(subjectHolder, parent, widgetFactory);
- }
-
- @Override
- public JpaComposite createJavaManyToManyMappingComposite(
- PropertyValueModel<JavaManyToManyMapping> subjectHolder,
- Composite parent,
- WidgetFactory widgetFactory) {
- return new EclipseLinkManyToManyMappingComposite(subjectHolder, parent, widgetFactory);
- }
-} \ No newline at end of file
diff --git a/jpa/plugins/org.eclipse.jpt.eclipselink.ui/src/org/eclipse/jpt/eclipselink/ui/internal/EclipseLinkUiMessages.java b/jpa/plugins/org.eclipse.jpt.eclipselink.ui/src/org/eclipse/jpt/eclipselink/ui/internal/EclipseLinkUiMessages.java
deleted file mode 100644
index 76ba93a513..0000000000
--- a/jpa/plugins/org.eclipse.jpt.eclipselink.ui/src/org/eclipse/jpt/eclipselink/ui/internal/EclipseLinkUiMessages.java
+++ /dev/null
@@ -1,354 +0,0 @@
-/*******************************************************************************
-* Copyright (c) 2007, 2008 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.
-*
-* Contributors:
-* Oracle - initial API and implementation
-*******************************************************************************/
-package org.eclipse.jpt.eclipselink.ui.internal;
-
-import org.eclipse.osgi.util.NLS;
-
-/**
- * Localized messages used by ElipseLink UI.
- */
-public class EclipseLinkUiMessages {
-
- public static String MappingFileWizard_title;
- public static String MappingFileWizardPage_title;
- public static String MappingFileWizardPage_desc;
-
- public static String EclipseLink1_1MappingFileWizard_title;
- public static String EclipseLink1_1MappingFileWizardPage_title;
- public static String EclipseLink1_1MappingFileWizardPage_desc;
-
- public static String Boolean_True;
- public static String Boolean_False;
-
- public static String DefaultWithoutValue;
- public static String DefaultWithValue;
-
- public static String PersistenceXmlTabFolder_defaultEmpty;
- public static String PersistenceXmlTabFolder_defaultWithOneParam;
-
- public static String PersistenceXmlGeneralTab_name;
- public static String PersistenceXmlGeneralTab_provider;
- public static String PersistenceXmlGeneralTab_browse;
- public static String PersistenceXmlGeneralTab_description;
-
- // General
- public static String PersistenceXmlGeneralTab_title;
- public static String PersistenceXmlGeneralTab_generalSectionTitle;
- public static String PersistenceXmlGeneralTab_mappedClassesSectionTitle;
- public static String PersistenceXmlGeneralTab_mappedClassesSectionDescription;
- public static String PersistenceXmlGeneralTab_xmlMappingFilesSectionTitle;
- public static String PersistenceXmlGeneralTab_xmlMappingFilesSectionDescription;
-
- public static String PersistenceXmlGeneralTab_nameLabel;
- public static String PersistenceXmlGeneralTab_persistenceProviderLabel;
- public static String PersistenceXmlGeneralTab_descriptionLabel;
-
- public static String PersistenceXmlGeneralTab_excludeUnlistedMappedClasses;
- public static String PersistenceXmlGeneralTab_excludeUnlistedMappedClassesWithDefault;
- public static String PersistenceXmlGeneralTab_mappedClassesNoName;
- public static String PersistenceXmlGeneralTab_open;
-
- public static String PersistenceXmlGeneralTab_xmlMappingFilesDialog_title;
- public static String PersistenceXmlGeneralTab_xmlMappingFilesDialog_message;
- public static String PersistenceXmlGeneralTab_ormNoName;
- public static String PersistenceXmlGeneralTab_excludeEclipselinkOrm;
- public static String PersistenceXmlGeneralTab_excludeEclipselinkOrmWithDefault;
-
- // Connection
- public static String PersistenceXmlConnectionTab_title;
- public static String PersistenceXmlConnectionTab_sectionTitle;
- public static String PersistenceXmlConnectionTab_sectionDescription;
- public static String PersistenceXmlConnectionTab_defaultWithOneParam;
- public static String PersistenceXmlConnectionTab_defaultEmpty;
-
- public static String PersistenceXmlConnectionTab_transactionTypeLabel;
-
- public static String ConnectionPropertiesComposite_Database_GroupBox;
-
- public static String JdbcPropertiesComposite_EclipseLinkConnectionPool_GroupBox;
-
- public static String JdbcConnectionPropertiesComposite_ConnectionDialog_Message;
- public static String JdbcConnectionPropertiesComposite_ConnectionDialog_Title;
-
- public static String TransactionTypeComposite_jta;
- public static String TransactionTypeComposite_resource_local;
-
- public static String PersistenceXmlConnectionTab_nativeSqlLabel;
- public static String PersistenceXmlConnectionTab_nativeSqlLabelDefault;
-
- public static String PersistenceXmlConnectionTab_batchWritingLabel;
-
- public static String BatchWritingComposite_none;
- public static String BatchWritingComposite_jdbc;
- public static String BatchWritingComposite_buffered;
- public static String BatchWritingComposite_oracle_jdbc;
-
- public static String PersistenceXmlConnectionTab_cacheStatementsLabel;
-
- public static String PersistenceXmlConnectionTab_jtaDataSourceLabel;
- public static String PersistenceXmlConnectionTab_nonJtaDataSourceLabel;
-
- public static String PersistenceXmlConnectionTab_driverLabel;
- public static String PersistenceXmlConnectionTab_urlLabel;
- public static String PersistenceXmlConnectionTab_userLabel;
- public static String PersistenceXmlConnectionTab_passwordLabel;
- public static String PersistenceXmlConnectionTab_bindParametersLabel;
- public static String PersistenceXmlConnectionTab_bindParametersLabelDefault;
-
- public static String PersistenceXmlConnectionTab_readConnectionsSharedLabel;
- public static String PersistenceXmlConnectionTab_readConnectionsSharedLabelDefault;
- public static String PersistenceXmlConnectionTab_readConnectionsSectionTitle;
- public static String PersistenceXmlConnectionTab_readConnectionsMinLabel;
- public static String PersistenceXmlConnectionTab_readConnectionsMaxLabel;
- public static String PersistenceXmlConnectionTab_writeConnectionsSectionTitle;
- public static String PersistenceXmlConnectionTab_writeConnectionsMinLabel;
- public static String PersistenceXmlConnectionTab_writeConnectionsMaxLabel;
-
- // SchemaGeneration
- public static String PersistenceXmlSchemaGenerationTab_title;
- public static String PersistenceXmlSchemaGenerationTab_sectionTitle;
- public static String PersistenceXmlSchemaGenerationTab_sectionDescription;
- public static String PersistenceXmlSchemaGenerationTab_defaultWithOneParam;
- public static String PersistenceXmlSchemaGenerationTab_defaultEmpty;
-
- public static String PersistenceXmlSchemaGenerationTab_ddlGenerationTypeLabel;
- public static String PersistenceXmlSchemaGenerationTab_outputModeLabel;
-
- public static String PersistenceXmlSchemaGenerationTab_createDdlFileNameLabel;
- public static String PersistenceXmlSchemaGenerationTab_dropDdlFileNameLabel;
-
- public static String OutputModeComposite_both;
- public static String OutputModeComposite_sql_script;
- public static String OutputModeComposite_database;
-
- public static String DdlGenerationTypeComposite_none;
- public static String DdlGenerationTypeComposite_create_tables;
- public static String DdlGenerationTypeComposite_drop_and_create_tables;
-
- public static String PersistenceXmlSchemaGenerationTab_ddlGenerationLocationLabel;
-
- public static String DdlGenerationLocationComposite_dialogTitle;
- public static String DdlGenerationLocationComposite_dialogMessage;
-
- // Caching
- public static String PersistenceXmlCachingTab_title;
- public static String PersistenceXmlCachingTab_sectionTitle;
- public static String PersistenceXmlCachingTab_sectionDescription;
-
- public static String PersistenceXmlCachingTab_defaultCacheTypeLabel;
- public static String PersistenceXmlCachingTab_cacheTypeLabel;
-
- public static String PersistenceXmlCachingTab_defaultSharedCacheLabel;
- public static String PersistenceXmlCachingTab_sharedCacheLabel;
-
- public static String PersistenceXmlCachingTab_defaultSharedCacheDefaultLabel;
- public static String PersistenceXmlCachingTab_sharedCacheDefaultLabel;
-
- public static String CacheSizeComposite_cacheSize;
-
- public static String CacheTypeComposite_full;
- public static String CacheTypeComposite_hard_weak;
- public static String CacheTypeComposite_none;
- public static String CacheTypeComposite_soft;
- public static String CacheTypeComposite_soft_weak;
- public static String CacheTypeComposite_weak;
-
- public static String DefaultCacheSizeComposite_defaultCacheSize;
-
- public static String DefaultCacheTypeComposite_full;
- public static String DefaultCacheTypeComposite_hard_weak;
- public static String DefaultCacheTypeComposite_none;
- public static String DefaultCacheTypeComposite_soft;
- public static String DefaultCacheTypeComposite_soft_weak;
- public static String DefaultCacheTypeComposite_weak;
-
- public static String EntityDialog_selectEntity;
- public static String EntityDialog_name;
-
- public static String CachingEntityListComposite_groupTitle;
- public static String CachingEntityListComposite_editButton;
-
- public static String CachingEntityListComposite_dialogMessage;
- public static String CachingEntityListComposite_dialogTitle;
-
- public static String PersistenceXmlCachingTab_FlushClearCacheLabel;
-
- public static String FlushClearCacheComposite_drop;
- public static String FlushClearCacheComposite_drop_invalidate;
- public static String FlushClearCacheComposite_merge;
-
- // Customization
- public static String PersistenceXmlCustomizationTab_title;
- public static String PersistenceXmlCustomizationTab_sectionTitle;
- public static String PersistenceXmlCustomizationTab_sectionDescription;
- public static String PersistenceXmlCustomizationTab_defaultWithOneParam;
-
- public static String PersistenceXmlCustomizationTab_weavingLabel;
-
- public static String PersistenceXmlCustomizationTab_weavingLazyLabelDefault;
- public static String PersistenceXmlCustomizationTab_weavingLazyLabel;
-
- public static String PersistenceXmlCustomizationTab_weavingChangeTrackingLabelDefault;
- public static String PersistenceXmlCustomizationTab_weavingChangeTrackingLabel;
-
- public static String PersistenceXmlCustomizationTab_weavingFetchGroupsLabelDefault;
- public static String PersistenceXmlCustomizationTab_weavingFetchGroupsLabel;
-
- public static String PersistenceXmlCustomizationTab_weavingInternalLabelDefault;
- public static String PersistenceXmlCustomizationTab_weavingInternalLabel;
-
- public static String PersistenceXmlCustomizationTab_weavingEagerLabelDefault;
- public static String PersistenceXmlCustomizationTab_weavingEagerLabel;
- public static String PersistenceXmlCustomizationTab_defaultEmpty;
-
- public static String PersistenceXmlCustomizationTab_throwExceptionsLabelDefault;
- public static String PersistenceXmlCustomizationTab_throwExceptionsLabel;
-
- public static String PersistenceXmlCustomizationTab_exceptionHandlerLabel;
-
- public static String WeavingComposite_true_;
- public static String WeavingComposite_false_;
- public static String WeavingComposite_static_;
-
- public static String CustomizationEntityListComposite_groupTitle;
- public static String CustomizationEntityListComposite_editButton;
-
- public static String CustomizationEntityListComposite_dialogMessage;
- public static String CustomizationEntityListComposite_dialogTitle;
-
- public static String PersistenceXmlCustomizationTab_customizerLabel;
- public static String PersistenceXmlCustomizationTab_sessionCustomizerLabel;
- public static String PersistenceXmlCustomizationTab_noName;
-
- public static String PersistenceXmlCustomizationTab_validationOnlyLabel;
- public static String PersistenceXmlCustomizationTab_validationOnlyLabelDefault;
-
- public static String PersistenceXmlCustomizationTab_profilerLabel;
- public static String PersistenceXmlCustomizationTab_browse;
-
- public static String ProfilerComposite_performance_profiler;
- public static String ProfilerComposite_query_monitor;
- public static String ProfilerComposite_no_profiler;
-
- // Logging
- public static String PersistenceXmlLoggingTab_title;
- public static String PersistenceXmlLoggingTab_sectionTitle;
- public static String PersistenceXmlLoggingTab_sectionDescription;
- public static String PersistenceXmlLoggingTab_defaultWithOneParam;
- public static String PersistenceXmlLoggingTab_defaultEmpty;
-
- public static String PersistenceXmlLoggingTab_loggingLevelLabel;
-
- public static String LoggingLevelComposite_off;
- public static String LoggingLevelComposite_severe;
- public static String LoggingLevelComposite_warning;
- public static String LoggingLevelComposite_info;
- public static String LoggingLevelComposite_config;
- public static String LoggingLevelComposite_fine;
- public static String LoggingLevelComposite_finer;
- public static String LoggingLevelComposite_finest;
- public static String LoggingLevelComposite_all;
-
- public static String PersistenceXmlLoggingTab_loggerLabel;
- public static String PersistenceXmlLoggingTab_browse;
-
- public static String LoggerComposite_default_logger;
- public static String LoggerComposite_java_logger;
- public static String LoggerComposite_server_logger;
-
- public static String PersistenceXmlLoggingTab_timestampLabel;
- public static String PersistenceXmlLoggingTab_timestampLabelDefault;
- public static String PersistenceXmlLoggingTab_threadLabel;
- public static String PersistenceXmlLoggingTab_threadLabelDefault;
- public static String PersistenceXmlLoggingTab_sessionLabel;
- public static String PersistenceXmlLoggingTab_sessionLabelDefault;
- public static String PersistenceXmlLoggingTab_exceptionsLabel;
- public static String PersistenceXmlLoggingTab_exceptionsLabelDefault;
-
- public static String PersistenceXmlLoggingTab_loggersLabel;
- public static String PersistenceXmlLoggingTab_loggingFileLabel;
-
- public static String LoggingFileLocationComposite_dialogTitle;
- public static String LoggingFileLocationComposite_dialogMessage;
-
- // Session Options
- public static String PersistenceXmlOptionsTab_title;
- public static String PersistenceXmlOptionsTab_sessionSectionTitle;
- public static String PersistenceXmlOptionsTab_sessionSectionDescription;
- public static String PersistenceXmlOptionsTab_defaultWithOneParam;
- public static String PersistenceXmlOptionsTab_defaultEmpty;
-
- public static String PersistenceXmlOptionsTab_sessionName;
- public static String PersistenceXmlOptionsTab_sessionsXml;
-
- public static String PersistenceXmlOptionsTab_includeDescriptorQueriesLabel;
- public static String PersistenceXmlOptionsTab_includeDescriptorQueriesLabelDefault;
-
- public static String PersistenceXmlOptionsTab_eventListenerLabel;
- public static String PersistenceXmlOptionsTab_targetDatabaseLabel;
-
- public static String PersistenceXmlOptionsTab_miscellaneousSectionTitle;
- public static String PersistenceXmlOptionsTab_miscellaneousSectionDescription;
-
- public static String PersistenceXmlOptionsTab_temporalMutableLabel;
- public static String PersistenceXmlOptionsTab_temporalMutableLabelDefault;
-
- public static String TargetDatabaseComposite_attunity;
- public static String TargetDatabaseComposite_auto;
- public static String TargetDatabaseComposite_cloudscape;
- public static String TargetDatabaseComposite_database;
- public static String TargetDatabaseComposite_db2;
- public static String TargetDatabaseComposite_db2mainframe;
- public static String TargetDatabaseComposite_dbase;
- public static String TargetDatabaseComposite_derby;
- public static String TargetDatabaseComposite_hsql;
- public static String TargetDatabaseComposite_informix;
- public static String TargetDatabaseComposite_javadb;
- public static String TargetDatabaseComposite_mysql;
- public static String TargetDatabaseComposite_oracle;
- public static String TargetDatabaseComposite_oracle11;
- public static String TargetDatabaseComposite_oracle10;
- public static String TargetDatabaseComposite_oracle9;
- public static String TargetDatabaseComposite_oracle8;
- public static String TargetDatabaseComposite_pointbase;
- public static String TargetDatabaseComposite_postgresql;
- public static String TargetDatabaseComposite_sqlanywhere;
- public static String TargetDatabaseComposite_sqlserver;
- public static String TargetDatabaseComposite_sybase;
- public static String TargetDatabaseComposite_timesten;
-
- public static String PersistenceXmlOptionsTab_targetServerLabel;
-
- public static String TargetServerComposite_none;
- public static String TargetServerComposite_oc4j;
- public static String TargetServerComposite_sunas9;
- public static String TargetServerComposite_websphere;
- public static String TargetServerComposite_websphere_6_1;
- public static String TargetServerComposite_weblogic;
- public static String TargetServerComposite_weblogic_9;
- public static String TargetServerComposite_weblogic_10;
- public static String TargetServerComposite_jboss;
-
- // DDL Generation
- public static String EclipseLinkDDLGeneratorUi_generatingDDLWarningTitle;
- public static String EclipseLinkDDLGeneratorUi_generatingDDLWarningMessage;
- public static String EclipseLinkDDLGeneratorUi_error;
-
- private static final String BUNDLE_NAME = "eclipselink_ui"; //$NON-NLS-1$
- private static final Class<?> BUNDLE_CLASS = EclipseLinkUiMessages.class;
- static {
- NLS.initializeMessages(BUNDLE_NAME, BUNDLE_CLASS);
- }
-
- private EclipseLinkUiMessages() {
- throw new UnsupportedOperationException();
- }
-
-}
diff --git a/jpa/plugins/org.eclipse.jpt.eclipselink.ui/src/org/eclipse/jpt/eclipselink/ui/internal/ddlgen/EclipseLinkDDLGeneratorUi.java b/jpa/plugins/org.eclipse.jpt.eclipselink.ui/src/org/eclipse/jpt/eclipselink/ui/internal/ddlgen/EclipseLinkDDLGeneratorUi.java
deleted file mode 100644
index 1a23b0742a..0000000000
--- a/jpa/plugins/org.eclipse.jpt.eclipselink.ui/src/org/eclipse/jpt/eclipselink/ui/internal/ddlgen/EclipseLinkDDLGeneratorUi.java
+++ /dev/null
@@ -1,167 +0,0 @@
-/*******************************************************************************
-* Copyright (c) 2007, 2008 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.
-*
-* Contributors:
-* Oracle - initial API and implementation
-*******************************************************************************/
-package org.eclipse.jpt.eclipselink.ui.internal.ddlgen;
-
-import java.util.Iterator;
-
-import org.eclipse.core.resources.IWorkspaceRunnable;
-import org.eclipse.core.resources.ResourcesPlugin;
-import org.eclipse.core.runtime.CoreException;
-import org.eclipse.core.runtime.IProgressMonitor;
-import org.eclipse.core.runtime.NullProgressMonitor;
-import org.eclipse.core.runtime.OperationCanceledException;
-import org.eclipse.jface.dialogs.MessageDialog;
-import org.eclipse.jface.window.Window;
-import org.eclipse.jface.wizard.WizardDialog;
-import org.eclipse.jpt.core.JpaPlatform;
-import org.eclipse.jpt.core.JpaProject;
-import org.eclipse.jpt.core.context.persistence.Persistence;
-import org.eclipse.jpt.core.context.persistence.PersistenceUnit;
-import org.eclipse.jpt.eclipselink.core.internal.ddlgen.EclipseLinkDDLGenerator;
-import org.eclipse.jpt.eclipselink.ui.internal.EclipseLinkUiMessages;
-import org.eclipse.jpt.eclipselink.ui.internal.ddlgen.wizards.GenerateDDLWizard;
-import org.eclipse.jpt.utility.internal.StringTools;
-import org.eclipse.swt.widgets.Display;
-import org.eclipse.swt.widgets.Shell;
-
-/**
- * EclipseLinkDLLGeneratorUi is used by the EclipseLinkPlatformUi to initiate
- * the execution of EclipseLink DDL generator.
- */
-public class EclipseLinkDDLGeneratorUi
-{
- private final JpaProject project;
- private static final String CR = StringTools.CR;
-
- // ********** constructors **********
-
- public static void generate(JpaProject project) {
- new EclipseLinkDDLGeneratorUi(project).generate();
- }
-
- private EclipseLinkDDLGeneratorUi(JpaProject project) {
- super();
- if (project == null) {
- throw new NullPointerException();
- }
- this.project = project;
- }
-
- // ********** behavior **********
-
- protected void generate() {
-
- PersistenceUnit persistenceUnit = this.getPersistenceUnits().next(); // Take the first persistenceUnit
- String puName = persistenceUnit.getName();
- if( ! this.displayGeneratingDDLWarning()) {
- return;
- }
-
- GenerateDDLWizard wizard = new GenerateDDLWizard(this.project);
- WizardDialog dialog = new WizardDialog(this.getCurrentShell(), wizard);
- dialog.create();
- if(wizard.getPageCount() > 0) {
- int returnCode = dialog.open();
- if (returnCode == Window.CANCEL) {
- return;
- }
- }
- IWorkspaceRunnable runnable = new GenerateDDLRunnable(puName, this.project);
- try {
- ResourcesPlugin.getWorkspace().run(runnable, new NullProgressMonitor());
- }
- catch (CoreException ex) {
- throw new RuntimeException(ex);
- }
- }
-
- private Shell getCurrentShell() {
- return Display.getCurrent().getActiveShell();
- }
-
- private boolean displayGeneratingDDLWarning() {
- String message = org.eclipse.osgi.util.NLS.bind(
- EclipseLinkUiMessages.EclipseLinkDDLGeneratorUi_generatingDDLWarningMessage,
- CR, CR + CR);
-
- return MessageDialog.openQuestion(
- this.getCurrentShell(),
- EclipseLinkUiMessages.EclipseLinkDDLGeneratorUi_generatingDDLWarningTitle,
- message);
- }
-
- // ********** Persistence Unit **********
-
- protected JpaPlatform getPlatform() {
- return this.project.getJpaPlatform();
- }
-
- protected Iterator<PersistenceUnit> getPersistenceUnits() {
- return this.getPersistence().persistenceUnits();
- }
-
- protected Persistence getPersistence() {
- return this.project.getRootContextNode().getPersistenceXml().getPersistence();
- }
-
- // ********** runnable **********
-
- static class GenerateDDLRunnable implements IWorkspaceRunnable {
- private final String puName;
- private final JpaProject project;
-
- GenerateDDLRunnable(String puName, JpaProject project) {
- super();
- this.puName = puName;
- this.project = project;
- }
-
- public void run(IProgressMonitor monitor) {
- String projectLocation = this.project.getProject().getLocation().toString();
- try {
- EclipseLinkDDLGenerator.generate(this.puName, this.project, projectLocation, monitor);
- }
- catch (OperationCanceledException e) {
- return;
- // fall through and tell monitor we are done
- }
- catch (RuntimeException re) {
- String msg = re.getMessage();
- String message = (msg == null) ? re.toString() : msg;
-
- this.logError(message);
- throw new RuntimeException(re);
- }
- }
-
- protected void logError(String message) {
- this.displayError(message);
- }
-
- private void displayError(String message) {
- MessageDialog.openError(
- getShell(),
- EclipseLinkUiMessages.EclipseLinkDDLGeneratorUi_error,
- message
- );
- }
-
- private Shell getShell() {
- Display display = Display.getCurrent();
- Shell shell = (display == null) ? null : display.getActiveShell();
- if (shell == null && display != null) {
- Shell[] shells = display.getShells();
- if (shells.length > 0)
- shell = shells[0];
- }
- return shell;
- }
- }
-}
diff --git a/jpa/plugins/org.eclipse.jpt.eclipselink.ui/src/org/eclipse/jpt/eclipselink/ui/internal/ddlgen/wizards/GenerateDDLWizard.java b/jpa/plugins/org.eclipse.jpt.eclipselink.ui/src/org/eclipse/jpt/eclipselink/ui/internal/ddlgen/wizards/GenerateDDLWizard.java
deleted file mode 100644
index 364e5b2bab..0000000000
--- a/jpa/plugins/org.eclipse.jpt.eclipselink.ui/src/org/eclipse/jpt/eclipselink/ui/internal/ddlgen/wizards/GenerateDDLWizard.java
+++ /dev/null
@@ -1,56 +0,0 @@
-/*******************************************************************************
-* Copyright (c) 2007, 2009 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.
-*
-* Contributors:
-* Oracle - initial API and implementation
-*******************************************************************************/
-package org.eclipse.jpt.eclipselink.ui.internal.ddlgen.wizards;
-
-import org.eclipse.jface.wizard.Wizard;
-import org.eclipse.jpt.core.JpaProject;
-import org.eclipse.jpt.db.ConnectionProfile;
-import org.eclipse.jpt.ui.internal.JptUiMessages;
-import org.eclipse.jpt.ui.internal.wizards.DatabaseSchemaWizardPage;
-
-/**
- * GenerateDDLWizard
- */
-public class GenerateDDLWizard extends Wizard {
-
- private JpaProject jpaProject;
-
- private DatabaseSchemaWizardPage dbSettingsPage;
-
- public GenerateDDLWizard(JpaProject jpaProject) {
- super();
- this.jpaProject = jpaProject;
- this.setWindowTitle(JptUiMessages.GenerateDDLWizard_title);
- }
-
- @Override
- public void addPages() {
- super.addPages();
- if (this.getJpaProjectConnectionProfile() == null) {
- this.dbSettingsPage = new DatabaseSchemaWizardPage(this.jpaProject);
- this.addPage(this.dbSettingsPage);
- }
- }
-
- @Override
- public boolean performFinish() {
- return (this.getJpaProjectConnectionProfile() != null);
- }
-
- @Override
- public boolean canFinish() {
- return this.dbSettingsPage.isPageComplete();
- }
-
- private ConnectionProfile getJpaProjectConnectionProfile() {
- return this.jpaProject.getConnectionProfile();
- }
-
-}
diff --git a/jpa/plugins/org.eclipse.jpt.eclipselink.ui/src/org/eclipse/jpt/eclipselink/ui/internal/java/details/ConvertersComposite.java b/jpa/plugins/org.eclipse.jpt.eclipselink.ui/src/org/eclipse/jpt/eclipselink/ui/internal/java/details/ConvertersComposite.java
deleted file mode 100644
index b1141167b9..0000000000
--- a/jpa/plugins/org.eclipse.jpt.eclipselink.ui/src/org/eclipse/jpt/eclipselink/ui/internal/java/details/ConvertersComposite.java
+++ /dev/null
@@ -1,271 +0,0 @@
-/*******************************************************************************
- * Copyright (c) 2008 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.
- *
- * Contributors:
- * Oracle - initial API and implementation
- ******************************************************************************/
-package org.eclipse.jpt.eclipselink.ui.internal.java.details;
-
-import org.eclipse.jpt.eclipselink.core.context.CustomConverter;
-import org.eclipse.jpt.eclipselink.core.context.ObjectTypeConverter;
-import org.eclipse.jpt.eclipselink.core.context.StructConverter;
-import org.eclipse.jpt.eclipselink.core.context.TypeConverter;
-import org.eclipse.jpt.eclipselink.core.context.java.JavaConverterHolder;
-import org.eclipse.jpt.eclipselink.ui.internal.mappings.EclipseLinkUiMappingsMessages;
-import org.eclipse.jpt.eclipselink.ui.internal.mappings.details.CustomConverterComposite;
-import org.eclipse.jpt.eclipselink.ui.internal.mappings.details.ObjectTypeConverterComposite;
-import org.eclipse.jpt.eclipselink.ui.internal.mappings.details.StructConverterComposite;
-import org.eclipse.jpt.eclipselink.ui.internal.mappings.details.TypeConverterComposite;
-import org.eclipse.jpt.ui.internal.widgets.Pane;
-import org.eclipse.jpt.utility.internal.model.value.PropertyAspectAdapter;
-import org.eclipse.jpt.utility.model.value.PropertyValueModel;
-import org.eclipse.jpt.utility.model.value.WritablePropertyValueModel;
-import org.eclipse.swt.widgets.Button;
-import org.eclipse.swt.widgets.Composite;
-
-/**
- * Here the layout of this pane:
- * <pre>
- * -----------------------------------------------------------------------------
- * | X CustomConverter |
- * | |
- * | ----------------------------------------------------------------------- |
- * | | | |
- * | | CustomConverterComposite | |
- * | | | |
- * | ----------------------------------------------------------------------- |
- * | |
- * | X Type Converter |
- * | |
- * | ----------------------------------------------------------------------- |
- * | | | |
- * | | TypeConverterComposite | |
- * | | | |
- * | ----------------------------------------------------------------------- |
- * | |
- * | X Oject Type Converter |
- * | |
- * | ----------------------------------------------------------------------- |
- * | | | |
- * | | ObjectTypeConverterComposite | |
- * | | | |
- * | ----------------------------------------------------------------------- |
- * | |
- * | X Struct Converter |
- * | |
- * | ----------------------------------------------------------------------- |
- * | | | |
- * | | StructConverterComposite | |
- * | | | |
- * | ----------------------------------------------------------------------- |
- * -----------------------------------------------------------------------------</pre>
- *
- *
- * @version 2.1
- * @since 2.1
- */
-public class ConvertersComposite extends Pane<JavaConverterHolder>
-{
-
- /**
- * Creates a new <code>ConversionComposite</code>.
- *
- * @param parentPane The parent container of this one
- * @param parent The parent container
- */
- public ConvertersComposite(Pane<?> parentPane,
- PropertyValueModel<? extends JavaConverterHolder> subjectHolder,
- Composite parent) {
-
- super(parentPane, subjectHolder, parent, false);
- }
-
- @Override
- protected void initializeLayout(Composite container) {
-
- initializeConverterPane(container);
- }
-
- private void initializeConverterPane(Composite container) {
- // Custom Converter check box
- Button customConverterCheckBox = addCheckBox(
- addSubPane(container, 5),
- EclipseLinkUiMappingsMessages.ConvertersComposite_customConverter,
- buildCustomConverterBooleanHolder(),
- null
- );
-
- // Custom Converter pane
- CustomConverterComposite customConverterComposite = new CustomConverterComposite(
- buildCustomConverterHolder(),
- addSubPane(container, 0, customConverterCheckBox.getBorderWidth() + 16),
- getWidgetFactory()
- );
- registerSubPane(customConverterComposite);
-
-
- // Type Converter check box
- Button typeConverterCheckBox = addCheckBox(
- addSubPane(container, 5),
- EclipseLinkUiMappingsMessages.ConvertersComposite_typeConverter,
- buildTypeConverterBooleanHolder(),
- null
- );
-
- // Type Converter pane
- TypeConverterComposite typeConverterComposite = new TypeConverterComposite(
- buildTypeConverterHolder(),
- addSubPane(container, 0, typeConverterCheckBox.getBorderWidth() + 16),
- getWidgetFactory()
- );
- registerSubPane(typeConverterComposite);
-
- // Object Type Converter check box
- Button objectTypeConverterCheckBox = addCheckBox(
- addSubPane(container, 5),
- EclipseLinkUiMappingsMessages.ConvertersComposite_objectTypeConverter,
- buildObjectTypeConverterBooleanHolder(),
- null
- );
-
- // Object Type Converter pane
- ObjectTypeConverterComposite objectTypeConverterComposite = new ObjectTypeConverterComposite(
- buildObjectTypeConverterHolder(),
- addSubPane(container, 0, objectTypeConverterCheckBox.getBorderWidth() + 16),
- getWidgetFactory()
- );
- registerSubPane(objectTypeConverterComposite);
-
- // Struct Converter check box
- Button structConverterCheckBox = addCheckBox(
- addSubPane(container, 5),
- EclipseLinkUiMappingsMessages.ConvertersComposite_structConverter,
- buildStructConverterBooleanHolder(),
- null
- );
-
- // Struct Converter pane
- StructConverterComposite structConverterComposite = new StructConverterComposite(
- buildStructConverterHolder(),
- addSubPane(container, 0, structConverterCheckBox.getBorderWidth() + 16),
- getWidgetFactory()
- );
- registerSubPane(structConverterComposite);
- }
-
- private WritablePropertyValueModel<Boolean> buildCustomConverterBooleanHolder() {
- return new PropertyAspectAdapter<JavaConverterHolder, Boolean>(getSubjectHolder(), JavaConverterHolder.CUSTOM_CONVERTER_PROPERTY) {
- @Override
- protected Boolean buildValue_() {
- return Boolean.valueOf(this.subject.getCustomConverter() != null);
- }
-
- @Override
- protected void setValue_(Boolean value) {
- if (value.booleanValue() && (this.subject.getCustomConverter() == null)) {
- this.subject.addCustomConverter();
- }
- else if (!value.booleanValue() && (this.subject.getCustomConverter() != null)) {
- this.subject.removeCustomConverter();
- }
- }
- };
- }
-
- private PropertyValueModel<CustomConverter> buildCustomConverterHolder() {
- return new PropertyAspectAdapter<JavaConverterHolder, CustomConverter>(getSubjectHolder(), JavaConverterHolder.CUSTOM_CONVERTER_PROPERTY) {
- @Override
- protected CustomConverter buildValue_() {
- return this.subject.getCustomConverter();
- }
- };
- }
-
- private WritablePropertyValueModel<Boolean> buildTypeConverterBooleanHolder() {
- return new PropertyAspectAdapter<JavaConverterHolder, Boolean>(getSubjectHolder(), JavaConverterHolder.TYPE_CONVERTER_PROPERTY) {
- @Override
- protected Boolean buildValue_() {
- return Boolean.valueOf(this.subject.getTypeConverter() != null);
- }
-
- @Override
- protected void setValue_(Boolean value) {
- if (value.booleanValue() && (this.subject.getTypeConverter() == null)) {
- this.subject.addTypeConverter();
- }
- else if (!value.booleanValue() && (this.subject.getTypeConverter() != null)) {
- this.subject.removeTypeConverter();
- }
- }
- };
- }
-
- private PropertyValueModel<TypeConverter> buildTypeConverterHolder() {
- return new PropertyAspectAdapter<JavaConverterHolder, TypeConverter>(getSubjectHolder(), JavaConverterHolder.TYPE_CONVERTER_PROPERTY) {
- @Override
- protected TypeConverter buildValue_() {
- return this.subject.getTypeConverter();
- }
- };
- }
-
- private WritablePropertyValueModel<Boolean> buildObjectTypeConverterBooleanHolder() {
- return new PropertyAspectAdapter<JavaConverterHolder, Boolean>(getSubjectHolder(), JavaConverterHolder.OBJECT_TYPE_CONVERTER_PROPERTY) {
- @Override
- protected Boolean buildValue_() {
- return Boolean.valueOf(this.subject.getObjectTypeConverter() != null);
- }
-
- @Override
- protected void setValue_(Boolean value) {
- if (value.booleanValue() && (this.subject.getObjectTypeConverter() == null)) {
- this.subject.addObjectTypeConverter();
- }
- else if (!value.booleanValue() && (this.subject.getObjectTypeConverter() != null)) {
- this.subject.removeObjectTypeConverter();
- }
- }
- };
- }
-
- private PropertyValueModel<ObjectTypeConverter> buildObjectTypeConverterHolder() {
- return new PropertyAspectAdapter<JavaConverterHolder, ObjectTypeConverter>(getSubjectHolder(), JavaConverterHolder.OBJECT_TYPE_CONVERTER_PROPERTY) {
- @Override
- protected ObjectTypeConverter buildValue_() {
- return this.subject.getObjectTypeConverter();
- }
- };
- }
-
-
- private WritablePropertyValueModel<Boolean> buildStructConverterBooleanHolder() {
- return new PropertyAspectAdapter<JavaConverterHolder, Boolean>(getSubjectHolder(), JavaConverterHolder.STRUCT_CONVERTER_PROPERTY) {
- @Override
- protected Boolean buildValue_() {
- return Boolean.valueOf(this.subject.getStructConverter() != null);
- }
-
- @Override
- protected void setValue_(Boolean value) {
- if (value.booleanValue() && (this.subject.getStructConverter() == null)) {
- this.subject.addStructConverter();
- }
- else if (!value.booleanValue() && (this.subject.getStructConverter() != null)) {
- this.subject.removeStructConverter();
- }
- }
- };
- }
-
- private PropertyValueModel<StructConverter> buildStructConverterHolder() {
- return new PropertyAspectAdapter<JavaConverterHolder, StructConverter>(getSubjectHolder(), JavaConverterHolder.STRUCT_CONVERTER_PROPERTY) {
- @Override
- protected StructConverter buildValue_() {
- return this.subject.getStructConverter();
- }
- };
- }
-}
diff --git a/jpa/plugins/org.eclipse.jpt.eclipselink.ui/src/org/eclipse/jpt/eclipselink/ui/internal/java/details/DefaultOneToManyMappingUiProvider.java b/jpa/plugins/org.eclipse.jpt.eclipselink.ui/src/org/eclipse/jpt/eclipselink/ui/internal/java/details/DefaultOneToManyMappingUiProvider.java
deleted file mode 100644
index bbf6cc066e..0000000000
--- a/jpa/plugins/org.eclipse.jpt.eclipselink.ui/src/org/eclipse/jpt/eclipselink/ui/internal/java/details/DefaultOneToManyMappingUiProvider.java
+++ /dev/null
@@ -1,85 +0,0 @@
-/*******************************************************************************
- * Copyright (c) 2008 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.
- *
- * Contributors:
- * Oracle - initial API and implementation
- ******************************************************************************/
-package org.eclipse.jpt.eclipselink.ui.internal.java.details;
-
-import org.eclipse.core.runtime.content.IContentType;
-import org.eclipse.jpt.core.JptCorePlugin;
-import org.eclipse.jpt.core.MappingKeys;
-import org.eclipse.jpt.core.context.java.JavaOneToManyMapping;
-import org.eclipse.jpt.eclipselink.ui.internal.mappings.EclipseLinkUiMappingsMessages;
-import org.eclipse.jpt.ui.JpaUiFactory;
-import org.eclipse.jpt.ui.WidgetFactory;
-import org.eclipse.jpt.ui.details.DefaultAttributeMappingUiProvider;
-import org.eclipse.jpt.ui.details.JpaComposite;
-import org.eclipse.jpt.ui.internal.JpaMappingImageHelper;
-import org.eclipse.jpt.ui.internal.details.AbstractOneToManyMappingUiProvider;
-import org.eclipse.jpt.utility.model.value.PropertyValueModel;
-import org.eclipse.swt.graphics.Image;
-import org.eclipse.swt.widgets.Composite;
-
-public class DefaultOneToManyMappingUiProvider
- extends AbstractOneToManyMappingUiProvider<JavaOneToManyMapping>
- implements DefaultAttributeMappingUiProvider<JavaOneToManyMapping>
-{
- // singleton
- private static final DefaultOneToManyMappingUiProvider INSTANCE =
- new DefaultOneToManyMappingUiProvider();
-
- /**
- * Return the singleton.
- */
- public static DefaultAttributeMappingUiProvider<JavaOneToManyMapping> instance() {
- return INSTANCE;
- }
-
-
- /**
- * Ensure single instance.
- */
- private DefaultOneToManyMappingUiProvider() {
- super();
- }
-
- public IContentType getContentType() {
- return JptCorePlugin.JAVA_SOURCE_CONTENT_TYPE;
- }
-
- @Override
- public String getKey() {
- return null;
- }
-
- public String getDefaultKey() {
- return MappingKeys.ONE_TO_MANY_ATTRIBUTE_MAPPING_KEY;
- }
-
- @Override
- public String getLabel() {
- return EclipseLinkUiMappingsMessages.DefaultOneToManyMappingUiProvider_label;
- }
-
- @Override
- public String getLinkLabel() {
- return EclipseLinkUiMappingsMessages.DefaultOneToManyMappingUiProvider_linkLabel;
- }
-
- @Override
- public Image getImage() {
- return JpaMappingImageHelper.imageForAttributeMapping(getDefaultKey());
- }
-
- public JpaComposite buildAttributeMappingComposite(
- JpaUiFactory factory,
- PropertyValueModel<JavaOneToManyMapping> subjectHolder,
- Composite parent,
- WidgetFactory widgetFactory) {
- return factory.createJavaOneToManyMappingComposite(subjectHolder, parent, widgetFactory);
- }
-}
diff --git a/jpa/plugins/org.eclipse.jpt.eclipselink.ui/src/org/eclipse/jpt/eclipselink/ui/internal/java/details/DefaultOneToOneMappingUiProvider.java b/jpa/plugins/org.eclipse.jpt.eclipselink.ui/src/org/eclipse/jpt/eclipselink/ui/internal/java/details/DefaultOneToOneMappingUiProvider.java
deleted file mode 100644
index 80f2140730..0000000000
--- a/jpa/plugins/org.eclipse.jpt.eclipselink.ui/src/org/eclipse/jpt/eclipselink/ui/internal/java/details/DefaultOneToOneMappingUiProvider.java
+++ /dev/null
@@ -1,85 +0,0 @@
-/*******************************************************************************
- * Copyright (c) 2008 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.
- *
- * Contributors:
- * Oracle - initial API and implementation
- ******************************************************************************/
-package org.eclipse.jpt.eclipselink.ui.internal.java.details;
-
-import org.eclipse.core.runtime.content.IContentType;
-import org.eclipse.jpt.core.JptCorePlugin;
-import org.eclipse.jpt.core.MappingKeys;
-import org.eclipse.jpt.core.context.java.JavaOneToOneMapping;
-import org.eclipse.jpt.eclipselink.ui.internal.mappings.EclipseLinkUiMappingsMessages;
-import org.eclipse.jpt.ui.JpaUiFactory;
-import org.eclipse.jpt.ui.WidgetFactory;
-import org.eclipse.jpt.ui.details.DefaultAttributeMappingUiProvider;
-import org.eclipse.jpt.ui.details.JpaComposite;
-import org.eclipse.jpt.ui.internal.JpaMappingImageHelper;
-import org.eclipse.jpt.ui.internal.details.AbstractOneToOneMappingUiProvider;
-import org.eclipse.jpt.utility.model.value.PropertyValueModel;
-import org.eclipse.swt.graphics.Image;
-import org.eclipse.swt.widgets.Composite;
-
-public class DefaultOneToOneMappingUiProvider
- extends AbstractOneToOneMappingUiProvider<JavaOneToOneMapping>
- implements DefaultAttributeMappingUiProvider<JavaOneToOneMapping>
-{
- // singleton
- private static final DefaultOneToOneMappingUiProvider INSTANCE =
- new DefaultOneToOneMappingUiProvider();
-
- /**
- * Return the singleton.
- */
- public static DefaultAttributeMappingUiProvider<JavaOneToOneMapping> instance() {
- return INSTANCE;
- }
-
-
- /**
- * Ensure single instance.
- */
- private DefaultOneToOneMappingUiProvider() {
- super();
- }
-
- public IContentType getContentType() {
- return JptCorePlugin.JAVA_SOURCE_CONTENT_TYPE;
- }
-
- @Override
- public String getKey() {
- return null;
- }
-
- public String getDefaultKey() {
- return MappingKeys.ONE_TO_ONE_ATTRIBUTE_MAPPING_KEY;
- }
-
- @Override
- public String getLabel() {
- return EclipseLinkUiMappingsMessages.DefaultOneToOneMappingUiProvider_label;
- }
-
- @Override
- public String getLinkLabel() {
- return EclipseLinkUiMappingsMessages.DefaultOneToOneMappingUiProvider_linkLabel;
- }
-
- @Override
- public Image getImage() {
- return JpaMappingImageHelper.imageForAttributeMapping(getDefaultKey());
- }
-
- public JpaComposite buildAttributeMappingComposite(
- JpaUiFactory factory,
- PropertyValueModel<JavaOneToOneMapping> subjectHolder,
- Composite parent,
- WidgetFactory widgetFactory) {
- return factory.createJavaOneToOneMappingComposite(subjectHolder, parent, widgetFactory);
- }
-}
diff --git a/jpa/plugins/org.eclipse.jpt.eclipselink.ui/src/org/eclipse/jpt/eclipselink/ui/internal/java/details/DefaultVariableOneToOneMappingUiProvider.java b/jpa/plugins/org.eclipse.jpt.eclipselink.ui/src/org/eclipse/jpt/eclipselink/ui/internal/java/details/DefaultVariableOneToOneMappingUiProvider.java
deleted file mode 100644
index 8f08ba2be8..0000000000
--- a/jpa/plugins/org.eclipse.jpt.eclipselink.ui/src/org/eclipse/jpt/eclipselink/ui/internal/java/details/DefaultVariableOneToOneMappingUiProvider.java
+++ /dev/null
@@ -1,81 +0,0 @@
-/*******************************************************************************
- * Copyright (c) 2009 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.
- *
- * Contributors:
- * Oracle - initial API and implementation
- ******************************************************************************/
-package org.eclipse.jpt.eclipselink.ui.internal.java.details;
-
-import org.eclipse.core.runtime.content.IContentType;
-import org.eclipse.jpt.core.JptCorePlugin;
-import org.eclipse.jpt.eclipselink.core.EclipseLinkMappingKeys;
-import org.eclipse.jpt.eclipselink.core.internal.context.java.JavaVariableOneToOneMapping;
-import org.eclipse.jpt.eclipselink.ui.internal.mappings.EclipseLinkUiMappingsMessages;
-import org.eclipse.jpt.eclipselink.ui.internal.mappings.details.VariableOneToOneMappingComposite;
-import org.eclipse.jpt.ui.JpaUiFactory;
-import org.eclipse.jpt.ui.JptUiPlugin;
-import org.eclipse.jpt.ui.WidgetFactory;
-import org.eclipse.jpt.ui.details.DefaultAttributeMappingUiProvider;
-import org.eclipse.jpt.ui.details.JpaComposite;
-import org.eclipse.jpt.ui.internal.JptUiIcons;
-import org.eclipse.jpt.utility.model.value.PropertyValueModel;
-import org.eclipse.swt.graphics.Image;
-import org.eclipse.swt.widgets.Composite;
-
-public class DefaultVariableOneToOneMappingUiProvider
- implements DefaultAttributeMappingUiProvider<JavaVariableOneToOneMapping>
-{
- // singleton
- private static final DefaultVariableOneToOneMappingUiProvider INSTANCE =
- new DefaultVariableOneToOneMappingUiProvider();
-
- /**
- * Return the singleton.
- */
- public static DefaultAttributeMappingUiProvider<JavaVariableOneToOneMapping> instance() {
- return INSTANCE;
- }
-
-
- /**
- * Ensure single instance.
- */
- private DefaultVariableOneToOneMappingUiProvider() {
- super();
- }
-
- public IContentType getContentType() {
- return JptCorePlugin.JAVA_SOURCE_CONTENT_TYPE;
- }
-
- public String getKey() {
- return null;
- }
-
- public String getDefaultKey() {
- return EclipseLinkMappingKeys.VARIABLE_ONE_TO_ONE_ATTRIBUTE_MAPPING_KEY;
- }
-
- public Image getImage() {
- return JptUiPlugin.getImage(JptUiIcons.JPA_CONTENT);
- }
-
- public String getLabel() {
- return EclipseLinkUiMappingsMessages.DefaultVariableOneToOneMappingUiProvider_label;
- }
-
- public String getLinkLabel() {
- return EclipseLinkUiMappingsMessages.DefaultVariableOneToOneMappingUiProvider_linkLabel;
- }
-
- public JpaComposite buildAttributeMappingComposite(
- JpaUiFactory factory,
- PropertyValueModel<JavaVariableOneToOneMapping> subjectHolder,
- Composite parent,
- WidgetFactory widgetFactory) {
- return new VariableOneToOneMappingComposite(subjectHolder, parent, widgetFactory);
- }
-}
diff --git a/jpa/plugins/org.eclipse.jpt.eclipselink.ui/src/org/eclipse/jpt/eclipselink/ui/internal/java/details/EclipseLinkJavaBasicCollectionMappingUiProvider.java b/jpa/plugins/org.eclipse.jpt.eclipselink.ui/src/org/eclipse/jpt/eclipselink/ui/internal/java/details/EclipseLinkJavaBasicCollectionMappingUiProvider.java
deleted file mode 100644
index 4952321b4f..0000000000
--- a/jpa/plugins/org.eclipse.jpt.eclipselink.ui/src/org/eclipse/jpt/eclipselink/ui/internal/java/details/EclipseLinkJavaBasicCollectionMappingUiProvider.java
+++ /dev/null
@@ -1,56 +0,0 @@
-/*******************************************************************************
- * Copyright (c) 2009 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.
- *
- * Contributors:
- * Oracle - initial API and implementation
- ******************************************************************************/
-package org.eclipse.jpt.eclipselink.ui.internal.java.details;
-
-import org.eclipse.core.runtime.content.IContentType;
-import org.eclipse.jpt.core.JptCorePlugin;
-import org.eclipse.jpt.eclipselink.core.context.BasicCollectionMapping;
-import org.eclipse.jpt.eclipselink.ui.internal.mappings.details.BasicCollectionMappingComposite;
-import org.eclipse.jpt.eclipselink.ui.internal.mappings.details.EclipseLinkBasicCollectionMappingUiProvider;
-import org.eclipse.jpt.ui.JpaUiFactory;
-import org.eclipse.jpt.ui.WidgetFactory;
-import org.eclipse.jpt.ui.details.AttributeMappingUiProvider;
-import org.eclipse.jpt.ui.details.JpaComposite;
-import org.eclipse.jpt.utility.model.value.PropertyValueModel;
-import org.eclipse.swt.widgets.Composite;
-
-public class EclipseLinkJavaBasicCollectionMappingUiProvider extends EclipseLinkBasicCollectionMappingUiProvider<BasicCollectionMapping>
-{
- // singleton
- private static final EclipseLinkJavaBasicCollectionMappingUiProvider INSTANCE =
- new EclipseLinkJavaBasicCollectionMappingUiProvider();
-
- /**
- * Return the singleton.
- */
- public static AttributeMappingUiProvider<BasicCollectionMapping> instance() {
- return INSTANCE;
- }
-
-
- /**
- * Ensure single instance.
- */
- private EclipseLinkJavaBasicCollectionMappingUiProvider() {
- super();
- }
-
- public IContentType getContentType() {
- return JptCorePlugin.JAVA_SOURCE_CONTENT_TYPE;
- }
-
- public JpaComposite buildAttributeMappingComposite(
- JpaUiFactory factory,
- PropertyValueModel<BasicCollectionMapping> subjectHolder,
- Composite parent,
- WidgetFactory widgetFactory) {
- return new BasicCollectionMappingComposite(subjectHolder, parent, widgetFactory);
- }
-}
diff --git a/jpa/plugins/org.eclipse.jpt.eclipselink.ui/src/org/eclipse/jpt/eclipselink/ui/internal/java/details/EclipseLinkJavaBasicMapMappingUiProvider.java b/jpa/plugins/org.eclipse.jpt.eclipselink.ui/src/org/eclipse/jpt/eclipselink/ui/internal/java/details/EclipseLinkJavaBasicMapMappingUiProvider.java
deleted file mode 100644
index 3c3c004900..0000000000
--- a/jpa/plugins/org.eclipse.jpt.eclipselink.ui/src/org/eclipse/jpt/eclipselink/ui/internal/java/details/EclipseLinkJavaBasicMapMappingUiProvider.java
+++ /dev/null
@@ -1,56 +0,0 @@
-/*******************************************************************************
- * Copyright (c) 2009 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.
- *
- * Contributors:
- * Oracle - initial API and implementation
- ******************************************************************************/
-package org.eclipse.jpt.eclipselink.ui.internal.java.details;
-
-import org.eclipse.core.runtime.content.IContentType;
-import org.eclipse.jpt.core.JptCorePlugin;
-import org.eclipse.jpt.eclipselink.core.context.BasicMapMapping;
-import org.eclipse.jpt.eclipselink.ui.internal.mappings.details.BasicMapMappingComposite;
-import org.eclipse.jpt.eclipselink.ui.internal.mappings.details.EclipseLinkBasicMapMappingUiProvider;
-import org.eclipse.jpt.ui.JpaUiFactory;
-import org.eclipse.jpt.ui.WidgetFactory;
-import org.eclipse.jpt.ui.details.AttributeMappingUiProvider;
-import org.eclipse.jpt.ui.details.JpaComposite;
-import org.eclipse.jpt.utility.model.value.PropertyValueModel;
-import org.eclipse.swt.widgets.Composite;
-
-public class EclipseLinkJavaBasicMapMappingUiProvider extends EclipseLinkBasicMapMappingUiProvider<BasicMapMapping>
-{
- // singleton
- private static final EclipseLinkJavaBasicMapMappingUiProvider INSTANCE =
- new EclipseLinkJavaBasicMapMappingUiProvider();
-
- /**
- * Return the singleton.
- */
- public static AttributeMappingUiProvider<BasicMapMapping> instance() {
- return INSTANCE;
- }
-
-
- /**
- * Ensure single instance.
- */
- private EclipseLinkJavaBasicMapMappingUiProvider() {
- super();
- }
-
- public IContentType getContentType() {
- return JptCorePlugin.JAVA_SOURCE_CONTENT_TYPE;
- }
-
- public JpaComposite buildAttributeMappingComposite(
- JpaUiFactory factory,
- PropertyValueModel<BasicMapMapping> subjectHolder,
- Composite parent,
- WidgetFactory widgetFactory) {
- return new BasicMapMappingComposite(subjectHolder, parent, widgetFactory);
- }
-}
diff --git a/jpa/plugins/org.eclipse.jpt.eclipselink.ui/src/org/eclipse/jpt/eclipselink/ui/internal/java/details/EclipseLinkJavaEmbeddableComposite.java b/jpa/plugins/org.eclipse.jpt.eclipselink.ui/src/org/eclipse/jpt/eclipselink/ui/internal/java/details/EclipseLinkJavaEmbeddableComposite.java
deleted file mode 100644
index c40de209fb..0000000000
--- a/jpa/plugins/org.eclipse.jpt.eclipselink.ui/src/org/eclipse/jpt/eclipselink/ui/internal/java/details/EclipseLinkJavaEmbeddableComposite.java
+++ /dev/null
@@ -1,79 +0,0 @@
-/*******************************************************************************
- * Copyright (c) 2007, 2008 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.
- *
- * Contributors:
- * Oracle - initial API and implementation
- ******************************************************************************/
-package org.eclipse.jpt.eclipselink.ui.internal.java.details;
-
-import org.eclipse.jpt.core.context.java.JavaEmbeddable;
-import org.eclipse.jpt.eclipselink.core.context.java.EclipseLinkJavaEmbeddable;
-import org.eclipse.jpt.eclipselink.core.context.java.JavaConverterHolder;
-import org.eclipse.jpt.eclipselink.ui.internal.mappings.EclipseLinkUiMappingsMessages;
-import org.eclipse.jpt.eclipselink.ui.internal.mappings.details.EclipseLinkEmbeddableAdvancedComposite;
-import org.eclipse.jpt.ui.WidgetFactory;
-import org.eclipse.jpt.ui.details.JpaComposite;
-import org.eclipse.jpt.ui.internal.widgets.FormPane;
-import org.eclipse.jpt.utility.internal.model.value.PropertyAspectAdapter;
-import org.eclipse.jpt.utility.model.value.PropertyValueModel;
-import org.eclipse.swt.widgets.Composite;
-
-/**
- * This pane does not have any widgets.
- *
- * @see Embeddable
- * @see BaseJpaUiFactory - The factory creating this pane
- * @see EmbeddableUiProvider
- *
- * @version 2.1
- * @since 2.1
- */
-public class EclipseLinkJavaEmbeddableComposite extends FormPane<JavaEmbeddable>
- implements JpaComposite
-{
- /**
- * Creates a new <code>EmbeddableComposite</code>.
- *
- * @param subjectHolder The holder of this pane's subject
- * @param parent The parent container
- * @param widgetFactory The factory used to create various common widgets
- */
- public EclipseLinkJavaEmbeddableComposite(PropertyValueModel<? extends JavaEmbeddable> subjectHolder,
- Composite parent,
- WidgetFactory widgetFactory) {
-
- super(subjectHolder, parent, widgetFactory);
- }
-
- @Override
- protected void initializeLayout(Composite container) {
- initializeConvertersPane(container);
- initializeAdvancedPane(container);
- }
-
- protected void initializeConvertersPane(Composite container) {
-
- container = addCollapsableSection(
- addSubPane(container, 5),
- EclipseLinkUiMappingsMessages.EclipseLinkTypeMappingComposite_converters
- );
-
- new ConvertersComposite(this, buildConverterHolderValueModel(), container);
- }
-
- protected PropertyValueModel<JavaConverterHolder> buildConverterHolderValueModel() {
- return new PropertyAspectAdapter<JavaEmbeddable, JavaConverterHolder>(getSubjectHolder()) {
- @Override
- protected JavaConverterHolder buildValue_() {
- return ((EclipseLinkJavaEmbeddable) this.subject).getConverterHolder();
- }
- };
- }
-
- protected void initializeAdvancedPane(Composite container) {
- new EclipseLinkEmbeddableAdvancedComposite(this, container);
- }
-} \ No newline at end of file
diff --git a/jpa/plugins/org.eclipse.jpt.eclipselink.ui/src/org/eclipse/jpt/eclipselink/ui/internal/java/details/EclipseLinkJavaEntityComposite.java b/jpa/plugins/org.eclipse.jpt.eclipselink.ui/src/org/eclipse/jpt/eclipselink/ui/internal/java/details/EclipseLinkJavaEntityComposite.java
deleted file mode 100644
index 2b16826cd9..0000000000
--- a/jpa/plugins/org.eclipse.jpt.eclipselink.ui/src/org/eclipse/jpt/eclipselink/ui/internal/java/details/EclipseLinkJavaEntityComposite.java
+++ /dev/null
@@ -1,119 +0,0 @@
-/*******************************************************************************
- * Copyright (c) 2008 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.
- *
- * Contributors:
- * Oracle - initial API and implementation
- ******************************************************************************/
-package org.eclipse.jpt.eclipselink.ui.internal.java.details;
-
-import org.eclipse.jpt.core.context.java.JavaEntity;
-import org.eclipse.jpt.eclipselink.core.context.java.EclipseLinkJavaEntity;
-import org.eclipse.jpt.eclipselink.core.context.java.JavaCaching;
-import org.eclipse.jpt.eclipselink.core.context.java.JavaConverterHolder;
-import org.eclipse.jpt.eclipselink.ui.internal.mappings.EclipseLinkUiMappingsMessages;
-import org.eclipse.jpt.eclipselink.ui.internal.mappings.details.EclipseLinkEntityAdvancedComposite;
-import org.eclipse.jpt.ui.WidgetFactory;
-import org.eclipse.jpt.ui.internal.java.details.JavaInheritanceComposite;
-import org.eclipse.jpt.ui.internal.java.details.JavaSecondaryTablesComposite;
-import org.eclipse.jpt.ui.internal.mappings.details.AbstractEntityComposite;
-import org.eclipse.jpt.utility.internal.model.value.PropertyAspectAdapter;
-import org.eclipse.jpt.utility.model.value.PropertyValueModel;
-import org.eclipse.swt.widgets.Composite;
-
-/**
- * The pane used for an EclipseLink Java entity.
- *
- * @see EclipseLinkJavaEntity
- * @see EclipselinkJpaUiFactory - The factory creating this pane
- *
- * @version 2.1
- * @since 2.1
- */
-public class EclipseLinkJavaEntityComposite extends AbstractEntityComposite<JavaEntity>
-{
- /**
- * Creates a new <code>EclipseLinkJavaEntityComposite</code>.
- *
- * @param subjectHolder The holder of the subject <code>JavaEntity</code>
- * @param parent The parent container
- * @param widgetFactory The factory used to create various common widgets
- */
- public EclipseLinkJavaEntityComposite(PropertyValueModel<? extends JavaEntity> subjectHolder,
- Composite parent,
- WidgetFactory widgetFactory) {
-
- super(subjectHolder, parent, widgetFactory);
- }
-
-
- @Override
- protected void initializeLayout(Composite container) {
- initializeGeneralPane(container);
- initializeCachingPane(container);
- initializeQueriesPane(container);
- initializeInheritancePane(container);
- initializeAttributeOverridesPane(container);
- initializeGeneratorsPane(container);
- initializeConvertersPane(container);
- initializeSecondaryTablesPane(container);
- initializeAdvancedPane(container);
- }
-
- protected void initializeCachingPane(Composite container) {
-
- container = addCollapsableSection(
- addSubPane(container, 5),
- EclipseLinkUiMappingsMessages.EclipseLinkTypeMappingComposite_caching
- );
-
- new JavaCachingComposite(this, buildCachingHolder(), container);
- }
-
- private PropertyAspectAdapter<JavaEntity, JavaCaching> buildCachingHolder() {
- return new PropertyAspectAdapter<JavaEntity, JavaCaching>(
- getSubjectHolder())
- {
- @Override
- protected JavaCaching buildValue_() {
- return ((EclipseLinkJavaEntity) this.subject).getCaching();
- }
- };
-
- }
-
- protected void initializeConvertersPane(Composite container) {
-
- container = addCollapsableSection(
- container,
- EclipseLinkUiMappingsMessages.EclipseLinkTypeMappingComposite_converters
- );
-
- new ConvertersComposite(this, buildConverterHolderValueModel(), container);
- }
-
- protected PropertyValueModel<JavaConverterHolder> buildConverterHolderValueModel() {
- return new PropertyAspectAdapter<JavaEntity, JavaConverterHolder>(getSubjectHolder()) {
- @Override
- protected JavaConverterHolder buildValue_() {
- return ((EclipseLinkJavaEntity) this.subject).getConverterHolder();
- }
- };
- }
-
- @Override
- protected void addSecondaryTablesComposite(Composite container) {
- new JavaSecondaryTablesComposite(this, container);
- }
-
- @Override
- protected void addInheritanceComposite(Composite container) {
- new JavaInheritanceComposite(this, container);
- }
-
- protected void initializeAdvancedPane(Composite container) {
- new EclipseLinkEntityAdvancedComposite(this, container);
- }
-} \ No newline at end of file
diff --git a/jpa/plugins/org.eclipse.jpt.eclipselink.ui/src/org/eclipse/jpt/eclipselink/ui/internal/java/details/EclipseLinkJavaMappedSuperclassComposite.java b/jpa/plugins/org.eclipse.jpt.eclipselink.ui/src/org/eclipse/jpt/eclipselink/ui/internal/java/details/EclipseLinkJavaMappedSuperclassComposite.java
deleted file mode 100644
index e087936e32..0000000000
--- a/jpa/plugins/org.eclipse.jpt.eclipselink.ui/src/org/eclipse/jpt/eclipselink/ui/internal/java/details/EclipseLinkJavaMappedSuperclassComposite.java
+++ /dev/null
@@ -1,103 +0,0 @@
-/*******************************************************************************
- * Copyright (c) 2008 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.
- *
- * Contributors:
- * Oracle - initial API and implementation
- ******************************************************************************/
-package org.eclipse.jpt.eclipselink.ui.internal.java.details;
-
-import org.eclipse.jpt.core.context.java.JavaMappedSuperclass;
-import org.eclipse.jpt.eclipselink.core.context.java.EclipseLinkJavaMappedSuperclass;
-import org.eclipse.jpt.eclipselink.core.context.java.JavaCaching;
-import org.eclipse.jpt.eclipselink.core.context.java.JavaConverterHolder;
-import org.eclipse.jpt.eclipselink.ui.internal.mappings.EclipseLinkUiMappingsMessages;
-import org.eclipse.jpt.eclipselink.ui.internal.mappings.details.EclipseLinkMappedSuperclassAdvancedComposite;
-import org.eclipse.jpt.ui.WidgetFactory;
-import org.eclipse.jpt.ui.details.JpaComposite;
-import org.eclipse.jpt.ui.internal.mappings.details.IdClassComposite;
-import org.eclipse.jpt.ui.internal.widgets.FormPane;
-import org.eclipse.jpt.utility.internal.model.value.PropertyAspectAdapter;
-import org.eclipse.jpt.utility.model.value.PropertyValueModel;
-import org.eclipse.swt.widgets.Composite;
-
-/**
- * The pane used for an EclipseLink Java Mapped Superclass.
- *
- * @see EclipseLinkMappedSuperclass
- * @see EclipselinkJpaUiFactory - The factory creating this pane
- *
- * @version 2.1
- * @since 2.1
- */
-public class EclipseLinkJavaMappedSuperclassComposite extends FormPane<JavaMappedSuperclass>
- implements JpaComposite
-{
- /**
- * Creates a new <code>MappedSuperclassComposite</code>.
- *
- * @param subjectHolder The holder of this pane's subject
- * @param parent The parent container
- * @param widgetFactory The factory used to create various common widgets
- */
- public EclipseLinkJavaMappedSuperclassComposite(PropertyValueModel<? extends JavaMappedSuperclass> subjectHolder,
- Composite parent,
- WidgetFactory widgetFactory) {
-
- super(subjectHolder, parent, widgetFactory);
- }
-
- @Override
- protected void initializeLayout(Composite container) {
- new IdClassComposite(this, container);
-
- initializeCachingPane(container);
- initializeConvertersPane(container);
- initializeAdvancedPane(container);
- }
-
- protected void initializeCachingPane(Composite container) {
-
- container = addCollapsableSection(
- addSubPane(container, 5),
- EclipseLinkUiMappingsMessages.EclipseLinkTypeMappingComposite_caching
- );
-
- new JavaCachingComposite(this, buildCachingHolder(), container);
- }
-
- private PropertyAspectAdapter<JavaMappedSuperclass, JavaCaching> buildCachingHolder() {
- return new PropertyAspectAdapter<JavaMappedSuperclass, JavaCaching>(
- getSubjectHolder())
- {
- @Override
- protected JavaCaching buildValue_() {
- return ((EclipseLinkJavaMappedSuperclass) this.subject).getCaching();
- }
- };
- }
-
- protected void initializeConvertersPane(Composite container) {
- container = addCollapsableSection(
- container,
- EclipseLinkUiMappingsMessages.EclipseLinkTypeMappingComposite_converters
- );
-
- new ConvertersComposite(this, buildConverterHolderValueModel(), container);
- }
-
- protected PropertyValueModel<JavaConverterHolder> buildConverterHolderValueModel() {
- return new PropertyAspectAdapter<JavaMappedSuperclass, JavaConverterHolder>(getSubjectHolder()) {
- @Override
- protected JavaConverterHolder buildValue_() {
- return ((EclipseLinkJavaMappedSuperclass) this.subject).getConverterHolder();
- }
- };
- }
-
- protected void initializeAdvancedPane(Composite container) {
- new EclipseLinkMappedSuperclassAdvancedComposite(this, container);
- }
-} \ No newline at end of file
diff --git a/jpa/plugins/org.eclipse.jpt.eclipselink.ui/src/org/eclipse/jpt/eclipselink/ui/internal/java/details/EclipseLinkJavaTransformationMappingUiProvider.java b/jpa/plugins/org.eclipse.jpt.eclipselink.ui/src/org/eclipse/jpt/eclipselink/ui/internal/java/details/EclipseLinkJavaTransformationMappingUiProvider.java
deleted file mode 100644
index 6fa7ad013c..0000000000
--- a/jpa/plugins/org.eclipse.jpt.eclipselink.ui/src/org/eclipse/jpt/eclipselink/ui/internal/java/details/EclipseLinkJavaTransformationMappingUiProvider.java
+++ /dev/null
@@ -1,57 +0,0 @@
-/*******************************************************************************
- * Copyright (c) 2009 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.
- *
- * Contributors:
- * Oracle - initial API and implementation
- ******************************************************************************/
-package org.eclipse.jpt.eclipselink.ui.internal.java.details;
-
-import org.eclipse.core.runtime.content.IContentType;
-import org.eclipse.jpt.core.JptCorePlugin;
-import org.eclipse.jpt.eclipselink.core.context.TransformationMapping;
-import org.eclipse.jpt.eclipselink.ui.internal.mappings.details.EclipseLinkTransformationMappingUiProvider;
-import org.eclipse.jpt.eclipselink.ui.internal.mappings.details.TransformationMappingComposite;
-import org.eclipse.jpt.ui.JpaUiFactory;
-import org.eclipse.jpt.ui.WidgetFactory;
-import org.eclipse.jpt.ui.details.AttributeMappingUiProvider;
-import org.eclipse.jpt.ui.details.JpaComposite;
-import org.eclipse.jpt.utility.model.value.PropertyValueModel;
-import org.eclipse.swt.widgets.Composite;
-
-public class EclipseLinkJavaTransformationMappingUiProvider extends EclipseLinkTransformationMappingUiProvider<TransformationMapping>
-{
- // singleton
- private static final EclipseLinkJavaTransformationMappingUiProvider INSTANCE =
- new EclipseLinkJavaTransformationMappingUiProvider();
-
- /**
- * Return the singleton.
- */
- public static AttributeMappingUiProvider<TransformationMapping> instance() {
- return INSTANCE;
- }
-
-
- /**
- * Ensure single instance.
- */
- private EclipseLinkJavaTransformationMappingUiProvider() {
- super();
- }
-
- public IContentType getContentType() {
- return JptCorePlugin.JAVA_SOURCE_CONTENT_TYPE;
- }
-
- public JpaComposite buildAttributeMappingComposite(
- JpaUiFactory factory,
- PropertyValueModel<TransformationMapping> subjectHolder,
- Composite parent,
- WidgetFactory widgetFactory) {
-
- return new TransformationMappingComposite(subjectHolder, parent, widgetFactory);
- }
-}
diff --git a/jpa/plugins/org.eclipse.jpt.eclipselink.ui/src/org/eclipse/jpt/eclipselink/ui/internal/java/details/EclipseLinkJavaVariableOneToOneMappingUiProvider.java b/jpa/plugins/org.eclipse.jpt.eclipselink.ui/src/org/eclipse/jpt/eclipselink/ui/internal/java/details/EclipseLinkJavaVariableOneToOneMappingUiProvider.java
deleted file mode 100644
index 32de38ec64..0000000000
--- a/jpa/plugins/org.eclipse.jpt.eclipselink.ui/src/org/eclipse/jpt/eclipselink/ui/internal/java/details/EclipseLinkJavaVariableOneToOneMappingUiProvider.java
+++ /dev/null
@@ -1,56 +0,0 @@
-/*******************************************************************************
- * Copyright (c) 2009 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.
- *
- * Contributors:
- * Oracle - initial API and implementation
- ******************************************************************************/
-package org.eclipse.jpt.eclipselink.ui.internal.java.details;
-
-import org.eclipse.core.runtime.content.IContentType;
-import org.eclipse.jpt.core.JptCorePlugin;
-import org.eclipse.jpt.eclipselink.core.context.VariableOneToOneMapping;
-import org.eclipse.jpt.eclipselink.ui.internal.mappings.details.EclipseLinkVariableOneToOneMappingUiProvider;
-import org.eclipse.jpt.eclipselink.ui.internal.mappings.details.VariableOneToOneMappingComposite;
-import org.eclipse.jpt.ui.JpaUiFactory;
-import org.eclipse.jpt.ui.WidgetFactory;
-import org.eclipse.jpt.ui.details.AttributeMappingUiProvider;
-import org.eclipse.jpt.ui.details.JpaComposite;
-import org.eclipse.jpt.utility.model.value.PropertyValueModel;
-import org.eclipse.swt.widgets.Composite;
-
-public class EclipseLinkJavaVariableOneToOneMappingUiProvider extends EclipseLinkVariableOneToOneMappingUiProvider<VariableOneToOneMapping>
-{
- // singleton
- private static final EclipseLinkJavaVariableOneToOneMappingUiProvider INSTANCE =
- new EclipseLinkJavaVariableOneToOneMappingUiProvider();
-
- /**
- * Return the singleton.
- */
- public static AttributeMappingUiProvider<VariableOneToOneMapping> instance() {
- return INSTANCE;
- }
-
-
- /**
- * Ensure single instance.
- */
- private EclipseLinkJavaVariableOneToOneMappingUiProvider() {
- super();
- }
-
- public IContentType getContentType() {
- return JptCorePlugin.JAVA_SOURCE_CONTENT_TYPE;
- }
-
- public JpaComposite buildAttributeMappingComposite(
- JpaUiFactory factory,
- PropertyValueModel<VariableOneToOneMapping> subjectHolder,
- Composite parent,
- WidgetFactory widgetFactory) {
- return new VariableOneToOneMappingComposite(subjectHolder, parent, widgetFactory);
- }
-}
diff --git a/jpa/plugins/org.eclipse.jpt.eclipselink.ui/src/org/eclipse/jpt/eclipselink/ui/internal/java/details/JavaCachingComposite.java b/jpa/plugins/org.eclipse.jpt.eclipselink.ui/src/org/eclipse/jpt/eclipselink/ui/internal/java/details/JavaCachingComposite.java
deleted file mode 100644
index 8fd9e54acd..0000000000
--- a/jpa/plugins/org.eclipse.jpt.eclipselink.ui/src/org/eclipse/jpt/eclipselink/ui/internal/java/details/JavaCachingComposite.java
+++ /dev/null
@@ -1,62 +0,0 @@
-/*******************************************************************************
- * Copyright (c) 2008 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.
- *
- * Contributors:
- * Oracle - initial API and implementation
- ******************************************************************************/
-package org.eclipse.jpt.eclipselink.ui.internal.java.details;
-
-import org.eclipse.jpt.eclipselink.core.context.java.JavaCaching;
-import org.eclipse.jpt.eclipselink.ui.internal.mappings.details.CachingComposite;
-import org.eclipse.jpt.ui.internal.widgets.FormPane;
-import org.eclipse.jpt.utility.model.value.PropertyValueModel;
-import org.eclipse.swt.widgets.Composite;
-
-/**
- * This pane shows the caching options.
- * <p>
- * Here the layout of this pane:
- * <pre>
- * -----------------------------------------------------------------------------
- * | x Shared |
- * | CacheTypeComposite |
- * | CacheSizeComposite |
- * | > Advanced |
- * | ExpiryComposite |
- * | AlwaysRefreshComposite |
- * | RefreshOnlyIfNewerComposite |
- * | DisableHitsComposite |
- * | CacheCoordinationComposite |
- * | ExistenceTypeComposite |
- * -----------------------------------------------------------------------------</pre>
- *
- * @see Entity
- * @see EclipseLinkCaching
- * @see EclipseLinkJavaEntityComposite - The parent container
- * @see CacheTypeComposite
- * @see CacheSizeComposite
- * @see AlwaysRefreshComposite
- * @see RefreshOnlyIfNewerComposite
- * @see DisableHitsComposite
- *
- * @version 2.1
- * @since 2.1
- */
-public class JavaCachingComposite extends CachingComposite<JavaCaching>
-{
-
- public JavaCachingComposite(FormPane<?> parentPane,
- PropertyValueModel<JavaCaching> subjectHolder,
- Composite parent) {
-
- super(parentPane, subjectHolder, parent);
- }
-
- @Override
- protected void initializeExistenceCheckingComposite(Composite parent) {
- new JavaExistenceCheckingComposite(this, parent);
- }
-} \ No newline at end of file
diff --git a/jpa/plugins/org.eclipse.jpt.eclipselink.ui/src/org/eclipse/jpt/eclipselink/ui/internal/java/details/JavaExistenceCheckingComposite.java b/jpa/plugins/org.eclipse.jpt.eclipselink.ui/src/org/eclipse/jpt/eclipselink/ui/internal/java/details/JavaExistenceCheckingComposite.java
deleted file mode 100644
index e230321696..0000000000
--- a/jpa/plugins/org.eclipse.jpt.eclipselink.ui/src/org/eclipse/jpt/eclipselink/ui/internal/java/details/JavaExistenceCheckingComposite.java
+++ /dev/null
@@ -1,128 +0,0 @@
-/*******************************************************************************
- * Copyright (c) 2008 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
- *
- * Contributors: Oracle. - initial API and implementation
- *******************************************************************************/
-package org.eclipse.jpt.eclipselink.ui.internal.java.details;
-
-import java.util.Collection;
-import org.eclipse.jpt.eclipselink.core.context.Caching;
-import org.eclipse.jpt.eclipselink.core.context.ExistenceType;
-import org.eclipse.jpt.eclipselink.core.context.java.JavaCaching;
-import org.eclipse.jpt.eclipselink.ui.internal.mappings.EclipseLinkUiMappingsMessages;
-import org.eclipse.jpt.ui.internal.widgets.EnumFormComboViewer;
-import org.eclipse.jpt.ui.internal.widgets.FormPane;
-import org.eclipse.jpt.utility.internal.model.value.PropertyAspectAdapter;
-import org.eclipse.jpt.utility.model.value.WritablePropertyValueModel;
-import org.eclipse.swt.widgets.Composite;
-
-/**
- * Here is the layout of this pane:
- * <pre>
- * -------------------------------------------------------------------------
- * | ---------------------------------------------- |
- * | x Existence Checking: | |v| |
- * | ---------------------------------------------- |
- * -------------------------------------------------------------------------</pre>
- *
- * @see EclipseLinkCaching
- * @see CachingComposite - A container of this widget
- *
- * @version 2.1
- * @since 2.1
- */
-public class JavaExistenceCheckingComposite extends FormPane<JavaCaching> {
-
- /**
- * Creates a new <code>ExistenceCheckingComposite</code>.
- *
- * @param parentPane The parent container of this one
- * @param parent The parent container
- */
- public JavaExistenceCheckingComposite(FormPane<? extends JavaCaching> parentPane,
- Composite parent) {
-
- super(parentPane, parent, false);
- }
-
- @Override
- protected void initializeLayout(Composite container) {
-
- addLabeledComposite(
- container,
- addCheckBox(
- container,
- EclipseLinkUiMappingsMessages.ExistenceCheckingComposite_label,
- buildExistenceCheckingHolder(),
- null
- ),
- addExistenceCheckingTypeCombo(container).getControl(),
- null
- );
- }
-
- private EnumFormComboViewer<Caching, ExistenceType> addExistenceCheckingTypeCombo(Composite container) {
-
- return new EnumFormComboViewer<Caching, ExistenceType>(this, container) {
-
- @Override
- protected void addPropertyNames(Collection<String> propertyNames) {
- super.addPropertyNames(propertyNames);
- propertyNames.add(Caching.DEFAULT_EXISTENCE_TYPE_PROPERTY);
- propertyNames.add(Caching.SPECIFIED_EXISTENCE_TYPE_PROPERTY);
- }
-
- @Override
- protected ExistenceType[] getChoices() {
- return ExistenceType.values();
- }
-
- @Override
- protected ExistenceType getDefaultValue() {
- return getSubject().getDefaultExistenceType();
- }
-
- @Override
- protected String displayString(ExistenceType value) {
- return buildDisplayString(
- EclipseLinkUiMappingsMessages.class,
- JavaExistenceCheckingComposite.this,
- value
- );
- }
-
- @Override
- protected ExistenceType getValue() {
- return getSubject().getSpecifiedExistenceType();
- }
-
- @Override
- protected void setValue(ExistenceType value) {
- getSubject().setSpecifiedExistenceType(value);
- }
-
- @Override
- protected boolean sortChoices() {
- return false;
- }
- };
- }
-
- private WritablePropertyValueModel<Boolean> buildExistenceCheckingHolder() {
- return new PropertyAspectAdapter<JavaCaching, Boolean>(getSubjectHolder(), JavaCaching.EXISTENCE_CHECKING_PROPERTY) {
- @Override
- protected Boolean buildValue_() {
- return Boolean.valueOf(this.subject.hasExistenceChecking());
- }
-
- @Override
- protected void setValue_(Boolean value) {
- this.subject.setExistenceChecking(value.booleanValue());
- }
- };
- }
-
-}
diff --git a/jpa/plugins/org.eclipse.jpt.eclipselink.ui/src/org/eclipse/jpt/eclipselink/ui/internal/mappings/EclipseLinkUiMappingsMessages.java b/jpa/plugins/org.eclipse.jpt.eclipselink.ui/src/org/eclipse/jpt/eclipselink/ui/internal/mappings/EclipseLinkUiMappingsMessages.java
deleted file mode 100644
index e441151167..0000000000
--- a/jpa/plugins/org.eclipse.jpt.eclipselink.ui/src/org/eclipse/jpt/eclipselink/ui/internal/mappings/EclipseLinkUiMappingsMessages.java
+++ /dev/null
@@ -1,169 +0,0 @@
-/*******************************************************************************
- * Copyright (c) 2008, 2009 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.
- *
- * Contributors:
- * Oracle - initial API and implementation
- ******************************************************************************/
-package org.eclipse.jpt.eclipselink.ui.internal.mappings;
-
-import org.eclipse.osgi.util.NLS;
-
-/**
- * The localized strings used by the mapping panes.
- *
- * @version 2.2
- * @since 1.0
- */
-@SuppressWarnings("nls")
-public class EclipseLinkUiMappingsMessages extends NLS {
-
- public static String BasicCollectionMappingUiProvider_label;
- public static String BasicCollectionMappingUiProvider_linkLabel;
-
- public static String BasicMapMappingUiProvider_label;
- public static String BasicMapMappingUiProvider_linkLabel;
-
- public static String TransformationMappingUiProvider_label;
- public static String TransformationMappingUiProvider_linkLabel;
-
- public static String VariableOneToOneMappingUiProvider_label;
- public static String VariableOneToOneMappingUiProvider_linkLabel;
-
- public static String CacheTypeComposite_label;
- public static String CacheTypeComposite_full;
- public static String CacheTypeComposite_weak;
- public static String CacheTypeComposite_soft;
- public static String CacheTypeComposite_soft_weak;
- public static String CacheTypeComposite_hard_weak;
- public static String CacheTypeComposite_cache;
- public static String CacheTypeComposite_none;
- public static String EclipseLinkTypeMappingComposite_advanced;
- public static String EclipseLinkTypeMappingComposite_caching;
- public static String EclipseLinkTypeMappingComposite_converters;
-
- public static String CacheSizeComposite_size;
- public static String CacheCoordinationTypeComposite_label;
- public static String CacheCoordinationTypeComposite_send_object_changes;
- public static String CacheCoordinationTypeComposite_invalidate_changed_objects;
- public static String CacheCoordinationTypeComposite_send_new_objects_with_changes;
- public static String CacheCoordinationTypeComposite_none;
-
- public static String CachingComposite_sharedLabelDefault;
- public static String CachingComposite_sharedLabel;
- public static String CachingComposite_advanced;
- public static String AlwaysRefreshComposite_alwaysRefreshDefault;
- public static String AlwaysRefreshComposite_alwaysRefreshLabel;
- public static String RefreshOnlyIfNewerComposite_refreshOnlyIfNewerDefault;
- public static String RefreshOnlyIfNewerComposite_refreshOnlyIfNewerLabel;
- public static String DisableHitsComposite_disableHitsDefault;
- public static String DisableHitsComposite_disableHitsLabel;
-
- public static String ChangeTrackingComposite_label;
- public static String ChangeTrackingComposite_attribute;
- public static String ChangeTrackingComposite_object;
- public static String ChangeTrackingComposite_deferred;
- public static String ChangeTrackingComposite_auto;
-
- public static String ConvertComposite_converterNameLabel;
- public static String ConvertComposite_defineConverterSection;
- public static String ConvertComposite_default;
- public static String ConvertComposite_custom;
- public static String ConvertComposite_type;
- public static String ConvertComposite_objectType;
- public static String ConvertComposite_struct;
-
- public static String ConverterComposite_nameTextLabel;
- public static String ConverterComposite_classLabel;
-
- public static String ConvertersComposite_customConverter;
- public static String ConvertersComposite_objectTypeConverter;
- public static String ConvertersComposite_structConverter;
- public static String ConvertersComposite_typeConverter;
-
- public static String CustomizerComposite_classLabel;
-
- public static String TypeSection_converted;
-
- public static String ExistenceCheckingComposite_label;
- public static String JavaExistenceCheckingComposite_check_cache;
- public static String JavaExistenceCheckingComposite_check_database;
- public static String JavaExistenceCheckingComposite_assume_existence;
- public static String JavaExistenceCheckingComposite_assume_non_existence;
- public static String OrmExistenceCheckingComposite_check_cache;
- public static String OrmExistenceCheckingComposite_check_database;
- public static String OrmExistenceCheckingComposite_assume_existence;
- public static String OrmExistenceCheckingComposite_assume_non_existence;
-
- public static String ExpiryComposite_expirySection;
- public static String ExpiryComposite_noExpiry;
- public static String ExpiryComposite_timeToLiveExpiry;
- public static String ExpiryComposite_timeToLiveExpiryExpireAfter;
- public static String ExpiryComposite_timeToLiveExpiryMilliseconds;
- public static String ExpiryComposite_dailyExpiry;
- public static String ExpiryComposite_timeOfDayExpiryExpireAt;
-
- public static String JoinFetchComposite_label;
- public static String JoinFetchComposite_inner;
- public static String JoinFetchComposite_outer;
-
- public static String MutableComposite_mutableLabel;
- public static String MutableComposite_mutableLabelDefault;
- public static String MutableComposite_true;
- public static String MutableComposite_false;
-
- public static String ObjectTypeConverterComposite_dataTypeLabel;
- public static String ObjectTypeConverterComposite_objectTypeLabel;
- public static String ObjectTypeConverterComposite_conversionValueEdit;
- public static String ObjectTypeConverterComposite_conversionValuesDataValueColumn;
- public static String ObjectTypeConverterComposite_conversionValuesObjectValueColumn;
- public static String ObjectTypeConverterComposite_defaultObjectValueLabel;
- public static String ObjectTypeConverterComposite_conversionValuesGroupTitle;
-
- public static String ConversionValueDialog_addConversionValue;
- public static String ConversionValueDialog_editConversionValue;
- public static String ConversionValueDialog_addConversionValueDescriptionTitle;
- public static String ConversionValueDialog_editConversionValueDescriptionTitle;
- public static String ConversionValueDialog_addConversionValueDescription;
- public static String ConversionValueDialog_editConversionValueDescription;
-
- public static String ConversionValueDialog_dataValue;
- public static String ConversionValueDialog_objectValue;
- public static String ConversionValueStateObject_dataValueMustBeSpecified;
- public static String ConversionValueStateObject_objectValueMustBeSpecified;
- public static String ConversionValueStateObject_dataValueAlreadyExists;
-
- public static String PrivateOwnedComposite_privateOwnedLabel;
-
- public static String ReadOnlyComposite_readOnlyLabel;
- public static String ReadOnlyComposite_readOnlyWithDefault;
-
- public static String TypeConverterComposite_dataTypeLabel;
- public static String TypeConverterComposite_objectTypeLabel;
-
- public static String DefaultOneToOneMappingUiProvider_label;
- public static String DefaultVariableOneToOneMappingUiProvider_label;
- public static String DefaultOneToManyMappingUiProvider_label;
- public static String DefaultOneToOneMappingUiProvider_linkLabel;
- public static String DefaultVariableOneToOneMappingUiProvider_linkLabel;
- public static String DefaultOneToManyMappingUiProvider_linkLabel;
-
- public static String ConvertersComposite_Label;
- public static String EclipseLinkConverterDialog_name;
- public static String EclipseLinkConverterDialog_converterType;
- public static String EclipseLinkConverterDialog_addConverter;
- public static String EclipseLinkConverterDialog_addConverterDescriptionTitle;
- public static String EclipseLinkConverterDialog_addConverterDescription;
- public static String EclipseLinkConverterStateObject_nameMustBeSpecified;
- public static String EclipseLinkConverterStateObject_typeMustBeSpecified;
-
- static {
- NLS.initializeMessages("eclipselink_ui_mappings", EclipseLinkUiMappingsMessages.class);
- }
-
- private EclipseLinkUiMappingsMessages() {
- throw new UnsupportedOperationException();
- }
-} \ No newline at end of file
diff --git a/jpa/plugins/org.eclipse.jpt.eclipselink.ui/src/org/eclipse/jpt/eclipselink/ui/internal/mappings/details/AlwaysRefreshComposite.java b/jpa/plugins/org.eclipse.jpt.eclipselink.ui/src/org/eclipse/jpt/eclipselink/ui/internal/mappings/details/AlwaysRefreshComposite.java
deleted file mode 100644
index 27ee6e6f78..0000000000
--- a/jpa/plugins/org.eclipse.jpt.eclipselink.ui/src/org/eclipse/jpt/eclipselink/ui/internal/mappings/details/AlwaysRefreshComposite.java
+++ /dev/null
@@ -1,102 +0,0 @@
-/*******************************************************************************
- * Copyright (c) 2008, 2009 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.
- *
- * Contributors:
- * Oracle - initial API and implementation
- ******************************************************************************/
-package org.eclipse.jpt.eclipselink.ui.internal.mappings.details;
-
-import org.eclipse.jpt.eclipselink.core.context.Caching;
-import org.eclipse.jpt.eclipselink.ui.internal.EclipseLinkHelpContextIds;
-import org.eclipse.jpt.eclipselink.ui.internal.mappings.EclipseLinkUiMappingsMessages;
-import org.eclipse.jpt.ui.internal.mappings.JptUiMappingsMessages;
-import org.eclipse.jpt.ui.internal.widgets.FormPane;
-import org.eclipse.jpt.utility.internal.model.value.PropertyAspectAdapter;
-import org.eclipse.jpt.utility.internal.model.value.TransformationPropertyValueModel;
-import org.eclipse.jpt.utility.model.value.PropertyValueModel;
-import org.eclipse.jpt.utility.model.value.WritablePropertyValueModel;
-import org.eclipse.osgi.util.NLS;
-import org.eclipse.swt.widgets.Composite;
-
-
-/**
- * This composite simply shows a tri-state check box for the Always Refresh option.
- *
- * @see EclipseLinkCaching
- * @see CachingComposite - A container of this widget
- *
- * @version 2.1
- * @since 2.1
- */
-public class AlwaysRefreshComposite extends FormPane<Caching>
-{
- /**
- * Creates a new <code>OptionalComposite</code>.
- *
- * @param parentPane The parent container of this one
- * @param parent The parent container
- */
- public AlwaysRefreshComposite(FormPane<? extends Caching> parentPane,
- Composite parent)
- {
- super(parentPane, parent);
- }
-
- @Override
- protected void initializeLayout(Composite container) {
-
- addTriStateCheckBoxWithDefault(
- container,
- EclipseLinkUiMappingsMessages.AlwaysRefreshComposite_alwaysRefreshLabel,
- buildAlwaysRefreshHolder(),
- buildAlwaysRefreshStringHolder(),
- EclipseLinkHelpContextIds.CACHING_ALWAYS_REFRESH
- );
- }
-
- private WritablePropertyValueModel<Boolean> buildAlwaysRefreshHolder() {
- return new PropertyAspectAdapter<Caching, Boolean>(getSubjectHolder(), Caching.SPECIFIED_ALWAYS_REFRESH_PROPERTY) {
- @Override
- protected Boolean buildValue_() {
- return this.subject.getSpecifiedAlwaysRefresh();
- }
-
- @Override
- protected void setValue_(Boolean value) {
- this.subject.setSpecifiedAlwaysRefresh(value);
- }
- };
- }
-
- private PropertyValueModel<String> buildAlwaysRefreshStringHolder() {
- return new TransformationPropertyValueModel<Boolean, String>(buildDefaultAlwaysRefreshHolder()) {
- @Override
- protected String transform(Boolean value) {
- if (value != null) {
- String defaultStringValue = value.booleanValue() ? JptUiMappingsMessages.Boolean_True : JptUiMappingsMessages.Boolean_False;
- return NLS.bind(EclipseLinkUiMappingsMessages.AlwaysRefreshComposite_alwaysRefreshDefault, defaultStringValue);
- }
- return EclipseLinkUiMappingsMessages.AlwaysRefreshComposite_alwaysRefreshLabel;
- }
- };
- }
-
- private PropertyValueModel<Boolean> buildDefaultAlwaysRefreshHolder() {
- return new PropertyAspectAdapter<Caching, Boolean>(
- getSubjectHolder(),
- Caching.SPECIFIED_ALWAYS_REFRESH_PROPERTY,
- Caching.DEFAULT_ALWAYS_REFRESH_PROPERTY)
- {
- @Override
- protected Boolean buildValue_() {
- if (this.subject.getSpecifiedAlwaysRefresh() != null) {
- return null;
- }
- return Boolean.valueOf(this.subject.isDefaultAlwaysRefresh());
- }
- };
- }
-} \ No newline at end of file
diff --git a/jpa/plugins/org.eclipse.jpt.eclipselink.ui/src/org/eclipse/jpt/eclipselink/ui/internal/mappings/details/BasicCollectionMappingComposite.java b/jpa/plugins/org.eclipse.jpt.eclipselink.ui/src/org/eclipse/jpt/eclipselink/ui/internal/mappings/details/BasicCollectionMappingComposite.java
deleted file mode 100644
index 32e48c6646..0000000000
--- a/jpa/plugins/org.eclipse.jpt.eclipselink.ui/src/org/eclipse/jpt/eclipselink/ui/internal/mappings/details/BasicCollectionMappingComposite.java
+++ /dev/null
@@ -1,45 +0,0 @@
-/*******************************************************************************
- * Copyright (c) 2008 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.
- *
- * Contributors:
- * Oracle - initial API and implementation
- ******************************************************************************/
-package org.eclipse.jpt.eclipselink.ui.internal.mappings.details;
-
-import org.eclipse.jpt.eclipselink.core.context.BasicCollectionMapping;
-import org.eclipse.jpt.ui.WidgetFactory;
-import org.eclipse.jpt.ui.details.JpaComposite;
-import org.eclipse.jpt.ui.internal.widgets.FormPane;
-import org.eclipse.jpt.utility.model.value.PropertyValueModel;
-import org.eclipse.swt.widgets.Composite;
-
-/**
- *
- * @version 2.1
- * @since 2.1
- */
-public class BasicCollectionMappingComposite extends FormPane<BasicCollectionMapping>
- implements JpaComposite
-{
- /**
- * Creates a new <code>EclipseLinkBasicCollectionMappingComposite</code>.
- *
- * @param subjectHolder The holder of the subject <code>IManyToOneMapping</code>
- * @param parent The parent container
- * @param widgetFactory The factory used to create various common widgets
- */
- public BasicCollectionMappingComposite(PropertyValueModel<? extends BasicCollectionMapping> subjectHolder,
- Composite parent,
- WidgetFactory widgetFactory) {
-
- super(subjectHolder, parent, widgetFactory);
- }
-
- @Override
- protected void initializeLayout(Composite container) {
-
- }
-}
diff --git a/jpa/plugins/org.eclipse.jpt.eclipselink.ui/src/org/eclipse/jpt/eclipselink/ui/internal/mappings/details/BasicMapMappingComposite.java b/jpa/plugins/org.eclipse.jpt.eclipselink.ui/src/org/eclipse/jpt/eclipselink/ui/internal/mappings/details/BasicMapMappingComposite.java
deleted file mode 100644
index 0003404b33..0000000000
--- a/jpa/plugins/org.eclipse.jpt.eclipselink.ui/src/org/eclipse/jpt/eclipselink/ui/internal/mappings/details/BasicMapMappingComposite.java
+++ /dev/null
@@ -1,45 +0,0 @@
-/*******************************************************************************
- * Copyright (c) 2008 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.
- *
- * Contributors:
- * Oracle - initial API and implementation
- ******************************************************************************/
-package org.eclipse.jpt.eclipselink.ui.internal.mappings.details;
-
-import org.eclipse.jpt.eclipselink.core.context.BasicMapMapping;
-import org.eclipse.jpt.ui.WidgetFactory;
-import org.eclipse.jpt.ui.details.JpaComposite;
-import org.eclipse.jpt.ui.internal.widgets.FormPane;
-import org.eclipse.jpt.utility.model.value.PropertyValueModel;
-import org.eclipse.swt.widgets.Composite;
-
-/**
- *
- * @version 2.1
- * @since 2.1
- */
-public class BasicMapMappingComposite extends FormPane<BasicMapMapping>
- implements JpaComposite
-{
- /**
- * Creates a new <code>EclipseLinkBasicCollectionMappingComposite</code>.
- *
- * @param subjectHolder The holder of the subject <code>IManyToOneMapping</code>
- * @param parent The parent container
- * @param widgetFactory The factory used to create various common widgets
- */
- public BasicMapMappingComposite(PropertyValueModel<? extends BasicMapMapping> subjectHolder,
- Composite parent,
- WidgetFactory widgetFactory) {
-
- super(subjectHolder, parent, widgetFactory);
- }
-
- @Override
- protected void initializeLayout(Composite container) {
-
- }
-}
diff --git a/jpa/plugins/org.eclipse.jpt.eclipselink.ui/src/org/eclipse/jpt/eclipselink/ui/internal/mappings/details/CacheCoordinationTypeComposite.java b/jpa/plugins/org.eclipse.jpt.eclipselink.ui/src/org/eclipse/jpt/eclipselink/ui/internal/mappings/details/CacheCoordinationTypeComposite.java
deleted file mode 100644
index b5217f9829..0000000000
--- a/jpa/plugins/org.eclipse.jpt.eclipselink.ui/src/org/eclipse/jpt/eclipselink/ui/internal/mappings/details/CacheCoordinationTypeComposite.java
+++ /dev/null
@@ -1,106 +0,0 @@
-/*******************************************************************************
- * Copyright (c) 2008 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
- *
- * Contributors: Oracle. - initial API and implementation
- *******************************************************************************/
-package org.eclipse.jpt.eclipselink.ui.internal.mappings.details;
-
-import java.util.Collection;
-import org.eclipse.jpt.eclipselink.core.context.CacheCoordinationType;
-import org.eclipse.jpt.eclipselink.core.context.Caching;
-import org.eclipse.jpt.eclipselink.ui.internal.EclipseLinkHelpContextIds;
-import org.eclipse.jpt.eclipselink.ui.internal.mappings.EclipseLinkUiMappingsMessages;
-import org.eclipse.jpt.ui.internal.widgets.EnumFormComboViewer;
-import org.eclipse.jpt.ui.internal.widgets.FormPane;
-import org.eclipse.swt.widgets.Composite;
-
-/**
- * Here is the layout of this pane:
- * <pre>
- * ----------------------------------------------------------------------------
- * | ----------------------------------------------------- |
- * | Coordination Type: | |v| |
- * | ----------------------------------------------------- |
- * ----------------------------------------------------------------------------</pre>
- *
- * @see EclipseLinkCaching
- * @see CachingComposite - A container of this widget
- *
- * @version 2.1
- * @since 2.1
- */
-public class CacheCoordinationTypeComposite extends FormPane<Caching> {
-
- /**
- * Creates a new <code>CacheTypeComposite</code>.
- *
- * @param parentPane The parent container of this one
- * @param parent The parent container
- */
- public CacheCoordinationTypeComposite(FormPane<? extends Caching> parentPane,
- Composite parent) {
-
- super(parentPane, parent);
- }
-
- private EnumFormComboViewer<Caching, CacheCoordinationType> addCacheCoordinationTypeCombo(Composite container) {
-
- return new EnumFormComboViewer<Caching, CacheCoordinationType>(this, container) {
-
- @Override
- protected void addPropertyNames(Collection<String> propertyNames) {
- super.addPropertyNames(propertyNames);
- propertyNames.add(Caching.DEFAULT_COORDINATION_TYPE_PROPERTY);
- propertyNames.add(Caching.SPECIFIED_COORDINATION_TYPE_PROPERTY);
- }
-
- @Override
- protected CacheCoordinationType[] getChoices() {
- return CacheCoordinationType.values();
- }
-
- @Override
- protected CacheCoordinationType getDefaultValue() {
- return getSubject().getDefaultCoordinationType();
- }
-
- @Override
- protected String displayString(CacheCoordinationType value) {
- return buildDisplayString(
- EclipseLinkUiMappingsMessages.class,
- CacheCoordinationTypeComposite.this,
- value
- );
- }
-
- @Override
- protected CacheCoordinationType getValue() {
- return getSubject().getSpecifiedCoordinationType();
- }
-
- @Override
- protected void setValue(CacheCoordinationType value) {
- getSubject().setSpecifiedCoordinationType(value);
- }
-
- @Override
- protected boolean sortChoices() {
- return false;
- }
- };
- }
-
- @Override
- protected void initializeLayout(Composite container) {
-
- addLabeledComposite(
- container,
- EclipseLinkUiMappingsMessages.CacheCoordinationTypeComposite_label,
- addCacheCoordinationTypeCombo(container),
- EclipseLinkHelpContextIds.CACHING_CACHE_COORDINATION_TYPE
- );
- }
-}
diff --git a/jpa/plugins/org.eclipse.jpt.eclipselink.ui/src/org/eclipse/jpt/eclipselink/ui/internal/mappings/details/CacheSizeComposite.java b/jpa/plugins/org.eclipse.jpt.eclipselink.ui/src/org/eclipse/jpt/eclipselink/ui/internal/mappings/details/CacheSizeComposite.java
deleted file mode 100644
index cf26c7d114..0000000000
--- a/jpa/plugins/org.eclipse.jpt.eclipselink.ui/src/org/eclipse/jpt/eclipselink/ui/internal/mappings/details/CacheSizeComposite.java
+++ /dev/null
@@ -1,94 +0,0 @@
-/*******************************************************************************
- * Copyright (c) 2008 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
- *
- * Contributors: Oracle. - initial API and implementation
- *******************************************************************************/
-package org.eclipse.jpt.eclipselink.ui.internal.mappings.details;
-
-import org.eclipse.jpt.eclipselink.core.context.Caching;
-import org.eclipse.jpt.eclipselink.ui.internal.mappings.EclipseLinkUiMappingsMessages;
-import org.eclipse.jpt.ui.internal.widgets.FormPane;
-import org.eclipse.jpt.ui.internal.widgets.IntegerCombo;
-import org.eclipse.jpt.utility.internal.model.value.PropertyAspectAdapter;
-import org.eclipse.jpt.utility.model.value.PropertyValueModel;
-import org.eclipse.jpt.utility.model.value.WritablePropertyValueModel;
-import org.eclipse.swt.widgets.Composite;
-
-/**
- * Here is the layout of this pane:
- * <pre>
- * ----------------------------------------------------------------------------
- * | --------------- |
- * | Size: | I |I| Default (XXX) |
- * | --------------- |
- * ----------------------------------------------------------------------------</pre>
- *
- * @see EclipseLinkCaching
- * @see CachingComposite - A container of this widget
- *
- * @version 2.1
- * @since 2.1
- */
-public class CacheSizeComposite extends FormPane<Caching> {
-
- /**
- * Creates a new <code>CacheSizeComposite</code>.
- *
- * @param parentPane The parent container of this one
- * @param parent The parent container
- */
- public CacheSizeComposite(FormPane<? extends Caching> parentPane,
- Composite parent) {
-
- super(parentPane, parent);
- }
-
- @Override
- protected void initializeLayout(Composite container) {
- addSizeCombo(container);
- }
-
- private void addSizeCombo(Composite container) {
- new IntegerCombo<Caching>(this, container) {
-
- @Override
- protected String getLabelText() {
- return EclipseLinkUiMappingsMessages.CacheSizeComposite_size;
- }
-
- @Override
- protected String getHelpId() {
- return null;//JpaHelpContextIds.MAPPING_COLUMN_LENGTH;
- }
-
- @Override
- protected PropertyValueModel<Integer> buildDefaultHolder() {
- return new PropertyAspectAdapter<Caching, Integer>(getSubjectHolder(), Caching.DEFAULT_SIZE_PROPERTY) {
- @Override
- protected Integer buildValue_() {
- return Integer.valueOf(this.subject.getDefaultSize());
- }
- };
- }
-
- @Override
- protected WritablePropertyValueModel<Integer> buildSelectedItemHolder() {
- return new PropertyAspectAdapter<Caching, Integer>(getSubjectHolder(), Caching.SPECIFIED_SIZE_PROPERTY) {
- @Override
- protected Integer buildValue_() {
- return this.subject.getSpecifiedSize();
- }
-
- @Override
- protected void setValue_(Integer value) {
- this.subject.setSpecifiedSize(value);
- }
- };
- }
- };
- }
-
-}
diff --git a/jpa/plugins/org.eclipse.jpt.eclipselink.ui/src/org/eclipse/jpt/eclipselink/ui/internal/mappings/details/CacheTypeComposite.java b/jpa/plugins/org.eclipse.jpt.eclipselink.ui/src/org/eclipse/jpt/eclipselink/ui/internal/mappings/details/CacheTypeComposite.java
deleted file mode 100644
index d6981e0cfe..0000000000
--- a/jpa/plugins/org.eclipse.jpt.eclipselink.ui/src/org/eclipse/jpt/eclipselink/ui/internal/mappings/details/CacheTypeComposite.java
+++ /dev/null
@@ -1,106 +0,0 @@
-/*******************************************************************************
- * Copyright (c) 2008 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
- *
- * Contributors: Oracle. - initial API and implementation
- *******************************************************************************/
-package org.eclipse.jpt.eclipselink.ui.internal.mappings.details;
-
-import java.util.Collection;
-import org.eclipse.jpt.eclipselink.core.context.CacheType;
-import org.eclipse.jpt.eclipselink.core.context.Caching;
-import org.eclipse.jpt.eclipselink.ui.internal.EclipseLinkHelpContextIds;
-import org.eclipse.jpt.eclipselink.ui.internal.mappings.EclipseLinkUiMappingsMessages;
-import org.eclipse.jpt.ui.internal.widgets.EnumFormComboViewer;
-import org.eclipse.jpt.ui.internal.widgets.FormPane;
-import org.eclipse.swt.widgets.Composite;
-
-/**
- * Here is the layout of this pane:
- * <pre>
- * ----------------------------------------------------------------------------
- * | ------------------------------------------------------------------ |
- * | Type: | |v| |
- * | ------------------------------------------------------------------ |
- * ----------------------------------------------------------------------------</pre>
- *
- * @see EclipseLinkCaching
- * @see CachingComposite - A container of this widget
- *
- * @version 2.1
- * @since 2.1
- */
-public class CacheTypeComposite extends FormPane<Caching> {
-
- /**
- * Creates a new <code>CacheTypeComposite</code>.
- *
- * @param parentPane The parent container of this one
- * @param parent The parent container
- */
- public CacheTypeComposite(FormPane<? extends Caching> parentPane,
- Composite parent) {
-
- super(parentPane, parent);
- }
-
- private EnumFormComboViewer<Caching, CacheType> addCacheTypeCombo(Composite container) {
-
- return new EnumFormComboViewer<Caching, CacheType>(this, container) {
-
- @Override
- protected void addPropertyNames(Collection<String> propertyNames) {
- super.addPropertyNames(propertyNames);
- propertyNames.add(Caching.DEFAULT_TYPE_PROPERTY);
- propertyNames.add(Caching.SPECIFIED_TYPE_PROPERTY);
- }
-
- @Override
- protected CacheType[] getChoices() {
- return CacheType.values();
- }
-
- @Override
- protected CacheType getDefaultValue() {
- return getSubject().getDefaultType();
- }
-
- @Override
- protected String displayString(CacheType value) {
- return buildDisplayString(
- EclipseLinkUiMappingsMessages.class,
- CacheTypeComposite.this,
- value
- );
- }
-
- @Override
- protected CacheType getValue() {
- return getSubject().getSpecifiedType();
- }
-
- @Override
- protected void setValue(CacheType value) {
- getSubject().setSpecifiedType(value);
- }
-
- @Override
- protected boolean sortChoices() {
- return false;
- }
- };
- }
-
- @Override
- protected void initializeLayout(Composite container) {
-
- addLabeledComposite(
- container,
- EclipseLinkUiMappingsMessages.CacheTypeComposite_label,
- addCacheTypeCombo(container),
- EclipseLinkHelpContextIds.CACHING_CACHE_TYPE
- );
- }
-}
diff --git a/jpa/plugins/org.eclipse.jpt.eclipselink.ui/src/org/eclipse/jpt/eclipselink/ui/internal/mappings/details/CachingComposite.java b/jpa/plugins/org.eclipse.jpt.eclipselink.ui/src/org/eclipse/jpt/eclipselink/ui/internal/mappings/details/CachingComposite.java
deleted file mode 100644
index 9f0e59029e..0000000000
--- a/jpa/plugins/org.eclipse.jpt.eclipselink.ui/src/org/eclipse/jpt/eclipselink/ui/internal/mappings/details/CachingComposite.java
+++ /dev/null
@@ -1,170 +0,0 @@
-/*******************************************************************************
- * Copyright (c) 2008, 2009 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.
- *
- * Contributors:
- * Oracle - initial API and implementation
- ******************************************************************************/
-package org.eclipse.jpt.eclipselink.ui.internal.mappings.details;
-
-import java.util.ArrayList;
-import java.util.Collection;
-
-import org.eclipse.jpt.core.context.Entity;
-import org.eclipse.jpt.eclipselink.core.context.Caching;
-import org.eclipse.jpt.eclipselink.core.internal.context.persistence.caching.EclipseLinkCaching;
-import org.eclipse.jpt.eclipselink.ui.internal.EclipseLinkHelpContextIds;
-import org.eclipse.jpt.eclipselink.ui.internal.java.details.EclipseLinkJavaEntityComposite;
-import org.eclipse.jpt.eclipselink.ui.internal.mappings.EclipseLinkUiMappingsMessages;
-import org.eclipse.jpt.ui.internal.mappings.JptUiMappingsMessages;
-import org.eclipse.jpt.ui.internal.util.PaneEnabler;
-import org.eclipse.jpt.ui.internal.widgets.FormPane;
-import org.eclipse.jpt.ui.internal.widgets.Pane;
-import org.eclipse.jpt.utility.internal.model.value.PropertyAspectAdapter;
-import org.eclipse.jpt.utility.internal.model.value.SimplePropertyValueModel;
-import org.eclipse.jpt.utility.internal.model.value.TransformationPropertyValueModel;
-import org.eclipse.jpt.utility.model.value.PropertyValueModel;
-import org.eclipse.jpt.utility.model.value.WritablePropertyValueModel;
-import org.eclipse.osgi.util.NLS;
-import org.eclipse.swt.widgets.Composite;
-
-/**
- * This pane shows the caching options.
- * <p>
- * Here the layout of this pane:
- * <pre>
- * -----------------------------------------------------------------------------
- * | x Shared |
- * | CacheTypeComposite |
- * | CacheSizeComposite |
- * | > Advanced |
- * | ExpiryComposite |
- * | AlwaysRefreshComposite |
- * | RefreshOnlyIfNewerComposite |
- * | DisableHitsComposite |
- * | CacheCoordinationComposite |
- * | ExistenceTypeComposite |
- * -----------------------------------------------------------------------------</pre>
- *
- * @see Entity
- * @see EclipseLinkCaching
- * @see EclipseLinkJavaEntityComposite - The parent container
- * @see CacheTypeComposite
- * @see CacheSizeComposite
- * @see AlwaysRefreshComposite
- * @see RefreshOnlyIfNewerComposite
- * @see DisableHitsComposite
- *
- * @version 2.1
- * @since 2.1
- */
-public abstract class CachingComposite<T extends Caching> extends FormPane<T>
-{
-
- protected CachingComposite(FormPane<?> parentPane,
- PropertyValueModel<T> subjectHolder,
- Composite parent) {
-
- super(parentPane, subjectHolder, parent, false);
- }
-
- @Override
- protected void initializeLayout(Composite container) {
-
- //Shared Check box, uncheck this and the rest of the panel is disabled
- addTriStateCheckBoxWithDefault(
- addSubPane(container, 8),
- EclipseLinkUiMappingsMessages.CachingComposite_sharedLabel,
- buildSpecifiedSharedHolder(),
- buildSharedStringHolder(),
- EclipseLinkHelpContextIds.CACHING_SHARED
- );
-
- Composite subPane = addSubPane(container, 0, 16);
-
- Collection<Pane<?>> panes = new ArrayList<Pane<?>>();
-
- panes.add(new CacheTypeComposite(this, subPane));
- panes.add(new CacheSizeComposite(this, subPane));
-
- // Advanced sub-pane
- Composite advancedSection = addCollapsableSubSection(
- subPane,
- EclipseLinkUiMappingsMessages.CachingComposite_advanced,
- new SimplePropertyValueModel<Boolean>(Boolean.FALSE)
- );
-
- initializeAdvancedPane(addSubPane(advancedSection, 0, 16), panes);
-
- new PaneEnabler(buildSharedCacheEnabler(), panes);
-
- initializeExistenceCheckingComposite(addSubPane(container, 8));
- }
-
- protected void initializeAdvancedPane(Composite container, Collection<Pane<?>> panes) {
- panes.add(new ExpiryComposite(this, container));
- panes.add(new AlwaysRefreshComposite(this, container));
- panes.add(new RefreshOnlyIfNewerComposite(this, container));
- panes.add(new DisableHitsComposite(this, container));
- panes.add(new CacheCoordinationTypeComposite(this, container));
- }
-
- protected abstract void initializeExistenceCheckingComposite(Composite parent);
-
- private PropertyValueModel<Boolean> buildSharedCacheEnabler() {
- return new PropertyAspectAdapter<Caching, Boolean>(
- getSubjectHolder(),
- Caching.SPECIFIED_SHARED_PROPERTY,
- Caching.DEFAULT_SHARED_PROPERTY) {
- @Override
- protected Boolean buildValue_() {
- return Boolean.valueOf(this.subject.isShared());
- }
- };
- }
-
- private WritablePropertyValueModel<Boolean> buildSpecifiedSharedHolder() {
- return new PropertyAspectAdapter<Caching, Boolean>(getSubjectHolder(), Caching.SPECIFIED_SHARED_PROPERTY) {
- @Override
- protected Boolean buildValue_() {
- return this.subject.getSpecifiedShared();
- }
-
- @Override
- protected void setValue_(Boolean value) {
- this.subject.setSpecifiedShared(value);
- }
- };
- }
-
- private PropertyValueModel<String> buildSharedStringHolder() {
- return new TransformationPropertyValueModel<Boolean, String>(buildDefaultSharedHolder()) {
- @Override
- protected String transform(Boolean value) {
- if (value != null) {
- String defaultStringValue = value.booleanValue() ? JptUiMappingsMessages.Boolean_True : JptUiMappingsMessages.Boolean_False;
- return NLS.bind(EclipseLinkUiMappingsMessages.CachingComposite_sharedLabelDefault, defaultStringValue);
- }
- return EclipseLinkUiMappingsMessages.CachingComposite_sharedLabel;
- }
- };
- }
-
- private PropertyValueModel<Boolean> buildDefaultSharedHolder() {
- return new PropertyAspectAdapter<Caching, Boolean>(
- getSubjectHolder(),
- Caching.SPECIFIED_SHARED_PROPERTY,
- Caching.DEFAULT_SHARED_PROPERTY)
- {
- @Override
- protected Boolean buildValue_() {
- if (this.subject.getSpecifiedShared() != null) {
- return null;
- }
- return Boolean.valueOf(this.subject.isDefaultShared());
- }
- };
- }
-} \ No newline at end of file
diff --git a/jpa/plugins/org.eclipse.jpt.eclipselink.ui/src/org/eclipse/jpt/eclipselink/ui/internal/mappings/details/ChangeTrackingComposite.java b/jpa/plugins/org.eclipse.jpt.eclipselink.ui/src/org/eclipse/jpt/eclipselink/ui/internal/mappings/details/ChangeTrackingComposite.java
deleted file mode 100644
index 70457d06d2..0000000000
--- a/jpa/plugins/org.eclipse.jpt.eclipselink.ui/src/org/eclipse/jpt/eclipselink/ui/internal/mappings/details/ChangeTrackingComposite.java
+++ /dev/null
@@ -1,108 +0,0 @@
-/*******************************************************************************
- * Copyright (c) 2008 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
- *
- * Contributors: Oracle. - initial API and implementation
- *******************************************************************************/
-package org.eclipse.jpt.eclipselink.ui.internal.mappings.details;
-
-import java.util.Collection;
-import org.eclipse.jpt.eclipselink.core.context.ChangeTracking;
-import org.eclipse.jpt.eclipselink.core.context.ChangeTrackingType;
-import org.eclipse.jpt.eclipselink.ui.internal.mappings.EclipseLinkUiMappingsMessages;
-import org.eclipse.jpt.ui.internal.widgets.EnumFormComboViewer;
-import org.eclipse.jpt.ui.internal.widgets.FormPane;
-import org.eclipse.jpt.utility.model.value.PropertyValueModel;
-import org.eclipse.swt.widgets.Composite;
-
-/**
- * Here is the layout of this pane:
- * <pre>
- * -------------------------------------------------------------------------
- * | ---------------------------------------------- |
- * | Change Tracking : | |v| |
- * | ---------------------------------------------- |
- * -------------------------------------------------------------------------</pre>
- *
- * @see ChangeTracking
- *
- * @version 2.1
- * @since 2.1
- */
-public class ChangeTrackingComposite extends FormPane<ChangeTracking> {
-
- /**
- * Creates a new <code>ChangeTrackingComposite</code>.
- *
- * @param parentPane The parent container of this one
- * @param parent The parent container
- */
- public ChangeTrackingComposite(FormPane<?> parentPane,
- PropertyValueModel<? extends ChangeTracking> subjectHolder,
- Composite parent) {
-
- super(parentPane, subjectHolder, parent);
- }
-
- @Override
- protected void initializeLayout(Composite container) {
-
- addLabeledComposite(
- container,
- addLabel(
- container,
- EclipseLinkUiMappingsMessages.ChangeTrackingComposite_label),
- addChangeTrackingTypeCombo(container).getControl(),
- null
- );
- }
-
- private EnumFormComboViewer<ChangeTracking, ChangeTrackingType> addChangeTrackingTypeCombo(Composite container) {
-
- return new EnumFormComboViewer<ChangeTracking, ChangeTrackingType>(this, container) {
-
- @Override
- protected void addPropertyNames(Collection<String> propertyNames) {
- super.addPropertyNames(propertyNames);
- propertyNames.add(ChangeTracking.DEFAULT_TYPE_PROPERTY);
- propertyNames.add(ChangeTracking.SPECIFIED_TYPE_PROPERTY);
- }
-
- @Override
- protected ChangeTrackingType[] getChoices() {
- return ChangeTrackingType.values();
- }
-
- @Override
- protected ChangeTrackingType getDefaultValue() {
- return getSubject().getDefaultType();
- }
-
- @Override
- protected String displayString(ChangeTrackingType value) {
- return buildDisplayString(
- EclipseLinkUiMappingsMessages.class,
- ChangeTrackingComposite.this,
- value
- );
- }
-
- @Override
- protected ChangeTrackingType getValue() {
- return getSubject().getSpecifiedType();
- }
-
- @Override
- protected void setValue(ChangeTrackingType value) {
- getSubject().setSpecifiedType(value);
- }
-
- @Override
- protected boolean sortChoices() {
- return false;
- }
- };
- }
-}
diff --git a/jpa/plugins/org.eclipse.jpt.eclipselink.ui/src/org/eclipse/jpt/eclipselink/ui/internal/mappings/details/ConversionValueDialog.java b/jpa/plugins/org.eclipse.jpt.eclipselink.ui/src/org/eclipse/jpt/eclipselink/ui/internal/mappings/details/ConversionValueDialog.java
deleted file mode 100644
index e884da8fe8..0000000000
--- a/jpa/plugins/org.eclipse.jpt.eclipselink.ui/src/org/eclipse/jpt/eclipselink/ui/internal/mappings/details/ConversionValueDialog.java
+++ /dev/null
@@ -1,210 +0,0 @@
-/*******************************************************************************
- * Copyright (c) 2008 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.
- *
- * Contributors:
- * Oracle - initial API and implementation
- ******************************************************************************/
-package org.eclipse.jpt.eclipselink.ui.internal.mappings.details;
-
-import java.util.Set;
-import org.eclipse.jpt.eclipselink.core.context.ConversionValue;
-import org.eclipse.jpt.eclipselink.core.context.ObjectTypeConverter;
-import org.eclipse.jpt.eclipselink.ui.internal.mappings.EclipseLinkUiMappingsMessages;
-import org.eclipse.jpt.ui.internal.widgets.DialogPane;
-import org.eclipse.jpt.ui.internal.widgets.ValidatingDialog;
-import org.eclipse.jpt.utility.internal.CollectionTools;
-import org.eclipse.jpt.utility.internal.model.value.PropertyAspectAdapter;
-import org.eclipse.jpt.utility.model.value.WritablePropertyValueModel;
-import org.eclipse.swt.widgets.Composite;
-import org.eclipse.swt.widgets.Shell;
-import org.eclipse.swt.widgets.Text;
-
-/**
- * Clients can use this dialog to prompt the user for SecondaryTable settings.
- * Use the following once the dialog is closed:
- * @see #getSelectedTable()
- * @see #getSelectedCatalog()
- * @see #getSelectedSchema()
- * @version 2.1
- * @since 2.1
- */
-public class ConversionValueDialog extends ValidatingDialog<ConversionValueStateObject> {
-
- /**
- * when creating a new EclipseLinkConversionValue, 'conversionValue' will be null
- */
- private final ConversionValue conversionValue;
-
- private ObjectTypeConverter objectTypeConverter;
-
- // ********** constructors **********
-
- /**
- * Use this constructor to create a new conversion value
- */
- public ConversionValueDialog(Shell parent, ObjectTypeConverter objectTypeConverter) {
- this(parent,objectTypeConverter, null);
- }
-
- /**
- * Use this constructor to edit an existing conversion value
- */
- public ConversionValueDialog(Shell parent, ObjectTypeConverter objectTypeConverter, ConversionValue conversionValue) {
- super(parent);
- this.objectTypeConverter = objectTypeConverter;
- this.conversionValue = conversionValue;
- }
-
- @Override
- protected ConversionValueStateObject buildStateObject() {
- String dataValue = null;
- String objectValue = null;
- Set<String> dataValues = CollectionTools.set(this.objectTypeConverter.dataValues());
- if (isEditDialog()) {
- dataValue = this.conversionValue.getDataValue();
- objectValue = this.conversionValue.getObjectValue();
- //remove *this* dataValue, don't want a duplicate data value error
- dataValues.remove(dataValue);
- }
- return new ConversionValueStateObject(
- dataValue,
- objectValue,
- dataValues);
- }
-
- // ********** open **********
-
- @Override
- protected void configureShell(Shell shell) {
- super.configureShell(shell);
- shell.setText(this.getTitle());
- }
-
- @Override
- protected String getTitle() {
- return (this.isAddDialog()) ?
- EclipseLinkUiMappingsMessages.ConversionValueDialog_addConversionValue
- :
- EclipseLinkUiMappingsMessages.ConversionValueDialog_editConversionValue;
- }
-
- @Override
- protected String getDescriptionTitle() {
- return (this.isAddDialog()) ?
- EclipseLinkUiMappingsMessages.ConversionValueDialog_addConversionValueDescriptionTitle
- :
- EclipseLinkUiMappingsMessages.ConversionValueDialog_editConversionValueDescriptionTitle;
- }
-
- @Override
- protected String getDescription() {
- return (this.isAddDialog()) ?
- EclipseLinkUiMappingsMessages.ConversionValueDialog_addConversionValueDescription
- :
- EclipseLinkUiMappingsMessages.ConversionValueDialog_editConversionValueDescription;
- }
-
- @Override
- protected DialogPane<ConversionValueStateObject> buildLayout(Composite container) {
- return new ConversionValueDialogPane(container);
- }
-
- @Override
- public void create() {
- super.create();
-
- ConversionValueDialogPane pane = (ConversionValueDialogPane) getPane();
- pane.selectAll();
-
- getButton(OK).setEnabled(false);
- }
-
-
- // ********** convenience methods **********
-
- protected boolean isAddDialog() {
- return this.conversionValue == null;
- }
-
- protected boolean isEditDialog() {
- return ! this.isAddDialog();
- }
-
-
- // ********** public API **********
-
- /**
- * Return the data value set in the text widget.
- */
- public String getDataValue() {
- return getSubject().getDataValue();
- }
-
- /**
- * Return the object value set in the text widget.
- */
- public String getObjectValue() {
- return getSubject().getObjectValue();
- }
-
- private class ConversionValueDialogPane extends DialogPane<ConversionValueStateObject> {
-
- private Text dataValueText;
- private Text objectValueText;
-
- ConversionValueDialogPane(Composite parent) {
- super(ConversionValueDialog.this.getSubjectHolder(), parent);
- }
-
- @Override
- protected void initializeLayout(Composite container) {
- this.dataValueText = addLabeledText(
- container,
- EclipseLinkUiMappingsMessages.ConversionValueDialog_dataValue,
- buildDataValueHolder()
- );
-
- this.objectValueText = addLabeledText(
- container,
- EclipseLinkUiMappingsMessages.ConversionValueDialog_objectValue,
- buildObjectValueHolder()
- );
- }
-
- private WritablePropertyValueModel<String> buildDataValueHolder() {
- return new PropertyAspectAdapter<ConversionValueStateObject, String>(getSubjectHolder(), ConversionValueStateObject.DATA_VALUE_PROPERTY) {
- @Override
- protected String buildValue_() {
- return this.subject.getDataValue();
- }
-
- @Override
- protected void setValue_(String value) {
- this.subject.setDataValue(value);
- }
- };
- }
-
- private WritablePropertyValueModel<String> buildObjectValueHolder() {
- return new PropertyAspectAdapter<ConversionValueStateObject, String>(getSubjectHolder(), ConversionValueStateObject.OBJECT_VALUE_PROPERTY) {
- @Override
- protected String buildValue_() {
- return this.subject.getObjectValue();
- }
-
- @Override
- protected void setValue_(String value) {
- this.subject.setObjectValue(value);
- }
- };
- }
-
- void selectAll() {
- this.dataValueText.selectAll();
- this.objectValueText.selectAll();
- }
- }
-}
diff --git a/jpa/plugins/org.eclipse.jpt.eclipselink.ui/src/org/eclipse/jpt/eclipselink/ui/internal/mappings/details/ConversionValueStateObject.java b/jpa/plugins/org.eclipse.jpt.eclipselink.ui/src/org/eclipse/jpt/eclipselink/ui/internal/mappings/details/ConversionValueStateObject.java
deleted file mode 100644
index 3bbcf48174..0000000000
--- a/jpa/plugins/org.eclipse.jpt.eclipselink.ui/src/org/eclipse/jpt/eclipselink/ui/internal/mappings/details/ConversionValueStateObject.java
+++ /dev/null
@@ -1,138 +0,0 @@
-/*******************************************************************************
- * Copyright (c) 2008 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.
- *
- * Contributors:
- * Oracle - initial API and implementation
- ******************************************************************************/
-package org.eclipse.jpt.eclipselink.ui.internal.mappings.details;
-
-import java.util.Collection;
-import java.util.List;
-import org.eclipse.jpt.eclipselink.ui.internal.mappings.EclipseLinkUiMappingsMessages;
-import org.eclipse.jpt.utility.internal.StringTools;
-import org.eclipse.jpt.utility.internal.node.AbstractNode;
-import org.eclipse.jpt.utility.internal.node.Node;
-import org.eclipse.jpt.utility.internal.node.Problem;
-
-/**
- * This is the state object used by the <code>NewNameDialog</code>, which stores
- * the current name and validates it when it is modified.
- *
- * @see NewNameDialog
- *
- * @version 2.1
- * @since 2.1
- */
-@SuppressWarnings("nls")
-final class ConversionValueStateObject extends AbstractNode
-{
- /**
- * The initial dataValue or <code>null</code>
- */
- private String dataValue;
-
- /**
- * The collection of data values that can't be used or an empty collection
- */
- private Collection<String> dataValues;
-
- /**
- * The initial objectValue or <code>null</code>
- */
- private String objectValue;
-
- /**
- * The <code>Validator</code> used to validate this state object.
- */
- private Validator validator;
-
- /**
- * Notifies a change in the data value property.
- */
- static final String DATA_VALUE_PROPERTY = "dataValue";
-
- /**
- * Notifies a change in the object value property.
- */
- static final String OBJECT_VALUE_PROPERTY = "objectValue";
-
- /**
- * Creates a new <code>NewNameStateObject</code>.
- *
- * @param name The initial input or <code>null</code> if no initial value can
- * be specified
- * @param names The collection of names that can't be used or an empty
- * collection if none are available
- */
- ConversionValueStateObject(String dataValue, String objectValue, Collection<String> dataValues) {
- super(null);
-
- this.dataValue = dataValue;
- this.objectValue = objectValue;
- this.dataValues = dataValues;
- }
-
- private void addDataValueProblemsTo(List<Problem> currentProblems) {
- if (StringTools.stringIsEmpty(this.dataValue)) {
- currentProblems.add(buildProblem(EclipseLinkUiMappingsMessages.ConversionValueStateObject_dataValueMustBeSpecified));
- }
- else if (this.dataValues.contains(this.dataValue)) {
- currentProblems.add(buildProblem(EclipseLinkUiMappingsMessages.ConversionValueStateObject_dataValueAlreadyExists));
- }
- }
-
- private void addObjectValueProblemsTo(List<Problem> currentProblems) {
- if (StringTools.stringIsEmpty(this.objectValue)) {
- currentProblems.add(buildProblem(EclipseLinkUiMappingsMessages.ConversionValueStateObject_objectValueMustBeSpecified));
- }
- }
-
- @Override
- protected void addProblemsTo(List<Problem> currentProblems) {
- super.addProblemsTo(currentProblems);
- addDataValueProblemsTo(currentProblems);
- addObjectValueProblemsTo(currentProblems);
- }
-
- @Override
- protected void checkParent(Node parentNode) {
- //not parent
- }
-
- public String displayString() {
- return null;
- }
-
- String getDataValue() {
- return this.dataValue;
- }
-
- String getObjectValue() {
- return this.objectValue;
- }
-
- public void setDataValue(String dataValue) {
- String oldDataValue = this.dataValue;
- this.dataValue = dataValue;
- firePropertyChanged(DATA_VALUE_PROPERTY, oldDataValue, dataValue);
- }
-
- public void setObjectValue(String objectValue) {
- String oldObjectValue = this.objectValue;
- this.objectValue = objectValue;
- firePropertyChanged(OBJECT_VALUE_PROPERTY, oldObjectValue, objectValue);
- }
-
- @Override
- public void setValidator(Validator validator) {
- this.validator = validator;
- }
-
- @Override
- public Validator getValidator() {
- return this.validator;
- }
-}
diff --git a/jpa/plugins/org.eclipse.jpt.eclipselink.ui/src/org/eclipse/jpt/eclipselink/ui/internal/mappings/details/ConvertComposite.java b/jpa/plugins/org.eclipse.jpt.eclipselink.ui/src/org/eclipse/jpt/eclipselink/ui/internal/mappings/details/ConvertComposite.java
deleted file mode 100644
index 1a3ea33175..0000000000
--- a/jpa/plugins/org.eclipse.jpt.eclipselink.ui/src/org/eclipse/jpt/eclipselink/ui/internal/mappings/details/ConvertComposite.java
+++ /dev/null
@@ -1,361 +0,0 @@
-/*******************************************************************************
- * Copyright (c) 2006, 2008 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
- *
- * Contributors: Oracle. - initial API and implementation
- *******************************************************************************/
-package org.eclipse.jpt.eclipselink.ui.internal.mappings.details;
-
-import java.util.ArrayList;
-import java.util.ListIterator;
-import org.eclipse.jpt.eclipselink.core.context.Convert;
-import org.eclipse.jpt.eclipselink.core.context.CustomConverter;
-import org.eclipse.jpt.eclipselink.core.context.EclipseLinkConverter;
-import org.eclipse.jpt.eclipselink.core.context.ObjectTypeConverter;
-import org.eclipse.jpt.eclipselink.core.context.StructConverter;
-import org.eclipse.jpt.eclipselink.core.context.TypeConverter;
-import org.eclipse.jpt.eclipselink.core.internal.context.persistence.EclipseLinkPersistenceUnit;
-import org.eclipse.jpt.eclipselink.ui.internal.mappings.EclipseLinkUiMappingsMessages;
-import org.eclipse.jpt.ui.WidgetFactory;
-import org.eclipse.jpt.ui.internal.mappings.JptUiMappingsMessages;
-import org.eclipse.jpt.ui.internal.util.PaneEnabler;
-import org.eclipse.jpt.ui.internal.util.SWTUtil;
-import org.eclipse.jpt.ui.internal.widgets.FormPane;
-import org.eclipse.jpt.utility.internal.CollectionTools;
-import org.eclipse.jpt.utility.internal.StringConverter;
-import org.eclipse.jpt.utility.internal.model.value.CompositeListValueModel;
-import org.eclipse.jpt.utility.internal.model.value.ListAspectAdapter;
-import org.eclipse.jpt.utility.internal.model.value.PropertyAspectAdapter;
-import org.eclipse.jpt.utility.internal.model.value.PropertyListValueModelAdapter;
-import org.eclipse.jpt.utility.internal.model.value.SimplePropertyValueModel;
-import org.eclipse.jpt.utility.internal.model.value.StaticListValueModel;
-import org.eclipse.jpt.utility.internal.model.value.TransformationPropertyValueModel;
-import org.eclipse.jpt.utility.model.value.ListValueModel;
-import org.eclipse.jpt.utility.model.value.PropertyValueModel;
-import org.eclipse.jpt.utility.model.value.WritablePropertyValueModel;
-import org.eclipse.osgi.util.NLS;
-import org.eclipse.swt.custom.CCombo;
-import org.eclipse.swt.layout.GridData;
-import org.eclipse.swt.widgets.Composite;
-
-/**
- * Here the layout of this pane:
- * <pre>
- * -----------------------------------------------------------------------------
- * | -------------------------------------------------------------- |
- * | Enum Type: | |v| |
- * | -------------------------------------------------------------- |
- * -----------------------------------------------------------------------------</pre>
- *
- * @see EclipseLinkConvert
- * @see EclipseLinkBasicMappingComposite - A container of this widget
- *
- * @version 2.1
- * @since 2.1
- */
-public class ConvertComposite extends FormPane<Convert>
-{
-
- /**
- * A key used to represent the default value, this is required to convert
- * the selected item from a combo to <code>null</code>. This key is most
- * likely never typed the user and it will help to convert the value to
- * <code>null</code> when it's time to set the new selected value into the
- * model.
- */
- protected static String DEFAULT_KEY = "?!#!?#?#?default?#?!#?!#?"; //$NON-NLS-1$
-
-
- /**
- * Creates a new <code>EnumTypeComposite</code>.
- *
- * @param parentPane The parent container of this one
- * @param parent The parent container
- */
- public ConvertComposite(PropertyValueModel<? extends Convert> subjectHolder,
- Composite parent,
- WidgetFactory widgetFactory) {
-
- super(subjectHolder, parent, widgetFactory);
- }
-
- @Override
- protected void initializeLayout(Composite container) {
- CCombo combo = addLabeledEditableCCombo(
- container,
- EclipseLinkUiMappingsMessages.ConvertComposite_converterNameLabel,
- buildConvertNameListHolder(),
- buildConvertNameHolder(),
- buildNameConverter(),
- null
- );
- SWTUtil.attachDefaultValueHandler(combo);
-
- Composite subSection = addCollapsableSubSection(
- container,
- EclipseLinkUiMappingsMessages.ConvertComposite_defineConverterSection,
- new SimplePropertyValueModel<Boolean>(Boolean.FALSE));
-
- // No Converter
- addRadioButton(
- subSection,
- EclipseLinkUiMappingsMessages.ConvertComposite_default,
- buildNoConverterHolder(),
- null);
- PropertyValueModel<EclipseLinkConverter> converterHolder = buildConverterHolder();
- // CustomConverter
- addRadioButton(
- subSection,
- EclipseLinkUiMappingsMessages.ConvertComposite_custom,
- buildConverterHolder(EclipseLinkConverter.CUSTOM_CONVERTER),
- null);
- CustomConverterComposite converterComposite = new CustomConverterComposite(buildCustomConverterHolder(converterHolder), subSection, getWidgetFactory());
- GridData gridData = (GridData) converterComposite.getControl().getLayoutData();
- gridData.horizontalIndent = 20;
- registerSubPane(converterComposite);
-
- // Type Converter
- addRadioButton(
- subSection,
- EclipseLinkUiMappingsMessages.ConvertComposite_type,
- buildConverterHolder(EclipseLinkConverter.TYPE_CONVERTER),
- null);
- TypeConverterComposite typeConverterComposite = new TypeConverterComposite(buildTypeConverterHolder(converterHolder), subSection, getWidgetFactory());
- gridData = (GridData) typeConverterComposite.getControl().getLayoutData();
- gridData.horizontalIndent = 20;
- registerSubPane(typeConverterComposite);
-
- // Object Type Converter
- addRadioButton(
- subSection,
- EclipseLinkUiMappingsMessages.ConvertComposite_objectType,
- buildConverterHolder(EclipseLinkConverter.OBJECT_TYPE_CONVERTER),
- null);
- ObjectTypeConverterComposite objectTypeConverterComposite = new ObjectTypeConverterComposite(buildObjectTypeConverterHolder(converterHolder), subSection, getWidgetFactory());
- gridData = (GridData) objectTypeConverterComposite.getControl().getLayoutData();
- gridData.horizontalIndent = 20;
- registerSubPane(objectTypeConverterComposite);
-
- // Struct Converter
- addRadioButton(
- subSection,
- EclipseLinkUiMappingsMessages.ConvertComposite_struct,
- buildConverterHolder(EclipseLinkConverter.STRUCT_CONVERTER),
- null);
- StructConverterComposite structConverterComposite = new StructConverterComposite(buildStructConverterHolder(converterHolder), subSection, getWidgetFactory());
- gridData = (GridData) structConverterComposite.getControl().getLayoutData();
- gridData.horizontalIndent = 20;
- registerSubPane(structConverterComposite);
-
- new PaneEnabler(buildBooleanHolder(), this);
- }
-
- protected final WritablePropertyValueModel<String> buildConvertNameHolder() {
- return new PropertyAspectAdapter<Convert, String>(getSubjectHolder(), Convert.SPECIFIED_CONVERTER_NAME_PROPERTY) {
- @Override
- protected String buildValue_() {
- return this.subject.getSpecifiedConverterName();
- }
-
- @Override
- protected void setValue_(String value) {
- // Convert the default value or an empty string to null
- if ((value != null) &&
- ((value.length() == 0) || value.startsWith(DEFAULT_KEY))) {
-
- value = null;
- }
- this.subject.setSpecifiedConverterName(value);
- }
- };
- }
- private ListValueModel<String> buildConvertNameListHolder() {
- java.util.List<ListValueModel<String>> list = new ArrayList<ListValueModel<String>>();
- list.add(buildDefaultNameListHolder());
- list.add(buildReservedConverterNameListHolder());
- list.add(buildConverterNameListHolder());
- return new CompositeListValueModel<ListValueModel<String>, String>(list);
- }
-
- protected ListValueModel<String> buildDefaultNameListHolder() {
- return new PropertyListValueModelAdapter<String>(
- buildDefaultNameHolder()
- );
- }
-
- private WritablePropertyValueModel<String> buildDefaultNameHolder() {
- return new PropertyAspectAdapter<Convert, String>(getSubjectHolder(), Convert.DEFAULT_CONVERTER_NAME_PROPERTY) {
- @Override
- protected String buildValue_() {
- String name = this.subject.getDefaultConverterName();
-
- if (name == null) {
- name = DEFAULT_KEY;
- }
- else {
- name = DEFAULT_KEY + name;
- }
-
- return name;
- }
- };
- }
-
- private StringConverter<String> buildNameConverter() {
- return new StringConverter<String>() {
- public String convertToString(String value) {
-
- if (getSubject() == null) {
- return value;
- }
-
- if (value == null) {
- value = getSubject().getDefaultConverterName();
-
- if (value != null) {
- value = DEFAULT_KEY + value;
- }
- else {
- value = DEFAULT_KEY;
- }
- }
-
- if (value.startsWith(DEFAULT_KEY)) {
- String defaultName = value.substring(DEFAULT_KEY.length());
-
- if (defaultName.length() > 0) {
- value = NLS.bind(
- JptUiMappingsMessages.DefaultWithOneParam,
- defaultName
- );
- }
- else {
- value = JptUiMappingsMessages.DefaultEmpty;
- }
- }
-
- return value;
- }
- };
- }
-
- protected ListValueModel<String> buildReservedConverterNameListHolder() {
- return new StaticListValueModel<String>(Convert.RESERVED_CONVERTER_NAMES);
- }
-
- protected ListValueModel<String> buildConverterNameListHolder() {
- return new ListAspectAdapter<EclipseLinkPersistenceUnit, String>(
- buildPersistenceUnitHolder(),
- EclipseLinkPersistenceUnit.CONVERTERS_LIST)//TODO need EclipseLinkPersistenceUnit interface
- {
- @Override
- protected ListIterator<String> listIterator_() {
- return CollectionTools.listIterator(CollectionTools.sort(this.subject.uniqueConverterNames()));
- }
- };
- }
-
- protected PropertyValueModel<EclipseLinkPersistenceUnit> buildPersistenceUnitHolder() {
- return new PropertyAspectAdapter<Convert, EclipseLinkPersistenceUnit>(getSubjectHolder()) {
- @Override
- protected EclipseLinkPersistenceUnit buildValue_() {
- return (EclipseLinkPersistenceUnit) getSubject().getPersistenceUnit();
- }
- };
- }
-
- private WritablePropertyValueModel<Boolean> buildNoConverterHolder() {
- return new PropertyAspectAdapter<Convert, Boolean>(getSubjectHolder(), Convert.CONVERTER_PROPERTY) {
- @Override
- protected Boolean buildValue_() {
- return Boolean.valueOf(this.subject.getConverter() == null);
- }
-
- @Override
- protected void setValue_(Boolean value) {
- if (value.booleanValue()) {
- this.subject.setConverter(EclipseLinkConverter.NO_CONVERTER);
- }
- }
- };
- }
-
- private WritablePropertyValueModel<Boolean> buildConverterHolder(final String converterType) {
- return new PropertyAspectAdapter<Convert, Boolean>(getSubjectHolder(), Convert.CONVERTER_PROPERTY) {
- @Override
- protected Boolean buildValue_() {
- EclipseLinkConverter converter = this.subject.getConverter();
- if (converter == null) {
- return Boolean.FALSE;
- }
- return Boolean.valueOf(converter.getType() == converterType);
- }
-
- @Override
- protected void setValue_(Boolean value) {
- if (value.booleanValue()) {
- this.subject.setConverter(converterType);
- }
- }
- };
- }
-
- private PropertyValueModel<EclipseLinkConverter> buildConverterHolder() {
- return new PropertyAspectAdapter<Convert, EclipseLinkConverter>(getSubjectHolder(), Convert.CONVERTER_PROPERTY) {
- @Override
- protected EclipseLinkConverter buildValue_() {
- return this.subject.getConverter();
- }
- };
- }
-
- private PropertyValueModel<CustomConverter> buildCustomConverterHolder(PropertyValueModel<EclipseLinkConverter> converterHolder) {
- return new TransformationPropertyValueModel<EclipseLinkConverter, CustomConverter>(converterHolder) {
- @Override
- protected CustomConverter transform_(EclipseLinkConverter converter) {
- return (converter != null && converter.getType() == EclipseLinkConverter.CUSTOM_CONVERTER) ? (CustomConverter) converter : null;
- }
- };
- }
-
- private PropertyValueModel<TypeConverter> buildTypeConverterHolder(PropertyValueModel<EclipseLinkConverter> converterHolder) {
- return new TransformationPropertyValueModel<EclipseLinkConverter, TypeConverter>(converterHolder) {
- @Override
- protected TypeConverter transform_(EclipseLinkConverter converter) {
- return (converter != null && converter.getType() == EclipseLinkConverter.TYPE_CONVERTER) ? (TypeConverter) converter : null;
- }
- };
- }
-
- private PropertyValueModel<ObjectTypeConverter> buildObjectTypeConverterHolder(PropertyValueModel<EclipseLinkConverter> converterHolder) {
- return new TransformationPropertyValueModel<EclipseLinkConverter, ObjectTypeConverter>(converterHolder) {
- @Override
- protected ObjectTypeConverter transform_(EclipseLinkConverter converter) {
- return (converter != null && converter.getType() == EclipseLinkConverter.OBJECT_TYPE_CONVERTER) ? (ObjectTypeConverter) converter : null;
- }
- };
- }
-
- private PropertyValueModel<StructConverter> buildStructConverterHolder(PropertyValueModel<EclipseLinkConverter> converterHolder) {
- return new TransformationPropertyValueModel<EclipseLinkConverter, StructConverter>(converterHolder) {
- @Override
- protected StructConverter transform_(EclipseLinkConverter converter) {
- return (converter != null && converter.getType() == EclipseLinkConverter.STRUCT_CONVERTER) ? (StructConverter) converter : null;
- }
- };
- }
-
- protected PropertyValueModel<Boolean> buildBooleanHolder() {
- return new TransformationPropertyValueModel<Convert, Boolean>(getSubjectHolder()) {
- @Override
- protected Boolean transform(Convert value) {
- if (getSubject() != null && getSubject().getParent().getPersistentAttribute().isVirtual()) {
- return Boolean.FALSE;
- }
- return Boolean.valueOf(value != null);
- }
- };
- }
-}
diff --git a/jpa/plugins/org.eclipse.jpt.eclipselink.ui/src/org/eclipse/jpt/eclipselink/ui/internal/mappings/details/CustomConverterComposite.java b/jpa/plugins/org.eclipse.jpt.eclipselink.ui/src/org/eclipse/jpt/eclipselink/ui/internal/mappings/details/CustomConverterComposite.java
deleted file mode 100644
index 4cf240a7e4..0000000000
--- a/jpa/plugins/org.eclipse.jpt.eclipselink.ui/src/org/eclipse/jpt/eclipselink/ui/internal/mappings/details/CustomConverterComposite.java
+++ /dev/null
@@ -1,156 +0,0 @@
-/*******************************************************************************
- * Copyright (c) 2006, 2009 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
- *
- * Contributors: Oracle. - initial API and implementation
- *******************************************************************************/
-package org.eclipse.jpt.eclipselink.ui.internal.mappings.details;
-
-import org.eclipse.jpt.core.JpaProject;
-import org.eclipse.jpt.eclipselink.core.context.CustomConverter;
-import org.eclipse.jpt.eclipselink.core.context.EclipseLinkConverter;
-import org.eclipse.jpt.eclipselink.ui.internal.mappings.EclipseLinkUiMappingsMessages;
-import org.eclipse.jpt.ui.WidgetFactory;
-import org.eclipse.jpt.ui.internal.util.PaneEnabler;
-import org.eclipse.jpt.ui.internal.widgets.ClassChooserPane;
-import org.eclipse.jpt.ui.internal.widgets.FormPane;
-import org.eclipse.jpt.utility.internal.model.value.PropertyAspectAdapter;
-import org.eclipse.jpt.utility.internal.model.value.TransformationPropertyValueModel;
-import org.eclipse.jpt.utility.model.value.PropertyValueModel;
-import org.eclipse.jpt.utility.model.value.WritablePropertyValueModel;
-import org.eclipse.swt.widgets.Composite;
-
-/**
- * Here the layout of this pane:
- * <pre>
- * -----------------------------------------------------------------------------
- * | -------------------------------------------------------------- |
- * | Name: | ||
- * | -------------------------------------------------------------- |
- * -----------------------------------------------------------------------------</pre>
- *
- * @see EclipseLinkConverter
- * @see ConvertComposite - A container of this widget
- *
- * @version 2.1
- * @since 2.1
- */
-public class CustomConverterComposite extends FormPane<CustomConverter>
-{
-
- /**
- * Creates a new <code>ConverterComposite</code>.
- *
- * @param parentPane The parent container of this one
- * @param parent The parent container
- */
- public CustomConverterComposite(PropertyValueModel<? extends CustomConverter> subjectHolder,
- Composite parent,
- WidgetFactory widgetFactory) {
-
- super(subjectHolder, parent, widgetFactory);
- }
-
- @Override
- protected void initializeLayout(Composite container) {
-
- addLabeledText(
- container,
- EclipseLinkUiMappingsMessages.ConverterComposite_nameTextLabel,
- buildNameTextHolder());
-
- addClassChooser(container);
-
- new PaneEnabler(buildBooleanHolder(), this);
- }
-
- protected WritablePropertyValueModel<String> buildNameTextHolder() {
- return new PropertyAspectAdapter<CustomConverter, String>(
- getSubjectHolder(), EclipseLinkConverter.NAME_PROPERTY) {
- @Override
- protected String buildValue_() {
- return this.subject.getName();
- }
-
- @Override
- protected void setValue_(String value) {
- if (value.length() == 0) {
- value = null;
- }
- this.subject.setName(value);
- }
- };
- }
-
-
- private ClassChooserPane<CustomConverter> addClassChooser(Composite container) {
-
- return new ClassChooserPane<CustomConverter>(this, container) {
-
- @Override
- protected WritablePropertyValueModel<String> buildTextHolder() {
- return new PropertyAspectAdapter<CustomConverter, String>(getSubjectHolder(), CustomConverter.CONVERTER_CLASS_PROPERTY) {
- @Override
- protected String buildValue_() {
- return this.subject.getConverterClass();
- }
-
- @Override
- protected void setValue_(String value) {
-
- if (value.length() == 0) {
- value = null;
- }
-
- this.subject.setConverterClass(value);
- }
- };
- }
-
- @Override
- protected String getClassName() {
- return getSubject().getConverterClass();
- }
-
- @Override
- protected String getLabelText() {
- return EclipseLinkUiMappingsMessages.ConverterComposite_classLabel;
- }
-
- @Override
- protected JpaProject getJpaProject() {
- return getSubject().getJpaProject();
- }
-
- @Override
- protected void setClassName(String className) {
- getSubject().setConverterClass(className);
- }
-
- @Override
- protected String getSuperInterfaceName() {
- return CustomConverter.ECLIPSELINK_CONVERTER_CLASS_NAME;
- }
-
- @Override
- protected char getEnclosingTypeSeparator() {
- return getSubject().getEnclosingTypeSeparator();
- }
- };
- }
-
-
- protected PropertyValueModel<Boolean> buildBooleanHolder() {
- return new TransformationPropertyValueModel<CustomConverter, Boolean>(getSubjectHolder()) {
- @Override
- protected Boolean transform(CustomConverter value) {
-// if (getSubject() != null && getSubject().getParent().getPersistentAttribute().isVirtual()) {
-// return Boolean.FALSE;
-// }
- return Boolean.valueOf(value != null);
- }
- };
- }
-}
diff --git a/jpa/plugins/org.eclipse.jpt.eclipselink.ui/src/org/eclipse/jpt/eclipselink/ui/internal/mappings/details/CustomizerComposite.java b/jpa/plugins/org.eclipse.jpt.eclipselink.ui/src/org/eclipse/jpt/eclipselink/ui/internal/mappings/details/CustomizerComposite.java
deleted file mode 100644
index 45e6a9d0db..0000000000
--- a/jpa/plugins/org.eclipse.jpt.eclipselink.ui/src/org/eclipse/jpt/eclipselink/ui/internal/mappings/details/CustomizerComposite.java
+++ /dev/null
@@ -1,105 +0,0 @@
-/*******************************************************************************
- * Copyright (c) 2008, 2009 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.
- *
- * Contributors:
- * Oracle - initial API and implementation
- ******************************************************************************/
-package org.eclipse.jpt.eclipselink.ui.internal.mappings.details;
-
-import org.eclipse.jpt.core.JpaProject;
-import org.eclipse.jpt.eclipselink.core.context.Customizer;
-import org.eclipse.jpt.eclipselink.ui.internal.mappings.EclipseLinkUiMappingsMessages;
-import org.eclipse.jpt.ui.internal.widgets.ClassChooserPane;
-import org.eclipse.jpt.ui.internal.widgets.FormPane;
-import org.eclipse.jpt.utility.internal.model.value.PropertyAspectAdapter;
-import org.eclipse.jpt.utility.model.value.PropertyValueModel;
-import org.eclipse.jpt.utility.model.value.WritablePropertyValueModel;
-import org.eclipse.swt.widgets.Composite;
-
-/**
- *
- * @see Customizer
- *
- * @version 2.1
- * @since 2.1
- */
-public class CustomizerComposite extends FormPane<Customizer>
-{
- /**
- * Creates a new <code>CustomizerComposite</code>.
- *
- * @param parentPane The parent container of this one
- * @param parent The parent container
- */
- public CustomizerComposite(FormPane<?> parentPane,
- PropertyValueModel<? extends Customizer> subjectHolder,
- Composite parent) {
-
- super(parentPane, subjectHolder, parent);
- }
-
- @Override
- protected void initializeLayout(Composite container) {
- addCustomizerClassChooser(container);
- }
-
- private ClassChooserPane<Customizer> addCustomizerClassChooser(Composite container) {
-
- return new ClassChooserPane<Customizer>(this, container) {
-
- @Override
- protected WritablePropertyValueModel<String> buildTextHolder() {
- return new PropertyAspectAdapter<Customizer, String>(getSubjectHolder(), Customizer.SPECIFIED_CUSTOMIZER_CLASS_PROPERTY) {
- @Override
- protected String buildValue_() {
- return this.subject.getSpecifiedCustomizerClass();
- }
-
- @Override
- protected void setValue_(String value) {
-
- if (value.length() == 0) {
- value = null;
- }
-
- this.subject.setSpecifiedCustomizerClass(value);
- }
- };
- }
-
- @Override
- protected String getClassName() {
- return getSubject().getSpecifiedCustomizerClass();
- }
-
- @Override
- protected String getLabelText() {
- return EclipseLinkUiMappingsMessages.CustomizerComposite_classLabel;
- }
-
- @Override
- protected JpaProject getJpaProject() {
- return getSubject().getJpaProject();
- }
-
- @Override
- protected void setClassName(String className) {
- getSubject().setSpecifiedCustomizerClass(className);
- }
-
- @Override
- protected String getSuperInterfaceName() {
- return Customizer.ECLIPSELINK_DESCRIPTOR_CUSTOMIZER_CLASS_NAME;
- }
-
- @Override
- protected char getEnclosingTypeSeparator() {
- return getSubject().getCustomizerClassEnclosingTypeSeparator();
- }
- };
- }
-
-}
diff --git a/jpa/plugins/org.eclipse.jpt.eclipselink.ui/src/org/eclipse/jpt/eclipselink/ui/internal/mappings/details/DisableHitsComposite.java b/jpa/plugins/org.eclipse.jpt.eclipselink.ui/src/org/eclipse/jpt/eclipselink/ui/internal/mappings/details/DisableHitsComposite.java
deleted file mode 100644
index 2ff2230fa8..0000000000
--- a/jpa/plugins/org.eclipse.jpt.eclipselink.ui/src/org/eclipse/jpt/eclipselink/ui/internal/mappings/details/DisableHitsComposite.java
+++ /dev/null
@@ -1,101 +0,0 @@
-/*******************************************************************************
- * Copyright (c) 2008, 2009 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.
- *
- * Contributors:
- * Oracle - initial API and implementation
- ******************************************************************************/
-package org.eclipse.jpt.eclipselink.ui.internal.mappings.details;
-
-import org.eclipse.jpt.eclipselink.core.context.Caching;
-import org.eclipse.jpt.eclipselink.ui.internal.EclipseLinkHelpContextIds;
-import org.eclipse.jpt.eclipselink.ui.internal.mappings.EclipseLinkUiMappingsMessages;
-import org.eclipse.jpt.ui.internal.mappings.JptUiMappingsMessages;
-import org.eclipse.jpt.ui.internal.widgets.FormPane;
-import org.eclipse.jpt.utility.internal.model.value.PropertyAspectAdapter;
-import org.eclipse.jpt.utility.internal.model.value.TransformationPropertyValueModel;
-import org.eclipse.jpt.utility.model.value.PropertyValueModel;
-import org.eclipse.jpt.utility.model.value.WritablePropertyValueModel;
-import org.eclipse.osgi.util.NLS;
-import org.eclipse.swt.widgets.Composite;
-
-/**
- * This composite simply shows a tri-state check box for the Disable Hits option.
- *
- * @see EclipseLinkCaching
- * @see CachingComposite - A container of this widget
- *
- * @version 2.1
- * @since 2.1
- */
-public class DisableHitsComposite extends FormPane<Caching>
-{
- /**
- * Creates a new <code>OptionalComposite</code>.
- *
- * @param parentPane The parent container of this one
- * @param parent The parent container
- */
- public DisableHitsComposite(FormPane<? extends Caching> parentPane,
- Composite parent)
- {
- super(parentPane, parent);
- }
-
- @Override
- protected void initializeLayout(Composite container) {
-
- addTriStateCheckBoxWithDefault(
- container,
- EclipseLinkUiMappingsMessages.DisableHitsComposite_disableHitsLabel,
- buildDisableHitsHolder(),
- buildDisableHitsStringHolder(),
- EclipseLinkHelpContextIds.CACHING_DISABLE_HITS
- );
- }
-
- private WritablePropertyValueModel<Boolean> buildDisableHitsHolder() {
- return new PropertyAspectAdapter<Caching, Boolean>(getSubjectHolder(), Caching.SPECIFIED_DISABLE_HITS_PROPERTY) {
- @Override
- protected Boolean buildValue_() {
- return this.subject.getSpecifiedDisableHits();
- }
-
- @Override
- protected void setValue_(Boolean value) {
- this.subject.setSpecifiedDisableHits(value);
- }
- };
- }
-
- private PropertyValueModel<String> buildDisableHitsStringHolder() {
- return new TransformationPropertyValueModel<Boolean, String>(buildDefaultDisableHitsHolder()) {
- @Override
- protected String transform(Boolean value) {
- if (value != null) {
- String defaultStringValue = value.booleanValue() ? JptUiMappingsMessages.Boolean_True : JptUiMappingsMessages.Boolean_False;
- return NLS.bind(EclipseLinkUiMappingsMessages.DisableHitsComposite_disableHitsDefault, defaultStringValue);
- }
- return EclipseLinkUiMappingsMessages.DisableHitsComposite_disableHitsLabel;
- }
- };
- }
-
- private PropertyValueModel<Boolean> buildDefaultDisableHitsHolder() {
- return new PropertyAspectAdapter<Caching, Boolean>(
- getSubjectHolder(),
- Caching.SPECIFIED_DISABLE_HITS_PROPERTY,
- Caching.DEFAULT_DISABLE_HITS_PROPERTY)
- {
- @Override
- protected Boolean buildValue_() {
- if (this.subject.getSpecifiedDisableHits() != null) {
- return null;
- }
- return Boolean.valueOf(this.subject.isDefaultDisableHits());
- }
- };
- }
-} \ No newline at end of file
diff --git a/jpa/plugins/org.eclipse.jpt.eclipselink.ui/src/org/eclipse/jpt/eclipselink/ui/internal/mappings/details/EclipseLinkBasicCollectionMappingUiProvider.java b/jpa/plugins/org.eclipse.jpt.eclipselink.ui/src/org/eclipse/jpt/eclipselink/ui/internal/mappings/details/EclipseLinkBasicCollectionMappingUiProvider.java
deleted file mode 100644
index 4bf9f9f487..0000000000
--- a/jpa/plugins/org.eclipse.jpt.eclipselink.ui/src/org/eclipse/jpt/eclipselink/ui/internal/mappings/details/EclipseLinkBasicCollectionMappingUiProvider.java
+++ /dev/null
@@ -1,42 +0,0 @@
-/*******************************************************************************
- * Copyright (c) 2008, 2009 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.
- *
- * Contributors:
- * Oracle - initial API and implementation
- ******************************************************************************/
-package org.eclipse.jpt.eclipselink.ui.internal.mappings.details;
-
-import org.eclipse.jpt.eclipselink.core.EclipseLinkMappingKeys;
-import org.eclipse.jpt.eclipselink.core.context.BasicCollectionMapping;
-import org.eclipse.jpt.eclipselink.ui.internal.mappings.EclipseLinkUiMappingsMessages;
-import org.eclipse.jpt.ui.JptUiPlugin;
-import org.eclipse.jpt.ui.details.AttributeMappingUiProvider;
-import org.eclipse.jpt.ui.internal.JptUiIcons;
-import org.eclipse.swt.graphics.Image;
-
-public abstract class EclipseLinkBasicCollectionMappingUiProvider<T extends BasicCollectionMapping>
- implements AttributeMappingUiProvider<T>
-{
-
- protected EclipseLinkBasicCollectionMappingUiProvider() {}
-
- public Image getImage() {
- return JptUiPlugin.getImage(JptUiIcons.JPA_CONTENT);
- }
-
- public String getLabel() {
- return EclipseLinkUiMappingsMessages.BasicCollectionMappingUiProvider_label;
- }
-
- public String getLinkLabel() {
- return EclipseLinkUiMappingsMessages.BasicCollectionMappingUiProvider_linkLabel;
- }
-
- public String getKey() {
- return EclipseLinkMappingKeys.BASIC_COLLECTION_ATTRIBUTE_MAPPING_KEY;
- }
-
-}
diff --git a/jpa/plugins/org.eclipse.jpt.eclipselink.ui/src/org/eclipse/jpt/eclipselink/ui/internal/mappings/details/EclipseLinkBasicMapMappingUiProvider.java b/jpa/plugins/org.eclipse.jpt.eclipselink.ui/src/org/eclipse/jpt/eclipselink/ui/internal/mappings/details/EclipseLinkBasicMapMappingUiProvider.java
deleted file mode 100644
index e0890f7a03..0000000000
--- a/jpa/plugins/org.eclipse.jpt.eclipselink.ui/src/org/eclipse/jpt/eclipselink/ui/internal/mappings/details/EclipseLinkBasicMapMappingUiProvider.java
+++ /dev/null
@@ -1,44 +0,0 @@
-/*******************************************************************************
- * Copyright (c) 2008, 2009 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.
- *
- * Contributors:
- * Oracle - initial API and implementation
- ******************************************************************************/
-package org.eclipse.jpt.eclipselink.ui.internal.mappings.details;
-
-import org.eclipse.jpt.eclipselink.core.EclipseLinkMappingKeys;
-import org.eclipse.jpt.eclipselink.core.context.BasicMapMapping;
-import org.eclipse.jpt.eclipselink.ui.internal.mappings.EclipseLinkUiMappingsMessages;
-import org.eclipse.jpt.ui.JptUiPlugin;
-import org.eclipse.jpt.ui.details.AttributeMappingUiProvider;
-import org.eclipse.jpt.ui.internal.JptUiIcons;
-import org.eclipse.swt.graphics.Image;
-
-public abstract class EclipseLinkBasicMapMappingUiProvider<T extends BasicMapMapping>
- implements AttributeMappingUiProvider<T>
-{
-
- protected EclipseLinkBasicMapMappingUiProvider() {
- super();
- }
-
- public Image getImage() {
- return JptUiPlugin.getImage(JptUiIcons.JPA_CONTENT);
- }
-
- public String getLabel() {
- return EclipseLinkUiMappingsMessages.BasicMapMappingUiProvider_label;
- }
-
- public String getLinkLabel() {
- return EclipseLinkUiMappingsMessages.BasicMapMappingUiProvider_linkLabel;
- }
-
- public String getKey() {
- return EclipseLinkMappingKeys.BASIC_MAP_ATTRIBUTE_MAPPING_KEY;
- }
-
-}
diff --git a/jpa/plugins/org.eclipse.jpt.eclipselink.ui/src/org/eclipse/jpt/eclipselink/ui/internal/mappings/details/EclipseLinkBasicMappingComposite.java b/jpa/plugins/org.eclipse.jpt.eclipselink.ui/src/org/eclipse/jpt/eclipselink/ui/internal/mappings/details/EclipseLinkBasicMappingComposite.java
deleted file mode 100644
index f5ccc6519c..0000000000
--- a/jpa/plugins/org.eclipse.jpt.eclipselink.ui/src/org/eclipse/jpt/eclipselink/ui/internal/mappings/details/EclipseLinkBasicMappingComposite.java
+++ /dev/null
@@ -1,282 +0,0 @@
-/*******************************************************************************
- * Copyright (c) 2008, 2009 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.
- *
- * Contributors:
- * Oracle - initial API and implementation
- ******************************************************************************/
-package org.eclipse.jpt.eclipselink.ui.internal.mappings.details;
-
-import org.eclipse.jpt.core.context.BasicMapping;
-import org.eclipse.jpt.core.context.Column;
-import org.eclipse.jpt.core.context.Converter;
-import org.eclipse.jpt.core.context.ConvertibleMapping;
-import org.eclipse.jpt.core.context.EnumeratedConverter;
-import org.eclipse.jpt.core.context.TemporalConverter;
-import org.eclipse.jpt.eclipselink.core.context.Convert;
-import org.eclipse.jpt.eclipselink.core.context.EclipseLinkBasicMapping;
-import org.eclipse.jpt.eclipselink.core.context.Mutable;
-import org.eclipse.jpt.eclipselink.ui.internal.mappings.EclipseLinkUiMappingsMessages;
-import org.eclipse.jpt.ui.WidgetFactory;
-import org.eclipse.jpt.ui.details.JpaComposite;
-import org.eclipse.jpt.ui.internal.mappings.JptUiMappingsMessages;
-import org.eclipse.jpt.ui.internal.mappings.details.ColumnComposite;
-import org.eclipse.jpt.ui.internal.mappings.details.EnumTypeComposite;
-import org.eclipse.jpt.ui.internal.mappings.details.FetchTypeComposite;
-import org.eclipse.jpt.ui.internal.mappings.details.OptionalComposite;
-import org.eclipse.jpt.ui.internal.mappings.details.TemporalTypeComposite;
-import org.eclipse.jpt.ui.internal.widgets.FormPane;
-import org.eclipse.jpt.ui.internal.widgets.Pane;
-import org.eclipse.jpt.utility.internal.model.value.PropertyAspectAdapter;
-import org.eclipse.jpt.utility.internal.model.value.TransformationPropertyValueModel;
-import org.eclipse.jpt.utility.model.value.PropertyValueModel;
-import org.eclipse.jpt.utility.model.value.WritablePropertyValueModel;
-import org.eclipse.swt.layout.GridData;
-import org.eclipse.swt.layout.GridLayout;
-import org.eclipse.swt.widgets.Button;
-import org.eclipse.swt.widgets.Composite;
-
-/**
- * Here the layout of this pane:
- * <pre>
- * -----------------------------------------------------------------------------
- * | ------------------------------------------------------------------------- |
- * | | | |
- * | | ColumnComposite | |
- * | | | |
- * | ------------------------------------------------------------------------- |
- * | ------------------------------------------------------------------------- |
- * | | | |
- * | | FetchTypeComposite | |
- * | | | |
- * | ------------------------------------------------------------------------- |
- * | ------------------------------------------------------------------------- |
- * | | | |
- * | | TemporalTypeComposite | |
- * | | | |
- * | ------------------------------------------------------------------------- |
- * | ------------------------------------------------------------------------- |
- * | | | |
- * | | EnumTypeComposite | |
- * | | | |
- * | ------------------------------------------------------------------------- |
- * | ------------------------------------------------------------------------- |
- * | | | |
- * | | OptionalComposite | |
- * | | | |
- * | ------------------------------------------------------------------------- |
- * | ------------------------------------------------------------------------- |
- * | | | |
- * | | MutableComposite | |
- * | | | |
- * | ------------------------------------------------------------------------- |
- * | ------------------------------------------------------------------------- |
- * | | | |
- * | | LobComposite | |
- * | | | |
- * | ------------------------------------------------------------------------- |
- * -----------------------------------------------------------------------------</pre>
- *
- * @see BasicMapping
- * @see BaseJpaUiFactory - The factory creating this pane
- * @see ColumnComposite
- * @see EnumTypeComposite
- * @see FetchTypeComposite
- * @see LobComposite
- * @see OptionalComposite
- * @see TemporalTypeComposite
- *
- * @version 2.1
- * @since 2.1
- */
-public class EclipseLinkBasicMappingComposite extends FormPane<BasicMapping>
- implements JpaComposite
-{
- /**
- * Creates a new <code>BasicMappingComposite</code>.
- *
- * @param subjectHolder The holder of the subject <code>IBasicMapping</code>
- * @param parent The parent container
- * @param widgetFactory The factory used to create various common widgets
- */
- public EclipseLinkBasicMappingComposite(PropertyValueModel<? extends BasicMapping> subjectHolder,
- Composite parent,
- WidgetFactory widgetFactory) {
-
- super(subjectHolder, parent, widgetFactory);
- }
-
- @Override
- protected void initializeLayout(Composite container) {
- initializeGeneralPane(container);
- initializeTypePane(container);
- }
-
- protected void initializeGeneralPane(Composite container) {
- int groupBoxMargin = getGroupBoxMargin();
-
- new ColumnComposite(this, buildColumnHolder(), container);
-
- // Align the widgets under the ColumnComposite
- container = addSubPane(container, 0, groupBoxMargin, 0, groupBoxMargin);
-
- new FetchTypeComposite(this, container);
- new OptionalComposite(this, addSubPane(container, 4));
-
- // Mutable widgets
- new MutableComposite(this, buildMutableHolder(), container);
- }
-
- protected void initializeTypePane(Composite container) {
-
- container = addCollapsableSection(
- container,
- JptUiMappingsMessages.TypeSection_type
- );
- ((GridLayout) container.getLayout()).numColumns = 2;
-
- // No converter
- Button noConverterButton = addRadioButton(
- container,
- JptUiMappingsMessages.TypeSection_default,
- buildNoConverterHolder(),
- null);
- ((GridData) noConverterButton.getLayoutData()).horizontalSpan = 2;
-
- // Lob
- Button lobButton = addRadioButton(
- container,
- JptUiMappingsMessages.TypeSection_lob,
- buildConverterBooleanHolder(Converter.LOB_CONVERTER),
- null);
- ((GridData) lobButton.getLayoutData()).horizontalSpan = 2;
-
- PropertyValueModel<Converter> specifiedConverterHolder = buildSpecifiedConverterHolder();
- // Temporal
- addRadioButton(
- container,
- JptUiMappingsMessages.TypeSection_temporal,
- buildConverterBooleanHolder(Converter.TEMPORAL_CONVERTER),
- null);
- registerSubPane(new TemporalTypeComposite(buildTemporalConverterHolder(specifiedConverterHolder), container, getWidgetFactory()));
-
-
- // Enumerated
- addRadioButton(
- container,
- JptUiMappingsMessages.TypeSection_enumerated,
- buildConverterBooleanHolder(Converter.ENUMERATED_CONVERTER),
- null);
- registerSubPane(new EnumTypeComposite(buildEnumeratedConverterHolder(specifiedConverterHolder), container, getWidgetFactory()));
-
- // EclipseLink Converter
- Button elConverterButton = addRadioButton(
- container,
- EclipseLinkUiMappingsMessages.TypeSection_converted,
- buildConverterBooleanHolder(Convert.ECLIPSE_LINK_CONVERTER),
- null);
- ((GridData) elConverterButton.getLayoutData()).horizontalSpan = 2;
-
- Pane<Convert> convertComposite = buildConvertComposite(buildEclipseLinkConverterHolder(specifiedConverterHolder), container);
- GridData gridData = (GridData) convertComposite.getControl().getLayoutData();
- gridData.horizontalSpan = 2;
- gridData.horizontalIndent = 20;
- registerSubPane(convertComposite);
- }
-
- protected Pane<Convert> buildConvertComposite(PropertyValueModel<Convert> convertHolder, Composite container) {
- return new ConvertComposite(convertHolder, container, getWidgetFactory());
- }
-
- protected PropertyValueModel<Column> buildColumnHolder() {
- return new TransformationPropertyValueModel<BasicMapping, Column>(getSubjectHolder()) {
- @Override
- protected Column transform_(BasicMapping value) {
- return value.getColumn();
- }
- };
- }
-
- protected PropertyValueModel<Mutable> buildMutableHolder() {
- return new PropertyAspectAdapter<BasicMapping, Mutable>(getSubjectHolder()) {
- @Override
- protected Mutable buildValue_() {
- return ((EclipseLinkBasicMapping) this.subject).getMutable();
- }
- };
- }
-
- protected PropertyValueModel<Converter> buildSpecifiedConverterHolder() {
- return new PropertyAspectAdapter<BasicMapping, Converter>(getSubjectHolder(), ConvertibleMapping.SPECIFIED_CONVERTER_PROPERTY) {
- @Override
- protected Converter buildValue_() {
- return this.subject.getSpecifiedConverter();
- }
- };
- }
-
- protected PropertyValueModel<TemporalConverter> buildTemporalConverterHolder(PropertyValueModel<Converter> converterHolder) {
- return new TransformationPropertyValueModel<Converter, TemporalConverter>(converterHolder) {
- @Override
- protected TemporalConverter transform_(Converter converter) {
- return (converter != null && converter.getType() == Converter.TEMPORAL_CONVERTER) ? (TemporalConverter) converter : null;
- }
- };
- }
-
- protected PropertyValueModel<EnumeratedConverter> buildEnumeratedConverterHolder(PropertyValueModel<Converter> converterHolder) {
- return new TransformationPropertyValueModel<Converter, EnumeratedConverter>(converterHolder) {
- @Override
- protected EnumeratedConverter transform_(Converter converter) {
- return (converter != null && converter.getType() == Converter.ENUMERATED_CONVERTER) ? (EnumeratedConverter) converter : null;
- }
- };
- }
-
- protected PropertyValueModel<Convert> buildEclipseLinkConverterHolder(PropertyValueModel<Converter> converterHolder) {
- return new TransformationPropertyValueModel<Converter, Convert>(converterHolder) {
- @Override
- protected Convert transform_(Converter converter) {
- return (converter != null && converter.getType() == Convert.ECLIPSE_LINK_CONVERTER) ? (Convert) converter : null;
- }
- };
- }
-
- protected WritablePropertyValueModel<Boolean> buildNoConverterHolder() {
- return new PropertyAspectAdapter<BasicMapping, Boolean>(getSubjectHolder(), ConvertibleMapping.SPECIFIED_CONVERTER_PROPERTY) {
- @Override
- protected Boolean buildValue_() {
- return Boolean.valueOf(this.subject.getSpecifiedConverter() == null);
- }
-
- @Override
- protected void setValue_(Boolean value) {
- if (value.booleanValue()) {
- this.subject.setSpecifiedConverter(Converter.NO_CONVERTER);
- }
- }
- };
- }
-
- protected WritablePropertyValueModel<Boolean> buildConverterBooleanHolder(final String converterType) {
- return new PropertyAspectAdapter<BasicMapping, Boolean>(getSubjectHolder(), ConvertibleMapping.SPECIFIED_CONVERTER_PROPERTY) {
- @Override
- protected Boolean buildValue_() {
- Converter converter = this.subject.getSpecifiedConverter();
- if (converter == null) {
- return Boolean.FALSE;
- }
- return Boolean.valueOf(converter.getType() == converterType);
- }
-
- @Override
- protected void setValue_(Boolean value) {
- if (value.booleanValue()) {
- this.subject.setSpecifiedConverter(converterType);
- }
- }
- };
- }
-} \ No newline at end of file
diff --git a/jpa/plugins/org.eclipse.jpt.eclipselink.ui/src/org/eclipse/jpt/eclipselink/ui/internal/mappings/details/EclipseLinkEmbeddableAdvancedComposite.java b/jpa/plugins/org.eclipse.jpt.eclipselink.ui/src/org/eclipse/jpt/eclipselink/ui/internal/mappings/details/EclipseLinkEmbeddableAdvancedComposite.java
deleted file mode 100644
index 95c7c879ba..0000000000
--- a/jpa/plugins/org.eclipse.jpt.eclipselink.ui/src/org/eclipse/jpt/eclipselink/ui/internal/mappings/details/EclipseLinkEmbeddableAdvancedComposite.java
+++ /dev/null
@@ -1,59 +0,0 @@
-/*******************************************************************************
- * Copyright (c) 2008 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.
- *
- * Contributors:
- * Oracle - initial API and implementation
- ******************************************************************************/
-package org.eclipse.jpt.eclipselink.ui.internal.mappings.details;
-
-import org.eclipse.jpt.core.context.Embeddable;
-import org.eclipse.jpt.eclipselink.core.context.ChangeTracking;
-import org.eclipse.jpt.eclipselink.core.context.Customizer;
-import org.eclipse.jpt.eclipselink.core.context.EclipseLinkEmbeddable;
-import org.eclipse.jpt.eclipselink.ui.internal.mappings.EclipseLinkUiMappingsMessages;
-import org.eclipse.jpt.ui.internal.widgets.FormPane;
-import org.eclipse.jpt.utility.internal.model.value.PropertyAspectAdapter;
-import org.eclipse.jpt.utility.model.value.PropertyValueModel;
-import org.eclipse.swt.widgets.Composite;
-
-public class EclipseLinkEmbeddableAdvancedComposite extends FormPane<Embeddable> {
-
- public EclipseLinkEmbeddableAdvancedComposite(
- FormPane<? extends Embeddable> parentPane,
- Composite parent) {
-
- super(parentPane, parent, false);
- }
-
- @Override
- protected void initializeLayout(Composite container) {
- container = addCollapsableSection(
- container,
- EclipseLinkUiMappingsMessages.EclipseLinkTypeMappingComposite_advanced
- );
-
- new CustomizerComposite(this, buildCustomizerHolder(), container);
- new ChangeTrackingComposite(this, buildChangeTrackingHolder(), container);
- }
-
- private PropertyValueModel<Customizer> buildCustomizerHolder() {
- return new PropertyAspectAdapter<Embeddable, Customizer>(getSubjectHolder()) {
- @Override
- protected Customizer buildValue_() {
- return ((EclipseLinkEmbeddable) this.subject).getCustomizer();
- }
- };
- }
-
- private PropertyValueModel<ChangeTracking> buildChangeTrackingHolder() {
- return new PropertyAspectAdapter<Embeddable, ChangeTracking>(getSubjectHolder()) {
- @Override
- protected ChangeTracking buildValue_() {
- return ((EclipseLinkEmbeddable) this.subject).getChangeTracking();
- }
- };
- }
-}
diff --git a/jpa/plugins/org.eclipse.jpt.eclipselink.ui/src/org/eclipse/jpt/eclipselink/ui/internal/mappings/details/EclipseLinkEntityAdvancedComposite.java b/jpa/plugins/org.eclipse.jpt.eclipselink.ui/src/org/eclipse/jpt/eclipselink/ui/internal/mappings/details/EclipseLinkEntityAdvancedComposite.java
deleted file mode 100644
index da73465c0f..0000000000
--- a/jpa/plugins/org.eclipse.jpt.eclipselink.ui/src/org/eclipse/jpt/eclipselink/ui/internal/mappings/details/EclipseLinkEntityAdvancedComposite.java
+++ /dev/null
@@ -1,70 +0,0 @@
-/*******************************************************************************
- * Copyright (c) 2008 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.
- *
- * Contributors:
- * Oracle - initial API and implementation
- ******************************************************************************/
-package org.eclipse.jpt.eclipselink.ui.internal.mappings.details;
-
-import org.eclipse.jpt.core.context.Entity;
-import org.eclipse.jpt.eclipselink.core.context.ChangeTracking;
-import org.eclipse.jpt.eclipselink.core.context.Customizer;
-import org.eclipse.jpt.eclipselink.core.context.EclipseLinkEntity;
-import org.eclipse.jpt.eclipselink.core.context.ReadOnly;
-import org.eclipse.jpt.eclipselink.ui.internal.mappings.EclipseLinkUiMappingsMessages;
-import org.eclipse.jpt.ui.internal.widgets.FormPane;
-import org.eclipse.jpt.utility.internal.model.value.PropertyAspectAdapter;
-import org.eclipse.jpt.utility.model.value.PropertyValueModel;
-import org.eclipse.swt.widgets.Composite;
-
-public class EclipseLinkEntityAdvancedComposite extends FormPane<Entity> {
-
- public EclipseLinkEntityAdvancedComposite(
- FormPane<? extends Entity> parentPane,
- Composite parent) {
-
- super(parentPane, parent, false);
- }
-
- @Override
- protected void initializeLayout(Composite container) {
- container = addCollapsableSection(
- container,
- EclipseLinkUiMappingsMessages.EclipseLinkTypeMappingComposite_advanced
- );
-
- new ReadOnlyComposite(this, buildReadOnlyHolder(), container);
- new CustomizerComposite(this, buildCustomizerHolder(), container);
- new ChangeTrackingComposite(this, buildChangeTrackingHolder(), container);
- }
-
- private PropertyValueModel<ReadOnly> buildReadOnlyHolder() {
- return new PropertyAspectAdapter<Entity, ReadOnly>(getSubjectHolder()) {
- @Override
- protected ReadOnly buildValue_() {
- return ((EclipseLinkEntity) this.subject).getReadOnly();
- }
- };
- }
-
- private PropertyValueModel<Customizer> buildCustomizerHolder() {
- return new PropertyAspectAdapter<Entity, Customizer>(getSubjectHolder()) {
- @Override
- protected Customizer buildValue_() {
- return ((EclipseLinkEntity) this.subject).getCustomizer();
- }
- };
- }
-
- private PropertyValueModel<ChangeTracking> buildChangeTrackingHolder() {
- return new PropertyAspectAdapter<Entity, ChangeTracking>(getSubjectHolder()) {
- @Override
- protected ChangeTracking buildValue_() {
- return ((EclipseLinkEntity) this.subject).getChangeTracking();
- }
- };
- }
-}
diff --git a/jpa/plugins/org.eclipse.jpt.eclipselink.ui/src/org/eclipse/jpt/eclipselink/ui/internal/mappings/details/EclipseLinkIdMappingComposite.java b/jpa/plugins/org.eclipse.jpt.eclipselink.ui/src/org/eclipse/jpt/eclipselink/ui/internal/mappings/details/EclipseLinkIdMappingComposite.java
deleted file mode 100644
index 4cbc875e6e..0000000000
--- a/jpa/plugins/org.eclipse.jpt.eclipselink.ui/src/org/eclipse/jpt/eclipselink/ui/internal/mappings/details/EclipseLinkIdMappingComposite.java
+++ /dev/null
@@ -1,252 +0,0 @@
-/*******************************************************************************
- * Copyright (c) 2008 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.
- *
- * Contributors:
- * Oracle - initial API and implementation
- ******************************************************************************/
-package org.eclipse.jpt.eclipselink.ui.internal.mappings.details;
-
-import org.eclipse.jpt.core.context.Column;
-import org.eclipse.jpt.core.context.Converter;
-import org.eclipse.jpt.core.context.ConvertibleMapping;
-import org.eclipse.jpt.core.context.IdMapping;
-import org.eclipse.jpt.core.context.TemporalConverter;
-import org.eclipse.jpt.eclipselink.core.context.Convert;
-import org.eclipse.jpt.eclipselink.core.context.EclipseLinkIdMapping;
-import org.eclipse.jpt.eclipselink.core.context.Mutable;
-import org.eclipse.jpt.eclipselink.ui.internal.mappings.EclipseLinkUiMappingsMessages;
-import org.eclipse.jpt.ui.WidgetFactory;
-import org.eclipse.jpt.ui.details.JpaComposite;
-import org.eclipse.jpt.ui.internal.mappings.JptUiMappingsMessages;
-import org.eclipse.jpt.ui.internal.mappings.details.ColumnComposite;
-import org.eclipse.jpt.ui.internal.mappings.details.GenerationComposite;
-import org.eclipse.jpt.ui.internal.mappings.details.TemporalTypeComposite;
-import org.eclipse.jpt.ui.internal.widgets.FormPane;
-import org.eclipse.jpt.ui.internal.widgets.Pane;
-import org.eclipse.jpt.utility.internal.model.value.PropertyAspectAdapter;
-import org.eclipse.jpt.utility.internal.model.value.TransformationPropertyValueModel;
-import org.eclipse.jpt.utility.model.value.PropertyValueModel;
-import org.eclipse.jpt.utility.model.value.WritablePropertyValueModel;
-import org.eclipse.swt.layout.GridData;
-import org.eclipse.swt.layout.GridLayout;
-import org.eclipse.swt.widgets.Button;
-import org.eclipse.swt.widgets.Composite;
-
-/**
- * Here the layout of this pane:
- * <pre>
- * -----------------------------------------------------------------------------
- * | ------------------------------------------------------------------------- |
- * | | | |
- * | | ColumnComposite | |
- * | | | |
- * | ------------------------------------------------------------------------- |
- * | ------------------------------------------------------------------------- |
- * | | | |
- * | | TemporalTypeComposite | |
- * | | | |
- * | ------------------------------------------------------------------------- |
- * | ------------------------------------------------------------------------- |
- * | | | |
- * | | GenerationComposite | |
- * | | | |
- * | ------------------------------------------------------------------------- |
- * -----------------------------------------------------------------------------</pre>
- *
- * @see IdMapping
- * @see BaseJpaUiFactory - The factory creating this pane
- * @see ColumnComposite
- * @see TemporalTypeComposite
- * @see GenerationComposite
- *
- * @version 2.1
- * @since 2.1
- */
-public class EclipseLinkIdMappingComposite extends FormPane<IdMapping>
- implements JpaComposite
-{
- /**
- * Creates a new <code>IdMappingComposite</code>.
- *
- * @param subjectHolder The holder of the subject <code>IIdMapping</code>
- * @param parent The parent container
- * @param widgetFactory The factory used to create various common widgets
- */
- public EclipseLinkIdMappingComposite(PropertyValueModel<? extends IdMapping> subjectHolder,
- Composite parent,
- WidgetFactory widgetFactory) {
-
- super(subjectHolder, parent, widgetFactory);
- }
-
- protected PropertyValueModel<? extends Column> buildColumnHolder() {
- return new TransformationPropertyValueModel<IdMapping, Column>(getSubjectHolder()) {
- @Override
- protected Column transform_(IdMapping value) {
- return value.getColumn();
- }
- };
- }
-
- @Override
- protected void initializeLayout(Composite container) {
- initializeGeneralPane(container);
- initializeTypePane(container);
-
- // Generation pane
- new GenerationComposite(this, container);
- }
-
- protected void initializeGeneralPane(Composite container) {
- int groupBoxMargin = getGroupBoxMargin();
-
- // Column widgets
- new ColumnComposite(this, buildColumnHolder(), container);
-
- // Align the widgets under the ColumnComposite
- container = addSubPane(container, 0, groupBoxMargin, 0, groupBoxMargin);
-
- // Mutable widgets
- new MutableComposite(this, buildMutableHolder(), container);
- }
-
- protected void initializeTypePane(Composite container) {
-
- container = addCollapsableSection(
- addSubPane(container, 5),
- JptUiMappingsMessages.TypeSection_type
- );
- ((GridLayout) container.getLayout()).numColumns = 2;
-
- // No converter
- Button noConverterButton = addRadioButton(
- container,
- JptUiMappingsMessages.TypeSection_default,
- buildNoConverterHolder(),
- null);
- ((GridData) noConverterButton.getLayoutData()).horizontalSpan = 2;
-
- PropertyValueModel<Converter> specifiedConverterHolder = buildSpecifiedConverterHolder();
- // Temporal
- addRadioButton(
- container,
- JptUiMappingsMessages.TypeSection_temporal,
- buildTemporalBooleanHolder(),
- null);
- registerSubPane(new TemporalTypeComposite(buildTemporalConverterHolder(specifiedConverterHolder), container, getWidgetFactory()));
-
- // EclipseLink Converter
- Button elConverterButton = addRadioButton(
- container,
- EclipseLinkUiMappingsMessages.TypeSection_converted,
- buildEclipseLinkConverterBooleanHolder(),
- null);
- ((GridData) elConverterButton.getLayoutData()).horizontalSpan = 2;
-
- Pane<Convert> convertComposite = buildConvertComposite(buildEclipseLinkConverterHolder(specifiedConverterHolder), container);
- GridData gridData = (GridData) convertComposite.getControl().getLayoutData();
- gridData.horizontalSpan = 2;
- gridData.horizontalIndent = 20;
- registerSubPane(convertComposite);
- }
-
- protected Pane<Convert> buildConvertComposite(PropertyValueModel<Convert> convertHolder, Composite container) {
- return new ConvertComposite(convertHolder, container, getWidgetFactory());
- }
-
- protected WritablePropertyValueModel<Boolean> buildNoConverterHolder() {
- return new PropertyAspectAdapter<IdMapping, Boolean>(getSubjectHolder(), ConvertibleMapping.SPECIFIED_CONVERTER_PROPERTY) {
- @Override
- protected Boolean buildValue_() {
- return Boolean.valueOf(this.subject.getSpecifiedConverter() == null);
- }
-
- @Override
- protected void setValue_(Boolean value) {
- if (value.booleanValue()) {
- this.subject.setSpecifiedConverter(Converter.NO_CONVERTER);
- }
- }
- };
- }
-
- protected PropertyValueModel<Convert> buildEclipseLinkConverterHolder(PropertyValueModel<Converter> converterHolder) {
- return new TransformationPropertyValueModel<Converter, Convert>(converterHolder) {
- @Override
- protected Convert transform_(Converter converter) {
- return (converter != null && converter.getType() == Convert.ECLIPSE_LINK_CONVERTER) ? (Convert) converter : null;
- }
- };
- }
-
- protected WritablePropertyValueModel<Boolean> buildTemporalBooleanHolder() {
- return new PropertyAspectAdapter<IdMapping, Boolean>(getSubjectHolder(), ConvertibleMapping.SPECIFIED_CONVERTER_PROPERTY) {
- @Override
- protected Boolean buildValue_() {
- Converter converter = this.subject.getSpecifiedConverter();
- if (converter == null) {
- return Boolean.FALSE;
- }
- return Boolean.valueOf(converter.getType() == Converter.TEMPORAL_CONVERTER);
- }
-
- @Override
- protected void setValue_(Boolean value) {
- if (value.booleanValue()) {
- this.subject.setSpecifiedConverter(Converter.TEMPORAL_CONVERTER);
- }
- }
- };
- }
-
- protected WritablePropertyValueModel<Boolean> buildEclipseLinkConverterBooleanHolder() {
- return new PropertyAspectAdapter<IdMapping, Boolean>(getSubjectHolder(), ConvertibleMapping.SPECIFIED_CONVERTER_PROPERTY) {
- @Override
- protected Boolean buildValue_() {
- Converter converter = this.subject.getSpecifiedConverter();
- if (converter == null) {
- return Boolean.FALSE;
- }
- return Boolean.valueOf(converter.getType() == Convert.ECLIPSE_LINK_CONVERTER);
- }
-
- @Override
- protected void setValue_(Boolean value) {
- if (value.booleanValue()) {
- this.subject.setSpecifiedConverter(Convert.ECLIPSE_LINK_CONVERTER);
- }
- }
- };
- }
-
- protected PropertyValueModel<Converter> buildSpecifiedConverterHolder() {
- return new PropertyAspectAdapter<IdMapping, Converter>(getSubjectHolder(), ConvertibleMapping.SPECIFIED_CONVERTER_PROPERTY) {
- @Override
- protected Converter buildValue_() {
- return this.subject.getSpecifiedConverter();
- }
- };
- }
-
- protected PropertyValueModel<TemporalConverter> buildTemporalConverterHolder(PropertyValueModel<Converter> converterHolder) {
- return new TransformationPropertyValueModel<Converter, TemporalConverter>(converterHolder) {
- @Override
- protected TemporalConverter transform_(Converter converter) {
- return (converter != null && converter.getType() == Converter.TEMPORAL_CONVERTER) ? (TemporalConverter) converter : null;
- }
- };
- }
-
-
- protected PropertyValueModel<Mutable> buildMutableHolder() {
- return new PropertyAspectAdapter<IdMapping, Mutable>(getSubjectHolder()) {
- @Override
- protected Mutable buildValue_() {
- return ((EclipseLinkIdMapping) this.subject).getMutable();
- }
- };
- }
-} \ No newline at end of file
diff --git a/jpa/plugins/org.eclipse.jpt.eclipselink.ui/src/org/eclipse/jpt/eclipselink/ui/internal/mappings/details/EclipseLinkManyToManyMappingComposite.java b/jpa/plugins/org.eclipse.jpt.eclipselink.ui/src/org/eclipse/jpt/eclipselink/ui/internal/mappings/details/EclipseLinkManyToManyMappingComposite.java
deleted file mode 100644
index 79cff76f23..0000000000
--- a/jpa/plugins/org.eclipse.jpt.eclipselink.ui/src/org/eclipse/jpt/eclipselink/ui/internal/mappings/details/EclipseLinkManyToManyMappingComposite.java
+++ /dev/null
@@ -1,133 +0,0 @@
-/*******************************************************************************
- * Copyright (c) 2006, 2009 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.
- *
- * Contributors:
- * Oracle - initial API and implementation
- ******************************************************************************/
-package org.eclipse.jpt.eclipselink.ui.internal.mappings.details;
-
-import org.eclipse.jpt.core.context.Cascade;
-import org.eclipse.jpt.core.context.ManyToManyMapping;
-import org.eclipse.jpt.core.context.ManyToManyRelationshipReference;
-import org.eclipse.jpt.eclipselink.core.context.EclipseLinkRelationshipMapping;
-import org.eclipse.jpt.eclipselink.core.context.JoinFetch;
-import org.eclipse.jpt.ui.WidgetFactory;
-import org.eclipse.jpt.ui.details.JpaComposite;
-import org.eclipse.jpt.ui.internal.mappings.details.CascadeComposite;
-import org.eclipse.jpt.ui.internal.mappings.details.FetchTypeComposite;
-import org.eclipse.jpt.ui.internal.mappings.details.ManyToManyJoiningStrategyPane;
-import org.eclipse.jpt.ui.internal.mappings.details.OrderingComposite;
-import org.eclipse.jpt.ui.internal.mappings.details.TargetEntityComposite;
-import org.eclipse.jpt.ui.internal.widgets.FormPane;
-import org.eclipse.jpt.utility.internal.model.value.PropertyAspectAdapter;
-import org.eclipse.jpt.utility.internal.model.value.TransformationPropertyValueModel;
-import org.eclipse.jpt.utility.model.value.PropertyValueModel;
-import org.eclipse.swt.widgets.Composite;
-
-/**
- * Here the layout of this pane:
- * <pre>
- * -----------------------------------------------------------------------------
- * | ------------------------------------------------------------------------- |
- * | | | |
- * | | TargetEntityComposite | |
- * | | | |
- * | ------------------------------------------------------------------------- |
- * | ------------------------------------------------------------------------- |
- * | | | |
- * | | JoiningStrategyComposite | |
- * | | | |
- * | ------------------------------------------------------------------------- |
- * | ------------------------------------------------------------------------- |
- * | | | |
- * | | FetchTypeComposite | |
- * | | | |
- * | ------------------------------------------------------------------------- |
- * | ------------------------------------------------------------------------- |
- * | | | |
- * | | CascadeComposite | |
- * | | | |
- * | ------------------------------------------------------------------------- |
- * | ------------------------------------------------------------------------- |
- * | | | |
- * | | OrderingComposite | |
- * | | | |
- * | ------------------------------------------------------------------------- |
- * -----------------------------------------------------------------------------</pre>
- *
- * @see {@link ManyToManyMapping}
- * @see {@link BaseJpaUiFactory} - The factory creating this pane
- * @see {@link TargetEntityComposite}
- * @see {@link ManyToManyJoiningStrategyPane}
- * @see {@link FetchTypeComposite}
- * @see {@link CascadeComposite}
- * @see {@link OrderingComposite}
- *
- * @version 2.1
- * @since 2.1
- */
-public class EclipseLinkManyToManyMappingComposite
- extends FormPane<ManyToManyMapping>
- implements JpaComposite
-{
- /**
- * Creates a new <code>ManyToManyMappingComposite</code>.
- *
- * @param subjectHolder The holder of the subject <code>IManyToManyMapping</code>
- * @param parent The parent container
- * @param widgetFactory The factory used to create various common widgets
- */
- public EclipseLinkManyToManyMappingComposite(PropertyValueModel<? extends ManyToManyMapping> subjectHolder,
- Composite parent,
- WidgetFactory widgetFactory) {
-
- super(subjectHolder, parent, widgetFactory);
- }
-
- @Override
- protected void initializeLayout(Composite container) {
- int groupBoxMargin = getGroupBoxMargin();
-
- new TargetEntityComposite(this, addPane(container, groupBoxMargin));
- new ManyToManyJoiningStrategyPane(this, buildJoiningHolder(), container);
- new FetchTypeComposite(this, addPane(container, groupBoxMargin));
- new JoinFetchComposite(this, buildJoinFetchableHolder(), addPane(container, groupBoxMargin));
- new CascadeComposite(this, buildCascadeHolder(), addSubPane(container, 5));
- new OrderingComposite(this, container);
- }
-
- protected Composite addPane(Composite container, int groupBoxMargin) {
- return addSubPane(container, 0, groupBoxMargin, 0, groupBoxMargin);
- }
-
- protected PropertyValueModel<ManyToManyRelationshipReference> buildJoiningHolder() {
- return new TransformationPropertyValueModel<ManyToManyMapping, ManyToManyRelationshipReference>(
- getSubjectHolder()) {
- @Override
- protected ManyToManyRelationshipReference transform_(ManyToManyMapping value) {
- return value.getRelationshipReference();
- }
- };
- }
-
- protected PropertyValueModel<Cascade> buildCascadeHolder() {
- return new TransformationPropertyValueModel<ManyToManyMapping, Cascade>(getSubjectHolder()) {
- @Override
- protected Cascade transform_(ManyToManyMapping value) {
- return value.getCascade();
- }
- };
- }
-
- protected PropertyValueModel<JoinFetch> buildJoinFetchableHolder() {
- return new PropertyAspectAdapter<ManyToManyMapping, JoinFetch>(getSubjectHolder()) {
- @Override
- protected JoinFetch buildValue_() {
- return ((EclipseLinkRelationshipMapping) this.subject).getJoinFetch();
- }
- };
- }
-} \ No newline at end of file
diff --git a/jpa/plugins/org.eclipse.jpt.eclipselink.ui/src/org/eclipse/jpt/eclipselink/ui/internal/mappings/details/EclipseLinkManyToOneMappingComposite.java b/jpa/plugins/org.eclipse.jpt.eclipselink.ui/src/org/eclipse/jpt/eclipselink/ui/internal/mappings/details/EclipseLinkManyToOneMappingComposite.java
deleted file mode 100644
index 37631e8814..0000000000
--- a/jpa/plugins/org.eclipse.jpt.eclipselink.ui/src/org/eclipse/jpt/eclipselink/ui/internal/mappings/details/EclipseLinkManyToOneMappingComposite.java
+++ /dev/null
@@ -1,132 +0,0 @@
-/*******************************************************************************
- * Copyright (c) 2006, 2009 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.
- *
- * Contributors:
- * Oracle - initial API and implementation
- ******************************************************************************/
-package org.eclipse.jpt.eclipselink.ui.internal.mappings.details;
-
-import org.eclipse.jpt.core.context.Cascade;
-import org.eclipse.jpt.core.context.ManyToOneMapping;
-import org.eclipse.jpt.core.context.ManyToOneRelationshipReference;
-import org.eclipse.jpt.eclipselink.core.context.EclipseLinkRelationshipMapping;
-import org.eclipse.jpt.eclipselink.core.context.JoinFetch;
-import org.eclipse.jpt.ui.WidgetFactory;
-import org.eclipse.jpt.ui.details.JpaComposite;
-import org.eclipse.jpt.ui.internal.mappings.details.CascadeComposite;
-import org.eclipse.jpt.ui.internal.mappings.details.FetchTypeComposite;
-import org.eclipse.jpt.ui.internal.mappings.details.ManyToOneJoiningStrategyPane;
-import org.eclipse.jpt.ui.internal.mappings.details.OptionalComposite;
-import org.eclipse.jpt.ui.internal.mappings.details.TargetEntityComposite;
-import org.eclipse.jpt.ui.internal.widgets.FormPane;
-import org.eclipse.jpt.utility.internal.model.value.PropertyAspectAdapter;
-import org.eclipse.jpt.utility.internal.model.value.TransformationPropertyValueModel;
-import org.eclipse.jpt.utility.model.value.PropertyValueModel;
-import org.eclipse.swt.widgets.Composite;
-
-/**
- * Here the layout of this pane:
- * <pre>
- * -----------------------------------------------------------------------------
- * | ------------------------------------------------------------------------- |
- * | | | |
- * | | TargetEntityComposite | |
- * | | | |
- * | ------------------------------------------------------------------------- |
- * | ------------------------------------------------------------------------- |
- * | | | |
- * | | JoiningStrategyComposite | |
- * | | | |
- * | ------------------------------------------------------------------------- |
- * | ------------------------------------------------------------------------- |
- * | | | |
- * | | FetchTypeComposite | |
- * | | | |
- * | ------------------------------------------------------------------------- |
- * | ------------------------------------------------------------------------- |
- * | | | |
- * | | OptionalComposite | |
- * | | | |
- * | ------------------------------------------------------------------------- |
- * | ------------------------------------------------------------------------- |
- * | | | |
- * | | CascadeComposite | |
- * | | | |
- * | ------------------------------------------------------------------------- |
- * -----------------------------------------------------------------------------</pre>
- *
- * @see {@link ManyToOneMapping}
- * @see {@link BaseJpaUiFactory} - The factory creating this pane
- * @see {@link TargetEntityComposite}
- * @see {@link ManyToOneJoiningStrategyPane}
- * @see {@link FetchTypeComposite}
- * @see {@link OptionalComposite}
- * @see {@link CascadeComposite}
- *
- * @version 2.1
- * @since 2.1
- */
-public class EclipseLinkManyToOneMappingComposite extends FormPane<ManyToOneMapping>
- implements JpaComposite
-{
- /**
- * Creates a new <code>EclipseLinkManyToOneMappingComposite</code>.
- *
- * @param subjectHolder The holder of the subject <code>ManyToOneMapping</code>
- * @param parent The parent container
- * @param widgetFactory The factory used to create various common widgets
- */
- public EclipseLinkManyToOneMappingComposite(PropertyValueModel<? extends ManyToOneMapping> subjectHolder,
- Composite parent,
- WidgetFactory widgetFactory) {
-
- super(subjectHolder, parent, widgetFactory);
- }
-
- @Override
- protected void initializeLayout(Composite container) {
- int groupBoxMargin = getGroupBoxMargin();
-
- new TargetEntityComposite(this, addPane(container, groupBoxMargin));
- new ManyToOneJoiningStrategyPane(this, buildJoiningHolder(), container);
- new FetchTypeComposite(this, addPane(container, groupBoxMargin));
- new JoinFetchComposite(this, buildJoinFetchableHolder(), addPane(container, groupBoxMargin));
- new OptionalComposite(this, addPane(container, groupBoxMargin));
- new CascadeComposite(this, buildCascadeHolder(), addSubPane(container, 5));
- }
-
- protected Composite addPane(Composite container, int groupBoxMargin) {
- return addSubPane(container, 0, groupBoxMargin, 0, groupBoxMargin);
- }
-
- protected PropertyValueModel<ManyToOneRelationshipReference> buildJoiningHolder() {
- return new TransformationPropertyValueModel<ManyToOneMapping, ManyToOneRelationshipReference>(
- getSubjectHolder()) {
- @Override
- protected ManyToOneRelationshipReference transform_(ManyToOneMapping value) {
- return value.getRelationshipReference();
- }
- };
- }
-
- protected PropertyValueModel<JoinFetch> buildJoinFetchableHolder() {
- return new PropertyAspectAdapter<ManyToOneMapping, JoinFetch>(getSubjectHolder()) {
- @Override
- protected JoinFetch buildValue_() {
- return ((EclipseLinkRelationshipMapping) this.subject).getJoinFetch();
- }
- };
- }
-
- protected PropertyValueModel<Cascade> buildCascadeHolder() {
- return new TransformationPropertyValueModel<ManyToOneMapping, Cascade>(getSubjectHolder()) {
- @Override
- protected Cascade transform_(ManyToOneMapping value) {
- return value.getCascade();
- }
- };
- }
-}
diff --git a/jpa/plugins/org.eclipse.jpt.eclipselink.ui/src/org/eclipse/jpt/eclipselink/ui/internal/mappings/details/EclipseLinkMappedSuperclassAdvancedComposite.java b/jpa/plugins/org.eclipse.jpt.eclipselink.ui/src/org/eclipse/jpt/eclipselink/ui/internal/mappings/details/EclipseLinkMappedSuperclassAdvancedComposite.java
deleted file mode 100644
index 007b8f0844..0000000000
--- a/jpa/plugins/org.eclipse.jpt.eclipselink.ui/src/org/eclipse/jpt/eclipselink/ui/internal/mappings/details/EclipseLinkMappedSuperclassAdvancedComposite.java
+++ /dev/null
@@ -1,70 +0,0 @@
-/*******************************************************************************
- * Copyright (c) 2008 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.
- *
- * Contributors:
- * Oracle - initial API and implementation
- ******************************************************************************/
-package org.eclipse.jpt.eclipselink.ui.internal.mappings.details;
-
-import org.eclipse.jpt.core.context.MappedSuperclass;
-import org.eclipse.jpt.eclipselink.core.context.ChangeTracking;
-import org.eclipse.jpt.eclipselink.core.context.Customizer;
-import org.eclipse.jpt.eclipselink.core.context.EclipseLinkMappedSuperclass;
-import org.eclipse.jpt.eclipselink.core.context.ReadOnly;
-import org.eclipse.jpt.eclipselink.ui.internal.mappings.EclipseLinkUiMappingsMessages;
-import org.eclipse.jpt.ui.internal.widgets.FormPane;
-import org.eclipse.jpt.utility.internal.model.value.PropertyAspectAdapter;
-import org.eclipse.jpt.utility.model.value.PropertyValueModel;
-import org.eclipse.swt.widgets.Composite;
-
-public class EclipseLinkMappedSuperclassAdvancedComposite extends FormPane<MappedSuperclass> {
-
- public EclipseLinkMappedSuperclassAdvancedComposite(
- FormPane<? extends MappedSuperclass> parentPane,
- Composite parent) {
-
- super(parentPane, parent, false);
- }
-
- @Override
- protected void initializeLayout(Composite container) {
- container = addCollapsableSection(
- container,
- EclipseLinkUiMappingsMessages.EclipseLinkTypeMappingComposite_advanced
- );
-
- new ReadOnlyComposite(this, buildReadOnlyHolder(), container);
- new CustomizerComposite(this, buildCustomizerHolder(), container);
- new ChangeTrackingComposite(this, buildChangeTrackingHolder(), container);
- }
-
- private PropertyValueModel<ReadOnly> buildReadOnlyHolder() {
- return new PropertyAspectAdapter<MappedSuperclass, ReadOnly>(getSubjectHolder()) {
- @Override
- protected ReadOnly buildValue_() {
- return ((EclipseLinkMappedSuperclass) this.subject).getReadOnly();
- }
- };
- }
-
- private PropertyValueModel<Customizer> buildCustomizerHolder() {
- return new PropertyAspectAdapter<MappedSuperclass, Customizer>(getSubjectHolder()) {
- @Override
- protected Customizer buildValue_() {
- return ((EclipseLinkMappedSuperclass) this.subject).getCustomizer();
- }
- };
- }
-
- private PropertyValueModel<ChangeTracking> buildChangeTrackingHolder() {
- return new PropertyAspectAdapter<MappedSuperclass, ChangeTracking>(getSubjectHolder()) {
- @Override
- protected ChangeTracking buildValue_() {
- return ((EclipseLinkMappedSuperclass) this.subject).getChangeTracking();
- }
- };
- }
-}
diff --git a/jpa/plugins/org.eclipse.jpt.eclipselink.ui/src/org/eclipse/jpt/eclipselink/ui/internal/mappings/details/EclipseLinkOneToManyJoiningStrategyPane.java b/jpa/plugins/org.eclipse.jpt.eclipselink.ui/src/org/eclipse/jpt/eclipselink/ui/internal/mappings/details/EclipseLinkOneToManyJoiningStrategyPane.java
deleted file mode 100644
index c2689cddc4..0000000000
--- a/jpa/plugins/org.eclipse.jpt.eclipselink.ui/src/org/eclipse/jpt/eclipselink/ui/internal/mappings/details/EclipseLinkOneToManyJoiningStrategyPane.java
+++ /dev/null
@@ -1,48 +0,0 @@
-/*******************************************************************************
- * Copyright (c) 2009 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
- *
- * Contributors:
- * Oracle - initial API and implementation
- *******************************************************************************/
-package org.eclipse.jpt.eclipselink.ui.internal.mappings.details;
-
-import org.eclipse.jpt.eclipselink.core.context.EclipseLinkOneToManyRelationshipReference;
-import org.eclipse.jpt.ui.internal.mappings.JptUiMappingsMessages;
-import org.eclipse.jpt.ui.internal.mappings.details.JoinColumnJoiningStrategyPane;
-import org.eclipse.jpt.ui.internal.mappings.details.JoinTableJoiningStrategyPane;
-import org.eclipse.jpt.ui.internal.mappings.details.MappedByJoiningStrategyPane;
-import org.eclipse.jpt.ui.internal.widgets.FormPane;
-import org.eclipse.jpt.utility.model.value.PropertyValueModel;
-import org.eclipse.swt.widgets.Composite;
-import org.eclipse.swt.widgets.Group;
-
-public class EclipseLinkOneToManyJoiningStrategyPane
- extends FormPane<EclipseLinkOneToManyRelationshipReference>
-{
- public EclipseLinkOneToManyJoiningStrategyPane(
- FormPane<?> parentPane,
- PropertyValueModel<EclipseLinkOneToManyRelationshipReference> subjectHolder,
- Composite parent) {
- super(parentPane, subjectHolder, parent);
- }
-
-
- @Override
- protected void initializeLayout(Composite container) {
- // joining strategy group pane
- Group groupPane = addTitledGroup(
- container,
- JptUiMappingsMessages.Joining_title
- );
-
- new MappedByJoiningStrategyPane(this, groupPane);
-
- new JoinColumnJoiningStrategyPane(this, groupPane);
-
- new JoinTableJoiningStrategyPane(this, groupPane);
- }
-}
diff --git a/jpa/plugins/org.eclipse.jpt.eclipselink.ui/src/org/eclipse/jpt/eclipselink/ui/internal/mappings/details/EclipseLinkOneToManyMappingComposite.java b/jpa/plugins/org.eclipse.jpt.eclipselink.ui/src/org/eclipse/jpt/eclipselink/ui/internal/mappings/details/EclipseLinkOneToManyMappingComposite.java
deleted file mode 100644
index eafc0d01ae..0000000000
--- a/jpa/plugins/org.eclipse.jpt.eclipselink.ui/src/org/eclipse/jpt/eclipselink/ui/internal/mappings/details/EclipseLinkOneToManyMappingComposite.java
+++ /dev/null
@@ -1,148 +0,0 @@
-/*******************************************************************************
- * Copyright (c) 2008, 2009 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.
- *
- * Contributors:
- * Oracle - initial API and implementation
- ******************************************************************************/
-package org.eclipse.jpt.eclipselink.ui.internal.mappings.details;
-
-import org.eclipse.jpt.core.context.Cascade;
-import org.eclipse.jpt.core.context.OneToManyMapping;
-import org.eclipse.jpt.eclipselink.core.context.EclipseLinkOneToManyMapping;
-import org.eclipse.jpt.eclipselink.core.context.EclipseLinkOneToManyRelationshipReference;
-import org.eclipse.jpt.eclipselink.core.context.JoinFetch;
-import org.eclipse.jpt.eclipselink.core.context.PrivateOwned;
-import org.eclipse.jpt.ui.WidgetFactory;
-import org.eclipse.jpt.ui.details.JpaComposite;
-import org.eclipse.jpt.ui.internal.mappings.details.CascadeComposite;
-import org.eclipse.jpt.ui.internal.mappings.details.FetchTypeComposite;
-import org.eclipse.jpt.ui.internal.mappings.details.OrderingComposite;
-import org.eclipse.jpt.ui.internal.mappings.details.TargetEntityComposite;
-import org.eclipse.jpt.ui.internal.widgets.FormPane;
-import org.eclipse.jpt.utility.internal.model.value.PropertyAspectAdapter;
-import org.eclipse.jpt.utility.internal.model.value.TransformationPropertyValueModel;
-import org.eclipse.jpt.utility.model.value.PropertyValueModel;
-import org.eclipse.swt.widgets.Composite;
-
-/**
- * Here the layout of this pane:
- * <pre>
- * -----------------------------------------------------------------------------
- * | ------------------------------------------------------------------------- |
- * | | | |
- * | | TargetEntityComposite | |
- * | | | |
- * | ------------------------------------------------------------------------- |
- * | ------------------------------------------------------------------------- |
- * | | | |
- * | | FetchTypeComposite | |
- * | | | |
- * | ------------------------------------------------------------------------- |
- * | ------------------------------------------------------------------------- |
- * | | | |
- * | | MappedByPane | |
- * | | | |
- * | ------------------------------------------------------------------------- |
- * | ------------------------------------------------------------------------- |
- * | | | |
- * | | OptionalComposite | |
- * | | | |
- * | ------------------------------------------------------------------------- |
- * | ------------------------------------------------------------------------- |
- * | | | |
- * | | CascadeComposite | |
- * | | | |
- * | ------------------------------------------------------------------------- |
- * | ------------------------------------------------------------------------- |
- * | | | |
- * | | JoinColumnComposite | |
- * | | | |
- * | ------------------------------------------------------------------------- |
- * -----------------------------------------------------------------------------</pre>
- *
- * @see OneToOneMapping
- * @see BaseJpaUiFactory - The factory creating this pane
- * @see CascadeComposite
- * @see FetchTypeComposite
- * @see JoinColumnComposite
- * @see MappedByPane
- * @see OptionalComposite
- * @see TargetEntityComposite
- *
- * @version 2.1
- * @since 2.1
- */
-public class EclipseLinkOneToManyMappingComposite
- extends FormPane<EclipseLinkOneToManyMapping>
- implements JpaComposite
-{
- /**
- * Creates a new <code>EclipselinkOneToManyMappingComposite</code>.
- *
- * @param subjectHolder The holder of the subject <code>IOneToManyMapping</code>
- * @param parent The parent container
- * @param widgetFactory The factory used to create various common widgets
- */
- public EclipseLinkOneToManyMappingComposite(PropertyValueModel<? extends EclipseLinkOneToManyMapping> subjectHolder,
- Composite parent,
- WidgetFactory widgetFactory) {
-
- super(subjectHolder, parent, widgetFactory);
- }
-
- @Override
- protected void initializeLayout(Composite container) {
- int groupBoxMargin = getGroupBoxMargin();
-
- new TargetEntityComposite(this, addPane(container, groupBoxMargin));
- new EclipseLinkOneToManyJoiningStrategyPane(this, buildJoiningHolder(), container);
- new FetchTypeComposite(this, addPane(container, groupBoxMargin));
- new JoinFetchComposite(this, buildJoinFetchableHolder(), addPane(container, groupBoxMargin));
- new PrivateOwnedComposite(this, buildPrivateOwnableHolder(), addPane(container, groupBoxMargin));
- new CascadeComposite(this, buildCascadeHolder(), addSubPane(container, 5));
- new OrderingComposite(this, container);
- }
-
- protected Composite addPane(Composite container, int groupBoxMargin) {
- return addSubPane(container, 0, groupBoxMargin, 0, groupBoxMargin);
- }
-
- protected PropertyValueModel<EclipseLinkOneToManyRelationshipReference> buildJoiningHolder() {
- return new TransformationPropertyValueModel<EclipseLinkOneToManyMapping, EclipseLinkOneToManyRelationshipReference>(getSubjectHolder()) {
- @Override
- protected EclipseLinkOneToManyRelationshipReference transform_(EclipseLinkOneToManyMapping value) {
- return value.getRelationshipReference();
- }
- };
- }
-
- protected PropertyValueModel<PrivateOwned> buildPrivateOwnableHolder() {
- return new PropertyAspectAdapter<OneToManyMapping, PrivateOwned>(getSubjectHolder()) {
- @Override
- protected PrivateOwned buildValue_() {
- return ((EclipseLinkOneToManyMapping) this.subject).getPrivateOwned();
- }
- };
- }
-
- protected PropertyValueModel<JoinFetch> buildJoinFetchableHolder() {
- return new PropertyAspectAdapter<OneToManyMapping, JoinFetch>(getSubjectHolder()) {
- @Override
- protected JoinFetch buildValue_() {
- return ((EclipseLinkOneToManyMapping) this.subject).getJoinFetch();
- }
- };
- }
-
- protected PropertyValueModel<Cascade> buildCascadeHolder() {
- return new TransformationPropertyValueModel<OneToManyMapping, Cascade>(getSubjectHolder()) {
- @Override
- protected Cascade transform_(OneToManyMapping value) {
- return value.getCascade();
- }
- };
- }
-} \ No newline at end of file
diff --git a/jpa/plugins/org.eclipse.jpt.eclipselink.ui/src/org/eclipse/jpt/eclipselink/ui/internal/mappings/details/EclipseLinkOneToOneMappingComposite.java b/jpa/plugins/org.eclipse.jpt.eclipselink.ui/src/org/eclipse/jpt/eclipselink/ui/internal/mappings/details/EclipseLinkOneToOneMappingComposite.java
deleted file mode 100644
index 52a4757d29..0000000000
--- a/jpa/plugins/org.eclipse.jpt.eclipselink.ui/src/org/eclipse/jpt/eclipselink/ui/internal/mappings/details/EclipseLinkOneToOneMappingComposite.java
+++ /dev/null
@@ -1,103 +0,0 @@
-/*******************************************************************************
- * Copyright (c) 2008, 2009 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.
- *
- * Contributors:
- * Oracle - initial API and implementation
- ******************************************************************************/
-package org.eclipse.jpt.eclipselink.ui.internal.mappings.details;
-
-import org.eclipse.jpt.core.context.Cascade;
-import org.eclipse.jpt.core.context.OneToOneMapping;
-import org.eclipse.jpt.core.context.OneToOneRelationshipReference;
-import org.eclipse.jpt.eclipselink.core.context.EclipseLinkOneToOneMapping;
-import org.eclipse.jpt.eclipselink.core.context.JoinFetch;
-import org.eclipse.jpt.eclipselink.core.context.PrivateOwned;
-import org.eclipse.jpt.ui.WidgetFactory;
-import org.eclipse.jpt.ui.details.JpaComposite;
-import org.eclipse.jpt.ui.internal.mappings.details.CascadeComposite;
-import org.eclipse.jpt.ui.internal.mappings.details.FetchTypeComposite;
-import org.eclipse.jpt.ui.internal.mappings.details.OneToOneJoiningStrategyPane;
-import org.eclipse.jpt.ui.internal.mappings.details.OptionalComposite;
-import org.eclipse.jpt.ui.internal.mappings.details.TargetEntityComposite;
-import org.eclipse.jpt.ui.internal.widgets.FormPane;
-import org.eclipse.jpt.utility.internal.model.value.PropertyAspectAdapter;
-import org.eclipse.jpt.utility.internal.model.value.TransformationPropertyValueModel;
-import org.eclipse.jpt.utility.model.value.PropertyValueModel;
-import org.eclipse.swt.widgets.Composite;
-
-
-public class EclipseLinkOneToOneMappingComposite extends FormPane<OneToOneMapping>
- implements JpaComposite
-{
- /**
- * Creates a new <code>EclipselinkOneToOneMappingComposite</code>.
- *
- * @param subjectHolder The holder of the subject <code>IOneToOneMapping</code>
- * @param parent The parent container
- * @param widgetFactory The factory used to create various common widgets
- */
- public EclipseLinkOneToOneMappingComposite(PropertyValueModel<? extends OneToOneMapping> subjectHolder,
- Composite parent,
- WidgetFactory widgetFactory) {
-
- super(subjectHolder, parent, widgetFactory);
- }
-
- @Override
- protected void initializeLayout(Composite container) {
- int groupBoxMargin = getGroupBoxMargin();
-
- new TargetEntityComposite(this, addPane(container, groupBoxMargin));
- new OneToOneJoiningStrategyPane(this, buildJoiningHolder(), container);
- new FetchTypeComposite(this, addPane(container, groupBoxMargin));
- new JoinFetchComposite(this, buildJoinFetchableHolder(), addPane(container, groupBoxMargin));
- new OptionalComposite(this, addPane(container, groupBoxMargin));
- new PrivateOwnedComposite(this, buildPrivateOwnableHolder(), addPane(container, groupBoxMargin));
- new CascadeComposite(this, buildCascadeHolder(), addSubPane(container, 5));
- }
-
- protected Composite addPane(Composite container, int groupBoxMargin) {
- return addSubPane(container, 0, groupBoxMargin, 0, groupBoxMargin);
- }
-
- protected PropertyValueModel<OneToOneRelationshipReference> buildJoiningHolder() {
- return new TransformationPropertyValueModel<OneToOneMapping, OneToOneRelationshipReference>(
- getSubjectHolder()) {
- @Override
- protected OneToOneRelationshipReference transform_(OneToOneMapping value) {
- return value.getRelationshipReference();
- }
- };
- }
-
- protected PropertyValueModel<JoinFetch> buildJoinFetchableHolder() {
- return new PropertyAspectAdapter<OneToOneMapping, JoinFetch>(getSubjectHolder()) {
- @Override
- protected JoinFetch buildValue_() {
- return ((EclipseLinkOneToOneMapping) this.subject).getJoinFetch();
- }
- };
- }
-
- protected PropertyValueModel<PrivateOwned> buildPrivateOwnableHolder() {
- return new PropertyAspectAdapter<OneToOneMapping, PrivateOwned>(getSubjectHolder()) {
- @Override
- protected PrivateOwned buildValue_() {
- return ((EclipseLinkOneToOneMapping) this.subject).getPrivateOwned();
- }
- };
- }
-
- protected PropertyValueModel<Cascade> buildCascadeHolder() {
- return new TransformationPropertyValueModel<OneToOneMapping, Cascade>(getSubjectHolder()) {
-
- @Override
- protected Cascade transform_(OneToOneMapping value) {
- return value.getCascade();
- }
- };
- }
-} \ No newline at end of file
diff --git a/jpa/plugins/org.eclipse.jpt.eclipselink.ui/src/org/eclipse/jpt/eclipselink/ui/internal/mappings/details/EclipseLinkTransformationMappingUiProvider.java b/jpa/plugins/org.eclipse.jpt.eclipselink.ui/src/org/eclipse/jpt/eclipselink/ui/internal/mappings/details/EclipseLinkTransformationMappingUiProvider.java
deleted file mode 100644
index 0d768daabe..0000000000
--- a/jpa/plugins/org.eclipse.jpt.eclipselink.ui/src/org/eclipse/jpt/eclipselink/ui/internal/mappings/details/EclipseLinkTransformationMappingUiProvider.java
+++ /dev/null
@@ -1,43 +0,0 @@
-/*******************************************************************************
- * Copyright (c) 2008, 2009 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.
- *
- * Contributors:
- * Oracle - initial API and implementation
- ******************************************************************************/
-package org.eclipse.jpt.eclipselink.ui.internal.mappings.details;
-
-import org.eclipse.jpt.eclipselink.core.EclipseLinkMappingKeys;
-import org.eclipse.jpt.eclipselink.core.context.TransformationMapping;
-import org.eclipse.jpt.eclipselink.ui.internal.mappings.EclipseLinkUiMappingsMessages;
-import org.eclipse.jpt.ui.JptUiPlugin;
-import org.eclipse.jpt.ui.details.AttributeMappingUiProvider;
-import org.eclipse.jpt.ui.internal.JptUiIcons;
-import org.eclipse.swt.graphics.Image;
-
-public abstract class EclipseLinkTransformationMappingUiProvider<T extends TransformationMapping>
- implements AttributeMappingUiProvider<T>
-{
-
- protected EclipseLinkTransformationMappingUiProvider() {
- super();
- }
-
- public Image getImage() {
- return JptUiPlugin.getImage(JptUiIcons.JPA_CONTENT);
- }
-
- public String getLabel() {
- return EclipseLinkUiMappingsMessages.TransformationMappingUiProvider_label;
- }
-
- public String getLinkLabel() {
- return EclipseLinkUiMappingsMessages.TransformationMappingUiProvider_linkLabel;
- }
-
- public String getKey() {
- return EclipseLinkMappingKeys.TRANSFORMATION_ATTRIBUTE_MAPPING_KEY;
- }
-}
diff --git a/jpa/plugins/org.eclipse.jpt.eclipselink.ui/src/org/eclipse/jpt/eclipselink/ui/internal/mappings/details/EclipseLinkVariableOneToOneMappingUiProvider.java b/jpa/plugins/org.eclipse.jpt.eclipselink.ui/src/org/eclipse/jpt/eclipselink/ui/internal/mappings/details/EclipseLinkVariableOneToOneMappingUiProvider.java
deleted file mode 100644
index 58ce196648..0000000000
--- a/jpa/plugins/org.eclipse.jpt.eclipselink.ui/src/org/eclipse/jpt/eclipselink/ui/internal/mappings/details/EclipseLinkVariableOneToOneMappingUiProvider.java
+++ /dev/null
@@ -1,42 +0,0 @@
-/*******************************************************************************
- * Copyright (c) 2009 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.
- *
- * Contributors:
- * Oracle - initial API and implementation
- ******************************************************************************/
-package org.eclipse.jpt.eclipselink.ui.internal.mappings.details;
-
-import org.eclipse.jpt.eclipselink.core.EclipseLinkMappingKeys;
-import org.eclipse.jpt.eclipselink.core.context.VariableOneToOneMapping;
-import org.eclipse.jpt.eclipselink.ui.internal.mappings.EclipseLinkUiMappingsMessages;
-import org.eclipse.jpt.ui.JptUiPlugin;
-import org.eclipse.jpt.ui.details.AttributeMappingUiProvider;
-import org.eclipse.jpt.ui.internal.JptUiIcons;
-import org.eclipse.swt.graphics.Image;
-
-public abstract class EclipseLinkVariableOneToOneMappingUiProvider<T extends VariableOneToOneMapping>
- implements AttributeMappingUiProvider<T>
-{
- protected EclipseLinkVariableOneToOneMappingUiProvider() {
- super();
- }
-
- public Image getImage() {
- return JptUiPlugin.getImage(JptUiIcons.JPA_CONTENT);
- }
-
- public String getLabel() {
- return EclipseLinkUiMappingsMessages.VariableOneToOneMappingUiProvider_label;
- }
-
- public String getLinkLabel() {
- return EclipseLinkUiMappingsMessages.VariableOneToOneMappingUiProvider_linkLabel;
- }
-
- public String getKey() {
- return EclipseLinkMappingKeys.VARIABLE_ONE_TO_ONE_ATTRIBUTE_MAPPING_KEY;
- }
-}
diff --git a/jpa/plugins/org.eclipse.jpt.eclipselink.ui/src/org/eclipse/jpt/eclipselink/ui/internal/mappings/details/EclipseLinkVersionMappingComposite.java b/jpa/plugins/org.eclipse.jpt.eclipselink.ui/src/org/eclipse/jpt/eclipselink/ui/internal/mappings/details/EclipseLinkVersionMappingComposite.java
deleted file mode 100644
index b23bfef90c..0000000000
--- a/jpa/plugins/org.eclipse.jpt.eclipselink.ui/src/org/eclipse/jpt/eclipselink/ui/internal/mappings/details/EclipseLinkVersionMappingComposite.java
+++ /dev/null
@@ -1,246 +0,0 @@
-/*******************************************************************************
- * Copyright (c) 2008, 2009 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.
- *
- * Contributors:
- * Oracle - initial API and implementation
- ******************************************************************************/
-package org.eclipse.jpt.eclipselink.ui.internal.mappings.details;
-
-import org.eclipse.jpt.core.context.Column;
-import org.eclipse.jpt.core.context.Converter;
-import org.eclipse.jpt.core.context.ConvertibleMapping;
-import org.eclipse.jpt.core.context.TemporalConverter;
-import org.eclipse.jpt.core.context.VersionMapping;
-import org.eclipse.jpt.eclipselink.core.context.Convert;
-import org.eclipse.jpt.eclipselink.core.context.EclipseLinkVersionMapping;
-import org.eclipse.jpt.eclipselink.core.context.Mutable;
-import org.eclipse.jpt.eclipselink.ui.internal.mappings.EclipseLinkUiMappingsMessages;
-import org.eclipse.jpt.ui.WidgetFactory;
-import org.eclipse.jpt.ui.details.JpaComposite;
-import org.eclipse.jpt.ui.internal.mappings.JptUiMappingsMessages;
-import org.eclipse.jpt.ui.internal.mappings.details.ColumnComposite;
-import org.eclipse.jpt.ui.internal.mappings.details.TemporalTypeComposite;
-import org.eclipse.jpt.ui.internal.widgets.FormPane;
-import org.eclipse.jpt.ui.internal.widgets.Pane;
-import org.eclipse.jpt.utility.internal.model.value.PropertyAspectAdapter;
-import org.eclipse.jpt.utility.internal.model.value.TransformationPropertyValueModel;
-import org.eclipse.jpt.utility.model.value.PropertyValueModel;
-import org.eclipse.jpt.utility.model.value.WritablePropertyValueModel;
-import org.eclipse.swt.layout.GridData;
-import org.eclipse.swt.layout.GridLayout;
-import org.eclipse.swt.widgets.Button;
-import org.eclipse.swt.widgets.Composite;
-
-/**
- * Here the layout of this pane:
- * <pre>
- * -----------------------------------------------------------------------------
- * | ------------------------------------------------------------------------- |
- * | | | |
- * | | ColumnComposite | |
- * | | | |
- * | ------------------------------------------------------------------------- |
- * | ------------------------------------------------------------------------- |
- * | | | |
- * | | MutableComposite | |
- * | | | |
- * | ------------------------------------------------------------------------- |
- * | ------------------------------------------------------------------------- |
- * | | | |
- * | | TemporalTypeComposite | |
- * | | | |
- * | ------------------------------------------------------------------------- |
- * -----------------------------------------------------------------------------</pre>
- *
- * @see VersionMapping
- * @see BaseJpaUiFactory - The factory creating this pane
- * @see ColumnComposite
- * @see TemporalTypeComposite
- *
- * @version 2.1
- * @since 2.1
- */
-public class EclipseLinkVersionMappingComposite extends FormPane<VersionMapping>
- implements JpaComposite
-{
- /**
- * Creates a new <code>VersionMappingComposite</code>.
- *
- * @param subjectHolder The holder of the subject <code>IVersionMapping</code>
- * @param parent The parent container
- * @param widgetFactory The factory used to create various common widgets
- */
- public EclipseLinkVersionMappingComposite(PropertyValueModel<? extends VersionMapping> subjectHolder,
- Composite parent,
- WidgetFactory widgetFactory) {
-
- super(subjectHolder, parent, widgetFactory);
- }
-
- protected PropertyValueModel<Column> buildColumnHolder() {
- return new TransformationPropertyValueModel<VersionMapping, Column>(getSubjectHolder()) {
- @Override
- protected Column transform_(VersionMapping value) {
- return value.getColumn();
- }
- };
- }
-
- @Override
- protected void initializeLayout(Composite container) {
- initializeGeneralPane(container);
- initializeTypePane(container);
- }
-
- protected void initializeGeneralPane(Composite container) {
- int groupBoxMargin = getGroupBoxMargin();
-
- // Column widgets
- new ColumnComposite(this, buildColumnHolder(), container);
-
- // Align the widgets under the ColumnComposite
- container = addSubPane(container, 0, groupBoxMargin, 0, groupBoxMargin);
-
- // Mutable widgets
- new MutableComposite(this, buildMutableHolder(), container);
- }
-
- protected void initializeTypePane(Composite container) {
-
- container = addCollapsableSection(
- container,
- JptUiMappingsMessages.TypeSection_type
- );
- ((GridLayout) container.getLayout()).numColumns = 2;
-
- // No converter
- Button noConverterButton = addRadioButton(
- container,
- JptUiMappingsMessages.TypeSection_default,
- buildNoConverterHolder(),
- null);
- ((GridData) noConverterButton.getLayoutData()).horizontalSpan = 2;
-
- PropertyValueModel<Converter> specifiedConverterHolder = buildSpecifiedConverterHolder();
- // Temporal
- addRadioButton(
- container,
- JptUiMappingsMessages.TypeSection_temporal,
- buildTemporalBooleanHolder(),
- null);
- registerSubPane(new TemporalTypeComposite(buildTemporalConverterHolder(specifiedConverterHolder), container, getWidgetFactory()));
-
- // EclipseLink Converter
- Button elConverterButton = addRadioButton(
- container,
- EclipseLinkUiMappingsMessages.TypeSection_converted,
- buildEclipseLinkConverterBooleanHolder(),
- null);
- ((GridData) elConverterButton.getLayoutData()).horizontalSpan = 2;
-
- Pane<Convert> convertComposite = buildConvertComposite(buildEclipseLinkConverterHolder(specifiedConverterHolder), container);
- GridData gridData = (GridData) convertComposite.getControl().getLayoutData();
- gridData.horizontalSpan = 2;
- gridData.horizontalIndent = 20;
- registerSubPane(convertComposite);
- }
-
- protected Pane<Convert> buildConvertComposite(PropertyValueModel<Convert> convertHolder, Composite container) {
- return new ConvertComposite(convertHolder, container, getWidgetFactory());
- }
-
- protected WritablePropertyValueModel<Boolean> buildNoConverterHolder() {
- return new PropertyAspectAdapter<VersionMapping, Boolean>(getSubjectHolder(), ConvertibleMapping.SPECIFIED_CONVERTER_PROPERTY) {
- @Override
- protected Boolean buildValue_() {
- return Boolean.valueOf(this.subject.getSpecifiedConverter() == null);
- }
-
- @Override
- protected void setValue_(Boolean value) {
- if (value.booleanValue()) {
- this.subject.setSpecifiedConverter(Converter.NO_CONVERTER);
- }
- }
- };
- }
-
- protected PropertyValueModel<Convert> buildEclipseLinkConverterHolder(PropertyValueModel<Converter> converterHolder) {
- return new TransformationPropertyValueModel<Converter, Convert>(converterHolder) {
- @Override
- protected Convert transform_(Converter converter) {
- return (converter != null && converter.getType() == Convert.ECLIPSE_LINK_CONVERTER) ? (Convert) converter : null;
- }
- };
- }
-
- protected WritablePropertyValueModel<Boolean> buildTemporalBooleanHolder() {
- return new PropertyAspectAdapter<VersionMapping, Boolean>(getSubjectHolder(), ConvertibleMapping.SPECIFIED_CONVERTER_PROPERTY) {
- @Override
- protected Boolean buildValue_() {
- Converter converter = this.subject.getSpecifiedConverter();
- if (converter == null) {
- return Boolean.FALSE;
- }
- return Boolean.valueOf(converter.getType() == Converter.TEMPORAL_CONVERTER);
- }
-
- @Override
- protected void setValue_(Boolean value) {
- if (value.booleanValue()) {
- this.subject.setSpecifiedConverter(Converter.TEMPORAL_CONVERTER);
- }
- }
- };
- }
-
- protected WritablePropertyValueModel<Boolean> buildEclipseLinkConverterBooleanHolder() {
- return new PropertyAspectAdapter<VersionMapping, Boolean>(getSubjectHolder(), ConvertibleMapping.SPECIFIED_CONVERTER_PROPERTY) {
- @Override
- protected Boolean buildValue_() {
- Converter converter = this.subject.getSpecifiedConverter();
- if (converter == null) {
- return Boolean.FALSE;
- }
- return Boolean.valueOf(converter.getType() == Convert.ECLIPSE_LINK_CONVERTER);
- }
-
- @Override
- protected void setValue_(Boolean value) {
- if (value.booleanValue()) {
- this.subject.setSpecifiedConverter(Convert.ECLIPSE_LINK_CONVERTER);
- }
- }
- };
- }
-
- protected PropertyValueModel<Converter> buildSpecifiedConverterHolder() {
- return new PropertyAspectAdapter<VersionMapping, Converter>(getSubjectHolder(), ConvertibleMapping.SPECIFIED_CONVERTER_PROPERTY) {
- @Override
- protected Converter buildValue_() {
- return this.subject.getSpecifiedConverter();
- }
- };
- }
-
- protected PropertyValueModel<TemporalConverter> buildTemporalConverterHolder(PropertyValueModel<Converter> converterHolder) {
- return new TransformationPropertyValueModel<Converter, TemporalConverter>(converterHolder) {
- @Override
- protected TemporalConverter transform_(Converter converter) {
- return (converter != null && converter.getType() == Converter.TEMPORAL_CONVERTER) ? (TemporalConverter) converter : null;
- }
- };
- }
-
- protected PropertyValueModel<Mutable> buildMutableHolder() {
- return new PropertyAspectAdapter<VersionMapping, Mutable>(getSubjectHolder()) {
- @Override
- protected Mutable buildValue_() {
- return ((EclipseLinkVersionMapping) this.subject).getMutable();
- }
- };
- }
-} \ No newline at end of file
diff --git a/jpa/plugins/org.eclipse.jpt.eclipselink.ui/src/org/eclipse/jpt/eclipselink/ui/internal/mappings/details/ExpiryComposite.java b/jpa/plugins/org.eclipse.jpt.eclipselink.ui/src/org/eclipse/jpt/eclipselink/ui/internal/mappings/details/ExpiryComposite.java
deleted file mode 100644
index 05f4cd5fd6..0000000000
--- a/jpa/plugins/org.eclipse.jpt.eclipselink.ui/src/org/eclipse/jpt/eclipselink/ui/internal/mappings/details/ExpiryComposite.java
+++ /dev/null
@@ -1,326 +0,0 @@
-/*******************************************************************************
- * Copyright (c) 2008 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
- *
- * Contributors: Oracle. - initial API and implementation
- *******************************************************************************/
-package org.eclipse.jpt.eclipselink.ui.internal.mappings.details;
-
-import org.eclipse.jpt.eclipselink.core.context.Caching;
-import org.eclipse.jpt.eclipselink.core.context.ExpiryTimeOfDay;
-import org.eclipse.jpt.eclipselink.ui.internal.mappings.EclipseLinkUiMappingsMessages;
-import org.eclipse.jpt.ui.internal.util.ControlEnabler;
-import org.eclipse.jpt.ui.internal.widgets.FormPane;
-import org.eclipse.jpt.ui.internal.widgets.IntegerCombo;
-import org.eclipse.jpt.utility.internal.StringConverter;
-import org.eclipse.jpt.utility.internal.model.value.PropertyAspectAdapter;
-import org.eclipse.jpt.utility.model.value.PropertyValueModel;
-import org.eclipse.jpt.utility.model.value.WritablePropertyValueModel;
-import org.eclipse.swt.custom.CCombo;
-import org.eclipse.swt.layout.GridData;
-import org.eclipse.swt.widgets.Button;
-import org.eclipse.swt.widgets.Composite;
-import org.eclipse.swt.widgets.Control;
-import org.eclipse.swt.widgets.DateTime;
-import org.eclipse.swt.widgets.Group;
-
-/**
- * Here is the layout of this pane:
- * <pre>
- * -----------------------------------------------------------------------------
- * | - Expiry -------------------------------------------------------------- | |
- * | | | |
- * | | o No expiry | |
- * | | ---------------- | |
- * | | o Time to live expiry Expire after | I |I| milliseconds | |
- * | | ---------------- | |
- * | | -------------------- | |
- * | | o Daily expiry Expire at | HH:MM:SS:AM/PM |I| | |
- * | | -------------------- | |
- * | ------------------------------------------------------------------------- |
- * -----------------------------------------------------------------------------</pre>
- *
- * @see EclipseLinkCaching
- * @see EclipseLinkExpiryTimeOfDay
- * @see CachingComposite - A container of this widget
- *
- * @version 2.1
- * @since 2.1
- */
-public class ExpiryComposite extends FormPane<Caching> {
-
- public ExpiryComposite(FormPane<? extends Caching> parentPane,
- Composite parent) {
-
- super(parentPane, parent);
- }
-
- @Override
- protected void initializeLayout(Composite container) {
- // Expiry group pane
- Group expiryGroupPane = addTitledGroup(
- container,
- EclipseLinkUiMappingsMessages.ExpiryComposite_expirySection,
- 2,
- null
- );
-
- // No Expiry radio button
- Button button = addRadioButton(
- expiryGroupPane,
- EclipseLinkUiMappingsMessages.ExpiryComposite_noExpiry,
- buildNoExpiryHolder(),
- null
- );
- GridData gridData = new GridData();
- gridData.horizontalSpan = 2;
- button.setLayoutData(gridData);
-
-
- // Time To Live Expiry radio button
- addRadioButton(
- expiryGroupPane,
- EclipseLinkUiMappingsMessages.ExpiryComposite_timeToLiveExpiry,
- buildExpiryHolder(),
- null
- );
-
- addTimeToLiveComposite(expiryGroupPane);
-
- // Daily Expiry radio button
- addRadioButton(
- expiryGroupPane,
- EclipseLinkUiMappingsMessages.ExpiryComposite_dailyExpiry,
- buildTimeOfDayExpiryBooleanHolder(),
- null
- );
-
- addTimeOfDayComposite(expiryGroupPane);
- }
-
- protected void addTimeToLiveComposite(Composite parent) {
- Composite container = this.addSubPane(parent, 3, 0, 10, 0, 0);
-
-
- Control expireAfterLabel = addUnmanagedLabel(
- container,
- EclipseLinkUiMappingsMessages.ExpiryComposite_timeToLiveExpiryExpireAfter
- );
-
- IntegerCombo<?> combo = addTimeToLiveExpiryCombo(container);
- GridData gridData = new GridData();
- gridData.grabExcessHorizontalSpace = false;
- combo.getControl().setLayoutData(gridData);
-
- Control millisecondsLabel = addUnmanagedLabel(
- container,
- EclipseLinkUiMappingsMessages.ExpiryComposite_timeToLiveExpiryMilliseconds
- );
-
- new ControlEnabler(buildTimeToLiveExpiryEnabler(), expireAfterLabel, combo.getCombo(), millisecondsLabel);
- }
-
- protected void addTimeOfDayComposite(Composite parent) {
- Composite container = this.addSubPane(parent, 2, 0, 10, 0, 0);
-
-
- Control expireAtLabel = addUnmanagedLabel(
- container,
- EclipseLinkUiMappingsMessages.ExpiryComposite_timeOfDayExpiryExpireAt
- );
-
- PropertyValueModel<ExpiryTimeOfDay> timeOfDayExpiryHolder = buildTimeOfDayExpiryHolder();
- DateTime dateTime = addUnmanagedDateTime(
- container,
- buildTimeOfDayExpiryHourHolder(timeOfDayExpiryHolder),
- buildTimeOfDayExpiryMinuteHolder(timeOfDayExpiryHolder),
- buildTimeOfDayExpirySecondHolder(timeOfDayExpiryHolder),
- null);
-
- new ControlEnabler(buildTimeOfDayExpiryEnabler(), expireAtLabel, dateTime);
- }
-
- private WritablePropertyValueModel<Boolean> buildNoExpiryHolder() {
- return new PropertyAspectAdapter<Caching, Boolean>(
- getSubjectHolder(),
- Caching.EXPIRY_PROPERTY,
- Caching.EXPIRY_TIME_OF_DAY_PROPERTY) {
- @Override
- protected Boolean buildValue_() {
- return Boolean.valueOf(this.subject.getExpiry() == null && this.subject.getExpiryTimeOfDay() == null);
- }
-
- @Override
- protected void setValue_(Boolean value) {
- this.subject.setExpiry(null);
- if (this.subject.getExpiryTimeOfDay() != null) {
- this.subject.removeExpiryTimeOfDay();
- }
- }
- };
- }
-
- private WritablePropertyValueModel<Boolean> buildExpiryHolder() {
- return new PropertyAspectAdapter<Caching, Boolean>(
- getSubjectHolder(),
- Caching.EXPIRY_PROPERTY) {
- @Override
- protected Boolean buildValue_() {
- return Boolean.valueOf(this.subject.getExpiry() != null);
- }
-
- @Override
- protected void setValue_(Boolean value) {
- if (value == Boolean.TRUE) {
- this.subject.setExpiry(0);
- }
- }
- };
- }
-
- private WritablePropertyValueModel<Boolean> buildTimeOfDayExpiryBooleanHolder() {
- return new PropertyAspectAdapter<Caching, Boolean>(
- getSubjectHolder(),
- Caching.EXPIRY_TIME_OF_DAY_PROPERTY) {
- @Override
- protected Boolean buildValue_() {
- return Boolean.valueOf(this.subject.getExpiryTimeOfDay() != null);
- }
-
- @Override
- protected void setValue_(Boolean value) {
- if (value == Boolean.TRUE) {
- this.subject.addExpiryTimeOfDay();
- }
- }
- };
- }
-
- private IntegerCombo<Caching> addTimeToLiveExpiryCombo(Composite container) {
- return new IntegerCombo<Caching>(this, container) {
-
- @Override
- protected CCombo addIntegerCombo(Composite container) {
- return this.addUnmanagedEditableCCombo(
- container,
- buildDefaultListHolder(),
- buildSelectedItemStringHolder(),
- StringConverter.Default.<String>instance());
- }
-
- @Override
- protected String getLabelText() {
- throw new UnsupportedOperationException();
- }
-
-
- @Override
- protected String getHelpId() {
- return null;
- }
-
- @Override
- protected PropertyValueModel<Integer> buildDefaultHolder() {
- return new PropertyAspectAdapter<Caching, Integer>(getSubjectHolder()) {
- @Override
- protected Integer buildValue_() {
- return Integer.valueOf(0);
- }
- };
- }
-
- @Override
- protected WritablePropertyValueModel<Integer> buildSelectedItemHolder() {
- return new PropertyAspectAdapter<Caching, Integer>(getSubjectHolder(), Caching.EXPIRY_PROPERTY) {
- @Override
- protected Integer buildValue_() {
- return this.subject.getExpiry();
- }
-
- @Override
- protected void setValue_(Integer value) {
- this.subject.setExpiry(value);
- }
- };
- }
- };
- }
-
- private PropertyValueModel<Boolean> buildTimeToLiveExpiryEnabler() {
- return new PropertyAspectAdapter<Caching, Boolean>(getSubjectHolder(), Caching.EXPIRY_PROPERTY) {
- @Override
- protected Boolean buildValue_() {
- return Boolean.valueOf(this.subject.getExpiry() != null);
- }
- };
- }
-
- private PropertyValueModel<Boolean> buildTimeOfDayExpiryEnabler() {
- return new PropertyAspectAdapter<Caching, Boolean>(getSubjectHolder(), Caching.EXPIRY_TIME_OF_DAY_PROPERTY) {
- @Override
- protected Boolean buildValue_() {
- return Boolean.valueOf(this.subject.getExpiryTimeOfDay() != null);
- }
- };
- }
-
- private PropertyValueModel<ExpiryTimeOfDay> buildTimeOfDayExpiryHolder() {
- return new PropertyAspectAdapter<Caching, ExpiryTimeOfDay>(getSubjectHolder(), Caching.EXPIRY_TIME_OF_DAY_PROPERTY) {
- @Override
- protected ExpiryTimeOfDay buildValue_() {
- return this.subject.getExpiryTimeOfDay();
- }
- };
- }
-
- private WritablePropertyValueModel<Integer> buildTimeOfDayExpiryHourHolder(PropertyValueModel<ExpiryTimeOfDay> timeOfDayExpiryHolder) {
- return new PropertyAspectAdapter<ExpiryTimeOfDay, Integer>(
- timeOfDayExpiryHolder,
- ExpiryTimeOfDay.HOUR_PROPERTY) {
- @Override
- protected Integer buildValue_() {
- return this.subject.getHour();
- }
-
- @Override
- protected void setValue_(Integer hour) {
- this.subject.setHour(hour);
- }
- };
- }
-
- private WritablePropertyValueModel<Integer> buildTimeOfDayExpiryMinuteHolder(PropertyValueModel<ExpiryTimeOfDay> timeOfDayExpiryHolder) {
- return new PropertyAspectAdapter<ExpiryTimeOfDay, Integer>(
- timeOfDayExpiryHolder,
- ExpiryTimeOfDay.MINUTE_PROPERTY) {
- @Override
- protected Integer buildValue_() {
- return this.subject.getMinute();
- }
-
- @Override
- protected void setValue_(Integer minute) {
- this.subject.setMinute(minute);
- }
- };
- }
-
- private WritablePropertyValueModel<Integer> buildTimeOfDayExpirySecondHolder(PropertyValueModel<ExpiryTimeOfDay> timeOfDayExpiryHolder) {
- return new PropertyAspectAdapter<ExpiryTimeOfDay, Integer>(
- timeOfDayExpiryHolder,
- ExpiryTimeOfDay.SECOND_PROPERTY) {
- @Override
- protected Integer buildValue_() {
- return this.subject.getSecond();
- }
-
- @Override
- protected void setValue_(Integer second) {
- this.subject.setSecond(second);
- }
- };
- }
-
-}
diff --git a/jpa/plugins/org.eclipse.jpt.eclipselink.ui/src/org/eclipse/jpt/eclipselink/ui/internal/mappings/details/JoinFetchComposite.java b/jpa/plugins/org.eclipse.jpt.eclipselink.ui/src/org/eclipse/jpt/eclipselink/ui/internal/mappings/details/JoinFetchComposite.java
deleted file mode 100644
index bd49227ae3..0000000000
--- a/jpa/plugins/org.eclipse.jpt.eclipselink.ui/src/org/eclipse/jpt/eclipselink/ui/internal/mappings/details/JoinFetchComposite.java
+++ /dev/null
@@ -1,113 +0,0 @@
-/*******************************************************************************
- * Copyright (c) 2008 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
- *
- * Contributors: Oracle. - initial API and implementation
- *******************************************************************************/
-package org.eclipse.jpt.eclipselink.ui.internal.mappings.details;
-
-import java.util.Collection;
-import org.eclipse.jpt.core.internal.JptCoreMessages;
-import org.eclipse.jpt.eclipselink.core.context.JoinFetch;
-import org.eclipse.jpt.eclipselink.core.context.JoinFetchType;
-import org.eclipse.jpt.eclipselink.ui.internal.mappings.EclipseLinkUiMappingsMessages;
-import org.eclipse.jpt.ui.internal.widgets.EnumFormComboViewer;
-import org.eclipse.jpt.ui.internal.widgets.FormPane;
-import org.eclipse.jpt.utility.model.value.PropertyValueModel;
-import org.eclipse.swt.widgets.Composite;
-
-/**
- * Here the layout of this pane:
- * <pre>
- * -----------------------------------------------------------------------------
- * | ---------------------------------------------------------- |
- * | Join Fetch: | |v| |
- * | ---------------------------------------------------------- |
- * -----------------------------------------------------------------------------</pre>
- *
- * @see Fetchable
- * @see BasicMappingComposite - A container of this widget
- * @see ManyToManyMappingComposite - A container of this widget
- * @see ManyToOneMappingComposite - A container of this widget
- * @see OneToManyMappingComposite - A container of this widget
- * @see OneToOneMappingComposite - A container of this widget
- *
- * @version 2.1
- * @since 2.1
- */
-public class JoinFetchComposite extends FormPane<JoinFetch> {
-
- /**
- * Creates a new <code>JoinFetchComposite</code>.
- *
- * @param parentPane The parent container of this one
- * @param parent The parent container
- */
- public JoinFetchComposite(FormPane<?> parentPane,
- PropertyValueModel<? extends JoinFetch> subjectHolder,
- Composite parent) {
-
- super(parentPane, subjectHolder, parent);
- }
-
- @Override
- protected void initializeLayout(Composite container) {
- addLabeledComposite(
- container,
- addLabel(
- container,
- EclipseLinkUiMappingsMessages.JoinFetchComposite_label),
- addJoinFetchTypeCombo(container).getControl(),
- null
- );
- }
-
-
- private EnumFormComboViewer<JoinFetch, JoinFetchType> addJoinFetchTypeCombo(Composite container) {
-
- return new EnumFormComboViewer<JoinFetch, JoinFetchType>(this, container) {
-
- @Override
- protected void addPropertyNames(Collection<String> propertyNames) {
- super.addPropertyNames(propertyNames);
- propertyNames.add(JoinFetch.VALUE_PROPERTY);
- }
-
- @Override
- protected JoinFetchType[] getChoices() {
- return JoinFetchType.values();
- }
-
- @Override
- protected JoinFetchType getDefaultValue() {
- return null;
- }
-
- @Override
- protected String displayString(JoinFetchType value) {
- return buildDisplayString(
- EclipseLinkUiMappingsMessages.class,
- JoinFetchComposite.this,
- value
- );
- }
-
- @Override
- protected String nullDisplayString() {
- return JptCoreMessages.NONE;
- }
-
- @Override
- protected JoinFetchType getValue() {
- return getSubject().getValue();
- }
-
- @Override
- protected void setValue(JoinFetchType value) {
- getSubject().setValue(value);
- }
- };
- }
-}
diff --git a/jpa/plugins/org.eclipse.jpt.eclipselink.ui/src/org/eclipse/jpt/eclipselink/ui/internal/mappings/details/MutableComposite.java b/jpa/plugins/org.eclipse.jpt.eclipselink.ui/src/org/eclipse/jpt/eclipselink/ui/internal/mappings/details/MutableComposite.java
deleted file mode 100644
index 2e77be61a3..0000000000
--- a/jpa/plugins/org.eclipse.jpt.eclipselink.ui/src/org/eclipse/jpt/eclipselink/ui/internal/mappings/details/MutableComposite.java
+++ /dev/null
@@ -1,101 +0,0 @@
-/*******************************************************************************
- * Copyright (c) 2006, 2009 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.
- *
- * Contributors:
- * Oracle - initial API and implementation
- ******************************************************************************/
-package org.eclipse.jpt.eclipselink.ui.internal.mappings.details;
-
-import org.eclipse.jpt.eclipselink.core.context.Mutable;
-import org.eclipse.jpt.eclipselink.ui.internal.mappings.EclipseLinkUiMappingsMessages;
-import org.eclipse.jpt.ui.internal.mappings.JptUiMappingsMessages;
-import org.eclipse.jpt.ui.internal.widgets.FormPane;
-import org.eclipse.jpt.utility.internal.model.value.PropertyAspectAdapter;
-import org.eclipse.jpt.utility.internal.model.value.TransformationPropertyValueModel;
-import org.eclipse.jpt.utility.model.value.PropertyValueModel;
-import org.eclipse.jpt.utility.model.value.WritablePropertyValueModel;
-import org.eclipse.osgi.util.NLS;
-import org.eclipse.swt.widgets.Composite;
-
-/**
- * This composite simply shows a tri-state check box for the Mutable option.
- *
- * @see Mutable
- * @see EclipseLinkBasicMappingComposite - A container of this pane
- *
- * @version 2.1
- * @since 2.1
- */
-public class MutableComposite extends FormPane<Mutable>
-{
- /**
- * Creates a new <code>MutableComposite</code>.
- *
- * @param parentPane The parent container of this one
- * @param parent The parent container
- */
- public MutableComposite(FormPane<?> parentPane,
- PropertyValueModel<? extends Mutable> subjectHolder,
- Composite parent) {
-
- super(parentPane, subjectHolder, parent);
- }
-
- @Override
- protected void initializeLayout(Composite container) {
- addTriStateCheckBoxWithDefault(
- container,
- EclipseLinkUiMappingsMessages.MutableComposite_mutableLabel,
- buildMutableHolder(),
- buildMutableStringHolder(),
- null
- );
- }
-
- private WritablePropertyValueModel<Boolean> buildMutableHolder() {
- return new PropertyAspectAdapter<Mutable, Boolean>(getSubjectHolder(), Mutable.SPECIFIED_MUTABLE_PROPERTY) {
- @Override
- protected Boolean buildValue_() {
- return this.subject.getSpecifiedMutable();
- }
-
- @Override
- protected void setValue_(Boolean value) {
- this.subject.setSpecifiedMutable(value);
- }
-
- };
- }
-
- private PropertyValueModel<String> buildMutableStringHolder() {
- return new TransformationPropertyValueModel<Boolean, String>(buildDefaultMutableHolder()) {
- @Override
- protected String transform(Boolean value) {
- if (value != null) {
- String defaultStringValue = value.booleanValue() ? JptUiMappingsMessages.Boolean_True : JptUiMappingsMessages.Boolean_False;
- return NLS.bind(EclipseLinkUiMappingsMessages.MutableComposite_mutableLabelDefault, defaultStringValue);
- }
- return EclipseLinkUiMappingsMessages.MutableComposite_mutableLabel;
- }
- };
- }
-
- private PropertyValueModel<Boolean> buildDefaultMutableHolder() {
- return new PropertyAspectAdapter<Mutable, Boolean>(
- getSubjectHolder(),
- Mutable.SPECIFIED_MUTABLE_PROPERTY,
- Mutable.DEFAULT_MUTABLE_PROPERTY)
- {
- @Override
- protected Boolean buildValue_() {
- if (this.subject.getSpecifiedMutable() != null) {
- return null;
- }
- return Boolean.valueOf(this.subject.isDefaultMutable());
- }
- };
- }
-} \ No newline at end of file
diff --git a/jpa/plugins/org.eclipse.jpt.eclipselink.ui/src/org/eclipse/jpt/eclipselink/ui/internal/mappings/details/ObjectTypeConverterComposite.java b/jpa/plugins/org.eclipse.jpt.eclipselink.ui/src/org/eclipse/jpt/eclipselink/ui/internal/mappings/details/ObjectTypeConverterComposite.java
deleted file mode 100644
index b8e429e7ee..0000000000
--- a/jpa/plugins/org.eclipse.jpt.eclipselink.ui/src/org/eclipse/jpt/eclipselink/ui/internal/mappings/details/ObjectTypeConverterComposite.java
+++ /dev/null
@@ -1,482 +0,0 @@
-/*******************************************************************************
- * Copyright (c) 2006, 2009 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
- *
- * Contributors: Oracle. - initial API and implementation
- *******************************************************************************/
-package org.eclipse.jpt.eclipselink.ui.internal.mappings.details;
-
-import java.util.ListIterator;
-import org.eclipse.jdt.ui.IJavaElementSearchConstants;
-import org.eclipse.jface.viewers.ITableLabelProvider;
-import org.eclipse.jface.viewers.LabelProvider;
-import org.eclipse.jface.window.Window;
-import org.eclipse.jpt.core.JpaProject;
-import org.eclipse.jpt.eclipselink.core.context.ConversionValue;
-import org.eclipse.jpt.eclipselink.core.context.EclipseLinkConverter;
-import org.eclipse.jpt.eclipselink.core.context.ObjectTypeConverter;
-import org.eclipse.jpt.eclipselink.ui.internal.mappings.EclipseLinkUiMappingsMessages;
-import org.eclipse.jpt.ui.WidgetFactory;
-import org.eclipse.jpt.ui.internal.swt.ColumnAdapter;
-import org.eclipse.jpt.ui.internal.util.PaneEnabler;
-import org.eclipse.jpt.ui.internal.widgets.AddRemoveListPane;
-import org.eclipse.jpt.ui.internal.widgets.AddRemoveTablePane;
-import org.eclipse.jpt.ui.internal.widgets.ClassChooserPane;
-import org.eclipse.jpt.ui.internal.widgets.FormPane;
-import org.eclipse.jpt.utility.internal.StringConverter;
-import org.eclipse.jpt.utility.internal.model.value.ItemPropertyListValueModelAdapter;
-import org.eclipse.jpt.utility.internal.model.value.ListAspectAdapter;
-import org.eclipse.jpt.utility.internal.model.value.PropertyAspectAdapter;
-import org.eclipse.jpt.utility.internal.model.value.SimplePropertyValueModel;
-import org.eclipse.jpt.utility.internal.model.value.TransformationListValueModelAdapter;
-import org.eclipse.jpt.utility.internal.model.value.TransformationPropertyValueModel;
-import org.eclipse.jpt.utility.internal.model.value.swing.ObjectListSelectionModel;
-import org.eclipse.jpt.utility.model.value.ListValueModel;
-import org.eclipse.jpt.utility.model.value.PropertyValueModel;
-import org.eclipse.jpt.utility.model.value.WritablePropertyValueModel;
-import org.eclipse.swt.graphics.Image;
-import org.eclipse.swt.widgets.Composite;
-import org.eclipse.swt.widgets.Group;
-
-/**
- * Here the layout of this pane:
- * <pre>
- * -----------------------------------------------------------------------------
- * | -------------------------------------------------------------- |
- * | Name: | ||
- * | -------------------------------------------------------------- |
- * -----------------------------------------------------------------------------</pre>
- *
- * @see EclipseLinkConverter
- * @see ConvertComposite - A container of this widget
- *
- * @version 2.1
- * @since 2.1
- */
-public class ObjectTypeConverterComposite extends FormPane<ObjectTypeConverter>
-{
-
- /**
- * Creates a new <code>ObjectTypeConverterComposite</code>.
- *
- * @param parentPane The parent container of this one
- * @param parent The parent container
- */
- public ObjectTypeConverterComposite(PropertyValueModel<? extends ObjectTypeConverter> subjectHolder,
- Composite parent,
- WidgetFactory widgetFactory) {
-
- super(subjectHolder, parent, widgetFactory);
- }
-
- @Override
- protected void initializeLayout(Composite container) {
-
- addLabeledText(
- container,
- EclipseLinkUiMappingsMessages.ConverterComposite_nameTextLabel,
- buildNameTextHolder());
-
- addDataTypeChooser(container);
- addObjectTypeChooser(container);
-
- addConversionValuesTable(container);
-
- addLabeledEditableCCombo(
- container,
- EclipseLinkUiMappingsMessages.ObjectTypeConverterComposite_defaultObjectValueLabel,
- buildDefaultObjectValueListHolder(),
- buildDefaultObjectValueHolder(),
- buildStringConverter(),
- null
- );
-
- new PaneEnabler(buildBooleanHolder(), this);
- }
-
- protected WritablePropertyValueModel<String> buildNameTextHolder() {
- return new PropertyAspectAdapter<ObjectTypeConverter, String>(
- getSubjectHolder(), EclipseLinkConverter.NAME_PROPERTY) {
- @Override
- protected String buildValue_() {
- return this.subject.getName();
- }
-
- @Override
- protected void setValue_(String value) {
- if (value.length() == 0) {
- value = null;
- }
- this.subject.setName(value);
- }
- };
- }
-
- private ClassChooserPane<ObjectTypeConverter> addDataTypeChooser(Composite container) {
-
- return new ClassChooserPane<ObjectTypeConverter>(this, container) {
-
- @Override
- protected WritablePropertyValueModel<String> buildTextHolder() {
- return new PropertyAspectAdapter<ObjectTypeConverter, String>(getSubjectHolder(), ObjectTypeConverter.DATA_TYPE_PROPERTY) {
- @Override
- protected String buildValue_() {
- return this.subject.getDataType();
- }
-
- @Override
- protected void setValue_(String value) {
-
- if (value.length() == 0) {
- value = null;
- }
-
- this.subject.setDataType(value);
- }
- };
- }
-
- @Override
- protected String getClassName() {
- return getSubject().getDataType();
- }
-
- @Override
- protected String getLabelText() {
- return EclipseLinkUiMappingsMessages.ObjectTypeConverterComposite_dataTypeLabel;
- }
-
- @Override
- protected JpaProject getJpaProject() {
- return getSubject().getJpaProject();
- }
-
- @Override
- protected void setClassName(String className) {
- getSubject().setDataType(className);
- }
-
- @Override
- protected char getEnclosingTypeSeparator() {
- return getSubject().getEnclosingTypeSeparator();
- }
- };
- }
-
- private ClassChooserPane<ObjectTypeConverter> addObjectTypeChooser(Composite container) {
-
- return new ClassChooserPane<ObjectTypeConverter>(this, container) {
-
- @Override
- protected WritablePropertyValueModel<String> buildTextHolder() {
- return new PropertyAspectAdapter<ObjectTypeConverter, String>(getSubjectHolder(), ObjectTypeConverter.OBJECT_TYPE_PROPERTY) {
- @Override
- protected String buildValue_() {
- return this.subject.getObjectType();
- }
-
- @Override
- protected void setValue_(String value) {
-
- if (value.length() == 0) {
- value = null;
- }
-
- this.subject.setObjectType(value);
- }
- };
- }
-
- @Override
- protected String getClassName() {
- return getSubject().getObjectType();
- }
-
- @Override
- protected String getLabelText() {
- return EclipseLinkUiMappingsMessages.ObjectTypeConverterComposite_objectTypeLabel;
- }
-
- @Override
- protected JpaProject getJpaProject() {
- return getSubject().getJpaProject();
- }
-
- @Override
- protected void setClassName(String className) {
- getSubject().setObjectType(className);
- }
-
- @Override
- protected int getTypeDialogStyle() {
- return IJavaElementSearchConstants.CONSIDER_CLASSES_AND_ENUMS;
- }
-
- @Override
- protected char getEnclosingTypeSeparator() {
- return getSubject().getEnclosingTypeSeparator();
- }
- };
- }
-
- protected void addConversionValuesTable(Composite container) {
-
- // Join Columns group pane
- Group conversionValuesGroupPane = addTitledGroup(
- container,
- EclipseLinkUiMappingsMessages.ObjectTypeConverterComposite_conversionValuesGroupTitle
- );
-
- WritablePropertyValueModel<ConversionValue> conversionValueHolder =
- buildConversionValueHolder();
- // Conversion Values add/remove list pane
- new AddRemoveTablePane<ObjectTypeConverter>(
- this,
- conversionValuesGroupPane,
- buildConversionValuesAdapter(),
- buildConversionValuesListModel(),
- conversionValueHolder,
- buildConversionValuesLabelProvider(),
- null//TODO need a help context id for this
- ) {
- @Override
- protected ColumnAdapter<ConversionValue> buildColumnAdapter() {
- return new ConversionValueColumnAdapter();
- }
- };
-
- }
-
- protected WritablePropertyValueModel<ConversionValue> buildConversionValueHolder() {
- return new SimplePropertyValueModel<ConversionValue>();
- }
-
- protected AddRemoveListPane.Adapter buildConversionValuesAdapter() {
- return new AddRemoveListPane.AbstractAdapter() {
-
- public void addNewItem(ObjectListSelectionModel listSelectionModel) {
- ConversionValueDialog dialog = buildConversionValueDialogForAdd();
- addConversionValueFromDialog(dialog, listSelectionModel);
- }
-
- @Override
- public boolean hasOptionalButton() {
- return true;
- }
-
- @Override
- public String optionalButtonText() {
- return EclipseLinkUiMappingsMessages.ObjectTypeConverterComposite_conversionValueEdit;
- }
-
- @Override
- public void optionOnSelection(ObjectListSelectionModel listSelectionModel) {
- ConversionValue conversionValue = (ConversionValue) listSelectionModel.selectedValue();
- ConversionValueDialog dialog = new ConversionValueDialog(getControl().getShell(), getSubject(), conversionValue);
- editConversionValueFromDialog(dialog, conversionValue);
- }
-
- public void removeSelectedItems(ObjectListSelectionModel listSelectionModel) {
- ObjectTypeConverter converter = getSubject();
- int[] selectedIndices = listSelectionModel.selectedIndices();
-
- for (int index = selectedIndices.length; --index >= 0; ) {
- converter.removeConversionValue(selectedIndices[index]);
- }
- }
- };
- }
-
-
- protected ConversionValueDialog buildConversionValueDialogForAdd() {
- return new ConversionValueDialog(getControl().getShell(), getSubject());
- }
-
- protected void addConversionValueFromDialog(ConversionValueDialog dialog, ObjectListSelectionModel listSelectionModel) {
- if (dialog.open() != Window.OK) {
- return;
- }
-
- ConversionValue conversionValue = this.getSubject().addConversionValue();
- conversionValue.setDataValue(dialog.getDataValue());
- conversionValue.setObjectValue(dialog.getObjectValue());
-
- listSelectionModel.setSelectedValue(conversionValue);
- }
-
- protected void editConversionValueFromDialog(ConversionValueDialog dialog, ConversionValue conversionValue) {
- if (dialog.open() != Window.OK) {
- return;
- }
-
- conversionValue.setDataValue(dialog.getDataValue());
- conversionValue.setObjectValue(dialog.getObjectValue());
- }
-
- private ListValueModel<ConversionValue> buildConversionValuesListModel() {
- return new ItemPropertyListValueModelAdapter<ConversionValue>(buildConversionValuesListHolder(),
- ConversionValue.DATA_VALUE_PROPERTY,
- ConversionValue.OBJECT_VALUE_PROPERTY);
- }
-
- private ListValueModel<ConversionValue> buildConversionValuesListHolder() {
- return new ListAspectAdapter<ObjectTypeConverter, ConversionValue>(getSubjectHolder(), ObjectTypeConverter.CONVERSION_VALUES_LIST) {
- @Override
- protected ListIterator<ConversionValue> listIterator_() {
- return this.subject.conversionValues();
- }
-
- @Override
- protected int size_() {
- return this.subject.conversionValuesSize();
- }
- };
- }
-
- private ITableLabelProvider buildConversionValuesLabelProvider() {
- return new TableLabelProvider();
- }
-
- protected ListValueModel<String> buildDefaultObjectValueListHolder() {
- return new TransformationListValueModelAdapter<ConversionValue, String>(buildConversionValuesListModel()) {
- @Override
- protected String transformItem(ConversionValue conversionValue) {
- return conversionValue.getObjectValue();
- }
- };
- }
-
- protected WritablePropertyValueModel<String> buildDefaultObjectValueHolder() {
- return new PropertyAspectAdapter<ObjectTypeConverter, String>(
- getSubjectHolder(), ObjectTypeConverter.DEFAULT_OBJECT_VALUE_PROPERTY) {
- @Override
- protected String buildValue_() {
- return this.subject.getDefaultObjectValue();
- }
-
- @Override
- protected void setValue_(String value) {
- if (value != null && value.length() == 0) {
- value = null;
- }
- this.subject.setDefaultObjectValue(value);
- }
- };
- }
-
- protected final StringConverter<String> buildStringConverter() {
- return new StringConverter<String>() {
- public String convertToString(String value) {
- return (value == null) ? "" : value; //$NON-NLS-1$
- }
- };
- }
-
- protected PropertyValueModel<Boolean> buildBooleanHolder() {
- return new TransformationPropertyValueModel<ObjectTypeConverter, Boolean>(getSubjectHolder()) {
- @Override
- protected Boolean transform(ObjectTypeConverter value) {
- return Boolean.valueOf(value != null);
- }
- };
- }
-
- private class TableLabelProvider extends LabelProvider
- implements ITableLabelProvider {
-
- public Image getColumnImage(Object element, int columnIndex) {
- return null;
- }
-
- public String getColumnText(Object element, int columnIndex) {
-
- ConversionValue conversionValue = (ConversionValue) element;
- String value = null;
-
- switch (columnIndex) {
- case ConversionValueColumnAdapter.DATA_VALUE_COLUMN: {
- value = conversionValue.getDataValue();
- break;
- }
-
- case ConversionValueColumnAdapter.OBJECT_VALUE_COLUMN: {
- value = conversionValue.getObjectValue();
- break;
- }
- }
-
- if (value == null) {
- value = ""; //$NON-NLS-1$
- }
-
- return value;
- }
- }
-
- private static class ConversionValueColumnAdapter implements ColumnAdapter<ConversionValue> {
-
- public static final int COLUMN_COUNT = 2;
- //public static final int SELECTION_COLUMN = 0;
- public static final int DATA_VALUE_COLUMN = 0;
- public static final int OBJECT_VALUE_COLUMN = 1;
-
- private WritablePropertyValueModel<String> buildDataValueHolder(ConversionValue subject) {
- return new PropertyAspectAdapter<ConversionValue, String>(ConversionValue.DATA_VALUE_PROPERTY, subject) {
- @Override
- protected String buildValue_() {
- return this.subject.getDataValue();
- }
-
- @Override
- protected void setValue_(String value) {
- this.subject.setDataValue(value);
- }
- };
- }
-
- private WritablePropertyValueModel<String> buildObjectValueHolder(ConversionValue subject) {
- return new PropertyAspectAdapter<ConversionValue, String>(ConversionValue.OBJECT_VALUE_PROPERTY, subject) {
- @Override
- protected String buildValue_() {
- return this.subject.getObjectValue();
- }
-
- @Override
- protected void setValue_(String value) {
- this.subject.setObjectValue(value);
- }
- };
- }
-
- public WritablePropertyValueModel<?>[] cellModels(ConversionValue subject) {
- WritablePropertyValueModel<?>[] holders = new WritablePropertyValueModel<?>[COLUMN_COUNT];
- //holders[SELECTION_COLUMN] = new SimplePropertyValueModel<Object>();
- holders[DATA_VALUE_COLUMN] = buildDataValueHolder(subject);
- holders[OBJECT_VALUE_COLUMN] = buildObjectValueHolder(subject);
- return holders;
- }
-
- public int columnCount() {
- return COLUMN_COUNT;
- }
-
- public String columnName(int columnIndex) {
-
- switch (columnIndex) {
- case ConversionValueColumnAdapter.DATA_VALUE_COLUMN: {
- return EclipseLinkUiMappingsMessages.ObjectTypeConverterComposite_conversionValuesDataValueColumn;
- }
-
- case ConversionValueColumnAdapter.OBJECT_VALUE_COLUMN: {
- return EclipseLinkUiMappingsMessages.ObjectTypeConverterComposite_conversionValuesObjectValueColumn;
- }
-
- default: {
- return null;
- }
- }
- }
- }
-}
diff --git a/jpa/plugins/org.eclipse.jpt.eclipselink.ui/src/org/eclipse/jpt/eclipselink/ui/internal/mappings/details/PrivateOwnedComposite.java b/jpa/plugins/org.eclipse.jpt.eclipselink.ui/src/org/eclipse/jpt/eclipselink/ui/internal/mappings/details/PrivateOwnedComposite.java
deleted file mode 100644
index 925202313c..0000000000
--- a/jpa/plugins/org.eclipse.jpt.eclipselink.ui/src/org/eclipse/jpt/eclipselink/ui/internal/mappings/details/PrivateOwnedComposite.java
+++ /dev/null
@@ -1,67 +0,0 @@
-/*******************************************************************************
- * Copyright (c) 2008 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.
- *
- * Contributors:
- * Oracle - initial API and implementation
- ******************************************************************************/
-package org.eclipse.jpt.eclipselink.ui.internal.mappings.details;
-
-import org.eclipse.jpt.eclipselink.core.context.PrivateOwned;
-import org.eclipse.jpt.eclipselink.ui.internal.mappings.EclipseLinkUiMappingsMessages;
-import org.eclipse.jpt.ui.internal.widgets.FormPane;
-import org.eclipse.jpt.utility.internal.model.value.PropertyAspectAdapter;
-import org.eclipse.jpt.utility.model.value.PropertyValueModel;
-import org.eclipse.swt.widgets.Composite;
-
-/**
- * This composite simply shows the Lob check box.
- *
- * @see BasicMapping
- *
- * @version 2.1
- * @since 2.1
- */
-public class PrivateOwnedComposite extends FormPane<PrivateOwned>
-{
- /**
- * Creates a new <code>PrivateOwnedComposite</code>.
- *
- * @param parentPane The parent container of this one
- * @param parent The parent container
- */
- public PrivateOwnedComposite(FormPane<?> parentPane,
- PropertyValueModel<? extends PrivateOwned> subjectHolder,
- Composite parent) {
-
- super(parentPane, subjectHolder, parent);
- }
-
- private PropertyAspectAdapter<PrivateOwned, Boolean> buildPrivateOwnedHolder() {
-
- return new PropertyAspectAdapter<PrivateOwned, Boolean>(getSubjectHolder(), PrivateOwned.PRIVATE_OWNED_PROPERTY) {
-
- @Override
- protected Boolean buildValue_() {
- return Boolean.valueOf(this.subject.isPrivateOwned());
- }
-
- @Override
- protected void setValue_(Boolean value) {
- this.subject.setPrivateOwned(value.booleanValue());
- }
- };
- }
-
- @Override
- protected void initializeLayout(Composite container) {
- addCheckBox(
- container,
- EclipseLinkUiMappingsMessages.PrivateOwnedComposite_privateOwnedLabel,
- buildPrivateOwnedHolder(),
- null
- );
- }
-}
diff --git a/jpa/plugins/org.eclipse.jpt.eclipselink.ui/src/org/eclipse/jpt/eclipselink/ui/internal/mappings/details/ReadOnlyComposite.java b/jpa/plugins/org.eclipse.jpt.eclipselink.ui/src/org/eclipse/jpt/eclipselink/ui/internal/mappings/details/ReadOnlyComposite.java
deleted file mode 100644
index 824aa3bf32..0000000000
--- a/jpa/plugins/org.eclipse.jpt.eclipselink.ui/src/org/eclipse/jpt/eclipselink/ui/internal/mappings/details/ReadOnlyComposite.java
+++ /dev/null
@@ -1,103 +0,0 @@
-/*******************************************************************************
- * Copyright (c) 2008, 2009 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.
- *
- * Contributors:
- * Oracle - initial API and implementation
- ******************************************************************************/
-package org.eclipse.jpt.eclipselink.ui.internal.mappings.details;
-
-import org.eclipse.jpt.eclipselink.core.context.ReadOnly;
-import org.eclipse.jpt.eclipselink.ui.internal.mappings.EclipseLinkUiMappingsMessages;
-import org.eclipse.jpt.ui.internal.mappings.JptUiMappingsMessages;
-import org.eclipse.jpt.ui.internal.widgets.FormPane;
-import org.eclipse.jpt.utility.internal.model.value.PropertyAspectAdapter;
-import org.eclipse.jpt.utility.internal.model.value.TransformationPropertyValueModel;
-import org.eclipse.jpt.utility.model.value.PropertyValueModel;
-import org.eclipse.jpt.utility.model.value.WritablePropertyValueModel;
-import org.eclipse.osgi.util.NLS;
-import org.eclipse.swt.widgets.Composite;
-
-/**
- * This composite simply shows the Read Only check box.
- *
- * @see ReadOnly
- *
- * @version 2.1
- * @since 2.1
- */
-public class ReadOnlyComposite extends FormPane<ReadOnly>
-{
- /**
- * Creates a new <code>ReadOnlyComposite</code>.
- *
- * @param parentPane The parent container of this one
- * @param parent The parent container
- */
- public ReadOnlyComposite(FormPane<?> parentPane,
- PropertyValueModel<? extends ReadOnly> subjectHolder,
- Composite parent) {
-
- super(parentPane, subjectHolder, parent);
- }
-
- @Override
- protected void initializeLayout(Composite container) {
- // Unique tri-state check box
- addTriStateCheckBoxWithDefault(
- container,
- EclipseLinkUiMappingsMessages.ReadOnlyComposite_readOnlyLabel,
- buildSpecifiedReadOnlyHolder(),
- buildReadOnlyStringHolder(),
- null
- );
- }
-
- private WritablePropertyValueModel<Boolean> buildSpecifiedReadOnlyHolder() {
- return new PropertyAspectAdapter<ReadOnly, Boolean>(
- getSubjectHolder(),
- ReadOnly.SPECIFIED_READ_ONLY_PROPERTY)
- {
- @Override
- protected Boolean buildValue_() {
- return this.subject.getSpecifiedReadOnly();
- }
-
- @Override
- protected void setValue_(Boolean value) {
- this.subject.setSpecifiedReadOnly(value);
- }
- };
- }
-
- private PropertyValueModel<String> buildReadOnlyStringHolder() {
- return new TransformationPropertyValueModel<Boolean, String>(buildDefaultReadOnlyHolder()) {
- @Override
- protected String transform(Boolean value) {
- if (value != null) {
- String defaultStringValue = value.booleanValue() ? JptUiMappingsMessages.Boolean_True : JptUiMappingsMessages.Boolean_False;
- return NLS.bind(EclipseLinkUiMappingsMessages.ReadOnlyComposite_readOnlyWithDefault, defaultStringValue);
- }
- return EclipseLinkUiMappingsMessages.ReadOnlyComposite_readOnlyLabel;
- }
- };
- }
-
- private PropertyValueModel<Boolean> buildDefaultReadOnlyHolder() {
- return new PropertyAspectAdapter<ReadOnly, Boolean>(
- getSubjectHolder(),
- ReadOnly.SPECIFIED_READ_ONLY_PROPERTY,
- ReadOnly.DEFAULT_READ_ONLY_PROPERTY)
- {
- @Override
- protected Boolean buildValue_() {
- if (this.subject.getSpecifiedReadOnly() != null) {
- return null;
- }
- return Boolean.valueOf(this.subject.isDefaultReadOnly());
- }
- };
- }
-}
diff --git a/jpa/plugins/org.eclipse.jpt.eclipselink.ui/src/org/eclipse/jpt/eclipselink/ui/internal/mappings/details/RefreshOnlyIfNewerComposite.java b/jpa/plugins/org.eclipse.jpt.eclipselink.ui/src/org/eclipse/jpt/eclipselink/ui/internal/mappings/details/RefreshOnlyIfNewerComposite.java
deleted file mode 100644
index 3033f5ba7d..0000000000
--- a/jpa/plugins/org.eclipse.jpt.eclipselink.ui/src/org/eclipse/jpt/eclipselink/ui/internal/mappings/details/RefreshOnlyIfNewerComposite.java
+++ /dev/null
@@ -1,103 +0,0 @@
-/*******************************************************************************
- * Copyright (c) 2008, 2009 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.
- *
- * Contributors:
- * Oracle - initial API and implementation
- ******************************************************************************/
-package org.eclipse.jpt.eclipselink.ui.internal.mappings.details;
-
-import org.eclipse.jpt.eclipselink.core.context.Caching;
-import org.eclipse.jpt.eclipselink.ui.internal.EclipseLinkHelpContextIds;
-import org.eclipse.jpt.eclipselink.ui.internal.mappings.EclipseLinkUiMappingsMessages;
-import org.eclipse.jpt.ui.internal.mappings.JptUiMappingsMessages;
-import org.eclipse.jpt.ui.internal.widgets.FormPane;
-import org.eclipse.jpt.utility.internal.model.value.PropertyAspectAdapter;
-import org.eclipse.jpt.utility.internal.model.value.TransformationPropertyValueModel;
-import org.eclipse.jpt.utility.model.value.PropertyValueModel;
-import org.eclipse.jpt.utility.model.value.WritablePropertyValueModel;
-import org.eclipse.osgi.util.NLS;
-import org.eclipse.swt.widgets.Composite;
-
-/**
- * This composite simply shows a tri-state check box for the Refresh Only If Newer option.
- *
- * @see EclipseLinkCaching
- * @see CachingComposite - A container of this widget
- *
- * @version 2.1
- * @since 2.1
- */
-public class RefreshOnlyIfNewerComposite extends FormPane<Caching>
-{
- /**
- * Creates a new <code>OptionalComposite</code>.
- *
- * @param parentPane The parent container of this one
- * @param parent The parent container
- */
- public RefreshOnlyIfNewerComposite(FormPane<? extends Caching> parentPane,
- Composite parent)
- {
- super(parentPane, parent);
- }
-
- @Override
- protected void initializeLayout(Composite container) {
-
- addTriStateCheckBoxWithDefault(
- container,
- EclipseLinkUiMappingsMessages.RefreshOnlyIfNewerComposite_refreshOnlyIfNewerLabel,
- buildRefreshOnlyIfNewerHolder(),
- buildRefreshOnlyIfNewerStringHolder(),
- EclipseLinkHelpContextIds.CACHING_REFRESH_ONLY_IF_NEWER
- );
- }
-
- private WritablePropertyValueModel<Boolean> buildRefreshOnlyIfNewerHolder() {
- return new PropertyAspectAdapter<Caching, Boolean>(getSubjectHolder(), Caching.SPECIFIED_REFRESH_ONLY_IF_NEWER_PROPERTY) {
- @Override
- protected Boolean buildValue_() {
- return this.subject.getSpecifiedRefreshOnlyIfNewer();
- }
-
- @Override
- protected void setValue_(Boolean value) {
- this.subject.setSpecifiedRefreshOnlyIfNewer(value);
- }
- };
- }
-
- private PropertyValueModel<String> buildRefreshOnlyIfNewerStringHolder() {
-
- return new TransformationPropertyValueModel<Boolean, String>(buildDefaultRefreshOnlyIfNewerHolder()) {
-
- @Override
- protected String transform(Boolean value) {
- if (value != null) {
- String defaultStringValue = value.booleanValue() ? JptUiMappingsMessages.Boolean_True : JptUiMappingsMessages.Boolean_False;
- return NLS.bind(EclipseLinkUiMappingsMessages.RefreshOnlyIfNewerComposite_refreshOnlyIfNewerDefault, defaultStringValue);
- }
- return EclipseLinkUiMappingsMessages.RefreshOnlyIfNewerComposite_refreshOnlyIfNewerLabel;
- }
- };
- }
-
- private PropertyValueModel<Boolean> buildDefaultRefreshOnlyIfNewerHolder() {
- return new PropertyAspectAdapter<Caching, Boolean>(
- getSubjectHolder(),
- Caching.SPECIFIED_REFRESH_ONLY_IF_NEWER_PROPERTY,
- Caching.DEFAULT_REFRESH_ONLY_IF_NEWER_PROPERTY)
- {
- @Override
- protected Boolean buildValue_() {
- if (this.subject.getSpecifiedRefreshOnlyIfNewer() != null) {
- return null;
- }
- return Boolean.valueOf(this.subject.isDefaultRefreshOnlyIfNewer());
- }
- };
- }
-} \ No newline at end of file
diff --git a/jpa/plugins/org.eclipse.jpt.eclipselink.ui/src/org/eclipse/jpt/eclipselink/ui/internal/mappings/details/StructConverterComposite.java b/jpa/plugins/org.eclipse.jpt.eclipselink.ui/src/org/eclipse/jpt/eclipselink/ui/internal/mappings/details/StructConverterComposite.java
deleted file mode 100644
index 8170094d9a..0000000000
--- a/jpa/plugins/org.eclipse.jpt.eclipselink.ui/src/org/eclipse/jpt/eclipselink/ui/internal/mappings/details/StructConverterComposite.java
+++ /dev/null
@@ -1,152 +0,0 @@
-/*******************************************************************************
- * Copyright (c) 2006, 2009 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
- *
- * Contributors: Oracle. - initial API and implementation
- *******************************************************************************/
-package org.eclipse.jpt.eclipselink.ui.internal.mappings.details;
-
-import org.eclipse.jpt.core.JpaProject;
-import org.eclipse.jpt.eclipselink.core.context.EclipseLinkConverter;
-import org.eclipse.jpt.eclipselink.core.context.StructConverter;
-import org.eclipse.jpt.eclipselink.ui.internal.mappings.EclipseLinkUiMappingsMessages;
-import org.eclipse.jpt.ui.WidgetFactory;
-import org.eclipse.jpt.ui.internal.util.PaneEnabler;
-import org.eclipse.jpt.ui.internal.widgets.ClassChooserPane;
-import org.eclipse.jpt.ui.internal.widgets.FormPane;
-import org.eclipse.jpt.utility.internal.model.value.PropertyAspectAdapter;
-import org.eclipse.jpt.utility.internal.model.value.TransformationPropertyValueModel;
-import org.eclipse.jpt.utility.model.value.PropertyValueModel;
-import org.eclipse.jpt.utility.model.value.WritablePropertyValueModel;
-import org.eclipse.swt.widgets.Composite;
-
-/**
- * Here the layout of this pane:
- * <pre>
- * -----------------------------------------------------------------------------
- * | -------------------------------------------------------------- |
- * | Name: | ||
- * | -------------------------------------------------------------- |
- * -----------------------------------------------------------------------------</pre>
- *
- * @see EclipseLinkConverter
- * @see ConvertComposite - A container of this widget
- *
- * @version 2.1
- * @since 2.1
- */
-public class StructConverterComposite extends FormPane<StructConverter>
-{
-
- /**
- * Creates a new <code>StructConverterComposite</code>.
- *
- * @param parentPane The parent container of this one
- * @param parent The parent container
- */
- public StructConverterComposite(PropertyValueModel<? extends StructConverter> subjectHolder,
- Composite parent,
- WidgetFactory widgetFactory) {
-
- super(subjectHolder, parent, widgetFactory);
- }
-
- @Override
- protected void initializeLayout(Composite container) {
-
- addLabeledText(
- container,
- EclipseLinkUiMappingsMessages.ConverterComposite_nameTextLabel,
- buildNameTextHolder());
-
- addClassChooser(container);
-
- new PaneEnabler(buildBooleanHolder(), this);
- }
-
- protected WritablePropertyValueModel<String> buildNameTextHolder() {
- return new PropertyAspectAdapter<StructConverter, String>(
- getSubjectHolder(), EclipseLinkConverter.NAME_PROPERTY) {
- @Override
- protected String buildValue_() {
- return this.subject.getName();
- }
-
- @Override
- protected void setValue_(String value) {
- if (value.length() == 0) {
- value = null;
- }
- this.subject.setName(value);
- }
- };
- }
-
-
- private ClassChooserPane<StructConverter> addClassChooser(Composite container) {
-
- return new ClassChooserPane<StructConverter>(this, container) {
-
- @Override
- protected WritablePropertyValueModel<String> buildTextHolder() {
- return new PropertyAspectAdapter<StructConverter, String>(getSubjectHolder(), StructConverter.CONVERTER_CLASS_PROPERTY) {
- @Override
- protected String buildValue_() {
- return this.subject.getConverterClass();
- }
-
- @Override
- protected void setValue_(String value) {
-
- if (value.length() == 0) {
- value = null;
- }
-
- this.subject.setConverterClass(value);
- }
- };
- }
-
- @Override
- protected String getClassName() {
- return getSubject().getConverterClass();
- }
-
- @Override
- protected String getLabelText() {
- return EclipseLinkUiMappingsMessages.ConverterComposite_classLabel;
- }
-
- @Override
- protected JpaProject getJpaProject() {
- return getSubject().getJpaProject();
- }
-
- @Override
- protected void setClassName(String className) {
- getSubject().setConverterClass(className);
- }
-
- @Override
- protected String getSuperInterfaceName() {
- return StructConverter.ECLIPSELINK_STRUCT_CONVERTER_CLASS_NAME;
- }
-
- @Override
- protected char getEnclosingTypeSeparator() {
- return getSubject().getEnclosingTypeSeparator();
- }
- };
- }
-
- protected PropertyValueModel<Boolean> buildBooleanHolder() {
- return new TransformationPropertyValueModel<StructConverter, Boolean>(getSubjectHolder()) {
- @Override
- protected Boolean transform(StructConverter value) {
- return Boolean.valueOf(value != null);
- }
- };
- }
-}
diff --git a/jpa/plugins/org.eclipse.jpt.eclipselink.ui/src/org/eclipse/jpt/eclipselink/ui/internal/mappings/details/TransformationMappingComposite.java b/jpa/plugins/org.eclipse.jpt.eclipselink.ui/src/org/eclipse/jpt/eclipselink/ui/internal/mappings/details/TransformationMappingComposite.java
deleted file mode 100644
index 2d70b233e3..0000000000
--- a/jpa/plugins/org.eclipse.jpt.eclipselink.ui/src/org/eclipse/jpt/eclipselink/ui/internal/mappings/details/TransformationMappingComposite.java
+++ /dev/null
@@ -1,45 +0,0 @@
-/*******************************************************************************
- * Copyright (c) 2008 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.
- *
- * Contributors:
- * Oracle - initial API and implementation
- ******************************************************************************/
-package org.eclipse.jpt.eclipselink.ui.internal.mappings.details;
-
-import org.eclipse.jpt.eclipselink.core.context.TransformationMapping;
-import org.eclipse.jpt.ui.WidgetFactory;
-import org.eclipse.jpt.ui.details.JpaComposite;
-import org.eclipse.jpt.ui.internal.widgets.FormPane;
-import org.eclipse.jpt.utility.model.value.PropertyValueModel;
-import org.eclipse.swt.widgets.Composite;
-
-/**
- *
- * @version 2.1
- * @since 2.1
- */
-public class TransformationMappingComposite extends FormPane<TransformationMapping>
- implements JpaComposite
-{
- /**
- * Creates a new <code>EclipseLinkBasicCollectionMappingComposite</code>.
- *
- * @param subjectHolder The holder of the subject <code>IManyToOneMapping</code>
- * @param parent The parent container
- * @param widgetFactory The factory used to create various common widgets
- */
- public TransformationMappingComposite(PropertyValueModel<? extends TransformationMapping> subjectHolder,
- Composite parent,
- WidgetFactory widgetFactory) {
-
- super(subjectHolder, parent, widgetFactory);
- }
-
- @Override
- protected void initializeLayout(Composite container) {
-
- }
-}
diff --git a/jpa/plugins/org.eclipse.jpt.eclipselink.ui/src/org/eclipse/jpt/eclipselink/ui/internal/mappings/details/TypeConverterComposite.java b/jpa/plugins/org.eclipse.jpt.eclipselink.ui/src/org/eclipse/jpt/eclipselink/ui/internal/mappings/details/TypeConverterComposite.java
deleted file mode 100644
index 6009bebf6c..0000000000
--- a/jpa/plugins/org.eclipse.jpt.eclipselink.ui/src/org/eclipse/jpt/eclipselink/ui/internal/mappings/details/TypeConverterComposite.java
+++ /dev/null
@@ -1,199 +0,0 @@
-/*******************************************************************************
- * Copyright (c) 2006, 2009 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
- *
- * Contributors: Oracle. - initial API and implementation
- *******************************************************************************/
-package org.eclipse.jpt.eclipselink.ui.internal.mappings.details;
-
-import org.eclipse.jpt.core.JpaProject;
-import org.eclipse.jpt.eclipselink.core.context.EclipseLinkConverter;
-import org.eclipse.jpt.eclipselink.core.context.TypeConverter;
-import org.eclipse.jpt.eclipselink.ui.internal.mappings.EclipseLinkUiMappingsMessages;
-import org.eclipse.jpt.ui.WidgetFactory;
-import org.eclipse.jpt.ui.internal.util.PaneEnabler;
-import org.eclipse.jpt.ui.internal.widgets.ClassChooserPane;
-import org.eclipse.jpt.ui.internal.widgets.FormPane;
-import org.eclipse.jpt.utility.internal.model.value.PropertyAspectAdapter;
-import org.eclipse.jpt.utility.internal.model.value.TransformationPropertyValueModel;
-import org.eclipse.jpt.utility.model.value.PropertyValueModel;
-import org.eclipse.jpt.utility.model.value.WritablePropertyValueModel;
-import org.eclipse.swt.widgets.Composite;
-
-/**
- * Here the layout of this pane:
- * <pre>
- * -----------------------------------------------------------------------------
- * | -------------------------------------------------------------- |
- * | Name: | ||
- * | -------------------------------------------------------------- |
- * -----------------------------------------------------------------------------</pre>
- *
- * @see EclipseLinkConverter
- * @see ConvertComposite - A container of this widget
- *
- * @version 2.1
- * @since 2.1
- */
-public class TypeConverterComposite extends FormPane<TypeConverter>
-{
-
- /**
- * Creates a new <code>TypeConverterComposite</code>.
- *
- * @param parentPane The parent container of this one
- * @param parent The parent container
- */
- public TypeConverterComposite(PropertyValueModel<? extends TypeConverter> subjectHolder,
- Composite parent,
- WidgetFactory widgetFactory) {
-
- super(subjectHolder, parent, widgetFactory);
- }
-
- @Override
- protected void initializeLayout(Composite container) {
-
- addLabeledText(
- container,
- EclipseLinkUiMappingsMessages.ConverterComposite_nameTextLabel,
- buildNameTextHolder());
-
- addDataTypeChooser(container);
- addObjectTypeChooser(container);
-
- new PaneEnabler(buildBooleanHolder(), this);
- }
-
- protected WritablePropertyValueModel<String> buildNameTextHolder() {
- return new PropertyAspectAdapter<TypeConverter, String>(
- getSubjectHolder(), EclipseLinkConverter.NAME_PROPERTY) {
- @Override
- protected String buildValue_() {
- return this.subject.getName();
- }
-
- @Override
- protected void setValue_(String value) {
- if (value.length() == 0) {
- value = null;
- }
- this.subject.setName(value);
- }
- };
- }
-
-
- private ClassChooserPane<TypeConverter> addDataTypeChooser(Composite container) {
-
- return new ClassChooserPane<TypeConverter>(this, container) {
-
- @Override
- protected WritablePropertyValueModel<String> buildTextHolder() {
- return new PropertyAspectAdapter<TypeConverter, String>(getSubjectHolder(), TypeConverter.DATA_TYPE_PROPERTY) {
- @Override
- protected String buildValue_() {
- return this.subject.getDataType();
- }
-
- @Override
- protected void setValue_(String value) {
-
- if (value.length() == 0) {
- value = null;
- }
-
- this.subject.setDataType(value);
- }
- };
- }
-
- @Override
- protected String getClassName() {
- return getSubject().getDataType();
- }
-
- @Override
- protected String getLabelText() {
- return EclipseLinkUiMappingsMessages.TypeConverterComposite_dataTypeLabel;
- }
-
- @Override
- protected JpaProject getJpaProject() {
- return getSubject().getJpaProject();
- }
-
- @Override
- protected void setClassName(String className) {
- getSubject().setDataType(className);
- }
-
- @Override
- protected char getEnclosingTypeSeparator() {
- return getSubject().getEnclosingTypeSeparator();
- }
- };
- }
-
- private ClassChooserPane<TypeConverter> addObjectTypeChooser(Composite container) {
-
- return new ClassChooserPane<TypeConverter>(this, container) {
-
- @Override
- protected WritablePropertyValueModel<String> buildTextHolder() {
- return new PropertyAspectAdapter<TypeConverter, String>(getSubjectHolder(), TypeConverter.OBJECT_TYPE_PROPERTY) {
- @Override
- protected String buildValue_() {
- return this.subject.getObjectType();
- }
-
- @Override
- protected void setValue_(String value) {
-
- if (value.length() == 0) {
- value = null;
- }
-
- this.subject.setObjectType(value);
- }
- };
- }
-
- @Override
- protected String getClassName() {
- return getSubject().getObjectType();
- }
-
- @Override
- protected String getLabelText() {
- return EclipseLinkUiMappingsMessages.TypeConverterComposite_objectTypeLabel;
- }
-
- @Override
- protected JpaProject getJpaProject() {
- return getSubject().getJpaProject();
- }
-
- @Override
- protected void setClassName(String className) {
- getSubject().setObjectType(className);
- }
-
- @Override
- protected char getEnclosingTypeSeparator() {
- return getSubject().getEnclosingTypeSeparator();
- }
- };
- }
-
- protected PropertyValueModel<Boolean> buildBooleanHolder() {
- return new TransformationPropertyValueModel<TypeConverter, Boolean>(getSubjectHolder()) {
- @Override
- protected Boolean transform(TypeConverter value) {
- return Boolean.valueOf(value != null);
- }
- };
- }
-}
diff --git a/jpa/plugins/org.eclipse.jpt.eclipselink.ui/src/org/eclipse/jpt/eclipselink/ui/internal/mappings/details/VariableOneToOneMappingComposite.java b/jpa/plugins/org.eclipse.jpt.eclipselink.ui/src/org/eclipse/jpt/eclipselink/ui/internal/mappings/details/VariableOneToOneMappingComposite.java
deleted file mode 100644
index ae6475a03f..0000000000
--- a/jpa/plugins/org.eclipse.jpt.eclipselink.ui/src/org/eclipse/jpt/eclipselink/ui/internal/mappings/details/VariableOneToOneMappingComposite.java
+++ /dev/null
@@ -1,45 +0,0 @@
-/*******************************************************************************
- * Copyright (c) 2009 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.
- *
- * Contributors:
- * Oracle - initial API and implementation
- ******************************************************************************/
-package org.eclipse.jpt.eclipselink.ui.internal.mappings.details;
-
-import org.eclipse.jpt.eclipselink.core.context.VariableOneToOneMapping;
-import org.eclipse.jpt.ui.WidgetFactory;
-import org.eclipse.jpt.ui.details.JpaComposite;
-import org.eclipse.jpt.ui.internal.widgets.FormPane;
-import org.eclipse.jpt.utility.model.value.PropertyValueModel;
-import org.eclipse.swt.widgets.Composite;
-
-/**
- *
- * @version 2.2
- * @since 2.2
- */
-public class VariableOneToOneMappingComposite extends FormPane<VariableOneToOneMapping>
- implements JpaComposite
-{
- /**
- * Creates a new <code>EclipseLinkBasicCollectionMappingComposite</code>.
- *
- * @param subjectHolder The holder of the subject <code>IManyToOneMapping</code>
- * @param parent The parent container
- * @param widgetFactory The factory used to create various common widgets
- */
- public VariableOneToOneMappingComposite(PropertyValueModel<? extends VariableOneToOneMapping> subjectHolder,
- Composite parent,
- WidgetFactory widgetFactory) {
-
- super(subjectHolder, parent, widgetFactory);
- }
-
- @Override
- protected void initializeLayout(Composite container) {
-
- }
-}
diff --git a/jpa/plugins/org.eclipse.jpt.eclipselink.ui/src/org/eclipse/jpt/eclipselink/ui/internal/orm/details/ConvertersComposite.java b/jpa/plugins/org.eclipse.jpt.eclipselink.ui/src/org/eclipse/jpt/eclipselink/ui/internal/orm/details/ConvertersComposite.java
deleted file mode 100644
index e977fe940e..0000000000
--- a/jpa/plugins/org.eclipse.jpt.eclipselink.ui/src/org/eclipse/jpt/eclipselink/ui/internal/orm/details/ConvertersComposite.java
+++ /dev/null
@@ -1,407 +0,0 @@
-/*******************************************************************************
- * Copyright (c) 2008 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.
- *
- * Contributors:
- * Oracle - initial API and implementation
- ******************************************************************************/
-package org.eclipse.jpt.eclipselink.ui.internal.orm.details;
-
-import java.util.ArrayList;
-import java.util.Iterator;
-import java.util.List;
-import java.util.ListIterator;
-import org.eclipse.jface.viewers.ILabelProvider;
-import org.eclipse.jface.viewers.LabelProvider;
-import org.eclipse.jface.window.Window;
-import org.eclipse.jpt.eclipselink.core.context.CustomConverter;
-import org.eclipse.jpt.eclipselink.core.context.EclipseLinkConverter;
-import org.eclipse.jpt.eclipselink.core.context.ObjectTypeConverter;
-import org.eclipse.jpt.eclipselink.core.context.StructConverter;
-import org.eclipse.jpt.eclipselink.core.context.TypeConverter;
-import org.eclipse.jpt.eclipselink.core.internal.context.orm.ConverterHolder;
-import org.eclipse.jpt.eclipselink.ui.internal.mappings.details.CustomConverterComposite;
-import org.eclipse.jpt.eclipselink.ui.internal.mappings.details.ObjectTypeConverterComposite;
-import org.eclipse.jpt.eclipselink.ui.internal.mappings.details.StructConverterComposite;
-import org.eclipse.jpt.eclipselink.ui.internal.mappings.details.TypeConverterComposite;
-import org.eclipse.jpt.ui.internal.util.ControlSwitcher;
-import org.eclipse.jpt.ui.internal.widgets.AddRemoveListPane;
-import org.eclipse.jpt.ui.internal.widgets.FormPane;
-import org.eclipse.jpt.ui.internal.widgets.Pane;
-import org.eclipse.jpt.ui.internal.widgets.AddRemovePane.Adapter;
-import org.eclipse.jpt.utility.internal.Transformer;
-import org.eclipse.jpt.utility.internal.iterators.TransformationIterator;
-import org.eclipse.jpt.utility.internal.model.value.CompositeListValueModel;
-import org.eclipse.jpt.utility.internal.model.value.ItemPropertyListValueModelAdapter;
-import org.eclipse.jpt.utility.internal.model.value.ListAspectAdapter;
-import org.eclipse.jpt.utility.internal.model.value.SimplePropertyValueModel;
-import org.eclipse.jpt.utility.internal.model.value.TransformationPropertyValueModel;
-import org.eclipse.jpt.utility.internal.model.value.swing.ObjectListSelectionModel;
-import org.eclipse.jpt.utility.model.value.ListValueModel;
-import org.eclipse.jpt.utility.model.value.PropertyValueModel;
-import org.eclipse.jpt.utility.model.value.WritablePropertyValueModel;
-import org.eclipse.swt.SWT;
-import org.eclipse.swt.layout.GridData;
-import org.eclipse.swt.widgets.Composite;
-import org.eclipse.swt.widgets.Control;
-import org.eclipse.ui.part.PageBook;
-
-/**
- * This pane shows the list of named queries and named native queries.
- * <p>
- * Here the layout of this pane:
- * <pre>
- * -----------------------------------------------------------------------------
- * | ------------------------------------------------------------------------- |
- * | | | |
- * | | AddRemoveListPane | |
- * | | | |
- * | ------------------------------------------------------------------------- |
- * | ------------------------------------------------------------------------- |
- * | | | |
- * | | ConverterComposite or ObjectTypeConverterComposite | |
- * | | or StructConverterComposite or TypeConverterComposite | |
- * | | | |
- * | ------------------------------------------------------------------------- |
- * -----------------------------------------------------------------------------</pre>
- *
- * @see Entity
- * @see Query
- * @see NamedNativeQuery
- * @see NamedQuery
- * @see AbstractEntityComposite - The parent container
- * @see NamedNativeQueryPropertyComposite
- * @see NamedQueryPropertyComposite
- *
- * @version 2.1
- * @since 2.1
- */
-public class ConvertersComposite extends Pane<ConverterHolder>
-{
- private AddRemoveListPane<ConverterHolder> listPane;
- private CustomConverterComposite converterComposite;
- private ObjectTypeConverterComposite objectTypeConverterComposite;
- private StructConverterComposite structConverterComposite;
- private TypeConverterComposite typeConverterComposite;
- private WritablePropertyValueModel<EclipseLinkConverter> selectedConverterHolder;
-
- public ConvertersComposite(
- FormPane<?> parentPane,
- PropertyValueModel<? extends ConverterHolder> subjectHolder,
- Composite parent) {
-
- super(parentPane, subjectHolder, parent, false);
- }
-
- @Override
- protected void initialize() {
- super.initialize();
- this.selectedConverterHolder = buildSelectedConverterHolder();
- }
-
- private WritablePropertyValueModel<EclipseLinkConverter> buildSelectedConverterHolder() {
- return new SimplePropertyValueModel<EclipseLinkConverter>();
- }
-
- @Override
- protected void initializeLayout(Composite container) {
-
- // List pane
- this.listPane = addListPane(container);
-
- // Property pane
- PageBook pageBook = new PageBook(container, SWT.NULL);
- pageBook.setLayoutData(new GridData(GridData.FILL_HORIZONTAL));
-
- this.converterComposite = new CustomConverterComposite(
- buildCustomConverterHolder(),
- pageBook,
- getWidgetFactory()
- );
- registerSubPane(this.converterComposite);
-
- this.objectTypeConverterComposite = new ObjectTypeConverterComposite(
- buildObjectTypeConverterHolder(),
- pageBook,
- getWidgetFactory()
- );
- registerSubPane(this.objectTypeConverterComposite);
-
- this.structConverterComposite = new StructConverterComposite(
- buildStructConverterHolder(),
- pageBook,
- getWidgetFactory()
- );
- registerSubPane(this.structConverterComposite);
-
- this.typeConverterComposite = new TypeConverterComposite(
- buildTypeConverterHolder(),
- pageBook,
- getWidgetFactory()
- );
- registerSubPane(this.typeConverterComposite);
-
- installPaneSwitcher(pageBook);
- }
-
- private AddRemoveListPane<ConverterHolder> addListPane(Composite container) {
-
- return new AddRemoveListPane<ConverterHolder>(
- this,
- container,
- buildConvertersAdapter(),
- buildDisplayableConvertersListHolder(),
- this.selectedConverterHolder,
- buildConvertersListLabelProvider(),
- null//JpaHelpContextIds.MAPPING_NAMED_QUERIES
- ) {
- //TODO yeah, this is weird, but i don't want this to be disabled just
- //because the subject is null. i have no need for that and that is
- //currently how AddRemovePane works. See OrmQueriesComposite where
- //the work around there is yet another pane enabler. I want to change
- //how this works in 2.2
- @Override
- public void enableWidgets(boolean enabled) {
- super.enableWidgets(true);
- }
- };
- }
-
- private void installPaneSwitcher(PageBook pageBook) {
- new ControlSwitcher(this.selectedConverterHolder, buildPaneTransformer(), pageBook);
- }
-
- private Adapter buildConvertersAdapter() {
-
- return new AddRemoveListPane.AbstractAdapter() {
-
- public void addNewItem(ObjectListSelectionModel listSelectionModel) {
- addConverter();
- }
-
- public void removeSelectedItems(ObjectListSelectionModel listSelectionModel) {
- for (Object item : listSelectionModel.selectedValues()) {
- if (((EclipseLinkConverter) item).getType() == EclipseLinkConverter.CUSTOM_CONVERTER) {
- getSubject().removeCustomConverter((CustomConverter) item);
- }
- else if (((EclipseLinkConverter) item).getType() == EclipseLinkConverter.OBJECT_TYPE_CONVERTER) {
- getSubject().removeObjectTypeConverter((ObjectTypeConverter) item);
- }
- else if (((EclipseLinkConverter) item).getType() == EclipseLinkConverter.STRUCT_CONVERTER) {
- getSubject().removeStructConverter((StructConverter) item);
- }
- else if (((EclipseLinkConverter) item).getType() == EclipseLinkConverter.TYPE_CONVERTER) {
- getSubject().removeTypeConverter((TypeConverter) item);
- }
- }
- }
- };
- }
-
- private void addConverter() {
- addEclipseLinkConverterFromDialog(buildEclipseLinkConverterDialog());
- }
-
- protected EclipseLinkConverterDialog buildEclipseLinkConverterDialog() {
- return new EclipseLinkConverterDialog(getControl().getShell());
- }
-
- protected void addEclipseLinkConverterFromDialog(EclipseLinkConverterDialog dialog) {
- if (dialog.open() != Window.OK) {
- return;
- }
- String converterType = dialog.getConverterType();
- EclipseLinkConverter converter;
- if (converterType == EclipseLinkConverter.CUSTOM_CONVERTER) {
- converter = this.getSubject().addCustomConverter(getSubject().customConvertersSize());
- }
- else if (converterType == EclipseLinkConverter.OBJECT_TYPE_CONVERTER) {
- converter = this.getSubject().addObjectTypeConverter(getSubject().objectTypeConvertersSize());
- }
- else if (converterType == EclipseLinkConverter.STRUCT_CONVERTER) {
- converter = this.getSubject().addStructConverter(getSubject().structConvertersSize());
- }
- else if (converterType == EclipseLinkConverter.TYPE_CONVERTER) {
- converter = this.getSubject().addTypeConverter(getSubject().typeConvertersSize());
- }
- else {
- throw new IllegalArgumentException();
- }
- converter.setName(dialog.getName());
- this.selectedConverterHolder.setValue(converter);//so that it gets selected in the List for the user to edit
- }
-
- private Transformer<EclipseLinkConverter, Control> buildPaneTransformer() {
- return new Transformer<EclipseLinkConverter, Control>() {
- public Control transform(EclipseLinkConverter converter) {
- if (converter == null) {
- return null;
- }
-
- if (converter.getType() == EclipseLinkConverter.CUSTOM_CONVERTER) {
- return ConvertersComposite.this.converterComposite.getControl();
- }
- if (converter.getType() == EclipseLinkConverter.OBJECT_TYPE_CONVERTER) {
- return ConvertersComposite.this.objectTypeConverterComposite.getControl();
- }
- if (converter.getType() == EclipseLinkConverter.STRUCT_CONVERTER) {
- return ConvertersComposite.this.structConverterComposite.getControl();
- }
- if (converter.getType() == EclipseLinkConverter.TYPE_CONVERTER) {
- return ConvertersComposite.this.typeConverterComposite.getControl();
- }
-
- return null;
- }
- };
- }
-
- private ListValueModel<EclipseLinkConverter> buildDisplayableConvertersListHolder() {
- return new ItemPropertyListValueModelAdapter<EclipseLinkConverter>(
- buildEclipseLinkConvertersHolder(),
- EclipseLinkConverter.NAME_PROPERTY
- );
- }
-
- private ListValueModel<EclipseLinkConverter> buildEclipseLinkConvertersHolder() {
- List<ListValueModel<? extends EclipseLinkConverter>> list = new ArrayList<ListValueModel<? extends EclipseLinkConverter>>();
- list.add(buildCustomConvertersListHolder());
- list.add(buildObjectTypeConvertersListHolder());
- list.add(buildStructConvertersListHolder());
- list.add(buildTypeConvertersListHolder());
- return new CompositeListValueModel<ListValueModel<? extends EclipseLinkConverter>, EclipseLinkConverter>(list);
- }
-
- private ListValueModel<CustomConverter> buildCustomConvertersListHolder() {
- return new ListAspectAdapter<ConverterHolder, CustomConverter>(
- getSubjectHolder(),
- ConverterHolder.CUSTOM_CONVERTERS_LIST)
- {
- @Override
- protected ListIterator<CustomConverter> listIterator_() {
- return this.subject.customConverters();
- }
-
- @Override
- protected int size_() {
- return this.subject.customConvertersSize();
- }
- };
- }
-
- private ListValueModel<ObjectTypeConverter> buildObjectTypeConvertersListHolder() {
- return new ListAspectAdapter<ConverterHolder, ObjectTypeConverter>(
- getSubjectHolder(),
- ConverterHolder.OBJECT_TYPE_CONVERTERS_LIST)
- {
- @Override
- protected ListIterator<ObjectTypeConverter> listIterator_() {
- return this.subject.objectTypeConverters();
- }
-
- @Override
- protected int size_() {
- return this.subject.objectTypeConvertersSize();
- }
- };
- }
-
- private ListValueModel<StructConverter> buildStructConvertersListHolder() {
- return new ListAspectAdapter<ConverterHolder, StructConverter>(
- getSubjectHolder(),
- ConverterHolder.STRUCT_CONVERTERS_LIST)
- {
- @Override
- protected ListIterator<StructConverter> listIterator_() {
- return this.subject.structConverters();
- }
-
- @Override
- protected int size_() {
- return this.subject.structConvertersSize();
- }
- };
- }
-
- private ListValueModel<TypeConverter> buildTypeConvertersListHolder() {
- return new ListAspectAdapter<ConverterHolder, TypeConverter>(
- getSubjectHolder(),
- ConverterHolder.TYPE_CONVERTERS_LIST)
- {
- @Override
- protected ListIterator<TypeConverter> listIterator_() {
- return this.subject.typeConverters();
- }
-
- @Override
- protected int size_() {
- return this.subject.typeConvertersSize();
- }
- };
- }
-
- private PropertyValueModel<CustomConverter> buildCustomConverterHolder() {
- return new TransformationPropertyValueModel<EclipseLinkConverter, CustomConverter>(this.selectedConverterHolder) {
- @Override
- protected CustomConverter transform_(EclipseLinkConverter value) {
- return value.getType() == EclipseLinkConverter.CUSTOM_CONVERTER ? (CustomConverter) value : null;
- }
- };
- }
-
- private PropertyValueModel<ObjectTypeConverter> buildObjectTypeConverterHolder() {
- return new TransformationPropertyValueModel<EclipseLinkConverter, ObjectTypeConverter>(this.selectedConverterHolder) {
- @Override
- protected ObjectTypeConverter transform_(EclipseLinkConverter value) {
- return value.getType() == EclipseLinkConverter.OBJECT_TYPE_CONVERTER ? (ObjectTypeConverter) value : null;
- }
- };
- }
-
- private PropertyValueModel<StructConverter> buildStructConverterHolder() {
- return new TransformationPropertyValueModel<EclipseLinkConverter, StructConverter>(this.selectedConverterHolder) {
- @Override
- protected StructConverter transform_(EclipseLinkConverter value) {
- return value.getType() == EclipseLinkConverter.STRUCT_CONVERTER ? (StructConverter) value : null;
- }
- };
- }
-
- private PropertyValueModel<TypeConverter> buildTypeConverterHolder() {
- return new TransformationPropertyValueModel<EclipseLinkConverter, TypeConverter>(this.selectedConverterHolder) {
- @Override
- protected TypeConverter transform_(EclipseLinkConverter value) {
- return value.getType() == EclipseLinkConverter.TYPE_CONVERTER ? (TypeConverter) value : null;
- }
- };
- }
-
- private ILabelProvider buildConvertersListLabelProvider() {
- return new LabelProvider() {
- @Override
- public String getText(Object element) {
- return ((EclipseLinkConverter) element).getName();
- }
- };
- }
-
- @Override
- public void enableWidgets(boolean enabled) {
- super.enableWidgets(enabled);
- this.listPane.enableWidgets(enabled);
- }
-
- //TODO need to check the converter repository for this, should check all converters, except for the override case, hmm
- //we at least need to check typeconverters, converters, structconverters, and objectypeconverters, on this particular
- //object. or we need to give a warning about the case where you are overriding or an error if it's not an override?
- private Iterator<String> converterNames() {
- return new TransformationIterator<CustomConverter, String>(getSubject().customConverters()) {
- @Override
- protected String transform(CustomConverter next) {
- return next.getName();
- }
- };
- }
-} \ No newline at end of file
diff --git a/jpa/plugins/org.eclipse.jpt.eclipselink.ui/src/org/eclipse/jpt/eclipselink/ui/internal/orm/details/EclipseLinkConverterDialog.java b/jpa/plugins/org.eclipse.jpt.eclipselink.ui/src/org/eclipse/jpt/eclipselink/ui/internal/orm/details/EclipseLinkConverterDialog.java
deleted file mode 100644
index 080ed59bbe..0000000000
--- a/jpa/plugins/org.eclipse.jpt.eclipselink.ui/src/org/eclipse/jpt/eclipselink/ui/internal/orm/details/EclipseLinkConverterDialog.java
+++ /dev/null
@@ -1,195 +0,0 @@
-/*******************************************************************************
- * Copyright (c) 2008 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.
- *
- * Contributors:
- * Oracle - initial API and implementation
- ******************************************************************************/
-package org.eclipse.jpt.eclipselink.ui.internal.orm.details;
-
-import java.util.ArrayList;
-import java.util.List;
-import org.eclipse.jpt.eclipselink.core.context.EclipseLinkConverter;
-import org.eclipse.jpt.eclipselink.ui.internal.mappings.EclipseLinkUiMappingsMessages;
-import org.eclipse.jpt.ui.internal.widgets.DialogPane;
-import org.eclipse.jpt.ui.internal.widgets.ValidatingDialog;
-import org.eclipse.jpt.utility.internal.StringConverter;
-import org.eclipse.jpt.utility.internal.model.value.PropertyAspectAdapter;
-import org.eclipse.jpt.utility.internal.model.value.StaticListValueModel;
-import org.eclipse.jpt.utility.model.value.ListValueModel;
-import org.eclipse.jpt.utility.model.value.WritablePropertyValueModel;
-import org.eclipse.swt.widgets.Composite;
-import org.eclipse.swt.widgets.Shell;
-import org.eclipse.swt.widgets.Text;
-
-/**
- * Clients can use this dialog to prompt the user for SecondaryTable settings.
- * Use the following once the dialog is closed:
- * @see #getSelectedTable()
- * @see #getSelectedCatalog()
- * @see #getSelectedSchema()
- * @version 2.1
- * @since 2.1
- */
-public class EclipseLinkConverterDialog extends ValidatingDialog<EclipseLinkConverterStateObject> {
-
-
- // ********** constructors **********
-
- /**
- * Use this constructor to edit an existing conversion value
- */
- public EclipseLinkConverterDialog(Shell parent) {
- super(parent);
- }
-
- @Override
- protected EclipseLinkConverterStateObject buildStateObject() {
- return new EclipseLinkConverterStateObject();
- }
-
- // ********** open **********
-
- @Override
- protected void configureShell(Shell shell) {
- super.configureShell(shell);
- shell.setText(this.getTitle());
- }
-
- @Override
- protected String getTitle() {
- return EclipseLinkUiMappingsMessages.EclipseLinkConverterDialog_addConverter;
- }
-
- @Override
- protected String getDescriptionTitle() {
- return EclipseLinkUiMappingsMessages.EclipseLinkConverterDialog_addConverterDescriptionTitle;
- }
-
- @Override
- protected String getDescription() {
- return EclipseLinkUiMappingsMessages.EclipseLinkConverterDialog_addConverterDescription;
- }
-
- @Override
- protected DialogPane<EclipseLinkConverterStateObject> buildLayout(Composite container) {
- return new ConversionValueDialogPane(container);
- }
-
- @Override
- public void create() {
- super.create();
-
- ConversionValueDialogPane pane = (ConversionValueDialogPane) getPane();
- pane.selectAll();
-
- getButton(OK).setEnabled(false);
- }
-
-
- // ********** public API **********
-
- /**
- * Return the data value set in the text widget.
- */
- public String getName() {
- return getSubject().getName();
- }
-
- /**
- * Return the object value set in the text widget.
- */
- public String getConverterType() {
- return getSubject().getConverterType();
- }
-
- private class ConversionValueDialogPane extends DialogPane<EclipseLinkConverterStateObject> {
-
- private Text nameText;
-
- ConversionValueDialogPane(Composite parent) {
- super(EclipseLinkConverterDialog.this.getSubjectHolder(), parent);
- }
-
- @Override
- protected void initializeLayout(Composite container) {
- this.nameText = addLabeledText(
- container,
- EclipseLinkUiMappingsMessages.EclipseLinkConverterDialog_name,
- buildNameHolder()
- );
-
- addLabeledCombo(
- container,
- EclipseLinkUiMappingsMessages.EclipseLinkConverterDialog_converterType,
- buildConverterTypeListHolder(),
- buildConverterTypeHolder(),
- buildStringConverter(),
- null);
- }
-
- protected ListValueModel<String> buildConverterTypeListHolder() {
- List<String> converterTypes = new ArrayList<String>();
- converterTypes.add(EclipseLinkConverter.CUSTOM_CONVERTER);
- converterTypes.add(EclipseLinkConverter.OBJECT_TYPE_CONVERTER);
- converterTypes.add(EclipseLinkConverter.STRUCT_CONVERTER);
- converterTypes.add(EclipseLinkConverter.TYPE_CONVERTER);
-
- return new StaticListValueModel<String>(converterTypes);
- }
-
- private StringConverter<String> buildStringConverter() {
- return new StringConverter<String>() {
- public String convertToString(String value) {
- if (value == EclipseLinkConverter.CUSTOM_CONVERTER) {
- return EclipseLinkUiMappingsMessages.ConvertersComposite_customConverter;
- }
- if (value == EclipseLinkConverter.OBJECT_TYPE_CONVERTER) {
- return EclipseLinkUiMappingsMessages.ConvertersComposite_objectTypeConverter;
- }
- if (value == EclipseLinkConverter.STRUCT_CONVERTER) {
- return EclipseLinkUiMappingsMessages.ConvertersComposite_structConverter;
- }
- if (value == EclipseLinkConverter.TYPE_CONVERTER) {
- return EclipseLinkUiMappingsMessages.ConvertersComposite_typeConverter;
- }
- return value;
- }
- };
- }
-
- private WritablePropertyValueModel<String> buildNameHolder() {
- return new PropertyAspectAdapter<EclipseLinkConverterStateObject, String>(getSubjectHolder(), EclipseLinkConverterStateObject.NAME_PROPERTY) {
- @Override
- protected String buildValue_() {
- return this.subject.getName();
- }
-
- @Override
- protected void setValue_(String value) {
- this.subject.setName(value);
- }
- };
- }
-
- private WritablePropertyValueModel<String> buildConverterTypeHolder() {
- return new PropertyAspectAdapter<EclipseLinkConverterStateObject, String>(getSubjectHolder(), EclipseLinkConverterStateObject.CONVERTER_TYPE_PROPERTY) {
- @Override
- protected String buildValue_() {
- return this.subject.getConverterType();
- }
-
- @Override
- protected void setValue_(String value) {
- this.subject.setConverterType(value);
- }
- };
- }
-
- void selectAll() {
- this.nameText.selectAll();
- }
- }
-}
diff --git a/jpa/plugins/org.eclipse.jpt.eclipselink.ui/src/org/eclipse/jpt/eclipselink/ui/internal/orm/details/EclipseLinkConverterStateObject.java b/jpa/plugins/org.eclipse.jpt.eclipselink.ui/src/org/eclipse/jpt/eclipselink/ui/internal/orm/details/EclipseLinkConverterStateObject.java
deleted file mode 100644
index 06a2a5b36b..0000000000
--- a/jpa/plugins/org.eclipse.jpt.eclipselink.ui/src/org/eclipse/jpt/eclipselink/ui/internal/orm/details/EclipseLinkConverterStateObject.java
+++ /dev/null
@@ -1,125 +0,0 @@
-/*******************************************************************************
- * Copyright (c) 2008 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.
- *
- * Contributors:
- * Oracle - initial API and implementation
- ******************************************************************************/
-package org.eclipse.jpt.eclipselink.ui.internal.orm.details;
-
-import java.util.List;
-import org.eclipse.jpt.eclipselink.ui.internal.mappings.EclipseLinkUiMappingsMessages;
-import org.eclipse.jpt.utility.internal.StringTools;
-import org.eclipse.jpt.utility.internal.node.AbstractNode;
-import org.eclipse.jpt.utility.internal.node.Node;
-import org.eclipse.jpt.utility.internal.node.Problem;
-
-/**
- * This is the state object used by the <code>EclipseLinkConverterDialog</code>, which stores
- * the current name and validates it when it is modified.
- *
- * @see EclipseLinkConverterDialog
- *
- * @version 2.1
- * @since 2.1
- */
-final class EclipseLinkConverterStateObject extends AbstractNode
-{
- /**
- * The initial name or <code>null</code>
- */
- private String name;
-
- /**
- * The initial converterType or <code>null</code>
- */
- private String converterType;
-
- /**
- * The <code>Validator</code> used to validate this state object.
- */
- private Validator validator;
-
- /**
- * Notifies a change in the data value property.
- */
- static final String NAME_PROPERTY = "name"; //$NON-NLS-1$
-
- /**
- * Notifies a change in the object value property.
- */
- static final String CONVERTER_TYPE_PROPERTY = "converterType"; //$NON-NLS-1$
-
- /**
- * Creates a new <code>NewNameStateObject</code>.
- *
- * @param name The initial input or <code>null</code> if no initial value can
- * be specified
- * @param names The collection of names that can't be used or an empty
- * collection if none are available
- */
- EclipseLinkConverterStateObject() {
- super(null);
-
- }
-
- private void addNameProblemsTo(List<Problem> currentProblems) {
- if (StringTools.stringIsEmpty(this.name)) {
- currentProblems.add(buildProblem(EclipseLinkUiMappingsMessages.EclipseLinkConverterStateObject_nameMustBeSpecified));
- }
- }
-
- private void addConverterTypeProblemsTo(List<Problem> currentProblems) {
- if (StringTools.stringIsEmpty(this.converterType)) {
- currentProblems.add(buildProblem(EclipseLinkUiMappingsMessages.EclipseLinkConverterStateObject_typeMustBeSpecified));
- }
- }
-
- @Override
- protected void addProblemsTo(List<Problem> currentProblems) {
- super.addProblemsTo(currentProblems);
- addNameProblemsTo(currentProblems);
- addConverterTypeProblemsTo(currentProblems);
- }
-
- @Override
- protected void checkParent(@SuppressWarnings("unused") Node parentNode) {
- //no parent
- }
-
- public String displayString() {
- return null;
- }
-
- String getName() {
- return this.name;
- }
-
- String getConverterType() {
- return this.converterType;
- }
-
- public void setName(String newName) {
- String oldName = this.name;
- this.name = newName;
- firePropertyChanged(NAME_PROPERTY, oldName, newName);
- }
-
- public void setConverterType(String newConverterType) {
- String oldConverterType = this.converterType;
- this.converterType = newConverterType;
- firePropertyChanged(CONVERTER_TYPE_PROPERTY, oldConverterType, newConverterType);
- }
-
- @Override
- public void setValidator(Validator validator) {
- this.validator = validator;
- }
-
- @Override
- public Validator getValidator() {
- return this.validator;
- }
-}
diff --git a/jpa/plugins/org.eclipse.jpt.eclipselink.ui/src/org/eclipse/jpt/eclipselink/ui/internal/orm/details/EclipseLinkEntityMappingsDetailsProvider.java b/jpa/plugins/org.eclipse.jpt.eclipselink.ui/src/org/eclipse/jpt/eclipselink/ui/internal/orm/details/EclipseLinkEntityMappingsDetailsProvider.java
deleted file mode 100644
index 53a501193d..0000000000
--- a/jpa/plugins/org.eclipse.jpt.eclipselink.ui/src/org/eclipse/jpt/eclipselink/ui/internal/orm/details/EclipseLinkEntityMappingsDetailsProvider.java
+++ /dev/null
@@ -1,64 +0,0 @@
-/*******************************************************************************
- * Copyright (c) 2009 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.
- *
- * Contributors:
- * Oracle - initial API and implementation
- ******************************************************************************/
-package org.eclipse.jpt.eclipselink.ui.internal.orm.details;
-
-import org.eclipse.core.runtime.content.IContentType;
-import org.eclipse.jpt.core.JpaStructureNode;
-import org.eclipse.jpt.core.context.orm.OrmStructureNodes;
-import org.eclipse.jpt.eclipselink.core.internal.JptEclipseLinkCorePlugin;
-import org.eclipse.jpt.ui.WidgetFactory;
-import org.eclipse.jpt.ui.details.JpaDetailsPage;
-import org.eclipse.jpt.ui.details.JpaDetailsProvider;
-import org.eclipse.swt.widgets.Composite;
-
-/**
- * This provider is responsible for creating the {@link JpaDetailsPage}
- * when the information comes from the XML file (either from the persistence
- * configuration or from the Mappings Descriptor).
- *
- * @version 2.2
- * @since 2.2
- */
-public class EclipseLinkEntityMappingsDetailsProvider
- implements JpaDetailsProvider
-{
- // singleton
- private static final JpaDetailsProvider INSTANCE = new EclipseLinkEntityMappingsDetailsProvider();
-
- /**
- * Return the singleton.
- */
- public static JpaDetailsProvider instance() {
- return INSTANCE;
- }
-
- /**
- * Ensure single instance.
- */
- private EclipseLinkEntityMappingsDetailsProvider() {
- super();
- }
-
- public String getId() {
- return OrmStructureNodes.ENTITY_MAPPINGS_ID;
- }
-
- public IContentType getContentType() {
- return JptEclipseLinkCorePlugin.ECLIPSELINK_ORM_XML_CONTENT_TYPE;
- }
-
- public JpaDetailsPage<? extends JpaStructureNode> buildDetailsPage(
- Composite parent,
- WidgetFactory widgetFactory) {
-
- return new EntityMappingsDetailsPage(parent, widgetFactory);
- }
-
-}
diff --git a/jpa/plugins/org.eclipse.jpt.eclipselink.ui/src/org/eclipse/jpt/eclipselink/ui/internal/orm/details/EclipseLinkOrmBasicCollectionMappingUiProvider.java b/jpa/plugins/org.eclipse.jpt.eclipselink.ui/src/org/eclipse/jpt/eclipselink/ui/internal/orm/details/EclipseLinkOrmBasicCollectionMappingUiProvider.java
deleted file mode 100644
index da586ead21..0000000000
--- a/jpa/plugins/org.eclipse.jpt.eclipselink.ui/src/org/eclipse/jpt/eclipselink/ui/internal/orm/details/EclipseLinkOrmBasicCollectionMappingUiProvider.java
+++ /dev/null
@@ -1,56 +0,0 @@
-/*******************************************************************************
- * Copyright (c) 2009 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.
- *
- * Contributors:
- * Oracle - initial API and implementation
- ******************************************************************************/
-package org.eclipse.jpt.eclipselink.ui.internal.orm.details;
-
-import org.eclipse.core.runtime.content.IContentType;
-import org.eclipse.jpt.eclipselink.core.context.BasicCollectionMapping;
-import org.eclipse.jpt.eclipselink.core.internal.JptEclipseLinkCorePlugin;
-import org.eclipse.jpt.eclipselink.ui.internal.mappings.details.BasicCollectionMappingComposite;
-import org.eclipse.jpt.eclipselink.ui.internal.mappings.details.EclipseLinkBasicCollectionMappingUiProvider;
-import org.eclipse.jpt.ui.JpaUiFactory;
-import org.eclipse.jpt.ui.WidgetFactory;
-import org.eclipse.jpt.ui.details.AttributeMappingUiProvider;
-import org.eclipse.jpt.ui.details.JpaComposite;
-import org.eclipse.jpt.utility.model.value.PropertyValueModel;
-import org.eclipse.swt.widgets.Composite;
-
-public class EclipseLinkOrmBasicCollectionMappingUiProvider extends EclipseLinkBasicCollectionMappingUiProvider<BasicCollectionMapping>
-{
- // singleton
- private static final EclipseLinkOrmBasicCollectionMappingUiProvider INSTANCE =
- new EclipseLinkOrmBasicCollectionMappingUiProvider();
-
- /**
- * Return the singleton.
- */
- public static AttributeMappingUiProvider<BasicCollectionMapping> instance() {
- return INSTANCE;
- }
-
-
- /**
- * Ensure single instance.
- */
- private EclipseLinkOrmBasicCollectionMappingUiProvider() {
- super();
- }
-
- public IContentType getContentType() {
- return JptEclipseLinkCorePlugin.ECLIPSELINK_ORM_XML_CONTENT_TYPE;
- }
-
- public JpaComposite buildAttributeMappingComposite(
- JpaUiFactory factory,
- PropertyValueModel<BasicCollectionMapping> subjectHolder,
- Composite parent,
- WidgetFactory widgetFactory) {
- return new BasicCollectionMappingComposite(subjectHolder, parent, widgetFactory);
- }
-}
diff --git a/jpa/plugins/org.eclipse.jpt.eclipselink.ui/src/org/eclipse/jpt/eclipselink/ui/internal/orm/details/EclipseLinkOrmBasicMapMappingUiProvider.java b/jpa/plugins/org.eclipse.jpt.eclipselink.ui/src/org/eclipse/jpt/eclipselink/ui/internal/orm/details/EclipseLinkOrmBasicMapMappingUiProvider.java
deleted file mode 100644
index 7a74315372..0000000000
--- a/jpa/plugins/org.eclipse.jpt.eclipselink.ui/src/org/eclipse/jpt/eclipselink/ui/internal/orm/details/EclipseLinkOrmBasicMapMappingUiProvider.java
+++ /dev/null
@@ -1,56 +0,0 @@
-/*******************************************************************************
- * Copyright (c) 2009 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.
- *
- * Contributors:
- * Oracle - initial API and implementation
- ******************************************************************************/
-package org.eclipse.jpt.eclipselink.ui.internal.orm.details;
-
-import org.eclipse.core.runtime.content.IContentType;
-import org.eclipse.jpt.eclipselink.core.context.BasicMapMapping;
-import org.eclipse.jpt.eclipselink.core.internal.JptEclipseLinkCorePlugin;
-import org.eclipse.jpt.eclipselink.ui.internal.mappings.details.BasicMapMappingComposite;
-import org.eclipse.jpt.eclipselink.ui.internal.mappings.details.EclipseLinkBasicMapMappingUiProvider;
-import org.eclipse.jpt.ui.JpaUiFactory;
-import org.eclipse.jpt.ui.WidgetFactory;
-import org.eclipse.jpt.ui.details.AttributeMappingUiProvider;
-import org.eclipse.jpt.ui.details.JpaComposite;
-import org.eclipse.jpt.utility.model.value.PropertyValueModel;
-import org.eclipse.swt.widgets.Composite;
-
-public class EclipseLinkOrmBasicMapMappingUiProvider extends EclipseLinkBasicMapMappingUiProvider<BasicMapMapping>
-{
- // singleton
- private static final EclipseLinkOrmBasicMapMappingUiProvider INSTANCE =
- new EclipseLinkOrmBasicMapMappingUiProvider();
-
- /**
- * Return the singleton.
- */
- public static AttributeMappingUiProvider<BasicMapMapping> instance() {
- return INSTANCE;
- }
-
-
- /**
- * Ensure single instance.
- */
- private EclipseLinkOrmBasicMapMappingUiProvider() {
- super();
- }
-
- public IContentType getContentType() {
- return JptEclipseLinkCorePlugin.ECLIPSELINK_ORM_XML_CONTENT_TYPE;
- }
-
- public JpaComposite buildAttributeMappingComposite(
- JpaUiFactory factory,
- PropertyValueModel<BasicMapMapping> subjectHolder,
- Composite parent,
- WidgetFactory widgetFactory) {
- return new BasicMapMappingComposite(subjectHolder, parent, widgetFactory);
- }
-}
diff --git a/jpa/plugins/org.eclipse.jpt.eclipselink.ui/src/org/eclipse/jpt/eclipselink/ui/internal/orm/details/EclipseLinkOrmBasicMappingComposite.java b/jpa/plugins/org.eclipse.jpt.eclipselink.ui/src/org/eclipse/jpt/eclipselink/ui/internal/orm/details/EclipseLinkOrmBasicMappingComposite.java
deleted file mode 100644
index 0c30f3e226..0000000000
--- a/jpa/plugins/org.eclipse.jpt.eclipselink.ui/src/org/eclipse/jpt/eclipselink/ui/internal/orm/details/EclipseLinkOrmBasicMappingComposite.java
+++ /dev/null
@@ -1,44 +0,0 @@
-/*******************************************************************************
- * Copyright (c) 2008 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.
- *
- * Contributors:
- * Oracle - initial API and implementation
- ******************************************************************************/
-package org.eclipse.jpt.eclipselink.ui.internal.orm.details;
-
-import org.eclipse.jpt.core.context.BasicMapping;
-import org.eclipse.jpt.eclipselink.core.context.Convert;
-import org.eclipse.jpt.eclipselink.ui.internal.mappings.details.EclipseLinkBasicMappingComposite;
-import org.eclipse.jpt.ui.WidgetFactory;
-import org.eclipse.jpt.ui.internal.widgets.Pane;
-import org.eclipse.jpt.utility.model.value.PropertyValueModel;
-import org.eclipse.swt.widgets.Composite;
-
-//Temporary to remove the Converters section from orm basic mapping.
-//This is supported in EclipseLink in version 1.1, but not 1.0
-public class EclipseLinkOrmBasicMappingComposite extends EclipseLinkBasicMappingComposite
-{
- /**
- * Creates a new <code>EclipseLinkOrmBasicMappingComposite</code>.
- *
- * @param subjectHolder The holder of the subject <code>BasicMapping</code>
- * @param parent The parent container
- * @param widgetFactory The factory used to create various common widgets
- */
- public EclipseLinkOrmBasicMappingComposite(PropertyValueModel<? extends BasicMapping> subjectHolder,
- Composite parent,
- WidgetFactory widgetFactory) {
-
- super(subjectHolder, parent, widgetFactory);
- }
-
- @Override
- //everything but the 'Defaine Converter' section. This is not supported in eclipselink 1.0, but is in 1.1
- protected Pane<Convert> buildConvertComposite(PropertyValueModel<Convert> convertHolder, Composite container) {
- return new OrmConvertComposite(convertHolder, container, getWidgetFactory());
- }
-
-} \ No newline at end of file
diff --git a/jpa/plugins/org.eclipse.jpt.eclipselink.ui/src/org/eclipse/jpt/eclipselink/ui/internal/orm/details/EclipseLinkOrmBasicMappingUiProvider.java b/jpa/plugins/org.eclipse.jpt.eclipselink.ui/src/org/eclipse/jpt/eclipselink/ui/internal/orm/details/EclipseLinkOrmBasicMappingUiProvider.java
deleted file mode 100644
index 75cab0e614..0000000000
--- a/jpa/plugins/org.eclipse.jpt.eclipselink.ui/src/org/eclipse/jpt/eclipselink/ui/internal/orm/details/EclipseLinkOrmBasicMappingUiProvider.java
+++ /dev/null
@@ -1,57 +0,0 @@
-/*******************************************************************************
- * Copyright (c) 2008 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.
- *
- * Contributors:
- * Oracle - initial API and implementation
- ******************************************************************************/
-package org.eclipse.jpt.eclipselink.ui.internal.orm.details;
-
-import org.eclipse.core.runtime.content.IContentType;
-import org.eclipse.jpt.eclipselink.core.internal.JptEclipseLinkCorePlugin;
-import org.eclipse.jpt.eclipselink.core.internal.context.orm.EclipseLinkOrmBasicMapping;
-import org.eclipse.jpt.ui.JpaUiFactory;
-import org.eclipse.jpt.ui.WidgetFactory;
-import org.eclipse.jpt.ui.details.AttributeMappingUiProvider;
-import org.eclipse.jpt.ui.details.JpaComposite;
-import org.eclipse.jpt.ui.internal.details.AbstractBasicMappingUiProvider;
-import org.eclipse.jpt.utility.model.value.PropertyValueModel;
-import org.eclipse.swt.widgets.Composite;
-
-public class EclipseLinkOrmBasicMappingUiProvider
- extends AbstractBasicMappingUiProvider<EclipseLinkOrmBasicMapping>
-{
- // singleton
- private static final EclipseLinkOrmBasicMappingUiProvider INSTANCE =
- new EclipseLinkOrmBasicMappingUiProvider();
-
- /**
- * Return the singleton.
- */
- public static AttributeMappingUiProvider<EclipseLinkOrmBasicMapping> instance() {
- return INSTANCE;
- }
-
-
- /**
- * Ensure single instance.
- */
- private EclipseLinkOrmBasicMappingUiProvider() {
- super();
- }
-
- public IContentType getContentType() {
- return JptEclipseLinkCorePlugin.ECLIPSELINK_ORM_XML_CONTENT_TYPE;
- }
-
- public JpaComposite buildAttributeMappingComposite(
- JpaUiFactory factory,
- PropertyValueModel<EclipseLinkOrmBasicMapping> subjectHolder,
- Composite parent,
- WidgetFactory widgetFactory) {
-
- return new EclipseLinkOrmBasicMappingComposite(subjectHolder, parent, widgetFactory);
- }
-}
diff --git a/jpa/plugins/org.eclipse.jpt.eclipselink.ui/src/org/eclipse/jpt/eclipselink/ui/internal/orm/details/EclipseLinkOrmEmbeddableComposite.java b/jpa/plugins/org.eclipse.jpt.eclipselink.ui/src/org/eclipse/jpt/eclipselink/ui/internal/orm/details/EclipseLinkOrmEmbeddableComposite.java
deleted file mode 100644
index 4acf4c41a6..0000000000
--- a/jpa/plugins/org.eclipse.jpt.eclipselink.ui/src/org/eclipse/jpt/eclipselink/ui/internal/orm/details/EclipseLinkOrmEmbeddableComposite.java
+++ /dev/null
@@ -1,100 +0,0 @@
-/*******************************************************************************
- * Copyright (c) 2008, 2009 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.
- *
- * Contributors:
- * Oracle - initial API and implementation
- ******************************************************************************/
-package org.eclipse.jpt.eclipselink.ui.internal.orm.details;
-
-import org.eclipse.jpt.core.context.AccessHolder;
-import org.eclipse.jpt.eclipselink.core.internal.context.orm.ConverterHolder;
-import org.eclipse.jpt.eclipselink.core.internal.context.orm.EclipseLinkOrmEmbeddable;
-import org.eclipse.jpt.eclipselink.ui.internal.mappings.EclipseLinkUiMappingsMessages;
-import org.eclipse.jpt.eclipselink.ui.internal.mappings.details.EclipseLinkEmbeddableAdvancedComposite;
-import org.eclipse.jpt.ui.WidgetFactory;
-import org.eclipse.jpt.ui.details.JpaComposite;
-import org.eclipse.jpt.ui.internal.details.AccessTypeComposite;
-import org.eclipse.jpt.ui.internal.orm.details.MetadataCompleteComposite;
-import org.eclipse.jpt.ui.internal.orm.details.OrmJavaClassChooser;
-import org.eclipse.jpt.ui.internal.widgets.FormPane;
-import org.eclipse.jpt.utility.internal.model.value.PropertyAspectAdapter;
-import org.eclipse.jpt.utility.model.value.PropertyValueModel;
-import org.eclipse.swt.widgets.Composite;
-
-/**
- * This pane does not have any widgets.
- *
- * @see Embeddable
- * @see BaseJpaUiFactory - The factory creating this pane
- * @see EmbeddableUiProvider
- *
- * @version 2.1
- * @since 2.1
- */
-public class EclipseLinkOrmEmbeddableComposite extends FormPane<EclipseLinkOrmEmbeddable>
- implements JpaComposite
-{
- /**
- * Creates a new <code>EmbeddableComposite</code>.
- *
- * @param subjectHolder The holder of this pane's subject
- * @param parent The parent container
- * @param widgetFactory The factory used to create various common widgets
- */
- public EclipseLinkOrmEmbeddableComposite(PropertyValueModel<? extends EclipseLinkOrmEmbeddable> subjectHolder,
- Composite parent,
- WidgetFactory widgetFactory) {
-
- super(subjectHolder, parent, widgetFactory);
- }
-
- @Override
- protected void initializeLayout(Composite container) {
- initializeGeneralPane(container);
- initializeConvertersPane(container);
- initializeAdvancedPane(container);
- }
-
- protected void initializeGeneralPane(Composite container) {
- new OrmJavaClassChooser(this, getSubjectHolder(), container);
- new AccessTypeComposite(this, buildAccessHolder(), container);
- new MetadataCompleteComposite(this, getSubjectHolder(), container);
- }
-
- protected PropertyValueModel<AccessHolder> buildAccessHolder() {
- return new PropertyAspectAdapter<EclipseLinkOrmEmbeddable, AccessHolder>(
- getSubjectHolder())
- {
- @Override
- protected AccessHolder buildValue_() {
- return this.subject.getPersistentType();
- }
- };
- }
-
- protected void initializeConvertersPane(Composite container) {
-
- container = addCollapsableSection(
- addSubPane(container, 5),
- EclipseLinkUiMappingsMessages.ConvertersComposite_Label
- );
-
- new ConvertersComposite(this, buildConverterHolder(), container);
- }
-
- private PropertyValueModel<ConverterHolder> buildConverterHolder() {
- return new PropertyAspectAdapter<EclipseLinkOrmEmbeddable, ConverterHolder>(getSubjectHolder()) {
- @Override
- protected ConverterHolder buildValue_() {
- return this.subject.getConverterHolder();
- }
- };
- }
-
- protected void initializeAdvancedPane(Composite container) {
- new EclipseLinkEmbeddableAdvancedComposite(this, container);
- }
-} \ No newline at end of file
diff --git a/jpa/plugins/org.eclipse.jpt.eclipselink.ui/src/org/eclipse/jpt/eclipselink/ui/internal/orm/details/EclipseLinkOrmEmbeddableUiProvider.java b/jpa/plugins/org.eclipse.jpt.eclipselink.ui/src/org/eclipse/jpt/eclipselink/ui/internal/orm/details/EclipseLinkOrmEmbeddableUiProvider.java
deleted file mode 100644
index d14553a5b2..0000000000
--- a/jpa/plugins/org.eclipse.jpt.eclipselink.ui/src/org/eclipse/jpt/eclipselink/ui/internal/orm/details/EclipseLinkOrmEmbeddableUiProvider.java
+++ /dev/null
@@ -1,57 +0,0 @@
-/*******************************************************************************
- * Copyright (c) 2008 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
- *
- * Contributors:
- * Oracle - initial API and implementation
- *******************************************************************************/
-package org.eclipse.jpt.eclipselink.ui.internal.orm.details;
-
-import org.eclipse.core.runtime.content.IContentType;
-import org.eclipse.jpt.eclipselink.core.internal.JptEclipseLinkCorePlugin;
-import org.eclipse.jpt.eclipselink.core.internal.context.orm.EclipseLinkOrmEmbeddable;
-import org.eclipse.jpt.ui.JpaUiFactory;
-import org.eclipse.jpt.ui.WidgetFactory;
-import org.eclipse.jpt.ui.details.JpaComposite;
-import org.eclipse.jpt.ui.details.TypeMappingUiProvider;
-import org.eclipse.jpt.ui.internal.details.AbstractEmbeddableUiProvider;
-import org.eclipse.jpt.utility.model.value.PropertyValueModel;
-import org.eclipse.swt.widgets.Composite;
-
-public class EclipseLinkOrmEmbeddableUiProvider
- extends AbstractEmbeddableUiProvider<EclipseLinkOrmEmbeddable>
-{
- // singleton
- private static final EclipseLinkOrmEmbeddableUiProvider INSTANCE =
- new EclipseLinkOrmEmbeddableUiProvider();
-
- /**
- * Return the singleton.
- */
- public static TypeMappingUiProvider<EclipseLinkOrmEmbeddable> instance() {
- return INSTANCE;
- }
-
-
- /**
- * Ensure single instance.
- */
- private EclipseLinkOrmEmbeddableUiProvider() {
- super();
- }
-
- public IContentType getContentType() {
- return JptEclipseLinkCorePlugin.ECLIPSELINK_ORM_XML_CONTENT_TYPE;
- }
-
- public JpaComposite buildPersistentTypeMappingComposite(
- JpaUiFactory factory,
- PropertyValueModel<EclipseLinkOrmEmbeddable> subjectHolder,
- Composite parent,
- WidgetFactory widgetFactory) {
- return new EclipseLinkOrmEmbeddableComposite(subjectHolder, parent, widgetFactory);
- }
-}
diff --git a/jpa/plugins/org.eclipse.jpt.eclipselink.ui/src/org/eclipse/jpt/eclipselink/ui/internal/orm/details/EclipseLinkOrmEmbeddedIdMappingUiProvider.java b/jpa/plugins/org.eclipse.jpt.eclipselink.ui/src/org/eclipse/jpt/eclipselink/ui/internal/orm/details/EclipseLinkOrmEmbeddedIdMappingUiProvider.java
deleted file mode 100644
index c395af16e5..0000000000
--- a/jpa/plugins/org.eclipse.jpt.eclipselink.ui/src/org/eclipse/jpt/eclipselink/ui/internal/orm/details/EclipseLinkOrmEmbeddedIdMappingUiProvider.java
+++ /dev/null
@@ -1,57 +0,0 @@
-/*******************************************************************************
- * Copyright (c) 2009 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
- *
- * Contributors:
- * Oracle - initial API and implementation
- *******************************************************************************/
-package org.eclipse.jpt.eclipselink.ui.internal.orm.details;
-
-import org.eclipse.core.runtime.content.IContentType;
-import org.eclipse.jpt.core.context.orm.OrmEmbeddedIdMapping;
-import org.eclipse.jpt.eclipselink.core.internal.JptEclipseLinkCorePlugin;
-import org.eclipse.jpt.ui.JpaUiFactory;
-import org.eclipse.jpt.ui.WidgetFactory;
-import org.eclipse.jpt.ui.details.AttributeMappingUiProvider;
-import org.eclipse.jpt.ui.details.JpaComposite;
-import org.eclipse.jpt.ui.internal.details.AbstractEmbeddedIdMappingUiProvider;
-import org.eclipse.jpt.utility.model.value.PropertyValueModel;
-import org.eclipse.swt.widgets.Composite;
-
-public class EclipseLinkOrmEmbeddedIdMappingUiProvider
- extends AbstractEmbeddedIdMappingUiProvider<OrmEmbeddedIdMapping>
-{
- // singleton
- private static final EclipseLinkOrmEmbeddedIdMappingUiProvider INSTANCE =
- new EclipseLinkOrmEmbeddedIdMappingUiProvider();
-
- /**
- * Return the singleton.
- */
- public static AttributeMappingUiProvider<OrmEmbeddedIdMapping> instance() {
- return INSTANCE;
- }
-
-
- /**
- * Ensure single instance.
- */
- private EclipseLinkOrmEmbeddedIdMappingUiProvider() {
- super();
- }
-
- public IContentType getContentType() {
- return JptEclipseLinkCorePlugin.ECLIPSELINK_ORM_XML_CONTENT_TYPE;
- }
-
- public JpaComposite buildAttributeMappingComposite(
- JpaUiFactory factory,
- PropertyValueModel<OrmEmbeddedIdMapping> subjectHolder,
- Composite parent,
- WidgetFactory widgetFactory) {
- return factory.createOrmEmbeddedIdMappingComposite(subjectHolder, parent, widgetFactory);
- }
-}
diff --git a/jpa/plugins/org.eclipse.jpt.eclipselink.ui/src/org/eclipse/jpt/eclipselink/ui/internal/orm/details/EclipseLinkOrmEmbeddedMappingUiProvider.java b/jpa/plugins/org.eclipse.jpt.eclipselink.ui/src/org/eclipse/jpt/eclipselink/ui/internal/orm/details/EclipseLinkOrmEmbeddedMappingUiProvider.java
deleted file mode 100644
index a1eeea0b32..0000000000
--- a/jpa/plugins/org.eclipse.jpt.eclipselink.ui/src/org/eclipse/jpt/eclipselink/ui/internal/orm/details/EclipseLinkOrmEmbeddedMappingUiProvider.java
+++ /dev/null
@@ -1,57 +0,0 @@
-/*******************************************************************************
- * Copyright (c) 2009 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
- *
- * Contributors:
- * Oracle - initial API and implementation
- *******************************************************************************/
-package org.eclipse.jpt.eclipselink.ui.internal.orm.details;
-
-import org.eclipse.core.runtime.content.IContentType;
-import org.eclipse.jpt.core.context.orm.OrmEmbeddedMapping;
-import org.eclipse.jpt.eclipselink.core.internal.JptEclipseLinkCorePlugin;
-import org.eclipse.jpt.ui.JpaUiFactory;
-import org.eclipse.jpt.ui.WidgetFactory;
-import org.eclipse.jpt.ui.details.AttributeMappingUiProvider;
-import org.eclipse.jpt.ui.details.JpaComposite;
-import org.eclipse.jpt.ui.internal.details.AbstractEmbeddedMappingUiProvider;
-import org.eclipse.jpt.utility.model.value.PropertyValueModel;
-import org.eclipse.swt.widgets.Composite;
-
-public class EclipseLinkOrmEmbeddedMappingUiProvider
- extends AbstractEmbeddedMappingUiProvider<OrmEmbeddedMapping>
-{
- // singleton
- private static final EclipseLinkOrmEmbeddedMappingUiProvider INSTANCE =
- new EclipseLinkOrmEmbeddedMappingUiProvider();
-
- /**
- * Return the singleton.
- */
- public static AttributeMappingUiProvider<OrmEmbeddedMapping> instance() {
- return INSTANCE;
- }
-
-
- /**
- * Ensure single instance.
- */
- private EclipseLinkOrmEmbeddedMappingUiProvider() {
- super();
- }
-
- public IContentType getContentType() {
- return JptEclipseLinkCorePlugin.ECLIPSELINK_ORM_XML_CONTENT_TYPE;
- }
-
- public JpaComposite buildAttributeMappingComposite(
- JpaUiFactory factory,
- PropertyValueModel<OrmEmbeddedMapping> subjectHolder,
- Composite parent,
- WidgetFactory widgetFactory) {
- return factory.createOrmEmbeddedMappingComposite(subjectHolder, parent, widgetFactory);
- }
-}
diff --git a/jpa/plugins/org.eclipse.jpt.eclipselink.ui/src/org/eclipse/jpt/eclipselink/ui/internal/orm/details/EclipseLinkOrmEntityComposite.java b/jpa/plugins/org.eclipse.jpt.eclipselink.ui/src/org/eclipse/jpt/eclipselink/ui/internal/orm/details/EclipseLinkOrmEntityComposite.java
deleted file mode 100644
index f266640c89..0000000000
--- a/jpa/plugins/org.eclipse.jpt.eclipselink.ui/src/org/eclipse/jpt/eclipselink/ui/internal/orm/details/EclipseLinkOrmEntityComposite.java
+++ /dev/null
@@ -1,127 +0,0 @@
-/*******************************************************************************
- * Copyright (c) 2008, 2009 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
- *
- * Contributors:
- * Oracle - initial API and implementation
- *******************************************************************************/
-package org.eclipse.jpt.eclipselink.ui.internal.orm.details;
-
-import org.eclipse.jpt.core.context.AccessHolder;
-import org.eclipse.jpt.core.context.orm.OrmEntity;
-import org.eclipse.jpt.eclipselink.core.context.Caching;
-import org.eclipse.jpt.eclipselink.core.internal.context.orm.ConverterHolder;
-import org.eclipse.jpt.eclipselink.core.internal.context.orm.EclipseLinkOrmEntity;
-import org.eclipse.jpt.eclipselink.ui.internal.mappings.EclipseLinkUiMappingsMessages;
-import org.eclipse.jpt.eclipselink.ui.internal.mappings.details.EclipseLinkEntityAdvancedComposite;
-import org.eclipse.jpt.ui.WidgetFactory;
-import org.eclipse.jpt.ui.internal.details.AccessTypeComposite;
-import org.eclipse.jpt.ui.internal.mappings.details.AbstractEntityComposite;
-import org.eclipse.jpt.ui.internal.mappings.details.EntityNameComposite;
-import org.eclipse.jpt.ui.internal.mappings.details.IdClassComposite;
-import org.eclipse.jpt.ui.internal.mappings.details.TableComposite;
-import org.eclipse.jpt.ui.internal.orm.details.MetadataCompleteComposite;
-import org.eclipse.jpt.ui.internal.orm.details.OrmInheritanceComposite;
-import org.eclipse.jpt.ui.internal.orm.details.OrmJavaClassChooser;
-import org.eclipse.jpt.ui.internal.orm.details.OrmSecondaryTablesComposite;
-import org.eclipse.jpt.utility.internal.model.value.PropertyAspectAdapter;
-import org.eclipse.jpt.utility.model.value.PropertyValueModel;
-import org.eclipse.swt.widgets.Composite;
-
-public class EclipseLinkOrmEntityComposite extends AbstractEntityComposite<OrmEntity>
-{
- public EclipseLinkOrmEntityComposite(
- PropertyValueModel<? extends OrmEntity> subjectHolder,
- Composite parent, WidgetFactory widgetFactory) {
- super(subjectHolder, parent, widgetFactory);
- }
-
-
- @Override
- protected void initializeLayout(Composite container) {
- initializeGeneralPane(container);
- initializeCachingPane(container);
- initializeQueriesPane(container);
- initializeInheritancePane(container);
- initializeAttributeOverridesPane(container);
- initializeGeneratorsPane(container);
- initializeConvertersPane(container);
- initializeSecondaryTablesPane(container);
- initializeAdvancedPane(container);
- }
-
- @Override
- protected void initializeGeneralPane(Composite container) {
- int groupBoxMargin = getGroupBoxMargin();
-
- new OrmJavaClassChooser(this, getSubjectHolder(), addSubPane(container, 0, groupBoxMargin, 0, groupBoxMargin), false);
- new TableComposite(this, container);
- new EntityNameComposite(this, addSubPane(container, 0, groupBoxMargin, 0, groupBoxMargin));
- new AccessTypeComposite(this, buildAccessHolder(), addSubPane(container, 0, groupBoxMargin, 0, groupBoxMargin));
- new IdClassComposite(this, addSubPane(container, 0, groupBoxMargin, 0, groupBoxMargin), false);
- new MetadataCompleteComposite(this, getSubjectHolder(), addSubPane(container, 0, groupBoxMargin, 0, groupBoxMargin));
- }
-
- protected PropertyValueModel<AccessHolder> buildAccessHolder() {
- return new PropertyAspectAdapter<OrmEntity, AccessHolder>(
- getSubjectHolder())
- {
- @Override
- protected AccessHolder buildValue_() {
- return this.subject.getPersistentType();
- }
- };
- }
-
- protected void initializeCachingPane(Composite container) {
- container = addCollapsableSection(
- addSubPane(container, 5),
- EclipseLinkUiMappingsMessages.EclipseLinkTypeMappingComposite_caching);
- new OrmCachingComposite(this, buildCachingHolder(), container);
- }
-
- private PropertyAspectAdapter<OrmEntity, Caching> buildCachingHolder() {
- return new PropertyAspectAdapter<OrmEntity, Caching>(getSubjectHolder()) {
- @Override
- protected Caching buildValue_() {
- return ((EclipseLinkOrmEntity) this.subject).getCaching();
- }
- };
- }
-
- @Override
- protected void addInheritanceComposite(Composite container) {
- new OrmInheritanceComposite(this, container);
- }
-
- @Override
- protected void addSecondaryTablesComposite(Composite container) {
- new OrmSecondaryTablesComposite(this, container);
- }
-
- protected void initializeConvertersPane(Composite container) {
-
- container = addCollapsableSection(
- container,
- EclipseLinkUiMappingsMessages.ConvertersComposite_Label
- );
-
- new ConvertersComposite(this, buildConverterHolder(), container);
- }
-
- private PropertyValueModel<ConverterHolder> buildConverterHolder() {
- return new PropertyAspectAdapter<OrmEntity, ConverterHolder>(getSubjectHolder()) {
- @Override
- protected ConverterHolder buildValue_() {
- return ((EclipseLinkOrmEntity) this.subject).getConverterHolder();
- }
- };
- }
-
- protected void initializeAdvancedPane(Composite container) {
- new EclipseLinkEntityAdvancedComposite(this, container);
- }
-}
diff --git a/jpa/plugins/org.eclipse.jpt.eclipselink.ui/src/org/eclipse/jpt/eclipselink/ui/internal/orm/details/EclipseLinkOrmEntityUiProvider.java b/jpa/plugins/org.eclipse.jpt.eclipselink.ui/src/org/eclipse/jpt/eclipselink/ui/internal/orm/details/EclipseLinkOrmEntityUiProvider.java
deleted file mode 100644
index bcdc7fbfb3..0000000000
--- a/jpa/plugins/org.eclipse.jpt.eclipselink.ui/src/org/eclipse/jpt/eclipselink/ui/internal/orm/details/EclipseLinkOrmEntityUiProvider.java
+++ /dev/null
@@ -1,57 +0,0 @@
-/*******************************************************************************
- * Copyright (c) 2008 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
- *
- * Contributors:
- * Oracle - initial API and implementation
- *******************************************************************************/
-package org.eclipse.jpt.eclipselink.ui.internal.orm.details;
-
-import org.eclipse.core.runtime.content.IContentType;
-import org.eclipse.jpt.eclipselink.core.internal.JptEclipseLinkCorePlugin;
-import org.eclipse.jpt.eclipselink.core.internal.context.orm.EclipseLinkOrmEntity;
-import org.eclipse.jpt.ui.JpaUiFactory;
-import org.eclipse.jpt.ui.WidgetFactory;
-import org.eclipse.jpt.ui.details.JpaComposite;
-import org.eclipse.jpt.ui.details.TypeMappingUiProvider;
-import org.eclipse.jpt.ui.internal.details.AbstractEntityUiProvider;
-import org.eclipse.jpt.utility.model.value.PropertyValueModel;
-import org.eclipse.swt.widgets.Composite;
-
-public class EclipseLinkOrmEntityUiProvider
- extends AbstractEntityUiProvider<EclipseLinkOrmEntity>
-{
- // singleton
- private static final EclipseLinkOrmEntityUiProvider INSTANCE =
- new EclipseLinkOrmEntityUiProvider();
-
- /**
- * Return the singleton.
- */
- public static TypeMappingUiProvider<EclipseLinkOrmEntity> instance() {
- return INSTANCE;
- }
-
- public IContentType getContentType() {
- return JptEclipseLinkCorePlugin.ECLIPSELINK_ORM_XML_CONTENT_TYPE;
- }
-
- /**
- * Ensure single instance.
- */
- private EclipseLinkOrmEntityUiProvider() {
- super();
- }
-
-
- public JpaComposite buildPersistentTypeMappingComposite(
- JpaUiFactory factory,
- PropertyValueModel<EclipseLinkOrmEntity> subjectHolder,
- Composite parent,
- WidgetFactory widgetFactory) {
- return new EclipseLinkOrmEntityComposite(subjectHolder, parent, widgetFactory);
- }
-}
diff --git a/jpa/plugins/org.eclipse.jpt.eclipselink.ui/src/org/eclipse/jpt/eclipselink/ui/internal/orm/details/EclipseLinkOrmIdMappingComposite.java b/jpa/plugins/org.eclipse.jpt.eclipselink.ui/src/org/eclipse/jpt/eclipselink/ui/internal/orm/details/EclipseLinkOrmIdMappingComposite.java
deleted file mode 100644
index 47b78e4ec6..0000000000
--- a/jpa/plugins/org.eclipse.jpt.eclipselink.ui/src/org/eclipse/jpt/eclipselink/ui/internal/orm/details/EclipseLinkOrmIdMappingComposite.java
+++ /dev/null
@@ -1,43 +0,0 @@
-/*******************************************************************************
- * Copyright (c) 2008 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.
- *
- * Contributors:
- * Oracle - initial API and implementation
- ******************************************************************************/
-package org.eclipse.jpt.eclipselink.ui.internal.orm.details;
-
-import org.eclipse.jpt.core.context.IdMapping;
-import org.eclipse.jpt.eclipselink.core.context.Convert;
-import org.eclipse.jpt.eclipselink.ui.internal.mappings.details.EclipseLinkIdMappingComposite;
-import org.eclipse.jpt.ui.WidgetFactory;
-import org.eclipse.jpt.ui.internal.widgets.Pane;
-import org.eclipse.jpt.utility.model.value.PropertyValueModel;
-import org.eclipse.swt.widgets.Composite;
-
-//Removing the Converters section from EclipseLink 1.0 orm basic mapping.
-//This is supported in EclipseLink in version 1.1, but not 1.0
-public class EclipseLinkOrmIdMappingComposite extends EclipseLinkIdMappingComposite
-{
- /**
- * Creates a new <code>EclipseLinkOrmIdMappingComposite</code>.
- *
- * @param subjectHolder The holder of the subject <code>IdMapping</code>
- * @param parent The parent container
- * @param widgetFactory The factory used to create various common widgets
- */
- public EclipseLinkOrmIdMappingComposite(PropertyValueModel<? extends IdMapping> subjectHolder,
- Composite parent,
- WidgetFactory widgetFactory) {
-
- super(subjectHolder, parent, widgetFactory);
- }
-
- @Override
- //everything but the 'Define Converter' section. This is not supported in eclipselink 1.0, but is in 1.1
- protected Pane<Convert> buildConvertComposite(PropertyValueModel<Convert> convertHolder, Composite container) {
- return new OrmConvertComposite(convertHolder, container, getWidgetFactory());
- }
-} \ No newline at end of file
diff --git a/jpa/plugins/org.eclipse.jpt.eclipselink.ui/src/org/eclipse/jpt/eclipselink/ui/internal/orm/details/EclipseLinkOrmIdMappingUiProvider.java b/jpa/plugins/org.eclipse.jpt.eclipselink.ui/src/org/eclipse/jpt/eclipselink/ui/internal/orm/details/EclipseLinkOrmIdMappingUiProvider.java
deleted file mode 100644
index 463e4f4521..0000000000
--- a/jpa/plugins/org.eclipse.jpt.eclipselink.ui/src/org/eclipse/jpt/eclipselink/ui/internal/orm/details/EclipseLinkOrmIdMappingUiProvider.java
+++ /dev/null
@@ -1,56 +0,0 @@
-/*******************************************************************************
- * Copyright (c) 2008 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.
- *
- * Contributors:
- * Oracle - initial API and implementation
- ******************************************************************************/
-package org.eclipse.jpt.eclipselink.ui.internal.orm.details;
-
-import org.eclipse.core.runtime.content.IContentType;
-import org.eclipse.jpt.eclipselink.core.internal.JptEclipseLinkCorePlugin;
-import org.eclipse.jpt.eclipselink.core.internal.context.orm.EclipseLinkOrmIdMapping;
-import org.eclipse.jpt.ui.JpaUiFactory;
-import org.eclipse.jpt.ui.WidgetFactory;
-import org.eclipse.jpt.ui.details.AttributeMappingUiProvider;
-import org.eclipse.jpt.ui.details.JpaComposite;
-import org.eclipse.jpt.ui.internal.details.AbstractIdMappingUiProvider;
-import org.eclipse.jpt.utility.model.value.PropertyValueModel;
-import org.eclipse.swt.widgets.Composite;
-
-public class EclipseLinkOrmIdMappingUiProvider
- extends AbstractIdMappingUiProvider<EclipseLinkOrmIdMapping>
-{
- // singleton
- private static final EclipseLinkOrmIdMappingUiProvider INSTANCE =
- new EclipseLinkOrmIdMappingUiProvider();
-
- /**
- * Return the singleton.
- */
- public static AttributeMappingUiProvider<EclipseLinkOrmIdMapping> instance() {
- return INSTANCE;
- }
-
-
- /**
- * Ensure single instance.
- */
- private EclipseLinkOrmIdMappingUiProvider() {
- super();
- }
-
- public IContentType getContentType() {
- return JptEclipseLinkCorePlugin.ECLIPSELINK_ORM_XML_CONTENT_TYPE;
- }
-
- public JpaComposite buildAttributeMappingComposite(
- JpaUiFactory factory,
- PropertyValueModel<EclipseLinkOrmIdMapping> subjectHolder,
- Composite parent,
- WidgetFactory widgetFactory) {
- return new EclipseLinkOrmIdMappingComposite(subjectHolder, parent, widgetFactory);
- }
-}
diff --git a/jpa/plugins/org.eclipse.jpt.eclipselink.ui/src/org/eclipse/jpt/eclipselink/ui/internal/orm/details/EclipseLinkOrmManyToManyMappingUiProvider.java b/jpa/plugins/org.eclipse.jpt.eclipselink.ui/src/org/eclipse/jpt/eclipselink/ui/internal/orm/details/EclipseLinkOrmManyToManyMappingUiProvider.java
deleted file mode 100644
index 0dd6c27a79..0000000000
--- a/jpa/plugins/org.eclipse.jpt.eclipselink.ui/src/org/eclipse/jpt/eclipselink/ui/internal/orm/details/EclipseLinkOrmManyToManyMappingUiProvider.java
+++ /dev/null
@@ -1,57 +0,0 @@
-/*******************************************************************************
- * Copyright (c) 2008 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.
- *
- * Contributors:
- * Oracle - initial API and implementation
- ******************************************************************************/
-package org.eclipse.jpt.eclipselink.ui.internal.orm.details;
-
-import org.eclipse.core.runtime.content.IContentType;
-import org.eclipse.jpt.eclipselink.core.internal.JptEclipseLinkCorePlugin;
-import org.eclipse.jpt.eclipselink.core.internal.context.orm.EclipseLinkOrmManyToManyMapping;
-import org.eclipse.jpt.eclipselink.ui.internal.mappings.details.EclipseLinkManyToManyMappingComposite;
-import org.eclipse.jpt.ui.JpaUiFactory;
-import org.eclipse.jpt.ui.WidgetFactory;
-import org.eclipse.jpt.ui.details.AttributeMappingUiProvider;
-import org.eclipse.jpt.ui.details.JpaComposite;
-import org.eclipse.jpt.ui.internal.details.AbstractManyToManyMappingUiProvider;
-import org.eclipse.jpt.utility.model.value.PropertyValueModel;
-import org.eclipse.swt.widgets.Composite;
-
-public class EclipseLinkOrmManyToManyMappingUiProvider
- extends AbstractManyToManyMappingUiProvider<EclipseLinkOrmManyToManyMapping>
-{
- // singleton
- private static final EclipseLinkOrmManyToManyMappingUiProvider INSTANCE =
- new EclipseLinkOrmManyToManyMappingUiProvider();
-
- /**
- * Return the singleton.
- */
- public static AttributeMappingUiProvider<EclipseLinkOrmManyToManyMapping> instance() {
- return INSTANCE;
- }
-
-
- /**
- * Ensure single instance.
- */
- private EclipseLinkOrmManyToManyMappingUiProvider() {
- super();
- }
-
- public IContentType getContentType() {
- return JptEclipseLinkCorePlugin.ECLIPSELINK_ORM_XML_CONTENT_TYPE;
- }
-
- public JpaComposite buildAttributeMappingComposite(
- JpaUiFactory factory,
- PropertyValueModel<EclipseLinkOrmManyToManyMapping> subjectHolder,
- Composite parent,
- WidgetFactory widgetFactory) {
- return new EclipseLinkManyToManyMappingComposite(subjectHolder, parent, widgetFactory);
- }
-}
diff --git a/jpa/plugins/org.eclipse.jpt.eclipselink.ui/src/org/eclipse/jpt/eclipselink/ui/internal/orm/details/EclipseLinkOrmManyToOneMappingUiProvider.java b/jpa/plugins/org.eclipse.jpt.eclipselink.ui/src/org/eclipse/jpt/eclipselink/ui/internal/orm/details/EclipseLinkOrmManyToOneMappingUiProvider.java
deleted file mode 100644
index 37de5db03a..0000000000
--- a/jpa/plugins/org.eclipse.jpt.eclipselink.ui/src/org/eclipse/jpt/eclipselink/ui/internal/orm/details/EclipseLinkOrmManyToOneMappingUiProvider.java
+++ /dev/null
@@ -1,57 +0,0 @@
-/*******************************************************************************
- * Copyright (c) 2008 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.
- *
- * Contributors:
- * Oracle - initial API and implementation
- ******************************************************************************/
-package org.eclipse.jpt.eclipselink.ui.internal.orm.details;
-
-import org.eclipse.core.runtime.content.IContentType;
-import org.eclipse.jpt.eclipselink.core.internal.JptEclipseLinkCorePlugin;
-import org.eclipse.jpt.eclipselink.core.internal.context.orm.EclipseLinkOrmManyToOneMapping;
-import org.eclipse.jpt.eclipselink.ui.internal.mappings.details.EclipseLinkManyToOneMappingComposite;
-import org.eclipse.jpt.ui.JpaUiFactory;
-import org.eclipse.jpt.ui.WidgetFactory;
-import org.eclipse.jpt.ui.details.AttributeMappingUiProvider;
-import org.eclipse.jpt.ui.details.JpaComposite;
-import org.eclipse.jpt.ui.internal.details.AbstractManyToOneMappingUiProvider;
-import org.eclipse.jpt.utility.model.value.PropertyValueModel;
-import org.eclipse.swt.widgets.Composite;
-
-public class EclipseLinkOrmManyToOneMappingUiProvider
- extends AbstractManyToOneMappingUiProvider<EclipseLinkOrmManyToOneMapping>
-{
- // singleton
- private static final EclipseLinkOrmManyToOneMappingUiProvider INSTANCE =
- new EclipseLinkOrmManyToOneMappingUiProvider();
-
- /**
- * Return the singleton.
- */
- public static AttributeMappingUiProvider<EclipseLinkOrmManyToOneMapping> instance() {
- return INSTANCE;
- }
-
-
- /**
- * Ensure single instance.
- */
- private EclipseLinkOrmManyToOneMappingUiProvider() {
- super();
- }
-
- public IContentType getContentType() {
- return JptEclipseLinkCorePlugin.ECLIPSELINK_ORM_XML_CONTENT_TYPE;
- }
-
- public JpaComposite buildAttributeMappingComposite(
- JpaUiFactory factory,
- PropertyValueModel<EclipseLinkOrmManyToOneMapping> subjectHolder,
- Composite parent,
- WidgetFactory widgetFactory) {
- return new EclipseLinkManyToOneMappingComposite(subjectHolder, parent, widgetFactory);
- }
-}
diff --git a/jpa/plugins/org.eclipse.jpt.eclipselink.ui/src/org/eclipse/jpt/eclipselink/ui/internal/orm/details/EclipseLinkOrmMappedSuperclassComposite.java b/jpa/plugins/org.eclipse.jpt.eclipselink.ui/src/org/eclipse/jpt/eclipselink/ui/internal/orm/details/EclipseLinkOrmMappedSuperclassComposite.java
deleted file mode 100644
index 79c197c900..0000000000
--- a/jpa/plugins/org.eclipse.jpt.eclipselink.ui/src/org/eclipse/jpt/eclipselink/ui/internal/orm/details/EclipseLinkOrmMappedSuperclassComposite.java
+++ /dev/null
@@ -1,108 +0,0 @@
-/*******************************************************************************
- * Copyright (c) 2008, 2009 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
- *
- * Contributors:
- * Oracle - initial API and implementation
- *******************************************************************************/
-package org.eclipse.jpt.eclipselink.ui.internal.orm.details;
-
-import org.eclipse.jpt.core.context.AccessHolder;
-import org.eclipse.jpt.eclipselink.core.context.Caching;
-import org.eclipse.jpt.eclipselink.core.internal.context.orm.ConverterHolder;
-import org.eclipse.jpt.eclipselink.core.internal.context.orm.EclipseLinkOrmMappedSuperclass;
-import org.eclipse.jpt.eclipselink.ui.internal.mappings.EclipseLinkUiMappingsMessages;
-import org.eclipse.jpt.eclipselink.ui.internal.mappings.details.EclipseLinkMappedSuperclassAdvancedComposite;
-import org.eclipse.jpt.ui.WidgetFactory;
-import org.eclipse.jpt.ui.details.JpaComposite;
-import org.eclipse.jpt.ui.internal.details.AccessTypeComposite;
-import org.eclipse.jpt.ui.internal.mappings.details.IdClassComposite;
-import org.eclipse.jpt.ui.internal.orm.details.MetadataCompleteComposite;
-import org.eclipse.jpt.ui.internal.orm.details.OrmJavaClassChooser;
-import org.eclipse.jpt.ui.internal.widgets.FormPane;
-import org.eclipse.jpt.utility.internal.model.value.PropertyAspectAdapter;
-import org.eclipse.jpt.utility.model.value.PropertyValueModel;
-import org.eclipse.swt.widgets.Composite;
-
-public class EclipseLinkOrmMappedSuperclassComposite extends FormPane<EclipseLinkOrmMappedSuperclass> implements JpaComposite
-{
- public EclipseLinkOrmMappedSuperclassComposite(
- PropertyValueModel<? extends EclipseLinkOrmMappedSuperclass> subjectHolder,
- Composite parent, WidgetFactory widgetFactory) {
- super(subjectHolder, parent, widgetFactory);
- }
-
-
- @Override
- protected void initializeLayout(Composite container) {
- initializeGeneralPane(container);
- initializeCachingPane(container);
- initializeConvertersPane(container);
- initializeAdvancedPane(container);
- }
-
- protected void initializeGeneralPane(Composite container) {
- new OrmJavaClassChooser(this, getSubjectHolder(), container);
- new AccessTypeComposite(this, buildAccessHolder(), container);
- new IdClassComposite(this, container);
- new MetadataCompleteComposite(this, getSubjectHolder(), container);
- }
-
- protected PropertyValueModel<AccessHolder> buildAccessHolder() {
- return new PropertyAspectAdapter<EclipseLinkOrmMappedSuperclass, AccessHolder>(
- getSubjectHolder())
- {
- @Override
- protected AccessHolder buildValue_() {
- return this.subject.getPersistentType();
- }
- };
- }
-
- protected void initializeCachingPane(Composite container) {
-
- container = addCollapsableSection(
- addSubPane(container, 5),
- EclipseLinkUiMappingsMessages.EclipseLinkTypeMappingComposite_caching
- );
-
- new OrmCachingComposite(this, buildCachingHolder(), container);
- }
-
- private PropertyAspectAdapter<EclipseLinkOrmMappedSuperclass, Caching> buildCachingHolder() {
- return new PropertyAspectAdapter<EclipseLinkOrmMappedSuperclass, Caching>(
- getSubjectHolder())
- {
- @Override
- protected Caching buildValue_() {
- return this.subject.getCaching();
- }
- };
- }
-
- protected void initializeConvertersPane(Composite container) {
-
- container = addCollapsableSection(
- container,
- EclipseLinkUiMappingsMessages.ConvertersComposite_Label
- );
-
- new ConvertersComposite(this, buildConverterHolder(), container);
- }
-
- private PropertyValueModel<ConverterHolder> buildConverterHolder() {
- return new PropertyAspectAdapter<EclipseLinkOrmMappedSuperclass, ConverterHolder>(getSubjectHolder()) {
- @Override
- protected ConverterHolder buildValue_() {
- return this.subject.getConverterHolder();
- }
- };
- }
-
- protected void initializeAdvancedPane(Composite container) {
- new EclipseLinkMappedSuperclassAdvancedComposite(this, container);
- }
-}
diff --git a/jpa/plugins/org.eclipse.jpt.eclipselink.ui/src/org/eclipse/jpt/eclipselink/ui/internal/orm/details/EclipseLinkOrmMappedSuperclassUiProvider.java b/jpa/plugins/org.eclipse.jpt.eclipselink.ui/src/org/eclipse/jpt/eclipselink/ui/internal/orm/details/EclipseLinkOrmMappedSuperclassUiProvider.java
deleted file mode 100644
index 5bed698450..0000000000
--- a/jpa/plugins/org.eclipse.jpt.eclipselink.ui/src/org/eclipse/jpt/eclipselink/ui/internal/orm/details/EclipseLinkOrmMappedSuperclassUiProvider.java
+++ /dev/null
@@ -1,53 +0,0 @@
-/*******************************************************************************
- * Copyright (c) 2008 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
- *
- * Contributors:
- * Oracle - initial API and implementation
- *******************************************************************************/
-package org.eclipse.jpt.eclipselink.ui.internal.orm.details;
-
-import org.eclipse.core.runtime.content.IContentType;
-import org.eclipse.jpt.eclipselink.core.internal.JptEclipseLinkCorePlugin;
-import org.eclipse.jpt.eclipselink.core.internal.context.orm.EclipseLinkOrmMappedSuperclass;
-import org.eclipse.jpt.ui.JpaUiFactory;
-import org.eclipse.jpt.ui.WidgetFactory;
-import org.eclipse.jpt.ui.details.JpaComposite;
-import org.eclipse.jpt.ui.details.TypeMappingUiProvider;
-import org.eclipse.jpt.ui.internal.details.AbstractMappedSuperclassUiProvider;
-import org.eclipse.jpt.utility.model.value.PropertyValueModel;
-import org.eclipse.swt.widgets.Composite;
-
-public class EclipseLinkOrmMappedSuperclassUiProvider
- extends AbstractMappedSuperclassUiProvider<EclipseLinkOrmMappedSuperclass>
-{
- // singleton
- private static final EclipseLinkOrmMappedSuperclassUiProvider INSTANCE =
- new EclipseLinkOrmMappedSuperclassUiProvider();
-
- /**
- * Return the singleton.
- */
- public static TypeMappingUiProvider<EclipseLinkOrmMappedSuperclass> instance() {
- return INSTANCE;
- }
-
-
- /**
- * Ensure single instance.
- */
- private EclipseLinkOrmMappedSuperclassUiProvider() {
- super();
- }
-
- public IContentType getContentType() {
- return JptEclipseLinkCorePlugin.ECLIPSELINK_ORM_XML_CONTENT_TYPE;
- }
-
- public JpaComposite buildPersistentTypeMappingComposite(JpaUiFactory factory, PropertyValueModel<EclipseLinkOrmMappedSuperclass> subjectHolder, Composite parent, WidgetFactory widgetFactory) {
- return new EclipseLinkOrmMappedSuperclassComposite(subjectHolder, parent, widgetFactory);
- }
-}
diff --git a/jpa/plugins/org.eclipse.jpt.eclipselink.ui/src/org/eclipse/jpt/eclipselink/ui/internal/orm/details/EclipseLinkOrmOneToManyMappingUiProvider.java b/jpa/plugins/org.eclipse.jpt.eclipselink.ui/src/org/eclipse/jpt/eclipselink/ui/internal/orm/details/EclipseLinkOrmOneToManyMappingUiProvider.java
deleted file mode 100644
index b53b480383..0000000000
--- a/jpa/plugins/org.eclipse.jpt.eclipselink.ui/src/org/eclipse/jpt/eclipselink/ui/internal/orm/details/EclipseLinkOrmOneToManyMappingUiProvider.java
+++ /dev/null
@@ -1,57 +0,0 @@
-/*******************************************************************************
- * Copyright (c) 2008, 2009 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.
- *
- * Contributors:
- * Oracle - initial API and implementation
- ******************************************************************************/
-package org.eclipse.jpt.eclipselink.ui.internal.orm.details;
-
-import org.eclipse.core.runtime.content.IContentType;
-import org.eclipse.jpt.eclipselink.core.internal.JptEclipseLinkCorePlugin;
-import org.eclipse.jpt.eclipselink.core.internal.context.orm.EclipseLinkOrmOneToManyMapping;
-import org.eclipse.jpt.eclipselink.ui.internal.mappings.details.EclipseLinkOneToManyMappingComposite;
-import org.eclipse.jpt.ui.JpaUiFactory;
-import org.eclipse.jpt.ui.WidgetFactory;
-import org.eclipse.jpt.ui.details.AttributeMappingUiProvider;
-import org.eclipse.jpt.ui.details.JpaComposite;
-import org.eclipse.jpt.ui.internal.details.AbstractOneToManyMappingUiProvider;
-import org.eclipse.jpt.utility.model.value.PropertyValueModel;
-import org.eclipse.swt.widgets.Composite;
-
-public class EclipseLinkOrmOneToManyMappingUiProvider
- extends AbstractOneToManyMappingUiProvider<EclipseLinkOrmOneToManyMapping>
-{
- // singleton
- private static final EclipseLinkOrmOneToManyMappingUiProvider INSTANCE =
- new EclipseLinkOrmOneToManyMappingUiProvider();
-
- /**
- * Return the singleton.
- */
- public static AttributeMappingUiProvider<EclipseLinkOrmOneToManyMapping> instance() {
- return INSTANCE;
- }
-
-
- /**
- * Ensure single instance.
- */
- private EclipseLinkOrmOneToManyMappingUiProvider() {
- super();
- }
-
- public IContentType getContentType() {
- return JptEclipseLinkCorePlugin.ECLIPSELINK_ORM_XML_CONTENT_TYPE;
- }
-
- public JpaComposite buildAttributeMappingComposite(
- JpaUiFactory factory,
- PropertyValueModel<EclipseLinkOrmOneToManyMapping> subjectHolder,
- Composite parent,
- WidgetFactory widgetFactory) {
- return new EclipseLinkOneToManyMappingComposite(subjectHolder, parent, widgetFactory);
- }
-}
diff --git a/jpa/plugins/org.eclipse.jpt.eclipselink.ui/src/org/eclipse/jpt/eclipselink/ui/internal/orm/details/EclipseLinkOrmOneToOneMappingUiProvider.java b/jpa/plugins/org.eclipse.jpt.eclipselink.ui/src/org/eclipse/jpt/eclipselink/ui/internal/orm/details/EclipseLinkOrmOneToOneMappingUiProvider.java
deleted file mode 100644
index 117110c4be..0000000000
--- a/jpa/plugins/org.eclipse.jpt.eclipselink.ui/src/org/eclipse/jpt/eclipselink/ui/internal/orm/details/EclipseLinkOrmOneToOneMappingUiProvider.java
+++ /dev/null
@@ -1,57 +0,0 @@
-/*******************************************************************************
- * Copyright (c) 2008, 2009 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.
- *
- * Contributors:
- * Oracle - initial API and implementation
- ******************************************************************************/
-package org.eclipse.jpt.eclipselink.ui.internal.orm.details;
-
-import org.eclipse.core.runtime.content.IContentType;
-import org.eclipse.jpt.eclipselink.core.internal.JptEclipseLinkCorePlugin;
-import org.eclipse.jpt.eclipselink.core.internal.context.orm.EclipseLinkOrmOneToOneMapping;
-import org.eclipse.jpt.eclipselink.ui.internal.mappings.details.EclipseLinkOneToOneMappingComposite;
-import org.eclipse.jpt.ui.JpaUiFactory;
-import org.eclipse.jpt.ui.WidgetFactory;
-import org.eclipse.jpt.ui.details.AttributeMappingUiProvider;
-import org.eclipse.jpt.ui.details.JpaComposite;
-import org.eclipse.jpt.ui.internal.details.AbstractOneToOneMappingUiProvider;
-import org.eclipse.jpt.utility.model.value.PropertyValueModel;
-import org.eclipse.swt.widgets.Composite;
-
-public class EclipseLinkOrmOneToOneMappingUiProvider
- extends AbstractOneToOneMappingUiProvider<EclipseLinkOrmOneToOneMapping>
-{
- // singleton
- private static final EclipseLinkOrmOneToOneMappingUiProvider INSTANCE =
- new EclipseLinkOrmOneToOneMappingUiProvider();
-
- /**
- * Return the singleton.
- */
- public static AttributeMappingUiProvider<EclipseLinkOrmOneToOneMapping> instance() {
- return INSTANCE;
- }
-
-
- /**
- * Ensure single instance.
- */
- private EclipseLinkOrmOneToOneMappingUiProvider() {
- super();
- }
-
- public IContentType getContentType() {
- return JptEclipseLinkCorePlugin.ECLIPSELINK_ORM_XML_CONTENT_TYPE;
- }
-
- public JpaComposite buildAttributeMappingComposite(
- JpaUiFactory factory,
- PropertyValueModel<EclipseLinkOrmOneToOneMapping> subjectHolder,
- Composite parent,
- WidgetFactory widgetFactory) {
- return new EclipseLinkOneToOneMappingComposite(subjectHolder, parent, widgetFactory);
- }
-}
diff --git a/jpa/plugins/org.eclipse.jpt.eclipselink.ui/src/org/eclipse/jpt/eclipselink/ui/internal/orm/details/EclipseLinkOrmTransformationMappingUiProvider.java b/jpa/plugins/org.eclipse.jpt.eclipselink.ui/src/org/eclipse/jpt/eclipselink/ui/internal/orm/details/EclipseLinkOrmTransformationMappingUiProvider.java
deleted file mode 100644
index 854c7b6b63..0000000000
--- a/jpa/plugins/org.eclipse.jpt.eclipselink.ui/src/org/eclipse/jpt/eclipselink/ui/internal/orm/details/EclipseLinkOrmTransformationMappingUiProvider.java
+++ /dev/null
@@ -1,57 +0,0 @@
-/*******************************************************************************
- * Copyright (c) 2009 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.
- *
- * Contributors:
- * Oracle - initial API and implementation
- ******************************************************************************/
-package org.eclipse.jpt.eclipselink.ui.internal.orm.details;
-
-import org.eclipse.core.runtime.content.IContentType;
-import org.eclipse.jpt.eclipselink.core.context.TransformationMapping;
-import org.eclipse.jpt.eclipselink.core.internal.JptEclipseLinkCorePlugin;
-import org.eclipse.jpt.eclipselink.ui.internal.mappings.details.EclipseLinkTransformationMappingUiProvider;
-import org.eclipse.jpt.eclipselink.ui.internal.mappings.details.TransformationMappingComposite;
-import org.eclipse.jpt.ui.JpaUiFactory;
-import org.eclipse.jpt.ui.WidgetFactory;
-import org.eclipse.jpt.ui.details.AttributeMappingUiProvider;
-import org.eclipse.jpt.ui.details.JpaComposite;
-import org.eclipse.jpt.utility.model.value.PropertyValueModel;
-import org.eclipse.swt.widgets.Composite;
-
-public class EclipseLinkOrmTransformationMappingUiProvider extends EclipseLinkTransformationMappingUiProvider<TransformationMapping>
-{
- // singleton
- private static final EclipseLinkOrmTransformationMappingUiProvider INSTANCE =
- new EclipseLinkOrmTransformationMappingUiProvider();
-
- /**
- * Return the singleton.
- */
- public static AttributeMappingUiProvider<TransformationMapping> instance() {
- return INSTANCE;
- }
-
-
- /**
- * Ensure single instance.
- */
- private EclipseLinkOrmTransformationMappingUiProvider() {
- super();
- }
-
- public IContentType getContentType() {
- return JptEclipseLinkCorePlugin.ECLIPSELINK_ORM_XML_CONTENT_TYPE;
- }
-
- public JpaComposite buildAttributeMappingComposite(
- JpaUiFactory factory,
- PropertyValueModel<TransformationMapping> subjectHolder,
- Composite parent,
- WidgetFactory widgetFactory) {
-
- return new TransformationMappingComposite(subjectHolder, parent, widgetFactory);
- }
-}
diff --git a/jpa/plugins/org.eclipse.jpt.eclipselink.ui/src/org/eclipse/jpt/eclipselink/ui/internal/orm/details/EclipseLinkOrmTransientMappingUiProvider.java b/jpa/plugins/org.eclipse.jpt.eclipselink.ui/src/org/eclipse/jpt/eclipselink/ui/internal/orm/details/EclipseLinkOrmTransientMappingUiProvider.java
deleted file mode 100644
index 47dd82a524..0000000000
--- a/jpa/plugins/org.eclipse.jpt.eclipselink.ui/src/org/eclipse/jpt/eclipselink/ui/internal/orm/details/EclipseLinkOrmTransientMappingUiProvider.java
+++ /dev/null
@@ -1,57 +0,0 @@
-/*******************************************************************************
- * Copyright (c) 2009 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
- *
- * Contributors:
- * Oracle - initial API and implementation
- *******************************************************************************/
-package org.eclipse.jpt.eclipselink.ui.internal.orm.details;
-
-import org.eclipse.core.runtime.content.IContentType;
-import org.eclipse.jpt.core.context.orm.OrmTransientMapping;
-import org.eclipse.jpt.eclipselink.core.internal.JptEclipseLinkCorePlugin;
-import org.eclipse.jpt.ui.JpaUiFactory;
-import org.eclipse.jpt.ui.WidgetFactory;
-import org.eclipse.jpt.ui.details.AttributeMappingUiProvider;
-import org.eclipse.jpt.ui.details.JpaComposite;
-import org.eclipse.jpt.ui.internal.details.AbstractTransientMappingUiProvider;
-import org.eclipse.jpt.utility.model.value.PropertyValueModel;
-import org.eclipse.swt.widgets.Composite;
-
-public class EclipseLinkOrmTransientMappingUiProvider
- extends AbstractTransientMappingUiProvider<OrmTransientMapping>
-{
- // singleton
- private static final EclipseLinkOrmTransientMappingUiProvider INSTANCE =
- new EclipseLinkOrmTransientMappingUiProvider();
-
- /**
- * Return the singleton.
- */
- public static AttributeMappingUiProvider<OrmTransientMapping> instance() {
- return INSTANCE;
- }
-
-
- /**
- * Ensure single instance.
- */
- private EclipseLinkOrmTransientMappingUiProvider() {
- super();
- }
-
- public IContentType getContentType() {
- return JptEclipseLinkCorePlugin.ECLIPSELINK_ORM_XML_CONTENT_TYPE;
- }
-
- public JpaComposite buildAttributeMappingComposite(
- JpaUiFactory factory,
- PropertyValueModel<OrmTransientMapping> subjectHolder,
- Composite parent,
- WidgetFactory widgetFactory) {
- return factory.createOrmTransientMappingComposite(subjectHolder, parent, widgetFactory);
- }
-}
diff --git a/jpa/plugins/org.eclipse.jpt.eclipselink.ui/src/org/eclipse/jpt/eclipselink/ui/internal/orm/details/EclipseLinkOrmVariableOneToOneMappingUiProvider.java b/jpa/plugins/org.eclipse.jpt.eclipselink.ui/src/org/eclipse/jpt/eclipselink/ui/internal/orm/details/EclipseLinkOrmVariableOneToOneMappingUiProvider.java
deleted file mode 100644
index 7e0f297074..0000000000
--- a/jpa/plugins/org.eclipse.jpt.eclipselink.ui/src/org/eclipse/jpt/eclipselink/ui/internal/orm/details/EclipseLinkOrmVariableOneToOneMappingUiProvider.java
+++ /dev/null
@@ -1,56 +0,0 @@
-/*******************************************************************************
- * Copyright (c) 2009 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.
- *
- * Contributors:
- * Oracle - initial API and implementation
- ******************************************************************************/
-package org.eclipse.jpt.eclipselink.ui.internal.orm.details;
-
-import org.eclipse.core.runtime.content.IContentType;
-import org.eclipse.jpt.eclipselink.core.context.VariableOneToOneMapping;
-import org.eclipse.jpt.eclipselink.core.internal.JptEclipseLinkCorePlugin;
-import org.eclipse.jpt.eclipselink.ui.internal.mappings.details.EclipseLinkVariableOneToOneMappingUiProvider;
-import org.eclipse.jpt.eclipselink.ui.internal.mappings.details.VariableOneToOneMappingComposite;
-import org.eclipse.jpt.ui.JpaUiFactory;
-import org.eclipse.jpt.ui.WidgetFactory;
-import org.eclipse.jpt.ui.details.AttributeMappingUiProvider;
-import org.eclipse.jpt.ui.details.JpaComposite;
-import org.eclipse.jpt.utility.model.value.PropertyValueModel;
-import org.eclipse.swt.widgets.Composite;
-
-public class EclipseLinkOrmVariableOneToOneMappingUiProvider extends EclipseLinkVariableOneToOneMappingUiProvider<VariableOneToOneMapping>
-{
- // singleton
- private static final EclipseLinkOrmVariableOneToOneMappingUiProvider INSTANCE =
- new EclipseLinkOrmVariableOneToOneMappingUiProvider();
-
- /**
- * Return the singleton.
- */
- public static AttributeMappingUiProvider<VariableOneToOneMapping> instance() {
- return INSTANCE;
- }
-
-
- /**
- * Ensure single instance.
- */
- private EclipseLinkOrmVariableOneToOneMappingUiProvider() {
- super();
- }
-
- public IContentType getContentType() {
- return JptEclipseLinkCorePlugin.ECLIPSELINK_ORM_XML_CONTENT_TYPE;
- }
-
- public JpaComposite buildAttributeMappingComposite(
- JpaUiFactory factory,
- PropertyValueModel<VariableOneToOneMapping> subjectHolder,
- Composite parent,
- WidgetFactory widgetFactory) {
- return new VariableOneToOneMappingComposite(subjectHolder, parent, widgetFactory);
- }
-}
diff --git a/jpa/plugins/org.eclipse.jpt.eclipselink.ui/src/org/eclipse/jpt/eclipselink/ui/internal/orm/details/EclipseLinkOrmVersionMappingComposite.java b/jpa/plugins/org.eclipse.jpt.eclipselink.ui/src/org/eclipse/jpt/eclipselink/ui/internal/orm/details/EclipseLinkOrmVersionMappingComposite.java
deleted file mode 100644
index 233f7a996c..0000000000
--- a/jpa/plugins/org.eclipse.jpt.eclipselink.ui/src/org/eclipse/jpt/eclipselink/ui/internal/orm/details/EclipseLinkOrmVersionMappingComposite.java
+++ /dev/null
@@ -1,45 +0,0 @@
-/*******************************************************************************
- * Copyright (c) 2008 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.
- *
- * Contributors:
- * Oracle - initial API and implementation
- ******************************************************************************/
-package org.eclipse.jpt.eclipselink.ui.internal.orm.details;
-
-import org.eclipse.jpt.core.context.VersionMapping;
-import org.eclipse.jpt.eclipselink.core.context.Convert;
-import org.eclipse.jpt.eclipselink.ui.internal.mappings.details.EclipseLinkVersionMappingComposite;
-import org.eclipse.jpt.ui.WidgetFactory;
-import org.eclipse.jpt.ui.details.JpaComposite;
-import org.eclipse.jpt.ui.internal.widgets.Pane;
-import org.eclipse.jpt.utility.model.value.PropertyValueModel;
-import org.eclipse.swt.widgets.Composite;
-
-//Temporary to remove the Converters section from orm basic mapping.
-//This is supported in EclipseLink in version 1.1, but not 1.0
-public class EclipseLinkOrmVersionMappingComposite extends EclipseLinkVersionMappingComposite implements JpaComposite
-{
- /**
- * Creates a new <code>EclipseLinkOrmVersionMappingComposite</code>.
- *
- * @param subjectHolder The holder of the subject <code>VersionMapping</code>
- * @param parent The parent container
- * @param widgetFactory The factory used to create various common widgets
- */
- public EclipseLinkOrmVersionMappingComposite(PropertyValueModel<? extends VersionMapping> subjectHolder,
- Composite parent,
- WidgetFactory widgetFactory) {
-
- super(subjectHolder, parent, widgetFactory);
- }
-
-
- @Override
- //everything but the 'Defaine Converter' section. This is not supported in eclipselink 1.0, but is in 1.1
- protected Pane<Convert> buildConvertComposite(PropertyValueModel<Convert> convertHolder, Composite container) {
- return new OrmConvertComposite(convertHolder, container, getWidgetFactory());
- }
-} \ No newline at end of file
diff --git a/jpa/plugins/org.eclipse.jpt.eclipselink.ui/src/org/eclipse/jpt/eclipselink/ui/internal/orm/details/EclipseLinkOrmVersionMappingUiProvider.java b/jpa/plugins/org.eclipse.jpt.eclipselink.ui/src/org/eclipse/jpt/eclipselink/ui/internal/orm/details/EclipseLinkOrmVersionMappingUiProvider.java
deleted file mode 100644
index 0aa08dbfcf..0000000000
--- a/jpa/plugins/org.eclipse.jpt.eclipselink.ui/src/org/eclipse/jpt/eclipselink/ui/internal/orm/details/EclipseLinkOrmVersionMappingUiProvider.java
+++ /dev/null
@@ -1,56 +0,0 @@
-/*******************************************************************************
- * Copyright (c) 2008 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.
- *
- * Contributors:
- * Oracle - initial API and implementation
- ******************************************************************************/
-package org.eclipse.jpt.eclipselink.ui.internal.orm.details;
-
-import org.eclipse.core.runtime.content.IContentType;
-import org.eclipse.jpt.eclipselink.core.internal.JptEclipseLinkCorePlugin;
-import org.eclipse.jpt.eclipselink.core.internal.context.orm.EclipseLinkOrmVersionMapping;
-import org.eclipse.jpt.ui.JpaUiFactory;
-import org.eclipse.jpt.ui.WidgetFactory;
-import org.eclipse.jpt.ui.details.AttributeMappingUiProvider;
-import org.eclipse.jpt.ui.details.JpaComposite;
-import org.eclipse.jpt.ui.internal.details.AbstractVersionMappingUiProvider;
-import org.eclipse.jpt.utility.model.value.PropertyValueModel;
-import org.eclipse.swt.widgets.Composite;
-
-public class EclipseLinkOrmVersionMappingUiProvider
- extends AbstractVersionMappingUiProvider<EclipseLinkOrmVersionMapping>
-{
- // singleton
- private static final EclipseLinkOrmVersionMappingUiProvider INSTANCE =
- new EclipseLinkOrmVersionMappingUiProvider();
-
- /**
- * Return the singleton.
- */
- public static AttributeMappingUiProvider<EclipseLinkOrmVersionMapping> instance() {
- return INSTANCE;
- }
-
-
- /**
- * Ensure single instance.
- */
- private EclipseLinkOrmVersionMappingUiProvider() {
- super();
- }
-
- public IContentType getContentType() {
- return JptEclipseLinkCorePlugin.ECLIPSELINK_ORM_XML_CONTENT_TYPE;
- }
-
- public JpaComposite buildAttributeMappingComposite(
- JpaUiFactory factory,
- PropertyValueModel<EclipseLinkOrmVersionMapping> subjectHolder,
- Composite parent,
- WidgetFactory widgetFactory) {
- return new EclipseLinkOrmVersionMappingComposite(subjectHolder, parent, widgetFactory);
- }
-}
diff --git a/jpa/plugins/org.eclipse.jpt.eclipselink.ui/src/org/eclipse/jpt/eclipselink/ui/internal/orm/details/EntityMappingsDetailsPage.java b/jpa/plugins/org.eclipse.jpt.eclipselink.ui/src/org/eclipse/jpt/eclipselink/ui/internal/orm/details/EntityMappingsDetailsPage.java
deleted file mode 100644
index bf5aaa89ca..0000000000
--- a/jpa/plugins/org.eclipse.jpt.eclipselink.ui/src/org/eclipse/jpt/eclipselink/ui/internal/orm/details/EntityMappingsDetailsPage.java
+++ /dev/null
@@ -1,167 +0,0 @@
-/*******************************************************************************
- * Copyright (c) 2006, 2008 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.
- *
- * Contributors:
- * Oracle - initial API and implementation
- ******************************************************************************/
-package org.eclipse.jpt.eclipselink.ui.internal.orm.details;
-
-import org.eclipse.jpt.core.context.orm.EntityMappings;
-import org.eclipse.jpt.eclipselink.core.internal.context.orm.ConverterHolder;
-import org.eclipse.jpt.eclipselink.core.internal.context.orm.EclipseLinkEntityMappings;
-import org.eclipse.jpt.eclipselink.ui.internal.mappings.EclipseLinkUiMappingsMessages;
-import org.eclipse.jpt.ui.WidgetFactory;
-import org.eclipse.jpt.ui.internal.JpaHelpContextIds;
-import org.eclipse.jpt.ui.internal.orm.JptUiOrmMessages;
-import org.eclipse.jpt.ui.internal.orm.details.OrmGeneratorsComposite;
-import org.eclipse.jpt.ui.internal.orm.details.OrmPackageChooser;
-import org.eclipse.jpt.ui.internal.orm.details.OrmQueriesComposite;
-import org.eclipse.jpt.ui.internal.orm.details.PersistenceUnitMetadataComposite;
-import org.eclipse.jpt.utility.internal.model.value.PropertyAspectAdapter;
-import org.eclipse.jpt.utility.model.value.PropertyValueModel;
-import org.eclipse.swt.widgets.Composite;
-
-/**
- * Here the layout of this pane:
- * <pre>
- * -----------------------------------------------------------------------------
- * | ------------------------------------------------------------------------- |
- * | | | |
- * | | XmlPackageChooser | |
- * | | | |
- * | ------------------------------------------------------------------------- |
- * | ------------------------------------------------------------ |
- * | Schema: | SchemaCombo | |
- * | ------------------------------------------------------------ |
- * | ------------------------------------------------------------ |
- * | Catalog: | CatalogCombo | |
- * | ------------------------------------------------------------ |
- * | ------------------------------------------------------------ |
- * | Access Type: | |v| |
- * | ------------------------------------------------------------ |
- * | |
- * | ------------------------------------------------------------------------- |
- * | | | |
- * | | PersistenceUnitMetadataComposite | |
- * | | | |
- * | ------------------------------------------------------------------------- |
- * | ------------------------------------------------------------------------- |
- * | | | |
- * | | OrmGeneratorsComposite | |
- * | | | |
- * | ------------------------------------------------------------------------- |
- * | ------------------------------------------------------------------------- |
- * | | | |
- * | | OrmQueriesComposite | |
- * | | | |
- * | ------------------------------------------------------------------------- |
- * | ------------------------------------------------------------------------- |
- * | | | |
- * | | ConvertersComposite | |
- * | | | |
- * | ------------------------------------------------------------------------- |
- * -----------------------------------------------------------------------------</pre>
- *
- * @see EntityMappings
- * @see EntityMappingsDetailsPage - The parent container
- * @see CatalogCombo
- * @see EnumFormComboViewer
- * @see OrmGeneratorsComposite
- * @see OrmPackageChooser
- * @see OrmQueriesComposite
- * @see PersistenceUnitMetadataComposite
- * @see SchemaCombo
- *
- * @version 2.1
- * @since 2.1
- */
-public class EntityMappingsDetailsPage extends org.eclipse.jpt.ui.internal.orm.details.EntityMappingsDetailsPage
-{
- /**
- * Creates a new <code>XmlEntityMappingsDetailsPage</code>.
- *
- * @param parent The parent container
- * @param widgetFactory The factory used to create various common widgets
- */
- public EntityMappingsDetailsPage(Composite parent,
- WidgetFactory widgetFactory) {
-
- super(parent, widgetFactory);
- }
-
-
- @Override
- protected void initializeLayout(Composite container) {
-
- // Package widgets
- new OrmPackageChooser(this, container);
-
- // Schema widgets
- addLabeledComposite(
- container,
- JptUiOrmMessages.EntityMappingsDetailsPage_schema,
- addSchemaCombo(container),
- JpaHelpContextIds.ENTITY_ORM_SCHEMA
- );
-
- // Catalog widgets
- addLabeledComposite(
- container,
- JptUiOrmMessages.EntityMappingsDetailsPage_catalog,
- addCatalogCombo(container),
- JpaHelpContextIds.ENTITY_ORM_CATALOG
- );
-
- // Access Type widgets
- addLabeledComposite(
- container,
- JptUiOrmMessages.EntityMappingsDetailsPage_access,
- addAccessTypeCombo(container),
- JpaHelpContextIds.ENTITY_ORM_ACCESS
- );
-
- // Persistence Unit Metadata widgets
- new PersistenceUnitMetadataComposite(
- this,
- buildPersistentUnitMetadataHolder(),
- addSubPane(container, 5)
- );
-
- // Generators pane
- new OrmGeneratorsComposite(
- this,
- container
- );
-
- // Queries pane
- new OrmQueriesComposite(
- this,
- container
- );
-
- // Converters section
- container = addCollapsableSection(
- container,
- EclipseLinkUiMappingsMessages.ConvertersComposite_Label
- );
-
- new ConvertersComposite(
- this,
- buildConverterHolder(),
- container
- );
- }
-
- private PropertyValueModel<ConverterHolder> buildConverterHolder() {
- return new PropertyAspectAdapter<EntityMappings, ConverterHolder>(getSubjectHolder()) {
- @Override
- protected ConverterHolder buildValue_() {
- return ((EclipseLinkEntityMappings) this.subject).getConverterHolder();
- }
- };
- }
-
-} \ No newline at end of file
diff --git a/jpa/plugins/org.eclipse.jpt.eclipselink.ui/src/org/eclipse/jpt/eclipselink/ui/internal/orm/details/OrmCachingComposite.java b/jpa/plugins/org.eclipse.jpt.eclipselink.ui/src/org/eclipse/jpt/eclipselink/ui/internal/orm/details/OrmCachingComposite.java
deleted file mode 100644
index 1d4989cbb0..0000000000
--- a/jpa/plugins/org.eclipse.jpt.eclipselink.ui/src/org/eclipse/jpt/eclipselink/ui/internal/orm/details/OrmCachingComposite.java
+++ /dev/null
@@ -1,62 +0,0 @@
-/*******************************************************************************
- * Copyright (c) 2008 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.
- *
- * Contributors:
- * Oracle - initial API and implementation
- ******************************************************************************/
-package org.eclipse.jpt.eclipselink.ui.internal.orm.details;
-
-import org.eclipse.jpt.eclipselink.core.context.Caching;
-import org.eclipse.jpt.eclipselink.ui.internal.mappings.details.CachingComposite;
-import org.eclipse.jpt.ui.internal.widgets.FormPane;
-import org.eclipse.jpt.utility.model.value.PropertyValueModel;
-import org.eclipse.swt.widgets.Composite;
-
-/**
- * This pane shows the caching options.
- * <p>
- * Here the layout of this pane:
- * <pre>
- * -----------------------------------------------------------------------------
- * | x Shared |
- * | CacheTypeComposite |
- * | CacheSizeComposite |
- * | > Advanced |
- * | ExpiryComposite |
- * | AlwaysRefreshComposite |
- * | RefreshOnlyIfNewerComposite |
- * | DisableHitsComposite |
- * | CacheCoordinationComposite |
- * | ExistenceTypeComposite |
- * -----------------------------------------------------------------------------</pre>
- *
- * @see Entity
- * @see EclipseLinkCaching
- * @see EclipseLinkJavaEntityComposite - The parent container
- * @see CacheTypeComposite
- * @see CacheSizeComposite
- * @see AlwaysRefreshComposite
- * @see RefreshOnlyIfNewerComposite
- * @see DisableHitsComposite
- *
- * @version 2.1
- * @since 2.1
- */
-public class OrmCachingComposite extends CachingComposite<Caching>
-{
-
- public OrmCachingComposite(FormPane<?> parentPane,
- PropertyValueModel<Caching> subjectHolder,
- Composite parent) {
-
- super(parentPane, subjectHolder, parent);
- }
-
- @Override
- protected void initializeExistenceCheckingComposite(Composite parent) {
- new OrmExistenceCheckingComposite(this, parent);
- }
-} \ No newline at end of file
diff --git a/jpa/plugins/org.eclipse.jpt.eclipselink.ui/src/org/eclipse/jpt/eclipselink/ui/internal/orm/details/OrmConvertComposite.java b/jpa/plugins/org.eclipse.jpt.eclipselink.ui/src/org/eclipse/jpt/eclipselink/ui/internal/orm/details/OrmConvertComposite.java
deleted file mode 100644
index d03f6f068a..0000000000
--- a/jpa/plugins/org.eclipse.jpt.eclipselink.ui/src/org/eclipse/jpt/eclipselink/ui/internal/orm/details/OrmConvertComposite.java
+++ /dev/null
@@ -1,220 +0,0 @@
-/*******************************************************************************
- * Copyright (c) 2008 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
- *
- * Contributors: Oracle. - initial API and implementation
- *******************************************************************************/
-package org.eclipse.jpt.eclipselink.ui.internal.orm.details;
-
-import java.util.ArrayList;
-import java.util.ListIterator;
-import org.eclipse.jpt.eclipselink.core.context.Convert;
-import org.eclipse.jpt.eclipselink.core.internal.context.persistence.EclipseLinkPersistenceUnit;
-import org.eclipse.jpt.eclipselink.ui.internal.mappings.EclipseLinkUiMappingsMessages;
-import org.eclipse.jpt.ui.WidgetFactory;
-import org.eclipse.jpt.ui.internal.mappings.JptUiMappingsMessages;
-import org.eclipse.jpt.ui.internal.util.PaneEnabler;
-import org.eclipse.jpt.ui.internal.util.SWTUtil;
-import org.eclipse.jpt.ui.internal.widgets.FormPane;
-import org.eclipse.jpt.utility.internal.CollectionTools;
-import org.eclipse.jpt.utility.internal.StringConverter;
-import org.eclipse.jpt.utility.internal.model.value.CompositeListValueModel;
-import org.eclipse.jpt.utility.internal.model.value.ListAspectAdapter;
-import org.eclipse.jpt.utility.internal.model.value.PropertyAspectAdapter;
-import org.eclipse.jpt.utility.internal.model.value.PropertyListValueModelAdapter;
-import org.eclipse.jpt.utility.internal.model.value.StaticListValueModel;
-import org.eclipse.jpt.utility.internal.model.value.TransformationPropertyValueModel;
-import org.eclipse.jpt.utility.model.value.ListValueModel;
-import org.eclipse.jpt.utility.model.value.PropertyValueModel;
-import org.eclipse.jpt.utility.model.value.WritablePropertyValueModel;
-import org.eclipse.osgi.util.NLS;
-import org.eclipse.swt.custom.CCombo;
-import org.eclipse.swt.widgets.Composite;
-
-/**
- * Here the layout of this pane:
- * <pre>
- * -----------------------------------------------------------------------------
- * | -------------------------------------------------------------- |
- * | Converter: | |v| |
- * | -------------------------------------------------------------- |
- * -----------------------------------------------------------------------------</pre>
- *
- * @see EclipseLinkConvert
- * @see EclipseLinkBasicMappingComposite - A container of this widget
- *
- * @version 2.1
- * @since 2.1
- */
-
-//Temporary to remove the Define Converters section from orm basic, id, version mapping.
-//This is supported in EclipseLink in version 1.1, but not 1.0
-public class OrmConvertComposite extends FormPane<Convert>
-{
-
- /**
- * A key used to represent the default value, this is required to convert
- * the selected item from a combo to <code>null</code>. This key is most
- * likely never typed the user and it will help to convert the value to
- * <code>null</code> when it's time to set the new selected value into the
- * model.
- */
- protected static String DEFAULT_KEY = "?!#!?#?#?default?#?!#?!#?"; //$NON-NLS-1$
-
-
- /**
- * Creates a new <code>EnumTypeComposite</code>.
- *
- * @param parentPane The parent container of this one
- * @param parent The parent container
- */
- public OrmConvertComposite(PropertyValueModel<? extends Convert> subjectHolder,
- Composite parent,
- WidgetFactory widgetFactory) {
-
- super(subjectHolder, parent, widgetFactory);
- }
-
- @Override
- protected void initializeLayout(Composite container) {
- CCombo combo = addLabeledEditableCCombo(
- container,
- EclipseLinkUiMappingsMessages.ConvertComposite_converterNameLabel,
- buildConvertNameListHolder(),
- buildConvertNameHolder(),
- buildNameConverter(),
- null
- );
- SWTUtil.attachDefaultValueHandler(combo);
-
- new PaneEnabler(buildBooleanHolder(), this);
- }
-
- protected final WritablePropertyValueModel<String> buildConvertNameHolder() {
- return new PropertyAspectAdapter<Convert, String>(getSubjectHolder(), Convert.SPECIFIED_CONVERTER_NAME_PROPERTY) {
- @Override
- protected String buildValue_() {
- return this.subject.getSpecifiedConverterName();
- }
-
- @Override
- protected void setValue_(String value) {
- // Convert the default value or an empty string to null
- if ((value != null) &&
- ((value.length() == 0) || value.startsWith(DEFAULT_KEY))) {
-
- value = null;
- }
- this.subject.setSpecifiedConverterName(value);
- }
- };
- }
- private ListValueModel<String> buildConvertNameListHolder() {
- java.util.List<ListValueModel<String>> list = new ArrayList<ListValueModel<String>>();
- list.add(buildDefaultNameListHolder());
- list.add(buildReservedConverterNameListHolder());
- list.add(buildConverterNameListHolder());
- return new CompositeListValueModel<ListValueModel<String>, String>(list);
- }
-
- protected ListValueModel<String> buildDefaultNameListHolder() {
- return new PropertyListValueModelAdapter<String>(
- buildDefaultNameHolder()
- );
- }
-
- private WritablePropertyValueModel<String> buildDefaultNameHolder() {
- return new PropertyAspectAdapter<Convert, String>(getSubjectHolder(), Convert.DEFAULT_CONVERTER_NAME_PROPERTY) {
- @Override
- protected String buildValue_() {
- String name = this.subject.getDefaultConverterName();
-
- if (name == null) {
- name = DEFAULT_KEY;
- }
- else {
- name = DEFAULT_KEY + name;
- }
-
- return name;
- }
- };
- }
-
- private StringConverter<String> buildNameConverter() {
- return new StringConverter<String>() {
- public String convertToString(String value) {
-
- if (getSubject() == null) {
- return value;
- }
-
- if (value == null) {
- value = getSubject().getDefaultConverterName();
-
- if (value != null) {
- value = DEFAULT_KEY + value;
- }
- else {
- value = DEFAULT_KEY;
- }
- }
-
- if (value.startsWith(DEFAULT_KEY)) {
- String defaultName = value.substring(DEFAULT_KEY.length());
-
- if (defaultName.length() > 0) {
- value = NLS.bind(
- JptUiMappingsMessages.DefaultWithOneParam,
- defaultName
- );
- }
- else {
- value = JptUiMappingsMessages.DefaultEmpty;
- }
- }
-
- return value;
- }
- };
- }
-
- protected ListValueModel<String> buildReservedConverterNameListHolder() {
- return new StaticListValueModel<String>(Convert.RESERVED_CONVERTER_NAMES);
- }
-
- protected ListValueModel<String> buildConverterNameListHolder() {
- return new ListAspectAdapter<EclipseLinkPersistenceUnit, String>(
- buildPersistenceUnitHolder(),
- EclipseLinkPersistenceUnit.CONVERTERS_LIST)//TODO need EclipseLinkPersistenceUnit interface
- {
- @Override
- protected ListIterator<String> listIterator_() {
- return CollectionTools.listIterator(CollectionTools.sort(this.subject.uniqueConverterNames()));
- }
- };
- }
-
- protected PropertyValueModel<EclipseLinkPersistenceUnit> buildPersistenceUnitHolder() {
- return new PropertyAspectAdapter<Convert, EclipseLinkPersistenceUnit>(getSubjectHolder()) {
- @Override
- protected EclipseLinkPersistenceUnit buildValue_() {
- return (EclipseLinkPersistenceUnit) getSubject().getPersistenceUnit();
- }
- };
- }
-
- protected PropertyValueModel<Boolean> buildBooleanHolder() {
- return new TransformationPropertyValueModel<Convert, Boolean>(getSubjectHolder()) {
- @Override
- protected Boolean transform(Convert value) {
- if (getSubject() != null && getSubject().getParent().getPersistentAttribute().isVirtual()) {
- return Boolean.FALSE;
- }
- return Boolean.valueOf(value != null);
- }
- };
- }
-}
diff --git a/jpa/plugins/org.eclipse.jpt.eclipselink.ui/src/org/eclipse/jpt/eclipselink/ui/internal/orm/details/OrmExistenceCheckingComposite.java b/jpa/plugins/org.eclipse.jpt.eclipselink.ui/src/org/eclipse/jpt/eclipselink/ui/internal/orm/details/OrmExistenceCheckingComposite.java
deleted file mode 100644
index 919c110e15..0000000000
--- a/jpa/plugins/org.eclipse.jpt.eclipselink.ui/src/org/eclipse/jpt/eclipselink/ui/internal/orm/details/OrmExistenceCheckingComposite.java
+++ /dev/null
@@ -1,106 +0,0 @@
-/*******************************************************************************
- * Copyright (c) 2008 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
- *
- * Contributors: Oracle. - initial API and implementation
- *******************************************************************************/
-package org.eclipse.jpt.eclipselink.ui.internal.orm.details;
-
-import java.util.Collection;
-import org.eclipse.jpt.eclipselink.core.context.Caching;
-import org.eclipse.jpt.eclipselink.core.context.ExistenceType;
-import org.eclipse.jpt.eclipselink.ui.internal.mappings.EclipseLinkUiMappingsMessages;
-import org.eclipse.jpt.ui.internal.widgets.EnumFormComboViewer;
-import org.eclipse.jpt.ui.internal.widgets.FormPane;
-import org.eclipse.swt.widgets.Composite;
-
-/**
- * Here is the layout of this pane:
- * <pre>
- * -------------------------------------------------------------------------
- * | ---------------------------------------------- |
- * | x Existence Checking: | |v| |
- * | ---------------------------------------------- |
- * -------------------------------------------------------------------------</pre>
- *
- * @see EclipseLinkCaching
- * @see CachingComposite - A container of this widget
- *
- * @version 2.1
- * @since 2.1
- */
-public class OrmExistenceCheckingComposite extends FormPane<Caching> {
-
- /**
- * Creates a new <code>ExistenceCheckingComposite</code>.
- *
- * @param parentPane The parent container of this one
- * @param parent The parent container
- */
- public OrmExistenceCheckingComposite(FormPane<? extends Caching> parentPane,
- Composite parent) {
-
- super(parentPane, parent, false);
- }
-
- @Override
- protected void initializeLayout(Composite container) {
-
- addLabeledComposite(
- container,
- EclipseLinkUiMappingsMessages.ExistenceCheckingComposite_label,
- addExistenceCheckingTypeCombo(container).getControl(),
- null
- );
- }
-
- private EnumFormComboViewer<Caching, ExistenceType> addExistenceCheckingTypeCombo(Composite container) {
-
- return new EnumFormComboViewer<Caching, ExistenceType>(this, container) {
-
- @Override
- protected void addPropertyNames(Collection<String> propertyNames) {
- super.addPropertyNames(propertyNames);
- propertyNames.add(Caching.DEFAULT_EXISTENCE_TYPE_PROPERTY);
- propertyNames.add(Caching.SPECIFIED_EXISTENCE_TYPE_PROPERTY);
- }
-
- @Override
- protected ExistenceType[] getChoices() {
- return ExistenceType.values();
- }
-
- @Override
- protected ExistenceType getDefaultValue() {
- return getSubject().getDefaultExistenceType();
- }
-
- @Override
- protected String displayString(ExistenceType value) {
- return buildDisplayString(
- EclipseLinkUiMappingsMessages.class,
- OrmExistenceCheckingComposite.this,
- value
- );
- }
-
- @Override
- protected ExistenceType getValue() {
- return getSubject().getSpecifiedExistenceType();
- }
-
- @Override
- protected void setValue(ExistenceType value) {
- getSubject().setSpecifiedExistenceType(value);
- }
-
- @Override
- protected boolean sortChoices() {
- return false;
- }
- };
- }
-
-}
diff --git a/jpa/plugins/org.eclipse.jpt.eclipselink.ui/src/org/eclipse/jpt/eclipselink/ui/internal/persistence/caching/CacheSizeComposite.java b/jpa/plugins/org.eclipse.jpt.eclipselink.ui/src/org/eclipse/jpt/eclipselink/ui/internal/persistence/caching/CacheSizeComposite.java
deleted file mode 100644
index eaf471cac5..0000000000
--- a/jpa/plugins/org.eclipse.jpt.eclipselink.ui/src/org/eclipse/jpt/eclipselink/ui/internal/persistence/caching/CacheSizeComposite.java
+++ /dev/null
@@ -1,109 +0,0 @@
-/*******************************************************************************
- * Copyright (c) 2008, 2009 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.
- *
- * Contributors:
- * Oracle - initial API and implementation
- *******************************************************************************/
-package org.eclipse.jpt.eclipselink.ui.internal.persistence.caching;
-
-import org.eclipse.jpt.eclipselink.core.internal.context.persistence.caching.Caching;
-import org.eclipse.jpt.eclipselink.core.internal.context.persistence.caching.Entity;
-import org.eclipse.jpt.eclipselink.ui.internal.EclipseLinkHelpContextIds;
-import org.eclipse.jpt.eclipselink.ui.internal.EclipseLinkUiMessages;
-import org.eclipse.jpt.ui.internal.widgets.IntegerCombo;
-import org.eclipse.jpt.ui.internal.widgets.Pane;
-import org.eclipse.jpt.utility.internal.model.value.PropertyAspectAdapter;
-import org.eclipse.jpt.utility.internal.model.value.TransformationPropertyValueModel;
-import org.eclipse.jpt.utility.model.value.PropertyValueModel;
-import org.eclipse.jpt.utility.model.value.WritablePropertyValueModel;
-import org.eclipse.swt.widgets.Composite;
-
-/**
- * CacheSizeComposite
- */
-public class CacheSizeComposite extends Pane<Entity>
-{
- /**
- * Creates a new <code>CacheTypeComposite</code>.
- *
- * @param parentController
- * The parent container of this one
- * @param parent
- * The parent container
- */
- public CacheSizeComposite(Pane<Entity> parentComposite,
- Composite parent) {
-
- super(parentComposite, parent);
- }
-
- @Override
- protected void initializeLayout(Composite container) {
- this.addCacheSizeCombo(container);
- }
-
- private void addCacheSizeCombo(Composite container) {
- new IntegerCombo<Entity>(this, container) {
-
- @Override
- protected String getLabelText() {
- return EclipseLinkUiMessages.CacheSizeComposite_cacheSize;
- }
-
- @Override
- protected String getHelpId() {
- return EclipseLinkHelpContextIds.PERSISTENCE_CACHING;
- }
-
- @Override
- protected PropertyValueModel<Integer> buildDefaultHolder() {
- return new PropertyAspectAdapter<Caching, Integer>(buildCachingHolder(), Caching.CACHE_SIZE_DEFAULT_PROPERTY) {
- @Override
- protected Integer buildValue_() {
- Integer value = this.subject.getCacheSizeDefault();
- if (value == null) {
- value = this.subject.getDefaultCacheSizeDefault();
- }
- return value;
- }
- };
- }
-
- @Override
- protected WritablePropertyValueModel<Integer> buildSelectedItemHolder() {
- return new PropertyAspectAdapter<Entity, Integer>(this.getSubjectHolder(), Entity.CACHE_SIZE_PROPERTY) {
- @Override
- protected Integer buildValue_() {
- return getSubjectParent().getCacheSizeOf(getSubjectName());
- }
-
- @Override
- protected void setValue_(Integer value) {
- getSubjectParent().setCacheSizeOf(getSubjectName(), value);
- }
- };
- }
- };
- }
-
- private String getSubjectName() {
- return this.getSubjectHolder().getValue().getName();
- }
-
- private Caching getSubjectParent() {
- return this.getSubjectHolder().getValue().getParent();
- }
-
- private PropertyValueModel<Caching> buildCachingHolder() {
- return new TransformationPropertyValueModel<Entity, Caching>(this.getSubjectHolder()) {
- @Override
- protected Caching transform_(Entity value) {
- return value.getParent();
- }
- };
- }
-
-} \ No newline at end of file
diff --git a/jpa/plugins/org.eclipse.jpt.eclipselink.ui/src/org/eclipse/jpt/eclipselink/ui/internal/persistence/caching/CacheTypeComposite.java b/jpa/plugins/org.eclipse.jpt.eclipselink.ui/src/org/eclipse/jpt/eclipselink/ui/internal/persistence/caching/CacheTypeComposite.java
deleted file mode 100644
index 926935c561..0000000000
--- a/jpa/plugins/org.eclipse.jpt.eclipselink.ui/src/org/eclipse/jpt/eclipselink/ui/internal/persistence/caching/CacheTypeComposite.java
+++ /dev/null
@@ -1,170 +0,0 @@
-/*******************************************************************************
- * Copyright (c) 2008, 2009 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.
- *
- * Contributors:
- * Oracle - initial API and implementation
- *******************************************************************************/
-package org.eclipse.jpt.eclipselink.ui.internal.persistence.caching;
-
-import java.util.Collection;
-import org.eclipse.jpt.eclipselink.core.internal.context.persistence.caching.CacheType;
-import org.eclipse.jpt.eclipselink.core.internal.context.persistence.caching.Caching;
-import org.eclipse.jpt.eclipselink.core.internal.context.persistence.caching.Entity;
-import org.eclipse.jpt.eclipselink.ui.internal.EclipseLinkHelpContextIds;
-import org.eclipse.jpt.eclipselink.ui.internal.EclipseLinkUiMessages;
-import org.eclipse.jpt.ui.internal.listeners.SWTPropertyChangeListenerWrapper;
-import org.eclipse.jpt.ui.internal.widgets.EnumFormComboViewer;
-import org.eclipse.jpt.ui.internal.widgets.Pane;
-import org.eclipse.jpt.utility.internal.model.value.PropertyAspectAdapter;
-import org.eclipse.jpt.utility.internal.model.value.TransformationPropertyValueModel;
-import org.eclipse.jpt.utility.model.event.PropertyChangeEvent;
-import org.eclipse.jpt.utility.model.listener.PropertyChangeListener;
-import org.eclipse.jpt.utility.model.value.PropertyValueModel;
-import org.eclipse.swt.widgets.Composite;
-
-/**
- * CacheTypeComposite
- */
-public class CacheTypeComposite extends Pane<Entity>
-{
- /**
- * Creates a new <code>CacheTypeComposite</code>.
- *
- * @param parentController
- * The parent container of this one
- * @param parent
- * The parent container
- */
- public CacheTypeComposite(Pane<Entity> parentComposite,
- Composite parent) {
-
- super(parentComposite, parent);
- }
-
- @Override
- protected void initializeLayout(Composite container) {
-
- this.addLabeledComposite(
- container,
- EclipseLinkUiMessages.PersistenceXmlCachingTab_cacheTypeLabel,
- new CacheTypeCombo(container),
- EclipseLinkHelpContextIds.PERSISTENCE_CACHING
- );
- }
-
- private class CacheTypeCombo extends EnumFormComboViewer<Entity, CacheType> {
-
- private CacheTypeCombo(Composite parent) {
- super(CacheTypeComposite.this, parent);
- }
-
- @Override
- protected void addPropertyNames(Collection<String> propertyNames) {
- super.addPropertyNames(propertyNames);
- propertyNames.add(Entity.CACHE_TYPE_PROPERTY);
- }
-
- private PropertyValueModel<Caching> buildCachingHolder() {
- return new TransformationPropertyValueModel<Entity, Caching>(getSubjectHolder()) {
- @Override
- protected Caching transform_(Entity value) {
- return value.getParent();
- }
- };
- }
-
- private PropertyValueModel<CacheType> buildDefaultCacheTypeHolder() {
- return new PropertyAspectAdapter<Caching, CacheType>(buildCachingHolder(), Caching.CACHE_TYPE_DEFAULT_PROPERTY) {
- @Override
- protected CacheType buildValue_() {
- CacheType cacheType = subject.getCacheTypeDefault();
- if (cacheType == null) {
- cacheType = subject.getDefaultCacheTypeDefault();
- }
- return cacheType;
- }
- };
- }
-
- private PropertyChangeListener buildDefaultCachingTypePropertyChangeListener() {
- return new SWTPropertyChangeListenerWrapper(
- buildDefaultCachingTypePropertyChangeListener_()
- );
- }
-
- private PropertyChangeListener buildDefaultCachingTypePropertyChangeListener_() {
- return new PropertyChangeListener() {
- public void propertyChanged(PropertyChangeEvent e) {
- if ((e.getNewValue() != null) && !getCombo().isDisposed()) {
- CacheTypeCombo.this.doPopulate();
- }
- }
- };
- }
-
- @Override
- protected CacheType[] getChoices() {
- return CacheType.values();
- }
-
- @Override
- protected CacheType getDefaultValue() {
- return getSubjectParent().getDefaultCacheType();
- }
-
- @Override
- protected String displayString(CacheType value) {
- return buildDisplayString(
- EclipseLinkUiMessages.class,
- CacheTypeComposite.this,
- value
- );
- }
-
- @Override
- protected void doPopulate() {
- // This is required to allow the class loader to let the listener
- // written above to access this method
- super.doPopulate();
- }
-
- @Override
- protected CacheType getValue() {
- return getSubjectParent().getCacheTypeOf(getSubjectName());
- }
-
- @Override
- protected void initialize() {
- super.initialize();
-
- PropertyValueModel<CacheType> defaultCacheTypeHolder =
- buildDefaultCacheTypeHolder();
-
- defaultCacheTypeHolder.addPropertyChangeListener(
- PropertyValueModel.VALUE,
- buildDefaultCachingTypePropertyChangeListener()
- );
- }
-
- @Override
- protected void setValue(CacheType value) {
- getSubjectParent().setCacheTypeOf(getSubjectName(), value);
- }
-
- @Override
- protected boolean sortChoices() {
- return false;
- }
- }
-
- private String getSubjectName() {
- return this.getSubjectHolder().getValue().getName();
- }
-
- private Caching getSubjectParent() {
- return this.getSubjectHolder().getValue().getParent();
- }
-} \ No newline at end of file
diff --git a/jpa/plugins/org.eclipse.jpt.eclipselink.ui/src/org/eclipse/jpt/eclipselink/ui/internal/persistence/caching/DefaultCacheSizeComposite.java b/jpa/plugins/org.eclipse.jpt.eclipselink.ui/src/org/eclipse/jpt/eclipselink/ui/internal/persistence/caching/DefaultCacheSizeComposite.java
deleted file mode 100644
index a439b2bbcd..0000000000
--- a/jpa/plugins/org.eclipse.jpt.eclipselink.ui/src/org/eclipse/jpt/eclipselink/ui/internal/persistence/caching/DefaultCacheSizeComposite.java
+++ /dev/null
@@ -1,87 +0,0 @@
-/*******************************************************************************
- * Copyright (c) 2008, 2009 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.
- *
- * Contributors:
- * Oracle - initial API and implementation
- *******************************************************************************/
-package org.eclipse.jpt.eclipselink.ui.internal.persistence.caching;
-
-import org.eclipse.jpt.eclipselink.core.internal.context.persistence.caching.Caching;
-import org.eclipse.jpt.eclipselink.ui.internal.EclipseLinkHelpContextIds;
-import org.eclipse.jpt.eclipselink.ui.internal.EclipseLinkUiMessages;
-import org.eclipse.jpt.ui.internal.widgets.IntegerCombo;
-import org.eclipse.jpt.ui.internal.widgets.Pane;
-import org.eclipse.jpt.utility.internal.model.value.PropertyAspectAdapter;
-import org.eclipse.jpt.utility.model.value.PropertyValueModel;
-import org.eclipse.jpt.utility.model.value.WritablePropertyValueModel;
-import org.eclipse.swt.widgets.Composite;
-
-/**
- * CacheSizeComposite
- */
-public class DefaultCacheSizeComposite extends Pane<Caching>
-{
- /**
- * Creates a new <code>CacheTypeComposite</code>.
- *
- * @param parentController
- * The parent container of this one
- * @param parent
- * The parent container
- */
- public DefaultCacheSizeComposite(Pane<Caching> parentComposite,
- Composite parent) {
-
- super(parentComposite, parent);
- }
-
-
-
- @Override
- protected void initializeLayout(Composite container) {
- addDefaultCacheSizeCombo(container);
- }
-
- private void addDefaultCacheSizeCombo(Composite container) {
- new IntegerCombo<Caching>(this, container) {
-
- @Override
- protected String getLabelText() {
- return EclipseLinkUiMessages.DefaultCacheSizeComposite_defaultCacheSize;
- }
-
- @Override
- protected String getHelpId() {
- return EclipseLinkHelpContextIds.PERSISTENCE_CACHING_DEFAULT_SIZE;
- }
-
- @Override
- protected PropertyValueModel<Integer> buildDefaultHolder() {
- return new PropertyAspectAdapter<Caching, Integer>(getSubjectHolder()) {
- @Override
- protected Integer buildValue_() {
- return this.subject.getDefaultCacheSizeDefault();
- }
- };
- }
-
- @Override
- protected WritablePropertyValueModel<Integer> buildSelectedItemHolder() {
- return new PropertyAspectAdapter<Caching, Integer>(getSubjectHolder(), Caching.CACHE_SIZE_DEFAULT_PROPERTY) {
- @Override
- protected Integer buildValue_() {
- return this.subject.getCacheSizeDefault();
- }
-
- @Override
- protected void setValue_(Integer value) {
- this.subject.setCacheSizeDefault(value);
- }
- }; }
- };
- }
-
-} \ No newline at end of file
diff --git a/jpa/plugins/org.eclipse.jpt.eclipselink.ui/src/org/eclipse/jpt/eclipselink/ui/internal/persistence/caching/DefaultCacheTypeComposite.java b/jpa/plugins/org.eclipse.jpt.eclipselink.ui/src/org/eclipse/jpt/eclipselink/ui/internal/persistence/caching/DefaultCacheTypeComposite.java
deleted file mode 100644
index 7645654b3d..0000000000
--- a/jpa/plugins/org.eclipse.jpt.eclipselink.ui/src/org/eclipse/jpt/eclipselink/ui/internal/persistence/caching/DefaultCacheTypeComposite.java
+++ /dev/null
@@ -1,91 +0,0 @@
-/*******************************************************************************
- * Copyright (c) 2008 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.
- *
- * Contributors:
- * Oracle - initial API and implementation
- *******************************************************************************/
-package org.eclipse.jpt.eclipselink.ui.internal.persistence.caching;
-
-import java.util.Collection;
-import org.eclipse.jpt.eclipselink.core.internal.context.persistence.caching.CacheType;
-import org.eclipse.jpt.eclipselink.core.internal.context.persistence.caching.Caching;
-import org.eclipse.jpt.eclipselink.ui.internal.EclipseLinkHelpContextIds;
-import org.eclipse.jpt.eclipselink.ui.internal.EclipseLinkUiMessages;
-import org.eclipse.jpt.ui.internal.widgets.EnumFormComboViewer;
-import org.eclipse.jpt.ui.internal.widgets.FormPane;
-import org.eclipse.swt.widgets.Composite;
-
-/**
- * DefaultCacheTypeComposite
- */
-public class DefaultCacheTypeComposite extends FormPane<Caching>
-{
- /**
- * Creates a new <code>DefaultCacheTypeComposite</code>.
- *
- * @param parentController
- * The parent container of this one
- * @param parent
- * The parent container
- */
- public DefaultCacheTypeComposite(
- FormPane<? extends Caching> parentComposite,
- Composite parent) {
-
- super( parentComposite, parent);
- }
-
- private EnumFormComboViewer<Caching, CacheType> buildDefaultCacheTypeCombo(Composite container) {
- return new EnumFormComboViewer<Caching, CacheType>(this, container) {
- @Override
- protected void addPropertyNames(Collection<String> propertyNames) {
- super.addPropertyNames(propertyNames);
- propertyNames.add(Caching.CACHE_TYPE_DEFAULT_PROPERTY);
- }
-
- @Override
- protected CacheType[] getChoices() {
- return CacheType.values();
- }
-
- @Override
- protected boolean sortChoices() {
- return false;
- }
-
- @Override
- protected CacheType getDefaultValue() {
- return getSubject().getDefaultCacheTypeDefault();
- }
-
- @Override
- protected String displayString(CacheType value) {
- return buildDisplayString(EclipseLinkUiMessages.class, DefaultCacheTypeComposite.this, value);
- }
-
- @Override
- protected CacheType getValue() {
- return getSubject().getCacheTypeDefault();
- }
-
- @Override
- protected void setValue(CacheType value) {
- getSubject().setCacheTypeDefault(value);
- }
- };
- }
-
- @Override
- protected void initializeLayout( Composite container) {
-
- this.addLabeledComposite(
- container,
- EclipseLinkUiMessages.PersistenceXmlCachingTab_defaultCacheTypeLabel,
- this.buildDefaultCacheTypeCombo( container),
- EclipseLinkHelpContextIds.PERSISTENCE_CACHING_DEFAULT_TYPE
- );
- }
-}
diff --git a/jpa/plugins/org.eclipse.jpt.eclipselink.ui/src/org/eclipse/jpt/eclipselink/ui/internal/persistence/caching/DefaultSharedCacheComposite.java b/jpa/plugins/org.eclipse.jpt.eclipselink.ui/src/org/eclipse/jpt/eclipselink/ui/internal/persistence/caching/DefaultSharedCacheComposite.java
deleted file mode 100644
index 0ec3f337d1..0000000000
--- a/jpa/plugins/org.eclipse.jpt.eclipselink.ui/src/org/eclipse/jpt/eclipselink/ui/internal/persistence/caching/DefaultSharedCacheComposite.java
+++ /dev/null
@@ -1,95 +0,0 @@
-/*******************************************************************************
- * Copyright (c) 2008, 2009 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.
- *
- * Contributors:
- * Oracle - initial API and implementation
- *******************************************************************************/
-package org.eclipse.jpt.eclipselink.ui.internal.persistence.caching;
-
-import org.eclipse.jpt.eclipselink.core.internal.context.persistence.caching.Caching;
-import org.eclipse.jpt.eclipselink.ui.internal.EclipseLinkHelpContextIds;
-import org.eclipse.jpt.eclipselink.ui.internal.EclipseLinkUiMessages;
-import org.eclipse.jpt.ui.internal.widgets.FormPane;
-import org.eclipse.jpt.utility.internal.model.value.PropertyAspectAdapter;
-import org.eclipse.jpt.utility.internal.model.value.TransformationPropertyValueModel;
-import org.eclipse.jpt.utility.model.value.PropertyValueModel;
-import org.eclipse.jpt.utility.model.value.WritablePropertyValueModel;
-import org.eclipse.osgi.util.NLS;
-import org.eclipse.swt.widgets.Composite;
-
-/**
- * DefaultShareCacheComposite
- */
-public class DefaultSharedCacheComposite extends FormPane<Caching>
-{
- /**
- * Creates a new <code>DefaultShareCacheComposite</code>.
- *
- * @param parentController
- * The parent container of this one
- * @param parent
- * The parent container
- */
- public DefaultSharedCacheComposite(
- FormPane<? extends Caching> parentComposite,
- Composite parent) {
-
- super(parentComposite, parent);
- }
-
- @Override
- protected void initializeLayout(Composite container) {
-
- this.addTriStateCheckBoxWithDefault(
- container,
- EclipseLinkUiMessages.PersistenceXmlCachingTab_sharedCacheDefaultLabel,
- this.buildDefaultSharedCacheHolder(),
- this.buildDefaultSharedCacheStringHolder(),
- EclipseLinkHelpContextIds.PERSISTENCE_CACHING_DEFAULT_SHARED
- );
- }
-
- private WritablePropertyValueModel<Boolean> buildDefaultSharedCacheHolder() {
- return new PropertyAspectAdapter<Caching, Boolean>(getSubjectHolder(), Caching.SHARED_CACHE_DEFAULT_PROPERTY) {
- @Override
- protected Boolean buildValue_() {
- return this.subject.getSharedCacheDefault();
- }
-
- @Override
- protected void setValue_(Boolean value) {
- this.subject.setSharedCacheDefault(value);
- }
- };
- }
-
- private PropertyValueModel<String> buildDefaultSharedCacheStringHolder() {
- return new TransformationPropertyValueModel<Boolean, String>(buildDefaultDefaultSharedCacheHolder()) {
- @Override
- protected String transform(Boolean value) {
- if (value != null) {
- String defaultStringValue = value.booleanValue() ? EclipseLinkUiMessages.Boolean_True : EclipseLinkUiMessages.Boolean_False;
- return NLS.bind(EclipseLinkUiMessages.PersistenceXmlCachingTab_defaultSharedCacheDefaultLabel, defaultStringValue);
- }
- return EclipseLinkUiMessages.PersistenceXmlCachingTab_sharedCacheDefaultLabel;
- }
- };
- }
- private PropertyValueModel<Boolean> buildDefaultDefaultSharedCacheHolder() {
- return new PropertyAspectAdapter<Caching, Boolean>(
- getSubjectHolder(),
- Caching.SHARED_CACHE_DEFAULT_PROPERTY)
- {
- @Override
- protected Boolean buildValue_() {
- if (this.subject.getSharedCacheDefault() != null) {
- return null;
- }
- return this.subject.getDefaultSharedCacheDefault();
- }
- };
- }
-}
diff --git a/jpa/plugins/org.eclipse.jpt.eclipselink.ui/src/org/eclipse/jpt/eclipselink/ui/internal/persistence/caching/EclipseLinkCachingComposite.java b/jpa/plugins/org.eclipse.jpt.eclipselink.ui/src/org/eclipse/jpt/eclipselink/ui/internal/persistence/caching/EclipseLinkCachingComposite.java
deleted file mode 100644
index 225909b3a7..0000000000
--- a/jpa/plugins/org.eclipse.jpt.eclipselink.ui/src/org/eclipse/jpt/eclipselink/ui/internal/persistence/caching/EclipseLinkCachingComposite.java
+++ /dev/null
@@ -1,60 +0,0 @@
-/*******************************************************************************
-* Copyright (c) 2008 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.
-*
-* Contributors:
-* Oracle - initial API and implementation
-*******************************************************************************/
-package org.eclipse.jpt.eclipselink.ui.internal.persistence.caching;
-
-import org.eclipse.jpt.eclipselink.core.internal.context.persistence.caching.Caching;
-import org.eclipse.jpt.eclipselink.ui.internal.EclipseLinkUiMessages;
-import org.eclipse.jpt.ui.internal.widgets.FormPane;
-import org.eclipse.swt.widgets.Composite;
-
-/**
- * EclipseLinkCachingComposite
- */
-public class EclipseLinkCachingComposite extends FormPane<Caching>
-{
- public EclipseLinkCachingComposite(FormPane<Caching> subjectHolder,
- Composite container) {
-
- super(subjectHolder, container);
- }
-
- @Override
- protected void initializeLayout(Composite container) {
-
- container = this.addSection(
- container,
- EclipseLinkUiMessages.PersistenceXmlCachingTab_sectionTitle,
- EclipseLinkUiMessages.PersistenceXmlCachingTab_sectionDescription
- );
-
- // Default pane
- int groupBoxMargin = this.getGroupBoxMargin();
-
- Composite defaultPane = this.addSubPane(
- container,
- 0, groupBoxMargin, 0, groupBoxMargin
- );
-
- // Default Cache Type
- new DefaultCacheTypeComposite(this, defaultPane);
-
- // Default Cache Size
- new DefaultCacheSizeComposite(this, defaultPane);
-
- // Default Shared Cache
- new DefaultSharedCacheComposite(this, defaultPane);
-
- // EntitiesList
- new EntityListComposite(this, container);
-
- // Flush Clear Cache
- new FlushClearCacheComposite(this, container);
- }
-} \ No newline at end of file
diff --git a/jpa/plugins/org.eclipse.jpt.eclipselink.ui/src/org/eclipse/jpt/eclipselink/ui/internal/persistence/caching/EntityCachingPropertyComposite.java b/jpa/plugins/org.eclipse.jpt.eclipselink.ui/src/org/eclipse/jpt/eclipselink/ui/internal/persistence/caching/EntityCachingPropertyComposite.java
deleted file mode 100644
index 9080e937cd..0000000000
--- a/jpa/plugins/org.eclipse.jpt.eclipselink.ui/src/org/eclipse/jpt/eclipselink/ui/internal/persistence/caching/EntityCachingPropertyComposite.java
+++ /dev/null
@@ -1,53 +0,0 @@
-/*******************************************************************************
- * Copyright (c) 2008, 2009 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.
- *
- * Contributors:
- * Oracle - initial API and implementation
- ******************************************************************************/
-package org.eclipse.jpt.eclipselink.ui.internal.persistence.caching;
-
-import org.eclipse.jpt.eclipselink.core.internal.context.persistence.caching.Caching;
-import org.eclipse.jpt.eclipselink.core.internal.context.persistence.caching.Entity;
-import org.eclipse.jpt.ui.internal.widgets.Pane;
-import org.eclipse.jpt.utility.model.value.PropertyValueModel;
-import org.eclipse.swt.widgets.Composite;
-
-/**
- * @version 2.0
- * @since 2.0
- */
-public class EntityCachingPropertyComposite extends Pane<Entity> {
-
- /**
- * Creates a new <code>EntityCachingPropertyComposite</code>.
- *
- * @param parentPane The parent container of this one
- * @param subjectHolder The holder of this pane's subject
- * @param parent The parent container
- */
- public EntityCachingPropertyComposite(Pane<Caching> parentComposite,
- PropertyValueModel<Entity> subjectHolder,
- Composite parent) {
-
- super(parentComposite, subjectHolder, parent);
- }
-
- /*
- * (non-Javadoc)
- */
- @Override
- protected void initializeLayout(Composite container) {
-
- // Cache Type
- new CacheTypeComposite(this, container);
-
- // Cache Size
- new CacheSizeComposite(this, container);
-
- // Share Cache
- new SharedCacheComposite(this, container);
- }
-}
diff --git a/jpa/plugins/org.eclipse.jpt.eclipselink.ui/src/org/eclipse/jpt/eclipselink/ui/internal/persistence/caching/EntityListComposite.java b/jpa/plugins/org.eclipse.jpt.eclipselink.ui/src/org/eclipse/jpt/eclipselink/ui/internal/persistence/caching/EntityListComposite.java
deleted file mode 100644
index 18b5a4f681..0000000000
--- a/jpa/plugins/org.eclipse.jpt.eclipselink.ui/src/org/eclipse/jpt/eclipselink/ui/internal/persistence/caching/EntityListComposite.java
+++ /dev/null
@@ -1,218 +0,0 @@
-/*******************************************************************************
-* Copyright (c) 2007, 2009 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.
-*
-* Contributors:
-* Oracle - initial API and implementation
-*******************************************************************************/
-package org.eclipse.jpt.eclipselink.ui.internal.persistence.caching;
-
-import java.util.ListIterator;
-import org.eclipse.core.resources.IProject;
-import org.eclipse.jdt.core.IJavaElement;
-import org.eclipse.jdt.core.IJavaProject;
-import org.eclipse.jdt.core.IPackageFragmentRoot;
-import org.eclipse.jdt.core.IType;
-import org.eclipse.jdt.core.JavaCore;
-import org.eclipse.jdt.core.JavaModelException;
-import org.eclipse.jdt.core.search.IJavaSearchScope;
-import org.eclipse.jdt.core.search.SearchEngine;
-import org.eclipse.jdt.ui.IJavaElementSearchConstants;
-import org.eclipse.jdt.ui.JavaUI;
-import org.eclipse.jface.viewers.ILabelProvider;
-import org.eclipse.jface.viewers.LabelProvider;
-import org.eclipse.jface.window.Window;
-import org.eclipse.jpt.eclipselink.core.internal.context.persistence.caching.Caching;
-import org.eclipse.jpt.eclipselink.core.internal.context.persistence.caching.Entity;
-import org.eclipse.jpt.eclipselink.ui.JptEclipseLinkUiPlugin;
-import org.eclipse.jpt.eclipselink.ui.internal.EclipseLinkHelpContextIds;
-import org.eclipse.jpt.eclipselink.ui.internal.EclipseLinkUiMessages;
-import org.eclipse.jpt.ui.internal.util.PaneEnabler;
-import org.eclipse.jpt.ui.internal.widgets.AddRemoveListPane;
-import org.eclipse.jpt.ui.internal.widgets.Pane;
-import org.eclipse.jpt.utility.internal.model.value.ListAspectAdapter;
-import org.eclipse.jpt.utility.internal.model.value.SimplePropertyValueModel;
-import org.eclipse.jpt.utility.internal.model.value.TransformationPropertyValueModel;
-import org.eclipse.jpt.utility.internal.model.value.swing.ObjectListSelectionModel;
-import org.eclipse.jpt.utility.model.value.ListValueModel;
-import org.eclipse.jpt.utility.model.value.PropertyValueModel;
-import org.eclipse.jpt.utility.model.value.WritablePropertyValueModel;
-import org.eclipse.swt.widgets.Composite;
-import org.eclipse.ui.PlatformUI;
-import org.eclipse.ui.dialogs.SelectionDialog;
-import org.eclipse.ui.progress.IProgressService;
-
-/**
- * EntityListComposite
- */
-public class EntityListComposite extends Pane<Caching>
-{
- public EntityListComposite(Pane<Caching> parentComposite, Composite parent) {
-
- super(parentComposite, parent);
- }
-
- @Override
- protected void initializeLayout(Composite container) {
-
- container = this.addTitledGroup(
- container,
- EclipseLinkUiMessages.CachingEntityListComposite_groupTitle
- );
- WritablePropertyValueModel<Entity> entityHolder = this.buildEntityHolder();
-
- // Entities add/remove list pane
- new AddRemoveListPane<Caching>(
- this,
- container,
- this.buildEntitiesAdapter(),
- this.buildEntitiesListHolder(),
- entityHolder,
- this.buildEntityLabelProvider(),
- EclipseLinkHelpContextIds.PERSISTENCE_CACHING
- );
-
- // Entity Caching property pane
- EntityCachingPropertyComposite pane = new EntityCachingPropertyComposite(
- this,
- entityHolder,
- container
- );
- this.installPaneEnabler(entityHolder, pane);
- }
-
- private AddRemoveListPane.Adapter buildEntitiesAdapter() {
- return new AddRemoveListPane.AbstractAdapter() {
- public void addNewItem(ObjectListSelectionModel listSelectionModel) {
- EntityListComposite.this.addEntities(listSelectionModel);
- }
-
- public void removeSelectedItems(ObjectListSelectionModel listSelectionModel) {
- Caching caching = getSubject();
- for (Object item : listSelectionModel.selectedValues()) {
- Entity entityCaching = (Entity) item;
- caching.removeEntity(entityCaching.getName());
- }
- }
- };
- }
-
- private void addEntities(ObjectListSelectionModel listSelectionModel) {
-
- IType type = this.chooseEntity();
-
- if (type != null) {
- String entityName = this.getEntityName(type.getFullyQualifiedName());
- if (entityName == null) {
- entityName = type.getElementName();
- }
-
- if( ! this.getSubject().entityExists(entityName)) {
- this.getSubject().addEntity(entityName);
-
- listSelectionModel.setSelectedValue(entityName);
- }
- }
- }
-
- private String getEntityName(String fullyQualifiedTypeName) {
-
- org.eclipse.jpt.core.context.Entity entity = getSubject().getPersistenceUnit().getEntity(fullyQualifiedTypeName);
- return (entity != null) ? entity.getName() : null;
- }
-
- private IType chooseEntity() {
-
- IPackageFragmentRoot root = getPackageFragmentRoot();
- if (root == null) {
- return null;
- }
- IJavaElement[] elements = new IJavaElement[] { root.getJavaProject() };
- IJavaSearchScope scope = SearchEngine.createJavaSearchScope(elements);
- IProgressService service = PlatformUI.getWorkbench().getProgressService();
- SelectionDialog typeSelectionDialog;
-
- try {
- typeSelectionDialog = JavaUI.createTypeDialog(
- getShell(),
- service,
- scope,
- IJavaElementSearchConstants.CONSIDER_CLASSES,
- false,
- ""
- );
- }
- catch (JavaModelException e) {
- JptEclipseLinkUiPlugin.log(e);
- return null;
- }
- typeSelectionDialog.setTitle(EclipseLinkUiMessages.CachingEntityListComposite_dialogTitle);
- typeSelectionDialog.setMessage(EclipseLinkUiMessages.CachingEntityListComposite_dialogMessage);
-
- if (typeSelectionDialog.open() == Window.OK) {
- return (IType) typeSelectionDialog.getResult()[0];
- }
- return null;
- }
-
- private IPackageFragmentRoot getPackageFragmentRoot() {
- IProject project = getSubject().getJpaProject().getProject();
- IJavaProject root = JavaCore.create(project);
-
- try {
- return root.getAllPackageFragmentRoots()[0];
- }
- catch (JavaModelException e) {
- JptEclipseLinkUiPlugin.log(e);
- }
- return null;
- }
-
- private ILabelProvider buildEntityLabelProvider() {
- return new LabelProvider() {
- @Override
- public String getText(Object element) {
- Entity entityCaching = (Entity) element;
- return entityCaching.getName();
- }
- };
- }
-
- private WritablePropertyValueModel<Entity> buildEntityHolder() {
- return new SimplePropertyValueModel<Entity>();
- }
-
- private ListValueModel<Entity> buildEntitiesListHolder() {
- return new ListAspectAdapter<Caching, Entity>(
- this.getSubjectHolder(), Caching.ENTITIES_LIST) {
- @Override
- protected ListIterator<Entity> listIterator_() {
- return this.subject.entities();
- }
- @Override
- protected int size_() {
- return this.subject.entitiesSize();
- }
- };
- }
-
- private void installPaneEnabler(WritablePropertyValueModel<Entity> entityHolder,
- EntityCachingPropertyComposite pane) {
-
- new PaneEnabler(
- this.buildPaneEnablerHolder(entityHolder),
- pane
- );
- }
-
- private PropertyValueModel<Boolean> buildPaneEnablerHolder(WritablePropertyValueModel<Entity> entityHolder) {
- return new TransformationPropertyValueModel<Entity, Boolean>(entityHolder) {
- @Override
- protected Boolean transform_(Entity value) {
- return value.entityNameIsValid();
- }
- };
- }
-}
diff --git a/jpa/plugins/org.eclipse.jpt.eclipselink.ui/src/org/eclipse/jpt/eclipselink/ui/internal/persistence/caching/FlushClearCacheComposite.java b/jpa/plugins/org.eclipse.jpt.eclipselink.ui/src/org/eclipse/jpt/eclipselink/ui/internal/persistence/caching/FlushClearCacheComposite.java
deleted file mode 100644
index 87d268120c..0000000000
--- a/jpa/plugins/org.eclipse.jpt.eclipselink.ui/src/org/eclipse/jpt/eclipselink/ui/internal/persistence/caching/FlushClearCacheComposite.java
+++ /dev/null
@@ -1,91 +0,0 @@
-/*******************************************************************************
- * Copyright (c) 2008 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.
- *
- * Contributors:
- * Oracle - initial API and implementation
- *******************************************************************************/
-package org.eclipse.jpt.eclipselink.ui.internal.persistence.caching;
-
-import java.util.Collection;
-
-import org.eclipse.jpt.eclipselink.core.internal.context.persistence.caching.Caching;
-import org.eclipse.jpt.eclipselink.core.internal.context.persistence.caching.FlushClearCache;
-import org.eclipse.jpt.eclipselink.ui.internal.EclipseLinkHelpContextIds;
-import org.eclipse.jpt.eclipselink.ui.internal.EclipseLinkUiMessages;
-import org.eclipse.jpt.ui.internal.widgets.EnumFormComboViewer;
-import org.eclipse.jpt.ui.internal.widgets.FormPane;
-import org.eclipse.swt.widgets.Composite;
-
-/**
- * FlushClearCacheComposite
- */
-public class FlushClearCacheComposite extends FormPane<Caching>
-{
- /**
- * Creates a new <code>FlushClearCacheComposite</code>.
- *
- * @param parentController
- * The parent container of this one
- * @param parent
- * The parent container
- */
- public FlushClearCacheComposite(
- FormPane<? extends Caching> parentComposite,
- Composite parent) {
-
- super(parentComposite, parent);
- }
-
- private EnumFormComboViewer<Caching, FlushClearCache> addFlushClearCacheCombo(Composite container) {
- return new EnumFormComboViewer<Caching, FlushClearCache>(this, container) {
- @Override
- protected void addPropertyNames(Collection<String> propertyNames) {
- super.addPropertyNames(propertyNames);
- propertyNames.add(Caching.FLUSH_CLEAR_CACHE_PROPERTY);
- }
-
- @Override
- protected FlushClearCache[] getChoices() {
- return FlushClearCache.values();
- }
-
- @Override
- protected boolean sortChoices() {
- return false;
- }
-
- @Override
- protected FlushClearCache getDefaultValue() {
- return this.getSubject().getDefaultFlushClearCache();
- }
-
- @Override
- protected String displayString(FlushClearCache value) {
- return this.buildDisplayString(EclipseLinkUiMessages.class, FlushClearCacheComposite.this, value);
- }
-
- @Override
- protected FlushClearCache getValue() {
- return this.getSubject().getFlushClearCache();
- }
-
- @Override
- protected void setValue(FlushClearCache value) {
- this.getSubject().setFlushClearCache(value);
- }
- };
- }
-
- @Override
- protected void initializeLayout(Composite container) {
- this.addLabeledComposite(
- container,
- EclipseLinkUiMessages.PersistenceXmlCachingTab_FlushClearCacheLabel,
- this.addFlushClearCacheCombo(container),
- EclipseLinkHelpContextIds.PERSISTENCE_CACHING
- );
- }
-}
diff --git a/jpa/plugins/org.eclipse.jpt.eclipselink.ui/src/org/eclipse/jpt/eclipselink/ui/internal/persistence/caching/PersistenceXmlCachingTab.java b/jpa/plugins/org.eclipse.jpt.eclipselink.ui/src/org/eclipse/jpt/eclipselink/ui/internal/persistence/caching/PersistenceXmlCachingTab.java
deleted file mode 100644
index 20677b6b02..0000000000
--- a/jpa/plugins/org.eclipse.jpt.eclipselink.ui/src/org/eclipse/jpt/eclipselink/ui/internal/persistence/caching/PersistenceXmlCachingTab.java
+++ /dev/null
@@ -1,87 +0,0 @@
-/*******************************************************************************
-* Copyright (c) 2007, 2009 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.
-*
-* Contributors:
-* Oracle - initial API and implementation
-*******************************************************************************/
-package org.eclipse.jpt.eclipselink.ui.internal.persistence.caching;
-
-import org.eclipse.jpt.eclipselink.core.internal.context.persistence.caching.Caching;
-import org.eclipse.jpt.eclipselink.ui.internal.EclipseLinkHelpContextIds;
-import org.eclipse.jpt.eclipselink.ui.internal.EclipseLinkUiMessages;
-import org.eclipse.jpt.ui.WidgetFactory;
-import org.eclipse.jpt.ui.details.JpaPageComposite;
-import org.eclipse.jpt.ui.internal.widgets.FormPane;
-import org.eclipse.jpt.utility.model.value.PropertyValueModel;
-import org.eclipse.swt.SWT;
-import org.eclipse.swt.graphics.Image;
-import org.eclipse.swt.layout.GridData;
-import org.eclipse.swt.layout.GridLayout;
-import org.eclipse.swt.widgets.Composite;
-
-/**
- * PersistenceXmlCachingTab
- */
-public class PersistenceXmlCachingTab
- extends FormPane<Caching>
- implements JpaPageComposite
-{
- public PersistenceXmlCachingTab(
- PropertyValueModel<Caching> subjectHolder,
- Composite parent,
- WidgetFactory widgetFactory) {
-
- super(subjectHolder, parent, widgetFactory);
- }
-
- @Override
- protected void initializeLayout(Composite container) {
-
- new EclipseLinkCachingComposite(this, container);
- }
-
- // ********** JpaPageComposite implementation **********
-
- public String getHelpID() {
- return EclipseLinkHelpContextIds.PERSISTENCE_CACHING;
- }
-
- public Image getPageImage() {
- return null;
- }
- public String getPageText() {
- return EclipseLinkUiMessages.PersistenceXmlCachingTab_title;
- }
-
- // ********** Layout **********
-
- @Override
- protected Composite addContainer(Composite parent) {
- GridLayout layout = new GridLayout(1, true);
- layout.marginHeight = 0;
- layout.marginWidth = 0;
- layout.marginTop = 0;
- layout.marginLeft = 0;
- layout.marginBottom = 0;
- layout.marginRight = 0;
- layout.verticalSpacing = 15;
-
- Composite container = addPane(parent, layout);
- updateGridData(container);
-
- return container;
- }
-
- private void updateGridData(Composite container) {
- GridData gridData = new GridData();
- gridData.grabExcessHorizontalSpace = true;
- gridData.grabExcessVerticalSpace = true;
- gridData.horizontalAlignment = SWT.FILL;
- gridData.verticalAlignment = SWT.FILL;
- container.setLayoutData(gridData);
- }
-
-}
diff --git a/jpa/plugins/org.eclipse.jpt.eclipselink.ui/src/org/eclipse/jpt/eclipselink/ui/internal/persistence/caching/SharedCacheComposite.java b/jpa/plugins/org.eclipse.jpt.eclipselink.ui/src/org/eclipse/jpt/eclipselink/ui/internal/persistence/caching/SharedCacheComposite.java
deleted file mode 100644
index 101541b4e0..0000000000
--- a/jpa/plugins/org.eclipse.jpt.eclipselink.ui/src/org/eclipse/jpt/eclipselink/ui/internal/persistence/caching/SharedCacheComposite.java
+++ /dev/null
@@ -1,163 +0,0 @@
-/*******************************************************************************
-* Copyright (c) 2008, 2009 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.
-*
-* Contributors:
-* Oracle - initial API and implementation
-*******************************************************************************/
-package org.eclipse.jpt.eclipselink.ui.internal.persistence.caching;
-
-import java.util.ArrayList;
-import org.eclipse.jpt.eclipselink.core.internal.context.persistence.caching.Caching;
-import org.eclipse.jpt.eclipselink.core.internal.context.persistence.caching.Entity;
-import org.eclipse.jpt.eclipselink.ui.internal.EclipseLinkHelpContextIds;
-import org.eclipse.jpt.eclipselink.ui.internal.EclipseLinkUiMessages;
-import org.eclipse.jpt.ui.internal.widgets.Pane;
-import org.eclipse.jpt.ui.internal.widgets.TriStateCheckBox;
-import org.eclipse.jpt.utility.internal.model.value.CompositeListValueModel;
-import org.eclipse.jpt.utility.internal.model.value.ListPropertyValueModelAdapter;
-import org.eclipse.jpt.utility.internal.model.value.PropertyAspectAdapter;
-import org.eclipse.jpt.utility.internal.model.value.PropertyListValueModelAdapter;
-import org.eclipse.jpt.utility.internal.model.value.TransformationPropertyValueModel;
-import org.eclipse.jpt.utility.model.value.ListValueModel;
-import org.eclipse.jpt.utility.model.value.PropertyValueModel;
-import org.eclipse.jpt.utility.model.value.WritablePropertyValueModel;
-import org.eclipse.osgi.util.NLS;
-import org.eclipse.swt.widgets.Composite;
-
-/**
- * SharedCacheComposite
- */
-public class SharedCacheComposite extends Pane<Entity>
-{
- private TriStateCheckBox sharedCacheCheckBox;
-
- /**
- * Creates a new <code>ShareCacheComposite</code>.
- *
- * @param parentController The parent container of this one
- * @param parent The parent container
- */
- public SharedCacheComposite(Pane<Entity> parentComposite,
- Composite parent) {
-
- super(parentComposite, parent);
- }
-
- private PropertyValueModel<Caching> buildCachingHolder() {
- return new TransformationPropertyValueModel<Entity, Caching>(this.getSubjectHolder()) {
- @Override
- protected Caching transform_(Entity value) {
- return value.getParent();
- }
- };
- }
-
- private PropertyValueModel<Boolean> buildDefaultAndNonDefaultSharedCacheHolder() {
- return new ListPropertyValueModelAdapter<Boolean>(
- buildDefaultAndNonDefaultSharedCacheListHolder()
- ) {
- @Override
- protected Boolean buildValue() {
- // If the number of ListValueModel equals 1, that means the shared
- // Cache properties is not set (partially selected), which means we
- // want to see the default value appended to the text
- if (this.listHolder.size() == 1) {
- return (Boolean) this.listHolder.listIterator().next();
- }
- return null;
- }
- };
- }
-
- private ListValueModel<Boolean> buildDefaultAndNonDefaultSharedCacheListHolder() {
- ArrayList<ListValueModel<Boolean>> holders = new ArrayList<ListValueModel<Boolean>>(2);
- holders.add(buildSharedCacheListHolder());
- holders.add(buildDefaultSharedCacheListHolder());
-
- return new CompositeListValueModel<ListValueModel<Boolean>, Boolean>(
- holders
- );
- }
-
- private PropertyValueModel<Boolean> buildDefaultSharedCacheHolder() {
- return new PropertyAspectAdapter<Caching, Boolean>(buildCachingHolder(), Caching.SHARED_CACHE_DEFAULT_PROPERTY) {
- @Override
- protected Boolean buildValue_() {
- Boolean value = this.subject.getSharedCacheDefault();
- if (value == null) {
- value = this.subject.getDefaultSharedCacheDefault();
- }
- return value;
- }
- };
- }
-
- private ListValueModel<Boolean> buildDefaultSharedCacheListHolder() {
- return new PropertyListValueModelAdapter<Boolean>(
- buildDefaultSharedCacheHolder()
- );
- }
-
- private WritablePropertyValueModel<Boolean> buildSharedCacheHolder() {
- return new PropertyAspectAdapter<Entity, Boolean>(
- getSubjectHolder(), Entity.SHARED_CACHE_PROPERTY) {
- @Override
- protected Boolean buildValue_() {
- return getSubjectParent().getSharedCacheOf(getSubjectName());
- }
-
- @Override
- protected void setValue_(Boolean value) {
- getSubjectParent().setSharedCacheOf(getSubjectName(), value);
- }
- };
- }
-
- private String getSubjectName() {
- return this.getSubjectHolder().getValue().getName();
- }
-
- private Caching getSubjectParent() {
- return this.getSubjectHolder().getValue().getParent();
- }
-
- private ListValueModel<Boolean> buildSharedCacheListHolder() {
- return new PropertyListValueModelAdapter<Boolean>(
- buildSharedCacheHolder()
- );
- }
-
- private PropertyValueModel<String> buildSharedCacheStringHolder() {
- return new TransformationPropertyValueModel<Boolean, String>(buildDefaultAndNonDefaultSharedCacheHolder()) {
- @Override
- protected String transform(Boolean value) {
- if (value != null) {
- String defaultStringValue = value.booleanValue() ? EclipseLinkUiMessages.Boolean_True : EclipseLinkUiMessages.Boolean_False;
- return NLS.bind(EclipseLinkUiMessages.PersistenceXmlCachingTab_defaultSharedCacheLabel, defaultStringValue);
- }
- return EclipseLinkUiMessages.PersistenceXmlCachingTab_sharedCacheLabel;
- }
- };
- }
-
- @Override
- public void enableWidgets(boolean enabled) {
- super.enableWidgets(enabled);
- this.sharedCacheCheckBox.setEnabled(enabled);
- }
-
- @Override
- protected void initializeLayout(Composite container) {
-
- this.sharedCacheCheckBox = this.addTriStateCheckBoxWithDefault(
- container,
- EclipseLinkUiMessages.PersistenceXmlCachingTab_sharedCacheLabel,
- this.buildSharedCacheHolder(),
- this.buildSharedCacheStringHolder(),
- EclipseLinkHelpContextIds.PERSISTENCE_CACHING
- );
- }
-} \ No newline at end of file
diff --git a/jpa/plugins/org.eclipse.jpt.eclipselink.ui/src/org/eclipse/jpt/eclipselink/ui/internal/persistence/connection/BatchWritingComposite.java b/jpa/plugins/org.eclipse.jpt.eclipselink.ui/src/org/eclipse/jpt/eclipselink/ui/internal/persistence/connection/BatchWritingComposite.java
deleted file mode 100644
index cfe1ff2e67..0000000000
--- a/jpa/plugins/org.eclipse.jpt.eclipselink.ui/src/org/eclipse/jpt/eclipselink/ui/internal/persistence/connection/BatchWritingComposite.java
+++ /dev/null
@@ -1,87 +0,0 @@
-/*******************************************************************************
- * Copyright (c) 2008, 2009 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.
- *
- * Contributors:
- * Oracle - initial API and implementation
- *******************************************************************************/
-package org.eclipse.jpt.eclipselink.ui.internal.persistence.connection;
-
-import java.util.Collection;
-
-import org.eclipse.jpt.eclipselink.core.internal.context.persistence.connection.BatchWriting;
-import org.eclipse.jpt.eclipselink.core.internal.context.persistence.connection.Connection;
-import org.eclipse.jpt.eclipselink.ui.internal.EclipseLinkUiMessages;
-import org.eclipse.jpt.ui.internal.JpaHelpContextIds;
-import org.eclipse.jpt.ui.internal.widgets.EnumFormComboViewer;
-import org.eclipse.jpt.ui.internal.widgets.FormPane;
-import org.eclipse.swt.widgets.Composite;
-
-/**
- * BatchWritingComposite
- */
-public class BatchWritingComposite extends FormPane<Connection>
-{
- /**
- * Creates a new <code>BatchWritingComposite</code>.
- *
- * @param parentController
- * The parent container of this one
- * @param parent
- * The parent container
- */
- public BatchWritingComposite(
- FormPane<? extends Connection> parentComposite,
- Composite parent) {
-
- super( parentComposite, parent);
- }
-
- private EnumFormComboViewer<Connection, BatchWriting> addBatchWritingCombo(Composite container) {
- return new EnumFormComboViewer<Connection, BatchWriting>(this, container) {
- @Override
- protected void addPropertyNames(Collection<String> propertyNames) {
- super.addPropertyNames(propertyNames);
- propertyNames.add(Connection.BATCH_WRITING_PROPERTY);
- }
-
- @Override
- protected BatchWriting[] getChoices() {
- return BatchWriting.values();
- }
-
- @Override
- protected BatchWriting getDefaultValue() {
- return getSubject().getDefaultBatchWriting();
- }
-
- @Override
- protected String displayString(BatchWriting value) {
- return buildDisplayString(EclipseLinkUiMessages.class, BatchWritingComposite.this, value);
- }
-
- @Override
- protected BatchWriting getValue() {
- return getSubject().getBatchWriting();
- }
-
- @Override
- protected void setValue(BatchWriting value) {
- getSubject().setBatchWriting(value);
- }
- };
- }
-
- @Override
- protected void initializeLayout( Composite container) {
-
- this.addLabeledComposite(
- container,
- EclipseLinkUiMessages.PersistenceXmlConnectionTab_batchWritingLabel,
- this.addBatchWritingCombo( container),
- JpaHelpContextIds.PERSISTENCE_XML_CONNECTION
- );
- }
-}
diff --git a/jpa/plugins/org.eclipse.jpt.eclipselink.ui/src/org/eclipse/jpt/eclipselink/ui/internal/persistence/connection/CacheStatementsPropertiesComposite.java b/jpa/plugins/org.eclipse.jpt.eclipselink.ui/src/org/eclipse/jpt/eclipselink/ui/internal/persistence/connection/CacheStatementsPropertiesComposite.java
deleted file mode 100644
index 8483ae6bc9..0000000000
--- a/jpa/plugins/org.eclipse.jpt.eclipselink.ui/src/org/eclipse/jpt/eclipselink/ui/internal/persistence/connection/CacheStatementsPropertiesComposite.java
+++ /dev/null
@@ -1,132 +0,0 @@
-/*******************************************************************************
-* Copyright (c) 2008, 2009 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.
-*
-* Contributors:
-* Oracle - initial API and implementation
-*******************************************************************************/
-package org.eclipse.jpt.eclipselink.ui.internal.persistence.connection;
-
-import org.eclipse.jpt.eclipselink.core.internal.context.persistence.connection.Connection;
-import org.eclipse.jpt.eclipselink.ui.internal.EclipseLinkUiMessages;
-import org.eclipse.jpt.ui.internal.JpaHelpContextIds;
-import org.eclipse.jpt.ui.internal.util.PaneEnabler;
-import org.eclipse.jpt.ui.internal.widgets.IntegerCombo;
-import org.eclipse.jpt.ui.internal.widgets.Pane;
-import org.eclipse.jpt.utility.internal.StringConverter;
-import org.eclipse.jpt.utility.internal.model.value.PropertyAspectAdapter;
-import org.eclipse.jpt.utility.model.value.PropertyValueModel;
-import org.eclipse.jpt.utility.model.value.WritablePropertyValueModel;
-import org.eclipse.swt.custom.CCombo;
-import org.eclipse.swt.widgets.Composite;
-
-/**
- * CacheStatementsPropertiesComposite
- */
-public class CacheStatementsPropertiesComposite extends Pane<Connection>
-{
- public CacheStatementsPropertiesComposite(Pane<Connection> parentComposite, Composite parent) {
-
- super(parentComposite, parent);
- }
-
- @Override
- protected void initializeLayout(Composite container) {
-
- WritablePropertyValueModel<Boolean> cacheStatementsHolder = buildCacheStatementsHolder();
-
- container = this.addSubPane(container, 3, 5, 0, 0, 0);
-
- this.addTriStateCheckBox(
- container,
- EclipseLinkUiMessages.PersistenceXmlConnectionTab_cacheStatementsLabel,
- cacheStatementsHolder,
- JpaHelpContextIds.PERSISTENCE_XML_CONNECTION
- );
- IntegerCombo<?> combo = addCacheStatementsSizeCombo(container);
-
- this.installControlEnabler(cacheStatementsHolder, combo);
- }
-
- private WritablePropertyValueModel<Boolean> buildCacheStatementsHolder() {
- return new PropertyAspectAdapter<Connection, Boolean>(getSubjectHolder(), Connection.CACHE_STATEMENTS_PROPERTY) {
- @Override
- protected Boolean buildValue_() {
- return this.subject.getCacheStatements();
- }
-
- @Override
- protected void setValue_(Boolean value) {
- this.subject.setCacheStatements(value);
- }
-
- @Override
- protected void subjectChanged() {
- Object oldValue = this.getValue();
- super.subjectChanged();
- Object newValue = this.getValue();
-
- // Make sure the default value is appended to the text
- if (oldValue == newValue && newValue == null) {
- this.fireAspectChanged(Boolean.TRUE, newValue);
- }
- }
- };
- }
-
- private IntegerCombo<Connection> addCacheStatementsSizeCombo(Composite container) {
- return new IntegerCombo<Connection>(this, container) {
-
- @Override
- protected CCombo addIntegerCombo(Composite container) {
- return this.addEditableCCombo(
- container,
- buildDefaultListHolder(),
- buildSelectedItemStringHolder(),
- StringConverter.Default.<String>instance());
- }
-
- @Override
- protected String getLabelText() {
- throw new UnsupportedOperationException();
- }
-
- @Override
- protected String getHelpId() {
- return JpaHelpContextIds.PERSISTENCE_XML_CONNECTION;
- }
-
- @Override
- protected PropertyValueModel<Integer> buildDefaultHolder() {
- return new PropertyAspectAdapter<Connection, Integer>(getSubjectHolder()) {
- @Override
- protected Integer buildValue_() {
- return this.subject.getDefaultCacheStatementsSize();
- }
- };
- }
-
- @Override
- protected WritablePropertyValueModel<Integer> buildSelectedItemHolder() {
- return new PropertyAspectAdapter<Connection, Integer>(getSubjectHolder(), Connection.CACHE_STATEMENTS_SIZE_PROPERTY) {
- @Override
- protected Integer buildValue_() {
- return this.subject.getCacheStatementsSize();
- }
-
- @Override
- protected void setValue_(Integer value) {
- this.subject.setCacheStatementsSize(value);
- }
- };
- }
- };
- }
-
- private void installControlEnabler(WritablePropertyValueModel<Boolean> cacheStatementsHolder, IntegerCombo<?> combo) {
-
- new PaneEnabler(cacheStatementsHolder, combo);
- }
-} \ No newline at end of file
diff --git a/jpa/plugins/org.eclipse.jpt.eclipselink.ui/src/org/eclipse/jpt/eclipselink/ui/internal/persistence/connection/ConnectionPropertiesComposite.java b/jpa/plugins/org.eclipse.jpt.eclipselink.ui/src/org/eclipse/jpt/eclipselink/ui/internal/persistence/connection/ConnectionPropertiesComposite.java
deleted file mode 100644
index 0db4240567..0000000000
--- a/jpa/plugins/org.eclipse.jpt.eclipselink.ui/src/org/eclipse/jpt/eclipselink/ui/internal/persistence/connection/ConnectionPropertiesComposite.java
+++ /dev/null
@@ -1,38 +0,0 @@
-/*******************************************************************************
-* Copyright (c) 2008 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.
-*
-* Contributors:
-* Oracle - initial API and implementation
-*******************************************************************************/
-package org.eclipse.jpt.eclipselink.ui.internal.persistence.connection;
-
-import org.eclipse.jpt.eclipselink.core.internal.context.persistence.connection.Connection;
-import org.eclipse.jpt.eclipselink.ui.internal.EclipseLinkUiMessages;
-import org.eclipse.jpt.ui.internal.widgets.Pane;
-import org.eclipse.swt.widgets.Composite;
-
-/**
- * ConnectionPropertiesComposite
- */
-public class ConnectionPropertiesComposite extends Pane<Connection>
-{
- public ConnectionPropertiesComposite(Pane<Connection> parentComposite, Composite parent) {
-
- super(parentComposite, parent);
- }
-
- @Override
- protected void initializeLayout(Composite container) {
-
- container = addTitledGroup(
- container,
- EclipseLinkUiMessages.ConnectionPropertiesComposite_Database_GroupBox
- );
-
- new DataSourcePropertiesComposite(this, container);
- new JdbcPropertiesComposite(this, container);
- }
-} \ No newline at end of file
diff --git a/jpa/plugins/org.eclipse.jpt.eclipselink.ui/src/org/eclipse/jpt/eclipselink/ui/internal/persistence/connection/DataSourcePropertiesComposite.java b/jpa/plugins/org.eclipse.jpt.eclipselink.ui/src/org/eclipse/jpt/eclipselink/ui/internal/persistence/connection/DataSourcePropertiesComposite.java
deleted file mode 100644
index b4aafbfb1f..0000000000
--- a/jpa/plugins/org.eclipse.jpt.eclipselink.ui/src/org/eclipse/jpt/eclipselink/ui/internal/persistence/connection/DataSourcePropertiesComposite.java
+++ /dev/null
@@ -1,152 +0,0 @@
-/*******************************************************************************
- * Copyright (c) 2008, 2009 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.
- *
- * Contributors:
- * Oracle - initial API and implementation
- ******************************************************************************/
-package org.eclipse.jpt.eclipselink.ui.internal.persistence.connection;
-
-import org.eclipse.jpt.core.context.persistence.PersistenceUnit;
-import org.eclipse.jpt.core.context.persistence.PersistenceUnitTransactionType;
-import org.eclipse.jpt.eclipselink.core.internal.context.persistence.connection.Connection;
-import org.eclipse.jpt.eclipselink.ui.internal.EclipseLinkUiMessages;
-import org.eclipse.jpt.ui.internal.JpaHelpContextIds;
-import org.eclipse.jpt.ui.internal.util.ControlEnabler;
-import org.eclipse.jpt.ui.internal.widgets.Pane;
-import org.eclipse.jpt.utility.internal.model.value.PropertyAspectAdapter;
-import org.eclipse.jpt.utility.internal.model.value.TransformationPropertyValueModel;
-import org.eclipse.jpt.utility.model.value.PropertyValueModel;
-import org.eclipse.jpt.utility.model.value.WritablePropertyValueModel;
-import org.eclipse.swt.widgets.Composite;
-import org.eclipse.swt.widgets.Label;
-import org.eclipse.swt.widgets.Text;
-
-/**
- * @version 2.0
- * @since 2.0
- */
-public class DataSourcePropertiesComposite extends Pane<Connection> {
-
- /**
- * Creates a new <code>DataSourcePropertiesComposite</code>.
- *
- * @param parentPane The parent container of this one
- * @param parent The parent container
- */
- public DataSourcePropertiesComposite(Pane<Connection> parentComposite,
- Composite parent) {
-
- super(parentComposite, parent);
- }
-
- private WritablePropertyValueModel<String> buildJtaDataSourceHolder() {
- return new PropertyAspectAdapter<PersistenceUnit, String>(buildPersistenceUnitHolder(), PersistenceUnit.JTA_DATA_SOURCE_PROPERTY) {
- @Override
- protected String buildValue_() {
- return this.subject.getJtaDataSource();
- }
-
- @Override
- protected void setValue_(String value) {
- if (value.length() == 0) {
- value = null;
- }
- this.subject.setJtaDataSource(value);
- }
- };
- }
-
- private PropertyValueModel<Boolean> buildJTADataSourceHolder() {
- return new TransformationPropertyValueModel<PersistenceUnitTransactionType, Boolean>(buildTransactionTypeHolder()) {
- @Override
- protected Boolean transform(PersistenceUnitTransactionType value) {
- return value == null || value == PersistenceUnitTransactionType.JTA;
- }
- };
- }
-
- private WritablePropertyValueModel<String> buildNonJtaDataSourceHolder() {
- return new PropertyAspectAdapter<PersistenceUnit, String>(buildPersistenceUnitHolder(), PersistenceUnit.NON_JTA_DATA_SOURCE_PROPERTY) {
- @Override
- protected String buildValue_() {
- return this.subject.getNonJtaDataSource();
- }
-
- @Override
- protected void setValue_(String value) {
- if (value.length() == 0) {
- value = null;
- }
- this.subject.setNonJtaDataSource(value);
- }
- };
- }
-
- private PropertyValueModel<Boolean> buildNonJTADataSourceHolder() {
- return new TransformationPropertyValueModel<PersistenceUnitTransactionType, Boolean>(buildTransactionTypeHolder()) {
- @Override
- protected Boolean transform(PersistenceUnitTransactionType value) {
- return Boolean.valueOf(value == PersistenceUnitTransactionType.RESOURCE_LOCAL);
- }
- };
- }
-
- private PropertyValueModel<PersistenceUnitTransactionType> buildTransactionTypeHolder() {
- return new PropertyAspectAdapter<PersistenceUnit, PersistenceUnitTransactionType>(
- buildPersistenceUnitHolder(),
- PersistenceUnit.SPECIFIED_TRANSACTION_TYPE_PROPERTY,
- PersistenceUnit.DEFAULT_TRANSACTION_TYPE_PROPERTY) {
- @Override
- protected PersistenceUnitTransactionType buildValue_() {
- return this.subject.getTransactionType();
- }
- };
- }
-
- private PropertyValueModel<PersistenceUnit> buildPersistenceUnitHolder() {
- return new PropertyAspectAdapter<Connection, PersistenceUnit>(getSubjectHolder()) {
- @Override
- protected PersistenceUnit buildValue_() {
- return this.subject.getPersistenceUnit();
- }
- };
-
- }
-
- @Override
- protected void initializeLayout(Composite container) {
-
- int groupBoxMargin = getGroupBoxMargin();
-
- container = addSubPane(container, 0, groupBoxMargin, 0, groupBoxMargin);
-
- // JTA Data Source
- Label jtaLabel = addUnmanagedLabel(container, EclipseLinkUiMessages.PersistenceXmlConnectionTab_jtaDataSourceLabel);
- Text text = addUnmanagedText(container, this.buildJtaDataSourceHolder(), this.getHelpID());
- this.addLabeledComposite(container, jtaLabel, text, this.getHelpID());
-
- this.installJTADataSourceControlEnabler(text, jtaLabel);
-
- // Non-JTA Data Source
- Label nonJtaLabel = addUnmanagedLabel(container, EclipseLinkUiMessages.PersistenceXmlConnectionTab_nonJtaDataSourceLabel);
- Text nonJtaText = addUnmanagedText(container, buildNonJtaDataSourceHolder(), this.getHelpID());
- this.addLabeledComposite(container, nonJtaLabel, nonJtaText, this.getHelpID());
-
- this.installNonJTADataSourceControlEnabler(nonJtaText, nonJtaLabel);
- }
-
- private void installJTADataSourceControlEnabler(Text text, Label label) {
- new ControlEnabler(buildJTADataSourceHolder(), text, label);
- }
-
- private void installNonJTADataSourceControlEnabler(Text text, Label label) {
- new ControlEnabler(buildNonJTADataSourceHolder(), text, label);
- }
-
- public String getHelpID() {
- return JpaHelpContextIds.PERSISTENCE_XML_CONNECTION;
- }
-} \ No newline at end of file
diff --git a/jpa/plugins/org.eclipse.jpt.eclipselink.ui/src/org/eclipse/jpt/eclipselink/ui/internal/persistence/connection/EclipseLinkConnectionComposite.java b/jpa/plugins/org.eclipse.jpt.eclipselink.ui/src/org/eclipse/jpt/eclipselink/ui/internal/persistence/connection/EclipseLinkConnectionComposite.java
deleted file mode 100644
index 2f4f76fcac..0000000000
--- a/jpa/plugins/org.eclipse.jpt.eclipselink.ui/src/org/eclipse/jpt/eclipselink/ui/internal/persistence/connection/EclipseLinkConnectionComposite.java
+++ /dev/null
@@ -1,55 +0,0 @@
-/*******************************************************************************
- * Copyright (c) 2008 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.
- *
- * Contributors:
- * Oracle - initial API and implementation
- *******************************************************************************/
-package org.eclipse.jpt.eclipselink.ui.internal.persistence.connection;
-
-import org.eclipse.jpt.eclipselink.core.internal.context.persistence.connection.Connection;
-import org.eclipse.jpt.eclipselink.ui.internal.EclipseLinkUiMessages;
-import org.eclipse.jpt.ui.internal.widgets.FormPane;
-import org.eclipse.swt.widgets.Composite;
-
-/**
- * EclipseLinkConnectionComposite
- */
-public class EclipseLinkConnectionComposite
- extends FormPane<Connection>
-{
- public EclipseLinkConnectionComposite(
- FormPane<Connection> subjectHolder,
- Composite container) {
- super(subjectHolder, container, false);
- }
-
- @Override
- protected void initializeLayout(Composite container) {
-
- int groupBoxMargin = getGroupBoxMargin() * 2;
-
- container = addSection(
- container,
- EclipseLinkUiMessages.PersistenceXmlConnectionTab_sectionTitle,
- EclipseLinkUiMessages.PersistenceXmlConnectionTab_sectionDescription
- );
-
- Composite subPane = addSubPane(
- container,
- 0, groupBoxMargin, 10, groupBoxMargin
- );
-
- new TransactionTypeComposite(this, subPane);
-
- new BatchWritingComposite(this, subPane);
-
- new CacheStatementsPropertiesComposite(this, subPane);
-
- new NativeSqlComposite(this, subPane);
-
- new ConnectionPropertiesComposite(this, container);
- }
-} \ No newline at end of file
diff --git a/jpa/plugins/org.eclipse.jpt.eclipselink.ui/src/org/eclipse/jpt/eclipselink/ui/internal/persistence/connection/JdbcBindParametersComposite.java b/jpa/plugins/org.eclipse.jpt.eclipselink.ui/src/org/eclipse/jpt/eclipselink/ui/internal/persistence/connection/JdbcBindParametersComposite.java
deleted file mode 100644
index 459fc50e96..0000000000
--- a/jpa/plugins/org.eclipse.jpt.eclipselink.ui/src/org/eclipse/jpt/eclipselink/ui/internal/persistence/connection/JdbcBindParametersComposite.java
+++ /dev/null
@@ -1,96 +0,0 @@
-/*******************************************************************************
- * Copyright (c) 2008, 2009 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.
- *
- * Contributors:
- * Oracle - initial API and implementation
- *******************************************************************************/
-package org.eclipse.jpt.eclipselink.ui.internal.persistence.connection;
-
-import org.eclipse.jpt.eclipselink.core.internal.context.persistence.connection.Connection;
-import org.eclipse.jpt.eclipselink.ui.internal.EclipseLinkUiMessages;
-import org.eclipse.jpt.ui.internal.JpaHelpContextIds;
-import org.eclipse.jpt.ui.internal.widgets.Pane;
-import org.eclipse.jpt.utility.internal.model.value.PropertyAspectAdapter;
-import org.eclipse.jpt.utility.internal.model.value.TransformationPropertyValueModel;
-import org.eclipse.jpt.utility.model.value.PropertyValueModel;
-import org.eclipse.jpt.utility.model.value.WritablePropertyValueModel;
-import org.eclipse.osgi.util.NLS;
-import org.eclipse.swt.widgets.Composite;
-
-/**
- * JdbcBindParametersComposite
- */
-public class JdbcBindParametersComposite extends Pane<Connection>
-{
- /**
- * Creates a new <code>JdbcBindParametersComposite</code>.
- *
- * @param parentController
- * The parent container of this one
- * @param parent
- * The parent container
- */
- public JdbcBindParametersComposite(
- Pane<? extends Connection> parentComposite,
- Composite parent) {
-
- super(parentComposite, parent);
- }
-
- @Override
- protected void initializeLayout(Composite container) {
-
- this.addTriStateCheckBoxWithDefault(
- container,
- EclipseLinkUiMessages.PersistenceXmlConnectionTab_bindParametersLabel,
- this.buildBindParametersHolder(),
- this.buildBindParametersStringHolder(),
- JpaHelpContextIds.PERSISTENCE_XML_CONNECTION
- );
- }
-
- private WritablePropertyValueModel<Boolean> buildBindParametersHolder() {
- return new PropertyAspectAdapter<Connection, Boolean>(getSubjectHolder(), Connection.BIND_PARAMETERS_PROPERTY) {
- @Override
- protected Boolean buildValue_() {
- return this.subject.getBindParameters();
- }
-
- @Override
- protected void setValue_(Boolean value) {
- this.subject.setBindParameters(value);
- }
- };
- }
-
- private PropertyValueModel<String> buildBindParametersStringHolder() {
- return new TransformationPropertyValueModel<Boolean, String>(buildDefaultBindParametersHolder()) {
- @Override
- protected String transform(Boolean value) {
- if (value != null) {
- String defaultStringValue = value.booleanValue() ? EclipseLinkUiMessages.Boolean_True : EclipseLinkUiMessages.Boolean_False;
- return NLS.bind(EclipseLinkUiMessages.PersistenceXmlConnectionTab_bindParametersLabelDefault, defaultStringValue);
- }
- return EclipseLinkUiMessages.PersistenceXmlConnectionTab_bindParametersLabel;
- }
- };
- }
-
- private PropertyValueModel<Boolean> buildDefaultBindParametersHolder() {
- return new PropertyAspectAdapter<Connection, Boolean>(
- getSubjectHolder(),
- Connection.BIND_PARAMETERS_PROPERTY)
- {
- @Override
- protected Boolean buildValue_() {
- if (this.subject.getBindParameters() != null) {
- return null;
- }
- return this.subject.getDefaultBindParameters();
- }
- };
- }
-}
diff --git a/jpa/plugins/org.eclipse.jpt.eclipselink.ui/src/org/eclipse/jpt/eclipselink/ui/internal/persistence/connection/JdbcConnectionPropertiesComposite.java b/jpa/plugins/org.eclipse.jpt.eclipselink.ui/src/org/eclipse/jpt/eclipselink/ui/internal/persistence/connection/JdbcConnectionPropertiesComposite.java
deleted file mode 100644
index 5c6b9a69b8..0000000000
--- a/jpa/plugins/org.eclipse.jpt.eclipselink.ui/src/org/eclipse/jpt/eclipselink/ui/internal/persistence/connection/JdbcConnectionPropertiesComposite.java
+++ /dev/null
@@ -1,340 +0,0 @@
-/*******************************************************************************
-* Copyright (c) 2008 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.
-*
-* Contributors:
-* Oracle - initial API and implementation
-*******************************************************************************/
-package org.eclipse.jpt.eclipselink.ui.internal.persistence.connection;
-
-import java.util.Comparator;
-import java.util.Iterator;
-import org.eclipse.core.runtime.CoreException;
-import org.eclipse.core.runtime.IProgressMonitor;
-import org.eclipse.core.runtime.IStatus;
-import org.eclipse.core.runtime.Status;
-import org.eclipse.jface.dialogs.IDialogConstants;
-import org.eclipse.jface.dialogs.IDialogSettings;
-import org.eclipse.jface.viewers.ILabelProvider;
-import org.eclipse.jface.viewers.LabelProvider;
-import org.eclipse.jpt.db.ConnectionProfile;
-import org.eclipse.jpt.db.ConnectionProfileFactory;
-import org.eclipse.jpt.db.JptDbPlugin;
-import org.eclipse.jpt.eclipselink.core.internal.context.persistence.connection.Connection;
-import org.eclipse.jpt.eclipselink.ui.internal.EclipseLinkUiMessages;
-import org.eclipse.jpt.ui.JptUiPlugin;
-import org.eclipse.jpt.ui.internal.widgets.Pane;
-import org.eclipse.jpt.utility.internal.StringTools;
-import org.eclipse.jpt.utility.internal.model.value.PropertyAspectAdapter;
-import org.eclipse.jpt.utility.model.value.WritablePropertyValueModel;
-import org.eclipse.swt.graphics.Image;
-import org.eclipse.swt.widgets.Composite;
-import org.eclipse.swt.widgets.Control;
-import org.eclipse.swt.widgets.Shell;
-import org.eclipse.ui.dialogs.FilteredItemsSelectionDialog;
-
-/**
- * JdbcConnectionPropertiesComposite
- */
-@SuppressWarnings("nls")
-public class JdbcConnectionPropertiesComposite extends Pane<Connection>
-{
- /**
- * The constant ID used to retrieve the dialog settings.
- */
- private static final String DIALOG_SETTINGS = "org.eclipse.jpt.eclipselink.ui.dialogs.ConnectionDialog";
-
- public JdbcConnectionPropertiesComposite(Pane<Connection> parentComposite, Composite parent) {
-
- super(parentComposite, parent);
- }
-
- private WritablePropertyValueModel<String> buildPasswordHolder() {
- return new PropertyAspectAdapter<Connection, String>(getSubjectHolder(), Connection.PASSWORD_PROPERTY) {
- @Override
- protected String buildValue_() {
- return subject.getPassword();
- }
-
- @Override
- protected void setValue_(String value) {
- if (value.length() == 0) {
- value = null;
- }
- subject.setPassword(value);
- }
- };
- }
-
- private Runnable buildPopulateFromConnectionAction() {
- return new Runnable() {
- public void run() {
- promptConnection();
- }
- };
- }
-
- private WritablePropertyValueModel<String> buildUrlHolder() {
- return new PropertyAspectAdapter<Connection, String>(getSubjectHolder(), Connection.URL_PROPERTY) {
- @Override
- protected String buildValue_() {
- return subject.getUrl();
- }
-
- @Override
- protected void setValue_(String value) {
- if (value.length() == 0) {
- value = null;
- }
- subject.setUrl(value);
- }
- };
- }
-
- private WritablePropertyValueModel<String> buildUserHolder() {
- return new PropertyAspectAdapter<Connection, String>(getSubjectHolder(), Connection.USER_PROPERTY) {
- @Override
- protected String buildValue_() {
- return subject.getUser();
- }
-
- @Override
- protected void setValue_(String value) {
- if (value.length() == 0) {
- value = null;
- }
- subject.setUser(value);
- }
- };
- }
-
- @Override
- protected void initializeLayout(Composite container) {
-
- // Populate from Connection hyperlink
- this.addHyperlink(
- container,
- "Populate from Connection...",
- buildPopulateFromConnectionAction()
- );
-
- // Driver
- new JdbcDriverComposite(this, container);
-
- // Url
- this.addLabeledText(
- container,
- EclipseLinkUiMessages.PersistenceXmlConnectionTab_urlLabel,
- buildUrlHolder()
- );
-
- // User
- this.addLabeledText(
- container,
- EclipseLinkUiMessages.PersistenceXmlConnectionTab_userLabel,
- buildUserHolder()
- );
-
- // Password
- this.addLabeledPasswordText(
- container,
- EclipseLinkUiMessages.PersistenceXmlConnectionTab_passwordLabel,
- buildPasswordHolder()
- );
-
- // Bind Parameters
- new JdbcBindParametersComposite(this, container);
- }
-
- void promptConnection() {
-
- ConnectionSelectionDialog dialog = new ConnectionSelectionDialog();
-
- if (dialog.open() != IDialogConstants.OK_ID) {
- return;
- }
-
- String name = (String) dialog.getResult()[0];
- ConnectionProfile cp = this.getConnectionProfileFactory().buildConnectionProfile(name);
-
- Connection connection = getSubject();
- connection.setUrl((cp == null) ? "" : cp.getURL());
- connection.setUser((cp == null) ? "" : cp.getUserName());
- connection.setPassword((cp == null) ? "" : cp.getUserPassword());
- connection.setDriver((cp == null) ? "" : cp.getDriverClassName());
- }
-
- ConnectionProfileFactory getConnectionProfileFactory() {
- // we allow the user to select any connection profile and simply
- // take the settings from it (user, password, etc.) and give them
- // to the EclipseLink connection, so we go
- // to the db plug-in directly to get the factory
- return JptDbPlugin.instance().getConnectionProfileFactory();
- }
-
- // broaden access a bit
- Shell getShell_() {
- return this.getShell();
- }
-
- /**
- * This dialog shows the list of possible connection names and lets the user
- * the option to filter them using a search field.
- */
- protected class ConnectionSelectionDialog extends FilteredItemsSelectionDialog {
-
- /**
- * Creates a new <code>MappingSelectionDialog</code>.
- */
- protected ConnectionSelectionDialog() {
- super(JdbcConnectionPropertiesComposite.this.getShell_(), false);
- setMessage(EclipseLinkUiMessages.JdbcConnectionPropertiesComposite_ConnectionDialog_Message);
- setTitle(EclipseLinkUiMessages.JdbcConnectionPropertiesComposite_ConnectionDialog_Title);
- setListLabelProvider(buildLabelProvider());
- setDetailsLabelProvider(buildLabelProvider());
- }
-
- protected ILabelProvider buildLabelProvider() {
- return new LabelProvider() {
- @Override
- public Image getImage(Object element) {
- return null;
- }
-
- @Override
- public String getText(Object element) {
- return (element == null) ? "" : element.toString();
- }
- };
- }
-
- /*
- * (non-Javadoc)
- */
- @Override
- protected Control createExtendedContentArea(Composite parent) {
- return null;
- }
-
- /*
- * (non-Javadoc)
- */
- @Override
- protected ItemsFilter createFilter() {
- return new ConnectionItemsFilter();
- }
-
- /*
- * (non-Javadoc)
- */
- @Override
- protected void fillContentProvider(AbstractContentProvider provider,
- ItemsFilter itemsFilter,
- IProgressMonitor monitor) throws CoreException {
-
- monitor.beginTask(null, -1);
-
- try {
- // Add the connection names to the dialog
- for (Iterator<String> stream = this.connectionProfileNames(); stream.hasNext(); ) {
- provider.add(stream.next(), itemsFilter);
- }
- }
- finally {
- monitor.done();
- }
- }
-
- private Iterator<String> connectionProfileNames() {
- return JdbcConnectionPropertiesComposite.this.getConnectionProfileFactory().connectionProfileNames();
- }
-
- /*
- * (non-Javadoc)
- */
- @Override
- protected IDialogSettings getDialogSettings() {
-
- IDialogSettings dialogSettings = JptUiPlugin.instance().getDialogSettings();
- IDialogSettings settings = dialogSettings.getSection(DIALOG_SETTINGS);
-
- if (settings == null) {
- settings = dialogSettings.addNewSection(DIALOG_SETTINGS);
- }
-
- return settings;
- }
-
- /*
- * (non-Javadoc)
- */
- @Override
- public String getElementName(Object object) {
- return object.toString();
- }
-
- /*
- * (non-Javadoc)
- */
- @Override
- protected Comparator<String> getItemsComparator() {
- return new Comparator<String>() {
- public int compare(String item1, String item2) {
- return item1.compareTo(item2);
- }
- };
- }
-
- /*
- * (non-Javadoc)
- */
- @Override
- protected IStatus validateItem(Object item) {
-
- if (item == null) {
- return new Status(IStatus.ERROR, JptUiPlugin.PLUGIN_ID, IStatus.ERROR, "", null);
- }
-
- return Status.OK_STATUS;
- }
-
- /**
- * Create the filter responsible to remove any connection name based on
- * the pattern entered in the text field.
- */
- private class ConnectionItemsFilter extends ItemsFilter {
-
- /**
- * Creates a new <code>ConnectionItemsFilter</code>.
- */
- ConnectionItemsFilter() {
-
- super();
-
- // Make sure that if the pattern is empty, we specify * in order
- // to show all the mapping types
- if (StringTools.stringIsEmpty(getPattern())) {
- patternMatcher.setPattern("*");
- }
- }
-
- /*
- * (non-Javadoc)
- */
- @Override
- public boolean isConsistentItem(Object item) {
- return true;
- }
-
- /*
- * (non-Javadoc)
- */
- @Override
- public boolean matchItem(Object item) {
- return matches(item.toString());
- }
- }
- }
-} \ No newline at end of file
diff --git a/jpa/plugins/org.eclipse.jpt.eclipselink.ui/src/org/eclipse/jpt/eclipselink/ui/internal/persistence/connection/JdbcDriverComposite.java b/jpa/plugins/org.eclipse.jpt.eclipselink.ui/src/org/eclipse/jpt/eclipselink/ui/internal/persistence/connection/JdbcDriverComposite.java
deleted file mode 100644
index 9d7a943a7e..0000000000
--- a/jpa/plugins/org.eclipse.jpt.eclipselink.ui/src/org/eclipse/jpt/eclipselink/ui/internal/persistence/connection/JdbcDriverComposite.java
+++ /dev/null
@@ -1,93 +0,0 @@
-/*******************************************************************************
-* Copyright (c) 2008 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.
-*
-* Contributors:
-* Oracle - initial API and implementation
-*******************************************************************************/
-package org.eclipse.jpt.eclipselink.ui.internal.persistence.connection;
-
-import org.eclipse.jpt.core.JpaProject;
-import org.eclipse.jpt.eclipselink.core.internal.context.persistence.connection.Connection;
-import org.eclipse.jpt.eclipselink.ui.internal.EclipseLinkUiMessages;
-import org.eclipse.jpt.ui.internal.widgets.ClassChooserPane;
-import org.eclipse.jpt.ui.internal.widgets.Pane;
-import org.eclipse.jpt.utility.internal.model.value.PropertyAspectAdapter;
-import org.eclipse.jpt.utility.model.value.WritablePropertyValueModel;
-import org.eclipse.swt.widgets.Composite;
-
-/**
- * JdbcDriverComposite
- */
-public class JdbcDriverComposite extends Pane<Connection>
-{
- /**
- * Creates a new <code>EventListenerComposite</code>.
- *
- * @param parentPane The parent pane of this one
- * @param parent The parent container
- */
- public JdbcDriverComposite(Pane<? extends Connection> parentPane,
- Composite parent) {
-
- super(parentPane, parent);
- }
-
- private ClassChooserPane<Connection> initializeClassChooser(Composite container) {
-
- return new ClassChooserPane<Connection>(this, container) {
-
- @Override
- protected WritablePropertyValueModel<String> buildTextHolder() {
- return new PropertyAspectAdapter<Connection, String>(
- this.getSubjectHolder(), Connection.DRIVER_PROPERTY) {
- @Override
- protected String buildValue_() {
- return this.subject.getDriver();
- }
-
- @Override
- protected void setValue_(String value) {
-
- if (value.length() == 0) {
- value = null;
- }
- this.subject.setDriver(value);
- }
- };
- }
-
- @Override
- protected String getClassName() {
- return this.getSubject().getDriver();
- }
-
- @Override
- protected String getLabelText() {
- return EclipseLinkUiMessages.PersistenceXmlConnectionTab_driverLabel;
- }
-
- @Override
- protected JpaProject getJpaProject() {
- return getSubject().getJpaProject();
- }
- @Override
- protected void setClassName(String className) {
- this.getSubject().setDriver(className);
- }
-
- @Override
- protected boolean allowTypeCreation() {
- //Does not make sense to allow the user to create a new Driver class
- return false;
- }
- };
- }
-
- @Override
- protected void initializeLayout(Composite container) {
- this.initializeClassChooser(container);
- }
-}
diff --git a/jpa/plugins/org.eclipse.jpt.eclipselink.ui/src/org/eclipse/jpt/eclipselink/ui/internal/persistence/connection/JdbcPropertiesComposite.java b/jpa/plugins/org.eclipse.jpt.eclipselink.ui/src/org/eclipse/jpt/eclipselink/ui/internal/persistence/connection/JdbcPropertiesComposite.java
deleted file mode 100644
index a4b532efac..0000000000
--- a/jpa/plugins/org.eclipse.jpt.eclipselink.ui/src/org/eclipse/jpt/eclipselink/ui/internal/persistence/connection/JdbcPropertiesComposite.java
+++ /dev/null
@@ -1,86 +0,0 @@
-/*******************************************************************************
-* Copyright (c) 2008, 2009 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.
-*
-* Contributors:
-* Oracle - initial API and implementation
-*******************************************************************************/
-package org.eclipse.jpt.eclipselink.ui.internal.persistence.connection;
-
-import org.eclipse.jpt.core.context.persistence.PersistenceUnit;
-import org.eclipse.jpt.core.context.persistence.PersistenceUnitTransactionType;
-import org.eclipse.jpt.eclipselink.core.internal.context.persistence.connection.Connection;
-import org.eclipse.jpt.eclipselink.ui.internal.EclipseLinkUiMessages;
-import org.eclipse.jpt.ui.internal.util.PaneEnabler;
-import org.eclipse.jpt.ui.internal.widgets.Pane;
-import org.eclipse.jpt.utility.internal.model.value.PropertyAspectAdapter;
-import org.eclipse.jpt.utility.internal.model.value.TransformationPropertyValueModel;
-import org.eclipse.jpt.utility.model.value.PropertyValueModel;
-import org.eclipse.swt.layout.GridLayout;
-import org.eclipse.swt.widgets.Composite;
-
-/**
- * JdbcPropertiesComposite
- */
-public class JdbcPropertiesComposite extends Pane<Connection>
-{
- public JdbcPropertiesComposite(Pane<Connection> parentComposite, Composite parent) {
-
- super(parentComposite, parent);
- }
-
- private PropertyValueModel<Boolean> buildPaneEnablerHolder() {
- return new TransformationPropertyValueModel<PersistenceUnitTransactionType, Boolean>(buildTransactionTypeHolder()) {
- @Override
- protected Boolean transform(PersistenceUnitTransactionType value) {
- return value == PersistenceUnitTransactionType.RESOURCE_LOCAL;
- }
- };
- }
-
- private PropertyValueModel<PersistenceUnitTransactionType> buildTransactionTypeHolder() {
- return new PropertyAspectAdapter<PersistenceUnit, PersistenceUnitTransactionType>(
- buildPersistenceUnitHolder(),
- PersistenceUnit.SPECIFIED_TRANSACTION_TYPE_PROPERTY,
- PersistenceUnit.DEFAULT_TRANSACTION_TYPE_PROPERTY) {
- @Override
- protected PersistenceUnitTransactionType buildValue_() {
- return this.subject.getTransactionType();
- }
- };
- }
-
- private PropertyValueModel<PersistenceUnit> buildPersistenceUnitHolder() {
- return new PropertyAspectAdapter<Connection, PersistenceUnit>(getSubjectHolder()) {
- @Override
- protected PersistenceUnit buildValue_() {
- return this.subject.getPersistenceUnit();
- }
- };
-
- }
-
- @Override
- protected void initializeLayout(Composite container) {
-
- container = addTitledGroup(
- addSubPane(container, 10),
- EclipseLinkUiMessages.JdbcPropertiesComposite_EclipseLinkConnectionPool_GroupBox
- );
-
- new JdbcConnectionPropertiesComposite(this, container);
-
- container = addPane(container, new GridLayout(2, true));
-
- new JdbcReadConnectionPropertiesComposite(this, container);
- new JdbcWriteConnectionPropertiesComposite(this, container);
-
- this.installPaneEnabler();
- }
-
- private void installPaneEnabler() {
- new PaneEnabler(buildPaneEnablerHolder(), this);
- }
-} \ No newline at end of file
diff --git a/jpa/plugins/org.eclipse.jpt.eclipselink.ui/src/org/eclipse/jpt/eclipselink/ui/internal/persistence/connection/JdbcReadConnectionPropertiesComposite.java b/jpa/plugins/org.eclipse.jpt.eclipselink.ui/src/org/eclipse/jpt/eclipselink/ui/internal/persistence/connection/JdbcReadConnectionPropertiesComposite.java
deleted file mode 100644
index d1796e38ed..0000000000
--- a/jpa/plugins/org.eclipse.jpt.eclipselink.ui/src/org/eclipse/jpt/eclipselink/ui/internal/persistence/connection/JdbcReadConnectionPropertiesComposite.java
+++ /dev/null
@@ -1,52 +0,0 @@
-/*******************************************************************************
-* Copyright (c) 2008 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.
-*
-* Contributors:
-* Oracle - initial API and implementation
-*******************************************************************************/
-package org.eclipse.jpt.eclipselink.ui.internal.persistence.connection;
-
-import org.eclipse.jpt.eclipselink.core.internal.context.persistence.connection.Connection;
-import org.eclipse.jpt.eclipselink.ui.internal.EclipseLinkUiMessages;
-import org.eclipse.jpt.ui.internal.widgets.Pane;
-import org.eclipse.swt.SWT;
-import org.eclipse.swt.layout.GridData;
-import org.eclipse.swt.widgets.Composite;
-
-/**
- * JdbcReadConnectionPropertiesComposite
- */
-public class JdbcReadConnectionPropertiesComposite extends Pane<Connection>
-{
- public JdbcReadConnectionPropertiesComposite(Pane<Connection> parentComposite, Composite parent) {
-
- super(parentComposite, parent, false);
- }
-
- @Override
- protected void initializeLayout(Composite container) {
-
- container = this.addSection(
- container,
- EclipseLinkUiMessages.PersistenceXmlConnectionTab_readConnectionsSectionTitle
- );
-
- GridData data = (GridData) container.getLayoutData();
- data.verticalAlignment = SWT.TOP;
-
- data = (GridData) getControl().getLayoutData();
- data.verticalAlignment = SWT.TOP;
-
- // Read Connections Shared
- new JdbcReadConnectionsSharedComposite(this, container);
-
- // Read Connections Minimum
- new JdbcReadConnectionsMinComposite(this, container);
-
- // Read Connections Maximum
- new JdbcReadConnectionsMaxComposite(this, container);
- }
-} \ No newline at end of file
diff --git a/jpa/plugins/org.eclipse.jpt.eclipselink.ui/src/org/eclipse/jpt/eclipselink/ui/internal/persistence/connection/JdbcReadConnectionsMaxComposite.java b/jpa/plugins/org.eclipse.jpt.eclipselink.ui/src/org/eclipse/jpt/eclipselink/ui/internal/persistence/connection/JdbcReadConnectionsMaxComposite.java
deleted file mode 100644
index 2775d2d3c3..0000000000
--- a/jpa/plugins/org.eclipse.jpt.eclipselink.ui/src/org/eclipse/jpt/eclipselink/ui/internal/persistence/connection/JdbcReadConnectionsMaxComposite.java
+++ /dev/null
@@ -1,86 +0,0 @@
-/*******************************************************************************
- * Copyright (c) 2008, 2009 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.
- *
- * Contributors:
- * Oracle - initial API and implementation
- *******************************************************************************/
-package org.eclipse.jpt.eclipselink.ui.internal.persistence.connection;
-
-import org.eclipse.jpt.eclipselink.core.internal.context.persistence.connection.Connection;
-import org.eclipse.jpt.eclipselink.ui.internal.EclipseLinkUiMessages;
-import org.eclipse.jpt.ui.internal.JpaHelpContextIds;
-import org.eclipse.jpt.ui.internal.widgets.IntegerCombo;
-import org.eclipse.jpt.ui.internal.widgets.Pane;
-import org.eclipse.jpt.utility.internal.model.value.PropertyAspectAdapter;
-import org.eclipse.jpt.utility.model.value.PropertyValueModel;
-import org.eclipse.jpt.utility.model.value.WritablePropertyValueModel;
-import org.eclipse.swt.widgets.Composite;
-
-/**
- * JdbcReadConnectionsMaxComposite
- */
-public class JdbcReadConnectionsMaxComposite extends Pane<Connection>
-{
- /**
- * Creates a new <code>JdbcReadConnectionsMaxComposite</code>.
- *
- * @param parentController
- * The parent container of this one
- * @param parent
- * The parent container
- */
- public JdbcReadConnectionsMaxComposite(Pane<Connection> parentComposite,
- Composite parent) {
-
- super(parentComposite, parent);
- }
-
-
- @Override
- protected void initializeLayout(Composite container) {
- addReadConnectionsMaxCombo(container);
- }
-
- private void addReadConnectionsMaxCombo(Composite container) {
- new IntegerCombo<Connection>(this, container) {
-
- @Override
- protected String getLabelText() {
- return EclipseLinkUiMessages.PersistenceXmlConnectionTab_readConnectionsMaxLabel;
- }
-
- @Override
- protected String getHelpId() {
- return JpaHelpContextIds.PERSISTENCE_XML_CONNECTION;
- }
-
- @Override
- protected PropertyValueModel<Integer> buildDefaultHolder() {
- return new PropertyAspectAdapter<Connection, Integer>(getSubjectHolder()) {
- @Override
- protected Integer buildValue_() {
- return this.subject.getDefaultReadConnectionsMax();
- }
- };
- }
-
- @Override
- protected WritablePropertyValueModel<Integer> buildSelectedItemHolder() {
- return new PropertyAspectAdapter<Connection, Integer>(getSubjectHolder(), Connection.READ_CONNECTIONS_MAX_PROPERTY) {
- @Override
- protected Integer buildValue_() {
- return this.subject.getReadConnectionsMax();
- }
-
- @Override
- protected void setValue_(Integer value) {
- this.subject.setReadConnectionsMax(value);
- }
- };
- }
- };
- }
-} \ No newline at end of file
diff --git a/jpa/plugins/org.eclipse.jpt.eclipselink.ui/src/org/eclipse/jpt/eclipselink/ui/internal/persistence/connection/JdbcReadConnectionsMinComposite.java b/jpa/plugins/org.eclipse.jpt.eclipselink.ui/src/org/eclipse/jpt/eclipselink/ui/internal/persistence/connection/JdbcReadConnectionsMinComposite.java
deleted file mode 100644
index 0bbd458d83..0000000000
--- a/jpa/plugins/org.eclipse.jpt.eclipselink.ui/src/org/eclipse/jpt/eclipselink/ui/internal/persistence/connection/JdbcReadConnectionsMinComposite.java
+++ /dev/null
@@ -1,85 +0,0 @@
-/*******************************************************************************
- * Copyright (c) 2008, 2009 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.
- *
- * Contributors:
- * Oracle - initial API and implementation
- *******************************************************************************/
-package org.eclipse.jpt.eclipselink.ui.internal.persistence.connection;
-
-import org.eclipse.jpt.eclipselink.core.internal.context.persistence.connection.Connection;
-import org.eclipse.jpt.eclipselink.ui.internal.EclipseLinkUiMessages;
-import org.eclipse.jpt.ui.internal.JpaHelpContextIds;
-import org.eclipse.jpt.ui.internal.widgets.IntegerCombo;
-import org.eclipse.jpt.ui.internal.widgets.Pane;
-import org.eclipse.jpt.utility.internal.model.value.PropertyAspectAdapter;
-import org.eclipse.jpt.utility.model.value.PropertyValueModel;
-import org.eclipse.jpt.utility.model.value.WritablePropertyValueModel;
-import org.eclipse.swt.widgets.Composite;
-
-/**
- * JdbcReadConnectionsMinComposite
- */
-public class JdbcReadConnectionsMinComposite extends Pane<Connection>
-{
- /**
- * Creates a new <code>JdbcReadConnectionsMinComposite</code>.
- *
- * @param parentController
- * The parent container of this one
- * @param parent
- * The parent container
- */
- public JdbcReadConnectionsMinComposite(Pane<Connection> parentComposite,
- Composite parent) {
-
- super(parentComposite, parent);
- }
-
- @Override
- protected void initializeLayout(Composite container) {
- addReadConnectionsMinCombo(container);
- }
-
- private void addReadConnectionsMinCombo(Composite container) {
- new IntegerCombo<Connection>(this, container) {
-
- @Override
- protected String getLabelText() {
- return EclipseLinkUiMessages.PersistenceXmlConnectionTab_readConnectionsMinLabel;
- }
-
- @Override
- protected String getHelpId() {
- return JpaHelpContextIds.PERSISTENCE_XML_CONNECTION;
- }
-
- @Override
- protected PropertyValueModel<Integer> buildDefaultHolder() {
- return new PropertyAspectAdapter<Connection, Integer>(getSubjectHolder()) {
- @Override
- protected Integer buildValue_() {
- return this.subject.getDefaultReadConnectionsMin();
- }
- };
- }
-
- @Override
- protected WritablePropertyValueModel<Integer> buildSelectedItemHolder() {
- return new PropertyAspectAdapter<Connection, Integer>(getSubjectHolder(), Connection.READ_CONNECTIONS_MIN_PROPERTY) {
- @Override
- protected Integer buildValue_() {
- return this.subject.getReadConnectionsMin();
- }
-
- @Override
- protected void setValue_(Integer value) {
- this.subject.setReadConnectionsMin(value);
- }
- };
- }
- };
- }
-} \ No newline at end of file
diff --git a/jpa/plugins/org.eclipse.jpt.eclipselink.ui/src/org/eclipse/jpt/eclipselink/ui/internal/persistence/connection/JdbcReadConnectionsSharedComposite.java b/jpa/plugins/org.eclipse.jpt.eclipselink.ui/src/org/eclipse/jpt/eclipselink/ui/internal/persistence/connection/JdbcReadConnectionsSharedComposite.java
deleted file mode 100644
index d1d2346fb8..0000000000
--- a/jpa/plugins/org.eclipse.jpt.eclipselink.ui/src/org/eclipse/jpt/eclipselink/ui/internal/persistence/connection/JdbcReadConnectionsSharedComposite.java
+++ /dev/null
@@ -1,97 +0,0 @@
-/*******************************************************************************
- * Copyright (c) 2008, 2009 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.
- *
- * Contributors:
- * Oracle - initial API and implementation
- *******************************************************************************/
-package org.eclipse.jpt.eclipselink.ui.internal.persistence.connection;
-
-import org.eclipse.jpt.eclipselink.core.internal.context.persistence.connection.Connection;
-import org.eclipse.jpt.eclipselink.ui.internal.EclipseLinkUiMessages;
-import org.eclipse.jpt.ui.internal.JpaHelpContextIds;
-import org.eclipse.jpt.ui.internal.mappings.JptUiMappingsMessages;
-import org.eclipse.jpt.ui.internal.widgets.Pane;
-import org.eclipse.jpt.utility.internal.model.value.PropertyAspectAdapter;
-import org.eclipse.jpt.utility.internal.model.value.TransformationPropertyValueModel;
-import org.eclipse.jpt.utility.model.value.PropertyValueModel;
-import org.eclipse.jpt.utility.model.value.WritablePropertyValueModel;
-import org.eclipse.osgi.util.NLS;
-import org.eclipse.swt.widgets.Composite;
-
-/**
- * ReadConnectionsSharedComposite
- */
-public class JdbcReadConnectionsSharedComposite extends Pane<Connection>
-{
- /**
- * Creates a new <code>ReadConnectionsSharedComposite</code>.
- *
- * @param parentController
- * The parent container of this one
- * @param parent
- * The parent container
- */
- public JdbcReadConnectionsSharedComposite(
- Pane<? extends Connection> parentComposite,
- Composite parent) {
-
- super(parentComposite, parent);
- }
-
- @Override
- protected void initializeLayout(Composite container) {
-
- this.addTriStateCheckBoxWithDefault(
- container,
- EclipseLinkUiMessages.PersistenceXmlConnectionTab_readConnectionsSharedLabel,
- this.buildReadConnectionsSharedHolder(),
- this.buildReadConnectionsSharedStringHolder(),
- JpaHelpContextIds.PERSISTENCE_XML_CONNECTION
- );
- }
-
- private WritablePropertyValueModel<Boolean> buildReadConnectionsSharedHolder() {
- return new PropertyAspectAdapter<Connection, Boolean>(getSubjectHolder(), Connection.READ_CONNECTIONS_SHARED_PROPERTY) {
- @Override
- protected Boolean buildValue_() {
- return this.subject.getReadConnectionsShared();
- }
-
- @Override
- protected void setValue_(Boolean value) {
- this.subject.setReadConnectionsShared(value);
- }
- };
- }
-
- private PropertyValueModel<String> buildReadConnectionsSharedStringHolder() {
- return new TransformationPropertyValueModel<Boolean, String>(buildDefaultReadConnectionsSharedHolder()) {
- @Override
- protected String transform(Boolean value) {
- if (value != null) {
- String defaultStringValue = value.booleanValue() ? JptUiMappingsMessages.Boolean_True : JptUiMappingsMessages.Boolean_False;
- return NLS.bind(EclipseLinkUiMessages.PersistenceXmlConnectionTab_readConnectionsSharedLabelDefault, defaultStringValue);
- }
- return EclipseLinkUiMessages.PersistenceXmlConnectionTab_readConnectionsSharedLabel;
- }
- };
- }
-
- private PropertyValueModel<Boolean> buildDefaultReadConnectionsSharedHolder() {
- return new PropertyAspectAdapter<Connection, Boolean>(
- getSubjectHolder(),
- Connection.READ_CONNECTIONS_SHARED_PROPERTY)
- {
- @Override
- protected Boolean buildValue_() {
- if (this.subject.getReadConnectionsShared() != null) {
- return null;
- }
- return this.subject.getDefaultReadConnectionsShared();
- }
- };
- }
-}
diff --git a/jpa/plugins/org.eclipse.jpt.eclipselink.ui/src/org/eclipse/jpt/eclipselink/ui/internal/persistence/connection/JdbcWriteConnectionPropertiesComposite.java b/jpa/plugins/org.eclipse.jpt.eclipselink.ui/src/org/eclipse/jpt/eclipselink/ui/internal/persistence/connection/JdbcWriteConnectionPropertiesComposite.java
deleted file mode 100644
index 2d999760e0..0000000000
--- a/jpa/plugins/org.eclipse.jpt.eclipselink.ui/src/org/eclipse/jpt/eclipselink/ui/internal/persistence/connection/JdbcWriteConnectionPropertiesComposite.java
+++ /dev/null
@@ -1,58 +0,0 @@
-/*******************************************************************************
-* Copyright (c) 2008 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.
-*
-* Contributors:
-* Oracle - initial API and implementation
-*******************************************************************************/
-package org.eclipse.jpt.eclipselink.ui.internal.persistence.connection;
-
-import org.eclipse.jpt.eclipselink.core.internal.context.persistence.connection.Connection;
-import org.eclipse.jpt.eclipselink.ui.internal.EclipseLinkUiMessages;
-import org.eclipse.jpt.ui.internal.widgets.Pane;
-import org.eclipse.swt.SWT;
-import org.eclipse.swt.graphics.Point;
-import org.eclipse.swt.layout.GridData;
-import org.eclipse.swt.widgets.Button;
-import org.eclipse.swt.widgets.Composite;
-
-/**
- * JdbcWriteConnectionPropertiesComposite
- */
-@SuppressWarnings("nls")
-public class JdbcWriteConnectionPropertiesComposite extends Pane<Connection>
-{
- public JdbcWriteConnectionPropertiesComposite(Pane<Connection> parentComposite, Composite parent) {
-
- super(parentComposite, parent, false);
- }
-
- @Override
- protected void initializeLayout(Composite container) {
-
- container = this.addSection(
- container,
- EclipseLinkUiMessages.PersistenceXmlConnectionTab_writeConnectionsSectionTitle
- );
-
- GridData data = (GridData) container.getLayoutData();
- data.verticalAlignment = SWT.TOP;
-
- data = (GridData) getControl().getLayoutData();
- data.verticalAlignment = SWT.TOP;
-
- // This will add space to have the same layout than read connection pool
- Button space = this.getWidgetFactory().createCheckBox(container, "m");
- Point size = space.computeSize(SWT.DEFAULT, SWT.DEFAULT);
- container = this.addSubPane(container, size.y + 5);
- space.dispose();
-
- // Write Connections Minimum
- new JdbcWriteConnectionsMinComposite(this, container);
-
- // Write Connections Maximum
- new JdbcWriteConnectionsMaxComposite(this, container);
- }
-}
diff --git a/jpa/plugins/org.eclipse.jpt.eclipselink.ui/src/org/eclipse/jpt/eclipselink/ui/internal/persistence/connection/JdbcWriteConnectionsMaxComposite.java b/jpa/plugins/org.eclipse.jpt.eclipselink.ui/src/org/eclipse/jpt/eclipselink/ui/internal/persistence/connection/JdbcWriteConnectionsMaxComposite.java
deleted file mode 100644
index 2fdd3b0234..0000000000
--- a/jpa/plugins/org.eclipse.jpt.eclipselink.ui/src/org/eclipse/jpt/eclipselink/ui/internal/persistence/connection/JdbcWriteConnectionsMaxComposite.java
+++ /dev/null
@@ -1,85 +0,0 @@
-/*******************************************************************************
- * Copyright (c) 2008, 2009 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.
- *
- * Contributors:
- * Oracle - initial API and implementation
- *******************************************************************************/
-package org.eclipse.jpt.eclipselink.ui.internal.persistence.connection;
-
-import org.eclipse.jpt.eclipselink.core.internal.context.persistence.connection.Connection;
-import org.eclipse.jpt.eclipselink.ui.internal.EclipseLinkUiMessages;
-import org.eclipse.jpt.ui.internal.JpaHelpContextIds;
-import org.eclipse.jpt.ui.internal.widgets.IntegerCombo;
-import org.eclipse.jpt.ui.internal.widgets.Pane;
-import org.eclipse.jpt.utility.internal.model.value.PropertyAspectAdapter;
-import org.eclipse.jpt.utility.model.value.PropertyValueModel;
-import org.eclipse.jpt.utility.model.value.WritablePropertyValueModel;
-import org.eclipse.swt.widgets.Composite;
-
-/**
- * JdbcWriteConnectionsMaxComposite
- */
-public class JdbcWriteConnectionsMaxComposite extends Pane<Connection>
-{
- /**
- * Creates a new <code>JdbcWriteConnectionsMaxComposite</code>.
- *
- * @param parentController
- * The parent container of this one
- * @param parent
- * The parent container
- */
- public JdbcWriteConnectionsMaxComposite(Pane<Connection> parentComposite,
- Composite parent) {
-
- super(parentComposite, parent);
- }
-
- @Override
- protected void initializeLayout(Composite container) {
- addWriteConnectionsMaxCombo(container);
- }
-
- private void addWriteConnectionsMaxCombo(Composite container) {
- new IntegerCombo<Connection>(this, container) {
-
- @Override
- protected String getLabelText() {
- return EclipseLinkUiMessages.PersistenceXmlConnectionTab_writeConnectionsMaxLabel;
- }
-
- @Override
- protected String getHelpId() {
- return JpaHelpContextIds.PERSISTENCE_XML_CONNECTION;
- }
-
- @Override
- protected PropertyValueModel<Integer> buildDefaultHolder() {
- return new PropertyAspectAdapter<Connection, Integer>(getSubjectHolder()) {
- @Override
- protected Integer buildValue_() {
- return this.subject.getDefaultWriteConnectionsMax();
- }
- };
- }
-
- @Override
- protected WritablePropertyValueModel<Integer> buildSelectedItemHolder() {
- return new PropertyAspectAdapter<Connection, Integer>(getSubjectHolder(), Connection.WRITE_CONNECTIONS_MAX_PROPERTY) {
- @Override
- protected Integer buildValue_() {
- return this.subject.getWriteConnectionsMax();
- }
-
- @Override
- protected void setValue_(Integer value) {
- this.subject.setWriteConnectionsMax(value);
- }
- };
- }
- };
- }
-} \ No newline at end of file
diff --git a/jpa/plugins/org.eclipse.jpt.eclipselink.ui/src/org/eclipse/jpt/eclipselink/ui/internal/persistence/connection/JdbcWriteConnectionsMinComposite.java b/jpa/plugins/org.eclipse.jpt.eclipselink.ui/src/org/eclipse/jpt/eclipselink/ui/internal/persistence/connection/JdbcWriteConnectionsMinComposite.java
deleted file mode 100644
index 60485c4807..0000000000
--- a/jpa/plugins/org.eclipse.jpt.eclipselink.ui/src/org/eclipse/jpt/eclipselink/ui/internal/persistence/connection/JdbcWriteConnectionsMinComposite.java
+++ /dev/null
@@ -1,85 +0,0 @@
-/*******************************************************************************
- * Copyright (c) 2008, 2008 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.
- *
- * Contributors:
- * Oracle - initial API and implementation
- *******************************************************************************/
-package org.eclipse.jpt.eclipselink.ui.internal.persistence.connection;
-
-import org.eclipse.jpt.eclipselink.core.internal.context.persistence.connection.Connection;
-import org.eclipse.jpt.eclipselink.ui.internal.EclipseLinkUiMessages;
-import org.eclipse.jpt.ui.internal.JpaHelpContextIds;
-import org.eclipse.jpt.ui.internal.widgets.IntegerCombo;
-import org.eclipse.jpt.ui.internal.widgets.Pane;
-import org.eclipse.jpt.utility.internal.model.value.PropertyAspectAdapter;
-import org.eclipse.jpt.utility.model.value.PropertyValueModel;
-import org.eclipse.jpt.utility.model.value.WritablePropertyValueModel;
-import org.eclipse.swt.widgets.Composite;
-
-/**
- * JdbcWriteConnectionsMinComposite
- */
-public class JdbcWriteConnectionsMinComposite extends Pane<Connection>
-{
- /**
- * Creates a new <code>JdbcWriteConnectionsMinComposite</code>.
- *
- * @param parentController
- * The parent container of this one
- * @param parent
- * The parent container
- */
- public JdbcWriteConnectionsMinComposite(Pane<Connection> parentComposite,
- Composite parent) {
-
- super(parentComposite, parent);
- }
-
- @Override
- protected void initializeLayout(Composite container) {
- addWriteConnectionsMinCombo(container);
- }
-
- private void addWriteConnectionsMinCombo(Composite container) {
- new IntegerCombo<Connection>(this, container) {
-
- @Override
- protected String getLabelText() {
- return EclipseLinkUiMessages.PersistenceXmlConnectionTab_writeConnectionsMinLabel;
- }
-
- @Override
- protected String getHelpId() {
- return JpaHelpContextIds.PERSISTENCE_XML_CONNECTION;
- }
-
- @Override
- protected PropertyValueModel<Integer> buildDefaultHolder() {
- return new PropertyAspectAdapter<Connection, Integer>(getSubjectHolder()) {
- @Override
- protected Integer buildValue_() {
- return this.subject.getDefaultWriteConnectionsMin();
- }
- };
- }
-
- @Override
- protected WritablePropertyValueModel<Integer> buildSelectedItemHolder() {
- return new PropertyAspectAdapter<Connection, Integer>(getSubjectHolder(), Connection.WRITE_CONNECTIONS_MIN_PROPERTY) {
- @Override
- protected Integer buildValue_() {
- return this.subject.getWriteConnectionsMin();
- }
-
- @Override
- protected void setValue_(Integer value) {
- this.subject.setWriteConnectionsMin(value);
- }
- };
- }
- };
- }
-} \ No newline at end of file
diff --git a/jpa/plugins/org.eclipse.jpt.eclipselink.ui/src/org/eclipse/jpt/eclipselink/ui/internal/persistence/connection/NativeSqlComposite.java b/jpa/plugins/org.eclipse.jpt.eclipselink.ui/src/org/eclipse/jpt/eclipselink/ui/internal/persistence/connection/NativeSqlComposite.java
deleted file mode 100644
index 1c1e7286f0..0000000000
--- a/jpa/plugins/org.eclipse.jpt.eclipselink.ui/src/org/eclipse/jpt/eclipselink/ui/internal/persistence/connection/NativeSqlComposite.java
+++ /dev/null
@@ -1,97 +0,0 @@
-/*******************************************************************************
- * Copyright (c) 2008, 2009 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.
- *
- * Contributors:
- * Oracle - initial API and implementation
- *******************************************************************************/
-package org.eclipse.jpt.eclipselink.ui.internal.persistence.connection;
-
-import org.eclipse.jpt.eclipselink.core.internal.context.persistence.connection.Connection;
-import org.eclipse.jpt.eclipselink.ui.internal.EclipseLinkUiMessages;
-import org.eclipse.jpt.ui.internal.JpaHelpContextIds;
-import org.eclipse.jpt.ui.internal.mappings.JptUiMappingsMessages;
-import org.eclipse.jpt.ui.internal.widgets.Pane;
-import org.eclipse.jpt.utility.internal.model.value.PropertyAspectAdapter;
-import org.eclipse.jpt.utility.internal.model.value.TransformationPropertyValueModel;
-import org.eclipse.jpt.utility.model.value.PropertyValueModel;
-import org.eclipse.jpt.utility.model.value.WritablePropertyValueModel;
-import org.eclipse.osgi.util.NLS;
-import org.eclipse.swt.widgets.Composite;
-
-/**
- * NativeSqlComposite
- */
-public class NativeSqlComposite extends Pane<Connection>
-{
- /**
- * Creates a new <code>NativeSqlComposite</code>.
- *
- * @param parentController
- * The parent container of this one
- * @param parent
- * The parent container
- */
- public NativeSqlComposite(
- Pane<? extends Connection> parentComposite,
- Composite parent) {
-
- super(parentComposite, parent);
- }
-
- @Override
- protected void initializeLayout(Composite container) {
- this.addTriStateCheckBoxWithDefault(
- container,
- EclipseLinkUiMessages.PersistenceXmlConnectionTab_nativeSqlLabel,
- this.buildNativeSqlHolder(),
- this.buildNativeSqlStringHolder(),
- JpaHelpContextIds.PERSISTENCE_XML_CONNECTION
- );
- }
-
- private WritablePropertyValueModel<Boolean> buildNativeSqlHolder() {
- return new PropertyAspectAdapter<Connection, Boolean>(getSubjectHolder(), Connection.NATIVE_SQL_PROPERTY) {
- @Override
- protected Boolean buildValue_() {
- return this.subject.getNativeSql();
- }
-
- @Override
- protected void setValue_(Boolean value) {
- this.subject.setNativeSql(value);
- }
-
- };
- }
-
- private PropertyValueModel<String> buildNativeSqlStringHolder() {
- return new TransformationPropertyValueModel<Boolean, String>(buildDefaultNativeSqlHolder()) {
- @Override
- protected String transform(Boolean value) {
- if (value != null) {
- String defaultStringValue = value.booleanValue() ? JptUiMappingsMessages.Boolean_True : JptUiMappingsMessages.Boolean_False;
- return NLS.bind(EclipseLinkUiMessages.PersistenceXmlConnectionTab_nativeSqlLabelDefault, defaultStringValue);
- }
- return EclipseLinkUiMessages.PersistenceXmlConnectionTab_nativeSqlLabel;
- }
- };
- }
-
- private PropertyValueModel<Boolean> buildDefaultNativeSqlHolder() {
- return new PropertyAspectAdapter<Connection, Boolean>(
- getSubjectHolder(),
- Connection.NATIVE_SQL_PROPERTY)
- {
- @Override
- protected Boolean buildValue_() {
- if (this.subject.getNativeSql() != null) {
- return null;
- }
- return this.subject.getDefaultNativeSql();
- }
- };
- }
-}
diff --git a/jpa/plugins/org.eclipse.jpt.eclipselink.ui/src/org/eclipse/jpt/eclipselink/ui/internal/persistence/connection/PersistenceXmlConnectionTab.java b/jpa/plugins/org.eclipse.jpt.eclipselink.ui/src/org/eclipse/jpt/eclipselink/ui/internal/persistence/connection/PersistenceXmlConnectionTab.java
deleted file mode 100644
index 3f585b2a75..0000000000
--- a/jpa/plugins/org.eclipse.jpt.eclipselink.ui/src/org/eclipse/jpt/eclipselink/ui/internal/persistence/connection/PersistenceXmlConnectionTab.java
+++ /dev/null
@@ -1,84 +0,0 @@
-/*******************************************************************************
- * Copyright (c) 2007, 2009 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.
- *
- * Contributors:
- * Oracle - initial API and implementation
- *******************************************************************************/
-package org.eclipse.jpt.eclipselink.ui.internal.persistence.connection;
-
-import org.eclipse.jpt.eclipselink.core.internal.context.persistence.connection.Connection;
-import org.eclipse.jpt.eclipselink.ui.internal.EclipseLinkUiMessages;
-import org.eclipse.jpt.ui.WidgetFactory;
-import org.eclipse.jpt.ui.details.JpaPageComposite;
-import org.eclipse.jpt.ui.internal.JpaHelpContextIds;
-import org.eclipse.jpt.ui.internal.widgets.FormPane;
-import org.eclipse.jpt.utility.model.value.PropertyValueModel;
-import org.eclipse.swt.SWT;
-import org.eclipse.swt.graphics.Image;
-import org.eclipse.swt.layout.GridData;
-import org.eclipse.swt.layout.GridLayout;
-import org.eclipse.swt.widgets.Composite;
-
-/**
- * PersistenceXmlConnectionTab
- */
-public class PersistenceXmlConnectionTab
- extends FormPane<Connection>
- implements JpaPageComposite
-{
- // ********** constructors/initialization **********
- public PersistenceXmlConnectionTab(
- PropertyValueModel<Connection> subjectHolder,
- Composite parent,
- WidgetFactory widgetFactory) {
-
- super(subjectHolder, parent, widgetFactory);
- }
-
- @Override
- protected void initializeLayout(Composite container) {
- new EclipseLinkConnectionComposite(this, container);
- }
-
- // ********** JpaPageComposite implementation **********
-
- public String getHelpID() {
- return JpaHelpContextIds.PERSISTENCE_XML_CONNECTION;
- }
-
- public Image getPageImage() {
- return null;
- }
-
- public String getPageText() {
- return EclipseLinkUiMessages.PersistenceXmlConnectionTab_title;
- }
-
- // ********** Layout **********
- @Override
- protected Composite addContainer(Composite parent) {
- GridLayout layout = new GridLayout(1, true);
- layout.marginHeight = 0;
- layout.marginWidth = 0;
- layout.marginTop = 0;
- layout.marginLeft = 0;
- layout.marginBottom = 0;
- layout.marginRight = 0;
- layout.verticalSpacing = 15;
- Composite container = this.addPane(parent, layout);
- this.updateGridData(container);
- return container;
- }
-
- private void updateGridData(Composite container) {
- GridData gridData = new GridData();
- gridData.grabExcessHorizontalSpace = true;
- gridData.grabExcessVerticalSpace = true;
- gridData.horizontalAlignment = SWT.FILL;
- gridData.verticalAlignment = SWT.FILL;
- container.setLayoutData(gridData);
- }
-}
diff --git a/jpa/plugins/org.eclipse.jpt.eclipselink.ui/src/org/eclipse/jpt/eclipselink/ui/internal/persistence/connection/TransactionTypeComposite.java b/jpa/plugins/org.eclipse.jpt.eclipselink.ui/src/org/eclipse/jpt/eclipselink/ui/internal/persistence/connection/TransactionTypeComposite.java
deleted file mode 100644
index 116cc3399f..0000000000
--- a/jpa/plugins/org.eclipse.jpt.eclipselink.ui/src/org/eclipse/jpt/eclipselink/ui/internal/persistence/connection/TransactionTypeComposite.java
+++ /dev/null
@@ -1,127 +0,0 @@
-/*******************************************************************************
- * Copyright (c) 2008, 2009 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.
- *
- * Contributors:
- * Oracle - initial API and implementation
- *******************************************************************************/
-package org.eclipse.jpt.eclipselink.ui.internal.persistence.connection;
-
-import java.util.Collection;
-
-import org.eclipse.jpt.core.context.persistence.PersistenceUnit;
-import org.eclipse.jpt.core.context.persistence.PersistenceUnitTransactionType;
-import org.eclipse.jpt.eclipselink.core.internal.context.persistence.connection.Connection;
-import org.eclipse.jpt.eclipselink.ui.internal.EclipseLinkUiMessages;
-import org.eclipse.jpt.ui.internal.JpaHelpContextIds;
-import org.eclipse.jpt.ui.internal.widgets.EnumFormComboViewer;
-import org.eclipse.jpt.ui.internal.widgets.FormPane;
-import org.eclipse.jpt.utility.internal.model.value.PropertyAspectAdapter;
-import org.eclipse.jpt.utility.model.value.PropertyValueModel;
-import org.eclipse.swt.widgets.Composite;
-
-/**
- * TransactionTypeComposite
- */
-public class TransactionTypeComposite extends FormPane<Connection>
-{
- /**
- * Creates a new <code>TransactionTypeComposite</code>.
- *
- * @param parentController
- * The parent container of this one
- * @param parent
- * The parent container
- */
- public TransactionTypeComposite(
- FormPane<? extends Connection> parentComposite,
- Composite parent) {
-
- super( parentComposite, parent);
- }
-
- private EnumFormComboViewer<PersistenceUnit, PersistenceUnitTransactionType> addTransactionTypeCombo(Composite container) {
- return new EnumFormComboViewer<PersistenceUnit, PersistenceUnitTransactionType>(this, buildPersistenceUnitHolder(), container) {
- @Override
- protected void addPropertyNames(Collection<String> propertyNames) {
- super.addPropertyNames(propertyNames);
- propertyNames.add(PersistenceUnit.SPECIFIED_TRANSACTION_TYPE_PROPERTY);
- propertyNames.add(PersistenceUnit.DEFAULT_TRANSACTION_TYPE_PROPERTY);
- }
-
- @Override
- protected PersistenceUnitTransactionType[] getChoices() {
- return PersistenceUnitTransactionType.values();
- }
-
- @Override
- protected PersistenceUnitTransactionType getDefaultValue() {
- return getSubject().getDefaultTransactionType();
- }
-
- @Override
- protected String displayString(PersistenceUnitTransactionType value) {
- return buildDisplayString(EclipseLinkUiMessages.class, TransactionTypeComposite.this, value);
- }
-
- @Override
- protected PersistenceUnitTransactionType getValue() {
- return getSubject().getSpecifiedTransactionType();
- }
-
- @Override
- protected void setValue(PersistenceUnitTransactionType value) {
- getSubject().setSpecifiedTransactionType(value);
-
- if (value == PersistenceUnitTransactionType.RESOURCE_LOCAL) {
- clearJTAProperties();
- }
- else {
- clearResourceLocalProperties();
- }
- }
- };
- }
-
- private PropertyValueModel<PersistenceUnit> buildPersistenceUnitHolder() {
- return new PropertyAspectAdapter<Connection, PersistenceUnit>(getSubjectHolder()) {
- @Override
- protected PersistenceUnit buildValue_() {
- return this.subject.getPersistenceUnit();
- }
- };
-
- }
-
- private void clearJTAProperties() {
- getSubject().getPersistenceUnit().setJtaDataSource(null);
- }
-
- private void clearResourceLocalProperties() {
- Connection connection = getSubject();
- connection.getPersistenceUnit().setNonJtaDataSource(null);
- connection.setDriver(null);
- connection.setUrl(null);
- connection.setUser(null);
- connection.setPassword(null);
- connection.setBindParameters(null);
- connection.setWriteConnectionsMax(null);
- connection.setWriteConnectionsMin(null);
- connection.setReadConnectionsMax(null);
- connection.setReadConnectionsMin(null);
- connection.setReadConnectionsShared(null);
- }
-
- @Override
- protected void initializeLayout( Composite container) {
-
- this.addLabeledComposite(
- container,
- EclipseLinkUiMessages.PersistenceXmlConnectionTab_transactionTypeLabel,
- this.addTransactionTypeCombo( container),
- JpaHelpContextIds.PERSISTENCE_XML_CONNECTION
- );
- }
-}
diff --git a/jpa/plugins/org.eclipse.jpt.eclipselink.ui/src/org/eclipse/jpt/eclipselink/ui/internal/persistence/customization/CustomizerComposite.java b/jpa/plugins/org.eclipse.jpt.eclipselink.ui/src/org/eclipse/jpt/eclipselink/ui/internal/persistence/customization/CustomizerComposite.java
deleted file mode 100644
index 7eae8223e4..0000000000
--- a/jpa/plugins/org.eclipse.jpt.eclipselink.ui/src/org/eclipse/jpt/eclipselink/ui/internal/persistence/customization/CustomizerComposite.java
+++ /dev/null
@@ -1,103 +0,0 @@
-/*******************************************************************************
-* Copyright (c) 2008, 2009 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.
-*
-* Contributors:
-* Oracle - initial API and implementation
-*******************************************************************************/
-package org.eclipse.jpt.eclipselink.ui.internal.persistence.customization;
-
-import org.eclipse.jpt.core.JpaProject;
-import org.eclipse.jpt.eclipselink.core.context.Customizer;
-import org.eclipse.jpt.eclipselink.core.internal.context.persistence.customization.Customization;
-import org.eclipse.jpt.eclipselink.core.internal.context.persistence.customization.Entity;
-import org.eclipse.jpt.eclipselink.ui.internal.EclipseLinkUiMessages;
-import org.eclipse.jpt.ui.internal.widgets.ClassChooserPane;
-import org.eclipse.jpt.ui.internal.widgets.Pane;
-import org.eclipse.jpt.utility.internal.model.value.PropertyAspectAdapter;
-import org.eclipse.jpt.utility.model.value.WritablePropertyValueModel;
-import org.eclipse.swt.widgets.Composite;
-
-/**
- * CustomizerComposite
- */
-public class CustomizerComposite extends Pane<Entity>
-{
- /**
- * Creates a new <code>CustomizerComposite</code>.
- *
- * @param parentPane The parent pane of this one
- * @param parent The parent container
- */
- public CustomizerComposite(Pane<? extends Entity> parentPane,
- Composite parent) {
-
- super(parentPane, parent);
- }
-
- private ClassChooserPane<Entity> initializeClassChooser(Composite container) {
-
- return new ClassChooserPane<Entity>(this, container) {
-
- @Override
- protected WritablePropertyValueModel<String> buildTextHolder() {
- return new PropertyAspectAdapter<Entity, String>(
- this.getSubjectHolder(), Entity.DESCRIPTOR_CUSTOMIZER_PROPERTY) {
- @Override
- protected String buildValue_() {
- return getSubjectParent().getDescriptorCustomizerOf(getSubjectName());
- }
-
- @Override
- protected void setValue_(String value) {
-
- if (value.length() == 0) {
- value = null;
- }
- getSubjectParent().setDescriptorCustomizerOf(getSubjectName(), value);
- }
- };
- }
-
- @Override
- protected String getClassName() {
- return getSubjectParent().getDescriptorCustomizerOf(getSubjectName());
- }
-
- @Override
- protected String getLabelText() {
- return EclipseLinkUiMessages.PersistenceXmlCustomizationTab_customizerLabel;
- }
-
- @Override
- protected JpaProject getJpaProject() {
- return getSubjectParent().getJpaProject();
- }
-
- @Override
- protected void setClassName(String className) {
- getSubjectParent().setDescriptorCustomizerOf(getSubjectName(), className);
- }
-
- @Override
- protected String getSuperInterfaceName() {
- return Customizer.ECLIPSELINK_DESCRIPTOR_CUSTOMIZER_CLASS_NAME;
- }
- };
- }
-
- private String getSubjectName() {
- return this.getSubjectHolder().getValue().getName();
- }
-
- private Customization getSubjectParent() {
- return this.getSubjectHolder().getValue().getParent();
- }
-
- @Override
- protected void initializeLayout(Composite container) {
- this.initializeClassChooser(container);
- }
-}
diff --git a/jpa/plugins/org.eclipse.jpt.eclipselink.ui/src/org/eclipse/jpt/eclipselink/ui/internal/persistence/customization/EclipseLinkCustomizationComposite.java b/jpa/plugins/org.eclipse.jpt.eclipselink.ui/src/org/eclipse/jpt/eclipselink/ui/internal/persistence/customization/EclipseLinkCustomizationComposite.java
deleted file mode 100644
index 332a7c6b2f..0000000000
--- a/jpa/plugins/org.eclipse.jpt.eclipselink.ui/src/org/eclipse/jpt/eclipselink/ui/internal/persistence/customization/EclipseLinkCustomizationComposite.java
+++ /dev/null
@@ -1,86 +0,0 @@
-/*******************************************************************************
-* Copyright (c) 2008 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.
-*
-* Contributors:
-* Oracle - initial API and implementation
-*******************************************************************************/
-package org.eclipse.jpt.eclipselink.ui.internal.persistence.customization;
-
-import org.eclipse.jpt.eclipselink.core.internal.context.persistence.customization.Customization;
-import org.eclipse.jpt.eclipselink.ui.internal.EclipseLinkUiMessages;
-import org.eclipse.jpt.ui.internal.widgets.FormPane;
-import org.eclipse.swt.SWT;
-import org.eclipse.swt.layout.GridData;
-import org.eclipse.swt.widgets.Composite;
-import org.eclipse.ui.forms.widgets.ExpandableComposite;
-import org.eclipse.ui.forms.widgets.Section;
-
-/**
- * PersistenceUnitCustomizationComposite
- */
-public class EclipseLinkCustomizationComposite extends FormPane<Customization>
-{
- public EclipseLinkCustomizationComposite(FormPane<Customization> subjectHolder,
- Composite container) {
-
- super(subjectHolder, container);
- }
-
- @Override
- protected void initializeLayout(Composite parent) {
- Section section = getWidgetFactory().createSection(parent, SWT.FLAT | ExpandableComposite.TITLE_BAR | Section.DESCRIPTION);
- section.setText(EclipseLinkUiMessages.PersistenceXmlCustomizationTab_sectionTitle);
- section.setDescription(EclipseLinkUiMessages.PersistenceXmlCustomizationTab_sectionDescription);
- section.setLayoutData(new GridData(GridData.FILL_BOTH));
-
- Composite composite = this.addSubPane(section);
- section.setClient(composite);
-
- // Default pane
- int groupBoxMargin = this.getGroupBoxMargin();
-
- Composite defaultPane = this.addSubPane(
- composite,
- 0, groupBoxMargin, 0, groupBoxMargin
- );
-
- // Weaving
- new WeavingComposite(this, defaultPane);
-
- // Weaving Lazy
- new WeavingLazyComposite(this, defaultPane);
-
- // Weaving Fetch Groups
- new WeavingFetchGroupsComposite(this, defaultPane);
-
- // Weaving Internal
- new WeavingInternalComposite(this, defaultPane);
-
- // Weaving Eager
- new WeavingEagerComposite(this, defaultPane);
-
- // Weaving Change Tracking
- new WeavingChangeTrackingComposite(this, defaultPane);
-
- // Throw Exceptions
- new ThrowExceptionsComposite(this, defaultPane);
-
- // Exception Handler
- new ExceptionHandlerComposite(this, defaultPane);
-
- // Session Customizer
- new SessionCustomizersComposite(this, composite);
-
- // EntitiesList
- new EntityListComposite(this, composite);
-
- // Validation Only
- new ValidationOnlyComposite(this, composite);
-
- // Profiler:
- new ProfilerComposite(this, composite);
- }
-} \ No newline at end of file
diff --git a/jpa/plugins/org.eclipse.jpt.eclipselink.ui/src/org/eclipse/jpt/eclipselink/ui/internal/persistence/customization/EntityCustomizationPropertyComposite.java b/jpa/plugins/org.eclipse.jpt.eclipselink.ui/src/org/eclipse/jpt/eclipselink/ui/internal/persistence/customization/EntityCustomizationPropertyComposite.java
deleted file mode 100644
index cde8fe68cc..0000000000
--- a/jpa/plugins/org.eclipse.jpt.eclipselink.ui/src/org/eclipse/jpt/eclipselink/ui/internal/persistence/customization/EntityCustomizationPropertyComposite.java
+++ /dev/null
@@ -1,47 +0,0 @@
-/*******************************************************************************
- * Copyright (c) 2008, 2009 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.
- *
- * Contributors:
- * Oracle - initial API and implementation
- ******************************************************************************/
-package org.eclipse.jpt.eclipselink.ui.internal.persistence.customization;
-
-import org.eclipse.jpt.eclipselink.core.internal.context.persistence.customization.Customization;
-import org.eclipse.jpt.eclipselink.core.internal.context.persistence.customization.Entity;
-import org.eclipse.jpt.ui.internal.widgets.Pane;
-import org.eclipse.jpt.utility.model.value.PropertyValueModel;
-import org.eclipse.swt.widgets.Composite;
-
-/**
- * EntityCustomizationPropertyComposite
- */
-public class EntityCustomizationPropertyComposite extends Pane<Entity> {
-
- /**
- * Creates a new <code>EntityCustomizationPropertyComposite</code>.
- *
- * @param parentPane The parent container of this one
- * @param subjectHolder The holder of this pane's subject
- * @param parent The parent container
- */
- public EntityCustomizationPropertyComposite(Pane<Customization> parentComposite,
- PropertyValueModel<Entity> subjectHolder,
- Composite parent) {
-
- super(parentComposite, subjectHolder, parent);
- }
-
- /*
- * (non-Javadoc)
- */
- @Override
- protected void initializeLayout(Composite container) {
-
- // Customizer
- new CustomizerComposite(this, container);
-
- }
-}
diff --git a/jpa/plugins/org.eclipse.jpt.eclipselink.ui/src/org/eclipse/jpt/eclipselink/ui/internal/persistence/customization/EntityListComposite.java b/jpa/plugins/org.eclipse.jpt.eclipselink.ui/src/org/eclipse/jpt/eclipselink/ui/internal/persistence/customization/EntityListComposite.java
deleted file mode 100644
index b8d77ba28f..0000000000
--- a/jpa/plugins/org.eclipse.jpt.eclipselink.ui/src/org/eclipse/jpt/eclipselink/ui/internal/persistence/customization/EntityListComposite.java
+++ /dev/null
@@ -1,227 +0,0 @@
-/*******************************************************************************
-* Copyright (c) 2007, 2009 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.
-*
-* Contributors:
-* Oracle - initial API and implementation
-*******************************************************************************/
-package org.eclipse.jpt.eclipselink.ui.internal.persistence.customization;
-
-import java.util.ListIterator;
-import org.eclipse.core.resources.IProject;
-import org.eclipse.jdt.core.IJavaElement;
-import org.eclipse.jdt.core.IJavaProject;
-import org.eclipse.jdt.core.IPackageFragmentRoot;
-import org.eclipse.jdt.core.IType;
-import org.eclipse.jdt.core.JavaCore;
-import org.eclipse.jdt.core.JavaModelException;
-import org.eclipse.jdt.core.search.IJavaSearchScope;
-import org.eclipse.jdt.core.search.SearchEngine;
-import org.eclipse.jdt.ui.IJavaElementSearchConstants;
-import org.eclipse.jdt.ui.JavaUI;
-import org.eclipse.jface.viewers.ILabelProvider;
-import org.eclipse.jface.viewers.LabelProvider;
-import org.eclipse.jface.window.Window;
-import org.eclipse.jpt.eclipselink.core.internal.context.persistence.customization.Customization;
-import org.eclipse.jpt.eclipselink.core.internal.context.persistence.customization.Entity;
-import org.eclipse.jpt.eclipselink.ui.JptEclipseLinkUiPlugin;
-import org.eclipse.jpt.eclipselink.ui.internal.EclipseLinkHelpContextIds;
-import org.eclipse.jpt.eclipselink.ui.internal.EclipseLinkUiMessages;
-import org.eclipse.jpt.ui.internal.util.PaneEnabler;
-import org.eclipse.jpt.ui.internal.widgets.AddRemoveListPane;
-import org.eclipse.jpt.ui.internal.widgets.Pane;
-import org.eclipse.jpt.utility.internal.CollectionTools;
-import org.eclipse.jpt.utility.internal.model.value.ListAspectAdapter;
-import org.eclipse.jpt.utility.internal.model.value.SimplePropertyValueModel;
-import org.eclipse.jpt.utility.internal.model.value.TransformationPropertyValueModel;
-import org.eclipse.jpt.utility.internal.model.value.swing.ObjectListSelectionModel;
-import org.eclipse.jpt.utility.model.value.ListValueModel;
-import org.eclipse.jpt.utility.model.value.PropertyValueModel;
-import org.eclipse.jpt.utility.model.value.WritablePropertyValueModel;
-import org.eclipse.swt.widgets.Composite;
-import org.eclipse.ui.PlatformUI;
-import org.eclipse.ui.dialogs.SelectionDialog;
-import org.eclipse.ui.progress.IProgressService;
-
-/**
- * EntityListComposite
- */
-public class EntityListComposite extends Pane<Customization>
-{
- private WritablePropertyValueModel<Entity> entityHolder;
-
- public EntityListComposite(Pane<Customization> parentComposite, Composite parent) {
-
- super(parentComposite, parent);
- }
-
- @Override
- protected void initialize() {
- super.initialize();
- this.entityHolder = this.buildEntityHolder();
- }
-
- @Override
- protected void initializeLayout(Composite container) {
-
- container = this.addTitledGroup(
- container,
- EclipseLinkUiMessages.CustomizationEntityListComposite_groupTitle
- );
-
- // Entities add/remove list pane
- new AddRemoveListPane<Customization>(
- this,
- container,
- this.buildEntitiesAdapter(),
- this.buildEntitiesListHolder(),
- this.entityHolder,
- this.buildEntityLabelProvider(),
- EclipseLinkHelpContextIds.PERSISTENCE_CUSTOMIZATION
- );
-
- // Entity Customization property pane
- EntityCustomizationPropertyComposite pane = new EntityCustomizationPropertyComposite(
- this,
- this.entityHolder,
- container
- );
- this.installPaneEnabler(this.entityHolder, pane);
- }
-
- private AddRemoveListPane.Adapter buildEntitiesAdapter() {
- return new AddRemoveListPane.AbstractAdapter() {
- public void addNewItem(ObjectListSelectionModel listSelectionModel) {
- EntityListComposite.this.addEntities(listSelectionModel);
- }
-
- public void removeSelectedItems(ObjectListSelectionModel listSelectionModel) {
- Customization customization = getSubject();
- for (Object item : listSelectionModel.selectedValues()) {
- Entity entityCustomization = (Entity) item;
- customization.removeEntity(entityCustomization.getName());
- }
- }
- };
- }
-
- private void addEntities(ObjectListSelectionModel listSelectionModel) {
-
- IType type = this.chooseEntity();
-
- if (type != null) {
- String entityName = this.getEntityName(type.getFullyQualifiedName());
- if (entityName == null) {
- entityName = type.getElementName();
- }
-
- if( ! this.getSubject().entityExists(entityName)) {
- this.getSubject().addEntity(entityName);
- int index = CollectionTools.indexOf(this.getSubject().entities(), entityName);
- Entity entity = (Entity) listSelectionModel.getListModel().getElementAt(index);
- this.entityHolder.setValue(entity);
- }
- }
- }
-
- private String getEntityName(String fullyQualifiedTypeName) {
-
- org.eclipse.jpt.core.context.Entity entity = getSubject().getPersistenceUnit().getEntity(fullyQualifiedTypeName);
- return entity != null ? entity.getName() : null;
- }
-
- private IType chooseEntity() {
-
- IPackageFragmentRoot root = getPackageFragmentRoot();
- if (root == null) {
- return null;
- }
- IJavaElement[] elements = new IJavaElement[] { root.getJavaProject() };
- IJavaSearchScope scope = SearchEngine.createJavaSearchScope(elements);
- IProgressService service = PlatformUI.getWorkbench().getProgressService();
- SelectionDialog typeSelectionDialog;
-
- try {
- typeSelectionDialog = JavaUI.createTypeDialog(
- getShell(),
- service,
- scope,
- IJavaElementSearchConstants.CONSIDER_CLASSES,
- false,
- ""
- );
- }
- catch (JavaModelException e) {
- JptEclipseLinkUiPlugin.log(e);
- return null;
- }
- typeSelectionDialog.setTitle(EclipseLinkUiMessages.CustomizationEntityListComposite_dialogTitle);
- typeSelectionDialog.setMessage(EclipseLinkUiMessages.CustomizationEntityListComposite_dialogMessage);
-
- if (typeSelectionDialog.open() == Window.OK) {
- return (IType) typeSelectionDialog.getResult()[0];
- }
- return null;
- }
-
- private IPackageFragmentRoot getPackageFragmentRoot() {
- IProject project = getSubject().getJpaProject().getProject();
- IJavaProject root = JavaCore.create(project);
-
- try {
- return root.getAllPackageFragmentRoots()[0];
- }
- catch (JavaModelException e) {
- JptEclipseLinkUiPlugin.log(e);
- }
- return null;
- }
-
- private ILabelProvider buildEntityLabelProvider() {
- return new LabelProvider() {
- @Override
- public String getText(Object element) {
- Entity entityCustomization = (Entity) element;
- return entityCustomization.getName();
- }
- };
- }
-
- private WritablePropertyValueModel<Entity> buildEntityHolder() {
- return new SimplePropertyValueModel<Entity>();
- }
-
- private ListValueModel<Entity> buildEntitiesListHolder() {
- return new ListAspectAdapter<Customization, Entity>(
- this.getSubjectHolder(), Customization.ENTITIES_LIST) {
- @Override
- protected ListIterator<Entity> listIterator_() {
- return this.subject.entities();
- }
- @Override
- protected int size_() {
- return this.subject.entitiesSize();
- }
- };
- }
-
- private void installPaneEnabler(WritablePropertyValueModel<Entity> entityHolder,
- EntityCustomizationPropertyComposite pane) {
-
- new PaneEnabler(
- this.buildPaneEnablerHolder(entityHolder),
- pane
- );
- }
-
- private PropertyValueModel<Boolean> buildPaneEnablerHolder(WritablePropertyValueModel<Entity> entityHolder) {
- return new TransformationPropertyValueModel<Entity, Boolean>(entityHolder) {
- @Override
- protected Boolean transform_(Entity value) {
- return value.entityNameIsValid();
- }
- };
- }
-}
diff --git a/jpa/plugins/org.eclipse.jpt.eclipselink.ui/src/org/eclipse/jpt/eclipselink/ui/internal/persistence/customization/ExceptionHandlerComposite.java b/jpa/plugins/org.eclipse.jpt.eclipselink.ui/src/org/eclipse/jpt/eclipselink/ui/internal/persistence/customization/ExceptionHandlerComposite.java
deleted file mode 100644
index 574278da9f..0000000000
--- a/jpa/plugins/org.eclipse.jpt.eclipselink.ui/src/org/eclipse/jpt/eclipselink/ui/internal/persistence/customization/ExceptionHandlerComposite.java
+++ /dev/null
@@ -1,93 +0,0 @@
-/*******************************************************************************
-* Copyright (c) 2008 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.
-*
-* Contributors:
-* Oracle - initial API and implementation
-*******************************************************************************/
-package org.eclipse.jpt.eclipselink.ui.internal.persistence.customization;
-
-import org.eclipse.jpt.core.JpaProject;
-import org.eclipse.jpt.eclipselink.core.internal.context.persistence.customization.Customization;
-import org.eclipse.jpt.eclipselink.ui.internal.EclipseLinkUiMessages;
-import org.eclipse.jpt.ui.internal.widgets.ClassChooserPane;
-import org.eclipse.jpt.ui.internal.widgets.Pane;
-import org.eclipse.jpt.utility.internal.model.value.PropertyAspectAdapter;
-import org.eclipse.jpt.utility.model.value.WritablePropertyValueModel;
-import org.eclipse.swt.widgets.Composite;
-
-/**
- * ExceptionHandlerComposite
- */
-public class ExceptionHandlerComposite extends Pane<Customization>
-{
- /**
- * Creates a new <code>ExceptionHandlerComposite</code>.
- *
- * @param parentPane The parent pane of this one
- * @param parent The parent container
- */
- public ExceptionHandlerComposite(Pane<? extends Customization> parentPane,
- Composite parent) {
-
- super(parentPane, parent);
- }
-
- private ClassChooserPane<Customization> initializeClassChooser(Composite container) {
-
- return new ClassChooserPane<Customization>(this, container) {
-
- @Override
- protected WritablePropertyValueModel<String> buildTextHolder() {
- return new PropertyAspectAdapter<Customization, String>(
- this.getSubjectHolder(), Customization.EXCEPTION_HANDLER_PROPERTY) {
- @Override
- protected String buildValue_() {
- return this.subject.getExceptionHandler();
- }
-
- @Override
- protected void setValue_(String value) {
-
- if (value.length() == 0) {
- value = null;
- }
- this.subject.setExceptionHandler(value);
- }
- };
- }
-
- @Override
- protected String getClassName() {
- return this.getSubject().getExceptionHandler();
- }
-
- @Override
- protected String getLabelText() {
- return EclipseLinkUiMessages.PersistenceXmlCustomizationTab_exceptionHandlerLabel;
- }
-
- @Override
- protected JpaProject getJpaProject() {
- return getSubject().getJpaProject();
- }
-
- @Override
- protected void setClassName(String className) {
- this.getSubject().setExceptionHandler(className);
- }
-
- @Override
- protected String getSuperInterfaceName() {
- return Customization.ECLIPSELINK_EXCEPTION_HANDLER_CLASS_NAME;
- }
- };
- }
-
- @Override
- protected void initializeLayout(Composite container) {
- this.initializeClassChooser(container);
- }
-}
diff --git a/jpa/plugins/org.eclipse.jpt.eclipselink.ui/src/org/eclipse/jpt/eclipselink/ui/internal/persistence/customization/PersistenceXmlCustomizationTab.java b/jpa/plugins/org.eclipse.jpt.eclipselink.ui/src/org/eclipse/jpt/eclipselink/ui/internal/persistence/customization/PersistenceXmlCustomizationTab.java
deleted file mode 100644
index e6e3884382..0000000000
--- a/jpa/plugins/org.eclipse.jpt.eclipselink.ui/src/org/eclipse/jpt/eclipselink/ui/internal/persistence/customization/PersistenceXmlCustomizationTab.java
+++ /dev/null
@@ -1,88 +0,0 @@
-/*******************************************************************************
-* Copyright (c) 2009 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.
-*
-* Contributors:
-* Oracle - initial API and implementation
-*******************************************************************************/
-package org.eclipse.jpt.eclipselink.ui.internal.persistence.customization;
-
-import org.eclipse.jpt.eclipselink.core.internal.context.persistence.customization.Customization;
-import org.eclipse.jpt.eclipselink.ui.internal.EclipseLinkHelpContextIds;
-import org.eclipse.jpt.eclipselink.ui.internal.EclipseLinkUiMessages;
-import org.eclipse.jpt.ui.WidgetFactory;
-import org.eclipse.jpt.ui.details.JpaPageComposite;
-import org.eclipse.jpt.ui.internal.widgets.FormPane;
-import org.eclipse.jpt.utility.model.value.PropertyValueModel;
-import org.eclipse.swt.SWT;
-import org.eclipse.swt.graphics.Image;
-import org.eclipse.swt.layout.GridData;
-import org.eclipse.swt.layout.GridLayout;
-import org.eclipse.swt.widgets.Composite;
-
-/**
- * PersistenceXmlCustomizationTabItem
- */
-public class PersistenceXmlCustomizationTab
- extends FormPane<Customization>
- implements JpaPageComposite
-{
- public PersistenceXmlCustomizationTab(
- PropertyValueModel<Customization> subjectHolder,
- Composite parent,
- WidgetFactory widgetFactory) {
-
- super(subjectHolder, parent, widgetFactory);
- }
-
- @Override
- protected void initializeLayout(Composite container) {
-
- new EclipseLinkCustomizationComposite(this, container);
- }
-
- // ********** JpaPageComposite implementation **********
-
- public String getHelpID() {
- return EclipseLinkHelpContextIds.PERSISTENCE_CUSTOMIZATION;
- }
-
- public Image getPageImage() {
- return null;
- }
-
- public String getPageText() {
- return EclipseLinkUiMessages.PersistenceXmlCustomizationTab_title;
- }
-
- // ********** Layout **********
-
- @Override
- protected Composite addContainer(Composite parent) {
- GridLayout layout = new GridLayout(1, true);
- layout.marginHeight = 0;
- layout.marginWidth = 0;
- layout.marginTop = 0;
- layout.marginLeft = 0;
- layout.marginBottom = 0;
- layout.marginRight = 0;
- layout.verticalSpacing = 15;
-
- Composite container = addPane(parent, layout);
- updateGridData(container);
-
- return container;
- }
-
- private void updateGridData(Composite container) {
- GridData gridData = new GridData();
- gridData.grabExcessHorizontalSpace = true;
- gridData.grabExcessVerticalSpace = true;
- gridData.horizontalAlignment = SWT.FILL;
- gridData.verticalAlignment = SWT.FILL;
- container.setLayoutData(gridData);
- }
-
-}
diff --git a/jpa/plugins/org.eclipse.jpt.eclipselink.ui/src/org/eclipse/jpt/eclipselink/ui/internal/persistence/customization/ProfilerComposite.java b/jpa/plugins/org.eclipse.jpt.eclipselink.ui/src/org/eclipse/jpt/eclipselink/ui/internal/persistence/customization/ProfilerComposite.java
deleted file mode 100644
index 4f49515a0f..0000000000
--- a/jpa/plugins/org.eclipse.jpt.eclipselink.ui/src/org/eclipse/jpt/eclipselink/ui/internal/persistence/customization/ProfilerComposite.java
+++ /dev/null
@@ -1,207 +0,0 @@
-/*******************************************************************************
-* Copyright (c) 2008 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.
-*
-* Contributors:
-* Oracle - initial API and implementation
-*******************************************************************************/
-package org.eclipse.jpt.eclipselink.ui.internal.persistence.customization;
-
-import com.ibm.icu.text.Collator;
-import java.util.ArrayList;
-import java.util.Comparator;
-import java.util.Iterator;
-
-import org.eclipse.jpt.core.JpaProject;
-import org.eclipse.jpt.eclipselink.core.internal.context.persistence.customization.Customization;
-import org.eclipse.jpt.eclipselink.core.internal.context.persistence.customization.Profiler;
-import org.eclipse.jpt.eclipselink.ui.internal.EclipseLinkUiMessages;
-import org.eclipse.jpt.ui.internal.widgets.ClassChooserComboPane;
-import org.eclipse.jpt.ui.internal.widgets.Pane;
-import org.eclipse.jpt.utility.internal.CollectionTools;
-import org.eclipse.jpt.utility.internal.StringConverter;
-import org.eclipse.jpt.utility.internal.iterators.TransformationIterator;
-import org.eclipse.jpt.utility.internal.model.value.CompositeListValueModel;
-import org.eclipse.jpt.utility.internal.model.value.PropertyAspectAdapter;
-import org.eclipse.jpt.utility.internal.model.value.PropertyListValueModelAdapter;
-import org.eclipse.jpt.utility.internal.model.value.SimpleCollectionValueModel;
-import org.eclipse.jpt.utility.internal.model.value.SortedListValueModelAdapter;
-import org.eclipse.jpt.utility.model.value.CollectionValueModel;
-import org.eclipse.jpt.utility.model.value.ListValueModel;
-import org.eclipse.jpt.utility.model.value.PropertyValueModel;
-import org.eclipse.jpt.utility.model.value.WritablePropertyValueModel;
-import org.eclipse.osgi.util.NLS;
-import org.eclipse.swt.widgets.Composite;
-
-/**
- * ProfilerComposite
- */
-public class ProfilerComposite extends ClassChooserComboPane<Customization>
-{
-
- /**
- * Creates a new <code>ProfilerComposite</code>.
- *
- * @param parentPane The parent container of this one
- * @param parent The parent container
- */
- public ProfilerComposite(
- Pane<? extends Customization> parentPane,
- Composite parent) {
-
- super(parentPane, parent);
- }
-
- @Override
- protected String getClassName() {
- return Profiler.getProfilerClassName(this.getSubject().getProfiler());
- }
-
- @Override
- protected String getLabelText() {
- return EclipseLinkUiMessages.PersistenceXmlCustomizationTab_profilerLabel;
- }
-
- @Override
- protected JpaProject getJpaProject() {
- return getSubject().getJpaProject();
- }
-
- @Override
- protected WritablePropertyValueModel<String> buildTextHolder() {
- return new PropertyAspectAdapter<Customization, String>(this.getSubjectHolder(), Customization.PROFILER_PROPERTY) {
- @Override
- protected String buildValue_() {
-
- String name = this.subject.getProfiler();
- if (name == null) {
- name = ProfilerComposite.this.getDefaultValue(this.subject);
- }
- return name;
- }
-
- @Override
- protected void setValue_(String value) {
-
- if (getDefaultValue(this.subject).equals(value)) {
- value = null;
- }
- this.subject.setProfiler(value);
- }
- };
- }
-
- private PropertyValueModel<String> buildDefaultProfilerHolder() {
- return new PropertyAspectAdapter<Customization, String>(this.getSubjectHolder(), Customization.DEFAULT_PROFILER) {
- @Override
- protected String buildValue_() {
- return ProfilerComposite.this.getDefaultValue(this.subject);
- }
- };
- }
-
- private ListValueModel<String> buildDefaultProfilerListHolder() {
- return new PropertyListValueModelAdapter<String>(
- this.buildDefaultProfilerHolder()
- );
- }
-
- private String buildDisplayString(String profilerName) {
-
- switch (Profiler.valueOf(profilerName)) {
- case no_profiler: {
- return EclipseLinkUiMessages.ProfilerComposite_no_profiler;
- }
- case performance_profiler: {
- return EclipseLinkUiMessages.ProfilerComposite_performance_profiler;
- }
- case query_monitor: {
- return EclipseLinkUiMessages.ProfilerComposite_query_monitor;
- }
- default: {
- return null;
- }
- }
- }
-
- private Comparator<String> buildProfilerComparator() {
- return new Comparator<String>() {
- public int compare(String profiler1, String profiler2) {
- profiler1 = buildDisplayString(profiler1);
- profiler2 = buildDisplayString(profiler2);
- return Collator.getInstance().compare(profiler1, profiler2);
- }
- };
- }
-
- @Override
- protected StringConverter<String> buildClassConverter() {
- return new StringConverter<String>() {
- public String convertToString(String value) {
- try {
- Profiler.valueOf(value);
- value = buildDisplayString(value);
- }
- catch (Exception e) {
- // Ignore since the value is not a Profiler
- }
- return value;
- }
- };
- }
-
-
- @Override
- protected ListValueModel<String> buildClassListHolder() {
- ArrayList<ListValueModel<String>> holders = new ArrayList<ListValueModel<String>>(2);
- holders.add(this.buildDefaultProfilerListHolder());
- holders.add(this.buildProfilersListHolder());
- return new CompositeListValueModel<ListValueModel<String>, String>(holders);
- }
-
- private Iterator<String> buildProfilers() {
- return new TransformationIterator<Profiler, String>(CollectionTools.iterator(Profiler.values())) {
- @Override
- protected String transform(Profiler next) {
- return next.name();
- }
- };
- }
-
- private CollectionValueModel<String> buildProfilersCollectionHolder() {
- return new SimpleCollectionValueModel<String>(
- CollectionTools.collection(this.buildProfilers())
- );
- }
-
- private ListValueModel<String> buildProfilersListHolder() {
- return new SortedListValueModelAdapter<String>(
- this.buildProfilersCollectionHolder(),
- this.buildProfilerComparator()
- );
- }
-
- private String getDefaultValue(Customization subject) {
- String defaultValue = subject.getDefaultProfiler();
-
- if (defaultValue != null) {
- return NLS.bind(
- EclipseLinkUiMessages.PersistenceXmlCustomizationTab_defaultWithOneParam,
- defaultValue
- );
- }
- return EclipseLinkUiMessages.PersistenceXmlCustomizationTab_defaultEmpty;
- }
-
- @Override
- protected void setClassName(String className) {
- this.getSubject().setProfiler(className);
- }
-
- @Override
- protected String getSuperInterfaceName() {
- return Customization.ECLIPSELINK_SESSION_PROFILER_CLASS_NAME;
- }
-} \ No newline at end of file
diff --git a/jpa/plugins/org.eclipse.jpt.eclipselink.ui/src/org/eclipse/jpt/eclipselink/ui/internal/persistence/customization/SessionCustomizersComposite.java b/jpa/plugins/org.eclipse.jpt.eclipselink.ui/src/org/eclipse/jpt/eclipselink/ui/internal/persistence/customization/SessionCustomizersComposite.java
deleted file mode 100644
index 8b1c2c85ba..0000000000
--- a/jpa/plugins/org.eclipse.jpt.eclipselink.ui/src/org/eclipse/jpt/eclipselink/ui/internal/persistence/customization/SessionCustomizersComposite.java
+++ /dev/null
@@ -1,213 +0,0 @@
-/*******************************************************************************
-* Copyright (c) 2008, 2009 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.
-*
-* Contributors:
-* Oracle - initial API and implementation
-*******************************************************************************/
-package org.eclipse.jpt.eclipselink.ui.internal.persistence.customization;
-
-import java.util.ListIterator;
-import org.eclipse.core.resources.IProject;
-import org.eclipse.jdt.core.IJavaElement;
-import org.eclipse.jdt.core.IJavaProject;
-import org.eclipse.jdt.core.IPackageFragmentRoot;
-import org.eclipse.jdt.core.IType;
-import org.eclipse.jdt.core.JavaCore;
-import org.eclipse.jdt.core.JavaModelException;
-import org.eclipse.jdt.core.search.IJavaSearchScope;
-import org.eclipse.jdt.core.search.SearchEngine;
-import org.eclipse.jdt.ui.IJavaElementSearchConstants;
-import org.eclipse.jdt.ui.JavaUI;
-import org.eclipse.jface.viewers.ILabelProvider;
-import org.eclipse.jface.viewers.LabelProvider;
-import org.eclipse.jface.window.Window;
-import org.eclipse.jpt.eclipselink.core.internal.context.persistence.customization.Customization;
-import org.eclipse.jpt.eclipselink.ui.JptEclipseLinkUiPlugin;
-import org.eclipse.jpt.eclipselink.ui.internal.EclipseLinkUiMessages;
-import org.eclipse.jpt.ui.internal.JptUiMessages;
-import org.eclipse.jpt.ui.internal.widgets.AddRemoveListPane;
-import org.eclipse.jpt.ui.internal.widgets.Pane;
-import org.eclipse.jpt.ui.internal.widgets.AddRemovePane.Adapter;
-import org.eclipse.jpt.utility.internal.model.value.ItemPropertyListValueModelAdapter;
-import org.eclipse.jpt.utility.internal.model.value.ListAspectAdapter;
-import org.eclipse.jpt.utility.internal.model.value.SimplePropertyValueModel;
-import org.eclipse.jpt.utility.internal.model.value.swing.ObjectListSelectionModel;
-import org.eclipse.jpt.utility.model.value.ListValueModel;
-import org.eclipse.jpt.utility.model.value.WritablePropertyValueModel;
-import org.eclipse.swt.layout.GridData;
-import org.eclipse.swt.widgets.Composite;
-import org.eclipse.swt.widgets.Table;
-import org.eclipse.ui.PlatformUI;
-import org.eclipse.ui.dialogs.SelectionDialog;
-import org.eclipse.ui.progress.IProgressService;
-
-/**
- * SessionCustomizersComposite
- */
-public class SessionCustomizersComposite extends Pane<Customization>
-{
- /**
- * Creates a new <code>SessionCustomizerComposite</code>.
- *
- * @param parentPane The parent pane of this one
- * @param parent The parent container
- */
- public SessionCustomizersComposite(Pane<? extends Customization> parentPane,
- Composite parent) {
-
- super(parentPane, parent);
- }
-
-
- private void addSessionCustomizerClass(ObjectListSelectionModel listSelectionModel) {
-
- IType type = chooseType();
-
- if (type != null) {
- String className = type.getFullyQualifiedName('.');
- if( ! this.getSubject().sessionCustomizerExists(className)) {
-
- String classRef = this.getSubject().addSessionCustomizer(className);
- listSelectionModel.setSelectedValue(classRef);
- }
- }
- }
-
- private Adapter buildAdapter() {
- return new AddRemoveListPane.AbstractAdapter() {
- public void addNewItem(ObjectListSelectionModel listSelectionModel) {
- addSessionCustomizerClass(listSelectionModel);
- }
-
- public void removeSelectedItems(ObjectListSelectionModel listSelectionModel) {
- for (Object item : listSelectionModel.selectedValues()) {
- getSubject().removeSessionCustomizer((String) item);
- }
- }
- };
- }
-
- private ILabelProvider buildLabelProvider() {
- return new LabelProvider() {
-
- @Override
- public String getText(Object element) {
- String name = (String) element;
-
- if (name == null) {
- name = EclipseLinkUiMessages.PersistenceXmlCustomizationTab_noName;
- }
- return name;
- }
- };
- }
-
- private ListValueModel<String> buildListHolder() {
- return new ListAspectAdapter<Customization, String>(getSubjectHolder(), Customization.SESSION_CUSTOMIZER_LIST) {
- @Override
- protected ListIterator<String> listIterator_() {
- return subject.sessionCustomizers();
- }
-
- @Override
- protected int size_() {
- return subject.sessionCustomizersSize();
- }
- };
- }
-
- private WritablePropertyValueModel<String> buildSelectedItemHolder() {
- return new SimplePropertyValueModel<String>();
- }
-
- /**
- * Prompts the user the Open Type dialog.
- *
- * @return Either the selected type or <code>null</code> if the user
- * cancelled the dialog
- */
- private IType chooseType() {
-
- IPackageFragmentRoot root = packageFragmentRoot();
-
- if (root == null) {
- return null;
- }
-
- IJavaElement[] elements = new IJavaElement[] { root.getJavaProject() };
- IJavaSearchScope scope = SearchEngine.createJavaSearchScope(elements);
- IProgressService service = PlatformUI.getWorkbench().getProgressService();
- SelectionDialog typeSelectionDialog;
-
- try {
- typeSelectionDialog = JavaUI.createTypeDialog(
- getShell(),
- service,
- scope,
- IJavaElementSearchConstants.CONSIDER_CLASSES,
- false,
- ""
- );
- }
- catch (JavaModelException e) {
- JptEclipseLinkUiPlugin.log(e);
- return null;
- }
-
- typeSelectionDialog.setTitle(JptUiMessages.ClassChooserPane_dialogTitle);
- typeSelectionDialog.setMessage(JptUiMessages.ClassChooserPane_dialogMessage);
-
- if (typeSelectionDialog.open() == Window.OK) {
- return (IType) typeSelectionDialog.getResult()[0];
- }
-
- return null;
- }
-
- @Override
- protected void initializeLayout(Composite container) {
- // Description
- container = addTitledGroup(
- container,
- EclipseLinkUiMessages.PersistenceXmlCustomizationTab_sessionCustomizerLabel
- );
-
- // List pane
- new AddRemoveListPane<Customization>(
- this,
- container,
- buildAdapter(),
- buildListHolder(),
- buildSelectedItemHolder(),
- buildLabelProvider()
- )
- {
- @Override
- protected void initializeTable(Table table) {
- super.initializeTable(table);
-
- Composite container = table.getParent();
- GridData gridData = (GridData) container.getLayoutData();
- gridData.heightHint = 75;
- }
- };
- }
-
- private IPackageFragmentRoot packageFragmentRoot() {
- IProject project = getSubject().getJpaProject().getProject();
- IJavaProject root = JavaCore.create(project);
-
- try {
- return root.getAllPackageFragmentRoots()[0];
- }
- catch (JavaModelException e) {
- JptEclipseLinkUiPlugin.log(e);
- }
-
- return null;
- }
-
-}
diff --git a/jpa/plugins/org.eclipse.jpt.eclipselink.ui/src/org/eclipse/jpt/eclipselink/ui/internal/persistence/customization/ThrowExceptionsComposite.java b/jpa/plugins/org.eclipse.jpt.eclipselink.ui/src/org/eclipse/jpt/eclipselink/ui/internal/persistence/customization/ThrowExceptionsComposite.java
deleted file mode 100644
index 147d092bdd..0000000000
--- a/jpa/plugins/org.eclipse.jpt.eclipselink.ui/src/org/eclipse/jpt/eclipselink/ui/internal/persistence/customization/ThrowExceptionsComposite.java
+++ /dev/null
@@ -1,96 +0,0 @@
-/*******************************************************************************
- * Copyright (c) 2008, 2009 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.
- *
- * Contributors:
- * Oracle - initial API and implementation
- *******************************************************************************/
-package org.eclipse.jpt.eclipselink.ui.internal.persistence.customization;
-
-import org.eclipse.jpt.eclipselink.core.internal.context.persistence.customization.Customization;
-import org.eclipse.jpt.eclipselink.ui.internal.EclipseLinkHelpContextIds;
-import org.eclipse.jpt.eclipselink.ui.internal.EclipseLinkUiMessages;
-import org.eclipse.jpt.ui.internal.widgets.FormPane;
-import org.eclipse.jpt.utility.internal.model.value.PropertyAspectAdapter;
-import org.eclipse.jpt.utility.internal.model.value.TransformationPropertyValueModel;
-import org.eclipse.jpt.utility.model.value.PropertyValueModel;
-import org.eclipse.jpt.utility.model.value.WritablePropertyValueModel;
-import org.eclipse.osgi.util.NLS;
-import org.eclipse.swt.widgets.Composite;
-
-/**
- * ThrowExceptionsComposite
- */
-public class ThrowExceptionsComposite extends FormPane<Customization>
-{
- /**
- * Creates a new <code>ThrowExceptionsComposite</code>.
- *
- * @param parentController
- * The parent container of this one
- * @param parent
- * The parent container
- */
- public ThrowExceptionsComposite(
- FormPane<? extends Customization> parentComposite,
- Composite parent) {
-
- super(parentComposite, parent);
- }
-
- @Override
- protected void initializeLayout(Composite container) {
-
- this.addTriStateCheckBoxWithDefault(
- container,
- EclipseLinkUiMessages.PersistenceXmlCustomizationTab_throwExceptionsLabel,
- this.buildThrowExceptionsHolder(),
- this.buildThrowExceptionsStringHolder(),
- EclipseLinkHelpContextIds.PERSISTENCE_CUSTOMIZATION
- );
- }
-
- private WritablePropertyValueModel<Boolean> buildThrowExceptionsHolder() {
- return new PropertyAspectAdapter<Customization, Boolean>(getSubjectHolder(), Customization.THROW_EXCEPTIONS_PROPERTY) {
- @Override
- protected Boolean buildValue_() {
- return this.subject.getThrowExceptions();
- }
-
- @Override
- protected void setValue_(Boolean value) {
- this.subject.setThrowExceptions(value);
- }
- };
- }
-
- private PropertyValueModel<String> buildThrowExceptionsStringHolder() {
- return new TransformationPropertyValueModel<Boolean, String>(buildDefaultThrowExceptionsHolder()) {
- @Override
- protected String transform(Boolean value) {
- if (value != null) {
- String defaultStringValue = value.booleanValue() ? EclipseLinkUiMessages.Boolean_True : EclipseLinkUiMessages.Boolean_False;
- return NLS.bind(EclipseLinkUiMessages.PersistenceXmlCustomizationTab_throwExceptionsLabelDefault, defaultStringValue);
- }
- return EclipseLinkUiMessages.PersistenceXmlCustomizationTab_throwExceptionsLabel;
- }
- };
- }
-
- private PropertyValueModel<Boolean> buildDefaultThrowExceptionsHolder() {
- return new PropertyAspectAdapter<Customization, Boolean>(
- getSubjectHolder(),
- Customization.THROW_EXCEPTIONS_PROPERTY)
- {
- @Override
- protected Boolean buildValue_() {
- if (this.subject.getThrowExceptions() != null) {
- return null;
- }
- return this.subject.getDefaultThrowExceptions();
- }
- };
- }
-}
diff --git a/jpa/plugins/org.eclipse.jpt.eclipselink.ui/src/org/eclipse/jpt/eclipselink/ui/internal/persistence/customization/ValidationOnlyComposite.java b/jpa/plugins/org.eclipse.jpt.eclipselink.ui/src/org/eclipse/jpt/eclipselink/ui/internal/persistence/customization/ValidationOnlyComposite.java
deleted file mode 100644
index 6b0ae9387c..0000000000
--- a/jpa/plugins/org.eclipse.jpt.eclipselink.ui/src/org/eclipse/jpt/eclipselink/ui/internal/persistence/customization/ValidationOnlyComposite.java
+++ /dev/null
@@ -1,96 +0,0 @@
-/*******************************************************************************
- * Copyright (c) 2008, 2009 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.
- *
- * Contributors:
- * Oracle - initial API and implementation
- *******************************************************************************/
-package org.eclipse.jpt.eclipselink.ui.internal.persistence.customization;
-
-import org.eclipse.jpt.eclipselink.core.internal.context.persistence.customization.Customization;
-import org.eclipse.jpt.eclipselink.ui.internal.EclipseLinkHelpContextIds;
-import org.eclipse.jpt.eclipselink.ui.internal.EclipseLinkUiMessages;
-import org.eclipse.jpt.ui.internal.widgets.FormPane;
-import org.eclipse.jpt.utility.internal.model.value.PropertyAspectAdapter;
-import org.eclipse.jpt.utility.internal.model.value.TransformationPropertyValueModel;
-import org.eclipse.jpt.utility.model.value.PropertyValueModel;
-import org.eclipse.jpt.utility.model.value.WritablePropertyValueModel;
-import org.eclipse.osgi.util.NLS;
-import org.eclipse.swt.widgets.Composite;
-
-/**
- * ValidationOnlyComposite
- */
-public class ValidationOnlyComposite extends FormPane<Customization>
-{
- /**
- * Creates a new <code>ValidationOnlyComposite</code>.
- *
- * @param parentController
- * The parent container of this one
- * @param parent
- * The parent container
- */
- public ValidationOnlyComposite(
- FormPane<? extends Customization> parentComposite,
- Composite parent) {
-
- super(parentComposite, parent);
- }
-
- @Override
- protected void initializeLayout(Composite container) {
-
- this.addTriStateCheckBoxWithDefault(
- container,
- EclipseLinkUiMessages.PersistenceXmlCustomizationTab_validationOnlyLabel,
- this.buildValidationOnlyHolder(),
- this.buildValidationOnlyStringHolder(),
- EclipseLinkHelpContextIds.PERSISTENCE_CUSTOMIZATION
- );
- }
-
- private WritablePropertyValueModel<Boolean> buildValidationOnlyHolder() {
- return new PropertyAspectAdapter<Customization, Boolean>(getSubjectHolder(), Customization.VALIDATION_ONLY_PROPERTY) {
- @Override
- protected Boolean buildValue_() {
- return this.subject.getValidationOnly();
- }
-
- @Override
- protected void setValue_(Boolean value) {
- this.subject.setValidationOnly(value);
- }
- };
- }
-
- private PropertyValueModel<String> buildValidationOnlyStringHolder() {
- return new TransformationPropertyValueModel<Boolean, String>(buildDefaultValidationOnlyHolder()) {
- @Override
- protected String transform(Boolean value) {
- if (value != null) {
- String defaultStringValue = value.booleanValue() ? EclipseLinkUiMessages.Boolean_True : EclipseLinkUiMessages.Boolean_False;
- return NLS.bind(EclipseLinkUiMessages.PersistenceXmlCustomizationTab_validationOnlyLabelDefault, defaultStringValue);
- }
- return EclipseLinkUiMessages.PersistenceXmlCustomizationTab_validationOnlyLabel;
- }
- };
- }
-
- private PropertyValueModel<Boolean> buildDefaultValidationOnlyHolder() {
- return new PropertyAspectAdapter<Customization, Boolean>(
- getSubjectHolder(),
- Customization.VALIDATION_ONLY_PROPERTY)
- {
- @Override
- protected Boolean buildValue_() {
- if (this.subject.getValidationOnly() != null) {
- return null;
- }
- return this.subject.getDefaultValidationOnly();
- }
- };
- }
-}
diff --git a/jpa/plugins/org.eclipse.jpt.eclipselink.ui/src/org/eclipse/jpt/eclipselink/ui/internal/persistence/customization/WeavingChangeTrackingComposite.java b/jpa/plugins/org.eclipse.jpt.eclipselink.ui/src/org/eclipse/jpt/eclipselink/ui/internal/persistence/customization/WeavingChangeTrackingComposite.java
deleted file mode 100644
index 0d2103fc8d..0000000000
--- a/jpa/plugins/org.eclipse.jpt.eclipselink.ui/src/org/eclipse/jpt/eclipselink/ui/internal/persistence/customization/WeavingChangeTrackingComposite.java
+++ /dev/null
@@ -1,96 +0,0 @@
-/*******************************************************************************
- * Copyright (c) 2008, 2009 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.
- *
- * Contributors:
- * Oracle - initial API and implementation
- *******************************************************************************/
-package org.eclipse.jpt.eclipselink.ui.internal.persistence.customization;
-
-import org.eclipse.jpt.eclipselink.core.internal.context.persistence.customization.Customization;
-import org.eclipse.jpt.eclipselink.ui.internal.EclipseLinkHelpContextIds;
-import org.eclipse.jpt.eclipselink.ui.internal.EclipseLinkUiMessages;
-import org.eclipse.jpt.ui.internal.widgets.FormPane;
-import org.eclipse.jpt.utility.internal.model.value.PropertyAspectAdapter;
-import org.eclipse.jpt.utility.internal.model.value.TransformationPropertyValueModel;
-import org.eclipse.jpt.utility.model.value.PropertyValueModel;
-import org.eclipse.jpt.utility.model.value.WritablePropertyValueModel;
-import org.eclipse.osgi.util.NLS;
-import org.eclipse.swt.widgets.Composite;
-
-/**
- * WeavingChangeTrackingComposite
- */
-public class WeavingChangeTrackingComposite extends FormPane<Customization>
-{
- /**
- * Creates a new <code>WeavingChangeTrackingComposite</code>.
- *
- * @param parentController
- * The parent container of this one
- * @param parent
- * The parent container
- */
- public WeavingChangeTrackingComposite(
- FormPane<? extends Customization> parentComposite,
- Composite parent) {
-
- super(parentComposite, parent);
- }
-
- @Override
- protected void initializeLayout(Composite container) {
-
- this.addTriStateCheckBoxWithDefault(
- container,
- EclipseLinkUiMessages.PersistenceXmlCustomizationTab_weavingChangeTrackingLabel,
- this.buildWeavingChangeTrackingHolder(),
- this.buildWeavingChangeTrackingStringHolder(),
- EclipseLinkHelpContextIds.PERSISTENCE_CUSTOMIZATION
- );
- }
-
- private WritablePropertyValueModel<Boolean> buildWeavingChangeTrackingHolder() {
- return new PropertyAspectAdapter<Customization, Boolean>(getSubjectHolder(), Customization.WEAVING_CHANGE_TRACKING_PROPERTY) {
- @Override
- protected Boolean buildValue_() {
- return this.subject.getWeavingChangeTracking();
- }
-
- @Override
- protected void setValue_(Boolean value) {
- this.subject.setWeavingChangeTracking(value);
- }
- };
- }
-
- private PropertyValueModel<String> buildWeavingChangeTrackingStringHolder() {
- return new TransformationPropertyValueModel<Boolean, String>(buildDefaultWeavingChangeTrackingHolder()) {
- @Override
- protected String transform(Boolean value) {
- if (value != null) {
- String defaultStringValue = value.booleanValue() ? EclipseLinkUiMessages.Boolean_True : EclipseLinkUiMessages.Boolean_False;
- return NLS.bind(EclipseLinkUiMessages.PersistenceXmlCustomizationTab_weavingChangeTrackingLabelDefault, defaultStringValue);
- }
- return EclipseLinkUiMessages.PersistenceXmlCustomizationTab_weavingChangeTrackingLabel;
- }
- };
- }
-
- private PropertyValueModel<Boolean> buildDefaultWeavingChangeTrackingHolder() {
- return new PropertyAspectAdapter<Customization, Boolean>(
- getSubjectHolder(),
- Customization.WEAVING_CHANGE_TRACKING_PROPERTY)
- {
- @Override
- protected Boolean buildValue_() {
- if (this.subject.getWeavingChangeTracking() != null) {
- return null;
- }
- return this.subject.getDefaultWeavingChangeTracking();
- }
- };
- }
-}
diff --git a/jpa/plugins/org.eclipse.jpt.eclipselink.ui/src/org/eclipse/jpt/eclipselink/ui/internal/persistence/customization/WeavingComposite.java b/jpa/plugins/org.eclipse.jpt.eclipselink.ui/src/org/eclipse/jpt/eclipselink/ui/internal/persistence/customization/WeavingComposite.java
deleted file mode 100644
index cc4dc53aad..0000000000
--- a/jpa/plugins/org.eclipse.jpt.eclipselink.ui/src/org/eclipse/jpt/eclipselink/ui/internal/persistence/customization/WeavingComposite.java
+++ /dev/null
@@ -1,87 +0,0 @@
-/*******************************************************************************
- * Copyright (c) 2008, 2009 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.
- *
- * Contributors:
- * Oracle - initial API and implementation
- *******************************************************************************/
-package org.eclipse.jpt.eclipselink.ui.internal.persistence.customization;
-
-import java.util.Collection;
-import org.eclipse.jpt.eclipselink.core.internal.context.persistence.customization.Customization;
-import org.eclipse.jpt.eclipselink.core.internal.context.persistence.customization.Weaving;
-import org.eclipse.jpt.eclipselink.ui.internal.EclipseLinkHelpContextIds;
-import org.eclipse.jpt.eclipselink.ui.internal.EclipseLinkUiMessages;
-import org.eclipse.jpt.ui.internal.widgets.EnumFormComboViewer;
-import org.eclipse.jpt.ui.internal.widgets.FormPane;
-import org.eclipse.swt.widgets.Composite;
-
-/**
- * WeavingComposite
- */
-public class WeavingComposite extends FormPane<Customization>
-{
- /**
- * Creates a new <code>WeavingComposite</code>.
- *
- * @param parentController
- * The parent container of this one
- * @param parent
- * The parent container
- */
- public WeavingComposite(
- FormPane<? extends Customization> parentComposite,
- Composite parent) {
-
- super( parentComposite, parent);
- }
-
- private EnumFormComboViewer<Customization, Weaving> addWeavingCombo(Composite container) {
- return new EnumFormComboViewer<Customization, Weaving>(this, container) {
- @Override
- protected void addPropertyNames(Collection<String> propertyNames) {
- super.addPropertyNames(propertyNames);
- propertyNames.add(Customization.WEAVING_PROPERTY);
- }
-
- @Override
- protected Weaving[] getChoices() {
- return Weaving.values();
- }
-
- @Override
- protected Weaving getDefaultValue() {
- return getSubject().getDefaultWeaving();
- }
-
- @Override
- protected String displayString(Weaving value) {
- return buildDisplayString(EclipseLinkUiMessages.class, WeavingComposite.this, value);
- }
-
- @Override
- protected Weaving getValue() {
- return getSubject().getWeaving();
- }
-
- @Override
- protected void setValue(Weaving value) {
- getSubject().setWeaving(value);
- }
- };
- }
-
- @Override
- protected void initializeLayout( Composite container) {
-
- this.addLabeledComposite(
- container,
- EclipseLinkUiMessages.PersistenceXmlCustomizationTab_weavingLabel,
- this.addWeavingCombo( container),
- EclipseLinkHelpContextIds.PERSISTENCE_CUSTOMIZATION
- );
- }
-
-}
diff --git a/jpa/plugins/org.eclipse.jpt.eclipselink.ui/src/org/eclipse/jpt/eclipselink/ui/internal/persistence/customization/WeavingEagerComposite.java b/jpa/plugins/org.eclipse.jpt.eclipselink.ui/src/org/eclipse/jpt/eclipselink/ui/internal/persistence/customization/WeavingEagerComposite.java
deleted file mode 100644
index 9c13a3161c..0000000000
--- a/jpa/plugins/org.eclipse.jpt.eclipselink.ui/src/org/eclipse/jpt/eclipselink/ui/internal/persistence/customization/WeavingEagerComposite.java
+++ /dev/null
@@ -1,96 +0,0 @@
-/*******************************************************************************
- * Copyright (c) 2008, 2009 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.
- *
- * Contributors:
- * Oracle - initial API and implementation
- *******************************************************************************/
-package org.eclipse.jpt.eclipselink.ui.internal.persistence.customization;
-
-import org.eclipse.jpt.eclipselink.core.internal.context.persistence.customization.Customization;
-import org.eclipse.jpt.eclipselink.ui.internal.EclipseLinkHelpContextIds;
-import org.eclipse.jpt.eclipselink.ui.internal.EclipseLinkUiMessages;
-import org.eclipse.jpt.ui.internal.widgets.FormPane;
-import org.eclipse.jpt.utility.internal.model.value.PropertyAspectAdapter;
-import org.eclipse.jpt.utility.internal.model.value.TransformationPropertyValueModel;
-import org.eclipse.jpt.utility.model.value.PropertyValueModel;
-import org.eclipse.jpt.utility.model.value.WritablePropertyValueModel;
-import org.eclipse.osgi.util.NLS;
-import org.eclipse.swt.widgets.Composite;
-
-/**
- * WeavingEagerComposite
- */
-public class WeavingEagerComposite extends FormPane<Customization>
-{
- /**
- * Creates a new <code>WeavingEagerComposite</code>.
- *
- * @param parentController
- * The parent container of this one
- * @param parent
- * The parent container
- */
- public WeavingEagerComposite(
- FormPane<? extends Customization> parentComposite,
- Composite parent) {
-
- super(parentComposite, parent);
- }
-
- @Override
- protected void initializeLayout(Composite container) {
-
- this.addTriStateCheckBoxWithDefault(
- container,
- EclipseLinkUiMessages.PersistenceXmlCustomizationTab_weavingEagerLabel,
- this.buildWeavingEagerHolder(),
- this.buildWeavingEagerStringHolder(),
- EclipseLinkHelpContextIds.PERSISTENCE_CUSTOMIZATION
- );
- }
-
- private WritablePropertyValueModel<Boolean> buildWeavingEagerHolder() {
- return new PropertyAspectAdapter<Customization, Boolean>(getSubjectHolder(), Customization.WEAVING_EAGER_PROPERTY) {
- @Override
- protected Boolean buildValue_() {
- return this.subject.getWeavingEager();
- }
-
- @Override
- protected void setValue_(Boolean value) {
- this.subject.setWeavingEager(value);
- }
- };
- }
-
- private PropertyValueModel<String> buildWeavingEagerStringHolder() {
- return new TransformationPropertyValueModel<Boolean, String>(buildDefaultWeavingEagerHolder()) {
- @Override
- protected String transform(Boolean value) {
- if (value != null) {
- String defaultStringValue = value.booleanValue() ? EclipseLinkUiMessages.Boolean_True : EclipseLinkUiMessages.Boolean_False;
- return NLS.bind(EclipseLinkUiMessages.PersistenceXmlCustomizationTab_weavingEagerLabelDefault, defaultStringValue);
- }
- return EclipseLinkUiMessages.PersistenceXmlCustomizationTab_weavingEagerLabel;
- }
- };
- }
-
- private PropertyValueModel<Boolean> buildDefaultWeavingEagerHolder() {
- return new PropertyAspectAdapter<Customization, Boolean>(
- getSubjectHolder(),
- Customization.WEAVING_EAGER_PROPERTY)
- {
- @Override
- protected Boolean buildValue_() {
- if (this.subject.getWeavingEager() != null) {
- return null;
- }
- return this.subject.getDefaultWeavingEager();
- }
- };
- }
-}
diff --git a/jpa/plugins/org.eclipse.jpt.eclipselink.ui/src/org/eclipse/jpt/eclipselink/ui/internal/persistence/customization/WeavingFetchGroupsComposite.java b/jpa/plugins/org.eclipse.jpt.eclipselink.ui/src/org/eclipse/jpt/eclipselink/ui/internal/persistence/customization/WeavingFetchGroupsComposite.java
deleted file mode 100644
index bf64a25e3e..0000000000
--- a/jpa/plugins/org.eclipse.jpt.eclipselink.ui/src/org/eclipse/jpt/eclipselink/ui/internal/persistence/customization/WeavingFetchGroupsComposite.java
+++ /dev/null
@@ -1,96 +0,0 @@
-/*******************************************************************************
- * Copyright (c) 2008, 2009 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.
- *
- * Contributors:
- * Oracle - initial API and implementation
- *******************************************************************************/
-package org.eclipse.jpt.eclipselink.ui.internal.persistence.customization;
-
-import org.eclipse.jpt.eclipselink.core.internal.context.persistence.customization.Customization;
-import org.eclipse.jpt.eclipselink.ui.internal.EclipseLinkHelpContextIds;
-import org.eclipse.jpt.eclipselink.ui.internal.EclipseLinkUiMessages;
-import org.eclipse.jpt.ui.internal.widgets.FormPane;
-import org.eclipse.jpt.utility.internal.model.value.PropertyAspectAdapter;
-import org.eclipse.jpt.utility.internal.model.value.TransformationPropertyValueModel;
-import org.eclipse.jpt.utility.model.value.PropertyValueModel;
-import org.eclipse.jpt.utility.model.value.WritablePropertyValueModel;
-import org.eclipse.osgi.util.NLS;
-import org.eclipse.swt.widgets.Composite;
-
-/**
- * WeavingFetchGroupsComposite
- */
-public class WeavingFetchGroupsComposite extends FormPane<Customization>
-{
- /**
- * Creates a new <code>WeavingFetchGroupsComposite</code>.
- *
- * @param parentController
- * The parent container of this one
- * @param parent
- * The parent container
- */
- public WeavingFetchGroupsComposite(
- FormPane<? extends Customization> parentComposite,
- Composite parent) {
-
- super(parentComposite, parent);
- }
-
- @Override
- protected void initializeLayout(Composite container) {
-
- this.addTriStateCheckBoxWithDefault(
- container,
- EclipseLinkUiMessages.PersistenceXmlCustomizationTab_weavingFetchGroupsLabel,
- this.buildWeavingFetchGroupsHolder(),
- this.buildWeavingFetchGroupsStringHolder(),
- EclipseLinkHelpContextIds.PERSISTENCE_CUSTOMIZATION
- );
- }
-
- private WritablePropertyValueModel<Boolean> buildWeavingFetchGroupsHolder() {
- return new PropertyAspectAdapter<Customization, Boolean>(getSubjectHolder(), Customization.WEAVING_FETCH_GROUPS_PROPERTY) {
- @Override
- protected Boolean buildValue_() {
- return this.subject.getWeavingFetchGroups();
- }
-
- @Override
- protected void setValue_(Boolean value) {
- this.subject.setWeavingFetchGroups(value);
- }
- };
- }
-
- private PropertyValueModel<String> buildWeavingFetchGroupsStringHolder() {
- return new TransformationPropertyValueModel<Boolean, String>(buildDefaultWeavingFetchGroupsHolder()) {
- @Override
- protected String transform(Boolean value) {
- if (value != null) {
- String defaultStringValue = value.booleanValue() ? EclipseLinkUiMessages.Boolean_True : EclipseLinkUiMessages.Boolean_False;
- return NLS.bind(EclipseLinkUiMessages.PersistenceXmlCustomizationTab_weavingFetchGroupsLabelDefault, defaultStringValue);
- }
- return EclipseLinkUiMessages.PersistenceXmlCustomizationTab_weavingFetchGroupsLabel;
- }
- };
- }
-
- private PropertyValueModel<Boolean> buildDefaultWeavingFetchGroupsHolder() {
- return new PropertyAspectAdapter<Customization, Boolean>(
- getSubjectHolder(),
- Customization.WEAVING_FETCH_GROUPS_PROPERTY)
- {
- @Override
- protected Boolean buildValue_() {
- if (this.subject.getWeavingFetchGroups() != null) {
- return null;
- }
- return this.subject.getDefaultWeavingFetchGroups();
- }
- };
- }
-}
diff --git a/jpa/plugins/org.eclipse.jpt.eclipselink.ui/src/org/eclipse/jpt/eclipselink/ui/internal/persistence/customization/WeavingInternalComposite.java b/jpa/plugins/org.eclipse.jpt.eclipselink.ui/src/org/eclipse/jpt/eclipselink/ui/internal/persistence/customization/WeavingInternalComposite.java
deleted file mode 100644
index 95bf74db63..0000000000
--- a/jpa/plugins/org.eclipse.jpt.eclipselink.ui/src/org/eclipse/jpt/eclipselink/ui/internal/persistence/customization/WeavingInternalComposite.java
+++ /dev/null
@@ -1,97 +0,0 @@
-/*******************************************************************************
- * Copyright (c) 2008, 2009 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.
- *
- * Contributors:
- * Oracle - initial API and implementation
- *******************************************************************************/
-package org.eclipse.jpt.eclipselink.ui.internal.persistence.customization;
-
-import org.eclipse.jpt.eclipselink.core.internal.context.persistence.customization.Customization;
-import org.eclipse.jpt.eclipselink.ui.internal.EclipseLinkHelpContextIds;
-import org.eclipse.jpt.eclipselink.ui.internal.EclipseLinkUiMessages;
-import org.eclipse.jpt.ui.internal.widgets.FormPane;
-import org.eclipse.jpt.utility.internal.model.value.PropertyAspectAdapter;
-import org.eclipse.jpt.utility.internal.model.value.TransformationPropertyValueModel;
-import org.eclipse.jpt.utility.model.value.PropertyValueModel;
-import org.eclipse.jpt.utility.model.value.WritablePropertyValueModel;
-import org.eclipse.osgi.util.NLS;
-import org.eclipse.swt.widgets.Composite;
-
-/**
- * WeavingInternalComposite
- */
-public class WeavingInternalComposite extends FormPane<Customization>
-{
- /**
- * Creates a new <code>WeavingInternalComposite</code>.
- *
- * @param parentController
- * The parent container of this one
- * @param parent
- * The parent container
- */
- public WeavingInternalComposite(
- FormPane<? extends Customization> parentComposite,
- Composite parent) {
-
- super(parentComposite, parent);
- }
-
- @Override
- protected void initializeLayout(Composite container) {
-
- this.addTriStateCheckBoxWithDefault(
- container,
- EclipseLinkUiMessages.PersistenceXmlCustomizationTab_weavingInternalLabel,
- this.buildWeavingInternalHolder(),
- this.buildWeavingInternalStringHolder(),
- EclipseLinkHelpContextIds.PERSISTENCE_CUSTOMIZATION
- );
- }
-
- private WritablePropertyValueModel<Boolean> buildWeavingInternalHolder() {
- return new PropertyAspectAdapter<Customization, Boolean>(getSubjectHolder(), Customization.WEAVING_INTERNAL_PROPERTY) {
- @Override
- protected Boolean buildValue_() {
- return this.subject.getWeavingInternal();
- }
-
- @Override
- protected void setValue_(Boolean value) {
- this.subject.setWeavingInternal(value);
- }
- };
- }
-
- private PropertyValueModel<String> buildWeavingInternalStringHolder() {
- return new TransformationPropertyValueModel<Boolean, String>(buildDefaultWeavingInternalHolder()) {
- @Override
- protected String transform(Boolean value) {
- if (value != null) {
- String defaultStringValue = value.booleanValue() ? EclipseLinkUiMessages.Boolean_True : EclipseLinkUiMessages.Boolean_False;
- return NLS.bind(EclipseLinkUiMessages.PersistenceXmlCustomizationTab_weavingInternalLabelDefault, defaultStringValue);
- }
- return EclipseLinkUiMessages.PersistenceXmlCustomizationTab_weavingInternalLabel;
- }
- };
- }
-
-
- private PropertyValueModel<Boolean> buildDefaultWeavingInternalHolder() {
- return new PropertyAspectAdapter<Customization, Boolean>(
- getSubjectHolder(),
- Customization.WEAVING_INTERNAL_PROPERTY)
- {
- @Override
- protected Boolean buildValue_() {
- if (this.subject.getWeavingInternal() != null) {
- return null;
- }
- return this.subject.getDefaultWeavingInternal();
- }
- };
- }
-}
diff --git a/jpa/plugins/org.eclipse.jpt.eclipselink.ui/src/org/eclipse/jpt/eclipselink/ui/internal/persistence/customization/WeavingLazyComposite.java b/jpa/plugins/org.eclipse.jpt.eclipselink.ui/src/org/eclipse/jpt/eclipselink/ui/internal/persistence/customization/WeavingLazyComposite.java
deleted file mode 100644
index 66215c0413..0000000000
--- a/jpa/plugins/org.eclipse.jpt.eclipselink.ui/src/org/eclipse/jpt/eclipselink/ui/internal/persistence/customization/WeavingLazyComposite.java
+++ /dev/null
@@ -1,96 +0,0 @@
-/*******************************************************************************
- * Copyright (c) 2008, 2009 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.
- *
- * Contributors:
- * Oracle - initial API and implementation
- *******************************************************************************/
-package org.eclipse.jpt.eclipselink.ui.internal.persistence.customization;
-
-import org.eclipse.jpt.eclipselink.core.internal.context.persistence.customization.Customization;
-import org.eclipse.jpt.eclipselink.ui.internal.EclipseLinkHelpContextIds;
-import org.eclipse.jpt.eclipselink.ui.internal.EclipseLinkUiMessages;
-import org.eclipse.jpt.ui.internal.widgets.FormPane;
-import org.eclipse.jpt.utility.internal.model.value.PropertyAspectAdapter;
-import org.eclipse.jpt.utility.internal.model.value.TransformationPropertyValueModel;
-import org.eclipse.jpt.utility.model.value.PropertyValueModel;
-import org.eclipse.jpt.utility.model.value.WritablePropertyValueModel;
-import org.eclipse.osgi.util.NLS;
-import org.eclipse.swt.widgets.Composite;
-
-/**
- * WeavingLazyComposite
- */
-public class WeavingLazyComposite extends FormPane<Customization>
-{
- /**
- * Creates a new <code>WeavingLazyComposite</code>.
- *
- * @param parentController
- * The parent container of this one
- * @param parent
- * The parent container
- */
- public WeavingLazyComposite(
- FormPane<? extends Customization> parentComposite,
- Composite parent) {
-
- super(parentComposite, parent);
- }
-
- @Override
- protected void initializeLayout(Composite container) {
-
- this.addTriStateCheckBoxWithDefault(
- container,
- EclipseLinkUiMessages.PersistenceXmlCustomizationTab_weavingLazyLabel,
- this.buildWeavingLazyHolder(),
- this.buildWeavingLazyStringHolder(),
- EclipseLinkHelpContextIds.PERSISTENCE_CUSTOMIZATION
- );
- }
-
- private WritablePropertyValueModel<Boolean> buildWeavingLazyHolder() {
- return new PropertyAspectAdapter<Customization, Boolean>(getSubjectHolder(), Customization.WEAVING_LAZY_PROPERTY) {
- @Override
- protected Boolean buildValue_() {
- return this.subject.getWeavingLazy();
- }
-
- @Override
- protected void setValue_(Boolean value) {
- this.subject.setWeavingLazy(value);
- }
- };
- }
-
- private PropertyValueModel<String> buildWeavingLazyStringHolder() {
- return new TransformationPropertyValueModel<Boolean, String>(buildDefaultWeavingLazyHolder()) {
- @Override
- protected String transform(Boolean value) {
- if (value != null) {
- String defaultStringValue = value.booleanValue() ? EclipseLinkUiMessages.Boolean_True : EclipseLinkUiMessages.Boolean_False;
- return NLS.bind(EclipseLinkUiMessages.PersistenceXmlCustomizationTab_weavingLazyLabelDefault, defaultStringValue);
- }
- return EclipseLinkUiMessages.PersistenceXmlCustomizationTab_weavingLazyLabel;
- }
- };
- }
-
- private PropertyValueModel<Boolean> buildDefaultWeavingLazyHolder() {
- return new PropertyAspectAdapter<Customization, Boolean>(
- getSubjectHolder(),
- Customization.WEAVING_LAZY_PROPERTY)
- {
- @Override
- protected Boolean buildValue_() {
- if (this.subject.getWeavingLazy() != null) {
- return null;
- }
- return this.subject.getDefaultWeavingLazy();
- }
- };
- }
-}
diff --git a/jpa/plugins/org.eclipse.jpt.eclipselink.ui/src/org/eclipse/jpt/eclipselink/ui/internal/persistence/general/EclipseLinkPersistenceUnitGeneralComposite.java b/jpa/plugins/org.eclipse.jpt.eclipselink.ui/src/org/eclipse/jpt/eclipselink/ui/internal/persistence/general/EclipseLinkPersistenceUnitGeneralComposite.java
deleted file mode 100644
index 0aea92cde3..0000000000
--- a/jpa/plugins/org.eclipse.jpt.eclipselink.ui/src/org/eclipse/jpt/eclipselink/ui/internal/persistence/general/EclipseLinkPersistenceUnitGeneralComposite.java
+++ /dev/null
@@ -1,68 +0,0 @@
-/*******************************************************************************
- * Copyright (c) 2008 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.
- *
- * Contributors:
- * Oracle - initial API and implementation
- *******************************************************************************/
-package org.eclipse.jpt.eclipselink.ui.internal.persistence.general;
-
-import org.eclipse.jpt.eclipselink.core.internal.context.persistence.EclipseLinkPersistenceUnit;
-import org.eclipse.jpt.ui.WidgetFactory;
-import org.eclipse.jpt.ui.internal.persistence.JptUiPersistenceMessages;
-import org.eclipse.jpt.ui.internal.persistence.details.PersistenceUnitGeneralComposite;
-import org.eclipse.jpt.utility.model.value.PropertyValueModel;
-import org.eclipse.swt.widgets.Composite;
-
-/**
- * EclipseLinkPersistenceUnitGeneralComposite
- */
-public class EclipseLinkPersistenceUnitGeneralComposite
- extends PersistenceUnitGeneralComposite
-{
- // ********** constructors **********
- public EclipseLinkPersistenceUnitGeneralComposite(
- PropertyValueModel<EclipseLinkPersistenceUnit> subjectHolder,
- Composite container,
- WidgetFactory widgetFactory) {
- super(subjectHolder, container, widgetFactory);
- }
-
- // ********** initialization **********
- @Override
- protected void initializeLayout(Composite container) {
- this.initializeGeneralPane(container);
- this.initializeMappedClassesPane(container);
- this.initializeJPAMappingDescriptorsPane(container);
- this.initializeJarFilesPane(container);
- }
-
- protected void initializeJPAMappingDescriptorsPane(Composite container) {
-
- container = addCollapsableSection(
- container,
- JptUiPersistenceMessages.PersistenceUnitGeneralComposite_jpaMappingDescriptors,
- JptUiPersistenceMessages.PersistenceUnitGeneralComposite_jpaMappingDescriptors_description
- );
-
- updateGridData(container);
- updateGridData(container.getParent());
-
- new EclipseLinkPersistenceUnitMappingFilesComposite(this, container);
- }
-
- protected void initializeJarFilesPane(Composite container) {
-
- container = addCollapsableSection(
- container,
- JptUiPersistenceMessages.PersistenceUnitGeneralComposite_jarFiles
- );
-
- updateGridData(container);
- updateGridData(container.getParent());
-
- new EclipseLinkPersistenceUnitJarFilesComposite(this, container);
- }
-} \ No newline at end of file
diff --git a/jpa/plugins/org.eclipse.jpt.eclipselink.ui/src/org/eclipse/jpt/eclipselink/ui/internal/persistence/general/EclipseLinkPersistenceUnitJarFilesComposite.java b/jpa/plugins/org.eclipse.jpt.eclipselink.ui/src/org/eclipse/jpt/eclipselink/ui/internal/persistence/general/EclipseLinkPersistenceUnitJarFilesComposite.java
deleted file mode 100644
index 2449678ffc..0000000000
--- a/jpa/plugins/org.eclipse.jpt.eclipselink.ui/src/org/eclipse/jpt/eclipselink/ui/internal/persistence/general/EclipseLinkPersistenceUnitJarFilesComposite.java
+++ /dev/null
@@ -1,53 +0,0 @@
-/*******************************************************************************
- * Copyright (c) 2009 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
- *
- * Contributors:
- * Oracle - initial API and implementation
- *******************************************************************************/
-package org.eclipse.jpt.eclipselink.ui.internal.persistence.general;
-
-import org.eclipse.core.resources.IFile;
-import org.eclipse.jpt.core.JptCorePlugin;
-import org.eclipse.jpt.core.context.persistence.PersistenceUnit;
-import org.eclipse.jpt.ui.internal.persistence.details.ArchiveFileSelectionDialog;
-import org.eclipse.jpt.ui.internal.persistence.details.PersistenceUnitJarFilesComposite;
-import org.eclipse.jpt.ui.internal.persistence.details.ArchiveFileSelectionDialog.DeploymentPathCalculator;
-import org.eclipse.jpt.ui.internal.widgets.Pane;
-import org.eclipse.swt.widgets.Composite;
-
-public class EclipseLinkPersistenceUnitJarFilesComposite
- extends PersistenceUnitJarFilesComposite
-{
- public EclipseLinkPersistenceUnitJarFilesComposite(
- Pane<? extends PersistenceUnit> parentPane,
- Composite parent) {
-
- super(parentPane, parent);
- }
-
-
- @Override
- protected DeploymentPathCalculator buildJarFileDeploymentPathCalculator() {
- return new EclipseLinkDeploymentPathCalculator();
- }
-
-
- private static class EclipseLinkDeploymentPathCalculator
- extends ArchiveFileSelectionDialog.ModuleDeploymentPathCalculator
- {
- @Override
- public String calculateDeploymentPath(IFile file) {
- String baseDeploymentPath = super.calculateDeploymentPath(file);
- if (JptCorePlugin.projectHasWebFacet(file.getProject())) {
- return "../" + baseDeploymentPath;
- }
- else {
- return baseDeploymentPath;
- }
- }
- }
-}
diff --git a/jpa/plugins/org.eclipse.jpt.eclipselink.ui/src/org/eclipse/jpt/eclipselink/ui/internal/persistence/general/EclipseLinkPersistenceUnitMappingFilesComposite.java b/jpa/plugins/org.eclipse.jpt.eclipselink.ui/src/org/eclipse/jpt/eclipselink/ui/internal/persistence/general/EclipseLinkPersistenceUnitMappingFilesComposite.java
deleted file mode 100644
index fda2fc3f31..0000000000
--- a/jpa/plugins/org.eclipse.jpt.eclipselink.ui/src/org/eclipse/jpt/eclipselink/ui/internal/persistence/general/EclipseLinkPersistenceUnitMappingFilesComposite.java
+++ /dev/null
@@ -1,123 +0,0 @@
-/*******************************************************************************
- * Copyright (c) 2008, 2009 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.
- *
- * Contributors:
- * Oracle - initial API and implementation
- ******************************************************************************/
-package org.eclipse.jpt.eclipselink.ui.internal.persistence.general;
-
-import org.eclipse.jpt.core.context.persistence.PersistenceUnit;
-import org.eclipse.jpt.eclipselink.core.internal.context.persistence.EclipseLinkPersistenceUnit;
-import org.eclipse.jpt.eclipselink.core.internal.context.persistence.general.GeneralProperties;
-import org.eclipse.jpt.eclipselink.ui.internal.EclipseLinkUiMessages;
-import org.eclipse.jpt.ui.internal.JpaHelpContextIds;
-import org.eclipse.jpt.ui.internal.persistence.details.PersistenceUnitMappingFilesComposite;
-import org.eclipse.jpt.ui.internal.widgets.Pane;
-import org.eclipse.jpt.utility.internal.model.value.PropertyAspectAdapter;
-import org.eclipse.jpt.utility.internal.model.value.TransformationPropertyValueModel;
-import org.eclipse.jpt.utility.model.value.PropertyValueModel;
-import org.eclipse.jpt.utility.model.value.WritablePropertyValueModel;
-import org.eclipse.osgi.util.NLS;
-import org.eclipse.swt.widgets.Composite;
-
-/**
- * Here the layout of this pane:
- * <pre>
- * -----------------------------------------------------------------------------
- * | ------------------------------------------------------------------------- |
- * | | | |
- * | | AddRemoveListPane | |
- * | | | |
- * | ------------------------------------------------------------------------- |
- * -----------------------------------------------------------------------------</pre>
- *
- * @see PersistenceUnit
- * @see PersistenceUnitGeneralComposite - The parent container
- * @see AddRemoveListPane
- *
- * @version 2.0
- * @since 2.0
- */
-public class EclipseLinkPersistenceUnitMappingFilesComposite extends PersistenceUnitMappingFilesComposite
-{
- /**
- * Creates a new <code>PersistenceUnitMappingFilesComposite</code>.
- *
- * @param parentPane The parent pane of this one
- * @param parent The parent container
- */
- public EclipseLinkPersistenceUnitMappingFilesComposite(Pane<? extends PersistenceUnit> parentPane,
- Composite parent) {
-
- super(parentPane, parent);
- }
-
- @Override
- protected void initializeLayout(Composite container) {
- this.addMappingFilesList(container);
- this.addTriStateCheckBoxWithDefault(
- container,
- EclipseLinkUiMessages.PersistenceXmlGeneralTab_excludeEclipselinkOrm,
- this.buildExcludeEclipselinkOrmHolder(),
- this.buildExcludeEclipselinkOrmStringHolder(),
- JpaHelpContextIds.PERSISTENCE_XML_GENERAL
- );
- }
-
- protected PropertyValueModel<GeneralProperties> buildGeneralPropertiesHolder() {
- return new TransformationPropertyValueModel<PersistenceUnit, GeneralProperties>(getSubjectHolder()) {
- @Override
- protected GeneralProperties transform_(PersistenceUnit persistenceUnit) {
- return ((EclipseLinkPersistenceUnit) persistenceUnit).getGeneralProperties();
- }
- };
- }
-
- private WritablePropertyValueModel<Boolean> buildExcludeEclipselinkOrmHolder() {
- return new PropertyAspectAdapter<GeneralProperties, Boolean>(
- buildGeneralPropertiesHolder(),
- GeneralProperties.EXCLUDE_ECLIPSELINK_ORM_PROPERTY)
- {
- @Override
- protected Boolean buildValue_() {
- return this.subject.getExcludeEclipselinkOrm();
- }
-
- @Override
- protected void setValue_(Boolean value) {
- this.subject.setExcludeEclipselinkOrm(value);
- }
- };
- }
-
- private PropertyValueModel<String> buildExcludeEclipselinkOrmStringHolder() {
- return new TransformationPropertyValueModel<Boolean, String>(buildDefaultExcludeEclipselinkOrmHolder()) {
- @Override
- protected String transform(Boolean value) {
- if (value != null) {
- String defaultStringValue = value.booleanValue() ? EclipseLinkUiMessages.Boolean_True : EclipseLinkUiMessages.Boolean_False;
- return NLS.bind(EclipseLinkUiMessages.PersistenceXmlGeneralTab_excludeEclipselinkOrmWithDefault, defaultStringValue);
- }
- return EclipseLinkUiMessages.PersistenceXmlGeneralTab_excludeEclipselinkOrm;
- }
- };
- }
-
- private PropertyValueModel<Boolean> buildDefaultExcludeEclipselinkOrmHolder() {
- return new PropertyAspectAdapter<GeneralProperties, Boolean>(
- buildGeneralPropertiesHolder(),
- GeneralProperties.EXCLUDE_ECLIPSELINK_ORM_PROPERTY)
- {
- @Override
- protected Boolean buildValue_() {
- if (this.subject.getExcludeEclipselinkOrm() != null) {
- return null;
- }
- return this.subject.getDefaultExcludeEclipselinkOrm();
- }
- };
- }
-} \ No newline at end of file
diff --git a/jpa/plugins/org.eclipse.jpt.eclipselink.ui/src/org/eclipse/jpt/eclipselink/ui/internal/persistence/logging/EclipseLinkLoggingComposite.java b/jpa/plugins/org.eclipse.jpt.eclipselink.ui/src/org/eclipse/jpt/eclipselink/ui/internal/persistence/logging/EclipseLinkLoggingComposite.java
deleted file mode 100644
index bd93c7d1b3..0000000000
--- a/jpa/plugins/org.eclipse.jpt.eclipselink.ui/src/org/eclipse/jpt/eclipselink/ui/internal/persistence/logging/EclipseLinkLoggingComposite.java
+++ /dev/null
@@ -1,77 +0,0 @@
-/*******************************************************************************
- * Copyright (c) 2008 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.
- *
- * Contributors:
- * Oracle - initial API and implementation
- *******************************************************************************/
-package org.eclipse.jpt.eclipselink.ui.internal.persistence.logging;
-
-import org.eclipse.jpt.eclipselink.core.internal.context.persistence.logging.Logging;
-import org.eclipse.jpt.eclipselink.ui.internal.EclipseLinkUiMessages;
-import org.eclipse.jpt.ui.internal.widgets.FormPane;
-import org.eclipse.swt.SWT;
-import org.eclipse.swt.layout.GridData;
-import org.eclipse.swt.layout.GridLayout;
-import org.eclipse.swt.widgets.Composite;
-import org.eclipse.ui.forms.widgets.ExpandableComposite;
-import org.eclipse.ui.forms.widgets.Section;
-
-/**
- * EclipseLinkLoggingComposite
- */
-public class EclipseLinkLoggingComposite
- extends FormPane<Logging>
-{
- public EclipseLinkLoggingComposite(
- FormPane<Logging> subjectHolder,
- Composite container) {
- super(subjectHolder, container, false);
- }
-
- @Override
- protected void initializeLayout(Composite parent) {
- Section section = getWidgetFactory().createSection(parent, SWT.FLAT | ExpandableComposite.TITLE_BAR | Section.DESCRIPTION);
- section.setText(EclipseLinkUiMessages.PersistenceXmlLoggingTab_sectionTitle);
- section.setDescription(EclipseLinkUiMessages.PersistenceXmlLoggingTab_sectionDescription);
- Composite composite = getWidgetFactory().createComposite(section);
- composite.setLayout(new GridLayout(1, false));
- section.setClient(composite);
- this.updateGridData(composite);
- this.updateGridData(composite.getParent());
-
- // LoggingLevel:
- new LoggingLevelComposite(this, composite);
-
- // Timestamp:
- new TimestampComposite(this, composite);
-
- // Thread:
- new ThreadComposite(this, composite);
-
- // Session:
- new SessionComposite(this, composite);
-
- // Exceptions:
- new ExceptionsComposite(this, composite);
-
- // LoggingFile:
- new LoggingFileLocationComposite(this, composite);
-
- // Logger:
- new LoggerComposite(this, composite);
-
- return;
- }
-
- private void updateGridData(Composite container) {
- GridData gridData = new GridData();
- gridData.grabExcessHorizontalSpace = true;
- gridData.grabExcessVerticalSpace = true;
- gridData.horizontalAlignment = SWT.FILL;
- gridData.verticalAlignment = SWT.FILL;
- container.setLayoutData(gridData);
- }
-}
diff --git a/jpa/plugins/org.eclipse.jpt.eclipselink.ui/src/org/eclipse/jpt/eclipselink/ui/internal/persistence/logging/ExceptionsComposite.java b/jpa/plugins/org.eclipse.jpt.eclipselink.ui/src/org/eclipse/jpt/eclipselink/ui/internal/persistence/logging/ExceptionsComposite.java
deleted file mode 100644
index f3735e1b4b..0000000000
--- a/jpa/plugins/org.eclipse.jpt.eclipselink.ui/src/org/eclipse/jpt/eclipselink/ui/internal/persistence/logging/ExceptionsComposite.java
+++ /dev/null
@@ -1,96 +0,0 @@
-/*******************************************************************************
- * Copyright (c) 2008, 2009 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.
- *
- * Contributors:
- * Oracle - initial API and implementation
- *******************************************************************************/
-package org.eclipse.jpt.eclipselink.ui.internal.persistence.logging;
-
-import org.eclipse.jpt.eclipselink.core.internal.context.persistence.logging.Logging;
-import org.eclipse.jpt.eclipselink.ui.internal.EclipseLinkHelpContextIds;
-import org.eclipse.jpt.eclipselink.ui.internal.EclipseLinkUiMessages;
-import org.eclipse.jpt.ui.internal.widgets.FormPane;
-import org.eclipse.jpt.utility.internal.model.value.PropertyAspectAdapter;
-import org.eclipse.jpt.utility.internal.model.value.TransformationPropertyValueModel;
-import org.eclipse.jpt.utility.model.value.PropertyValueModel;
-import org.eclipse.jpt.utility.model.value.WritablePropertyValueModel;
-import org.eclipse.osgi.util.NLS;
-import org.eclipse.swt.widgets.Composite;
-
-/**
- * ExceptionsComposite
- */
-public class ExceptionsComposite extends FormPane<Logging>
-{
- /**
- * Creates a new <code>ExceptionsComposite</code>.
- *
- * @param parentController
- * The parent container of this one
- * @param parent
- * The parent container
- */
- public ExceptionsComposite(
- FormPane<? extends Logging> parentComposite,
- Composite parent) {
-
- super(parentComposite, parent);
- }
-
- @Override
- protected void initializeLayout(Composite container) {
-
- this.addTriStateCheckBoxWithDefault(
- container,
- EclipseLinkUiMessages.PersistenceXmlLoggingTab_exceptionsLabel,
- this.buildExceptionsHolder(),
- this.buildExceptionsStringHolder(),
- EclipseLinkHelpContextIds.PERSISTENCE_LOGGING_EXCEPTIONS
- );
- }
-
- private WritablePropertyValueModel<Boolean> buildExceptionsHolder() {
- return new PropertyAspectAdapter<Logging, Boolean>(getSubjectHolder(), Logging.EXCEPTIONS_PROPERTY) {
- @Override
- protected Boolean buildValue_() {
- return this.subject.getExceptions();
- }
-
- @Override
- protected void setValue_(Boolean value) {
- this.subject.setExceptions(value);
- }
- };
- }
-
- private PropertyValueModel<String> buildExceptionsStringHolder() {
- return new TransformationPropertyValueModel<Boolean, String>(buildDefaultExceptionsHolder()) {
- @Override
- protected String transform(Boolean value) {
- if (value != null) {
- String defaultStringValue = value.booleanValue() ? EclipseLinkUiMessages.Boolean_True : EclipseLinkUiMessages.Boolean_False;
- return NLS.bind(EclipseLinkUiMessages.PersistenceXmlLoggingTab_exceptionsLabelDefault, defaultStringValue);
- }
- return EclipseLinkUiMessages.PersistenceXmlLoggingTab_exceptionsLabel;
- }
- };
- }
-
- private PropertyValueModel<Boolean> buildDefaultExceptionsHolder() {
- return new PropertyAspectAdapter<Logging, Boolean>(
- getSubjectHolder(),
- Logging.EXCEPTIONS_PROPERTY)
- {
- @Override
- protected Boolean buildValue_() {
- if (this.subject.getExceptions() != null) {
- return null;
- }
- return this.subject.getDefaultExceptions();
- }
- };
- }
-}
diff --git a/jpa/plugins/org.eclipse.jpt.eclipselink.ui/src/org/eclipse/jpt/eclipselink/ui/internal/persistence/logging/LoggerComposite.java b/jpa/plugins/org.eclipse.jpt.eclipselink.ui/src/org/eclipse/jpt/eclipselink/ui/internal/persistence/logging/LoggerComposite.java
deleted file mode 100644
index 869830cb71..0000000000
--- a/jpa/plugins/org.eclipse.jpt.eclipselink.ui/src/org/eclipse/jpt/eclipselink/ui/internal/persistence/logging/LoggerComposite.java
+++ /dev/null
@@ -1,207 +0,0 @@
-/*******************************************************************************
-* Copyright (c) 2008 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.
-*
-* Contributors:
-* Oracle - initial API and implementation
-*******************************************************************************/
-package org.eclipse.jpt.eclipselink.ui.internal.persistence.logging;
-
-import com.ibm.icu.text.Collator;
-import java.util.ArrayList;
-import java.util.Comparator;
-import java.util.Iterator;
-import org.eclipse.jpt.core.JpaProject;
-import org.eclipse.jpt.eclipselink.core.internal.context.persistence.logging.Logger;
-import org.eclipse.jpt.eclipselink.core.internal.context.persistence.logging.Logging;
-import org.eclipse.jpt.eclipselink.ui.internal.EclipseLinkUiMessages;
-import org.eclipse.jpt.ui.internal.widgets.ClassChooserComboPane;
-import org.eclipse.jpt.ui.internal.widgets.Pane;
-import org.eclipse.jpt.utility.internal.CollectionTools;
-import org.eclipse.jpt.utility.internal.StringConverter;
-import org.eclipse.jpt.utility.internal.iterators.TransformationIterator;
-import org.eclipse.jpt.utility.internal.model.value.CompositeListValueModel;
-import org.eclipse.jpt.utility.internal.model.value.PropertyAspectAdapter;
-import org.eclipse.jpt.utility.internal.model.value.PropertyListValueModelAdapter;
-import org.eclipse.jpt.utility.internal.model.value.SimpleCollectionValueModel;
-import org.eclipse.jpt.utility.internal.model.value.SortedListValueModelAdapter;
-import org.eclipse.jpt.utility.model.value.CollectionValueModel;
-import org.eclipse.jpt.utility.model.value.ListValueModel;
-import org.eclipse.jpt.utility.model.value.PropertyValueModel;
-import org.eclipse.jpt.utility.model.value.WritablePropertyValueModel;
-import org.eclipse.osgi.util.NLS;
-import org.eclipse.swt.widgets.Composite;
-
-/**
- * LoggerComposite
- */
-public class LoggerComposite extends ClassChooserComboPane<Logging>
-{
- /**
- * Creates a new <code>LoggerComposite</code>.
- *
- * @param parentPane The parent container of this one
- * @param parent The parent container
- */
- public LoggerComposite(
- Pane<? extends Logging> parentPane,
- Composite parent) {
-
- super(parentPane, parent);
- }
-
- @Override
- protected String getClassName() {
- if (this.getSubject().getLogger() == null) {
- return Logger.DEFAULT_LOGGER_CLASS_NAME;
- }
- return Logger.getLoggerClassName(this.getSubject().getLogger());
- }
-
- @Override
- protected String getLabelText() {
- return EclipseLinkUiMessages.PersistenceXmlLoggingTab_loggerLabel;
- }
-
- @Override
- protected JpaProject getJpaProject() {
- return getSubject().getJpaProject();
- }
-
- @Override
- protected String getSuperInterfaceName() {
- return Logging.ECLIPSELINK_LOGGER_CLASS_NAME;
- }
-
- @Override
- protected WritablePropertyValueModel<String> buildTextHolder() {
- return new PropertyAspectAdapter<Logging, String>(this.getSubjectHolder(), Logging.LOGGER_PROPERTY) {
- @Override
- protected String buildValue_() {
-
- String name = this.subject.getLogger();
- if (name == null) {
- name = LoggerComposite.this.getDefaultValue(this.subject);
- }
- return name;
- }
-
- @Override
- protected void setValue_(String value) {
-
- if (getDefaultValue(this.subject).equals(value)) {
- value = null;
- }
- this.subject.setLogger(value);
- }
- };
- }
-
- private PropertyValueModel<String> buildDefaultLoggerHolder() {
- return new PropertyAspectAdapter<Logging, String>(this.getSubjectHolder(), Logging.DEFAULT_LOGGER) {
- @Override
- protected String buildValue_() {
- return LoggerComposite.this.getDefaultValue(this.subject);
- }
- };
- }
-
- private ListValueModel<String> buildDefaultLoggerListHolder() {
- return new PropertyListValueModelAdapter<String>(
- this.buildDefaultLoggerHolder()
- );
- }
-
- private String buildDisplayString(String loggerName) {
-
- switch (Logger.valueOf(loggerName)) {
- case default_logger: {
- return EclipseLinkUiMessages.LoggerComposite_default_logger;
- }
- case java_logger: {
- return EclipseLinkUiMessages.LoggerComposite_java_logger;
- }
- case server_logger: {
- return EclipseLinkUiMessages.LoggerComposite_server_logger;
- }
- default: {
- return null;
- }
- }
- }
-
- private Comparator<String> buildLoggerComparator() {
- return new Comparator<String>() {
- public int compare(String logger1, String logger2) {
- logger1 = buildDisplayString(logger1);
- logger2 = buildDisplayString(logger2);
- return Collator.getInstance().compare(logger1, logger2);
- }
- };
- }
-
- @Override
- protected StringConverter<String> buildClassConverter() {
- return new StringConverter<String>() {
- public String convertToString(String value) {
- try {
- Logger.valueOf(value);
- value = buildDisplayString(value);
- }
- catch (Exception e) {
- // Ignore since the value is not a Logger
- }
- return value;
- }
- };
- }
-
- @Override
- protected ListValueModel<String> buildClassListHolder() {
- ArrayList<ListValueModel<String>> holders = new ArrayList<ListValueModel<String>>(2);
- holders.add(this.buildDefaultLoggerListHolder());
- holders.add(this.buildLoggersListHolder());
- return new CompositeListValueModel<ListValueModel<String>, String>(holders);
- }
-
- private Iterator<String> buildLoggers() {
- return new TransformationIterator<Logger, String>(CollectionTools.iterator(Logger.values())) {
- @Override
- protected String transform(Logger next) {
- return next.name();
- }
- };
- }
-
- private CollectionValueModel<String> buildLoggersCollectionHolder() {
- return new SimpleCollectionValueModel<String>(
- CollectionTools.collection(this.buildLoggers())
- );
- }
-
- private ListValueModel<String> buildLoggersListHolder() {
- return new SortedListValueModelAdapter<String>(
- this.buildLoggersCollectionHolder(),
- this.buildLoggerComparator()
- );
- }
-
- private String getDefaultValue(Logging subject) {
- String defaultValue = subject.getDefaultLogger();
-
- if (defaultValue != null) {
- return NLS.bind(
- EclipseLinkUiMessages.PersistenceXmlLoggingTab_defaultWithOneParam,
- defaultValue
- );
- }
- return EclipseLinkUiMessages.PersistenceXmlLoggingTab_defaultEmpty;
- }
-
- @Override
- protected void setClassName(String className) {
- this.getSubject().setLogger(className);
- }
-} \ No newline at end of file
diff --git a/jpa/plugins/org.eclipse.jpt.eclipselink.ui/src/org/eclipse/jpt/eclipselink/ui/internal/persistence/logging/LoggingFileLocationComposite.java b/jpa/plugins/org.eclipse.jpt.eclipselink.ui/src/org/eclipse/jpt/eclipselink/ui/internal/persistence/logging/LoggingFileLocationComposite.java
deleted file mode 100644
index 1b926fbae0..0000000000
--- a/jpa/plugins/org.eclipse.jpt.eclipselink.ui/src/org/eclipse/jpt/eclipselink/ui/internal/persistence/logging/LoggingFileLocationComposite.java
+++ /dev/null
@@ -1,92 +0,0 @@
-/*******************************************************************************
-* Copyright (c) 2008 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.
-*
-* Contributors:
-* Oracle - initial API and implementation
-*******************************************************************************/
-package org.eclipse.jpt.eclipselink.ui.internal.persistence.logging;
-
-import org.eclipse.jpt.eclipselink.core.internal.context.persistence.logging.Logging;
-import org.eclipse.jpt.eclipselink.ui.internal.EclipseLinkUiMessages;
-import org.eclipse.jpt.ui.internal.widgets.FolderChooserPane;
-import org.eclipse.jpt.ui.internal.widgets.Pane;
-import org.eclipse.jpt.utility.internal.model.value.PropertyAspectAdapter;
-import org.eclipse.jpt.utility.model.value.WritablePropertyValueModel;
-import org.eclipse.osgi.util.NLS;
-import org.eclipse.swt.widgets.Composite;
-
-/**
- * LoggingFileLocationComposite
- */
-public class LoggingFileLocationComposite extends Pane<Logging>
-{
- public LoggingFileLocationComposite(Pane<? extends Logging> parentPane,
- Composite parent) {
-
- super(parentPane, parent);
- }
-
- @Override
- protected void initializeLayout(Composite container) {
-
- new FolderChooserPane<Logging>(this, container) {
-
- @Override
- protected WritablePropertyValueModel<String> buildTextHolder() {
- return new PropertyAspectAdapter<Logging, String>(
- getSubjectHolder(), Logging.LOG_FILE_LOCATION_PROPERTY) {
- @Override
- protected String buildValue_() {
-
- String name = subject.getLogFileLocation();
- if (name == null) {
- name = defaultValue(subject);
- }
- return name;
- }
-
- @Override
- protected void setValue_(String value) {
-
- if (defaultValue(subject).equals(value)) {
- value = null;
- }
- subject.setLogFileLocation(value);
- }
- };
- }
-
- private String defaultValue(Logging subject) {
- String defaultValue = subject.getDefaultLogFileLocation();
-
- if (defaultValue != null) {
- return NLS.bind(
- EclipseLinkUiMessages.PersistenceXmlLoggingTab_defaultWithOneParam,
- defaultValue
- );
- }
- else {
- return EclipseLinkUiMessages.PersistenceXmlLoggingTab_defaultEmpty;
- }
- }
-
- @Override
- protected String getDialogMessage() {
- return EclipseLinkUiMessages.LoggingFileLocationComposite_dialogMessage;
- }
-
- @Override
- protected String getDialogTitle() {
- return EclipseLinkUiMessages.LoggingFileLocationComposite_dialogTitle;
- }
-
- @Override
- protected String getLabelText() {
- return EclipseLinkUiMessages.PersistenceXmlLoggingTab_loggingFileLabel;
- }
- };
- }
-}
diff --git a/jpa/plugins/org.eclipse.jpt.eclipselink.ui/src/org/eclipse/jpt/eclipselink/ui/internal/persistence/logging/LoggingLevelComposite.java b/jpa/plugins/org.eclipse.jpt.eclipselink.ui/src/org/eclipse/jpt/eclipselink/ui/internal/persistence/logging/LoggingLevelComposite.java
deleted file mode 100644
index 3b8cc24ba0..0000000000
--- a/jpa/plugins/org.eclipse.jpt.eclipselink.ui/src/org/eclipse/jpt/eclipselink/ui/internal/persistence/logging/LoggingLevelComposite.java
+++ /dev/null
@@ -1,90 +0,0 @@
-/*******************************************************************************
- * Copyright (c) 2008, 2009 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.
- *
- * Contributors:
- * Oracle - initial API and implementation
- *******************************************************************************/
-package org.eclipse.jpt.eclipselink.ui.internal.persistence.logging;
-
-import java.util.Collection;
-import org.eclipse.jpt.eclipselink.core.internal.context.persistence.logging.Logging;
-import org.eclipse.jpt.eclipselink.core.internal.context.persistence.logging.LoggingLevel;
-import org.eclipse.jpt.eclipselink.ui.internal.EclipseLinkHelpContextIds;
-import org.eclipse.jpt.eclipselink.ui.internal.EclipseLinkUiMessages;
-import org.eclipse.jpt.ui.internal.widgets.EnumFormComboViewer;
-import org.eclipse.jpt.ui.internal.widgets.FormPane;
-import org.eclipse.swt.widgets.Composite;
-
-/**
- * LoggingLevelComposite
- */
-public class LoggingLevelComposite extends FormPane<Logging>
-{
- /**
- * Creates a new <code>LoggingLevelComposite</code>.
- *
- * @param parentController
- * The parent container of this one
- * @param parent
- * The parent container
- */
- public LoggingLevelComposite(
- FormPane<? extends Logging> parentComposite,
- Composite parent) {
-
- super(parentComposite, parent);
- }
-
- private EnumFormComboViewer<Logging, LoggingLevel> addLoggingLevelCombo(Composite container) {
- return new EnumFormComboViewer<Logging, LoggingLevel>(this, container) {
- @Override
- protected void addPropertyNames(Collection<String> propertyNames) {
- super.addPropertyNames(propertyNames);
- propertyNames.add(Logging.LEVEL_PROPERTY);
- }
-
- @Override
- protected LoggingLevel[] getChoices() {
- return LoggingLevel.values();
- }
-
- @Override
- protected boolean sortChoices() {
- return false;
- }
-
- @Override
- protected LoggingLevel getDefaultValue() {
- return this.getSubject().getDefaultLevel();
- }
-
- @Override
- protected String displayString(LoggingLevel value) {
- return this.buildDisplayString(EclipseLinkUiMessages.class, LoggingLevelComposite.this, value);
- }
-
- @Override
- protected LoggingLevel getValue() {
- return this.getSubject().getLevel();
- }
-
- @Override
- protected void setValue(LoggingLevel value) {
- this.getSubject().setLevel(value);
- }
- };
- }
-
- @Override
- protected void initializeLayout(Composite container) {
- this.addLabeledComposite(
- container,
- EclipseLinkUiMessages.PersistenceXmlLoggingTab_loggingLevelLabel,
- this.addLoggingLevelCombo(container),
- EclipseLinkHelpContextIds.PERSISTENCE_LOGGING_LEVEL
- );
- }
-}
diff --git a/jpa/plugins/org.eclipse.jpt.eclipselink.ui/src/org/eclipse/jpt/eclipselink/ui/internal/persistence/logging/PersistenceXmlLoggingTab.java b/jpa/plugins/org.eclipse.jpt.eclipselink.ui/src/org/eclipse/jpt/eclipselink/ui/internal/persistence/logging/PersistenceXmlLoggingTab.java
deleted file mode 100644
index 5b7319ac5b..0000000000
--- a/jpa/plugins/org.eclipse.jpt.eclipselink.ui/src/org/eclipse/jpt/eclipselink/ui/internal/persistence/logging/PersistenceXmlLoggingTab.java
+++ /dev/null
@@ -1,84 +0,0 @@
-/*******************************************************************************
- * Copyright (c) 2007, 2009 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.
- *
- * Contributors:
- * Oracle - initial API and implementation
- *******************************************************************************/
-package org.eclipse.jpt.eclipselink.ui.internal.persistence.logging;
-
-import org.eclipse.jpt.eclipselink.core.internal.context.persistence.logging.Logging;
-import org.eclipse.jpt.eclipselink.ui.internal.EclipseLinkHelpContextIds;
-import org.eclipse.jpt.eclipselink.ui.internal.EclipseLinkUiMessages;
-import org.eclipse.jpt.ui.WidgetFactory;
-import org.eclipse.jpt.ui.details.JpaPageComposite;
-import org.eclipse.jpt.ui.internal.widgets.FormPane;
-import org.eclipse.jpt.utility.model.value.PropertyValueModel;
-import org.eclipse.swt.SWT;
-import org.eclipse.swt.graphics.Image;
-import org.eclipse.swt.layout.GridData;
-import org.eclipse.swt.layout.GridLayout;
-import org.eclipse.swt.widgets.Composite;
-
-/**
- * PersistenceXmlLoggingTab
- */
-public class PersistenceXmlLoggingTab
- extends FormPane<Logging>
- implements JpaPageComposite
-{
- // ********** constructors/initialization **********
- public PersistenceXmlLoggingTab(
- PropertyValueModel<Logging> subjectHolder,
- Composite parent,
- WidgetFactory widgetFactory) {
-
- super(subjectHolder, parent, widgetFactory);
- }
-
- @Override
- protected void initializeLayout(Composite container) {
- new EclipseLinkLoggingComposite(this, container);
- }
-
- // ********** JpaPageComposite implementation **********
-
- public String getHelpID() {
- return EclipseLinkHelpContextIds.PERSISTENCE_LOGGING;
- }
-
- public Image getPageImage() {
- return null;
- }
-
- public String getPageText() {
- return EclipseLinkUiMessages.PersistenceXmlLoggingTab_title;
- }
-
- // ********** Layout **********
- @Override
- protected Composite addContainer(Composite parent) {
- GridLayout layout = new GridLayout(1, true);
- layout.marginHeight = 0;
- layout.marginWidth = 0;
- layout.marginTop = 0;
- layout.marginLeft = 0;
- layout.marginBottom = 0;
- layout.marginRight = 0;
- layout.verticalSpacing = 15;
- Composite container = this.addPane(parent, layout);
- this.updateGridData(container);
- return container;
- }
-
- private void updateGridData(Composite container) {
- GridData gridData = new GridData();
- gridData.grabExcessHorizontalSpace = true;
- gridData.grabExcessVerticalSpace = true;
- gridData.horizontalAlignment = SWT.FILL;
- gridData.verticalAlignment = SWT.FILL;
- container.setLayoutData(gridData);
- }
-}
diff --git a/jpa/plugins/org.eclipse.jpt.eclipselink.ui/src/org/eclipse/jpt/eclipselink/ui/internal/persistence/logging/SessionComposite.java b/jpa/plugins/org.eclipse.jpt.eclipselink.ui/src/org/eclipse/jpt/eclipselink/ui/internal/persistence/logging/SessionComposite.java
deleted file mode 100644
index a18c0f6919..0000000000
--- a/jpa/plugins/org.eclipse.jpt.eclipselink.ui/src/org/eclipse/jpt/eclipselink/ui/internal/persistence/logging/SessionComposite.java
+++ /dev/null
@@ -1,97 +0,0 @@
-/*******************************************************************************
- * Copyright (c) 2008, 2009 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.
- *
- * Contributors:
- * Oracle - initial API and implementation
- *******************************************************************************/
-package org.eclipse.jpt.eclipselink.ui.internal.persistence.logging;
-
-import org.eclipse.jpt.eclipselink.core.internal.context.persistence.logging.Logging;
-import org.eclipse.jpt.eclipselink.ui.internal.EclipseLinkHelpContextIds;
-import org.eclipse.jpt.eclipselink.ui.internal.EclipseLinkUiMessages;
-import org.eclipse.jpt.ui.internal.widgets.FormPane;
-import org.eclipse.jpt.utility.internal.model.value.PropertyAspectAdapter;
-import org.eclipse.jpt.utility.internal.model.value.TransformationPropertyValueModel;
-import org.eclipse.jpt.utility.model.value.PropertyValueModel;
-import org.eclipse.jpt.utility.model.value.WritablePropertyValueModel;
-import org.eclipse.osgi.util.NLS;
-import org.eclipse.swt.widgets.Composite;
-
-/**
- * SessionComposite
- */
-public class SessionComposite extends FormPane<Logging>
-{
- /**
- * Creates a new <code>SessionComposite</code>.
- *
- * @param parentController
- * The parent container of this one
- * @param parent
- * The parent container
- */
- public SessionComposite(
- FormPane<? extends Logging> parentComposite,
- Composite parent) {
-
- super(parentComposite, parent);
- }
-
- @Override
- protected void initializeLayout(Composite container) {
-
- this.addTriStateCheckBoxWithDefault(
- container,
- EclipseLinkUiMessages.PersistenceXmlLoggingTab_sessionLabel,
- this.buildSessionHolder(),
- this.buildSessionStringHolder(),
- EclipseLinkHelpContextIds.PERSISTENCE_LOGGING_SESSION
- );
- }
-
- private WritablePropertyValueModel<Boolean> buildSessionHolder() {
- return new PropertyAspectAdapter<Logging, Boolean>(getSubjectHolder(), Logging.SESSION_PROPERTY) {
- @Override
- protected Boolean buildValue_() {
- return this.subject.getSession();
- }
-
- @Override
- protected void setValue_(Boolean value) {
- this.subject.setSession(value);
- }
- };
- }
-
- private PropertyValueModel<String> buildSessionStringHolder() {
- return new TransformationPropertyValueModel<Boolean, String>(buildDefaultSessionHolder()) {
- @Override
- protected String transform(Boolean value) {
- if (value != null) {
- String defaultStringValue = value.booleanValue() ? EclipseLinkUiMessages.Boolean_True : EclipseLinkUiMessages.Boolean_False;
- return NLS.bind(EclipseLinkUiMessages.PersistenceXmlLoggingTab_sessionLabelDefault, defaultStringValue);
- }
- return EclipseLinkUiMessages.PersistenceXmlLoggingTab_sessionLabel;
- }
- };
- }
-
- private PropertyValueModel<Boolean> buildDefaultSessionHolder() {
- return new PropertyAspectAdapter<Logging, Boolean>(
- getSubjectHolder(),
- Logging.SESSION_PROPERTY)
- {
- @Override
- protected Boolean buildValue_() {
- if (this.subject.getSession() != null) {
- return null;
- }
- return this.subject.getDefaultSession();
- }
- };
- }
-
-}
diff --git a/jpa/plugins/org.eclipse.jpt.eclipselink.ui/src/org/eclipse/jpt/eclipselink/ui/internal/persistence/logging/ThreadComposite.java b/jpa/plugins/org.eclipse.jpt.eclipselink.ui/src/org/eclipse/jpt/eclipselink/ui/internal/persistence/logging/ThreadComposite.java
deleted file mode 100644
index b690382a5e..0000000000
--- a/jpa/plugins/org.eclipse.jpt.eclipselink.ui/src/org/eclipse/jpt/eclipselink/ui/internal/persistence/logging/ThreadComposite.java
+++ /dev/null
@@ -1,96 +0,0 @@
-/*******************************************************************************
- * Copyright (c) 2008, 2009 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.
- *
- * Contributors:
- * Oracle - initial API and implementation
- *******************************************************************************/
-package org.eclipse.jpt.eclipselink.ui.internal.persistence.logging;
-
-import org.eclipse.jpt.eclipselink.core.internal.context.persistence.logging.Logging;
-import org.eclipse.jpt.eclipselink.ui.internal.EclipseLinkHelpContextIds;
-import org.eclipse.jpt.eclipselink.ui.internal.EclipseLinkUiMessages;
-import org.eclipse.jpt.ui.internal.widgets.FormPane;
-import org.eclipse.jpt.utility.internal.model.value.PropertyAspectAdapter;
-import org.eclipse.jpt.utility.internal.model.value.TransformationPropertyValueModel;
-import org.eclipse.jpt.utility.model.value.PropertyValueModel;
-import org.eclipse.jpt.utility.model.value.WritablePropertyValueModel;
-import org.eclipse.osgi.util.NLS;
-import org.eclipse.swt.widgets.Composite;
-
-/**
- * ThreadComposite
- */
-public class ThreadComposite extends FormPane<Logging>
-{
- /**
- * Creates a new <code>ThreadComposite</code>.
- *
- * @param parentController
- * The parent container of this one
- * @param parent
- * The parent container
- */
- public ThreadComposite(
- FormPane<? extends Logging> parentComposite,
- Composite parent) {
-
- super(parentComposite, parent);
- }
-
- @Override
- protected void initializeLayout(Composite container) {
-
- this.addTriStateCheckBoxWithDefault(
- container,
- EclipseLinkUiMessages.PersistenceXmlLoggingTab_threadLabel,
- this.buildThreadHolder(),
- this.buildThreadStringHolder(),
- EclipseLinkHelpContextIds.PERSISTENCE_LOGGING_THREAD
- );
- }
-
- private WritablePropertyValueModel<Boolean> buildThreadHolder() {
- return new PropertyAspectAdapter<Logging, Boolean>(getSubjectHolder(), Logging.THREAD_PROPERTY) {
- @Override
- protected Boolean buildValue_() {
- return this.subject.getThread();
- }
-
- @Override
- protected void setValue_(Boolean value) {
- this.subject.setThread(value);
- }
- };
- }
-
- private PropertyValueModel<String> buildThreadStringHolder() {
- return new TransformationPropertyValueModel<Boolean, String>(buildDefaultThreadHolder()) {
- @Override
- protected String transform(Boolean value) {
- if (value != null) {
- String defaultStringValue = value.booleanValue() ? EclipseLinkUiMessages.Boolean_True : EclipseLinkUiMessages.Boolean_False;
- return NLS.bind(EclipseLinkUiMessages.PersistenceXmlLoggingTab_threadLabelDefault, defaultStringValue);
- }
- return EclipseLinkUiMessages.PersistenceXmlLoggingTab_threadLabel;
- }
- };
- }
-
- private PropertyValueModel<Boolean> buildDefaultThreadHolder() {
- return new PropertyAspectAdapter<Logging, Boolean>(
- getSubjectHolder(),
- Logging.THREAD_PROPERTY)
- {
- @Override
- protected Boolean buildValue_() {
- if (this.subject.getThread() != null) {
- return null;
- }
- return this.subject.getDefaultThread();
- }
- };
- }
-}
diff --git a/jpa/plugins/org.eclipse.jpt.eclipselink.ui/src/org/eclipse/jpt/eclipselink/ui/internal/persistence/logging/TimestampComposite.java b/jpa/plugins/org.eclipse.jpt.eclipselink.ui/src/org/eclipse/jpt/eclipselink/ui/internal/persistence/logging/TimestampComposite.java
deleted file mode 100644
index 2d344344fe..0000000000
--- a/jpa/plugins/org.eclipse.jpt.eclipselink.ui/src/org/eclipse/jpt/eclipselink/ui/internal/persistence/logging/TimestampComposite.java
+++ /dev/null
@@ -1,95 +0,0 @@
-/*******************************************************************************
- * Copyright (c) 2008, 2009 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.
- *
- * Contributors:
- * Oracle - initial API and implementation
- *******************************************************************************/
-package org.eclipse.jpt.eclipselink.ui.internal.persistence.logging;
-
-import org.eclipse.jpt.eclipselink.core.internal.context.persistence.logging.Logging;
-import org.eclipse.jpt.eclipselink.ui.internal.EclipseLinkHelpContextIds;
-import org.eclipse.jpt.eclipselink.ui.internal.EclipseLinkUiMessages;
-import org.eclipse.jpt.ui.internal.widgets.FormPane;
-import org.eclipse.jpt.utility.internal.model.value.PropertyAspectAdapter;
-import org.eclipse.jpt.utility.internal.model.value.TransformationPropertyValueModel;
-import org.eclipse.jpt.utility.model.value.PropertyValueModel;
-import org.eclipse.jpt.utility.model.value.WritablePropertyValueModel;
-import org.eclipse.osgi.util.NLS;
-import org.eclipse.swt.widgets.Composite;
-
-/**
- * TimestampComposite
- */
-public class TimestampComposite extends FormPane<Logging>
-{
- /**
- * Creates a new <code>TimestampComposite</code>.
- *
- * @param parentController
- * The parent container of this one
- * @param parent
- * The parent container
- */
- public TimestampComposite(
- FormPane<? extends Logging> parentComposite,
- Composite parent) {
-
- super(parentComposite, parent);
- }
-
- @Override
- protected void initializeLayout(Composite container) {
-
- this.addTriStateCheckBoxWithDefault(
- container,
- EclipseLinkUiMessages.PersistenceXmlLoggingTab_timestampLabel,
- this.buildTimestampHolder(),
- this.buildTimestampStringHolder(),
- EclipseLinkHelpContextIds.PERSISTENCE_LOGGING_TIMESTAMP
- );
- }
-
- private WritablePropertyValueModel<Boolean> buildTimestampHolder() {
- return new PropertyAspectAdapter<Logging, Boolean>(getSubjectHolder(), Logging.TIMESTAMP_PROPERTY) {
- @Override
- protected Boolean buildValue_() {
- return this.subject.getTimestamp();
- }
-
- @Override
- protected void setValue_(Boolean value) {
- this.subject.setTimestamp(value);
- }
- };
- }
-
- private PropertyValueModel<String> buildTimestampStringHolder() {
- return new TransformationPropertyValueModel<Boolean, String>(buildDefaultTimestampHolder()) {
- @Override
- protected String transform(Boolean value) {
- if (value != null) {
- String defaultStringValue = value.booleanValue() ? EclipseLinkUiMessages.Boolean_True : EclipseLinkUiMessages.Boolean_False;
- return NLS.bind(EclipseLinkUiMessages.PersistenceXmlLoggingTab_timestampLabelDefault, defaultStringValue);
- }
- return EclipseLinkUiMessages.PersistenceXmlLoggingTab_timestampLabel;
- }
- };
- }
- private PropertyValueModel<Boolean> buildDefaultTimestampHolder() {
- return new PropertyAspectAdapter<Logging, Boolean>(
- getSubjectHolder(),
- Logging.TIMESTAMP_PROPERTY)
- {
- @Override
- protected Boolean buildValue_() {
- if (this.subject.getTimestamp() != null) {
- return null;
- }
- return this.subject.getDefaultTimestamp();
- }
- };
- }
-}
diff --git a/jpa/plugins/org.eclipse.jpt.eclipselink.ui/src/org/eclipse/jpt/eclipselink/ui/internal/persistence/options/EclipseLinkOptionsComposite.java b/jpa/plugins/org.eclipse.jpt.eclipselink.ui/src/org/eclipse/jpt/eclipselink/ui/internal/persistence/options/EclipseLinkOptionsComposite.java
deleted file mode 100644
index fed02d88cb..0000000000
--- a/jpa/plugins/org.eclipse.jpt.eclipselink.ui/src/org/eclipse/jpt/eclipselink/ui/internal/persistence/options/EclipseLinkOptionsComposite.java
+++ /dev/null
@@ -1,83 +0,0 @@
-/*******************************************************************************
- * Copyright (c) 2008 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.
- *
- * Contributors:
- * Oracle - initial API and implementation
- *******************************************************************************/
-package org.eclipse.jpt.eclipselink.ui.internal.persistence.options;
-
-import org.eclipse.jpt.eclipselink.core.internal.context.persistence.options.Options;
-import org.eclipse.jpt.eclipselink.ui.internal.EclipseLinkUiMessages;
-import org.eclipse.jpt.ui.internal.widgets.FormPane;
-import org.eclipse.swt.SWT;
-import org.eclipse.swt.layout.GridData;
-import org.eclipse.swt.widgets.Composite;
-
-/**
- * EclipseLinkOptionsComposite
- */
-public class EclipseLinkOptionsComposite
- extends FormPane<Options>
-{
- public EclipseLinkOptionsComposite(
- FormPane<Options> subjectHolder,
- Composite container) {
- super(subjectHolder, container, false);
- }
-
- @Override
- protected void initializeLayout(Composite parent) {
- this.initializeSessionOptionsPane(parent);
- this.initializeMiscellaneousPane(parent);
- }
-
- private void initializeSessionOptionsPane(Composite parent) {
- Composite composite = this.addSection(parent,
- EclipseLinkUiMessages.PersistenceXmlOptionsTab_sessionSectionTitle,
- EclipseLinkUiMessages.PersistenceXmlOptionsTab_sessionSectionDescription);
-
- this.updateGridData(composite);
- this.updateGridData(composite.getParent());
-
- new SessionNameComposite(this, composite);
-
- new SessionsXmlComposite(this, composite);
-
- new TargetDatabaseComposite(this, composite);
-
- new TargetServerComposite(this, composite);
-
- new EventListenerComposite(this, composite);
-
- new IncludeDescriptorQueriesComposite(this, composite);
-
- return;
- }
-
- private void initializeMiscellaneousPane(Composite container) {
-
- this.updateGridData(container);
- this.updateGridData(container.getParent());
-
- Composite composite = this.addSection(container,
- EclipseLinkUiMessages.PersistenceXmlOptionsTab_miscellaneousSectionTitle,
- EclipseLinkUiMessages.PersistenceXmlOptionsTab_miscellaneousSectionDescription);
-
- this.updateGridData(composite);
- this.updateGridData(composite.getParent());
-
- new TemporalMutableComposite(this, composite);
- }
-
- private void updateGridData(Composite container) {
- GridData gridData = new GridData();
- gridData.grabExcessHorizontalSpace = true;
- gridData.grabExcessVerticalSpace = true;
- gridData.horizontalAlignment = SWT.FILL;
- gridData.verticalAlignment = SWT.FILL;
- container.setLayoutData(gridData);
- }
-}
diff --git a/jpa/plugins/org.eclipse.jpt.eclipselink.ui/src/org/eclipse/jpt/eclipselink/ui/internal/persistence/options/EventListenerComposite.java b/jpa/plugins/org.eclipse.jpt.eclipselink.ui/src/org/eclipse/jpt/eclipselink/ui/internal/persistence/options/EventListenerComposite.java
deleted file mode 100644
index 748dce776d..0000000000
--- a/jpa/plugins/org.eclipse.jpt.eclipselink.ui/src/org/eclipse/jpt/eclipselink/ui/internal/persistence/options/EventListenerComposite.java
+++ /dev/null
@@ -1,93 +0,0 @@
-/*******************************************************************************
-* Copyright (c) 2008 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.
-*
-* Contributors:
-* Oracle - initial API and implementation
-*******************************************************************************/
-package org.eclipse.jpt.eclipselink.ui.internal.persistence.options;
-
-import org.eclipse.jpt.core.JpaProject;
-import org.eclipse.jpt.eclipselink.core.internal.context.persistence.options.Options;
-import org.eclipse.jpt.eclipselink.ui.internal.EclipseLinkUiMessages;
-import org.eclipse.jpt.ui.internal.widgets.ClassChooserPane;
-import org.eclipse.jpt.ui.internal.widgets.Pane;
-import org.eclipse.jpt.utility.internal.model.value.PropertyAspectAdapter;
-import org.eclipse.jpt.utility.model.value.WritablePropertyValueModel;
-import org.eclipse.swt.widgets.Composite;
-
-/**
- * EventListenerComposite
- */
-public class EventListenerComposite extends Pane<Options>
-{
- /**
- * Creates a new <code>EventListenerComposite</code>.
- *
- * @param parentPane The parent pane of this one
- * @param parent The parent container
- */
- public EventListenerComposite(Pane<? extends Options> parentPane,
- Composite parent) {
-
- super(parentPane, parent);
- }
-
- private ClassChooserPane<Options> initializeClassChooser(Composite container) {
-
- return new ClassChooserPane<Options>(this, container) {
-
- @Override
- protected WritablePropertyValueModel<String> buildTextHolder() {
- return new PropertyAspectAdapter<Options, String>(
- this.getSubjectHolder(), Options.SESSION_EVENT_LISTENER_PROPERTY) {
- @Override
- protected String buildValue_() {
- return this.subject.getEventListener();
- }
-
- @Override
- protected void setValue_(String value) {
-
- if (value.length() == 0) {
- value = null;
- }
- this.subject.setEventListener(value);
- }
- };
- }
-
- @Override
- protected String getClassName() {
- return this.getSubject().getEventListener();
- }
-
- @Override
- protected String getLabelText() {
- return EclipseLinkUiMessages.PersistenceXmlOptionsTab_eventListenerLabel;
- }
-
- @Override
- protected JpaProject getJpaProject() {
- return getSubject().getJpaProject();
- }
-
- @Override
- protected void setClassName(String className) {
- this.getSubject().setEventListener(className);
- }
-
- @Override
- protected String getSuperInterfaceName() {
- return Options.ECLIPSELINK_EVENT_LISTENER_CLASS_NAME;
- }
- };
- }
-
- @Override
- protected void initializeLayout(Composite container) {
- this.initializeClassChooser(container);
- }
-}
diff --git a/jpa/plugins/org.eclipse.jpt.eclipselink.ui/src/org/eclipse/jpt/eclipselink/ui/internal/persistence/options/IncludeDescriptorQueriesComposite.java b/jpa/plugins/org.eclipse.jpt.eclipselink.ui/src/org/eclipse/jpt/eclipselink/ui/internal/persistence/options/IncludeDescriptorQueriesComposite.java
deleted file mode 100644
index 09fa3bb8fb..0000000000
--- a/jpa/plugins/org.eclipse.jpt.eclipselink.ui/src/org/eclipse/jpt/eclipselink/ui/internal/persistence/options/IncludeDescriptorQueriesComposite.java
+++ /dev/null
@@ -1,96 +0,0 @@
-/*******************************************************************************
- * Copyright (c) 2008, 2009 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.
- *
- * Contributors:
- * Oracle - initial API and implementation
- *******************************************************************************/
-package org.eclipse.jpt.eclipselink.ui.internal.persistence.options;
-
-import org.eclipse.jpt.eclipselink.core.internal.context.persistence.options.Options;
-import org.eclipse.jpt.eclipselink.ui.internal.EclipseLinkHelpContextIds;
-import org.eclipse.jpt.eclipselink.ui.internal.EclipseLinkUiMessages;
-import org.eclipse.jpt.ui.internal.widgets.FormPane;
-import org.eclipse.jpt.utility.internal.model.value.PropertyAspectAdapter;
-import org.eclipse.jpt.utility.internal.model.value.TransformationPropertyValueModel;
-import org.eclipse.jpt.utility.model.value.PropertyValueModel;
-import org.eclipse.jpt.utility.model.value.WritablePropertyValueModel;
-import org.eclipse.osgi.util.NLS;
-import org.eclipse.swt.widgets.Composite;
-
-/**
- * IncludeDescriptorQueriesComposite
- */
-public class IncludeDescriptorQueriesComposite extends FormPane<Options>
-{
- /**
- * Creates a new <code>IncludeDescriptorQueriesComposite</code>.
- *
- * @param parentController
- * The parent container of this one
- * @param parent
- * The parent container
- */
- public IncludeDescriptorQueriesComposite(
- FormPane<? extends Options> parentComposite,
- Composite parent) {
-
- super(parentComposite, parent);
- }
-
- @Override
- protected void initializeLayout(Composite container) {
-
- this.addTriStateCheckBoxWithDefault(
- container,
- EclipseLinkUiMessages.PersistenceXmlOptionsTab_includeDescriptorQueriesLabel,
- this.buildIncludeDescriptorQueriesHolder(),
- this.buildIncludeDescriptorQueriesStringHolder(),
- EclipseLinkHelpContextIds.PERSISTENCE_OPTIONS
- );
- }
-
- private WritablePropertyValueModel<Boolean> buildIncludeDescriptorQueriesHolder() {
- return new PropertyAspectAdapter<Options, Boolean>(getSubjectHolder(), Options.SESSION_INCLUDE_DESCRIPTOR_QUERIES_PROPERTY) {
- @Override
- protected Boolean buildValue_() {
- return this.subject.getIncludeDescriptorQueries();
- }
-
- @Override
- protected void setValue_(Boolean value) {
- this.subject.setIncludeDescriptorQueries(value);
- }
- };
- }
-
- private PropertyValueModel<String> buildIncludeDescriptorQueriesStringHolder() {
- return new TransformationPropertyValueModel<Boolean, String>(buildDefaultIncludeDescriptorQueriesHolder()) {
- @Override
- protected String transform(Boolean value) {
- if (value != null) {
- String defaultStringValue = value.booleanValue() ? EclipseLinkUiMessages.Boolean_True : EclipseLinkUiMessages.Boolean_False;
- return NLS.bind(EclipseLinkUiMessages.PersistenceXmlOptionsTab_includeDescriptorQueriesLabelDefault, defaultStringValue);
- }
- return EclipseLinkUiMessages.PersistenceXmlOptionsTab_includeDescriptorQueriesLabel;
- }
- };
- }
-
- private PropertyValueModel<Boolean> buildDefaultIncludeDescriptorQueriesHolder() {
- return new PropertyAspectAdapter<Options, Boolean>(
- getSubjectHolder(),
- Options.SESSION_INCLUDE_DESCRIPTOR_QUERIES_PROPERTY)
- {
- @Override
- protected Boolean buildValue_() {
- if (this.subject.getIncludeDescriptorQueries() != null) {
- return null;
- }
- return this.subject.getDefaultIncludeDescriptorQueries();
- }
- };
- }
-}
diff --git a/jpa/plugins/org.eclipse.jpt.eclipselink.ui/src/org/eclipse/jpt/eclipselink/ui/internal/persistence/options/PersistenceXmlOptionsTab.java b/jpa/plugins/org.eclipse.jpt.eclipselink.ui/src/org/eclipse/jpt/eclipselink/ui/internal/persistence/options/PersistenceXmlOptionsTab.java
deleted file mode 100644
index ee9eedc904..0000000000
--- a/jpa/plugins/org.eclipse.jpt.eclipselink.ui/src/org/eclipse/jpt/eclipselink/ui/internal/persistence/options/PersistenceXmlOptionsTab.java
+++ /dev/null
@@ -1,84 +0,0 @@
-/*******************************************************************************
- * Copyright (c) 2007, 2009 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.
- *
- * Contributors:
- * Oracle - initial API and implementation
- *******************************************************************************/
-package org.eclipse.jpt.eclipselink.ui.internal.persistence.options;
-
-import org.eclipse.jpt.eclipselink.core.internal.context.persistence.options.Options;
-import org.eclipse.jpt.eclipselink.ui.internal.EclipseLinkHelpContextIds;
-import org.eclipse.jpt.eclipselink.ui.internal.EclipseLinkUiMessages;
-import org.eclipse.jpt.ui.WidgetFactory;
-import org.eclipse.jpt.ui.details.JpaPageComposite;
-import org.eclipse.jpt.ui.internal.widgets.FormPane;
-import org.eclipse.jpt.utility.model.value.PropertyValueModel;
-import org.eclipse.swt.SWT;
-import org.eclipse.swt.graphics.Image;
-import org.eclipse.swt.layout.GridData;
-import org.eclipse.swt.layout.GridLayout;
-import org.eclipse.swt.widgets.Composite;
-
-/**
- * PersistenceXmlOptionsTab
- */
-public class PersistenceXmlOptionsTab
- extends FormPane<Options>
- implements JpaPageComposite
-{
- // ********** constructors/initialization **********
- public PersistenceXmlOptionsTab(
- PropertyValueModel<Options> subjectHolder,
- Composite parent,
- WidgetFactory widgetFactory) {
-
- super(subjectHolder, parent, widgetFactory);
- }
-
- @Override
- protected void initializeLayout(Composite container) {
- new EclipseLinkOptionsComposite(this, container);
- }
-
- // ********** JpaPageComposite implementation **********
-
- public String getHelpID() {
- return EclipseLinkHelpContextIds.PERSISTENCE_OPTIONS;
- }
-
- public Image getPageImage() {
- return null;
- }
-
- public String getPageText() {
- return EclipseLinkUiMessages.PersistenceXmlOptionsTab_title;
- }
-
- // ********** Layout **********
- @Override
- protected Composite addContainer(Composite parent) {
- GridLayout layout = new GridLayout(1, true);
- layout.marginHeight = 0;
- layout.marginWidth = 0;
- layout.marginTop = 0;
- layout.marginLeft = 0;
- layout.marginBottom = 0;
- layout.marginRight = 0;
- layout.verticalSpacing = 15;
- Composite container = this.addPane(parent, layout);
- this.updateGridData(container);
- return container;
- }
-
- private void updateGridData(Composite container) {
- GridData gridData = new GridData();
- gridData.grabExcessHorizontalSpace = true;
- gridData.grabExcessVerticalSpace = true;
- gridData.horizontalAlignment = SWT.FILL;
- gridData.verticalAlignment = SWT.FILL;
- container.setLayoutData(gridData);
- }
-}
diff --git a/jpa/plugins/org.eclipse.jpt.eclipselink.ui/src/org/eclipse/jpt/eclipselink/ui/internal/persistence/options/SessionNameComposite.java b/jpa/plugins/org.eclipse.jpt.eclipselink.ui/src/org/eclipse/jpt/eclipselink/ui/internal/persistence/options/SessionNameComposite.java
deleted file mode 100644
index 5526d5bdd9..0000000000
--- a/jpa/plugins/org.eclipse.jpt.eclipselink.ui/src/org/eclipse/jpt/eclipselink/ui/internal/persistence/options/SessionNameComposite.java
+++ /dev/null
@@ -1,111 +0,0 @@
-/*******************************************************************************
-* Copyright (c) 2008, 2009 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.
-*
-* Contributors:
-* Oracle - initial API and implementation
-*******************************************************************************/
-package org.eclipse.jpt.eclipselink.ui.internal.persistence.options;
-
-import org.eclipse.jpt.eclipselink.core.internal.context.persistence.options.Options;
-import org.eclipse.jpt.eclipselink.ui.internal.EclipseLinkHelpContextIds;
-import org.eclipse.jpt.eclipselink.ui.internal.EclipseLinkUiMessages;
-import org.eclipse.jpt.ui.internal.util.SWTUtil;
-import org.eclipse.jpt.ui.internal.widgets.Pane;
-import org.eclipse.jpt.utility.internal.model.value.PropertyAspectAdapter;
-import org.eclipse.jpt.utility.internal.model.value.PropertyListValueModelAdapter;
-import org.eclipse.jpt.utility.model.value.ListValueModel;
-import org.eclipse.jpt.utility.model.value.PropertyValueModel;
-import org.eclipse.jpt.utility.model.value.WritablePropertyValueModel;
-import org.eclipse.osgi.util.NLS;
-import org.eclipse.swt.custom.CCombo;
-import org.eclipse.swt.widgets.Composite;
-
-/**
- * SessionNameComposite
- */
-public class SessionNameComposite extends Pane<Options>
-{
- /**
- * Creates a new <code>SessionNameComposite</code>.
- *
- * @param parentPane The parent container of this one
- * @param parent The parent container
- */
- public SessionNameComposite(
- Pane<? extends Options> parentPane,
- Composite parent) {
-
- super(parentPane, parent);
- }
-
- private PropertyValueModel<String> buildDefaultSessionNameHolder() {
- return new PropertyAspectAdapter<Options, String>(this.getSubjectHolder(), Options.DEFAULT_SESSION_NAME) {
- @Override
- protected String buildValue_() {
- return SessionNameComposite.this.getDefaultValue(subject);
- }
- };
- }
-
- private ListValueModel<String> buildDefaultSessionNameListHolder() {
- return new PropertyListValueModelAdapter<String>(
- this.buildDefaultSessionNameHolder()
- );
- }
-
- private WritablePropertyValueModel<String> buildSessionNameHolder() {
- return new PropertyAspectAdapter<Options, String>(this.getSubjectHolder(), Options.SESSION_NAME_PROPERTY) {
- @Override
- protected String buildValue_() {
-
- String name = subject.getSessionName();
- if (name == null) {
- name = SessionNameComposite.this.getDefaultValue(subject);
- }
- return name;
- }
-
- @Override
- protected void setValue_(String value) {
-
- if (getDefaultValue(subject).equals(value)) {
- value = null;
- }
- subject.setSessionName(value);
- }
- };
- }
-
- private String getDefaultValue(Options subject) {
- String defaultValue = subject.getDefaultSessionName();
-
- if (defaultValue != null) {
- return NLS.bind(
- EclipseLinkUiMessages.PersistenceXmlOptionsTab_defaultWithOneParam,
- defaultValue
- );
- }
- else {
- return EclipseLinkUiMessages.PersistenceXmlOptionsTab_defaultEmpty;
- }
- }
-
- /*
- * (non-Javadoc)
- */
- @Override
- protected void initializeLayout(Composite container) {
-
- CCombo combo = addLabeledEditableCCombo(
- container,
- EclipseLinkUiMessages.PersistenceXmlOptionsTab_sessionName,
- this.buildDefaultSessionNameListHolder(),
- this.buildSessionNameHolder(),
- EclipseLinkHelpContextIds.PERSISTENCE_OPTIONS_SESSION_NAME
- );
- SWTUtil.attachDefaultValueHandler(combo);
- }
-}
diff --git a/jpa/plugins/org.eclipse.jpt.eclipselink.ui/src/org/eclipse/jpt/eclipselink/ui/internal/persistence/options/SessionsXmlComposite.java b/jpa/plugins/org.eclipse.jpt.eclipselink.ui/src/org/eclipse/jpt/eclipselink/ui/internal/persistence/options/SessionsXmlComposite.java
deleted file mode 100644
index 4413082942..0000000000
--- a/jpa/plugins/org.eclipse.jpt.eclipselink.ui/src/org/eclipse/jpt/eclipselink/ui/internal/persistence/options/SessionsXmlComposite.java
+++ /dev/null
@@ -1,111 +0,0 @@
-/*******************************************************************************
-* Copyright (c) 2008, 2009 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.
-*
-* Contributors:
-* Oracle - initial API and implementation
-*******************************************************************************/
-package org.eclipse.jpt.eclipselink.ui.internal.persistence.options;
-
-import org.eclipse.jpt.eclipselink.core.internal.context.persistence.options.Options;
-import org.eclipse.jpt.eclipselink.ui.internal.EclipseLinkHelpContextIds;
-import org.eclipse.jpt.eclipselink.ui.internal.EclipseLinkUiMessages;
-import org.eclipse.jpt.ui.internal.util.SWTUtil;
-import org.eclipse.jpt.ui.internal.widgets.Pane;
-import org.eclipse.jpt.utility.internal.model.value.PropertyAspectAdapter;
-import org.eclipse.jpt.utility.internal.model.value.PropertyListValueModelAdapter;
-import org.eclipse.jpt.utility.model.value.ListValueModel;
-import org.eclipse.jpt.utility.model.value.PropertyValueModel;
-import org.eclipse.jpt.utility.model.value.WritablePropertyValueModel;
-import org.eclipse.osgi.util.NLS;
-import org.eclipse.swt.custom.CCombo;
-import org.eclipse.swt.widgets.Composite;
-
-/**
- * SessionsXmlComposite
- */
-public class SessionsXmlComposite extends Pane<Options>
-{
- /**
- * Creates a new <code>SessionsXmlComposite</code>.
- *
- * @param parentPane The parent container of this one
- * @param parent The parent container
- */
- public SessionsXmlComposite(
- Pane<? extends Options> parentPane,
- Composite parent) {
-
- super(parentPane, parent);
- }
-
- private PropertyValueModel<String> buildDefaultSessionsXmlFileNameHolder() {
- return new PropertyAspectAdapter<Options, String>(this.getSubjectHolder(), Options.DEFAULT_SESSIONS_XML) {
- @Override
- protected String buildValue_() {
- return SessionsXmlComposite.this.getDefaultValue(subject);
- }
- };
- }
-
- private ListValueModel<String> buildDefaultSessionsXmlFileNameListHolder() {
- return new PropertyListValueModelAdapter<String>(
- this.buildDefaultSessionsXmlFileNameHolder()
- );
- }
-
- private WritablePropertyValueModel<String> buildSessionsXmlFileNameHolder() {
- return new PropertyAspectAdapter<Options, String>(this.getSubjectHolder(), Options.SESSIONS_XML_PROPERTY) {
- @Override
- protected String buildValue_() {
-
- String name = subject.getSessionsXml();
- if (name == null) {
- name = SessionsXmlComposite.this.getDefaultValue(subject);
- }
- return name;
- }
-
- @Override
- protected void setValue_(String value) {
-
- if (getDefaultValue(subject).equals(value)) {
- value = null;
- }
- subject.setSessionsXml(value);
- }
- };
- }
-
- private String getDefaultValue(Options subject) {
- String defaultValue = subject.getDefaultSessionsXml();
-
- if (defaultValue != null) {
- return NLS.bind(
- EclipseLinkUiMessages.PersistenceXmlOptionsTab_defaultWithOneParam,
- defaultValue
- );
- }
- else {
- return EclipseLinkUiMessages.PersistenceXmlOptionsTab_defaultEmpty;
- }
- }
-
- /*
- * (non-Javadoc)
- */
- @Override
- protected void initializeLayout(Composite container) {
-
- CCombo combo = addLabeledEditableCCombo(
- container,
- EclipseLinkUiMessages.PersistenceXmlOptionsTab_sessionsXml,
- this.buildDefaultSessionsXmlFileNameListHolder(),
- this.buildSessionsXmlFileNameHolder(),
- EclipseLinkHelpContextIds.PERSISTENCE_OPTIONS_SESSIONS_XML
- );
- SWTUtil.attachDefaultValueHandler(combo);
- }
-}
diff --git a/jpa/plugins/org.eclipse.jpt.eclipselink.ui/src/org/eclipse/jpt/eclipselink/ui/internal/persistence/options/TargetDatabaseComposite.java b/jpa/plugins/org.eclipse.jpt.eclipselink.ui/src/org/eclipse/jpt/eclipselink/ui/internal/persistence/options/TargetDatabaseComposite.java
deleted file mode 100644
index 231615a8c0..0000000000
--- a/jpa/plugins/org.eclipse.jpt.eclipselink.ui/src/org/eclipse/jpt/eclipselink/ui/internal/persistence/options/TargetDatabaseComposite.java
+++ /dev/null
@@ -1,187 +0,0 @@
-/*******************************************************************************
- * Copyright (c) 2008, 2009 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.
- *
- * Contributors:
- * Oracle - initial API and implementation
- *******************************************************************************/
-package org.eclipse.jpt.eclipselink.ui.internal.persistence.options;
-
-import com.ibm.icu.text.Collator;
-import java.util.ArrayList;
-import java.util.Comparator;
-import java.util.Iterator;
-import org.eclipse.jpt.eclipselink.core.internal.context.persistence.options.Options;
-import org.eclipse.jpt.eclipselink.core.internal.context.persistence.options.TargetDatabase;
-import org.eclipse.jpt.eclipselink.ui.internal.EclipseLinkHelpContextIds;
-import org.eclipse.jpt.eclipselink.ui.internal.EclipseLinkUiMessages;
-import org.eclipse.jpt.ui.internal.util.SWTUtil;
-import org.eclipse.jpt.ui.internal.widgets.Pane;
-import org.eclipse.jpt.utility.internal.CollectionTools;
-import org.eclipse.jpt.utility.internal.StringConverter;
-import org.eclipse.jpt.utility.internal.iterators.TransformationIterator;
-import org.eclipse.jpt.utility.internal.model.value.CompositeListValueModel;
-import org.eclipse.jpt.utility.internal.model.value.PropertyAspectAdapter;
-import org.eclipse.jpt.utility.internal.model.value.PropertyListValueModelAdapter;
-import org.eclipse.jpt.utility.internal.model.value.SimpleCollectionValueModel;
-import org.eclipse.jpt.utility.internal.model.value.SortedListValueModelAdapter;
-import org.eclipse.jpt.utility.model.value.CollectionValueModel;
-import org.eclipse.jpt.utility.model.value.ListValueModel;
-import org.eclipse.jpt.utility.model.value.PropertyValueModel;
-import org.eclipse.jpt.utility.model.value.WritablePropertyValueModel;
-import org.eclipse.osgi.util.NLS;
-import org.eclipse.swt.custom.CCombo;
-import org.eclipse.swt.widgets.Composite;
-
-/**
- * TargetDatabaseComposite
- */
-public class TargetDatabaseComposite extends Pane<Options>
-{
- /**
- * Creates a new <code>TargetDatabaseComposite</code>.
- *
- * @param parentPane The parent container of this one
- * @param parent The parent container
- */
- public TargetDatabaseComposite(
- Pane<? extends Options> parentPane,
- Composite parent) {
-
- super(parentPane, parent);
- }
-
- private PropertyValueModel<String> buildDefaultTargetDatabaseHolder() {
- return new PropertyAspectAdapter<Options, String>(this.getSubjectHolder(), Options.DEFAULT_TARGET_DATABASE) {
- @Override
- protected String buildValue_() {
- return TargetDatabaseComposite.this.getDefaultValue(subject);
- }
- };
- }
-
- private ListValueModel<String> buildDefaultTargetDatabaseListHolder() {
- return new PropertyListValueModelAdapter<String>(
- this.buildDefaultTargetDatabaseHolder()
- );
- }
-
- private String buildDisplayString(String targetDatabaseName) {
-
- return SWTUtil.buildDisplayString(
- EclipseLinkUiMessages.class,
- this.getClass(),
- TargetDatabase.valueOf(targetDatabaseName));
- }
-
- private Comparator<String> buildTargetDatabaseComparator() {
- return new Comparator<String>() {
- public int compare(String targetDatabase1, String targetDatabase2) {
- targetDatabase1 = buildDisplayString(targetDatabase1);
- targetDatabase2 = buildDisplayString(targetDatabase2);
- return Collator.getInstance().compare(targetDatabase1, targetDatabase2);
- }
- };
- }
-
- private StringConverter<String> buildTargetDatabaseConverter() {
- return new StringConverter<String>() {
- public String convertToString(String value) {
- try {
- TargetDatabase.valueOf(value);
- value = buildDisplayString(value);
- }
- catch (Exception e) {
- // Ignore since the value is not a TargetDatabase
- }
- return value;
- }
- };
- }
-
- private WritablePropertyValueModel<String> buildTargetDatabaseHolder() {
- return new PropertyAspectAdapter<Options, String>(this.getSubjectHolder(), Options.TARGET_DATABASE_PROPERTY) {
- @Override
- protected String buildValue_() {
-
- String name = subject.getTargetDatabase();
- if (name == null) {
- name = TargetDatabaseComposite.this.getDefaultValue(subject);
- }
- return name;
- }
-
- @Override
- protected void setValue_(String value) {
-
- if (getDefaultValue(subject).equals(value)) {
- value = null;
- }
- subject.setTargetDatabase(value);
- }
- };
- }
-
- private ListValueModel<String> buildTargetDatabaseListHolder() {
- ArrayList<ListValueModel<String>> holders = new ArrayList<ListValueModel<String>>(2);
- holders.add(buildDefaultTargetDatabaseListHolder());
- holders.add(buildTargetDatabasesListHolder());
- return new CompositeListValueModel<ListValueModel<String>, String>(holders);
- }
-
- private Iterator<String> buildTargetDatabases() {
- return new TransformationIterator<TargetDatabase, String>(CollectionTools.iterator(TargetDatabase.values())) {
- @Override
- protected String transform(TargetDatabase next) {
- return next.name();
- }
- };
- }
-
- private CollectionValueModel<String> buildTargetDatabasesCollectionHolder() {
- return new SimpleCollectionValueModel<String>(
- CollectionTools.collection(buildTargetDatabases())
- );
- }
-
- private ListValueModel<String> buildTargetDatabasesListHolder() {
- return new SortedListValueModelAdapter<String>(
- buildTargetDatabasesCollectionHolder(),
- buildTargetDatabaseComparator()
- );
- }
-
- private String getDefaultValue(Options subject) {
- String defaultValue = subject.getDefaultTargetDatabase();
-
- if (defaultValue != null) {
- return NLS.bind(
- EclipseLinkUiMessages.PersistenceXmlOptionsTab_defaultWithOneParam,
- defaultValue
- );
- }
- else {
- return EclipseLinkUiMessages.PersistenceXmlOptionsTab_defaultEmpty;
- }
- }
-
- /*
- * (non-Javadoc)
- */
- @Override
- protected void initializeLayout(Composite container) {
-
- CCombo combo = addLabeledEditableCCombo(
- container,
- EclipseLinkUiMessages.PersistenceXmlOptionsTab_targetDatabaseLabel,
- this.buildTargetDatabaseListHolder(),
- this.buildTargetDatabaseHolder(),
- this.buildTargetDatabaseConverter(),
- EclipseLinkHelpContextIds.PERSISTENCE_OPTIONS_TARGET_DATABASE
- );
-
- SWTUtil.attachDefaultValueHandler(combo);
- }
-}
diff --git a/jpa/plugins/org.eclipse.jpt.eclipselink.ui/src/org/eclipse/jpt/eclipselink/ui/internal/persistence/options/TargetServerComposite.java b/jpa/plugins/org.eclipse.jpt.eclipselink.ui/src/org/eclipse/jpt/eclipselink/ui/internal/persistence/options/TargetServerComposite.java
deleted file mode 100644
index 840ae5909c..0000000000
--- a/jpa/plugins/org.eclipse.jpt.eclipselink.ui/src/org/eclipse/jpt/eclipselink/ui/internal/persistence/options/TargetServerComposite.java
+++ /dev/null
@@ -1,187 +0,0 @@
-/*******************************************************************************
-* Copyright (c) 2008, 2009 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.
-*
-* Contributors:
-* Oracle - initial API and implementation
-*******************************************************************************/
-package org.eclipse.jpt.eclipselink.ui.internal.persistence.options;
-
-import com.ibm.icu.text.Collator;
-import java.util.ArrayList;
-import java.util.Comparator;
-import java.util.Iterator;
-import org.eclipse.jpt.eclipselink.core.internal.context.persistence.options.Options;
-import org.eclipse.jpt.eclipselink.core.internal.context.persistence.options.TargetServer;
-import org.eclipse.jpt.eclipselink.ui.internal.EclipseLinkHelpContextIds;
-import org.eclipse.jpt.eclipselink.ui.internal.EclipseLinkUiMessages;
-import org.eclipse.jpt.ui.internal.util.SWTUtil;
-import org.eclipse.jpt.ui.internal.widgets.Pane;
-import org.eclipse.jpt.utility.internal.CollectionTools;
-import org.eclipse.jpt.utility.internal.StringConverter;
-import org.eclipse.jpt.utility.internal.iterators.TransformationIterator;
-import org.eclipse.jpt.utility.internal.model.value.CompositeListValueModel;
-import org.eclipse.jpt.utility.internal.model.value.PropertyAspectAdapter;
-import org.eclipse.jpt.utility.internal.model.value.PropertyListValueModelAdapter;
-import org.eclipse.jpt.utility.internal.model.value.SimpleCollectionValueModel;
-import org.eclipse.jpt.utility.internal.model.value.SortedListValueModelAdapter;
-import org.eclipse.jpt.utility.model.value.CollectionValueModel;
-import org.eclipse.jpt.utility.model.value.ListValueModel;
-import org.eclipse.jpt.utility.model.value.PropertyValueModel;
-import org.eclipse.jpt.utility.model.value.WritablePropertyValueModel;
-import org.eclipse.osgi.util.NLS;
-import org.eclipse.swt.custom.CCombo;
-import org.eclipse.swt.widgets.Composite;
-
-/**
- * TargetServerComposite
- */
-public class TargetServerComposite extends Pane<Options>
-{
- /**
- * Creates a new <code>TargetServerComposite</code>.
- *
- * @param parentPane The parent container of this one
- * @param parent The parent container
- */
- public TargetServerComposite(
- Pane<? extends Options> parentPane,
- Composite parent) {
-
- super(parentPane, parent);
- }
-
- private PropertyValueModel<String> buildDefaultTargetServerHolder() {
- return new PropertyAspectAdapter<Options, String>(this.getSubjectHolder(), Options.DEFAULT_TARGET_SERVER) {
- @Override
- protected String buildValue_() {
- return TargetServerComposite.this.getDefaultValue(subject);
- }
- };
- }
-
- private ListValueModel<String> buildDefaultTargetServerListHolder() {
- return new PropertyListValueModelAdapter<String>(
- this.buildDefaultTargetServerHolder()
- );
- }
-
- private String buildDisplayString(String targetServerName) {
-
- return SWTUtil.buildDisplayString(
- EclipseLinkUiMessages.class,
- this.getClass(),
- TargetServer.valueOf(targetServerName));
- }
-
- private Comparator<String> buildTargetServerComparator() {
- return new Comparator<String>() {
- public int compare(String targetServer1, String targetServer2) {
- targetServer1 = buildDisplayString(targetServer1);
- targetServer2 = buildDisplayString(targetServer2);
- return Collator.getInstance().compare(targetServer1, targetServer2);
- }
- };
- }
-
- private StringConverter<String> buildTargetServerConverter() {
- return new StringConverter<String>() {
- public String convertToString(String value) {
- try {
- TargetServer.valueOf(value);
- value = buildDisplayString(value);
- }
- catch (Exception e) {
- // Ignore since the value is not a TargetServer
- }
- return value;
- }
- };
- }
-
- private WritablePropertyValueModel<String> buildTargetServerHolder() {
- return new PropertyAspectAdapter<Options, String>(this.getSubjectHolder(), Options.TARGET_SERVER_PROPERTY) {
- @Override
- protected String buildValue_() {
-
- String name = subject.getTargetServer();
- if (name == null) {
- name = TargetServerComposite.this.getDefaultValue(subject);
- }
- return name;
- }
-
- @Override
- protected void setValue_(String value) {
-
- if (getDefaultValue(subject).equals(value)) {
- value = null;
- }
- subject.setTargetServer(value);
- }
- };
- }
-
- private ListValueModel<String> buildTargetServerListHolder() {
- ArrayList<ListValueModel<String>> holders = new ArrayList<ListValueModel<String>>(2);
- holders.add(buildDefaultTargetServerListHolder());
- holders.add(buildTargetServersListHolder());
- return new CompositeListValueModel<ListValueModel<String>, String>(holders);
- }
-
- private Iterator<String> buildTargetServers() {
- return new TransformationIterator<TargetServer, String>(CollectionTools.iterator(TargetServer.values())) {
- @Override
- protected String transform(TargetServer next) {
- return next.name();
- }
- };
- }
-
- private CollectionValueModel<String> buildTargetServersCollectionHolder() {
- return new SimpleCollectionValueModel<String>(
- CollectionTools.collection(buildTargetServers())
- );
- }
-
- private ListValueModel<String> buildTargetServersListHolder() {
- return new SortedListValueModelAdapter<String>(
- buildTargetServersCollectionHolder(),
- buildTargetServerComparator()
- );
- }
-
- private String getDefaultValue(Options subject) {
- String defaultValue = subject.getDefaultTargetServer();
-
- if (defaultValue != null) {
- return NLS.bind(
- EclipseLinkUiMessages.PersistenceXmlOptionsTab_defaultWithOneParam,
- defaultValue
- );
- }
- else {
- return EclipseLinkUiMessages.PersistenceXmlOptionsTab_defaultEmpty;
- }
- }
-
- /*
- * (non-Javadoc)
- */
- @Override
- protected void initializeLayout(Composite container) {
-
- CCombo combo = addLabeledEditableCCombo(
- container,
- EclipseLinkUiMessages.PersistenceXmlOptionsTab_targetServerLabel,
- this.buildTargetServerListHolder(),
- this.buildTargetServerHolder(),
- this.buildTargetServerConverter(),
- EclipseLinkHelpContextIds.PERSISTENCE_OPTIONS_TARGET_SERVER
- );
-
- SWTUtil.attachDefaultValueHandler(combo);
- }
-}
diff --git a/jpa/plugins/org.eclipse.jpt.eclipselink.ui/src/org/eclipse/jpt/eclipselink/ui/internal/persistence/options/TemporalMutableComposite.java b/jpa/plugins/org.eclipse.jpt.eclipselink.ui/src/org/eclipse/jpt/eclipselink/ui/internal/persistence/options/TemporalMutableComposite.java
deleted file mode 100644
index da8cd90cc0..0000000000
--- a/jpa/plugins/org.eclipse.jpt.eclipselink.ui/src/org/eclipse/jpt/eclipselink/ui/internal/persistence/options/TemporalMutableComposite.java
+++ /dev/null
@@ -1,96 +0,0 @@
-/*******************************************************************************
-* Copyright (c) 2008, 2009 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.
-*
-* Contributors:
-* Oracle - initial API and implementation
-*******************************************************************************/
-package org.eclipse.jpt.eclipselink.ui.internal.persistence.options;
-
-import org.eclipse.jpt.eclipselink.core.internal.context.persistence.options.Options;
-import org.eclipse.jpt.eclipselink.ui.internal.EclipseLinkHelpContextIds;
-import org.eclipse.jpt.eclipselink.ui.internal.EclipseLinkUiMessages;
-import org.eclipse.jpt.ui.internal.widgets.FormPane;
-import org.eclipse.jpt.utility.internal.model.value.PropertyAspectAdapter;
-import org.eclipse.jpt.utility.internal.model.value.TransformationPropertyValueModel;
-import org.eclipse.jpt.utility.model.value.PropertyValueModel;
-import org.eclipse.jpt.utility.model.value.WritablePropertyValueModel;
-import org.eclipse.osgi.util.NLS;
-import org.eclipse.swt.widgets.Composite;
-
-/**
- * TemporalMutableComposite
- */
-public class TemporalMutableComposite extends FormPane<Options>
-{
- /**
- * Creates a new <code>TemporalMutableComposite</code>.
- *
- * @param parentController
- * The parent container of this one
- * @param parent
- * The parent container
- */
- public TemporalMutableComposite(
- FormPane<? extends Options> parentComposite,
- Composite parent) {
-
- super(parentComposite, parent);
- }
-
- @Override
- protected void initializeLayout(Composite container) {
-
- this.addTriStateCheckBoxWithDefault(
- container,
- EclipseLinkUiMessages.PersistenceXmlOptionsTab_temporalMutableLabel,
- this.buildTemporalMutableHolder(),
- this.buildTemporalMutableStringHolder(),
- EclipseLinkHelpContextIds.PERSISTENCE_OPTIONS
- );
- }
-
- private WritablePropertyValueModel<Boolean> buildTemporalMutableHolder() {
- return new PropertyAspectAdapter<Options, Boolean>(getSubjectHolder(), Options.TEMPORAL_MUTABLE_PROPERTY) {
- @Override
- protected Boolean buildValue_() {
- return this.subject.getTemporalMutable();
- }
-
- @Override
- protected void setValue_(Boolean value) {
- this.subject.setTemporalMutable(value);
- }
- };
- }
-
- private PropertyValueModel<String> buildTemporalMutableStringHolder() {
- return new TransformationPropertyValueModel<Boolean, String>(buildDefaultTemporalMutableHolder()) {
- @Override
- protected String transform(Boolean value) {
- if (value != null) {
- String defaultStringValue = value.booleanValue() ? EclipseLinkUiMessages.Boolean_True : EclipseLinkUiMessages.Boolean_False;
- return NLS.bind(EclipseLinkUiMessages.PersistenceXmlOptionsTab_temporalMutableLabelDefault, defaultStringValue);
- }
- return EclipseLinkUiMessages.PersistenceXmlOptionsTab_temporalMutableLabel;
- }
- };
- }
-
- private PropertyValueModel<Boolean> buildDefaultTemporalMutableHolder() {
- return new PropertyAspectAdapter<Options, Boolean>(
- getSubjectHolder(),
- Options.TEMPORAL_MUTABLE_PROPERTY)
- {
- @Override
- protected Boolean buildValue_() {
- if (this.subject.getTemporalMutable() != null) {
- return null;
- }
- return this.subject.getDefaultTemporalMutable();
- }
- };
- }
-}
diff --git a/jpa/plugins/org.eclipse.jpt.eclipselink.ui/src/org/eclipse/jpt/eclipselink/ui/internal/persistence/schema/generation/CreateDdlFileNameComposite.java b/jpa/plugins/org.eclipse.jpt.eclipselink.ui/src/org/eclipse/jpt/eclipselink/ui/internal/persistence/schema/generation/CreateDdlFileNameComposite.java
deleted file mode 100644
index 3427cf9889..0000000000
--- a/jpa/plugins/org.eclipse.jpt.eclipselink.ui/src/org/eclipse/jpt/eclipselink/ui/internal/persistence/schema/generation/CreateDdlFileNameComposite.java
+++ /dev/null
@@ -1,111 +0,0 @@
-/*******************************************************************************
-* Copyright (c) 2008, 2009 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.
-*
-* Contributors:
-* Oracle - initial API and implementation
-*******************************************************************************/
-package org.eclipse.jpt.eclipselink.ui.internal.persistence.schema.generation;
-
-import org.eclipse.jpt.eclipselink.core.internal.context.persistence.schema.generation.SchemaGeneration;
-import org.eclipse.jpt.eclipselink.ui.internal.EclipseLinkHelpContextIds;
-import org.eclipse.jpt.eclipselink.ui.internal.EclipseLinkUiMessages;
-import org.eclipse.jpt.ui.internal.util.SWTUtil;
-import org.eclipse.jpt.ui.internal.widgets.Pane;
-import org.eclipse.jpt.utility.internal.model.value.PropertyAspectAdapter;
-import org.eclipse.jpt.utility.internal.model.value.PropertyListValueModelAdapter;
-import org.eclipse.jpt.utility.model.value.ListValueModel;
-import org.eclipse.jpt.utility.model.value.PropertyValueModel;
-import org.eclipse.jpt.utility.model.value.WritablePropertyValueModel;
-import org.eclipse.osgi.util.NLS;
-import org.eclipse.swt.custom.CCombo;
-import org.eclipse.swt.widgets.Composite;
-
-/**
- * CreateDdlFileNameComposite
- */
-public class CreateDdlFileNameComposite extends Pane<SchemaGeneration>
-{
- /**
- * Creates a new <code>CreateDdlFileNameComposite</code>.
- *
- * @param parentPane The parent container of this one
- * @param parent The parent container
- */
- public CreateDdlFileNameComposite(
- Pane<? extends SchemaGeneration> parentPane,
- Composite parent) {
-
- super(parentPane, parent);
- }
-
- private PropertyValueModel<String> buildDefaultCreateDdlFileNameHolder() {
- return new PropertyAspectAdapter<SchemaGeneration, String>(this.getSubjectHolder(), SchemaGeneration.DEFAULT_SCHEMA_GENERATION_CREATE_FILE_NAME) {
- @Override
- protected String buildValue_() {
- return CreateDdlFileNameComposite.this.getDefaultValue(subject);
- }
- };
- }
-
- private ListValueModel<String> buildDefaultCreateDdlFileNameListHolder() {
- return new PropertyListValueModelAdapter<String>(
- this.buildDefaultCreateDdlFileNameHolder()
- );
- }
-
- private WritablePropertyValueModel<String> buildCreateDdlFileNameHolder() {
- return new PropertyAspectAdapter<SchemaGeneration, String>(this.getSubjectHolder(), SchemaGeneration.CREATE_FILE_NAME_PROPERTY) {
- @Override
- protected String buildValue_() {
-
- String name = subject.getCreateFileName();
- if (name == null) {
- name = CreateDdlFileNameComposite.this.getDefaultValue(subject);
- }
- return name;
- }
-
- @Override
- protected void setValue_(String value) {
-
- if (getDefaultValue(subject).equals(value)) {
- value = null;
- }
- subject.setCreateFileName(value);
- }
- };
- }
-
- private String getDefaultValue(SchemaGeneration subject) {
- String defaultValue = subject.getDefaultCreateFileName();
-
- if (defaultValue != null) {
- return NLS.bind(
- EclipseLinkUiMessages.PersistenceXmlSchemaGenerationTab_defaultWithOneParam,
- defaultValue
- );
- }
- else {
- return EclipseLinkUiMessages.PersistenceXmlSchemaGenerationTab_defaultEmpty;
- }
- }
-
- /*
- * (non-Javadoc)
- */
- @Override
- protected void initializeLayout(Composite container) {
-
- CCombo combo = addLabeledEditableCCombo(
- container,
- EclipseLinkUiMessages.PersistenceXmlSchemaGenerationTab_createDdlFileNameLabel,
- this.buildDefaultCreateDdlFileNameListHolder(),
- this.buildCreateDdlFileNameHolder(),
- EclipseLinkHelpContextIds.PERSISTENCE_SCHEMA_GENERATION
- );
- SWTUtil.attachDefaultValueHandler(combo);
- }
-}
diff --git a/jpa/plugins/org.eclipse.jpt.eclipselink.ui/src/org/eclipse/jpt/eclipselink/ui/internal/persistence/schema/generation/DdlGenerationLocationComposite.java b/jpa/plugins/org.eclipse.jpt.eclipselink.ui/src/org/eclipse/jpt/eclipselink/ui/internal/persistence/schema/generation/DdlGenerationLocationComposite.java
deleted file mode 100644
index 970855e6f1..0000000000
--- a/jpa/plugins/org.eclipse.jpt.eclipselink.ui/src/org/eclipse/jpt/eclipselink/ui/internal/persistence/schema/generation/DdlGenerationLocationComposite.java
+++ /dev/null
@@ -1,92 +0,0 @@
-/*******************************************************************************
- * Copyright (c) 2008 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.
- *
- * Contributors:
- * Oracle - initial API and implementation
- ******************************************************************************/
-package org.eclipse.jpt.eclipselink.ui.internal.persistence.schema.generation;
-
-import org.eclipse.jpt.eclipselink.core.internal.context.persistence.schema.generation.SchemaGeneration;
-import org.eclipse.jpt.eclipselink.ui.internal.EclipseLinkUiMessages;
-import org.eclipse.jpt.ui.internal.widgets.FolderChooserPane;
-import org.eclipse.jpt.ui.internal.widgets.Pane;
-import org.eclipse.jpt.utility.internal.model.value.PropertyAspectAdapter;
-import org.eclipse.jpt.utility.model.value.WritablePropertyValueModel;
-import org.eclipse.osgi.util.NLS;
-import org.eclipse.swt.widgets.Composite;
-
-/**
- * DdlGenerationLocationComposite
- */
-public class DdlGenerationLocationComposite extends Pane<SchemaGeneration>
-{
- public DdlGenerationLocationComposite(Pane<? extends SchemaGeneration> parentPane,
- Composite parent) {
-
- super(parentPane, parent);
- }
-
- @Override
- protected void initializeLayout(Composite container) {
-
- new FolderChooserPane<SchemaGeneration>(this, container) {
-
- @Override
- protected WritablePropertyValueModel<String> buildTextHolder() {
- return new PropertyAspectAdapter<SchemaGeneration, String>(
- getSubjectHolder(), SchemaGeneration.APPLICATION_LOCATION_PROPERTY) {
- @Override
- protected String buildValue_() {
-
- String name = subject.getApplicationLocation();
- if (name == null) {
- name = defaultValue(subject);
- }
- return name;
- }
-
- @Override
- protected void setValue_(String value) {
-
- if (defaultValue(subject).equals(value)) {
- value = null;
- }
- subject.setApplicationLocation(value);
- }
- };
- }
-
- private String defaultValue(SchemaGeneration subject) {
- String defaultValue = subject.getDefaultApplicationLocation();
-
- if (defaultValue != null) {
- return NLS.bind(
- EclipseLinkUiMessages.PersistenceXmlSchemaGenerationTab_defaultWithOneParam,
- defaultValue
- );
- }
- else {
- return EclipseLinkUiMessages.PersistenceXmlSchemaGenerationTab_defaultEmpty;
- }
- }
-
- @Override
- protected String getDialogMessage() {
- return EclipseLinkUiMessages.DdlGenerationLocationComposite_dialogMessage;
- }
-
- @Override
- protected String getDialogTitle() {
- return EclipseLinkUiMessages.DdlGenerationLocationComposite_dialogTitle;
- }
-
- @Override
- protected String getLabelText() {
- return EclipseLinkUiMessages.PersistenceXmlSchemaGenerationTab_ddlGenerationLocationLabel;
- }
- };
- }
-}
diff --git a/jpa/plugins/org.eclipse.jpt.eclipselink.ui/src/org/eclipse/jpt/eclipselink/ui/internal/persistence/schema/generation/DdlGenerationTypeComposite.java b/jpa/plugins/org.eclipse.jpt.eclipselink.ui/src/org/eclipse/jpt/eclipselink/ui/internal/persistence/schema/generation/DdlGenerationTypeComposite.java
deleted file mode 100644
index a4b4524638..0000000000
--- a/jpa/plugins/org.eclipse.jpt.eclipselink.ui/src/org/eclipse/jpt/eclipselink/ui/internal/persistence/schema/generation/DdlGenerationTypeComposite.java
+++ /dev/null
@@ -1,87 +0,0 @@
-/*******************************************************************************
- * Copyright (c) 2008 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.
- *
- * Contributors:
- * Oracle - initial API and implementation
- *******************************************************************************/
-package org.eclipse.jpt.eclipselink.ui.internal.persistence.schema.generation;
-
-import java.util.Collection;
-import org.eclipse.jpt.eclipselink.core.internal.context.persistence.schema.generation.DdlGenerationType;
-import org.eclipse.jpt.eclipselink.core.internal.context.persistence.schema.generation.SchemaGeneration;
-import org.eclipse.jpt.eclipselink.ui.internal.EclipseLinkHelpContextIds;
-import org.eclipse.jpt.eclipselink.ui.internal.EclipseLinkUiMessages;
-import org.eclipse.jpt.ui.internal.widgets.EnumFormComboViewer;
-import org.eclipse.jpt.ui.internal.widgets.FormPane;
-import org.eclipse.swt.widgets.Composite;
-
-/**
- * DdlGenerationTypeComposite
- */
-public class DdlGenerationTypeComposite
- extends FormPane<SchemaGeneration>
-{
- /**
- * Creates a new <code>DdlGenerationTypeComposite</code>.
- *
- * @param parentController
- * The parent container of this one
- * @param parent
- * The parent container
- */
- public DdlGenerationTypeComposite(
- FormPane<? extends SchemaGeneration> parentComposite,
- Composite parent) {
-
- super(parentComposite, parent);
- }
-
- private EnumFormComboViewer<SchemaGeneration, DdlGenerationType> addDdlGenerationTypeCombo(Composite container) {
- return new EnumFormComboViewer<SchemaGeneration, DdlGenerationType>(this, container) {
- @Override
- protected void addPropertyNames(Collection<String> propertyNames) {
- super.addPropertyNames(propertyNames);
- propertyNames.add(SchemaGeneration.DDL_GENERATION_TYPE_PROPERTY);
- }
-
- @Override
- protected DdlGenerationType[] getChoices() {
- return DdlGenerationType.values();
- }
-
- @Override
- protected DdlGenerationType getDefaultValue() {
- return this.getSubject().getDefaultDdlGenerationType();
- }
-
- @Override
- protected String displayString(DdlGenerationType value) {
- return this.buildDisplayString(EclipseLinkUiMessages.class, DdlGenerationTypeComposite.this, value);
- }
-
- @Override
- protected DdlGenerationType getValue() {
- return this.getSubject().getDdlGenerationType();
- }
-
- @Override
- protected void setValue(DdlGenerationType value) {
- this.getSubject().setDdlGenerationType(value);
- }
- };
- }
-
- @Override
- protected void initializeLayout(Composite container) {
-
- this.addLabeledComposite(
- container,
- EclipseLinkUiMessages.PersistenceXmlSchemaGenerationTab_ddlGenerationTypeLabel,
- addDdlGenerationTypeCombo( container),
- EclipseLinkHelpContextIds.PERSISTENCE_SCHEMA_GENERATION
- );
- }
-}
diff --git a/jpa/plugins/org.eclipse.jpt.eclipselink.ui/src/org/eclipse/jpt/eclipselink/ui/internal/persistence/schema/generation/DropDdlFileNameComposite.java b/jpa/plugins/org.eclipse.jpt.eclipselink.ui/src/org/eclipse/jpt/eclipselink/ui/internal/persistence/schema/generation/DropDdlFileNameComposite.java
deleted file mode 100644
index 92597b044b..0000000000
--- a/jpa/plugins/org.eclipse.jpt.eclipselink.ui/src/org/eclipse/jpt/eclipselink/ui/internal/persistence/schema/generation/DropDdlFileNameComposite.java
+++ /dev/null
@@ -1,111 +0,0 @@
-/*******************************************************************************
-* Copyright (c) 2008, 2009 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.
-*
-* Contributors:
-* Oracle - initial API and implementation
-*******************************************************************************/
-package org.eclipse.jpt.eclipselink.ui.internal.persistence.schema.generation;
-
-import org.eclipse.jpt.eclipselink.core.internal.context.persistence.schema.generation.SchemaGeneration;
-import org.eclipse.jpt.eclipselink.ui.internal.EclipseLinkHelpContextIds;
-import org.eclipse.jpt.eclipselink.ui.internal.EclipseLinkUiMessages;
-import org.eclipse.jpt.ui.internal.util.SWTUtil;
-import org.eclipse.jpt.ui.internal.widgets.Pane;
-import org.eclipse.jpt.utility.internal.model.value.PropertyAspectAdapter;
-import org.eclipse.jpt.utility.internal.model.value.PropertyListValueModelAdapter;
-import org.eclipse.jpt.utility.model.value.ListValueModel;
-import org.eclipse.jpt.utility.model.value.PropertyValueModel;
-import org.eclipse.jpt.utility.model.value.WritablePropertyValueModel;
-import org.eclipse.osgi.util.NLS;
-import org.eclipse.swt.custom.CCombo;
-import org.eclipse.swt.widgets.Composite;
-
-/**
- * DropDdlFileNameComposite
- */
-public class DropDdlFileNameComposite extends Pane<SchemaGeneration>
-{
- /**
- * Creates a new <code>DropDdlFileNameComposite</code>.
- *
- * @param parentPane The parent container of this one
- * @param parent The parent container
- */
- public DropDdlFileNameComposite(
- Pane<? extends SchemaGeneration> parentPane,
- Composite parent) {
-
- super(parentPane, parent);
- }
-
- private PropertyValueModel<String> buildDefaultDropDdlFileNameHolder() {
- return new PropertyAspectAdapter<SchemaGeneration, String>(this.getSubjectHolder(), SchemaGeneration.DEFAULT_SCHEMA_GENERATION_DROP_FILE_NAME) {
- @Override
- protected String buildValue_() {
- return DropDdlFileNameComposite.this.getDefaultValue(subject);
- }
- };
- }
-
- private ListValueModel<String> buildDefaultDropDdlFileNameListHolder() {
- return new PropertyListValueModelAdapter<String>(
- this.buildDefaultDropDdlFileNameHolder()
- );
- }
-
- private WritablePropertyValueModel<String> buildDropDdlFileNameHolder() {
- return new PropertyAspectAdapter<SchemaGeneration, String>(this.getSubjectHolder(), SchemaGeneration.DROP_FILE_NAME_PROPERTY) {
- @Override
- protected String buildValue_() {
-
- String name = subject.getDropFileName();
- if (name == null) {
- name = DropDdlFileNameComposite.this.getDefaultValue(subject);
- }
- return name;
- }
-
- @Override
- protected void setValue_(String value) {
-
- if (DropDdlFileNameComposite.this.getDefaultValue(subject).equals(value)) {
- value = null;
- }
- subject.setDropFileName(value);
- }
- };
- }
-
- private String getDefaultValue(SchemaGeneration subject) {
- String defaultValue = subject.getDefaultDropFileName();
-
- if (defaultValue != null) {
- return NLS.bind(
- EclipseLinkUiMessages.PersistenceXmlSchemaGenerationTab_defaultWithOneParam,
- defaultValue
- );
- }
- else {
- return EclipseLinkUiMessages.PersistenceXmlSchemaGenerationTab_defaultEmpty;
- }
- }
-
- /*
- * (non-Javadoc)
- */
- @Override
- protected void initializeLayout(Composite container) {
-
- CCombo combo = addLabeledEditableCCombo(
- container,
- EclipseLinkUiMessages.PersistenceXmlSchemaGenerationTab_dropDdlFileNameLabel,
- this.buildDefaultDropDdlFileNameListHolder(),
- this.buildDropDdlFileNameHolder(),
- EclipseLinkHelpContextIds.PERSISTENCE_SCHEMA_GENERATION
- );
- SWTUtil.attachDefaultValueHandler(combo);
- }
-}
diff --git a/jpa/plugins/org.eclipse.jpt.eclipselink.ui/src/org/eclipse/jpt/eclipselink/ui/internal/persistence/schema/generation/EclipseLinkSchemaGenerationComposite.java b/jpa/plugins/org.eclipse.jpt.eclipselink.ui/src/org/eclipse/jpt/eclipselink/ui/internal/persistence/schema/generation/EclipseLinkSchemaGenerationComposite.java
deleted file mode 100644
index 6dfadc1728..0000000000
--- a/jpa/plugins/org.eclipse.jpt.eclipselink.ui/src/org/eclipse/jpt/eclipselink/ui/internal/persistence/schema/generation/EclipseLinkSchemaGenerationComposite.java
+++ /dev/null
@@ -1,49 +0,0 @@
-/*******************************************************************************
- * Copyright (c) 2008 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.
- *
- * Contributors:
- * Oracle - initial API and implementation
- *******************************************************************************/
-package org.eclipse.jpt.eclipselink.ui.internal.persistence.schema.generation;
-
-import org.eclipse.jpt.eclipselink.core.internal.context.persistence.schema.generation.SchemaGeneration;
-import org.eclipse.jpt.eclipselink.ui.internal.EclipseLinkUiMessages;
-import org.eclipse.jpt.ui.internal.widgets.FormPane;
-import org.eclipse.swt.widgets.Composite;
-
-/**
- * EclipseLinkSchemaGenerationComposite
- */
-public class EclipseLinkSchemaGenerationComposite
- extends FormPane<SchemaGeneration>
-{
- public EclipseLinkSchemaGenerationComposite(
- FormPane<SchemaGeneration> subjectHolder,
- Composite container) {
- super(subjectHolder, container, false);
- }
-
- @Override
- protected void initializeLayout(Composite container) {
-
- container = addSection(
- container,
- EclipseLinkUiMessages.PersistenceXmlSchemaGenerationTab_sectionTitle,
- EclipseLinkUiMessages.PersistenceXmlSchemaGenerationTab_sectionDescription
- );
-
- // DDL Generation Type:
- new DdlGenerationTypeComposite(this, container);
- // Output Mode:
- new OutputModeComposite(this, container);
- // DDL Generation Location
- new DdlGenerationLocationComposite(this, container);
- // Create DDL File Name:
- new CreateDdlFileNameComposite(this, container);
- // Drop DDL File Name:
- new DropDdlFileNameComposite(this, container);
- }
-} \ No newline at end of file
diff --git a/jpa/plugins/org.eclipse.jpt.eclipselink.ui/src/org/eclipse/jpt/eclipselink/ui/internal/persistence/schema/generation/OutputModeComposite.java b/jpa/plugins/org.eclipse.jpt.eclipselink.ui/src/org/eclipse/jpt/eclipselink/ui/internal/persistence/schema/generation/OutputModeComposite.java
deleted file mode 100644
index 6bfd0d9a7f..0000000000
--- a/jpa/plugins/org.eclipse.jpt.eclipselink.ui/src/org/eclipse/jpt/eclipselink/ui/internal/persistence/schema/generation/OutputModeComposite.java
+++ /dev/null
@@ -1,85 +0,0 @@
-/*******************************************************************************
- * Copyright (c) 2008, 2009 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.
- *
- * Contributors:
- * Oracle - initial API and implementation
- *******************************************************************************/
-package org.eclipse.jpt.eclipselink.ui.internal.persistence.schema.generation;
-
-import java.util.Collection;
-import org.eclipse.jpt.eclipselink.core.internal.context.persistence.schema.generation.OutputMode;
-import org.eclipse.jpt.eclipselink.core.internal.context.persistence.schema.generation.SchemaGeneration;
-import org.eclipse.jpt.eclipselink.ui.internal.EclipseLinkHelpContextIds;
-import org.eclipse.jpt.eclipselink.ui.internal.EclipseLinkUiMessages;
-import org.eclipse.jpt.ui.internal.widgets.EnumFormComboViewer;
-import org.eclipse.jpt.ui.internal.widgets.FormPane;
-import org.eclipse.swt.widgets.Composite;
-
-/**
- * OutputModeComposite
- */
-public class OutputModeComposite extends FormPane<SchemaGeneration>
-{
- /**
- * Creates a new <code>OutputModeComposite</code>.
- *
- * @param parentController
- * The parent container of this one
- * @param parent
- * The parent container
- */
- public OutputModeComposite(
- FormPane<? extends SchemaGeneration> parentComposite,
- Composite parent) {
-
- super(parentComposite, parent);
- }
-
- private EnumFormComboViewer<SchemaGeneration, OutputMode> addBuildOutputModeCombo(Composite container) {
- return new EnumFormComboViewer<SchemaGeneration, OutputMode>(this, container) {
- @Override
- protected void addPropertyNames(Collection<String> propertyNames) {
- super.addPropertyNames(propertyNames);
- propertyNames.add(SchemaGeneration.OUTPUT_MODE_PROPERTY);
- }
-
- @Override
- protected OutputMode[] getChoices() {
- return OutputMode.values();
- }
-
- @Override
- protected OutputMode getDefaultValue() {
- return this.getSubject().getDefaultOutputMode();
- }
-
- @Override
- protected String displayString(OutputMode value) {
- return this.buildDisplayString(EclipseLinkUiMessages.class, OutputModeComposite.this, value);
- }
-
- @Override
- protected OutputMode getValue() {
- return this.getSubject().getOutputMode();
- }
-
- @Override
- protected void setValue(OutputMode value) {
- this.getSubject().setOutputMode(value);
- }
- };
- }
-
- @Override
- protected void initializeLayout(Composite container) {
- this.addLabeledComposite(
- container,
- EclipseLinkUiMessages.PersistenceXmlSchemaGenerationTab_outputModeLabel,
- this.addBuildOutputModeCombo(container),
- EclipseLinkHelpContextIds.PERSISTENCE_SCHEMA_GENERATION
- );
- }
-}
diff --git a/jpa/plugins/org.eclipse.jpt.eclipselink.ui/src/org/eclipse/jpt/eclipselink/ui/internal/persistence/schema/generation/PersistenceXmlSchemaGenerationTab.java b/jpa/plugins/org.eclipse.jpt.eclipselink.ui/src/org/eclipse/jpt/eclipselink/ui/internal/persistence/schema/generation/PersistenceXmlSchemaGenerationTab.java
deleted file mode 100644
index 69c9334f4f..0000000000
--- a/jpa/plugins/org.eclipse.jpt.eclipselink.ui/src/org/eclipse/jpt/eclipselink/ui/internal/persistence/schema/generation/PersistenceXmlSchemaGenerationTab.java
+++ /dev/null
@@ -1,56 +0,0 @@
-/*******************************************************************************
- * Copyright (c) 2007, 2009 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.
- *
- * Contributors:
- * Oracle - initial API and implementation
- *******************************************************************************/
-package org.eclipse.jpt.eclipselink.ui.internal.persistence.schema.generation;
-
-import org.eclipse.jpt.eclipselink.core.internal.context.persistence.schema.generation.SchemaGeneration;
-import org.eclipse.jpt.eclipselink.ui.internal.EclipseLinkHelpContextIds;
-import org.eclipse.jpt.eclipselink.ui.internal.EclipseLinkUiMessages;
-import org.eclipse.jpt.ui.WidgetFactory;
-import org.eclipse.jpt.ui.details.JpaPageComposite;
-import org.eclipse.jpt.ui.internal.widgets.FormPane;
-import org.eclipse.jpt.utility.model.value.PropertyValueModel;
-import org.eclipse.swt.graphics.Image;
-import org.eclipse.swt.widgets.Composite;
-
-/**
- * PersistenceXmlSchemaGenerationTab
- */
-public class PersistenceXmlSchemaGenerationTab
- extends FormPane<SchemaGeneration>
- implements JpaPageComposite
-{
- // ********** constructors/initialization **********
- public PersistenceXmlSchemaGenerationTab(
- PropertyValueModel<SchemaGeneration> subjectHolder,
- Composite parent,
- WidgetFactory widgetFactory) {
-
- super(subjectHolder, parent, widgetFactory);
- }
-
- @Override
- protected void initializeLayout(Composite container) {
- new EclipseLinkSchemaGenerationComposite(this, container);
- }
-
- // ********** JpaPageComposite implementation **********
-
- public String getHelpID() {
- return EclipseLinkHelpContextIds.PERSISTENCE_SCHEMA_GENERATION;
- }
-
- public Image getPageImage() {
- return null;
- }
-
- public String getPageText() {
- return EclipseLinkUiMessages.PersistenceXmlSchemaGenerationTab_title;
- }
-} \ No newline at end of file
diff --git a/jpa/plugins/org.eclipse.jpt.eclipselink.ui/src/org/eclipse/jpt/eclipselink/ui/internal/persistencexml/details/EclipseLinkNavigatorItemContentProviderFactory.java b/jpa/plugins/org.eclipse.jpt.eclipselink.ui/src/org/eclipse/jpt/eclipselink/ui/internal/persistencexml/details/EclipseLinkNavigatorItemContentProviderFactory.java
deleted file mode 100644
index f921d3bc40..0000000000
--- a/jpa/plugins/org.eclipse.jpt.eclipselink.ui/src/org/eclipse/jpt/eclipselink/ui/internal/persistencexml/details/EclipseLinkNavigatorItemContentProviderFactory.java
+++ /dev/null
@@ -1,94 +0,0 @@
-/*******************************************************************************
- * Copyright (c) 2008, 2009 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.
- *
- * Contributors:
- * Oracle - initial API and implementation
- *******************************************************************************/
-package org.eclipse.jpt.eclipselink.ui.internal.persistencexml.details;
-
-import java.util.ArrayList;
-import java.util.List;
-import org.eclipse.jpt.core.context.JpaContextNode;
-import org.eclipse.jpt.core.context.MappingFile;
-import org.eclipse.jpt.core.context.persistence.MappingFileRef;
-import org.eclipse.jpt.eclipselink.core.internal.context.persistence.EclipseLinkPersistenceUnit;
-import org.eclipse.jpt.ui.internal.jface.DelegatingTreeContentAndLabelProvider;
-import org.eclipse.jpt.ui.internal.platform.generic.GenericNavigatorItemContentProviderFactory;
-import org.eclipse.jpt.ui.jface.DelegatingContentAndLabelProvider;
-import org.eclipse.jpt.ui.jface.TreeItemContentProvider;
-import org.eclipse.jpt.ui.jface.TreeItemContentProviderFactory;
-import org.eclipse.jpt.utility.internal.model.value.CompositeCollectionValueModel;
-import org.eclipse.jpt.utility.internal.model.value.PropertyAspectAdapter;
-import org.eclipse.jpt.utility.internal.model.value.PropertyCollectionValueModelAdapter;
-import org.eclipse.jpt.utility.model.value.CollectionValueModel;
-
-/**
- * EclipseLinkNavigatorItemContentProviderFactory
- */
-public class EclipseLinkNavigatorItemContentProviderFactory
- extends GenericNavigatorItemContentProviderFactory
- implements TreeItemContentProviderFactory
-{
- @Override
- public TreeItemContentProvider buildItemContentProvider(
- Object item, DelegatingContentAndLabelProvider contentAndLabelProvider) {
- DelegatingTreeContentAndLabelProvider treeContentAndLabelProvider =
- (DelegatingTreeContentAndLabelProvider) contentAndLabelProvider;
-
- if (item instanceof EclipseLinkPersistenceUnit) {
- return new EclipseLinkPersistenceUnitItemContentProvider(
- (EclipseLinkPersistenceUnit) item, treeContentAndLabelProvider);
- }
-
- return super.buildItemContentProvider(item, contentAndLabelProvider);
- }
-
-
- public static class EclipseLinkPersistenceUnitItemContentProvider
- extends PersistenceUnitItemContentProvider
- {
- public EclipseLinkPersistenceUnitItemContentProvider(
- EclipseLinkPersistenceUnit persistenceUnit, DelegatingTreeContentAndLabelProvider contentProvider) {
- super(persistenceUnit, contentProvider);
- }
-
- @Override
- public EclipseLinkPersistenceUnit getModel() {
- return (EclipseLinkPersistenceUnit) super.getModel();
- }
-
- @Override
- protected CollectionValueModel<JpaContextNode> buildChildrenModel() {
- List<CollectionValueModel<? extends JpaContextNode>> list = new ArrayList<CollectionValueModel<? extends JpaContextNode>>();
- list.add(buildSpecifiedOrmXmlCvm());
- list.add(buildImpliedMappingFileCvm());
- list.add(buildImpliedEclipseLinkMappingFileCvm());
- list.add(buildPersistentTypeCvm());
- list.add(buildJarFileCvm());
- return new CompositeCollectionValueModel<CollectionValueModel<? extends JpaContextNode>, JpaContextNode>(list);
- }
-
- private CollectionValueModel<MappingFile> buildImpliedEclipseLinkMappingFileCvm() {
- return new PropertyCollectionValueModelAdapter<MappingFile>(
- new PropertyAspectAdapter<MappingFileRef, MappingFile>(
- new PropertyAspectAdapter<EclipseLinkPersistenceUnit, MappingFileRef>(
- EclipseLinkPersistenceUnit.IMPLIED_ECLIPSELINK_MAPPING_FILE_REF_PROPERTY,
- getModel()) {
- @Override
- protected MappingFileRef buildValue_() {
- return subject.getImpliedEclipseLinkMappingFileRef();
- }
- },
- MappingFileRef.MAPPING_FILE_PROPERTY) {
- @Override
- protected MappingFile buildValue_() {
- return subject.getMappingFile();
- }
- }
- );
- }
- }
-}
diff --git a/jpa/plugins/org.eclipse.jpt.eclipselink.ui/src/org/eclipse/jpt/eclipselink/ui/internal/persistencexml/details/EclipseLinkNavigatorItemLabelProviderFactory.java b/jpa/plugins/org.eclipse.jpt.eclipselink.ui/src/org/eclipse/jpt/eclipselink/ui/internal/persistencexml/details/EclipseLinkNavigatorItemLabelProviderFactory.java
deleted file mode 100644
index 6fa03d383d..0000000000
--- a/jpa/plugins/org.eclipse.jpt.eclipselink.ui/src/org/eclipse/jpt/eclipselink/ui/internal/persistencexml/details/EclipseLinkNavigatorItemLabelProviderFactory.java
+++ /dev/null
@@ -1,23 +0,0 @@
-/*******************************************************************************
- * Copyright (c) 2008 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.
- *
- * Contributors:
- * Oracle - initial API and implementation
- *******************************************************************************/
-package org.eclipse.jpt.eclipselink.ui.internal.persistencexml.details;
-
-import org.eclipse.jpt.ui.internal.platform.generic.GenericNavigatorItemLabelProviderFactory;
-import org.eclipse.jpt.ui.jface.ItemLabelProviderFactory;
-
-/**
- * EclipseLinkNavigatorItemLabelProviderFactory
- */
-public class EclipseLinkNavigatorItemLabelProviderFactory
- extends GenericNavigatorItemLabelProviderFactory
- implements ItemLabelProviderFactory
-{
-
-}
diff --git a/jpa/plugins/org.eclipse.jpt.eclipselink.ui/src/org/eclipse/jpt/eclipselink/ui/internal/platform/EclipseLinkJpaPlatformUi.java b/jpa/plugins/org.eclipse.jpt.eclipselink.ui/src/org/eclipse/jpt/eclipselink/ui/internal/platform/EclipseLinkJpaPlatformUi.java
deleted file mode 100644
index 5ceaa9e93e..0000000000
--- a/jpa/plugins/org.eclipse.jpt.eclipselink.ui/src/org/eclipse/jpt/eclipselink/ui/internal/platform/EclipseLinkJpaPlatformUi.java
+++ /dev/null
@@ -1,40 +0,0 @@
-/*******************************************************************************
- * Copyright (c) 2008, 2009 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.
- *
- * Contributors:
- * Oracle - initial API and implementation
- *******************************************************************************/
-package org.eclipse.jpt.eclipselink.ui.internal.platform;
-
-import org.eclipse.jface.viewers.IStructuredSelection;
-import org.eclipse.jpt.core.JpaProject;
-import org.eclipse.jpt.eclipselink.ui.internal.ddlgen.EclipseLinkDDLGeneratorUi;
-import org.eclipse.jpt.ui.JpaPlatformUiProvider;
-import org.eclipse.jpt.ui.JpaUiFactory;
-import org.eclipse.jpt.ui.internal.platform.base.BaseJpaPlatformUi;
-import org.eclipse.jpt.ui.navigator.JpaNavigatorProvider;
-import org.eclipse.jpt.ui.structure.JpaStructureProvider;
-
-public class EclipseLinkJpaPlatformUi
- extends BaseJpaPlatformUi
-{
- public EclipseLinkJpaPlatformUi(
- JpaUiFactory jpaUiFactory,
- JpaNavigatorProvider navigatorProvider,
- JpaStructureProvider persistenceStructureProvider,
- JpaStructureProvider javaStructureProvider,
- JpaPlatformUiProvider... platformUiProviders)
- {
- super(jpaUiFactory, navigatorProvider, persistenceStructureProvider, javaStructureProvider, platformUiProviders);
- }
-
- // ********** DDL generation **********
-
- public void generateDDL(JpaProject project, IStructuredSelection selection) {
- EclipseLinkDDLGeneratorUi.generate(project);
- }
-
-}
diff --git a/jpa/plugins/org.eclipse.jpt.eclipselink.ui/src/org/eclipse/jpt/eclipselink/ui/internal/platform/EclipseLinkJpaPlatformUiFactory.java b/jpa/plugins/org.eclipse.jpt.eclipselink.ui/src/org/eclipse/jpt/eclipselink/ui/internal/platform/EclipseLinkJpaPlatformUiFactory.java
deleted file mode 100644
index 1170972245..0000000000
--- a/jpa/plugins/org.eclipse.jpt.eclipselink.ui/src/org/eclipse/jpt/eclipselink/ui/internal/platform/EclipseLinkJpaPlatformUiFactory.java
+++ /dev/null
@@ -1,39 +0,0 @@
-/*******************************************************************************
- * Copyright (c) 2009 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.
- *
- * Contributors:
- * Oracle - initial API and implementation
- ******************************************************************************/
-package org.eclipse.jpt.eclipselink.ui.internal.platform;
-
-import org.eclipse.jpt.eclipselink.ui.internal.EclipseLinkJpaUiFactory;
-import org.eclipse.jpt.eclipselink.ui.internal.structure.EclipseLinkPersistenceResourceModelStructureProvider;
-import org.eclipse.jpt.ui.JpaPlatformUi;
-import org.eclipse.jpt.ui.JpaPlatformUiFactory;
-import org.eclipse.jpt.ui.internal.GenericJpaPlatformUiProvider;
-import org.eclipse.jpt.ui.internal.structure.JavaResourceModelStructureProvider;
-
-public class EclipseLinkJpaPlatformUiFactory implements JpaPlatformUiFactory
-{
-
- /**
- * Zero arg constructor for extension point
- */
- public EclipseLinkJpaPlatformUiFactory() {
- super();
- }
-
- public JpaPlatformUi buildJpaPlatformUi() {
- return new EclipseLinkJpaPlatformUi(
- new EclipseLinkJpaUiFactory(),
- new EclipseLinkNavigatorProvider(),
- JavaResourceModelStructureProvider.instance(),
- EclipseLinkPersistenceResourceModelStructureProvider.instance(),
- GenericJpaPlatformUiProvider.instance(),
- EclipseLinkJpaPlatformUiProvider.instance()
- );
- }
-}
diff --git a/jpa/plugins/org.eclipse.jpt.eclipselink.ui/src/org/eclipse/jpt/eclipselink/ui/internal/platform/EclipseLinkJpaPlatformUiProvider.java b/jpa/plugins/org.eclipse.jpt.eclipselink.ui/src/org/eclipse/jpt/eclipselink/ui/internal/platform/EclipseLinkJpaPlatformUiProvider.java
deleted file mode 100644
index 0bae1c3443..0000000000
--- a/jpa/plugins/org.eclipse.jpt.eclipselink.ui/src/org/eclipse/jpt/eclipselink/ui/internal/platform/EclipseLinkJpaPlatformUiProvider.java
+++ /dev/null
@@ -1,132 +0,0 @@
-/*******************************************************************************
- * Copyright (c) 2007, 2009 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.
- *
- * Contributors:
- * Oracle - initial API and implementation
- ******************************************************************************/
-package org.eclipse.jpt.eclipselink.ui.internal.platform;
-
-import java.util.List;
-import org.eclipse.jpt.core.context.AttributeMapping;
-import org.eclipse.jpt.eclipselink.ui.internal.java.details.DefaultOneToManyMappingUiProvider;
-import org.eclipse.jpt.eclipselink.ui.internal.java.details.DefaultOneToOneMappingUiProvider;
-import org.eclipse.jpt.eclipselink.ui.internal.java.details.DefaultVariableOneToOneMappingUiProvider;
-import org.eclipse.jpt.eclipselink.ui.internal.java.details.EclipseLinkJavaBasicCollectionMappingUiProvider;
-import org.eclipse.jpt.eclipselink.ui.internal.java.details.EclipseLinkJavaBasicMapMappingUiProvider;
-import org.eclipse.jpt.eclipselink.ui.internal.java.details.EclipseLinkJavaTransformationMappingUiProvider;
-import org.eclipse.jpt.eclipselink.ui.internal.java.details.EclipseLinkJavaVariableOneToOneMappingUiProvider;
-import org.eclipse.jpt.eclipselink.ui.internal.orm.details.EclipseLinkEntityMappingsDetailsProvider;
-import org.eclipse.jpt.eclipselink.ui.internal.orm.details.EclipseLinkOrmBasicCollectionMappingUiProvider;
-import org.eclipse.jpt.eclipselink.ui.internal.orm.details.EclipseLinkOrmBasicMapMappingUiProvider;
-import org.eclipse.jpt.eclipselink.ui.internal.orm.details.EclipseLinkOrmBasicMappingUiProvider;
-import org.eclipse.jpt.eclipselink.ui.internal.orm.details.EclipseLinkOrmEmbeddableUiProvider;
-import org.eclipse.jpt.eclipselink.ui.internal.orm.details.EclipseLinkOrmEmbeddedIdMappingUiProvider;
-import org.eclipse.jpt.eclipselink.ui.internal.orm.details.EclipseLinkOrmEmbeddedMappingUiProvider;
-import org.eclipse.jpt.eclipselink.ui.internal.orm.details.EclipseLinkOrmEntityUiProvider;
-import org.eclipse.jpt.eclipselink.ui.internal.orm.details.EclipseLinkOrmIdMappingUiProvider;
-import org.eclipse.jpt.eclipselink.ui.internal.orm.details.EclipseLinkOrmManyToManyMappingUiProvider;
-import org.eclipse.jpt.eclipselink.ui.internal.orm.details.EclipseLinkOrmManyToOneMappingUiProvider;
-import org.eclipse.jpt.eclipselink.ui.internal.orm.details.EclipseLinkOrmMappedSuperclassUiProvider;
-import org.eclipse.jpt.eclipselink.ui.internal.orm.details.EclipseLinkOrmOneToManyMappingUiProvider;
-import org.eclipse.jpt.eclipselink.ui.internal.orm.details.EclipseLinkOrmOneToOneMappingUiProvider;
-import org.eclipse.jpt.eclipselink.ui.internal.orm.details.EclipseLinkOrmTransformationMappingUiProvider;
-import org.eclipse.jpt.eclipselink.ui.internal.orm.details.EclipseLinkOrmTransientMappingUiProvider;
-import org.eclipse.jpt.eclipselink.ui.internal.orm.details.EclipseLinkOrmVariableOneToOneMappingUiProvider;
-import org.eclipse.jpt.eclipselink.ui.internal.orm.details.EclipseLinkOrmVersionMappingUiProvider;
-import org.eclipse.jpt.eclipselink.ui.internal.structure.EclipseLinkOrmResourceModelStructureProvider;
-import org.eclipse.jpt.ui.JpaPlatformUiProvider;
-import org.eclipse.jpt.ui.details.AttributeMappingUiProvider;
-import org.eclipse.jpt.ui.details.DefaultAttributeMappingUiProvider;
-import org.eclipse.jpt.ui.details.DefaultTypeMappingUiProvider;
-import org.eclipse.jpt.ui.details.JpaDetailsProvider;
-import org.eclipse.jpt.ui.details.TypeMappingUiProvider;
-import org.eclipse.jpt.ui.internal.AbstractJpaPlatformUiProvider;
-import org.eclipse.jpt.ui.structure.JpaStructureProvider;
-
-public class EclipseLinkJpaPlatformUiProvider extends AbstractJpaPlatformUiProvider
-{
-
- // singleton
- private static final JpaPlatformUiProvider INSTANCE = new EclipseLinkJpaPlatformUiProvider();
-
- /**
- * Return the singleton.
- */
- public static JpaPlatformUiProvider instance() {
- return INSTANCE;
- }
-
- /**
- * Ensure single instance.
- */
- private EclipseLinkJpaPlatformUiProvider() {
- super();
- }
-
-
- // ********** details providers **********
-
- @Override
- protected void addDetailsProvidersTo(List<JpaDetailsProvider> providers) {
- providers.add(EclipseLinkEntityMappingsDetailsProvider.instance());
- }
-
-
- // ********** structure providers **********
-
- @Override
- protected void addMappingFileStructureProvidersTo(List<JpaStructureProvider> providers) {
- providers.add(EclipseLinkOrmResourceModelStructureProvider.instance());
- }
-
-
- // ********** type mapping ui providers **********
-
- @Override
- protected void addTypeMappingUiProvidersTo(List<TypeMappingUiProvider<?>> providers) {
- providers.add(EclipseLinkOrmEntityUiProvider.instance());
- providers.add(EclipseLinkOrmMappedSuperclassUiProvider.instance());
- providers.add(EclipseLinkOrmEmbeddableUiProvider.instance());
- }
-
- @Override
- protected void addDefaultTypeMappingUiProvidersTo(List<DefaultTypeMappingUiProvider<?>> providers) {
- //none specific to EclipseLink
- }
-
-
- // ********** attribute mapping ui providers **********
-
- @Override
- protected void addAttributeMappingUiProvidersTo(List<AttributeMappingUiProvider<? extends AttributeMapping>> providers) {
- providers.add(EclipseLinkJavaBasicCollectionMappingUiProvider.instance());
- providers.add(EclipseLinkJavaBasicMapMappingUiProvider.instance());
- providers.add(EclipseLinkJavaVariableOneToOneMappingUiProvider.instance());
- providers.add(EclipseLinkJavaTransformationMappingUiProvider.instance());
-
- providers.add(EclipseLinkOrmIdMappingUiProvider.instance());
- providers.add(EclipseLinkOrmEmbeddedIdMappingUiProvider.instance());
- providers.add(EclipseLinkOrmBasicMappingUiProvider.instance());
- providers.add(EclipseLinkOrmBasicCollectionMappingUiProvider.instance());
- providers.add(EclipseLinkOrmBasicMapMappingUiProvider.instance());
- providers.add(EclipseLinkOrmVersionMappingUiProvider.instance());
- providers.add(EclipseLinkOrmManyToOneMappingUiProvider.instance());
- providers.add(EclipseLinkOrmOneToManyMappingUiProvider.instance());
- providers.add(EclipseLinkOrmEmbeddedMappingUiProvider.instance());
- providers.add(EclipseLinkOrmOneToOneMappingUiProvider.instance());
- providers.add(EclipseLinkOrmVariableOneToOneMappingUiProvider.instance());
- providers.add(EclipseLinkOrmManyToManyMappingUiProvider.instance());
- providers.add(EclipseLinkOrmTransformationMappingUiProvider.instance());
- providers.add(EclipseLinkOrmTransientMappingUiProvider.instance());
- }
-
- @Override
- protected void addDefaultAttributeMappingUiProvidersTo(List<DefaultAttributeMappingUiProvider<? extends AttributeMapping>> providers) {
- providers.add(DefaultOneToOneMappingUiProvider.instance());
- providers.add(DefaultOneToManyMappingUiProvider.instance());
- providers.add(DefaultVariableOneToOneMappingUiProvider.instance());
- }
-}
diff --git a/jpa/plugins/org.eclipse.jpt.eclipselink.ui/src/org/eclipse/jpt/eclipselink/ui/internal/platform/EclipseLinkNavigatorProvider.java b/jpa/plugins/org.eclipse.jpt.eclipselink.ui/src/org/eclipse/jpt/eclipselink/ui/internal/platform/EclipseLinkNavigatorProvider.java
deleted file mode 100644
index f8e5c4b3d3..0000000000
--- a/jpa/plugins/org.eclipse.jpt.eclipselink.ui/src/org/eclipse/jpt/eclipselink/ui/internal/platform/EclipseLinkNavigatorProvider.java
+++ /dev/null
@@ -1,34 +0,0 @@
-/*******************************************************************************
- * Copyright (c) 2008 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.
- *
- * Contributors:
- * Oracle - initial API and implementation
- *******************************************************************************/
-package org.eclipse.jpt.eclipselink.ui.internal.platform;
-
-import org.eclipse.jpt.eclipselink.ui.internal.persistencexml.details.EclipseLinkNavigatorItemContentProviderFactory;
-import org.eclipse.jpt.eclipselink.ui.internal.persistencexml.details.EclipseLinkNavigatorItemLabelProviderFactory;
-import org.eclipse.jpt.ui.jface.ItemLabelProviderFactory;
-import org.eclipse.jpt.ui.jface.TreeItemContentProviderFactory;
-import org.eclipse.jpt.ui.navigator.JpaNavigatorProvider;
-
-/**
- * EclipseLinkNavigatorProvider
- */
-public class EclipseLinkNavigatorProvider implements JpaNavigatorProvider
-{
- public ItemLabelProviderFactory getItemLabelProviderFactory() {
- return new EclipseLinkNavigatorItemLabelProviderFactory();
- }
-
- public TreeItemContentProviderFactory getTreeItemContentProviderFactory() {
- return new EclipseLinkNavigatorItemContentProviderFactory();
- }
-
- public void dispose() {
-
- }
-}
diff --git a/jpa/plugins/org.eclipse.jpt.eclipselink.ui/src/org/eclipse/jpt/eclipselink/ui/internal/structure/EclipseLinkOrmResourceModelStructureProvider.java b/jpa/plugins/org.eclipse.jpt.eclipselink.ui/src/org/eclipse/jpt/eclipselink/ui/internal/structure/EclipseLinkOrmResourceModelStructureProvider.java
deleted file mode 100644
index 656ba8c0a4..0000000000
--- a/jpa/plugins/org.eclipse.jpt.eclipselink.ui/src/org/eclipse/jpt/eclipselink/ui/internal/structure/EclipseLinkOrmResourceModelStructureProvider.java
+++ /dev/null
@@ -1,52 +0,0 @@
-/*******************************************************************************
- * Copyright (c) 2008, 2009 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.
- *
- * Contributors:
- * Oracle - initial API and implementation
- ******************************************************************************/
-package org.eclipse.jpt.eclipselink.ui.internal.structure;
-
-import org.eclipse.core.runtime.content.IContentType;
-import org.eclipse.jpt.eclipselink.core.internal.JptEclipseLinkCorePlugin;
-import org.eclipse.jpt.ui.internal.structure.OrmItemContentProviderFactory;
-import org.eclipse.jpt.ui.internal.structure.OrmItemLabelProviderFactory;
-import org.eclipse.jpt.ui.jface.ItemLabelProviderFactory;
-import org.eclipse.jpt.ui.jface.TreeItemContentProviderFactory;
-import org.eclipse.jpt.ui.structure.JpaStructureProvider;
-
-public class EclipseLinkOrmResourceModelStructureProvider
- implements JpaStructureProvider
-{
- // singleton
- private static final JpaStructureProvider INSTANCE = new EclipseLinkOrmResourceModelStructureProvider();
-
- /**
- * Return the singleton.
- */
- public static JpaStructureProvider instance() {
- return INSTANCE;
- }
-
- /**
- * Ensure single instance.
- */
- private EclipseLinkOrmResourceModelStructureProvider() {
- super();
- }
-
- public IContentType getContentType() {
- return JptEclipseLinkCorePlugin.ECLIPSELINK_ORM_XML_CONTENT_TYPE;
- }
-
- public TreeItemContentProviderFactory getTreeItemContentProviderFactory() {
- return new OrmItemContentProviderFactory();
- }
-
- public ItemLabelProviderFactory getItemLabelProviderFactory() {
- return new OrmItemLabelProviderFactory();
- }
-
-}
diff --git a/jpa/plugins/org.eclipse.jpt.eclipselink.ui/src/org/eclipse/jpt/eclipselink/ui/internal/structure/EclipseLinkPersistenceItemContentProviderFactory.java b/jpa/plugins/org.eclipse.jpt.eclipselink.ui/src/org/eclipse/jpt/eclipselink/ui/internal/structure/EclipseLinkPersistenceItemContentProviderFactory.java
deleted file mode 100644
index 2e89f7f8e0..0000000000
--- a/jpa/plugins/org.eclipse.jpt.eclipselink.ui/src/org/eclipse/jpt/eclipselink/ui/internal/structure/EclipseLinkPersistenceItemContentProviderFactory.java
+++ /dev/null
@@ -1,137 +0,0 @@
-/*******************************************************************************
- * Copyright (c) 2008, 2009 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.
- *
- * Contributors:
- * Oracle - initial API and implementation
- *******************************************************************************/
-package org.eclipse.jpt.eclipselink.ui.internal.structure;
-
-import java.util.ArrayList;
-import java.util.Iterator;
-import java.util.List;
-import java.util.ListIterator;
-
-import org.eclipse.jpt.core.JpaStructureNode;
-import org.eclipse.jpt.core.context.persistence.ClassRef;
-import org.eclipse.jpt.core.context.persistence.MappingFileRef;
-import org.eclipse.jpt.core.context.persistence.PersistenceUnit;
-import org.eclipse.jpt.eclipselink.core.internal.context.persistence.EclipseLinkPersistenceUnit;
-import org.eclipse.jpt.ui.internal.jface.DelegatingTreeContentAndLabelProvider;
-import org.eclipse.jpt.ui.internal.structure.PersistenceItemContentProviderFactory;
-import org.eclipse.jpt.ui.jface.DelegatingContentAndLabelProvider;
-import org.eclipse.jpt.ui.jface.TreeItemContentProvider;
-import org.eclipse.jpt.utility.internal.model.value.CollectionAspectAdapter;
-import org.eclipse.jpt.utility.internal.model.value.CompositeCollectionValueModel;
-import org.eclipse.jpt.utility.internal.model.value.ListAspectAdapter;
-import org.eclipse.jpt.utility.internal.model.value.ListCollectionValueModelAdapter;
-import org.eclipse.jpt.utility.internal.model.value.PropertyAspectAdapter;
-import org.eclipse.jpt.utility.internal.model.value.PropertyCollectionValueModelAdapter;
-import org.eclipse.jpt.utility.model.value.CollectionValueModel;
-
-public class EclipseLinkPersistenceItemContentProviderFactory
- extends PersistenceItemContentProviderFactory
-{
- @Override
- public TreeItemContentProvider buildItemContentProvider(
- Object item, DelegatingContentAndLabelProvider contentAndLabelProvider) {
- DelegatingTreeContentAndLabelProvider treeContentProvider = (DelegatingTreeContentAndLabelProvider) contentAndLabelProvider;
- if (item instanceof EclipseLinkPersistenceUnit) {
- return new EclipseLinkPersistenceUnitItemContentProvider((EclipseLinkPersistenceUnit) item, treeContentProvider);
- }
- return super.buildItemContentProvider(item, contentAndLabelProvider);
- }
-
-
- public static class EclipseLinkPersistenceUnitItemContentProvider
- extends PersistenceUnitItemContentProvider
- {
- public EclipseLinkPersistenceUnitItemContentProvider(
- EclipseLinkPersistenceUnit persistenceUnit, DelegatingTreeContentAndLabelProvider contentProvider) {
- super(persistenceUnit, contentProvider);
- }
-
- @Override
- public EclipseLinkPersistenceUnit getModel() {
- return (EclipseLinkPersistenceUnit) super.getModel();
- }
-
- @Override
- protected CollectionValueModel<JpaStructureNode> buildChildrenModel() {
- CollectionValueModel<MappingFileRef> specifiedMappingFileCvm =
- new ListCollectionValueModelAdapter<MappingFileRef>(
- new ListAspectAdapter<PersistenceUnit, MappingFileRef>(
- PersistenceUnit.SPECIFIED_MAPPING_FILE_REFS_LIST,
- getModel()) {
- @Override
- protected ListIterator<MappingFileRef> listIterator_() {
- return subject.specifiedMappingFileRefs();
- }
- @Override
- protected int size_() {
- return subject.specifiedMappingFileRefsSize();
- }
- });
-
- CollectionValueModel<MappingFileRef> impliedMappingFileCvm =
- new PropertyCollectionValueModelAdapter<MappingFileRef>(
- new PropertyAspectAdapter<PersistenceUnit, MappingFileRef>(
- PersistenceUnit.IMPLIED_MAPPING_FILE_REF_PROPERTY,
- getModel()) {
- @Override
- protected MappingFileRef buildValue_() {
- return subject.getImpliedMappingFileRef();
- }
- }
- );
- CollectionValueModel<MappingFileRef> impliedEclipseLinkMappingFileCvm =
- new PropertyCollectionValueModelAdapter<MappingFileRef>(
- new PropertyAspectAdapter<EclipseLinkPersistenceUnit, MappingFileRef>(
- EclipseLinkPersistenceUnit.IMPLIED_ECLIPSELINK_MAPPING_FILE_REF_PROPERTY,
- getModel()) {
- @Override
- protected MappingFileRef buildValue_() {
- return subject.getImpliedEclipseLinkMappingFileRef();
- }
- }
- );
- CollectionValueModel<ClassRef> specifiedClassCvm =
- new ListCollectionValueModelAdapter<ClassRef>(
- new ListAspectAdapter<PersistenceUnit, ClassRef>(
- PersistenceUnit.SPECIFIED_CLASS_REFS_LIST,
- getModel()) {
- @Override
- protected ListIterator<ClassRef> listIterator_() {
- return subject.specifiedClassRefs();
- }
- @Override
- protected int size_() {
- return subject.specifiedClassRefsSize();
- }
- });
- CollectionValueModel<ClassRef> impliedClassCvm =
- new CollectionAspectAdapter<PersistenceUnit, ClassRef>(
- PersistenceUnit.IMPLIED_CLASS_REFS_COLLECTION,
- getModel()) {
- @Override
- protected Iterator<ClassRef> iterator_() {
- return subject.impliedClassRefs();
- }
- @Override
- protected int size_() {
- return subject.impliedClassRefsSize();
- }
- };
- List<CollectionValueModel<? extends JpaStructureNode>> list = new ArrayList<CollectionValueModel<? extends JpaStructureNode>>(4);
- list.add(specifiedMappingFileCvm);
- list.add(impliedMappingFileCvm);
- list.add(impliedEclipseLinkMappingFileCvm);
- list.add(specifiedClassCvm);
- list.add(impliedClassCvm);
-
- return new CompositeCollectionValueModel<CollectionValueModel<? extends JpaStructureNode>, JpaStructureNode>(list);
- }
- }
-}
diff --git a/jpa/plugins/org.eclipse.jpt.eclipselink.ui/src/org/eclipse/jpt/eclipselink/ui/internal/structure/EclipseLinkPersistenceResourceModelStructureProvider.java b/jpa/plugins/org.eclipse.jpt.eclipselink.ui/src/org/eclipse/jpt/eclipselink/ui/internal/structure/EclipseLinkPersistenceResourceModelStructureProvider.java
deleted file mode 100644
index 5502d26936..0000000000
--- a/jpa/plugins/org.eclipse.jpt.eclipselink.ui/src/org/eclipse/jpt/eclipselink/ui/internal/structure/EclipseLinkPersistenceResourceModelStructureProvider.java
+++ /dev/null
@@ -1,51 +0,0 @@
-/*******************************************************************************
- * Copyright (c) 2008, 2009 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.
- *
- * Contributors:
- * Oracle - initial API and implementation
- ******************************************************************************/
-package org.eclipse.jpt.eclipselink.ui.internal.structure;
-
-import org.eclipse.core.runtime.content.IContentType;
-import org.eclipse.jpt.core.JptCorePlugin;
-import org.eclipse.jpt.ui.internal.structure.PersistenceItemLabelProviderFactory;
-import org.eclipse.jpt.ui.jface.ItemLabelProviderFactory;
-import org.eclipse.jpt.ui.jface.TreeItemContentProviderFactory;
-import org.eclipse.jpt.ui.structure.JpaStructureProvider;
-
-public class EclipseLinkPersistenceResourceModelStructureProvider
- implements JpaStructureProvider
-{
- // singleton
- private static final JpaStructureProvider INSTANCE = new EclipseLinkPersistenceResourceModelStructureProvider();
-
- /**
- * Return the singleton.
- */
- public static JpaStructureProvider instance() {
- return INSTANCE;
- }
-
- /**
- * Ensure single instance.
- */
- private EclipseLinkPersistenceResourceModelStructureProvider() {
- super();
- }
-
- public IContentType getContentType() {
- return JptCorePlugin.PERSISTENCE_XML_CONTENT_TYPE;
- }
-
- public TreeItemContentProviderFactory getTreeItemContentProviderFactory() {
- return new EclipseLinkPersistenceItemContentProviderFactory();
- }
-
- public ItemLabelProviderFactory getItemLabelProviderFactory() {
- return new PersistenceItemLabelProviderFactory();
- }
-
-}
diff --git a/jpa/plugins/org.eclipse.jpt.eclipselink.ui/src/org/eclipse/jpt/eclipselink/ui/internal/wizards/EclipseLinkMappingFileWizard.java b/jpa/plugins/org.eclipse.jpt.eclipselink.ui/src/org/eclipse/jpt/eclipselink/ui/internal/wizards/EclipseLinkMappingFileWizard.java
deleted file mode 100644
index ce9e1172fa..0000000000
--- a/jpa/plugins/org.eclipse.jpt.eclipselink.ui/src/org/eclipse/jpt/eclipselink/ui/internal/wizards/EclipseLinkMappingFileWizard.java
+++ /dev/null
@@ -1,46 +0,0 @@
-/*******************************************************************************
- * Copyright (c) 2008 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
- *
- * Contributors:
- * Oracle - initial API and implementation
- *******************************************************************************/
-package org.eclipse.jpt.eclipselink.ui.internal.wizards;
-
-import org.eclipse.jpt.eclipselink.core.internal.operations.EclipseLinkOrmFileCreationDataModelProvider;
-import org.eclipse.jpt.eclipselink.ui.internal.EclipseLinkUiMessages;
-import org.eclipse.jpt.ui.internal.wizards.orm.MappingFileWizard;
-import org.eclipse.jpt.ui.internal.wizards.orm.MappingFileWizardPage;
-import org.eclipse.ui.INewWizard;
-import org.eclipse.wst.common.frameworks.datamodel.IDataModel;
-import org.eclipse.wst.common.frameworks.datamodel.IDataModelProvider;
-
-/**
- * This is referenced in the plugin.xml as an org.eclipse.ui.newWizards extension
- */
-public class EclipseLinkMappingFileWizard extends MappingFileWizard
- implements INewWizard
-{
- public EclipseLinkMappingFileWizard() {
- this(null);
- }
-
- public EclipseLinkMappingFileWizard(IDataModel dataModel) {
- super(dataModel);
- setWindowTitle(EclipseLinkUiMessages.MappingFileWizard_title);
- }
-
-
- @Override
- protected MappingFileWizardPage buildMappingFileWizardPage() {
- return new EclipseLinkMappingFileWizardPage(getDataModel(), "Page_1", EclipseLinkUiMessages.MappingFileWizardPage_title, EclipseLinkUiMessages.MappingFileWizardPage_desc);
- }
-
- @Override
- protected IDataModelProvider getDefaultProvider() {
- return new EclipseLinkOrmFileCreationDataModelProvider();
- }
-}
diff --git a/jpa/plugins/org.eclipse.jpt.eclipselink.ui/src/org/eclipse/jpt/eclipselink/ui/internal/wizards/EclipseLinkMappingFileWizardPage.java b/jpa/plugins/org.eclipse.jpt.eclipselink.ui/src/org/eclipse/jpt/eclipselink/ui/internal/wizards/EclipseLinkMappingFileWizardPage.java
deleted file mode 100644
index 5f168cd5ed..0000000000
--- a/jpa/plugins/org.eclipse.jpt.eclipselink.ui/src/org/eclipse/jpt/eclipselink/ui/internal/wizards/EclipseLinkMappingFileWizardPage.java
+++ /dev/null
@@ -1,24 +0,0 @@
-/*******************************************************************************
- * Copyright (c) 2008 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
- *
- * Contributors:
- * Oracle - initial API and implementation
- *******************************************************************************/
-package org.eclipse.jpt.eclipselink.ui.internal.wizards;
-
-import org.eclipse.jpt.ui.internal.wizards.orm.MappingFileWizardPage;
-import org.eclipse.wst.common.frameworks.datamodel.IDataModel;
-
-public class EclipseLinkMappingFileWizardPage extends MappingFileWizardPage
-{
- public EclipseLinkMappingFileWizardPage(IDataModel dataModel, String pageName, String title, String desc) {
- super(dataModel, pageName);
- setTitle(title);
- setDescription(desc);
- setPageComplete(false);
- }
-}
diff --git a/jpa/plugins/org.eclipse.jpt.eclipselink.ui/src/org/eclipse/jpt/eclipselink1_1/ui/internal/EclipseLink1_1JpaUiFactory.java b/jpa/plugins/org.eclipse.jpt.eclipselink.ui/src/org/eclipse/jpt/eclipselink1_1/ui/internal/EclipseLink1_1JpaUiFactory.java
deleted file mode 100644
index 63fe2c4c79..0000000000
--- a/jpa/plugins/org.eclipse.jpt.eclipselink.ui/src/org/eclipse/jpt/eclipselink1_1/ui/internal/EclipseLink1_1JpaUiFactory.java
+++ /dev/null
@@ -1,54 +0,0 @@
-/*******************************************************************************
- * Copyright (c) 2009 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.
- *
- * Contributors:
- * Oracle - initial API and implementation
- *******************************************************************************/
-package org.eclipse.jpt.eclipselink1_1.ui.internal;
-
-import org.eclipse.jpt.core.context.java.JavaEmbeddable;
-import org.eclipse.jpt.core.context.java.JavaEntity;
-import org.eclipse.jpt.core.context.java.JavaMappedSuperclass;
-import org.eclipse.jpt.eclipselink.ui.internal.EclipseLinkJpaUiFactory;
-import org.eclipse.jpt.eclipselink1_1.ui.internal.java.details.EclipseLink1_1JavaEmbeddableComposite;
-import org.eclipse.jpt.eclipselink1_1.ui.internal.java.details.EclipseLink1_1JavaEntityComposite;
-import org.eclipse.jpt.eclipselink1_1.ui.internal.java.details.EclipseLink1_1JavaMappedSuperclassComposite;
-import org.eclipse.jpt.ui.WidgetFactory;
-import org.eclipse.jpt.ui.details.JpaComposite;
-import org.eclipse.jpt.utility.model.value.PropertyValueModel;
-import org.eclipse.swt.widgets.Composite;
-
-public class EclipseLink1_1JpaUiFactory extends EclipseLinkJpaUiFactory //TODO just extend for now, but we need to change this to match the JpaPlatform
-{
- public EclipseLink1_1JpaUiFactory() {
- super();
- }
-
-
-
- // **************** java type mapping composites ***************************
-
- @Override
- public JpaComposite createJavaMappedSuperclassComposite(
- PropertyValueModel<JavaMappedSuperclass> subjectHolder,
- Composite parent, WidgetFactory widgetFactory) {
- return new EclipseLink1_1JavaMappedSuperclassComposite(subjectHolder, parent, widgetFactory);
- }
-
- @Override
- public JpaComposite createJavaEntityComposite(
- PropertyValueModel<JavaEntity> subjectHolder,
- Composite parent, WidgetFactory widgetFactory) {
- return new EclipseLink1_1JavaEntityComposite(subjectHolder, parent, widgetFactory);
- }
-
- @Override
- public JpaComposite createJavaEmbeddableComposite(
- PropertyValueModel<JavaEmbeddable> subjectHolder,
- Composite parent, WidgetFactory widgetFactory) {
- return new EclipseLink1_1JavaEmbeddableComposite(subjectHolder, parent, widgetFactory);
- }
-} \ No newline at end of file
diff --git a/jpa/plugins/org.eclipse.jpt.eclipselink.ui/src/org/eclipse/jpt/eclipselink1_1/ui/internal/java/details/EclipseLink1_1JavaEmbeddableComposite.java b/jpa/plugins/org.eclipse.jpt.eclipselink.ui/src/org/eclipse/jpt/eclipselink1_1/ui/internal/java/details/EclipseLink1_1JavaEmbeddableComposite.java
deleted file mode 100644
index 04aed00fb3..0000000000
--- a/jpa/plugins/org.eclipse.jpt.eclipselink.ui/src/org/eclipse/jpt/eclipselink1_1/ui/internal/java/details/EclipseLink1_1JavaEmbeddableComposite.java
+++ /dev/null
@@ -1,98 +0,0 @@
-/*******************************************************************************
- * Copyright (c) 2009 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.
- *
- * Contributors:
- * Oracle - initial API and implementation
- ******************************************************************************/
-package org.eclipse.jpt.eclipselink1_1.ui.internal.java.details;
-
-import org.eclipse.jpt.core.context.AccessHolder;
-import org.eclipse.jpt.core.context.java.JavaEmbeddable;
-import org.eclipse.jpt.eclipselink.core.context.java.EclipseLinkJavaEmbeddable;
-import org.eclipse.jpt.eclipselink.core.context.java.JavaConverterHolder;
-import org.eclipse.jpt.eclipselink.ui.internal.java.details.ConvertersComposite;
-import org.eclipse.jpt.eclipselink.ui.internal.mappings.EclipseLinkUiMappingsMessages;
-import org.eclipse.jpt.eclipselink.ui.internal.mappings.details.EclipseLinkEmbeddableAdvancedComposite;
-import org.eclipse.jpt.ui.WidgetFactory;
-import org.eclipse.jpt.ui.details.JpaComposite;
-import org.eclipse.jpt.ui.internal.details.AccessTypeComposite;
-import org.eclipse.jpt.ui.internal.widgets.FormPane;
-import org.eclipse.jpt.utility.internal.model.value.PropertyAspectAdapter;
-import org.eclipse.jpt.utility.model.value.PropertyValueModel;
-import org.eclipse.swt.widgets.Composite;
-
-/**
- * This pane does not have any widgets.
- *
- * @see Embeddable
- * @see BaseJpaUiFactory - The factory creating this pane
- * @see EmbeddableUiProvider
- *
- * @version 2.1
- * @since 2.1
- */
-public class EclipseLink1_1JavaEmbeddableComposite extends FormPane<JavaEmbeddable>
- implements JpaComposite
-{
- /**
- * Creates a new <code>EmbeddableComposite</code>.
- *
- * @param subjectHolder The holder of this pane's subject
- * @param parent The parent container
- * @param widgetFactory The factory used to create various common widgets
- */
- public EclipseLink1_1JavaEmbeddableComposite(PropertyValueModel<? extends JavaEmbeddable> subjectHolder,
- Composite parent,
- WidgetFactory widgetFactory) {
-
- super(subjectHolder, parent, widgetFactory);
- }
-
- @Override
- protected void initializeLayout(Composite container) {
- initializeGeneralPane(container);
- initializeConvertersPane(container);
- initializeAdvancedPane(container);
- }
-
- protected void initializeGeneralPane(Composite container) {
- new AccessTypeComposite(this, buildAccessHolder(), container);
- }
-
- protected PropertyValueModel<AccessHolder> buildAccessHolder() {
- return new PropertyAspectAdapter<JavaEmbeddable, AccessHolder>(
- getSubjectHolder())
- {
- @Override
- protected AccessHolder buildValue_() {
- return this.subject.getPersistentType();
- }
- };
- }
-
- protected void initializeConvertersPane(Composite container) {
-
- container = addCollapsableSection(
- addSubPane(container, 5),
- EclipseLinkUiMappingsMessages.EclipseLinkTypeMappingComposite_converters
- );
-
- new ConvertersComposite(this, buildConverterHolderValueModel(), container);
- }
-
- protected PropertyValueModel<JavaConverterHolder> buildConverterHolderValueModel() {
- return new PropertyAspectAdapter<JavaEmbeddable, JavaConverterHolder>(getSubjectHolder()) {
- @Override
- protected JavaConverterHolder buildValue_() {
- return ((EclipseLinkJavaEmbeddable) this.subject).getConverterHolder();
- }
- };
- }
-
- protected void initializeAdvancedPane(Composite container) {
- new EclipseLinkEmbeddableAdvancedComposite(this, container);
- }
-} \ No newline at end of file
diff --git a/jpa/plugins/org.eclipse.jpt.eclipselink.ui/src/org/eclipse/jpt/eclipselink1_1/ui/internal/java/details/EclipseLink1_1JavaEntityComposite.java b/jpa/plugins/org.eclipse.jpt.eclipselink.ui/src/org/eclipse/jpt/eclipselink1_1/ui/internal/java/details/EclipseLink1_1JavaEntityComposite.java
deleted file mode 100644
index 73bb441122..0000000000
--- a/jpa/plugins/org.eclipse.jpt.eclipselink.ui/src/org/eclipse/jpt/eclipselink1_1/ui/internal/java/details/EclipseLink1_1JavaEntityComposite.java
+++ /dev/null
@@ -1,147 +0,0 @@
-/*******************************************************************************
- * Copyright (c) 2008, 2009 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.
- *
- * Contributors:
- * Oracle - initial API and implementation
- ******************************************************************************/
-package org.eclipse.jpt.eclipselink1_1.ui.internal.java.details;
-
-import org.eclipse.jpt.core.context.AccessHolder;
-import org.eclipse.jpt.core.context.java.JavaEntity;
-import org.eclipse.jpt.eclipselink.core.context.java.EclipseLinkJavaEntity;
-import org.eclipse.jpt.eclipselink.core.context.java.JavaCaching;
-import org.eclipse.jpt.eclipselink.core.context.java.JavaConverterHolder;
-import org.eclipse.jpt.eclipselink.ui.internal.java.details.ConvertersComposite;
-import org.eclipse.jpt.eclipselink.ui.internal.java.details.JavaCachingComposite;
-import org.eclipse.jpt.eclipselink.ui.internal.mappings.EclipseLinkUiMappingsMessages;
-import org.eclipse.jpt.eclipselink.ui.internal.mappings.details.EclipseLinkEntityAdvancedComposite;
-import org.eclipse.jpt.ui.WidgetFactory;
-import org.eclipse.jpt.ui.internal.details.AccessTypeComposite;
-import org.eclipse.jpt.ui.internal.java.details.JavaInheritanceComposite;
-import org.eclipse.jpt.ui.internal.java.details.JavaSecondaryTablesComposite;
-import org.eclipse.jpt.ui.internal.mappings.details.AbstractEntityComposite;
-import org.eclipse.jpt.ui.internal.mappings.details.EntityNameComposite;
-import org.eclipse.jpt.ui.internal.mappings.details.IdClassComposite;
-import org.eclipse.jpt.ui.internal.mappings.details.TableComposite;
-import org.eclipse.jpt.utility.internal.model.value.PropertyAspectAdapter;
-import org.eclipse.jpt.utility.model.value.PropertyValueModel;
-import org.eclipse.swt.widgets.Composite;
-
-/**
- * The pane used for an EclipseLink1.1 Java entity.
- *
- * @see EclipseLinkJavaEntity
- * @see EclipselinkJpaUiFactory - The factory creating this pane
- *
- * @version 2.2
- * @since 2.2
- */
-public class EclipseLink1_1JavaEntityComposite extends AbstractEntityComposite<JavaEntity>
-{
- /**
- * Creates a new <code>EclipseLinkJavaEntityComposite</code>.
- *
- * @param subjectHolder The holder of the subject <code>JavaEntity</code>
- * @param parent The parent container
- * @param widgetFactory The factory used to create various common widgets
- */
- public EclipseLink1_1JavaEntityComposite(PropertyValueModel<? extends JavaEntity> subjectHolder,
- Composite parent,
- WidgetFactory widgetFactory) {
-
- super(subjectHolder, parent, widgetFactory);
- }
-
-
- @Override
- protected void initializeLayout(Composite container) {
- initializeGeneralPane(container);
- initializeCachingPane(container);
- initializeQueriesPane(container);
- initializeInheritancePane(container);
- initializeAttributeOverridesPane(container);
- initializeGeneratorsPane(container);
- initializeConvertersPane(container);
- initializeSecondaryTablesPane(container);
- initializeAdvancedPane(container);
- }
-
- @Override
- protected void initializeGeneralPane(Composite container) {
- int groupBoxMargin = getGroupBoxMargin();
-
- new TableComposite(this, container);
- new EntityNameComposite(this, addSubPane(container, 0, groupBoxMargin, 0, groupBoxMargin));
- new AccessTypeComposite(this, buildAccessHolder(), addSubPane(container, 0, groupBoxMargin, 0, groupBoxMargin));
- new IdClassComposite(this, addSubPane(container, 0, groupBoxMargin, 0, groupBoxMargin), false);
- }
-
- protected PropertyValueModel<AccessHolder> buildAccessHolder() {
- return new PropertyAspectAdapter<JavaEntity, AccessHolder>(
- getSubjectHolder())
- {
- @Override
- protected AccessHolder buildValue_() {
- return this.subject.getPersistentType();
- }
- };
- }
-
- protected void initializeCachingPane(Composite container) {
-
- container = addCollapsableSection(
- addSubPane(container, 5),
- EclipseLinkUiMappingsMessages.EclipseLinkTypeMappingComposite_caching
- );
-
- new JavaCachingComposite(this, buildCachingHolder(), container);
- }
-
- private PropertyAspectAdapter<JavaEntity, JavaCaching> buildCachingHolder() {
- return new PropertyAspectAdapter<JavaEntity, JavaCaching>(
- getSubjectHolder())
- {
- @Override
- protected JavaCaching buildValue_() {
- return ((EclipseLinkJavaEntity) this.subject).getCaching();
- }
- };
-
- }
-
- protected void initializeConvertersPane(Composite container) {
-
- container = addCollapsableSection(
- container,
- EclipseLinkUiMappingsMessages.EclipseLinkTypeMappingComposite_converters
- );
-
- new ConvertersComposite(this, buildConverterHolderValueModel(), container);
- }
-
- protected PropertyValueModel<JavaConverterHolder> buildConverterHolderValueModel() {
- return new PropertyAspectAdapter<JavaEntity, JavaConverterHolder>(getSubjectHolder()) {
- @Override
- protected JavaConverterHolder buildValue_() {
- return ((EclipseLinkJavaEntity) this.subject).getConverterHolder();
- }
- };
- }
-
- @Override
- protected void addSecondaryTablesComposite(Composite container) {
- new JavaSecondaryTablesComposite(this, container);
- }
-
- @Override
- protected void addInheritanceComposite(Composite container) {
- new JavaInheritanceComposite(this, container);
- }
-
- protected void initializeAdvancedPane(Composite container) {
- new EclipseLinkEntityAdvancedComposite(this, container);
- }
-} \ No newline at end of file
diff --git a/jpa/plugins/org.eclipse.jpt.eclipselink.ui/src/org/eclipse/jpt/eclipselink1_1/ui/internal/java/details/EclipseLink1_1JavaMappedSuperclassComposite.java b/jpa/plugins/org.eclipse.jpt.eclipselink.ui/src/org/eclipse/jpt/eclipselink1_1/ui/internal/java/details/EclipseLink1_1JavaMappedSuperclassComposite.java
deleted file mode 100644
index f8d64a990d..0000000000
--- a/jpa/plugins/org.eclipse.jpt.eclipselink.ui/src/org/eclipse/jpt/eclipselink1_1/ui/internal/java/details/EclipseLink1_1JavaMappedSuperclassComposite.java
+++ /dev/null
@@ -1,123 +0,0 @@
-/*******************************************************************************
- * Copyright (c) 2008 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.
- *
- * Contributors:
- * Oracle - initial API and implementation
- ******************************************************************************/
-package org.eclipse.jpt.eclipselink1_1.ui.internal.java.details;
-
-import org.eclipse.jpt.core.context.AccessHolder;
-import org.eclipse.jpt.core.context.java.JavaMappedSuperclass;
-import org.eclipse.jpt.eclipselink.core.context.java.EclipseLinkJavaMappedSuperclass;
-import org.eclipse.jpt.eclipselink.core.context.java.JavaCaching;
-import org.eclipse.jpt.eclipselink.core.context.java.JavaConverterHolder;
-import org.eclipse.jpt.eclipselink.ui.internal.java.details.ConvertersComposite;
-import org.eclipse.jpt.eclipselink.ui.internal.java.details.JavaCachingComposite;
-import org.eclipse.jpt.eclipselink.ui.internal.mappings.EclipseLinkUiMappingsMessages;
-import org.eclipse.jpt.eclipselink.ui.internal.mappings.details.EclipseLinkMappedSuperclassAdvancedComposite;
-import org.eclipse.jpt.ui.WidgetFactory;
-import org.eclipse.jpt.ui.details.JpaComposite;
-import org.eclipse.jpt.ui.internal.details.AccessTypeComposite;
-import org.eclipse.jpt.ui.internal.mappings.details.IdClassComposite;
-import org.eclipse.jpt.ui.internal.widgets.FormPane;
-import org.eclipse.jpt.utility.internal.model.value.PropertyAspectAdapter;
-import org.eclipse.jpt.utility.model.value.PropertyValueModel;
-import org.eclipse.swt.widgets.Composite;
-
-/**
- * The pane used for an EclipseLink Java Mapped Superclass.
- *
- * @see EclipseLinkMappedSuperclass
- * @see EclipselinkJpaUiFactory - The factory creating this pane
- *
- * @version 2.1
- * @since 2.1
- */
-public class EclipseLink1_1JavaMappedSuperclassComposite extends FormPane<JavaMappedSuperclass>
- implements JpaComposite
-{
- /**
- * Creates a new <code>MappedSuperclassComposite</code>.
- *
- * @param subjectHolder The holder of this pane's subject
- * @param parent The parent container
- * @param widgetFactory The factory used to create various common widgets
- */
- public EclipseLink1_1JavaMappedSuperclassComposite(PropertyValueModel<? extends JavaMappedSuperclass> subjectHolder,
- Composite parent,
- WidgetFactory widgetFactory) {
-
- super(subjectHolder, parent, widgetFactory);
- }
-
- @Override
- protected void initializeLayout(Composite container) {
- initializeGeneralPane(container);
- initializeCachingPane(container);
- initializeConvertersPane(container);
- initializeAdvancedPane(container);
- }
-
- protected void initializeGeneralPane(Composite container) {
- new AccessTypeComposite(this, buildAccessHolder(), container);
- new IdClassComposite(this, container);
- }
-
- protected PropertyValueModel<AccessHolder> buildAccessHolder() {
- return new PropertyAspectAdapter<JavaMappedSuperclass, AccessHolder>(
- getSubjectHolder())
- {
- @Override
- protected AccessHolder buildValue_() {
- return this.subject.getPersistentType();
- }
- };
- }
-
-
- protected void initializeCachingPane(Composite container) {
-
- container = addCollapsableSection(
- addSubPane(container, 5),
- EclipseLinkUiMappingsMessages.EclipseLinkTypeMappingComposite_caching
- );
-
- new JavaCachingComposite(this, buildCachingHolder(), container);
- }
-
- private PropertyAspectAdapter<JavaMappedSuperclass, JavaCaching> buildCachingHolder() {
- return new PropertyAspectAdapter<JavaMappedSuperclass, JavaCaching>(
- getSubjectHolder())
- {
- @Override
- protected JavaCaching buildValue_() {
- return ((EclipseLinkJavaMappedSuperclass) this.subject).getCaching();
- }
- };
- }
-
- protected void initializeConvertersPane(Composite container) {
- container = addCollapsableSection(
- container,
- EclipseLinkUiMappingsMessages.EclipseLinkTypeMappingComposite_converters
- );
-
- new ConvertersComposite(this, buildConverterHolderValueModel(), container);
- }
-
- protected PropertyValueModel<JavaConverterHolder> buildConverterHolderValueModel() {
- return new PropertyAspectAdapter<JavaMappedSuperclass, JavaConverterHolder>(getSubjectHolder()) {
- @Override
- protected JavaConverterHolder buildValue_() {
- return ((EclipseLinkJavaMappedSuperclass) this.subject).getConverterHolder();
- }
- };
- }
-
- protected void initializeAdvancedPane(Composite container) {
- new EclipseLinkMappedSuperclassAdvancedComposite(this, container);
- }
-} \ No newline at end of file
diff --git a/jpa/plugins/org.eclipse.jpt.eclipselink.ui/src/org/eclipse/jpt/eclipselink1_1/ui/internal/orm/details/EclipseLink1_1OrmBasicCollectionMappingComposite.java b/jpa/plugins/org.eclipse.jpt.eclipselink.ui/src/org/eclipse/jpt/eclipselink1_1/ui/internal/orm/details/EclipseLink1_1OrmBasicCollectionMappingComposite.java
deleted file mode 100644
index 1706e9e5c0..0000000000
--- a/jpa/plugins/org.eclipse.jpt.eclipselink.ui/src/org/eclipse/jpt/eclipselink1_1/ui/internal/orm/details/EclipseLink1_1OrmBasicCollectionMappingComposite.java
+++ /dev/null
@@ -1,57 +0,0 @@
-/*******************************************************************************
- * Copyright (c) 2009 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.
- *
- * Contributors:
- * Oracle - initial API and implementation
- ******************************************************************************/
-package org.eclipse.jpt.eclipselink1_1.ui.internal.orm.details;
-
-import org.eclipse.jpt.core.context.AccessHolder;
-import org.eclipse.jpt.eclipselink.core.context.BasicCollectionMapping;
-import org.eclipse.jpt.ui.WidgetFactory;
-import org.eclipse.jpt.ui.details.JpaComposite;
-import org.eclipse.jpt.ui.internal.details.AccessTypeComposite;
-import org.eclipse.jpt.ui.internal.widgets.FormPane;
-import org.eclipse.jpt.utility.internal.model.value.PropertyAspectAdapter;
-import org.eclipse.jpt.utility.model.value.PropertyValueModel;
-import org.eclipse.swt.widgets.Composite;
-
-/**
- *
- * @version 2.2
- * @since 2.2
- */
-public class EclipseLink1_1OrmBasicCollectionMappingComposite extends FormPane<BasicCollectionMapping>
- implements JpaComposite
-{
- /**
- * Creates a new <code>EclipseLinkBasicCollectionMappingComposite</code>.
- *
- * @param subjectHolder The holder of the subject <code>IManyToOneMapping</code>
- * @param parent The parent container
- * @param widgetFactory The factory used to create various common widgets
- */
- public EclipseLink1_1OrmBasicCollectionMappingComposite(PropertyValueModel<? extends BasicCollectionMapping> subjectHolder,
- Composite parent,
- WidgetFactory widgetFactory) {
-
- super(subjectHolder, parent, widgetFactory);
- }
-
- @Override
- protected void initializeLayout(Composite container) {
- new AccessTypeComposite(this, buildAccessHolderHolder(), container);
- }
-
- protected PropertyValueModel<AccessHolder> buildAccessHolderHolder() {
- return new PropertyAspectAdapter<BasicCollectionMapping, AccessHolder>(getSubjectHolder()) {
- @Override
- protected AccessHolder buildValue_() {
- return this.subject.getPersistentAttribute();
- }
- };
- }
-}
diff --git a/jpa/plugins/org.eclipse.jpt.eclipselink.ui/src/org/eclipse/jpt/eclipselink1_1/ui/internal/orm/details/EclipseLink1_1OrmBasicCollectionMappingUiProvider.java b/jpa/plugins/org.eclipse.jpt.eclipselink.ui/src/org/eclipse/jpt/eclipselink1_1/ui/internal/orm/details/EclipseLink1_1OrmBasicCollectionMappingUiProvider.java
deleted file mode 100644
index 89864de7d8..0000000000
--- a/jpa/plugins/org.eclipse.jpt.eclipselink.ui/src/org/eclipse/jpt/eclipselink1_1/ui/internal/orm/details/EclipseLink1_1OrmBasicCollectionMappingUiProvider.java
+++ /dev/null
@@ -1,55 +0,0 @@
-/*******************************************************************************
- * Copyright (c) 2009 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.
- *
- * Contributors:
- * Oracle - initial API and implementation
- ******************************************************************************/
-package org.eclipse.jpt.eclipselink1_1.ui.internal.orm.details;
-
-import org.eclipse.core.runtime.content.IContentType;
-import org.eclipse.jpt.eclipselink.core.context.BasicCollectionMapping;
-import org.eclipse.jpt.eclipselink.core.internal.JptEclipseLinkCorePlugin;
-import org.eclipse.jpt.eclipselink.ui.internal.mappings.details.EclipseLinkBasicCollectionMappingUiProvider;
-import org.eclipse.jpt.ui.JpaUiFactory;
-import org.eclipse.jpt.ui.WidgetFactory;
-import org.eclipse.jpt.ui.details.AttributeMappingUiProvider;
-import org.eclipse.jpt.ui.details.JpaComposite;
-import org.eclipse.jpt.utility.model.value.PropertyValueModel;
-import org.eclipse.swt.widgets.Composite;
-
-public class EclipseLink1_1OrmBasicCollectionMappingUiProvider extends EclipseLinkBasicCollectionMappingUiProvider<BasicCollectionMapping>
-{
- // singleton
- private static final EclipseLink1_1OrmBasicCollectionMappingUiProvider INSTANCE =
- new EclipseLink1_1OrmBasicCollectionMappingUiProvider();
-
- /**
- * Return the singleton.
- */
- public static AttributeMappingUiProvider<BasicCollectionMapping> instance() {
- return INSTANCE;
- }
-
-
- /**
- * Ensure single instance.
- */
- private EclipseLink1_1OrmBasicCollectionMappingUiProvider() {
- super();
- }
-
- public IContentType getContentType() {
- return JptEclipseLinkCorePlugin.ECLIPSELINK1_1_ORM_XML_CONTENT_TYPE;
- }
-
- public JpaComposite buildAttributeMappingComposite(
- JpaUiFactory factory,
- PropertyValueModel<BasicCollectionMapping> subjectHolder,
- Composite parent,
- WidgetFactory widgetFactory) {
- return new EclipseLink1_1OrmBasicCollectionMappingComposite(subjectHolder, parent, widgetFactory);
- }
-}
diff --git a/jpa/plugins/org.eclipse.jpt.eclipselink.ui/src/org/eclipse/jpt/eclipselink1_1/ui/internal/orm/details/EclipseLink1_1OrmBasicMapMappingComposite.java b/jpa/plugins/org.eclipse.jpt.eclipselink.ui/src/org/eclipse/jpt/eclipselink1_1/ui/internal/orm/details/EclipseLink1_1OrmBasicMapMappingComposite.java
deleted file mode 100644
index e158f2152b..0000000000
--- a/jpa/plugins/org.eclipse.jpt.eclipselink.ui/src/org/eclipse/jpt/eclipselink1_1/ui/internal/orm/details/EclipseLink1_1OrmBasicMapMappingComposite.java
+++ /dev/null
@@ -1,57 +0,0 @@
-/*******************************************************************************
- * Copyright (c) 2009 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.
- *
- * Contributors:
- * Oracle - initial API and implementation
- ******************************************************************************/
-package org.eclipse.jpt.eclipselink1_1.ui.internal.orm.details;
-
-import org.eclipse.jpt.core.context.AccessHolder;
-import org.eclipse.jpt.eclipselink.core.context.BasicMapMapping;
-import org.eclipse.jpt.ui.WidgetFactory;
-import org.eclipse.jpt.ui.details.JpaComposite;
-import org.eclipse.jpt.ui.internal.details.AccessTypeComposite;
-import org.eclipse.jpt.ui.internal.widgets.FormPane;
-import org.eclipse.jpt.utility.internal.model.value.PropertyAspectAdapter;
-import org.eclipse.jpt.utility.model.value.PropertyValueModel;
-import org.eclipse.swt.widgets.Composite;
-
-/**
- *
- * @version 2.2
- * @since 2.2
- */
-public class EclipseLink1_1OrmBasicMapMappingComposite extends FormPane<BasicMapMapping>
- implements JpaComposite
-{
- /**
- * Creates a new <code>EclipseLinkBasicCollectionMappingComposite</code>.
- *
- * @param subjectHolder The holder of the subject <code>IManyToOneMapping</code>
- * @param parent The parent container
- * @param widgetFactory The factory used to create various common widgets
- */
- public EclipseLink1_1OrmBasicMapMappingComposite(PropertyValueModel<? extends BasicMapMapping> subjectHolder,
- Composite parent,
- WidgetFactory widgetFactory) {
-
- super(subjectHolder, parent, widgetFactory);
- }
-
- @Override
- protected void initializeLayout(Composite container) {
- new AccessTypeComposite(this, buildAccessHolderHolder(), container);
- }
-
- protected PropertyValueModel<AccessHolder> buildAccessHolderHolder() {
- return new PropertyAspectAdapter<BasicMapMapping, AccessHolder>(getSubjectHolder()) {
- @Override
- protected AccessHolder buildValue_() {
- return this.subject.getPersistentAttribute();
- }
- };
- }
-}
diff --git a/jpa/plugins/org.eclipse.jpt.eclipselink.ui/src/org/eclipse/jpt/eclipselink1_1/ui/internal/orm/details/EclipseLink1_1OrmBasicMapMappingUiProvider.java b/jpa/plugins/org.eclipse.jpt.eclipselink.ui/src/org/eclipse/jpt/eclipselink1_1/ui/internal/orm/details/EclipseLink1_1OrmBasicMapMappingUiProvider.java
deleted file mode 100644
index e3da2886e3..0000000000
--- a/jpa/plugins/org.eclipse.jpt.eclipselink.ui/src/org/eclipse/jpt/eclipselink1_1/ui/internal/orm/details/EclipseLink1_1OrmBasicMapMappingUiProvider.java
+++ /dev/null
@@ -1,55 +0,0 @@
-/*******************************************************************************
- * Copyright (c) 2009 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.
- *
- * Contributors:
- * Oracle - initial API and implementation
- ******************************************************************************/
-package org.eclipse.jpt.eclipselink1_1.ui.internal.orm.details;
-
-import org.eclipse.core.runtime.content.IContentType;
-import org.eclipse.jpt.eclipselink.core.context.BasicMapMapping;
-import org.eclipse.jpt.eclipselink.core.internal.JptEclipseLinkCorePlugin;
-import org.eclipse.jpt.eclipselink.ui.internal.mappings.details.EclipseLinkBasicMapMappingUiProvider;
-import org.eclipse.jpt.ui.JpaUiFactory;
-import org.eclipse.jpt.ui.WidgetFactory;
-import org.eclipse.jpt.ui.details.AttributeMappingUiProvider;
-import org.eclipse.jpt.ui.details.JpaComposite;
-import org.eclipse.jpt.utility.model.value.PropertyValueModel;
-import org.eclipse.swt.widgets.Composite;
-
-public class EclipseLink1_1OrmBasicMapMappingUiProvider extends EclipseLinkBasicMapMappingUiProvider<BasicMapMapping>
-{
- // singleton
- private static final EclipseLink1_1OrmBasicMapMappingUiProvider INSTANCE =
- new EclipseLink1_1OrmBasicMapMappingUiProvider();
-
- /**
- * Return the singleton.
- */
- public static AttributeMappingUiProvider<BasicMapMapping> instance() {
- return INSTANCE;
- }
-
-
- /**
- * Ensure single instance.
- */
- private EclipseLink1_1OrmBasicMapMappingUiProvider() {
- super();
- }
-
- public IContentType getContentType() {
- return JptEclipseLinkCorePlugin.ECLIPSELINK1_1_ORM_XML_CONTENT_TYPE;
- }
-
- public JpaComposite buildAttributeMappingComposite(
- JpaUiFactory factory,
- PropertyValueModel<BasicMapMapping> subjectHolder,
- Composite parent,
- WidgetFactory widgetFactory) {
- return new EclipseLink1_1OrmBasicMapMappingComposite(subjectHolder, parent, widgetFactory);
- }
-}
diff --git a/jpa/plugins/org.eclipse.jpt.eclipselink.ui/src/org/eclipse/jpt/eclipselink1_1/ui/internal/orm/details/EclipseLink1_1OrmBasicMappingComposite.java b/jpa/plugins/org.eclipse.jpt.eclipselink.ui/src/org/eclipse/jpt/eclipselink1_1/ui/internal/orm/details/EclipseLink1_1OrmBasicMappingComposite.java
deleted file mode 100644
index 10e9b53640..0000000000
--- a/jpa/plugins/org.eclipse.jpt.eclipselink.ui/src/org/eclipse/jpt/eclipselink1_1/ui/internal/orm/details/EclipseLink1_1OrmBasicMappingComposite.java
+++ /dev/null
@@ -1,67 +0,0 @@
-/*******************************************************************************
- * Copyright (c) 2009 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.
- *
- * Contributors:
- * Oracle - initial API and implementation
- ******************************************************************************/
-package org.eclipse.jpt.eclipselink1_1.ui.internal.orm.details;
-
-import org.eclipse.jpt.core.context.AccessHolder;
-import org.eclipse.jpt.core.context.BasicMapping;
-import org.eclipse.jpt.eclipselink.ui.internal.mappings.details.EclipseLinkBasicMappingComposite;
-import org.eclipse.jpt.eclipselink.ui.internal.mappings.details.MutableComposite;
-import org.eclipse.jpt.ui.WidgetFactory;
-import org.eclipse.jpt.ui.internal.details.AccessTypeComposite;
-import org.eclipse.jpt.ui.internal.mappings.details.ColumnComposite;
-import org.eclipse.jpt.ui.internal.mappings.details.FetchTypeComposite;
-import org.eclipse.jpt.ui.internal.mappings.details.OptionalComposite;
-import org.eclipse.jpt.utility.internal.model.value.PropertyAspectAdapter;
-import org.eclipse.jpt.utility.model.value.PropertyValueModel;
-import org.eclipse.swt.widgets.Composite;
-
-public class EclipseLink1_1OrmBasicMappingComposite extends EclipseLinkBasicMappingComposite
-{
- /**
- * Creates a new <code>EclipseLink1_1OrmBasicMappingComposite</code>.
- *
- * @param subjectHolder The holder of the subject <code>BasicMapping</code>
- * @param parent The parent container
- * @param widgetFactory The factory used to create various common widgets
- */
- public EclipseLink1_1OrmBasicMappingComposite(PropertyValueModel<? extends BasicMapping> subjectHolder,
- Composite parent,
- WidgetFactory widgetFactory) {
-
- super(subjectHolder, parent, widgetFactory);
- }
-
- @Override
- protected void initializeGeneralPane(Composite container) {
- int groupBoxMargin = getGroupBoxMargin();
-
- new ColumnComposite(this, buildColumnHolder(), container);
-
- // Align the widgets under the ColumnComposite
- container = addSubPane(container, 0, groupBoxMargin, 0, groupBoxMargin);
-
- new AccessTypeComposite(this, buildAccessHolderHolder(), container);
- new FetchTypeComposite(this, container);
- new OptionalComposite(this, addSubPane(container, 4));
-
- // Mutable widgets
- new MutableComposite(this, buildMutableHolder(), container);
- }
-
- protected PropertyValueModel<AccessHolder> buildAccessHolderHolder() {
- return new PropertyAspectAdapter<BasicMapping, AccessHolder>(getSubjectHolder()) {
- @Override
- protected AccessHolder buildValue_() {
- return this.subject.getPersistentAttribute();
- }
- };
- }
-
-} \ No newline at end of file
diff --git a/jpa/plugins/org.eclipse.jpt.eclipselink.ui/src/org/eclipse/jpt/eclipselink1_1/ui/internal/orm/details/EclipseLink1_1OrmBasicMappingUiProvider.java b/jpa/plugins/org.eclipse.jpt.eclipselink.ui/src/org/eclipse/jpt/eclipselink1_1/ui/internal/orm/details/EclipseLink1_1OrmBasicMappingUiProvider.java
deleted file mode 100644
index 1398534bfd..0000000000
--- a/jpa/plugins/org.eclipse.jpt.eclipselink.ui/src/org/eclipse/jpt/eclipselink1_1/ui/internal/orm/details/EclipseLink1_1OrmBasicMappingUiProvider.java
+++ /dev/null
@@ -1,57 +0,0 @@
-/*******************************************************************************
- * Copyright (c) 2009 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.
- *
- * Contributors:
- * Oracle - initial API and implementation
- ******************************************************************************/
-package org.eclipse.jpt.eclipselink1_1.ui.internal.orm.details;
-
-import org.eclipse.core.runtime.content.IContentType;
-import org.eclipse.jpt.eclipselink.core.internal.JptEclipseLinkCorePlugin;
-import org.eclipse.jpt.eclipselink.core.internal.context.orm.EclipseLinkOrmBasicMapping;
-import org.eclipse.jpt.ui.JpaUiFactory;
-import org.eclipse.jpt.ui.WidgetFactory;
-import org.eclipse.jpt.ui.details.AttributeMappingUiProvider;
-import org.eclipse.jpt.ui.details.JpaComposite;
-import org.eclipse.jpt.ui.internal.details.AbstractBasicMappingUiProvider;
-import org.eclipse.jpt.utility.model.value.PropertyValueModel;
-import org.eclipse.swt.widgets.Composite;
-
-public class EclipseLink1_1OrmBasicMappingUiProvider
- extends AbstractBasicMappingUiProvider<EclipseLinkOrmBasicMapping>
-{
- // singleton
- private static final EclipseLink1_1OrmBasicMappingUiProvider INSTANCE =
- new EclipseLink1_1OrmBasicMappingUiProvider();
-
- /**
- * Return the singleton.
- */
- public static AttributeMappingUiProvider<EclipseLinkOrmBasicMapping> instance() {
- return INSTANCE;
- }
-
-
- /**
- * Ensure single instance.
- */
- private EclipseLink1_1OrmBasicMappingUiProvider() {
- super();
- }
-
- public IContentType getContentType() {
- return JptEclipseLinkCorePlugin.ECLIPSELINK1_1_ORM_XML_CONTENT_TYPE;
- }
-
- public JpaComposite buildAttributeMappingComposite(
- JpaUiFactory factory,
- PropertyValueModel<EclipseLinkOrmBasicMapping> subjectHolder,
- Composite parent,
- WidgetFactory widgetFactory) {
-
- return new EclipseLink1_1OrmBasicMappingComposite(subjectHolder, parent, widgetFactory);
- }
-}
diff --git a/jpa/plugins/org.eclipse.jpt.eclipselink.ui/src/org/eclipse/jpt/eclipselink1_1/ui/internal/orm/details/EclipseLink1_1OrmEmbeddableComposite.java b/jpa/plugins/org.eclipse.jpt.eclipselink.ui/src/org/eclipse/jpt/eclipselink1_1/ui/internal/orm/details/EclipseLink1_1OrmEmbeddableComposite.java
deleted file mode 100644
index f6f9e57bc1..0000000000
--- a/jpa/plugins/org.eclipse.jpt.eclipselink.ui/src/org/eclipse/jpt/eclipselink1_1/ui/internal/orm/details/EclipseLink1_1OrmEmbeddableComposite.java
+++ /dev/null
@@ -1,101 +0,0 @@
-/*******************************************************************************
- * Copyright (c) 2009 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.
- *
- * Contributors:
- * Oracle - initial API and implementation
- ******************************************************************************/
-package org.eclipse.jpt.eclipselink1_1.ui.internal.orm.details;
-
-import org.eclipse.jpt.core.context.AccessHolder;
-import org.eclipse.jpt.eclipselink.core.internal.context.orm.ConverterHolder;
-import org.eclipse.jpt.eclipselink.core.internal.context.orm.EclipseLinkOrmEmbeddable;
-import org.eclipse.jpt.eclipselink.ui.internal.mappings.EclipseLinkUiMappingsMessages;
-import org.eclipse.jpt.eclipselink.ui.internal.mappings.details.EclipseLinkEmbeddableAdvancedComposite;
-import org.eclipse.jpt.eclipselink.ui.internal.orm.details.ConvertersComposite;
-import org.eclipse.jpt.ui.WidgetFactory;
-import org.eclipse.jpt.ui.details.JpaComposite;
-import org.eclipse.jpt.ui.internal.details.AccessTypeComposite;
-import org.eclipse.jpt.ui.internal.orm.details.MetadataCompleteComposite;
-import org.eclipse.jpt.ui.internal.orm.details.OrmJavaClassChooser;
-import org.eclipse.jpt.ui.internal.widgets.FormPane;
-import org.eclipse.jpt.utility.internal.model.value.PropertyAspectAdapter;
-import org.eclipse.jpt.utility.model.value.PropertyValueModel;
-import org.eclipse.swt.widgets.Composite;
-
-/**
- * This pane does not have any widgets.
- *
- * @see Embeddable
- * @see BaseJpaUiFactory - The factory creating this pane
- * @see EmbeddableUiProvider
- *
- * @version 2.1
- * @since 2.1
- */
-public class EclipseLink1_1OrmEmbeddableComposite extends FormPane<EclipseLinkOrmEmbeddable>
- implements JpaComposite
-{
- /**
- * Creates a new <code>EmbeddableComposite</code>.
- *
- * @param subjectHolder The holder of this pane's subject
- * @param parent The parent container
- * @param widgetFactory The factory used to create various common widgets
- */
- public EclipseLink1_1OrmEmbeddableComposite(PropertyValueModel<? extends EclipseLinkOrmEmbeddable> subjectHolder,
- Composite parent,
- WidgetFactory widgetFactory) {
-
- super(subjectHolder, parent, widgetFactory);
- }
-
- @Override
- protected void initializeLayout(Composite container) {
- initializeGeneralPane(container);
- initializeConvertersPane(container);
- initializeAdvancedPane(container);
- }
-
- protected void initializeGeneralPane(Composite container) {
- new OrmJavaClassChooser(this, getSubjectHolder(), container);
- new AccessTypeComposite(this, buildAccessHolder(), container);
- new MetadataCompleteComposite(this, getSubjectHolder(), container);
- }
-
- protected PropertyValueModel<AccessHolder> buildAccessHolder() {
- return new PropertyAspectAdapter<EclipseLinkOrmEmbeddable, AccessHolder>(
- getSubjectHolder())
- {
- @Override
- protected AccessHolder buildValue_() {
- return this.subject.getPersistentType();
- }
- };
- }
-
- protected void initializeConvertersPane(Composite container) {
-
- container = addCollapsableSection(
- addSubPane(container, 5),
- EclipseLinkUiMappingsMessages.ConvertersComposite_Label
- );
-
- new ConvertersComposite(this, buildConverterHolder(), container);
- }
-
- private PropertyValueModel<ConverterHolder> buildConverterHolder() {
- return new PropertyAspectAdapter<EclipseLinkOrmEmbeddable, ConverterHolder>(getSubjectHolder()) {
- @Override
- protected ConverterHolder buildValue_() {
- return this.subject.getConverterHolder();
- }
- };
- }
-
- protected void initializeAdvancedPane(Composite container) {
- new EclipseLinkEmbeddableAdvancedComposite(this, container);
- }
-} \ No newline at end of file
diff --git a/jpa/plugins/org.eclipse.jpt.eclipselink.ui/src/org/eclipse/jpt/eclipselink1_1/ui/internal/orm/details/EclipseLink1_1OrmEmbeddableUiProvider.java b/jpa/plugins/org.eclipse.jpt.eclipselink.ui/src/org/eclipse/jpt/eclipselink1_1/ui/internal/orm/details/EclipseLink1_1OrmEmbeddableUiProvider.java
deleted file mode 100644
index 822b1fd54a..0000000000
--- a/jpa/plugins/org.eclipse.jpt.eclipselink.ui/src/org/eclipse/jpt/eclipselink1_1/ui/internal/orm/details/EclipseLink1_1OrmEmbeddableUiProvider.java
+++ /dev/null
@@ -1,58 +0,0 @@
-/*******************************************************************************
- * Copyright (c) 2009 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
- *
- * Contributors:
- * Oracle - initial API and implementation
- *******************************************************************************/
-package org.eclipse.jpt.eclipselink1_1.ui.internal.orm.details;
-
-import org.eclipse.core.runtime.content.IContentType;
-import org.eclipse.jpt.eclipselink.core.internal.JptEclipseLinkCorePlugin;
-import org.eclipse.jpt.eclipselink.core.internal.context.orm.EclipseLinkOrmEmbeddable;
-import org.eclipse.jpt.eclipselink.ui.internal.orm.details.EclipseLinkOrmEmbeddableComposite;
-import org.eclipse.jpt.ui.JpaUiFactory;
-import org.eclipse.jpt.ui.WidgetFactory;
-import org.eclipse.jpt.ui.details.JpaComposite;
-import org.eclipse.jpt.ui.details.TypeMappingUiProvider;
-import org.eclipse.jpt.ui.internal.details.AbstractEmbeddableUiProvider;
-import org.eclipse.jpt.utility.model.value.PropertyValueModel;
-import org.eclipse.swt.widgets.Composite;
-
-public class EclipseLink1_1OrmEmbeddableUiProvider
- extends AbstractEmbeddableUiProvider<EclipseLinkOrmEmbeddable>
-{
- // singleton
- private static final EclipseLink1_1OrmEmbeddableUiProvider INSTANCE =
- new EclipseLink1_1OrmEmbeddableUiProvider();
-
- /**
- * Return the singleton.
- */
- public static TypeMappingUiProvider<EclipseLinkOrmEmbeddable> instance() {
- return INSTANCE;
- }
-
-
- /**
- * Ensure single instance.
- */
- private EclipseLink1_1OrmEmbeddableUiProvider() {
- super();
- }
-
- public IContentType getContentType() {
- return JptEclipseLinkCorePlugin.ECLIPSELINK1_1_ORM_XML_CONTENT_TYPE;
- }
-
- public JpaComposite buildPersistentTypeMappingComposite(
- JpaUiFactory factory,
- PropertyValueModel<EclipseLinkOrmEmbeddable> subjectHolder,
- Composite parent,
- WidgetFactory widgetFactory) {
- return new EclipseLinkOrmEmbeddableComposite(subjectHolder, parent, widgetFactory);
- }
-}
diff --git a/jpa/plugins/org.eclipse.jpt.eclipselink.ui/src/org/eclipse/jpt/eclipselink1_1/ui/internal/orm/details/EclipseLink1_1OrmEmbeddedIdMappingComposite.java b/jpa/plugins/org.eclipse.jpt.eclipselink.ui/src/org/eclipse/jpt/eclipselink1_1/ui/internal/orm/details/EclipseLink1_1OrmEmbeddedIdMappingComposite.java
deleted file mode 100644
index cba71989b5..0000000000
--- a/jpa/plugins/org.eclipse.jpt.eclipselink.ui/src/org/eclipse/jpt/eclipselink1_1/ui/internal/orm/details/EclipseLink1_1OrmEmbeddedIdMappingComposite.java
+++ /dev/null
@@ -1,75 +0,0 @@
-/*******************************************************************************
- * Copyright (c) 2009 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.
- *
- * Contributors:
- * Oracle - initial API and implementation
- ******************************************************************************/
-package org.eclipse.jpt.eclipselink1_1.ui.internal.orm.details;
-
-import org.eclipse.jpt.core.context.AccessHolder;
-import org.eclipse.jpt.core.context.EmbeddedIdMapping;
-import org.eclipse.jpt.ui.WidgetFactory;
-import org.eclipse.jpt.ui.details.JpaComposite;
-import org.eclipse.jpt.ui.internal.details.AccessTypeComposite;
-import org.eclipse.jpt.ui.internal.mappings.details.AbstractEmbeddedMappingComposite;
-import org.eclipse.jpt.ui.internal.mappings.details.EmbeddedAttributeOverridesComposite;
-import org.eclipse.jpt.utility.internal.model.value.PropertyAspectAdapter;
-import org.eclipse.jpt.utility.model.value.PropertyValueModel;
-import org.eclipse.swt.widgets.Composite;
-
-/**
- * Here's the layout of this pane:
- * <pre>
- * -----------------------------------------------------------------------------
- * | ------------------------------------------------------------------------- |
- * | | | |
- * | | EmbeddedAttributeOverridesComposite | |
- * | | | |
- * | ------------------------------------------------------------------------- |
- * -----------------------------------------------------------------------------</pre>
- *
- * @see EmbeddedIdMapping
- * @see BaseJpaUiFactory - The factory creating this pane
- *
- * @version 2.2
- * @since 2.2
- */
-public class EclipseLink1_1OrmEmbeddedIdMappingComposite extends AbstractEmbeddedMappingComposite<EmbeddedIdMapping>
- implements JpaComposite
-{
- /**
- * Creates a new <code>EclipseLink1_1OrmEmbeddedIdMappingComposite</code>.
- *
- * @param subjectHolder The holder of the subject <code>EmbeddedIdMapping</code>
- * @param parent The parent container
- * @param widgetFactory The factory used to create various common widgets
- */
- public EclipseLink1_1OrmEmbeddedIdMappingComposite(PropertyValueModel<? extends EmbeddedIdMapping> subjectHolder,
- Composite parent,
- WidgetFactory widgetFactory) {
-
- super(subjectHolder, parent, widgetFactory);
- }
-
- @Override
- protected void initializeLayout(Composite container) {
- new AccessTypeComposite(this, buildAccessHolderHolder(), container);
-
- new EmbeddedAttributeOverridesComposite(
- this,
- container
- );
- }
-
- protected PropertyValueModel<AccessHolder> buildAccessHolderHolder() {
- return new PropertyAspectAdapter<EmbeddedIdMapping, AccessHolder>(getSubjectHolder()) {
- @Override
- protected AccessHolder buildValue_() {
- return this.subject.getPersistentAttribute();
- }
- };
- }
-} \ No newline at end of file
diff --git a/jpa/plugins/org.eclipse.jpt.eclipselink.ui/src/org/eclipse/jpt/eclipselink1_1/ui/internal/orm/details/EclipseLink1_1OrmEmbeddedIdMappingUiProvider.java b/jpa/plugins/org.eclipse.jpt.eclipselink.ui/src/org/eclipse/jpt/eclipselink1_1/ui/internal/orm/details/EclipseLink1_1OrmEmbeddedIdMappingUiProvider.java
deleted file mode 100644
index 243f6dd74c..0000000000
--- a/jpa/plugins/org.eclipse.jpt.eclipselink.ui/src/org/eclipse/jpt/eclipselink1_1/ui/internal/orm/details/EclipseLink1_1OrmEmbeddedIdMappingUiProvider.java
+++ /dev/null
@@ -1,57 +0,0 @@
-/*******************************************************************************
- * Copyright (c) 2009 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
- *
- * Contributors:
- * Oracle - initial API and implementation
- *******************************************************************************/
-package org.eclipse.jpt.eclipselink1_1.ui.internal.orm.details;
-
-import org.eclipse.core.runtime.content.IContentType;
-import org.eclipse.jpt.core.context.orm.OrmEmbeddedIdMapping;
-import org.eclipse.jpt.eclipselink.core.internal.JptEclipseLinkCorePlugin;
-import org.eclipse.jpt.ui.JpaUiFactory;
-import org.eclipse.jpt.ui.WidgetFactory;
-import org.eclipse.jpt.ui.details.AttributeMappingUiProvider;
-import org.eclipse.jpt.ui.details.JpaComposite;
-import org.eclipse.jpt.ui.internal.details.AbstractEmbeddedIdMappingUiProvider;
-import org.eclipse.jpt.utility.model.value.PropertyValueModel;
-import org.eclipse.swt.widgets.Composite;
-
-public class EclipseLink1_1OrmEmbeddedIdMappingUiProvider
- extends AbstractEmbeddedIdMappingUiProvider<OrmEmbeddedIdMapping>
-{
- // singleton
- private static final EclipseLink1_1OrmEmbeddedIdMappingUiProvider INSTANCE =
- new EclipseLink1_1OrmEmbeddedIdMappingUiProvider();
-
- /**
- * Return the singleton.
- */
- public static AttributeMappingUiProvider<OrmEmbeddedIdMapping> instance() {
- return INSTANCE;
- }
-
-
- /**
- * Ensure single instance.
- */
- private EclipseLink1_1OrmEmbeddedIdMappingUiProvider() {
- super();
- }
-
- public IContentType getContentType() {
- return JptEclipseLinkCorePlugin.ECLIPSELINK1_1_ORM_XML_CONTENT_TYPE;
- }
-
- public JpaComposite buildAttributeMappingComposite(
- JpaUiFactory factory,
- PropertyValueModel<OrmEmbeddedIdMapping> subjectHolder,
- Composite parent,
- WidgetFactory widgetFactory) {
- return new EclipseLink1_1OrmEmbeddedIdMappingComposite(subjectHolder, parent, widgetFactory);
- }
-}
diff --git a/jpa/plugins/org.eclipse.jpt.eclipselink.ui/src/org/eclipse/jpt/eclipselink1_1/ui/internal/orm/details/EclipseLink1_1OrmEmbeddedMappingComposite.java b/jpa/plugins/org.eclipse.jpt.eclipselink.ui/src/org/eclipse/jpt/eclipselink1_1/ui/internal/orm/details/EclipseLink1_1OrmEmbeddedMappingComposite.java
deleted file mode 100644
index da10997f28..0000000000
--- a/jpa/plugins/org.eclipse.jpt.eclipselink.ui/src/org/eclipse/jpt/eclipselink1_1/ui/internal/orm/details/EclipseLink1_1OrmEmbeddedMappingComposite.java
+++ /dev/null
@@ -1,76 +0,0 @@
-/*******************************************************************************
- * Copyright (c) 2009 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.
- *
- * Contributors:
- * Oracle - initial API and implementation
- ******************************************************************************/
-package org.eclipse.jpt.eclipselink1_1.ui.internal.orm.details;
-
-import org.eclipse.jpt.core.context.AccessHolder;
-import org.eclipse.jpt.core.context.EmbeddedMapping;
-import org.eclipse.jpt.ui.WidgetFactory;
-import org.eclipse.jpt.ui.details.JpaComposite;
-import org.eclipse.jpt.ui.internal.details.AccessTypeComposite;
-import org.eclipse.jpt.ui.internal.mappings.details.AbstractEmbeddedMappingComposite;
-import org.eclipse.jpt.ui.internal.mappings.details.EmbeddedAttributeOverridesComposite;
-import org.eclipse.jpt.utility.internal.model.value.PropertyAspectAdapter;
-import org.eclipse.jpt.utility.model.value.PropertyValueModel;
-import org.eclipse.swt.widgets.Composite;
-
-/**
- * Here the layout of this pane:
- * <pre>
- * -----------------------------------------------------------------------------
- * | ------------------------------------------------------------------------- |
- * | | | |
- * | | EmbeddedAttributeOverridesComposite | |
- * | | | |
- * | ------------------------------------------------------------------------- |
- * -----------------------------------------------------------------------------</pre>
- *
- * @see EmbeddedMapping
- * @see BaseJpaUiFactory - The factory creating this pane
- *
- * @version 2.2
- * @since 2.2
- */
-public class EclipseLink1_1OrmEmbeddedMappingComposite extends AbstractEmbeddedMappingComposite<EmbeddedMapping>
- implements JpaComposite
-{
- /**
- * Creates a new <code>EmbeddedMappingComposite</code>.
- *
- * @param subjectHolder The holder of the subject <code>EmbeddedMapping</code>
- * @param parent The parent container
- * @param widgetFactory The factory used to create various common widgets
- */
- public EclipseLink1_1OrmEmbeddedMappingComposite(PropertyValueModel<? extends EmbeddedMapping> subjectHolder,
- Composite parent,
- WidgetFactory widgetFactory) {
-
- super(subjectHolder, parent, widgetFactory);
- }
-
-
- @Override
- protected void initializeLayout(Composite container) {
- new AccessTypeComposite(this, buildAccessHolderHolder(), container);
-
- new EmbeddedAttributeOverridesComposite(
- this,
- container
- );
- }
-
- protected PropertyValueModel<AccessHolder> buildAccessHolderHolder() {
- return new PropertyAspectAdapter<EmbeddedMapping, AccessHolder>(getSubjectHolder()) {
- @Override
- protected AccessHolder buildValue_() {
- return this.subject.getPersistentAttribute();
- }
- };
- }
-} \ No newline at end of file
diff --git a/jpa/plugins/org.eclipse.jpt.eclipselink.ui/src/org/eclipse/jpt/eclipselink1_1/ui/internal/orm/details/EclipseLink1_1OrmEmbeddedMappingUiProvider.java b/jpa/plugins/org.eclipse.jpt.eclipselink.ui/src/org/eclipse/jpt/eclipselink1_1/ui/internal/orm/details/EclipseLink1_1OrmEmbeddedMappingUiProvider.java
deleted file mode 100644
index 2346ac9277..0000000000
--- a/jpa/plugins/org.eclipse.jpt.eclipselink.ui/src/org/eclipse/jpt/eclipselink1_1/ui/internal/orm/details/EclipseLink1_1OrmEmbeddedMappingUiProvider.java
+++ /dev/null
@@ -1,57 +0,0 @@
-/*******************************************************************************
- * Copyright (c) 2009 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
- *
- * Contributors:
- * Oracle - initial API and implementation
- *******************************************************************************/
-package org.eclipse.jpt.eclipselink1_1.ui.internal.orm.details;
-
-import org.eclipse.core.runtime.content.IContentType;
-import org.eclipse.jpt.core.context.orm.OrmEmbeddedMapping;
-import org.eclipse.jpt.eclipselink.core.internal.JptEclipseLinkCorePlugin;
-import org.eclipse.jpt.ui.JpaUiFactory;
-import org.eclipse.jpt.ui.WidgetFactory;
-import org.eclipse.jpt.ui.details.AttributeMappingUiProvider;
-import org.eclipse.jpt.ui.details.JpaComposite;
-import org.eclipse.jpt.ui.internal.details.AbstractEmbeddedMappingUiProvider;
-import org.eclipse.jpt.utility.model.value.PropertyValueModel;
-import org.eclipse.swt.widgets.Composite;
-
-public class EclipseLink1_1OrmEmbeddedMappingUiProvider
- extends AbstractEmbeddedMappingUiProvider<OrmEmbeddedMapping>
-{
- // singleton
- private static final EclipseLink1_1OrmEmbeddedMappingUiProvider INSTANCE =
- new EclipseLink1_1OrmEmbeddedMappingUiProvider();
-
- /**
- * Return the singleton.
- */
- public static AttributeMappingUiProvider<OrmEmbeddedMapping> instance() {
- return INSTANCE;
- }
-
-
- /**
- * Ensure single instance.
- */
- private EclipseLink1_1OrmEmbeddedMappingUiProvider() {
- super();
- }
-
- public IContentType getContentType() {
- return JptEclipseLinkCorePlugin.ECLIPSELINK1_1_ORM_XML_CONTENT_TYPE;
- }
-
- public JpaComposite buildAttributeMappingComposite(
- JpaUiFactory factory,
- PropertyValueModel<OrmEmbeddedMapping> subjectHolder,
- Composite parent,
- WidgetFactory widgetFactory) {
- return new EclipseLink1_1OrmEmbeddedMappingComposite(subjectHolder, parent, widgetFactory);
- }
-}
diff --git a/jpa/plugins/org.eclipse.jpt.eclipselink.ui/src/org/eclipse/jpt/eclipselink1_1/ui/internal/orm/details/EclipseLink1_1OrmEntityUiProvider.java b/jpa/plugins/org.eclipse.jpt.eclipselink.ui/src/org/eclipse/jpt/eclipselink1_1/ui/internal/orm/details/EclipseLink1_1OrmEntityUiProvider.java
deleted file mode 100644
index bc74a18b9f..0000000000
--- a/jpa/plugins/org.eclipse.jpt.eclipselink.ui/src/org/eclipse/jpt/eclipselink1_1/ui/internal/orm/details/EclipseLink1_1OrmEntityUiProvider.java
+++ /dev/null
@@ -1,58 +0,0 @@
-/*******************************************************************************
- * Copyright (c) 2009 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
- *
- * Contributors:
- * Oracle - initial API and implementation
- *******************************************************************************/
-package org.eclipse.jpt.eclipselink1_1.ui.internal.orm.details;
-
-import org.eclipse.core.runtime.content.IContentType;
-import org.eclipse.jpt.eclipselink.core.internal.JptEclipseLinkCorePlugin;
-import org.eclipse.jpt.eclipselink.core.internal.context.orm.EclipseLinkOrmEntity;
-import org.eclipse.jpt.eclipselink.ui.internal.orm.details.EclipseLinkOrmEntityComposite;
-import org.eclipse.jpt.ui.JpaUiFactory;
-import org.eclipse.jpt.ui.WidgetFactory;
-import org.eclipse.jpt.ui.details.JpaComposite;
-import org.eclipse.jpt.ui.details.TypeMappingUiProvider;
-import org.eclipse.jpt.ui.internal.details.AbstractEntityUiProvider;
-import org.eclipse.jpt.utility.model.value.PropertyValueModel;
-import org.eclipse.swt.widgets.Composite;
-
-public class EclipseLink1_1OrmEntityUiProvider
- extends AbstractEntityUiProvider<EclipseLinkOrmEntity>
-{
- // singleton
- private static final EclipseLink1_1OrmEntityUiProvider INSTANCE =
- new EclipseLink1_1OrmEntityUiProvider();
-
- /**
- * Return the singleton.
- */
- public static TypeMappingUiProvider<EclipseLinkOrmEntity> instance() {
- return INSTANCE;
- }
-
- public IContentType getContentType() {
- return JptEclipseLinkCorePlugin.ECLIPSELINK1_1_ORM_XML_CONTENT_TYPE;
- }
-
- /**
- * Ensure single instance.
- */
- private EclipseLink1_1OrmEntityUiProvider() {
- super();
- }
-
-
- public JpaComposite buildPersistentTypeMappingComposite(
- JpaUiFactory factory,
- PropertyValueModel<EclipseLinkOrmEntity> subjectHolder,
- Composite parent,
- WidgetFactory widgetFactory) {
- return new EclipseLinkOrmEntityComposite(subjectHolder, parent, widgetFactory);
- }
-}
diff --git a/jpa/plugins/org.eclipse.jpt.eclipselink.ui/src/org/eclipse/jpt/eclipselink1_1/ui/internal/orm/details/EclipseLink1_1OrmIdMappingComposite.java b/jpa/plugins/org.eclipse.jpt.eclipselink.ui/src/org/eclipse/jpt/eclipselink1_1/ui/internal/orm/details/EclipseLink1_1OrmIdMappingComposite.java
deleted file mode 100644
index 40536d211a..0000000000
--- a/jpa/plugins/org.eclipse.jpt.eclipselink.ui/src/org/eclipse/jpt/eclipselink1_1/ui/internal/orm/details/EclipseLink1_1OrmIdMappingComposite.java
+++ /dev/null
@@ -1,62 +0,0 @@
-/*******************************************************************************
- * Copyright (c) 2009 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.
- *
- * Contributors:
- * Oracle - initial API and implementation
- ******************************************************************************/
-package org.eclipse.jpt.eclipselink1_1.ui.internal.orm.details;
-
-import org.eclipse.jpt.core.context.AccessHolder;
-import org.eclipse.jpt.core.context.IdMapping;
-import org.eclipse.jpt.eclipselink.ui.internal.mappings.details.EclipseLinkIdMappingComposite;
-import org.eclipse.jpt.eclipselink.ui.internal.mappings.details.MutableComposite;
-import org.eclipse.jpt.ui.WidgetFactory;
-import org.eclipse.jpt.ui.internal.details.AccessTypeComposite;
-import org.eclipse.jpt.ui.internal.mappings.details.ColumnComposite;
-import org.eclipse.jpt.utility.internal.model.value.PropertyAspectAdapter;
-import org.eclipse.jpt.utility.model.value.PropertyValueModel;
-import org.eclipse.swt.widgets.Composite;
-
-public class EclipseLink1_1OrmIdMappingComposite extends EclipseLinkIdMappingComposite
-{
- /**
- * Creates a new <code>
-public</code>.
- *
- * @param subjectHolder The holder of the subject <code>IdMapping</code>
- * @param parent The parent container
- * @param widgetFactory The factory used to create various common widgets
- */
- public EclipseLink1_1OrmIdMappingComposite(PropertyValueModel<? extends IdMapping> subjectHolder,
- Composite parent,
- WidgetFactory widgetFactory) {
-
- super(subjectHolder, parent, widgetFactory);
- }
-
- @Override
- protected void initializeGeneralPane(Composite container) {
- int groupBoxMargin = getGroupBoxMargin();
-
- // Column widgets
- new ColumnComposite(this, buildColumnHolder(), container);
-
- // Align the widgets under the ColumnComposite
- container = addSubPane(container, 0, groupBoxMargin, 0, groupBoxMargin);
-
- new AccessTypeComposite(this, buildAccessHolderHolder(), container);
- new MutableComposite(this, buildMutableHolder(), container);
- }
-
- protected PropertyValueModel<AccessHolder> buildAccessHolderHolder() {
- return new PropertyAspectAdapter<IdMapping, AccessHolder>(getSubjectHolder()) {
- @Override
- protected AccessHolder buildValue_() {
- return this.subject.getPersistentAttribute();
- }
- };
- }
-} \ No newline at end of file
diff --git a/jpa/plugins/org.eclipse.jpt.eclipselink.ui/src/org/eclipse/jpt/eclipselink1_1/ui/internal/orm/details/EclipseLink1_1OrmIdMappingUiProvider.java b/jpa/plugins/org.eclipse.jpt.eclipselink.ui/src/org/eclipse/jpt/eclipselink1_1/ui/internal/orm/details/EclipseLink1_1OrmIdMappingUiProvider.java
deleted file mode 100644
index 7886a464c3..0000000000
--- a/jpa/plugins/org.eclipse.jpt.eclipselink.ui/src/org/eclipse/jpt/eclipselink1_1/ui/internal/orm/details/EclipseLink1_1OrmIdMappingUiProvider.java
+++ /dev/null
@@ -1,56 +0,0 @@
-/*******************************************************************************
- * Copyright (c) 2009 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.
- *
- * Contributors:
- * Oracle - initial API and implementation
- ******************************************************************************/
-package org.eclipse.jpt.eclipselink1_1.ui.internal.orm.details;
-
-import org.eclipse.core.runtime.content.IContentType;
-import org.eclipse.jpt.eclipselink.core.internal.JptEclipseLinkCorePlugin;
-import org.eclipse.jpt.eclipselink.core.internal.context.orm.EclipseLinkOrmIdMapping;
-import org.eclipse.jpt.ui.JpaUiFactory;
-import org.eclipse.jpt.ui.WidgetFactory;
-import org.eclipse.jpt.ui.details.AttributeMappingUiProvider;
-import org.eclipse.jpt.ui.details.JpaComposite;
-import org.eclipse.jpt.ui.internal.details.AbstractIdMappingUiProvider;
-import org.eclipse.jpt.utility.model.value.PropertyValueModel;
-import org.eclipse.swt.widgets.Composite;
-
-public class EclipseLink1_1OrmIdMappingUiProvider
- extends AbstractIdMappingUiProvider<EclipseLinkOrmIdMapping>
-{
- // singleton
- private static final EclipseLink1_1OrmIdMappingUiProvider INSTANCE =
- new EclipseLink1_1OrmIdMappingUiProvider();
-
- /**
- * Return the singleton.
- */
- public static AttributeMappingUiProvider<EclipseLinkOrmIdMapping> instance() {
- return INSTANCE;
- }
-
-
- /**
- * Ensure single instance.
- */
- private EclipseLink1_1OrmIdMappingUiProvider() {
- super();
- }
-
- public IContentType getContentType() {
- return JptEclipseLinkCorePlugin.ECLIPSELINK1_1_ORM_XML_CONTENT_TYPE;
- }
-
- public JpaComposite buildAttributeMappingComposite(
- JpaUiFactory factory,
- PropertyValueModel<EclipseLinkOrmIdMapping> subjectHolder,
- Composite parent,
- WidgetFactory widgetFactory) {
- return new EclipseLink1_1OrmIdMappingComposite(subjectHolder, parent, widgetFactory);
- }
-}
diff --git a/jpa/plugins/org.eclipse.jpt.eclipselink.ui/src/org/eclipse/jpt/eclipselink1_1/ui/internal/orm/details/EclipseLink1_1OrmManyToManyMappingComposite.java b/jpa/plugins/org.eclipse.jpt.eclipselink.ui/src/org/eclipse/jpt/eclipselink1_1/ui/internal/orm/details/EclipseLink1_1OrmManyToManyMappingComposite.java
deleted file mode 100644
index 910045ab79..0000000000
--- a/jpa/plugins/org.eclipse.jpt.eclipselink.ui/src/org/eclipse/jpt/eclipselink1_1/ui/internal/orm/details/EclipseLink1_1OrmManyToManyMappingComposite.java
+++ /dev/null
@@ -1,106 +0,0 @@
-/*******************************************************************************
- * Copyright (c) 2009 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.
- *
- * Contributors:
- * Oracle - initial API and implementation
- ******************************************************************************/
-package org.eclipse.jpt.eclipselink1_1.ui.internal.orm.details;
-
-import org.eclipse.jpt.core.context.AccessHolder;
-import org.eclipse.jpt.core.context.ManyToManyMapping;
-import org.eclipse.jpt.eclipselink.ui.internal.mappings.details.EclipseLinkManyToManyMappingComposite;
-import org.eclipse.jpt.eclipselink.ui.internal.mappings.details.JoinFetchComposite;
-import org.eclipse.jpt.ui.WidgetFactory;
-import org.eclipse.jpt.ui.internal.details.AccessTypeComposite;
-import org.eclipse.jpt.ui.internal.mappings.details.CascadeComposite;
-import org.eclipse.jpt.ui.internal.mappings.details.FetchTypeComposite;
-import org.eclipse.jpt.ui.internal.mappings.details.ManyToManyJoiningStrategyPane;
-import org.eclipse.jpt.ui.internal.mappings.details.OrderingComposite;
-import org.eclipse.jpt.ui.internal.mappings.details.TargetEntityComposite;
-import org.eclipse.jpt.utility.internal.model.value.PropertyAspectAdapter;
-import org.eclipse.jpt.utility.model.value.PropertyValueModel;
-import org.eclipse.swt.widgets.Composite;
-
-/**
- * Here the layout of this pane:
- * <pre>
- * -----------------------------------------------------------------------------
- * | ------------------------------------------------------------------------- |
- * | | | |
- * | | TargetEntityComposite | |
- * | | | |
- * | ------------------------------------------------------------------------- |
- * | ------------------------------------------------------------------------- |
- * | | | |
- * | | JoiningStrategyComposite | |
- * | | | |
- * | ------------------------------------------------------------------------- |
- * | ------------------------------------------------------------------------- |
- * | | | |
- * | | FetchTypeComposite | |
- * | | | |
- * | ------------------------------------------------------------------------- |
- * | ------------------------------------------------------------------------- |
- * | | | |
- * | | CascadeComposite | |
- * | | | |
- * | ------------------------------------------------------------------------- |
- * | ------------------------------------------------------------------------- |
- * | | | |
- * | | OrderingComposite | |
- * | | | |
- * | ------------------------------------------------------------------------- |
- * -----------------------------------------------------------------------------</pre>
- *
- * @see {@link ManyToManyMapping}
- * @see {@link BaseJpaUiFactory} - The factory creating this pane
- * @see {@link TargetEntityComposite}
- * @see {@link ManyToManyJoiningStrategyPane}
- * @see {@link FetchTypeComposite}
- * @see {@link CascadeComposite}
- * @see {@link OrderingComposite}
- *
- * @version 2.2
- * @since 2.2
- */
-public class EclipseLink1_1OrmManyToManyMappingComposite extends EclipseLinkManyToManyMappingComposite
-{
- /**
- * Creates a new <code>ManyToManyMappingComposite</code>.
- *
- * @param subjectHolder The holder of the subject <code>IManyToManyMapping</code>
- * @param parent The parent container
- * @param widgetFactory The factory used to create various common widgets
- */
- public EclipseLink1_1OrmManyToManyMappingComposite(PropertyValueModel<? extends ManyToManyMapping> subjectHolder,
- Composite parent,
- WidgetFactory widgetFactory) {
-
- super(subjectHolder, parent, widgetFactory);
- }
-
- @Override
- protected void initializeLayout(Composite container) {
- int groupBoxMargin = getGroupBoxMargin();
-
- new TargetEntityComposite(this, addPane(container, groupBoxMargin));
- new ManyToManyJoiningStrategyPane(this, buildJoiningHolder(), container);
- new AccessTypeComposite(this, buildAccessHolderHolder(), addPane(container, groupBoxMargin));
- new FetchTypeComposite(this, addPane(container, groupBoxMargin));
- new JoinFetchComposite(this, buildJoinFetchableHolder(), addPane(container, groupBoxMargin));
- new CascadeComposite(this, buildCascadeHolder(), addSubPane(container, 5));
- new OrderingComposite(this, container);
- }
-
- protected PropertyValueModel<AccessHolder> buildAccessHolderHolder() {
- return new PropertyAspectAdapter<ManyToManyMapping, AccessHolder>(getSubjectHolder()) {
- @Override
- protected AccessHolder buildValue_() {
- return this.subject.getPersistentAttribute();
- }
- };
- }
-} \ No newline at end of file
diff --git a/jpa/plugins/org.eclipse.jpt.eclipselink.ui/src/org/eclipse/jpt/eclipselink1_1/ui/internal/orm/details/EclipseLink1_1OrmManyToManyMappingUiProvider.java b/jpa/plugins/org.eclipse.jpt.eclipselink.ui/src/org/eclipse/jpt/eclipselink1_1/ui/internal/orm/details/EclipseLink1_1OrmManyToManyMappingUiProvider.java
deleted file mode 100644
index fcfe60392b..0000000000
--- a/jpa/plugins/org.eclipse.jpt.eclipselink.ui/src/org/eclipse/jpt/eclipselink1_1/ui/internal/orm/details/EclipseLink1_1OrmManyToManyMappingUiProvider.java
+++ /dev/null
@@ -1,56 +0,0 @@
-/*******************************************************************************
- * Copyright (c) 2009 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.
- *
- * Contributors:
- * Oracle - initial API and implementation
- ******************************************************************************/
-package org.eclipse.jpt.eclipselink1_1.ui.internal.orm.details;
-
-import org.eclipse.core.runtime.content.IContentType;
-import org.eclipse.jpt.eclipselink.core.internal.JptEclipseLinkCorePlugin;
-import org.eclipse.jpt.eclipselink.core.internal.context.orm.EclipseLinkOrmManyToManyMapping;
-import org.eclipse.jpt.ui.JpaUiFactory;
-import org.eclipse.jpt.ui.WidgetFactory;
-import org.eclipse.jpt.ui.details.AttributeMappingUiProvider;
-import org.eclipse.jpt.ui.details.JpaComposite;
-import org.eclipse.jpt.ui.internal.details.AbstractManyToManyMappingUiProvider;
-import org.eclipse.jpt.utility.model.value.PropertyValueModel;
-import org.eclipse.swt.widgets.Composite;
-
-public class EclipseLink1_1OrmManyToManyMappingUiProvider
- extends AbstractManyToManyMappingUiProvider<EclipseLinkOrmManyToManyMapping>
-{
- // singleton
- private static final EclipseLink1_1OrmManyToManyMappingUiProvider INSTANCE =
- new EclipseLink1_1OrmManyToManyMappingUiProvider();
-
- /**
- * Return the singleton.
- */
- public static AttributeMappingUiProvider<EclipseLinkOrmManyToManyMapping> instance() {
- return INSTANCE;
- }
-
-
- /**
- * Ensure single instance.
- */
- private EclipseLink1_1OrmManyToManyMappingUiProvider() {
- super();
- }
-
- public IContentType getContentType() {
- return JptEclipseLinkCorePlugin.ECLIPSELINK1_1_ORM_XML_CONTENT_TYPE;
- }
-
- public JpaComposite buildAttributeMappingComposite(
- JpaUiFactory factory,
- PropertyValueModel<EclipseLinkOrmManyToManyMapping> subjectHolder,
- Composite parent,
- WidgetFactory widgetFactory) {
- return new EclipseLink1_1OrmManyToManyMappingComposite(subjectHolder, parent, widgetFactory);
- }
-}
diff --git a/jpa/plugins/org.eclipse.jpt.eclipselink.ui/src/org/eclipse/jpt/eclipselink1_1/ui/internal/orm/details/EclipseLink1_1OrmManyToOneMappingComposite.java b/jpa/plugins/org.eclipse.jpt.eclipselink.ui/src/org/eclipse/jpt/eclipselink1_1/ui/internal/orm/details/EclipseLink1_1OrmManyToOneMappingComposite.java
deleted file mode 100644
index f9364f1b86..0000000000
--- a/jpa/plugins/org.eclipse.jpt.eclipselink.ui/src/org/eclipse/jpt/eclipselink1_1/ui/internal/orm/details/EclipseLink1_1OrmManyToOneMappingComposite.java
+++ /dev/null
@@ -1,107 +0,0 @@
-/*******************************************************************************
- * Copyright (c) 2009 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.
- *
- * Contributors:
- * Oracle - initial API and implementation
- ******************************************************************************/
-package org.eclipse.jpt.eclipselink1_1.ui.internal.orm.details;
-
-import org.eclipse.jpt.core.context.AccessHolder;
-import org.eclipse.jpt.core.context.ManyToOneMapping;
-import org.eclipse.jpt.eclipselink.ui.internal.mappings.details.EclipseLinkManyToOneMappingComposite;
-import org.eclipse.jpt.eclipselink.ui.internal.mappings.details.JoinFetchComposite;
-import org.eclipse.jpt.ui.WidgetFactory;
-import org.eclipse.jpt.ui.internal.details.AccessTypeComposite;
-import org.eclipse.jpt.ui.internal.mappings.details.CascadeComposite;
-import org.eclipse.jpt.ui.internal.mappings.details.FetchTypeComposite;
-import org.eclipse.jpt.ui.internal.mappings.details.ManyToOneJoiningStrategyPane;
-import org.eclipse.jpt.ui.internal.mappings.details.OptionalComposite;
-import org.eclipse.jpt.ui.internal.mappings.details.TargetEntityComposite;
-import org.eclipse.jpt.utility.internal.model.value.PropertyAspectAdapter;
-import org.eclipse.jpt.utility.model.value.PropertyValueModel;
-import org.eclipse.swt.widgets.Composite;
-
-/**
- * Here the layout of this pane:
- * <pre>
- * -----------------------------------------------------------------------------
- * | ------------------------------------------------------------------------- |
- * | | | |
- * | | TargetEntityComposite | |
- * | | | |
- * | ------------------------------------------------------------------------- |
- * | ------------------------------------------------------------------------- |
- * | | | |
- * | | JoiningStrategyComposite | |
- * | | | |
- * | ------------------------------------------------------------------------- |
- * | ------------------------------------------------------------------------- |
- * | | | |
- * | | FetchTypeComposite | |
- * | | | |
- * | ------------------------------------------------------------------------- |
- * | ------------------------------------------------------------------------- |
- * | | | |
- * | | OptionalComposite | |
- * | | | |
- * | ------------------------------------------------------------------------- |
- * | ------------------------------------------------------------------------- |
- * | | | |
- * | | CascadeComposite | |
- * | | | |
- * | ------------------------------------------------------------------------- |
- * -----------------------------------------------------------------------------</pre>
- *
- * @see {@link ManyToOneMapping}
- * @see {@link BaseJpaUiFactory} - The factory creating this pane
- * @see {@link TargetEntityComposite}
- * @see {@link ManyToOneJoiningStrategyPane}
- * @see {@link FetchTypeComposite}
- * @see {@link OptionalComposite}
- * @see {@link CascadeComposite}
- *
- * @version 2.2
- * @since 2.2
- */
-public class EclipseLink1_1OrmManyToOneMappingComposite extends EclipseLinkManyToOneMappingComposite
-{
- /**
- * Creates a new <code>EclipseLink1_1ManyToOneMappingComposite</code>.
- *
- * @param subjectHolder The holder of the subject <code>ManyToOneMapping</code>
- * @param parent The parent container
- * @param widgetFactory The factory used to create various common widgets
- */
- public EclipseLink1_1OrmManyToOneMappingComposite(PropertyValueModel<? extends ManyToOneMapping> subjectHolder,
- Composite parent,
- WidgetFactory widgetFactory) {
-
- super(subjectHolder, parent, widgetFactory);
- }
-
- @Override
- protected void initializeLayout(Composite container) {
- int groupBoxMargin = getGroupBoxMargin();
-
- new TargetEntityComposite(this, addPane(container, groupBoxMargin));
- new ManyToOneJoiningStrategyPane(this, buildJoiningHolder(), container);
- new AccessTypeComposite(this, buildAccessHolderHolder(), addPane(container, groupBoxMargin));
- new FetchTypeComposite(this, addPane(container, groupBoxMargin));
- new JoinFetchComposite(this, buildJoinFetchableHolder(), addPane(container, groupBoxMargin));
- new OptionalComposite(this, addPane(container, groupBoxMargin));
- new CascadeComposite(this, buildCascadeHolder(), addSubPane(container, 5));
- }
-
- protected PropertyValueModel<AccessHolder> buildAccessHolderHolder() {
- return new PropertyAspectAdapter<ManyToOneMapping, AccessHolder>(getSubjectHolder()) {
- @Override
- protected AccessHolder buildValue_() {
- return this.subject.getPersistentAttribute();
- }
- };
- }
-
-}
diff --git a/jpa/plugins/org.eclipse.jpt.eclipselink.ui/src/org/eclipse/jpt/eclipselink1_1/ui/internal/orm/details/EclipseLink1_1OrmManyToOneMappingUiProvider.java b/jpa/plugins/org.eclipse.jpt.eclipselink.ui/src/org/eclipse/jpt/eclipselink1_1/ui/internal/orm/details/EclipseLink1_1OrmManyToOneMappingUiProvider.java
deleted file mode 100644
index dd96870968..0000000000
--- a/jpa/plugins/org.eclipse.jpt.eclipselink.ui/src/org/eclipse/jpt/eclipselink1_1/ui/internal/orm/details/EclipseLink1_1OrmManyToOneMappingUiProvider.java
+++ /dev/null
@@ -1,56 +0,0 @@
-/*******************************************************************************
- * Copyright (c) 2009 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.
- *
- * Contributors:
- * Oracle - initial API and implementation
- ******************************************************************************/
-package org.eclipse.jpt.eclipselink1_1.ui.internal.orm.details;
-
-import org.eclipse.core.runtime.content.IContentType;
-import org.eclipse.jpt.eclipselink.core.internal.JptEclipseLinkCorePlugin;
-import org.eclipse.jpt.eclipselink.core.internal.context.orm.EclipseLinkOrmManyToOneMapping;
-import org.eclipse.jpt.ui.JpaUiFactory;
-import org.eclipse.jpt.ui.WidgetFactory;
-import org.eclipse.jpt.ui.details.AttributeMappingUiProvider;
-import org.eclipse.jpt.ui.details.JpaComposite;
-import org.eclipse.jpt.ui.internal.details.AbstractManyToOneMappingUiProvider;
-import org.eclipse.jpt.utility.model.value.PropertyValueModel;
-import org.eclipse.swt.widgets.Composite;
-
-public class EclipseLink1_1OrmManyToOneMappingUiProvider
- extends AbstractManyToOneMappingUiProvider<EclipseLinkOrmManyToOneMapping>
-{
- // singleton
- private static final EclipseLink1_1OrmManyToOneMappingUiProvider INSTANCE =
- new EclipseLink1_1OrmManyToOneMappingUiProvider();
-
- /**
- * Return the singleton.
- */
- public static AttributeMappingUiProvider<EclipseLinkOrmManyToOneMapping> instance() {
- return INSTANCE;
- }
-
-
- /**
- * Ensure single instance.
- */
- private EclipseLink1_1OrmManyToOneMappingUiProvider() {
- super();
- }
-
- public IContentType getContentType() {
- return JptEclipseLinkCorePlugin.ECLIPSELINK1_1_ORM_XML_CONTENT_TYPE;
- }
-
- public JpaComposite buildAttributeMappingComposite(
- JpaUiFactory factory,
- PropertyValueModel<EclipseLinkOrmManyToOneMapping> subjectHolder,
- Composite parent,
- WidgetFactory widgetFactory) {
- return new EclipseLink1_1OrmManyToOneMappingComposite(subjectHolder, parent, widgetFactory);
- }
-}
diff --git a/jpa/plugins/org.eclipse.jpt.eclipselink.ui/src/org/eclipse/jpt/eclipselink1_1/ui/internal/orm/details/EclipseLink1_1OrmMappedSuperclassUiProvider.java b/jpa/plugins/org.eclipse.jpt.eclipselink.ui/src/org/eclipse/jpt/eclipselink1_1/ui/internal/orm/details/EclipseLink1_1OrmMappedSuperclassUiProvider.java
deleted file mode 100644
index e66c3c88eb..0000000000
--- a/jpa/plugins/org.eclipse.jpt.eclipselink.ui/src/org/eclipse/jpt/eclipselink1_1/ui/internal/orm/details/EclipseLink1_1OrmMappedSuperclassUiProvider.java
+++ /dev/null
@@ -1,54 +0,0 @@
-/*******************************************************************************
- * Copyright (c) 2009 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
- *
- * Contributors:
- * Oracle - initial API and implementation
- *******************************************************************************/
-package org.eclipse.jpt.eclipselink1_1.ui.internal.orm.details;
-
-import org.eclipse.core.runtime.content.IContentType;
-import org.eclipse.jpt.eclipselink.core.internal.JptEclipseLinkCorePlugin;
-import org.eclipse.jpt.eclipselink.core.internal.context.orm.EclipseLinkOrmMappedSuperclass;
-import org.eclipse.jpt.eclipselink.ui.internal.orm.details.EclipseLinkOrmMappedSuperclassComposite;
-import org.eclipse.jpt.ui.JpaUiFactory;
-import org.eclipse.jpt.ui.WidgetFactory;
-import org.eclipse.jpt.ui.details.JpaComposite;
-import org.eclipse.jpt.ui.details.TypeMappingUiProvider;
-import org.eclipse.jpt.ui.internal.details.AbstractMappedSuperclassUiProvider;
-import org.eclipse.jpt.utility.model.value.PropertyValueModel;
-import org.eclipse.swt.widgets.Composite;
-
-public class EclipseLink1_1OrmMappedSuperclassUiProvider
- extends AbstractMappedSuperclassUiProvider<EclipseLinkOrmMappedSuperclass>
-{
- // singleton
- private static final EclipseLink1_1OrmMappedSuperclassUiProvider INSTANCE =
- new EclipseLink1_1OrmMappedSuperclassUiProvider();
-
- /**
- * Return the singleton.
- */
- public static TypeMappingUiProvider<EclipseLinkOrmMappedSuperclass> instance() {
- return INSTANCE;
- }
-
-
- /**
- * Ensure single instance.
- */
- private EclipseLink1_1OrmMappedSuperclassUiProvider() {
- super();
- }
-
- public IContentType getContentType() {
- return JptEclipseLinkCorePlugin.ECLIPSELINK1_1_ORM_XML_CONTENT_TYPE;
- }
-
- public JpaComposite buildPersistentTypeMappingComposite(JpaUiFactory factory, PropertyValueModel<EclipseLinkOrmMappedSuperclass> subjectHolder, Composite parent, WidgetFactory widgetFactory) {
- return new EclipseLinkOrmMappedSuperclassComposite(subjectHolder, parent, widgetFactory);
- }
-}
diff --git a/jpa/plugins/org.eclipse.jpt.eclipselink.ui/src/org/eclipse/jpt/eclipselink1_1/ui/internal/orm/details/EclipseLink1_1OrmOneToManyMappingComposite.java b/jpa/plugins/org.eclipse.jpt.eclipselink.ui/src/org/eclipse/jpt/eclipselink1_1/ui/internal/orm/details/EclipseLink1_1OrmOneToManyMappingComposite.java
deleted file mode 100644
index 829a2fb8e6..0000000000
--- a/jpa/plugins/org.eclipse.jpt.eclipselink.ui/src/org/eclipse/jpt/eclipselink1_1/ui/internal/orm/details/EclipseLink1_1OrmOneToManyMappingComposite.java
+++ /dev/null
@@ -1,61 +0,0 @@
-/*******************************************************************************
- * Copyright (c) 2009 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.
- *
- * Contributors:
- * Oracle - initial API and implementation
- ******************************************************************************/
-package org.eclipse.jpt.eclipselink1_1.ui.internal.orm.details;
-
-import org.eclipse.jpt.core.context.AccessHolder;
-import org.eclipse.jpt.core.context.OneToManyMapping;
-import org.eclipse.jpt.eclipselink.core.context.EclipseLinkOneToManyMapping;
-import org.eclipse.jpt.eclipselink.ui.internal.mappings.details.EclipseLinkOneToManyJoiningStrategyPane;
-import org.eclipse.jpt.eclipselink.ui.internal.mappings.details.EclipseLinkOneToManyMappingComposite;
-import org.eclipse.jpt.eclipselink.ui.internal.mappings.details.JoinFetchComposite;
-import org.eclipse.jpt.eclipselink.ui.internal.mappings.details.PrivateOwnedComposite;
-import org.eclipse.jpt.ui.WidgetFactory;
-import org.eclipse.jpt.ui.internal.details.AccessTypeComposite;
-import org.eclipse.jpt.ui.internal.mappings.details.CascadeComposite;
-import org.eclipse.jpt.ui.internal.mappings.details.FetchTypeComposite;
-import org.eclipse.jpt.ui.internal.mappings.details.OrderingComposite;
-import org.eclipse.jpt.ui.internal.mappings.details.TargetEntityComposite;
-import org.eclipse.jpt.utility.internal.model.value.PropertyAspectAdapter;
-import org.eclipse.jpt.utility.model.value.PropertyValueModel;
-import org.eclipse.swt.widgets.Composite;
-
-
-public class EclipseLink1_1OrmOneToManyMappingComposite extends EclipseLinkOneToManyMappingComposite
-{
- public EclipseLink1_1OrmOneToManyMappingComposite(
- PropertyValueModel<? extends EclipseLinkOneToManyMapping> subjectHolder,
- Composite parent,
- WidgetFactory widgetFactory) {
- super(subjectHolder, parent, widgetFactory);
- }
-
- @Override
- protected void initializeLayout(Composite container) {
- int groupBoxMargin = getGroupBoxMargin();
-
- new TargetEntityComposite(this, addPane(container, groupBoxMargin));
- new EclipseLinkOneToManyJoiningStrategyPane(this, buildJoiningHolder(), container);
- new AccessTypeComposite(this, buildAccessHolderHolder(), addPane(container, groupBoxMargin));
- new FetchTypeComposite(this, addPane(container, groupBoxMargin));
- new JoinFetchComposite(this, buildJoinFetchableHolder(), addPane(container, groupBoxMargin));
- new PrivateOwnedComposite(this, buildPrivateOwnableHolder(), addPane(container, groupBoxMargin));
- new CascadeComposite(this, buildCascadeHolder(), addSubPane(container, 5));
- new OrderingComposite(this, container);
- }
-
- protected PropertyValueModel<AccessHolder> buildAccessHolderHolder() {
- return new PropertyAspectAdapter<OneToManyMapping, AccessHolder>(getSubjectHolder()) {
- @Override
- protected AccessHolder buildValue_() {
- return this.subject.getPersistentAttribute();
- }
- };
- }
-} \ No newline at end of file
diff --git a/jpa/plugins/org.eclipse.jpt.eclipselink.ui/src/org/eclipse/jpt/eclipselink1_1/ui/internal/orm/details/EclipseLink1_1OrmOneToManyMappingUiProvider.java b/jpa/plugins/org.eclipse.jpt.eclipselink.ui/src/org/eclipse/jpt/eclipselink1_1/ui/internal/orm/details/EclipseLink1_1OrmOneToManyMappingUiProvider.java
deleted file mode 100644
index ee73ad7f92..0000000000
--- a/jpa/plugins/org.eclipse.jpt.eclipselink.ui/src/org/eclipse/jpt/eclipselink1_1/ui/internal/orm/details/EclipseLink1_1OrmOneToManyMappingUiProvider.java
+++ /dev/null
@@ -1,56 +0,0 @@
-/*******************************************************************************
- * Copyright (c) 2009 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.
- *
- * Contributors:
- * Oracle - initial API and implementation
- ******************************************************************************/
-package org.eclipse.jpt.eclipselink1_1.ui.internal.orm.details;
-
-import org.eclipse.core.runtime.content.IContentType;
-import org.eclipse.jpt.eclipselink.core.internal.JptEclipseLinkCorePlugin;
-import org.eclipse.jpt.eclipselink.core.internal.context.orm.EclipseLinkOrmOneToManyMapping;
-import org.eclipse.jpt.ui.JpaUiFactory;
-import org.eclipse.jpt.ui.WidgetFactory;
-import org.eclipse.jpt.ui.details.AttributeMappingUiProvider;
-import org.eclipse.jpt.ui.details.JpaComposite;
-import org.eclipse.jpt.ui.internal.details.AbstractOneToManyMappingUiProvider;
-import org.eclipse.jpt.utility.model.value.PropertyValueModel;
-import org.eclipse.swt.widgets.Composite;
-
-public class EclipseLink1_1OrmOneToManyMappingUiProvider
- extends AbstractOneToManyMappingUiProvider<EclipseLinkOrmOneToManyMapping>
-{
- // singleton
- private static final EclipseLink1_1OrmOneToManyMappingUiProvider INSTANCE =
- new EclipseLink1_1OrmOneToManyMappingUiProvider();
-
- /**
- * Return the singleton.
- */
- public static AttributeMappingUiProvider<EclipseLinkOrmOneToManyMapping> instance() {
- return INSTANCE;
- }
-
-
- /**
- * Ensure single instance.
- */
- private EclipseLink1_1OrmOneToManyMappingUiProvider() {
- super();
- }
-
- public IContentType getContentType() {
- return JptEclipseLinkCorePlugin.ECLIPSELINK1_1_ORM_XML_CONTENT_TYPE;
- }
-
- public JpaComposite buildAttributeMappingComposite(
- JpaUiFactory factory,
- PropertyValueModel<EclipseLinkOrmOneToManyMapping> subjectHolder,
- Composite parent,
- WidgetFactory widgetFactory) {
- return new EclipseLink1_1OrmOneToManyMappingComposite(subjectHolder, parent, widgetFactory);
- }
-}
diff --git a/jpa/plugins/org.eclipse.jpt.eclipselink.ui/src/org/eclipse/jpt/eclipselink1_1/ui/internal/orm/details/EclipseLink1_1OrmOneToOneMappingComposite.java b/jpa/plugins/org.eclipse.jpt.eclipselink.ui/src/org/eclipse/jpt/eclipselink1_1/ui/internal/orm/details/EclipseLink1_1OrmOneToOneMappingComposite.java
deleted file mode 100644
index b67387ead3..0000000000
--- a/jpa/plugins/org.eclipse.jpt.eclipselink.ui/src/org/eclipse/jpt/eclipselink1_1/ui/internal/orm/details/EclipseLink1_1OrmOneToOneMappingComposite.java
+++ /dev/null
@@ -1,114 +0,0 @@
-/*******************************************************************************
- * Copyright (c) 2009 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.
- *
- * Contributors:
- * Oracle - initial API and implementation
- ******************************************************************************/
-package org.eclipse.jpt.eclipselink1_1.ui.internal.orm.details;
-
-import org.eclipse.jpt.core.context.AccessHolder;
-import org.eclipse.jpt.core.context.OneToOneMapping;
-import org.eclipse.jpt.eclipselink.ui.internal.mappings.details.EclipseLinkOneToOneMappingComposite;
-import org.eclipse.jpt.eclipselink.ui.internal.mappings.details.JoinFetchComposite;
-import org.eclipse.jpt.eclipselink.ui.internal.mappings.details.PrivateOwnedComposite;
-import org.eclipse.jpt.ui.WidgetFactory;
-import org.eclipse.jpt.ui.internal.details.AccessTypeComposite;
-import org.eclipse.jpt.ui.internal.mappings.details.CascadeComposite;
-import org.eclipse.jpt.ui.internal.mappings.details.FetchTypeComposite;
-import org.eclipse.jpt.ui.internal.mappings.details.OneToOneJoiningStrategyPane;
-import org.eclipse.jpt.ui.internal.mappings.details.OptionalComposite;
-import org.eclipse.jpt.ui.internal.mappings.details.TargetEntityComposite;
-import org.eclipse.jpt.utility.internal.model.value.PropertyAspectAdapter;
-import org.eclipse.jpt.utility.model.value.PropertyValueModel;
-import org.eclipse.swt.widgets.Composite;
-
-/**
- * Here the layout of this pane:
- * <pre>
- * -----------------------------------------------------------------------------
- * | ------------------------------------------------------------------------- |
- * | | | |
- * | | TargetEntityComposite | |
- * | | | |
- * | ------------------------------------------------------------------------- |
- * | ------------------------------------------------------------------------- |
- * | | | |
- * | | FetchTypeComposite | |
- * | | | |
- * | ------------------------------------------------------------------------- |
- * | ------------------------------------------------------------------------- |
- * | | | |
- * | | MappedByPane | |
- * | | | |
- * | ------------------------------------------------------------------------- |
- * | ------------------------------------------------------------------------- |
- * | | | |
- * | | OptionalComposite | |
- * | | | |
- * | ------------------------------------------------------------------------- |
- * | ------------------------------------------------------------------------- |
- * | | | |
- * | | CascadeComposite | |
- * | | | |
- * | ------------------------------------------------------------------------- |
- * | ------------------------------------------------------------------------- |
- * | | | |
- * | | JoinColumnComposite | |
- * | | | |
- * | ------------------------------------------------------------------------- |
- * -----------------------------------------------------------------------------</pre>
- *
- * @see OneToOneMapping
- * @see BaseJpaUiFactory - The factory creating this pane
- * @see CascadeComposite
- * @see FetchTypeComposite
- * @see JoinColumnComposite
- * @see MappedByPane
- * @see OptionalComposite
- * @see TargetEntityComposite
- *
- * @version 2.2
- * @since 2.2
- */
-public class EclipseLink1_1OrmOneToOneMappingComposite extends EclipseLinkOneToOneMappingComposite
-{
- /**
- * Creates a new <code>Eclipselink1_1OneToOneMappingComposite</code>.
- *
- * @param subjectHolder The holder of the subject <code>IOneToOneMapping</code>
- * @param parent The parent container
- * @param widgetFactory The factory used to create various common widgets
- */
- public EclipseLink1_1OrmOneToOneMappingComposite(PropertyValueModel<? extends OneToOneMapping> subjectHolder,
- Composite parent,
- WidgetFactory widgetFactory) {
-
- super(subjectHolder, parent, widgetFactory);
- }
-
- @Override
- protected void initializeLayout(Composite container) {
- int groupBoxMargin = getGroupBoxMargin();
-
- new TargetEntityComposite(this, addPane(container, groupBoxMargin));
- new AccessTypeComposite(this, buildAccessHolderHolder(), addPane(container, groupBoxMargin));
- new OneToOneJoiningStrategyPane(this, buildJoiningHolder(), container);
- new FetchTypeComposite(this, addPane(container, groupBoxMargin));
- new JoinFetchComposite(this, buildJoinFetchableHolder(), addPane(container, groupBoxMargin));
- new OptionalComposite(this, addPane(container, groupBoxMargin));
- new PrivateOwnedComposite(this, buildPrivateOwnableHolder(), addPane(container, groupBoxMargin));
- new CascadeComposite(this, buildCascadeHolder(), addSubPane(container, 5));
- }
-
- protected PropertyValueModel<AccessHolder> buildAccessHolderHolder() {
- return new PropertyAspectAdapter<OneToOneMapping, AccessHolder>(getSubjectHolder()) {
- @Override
- protected AccessHolder buildValue_() {
- return this.subject.getPersistentAttribute();
- }
- };
- }
-} \ No newline at end of file
diff --git a/jpa/plugins/org.eclipse.jpt.eclipselink.ui/src/org/eclipse/jpt/eclipselink1_1/ui/internal/orm/details/EclipseLink1_1OrmOneToOneMappingUiProvider.java b/jpa/plugins/org.eclipse.jpt.eclipselink.ui/src/org/eclipse/jpt/eclipselink1_1/ui/internal/orm/details/EclipseLink1_1OrmOneToOneMappingUiProvider.java
deleted file mode 100644
index 194c092021..0000000000
--- a/jpa/plugins/org.eclipse.jpt.eclipselink.ui/src/org/eclipse/jpt/eclipselink1_1/ui/internal/orm/details/EclipseLink1_1OrmOneToOneMappingUiProvider.java
+++ /dev/null
@@ -1,56 +0,0 @@
-/*******************************************************************************
- * Copyright (c) 2009 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.
- *
- * Contributors:
- * Oracle - initial API and implementation
- ******************************************************************************/
-package org.eclipse.jpt.eclipselink1_1.ui.internal.orm.details;
-
-import org.eclipse.core.runtime.content.IContentType;
-import org.eclipse.jpt.eclipselink.core.internal.JptEclipseLinkCorePlugin;
-import org.eclipse.jpt.eclipselink.core.internal.context.orm.EclipseLinkOrmOneToOneMapping;
-import org.eclipse.jpt.ui.JpaUiFactory;
-import org.eclipse.jpt.ui.WidgetFactory;
-import org.eclipse.jpt.ui.details.AttributeMappingUiProvider;
-import org.eclipse.jpt.ui.details.JpaComposite;
-import org.eclipse.jpt.ui.internal.details.AbstractOneToOneMappingUiProvider;
-import org.eclipse.jpt.utility.model.value.PropertyValueModel;
-import org.eclipse.swt.widgets.Composite;
-
-public class EclipseLink1_1OrmOneToOneMappingUiProvider
- extends AbstractOneToOneMappingUiProvider<EclipseLinkOrmOneToOneMapping>
-{
- // singleton
- private static final EclipseLink1_1OrmOneToOneMappingUiProvider INSTANCE =
- new EclipseLink1_1OrmOneToOneMappingUiProvider();
-
- /**
- * Return the singleton.
- */
- public static AttributeMappingUiProvider<EclipseLinkOrmOneToOneMapping> instance() {
- return INSTANCE;
- }
-
-
- /**
- * Ensure single instance.
- */
- private EclipseLink1_1OrmOneToOneMappingUiProvider() {
- super();
- }
-
- public IContentType getContentType() {
- return JptEclipseLinkCorePlugin.ECLIPSELINK1_1_ORM_XML_CONTENT_TYPE;
- }
-
- public JpaComposite buildAttributeMappingComposite(
- JpaUiFactory factory,
- PropertyValueModel<EclipseLinkOrmOneToOneMapping> subjectHolder,
- Composite parent,
- WidgetFactory widgetFactory) {
- return new EclipseLink1_1OrmOneToOneMappingComposite(subjectHolder, parent, widgetFactory);
- }
-}
diff --git a/jpa/plugins/org.eclipse.jpt.eclipselink.ui/src/org/eclipse/jpt/eclipselink1_1/ui/internal/orm/details/EclipseLink1_1OrmTransformationMappingUiProvider.java b/jpa/plugins/org.eclipse.jpt.eclipselink.ui/src/org/eclipse/jpt/eclipselink1_1/ui/internal/orm/details/EclipseLink1_1OrmTransformationMappingUiProvider.java
deleted file mode 100644
index 7677e71637..0000000000
--- a/jpa/plugins/org.eclipse.jpt.eclipselink.ui/src/org/eclipse/jpt/eclipselink1_1/ui/internal/orm/details/EclipseLink1_1OrmTransformationMappingUiProvider.java
+++ /dev/null
@@ -1,57 +0,0 @@
-/*******************************************************************************
- * Copyright (c) 2009 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.
- *
- * Contributors:
- * Oracle - initial API and implementation
- ******************************************************************************/
-package org.eclipse.jpt.eclipselink1_1.ui.internal.orm.details;
-
-import org.eclipse.core.runtime.content.IContentType;
-import org.eclipse.jpt.eclipselink.core.context.TransformationMapping;
-import org.eclipse.jpt.eclipselink.core.internal.JptEclipseLinkCorePlugin;
-import org.eclipse.jpt.eclipselink.ui.internal.mappings.details.EclipseLinkTransformationMappingUiProvider;
-import org.eclipse.jpt.eclipselink.ui.internal.mappings.details.TransformationMappingComposite;
-import org.eclipse.jpt.ui.JpaUiFactory;
-import org.eclipse.jpt.ui.WidgetFactory;
-import org.eclipse.jpt.ui.details.AttributeMappingUiProvider;
-import org.eclipse.jpt.ui.details.JpaComposite;
-import org.eclipse.jpt.utility.model.value.PropertyValueModel;
-import org.eclipse.swt.widgets.Composite;
-
-public class EclipseLink1_1OrmTransformationMappingUiProvider extends EclipseLinkTransformationMappingUiProvider<TransformationMapping>
-{
- // singleton
- private static final EclipseLink1_1OrmTransformationMappingUiProvider INSTANCE =
- new EclipseLink1_1OrmTransformationMappingUiProvider();
-
- /**
- * Return the singleton.
- */
- public static AttributeMappingUiProvider<TransformationMapping> instance() {
- return INSTANCE;
- }
-
-
- /**
- * Ensure single instance.
- */
- private EclipseLink1_1OrmTransformationMappingUiProvider() {
- super();
- }
-
- public IContentType getContentType() {
- return JptEclipseLinkCorePlugin.ECLIPSELINK1_1_ORM_XML_CONTENT_TYPE;
- }
-
- public JpaComposite buildAttributeMappingComposite(
- JpaUiFactory factory,
- PropertyValueModel<TransformationMapping> subjectHolder,
- Composite parent,
- WidgetFactory widgetFactory) {
-
- return new TransformationMappingComposite(subjectHolder, parent, widgetFactory);
- }
-}
diff --git a/jpa/plugins/org.eclipse.jpt.eclipselink.ui/src/org/eclipse/jpt/eclipselink1_1/ui/internal/orm/details/EclipseLink1_1OrmTransientMappingUiProvider.java b/jpa/plugins/org.eclipse.jpt.eclipselink.ui/src/org/eclipse/jpt/eclipselink1_1/ui/internal/orm/details/EclipseLink1_1OrmTransientMappingUiProvider.java
deleted file mode 100644
index 20225d8b36..0000000000
--- a/jpa/plugins/org.eclipse.jpt.eclipselink.ui/src/org/eclipse/jpt/eclipselink1_1/ui/internal/orm/details/EclipseLink1_1OrmTransientMappingUiProvider.java
+++ /dev/null
@@ -1,57 +0,0 @@
-/*******************************************************************************
- * Copyright (c) 2009 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
- *
- * Contributors:
- * Oracle - initial API and implementation
- *******************************************************************************/
-package org.eclipse.jpt.eclipselink1_1.ui.internal.orm.details;
-
-import org.eclipse.core.runtime.content.IContentType;
-import org.eclipse.jpt.core.context.orm.OrmTransientMapping;
-import org.eclipse.jpt.eclipselink.core.internal.JptEclipseLinkCorePlugin;
-import org.eclipse.jpt.ui.JpaUiFactory;
-import org.eclipse.jpt.ui.WidgetFactory;
-import org.eclipse.jpt.ui.details.AttributeMappingUiProvider;
-import org.eclipse.jpt.ui.details.JpaComposite;
-import org.eclipse.jpt.ui.internal.details.AbstractTransientMappingUiProvider;
-import org.eclipse.jpt.utility.model.value.PropertyValueModel;
-import org.eclipse.swt.widgets.Composite;
-
-public class EclipseLink1_1OrmTransientMappingUiProvider
- extends AbstractTransientMappingUiProvider<OrmTransientMapping>
-{
- // singleton
- private static final EclipseLink1_1OrmTransientMappingUiProvider INSTANCE =
- new EclipseLink1_1OrmTransientMappingUiProvider();
-
- /**
- * Return the singleton.
- */
- public static AttributeMappingUiProvider<OrmTransientMapping> instance() {
- return INSTANCE;
- }
-
-
- /**
- * Ensure single instance.
- */
- private EclipseLink1_1OrmTransientMappingUiProvider() {
- super();
- }
-
- public IContentType getContentType() {
- return JptEclipseLinkCorePlugin.ECLIPSELINK1_1_ORM_XML_CONTENT_TYPE;
- }
-
- public JpaComposite buildAttributeMappingComposite(
- JpaUiFactory factory,
- PropertyValueModel<OrmTransientMapping> subjectHolder,
- Composite parent,
- WidgetFactory widgetFactory) {
- return factory.createOrmTransientMappingComposite(subjectHolder, parent, widgetFactory);
- }
-}
diff --git a/jpa/plugins/org.eclipse.jpt.eclipselink.ui/src/org/eclipse/jpt/eclipselink1_1/ui/internal/orm/details/EclipseLink1_1OrmVariableOneToOneMappingUiProvider.java b/jpa/plugins/org.eclipse.jpt.eclipselink.ui/src/org/eclipse/jpt/eclipselink1_1/ui/internal/orm/details/EclipseLink1_1OrmVariableOneToOneMappingUiProvider.java
deleted file mode 100644
index 3c4d152d6f..0000000000
--- a/jpa/plugins/org.eclipse.jpt.eclipselink.ui/src/org/eclipse/jpt/eclipselink1_1/ui/internal/orm/details/EclipseLink1_1OrmVariableOneToOneMappingUiProvider.java
+++ /dev/null
@@ -1,56 +0,0 @@
-/*******************************************************************************
- * Copyright (c) 2009 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.
- *
- * Contributors:
- * Oracle - initial API and implementation
- ******************************************************************************/
-package org.eclipse.jpt.eclipselink1_1.ui.internal.orm.details;
-
-import org.eclipse.core.runtime.content.IContentType;
-import org.eclipse.jpt.eclipselink.core.context.VariableOneToOneMapping;
-import org.eclipse.jpt.eclipselink.core.internal.JptEclipseLinkCorePlugin;
-import org.eclipse.jpt.eclipselink.ui.internal.mappings.details.EclipseLinkVariableOneToOneMappingUiProvider;
-import org.eclipse.jpt.eclipselink.ui.internal.mappings.details.VariableOneToOneMappingComposite;
-import org.eclipse.jpt.ui.JpaUiFactory;
-import org.eclipse.jpt.ui.WidgetFactory;
-import org.eclipse.jpt.ui.details.AttributeMappingUiProvider;
-import org.eclipse.jpt.ui.details.JpaComposite;
-import org.eclipse.jpt.utility.model.value.PropertyValueModel;
-import org.eclipse.swt.widgets.Composite;
-
-public class EclipseLink1_1OrmVariableOneToOneMappingUiProvider extends EclipseLinkVariableOneToOneMappingUiProvider<VariableOneToOneMapping>
-{
- // singleton
- private static final EclipseLink1_1OrmVariableOneToOneMappingUiProvider INSTANCE =
- new EclipseLink1_1OrmVariableOneToOneMappingUiProvider();
-
- /**
- * Return the singleton.
- */
- public static AttributeMappingUiProvider<VariableOneToOneMapping> instance() {
- return INSTANCE;
- }
-
-
- /**
- * Ensure single instance.
- */
- private EclipseLink1_1OrmVariableOneToOneMappingUiProvider() {
- super();
- }
-
- public IContentType getContentType() {
- return JptEclipseLinkCorePlugin.ECLIPSELINK1_1_ORM_XML_CONTENT_TYPE;
- }
-
- public JpaComposite buildAttributeMappingComposite(
- JpaUiFactory factory,
- PropertyValueModel<VariableOneToOneMapping> subjectHolder,
- Composite parent,
- WidgetFactory widgetFactory) {
- return new VariableOneToOneMappingComposite(subjectHolder, parent, widgetFactory);
- }
-}
diff --git a/jpa/plugins/org.eclipse.jpt.eclipselink.ui/src/org/eclipse/jpt/eclipselink1_1/ui/internal/orm/details/EclipseLink1_1OrmVersionMappingComposite.java b/jpa/plugins/org.eclipse.jpt.eclipselink.ui/src/org/eclipse/jpt/eclipselink1_1/ui/internal/orm/details/EclipseLink1_1OrmVersionMappingComposite.java
deleted file mode 100644
index 3e9b83059c..0000000000
--- a/jpa/plugins/org.eclipse.jpt.eclipselink.ui/src/org/eclipse/jpt/eclipselink1_1/ui/internal/orm/details/EclipseLink1_1OrmVersionMappingComposite.java
+++ /dev/null
@@ -1,61 +0,0 @@
-/*******************************************************************************
- * Copyright (c) 2009 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.
- *
- * Contributors:
- * Oracle - initial API and implementation
- ******************************************************************************/
-package org.eclipse.jpt.eclipselink1_1.ui.internal.orm.details;
-
-import org.eclipse.jpt.core.context.AccessHolder;
-import org.eclipse.jpt.core.context.VersionMapping;
-import org.eclipse.jpt.eclipselink.ui.internal.mappings.details.EclipseLinkVersionMappingComposite;
-import org.eclipse.jpt.eclipselink.ui.internal.mappings.details.MutableComposite;
-import org.eclipse.jpt.ui.WidgetFactory;
-import org.eclipse.jpt.ui.internal.details.AccessTypeComposite;
-import org.eclipse.jpt.ui.internal.mappings.details.ColumnComposite;
-import org.eclipse.jpt.utility.internal.model.value.PropertyAspectAdapter;
-import org.eclipse.jpt.utility.model.value.PropertyValueModel;
-import org.eclipse.swt.widgets.Composite;
-
-public class EclipseLink1_1OrmVersionMappingComposite extends EclipseLinkVersionMappingComposite
-{
- /**
- * Creates a new <code>EclipseLinkOrmVersionMappingComposite</code>.
- *
- * @param subjectHolder The holder of the subject <code>VersionMapping</code>
- * @param parent The parent container
- * @param widgetFactory The factory used to create various common widgets
- */
- public EclipseLink1_1OrmVersionMappingComposite(PropertyValueModel<? extends VersionMapping> subjectHolder,
- Composite parent,
- WidgetFactory widgetFactory) {
-
- super(subjectHolder, parent, widgetFactory);
- }
-
- @Override
- protected void initializeGeneralPane(Composite container) {
- int groupBoxMargin = getGroupBoxMargin();
-
- // Column widgets
- new ColumnComposite(this, buildColumnHolder(), container);
-
- // Align the widgets under the ColumnComposite
- container = addSubPane(container, 0, groupBoxMargin, 0, groupBoxMargin);
-
- new AccessTypeComposite(this, buildAccessHolderHolder(), container);
- new MutableComposite(this, buildMutableHolder(), container);
- }
-
- protected PropertyValueModel<AccessHolder> buildAccessHolderHolder() {
- return new PropertyAspectAdapter<VersionMapping, AccessHolder>(getSubjectHolder()) {
- @Override
- protected AccessHolder buildValue_() {
- return this.subject.getPersistentAttribute();
- }
- };
- }
-} \ No newline at end of file
diff --git a/jpa/plugins/org.eclipse.jpt.eclipselink.ui/src/org/eclipse/jpt/eclipselink1_1/ui/internal/orm/details/EclipseLink1_1OrmVersionMappingUiProvider.java b/jpa/plugins/org.eclipse.jpt.eclipselink.ui/src/org/eclipse/jpt/eclipselink1_1/ui/internal/orm/details/EclipseLink1_1OrmVersionMappingUiProvider.java
deleted file mode 100644
index 4c2238a2e7..0000000000
--- a/jpa/plugins/org.eclipse.jpt.eclipselink.ui/src/org/eclipse/jpt/eclipselink1_1/ui/internal/orm/details/EclipseLink1_1OrmVersionMappingUiProvider.java
+++ /dev/null
@@ -1,56 +0,0 @@
-/*******************************************************************************
- * Copyright (c) 2009 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.
- *
- * Contributors:
- * Oracle - initial API and implementation
- ******************************************************************************/
-package org.eclipse.jpt.eclipselink1_1.ui.internal.orm.details;
-
-import org.eclipse.core.runtime.content.IContentType;
-import org.eclipse.jpt.eclipselink.core.internal.JptEclipseLinkCorePlugin;
-import org.eclipse.jpt.eclipselink.core.internal.context.orm.EclipseLinkOrmVersionMapping;
-import org.eclipse.jpt.ui.JpaUiFactory;
-import org.eclipse.jpt.ui.WidgetFactory;
-import org.eclipse.jpt.ui.details.AttributeMappingUiProvider;
-import org.eclipse.jpt.ui.details.JpaComposite;
-import org.eclipse.jpt.ui.internal.details.AbstractVersionMappingUiProvider;
-import org.eclipse.jpt.utility.model.value.PropertyValueModel;
-import org.eclipse.swt.widgets.Composite;
-
-public class EclipseLink1_1OrmVersionMappingUiProvider
- extends AbstractVersionMappingUiProvider<EclipseLinkOrmVersionMapping>
-{
- // singleton
- private static final EclipseLink1_1OrmVersionMappingUiProvider INSTANCE =
- new EclipseLink1_1OrmVersionMappingUiProvider();
-
- /**
- * Return the singleton.
- */
- public static AttributeMappingUiProvider<EclipseLinkOrmVersionMapping> instance() {
- return INSTANCE;
- }
-
-
- /**
- * Ensure single instance.
- */
- private EclipseLink1_1OrmVersionMappingUiProvider() {
- super();
- }
-
- public IContentType getContentType() {
- return JptEclipseLinkCorePlugin.ECLIPSELINK1_1_ORM_XML_CONTENT_TYPE;
- }
-
- public JpaComposite buildAttributeMappingComposite(
- JpaUiFactory factory,
- PropertyValueModel<EclipseLinkOrmVersionMapping> subjectHolder,
- Composite parent,
- WidgetFactory widgetFactory) {
- return new EclipseLink1_1OrmVersionMappingComposite(subjectHolder, parent, widgetFactory);
- }
-}
diff --git a/jpa/plugins/org.eclipse.jpt.eclipselink.ui/src/org/eclipse/jpt/eclipselink1_1/ui/internal/platform/EclipseLink1_1JpaPlatformUiFactory.java b/jpa/plugins/org.eclipse.jpt.eclipselink.ui/src/org/eclipse/jpt/eclipselink1_1/ui/internal/platform/EclipseLink1_1JpaPlatformUiFactory.java
deleted file mode 100644
index ae926175e2..0000000000
--- a/jpa/plugins/org.eclipse.jpt.eclipselink.ui/src/org/eclipse/jpt/eclipselink1_1/ui/internal/platform/EclipseLink1_1JpaPlatformUiFactory.java
+++ /dev/null
@@ -1,46 +0,0 @@
-/*******************************************************************************
- * Copyright (c) 2009 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.
- *
- * Contributors:
- * Oracle - initial API and implementation
- ******************************************************************************/
-package org.eclipse.jpt.eclipselink1_1.ui.internal.platform;
-
-import org.eclipse.jpt.eclipselink.ui.internal.EclipseLinkJpaUiFactory;
-import org.eclipse.jpt.eclipselink.ui.internal.platform.EclipseLinkJpaPlatformUi;
-import org.eclipse.jpt.eclipselink.ui.internal.platform.EclipseLinkJpaPlatformUiProvider;
-import org.eclipse.jpt.eclipselink.ui.internal.platform.EclipseLinkNavigatorProvider;
-import org.eclipse.jpt.eclipselink.ui.internal.structure.EclipseLinkPersistenceResourceModelStructureProvider;
-import org.eclipse.jpt.ui.JpaPlatformUi;
-import org.eclipse.jpt.ui.JpaPlatformUiFactory;
-import org.eclipse.jpt.ui.internal.GenericJpaPlatformUiProvider;
-import org.eclipse.jpt.ui.internal.structure.JavaResourceModelStructureProvider;
-
-public class EclipseLink1_1JpaPlatformUiFactory implements JpaPlatformUiFactory
-{
-
- /**
- * Zero arg constructor for extension point
- */
- public EclipseLink1_1JpaPlatformUiFactory() {
- super();
- }
-
- public JpaPlatformUi buildJpaPlatformUi() {
- return new EclipseLinkJpaPlatformUi(
- new EclipseLinkJpaUiFactory(), //new EclipseLink1_1JpaUiFactory() is not being used because
- //we don't want the java Access annotation work to be exposed yet
- //EclipseLink has backed out its JPA 2.0 annotation support until
- //it is released or licensing issues are cleared up
- new EclipseLinkNavigatorProvider(),
- JavaResourceModelStructureProvider.instance(),
- EclipseLinkPersistenceResourceModelStructureProvider.instance(),
- GenericJpaPlatformUiProvider.instance(),
- EclipseLinkJpaPlatformUiProvider.instance(),
- EclipseLink1_1JpaPlatformUiProvider.instance()
- );
- }
-}
diff --git a/jpa/plugins/org.eclipse.jpt.eclipselink.ui/src/org/eclipse/jpt/eclipselink1_1/ui/internal/platform/EclipseLink1_1JpaPlatformUiProvider.java b/jpa/plugins/org.eclipse.jpt.eclipselink.ui/src/org/eclipse/jpt/eclipselink1_1/ui/internal/platform/EclipseLink1_1JpaPlatformUiProvider.java
deleted file mode 100644
index 353c3bbf99..0000000000
--- a/jpa/plugins/org.eclipse.jpt.eclipselink.ui/src/org/eclipse/jpt/eclipselink1_1/ui/internal/platform/EclipseLink1_1JpaPlatformUiProvider.java
+++ /dev/null
@@ -1,116 +0,0 @@
-/*******************************************************************************
- * Copyright (c) 2007, 2009 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.
- *
- * Contributors:
- * Oracle - initial API and implementation
- ******************************************************************************/
-package org.eclipse.jpt.eclipselink1_1.ui.internal.platform;
-
-import java.util.List;
-import org.eclipse.jpt.core.context.AttributeMapping;
-import org.eclipse.jpt.eclipselink1_1.ui.internal.orm.details.EclipseLink1_1OrmBasicCollectionMappingUiProvider;
-import org.eclipse.jpt.eclipselink1_1.ui.internal.orm.details.EclipseLink1_1OrmBasicMapMappingUiProvider;
-import org.eclipse.jpt.eclipselink1_1.ui.internal.orm.details.EclipseLink1_1OrmBasicMappingUiProvider;
-import org.eclipse.jpt.eclipselink1_1.ui.internal.orm.details.EclipseLink1_1OrmEmbeddableUiProvider;
-import org.eclipse.jpt.eclipselink1_1.ui.internal.orm.details.EclipseLink1_1OrmEmbeddedIdMappingUiProvider;
-import org.eclipse.jpt.eclipselink1_1.ui.internal.orm.details.EclipseLink1_1OrmEmbeddedMappingUiProvider;
-import org.eclipse.jpt.eclipselink1_1.ui.internal.orm.details.EclipseLink1_1OrmEntityUiProvider;
-import org.eclipse.jpt.eclipselink1_1.ui.internal.orm.details.EclipseLink1_1OrmIdMappingUiProvider;
-import org.eclipse.jpt.eclipselink1_1.ui.internal.orm.details.EclipseLink1_1OrmManyToManyMappingUiProvider;
-import org.eclipse.jpt.eclipselink1_1.ui.internal.orm.details.EclipseLink1_1OrmManyToOneMappingUiProvider;
-import org.eclipse.jpt.eclipselink1_1.ui.internal.orm.details.EclipseLink1_1OrmMappedSuperclassUiProvider;
-import org.eclipse.jpt.eclipselink1_1.ui.internal.orm.details.EclipseLink1_1OrmOneToManyMappingUiProvider;
-import org.eclipse.jpt.eclipselink1_1.ui.internal.orm.details.EclipseLink1_1OrmOneToOneMappingUiProvider;
-import org.eclipse.jpt.eclipselink1_1.ui.internal.orm.details.EclipseLink1_1OrmTransformationMappingUiProvider;
-import org.eclipse.jpt.eclipselink1_1.ui.internal.orm.details.EclipseLink1_1OrmTransientMappingUiProvider;
-import org.eclipse.jpt.eclipselink1_1.ui.internal.orm.details.EclipseLink1_1OrmVariableOneToOneMappingUiProvider;
-import org.eclipse.jpt.eclipselink1_1.ui.internal.orm.details.EclipseLink1_1OrmVersionMappingUiProvider;
-import org.eclipse.jpt.eclipselink1_1.ui.internal.structure.EclipseLink1_1OrmResourceModelStructureProvider;
-import org.eclipse.jpt.ui.JpaPlatformUiProvider;
-import org.eclipse.jpt.ui.details.AttributeMappingUiProvider;
-import org.eclipse.jpt.ui.details.DefaultAttributeMappingUiProvider;
-import org.eclipse.jpt.ui.details.DefaultTypeMappingUiProvider;
-import org.eclipse.jpt.ui.details.JpaDetailsProvider;
-import org.eclipse.jpt.ui.details.TypeMappingUiProvider;
-import org.eclipse.jpt.ui.internal.AbstractJpaPlatformUiProvider;
-import org.eclipse.jpt.ui.structure.JpaStructureProvider;
-
-public class EclipseLink1_1JpaPlatformUiProvider extends AbstractJpaPlatformUiProvider
-{
-
- // singleton
- private static final JpaPlatformUiProvider INSTANCE = new EclipseLink1_1JpaPlatformUiProvider();
-
- /**
- * Return the singleton.
- */
- public static JpaPlatformUiProvider instance() {
- return INSTANCE;
- }
-
- /**
- * Ensure single instance.
- */
- private EclipseLink1_1JpaPlatformUiProvider() {
- super();
- }
-
-
- // ********** details providers **********
-
- @Override
- protected void addDetailsProvidersTo(List<JpaDetailsProvider> providers) {
- //none specific to EclipseLink 1.1
- }
-
- // ********** structure providers **********
-
- @Override
- protected void addMappingFileStructureProvidersTo(List<JpaStructureProvider> providers) {
- providers.add(EclipseLink1_1OrmResourceModelStructureProvider.instance());
- }
-
-
- // ********** type mapping ui providers **********
-
- @Override
- protected void addTypeMappingUiProvidersTo(List<TypeMappingUiProvider<?>> providers) {
- providers.add(EclipseLink1_1OrmEntityUiProvider.instance());
- providers.add(EclipseLink1_1OrmMappedSuperclassUiProvider.instance());
- providers.add(EclipseLink1_1OrmEmbeddableUiProvider.instance());
- }
-
- @Override
- protected void addDefaultTypeMappingUiProvidersTo(List<DefaultTypeMappingUiProvider<?>> providers) {
- //none specific to EclipseLink 1.1
- }
-
-
- // ********** attribute mapping ui providers **********
-
- @Override
- protected void addAttributeMappingUiProvidersTo(List<AttributeMappingUiProvider<? extends AttributeMapping>> providers) {
- providers.add(EclipseLink1_1OrmIdMappingUiProvider.instance());
- providers.add(EclipseLink1_1OrmEmbeddedIdMappingUiProvider.instance());
- providers.add(EclipseLink1_1OrmBasicMappingUiProvider.instance());
- providers.add(EclipseLink1_1OrmBasicCollectionMappingUiProvider.instance());
- providers.add(EclipseLink1_1OrmBasicMapMappingUiProvider.instance());
- providers.add(EclipseLink1_1OrmVersionMappingUiProvider.instance());
- providers.add(EclipseLink1_1OrmManyToOneMappingUiProvider.instance());
- providers.add(EclipseLink1_1OrmOneToManyMappingUiProvider.instance());
- providers.add(EclipseLink1_1OrmEmbeddedMappingUiProvider.instance());
- providers.add(EclipseLink1_1OrmOneToOneMappingUiProvider.instance());
- providers.add(EclipseLink1_1OrmVariableOneToOneMappingUiProvider.instance());
- providers.add(EclipseLink1_1OrmManyToManyMappingUiProvider.instance());
- providers.add(EclipseLink1_1OrmTransformationMappingUiProvider.instance());
- providers.add(EclipseLink1_1OrmTransientMappingUiProvider.instance());
- }
-
- @Override
- protected void addDefaultAttributeMappingUiProvidersTo(List<DefaultAttributeMappingUiProvider<? extends AttributeMapping>> providers) {
- //none specific to EclipseLink 1.1
- }
-}
diff --git a/jpa/plugins/org.eclipse.jpt.eclipselink.ui/src/org/eclipse/jpt/eclipselink1_1/ui/internal/structure/EclipseLink1_1OrmResourceModelStructureProvider.java b/jpa/plugins/org.eclipse.jpt.eclipselink.ui/src/org/eclipse/jpt/eclipselink1_1/ui/internal/structure/EclipseLink1_1OrmResourceModelStructureProvider.java
deleted file mode 100644
index 1bfdfa72ad..0000000000
--- a/jpa/plugins/org.eclipse.jpt.eclipselink.ui/src/org/eclipse/jpt/eclipselink1_1/ui/internal/structure/EclipseLink1_1OrmResourceModelStructureProvider.java
+++ /dev/null
@@ -1,52 +0,0 @@
-/*******************************************************************************
- * Copyright (c) 2009 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.
- *
- * Contributors:
- * Oracle - initial API and implementation
- ******************************************************************************/
-package org.eclipse.jpt.eclipselink1_1.ui.internal.structure;
-
-import org.eclipse.core.runtime.content.IContentType;
-import org.eclipse.jpt.eclipselink.core.internal.JptEclipseLinkCorePlugin;
-import org.eclipse.jpt.ui.internal.structure.OrmItemContentProviderFactory;
-import org.eclipse.jpt.ui.internal.structure.OrmItemLabelProviderFactory;
-import org.eclipse.jpt.ui.jface.ItemLabelProviderFactory;
-import org.eclipse.jpt.ui.jface.TreeItemContentProviderFactory;
-import org.eclipse.jpt.ui.structure.JpaStructureProvider;
-
-public class EclipseLink1_1OrmResourceModelStructureProvider
- implements JpaStructureProvider
-{
- // singleton
- private static final JpaStructureProvider INSTANCE = new EclipseLink1_1OrmResourceModelStructureProvider();
-
- /**
- * Return the singleton.
- */
- public static JpaStructureProvider instance() {
- return INSTANCE;
- }
-
- /**
- * Ensure single instance.
- */
- private EclipseLink1_1OrmResourceModelStructureProvider() {
- super();
- }
-
- public IContentType getContentType() {
- return JptEclipseLinkCorePlugin.ECLIPSELINK1_1_ORM_XML_CONTENT_TYPE;
- }
-
- public TreeItemContentProviderFactory getTreeItemContentProviderFactory() {
- return new OrmItemContentProviderFactory();
- }
-
- public ItemLabelProviderFactory getItemLabelProviderFactory() {
- return new OrmItemLabelProviderFactory();
- }
-
-}
diff --git a/jpa/plugins/org.eclipse.jpt.eclipselink.ui/src/org/eclipse/jpt/eclipselink1_1/ui/internal/wizards/EclipseLink1_1MappingFileWizard.java b/jpa/plugins/org.eclipse.jpt.eclipselink.ui/src/org/eclipse/jpt/eclipselink1_1/ui/internal/wizards/EclipseLink1_1MappingFileWizard.java
deleted file mode 100644
index 56f119eb9b..0000000000
--- a/jpa/plugins/org.eclipse.jpt.eclipselink.ui/src/org/eclipse/jpt/eclipselink1_1/ui/internal/wizards/EclipseLink1_1MappingFileWizard.java
+++ /dev/null
@@ -1,47 +0,0 @@
-/*******************************************************************************
- * Copyright (c) 2009 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
- *
- * Contributors:
- * Oracle - initial API and implementation
- *******************************************************************************/
-package org.eclipse.jpt.eclipselink1_1.ui.internal.wizards;
-
-import org.eclipse.jpt.eclipselink.ui.internal.EclipseLinkUiMessages;
-import org.eclipse.jpt.eclipselink.ui.internal.wizards.EclipseLinkMappingFileWizardPage;
-import org.eclipse.jpt.eclipselink1_1.core.internal.operations.EclipseLink1_1OrmFileCreationDataModelProvider;
-import org.eclipse.jpt.ui.internal.wizards.orm.MappingFileWizard;
-import org.eclipse.jpt.ui.internal.wizards.orm.MappingFileWizardPage;
-import org.eclipse.ui.INewWizard;
-import org.eclipse.wst.common.frameworks.datamodel.IDataModel;
-import org.eclipse.wst.common.frameworks.datamodel.IDataModelProvider;
-
-/**
- * This is referenced in the plugin.xml as an org.eclipse.ui.newWizards extension
- */
-public class EclipseLink1_1MappingFileWizard extends MappingFileWizard
- implements INewWizard
-{
- public EclipseLink1_1MappingFileWizard() {
- this(null);
- }
-
- public EclipseLink1_1MappingFileWizard(IDataModel dataModel) {
- super(dataModel);
- setWindowTitle(EclipseLinkUiMessages.EclipseLink1_1MappingFileWizard_title);
- }
-
-
- @Override
- protected MappingFileWizardPage buildMappingFileWizardPage() {
- return new EclipseLinkMappingFileWizardPage(getDataModel(), "Page_1", EclipseLinkUiMessages.EclipseLink1_1MappingFileWizardPage_title, EclipseLinkUiMessages.EclipseLink1_1MappingFileWizardPage_desc);
- }
-
- @Override
- protected IDataModelProvider getDefaultProvider() {
- return new EclipseLink1_1OrmFileCreationDataModelProvider();
- }
-}
diff --git a/jpa/tests/org.eclipse.jpt.core.tests.extension.resource/.classpath b/jpa/tests/org.eclipse.jpt.core.tests.extension.resource/.classpath
deleted file mode 100644
index d0ea6899cf..0000000000
--- a/jpa/tests/org.eclipse.jpt.core.tests.extension.resource/.classpath
+++ /dev/null
@@ -1,12 +0,0 @@
-<?xml version="1.0" encoding="UTF-8"?>
-<classpath>
- <classpathentry kind="src" path="src"/>
- <classpathentry kind="con" path="org.eclipse.jdt.launching.JRE_CONTAINER/org.eclipse.jdt.internal.debug.ui.launcher.StandardVMType/J2SE-1.5"/>
- <classpathentry kind="con" path="org.eclipse.pde.core.requiredPlugins">
- <accessrules>
- <accessrule kind="accessible" pattern="org/eclipse/jpt/core/**"/>
- <accessrule kind="accessible" pattern="org/eclipse/jpt/ui/**"/>
- </accessrules>
- </classpathentry>
- <classpathentry kind="output" path="bin"/>
-</classpath>
diff --git a/jpa/tests/org.eclipse.jpt.core.tests.extension.resource/.cvsignore b/jpa/tests/org.eclipse.jpt.core.tests.extension.resource/.cvsignore
deleted file mode 100644
index a196dd7686..0000000000
--- a/jpa/tests/org.eclipse.jpt.core.tests.extension.resource/.cvsignore
+++ /dev/null
@@ -1,6 +0,0 @@
-bin
-@dot
-temp.folder
-build.xml
-javaCompiler...args
-javaCompiler...args.* \ No newline at end of file
diff --git a/jpa/tests/org.eclipse.jpt.core.tests.extension.resource/.project b/jpa/tests/org.eclipse.jpt.core.tests.extension.resource/.project
deleted file mode 100644
index bb6561e95f..0000000000
--- a/jpa/tests/org.eclipse.jpt.core.tests.extension.resource/.project
+++ /dev/null
@@ -1,28 +0,0 @@
-<?xml version="1.0" encoding="UTF-8"?>
-<projectDescription>
- <name>org.eclipse.jpt.core.tests.extension.resource</name>
- <comment></comment>
- <projects>
- </projects>
- <buildSpec>
- <buildCommand>
- <name>org.eclipse.jdt.core.javabuilder</name>
- <arguments>
- </arguments>
- </buildCommand>
- <buildCommand>
- <name>org.eclipse.pde.ManifestBuilder</name>
- <arguments>
- </arguments>
- </buildCommand>
- <buildCommand>
- <name>org.eclipse.pde.SchemaBuilder</name>
- <arguments>
- </arguments>
- </buildCommand>
- </buildSpec>
- <natures>
- <nature>org.eclipse.pde.PluginNature</nature>
- <nature>org.eclipse.jdt.core.javanature</nature>
- </natures>
-</projectDescription>
diff --git a/jpa/tests/org.eclipse.jpt.core.tests.extension.resource/.settings/org.eclipse.core.resources.prefs b/jpa/tests/org.eclipse.jpt.core.tests.extension.resource/.settings/org.eclipse.core.resources.prefs
deleted file mode 100644
index 55044aaf02..0000000000
--- a/jpa/tests/org.eclipse.jpt.core.tests.extension.resource/.settings/org.eclipse.core.resources.prefs
+++ /dev/null
@@ -1,3 +0,0 @@
-#Mon Apr 07 14:26:32 EDT 2008
-eclipse.preferences.version=1
-encoding/<project>=ISO-8859-1
diff --git a/jpa/tests/org.eclipse.jpt.core.tests.extension.resource/META-INF/MANIFEST.MF b/jpa/tests/org.eclipse.jpt.core.tests.extension.resource/META-INF/MANIFEST.MF
deleted file mode 100644
index 0fc489b04d..0000000000
--- a/jpa/tests/org.eclipse.jpt.core.tests.extension.resource/META-INF/MANIFEST.MF
+++ /dev/null
@@ -1,22 +0,0 @@
-Manifest-Version: 1.0
-Bundle-ManifestVersion: 2
-Bundle-Name: %pluginName
-Bundle-Vendor: %providerName
-Bundle-SymbolicName: org.eclipse.jpt.core.tests.extension.resource;singleton:=true
-Bundle-Version: 2.2.0.qualifier
-Bundle-Activator: org.eclipse.jpt.core.tests.extension.resource.ExtensionTestPlugin
-Bundle-ActivationPolicy: lazy
-Bundle-Localization: plugin
-Require-Bundle: org.eclipse.core.resources,
- org.eclipse.core.runtime,
- org.eclipse.jdt.core,
- org.eclipse.jpt.core,
- org.eclipse.jpt.ui,
- org.eclipse.jpt.core,
- org.eclipse.jpt.gen,
- org.eclipse.jpt.db,
- org.eclipse.jpt.utility,
- org.eclipse.swt,
- org.eclipse.wst.validation
-Bundle-RequiredExecutionEnvironment: J2SE-1.5
-Export-Package: org.eclipse.jpt.core.tests.extension.resource;x-friends:="org.eclipse.jpt.ui.tests,org.eclipse.jpt.core.tests"
diff --git a/jpa/tests/org.eclipse.jpt.core.tests.extension.resource/about.html b/jpa/tests/org.eclipse.jpt.core.tests.extension.resource/about.html
deleted file mode 100644
index be534ba44f..0000000000
--- a/jpa/tests/org.eclipse.jpt.core.tests.extension.resource/about.html
+++ /dev/null
@@ -1,34 +0,0 @@
-<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.0//EN">
-<HTML>
-
-<head>
-<title>About</title>
-<meta http-equiv=Content-Type content="text/html; charset=ISO-8859-1">
-</head>
-
-<BODY lang="EN-US">
-
-<H3>About This Content</H3>
-
-<P>May 02, 2008</P>
-
-<H3>License</H3>
-
-<P>The Eclipse Foundation makes available all content in this plug-in
-("Content"). Unless otherwise indicated below, the Content is provided to you
-under the terms and conditions of the Eclipse Public License Version 1.0
-("EPL"). A copy of the EPL is available at
-<A href="http://www.eclipse.org/org/documents/epl-v10.php">http://www.eclipse.org/org/documents/epl-v10.php</A>.
-For purposes of the EPL, "Program" will mean the Content.</P>
-
-<P>If you did not receive this Content directly from the Eclipse Foundation, the
-Content is being redistributed by another party ("Redistributor") and different
-terms and conditions may apply to your use of any object code in the Content.
-Check the Redistributor's license that was provided with the Content. If no such
-license exists, contact the Redistributor. Unless otherwise indicated below, the
-terms and conditions of the EPL still apply to any source code in the Content
-and such source code may be obtained at
-<A href="http://www.eclipse.org/">http://www.eclipse.org/</A>.</P>
-
-</BODY>
-</HTML>
diff --git a/jpa/tests/org.eclipse.jpt.core.tests.extension.resource/build.properties b/jpa/tests/org.eclipse.jpt.core.tests.extension.resource/build.properties
deleted file mode 100644
index f5e3f40ad8..0000000000
--- a/jpa/tests/org.eclipse.jpt.core.tests.extension.resource/build.properties
+++ /dev/null
@@ -1,19 +0,0 @@
-###############################################################################
-# Copyright (c) 2007 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
-#
-# Contributors:
-# Oracle. - initial API and implementation
-###############################################################################
-javacSource=1.5
-javacTarget=1.5
-source.. = src/
-output.. = bin/
-bin.includes = .,\
- META-INF/,\
- plugin.xml,\
- plugin.properties
-jars.compile.order = .
diff --git a/jpa/tests/org.eclipse.jpt.core.tests.extension.resource/plugin.properties b/jpa/tests/org.eclipse.jpt.core.tests.extension.resource/plugin.properties
deleted file mode 100644
index 0f7956c9f5..0000000000
--- a/jpa/tests/org.eclipse.jpt.core.tests.extension.resource/plugin.properties
+++ /dev/null
@@ -1,24 +0,0 @@
-###############################################################################
-# Copyright (c) 2007 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
-#
-# Contributors:
-# Oracle. - initial API and implementation
-###############################################################################
-# ====================================================================
-# To code developer:
-# Do NOT change the properties between this line and the
-# "%%% END OF TRANSLATED PROPERTIES %%%" line.
-# Make a new property name, append to the end of the file and change
-# the code to use the new property.
-# ====================================================================
-
-# ====================================================================
-# %%% END OF TRANSLATED PROPERTIES %%%
-# ====================================================================
-
-pluginName = Dali Java Persistence Tools - Extension Tests
-providerName = Eclipse Web Tools Platform
diff --git a/jpa/tests/org.eclipse.jpt.core.tests.extension.resource/plugin.xml b/jpa/tests/org.eclipse.jpt.core.tests.extension.resource/plugin.xml
deleted file mode 100644
index 7c9881ed8e..0000000000
--- a/jpa/tests/org.eclipse.jpt.core.tests.extension.resource/plugin.xml
+++ /dev/null
@@ -1,27 +0,0 @@
-<?xml version="1.0" encoding="UTF-8"?>
-<?eclipse version="3.2"?>
-<plugin>
-
- <extension
- point="org.eclipse.jpt.core.jpaPlatforms">
-
- <jpaPlatform
- id="core.testJpaPlatform"
- label="Test Jpa Platform"
- factoryClass="org.eclipse.jpt.core.tests.extension.resource.TestJpaPlatformFactory"
- default="true">
- </jpaPlatform>
-
- </extension>
-
- <extension
- point="org.eclipse.jpt.ui.jpaPlatformUis">
-
- <jpaPlatformUi
- id="core.testJpaPlatform.ui"
- jpaPlatform="core.testJpaPlatform"
- factoryClass="org.eclipse.jpt.core.tests.extension.resource.TestJpaPlatformUiFactory"/>
-
- </extension>
-
-</plugin>
diff --git a/jpa/tests/org.eclipse.jpt.core.tests.extension.resource/src/org/eclipse/jpt/core/tests/extension/resource/ExtensionTestPlugin.java b/jpa/tests/org.eclipse.jpt.core.tests.extension.resource/src/org/eclipse/jpt/core/tests/extension/resource/ExtensionTestPlugin.java
deleted file mode 100644
index 47ff993fb2..0000000000
--- a/jpa/tests/org.eclipse.jpt.core.tests.extension.resource/src/org/eclipse/jpt/core/tests/extension/resource/ExtensionTestPlugin.java
+++ /dev/null
@@ -1,55 +0,0 @@
-/*******************************************************************************
- * Copyright (c) 2008, 2009 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
- *
- * Contributors:
- * Oracle - initial API and implementation
- *******************************************************************************/
-package org.eclipse.jpt.core.tests.extension.resource;
-
-import org.eclipse.core.runtime.Plugin;
-import org.osgi.framework.BundleContext;
-
-/**
- * The activator class controls the plug-in life cycle
- */
-public class ExtensionTestPlugin extends Plugin {
-
- // The plug-in ID
- public static final String PLUGIN_ID = "org.eclipse.jpt.core.tests.extension.resource"; //$NON-NLS-1$
-
- // The shared instance
- private static ExtensionTestPlugin plugin;
-
- /**
- * The constructor
- */
- public ExtensionTestPlugin() {
- super();
- }
-
- @Override
- public void start(BundleContext context) throws Exception {
- super.start(context);
- plugin = this;
- }
-
- @Override
- public void stop(BundleContext context) throws Exception {
- plugin = null;
- super.stop(context);
- }
-
- /**
- * Returns the shared instance
- *
- * @return the shared instance
- */
- public static ExtensionTestPlugin getDefault() {
- return plugin;
- }
-
-}
diff --git a/jpa/tests/org.eclipse.jpt.core.tests.extension.resource/src/org/eclipse/jpt/core/tests/extension/resource/JavaTestAttributeMapping.java b/jpa/tests/org.eclipse.jpt.core.tests.extension.resource/src/org/eclipse/jpt/core/tests/extension/resource/JavaTestAttributeMapping.java
deleted file mode 100644
index 0093e31b33..0000000000
--- a/jpa/tests/org.eclipse.jpt.core.tests.extension.resource/src/org/eclipse/jpt/core/tests/extension/resource/JavaTestAttributeMapping.java
+++ /dev/null
@@ -1,39 +0,0 @@
-/*******************************************************************************
- * Copyright (c) 2008, 2009 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.
- *
- * Contributors:
- * Oracle - initial API and implementation
- ******************************************************************************/
-package org.eclipse.jpt.core.tests.extension.resource;
-
-import java.util.Iterator;
-import org.eclipse.jpt.core.context.java.JavaPersistentAttribute;
-import org.eclipse.jpt.core.internal.context.java.AbstractJavaAttributeMapping;
-import org.eclipse.jpt.core.resource.java.Annotation;
-import org.eclipse.jpt.utility.internal.iterators.EmptyListIterator;
-
-public class JavaTestAttributeMapping extends AbstractJavaAttributeMapping<Annotation>
-{
- public static final String TEST_ATTRIBUTE_MAPPING_KEY = "testAttribute"; //$NON-NLS-1$
- public static final String TEST_ATTRIBUTE_ANNOTATION_NAME = "test.TestAttribute"; //$NON-NLS-1$
-
-
- public JavaTestAttributeMapping(JavaPersistentAttribute parent) {
- super(parent);
- }
-
- public String getKey() {
- return JavaTestAttributeMapping.TEST_ATTRIBUTE_MAPPING_KEY;
- }
-
- public String getAnnotationName() {
- return JavaTestAttributeMapping.TEST_ATTRIBUTE_ANNOTATION_NAME;
- }
-
- public Iterator<String> supportingAnnotationNames() {
- return EmptyListIterator.instance();
- }
-}
diff --git a/jpa/tests/org.eclipse.jpt.core.tests.extension.resource/src/org/eclipse/jpt/core/tests/extension/resource/JavaTestAttributeMappingProvider.java b/jpa/tests/org.eclipse.jpt.core.tests.extension.resource/src/org/eclipse/jpt/core/tests/extension/resource/JavaTestAttributeMappingProvider.java
deleted file mode 100644
index 5eed911d38..0000000000
--- a/jpa/tests/org.eclipse.jpt.core.tests.extension.resource/src/org/eclipse/jpt/core/tests/extension/resource/JavaTestAttributeMappingProvider.java
+++ /dev/null
@@ -1,48 +0,0 @@
-/*******************************************************************************
- * Copyright (c) 2008 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.
- *
- * Contributors:
- * Oracle - initial API and implementation
- ******************************************************************************/
-package org.eclipse.jpt.core.tests.extension.resource;
-
-import org.eclipse.jpt.core.JpaFactory;
-import org.eclipse.jpt.core.context.java.JavaAttributeMappingProvider;
-import org.eclipse.jpt.core.context.java.JavaPersistentAttribute;
-
-public class JavaTestAttributeMappingProvider
- implements JavaAttributeMappingProvider
-{
- // singleton
- private static final JavaTestAttributeMappingProvider INSTANCE = new JavaTestAttributeMappingProvider();
-
- /**
- * Return the singleton.
- */
- public static JavaAttributeMappingProvider instance() {
- return INSTANCE;
- }
-
- /**
- * Ensure single instance.
- */
- private JavaTestAttributeMappingProvider() {
- super();
- }
-
- public String getKey() {
- return JavaTestAttributeMapping.TEST_ATTRIBUTE_MAPPING_KEY;
- }
-
- public String getAnnotationName() {
- return JavaTestAttributeMapping.TEST_ATTRIBUTE_ANNOTATION_NAME;
- }
-
- public JavaTestAttributeMapping buildMapping(JavaPersistentAttribute parent, JpaFactory factory) {
- return ((TestJpaFactory) factory).buildJavaTestAttributeMapping(parent);
- }
-
-}
diff --git a/jpa/tests/org.eclipse.jpt.core.tests.extension.resource/src/org/eclipse/jpt/core/tests/extension/resource/JavaTestTypeMapping.java b/jpa/tests/org.eclipse.jpt.core.tests.extension.resource/src/org/eclipse/jpt/core/tests/extension/resource/JavaTestTypeMapping.java
deleted file mode 100644
index d0f2d4e858..0000000000
--- a/jpa/tests/org.eclipse.jpt.core.tests.extension.resource/src/org/eclipse/jpt/core/tests/extension/resource/JavaTestTypeMapping.java
+++ /dev/null
@@ -1,50 +0,0 @@
-/*******************************************************************************
- * Copyright (c) 2008, 2009 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.
- *
- * Contributors:
- * Oracle - initial API and implementation
- ******************************************************************************/
-package org.eclipse.jpt.core.tests.extension.resource;
-
-import java.util.Iterator;
-import org.eclipse.jpt.core.context.java.JavaPersistentType;
-import org.eclipse.jpt.core.internal.context.java.AbstractJavaTypeMapping;
-import org.eclipse.jpt.utility.internal.iterators.EmptyIterator;
-
-public class JavaTestTypeMapping extends AbstractJavaTypeMapping
-{
- public static final String TEST_TYPE_MAPPING_KEY = "test"; //$NON-NLS-1$
- public static final String TEST_TYPE_ANNOTATION_NAME = "test.Test"; //$NON-NLS-1$
-
-
- public JavaTestTypeMapping(JavaPersistentType parent) {
- super(parent);
- }
-
- public String getAnnotationName() {
- return TEST_TYPE_ANNOTATION_NAME;
- }
-
- public String getKey() {
- return TEST_TYPE_MAPPING_KEY;
- }
-
- public Iterator<String> correspondingAnnotationNames() {
- return EmptyIterator.instance();
- }
-
- public boolean isMapped() {
- return true;
- }
-
- public boolean tableNameIsInvalid(String tableName) {
- return false;
- }
-
- public boolean shouldValidateDbInfo() {
- return false;
- }
-}
diff --git a/jpa/tests/org.eclipse.jpt.core.tests.extension.resource/src/org/eclipse/jpt/core/tests/extension/resource/JavaTestTypeMappingProvider.java b/jpa/tests/org.eclipse.jpt.core.tests.extension.resource/src/org/eclipse/jpt/core/tests/extension/resource/JavaTestTypeMappingProvider.java
deleted file mode 100644
index 4eb6560a3d..0000000000
--- a/jpa/tests/org.eclipse.jpt.core.tests.extension.resource/src/org/eclipse/jpt/core/tests/extension/resource/JavaTestTypeMappingProvider.java
+++ /dev/null
@@ -1,51 +0,0 @@
-/*******************************************************************************
- * Copyright (c) 2008 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.
- *
- * Contributors:
- * Oracle - initial API and implementation
- ******************************************************************************/
-package org.eclipse.jpt.core.tests.extension.resource;
-
-import org.eclipse.jpt.core.JpaFactory;
-import org.eclipse.jpt.core.context.java.JavaPersistentType;
-import org.eclipse.jpt.core.context.java.JavaTypeMappingProvider;
-
-/**
- *
- */
-public class JavaTestTypeMappingProvider
- implements JavaTypeMappingProvider
-{
- // singleton
- private static final JavaTestTypeMappingProvider INSTANCE = new JavaTestTypeMappingProvider();
-
- /**
- * Return the singleton.
- */
- public static JavaTypeMappingProvider instance() {
- return INSTANCE;
- }
-
- /**
- * Ensure single instance.
- */
- private JavaTestTypeMappingProvider() {
- super();
- }
-
- public String getKey() {
- return JavaTestTypeMapping.TEST_TYPE_MAPPING_KEY;
- }
-
- public String getAnnotationName() {
- return JavaTestTypeMapping.TEST_TYPE_ANNOTATION_NAME;
- }
-
- public JavaTestTypeMapping buildMapping(JavaPersistentType parent, JpaFactory factory) {
- return ((TestJpaFactory) factory).buildJavaTestTypeMapping(parent);
- }
-
-}
diff --git a/jpa/tests/org.eclipse.jpt.core.tests.extension.resource/src/org/eclipse/jpt/core/tests/extension/resource/TestJavaBasicMapping.java b/jpa/tests/org.eclipse.jpt.core.tests.extension.resource/src/org/eclipse/jpt/core/tests/extension/resource/TestJavaBasicMapping.java
deleted file mode 100644
index ccd2f6ae1d..0000000000
--- a/jpa/tests/org.eclipse.jpt.core.tests.extension.resource/src/org/eclipse/jpt/core/tests/extension/resource/TestJavaBasicMapping.java
+++ /dev/null
@@ -1,20 +0,0 @@
-/*******************************************************************************
- * Copyright (c) 2008 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.
- *
- * Contributors:
- * Oracle - initial API and implementation
- ******************************************************************************/
-package org.eclipse.jpt.core.tests.extension.resource;
-
-import org.eclipse.jpt.core.context.java.JavaPersistentAttribute;
-import org.eclipse.jpt.core.internal.context.java.GenericJavaBasicMapping;
-
-public class TestJavaBasicMapping extends GenericJavaBasicMapping
-{
- public TestJavaBasicMapping(JavaPersistentAttribute parent) {
- super(parent);
- }
-}
diff --git a/jpa/tests/org.eclipse.jpt.core.tests.extension.resource/src/org/eclipse/jpt/core/tests/extension/resource/TestJavaEntity.java b/jpa/tests/org.eclipse.jpt.core.tests.extension.resource/src/org/eclipse/jpt/core/tests/extension/resource/TestJavaEntity.java
deleted file mode 100644
index 55e8265c3f..0000000000
--- a/jpa/tests/org.eclipse.jpt.core.tests.extension.resource/src/org/eclipse/jpt/core/tests/extension/resource/TestJavaEntity.java
+++ /dev/null
@@ -1,20 +0,0 @@
-/*******************************************************************************
- * Copyright (c) 2008, 2009 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.
- *
- * Contributors:
- * Oracle - initial API and implementation
- ******************************************************************************/
-package org.eclipse.jpt.core.tests.extension.resource;
-
-import org.eclipse.jpt.core.context.java.JavaPersistentType;
-import org.eclipse.jpt.core.internal.context.java.AbstractJavaEntity;
-
-public class TestJavaEntity extends AbstractJavaEntity
-{
- protected TestJavaEntity(JavaPersistentType parent) {
- super(parent);
- }
-}
diff --git a/jpa/tests/org.eclipse.jpt.core.tests.extension.resource/src/org/eclipse/jpt/core/tests/extension/resource/TestJpaFactory.java b/jpa/tests/org.eclipse.jpt.core.tests.extension.resource/src/org/eclipse/jpt/core/tests/extension/resource/TestJpaFactory.java
deleted file mode 100644
index 203e751149..0000000000
--- a/jpa/tests/org.eclipse.jpt.core.tests.extension.resource/src/org/eclipse/jpt/core/tests/extension/resource/TestJpaFactory.java
+++ /dev/null
@@ -1,37 +0,0 @@
-/*******************************************************************************
- * Copyright (c) 2007, 2008 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.
- *
- * Contributors:
- * Oracle - initial API and implementation
- ******************************************************************************/
-package org.eclipse.jpt.core.tests.extension.resource;
-
-import org.eclipse.jpt.core.context.java.JavaBasicMapping;
-import org.eclipse.jpt.core.context.java.JavaEntity;
-import org.eclipse.jpt.core.context.java.JavaPersistentAttribute;
-import org.eclipse.jpt.core.context.java.JavaPersistentType;
-import org.eclipse.jpt.core.internal.platform.GenericJpaFactory;
-
-public class TestJpaFactory extends GenericJpaFactory
-{
- @Override
- public JavaEntity buildJavaEntity(JavaPersistentType parent) {
- return new TestJavaEntity(parent);
- }
-
- @Override
- public JavaBasicMapping buildJavaBasicMapping(JavaPersistentAttribute parent) {
- return new TestJavaBasicMapping(parent);
- }
-
- public JavaTestTypeMapping buildJavaTestTypeMapping(JavaPersistentType parent) {
- return new JavaTestTypeMapping(parent);
- }
-
- public JavaTestAttributeMapping buildJavaTestAttributeMapping(JavaPersistentAttribute parent) {
- return new JavaTestAttributeMapping(parent);
- }
-}
diff --git a/jpa/tests/org.eclipse.jpt.core.tests.extension.resource/src/org/eclipse/jpt/core/tests/extension/resource/TestJpaPlatformFactory.java b/jpa/tests/org.eclipse.jpt.core.tests.extension.resource/src/org/eclipse/jpt/core/tests/extension/resource/TestJpaPlatformFactory.java
deleted file mode 100644
index 7219f4cfe8..0000000000
--- a/jpa/tests/org.eclipse.jpt.core.tests.extension.resource/src/org/eclipse/jpt/core/tests/extension/resource/TestJpaPlatformFactory.java
+++ /dev/null
@@ -1,63 +0,0 @@
-/*******************************************************************************
- * Copyright (c) 2007, 2009 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.
- *
- * Contributors:
- * Oracle - initial API and implementation
- ******************************************************************************/
-package org.eclipse.jpt.core.tests.extension.resource;
-
-import org.eclipse.jpt.core.JpaAnnotationProvider;
-import org.eclipse.jpt.core.JpaFactory;
-import org.eclipse.jpt.core.JpaPlatform;
-import org.eclipse.jpt.core.JpaPlatformFactory;
-import org.eclipse.jpt.core.JpaValidation;
-import org.eclipse.jpt.core.internal.platform.GenericJpaAnnotationDefinitionProvider;
-import org.eclipse.jpt.core.internal.platform.GenericJpaAnnotationProvider;
-import org.eclipse.jpt.core.internal.platform.GenericJpaPlatform;
-import org.eclipse.jpt.core.internal.platform.GenericJpaPlatformProvider;
-
-/**
- * All the state in the JPA platform should be "static" (i.e. unchanging once
- * it is initialized).
- */
-public class TestJpaPlatformFactory
- implements JpaPlatformFactory
-{
-
- /**
- * zero-argument constructor
- */
- public TestJpaPlatformFactory() {
- super();
- }
-
- public JpaPlatform buildJpaPlatform(String id) {
- return new GenericJpaPlatform(
- id,
- buildJpaFactory(),
- buildJpaAnnotationProvider(),
- buildJpaValidation(),
- GenericJpaPlatformProvider.instance(),
- TestJpaPlatformProvider.instance());
- }
-
- protected JpaFactory buildJpaFactory() {
- return new TestJpaFactory();
- }
-
- protected JpaAnnotationProvider buildJpaAnnotationProvider() {
- return new GenericJpaAnnotationProvider(
- GenericJpaAnnotationDefinitionProvider.instance());
- }
-
- protected JpaValidation buildJpaValidation() {
- return new JpaValidation() {
- public Supported getTablePerConcreteClassInheritanceIsSupported() {
- return Supported.MAYBE;
- }
- };
- }
-}
diff --git a/jpa/tests/org.eclipse.jpt.core.tests.extension.resource/src/org/eclipse/jpt/core/tests/extension/resource/TestJpaPlatformProvider.java b/jpa/tests/org.eclipse.jpt.core.tests.extension.resource/src/org/eclipse/jpt/core/tests/extension/resource/TestJpaPlatformProvider.java
deleted file mode 100644
index 6380e8db9b..0000000000
--- a/jpa/tests/org.eclipse.jpt.core.tests.extension.resource/src/org/eclipse/jpt/core/tests/extension/resource/TestJpaPlatformProvider.java
+++ /dev/null
@@ -1,79 +0,0 @@
-/*******************************************************************************
- * Copyright (c) 2008, 2009 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.
- *
- * Contributors:
- * Oracle - initial API and implementation
- ******************************************************************************/
-package org.eclipse.jpt.core.tests.extension.resource;
-
-import java.util.List;
-import org.eclipse.jpt.core.JpaPlatformProvider;
-import org.eclipse.jpt.core.JpaResourceModelProvider;
-import org.eclipse.jpt.core.context.MappingFileProvider;
-import org.eclipse.jpt.core.context.java.DefaultJavaAttributeMappingProvider;
-import org.eclipse.jpt.core.context.java.JavaAttributeMappingProvider;
-import org.eclipse.jpt.core.context.java.JavaTypeMappingProvider;
-import org.eclipse.jpt.core.context.orm.OrmAttributeMappingProvider;
-import org.eclipse.jpt.core.context.orm.OrmTypeMappingProvider;
-import org.eclipse.jpt.core.internal.platform.AbstractJpaPlatformProvider;
-
-public class TestJpaPlatformProvider extends AbstractJpaPlatformProvider
-{
- public static final String ID = "core.testJpaPlatform"; //$NON-NLS-1$
-
- // singleton
- private static final JpaPlatformProvider INSTANCE = new TestJpaPlatformProvider();
-
- /**
- * Return the singleton.
- */
- public static JpaPlatformProvider instance() {
- return INSTANCE;
- }
-
- /**
- * Ensure single instance.
- */
- private TestJpaPlatformProvider() {
- super();
- }
-
- @Override
- protected void addJavaTypeMappingProvidersTo(List<JavaTypeMappingProvider> providers) {
- providers.add(JavaTestTypeMappingProvider.instance());
- }
-
- @Override
- protected void addJavaAttributeMappingProvidersTo(List<JavaAttributeMappingProvider> providers) {
- providers.add(JavaTestAttributeMappingProvider.instance());
- }
-
- @Override
- protected void addMappingFileProvidersTo(List<MappingFileProvider> providers) {
- //none
- }
-
- @Override
- protected void addDefaultJavaAttributeMappingProvidersTo(List<DefaultJavaAttributeMappingProvider> providers) {
- //none
- }
-
- @Override
- protected void addOrmAttributeMappingProvidersTo(List<OrmAttributeMappingProvider> providers) {
- //none
- }
-
- @Override
- protected void addOrmTypeMappingProvidersTo(List<OrmTypeMappingProvider> providers) {
- //none
- }
-
- @Override
- protected void addResourceModelProvidersTo(List<JpaResourceModelProvider> providers) {
- //none
- }
-
-}
diff --git a/jpa/tests/org.eclipse.jpt.core.tests.extension.resource/src/org/eclipse/jpt/core/tests/extension/resource/TestJpaPlatformUiFactory.java b/jpa/tests/org.eclipse.jpt.core.tests.extension.resource/src/org/eclipse/jpt/core/tests/extension/resource/TestJpaPlatformUiFactory.java
deleted file mode 100644
index eca85554b0..0000000000
--- a/jpa/tests/org.eclipse.jpt.core.tests.extension.resource/src/org/eclipse/jpt/core/tests/extension/resource/TestJpaPlatformUiFactory.java
+++ /dev/null
@@ -1,36 +0,0 @@
-/*******************************************************************************
- * Copyright (c) 2009 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.
- *
- * Contributors:
- * Oracle - initial API and implementation
- ******************************************************************************/
-package org.eclipse.jpt.core.tests.extension.resource;
-
-import org.eclipse.jpt.ui.JpaPlatformUi;
-import org.eclipse.jpt.ui.JpaPlatformUiFactory;
-import org.eclipse.jpt.ui.internal.platform.generic.GenericJpaPlatformUi;
-import org.eclipse.jpt.ui.internal.platform.generic.GenericNavigatorProvider;
-import org.eclipse.jpt.ui.internal.structure.JavaResourceModelStructureProvider;
-import org.eclipse.jpt.ui.internal.structure.PersistenceResourceModelStructureProvider;
-
-public class TestJpaPlatformUiFactory implements JpaPlatformUiFactory
-{
-
- /**
- * Zero arg constructor for extension point
- */
- public TestJpaPlatformUiFactory() {
- super();
- }
-
- public JpaPlatformUi buildJpaPlatformUi() {
- return new GenericJpaPlatformUi(
- new TestJpaUiFactory(),
- new GenericNavigatorProvider(),
- JavaResourceModelStructureProvider.instance(),
- PersistenceResourceModelStructureProvider.instance());
- }
-}
diff --git a/jpa/tests/org.eclipse.jpt.core.tests.extension.resource/src/org/eclipse/jpt/core/tests/extension/resource/TestJpaUiFactory.java b/jpa/tests/org.eclipse.jpt.core.tests.extension.resource/src/org/eclipse/jpt/core/tests/extension/resource/TestJpaUiFactory.java
deleted file mode 100644
index bfd77f229e..0000000000
--- a/jpa/tests/org.eclipse.jpt.core.tests.extension.resource/src/org/eclipse/jpt/core/tests/extension/resource/TestJpaUiFactory.java
+++ /dev/null
@@ -1,27 +0,0 @@
-/*******************************************************************************
- * Copyright (c) 2008 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.
- *
- * Contributors:
- * Oracle - initial API and implementation
- ******************************************************************************/
-package org.eclipse.jpt.core.tests.extension.resource;
-
-import org.eclipse.jpt.ui.JpaUiFactory;
-import org.eclipse.jpt.ui.internal.BaseJpaUiFactory;
-
-/**
- * The default implementation of the UI factory required to show the information
- * related to a JPA mapping (type or attribute).
- *
- * @see JpaUiFactory
- *
- * @version 1.0
- * @since 1.0
- */
-public class TestJpaUiFactory extends BaseJpaUiFactory
-{
-
-} \ No newline at end of file
diff --git a/jpa/tests/org.eclipse.jpt.core.tests/.classpath b/jpa/tests/org.eclipse.jpt.core.tests/.classpath
deleted file mode 100644
index 3c0b3a6a9e..0000000000
--- a/jpa/tests/org.eclipse.jpt.core.tests/.classpath
+++ /dev/null
@@ -1,14 +0,0 @@
-<?xml version="1.0" encoding="UTF-8"?>
-<classpath>
- <classpathentry kind="src" path="src"/>
- <classpathentry kind="con" path="org.eclipse.jdt.launching.JRE_CONTAINER/org.eclipse.jdt.internal.debug.ui.launcher.StandardVMType/J2SE-1.5"/>
- <classpathentry kind="con" path="org.eclipse.pde.core.requiredPlugins">
- <accessrules>
- <accessrule kind="accessible" pattern="org/eclipse/wst/**"/>
- <accessrule kind="accessible" pattern="org/eclipse/jst/**"/>
- <accessrule kind="accessible" pattern="org/eclipse/jpt/core/**"/>
- <accessrule kind="accessible" pattern="org/eclipse/jpt/utility/**"/>
- </accessrules>
- </classpathentry>
- <classpathentry kind="output" path="bin"/>
-</classpath>
diff --git a/jpa/tests/org.eclipse.jpt.core.tests/.cvsignore b/jpa/tests/org.eclipse.jpt.core.tests/.cvsignore
deleted file mode 100644
index c4ba612bad..0000000000
--- a/jpa/tests/org.eclipse.jpt.core.tests/.cvsignore
+++ /dev/null
@@ -1,5 +0,0 @@
-bin
-@dot
-temp.folder
-build.xml
-javaCompiler...args \ No newline at end of file
diff --git a/jpa/tests/org.eclipse.jpt.core.tests/.project b/jpa/tests/org.eclipse.jpt.core.tests/.project
deleted file mode 100644
index 08395a8e86..0000000000
--- a/jpa/tests/org.eclipse.jpt.core.tests/.project
+++ /dev/null
@@ -1,28 +0,0 @@
-<?xml version="1.0" encoding="UTF-8"?>
-<projectDescription>
- <name>org.eclipse.jpt.core.tests</name>
- <comment></comment>
- <projects>
- </projects>
- <buildSpec>
- <buildCommand>
- <name>org.eclipse.jdt.core.javabuilder</name>
- <arguments>
- </arguments>
- </buildCommand>
- <buildCommand>
- <name>org.eclipse.pde.ManifestBuilder</name>
- <arguments>
- </arguments>
- </buildCommand>
- <buildCommand>
- <name>org.eclipse.pde.SchemaBuilder</name>
- <arguments>
- </arguments>
- </buildCommand>
- </buildSpec>
- <natures>
- <nature>org.eclipse.pde.PluginNature</nature>
- <nature>org.eclipse.jdt.core.javanature</nature>
- </natures>
-</projectDescription>
diff --git a/jpa/tests/org.eclipse.jpt.core.tests/.settings/org.eclipse.core.resources.prefs b/jpa/tests/org.eclipse.jpt.core.tests/.settings/org.eclipse.core.resources.prefs
deleted file mode 100644
index eb348782fa..0000000000
--- a/jpa/tests/org.eclipse.jpt.core.tests/.settings/org.eclipse.core.resources.prefs
+++ /dev/null
@@ -1,3 +0,0 @@
-#Tue Jan 15 11:10:55 EST 2008
-eclipse.preferences.version=1
-encoding/<project>=ISO-8859-1
diff --git a/jpa/tests/org.eclipse.jpt.core.tests/.settings/org.eclipse.jdt.core.prefs b/jpa/tests/org.eclipse.jpt.core.tests/.settings/org.eclipse.jdt.core.prefs
deleted file mode 100644
index a2f6604d54..0000000000
--- a/jpa/tests/org.eclipse.jpt.core.tests/.settings/org.eclipse.jdt.core.prefs
+++ /dev/null
@@ -1,7 +0,0 @@
-#Sun May 27 14:58:31 EDT 2007
-eclipse.preferences.version=1
-org.eclipse.jdt.core.compiler.codegen.targetPlatform=1.5
-org.eclipse.jdt.core.compiler.compliance=1.5
-org.eclipse.jdt.core.compiler.problem.assertIdentifier=error
-org.eclipse.jdt.core.compiler.problem.enumIdentifier=error
-org.eclipse.jdt.core.compiler.source=1.5
diff --git a/jpa/tests/org.eclipse.jpt.core.tests/META-INF/MANIFEST.MF b/jpa/tests/org.eclipse.jpt.core.tests/META-INF/MANIFEST.MF
deleted file mode 100644
index 30596a277f..0000000000
--- a/jpa/tests/org.eclipse.jpt.core.tests/META-INF/MANIFEST.MF
+++ /dev/null
@@ -1,39 +0,0 @@
-Manifest-Version: 1.0
-Bundle-ManifestVersion: 2
-Bundle-Name: %pluginName
-Bundle-Vendor: %providerName
-Bundle-SymbolicName: org.eclipse.jpt.core.tests
-Bundle-Version: 2.2.0
-Bundle-Localization: plugin
-Require-Bundle: org.eclipse.core.commands;bundle-version="[3.4.0,4.0.0)",
- org.eclipse.core.resources;bundle-version="[3.4.0,4.0.0)",
- org.eclipse.core.runtime;bundle-version="[3.4.0,4.0.0)",
- org.eclipse.emf.ecore.xmi;bundle-version="[2.4.0,3.0.0)",
- org.eclipse.jdt.core;bundle-version="[3.4.0,4.0.0)",
- org.eclipse.jem.util;bundle-version="[2.0.100,3.0.0)",
- org.eclipse.jpt.core;bundle-version="[2.0.0,3.0.0)",
- org.eclipse.jpt.core.tests.extension.resource;bundle-version="[2.0.0,3.0.0)",
- org.eclipse.jpt.db;bundle-version="[1.2.0,2.0.0)",
- org.eclipse.jpt.utility;bundle-version="[1.2.0,2.0.0)",
- org.eclipse.jpt.utility.tests;bundle-version="[1.2.0,2.0.0)",
- org.eclipse.wst.common.emf;bundle-version="[1.1.200,2.0.0)",
- org.eclipse.wst.common.emfworkbench.integration;bundle-version="[1.1.200,2.0.0)",
- org.eclipse.wst.common.frameworks;bundle-version="[1.1.200,1.2.0)",
- org.eclipse.wst.common.modulecore;bundle-version="[1.1.200,2.0.0)",
- org.eclipse.wst.common.project.facet.core;bundle-version="[1.3.0,2.0.0)",
- org.junit;bundle-version="[3.8.2,4.0.0)"
-Bundle-RequiredExecutionEnvironment: J2SE-1.5
-Export-Package: org.eclipse.jpt.core.tests.internal;x-friends:="org.eclipse.jpt.ui.tests",
- org.eclipse.jpt.core.tests.internal.context;x-internal:=true,
- org.eclipse.jpt.core.tests.internal.context.java;x-internal:=true,
- org.eclipse.jpt.core.tests.internal.context.orm;x-internal:=true,
- org.eclipse.jpt.core.tests.internal.context.persistence;x-internal:=true,
- org.eclipse.jpt.core.tests.internal.model;x-internal:=true,
- org.eclipse.jpt.core.tests.internal.platform;x-internal:=true,
- org.eclipse.jpt.core.tests.internal.projects;x-friends:="org.eclipse.jpt.ui.tests",
- org.eclipse.jpt.core.tests.internal.resource;x-internal:=true,
- org.eclipse.jpt.core.tests.internal.resource.java;x-internal:=true,
- org.eclipse.jpt.core.tests.internal.utility.jdt;x-internal:=true,
- org.eclipse.jpt2_0.core.tests.internal.context.java,
- org.eclipse.jpt2_0.core.tests.internal.context.orm,
- org.eclipse.jpt2_0.core.tests.internal.resource.java
diff --git a/jpa/tests/org.eclipse.jpt.core.tests/about.html b/jpa/tests/org.eclipse.jpt.core.tests/about.html
deleted file mode 100644
index be534ba44f..0000000000
--- a/jpa/tests/org.eclipse.jpt.core.tests/about.html
+++ /dev/null
@@ -1,34 +0,0 @@
-<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.0//EN">
-<HTML>
-
-<head>
-<title>About</title>
-<meta http-equiv=Content-Type content="text/html; charset=ISO-8859-1">
-</head>
-
-<BODY lang="EN-US">
-
-<H3>About This Content</H3>
-
-<P>May 02, 2008</P>
-
-<H3>License</H3>
-
-<P>The Eclipse Foundation makes available all content in this plug-in
-("Content"). Unless otherwise indicated below, the Content is provided to you
-under the terms and conditions of the Eclipse Public License Version 1.0
-("EPL"). A copy of the EPL is available at
-<A href="http://www.eclipse.org/org/documents/epl-v10.php">http://www.eclipse.org/org/documents/epl-v10.php</A>.
-For purposes of the EPL, "Program" will mean the Content.</P>
-
-<P>If you did not receive this Content directly from the Eclipse Foundation, the
-Content is being redistributed by another party ("Redistributor") and different
-terms and conditions may apply to your use of any object code in the Content.
-Check the Redistributor's license that was provided with the Content. If no such
-license exists, contact the Redistributor. Unless otherwise indicated below, the
-terms and conditions of the EPL still apply to any source code in the Content
-and such source code may be obtained at
-<A href="http://www.eclipse.org/">http://www.eclipse.org/</A>.</P>
-
-</BODY>
-</HTML>
diff --git a/jpa/tests/org.eclipse.jpt.core.tests/build.properties b/jpa/tests/org.eclipse.jpt.core.tests/build.properties
deleted file mode 100644
index 96de1ee6d2..0000000000
--- a/jpa/tests/org.eclipse.jpt.core.tests/build.properties
+++ /dev/null
@@ -1,18 +0,0 @@
-################################################################################
-# Copyright (c) 2006, 2008 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.
-#
-# Contributors:
-# Oracle - initial API and implementation
-################################################################################
-javacSource = 1.5
-javacTarget = 1.5
-bin.includes = .,\
- META-INF/,\
- about.html,\
- test.xml,\
- plugin.properties
-source.. = src/
-output.. = bin/
diff --git a/jpa/tests/org.eclipse.jpt.core.tests/plugin.properties b/jpa/tests/org.eclipse.jpt.core.tests/plugin.properties
deleted file mode 100644
index c4f4cbdc4f..0000000000
--- a/jpa/tests/org.eclipse.jpt.core.tests/plugin.properties
+++ /dev/null
@@ -1,22 +0,0 @@
-###############################################################################
-# Copyright (c) 2006, 2007 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
-#
-# Contributors: Oracle. - initial API and implementation
-###############################################################################
-# ====================================================================
-# To code developer:
-# Do NOT change the properties between this line and the
-# "%%% END OF TRANSLATED PROPERTIES %%%" line.
-# Make a new property name, append to the end of the file and change
-# the code to use the new property.
-# ====================================================================
-
-# ====================================================================
-# %%% END OF TRANSLATED PROPERTIES %%%
-# ====================================================================
-
-pluginName=Dali Java Persistence Tools - Core Tests
-providerName=Eclipse Web Tools Platform
diff --git a/jpa/tests/org.eclipse.jpt.core.tests/src/org/eclipse/jpt/core/tests/internal/JptCoreTests.java b/jpa/tests/org.eclipse.jpt.core.tests/src/org/eclipse/jpt/core/tests/internal/JptCoreTests.java
deleted file mode 100644
index e3cfa6f276..0000000000
--- a/jpa/tests/org.eclipse.jpt.core.tests/src/org/eclipse/jpt/core/tests/internal/JptCoreTests.java
+++ /dev/null
@@ -1,83 +0,0 @@
-/*******************************************************************************
- * Copyright (c) 2006, 2009 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.
- *
- * Contributors:
- * Oracle - initial API and implementation
- ******************************************************************************/
-package org.eclipse.jpt.core.tests.internal;
-
-import java.io.File;
-import junit.framework.Test;
-import junit.framework.TestSuite;
-import org.eclipse.jpt.core.tests.internal.context.JptCoreContextModelTests;
-import org.eclipse.jpt.core.tests.internal.model.JptCoreModelTests;
-import org.eclipse.jpt.core.tests.internal.projects.TestJpaProject;
-import org.eclipse.jpt.core.tests.internal.resource.JptCoreResourceModelTests;
-import org.eclipse.jpt.core.tests.internal.utility.jdt.JptCoreUtilityJdtTests;
-
-/**
- * decentralize test creation code
- *
- * Required Java system property:
- * -Dorg.eclipse.jpt.jpa.jar=<jpa.jar path>
- */
-@SuppressWarnings("nls")
-public class JptCoreTests {
- private static final String JPA_JAR_PROPERTY = TestJpaProject.JPA_JAR_NAME_SYSTEM_PROPERTY;
-
- public static Test suite() {
- TestSuite suite = new TestSuite(JptCoreTests.class.getPackage().getName());
-
- if(requiredJarsExists()) {
- suite.addTest(JptCoreUtilityJdtTests.suite());
- suite.addTest(JptCoreModelTests.suite());
- suite.addTest(JptCoreResourceModelTests.suite());
- suite.addTest(JptCoreContextModelTests.suite());
- }
- else {
- suite.addTest(TestSuite.warning(buildMissingJarErrorMessage()));
- }
- return suite;
- }
-
- public static boolean requiredJarsExists() {
- return jpaJarPropertyExists() && jpaJarFileExists();
- }
-
- public static boolean jpaJarPropertyExists() {
- return getSystemProperty(JPA_JAR_PROPERTY) != null;
- }
-
- public static boolean jpaJarFileExists() {
- return (new File(getSystemProperty(JPA_JAR_PROPERTY))).exists();
- }
-
- /*********** private **********/
- private static String buildMissingJarErrorMessage() {
-
- if( ! jpaJarPropertyExists()) {
- return errorMissingProperty(JPA_JAR_PROPERTY);
- }
- return errorJarFileDoesNotExist(getSystemProperty(JPA_JAR_PROPERTY));
- }
-
- private static String errorMissingProperty(String propertyName) {
- return "missing Java system property: \"" + propertyName + "\"";
- }
-
- private static String errorJarFileDoesNotExist(String propertyValue) {
- return "JAR file doesn't exist: \"" + propertyValue + "\"";
- }
-
- private static String getSystemProperty(String propertyName) {
- return System.getProperty(propertyName);
- }
-
- private JptCoreTests() {
- super();
- throw new UnsupportedOperationException();
- }
-}
diff --git a/jpa/tests/org.eclipse.jpt.core.tests/src/org/eclipse/jpt/core/tests/internal/context/ContextModelTestCase.java b/jpa/tests/org.eclipse.jpt.core.tests/src/org/eclipse/jpt/core/tests/internal/context/ContextModelTestCase.java
deleted file mode 100644
index 8def6c74aa..0000000000
--- a/jpa/tests/org.eclipse.jpt.core.tests/src/org/eclipse/jpt/core/tests/internal/context/ContextModelTestCase.java
+++ /dev/null
@@ -1,187 +0,0 @@
-/*******************************************************************************
- * Copyright (c) 2007, 2009 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.
- *
- * Contributors:
- * Oracle - initial API and implementation
- ******************************************************************************/
-package org.eclipse.jpt.core.tests.internal.context;
-
-import org.eclipse.core.resources.ResourcesPlugin;
-import org.eclipse.core.runtime.CoreException;
-import org.eclipse.core.runtime.IProgressMonitor;
-import org.eclipse.core.runtime.IStatus;
-import org.eclipse.core.runtime.Status;
-import org.eclipse.core.runtime.jobs.Job;
-import org.eclipse.emf.ecore.resource.Resource;
-import org.eclipse.jpt.core.JpaProject;
-import org.eclipse.jpt.core.context.JpaRootContextNode;
-import org.eclipse.jpt.core.context.MappingFile;
-import org.eclipse.jpt.core.context.java.JavaEntity;
-import org.eclipse.jpt.core.context.java.JavaPersistentType;
-import org.eclipse.jpt.core.context.orm.EntityMappings;
-import org.eclipse.jpt.core.context.persistence.ClassRef;
-import org.eclipse.jpt.core.context.persistence.PersistenceUnit;
-import org.eclipse.jpt.core.resource.orm.XmlEntityMappings;
-import org.eclipse.jpt.core.resource.persistence.PersistenceFactory;
-import org.eclipse.jpt.core.resource.persistence.XmlJavaClassRef;
-import org.eclipse.jpt.core.resource.persistence.XmlMappingFileRef;
-import org.eclipse.jpt.core.resource.persistence.XmlPersistence;
-import org.eclipse.jpt.core.resource.persistence.XmlPersistenceUnit;
-import org.eclipse.jpt.core.resource.xml.JpaXmlResource;
-import org.eclipse.jpt.core.tests.internal.projects.TestJavaProject;
-import org.eclipse.jpt.core.tests.internal.projects.TestJpaProject;
-import org.eclipse.jpt.core.tests.internal.utility.jdt.AnnotationTestCase;
-import org.eclipse.wst.common.frameworks.datamodel.IDataModel;
-import org.eclipse.wst.common.internal.emfworkbench.WorkbenchResourceHelper;
-
-@SuppressWarnings("nls")
-public abstract class ContextModelTestCase extends AnnotationTestCase
-{
- protected static final String BASE_PROJECT_NAME = "ContextModelTestProject";
-
- protected JpaXmlResource persistenceXmlResource;
-
- protected JpaXmlResource ormXmlResource;
-
-
- protected ContextModelTestCase(String name) {
- super(name);
- }
-
- @Override
- protected void setUp() throws Exception {
- super.setUp();
- this.persistenceXmlResource = getJpaProject().getPersistenceXmlResource();
- this.ormXmlResource = getJpaProject().getDefaultOrmXmlResource();
- waitForWorkspaceJobs();
- }
-
- @Override
- protected void tearDown() throws Exception {
- this.persistenceXmlResource = null;
- this.ormXmlResource = null;
- super.tearDown();
- }
-
- @Override
- protected TestJavaProject buildJavaProject(boolean autoBuild) throws Exception {
- return buildJpaProject(BASE_PROJECT_NAME, autoBuild, buildJpaConfigDataModel());
- }
-
- protected TestJpaProject buildJpaProject(String projectName, boolean autoBuild, IDataModel jpaConfig)
- throws Exception {
- return TestJpaProject.buildJpaProject(projectName, autoBuild, jpaConfig);
- }
-
- protected IDataModel buildJpaConfigDataModel() {
- return null;
- }
-
- protected JpaProject getJpaProject() {
- return getJavaProject().getJpaProject();
- }
-
- protected void waitForWorkspaceJobs() {
- // This job will not finish running until the workspace jobs are done
- Job waitJob = new Job("Wait job") {
- @Override
- protected IStatus run(IProgressMonitor monitor) {
- return Status.OK_STATUS;
- }
- };
- waitJob.setRule(ResourcesPlugin.getWorkspace().getRoot());
- waitJob.schedule();
- try {
- waitJob.join();
- } catch (InterruptedException ex) {
- // the job thread was interrupted during a wait - ignore
- }
- }
-
- protected JpaXmlResource getPersistenceXmlResource() {
- return this.persistenceXmlResource;
- }
-
- protected JpaXmlResource getOrmXmlResource() {
- return this.ormXmlResource;
- }
-
- protected XmlEntityMappings getXmlEntityMappings() {
- return (XmlEntityMappings) getOrmXmlResource().getRootObject();
- }
-
- protected XmlPersistence getXmlPersistence() {
- return (XmlPersistence) getPersistenceXmlResource().getRootObject();
- }
-
- protected EntityMappings getEntityMappings() {
- MappingFile mappingFile = getPersistenceUnit().mappingFileRefs().next().getMappingFile();
- return (mappingFile == null) ? null : (EntityMappings) mappingFile.getRoot();
- }
-
- protected XmlPersistenceUnit getXmlPersistenceUnit() {
- return getXmlPersistence().getPersistenceUnits().get(0);
- }
-
- protected PersistenceUnit getPersistenceUnit() {
- return getRootContextNode().getPersistenceXml().getPersistence().persistenceUnits().next();
- }
-
- protected ClassRef getSpecifiedClassRef() {
- return getPersistenceUnit().specifiedClassRefs().next();
- }
-
- protected JavaPersistentType getJavaPersistentType() {
- return getSpecifiedClassRef().getJavaPersistentType();
- }
-
- protected JavaEntity getJavaEntity() {
- return (JavaEntity) getJavaPersistentType().getMapping();
- }
-
- protected void addXmlClassRef(String className) {
- XmlPersistenceUnit xmlPersistenceUnit = getXmlPersistenceUnit();
-
- XmlJavaClassRef xmlClassRef = PersistenceFactory.eINSTANCE.createXmlJavaClassRef();
- xmlClassRef.setJavaClass(className);
- xmlPersistenceUnit.getClasses().add(xmlClassRef);
- }
-
- protected void removeXmlClassRef(String className) {
- XmlPersistenceUnit xmlPersistenceUnit = getXmlPersistenceUnit();
- XmlJavaClassRef xmlJavaClassRefToRemove = null;
- for (XmlJavaClassRef xmlJavaClassRef : xmlPersistenceUnit.getClasses()) {
- if (xmlJavaClassRef.getJavaClass().equals(className)) {
- xmlJavaClassRefToRemove = xmlJavaClassRef;
- }
- }
- if (xmlJavaClassRefToRemove == null) {
- throw new IllegalArgumentException();
- }
- xmlPersistenceUnit.getClasses().remove(xmlJavaClassRefToRemove);
- }
-
- protected void addXmlMappingFileRef(String fileName) {
- XmlPersistenceUnit xmlPersistenceUnit = getXmlPersistenceUnit();
-
- XmlMappingFileRef xmlMappingFileRef = PersistenceFactory.eINSTANCE.createXmlMappingFileRef();
- xmlMappingFileRef.setFileName(fileName);
- xmlPersistenceUnit.getMappingFiles().add(xmlMappingFileRef);
- }
-
- protected JpaRootContextNode getRootContextNode() {
- return getJavaProject().getJpaProject().getRootContextNode();
- }
-
- @Override
- protected TestJpaProject getJavaProject() {
- return (TestJpaProject) super.getJavaProject();
- }
-
- protected void deleteResource(Resource resource) throws CoreException {
- WorkbenchResourceHelper.deleteResource(resource);
- }
-}
diff --git a/jpa/tests/org.eclipse.jpt.core.tests/src/org/eclipse/jpt/core/tests/internal/context/JpaFileTests.java b/jpa/tests/org.eclipse.jpt.core.tests/src/org/eclipse/jpt/core/tests/internal/context/JpaFileTests.java
deleted file mode 100644
index 658b85f36b..0000000000
--- a/jpa/tests/org.eclipse.jpt.core.tests/src/org/eclipse/jpt/core/tests/internal/context/JpaFileTests.java
+++ /dev/null
@@ -1,398 +0,0 @@
-/*******************************************************************************
- * Copyright (c) 2008, 2009 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.
- *
- * Contributors:
- * Oracle - initial API and implementation
- ******************************************************************************/
-package org.eclipse.jpt.core.tests.internal.context;
-
-import java.util.Iterator;
-import org.eclipse.core.resources.IFile;
-import org.eclipse.jdt.core.ICompilationUnit;
-import org.eclipse.jpt.core.JpaFile;
-import org.eclipse.jpt.core.JpaStructureNode;
-import org.eclipse.jpt.core.JptCorePlugin;
-import org.eclipse.jpt.core.MappingKeys;
-import org.eclipse.jpt.core.context.java.JavaPersistentType;
-import org.eclipse.jpt.core.context.orm.EntityMappings;
-import org.eclipse.jpt.core.context.orm.OrmPersistentType;
-import org.eclipse.jpt.core.context.orm.OrmXml;
-import org.eclipse.jpt.core.context.persistence.ClassRef;
-import org.eclipse.jpt.core.context.persistence.MappingFileRef;
-import org.eclipse.jpt.core.resource.java.JPA;
-import org.eclipse.jpt.core.resource.persistence.PersistenceFactory;
-import org.eclipse.jpt.core.resource.persistence.XmlMappingFileRef;
-import org.eclipse.jpt.utility.internal.iterators.ArrayIterator;
-
-@SuppressWarnings("nls")
-public class JpaFileTests extends ContextModelTestCase
-{
- public JpaFileTests(String name) {
- super(name);
- }
-
- @Override
- protected void setUp() throws Exception {
- super.setUp();
- XmlMappingFileRef mappingFileRef = PersistenceFactory.eINSTANCE.createXmlMappingFileRef();
- mappingFileRef.setFileName(JptCorePlugin.DEFAULT_ORM_XML_FILE_PATH);
- getXmlPersistenceUnit().getMappingFiles().add(mappingFileRef);
- getPersistenceXmlResource().save(null);
- }
-
- private ICompilationUnit createTestEntity() 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");
- }
- });
- }
-
- public void testGetRootStructureNode() throws Exception {
- OrmPersistentType ormPersistentType = getEntityMappings().addPersistentType(MappingKeys.ENTITY_TYPE_MAPPING_KEY, FULLY_QUALIFIED_TYPE_NAME);
-
- IFile file = getOrmXmlResource().getFile();
- JpaFile ormXmlJpaFile = JptCorePlugin.getJpaFile(file);
-
- assertEquals(getEntityMappings(), ormXmlJpaFile.rootStructureNodes().next());
-
-
- ICompilationUnit cu = createTestEntity();
- JpaFile javaJpaFile = JptCorePlugin.getJpaFile((IFile) cu.getResource());
-
- assertEquals(ormPersistentType.getJavaPersistentType(), javaJpaFile.rootStructureNodes().next());
-
- addXmlClassRef(FULLY_QUALIFIED_TYPE_NAME);
-
- //verify the mapping file reference "wins" as the root structure node when both
- //persistence.xml <class> tag and mapping file <entity> tag exist for a particulary java class
- assertEquals(ormPersistentType.getJavaPersistentType(), javaJpaFile.rootStructureNodes().next());
-
- getEntityMappings().removePersistentType(ormPersistentType);
-
- assertEquals(getJavaEntity().getPersistentType(), javaJpaFile.rootStructureNodes().next());
-
- ormPersistentType = getEntityMappings().addPersistentType(MappingKeys.ENTITY_TYPE_MAPPING_KEY, FULLY_QUALIFIED_TYPE_NAME);
- assertEquals(ormPersistentType.getJavaPersistentType(), javaJpaFile.rootStructureNodes().next());
- }
-
- public void testEntityMappingsRootStructureNodeRemoved() throws Exception {
- IFile file = getOrmXmlResource().getFile();
- JpaFile ormXmlJpaFile = JptCorePlugin.getJpaFile(file);
- assertEquals(getEntityMappings(), ormXmlJpaFile.rootStructureNodes().next());
-
- ((OrmXml) getEntityMappings().getParent()).removeEntityMappings();
-
- assertFalse(ormXmlJpaFile.rootStructureNodes().hasNext());
- }
-
- public void testImpliedEntityMappingsRootStructureNodeRemoved() throws Exception {
- IFile file = getOrmXmlResource().getFile();
- JpaFile ormXmlJpaFile = JptCorePlugin.getJpaFile(file);
-
- assertNull(getPersistenceUnit().getImpliedMappingFileRef());
-
- getXmlPersistenceUnit().getMappingFiles().remove(0);
- assertNotNull(getPersistenceUnit().getImpliedMappingFileRef());
- assertEquals(getPersistenceUnit().getImpliedMappingFileRef().getMappingFile().getRoot(), ormXmlJpaFile.rootStructureNodes().next());
-
- ((OrmXml) getPersistenceUnit().getImpliedMappingFileRef().getMappingFile()).removeEntityMappings();
- assertFalse(ormXmlJpaFile.rootStructureNodes().hasNext());
- }
-
- public void testEntityMappingsRootStructureNodeRemovedFromResourceModel() throws Exception {
- IFile file = getOrmXmlResource().getFile();
- JpaFile ormXmlJpaFile = JptCorePlugin.getJpaFile(file);
- assertEquals(getEntityMappings(), ormXmlJpaFile.rootStructureNodes().next());
-
- getOrmXmlResource().getContents().remove(getOrmXmlResource().getRootObject());
-
- assertFalse(ormXmlJpaFile.rootStructureNodes().hasNext());
- }
-
- public void testUpdatePersistenceRootStructureNodePersistenceRemoved() throws Exception {
- IFile file = getPersistenceXmlResource().getFile();
- JpaFile persistenceXmlJpaFile = JptCorePlugin.getJpaFile(file);
- assertEquals(getRootContextNode().getPersistenceXml().getPersistence(), persistenceXmlJpaFile.rootStructureNodes().next());
-
- getRootContextNode().getPersistenceXml().removePersistence();
- assertFalse(persistenceXmlJpaFile.rootStructureNodes().hasNext());
- }
-
- public void testUpdateOrmJavaRootStructureNodePersistenceRemoved() throws Exception {
- OrmPersistentType ormPersistentType = getEntityMappings().addPersistentType(MappingKeys.ENTITY_TYPE_MAPPING_KEY, FULLY_QUALIFIED_TYPE_NAME);
-
- ICompilationUnit cu = createTestEntity();
- JpaFile javaJpaFile = JptCorePlugin.getJpaFile((IFile) cu.getResource());
-
- assertEquals(ormPersistentType.getJavaPersistentType(), javaJpaFile.rootStructureNodes().next());
-
- getRootContextNode().getPersistenceXml().removePersistence();
- assertFalse(javaJpaFile.rootStructureNodes().hasNext());
- }
-
- public void testUpdateJavaRootStructureNodePersistenceRemoved() throws Exception {
- ICompilationUnit cu = createTestEntity();
- addXmlClassRef(FULLY_QUALIFIED_TYPE_NAME);
-
- JpaFile javaJpaFile = JptCorePlugin.getJpaFile((IFile) cu.getResource());
-
- assertEquals(getJavaPersistentType(), javaJpaFile.rootStructureNodes().next());
-
- getRootContextNode().getPersistenceXml().removePersistence();
- assertFalse(javaJpaFile.rootStructureNodes().hasNext());
- }
-
- public void testPersistenceRootStructureNodeRemovedFromResourceModel() throws Exception {
- IFile file = getPersistenceXmlResource().getFile();
- JpaFile persistenceXmlJpaFile = JptCorePlugin.getJpaFile(file);
- getRootContextNode().getPersistenceXml().getPersistence();
- assertEquals(getRootContextNode().getPersistenceXml().getPersistence(), persistenceXmlJpaFile.rootStructureNodes().next());
-
- getPersistenceXmlResource().getContents().remove(getXmlPersistence());
-
- assertFalse(persistenceXmlJpaFile.rootStructureNodes().hasNext());
- }
-
- public void testUpdateOrmJavaRootStructureNodePersistenceXmlRemoved() throws Exception {
- OrmPersistentType ormPersistentType = getEntityMappings().addPersistentType(MappingKeys.ENTITY_TYPE_MAPPING_KEY, FULLY_QUALIFIED_TYPE_NAME);
-
- ICompilationUnit cu = createTestEntity();
- JpaFile javaJpaFile = JptCorePlugin.getJpaFile((IFile) cu.getResource());
-
- assertEquals(ormPersistentType.getJavaPersistentType(), javaJpaFile.rootStructureNodes().next());
-
- getPersistenceXmlResource().getContents().remove(getXmlPersistence());
- assertFalse(javaJpaFile.rootStructureNodes().hasNext());
- }
-
- public void testUpdateJavaRootStructureNodePersistenceXmlRemoved() throws Exception {
- ICompilationUnit cu = createTestEntity();
- addXmlClassRef(FULLY_QUALIFIED_TYPE_NAME);
-
- JpaFile javaJpaFile = JptCorePlugin.getJpaFile((IFile) cu.getResource());
-
- assertEquals(getJavaPersistentType(), javaJpaFile.rootStructureNodes().next());
-
- getPersistenceXmlResource().getContents().remove(getXmlPersistence());
- assertFalse(javaJpaFile.rootStructureNodes().hasNext());
- }
-
- public void testOrmJavaPersistentTypeRootStructureNodeRemoved() throws Exception {
- OrmPersistentType ormPersistentType = getEntityMappings().addPersistentType(MappingKeys.ENTITY_TYPE_MAPPING_KEY, FULLY_QUALIFIED_TYPE_NAME);
-
- ICompilationUnit cu = createTestEntity();
- JpaFile javaJpaFile = JptCorePlugin.getJpaFile((IFile) cu.getResource());
- JavaPersistentType javaPersistentType = ormPersistentType.getJavaPersistentType();
- assertEquals(javaPersistentType, javaJpaFile.rootStructureNodes().next());
- assertTrue(javaJpaFile.rootStructureNodes().next().getParent() instanceof OrmPersistentType);
-
-
- getEntityMappings().removePersistentType(0);
-
- assertEquals(1, javaJpaFile.rootStructureNodesSize());
- assertTrue(javaJpaFile.rootStructureNodes().next().getParent() instanceof ClassRef);
- assertNotSame(javaPersistentType, javaJpaFile.rootStructureNodes().next());
- }
-
- public void testOrmJavaPersistentTypeRootStructureNodeRemovedFromResourceModel() throws Exception {
- OrmPersistentType ormPersistentType = getEntityMappings().addPersistentType(MappingKeys.ENTITY_TYPE_MAPPING_KEY, FULLY_QUALIFIED_TYPE_NAME);
-
- ICompilationUnit cu = createTestEntity();
- JpaFile javaJpaFile = JptCorePlugin.getJpaFile((IFile) cu.getResource());
-
- JavaPersistentType javaPersistentType = ormPersistentType.getJavaPersistentType();
- assertEquals(javaPersistentType, javaJpaFile.rootStructureNodes().next());
- assertTrue(javaJpaFile.rootStructureNodes().next().getParent() instanceof OrmPersistentType);
-
- getXmlEntityMappings().getEntities().remove(0);
-
- assertEquals(1, javaJpaFile.rootStructureNodesSize());
- assertTrue(javaJpaFile.rootStructureNodes().next().getParent() instanceof ClassRef);
- assertNotSame(javaPersistentType, javaJpaFile.rootStructureNodes().next());
- }
-
- public void testJavaPersistentTypeRootStructureNodeRemoved() throws Exception {
- ICompilationUnit cu = createTestEntity();
- JpaFile javaJpaFile = JptCorePlugin.getJpaFile((IFile) cu.getResource());
-
- addXmlClassRef(FULLY_QUALIFIED_TYPE_NAME);
- JavaPersistentType javaPersistentType = getJavaPersistentType();
- assertEquals(javaPersistentType, javaJpaFile.rootStructureNodes().next());
- assertEquals(getEntityMappings().getPersistenceUnit().specifiedClassRefs().next(), javaJpaFile.rootStructureNodes().next().getParent());
-
- getEntityMappings().getPersistenceUnit().removeSpecifiedClassRef(0);
- assertNotSame(javaPersistentType, javaJpaFile.rootStructureNodes().next());
- assertEquals(getEntityMappings().getPersistenceUnit().impliedClassRefs().next(), javaJpaFile.rootStructureNodes().next().getParent());
- }
-
- public void testJavaPersistentTypeRootStructureNodeRemovedFromResourceModel() throws Exception {
- ICompilationUnit cu = createTestEntity();
- JpaFile javaJpaFile = JptCorePlugin.getJpaFile((IFile) cu.getResource());
-
- addXmlClassRef(FULLY_QUALIFIED_TYPE_NAME);
- JavaPersistentType javaPersistentType = getJavaPersistentType();
- Iterator<JpaStructureNode> rootStructureNodes = javaJpaFile.rootStructureNodes();
- JpaStructureNode rootStructureNode = rootStructureNodes.next();
- assertEquals(javaPersistentType, rootStructureNode);
- assertEquals(getEntityMappings().getPersistenceUnit().specifiedClassRefs().next(), rootStructureNode.getParent());
- assertFalse(rootStructureNodes.hasNext());
-
- removeXmlClassRef(FULLY_QUALIFIED_TYPE_NAME);
- assertNotSame(javaPersistentType, javaJpaFile.rootStructureNodes().next());
- assertEquals(getEntityMappings().getPersistenceUnit().impliedClassRefs().next(), javaJpaFile.rootStructureNodes().next().getParent());
- }
-
- public void testImpliedJavaPersistentTypeRootStructureNodeRemoved() throws Exception {
- getJpaProject().setDiscoversAnnotatedClasses(true);
- ICompilationUnit cu = createTestEntity();
- JpaFile javaJpaFile = JptCorePlugin.getJpaFile((IFile) cu.getResource());
-
- JavaPersistentType javaPersistentType = getPersistenceUnit().impliedClassRefs().next().getJavaPersistentType();
- assertEquals(javaPersistentType, javaJpaFile.rootStructureNodes().next());
-
- javaPersistentType.setMappingKey(MappingKeys.NULL_TYPE_MAPPING_KEY);
-
- assertFalse(javaJpaFile.rootStructureNodes().hasNext());
- }
-
- public void testJavaRootStructureNodesEntityMappingsRemoved() throws Exception {
- OrmPersistentType ormPersistentType = getEntityMappings().addPersistentType(MappingKeys.ENTITY_TYPE_MAPPING_KEY, FULLY_QUALIFIED_TYPE_NAME);
-
- ICompilationUnit cu = createTestEntity();
- JpaFile javaJpaFile = JptCorePlugin.getJpaFile((IFile) cu.getResource());
-
- JavaPersistentType javaPersistentType = ormPersistentType.getJavaPersistentType();
- assertEquals(javaPersistentType, javaJpaFile.rootStructureNodes().next());
-
- getOrmXmlResource().getContents().remove(getXmlEntityMappings());
- assertNotSame(javaPersistentType, javaJpaFile.rootStructureNodes().next());
- assertEquals(1, javaJpaFile.rootStructureNodesSize());
- assertEquals(getPersistenceUnit().impliedClassRefs().next(), javaJpaFile.rootStructureNodes().next().getParent());
- }
-
- public void testJavaRootStructureNodesPersistenceUnitRemovedFromResourceModel() throws Exception {
- OrmPersistentType ormPersistentType = getEntityMappings().addPersistentType(MappingKeys.ENTITY_TYPE_MAPPING_KEY, FULLY_QUALIFIED_TYPE_NAME);
-
- ICompilationUnit cu = createTestEntity();
- JpaFile javaJpaFile = JptCorePlugin.getJpaFile((IFile) cu.getResource());
-
- JavaPersistentType javaPersistentType = ormPersistentType.getJavaPersistentType();
- assertEquals(javaPersistentType, javaJpaFile.rootStructureNodes().next());
-
- getXmlPersistence().getPersistenceUnits().remove(0);
-
- assertFalse(javaJpaFile.rootStructureNodes().hasNext());
- assertEquals(0, javaJpaFile.rootStructureNodesSize());
- }
-
- public void testJavaRootStructureNodesPersistenceUnitRemoved() throws Exception {
- OrmPersistentType ormPersistentType = getEntityMappings().addPersistentType(MappingKeys.ENTITY_TYPE_MAPPING_KEY, FULLY_QUALIFIED_TYPE_NAME);
-
- ICompilationUnit cu = createTestEntity();
- JpaFile javaJpaFile = JptCorePlugin.getJpaFile((IFile) cu.getResource());
-
- JavaPersistentType javaPersistentType = ormPersistentType.getJavaPersistentType();
- assertEquals(javaPersistentType, javaJpaFile.rootStructureNodes().next());
-
- getJpaProject().getRootContextNode().getPersistenceXml().getPersistence().removePersistenceUnit(0);
-
- assertFalse(javaJpaFile.rootStructureNodes().hasNext());
- assertEquals(0, javaJpaFile.rootStructureNodesSize());
- }
-
- public void testJavaRootStructureNodesOrmPersistentTypeRemoved() throws Exception {
- OrmPersistentType ormPersistentType = getEntityMappings().addPersistentType(MappingKeys.ENTITY_TYPE_MAPPING_KEY, FULLY_QUALIFIED_TYPE_NAME);
-
- ICompilationUnit cu = createTestEntity();
- JpaFile javaJpaFile = JptCorePlugin.getJpaFile((IFile) cu.getResource());
-
- JavaPersistentType javaPersistentType = ormPersistentType.getJavaPersistentType();
- assertEquals(javaPersistentType, javaJpaFile.rootStructureNodes().next());
-
- getEntityMappings().removePersistentType(0);
- assertNotSame(javaPersistentType, javaJpaFile.rootStructureNodes().next());
- assertEquals(1, javaJpaFile.rootStructureNodesSize());
- assertEquals(getEntityMappings().getPersistenceUnit().impliedClassRefs().next(), javaJpaFile.rootStructureNodes().next().getParent());
- }
-
- public void testJavaRootStructureNodesOrmTypeMappingMorphed() throws Exception {
- OrmPersistentType ormPersistentType = getEntityMappings().addPersistentType(MappingKeys.ENTITY_TYPE_MAPPING_KEY, FULLY_QUALIFIED_TYPE_NAME);
-
- ICompilationUnit cu = createTestEntity();
- JpaFile javaJpaFile = JptCorePlugin.getJpaFile((IFile) cu.getResource());
-
- JavaPersistentType javaPersistentType = ormPersistentType.getJavaPersistentType();
- assertEquals(javaPersistentType, javaJpaFile.rootStructureNodes().next());
-
- ormPersistentType.setMappingKey(MappingKeys.EMBEDDABLE_TYPE_MAPPING_KEY);
- assertEquals(1, javaJpaFile.rootStructureNodesSize());
- javaPersistentType = getEntityMappings().persistentTypes().next().getJavaPersistentType();
- assertEquals(javaPersistentType, javaJpaFile.rootStructureNodes().next());
-
- getEntityMappings().removePersistentType(0);
- assertNotSame(javaPersistentType, javaJpaFile.rootStructureNodes().next());
- assertEquals(1, javaJpaFile.rootStructureNodesSize());
- assertEquals(getEntityMappings().getPersistenceUnit().impliedClassRefs().next(), javaJpaFile.rootStructureNodes().next().getParent());
- }
-
- public void testUpdateOrmJavaRootStructureNodeMappingFileRefChanged() throws Exception {
- OrmPersistentType ormPersistentType = getEntityMappings().addPersistentType(MappingKeys.ENTITY_TYPE_MAPPING_KEY, FULLY_QUALIFIED_TYPE_NAME);
-
- ICompilationUnit cu = createTestEntity();
- JpaFile javaJpaFile = JptCorePlugin.getJpaFile((IFile) cu.getResource());
-
- assertEquals(ormPersistentType.getJavaPersistentType(), javaJpaFile.rootStructureNodes().next());
-
- MappingFileRef mappingFileRef = getPersistenceUnit().mappingFileRefs().next();
- mappingFileRef.setFileName("foo");
-
- ormPersistentType = ((EntityMappings) getPersistenceUnit().getImpliedMappingFileRef().getMappingFile().getMappingFileRoot()).persistentTypes().next();
- assertEquals(ormPersistentType.getJavaPersistentType(), javaJpaFile.rootStructureNodes().next());
-
- IFile file = getPersistenceXmlResource().getFile();
- JpaFile ormXmlJpaFile = JptCorePlugin.getJpaFile(file);
-
- assertEquals(1, ormXmlJpaFile.rootStructureNodesSize());
- }
-
- public void testUpdateJavaRootStructureNodeMappingFileRefChanged() throws Exception {
- ICompilationUnit cu = createTestEntity();
- addXmlClassRef(FULLY_QUALIFIED_TYPE_NAME);
-
- JpaFile javaJpaFile = JptCorePlugin.getJpaFile((IFile) cu.getResource());
-
- assertEquals(getJavaPersistentType(), javaJpaFile.rootStructureNodes().next());
-
- MappingFileRef mappingFileRef = getPersistenceUnit().mappingFileRefs().next();
- mappingFileRef.setFileName("foo");
- assertEquals(getJavaPersistentType(), javaJpaFile.rootStructureNodes().next());
- }
-
-
- public void testUpdateJavaRootStrucutreNodeDeleteOrmResource() throws Exception {
- OrmPersistentType ormPersistentType = getEntityMappings().addPersistentType(MappingKeys.ENTITY_TYPE_MAPPING_KEY, FULLY_QUALIFIED_TYPE_NAME);
-
- ICompilationUnit cu = createTestEntity();
- JpaFile javaJpaFile = JptCorePlugin.getJpaFile((IFile) cu.getResource());
-
- JavaPersistentType javaPersistentType = ormPersistentType.getJavaPersistentType();
- assertEquals(javaPersistentType, javaJpaFile.rootStructureNodes().next());
-
-
- deleteResource(getOrmXmlResource());
-
- assertNotSame(javaPersistentType, javaJpaFile.rootStructureNodes().next());
- assertEquals(1, javaJpaFile.rootStructureNodesSize());
- assertEquals(getPersistenceUnit().impliedClassRefs().next(), javaJpaFile.rootStructureNodes().next().getParent());
- }
- //TODO test rootStructureNodes with a static inner class
-} \ No newline at end of file
diff --git a/jpa/tests/org.eclipse.jpt.core.tests/src/org/eclipse/jpt/core/tests/internal/context/JpaProjectTests.java b/jpa/tests/org.eclipse.jpt.core.tests/src/org/eclipse/jpt/core/tests/internal/context/JpaProjectTests.java
deleted file mode 100644
index 752af84635..0000000000
--- a/jpa/tests/org.eclipse.jpt.core.tests/src/org/eclipse/jpt/core/tests/internal/context/JpaProjectTests.java
+++ /dev/null
@@ -1,147 +0,0 @@
-/*******************************************************************************
- * Copyright (c) 2009 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.
- *
- * Contributors:
- * Oracle - initial API and implementation
- ******************************************************************************/
-package org.eclipse.jpt.core.tests.internal.context;
-
-import junit.framework.TestCase;
-import org.eclipse.jpt.core.JpaProject;
-import org.eclipse.jpt.core.JptCorePlugin;
-import org.eclipse.jpt.core.internal.resource.orm.OrmXmlResourceProvider;
-import org.eclipse.jpt.core.internal.resource.persistence.PersistenceXmlResourceProvider;
-import org.eclipse.jpt.core.resource.xml.JpaXmlResource;
-import org.eclipse.jpt.core.tests.internal.projects.TestJpaProject;
-
-@SuppressWarnings("nls")
-public class JpaProjectTests extends TestCase
-{
- static final String BASE_PROJECT_NAME = JpaProjectTests.class.getSimpleName();
-
- TestJpaProject jpaProject;
-
-
- public JpaProjectTests(String name) {
- super(name);
- }
-
- @Override
- protected void setUp() throws Exception {
- super.setUp();
- this.jpaProject = TestJpaProject.buildJpaProject(BASE_PROJECT_NAME, false); // false = no auto-build
- }
-
- @Override
- protected void tearDown() throws Exception {
- this.jpaProject.getProject().delete(true, true, null);
- this.jpaProject = null;
- super.tearDown();
- }
-
- protected JpaProject getJpaProject() {
- return this.jpaProject.getJpaProject();
- }
-
- public void testGetPersistenceXmlResource() throws Exception {
- JpaXmlResource resource = this.getJpaProject().getPersistenceXmlResource();
- assertNotNull(resource);
- assertEquals(JptCorePlugin.PERSISTENCE_XML_CONTENT_TYPE, resource.getContentType());
- assertEquals("src/META-INF/persistence.xml", resource.getFile().getProjectRelativePath().toString());
-
- //delete the persistence.xml file and verify it is not returned from getPersistenceXmlResource()
- resource.delete(null);
- resource = this.getJpaProject().getPersistenceXmlResource();
- assertNull(resource);
-
- //add the persistence.xml file back
- createPersistenceXmlFile();
- resource = this.getJpaProject().getPersistenceXmlResource();
- assertNotNull(resource);
- assertEquals(JptCorePlugin.PERSISTENCE_XML_CONTENT_TYPE, resource.getContentType());
- assertEquals("src/META-INF/persistence.xml", resource.getFile().getProjectRelativePath().toString());
- }
-
- private void createPersistenceXmlFile() throws Exception {
- PersistenceXmlResourceProvider resourceProvider =
- PersistenceXmlResourceProvider.getDefaultXmlResourceProvider(this.jpaProject.getProject());
- resourceProvider.createFileAndResource();
- }
-
- public void testGetDefaultOrmXmlResource() throws Exception {
- JpaXmlResource resource = this.getJpaProject().getDefaultOrmXmlResource();
- assertNotNull(resource);
- assertEquals(JptCorePlugin.ORM_XML_CONTENT_TYPE, resource.getContentType());
- assertEquals("src/META-INF/orm.xml", resource.getFile().getProjectRelativePath().toString());
-
- //delete the orm.xml file and verify it is not returned from getDefaultOrmXmlResource()
- resource.delete(null);
- resource = this.getJpaProject().getDefaultOrmXmlResource();
- assertNull(resource);
-
- //add the default orm.xml file back
- createDefaultOrmXmlFile();
- resource = this.getJpaProject().getDefaultOrmXmlResource();
- assertNotNull(resource);
- assertEquals(JptCorePlugin.ORM_XML_CONTENT_TYPE, resource.getContentType());
- assertEquals("src/META-INF/orm.xml", resource.getFile().getProjectRelativePath().toString());
- }
-
- private void createDefaultOrmXmlFile() throws Exception {
- OrmXmlResourceProvider resourceProvider =
- OrmXmlResourceProvider.getDefaultXmlResourceProvider(this.jpaProject.getProject());
- resourceProvider.createFileAndResource();
- }
-
- private void createOrmXmlFile(String filePath) throws Exception {
- OrmXmlResourceProvider resourceProvider =
- OrmXmlResourceProvider.getXmlResourceProvider(this.jpaProject.getProject(), filePath);
- resourceProvider.createFileAndResource();
- }
-
- public void testGetMappingFileResource() throws Exception {
- JpaXmlResource resource = this.getJpaProject().getMappingFileXmlResource(JptCorePlugin.DEFAULT_ORM_XML_FILE_PATH);
- assertNotNull(resource);
- assertEquals(JptCorePlugin.ORM_XML_CONTENT_TYPE, resource.getContentType());
- assertEquals("src/META-INF/orm.xml", resource.getFile().getProjectRelativePath().toString());
-
- //delete the orm.xml file and verify it is not returned from getMappingFileResource()
- resource.delete(null);
- resource = this.getJpaProject().getMappingFileXmlResource(JptCorePlugin.DEFAULT_ORM_XML_FILE_PATH);
- assertNull(resource);
-
- //add the orm.xml file back
- createDefaultOrmXmlFile();
- resource = this.getJpaProject().getMappingFileXmlResource(JptCorePlugin.DEFAULT_ORM_XML_FILE_PATH);
- assertNotNull(resource);
- assertEquals(JptCorePlugin.ORM_XML_CONTENT_TYPE, resource.getContentType());
- assertEquals("src/META-INF/orm.xml", resource.getFile().getProjectRelativePath().toString());
- }
-
- public void testGetMappingFileResourceDifferentlyName() throws Exception {
- JpaXmlResource resource = this.getJpaProject().getMappingFileXmlResource("META-INF/orm2.xml");
- assertNull(resource);
-
- //create the orm2.xml file
- createOrmXmlFile("META-INF/orm2.xml");
- resource = this.getJpaProject().getMappingFileXmlResource("META-INF/orm2.xml");
- assertNotNull(resource);
- assertEquals(JptCorePlugin.ORM_XML_CONTENT_TYPE, resource.getContentType());
- assertEquals("src/META-INF/orm2.xml", resource.getFile().getProjectRelativePath().toString());
-
- //delete the orm2.xml file and verify it is not returned from getMappingFileResource()
- resource.delete(null);
- resource = this.getJpaProject().getMappingFileXmlResource("META-INF/orm2.xml");
- assertNull(resource);
-
- //add the orm2.xml file back
- createOrmXmlFile("META-INF/orm2.xml");
- resource = this.getJpaProject().getMappingFileXmlResource("META-INF/orm2.xml");
- assertNotNull(resource);
- assertEquals(JptCorePlugin.ORM_XML_CONTENT_TYPE, resource.getContentType());
- assertEquals("src/META-INF/orm2.xml", resource.getFile().getProjectRelativePath().toString());
- }
-}
diff --git a/jpa/tests/org.eclipse.jpt.core.tests/src/org/eclipse/jpt/core/tests/internal/context/JptCoreContextModelTests.java b/jpa/tests/org.eclipse.jpt.core.tests/src/org/eclipse/jpt/core/tests/internal/context/JptCoreContextModelTests.java
deleted file mode 100644
index 3ca5f2640d..0000000000
--- a/jpa/tests/org.eclipse.jpt.core.tests/src/org/eclipse/jpt/core/tests/internal/context/JptCoreContextModelTests.java
+++ /dev/null
@@ -1,40 +0,0 @@
-/*******************************************************************************
- * Copyright (c) 2007, 2009 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
- *
- * Contributors:
- * Oracle - initial API and implementation
- *******************************************************************************/
-package org.eclipse.jpt.core.tests.internal.context;
-
-import junit.framework.Test;
-import junit.framework.TestCase;
-import junit.framework.TestSuite;
-import org.eclipse.jpt.core.tests.internal.context.java.JptCoreContextJavaModelTests;
-import org.eclipse.jpt.core.tests.internal.context.orm.JptCoreOrmContextModelTests;
-import org.eclipse.jpt.core.tests.internal.context.persistence.JptCorePersistenceContextModelTests;
-import org.eclipse.jpt2_0.core.tests.internal.context.java.Generic2_0JavaContextModelTests;
-import org.eclipse.jpt2_0.core.tests.internal.context.orm.Generic2_0OrmContextModelTests;
-
-public class JptCoreContextModelTests extends TestCase
-{
- public static Test suite() {
- TestSuite suite = new TestSuite(JptCoreContextModelTests.class.getName());
- suite.addTestSuite(JpaProjectTests.class);
- suite.addTestSuite(JpaFileTests.class);
- suite.addTest(JptCorePersistenceContextModelTests.suite());
- suite.addTest(JptCoreOrmContextModelTests.suite());
- suite.addTest(JptCoreContextJavaModelTests.suite());
- suite.addTest(Generic2_0JavaContextModelTests.suite());
- suite.addTest(Generic2_0OrmContextModelTests.suite());
- return suite;
- }
-
- private JptCoreContextModelTests() {
- super();
- throw new UnsupportedOperationException();
- }
-}
diff --git a/jpa/tests/org.eclipse.jpt.core.tests/src/org/eclipse/jpt/core/tests/internal/context/java/GenericJavaPersistentAttributeTests.java b/jpa/tests/org.eclipse.jpt.core.tests/src/org/eclipse/jpt/core/tests/internal/context/java/GenericJavaPersistentAttributeTests.java
deleted file mode 100644
index 0b1d6092be..0000000000
--- a/jpa/tests/org.eclipse.jpt.core.tests/src/org/eclipse/jpt/core/tests/internal/context/java/GenericJavaPersistentAttributeTests.java
+++ /dev/null
@@ -1,237 +0,0 @@
-/*******************************************************************************
- * Copyright (c) 2007, 2009 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.
- *
- * Contributors:
- * Oracle - initial API and implementation
- ******************************************************************************/
-package org.eclipse.jpt.core.tests.internal.context.java;
-
-import java.util.Iterator;
-import org.eclipse.jdt.core.ICompilationUnit;
-import org.eclipse.jpt.core.MappingKeys;
-import org.eclipse.jpt.core.context.AccessType;
-import org.eclipse.jpt.core.context.PersistentAttribute;
-import org.eclipse.jpt.core.context.java.JavaBasicMapping;
-import org.eclipse.jpt.core.context.java.JavaEmbeddedMapping;
-import org.eclipse.jpt.core.context.java.JavaIdMapping;
-import org.eclipse.jpt.core.resource.java.BasicAnnotation;
-import org.eclipse.jpt.core.resource.java.EmbeddedAnnotation;
-import org.eclipse.jpt.core.resource.java.IdAnnotation;
-import org.eclipse.jpt.core.resource.java.JPA;
-import org.eclipse.jpt.core.resource.java.JavaResourcePersistentAttribute;
-import org.eclipse.jpt.core.resource.java.JavaResourcePersistentType;
-import org.eclipse.jpt.core.tests.internal.context.ContextModelTestCase;
-import org.eclipse.jpt.utility.internal.iterators.ArrayIterator;
-
-@SuppressWarnings("nls")
-public class GenericJavaPersistentAttributeTests extends ContextModelTestCase
-{
-
- private ICompilationUnit createTestEntityAnnotatedField() 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("@Id");
- }
- });
- }
-
- private ICompilationUnit createTestEntityAnnotatedMethod() 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 appendGetIdMethodAnnotationTo(StringBuilder sb) {
- sb.append("@Id");
- }
- });
- }
-
-
- public GenericJavaPersistentAttributeTests(String name) {
- super(name);
- }
-
- public void testGetName() throws Exception {
- createTestType();
- addXmlClassRef(FULLY_QUALIFIED_TYPE_NAME);
-
- PersistentAttribute persistentAttribute = getJavaPersistentType().attributes().next();
-
- assertEquals("id", persistentAttribute.getName());
- }
-
- public void testGetMapping() throws Exception {
- createTestEntityAnnotatedMethod();
- addXmlClassRef(FULLY_QUALIFIED_TYPE_NAME);
-
- PersistentAttribute persistentAttribute = getJavaPersistentType().attributes().next();
- assertTrue(persistentAttribute.getMapping() instanceof JavaIdMapping);
-
- persistentAttribute.setSpecifiedMappingKey(null);
- assertTrue(persistentAttribute.getMapping() instanceof JavaBasicMapping);
- }
-
- public void testGetSpecifiedMapping() throws Exception {
- createTestEntityAnnotatedMethod();
- addXmlClassRef(FULLY_QUALIFIED_TYPE_NAME);
-
- PersistentAttribute persistentAttribute = getJavaPersistentType().attributes().next();
- assertTrue(persistentAttribute.getSpecifiedMapping() instanceof JavaIdMapping);
-
- persistentAttribute.setSpecifiedMappingKey(null);
- assertNull(persistentAttribute.getSpecifiedMapping());
- }
-
- public void testGetSpecifiedMappingNull() throws Exception {
- createTestType();
- addXmlClassRef(FULLY_QUALIFIED_TYPE_NAME);
-
- PersistentAttribute persistentAttribute = getJavaPersistentType().attributes().next();
-
- assertNull(persistentAttribute.getSpecifiedMapping());
- assertNotNull(persistentAttribute.getMapping());
- }
-
- public void testMappingKey() throws Exception {
- createTestEntityAnnotatedMethod();
- addXmlClassRef(FULLY_QUALIFIED_TYPE_NAME);
-
- PersistentAttribute persistentAttribute = getJavaPersistentType().attributes().next();
-
- assertEquals(MappingKeys.ID_ATTRIBUTE_MAPPING_KEY, persistentAttribute.getMappingKey());
-
- persistentAttribute.setSpecifiedMappingKey(null);
- assertEquals(MappingKeys.BASIC_ATTRIBUTE_MAPPING_KEY, persistentAttribute.getMappingKey());
- }
-
- public void testDefaultMappingKey() throws Exception {
- createTestEntityAnnotatedMethod();
- addXmlClassRef(FULLY_QUALIFIED_TYPE_NAME);
-
- PersistentAttribute persistentAttribute = getJavaPersistentType().attributes().next();
-
- assertEquals(MappingKeys.ID_ATTRIBUTE_MAPPING_KEY, persistentAttribute.getMappingKey());
- assertEquals(MappingKeys.BASIC_ATTRIBUTE_MAPPING_KEY, persistentAttribute.getDefaultMappingKey());
- }
-
- public void testSetSpecifiedMappingKey() throws Exception {
- createTestType();
- addXmlClassRef(FULLY_QUALIFIED_TYPE_NAME);
-
- PersistentAttribute persistentAttribute = getJavaPersistentType().attributes().next();
- assertNull(persistentAttribute.getSpecifiedMapping());
-
- persistentAttribute.setSpecifiedMappingKey(MappingKeys.EMBEDDED_ATTRIBUTE_MAPPING_KEY);
-
- JavaResourcePersistentType typeResource = getJpaProject().getJavaResourcePersistentType(FULLY_QUALIFIED_TYPE_NAME);
- JavaResourcePersistentAttribute attributeResource = typeResource.persistableAttributes().next();
- assertNotNull(attributeResource.getMappingAnnotation());
- assertTrue(attributeResource.getMappingAnnotation() instanceof EmbeddedAnnotation);
-
- assertEquals(MappingKeys.EMBEDDED_ATTRIBUTE_MAPPING_KEY, persistentAttribute.getMappingKey());
- assertTrue(persistentAttribute.getSpecifiedMapping() instanceof JavaEmbeddedMapping);
- }
-
- public void testSetSpecifiedMappingKey2() throws Exception {
- createTestEntityAnnotatedField();
- addXmlClassRef(FULLY_QUALIFIED_TYPE_NAME);
-
- PersistentAttribute persistentAttribute = getJavaPersistentType().attributes().next();
- assertEquals(MappingKeys.ID_ATTRIBUTE_MAPPING_KEY, persistentAttribute.getMappingKey());
-
- persistentAttribute.setSpecifiedMappingKey(MappingKeys.EMBEDDED_ATTRIBUTE_MAPPING_KEY);
-
- JavaResourcePersistentType typeResource = getJpaProject().getJavaResourcePersistentType(FULLY_QUALIFIED_TYPE_NAME);
- JavaResourcePersistentAttribute attributeResource = typeResource.persistableAttributes().next();
- assertNotNull(attributeResource.getMappingAnnotation());
- assertTrue(attributeResource.getMappingAnnotation() instanceof EmbeddedAnnotation);
-
- assertEquals(MappingKeys.EMBEDDED_ATTRIBUTE_MAPPING_KEY, persistentAttribute.getMappingKey());
- assertTrue(persistentAttribute.getSpecifiedMapping() instanceof JavaEmbeddedMapping);
- }
-
- public void testSetSpecifiedMappingKeyNull() throws Exception {
- createTestEntityAnnotatedMethod();
- addXmlClassRef(FULLY_QUALIFIED_TYPE_NAME);
-
- PersistentAttribute persistentAttribute = getJavaPersistentType().attributes().next();
- assertEquals(MappingKeys.ID_ATTRIBUTE_MAPPING_KEY, persistentAttribute.getMappingKey());
-
- persistentAttribute.setSpecifiedMappingKey(MappingKeys.NULL_ATTRIBUTE_MAPPING_KEY);
-
- JavaResourcePersistentType typeResource = getJpaProject().getJavaResourcePersistentType(FULLY_QUALIFIED_TYPE_NAME);
- JavaResourcePersistentAttribute attributeResource = typeResource.persistableAttributes().next();
- assertNull(attributeResource.getMappingAnnotation());
- assertNull(attributeResource.getMappingAnnotation(IdAnnotation.ANNOTATION_NAME));
-
- assertNull(persistentAttribute.getSpecifiedMapping());
- }
-
- public void testGetMappingKeyMappingChangeInResourceModel() throws Exception {
- createTestEntityAnnotatedField();
- addXmlClassRef(FULLY_QUALIFIED_TYPE_NAME);
-
- PersistentAttribute persistentAttribute = getJavaPersistentType().attributes().next();
- assertEquals(MappingKeys.ID_ATTRIBUTE_MAPPING_KEY, persistentAttribute.getMappingKey());
-
- JavaResourcePersistentType typeResource = getJpaProject().getJavaResourcePersistentType(FULLY_QUALIFIED_TYPE_NAME);
- JavaResourcePersistentAttribute attributeResource = typeResource.persistableAttributes().next();
- attributeResource.setMappingAnnotation(EmbeddedAnnotation.ANNOTATION_NAME);
-
- assertEquals(MappingKeys.EMBEDDED_ATTRIBUTE_MAPPING_KEY, persistentAttribute.getMappingKey());
- }
-
- public void testGetMappingKeyMappingChangeInResourceModel2() throws Exception {
- createTestType();
- addXmlClassRef(FULLY_QUALIFIED_TYPE_NAME);
-
- PersistentAttribute persistentAttribute = getJavaPersistentType().attributes().next();
- assertNull(persistentAttribute.getSpecifiedMapping());
-
- JavaResourcePersistentType typeResource = getJpaProject().getJavaResourcePersistentType(FULLY_QUALIFIED_TYPE_NAME);
- JavaResourcePersistentAttribute attributeResource = typeResource.persistableAttributes().next();
- attributeResource.setMappingAnnotation(BasicAnnotation.ANNOTATION_NAME);
-
- assertEquals(MappingKeys.BASIC_ATTRIBUTE_MAPPING_KEY, persistentAttribute.getSpecifiedMapping().getKey());
- }
-
- public void testGetAccessField() throws Exception {
- createTestEntityAnnotatedField();
- addXmlClassRef(FULLY_QUALIFIED_TYPE_NAME);
-
- PersistentAttribute persistentAttribute = getJavaPersistentType().attributes().next();
- assertEquals(AccessType.FIELD, persistentAttribute.getAccess());
- assertEquals(AccessType.FIELD, persistentAttribute.getDefaultAccess());
- assertEquals(null, persistentAttribute.getSpecifiedAccess());
- }
-
- public void testGetAccessProperty() throws Exception {
- createTestEntityAnnotatedMethod();
- addXmlClassRef(FULLY_QUALIFIED_TYPE_NAME);
-
- PersistentAttribute persistentAttribute = getJavaPersistentType().attributes().next();
- assertEquals(AccessType.PROPERTY, persistentAttribute.getAccess());
- assertEquals(AccessType.PROPERTY, persistentAttribute.getDefaultAccess());
- assertEquals(null, persistentAttribute.getSpecifiedAccess());
- }
-}
diff --git a/jpa/tests/org.eclipse.jpt.core.tests/src/org/eclipse/jpt/core/tests/internal/context/java/GenericJavaPersistentTypeTests.java b/jpa/tests/org.eclipse.jpt.core.tests/src/org/eclipse/jpt/core/tests/internal/context/java/GenericJavaPersistentTypeTests.java
deleted file mode 100644
index 65484b8879..0000000000
--- a/jpa/tests/org.eclipse.jpt.core.tests/src/org/eclipse/jpt/core/tests/internal/context/java/GenericJavaPersistentTypeTests.java
+++ /dev/null
@@ -1,759 +0,0 @@
-/*******************************************************************************
- * Copyright (c) 2007, 2009 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.
- *
- * Contributors:
- * Oracle - initial API and implementation
- ******************************************************************************/
-package org.eclipse.jpt.core.tests.internal.context.java;
-
-import java.util.Iterator;
-import java.util.ListIterator;
-import org.eclipse.jdt.core.ICompilationUnit;
-import org.eclipse.jdt.core.IField;
-import org.eclipse.jpt.core.JptCorePlugin;
-import org.eclipse.jpt.core.MappingKeys;
-import org.eclipse.jpt.core.context.AccessType;
-import org.eclipse.jpt.core.context.PersistentAttribute;
-import org.eclipse.jpt.core.context.PersistentType;
-import org.eclipse.jpt.core.context.java.JavaPersistentAttribute;
-import org.eclipse.jpt.core.context.java.JavaPersistentType;
-import org.eclipse.jpt.core.context.orm.OrmPersistentType;
-import org.eclipse.jpt.core.context.persistence.ClassRef;
-import org.eclipse.jpt.core.resource.java.EmbeddableAnnotation;
-import org.eclipse.jpt.core.resource.java.EntityAnnotation;
-import org.eclipse.jpt.core.resource.java.JPA;
-import org.eclipse.jpt.core.resource.java.JavaResourcePersistentType;
-import org.eclipse.jpt.core.resource.persistence.PersistenceFactory;
-import org.eclipse.jpt.core.resource.persistence.XmlMappingFileRef;
-import org.eclipse.jpt.core.tests.internal.context.ContextModelTestCase;
-import org.eclipse.jpt.core.tests.internal.projects.TestJavaProject.SourceWriter;
-import org.eclipse.jpt.utility.internal.iterators.ArrayIterator;
-
-
-@SuppressWarnings("nls")
-public class GenericJavaPersistentTypeTests extends ContextModelTestCase
-{
- @Override
- protected void setUp() throws Exception {
- super.setUp();
- XmlMappingFileRef mappingFileRef = PersistenceFactory.eINSTANCE.createXmlMappingFileRef();
- mappingFileRef.setFileName(JptCorePlugin.DEFAULT_ORM_XML_FILE_PATH);
- getXmlPersistenceUnit().getMappingFiles().add(mappingFileRef);
- getPersistenceXmlResource().save(null);
- }
-
- private ICompilationUnit createTestEntity() 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");
- }
- });
- }
-
- private ICompilationUnit createTestEntityAnnotatedField() 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("@Id");
- }
- });
- }
-
- private ICompilationUnit createTestEntityAnnotatedMethod() 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 appendGetIdMethodAnnotationTo(StringBuilder sb) {
- sb.append("@Id");
- }
- });
- }
- private ICompilationUnit createTestEntityAnnotatedFieldAndMethod() 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 appendGetIdMethodAnnotationTo(StringBuilder sb) {
- sb.append("@Id");
- }
-
- @Override
- public void appendIdFieldAnnotationTo(StringBuilder sb) {
- sb.append("@Id");
- }
- });
- }
-
- private ICompilationUnit createTestSubType() throws Exception {
- return this.createTestType(PACKAGE_NAME, "AnnotationTestTypeChild.java", "AnnotationTestTypeChild", new DefaultAnnotationWriter() {
- @Override
- public Iterator<String> imports() {
- return new ArrayIterator<String>(JPA.ENTITY);
- }
- @Override
- public void appendExtendsImplementsTo(StringBuilder sb) {
- sb.append("extends " + TYPE_NAME + " ");
- }
- @Override
- public void appendTypeAnnotationTo(StringBuilder sb) {
- sb.append("@Entity");
- }
-
- });
- }
-
- private ICompilationUnit createTestSubTypeWithFieldAnnotation() throws Exception {
- return this.createTestType(PACKAGE_NAME, "AnnotationTestTypeChild.java", "AnnotationTestTypeChild", new DefaultAnnotationWriter() {
- @Override
- public Iterator<String> imports() {
- return new ArrayIterator<String>(JPA.ENTITY, JPA.ID);
- }
- @Override
- public void appendExtendsImplementsTo(StringBuilder sb) {
- sb.append("extends " + TYPE_NAME + " ");
- }
- @Override
- public void appendTypeAnnotationTo(StringBuilder sb) {
- sb.append("@Entity");
- }
-
- @Override
- public void appendIdFieldAnnotationTo(StringBuilder sb) {
- sb.append("@Id");
- }
- });
- }
-
- private ICompilationUnit createTestSubTypeWithMethodAnnotation() throws Exception {
- return this.createTestType(PACKAGE_NAME, "AnnotationTestTypeChild.java", "AnnotationTestTypeChild", new DefaultAnnotationWriter() {
- @Override
- public Iterator<String> imports() {
- return new ArrayIterator<String>(JPA.ENTITY, JPA.ID);
- }
- @Override
- public void appendExtendsImplementsTo(StringBuilder sb) {
- sb.append("extends " + TYPE_NAME + " ");
- }
- @Override
- public void appendTypeAnnotationTo(StringBuilder sb) {
- sb.append("@Entity");
- }
-
- @Override
- public void appendGetIdMethodAnnotationTo(StringBuilder sb) {
- sb.append("@Id");
- }
- });
- }
-
- private ICompilationUnit createTestSubTypeNonPersistent() throws Exception {
- return this.createTestType(PACKAGE_NAME, "AnnotationTestTypeChild.java", "AnnotationTestTypeChild", new DefaultAnnotationWriter() {
- @Override
- public void appendExtendsImplementsTo(StringBuilder sb) {
- sb.append("extends " + TYPE_NAME + " ");
- }
- });
- }
-
- private ICompilationUnit createTestSubTypePersistentExtendsNonPersistent() throws Exception {
- return this.createTestType(PACKAGE_NAME, "AnnotationTestTypeChild2.java", "AnnotationTestTypeChild2", new DefaultAnnotationWriter() {
- @Override
- public Iterator<String> imports() {
- return new ArrayIterator<String>(JPA.ENTITY, JPA.ID);
- }
- @Override
- public void appendExtendsImplementsTo(StringBuilder sb) {
- sb.append("extends AnnotationTestTypeChild ");
- }
- @Override
- public void appendTypeAnnotationTo(StringBuilder sb) {
- sb.append("@Entity");
- }
-
- @Override
- public void appendGetIdMethodAnnotationTo(StringBuilder sb) {
- sb.append("@Id");
- }
- });
- }
-
- public GenericJavaPersistentTypeTests(String name) {
- super(name);
- }
-
- public void testGetName() throws Exception {
- createTestType();
- addXmlClassRef(FULLY_QUALIFIED_TYPE_NAME);
-
- assertEquals(FULLY_QUALIFIED_TYPE_NAME, getJavaPersistentType().getName());
- }
-
- public void testGetAccessNothingAnnotated() throws Exception {
- createTestType();
- addXmlClassRef(FULLY_QUALIFIED_TYPE_NAME);
-
- assertEquals(AccessType.FIELD, getJavaPersistentType().getAccess());
- }
-
- public void testAccessField() throws Exception {
- createTestEntityAnnotatedField();
- addXmlClassRef(FULLY_QUALIFIED_TYPE_NAME);
-
- assertEquals(AccessType.FIELD, getJavaPersistentType().getAccess());
- }
-
- public void testAccessProperty() throws Exception {
- createTestEntityAnnotatedMethod();
- addXmlClassRef(FULLY_QUALIFIED_TYPE_NAME);
-
- assertEquals(AccessType.PROPERTY, getJavaPersistentType().getAccess());
- }
-
- public void testAccessFieldAndMethodAnnotated() throws Exception {
- createTestEntityAnnotatedFieldAndMethod();
- addXmlClassRef(FULLY_QUALIFIED_TYPE_NAME);
-
- assertEquals(AccessType.FIELD, getJavaPersistentType().getAccess());
- }
-
- public void testAccessInheritance() throws Exception {
- createTestEntityAnnotatedMethod();
- createTestSubType();
-
- addXmlClassRef(FULLY_QUALIFIED_TYPE_NAME);
- addXmlClassRef(PACKAGE_NAME + ".AnnotationTestTypeChild");
-
- ListIterator<ClassRef> classRefs = getPersistenceUnit().specifiedClassRefs();
- classRefs.next();
- ClassRef classRef = classRefs.next();
-
- JavaPersistentType javaPersistentType = classRef.getJavaPersistentType();
- assertEquals(PACKAGE_NAME + ".AnnotationTestTypeChild", javaPersistentType.getName());
-
- assertEquals(AccessType.PROPERTY, javaPersistentType.getAccess());
- }
-
- public void testAccessInheritance2() throws Exception {
- createTestEntityAnnotatedField();
- createTestSubType();
-
- addXmlClassRef(FULLY_QUALIFIED_TYPE_NAME);
- addXmlClassRef(PACKAGE_NAME + ".AnnotationTestTypeChild");
-
- ListIterator<ClassRef> classRefs = getPersistenceUnit().specifiedClassRefs();
- classRefs.next();
- ClassRef classRef = classRefs.next();
-
- JavaPersistentType javaPersistentType = classRef.getJavaPersistentType();
- assertEquals(PACKAGE_NAME + ".AnnotationTestTypeChild", javaPersistentType.getName());
-
- assertEquals(AccessType.FIELD, javaPersistentType.getAccess());
- }
-
- public void testAccessInheritance3() throws Exception {
- createTestEntityAnnotatedField();
- createTestSubTypeWithMethodAnnotation();
-
- addXmlClassRef(FULLY_QUALIFIED_TYPE_NAME);
- addXmlClassRef(PACKAGE_NAME + ".AnnotationTestTypeChild");
-
- ListIterator<ClassRef> classRefs = getPersistenceUnit().specifiedClassRefs();
- classRefs.next();
- ClassRef classRef = classRefs.next();
-
- JavaPersistentType javaPersistentType = classRef.getJavaPersistentType();
- assertEquals(PACKAGE_NAME + ".AnnotationTestTypeChild", javaPersistentType.getName());
-
- assertEquals(AccessType.PROPERTY, javaPersistentType.getAccess());
- }
-
- public void testAccessInheritance4() throws Exception {
- createTestEntityAnnotatedMethod();
- createTestSubTypeWithFieldAnnotation();
-
- addXmlClassRef(FULLY_QUALIFIED_TYPE_NAME);
- addXmlClassRef(PACKAGE_NAME + ".AnnotationTestTypeChild");
-
- ListIterator<ClassRef> classRefs = getPersistenceUnit().specifiedClassRefs();
- classRefs.next();
- ClassRef classRef = classRefs.next();
- JavaPersistentType javaPersistentType = classRef.getJavaPersistentType();
-
- assertEquals(PACKAGE_NAME + ".AnnotationTestTypeChild", javaPersistentType.getName());
-
- assertEquals(AccessType.FIELD, javaPersistentType.getAccess());
- }
-
- //inherited class having annotations set wins over the default access set on persistence-unit-defaults
- public void testAccessInheritancePersistenceUnitDefaultAccess() throws Exception {
- createTestEntityAnnotatedMethod();
- createTestSubType();
-
- addXmlClassRef(FULLY_QUALIFIED_TYPE_NAME);
- addXmlClassRef(PACKAGE_NAME + ".AnnotationTestTypeChild");
- getEntityMappings().getPersistenceUnitMetadata().getPersistenceUnitDefaults().setAccess(AccessType.FIELD);
-
- ListIterator<ClassRef> classRefs = getPersistenceUnit().specifiedClassRefs();
- classRefs.next();
- ClassRef classRef = classRefs.next();
- JavaPersistentType javaPersistentType = classRef.getJavaPersistentType();
-
- assertEquals(PACKAGE_NAME + ".AnnotationTestTypeChild", javaPersistentType.getName());
-
- assertEquals(AccessType.PROPERTY, javaPersistentType.getAccess());
- }
-
- public void testAccessXmlNoAccessNoAnnotations() throws Exception {
- OrmPersistentType entityPersistentType = getEntityMappings().addPersistentType(MappingKeys.ENTITY_TYPE_MAPPING_KEY, FULLY_QUALIFIED_TYPE_NAME);
- createTestEntity();
-
- JavaPersistentType javaPersistentType = entityPersistentType.getJavaPersistentType();
- assertEquals(AccessType.FIELD, javaPersistentType.getAccess());
- }
-
- public void testAccessXmlEntityAccessNoAnnotations() throws Exception {
- OrmPersistentType entityPersistentType = getEntityMappings().addPersistentType(MappingKeys.ENTITY_TYPE_MAPPING_KEY, FULLY_QUALIFIED_TYPE_NAME);
- createTestEntity();
- JavaPersistentType javaPersistentType = entityPersistentType.getJavaPersistentType();
-
- entityPersistentType.setSpecifiedAccess(AccessType.FIELD);
- assertEquals(AccessType.FIELD, javaPersistentType.getAccess());
-
- entityPersistentType.setSpecifiedAccess(AccessType.PROPERTY);
- assertEquals(AccessType.PROPERTY, javaPersistentType.getAccess());
- }
-
- public void testAccessXmlPersistenceUnitDefaultsAccessNoAnnotations() throws Exception {
- OrmPersistentType entityPersistentType = getEntityMappings().addPersistentType(MappingKeys.ENTITY_TYPE_MAPPING_KEY, FULLY_QUALIFIED_TYPE_NAME);
- createTestEntity();
- JavaPersistentType javaPersistentType = entityPersistentType.getJavaPersistentType();
- assertEquals(AccessType.FIELD, javaPersistentType.getAccess());
-
- getEntityMappings().getPersistenceUnitMetadata().getPersistenceUnitDefaults().setAccess(AccessType.FIELD);
- assertEquals(AccessType.FIELD, javaPersistentType.getAccess());
-
- getEntityMappings().getPersistenceUnitMetadata().getPersistenceUnitDefaults().setAccess(AccessType.PROPERTY);
- assertEquals(AccessType.PROPERTY, javaPersistentType.getAccess());
- }
-
- public void testAccessXmlEntityPropertyAccessAndFieldAnnotations() throws Exception {
- //xml access set to property, field annotations, JavaPersistentType access is field
- OrmPersistentType ormPersistentType = getEntityMappings().addPersistentType(MappingKeys.ENTITY_TYPE_MAPPING_KEY, FULLY_QUALIFIED_TYPE_NAME);
- createTestEntityAnnotatedField();
- JavaPersistentType javaPersistentType = ormPersistentType.getJavaPersistentType();
-
- ormPersistentType.setSpecifiedAccess(AccessType.PROPERTY);
- assertEquals(AccessType.FIELD, javaPersistentType.getAccess());
- }
-
- public void testAccessXmlEntityFieldAccessAndPropertyAnnotations() throws Exception {
- //xml access set to field, property annotations, JavaPersistentType access is property
- OrmPersistentType ormPersistentType = getEntityMappings().addPersistentType(MappingKeys.ENTITY_TYPE_MAPPING_KEY, FULLY_QUALIFIED_TYPE_NAME);
- createTestEntityAnnotatedMethod();
- JavaPersistentType javaPersistentType = ormPersistentType.getJavaPersistentType();
-
- ormPersistentType.setSpecifiedAccess(AccessType.FIELD);
- assertEquals(AccessType.PROPERTY, javaPersistentType.getAccess());
- }
-
- public void testAccessXmlPersistenceUnitDefaultsAccessFieldAnnotations() throws Exception {
- OrmPersistentType entityPersistentType = getEntityMappings().addPersistentType(MappingKeys.ENTITY_TYPE_MAPPING_KEY, FULLY_QUALIFIED_TYPE_NAME);
- createTestEntityAnnotatedField();
- JavaPersistentType javaPersistentType = entityPersistentType.getJavaPersistentType();
-
- getEntityMappings().getPersistenceUnitMetadata().getPersistenceUnitDefaults().setAccess(AccessType.PROPERTY);
- assertEquals(AccessType.FIELD, javaPersistentType.getAccess());
- }
-
- //inheritance wins over entity-mappings specified access
- public void testAccessXmlEntityMappingsAccessWithInheritance() throws Exception {
- OrmPersistentType entityPersistentType = getEntityMappings().addPersistentType(MappingKeys.ENTITY_TYPE_MAPPING_KEY, FULLY_QUALIFIED_TYPE_NAME);
- OrmPersistentType childEntityPersistentType = getEntityMappings().addPersistentType(MappingKeys.ENTITY_TYPE_MAPPING_KEY, PACKAGE_NAME + ".AnnotationTestTypeChild");
-
- createTestEntityAnnotatedMethod();
- createTestSubType();
- JavaPersistentType childJavaPersistentType = childEntityPersistentType.getJavaPersistentType();
-
- getEntityMappings().setSpecifiedAccess(AccessType.FIELD);
- assertEquals(AccessType.PROPERTY, entityPersistentType.getJavaPersistentType().getAccess());
- assertEquals(AccessType.PROPERTY, childJavaPersistentType.getAccess());
- }
-
- public void testAccessXmlMetadataCompleteFieldAnnotations() throws Exception {
- //xml access set to property, java has field annotations so the access should be field
- OrmPersistentType entityPersistentType = getEntityMappings().addPersistentType(MappingKeys.ENTITY_TYPE_MAPPING_KEY, FULLY_QUALIFIED_TYPE_NAME);
- createTestEntityAnnotatedField();
- JavaPersistentType javaPersistentType = entityPersistentType.getJavaPersistentType();
-
- getEntityMappings().getPersistenceUnitMetadata().getPersistenceUnitDefaults().setAccess(AccessType.PROPERTY);
- getEntityMappings().getPersistenceUnitMetadata().setXmlMappingMetadataComplete(true);
- assertEquals(AccessType.FIELD, javaPersistentType.getAccess());
-
- }
-
- public void testAccessNoXmlAccessXmlMetdataCompletePropertyAnnotations() throws Exception {
- //xml access not set, metadata complete set. JavaPersistentType access is property because properties are annotated
- OrmPersistentType entityPersistentType = getEntityMappings().addPersistentType(MappingKeys.ENTITY_TYPE_MAPPING_KEY, FULLY_QUALIFIED_TYPE_NAME);
- createTestEntityAnnotatedMethod();
- JavaPersistentType javaPersistentType = entityPersistentType.getJavaPersistentType();
-
- getEntityMappings().getPersistenceUnitMetadata().setXmlMappingMetadataComplete(true);
- assertEquals(AccessType.PROPERTY, javaPersistentType.getAccess());
- }
-
- public void testParentPersistentType() throws Exception {
- createTestEntityAnnotatedMethod();
- createTestSubTypeWithFieldAnnotation();
-
- addXmlClassRef(FULLY_QUALIFIED_TYPE_NAME);
- addXmlClassRef(PACKAGE_NAME + ".AnnotationTestTypeChild");
-
- ListIterator<ClassRef> classRefs = getPersistenceUnit().specifiedClassRefs();
- ClassRef classRef = classRefs.next();
- JavaPersistentType rootJavaPersistentType = classRef.getJavaPersistentType();
-
- classRef = classRefs.next();
- JavaPersistentType childJavaPersistentType = classRef.getJavaPersistentType();
-
- assertEquals(rootJavaPersistentType, childJavaPersistentType.getParentPersistentType());
- assertNull(rootJavaPersistentType.getParentPersistentType());
- }
-
- public void testParentPersistentType2() throws Exception {
- createTestEntityAnnotatedMethod();
- createTestSubTypeWithFieldAnnotation();
-
- //parent is not added to the persistenceUnit, but it should still be found
- //as the parentPersistentType because of impliedClassRefs and changes for bug 190317
- addXmlClassRef(PACKAGE_NAME + ".AnnotationTestTypeChild");
-
- ListIterator<ClassRef> classRefs = getPersistenceUnit().specifiedClassRefs();
- JavaPersistentType javaPersistentType = classRefs.next().getJavaPersistentType();
-
- assertNotNull(javaPersistentType.getParentPersistentType());
- }
-
- //Entity extends Non-Entity extends Entity
- public void testParentPersistentType3() throws Exception {
- createTestEntityAnnotatedMethod();
- createTestSubTypeNonPersistent();
- createTestSubTypePersistentExtendsNonPersistent();
-
- addXmlClassRef(FULLY_QUALIFIED_TYPE_NAME);
- addXmlClassRef(PACKAGE_NAME + ".AnnotationTestTypeChild2");
-
- ListIterator<ClassRef> classRefs = getPersistenceUnit().specifiedClassRefs();
- ClassRef classRef = classRefs.next();
- JavaPersistentType rootJavaPersistentType = classRef.getJavaPersistentType();
-
- classRef = classRefs.next();
- JavaPersistentType childJavaPersistentType = classRef.getJavaPersistentType();
-
- assertEquals(rootJavaPersistentType, childJavaPersistentType.getParentPersistentType());
- assertNull(rootJavaPersistentType.getParentPersistentType());
- }
-
- public void testInheritanceHierarchy() throws Exception {
- createTestEntityAnnotatedMethod();
- createTestSubTypeNonPersistent();
- createTestSubTypePersistentExtendsNonPersistent();
-
- addXmlClassRef(FULLY_QUALIFIED_TYPE_NAME);
- addXmlClassRef(PACKAGE_NAME + ".AnnotationTestTypeChild2");
-
- ListIterator<ClassRef> classRefs = getPersistenceUnit().specifiedClassRefs();
- JavaPersistentType rootJavaPersistentType = classRefs.next().getJavaPersistentType();
- JavaPersistentType childJavaPersistentType = classRefs.next().getJavaPersistentType();
-
- Iterator<PersistentType> inheritanceHierarchy = childJavaPersistentType.inheritanceHierarchy();
-
- assertEquals(childJavaPersistentType, inheritanceHierarchy.next());
- assertEquals(rootJavaPersistentType, inheritanceHierarchy.next());
- }
-
- public void testInheritanceHierarchy2() throws Exception {
- createTestEntityAnnotatedMethod();
- createTestSubTypeNonPersistent();
- createTestSubTypePersistentExtendsNonPersistent();
-
- addXmlClassRef(PACKAGE_NAME + ".AnnotationTestTypeChild2");
- addXmlClassRef(FULLY_QUALIFIED_TYPE_NAME);
-
- ListIterator<ClassRef> classRefs = getPersistenceUnit().specifiedClassRefs();
- JavaPersistentType childJavaPersistentType = classRefs.next().getJavaPersistentType();
- JavaPersistentType rootJavaPersistentType = classRefs.next().getJavaPersistentType();
-
- Iterator<PersistentType> inheritanceHierarchy = childJavaPersistentType.inheritanceHierarchy();
-
- assertEquals(childJavaPersistentType, inheritanceHierarchy.next());
- assertEquals(rootJavaPersistentType, inheritanceHierarchy.next());
- }
-
- public void testGetMapping() throws Exception {
- createTestEntityAnnotatedMethod();
- addXmlClassRef(FULLY_QUALIFIED_TYPE_NAME);
-
- assertEquals(MappingKeys.ENTITY_TYPE_MAPPING_KEY, getJavaPersistentType().getMapping().getKey());
- }
-
- public void testGetMappingNull() throws Exception {
- createTestType();
- addXmlClassRef(FULLY_QUALIFIED_TYPE_NAME);
-
- assertEquals(MappingKeys.NULL_TYPE_MAPPING_KEY, getJavaPersistentType().getMapping().getKey());
- }
-
- public void testMappingKey() throws Exception {
- createTestEntityAnnotatedMethod();
- addXmlClassRef(FULLY_QUALIFIED_TYPE_NAME);
-
- assertEquals(MappingKeys.ENTITY_TYPE_MAPPING_KEY, getJavaPersistentType().getMappingKey());
- }
-
- public void testMappingKeyNull() throws Exception {
- createTestType();
- addXmlClassRef(FULLY_QUALIFIED_TYPE_NAME);
-
- assertEquals(MappingKeys.NULL_TYPE_MAPPING_KEY, getJavaPersistentType().getMappingKey());
- }
-
- public void testSetMappingKey() throws Exception {
- createTestType();
- addXmlClassRef(FULLY_QUALIFIED_TYPE_NAME);
-
- assertEquals(MappingKeys.NULL_TYPE_MAPPING_KEY, getJavaPersistentType().getMappingKey());
-
- getJavaPersistentType().setMappingKey(MappingKeys.ENTITY_TYPE_MAPPING_KEY);
-
- JavaResourcePersistentType typeResource = getJpaProject().getJavaResourcePersistentType(FULLY_QUALIFIED_TYPE_NAME);
- assertNotNull(typeResource.getMappingAnnotation());
- assertTrue(typeResource.getMappingAnnotation() instanceof EntityAnnotation);
-
- assertEquals(MappingKeys.ENTITY_TYPE_MAPPING_KEY, getJavaPersistentType().getMappingKey());
- }
-
- public void testSetMappingKey2() throws Exception {
- createTestEntityAnnotatedField();
- addXmlClassRef(FULLY_QUALIFIED_TYPE_NAME);
-
- assertEquals(MappingKeys.ENTITY_TYPE_MAPPING_KEY, getJavaPersistentType().getMappingKey());
-
- getJavaPersistentType().setMappingKey(MappingKeys.EMBEDDABLE_TYPE_MAPPING_KEY);
-
- JavaResourcePersistentType typeResource = getJpaProject().getJavaResourcePersistentType(FULLY_QUALIFIED_TYPE_NAME);
- assertNotNull(typeResource.getMappingAnnotation());
- assertTrue(typeResource.getMappingAnnotation() instanceof EmbeddableAnnotation);
-
- assertEquals(MappingKeys.EMBEDDABLE_TYPE_MAPPING_KEY, getJavaPersistentType().getMappingKey());
- }
-
- public void testSetMappingKeyNull() throws Exception {
- createTestEntityAnnotatedMethod();
- addXmlClassRef(FULLY_QUALIFIED_TYPE_NAME);
-
- assertEquals(MappingKeys.ENTITY_TYPE_MAPPING_KEY, getJavaPersistentType().getMappingKey());
-
- getJavaPersistentType().setMappingKey(MappingKeys.NULL_TYPE_MAPPING_KEY);
-
- JavaResourcePersistentType typeResource = getJpaProject().getJavaResourcePersistentType(FULLY_QUALIFIED_TYPE_NAME);
- assertNull(typeResource.getMappingAnnotation());
- assertNull(typeResource.getMappingAnnotation(EntityAnnotation.ANNOTATION_NAME));
-
- assertEquals(MappingKeys.NULL_TYPE_MAPPING_KEY, getJavaPersistentType().getMappingKey());
- }
-
- public void testGetMappingKeyMappingChangeInResourceModel() throws Exception {
- createTestEntityAnnotatedField();
- addXmlClassRef(FULLY_QUALIFIED_TYPE_NAME);
-
- assertEquals(MappingKeys.ENTITY_TYPE_MAPPING_KEY, getJavaPersistentType().getMappingKey());
-
- JavaResourcePersistentType typeResource = getJpaProject().getJavaResourcePersistentType(FULLY_QUALIFIED_TYPE_NAME);
- typeResource.setMappingAnnotation(EmbeddableAnnotation.ANNOTATION_NAME);
-
- assertEquals(MappingKeys.EMBEDDABLE_TYPE_MAPPING_KEY, getJavaPersistentType().getMappingKey());
- }
-
- public void testGetMappingKeyMappingChangeInResourceModel2() throws Exception {
- createTestType();
- addXmlClassRef(FULLY_QUALIFIED_TYPE_NAME);
-
- assertEquals(MappingKeys.NULL_TYPE_MAPPING_KEY, getJavaPersistentType().getMappingKey());
-
- JavaResourcePersistentType typeResource = getJpaProject().getJavaResourcePersistentType(FULLY_QUALIFIED_TYPE_NAME);
- typeResource.setMappingAnnotation(EntityAnnotation.ANNOTATION_NAME);
-
- assertEquals(MappingKeys.ENTITY_TYPE_MAPPING_KEY, getJavaPersistentType().getMappingKey());
- }
-
- public void testIsMapped() throws Exception {
- createTestEntityAnnotatedMethod();
- addXmlClassRef(FULLY_QUALIFIED_TYPE_NAME);
-
- assertTrue(getJavaPersistentType().isMapped());
-
- getJavaPersistentType().setMappingKey(MappingKeys.NULL_TYPE_MAPPING_KEY);
- assertFalse(getJavaPersistentType().isMapped());
- }
-
- public void testAttributes() throws Exception {
- createTestEntityAnnotatedMethod();
- addXmlClassRef(FULLY_QUALIFIED_TYPE_NAME);
- ListIterator<JavaPersistentAttribute> attributes = getJavaPersistentType().attributes();
-
- assertEquals("id", attributes.next().getName());
- assertFalse(attributes.hasNext());
- }
-
- public void testAttributes2() throws Exception {
- createTestEntityAnnotatedFieldAndMethod();
- addXmlClassRef(FULLY_QUALIFIED_TYPE_NAME);
-
- ListIterator<JavaPersistentAttribute> attributes = getJavaPersistentType().attributes();
-
- assertEquals("id", attributes.next().getName());
- assertEquals("name", attributes.next().getName());
- assertFalse(attributes.hasNext());
- }
-
- public void testAttributesSize() throws Exception {
- createTestEntityAnnotatedMethod();
- addXmlClassRef(FULLY_QUALIFIED_TYPE_NAME);
-
- assertEquals(1, getJavaPersistentType().attributesSize());
- }
-
- public void testAttributesSize2() throws Exception {
- createTestEntityAnnotatedFieldAndMethod();
- addXmlClassRef(FULLY_QUALIFIED_TYPE_NAME);
-
- assertEquals(2, getJavaPersistentType().attributesSize());
- }
-
- public void testAttributeNamed() throws Exception {
- createTestEntityAnnotatedMethod();
- addXmlClassRef(FULLY_QUALIFIED_TYPE_NAME);
-
- PersistentAttribute attribute = getJavaPersistentType().getAttributeNamed("id");
-
- assertEquals("id", attribute.getName());
- assertNull(getJavaPersistentType().getAttributeNamed("name"));
- assertNull(getJavaPersistentType().getAttributeNamed("foo"));
- }
-
- public void testAttributeNamed2() throws Exception {
- createTestEntityAnnotatedField();
- addXmlClassRef(FULLY_QUALIFIED_TYPE_NAME);
-
- PersistentAttribute attribute = getJavaPersistentType().getAttributeNamed("name");
-
- assertEquals("name", attribute.getName());
-
- assertNull(getJavaPersistentType().getAttributeNamed("foo"));
- }
-
- public void testRenameAttribute() throws Exception {
- ICompilationUnit testType = createTestEntityAnnotatedField();
- addXmlClassRef(FULLY_QUALIFIED_TYPE_NAME);
-
- ListIterator<JavaPersistentAttribute> attributes = getJavaPersistentType().attributes();
- JavaPersistentAttribute idAttribute = attributes.next();
- JavaPersistentAttribute nameAttribute = attributes.next();
-
-
- assertEquals("id", idAttribute.getName());
- assertEquals("name", nameAttribute.getName());
-
- IField idField = testType.findPrimaryType().getField("id");
- idField.rename("id2", false, null);
-
- attributes = getJavaPersistentType().attributes();
- JavaPersistentAttribute nameAttribute2 = attributes.next();
- JavaPersistentAttribute id2Attribute = attributes.next();
-
- assertNotSame(idAttribute, id2Attribute);
- assertEquals("id2", id2Attribute.getName());
- assertEquals(nameAttribute, nameAttribute2);
- assertEquals("name", nameAttribute2.getName());
- assertFalse(attributes.hasNext());
- }
-
- public void testParentPersistentTypeGeneric() throws Exception {
- createTestGenericEntity();
- createTestGenericMappedSuperclass();
-
- addXmlClassRef(PACKAGE_NAME + ".Entity1");
- addXmlClassRef(PACKAGE_NAME + ".Entity2");
-
- JavaPersistentType javaPersistentType = getJavaPersistentType();
- assertEquals("test.Entity1", javaPersistentType.getName());
- assertNotNull(javaPersistentType.getParentPersistentType());
-
- assertEquals("test.Entity2", javaPersistentType.getParentPersistentType().getName());
- }
-
- private void createTestGenericEntity() throws Exception {
- SourceWriter sourceWriter = new SourceWriter() {
- public void appendSourceTo(StringBuilder sb) {
- sb.append(CR);
- sb.append("import ");
- sb.append(JPA.ENTITY);
- sb.append(";");
- sb.append(CR);
- sb.append("@Entity");
- sb.append(CR);
- sb.append("public class Entity1 ");
- sb.append("extends Entity2<Integer> {}").append(CR);
- }
- };
- this.javaProject.createCompilationUnit(PACKAGE_NAME, "Entity1.java", sourceWriter);
- }
-
- private void createTestGenericMappedSuperclass() throws Exception {
- SourceWriter sourceWriter = new SourceWriter() {
- public void appendSourceTo(StringBuilder sb) {
- sb.append(CR);
- sb.append("import ");
- sb.append(JPA.MAPPED_SUPERCLASS);
- sb.append(";");
- sb.append(CR);
- sb.append("@MappedSuperclass");
- sb.append(CR);
- sb.append("public class Entity2<K> {}").append(CR);
- }
- };
- this.javaProject.createCompilationUnit(PACKAGE_NAME, "Entity2.java", sourceWriter);
- }
-}
diff --git a/jpa/tests/org.eclipse.jpt.core.tests/src/org/eclipse/jpt/core/tests/internal/context/java/JavaAssociationOverrideTests.java b/jpa/tests/org.eclipse.jpt.core.tests/src/org/eclipse/jpt/core/tests/internal/context/java/JavaAssociationOverrideTests.java
deleted file mode 100644
index db7bae5ba8..0000000000
--- a/jpa/tests/org.eclipse.jpt.core.tests/src/org/eclipse/jpt/core/tests/internal/context/java/JavaAssociationOverrideTests.java
+++ /dev/null
@@ -1,407 +0,0 @@
-/*******************************************************************************
- * Copyright (c) 2008, 2009 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.
- *
- * Contributors:
- * Oracle - initial API and implementation
- ******************************************************************************/
-package org.eclipse.jpt.core.tests.internal.context.java;
-
-import java.util.Iterator;
-import java.util.ListIterator;
-import org.eclipse.jdt.core.ICompilationUnit;
-import org.eclipse.jpt.core.context.AssociationOverride;
-import org.eclipse.jpt.core.context.Entity;
-import org.eclipse.jpt.core.context.JoinColumn;
-import org.eclipse.jpt.core.resource.java.AssociationOverrideAnnotation;
-import org.eclipse.jpt.core.resource.java.JPA;
-import org.eclipse.jpt.core.resource.java.JavaResourcePersistentType;
-import org.eclipse.jpt.core.tests.internal.context.ContextModelTestCase;
-import org.eclipse.jpt.core.tests.internal.projects.TestJavaProject.SourceWriter;
-import org.eclipse.jpt.utility.internal.iterators.ArrayIterator;
-
-@SuppressWarnings("nls")
-public class JavaAssociationOverrideTests extends ContextModelTestCase
-{
- private static final String ASSOCIATION_OVERRIDE_NAME = "MY_ASSOCIATION_OVERRIDE_NAME";
-
-
- private ICompilationUnit createTestMappedSuperclass() throws Exception {
- return this.createTestType(new DefaultAnnotationWriter() {
- @Override
- public Iterator<String> imports() {
- return new ArrayIterator<String>(JPA.MAPPED_SUPERCLASS, JPA.ONE_TO_ONE, JPA.ID);
- }
- @Override
- public void appendTypeAnnotationTo(StringBuilder sb) {
- sb.append("@MappedSuperclass");
- }
-
- @Override
- public void appendIdFieldAnnotationTo(StringBuilder sb) {
- sb.append("@OneToOne");
- sb.append(CR);
- sb.append(" private AnnotationTestTypeChild address;").append(CR);
- sb.append(CR);
- sb.append(" @Id");
- }
- });
- }
-
- private ICompilationUnit createTestEntityWithAssociationOverride() throws Exception {
- return this.createTestType(new DefaultAnnotationWriter() {
- @Override
- public Iterator<String> imports() {
- return new ArrayIterator<String>(JPA.ENTITY, JPA.ASSOCIATION_OVERRIDE);
- }
- @Override
- public void appendTypeAnnotationTo(StringBuilder sb) {
- sb.append("@Entity").append(CR);
- sb.append("@AssociationOverride(name=\"" + ASSOCIATION_OVERRIDE_NAME + "\")");
- }
- });
- }
-
- private void createTestSubType() throws Exception {
- SourceWriter sourceWriter = new SourceWriter() {
- public void appendSourceTo(StringBuilder sb) {
- sb.append("import ");
- sb.append(JPA.ENTITY);
- sb.append(";");
- sb.append(CR);
- sb.append(CR);
- sb.append("@Entity");
- sb.append(CR);
- sb.append("public class ").append("AnnotationTestTypeChild").append(" ");
- sb.append("extends " + TYPE_NAME + " ");
- sb.append("{}").append(CR);
- }
- };
- this.javaProject.createCompilationUnit(PACKAGE_NAME, "AnnotationTestTypeChild.java", sourceWriter);
- }
-
-
-
- public JavaAssociationOverrideTests(String name) {
- super(name);
- }
-
- public void testUpdateName() throws Exception {
- createTestMappedSuperclass();
- createTestSubType();
- addXmlClassRef(PACKAGE_NAME + ".AnnotationTestTypeChild");
- addXmlClassRef(FULLY_QUALIFIED_TYPE_NAME);
-
- Entity entity = getJavaEntity();
- AssociationOverride javaAssociationOverride = entity.virtualAssociationOverrides().next();
- javaAssociationOverride = javaAssociationOverride.setVirtual(false);
-
- JavaResourcePersistentType typeResource = getJpaProject().getJavaResourcePersistentType(PACKAGE_NAME + ".AnnotationTestTypeChild");
- AssociationOverrideAnnotation associationOverrideResource = (AssociationOverrideAnnotation) typeResource.getSupportingAnnotation(JPA.ASSOCIATION_OVERRIDE);
-
- assertEquals("address", javaAssociationOverride.getName());
- assertEquals("address", associationOverrideResource.getName());
- assertTrue(getJavaEntity().associationOverrides().hasNext());
-
- //set name in the resource model, verify context model updated
- associationOverrideResource.setName("FOO");
- assertEquals("FOO", javaAssociationOverride.getName());
- assertEquals("FOO", associationOverrideResource.getName());
-
- //set name to null in the resource model
- associationOverrideResource.setName(null);
- assertNull(javaAssociationOverride.getName());
- assertNull(associationOverrideResource.getName());
-
- associationOverrideResource.setName("FOO");
- assertEquals("FOO", javaAssociationOverride.getName());
- assertEquals("FOO", associationOverrideResource.getName());
-
- typeResource.removeSupportingAnnotation(0, JPA.ASSOCIATION_OVERRIDE, JPA.ASSOCIATION_OVERRIDES);
- assertFalse(getJavaEntity().specifiedAssociationOverrides().hasNext());
- assertFalse(typeResource.supportingAnnotations(JPA.ASSOCIATION_OVERRIDE, JPA.ASSOCIATION_OVERRIDES).hasNext());
- }
-
- public void testModifyName() throws Exception {
- createTestMappedSuperclass();
- createTestSubType();
- addXmlClassRef(PACKAGE_NAME + ".AnnotationTestTypeChild");
- addXmlClassRef(FULLY_QUALIFIED_TYPE_NAME);
-
- Entity entity = getJavaEntity();
- AssociationOverride javaAssociationOverride = entity.virtualAssociationOverrides().next();
- javaAssociationOverride = javaAssociationOverride.setVirtual(false);
-
- JavaResourcePersistentType typeResource = getJpaProject().getJavaResourcePersistentType(PACKAGE_NAME + ".AnnotationTestTypeChild");
- AssociationOverrideAnnotation associationOverrideResource = (AssociationOverrideAnnotation) typeResource.getSupportingAnnotation(JPA.ASSOCIATION_OVERRIDE);
-
- assertEquals("address", javaAssociationOverride.getName());
- assertEquals("address", associationOverrideResource.getName());
- assertTrue(getJavaEntity().associationOverrides().hasNext());
-
- //set name in the context model, verify resource model modified
- javaAssociationOverride.setName("foo");
- assertEquals("foo", javaAssociationOverride.getName());
- assertEquals("foo", associationOverrideResource.getName());
-
- //set name to null in the context model
- javaAssociationOverride.setName(null);
- assertNull(javaAssociationOverride.getName());
- associationOverrideResource = (AssociationOverrideAnnotation) typeResource.getSupportingAnnotation(JPA.ASSOCIATION_OVERRIDE);
- assertNull(associationOverrideResource.getName());
- }
-
- public void testAddSpecifiedJoinColumn() throws Exception {
- createTestMappedSuperclass();
- createTestSubType();
- addXmlClassRef(PACKAGE_NAME + ".AnnotationTestTypeChild");
- addXmlClassRef(FULLY_QUALIFIED_TYPE_NAME);
-
- Entity entity = getJavaEntity();
- AssociationOverride javaAssociationOverride = entity.virtualAssociationOverrides().next();
- javaAssociationOverride = javaAssociationOverride.setVirtual(false);
-
- JavaResourcePersistentType typeResource = getJpaProject().getJavaResourcePersistentType(PACKAGE_NAME + ".AnnotationTestTypeChild");
- AssociationOverrideAnnotation associationOverrideResource = (AssociationOverrideAnnotation) typeResource.getSupportingAnnotation(JPA.ASSOCIATION_OVERRIDE);
-
-
- JoinColumn joinColumn = javaAssociationOverride.addSpecifiedJoinColumn(0);
- joinColumn.setSpecifiedName("FOO");
-
- assertEquals("FOO", associationOverrideResource.joinColumnAt(0).getName());
-
- JoinColumn joinColumn2 = javaAssociationOverride.addSpecifiedJoinColumn(0);
- joinColumn2.setSpecifiedName("BAR");
-
- assertEquals("BAR", associationOverrideResource.joinColumnAt(0).getName());
- assertEquals("FOO", associationOverrideResource.joinColumnAt(1).getName());
-
- JoinColumn joinColumn3 = javaAssociationOverride.addSpecifiedJoinColumn(1);
- joinColumn3.setSpecifiedName("BAZ");
-
- assertEquals("BAR", associationOverrideResource.joinColumnAt(0).getName());
- assertEquals("BAZ", associationOverrideResource.joinColumnAt(1).getName());
- assertEquals("FOO", associationOverrideResource.joinColumnAt(2).getName());
-
- ListIterator<JoinColumn> joinColumns = javaAssociationOverride.specifiedJoinColumns();
- assertEquals(joinColumn2, joinColumns.next());
- assertEquals(joinColumn3, joinColumns.next());
- assertEquals(joinColumn, joinColumns.next());
-
- joinColumns = javaAssociationOverride.specifiedJoinColumns();
- assertEquals("BAR", joinColumns.next().getName());
- assertEquals("BAZ", joinColumns.next().getName());
- assertEquals("FOO", joinColumns.next().getName());
- }
-
- public void testRemoveSpecifiedJoinColumn() throws Exception {
- createTestMappedSuperclass();
- createTestSubType();
- addXmlClassRef(PACKAGE_NAME + ".AnnotationTestTypeChild");
- addXmlClassRef(FULLY_QUALIFIED_TYPE_NAME);
-
- Entity entity = getJavaEntity();
- AssociationOverride javaAssociationOverride = entity.virtualAssociationOverrides().next();
- javaAssociationOverride = javaAssociationOverride.setVirtual(false);
-
- JavaResourcePersistentType typeResource = getJpaProject().getJavaResourcePersistentType(PACKAGE_NAME + ".AnnotationTestTypeChild");
- AssociationOverrideAnnotation associationOverrideResource = (AssociationOverrideAnnotation) typeResource.getSupportingAnnotation(JPA.ASSOCIATION_OVERRIDE);
-
- assertEquals(1, associationOverrideResource.joinColumnsSize());
-
- javaAssociationOverride.addSpecifiedJoinColumn(0).setSpecifiedName("FOO");
- javaAssociationOverride.addSpecifiedJoinColumn(1).setSpecifiedName("BAR");
- javaAssociationOverride.addSpecifiedJoinColumn(2).setSpecifiedName("BAZ");
-
- assertEquals(4, associationOverrideResource.joinColumnsSize());
-
- javaAssociationOverride.removeSpecifiedJoinColumn(0);
- assertEquals(3, associationOverrideResource.joinColumnsSize());
- assertEquals("BAR", associationOverrideResource.joinColumnAt(0).getName());
- assertEquals("BAZ", associationOverrideResource.joinColumnAt(1).getName());
-
- javaAssociationOverride.removeSpecifiedJoinColumn(0);
- assertEquals(2, associationOverrideResource.joinColumnsSize());
- assertEquals("BAZ", associationOverrideResource.joinColumnAt(0).getName());
-
- javaAssociationOverride.removeSpecifiedJoinColumn(0);
- assertEquals(1, associationOverrideResource.joinColumnsSize());
- }
-
- public void testMoveSpecifiedJoinColumn() throws Exception {
- createTestMappedSuperclass();
- createTestSubType();
- addXmlClassRef(PACKAGE_NAME + ".AnnotationTestTypeChild");
- addXmlClassRef(FULLY_QUALIFIED_TYPE_NAME);
-
- Entity entity = getJavaEntity();
- AssociationOverride javaAssociationOverride = entity.virtualAssociationOverrides().next();
- javaAssociationOverride = javaAssociationOverride.setVirtual(false);
-
- JavaResourcePersistentType typeResource = getJpaProject().getJavaResourcePersistentType(PACKAGE_NAME + ".AnnotationTestTypeChild");
- AssociationOverrideAnnotation associationOverrideResource = (AssociationOverrideAnnotation) typeResource.getSupportingAnnotation(JPA.ASSOCIATION_OVERRIDE);
-
- javaAssociationOverride.addSpecifiedJoinColumn(0).setSpecifiedName("FOO");
- javaAssociationOverride.addSpecifiedJoinColumn(1).setSpecifiedName("BAR");
- javaAssociationOverride.addSpecifiedJoinColumn(2).setSpecifiedName("BAZ");
-
- assertEquals(4, associationOverrideResource.joinColumnsSize());
-
-
- javaAssociationOverride.moveSpecifiedJoinColumn(2, 0);
- ListIterator<JoinColumn> joinColumns = javaAssociationOverride.specifiedJoinColumns();
- assertEquals("BAR", joinColumns.next().getName());
- assertEquals("BAZ", joinColumns.next().getName());
- assertEquals("FOO", joinColumns.next().getName());
-
- assertEquals("BAR", associationOverrideResource.joinColumnAt(0).getName());
- assertEquals("BAZ", associationOverrideResource.joinColumnAt(1).getName());
- assertEquals("FOO", associationOverrideResource.joinColumnAt(2).getName());
-
-
- javaAssociationOverride.moveSpecifiedJoinColumn(0, 1);
- joinColumns = javaAssociationOverride.specifiedJoinColumns();
- assertEquals("BAZ", joinColumns.next().getName());
- assertEquals("BAR", joinColumns.next().getName());
- assertEquals("FOO", joinColumns.next().getName());
-
- assertEquals("BAZ", associationOverrideResource.joinColumnAt(0).getName());
- assertEquals("BAR", associationOverrideResource.joinColumnAt(1).getName());
- assertEquals("FOO", associationOverrideResource.joinColumnAt(2).getName());
- }
-
- public void testUpdateJoinColumns() throws Exception {
- createTestMappedSuperclass();
- createTestSubType();
- addXmlClassRef(PACKAGE_NAME + ".AnnotationTestTypeChild");
- addXmlClassRef(FULLY_QUALIFIED_TYPE_NAME);
-
- Entity entity = getJavaEntity();
- AssociationOverride javaAssociationOverride = entity.virtualAssociationOverrides().next();
- javaAssociationOverride = javaAssociationOverride.setVirtual(false);
-
- JavaResourcePersistentType typeResource = getJpaProject().getJavaResourcePersistentType(PACKAGE_NAME + ".AnnotationTestTypeChild");
- AssociationOverrideAnnotation associationOverrideResource = (AssociationOverrideAnnotation) typeResource.getSupportingAnnotation(JPA.ASSOCIATION_OVERRIDE);
-
- ListIterator<JoinColumn> joinColumns = javaAssociationOverride.specifiedJoinColumns();
- JoinColumn joinColumn = joinColumns.next();
- assertEquals("address_id", joinColumn.getSpecifiedName());
- assertEquals("id", joinColumn.getSpecifiedReferencedColumnName());
-
-
- associationOverrideResource.addJoinColumn(0);
- associationOverrideResource.addJoinColumn(1);
- associationOverrideResource.addJoinColumn(2);
-
- associationOverrideResource.joinColumnAt(0).setName("FOO");
- associationOverrideResource.joinColumnAt(1).setName("BAR");
- associationOverrideResource.joinColumnAt(2).setName("BAZ");
-
- joinColumns = javaAssociationOverride.specifiedJoinColumns();
- assertEquals("FOO", joinColumns.next().getName());
- assertEquals("BAR", joinColumns.next().getName());
- assertEquals("BAZ", joinColumns.next().getName());
- assertEquals("address_id", joinColumns.next().getName());
- assertFalse(joinColumns.hasNext());
-
- associationOverrideResource.moveJoinColumn(2, 0);
- joinColumns = javaAssociationOverride.specifiedJoinColumns();
- assertEquals("BAR", joinColumns.next().getName());
- assertEquals("BAZ", joinColumns.next().getName());
- assertEquals("FOO", joinColumns.next().getName());
- assertEquals("address_id", joinColumns.next().getName());
- assertFalse(joinColumns.hasNext());
-
- associationOverrideResource.moveJoinColumn(0, 1);
- joinColumns = javaAssociationOverride.specifiedJoinColumns();
- assertEquals("BAZ", joinColumns.next().getName());
- assertEquals("BAR", joinColumns.next().getName());
- assertEquals("FOO", joinColumns.next().getName());
- assertEquals("address_id", joinColumns.next().getName());
- assertFalse(joinColumns.hasNext());
-
- associationOverrideResource.removeJoinColumn(1);
- joinColumns = javaAssociationOverride.specifiedJoinColumns();
- assertEquals("BAZ", joinColumns.next().getName());
- assertEquals("FOO", joinColumns.next().getName());
- assertEquals("address_id", joinColumns.next().getName());
- assertFalse(joinColumns.hasNext());
-
- associationOverrideResource.removeJoinColumn(1);
- joinColumns = javaAssociationOverride.specifiedJoinColumns();
- assertEquals("BAZ", joinColumns.next().getName());
- assertEquals("address_id", joinColumns.next().getName());
- assertFalse(joinColumns.hasNext());
-
- associationOverrideResource.removeJoinColumn(0);
- joinColumns = javaAssociationOverride.specifiedJoinColumns();
- assertEquals("address_id", joinColumns.next().getName());
-
- associationOverrideResource.removeJoinColumn(0);
- assertFalse(javaAssociationOverride.specifiedJoinColumns().hasNext());
- }
-
-
-
-
- public void testGetName() throws Exception {
- createTestEntityWithAssociationOverride();
- addXmlClassRef(FULLY_QUALIFIED_TYPE_NAME);
-
- AssociationOverride specifiedAssociationOverride = getJavaEntity().specifiedAssociationOverrides().next();
- assertEquals(ASSOCIATION_OVERRIDE_NAME, specifiedAssociationOverride.getName());
-
-
- JavaResourcePersistentType typeResource = getJpaProject().getJavaResourcePersistentType(FULLY_QUALIFIED_TYPE_NAME);
- AssociationOverrideAnnotation associationOverrideResource = (AssociationOverrideAnnotation) typeResource.getSupportingAnnotation(JPA.ASSOCIATION_OVERRIDE);
-
- associationOverrideResource.setName("FOO");
- specifiedAssociationOverride = getJavaEntity().specifiedAssociationOverrides().next();
- assertEquals("FOO", specifiedAssociationOverride.getName());
- }
-
- public void testSetName() throws Exception {
- createTestEntityWithAssociationOverride();
- addXmlClassRef(FULLY_QUALIFIED_TYPE_NAME);
-
- AssociationOverride specifiedAssociationOverride = getJavaEntity().specifiedAssociationOverrides().next();
- assertEquals(ASSOCIATION_OVERRIDE_NAME, specifiedAssociationOverride.getName());
-
- specifiedAssociationOverride.setName("FOO");
-
- JavaResourcePersistentType typeResource = getJpaProject().getJavaResourcePersistentType(FULLY_QUALIFIED_TYPE_NAME);
- AssociationOverrideAnnotation associationOverrideResource = (AssociationOverrideAnnotation) typeResource.getSupportingAnnotation(JPA.ASSOCIATION_OVERRIDE);
-
- assertEquals("FOO", associationOverrideResource.getName());
- }
-
- public void testDefaultName() throws Exception {
- createTestMappedSuperclass();
- createTestSubType();
- addXmlClassRef(PACKAGE_NAME + ".AnnotationTestTypeChild");
- addXmlClassRef(FULLY_QUALIFIED_TYPE_NAME);
-
- Entity entity = getJavaEntity();
- assertEquals("AnnotationTestTypeChild", entity.getName());
- assertEquals(1, entity.virtualAssociationOverridesSize());
-
- AssociationOverride associationOverride = entity.virtualAssociationOverrides().next();
- assertEquals("address", associationOverride.getName());
- }
-
- public void testIsVirtual() throws Exception {
- createTestMappedSuperclass();
- createTestSubType();
- addXmlClassRef(PACKAGE_NAME + ".AnnotationTestTypeChild");
- addXmlClassRef(FULLY_QUALIFIED_TYPE_NAME);
-
- Entity entity = getJavaEntity();
- assertEquals("AnnotationTestTypeChild", entity.getName());
- assertEquals(1, entity.virtualAssociationOverridesSize());
-
- AssociationOverride associationOverride = entity.virtualAssociationOverrides().next();
- assertTrue(associationOverride.isVirtual());
- }
-}
diff --git a/jpa/tests/org.eclipse.jpt.core.tests/src/org/eclipse/jpt/core/tests/internal/context/java/JavaAttributeOverrideTests.java b/jpa/tests/org.eclipse.jpt.core.tests/src/org/eclipse/jpt/core/tests/internal/context/java/JavaAttributeOverrideTests.java
deleted file mode 100644
index 7edb9406a7..0000000000
--- a/jpa/tests/org.eclipse.jpt.core.tests/src/org/eclipse/jpt/core/tests/internal/context/java/JavaAttributeOverrideTests.java
+++ /dev/null
@@ -1,246 +0,0 @@
-/*******************************************************************************
- * Copyright (c) 2007, 2008 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.
- *
- * Contributors:
- * Oracle - initial API and implementation
- ******************************************************************************/
-package org.eclipse.jpt.core.tests.internal.context.java;
-
-import java.util.Iterator;
-import org.eclipse.jdt.core.ICompilationUnit;
-import org.eclipse.jpt.core.context.AttributeOverride;
-import org.eclipse.jpt.core.context.BasicMapping;
-import org.eclipse.jpt.core.context.Column;
-import org.eclipse.jpt.core.context.Entity;
-import org.eclipse.jpt.core.context.java.JavaPersistentType;
-import org.eclipse.jpt.core.resource.java.AttributeOverrideAnnotation;
-import org.eclipse.jpt.core.resource.java.ColumnAnnotation;
-import org.eclipse.jpt.core.resource.java.JPA;
-import org.eclipse.jpt.core.resource.java.JavaResourcePersistentType;
-import org.eclipse.jpt.core.tests.internal.context.ContextModelTestCase;
-import org.eclipse.jpt.core.tests.internal.projects.TestJavaProject.SourceWriter;
-import org.eclipse.jpt.utility.internal.CollectionTools;
-import org.eclipse.jpt.utility.internal.iterators.ArrayIterator;
-
-public class JavaAttributeOverrideTests extends ContextModelTestCase
-{
- private static final String ATTRIBUTE_OVERRIDE_NAME = "MY_ATTRIBUTE_OVERRIDE_NAME";
- private static final String ATTRIBUTE_OVERRIDE_COLUMN_NAME = "MY_ATTRIBUTE_OVERRIDE_COLUMN_NAME";
-
- private ICompilationUnit createTestMappedSuperclass() throws Exception {
- return this.createTestType(new DefaultAnnotationWriter() {
- @Override
- public Iterator<String> imports() {
- return new ArrayIterator<String>(JPA.MAPPED_SUPERCLASS);
- }
- @Override
- public void appendTypeAnnotationTo(StringBuilder sb) {
- sb.append("@MappedSuperclass");
- }
- });
- }
-
- private ICompilationUnit createTestEntityWithAttributeOverride() throws Exception {
- return this.createTestType(new DefaultAnnotationWriter() {
- @Override
- public Iterator<String> imports() {
- return new ArrayIterator<String>(JPA.ENTITY, JPA.ATTRIBUTE_OVERRIDE, JPA.COLUMN);
- }
- @Override
- public void appendTypeAnnotationTo(StringBuilder sb) {
- sb.append("@Entity").append(CR);
- sb.append("@AttributeOverride(name=\"" + ATTRIBUTE_OVERRIDE_NAME + "\", column=@Column(name=\"" + ATTRIBUTE_OVERRIDE_COLUMN_NAME + "\"))");
- }
- });
- }
-
- private void createTestSubType() throws Exception {
- SourceWriter sourceWriter = new SourceWriter() {
- public void appendSourceTo(StringBuilder sb) {
- sb.append(CR);
- sb.append("import ");
- sb.append(JPA.ENTITY);
- sb.append(";");
- sb.append(CR);
- sb.append("@Entity");
- sb.append(CR);
- sb.append("public class ").append("AnnotationTestTypeChild").append(" ");
- sb.append("extends " + TYPE_NAME + " ");
- sb.append("{}").append(CR);
- }
- };
- this.javaProject.createCompilationUnit(PACKAGE_NAME, "AnnotationTestTypeChild.java", sourceWriter);
- }
-
-
-
- public JavaAttributeOverrideTests(String name) {
- super(name);
- }
-
- public void testGetName() throws Exception {
- createTestEntityWithAttributeOverride();
- addXmlClassRef(FULLY_QUALIFIED_TYPE_NAME);
-
- AttributeOverride specifiedAttributeOverride = getJavaEntity().specifiedAttributeOverrides().next();
- assertEquals(ATTRIBUTE_OVERRIDE_NAME, specifiedAttributeOverride.getName());
-
-
- JavaResourcePersistentType typeResource = getJpaProject().getJavaResourcePersistentType(FULLY_QUALIFIED_TYPE_NAME);
- AttributeOverrideAnnotation attributeOverrideResource = (AttributeOverrideAnnotation) typeResource.getSupportingAnnotation(JPA.ATTRIBUTE_OVERRIDE);
-
- attributeOverrideResource.setName("FOO");
- specifiedAttributeOverride = getJavaEntity().specifiedAttributeOverrides().next();
- assertEquals("FOO", specifiedAttributeOverride.getName());
- }
-
- public void testSetName() throws Exception {
- createTestEntityWithAttributeOverride();
- addXmlClassRef(FULLY_QUALIFIED_TYPE_NAME);
-
- AttributeOverride specifiedAttributeOverride = getJavaEntity().specifiedAttributeOverrides().next();
- assertEquals(ATTRIBUTE_OVERRIDE_NAME, specifiedAttributeOverride.getName());
-
- specifiedAttributeOverride.setName("FOO");
-
- JavaResourcePersistentType typeResource = getJpaProject().getJavaResourcePersistentType(FULLY_QUALIFIED_TYPE_NAME);
- AttributeOverrideAnnotation attributeOverrideResource = (AttributeOverrideAnnotation) typeResource.getSupportingAnnotation(JPA.ATTRIBUTE_OVERRIDE);
-
- assertEquals("FOO", attributeOverrideResource.getName());
- }
-
- public void testColumnGetName() throws Exception {
- createTestEntityWithAttributeOverride();
- addXmlClassRef(FULLY_QUALIFIED_TYPE_NAME);
-
- AttributeOverride specifiedAttributeOverride = getJavaEntity().specifiedAttributeOverrides().next();
- Column column = specifiedAttributeOverride.getColumn();
- assertEquals(ATTRIBUTE_OVERRIDE_COLUMN_NAME, column.getName());
-
-
- JavaResourcePersistentType typeResource = getJpaProject().getJavaResourcePersistentType(FULLY_QUALIFIED_TYPE_NAME);
- AttributeOverrideAnnotation attributeOverrideResource = (AttributeOverrideAnnotation) typeResource.getSupportingAnnotation(JPA.ATTRIBUTE_OVERRIDE);
- ColumnAnnotation columnResource = attributeOverrideResource.getColumn();
- columnResource.setName("FOO");
-
-
- column = getJavaEntity().specifiedAttributeOverrides().next().getColumn();
- assertEquals("FOO", column.getName());
- }
-
- public void testColumnSetName() throws Exception {
- createTestEntityWithAttributeOverride();
- addXmlClassRef(FULLY_QUALIFIED_TYPE_NAME);
-
- AttributeOverride specifiedAttributeOverride = getJavaEntity().specifiedAttributeOverrides().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.getSupportingAnnotation(JPA.ATTRIBUTE_OVERRIDE);
- ColumnAnnotation columnResource = attributeOverrideResource.getColumn();
-
- assertEquals("FOO", columnResource.getName());
-
- column.setSpecifiedName(null);
-
- attributeOverrideResource = (AttributeOverrideAnnotation) typeResource.getSupportingAnnotation(JPA.ATTRIBUTE_OVERRIDE);
- assertNull(attributeOverrideResource.getColumn());
- assertNotNull(specifiedAttributeOverride.getColumn());
- }
-
- public void testColumnDefaultName() throws Exception {
- createTestMappedSuperclass();
- createTestSubType();
- addXmlClassRef(PACKAGE_NAME + ".AnnotationTestTypeChild");
- addXmlClassRef(FULLY_QUALIFIED_TYPE_NAME);
-
- Entity entity = getJavaEntity();
- assertEquals("AnnotationTestTypeChild", entity.getName());
- assertEquals(2, entity.virtualAttributeOverridesSize());
-
- AttributeOverride attributeOverride = entity.virtualAttributeOverrides().next();
- assertEquals("id", attributeOverride.getColumn().getDefaultName());
-
-
- JavaPersistentType mappedSuperclass = CollectionTools.list(getPersistenceUnit().specifiedClassRefs()).get(1).getJavaPersistentType();
- BasicMapping basicMapping = (BasicMapping) mappedSuperclass.getAttributeNamed("id").getMapping();
- basicMapping.getColumn().setSpecifiedName("FOO");
-
- attributeOverride = entity.virtualAttributeOverrides().next();
- assertEquals("FOO", attributeOverride.getColumn().getDefaultName());
- }
-
- public void testColumnDefaultTableName() throws Exception {
- createTestMappedSuperclass();
- createTestSubType();
- addXmlClassRef(PACKAGE_NAME + ".AnnotationTestTypeChild");
- addXmlClassRef(FULLY_QUALIFIED_TYPE_NAME);
-
- Entity entity = getJavaEntity();
- assertEquals("AnnotationTestTypeChild", entity.getName());
- assertEquals(2, entity.virtualAttributeOverridesSize());
-
- AttributeOverride attributeOverride = entity.virtualAttributeOverrides().next();
- assertEquals("AnnotationTestTypeChild", attributeOverride.getColumn().getDefaultTable());
-
-
- JavaPersistentType mappedSuperclass = CollectionTools.list(getPersistenceUnit().specifiedClassRefs()).get(1).getJavaPersistentType();
- BasicMapping basicMapping = (BasicMapping) mappedSuperclass.getAttributeNamed("id").getMapping();
- basicMapping.getColumn().setSpecifiedTable("BAR");
-
- attributeOverride = entity.virtualAttributeOverrides().next();
- assertEquals("BAR", attributeOverride.getColumn().getDefaultTable());
- }
-
- public void testDefaultName() throws Exception {
- createTestMappedSuperclass();
- createTestSubType();
- addXmlClassRef(PACKAGE_NAME + ".AnnotationTestTypeChild");
- addXmlClassRef(FULLY_QUALIFIED_TYPE_NAME);
-
- Entity entity = getJavaEntity();
- assertEquals("AnnotationTestTypeChild", entity.getName());
- assertEquals(2, entity.virtualAttributeOverridesSize());
-
- AttributeOverride attributeOverride = entity.virtualAttributeOverrides().next();
- assertEquals("id", attributeOverride.getName());
- }
-
- public void testIsVirtual() throws Exception {
- createTestMappedSuperclass();
- createTestSubType();
- addXmlClassRef(PACKAGE_NAME + ".AnnotationTestTypeChild");
- addXmlClassRef(FULLY_QUALIFIED_TYPE_NAME);
-
- Entity entity = getJavaEntity();
- assertEquals("AnnotationTestTypeChild", entity.getName());
- assertEquals(2, entity.virtualAttributeOverridesSize());
-
- AttributeOverride attributeOverride = entity.virtualAttributeOverrides().next();
- assertTrue(attributeOverride.isVirtual());
- }
-
- public void testSetColumn() throws Exception {
- createTestMappedSuperclass();
- createTestSubType();
- addXmlClassRef(PACKAGE_NAME + ".AnnotationTestTypeChild");
- addXmlClassRef(FULLY_QUALIFIED_TYPE_NAME);
-
- Entity entity = getJavaEntity();
- AttributeOverride attributeOverride = entity.virtualAttributeOverrides().next();
- attributeOverride = attributeOverride.setVirtual(false);
- attributeOverride.getColumn().setSpecifiedName("FOO");
-
-
- JavaResourcePersistentType typeResource = getJpaProject().getJavaResourcePersistentType(PACKAGE_NAME + ".AnnotationTestTypeChild");
- AttributeOverrideAnnotation attributeOverrideResource = (AttributeOverrideAnnotation) typeResource.getSupportingAnnotation(JPA.ATTRIBUTE_OVERRIDE);
-
- assertEquals("FOO", attributeOverrideResource.getColumn().getName());
- assertEquals("FOO", entity.specifiedAttributeOverrides().next().getColumn().getSpecifiedName());
- }
-}
diff --git a/jpa/tests/org.eclipse.jpt.core.tests/src/org/eclipse/jpt/core/tests/internal/context/java/JavaBasicMappingTests.java b/jpa/tests/org.eclipse.jpt.core.tests/src/org/eclipse/jpt/core/tests/internal/context/java/JavaBasicMappingTests.java
deleted file mode 100644
index 6847910211..0000000000
--- a/jpa/tests/org.eclipse.jpt.core.tests/src/org/eclipse/jpt/core/tests/internal/context/java/JavaBasicMappingTests.java
+++ /dev/null
@@ -1,978 +0,0 @@
-/*******************************************************************************
- * Copyright (c) 2007, 2009 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.
- *
- * Contributors:
- * Oracle - initial API and implementation
- ******************************************************************************/
-package org.eclipse.jpt.core.tests.internal.context.java;
-
-import java.util.Iterator;
-
-import org.eclipse.jdt.core.ICompilationUnit;
-import org.eclipse.jpt.core.JptCorePlugin;
-import org.eclipse.jpt.core.MappingKeys;
-import org.eclipse.jpt.core.context.AccessType;
-import org.eclipse.jpt.core.context.BasicMapping;
-import org.eclipse.jpt.core.context.Converter;
-import org.eclipse.jpt.core.context.EmbeddedIdMapping;
-import org.eclipse.jpt.core.context.EmbeddedMapping;
-import org.eclipse.jpt.core.context.EnumType;
-import org.eclipse.jpt.core.context.EnumeratedConverter;
-import org.eclipse.jpt.core.context.FetchType;
-import org.eclipse.jpt.core.context.IdMapping;
-import org.eclipse.jpt.core.context.ManyToManyMapping;
-import org.eclipse.jpt.core.context.ManyToOneMapping;
-import org.eclipse.jpt.core.context.OneToManyMapping;
-import org.eclipse.jpt.core.context.OneToOneMapping;
-import org.eclipse.jpt.core.context.PersistentAttribute;
-import org.eclipse.jpt.core.context.TemporalConverter;
-import org.eclipse.jpt.core.context.TemporalType;
-import org.eclipse.jpt.core.context.TransientMapping;
-import org.eclipse.jpt.core.context.VersionMapping;
-import org.eclipse.jpt.core.resource.java.BasicAnnotation;
-import org.eclipse.jpt.core.resource.java.ColumnAnnotation;
-import org.eclipse.jpt.core.resource.java.EmbeddedAnnotation;
-import org.eclipse.jpt.core.resource.java.EmbeddedIdAnnotation;
-import org.eclipse.jpt.core.resource.java.EnumeratedAnnotation;
-import org.eclipse.jpt.core.resource.java.IdAnnotation;
-import org.eclipse.jpt.core.resource.java.JPA;
-import org.eclipse.jpt.core.resource.java.JavaResourcePersistentAttribute;
-import org.eclipse.jpt.core.resource.java.JavaResourcePersistentType;
-import org.eclipse.jpt.core.resource.java.LobAnnotation;
-import org.eclipse.jpt.core.resource.java.ManyToOneAnnotation;
-import org.eclipse.jpt.core.resource.java.OneToOneAnnotation;
-import org.eclipse.jpt.core.resource.java.TemporalAnnotation;
-import org.eclipse.jpt.core.resource.java.TransientAnnotation;
-import org.eclipse.jpt.core.resource.java.VersionAnnotation;
-import org.eclipse.jpt.core.resource.persistence.PersistenceFactory;
-import org.eclipse.jpt.core.resource.persistence.XmlMappingFileRef;
-import org.eclipse.jpt.core.tests.internal.context.ContextModelTestCase;
-import org.eclipse.jpt.utility.internal.iterators.ArrayIterator;
-
-@SuppressWarnings("nls")
-public class JavaBasicMappingTests extends ContextModelTestCase
-{
-
- private ICompilationUnit createTestEntity() 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");
- }
- });
- }
-
- private ICompilationUnit createTestEntityWithBasicMapping() throws Exception {
- return this.createTestType(new DefaultAnnotationWriter() {
- @Override
- public Iterator<String> imports() {
- return new ArrayIterator<String>(JPA.ENTITY, JPA.BASIC);
- }
- @Override
- public void appendTypeAnnotationTo(StringBuilder sb) {
- sb.append("@Entity").append(CR);
- }
-
- @Override
- public void appendIdFieldAnnotationTo(StringBuilder sb) {
- sb.append("@Basic").append(CR);
- }
- });
- }
- private ICompilationUnit createTestEntityWithBasicMappingFetchOptionalSpecified() throws Exception {
- return this.createTestType(new DefaultAnnotationWriter() {
- @Override
- public Iterator<String> imports() {
- return new ArrayIterator<String>(JPA.ENTITY, JPA.BASIC, JPA.FETCH_TYPE);
- }
- @Override
- public void appendTypeAnnotationTo(StringBuilder sb) {
- sb.append("@Entity").append(CR);
- }
-
- @Override
- public void appendIdFieldAnnotationTo(StringBuilder sb) {
- sb.append("@Basic(fetch=FetchType.EAGER, optional=false)").append(CR);
- }
- });
- }
-
- private ICompilationUnit createTestEntityWithLob() throws Exception {
- return this.createTestType(new DefaultAnnotationWriter() {
- @Override
- public Iterator<String> imports() {
- return new ArrayIterator<String>(JPA.ENTITY, JPA.LOB);
- }
- @Override
- public void appendTypeAnnotationTo(StringBuilder sb) {
- sb.append("@Entity").append(CR);
- }
-
- @Override
- public void appendIdFieldAnnotationTo(StringBuilder sb) {
- sb.append("@Lob").append(CR);
- }
- });
- }
-
- private ICompilationUnit createTestEntityWithEnumerated() throws Exception {
- return this.createTestType(new DefaultAnnotationWriter() {
- @Override
- public Iterator<String> imports() {
- return new ArrayIterator<String>(JPA.ENTITY, JPA.ENUMERATED, JPA.ENUM_TYPE);
- }
- @Override
- public void appendTypeAnnotationTo(StringBuilder sb) {
- sb.append("@Entity").append(CR);
- }
-
- @Override
- public void appendIdFieldAnnotationTo(StringBuilder sb) {
- sb.append("@Enumerated(EnumType.STRING)").append(CR);
- }
- });
- }
-
- private ICompilationUnit createTestEntityWithTemporal() throws Exception {
- return this.createTestType(new DefaultAnnotationWriter() {
- @Override
- public Iterator<String> imports() {
- return new ArrayIterator<String>(JPA.ENTITY, JPA.TEMPORAL, JPA.TEMPORAL_TYPE);
- }
- @Override
- public void appendTypeAnnotationTo(StringBuilder sb) {
- sb.append("@Entity").append(CR);
- }
-
- @Override
- public void appendIdFieldAnnotationTo(StringBuilder sb) {
- sb.append("@Temporal(TemporalType.TIMESTAMP)").append(CR);
- }
- });
- }
-
- public JavaBasicMappingTests(String name) {
- super(name);
- }
-
- public void testDefaultBasicGetDefaultFetch() throws Exception {
- createTestEntity();
- addXmlClassRef(FULLY_QUALIFIED_TYPE_NAME);
-
- PersistentAttribute persistentAttribute = getJavaPersistentType().attributes().next();
- BasicMapping basicMapping = (BasicMapping) persistentAttribute.getMapping();
- assertEquals(FetchType.EAGER, basicMapping.getDefaultFetch());
- }
-
- public void testSpecifiedBasicGetDefaultFetch() throws Exception {
- createTestEntityWithBasicMapping();
- addXmlClassRef(FULLY_QUALIFIED_TYPE_NAME);
-
- PersistentAttribute persistentAttribute = getJavaPersistentType().attributes().next();
- BasicMapping basicMapping = (BasicMapping) persistentAttribute.getSpecifiedMapping();
- assertEquals(FetchType.EAGER, basicMapping.getDefaultFetch());
- }
-
- public void testGetFetch() throws Exception {
- createTestEntityWithBasicMapping();
- addXmlClassRef(FULLY_QUALIFIED_TYPE_NAME);
-
- PersistentAttribute persistentAttribute = getJavaPersistentType().attributes().next();
- BasicMapping basicMapping = (BasicMapping) persistentAttribute.getSpecifiedMapping();
-
- assertEquals(FetchType.EAGER, basicMapping.getFetch());
-
- basicMapping.setSpecifiedFetch(FetchType.LAZY);
- assertEquals(FetchType.LAZY, basicMapping.getFetch());
- }
-
- public void testGetSpecifiedFetch() throws Exception {
- createTestEntityWithBasicMapping();
- addXmlClassRef(FULLY_QUALIFIED_TYPE_NAME);
-
- PersistentAttribute persistentAttribute = getJavaPersistentType().attributes().next();
- BasicMapping basicMapping = (BasicMapping) persistentAttribute.getSpecifiedMapping();
-
- assertNull(basicMapping.getSpecifiedFetch());
-
-
- JavaResourcePersistentType typeResource = getJpaProject().getJavaResourcePersistentType(FULLY_QUALIFIED_TYPE_NAME);
- JavaResourcePersistentAttribute attributeResource = typeResource.persistableAttributes().next();
- BasicAnnotation basic = (BasicAnnotation) attributeResource.getMappingAnnotation(JPA.BASIC);
- basic.setFetch(org.eclipse.jpt.core.resource.java.FetchType.LAZY);
-
- assertEquals(FetchType.LAZY, basicMapping.getSpecifiedFetch());
- }
-
- public void testGetSpecifiedFetch2() throws Exception {
- createTestEntityWithBasicMappingFetchOptionalSpecified();
- addXmlClassRef(FULLY_QUALIFIED_TYPE_NAME);
-
- PersistentAttribute persistentAttribute = getJavaPersistentType().attributes().next();
- BasicMapping basicMapping = (BasicMapping) persistentAttribute.getSpecifiedMapping();
-
- assertEquals(FetchType.EAGER, basicMapping.getSpecifiedFetch());
- }
-
- public void testSetSpecifiedFetch() throws Exception {
- createTestEntityWithBasicMapping();
- addXmlClassRef(FULLY_QUALIFIED_TYPE_NAME);
-
- PersistentAttribute persistentAttribute = getJavaPersistentType().attributes().next();
- BasicMapping basicMapping = (BasicMapping) persistentAttribute.getSpecifiedMapping();
- assertNull(basicMapping.getSpecifiedFetch());
-
- basicMapping.setSpecifiedFetch(FetchType.LAZY);
-
- JavaResourcePersistentType typeResource = getJpaProject().getJavaResourcePersistentType(FULLY_QUALIFIED_TYPE_NAME);
- JavaResourcePersistentAttribute attributeResource = typeResource.persistableAttributes().next();
- BasicAnnotation basic = (BasicAnnotation) attributeResource.getMappingAnnotation(JPA.BASIC);
-
- assertEquals(org.eclipse.jpt.core.resource.java.FetchType.LAZY, basic.getFetch());
-
- basicMapping.setSpecifiedFetch(null);
- assertNotNull(attributeResource.getMappingAnnotation(JPA.BASIC));
- }
-
- public void testSetSpecifiedFetch2() throws Exception {
- createTestEntity();
- addXmlClassRef(FULLY_QUALIFIED_TYPE_NAME);
-
- createOrmXmlFile();
- getEntityMappings().getPersistenceUnitMetadata().getPersistenceUnitDefaults().setAccess(AccessType.PROPERTY);
- PersistentAttribute persistentAttribute = getJavaPersistentType().attributes().next();
- BasicMapping basicMapping = (BasicMapping) persistentAttribute.getMapping();
- assertNull(basicMapping.getSpecifiedFetch());
- assertTrue(basicMapping.isDefault());
-
- basicMapping.setSpecifiedFetch(FetchType.LAZY);
-
- JavaResourcePersistentType typeResource = getJpaProject().getJavaResourcePersistentType(FULLY_QUALIFIED_TYPE_NAME);
- JavaResourcePersistentAttribute attributeResource = typeResource.persistableProperties().next();
- BasicAnnotation basic = (BasicAnnotation) attributeResource.getMappingAnnotation(JPA.BASIC);
-
- assertEquals(org.eclipse.jpt.core.resource.java.FetchType.LAZY, basic.getFetch());
-
- basicMapping = (BasicMapping) persistentAttribute.getMapping();
- assertEquals(FetchType.LAZY, basicMapping.getSpecifiedFetch());
- assertFalse(basicMapping.isDefault());
-
- basicMapping.setSpecifiedFetch(null);
- assertNotNull(attributeResource.getMappingAnnotation(JPA.BASIC));
-
- basicMapping = (BasicMapping) persistentAttribute.getMapping();
- assertFalse(basicMapping.isDefault());
- }
-
- protected void createOrmXmlFile() throws Exception {
- XmlMappingFileRef mappingFileRef = PersistenceFactory.eINSTANCE.createXmlMappingFileRef();
- mappingFileRef.setFileName(JptCorePlugin.DEFAULT_ORM_XML_FILE_PATH);
- getXmlPersistenceUnit().getMappingFiles().add(mappingFileRef);
- getPersistenceXmlResource().save(null);
- }
-
- public void testSetBasicRemovedFromResourceModel() throws Exception {
- createTestEntityWithBasicMapping();
- addXmlClassRef(FULLY_QUALIFIED_TYPE_NAME);
-
- PersistentAttribute persistentAttribute = getJavaPersistentType().attributes().next();
- BasicMapping basicMapping = (BasicMapping) persistentAttribute.getMapping();
- JavaResourcePersistentType typeResource = getJpaProject().getJavaResourcePersistentType(FULLY_QUALIFIED_TYPE_NAME);
- JavaResourcePersistentAttribute attributeResource = typeResource.persistableAttributes().next();
- assertFalse(basicMapping.isDefault());
- basicMapping.getColumn().setSpecifiedName("FOO");
- attributeResource.addSupportingAnnotation(TemporalAnnotation.ANNOTATION_NAME);
- attributeResource.addSupportingAnnotation(LobAnnotation.ANNOTATION_NAME);
- attributeResource.addSupportingAnnotation(EnumeratedAnnotation.ANNOTATION_NAME);
- assertFalse(basicMapping.isDefault());
-
- attributeResource.setMappingAnnotation(null);
-
- assertNotSame(basicMapping, persistentAttribute.getMapping());
-
- basicMapping = (BasicMapping) persistentAttribute.getMapping();
- assertTrue(basicMapping.isDefault());
- assertEquals("FOO", basicMapping.getColumn().getSpecifiedName());
-
-
- assertNotNull(attributeResource.getSupportingAnnotation(ColumnAnnotation.ANNOTATION_NAME));
- assertNotNull(attributeResource.getSupportingAnnotation(TemporalAnnotation.ANNOTATION_NAME));
- assertNotNull(attributeResource.getSupportingAnnotation(LobAnnotation.ANNOTATION_NAME));
- assertNotNull(attributeResource.getSupportingAnnotation(EnumeratedAnnotation.ANNOTATION_NAME));
- }
-
- public void testBasicMorphToDefaultBasic() throws Exception {
- createTestEntityWithBasicMapping();
- addXmlClassRef(FULLY_QUALIFIED_TYPE_NAME);
-
- PersistentAttribute persistentAttribute = getJavaPersistentType().attributes().next();
- BasicMapping basicMapping = (BasicMapping) persistentAttribute.getMapping();
- JavaResourcePersistentType typeResource = getJpaProject().getJavaResourcePersistentType(FULLY_QUALIFIED_TYPE_NAME);
- JavaResourcePersistentAttribute attributeResource = typeResource.persistableAttributes().next();
- assertFalse(basicMapping.isDefault());
- basicMapping.getColumn().setSpecifiedName("FOO");
- basicMapping.setSpecifiedConverter(Converter.ENUMERATED_CONVERTER);
- ((EnumeratedConverter) basicMapping.getSpecifiedConverter()).setSpecifiedEnumType(EnumType.STRING);
- attributeResource.addSupportingAnnotation(LobAnnotation.ANNOTATION_NAME);
- attributeResource.addSupportingAnnotation(TemporalAnnotation.ANNOTATION_NAME);
- basicMapping.setSpecifiedFetch(FetchType.EAGER);
- basicMapping.setSpecifiedOptional(Boolean.FALSE);
- assertFalse(basicMapping.isDefault());
-
- persistentAttribute.setSpecifiedMappingKey(MappingKeys.NULL_ATTRIBUTE_MAPPING_KEY);
- assertEquals("FOO", ((BasicMapping) persistentAttribute.getMapping()).getColumn().getSpecifiedName());
- assertEquals(EnumType.STRING, ((EnumeratedConverter) ((BasicMapping) persistentAttribute.getMapping()).getSpecifiedConverter()).getEnumType());
-
- assertNull(((BasicMapping) persistentAttribute.getMapping()).getSpecifiedFetch());
- assertNull(((BasicMapping) persistentAttribute.getMapping()).getSpecifiedOptional());
- assertNull(attributeResource.getMappingAnnotation(BasicAnnotation.ANNOTATION_NAME));
- assertNotNull(attributeResource.getSupportingAnnotation(ColumnAnnotation.ANNOTATION_NAME));
- assertNotNull(attributeResource.getSupportingAnnotation(TemporalAnnotation.ANNOTATION_NAME));
- assertNotNull(attributeResource.getSupportingAnnotation(LobAnnotation.ANNOTATION_NAME));
- assertNotNull(attributeResource.getSupportingAnnotation(EnumeratedAnnotation.ANNOTATION_NAME));
- }
-
- public void testBasicMorphToId() throws Exception {
- createTestEntityWithBasicMapping();
- addXmlClassRef(FULLY_QUALIFIED_TYPE_NAME);
-
- PersistentAttribute persistentAttribute = getJavaPersistentType().attributes().next();
- BasicMapping basicMapping = (BasicMapping) persistentAttribute.getMapping();
- JavaResourcePersistentType typeResource = getJpaProject().getJavaResourcePersistentType(FULLY_QUALIFIED_TYPE_NAME);
- JavaResourcePersistentAttribute attributeResource = typeResource.persistableAttributes().next();
- assertFalse(basicMapping.isDefault());
- basicMapping.getColumn().setSpecifiedName("FOO");
- basicMapping.setSpecifiedConverter(Converter.TEMPORAL_CONVERTER);
- ((TemporalConverter) basicMapping.getSpecifiedConverter()).setTemporalType(TemporalType.TIME);
- attributeResource.addSupportingAnnotation(LobAnnotation.ANNOTATION_NAME);
- attributeResource.addSupportingAnnotation(EnumeratedAnnotation.ANNOTATION_NAME);
- basicMapping.setSpecifiedFetch(FetchType.EAGER);
- basicMapping.setSpecifiedOptional(Boolean.FALSE);
- assertFalse(basicMapping.isDefault());
-
- persistentAttribute.setSpecifiedMappingKey(MappingKeys.ID_ATTRIBUTE_MAPPING_KEY);
- assertEquals("FOO", ((IdMapping) persistentAttribute.getMapping()).getColumn().getSpecifiedName());
- assertEquals(TemporalType.TIME, ((TemporalConverter) ((IdMapping) persistentAttribute.getMapping()).getSpecifiedConverter()).getTemporalType());
-
- assertNull(attributeResource.getMappingAnnotation(BasicAnnotation.ANNOTATION_NAME));
- assertNotNull(attributeResource.getMappingAnnotation(IdAnnotation.ANNOTATION_NAME));
- assertNotNull(attributeResource.getSupportingAnnotation(ColumnAnnotation.ANNOTATION_NAME));
- assertNotNull(attributeResource.getSupportingAnnotation(TemporalAnnotation.ANNOTATION_NAME));
- assertNull(attributeResource.getSupportingAnnotation(LobAnnotation.ANNOTATION_NAME));
- assertNull(attributeResource.getSupportingAnnotation(EnumeratedAnnotation.ANNOTATION_NAME));
- }
-
- public void testBasicMorphToVersion() throws Exception {
- createTestEntityWithBasicMapping();
- addXmlClassRef(FULLY_QUALIFIED_TYPE_NAME);
-
- PersistentAttribute persistentAttribute = getJavaPersistentType().attributes().next();
- BasicMapping basicMapping = (BasicMapping) persistentAttribute.getMapping();
- JavaResourcePersistentType typeResource = getJpaProject().getJavaResourcePersistentType(FULLY_QUALIFIED_TYPE_NAME);
- JavaResourcePersistentAttribute attributeResource = typeResource.persistableAttributes().next();
- assertFalse(basicMapping.isDefault());
- basicMapping.getColumn().setSpecifiedName("FOO");
- basicMapping.setSpecifiedConverter(Converter.TEMPORAL_CONVERTER);
- ((TemporalConverter) basicMapping.getSpecifiedConverter()).setTemporalType(TemporalType.TIME);
- attributeResource.addSupportingAnnotation(LobAnnotation.ANNOTATION_NAME);
- attributeResource.addSupportingAnnotation(EnumeratedAnnotation.ANNOTATION_NAME);
- assertFalse(basicMapping.isDefault());
-
- persistentAttribute.setSpecifiedMappingKey(MappingKeys.VERSION_ATTRIBUTE_MAPPING_KEY);
- assertEquals("FOO", ((VersionMapping) persistentAttribute.getMapping()).getColumn().getSpecifiedName());
- assertEquals(TemporalType.TIME, ((TemporalConverter) ((VersionMapping) persistentAttribute.getMapping()).getSpecifiedConverter()).getTemporalType());
-
- assertNull(attributeResource.getMappingAnnotation(BasicAnnotation.ANNOTATION_NAME));
- assertNotNull(attributeResource.getMappingAnnotation(VersionAnnotation.ANNOTATION_NAME));
- assertNotNull(attributeResource.getSupportingAnnotation(ColumnAnnotation.ANNOTATION_NAME));
- assertNotNull(attributeResource.getSupportingAnnotation(TemporalAnnotation.ANNOTATION_NAME));
- assertNull(attributeResource.getSupportingAnnotation(LobAnnotation.ANNOTATION_NAME));
- assertNull(attributeResource.getSupportingAnnotation(EnumeratedAnnotation.ANNOTATION_NAME));
- }
-
- public void testBasicMorphToEmbedded() throws Exception {
- createTestEntityWithBasicMapping();
- addXmlClassRef(FULLY_QUALIFIED_TYPE_NAME);
-
- PersistentAttribute persistentAttribute = getJavaPersistentType().attributes().next();
- BasicMapping basicMapping = (BasicMapping) persistentAttribute.getMapping();
- JavaResourcePersistentType typeResource = getJpaProject().getJavaResourcePersistentType(FULLY_QUALIFIED_TYPE_NAME);
- JavaResourcePersistentAttribute attributeResource = typeResource.persistableAttributes().next();
- assertFalse(basicMapping.isDefault());
- basicMapping.getColumn().setSpecifiedName("FOO");
- attributeResource.addSupportingAnnotation(TemporalAnnotation.ANNOTATION_NAME);
- attributeResource.addSupportingAnnotation(LobAnnotation.ANNOTATION_NAME);
- attributeResource.addSupportingAnnotation(EnumeratedAnnotation.ANNOTATION_NAME);
- assertFalse(basicMapping.isDefault());
-
- persistentAttribute.setSpecifiedMappingKey(MappingKeys.EMBEDDED_ATTRIBUTE_MAPPING_KEY);
- assertTrue(persistentAttribute.getMapping() instanceof EmbeddedMapping);
-
- assertNull(attributeResource.getMappingAnnotation(BasicAnnotation.ANNOTATION_NAME));
- assertNotNull(attributeResource.getMappingAnnotation(EmbeddedAnnotation.ANNOTATION_NAME));
- assertNull(attributeResource.getSupportingAnnotation(ColumnAnnotation.ANNOTATION_NAME));
- assertNull(attributeResource.getSupportingAnnotation(TemporalAnnotation.ANNOTATION_NAME));
- assertNull(attributeResource.getSupportingAnnotation(LobAnnotation.ANNOTATION_NAME));
- assertNull(attributeResource.getSupportingAnnotation(EnumeratedAnnotation.ANNOTATION_NAME));
- }
-
- public void testBasicMorphToEmbeddedId() throws Exception {
- createTestEntityWithBasicMapping();
- addXmlClassRef(FULLY_QUALIFIED_TYPE_NAME);
-
- PersistentAttribute persistentAttribute = getJavaPersistentType().attributes().next();
- BasicMapping basicMapping = (BasicMapping) persistentAttribute.getMapping();
- JavaResourcePersistentType typeResource = getJpaProject().getJavaResourcePersistentType(FULLY_QUALIFIED_TYPE_NAME);
- JavaResourcePersistentAttribute attributeResource = typeResource.persistableAttributes().next();
- assertFalse(basicMapping.isDefault());
- basicMapping.getColumn().setSpecifiedName("FOO");
- attributeResource.addSupportingAnnotation(TemporalAnnotation.ANNOTATION_NAME);
- attributeResource.addSupportingAnnotation(LobAnnotation.ANNOTATION_NAME);
- attributeResource.addSupportingAnnotation(EnumeratedAnnotation.ANNOTATION_NAME);
- assertFalse(basicMapping.isDefault());
-
- persistentAttribute.setSpecifiedMappingKey(MappingKeys.EMBEDDED_ID_ATTRIBUTE_MAPPING_KEY);
- assertTrue(persistentAttribute.getMapping() instanceof EmbeddedIdMapping);
-
- assertNull(attributeResource.getMappingAnnotation(BasicAnnotation.ANNOTATION_NAME));
- assertNotNull(attributeResource.getMappingAnnotation(EmbeddedIdAnnotation.ANNOTATION_NAME));
- assertNull(attributeResource.getSupportingAnnotation(ColumnAnnotation.ANNOTATION_NAME));
- assertNull(attributeResource.getSupportingAnnotation(TemporalAnnotation.ANNOTATION_NAME));
- assertNull(attributeResource.getSupportingAnnotation(LobAnnotation.ANNOTATION_NAME));
- assertNull(attributeResource.getSupportingAnnotation(EnumeratedAnnotation.ANNOTATION_NAME));
- }
-
- public void testBasicMorphToTransient() throws Exception {
- createTestEntityWithBasicMapping();
- addXmlClassRef(FULLY_QUALIFIED_TYPE_NAME);
-
- PersistentAttribute persistentAttribute = getJavaPersistentType().attributes().next();
- BasicMapping basicMapping = (BasicMapping) persistentAttribute.getMapping();
- JavaResourcePersistentType typeResource = getJpaProject().getJavaResourcePersistentType(FULLY_QUALIFIED_TYPE_NAME);
- JavaResourcePersistentAttribute attributeResource = typeResource.persistableAttributes().next();
- assertFalse(basicMapping.isDefault());
- basicMapping.getColumn().setSpecifiedName("FOO");
- attributeResource.addSupportingAnnotation(TemporalAnnotation.ANNOTATION_NAME);
- attributeResource.addSupportingAnnotation(LobAnnotation.ANNOTATION_NAME);
- attributeResource.addSupportingAnnotation(EnumeratedAnnotation.ANNOTATION_NAME);
- assertFalse(basicMapping.isDefault());
-
- persistentAttribute.setSpecifiedMappingKey(MappingKeys.TRANSIENT_ATTRIBUTE_MAPPING_KEY);
- assertTrue(persistentAttribute.getMapping() instanceof TransientMapping);
-
- assertNull(attributeResource.getMappingAnnotation(BasicAnnotation.ANNOTATION_NAME));
- assertNotNull(attributeResource.getMappingAnnotation(TransientAnnotation.ANNOTATION_NAME));
- assertNull(attributeResource.getSupportingAnnotation(ColumnAnnotation.ANNOTATION_NAME));
- assertNull(attributeResource.getSupportingAnnotation(TemporalAnnotation.ANNOTATION_NAME));
- assertNull(attributeResource.getSupportingAnnotation(LobAnnotation.ANNOTATION_NAME));
- assertNull(attributeResource.getSupportingAnnotation(EnumeratedAnnotation.ANNOTATION_NAME));
- }
-
- public void testBasicMorphToOneToOne() throws Exception {
- createTestEntityWithBasicMapping();
- addXmlClassRef(FULLY_QUALIFIED_TYPE_NAME);
-
- PersistentAttribute persistentAttribute = getJavaPersistentType().attributes().next();
- BasicMapping basicMapping = (BasicMapping) persistentAttribute.getMapping();
- JavaResourcePersistentType typeResource = getJpaProject().getJavaResourcePersistentType(FULLY_QUALIFIED_TYPE_NAME);
- JavaResourcePersistentAttribute attributeResource = typeResource.persistableAttributes().next();
- assertFalse(basicMapping.isDefault());
- basicMapping.getColumn().setSpecifiedName("FOO");
- attributeResource.addSupportingAnnotation(TemporalAnnotation.ANNOTATION_NAME);
- attributeResource.addSupportingAnnotation(LobAnnotation.ANNOTATION_NAME);
- attributeResource.addSupportingAnnotation(EnumeratedAnnotation.ANNOTATION_NAME);
- basicMapping.setSpecifiedFetch(FetchType.EAGER);
- basicMapping.setSpecifiedOptional(Boolean.FALSE);
- assertFalse(basicMapping.isDefault());
-
- persistentAttribute.setSpecifiedMappingKey(MappingKeys.ONE_TO_ONE_ATTRIBUTE_MAPPING_KEY);
- assertTrue(persistentAttribute.getMapping() instanceof OneToOneMapping);
-
-//TODO assertEquals(FetchType.EAGER, ((IOneToOneMapping) persistentAttribute.getMapping()).getSpecifiedFetch());
-// assertEquals(Boolean.FALSE, ((IOneToOneMapping) persistentAttribute.getMapping()).getSpecifiedOptional());
- assertNotNull(attributeResource.getMappingAnnotation(OneToOneAnnotation.ANNOTATION_NAME));
- assertNull(attributeResource.getMappingAnnotation(BasicAnnotation.ANNOTATION_NAME));
- assertNull(attributeResource.getSupportingAnnotation(ColumnAnnotation.ANNOTATION_NAME));
- assertNull(attributeResource.getSupportingAnnotation(TemporalAnnotation.ANNOTATION_NAME));
- assertNull(attributeResource.getSupportingAnnotation(LobAnnotation.ANNOTATION_NAME));
- assertNull(attributeResource.getSupportingAnnotation(EnumeratedAnnotation.ANNOTATION_NAME));
- }
-
- public void testBasicMorphToOneToMany() throws Exception {
- createTestEntityWithBasicMapping();
- addXmlClassRef(FULLY_QUALIFIED_TYPE_NAME);
-
- PersistentAttribute persistentAttribute = getJavaPersistentType().attributes().next();
- BasicMapping basicMapping = (BasicMapping) persistentAttribute.getMapping();
- JavaResourcePersistentType typeResource = getJpaProject().getJavaResourcePersistentType(FULLY_QUALIFIED_TYPE_NAME);
- JavaResourcePersistentAttribute attributeResource = typeResource.persistableAttributes().next();
- assertFalse(basicMapping.isDefault());
- basicMapping.getColumn().setSpecifiedName("FOO");
- attributeResource.addSupportingAnnotation(TemporalAnnotation.ANNOTATION_NAME);
- attributeResource.addSupportingAnnotation(LobAnnotation.ANNOTATION_NAME);
- attributeResource.addSupportingAnnotation(EnumeratedAnnotation.ANNOTATION_NAME);
- basicMapping.setSpecifiedFetch(FetchType.EAGER);
- basicMapping.setSpecifiedOptional(Boolean.FALSE);
- assertFalse(basicMapping.isDefault());
-
- persistentAttribute.setSpecifiedMappingKey(MappingKeys.ONE_TO_MANY_ATTRIBUTE_MAPPING_KEY);
- assertTrue(persistentAttribute.getMapping() instanceof OneToManyMapping);
-
-//TODO assertEquals(FetchType.EAGER, ((IOneToManyMapping) persistentAttribute.getMapping()).getSpecifiedFetch());
-// assertNotNull(attributeResource.mappingAnnotation(OneToMany.ANNOTATION_NAME));
- assertNull(attributeResource.getMappingAnnotation(BasicAnnotation.ANNOTATION_NAME));
- assertNull(attributeResource.getSupportingAnnotation(ColumnAnnotation.ANNOTATION_NAME));
- assertNull(attributeResource.getSupportingAnnotation(TemporalAnnotation.ANNOTATION_NAME));
- assertNull(attributeResource.getSupportingAnnotation(LobAnnotation.ANNOTATION_NAME));
- assertNull(attributeResource.getSupportingAnnotation(EnumeratedAnnotation.ANNOTATION_NAME));
- }
- public void testBasicMorphToManyToOne() throws Exception {
- createTestEntityWithBasicMapping();
- addXmlClassRef(FULLY_QUALIFIED_TYPE_NAME);
-
- PersistentAttribute persistentAttribute = getJavaPersistentType().attributes().next();
- BasicMapping basicMapping = (BasicMapping) persistentAttribute.getMapping();
- JavaResourcePersistentType typeResource = getJpaProject().getJavaResourcePersistentType(FULLY_QUALIFIED_TYPE_NAME);
- JavaResourcePersistentAttribute attributeResource = typeResource.persistableAttributes().next();
- assertFalse(basicMapping.isDefault());
- basicMapping.getColumn().setSpecifiedName("FOO");
- attributeResource.addSupportingAnnotation(TemporalAnnotation.ANNOTATION_NAME);
- attributeResource.addSupportingAnnotation(LobAnnotation.ANNOTATION_NAME);
- attributeResource.addSupportingAnnotation(EnumeratedAnnotation.ANNOTATION_NAME);
- basicMapping.setSpecifiedFetch(FetchType.EAGER);
- basicMapping.setSpecifiedOptional(Boolean.FALSE);
- assertFalse(basicMapping.isDefault());
-
- persistentAttribute.setSpecifiedMappingKey(MappingKeys.MANY_TO_ONE_ATTRIBUTE_MAPPING_KEY);
- assertTrue(persistentAttribute.getMapping() instanceof ManyToOneMapping);
-
-//TODO assertEquals(FetchType.EAGER, ((IManyToOneMapping) persistentAttribute.getMapping()).getSpecifiedFetch());
-// assertEquals(Boolean.FALSE, ((IManyToOneMapping) persistentAttribute.getMapping()).getSpecifiedOptional());
- assertNotNull(attributeResource.getMappingAnnotation(ManyToOneAnnotation.ANNOTATION_NAME));
- assertNull(attributeResource.getMappingAnnotation(BasicAnnotation.ANNOTATION_NAME));
- assertNull(attributeResource.getSupportingAnnotation(ColumnAnnotation.ANNOTATION_NAME));
- assertNull(attributeResource.getSupportingAnnotation(TemporalAnnotation.ANNOTATION_NAME));
- assertNull(attributeResource.getSupportingAnnotation(LobAnnotation.ANNOTATION_NAME));
- assertNull(attributeResource.getSupportingAnnotation(EnumeratedAnnotation.ANNOTATION_NAME));
- }
-
- public void testBasicMorphToManyToMany() throws Exception {
- createTestEntityWithBasicMapping();
- addXmlClassRef(FULLY_QUALIFIED_TYPE_NAME);
-
- PersistentAttribute persistentAttribute = getJavaPersistentType().attributes().next();
- BasicMapping basicMapping = (BasicMapping) persistentAttribute.getMapping();
- JavaResourcePersistentType typeResource = getJpaProject().getJavaResourcePersistentType(FULLY_QUALIFIED_TYPE_NAME);
- JavaResourcePersistentAttribute attributeResource = typeResource.persistableAttributes().next();
- assertFalse(basicMapping.isDefault());
- basicMapping.getColumn().setSpecifiedName("FOO");
- attributeResource.addSupportingAnnotation(TemporalAnnotation.ANNOTATION_NAME);
- attributeResource.addSupportingAnnotation(LobAnnotation.ANNOTATION_NAME);
- attributeResource.addSupportingAnnotation(EnumeratedAnnotation.ANNOTATION_NAME);
- basicMapping.setSpecifiedFetch(FetchType.EAGER);
- basicMapping.setSpecifiedOptional(Boolean.FALSE);
- assertFalse(basicMapping.isDefault());
-
- persistentAttribute.setSpecifiedMappingKey(MappingKeys.MANY_TO_MANY_ATTRIBUTE_MAPPING_KEY);
- assertTrue(persistentAttribute.getMapping() instanceof ManyToManyMapping);
-
-//TODO assertEquals(FetchType.EAGER, ((IManyToManyMapping) persistentAttribute.getMapping()).getSpecifiedFetch());
-// assertNotNull(attributeResource.mappingAnnotation(ManyToMany.ANNOTATION_NAME));
- assertNull(attributeResource.getMappingAnnotation(BasicAnnotation.ANNOTATION_NAME));
- assertNull(attributeResource.getSupportingAnnotation(ColumnAnnotation.ANNOTATION_NAME));
- assertNull(attributeResource.getSupportingAnnotation(TemporalAnnotation.ANNOTATION_NAME));
- assertNull(attributeResource.getSupportingAnnotation(LobAnnotation.ANNOTATION_NAME));
- assertNull(attributeResource.getSupportingAnnotation(EnumeratedAnnotation.ANNOTATION_NAME));
- }
-
- public void testDefaultBasicGetDefaultOptional() throws Exception {
- createTestEntity();
- addXmlClassRef(FULLY_QUALIFIED_TYPE_NAME);
-
- PersistentAttribute persistentAttribute = getJavaPersistentType().attributes().next();
- BasicMapping basicMapping = (BasicMapping) persistentAttribute.getMapping();
- assertEquals(true, basicMapping.isDefaultOptional());
- }
-
- public void testSpecifiedBasicGetDefaultOptional() throws Exception {
- createTestEntityWithBasicMapping();
- addXmlClassRef(FULLY_QUALIFIED_TYPE_NAME);
-
- PersistentAttribute persistentAttribute = getJavaPersistentType().attributes().next();
- BasicMapping basicMapping = (BasicMapping) persistentAttribute.getSpecifiedMapping();
- assertEquals(true, basicMapping.isDefaultOptional());
- }
-
- public void testGetOptional() throws Exception {
- createTestEntityWithBasicMapping();
- addXmlClassRef(FULLY_QUALIFIED_TYPE_NAME);
-
- PersistentAttribute persistentAttribute = getJavaPersistentType().attributes().next();
- BasicMapping basicMapping = (BasicMapping) persistentAttribute.getSpecifiedMapping();
-
- assertEquals(true, basicMapping.isOptional());
-
- basicMapping.setSpecifiedOptional(Boolean.TRUE);
- assertEquals(true, basicMapping.isOptional());
- }
-
- public void testGetSpecifiedOptional() throws Exception {
- createTestEntityWithBasicMapping();
- addXmlClassRef(FULLY_QUALIFIED_TYPE_NAME);
-
- PersistentAttribute persistentAttribute = getJavaPersistentType().attributes().next();
- BasicMapping basicMapping = (BasicMapping) persistentAttribute.getSpecifiedMapping();
-
- assertNull(basicMapping.getSpecifiedOptional());
-
-
- JavaResourcePersistentType typeResource = getJpaProject().getJavaResourcePersistentType(FULLY_QUALIFIED_TYPE_NAME);
- JavaResourcePersistentAttribute attributeResource = typeResource.persistableAttributes().next();
- BasicAnnotation basic = (BasicAnnotation) attributeResource.getMappingAnnotation(JPA.BASIC);
- basic.setOptional(Boolean.FALSE);
-
- assertEquals(Boolean.FALSE, basicMapping.getSpecifiedOptional());
- }
-
- public void testGetSpecifiedOptional2() throws Exception {
- createTestEntityWithBasicMappingFetchOptionalSpecified();
- addXmlClassRef(FULLY_QUALIFIED_TYPE_NAME);
-
- PersistentAttribute persistentAttribute = getJavaPersistentType().attributes().next();
- BasicMapping basicMapping = (BasicMapping) persistentAttribute.getSpecifiedMapping();
-
- assertEquals(Boolean.FALSE, basicMapping.getSpecifiedOptional());
- }
-
- public void testSetSpecifiedOptional() throws Exception {
- createTestEntityWithBasicMapping();
- addXmlClassRef(FULLY_QUALIFIED_TYPE_NAME);
-
- PersistentAttribute persistentAttribute = getJavaPersistentType().attributes().next();
- BasicMapping basicMapping = (BasicMapping) persistentAttribute.getSpecifiedMapping();
- assertNull(basicMapping.getSpecifiedOptional());
-
- basicMapping.setSpecifiedOptional(Boolean.FALSE);
-
- JavaResourcePersistentType typeResource = getJpaProject().getJavaResourcePersistentType(FULLY_QUALIFIED_TYPE_NAME);
- JavaResourcePersistentAttribute attributeResource = typeResource.persistableAttributes().next();
- BasicAnnotation basic = (BasicAnnotation) attributeResource.getMappingAnnotation(JPA.BASIC);
-
- assertEquals(Boolean.FALSE, basic.getOptional());
-
- basicMapping.setSpecifiedOptional(null);
- assertNotNull(attributeResource.getMappingAnnotation(JPA.BASIC));
- }
-
- public void testSetSpecifiedOptional2() throws Exception {
- createTestEntity();
- addXmlClassRef(FULLY_QUALIFIED_TYPE_NAME);
-
- PersistentAttribute persistentAttribute = getJavaPersistentType().attributes().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.getMappingAnnotation(JPA.BASIC);
-
- assertEquals(Boolean.TRUE, basic.getOptional());
-
- basicMapping = (BasicMapping) persistentAttribute.getMapping();
- assertEquals(Boolean.TRUE, basicMapping.getSpecifiedOptional());
- assertFalse(basicMapping.isDefault());
-
- basicMapping.setSpecifiedOptional(null);
- assertNotNull(attributeResource.getMappingAnnotation(JPA.BASIC));
-
- basicMapping = (BasicMapping) persistentAttribute.getMapping();
- assertFalse(basicMapping.isDefault());
- }
-
-
- public void testGetSpecifiedOptionalUpdatesFromResourceModelChange() throws Exception {
- createTestEntityWithBasicMapping();
- addXmlClassRef(FULLY_QUALIFIED_TYPE_NAME);
-
- PersistentAttribute persistentAttribute = getJavaPersistentType().attributes().next();
- BasicMapping basicMapping = (BasicMapping) persistentAttribute.getSpecifiedMapping();
-
- assertNull(basicMapping.getSpecifiedOptional());
-
-
- JavaResourcePersistentType typeResource = getJpaProject().getJavaResourcePersistentType(FULLY_QUALIFIED_TYPE_NAME);
- JavaResourcePersistentAttribute attributeResource = typeResource.persistableAttributes().next();
- BasicAnnotation basic = (BasicAnnotation) attributeResource.getMappingAnnotation(JPA.BASIC);
- basic.setOptional(Boolean.FALSE);
-
- assertEquals(Boolean.FALSE, basicMapping.getSpecifiedOptional());
-
- basic.setOptional(null);
- assertNull(basicMapping.getSpecifiedOptional());
- assertFalse(basicMapping.isDefault());
- assertSame(basicMapping, persistentAttribute.getSpecifiedMapping());
-
- basic.setOptional(Boolean.FALSE);
- attributeResource.setMappingAnnotation(null);
-
- assertNull(persistentAttribute.getSpecifiedMapping());
- assertEquals(true, ((BasicMapping) persistentAttribute.getMapping()).isOptional());
- }
-
-
- public void testIsLob() throws Exception {
- createTestEntityWithBasicMapping();
- addXmlClassRef(FULLY_QUALIFIED_TYPE_NAME);
-
- PersistentAttribute persistentAttribute = getJavaPersistentType().attributes().next();
- BasicMapping basicMapping = (BasicMapping) persistentAttribute.getSpecifiedMapping();
-
- assertFalse(basicMapping.getConverter().getType() == Converter.LOB_CONVERTER);
- }
-
- public void testIsLob2() throws Exception {
- createTestEntityWithLob();
- addXmlClassRef(FULLY_QUALIFIED_TYPE_NAME);
-
- PersistentAttribute persistentAttribute = getJavaPersistentType().attributes().next();
- BasicMapping basicMapping = (BasicMapping) persistentAttribute.getMapping();
-
- assertTrue(basicMapping.getConverter().getType() == Converter.LOB_CONVERTER);
- }
-
- public void testSetLob() throws Exception {
- createTestEntityWithBasicMapping();
- addXmlClassRef(FULLY_QUALIFIED_TYPE_NAME);
-
- PersistentAttribute persistentAttribute = getJavaPersistentType().attributes().next();
- BasicMapping basicMapping = (BasicMapping) persistentAttribute.getSpecifiedMapping();
-
- basicMapping.setSpecifiedConverter(Converter.LOB_CONVERTER);
-
- JavaResourcePersistentType typeResource = getJpaProject().getJavaResourcePersistentType(FULLY_QUALIFIED_TYPE_NAME);
- JavaResourcePersistentAttribute attributeResource = typeResource.persistableAttributes().next();
- assertNotNull(attributeResource.getSupportingAnnotation(LobAnnotation.ANNOTATION_NAME));
-
- basicMapping.setSpecifiedConverter(null);
- assertNull(attributeResource.getSupportingAnnotation(LobAnnotation.ANNOTATION_NAME));
- }
-
- public void testIsLobUpdatesFromResourceModelChange() throws Exception {
- createTestEntityWithBasicMapping();
- addXmlClassRef(FULLY_QUALIFIED_TYPE_NAME);
-
- PersistentAttribute persistentAttribute = getJavaPersistentType().attributes().next();
- BasicMapping basicMapping = (BasicMapping) persistentAttribute.getSpecifiedMapping();
-
- assertFalse(basicMapping.getConverter().getType() == Converter.LOB_CONVERTER);
-
- JavaResourcePersistentType typeResource = getJpaProject().getJavaResourcePersistentType(FULLY_QUALIFIED_TYPE_NAME);
- JavaResourcePersistentAttribute attributeResource = typeResource.persistableAttributes().next();
- attributeResource.addSupportingAnnotation(LobAnnotation.ANNOTATION_NAME);
-
- assertTrue(basicMapping.getConverter().getType() == Converter.LOB_CONVERTER);
-
- attributeResource.removeSupportingAnnotation(LobAnnotation.ANNOTATION_NAME);
-
- assertFalse(basicMapping.getConverter().getType() == Converter.LOB_CONVERTER);
- }
-
- public void testDefaultBasicGetDefaultConverter() throws Exception {
- createTestEntity();
- addXmlClassRef(FULLY_QUALIFIED_TYPE_NAME);
-
- PersistentAttribute persistentAttribute = getJavaPersistentType().attributes().next();
- BasicMapping basicMapping = (BasicMapping) persistentAttribute.getMapping();
- assertTrue(basicMapping.getConverter().getType() == Converter.NO_CONVERTER);
- }
-
- public void testSpecifiedBasicGetDefaultConverter() throws Exception {
- createTestEntityWithBasicMapping();
- addXmlClassRef(FULLY_QUALIFIED_TYPE_NAME);
-
- PersistentAttribute persistentAttribute = getJavaPersistentType().attributes().next();
- BasicMapping basicMapping = (BasicMapping) persistentAttribute.getSpecifiedMapping();
- assertTrue(basicMapping.getConverter().getType() == Converter.NO_CONVERTER);
- }
-
- public void testGetEnumerated() throws Exception {
- createTestEntityWithBasicMapping();
- addXmlClassRef(FULLY_QUALIFIED_TYPE_NAME);
-
- PersistentAttribute persistentAttribute = getJavaPersistentType().attributes().next();
- BasicMapping basicMapping = (BasicMapping) persistentAttribute.getSpecifiedMapping();
-
- assertTrue(basicMapping.getConverter().getType() == Converter.NO_CONVERTER);
-
- JavaResourcePersistentType typeResource = getJpaProject().getJavaResourcePersistentType(FULLY_QUALIFIED_TYPE_NAME);
- JavaResourcePersistentAttribute attributeResource = typeResource.persistableAttributes().next();
- EnumeratedAnnotation enumeratedAnnotation = (EnumeratedAnnotation) attributeResource.addSupportingAnnotation(EnumeratedAnnotation.ANNOTATION_NAME);
- assertEquals(EnumType.ORDINAL, ((EnumeratedConverter) basicMapping.getConverter()).getDefaultEnumType());
-
- enumeratedAnnotation.setValue(org.eclipse.jpt.core.resource.java.EnumType.STRING);
- assertEquals(EnumType.STRING, ((EnumeratedConverter) basicMapping.getConverter()).getSpecifiedEnumType());
- }
-
- public void testGetSpecifiedEnumerated() throws Exception {
- createTestEntityWithEnumerated();
- addXmlClassRef(FULLY_QUALIFIED_TYPE_NAME);
-
- PersistentAttribute persistentAttribute = getJavaPersistentType().attributes().next();
- BasicMapping basicMapping = (BasicMapping) persistentAttribute.getMapping();
-
- assertEquals(EnumType.STRING, ((EnumeratedConverter) basicMapping.getConverter()).getSpecifiedEnumType());
- }
-
- public void testSetSpecifiedEnumerated() throws Exception {
- createTestEntityWithBasicMapping();
- addXmlClassRef(FULLY_QUALIFIED_TYPE_NAME);
-
- PersistentAttribute persistentAttribute = getJavaPersistentType().attributes().next();
- BasicMapping basicMapping = (BasicMapping) persistentAttribute.getSpecifiedMapping();
- assertTrue(basicMapping.getConverter().getType() == Converter.NO_CONVERTER);
-
- basicMapping.setSpecifiedConverter(Converter.ENUMERATED_CONVERTER);
-
- JavaResourcePersistentType typeResource = getJpaProject().getJavaResourcePersistentType(FULLY_QUALIFIED_TYPE_NAME);
- JavaResourcePersistentAttribute attributeResource = typeResource.persistableAttributes().next();
- EnumeratedAnnotation enumerated = (EnumeratedAnnotation) attributeResource.getSupportingAnnotation(EnumeratedAnnotation.ANNOTATION_NAME);
-
- assertNotNull(enumerated);
- assertEquals(null, enumerated.getValue());
-
- ((EnumeratedConverter) basicMapping.getConverter()).setSpecifiedEnumType(EnumType.STRING);
- assertEquals(org.eclipse.jpt.core.resource.java.EnumType.STRING, enumerated.getValue());
-
- ((EnumeratedConverter) basicMapping.getConverter()).setSpecifiedEnumType(null);
- assertNotNull(attributeResource.getSupportingAnnotation(EnumeratedAnnotation.ANNOTATION_NAME));
- assertNull(enumerated.getValue());
-
- basicMapping.setSpecifiedConverter(Converter.NO_CONVERTER);
- assertNull(attributeResource.getSupportingAnnotation(EnumeratedAnnotation.ANNOTATION_NAME));
- }
-
- public void testGetSpecifiedEnumeratedUpdatesFromResourceModelChange() throws Exception {
- createTestEntityWithBasicMapping();
- addXmlClassRef(FULLY_QUALIFIED_TYPE_NAME);
-
- PersistentAttribute persistentAttribute = getJavaPersistentType().attributes().next();
- BasicMapping basicMapping = (BasicMapping) persistentAttribute.getSpecifiedMapping();
-
- assertTrue(basicMapping.getConverter().getType() == Converter.NO_CONVERTER);
-
-
- JavaResourcePersistentType typeResource = getJpaProject().getJavaResourcePersistentType(FULLY_QUALIFIED_TYPE_NAME);
- JavaResourcePersistentAttribute attributeResource = typeResource.persistableAttributes().next();
- EnumeratedAnnotation enumerated = (EnumeratedAnnotation) attributeResource.addSupportingAnnotation(EnumeratedAnnotation.ANNOTATION_NAME);
- enumerated.setValue(org.eclipse.jpt.core.resource.java.EnumType.STRING);
-
- assertEquals(EnumType.STRING, ((EnumeratedConverter) basicMapping.getConverter()).getSpecifiedEnumType());
-
- enumerated.setValue(null);
- assertNotNull(attributeResource.getSupportingAnnotation(EnumeratedAnnotation.ANNOTATION_NAME));
- assertNull(((EnumeratedConverter) basicMapping.getConverter()).getSpecifiedEnumType());
- assertFalse(basicMapping.isDefault());
- assertSame(basicMapping, persistentAttribute.getSpecifiedMapping());
- }
-
- public void testGetTemporal() throws Exception {
- createTestEntityWithBasicMapping();
- addXmlClassRef(FULLY_QUALIFIED_TYPE_NAME);
-
- JavaResourcePersistentType typeResource = getJpaProject().getJavaResourcePersistentType(FULLY_QUALIFIED_TYPE_NAME);
- JavaResourcePersistentAttribute attributeResource = typeResource.persistableAttributes().next();
- attributeResource.addSupportingAnnotation(TemporalAnnotation.ANNOTATION_NAME);
-
- PersistentAttribute persistentAttribute = getJavaPersistentType().attributes().next();
- BasicMapping basicMapping = (BasicMapping) persistentAttribute.getSpecifiedMapping();
-
- assertEquals(Converter.TEMPORAL_CONVERTER, basicMapping.getConverter().getType());
- }
-
- public void testGetTemporal2() throws Exception {
- createTestEntityWithTemporal();
- addXmlClassRef(FULLY_QUALIFIED_TYPE_NAME);
-
- PersistentAttribute persistentAttribute = getJavaPersistentType().attributes().next();
- BasicMapping basicMapping = (BasicMapping) persistentAttribute.getMapping();
-
- assertEquals(Converter.TEMPORAL_CONVERTER, basicMapping.getConverter().getType());
- assertEquals(TemporalType.TIMESTAMP, ((TemporalConverter) basicMapping.getConverter()).getTemporalType());
- }
-
- public void testSetTemporal() throws Exception {
- createTestEntityWithBasicMapping();
- addXmlClassRef(FULLY_QUALIFIED_TYPE_NAME);
-
- PersistentAttribute persistentAttribute = getJavaPersistentType().attributes().next();
- BasicMapping basicMapping = (BasicMapping) persistentAttribute.getSpecifiedMapping();
- assertEquals(Converter.NO_CONVERTER, basicMapping.getConverter().getType());
-
- basicMapping.setSpecifiedConverter(Converter.TEMPORAL_CONVERTER);
- ((TemporalConverter) basicMapping.getSpecifiedConverter()).setTemporalType(TemporalType.TIME);
-
- JavaResourcePersistentType typeResource = getJpaProject().getJavaResourcePersistentType(FULLY_QUALIFIED_TYPE_NAME);
- JavaResourcePersistentAttribute attributeResource = typeResource.persistableAttributes().next();
- TemporalAnnotation temporal = (TemporalAnnotation) attributeResource.getSupportingAnnotation(TemporalAnnotation.ANNOTATION_NAME);
-
- assertEquals(org.eclipse.jpt.core.resource.java.TemporalType.TIME, temporal.getValue());
-
- basicMapping.setSpecifiedConverter(null);
- assertNull(attributeResource.getSupportingAnnotation(TemporalAnnotation.ANNOTATION_NAME));
- }
-
- public void testGetTemporalUpdatesFromResourceModelChange() throws Exception {
- createTestEntityWithBasicMapping();
- addXmlClassRef(FULLY_QUALIFIED_TYPE_NAME);
-
- PersistentAttribute persistentAttribute = getJavaPersistentType().attributes().next();
- BasicMapping basicMapping = (BasicMapping) persistentAttribute.getSpecifiedMapping();
-
- assertEquals(Converter.NO_CONVERTER, basicMapping.getConverter().getType());
-
-
- JavaResourcePersistentType typeResource = getJpaProject().getJavaResourcePersistentType(FULLY_QUALIFIED_TYPE_NAME);
- JavaResourcePersistentAttribute attributeResource = typeResource.persistableAttributes().next();
- TemporalAnnotation temporal = (TemporalAnnotation) attributeResource.addSupportingAnnotation(TemporalAnnotation.ANNOTATION_NAME);
- temporal.setValue(org.eclipse.jpt.core.resource.java.TemporalType.DATE);
-
- assertEquals(Converter.TEMPORAL_CONVERTER, basicMapping.getConverter().getType());
- assertEquals(TemporalType.DATE, ((TemporalConverter) basicMapping.getConverter()).getTemporalType());
-
- attributeResource.removeSupportingAnnotation(TemporalAnnotation.ANNOTATION_NAME);
-
- assertEquals(Converter.NO_CONVERTER, basicMapping.getConverter().getType());
- assertFalse(basicMapping.isDefault());
- assertSame(basicMapping, persistentAttribute.getSpecifiedMapping());
- }
-
- public void testGetColumn() throws Exception {
- createTestEntityWithBasicMapping();
- addXmlClassRef(FULLY_QUALIFIED_TYPE_NAME);
-
- PersistentAttribute persistentAttribute = getJavaPersistentType().attributes().next();
- BasicMapping basicMapping = (BasicMapping) persistentAttribute.getSpecifiedMapping();
-
- 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.addSupportingAnnotation(JPA.COLUMN);
- column.setName("foo");
-
- assertEquals("foo", basicMapping.getColumn().getSpecifiedName());
- assertEquals("foo", basicMapping.getColumn().getName());
- assertEquals("id", basicMapping.getColumn().getDefaultName());
- }
-}
diff --git a/jpa/tests/org.eclipse.jpt.core.tests/src/org/eclipse/jpt/core/tests/internal/context/java/JavaColumnTests.java b/jpa/tests/org.eclipse.jpt.core.tests/src/org/eclipse/jpt/core/tests/internal/context/java/JavaColumnTests.java
deleted file mode 100644
index 057325483f..0000000000
--- a/jpa/tests/org.eclipse.jpt.core.tests/src/org/eclipse/jpt/core/tests/internal/context/java/JavaColumnTests.java
+++ /dev/null
@@ -1,816 +0,0 @@
-/*******************************************************************************
- * Copyright (c) 2007, 2008 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.
- *
- * Contributors:
- * Oracle - initial API and implementation
- ******************************************************************************/
-package org.eclipse.jpt.core.tests.internal.context.java;
-
-import java.util.Iterator;
-import org.eclipse.jdt.core.ICompilationUnit;
-import org.eclipse.jpt.core.context.BaseColumn;
-import org.eclipse.jpt.core.context.BasicMapping;
-import org.eclipse.jpt.core.context.Column;
-import org.eclipse.jpt.core.context.Entity;
-import org.eclipse.jpt.core.resource.java.ColumnAnnotation;
-import org.eclipse.jpt.core.resource.java.JPA;
-import org.eclipse.jpt.core.resource.java.JavaResourcePersistentAttribute;
-import org.eclipse.jpt.core.resource.java.JavaResourcePersistentType;
-import org.eclipse.jpt.core.tests.internal.context.ContextModelTestCase;
-import org.eclipse.jpt.utility.internal.iterators.ArrayIterator;
-
-@SuppressWarnings("nls")
-public class JavaColumnTests extends ContextModelTestCase
-{
- private static final String COLUMN_NAME = "MY_COLUMN";
- private static final String TABLE_NAME = "MY_TABLE";
- private static final String COLUMN_DEFINITION = "MY_COLUMN_DEFINITION";
-
-
- private ICompilationUnit createTestEntity() 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");
- }
- });
- }
-
- private ICompilationUnit createTestEntityWithDefaultBasicColumn() 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").append(CR);
- }
-
- @Override
- public void appendIdFieldAnnotationTo(StringBuilder sb) {
- sb.append("@Column(name=\"" + COLUMN_NAME + "\")");
- }
- });
- }
-
- private ICompilationUnit createTestEntityWithBasicColumnTableSet() throws Exception {
- return this.createTestType(new DefaultAnnotationWriter() {
- @Override
- public Iterator<String> imports() {
- return new ArrayIterator<String>(JPA.ENTITY, JPA.BASIC, JPA.COLUMN);
- }
- @Override
- public void appendTypeAnnotationTo(StringBuilder sb) {
- sb.append("@Entity").append(CR);
- }
-
- @Override
- public void appendIdFieldAnnotationTo(StringBuilder sb) {
- sb.append("@Basic");
- sb.append("@Column(table=\"" + TABLE_NAME + "\")");
- }
- });
- }
-
- private ICompilationUnit createTestEntityWithBasicColumnColumnDefinitionSet() throws Exception {
- return this.createTestType(new DefaultAnnotationWriter() {
- @Override
- public Iterator<String> imports() {
- return new ArrayIterator<String>(JPA.ENTITY, JPA.BASIC, JPA.COLUMN);
- }
- @Override
- public void appendTypeAnnotationTo(StringBuilder sb) {
- sb.append("@Entity").append(CR);
- }
-
- @Override
- public void appendIdFieldAnnotationTo(StringBuilder sb) {
- sb.append("@Basic");
- sb.append("@Column(columnDefinition=\"" + COLUMN_DEFINITION + "\")");
- }
- });
- }
-
- public JavaColumnTests(String name) {
- super(name);
- }
-
- public void testGetSpecifiedNameNull() throws Exception {
- createTestEntity();
- addXmlClassRef(FULLY_QUALIFIED_TYPE_NAME);
-
- BasicMapping basicMapping = (BasicMapping) getJavaPersistentType().attributes().next().getMapping();
-
- assertNull(basicMapping.getColumn().getSpecifiedName());
- }
-
- public void testGetSpecifiedName() throws Exception {
- createTestEntityWithDefaultBasicColumn();
- addXmlClassRef(FULLY_QUALIFIED_TYPE_NAME);
-
- BasicMapping basicMapping = (BasicMapping) getJavaPersistentType().attributes().next().getMapping();
-
- assertEquals(COLUMN_NAME, basicMapping.getColumn().getSpecifiedName());
- }
-
- public void testGetDefaultNameSpecifiedNameNull() throws Exception {
- createTestEntity();
- addXmlClassRef(FULLY_QUALIFIED_TYPE_NAME);
- BasicMapping basicMapping = (BasicMapping) getJavaPersistentType().attributes().next().getMapping();
-
- assertEquals(basicMapping.getPersistentAttribute().getName(), basicMapping.getColumn().getDefaultName());
- assertEquals("id", basicMapping.getColumn().getDefaultName());
- }
-
- public void testGetDefaultName() throws Exception {
- createTestEntityWithDefaultBasicColumn();
- addXmlClassRef(FULLY_QUALIFIED_TYPE_NAME);
-
- BasicMapping basicMapping = (BasicMapping) getJavaPersistentType().attributes().next().getMapping();
- assertEquals("id", basicMapping.getColumn().getDefaultName());
-
- basicMapping.getColumn().setSpecifiedName("foo");
- assertEquals("id", basicMapping.getColumn().getDefaultName());
- }
-
- public void testGetNameSpecifiedNameNull() throws Exception {
- createTestEntity();
- addXmlClassRef(FULLY_QUALIFIED_TYPE_NAME);
- BasicMapping basicMapping = (BasicMapping) getJavaPersistentType().attributes().next().getMapping();
-
- assertEquals("id", basicMapping.getColumn().getName());
- }
-
- public void testGetName() throws Exception {
- createTestEntityWithDefaultBasicColumn();
- addXmlClassRef(FULLY_QUALIFIED_TYPE_NAME);
- BasicMapping basicMapping = (BasicMapping) getJavaPersistentType().attributes().next().getMapping();
-
- assertEquals(COLUMN_NAME, basicMapping.getColumn().getName());
- }
-
- public void testSetSpecifiedName() throws Exception {
- createTestEntity();
- addXmlClassRef(FULLY_QUALIFIED_TYPE_NAME);
- BasicMapping basicMapping = (BasicMapping) getJavaPersistentType().attributes().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.getSupportingAnnotation(JPA.COLUMN);
-
- assertEquals("foo", column.getName());
- }
-
- public void testSetSpecifiedNameNull() throws Exception {
- createTestEntityWithDefaultBasicColumn();
- addXmlClassRef(FULLY_QUALIFIED_TYPE_NAME);
-
- BasicMapping basicMapping = (BasicMapping) getJavaPersistentType().attributes().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.getSupportingAnnotation(JPA.COLUMN));
- }
-
- public void testGetNameUpdatesFromResourceChange() throws Exception {
- createTestEntity();
- addXmlClassRef(FULLY_QUALIFIED_TYPE_NAME);
- BasicMapping basicMapping = (BasicMapping) getJavaPersistentType().attributes().next().getMapping();
-
- assertNull(basicMapping.getColumn().getSpecifiedName());
-
- JavaResourcePersistentType typeResource = getJpaProject().getJavaResourcePersistentType(FULLY_QUALIFIED_TYPE_NAME);
- JavaResourcePersistentAttribute attributeResource = typeResource.persistableAttributes().next();
- ColumnAnnotation column = (ColumnAnnotation) attributeResource.addSupportingAnnotation(JPA.COLUMN);
-
- column.setName("foo");
- assertEquals("foo", basicMapping.getColumn().getSpecifiedName());
- assertEquals("foo", basicMapping.getColumn().getName());
-
- column.setName(null);
- assertNull(basicMapping.getColumn().getSpecifiedName());
- }
-
-
-
-
-
-
-
-
-
-
-
-
-
- public void testGetSpecifiedTableNull() throws Exception {
- createTestEntity();
- addXmlClassRef(FULLY_QUALIFIED_TYPE_NAME);
-
- BasicMapping basicMapping = (BasicMapping) getJavaPersistentType().attributes().next().getMapping();
-
- assertNull(basicMapping.getColumn().getSpecifiedTable());
- }
-
- public void testGetSpecifiedTable() throws Exception {
- createTestEntityWithBasicColumnTableSet();
- addXmlClassRef(FULLY_QUALIFIED_TYPE_NAME);
-
- BasicMapping basicMapping = (BasicMapping) getJavaPersistentType().attributes().next().getMapping();
-
- assertEquals(TABLE_NAME, basicMapping.getColumn().getSpecifiedTable());
- }
-
- public void testGetDefaultTableSpecifiedTableNull() throws Exception {
- createTestEntity();
- addXmlClassRef(FULLY_QUALIFIED_TYPE_NAME);
- BasicMapping basicMapping = (BasicMapping) getJavaPersistentType().attributes().next().getMapping();
-
- assertEquals(((Entity) basicMapping.getTypeMapping()).getName(), basicMapping.getColumn().getDefaultTable());
- assertEquals(TYPE_NAME, basicMapping.getColumn().getDefaultTable());
- }
-
- public void testGetDefaultTable() throws Exception {
- createTestEntityWithDefaultBasicColumn();
- addXmlClassRef(FULLY_QUALIFIED_TYPE_NAME);
-
- BasicMapping basicMapping = (BasicMapping) getJavaPersistentType().attributes().next().getMapping();
- assertEquals(TYPE_NAME, basicMapping.getColumn().getDefaultTable());
-
- basicMapping.getColumn().setSpecifiedTable("foo");
- assertEquals(TYPE_NAME, basicMapping.getColumn().getDefaultTable());
- }
-
- public void testGetTable() throws Exception {
- createTestEntityWithBasicColumnTableSet();
- addXmlClassRef(FULLY_QUALIFIED_TYPE_NAME);
- BasicMapping basicMapping = (BasicMapping) getJavaPersistentType().attributes().next().getMapping();
-
- assertEquals(TABLE_NAME, basicMapping.getColumn().getTable());
- }
-
- public void testSetSpecifiedTable() throws Exception {
- createTestEntity();
- addXmlClassRef(FULLY_QUALIFIED_TYPE_NAME);
- BasicMapping basicMapping = (BasicMapping) getJavaPersistentType().attributes().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.getSupportingAnnotation(JPA.COLUMN);
-
- assertEquals("foo", column.getTable());
- }
-
- public void testSetSpecifiedTableNull() throws Exception {
- createTestEntityWithBasicColumnTableSet();
- addXmlClassRef(FULLY_QUALIFIED_TYPE_NAME);
-
- BasicMapping basicMapping = (BasicMapping) getJavaPersistentType().attributes().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.getSupportingAnnotation(JPA.COLUMN));
- }
-
- public void testGetTableUpdatesFromResourceChange() throws Exception {
- createTestEntity();
- addXmlClassRef(FULLY_QUALIFIED_TYPE_NAME);
- BasicMapping basicMapping = (BasicMapping) getJavaPersistentType().attributes().next().getMapping();
-
- assertNull(basicMapping.getColumn().getSpecifiedTable());
-
- JavaResourcePersistentType typeResource = getJpaProject().getJavaResourcePersistentType(FULLY_QUALIFIED_TYPE_NAME);
- JavaResourcePersistentAttribute attributeResource = typeResource.persistableAttributes().next();
- ColumnAnnotation column = (ColumnAnnotation) attributeResource.addSupportingAnnotation(JPA.COLUMN);
-
- column.setTable("foo");
- assertEquals("foo", basicMapping.getColumn().getSpecifiedTable());
- assertEquals("foo", basicMapping.getColumn().getTable());
-
- column.setTable(null);
- assertNull(basicMapping.getColumn().getSpecifiedTable());
- }
-
- public void testGetColumnDefinition() throws Exception {
- createTestEntityWithBasicColumnColumnDefinitionSet();
- addXmlClassRef(FULLY_QUALIFIED_TYPE_NAME);
- BasicMapping basicMapping = (BasicMapping) getJavaPersistentType().attributes().next().getMapping();
-
- assertEquals(COLUMN_DEFINITION, basicMapping.getColumn().getColumnDefinition());
- }
-
- public void testSetColumnDefinition() throws Exception {
- createTestEntityWithBasicColumnTableSet();
- addXmlClassRef(FULLY_QUALIFIED_TYPE_NAME);
- BasicMapping basicMapping = (BasicMapping) getJavaPersistentType().attributes().next().getMapping();
-
- basicMapping.getColumn().setColumnDefinition("foo");
-
- JavaResourcePersistentType typeResource = getJpaProject().getJavaResourcePersistentType(FULLY_QUALIFIED_TYPE_NAME);
- JavaResourcePersistentAttribute attributeResource = typeResource.persistableAttributes().next();
- ColumnAnnotation column = (ColumnAnnotation) attributeResource.getSupportingAnnotation(JPA.COLUMN);
-
- assertEquals("foo", column.getColumnDefinition());
-
- basicMapping.getColumn().setColumnDefinition(null);
- assertNull(column.getColumnDefinition());
- }
-
- public void testGetColumnDefinitionUpdatesFromResourceChange() throws Exception {
- createTestEntity();
- addXmlClassRef(FULLY_QUALIFIED_TYPE_NAME);
- BasicMapping basicMapping = (BasicMapping) getJavaPersistentType().attributes().next().getMapping();
-
- assertNull(basicMapping.getColumn().getColumnDefinition());
-
- JavaResourcePersistentType typeResource = getJpaProject().getJavaResourcePersistentType(FULLY_QUALIFIED_TYPE_NAME);
- JavaResourcePersistentAttribute attributeResource = typeResource.persistableAttributes().next();
- ColumnAnnotation column = (ColumnAnnotation) attributeResource.addSupportingAnnotation(JPA.COLUMN);
-
- column.setColumnDefinition("foo");
- assertEquals("foo", basicMapping.getColumn().getColumnDefinition());
-
- column.setColumnDefinition(null);
- assertNull(basicMapping.getColumn().getColumnDefinition());
-
- }
-
- public void testGetLength() throws Exception {
- createTestEntity();
- addXmlClassRef(FULLY_QUALIFIED_TYPE_NAME);
- BasicMapping basicMapping = (BasicMapping) getJavaPersistentType().attributes().next().getMapping();
-
- assertEquals(Column.DEFAULT_LENGTH, basicMapping.getColumn().getLength());
- basicMapping.getColumn().setSpecifiedLength(Integer.valueOf(55));
- assertEquals(55, basicMapping.getColumn().getLength());
- }
-
- public void testGetDefaultLength() throws Exception {
- createTestEntityWithBasicColumnColumnDefinitionSet();
- addXmlClassRef(FULLY_QUALIFIED_TYPE_NAME);
-
- BasicMapping basicMapping = (BasicMapping) getJavaPersistentType().attributes().next().getMapping();
-
- assertEquals(Column.DEFAULT_LENGTH, basicMapping.getColumn().getDefaultLength());
- basicMapping.getColumn().setSpecifiedLength(Integer.valueOf(55));
-
- assertEquals(Column.DEFAULT_LENGTH, basicMapping.getColumn().getDefaultLength());
- }
-
- public void testGetSpecifiedLength() throws Exception {
- createTestEntity();
- addXmlClassRef(FULLY_QUALIFIED_TYPE_NAME);
-
- BasicMapping basicMapping = (BasicMapping) getJavaPersistentType().attributes().next().getMapping();
-
- assertNull(basicMapping.getColumn().getSpecifiedLength());
-
- JavaResourcePersistentType typeResource = getJpaProject().getJavaResourcePersistentType(FULLY_QUALIFIED_TYPE_NAME);
- JavaResourcePersistentAttribute attributeResource = typeResource.persistableAttributes().next();
- ColumnAnnotation column = (ColumnAnnotation) attributeResource.addSupportingAnnotation(JPA.COLUMN);
- column.setLength(Integer.valueOf(66));
-
- assertEquals(Integer.valueOf(66), basicMapping.getColumn().getSpecifiedLength());
- assertEquals(66, basicMapping.getColumn().getLength());
-
- column.setLength(null);
-
- assertNull(attributeResource.getSupportingAnnotation(JPA.COLUMN));
- assertNull(basicMapping.getColumn().getSpecifiedLength());
- }
-
- public void testSetSpecifiedLength() throws Exception {
- createTestEntityWithBasicColumnColumnDefinitionSet();
- addXmlClassRef(FULLY_QUALIFIED_TYPE_NAME);
-
- BasicMapping basicMapping = (BasicMapping) getJavaPersistentType().attributes().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 column = (ColumnAnnotation) attributeResource.getSupportingAnnotation(JPA.COLUMN);
-
- assertEquals(Integer.valueOf(100), column.getLength());
-
- basicMapping.getColumn().setSpecifiedLength(null);
-
- assertNull(column.getLength());
- }
-
- public void testGetPrecision() throws Exception {
- createTestEntity();
- addXmlClassRef(FULLY_QUALIFIED_TYPE_NAME);
- BasicMapping basicMapping = (BasicMapping) getJavaPersistentType().attributes().next().getMapping();
-
- assertEquals(Column.DEFAULT_PRECISION, basicMapping.getColumn().getPrecision());
- basicMapping.getColumn().setSpecifiedPrecision(Integer.valueOf(55));
- assertEquals(55, basicMapping.getColumn().getPrecision());
- }
-
- public void testGetDefaultPrecision() throws Exception {
- createTestEntityWithBasicColumnColumnDefinitionSet();
- addXmlClassRef(FULLY_QUALIFIED_TYPE_NAME);
-
- BasicMapping basicMapping = (BasicMapping) getJavaPersistentType().attributes().next().getMapping();
-
- assertEquals(Column.DEFAULT_PRECISION, basicMapping.getColumn().getDefaultPrecision());
- basicMapping.getColumn().setSpecifiedPrecision(Integer.valueOf(55));
-
- assertEquals(Column.DEFAULT_PRECISION, basicMapping.getColumn().getDefaultPrecision());
- }
-
- public void testGetSpecifiedPrecision() throws Exception {
- createTestEntity();
- addXmlClassRef(FULLY_QUALIFIED_TYPE_NAME);
-
- BasicMapping basicMapping = (BasicMapping) getJavaPersistentType().attributes().next().getMapping();
-
- assertNull(basicMapping.getColumn().getSpecifiedPrecision());
-
- JavaResourcePersistentType typeResource = getJpaProject().getJavaResourcePersistentType(FULLY_QUALIFIED_TYPE_NAME);
- JavaResourcePersistentAttribute attributeResource = typeResource.persistableAttributes().next();
- ColumnAnnotation column = (ColumnAnnotation) attributeResource.addSupportingAnnotation(JPA.COLUMN);
- column.setPrecision(Integer.valueOf(66));
-
- assertEquals(Integer.valueOf(66), basicMapping.getColumn().getSpecifiedPrecision());
- assertEquals(66, basicMapping.getColumn().getPrecision());
-
- column.setPrecision(null);
-
- assertNull(attributeResource.getSupportingAnnotation(JPA.COLUMN));
- assertNull(basicMapping.getColumn().getSpecifiedPrecision());
- }
-
- public void testSetSpecifiedPrecision() throws Exception {
- createTestEntityWithBasicColumnColumnDefinitionSet();
- addXmlClassRef(FULLY_QUALIFIED_TYPE_NAME);
-
- BasicMapping basicMapping = (BasicMapping) getJavaPersistentType().attributes().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 column = (ColumnAnnotation) attributeResource.getSupportingAnnotation(JPA.COLUMN);
-
- assertEquals(Integer.valueOf(100), column.getPrecision());
-
- basicMapping.getColumn().setSpecifiedPrecision(null);
-
- assertNull(column.getPrecision());
- }
-
- public void testGetScale() throws Exception {
- createTestEntity();
- addXmlClassRef(FULLY_QUALIFIED_TYPE_NAME);
- BasicMapping basicMapping = (BasicMapping) getJavaPersistentType().attributes().next().getMapping();
-
- assertEquals(Column.DEFAULT_SCALE, basicMapping.getColumn().getScale());
- basicMapping.getColumn().setSpecifiedScale(Integer.valueOf(55));
- assertEquals(55, basicMapping.getColumn().getScale());
- }
-
- public void testGetDefaultScale() throws Exception {
- createTestEntityWithBasicColumnColumnDefinitionSet();
- addXmlClassRef(FULLY_QUALIFIED_TYPE_NAME);
-
- BasicMapping basicMapping = (BasicMapping) getJavaPersistentType().attributes().next().getMapping();
-
- assertEquals(Column.DEFAULT_SCALE, basicMapping.getColumn().getDefaultScale());
- basicMapping.getColumn().setSpecifiedScale(Integer.valueOf(55));
-
- assertEquals(Column.DEFAULT_SCALE, basicMapping.getColumn().getDefaultScale());
- }
-
- public void testGetSpecifiedScale() throws Exception {
- createTestEntity();
- addXmlClassRef(FULLY_QUALIFIED_TYPE_NAME);
-
- BasicMapping basicMapping = (BasicMapping) getJavaPersistentType().attributes().next().getMapping();
-
- assertNull(basicMapping.getColumn().getSpecifiedScale());
-
- JavaResourcePersistentType typeResource = getJpaProject().getJavaResourcePersistentType(FULLY_QUALIFIED_TYPE_NAME);
- JavaResourcePersistentAttribute attributeResource = typeResource.persistableAttributes().next();
- ColumnAnnotation column = (ColumnAnnotation) attributeResource.addSupportingAnnotation(JPA.COLUMN);
- column.setScale(Integer.valueOf(66));
-
- assertEquals(Integer.valueOf(66), basicMapping.getColumn().getSpecifiedScale());
- assertEquals(66, basicMapping.getColumn().getScale());
-
- column.setScale(null);
-
- assertNull(attributeResource.getSupportingAnnotation(JPA.COLUMN));
- assertNull(basicMapping.getColumn().getSpecifiedScale());
- }
-
- public void testSetSpecifiedScale() throws Exception {
- createTestEntityWithBasicColumnColumnDefinitionSet();
- addXmlClassRef(FULLY_QUALIFIED_TYPE_NAME);
-
- BasicMapping basicMapping = (BasicMapping) getJavaPersistentType().attributes().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 column = (ColumnAnnotation) attributeResource.getSupportingAnnotation(JPA.COLUMN);
-
- assertEquals(Integer.valueOf(100), column.getScale());
-
- basicMapping.getColumn().setSpecifiedScale(null);
-
- assertNull(column.getScale());
- }
-
- public void testGetUnique() throws Exception {
- createTestEntity();
- addXmlClassRef(FULLY_QUALIFIED_TYPE_NAME);
- BasicMapping basicMapping = (BasicMapping) getJavaPersistentType().attributes().next().getMapping();
-
- assertEquals(BaseColumn.DEFAULT_UNIQUE, basicMapping.getColumn().isUnique());
- basicMapping.getColumn().setSpecifiedUnique(Boolean.TRUE);
- assertEquals(true, basicMapping.getColumn().isUnique());
- }
-
- public void testGetDefaultUnique() throws Exception {
- createTestEntityWithBasicColumnColumnDefinitionSet();
- addXmlClassRef(FULLY_QUALIFIED_TYPE_NAME);
-
- BasicMapping basicMapping = (BasicMapping) getJavaPersistentType().attributes().next().getMapping();
-
- assertEquals(BaseColumn.DEFAULT_UNIQUE, basicMapping.getColumn().isDefaultUnique());
- basicMapping.getColumn().setSpecifiedUnique(Boolean.TRUE);
-
- assertEquals(BaseColumn.DEFAULT_UNIQUE, basicMapping.getColumn().isDefaultUnique());
- }
-
- public void testGetSpecifiedUnique() throws Exception {
- createTestEntity();
- addXmlClassRef(FULLY_QUALIFIED_TYPE_NAME);
-
- BasicMapping basicMapping = (BasicMapping) getJavaPersistentType().attributes().next().getMapping();
-
- assertNull(basicMapping.getColumn().getSpecifiedUnique());
-
- JavaResourcePersistentType typeResource = getJpaProject().getJavaResourcePersistentType(FULLY_QUALIFIED_TYPE_NAME);
- JavaResourcePersistentAttribute attributeResource = typeResource.persistableAttributes().next();
- ColumnAnnotation column = (ColumnAnnotation) attributeResource.addSupportingAnnotation(JPA.COLUMN);
- column.setUnique(Boolean.TRUE);
-
- assertEquals(Boolean.TRUE, basicMapping.getColumn().getSpecifiedUnique());
- assertEquals(true, basicMapping.getColumn().isUnique());
-
- column.setUnique(null);
-
- assertNull(attributeResource.getSupportingAnnotation(JPA.COLUMN));
- assertNull(basicMapping.getColumn().getSpecifiedUnique());
- }
-
- public void testSetSpecifiedUnique() throws Exception {
- createTestEntityWithBasicColumnColumnDefinitionSet();
- addXmlClassRef(FULLY_QUALIFIED_TYPE_NAME);
-
- BasicMapping basicMapping = (BasicMapping) getJavaPersistentType().attributes().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 column = (ColumnAnnotation) attributeResource.getSupportingAnnotation(JPA.COLUMN);
-
- assertEquals(Boolean.FALSE, column.getUnique());
-
- basicMapping.getColumn().setSpecifiedUnique(null);
-
- assertNull(column.getUnique());
- }
-
- public void testGetInsertable() throws Exception {
- createTestEntity();
- addXmlClassRef(FULLY_QUALIFIED_TYPE_NAME);
- BasicMapping basicMapping = (BasicMapping) getJavaPersistentType().attributes().next().getMapping();
-
- assertEquals(BaseColumn.DEFAULT_INSERTABLE, basicMapping.getColumn().isInsertable());
- basicMapping.getColumn().setSpecifiedInsertable(Boolean.TRUE);
- assertEquals(true, basicMapping.getColumn().isInsertable());
- }
-
- public void testGetDefaultInsertable() throws Exception {
- createTestEntityWithBasicColumnColumnDefinitionSet();
- addXmlClassRef(FULLY_QUALIFIED_TYPE_NAME);
-
- BasicMapping basicMapping = (BasicMapping) getJavaPersistentType().attributes().next().getMapping();
-
- assertEquals(BaseColumn.DEFAULT_INSERTABLE, basicMapping.getColumn().isDefaultInsertable());
- basicMapping.getColumn().setSpecifiedInsertable(Boolean.TRUE);
-
- assertEquals(BaseColumn.DEFAULT_INSERTABLE, basicMapping.getColumn().isDefaultInsertable());
- }
-
- public void testGetSpecifiedInsertable() throws Exception {
- createTestEntity();
- addXmlClassRef(FULLY_QUALIFIED_TYPE_NAME);
-
- BasicMapping basicMapping = (BasicMapping) getJavaPersistentType().attributes().next().getMapping();
-
- assertNull(basicMapping.getColumn().getSpecifiedInsertable());
-
- JavaResourcePersistentType typeResource = getJpaProject().getJavaResourcePersistentType(FULLY_QUALIFIED_TYPE_NAME);
- JavaResourcePersistentAttribute attributeResource = typeResource.persistableAttributes().next();
- ColumnAnnotation column = (ColumnAnnotation) attributeResource.addSupportingAnnotation(JPA.COLUMN);
- column.setInsertable(Boolean.TRUE);
-
- assertEquals(Boolean.TRUE, basicMapping.getColumn().getSpecifiedInsertable());
- assertEquals(true, basicMapping.getColumn().isInsertable());
-
- column.setInsertable(null);
-
- assertNull(attributeResource.getSupportingAnnotation(JPA.COLUMN));
- assertNull(basicMapping.getColumn().getSpecifiedInsertable());
- }
-
- public void testSetSpecifiedInsertable() throws Exception {
- createTestEntityWithBasicColumnColumnDefinitionSet();
- addXmlClassRef(FULLY_QUALIFIED_TYPE_NAME);
-
- BasicMapping basicMapping = (BasicMapping) getJavaPersistentType().attributes().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 column = (ColumnAnnotation) attributeResource.getSupportingAnnotation(JPA.COLUMN);
-
- assertEquals(Boolean.FALSE, column.getInsertable());
-
- basicMapping.getColumn().setSpecifiedInsertable(null);
-
- assertNull(column.getInsertable());
- }
-
- public void testGetNullable() throws Exception {
- createTestEntity();
- addXmlClassRef(FULLY_QUALIFIED_TYPE_NAME);
- BasicMapping basicMapping = (BasicMapping) getJavaPersistentType().attributes().next().getMapping();
-
- assertEquals(BaseColumn.DEFAULT_NULLABLE, basicMapping.getColumn().isNullable());
- basicMapping.getColumn().setSpecifiedNullable(Boolean.TRUE);
- assertEquals(true, basicMapping.getColumn().isNullable());
- }
-
- public void testGetDefaultNullable() throws Exception {
- createTestEntityWithBasicColumnColumnDefinitionSet();
- addXmlClassRef(FULLY_QUALIFIED_TYPE_NAME);
-
- BasicMapping basicMapping = (BasicMapping) getJavaPersistentType().attributes().next().getMapping();
-
- assertEquals(BaseColumn.DEFAULT_NULLABLE, basicMapping.getColumn().isDefaultNullable());
- basicMapping.getColumn().setSpecifiedNullable(Boolean.TRUE);
-
- assertEquals(BaseColumn.DEFAULT_NULLABLE, basicMapping.getColumn().isDefaultNullable());
- }
-
- public void testGetSpecifiedNullable() throws Exception {
- createTestEntity();
- addXmlClassRef(FULLY_QUALIFIED_TYPE_NAME);
-
- BasicMapping basicMapping = (BasicMapping) getJavaPersistentType().attributes().next().getMapping();
-
- assertNull(basicMapping.getColumn().getSpecifiedNullable());
-
- JavaResourcePersistentType typeResource = getJpaProject().getJavaResourcePersistentType(FULLY_QUALIFIED_TYPE_NAME);
- JavaResourcePersistentAttribute attributeResource = typeResource.persistableAttributes().next();
- ColumnAnnotation column = (ColumnAnnotation) attributeResource.addSupportingAnnotation(JPA.COLUMN);
- column.setNullable(Boolean.TRUE);
-
- assertEquals(Boolean.TRUE, basicMapping.getColumn().getSpecifiedNullable());
- assertEquals(true, basicMapping.getColumn().isNullable());
-
- column.setNullable(null);
-
- assertNull(attributeResource.getSupportingAnnotation(JPA.COLUMN));
- assertNull(basicMapping.getColumn().getSpecifiedNullable());
- }
-
- public void testSetSpecifiedNullable() throws Exception {
- createTestEntityWithBasicColumnColumnDefinitionSet();
- addXmlClassRef(FULLY_QUALIFIED_TYPE_NAME);
-
- BasicMapping basicMapping = (BasicMapping) getJavaPersistentType().attributes().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 column = (ColumnAnnotation) attributeResource.getSupportingAnnotation(JPA.COLUMN);
-
- assertEquals(Boolean.FALSE, column.getNullable());
-
- basicMapping.getColumn().setSpecifiedNullable(null);
-
- assertNull(column.getNullable());
- }
-
- public void testGetUpdatable() throws Exception {
- createTestEntity();
- addXmlClassRef(FULLY_QUALIFIED_TYPE_NAME);
- BasicMapping basicMapping = (BasicMapping) getJavaPersistentType().attributes().next().getMapping();
-
- assertEquals(BaseColumn.DEFAULT_UPDATABLE, basicMapping.getColumn().isUpdatable());
- basicMapping.getColumn().setSpecifiedUpdatable(Boolean.TRUE);
- assertEquals(true, basicMapping.getColumn().isUpdatable());
- }
-
- public void testGetDefaultUpdatable() throws Exception {
- createTestEntityWithBasicColumnColumnDefinitionSet();
- addXmlClassRef(FULLY_QUALIFIED_TYPE_NAME);
-
- BasicMapping basicMapping = (BasicMapping) getJavaPersistentType().attributes().next().getMapping();
-
- assertEquals(BaseColumn.DEFAULT_UPDATABLE, basicMapping.getColumn().isDefaultUpdatable());
- basicMapping.getColumn().setSpecifiedUpdatable(Boolean.TRUE);
-
- assertEquals(BaseColumn.DEFAULT_UPDATABLE, basicMapping.getColumn().isDefaultUpdatable());
- }
-
- public void testGetSpecifiedUpdatable() throws Exception {
- createTestEntity();
- addXmlClassRef(FULLY_QUALIFIED_TYPE_NAME);
-
- BasicMapping basicMapping = (BasicMapping) getJavaPersistentType().attributes().next().getMapping();
-
- assertNull(basicMapping.getColumn().getSpecifiedUpdatable());
-
- JavaResourcePersistentType typeResource = getJpaProject().getJavaResourcePersistentType(FULLY_QUALIFIED_TYPE_NAME);
- JavaResourcePersistentAttribute attributeResource = typeResource.persistableAttributes().next();
- ColumnAnnotation column = (ColumnAnnotation) attributeResource.addSupportingAnnotation(JPA.COLUMN);
- column.setUpdatable(Boolean.TRUE);
-
- assertEquals(Boolean.TRUE, basicMapping.getColumn().getSpecifiedUpdatable());
- assertEquals(true, basicMapping.getColumn().isUpdatable());
-
- column.setUpdatable(null);
-
- assertNull(attributeResource.getSupportingAnnotation(JPA.COLUMN));
- assertNull(basicMapping.getColumn().getSpecifiedUpdatable());
- }
-
- public void testSetSpecifiedUpdatable() throws Exception {
- createTestEntityWithBasicColumnColumnDefinitionSet();
- addXmlClassRef(FULLY_QUALIFIED_TYPE_NAME);
-
- BasicMapping basicMapping = (BasicMapping) getJavaPersistentType().attributes().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 column = (ColumnAnnotation) attributeResource.getSupportingAnnotation(JPA.COLUMN);
-
- assertEquals(Boolean.FALSE, column.getUpdatable());
-
- basicMapping.getColumn().setSpecifiedUpdatable(null);
-
- assertNull(column.getUpdatable());
- }
-}
diff --git a/jpa/tests/org.eclipse.jpt.core.tests/src/org/eclipse/jpt/core/tests/internal/context/java/JavaDiscriminatorColumnTests.java b/jpa/tests/org.eclipse.jpt.core.tests/src/org/eclipse/jpt/core/tests/internal/context/java/JavaDiscriminatorColumnTests.java
deleted file mode 100644
index 9abd19c687..0000000000
--- a/jpa/tests/org.eclipse.jpt.core.tests/src/org/eclipse/jpt/core/tests/internal/context/java/JavaDiscriminatorColumnTests.java
+++ /dev/null
@@ -1,450 +0,0 @@
-/*******************************************************************************
- * Copyright (c) 2007, 2008 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.
- *
- * Contributors:
- * Oracle - initial API and implementation
- ******************************************************************************/
-package org.eclipse.jpt.core.tests.internal.context.java;
-
-import java.util.Iterator;
-import java.util.ListIterator;
-import org.eclipse.jdt.core.ICompilationUnit;
-import org.eclipse.jpt.core.context.DiscriminatorColumn;
-import org.eclipse.jpt.core.context.DiscriminatorType;
-import org.eclipse.jpt.core.context.InheritanceType;
-import org.eclipse.jpt.core.context.java.JavaEntity;
-import org.eclipse.jpt.core.context.persistence.ClassRef;
-import org.eclipse.jpt.core.resource.java.DiscriminatorColumnAnnotation;
-import org.eclipse.jpt.core.resource.java.JPA;
-import org.eclipse.jpt.core.resource.java.JavaResourcePersistentType;
-import org.eclipse.jpt.core.tests.internal.context.ContextModelTestCase;
-import org.eclipse.jpt.core.tests.internal.projects.TestJavaProject.SourceWriter;
-import org.eclipse.jpt.utility.internal.iterators.ArrayIterator;
-
-@SuppressWarnings("nls")
-public class JavaDiscriminatorColumnTests extends ContextModelTestCase
-{
- private static final String DISCRIMINATOR_COLUMN_NAME = "MY_DISCRIMINATOR_COLUMN";
- private static final String COLUMN_DEFINITION = "MY_COLUMN_DEFINITION";
-
-
- private ICompilationUnit createTestEntity() 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");
- }
- });
- }
-
- private ICompilationUnit createTestEntityWithDiscriminatorColumn() throws Exception {
- return this.createTestType(new DefaultAnnotationWriter() {
- @Override
- public Iterator<String> imports() {
- return new ArrayIterator<String>(JPA.ENTITY, JPA.DISCRIMINATOR_COLUMN);
- }
- @Override
- public void appendTypeAnnotationTo(StringBuilder sb) {
- sb.append("@Entity").append(CR);
- sb.append("@DiscriminatorColumn(name=\"" + DISCRIMINATOR_COLUMN_NAME + "\")");
- }
- });
- }
-
- private void createTestAbstractEntity() throws Exception {
- SourceWriter sourceWriter = new SourceWriter() {
- public void appendSourceTo(StringBuilder sb) {
- sb.append(CR);
- sb.append("import ");
- sb.append(JPA.ENTITY);
- sb.append(";");
- sb.append(CR);
- sb.append("@Entity");
- sb.append(CR);
- sb.append("public abstract class ").append(TYPE_NAME).append(" ");
- sb.append("{}").append(CR);
- }
- };
- this.javaProject.createCompilationUnit(PACKAGE_NAME, FILE_NAME, sourceWriter);
- }
-
- private void createTestSubType() throws Exception {
- SourceWriter sourceWriter = new SourceWriter() {
- public void appendSourceTo(StringBuilder sb) {
- sb.append(CR);
- sb.append("import ");
- sb.append(JPA.ENTITY);
- sb.append(";");
- sb.append(CR);
- sb.append("@Entity");
- sb.append(CR);
- sb.append("public class ").append("AnnotationTestTypeChild").append(" ");
- sb.append("extends " + TYPE_NAME + " ");
- sb.append("{}").append(CR);
- }
- };
- this.javaProject.createCompilationUnit(PACKAGE_NAME, "AnnotationTestTypeChild.java", sourceWriter);
- }
-
-
- public JavaDiscriminatorColumnTests(String name) {
- super(name);
- }
-
- public void testGetSpecifiedNameNull() throws Exception {
- createTestEntity();
- addXmlClassRef(FULLY_QUALIFIED_TYPE_NAME);
-
- assertNull(getJavaEntity().getDiscriminatorColumn().getSpecifiedName());
- }
-
- public void testGetSpecifiedName() throws Exception {
- createTestEntityWithDiscriminatorColumn();
- addXmlClassRef(FULLY_QUALIFIED_TYPE_NAME);
-
- assertEquals(DISCRIMINATOR_COLUMN_NAME, getJavaEntity().getDiscriminatorColumn().getSpecifiedName());
- }
-
- public void testGetDefaultNameSpecifiedNameNull() throws Exception {
- createTestEntity();
- addXmlClassRef(FULLY_QUALIFIED_TYPE_NAME);
-
- assertEquals(null, getJavaEntity().getDiscriminatorColumn().getDefaultName());
-
- createTestSubType();
- addXmlClassRef(FULLY_QUALIFIED_TYPE_NAME);
- assertEquals("DTYPE", getJavaEntity().getDiscriminatorColumn().getDefaultName());
- }
-
- public void testGetDefaultName() throws Exception {
- createTestEntityWithDiscriminatorColumn();
- addXmlClassRef(FULLY_QUALIFIED_TYPE_NAME);
-
- assertEquals(null, getJavaEntity().getDiscriminatorColumn().getDefaultName());
-
- createTestSubType();
- addXmlClassRef(FULLY_QUALIFIED_TYPE_NAME);
- assertEquals("DTYPE", getJavaEntity().getDiscriminatorColumn().getDefaultName());
-
- getJavaEntity().getDiscriminatorColumn().setSpecifiedName("foo");
- assertEquals("DTYPE", getJavaEntity().getDiscriminatorColumn().getDefaultName());
- }
-
- public void testGetNameSpecifiedNameNull() throws Exception {
- createTestEntity();
- addXmlClassRef(FULLY_QUALIFIED_TYPE_NAME);
-
- assertEquals(null, getJavaEntity().getDiscriminatorColumn().getName());
-
- createTestSubType();
- addXmlClassRef(FULLY_QUALIFIED_TYPE_NAME);
- assertEquals("DTYPE", getJavaEntity().getDiscriminatorColumn().getName());
- }
-
- public void testGetName() throws Exception {
- createTestEntityWithDiscriminatorColumn();
- addXmlClassRef(FULLY_QUALIFIED_TYPE_NAME);
-
- assertEquals(DISCRIMINATOR_COLUMN_NAME, getJavaEntity().getDiscriminatorColumn().getName());
- }
-
- public void testSetSpecifiedName() throws Exception {
- createTestEntity();
- addXmlClassRef(FULLY_QUALIFIED_TYPE_NAME);
-
- getJavaEntity().getDiscriminatorColumn().setSpecifiedName("foo");
-
- assertEquals("foo", getJavaEntity().getDiscriminatorColumn().getSpecifiedName());
-
- JavaResourcePersistentType typeResource = getJpaProject().getJavaResourcePersistentType(FULLY_QUALIFIED_TYPE_NAME);
- DiscriminatorColumnAnnotation discriminatorColumn = (DiscriminatorColumnAnnotation) typeResource.getSupportingAnnotation(JPA.DISCRIMINATOR_COLUMN);
-
- assertEquals("foo", discriminatorColumn.getName());
- }
-
- public void testSetSpecifiedNameNull() throws Exception {
- createTestEntityWithDiscriminatorColumn();
- addXmlClassRef(FULLY_QUALIFIED_TYPE_NAME);
-
- getJavaEntity().getDiscriminatorColumn().setSpecifiedName(null);
-
- assertNull(getJavaEntity().getDiscriminatorColumn().getSpecifiedName());
-
- JavaResourcePersistentType typeResource = getJpaProject().getJavaResourcePersistentType(FULLY_QUALIFIED_TYPE_NAME);
- DiscriminatorColumnAnnotation discriminatorColumn = (DiscriminatorColumnAnnotation) typeResource.getSupportingAnnotation(JPA.DISCRIMINATOR_COLUMN);
-
- assertNull(discriminatorColumn);
- }
-
- public void testGetDefaultDiscriminatorType() throws Exception {
- createTestEntityWithDiscriminatorColumn();
- addXmlClassRef(FULLY_QUALIFIED_TYPE_NAME);
-
- assertEquals(null, getJavaEntity().getDiscriminatorColumn().getDefaultDiscriminatorType());
-
- createTestSubType();
- addXmlClassRef(FULLY_QUALIFIED_TYPE_NAME);
- assertEquals(DiscriminatorType.STRING, getJavaEntity().getDiscriminatorColumn().getDefaultDiscriminatorType());
- }
-
- public void testGetDiscriminatorType() throws Exception {
- createTestEntityWithDiscriminatorColumn();
- addXmlClassRef(FULLY_QUALIFIED_TYPE_NAME);
-
- assertEquals(null, getJavaEntity().getDiscriminatorColumn().getDiscriminatorType());
-
- createTestSubType();
- addXmlClassRef(FULLY_QUALIFIED_TYPE_NAME);
-
- assertEquals(DiscriminatorType.STRING, getJavaEntity().getDiscriminatorColumn().getDiscriminatorType());
-
- getJavaEntity().getDiscriminatorColumn().setSpecifiedDiscriminatorType(DiscriminatorType.CHAR);
- assertEquals(DiscriminatorType.CHAR, getJavaEntity().getDiscriminatorColumn().getDiscriminatorType());
- }
-
- public void testGetSpecifiedDiscriminatorType() throws Exception {
- createTestEntityWithDiscriminatorColumn();
- addXmlClassRef(FULLY_QUALIFIED_TYPE_NAME);
-
- assertNull(getJavaEntity().getDiscriminatorColumn().getSpecifiedDiscriminatorType());
-
-
- JavaResourcePersistentType typeResource = getJpaProject().getJavaResourcePersistentType(FULLY_QUALIFIED_TYPE_NAME);
- DiscriminatorColumnAnnotation discriminatorColumn = (DiscriminatorColumnAnnotation) typeResource.getSupportingAnnotation(JPA.DISCRIMINATOR_COLUMN);
- discriminatorColumn.setDiscriminatorType(org.eclipse.jpt.core.resource.java.DiscriminatorType.CHAR);
-
- assertEquals(DiscriminatorType.CHAR, getJavaEntity().getDiscriminatorColumn().getSpecifiedDiscriminatorType());
- }
-
- public void testSetSpecifiedDiscriminatorType() throws Exception {
- createTestEntityWithDiscriminatorColumn();
- addXmlClassRef(FULLY_QUALIFIED_TYPE_NAME);
-
- assertNull(getJavaEntity().getDiscriminatorColumn().getSpecifiedDiscriminatorType());
-
- getJavaEntity().getDiscriminatorColumn().setSpecifiedDiscriminatorType(DiscriminatorType.CHAR);
-
- JavaResourcePersistentType typeResource = getJpaProject().getJavaResourcePersistentType(FULLY_QUALIFIED_TYPE_NAME);
- DiscriminatorColumnAnnotation discriminatorColumn = (DiscriminatorColumnAnnotation) typeResource.getSupportingAnnotation(JPA.DISCRIMINATOR_COLUMN);
-
- assertEquals(org.eclipse.jpt.core.resource.java.DiscriminatorType.CHAR, discriminatorColumn.getDiscriminatorType());
-
- getJavaEntity().getDiscriminatorColumn().setSpecifiedName(null);
- getJavaEntity().getDiscriminatorColumn().setSpecifiedDiscriminatorType(null);
- assertNull(typeResource.getSupportingAnnotation(JPA.DISCRIMINATOR_COLUMN));
- }
-
- public void testGetDiscriminatorTypeUpdatesFromResourceChange() throws Exception {
- createTestEntity();
- addXmlClassRef(FULLY_QUALIFIED_TYPE_NAME);
-
- assertNull(getJavaEntity().getDiscriminatorColumn().getSpecifiedDiscriminatorType());
-
- JavaResourcePersistentType typeResource = getJpaProject().getJavaResourcePersistentType(FULLY_QUALIFIED_TYPE_NAME);
- DiscriminatorColumnAnnotation column = (DiscriminatorColumnAnnotation) typeResource.addSupportingAnnotation(JPA.DISCRIMINATOR_COLUMN);
-
- column.setDiscriminatorType(org.eclipse.jpt.core.resource.java.DiscriminatorType.INTEGER);
- assertEquals(DiscriminatorType.INTEGER, getJavaEntity().getDiscriminatorColumn().getSpecifiedDiscriminatorType());
- assertEquals(DiscriminatorType.INTEGER, getJavaEntity().getDiscriminatorColumn().getDiscriminatorType());
-
- column.setDiscriminatorType(null);
- assertNull(getJavaEntity().getDiscriminatorColumn().getSpecifiedDiscriminatorType());
- assertEquals(null, getJavaEntity().getDiscriminatorColumn().getDiscriminatorType());
-
- createTestSubType();
- addXmlClassRef(FULLY_QUALIFIED_TYPE_NAME);
- assertEquals(DiscriminatorColumn.DEFAULT_DISCRIMINATOR_TYPE, getJavaEntity().getDiscriminatorColumn().getDiscriminatorType());
- }
-
- public void testGetLength() throws Exception {
- createTestEntity();
- addXmlClassRef(FULLY_QUALIFIED_TYPE_NAME);
-
- assertEquals(0, getJavaEntity().getDiscriminatorColumn().getLength());
-
- createTestSubType();
- addXmlClassRef(FULLY_QUALIFIED_TYPE_NAME);
-
- assertEquals(DiscriminatorColumn.DEFAULT_LENGTH, getJavaEntity().getDiscriminatorColumn().getLength());
- getJavaEntity().getDiscriminatorColumn().setSpecifiedLength(Integer.valueOf(55));
- assertEquals(55, getJavaEntity().getDiscriminatorColumn().getLength());
- }
-
- public void testGetDefaultLength() throws Exception {
- createTestEntityWithDiscriminatorColumn();
- addXmlClassRef(FULLY_QUALIFIED_TYPE_NAME);
-
- assertEquals(0, getJavaEntity().getDiscriminatorColumn().getDefaultLength());
-
- createTestSubType();
- addXmlClassRef(FULLY_QUALIFIED_TYPE_NAME);
- assertEquals(DiscriminatorColumn.DEFAULT_LENGTH, getJavaEntity().getDiscriminatorColumn().getDefaultLength());
-
- getJavaEntity().getDiscriminatorColumn().setSpecifiedLength(Integer.valueOf(55));
-
- assertEquals(DiscriminatorColumn.DEFAULT_LENGTH, getJavaEntity().getDiscriminatorColumn().getDefaultLength());
- }
-
- public void testGetSpecifiedLength() throws Exception {
- createTestEntityWithDiscriminatorColumn();
- addXmlClassRef(FULLY_QUALIFIED_TYPE_NAME);
-
- assertNull(getJavaEntity().getDiscriminatorColumn().getSpecifiedLength());
-
- JavaResourcePersistentType typeResource = getJpaProject().getJavaResourcePersistentType(FULLY_QUALIFIED_TYPE_NAME);
- DiscriminatorColumnAnnotation discriminatorColumn = (DiscriminatorColumnAnnotation) typeResource.getSupportingAnnotation(JPA.DISCRIMINATOR_COLUMN);
- discriminatorColumn.setLength(Integer.valueOf(66));
-
- assertEquals(Integer.valueOf(66), getJavaEntity().getDiscriminatorColumn().getSpecifiedLength());
- assertEquals(66, getJavaEntity().getDiscriminatorColumn().getLength());
- discriminatorColumn.setName(null);
- discriminatorColumn.setLength(null);
-
- assertNull(typeResource.getSupportingAnnotation(JPA.DISCRIMINATOR_COLUMN));
- assertNull(getJavaEntity().getDiscriminatorColumn().getSpecifiedLength());
- }
-
- public void testSetSpecifiedLength() throws Exception {
- createTestEntityWithDiscriminatorColumn();
- addXmlClassRef(FULLY_QUALIFIED_TYPE_NAME);
-
- assertNull(getJavaEntity().getDiscriminatorColumn().getSpecifiedLength());
-
- getJavaEntity().getDiscriminatorColumn().setSpecifiedLength(Integer.valueOf(100));
-
- JavaResourcePersistentType typeResource = getJpaProject().getJavaResourcePersistentType(FULLY_QUALIFIED_TYPE_NAME);
- DiscriminatorColumnAnnotation discriminatorColumn = (DiscriminatorColumnAnnotation) typeResource.getSupportingAnnotation(JPA.DISCRIMINATOR_COLUMN);
-
- assertEquals(Integer.valueOf(100), discriminatorColumn.getLength());
-
- getJavaEntity().getDiscriminatorColumn().setSpecifiedName(null);
- getJavaEntity().getDiscriminatorColumn().setSpecifiedLength(null);
- assertNull(typeResource.getSupportingAnnotation(JPA.DISCRIMINATOR_COLUMN));
- }
-
- public void testGetLengthUpdatesFromResourceChange() throws Exception {
- createTestEntity();
- addXmlClassRef(FULLY_QUALIFIED_TYPE_NAME);
-
- assertNull(getJavaEntity().getDiscriminatorColumn().getSpecifiedLength());
-
- JavaResourcePersistentType typeResource = getJpaProject().getJavaResourcePersistentType(FULLY_QUALIFIED_TYPE_NAME);
- DiscriminatorColumnAnnotation column = (DiscriminatorColumnAnnotation) typeResource.addSupportingAnnotation(JPA.DISCRIMINATOR_COLUMN);
-
- column.setLength(Integer.valueOf(78));
- assertEquals(Integer.valueOf(78), getJavaEntity().getDiscriminatorColumn().getSpecifiedLength());
- assertEquals(78, getJavaEntity().getDiscriminatorColumn().getLength());
-
- column.setLength(null);
- assertNull(getJavaEntity().getDiscriminatorColumn().getSpecifiedLength());
- assertEquals(0, getJavaEntity().getDiscriminatorColumn().getLength());
-
- createTestSubType();
- addXmlClassRef(FULLY_QUALIFIED_TYPE_NAME);
- assertEquals(DiscriminatorColumn.DEFAULT_LENGTH, getJavaEntity().getDiscriminatorColumn().getLength());
- }
-
-
- public void testGetColumnDefinition() throws Exception {
- createTestEntityWithDiscriminatorColumn();
- addXmlClassRef(FULLY_QUALIFIED_TYPE_NAME);
-
- assertNull(getJavaEntity().getDiscriminatorColumn().getColumnDefinition());
-
- JavaResourcePersistentType typeResource = getJpaProject().getJavaResourcePersistentType(FULLY_QUALIFIED_TYPE_NAME);
- DiscriminatorColumnAnnotation column = (DiscriminatorColumnAnnotation) typeResource.getSupportingAnnotation(JPA.DISCRIMINATOR_COLUMN);
- column.setColumnDefinition(COLUMN_DEFINITION);
-
- assertEquals(COLUMN_DEFINITION, getJavaEntity().getDiscriminatorColumn().getColumnDefinition());
-
- column.setColumnDefinition(null);
-
- assertNull(getJavaEntity().getDiscriminatorColumn().getColumnDefinition());
-
- typeResource.removeSupportingAnnotation(JPA.DISCRIMINATOR_COLUMN);
- }
-
- public void testSetColumnDefinition() throws Exception {
- createTestEntityWithDiscriminatorColumn();
- addXmlClassRef(FULLY_QUALIFIED_TYPE_NAME);
-
- getJavaEntity().getDiscriminatorColumn().setColumnDefinition("foo");
-
- JavaResourcePersistentType typeResource = getJpaProject().getJavaResourcePersistentType(FULLY_QUALIFIED_TYPE_NAME);
- DiscriminatorColumnAnnotation column = (DiscriminatorColumnAnnotation) typeResource.getSupportingAnnotation(JPA.DISCRIMINATOR_COLUMN);
-
- assertEquals("foo", column.getColumnDefinition());
-
- getJavaEntity().getDiscriminatorColumn().setColumnDefinition(null);
- column = (DiscriminatorColumnAnnotation) typeResource.getSupportingAnnotation(JPA.DISCRIMINATOR_COLUMN);
- assertNull(column.getColumnDefinition());
- }
-
- public void testDefaults() throws Exception {
- createTestAbstractEntity();
- createTestSubType();
- addXmlClassRef(FULLY_QUALIFIED_TYPE_NAME);
- addXmlClassRef(PACKAGE_NAME + "." + "AnnotationTestTypeChild");
-
- ListIterator<ClassRef> classRefs = getPersistenceUnit().specifiedClassRefs();
- JavaEntity abstractEntity = (JavaEntity) classRefs.next().getJavaPersistentType().getMapping();
- JavaEntity childEntity = (JavaEntity) classRefs.next().getJavaPersistentType().getMapping();
-
- //test defaults with single-table inheritance, no specified discriminator column set
- assertEquals(InheritanceType.SINGLE_TABLE, abstractEntity.getDefaultInheritanceStrategy());
- assertEquals(DiscriminatorColumn.DEFAULT_NAME, abstractEntity.getDiscriminatorColumn().getDefaultName());
- assertEquals(DiscriminatorColumn.DEFAULT_LENGTH, abstractEntity.getDiscriminatorColumn().getDefaultLength());
- assertEquals(DiscriminatorColumn.DEFAULT_DISCRIMINATOR_TYPE, abstractEntity.getDiscriminatorColumn().getDefaultDiscriminatorType());
-
- assertEquals(InheritanceType.SINGLE_TABLE, childEntity.getDefaultInheritanceStrategy());
- assertEquals(DiscriminatorColumn.DEFAULT_NAME, childEntity.getDiscriminatorColumn().getDefaultName());
- assertEquals(DiscriminatorColumn.DEFAULT_LENGTH, childEntity.getDiscriminatorColumn().getDefaultLength());
- assertEquals(DiscriminatorColumn.DEFAULT_DISCRIMINATOR_TYPE, childEntity.getDiscriminatorColumn().getDefaultDiscriminatorType());
-
-
- //test defaults with single-table inheritance, specified discriminator column set on root
- abstractEntity.getDiscriminatorColumn().setSpecifiedName("DTYPE2");
- abstractEntity.getDiscriminatorColumn().setSpecifiedLength(Integer.valueOf(5));
- abstractEntity.getDiscriminatorColumn().setSpecifiedDiscriminatorType(DiscriminatorType.CHAR);
-
- assertEquals(InheritanceType.SINGLE_TABLE, abstractEntity.getDefaultInheritanceStrategy());
- assertEquals(DiscriminatorColumn.DEFAULT_NAME, abstractEntity.getDiscriminatorColumn().getDefaultName());
- assertEquals(DiscriminatorColumn.DEFAULT_LENGTH, abstractEntity.getDiscriminatorColumn().getDefaultLength());
- assertEquals(DiscriminatorColumn.DEFAULT_DISCRIMINATOR_TYPE, abstractEntity.getDiscriminatorColumn().getDefaultDiscriminatorType());
- assertEquals("DTYPE2", abstractEntity.getDiscriminatorColumn().getSpecifiedName());
- assertEquals(Integer.valueOf(5), abstractEntity.getDiscriminatorColumn().getSpecifiedLength());
- assertEquals(DiscriminatorType.CHAR, abstractEntity.getDiscriminatorColumn().getSpecifiedDiscriminatorType());
-
- assertEquals(InheritanceType.SINGLE_TABLE, childEntity.getDefaultInheritanceStrategy());
- assertEquals("DTYPE2", childEntity.getDiscriminatorColumn().getDefaultName());
- assertEquals(5, childEntity.getDiscriminatorColumn().getDefaultLength());
- assertEquals(DiscriminatorType.CHAR, childEntity.getDiscriminatorColumn().getDefaultDiscriminatorType());
- assertEquals(null, childEntity.getDiscriminatorColumn().getSpecifiedName());
- assertEquals(null, childEntity.getDiscriminatorColumn().getSpecifiedLength());
- assertEquals(null, childEntity.getDiscriminatorColumn().getSpecifiedDiscriminatorType());
-
-
- //test defaults with table-per-class inheritance, discriminator column does not apply
- abstractEntity.getDiscriminatorColumn().setSpecifiedName(null);
- abstractEntity.getDiscriminatorColumn().setSpecifiedLength(null);
- abstractEntity.getDiscriminatorColumn().setSpecifiedDiscriminatorType(null);
- abstractEntity.setSpecifiedInheritanceStrategy(InheritanceType.TABLE_PER_CLASS);
-
- assertEquals(InheritanceType.TABLE_PER_CLASS, abstractEntity.getInheritanceStrategy());
- assertEquals(null, abstractEntity.getDiscriminatorColumn().getDefaultName());
- assertEquals(0, abstractEntity.getDiscriminatorColumn().getDefaultLength());
- assertEquals(null, abstractEntity.getDiscriminatorColumn().getDefaultDiscriminatorType());
-
- assertEquals(InheritanceType.TABLE_PER_CLASS, childEntity.getDefaultInheritanceStrategy());
- assertEquals(null, childEntity.getDiscriminatorColumn().getDefaultName());
- assertEquals(0, childEntity.getDiscriminatorColumn().getDefaultLength());
- assertEquals(null, childEntity.getDiscriminatorColumn().getDefaultDiscriminatorType());
- }
-}
diff --git a/jpa/tests/org.eclipse.jpt.core.tests/src/org/eclipse/jpt/core/tests/internal/context/java/JavaEmbeddableTests.java b/jpa/tests/org.eclipse.jpt.core.tests/src/org/eclipse/jpt/core/tests/internal/context/java/JavaEmbeddableTests.java
deleted file mode 100644
index 176178bb91..0000000000
--- a/jpa/tests/org.eclipse.jpt.core.tests/src/org/eclipse/jpt/core/tests/internal/context/java/JavaEmbeddableTests.java
+++ /dev/null
@@ -1,177 +0,0 @@
-/*******************************************************************************
- * Copyright (c) 2007, 2008 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.
- *
- * Contributors:
- * Oracle - initial API and implementation
- ******************************************************************************/
-package org.eclipse.jpt.core.tests.internal.context.java;
-
-import java.util.Iterator;
-import org.eclipse.jdt.core.ICompilationUnit;
-import org.eclipse.jpt.core.MappingKeys;
-import org.eclipse.jpt.core.context.Embeddable;
-import org.eclipse.jpt.core.context.Entity;
-import org.eclipse.jpt.core.context.MappedSuperclass;
-import org.eclipse.jpt.core.internal.context.java.JavaNullTypeMapping;
-import org.eclipse.jpt.core.resource.java.EmbeddableAnnotation;
-import org.eclipse.jpt.core.resource.java.JPA;
-import org.eclipse.jpt.core.resource.java.JavaResourcePersistentType;
-import org.eclipse.jpt.core.tests.internal.context.ContextModelTestCase;
-import org.eclipse.jpt.utility.internal.iterators.ArrayIterator;
-
-public class JavaEmbeddableTests extends ContextModelTestCase
-{
-
- private ICompilationUnit createTestEmbeddable() throws Exception {
- return this.createTestType(new DefaultAnnotationWriter() {
- @Override
- public Iterator<String> imports() {
- return new ArrayIterator<String>(JPA.EMBEDDABLE);
- }
- @Override
- public void appendTypeAnnotationTo(StringBuilder sb) {
- sb.append("@Embeddable");
- }
- });
- }
-
-
- public JavaEmbeddableTests(String name) {
- super(name);
- }
-
- public void testMorphToEntity() throws Exception {
- createTestEmbeddable();
- addXmlClassRef(FULLY_QUALIFIED_TYPE_NAME);
-
- getJavaPersistentType().setMappingKey(MappingKeys.ENTITY_TYPE_MAPPING_KEY);
- assertTrue(getJavaPersistentType().getMapping() instanceof Entity);
-
- JavaResourcePersistentType typeResource = getJpaProject().getJavaResourcePersistentType(FULLY_QUALIFIED_TYPE_NAME);
- assertNull(typeResource.getMappingAnnotation(EmbeddableAnnotation.ANNOTATION_NAME));
- }
-
- public void testMorphToMappedSuperclass() throws Exception {
- createTestEmbeddable();
- addXmlClassRef(FULLY_QUALIFIED_TYPE_NAME);
-
- getJavaPersistentType().setMappingKey(MappingKeys.MAPPED_SUPERCLASS_TYPE_MAPPING_KEY);
- assertTrue(getJavaPersistentType().getMapping() instanceof MappedSuperclass);
-
- JavaResourcePersistentType typeResource = getJpaProject().getJavaResourcePersistentType(FULLY_QUALIFIED_TYPE_NAME);
- assertNull(typeResource.getMappingAnnotation(EmbeddableAnnotation.ANNOTATION_NAME));
- }
-
- public void testMorphToNull() throws Exception {
- createTestEmbeddable();
- addXmlClassRef(FULLY_QUALIFIED_TYPE_NAME);
-
- getJavaPersistentType().setMappingKey(MappingKeys.NULL_TYPE_MAPPING_KEY);
- assertTrue(getJavaPersistentType().getMapping() instanceof JavaNullTypeMapping);
-
- JavaResourcePersistentType typeResource = getJpaProject().getJavaResourcePersistentType(FULLY_QUALIFIED_TYPE_NAME);
- assertNull(typeResource.getMappingAnnotation(EmbeddableAnnotation.ANNOTATION_NAME));
- }
-
- public void testEmbeddable() throws Exception {
- createTestEmbeddable();
- addXmlClassRef(FULLY_QUALIFIED_TYPE_NAME);
- assertTrue(getJavaPersistentType().getMapping() instanceof Embeddable);
- }
-
- public void testOverridableAttributeNames() throws Exception {
- createTestEmbeddable();
- addXmlClassRef(FULLY_QUALIFIED_TYPE_NAME);
-
- Embeddable embeddable = (Embeddable) getJavaPersistentType().getMapping();
- Iterator<String> overridableAttributeNames = embeddable.overridableAttributeNames();
- assertFalse(overridableAttributeNames.hasNext());
- }
-
- public void testOverridableAssociationNames() throws Exception {
- createTestEmbeddable();
- addXmlClassRef(FULLY_QUALIFIED_TYPE_NAME);
-
- Embeddable embeddable = (Embeddable) getJavaPersistentType().getMapping();
- Iterator<String> overridableAssociationNames = embeddable.overridableAssociationNames();
- assertFalse(overridableAssociationNames.hasNext());
- }
-
- public void testTableNameIsInvalid() throws Exception {
- createTestEmbeddable();
- addXmlClassRef(FULLY_QUALIFIED_TYPE_NAME);
-
- Embeddable embeddable = (Embeddable) getJavaPersistentType().getMapping();
-
- assertFalse(embeddable.tableNameIsInvalid(FULLY_QUALIFIED_TYPE_NAME));
- assertFalse(embeddable.tableNameIsInvalid("FOO"));
- }
-
- public void testAttributeMappingKeyAllowed() throws Exception {
- createTestEmbeddable();
- addXmlClassRef(FULLY_QUALIFIED_TYPE_NAME);
-
- Embeddable embeddable = (Embeddable) getJavaPersistentType().getMapping();
- assertTrue(embeddable.attributeMappingKeyAllowed(MappingKeys.BASIC_ATTRIBUTE_MAPPING_KEY));
- assertTrue(embeddable.attributeMappingKeyAllowed(MappingKeys.TRANSIENT_ATTRIBUTE_MAPPING_KEY));
- assertFalse(embeddable.attributeMappingKeyAllowed(MappingKeys.ID_ATTRIBUTE_MAPPING_KEY));
- assertFalse(embeddable.attributeMappingKeyAllowed(MappingKeys.EMBEDDED_ATTRIBUTE_MAPPING_KEY));
- assertFalse(embeddable.attributeMappingKeyAllowed(MappingKeys.EMBEDDED_ID_ATTRIBUTE_MAPPING_KEY));
- assertFalse(embeddable.attributeMappingKeyAllowed(MappingKeys.VERSION_ATTRIBUTE_MAPPING_KEY));
- assertFalse(embeddable.attributeMappingKeyAllowed(MappingKeys.ONE_TO_ONE_ATTRIBUTE_MAPPING_KEY));
- assertFalse(embeddable.attributeMappingKeyAllowed(MappingKeys.MANY_TO_ONE_ATTRIBUTE_MAPPING_KEY));
- assertFalse(embeddable.attributeMappingKeyAllowed(MappingKeys.ONE_TO_MANY_ATTRIBUTE_MAPPING_KEY));
- assertFalse(embeddable.attributeMappingKeyAllowed(MappingKeys.MANY_TO_MANY_ATTRIBUTE_MAPPING_KEY));
- }
-
-
- public void testAssociatedTables() throws Exception {
- createTestEmbeddable();
- addXmlClassRef(FULLY_QUALIFIED_TYPE_NAME);
-
- Embeddable embeddable = (Embeddable) getJavaPersistentType().getMapping();
-
- assertFalse(embeddable.associatedTables().hasNext());
- }
-
- public void testAssociatedTablesIncludingInherited() throws Exception {
- createTestEmbeddable();
- addXmlClassRef(FULLY_QUALIFIED_TYPE_NAME);
-
- Embeddable embeddable = (Embeddable) getJavaPersistentType().getMapping();
-
- assertFalse(embeddable.associatedTablesIncludingInherited().hasNext());
- }
-
- public void testAssociatedTableNamesIncludingInherited() throws Exception {
- createTestEmbeddable();
- addXmlClassRef(FULLY_QUALIFIED_TYPE_NAME);
-
- Embeddable embeddable = (Embeddable) getJavaPersistentType().getMapping();
-
- assertFalse(embeddable.associatedTableNamesIncludingInherited().hasNext());
- }
-
- public void testAllOverridableAttributeNames() throws Exception {
- createTestEmbeddable();
- addXmlClassRef(FULLY_QUALIFIED_TYPE_NAME);
-
- Embeddable embeddable = (Embeddable) getJavaPersistentType().getMapping();
- Iterator<String> overridableAttributeNames = embeddable.overridableAttributeNames();
- assertFalse(overridableAttributeNames.hasNext());
- }
-
- //TODO need to create a subclass mappedSuperclass and test this
- public void testAllOverridableAssociationNames() throws Exception {
- createTestEmbeddable();
- addXmlClassRef(FULLY_QUALIFIED_TYPE_NAME);
-
- Embeddable embeddable = (Embeddable) getJavaPersistentType().getMapping();
- Iterator<String> overridableAssociationNames = embeddable.overridableAssociationNames();
- assertFalse(overridableAssociationNames.hasNext());
- }
-
-}
diff --git a/jpa/tests/org.eclipse.jpt.core.tests/src/org/eclipse/jpt/core/tests/internal/context/java/JavaEmbeddedIdMappingTests.java b/jpa/tests/org.eclipse.jpt.core.tests/src/org/eclipse/jpt/core/tests/internal/context/java/JavaEmbeddedIdMappingTests.java
deleted file mode 100644
index 37c1b40dde..0000000000
--- a/jpa/tests/org.eclipse.jpt.core.tests/src/org/eclipse/jpt/core/tests/internal/context/java/JavaEmbeddedIdMappingTests.java
+++ /dev/null
@@ -1,635 +0,0 @@
-/*******************************************************************************
- * Copyright (c) 2007, 2008 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.
- *
- * Contributors:
- * Oracle - initial API and implementation
- ******************************************************************************/
-package org.eclipse.jpt.core.tests.internal.context.java;
-
-import java.util.Iterator;
-import java.util.ListIterator;
-
-import org.eclipse.jdt.core.ICompilationUnit;
-import org.eclipse.jpt.core.MappingKeys;
-import org.eclipse.jpt.core.context.AttributeOverride;
-import org.eclipse.jpt.core.context.BasicMapping;
-import org.eclipse.jpt.core.context.Embeddable;
-import org.eclipse.jpt.core.context.EmbeddedIdMapping;
-import org.eclipse.jpt.core.context.EmbeddedMapping;
-import org.eclipse.jpt.core.context.IdMapping;
-import org.eclipse.jpt.core.context.ManyToManyMapping;
-import org.eclipse.jpt.core.context.ManyToOneMapping;
-import org.eclipse.jpt.core.context.OneToManyMapping;
-import org.eclipse.jpt.core.context.OneToOneMapping;
-import org.eclipse.jpt.core.context.PersistentAttribute;
-import org.eclipse.jpt.core.context.TransientMapping;
-import org.eclipse.jpt.core.context.VersionMapping;
-import org.eclipse.jpt.core.context.java.JavaAttributeOverride;
-import org.eclipse.jpt.core.context.persistence.ClassRef;
-import org.eclipse.jpt.core.internal.context.java.GenericJavaNullAttributeMapping;
-import org.eclipse.jpt.core.resource.java.AttributeOverrideAnnotation;
-import org.eclipse.jpt.core.resource.java.AttributeOverridesAnnotation;
-import org.eclipse.jpt.core.resource.java.BasicAnnotation;
-import org.eclipse.jpt.core.resource.java.EmbeddedAnnotation;
-import org.eclipse.jpt.core.resource.java.EmbeddedIdAnnotation;
-import org.eclipse.jpt.core.resource.java.IdAnnotation;
-import org.eclipse.jpt.core.resource.java.JPA;
-import org.eclipse.jpt.core.resource.java.JavaResourcePersistentAttribute;
-import org.eclipse.jpt.core.resource.java.JavaResourcePersistentType;
-import org.eclipse.jpt.core.resource.java.ManyToManyAnnotation;
-import org.eclipse.jpt.core.resource.java.ManyToOneAnnotation;
-import org.eclipse.jpt.core.resource.java.NestableAnnotation;
-import org.eclipse.jpt.core.resource.java.OneToManyAnnotation;
-import org.eclipse.jpt.core.resource.java.OneToOneAnnotation;
-import org.eclipse.jpt.core.resource.java.TransientAnnotation;
-import org.eclipse.jpt.core.resource.java.VersionAnnotation;
-import org.eclipse.jpt.core.tests.internal.context.ContextModelTestCase;
-import org.eclipse.jpt.core.tests.internal.projects.TestJavaProject.SourceWriter;
-import org.eclipse.jpt.utility.internal.iterators.ArrayIterator;
-
-@SuppressWarnings("nls")
-public class JavaEmbeddedIdMappingTests extends ContextModelTestCase
-{
-
- public static final String EMBEDDABLE_TYPE_NAME = "MyEmbeddable";
- public static final String FULLY_QUALIFIED_EMBEDDABLE_TYPE_NAME = PACKAGE_NAME + "." + EMBEDDABLE_TYPE_NAME;
-
- private ICompilationUnit createTestEntityWithEmbeddedIdMapping() throws Exception {
- return this.createTestType(new DefaultAnnotationWriter() {
- @Override
- public Iterator<String> imports() {
- return new ArrayIterator<String>(JPA.ENTITY, JPA.EMBEDDED_ID);
- }
- @Override
- public void appendTypeAnnotationTo(StringBuilder sb) {
- sb.append("@Entity").append(CR);
- }
-
- @Override
- public void appendIdFieldAnnotationTo(StringBuilder sb) {
- sb.append("@EmbeddedId").append(CR);
- sb.append(CR);
- sb.append(" private " + EMBEDDABLE_TYPE_NAME +" myEmbeddedId;").append(CR);
- sb.append(CR);
- }
- });
- }
-
- private void createEmbeddableType() throws Exception {
- SourceWriter sourceWriter = new SourceWriter() {
- public void appendSourceTo(StringBuilder sb) {
- sb.append(CR);
- sb.append("import ");
- sb.append(JPA.EMBEDDABLE);
- sb.append(";");
- sb.append(CR);
- sb.append("@Embeddable");
- sb.append(CR);
- sb.append("public class ").append(EMBEDDABLE_TYPE_NAME).append(" {");
- sb.append(CR);
- sb.append(" private String city;").append(CR);
- sb.append(CR);
- sb.append(" private String state;").append(CR);
- sb.append(CR);
- sb.append(" ");
- sb.append("}").append(CR);
- }
- };
- this.javaProject.createCompilationUnit(PACKAGE_NAME, EMBEDDABLE_TYPE_NAME + ".java", sourceWriter);
- }
-
-
- public JavaEmbeddedIdMappingTests(String name) {
- super(name);
- }
-
- public void testMorphToBasicMapping() throws Exception {
- createTestEntityWithEmbeddedIdMapping();
- createEmbeddableType();
- addXmlClassRef(FULLY_QUALIFIED_TYPE_NAME);
-
- PersistentAttribute persistentAttribute = getJavaPersistentType().attributes().next();
- EmbeddedIdMapping embeddedIdMapping = (EmbeddedIdMapping) persistentAttribute.getMapping();
- JavaResourcePersistentType typeResource = getJpaProject().getJavaResourcePersistentType(FULLY_QUALIFIED_TYPE_NAME);
- JavaResourcePersistentAttribute attributeResource = typeResource.persistableAttributes().next();
- attributeResource.addSupportingAnnotation(0, JPA.ATTRIBUTE_OVERRIDE, JPA.ATTRIBUTE_OVERRIDES);
- assertFalse(embeddedIdMapping.isDefault());
-
- persistentAttribute.setSpecifiedMappingKey(MappingKeys.BASIC_ATTRIBUTE_MAPPING_KEY);
- assertTrue(persistentAttribute.getMapping() instanceof BasicMapping);
- assertFalse(persistentAttribute.getMapping().isDefault());
-
- assertNull(attributeResource.getMappingAnnotation(EmbeddedIdAnnotation.ANNOTATION_NAME));
- assertNotNull(attributeResource.getMappingAnnotation(BasicAnnotation.ANNOTATION_NAME));
- assertNull(attributeResource.getSupportingAnnotation(AttributeOverrideAnnotation.ANNOTATION_NAME));
- }
-
- public void testMorphToDefault() throws Exception {
- createTestEntityWithEmbeddedIdMapping();
- createEmbeddableType();
- addXmlClassRef(FULLY_QUALIFIED_TYPE_NAME);
- addXmlClassRef(FULLY_QUALIFIED_EMBEDDABLE_TYPE_NAME);
-
- PersistentAttribute persistentAttribute = getJavaPersistentType().attributes().next();
- EmbeddedIdMapping embeddedIdMapping = (EmbeddedIdMapping) persistentAttribute.getMapping();
- JavaResourcePersistentType typeResource = getJpaProject().getJavaResourcePersistentType(FULLY_QUALIFIED_TYPE_NAME);
- JavaResourcePersistentAttribute attributeResource = typeResource.persistableAttributes().next();
- attributeResource.addSupportingAnnotation(0, JPA.ATTRIBUTE_OVERRIDE, JPA.ATTRIBUTE_OVERRIDES);
- assertFalse(embeddedIdMapping.isDefault());
-
- persistentAttribute.setSpecifiedMappingKey(MappingKeys.NULL_ATTRIBUTE_MAPPING_KEY);
- assertTrue(((EmbeddedMapping) persistentAttribute.getMapping()).attributeOverrides().hasNext());
- assertTrue(persistentAttribute.getMapping().isDefault());
-
- assertNull(attributeResource.getMappingAnnotation(EmbeddedIdAnnotation.ANNOTATION_NAME));
- assertNotNull(attributeResource.getSupportingAnnotation(AttributeOverrideAnnotation.ANNOTATION_NAME));
- }
-
- public void testDefaultEmbeddedIdMapping() throws Exception {
- createTestEntityWithEmbeddedIdMapping();
- addXmlClassRef(FULLY_QUALIFIED_TYPE_NAME);
-
- PersistentAttribute persistentAttribute = getJavaPersistentType().attributes().next();
- EmbeddedIdMapping embeddedIdMapping = (EmbeddedIdMapping) persistentAttribute.getMapping();
- assertFalse(embeddedIdMapping.isDefault());
-
- persistentAttribute.setSpecifiedMappingKey(MappingKeys.NULL_ATTRIBUTE_MAPPING_KEY);
- assertTrue(persistentAttribute.getMapping() instanceof GenericJavaNullAttributeMapping);
- assertTrue(persistentAttribute.getMapping().isDefault());
-
- createEmbeddableType();
- addXmlClassRef(FULLY_QUALIFIED_EMBEDDABLE_TYPE_NAME);
- assertTrue(persistentAttribute.getMapping() instanceof EmbeddedMapping);
- assertTrue(persistentAttribute.getMapping().isDefault());
- }
-
- public void testMorphToVersionMapping() throws Exception {
- createTestEntityWithEmbeddedIdMapping();
- createEmbeddableType();
- addXmlClassRef(FULLY_QUALIFIED_TYPE_NAME);
-
- PersistentAttribute persistentAttribute = getJavaPersistentType().attributes().next();
- EmbeddedIdMapping embeddedIdMapping = (EmbeddedIdMapping) persistentAttribute.getMapping();
- JavaResourcePersistentType typeResource = getJpaProject().getJavaResourcePersistentType(FULLY_QUALIFIED_TYPE_NAME);
- JavaResourcePersistentAttribute attributeResource = typeResource.persistableAttributes().next();
- attributeResource.addSupportingAnnotation(0, JPA.ATTRIBUTE_OVERRIDE, JPA.ATTRIBUTE_OVERRIDES);
- assertFalse(embeddedIdMapping.isDefault());
-
- persistentAttribute.setSpecifiedMappingKey(MappingKeys.VERSION_ATTRIBUTE_MAPPING_KEY);
- assertTrue(persistentAttribute.getMapping() instanceof VersionMapping);
-
- assertNull(attributeResource.getMappingAnnotation(EmbeddedIdAnnotation.ANNOTATION_NAME));
- assertNotNull(attributeResource.getMappingAnnotation(VersionAnnotation.ANNOTATION_NAME));
- assertNull(attributeResource.getSupportingAnnotation(AttributeOverrideAnnotation.ANNOTATION_NAME));
- }
-
- public void testMorphToTransientMapping() throws Exception {
- createTestEntityWithEmbeddedIdMapping();
- createEmbeddableType();
- addXmlClassRef(FULLY_QUALIFIED_TYPE_NAME);
-
- PersistentAttribute persistentAttribute = getJavaPersistentType().attributes().next();
- EmbeddedIdMapping embeddedIdMapping = (EmbeddedIdMapping) persistentAttribute.getMapping();
- JavaResourcePersistentType typeResource = getJpaProject().getJavaResourcePersistentType(FULLY_QUALIFIED_TYPE_NAME);
- JavaResourcePersistentAttribute attributeResource = typeResource.persistableAttributes().next();
- attributeResource.addSupportingAnnotation(0, JPA.ATTRIBUTE_OVERRIDE, JPA.ATTRIBUTE_OVERRIDES);
- assertFalse(embeddedIdMapping.isDefault());
-
- persistentAttribute.setSpecifiedMappingKey(MappingKeys.TRANSIENT_ATTRIBUTE_MAPPING_KEY);
- assertTrue(persistentAttribute.getMapping() instanceof TransientMapping);
-
- assertNull(attributeResource.getMappingAnnotation(EmbeddedIdAnnotation.ANNOTATION_NAME));
- assertNotNull(attributeResource.getMappingAnnotation(TransientAnnotation.ANNOTATION_NAME));
- assertNull(attributeResource.getSupportingAnnotation(AttributeOverrideAnnotation.ANNOTATION_NAME));
- }
-
- public void testMorphToIdMapping() throws Exception {
- createTestEntityWithEmbeddedIdMapping();
- createEmbeddableType();
- addXmlClassRef(FULLY_QUALIFIED_TYPE_NAME);
-
- PersistentAttribute persistentAttribute = getJavaPersistentType().attributes().next();
- EmbeddedIdMapping embeddedIdMapping = (EmbeddedIdMapping) persistentAttribute.getMapping();
- JavaResourcePersistentType typeResource = getJpaProject().getJavaResourcePersistentType(FULLY_QUALIFIED_TYPE_NAME);
- JavaResourcePersistentAttribute attributeResource = typeResource.persistableAttributes().next();
- attributeResource.addSupportingAnnotation(0, JPA.ATTRIBUTE_OVERRIDE, JPA.ATTRIBUTE_OVERRIDES);
- assertFalse(embeddedIdMapping.isDefault());
-
- persistentAttribute.setSpecifiedMappingKey(MappingKeys.ID_ATTRIBUTE_MAPPING_KEY);
- assertTrue(persistentAttribute.getMapping() instanceof IdMapping);
-
- assertNull(attributeResource.getMappingAnnotation(EmbeddedIdAnnotation.ANNOTATION_NAME));
- assertNotNull(attributeResource.getMappingAnnotation(IdAnnotation.ANNOTATION_NAME));
- assertNull(attributeResource.getSupportingAnnotation(AttributeOverrideAnnotation.ANNOTATION_NAME));
- }
-
- public void testMorphToEmbeddedMapping() throws Exception {
- createTestEntityWithEmbeddedIdMapping();
- createEmbeddableType();
- addXmlClassRef(FULLY_QUALIFIED_TYPE_NAME);
-
- PersistentAttribute persistentAttribute = getJavaPersistentType().attributes().next();
- EmbeddedIdMapping embeddedIdMapping = (EmbeddedIdMapping) persistentAttribute.getMapping();
- JavaResourcePersistentType typeResource = getJpaProject().getJavaResourcePersistentType(FULLY_QUALIFIED_TYPE_NAME);
- JavaResourcePersistentAttribute attributeResource = typeResource.persistableAttributes().next();
- attributeResource.addSupportingAnnotation(0, JPA.ATTRIBUTE_OVERRIDE, JPA.ATTRIBUTE_OVERRIDES);
- assertFalse(embeddedIdMapping.isDefault());
-
- persistentAttribute.setSpecifiedMappingKey(MappingKeys.EMBEDDED_ATTRIBUTE_MAPPING_KEY);
- assertTrue(persistentAttribute.getMapping() instanceof EmbeddedMapping);
-
- assertNull(attributeResource.getMappingAnnotation(EmbeddedIdAnnotation.ANNOTATION_NAME));
- assertNotNull(attributeResource.getMappingAnnotation(EmbeddedAnnotation.ANNOTATION_NAME));
- assertNotNull(attributeResource.getSupportingAnnotation(AttributeOverrideAnnotation.ANNOTATION_NAME));
- }
-
- public void testMorphToOneToOneMapping() throws Exception {
- createTestEntityWithEmbeddedIdMapping();
- createEmbeddableType();
- addXmlClassRef(FULLY_QUALIFIED_TYPE_NAME);
-
- PersistentAttribute persistentAttribute = getJavaPersistentType().attributes().next();
- EmbeddedIdMapping embeddedIdMapping = (EmbeddedIdMapping) persistentAttribute.getMapping();
- JavaResourcePersistentType typeResource = getJpaProject().getJavaResourcePersistentType(FULLY_QUALIFIED_TYPE_NAME);
- JavaResourcePersistentAttribute attributeResource = typeResource.persistableAttributes().next();
- attributeResource.addSupportingAnnotation(0, JPA.ATTRIBUTE_OVERRIDE, JPA.ATTRIBUTE_OVERRIDES);
- assertFalse(embeddedIdMapping.isDefault());
-
- persistentAttribute.setSpecifiedMappingKey(MappingKeys.ONE_TO_ONE_ATTRIBUTE_MAPPING_KEY);
- assertTrue(persistentAttribute.getMapping() instanceof OneToOneMapping);
-
- assertNull(attributeResource.getMappingAnnotation(EmbeddedIdAnnotation.ANNOTATION_NAME));
- assertNotNull(attributeResource.getMappingAnnotation(OneToOneAnnotation.ANNOTATION_NAME));
- assertNull(attributeResource.getSupportingAnnotation(AttributeOverrideAnnotation.ANNOTATION_NAME));
- }
-
- public void testMorphToOneToManyMapping() throws Exception {
- createTestEntityWithEmbeddedIdMapping();
- createEmbeddableType();
- addXmlClassRef(FULLY_QUALIFIED_TYPE_NAME);
-
- PersistentAttribute persistentAttribute = getJavaPersistentType().attributes().next();
- EmbeddedIdMapping embeddedIdMapping = (EmbeddedIdMapping) persistentAttribute.getMapping();
- JavaResourcePersistentType typeResource = getJpaProject().getJavaResourcePersistentType(FULLY_QUALIFIED_TYPE_NAME);
- JavaResourcePersistentAttribute attributeResource = typeResource.persistableAttributes().next();
- attributeResource.addSupportingAnnotation(0, JPA.ATTRIBUTE_OVERRIDE, JPA.ATTRIBUTE_OVERRIDES);
- assertFalse(embeddedIdMapping.isDefault());
-
- persistentAttribute.setSpecifiedMappingKey(MappingKeys.ONE_TO_MANY_ATTRIBUTE_MAPPING_KEY);
- assertTrue(persistentAttribute.getMapping() instanceof OneToManyMapping);
-
- assertNull(attributeResource.getMappingAnnotation(EmbeddedIdAnnotation.ANNOTATION_NAME));
- assertNotNull(attributeResource.getMappingAnnotation(OneToManyAnnotation.ANNOTATION_NAME));
- assertNull(attributeResource.getSupportingAnnotation(AttributeOverrideAnnotation.ANNOTATION_NAME));
- }
-
- public void testMorphToManyToOneMapping() throws Exception {
- createTestEntityWithEmbeddedIdMapping();
- createEmbeddableType();
- addXmlClassRef(FULLY_QUALIFIED_TYPE_NAME);
-
- PersistentAttribute persistentAttribute = getJavaPersistentType().attributes().next();
- EmbeddedIdMapping embeddedIdMapping = (EmbeddedIdMapping) persistentAttribute.getMapping();
- JavaResourcePersistentType typeResource = getJpaProject().getJavaResourcePersistentType(FULLY_QUALIFIED_TYPE_NAME);
- JavaResourcePersistentAttribute attributeResource = typeResource.persistableAttributes().next();
- attributeResource.addSupportingAnnotation(0, JPA.ATTRIBUTE_OVERRIDE, JPA.ATTRIBUTE_OVERRIDES);
- assertFalse(embeddedIdMapping.isDefault());
-
- persistentAttribute.setSpecifiedMappingKey(MappingKeys.MANY_TO_ONE_ATTRIBUTE_MAPPING_KEY);
- assertTrue(persistentAttribute.getMapping() instanceof ManyToOneMapping);
-
- assertNull(attributeResource.getMappingAnnotation(EmbeddedIdAnnotation.ANNOTATION_NAME));
- assertNotNull(attributeResource.getMappingAnnotation(ManyToOneAnnotation.ANNOTATION_NAME));
- assertNull(attributeResource.getSupportingAnnotation(AttributeOverrideAnnotation.ANNOTATION_NAME));
- }
-
- public void testMorphToManyToManyMapping() throws Exception {
- createTestEntityWithEmbeddedIdMapping();
- createEmbeddableType();
- addXmlClassRef(FULLY_QUALIFIED_TYPE_NAME);
-
- PersistentAttribute persistentAttribute = getJavaPersistentType().attributes().next();
- EmbeddedIdMapping embeddedIdMapping = (EmbeddedIdMapping) persistentAttribute.getMapping();
- JavaResourcePersistentType typeResource = getJpaProject().getJavaResourcePersistentType(FULLY_QUALIFIED_TYPE_NAME);
- JavaResourcePersistentAttribute attributeResource = typeResource.persistableAttributes().next();
- attributeResource.addSupportingAnnotation(0, JPA.ATTRIBUTE_OVERRIDE, JPA.ATTRIBUTE_OVERRIDES);
- assertFalse(embeddedIdMapping.isDefault());
-
- persistentAttribute.setSpecifiedMappingKey(MappingKeys.MANY_TO_MANY_ATTRIBUTE_MAPPING_KEY);
- assertTrue(persistentAttribute.getMapping() instanceof ManyToManyMapping);
-
- assertNull(attributeResource.getMappingAnnotation(EmbeddedIdAnnotation.ANNOTATION_NAME));
- assertNotNull(attributeResource.getMappingAnnotation(ManyToManyAnnotation.ANNOTATION_NAME));
- assertNull(attributeResource.getSupportingAnnotation(AttributeOverrideAnnotation.ANNOTATION_NAME));
- }
-
- public void testSpecifiedAttributeOverrides() throws Exception {
- createTestEntityWithEmbeddedIdMapping();
- createEmbeddableType();
- addXmlClassRef(FULLY_QUALIFIED_TYPE_NAME);
- addXmlClassRef(FULLY_QUALIFIED_EMBEDDABLE_TYPE_NAME);
-
- EmbeddedIdMapping embeddedIdMapping = (EmbeddedIdMapping) getJavaPersistentType().getAttributeNamed("myEmbeddedId").getMapping();
-
- ListIterator<JavaAttributeOverride> specifiedAttributeOverrides = embeddedIdMapping.specifiedAttributeOverrides();
-
- assertFalse(specifiedAttributeOverrides.hasNext());
-
- JavaResourcePersistentType typeResource = getJpaProject().getJavaResourcePersistentType(FULLY_QUALIFIED_TYPE_NAME);
- JavaResourcePersistentAttribute attributeResource = typeResource.persistableAttributes().next();
-
- //add an annotation to the resource model and verify the context model is updated
- AttributeOverrideAnnotation attributeOverride = (AttributeOverrideAnnotation) attributeResource.addSupportingAnnotation(0, JPA.ATTRIBUTE_OVERRIDE, JPA.ATTRIBUTE_OVERRIDES);
- attributeOverride.setName("FOO");
- specifiedAttributeOverrides = embeddedIdMapping.specifiedAttributeOverrides();
- assertEquals("FOO", specifiedAttributeOverrides.next().getName());
- assertFalse(specifiedAttributeOverrides.hasNext());
-
- attributeOverride = (AttributeOverrideAnnotation) attributeResource.addSupportingAnnotation(1, JPA.ATTRIBUTE_OVERRIDE, JPA.ATTRIBUTE_OVERRIDES);
- attributeOverride.setName("BAR");
- specifiedAttributeOverrides = embeddedIdMapping.specifiedAttributeOverrides();
- assertEquals("FOO", specifiedAttributeOverrides.next().getName());
- assertEquals("BAR", specifiedAttributeOverrides.next().getName());
- assertFalse(specifiedAttributeOverrides.hasNext());
-
-
- attributeOverride = (AttributeOverrideAnnotation) attributeResource.addSupportingAnnotation(0, JPA.ATTRIBUTE_OVERRIDE, JPA.ATTRIBUTE_OVERRIDES);
- attributeOverride.setName("BAZ");
- specifiedAttributeOverrides = embeddedIdMapping.specifiedAttributeOverrides();
- 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.moveSupportingAnnotation(1, 0, JPA.ATTRIBUTE_OVERRIDES);
- specifiedAttributeOverrides = embeddedIdMapping.specifiedAttributeOverrides();
- assertEquals("FOO", specifiedAttributeOverrides.next().getName());
- assertEquals("BAZ", specifiedAttributeOverrides.next().getName());
- assertEquals("BAR", specifiedAttributeOverrides.next().getName());
- assertFalse(specifiedAttributeOverrides.hasNext());
-
- attributeResource.removeSupportingAnnotation(0, JPA.ATTRIBUTE_OVERRIDE, JPA.ATTRIBUTE_OVERRIDES);
- specifiedAttributeOverrides = embeddedIdMapping.specifiedAttributeOverrides();
- assertEquals("BAZ", specifiedAttributeOverrides.next().getName());
- assertEquals("BAR", specifiedAttributeOverrides.next().getName());
- assertFalse(specifiedAttributeOverrides.hasNext());
-
- attributeResource.removeSupportingAnnotation(0, JPA.ATTRIBUTE_OVERRIDE, JPA.ATTRIBUTE_OVERRIDES);
- specifiedAttributeOverrides = embeddedIdMapping.specifiedAttributeOverrides();
- assertEquals("BAR", specifiedAttributeOverrides.next().getName());
- assertFalse(specifiedAttributeOverrides.hasNext());
-
-
- attributeResource.removeSupportingAnnotation(0, JPA.ATTRIBUTE_OVERRIDE, JPA.ATTRIBUTE_OVERRIDES);
- specifiedAttributeOverrides = embeddedIdMapping.specifiedAttributeOverrides();
- assertFalse(specifiedAttributeOverrides.hasNext());
- }
-
- public void testVirtualAttributeOverrides() throws Exception {
- createTestEntityWithEmbeddedIdMapping();
- createEmbeddableType();
- addXmlClassRef(FULLY_QUALIFIED_TYPE_NAME);
- addXmlClassRef(FULLY_QUALIFIED_EMBEDDABLE_TYPE_NAME);
-
- EmbeddedIdMapping embeddedMapping = (EmbeddedIdMapping) getJavaPersistentType().getAttributeNamed("myEmbeddedId").getMapping();
-
- JavaResourcePersistentType typeResource = getJpaProject().getJavaResourcePersistentType(FULLY_QUALIFIED_TYPE_NAME);
- JavaResourcePersistentAttribute attributeResource = typeResource.persistableAttributes().next();
- assertEquals("myEmbeddedId", attributeResource.getName());
- assertNull(attributeResource.getSupportingAnnotation(AttributeOverrideAnnotation.ANNOTATION_NAME));
- assertNull(attributeResource.getSupportingAnnotation(AttributeOverridesAnnotation.ANNOTATION_NAME));
-
- assertEquals(2, embeddedMapping.virtualAttributeOverridesSize());
- AttributeOverride defaultAttributeOverride = embeddedMapping.virtualAttributeOverrides().next();
- assertEquals("city", defaultAttributeOverride.getName());
- assertEquals("city", defaultAttributeOverride.getColumn().getName());
- assertEquals(TYPE_NAME, defaultAttributeOverride.getColumn().getTable());
- assertEquals(null, defaultAttributeOverride.getColumn().getColumnDefinition());
- assertEquals(true, defaultAttributeOverride.getColumn().isInsertable());
- assertEquals(true, defaultAttributeOverride.getColumn().isUpdatable());
- assertEquals(false, defaultAttributeOverride.getColumn().isUnique());
- assertEquals(true, defaultAttributeOverride.getColumn().isNullable());
- assertEquals(255, defaultAttributeOverride.getColumn().getLength());
- assertEquals(0, defaultAttributeOverride.getColumn().getPrecision());
- assertEquals(0, defaultAttributeOverride.getColumn().getScale());
-
-
- ListIterator<ClassRef> classRefs = getPersistenceUnit().specifiedClassRefs();
- classRefs.next();
- Embeddable embeddable = (Embeddable) classRefs.next().getJavaPersistentType().getMapping();
-
- BasicMapping cityMapping = (BasicMapping) embeddable.getPersistentType().getAttributeNamed("city").getMapping();
- cityMapping.getColumn().setSpecifiedName("FOO");
- cityMapping.getColumn().setSpecifiedTable("BAR");
- cityMapping.getColumn().setColumnDefinition("COLUMN_DEF");
- cityMapping.getColumn().setSpecifiedInsertable(Boolean.FALSE);
- cityMapping.getColumn().setSpecifiedUpdatable(Boolean.FALSE);
- cityMapping.getColumn().setSpecifiedUnique(Boolean.TRUE);
- cityMapping.getColumn().setSpecifiedNullable(Boolean.FALSE);
- cityMapping.getColumn().setSpecifiedLength(Integer.valueOf(5));
- cityMapping.getColumn().setSpecifiedPrecision(Integer.valueOf(6));
- cityMapping.getColumn().setSpecifiedScale(Integer.valueOf(7));
-
- assertEquals("myEmbeddedId", attributeResource.getName());
- assertNull(attributeResource.getSupportingAnnotation(AttributeOverrideAnnotation.ANNOTATION_NAME));
- assertNull(attributeResource.getSupportingAnnotation(AttributeOverridesAnnotation.ANNOTATION_NAME));
-
- assertEquals(2, embeddedMapping.virtualAttributeOverridesSize());
- defaultAttributeOverride = embeddedMapping.virtualAttributeOverrides().next();
- assertEquals("city", defaultAttributeOverride.getName());
- assertEquals("FOO", defaultAttributeOverride.getColumn().getName());
- assertEquals("BAR", defaultAttributeOverride.getColumn().getTable());
- assertEquals("COLUMN_DEF", defaultAttributeOverride.getColumn().getColumnDefinition());
- assertEquals(false, defaultAttributeOverride.getColumn().isInsertable());
- assertEquals(false, defaultAttributeOverride.getColumn().isUpdatable());
- assertEquals(true, defaultAttributeOverride.getColumn().isUnique());
- assertEquals(false, defaultAttributeOverride.getColumn().isNullable());
- assertEquals(5, defaultAttributeOverride.getColumn().getLength());
- assertEquals(6, defaultAttributeOverride.getColumn().getPrecision());
- assertEquals(7, defaultAttributeOverride.getColumn().getScale());
-
- cityMapping.getColumn().setSpecifiedName(null);
- cityMapping.getColumn().setSpecifiedTable(null);
- cityMapping.getColumn().setColumnDefinition(null);
- cityMapping.getColumn().setSpecifiedInsertable(null);
- cityMapping.getColumn().setSpecifiedUpdatable(null);
- cityMapping.getColumn().setSpecifiedUnique(null);
- cityMapping.getColumn().setSpecifiedNullable(null);
- cityMapping.getColumn().setSpecifiedLength(null);
- cityMapping.getColumn().setSpecifiedPrecision(null);
- cityMapping.getColumn().setSpecifiedScale(null);
- defaultAttributeOverride = embeddedMapping.virtualAttributeOverrides().next();
- assertEquals("city", defaultAttributeOverride.getName());
- assertEquals("city", defaultAttributeOverride.getColumn().getName());
- assertEquals(TYPE_NAME, defaultAttributeOverride.getColumn().getTable());
- assertEquals(null, defaultAttributeOverride.getColumn().getColumnDefinition());
- assertEquals(true, defaultAttributeOverride.getColumn().isInsertable());
- assertEquals(true, defaultAttributeOverride.getColumn().isUpdatable());
- assertEquals(false, defaultAttributeOverride.getColumn().isUnique());
- assertEquals(true, defaultAttributeOverride.getColumn().isNullable());
- assertEquals(255, defaultAttributeOverride.getColumn().getLength());
- assertEquals(0, defaultAttributeOverride.getColumn().getPrecision());
- assertEquals(0, defaultAttributeOverride.getColumn().getScale());
-
- AttributeOverrideAnnotation annotation = (AttributeOverrideAnnotation) attributeResource.addSupportingAnnotation(0, JPA.ATTRIBUTE_OVERRIDE, JPA.ATTRIBUTE_OVERRIDES);
- annotation.setName("city");
- assertEquals(1, embeddedMapping.virtualAttributeOverridesSize());
- }
-
- public void testSpecifiedAttributeOverridesSize() throws Exception {
- createTestEntityWithEmbeddedIdMapping();
- createEmbeddableType();
- addXmlClassRef(FULLY_QUALIFIED_TYPE_NAME);
- addXmlClassRef(FULLY_QUALIFIED_EMBEDDABLE_TYPE_NAME);
-
- EmbeddedIdMapping embeddedIdMapping = (EmbeddedIdMapping) getJavaPersistentType().getAttributeNamed("myEmbeddedId").getMapping();
- assertEquals(0, embeddedIdMapping.specifiedAttributeOverridesSize());
-
- JavaResourcePersistentType typeResource = getJpaProject().getJavaResourcePersistentType(FULLY_QUALIFIED_TYPE_NAME);
- JavaResourcePersistentAttribute attributeResource = typeResource.persistableAttributes().next();
-
- //add an annotation to the resource model and verify the context model is updated
- AttributeOverrideAnnotation attributeOverride = (AttributeOverrideAnnotation) attributeResource.addSupportingAnnotation(0, JPA.ATTRIBUTE_OVERRIDE, JPA.ATTRIBUTE_OVERRIDES);
- attributeOverride.setName("FOO");
- attributeOverride = (AttributeOverrideAnnotation) attributeResource.addSupportingAnnotation(0, JPA.ATTRIBUTE_OVERRIDE, JPA.ATTRIBUTE_OVERRIDES);
- attributeOverride.setName("BAR");
-
- assertEquals(2, embeddedIdMapping.specifiedAttributeOverridesSize());
- }
-
- public void testAttributeOverridesSize() throws Exception {
- createTestEntityWithEmbeddedIdMapping();
- createEmbeddableType();
- addXmlClassRef(FULLY_QUALIFIED_TYPE_NAME);
- addXmlClassRef(FULLY_QUALIFIED_EMBEDDABLE_TYPE_NAME);
-
- EmbeddedIdMapping embeddedIdMapping = (EmbeddedIdMapping) getJavaPersistentType().getAttributeNamed("myEmbeddedId").getMapping();
- assertEquals(2, embeddedIdMapping.attributeOverridesSize());
-
- JavaResourcePersistentType typeResource = getJpaProject().getJavaResourcePersistentType(FULLY_QUALIFIED_TYPE_NAME);
- JavaResourcePersistentAttribute attributeResource = typeResource.persistableAttributes().next();
-
- //add an annotation to the resource model and verify the context model is updated
- AttributeOverrideAnnotation attributeOverride = (AttributeOverrideAnnotation) attributeResource.addSupportingAnnotation(0, JPA.ATTRIBUTE_OVERRIDE, JPA.ATTRIBUTE_OVERRIDES);
- attributeOverride.setName("FOO");
- attributeOverride = (AttributeOverrideAnnotation) attributeResource.addSupportingAnnotation(0, JPA.ATTRIBUTE_OVERRIDE, JPA.ATTRIBUTE_OVERRIDES);
- attributeOverride.setName("BAR");
-
- assertEquals(4, embeddedIdMapping.attributeOverridesSize());
-
- attributeOverride = (AttributeOverrideAnnotation) attributeResource.addSupportingAnnotation(0, JPA.ATTRIBUTE_OVERRIDE, JPA.ATTRIBUTE_OVERRIDES);
- attributeOverride.setName("city");
- assertEquals(4, embeddedIdMapping.attributeOverridesSize());
- }
-
- public void testVirtualAttributeOverridesSize() throws Exception {
- createTestEntityWithEmbeddedIdMapping();
- createEmbeddableType();
- addXmlClassRef(FULLY_QUALIFIED_TYPE_NAME);
- addXmlClassRef(FULLY_QUALIFIED_EMBEDDABLE_TYPE_NAME);
-
- EmbeddedIdMapping embeddedIdMapping = (EmbeddedIdMapping) getJavaPersistentType().getAttributeNamed("myEmbeddedId").getMapping();
- assertEquals(2, embeddedIdMapping.virtualAttributeOverridesSize());
-
- JavaResourcePersistentType typeResource = getJpaProject().getJavaResourcePersistentType(FULLY_QUALIFIED_TYPE_NAME);
- JavaResourcePersistentAttribute attributeResource = typeResource.persistableAttributes().next();
-
- //add an annotation to the resource model and verify the context model is updated
- AttributeOverrideAnnotation attributeOverride = (AttributeOverrideAnnotation) attributeResource.addSupportingAnnotation(0, JPA.ATTRIBUTE_OVERRIDE, JPA.ATTRIBUTE_OVERRIDES);
- attributeOverride.setName("FOO");
-
- assertEquals(2, embeddedIdMapping.virtualAttributeOverridesSize());
-
- attributeOverride = (AttributeOverrideAnnotation) attributeResource.addSupportingAnnotation(0, JPA.ATTRIBUTE_OVERRIDE, JPA.ATTRIBUTE_OVERRIDES);
- attributeOverride.setName("city");
- assertEquals(1, embeddedIdMapping.virtualAttributeOverridesSize());
-
- attributeOverride = (AttributeOverrideAnnotation) attributeResource.addSupportingAnnotation(0, JPA.ATTRIBUTE_OVERRIDE, JPA.ATTRIBUTE_OVERRIDES);
- attributeOverride.setName("state");
- assertEquals(0, embeddedIdMapping.virtualAttributeOverridesSize());
- }
-
- public void testAttributeOverrideSetVirtual() throws Exception {
- createTestEntityWithEmbeddedIdMapping();
- createEmbeddableType();
- addXmlClassRef(FULLY_QUALIFIED_TYPE_NAME);
- addXmlClassRef(FULLY_QUALIFIED_EMBEDDABLE_TYPE_NAME);
-
- EmbeddedIdMapping embeddedIdMapping = (EmbeddedIdMapping) getJavaPersistentType().getAttributeNamed("myEmbeddedId").getMapping();
- embeddedIdMapping.virtualAttributeOverrides().next().setVirtual(false);
- embeddedIdMapping.virtualAttributeOverrides().next().setVirtual(false);
-
- JavaResourcePersistentType typeResource = getJpaProject().getJavaResourcePersistentType(FULLY_QUALIFIED_TYPE_NAME);
- JavaResourcePersistentAttribute attributeResource = typeResource.persistableAttributes().next();
- Iterator<NestableAnnotation> attributeOverrides = attributeResource.supportingAnnotations(AttributeOverrideAnnotation.ANNOTATION_NAME, AttributeOverridesAnnotation.ANNOTATION_NAME);
-
- assertEquals("city", ((AttributeOverrideAnnotation) attributeOverrides.next()).getName());
- assertEquals("state", ((AttributeOverrideAnnotation) attributeOverrides.next()).getName());
- assertFalse(attributeOverrides.hasNext());
-
- embeddedIdMapping.specifiedAttributeOverrides().next().setVirtual(true);
- attributeOverrides = attributeResource.supportingAnnotations(AttributeOverrideAnnotation.ANNOTATION_NAME, AttributeOverridesAnnotation.ANNOTATION_NAME);
- assertEquals("state", ((AttributeOverrideAnnotation) attributeOverrides.next()).getName());
- assertFalse(attributeOverrides.hasNext());
-
- assertEquals("city", embeddedIdMapping.virtualAttributeOverrides().next().getName());
- assertEquals(1, embeddedIdMapping.virtualAttributeOverridesSize());
-
- embeddedIdMapping.specifiedAttributeOverrides().next().setVirtual(true);
- attributeOverrides = attributeResource.supportingAnnotations(AttributeOverrideAnnotation.ANNOTATION_NAME, AttributeOverridesAnnotation.ANNOTATION_NAME);
- assertFalse(attributeOverrides.hasNext());
-
- Iterator<AttributeOverride> virtualAttributeOverrides = embeddedIdMapping.virtualAttributeOverrides();
- assertEquals("city", virtualAttributeOverrides.next().getName());
- assertEquals("state", virtualAttributeOverrides.next().getName());
- assertEquals(2, embeddedIdMapping.virtualAttributeOverridesSize());
- }
-
- public void testAttributeOverrideSetVirtual2() throws Exception {
- createTestEntityWithEmbeddedIdMapping();
- createEmbeddableType();
- addXmlClassRef(FULLY_QUALIFIED_TYPE_NAME);
- addXmlClassRef(FULLY_QUALIFIED_EMBEDDABLE_TYPE_NAME);
-
- EmbeddedIdMapping embeddedIdMapping = (EmbeddedIdMapping) getJavaPersistentType().getAttributeNamed("myEmbeddedId").getMapping();
- ListIterator<AttributeOverride> virtualAttributeOverrides = embeddedIdMapping.virtualAttributeOverrides();
- virtualAttributeOverrides.next();
- virtualAttributeOverrides.next().setVirtual(false);
- embeddedIdMapping.virtualAttributeOverrides().next().setVirtual(false);
-
- JavaResourcePersistentType typeResource = getJpaProject().getJavaResourcePersistentType(FULLY_QUALIFIED_TYPE_NAME);
- JavaResourcePersistentAttribute attributeResource = typeResource.persistableAttributes().next();
- Iterator<NestableAnnotation> attributeOverrides = attributeResource.supportingAnnotations(AttributeOverrideAnnotation.ANNOTATION_NAME, AttributeOverridesAnnotation.ANNOTATION_NAME);
-
- assertEquals("state", ((AttributeOverrideAnnotation) attributeOverrides.next()).getName());
- assertEquals("city", ((AttributeOverrideAnnotation) attributeOverrides.next()).getName());
- assertFalse(attributeOverrides.hasNext());
- }
-
-
- public void testMoveSpecifiedAttributeOverride() throws Exception {
- createTestEntityWithEmbeddedIdMapping();
- createEmbeddableType();
- addXmlClassRef(FULLY_QUALIFIED_TYPE_NAME);
- addXmlClassRef(FULLY_QUALIFIED_EMBEDDABLE_TYPE_NAME);
-
- EmbeddedIdMapping embeddedIdMapping = (EmbeddedIdMapping) getJavaPersistentType().getAttributeNamed("myEmbeddedId").getMapping();
- embeddedIdMapping.virtualAttributeOverrides().next().setVirtual(false);
- embeddedIdMapping.virtualAttributeOverrides().next().setVirtual(false);
-
- JavaResourcePersistentType typeResource = getJpaProject().getJavaResourcePersistentType(FULLY_QUALIFIED_TYPE_NAME);
- JavaResourcePersistentAttribute attributeResource = typeResource.persistableAttributes().next();
-
- attributeResource.moveSupportingAnnotation(1, 0, AttributeOverridesAnnotation.ANNOTATION_NAME);
-
- Iterator<NestableAnnotation> attributeOverrides = attributeResource.supportingAnnotations(AttributeOverrideAnnotation.ANNOTATION_NAME, AttributeOverridesAnnotation.ANNOTATION_NAME);
-
- assertEquals("state", ((AttributeOverrideAnnotation) attributeOverrides.next()).getName());
- assertEquals("city", ((AttributeOverrideAnnotation) attributeOverrides.next()).getName());
- assertFalse(attributeOverrides.hasNext());
- }
-}
diff --git a/jpa/tests/org.eclipse.jpt.core.tests/src/org/eclipse/jpt/core/tests/internal/context/java/JavaEmbeddedMappingTests.java b/jpa/tests/org.eclipse.jpt.core.tests/src/org/eclipse/jpt/core/tests/internal/context/java/JavaEmbeddedMappingTests.java
deleted file mode 100644
index 23731b4bb8..0000000000
--- a/jpa/tests/org.eclipse.jpt.core.tests/src/org/eclipse/jpt/core/tests/internal/context/java/JavaEmbeddedMappingTests.java
+++ /dev/null
@@ -1,680 +0,0 @@
-/*******************************************************************************
- * Copyright (c) 2007, 2008 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.
- *
- * Contributors:
- * Oracle - initial API and implementation
- ******************************************************************************/
-package org.eclipse.jpt.core.tests.internal.context.java;
-
-import java.util.Iterator;
-import java.util.ListIterator;
-
-import org.eclipse.jdt.core.ICompilationUnit;
-import org.eclipse.jpt.core.MappingKeys;
-import org.eclipse.jpt.core.context.AttributeOverride;
-import org.eclipse.jpt.core.context.BasicMapping;
-import org.eclipse.jpt.core.context.Embeddable;
-import org.eclipse.jpt.core.context.EmbeddedIdMapping;
-import org.eclipse.jpt.core.context.EmbeddedMapping;
-import org.eclipse.jpt.core.context.IdMapping;
-import org.eclipse.jpt.core.context.ManyToManyMapping;
-import org.eclipse.jpt.core.context.ManyToOneMapping;
-import org.eclipse.jpt.core.context.OneToManyMapping;
-import org.eclipse.jpt.core.context.OneToOneMapping;
-import org.eclipse.jpt.core.context.PersistentAttribute;
-import org.eclipse.jpt.core.context.TransientMapping;
-import org.eclipse.jpt.core.context.VersionMapping;
-import org.eclipse.jpt.core.context.java.JavaAttributeOverride;
-import org.eclipse.jpt.core.context.persistence.ClassRef;
-import org.eclipse.jpt.core.internal.context.java.GenericJavaNullAttributeMapping;
-import org.eclipse.jpt.core.resource.java.AttributeOverrideAnnotation;
-import org.eclipse.jpt.core.resource.java.AttributeOverridesAnnotation;
-import org.eclipse.jpt.core.resource.java.BasicAnnotation;
-import org.eclipse.jpt.core.resource.java.EmbeddedAnnotation;
-import org.eclipse.jpt.core.resource.java.EmbeddedIdAnnotation;
-import org.eclipse.jpt.core.resource.java.IdAnnotation;
-import org.eclipse.jpt.core.resource.java.JPA;
-import org.eclipse.jpt.core.resource.java.JavaResourcePersistentAttribute;
-import org.eclipse.jpt.core.resource.java.JavaResourcePersistentType;
-import org.eclipse.jpt.core.resource.java.ManyToManyAnnotation;
-import org.eclipse.jpt.core.resource.java.ManyToOneAnnotation;
-import org.eclipse.jpt.core.resource.java.NestableAnnotation;
-import org.eclipse.jpt.core.resource.java.OneToManyAnnotation;
-import org.eclipse.jpt.core.resource.java.OneToOneAnnotation;
-import org.eclipse.jpt.core.resource.java.TransientAnnotation;
-import org.eclipse.jpt.core.resource.java.VersionAnnotation;
-import org.eclipse.jpt.core.tests.internal.context.ContextModelTestCase;
-import org.eclipse.jpt.core.tests.internal.projects.TestJavaProject.SourceWriter;
-import org.eclipse.jpt.utility.internal.iterators.ArrayIterator;
-
-@SuppressWarnings("nls")
-public class JavaEmbeddedMappingTests extends ContextModelTestCase
-{
-
- public static final String EMBEDDABLE_TYPE_NAME = "MyEmbeddable";
- public static final String FULLY_QUALIFIED_EMBEDDABLE_TYPE_NAME = PACKAGE_NAME + "." + EMBEDDABLE_TYPE_NAME;
-
- private ICompilationUnit createTestEntityWithEmbeddedMapping() throws Exception {
-
- return this.createTestType(new DefaultAnnotationWriter() {
- @Override
- public Iterator<String> imports() {
- return new ArrayIterator<String>(JPA.ENTITY, JPA.EMBEDDED);
- }
- @Override
- public void appendTypeAnnotationTo(StringBuilder sb) {
- sb.append("@Entity").append(CR);
- }
-
- @Override
- public void appendIdFieldAnnotationTo(StringBuilder sb) {
- sb.append("@Embedded").append(CR);
- sb.append(" private " + EMBEDDABLE_TYPE_NAME + " myEmbedded;").append(CR);
- sb.append(CR);
- }
- });
- }
-
- private void createEmbeddableType() throws Exception {
- SourceWriter sourceWriter = new SourceWriter() {
- public void appendSourceTo(StringBuilder sb) {
- sb.append(CR);
- sb.append("import ");
- sb.append(JPA.EMBEDDABLE);
- sb.append(";");
- sb.append(CR);
- sb.append("@Embeddable");
- sb.append(CR);
- sb.append("public class ").append(EMBEDDABLE_TYPE_NAME).append(" {");
- sb.append(CR);
- sb.append(" private String city;").append(CR);
- sb.append(CR);
- sb.append(" private String state;").append(CR);
- sb.append(CR);
- sb.append(" ");
- sb.append("}").append(CR);
- }
- };
- this.javaProject.createCompilationUnit(PACKAGE_NAME, EMBEDDABLE_TYPE_NAME + ".java", sourceWriter);
- }
-
-
- public JavaEmbeddedMappingTests(String name) {
- super(name);
- }
-
- public void testMorphToBasicMapping() throws Exception {
- createTestEntityWithEmbeddedMapping();
- createEmbeddableType();
- addXmlClassRef(FULLY_QUALIFIED_TYPE_NAME);
-
- PersistentAttribute persistentAttribute = getJavaPersistentType().attributes().next();
- EmbeddedMapping embeddedMapping = (EmbeddedMapping) persistentAttribute.getMapping();
- assertFalse(embeddedMapping.isDefault());
-
- persistentAttribute.setSpecifiedMappingKey(MappingKeys.BASIC_ATTRIBUTE_MAPPING_KEY);
- assertTrue(persistentAttribute.getMapping() instanceof BasicMapping);
- assertFalse(persistentAttribute.getMapping().isDefault());
-
- JavaResourcePersistentType typeResource = getJpaProject().getJavaResourcePersistentType(FULLY_QUALIFIED_TYPE_NAME);
- JavaResourcePersistentAttribute attributeResource = typeResource.persistableAttributes().next();
- assertNull(attributeResource.getMappingAnnotation(EmbeddedAnnotation.ANNOTATION_NAME));
- assertNotNull(attributeResource.getMappingAnnotation(BasicAnnotation.ANNOTATION_NAME));
- assertNull(attributeResource.getSupportingAnnotation(AttributeOverrideAnnotation.ANNOTATION_NAME));
- }
-
- public void testMorphToDefault() throws Exception {
- createTestEntityWithEmbeddedMapping();
- createEmbeddableType();
- addXmlClassRef(FULLY_QUALIFIED_TYPE_NAME);
- addXmlClassRef(FULLY_QUALIFIED_EMBEDDABLE_TYPE_NAME);
-
- PersistentAttribute persistentAttribute = getJavaPersistentType().attributes().next();
- EmbeddedMapping embeddedMapping = (EmbeddedMapping) persistentAttribute.getMapping();
- JavaResourcePersistentType typeResource = getJpaProject().getJavaResourcePersistentType(FULLY_QUALIFIED_TYPE_NAME);
- JavaResourcePersistentAttribute attributeResource = typeResource.persistableAttributes().next();
- attributeResource.addSupportingAnnotation(0, JPA.ATTRIBUTE_OVERRIDE, JPA.ATTRIBUTE_OVERRIDES);
- assertFalse(embeddedMapping.isDefault());
-
- persistentAttribute.setSpecifiedMappingKey(MappingKeys.NULL_ATTRIBUTE_MAPPING_KEY);
- assertTrue(((EmbeddedMapping) persistentAttribute.getMapping()).attributeOverrides().hasNext());
- assertTrue(persistentAttribute.getMapping().isDefault());
-
- assertNull(attributeResource.getMappingAnnotation(EmbeddedAnnotation.ANNOTATION_NAME));
- assertNotNull(attributeResource.getSupportingAnnotation(AttributeOverrideAnnotation.ANNOTATION_NAME));
- }
-
- public void testDefaultEmbeddedMapping() throws Exception {
- createTestEntityWithEmbeddedMapping();
- addXmlClassRef(FULLY_QUALIFIED_TYPE_NAME);
-
- PersistentAttribute persistentAttribute = getJavaPersistentType().attributes().next();
- EmbeddedMapping embeddedMapping = (EmbeddedMapping) persistentAttribute.getMapping();
- assertFalse(embeddedMapping.isDefault());
-
- persistentAttribute.setSpecifiedMappingKey(MappingKeys.NULL_ATTRIBUTE_MAPPING_KEY);
- assertTrue(persistentAttribute.getMapping() instanceof GenericJavaNullAttributeMapping);
- assertTrue(persistentAttribute.getMapping().isDefault());
-
- createEmbeddableType();
- addXmlClassRef(FULLY_QUALIFIED_EMBEDDABLE_TYPE_NAME);
- assertTrue(persistentAttribute.getMapping() instanceof EmbeddedMapping);
- assertTrue(persistentAttribute.getMapping().isDefault());
- }
-
- public void testDefaultEmbeddedMappingGenericEmbeddable() throws Exception {
- createTestEntityWithDefaultEmbeddedMapping();
- createTestGenericEmbeddable();
- addXmlClassRef(PACKAGE_NAME + ".Entity1");
- addXmlClassRef(PACKAGE_NAME + ".Embeddable1");
-
- PersistentAttribute persistentAttribute = getJavaPersistentType().attributes().next();
- assertNull(persistentAttribute.getSpecifiedMapping());
- assertNotNull(persistentAttribute.getMapping());
- assertEquals(MappingKeys.EMBEDDED_ATTRIBUTE_MAPPING_KEY, persistentAttribute.getDefaultMappingKey());
- assertTrue(persistentAttribute.getMapping().isDefault());
- }
-
- private void createTestEntityWithDefaultEmbeddedMapping() throws Exception {
- SourceWriter sourceWriter = new SourceWriter() {
- public void appendSourceTo(StringBuilder sb) {
- sb.append(CR);
- sb.append("import ");
- sb.append(JPA.ENTITY);
- sb.append(";");
- sb.append(CR);
- sb.append("@Entity");
- sb.append(CR);
- sb.append("public class Entity1 { ").append(CR);
- sb.append("private Embeddable1<Integer> myEmbeddable;").append(CR);
- sb.append(CR);
- }
- };
- this.javaProject.createCompilationUnit(PACKAGE_NAME, "Entity1.java", sourceWriter);
- }
-
- private void createTestGenericEmbeddable() throws Exception {
- SourceWriter sourceWriter = new SourceWriter() {
- public void appendSourceTo(StringBuilder sb) {
- sb.append(CR);
- sb.append("import ");
- sb.append(JPA.EMBEDDABLE);
- sb.append(";");
- sb.append(CR);
- sb.append("@Embeddable");
- sb.append(CR);
- sb.append("public class Embeddable1<T> {}").append(CR);
- }
- };
- this.javaProject.createCompilationUnit(PACKAGE_NAME, "Embeddable1.java", sourceWriter);
- }
-
- public void testMorphToVersionMapping() throws Exception {
- createTestEntityWithEmbeddedMapping();
- createEmbeddableType();
- addXmlClassRef(FULLY_QUALIFIED_TYPE_NAME);
-
- PersistentAttribute persistentAttribute = getJavaPersistentType().attributes().next();
- EmbeddedMapping embeddedMapping = (EmbeddedMapping) persistentAttribute.getMapping();
- JavaResourcePersistentType typeResource = getJpaProject().getJavaResourcePersistentType(FULLY_QUALIFIED_TYPE_NAME);
- JavaResourcePersistentAttribute attributeResource = typeResource.persistableAttributes().next();
- attributeResource.addSupportingAnnotation(0, JPA.ATTRIBUTE_OVERRIDE, JPA.ATTRIBUTE_OVERRIDES);
- assertFalse(embeddedMapping.isDefault());
-
- persistentAttribute.setSpecifiedMappingKey(MappingKeys.VERSION_ATTRIBUTE_MAPPING_KEY);
- assertTrue(persistentAttribute.getMapping() instanceof VersionMapping);
-
- assertNull(attributeResource.getMappingAnnotation(EmbeddedAnnotation.ANNOTATION_NAME));
- assertNotNull(attributeResource.getMappingAnnotation(VersionAnnotation.ANNOTATION_NAME));
- assertNull(attributeResource.getSupportingAnnotation(AttributeOverrideAnnotation.ANNOTATION_NAME));
- }
-
- public void testMorphToTransientMapping() throws Exception {
- createTestEntityWithEmbeddedMapping();
- createEmbeddableType();
- addXmlClassRef(FULLY_QUALIFIED_TYPE_NAME);
-
- PersistentAttribute persistentAttribute = getJavaPersistentType().attributes().next();
- EmbeddedMapping embeddedMapping = (EmbeddedMapping) persistentAttribute.getMapping();
- JavaResourcePersistentType typeResource = getJpaProject().getJavaResourcePersistentType(FULLY_QUALIFIED_TYPE_NAME);
- JavaResourcePersistentAttribute attributeResource = typeResource.persistableAttributes().next();
- attributeResource.addSupportingAnnotation(0, JPA.ATTRIBUTE_OVERRIDE, JPA.ATTRIBUTE_OVERRIDES);
- assertFalse(embeddedMapping.isDefault());
-
- persistentAttribute.setSpecifiedMappingKey(MappingKeys.TRANSIENT_ATTRIBUTE_MAPPING_KEY);
- assertTrue(persistentAttribute.getMapping() instanceof TransientMapping);
-
- assertNull(attributeResource.getMappingAnnotation(EmbeddedAnnotation.ANNOTATION_NAME));
- assertNotNull(attributeResource.getMappingAnnotation(TransientAnnotation.ANNOTATION_NAME));
- assertNull(attributeResource.getSupportingAnnotation(AttributeOverrideAnnotation.ANNOTATION_NAME));
- }
-
- public void testMorphToIdMapping() throws Exception {
- createTestEntityWithEmbeddedMapping();
- createEmbeddableType();
- addXmlClassRef(FULLY_QUALIFIED_TYPE_NAME);
-
- PersistentAttribute persistentAttribute = getJavaPersistentType().attributes().next();
- EmbeddedMapping embeddedMapping = (EmbeddedMapping) persistentAttribute.getMapping();
- JavaResourcePersistentType typeResource = getJpaProject().getJavaResourcePersistentType(FULLY_QUALIFIED_TYPE_NAME);
- JavaResourcePersistentAttribute attributeResource = typeResource.persistableAttributes().next();
- attributeResource.addSupportingAnnotation(0, JPA.ATTRIBUTE_OVERRIDE, JPA.ATTRIBUTE_OVERRIDES);
- assertFalse(embeddedMapping.isDefault());
-
- persistentAttribute.setSpecifiedMappingKey(MappingKeys.ID_ATTRIBUTE_MAPPING_KEY);
- assertTrue(persistentAttribute.getMapping() instanceof IdMapping);
-
- assertNull(attributeResource.getMappingAnnotation(EmbeddedAnnotation.ANNOTATION_NAME));
- assertNotNull(attributeResource.getMappingAnnotation(IdAnnotation.ANNOTATION_NAME));
- assertNull(attributeResource.getSupportingAnnotation(AttributeOverrideAnnotation.ANNOTATION_NAME));
- }
-
- public void testMorphToEmbeddedIdMapping() throws Exception {
- createTestEntityWithEmbeddedMapping();
- createEmbeddableType();
- addXmlClassRef(FULLY_QUALIFIED_TYPE_NAME);
-
- PersistentAttribute persistentAttribute = getJavaPersistentType().attributes().next();
- EmbeddedMapping embeddedMapping = (EmbeddedMapping) persistentAttribute.getMapping();
- JavaResourcePersistentType typeResource = getJpaProject().getJavaResourcePersistentType(FULLY_QUALIFIED_TYPE_NAME);
- JavaResourcePersistentAttribute attributeResource = typeResource.persistableAttributes().next();
- attributeResource.addSupportingAnnotation(0, JPA.ATTRIBUTE_OVERRIDE, JPA.ATTRIBUTE_OVERRIDES);
- assertFalse(embeddedMapping.isDefault());
-
- persistentAttribute.setSpecifiedMappingKey(MappingKeys.EMBEDDED_ID_ATTRIBUTE_MAPPING_KEY);
- assertTrue(persistentAttribute.getMapping() instanceof EmbeddedIdMapping);
-
- assertNull(attributeResource.getMappingAnnotation(EmbeddedAnnotation.ANNOTATION_NAME));
- assertNotNull(attributeResource.getMappingAnnotation(EmbeddedIdAnnotation.ANNOTATION_NAME));
- assertNotNull(attributeResource.getSupportingAnnotation(AttributeOverrideAnnotation.ANNOTATION_NAME));
- }
-
- public void testMorphToOneToOneMapping() throws Exception {
- createTestEntityWithEmbeddedMapping();
- createEmbeddableType();
- addXmlClassRef(FULLY_QUALIFIED_TYPE_NAME);
-
- PersistentAttribute persistentAttribute = getJavaPersistentType().attributes().next();
- EmbeddedMapping embeddedMapping = (EmbeddedMapping) persistentAttribute.getMapping();
- JavaResourcePersistentType typeResource = getJpaProject().getJavaResourcePersistentType(FULLY_QUALIFIED_TYPE_NAME);
- JavaResourcePersistentAttribute attributeResource = typeResource.persistableAttributes().next();
- attributeResource.addSupportingAnnotation(0, JPA.ATTRIBUTE_OVERRIDE, JPA.ATTRIBUTE_OVERRIDES);
- assertFalse(embeddedMapping.isDefault());
-
- persistentAttribute.setSpecifiedMappingKey(MappingKeys.ONE_TO_ONE_ATTRIBUTE_MAPPING_KEY);
- assertTrue(persistentAttribute.getMapping() instanceof OneToOneMapping);
-
- assertNull(attributeResource.getMappingAnnotation(EmbeddedAnnotation.ANNOTATION_NAME));
- assertNotNull(attributeResource.getMappingAnnotation(OneToOneAnnotation.ANNOTATION_NAME));
- assertNull(attributeResource.getSupportingAnnotation(AttributeOverrideAnnotation.ANNOTATION_NAME));
- }
-
- public void testMorphToOneToManyMapping() throws Exception {
- createTestEntityWithEmbeddedMapping();
- createEmbeddableType();
- addXmlClassRef(FULLY_QUALIFIED_TYPE_NAME);
-
- PersistentAttribute persistentAttribute = getJavaPersistentType().attributes().next();
- EmbeddedMapping embeddedMapping = (EmbeddedMapping) persistentAttribute.getMapping();
- JavaResourcePersistentType typeResource = getJpaProject().getJavaResourcePersistentType(FULLY_QUALIFIED_TYPE_NAME);
- JavaResourcePersistentAttribute attributeResource = typeResource.persistableAttributes().next();
- attributeResource.addSupportingAnnotation(0, JPA.ATTRIBUTE_OVERRIDE, JPA.ATTRIBUTE_OVERRIDES);
- assertFalse(embeddedMapping.isDefault());
-
- persistentAttribute.setSpecifiedMappingKey(MappingKeys.ONE_TO_MANY_ATTRIBUTE_MAPPING_KEY);
- assertTrue(persistentAttribute.getMapping() instanceof OneToManyMapping);
-
- assertNull(attributeResource.getMappingAnnotation(EmbeddedAnnotation.ANNOTATION_NAME));
- assertNotNull(attributeResource.getMappingAnnotation(OneToManyAnnotation.ANNOTATION_NAME));
- assertNull(attributeResource.getSupportingAnnotation(AttributeOverrideAnnotation.ANNOTATION_NAME));
- }
-
- public void testMorphToManyToOneMapping() throws Exception {
- createTestEntityWithEmbeddedMapping();
- createEmbeddableType();
- addXmlClassRef(FULLY_QUALIFIED_TYPE_NAME);
-
- PersistentAttribute persistentAttribute = getJavaPersistentType().attributes().next();
- EmbeddedMapping embeddedMapping = (EmbeddedMapping) persistentAttribute.getMapping();
- JavaResourcePersistentType typeResource = getJpaProject().getJavaResourcePersistentType(FULLY_QUALIFIED_TYPE_NAME);
- JavaResourcePersistentAttribute attributeResource = typeResource.persistableAttributes().next();
- attributeResource.addSupportingAnnotation(0, JPA.ATTRIBUTE_OVERRIDE, JPA.ATTRIBUTE_OVERRIDES);
- assertFalse(embeddedMapping.isDefault());
-
- persistentAttribute.setSpecifiedMappingKey(MappingKeys.MANY_TO_ONE_ATTRIBUTE_MAPPING_KEY);
- assertTrue(persistentAttribute.getMapping() instanceof ManyToOneMapping);
-
- assertNull(attributeResource.getMappingAnnotation(EmbeddedAnnotation.ANNOTATION_NAME));
- assertNotNull(attributeResource.getMappingAnnotation(ManyToOneAnnotation.ANNOTATION_NAME));
- assertNull(attributeResource.getSupportingAnnotation(AttributeOverrideAnnotation.ANNOTATION_NAME));
- }
-
- public void testMorphToManyToManyMapping() throws Exception {
- createTestEntityWithEmbeddedMapping();
- createEmbeddableType();
- addXmlClassRef(FULLY_QUALIFIED_TYPE_NAME);
-
- PersistentAttribute persistentAttribute = getJavaPersistentType().attributes().next();
- EmbeddedMapping embeddedMapping = (EmbeddedMapping) persistentAttribute.getMapping();
- JavaResourcePersistentType typeResource = getJpaProject().getJavaResourcePersistentType(FULLY_QUALIFIED_TYPE_NAME);
- JavaResourcePersistentAttribute attributeResource = typeResource.persistableAttributes().next();
- attributeResource.addSupportingAnnotation(0, JPA.ATTRIBUTE_OVERRIDE, JPA.ATTRIBUTE_OVERRIDES);
- assertFalse(embeddedMapping.isDefault());
-
- persistentAttribute.setSpecifiedMappingKey(MappingKeys.MANY_TO_MANY_ATTRIBUTE_MAPPING_KEY);
- assertTrue(persistentAttribute.getMapping() instanceof ManyToManyMapping);
-
- assertNull(attributeResource.getMappingAnnotation(EmbeddedAnnotation.ANNOTATION_NAME));
- assertNotNull(attributeResource.getMappingAnnotation(ManyToManyAnnotation.ANNOTATION_NAME));
- assertNull(attributeResource.getSupportingAnnotation(AttributeOverrideAnnotation.ANNOTATION_NAME));
- }
-
- public void testSpecifiedAttributeOverrides() throws Exception {
- createTestEntityWithEmbeddedMapping();
- createEmbeddableType();
- addXmlClassRef(FULLY_QUALIFIED_TYPE_NAME);
- addXmlClassRef(FULLY_QUALIFIED_EMBEDDABLE_TYPE_NAME);
-
- EmbeddedMapping embeddedMapping = (EmbeddedMapping) getJavaPersistentType().getAttributeNamed("myEmbedded").getMapping();
-
- ListIterator<JavaAttributeOverride> specifiedAttributeOverrides = embeddedMapping.specifiedAttributeOverrides();
-
- assertFalse(specifiedAttributeOverrides.hasNext());
-
- JavaResourcePersistentType typeResource = getJpaProject().getJavaResourcePersistentType(FULLY_QUALIFIED_TYPE_NAME);
- JavaResourcePersistentAttribute attributeResource = typeResource.persistableAttributes().next();
-
- //add an annotation to the resource model and verify the context model is updated
- AttributeOverrideAnnotation attributeOverride = (AttributeOverrideAnnotation) attributeResource.addSupportingAnnotation(0, JPA.ATTRIBUTE_OVERRIDE, JPA.ATTRIBUTE_OVERRIDES);
- attributeOverride.setName("FOO");
- specifiedAttributeOverrides = embeddedMapping.specifiedAttributeOverrides();
- assertEquals("FOO", specifiedAttributeOverrides.next().getName());
- assertFalse(specifiedAttributeOverrides.hasNext());
-
- attributeOverride = (AttributeOverrideAnnotation) attributeResource.addSupportingAnnotation(1, JPA.ATTRIBUTE_OVERRIDE, JPA.ATTRIBUTE_OVERRIDES);
- attributeOverride.setName("BAR");
- specifiedAttributeOverrides = embeddedMapping.specifiedAttributeOverrides();
- assertEquals("FOO", specifiedAttributeOverrides.next().getName());
- assertEquals("BAR", specifiedAttributeOverrides.next().getName());
- assertFalse(specifiedAttributeOverrides.hasNext());
-
-
- attributeOverride = (AttributeOverrideAnnotation) attributeResource.addSupportingAnnotation(0, JPA.ATTRIBUTE_OVERRIDE, JPA.ATTRIBUTE_OVERRIDES);
- attributeOverride.setName("BAZ");
- specifiedAttributeOverrides = embeddedMapping.specifiedAttributeOverrides();
- 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.moveSupportingAnnotation(1, 0, JPA.ATTRIBUTE_OVERRIDES);
- specifiedAttributeOverrides = embeddedMapping.specifiedAttributeOverrides();
- assertEquals("FOO", specifiedAttributeOverrides.next().getName());
- assertEquals("BAZ", specifiedAttributeOverrides.next().getName());
- assertEquals("BAR", specifiedAttributeOverrides.next().getName());
- assertFalse(specifiedAttributeOverrides.hasNext());
-
- attributeResource.removeSupportingAnnotation(0, JPA.ATTRIBUTE_OVERRIDE, JPA.ATTRIBUTE_OVERRIDES);
- specifiedAttributeOverrides = embeddedMapping.specifiedAttributeOverrides();
- assertEquals("BAZ", specifiedAttributeOverrides.next().getName());
- assertEquals("BAR", specifiedAttributeOverrides.next().getName());
- assertFalse(specifiedAttributeOverrides.hasNext());
-
- attributeResource.removeSupportingAnnotation(0, JPA.ATTRIBUTE_OVERRIDE, JPA.ATTRIBUTE_OVERRIDES);
- specifiedAttributeOverrides = embeddedMapping.specifiedAttributeOverrides();
- assertEquals("BAR", specifiedAttributeOverrides.next().getName());
- assertFalse(specifiedAttributeOverrides.hasNext());
-
-
- attributeResource.removeSupportingAnnotation(0, JPA.ATTRIBUTE_OVERRIDE, JPA.ATTRIBUTE_OVERRIDES);
- specifiedAttributeOverrides = embeddedMapping.specifiedAttributeOverrides();
- assertFalse(specifiedAttributeOverrides.hasNext());
- }
-
- public void testVirtualAttributeOverrides() throws Exception {
- createTestEntityWithEmbeddedMapping();
- createEmbeddableType();
- addXmlClassRef(FULLY_QUALIFIED_TYPE_NAME);
- addXmlClassRef(FULLY_QUALIFIED_EMBEDDABLE_TYPE_NAME);
-
- EmbeddedMapping embeddedMapping = (EmbeddedMapping) getJavaPersistentType().getAttributeNamed("myEmbedded").getMapping();
-
- JavaResourcePersistentType typeResource = getJpaProject().getJavaResourcePersistentType(FULLY_QUALIFIED_TYPE_NAME);
- JavaResourcePersistentAttribute attributeResource = typeResource.persistableAttributes().next();
- assertEquals("myEmbedded", attributeResource.getName());
- assertNull(attributeResource.getSupportingAnnotation(AttributeOverrideAnnotation.ANNOTATION_NAME));
- assertNull(attributeResource.getSupportingAnnotation(AttributeOverridesAnnotation.ANNOTATION_NAME));
-
- assertEquals(2, embeddedMapping.virtualAttributeOverridesSize());
- AttributeOverride defaultAttributeOverride = embeddedMapping.virtualAttributeOverrides().next();
- assertEquals("city", defaultAttributeOverride.getName());
- assertEquals("city", defaultAttributeOverride.getColumn().getName());
- assertEquals(TYPE_NAME, defaultAttributeOverride.getColumn().getTable());
- assertEquals(null, defaultAttributeOverride.getColumn().getColumnDefinition());
- assertEquals(true, defaultAttributeOverride.getColumn().isInsertable());
- assertEquals(true, defaultAttributeOverride.getColumn().isUpdatable());
- assertEquals(false, defaultAttributeOverride.getColumn().isUnique());
- assertEquals(true, defaultAttributeOverride.getColumn().isNullable());
- assertEquals(255, defaultAttributeOverride.getColumn().getLength());
- assertEquals(0, defaultAttributeOverride.getColumn().getPrecision());
- assertEquals(0, defaultAttributeOverride.getColumn().getScale());
-
-
- ListIterator<ClassRef> classRefs = getPersistenceUnit().specifiedClassRefs();
- classRefs.next();
- Embeddable embeddable = (Embeddable) classRefs.next().getJavaPersistentType().getMapping();
-
- BasicMapping cityMapping = (BasicMapping) embeddable.getPersistentType().getAttributeNamed("city").getMapping();
- cityMapping.getColumn().setSpecifiedName("FOO");
- cityMapping.getColumn().setSpecifiedTable("BAR");
- cityMapping.getColumn().setColumnDefinition("COLUMN_DEF");
- cityMapping.getColumn().setSpecifiedInsertable(Boolean.FALSE);
- cityMapping.getColumn().setSpecifiedUpdatable(Boolean.FALSE);
- cityMapping.getColumn().setSpecifiedUnique(Boolean.TRUE);
- cityMapping.getColumn().setSpecifiedNullable(Boolean.FALSE);
- cityMapping.getColumn().setSpecifiedLength(Integer.valueOf(5));
- cityMapping.getColumn().setSpecifiedPrecision(Integer.valueOf(6));
- cityMapping.getColumn().setSpecifiedScale(Integer.valueOf(7));
-
- assertEquals("myEmbedded", attributeResource.getName());
- assertNull(attributeResource.getSupportingAnnotation(AttributeOverrideAnnotation.ANNOTATION_NAME));
- assertNull(attributeResource.getSupportingAnnotation(AttributeOverridesAnnotation.ANNOTATION_NAME));
-
- assertEquals(2, embeddedMapping.virtualAttributeOverridesSize());
- defaultAttributeOverride = embeddedMapping.virtualAttributeOverrides().next();
- assertEquals("city", defaultAttributeOverride.getName());
- assertEquals("FOO", defaultAttributeOverride.getColumn().getName());
- assertEquals("BAR", defaultAttributeOverride.getColumn().getTable());
- assertEquals("COLUMN_DEF", defaultAttributeOverride.getColumn().getColumnDefinition());
- assertEquals(false, defaultAttributeOverride.getColumn().isInsertable());
- assertEquals(false, defaultAttributeOverride.getColumn().isUpdatable());
- assertEquals(true, defaultAttributeOverride.getColumn().isUnique());
- assertEquals(false, defaultAttributeOverride.getColumn().isNullable());
- assertEquals(5, defaultAttributeOverride.getColumn().getLength());
- assertEquals(6, defaultAttributeOverride.getColumn().getPrecision());
- assertEquals(7, defaultAttributeOverride.getColumn().getScale());
-
- cityMapping.getColumn().setSpecifiedName(null);
- cityMapping.getColumn().setSpecifiedTable(null);
- cityMapping.getColumn().setColumnDefinition(null);
- cityMapping.getColumn().setSpecifiedInsertable(null);
- cityMapping.getColumn().setSpecifiedUpdatable(null);
- cityMapping.getColumn().setSpecifiedUnique(null);
- cityMapping.getColumn().setSpecifiedNullable(null);
- cityMapping.getColumn().setSpecifiedLength(null);
- cityMapping.getColumn().setSpecifiedPrecision(null);
- cityMapping.getColumn().setSpecifiedScale(null);
- defaultAttributeOverride = embeddedMapping.virtualAttributeOverrides().next();
- assertEquals("city", defaultAttributeOverride.getName());
- assertEquals("city", defaultAttributeOverride.getColumn().getName());
- assertEquals(TYPE_NAME, defaultAttributeOverride.getColumn().getTable());
- assertEquals(null, defaultAttributeOverride.getColumn().getColumnDefinition());
- assertEquals(true, defaultAttributeOverride.getColumn().isInsertable());
- assertEquals(true, defaultAttributeOverride.getColumn().isUpdatable());
- assertEquals(false, defaultAttributeOverride.getColumn().isUnique());
- assertEquals(true, defaultAttributeOverride.getColumn().isNullable());
- assertEquals(255, defaultAttributeOverride.getColumn().getLength());
- assertEquals(0, defaultAttributeOverride.getColumn().getPrecision());
- assertEquals(0, defaultAttributeOverride.getColumn().getScale());
-
- AttributeOverrideAnnotation annotation = (AttributeOverrideAnnotation) attributeResource.addSupportingAnnotation(0, JPA.ATTRIBUTE_OVERRIDE, JPA.ATTRIBUTE_OVERRIDES);
- annotation.setName("city");
- assertEquals(1, embeddedMapping.virtualAttributeOverridesSize());
- }
-
- public void testSpecifiedAttributeOverridesSize() throws Exception {
- createTestEntityWithEmbeddedMapping();
- createEmbeddableType();
- addXmlClassRef(FULLY_QUALIFIED_TYPE_NAME);
- addXmlClassRef(FULLY_QUALIFIED_EMBEDDABLE_TYPE_NAME);
-
- EmbeddedMapping embeddedMapping = (EmbeddedMapping) getJavaPersistentType().getAttributeNamed("myEmbedded").getMapping();
- assertEquals(0, embeddedMapping.specifiedAttributeOverridesSize());
-
- JavaResourcePersistentType typeResource = getJpaProject().getJavaResourcePersistentType(FULLY_QUALIFIED_TYPE_NAME);
- JavaResourcePersistentAttribute attributeResource = typeResource.persistableAttributes().next();
-
- //add an annotation to the resource model and verify the context model is updated
- AttributeOverrideAnnotation attributeOverride = (AttributeOverrideAnnotation) attributeResource.addSupportingAnnotation(0, JPA.ATTRIBUTE_OVERRIDE, JPA.ATTRIBUTE_OVERRIDES);
- attributeOverride.setName("FOO");
- attributeOverride = (AttributeOverrideAnnotation) attributeResource.addSupportingAnnotation(0, JPA.ATTRIBUTE_OVERRIDE, JPA.ATTRIBUTE_OVERRIDES);
- attributeOverride.setName("BAR");
-
- assertEquals(2, embeddedMapping.specifiedAttributeOverridesSize());
- }
-
- public void testAttributeOverridesSize() throws Exception {
- createTestEntityWithEmbeddedMapping();
- createEmbeddableType();
- addXmlClassRef(FULLY_QUALIFIED_TYPE_NAME);
- addXmlClassRef(FULLY_QUALIFIED_EMBEDDABLE_TYPE_NAME);
-
- EmbeddedMapping embeddedMapping = (EmbeddedMapping) getJavaPersistentType().getAttributeNamed("myEmbedded").getMapping();
- assertEquals(2, embeddedMapping.attributeOverridesSize());
-
- JavaResourcePersistentType typeResource = getJpaProject().getJavaResourcePersistentType(FULLY_QUALIFIED_TYPE_NAME);
- JavaResourcePersistentAttribute attributeResource = typeResource.persistableAttributes().next();
-
- //add an annotation to the resource model and verify the context model is updated
- AttributeOverrideAnnotation attributeOverride = (AttributeOverrideAnnotation) attributeResource.addSupportingAnnotation(0, JPA.ATTRIBUTE_OVERRIDE, JPA.ATTRIBUTE_OVERRIDES);
- attributeOverride.setName("FOO");
- attributeOverride = (AttributeOverrideAnnotation) attributeResource.addSupportingAnnotation(0, JPA.ATTRIBUTE_OVERRIDE, JPA.ATTRIBUTE_OVERRIDES);
- attributeOverride.setName("BAR");
-
- assertEquals(4, embeddedMapping.attributeOverridesSize());
-
- attributeOverride = (AttributeOverrideAnnotation) attributeResource.addSupportingAnnotation(0, JPA.ATTRIBUTE_OVERRIDE, JPA.ATTRIBUTE_OVERRIDES);
- attributeOverride.setName("city");
- assertEquals(4, embeddedMapping.attributeOverridesSize());
- }
-
- public void testVirtualAttributeOverridesSize() throws Exception {
- createTestEntityWithEmbeddedMapping();
- createEmbeddableType();
- addXmlClassRef(FULLY_QUALIFIED_TYPE_NAME);
- addXmlClassRef(FULLY_QUALIFIED_EMBEDDABLE_TYPE_NAME);
-
- EmbeddedMapping embeddedMapping = (EmbeddedMapping) getJavaPersistentType().getAttributeNamed("myEmbedded").getMapping();
- assertEquals(2, embeddedMapping.virtualAttributeOverridesSize());
-
- JavaResourcePersistentType typeResource = getJpaProject().getJavaResourcePersistentType(FULLY_QUALIFIED_TYPE_NAME);
- JavaResourcePersistentAttribute attributeResource = typeResource.persistableAttributes().next();
-
- //add an annotation to the resource model and verify the context model is updated
- AttributeOverrideAnnotation attributeOverride = (AttributeOverrideAnnotation) attributeResource.addSupportingAnnotation(0, JPA.ATTRIBUTE_OVERRIDE, JPA.ATTRIBUTE_OVERRIDES);
- attributeOverride.setName("FOO");
-
- assertEquals(2, embeddedMapping.virtualAttributeOverridesSize());
-
- attributeOverride = (AttributeOverrideAnnotation) attributeResource.addSupportingAnnotation(0, JPA.ATTRIBUTE_OVERRIDE, JPA.ATTRIBUTE_OVERRIDES);
- attributeOverride.setName("city");
- assertEquals(1, embeddedMapping.virtualAttributeOverridesSize());
-
- attributeOverride = (AttributeOverrideAnnotation) attributeResource.addSupportingAnnotation(0, JPA.ATTRIBUTE_OVERRIDE, JPA.ATTRIBUTE_OVERRIDES);
- attributeOverride.setName("state");
- assertEquals(0, embeddedMapping.virtualAttributeOverridesSize());
- }
-
- public void testAttributeOverrideSetVirtual() throws Exception {
- createTestEntityWithEmbeddedMapping();
- createEmbeddableType();
- addXmlClassRef(FULLY_QUALIFIED_TYPE_NAME);
- addXmlClassRef(FULLY_QUALIFIED_EMBEDDABLE_TYPE_NAME);
-
- EmbeddedMapping embeddedMapping = (EmbeddedMapping) getJavaPersistentType().getAttributeNamed("myEmbedded").getMapping();
- embeddedMapping.virtualAttributeOverrides().next().setVirtual(false);
- embeddedMapping.virtualAttributeOverrides().next().setVirtual(false);
-
- JavaResourcePersistentType typeResource = getJpaProject().getJavaResourcePersistentType(FULLY_QUALIFIED_TYPE_NAME);
- JavaResourcePersistentAttribute attributeResource = typeResource.persistableAttributes().next();
- Iterator<NestableAnnotation> attributeOverrides = attributeResource.supportingAnnotations(AttributeOverrideAnnotation.ANNOTATION_NAME, AttributeOverridesAnnotation.ANNOTATION_NAME);
-
- assertEquals("city", ((AttributeOverrideAnnotation) attributeOverrides.next()).getName());
- assertEquals("state", ((AttributeOverrideAnnotation) attributeOverrides.next()).getName());
- assertFalse(attributeOverrides.hasNext());
-
- embeddedMapping.specifiedAttributeOverrides().next().setVirtual(true);
- attributeOverrides = attributeResource.supportingAnnotations(AttributeOverrideAnnotation.ANNOTATION_NAME, AttributeOverridesAnnotation.ANNOTATION_NAME);
- assertEquals("state", ((AttributeOverrideAnnotation) attributeOverrides.next()).getName());
- assertFalse(attributeOverrides.hasNext());
-
- assertEquals("city", embeddedMapping.virtualAttributeOverrides().next().getName());
- assertEquals(1, embeddedMapping.virtualAttributeOverridesSize());
-
- embeddedMapping.specifiedAttributeOverrides().next().setVirtual(true);
- attributeOverrides = attributeResource.supportingAnnotations(AttributeOverrideAnnotation.ANNOTATION_NAME, AttributeOverridesAnnotation.ANNOTATION_NAME);
- assertFalse(attributeOverrides.hasNext());
-
- Iterator<AttributeOverride> virtualAttributeOverrides = embeddedMapping.virtualAttributeOverrides();
- assertEquals("city", virtualAttributeOverrides.next().getName());
- assertEquals("state", virtualAttributeOverrides.next().getName());
- assertEquals(2, embeddedMapping.virtualAttributeOverridesSize());
- }
-
- public void testAttributeOverrideSetVirtual2() throws Exception {
- createTestEntityWithEmbeddedMapping();
- createEmbeddableType();
- addXmlClassRef(FULLY_QUALIFIED_TYPE_NAME);
- addXmlClassRef(FULLY_QUALIFIED_EMBEDDABLE_TYPE_NAME);
-
- EmbeddedMapping embeddedMapping = (EmbeddedMapping) getJavaPersistentType().getAttributeNamed("myEmbedded").getMapping();
- ListIterator<AttributeOverride> virtualAttributeOverrides = embeddedMapping.virtualAttributeOverrides();
- virtualAttributeOverrides.next();
- virtualAttributeOverrides.next().setVirtual(false);
- embeddedMapping.virtualAttributeOverrides().next().setVirtual(false);
-
- JavaResourcePersistentType typeResource = getJpaProject().getJavaResourcePersistentType(FULLY_QUALIFIED_TYPE_NAME);
- JavaResourcePersistentAttribute attributeResource = typeResource.persistableAttributes().next();
- Iterator<NestableAnnotation> attributeOverrides = attributeResource.supportingAnnotations(AttributeOverrideAnnotation.ANNOTATION_NAME, AttributeOverridesAnnotation.ANNOTATION_NAME);
-
- assertEquals("state", ((AttributeOverrideAnnotation) attributeOverrides.next()).getName());
- assertEquals("city", ((AttributeOverrideAnnotation) attributeOverrides.next()).getName());
- assertFalse(attributeOverrides.hasNext());
- }
-
- public void testMoveSpecifiedAttributeOverride() throws Exception {
- createTestEntityWithEmbeddedMapping();
- createEmbeddableType();
- addXmlClassRef(FULLY_QUALIFIED_TYPE_NAME);
- addXmlClassRef(FULLY_QUALIFIED_EMBEDDABLE_TYPE_NAME);
-
- EmbeddedMapping embeddedMapping = (EmbeddedMapping) getJavaPersistentType().getAttributeNamed("myEmbedded").getMapping();
- embeddedMapping.virtualAttributeOverrides().next().setVirtual(false);
- embeddedMapping.virtualAttributeOverrides().next().setVirtual(false);
-
- JavaResourcePersistentType typeResource = getJpaProject().getJavaResourcePersistentType(FULLY_QUALIFIED_TYPE_NAME);
- JavaResourcePersistentAttribute attributeResource = typeResource.persistableAttributes().next();
-
- attributeResource.moveSupportingAnnotation(1, 0, AttributeOverridesAnnotation.ANNOTATION_NAME);
-
- Iterator<NestableAnnotation> attributeOverrides = attributeResource.supportingAnnotations(AttributeOverrideAnnotation.ANNOTATION_NAME, AttributeOverridesAnnotation.ANNOTATION_NAME);
-
- assertEquals("state", ((AttributeOverrideAnnotation) attributeOverrides.next()).getName());
- assertEquals("city", ((AttributeOverrideAnnotation) attributeOverrides.next()).getName());
- assertFalse(attributeOverrides.hasNext());
- }
-}
diff --git a/jpa/tests/org.eclipse.jpt.core.tests/src/org/eclipse/jpt/core/tests/internal/context/java/JavaEntityTests.java b/jpa/tests/org.eclipse.jpt.core.tests/src/org/eclipse/jpt/core/tests/internal/context/java/JavaEntityTests.java
deleted file mode 100644
index b43bf1af27..0000000000
--- a/jpa/tests/org.eclipse.jpt.core.tests/src/org/eclipse/jpt/core/tests/internal/context/java/JavaEntityTests.java
+++ /dev/null
@@ -1,3240 +0,0 @@
-/*******************************************************************************
- * Copyright (c) 2007, 2009 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.
- *
- * Contributors:
- * Oracle - initial API and implementation
- ******************************************************************************/
-package org.eclipse.jpt.core.tests.internal.context.java;
-
-import java.util.Iterator;
-import java.util.ListIterator;
-import org.eclipse.jdt.core.ICompilationUnit;
-import org.eclipse.jpt.core.JptCorePlugin;
-import org.eclipse.jpt.core.MappingKeys;
-import org.eclipse.jpt.core.context.AccessType;
-import org.eclipse.jpt.core.context.AssociationOverride;
-import org.eclipse.jpt.core.context.AttributeOverride;
-import org.eclipse.jpt.core.context.BasicMapping;
-import org.eclipse.jpt.core.context.DiscriminatorType;
-import org.eclipse.jpt.core.context.Embeddable;
-import org.eclipse.jpt.core.context.Entity;
-import org.eclipse.jpt.core.context.IdMapping;
-import org.eclipse.jpt.core.context.InheritanceType;
-import org.eclipse.jpt.core.context.JoinColumn;
-import org.eclipse.jpt.core.context.MappedSuperclass;
-import org.eclipse.jpt.core.context.NamedNativeQuery;
-import org.eclipse.jpt.core.context.NamedQuery;
-import org.eclipse.jpt.core.context.OneToOneMapping;
-import org.eclipse.jpt.core.context.PersistentAttribute;
-import org.eclipse.jpt.core.context.PersistentType;
-import org.eclipse.jpt.core.context.PrimaryKeyJoinColumn;
-import org.eclipse.jpt.core.context.SecondaryTable;
-import org.eclipse.jpt.core.context.Table;
-import org.eclipse.jpt.core.context.java.JavaAssociationOverride;
-import org.eclipse.jpt.core.context.java.JavaAttributeOverride;
-import org.eclipse.jpt.core.context.java.JavaEntity;
-import org.eclipse.jpt.core.context.java.JavaIdMapping;
-import org.eclipse.jpt.core.context.java.JavaNamedNativeQuery;
-import org.eclipse.jpt.core.context.java.JavaNamedQuery;
-import org.eclipse.jpt.core.context.java.JavaPersistentAttribute;
-import org.eclipse.jpt.core.context.java.JavaPersistentType;
-import org.eclipse.jpt.core.context.java.JavaPrimaryKeyJoinColumn;
-import org.eclipse.jpt.core.context.java.JavaSecondaryTable;
-import org.eclipse.jpt.core.context.orm.OrmPersistentType;
-import org.eclipse.jpt.core.context.persistence.ClassRef;
-import org.eclipse.jpt.core.internal.context.java.JavaNullTypeMapping;
-import org.eclipse.jpt.core.resource.java.AssociationOverrideAnnotation;
-import org.eclipse.jpt.core.resource.java.AssociationOverridesAnnotation;
-import org.eclipse.jpt.core.resource.java.AttributeOverrideAnnotation;
-import org.eclipse.jpt.core.resource.java.AttributeOverridesAnnotation;
-import org.eclipse.jpt.core.resource.java.DiscriminatorColumnAnnotation;
-import org.eclipse.jpt.core.resource.java.DiscriminatorValueAnnotation;
-import org.eclipse.jpt.core.resource.java.EntityAnnotation;
-import org.eclipse.jpt.core.resource.java.IdClassAnnotation;
-import org.eclipse.jpt.core.resource.java.InheritanceAnnotation;
-import org.eclipse.jpt.core.resource.java.JPA;
-import org.eclipse.jpt.core.resource.java.JavaResourcePersistentType;
-import org.eclipse.jpt.core.resource.java.NamedNativeQueriesAnnotation;
-import org.eclipse.jpt.core.resource.java.NamedNativeQueryAnnotation;
-import org.eclipse.jpt.core.resource.java.NamedQueriesAnnotation;
-import org.eclipse.jpt.core.resource.java.NamedQueryAnnotation;
-import org.eclipse.jpt.core.resource.java.NestableAnnotation;
-import org.eclipse.jpt.core.resource.java.PrimaryKeyJoinColumnAnnotation;
-import org.eclipse.jpt.core.resource.java.PrimaryKeyJoinColumnsAnnotation;
-import org.eclipse.jpt.core.resource.java.SecondaryTableAnnotation;
-import org.eclipse.jpt.core.resource.java.SecondaryTablesAnnotation;
-import org.eclipse.jpt.core.resource.java.SequenceGeneratorAnnotation;
-import org.eclipse.jpt.core.resource.java.TableAnnotation;
-import org.eclipse.jpt.core.resource.java.TableGeneratorAnnotation;
-import org.eclipse.jpt.core.resource.persistence.PersistenceFactory;
-import org.eclipse.jpt.core.resource.persistence.XmlMappingFileRef;
-import org.eclipse.jpt.core.tests.internal.context.ContextModelTestCase;
-import org.eclipse.jpt.core.tests.internal.projects.TestJavaProject.SourceWriter;
-import org.eclipse.jpt.utility.internal.CollectionTools;
-import org.eclipse.jpt.utility.internal.iterators.ArrayIterator;
-
-@SuppressWarnings("nls")
-public class JavaEntityTests extends ContextModelTestCase
-{
- private static final String ENTITY_NAME = "entityName";
- private static final String TABLE_NAME = "MY_TABLE";
- private static final String DISCRIMINATOR_VALUE = "MY_DISCRIMINATOR_VALUE";
- protected static final String SUB_TYPE_NAME = "AnnotationTestTypeChild";
- protected static final String FULLY_QUALIFIED_SUB_TYPE_NAME = PACKAGE_NAME + "." + SUB_TYPE_NAME;
-
-
- public JavaEntityTests(String name) {
- super(name);
- }
-
- private ICompilationUnit createTestEntity() 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");
- }
- });
- }
-
- private void createTestAbstractEntity() throws Exception {
- SourceWriter sourceWriter = new SourceWriter() {
- public void appendSourceTo(StringBuilder sb) {
- sb.append(CR);
- sb.append("import ");
- sb.append(JPA.ENTITY);
- sb.append(";");
- sb.append(CR);
- sb.append("@Entity");
- sb.append(CR);
- sb.append("public abstract class ").append(TYPE_NAME).append(" ");
- sb.append("{}").append(CR);
- }
- };
- this.javaProject.createCompilationUnit(PACKAGE_NAME, FILE_NAME, sourceWriter);
- }
-
- private ICompilationUnit createTestEntityAnnotationOnProperty() 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 appendGetIdMethodAnnotationTo(StringBuilder sb) {
- sb.append("@Id");
- }
- });
- }
-
- private ICompilationUnit createTestMappedSuperclass() throws Exception {
- return this.createTestType(new DefaultAnnotationWriter() {
- @Override
- public Iterator<String> imports() {
- return new ArrayIterator<String>(
- JPA.MAPPED_SUPERCLASS,
- JPA.BASIC,
- JPA.VERSION,
- JPA.TRANSIENT,
- JPA.EMBEDDED,
- JPA.EMBEDDED_ID,
- JPA.ONE_TO_ONE,
- JPA.ONE_TO_MANY,
- JPA.MANY_TO_ONE,
- JPA.MANY_TO_MANY,
- JPA.ID);
- }
- @Override
- public void appendTypeAnnotationTo(StringBuilder sb) {
- sb.append("@MappedSuperclass");
- }
-
- @Override
- public void appendIdFieldAnnotationTo(StringBuilder sb) {
- sb.append("private String foo;").append(CR);
- sb.append(CR);
- sb.append(" @Basic");
- sb.append(CR);
- sb.append(" private int basic;").append(CR);
- sb.append(CR);
- sb.append(" @Version");
- sb.append(CR);
- sb.append(" private int version;").append(CR);
- sb.append(CR);
- sb.append(" @Transient");
- sb.append(CR);
- sb.append(" private int transient;").append(CR);
- sb.append(CR);
- sb.append(" @Embedded");
- sb.append(CR);
- sb.append(" private int embedded;").append(CR);
- sb.append(CR);
- sb.append(" @EmbeddedId");
- sb.append(CR);
- sb.append(" private int embeddedId;").append(CR);
- sb.append(CR);
- sb.append(" @OneToOne");
- sb.append(CR);
- sb.append(" private " + SUB_TYPE_NAME + " oneToOne;").append(CR);
- sb.append(CR);
- sb.append(" @OneToMany");
- sb.append(CR);
- sb.append(" private int oneToMany;").append(CR);
- sb.append(CR);
- sb.append(" @ManyToOne");
- sb.append(CR);
- sb.append(" private int manyToOne;").append(CR);
- sb.append(CR);
- sb.append(" @ManyToMany");
- sb.append(CR);
- sb.append(" private int manyToMany;").append(CR);
- sb.append(CR);
- sb.append(" @Id");
- }
- });
- }
-
- private ICompilationUnit createTestAbstractEntityTablePerClass() throws Exception {
- return this.createTestType(new DefaultAnnotationWriter() {
- @Override
- public Iterator<String> imports() {
- return new ArrayIterator<String>(JPA.ENTITY, JPA.INHERITANCE, JPA.INHERITANCE_TYPE, JPA.ONE_TO_ONE);
- }
- @Override
- public void appendTypeAnnotationTo(StringBuilder sb) {
- sb.append("@Entity").append(CR);
- sb.append("@Inheritance(strategy=InheritanceType.TABLE_PER_CLASS)");
- sb.append("abstract");
- }
-
- @Override
- public void appendGetIdMethodAnnotationTo(StringBuilder sb) {
- sb.append("private String foo;").append(CR);
- sb.append(CR);
- sb.append(" @OneToOne");
- sb.append(CR);
- sb.append(" private int address;").append(CR);
- sb.append(CR);
- sb.append(" @OneToOne");
- sb.append(CR);
- sb.append(" private int address2;").append(CR);
- sb.append(CR);
- sb.append(" ");
- }
- });
- }
-
- private ICompilationUnit createTestEntityWithName() 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(name=\"" + ENTITY_NAME + "\")");
- }
- });
- }
-
- private ICompilationUnit createTestEntityWithTable() throws Exception {
- return this.createTestType(new DefaultAnnotationWriter() {
- @Override
- public Iterator<String> imports() {
- return new ArrayIterator<String>(JPA.ENTITY, JPA.TABLE);
- }
- @Override
- public void appendTypeAnnotationTo(StringBuilder sb) {
- sb.append("@Entity").append(CR);
- sb.append("@Table(name=\"" + TABLE_NAME + "\")");
- }
- });
- }
-
- private void createTestSubType() throws Exception {
- SourceWriter sourceWriter = new SourceWriter() {
- public void appendSourceTo(StringBuilder sb) {
- sb.append(CR);
- sb.append("import ");
- sb.append(JPA.ENTITY);
- sb.append(";");
- sb.append(CR);
- sb.append("@Entity");
- sb.append(CR);
- sb.append("public class ").append("AnnotationTestTypeChild").append(" ");
- sb.append("extends " + TYPE_NAME + " ");
- sb.append("{}").append(CR);
- }
- };
- this.javaProject.createCompilationUnit(PACKAGE_NAME, "AnnotationTestTypeChild.java", sourceWriter);
- }
-
- private ICompilationUnit createTestEntityWithInheritance() throws Exception {
- return this.createTestType(new DefaultAnnotationWriter() {
- @Override
- public Iterator<String> imports() {
- return new ArrayIterator<String>(JPA.ENTITY, JPA.INHERITANCE, JPA.INHERITANCE_TYPE);
- }
- @Override
- public void appendTypeAnnotationTo(StringBuilder sb) {
- sb.append("@Entity").append(CR);
- sb.append("@Inheritance(strategy=InheritanceType.TABLE_PER_CLASS)").append(CR);
- }
- });
- }
-
- private ICompilationUnit createTestEntityWithDiscriminatorValue() throws Exception {
- return this.createTestType(new DefaultAnnotationWriter() {
- @Override
- public Iterator<String> imports() {
- return new ArrayIterator<String>(JPA.ENTITY, JPA.DISCRIMINATOR_VALUE);
- }
- @Override
- public void appendTypeAnnotationTo(StringBuilder sb) {
- sb.append("@Entity").append(CR);
- sb.append("@DiscriminatorValue(value=\"" + DISCRIMINATOR_VALUE + "\")");
- }
- });
- }
-
- private ICompilationUnit createTestEntityWithSecondaryTable() throws Exception {
- return this.createTestType(new DefaultAnnotationWriter() {
- @Override
- public Iterator<String> imports() {
- return new ArrayIterator<String>(JPA.ENTITY, JPA.SECONDARY_TABLE);
- }
- @Override
- public void appendTypeAnnotationTo(StringBuilder sb) {
- sb.append("@Entity").append(CR);
- sb.append("@SecondaryTable(name=\"foo\")");
- }
- });
- }
-
- private ICompilationUnit createTestEntityWithSecondaryTables() throws Exception {
- return this.createTestType(new DefaultAnnotationWriter() {
- @Override
- public Iterator<String> imports() {
- return new ArrayIterator<String>(JPA.ENTITY, JPA.SECONDARY_TABLE, JPA.SECONDARY_TABLES);
- }
- @Override
- public void appendTypeAnnotationTo(StringBuilder sb) {
- sb.append("@Entity").append(CR);
- sb.append("@SecondaryTables({@SecondaryTable(name=\"foo\"), @SecondaryTable(name=\"bar\")})");
- }
- });
- }
-
- private ICompilationUnit createAbstractTestEntity() throws Exception {
- return this.createTestType(new DefaultAnnotationWriter() {
- @Override
- public Iterator<String> imports() {
- return new ArrayIterator<String>(JPA.ENTITY, JPA.INHERITANCE, JPA.INHERITANCE_TYPE);
- }
- @Override
- public void appendTypeAnnotationTo(StringBuilder sb) {
- sb.append("@Entity").append(CR);
- sb.append("@Inheritance(strategy=InheritanceType.TABLE_PER_CLASS)").append(CR);
- sb.append("abstract");
- }
- });
- }
-
- public void testMorphToMappedSuperclass() throws Exception {
- createTestEntity();
- addXmlClassRef(FULLY_QUALIFIED_TYPE_NAME);
-
- JavaEntity entity = (JavaEntity) getJavaPersistentType().getMapping();
- entity.getTable().setSpecifiedName("FOO");
- entity.addSpecifiedSecondaryTable(0);
- entity.addSpecifiedPrimaryKeyJoinColumn(0);
- JavaResourcePersistentType typeResource = getJpaProject().getJavaResourcePersistentType(FULLY_QUALIFIED_TYPE_NAME);
- typeResource.addSupportingAnnotation(0, JPA.ATTRIBUTE_OVERRIDE, JPA.ATTRIBUTE_OVERRIDES);
- typeResource.addSupportingAnnotation(0, JPA.ASSOCIATION_OVERRIDE, JPA.ASSOCIATION_OVERRIDES);
- entity.setSpecifiedInheritanceStrategy(InheritanceType.JOINED);
- entity.setSpecifiedDiscriminatorValue("asdf");
- entity.getDiscriminatorColumn().setSpecifiedName("BAR");
- entity.getGeneratorContainer().addTableGenerator();
- entity.getGeneratorContainer().addSequenceGenerator();
- entity.setIdClass("myIdClass");
- entity.getQueryContainer().addNamedNativeQuery(0);
- entity.getQueryContainer().addNamedQuery(0);
-
- getJavaPersistentType().setMappingKey(MappingKeys.MAPPED_SUPERCLASS_TYPE_MAPPING_KEY);
- assertTrue(getJavaPersistentType().getMapping() instanceof MappedSuperclass);
-
- assertNull(typeResource.getMappingAnnotation(EntityAnnotation.ANNOTATION_NAME));
- assertNull(typeResource.getSupportingAnnotation(TableAnnotation.ANNOTATION_NAME));
- assertNull(typeResource.getSupportingAnnotation(SecondaryTableAnnotation.ANNOTATION_NAME));
- assertNull(typeResource.getSupportingAnnotation(PrimaryKeyJoinColumnAnnotation.ANNOTATION_NAME));
- assertNull(typeResource.getSupportingAnnotation(AttributeOverrideAnnotation.ANNOTATION_NAME));
- assertNull(typeResource.getSupportingAnnotation(AssociationOverrideAnnotation.ANNOTATION_NAME));
- assertNull(typeResource.getSupportingAnnotation(InheritanceAnnotation.ANNOTATION_NAME));
- assertNull(typeResource.getSupportingAnnotation(DiscriminatorValueAnnotation.ANNOTATION_NAME));
- assertNull(typeResource.getSupportingAnnotation(DiscriminatorColumnAnnotation.ANNOTATION_NAME));
- assertNull(typeResource.getSupportingAnnotation(TableGeneratorAnnotation.ANNOTATION_NAME));
- assertNull(typeResource.getSupportingAnnotation(SequenceGeneratorAnnotation.ANNOTATION_NAME));
- assertNotNull(typeResource.getSupportingAnnotation(IdClassAnnotation.ANNOTATION_NAME));
- assertNull(typeResource.getSupportingAnnotation(NamedQueryAnnotation.ANNOTATION_NAME));
- assertNull(typeResource.getSupportingAnnotation(NamedNativeQueryAnnotation.ANNOTATION_NAME));
- }
-
- public void testMorphToEmbeddable() throws Exception {
- createTestEntity();
- addXmlClassRef(FULLY_QUALIFIED_TYPE_NAME);
-
- JavaEntity entity = (JavaEntity) getJavaPersistentType().getMapping();
- entity.getTable().setSpecifiedName("FOO");
- entity.addSpecifiedSecondaryTable(0);
- entity.addSpecifiedPrimaryKeyJoinColumn(0);
- JavaResourcePersistentType typeResource = getJpaProject().getJavaResourcePersistentType(FULLY_QUALIFIED_TYPE_NAME);
- typeResource.addSupportingAnnotation(0, JPA.ATTRIBUTE_OVERRIDE, JPA.ATTRIBUTE_OVERRIDES);
- typeResource.addSupportingAnnotation(0, JPA.ASSOCIATION_OVERRIDE, JPA.ASSOCIATION_OVERRIDES);
- entity.setSpecifiedInheritanceStrategy(InheritanceType.JOINED);
- entity.setSpecifiedDiscriminatorValue("asdf");
- entity.getDiscriminatorColumn().setSpecifiedName("BAR");
- entity.getGeneratorContainer().addTableGenerator();
- entity.getGeneratorContainer().addSequenceGenerator();
- entity.setIdClass("myIdClass");
- entity.getQueryContainer().addNamedNativeQuery(0);
- entity.getQueryContainer().addNamedQuery(0);
-
- getJavaPersistentType().setMappingKey(MappingKeys.EMBEDDABLE_TYPE_MAPPING_KEY);
- assertTrue(getJavaPersistentType().getMapping() instanceof Embeddable);
-
- assertNull(typeResource.getMappingAnnotation(EntityAnnotation.ANNOTATION_NAME));
- assertNull(typeResource.getSupportingAnnotation(TableAnnotation.ANNOTATION_NAME));
- assertNull(typeResource.getSupportingAnnotation(SecondaryTableAnnotation.ANNOTATION_NAME));
- assertNull(typeResource.getSupportingAnnotation(PrimaryKeyJoinColumnAnnotation.ANNOTATION_NAME));
- assertNull(typeResource.getSupportingAnnotation(AttributeOverrideAnnotation.ANNOTATION_NAME));
- assertNull(typeResource.getSupportingAnnotation(AssociationOverrideAnnotation.ANNOTATION_NAME));
- assertNull(typeResource.getSupportingAnnotation(InheritanceAnnotation.ANNOTATION_NAME));
- assertNull(typeResource.getSupportingAnnotation(DiscriminatorValueAnnotation.ANNOTATION_NAME));
- assertNull(typeResource.getSupportingAnnotation(DiscriminatorColumnAnnotation.ANNOTATION_NAME));
- assertNull(typeResource.getSupportingAnnotation(TableGeneratorAnnotation.ANNOTATION_NAME));
- assertNull(typeResource.getSupportingAnnotation(SequenceGeneratorAnnotation.ANNOTATION_NAME));
- assertNull(typeResource.getSupportingAnnotation(IdClassAnnotation.ANNOTATION_NAME));
- assertNull(typeResource.getSupportingAnnotation(NamedQueryAnnotation.ANNOTATION_NAME));
- assertNull(typeResource.getSupportingAnnotation(NamedNativeQueryAnnotation.ANNOTATION_NAME));
- }
-
- public void testMorphToNull() throws Exception {
- createTestEntity();
- addXmlClassRef(FULLY_QUALIFIED_TYPE_NAME);
-
- JavaEntity entity = (JavaEntity) getJavaPersistentType().getMapping();
- entity.getTable().setSpecifiedName("FOO");
- entity.addSpecifiedSecondaryTable(0);
- entity.addSpecifiedPrimaryKeyJoinColumn(0);
- JavaResourcePersistentType typeResource = getJpaProject().getJavaResourcePersistentType(FULLY_QUALIFIED_TYPE_NAME);
- typeResource.addSupportingAnnotation(0, JPA.ATTRIBUTE_OVERRIDE, JPA.ATTRIBUTE_OVERRIDES);
- typeResource.addSupportingAnnotation(0, JPA.ASSOCIATION_OVERRIDE, JPA.ASSOCIATION_OVERRIDES);
- entity.setSpecifiedInheritanceStrategy(InheritanceType.JOINED);
- entity.setSpecifiedDiscriminatorValue("asdf");
- entity.getDiscriminatorColumn().setSpecifiedName("BAR");
- entity.getGeneratorContainer().addTableGenerator();
- entity.getGeneratorContainer().addSequenceGenerator();
- entity.setIdClass("myIdClass");
- entity.getQueryContainer().addNamedNativeQuery(0);
- entity.getQueryContainer().addNamedQuery(0);
-
- getJavaPersistentType().setMappingKey(MappingKeys.NULL_TYPE_MAPPING_KEY);
- assertTrue(getJavaPersistentType().getMapping() instanceof JavaNullTypeMapping);
-
- assertNull(typeResource.getMappingAnnotation(EntityAnnotation.ANNOTATION_NAME));
- assertNull(typeResource.getSupportingAnnotation(TableAnnotation.ANNOTATION_NAME));
- assertNull(typeResource.getSupportingAnnotation(SecondaryTableAnnotation.ANNOTATION_NAME));
- assertNull(typeResource.getSupportingAnnotation(PrimaryKeyJoinColumnAnnotation.ANNOTATION_NAME));
- assertNull(typeResource.getSupportingAnnotation(AttributeOverrideAnnotation.ANNOTATION_NAME));
- assertNull(typeResource.getSupportingAnnotation(AssociationOverrideAnnotation.ANNOTATION_NAME));
- assertNull(typeResource.getSupportingAnnotation(InheritanceAnnotation.ANNOTATION_NAME));
- assertNull(typeResource.getSupportingAnnotation(DiscriminatorValueAnnotation.ANNOTATION_NAME));
- assertNull(typeResource.getSupportingAnnotation(DiscriminatorColumnAnnotation.ANNOTATION_NAME));
- assertNull(typeResource.getSupportingAnnotation(TableGeneratorAnnotation.ANNOTATION_NAME));
- assertNull(typeResource.getSupportingAnnotation(SequenceGeneratorAnnotation.ANNOTATION_NAME));
- assertNull(typeResource.getSupportingAnnotation(IdClassAnnotation.ANNOTATION_NAME));
- assertNull(typeResource.getSupportingAnnotation(NamedQueryAnnotation.ANNOTATION_NAME));
- assertNull(typeResource.getSupportingAnnotation(NamedNativeQueryAnnotation.ANNOTATION_NAME));
- }
-
- public void testAccessNoAnnotations() throws Exception {
- createTestEntity();
- addXmlClassRef(FULLY_QUALIFIED_TYPE_NAME);
- assertEquals(AccessType.FIELD, getJavaPersistentType().getAccess());
- }
-
- public void testAccessAnnotationsOnParent() throws Exception {
- createTestEntityAnnotationOnProperty();
- createTestSubType();
- addXmlClassRef(PACKAGE_NAME + ".AnnotationTestTypeChild");
- addXmlClassRef(FULLY_QUALIFIED_TYPE_NAME);
- XmlMappingFileRef mappingFileRef = PersistenceFactory.eINSTANCE.createXmlMappingFileRef();
- mappingFileRef.setFileName(JptCorePlugin.DEFAULT_ORM_XML_FILE_PATH);
- getXmlPersistenceUnit().getMappingFiles().add(mappingFileRef);
-
- JavaPersistentType childPersistentType = getJavaPersistentType();
- PersistentType parentPersistentType = childPersistentType.getParentPersistentType();
-
- assertEquals(AccessType.PROPERTY, parentPersistentType.getAccess());
- assertEquals(AccessType.PROPERTY, childPersistentType.getAccess());
-
- ((IdMapping) parentPersistentType.getAttributeNamed("id").getMapping()).getColumn().setSpecifiedName("FOO");
- JavaResourcePersistentType typeResource = getJpaProject().getJavaResourcePersistentType(FULLY_QUALIFIED_TYPE_NAME);
- typeResource.persistableProperties().next().setMappingAnnotation(null);
- //no mapping(Id) annotation, but still a Column annotation, so access should still be property
- assertEquals(AccessType.PROPERTY, parentPersistentType.getAccess());
- assertEquals(AccessType.PROPERTY, childPersistentType.getAccess());
-
- ((BasicMapping) parentPersistentType.getAttributeNamed("id").getMapping()).getColumn().setSpecifiedName(null);
- assertEquals(AccessType.FIELD, parentPersistentType.getAccess());
- assertEquals(AccessType.FIELD, childPersistentType.getAccess());
-
- getEntityMappings().getPersistenceUnitMetadata().getPersistenceUnitDefaults().setAccess(AccessType.PROPERTY);
- assertEquals(AccessType.PROPERTY, parentPersistentType.getAccess());
- assertEquals(AccessType.PROPERTY, childPersistentType.getAccess());
-
- getEntityMappings().setSpecifiedAccess(AccessType.FIELD);
- //still accessType of PROPERTY because the java class is not specified in this orm.xml
- assertEquals(AccessType.PROPERTY, parentPersistentType.getAccess());
- assertEquals(AccessType.PROPERTY, childPersistentType.getAccess());
-
- OrmPersistentType ormPersistentType = getEntityMappings().addPersistentType(MappingKeys.ENTITY_TYPE_MAPPING_KEY, FULLY_QUALIFIED_TYPE_NAME);
- removeXmlClassRef(FULLY_QUALIFIED_TYPE_NAME);
- //only parent specified in orm.xml, i think this outcome is right??
- assertEquals(AccessType.FIELD, ormPersistentType.getJavaPersistentType().getAccess());
- assertEquals(AccessType.FIELD, childPersistentType.getAccess());
-
- OrmPersistentType childOrmPersistentType = getEntityMappings().addPersistentType(MappingKeys.ENTITY_TYPE_MAPPING_KEY, PACKAGE_NAME + ".AnnotationTestTypeChild");
- removeXmlClassRef(PACKAGE_NAME + ".AnnotationTestTypeChild");
- //both parent and child specified in orm.xml
- assertEquals(AccessType.FIELD, ormPersistentType.getJavaPersistentType().getAccess());
- assertEquals(AccessType.FIELD, childOrmPersistentType.getJavaPersistentType().getAccess());
- }
-
- public void testAccessWithXmlSettings() throws Exception {
- createTestEntityAnnotationOnProperty();
- addXmlClassRef(FULLY_QUALIFIED_TYPE_NAME);
- XmlMappingFileRef mappingFileRef = PersistenceFactory.eINSTANCE.createXmlMappingFileRef();
- mappingFileRef.setFileName(JptCorePlugin.DEFAULT_ORM_XML_FILE_PATH);
- getXmlPersistenceUnit().getMappingFiles().add(mappingFileRef);
-
- assertEquals(AccessType.PROPERTY, getJavaPersistentType().getAccess());
-
- ((IdMapping) getJavaPersistentType().getAttributeNamed("id").getMapping()).getColumn().setSpecifiedName("FOO");
- JavaResourcePersistentType typeResource = getJpaProject().getJavaResourcePersistentType(FULLY_QUALIFIED_TYPE_NAME);
- typeResource.persistableProperties().next().setMappingAnnotation(null);
- //no mapping(Id) annotation, but still a Column annotation, so access should still be property
- assertEquals(AccessType.PROPERTY, getJavaPersistentType().getAccess());
-
- ((BasicMapping) getJavaPersistentType().getAttributeNamed("id").getMapping()).getColumn().setSpecifiedName(null);
- assertEquals(AccessType.FIELD, getJavaPersistentType().getAccess());
-
- getEntityMappings().getPersistenceUnitMetadata().getPersistenceUnitDefaults().setAccess(AccessType.PROPERTY);
- assertEquals(AccessType.PROPERTY, getJavaPersistentType().getAccess());
-
- getEntityMappings().setSpecifiedAccess(AccessType.FIELD);
- //still accessType of PROPERTY because the java class is not specified in this orm.xml
- assertEquals(AccessType.PROPERTY, getJavaPersistentType().getAccess());
-
- OrmPersistentType ormPersistentType = getEntityMappings().addPersistentType(MappingKeys.ENTITY_TYPE_MAPPING_KEY, FULLY_QUALIFIED_TYPE_NAME);
-
- //now class is specified in orm.xml, so entityMappings access setting wins over persistence-unit-defaults
- assertEquals(AccessType.FIELD, ormPersistentType.getJavaPersistentType().getAccess());
-
- ormPersistentType.setSpecifiedAccess(AccessType.PROPERTY);
-
- //accessType should be PROPERTY now, java gets the access from xml entity if it is specified
- assertEquals(AccessType.PROPERTY, ormPersistentType.getJavaPersistentType().getAccess());
- }
-
- public void testGetSpecifiedNameNull() throws Exception {
- createTestEntity();
- addXmlClassRef(FULLY_QUALIFIED_TYPE_NAME);
-
- assertNull(getJavaEntity().getSpecifiedName());
- }
-
- public void testGetSpecifiedName() throws Exception {
- createTestEntityWithName();
- addXmlClassRef(FULLY_QUALIFIED_TYPE_NAME);
-
- assertEquals(ENTITY_NAME, getJavaEntity().getSpecifiedName());
- }
-
- public void testGetDefaultNameSpecifiedNameNull() throws Exception {
- createTestEntity();
- addXmlClassRef(FULLY_QUALIFIED_TYPE_NAME);
-
- assertEquals(TYPE_NAME, getJavaEntity().getDefaultName());
- }
-
- public void testGetDefaultName() throws Exception {
- createTestEntityWithName();
- addXmlClassRef(FULLY_QUALIFIED_TYPE_NAME);
-
- assertEquals(TYPE_NAME, getJavaEntity().getDefaultName());
- }
-
- public void testGetNameSpecifiedNameNull() throws Exception {
- createTestEntity();
- addXmlClassRef(FULLY_QUALIFIED_TYPE_NAME);
-
- assertEquals(TYPE_NAME, getJavaEntity().getName());
- }
-
- public void testGetName() throws Exception {
- createTestEntityWithName();
- addXmlClassRef(FULLY_QUALIFIED_TYPE_NAME);
-
- assertEquals(ENTITY_NAME, getJavaEntity().getName());
- }
-
- public void testSetSpecifiedName() throws Exception {
- createTestEntity();
- addXmlClassRef(FULLY_QUALIFIED_TYPE_NAME);
-
- getJavaEntity().setSpecifiedName("foo");
-
- assertEquals("foo", getJavaEntity().getSpecifiedName());
-
- JavaResourcePersistentType typeResource = getJpaProject().getJavaResourcePersistentType(FULLY_QUALIFIED_TYPE_NAME);
-
- assertEquals("foo", ((EntityAnnotation) typeResource.getMappingAnnotation()).getName());
- }
-
- public void testSetSpecifiedNameNull() throws Exception {
- createTestEntityWithName();
- addXmlClassRef(FULLY_QUALIFIED_TYPE_NAME);
-
- getJavaEntity().setSpecifiedName(null);
-
- assertNull(getJavaEntity().getSpecifiedName());
-
- JavaResourcePersistentType typeResource = getJpaProject().getJavaResourcePersistentType(FULLY_QUALIFIED_TYPE_NAME);
-
- assertNull(((EntityAnnotation) typeResource.getMappingAnnotation()).getName());
- }
-
- public void testUpdateFromSpecifiedNameChangeInResourceModel() throws Exception {
- createTestEntityWithName();
- addXmlClassRef(FULLY_QUALIFIED_TYPE_NAME);
-
- JavaResourcePersistentType typeResource = getJpaProject().getJavaResourcePersistentType(FULLY_QUALIFIED_TYPE_NAME);
- EntityAnnotation entity = (EntityAnnotation) typeResource.getMappingAnnotation();
- entity.setName("foo");
-
- assertEquals("foo", getJavaEntity().getSpecifiedName());
- }
-
- public void testGetTableName() throws Exception {
- addXmlClassRef(FULLY_QUALIFIED_TYPE_NAME);
- createTestEntityWithName();
-
- assertEquals(ENTITY_NAME, getJavaEntity().getPrimaryTableName());
- }
-
- public void testGetTableName2() throws Exception {
- createTestEntity();
- addXmlClassRef(FULLY_QUALIFIED_TYPE_NAME);
-
- assertEquals(TYPE_NAME, getJavaEntity().getPrimaryTableName());
- }
-
- public void testGetTableName3() throws Exception {
- createTestEntityWithTable();
- addXmlClassRef(FULLY_QUALIFIED_TYPE_NAME);
-
- assertEquals(TABLE_NAME, getJavaEntity().getPrimaryTableName());
- }
-
- public void testSetTableNameWithNullTable() throws Exception {
- ICompilationUnit cu = createTestEntity();
- addXmlClassRef(FULLY_QUALIFIED_TYPE_NAME);
-
- Table table = getJavaEntity().getTable();
- assertEquals(TYPE_NAME, table.getName());
- assertSourceDoesNotContain("@Table", cu);
-
- table.setSpecifiedName(TABLE_NAME);
- assertSourceContains("@Table(name = \"" + TABLE_NAME + "\")", cu);
-
- assertEquals(TABLE_NAME, getJavaEntity().getPrimaryTableName());
- assertEquals(TABLE_NAME, table.getName());
-
- table.setSpecifiedCatalog(TABLE_NAME);
- }
-
- public void testGetInheritanceStrategy() throws Exception {
- createTestEntityWithInheritance();
- addXmlClassRef(FULLY_QUALIFIED_TYPE_NAME);
-
- assertEquals(InheritanceType.TABLE_PER_CLASS, getJavaEntity().getInheritanceStrategy());
- }
-
- public void testGetDefaultInheritanceStrategy() throws Exception {
- createTestEntity();
- createTestSubType();
-
- addXmlClassRef(PACKAGE_NAME + ".AnnotationTestTypeChild");
- addXmlClassRef(FULLY_QUALIFIED_TYPE_NAME);
-
- ListIterator<ClassRef> specifiedClassRefs = getPersistenceUnit().specifiedClassRefs();
- Entity childEntity = (Entity) specifiedClassRefs.next().getJavaPersistentType().getMapping();
- Entity rootEntity = (Entity) specifiedClassRefs.next().getJavaPersistentType().getMapping();
-
- assertNotSame(childEntity, rootEntity);
- assertEquals(InheritanceType.SINGLE_TABLE, childEntity.getDefaultInheritanceStrategy());
-
- //change root inheritance strategy, verify default is changed for child entity
- rootEntity.setSpecifiedInheritanceStrategy(InheritanceType.TABLE_PER_CLASS);
-
- assertEquals(InheritanceType.SINGLE_TABLE, rootEntity.getDefaultInheritanceStrategy());
- assertEquals(InheritanceType.TABLE_PER_CLASS, childEntity.getDefaultInheritanceStrategy());
- assertEquals(InheritanceType.TABLE_PER_CLASS, childEntity.getInheritanceStrategy());
- assertNull(childEntity.getSpecifiedInheritanceStrategy());
- }
-
- public void testGetSpecifiedInheritanceStrategy() throws Exception {
- createTestEntityWithInheritance();
- addXmlClassRef(FULLY_QUALIFIED_TYPE_NAME);
-
- assertEquals(InheritanceType.TABLE_PER_CLASS, getJavaEntity().getSpecifiedInheritanceStrategy());
-
- JavaResourcePersistentType typeResource = getJpaProject().getJavaResourcePersistentType(FULLY_QUALIFIED_TYPE_NAME);
- InheritanceAnnotation inheritance = (InheritanceAnnotation) typeResource.getSupportingAnnotation(InheritanceAnnotation.ANNOTATION_NAME);
-
- inheritance.setStrategy(org.eclipse.jpt.core.resource.java.InheritanceType.JOINED);
-
- assertEquals(InheritanceType.JOINED, getJavaEntity().getSpecifiedInheritanceStrategy());
-
- inheritance.setStrategy(null);
-
- assertNull(getJavaEntity().getSpecifiedInheritanceStrategy());
- }
-
- public void testSetSpecifiedInheritanceStrategy() throws Exception {
- createTestEntityWithInheritance();
- addXmlClassRef(FULLY_QUALIFIED_TYPE_NAME);
- assertEquals(InheritanceType.TABLE_PER_CLASS, getJavaEntity().getSpecifiedInheritanceStrategy());
-
- getJavaEntity().setSpecifiedInheritanceStrategy(InheritanceType.JOINED);
-
- assertEquals(InheritanceType.JOINED, getJavaEntity().getSpecifiedInheritanceStrategy());
-
- JavaResourcePersistentType typeResource = getJpaProject().getJavaResourcePersistentType(FULLY_QUALIFIED_TYPE_NAME);
- InheritanceAnnotation inheritance = (InheritanceAnnotation) typeResource.getSupportingAnnotation(InheritanceAnnotation.ANNOTATION_NAME);
- assertEquals(org.eclipse.jpt.core.resource.java.InheritanceType.JOINED, inheritance.getStrategy());
-
- }
-
- public void testGetDiscriminatorValue() throws Exception {
- createTestEntityWithDiscriminatorValue();
- addXmlClassRef(FULLY_QUALIFIED_TYPE_NAME);
-
- assertEquals(DISCRIMINATOR_VALUE, getJavaEntity().getDiscriminatorValue());
- }
-
- public void testGetDefaultDiscriminatorValue() throws Exception {
- createTestEntityWithDiscriminatorValue();
- addXmlClassRef(FULLY_QUALIFIED_TYPE_NAME);
-
- assertEquals(null, getJavaEntity().getDefaultDiscriminatorValue());
-
- createTestSubType();
- addXmlClassRef(FULLY_QUALIFIED_SUB_TYPE_NAME);
-
- assertEquals(getJavaEntity().getName(), getJavaEntity().getDefaultDiscriminatorValue());
-
- getJavaEntity().getDiscriminatorColumn().setSpecifiedDiscriminatorType(DiscriminatorType.INTEGER);
- assertNull(getJavaEntity().getDefaultDiscriminatorValue());
- }
-
- public void testGetSpecifiedDiscriminatorValue() throws Exception {
- createTestEntityWithDiscriminatorValue();
- addXmlClassRef(FULLY_QUALIFIED_TYPE_NAME);
-
- assertEquals(DISCRIMINATOR_VALUE, getJavaEntity().getSpecifiedDiscriminatorValue());
-
- JavaResourcePersistentType typeResource = getJpaProject().getJavaResourcePersistentType(FULLY_QUALIFIED_TYPE_NAME);
- DiscriminatorValueAnnotation discriminatorValue = (DiscriminatorValueAnnotation) typeResource.getSupportingAnnotation(DiscriminatorValueAnnotation.ANNOTATION_NAME);
-
- discriminatorValue.setValue("foo");
-
- assertEquals("foo", getJavaEntity().getSpecifiedDiscriminatorValue());
-
- discriminatorValue.setValue(null);
-
- assertNull(getJavaEntity().getSpecifiedDiscriminatorValue());
- assertNull(typeResource.getSupportingAnnotation(DiscriminatorValueAnnotation.ANNOTATION_NAME));
- }
-
- public void testSetSpecifiedDiscriminatorValue() throws Exception {
- createTestEntityWithDiscriminatorValue();
- addXmlClassRef(FULLY_QUALIFIED_TYPE_NAME);
- assertEquals(DISCRIMINATOR_VALUE, getJavaEntity().getSpecifiedDiscriminatorValue());
-
- getJavaEntity().setSpecifiedDiscriminatorValue("foo");
-
- assertEquals("foo", getJavaEntity().getSpecifiedDiscriminatorValue());
-
- JavaResourcePersistentType typeResource = getJpaProject().getJavaResourcePersistentType(FULLY_QUALIFIED_TYPE_NAME);
- DiscriminatorValueAnnotation discriminatorValue = (DiscriminatorValueAnnotation) typeResource.getSupportingAnnotation(DiscriminatorValueAnnotation.ANNOTATION_NAME);
- assertEquals("foo", discriminatorValue.getValue());
- }
-
- public void testSecondaryTables() throws Exception {
- createTestEntityWithSecondaryTable();
- addXmlClassRef(FULLY_QUALIFIED_TYPE_NAME);
-
- ListIterator<JavaSecondaryTable> secondaryTables = getJavaEntity().secondaryTables();
-
- assertTrue(secondaryTables.hasNext());
- assertEquals("foo", secondaryTables.next().getName());
- assertFalse(secondaryTables.hasNext());
- }
-
- public void testSecondaryTablesSize() throws Exception {
- createTestEntity();
- addXmlClassRef(FULLY_QUALIFIED_TYPE_NAME);
-
- Entity entity = getJavaEntity();
- JavaResourcePersistentType typeResource = getJpaProject().getJavaResourcePersistentType(FULLY_QUALIFIED_TYPE_NAME);
-
- assertEquals(0, entity.secondaryTablesSize());
-
- ((SecondaryTableAnnotation) typeResource.addSupportingAnnotation(0, SecondaryTableAnnotation.ANNOTATION_NAME, SecondaryTablesAnnotation.ANNOTATION_NAME)).setName("FOO");
- ((SecondaryTableAnnotation) typeResource.addSupportingAnnotation(1, SecondaryTableAnnotation.ANNOTATION_NAME, SecondaryTablesAnnotation.ANNOTATION_NAME)).setName("BAR");
- ((SecondaryTableAnnotation) typeResource.addSupportingAnnotation(2, SecondaryTableAnnotation.ANNOTATION_NAME, SecondaryTablesAnnotation.ANNOTATION_NAME)).setName("BAZ");
-
- assertEquals(3, entity.secondaryTablesSize());
- }
-
- public void testSpecifiedSecondaryTables() throws Exception {
- createTestEntityWithSecondaryTables();
- addXmlClassRef(FULLY_QUALIFIED_TYPE_NAME);
-
- ListIterator<JavaSecondaryTable> specifiedSecondaryTables = getJavaEntity().specifiedSecondaryTables();
-
- assertTrue(specifiedSecondaryTables.hasNext());
- assertEquals("foo", specifiedSecondaryTables.next().getName());
- assertEquals("bar", specifiedSecondaryTables.next().getName());
- assertFalse(specifiedSecondaryTables.hasNext());
- }
-
- public void testSpecifiedSecondaryTablesSize() throws Exception {
- createTestEntity();
- addXmlClassRef(FULLY_QUALIFIED_TYPE_NAME);
-
- Entity entity = getJavaEntity();
- JavaResourcePersistentType typeResource = getJpaProject().getJavaResourcePersistentType(FULLY_QUALIFIED_TYPE_NAME);
-
- assertEquals(0, entity.specifiedSecondaryTablesSize());
-
- ((SecondaryTableAnnotation) typeResource.addSupportingAnnotation(0, SecondaryTableAnnotation.ANNOTATION_NAME, SecondaryTablesAnnotation.ANNOTATION_NAME)).setName("FOO");
- ((SecondaryTableAnnotation) typeResource.addSupportingAnnotation(1, SecondaryTableAnnotation.ANNOTATION_NAME, SecondaryTablesAnnotation.ANNOTATION_NAME)).setName("BAR");
- ((SecondaryTableAnnotation) typeResource.addSupportingAnnotation(2, SecondaryTableAnnotation.ANNOTATION_NAME, SecondaryTablesAnnotation.ANNOTATION_NAME)).setName("BAZ");
-
- assertEquals(3, entity.specifiedSecondaryTablesSize());
- }
-
- public void testAddSpecifiedSecondaryTable() throws Exception {
- createTestEntity();
- addXmlClassRef(FULLY_QUALIFIED_TYPE_NAME);
-
- getJavaEntity().addSpecifiedSecondaryTable(0).setSpecifiedName("FOO");
- getJavaEntity().addSpecifiedSecondaryTable(0).setSpecifiedName("BAR");
- getJavaEntity().addSpecifiedSecondaryTable(0).setSpecifiedName("BAZ");
-
- JavaResourcePersistentType typeResource = getJpaProject().getJavaResourcePersistentType(FULLY_QUALIFIED_TYPE_NAME);
- Iterator<NestableAnnotation> secondaryTables = typeResource.supportingAnnotations(SecondaryTableAnnotation.ANNOTATION_NAME, SecondaryTablesAnnotation.ANNOTATION_NAME);
-
- assertEquals("BAZ", ((SecondaryTableAnnotation) secondaryTables.next()).getName());
- assertEquals("BAR", ((SecondaryTableAnnotation) secondaryTables.next()).getName());
- assertEquals("FOO", ((SecondaryTableAnnotation) secondaryTables.next()).getName());
- assertFalse(secondaryTables.hasNext());
- }
-
- public void testAddSpecifiedSecondaryTable2() throws Exception {
- createTestEntity();
- addXmlClassRef(FULLY_QUALIFIED_TYPE_NAME);
-
- getJavaEntity().addSpecifiedSecondaryTable(0).setSpecifiedName("FOO");
- getJavaEntity().addSpecifiedSecondaryTable(1).setSpecifiedName("BAR");
- getJavaEntity().addSpecifiedSecondaryTable(0).setSpecifiedName("BAZ");
-
- JavaResourcePersistentType typeResource = getJpaProject().getJavaResourcePersistentType(FULLY_QUALIFIED_TYPE_NAME);
- Iterator<NestableAnnotation> secondaryTables = typeResource.supportingAnnotations(SecondaryTableAnnotation.ANNOTATION_NAME, SecondaryTablesAnnotation.ANNOTATION_NAME);
-
- assertEquals("BAZ", ((SecondaryTableAnnotation) secondaryTables.next()).getName());
- assertEquals("FOO", ((SecondaryTableAnnotation) secondaryTables.next()).getName());
- assertEquals("BAR", ((SecondaryTableAnnotation) secondaryTables.next()).getName());
- assertFalse(secondaryTables.hasNext());
- }
-
- public void testAddSpecifiedSecondaryTablePreservePkJoinColumns() throws Exception {
- createTestEntity();
- addXmlClassRef(FULLY_QUALIFIED_TYPE_NAME);
-
- SecondaryTable specifiedSecondaryTable = getJavaEntity().addSpecifiedSecondaryTable(0);
- specifiedSecondaryTable.setSpecifiedName("FOO");
- specifiedSecondaryTable.setSpecifiedCatalog("CATALOG");
- specifiedSecondaryTable.setSpecifiedSchema("SCHEMA");
- specifiedSecondaryTable.addSpecifiedPrimaryKeyJoinColumn(0).setSpecifiedName("PK_NAME");
-
- //add another specified secondary table, pkJoinColumns from first should be saved.
- SecondaryTable specifiedSecondaryTable2 = getJavaEntity().addSpecifiedSecondaryTable(1);
- specifiedSecondaryTable2.setSpecifiedName("BAR");
-
-
- Iterator<JavaSecondaryTable> secondaryTables = getJavaEntity().secondaryTables();
- 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("PK_NAME", pkJoinColumn.getName());
-
- secondaryTable = secondaryTables.next();
- assertEquals(secondaryTable, specifiedSecondaryTable2);
- assertEquals("BAR", secondaryTable.getName());
- assertEquals(0, secondaryTable.specifiedPrimaryKeyJoinColumnsSize());
-
- }
-
- public void testRemoveSpecifiedSecondaryTable() throws Exception {
- createTestEntity();
- addXmlClassRef(FULLY_QUALIFIED_TYPE_NAME);
-
- getJavaEntity().addSpecifiedSecondaryTable(0).setSpecifiedName("FOO");
- getJavaEntity().addSpecifiedSecondaryTable(1).setSpecifiedName("BAR");
- getJavaEntity().addSpecifiedSecondaryTable(2).setSpecifiedName("BAZ");
-
- JavaResourcePersistentType typeResource = getJpaProject().getJavaResourcePersistentType(FULLY_QUALIFIED_TYPE_NAME);
-
- assertEquals(3, CollectionTools.size(typeResource.supportingAnnotations(SecondaryTableAnnotation.ANNOTATION_NAME, SecondaryTablesAnnotation.ANNOTATION_NAME)));
-
- getJavaEntity().removeSpecifiedSecondaryTable(1);
-
- Iterator<NestableAnnotation> secondaryTableResources = typeResource.supportingAnnotations(SecondaryTableAnnotation.ANNOTATION_NAME, SecondaryTablesAnnotation.ANNOTATION_NAME);
- assertEquals("FOO", ((SecondaryTableAnnotation) secondaryTableResources.next()).getName());
- assertEquals("BAZ", ((SecondaryTableAnnotation) secondaryTableResources.next()).getName());
- assertFalse(secondaryTableResources.hasNext());
-
- Iterator<JavaSecondaryTable> secondaryTables = getJavaEntity().secondaryTables();
- assertEquals("FOO", secondaryTables.next().getName());
- assertEquals("BAZ", secondaryTables.next().getName());
- assertFalse(secondaryTables.hasNext());
-
-
- getJavaEntity().removeSpecifiedSecondaryTable(1);
- secondaryTableResources = typeResource.supportingAnnotations(SecondaryTableAnnotation.ANNOTATION_NAME, SecondaryTablesAnnotation.ANNOTATION_NAME);
- assertEquals("FOO", ((SecondaryTableAnnotation) secondaryTableResources.next()).getName());
- assertFalse(secondaryTableResources.hasNext());
-
- secondaryTables = getJavaEntity().secondaryTables();
- assertEquals("FOO", secondaryTables.next().getName());
- assertFalse(secondaryTables.hasNext());
-
-
- getJavaEntity().removeSpecifiedSecondaryTable(0);
- secondaryTableResources = typeResource.supportingAnnotations(SecondaryTableAnnotation.ANNOTATION_NAME, SecondaryTablesAnnotation.ANNOTATION_NAME);
- assertFalse(secondaryTableResources.hasNext());
- secondaryTables = getJavaEntity().secondaryTables();
- assertFalse(secondaryTables.hasNext());
-
- assertNull(typeResource.getSupportingAnnotation(SecondaryTablesAnnotation.ANNOTATION_NAME));
- }
-
- public void testMoveSpecifiedSecondaryTable() throws Exception {
- createTestEntity();
- addXmlClassRef(FULLY_QUALIFIED_TYPE_NAME);
-
- Entity entity = getJavaEntity();
- JavaResourcePersistentType typeResource = getJpaProject().getJavaResourcePersistentType(FULLY_QUALIFIED_TYPE_NAME);
-
- entity.addSpecifiedSecondaryTable(0).setSpecifiedName("FOO");
- entity.addSpecifiedSecondaryTable(1).setSpecifiedName("BAR");
- entity.addSpecifiedSecondaryTable(2).setSpecifiedName("BAZ");
-
- ListIterator<NestableAnnotation> javaSecondaryTables = typeResource.supportingAnnotations(SecondaryTableAnnotation.ANNOTATION_NAME, SecondaryTablesAnnotation.ANNOTATION_NAME);
- assertEquals(3, CollectionTools.size(javaSecondaryTables));
-
-
- entity.moveSpecifiedSecondaryTable(2, 0);
- ListIterator<SecondaryTable> secondaryTables = entity.specifiedSecondaryTables();
- assertEquals("BAR", secondaryTables.next().getSpecifiedName());
- assertEquals("BAZ", secondaryTables.next().getSpecifiedName());
- assertEquals("FOO", secondaryTables.next().getSpecifiedName());
-
- javaSecondaryTables = typeResource.supportingAnnotations(SecondaryTableAnnotation.ANNOTATION_NAME, SecondaryTablesAnnotation.ANNOTATION_NAME);
- 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();
- assertEquals("BAZ", secondaryTables.next().getSpecifiedName());
- assertEquals("BAR", secondaryTables.next().getSpecifiedName());
- assertEquals("FOO", secondaryTables.next().getSpecifiedName());
-
- javaSecondaryTables = typeResource.supportingAnnotations(SecondaryTableAnnotation.ANNOTATION_NAME, SecondaryTablesAnnotation.ANNOTATION_NAME);
- assertEquals("BAZ", ((SecondaryTableAnnotation) javaSecondaryTables.next()).getName());
- assertEquals("BAR", ((SecondaryTableAnnotation) javaSecondaryTables.next()).getName());
- assertEquals("FOO", ((SecondaryTableAnnotation) javaSecondaryTables.next()).getName());
- }
-
- public void testUpdateSpecifiedSecondaryTables() throws Exception {
- createTestEntity();
- addXmlClassRef(FULLY_QUALIFIED_TYPE_NAME);
-
- Entity entity = getJavaEntity();
- JavaResourcePersistentType typeResource = getJpaProject().getJavaResourcePersistentType(FULLY_QUALIFIED_TYPE_NAME);
-
- ((SecondaryTableAnnotation) typeResource.addSupportingAnnotation(0, SecondaryTableAnnotation.ANNOTATION_NAME, SecondaryTablesAnnotation.ANNOTATION_NAME)).setName("FOO");
- ((SecondaryTableAnnotation) typeResource.addSupportingAnnotation(1, SecondaryTableAnnotation.ANNOTATION_NAME, SecondaryTablesAnnotation.ANNOTATION_NAME)).setName("BAR");
- ((SecondaryTableAnnotation) typeResource.addSupportingAnnotation(2, SecondaryTableAnnotation.ANNOTATION_NAME, SecondaryTablesAnnotation.ANNOTATION_NAME)).setName("BAZ");
-
- ListIterator<SecondaryTable> secondaryTables = entity.specifiedSecondaryTables();
- assertEquals("FOO", secondaryTables.next().getName());
- assertEquals("BAR", secondaryTables.next().getName());
- assertEquals("BAZ", secondaryTables.next().getName());
- assertFalse(secondaryTables.hasNext());
-
- typeResource.moveSupportingAnnotation(2, 0, SecondaryTablesAnnotation.ANNOTATION_NAME);
- secondaryTables = entity.specifiedSecondaryTables();
- assertEquals("BAR", secondaryTables.next().getName());
- assertEquals("BAZ", secondaryTables.next().getName());
- assertEquals("FOO", secondaryTables.next().getName());
- assertFalse(secondaryTables.hasNext());
-
- typeResource.moveSupportingAnnotation(0, 1, SecondaryTablesAnnotation.ANNOTATION_NAME);
- secondaryTables = entity.specifiedSecondaryTables();
- assertEquals("BAZ", secondaryTables.next().getName());
- assertEquals("BAR", secondaryTables.next().getName());
- assertEquals("FOO", secondaryTables.next().getName());
- assertFalse(secondaryTables.hasNext());
-
- typeResource.removeSupportingAnnotation(1, SecondaryTableAnnotation.ANNOTATION_NAME, SecondaryTablesAnnotation.ANNOTATION_NAME);
- secondaryTables = entity.specifiedSecondaryTables();
- assertEquals("BAZ", secondaryTables.next().getName());
- assertEquals("FOO", secondaryTables.next().getName());
- assertFalse(secondaryTables.hasNext());
-
- typeResource.removeSupportingAnnotation(1, SecondaryTableAnnotation.ANNOTATION_NAME, SecondaryTablesAnnotation.ANNOTATION_NAME);
- secondaryTables = entity.specifiedSecondaryTables();
- assertEquals("BAZ", secondaryTables.next().getName());
- assertFalse(secondaryTables.hasNext());
-
- typeResource.removeSupportingAnnotation(0, SecondaryTableAnnotation.ANNOTATION_NAME, SecondaryTablesAnnotation.ANNOTATION_NAME);
- secondaryTables = entity.specifiedSecondaryTables();
- assertFalse(secondaryTables.hasNext());
- }
-
- public void testAssociatedTables() throws Exception {
- createTestEntityWithSecondaryTables();
- addXmlClassRef(FULLY_QUALIFIED_TYPE_NAME);
-
- assertEquals(3, CollectionTools.size(getJavaEntity().associatedTables()));
- Iterator<Table> associatedTables = getJavaEntity().associatedTables();
- Table table1 = associatedTables.next();
- SecondaryTable table2 = (SecondaryTable) associatedTables.next();
- SecondaryTable table3 = (SecondaryTable) associatedTables.next();
- assertEquals(TYPE_NAME, table1.getName());
- assertEquals("foo", table2.getName());
- assertEquals("bar", table3.getName());
- }
-
- public void testAssociatedTablesIncludingInherited() throws Exception {
- createTestEntityWithSecondaryTables();
- createTestSubType();
- addXmlClassRef(PACKAGE_NAME + ".AnnotationTestTypeChild");
- addXmlClassRef(FULLY_QUALIFIED_TYPE_NAME);
-
- ListIterator<ClassRef> specifiedClassRefs = getPersistenceUnit().specifiedClassRefs();
- Entity childEntity = (Entity) specifiedClassRefs.next().getJavaPersistentType().getMapping();
- Entity rootEntity = (Entity) specifiedClassRefs.next().getJavaPersistentType().getMapping();
-
- assertEquals(3, CollectionTools.size(rootEntity.associatedTablesIncludingInherited()));
- Iterator<Table> associatedTables = rootEntity.associatedTablesIncludingInherited();
- Table table1 = associatedTables.next();
- SecondaryTable table2 = (SecondaryTable) associatedTables.next();
- SecondaryTable table3 = (SecondaryTable) associatedTables.next();
- assertEquals(TYPE_NAME, table1.getName());
- assertEquals("foo", table2.getName());
- assertEquals("bar", table3.getName());
-
- //TODO probably want this to be 3, since in this case the child descriptor really uses the
- //parent table because it is single table inheritance strategy. Not sure yet how to deal with this.
- assertEquals(4, CollectionTools.size(childEntity.associatedTablesIncludingInherited()));
- }
-
- public void testAssociatedTableNamesIncludingInherited() throws Exception {
- createTestEntityWithSecondaryTables();
- createTestSubType();
- addXmlClassRef(PACKAGE_NAME + ".AnnotationTestTypeChild");
- addXmlClassRef(FULLY_QUALIFIED_TYPE_NAME);
-
- ListIterator<ClassRef> specifiedClassRefs = getPersistenceUnit().specifiedClassRefs();
- Entity childEntity = (Entity) specifiedClassRefs.next().getJavaPersistentType().getMapping();
- Entity rootEntity = (Entity) specifiedClassRefs.next().getJavaPersistentType().getMapping();
-
- assertEquals(3, CollectionTools.size(rootEntity.associatedTableNamesIncludingInherited()));
- Iterator<String> associatedTables = rootEntity.associatedTableNamesIncludingInherited();
- String table1 = associatedTables.next();
- String table2 = associatedTables.next();
- String table3 = associatedTables.next();
- assertEquals(TYPE_NAME, table1);
- assertEquals("foo", table2);
- assertEquals("bar", table3);
-
- //TODO probably want this to be 3, since in this case the child descriptor really uses the
- //parent table because it is single table inheritance strategy. Not sure yet how to deal with this.
- assertEquals(4, CollectionTools.size(childEntity.associatedTableNamesIncludingInherited()));
- }
-
- public void testAddSecondaryTableToResourceModel() throws Exception {
- createTestEntityWithName();
- addXmlClassRef(FULLY_QUALIFIED_TYPE_NAME);
-
- JavaResourcePersistentType typeResource = getJpaProject().getJavaResourcePersistentType(FULLY_QUALIFIED_TYPE_NAME);
- SecondaryTableAnnotation secondaryTable = (SecondaryTableAnnotation) typeResource.addSupportingAnnotation(0, JPA.SECONDARY_TABLE, JPA.SECONDARY_TABLES);
- secondaryTable.setName("FOO");
-
- assertEquals(1, getJavaEntity().secondaryTablesSize());
- assertEquals("FOO", getJavaEntity().secondaryTables().next().getSpecifiedName());
- assertEquals("FOO", getJavaEntity().secondaryTables().next().getName());
-
- SecondaryTableAnnotation secondaryTable2 = (SecondaryTableAnnotation) typeResource.addSupportingAnnotation(1, JPA.SECONDARY_TABLE, JPA.SECONDARY_TABLES);
- secondaryTable2.setName("BAR");
-
- assertEquals(2, getJavaEntity().secondaryTablesSize());
- ListIterator<JavaSecondaryTable> secondaryTables = getJavaEntity().secondaryTables();
- assertEquals("FOO", secondaryTables.next().getSpecifiedName());
- assertEquals("BAR", secondaryTables.next().getSpecifiedName());
-
- SecondaryTableAnnotation secondaryTable3 = (SecondaryTableAnnotation) typeResource.addSupportingAnnotation(0, JPA.SECONDARY_TABLE, JPA.SECONDARY_TABLES);
- secondaryTable3.setName("BAZ");
-
- assertEquals(3, getJavaEntity().secondaryTablesSize());
- secondaryTables = getJavaEntity().secondaryTables();
- assertEquals("BAZ", secondaryTables.next().getSpecifiedName());
- assertEquals("FOO", secondaryTables.next().getSpecifiedName());
- assertEquals("BAR", secondaryTables.next().getSpecifiedName());
- }
-
- public void testRemoveSecondaryTableFromResourceModel() throws Exception {
- createTestEntityWithSecondaryTables();
- addXmlClassRef(FULLY_QUALIFIED_TYPE_NAME);
-
- getJavaEntity().addSpecifiedSecondaryTable(2).setSpecifiedName("baz");
- ListIterator<JavaSecondaryTable> secondaryTables = getJavaEntity().secondaryTables();
-
- assertEquals(3, getJavaEntity().secondaryTablesSize());
- assertEquals("foo", secondaryTables.next().getSpecifiedName());
- assertEquals("bar", secondaryTables.next().getSpecifiedName());
- assertEquals("baz", secondaryTables.next().getSpecifiedName());
-
- JavaResourcePersistentType typeResource = getJpaProject().getJavaResourcePersistentType(FULLY_QUALIFIED_TYPE_NAME);
- typeResource.removeSupportingAnnotation(0, JPA.SECONDARY_TABLE, JPA.SECONDARY_TABLES);
-
- secondaryTables = getJavaEntity().secondaryTables();
- assertEquals(2, getJavaEntity().secondaryTablesSize());
- assertEquals("bar", secondaryTables.next().getSpecifiedName());
- assertEquals("baz", secondaryTables.next().getSpecifiedName());
-
- typeResource.removeSupportingAnnotation(0, JPA.SECONDARY_TABLE, JPA.SECONDARY_TABLES);
-
- secondaryTables = getJavaEntity().secondaryTables();
- assertEquals(1, getJavaEntity().secondaryTablesSize());
- assertEquals("baz", secondaryTables.next().getSpecifiedName());
-
-
- typeResource.removeSupportingAnnotation(0, JPA.SECONDARY_TABLE, JPA.SECONDARY_TABLES);
-
- secondaryTables = getJavaEntity().secondaryTables();
- assertEquals(0, getJavaEntity().secondaryTablesSize());
- assertFalse(secondaryTables.hasNext());
- }
-
- public void testGetSequenceGenerator() throws Exception {
- createTestEntity();
- addXmlClassRef(FULLY_QUALIFIED_TYPE_NAME);
-
- assertNull(getJavaEntity().getGeneratorContainer().getSequenceGenerator());
- assertEquals(0, getJavaEntity().getPersistenceUnit().generatorsSize());
-
- JavaResourcePersistentType typeResource = getJpaProject().getJavaResourcePersistentType(FULLY_QUALIFIED_TYPE_NAME);
- typeResource.addSupportingAnnotation(JPA.SEQUENCE_GENERATOR);
-
- assertNotNull(getJavaEntity().getGeneratorContainer().getSequenceGenerator());
- assertEquals(1, typeResource.supportingAnnotationsSize());
- assertEquals(1, getJavaEntity().getPersistenceUnit().generatorsSize());
-
- getJavaEntity().getGeneratorContainer().getSequenceGenerator().setName("foo");
- assertEquals(1, getJavaEntity().getPersistenceUnit().generatorsSize());
- }
-
- public void testAddSequenceGenerator() throws Exception {
- createTestEntity();
- addXmlClassRef(FULLY_QUALIFIED_TYPE_NAME);
-
- assertNull(getJavaEntity().getGeneratorContainer().getSequenceGenerator());
-
- getJavaEntity().getGeneratorContainer().addSequenceGenerator();
-
- JavaResourcePersistentType typeResource = getJpaProject().getJavaResourcePersistentType(FULLY_QUALIFIED_TYPE_NAME);
-
- assertNotNull(typeResource.getSupportingAnnotation(JPA.SEQUENCE_GENERATOR));
- assertNotNull(getJavaEntity().getGeneratorContainer().getSequenceGenerator());
-
- //try adding another sequence generator, should get an IllegalStateException
- try {
- getJavaEntity().getGeneratorContainer().addSequenceGenerator();
- } catch (IllegalStateException e) {
- return;
- }
- fail("IllegalStateException not thrown");
- }
-
- public void testRemoveSequenceGenerator() throws Exception {
- createTestEntity();
- addXmlClassRef(FULLY_QUALIFIED_TYPE_NAME);
-
- JavaResourcePersistentType typeResource = getJpaProject().getJavaResourcePersistentType(FULLY_QUALIFIED_TYPE_NAME);
- typeResource.addSupportingAnnotation(JPA.SEQUENCE_GENERATOR);
-
- getJavaEntity().getGeneratorContainer().removeSequenceGenerator();
-
- assertNull(getJavaEntity().getGeneratorContainer().getSequenceGenerator());
- assertNull(typeResource.getSupportingAnnotation(JPA.SEQUENCE_GENERATOR));
-
- //try removing the sequence generator again, should get an IllegalStateException
- try {
- getJavaEntity().getGeneratorContainer().removeSequenceGenerator();
- } catch (IllegalStateException e) {
- return;
- }
- fail("IllegalStateException not thrown");
- }
-
- public void testGetTableGenerator() throws Exception {
- createTestEntity();
- addXmlClassRef(FULLY_QUALIFIED_TYPE_NAME);
-
- assertNull(getJavaEntity().getGeneratorContainer().getTableGenerator());
- assertEquals(0, getJavaEntity().getPersistenceUnit().generatorsSize());
-
- JavaResourcePersistentType typeResource = getJpaProject().getJavaResourcePersistentType(FULLY_QUALIFIED_TYPE_NAME);
- typeResource.addSupportingAnnotation(JPA.TABLE_GENERATOR);
-
- assertNotNull(getJavaEntity().getGeneratorContainer().getTableGenerator());
- assertEquals(1, typeResource.supportingAnnotationsSize());
- assertEquals(1, getJavaEntity().getPersistenceUnit().generatorsSize());
-
- getJavaEntity().getGeneratorContainer().getTableGenerator().setName("foo");
- assertEquals(1, getJavaEntity().getPersistenceUnit().generatorsSize());
- }
-
- public void testAddTableGenerator() throws Exception {
- createTestEntity();
- addXmlClassRef(FULLY_QUALIFIED_TYPE_NAME);
-
- assertNull(getJavaEntity().getGeneratorContainer().getTableGenerator());
-
- getJavaEntity().getGeneratorContainer().addTableGenerator();
-
- JavaResourcePersistentType typeResource = getJpaProject().getJavaResourcePersistentType(FULLY_QUALIFIED_TYPE_NAME);
-
- assertNotNull(typeResource.getSupportingAnnotation(JPA.TABLE_GENERATOR));
- assertNotNull(getJavaEntity().getGeneratorContainer().getTableGenerator());
-
- //try adding another table generator, should get an IllegalStateException
- try {
- getJavaEntity().getGeneratorContainer().addTableGenerator();
- } catch (IllegalStateException e) {
- return;
- }
- fail("IllegalStateException not thrown");
- }
-
- public void testRemoveTableGenerator() throws Exception {
- createTestEntity();
- addXmlClassRef(FULLY_QUALIFIED_TYPE_NAME);
-
- JavaResourcePersistentType typeResource = getJpaProject().getJavaResourcePersistentType(FULLY_QUALIFIED_TYPE_NAME);
- typeResource.addSupportingAnnotation(JPA.TABLE_GENERATOR);
-
- getJavaEntity().getGeneratorContainer().removeTableGenerator();
-
- assertNull(getJavaEntity().getGeneratorContainer().getTableGenerator());
- assertNull(typeResource.getSupportingAnnotation(JPA.TABLE_GENERATOR));
-
- //try removing the table generator again, should get an IllegalStateException
- try {
- getJavaEntity().getGeneratorContainer().removeTableGenerator();
- } catch (IllegalStateException e) {
- return;
- }
- fail("IllegalStateException not thrown");
- }
-
- public void testGetDiscriminatorColumn() throws Exception {
- createTestEntity();
- addXmlClassRef(FULLY_QUALIFIED_TYPE_NAME);
-
- assertNotNull(getJavaEntity().getDiscriminatorColumn());
-
- JavaResourcePersistentType typeResource = getJpaProject().getJavaResourcePersistentType(FULLY_QUALIFIED_TYPE_NAME);
- DiscriminatorColumnAnnotation column = (DiscriminatorColumnAnnotation) typeResource.addSupportingAnnotation(JPA.DISCRIMINATOR_COLUMN);
- column.setName("foo");
-
- assertEquals("foo", getJavaEntity().getDiscriminatorColumn().getSpecifiedName());
-
- column.setName(null);
-
- assertNull(getJavaEntity().getDiscriminatorColumn().getSpecifiedName());
-
- typeResource.removeSupportingAnnotation(JPA.DISCRIMINATOR_COLUMN);
-
- assertNotNull(getJavaEntity().getDiscriminatorColumn());
- }
-
- public void testSpecifiedPrimaryKeyJoinColumns() throws Exception {
- createTestEntity();
- addXmlClassRef(FULLY_QUALIFIED_TYPE_NAME);
-
- ListIterator<JavaPrimaryKeyJoinColumn> specifiedPkJoinColumns = getJavaEntity().specifiedPrimaryKeyJoinColumns();
-
- assertFalse(specifiedPkJoinColumns.hasNext());
-
- JavaResourcePersistentType typeResource = getJpaProject().getJavaResourcePersistentType(FULLY_QUALIFIED_TYPE_NAME);
-
- //add an annotation to the resource model and verify the context model is updated
- PrimaryKeyJoinColumnAnnotation pkJoinColumn = (PrimaryKeyJoinColumnAnnotation) typeResource.addSupportingAnnotation(0, JPA.PRIMARY_KEY_JOIN_COLUMN, JPA.PRIMARY_KEY_JOIN_COLUMNS);
- pkJoinColumn.setName("FOO");
- specifiedPkJoinColumns = getJavaEntity().specifiedPrimaryKeyJoinColumns();
- assertEquals("FOO", specifiedPkJoinColumns.next().getName());
- assertFalse(specifiedPkJoinColumns.hasNext());
-
- pkJoinColumn = (PrimaryKeyJoinColumnAnnotation) typeResource.addSupportingAnnotation(0, JPA.PRIMARY_KEY_JOIN_COLUMN, JPA.PRIMARY_KEY_JOIN_COLUMNS);
- pkJoinColumn.setName("BAR");
- specifiedPkJoinColumns = getJavaEntity().specifiedPrimaryKeyJoinColumns();
- assertEquals("BAR", specifiedPkJoinColumns.next().getName());
- assertEquals("FOO", specifiedPkJoinColumns.next().getName());
- assertFalse(specifiedPkJoinColumns.hasNext());
-
-
- pkJoinColumn = (PrimaryKeyJoinColumnAnnotation) typeResource.addSupportingAnnotation(0, JPA.PRIMARY_KEY_JOIN_COLUMN, JPA.PRIMARY_KEY_JOIN_COLUMNS);
- pkJoinColumn.setName("BAZ");
- specifiedPkJoinColumns = getJavaEntity().specifiedPrimaryKeyJoinColumns();
- 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.moveSupportingAnnotation(1, 0, JPA.PRIMARY_KEY_JOIN_COLUMNS);
- specifiedPkJoinColumns = getJavaEntity().specifiedPrimaryKeyJoinColumns();
- assertEquals("BAR", specifiedPkJoinColumns.next().getName());
- assertEquals("BAZ", specifiedPkJoinColumns.next().getName());
- assertEquals("FOO", specifiedPkJoinColumns.next().getName());
- assertFalse(specifiedPkJoinColumns.hasNext());
-
- typeResource.removeSupportingAnnotation(0, JPA.PRIMARY_KEY_JOIN_COLUMN, JPA.PRIMARY_KEY_JOIN_COLUMNS);
- specifiedPkJoinColumns = getJavaEntity().specifiedPrimaryKeyJoinColumns();
- assertEquals("BAZ", specifiedPkJoinColumns.next().getName());
- assertEquals("FOO", specifiedPkJoinColumns.next().getName());
- assertFalse(specifiedPkJoinColumns.hasNext());
-
- typeResource.removeSupportingAnnotation(0, JPA.PRIMARY_KEY_JOIN_COLUMN, JPA.PRIMARY_KEY_JOIN_COLUMNS);
- specifiedPkJoinColumns = getJavaEntity().specifiedPrimaryKeyJoinColumns();
- assertEquals("FOO", specifiedPkJoinColumns.next().getName());
- assertFalse(specifiedPkJoinColumns.hasNext());
-
-
- typeResource.removeSupportingAnnotation(0, JPA.PRIMARY_KEY_JOIN_COLUMN, JPA.PRIMARY_KEY_JOIN_COLUMNS);
- specifiedPkJoinColumns = getJavaEntity().specifiedPrimaryKeyJoinColumns();
- assertFalse(specifiedPkJoinColumns.hasNext());
- }
-
- public void testSpecifiedPrimaryKeyJoinColumnsSize() throws Exception {
- createTestEntity();
- addXmlClassRef(FULLY_QUALIFIED_TYPE_NAME);
-
- assertEquals(0, getJavaEntity().specifiedPrimaryKeyJoinColumnsSize());
-
- getJavaEntity().addSpecifiedPrimaryKeyJoinColumn(0).setSpecifiedName("FOO");
- getJavaEntity().addSpecifiedPrimaryKeyJoinColumn(0).setSpecifiedName("BAR");
- getJavaEntity().addSpecifiedPrimaryKeyJoinColumn(0).setSpecifiedName("BAZ");
-
- assertEquals(3, getJavaEntity().specifiedPrimaryKeyJoinColumnsSize());
- }
-
- public void testPrimaryKeyJoinColumnsSize() throws Exception {
- createTestEntityWithSecondaryTable();
- addXmlClassRef(FULLY_QUALIFIED_TYPE_NAME);
-
- //just the default pkJoinColumn, so 1
- assertEquals(1, getJavaEntity().primaryKeyJoinColumnsSize());
-
- getJavaEntity().addSpecifiedPrimaryKeyJoinColumn(0).setSpecifiedName("FOO");
- getJavaEntity().addSpecifiedPrimaryKeyJoinColumn(0).setSpecifiedName("BAR");
- getJavaEntity().addSpecifiedPrimaryKeyJoinColumn(0).setSpecifiedName("BAZ");
-
- //only the specified pkJoinColumns, 3
- assertEquals(3, getJavaEntity().primaryKeyJoinColumnsSize());
- }
-
- public void testGetDefaultPrimaryKeyJoinColumn() throws Exception {
- createTestEntityWithSecondaryTable();
- addXmlClassRef(FULLY_QUALIFIED_TYPE_NAME);
-
- assertNotNull(getJavaEntity().getDefaultPrimaryKeyJoinColumn());
-
- getJavaEntity().addSpecifiedPrimaryKeyJoinColumn(0).setSpecifiedName("FOO");
- getJavaEntity().addSpecifiedPrimaryKeyJoinColumn(0).setSpecifiedName("BAR");
- getJavaEntity().addSpecifiedPrimaryKeyJoinColumn(0).setSpecifiedName("BAZ");
-
- assertNull(getJavaEntity().getDefaultPrimaryKeyJoinColumn());
- }
-
- public void testAddSpecifiedPrimaryKeyJoinColumn() throws Exception {
- createTestEntity();
- addXmlClassRef(FULLY_QUALIFIED_TYPE_NAME);
-
- getJavaEntity().addSpecifiedPrimaryKeyJoinColumn(0).setSpecifiedName("FOO");
- getJavaEntity().addSpecifiedPrimaryKeyJoinColumn(0).setSpecifiedName("BAR");
- getJavaEntity().addSpecifiedPrimaryKeyJoinColumn(0).setSpecifiedName("BAZ");
-
- JavaResourcePersistentType typeResource = getJpaProject().getJavaResourcePersistentType(FULLY_QUALIFIED_TYPE_NAME);
- Iterator<NestableAnnotation> pkJoinColumns = typeResource.supportingAnnotations(PrimaryKeyJoinColumnAnnotation.ANNOTATION_NAME, PrimaryKeyJoinColumnsAnnotation.ANNOTATION_NAME);
-
- assertEquals("BAZ", ((PrimaryKeyJoinColumnAnnotation) pkJoinColumns.next()).getName());
- assertEquals("BAR", ((PrimaryKeyJoinColumnAnnotation) pkJoinColumns.next()).getName());
- assertEquals("FOO", ((PrimaryKeyJoinColumnAnnotation) pkJoinColumns.next()).getName());
- assertFalse(pkJoinColumns.hasNext());
- }
-
- public void testAddSpecifiedPrimaryKeyJoinColumn2() throws Exception {
- createTestEntity();
- addXmlClassRef(FULLY_QUALIFIED_TYPE_NAME);
-
- getJavaEntity().addSpecifiedPrimaryKeyJoinColumn(0).setSpecifiedName("FOO");
- getJavaEntity().addSpecifiedPrimaryKeyJoinColumn(1).setSpecifiedName("BAR");
- getJavaEntity().addSpecifiedPrimaryKeyJoinColumn(2).setSpecifiedName("BAZ");
-
- JavaResourcePersistentType typeResource = getJpaProject().getJavaResourcePersistentType(FULLY_QUALIFIED_TYPE_NAME);
- Iterator<NestableAnnotation> pkJoinColumns = typeResource.supportingAnnotations(PrimaryKeyJoinColumnAnnotation.ANNOTATION_NAME, PrimaryKeyJoinColumnsAnnotation.ANNOTATION_NAME);
-
- assertEquals("FOO", ((PrimaryKeyJoinColumnAnnotation) pkJoinColumns.next()).getName());
- assertEquals("BAR", ((PrimaryKeyJoinColumnAnnotation) pkJoinColumns.next()).getName());
- assertEquals("BAZ", ((PrimaryKeyJoinColumnAnnotation) pkJoinColumns.next()).getName());
- assertFalse(pkJoinColumns.hasNext());
- }
- public void testRemoveSpecifiedPrimaryKeyJoinColumn() throws Exception {
- createTestEntity();
- addXmlClassRef(FULLY_QUALIFIED_TYPE_NAME);
-
- getJavaEntity().addSpecifiedPrimaryKeyJoinColumn(0).setSpecifiedName("FOO");
- getJavaEntity().addSpecifiedPrimaryKeyJoinColumn(1).setSpecifiedName("BAR");
- getJavaEntity().addSpecifiedPrimaryKeyJoinColumn(2).setSpecifiedName("BAZ");
-
- JavaResourcePersistentType typeResource = getJpaProject().getJavaResourcePersistentType(FULLY_QUALIFIED_TYPE_NAME);
-
- assertEquals(3, CollectionTools.size(typeResource.supportingAnnotations(PrimaryKeyJoinColumnAnnotation.ANNOTATION_NAME, PrimaryKeyJoinColumnsAnnotation.ANNOTATION_NAME)));
-
- getJavaEntity().removeSpecifiedPrimaryKeyJoinColumn(1);
-
- Iterator<NestableAnnotation> pkJoinColumnResources = typeResource.supportingAnnotations(PrimaryKeyJoinColumnAnnotation.ANNOTATION_NAME, PrimaryKeyJoinColumnsAnnotation.ANNOTATION_NAME);
- assertEquals("FOO", ((PrimaryKeyJoinColumnAnnotation) pkJoinColumnResources.next()).getName());
- assertEquals("BAZ", ((PrimaryKeyJoinColumnAnnotation) pkJoinColumnResources.next()).getName());
- assertFalse(pkJoinColumnResources.hasNext());
-
- Iterator<JavaPrimaryKeyJoinColumn> pkJoinColumns = getJavaEntity().specifiedPrimaryKeyJoinColumns();
- assertEquals("FOO", pkJoinColumns.next().getName());
- assertEquals("BAZ", pkJoinColumns.next().getName());
- assertFalse(pkJoinColumns.hasNext());
-
-
- getJavaEntity().removeSpecifiedPrimaryKeyJoinColumn(1);
- pkJoinColumnResources = typeResource.supportingAnnotations(PrimaryKeyJoinColumnAnnotation.ANNOTATION_NAME, PrimaryKeyJoinColumnsAnnotation.ANNOTATION_NAME);
- assertEquals("FOO", ((PrimaryKeyJoinColumnAnnotation) pkJoinColumnResources.next()).getName());
- assertFalse(pkJoinColumnResources.hasNext());
-
- pkJoinColumns = getJavaEntity().specifiedPrimaryKeyJoinColumns();
- assertEquals("FOO", pkJoinColumns.next().getName());
- assertFalse(pkJoinColumns.hasNext());
-
-
- getJavaEntity().removeSpecifiedPrimaryKeyJoinColumn(0);
- pkJoinColumnResources = typeResource.supportingAnnotations(PrimaryKeyJoinColumnAnnotation.ANNOTATION_NAME, PrimaryKeyJoinColumnsAnnotation.ANNOTATION_NAME);
- assertFalse(pkJoinColumnResources.hasNext());
- pkJoinColumns = getJavaEntity().specifiedPrimaryKeyJoinColumns();
- assertFalse(pkJoinColumns.hasNext());
-
- assertNull(typeResource.getSupportingAnnotation(PrimaryKeyJoinColumnsAnnotation.ANNOTATION_NAME));
- }
-
- public void testMoveSpecifiedPrimaryKeyJoinColumn() throws Exception {
- createTestEntity();
- addXmlClassRef(FULLY_QUALIFIED_TYPE_NAME);
-
- Entity entity = getJavaEntity();
- JavaResourcePersistentType typeResource = getJpaProject().getJavaResourcePersistentType(FULLY_QUALIFIED_TYPE_NAME);
-
- entity.addSpecifiedPrimaryKeyJoinColumn(0).setSpecifiedName("FOO");
- entity.addSpecifiedPrimaryKeyJoinColumn(1).setSpecifiedName("BAR");
- entity.addSpecifiedPrimaryKeyJoinColumn(2).setSpecifiedName("BAZ");
-
- ListIterator<NestableAnnotation> javaPrimaryKeyJoinColumns = typeResource.supportingAnnotations(PrimaryKeyJoinColumnAnnotation.ANNOTATION_NAME, PrimaryKeyJoinColumnsAnnotation.ANNOTATION_NAME);
- assertEquals(3, CollectionTools.size(javaPrimaryKeyJoinColumns));
-
-
- entity.moveSpecifiedPrimaryKeyJoinColumn(2, 0);
- ListIterator<PrimaryKeyJoinColumn> primaryKeyJoinColumns = entity.specifiedPrimaryKeyJoinColumns();
- assertEquals("BAR", primaryKeyJoinColumns.next().getSpecifiedName());
- assertEquals("BAZ", primaryKeyJoinColumns.next().getSpecifiedName());
- assertEquals("FOO", primaryKeyJoinColumns.next().getSpecifiedName());
-
- javaPrimaryKeyJoinColumns = typeResource.supportingAnnotations(PrimaryKeyJoinColumnAnnotation.ANNOTATION_NAME, PrimaryKeyJoinColumnsAnnotation.ANNOTATION_NAME);
- 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();
- assertEquals("BAZ", primaryKeyJoinColumns.next().getSpecifiedName());
- assertEquals("BAR", primaryKeyJoinColumns.next().getSpecifiedName());
- assertEquals("FOO", primaryKeyJoinColumns.next().getSpecifiedName());
-
- javaPrimaryKeyJoinColumns = typeResource.supportingAnnotations(PrimaryKeyJoinColumnAnnotation.ANNOTATION_NAME, PrimaryKeyJoinColumnsAnnotation.ANNOTATION_NAME);
- assertEquals("BAZ", ((PrimaryKeyJoinColumnAnnotation) javaPrimaryKeyJoinColumns.next()).getName());
- assertEquals("BAR", ((PrimaryKeyJoinColumnAnnotation) javaPrimaryKeyJoinColumns.next()).getName());
- assertEquals("FOO", ((PrimaryKeyJoinColumnAnnotation) javaPrimaryKeyJoinColumns.next()).getName());
- }
-
- public void testUpdateSpecifiedPrimaryKeyJoinColumns() throws Exception {
- createTestEntity();
- addXmlClassRef(FULLY_QUALIFIED_TYPE_NAME);
-
- Entity entity = getJavaEntity();
- JavaResourcePersistentType typeResource = getJpaProject().getJavaResourcePersistentType(FULLY_QUALIFIED_TYPE_NAME);
-
- ((PrimaryKeyJoinColumnAnnotation) typeResource.addSupportingAnnotation(0, PrimaryKeyJoinColumnAnnotation.ANNOTATION_NAME, PrimaryKeyJoinColumnsAnnotation.ANNOTATION_NAME)).setName("FOO");
- ((PrimaryKeyJoinColumnAnnotation) typeResource.addSupportingAnnotation(1, PrimaryKeyJoinColumnAnnotation.ANNOTATION_NAME, PrimaryKeyJoinColumnsAnnotation.ANNOTATION_NAME)).setName("BAR");
- ((PrimaryKeyJoinColumnAnnotation) typeResource.addSupportingAnnotation(2, PrimaryKeyJoinColumnAnnotation.ANNOTATION_NAME, PrimaryKeyJoinColumnsAnnotation.ANNOTATION_NAME)).setName("BAZ");
-
- ListIterator<PrimaryKeyJoinColumn> primaryKeyJoinColumns = entity.specifiedPrimaryKeyJoinColumns();
- assertEquals("FOO", primaryKeyJoinColumns.next().getName());
- assertEquals("BAR", primaryKeyJoinColumns.next().getName());
- assertEquals("BAZ", primaryKeyJoinColumns.next().getName());
- assertFalse(primaryKeyJoinColumns.hasNext());
-
- typeResource.moveSupportingAnnotation(2, 0, PrimaryKeyJoinColumnsAnnotation.ANNOTATION_NAME);
- primaryKeyJoinColumns = entity.specifiedPrimaryKeyJoinColumns();
- assertEquals("BAR", primaryKeyJoinColumns.next().getName());
- assertEquals("BAZ", primaryKeyJoinColumns.next().getName());
- assertEquals("FOO", primaryKeyJoinColumns.next().getName());
- assertFalse(primaryKeyJoinColumns.hasNext());
-
- typeResource.moveSupportingAnnotation(0, 1, PrimaryKeyJoinColumnsAnnotation.ANNOTATION_NAME);
- primaryKeyJoinColumns = entity.specifiedPrimaryKeyJoinColumns();
- assertEquals("BAZ", primaryKeyJoinColumns.next().getName());
- assertEquals("BAR", primaryKeyJoinColumns.next().getName());
- assertEquals("FOO", primaryKeyJoinColumns.next().getName());
- assertFalse(primaryKeyJoinColumns.hasNext());
-
- typeResource.removeSupportingAnnotation(1, PrimaryKeyJoinColumnAnnotation.ANNOTATION_NAME, PrimaryKeyJoinColumnsAnnotation.ANNOTATION_NAME);
- primaryKeyJoinColumns = entity.specifiedPrimaryKeyJoinColumns();
- assertEquals("BAZ", primaryKeyJoinColumns.next().getName());
- assertEquals("FOO", primaryKeyJoinColumns.next().getName());
- assertFalse(primaryKeyJoinColumns.hasNext());
-
- typeResource.removeSupportingAnnotation(1, PrimaryKeyJoinColumnAnnotation.ANNOTATION_NAME, PrimaryKeyJoinColumnsAnnotation.ANNOTATION_NAME);
- primaryKeyJoinColumns = entity.specifiedPrimaryKeyJoinColumns();
- assertEquals("BAZ", primaryKeyJoinColumns.next().getName());
- assertFalse(primaryKeyJoinColumns.hasNext());
-
- typeResource.removeSupportingAnnotation(0, PrimaryKeyJoinColumnAnnotation.ANNOTATION_NAME, PrimaryKeyJoinColumnsAnnotation.ANNOTATION_NAME);
- primaryKeyJoinColumns = entity.specifiedPrimaryKeyJoinColumns();
- assertFalse(primaryKeyJoinColumns.hasNext());
- }
-
- public void testPrimaryKeyJoinColumnIsVirtual() throws Exception {
- createTestEntityWithSecondaryTable();
- addXmlClassRef(FULLY_QUALIFIED_TYPE_NAME);
-
- assertTrue(getJavaEntity().getDefaultPrimaryKeyJoinColumn().isVirtual());
-
- getJavaEntity().addSpecifiedPrimaryKeyJoinColumn(0);
- PrimaryKeyJoinColumn specifiedPkJoinColumn = getJavaEntity().specifiedPrimaryKeyJoinColumns().next();
- assertFalse(specifiedPkJoinColumn.isVirtual());
-
- assertNull(getJavaEntity().getDefaultPrimaryKeyJoinColumn());
- }
-
- public void testTableNameIsInvalid() throws Exception {
- createTestEntity();
- addXmlClassRef(FULLY_QUALIFIED_TYPE_NAME);
-
- assertFalse(getJavaEntity().tableNameIsInvalid(TYPE_NAME));
- assertTrue(getJavaEntity().tableNameIsInvalid("FOO"));
-
- getJavaEntity().addSpecifiedSecondaryTable(0).setSpecifiedName("BAR");
-
- assertFalse(getJavaEntity().tableNameIsInvalid("BAR"));
- }
-
- public void testAttributeMappingKeyAllowed() throws Exception {
- createTestEntity();
- addXmlClassRef(FULLY_QUALIFIED_TYPE_NAME);
-
- Entity entity = (Entity) getJavaPersistentType().getMapping();
- assertTrue(entity.attributeMappingKeyAllowed(MappingKeys.BASIC_ATTRIBUTE_MAPPING_KEY));
- assertTrue(entity.attributeMappingKeyAllowed(MappingKeys.ID_ATTRIBUTE_MAPPING_KEY));
- assertTrue(entity.attributeMappingKeyAllowed(MappingKeys.EMBEDDED_ATTRIBUTE_MAPPING_KEY));
- assertTrue(entity.attributeMappingKeyAllowed(MappingKeys.EMBEDDED_ID_ATTRIBUTE_MAPPING_KEY));
- assertTrue(entity.attributeMappingKeyAllowed(MappingKeys.VERSION_ATTRIBUTE_MAPPING_KEY));
- assertTrue(entity.attributeMappingKeyAllowed(MappingKeys.TRANSIENT_ATTRIBUTE_MAPPING_KEY));
- assertTrue(entity.attributeMappingKeyAllowed(MappingKeys.ONE_TO_ONE_ATTRIBUTE_MAPPING_KEY));
- assertTrue(entity.attributeMappingKeyAllowed(MappingKeys.MANY_TO_ONE_ATTRIBUTE_MAPPING_KEY));
- assertTrue(entity.attributeMappingKeyAllowed(MappingKeys.ONE_TO_MANY_ATTRIBUTE_MAPPING_KEY));
- assertTrue(entity.attributeMappingKeyAllowed(MappingKeys.MANY_TO_MANY_ATTRIBUTE_MAPPING_KEY));
- }
-
- public void testOverridableAttributes() throws Exception {
- createTestEntity();
- addXmlClassRef(FULLY_QUALIFIED_TYPE_NAME);
-
- Iterator<JavaPersistentAttribute> overridableAttributes = getJavaEntity().overridableAttributes();
- assertFalse(overridableAttributes.hasNext());
-
-
- getJavaEntity().setSpecifiedInheritanceStrategy(InheritanceType.TABLE_PER_CLASS);
-
- overridableAttributes = getJavaEntity().overridableAttributes();
- assertEquals("id", overridableAttributes.next().getName());
- assertEquals("name", overridableAttributes.next().getName());
- assertFalse(overridableAttributes.hasNext());
- }
-
- public void testOverridableAttributeNames() throws Exception {
- createTestEntity();
- addXmlClassRef(FULLY_QUALIFIED_TYPE_NAME);
-
- Iterator<String> overridableAttributeNames = getJavaEntity().overridableAttributeNames();
- assertFalse(overridableAttributeNames.hasNext());
-
-
- getJavaEntity().setSpecifiedInheritanceStrategy(InheritanceType.TABLE_PER_CLASS);
-
- overridableAttributeNames = getJavaEntity().overridableAttributeNames();
- assertEquals("id", overridableAttributeNames.next());
- assertEquals("name", overridableAttributeNames.next());
- assertFalse(overridableAttributeNames.hasNext());
- }
-
- public void testAllOverridableAttributes() throws Exception {
- createTestMappedSuperclass();
- createTestSubType();
- addXmlClassRef(PACKAGE_NAME + ".AnnotationTestTypeChild");
- addXmlClassRef(FULLY_QUALIFIED_TYPE_NAME);
-
- Iterator<PersistentAttribute> overridableAttributes = getJavaEntity().allOverridableAttributes();
- assertEquals("foo", overridableAttributes.next().getName());
- assertEquals("basic", overridableAttributes.next().getName());
- assertEquals("id", overridableAttributes.next().getName());
- assertEquals("name", overridableAttributes.next().getName());
- assertFalse(overridableAttributes.hasNext());
- }
-
- public void testAllOverridableAttributesTablePerClass() throws Exception {
- createTestAbstractEntityTablePerClass();
- createTestSubType();
- addXmlClassRef(PACKAGE_NAME + ".AnnotationTestTypeChild");
- addXmlClassRef(FULLY_QUALIFIED_TYPE_NAME);
-
- Iterator<PersistentAttribute> overridableAttributes = getJavaEntity().allOverridableAttributes();
- assertEquals("id", overridableAttributes.next().getName());
- assertEquals("name", overridableAttributes.next().getName());
- assertEquals("foo", overridableAttributes.next().getName());
- assertFalse(overridableAttributes.hasNext());
-
-
- ListIterator<ClassRef> classRefs = getPersistenceUnit().specifiedClassRefs();
- classRefs.next();
- JavaEntity abstractEntity = (JavaEntity) classRefs.next().getJavaPersistentType().getMapping();
- overridableAttributes = abstractEntity.allOverridableAttributes();
- assertFalse(overridableAttributes.hasNext());
- }
-
- public void testAllOverridableAssociationsTablePerClass() throws Exception {
- createTestAbstractEntityTablePerClass();
- createTestSubType();
- addXmlClassRef(PACKAGE_NAME + ".AnnotationTestTypeChild");
- addXmlClassRef(FULLY_QUALIFIED_TYPE_NAME);
-
- Iterator<PersistentAttribute> overridableAssociations = getJavaEntity().allOverridableAssociations();
- assertEquals("address", overridableAssociations.next().getName());
- assertEquals("address2", overridableAssociations.next().getName());
- assertFalse(overridableAssociations.hasNext());
-
-
- ListIterator<ClassRef> classRefs = getPersistenceUnit().specifiedClassRefs();
- classRefs.next();
- JavaEntity abstractEntity = (JavaEntity) classRefs.next().getJavaPersistentType().getMapping();
- overridableAssociations = abstractEntity.allOverridableAssociations();
- assertFalse(overridableAssociations.hasNext());
- }
-
- public void testAllOverridableAttributesMappedSuperclassInOrmXml() throws Exception {
- createTestMappedSuperclass();
- createTestSubType();
- addXmlClassRef(PACKAGE_NAME + ".AnnotationTestTypeChild");
- getEntityMappings().addPersistentType(MappingKeys.MAPPED_SUPERCLASS_TYPE_MAPPING_KEY, FULLY_QUALIFIED_TYPE_NAME);
-
- Iterator<PersistentAttribute> overridableAttributes = getJavaEntity().allOverridableAttributes();
- assertEquals("foo", overridableAttributes.next().getName());
- assertEquals("basic", overridableAttributes.next().getName());
- assertEquals("id", overridableAttributes.next().getName());
- assertEquals("name", overridableAttributes.next().getName());
- assertFalse(overridableAttributes.hasNext());
- }
-
- public void testAllOverridableAttributeNames() throws Exception {
- createTestMappedSuperclass();
- createTestSubType();
- addXmlClassRef(PACKAGE_NAME + ".AnnotationTestTypeChild");
- addXmlClassRef(FULLY_QUALIFIED_TYPE_NAME);
-
- Iterator<String> overridableAttributeNames = getJavaEntity().allOverridableAttributeNames();
- assertEquals("foo", overridableAttributeNames.next());
- assertEquals("basic", overridableAttributeNames.next());
- assertEquals("id", overridableAttributeNames.next());
- assertEquals("name", overridableAttributeNames.next());
- assertFalse(overridableAttributeNames.hasNext());
- }
-
- public void testSpecifiedAttributeOverrides() throws Exception {
- createTestEntity();
- addXmlClassRef(FULLY_QUALIFIED_TYPE_NAME);
-
- ListIterator<JavaAttributeOverride> specifiedAttributeOverrides = getJavaEntity().specifiedAttributeOverrides();
-
- assertFalse(specifiedAttributeOverrides.hasNext());
-
- JavaResourcePersistentType typeResource = getJpaProject().getJavaResourcePersistentType(FULLY_QUALIFIED_TYPE_NAME);
-
- //add an annotation to the resource model and verify the context model is updated
- AttributeOverrideAnnotation attributeOverride = (AttributeOverrideAnnotation) typeResource.addSupportingAnnotation(0, JPA.ATTRIBUTE_OVERRIDE, JPA.ATTRIBUTE_OVERRIDES);
- attributeOverride.setName("FOO");
- specifiedAttributeOverrides = getJavaEntity().specifiedAttributeOverrides();
- assertEquals("FOO", specifiedAttributeOverrides.next().getName());
- assertFalse(specifiedAttributeOverrides.hasNext());
-
- attributeOverride = (AttributeOverrideAnnotation) typeResource.addSupportingAnnotation(1, JPA.ATTRIBUTE_OVERRIDE, JPA.ATTRIBUTE_OVERRIDES);
- attributeOverride.setName("BAR");
- specifiedAttributeOverrides = getJavaEntity().specifiedAttributeOverrides();
- assertEquals("FOO", specifiedAttributeOverrides.next().getName());
- assertEquals("BAR", specifiedAttributeOverrides.next().getName());
- assertFalse(specifiedAttributeOverrides.hasNext());
-
-
- attributeOverride = (AttributeOverrideAnnotation) typeResource.addSupportingAnnotation(0, JPA.ATTRIBUTE_OVERRIDE, JPA.ATTRIBUTE_OVERRIDES);
- attributeOverride.setName("BAZ");
- specifiedAttributeOverrides = getJavaEntity().specifiedAttributeOverrides();
- 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.moveSupportingAnnotation(1, 0, JPA.ATTRIBUTE_OVERRIDES);
- specifiedAttributeOverrides = getJavaEntity().specifiedAttributeOverrides();
- assertEquals("FOO", specifiedAttributeOverrides.next().getName());
- assertEquals("BAZ", specifiedAttributeOverrides.next().getName());
- assertEquals("BAR", specifiedAttributeOverrides.next().getName());
- assertFalse(specifiedAttributeOverrides.hasNext());
-
- typeResource.removeSupportingAnnotation(0, JPA.ATTRIBUTE_OVERRIDE, JPA.ATTRIBUTE_OVERRIDES);
- specifiedAttributeOverrides = getJavaEntity().specifiedAttributeOverrides();
- assertEquals("BAZ", specifiedAttributeOverrides.next().getName());
- assertEquals("BAR", specifiedAttributeOverrides.next().getName());
- assertFalse(specifiedAttributeOverrides.hasNext());
-
- typeResource.removeSupportingAnnotation(0, JPA.ATTRIBUTE_OVERRIDE, JPA.ATTRIBUTE_OVERRIDES);
- specifiedAttributeOverrides = getJavaEntity().specifiedAttributeOverrides();
- assertEquals("BAR", specifiedAttributeOverrides.next().getName());
- assertFalse(specifiedAttributeOverrides.hasNext());
-
-
- typeResource.removeSupportingAnnotation(0, JPA.ATTRIBUTE_OVERRIDE, JPA.ATTRIBUTE_OVERRIDES);
- specifiedAttributeOverrides = getJavaEntity().specifiedAttributeOverrides();
- assertFalse(specifiedAttributeOverrides.hasNext());
- }
-
- public void testVirtualAttributeOverrideDefaults() throws Exception {
- createTestMappedSuperclass();
- createTestSubType();
-
- addXmlClassRef(FULLY_QUALIFIED_TYPE_NAME);
- addXmlClassRef(FULLY_QUALIFIED_SUB_TYPE_NAME);
-
- ListIterator<ClassRef> classRefs = getPersistenceUnit().specifiedClassRefs();
- classRefs.next();
- JavaEntity javaEntity = (JavaEntity) classRefs.next().getJavaPersistentType().getMapping();
-
- JavaResourcePersistentType typeResource = getJpaProject().getJavaResourcePersistentType(FULLY_QUALIFIED_SUB_TYPE_NAME);
- assertEquals(SUB_TYPE_NAME, typeResource.getName());
- assertNull(typeResource.getSupportingAnnotation(AttributeOverrideAnnotation.ANNOTATION_NAME));
- assertNull(typeResource.getSupportingAnnotation(AttributeOverridesAnnotation.ANNOTATION_NAME));
-
- assertEquals(4, javaEntity.virtualAttributeOverridesSize());
- AttributeOverride virtualAttributeOverride = javaEntity.virtualAttributeOverrides().next();
- assertEquals("foo", virtualAttributeOverride.getName());
- assertEquals("foo", virtualAttributeOverride.getColumn().getName());
- assertEquals(SUB_TYPE_NAME, virtualAttributeOverride.getColumn().getTable());
- assertEquals(null, virtualAttributeOverride.getColumn().getColumnDefinition());
- assertEquals(true, virtualAttributeOverride.getColumn().isInsertable());
- assertEquals(true, virtualAttributeOverride.getColumn().isUpdatable());
- assertEquals(false, virtualAttributeOverride.getColumn().isUnique());
- assertEquals(true, virtualAttributeOverride.getColumn().isNullable());
- assertEquals(255, virtualAttributeOverride.getColumn().getLength());
- assertEquals(0, virtualAttributeOverride.getColumn().getPrecision());
- assertEquals(0, virtualAttributeOverride.getColumn().getScale());
-
-
- MappedSuperclass mappedSuperclass = (MappedSuperclass) getJavaPersistentType().getMapping();
-
- BasicMapping fooMapping = (BasicMapping) mappedSuperclass.getPersistentType().getAttributeNamed("foo").getMapping();
- fooMapping.getColumn().setSpecifiedName("FOO");
- fooMapping.getColumn().setSpecifiedTable("BAR");
- fooMapping.getColumn().setColumnDefinition("COLUMN_DEF");
- fooMapping.getColumn().setSpecifiedInsertable(Boolean.FALSE);
- fooMapping.getColumn().setSpecifiedUpdatable(Boolean.FALSE);
- fooMapping.getColumn().setSpecifiedUnique(Boolean.TRUE);
- fooMapping.getColumn().setSpecifiedNullable(Boolean.FALSE);
- fooMapping.getColumn().setSpecifiedLength(Integer.valueOf(5));
- fooMapping.getColumn().setSpecifiedPrecision(Integer.valueOf(6));
- fooMapping.getColumn().setSpecifiedScale(Integer.valueOf(7));
-
- assertEquals(SUB_TYPE_NAME, typeResource.getName());
- assertNull(typeResource.getSupportingAnnotation(AttributeOverrideAnnotation.ANNOTATION_NAME));
- assertNull(typeResource.getSupportingAnnotation(AttributeOverridesAnnotation.ANNOTATION_NAME));
-
- assertEquals(4, javaEntity.virtualAttributeOverridesSize());
- virtualAttributeOverride = javaEntity.virtualAttributeOverrides().next();
- assertEquals("foo", virtualAttributeOverride.getName());
- assertEquals("FOO", virtualAttributeOverride.getColumn().getName());
- assertEquals("BAR", virtualAttributeOverride.getColumn().getTable());
- assertEquals("COLUMN_DEF", virtualAttributeOverride.getColumn().getColumnDefinition());
- assertEquals(false, virtualAttributeOverride.getColumn().isInsertable());
- assertEquals(false, virtualAttributeOverride.getColumn().isUpdatable());
- assertEquals(true, virtualAttributeOverride.getColumn().isUnique());
- assertEquals(false, virtualAttributeOverride.getColumn().isNullable());
- assertEquals(5, virtualAttributeOverride.getColumn().getLength());
- assertEquals(6, virtualAttributeOverride.getColumn().getPrecision());
- assertEquals(7, virtualAttributeOverride.getColumn().getScale());
-
- fooMapping.getColumn().setSpecifiedName(null);
- fooMapping.getColumn().setSpecifiedTable(null);
- fooMapping.getColumn().setColumnDefinition(null);
- fooMapping.getColumn().setSpecifiedInsertable(null);
- fooMapping.getColumn().setSpecifiedUpdatable(null);
- fooMapping.getColumn().setSpecifiedUnique(null);
- fooMapping.getColumn().setSpecifiedNullable(null);
- fooMapping.getColumn().setSpecifiedLength(null);
- fooMapping.getColumn().setSpecifiedPrecision(null);
- fooMapping.getColumn().setSpecifiedScale(null);
- assertEquals(SUB_TYPE_NAME, typeResource.getName());
- assertNull(typeResource.getSupportingAnnotation(AttributeOverrideAnnotation.ANNOTATION_NAME));
- assertNull(typeResource.getSupportingAnnotation(AttributeOverridesAnnotation.ANNOTATION_NAME));
-
- virtualAttributeOverride = javaEntity.virtualAttributeOverrides().next();
- assertEquals("foo", virtualAttributeOverride.getName());
- assertEquals("foo", virtualAttributeOverride.getColumn().getName());
- assertEquals(SUB_TYPE_NAME, virtualAttributeOverride.getColumn().getTable());
- assertEquals(null, virtualAttributeOverride.getColumn().getColumnDefinition());
- assertEquals(true, virtualAttributeOverride.getColumn().isInsertable());
- assertEquals(true, virtualAttributeOverride.getColumn().isUpdatable());
- assertEquals(false, virtualAttributeOverride.getColumn().isUnique());
- assertEquals(true, virtualAttributeOverride.getColumn().isNullable());
- assertEquals(255, virtualAttributeOverride.getColumn().getLength());
- assertEquals(0, virtualAttributeOverride.getColumn().getPrecision());
- assertEquals(0, virtualAttributeOverride.getColumn().getScale());
-
- virtualAttributeOverride = virtualAttributeOverride.setVirtual(false);
- assertEquals(3, javaEntity.virtualAttributeOverridesSize());
- }
-
- public void testVirtualAttributeOverridesEntityHierachy() throws Exception {
- createTestAbstractEntityTablePerClass();
- createTestSubType();
-
- addXmlClassRef(FULLY_QUALIFIED_TYPE_NAME);
- addXmlClassRef(FULLY_QUALIFIED_SUB_TYPE_NAME);
-
- ListIterator<ClassRef> classRefs = getPersistenceUnit().specifiedClassRefs();
- classRefs.next();
- JavaEntity javaEntity = (JavaEntity) classRefs.next().getJavaPersistentType().getMapping();
-
- JavaResourcePersistentType typeResource = getJpaProject().getJavaResourcePersistentType(FULLY_QUALIFIED_SUB_TYPE_NAME);
- assertEquals(SUB_TYPE_NAME, typeResource.getName());
- assertNull(typeResource.getSupportingAnnotation(AttributeOverrideAnnotation.ANNOTATION_NAME));
- assertNull(typeResource.getSupportingAnnotation(AttributeOverridesAnnotation.ANNOTATION_NAME));
-
- assertEquals(3, javaEntity.virtualAttributeOverridesSize());
- AttributeOverride virtualAttributeOverride = javaEntity.virtualAttributeOverrides().next();
- assertEquals("id", virtualAttributeOverride.getName());
- assertEquals("id", virtualAttributeOverride.getColumn().getName());
- assertEquals(SUB_TYPE_NAME, virtualAttributeOverride.getColumn().getTable());
-
-
- JavaEntity superclass = (JavaEntity) getJavaPersistentType().getMapping();
-
- BasicMapping idMapping = (BasicMapping) superclass.getPersistentType().getAttributeNamed("id").getMapping();
- idMapping.getColumn().setSpecifiedName("FOO");
- idMapping.getColumn().setSpecifiedTable("BAR");
-
- assertEquals(SUB_TYPE_NAME, typeResource.getName());
- assertNull(typeResource.getSupportingAnnotation(AttributeOverrideAnnotation.ANNOTATION_NAME));
- assertNull(typeResource.getSupportingAnnotation(AttributeOverridesAnnotation.ANNOTATION_NAME));
-
- assertEquals(3, javaEntity.virtualAttributeOverridesSize());
- virtualAttributeOverride = javaEntity.virtualAttributeOverrides().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.getSupportingAnnotation(AttributeOverrideAnnotation.ANNOTATION_NAME));
- assertNull(typeResource.getSupportingAnnotation(AttributeOverridesAnnotation.ANNOTATION_NAME));
-
- virtualAttributeOverride = javaEntity.virtualAttributeOverrides().next();
- assertEquals("id", virtualAttributeOverride.getName());
- assertEquals("id", virtualAttributeOverride.getColumn().getName());
- assertEquals(SUB_TYPE_NAME, virtualAttributeOverride.getColumn().getTable());
-
- virtualAttributeOverride = virtualAttributeOverride.setVirtual(false);
- assertEquals(2, javaEntity.virtualAttributeOverridesSize());
- }
-
- public void testSpecifiedAttributeOverridesSize() throws Exception {
- createTestEntity();
- addXmlClassRef(FULLY_QUALIFIED_TYPE_NAME);
-
- assertEquals(0, getJavaEntity().specifiedAttributeOverridesSize());
-
- JavaResourcePersistentType typeResource = getJpaProject().getJavaResourcePersistentType(FULLY_QUALIFIED_TYPE_NAME);
-
- //add an annotation to the resource model and verify the context model is updated
- AttributeOverrideAnnotation attributeOverride = (AttributeOverrideAnnotation) typeResource.addSupportingAnnotation(0, JPA.ATTRIBUTE_OVERRIDE, JPA.ATTRIBUTE_OVERRIDES);
- attributeOverride.setName("FOO");
- attributeOverride = (AttributeOverrideAnnotation) typeResource.addSupportingAnnotation(0, JPA.ATTRIBUTE_OVERRIDE, JPA.ATTRIBUTE_OVERRIDES);
- attributeOverride.setName("BAR");
-
- assertEquals(2, getJavaEntity().specifiedAttributeOverridesSize());
- }
-
- public void testVirtualAttributeOverridesSize() throws Exception {
- createTestMappedSuperclass();
- createTestSubType();
-
- addXmlClassRef(FULLY_QUALIFIED_SUB_TYPE_NAME);
- addXmlClassRef(FULLY_QUALIFIED_TYPE_NAME);
- Entity javaEntity = getJavaEntity();
-
- assertEquals(4, javaEntity.virtualAttributeOverridesSize());
-
- javaEntity.virtualAttributeOverrides().next().setVirtual(false);
- assertEquals(3, javaEntity.virtualAttributeOverridesSize());
-
- javaEntity.virtualAttributeOverrides().next().setVirtual(false);
- assertEquals(2, javaEntity.virtualAttributeOverridesSize());
-
- javaEntity.virtualAttributeOverrides().next().setVirtual(false);
- assertEquals(1, javaEntity.virtualAttributeOverridesSize());
-
- javaEntity.virtualAttributeOverrides().next().setVirtual(false);
- assertEquals(0, javaEntity.virtualAttributeOverridesSize());
- }
-
- public void testAttributeOverridesSize() throws Exception {
- createTestMappedSuperclass();
- createTestSubType();
-
- addXmlClassRef(FULLY_QUALIFIED_SUB_TYPE_NAME);
- addXmlClassRef(FULLY_QUALIFIED_TYPE_NAME);
- Entity javaEntity = getJavaEntity();
-
- assertEquals(4, javaEntity.attributeOverridesSize());
-
- javaEntity.virtualAttributeOverrides().next().setVirtual(false);
- assertEquals(4, javaEntity.attributeOverridesSize());
-
- javaEntity.virtualAttributeOverrides().next().setVirtual(false);
- assertEquals(4, javaEntity.attributeOverridesSize());
-
-
- JavaResourcePersistentType typeResource = getJpaProject().getJavaResourcePersistentType(FULLY_QUALIFIED_SUB_TYPE_NAME);
- AttributeOverrideAnnotation annotation = (AttributeOverrideAnnotation) typeResource.addSupportingAnnotation(0, JPA.ATTRIBUTE_OVERRIDE, JPA.ATTRIBUTE_OVERRIDES);
- annotation.setName("bar");
- assertEquals(5, javaEntity.attributeOverridesSize());
- }
-
- public void testAttributeOverrideSetVirtual() throws Exception {
- createTestMappedSuperclass();
- createTestSubType();
-
- addXmlClassRef(FULLY_QUALIFIED_SUB_TYPE_NAME);
- addXmlClassRef(FULLY_QUALIFIED_TYPE_NAME);
-
- getJavaEntity().virtualAttributeOverrides().next().setVirtual(false);
- getJavaEntity().virtualAttributeOverrides().next().setVirtual(false);
-
- JavaResourcePersistentType typeResource = getJpaProject().getJavaResourcePersistentType(FULLY_QUALIFIED_SUB_TYPE_NAME);
- Iterator<NestableAnnotation> attributeOverrides = typeResource.supportingAnnotations(AttributeOverrideAnnotation.ANNOTATION_NAME, AttributeOverridesAnnotation.ANNOTATION_NAME);
-
- assertEquals("foo", ((AttributeOverrideAnnotation) attributeOverrides.next()).getName());
- assertEquals("basic", ((AttributeOverrideAnnotation) attributeOverrides.next()).getName());
- assertFalse(attributeOverrides.hasNext());
- }
-
- public void testAttributeOverrideSetVirtual2() throws Exception {
- createTestMappedSuperclass();
- createTestSubType();
-
- addXmlClassRef(FULLY_QUALIFIED_SUB_TYPE_NAME);
- addXmlClassRef(FULLY_QUALIFIED_TYPE_NAME);
-
- ListIterator<JavaAttributeOverride> virtualAttributeOverrides = getJavaEntity().virtualAttributeOverrides();
- virtualAttributeOverrides.next();
- virtualAttributeOverrides.next().setVirtual(false);
- getJavaEntity().virtualAttributeOverrides().next().setVirtual(false);
-
- JavaResourcePersistentType typeResource = getJpaProject().getJavaResourcePersistentType(FULLY_QUALIFIED_SUB_TYPE_NAME);
- Iterator<NestableAnnotation> attributeOverrides = typeResource.supportingAnnotations(AttributeOverrideAnnotation.ANNOTATION_NAME, AttributeOverridesAnnotation.ANNOTATION_NAME);
-
- assertEquals("basic", ((AttributeOverrideAnnotation) attributeOverrides.next()).getName());
- assertEquals("foo", ((AttributeOverrideAnnotation) attributeOverrides.next()).getName());
- assertFalse(attributeOverrides.hasNext());
- }
-
- public void testAttributeOverrideSetVirtualTrue() throws Exception {
- createTestMappedSuperclass();
- createTestSubType();
-
- addXmlClassRef(FULLY_QUALIFIED_SUB_TYPE_NAME);
- addXmlClassRef(FULLY_QUALIFIED_TYPE_NAME);
-
- getJavaEntity().virtualAttributeOverrides().next().setVirtual(false);
- getJavaEntity().virtualAttributeOverrides().next().setVirtual(false);
- getJavaEntity().virtualAttributeOverrides().next().setVirtual(false);
-
- JavaResourcePersistentType typeResource = getJpaProject().getJavaResourcePersistentType(FULLY_QUALIFIED_SUB_TYPE_NAME);
- assertEquals(3, CollectionTools.size(typeResource.supportingAnnotations(AttributeOverrideAnnotation.ANNOTATION_NAME, AttributeOverridesAnnotation.ANNOTATION_NAME)));
-
- getJavaEntity().specifiedAttributeOverrides().next().setVirtual(true);
-
- Iterator<NestableAnnotation> attributeOverrideResources = typeResource.supportingAnnotations(AttributeOverrideAnnotation.ANNOTATION_NAME, AttributeOverridesAnnotation.ANNOTATION_NAME);
- assertEquals("basic", ((AttributeOverrideAnnotation) attributeOverrideResources.next()).getName());
- assertEquals("id", ((AttributeOverrideAnnotation) attributeOverrideResources.next()).getName());
- assertFalse(attributeOverrideResources.hasNext());
-
- Iterator<JavaAttributeOverride> attributeOverrides = getJavaEntity().specifiedAttributeOverrides();
- assertEquals("basic", attributeOverrides.next().getName());
- assertEquals("id", attributeOverrides.next().getName());
- assertFalse(attributeOverrides.hasNext());
-
-
- getJavaEntity().specifiedAttributeOverrides().next().setVirtual(true);
- attributeOverrideResources = typeResource.supportingAnnotations(AttributeOverrideAnnotation.ANNOTATION_NAME, AttributeOverridesAnnotation.ANNOTATION_NAME);
- assertEquals("id", ((AttributeOverrideAnnotation) attributeOverrideResources.next()).getName());
- assertFalse(attributeOverrideResources.hasNext());
-
- attributeOverrides = getJavaEntity().specifiedAttributeOverrides();
- assertEquals("id", attributeOverrides.next().getName());
- assertFalse(attributeOverrides.hasNext());
-
-
- getJavaEntity().specifiedAttributeOverrides().next().setVirtual(true);
- attributeOverrideResources = typeResource.supportingAnnotations(AttributeOverrideAnnotation.ANNOTATION_NAME, AttributeOverridesAnnotation.ANNOTATION_NAME);
- assertFalse(attributeOverrideResources.hasNext());
- attributeOverrides = getJavaEntity().specifiedAttributeOverrides();
- assertFalse(attributeOverrides.hasNext());
-
- assertNull(typeResource.getSupportingAnnotation(AttributeOverridesAnnotation.ANNOTATION_NAME));
- }
-
- public void testMoveSpecifiedAttributeOverride() throws Exception {
- createTestMappedSuperclass();
- createTestSubType();
-
- addXmlClassRef(FULLY_QUALIFIED_SUB_TYPE_NAME);
- addXmlClassRef(FULLY_QUALIFIED_TYPE_NAME);
-
- Entity entity = getJavaEntity();
- getJavaEntity().virtualAttributeOverrides().next().setVirtual(false);
- getJavaEntity().virtualAttributeOverrides().next().setVirtual(false);
- getJavaEntity().virtualAttributeOverrides().next().setVirtual(false);
-
-
- JavaResourcePersistentType typeResource = getJpaProject().getJavaResourcePersistentType(FULLY_QUALIFIED_SUB_TYPE_NAME);
-
- ListIterator<NestableAnnotation> javaAttributeOverrides = typeResource.supportingAnnotations(AttributeOverrideAnnotation.ANNOTATION_NAME, AttributeOverridesAnnotation.ANNOTATION_NAME);
- assertEquals(3, CollectionTools.size(javaAttributeOverrides));
-
- entity.moveSpecifiedAttributeOverride(2, 0);
- ListIterator<AttributeOverride> attributeOverrides = entity.specifiedAttributeOverrides();
- assertEquals("basic", attributeOverrides.next().getName());
- assertEquals("id", attributeOverrides.next().getName());
- assertEquals("foo", attributeOverrides.next().getName());
-
- javaAttributeOverrides = typeResource.supportingAnnotations(AttributeOverrideAnnotation.ANNOTATION_NAME, AttributeOverridesAnnotation.ANNOTATION_NAME);
- assertEquals("basic", ((AttributeOverrideAnnotation) javaAttributeOverrides.next()).getName());
- assertEquals("id", ((AttributeOverrideAnnotation) javaAttributeOverrides.next()).getName());
- assertEquals("foo", ((AttributeOverrideAnnotation) javaAttributeOverrides.next()).getName());
-
-
- entity.moveSpecifiedAttributeOverride(0, 1);
- attributeOverrides = entity.specifiedAttributeOverrides();
- assertEquals("id", attributeOverrides.next().getName());
- assertEquals("basic", attributeOverrides.next().getName());
- assertEquals("foo", attributeOverrides.next().getName());
-
- javaAttributeOverrides = typeResource.supportingAnnotations(AttributeOverrideAnnotation.ANNOTATION_NAME, AttributeOverridesAnnotation.ANNOTATION_NAME);
- assertEquals("id", ((AttributeOverrideAnnotation) javaAttributeOverrides.next()).getName());
- assertEquals("basic", ((AttributeOverrideAnnotation) javaAttributeOverrides.next()).getName());
- assertEquals("foo", ((AttributeOverrideAnnotation) javaAttributeOverrides.next()).getName());
- }
-//
- public void testUpdateSpecifiedAttributeOverrides() throws Exception {
- createTestEntity();
- addXmlClassRef(FULLY_QUALIFIED_TYPE_NAME);
-
- Entity entity = getJavaEntity();
- JavaResourcePersistentType typeResource = getJpaProject().getJavaResourcePersistentType(FULLY_QUALIFIED_TYPE_NAME);
-
- ((AttributeOverrideAnnotation) typeResource.addSupportingAnnotation(0, AttributeOverrideAnnotation.ANNOTATION_NAME, AttributeOverridesAnnotation.ANNOTATION_NAME)).setName("FOO");
- ((AttributeOverrideAnnotation) typeResource.addSupportingAnnotation(1, AttributeOverrideAnnotation.ANNOTATION_NAME, AttributeOverridesAnnotation.ANNOTATION_NAME)).setName("BAR");
- ((AttributeOverrideAnnotation) typeResource.addSupportingAnnotation(2, AttributeOverrideAnnotation.ANNOTATION_NAME, AttributeOverridesAnnotation.ANNOTATION_NAME)).setName("BAZ");
-
- ListIterator<AttributeOverride> attributeOverrides = entity.specifiedAttributeOverrides();
- assertEquals("FOO", attributeOverrides.next().getName());
- assertEquals("BAR", attributeOverrides.next().getName());
- assertEquals("BAZ", attributeOverrides.next().getName());
- assertFalse(attributeOverrides.hasNext());
-
- typeResource.moveSupportingAnnotation(2, 0, AttributeOverridesAnnotation.ANNOTATION_NAME);
- attributeOverrides = entity.specifiedAttributeOverrides();
- assertEquals("BAR", attributeOverrides.next().getName());
- assertEquals("BAZ", attributeOverrides.next().getName());
- assertEquals("FOO", attributeOverrides.next().getName());
- assertFalse(attributeOverrides.hasNext());
-
- typeResource.moveSupportingAnnotation(0, 1, AttributeOverridesAnnotation.ANNOTATION_NAME);
- attributeOverrides = entity.specifiedAttributeOverrides();
- assertEquals("BAZ", attributeOverrides.next().getName());
- assertEquals("BAR", attributeOverrides.next().getName());
- assertEquals("FOO", attributeOverrides.next().getName());
- assertFalse(attributeOverrides.hasNext());
-
- typeResource.removeSupportingAnnotation(1, AttributeOverrideAnnotation.ANNOTATION_NAME, AttributeOverridesAnnotation.ANNOTATION_NAME);
- attributeOverrides = entity.specifiedAttributeOverrides();
- assertEquals("BAZ", attributeOverrides.next().getName());
- assertEquals("FOO", attributeOverrides.next().getName());
- assertFalse(attributeOverrides.hasNext());
-
- typeResource.removeSupportingAnnotation(1, AttributeOverrideAnnotation.ANNOTATION_NAME, AttributeOverridesAnnotation.ANNOTATION_NAME);
- attributeOverrides = entity.specifiedAttributeOverrides();
- assertEquals("BAZ", attributeOverrides.next().getName());
- assertFalse(attributeOverrides.hasNext());
-
- typeResource.removeSupportingAnnotation(0, AttributeOverrideAnnotation.ANNOTATION_NAME, AttributeOverridesAnnotation.ANNOTATION_NAME);
- attributeOverrides = entity.specifiedAttributeOverrides();
- assertFalse(attributeOverrides.hasNext());
- }
-
- public void testAttributeOverrideIsVirtual() throws Exception {
- createTestMappedSuperclass();
- createTestSubType();
- addXmlClassRef(PACKAGE_NAME + ".AnnotationTestTypeChild");
- addXmlClassRef(FULLY_QUALIFIED_TYPE_NAME);
-
- ListIterator<JavaAttributeOverride> virtualAttributeOverrides = getJavaEntity().virtualAttributeOverrides();
- AttributeOverride virtualAttributeOverride = virtualAttributeOverrides.next();
- assertEquals("foo", virtualAttributeOverride.getName());
- assertTrue(virtualAttributeOverride.isVirtual());
-
- virtualAttributeOverride = virtualAttributeOverrides.next();
- assertEquals("basic", virtualAttributeOverride.getName());
- assertTrue(virtualAttributeOverride.isVirtual());
-
- virtualAttributeOverride = virtualAttributeOverrides.next();
- assertEquals("id", virtualAttributeOverride.getName());
- assertTrue(virtualAttributeOverride.isVirtual());
-
- virtualAttributeOverride = virtualAttributeOverrides.next();
- assertEquals("name", virtualAttributeOverride.getName());
- assertTrue(virtualAttributeOverride.isVirtual());
- assertFalse(virtualAttributeOverrides.hasNext());
-
- getJavaEntity().virtualAttributeOverrides().next().setVirtual(false);
- AttributeOverride specifiedAttributeOverride = getJavaEntity().specifiedAttributeOverrides().next();
- assertFalse(specifiedAttributeOverride.isVirtual());
-
-
- virtualAttributeOverrides = getJavaEntity().virtualAttributeOverrides();
- virtualAttributeOverride = virtualAttributeOverrides.next();
- assertEquals("basic", virtualAttributeOverride.getName());
- assertTrue(virtualAttributeOverride.isVirtual());
-
- virtualAttributeOverride = virtualAttributeOverrides.next();
- assertEquals("id", virtualAttributeOverride.getName());
- assertTrue(virtualAttributeOverride.isVirtual());
-
- virtualAttributeOverride = virtualAttributeOverrides.next();
- assertEquals("name", virtualAttributeOverride.getName());
- assertTrue(virtualAttributeOverride.isVirtual());
- assertFalse(virtualAttributeOverrides.hasNext());
- }
-
-
- public void testOverridableAssociations() throws Exception {
- createTestEntity();
- addXmlClassRef(FULLY_QUALIFIED_TYPE_NAME);
-
- Iterator<JavaPersistentAttribute> overridableAssociations = getJavaEntity().overridableAssociations();
- assertFalse(overridableAssociations.hasNext());
- }
-
- public void testOverridableAssociationNames() throws Exception {
- createTestEntity();
- addXmlClassRef(FULLY_QUALIFIED_TYPE_NAME);
-
- Iterator<String> overridableAssociationNames = getJavaEntity().overridableAssociationNames();
- assertFalse(overridableAssociationNames.hasNext());
- }
-
- public void testAllOverridableAssociationNames() throws Exception {
- createTestMappedSuperclass();
- createTestSubType();
- addXmlClassRef(PACKAGE_NAME + ".AnnotationTestTypeChild");
- addXmlClassRef(FULLY_QUALIFIED_TYPE_NAME);
-
- Iterator<String> overridableAssociationNames = getJavaEntity().allOverridableAssociationNames();
- assertEquals("oneToOne", overridableAssociationNames.next());
- assertEquals("manyToOne", overridableAssociationNames.next());
- assertFalse(overridableAssociationNames.hasNext());
- }
-
- public void testAllOverridableAssociations() throws Exception {
- createTestMappedSuperclass();
- createTestSubType();
- addXmlClassRef(PACKAGE_NAME + ".AnnotationTestTypeChild");
- addXmlClassRef(FULLY_QUALIFIED_TYPE_NAME);
-
- Iterator<PersistentAttribute> overridableAssociations = getJavaEntity().allOverridableAssociations();
- assertEquals("oneToOne", overridableAssociations.next().getName());
- assertEquals("manyToOne", overridableAssociations.next().getName());
- assertFalse(overridableAssociations.hasNext());
- }
-
- public void testAllOverridableAssociationsMappedSuperclassInOrmXml() throws Exception {
- createTestMappedSuperclass();
- createTestSubType();
- addXmlClassRef(PACKAGE_NAME + ".AnnotationTestTypeChild");
- getEntityMappings().addPersistentType(MappingKeys.MAPPED_SUPERCLASS_TYPE_MAPPING_KEY, FULLY_QUALIFIED_TYPE_NAME);
-
- Iterator<PersistentAttribute> overridableAssociations = getJavaEntity().allOverridableAssociations();
- assertEquals("oneToOne", overridableAssociations.next().getName());
- assertEquals("manyToOne", overridableAssociations.next().getName());
- assertFalse(overridableAssociations.hasNext());
- }
-
- public void testSpecifiedAssociationOverrides() throws Exception {
- createTestEntity();
- addXmlClassRef(FULLY_QUALIFIED_TYPE_NAME);
-
- ListIterator<JavaAssociationOverride> specifiedAssociationOverrides = getJavaEntity().specifiedAssociationOverrides();
-
- assertFalse(specifiedAssociationOverrides.hasNext());
-
- JavaResourcePersistentType typeResource = getJpaProject().getJavaResourcePersistentType(FULLY_QUALIFIED_TYPE_NAME);
-
- //add an annotation to the resource model and verify the context model is updated
- AssociationOverrideAnnotation associationOverride = (AssociationOverrideAnnotation) typeResource.addSupportingAnnotation(0, JPA.ASSOCIATION_OVERRIDE, JPA.ASSOCIATION_OVERRIDES);
- associationOverride.setName("FOO");
- specifiedAssociationOverrides = getJavaEntity().specifiedAssociationOverrides();
- assertEquals("FOO", specifiedAssociationOverrides.next().getName());
- assertFalse(specifiedAssociationOverrides.hasNext());
-
- associationOverride = (AssociationOverrideAnnotation) typeResource.addSupportingAnnotation(1, JPA.ASSOCIATION_OVERRIDE, JPA.ASSOCIATION_OVERRIDES);
- associationOverride.setName("BAR");
- specifiedAssociationOverrides = getJavaEntity().specifiedAssociationOverrides();
- assertEquals("FOO", specifiedAssociationOverrides.next().getName());
- assertEquals("BAR", specifiedAssociationOverrides.next().getName());
- assertFalse(specifiedAssociationOverrides.hasNext());
-
-
- associationOverride = (AssociationOverrideAnnotation) typeResource.addSupportingAnnotation(0, JPA.ASSOCIATION_OVERRIDE, JPA.ASSOCIATION_OVERRIDES);
- associationOverride.setName("BAZ");
- specifiedAssociationOverrides = getJavaEntity().specifiedAssociationOverrides();
- 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.moveSupportingAnnotation(1, 0, JPA.ASSOCIATION_OVERRIDES);
- specifiedAssociationOverrides = getJavaEntity().specifiedAssociationOverrides();
- assertEquals("FOO", specifiedAssociationOverrides.next().getName());
- assertEquals("BAZ", specifiedAssociationOverrides.next().getName());
- assertEquals("BAR", specifiedAssociationOverrides.next().getName());
- assertFalse(specifiedAssociationOverrides.hasNext());
-
- typeResource.removeSupportingAnnotation(0, JPA.ASSOCIATION_OVERRIDE, JPA.ASSOCIATION_OVERRIDES);
- specifiedAssociationOverrides = getJavaEntity().specifiedAssociationOverrides();
- assertEquals("BAZ", specifiedAssociationOverrides.next().getName());
- assertEquals("BAR", specifiedAssociationOverrides.next().getName());
- assertFalse(specifiedAssociationOverrides.hasNext());
-
- typeResource.removeSupportingAnnotation(0, JPA.ASSOCIATION_OVERRIDE, JPA.ASSOCIATION_OVERRIDES);
- specifiedAssociationOverrides = getJavaEntity().specifiedAssociationOverrides();
- assertEquals("BAR", specifiedAssociationOverrides.next().getName());
- assertFalse(specifiedAssociationOverrides.hasNext());
-
-
- typeResource.removeSupportingAnnotation(0, JPA.ASSOCIATION_OVERRIDE, JPA.ASSOCIATION_OVERRIDES);
- specifiedAssociationOverrides = getJavaEntity().specifiedAssociationOverrides();
- assertFalse(specifiedAssociationOverrides.hasNext());
- }
-
- public void testVirtualAssociationOverrideDefaults() throws Exception {
- createTestMappedSuperclass();
- createTestSubType();
-
- addXmlClassRef(FULLY_QUALIFIED_TYPE_NAME);
- addXmlClassRef(FULLY_QUALIFIED_SUB_TYPE_NAME);
-
- ListIterator<ClassRef> classRefs = getPersistenceUnit().specifiedClassRefs();
- classRefs.next();
- JavaEntity javaEntity = (JavaEntity) classRefs.next().getJavaPersistentType().getMapping();
-
- JavaResourcePersistentType typeResource = getJpaProject().getJavaResourcePersistentType(FULLY_QUALIFIED_SUB_TYPE_NAME);
- assertEquals(SUB_TYPE_NAME, typeResource.getName());
- assertNull(typeResource.getSupportingAnnotation(AssociationOverrideAnnotation.ANNOTATION_NAME));
- assertNull(typeResource.getSupportingAnnotation(AssociationOverridesAnnotation.ANNOTATION_NAME));
-
- assertEquals(2, javaEntity.virtualAssociationOverridesSize());
- AssociationOverride virtualAssociationOverride = javaEntity.virtualAssociationOverrides().next();
- assertEquals("oneToOne", virtualAssociationOverride.getName());
- assertEquals(1, virtualAssociationOverride.joinColumnsSize());
- JoinColumn virtualJoinColumn = virtualAssociationOverride.joinColumns().next();
- assertEquals("oneToOne_id", virtualJoinColumn.getName());
- assertEquals("id", virtualJoinColumn.getReferencedColumnName());
- assertEquals(SUB_TYPE_NAME, virtualJoinColumn.getTable());
- assertEquals(null, virtualJoinColumn.getColumnDefinition());
- assertEquals(true, virtualJoinColumn.isInsertable());
- assertEquals(true, virtualJoinColumn.isUpdatable());
- assertEquals(false, virtualJoinColumn.isUnique());
- assertEquals(true, virtualJoinColumn.isNullable());
-
-
- OneToOneMapping oneToOneMapping = (OneToOneMapping) getJavaPersistentType().getAttributeNamed("oneToOne").getMapping();
- JoinColumn joinColumn = oneToOneMapping.getRelationshipReference().getJoinColumnJoiningStrategy().addSpecifiedJoinColumn(0);
- joinColumn.setSpecifiedName("MY_JOIN_COLUMN");
- joinColumn.setSpecifiedReferencedColumnName("MY_REFERENCE_COLUMN");
- joinColumn.setSpecifiedTable("BAR");
- joinColumn.setColumnDefinition("COLUMN_DEF");
- joinColumn.setSpecifiedInsertable(Boolean.FALSE);
- joinColumn.setSpecifiedUpdatable(Boolean.FALSE);
- joinColumn.setSpecifiedUnique(Boolean.TRUE);
- joinColumn.setSpecifiedNullable(Boolean.FALSE);
-
- assertEquals(SUB_TYPE_NAME, typeResource.getName());
- assertNull(typeResource.getSupportingAnnotation(AssociationOverrideAnnotation.ANNOTATION_NAME));
- assertNull(typeResource.getSupportingAnnotation(AssociationOverridesAnnotation.ANNOTATION_NAME));
-
- assertEquals(2, javaEntity.virtualAssociationOverridesSize());
- virtualAssociationOverride = javaEntity.virtualAssociationOverrides().next();
- assertEquals("oneToOne", virtualAssociationOverride.getName());
- assertEquals(1, virtualAssociationOverride.joinColumnsSize());
- virtualAssociationOverride = javaEntity.virtualAssociationOverrides().next();
- virtualJoinColumn = virtualAssociationOverride.joinColumns().next();
- assertEquals("MY_JOIN_COLUMN", virtualJoinColumn.getName());
- assertEquals("MY_REFERENCE_COLUMN", virtualJoinColumn.getReferencedColumnName());
- assertEquals("BAR", virtualJoinColumn.getTable());
- assertEquals("COLUMN_DEF", virtualJoinColumn.getColumnDefinition());
- assertEquals(false, virtualJoinColumn.isInsertable());
- assertEquals(false, virtualJoinColumn.isUpdatable());
- assertEquals(true, virtualJoinColumn.isUnique());
- assertEquals(false, virtualJoinColumn.isNullable());
-
- assertEquals("MY_JOIN_COLUMN", virtualAssociationOverride.joinColumns().next().getName());
-
-
-
-
-
-
- //idMapping.getColumn().setSpecifiedName(null);
- //idMapping.getColumn().setSpecifiedTable(null);
- assertEquals(SUB_TYPE_NAME, typeResource.getName());
- assertNull(typeResource.getSupportingAnnotation(AssociationOverrideAnnotation.ANNOTATION_NAME));
- assertNull(typeResource.getSupportingAnnotation(AssociationOverridesAnnotation.ANNOTATION_NAME));
-
- virtualAssociationOverride = javaEntity.virtualAssociationOverrides().next();
- assertEquals("oneToOne", virtualAssociationOverride.getName());
-
- virtualAssociationOverride = virtualAssociationOverride.setVirtual(false);
- assertEquals(1, javaEntity.virtualAssociationOverridesSize());
-
-
-
-// //TODO joinColumns for default association overrides
-//// IJoinColumn defaultJoinColumn = defaultAssociationOverride.joinColumns().next();
-//// assertEquals("address", defaultJoinColumn.getName());
-//// assertEquals("address", defaultJoinColumn.getReferencedColumnName());
-//// assertEquals(SUB_TYPE_NAME, defaultJoinColumn.getTable());
-////
-////
-//// IMappedSuperclass mappedSuperclass = (IMappedSuperclass) javaPersistentType().getMapping();
-////
-//// IOneToOneMapping addressMapping = (IOneToOneMapping) mappedSuperclass.persistentType().attributeNamed("address").getMapping();
-//// IJoinColumn joinColumn = addressMapping.addSpecifiedJoinColumn(0);
-//// joinColumn.setSpecifiedName("FOO");
-//// 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(1, CollectionTools.size(javaEntity.defaultAssociationOverrides()));
-//// defaultAssociationOverride = javaEntity.defaultAssociationOverrides().next();
-//// assertEquals("address", defaultAssociationOverride.getName());
-//// assertEquals("FOO", defaultJoinColumn.getName());
-//// assertEquals("BAR", defaultJoinColumn.getReferencedColumnName());
-//// assertEquals("BAZ", defaultJoinColumn.getTable());
-////
-//// 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));
-////
-//// defaultAssociationOverride = javaEntity.defaultAssociationOverrides().next();
-//// assertEquals("address", defaultJoinColumn.getName());
-//// assertEquals("address", defaultJoinColumn.getReferencedColumnName());
-//// assertEquals(SUB_TYPE_NAME, defaultJoinColumn.getTable());
-////
-//// javaEntity.addSpecifiedAssociationOverride(0).setName("address");
-//// assertEquals(0, CollectionTools.size(javaEntity.defaultAssociationOverrides()));
-
- }
-
- public void testSpecifiedAssociationOverridesSize() throws Exception {
- createTestEntity();
- addXmlClassRef(FULLY_QUALIFIED_TYPE_NAME);
-
- assertEquals(0, getJavaEntity().specifiedAssociationOverridesSize());
-
- JavaResourcePersistentType typeResource = getJpaProject().getJavaResourcePersistentType(FULLY_QUALIFIED_TYPE_NAME);
-
- //add an annotation to the resource model and verify the context model is updated
- AssociationOverrideAnnotation associationOverride = (AssociationOverrideAnnotation) typeResource.addSupportingAnnotation(0, JPA.ASSOCIATION_OVERRIDE, JPA.ASSOCIATION_OVERRIDES);
- associationOverride.setName("FOO");
- associationOverride = (AssociationOverrideAnnotation) typeResource.addSupportingAnnotation(0, JPA.ASSOCIATION_OVERRIDE, JPA.ASSOCIATION_OVERRIDES);
- associationOverride.setName("BAR");
-
- assertEquals(2, getJavaEntity().specifiedAssociationOverridesSize());
- }
-
- public void testVirtualAssociationOverridesSize() throws Exception {
- createTestMappedSuperclass();
- createTestSubType();
-
- addXmlClassRef(FULLY_QUALIFIED_SUB_TYPE_NAME);
- addXmlClassRef(FULLY_QUALIFIED_TYPE_NAME);
- Entity javaEntity = getJavaEntity();
-
- assertEquals(2, javaEntity.virtualAssociationOverridesSize());
-
- javaEntity.virtualAssociationOverrides().next().setVirtual(false);
- assertEquals(1, javaEntity.virtualAssociationOverridesSize());
-
- javaEntity.virtualAssociationOverrides().next().setVirtual(false);
- assertEquals(0, javaEntity.virtualAssociationOverridesSize());
- }
-
- public void testAssociationOverridesSize() throws Exception {
- createTestMappedSuperclass();
- createTestSubType();
-
- addXmlClassRef(FULLY_QUALIFIED_SUB_TYPE_NAME);
- addXmlClassRef(FULLY_QUALIFIED_TYPE_NAME);
- Entity javaEntity = getJavaEntity();
-
- assertEquals(2, javaEntity.associationOverridesSize());
-
- javaEntity.virtualAssociationOverrides().next().setVirtual(false);
- assertEquals(2, javaEntity.associationOverridesSize());
-
- javaEntity.virtualAssociationOverrides().next().setVirtual(false);
- assertEquals(2, javaEntity.associationOverridesSize());
-
-
- JavaResourcePersistentType typeResource = getJpaProject().getJavaResourcePersistentType(FULLY_QUALIFIED_SUB_TYPE_NAME);
- AssociationOverrideAnnotation annotation = (AssociationOverrideAnnotation) typeResource.addSupportingAnnotation(0, JPA.ASSOCIATION_OVERRIDE, JPA.ASSOCIATION_OVERRIDES);
- annotation.setName("bar");
- assertEquals(3, javaEntity.associationOverridesSize());
- }
-
- public void testAssociationOverrideSetVirtual() throws Exception {
- createTestMappedSuperclass();
- createTestSubType();
-
- addXmlClassRef(FULLY_QUALIFIED_SUB_TYPE_NAME);
- addXmlClassRef(FULLY_QUALIFIED_TYPE_NAME);
-
- getJavaEntity().virtualAssociationOverrides().next().setVirtual(false);
- getJavaEntity().virtualAssociationOverrides().next().setVirtual(false);
-
- JavaResourcePersistentType typeResource = getJpaProject().getJavaResourcePersistentType(FULLY_QUALIFIED_SUB_TYPE_NAME);
- Iterator<NestableAnnotation> associationOverrides = typeResource.supportingAnnotations(AssociationOverrideAnnotation.ANNOTATION_NAME, AssociationOverridesAnnotation.ANNOTATION_NAME);
-
- assertEquals("oneToOne", ((AssociationOverrideAnnotation) associationOverrides.next()).getName());
- assertEquals("manyToOne", ((AssociationOverrideAnnotation) associationOverrides.next()).getName());
- assertFalse(associationOverrides.hasNext());
- }
-
- public void testAssociationOverrideSetVirtual2() throws Exception {
- createTestMappedSuperclass();
- createTestSubType();
-
- addXmlClassRef(FULLY_QUALIFIED_SUB_TYPE_NAME);
- addXmlClassRef(FULLY_QUALIFIED_TYPE_NAME);
-
- ListIterator<JavaAssociationOverride> virtualAssociationOverrides = getJavaEntity().virtualAssociationOverrides();
- virtualAssociationOverrides.next();
- virtualAssociationOverrides.next().setVirtual(false);
- getJavaEntity().virtualAssociationOverrides().next().setVirtual(false);
-
- JavaResourcePersistentType typeResource = getJpaProject().getJavaResourcePersistentType(FULLY_QUALIFIED_SUB_TYPE_NAME);
- Iterator<NestableAnnotation> associationOverrides = typeResource.supportingAnnotations(AssociationOverrideAnnotation.ANNOTATION_NAME, AssociationOverridesAnnotation.ANNOTATION_NAME);
-
- assertEquals("manyToOne", ((AssociationOverrideAnnotation) associationOverrides.next()).getName());
- assertEquals("oneToOne", ((AssociationOverrideAnnotation) associationOverrides.next()).getName());
- assertFalse(associationOverrides.hasNext());
- }
-
- public void testAssociationOverrideSetVirtualTrue() throws Exception {
- createTestMappedSuperclass();
- createTestSubType();
-
- addXmlClassRef(FULLY_QUALIFIED_SUB_TYPE_NAME);
- addXmlClassRef(FULLY_QUALIFIED_TYPE_NAME);
-
- getJavaEntity().virtualAssociationOverrides().next().setVirtual(false);
- getJavaEntity().virtualAssociationOverrides().next().setVirtual(false);
-
- JavaResourcePersistentType typeResource = getJpaProject().getJavaResourcePersistentType(FULLY_QUALIFIED_SUB_TYPE_NAME);
- assertEquals(2, CollectionTools.size(typeResource.supportingAnnotations(AssociationOverrideAnnotation.ANNOTATION_NAME, AssociationOverridesAnnotation.ANNOTATION_NAME)));
-
- getJavaEntity().specifiedAssociationOverrides().next().setVirtual(true);
-
- Iterator<NestableAnnotation> associationOverrideResources = typeResource.supportingAnnotations(AssociationOverrideAnnotation.ANNOTATION_NAME, AssociationOverridesAnnotation.ANNOTATION_NAME);
- assertEquals("manyToOne", ((AssociationOverrideAnnotation) associationOverrideResources.next()).getName());
- assertFalse(associationOverrideResources.hasNext());
-
- Iterator<JavaAssociationOverride> associationOverrides = getJavaEntity().specifiedAssociationOverrides();
- assertEquals("manyToOne", associationOverrides.next().getName());
- assertFalse(associationOverrides.hasNext());
-
-
- getJavaEntity().specifiedAssociationOverrides().next().setVirtual(true);
- associationOverrideResources = typeResource.supportingAnnotations(AssociationOverrideAnnotation.ANNOTATION_NAME, AssociationOverridesAnnotation.ANNOTATION_NAME);
- assertFalse(associationOverrideResources.hasNext());
- associationOverrides = getJavaEntity().specifiedAssociationOverrides();
- assertFalse(associationOverrides.hasNext());
-
- assertNull(typeResource.getSupportingAnnotation(AssociationOverridesAnnotation.ANNOTATION_NAME));
- }
-
- public void testMoveSpecifiedAssociationOverride() throws Exception {
- createTestMappedSuperclass();
- createTestSubType();
-
- addXmlClassRef(FULLY_QUALIFIED_SUB_TYPE_NAME);
- addXmlClassRef(FULLY_QUALIFIED_TYPE_NAME);
-
- Entity entity = getJavaEntity();
- getJavaEntity().virtualAssociationOverrides().next().setVirtual(false);
- getJavaEntity().virtualAssociationOverrides().next().setVirtual(false);
-
-
- JavaResourcePersistentType typeResource = getJpaProject().getJavaResourcePersistentType(FULLY_QUALIFIED_SUB_TYPE_NAME);
-
- ListIterator<NestableAnnotation> javaAssociationOverrides = typeResource.supportingAnnotations(AssociationOverrideAnnotation.ANNOTATION_NAME, AssociationOverridesAnnotation.ANNOTATION_NAME);
- assertEquals(2, CollectionTools.size(javaAssociationOverrides));
-
-
- entity.moveSpecifiedAssociationOverride(1, 0);
- ListIterator<AssociationOverride> associationOverrides = entity.specifiedAssociationOverrides();
- assertEquals("manyToOne", associationOverrides.next().getName());
- assertEquals("oneToOne", associationOverrides.next().getName());
-
- javaAssociationOverrides = typeResource.supportingAnnotations(AssociationOverrideAnnotation.ANNOTATION_NAME, AssociationOverridesAnnotation.ANNOTATION_NAME);
- assertEquals("manyToOne", ((AssociationOverrideAnnotation) javaAssociationOverrides.next()).getName());
- assertEquals("oneToOne", ((AssociationOverrideAnnotation) javaAssociationOverrides.next()).getName());
-
-
- entity.moveSpecifiedAssociationOverride(0, 1);
- associationOverrides = entity.specifiedAssociationOverrides();
- assertEquals("oneToOne", associationOverrides.next().getName());
- assertEquals("manyToOne", associationOverrides.next().getName());
-
- javaAssociationOverrides = typeResource.supportingAnnotations(AssociationOverrideAnnotation.ANNOTATION_NAME, AssociationOverridesAnnotation.ANNOTATION_NAME);
- assertEquals("oneToOne", ((AssociationOverrideAnnotation) javaAssociationOverrides.next()).getName());
- assertEquals("manyToOne", ((AssociationOverrideAnnotation) javaAssociationOverrides.next()).getName());
- }
-
- public void testUpdateSpecifiedAssociationOverrides() throws Exception {
- createTestEntity();
- addXmlClassRef(FULLY_QUALIFIED_TYPE_NAME);
-
- Entity entity = getJavaEntity();
- JavaResourcePersistentType typeResource = getJpaProject().getJavaResourcePersistentType(FULLY_QUALIFIED_TYPE_NAME);
-
- ((AssociationOverrideAnnotation) typeResource.addSupportingAnnotation(0, AssociationOverrideAnnotation.ANNOTATION_NAME, AssociationOverridesAnnotation.ANNOTATION_NAME)).setName("FOO");
- ((AssociationOverrideAnnotation) typeResource.addSupportingAnnotation(1, AssociationOverrideAnnotation.ANNOTATION_NAME, AssociationOverridesAnnotation.ANNOTATION_NAME)).setName("BAR");
- ((AssociationOverrideAnnotation) typeResource.addSupportingAnnotation(2, AssociationOverrideAnnotation.ANNOTATION_NAME, AssociationOverridesAnnotation.ANNOTATION_NAME)).setName("BAZ");
-
- ListIterator<AssociationOverride> associationOverrides = entity.specifiedAssociationOverrides();
- assertEquals("FOO", associationOverrides.next().getName());
- assertEquals("BAR", associationOverrides.next().getName());
- assertEquals("BAZ", associationOverrides.next().getName());
- assertFalse(associationOverrides.hasNext());
-
- typeResource.moveSupportingAnnotation(2, 0, AssociationOverridesAnnotation.ANNOTATION_NAME);
- associationOverrides = entity.specifiedAssociationOverrides();
- assertEquals("BAR", associationOverrides.next().getName());
- assertEquals("BAZ", associationOverrides.next().getName());
- assertEquals("FOO", associationOverrides.next().getName());
- assertFalse(associationOverrides.hasNext());
-
- typeResource.moveSupportingAnnotation(0, 1, AssociationOverridesAnnotation.ANNOTATION_NAME);
- associationOverrides = entity.specifiedAssociationOverrides();
- assertEquals("BAZ", associationOverrides.next().getName());
- assertEquals("BAR", associationOverrides.next().getName());
- assertEquals("FOO", associationOverrides.next().getName());
- assertFalse(associationOverrides.hasNext());
-
- typeResource.removeSupportingAnnotation(1, AssociationOverrideAnnotation.ANNOTATION_NAME, AssociationOverridesAnnotation.ANNOTATION_NAME);
- associationOverrides = entity.specifiedAssociationOverrides();
- assertEquals("BAZ", associationOverrides.next().getName());
- assertEquals("FOO", associationOverrides.next().getName());
- assertFalse(associationOverrides.hasNext());
-
- typeResource.removeSupportingAnnotation(1, AssociationOverrideAnnotation.ANNOTATION_NAME, AssociationOverridesAnnotation.ANNOTATION_NAME);
- associationOverrides = entity.specifiedAssociationOverrides();
- assertEquals("BAZ", associationOverrides.next().getName());
- assertFalse(associationOverrides.hasNext());
-
- typeResource.removeSupportingAnnotation(0, AssociationOverrideAnnotation.ANNOTATION_NAME, AssociationOverridesAnnotation.ANNOTATION_NAME);
- associationOverrides = entity.specifiedAssociationOverrides();
- assertFalse(associationOverrides.hasNext());
- }
-
- public void testAssociationOverrideIsVirtual() throws Exception {
- createTestMappedSuperclass();
- createTestSubType();
- addXmlClassRef(PACKAGE_NAME + ".AnnotationTestTypeChild");
- addXmlClassRef(FULLY_QUALIFIED_TYPE_NAME);
-
- ListIterator<JavaAssociationOverride> virtualAssociationOverrides = getJavaEntity().virtualAssociationOverrides();
- AssociationOverride virtualAssociationOverride = virtualAssociationOverrides.next();
- assertEquals("oneToOne", virtualAssociationOverride.getName());
- assertTrue(virtualAssociationOverride.isVirtual());
-
- virtualAssociationOverride = virtualAssociationOverrides.next();
- assertEquals("manyToOne", virtualAssociationOverride.getName());
- assertTrue(virtualAssociationOverride.isVirtual());
- assertFalse(virtualAssociationOverrides.hasNext());
-
- getJavaEntity().virtualAssociationOverrides().next().setVirtual(false);
- AssociationOverride specifiedAssociationOverride = getJavaEntity().specifiedAssociationOverrides().next();
- assertFalse(specifiedAssociationOverride.isVirtual());
-
-
- virtualAssociationOverrides = getJavaEntity().virtualAssociationOverrides();
- virtualAssociationOverride = virtualAssociationOverrides.next();
- assertEquals("manyToOne", virtualAssociationOverride.getName());
- assertTrue(virtualAssociationOverride.isVirtual());
- assertFalse(virtualAssociationOverrides.hasNext());
- }
-
- public void testAddNamedQuery() throws Exception {
- createTestEntity();
- addXmlClassRef(FULLY_QUALIFIED_TYPE_NAME);
-
- JavaEntity entity = getJavaEntity();
- JavaResourcePersistentType typeResource = getJpaProject().getJavaResourcePersistentType(FULLY_QUALIFIED_TYPE_NAME);
-
- NamedQuery namedQuery1 = entity.getQueryContainer().addNamedQuery(0);
- namedQuery1.setName("FOO");
-
- ListIterator<NestableAnnotation> javaNamedQueries = typeResource.supportingAnnotations(NamedQueryAnnotation.ANNOTATION_NAME, NamedQueriesAnnotation.ANNOTATION_NAME);
- assertEquals("FOO", ((NamedQueryAnnotation) javaNamedQueries.next()).getName());
-
- NamedQuery namedQuery2 = entity.getQueryContainer().addNamedQuery(0);
- namedQuery2.setName("BAR");
-
- javaNamedQueries = typeResource.supportingAnnotations(NamedQueryAnnotation.ANNOTATION_NAME, NamedQueriesAnnotation.ANNOTATION_NAME);
- assertEquals("BAR", ((NamedQueryAnnotation) javaNamedQueries.next()).getName());
- assertEquals("FOO", ((NamedQueryAnnotation) javaNamedQueries.next()).getName());
-
- NamedQuery namedQuery3 = entity.getQueryContainer().addNamedQuery(1);
- namedQuery3.setName("BAZ");
-
- javaNamedQueries = typeResource.supportingAnnotations(NamedQueryAnnotation.ANNOTATION_NAME, NamedQueriesAnnotation.ANNOTATION_NAME);
- assertEquals("BAR", ((NamedQueryAnnotation) javaNamedQueries.next()).getName());
- assertEquals("BAZ", ((NamedQueryAnnotation) javaNamedQueries.next()).getName());
- assertEquals("FOO", ((NamedQueryAnnotation) javaNamedQueries.next()).getName());
-
- ListIterator<JavaNamedQuery> namedQueries = entity.getQueryContainer().namedQueries();
- assertEquals(namedQuery2, namedQueries.next());
- assertEquals(namedQuery3, namedQueries.next());
- assertEquals(namedQuery1, namedQueries.next());
-
- namedQueries = entity.getQueryContainer().namedQueries();
- assertEquals("BAR", namedQueries.next().getName());
- assertEquals("BAZ", namedQueries.next().getName());
- assertEquals("FOO", namedQueries.next().getName());
-
- entity.getQueryContainer().addNamedNativeQuery(0).setName("foo");
- }
-
- public void testRemoveNamedQuery() throws Exception {
- createTestEntity();
- addXmlClassRef(FULLY_QUALIFIED_TYPE_NAME);
-
- JavaEntity entity = getJavaEntity();
- JavaResourcePersistentType typeResource = getJpaProject().getJavaResourcePersistentType(FULLY_QUALIFIED_TYPE_NAME);
-
- entity.getQueryContainer().addNamedQuery(0).setName("FOO");
- entity.getQueryContainer().addNamedQuery(1).setName("BAR");
- entity.getQueryContainer().addNamedQuery(2).setName("BAZ");
-
- ListIterator<NestableAnnotation> javaNamedQueries = typeResource.supportingAnnotations(NamedQueryAnnotation.ANNOTATION_NAME, NamedQueriesAnnotation.ANNOTATION_NAME);
- assertEquals(3, CollectionTools.size(javaNamedQueries));
-
- entity.getQueryContainer().removeNamedQuery(0);
- javaNamedQueries = typeResource.supportingAnnotations(NamedQueryAnnotation.ANNOTATION_NAME, NamedQueriesAnnotation.ANNOTATION_NAME);
- assertEquals(2, CollectionTools.size(javaNamedQueries));
- javaNamedQueries = typeResource.supportingAnnotations(NamedQueryAnnotation.ANNOTATION_NAME, NamedQueriesAnnotation.ANNOTATION_NAME);
- assertEquals("BAR", ((NamedQueryAnnotation) javaNamedQueries.next()).getName());
- assertEquals("BAZ", ((NamedQueryAnnotation) javaNamedQueries.next()).getName());
-
- entity.getQueryContainer().removeNamedQuery(0);
- javaNamedQueries = typeResource.supportingAnnotations(NamedQueryAnnotation.ANNOTATION_NAME, NamedQueriesAnnotation.ANNOTATION_NAME);
- assertEquals(1, CollectionTools.size(javaNamedQueries));
- javaNamedQueries = typeResource.supportingAnnotations(NamedQueryAnnotation.ANNOTATION_NAME, NamedQueriesAnnotation.ANNOTATION_NAME);
- assertEquals("BAZ", ((NamedQueryAnnotation) javaNamedQueries.next()).getName());
-
- entity.getQueryContainer().removeNamedQuery(0);
- javaNamedQueries = typeResource.supportingAnnotations(NamedQueryAnnotation.ANNOTATION_NAME, NamedQueriesAnnotation.ANNOTATION_NAME);
- assertEquals(0, CollectionTools.size(javaNamedQueries));
- }
-
- public void testAddNamedNativeQueryWithNamedQuery() throws Exception {
- createTestEntity();
- addXmlClassRef(FULLY_QUALIFIED_TYPE_NAME);
-
- JavaEntity entity = getJavaEntity();
- JavaResourcePersistentType typeResource = getJpaProject().getJavaResourcePersistentType(FULLY_QUALIFIED_TYPE_NAME);
-
- entity.getQueryContainer().addNamedQuery(0).setName("FOO");
-
-
- NamedNativeQueryAnnotation nativeQuery = (NamedNativeQueryAnnotation) typeResource.addSupportingAnnotation(0, JPA.NAMED_NATIVE_QUERY, JPA.NAMED_NATIVE_QUERIES);
- nativeQuery.setName("BAR");
-
- assertEquals(1, entity.getQueryContainer().namedNativeQueriesSize());
- ListIterator<JavaNamedNativeQuery> namedQueries = entity.getQueryContainer().namedNativeQueries();
- assertEquals("BAR", namedQueries.next().getName());
- }
-
- public void testAddNamedQueryWithNamedNativeQuery() throws Exception {
- createTestEntity();
- addXmlClassRef(FULLY_QUALIFIED_TYPE_NAME);
-
- JavaEntity entity = getJavaEntity();
- JavaResourcePersistentType typeResource = getJpaProject().getJavaResourcePersistentType(FULLY_QUALIFIED_TYPE_NAME);
-
- entity.getQueryContainer().addNamedNativeQuery(0).setName("FOO");
-
-
- NamedQueryAnnotation namedQuery = (NamedQueryAnnotation) typeResource.addSupportingAnnotation(0, JPA.NAMED_QUERY, JPA.NAMED_QUERIES);
- namedQuery.setName("BAR");
-
- assertEquals(1, entity.getQueryContainer().namedQueriesSize());
- ListIterator<JavaNamedQuery> namedQueries = entity.getQueryContainer().namedQueries();
- assertEquals("BAR", namedQueries.next().getName());
- }
-
- public void testMoveNamedQuery() throws Exception {
- createTestEntity();
- addXmlClassRef(FULLY_QUALIFIED_TYPE_NAME);
-
- JavaEntity entity = getJavaEntity();
- JavaResourcePersistentType typeResource = getJpaProject().getJavaResourcePersistentType(FULLY_QUALIFIED_TYPE_NAME);
-
- entity.getQueryContainer().addNamedQuery(0).setName("FOO");
- entity.getQueryContainer().addNamedQuery(1).setName("BAR");
- entity.getQueryContainer().addNamedQuery(2).setName("BAZ");
-
- ListIterator<NestableAnnotation> javaNamedQueries = typeResource.supportingAnnotations(NamedQueryAnnotation.ANNOTATION_NAME, NamedQueriesAnnotation.ANNOTATION_NAME);
- assertEquals(3, CollectionTools.size(javaNamedQueries));
-
-
- entity.getQueryContainer().moveNamedQuery(2, 0);
- ListIterator<JavaNamedQuery> namedQueries = entity.getQueryContainer().namedQueries();
- assertEquals("BAR", namedQueries.next().getName());
- assertEquals("BAZ", namedQueries.next().getName());
- assertEquals("FOO", namedQueries.next().getName());
-
- javaNamedQueries = typeResource.supportingAnnotations(NamedQueryAnnotation.ANNOTATION_NAME, NamedQueriesAnnotation.ANNOTATION_NAME);
- 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();
- assertEquals("BAZ", namedQueries.next().getName());
- assertEquals("BAR", namedQueries.next().getName());
- assertEquals("FOO", namedQueries.next().getName());
-
- javaNamedQueries = typeResource.supportingAnnotations(NamedQueryAnnotation.ANNOTATION_NAME, NamedQueriesAnnotation.ANNOTATION_NAME);
- assertEquals("BAZ", ((NamedQueryAnnotation) javaNamedQueries.next()).getName());
- assertEquals("BAR", ((NamedQueryAnnotation) javaNamedQueries.next()).getName());
- assertEquals("FOO", ((NamedQueryAnnotation) javaNamedQueries.next()).getName());
- }
-
- public void testUpdateNamedQueries() throws Exception {
- createTestEntity();
- addXmlClassRef(FULLY_QUALIFIED_TYPE_NAME);
-
- JavaEntity entity = getJavaEntity();
- JavaResourcePersistentType typeResource = getJpaProject().getJavaResourcePersistentType(FULLY_QUALIFIED_TYPE_NAME);
-
- assertEquals(0, entity.getPersistenceUnit().queriesSize());
-
- ((NamedQueryAnnotation) typeResource.addSupportingAnnotation(0, NamedQueryAnnotation.ANNOTATION_NAME, NamedQueriesAnnotation.ANNOTATION_NAME)).setName("FOO");
- ((NamedQueryAnnotation) typeResource.addSupportingAnnotation(1, NamedQueryAnnotation.ANNOTATION_NAME, NamedQueriesAnnotation.ANNOTATION_NAME)).setName("BAR");
- ((NamedQueryAnnotation) typeResource.addSupportingAnnotation(2, NamedQueryAnnotation.ANNOTATION_NAME, NamedQueriesAnnotation.ANNOTATION_NAME)).setName("BAZ");
- ListIterator<JavaNamedQuery> namedQueries = entity.getQueryContainer().namedQueries();
- assertEquals("FOO", namedQueries.next().getName());
- assertEquals("BAR", namedQueries.next().getName());
- assertEquals("BAZ", namedQueries.next().getName());
- assertFalse(namedQueries.hasNext());
- assertEquals(3, entity.getPersistenceUnit().queriesSize());
-
- typeResource.moveSupportingAnnotation(2, 0, NamedQueriesAnnotation.ANNOTATION_NAME);
- namedQueries = entity.getQueryContainer().namedQueries();
- assertEquals("BAR", namedQueries.next().getName());
- assertEquals("BAZ", namedQueries.next().getName());
- assertEquals("FOO", namedQueries.next().getName());
- assertFalse(namedQueries.hasNext());
-
- typeResource.moveSupportingAnnotation(0, 1, NamedQueriesAnnotation.ANNOTATION_NAME);
- namedQueries = entity.getQueryContainer().namedQueries();
- assertEquals("BAZ", namedQueries.next().getName());
- assertEquals("BAR", namedQueries.next().getName());
- assertEquals("FOO", namedQueries.next().getName());
- assertFalse(namedQueries.hasNext());
-
- typeResource.removeSupportingAnnotation(1, NamedQueryAnnotation.ANNOTATION_NAME, NamedQueriesAnnotation.ANNOTATION_NAME);
- namedQueries = entity.getQueryContainer().namedQueries();
- assertEquals("BAZ", namedQueries.next().getName());
- assertEquals("FOO", namedQueries.next().getName());
- assertFalse(namedQueries.hasNext());
- assertEquals(2, entity.getPersistenceUnit().queriesSize());
-
- typeResource.removeSupportingAnnotation(1, NamedQueryAnnotation.ANNOTATION_NAME, NamedQueriesAnnotation.ANNOTATION_NAME);
- namedQueries = entity.getQueryContainer().namedQueries();
- assertEquals("BAZ", namedQueries.next().getName());
- assertFalse(namedQueries.hasNext());
- assertEquals(1, entity.getPersistenceUnit().queriesSize());
-
- typeResource.removeSupportingAnnotation(0, NamedQueryAnnotation.ANNOTATION_NAME, NamedQueriesAnnotation.ANNOTATION_NAME);
- namedQueries = entity.getQueryContainer().namedQueries();
- assertFalse(namedQueries.hasNext());
- assertEquals(0, entity.getPersistenceUnit().queriesSize());
- }
-
- public void testNamedQueriesSize() throws Exception {
- createTestEntity();
- addXmlClassRef(FULLY_QUALIFIED_TYPE_NAME);
-
- JavaEntity entity = getJavaEntity();
- JavaResourcePersistentType typeResource = getJpaProject().getJavaResourcePersistentType(FULLY_QUALIFIED_TYPE_NAME);
-
- assertEquals(0, entity.getQueryContainer().namedQueriesSize());
-
- ((NamedQueryAnnotation) typeResource.addSupportingAnnotation(0, NamedQueryAnnotation.ANNOTATION_NAME, NamedQueriesAnnotation.ANNOTATION_NAME)).setName("FOO");
- ((NamedQueryAnnotation) typeResource.addSupportingAnnotation(1, NamedQueryAnnotation.ANNOTATION_NAME, NamedQueriesAnnotation.ANNOTATION_NAME)).setName("BAR");
- ((NamedQueryAnnotation) typeResource.addSupportingAnnotation(2, NamedQueryAnnotation.ANNOTATION_NAME, NamedQueriesAnnotation.ANNOTATION_NAME)).setName("BAZ");
-
- assertEquals(3, entity.getQueryContainer().namedQueriesSize());
- }
-
- public void testAddNamedNativeQuery() throws Exception {
- createTestEntity();
- addXmlClassRef(FULLY_QUALIFIED_TYPE_NAME);
-
- JavaEntity entity = getJavaEntity();
- JavaResourcePersistentType typeResource = getJpaProject().getJavaResourcePersistentType(FULLY_QUALIFIED_TYPE_NAME);
-
- NamedNativeQuery namedNativeQuery = entity.getQueryContainer().addNamedNativeQuery(0);
- namedNativeQuery.setName("FOO");
-
- ListIterator<NestableAnnotation> javaNamedQueries = typeResource.supportingAnnotations(NamedNativeQueryAnnotation.ANNOTATION_NAME, NamedNativeQueriesAnnotation.ANNOTATION_NAME);
- assertEquals("FOO", ((NamedNativeQueryAnnotation) javaNamedQueries.next()).getName());
-
- NamedNativeQuery namedNativeQuery2 = entity.getQueryContainer().addNamedNativeQuery(0);
- namedNativeQuery2.setName("BAR");
-
- javaNamedQueries = typeResource.supportingAnnotations(NamedNativeQueryAnnotation.ANNOTATION_NAME, NamedNativeQueriesAnnotation.ANNOTATION_NAME);
- assertEquals("BAR", ((NamedNativeQueryAnnotation) javaNamedQueries.next()).getName());
- assertEquals("FOO", ((NamedNativeQueryAnnotation) javaNamedQueries.next()).getName());
-
- NamedNativeQuery namedNativeQuery3 = entity.getQueryContainer().addNamedNativeQuery(1);
- namedNativeQuery3.setName("BAZ");
-
- javaNamedQueries = typeResource.supportingAnnotations(NamedNativeQueryAnnotation.ANNOTATION_NAME, NamedNativeQueriesAnnotation.ANNOTATION_NAME);
- assertEquals("BAR", ((NamedNativeQueryAnnotation) javaNamedQueries.next()).getName());
- assertEquals("BAZ", ((NamedNativeQueryAnnotation) javaNamedQueries.next()).getName());
- assertEquals("FOO", ((NamedNativeQueryAnnotation) javaNamedQueries.next()).getName());
-
- ListIterator<JavaNamedNativeQuery> namedQueries = entity.getQueryContainer().namedNativeQueries();
- assertEquals(namedNativeQuery2, namedQueries.next());
- assertEquals(namedNativeQuery3, namedQueries.next());
- assertEquals(namedNativeQuery, namedQueries.next());
-
- namedQueries = entity.getQueryContainer().namedNativeQueries();
- assertEquals("BAR", namedQueries.next().getName());
- assertEquals("BAZ", namedQueries.next().getName());
- assertEquals("FOO", namedQueries.next().getName());
- }
-
- public void testRemoveNamedNativeQuery() throws Exception {
- createTestEntity();
- addXmlClassRef(FULLY_QUALIFIED_TYPE_NAME);
-
- JavaEntity entity = getJavaEntity();
- JavaResourcePersistentType typeResource = getJpaProject().getJavaResourcePersistentType(FULLY_QUALIFIED_TYPE_NAME);
-
- entity.getQueryContainer().addNamedNativeQuery(0).setName("FOO");
- entity.getQueryContainer().addNamedNativeQuery(1).setName("BAR");
- entity.getQueryContainer().addNamedNativeQuery(2).setName("BAZ");
-
- ListIterator<NestableAnnotation> javaNamedQueries = typeResource.supportingAnnotations(NamedNativeQueryAnnotation.ANNOTATION_NAME, NamedNativeQueriesAnnotation.ANNOTATION_NAME);
- assertEquals(3, CollectionTools.size(javaNamedQueries));
-
- entity.getQueryContainer().removeNamedNativeQuery(0);
- javaNamedQueries = typeResource.supportingAnnotations(NamedNativeQueryAnnotation.ANNOTATION_NAME, NamedNativeQueriesAnnotation.ANNOTATION_NAME);
- assertEquals(2, CollectionTools.size(javaNamedQueries));
- javaNamedQueries = typeResource.supportingAnnotations(NamedNativeQueryAnnotation.ANNOTATION_NAME, NamedNativeQueriesAnnotation.ANNOTATION_NAME);
- assertEquals("BAR", ((NamedNativeQueryAnnotation) javaNamedQueries.next()).getName());
- assertEquals("BAZ", ((NamedNativeQueryAnnotation) javaNamedQueries.next()).getName());
-
- entity.getQueryContainer().removeNamedNativeQuery(0);
- javaNamedQueries = typeResource.supportingAnnotations(NamedNativeQueryAnnotation.ANNOTATION_NAME, NamedNativeQueriesAnnotation.ANNOTATION_NAME);
- assertEquals(1, CollectionTools.size(javaNamedQueries));
- javaNamedQueries = typeResource.supportingAnnotations(NamedNativeQueryAnnotation.ANNOTATION_NAME, NamedNativeQueriesAnnotation.ANNOTATION_NAME);
- assertEquals("BAZ", ((NamedNativeQueryAnnotation) javaNamedQueries.next()).getName());
-
- entity.getQueryContainer().removeNamedNativeQuery(0);
- javaNamedQueries = typeResource.supportingAnnotations(NamedNativeQueryAnnotation.ANNOTATION_NAME, NamedNativeQueriesAnnotation.ANNOTATION_NAME);
- assertEquals(0, CollectionTools.size(javaNamedQueries));
- }
-
- public void testMoveNamedNativeQuery() throws Exception {
- createTestEntity();
- addXmlClassRef(FULLY_QUALIFIED_TYPE_NAME);
-
- JavaEntity entity = getJavaEntity();
- JavaResourcePersistentType typeResource = getJpaProject().getJavaResourcePersistentType(FULLY_QUALIFIED_TYPE_NAME);
-
- entity.getQueryContainer().addNamedNativeQuery(0).setName("FOO");
- entity.getQueryContainer().addNamedNativeQuery(1).setName("BAR");
- entity.getQueryContainer().addNamedNativeQuery(2).setName("BAZ");
-
- ListIterator<NestableAnnotation> javaNamedQueries = typeResource.supportingAnnotations(NamedNativeQueryAnnotation.ANNOTATION_NAME, NamedNativeQueriesAnnotation.ANNOTATION_NAME);
- assertEquals(3, CollectionTools.size(javaNamedQueries));
-
-
- entity.getQueryContainer().moveNamedNativeQuery(2, 0);
- ListIterator<JavaNamedNativeQuery> namedQueries = entity.getQueryContainer().namedNativeQueries();
- assertEquals("BAR", namedQueries.next().getName());
- assertEquals("BAZ", namedQueries.next().getName());
- assertEquals("FOO", namedQueries.next().getName());
-
- javaNamedQueries = typeResource.supportingAnnotations(NamedNativeQueryAnnotation.ANNOTATION_NAME, NamedNativeQueriesAnnotation.ANNOTATION_NAME);
- 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();
- assertEquals("BAZ", namedQueries.next().getName());
- assertEquals("BAR", namedQueries.next().getName());
- assertEquals("FOO", namedQueries.next().getName());
-
- javaNamedQueries = typeResource.supportingAnnotations(NamedNativeQueryAnnotation.ANNOTATION_NAME, NamedNativeQueriesAnnotation.ANNOTATION_NAME);
- assertEquals("BAZ", ((NamedNativeQueryAnnotation) javaNamedQueries.next()).getName());
- assertEquals("BAR", ((NamedNativeQueryAnnotation) javaNamedQueries.next()).getName());
- assertEquals("FOO", ((NamedNativeQueryAnnotation) javaNamedQueries.next()).getName());
- }
-
- public void testUpdateNamedNativeQueries() throws Exception {
- createTestEntity();
- addXmlClassRef(FULLY_QUALIFIED_TYPE_NAME);
-
- JavaEntity entity = getJavaEntity();
- JavaResourcePersistentType typeResource = getJpaProject().getJavaResourcePersistentType(FULLY_QUALIFIED_TYPE_NAME);
-
- assertEquals(0, entity.getPersistenceUnit().queriesSize());
-
- ((NamedNativeQueryAnnotation) typeResource.addSupportingAnnotation(0, NamedNativeQueryAnnotation.ANNOTATION_NAME, NamedNativeQueriesAnnotation.ANNOTATION_NAME)).setName("FOO");
- ((NamedNativeQueryAnnotation) typeResource.addSupportingAnnotation(1, NamedNativeQueryAnnotation.ANNOTATION_NAME, NamedNativeQueriesAnnotation.ANNOTATION_NAME)).setName("BAR");
- ((NamedNativeQueryAnnotation) typeResource.addSupportingAnnotation(2, NamedNativeQueryAnnotation.ANNOTATION_NAME, NamedNativeQueriesAnnotation.ANNOTATION_NAME)).setName("BAZ");
- ListIterator<JavaNamedNativeQuery> namedQueries = entity.getQueryContainer().namedNativeQueries();
- assertEquals("FOO", namedQueries.next().getName());
- assertEquals("BAR", namedQueries.next().getName());
- assertEquals("BAZ", namedQueries.next().getName());
- assertFalse(namedQueries.hasNext());
- assertEquals(3, entity.getPersistenceUnit().queriesSize());
-
- typeResource.moveSupportingAnnotation(2, 0, NamedNativeQueriesAnnotation.ANNOTATION_NAME);
- namedQueries = entity.getQueryContainer().namedNativeQueries();
- assertEquals("BAR", namedQueries.next().getName());
- assertEquals("BAZ", namedQueries.next().getName());
- assertEquals("FOO", namedQueries.next().getName());
- assertFalse(namedQueries.hasNext());
-
- typeResource.moveSupportingAnnotation(0, 1, NamedNativeQueriesAnnotation.ANNOTATION_NAME);
- namedQueries = entity.getQueryContainer().namedNativeQueries();
- assertEquals("BAZ", namedQueries.next().getName());
- assertEquals("BAR", namedQueries.next().getName());
- assertEquals("FOO", namedQueries.next().getName());
- assertFalse(namedQueries.hasNext());
-
- typeResource.removeSupportingAnnotation(1, NamedNativeQueryAnnotation.ANNOTATION_NAME, NamedNativeQueriesAnnotation.ANNOTATION_NAME);
- namedQueries = entity.getQueryContainer().namedNativeQueries();
- assertEquals("BAZ", namedQueries.next().getName());
- assertEquals("FOO", namedQueries.next().getName());
- assertFalse(namedQueries.hasNext());
- assertEquals(2, entity.getPersistenceUnit().queriesSize());
-
- typeResource.removeSupportingAnnotation(1, NamedNativeQueryAnnotation.ANNOTATION_NAME, NamedNativeQueriesAnnotation.ANNOTATION_NAME);
- namedQueries = entity.getQueryContainer().namedNativeQueries();
- assertEquals("BAZ", namedQueries.next().getName());
- assertFalse(namedQueries.hasNext());
- assertEquals(1, entity.getPersistenceUnit().queriesSize());
-
- typeResource.removeSupportingAnnotation(0, NamedNativeQueryAnnotation.ANNOTATION_NAME, NamedNativeQueriesAnnotation.ANNOTATION_NAME);
- namedQueries = entity.getQueryContainer().namedNativeQueries();
- assertFalse(namedQueries.hasNext());
- assertEquals(0, entity.getPersistenceUnit().queriesSize());
- }
-
- public void testNamedNativeQueriesSize() throws Exception {
- createTestEntity();
- addXmlClassRef(FULLY_QUALIFIED_TYPE_NAME);
-
- JavaEntity entity = getJavaEntity();
- JavaResourcePersistentType typeResource = getJpaProject().getJavaResourcePersistentType(FULLY_QUALIFIED_TYPE_NAME);
-
- assertEquals(0, entity.getQueryContainer().namedNativeQueriesSize());
-
- ((NamedNativeQueryAnnotation) typeResource.addSupportingAnnotation(0, NamedNativeQueryAnnotation.ANNOTATION_NAME, NamedNativeQueriesAnnotation.ANNOTATION_NAME)).setName("FOO");
- ((NamedNativeQueryAnnotation) typeResource.addSupportingAnnotation(1, NamedNativeQueryAnnotation.ANNOTATION_NAME, NamedNativeQueriesAnnotation.ANNOTATION_NAME)).setName("BAR");
- ((NamedNativeQueryAnnotation) typeResource.addSupportingAnnotation(2, NamedNativeQueryAnnotation.ANNOTATION_NAME, NamedNativeQueriesAnnotation.ANNOTATION_NAME)).setName("BAZ");
-
- assertEquals(3, entity.getQueryContainer().namedNativeQueriesSize());
- }
-
- public void testUpdateIdClass() throws Exception {
- createTestEntity();
- addXmlClassRef(FULLY_QUALIFIED_TYPE_NAME);
-
- JavaResourcePersistentType typeResource = getJpaProject().getJavaResourcePersistentType(FULLY_QUALIFIED_TYPE_NAME);
-
- assertNull(getJavaEntity().getIdClass());
- assertNull(typeResource.getSupportingAnnotation(IdClassAnnotation.ANNOTATION_NAME));
-
- IdClassAnnotation idClass = (IdClassAnnotation) typeResource.addSupportingAnnotation(IdClassAnnotation.ANNOTATION_NAME);
- assertNull(getJavaEntity().getIdClass());
- assertNotNull(typeResource.getSupportingAnnotation(IdClassAnnotation.ANNOTATION_NAME));
-
- idClass.setValue("model.Foo");
- assertEquals("model.Foo", getJavaEntity().getIdClass());
- assertEquals("model.Foo", ((IdClassAnnotation) typeResource.getSupportingAnnotation(IdClassAnnotation.ANNOTATION_NAME)).getValue());
-
- //test setting @IdClass value to null, IdClass annotation is removed
- idClass.setValue(null);
- assertNull(getJavaEntity().getIdClass());
- assertNull(typeResource.getSupportingAnnotation(IdClassAnnotation.ANNOTATION_NAME));
-
- //reset @IdClass value and then remove @IdClass
- idClass = (IdClassAnnotation) typeResource.addSupportingAnnotation(IdClassAnnotation.ANNOTATION_NAME);
- idClass.setValue("model.Foo");
- typeResource.removeSupportingAnnotation(IdClassAnnotation.ANNOTATION_NAME);
-
- assertNull(getJavaEntity().getIdClass());
- assertNull(typeResource.getSupportingAnnotation(IdClassAnnotation.ANNOTATION_NAME));
- }
-
- public void testModifyIdClass() throws Exception {
- createTestEntity();
- addXmlClassRef(FULLY_QUALIFIED_TYPE_NAME);
-
- JavaResourcePersistentType typeResource = getJpaProject().getJavaResourcePersistentType(FULLY_QUALIFIED_TYPE_NAME);
-
- assertNull(getJavaEntity().getIdClass());
- assertNull(typeResource.getSupportingAnnotation(IdClassAnnotation.ANNOTATION_NAME));
-
- getJavaEntity().setIdClass("model.Foo");
- assertEquals("model.Foo", ((IdClassAnnotation) typeResource.getSupportingAnnotation(IdClassAnnotation.ANNOTATION_NAME)).getValue());
- assertEquals("model.Foo", getJavaEntity().getIdClass());
-
- getJavaEntity().setIdClass(null);
- assertNull(getJavaEntity().getIdClass());
- assertNull(typeResource.getSupportingAnnotation(IdClassAnnotation.ANNOTATION_NAME));
- }
-
- public void testGetPrimaryKeyColumnNameWithAttributeOverride() throws Exception {
- createTestMappedSuperclass();
- createTestSubType();
- addXmlClassRef(PACKAGE_NAME + ".AnnotationTestTypeChild");
- addXmlClassRef(FULLY_QUALIFIED_TYPE_NAME);
-
- Iterator<ClassRef> classRefs = getPersistenceUnit().specifiedClassRefs();
- JavaPersistentType entityPersistentType = classRefs.next().getJavaPersistentType();
- JavaEntity javaEntity = (JavaEntity) entityPersistentType.getMapping();
- JavaPersistentType mappedSuperclassPersistentType = classRefs.next().getJavaPersistentType();
-
- assertEquals("id", javaEntity.getPrimaryKeyColumnName());
-
- ((JavaIdMapping) mappedSuperclassPersistentType.getAttributeNamed("id").getMapping()).getColumn().setSpecifiedName("MY_ID");
- assertEquals("MY_ID", javaEntity.getPrimaryKeyColumnName());
-
- ListIterator<JavaAttributeOverride> virtualAttributeOverrides = javaEntity.virtualAttributeOverrides();
- virtualAttributeOverrides.next();
- virtualAttributeOverrides.next();
- JavaAttributeOverride javaAttributeOverride = virtualAttributeOverrides.next();
- assertEquals("id", javaAttributeOverride.getName());
-
- javaAttributeOverride = (JavaAttributeOverride) javaAttributeOverride.setVirtual(false);
- javaAttributeOverride.getColumn().setSpecifiedName("ID");
- assertEquals("ID", javaEntity.getPrimaryKeyColumnName());
- }
-
- public void testDiscriminatorValueIsUndefinedConcreteClass() throws Exception {
- createTestEntity();
- addXmlClassRef(FULLY_QUALIFIED_TYPE_NAME);
- assertTrue(getJavaEntity().discriminatorValueIsUndefined());
-
- createTestSubType();
- addXmlClassRef(FULLY_QUALIFIED_SUB_TYPE_NAME);
- assertFalse(getJavaEntity().discriminatorValueIsUndefined());
- }
-
- public void testDiscriminatorValueIsUndefinedAbstractClass() throws Exception {
- createTestAbstractEntity();
- addXmlClassRef(FULLY_QUALIFIED_TYPE_NAME);
- assertTrue(getJavaEntity().discriminatorValueIsUndefined());
-
- createTestSubType();
- addXmlClassRef(FULLY_QUALIFIED_SUB_TYPE_NAME);
- assertTrue(getJavaEntity().discriminatorValueIsUndefined());
- }
-
- public void testSpecifiedDiscriminatorColumnIsAllowed() throws Exception {
- createAbstractTestEntity();
- createTestSubType();
- addXmlClassRef(PACKAGE_NAME + ".AnnotationTestTypeChild");
- addXmlClassRef(FULLY_QUALIFIED_TYPE_NAME);
-
- ListIterator<ClassRef> specifiedClassRefs = getPersistenceUnit().specifiedClassRefs();
- Entity concreteEntity = (Entity) specifiedClassRefs.next().getJavaPersistentType().getMapping();
- assertEquals("AnnotationTestTypeChild", concreteEntity.getName());
-
- Entity abstractEntity = (Entity) specifiedClassRefs.next().getJavaPersistentType().getMapping();
- assertEquals(TYPE_NAME, abstractEntity.getName());
-
- //table-per-class, no discriminator column allowed
- assertFalse(concreteEntity.specifiedDiscriminatorColumnIsAllowed());
- assertFalse(abstractEntity.specifiedDiscriminatorColumnIsAllowed());
-
-
- //single-table, discriminator column allowed on root entity
- abstractEntity.setSpecifiedInheritanceStrategy(null);
- assertFalse(concreteEntity.specifiedDiscriminatorColumnIsAllowed());
- assertTrue(abstractEntity.specifiedDiscriminatorColumnIsAllowed());
- }
-
- public void testAbstractEntityGetDefaultDiscriminatorColumnNameTablePerClassInheritance() throws Exception {
- createAbstractTestEntity();
- createTestSubType();
-
- addXmlClassRef(PACKAGE_NAME + ".AnnotationTestTypeChild");
- addXmlClassRef(FULLY_QUALIFIED_TYPE_NAME);
-
- ListIterator<ClassRef> specifiedClassRefs = getPersistenceUnit().specifiedClassRefs();
- Entity concreteEntity = (Entity) specifiedClassRefs.next().getJavaPersistentType().getMapping();
- assertEquals("AnnotationTestTypeChild", concreteEntity.getName());
-
- Entity abstractEntity = (Entity) specifiedClassRefs.next().getJavaPersistentType().getMapping();
- assertEquals(TYPE_NAME, abstractEntity.getName());
-
-
- assertEquals(InheritanceType.TABLE_PER_CLASS, abstractEntity.getSpecifiedInheritanceStrategy());
- assertEquals(null, concreteEntity.getSpecifiedInheritanceStrategy());
- assertEquals(InheritanceType.TABLE_PER_CLASS, concreteEntity.getDefaultInheritanceStrategy());
-
-
- assertTrue(abstractEntity.discriminatorValueIsUndefined());
- assertFalse(concreteEntity.specifiedDiscriminatorColumnIsAllowed());
- assertEquals(null, abstractEntity.getDiscriminatorColumn().getDefaultName());
- assertEquals(null, concreteEntity.getDiscriminatorColumn().getDefaultName());
-
- assertTrue(abstractEntity.discriminatorValueIsUndefined());
- assertEquals(null, abstractEntity.getDefaultDiscriminatorValue());
- assertTrue(concreteEntity.discriminatorValueIsUndefined());
- assertEquals(null, concreteEntity.getDefaultDiscriminatorValue());
- }
-}
diff --git a/jpa/tests/org.eclipse.jpt.core.tests/src/org/eclipse/jpt/core/tests/internal/context/java/JavaGeneratedValueTests.java b/jpa/tests/org.eclipse.jpt.core.tests/src/org/eclipse/jpt/core/tests/internal/context/java/JavaGeneratedValueTests.java
deleted file mode 100644
index 38f306f140..0000000000
--- a/jpa/tests/org.eclipse.jpt.core.tests/src/org/eclipse/jpt/core/tests/internal/context/java/JavaGeneratedValueTests.java
+++ /dev/null
@@ -1,147 +0,0 @@
-/*******************************************************************************
- * Copyright (c) 2007, 2008 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.
- *
- * Contributors:
- * Oracle - initial API and implementation
- ******************************************************************************/
-package org.eclipse.jpt.core.tests.internal.context.java;
-
-import java.util.Iterator;
-
-import org.eclipse.jdt.core.ICompilationUnit;
-import org.eclipse.jpt.core.context.GeneratedValue;
-import org.eclipse.jpt.core.context.GenerationType;
-import org.eclipse.jpt.core.context.IdMapping;
-import org.eclipse.jpt.core.resource.java.GeneratedValueAnnotation;
-import org.eclipse.jpt.core.resource.java.JPA;
-import org.eclipse.jpt.core.resource.java.JavaResourcePersistentAttribute;
-import org.eclipse.jpt.core.resource.java.JavaResourcePersistentType;
-import org.eclipse.jpt.core.tests.internal.context.ContextModelTestCase;
-import org.eclipse.jpt.utility.internal.iterators.ArrayIterator;
-
-public class JavaGeneratedValueTests extends ContextModelTestCase
-{
- private static final String GENERATOR = "MY_GENERATOR";
-
- private ICompilationUnit createTestEntityWithGeneratedValue() throws Exception {
- return this.createTestType(new DefaultAnnotationWriter() {
- @Override
- public Iterator<String> imports() {
- return new ArrayIterator<String>(JPA.ENTITY, JPA.GENERATED_VALUE, JPA.ID);
- }
- @Override
- public void appendTypeAnnotationTo(StringBuilder sb) {
- sb.append("@Entity");
- }
-
- @Override
- public void appendIdFieldAnnotationTo(StringBuilder sb) {
- sb.append("@Id").append(CR);
- sb.append("@GeneratedValue(generator=\"" + GENERATOR + "\")");
- }
- });
- }
-
- public JavaGeneratedValueTests(String name) {
- super(name);
- }
-
- public void testGetGenerator() throws Exception {
- createTestEntityWithGeneratedValue();
- addXmlClassRef(FULLY_QUALIFIED_TYPE_NAME);
-
- IdMapping idMapping = (IdMapping) getJavaPersistentType().getAttributeNamed("id").getMapping();
- 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.getSupportingAnnotation(JPA.GENERATED_VALUE);
-
- generatedValue.setGenerator("foo");
-
- assertEquals("foo", idMapping.getGeneratedValue().getGenerator());
- }
-
- public void testSetSpecifiedGenerator() throws Exception {
- createTestEntityWithGeneratedValue();
- addXmlClassRef(FULLY_QUALIFIED_TYPE_NAME);
-
- IdMapping idMapping = (IdMapping) getJavaPersistentType().getAttributeNamed("id").getMapping();
- assertEquals(GENERATOR, idMapping.getGeneratedValue().getGenerator());
-
- idMapping.getGeneratedValue().setSpecifiedGenerator("foo");
-
- assertEquals("foo", idMapping.getGeneratedValue().getGenerator());
-
- JavaResourcePersistentType typeResource = getJpaProject().getJavaResourcePersistentType(FULLY_QUALIFIED_TYPE_NAME);
- JavaResourcePersistentAttribute attributeResource = typeResource.persistableAttributes().next();
- GeneratedValueAnnotation generatedValue = (GeneratedValueAnnotation) attributeResource.getSupportingAnnotation(JPA.GENERATED_VALUE);
-
- assertEquals("foo", generatedValue.getGenerator());
- }
-
- public void testSetSpecifiedNameNull() throws Exception {
- createTestEntityWithGeneratedValue();
- addXmlClassRef(FULLY_QUALIFIED_TYPE_NAME);
-
- IdMapping idMapping = (IdMapping) getJavaPersistentType().getAttributeNamed("id").getMapping();
- assertEquals(GENERATOR, idMapping.getGeneratedValue().getGenerator());
-
- idMapping.getGeneratedValue().setSpecifiedGenerator(null);
-
- assertNotNull(idMapping.getGeneratedValue());
-
- JavaResourcePersistentType typeResource = getJpaProject().getJavaResourcePersistentType(FULLY_QUALIFIED_TYPE_NAME);
- JavaResourcePersistentAttribute attributeResource = typeResource.persistableAttributes().next();
- GeneratedValueAnnotation generatedValue = (GeneratedValueAnnotation) attributeResource.getSupportingAnnotation(JPA.GENERATED_VALUE);
-
- assertNotNull(generatedValue);
- }
-
- public void testGetStrategy() throws Exception {
- createTestEntityWithGeneratedValue();
- addXmlClassRef(FULLY_QUALIFIED_TYPE_NAME);
-
- IdMapping idMapping = (IdMapping) getJavaPersistentType().getAttributeNamed("id").getMapping();
- 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.getSupportingAnnotation(JPA.GENERATED_VALUE);
-
- generatedValue.setStrategy(org.eclipse.jpt.core.resource.java.GenerationType.IDENTITY);
-
- assertEquals(GenerationType.IDENTITY, idMapping.getGeneratedValue().getStrategy());
- assertEquals(GeneratedValue.DEFAULT_STRATEGY, idMapping.getGeneratedValue().getDefaultStrategy());
- }
-
- public void testSetSpecifiedStrategy() throws Exception {
- createTestEntityWithGeneratedValue();
- addXmlClassRef(FULLY_QUALIFIED_TYPE_NAME);
-
- IdMapping idMapping = (IdMapping) getJavaPersistentType().getAttributeNamed("id").getMapping();
- assertEquals(GeneratedValue.DEFAULT_STRATEGY, idMapping.getGeneratedValue().getStrategy());
-
- idMapping.getGeneratedValue().setSpecifiedStrategy(GenerationType.IDENTITY);
-
- assertEquals(GenerationType.IDENTITY, idMapping.getGeneratedValue().getStrategy());
-
- JavaResourcePersistentType typeResource = getJpaProject().getJavaResourcePersistentType(FULLY_QUALIFIED_TYPE_NAME);
- JavaResourcePersistentAttribute attributeResource = typeResource.persistableAttributes().next();
- GeneratedValueAnnotation generatedValue = (GeneratedValueAnnotation) attributeResource.getSupportingAnnotation(JPA.GENERATED_VALUE);
-
- assertEquals(org.eclipse.jpt.core.resource.java.GenerationType.IDENTITY, generatedValue.getStrategy());
-
- idMapping.getGeneratedValue().setSpecifiedStrategy(null);
-
- assertEquals(GeneratedValue.DEFAULT_STRATEGY, idMapping.getGeneratedValue().getStrategy());
- generatedValue = (GeneratedValueAnnotation) attributeResource.getSupportingAnnotation(JPA.GENERATED_VALUE);
- assertNotNull(generatedValue);
- assertNull(generatedValue.getStrategy());
- }
-}
diff --git a/jpa/tests/org.eclipse.jpt.core.tests/src/org/eclipse/jpt/core/tests/internal/context/java/JavaIdMappingTests.java b/jpa/tests/org.eclipse.jpt.core.tests/src/org/eclipse/jpt/core/tests/internal/context/java/JavaIdMappingTests.java
deleted file mode 100644
index 7065b047ae..0000000000
--- a/jpa/tests/org.eclipse.jpt.core.tests/src/org/eclipse/jpt/core/tests/internal/context/java/JavaIdMappingTests.java
+++ /dev/null
@@ -1,707 +0,0 @@
-/*******************************************************************************
- * Copyright (c) 2007, 2009 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.
- *
- * Contributors:
- * Oracle - initial API and implementation
- ******************************************************************************/
-package org.eclipse.jpt.core.tests.internal.context.java;
-
-import java.util.Iterator;
-import org.eclipse.jdt.core.ICompilationUnit;
-import org.eclipse.jpt.core.MappingKeys;
-import org.eclipse.jpt.core.context.BasicMapping;
-import org.eclipse.jpt.core.context.Converter;
-import org.eclipse.jpt.core.context.EmbeddedIdMapping;
-import org.eclipse.jpt.core.context.EmbeddedMapping;
-import org.eclipse.jpt.core.context.IdMapping;
-import org.eclipse.jpt.core.context.ManyToManyMapping;
-import org.eclipse.jpt.core.context.ManyToOneMapping;
-import org.eclipse.jpt.core.context.OneToManyMapping;
-import org.eclipse.jpt.core.context.OneToOneMapping;
-import org.eclipse.jpt.core.context.PersistentAttribute;
-import org.eclipse.jpt.core.context.TemporalConverter;
-import org.eclipse.jpt.core.context.TemporalType;
-import org.eclipse.jpt.core.context.TransientMapping;
-import org.eclipse.jpt.core.context.VersionMapping;
-import org.eclipse.jpt.core.resource.java.BasicAnnotation;
-import org.eclipse.jpt.core.resource.java.ColumnAnnotation;
-import org.eclipse.jpt.core.resource.java.EmbeddedAnnotation;
-import org.eclipse.jpt.core.resource.java.EmbeddedIdAnnotation;
-import org.eclipse.jpt.core.resource.java.GeneratedValueAnnotation;
-import org.eclipse.jpt.core.resource.java.IdAnnotation;
-import org.eclipse.jpt.core.resource.java.JPA;
-import org.eclipse.jpt.core.resource.java.JavaResourcePersistentAttribute;
-import org.eclipse.jpt.core.resource.java.JavaResourcePersistentType;
-import org.eclipse.jpt.core.resource.java.ManyToManyAnnotation;
-import org.eclipse.jpt.core.resource.java.ManyToOneAnnotation;
-import org.eclipse.jpt.core.resource.java.OneToManyAnnotation;
-import org.eclipse.jpt.core.resource.java.OneToOneAnnotation;
-import org.eclipse.jpt.core.resource.java.SequenceGeneratorAnnotation;
-import org.eclipse.jpt.core.resource.java.TableGeneratorAnnotation;
-import org.eclipse.jpt.core.resource.java.TemporalAnnotation;
-import org.eclipse.jpt.core.resource.java.TransientAnnotation;
-import org.eclipse.jpt.core.resource.java.VersionAnnotation;
-import org.eclipse.jpt.core.tests.internal.context.ContextModelTestCase;
-import org.eclipse.jpt.utility.internal.iterators.ArrayIterator;
-
-@SuppressWarnings("nls")
-public class JavaIdMappingTests extends ContextModelTestCase
-{
-
- private ICompilationUnit createTestEntityWithIdMapping() 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").append(CR);
- }
-
- @Override
- public void appendIdFieldAnnotationTo(StringBuilder sb) {
- sb.append("@Id").append(CR);
- }
- });
- }
-
- private ICompilationUnit createTestEntityWithTemporal() throws Exception {
- return this.createTestType(new DefaultAnnotationWriter() {
- @Override
- public Iterator<String> imports() {
- return new ArrayIterator<String>(JPA.ENTITY, JPA.ID, JPA.TEMPORAL, JPA.TEMPORAL_TYPE);
- }
- @Override
- public void appendTypeAnnotationTo(StringBuilder sb) {
- sb.append("@Entity").append(CR);
- }
-
- @Override
- public void appendIdFieldAnnotationTo(StringBuilder sb) {
- sb.append("@Id").append(CR);
- sb.append("@Temporal(TemporalType.TIMESTAMP)").append(CR);
- }
- });
- }
-
- private ICompilationUnit createTestEntityWithIdMappingGeneratedValue() throws Exception {
- return this.createTestType(new DefaultAnnotationWriter() {
- @Override
- public Iterator<String> imports() {
- return new ArrayIterator<String>(JPA.ENTITY, JPA.ID, JPA.GENERATED_VALUE);
- }
- @Override
- public void appendTypeAnnotationTo(StringBuilder sb) {
- sb.append("@Entity").append(CR);
- }
-
- @Override
- public void appendIdFieldAnnotationTo(StringBuilder sb) {
- sb.append("@Id").append(CR);
- sb.append("@GeneratedValue").append(CR);
- }
- });
- }
-
- public JavaIdMappingTests(String name) {
- super(name);
- }
-
- public void testMorphToBasicMapping() throws Exception {
- createTestEntityWithIdMapping();
- addXmlClassRef(FULLY_QUALIFIED_TYPE_NAME);
-
- PersistentAttribute persistentAttribute = getJavaPersistentType().attributes().next();
- IdMapping idMapping = (IdMapping) persistentAttribute.getMapping();
- assertFalse(idMapping.isDefault());
- idMapping.getColumn().setSpecifiedName("FOO");
- idMapping.setSpecifiedConverter(Converter.TEMPORAL_CONVERTER);
- ((TemporalConverter) idMapping.getSpecifiedConverter()).setTemporalType(TemporalType.TIME);
- idMapping.addGeneratedValue();
- idMapping.getGeneratorContainer().addTableGenerator();
- idMapping.getGeneratorContainer().addSequenceGenerator();
- assertFalse(idMapping.isDefault());
-
- persistentAttribute.setSpecifiedMappingKey(MappingKeys.BASIC_ATTRIBUTE_MAPPING_KEY);
- 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.getMappingAnnotation(IdAnnotation.ANNOTATION_NAME));
- assertNotNull(attributeResource.getMappingAnnotation(BasicAnnotation.ANNOTATION_NAME));
- assertNotNull(attributeResource.getSupportingAnnotation(ColumnAnnotation.ANNOTATION_NAME));
- assertNotNull(attributeResource.getSupportingAnnotation(TemporalAnnotation.ANNOTATION_NAME));
- assertNull(attributeResource.getSupportingAnnotation(TableGeneratorAnnotation.ANNOTATION_NAME));
- assertNull(attributeResource.getSupportingAnnotation(SequenceGeneratorAnnotation.ANNOTATION_NAME));
- assertNull(attributeResource.getSupportingAnnotation(GeneratedValueAnnotation.ANNOTATION_NAME));
- }
-
- public void testMorphToDefault() throws Exception {
- createTestEntityWithIdMapping();
- addXmlClassRef(FULLY_QUALIFIED_TYPE_NAME);
-
- PersistentAttribute persistentAttribute = getJavaPersistentType().attributes().next();
- IdMapping idMapping = (IdMapping) persistentAttribute.getMapping();
- assertFalse(idMapping.isDefault());
- idMapping.getColumn().setSpecifiedName("FOO");
- idMapping.setSpecifiedConverter(Converter.TEMPORAL_CONVERTER);
- ((TemporalConverter) idMapping.getSpecifiedConverter()).setTemporalType(TemporalType.TIME);
- idMapping.addGeneratedValue();
- idMapping.getGeneratorContainer().addTableGenerator();
- idMapping.getGeneratorContainer().addSequenceGenerator();
- assertFalse(idMapping.isDefault());
-
- persistentAttribute.setSpecifiedMappingKey(MappingKeys.NULL_ATTRIBUTE_MAPPING_KEY);
- 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.getMappingAnnotation(IdAnnotation.ANNOTATION_NAME));
- assertNotNull(attributeResource.getSupportingAnnotation(ColumnAnnotation.ANNOTATION_NAME));
- assertNotNull(attributeResource.getSupportingAnnotation(TemporalAnnotation.ANNOTATION_NAME));
- assertNull(attributeResource.getSupportingAnnotation(TableGeneratorAnnotation.ANNOTATION_NAME));
- assertNull(attributeResource.getSupportingAnnotation(SequenceGeneratorAnnotation.ANNOTATION_NAME));
- assertNull(attributeResource.getSupportingAnnotation(GeneratedValueAnnotation.ANNOTATION_NAME));
- }
-
- public void testMorphToVersionMapping() throws Exception {
- createTestEntityWithIdMapping();
- addXmlClassRef(FULLY_QUALIFIED_TYPE_NAME);
-
- PersistentAttribute persistentAttribute = getJavaPersistentType().attributes().next();
- IdMapping idMapping = (IdMapping) persistentAttribute.getMapping();
- assertFalse(idMapping.isDefault());
- idMapping.getColumn().setSpecifiedName("FOO");
- idMapping.setSpecifiedConverter(Converter.TEMPORAL_CONVERTER);
- ((TemporalConverter) idMapping.getSpecifiedConverter()).setTemporalType(TemporalType.TIME);
- idMapping.addGeneratedValue();
- idMapping.getGeneratorContainer().addTableGenerator();
- idMapping.getGeneratorContainer().addSequenceGenerator();
- assertFalse(idMapping.isDefault());
-
- persistentAttribute.setSpecifiedMappingKey(MappingKeys.VERSION_ATTRIBUTE_MAPPING_KEY);
- 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.getMappingAnnotation(IdAnnotation.ANNOTATION_NAME));
- assertNotNull(attributeResource.getMappingAnnotation(VersionAnnotation.ANNOTATION_NAME));
- assertNotNull(attributeResource.getSupportingAnnotation(ColumnAnnotation.ANNOTATION_NAME));
- assertNotNull(attributeResource.getSupportingAnnotation(TemporalAnnotation.ANNOTATION_NAME));
- assertNull(attributeResource.getSupportingAnnotation(TableGeneratorAnnotation.ANNOTATION_NAME));
- assertNull(attributeResource.getSupportingAnnotation(SequenceGeneratorAnnotation.ANNOTATION_NAME));
- assertNull(attributeResource.getSupportingAnnotation(GeneratedValueAnnotation.ANNOTATION_NAME));
- }
-
- public void testMorphToEmbeddedMapping() throws Exception {
- createTestEntityWithIdMapping();
- addXmlClassRef(FULLY_QUALIFIED_TYPE_NAME);
-
- PersistentAttribute persistentAttribute = getJavaPersistentType().attributes().next();
- IdMapping idMapping = (IdMapping) persistentAttribute.getMapping();
- assertFalse(idMapping.isDefault());
- idMapping.getColumn().setSpecifiedName("FOO");
- idMapping.setSpecifiedConverter(Converter.TEMPORAL_CONVERTER);
- ((TemporalConverter) idMapping.getSpecifiedConverter()).setTemporalType(TemporalType.TIME);
- idMapping.addGeneratedValue();
- idMapping.getGeneratorContainer().addTableGenerator();
- idMapping.getGeneratorContainer().addSequenceGenerator();
- assertFalse(idMapping.isDefault());
-
- persistentAttribute.setSpecifiedMappingKey(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.getMappingAnnotation(IdAnnotation.ANNOTATION_NAME));
- assertNotNull(attributeResource.getMappingAnnotation(EmbeddedAnnotation.ANNOTATION_NAME));
- assertNull(attributeResource.getSupportingAnnotation(ColumnAnnotation.ANNOTATION_NAME));
- assertNull(attributeResource.getSupportingAnnotation(TemporalAnnotation.ANNOTATION_NAME));
- assertNull(attributeResource.getSupportingAnnotation(TableGeneratorAnnotation.ANNOTATION_NAME));
- assertNull(attributeResource.getSupportingAnnotation(SequenceGeneratorAnnotation.ANNOTATION_NAME));
- assertNull(attributeResource.getSupportingAnnotation(GeneratedValueAnnotation.ANNOTATION_NAME));
- }
-
- public void testMorphToTransientMapping() throws Exception {
- createTestEntityWithIdMapping();
- addXmlClassRef(FULLY_QUALIFIED_TYPE_NAME);
-
- PersistentAttribute persistentAttribute = getJavaPersistentType().attributes().next();
- IdMapping idMapping = (IdMapping) persistentAttribute.getMapping();
- assertFalse(idMapping.isDefault());
- idMapping.getColumn().setSpecifiedName("FOO");
- idMapping.setSpecifiedConverter(Converter.TEMPORAL_CONVERTER);
- ((TemporalConverter) idMapping.getSpecifiedConverter()).setTemporalType(TemporalType.TIME);
- idMapping.addGeneratedValue();
- idMapping.getGeneratorContainer().addTableGenerator();
- idMapping.getGeneratorContainer().addSequenceGenerator();
- assertFalse(idMapping.isDefault());
-
- persistentAttribute.setSpecifiedMappingKey(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.getMappingAnnotation(IdAnnotation.ANNOTATION_NAME));
- assertNotNull(attributeResource.getMappingAnnotation(TransientAnnotation.ANNOTATION_NAME));
- assertNull(attributeResource.getSupportingAnnotation(ColumnAnnotation.ANNOTATION_NAME));
- assertNull(attributeResource.getSupportingAnnotation(TemporalAnnotation.ANNOTATION_NAME));
- assertNull(attributeResource.getSupportingAnnotation(TableGeneratorAnnotation.ANNOTATION_NAME));
- assertNull(attributeResource.getSupportingAnnotation(SequenceGeneratorAnnotation.ANNOTATION_NAME));
- assertNull(attributeResource.getSupportingAnnotation(GeneratedValueAnnotation.ANNOTATION_NAME));
- }
-
- public void testMorphToEmbeddedIdMapping() throws Exception {
- createTestEntityWithIdMapping();
- addXmlClassRef(FULLY_QUALIFIED_TYPE_NAME);
-
- PersistentAttribute persistentAttribute = getJavaPersistentType().attributes().next();
- IdMapping idMapping = (IdMapping) persistentAttribute.getMapping();
- assertFalse(idMapping.isDefault());
- idMapping.getColumn().setSpecifiedName("FOO");
- idMapping.setSpecifiedConverter(Converter.TEMPORAL_CONVERTER);
- ((TemporalConverter) idMapping.getSpecifiedConverter()).setTemporalType(TemporalType.TIME);
- idMapping.addGeneratedValue();
- idMapping.getGeneratorContainer().addTableGenerator();
- idMapping.getGeneratorContainer().addSequenceGenerator();
- assertFalse(idMapping.isDefault());
-
- persistentAttribute.setSpecifiedMappingKey(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.getMappingAnnotation(IdAnnotation.ANNOTATION_NAME));
- assertNotNull(attributeResource.getMappingAnnotation(EmbeddedIdAnnotation.ANNOTATION_NAME));
- assertNull(attributeResource.getSupportingAnnotation(ColumnAnnotation.ANNOTATION_NAME));
- assertNull(attributeResource.getSupportingAnnotation(TemporalAnnotation.ANNOTATION_NAME));
- assertNull(attributeResource.getSupportingAnnotation(TableGeneratorAnnotation.ANNOTATION_NAME));
- assertNull(attributeResource.getSupportingAnnotation(SequenceGeneratorAnnotation.ANNOTATION_NAME));
- assertNull(attributeResource.getSupportingAnnotation(GeneratedValueAnnotation.ANNOTATION_NAME));
- }
-
- public void testMorphToOneToOneMapping() throws Exception {
- createTestEntityWithIdMapping();
- addXmlClassRef(FULLY_QUALIFIED_TYPE_NAME);
-
- PersistentAttribute persistentAttribute = getJavaPersistentType().attributes().next();
- IdMapping idMapping = (IdMapping) persistentAttribute.getMapping();
- assertFalse(idMapping.isDefault());
- idMapping.getColumn().setSpecifiedName("FOO");
- idMapping.setSpecifiedConverter(Converter.TEMPORAL_CONVERTER);
- ((TemporalConverter) idMapping.getSpecifiedConverter()).setTemporalType(TemporalType.TIME);
- idMapping.addGeneratedValue();
- idMapping.getGeneratorContainer().addTableGenerator();
- idMapping.getGeneratorContainer().addSequenceGenerator();
- assertFalse(idMapping.isDefault());
-
- persistentAttribute.setSpecifiedMappingKey(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.getMappingAnnotation(IdAnnotation.ANNOTATION_NAME));
- assertNotNull(attributeResource.getMappingAnnotation(OneToOneAnnotation.ANNOTATION_NAME));
- assertNull(attributeResource.getSupportingAnnotation(ColumnAnnotation.ANNOTATION_NAME));
- assertNull(attributeResource.getSupportingAnnotation(TemporalAnnotation.ANNOTATION_NAME));
- assertNull(attributeResource.getSupportingAnnotation(TableGeneratorAnnotation.ANNOTATION_NAME));
- assertNull(attributeResource.getSupportingAnnotation(SequenceGeneratorAnnotation.ANNOTATION_NAME));
- assertNull(attributeResource.getSupportingAnnotation(GeneratedValueAnnotation.ANNOTATION_NAME));
- }
-
- public void testMorphToOneToManyMapping() throws Exception {
- createTestEntityWithIdMapping();
- addXmlClassRef(FULLY_QUALIFIED_TYPE_NAME);
-
- PersistentAttribute persistentAttribute = getJavaPersistentType().attributes().next();
- IdMapping idMapping = (IdMapping) persistentAttribute.getMapping();
- assertFalse(idMapping.isDefault());
- idMapping.getColumn().setSpecifiedName("FOO");
- idMapping.setSpecifiedConverter(Converter.TEMPORAL_CONVERTER);
- ((TemporalConverter) idMapping.getSpecifiedConverter()).setTemporalType(TemporalType.TIME);
- idMapping.addGeneratedValue();
- idMapping.getGeneratorContainer().addTableGenerator();
- idMapping.getGeneratorContainer().addSequenceGenerator();
- assertFalse(idMapping.isDefault());
-
- persistentAttribute.setSpecifiedMappingKey(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.getMappingAnnotation(IdAnnotation.ANNOTATION_NAME));
- assertNotNull(attributeResource.getMappingAnnotation(OneToManyAnnotation.ANNOTATION_NAME));
- assertNull(attributeResource.getSupportingAnnotation(ColumnAnnotation.ANNOTATION_NAME));
- assertNull(attributeResource.getSupportingAnnotation(TemporalAnnotation.ANNOTATION_NAME));
- assertNull(attributeResource.getSupportingAnnotation(TableGeneratorAnnotation.ANNOTATION_NAME));
- assertNull(attributeResource.getSupportingAnnotation(SequenceGeneratorAnnotation.ANNOTATION_NAME));
- assertNull(attributeResource.getSupportingAnnotation(GeneratedValueAnnotation.ANNOTATION_NAME));
- }
-
- public void testMorphToManyToOneMapping() throws Exception {
- createTestEntityWithIdMapping();
- addXmlClassRef(FULLY_QUALIFIED_TYPE_NAME);
-
- PersistentAttribute persistentAttribute = getJavaPersistentType().attributes().next();
- IdMapping idMapping = (IdMapping) persistentAttribute.getMapping();
- assertFalse(idMapping.isDefault());
- idMapping.getColumn().setSpecifiedName("FOO");
- idMapping.setSpecifiedConverter(Converter.TEMPORAL_CONVERTER);
- ((TemporalConverter) idMapping.getSpecifiedConverter()).setTemporalType(TemporalType.TIME);
- idMapping.addGeneratedValue();
- idMapping.getGeneratorContainer().addTableGenerator();
- idMapping.getGeneratorContainer().addSequenceGenerator();
- assertFalse(idMapping.isDefault());
-
- persistentAttribute.setSpecifiedMappingKey(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.getMappingAnnotation(IdAnnotation.ANNOTATION_NAME));
- assertNotNull(attributeResource.getMappingAnnotation(ManyToOneAnnotation.ANNOTATION_NAME));
- assertNull(attributeResource.getSupportingAnnotation(ColumnAnnotation.ANNOTATION_NAME));
- assertNull(attributeResource.getSupportingAnnotation(TemporalAnnotation.ANNOTATION_NAME));
- assertNull(attributeResource.getSupportingAnnotation(TableGeneratorAnnotation.ANNOTATION_NAME));
- assertNull(attributeResource.getSupportingAnnotation(SequenceGeneratorAnnotation.ANNOTATION_NAME));
- assertNull(attributeResource.getSupportingAnnotation(GeneratedValueAnnotation.ANNOTATION_NAME));
- }
-
- public void testMorphToManyToManyMapping() throws Exception {
- createTestEntityWithIdMapping();
- addXmlClassRef(FULLY_QUALIFIED_TYPE_NAME);
-
- PersistentAttribute persistentAttribute = getJavaPersistentType().attributes().next();
- IdMapping idMapping = (IdMapping) persistentAttribute.getMapping();
- assertFalse(idMapping.isDefault());
- idMapping.getColumn().setSpecifiedName("FOO");
- idMapping.setSpecifiedConverter(Converter.TEMPORAL_CONVERTER);
- ((TemporalConverter) idMapping.getSpecifiedConverter()).setTemporalType(TemporalType.TIME);
- idMapping.addGeneratedValue();
- idMapping.getGeneratorContainer().addTableGenerator();
- idMapping.getGeneratorContainer().addSequenceGenerator();
- assertFalse(idMapping.isDefault());
-
- persistentAttribute.setSpecifiedMappingKey(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.getMappingAnnotation(IdAnnotation.ANNOTATION_NAME));
- assertNotNull(attributeResource.getMappingAnnotation(ManyToManyAnnotation.ANNOTATION_NAME));
- assertNull(attributeResource.getSupportingAnnotation(ColumnAnnotation.ANNOTATION_NAME));
- assertNull(attributeResource.getSupportingAnnotation(TemporalAnnotation.ANNOTATION_NAME));
- assertNull(attributeResource.getSupportingAnnotation(TableGeneratorAnnotation.ANNOTATION_NAME));
- assertNull(attributeResource.getSupportingAnnotation(SequenceGeneratorAnnotation.ANNOTATION_NAME));
- assertNull(attributeResource.getSupportingAnnotation(GeneratedValueAnnotation.ANNOTATION_NAME));
- }
-
- public void testGetTemporal() throws Exception {
- createTestEntityWithTemporal();
- addXmlClassRef(FULLY_QUALIFIED_TYPE_NAME);
-
- PersistentAttribute persistentAttribute = getJavaPersistentType().attributes().next();
- IdMapping idMapping = (IdMapping) persistentAttribute.getSpecifiedMapping();
-
- assertEquals(TemporalType.TIMESTAMP, ((TemporalConverter) idMapping.getConverter()).getTemporalType());
- }
-
- public void testSetTemporal() throws Exception {
- createTestEntityWithIdMapping();
- addXmlClassRef(FULLY_QUALIFIED_TYPE_NAME);
-
- PersistentAttribute persistentAttribute = getJavaPersistentType().attributes().next();
- IdMapping idMapping = (IdMapping) persistentAttribute.getSpecifiedMapping();
- assertEquals(Converter.NO_CONVERTER, idMapping.getConverter().getType());
-
- idMapping.setSpecifiedConverter(Converter.TEMPORAL_CONVERTER);
- ((TemporalConverter) idMapping.getConverter()).setTemporalType(TemporalType.TIME);
-
- JavaResourcePersistentType typeResource = getJpaProject().getJavaResourcePersistentType(FULLY_QUALIFIED_TYPE_NAME);
- JavaResourcePersistentAttribute attributeResource = typeResource.persistableAttributes().next();
- TemporalAnnotation temporal = (TemporalAnnotation) attributeResource.getSupportingAnnotation(TemporalAnnotation.ANNOTATION_NAME);
-
- assertEquals(org.eclipse.jpt.core.resource.java.TemporalType.TIME, temporal.getValue());
-
- idMapping.setSpecifiedConverter(null);
- assertNull(attributeResource.getSupportingAnnotation(TemporalAnnotation.ANNOTATION_NAME));
- }
-
- public void testGetTemporalUpdatesFromResourceModelChange() throws Exception {
- createTestEntityWithIdMapping();
- addXmlClassRef(FULLY_QUALIFIED_TYPE_NAME);
-
- PersistentAttribute persistentAttribute = getJavaPersistentType().attributes().next();
- IdMapping idMapping = (IdMapping) persistentAttribute.getSpecifiedMapping();
-
- assertEquals(Converter.NO_CONVERTER, idMapping.getConverter().getType());
-
-
- JavaResourcePersistentType typeResource = getJpaProject().getJavaResourcePersistentType(FULLY_QUALIFIED_TYPE_NAME);
- JavaResourcePersistentAttribute attributeResource = typeResource.persistableAttributes().next();
- TemporalAnnotation temporal = (TemporalAnnotation) attributeResource.addSupportingAnnotation(TemporalAnnotation.ANNOTATION_NAME);
- temporal.setValue(org.eclipse.jpt.core.resource.java.TemporalType.DATE);
-
- assertEquals(TemporalType.DATE, ((TemporalConverter) idMapping.getConverter()).getTemporalType());
-
- attributeResource.removeSupportingAnnotation(TemporalAnnotation.ANNOTATION_NAME);
-
- assertEquals(Converter.NO_CONVERTER, idMapping.getConverter().getType());
- assertFalse(idMapping.isDefault());
- assertSame(idMapping, persistentAttribute.getSpecifiedMapping());
- }
-
- public void testGetColumn() throws Exception {
- createTestEntityWithIdMapping();
- addXmlClassRef(FULLY_QUALIFIED_TYPE_NAME);
-
- PersistentAttribute persistentAttribute = getJavaPersistentType().attributes().next();
- IdMapping idMapping = (IdMapping) persistentAttribute.getSpecifiedMapping();
-
- 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.addSupportingAnnotation(JPA.COLUMN);
- column.setName("foo");
-
- assertEquals("foo", idMapping.getColumn().getSpecifiedName());
- assertEquals("foo", idMapping.getColumn().getName());
- assertEquals("id", idMapping.getColumn().getDefaultName());
- }
-
- public void testGetSequenceGenerator() throws Exception {
- createTestEntityWithIdMapping();
- addXmlClassRef(FULLY_QUALIFIED_TYPE_NAME);
-
- PersistentAttribute persistentAttribute = getJavaPersistentType().attributes().next();
- IdMapping idMapping = (IdMapping) persistentAttribute.getSpecifiedMapping();
- assertNull(idMapping.getGeneratorContainer().getSequenceGenerator());
- assertEquals(0, idMapping.getPersistenceUnit().generatorsSize());
-
- JavaResourcePersistentType typeResource = getJpaProject().getJavaResourcePersistentType(FULLY_QUALIFIED_TYPE_NAME);
- JavaResourcePersistentAttribute attributeResource = typeResource.persistableAttributes().next();
- attributeResource.addSupportingAnnotation(JPA.SEQUENCE_GENERATOR);
- assertNotNull(idMapping.getGeneratorContainer().getSequenceGenerator());
- assertEquals(1, attributeResource.supportingAnnotationsSize());
- assertEquals(1, idMapping.getPersistenceUnit().generatorsSize());
-
- idMapping.getGeneratorContainer().getSequenceGenerator().setName("foo");
- assertEquals(1, idMapping.getPersistenceUnit().generatorsSize());
- }
-
- public void testAddSequenceGenerator() throws Exception {
- createTestEntityWithIdMapping();
- addXmlClassRef(FULLY_QUALIFIED_TYPE_NAME);
-
- PersistentAttribute persistentAttribute = getJavaPersistentType().attributes().next();
- IdMapping idMapping = (IdMapping) persistentAttribute.getSpecifiedMapping();
-
- assertNull(idMapping.getGeneratorContainer().getSequenceGenerator());
-
- idMapping.getGeneratorContainer().addSequenceGenerator();
-
- JavaResourcePersistentType typeResource = getJpaProject().getJavaResourcePersistentType(FULLY_QUALIFIED_TYPE_NAME);
- JavaResourcePersistentAttribute attributeResource = typeResource.persistableAttributes().next();
-
- assertNotNull(attributeResource.getSupportingAnnotation(JPA.SEQUENCE_GENERATOR));
- assertNotNull(idMapping.getGeneratorContainer().getSequenceGenerator());
-
- //try adding another sequence generator, should get an IllegalStateException
- try {
- idMapping.getGeneratorContainer().addSequenceGenerator();
- } catch (IllegalStateException e) {
- return;
- }
- fail("IllegalStateException not thrown");
- }
-
- public void testRemoveSequenceGenerator() throws Exception {
- createTestEntityWithIdMapping();
- addXmlClassRef(FULLY_QUALIFIED_TYPE_NAME);
-
- PersistentAttribute persistentAttribute = getJavaPersistentType().attributes().next();
- IdMapping idMapping = (IdMapping) persistentAttribute.getSpecifiedMapping();
-
- JavaResourcePersistentType typeResource = getJpaProject().getJavaResourcePersistentType(FULLY_QUALIFIED_TYPE_NAME);
- JavaResourcePersistentAttribute attributeResource = typeResource.persistableAttributes().next();
- attributeResource.addSupportingAnnotation(JPA.SEQUENCE_GENERATOR);
-
-
- idMapping.getGeneratorContainer().removeSequenceGenerator();
-
- assertNull(idMapping.getGeneratorContainer().getSequenceGenerator());
- assertNull(attributeResource.getSupportingAnnotation(JPA.SEQUENCE_GENERATOR));
-
- //try removing the sequence generator again, should get an IllegalStateException
- try {
- idMapping.getGeneratorContainer().removeSequenceGenerator();
- } catch (IllegalStateException e) {
- return;
- }
- fail("IllegalStateException not thrown");
- }
-
- public void testGetTableGenerator() throws Exception {
- createTestEntityWithIdMapping();
- addXmlClassRef(FULLY_QUALIFIED_TYPE_NAME);
-
- PersistentAttribute persistentAttribute = getJavaPersistentType().attributes().next();
- IdMapping idMapping = (IdMapping) persistentAttribute.getSpecifiedMapping();
- assertNull(idMapping.getGeneratorContainer().getTableGenerator());
- assertEquals(0, idMapping.getPersistenceUnit().generatorsSize());
-
- JavaResourcePersistentType typeResource = getJpaProject().getJavaResourcePersistentType(FULLY_QUALIFIED_TYPE_NAME);
- JavaResourcePersistentAttribute attributeResource = typeResource.persistableAttributes().next();
- attributeResource.addSupportingAnnotation(JPA.TABLE_GENERATOR);
- assertNotNull(idMapping.getGeneratorContainer().getTableGenerator());
- assertEquals(1, attributeResource.supportingAnnotationsSize());
- assertEquals(1, idMapping.getPersistenceUnit().generatorsSize());
-
- idMapping.getGeneratorContainer().getTableGenerator().setName("foo");
- assertEquals(1, idMapping.getPersistenceUnit().generatorsSize());
- }
-
- public void testAddTableGenerator() throws Exception {
- createTestEntityWithIdMapping();
- addXmlClassRef(FULLY_QUALIFIED_TYPE_NAME);
-
- PersistentAttribute persistentAttribute = getJavaPersistentType().attributes().next();
- IdMapping idMapping = (IdMapping) persistentAttribute.getSpecifiedMapping();
-
- assertNull(idMapping.getGeneratorContainer().getTableGenerator());
-
- idMapping.getGeneratorContainer().addTableGenerator();
-
- JavaResourcePersistentType typeResource = getJpaProject().getJavaResourcePersistentType(FULLY_QUALIFIED_TYPE_NAME);
- JavaResourcePersistentAttribute attributeResource = typeResource.persistableAttributes().next();
-
- assertNotNull(attributeResource.getSupportingAnnotation(JPA.TABLE_GENERATOR));
- assertNotNull(idMapping.getGeneratorContainer().getTableGenerator());
-
- //try adding another table generator, should get an IllegalStateException
- try {
- idMapping.getGeneratorContainer().addTableGenerator();
- } catch (IllegalStateException e) {
- return;
- }
- fail("IllegalStateException not thrown");
- }
-
- public void testRemoveTableGenerator() throws Exception {
- createTestEntityWithIdMapping();
- addXmlClassRef(FULLY_QUALIFIED_TYPE_NAME);
-
- PersistentAttribute persistentAttribute = getJavaPersistentType().attributes().next();
- IdMapping idMapping = (IdMapping) persistentAttribute.getSpecifiedMapping();
-
- JavaResourcePersistentType typeResource = getJpaProject().getJavaResourcePersistentType(FULLY_QUALIFIED_TYPE_NAME);
- JavaResourcePersistentAttribute attributeResource = typeResource.persistableAttributes().next();
- attributeResource.addSupportingAnnotation(JPA.TABLE_GENERATOR);
-
-
- idMapping.getGeneratorContainer().removeTableGenerator();
-
- assertNull(idMapping.getGeneratorContainer().getTableGenerator());
- assertNull(attributeResource.getSupportingAnnotation(JPA.TABLE_GENERATOR));
-
- //try removing the table generator again, should get an IllegalStateException
- try {
- idMapping.getGeneratorContainer().removeTableGenerator();
- } catch (IllegalStateException e) {
- return;
- }
- fail("IllegalStateException not thrown");
- }
-
- public void testGetGeneratedValue() throws Exception {
- createTestEntityWithIdMapping();
- addXmlClassRef(FULLY_QUALIFIED_TYPE_NAME);
-
- PersistentAttribute persistentAttribute = getJavaPersistentType().attributes().next();
- IdMapping idMapping = (IdMapping) persistentAttribute.getSpecifiedMapping();
-
- assertNull(idMapping.getGeneratedValue());
-
- JavaResourcePersistentType typeResource = getJpaProject().getJavaResourcePersistentType(FULLY_QUALIFIED_TYPE_NAME);
- JavaResourcePersistentAttribute attributeResource = typeResource.persistableAttributes().next();
- attributeResource.addSupportingAnnotation(JPA.GENERATED_VALUE);
-
- assertNotNull(idMapping.getGeneratedValue());
- assertEquals(1, attributeResource.supportingAnnotationsSize());
- }
-
- public void testGetGeneratedValue2() throws Exception {
- addXmlClassRef(FULLY_QUALIFIED_TYPE_NAME);
- createTestEntityWithIdMappingGeneratedValue();
-
- PersistentAttribute persistentAttribute = getJavaPersistentType().attributes().next();
- IdMapping idMapping = (IdMapping) persistentAttribute.getSpecifiedMapping();
-
- JavaResourcePersistentType typeResource = getJpaProject().getJavaResourcePersistentType(FULLY_QUALIFIED_TYPE_NAME);
- JavaResourcePersistentAttribute attributeResource = typeResource.persistableAttributes().next();
-
- assertNotNull(idMapping.getGeneratedValue());
- assertEquals(1, attributeResource.supportingAnnotationsSize());
- }
-
- public void testAddGeneratedValue() throws Exception {
- createTestEntityWithIdMapping();
- addXmlClassRef(FULLY_QUALIFIED_TYPE_NAME);
-
- PersistentAttribute persistentAttribute = getJavaPersistentType().attributes().next();
- IdMapping idMapping = (IdMapping) persistentAttribute.getSpecifiedMapping();
-
- assertNull(idMapping.getGeneratedValue());
-
- idMapping.addGeneratedValue();
-
- JavaResourcePersistentType typeResource = getJpaProject().getJavaResourcePersistentType(FULLY_QUALIFIED_TYPE_NAME);
- JavaResourcePersistentAttribute attributeResource = typeResource.persistableAttributes().next();
-
- assertNotNull(attributeResource.getSupportingAnnotation(JPA.GENERATED_VALUE));
- assertNotNull(idMapping.getGeneratedValue());
-
- //try adding another generated value, should get an IllegalStateException
- try {
- idMapping.addGeneratedValue();
- } catch (IllegalStateException e) {
- return;
- }
- fail("IllegalStateException not thrown");
- }
-
- public void testRemoveGeneratedValue() throws Exception {
- createTestEntityWithIdMapping();
- addXmlClassRef(FULLY_QUALIFIED_TYPE_NAME);
-
- PersistentAttribute persistentAttribute = getJavaPersistentType().attributes().next();
- IdMapping idMapping = (IdMapping) persistentAttribute.getSpecifiedMapping();
-
- JavaResourcePersistentType typeResource = getJpaProject().getJavaResourcePersistentType(FULLY_QUALIFIED_TYPE_NAME);
- JavaResourcePersistentAttribute attributeResource = typeResource.persistableAttributes().next();
- attributeResource.addSupportingAnnotation(JPA.GENERATED_VALUE);
-
-
- idMapping.removeGeneratedValue();
-
- assertNull(idMapping.getGeneratedValue());
- assertNull(attributeResource.getSupportingAnnotation(JPA.GENERATED_VALUE));
-
- //try removing the generatedValue again, should get an IllegalStateException
- try {
- idMapping.removeGeneratedValue();
- } catch (IllegalStateException e) {
- return;
- }
- fail("IllegalStateException not thrown");
- }
-}
diff --git a/jpa/tests/org.eclipse.jpt.core.tests/src/org/eclipse/jpt/core/tests/internal/context/java/JavaJoinColumnTests.java b/jpa/tests/org.eclipse.jpt.core.tests/src/org/eclipse/jpt/core/tests/internal/context/java/JavaJoinColumnTests.java
deleted file mode 100644
index 9e74ee7051..0000000000
--- a/jpa/tests/org.eclipse.jpt.core.tests/src/org/eclipse/jpt/core/tests/internal/context/java/JavaJoinColumnTests.java
+++ /dev/null
@@ -1,533 +0,0 @@
-/*******************************************************************************
- * Copyright (c) 2008 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.
- *
- * Contributors:
- * Oracle - initial API and implementation
- ******************************************************************************/
-package org.eclipse.jpt.core.tests.internal.context.java;
-
-import java.util.Iterator;
-import org.eclipse.jdt.core.ICompilationUnit;
-import org.eclipse.jpt.core.context.java.JavaJoinColumn;
-import org.eclipse.jpt.core.context.java.JavaJoinColumnJoiningStrategy;
-import org.eclipse.jpt.core.context.java.JavaOneToOneMapping;
-import org.eclipse.jpt.core.resource.java.JPA;
-import org.eclipse.jpt.core.resource.java.JavaResourcePersistentAttribute;
-import org.eclipse.jpt.core.resource.java.JavaResourcePersistentType;
-import org.eclipse.jpt.core.resource.java.JoinColumnAnnotation;
-import org.eclipse.jpt.core.tests.internal.context.ContextModelTestCase;
-import org.eclipse.jpt.core.tests.internal.projects.TestJavaProject.SourceWriter;
-import org.eclipse.jpt.utility.internal.iterators.ArrayIterator;
-
-public class JavaJoinColumnTests extends ContextModelTestCase
-{
- public JavaJoinColumnTests(String name) {
- super(name);
- }
-
- private ICompilationUnit createTestEntityWithOneToOne() throws Exception {
- return this.createTestType(new DefaultAnnotationWriter() {
- @Override
- public Iterator<String> imports() {
- return new ArrayIterator<String>(JPA.ENTITY, JPA.ONE_TO_ONE);
- }
- @Override
- public void appendTypeAnnotationTo(StringBuilder sb) {
- sb.append("@Entity");
- }
- @Override
- public void appendIdFieldAnnotationTo(StringBuilder sb) {
- sb.append("@OneToOne").append(CR);
- }
- });
- }
-
- private ICompilationUnit createTestEntityWithValidOneToOne() throws Exception {
- return this.createTestType(new DefaultAnnotationWriter() {
- @Override
- public Iterator<String> imports() {
- return new ArrayIterator<String>(JPA.ENTITY, JPA.ONE_TO_ONE);
- }
- @Override
- public void appendTypeAnnotationTo(StringBuilder sb) {
- sb.append("@Entity");
- }
- @Override
- public void appendIdFieldAnnotationTo(StringBuilder sb) {
- sb.append("@OneToOne").append(CR);
- sb.append(" private Project project;").append(CR);
- }
- });
- }
-
- private void createTargetEntity() throws Exception {
- SourceWriter sourceWriter = new SourceWriter() {
- public void appendSourceTo(StringBuilder sb) {
- sb.append(CR);
- sb.append("import ");
- sb.append(JPA.ENTITY);
- sb.append(";");
- sb.append(CR);
- sb.append("import ");
- sb.append(JPA.ID);
- sb.append(";");
- sb.append(CR);
- sb.append(CR);
- sb.append("@Entity");
- sb.append(CR);
- sb.append("public class Project {").append(CR);
- sb.append(CR);
- sb.append(" @Id").append(CR);
- sb.append(" private int proj_id;").append(CR);
- sb.append(CR);
- }
- };
- this.javaProject.createCompilationUnit(PACKAGE_NAME, "Project.java", sourceWriter);
- }
-
- public void testUpdateSpecifiedName() throws Exception {
- createTestEntityWithOneToOne();
- addXmlClassRef(FULLY_QUALIFIED_TYPE_NAME);
-
- JavaOneToOneMapping oneToOneMapping = (JavaOneToOneMapping) getJavaPersistentType().attributes().next().getMapping();
- JavaJoinColumnJoiningStrategy joinColumns = oneToOneMapping.getRelationshipReference().getJoinColumnJoiningStrategy();
-
- JavaResourcePersistentType typeResource = getJpaProject().getJavaResourcePersistentType(FULLY_QUALIFIED_TYPE_NAME);
- JavaResourcePersistentAttribute attributeResource = typeResource.persistableAttributes().next();
-
- JoinColumnAnnotation javaJoinColumn = (JoinColumnAnnotation) attributeResource.getSupportingAnnotation(JoinColumnAnnotation.ANNOTATION_NAME);
-
- assertEquals(0, joinColumns.specifiedJoinColumnsSize());
- assertNull(javaJoinColumn);
-
-
- //set name in the resource model, verify context model updated
- javaJoinColumn = (JoinColumnAnnotation) attributeResource.addSupportingAnnotation(JoinColumnAnnotation.ANNOTATION_NAME);
- javaJoinColumn.setName("FOO");
- JavaJoinColumn joinColumn = joinColumns.specifiedJoinColumns().next();
- assertEquals("FOO", joinColumn.getSpecifiedName());
- assertEquals("FOO", javaJoinColumn.getName());
-
- //set name to null in the resource model, annotation removed, specified join column removed
- javaJoinColumn.setName(null);
- assertEquals(0, joinColumns.specifiedJoinColumnsSize());
- assertNull(attributeResource.getSupportingAnnotation(JoinColumnAnnotation.ANNOTATION_NAME));
- }
-
- public void testModifySpecifiedName() throws Exception {
- createTestEntityWithOneToOne();
- addXmlClassRef(FULLY_QUALIFIED_TYPE_NAME);
-
- JavaOneToOneMapping oneToOneMapping = (JavaOneToOneMapping) getJavaPersistentType().attributes().next().getMapping();
- JavaJoinColumnJoiningStrategy joinColumns = oneToOneMapping.getRelationshipReference().getJoinColumnJoiningStrategy();
-
- JavaResourcePersistentType typeResource = getJpaProject().getJavaResourcePersistentType(FULLY_QUALIFIED_TYPE_NAME);
- JavaResourcePersistentAttribute attributeResource = typeResource.persistableAttributes().next();
-
-
- JavaJoinColumn joinColumn = joinColumns.addSpecifiedJoinColumn(0);
- //set name in the context model, verify resource model modified
- joinColumn.setSpecifiedName("foo");
- JoinColumnAnnotation javaJoinColumn = (JoinColumnAnnotation) attributeResource.getSupportingAnnotation(JoinColumnAnnotation.ANNOTATION_NAME);
- assertEquals("foo", joinColumn.getSpecifiedName());
- assertEquals("foo", javaJoinColumn.getName());
-
- //set name to null in the context model
- joinColumn.setSpecifiedName(null);
- assertNull(joinColumn.getSpecifiedName());
- assertNull(attributeResource.getSupportingAnnotation(JoinColumnAnnotation.ANNOTATION_NAME));
- }
-
- // <attribute name>_<referenced column name>
- // or
- // <target entity name>_<referenced column name>
- public void testDefaultName() throws Exception {
- createTestEntityWithValidOneToOne();
- createTargetEntity();
- addXmlClassRef(FULLY_QUALIFIED_TYPE_NAME);
-
-
- JavaOneToOneMapping oneToOneMapping = (JavaOneToOneMapping) getJavaPersistentType().attributes().next().getMapping();
- JavaJoinColumnJoiningStrategy joinColumns = oneToOneMapping.getRelationshipReference().getJoinColumnJoiningStrategy();
- JavaJoinColumn defaultJavaJoinColumn = joinColumns.getDefaultJoinColumn();
-
-// assertNull(defaultJavaJoinColumn.getDefaultName());
-//TODO test default join column name
-// //add target entity to the persistence unit, now join table name is [table name]_[target table name]
-// addXmlClassRef(PACKAGE_NAME + ".Project");
-// assertEquals(TYPE_NAME + "_Project", joinTable.getDefaultName());
-//
-// JavaPersistentTypeResource typeResource = jpaProject().javaPersistentTypeResource(FULLY_QUALIFIED_TYPE_NAME);
-// JavaPersistentAttributeResource attributeResource = typeResource.attributes().next();
-// assertNull(attributeResource.annotation(JoinTable.ANNOTATION_NAME));
-//
-// //target entity does not resolve, default name is null
-// manyToManyMapping.setSpecifiedTargetEntity("Foo");
-// assertNull(joinTable.getDefaultName());
-//
-// //default target entity does resolve, so default name is again [table name]_[target table name]
-// manyToManyMapping.setSpecifiedTargetEntity(null);
-// assertEquals(TYPE_NAME + "_Project", joinTable.getDefaultName());
-//
-// //add the join table annotation, verify default join table name is the same
-// attributeResource.addAnnotation(JoinTable.ANNOTATION_NAME);
-// assertEquals(TYPE_NAME + "_Project", joinTable.getDefaultName());
-// assertNotNull(attributeResource.annotation(JoinTable.ANNOTATION_NAME));
-//
-// //set a table on the target entity, very default join table name updates
-// manyToManyMapping.getResolvedTargetEntity().getTable().setSpecifiedName("FOO");
-// assertEquals(TYPE_NAME + "_FOO", joinTable.getDefaultName());
-//
-// //set a table on the owning entity, very default join table name updates
-// javaEntity().getTable().setSpecifiedName("BAR");
-// assertEquals("BAR_FOO", joinTable.getDefaultName());
- }
-
- public void testUpdateSpecifiedReferencedColumnName() throws Exception {
- createTestEntityWithOneToOne();
- addXmlClassRef(FULLY_QUALIFIED_TYPE_NAME);
-
- JavaOneToOneMapping oneToOneMapping = (JavaOneToOneMapping) getJavaPersistentType().attributes().next().getMapping();
- JavaJoinColumnJoiningStrategy joinColumns = oneToOneMapping.getRelationshipReference().getJoinColumnJoiningStrategy();
-
- JavaResourcePersistentType typeResource = getJpaProject().getJavaResourcePersistentType(FULLY_QUALIFIED_TYPE_NAME);
- JavaResourcePersistentAttribute attributeResource = typeResource.persistableAttributes().next();
-
- JoinColumnAnnotation javaJoinColumn = (JoinColumnAnnotation) attributeResource.getSupportingAnnotation(JoinColumnAnnotation.ANNOTATION_NAME);
-
- assertEquals(0, joinColumns.specifiedJoinColumnsSize());
- assertNull(javaJoinColumn);
-
-
- //set referenced column name in the resource model, verify context model updated
- javaJoinColumn = (JoinColumnAnnotation) attributeResource.addSupportingAnnotation(JoinColumnAnnotation.ANNOTATION_NAME);
- javaJoinColumn.setName("FOO");
- javaJoinColumn.setReferencedColumnName("BAR");
- JavaJoinColumn joinColumn = joinColumns.specifiedJoinColumns().next();
- assertEquals("BAR", joinColumn.getSpecifiedReferencedColumnName());
- assertEquals("BAR", javaJoinColumn.getReferencedColumnName());
-
- //set referenced column name to null in the resource model,
- javaJoinColumn.setReferencedColumnName(null);
- assertNull(joinColumn.getSpecifiedReferencedColumnName());
- assertNull("BAR", javaJoinColumn.getReferencedColumnName());
- }
-
- public void testModifySpecifiedReferencedColumnName() throws Exception {
- createTestEntityWithOneToOne();
- addXmlClassRef(FULLY_QUALIFIED_TYPE_NAME);
-
- JavaOneToOneMapping oneToOneMapping = (JavaOneToOneMapping) getJavaPersistentType().attributes().next().getMapping();
- JavaJoinColumnJoiningStrategy joinColumns = oneToOneMapping.getRelationshipReference().getJoinColumnJoiningStrategy();
-
- JavaResourcePersistentType typeResource = getJpaProject().getJavaResourcePersistentType(FULLY_QUALIFIED_TYPE_NAME);
- JavaResourcePersistentAttribute attributeResource = typeResource.persistableAttributes().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.getSupportingAnnotation(JoinColumnAnnotation.ANNOTATION_NAME);
- assertEquals("BAR", joinColumn.getSpecifiedReferencedColumnName());
- assertEquals("BAR", javaJoinColumn.getReferencedColumnName());
-
- //set referenced column name to null in the context model
- joinColumn.setSpecifiedReferencedColumnName(null);
- assertNull(joinColumn.getSpecifiedReferencedColumnName());
- assertNull(javaJoinColumn.getReferencedColumnName());
- }
-
- public void testDefaultReferencedColumnName() throws Exception {
- //TODO test default join column referenced column name
-
- }
-
- public void testUpdateTable() throws Exception {
- createTestEntityWithOneToOne();
- addXmlClassRef(FULLY_QUALIFIED_TYPE_NAME);
-
- JavaOneToOneMapping oneToOneMapping = (JavaOneToOneMapping) getJavaPersistentType().attributes().next().getMapping();
- JavaJoinColumnJoiningStrategy joinColumns = oneToOneMapping.getRelationshipReference().getJoinColumnJoiningStrategy();
-
- JavaResourcePersistentType typeResource = getJpaProject().getJavaResourcePersistentType(FULLY_QUALIFIED_TYPE_NAME);
- JavaResourcePersistentAttribute attributeResource = typeResource.persistableAttributes().next();
-
- JoinColumnAnnotation javaJoinColumn = (JoinColumnAnnotation) attributeResource.getSupportingAnnotation(JoinColumnAnnotation.ANNOTATION_NAME);
-
- assertEquals(0, joinColumns.specifiedJoinColumnsSize());
- assertNull(javaJoinColumn);
-
-
- //set table in the resource model, verify context model updated
- javaJoinColumn = (JoinColumnAnnotation) attributeResource.addSupportingAnnotation(JoinColumnAnnotation.ANNOTATION_NAME);
- javaJoinColumn.setName("FOO");
- javaJoinColumn.setTable("BAR");
- JavaJoinColumn joinColumn = joinColumns.specifiedJoinColumns().next();
- assertEquals("BAR", joinColumn.getSpecifiedTable());
- assertEquals("BAR", javaJoinColumn.getTable());
-
- //set table to null in the resource model,
- javaJoinColumn.setTable(null);
- assertNull(joinColumn.getSpecifiedTable());
- assertNull("BAR", javaJoinColumn.getTable());
- }
-
- public void testModifyTable() throws Exception {
- createTestEntityWithOneToOne();
- addXmlClassRef(FULLY_QUALIFIED_TYPE_NAME);
-
- JavaOneToOneMapping oneToOneMapping = (JavaOneToOneMapping) getJavaPersistentType().attributes().next().getMapping();
- JavaJoinColumnJoiningStrategy joinColumns = oneToOneMapping.getRelationshipReference().getJoinColumnJoiningStrategy();
-
- JavaResourcePersistentType typeResource = getJpaProject().getJavaResourcePersistentType(FULLY_QUALIFIED_TYPE_NAME);
- JavaResourcePersistentAttribute attributeResource = typeResource.persistableAttributes().next();
-
-
- JavaJoinColumn joinColumn = joinColumns.addSpecifiedJoinColumn(0);
- //set table in the context model, verify resource model modified
- joinColumn.setSpecifiedName("foo");
- joinColumn.setSpecifiedTable("BAR");
-
- JoinColumnAnnotation javaJoinColumn = (JoinColumnAnnotation) attributeResource.getSupportingAnnotation(JoinColumnAnnotation.ANNOTATION_NAME);
- assertEquals("BAR", joinColumn.getSpecifiedTable());
- assertEquals("BAR", javaJoinColumn.getTable());
-
- //set table to null in the context model
- joinColumn.setSpecifiedTable(null);
- assertNull(joinColumn.getSpecifiedTable());
- assertNull(javaJoinColumn.getTable());
- }
-
- public void testDefaultTable() throws Exception {
- //TODO test default join column table
-
- }
-
- public void testUpdateUnique() throws Exception {
- createTestEntityWithOneToOne();
- addXmlClassRef(FULLY_QUALIFIED_TYPE_NAME);
-
- JavaOneToOneMapping oneToOneMapping = (JavaOneToOneMapping) getJavaPersistentType().attributes().next().getMapping();
- JavaJoinColumnJoiningStrategy joinColumns = oneToOneMapping.getRelationshipReference().getJoinColumnJoiningStrategy();
-
- JavaResourcePersistentType typeResource = getJpaProject().getJavaResourcePersistentType(FULLY_QUALIFIED_TYPE_NAME);
- JavaResourcePersistentAttribute attributeResource = typeResource.persistableAttributes().next();
-
- JoinColumnAnnotation javaJoinColumn = (JoinColumnAnnotation) attributeResource.getSupportingAnnotation(JoinColumnAnnotation.ANNOTATION_NAME);
-
- assertEquals(0, joinColumns.specifiedJoinColumnsSize());
- assertNull(javaJoinColumn);
-
-
- //set unique in the resource model, verify context model updated
- javaJoinColumn = (JoinColumnAnnotation) attributeResource.addSupportingAnnotation(JoinColumnAnnotation.ANNOTATION_NAME);
- javaJoinColumn.setName("FOO");
- javaJoinColumn.setUnique(Boolean.TRUE);
- JavaJoinColumn joinColumn = joinColumns.specifiedJoinColumns().next();
- assertEquals(Boolean.TRUE, joinColumn.getSpecifiedUnique());
- assertEquals(Boolean.TRUE, javaJoinColumn.getUnique());
-
- //set unique to null in the resource model,
- javaJoinColumn.setUnique(null);
- assertNull(joinColumn.getSpecifiedUnique());
- assertNull(javaJoinColumn.getUnique());
- }
-
- public void testModifyUnique() throws Exception {
- createTestEntityWithOneToOne();
- addXmlClassRef(FULLY_QUALIFIED_TYPE_NAME);
-
- JavaOneToOneMapping oneToOneMapping = (JavaOneToOneMapping) getJavaPersistentType().attributes().next().getMapping();
- JavaJoinColumnJoiningStrategy joinColumns = oneToOneMapping.getRelationshipReference().getJoinColumnJoiningStrategy();
-
- JavaResourcePersistentType typeResource = getJpaProject().getJavaResourcePersistentType(FULLY_QUALIFIED_TYPE_NAME);
- JavaResourcePersistentAttribute attributeResource = typeResource.persistableAttributes().next();
-
-
- JavaJoinColumn joinColumn = joinColumns.addSpecifiedJoinColumn(0);
- //set unique in the context model, verify resource model modified
- joinColumn.setSpecifiedName("foo");
- joinColumn.setSpecifiedUnique(Boolean.TRUE);
-
- JoinColumnAnnotation javaJoinColumn = (JoinColumnAnnotation) attributeResource.getSupportingAnnotation(JoinColumnAnnotation.ANNOTATION_NAME);
- assertEquals(Boolean.TRUE, joinColumn.getSpecifiedUnique());
- assertEquals(Boolean.TRUE, javaJoinColumn.getUnique());
-
- //set unique to null in the context model
- joinColumn.setSpecifiedUnique(null);
- assertNull(joinColumn.getSpecifiedUnique());
- assertNull(javaJoinColumn.getUnique());
- }
-
- public void testUpdateNullable() throws Exception {
- createTestEntityWithOneToOne();
- addXmlClassRef(FULLY_QUALIFIED_TYPE_NAME);
-
- JavaOneToOneMapping oneToOneMapping = (JavaOneToOneMapping) getJavaPersistentType().attributes().next().getMapping();
- JavaJoinColumnJoiningStrategy joinColumns = oneToOneMapping.getRelationshipReference().getJoinColumnJoiningStrategy();
-
- JavaResourcePersistentType typeResource = getJpaProject().getJavaResourcePersistentType(FULLY_QUALIFIED_TYPE_NAME);
- JavaResourcePersistentAttribute attributeResource = typeResource.persistableAttributes().next();
-
- JoinColumnAnnotation javaJoinColumn = (JoinColumnAnnotation) attributeResource.getSupportingAnnotation(JoinColumnAnnotation.ANNOTATION_NAME);
-
- assertEquals(0, joinColumns.specifiedJoinColumnsSize());
- assertNull(javaJoinColumn);
-
-
- //set nullable in the resource model, verify context model updated
- javaJoinColumn = (JoinColumnAnnotation) attributeResource.addSupportingAnnotation(JoinColumnAnnotation.ANNOTATION_NAME);
- javaJoinColumn.setName("FOO");
- javaJoinColumn.setNullable(Boolean.FALSE);
- JavaJoinColumn joinColumn = joinColumns.specifiedJoinColumns().next();
- assertEquals(Boolean.FALSE, joinColumn.getSpecifiedNullable());
- assertEquals(Boolean.FALSE, javaJoinColumn.getNullable());
-
- //set nullable to null in the resource model,
- javaJoinColumn.setNullable(null);
- assertNull(joinColumn.getSpecifiedNullable());
- assertNull(javaJoinColumn.getNullable());
- }
-
- public void testModifyNullable() throws Exception {
- createTestEntityWithOneToOne();
- addXmlClassRef(FULLY_QUALIFIED_TYPE_NAME);
-
- JavaOneToOneMapping oneToOneMapping = (JavaOneToOneMapping) getJavaPersistentType().attributes().next().getMapping();
- JavaJoinColumnJoiningStrategy joinColumns = oneToOneMapping.getRelationshipReference().getJoinColumnJoiningStrategy();
-
- JavaResourcePersistentType typeResource = getJpaProject().getJavaResourcePersistentType(FULLY_QUALIFIED_TYPE_NAME);
- JavaResourcePersistentAttribute attributeResource = typeResource.persistableAttributes().next();
-
-
- JavaJoinColumn joinColumn = joinColumns.addSpecifiedJoinColumn(0);
- //set nullable in the context model, verify resource model modified
- joinColumn.setSpecifiedName("foo");
- joinColumn.setSpecifiedNullable(Boolean.FALSE);
-
- JoinColumnAnnotation javaJoinColumn = (JoinColumnAnnotation) attributeResource.getSupportingAnnotation(JoinColumnAnnotation.ANNOTATION_NAME);
- assertEquals(Boolean.FALSE, joinColumn.getSpecifiedNullable());
- assertEquals(Boolean.FALSE, javaJoinColumn.getNullable());
-
- //set nullable to null in the context model
- joinColumn.setSpecifiedNullable(null);
- assertNull(joinColumn.getSpecifiedNullable());
- assertNull(javaJoinColumn.getNullable());
- }
-
- public void testUpdateInsertable() throws Exception {
- createTestEntityWithOneToOne();
- addXmlClassRef(FULLY_QUALIFIED_TYPE_NAME);
-
- JavaOneToOneMapping oneToOneMapping = (JavaOneToOneMapping) getJavaPersistentType().attributes().next().getMapping();
- JavaJoinColumnJoiningStrategy joinColumns = oneToOneMapping.getRelationshipReference().getJoinColumnJoiningStrategy();
-
- JavaResourcePersistentType typeResource = getJpaProject().getJavaResourcePersistentType(FULLY_QUALIFIED_TYPE_NAME);
- JavaResourcePersistentAttribute attributeResource = typeResource.persistableAttributes().next();
-
- JoinColumnAnnotation javaJoinColumn = (JoinColumnAnnotation) attributeResource.getSupportingAnnotation(JoinColumnAnnotation.ANNOTATION_NAME);
-
- assertEquals(0, joinColumns.specifiedJoinColumnsSize());
- assertNull(javaJoinColumn);
-
-
- //set insertable in the resource model, verify context model updated
- javaJoinColumn = (JoinColumnAnnotation) attributeResource.addSupportingAnnotation(JoinColumnAnnotation.ANNOTATION_NAME);
- javaJoinColumn.setName("FOO");
- javaJoinColumn.setInsertable(Boolean.FALSE);
- JavaJoinColumn joinColumn = joinColumns.specifiedJoinColumns().next();
- assertEquals(Boolean.FALSE, joinColumn.getSpecifiedInsertable());
- assertEquals(Boolean.FALSE, javaJoinColumn.getInsertable());
-
- //set insertable to null in the resource model,
- javaJoinColumn.setInsertable(null);
- assertNull(joinColumn.getSpecifiedInsertable());
- assertNull(javaJoinColumn.getInsertable());
- }
-
- public void testModifyInsertable() throws Exception {
- createTestEntityWithOneToOne();
- addXmlClassRef(FULLY_QUALIFIED_TYPE_NAME);
-
- JavaOneToOneMapping oneToOneMapping = (JavaOneToOneMapping) getJavaPersistentType().attributes().next().getMapping();
- JavaJoinColumnJoiningStrategy joinColumns = oneToOneMapping.getRelationshipReference().getJoinColumnJoiningStrategy();
-
- JavaResourcePersistentType typeResource = getJpaProject().getJavaResourcePersistentType(FULLY_QUALIFIED_TYPE_NAME);
- JavaResourcePersistentAttribute attributeResource = typeResource.persistableAttributes().next();
-
-
- JavaJoinColumn joinColumn = joinColumns.addSpecifiedJoinColumn(0);
- //set insertable in the context model, verify resource model modified
- joinColumn.setSpecifiedName("foo");
- joinColumn.setSpecifiedInsertable(Boolean.FALSE);
-
- JoinColumnAnnotation javaJoinColumn = (JoinColumnAnnotation) attributeResource.getSupportingAnnotation(JoinColumnAnnotation.ANNOTATION_NAME);
- assertEquals(Boolean.FALSE, joinColumn.getSpecifiedInsertable());
- assertEquals(Boolean.FALSE, javaJoinColumn.getInsertable());
-
- //set insertable to null in the context model
- joinColumn.setSpecifiedInsertable(null);
- assertNull(joinColumn.getSpecifiedInsertable());
- assertNull(javaJoinColumn.getInsertable());
- }
-
- public void testUpdateUpdatable() throws Exception {
- createTestEntityWithOneToOne();
- addXmlClassRef(FULLY_QUALIFIED_TYPE_NAME);
-
- JavaOneToOneMapping oneToOneMapping = (JavaOneToOneMapping) getJavaPersistentType().attributes().next().getMapping();
- JavaJoinColumnJoiningStrategy joinColumns = oneToOneMapping.getRelationshipReference().getJoinColumnJoiningStrategy();
-
- JavaResourcePersistentType typeResource = getJpaProject().getJavaResourcePersistentType(FULLY_QUALIFIED_TYPE_NAME);
- JavaResourcePersistentAttribute attributeResource = typeResource.persistableAttributes().next();
-
- JoinColumnAnnotation javaJoinColumn = (JoinColumnAnnotation) attributeResource.getSupportingAnnotation(JoinColumnAnnotation.ANNOTATION_NAME);
-
- assertEquals(0, joinColumns.specifiedJoinColumnsSize());
- assertNull(javaJoinColumn);
-
-
- //set updatable in the resource model, verify context model updated
- javaJoinColumn = (JoinColumnAnnotation) attributeResource.addSupportingAnnotation(JoinColumnAnnotation.ANNOTATION_NAME);
- javaJoinColumn.setName("FOO");
- javaJoinColumn.setUpdatable(Boolean.FALSE);
- JavaJoinColumn joinColumn = joinColumns.specifiedJoinColumns().next();
- assertEquals(Boolean.FALSE, joinColumn.getSpecifiedUpdatable());
- assertEquals(Boolean.FALSE, javaJoinColumn.getUpdatable());
-
- //set updatable to null in the resource model,
- javaJoinColumn.setUpdatable(null);
- assertNull(joinColumn.getSpecifiedUpdatable());
- assertNull(javaJoinColumn.getUpdatable());
- }
-
- public void testModifyUpdatable() throws Exception {
- createTestEntityWithOneToOne();
- addXmlClassRef(FULLY_QUALIFIED_TYPE_NAME);
-
- JavaOneToOneMapping oneToOneMapping = (JavaOneToOneMapping) getJavaPersistentType().attributes().next().getMapping();
- JavaJoinColumnJoiningStrategy joinColumns = oneToOneMapping.getRelationshipReference().getJoinColumnJoiningStrategy();
-
- JavaResourcePersistentType typeResource = getJpaProject().getJavaResourcePersistentType(FULLY_QUALIFIED_TYPE_NAME);
- JavaResourcePersistentAttribute attributeResource = typeResource.persistableAttributes().next();
-
-
- JavaJoinColumn joinColumn = joinColumns.addSpecifiedJoinColumn(0);
- //set updatable in the context model, verify resource model modified
- joinColumn.setSpecifiedName("foo");
- joinColumn.setSpecifiedUpdatable(Boolean.FALSE);
-
- JoinColumnAnnotation javaJoinColumn = (JoinColumnAnnotation) attributeResource.getSupportingAnnotation(JoinColumnAnnotation.ANNOTATION_NAME);
- assertEquals(Boolean.FALSE, joinColumn.getSpecifiedUpdatable());
- assertEquals(Boolean.FALSE, javaJoinColumn.getUpdatable());
-
- //set updatable to null in the context model
- joinColumn.setSpecifiedUpdatable(null);
- assertNull(joinColumn.getSpecifiedUpdatable());
- assertNull(javaJoinColumn.getUpdatable());
- }
-}
diff --git a/jpa/tests/org.eclipse.jpt.core.tests/src/org/eclipse/jpt/core/tests/internal/context/java/JavaJoinTableTests.java b/jpa/tests/org.eclipse.jpt.core.tests/src/org/eclipse/jpt/core/tests/internal/context/java/JavaJoinTableTests.java
deleted file mode 100644
index 45f636e707..0000000000
--- a/jpa/tests/org.eclipse.jpt.core.tests/src/org/eclipse/jpt/core/tests/internal/context/java/JavaJoinTableTests.java
+++ /dev/null
@@ -1,970 +0,0 @@
-/*******************************************************************************
- * Copyright (c) 2007, 2008 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.
- *
- * Contributors:
- * Oracle - initial API and implementation
- ******************************************************************************/
-package org.eclipse.jpt.core.tests.internal.context.java;
-
-import java.util.Iterator;
-import java.util.ListIterator;
-import org.eclipse.jdt.core.ICompilationUnit;
-import org.eclipse.jpt.core.context.JoinColumn;
-import org.eclipse.jpt.core.context.JoinTable;
-import org.eclipse.jpt.core.context.UniqueConstraint;
-import org.eclipse.jpt.core.context.java.JavaManyToManyMapping;
-import org.eclipse.jpt.core.context.java.JavaUniqueConstraint;
-import org.eclipse.jpt.core.resource.java.JPA;
-import org.eclipse.jpt.core.resource.java.JavaResourcePersistentAttribute;
-import org.eclipse.jpt.core.resource.java.JavaResourcePersistentType;
-import org.eclipse.jpt.core.resource.java.JoinTableAnnotation;
-import org.eclipse.jpt.core.resource.java.UniqueConstraintAnnotation;
-import org.eclipse.jpt.core.tests.internal.context.ContextModelTestCase;
-import org.eclipse.jpt.core.tests.internal.projects.TestJavaProject.SourceWriter;
-import org.eclipse.jpt.utility.internal.iterators.ArrayIterator;
-
-public class JavaJoinTableTests extends ContextModelTestCase
-{
- public JavaJoinTableTests(String name) {
- super(name);
- }
-
- private ICompilationUnit createTestEntityWithManyToMany() throws Exception {
- return this.createTestType(new DefaultAnnotationWriter() {
- @Override
- public Iterator<String> imports() {
- return new ArrayIterator<String>(JPA.ENTITY, JPA.MANY_TO_MANY);
- }
- @Override
- public void appendTypeAnnotationTo(StringBuilder sb) {
- sb.append("@Entity");
- }
- @Override
- public void appendIdFieldAnnotationTo(StringBuilder sb) {
- sb.append("@ManyToMany").append(CR);
- }
- });
- }
-
- private ICompilationUnit createTestEntityWithValidManyToMany() throws Exception {
- return this.createTestType(new DefaultAnnotationWriter() {
- @Override
- public Iterator<String> imports() {
- return new ArrayIterator<String>(JPA.ENTITY, JPA.MANY_TO_MANY, "java.util.Collection");
- }
- @Override
- public void appendTypeAnnotationTo(StringBuilder sb) {
- sb.append("@Entity");
- }
- @Override
- public void appendIdFieldAnnotationTo(StringBuilder sb) {
- sb.append("@ManyToMany").append(CR);
- sb.append(" private Collection<Project> projects;").append(CR);
- }
- });
- }
-
- private void createTargetEntity() throws Exception {
- SourceWriter sourceWriter = new SourceWriter() {
- public void appendSourceTo(StringBuilder sb) {
- sb.append(CR);
- sb.append("import ");
- sb.append(JPA.ENTITY);
- sb.append(";");
- sb.append(CR);
- sb.append("import ");
- sb.append(JPA.ID);
- sb.append(";");
- sb.append(CR);
- sb.append(CR);
- sb.append("@Entity");
- sb.append(CR);
- sb.append("public class Project {").append(CR);
- sb.append(CR);
- sb.append(" @Id").append(CR);
- sb.append(" private int proj_id;").append(CR);
- sb.append(CR);
- }
- };
- this.javaProject.createCompilationUnit(PACKAGE_NAME, "Project.java", sourceWriter);
- }
- public void testUpdateSpecifiedName() throws Exception {
- createTestEntityWithManyToMany();
- addXmlClassRef(FULLY_QUALIFIED_TYPE_NAME);
-
- JavaManyToManyMapping manyToManyMapping = (JavaManyToManyMapping) getJavaPersistentType().attributes().next().getMapping();
- JoinTable joinTable = manyToManyMapping.getRelationshipReference().getJoinTableJoiningStrategy().getJoinTable();
-
- JavaResourcePersistentType typeResource = getJpaProject().getJavaResourcePersistentType(FULLY_QUALIFIED_TYPE_NAME);
- JavaResourcePersistentAttribute attributeResource = typeResource.persistableAttributes().next();
-
- JoinTableAnnotation javaJoinTable = (JoinTableAnnotation) attributeResource.getSupportingAnnotation(JoinTableAnnotation.ANNOTATION_NAME);
-
- assertNull(joinTable.getSpecifiedName());
- assertNull(javaJoinTable);
-
-
- //set name in the resource model, verify context model updated
- attributeResource.addSupportingAnnotation(JoinTableAnnotation.ANNOTATION_NAME);
- javaJoinTable = (JoinTableAnnotation) attributeResource.getSupportingAnnotation(JoinTableAnnotation.ANNOTATION_NAME);
- javaJoinTable.setName("FOO");
- assertEquals("FOO", joinTable.getSpecifiedName());
- assertEquals("FOO", javaJoinTable.getName());
-
- //set name to null in the resource model
- javaJoinTable.setName(null);
- assertNull(joinTable.getSpecifiedName());
- assertNull(javaJoinTable.getName());
-
- javaJoinTable.setName("FOO");
- assertEquals("FOO", joinTable.getSpecifiedName());
- assertEquals("FOO", javaJoinTable.getName());
-
- attributeResource.removeSupportingAnnotation(JoinTableAnnotation.ANNOTATION_NAME);
- assertNull(joinTable.getSpecifiedName());
- assertNull(attributeResource.getSupportingAnnotation(JoinTableAnnotation.ANNOTATION_NAME));
- }
-
- public void testModifySpecifiedName() throws Exception {
- createTestEntityWithManyToMany();
- addXmlClassRef(FULLY_QUALIFIED_TYPE_NAME);
-
- JavaManyToManyMapping manyToManyMapping = (JavaManyToManyMapping) getJavaPersistentType().attributes().next().getMapping();
- JoinTable joinTable = manyToManyMapping.getRelationshipReference().getJoinTableJoiningStrategy().getJoinTable();
-
- JavaResourcePersistentType typeResource = getJpaProject().getJavaResourcePersistentType(FULLY_QUALIFIED_TYPE_NAME);
- JavaResourcePersistentAttribute attributeResource = typeResource.persistableAttributes().next();
-
- JoinTableAnnotation javaJoinTable = (JoinTableAnnotation) attributeResource.getSupportingAnnotation(JoinTableAnnotation.ANNOTATION_NAME);
-
- assertNull(joinTable.getSpecifiedName());
- assertNull(javaJoinTable);
-
- //set name in the context model, verify resource model modified
- joinTable.setSpecifiedName("foo");
- javaJoinTable = (JoinTableAnnotation) attributeResource.getSupportingAnnotation(JoinTableAnnotation.ANNOTATION_NAME);
- assertEquals("foo", joinTable.getSpecifiedName());
- assertEquals("foo", javaJoinTable.getName());
-
- //set name to null in the context model
- joinTable.setSpecifiedName(null);
- assertNull(joinTable.getSpecifiedName());
- assertNull(attributeResource.getSupportingAnnotation(JoinTableAnnotation.ANNOTATION_NAME));
- }
-
- public void testDefaultName() throws Exception {
- createTestEntityWithValidManyToMany();
- addXmlClassRef(FULLY_QUALIFIED_TYPE_NAME);
-
-
- JavaManyToManyMapping manyToManyMapping = (JavaManyToManyMapping) getJavaPersistentType().attributes().next().getMapping();
- JoinTable joinTable = manyToManyMapping.getRelationshipReference().getJoinTableJoiningStrategy().getJoinTable();
-
- //joinTable default name is null because targetEntity is not in the persistence unit
- assertNull(joinTable.getDefaultName());
-
- //add target entity to the persistence unit, now join table name is [table name]_[target table name]
- createTargetEntity();
- 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.getSupportingAnnotation(JoinTableAnnotation.ANNOTATION_NAME));
-
- //target entity does not resolve, default name is null
- manyToManyMapping.setSpecifiedTargetEntity("Foo");
- assertNull(joinTable.getDefaultName());
-
- //default target entity does resolve, so default name is again [table name]_[target table name]
- manyToManyMapping.setSpecifiedTargetEntity(null);
- assertEquals(TYPE_NAME + "_Project", joinTable.getDefaultName());
-
- //add the join table annotation, verify default join table name is the same
- attributeResource.addSupportingAnnotation(JoinTableAnnotation.ANNOTATION_NAME);
- assertEquals(TYPE_NAME + "_Project", joinTable.getDefaultName());
- assertNotNull(attributeResource.getSupportingAnnotation(JoinTableAnnotation.ANNOTATION_NAME));
-
- //set a table on the target entity, very default join table name updates
- manyToManyMapping.getResolvedTargetEntity().getTable().setSpecifiedName("FOO");
- assertEquals(TYPE_NAME + "_FOO", joinTable.getDefaultName());
-
- //set a table on the owning entity, very default join table name updates
- getJavaEntity().getTable().setSpecifiedName("BAR");
- assertEquals("BAR_FOO", joinTable.getDefaultName());
- }
-
- public void testUpdateSpecifiedSchema() throws Exception {
- createTestEntityWithManyToMany();
- addXmlClassRef(FULLY_QUALIFIED_TYPE_NAME);
-
- JavaManyToManyMapping manyToManyMapping = (JavaManyToManyMapping) getJavaPersistentType().attributes().next().getMapping();
- JoinTable joinTable = manyToManyMapping.getRelationshipReference().getJoinTableJoiningStrategy().getJoinTable();
-
- JavaResourcePersistentType typeResource = getJpaProject().getJavaResourcePersistentType(FULLY_QUALIFIED_TYPE_NAME);
- JavaResourcePersistentAttribute attributeResource = typeResource.persistableAttributes().next();
-
- JoinTableAnnotation javaJoinTable = (JoinTableAnnotation) attributeResource.getSupportingAnnotation(JoinTableAnnotation.ANNOTATION_NAME);
-
- assertNull(joinTable.getSpecifiedSchema());
- assertNull(javaJoinTable);
-
-
- //set schema in the resource model, verify context model updated
- attributeResource.addSupportingAnnotation(JoinTableAnnotation.ANNOTATION_NAME);
- javaJoinTable = (JoinTableAnnotation) attributeResource.getSupportingAnnotation(JoinTableAnnotation.ANNOTATION_NAME);
- javaJoinTable.setSchema("FOO");
- assertEquals("FOO", joinTable.getSpecifiedSchema());
- assertEquals("FOO", javaJoinTable.getSchema());
-
- //set schema to null in the resource model
- javaJoinTable.setSchema(null);
- assertNull(joinTable.getSpecifiedSchema());
- assertNull(javaJoinTable.getSchema());
-
- javaJoinTable.setSchema("FOO");
- assertEquals("FOO", joinTable.getSpecifiedSchema());
- assertEquals("FOO", javaJoinTable.getSchema());
-
- attributeResource.removeSupportingAnnotation(JoinTableAnnotation.ANNOTATION_NAME);
- assertNull(joinTable.getSpecifiedSchema());
- assertNull(attributeResource.getSupportingAnnotation(JoinTableAnnotation.ANNOTATION_NAME));
- }
-
- public void testModifySpecifiedSchema() throws Exception {
- createTestEntityWithManyToMany();
- addXmlClassRef(FULLY_QUALIFIED_TYPE_NAME);
-
- JavaManyToManyMapping manyToManyMapping = (JavaManyToManyMapping) getJavaPersistentType().attributes().next().getMapping();
- JoinTable joinTable = manyToManyMapping.getRelationshipReference().getJoinTableJoiningStrategy().getJoinTable();
-
- JavaResourcePersistentType typeResource = getJpaProject().getJavaResourcePersistentType(FULLY_QUALIFIED_TYPE_NAME);
- JavaResourcePersistentAttribute attributeResource = typeResource.persistableAttributes().next();
-
- JoinTableAnnotation javaJoinTable = (JoinTableAnnotation) attributeResource.getSupportingAnnotation(JoinTableAnnotation.ANNOTATION_NAME);
-
- assertNull(joinTable.getSpecifiedSchema());
- assertNull(javaJoinTable);
-
- //set schema in the context model, verify resource model modified
- joinTable.setSpecifiedSchema("foo");
- javaJoinTable = (JoinTableAnnotation) attributeResource.getSupportingAnnotation(JoinTableAnnotation.ANNOTATION_NAME);
- assertEquals("foo", joinTable.getSpecifiedSchema());
- assertEquals("foo", javaJoinTable.getSchema());
-
- //set schema to null in the context model
- joinTable.setSpecifiedSchema(null);
- assertNull(joinTable.getSpecifiedSchema());
- assertNull(attributeResource.getSupportingAnnotation(JoinTableAnnotation.ANNOTATION_NAME));
- }
-
- public void testUpdateSpecifiedCatalog() throws Exception {
- createTestEntityWithManyToMany();
- addXmlClassRef(FULLY_QUALIFIED_TYPE_NAME);
-
- JavaManyToManyMapping manyToManyMapping = (JavaManyToManyMapping) getJavaPersistentType().attributes().next().getMapping();
- JoinTable joinTable = manyToManyMapping.getRelationshipReference().getJoinTableJoiningStrategy().getJoinTable();
-
- JavaResourcePersistentType typeResource = getJpaProject().getJavaResourcePersistentType(FULLY_QUALIFIED_TYPE_NAME);
- JavaResourcePersistentAttribute attributeResource = typeResource.persistableAttributes().next();
-
- JoinTableAnnotation javaJoinTable = (JoinTableAnnotation) attributeResource.getSupportingAnnotation(JoinTableAnnotation.ANNOTATION_NAME);
-
- assertNull(joinTable.getSpecifiedCatalog());
- assertNull(javaJoinTable);
-
-
- //set catalog in the resource model, verify context model updated
- attributeResource.addSupportingAnnotation(JoinTableAnnotation.ANNOTATION_NAME);
- javaJoinTable = (JoinTableAnnotation) attributeResource.getSupportingAnnotation(JoinTableAnnotation.ANNOTATION_NAME);
- javaJoinTable.setCatalog("FOO");
- assertEquals("FOO", joinTable.getSpecifiedCatalog());
- assertEquals("FOO", javaJoinTable.getCatalog());
-
- //set catalog to null in the resource model
- javaJoinTable.setCatalog(null);
- assertNull(joinTable.getSpecifiedCatalog());
- assertNull(javaJoinTable.getCatalog());
-
- javaJoinTable.setCatalog("FOO");
- assertEquals("FOO", joinTable.getSpecifiedCatalog());
- assertEquals("FOO", javaJoinTable.getCatalog());
-
- attributeResource.removeSupportingAnnotation(JoinTableAnnotation.ANNOTATION_NAME);
- assertNull(joinTable.getSpecifiedCatalog());
- assertNull(attributeResource.getSupportingAnnotation(JoinTableAnnotation.ANNOTATION_NAME));
- }
-
- public void testModifySpecifiedCatalog() throws Exception {
- createTestEntityWithManyToMany();
- addXmlClassRef(FULLY_QUALIFIED_TYPE_NAME);
-
- JavaManyToManyMapping manyToManyMapping = (JavaManyToManyMapping) getJavaPersistentType().attributes().next().getMapping();
- JoinTable joinTable = manyToManyMapping.getRelationshipReference().getJoinTableJoiningStrategy().getJoinTable();
-
- JavaResourcePersistentType typeResource = getJpaProject().getJavaResourcePersistentType(FULLY_QUALIFIED_TYPE_NAME);
- JavaResourcePersistentAttribute attributeResource = typeResource.persistableAttributes().next();
-
- JoinTableAnnotation javaJoinTable = (JoinTableAnnotation) attributeResource.getSupportingAnnotation(JoinTableAnnotation.ANNOTATION_NAME);
-
- assertNull(joinTable.getSpecifiedCatalog());
- assertNull(javaJoinTable);
-
- //set catalog in the context model, verify resource model modified
- joinTable.setSpecifiedCatalog("foo");
- javaJoinTable = (JoinTableAnnotation) attributeResource.getSupportingAnnotation(JoinTableAnnotation.ANNOTATION_NAME);
- assertEquals("foo", joinTable.getSpecifiedCatalog());
- assertEquals("foo", javaJoinTable.getCatalog());
-
- //set catalog to null in the context model
- joinTable.setSpecifiedCatalog(null);
- assertNull(joinTable.getSpecifiedCatalog());
- assertNull(attributeResource.getSupportingAnnotation(JoinTableAnnotation.ANNOTATION_NAME));
- }
-
- public void testAddSpecifiedJoinColumn() throws Exception {
- createTestEntityWithManyToMany();
- addXmlClassRef(FULLY_QUALIFIED_TYPE_NAME);
-
- JavaManyToManyMapping manyToManyMapping = (JavaManyToManyMapping) getJavaPersistentType().attributes().next().getMapping();
- JoinTable joinTable = manyToManyMapping.getRelationshipReference().getJoinTableJoiningStrategy().getJoinTable();
-
- JavaResourcePersistentType typeResource = getJpaProject().getJavaResourcePersistentType(FULLY_QUALIFIED_TYPE_NAME);
- JavaResourcePersistentAttribute attributeResource = typeResource.persistableAttributes().next();
-
-
- JoinColumn joinColumn = joinTable.addSpecifiedJoinColumn(0);
- joinColumn.setSpecifiedName("FOO");
-
- JoinTableAnnotation joinTableResource = (JoinTableAnnotation) attributeResource.getSupportingAnnotation(JoinTableAnnotation.ANNOTATION_NAME);
-
- assertEquals("FOO", joinTableResource.joinColumnAt(0).getName());
-
- JoinColumn joinColumn2 = joinTable.addSpecifiedJoinColumn(0);
- joinColumn2.setSpecifiedName("BAR");
-
- assertEquals("BAR", joinTableResource.joinColumnAt(0).getName());
- assertEquals("FOO", joinTableResource.joinColumnAt(1).getName());
-
- JoinColumn joinColumn3 = joinTable.addSpecifiedJoinColumn(1);
- joinColumn3.setSpecifiedName("BAZ");
-
- assertEquals("BAR", joinTableResource.joinColumnAt(0).getName());
- assertEquals("BAZ", joinTableResource.joinColumnAt(1).getName());
- assertEquals("FOO", joinTableResource.joinColumnAt(2).getName());
-
- ListIterator<JoinColumn> joinColumns = joinTable.specifiedJoinColumns();
- assertEquals(joinColumn2, joinColumns.next());
- assertEquals(joinColumn3, joinColumns.next());
- assertEquals(joinColumn, joinColumns.next());
-
- joinColumns = joinTable.specifiedJoinColumns();
- assertEquals("BAR", joinColumns.next().getName());
- assertEquals("BAZ", joinColumns.next().getName());
- assertEquals("FOO", joinColumns.next().getName());
- }
-
- public void testRemoveSpecifiedJoinColumn() throws Exception {
- createTestEntityWithManyToMany();
- addXmlClassRef(FULLY_QUALIFIED_TYPE_NAME);
-
- JavaManyToManyMapping manyToManyMapping = (JavaManyToManyMapping) getJavaPersistentType().attributes().next().getMapping();
- JoinTable joinTable = manyToManyMapping.getRelationshipReference().getJoinTableJoiningStrategy().getJoinTable();
-
- JavaResourcePersistentType typeResource = getJpaProject().getJavaResourcePersistentType(FULLY_QUALIFIED_TYPE_NAME);
- JavaResourcePersistentAttribute attributeResource = typeResource.persistableAttributes().next();
-
- joinTable.addSpecifiedJoinColumn(0).setSpecifiedName("FOO");
- joinTable.addSpecifiedJoinColumn(1).setSpecifiedName("BAR");
- joinTable.addSpecifiedJoinColumn(2).setSpecifiedName("BAZ");
-
- JoinTableAnnotation joinTableResource = (JoinTableAnnotation) attributeResource.getSupportingAnnotation(JoinTableAnnotation.ANNOTATION_NAME);
- assertEquals(3, joinTableResource.joinColumnsSize());
-
- joinTable.removeSpecifiedJoinColumn(0);
- assertEquals(2, joinTableResource.joinColumnsSize());
- assertEquals("BAR", joinTableResource.joinColumnAt(0).getName());
- assertEquals("BAZ", joinTableResource.joinColumnAt(1).getName());
-
- joinTable.removeSpecifiedJoinColumn(0);
- assertEquals(1, joinTableResource.joinColumnsSize());
- assertEquals("BAZ", joinTableResource.joinColumnAt(0).getName());
-
- joinTable.removeSpecifiedJoinColumn(0);
- assertEquals(0, joinTableResource.joinColumnsSize());
- }
-
- public void testMoveSpecifiedJoinColumn() throws Exception {
- createTestEntityWithManyToMany();
- addXmlClassRef(FULLY_QUALIFIED_TYPE_NAME);
-
- JavaManyToManyMapping manyToManyMapping = (JavaManyToManyMapping) getJavaPersistentType().attributes().next().getMapping();
- JoinTable joinTable = manyToManyMapping.getRelationshipReference().getJoinTableJoiningStrategy().getJoinTable();
-
- JavaResourcePersistentType typeResource = getJpaProject().getJavaResourcePersistentType(FULLY_QUALIFIED_TYPE_NAME);
- JavaResourcePersistentAttribute attributeResource = typeResource.persistableAttributes().next();
-
- joinTable.addSpecifiedJoinColumn(0).setSpecifiedName("FOO");
- joinTable.addSpecifiedJoinColumn(1).setSpecifiedName("BAR");
- joinTable.addSpecifiedJoinColumn(2).setSpecifiedName("BAZ");
-
- JoinTableAnnotation joinTableResource = (JoinTableAnnotation) attributeResource.getSupportingAnnotation(JoinTableAnnotation.ANNOTATION_NAME);
- assertEquals(3, joinTableResource.joinColumnsSize());
-
-
- joinTable.moveSpecifiedJoinColumn(2, 0);
- ListIterator<JoinColumn> joinColumns = joinTable.specifiedJoinColumns();
- assertEquals("BAR", joinColumns.next().getName());
- assertEquals("BAZ", joinColumns.next().getName());
- assertEquals("FOO", joinColumns.next().getName());
-
- assertEquals("BAR", joinTableResource.joinColumnAt(0).getName());
- assertEquals("BAZ", joinTableResource.joinColumnAt(1).getName());
- assertEquals("FOO", joinTableResource.joinColumnAt(2).getName());
-
-
- joinTable.moveSpecifiedJoinColumn(0, 1);
- joinColumns = joinTable.specifiedJoinColumns();
- assertEquals("BAZ", joinColumns.next().getName());
- assertEquals("BAR", joinColumns.next().getName());
- assertEquals("FOO", joinColumns.next().getName());
-
- assertEquals("BAZ", joinTableResource.joinColumnAt(0).getName());
- assertEquals("BAR", joinTableResource.joinColumnAt(1).getName());
- assertEquals("FOO", joinTableResource.joinColumnAt(2).getName());
- }
-
- public void testUpdateJoinColumns() throws Exception {
- createTestEntityWithManyToMany();
- addXmlClassRef(FULLY_QUALIFIED_TYPE_NAME);
-
- JavaManyToManyMapping manyToManyMapping = (JavaManyToManyMapping) getJavaPersistentType().attributes().next().getMapping();
- JoinTable joinTable = manyToManyMapping.getRelationshipReference().getJoinTableJoiningStrategy().getJoinTable();
-
- JavaResourcePersistentType typeResource = getJpaProject().getJavaResourcePersistentType(FULLY_QUALIFIED_TYPE_NAME);
- JavaResourcePersistentAttribute attributeResource = typeResource.persistableAttributes().next();
-
- JoinTableAnnotation joinTableResource = (JoinTableAnnotation) attributeResource.addSupportingAnnotation(JoinTableAnnotation.ANNOTATION_NAME);
-
- joinTableResource.addJoinColumn(0);
- joinTableResource.addJoinColumn(1);
- joinTableResource.addJoinColumn(2);
-
- joinTableResource.joinColumnAt(0).setName("FOO");
- joinTableResource.joinColumnAt(1).setName("BAR");
- joinTableResource.joinColumnAt(2).setName("BAZ");
-
- ListIterator<JoinColumn> joinColumns = joinTable.specifiedJoinColumns();
- assertEquals("FOO", joinColumns.next().getName());
- assertEquals("BAR", joinColumns.next().getName());
- assertEquals("BAZ", joinColumns.next().getName());
- assertFalse(joinColumns.hasNext());
-
- joinTableResource.moveJoinColumn(2, 0);
- joinColumns = joinTable.specifiedJoinColumns();
- assertEquals("BAR", joinColumns.next().getName());
- assertEquals("BAZ", joinColumns.next().getName());
- assertEquals("FOO", joinColumns.next().getName());
- assertFalse(joinColumns.hasNext());
-
- joinTableResource.moveJoinColumn(0, 1);
- joinColumns = joinTable.specifiedJoinColumns();
- assertEquals("BAZ", joinColumns.next().getName());
- assertEquals("BAR", joinColumns.next().getName());
- assertEquals("FOO", joinColumns.next().getName());
- assertFalse(joinColumns.hasNext());
-
- joinTableResource.removeJoinColumn(1);
- joinColumns = joinTable.specifiedJoinColumns();
- assertEquals("BAZ", joinColumns.next().getName());
- assertEquals("FOO", joinColumns.next().getName());
- assertFalse(joinColumns.hasNext());
-
- joinTableResource.removeJoinColumn(1);
- joinColumns = joinTable.specifiedJoinColumns();
- assertEquals("BAZ", joinColumns.next().getName());
- assertFalse(joinColumns.hasNext());
-
- joinTableResource.removeJoinColumn(0);
- assertFalse(joinTable.specifiedJoinColumns().hasNext());
- }
-
- public void testGetDefaultJoinColumn() {
- //TODO
- }
-
- public void testSpecifiedJoinColumnsSize() throws Exception {
- createTestEntityWithManyToMany();
- addXmlClassRef(FULLY_QUALIFIED_TYPE_NAME);
-
- JavaManyToManyMapping manyToManyMapping = (JavaManyToManyMapping) getJavaPersistentType().attributes().next().getMapping();
- JoinTable joinTable = manyToManyMapping.getRelationshipReference().getJoinTableJoiningStrategy().getJoinTable();
-
- assertEquals(0, joinTable.specifiedJoinColumnsSize());
-
- joinTable.addSpecifiedJoinColumn(0);
- assertEquals(1, joinTable.specifiedJoinColumnsSize());
-
- joinTable.removeSpecifiedJoinColumn(0);
- assertEquals(0, joinTable.specifiedJoinColumnsSize());
- }
-
- public void testJoinColumnsSize() throws Exception {
- createTestEntityWithManyToMany();
- addXmlClassRef(FULLY_QUALIFIED_TYPE_NAME);
-
- JavaManyToManyMapping manyToManyMapping = (JavaManyToManyMapping) getJavaPersistentType().attributes().next().getMapping();
- JoinTable joinTable = manyToManyMapping.getRelationshipReference().getJoinTableJoiningStrategy().getJoinTable();
-
- assertEquals(1, joinTable.joinColumnsSize());
-
- joinTable.addSpecifiedJoinColumn(0);
- assertEquals(1, joinTable.joinColumnsSize());
-
- joinTable.addSpecifiedJoinColumn(0);
- assertEquals(2, joinTable.joinColumnsSize());
-
- joinTable.removeSpecifiedJoinColumn(0);
- joinTable.removeSpecifiedJoinColumn(0);
- assertEquals(1, joinTable.joinColumnsSize());
-
- //if non-owning side of the relationship then no default join table
- manyToManyMapping.getRelationshipReference().getMappedByJoiningStrategy().setMappedByAttribute("foo");
- assertNull(manyToManyMapping.getRelationshipReference().getJoinTableJoiningStrategy().getJoinTable());
- }
-
- public void testAddSpecifiedInverseJoinColumn() throws Exception {
- createTestEntityWithManyToMany();
- addXmlClassRef(FULLY_QUALIFIED_TYPE_NAME);
-
- JavaManyToManyMapping manyToManyMapping = (JavaManyToManyMapping) getJavaPersistentType().attributes().next().getMapping();
- JoinTable joinTable = manyToManyMapping.getRelationshipReference().getJoinTableJoiningStrategy().getJoinTable();
-
- JavaResourcePersistentType typeResource = getJpaProject().getJavaResourcePersistentType(FULLY_QUALIFIED_TYPE_NAME);
- JavaResourcePersistentAttribute attributeResource = typeResource.persistableAttributes().next();
-
-
- JoinColumn inverseJoinColumn = joinTable.addSpecifiedInverseJoinColumn(0);
- inverseJoinColumn.setSpecifiedName("FOO");
-
- JoinTableAnnotation joinTableResource = (JoinTableAnnotation) attributeResource.getSupportingAnnotation(JoinTableAnnotation.ANNOTATION_NAME);
-
- assertEquals("FOO", joinTableResource.inverseJoinColumnAt(0).getName());
-
- JoinColumn inverseJoinColumn2 = joinTable.addSpecifiedInverseJoinColumn(0);
- inverseJoinColumn2.setSpecifiedName("BAR");
-
- assertEquals("BAR", joinTableResource.inverseJoinColumnAt(0).getName());
- assertEquals("FOO", joinTableResource.inverseJoinColumnAt(1).getName());
-
- JoinColumn inverseJoinColumn3 = joinTable.addSpecifiedInverseJoinColumn(1);
- inverseJoinColumn3.setSpecifiedName("BAZ");
-
- assertEquals("BAR", joinTableResource.inverseJoinColumnAt(0).getName());
- assertEquals("BAZ", joinTableResource.inverseJoinColumnAt(1).getName());
- assertEquals("FOO", joinTableResource.inverseJoinColumnAt(2).getName());
-
- ListIterator<JoinColumn> inverseJoinColumns = joinTable.specifiedInverseJoinColumns();
- assertEquals(inverseJoinColumn2, inverseJoinColumns.next());
- assertEquals(inverseJoinColumn3, inverseJoinColumns.next());
- assertEquals(inverseJoinColumn, inverseJoinColumns.next());
-
- inverseJoinColumns = joinTable.specifiedInverseJoinColumns();
- assertEquals("BAR", inverseJoinColumns.next().getName());
- assertEquals("BAZ", inverseJoinColumns.next().getName());
- assertEquals("FOO", inverseJoinColumns.next().getName());
- }
-
- public void testRemoveSpecifiedInverseJoinColumn() throws Exception {
- createTestEntityWithManyToMany();
- addXmlClassRef(FULLY_QUALIFIED_TYPE_NAME);
-
- JavaManyToManyMapping manyToManyMapping = (JavaManyToManyMapping) getJavaPersistentType().attributes().next().getMapping();
- JoinTable joinTable = manyToManyMapping.getRelationshipReference().getJoinTableJoiningStrategy().getJoinTable();
-
- JavaResourcePersistentType typeResource = getJpaProject().getJavaResourcePersistentType(FULLY_QUALIFIED_TYPE_NAME);
- JavaResourcePersistentAttribute attributeResource = typeResource.persistableAttributes().next();
-
- joinTable.addSpecifiedInverseJoinColumn(0).setSpecifiedName("FOO");
- joinTable.addSpecifiedInverseJoinColumn(1).setSpecifiedName("BAR");
- joinTable.addSpecifiedInverseJoinColumn(2).setSpecifiedName("BAZ");
-
- JoinTableAnnotation joinTableResource = (JoinTableAnnotation) attributeResource.getSupportingAnnotation(JoinTableAnnotation.ANNOTATION_NAME);
- assertEquals(3, joinTableResource.inverseJoinColumnsSize());
-
- joinTable.removeSpecifiedInverseJoinColumn(0);
- assertEquals(2, joinTableResource.inverseJoinColumnsSize());
- assertEquals("BAR", joinTableResource.inverseJoinColumnAt(0).getName());
- assertEquals("BAZ", joinTableResource.inverseJoinColumnAt(1).getName());
-
- joinTable.removeSpecifiedInverseJoinColumn(0);
- assertEquals(1, joinTableResource.inverseJoinColumnsSize());
- assertEquals("BAZ", joinTableResource.inverseJoinColumnAt(0).getName());
-
- joinTable.removeSpecifiedInverseJoinColumn(0);
- assertEquals(0, joinTableResource.inverseJoinColumnsSize());
- }
-
- public void testMoveSpecifiedInverseJoinColumn() throws Exception {
- createTestEntityWithManyToMany();
- addXmlClassRef(FULLY_QUALIFIED_TYPE_NAME);
-
- JavaManyToManyMapping manyToManyMapping = (JavaManyToManyMapping) getJavaPersistentType().attributes().next().getMapping();
- JoinTable joinTable = manyToManyMapping.getRelationshipReference().getJoinTableJoiningStrategy().getJoinTable();
-
- JavaResourcePersistentType typeResource = getJpaProject().getJavaResourcePersistentType(FULLY_QUALIFIED_TYPE_NAME);
- JavaResourcePersistentAttribute attributeResource = typeResource.persistableAttributes().next();
-
- joinTable.addSpecifiedInverseJoinColumn(0).setSpecifiedName("FOO");
- joinTable.addSpecifiedInverseJoinColumn(1).setSpecifiedName("BAR");
- joinTable.addSpecifiedInverseJoinColumn(2).setSpecifiedName("BAZ");
-
- JoinTableAnnotation joinTableResource = (JoinTableAnnotation) attributeResource.getSupportingAnnotation(JoinTableAnnotation.ANNOTATION_NAME);
- assertEquals(3, joinTableResource.inverseJoinColumnsSize());
-
-
- joinTable.moveSpecifiedInverseJoinColumn(2, 0);
- ListIterator<JoinColumn> inverseJoinColumns = joinTable.specifiedInverseJoinColumns();
- assertEquals("BAR", inverseJoinColumns.next().getName());
- assertEquals("BAZ", inverseJoinColumns.next().getName());
- assertEquals("FOO", inverseJoinColumns.next().getName());
-
- assertEquals("BAR", joinTableResource.inverseJoinColumnAt(0).getName());
- assertEquals("BAZ", joinTableResource.inverseJoinColumnAt(1).getName());
- assertEquals("FOO", joinTableResource.inverseJoinColumnAt(2).getName());
-
-
- joinTable.moveSpecifiedInverseJoinColumn(0, 1);
- inverseJoinColumns = joinTable.specifiedInverseJoinColumns();
- assertEquals("BAZ", inverseJoinColumns.next().getName());
- assertEquals("BAR", inverseJoinColumns.next().getName());
- assertEquals("FOO", inverseJoinColumns.next().getName());
-
- assertEquals("BAZ", joinTableResource.inverseJoinColumnAt(0).getName());
- assertEquals("BAR", joinTableResource.inverseJoinColumnAt(1).getName());
- assertEquals("FOO", joinTableResource.inverseJoinColumnAt(2).getName());
- }
-
- public void testUpdateInverseJoinColumns() throws Exception {
- createTestEntityWithManyToMany();
- addXmlClassRef(FULLY_QUALIFIED_TYPE_NAME);
-
- JavaManyToManyMapping manyToManyMapping = (JavaManyToManyMapping) getJavaPersistentType().attributes().next().getMapping();
- JoinTable joinTable = manyToManyMapping.getRelationshipReference().getJoinTableJoiningStrategy().getJoinTable();
-
- JavaResourcePersistentType typeResource = getJpaProject().getJavaResourcePersistentType(FULLY_QUALIFIED_TYPE_NAME);
- JavaResourcePersistentAttribute attributeResource = typeResource.persistableAttributes().next();
-
- JoinTableAnnotation joinTableResource = (JoinTableAnnotation) attributeResource.addSupportingAnnotation(JoinTableAnnotation.ANNOTATION_NAME);
-
- joinTableResource.addInverseJoinColumn(0);
- joinTableResource.addInverseJoinColumn(1);
- joinTableResource.addInverseJoinColumn(2);
-
- joinTableResource.inverseJoinColumnAt(0).setName("FOO");
- joinTableResource.inverseJoinColumnAt(1).setName("BAR");
- joinTableResource.inverseJoinColumnAt(2).setName("BAZ");
-
- ListIterator<JoinColumn> inverseJoinColumns = joinTable.specifiedInverseJoinColumns();
- assertEquals("FOO", inverseJoinColumns.next().getName());
- assertEquals("BAR", inverseJoinColumns.next().getName());
- assertEquals("BAZ", inverseJoinColumns.next().getName());
- assertFalse(inverseJoinColumns.hasNext());
-
- joinTableResource.moveInverseJoinColumn(2, 0);
- inverseJoinColumns = joinTable.specifiedInverseJoinColumns();
- assertEquals("BAR", inverseJoinColumns.next().getName());
- assertEquals("BAZ", inverseJoinColumns.next().getName());
- assertEquals("FOO", inverseJoinColumns.next().getName());
- assertFalse(inverseJoinColumns.hasNext());
-
- joinTableResource.moveInverseJoinColumn(0, 1);
- inverseJoinColumns = joinTable.specifiedInverseJoinColumns();
- assertEquals("BAZ", inverseJoinColumns.next().getName());
- assertEquals("BAR", inverseJoinColumns.next().getName());
- assertEquals("FOO", inverseJoinColumns.next().getName());
- assertFalse(inverseJoinColumns.hasNext());
-
- joinTableResource.removeInverseJoinColumn(1);
- inverseJoinColumns = joinTable.specifiedInverseJoinColumns();
- assertEquals("BAZ", inverseJoinColumns.next().getName());
- assertEquals("FOO", inverseJoinColumns.next().getName());
- assertFalse(inverseJoinColumns.hasNext());
-
- joinTableResource.removeInverseJoinColumn(1);
- inverseJoinColumns = joinTable.specifiedInverseJoinColumns();
- assertEquals("BAZ", inverseJoinColumns.next().getName());
- assertFalse(inverseJoinColumns.hasNext());
-
- joinTableResource.removeInverseJoinColumn(0);
- assertFalse(joinTable.specifiedInverseJoinColumns().hasNext());
- }
-
- public void testGetDefaultInverseJoinColumn() {
- //TODO
- }
-
- public void testSpecifiedInverseJoinColumnsSize() throws Exception {
- createTestEntityWithManyToMany();
- addXmlClassRef(FULLY_QUALIFIED_TYPE_NAME);
-
- JavaManyToManyMapping manyToManyMapping = (JavaManyToManyMapping) getJavaPersistentType().attributes().next().getMapping();
- JoinTable joinTable = manyToManyMapping.getRelationshipReference().getJoinTableJoiningStrategy().getJoinTable();
-
- assertEquals(0, joinTable.specifiedInverseJoinColumnsSize());
-
- joinTable.addSpecifiedInverseJoinColumn(0);
- assertEquals(1, joinTable.specifiedInverseJoinColumnsSize());
-
- joinTable.removeSpecifiedInverseJoinColumn(0);
- assertEquals(0, joinTable.specifiedInverseJoinColumnsSize());
- }
-
- public void testInverseJoinColumnsSize() throws Exception {
- createTestEntityWithManyToMany();
- addXmlClassRef(FULLY_QUALIFIED_TYPE_NAME);
-
- JavaManyToManyMapping manyToManyMapping = (JavaManyToManyMapping) getJavaPersistentType().attributes().next().getMapping();
- JoinTable joinTable = manyToManyMapping.getRelationshipReference().getJoinTableJoiningStrategy().getJoinTable();
-
- assertEquals(1, joinTable.inverseJoinColumnsSize());
-
- joinTable.addSpecifiedInverseJoinColumn(0);
- assertEquals(1, joinTable.inverseJoinColumnsSize());
-
- joinTable.addSpecifiedInverseJoinColumn(0);
- assertEquals(2, joinTable.inverseJoinColumnsSize());
-
- joinTable.removeSpecifiedInverseJoinColumn(0);
- joinTable.removeSpecifiedInverseJoinColumn(0);
- assertEquals(1, joinTable.inverseJoinColumnsSize());
-
- //if non-owning side of the relationship then no default join table
- manyToManyMapping.getRelationshipReference().getMappedByJoiningStrategy().setMappedByAttribute("foo");
- assertNull(manyToManyMapping.getRelationshipReference().getJoinTableJoiningStrategy().getJoinTable());
- }
-
- public void testUniqueConstraints() throws Exception {
- createTestEntityWithManyToMany();
- addXmlClassRef(FULLY_QUALIFIED_TYPE_NAME);
-
- JavaManyToManyMapping manyToManyMapping = (JavaManyToManyMapping) getJavaPersistentType().attributes().next().getMapping();
- JoinTable joinTable = manyToManyMapping.getRelationshipReference().getJoinTableJoiningStrategy().getJoinTable();
-
- ListIterator<JavaUniqueConstraint> uniqueConstraints = joinTable.uniqueConstraints();
- assertFalse(uniqueConstraints.hasNext());
-
- JavaResourcePersistentType typeResource = getJpaProject().getJavaResourcePersistentType(FULLY_QUALIFIED_TYPE_NAME);
- JavaResourcePersistentAttribute attributeResource = typeResource.persistableAttributes().next();
- JoinTableAnnotation joinTableAnnotation = (JoinTableAnnotation) attributeResource.addSupportingAnnotation(JoinTableAnnotation.ANNOTATION_NAME);
- joinTableAnnotation.addUniqueConstraint(0).addColumnName(0, "foo");
- joinTableAnnotation.addUniqueConstraint(0).addColumnName(0, "bar");
-
- uniqueConstraints = joinTable.uniqueConstraints();
- assertTrue(uniqueConstraints.hasNext());
- assertEquals("bar", uniqueConstraints.next().columnNames().next());
- assertEquals("foo", uniqueConstraints.next().columnNames().next());
- assertFalse(uniqueConstraints.hasNext());
- }
-
- public void testUniqueConstraintsSize() throws Exception {
- createTestEntityWithManyToMany();
- addXmlClassRef(FULLY_QUALIFIED_TYPE_NAME);
-
- JavaManyToManyMapping manyToManyMapping = (JavaManyToManyMapping) getJavaPersistentType().attributes().next().getMapping();
- JoinTable joinTable = manyToManyMapping.getRelationshipReference().getJoinTableJoiningStrategy().getJoinTable();
-
- assertEquals(0, joinTable.uniqueConstraintsSize());
-
- JavaResourcePersistentType typeResource = getJpaProject().getJavaResourcePersistentType(FULLY_QUALIFIED_TYPE_NAME);
- JavaResourcePersistentAttribute attributeResource = typeResource.persistableAttributes().next();
- JoinTableAnnotation joinTableAnnotation = (JoinTableAnnotation) attributeResource.addSupportingAnnotation(JoinTableAnnotation.ANNOTATION_NAME);
- joinTableAnnotation.addUniqueConstraint(0).addColumnName(0, "foo");
- joinTableAnnotation.addUniqueConstraint(1).addColumnName(0, "bar");
-
- assertEquals(2, joinTable.uniqueConstraintsSize());
- }
-
- public void testAddUniqueConstraint() throws Exception {
- createTestEntityWithManyToMany();
- addXmlClassRef(FULLY_QUALIFIED_TYPE_NAME);
-
- JavaManyToManyMapping manyToManyMapping = (JavaManyToManyMapping) getJavaPersistentType().attributes().next().getMapping();
- JoinTable joinTable = manyToManyMapping.getRelationshipReference().getJoinTableJoiningStrategy().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.getSupportingAnnotation(JoinTableAnnotation.ANNOTATION_NAME);
- ListIterator<UniqueConstraintAnnotation> uniqueConstraints = joinTableAnnotation.uniqueConstraints();
-
- assertEquals("BAZ", uniqueConstraints.next().columnNames().next());
- assertEquals("BAR", uniqueConstraints.next().columnNames().next());
- assertEquals("FOO", uniqueConstraints.next().columnNames().next());
- assertFalse(uniqueConstraints.hasNext());
- }
-
- public void testAddUniqueConstraint2() throws Exception {
- createTestEntityWithManyToMany();
- addXmlClassRef(FULLY_QUALIFIED_TYPE_NAME);
-
- JavaManyToManyMapping manyToManyMapping = (JavaManyToManyMapping) getJavaPersistentType().attributes().next().getMapping();
- JoinTable joinTable = manyToManyMapping.getRelationshipReference().getJoinTableJoiningStrategy().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.getSupportingAnnotation(JoinTableAnnotation.ANNOTATION_NAME);
- ListIterator<UniqueConstraintAnnotation> uniqueConstraints = joinTableAnnotation.uniqueConstraints();
-
- assertEquals("BAZ", uniqueConstraints.next().columnNames().next());
- assertEquals("FOO", uniqueConstraints.next().columnNames().next());
- assertEquals("BAR", uniqueConstraints.next().columnNames().next());
- assertFalse(uniqueConstraints.hasNext());
- }
-
- public void testRemoveUniqueConstraint() throws Exception {
- createTestEntityWithManyToMany();
- addXmlClassRef(FULLY_QUALIFIED_TYPE_NAME);
-
- JavaManyToManyMapping manyToManyMapping = (JavaManyToManyMapping) getJavaPersistentType().attributes().next().getMapping();
- JoinTable joinTable = manyToManyMapping.getRelationshipReference().getJoinTableJoiningStrategy().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.getSupportingAnnotation(JoinTableAnnotation.ANNOTATION_NAME);
-
- assertEquals(3, joinTableAnnotation.uniqueConstraintsSize());
-
- joinTable.removeUniqueConstraint(1);
-
- ListIterator<UniqueConstraintAnnotation> uniqueConstraintAnnotations = joinTableAnnotation.uniqueConstraints();
- assertEquals("FOO", uniqueConstraintAnnotations.next().columnNames().next());
- assertEquals("BAZ", uniqueConstraintAnnotations.next().columnNames().next());
- assertFalse(uniqueConstraintAnnotations.hasNext());
-
- Iterator<UniqueConstraint> uniqueConstraints = joinTable.uniqueConstraints();
- assertEquals("FOO", uniqueConstraints.next().columnNames().next());
- assertEquals("BAZ", uniqueConstraints.next().columnNames().next());
- assertFalse(uniqueConstraints.hasNext());
-
-
- joinTable.removeUniqueConstraint(1);
- uniqueConstraintAnnotations = joinTableAnnotation.uniqueConstraints();
- assertEquals("FOO", uniqueConstraintAnnotations.next().columnNames().next());
- assertFalse(uniqueConstraintAnnotations.hasNext());
-
- uniqueConstraints = joinTable.uniqueConstraints();
- assertEquals("FOO", uniqueConstraints.next().columnNames().next());
- assertFalse(uniqueConstraints.hasNext());
-
-
- joinTable.removeUniqueConstraint(0);
- uniqueConstraintAnnotations = joinTableAnnotation.uniqueConstraints();
- assertFalse(uniqueConstraintAnnotations.hasNext());
- uniqueConstraints = joinTable.uniqueConstraints();
- assertFalse(uniqueConstraints.hasNext());
- }
-
- public void testMoveUniqueConstraint() throws Exception {
- createTestEntityWithManyToMany();
- addXmlClassRef(FULLY_QUALIFIED_TYPE_NAME);
-
- JavaManyToManyMapping manyToManyMapping = (JavaManyToManyMapping) getJavaPersistentType().attributes().next().getMapping();
- JoinTable joinTable = manyToManyMapping.getRelationshipReference().getJoinTableJoiningStrategy().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.getSupportingAnnotation(JoinTableAnnotation.ANNOTATION_NAME);
-
- assertEquals(3, joinTableAnnotation.uniqueConstraintsSize());
-
-
- joinTable.moveUniqueConstraint(2, 0);
- ListIterator<UniqueConstraint> uniqueConstraints = joinTable.uniqueConstraints();
- assertEquals("BAR", uniqueConstraints.next().columnNames().next());
- assertEquals("BAZ", uniqueConstraints.next().columnNames().next());
- assertEquals("FOO", uniqueConstraints.next().columnNames().next());
-
- ListIterator<UniqueConstraintAnnotation> uniqueConstraintAnnotations = joinTableAnnotation.uniqueConstraints();
- assertEquals("BAR", uniqueConstraintAnnotations.next().columnNames().next());
- assertEquals("BAZ", uniqueConstraintAnnotations.next().columnNames().next());
- assertEquals("FOO", uniqueConstraintAnnotations.next().columnNames().next());
-
-
- joinTable.moveUniqueConstraint(0, 1);
- uniqueConstraints = joinTable.uniqueConstraints();
- assertEquals("BAZ", uniqueConstraints.next().columnNames().next());
- assertEquals("BAR", uniqueConstraints.next().columnNames().next());
- assertEquals("FOO", uniqueConstraints.next().columnNames().next());
-
- uniqueConstraintAnnotations = joinTableAnnotation.uniqueConstraints();
- assertEquals("BAZ", uniqueConstraintAnnotations.next().columnNames().next());
- assertEquals("BAR", uniqueConstraintAnnotations.next().columnNames().next());
- assertEquals("FOO", uniqueConstraintAnnotations.next().columnNames().next());
- }
-
- public void testUpdateUniqueConstraints() throws Exception {
- createTestEntityWithManyToMany();
- addXmlClassRef(FULLY_QUALIFIED_TYPE_NAME);
-
- JavaManyToManyMapping manyToManyMapping = (JavaManyToManyMapping) getJavaPersistentType().attributes().next().getMapping();
- JoinTable joinTable = manyToManyMapping.getRelationshipReference().getJoinTableJoiningStrategy().getJoinTable();
- JavaResourcePersistentType typeResource = getJpaProject().getJavaResourcePersistentType(FULLY_QUALIFIED_TYPE_NAME);
- JavaResourcePersistentAttribute attributeResource = typeResource.persistableAttributes().next();
- JoinTableAnnotation joinTableAnnotation = (JoinTableAnnotation) attributeResource.addSupportingAnnotation(JoinTableAnnotation.ANNOTATION_NAME);
-
- joinTableAnnotation.addUniqueConstraint(0).addColumnName("FOO");
- joinTableAnnotation.addUniqueConstraint(1).addColumnName("BAR");
- joinTableAnnotation.addUniqueConstraint(2).addColumnName("BAZ");
-
-
- ListIterator<UniqueConstraint> uniqueConstraints = joinTable.uniqueConstraints();
- assertEquals("FOO", uniqueConstraints.next().columnNames().next());
- assertEquals("BAR", uniqueConstraints.next().columnNames().next());
- assertEquals("BAZ", uniqueConstraints.next().columnNames().next());
- assertFalse(uniqueConstraints.hasNext());
-
- joinTableAnnotation.moveUniqueConstraint(2, 0);
- uniqueConstraints = joinTable.uniqueConstraints();
- assertEquals("BAR", uniqueConstraints.next().columnNames().next());
- assertEquals("BAZ", uniqueConstraints.next().columnNames().next());
- assertEquals("FOO", uniqueConstraints.next().columnNames().next());
- assertFalse(uniqueConstraints.hasNext());
-
- joinTableAnnotation.moveUniqueConstraint(0, 1);
- uniqueConstraints = joinTable.uniqueConstraints();
- assertEquals("BAZ", uniqueConstraints.next().columnNames().next());
- assertEquals("BAR", uniqueConstraints.next().columnNames().next());
- assertEquals("FOO", uniqueConstraints.next().columnNames().next());
- assertFalse(uniqueConstraints.hasNext());
-
- joinTableAnnotation.removeUniqueConstraint(1);
- uniqueConstraints = joinTable.uniqueConstraints();
- assertEquals("BAZ", uniqueConstraints.next().columnNames().next());
- assertEquals("FOO", uniqueConstraints.next().columnNames().next());
- assertFalse(uniqueConstraints.hasNext());
-
- joinTableAnnotation.removeUniqueConstraint(1);
- uniqueConstraints = joinTable.uniqueConstraints();
- assertEquals("BAZ", uniqueConstraints.next().columnNames().next());
- assertFalse(uniqueConstraints.hasNext());
-
- joinTableAnnotation.removeUniqueConstraint(0);
- uniqueConstraints = joinTable.uniqueConstraints();
- assertFalse(uniqueConstraints.hasNext());
- }
-} \ No newline at end of file
diff --git a/jpa/tests/org.eclipse.jpt.core.tests/src/org/eclipse/jpt/core/tests/internal/context/java/JavaManyToManyMappingTests.java b/jpa/tests/org.eclipse.jpt.core.tests/src/org/eclipse/jpt/core/tests/internal/context/java/JavaManyToManyMappingTests.java
deleted file mode 100644
index 06dfe5cd18..0000000000
--- a/jpa/tests/org.eclipse.jpt.core.tests/src/org/eclipse/jpt/core/tests/internal/context/java/JavaManyToManyMappingTests.java
+++ /dev/null
@@ -1,966 +0,0 @@
-/*******************************************************************************
- * Copyright (c) 2007, 2008 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.
- *
- * Contributors:
- * Oracle - initial API and implementation
- ******************************************************************************/
-package org.eclipse.jpt.core.tests.internal.context.java;
-
-import java.util.Iterator;
-import java.util.ListIterator;
-import org.eclipse.jdt.core.ICompilationUnit;
-import org.eclipse.jpt.core.MappingKeys;
-import org.eclipse.jpt.core.context.BasicMapping;
-import org.eclipse.jpt.core.context.EmbeddedIdMapping;
-import org.eclipse.jpt.core.context.EmbeddedMapping;
-import org.eclipse.jpt.core.context.FetchType;
-import org.eclipse.jpt.core.context.IdMapping;
-import org.eclipse.jpt.core.context.ManyToManyMapping;
-import org.eclipse.jpt.core.context.ManyToOneMapping;
-import org.eclipse.jpt.core.context.OneToManyMapping;
-import org.eclipse.jpt.core.context.OneToOneMapping;
-import org.eclipse.jpt.core.context.PersistentAttribute;
-import org.eclipse.jpt.core.context.TransientMapping;
-import org.eclipse.jpt.core.context.TypeMapping;
-import org.eclipse.jpt.core.context.VersionMapping;
-import org.eclipse.jpt.core.context.java.JavaPersistentType;
-import org.eclipse.jpt.core.context.persistence.ClassRef;
-import org.eclipse.jpt.core.resource.java.BasicAnnotation;
-import org.eclipse.jpt.core.resource.java.EmbeddedAnnotation;
-import org.eclipse.jpt.core.resource.java.EmbeddedIdAnnotation;
-import org.eclipse.jpt.core.resource.java.IdAnnotation;
-import org.eclipse.jpt.core.resource.java.JPA;
-import org.eclipse.jpt.core.resource.java.JavaResourcePersistentAttribute;
-import org.eclipse.jpt.core.resource.java.JavaResourcePersistentType;
-import org.eclipse.jpt.core.resource.java.JoinTableAnnotation;
-import org.eclipse.jpt.core.resource.java.ManyToManyAnnotation;
-import org.eclipse.jpt.core.resource.java.ManyToOneAnnotation;
-import org.eclipse.jpt.core.resource.java.MapKeyAnnotation;
-import org.eclipse.jpt.core.resource.java.OneToManyAnnotation;
-import org.eclipse.jpt.core.resource.java.OneToOneAnnotation;
-import org.eclipse.jpt.core.resource.java.OrderByAnnotation;
-import org.eclipse.jpt.core.resource.java.TransientAnnotation;
-import org.eclipse.jpt.core.resource.java.VersionAnnotation;
-import org.eclipse.jpt.core.tests.internal.context.ContextModelTestCase;
-import org.eclipse.jpt.core.tests.internal.projects.TestJavaProject.SourceWriter;
-import org.eclipse.jpt.utility.internal.iterators.ArrayIterator;
-
-@SuppressWarnings("nls")
-public class JavaManyToManyMappingTests extends ContextModelTestCase
-{
-
- private void createTestTargetEntityAddress() throws Exception {
- SourceWriter sourceWriter = new SourceWriter() {
- public void appendSourceTo(StringBuilder sb) {
- sb.append(CR);
- sb.append("import ");
- sb.append(JPA.ENTITY);
- sb.append(";");
- sb.append(CR);
- sb.append("import ");
- sb.append(JPA.ID);
- sb.append(";");
- sb.append(CR);
- sb.append("@Entity");
- sb.append(CR);
- sb.append("public class ").append("Address").append(" ");
- sb.append("{").append(CR);
- sb.append(CR);
- sb.append(" @Id").append(CR);
- sb.append(" private int id;").append(CR);
- sb.append(CR);
- sb.append(" private String city;").append(CR);
- sb.append(CR);
- sb.append(" private String state;").append(CR);
- sb.append(CR);
- sb.append(" private int zip;").append(CR);
- sb.append(CR);
- sb.append("}").append(CR);
- }
- };
- this.javaProject.createCompilationUnit(PACKAGE_NAME, "Address.java", sourceWriter);
- }
-
- private ICompilationUnit createTestEntityWithManyToManyMapping() throws Exception {
- return this.createTestType(new DefaultAnnotationWriter() {
- @Override
- public Iterator<String> imports() {
- return new ArrayIterator<String>(JPA.ENTITY, JPA.MANY_TO_MANY);
- }
- @Override
- public void appendTypeAnnotationTo(StringBuilder sb) {
- sb.append("@Entity").append(CR);
- }
-
- @Override
- public void appendIdFieldAnnotationTo(StringBuilder sb) {
- sb.append("@ManyToMany").append(CR);
- }
- });
- }
-
- private ICompilationUnit createTestEntityWithValidManyToManyMapping() throws Exception {
- return this.createTestType(new DefaultAnnotationWriter() {
- @Override
- public Iterator<String> imports() {
- return new ArrayIterator<String>(JPA.ENTITY, JPA.MANY_TO_MANY, JPA.ID, "java.util.Collection");
- }
- @Override
- public void appendTypeAnnotationTo(StringBuilder sb) {
- sb.append("@Entity").append(CR);
- }
-
- @Override
- public void appendIdFieldAnnotationTo(StringBuilder sb) {
- sb.append(CR);
- sb.append(" @ManyToMany").append(CR);
- sb.append(" private Collection<Address> addresses;").append(CR);
- sb.append(CR);
- sb.append(" @Id").append(CR);
- }
- });
- }
- private ICompilationUnit createTestEntityWithCollectionManyToManyMapping() throws Exception {
- return this.createTestType(new DefaultAnnotationWriter() {
- @Override
- public Iterator<String> imports() {
- return new ArrayIterator<String>(JPA.ENTITY, JPA.MANY_TO_MANY, JPA.ID, "java.util.Collection");
- }
- @Override
- public void appendTypeAnnotationTo(StringBuilder sb) {
- sb.append("@Entity").append(CR);
- }
-
- @Override
- public void appendIdFieldAnnotationTo(StringBuilder sb) {
- sb.append(CR);
- sb.append(" @ManyToMany").append(CR);
- sb.append(" private Collection addresses;").append(CR);
- sb.append(CR);
- sb.append(" @Id").append(CR);
- }
- });
- }
- private ICompilationUnit createTestEntityWithNonCollectionManyToManyMapping() throws Exception {
- return this.createTestType(new DefaultAnnotationWriter() {
- @Override
- public Iterator<String> imports() {
- return new ArrayIterator<String>(JPA.ENTITY, JPA.MANY_TO_MANY, JPA.ID);
- }
- @Override
- public void appendTypeAnnotationTo(StringBuilder sb) {
- sb.append("@Entity").append(CR);
- }
-
- @Override
- public void appendIdFieldAnnotationTo(StringBuilder sb) {
- sb.append(CR);
- sb.append(" @ManyToMany").append(CR);
- sb.append(" private Address addresses;").append(CR);
- sb.append(CR);
- sb.append(" @Id").append(CR);
- }
- });
- }
-
- private void createTestDepartment() throws Exception {
- SourceWriter sourceWriter = new SourceWriter() {
- public void appendSourceTo(StringBuilder sb) {
- sb.append(CR);
- sb.append("import ").append(JPA.ENTITY).append(";");
- sb.append(CR);
- sb.append("import ").append(JPA.ID).append(";");
- sb.append(CR);
- sb.append("import java.util.Map;");
- sb.append(CR);
- sb.append("import ").append(JPA.MANY_TO_MANY).append(";");
- sb.append("@Entity");
- sb.append(CR);
- sb.append("public class ").append("Department").append(" ");
- sb.append("{").append(CR);
- sb.append(CR);
- sb.append(" @Id").append(CR);
- sb.append(" private int id;").append(CR);
- sb.append(CR);
- sb.append(" @ManyToMany").append(CR);
- sb.append(" private Map<Integer, Employee> employees;").append(CR);
- sb.append(CR);
- sb.append("}").append(CR);
- }
- };
- this.javaProject.createCompilationUnit(PACKAGE_NAME, "Department.java", sourceWriter);
- }
-
- private void createTestEmployee() throws Exception {
- SourceWriter sourceWriter = new SourceWriter() {
- public void appendSourceTo(StringBuilder sb) {
- sb.append(CR);
- sb.append("import ").append(JPA.ENTITY).append(";");
- sb.append(CR);
- sb.append("import ").append(JPA.ID).append(";");
- sb.append(CR);
- sb.append("@Entity");
- sb.append(CR);
- sb.append("public class ").append("Employee").append(" ");
- sb.append("{").append(CR);
- sb.append(CR);
- sb.append(" @Id").append(CR);
- sb.append(" private int empId;").append(CR);
- sb.append(CR);
- sb.append("}").append(CR);
- }
- };
- this.javaProject.createCompilationUnit(PACKAGE_NAME, "Employee.java", sourceWriter);
- }
-
- public JavaManyToManyMappingTests(String name) {
- super(name);
- }
-
- public void testMorphToBasicMapping() throws Exception {
- createTestEntityWithManyToManyMapping();
- addXmlClassRef(FULLY_QUALIFIED_TYPE_NAME);
-
- PersistentAttribute persistentAttribute = getJavaPersistentType().attributes().next();
- ManyToManyMapping manyToManyMapping = (ManyToManyMapping) persistentAttribute.getMapping();
- manyToManyMapping.setOrderBy("asdf");
- manyToManyMapping.getRelationshipReference().getJoinTableJoiningStrategy().getJoinTable().setSpecifiedName("FOO");
- assertFalse(manyToManyMapping.isDefault());
-
- persistentAttribute.setSpecifiedMappingKey(MappingKeys.BASIC_ATTRIBUTE_MAPPING_KEY);
- assertTrue(persistentAttribute.getMapping() instanceof BasicMapping);
- assertFalse(persistentAttribute.getMapping().isDefault());
-
- JavaResourcePersistentType typeResource = getJpaProject().getJavaResourcePersistentType(FULLY_QUALIFIED_TYPE_NAME);
- JavaResourcePersistentAttribute attributeResource = typeResource.persistableAttributes().next();
- assertNull(attributeResource.getMappingAnnotation(ManyToManyAnnotation.ANNOTATION_NAME));
- assertNotNull(attributeResource.getMappingAnnotation(BasicAnnotation.ANNOTATION_NAME));
- assertNull(attributeResource.getSupportingAnnotation(JoinTableAnnotation.ANNOTATION_NAME));
- assertNull(attributeResource.getSupportingAnnotation(OrderByAnnotation.ANNOTATION_NAME));
- }
-
- public void testMorphToDefault() throws Exception {
- createTestEntityWithManyToManyMapping();
- addXmlClassRef(FULLY_QUALIFIED_TYPE_NAME);
-
- PersistentAttribute persistentAttribute = getJavaPersistentType().attributes().next();
- ManyToManyMapping manyToManyMapping = (ManyToManyMapping) persistentAttribute.getMapping();
- manyToManyMapping.setOrderBy("asdf");
- manyToManyMapping.getRelationshipReference().getJoinTableJoiningStrategy().getJoinTable().setSpecifiedName("FOO");
- assertFalse(manyToManyMapping.isDefault());
-
- persistentAttribute.setSpecifiedMappingKey(MappingKeys.NULL_ATTRIBUTE_MAPPING_KEY);
- assertNull(persistentAttribute.getSpecifiedMapping());
- assertTrue(persistentAttribute.getMapping().isDefault());
-
- JavaResourcePersistentType typeResource = getJpaProject().getJavaResourcePersistentType(FULLY_QUALIFIED_TYPE_NAME);
- JavaResourcePersistentAttribute attributeResource = typeResource.persistableAttributes().next();
- assertNull(attributeResource.getMappingAnnotation(ManyToManyAnnotation.ANNOTATION_NAME));
- assertNull(attributeResource.getSupportingAnnotation(JoinTableAnnotation.ANNOTATION_NAME));
- assertNull(attributeResource.getSupportingAnnotation(OrderByAnnotation.ANNOTATION_NAME));
- }
-
- public void testMorphToVersionMapping() throws Exception {
- createTestEntityWithManyToManyMapping();
- addXmlClassRef(FULLY_QUALIFIED_TYPE_NAME);
-
- PersistentAttribute persistentAttribute = getJavaPersistentType().attributes().next();
- ManyToManyMapping manyToManyMapping = (ManyToManyMapping) persistentAttribute.getMapping();
- manyToManyMapping.setOrderBy("asdf");
- manyToManyMapping.getRelationshipReference().getJoinTableJoiningStrategy().getJoinTable().setSpecifiedName("FOO");
- assertFalse(manyToManyMapping.isDefault());
-
- persistentAttribute.setSpecifiedMappingKey(MappingKeys.VERSION_ATTRIBUTE_MAPPING_KEY);
- assertTrue(persistentAttribute.getMapping() instanceof VersionMapping);
- assertFalse(persistentAttribute.getMapping().isDefault());
-
- JavaResourcePersistentType typeResource = getJpaProject().getJavaResourcePersistentType(FULLY_QUALIFIED_TYPE_NAME);
- JavaResourcePersistentAttribute attributeResource = typeResource.persistableAttributes().next();
- assertNull(attributeResource.getMappingAnnotation(ManyToManyAnnotation.ANNOTATION_NAME));
- assertNotNull(attributeResource.getMappingAnnotation(VersionAnnotation.ANNOTATION_NAME));
- assertNull(attributeResource.getSupportingAnnotation(JoinTableAnnotation.ANNOTATION_NAME));
- assertNull(attributeResource.getSupportingAnnotation(OrderByAnnotation.ANNOTATION_NAME));
- }
-
- public void testMorphToIdMapping() throws Exception {
- createTestEntityWithManyToManyMapping();
- addXmlClassRef(FULLY_QUALIFIED_TYPE_NAME);
-
- PersistentAttribute persistentAttribute = getJavaPersistentType().attributes().next();
- ManyToManyMapping manyToManyMapping = (ManyToManyMapping) persistentAttribute.getMapping();
- manyToManyMapping.setOrderBy("asdf");
- manyToManyMapping.getRelationshipReference().getJoinTableJoiningStrategy().getJoinTable().setSpecifiedName("FOO");
- assertFalse(manyToManyMapping.isDefault());
-
- persistentAttribute.setSpecifiedMappingKey(MappingKeys.ID_ATTRIBUTE_MAPPING_KEY);
- assertTrue(persistentAttribute.getMapping() instanceof IdMapping);
- assertFalse(persistentAttribute.getMapping().isDefault());
-
- JavaResourcePersistentType typeResource = getJpaProject().getJavaResourcePersistentType(FULLY_QUALIFIED_TYPE_NAME);
- JavaResourcePersistentAttribute attributeResource = typeResource.persistableAttributes().next();
- assertNull(attributeResource.getMappingAnnotation(ManyToManyAnnotation.ANNOTATION_NAME));
- assertNotNull(attributeResource.getMappingAnnotation(IdAnnotation.ANNOTATION_NAME));
- assertNull(attributeResource.getSupportingAnnotation(JoinTableAnnotation.ANNOTATION_NAME));
- assertNull(attributeResource.getSupportingAnnotation(OrderByAnnotation.ANNOTATION_NAME));
- }
-
- public void testMorphToEmbeddedMapping() throws Exception {
- createTestEntityWithManyToManyMapping();
- addXmlClassRef(FULLY_QUALIFIED_TYPE_NAME);
-
- PersistentAttribute persistentAttribute = getJavaPersistentType().attributes().next();
- ManyToManyMapping manyToManyMapping = (ManyToManyMapping) persistentAttribute.getMapping();
- manyToManyMapping.setOrderBy("asdf");
- manyToManyMapping.getRelationshipReference().getJoinTableJoiningStrategy().getJoinTable().setSpecifiedName("FOO");
- assertFalse(manyToManyMapping.isDefault());
-
- persistentAttribute.setSpecifiedMappingKey(MappingKeys.EMBEDDED_ATTRIBUTE_MAPPING_KEY);
- assertTrue(persistentAttribute.getMapping() instanceof EmbeddedMapping);
- assertFalse(persistentAttribute.getMapping().isDefault());
-
- JavaResourcePersistentType typeResource = getJpaProject().getJavaResourcePersistentType(FULLY_QUALIFIED_TYPE_NAME);
- JavaResourcePersistentAttribute attributeResource = typeResource.persistableAttributes().next();
- assertNull(attributeResource.getMappingAnnotation(ManyToManyAnnotation.ANNOTATION_NAME));
- assertNotNull(attributeResource.getMappingAnnotation(EmbeddedAnnotation.ANNOTATION_NAME));
- assertNull(attributeResource.getSupportingAnnotation(JoinTableAnnotation.ANNOTATION_NAME));
- assertNull(attributeResource.getSupportingAnnotation(OrderByAnnotation.ANNOTATION_NAME));
- }
-
- public void testMorphToEmbeddedIdMapping() throws Exception {
- createTestEntityWithManyToManyMapping();
- addXmlClassRef(FULLY_QUALIFIED_TYPE_NAME);
-
- PersistentAttribute persistentAttribute = getJavaPersistentType().attributes().next();
- ManyToManyMapping manyToManyMapping = (ManyToManyMapping) persistentAttribute.getMapping();
- manyToManyMapping.setOrderBy("asdf");
- manyToManyMapping.getRelationshipReference().getJoinTableJoiningStrategy().getJoinTable().setSpecifiedName("FOO");
- assertFalse(manyToManyMapping.isDefault());
-
- persistentAttribute.setSpecifiedMappingKey(MappingKeys.EMBEDDED_ID_ATTRIBUTE_MAPPING_KEY);
- assertTrue(persistentAttribute.getMapping() instanceof EmbeddedIdMapping);
- assertFalse(persistentAttribute.getMapping().isDefault());
-
- JavaResourcePersistentType typeResource = getJpaProject().getJavaResourcePersistentType(FULLY_QUALIFIED_TYPE_NAME);
- JavaResourcePersistentAttribute attributeResource = typeResource.persistableAttributes().next();
- assertNull(attributeResource.getMappingAnnotation(ManyToManyAnnotation.ANNOTATION_NAME));
- assertNotNull(attributeResource.getMappingAnnotation(EmbeddedIdAnnotation.ANNOTATION_NAME));
- assertNull(attributeResource.getSupportingAnnotation(JoinTableAnnotation.ANNOTATION_NAME));
- assertNull(attributeResource.getSupportingAnnotation(OrderByAnnotation.ANNOTATION_NAME));
- }
-
- public void testMorphToTransientMapping() throws Exception {
- createTestEntityWithManyToManyMapping();
- addXmlClassRef(FULLY_QUALIFIED_TYPE_NAME);
-
- PersistentAttribute persistentAttribute = getJavaPersistentType().attributes().next();
- ManyToManyMapping manyToManyMapping = (ManyToManyMapping) persistentAttribute.getMapping();
- manyToManyMapping.setOrderBy("asdf");
- manyToManyMapping.getRelationshipReference().getJoinTableJoiningStrategy().getJoinTable().setSpecifiedName("FOO");
- assertFalse(manyToManyMapping.isDefault());
-
- persistentAttribute.setSpecifiedMappingKey(MappingKeys.TRANSIENT_ATTRIBUTE_MAPPING_KEY);
- assertTrue(persistentAttribute.getMapping() instanceof TransientMapping);
- assertFalse(persistentAttribute.getMapping().isDefault());
-
- JavaResourcePersistentType typeResource = getJpaProject().getJavaResourcePersistentType(FULLY_QUALIFIED_TYPE_NAME);
- JavaResourcePersistentAttribute attributeResource = typeResource.persistableAttributes().next();
- assertNull(attributeResource.getMappingAnnotation(ManyToManyAnnotation.ANNOTATION_NAME));
- assertNotNull(attributeResource.getMappingAnnotation(TransientAnnotation.ANNOTATION_NAME));
- assertNull(attributeResource.getSupportingAnnotation(JoinTableAnnotation.ANNOTATION_NAME));
- assertNull(attributeResource.getSupportingAnnotation(OrderByAnnotation.ANNOTATION_NAME));
- }
-
- public void testMorphToOneToOneMapping() throws Exception {
- createTestEntityWithManyToManyMapping();
- addXmlClassRef(FULLY_QUALIFIED_TYPE_NAME);
-
- PersistentAttribute persistentAttribute = getJavaPersistentType().attributes().next();
- ManyToManyMapping manyToManyMapping = (ManyToManyMapping) persistentAttribute.getMapping();
- manyToManyMapping.setOrderBy("asdf");
- manyToManyMapping.getRelationshipReference().getJoinTableJoiningStrategy().getJoinTable().setSpecifiedName("FOO");
- assertFalse(manyToManyMapping.isDefault());
-
- persistentAttribute.setSpecifiedMappingKey(MappingKeys.ONE_TO_ONE_ATTRIBUTE_MAPPING_KEY);
- assertTrue(persistentAttribute.getMapping() instanceof OneToOneMapping);
- assertFalse(persistentAttribute.getMapping().isDefault());
-
- JavaResourcePersistentType typeResource = getJpaProject().getJavaResourcePersistentType(FULLY_QUALIFIED_TYPE_NAME);
- JavaResourcePersistentAttribute attributeResource = typeResource.persistableAttributes().next();
- assertNull(attributeResource.getMappingAnnotation(ManyToManyAnnotation.ANNOTATION_NAME));
- assertNotNull(attributeResource.getMappingAnnotation(OneToOneAnnotation.ANNOTATION_NAME));
- assertNotNull(attributeResource.getSupportingAnnotation(JoinTableAnnotation.ANNOTATION_NAME));
- assertNull(attributeResource.getSupportingAnnotation(OrderByAnnotation.ANNOTATION_NAME));
- }
-
- public void testMorphToOneToManyMapping() throws Exception {
- createTestEntityWithManyToManyMapping();
- addXmlClassRef(FULLY_QUALIFIED_TYPE_NAME);
-
- PersistentAttribute persistentAttribute = getJavaPersistentType().attributes().next();
- ManyToManyMapping manyToManyMapping = (ManyToManyMapping) persistentAttribute.getMapping();
- manyToManyMapping.setOrderBy("asdf");
- manyToManyMapping.getRelationshipReference().getJoinTableJoiningStrategy().getJoinTable().setSpecifiedName("FOO");
- assertFalse(manyToManyMapping.isDefault());
-
- persistentAttribute.setSpecifiedMappingKey(MappingKeys.ONE_TO_MANY_ATTRIBUTE_MAPPING_KEY);
- assertTrue(persistentAttribute.getMapping() instanceof OneToManyMapping);
- assertFalse(persistentAttribute.getMapping().isDefault());
-
- JavaResourcePersistentType typeResource = getJpaProject().getJavaResourcePersistentType(FULLY_QUALIFIED_TYPE_NAME);
- JavaResourcePersistentAttribute attributeResource = typeResource.persistableAttributes().next();
- assertNull(attributeResource.getMappingAnnotation(ManyToManyAnnotation.ANNOTATION_NAME));
- assertNotNull(attributeResource.getMappingAnnotation(OneToManyAnnotation.ANNOTATION_NAME));
- assertNotNull(attributeResource.getSupportingAnnotation(JoinTableAnnotation.ANNOTATION_NAME));
- assertNotNull(attributeResource.getSupportingAnnotation(OrderByAnnotation.ANNOTATION_NAME));
- }
-
- public void testMorphToManyToOneMapping() throws Exception {
- createTestEntityWithManyToManyMapping();
- addXmlClassRef(FULLY_QUALIFIED_TYPE_NAME);
-
- PersistentAttribute persistentAttribute = getJavaPersistentType().attributes().next();
- ManyToManyMapping manyToManyMapping = (ManyToManyMapping) persistentAttribute.getMapping();
- manyToManyMapping.setOrderBy("asdf");
- manyToManyMapping.getRelationshipReference().getJoinTableJoiningStrategy().getJoinTable().setSpecifiedName("FOO");
- assertFalse(manyToManyMapping.isDefault());
-
- persistentAttribute.setSpecifiedMappingKey(MappingKeys.MANY_TO_ONE_ATTRIBUTE_MAPPING_KEY);
- assertTrue(persistentAttribute.getMapping() instanceof ManyToOneMapping);
- assertFalse(persistentAttribute.getMapping().isDefault());
-
- JavaResourcePersistentType typeResource = getJpaProject().getJavaResourcePersistentType(FULLY_QUALIFIED_TYPE_NAME);
- JavaResourcePersistentAttribute attributeResource = typeResource.persistableAttributes().next();
- assertNull(attributeResource.getMappingAnnotation(ManyToManyAnnotation.ANNOTATION_NAME));
- assertNotNull(attributeResource.getMappingAnnotation(ManyToOneAnnotation.ANNOTATION_NAME));
- assertNotNull(attributeResource.getSupportingAnnotation(JoinTableAnnotation.ANNOTATION_NAME));
- assertNull(attributeResource.getSupportingAnnotation(OrderByAnnotation.ANNOTATION_NAME));
- }
-
- public void testUpdateSpecifiedTargetEntity() throws Exception {
- createTestEntityWithManyToManyMapping();
- addXmlClassRef(FULLY_QUALIFIED_TYPE_NAME);
-
- PersistentAttribute persistentAttribute = getJavaPersistentType().attributes().next();
- ManyToManyMapping manyToManyMapping = (ManyToManyMapping) persistentAttribute.getMapping();
-
- JavaResourcePersistentType typeResource = getJpaProject().getJavaResourcePersistentType(FULLY_QUALIFIED_TYPE_NAME);
- JavaResourcePersistentAttribute attributeResource = typeResource.persistableAttributes().next();
- ManyToManyAnnotation manyToMany = (ManyToManyAnnotation) attributeResource.getMappingAnnotation();
-
- assertNull(manyToManyMapping.getSpecifiedTargetEntity());
- assertNull(manyToMany.getTargetEntity());
-
- //set target entity in the resource model, verify context model updated
- manyToMany.setTargetEntity("newTargetEntity");
- assertEquals("newTargetEntity", manyToManyMapping.getSpecifiedTargetEntity());
- assertEquals("newTargetEntity", manyToMany.getTargetEntity());
-
- //set target entity to null in the resource model
- manyToMany.setTargetEntity(null);
- assertNull(manyToManyMapping.getSpecifiedTargetEntity());
- assertNull(manyToMany.getTargetEntity());
- }
-
- public void testModifySpecifiedTargetEntity() throws Exception {
- createTestEntityWithManyToManyMapping();
- addXmlClassRef(FULLY_QUALIFIED_TYPE_NAME);
-
- PersistentAttribute persistentAttribute = getJavaPersistentType().attributes().next();
- ManyToManyMapping manyToManyMapping = (ManyToManyMapping) persistentAttribute.getMapping();
-
- JavaResourcePersistentType typeResource = getJpaProject().getJavaResourcePersistentType(FULLY_QUALIFIED_TYPE_NAME);
- JavaResourcePersistentAttribute attributeResource = typeResource.persistableAttributes().next();
- ManyToManyAnnotation manyToMany = (ManyToManyAnnotation) attributeResource.getMappingAnnotation();
-
- assertNull(manyToManyMapping.getSpecifiedTargetEntity());
- assertNull(manyToMany.getTargetEntity());
-
- //set target entity in the context model, verify resource model updated
- manyToManyMapping.setSpecifiedTargetEntity("newTargetEntity");
- assertEquals("newTargetEntity", manyToManyMapping.getSpecifiedTargetEntity());
- assertEquals("newTargetEntity", manyToMany.getTargetEntity());
-
- //set target entity to null in the context model
- manyToManyMapping.setSpecifiedTargetEntity(null);
- assertNull(manyToManyMapping.getSpecifiedTargetEntity());
- assertNull(manyToMany.getTargetEntity());
- }
-
- public void testUpdateSpecifiedFetch() throws Exception {
- createTestEntityWithManyToManyMapping();
- addXmlClassRef(FULLY_QUALIFIED_TYPE_NAME);
-
- PersistentAttribute persistentAttribute = getJavaPersistentType().attributes().next();
- ManyToManyMapping manyToManyMapping = (ManyToManyMapping) persistentAttribute.getMapping();
-
- JavaResourcePersistentType typeResource = getJpaProject().getJavaResourcePersistentType(FULLY_QUALIFIED_TYPE_NAME);
- JavaResourcePersistentAttribute attributeResource = typeResource.persistableAttributes().next();
- ManyToManyAnnotation manyToMany = (ManyToManyAnnotation) attributeResource.getMappingAnnotation();
-
- assertNull(manyToManyMapping.getSpecifiedFetch());
- assertNull(manyToMany.getFetch());
-
- //set fetch in the resource model, verify context model updated
- manyToMany.setFetch(org.eclipse.jpt.core.resource.java.FetchType.EAGER);
- assertEquals(FetchType.EAGER, manyToManyMapping.getSpecifiedFetch());
- assertEquals(org.eclipse.jpt.core.resource.java.FetchType.EAGER, manyToMany.getFetch());
-
- manyToMany.setFetch(org.eclipse.jpt.core.resource.java.FetchType.LAZY);
- assertEquals(FetchType.LAZY, manyToManyMapping.getSpecifiedFetch());
- assertEquals(org.eclipse.jpt.core.resource.java.FetchType.LAZY, manyToMany.getFetch());
-
-
- //set fetch to null in the resource model
- manyToMany.setFetch(null);
- assertNull(manyToManyMapping.getSpecifiedFetch());
- assertNull(manyToMany.getFetch());
- }
-
- public void testModifySpecifiedFetch() throws Exception {
- createTestEntityWithManyToManyMapping();
- addXmlClassRef(FULLY_QUALIFIED_TYPE_NAME);
-
- PersistentAttribute persistentAttribute = getJavaPersistentType().attributes().next();
- ManyToManyMapping manyToManyMapping = (ManyToManyMapping) persistentAttribute.getMapping();
-
- JavaResourcePersistentType typeResource = getJpaProject().getJavaResourcePersistentType(FULLY_QUALIFIED_TYPE_NAME);
- JavaResourcePersistentAttribute attributeResource = typeResource.persistableAttributes().next();
- ManyToManyAnnotation manyToMany = (ManyToManyAnnotation) attributeResource.getMappingAnnotation();
-
- assertNull(manyToManyMapping.getSpecifiedFetch());
- assertNull(manyToMany.getFetch());
-
- //set fetch in the context model, verify resource model updated
- manyToManyMapping.setSpecifiedFetch(FetchType.EAGER);
- assertEquals(FetchType.EAGER, manyToManyMapping.getSpecifiedFetch());
- assertEquals(org.eclipse.jpt.core.resource.java.FetchType.EAGER, manyToMany.getFetch());
-
- manyToManyMapping.setSpecifiedFetch(FetchType.LAZY);
- assertEquals(FetchType.LAZY, manyToManyMapping.getSpecifiedFetch());
- assertEquals(org.eclipse.jpt.core.resource.java.FetchType.LAZY, manyToMany.getFetch());
-
-
- //set fetch to null in the context model
- manyToManyMapping.setSpecifiedFetch(null);
- assertNull(manyToManyMapping.getSpecifiedFetch());
- assertNull(manyToMany.getFetch());
- }
-
- public void testUpdateMappedBy() throws Exception {
- createTestEntityWithManyToManyMapping();
- addXmlClassRef(FULLY_QUALIFIED_TYPE_NAME);
-
- PersistentAttribute persistentAttribute = getJavaPersistentType().attributes().next();
- ManyToManyMapping manyToManyMapping = (ManyToManyMapping) persistentAttribute.getMapping();
-
- JavaResourcePersistentType typeResource = getJpaProject().getJavaResourcePersistentType(FULLY_QUALIFIED_TYPE_NAME);
- JavaResourcePersistentAttribute attributeResource = typeResource.persistableAttributes().next();
- ManyToManyAnnotation manyToMany = (ManyToManyAnnotation) attributeResource.getMappingAnnotation();
-
- assertNull(manyToManyMapping.getRelationshipReference().getMappedByJoiningStrategy().getMappedByAttribute());
- assertNull(manyToMany.getMappedBy());
-
- //set mappedByJoiningStrategy in the resource model, verify context model updated
- manyToMany.setMappedBy("newMappedBy");
- assertEquals("newMappedBy", manyToManyMapping.getRelationshipReference().getMappedByJoiningStrategy().getMappedByAttribute());
- assertEquals("newMappedBy", manyToMany.getMappedBy());
-
- //set mappedByJoiningStrategy to null in the resource model
- manyToMany.setMappedBy(null);
- assertNull(manyToManyMapping.getRelationshipReference().getMappedByJoiningStrategy().getMappedByAttribute());
- assertNull(manyToMany.getMappedBy());
- }
-
- public void testModifyMappedBy() throws Exception {
- createTestEntityWithManyToManyMapping();
- addXmlClassRef(FULLY_QUALIFIED_TYPE_NAME);
-
- PersistentAttribute persistentAttribute = getJavaPersistentType().attributes().next();
- ManyToManyMapping manyToManyMapping = (ManyToManyMapping) persistentAttribute.getMapping();
-
- JavaResourcePersistentType typeResource = getJpaProject().getJavaResourcePersistentType(FULLY_QUALIFIED_TYPE_NAME);
- JavaResourcePersistentAttribute attributeResource = typeResource.persistableAttributes().next();
- ManyToManyAnnotation manyToMany = (ManyToManyAnnotation) attributeResource.getMappingAnnotation();
-
- assertNull(manyToManyMapping.getRelationshipReference().getMappedByJoiningStrategy().getMappedByAttribute());
- assertNull(manyToMany.getMappedBy());
-
- //set mappedBy in the context model, verify resource model updated
- manyToManyMapping.getRelationshipReference().getMappedByJoiningStrategy().setMappedByAttribute("newTargetEntity");
- assertEquals("newTargetEntity", manyToManyMapping.getRelationshipReference().getMappedByJoiningStrategy().getMappedByAttribute());
- assertEquals("newTargetEntity", manyToMany.getMappedBy());
-
- //set mappedBy to null in the context model
- manyToManyMapping.getRelationshipReference().getMappedByJoiningStrategy().setMappedByAttribute(null);
- assertNull(manyToManyMapping.getRelationshipReference().getMappedByJoiningStrategy().getMappedByAttribute());
- assertNull(manyToMany.getMappedBy());
- }
-
-
- public void testCandidateMappedByAttributeNames() throws Exception {
- createTestEntityWithValidManyToManyMapping();
- createTestTargetEntityAddress();
- addXmlClassRef(FULLY_QUALIFIED_TYPE_NAME);
- addXmlClassRef(PACKAGE_NAME + ".Address");
-
- PersistentAttribute persistentAttribute = getJavaPersistentType().attributes().next();
- ManyToManyMapping manyToManyMapping = (ManyToManyMapping) persistentAttribute.getMapping();
-
- Iterator<String> attributeNames =
- manyToManyMapping.getRelationshipReference().getMappedByJoiningStrategy().candidateMappedByAttributeNames();
- assertEquals("id", attributeNames.next());
- assertEquals("city", attributeNames.next());
- assertEquals("state", attributeNames.next());
- assertEquals("zip", attributeNames.next());
- assertFalse(attributeNames.hasNext());
-
- manyToManyMapping.setSpecifiedTargetEntity("foo");
- attributeNames =
- manyToManyMapping.getRelationshipReference().getMappedByJoiningStrategy().candidateMappedByAttributeNames();
- assertFalse(attributeNames.hasNext());
-
- manyToManyMapping.setSpecifiedTargetEntity(null);
- attributeNames =
- manyToManyMapping.getRelationshipReference().getMappedByJoiningStrategy().candidateMappedByAttributeNames();
- assertEquals("id", attributeNames.next());
- assertEquals("city", attributeNames.next());
- assertEquals("state", attributeNames.next());
- assertEquals("zip", attributeNames.next());
- assertFalse(attributeNames.hasNext());
- }
-
- public void testDefaultTargetEntity() throws Exception {
- createTestEntityWithValidManyToManyMapping();
- createTestTargetEntityAddress();
- addXmlClassRef(FULLY_QUALIFIED_TYPE_NAME);
-
- PersistentAttribute persistentAttribute = getJavaPersistentType().attributes().next();
- ManyToManyMapping manyToManyMapping = (ManyToManyMapping) persistentAttribute.getMapping();
-
- //targetEntity not in the persistence unit, default still set, handled by validation
- assertEquals(PACKAGE_NAME + ".Address", manyToManyMapping.getDefaultTargetEntity());
-
- //add targetEntity to the persistence unit
- addXmlClassRef(PACKAGE_NAME + ".Address");
- assertEquals(PACKAGE_NAME + ".Address", manyToManyMapping.getDefaultTargetEntity());
-
- //test default still the same when specified target entity it set
- manyToManyMapping.setSpecifiedTargetEntity("foo");
- assertEquals(PACKAGE_NAME + ".Address", manyToManyMapping.getDefaultTargetEntity());
-
- ListIterator<ClassRef> classRefs = getPersistenceUnit().specifiedClassRefs();
- classRefs.next();
- ClassRef addressClassRef = classRefs.next();
- JavaPersistentType addressPersistentType = addressClassRef.getJavaPersistentType();
-
- //test target is not an Entity, default target entity still exists, this case handled with validation
- addressPersistentType.setMappingKey(MappingKeys.NULL_TYPE_MAPPING_KEY);
- assertEquals(PACKAGE_NAME + ".Address", manyToManyMapping.getDefaultTargetEntity());
- }
-
- public void testDefaultTargetEntityCollectionType() throws Exception {
- createTestEntityWithCollectionManyToManyMapping();
- createTestTargetEntityAddress();
- addXmlClassRef(FULLY_QUALIFIED_TYPE_NAME);
- addXmlClassRef(PACKAGE_NAME + ".Address");
-
- PersistentAttribute persistentAttribute = getJavaPersistentType().attributes().next();
- ManyToManyMapping manyToManyMapping = (ManyToManyMapping) persistentAttribute.getMapping();
-
- assertNull(manyToManyMapping.getDefaultTargetEntity());
- }
-
- public void testDefaultTargetEntityNonCollectionType() throws Exception {
- createTestEntityWithNonCollectionManyToManyMapping();
- createTestTargetEntityAddress();
- addXmlClassRef(FULLY_QUALIFIED_TYPE_NAME);
- addXmlClassRef(PACKAGE_NAME + ".Address");
-
- PersistentAttribute persistentAttribute = getJavaPersistentType().attributes().next();
- ManyToManyMapping manyToManyMapping = (ManyToManyMapping) persistentAttribute.getMapping();
-
- assertNull(manyToManyMapping.getDefaultTargetEntity());
- }
-
- public void testTargetEntity() throws Exception {
- createTestEntityWithValidManyToManyMapping();
- createTestTargetEntityAddress();
- addXmlClassRef(FULLY_QUALIFIED_TYPE_NAME);
-
- PersistentAttribute persistentAttribute = getJavaPersistentType().attributes().next();
- ManyToManyMapping manyToManyMapping = (ManyToManyMapping) persistentAttribute.getMapping();
-
- assertEquals(PACKAGE_NAME + ".Address", manyToManyMapping.getTargetEntity());
-
- manyToManyMapping.setSpecifiedTargetEntity("foo");
- assertEquals("foo", manyToManyMapping.getTargetEntity());
-
- manyToManyMapping.setSpecifiedTargetEntity(null);
- assertEquals(PACKAGE_NAME + ".Address", manyToManyMapping.getTargetEntity());
- }
-
- public void testResolvedTargetEntity() throws Exception {
- createTestEntityWithValidManyToManyMapping();
- addXmlClassRef(FULLY_QUALIFIED_TYPE_NAME);
-
- PersistentAttribute persistentAttribute = getJavaPersistentType().attributes().next();
- ManyToManyMapping manyToManyMapping = (ManyToManyMapping) persistentAttribute.getMapping();
-
- //targetEntity not in the persistence unit
- assertNull(manyToManyMapping.getResolvedTargetEntity());
-
- //add targetEntity to the persistence unit, now target entity should resolve
- createTestTargetEntityAddress();
- addXmlClassRef(PACKAGE_NAME + ".Address");
- ListIterator<ClassRef> classRefs = getPersistenceUnit().specifiedClassRefs();
- classRefs.next();
- ClassRef addressClassRef = classRefs.next();
- TypeMapping addressTypeMapping = addressClassRef.getJavaPersistentType().getMapping();
- assertEquals(addressTypeMapping, manyToManyMapping.getResolvedTargetEntity());
-
- //test default still the same when specified target entity it set
- manyToManyMapping.setSpecifiedTargetEntity("foo");
- assertNull(manyToManyMapping.getResolvedTargetEntity());
-
-
- manyToManyMapping.setSpecifiedTargetEntity(PACKAGE_NAME + ".Address");
- assertEquals(addressTypeMapping, manyToManyMapping.getResolvedTargetEntity());
-
-
- manyToManyMapping.setSpecifiedTargetEntity(null);
- assertEquals(addressTypeMapping, manyToManyMapping.getResolvedTargetEntity());
- }
-
-
- public void testUpdateMapKey() throws Exception {
- createTestEntityWithManyToManyMapping();
- addXmlClassRef(FULLY_QUALIFIED_TYPE_NAME);
-
- PersistentAttribute persistentAttribute = getJavaPersistentType().attributes().next();
- ManyToManyMapping manyToManyMapping = (ManyToManyMapping) persistentAttribute.getMapping();
-
- JavaResourcePersistentType typeResource = getJpaProject().getJavaResourcePersistentType(FULLY_QUALIFIED_TYPE_NAME);
- JavaResourcePersistentAttribute attributeResource = typeResource.persistableAttributes().next();
-
- assertNull(manyToManyMapping.getMapKey());
- assertNull(attributeResource.getSupportingAnnotation(MapKeyAnnotation.ANNOTATION_NAME));
-
- //set mapKey in the resource model, verify context model does not change
- attributeResource.addSupportingAnnotation(MapKeyAnnotation.ANNOTATION_NAME);
- assertNull(manyToManyMapping.getMapKey());
- MapKeyAnnotation mapKey = (MapKeyAnnotation) attributeResource.getSupportingAnnotation(MapKeyAnnotation.ANNOTATION_NAME);
- assertNotNull(mapKey);
-
- //set mapKey name in the resource model, verify context model updated
- mapKey.setName("myMapKey");
- assertEquals("myMapKey", manyToManyMapping.getMapKey());
- assertEquals("myMapKey", mapKey.getName());
-
- //set mapKey name to null in the resource model
- mapKey.setName(null);
- assertNull(manyToManyMapping.getMapKey());
- assertNull(mapKey.getName());
-
- mapKey.setName("myMapKey");
- attributeResource.removeSupportingAnnotation(MapKeyAnnotation.ANNOTATION_NAME);
- assertNull(manyToManyMapping.getMapKey());
- assertNull(attributeResource.getSupportingAnnotation(MapKeyAnnotation.ANNOTATION_NAME));
- }
-
- public void testModifyMapKey() throws Exception {
- createTestEntityWithManyToManyMapping();
- addXmlClassRef(FULLY_QUALIFIED_TYPE_NAME);
-
- PersistentAttribute persistentAttribute = getJavaPersistentType().attributes().next();
- ManyToManyMapping manyToManyMapping = (ManyToManyMapping) persistentAttribute.getMapping();
-
- JavaResourcePersistentType typeResource = getJpaProject().getJavaResourcePersistentType(FULLY_QUALIFIED_TYPE_NAME);
- JavaResourcePersistentAttribute attributeResource = typeResource.persistableAttributes().next();
-
- assertNull(manyToManyMapping.getMapKey());
- assertNull(attributeResource.getSupportingAnnotation(MapKeyAnnotation.ANNOTATION_NAME));
-
- //set mapKey in the context model, verify resource model updated
- manyToManyMapping.setMapKey("myMapKey");
- MapKeyAnnotation mapKey = (MapKeyAnnotation) attributeResource.getSupportingAnnotation(MapKeyAnnotation.ANNOTATION_NAME);
- assertEquals("myMapKey", manyToManyMapping.getMapKey());
- assertEquals("myMapKey", mapKey.getName());
-
- //set mapKey to null in the context model
- manyToManyMapping.setMapKey(null);
- assertNull(manyToManyMapping.getMapKey());
- assertNull(attributeResource.getSupportingAnnotation(MapKeyAnnotation.ANNOTATION_NAME));
- }
-
- public void testUpdateOrderBy() throws Exception {
- createTestEntityWithManyToManyMapping();
- addXmlClassRef(FULLY_QUALIFIED_TYPE_NAME);
-
- PersistentAttribute persistentAttribute = getJavaPersistentType().attributes().next();
- ManyToManyMapping manyToManyMapping = (ManyToManyMapping) persistentAttribute.getMapping();
-
- JavaResourcePersistentType typeResource = getJpaProject().getJavaResourcePersistentType(FULLY_QUALIFIED_TYPE_NAME);
- JavaResourcePersistentAttribute attributeResource = typeResource.persistableAttributes().next();
-
- assertNull(manyToManyMapping.getOrderBy());
- assertNull(attributeResource.getSupportingAnnotation(OrderByAnnotation.ANNOTATION_NAME));
-
- //set orderBy in the resource model, verify context model updated
- attributeResource.addSupportingAnnotation(OrderByAnnotation.ANNOTATION_NAME);
- OrderByAnnotation orderBy = (OrderByAnnotation) attributeResource.getSupportingAnnotation(OrderByAnnotation.ANNOTATION_NAME);
- orderBy.setValue("newOrderBy");
- assertEquals("newOrderBy", manyToManyMapping.getOrderBy());
- assertEquals("newOrderBy", orderBy.getValue());
-
- //set orderBy to null in the resource model
- attributeResource.removeSupportingAnnotation(OrderByAnnotation.ANNOTATION_NAME);
- assertNull(manyToManyMapping.getOrderBy());
- assertNull(attributeResource.getSupportingAnnotation(OrderByAnnotation.ANNOTATION_NAME));
- }
-
- public void testModifyOrderBy() throws Exception {
- createTestEntityWithManyToManyMapping();
- addXmlClassRef(FULLY_QUALIFIED_TYPE_NAME);
-
- PersistentAttribute persistentAttribute = getJavaPersistentType().attributes().next();
- ManyToManyMapping manyToManyMapping = (ManyToManyMapping) persistentAttribute.getMapping();
-
- JavaResourcePersistentType typeResource = getJpaProject().getJavaResourcePersistentType(FULLY_QUALIFIED_TYPE_NAME);
- JavaResourcePersistentAttribute attributeResource = typeResource.persistableAttributes().next();
-
- assertNull(manyToManyMapping.getOrderBy());
- assertNull(attributeResource.getSupportingAnnotation(OrderByAnnotation.ANNOTATION_NAME));
-
- //set mappedBy in the context model, verify resource model updated
- manyToManyMapping.setOrderBy("newOrderBy");
- assertEquals("newOrderBy", manyToManyMapping.getOrderBy());
- OrderByAnnotation orderBy = (OrderByAnnotation) attributeResource.getSupportingAnnotation(OrderByAnnotation.ANNOTATION_NAME);
- assertEquals("newOrderBy", orderBy.getValue());
-
- //set mappedBy to null in the context model
- manyToManyMapping.setOrderBy(null);
- assertNull(manyToManyMapping.getOrderBy());
- assertNull(attributeResource.getSupportingAnnotation(OrderByAnnotation.ANNOTATION_NAME));
- }
-
- public void testUpdateNoOrdering() throws Exception {
- createTestEntityWithManyToManyMapping();
- addXmlClassRef(FULLY_QUALIFIED_TYPE_NAME);
-
- PersistentAttribute persistentAttribute = getJavaPersistentType().attributes().next();
- ManyToManyMapping manyToManyMapping = (ManyToManyMapping) persistentAttribute.getMapping();
-
- JavaResourcePersistentType typeResource = getJpaProject().getJavaResourcePersistentType(FULLY_QUALIFIED_TYPE_NAME);
- JavaResourcePersistentAttribute attributeResource = typeResource.persistableAttributes().next();
-
- assertTrue(manyToManyMapping.isNoOrdering());
- assertNull(attributeResource.getSupportingAnnotation(OrderByAnnotation.ANNOTATION_NAME));
-
- //set orderBy in the resource model, verify context model updated
- attributeResource.addSupportingAnnotation(OrderByAnnotation.ANNOTATION_NAME);
- assertFalse(manyToManyMapping.isNoOrdering());
-
- OrderByAnnotation orderBy = (OrderByAnnotation) attributeResource.getSupportingAnnotation(OrderByAnnotation.ANNOTATION_NAME);
- orderBy.setValue("newOrderBy");
- assertFalse(manyToManyMapping.isNoOrdering());
-
- //set orderBy to null in the resource model
- attributeResource.removeSupportingAnnotation(OrderByAnnotation.ANNOTATION_NAME);
- assertTrue(manyToManyMapping.isNoOrdering());
- assertNull(attributeResource.getSupportingAnnotation(OrderByAnnotation.ANNOTATION_NAME));
- }
-
- public void testModifyNoOrdering() throws Exception {
- createTestEntityWithManyToManyMapping();
- addXmlClassRef(FULLY_QUALIFIED_TYPE_NAME);
-
- PersistentAttribute persistentAttribute = getJavaPersistentType().attributes().next();
- ManyToManyMapping manyToManyMapping = (ManyToManyMapping) persistentAttribute.getMapping();
-
- JavaResourcePersistentType typeResource = getJpaProject().getJavaResourcePersistentType(FULLY_QUALIFIED_TYPE_NAME);
- JavaResourcePersistentAttribute attributeResource = typeResource.persistableAttributes().next();
-
- assertTrue(manyToManyMapping.isNoOrdering());
- assertNull(attributeResource.getSupportingAnnotation(OrderByAnnotation.ANNOTATION_NAME));
-
-// manyToManyMapping.setNoOrdering(false); //this does nothing
-// //set mappedBy in the context model, verify resource model updated
-// manyToManyMapping.setOrderBy("newOrderBy");
-// assertEquals("newOrderBy", manyToManyMapping.getOrderBy());
-// OrderBy orderBy = (OrderBy) attributeResource.annotation(OrderBy.ANNOTATION_NAME);
-// assertEquals("newOrderBy", orderBy.getValue());
-//
-// //set mappedBy to null in the context model
-// manyToManyMapping.setOrderBy(null);
-// assertNull(manyToManyMapping.getOrderBy());
-// assertNull(attributeResource.annotation(OrderBy.ANNOTATION_NAME));
- }
-
- public void testUpdatePkOrdering() throws Exception {
- createTestEntityWithManyToManyMapping();
- addXmlClassRef(FULLY_QUALIFIED_TYPE_NAME);
-
- PersistentAttribute persistentAttribute = getJavaPersistentType().attributes().next();
- ManyToManyMapping manyToManyMapping = (ManyToManyMapping) persistentAttribute.getMapping();
-
- JavaResourcePersistentType typeResource = getJpaProject().getJavaResourcePersistentType(FULLY_QUALIFIED_TYPE_NAME);
- JavaResourcePersistentAttribute attributeResource = typeResource.persistableAttributes().next();
-
- assertFalse(manyToManyMapping.isPkOrdering());
- assertNull(attributeResource.getSupportingAnnotation(OrderByAnnotation.ANNOTATION_NAME));
-
- //set orderBy in the resource model, verify context model updated
- attributeResource.addSupportingAnnotation(OrderByAnnotation.ANNOTATION_NAME);
- assertTrue(manyToManyMapping.isPkOrdering());
-
- OrderByAnnotation orderBy = (OrderByAnnotation) attributeResource.getSupportingAnnotation(OrderByAnnotation.ANNOTATION_NAME);
- orderBy.setValue("newOrderBy");
- assertFalse(manyToManyMapping.isPkOrdering());
-
- //set orderBy to null in the resource model
- attributeResource.removeSupportingAnnotation(OrderByAnnotation.ANNOTATION_NAME);
- assertFalse(manyToManyMapping.isPkOrdering());
- assertNull(attributeResource.getSupportingAnnotation(OrderByAnnotation.ANNOTATION_NAME));
- }
-
- public void testUpdateCustomOrdering() throws Exception {
- createTestEntityWithManyToManyMapping();
- addXmlClassRef(FULLY_QUALIFIED_TYPE_NAME);
-
- PersistentAttribute persistentAttribute = getJavaPersistentType().attributes().next();
- ManyToManyMapping manyToManyMapping = (ManyToManyMapping) persistentAttribute.getMapping();
-
- JavaResourcePersistentType typeResource = getJpaProject().getJavaResourcePersistentType(FULLY_QUALIFIED_TYPE_NAME);
- JavaResourcePersistentAttribute attributeResource = typeResource.persistableAttributes().next();
-
- assertFalse(manyToManyMapping.isCustomOrdering());
- assertNull(attributeResource.getSupportingAnnotation(OrderByAnnotation.ANNOTATION_NAME));
-
- //set orderBy in the resource model, verify context model updated
- attributeResource.addSupportingAnnotation(OrderByAnnotation.ANNOTATION_NAME);
- assertFalse(manyToManyMapping.isCustomOrdering());
-
- OrderByAnnotation orderBy = (OrderByAnnotation) attributeResource.getSupportingAnnotation(OrderByAnnotation.ANNOTATION_NAME);
- orderBy.setValue("newOrderBy");
- assertTrue(manyToManyMapping.isCustomOrdering());
-
- //set orderBy to null in the resource model
- attributeResource.removeSupportingAnnotation(OrderByAnnotation.ANNOTATION_NAME);
- assertFalse(manyToManyMapping.isCustomOrdering());
- assertNull(attributeResource.getSupportingAnnotation(OrderByAnnotation.ANNOTATION_NAME));
- }
-
- public void testDefaultTargetEntityForMap() throws Exception {
- createTestEmployee();
- createTestDepartment();
- addXmlClassRef(PACKAGE_NAME + ".Department");
- addXmlClassRef(PACKAGE_NAME + ".Employee");
-
- JavaPersistentType departmentPersistentType = getJavaPersistentType();
- ManyToManyMapping employeesMapping = (ManyToManyMapping) departmentPersistentType.getAttributeNamed("employees").getSpecifiedMapping();
- assertEquals(PACKAGE_NAME + ".Employee", employeesMapping.getTargetEntity());
- }
-}
diff --git a/jpa/tests/org.eclipse.jpt.core.tests/src/org/eclipse/jpt/core/tests/internal/context/java/JavaManyToOneMappingTests.java b/jpa/tests/org.eclipse.jpt.core.tests/src/org/eclipse/jpt/core/tests/internal/context/java/JavaManyToOneMappingTests.java
deleted file mode 100644
index 86060f59af..0000000000
--- a/jpa/tests/org.eclipse.jpt.core.tests/src/org/eclipse/jpt/core/tests/internal/context/java/JavaManyToOneMappingTests.java
+++ /dev/null
@@ -1,904 +0,0 @@
-/*******************************************************************************
- * Copyright (c) 2007, 2008 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.
- *
- * Contributors:
- * Oracle - initial API and implementation
- ******************************************************************************/
-package org.eclipse.jpt.core.tests.internal.context.java;
-
-import java.util.Iterator;
-import java.util.ListIterator;
-import org.eclipse.jdt.core.ICompilationUnit;
-import org.eclipse.jpt.core.MappingKeys;
-import org.eclipse.jpt.core.context.BasicMapping;
-import org.eclipse.jpt.core.context.EmbeddedIdMapping;
-import org.eclipse.jpt.core.context.EmbeddedMapping;
-import org.eclipse.jpt.core.context.IdMapping;
-import org.eclipse.jpt.core.context.JoinColumn;
-import org.eclipse.jpt.core.context.JoinColumnJoiningStrategy;
-import org.eclipse.jpt.core.context.ManyToManyMapping;
-import org.eclipse.jpt.core.context.ManyToOneMapping;
-import org.eclipse.jpt.core.context.OneToManyMapping;
-import org.eclipse.jpt.core.context.OneToOneMapping;
-import org.eclipse.jpt.core.context.PersistentAttribute;
-import org.eclipse.jpt.core.context.TransientMapping;
-import org.eclipse.jpt.core.context.TypeMapping;
-import org.eclipse.jpt.core.context.VersionMapping;
-import org.eclipse.jpt.core.context.java.JavaPersistentType;
-import org.eclipse.jpt.core.context.persistence.ClassRef;
-import org.eclipse.jpt.core.resource.java.BasicAnnotation;
-import org.eclipse.jpt.core.resource.java.EmbeddedAnnotation;
-import org.eclipse.jpt.core.resource.java.EmbeddedIdAnnotation;
-import org.eclipse.jpt.core.resource.java.IdAnnotation;
-import org.eclipse.jpt.core.resource.java.JPA;
-import org.eclipse.jpt.core.resource.java.JavaResourcePersistentAttribute;
-import org.eclipse.jpt.core.resource.java.JavaResourcePersistentType;
-import org.eclipse.jpt.core.resource.java.JoinColumnAnnotation;
-import org.eclipse.jpt.core.resource.java.JoinColumnsAnnotation;
-import org.eclipse.jpt.core.resource.java.ManyToManyAnnotation;
-import org.eclipse.jpt.core.resource.java.ManyToOneAnnotation;
-import org.eclipse.jpt.core.resource.java.NestableAnnotation;
-import org.eclipse.jpt.core.resource.java.OneToManyAnnotation;
-import org.eclipse.jpt.core.resource.java.OneToOneAnnotation;
-import org.eclipse.jpt.core.resource.java.TransientAnnotation;
-import org.eclipse.jpt.core.resource.java.VersionAnnotation;
-import org.eclipse.jpt.core.tests.internal.context.ContextModelTestCase;
-import org.eclipse.jpt.core.tests.internal.projects.TestJavaProject.SourceWriter;
-import org.eclipse.jpt.utility.internal.CollectionTools;
-import org.eclipse.jpt.utility.internal.iterators.ArrayIterator;
-
-@SuppressWarnings("nls")
-public class JavaManyToOneMappingTests extends ContextModelTestCase
-{
-
- private void createTestTargetEntityAddress() throws Exception {
- SourceWriter sourceWriter = new SourceWriter() {
- public void appendSourceTo(StringBuilder sb) {
- sb.append(CR);
- sb.append("import ");
- sb.append(JPA.ENTITY);
- sb.append(";");
- sb.append(CR);
- sb.append("import ");
- sb.append(JPA.ID);
- sb.append(";");
- sb.append(CR);
- sb.append("@Entity");
- sb.append(CR);
- sb.append("public class ").append("Address").append(" ");
- sb.append("{").append(CR);
- sb.append(CR);
- sb.append(" @Id").append(CR);
- sb.append(" private int id;").append(CR);
- sb.append(CR);
- sb.append(" private String city;").append(CR);
- sb.append(CR);
- sb.append(" private String state;").append(CR);
- sb.append(CR);
- sb.append(" private int zip;").append(CR);
- sb.append(CR);
- sb.append("}").append(CR);
- }
- };
- this.javaProject.createCompilationUnit(PACKAGE_NAME, "Address.java", sourceWriter);
- }
-
- private ICompilationUnit createTestEntityWithManyToOneMapping() throws Exception {
- return this.createTestType(new DefaultAnnotationWriter() {
- @Override
- public Iterator<String> imports() {
- return new ArrayIterator<String>(JPA.ENTITY, JPA.MANY_TO_ONE);
- }
- @Override
- public void appendTypeAnnotationTo(StringBuilder sb) {
- sb.append("@Entity").append(CR);
- }
-
- @Override
- public void appendIdFieldAnnotationTo(StringBuilder sb) {
- sb.append("@ManyToOne").append(CR);
- }
- });
- }
-
- private ICompilationUnit createTestEntityWithValidManyToOneMapping() throws Exception {
- return this.createTestType(new DefaultAnnotationWriter() {
- @Override
- public Iterator<String> imports() {
- return new ArrayIterator<String>(JPA.ENTITY, JPA.MANY_TO_ONE, JPA.ID);
- }
- @Override
- public void appendTypeAnnotationTo(StringBuilder sb) {
- sb.append("@Entity").append(CR);
- }
-
- @Override
- public void appendIdFieldAnnotationTo(StringBuilder sb) {
- sb.append(CR);
- sb.append(" @ManyToOne").append(CR);
- sb.append(" private Address address;").append(CR);
- sb.append(CR);
- sb.append(" @Id").append(CR);
- }
- });
- }
-
- private ICompilationUnit createTestEntityWithCollectionManyToOneMapping() throws Exception {
- return this.createTestType(new DefaultAnnotationWriter() {
- @Override
- public Iterator<String> imports() {
- return new ArrayIterator<String>(JPA.ENTITY, JPA.MANY_TO_ONE, JPA.ID, "java.util.Collection");
- }
- @Override
- public void appendTypeAnnotationTo(StringBuilder sb) {
- sb.append("@Entity").append(CR);
- }
-
- @Override
- public void appendIdFieldAnnotationTo(StringBuilder sb) {
- sb.append(CR);
- sb.append(" @ManyToOne").append(CR);
- sb.append(" private Collection address;").append(CR);
- sb.append(CR);
- sb.append(" @Id").append(CR);
- }
- });
- }
-
- private ICompilationUnit createTestEntityWithGenericizedCollectionManyToOneMapping() throws Exception {
- return this.createTestType(new DefaultAnnotationWriter() {
- @Override
- public Iterator<String> imports() {
- return new ArrayIterator<String>(JPA.ENTITY, JPA.MANY_TO_ONE, JPA.ID, "java.util.Collection");
- }
- @Override
- public void appendTypeAnnotationTo(StringBuilder sb) {
- sb.append("@Entity").append(CR);
- }
-
- @Override
- public void appendIdFieldAnnotationTo(StringBuilder sb) {
- sb.append(CR);
- sb.append(" @ManyToOne").append(CR);
- sb.append(" private Collection<Address> address;").append(CR);
- sb.append(CR);
- sb.append(" @Id").append(CR);
- }
- });
- }
-
- public JavaManyToOneMappingTests(String name) {
- super(name);
- }
-
- public void testMorphToBasicMapping() throws Exception {
- createTestEntityWithManyToOneMapping();
- addXmlClassRef(FULLY_QUALIFIED_TYPE_NAME);
-
- PersistentAttribute persistentAttribute = getJavaPersistentType().attributes().next();
- ManyToOneMapping manyToOneMapping = (ManyToOneMapping) persistentAttribute.getMapping();
- JoinColumnJoiningStrategy joinColumns = manyToOneMapping.getRelationshipReference().getJoinColumnJoiningStrategy();
- joinColumns.addSpecifiedJoinColumn(0);
- assertFalse(manyToOneMapping.isDefault());
-
- persistentAttribute.setSpecifiedMappingKey(MappingKeys.BASIC_ATTRIBUTE_MAPPING_KEY);
- assertTrue(persistentAttribute.getMapping() instanceof BasicMapping);
- assertFalse(persistentAttribute.getMapping().isDefault());
-
- JavaResourcePersistentType typeResource = getJpaProject().getJavaResourcePersistentType(FULLY_QUALIFIED_TYPE_NAME);
- JavaResourcePersistentAttribute attributeResource = typeResource.persistableAttributes().next();
- assertNull(attributeResource.getMappingAnnotation(ManyToOneAnnotation.ANNOTATION_NAME));
- assertNotNull(attributeResource.getMappingAnnotation(BasicAnnotation.ANNOTATION_NAME));
- assertNull(attributeResource.getSupportingAnnotation(JoinColumnAnnotation.ANNOTATION_NAME));
- }
-
- public void testMorphToDefault() throws Exception {
- createTestEntityWithManyToOneMapping();
- addXmlClassRef(FULLY_QUALIFIED_TYPE_NAME);
-
- PersistentAttribute persistentAttribute = getJavaPersistentType().attributes().next();
- ManyToOneMapping manyToOneMapping = (ManyToOneMapping) persistentAttribute.getMapping();
- JoinColumnJoiningStrategy joinColumns = manyToOneMapping.getRelationshipReference().getJoinColumnJoiningStrategy();
- joinColumns.addSpecifiedJoinColumn(0);
- assertFalse(manyToOneMapping.isDefault());
-
- persistentAttribute.setSpecifiedMappingKey(MappingKeys.NULL_ATTRIBUTE_MAPPING_KEY);
- assertNull(persistentAttribute.getSpecifiedMapping());
- assertTrue(persistentAttribute.getMapping().isDefault());
-
- JavaResourcePersistentType typeResource = getJpaProject().getJavaResourcePersistentType(FULLY_QUALIFIED_TYPE_NAME);
- JavaResourcePersistentAttribute attributeResource = typeResource.persistableAttributes().next();
- assertNull(attributeResource.getMappingAnnotation(ManyToOneAnnotation.ANNOTATION_NAME));
- assertNull(attributeResource.getSupportingAnnotation(JoinColumnAnnotation.ANNOTATION_NAME));
- }
-
- public void testMorphToVersionMapping() throws Exception {
- createTestEntityWithManyToOneMapping();
- addXmlClassRef(FULLY_QUALIFIED_TYPE_NAME);
-
- PersistentAttribute persistentAttribute = getJavaPersistentType().attributes().next();
- ManyToOneMapping manyToOneMapping = (ManyToOneMapping) persistentAttribute.getMapping();
- JoinColumnJoiningStrategy joinColumns = manyToOneMapping.getRelationshipReference().getJoinColumnJoiningStrategy();
- joinColumns.addSpecifiedJoinColumn(0);
- assertFalse(manyToOneMapping.isDefault());
-
- persistentAttribute.setSpecifiedMappingKey(MappingKeys.VERSION_ATTRIBUTE_MAPPING_KEY);
- assertTrue(persistentAttribute.getMapping() instanceof VersionMapping);
- assertFalse(persistentAttribute.getMapping().isDefault());
-
- JavaResourcePersistentType typeResource = getJpaProject().getJavaResourcePersistentType(FULLY_QUALIFIED_TYPE_NAME);
- JavaResourcePersistentAttribute attributeResource = typeResource.persistableAttributes().next();
- assertNull(attributeResource.getMappingAnnotation(ManyToOneAnnotation.ANNOTATION_NAME));
- assertNotNull(attributeResource.getMappingAnnotation(VersionAnnotation.ANNOTATION_NAME));
- assertNull(attributeResource.getSupportingAnnotation(JoinColumnAnnotation.ANNOTATION_NAME));
- }
-
- public void testMorphToIdMapping() throws Exception {
- createTestEntityWithManyToOneMapping();
- addXmlClassRef(FULLY_QUALIFIED_TYPE_NAME);
-
- PersistentAttribute persistentAttribute = getJavaPersistentType().attributes().next();
- ManyToOneMapping manyToOneMapping = (ManyToOneMapping) persistentAttribute.getMapping();
- JoinColumnJoiningStrategy joinColumns = manyToOneMapping.getRelationshipReference().getJoinColumnJoiningStrategy();
- joinColumns.addSpecifiedJoinColumn(0);
- assertFalse(manyToOneMapping.isDefault());
-
- persistentAttribute.setSpecifiedMappingKey(MappingKeys.ID_ATTRIBUTE_MAPPING_KEY);
- assertTrue(persistentAttribute.getMapping() instanceof IdMapping);
- assertFalse(persistentAttribute.getMapping().isDefault());
-
- JavaResourcePersistentType typeResource = getJpaProject().getJavaResourcePersistentType(FULLY_QUALIFIED_TYPE_NAME);
- JavaResourcePersistentAttribute attributeResource = typeResource.persistableAttributes().next();
- assertNull(attributeResource.getMappingAnnotation(ManyToOneAnnotation.ANNOTATION_NAME));
- assertNotNull(attributeResource.getMappingAnnotation(IdAnnotation.ANNOTATION_NAME));
- assertNull(attributeResource.getSupportingAnnotation(JoinColumnAnnotation.ANNOTATION_NAME));
- }
-
- public void testMorphToEmbeddedMapping() throws Exception {
- createTestEntityWithManyToOneMapping();
- addXmlClassRef(FULLY_QUALIFIED_TYPE_NAME);
-
- PersistentAttribute persistentAttribute = getJavaPersistentType().attributes().next();
- ManyToOneMapping manyToOneMapping = (ManyToOneMapping) persistentAttribute.getMapping();
- JoinColumnJoiningStrategy joinColumns = manyToOneMapping.getRelationshipReference().getJoinColumnJoiningStrategy();
- joinColumns.addSpecifiedJoinColumn(0);
- assertFalse(manyToOneMapping.isDefault());
-
- persistentAttribute.setSpecifiedMappingKey(MappingKeys.EMBEDDED_ATTRIBUTE_MAPPING_KEY);
- assertTrue(persistentAttribute.getMapping() instanceof EmbeddedMapping);
- assertFalse(persistentAttribute.getMapping().isDefault());
-
- JavaResourcePersistentType typeResource = getJpaProject().getJavaResourcePersistentType(FULLY_QUALIFIED_TYPE_NAME);
- JavaResourcePersistentAttribute attributeResource = typeResource.persistableAttributes().next();
- assertNull(attributeResource.getMappingAnnotation(ManyToOneAnnotation.ANNOTATION_NAME));
- assertNotNull(attributeResource.getMappingAnnotation(EmbeddedAnnotation.ANNOTATION_NAME));
- assertNull(attributeResource.getSupportingAnnotation(JoinColumnAnnotation.ANNOTATION_NAME));
- }
-
- public void testMorphToEmbeddedIdMapping() throws Exception {
- createTestEntityWithManyToOneMapping();
- addXmlClassRef(FULLY_QUALIFIED_TYPE_NAME);
-
- PersistentAttribute persistentAttribute = getJavaPersistentType().attributes().next();
- ManyToOneMapping manyToOneMapping = (ManyToOneMapping) persistentAttribute.getMapping();
- JoinColumnJoiningStrategy joinColumns = manyToOneMapping.getRelationshipReference().getJoinColumnJoiningStrategy();
- joinColumns.addSpecifiedJoinColumn(0);
- assertFalse(manyToOneMapping.isDefault());
-
- persistentAttribute.setSpecifiedMappingKey(MappingKeys.EMBEDDED_ID_ATTRIBUTE_MAPPING_KEY);
- assertTrue(persistentAttribute.getMapping() instanceof EmbeddedIdMapping);
- assertFalse(persistentAttribute.getMapping().isDefault());
-
- JavaResourcePersistentType typeResource = getJpaProject().getJavaResourcePersistentType(FULLY_QUALIFIED_TYPE_NAME);
- JavaResourcePersistentAttribute attributeResource = typeResource.persistableAttributes().next();
- assertNull(attributeResource.getMappingAnnotation(ManyToOneAnnotation.ANNOTATION_NAME));
- assertNotNull(attributeResource.getMappingAnnotation(EmbeddedIdAnnotation.ANNOTATION_NAME));
- assertNull(attributeResource.getSupportingAnnotation(JoinColumnAnnotation.ANNOTATION_NAME));
- }
-
- public void testMorphToTransientMapping() throws Exception {
- createTestEntityWithManyToOneMapping();
- addXmlClassRef(FULLY_QUALIFIED_TYPE_NAME);
-
- PersistentAttribute persistentAttribute = getJavaPersistentType().attributes().next();
- ManyToOneMapping manyToOneMapping = (ManyToOneMapping) persistentAttribute.getMapping();
- JoinColumnJoiningStrategy joinColumns = manyToOneMapping.getRelationshipReference().getJoinColumnJoiningStrategy();
- joinColumns.addSpecifiedJoinColumn(0);
- assertFalse(manyToOneMapping.isDefault());
-
- persistentAttribute.setSpecifiedMappingKey(MappingKeys.TRANSIENT_ATTRIBUTE_MAPPING_KEY);
- assertTrue(persistentAttribute.getMapping() instanceof TransientMapping);
- assertFalse(persistentAttribute.getMapping().isDefault());
-
- JavaResourcePersistentType typeResource = getJpaProject().getJavaResourcePersistentType(FULLY_QUALIFIED_TYPE_NAME);
- JavaResourcePersistentAttribute attributeResource = typeResource.persistableAttributes().next();
- assertNull(attributeResource.getMappingAnnotation(ManyToOneAnnotation.ANNOTATION_NAME));
- assertNotNull(attributeResource.getMappingAnnotation(TransientAnnotation.ANNOTATION_NAME));
- assertNull(attributeResource.getSupportingAnnotation(JoinColumnAnnotation.ANNOTATION_NAME));
- }
-
- public void testMorphToOneToOneMapping() throws Exception {
- createTestEntityWithManyToOneMapping();
- addXmlClassRef(FULLY_QUALIFIED_TYPE_NAME);
-
- PersistentAttribute persistentAttribute = getJavaPersistentType().attributes().next();
- ManyToOneMapping manyToOneMapping = (ManyToOneMapping) persistentAttribute.getMapping();
- JoinColumnJoiningStrategy joinColumns = manyToOneMapping.getRelationshipReference().getJoinColumnJoiningStrategy();
- joinColumns.addSpecifiedJoinColumn(0);
- assertFalse(manyToOneMapping.isDefault());
-
- persistentAttribute.setSpecifiedMappingKey(MappingKeys.ONE_TO_ONE_ATTRIBUTE_MAPPING_KEY);
- assertTrue(persistentAttribute.getMapping() instanceof OneToOneMapping);
- assertFalse(persistentAttribute.getMapping().isDefault());
-
- JavaResourcePersistentType typeResource = getJpaProject().getJavaResourcePersistentType(FULLY_QUALIFIED_TYPE_NAME);
- JavaResourcePersistentAttribute attributeResource = typeResource.persistableAttributes().next();
- assertNull(attributeResource.getMappingAnnotation(ManyToOneAnnotation.ANNOTATION_NAME));
- assertNotNull(attributeResource.getMappingAnnotation(OneToOneAnnotation.ANNOTATION_NAME));
- assertNotNull(attributeResource.getSupportingAnnotation(JoinColumnAnnotation.ANNOTATION_NAME));
- }
-
- public void testMorphToOneToManyMapping() throws Exception {
- createTestEntityWithManyToOneMapping();
- addXmlClassRef(FULLY_QUALIFIED_TYPE_NAME);
-
- PersistentAttribute persistentAttribute = getJavaPersistentType().attributes().next();
- ManyToOneMapping manyToOneMapping = (ManyToOneMapping) persistentAttribute.getMapping();
- JoinColumnJoiningStrategy joinColumns = manyToOneMapping.getRelationshipReference().getJoinColumnJoiningStrategy();
- joinColumns.addSpecifiedJoinColumn(0);
- assertFalse(manyToOneMapping.isDefault());
-
- persistentAttribute.setSpecifiedMappingKey(MappingKeys.ONE_TO_MANY_ATTRIBUTE_MAPPING_KEY);
- assertTrue(persistentAttribute.getMapping() instanceof OneToManyMapping);
- assertFalse(persistentAttribute.getMapping().isDefault());
-
- JavaResourcePersistentType typeResource = getJpaProject().getJavaResourcePersistentType(FULLY_QUALIFIED_TYPE_NAME);
- JavaResourcePersistentAttribute attributeResource = typeResource.persistableAttributes().next();
- assertNull(attributeResource.getMappingAnnotation(ManyToOneAnnotation.ANNOTATION_NAME));
- assertNotNull(attributeResource.getMappingAnnotation(OneToManyAnnotation.ANNOTATION_NAME));
- assertNotNull(attributeResource.getSupportingAnnotation(JoinColumnAnnotation.ANNOTATION_NAME));
- }
-
- public void testMorphToManyToManyMapping() throws Exception {
- createTestEntityWithManyToOneMapping();
- addXmlClassRef(FULLY_QUALIFIED_TYPE_NAME);
-
- PersistentAttribute persistentAttribute = getJavaPersistentType().attributes().next();
- ManyToOneMapping manyToOneMapping = (ManyToOneMapping) persistentAttribute.getMapping();
- JoinColumnJoiningStrategy joinColumns = manyToOneMapping.getRelationshipReference().getJoinColumnJoiningStrategy();
- joinColumns.addSpecifiedJoinColumn(0);
- assertFalse(manyToOneMapping.isDefault());
-
- persistentAttribute.setSpecifiedMappingKey(MappingKeys.MANY_TO_MANY_ATTRIBUTE_MAPPING_KEY);
- assertTrue(persistentAttribute.getMapping() instanceof ManyToManyMapping);
- assertFalse(persistentAttribute.getMapping().isDefault());
-
- JavaResourcePersistentType typeResource = getJpaProject().getJavaResourcePersistentType(FULLY_QUALIFIED_TYPE_NAME);
- JavaResourcePersistentAttribute attributeResource = typeResource.persistableAttributes().next();
- assertNull(attributeResource.getMappingAnnotation(ManyToOneAnnotation.ANNOTATION_NAME));
- assertNotNull(attributeResource.getMappingAnnotation(ManyToManyAnnotation.ANNOTATION_NAME));
- assertNull(attributeResource.getSupportingAnnotation(JoinColumnAnnotation.ANNOTATION_NAME));
- }
-
- public void testUpdateSpecifiedTargetEntity() throws Exception {
- createTestEntityWithManyToOneMapping();
- addXmlClassRef(FULLY_QUALIFIED_TYPE_NAME);
-
- PersistentAttribute persistentAttribute = getJavaPersistentType().attributes().next();
- ManyToOneMapping manyToOneMapping = (ManyToOneMapping) persistentAttribute.getMapping();
-
- JavaResourcePersistentType typeResource = getJpaProject().getJavaResourcePersistentType(FULLY_QUALIFIED_TYPE_NAME);
- JavaResourcePersistentAttribute attributeResource = typeResource.persistableAttributes().next();
- ManyToOneAnnotation manyToOne = (ManyToOneAnnotation) attributeResource.getMappingAnnotation();
-
- assertNull(manyToOneMapping.getSpecifiedTargetEntity());
- assertNull(manyToOne.getTargetEntity());
-
- //set target entity in the resource model, verify context model updated
- manyToOne.setTargetEntity("newTargetEntity");
- assertEquals("newTargetEntity", manyToOneMapping.getSpecifiedTargetEntity());
- assertEquals("newTargetEntity", manyToOne.getTargetEntity());
-
- //set target entity to null in the resource model
- manyToOne.setTargetEntity(null);
- assertNull(manyToOneMapping.getSpecifiedTargetEntity());
- assertNull(manyToOne.getTargetEntity());
- }
-
- public void testModifySpecifiedTargetEntity() throws Exception {
- createTestEntityWithManyToOneMapping();
- addXmlClassRef(FULLY_QUALIFIED_TYPE_NAME);
-
- PersistentAttribute persistentAttribute = getJavaPersistentType().attributes().next();
- ManyToOneMapping manyToOneMapping = (ManyToOneMapping) persistentAttribute.getMapping();
-
- JavaResourcePersistentType typeResource = getJpaProject().getJavaResourcePersistentType(FULLY_QUALIFIED_TYPE_NAME);
- JavaResourcePersistentAttribute attributeResource = typeResource.persistableAttributes().next();
- ManyToOneAnnotation manyToOne = (ManyToOneAnnotation) attributeResource.getMappingAnnotation();
-
- assertNull(manyToOneMapping.getSpecifiedTargetEntity());
- assertNull(manyToOne.getTargetEntity());
-
- //set target entity in the context model, verify resource model updated
- manyToOneMapping.setSpecifiedTargetEntity("newTargetEntity");
- assertEquals("newTargetEntity", manyToOneMapping.getSpecifiedTargetEntity());
- assertEquals("newTargetEntity", manyToOne.getTargetEntity());
-
- //set target entity to null in the context model
- manyToOneMapping.setSpecifiedTargetEntity(null);
- assertNull(manyToOneMapping.getSpecifiedTargetEntity());
- assertNull(manyToOne.getTargetEntity());
- }
-
- public void testUpdateSpecifiedOptional() throws Exception {
- createTestEntityWithManyToOneMapping();
- addXmlClassRef(FULLY_QUALIFIED_TYPE_NAME);
-
- PersistentAttribute persistentAttribute = getJavaPersistentType().attributes().next();
- ManyToOneMapping manyToOneMapping = (ManyToOneMapping) persistentAttribute.getMapping();
-
- JavaResourcePersistentType typeResource = getJpaProject().getJavaResourcePersistentType(FULLY_QUALIFIED_TYPE_NAME);
- JavaResourcePersistentAttribute attributeResource = typeResource.persistableAttributes().next();
- ManyToOneAnnotation manyToOne = (ManyToOneAnnotation) attributeResource.getMappingAnnotation();
-
- assertNull(manyToOneMapping.getSpecifiedOptional());
- assertNull(manyToOne.getOptional());
-
- //set optional in the resource model, verify context model updated
- manyToOne.setOptional(Boolean.TRUE);
- assertEquals(Boolean.TRUE, manyToOneMapping.getSpecifiedOptional());
- assertEquals(Boolean.TRUE, manyToOne.getOptional());
-
- manyToOne.setOptional(Boolean.FALSE);
- assertEquals(Boolean.FALSE, manyToOneMapping.getSpecifiedOptional());
- assertEquals(Boolean.FALSE, manyToOne.getOptional());
-
-
- //set optional to null in the resource model
- manyToOne.setOptional(null);
- assertNull(manyToOneMapping.getSpecifiedOptional());
- assertNull(manyToOne.getOptional());
- }
-
- public void testModifySpecifiedOptional() throws Exception {
- createTestEntityWithManyToOneMapping();
- addXmlClassRef(FULLY_QUALIFIED_TYPE_NAME);
-
- PersistentAttribute persistentAttribute = getJavaPersistentType().attributes().next();
- ManyToOneMapping manyToOneMapping = (ManyToOneMapping) persistentAttribute.getMapping();
-
- JavaResourcePersistentType typeResource = getJpaProject().getJavaResourcePersistentType(FULLY_QUALIFIED_TYPE_NAME);
- JavaResourcePersistentAttribute attributeResource = typeResource.persistableAttributes().next();
- ManyToOneAnnotation manyToOne = (ManyToOneAnnotation) attributeResource.getMappingAnnotation();
-
- assertNull(manyToOneMapping.getSpecifiedOptional());
- assertNull(manyToOne.getOptional());
-
- //set optional in the context model, verify resource model updated
- manyToOneMapping.setSpecifiedOptional(Boolean.TRUE);
- assertEquals(Boolean.TRUE, manyToOneMapping.getSpecifiedOptional());
- assertEquals(Boolean.TRUE, manyToOne.getOptional());
-
- manyToOneMapping.setSpecifiedOptional(Boolean.FALSE);
- assertEquals(Boolean.FALSE, manyToOneMapping.getSpecifiedOptional());
- assertEquals(Boolean.FALSE, manyToOne.getOptional());
-
-
- //set optional to null in the context model
- manyToOneMapping.setSpecifiedOptional(null);
- assertNull(manyToOneMapping.getSpecifiedOptional());
- assertNull(manyToOne.getOptional());
- }
-
-
- public void testSpecifiedJoinColumns() throws Exception {
- createTestEntityWithManyToOneMapping();
- addXmlClassRef(FULLY_QUALIFIED_TYPE_NAME);
-
- PersistentAttribute persistentAttribute = getJavaPersistentType().attributes().next();
- ManyToOneMapping manyToOneMapping = (ManyToOneMapping) persistentAttribute.getMapping();
- JoinColumnJoiningStrategy joinColumns = manyToOneMapping.getRelationshipReference().getJoinColumnJoiningStrategy();
-
- ListIterator<? extends JoinColumn> specifiedJoinColumns = joinColumns.specifiedJoinColumns();
-
- assertFalse(specifiedJoinColumns.hasNext());
-
- JavaResourcePersistentType typeResource = getJpaProject().getJavaResourcePersistentType(FULLY_QUALIFIED_TYPE_NAME);
- JavaResourcePersistentAttribute attributeResource = typeResource.persistableAttributes().next();
-
- //add an annotation to the resource model and verify the context model is updated
- JoinColumnAnnotation joinColumn = (JoinColumnAnnotation) attributeResource.addSupportingAnnotation(0, JPA.JOIN_COLUMN, JPA.JOIN_COLUMNS);
- joinColumn.setName("FOO");
- specifiedJoinColumns = joinColumns.specifiedJoinColumns();
- assertEquals("FOO", specifiedJoinColumns.next().getName());
- assertFalse(specifiedJoinColumns.hasNext());
-
- joinColumn = (JoinColumnAnnotation) attributeResource.addSupportingAnnotation(0, JPA.JOIN_COLUMN, JPA.JOIN_COLUMNS);
- joinColumn.setName("BAR");
- specifiedJoinColumns = joinColumns.specifiedJoinColumns();
- assertEquals("BAR", specifiedJoinColumns.next().getName());
- assertEquals("FOO", specifiedJoinColumns.next().getName());
- assertFalse(specifiedJoinColumns.hasNext());
-
-
- joinColumn = (JoinColumnAnnotation) attributeResource.addSupportingAnnotation(0, JPA.JOIN_COLUMN, JPA.JOIN_COLUMNS);
- joinColumn.setName("BAZ");
- specifiedJoinColumns = joinColumns.specifiedJoinColumns();
- assertEquals("BAZ", specifiedJoinColumns.next().getName());
- assertEquals("BAR", specifiedJoinColumns.next().getName());
- assertEquals("FOO", specifiedJoinColumns.next().getName());
- assertFalse(specifiedJoinColumns.hasNext());
-
- //move an annotation to the resource model and verify the context model is updated
- attributeResource.moveSupportingAnnotation(1, 0, JPA.JOIN_COLUMNS);
- specifiedJoinColumns = joinColumns.specifiedJoinColumns();
- assertEquals("BAR", specifiedJoinColumns.next().getName());
- assertEquals("BAZ", specifiedJoinColumns.next().getName());
- assertEquals("FOO", specifiedJoinColumns.next().getName());
- assertFalse(specifiedJoinColumns.hasNext());
-
- attributeResource.removeSupportingAnnotation(0, JPA.JOIN_COLUMN, JPA.JOIN_COLUMNS);
- specifiedJoinColumns = joinColumns.specifiedJoinColumns();
- assertEquals("BAZ", specifiedJoinColumns.next().getName());
- assertEquals("FOO", specifiedJoinColumns.next().getName());
- assertFalse(specifiedJoinColumns.hasNext());
-
- attributeResource.removeSupportingAnnotation(0, JPA.JOIN_COLUMN, JPA.JOIN_COLUMNS);
- specifiedJoinColumns = joinColumns.specifiedJoinColumns();
- assertEquals("FOO", specifiedJoinColumns.next().getName());
- assertFalse(specifiedJoinColumns.hasNext());
-
-
- attributeResource.removeSupportingAnnotation(0, JPA.JOIN_COLUMN, JPA.JOIN_COLUMNS);
- specifiedJoinColumns = joinColumns.specifiedJoinColumns();
- assertFalse(specifiedJoinColumns.hasNext());
- }
-
- public void testGetDefaultJoin() {
- //TODO
- }
-
- public void testSpecifiedJoinColumnsSize() throws Exception {
- createTestEntityWithManyToOneMapping();
- addXmlClassRef(FULLY_QUALIFIED_TYPE_NAME);
-
- PersistentAttribute persistentAttribute = getJavaPersistentType().attributes().next();
- ManyToOneMapping manyToOneMapping = (ManyToOneMapping) persistentAttribute.getMapping();
- JoinColumnJoiningStrategy joinColumns = manyToOneMapping.getRelationshipReference().getJoinColumnJoiningStrategy();
-
- assertEquals(0, joinColumns.specifiedJoinColumnsSize());
-
- joinColumns.addSpecifiedJoinColumn(0);
- assertEquals(1, joinColumns.specifiedJoinColumnsSize());
-
- joinColumns.removeSpecifiedJoinColumn(0);
- assertEquals(0, joinColumns.specifiedJoinColumnsSize());
- }
-
- public void testJoinColumnsSize() throws Exception {
- createTestEntityWithManyToOneMapping();
- addXmlClassRef(FULLY_QUALIFIED_TYPE_NAME);
-
- PersistentAttribute persistentAttribute = getJavaPersistentType().attributes().next();
- ManyToOneMapping manyToOneMapping = (ManyToOneMapping) persistentAttribute.getMapping();
- JoinColumnJoiningStrategy joinColumns = manyToOneMapping.getRelationshipReference().getJoinColumnJoiningStrategy();
-
- assertEquals(1, joinColumns.joinColumnsSize());
-
- joinColumns.addSpecifiedJoinColumn(0);
- assertEquals(1, joinColumns.joinColumnsSize());
-
- joinColumns.addSpecifiedJoinColumn(0);
- assertEquals(2, joinColumns.joinColumnsSize());
-
- joinColumns.removeSpecifiedJoinColumn(0);
- joinColumns.removeSpecifiedJoinColumn(0);
- assertEquals(1, joinColumns.joinColumnsSize());
- }
-
- public void testAddSpecifiedJoinColumn() throws Exception {
- createTestEntityWithManyToOneMapping();
- addXmlClassRef(FULLY_QUALIFIED_TYPE_NAME);
-
- PersistentAttribute persistentAttribute = getJavaPersistentType().attributes().next();
- ManyToOneMapping manyToOneMapping = (ManyToOneMapping) persistentAttribute.getMapping();
- JoinColumnJoiningStrategy joinColumns = manyToOneMapping.getRelationshipReference().getJoinColumnJoiningStrategy();
-
- joinColumns.addSpecifiedJoinColumn(0).setSpecifiedName("FOO");
- joinColumns.addSpecifiedJoinColumn(0).setSpecifiedName("BAR");
- joinColumns.addSpecifiedJoinColumn(0).setSpecifiedName("BAZ");
-
- JavaResourcePersistentType typeResource = getJpaProject().getJavaResourcePersistentType(FULLY_QUALIFIED_TYPE_NAME);
- JavaResourcePersistentAttribute attributeResource = typeResource.persistableAttributes().next();
- Iterator<NestableAnnotation> joinColumnsIterator = attributeResource.supportingAnnotations(JoinColumnAnnotation.ANNOTATION_NAME, JoinColumnsAnnotation.ANNOTATION_NAME);
-
- assertEquals("BAZ", ((JoinColumnAnnotation) joinColumnsIterator.next()).getName());
- assertEquals("BAR", ((JoinColumnAnnotation) joinColumnsIterator.next()).getName());
- assertEquals("FOO", ((JoinColumnAnnotation) joinColumnsIterator.next()).getName());
- assertFalse(joinColumnsIterator.hasNext());
- }
-
- public void testAddSpecifiedJoinColumn2() throws Exception {
- createTestEntityWithManyToOneMapping();
- addXmlClassRef(FULLY_QUALIFIED_TYPE_NAME);
-
- PersistentAttribute persistentAttribute = getJavaPersistentType().attributes().next();
- ManyToOneMapping manyToOneMapping = (ManyToOneMapping) persistentAttribute.getMapping();
- JoinColumnJoiningStrategy joinColumns = manyToOneMapping.getRelationshipReference().getJoinColumnJoiningStrategy();
-
- joinColumns.addSpecifiedJoinColumn(0).setSpecifiedName("FOO");
- joinColumns.addSpecifiedJoinColumn(1).setSpecifiedName("BAR");
- joinColumns.addSpecifiedJoinColumn(2).setSpecifiedName("BAZ");
-
- JavaResourcePersistentType typeResource = getJpaProject().getJavaResourcePersistentType(FULLY_QUALIFIED_TYPE_NAME);
- JavaResourcePersistentAttribute attributeResource = typeResource.persistableAttributes().next();
- Iterator<NestableAnnotation> joinColumnsIterator = attributeResource.supportingAnnotations(JoinColumnAnnotation.ANNOTATION_NAME, JoinColumnsAnnotation.ANNOTATION_NAME);
-
- assertEquals("FOO", ((JoinColumnAnnotation) joinColumnsIterator.next()).getName());
- assertEquals("BAR", ((JoinColumnAnnotation) joinColumnsIterator.next()).getName());
- assertEquals("BAZ", ((JoinColumnAnnotation) joinColumnsIterator.next()).getName());
- assertFalse(joinColumnsIterator.hasNext());
- }
- public void testRemoveSpecifiedJoinColumn() throws Exception {
- createTestEntityWithManyToOneMapping();
- addXmlClassRef(FULLY_QUALIFIED_TYPE_NAME);
-
- PersistentAttribute persistentAttribute = getJavaPersistentType().attributes().next();
- ManyToOneMapping manyToOneMapping = (ManyToOneMapping) persistentAttribute.getMapping();
- JoinColumnJoiningStrategy joinColumns = manyToOneMapping.getRelationshipReference().getJoinColumnJoiningStrategy();
-
- joinColumns.addSpecifiedJoinColumn(0).setSpecifiedName("FOO");
- joinColumns.addSpecifiedJoinColumn(1).setSpecifiedName("BAR");
- joinColumns.addSpecifiedJoinColumn(2).setSpecifiedName("BAZ");
-
- JavaResourcePersistentType typeResource = getJpaProject().getJavaResourcePersistentType(FULLY_QUALIFIED_TYPE_NAME);
- JavaResourcePersistentAttribute attributeResource = typeResource.persistableAttributes().next();
-
- assertEquals(3, CollectionTools.size(attributeResource.supportingAnnotations(JoinColumnAnnotation.ANNOTATION_NAME, JoinColumnsAnnotation.ANNOTATION_NAME)));
-
- joinColumns.removeSpecifiedJoinColumn(1);
-
- Iterator<NestableAnnotation> joinColumnResources = attributeResource.supportingAnnotations(JoinColumnAnnotation.ANNOTATION_NAME, JoinColumnsAnnotation.ANNOTATION_NAME);
- assertEquals("FOO", ((JoinColumnAnnotation) joinColumnResources.next()).getName());
- assertEquals("BAZ", ((JoinColumnAnnotation) joinColumnResources.next()).getName());
- assertFalse(joinColumnResources.hasNext());
-
- Iterator<? extends JoinColumn> joinColumnsIterator = joinColumns.specifiedJoinColumns();
- assertEquals("FOO", joinColumnsIterator.next().getName());
- assertEquals("BAZ", joinColumnsIterator.next().getName());
- assertFalse(joinColumnsIterator.hasNext());
-
-
- joinColumns.removeSpecifiedJoinColumn(1);
- joinColumnResources = attributeResource.supportingAnnotations(JoinColumnAnnotation.ANNOTATION_NAME, JoinColumnsAnnotation.ANNOTATION_NAME);
- assertEquals("FOO", ((JoinColumnAnnotation) joinColumnResources.next()).getName());
- assertFalse(joinColumnResources.hasNext());
-
- joinColumnsIterator = joinColumns.specifiedJoinColumns();
- assertEquals("FOO", joinColumnsIterator.next().getName());
- assertFalse(joinColumnsIterator.hasNext());
-
-
- joinColumns.removeSpecifiedJoinColumn(0);
- joinColumnResources = attributeResource.supportingAnnotations(JoinColumnAnnotation.ANNOTATION_NAME, JoinColumnsAnnotation.ANNOTATION_NAME);
- assertFalse(joinColumnResources.hasNext());
- joinColumnsIterator = joinColumns.specifiedJoinColumns();
- assertFalse(joinColumnsIterator.hasNext());
-
- assertNull(attributeResource.getSupportingAnnotation(JoinColumnsAnnotation.ANNOTATION_NAME));
- }
-
- public void testMoveSpecifiedJoinColumn() throws Exception {
- createTestEntityWithManyToOneMapping();
- addXmlClassRef(FULLY_QUALIFIED_TYPE_NAME);
-
- PersistentAttribute persistentAttribute = getJavaPersistentType().attributes().next();
- ManyToOneMapping manyToOneMapping = (ManyToOneMapping) persistentAttribute.getMapping();
- JoinColumnJoiningStrategy joinColumns = manyToOneMapping.getRelationshipReference().getJoinColumnJoiningStrategy();
-
- joinColumns.addSpecifiedJoinColumn(0).setSpecifiedName("FOO");
- joinColumns.addSpecifiedJoinColumn(1).setSpecifiedName("BAR");
- joinColumns.addSpecifiedJoinColumn(2).setSpecifiedName("BAZ");
-
- JavaResourcePersistentAttribute attributeResource = getJpaProject().getJavaResourcePersistentType(FULLY_QUALIFIED_TYPE_NAME).persistableAttributes().next();
-
- ListIterator<NestableAnnotation> javaJoinColumns = attributeResource.supportingAnnotations(JoinColumnAnnotation.ANNOTATION_NAME, JoinColumnsAnnotation.ANNOTATION_NAME);
- assertEquals(3, CollectionTools.size(javaJoinColumns));
-
-
- joinColumns.moveSpecifiedJoinColumn(2, 0);
- ListIterator<? extends JoinColumn> primaryKeyJoinColumns = joinColumns.specifiedJoinColumns();
- assertEquals("BAR", primaryKeyJoinColumns.next().getSpecifiedName());
- assertEquals("BAZ", primaryKeyJoinColumns.next().getSpecifiedName());
- assertEquals("FOO", primaryKeyJoinColumns.next().getSpecifiedName());
-
- javaJoinColumns = attributeResource.supportingAnnotations(JoinColumnAnnotation.ANNOTATION_NAME, JoinColumnsAnnotation.ANNOTATION_NAME);
- assertEquals("BAR", ((JoinColumnAnnotation) javaJoinColumns.next()).getName());
- assertEquals("BAZ", ((JoinColumnAnnotation) javaJoinColumns.next()).getName());
- assertEquals("FOO", ((JoinColumnAnnotation) javaJoinColumns.next()).getName());
-
-
- joinColumns.moveSpecifiedJoinColumn(0, 1);
- primaryKeyJoinColumns = joinColumns.specifiedJoinColumns();
- assertEquals("BAZ", primaryKeyJoinColumns.next().getSpecifiedName());
- assertEquals("BAR", primaryKeyJoinColumns.next().getSpecifiedName());
- assertEquals("FOO", primaryKeyJoinColumns.next().getSpecifiedName());
-
- javaJoinColumns = attributeResource.supportingAnnotations(JoinColumnAnnotation.ANNOTATION_NAME, JoinColumnsAnnotation.ANNOTATION_NAME);
- assertEquals("BAZ", ((JoinColumnAnnotation) javaJoinColumns.next()).getName());
- assertEquals("BAR", ((JoinColumnAnnotation) javaJoinColumns.next()).getName());
- assertEquals("FOO", ((JoinColumnAnnotation) javaJoinColumns.next()).getName());
- }
-
- public void testUpdateSpecifiedJoinColumns() throws Exception {
- createTestEntityWithManyToOneMapping();
- addXmlClassRef(FULLY_QUALIFIED_TYPE_NAME);
-
- PersistentAttribute persistentAttribute = getJavaPersistentType().attributes().next();
- ManyToOneMapping manyToOneMapping = (ManyToOneMapping) persistentAttribute.getMapping();
- JoinColumnJoiningStrategy joinColumns = manyToOneMapping.getRelationshipReference().getJoinColumnJoiningStrategy();
- JavaResourcePersistentAttribute attributeResource = getJpaProject().getJavaResourcePersistentType(FULLY_QUALIFIED_TYPE_NAME).persistableAttributes().next();
-
- ((JoinColumnAnnotation) attributeResource.addSupportingAnnotation(0, JoinColumnAnnotation.ANNOTATION_NAME, JoinColumnsAnnotation.ANNOTATION_NAME)).setName("FOO");
- ((JoinColumnAnnotation) attributeResource.addSupportingAnnotation(1, JoinColumnAnnotation.ANNOTATION_NAME, JoinColumnsAnnotation.ANNOTATION_NAME)).setName("BAR");
- ((JoinColumnAnnotation) attributeResource.addSupportingAnnotation(2, JoinColumnAnnotation.ANNOTATION_NAME, JoinColumnsAnnotation.ANNOTATION_NAME)).setName("BAZ");
-
- ListIterator<? extends JoinColumn> joinColumnsIterator = joinColumns.specifiedJoinColumns();
- assertEquals("FOO", joinColumnsIterator.next().getName());
- assertEquals("BAR", joinColumnsIterator.next().getName());
- assertEquals("BAZ", joinColumnsIterator.next().getName());
- assertFalse(joinColumnsIterator.hasNext());
-
- attributeResource.moveSupportingAnnotation(2, 0, JoinColumnsAnnotation.ANNOTATION_NAME);
- joinColumnsIterator = joinColumns.specifiedJoinColumns();
- assertEquals("BAR", joinColumnsIterator.next().getName());
- assertEquals("BAZ", joinColumnsIterator.next().getName());
- assertEquals("FOO", joinColumnsIterator.next().getName());
- assertFalse(joinColumnsIterator.hasNext());
-
- attributeResource.moveSupportingAnnotation(0, 1, JoinColumnsAnnotation.ANNOTATION_NAME);
- joinColumnsIterator = joinColumns.specifiedJoinColumns();
- assertEquals("BAZ", joinColumnsIterator.next().getName());
- assertEquals("BAR", joinColumnsIterator.next().getName());
- assertEquals("FOO", joinColumnsIterator.next().getName());
- assertFalse(joinColumnsIterator.hasNext());
-
- attributeResource.removeSupportingAnnotation(1, JoinColumnAnnotation.ANNOTATION_NAME, JoinColumnsAnnotation.ANNOTATION_NAME);
- joinColumnsIterator = joinColumns.specifiedJoinColumns();
- assertEquals("BAZ", joinColumnsIterator.next().getName());
- assertEquals("FOO", joinColumnsIterator.next().getName());
- assertFalse(joinColumnsIterator.hasNext());
-
- attributeResource.removeSupportingAnnotation(1, JoinColumnAnnotation.ANNOTATION_NAME, JoinColumnsAnnotation.ANNOTATION_NAME);
- joinColumnsIterator = joinColumns.specifiedJoinColumns();
- assertEquals("BAZ", joinColumnsIterator.next().getName());
- assertFalse(joinColumnsIterator.hasNext());
-
- attributeResource.removeSupportingAnnotation(0, JoinColumnAnnotation.ANNOTATION_NAME, JoinColumnsAnnotation.ANNOTATION_NAME);
- joinColumnsIterator = joinColumns.specifiedJoinColumns();
- assertFalse(joinColumnsIterator.hasNext());
- }
- public void testJoinColumnIsVirtual() throws Exception {
- createTestEntityWithManyToOneMapping();
- addXmlClassRef(FULLY_QUALIFIED_TYPE_NAME);
-
- PersistentAttribute persistentAttribute = getJavaPersistentType().attributes().next();
- ManyToOneMapping manyToOneMapping = (ManyToOneMapping) persistentAttribute.getMapping();
- JoinColumnJoiningStrategy joinColumns = manyToOneMapping.getRelationshipReference().getJoinColumnJoiningStrategy();
-
- assertTrue(joinColumns.getDefaultJoinColumn().isVirtual());
-
- joinColumns.addSpecifiedJoinColumn(0);
- JoinColumn specifiedJoinColumn = joinColumns.specifiedJoinColumns().next();
- assertFalse(specifiedJoinColumn.isVirtual());
-
- assertNull(joinColumns.getDefaultJoinColumn());
- }
-
- public void testDefaultTargetEntity() throws Exception {
- createTestEntityWithValidManyToOneMapping();
- createTestTargetEntityAddress();
- addXmlClassRef(FULLY_QUALIFIED_TYPE_NAME);
-
- PersistentAttribute persistentAttribute = getJavaPersistentType().attributes().next();
- ManyToOneMapping manyToOneMapping = (ManyToOneMapping) persistentAttribute.getMapping();
-
- //targetEntity not in the persistence unit, default still set, handled by validation
- assertEquals(PACKAGE_NAME + ".Address", manyToOneMapping.getDefaultTargetEntity());
-
- //add targetEntity to the persistence unit
- addXmlClassRef(PACKAGE_NAME + ".Address");
- assertEquals(PACKAGE_NAME + ".Address", manyToOneMapping.getDefaultTargetEntity());
-
- //test default still the same when specified target entity it set
- manyToOneMapping.setSpecifiedTargetEntity("foo");
- assertEquals(PACKAGE_NAME + ".Address", manyToOneMapping.getDefaultTargetEntity());
-
- ListIterator<ClassRef> classRefs = getPersistenceUnit().specifiedClassRefs();
- classRefs.next();
- ClassRef addressClassRef = classRefs.next();
- JavaPersistentType addressPersistentType = addressClassRef.getJavaPersistentType();
-
- //test target is not an Entity, default target entity still exists, this case handled with validation
- addressPersistentType.setMappingKey(MappingKeys.NULL_TYPE_MAPPING_KEY);
- assertEquals(PACKAGE_NAME + ".Address", manyToOneMapping.getDefaultTargetEntity());
- }
-
- public void testDefaultTargetEntityCollectionType() throws Exception {
- createTestEntityWithCollectionManyToOneMapping();
- createTestTargetEntityAddress();
- addXmlClassRef(FULLY_QUALIFIED_TYPE_NAME);
- addXmlClassRef(PACKAGE_NAME + ".Address");
-
- PersistentAttribute persistentAttribute = getJavaPersistentType().attributes().next();
- ManyToOneMapping manyToOneMapping = (ManyToOneMapping) persistentAttribute.getMapping();
-
- assertNull(manyToOneMapping.getDefaultTargetEntity());
- }
-
- public void testDefaultTargetEntityGenericizedCollectionType() throws Exception {
- createTestEntityWithGenericizedCollectionManyToOneMapping();
- createTestTargetEntityAddress();
- addXmlClassRef(FULLY_QUALIFIED_TYPE_NAME);
- addXmlClassRef(PACKAGE_NAME + ".Address");
-
- PersistentAttribute persistentAttribute = getJavaPersistentType().attributes().next();
- ManyToOneMapping manyToOneMapping = (ManyToOneMapping) persistentAttribute.getMapping();
-
- assertNull(manyToOneMapping.getDefaultTargetEntity());
- }
-
- public void testTargetEntity() throws Exception {
- createTestEntityWithValidManyToOneMapping();
- createTestTargetEntityAddress();
- addXmlClassRef(FULLY_QUALIFIED_TYPE_NAME);
- addXmlClassRef(PACKAGE_NAME + ".Address");
-
- PersistentAttribute persistentAttribute = getJavaPersistentType().attributes().next();
- ManyToOneMapping manyToOneMapping = (ManyToOneMapping) persistentAttribute.getMapping();
-
- assertEquals(PACKAGE_NAME + ".Address", manyToOneMapping.getTargetEntity());
-
- manyToOneMapping.setSpecifiedTargetEntity("foo");
- assertEquals("foo", manyToOneMapping.getTargetEntity());
-
- manyToOneMapping.setSpecifiedTargetEntity(null);
- assertEquals(PACKAGE_NAME + ".Address", manyToOneMapping.getTargetEntity());
- }
-
- public void testResolvedTargetEntity() throws Exception {
- createTestEntityWithValidManyToOneMapping();
- addXmlClassRef(FULLY_QUALIFIED_TYPE_NAME);
-
- PersistentAttribute persistentAttribute = getJavaPersistentType().attributes().next();
- ManyToOneMapping manyToOneMapping = (ManyToOneMapping) persistentAttribute.getMapping();
-
- //targetEntity not in the persistence unit
- assertNull(manyToOneMapping.getResolvedTargetEntity());
-
- //add targetEntity to the persistence unit, now target entity should resolve
- createTestTargetEntityAddress();
- addXmlClassRef(PACKAGE_NAME + ".Address");
- ListIterator<ClassRef> classRefs = getPersistenceUnit().specifiedClassRefs();
- classRefs.next();
- ClassRef addressClassRef = classRefs.next();
- TypeMapping addressTypeMapping = addressClassRef.getJavaPersistentType().getMapping();
- assertEquals(addressTypeMapping, manyToOneMapping.getResolvedTargetEntity());
-
- //test default still the same when specified target entity it set
- manyToOneMapping.setSpecifiedTargetEntity("foo");
- assertNull(manyToOneMapping.getResolvedTargetEntity());
-
-
- manyToOneMapping.setSpecifiedTargetEntity(PACKAGE_NAME + ".Address");
- assertEquals(addressTypeMapping, manyToOneMapping.getResolvedTargetEntity());
-
-
- manyToOneMapping.setSpecifiedTargetEntity(null);
- assertEquals(addressTypeMapping, manyToOneMapping.getResolvedTargetEntity());
- }
-
-}
diff --git a/jpa/tests/org.eclipse.jpt.core.tests/src/org/eclipse/jpt/core/tests/internal/context/java/JavaMappedSuperclassTests.java b/jpa/tests/org.eclipse.jpt.core.tests/src/org/eclipse/jpt/core/tests/internal/context/java/JavaMappedSuperclassTests.java
deleted file mode 100644
index d951c22f56..0000000000
--- a/jpa/tests/org.eclipse.jpt.core.tests/src/org/eclipse/jpt/core/tests/internal/context/java/JavaMappedSuperclassTests.java
+++ /dev/null
@@ -1,245 +0,0 @@
-/*******************************************************************************
- * Copyright (c) 2007, 2008 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.
- *
- * Contributors:
- * Oracle - initial API and implementation
- ******************************************************************************/
-package org.eclipse.jpt.core.tests.internal.context.java;
-
-import java.util.Iterator;
-import org.eclipse.jdt.core.ICompilationUnit;
-import org.eclipse.jpt.core.MappingKeys;
-import org.eclipse.jpt.core.context.Embeddable;
-import org.eclipse.jpt.core.context.Entity;
-import org.eclipse.jpt.core.context.MappedSuperclass;
-import org.eclipse.jpt.core.internal.context.java.JavaNullTypeMapping;
-import org.eclipse.jpt.core.resource.java.IdClassAnnotation;
-import org.eclipse.jpt.core.resource.java.JPA;
-import org.eclipse.jpt.core.resource.java.JavaResourcePersistentType;
-import org.eclipse.jpt.core.resource.java.MappedSuperclassAnnotation;
-import org.eclipse.jpt.core.tests.internal.context.ContextModelTestCase;
-import org.eclipse.jpt.utility.internal.iterators.ArrayIterator;
-
-public class JavaMappedSuperclassTests extends ContextModelTestCase
-{
-
- private ICompilationUnit createTestMappedSuperclass() throws Exception {
- return this.createTestType(new DefaultAnnotationWriter() {
- @Override
- public Iterator<String> imports() {
- return new ArrayIterator<String>(JPA.MAPPED_SUPERCLASS);
- }
- @Override
- public void appendTypeAnnotationTo(StringBuilder sb) {
- sb.append("@MappedSuperclass");
- }
- });
- }
-
-
- public JavaMappedSuperclassTests(String name) {
- super(name);
- }
-
- public void testMorphToEntity() throws Exception {
- createTestMappedSuperclass();
- addXmlClassRef(FULLY_QUALIFIED_TYPE_NAME);
-
- MappedSuperclass mappedSuperclass = (MappedSuperclass) getJavaPersistentType().getMapping();
- mappedSuperclass.setIdClass("myIdClass");
-
- getJavaPersistentType().setMappingKey(MappingKeys.ENTITY_TYPE_MAPPING_KEY);
- assertTrue(getJavaPersistentType().getMapping() instanceof Entity);
-
- JavaResourcePersistentType typeResource = getJpaProject().getJavaResourcePersistentType(FULLY_QUALIFIED_TYPE_NAME);
- assertNull(typeResource.getMappingAnnotation(MappedSuperclassAnnotation.ANNOTATION_NAME));
- assertNotNull(typeResource.getSupportingAnnotation(IdClassAnnotation.ANNOTATION_NAME));
- }
-
- public void testMorphToEmbeddable() throws Exception {
- createTestMappedSuperclass();
- addXmlClassRef(FULLY_QUALIFIED_TYPE_NAME);
-
- MappedSuperclass mappedSuperclass = (MappedSuperclass) getJavaPersistentType().getMapping();
- mappedSuperclass.setIdClass("myIdClass");
-
- getJavaPersistentType().setMappingKey(MappingKeys.EMBEDDABLE_TYPE_MAPPING_KEY);
- assertTrue(getJavaPersistentType().getMapping() instanceof Embeddable);
-
- JavaResourcePersistentType typeResource = getJpaProject().getJavaResourcePersistentType(FULLY_QUALIFIED_TYPE_NAME);
- assertNull(typeResource.getMappingAnnotation(MappedSuperclassAnnotation.ANNOTATION_NAME));
- assertNull(typeResource.getSupportingAnnotation(IdClassAnnotation.ANNOTATION_NAME));
- }
-
- public void testMorphToNull() throws Exception {
- createTestMappedSuperclass();
- addXmlClassRef(FULLY_QUALIFIED_TYPE_NAME);
-
- MappedSuperclass mappedSuperclass = (MappedSuperclass) getJavaPersistentType().getMapping();
- mappedSuperclass.setIdClass("myIdClass");
-
- getJavaPersistentType().setMappingKey(MappingKeys.NULL_TYPE_MAPPING_KEY);
- assertTrue(getJavaPersistentType().getMapping() instanceof JavaNullTypeMapping);
-
- JavaResourcePersistentType typeResource = getJpaProject().getJavaResourcePersistentType(FULLY_QUALIFIED_TYPE_NAME);
- assertNull(typeResource.getMappingAnnotation(MappedSuperclassAnnotation.ANNOTATION_NAME));
- assertNull(typeResource.getSupportingAnnotation(IdClassAnnotation.ANNOTATION_NAME));
- }
-
-
- public void testMappedSuperclass() throws Exception {
- createTestMappedSuperclass();
- addXmlClassRef(FULLY_QUALIFIED_TYPE_NAME);
- assertTrue(getJavaPersistentType().getMapping() instanceof MappedSuperclass);
- }
-
- public void testOverridableAttributeNames() throws Exception {
- createTestMappedSuperclass();
- addXmlClassRef(FULLY_QUALIFIED_TYPE_NAME);
-
- MappedSuperclass mappedSuperclass = (MappedSuperclass) getJavaPersistentType().getMapping();
- Iterator<String> overridableAttributeNames = mappedSuperclass.overridableAttributeNames();
- assertEquals("id", overridableAttributeNames.next());
- assertEquals("name", overridableAttributeNames.next());
- assertFalse(overridableAttributeNames.hasNext());
- }
-
- public void testOverridableAssociationNames() throws Exception {
- createTestMappedSuperclass();
- addXmlClassRef(FULLY_QUALIFIED_TYPE_NAME);
-
- MappedSuperclass mappedSuperclass = (MappedSuperclass) getJavaPersistentType().getMapping();
- Iterator<String> overridableAssociationNames = mappedSuperclass.overridableAssociationNames();
- assertFalse(overridableAssociationNames.hasNext());
- }
-
- public void testTableNameIsInvalid() throws Exception {
- createTestMappedSuperclass();
- addXmlClassRef(FULLY_QUALIFIED_TYPE_NAME);
-
- MappedSuperclass mappedSuperclass = (MappedSuperclass) getJavaPersistentType().getMapping();
-
- assertFalse(mappedSuperclass.tableNameIsInvalid(FULLY_QUALIFIED_TYPE_NAME));
- assertFalse(mappedSuperclass.tableNameIsInvalid("FOO"));
- }
-
- public void testAssociatedTables() throws Exception {
- createTestMappedSuperclass();
- addXmlClassRef(FULLY_QUALIFIED_TYPE_NAME);
-
- MappedSuperclass mappedSuperclass = (MappedSuperclass) getJavaPersistentType().getMapping();
-
- assertFalse(mappedSuperclass.associatedTables().hasNext());
- }
-
- public void testAssociatedTablesIncludingInherited() throws Exception {
- createTestMappedSuperclass();
- addXmlClassRef(FULLY_QUALIFIED_TYPE_NAME);
-
- MappedSuperclass mappedSuperclass = (MappedSuperclass) getJavaPersistentType().getMapping();
-
- assertFalse(mappedSuperclass.associatedTablesIncludingInherited().hasNext());
- }
-
- public void testAssociatedTableNamesIncludingInherited() throws Exception {
- createTestMappedSuperclass();
- addXmlClassRef(FULLY_QUALIFIED_TYPE_NAME);
-
- MappedSuperclass mappedSuperclass = (MappedSuperclass) getJavaPersistentType().getMapping();
-
- assertFalse(mappedSuperclass.associatedTableNamesIncludingInherited().hasNext());
- }
-
- public void testAllOverridableAttributeNames() throws Exception {
- createTestMappedSuperclass();
- addXmlClassRef(FULLY_QUALIFIED_TYPE_NAME);
-
- MappedSuperclass mappedSuperclass = (MappedSuperclass) getJavaPersistentType().getMapping();
- Iterator<String> overridableAttributeNames = mappedSuperclass.overridableAttributeNames();
- assertEquals("id", overridableAttributeNames.next());
- assertEquals("name", overridableAttributeNames.next());
- assertFalse(overridableAttributeNames.hasNext());
- }
-
- //TODO need to create a subclass mappedSuperclass and test this
- public void testAllOverridableAssociationNames() throws Exception {
- createTestMappedSuperclass();
- addXmlClassRef(FULLY_QUALIFIED_TYPE_NAME);
-
- MappedSuperclass mappedSuperclass = (MappedSuperclass) getJavaPersistentType().getMapping();
- Iterator<String> overridableAssociationNames = mappedSuperclass.overridableAssociationNames();
- assertFalse(overridableAssociationNames.hasNext());
- }
-
- public void testAttributeMappingKeyAllowed() throws Exception {
- createTestMappedSuperclass();
- addXmlClassRef(FULLY_QUALIFIED_TYPE_NAME);
-
- MappedSuperclass mappedSuperclass = (MappedSuperclass) getJavaPersistentType().getMapping();
- assertTrue(mappedSuperclass.attributeMappingKeyAllowed(MappingKeys.BASIC_ATTRIBUTE_MAPPING_KEY));
- assertTrue(mappedSuperclass.attributeMappingKeyAllowed(MappingKeys.ID_ATTRIBUTE_MAPPING_KEY));
- assertTrue(mappedSuperclass.attributeMappingKeyAllowed(MappingKeys.EMBEDDED_ATTRIBUTE_MAPPING_KEY));
- assertTrue(mappedSuperclass.attributeMappingKeyAllowed(MappingKeys.EMBEDDED_ID_ATTRIBUTE_MAPPING_KEY));
- assertTrue(mappedSuperclass.attributeMappingKeyAllowed(MappingKeys.VERSION_ATTRIBUTE_MAPPING_KEY));
- assertTrue(mappedSuperclass.attributeMappingKeyAllowed(MappingKeys.TRANSIENT_ATTRIBUTE_MAPPING_KEY));
- assertTrue(mappedSuperclass.attributeMappingKeyAllowed(MappingKeys.ONE_TO_ONE_ATTRIBUTE_MAPPING_KEY));
- assertTrue(mappedSuperclass.attributeMappingKeyAllowed(MappingKeys.MANY_TO_ONE_ATTRIBUTE_MAPPING_KEY));
- assertTrue(mappedSuperclass.attributeMappingKeyAllowed(MappingKeys.ONE_TO_MANY_ATTRIBUTE_MAPPING_KEY));
- assertTrue(mappedSuperclass.attributeMappingKeyAllowed(MappingKeys.MANY_TO_MANY_ATTRIBUTE_MAPPING_KEY));
- }
-
- public void testUpdateIdClass() throws Exception {
- createTestMappedSuperclass();
- addXmlClassRef(FULLY_QUALIFIED_TYPE_NAME);
-
- JavaResourcePersistentType typeResource = getJpaProject().getJavaResourcePersistentType(FULLY_QUALIFIED_TYPE_NAME);
- MappedSuperclass mappedSuperclass = (MappedSuperclass) getJavaPersistentType().getMapping();
-
- assertNull(mappedSuperclass.getIdClass());
- assertNull(typeResource.getSupportingAnnotation(IdClassAnnotation.ANNOTATION_NAME));
-
- IdClassAnnotation idClass = (IdClassAnnotation) typeResource.addSupportingAnnotation(IdClassAnnotation.ANNOTATION_NAME);
- assertNull(mappedSuperclass.getIdClass());
- assertNotNull(typeResource.getSupportingAnnotation(IdClassAnnotation.ANNOTATION_NAME));
-
- idClass.setValue("model.Foo");
- assertEquals("model.Foo", mappedSuperclass.getIdClass());
- assertEquals("model.Foo", ((IdClassAnnotation) typeResource.getSupportingAnnotation(IdClassAnnotation.ANNOTATION_NAME)).getValue());
-
- //test setting @IdClass value to null, IdClass annotation is removed
- idClass.setValue(null);
- assertNull(mappedSuperclass.getIdClass());
- assertNull(typeResource.getSupportingAnnotation(IdClassAnnotation.ANNOTATION_NAME));
-
- //reset @IdClass value and then remove @IdClass
- idClass = (IdClassAnnotation) typeResource.addSupportingAnnotation(IdClassAnnotation.ANNOTATION_NAME);
- idClass.setValue("model.Foo");
- typeResource.removeSupportingAnnotation(IdClassAnnotation.ANNOTATION_NAME);
-
- assertNull(mappedSuperclass.getIdClass());
- assertNull(typeResource.getSupportingAnnotation(IdClassAnnotation.ANNOTATION_NAME));
- }
-
- public void testModifyIdClass() throws Exception {
- createTestMappedSuperclass();
- addXmlClassRef(FULLY_QUALIFIED_TYPE_NAME);
-
- JavaResourcePersistentType typeResource = getJpaProject().getJavaResourcePersistentType(FULLY_QUALIFIED_TYPE_NAME);
- MappedSuperclass mappedSuperclass = (MappedSuperclass) getJavaPersistentType().getMapping();
-
- assertNull(mappedSuperclass.getIdClass());
- assertNull(typeResource.getSupportingAnnotation(IdClassAnnotation.ANNOTATION_NAME));
-
- mappedSuperclass.setIdClass("model.Foo");
- assertEquals("model.Foo", ((IdClassAnnotation) typeResource.getSupportingAnnotation(IdClassAnnotation.ANNOTATION_NAME)).getValue());
- assertEquals("model.Foo", mappedSuperclass.getIdClass());
-
- mappedSuperclass.setIdClass(null);
- assertNull(mappedSuperclass.getIdClass());
- assertNull(typeResource.getSupportingAnnotation(IdClassAnnotation.ANNOTATION_NAME));
- }
-
-}
diff --git a/jpa/tests/org.eclipse.jpt.core.tests/src/org/eclipse/jpt/core/tests/internal/context/java/JavaNamedNativeQueryTests.java b/jpa/tests/org.eclipse.jpt.core.tests/src/org/eclipse/jpt/core/tests/internal/context/java/JavaNamedNativeQueryTests.java
deleted file mode 100644
index 66139509fa..0000000000
--- a/jpa/tests/org.eclipse.jpt.core.tests/src/org/eclipse/jpt/core/tests/internal/context/java/JavaNamedNativeQueryTests.java
+++ /dev/null
@@ -1,425 +0,0 @@
-/*******************************************************************************
- * Copyright (c) 2007, 2009 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.
- *
- * Contributors:
- * Oracle - initial API and implementation
- ******************************************************************************/
-package org.eclipse.jpt.core.tests.internal.context.java;
-
-import java.util.Iterator;
-import java.util.ListIterator;
-import org.eclipse.jdt.core.ICompilationUnit;
-import org.eclipse.jpt.core.context.Entity;
-import org.eclipse.jpt.core.context.NamedNativeQuery;
-import org.eclipse.jpt.core.context.QueryHint;
-import org.eclipse.jpt.core.resource.java.JPA;
-import org.eclipse.jpt.core.resource.java.JavaResourcePersistentType;
-import org.eclipse.jpt.core.resource.java.NamedNativeQueryAnnotation;
-import org.eclipse.jpt.core.tests.internal.context.ContextModelTestCase;
-import org.eclipse.jpt.utility.internal.iterators.ArrayIterator;
-
-@SuppressWarnings("nls")
-public class JavaNamedNativeQueryTests extends ContextModelTestCase
-{
- private static final String QUERY_NAME = "QUERY_NAME";
- private static final String QUERY_QUERY = "MY_QUERY";
-
- private ICompilationUnit createTestEntityWithNamedNativeQuery() throws Exception {
- return this.createTestType(new DefaultAnnotationWriter() {
- @Override
- public Iterator<String> imports() {
- return new ArrayIterator<String>(JPA.ENTITY, JPA.NAMED_NATIVE_QUERY);
- }
- @Override
- public void appendTypeAnnotationTo(StringBuilder sb) {
- sb.append("@Entity").append(CR);
- sb.append("@NamedNativeQuery(name=\"" + QUERY_NAME + "\", query=\"" + QUERY_QUERY + "\")");
- }
- });
- }
-
-
-
- public JavaNamedNativeQueryTests(String name) {
- super(name);
- }
-
- public void testUpdateName() throws Exception {
- createTestEntityWithNamedNativeQuery();
- addXmlClassRef(FULLY_QUALIFIED_TYPE_NAME);
-
- Entity entity = getJavaEntity();
- NamedNativeQuery namedNativeQuery = entity.getQueryContainer().namedNativeQueries().next();
-
- JavaResourcePersistentType typeResource = getJpaProject().getJavaResourcePersistentType(FULLY_QUALIFIED_TYPE_NAME);
- NamedNativeQueryAnnotation javaNamedNativeQuery = (NamedNativeQueryAnnotation) typeResource.getSupportingAnnotation(NamedNativeQueryAnnotation.ANNOTATION_NAME);
-
- assertEquals(QUERY_NAME, javaNamedNativeQuery.getName());
- assertEquals(QUERY_NAME, namedNativeQuery.getName());
-
- //set name to null in the resource model
- javaNamedNativeQuery.setName(null);
- assertNull(javaNamedNativeQuery.getName());
- assertNull(namedNativeQuery.getName());
-
- //set name in the resource model, verify context model updated
- javaNamedNativeQuery.setName("foo");
- assertEquals("foo", javaNamedNativeQuery.getName());
- assertEquals("foo", namedNativeQuery.getName());
- }
-
- public void testModifyName() throws Exception {
- createTestEntityWithNamedNativeQuery();
- addXmlClassRef(FULLY_QUALIFIED_TYPE_NAME);
- Entity entity = getJavaEntity();
- NamedNativeQuery namedNativeQuery = entity.getQueryContainer().namedNativeQueries().next();
-
- JavaResourcePersistentType typeResource = getJpaProject().getJavaResourcePersistentType(FULLY_QUALIFIED_TYPE_NAME);
- NamedNativeQueryAnnotation javaNamedNativeQuery = (NamedNativeQueryAnnotation) typeResource.getSupportingAnnotation(NamedNativeQueryAnnotation.ANNOTATION_NAME);
-
- assertEquals(QUERY_NAME, javaNamedNativeQuery.getName());
- assertEquals(QUERY_NAME, namedNativeQuery.getName());
-
- //set name to null in the context model
- namedNativeQuery.setName(null);
- assertNull(javaNamedNativeQuery.getName());
- assertNull(namedNativeQuery.getName());
-
- //set name in the context model, verify resource model updated
- namedNativeQuery.setName("foo");
- assertEquals("foo", javaNamedNativeQuery.getName());
- assertEquals("foo", namedNativeQuery.getName());
- }
-
- public void testUpdateQuery() throws Exception {
- createTestEntityWithNamedNativeQuery();
- addXmlClassRef(FULLY_QUALIFIED_TYPE_NAME);
-
- Entity entity = getJavaEntity();
- NamedNativeQuery namedNativeQuery = entity.getQueryContainer().namedNativeQueries().next();
-
- JavaResourcePersistentType typeResource = getJpaProject().getJavaResourcePersistentType(FULLY_QUALIFIED_TYPE_NAME);
- NamedNativeQueryAnnotation javaNamedNativeQuery = (NamedNativeQueryAnnotation) typeResource.getSupportingAnnotation(NamedNativeQueryAnnotation.ANNOTATION_NAME);
-
- assertEquals(QUERY_QUERY, javaNamedNativeQuery.getQuery());
- assertEquals(QUERY_QUERY, namedNativeQuery.getQuery());
-
- //set name to null in the resource model
- javaNamedNativeQuery.setQuery(null);
- assertNull(javaNamedNativeQuery.getQuery());
- assertNull(namedNativeQuery.getQuery());
-
- //set name in the resource model, verify context model updated
- javaNamedNativeQuery.setQuery("foo");
- assertEquals("foo", javaNamedNativeQuery.getQuery());
- assertEquals("foo", namedNativeQuery.getQuery());
- }
-
- public void testModifyQuery() throws Exception {
- createTestEntityWithNamedNativeQuery();
- addXmlClassRef(FULLY_QUALIFIED_TYPE_NAME);
- Entity entity = getJavaEntity();
- NamedNativeQuery namedNativeQuery = entity.getQueryContainer().namedNativeQueries().next();
-
- JavaResourcePersistentType typeResource = getJpaProject().getJavaResourcePersistentType(FULLY_QUALIFIED_TYPE_NAME);
- NamedNativeQueryAnnotation javaNamedNativeQuery = (NamedNativeQueryAnnotation) typeResource.getSupportingAnnotation(NamedNativeQueryAnnotation.ANNOTATION_NAME);
-
- assertEquals(QUERY_QUERY, javaNamedNativeQuery.getQuery());
- assertEquals(QUERY_QUERY, namedNativeQuery.getQuery());
-
- //set name to null in the context model
- namedNativeQuery.setQuery(null);
- assertNull(javaNamedNativeQuery.getQuery());
- assertNull(namedNativeQuery.getQuery());
-
- //set name in the context model, verify resource model updated
- namedNativeQuery.setQuery("foo");
- assertEquals("foo", javaNamedNativeQuery.getQuery());
- assertEquals("foo", namedNativeQuery.getQuery());
- }
-
-
- public void testAddHint() throws Exception {
- createTestEntityWithNamedNativeQuery();
- addXmlClassRef(FULLY_QUALIFIED_TYPE_NAME);
- Entity entity = getJavaEntity();
- NamedNativeQuery namedNativeQuery = entity.getQueryContainer().namedNativeQueries().next();
-
- JavaResourcePersistentType typeResource = getJpaProject().getJavaResourcePersistentType(FULLY_QUALIFIED_TYPE_NAME);
- NamedNativeQueryAnnotation javaNamedNativeQuery = (NamedNativeQueryAnnotation) typeResource.getSupportingAnnotation(NamedNativeQueryAnnotation.ANNOTATION_NAME);
-
-
- QueryHint queryHint = namedNativeQuery.addHint(0);
- getOrmXmlResource().save(null);
- queryHint.setName("FOO");
- getOrmXmlResource().save(null);
-
- assertEquals("FOO", javaNamedNativeQuery.hintAt(0).getName());
-
- QueryHint queryHint2 = namedNativeQuery.addHint(0);
- getOrmXmlResource().save(null);
- queryHint2.setName("BAR");
- getOrmXmlResource().save(null);
-
- assertEquals("BAR", javaNamedNativeQuery.hintAt(0).getName());
- assertEquals("FOO", javaNamedNativeQuery.hintAt(1).getName());
-
- QueryHint queryHint3 = namedNativeQuery.addHint(1);
- getOrmXmlResource().save(null);
- queryHint3.setName("BAZ");
- getOrmXmlResource().save(null);
-
- assertEquals("BAR", javaNamedNativeQuery.hintAt(0).getName());
- assertEquals("BAZ", javaNamedNativeQuery.hintAt(1).getName());
- assertEquals("FOO", javaNamedNativeQuery.hintAt(2).getName());
-
- ListIterator<QueryHint> hints = namedNativeQuery.hints();
- assertEquals(queryHint2, hints.next());
- assertEquals(queryHint3, hints.next());
- assertEquals(queryHint, hints.next());
-
- hints = namedNativeQuery.hints();
- assertEquals("BAR", hints.next().getName());
- assertEquals("BAZ", hints.next().getName());
- assertEquals("FOO", hints.next().getName());
- }
-
- public void testRemoveHint() throws Exception {
- createTestEntityWithNamedNativeQuery();
- addXmlClassRef(FULLY_QUALIFIED_TYPE_NAME);
- Entity entity = getJavaEntity();
- NamedNativeQuery namedNativeQuery = entity.getQueryContainer().namedNativeQueries().next();
-
- JavaResourcePersistentType typeResource = getJpaProject().getJavaResourcePersistentType(FULLY_QUALIFIED_TYPE_NAME);
- NamedNativeQueryAnnotation javaNamedNativeQuery = (NamedNativeQueryAnnotation) typeResource.getSupportingAnnotation(NamedNativeQueryAnnotation.ANNOTATION_NAME);
-
- namedNativeQuery.addHint(0).setName("FOO");
- namedNativeQuery.addHint(1).setName("BAR");
- namedNativeQuery.addHint(2).setName("BAZ");
-
- assertEquals(3, javaNamedNativeQuery.hintsSize());
-
- namedNativeQuery.removeHint(0);
- assertEquals(2, javaNamedNativeQuery.hintsSize());
- assertEquals("BAR", javaNamedNativeQuery.hintAt(0).getName());
- assertEquals("BAZ", javaNamedNativeQuery.hintAt(1).getName());
-
- namedNativeQuery.removeHint(0);
- assertEquals(1, javaNamedNativeQuery.hintsSize());
- assertEquals("BAZ", javaNamedNativeQuery.hintAt(0).getName());
-
- namedNativeQuery.removeHint(0);
- assertEquals(0, javaNamedNativeQuery.hintsSize());
- }
-
- public void testMoveHint() throws Exception {
- createTestEntityWithNamedNativeQuery();
- addXmlClassRef(FULLY_QUALIFIED_TYPE_NAME);
- Entity entity = getJavaEntity();
- NamedNativeQuery namedNativeQuery = entity.getQueryContainer().namedNativeQueries().next();
-
- JavaResourcePersistentType typeResource = getJpaProject().getJavaResourcePersistentType(FULLY_QUALIFIED_TYPE_NAME);
- NamedNativeQueryAnnotation javaNamedNativeQuery = (NamedNativeQueryAnnotation) typeResource.getSupportingAnnotation(NamedNativeQueryAnnotation.ANNOTATION_NAME);
-
- namedNativeQuery.addHint(0).setName("FOO");
- namedNativeQuery.addHint(1).setName("BAR");
- namedNativeQuery.addHint(2).setName("BAZ");
-
- assertEquals(3, javaNamedNativeQuery.hintsSize());
-
-
- namedNativeQuery.moveHint(2, 0);
- ListIterator<QueryHint> hints = namedNativeQuery.hints();
- assertEquals("BAR", hints.next().getName());
- assertEquals("BAZ", hints.next().getName());
- assertEquals("FOO", hints.next().getName());
-
- assertEquals("BAR", javaNamedNativeQuery.hintAt(0).getName());
- assertEquals("BAZ", javaNamedNativeQuery.hintAt(1).getName());
- assertEquals("FOO", javaNamedNativeQuery.hintAt(2).getName());
-
-
- namedNativeQuery.moveHint(0, 1);
- hints = namedNativeQuery.hints();
- assertEquals("BAZ", hints.next().getName());
- assertEquals("BAR", hints.next().getName());
- assertEquals("FOO", hints.next().getName());
-
- assertEquals("BAZ", javaNamedNativeQuery.hintAt(0).getName());
- assertEquals("BAR", javaNamedNativeQuery.hintAt(1).getName());
- assertEquals("FOO", javaNamedNativeQuery.hintAt(2).getName());
- }
-
- public void testUpdateHints() throws Exception {
- createTestEntityWithNamedNativeQuery();
- addXmlClassRef(FULLY_QUALIFIED_TYPE_NAME);
- Entity entity = getJavaEntity();
- NamedNativeQuery namedNativeQuery = entity.getQueryContainer().namedNativeQueries().next();
-
- JavaResourcePersistentType typeResource = getJpaProject().getJavaResourcePersistentType(FULLY_QUALIFIED_TYPE_NAME);
- NamedNativeQueryAnnotation javaNamedNativeQuery = (NamedNativeQueryAnnotation) typeResource.getSupportingAnnotation(NamedNativeQueryAnnotation.ANNOTATION_NAME);
-
- javaNamedNativeQuery.addHint(0);
- javaNamedNativeQuery.addHint(1);
- javaNamedNativeQuery.addHint(2);
-
- javaNamedNativeQuery.hintAt(0).setName("FOO");
- javaNamedNativeQuery.hintAt(1).setName("BAR");
- javaNamedNativeQuery.hintAt(2).setName("BAZ");
-
- ListIterator<QueryHint> hints = namedNativeQuery.hints();
- assertEquals("FOO", hints.next().getName());
- assertEquals("BAR", hints.next().getName());
- assertEquals("BAZ", hints.next().getName());
- assertFalse(hints.hasNext());
-
- javaNamedNativeQuery.moveHint(2, 0);
- hints = namedNativeQuery.hints();
- assertEquals("BAR", hints.next().getName());
- assertEquals("BAZ", hints.next().getName());
- assertEquals("FOO", hints.next().getName());
- assertFalse(hints.hasNext());
-
- javaNamedNativeQuery.moveHint(0, 1);
- hints = namedNativeQuery.hints();
- assertEquals("BAZ", hints.next().getName());
- assertEquals("BAR", hints.next().getName());
- assertEquals("FOO", hints.next().getName());
- assertFalse(hints.hasNext());
-
- javaNamedNativeQuery.removeHint(1);
- hints = namedNativeQuery.hints();
- assertEquals("BAZ", hints.next().getName());
- assertEquals("FOO", hints.next().getName());
- assertFalse(hints.hasNext());
-
- javaNamedNativeQuery.removeHint(1);
- hints = namedNativeQuery.hints();
- assertEquals("BAZ", hints.next().getName());
- assertFalse(hints.hasNext());
-
- javaNamedNativeQuery.removeHint(0);
- assertFalse(namedNativeQuery.hints().hasNext());
- }
-
- public void testHintsSize() throws Exception {
- createTestEntityWithNamedNativeQuery();
- addXmlClassRef(FULLY_QUALIFIED_TYPE_NAME);
- Entity entity = getJavaEntity();
-
- NamedNativeQuery namedNativeQuery = entity.getQueryContainer().namedNativeQueries().next();
- assertEquals(0, namedNativeQuery.hintsSize());
-
- JavaResourcePersistentType typeResource = getJpaProject().getJavaResourcePersistentType(FULLY_QUALIFIED_TYPE_NAME);
- NamedNativeQueryAnnotation javaNamedNativeQuery = (NamedNativeQueryAnnotation) typeResource.getSupportingAnnotation(NamedNativeQueryAnnotation.ANNOTATION_NAME);
-
-
- javaNamedNativeQuery.addHint(0);
- assertEquals(1, namedNativeQuery.hintsSize());
-
- javaNamedNativeQuery.addHint(0);
- assertEquals(2, namedNativeQuery.hintsSize());
-
- javaNamedNativeQuery.removeHint(0);
- javaNamedNativeQuery.removeHint(0);
- assertEquals(0, namedNativeQuery.hintsSize());
- }
-
- public void testUpdateResultClass() throws Exception {
- createTestEntityWithNamedNativeQuery();
- addXmlClassRef(FULLY_QUALIFIED_TYPE_NAME);
-
- Entity entity = getJavaEntity();
- NamedNativeQuery namedNativeQuery = entity.getQueryContainer().namedNativeQueries().next();
-
- JavaResourcePersistentType typeResource = getJpaProject().getJavaResourcePersistentType(FULLY_QUALIFIED_TYPE_NAME);
- NamedNativeQueryAnnotation javaNamedNativeQuery = (NamedNativeQueryAnnotation) typeResource.getSupportingAnnotation(NamedNativeQueryAnnotation.ANNOTATION_NAME);
-
- assertEquals(null, javaNamedNativeQuery.getResultClass());
- assertEquals(null, namedNativeQuery.getResultClass());
-
- //set name in the resource model, verify context model updated
- javaNamedNativeQuery.setResultClass("foo");
- assertEquals("foo", javaNamedNativeQuery.getResultClass());
- assertEquals("foo", namedNativeQuery.getResultClass());
-
- //set name to null in the resource model
- javaNamedNativeQuery.setResultClass(null);
- assertNull(javaNamedNativeQuery.getResultClass());
- assertNull(namedNativeQuery.getResultClass());
- }
-
- public void testModifyResultClass() throws Exception {
- createTestEntityWithNamedNativeQuery();
- addXmlClassRef(FULLY_QUALIFIED_TYPE_NAME);
- Entity entity = getJavaEntity();
- NamedNativeQuery namedNativeQuery = entity.getQueryContainer().namedNativeQueries().next();
-
- JavaResourcePersistentType typeResource = getJpaProject().getJavaResourcePersistentType(FULLY_QUALIFIED_TYPE_NAME);
- NamedNativeQueryAnnotation javaNamedNativeQuery = (NamedNativeQueryAnnotation) typeResource.getSupportingAnnotation(NamedNativeQueryAnnotation.ANNOTATION_NAME);
-
- assertEquals(null, javaNamedNativeQuery.getResultClass());
- assertEquals(null, namedNativeQuery.getResultClass());
-
- //set name in the context model, verify resource model updated
- namedNativeQuery.setResultClass("foo");
- assertEquals("foo", javaNamedNativeQuery.getResultClass());
- assertEquals("foo", namedNativeQuery.getResultClass());
-
- //set name to null in the context model
- namedNativeQuery.setResultClass(null);
- assertNull(javaNamedNativeQuery.getResultClass());
- assertNull(namedNativeQuery.getResultClass());
- }
-
- public void testUpdateResultSetMapping() throws Exception {
- createTestEntityWithNamedNativeQuery();
- addXmlClassRef(FULLY_QUALIFIED_TYPE_NAME);
-
- Entity entity = getJavaEntity();
- NamedNativeQuery namedNativeQuery = entity.getQueryContainer().namedNativeQueries().next();
-
- JavaResourcePersistentType typeResource = getJpaProject().getJavaResourcePersistentType(FULLY_QUALIFIED_TYPE_NAME);
- NamedNativeQueryAnnotation javaNamedNativeQuery = (NamedNativeQueryAnnotation) typeResource.getSupportingAnnotation(NamedNativeQueryAnnotation.ANNOTATION_NAME);
-
- assertEquals(null, javaNamedNativeQuery.getResultSetMapping());
- assertEquals(null, namedNativeQuery.getResultSetMapping());
-
- //set name in the resource model, verify context model updated
- javaNamedNativeQuery.setResultSetMapping("foo");
- assertEquals("foo", javaNamedNativeQuery.getResultSetMapping());
- assertEquals("foo", namedNativeQuery.getResultSetMapping());
-
- //set name to null in the resource model
- javaNamedNativeQuery.setResultSetMapping(null);
- assertNull(javaNamedNativeQuery.getResultSetMapping());
- assertNull(namedNativeQuery.getResultSetMapping());
- }
-
- public void testModifyResultSetMapping() throws Exception {
- createTestEntityWithNamedNativeQuery();
- addXmlClassRef(FULLY_QUALIFIED_TYPE_NAME);
- Entity entity = getJavaEntity();
- NamedNativeQuery namedNativeQuery = entity.getQueryContainer().namedNativeQueries().next();
-
- JavaResourcePersistentType typeResource = getJpaProject().getJavaResourcePersistentType(FULLY_QUALIFIED_TYPE_NAME);
- NamedNativeQueryAnnotation javaNamedNativeQuery = (NamedNativeQueryAnnotation) typeResource.getSupportingAnnotation(NamedNativeQueryAnnotation.ANNOTATION_NAME);
-
- assertEquals(null, javaNamedNativeQuery.getResultSetMapping());
- assertEquals(null, namedNativeQuery.getResultSetMapping());
-
- //set name in the context model, verify resource model updated
- namedNativeQuery.setResultSetMapping("foo");
- assertEquals("foo", javaNamedNativeQuery.getResultSetMapping());
- assertEquals("foo", namedNativeQuery.getResultSetMapping());
-
- //set name to null in the context model
- namedNativeQuery.setResultSetMapping(null);
- assertNull(javaNamedNativeQuery.getResultSetMapping());
- assertNull(namedNativeQuery.getResultSetMapping());
- }
-
-}
diff --git a/jpa/tests/org.eclipse.jpt.core.tests/src/org/eclipse/jpt/core/tests/internal/context/java/JavaNamedQueryTests.java b/jpa/tests/org.eclipse.jpt.core.tests/src/org/eclipse/jpt/core/tests/internal/context/java/JavaNamedQueryTests.java
deleted file mode 100644
index ace94bee93..0000000000
--- a/jpa/tests/org.eclipse.jpt.core.tests/src/org/eclipse/jpt/core/tests/internal/context/java/JavaNamedQueryTests.java
+++ /dev/null
@@ -1,324 +0,0 @@
-/*******************************************************************************
- * Copyright (c) 2007, 2009 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.
- *
- * Contributors:
- * Oracle - initial API and implementation
- ******************************************************************************/
-package org.eclipse.jpt.core.tests.internal.context.java;
-
-import java.util.Iterator;
-import java.util.ListIterator;
-import org.eclipse.jdt.core.ICompilationUnit;
-import org.eclipse.jpt.core.context.Entity;
-import org.eclipse.jpt.core.context.NamedQuery;
-import org.eclipse.jpt.core.context.QueryHint;
-import org.eclipse.jpt.core.resource.java.JPA;
-import org.eclipse.jpt.core.resource.java.JavaResourcePersistentType;
-import org.eclipse.jpt.core.resource.java.NamedQueryAnnotation;
-import org.eclipse.jpt.core.tests.internal.context.ContextModelTestCase;
-import org.eclipse.jpt.utility.internal.iterators.ArrayIterator;
-
-@SuppressWarnings("nls")
-public class JavaNamedQueryTests extends ContextModelTestCase
-{
- private static final String QUERY_NAME = "QUERY_NAME";
- private static final String QUERY_QUERY = "MY_QUERY";
-
- private ICompilationUnit createTestEntityWithNamedQuery() throws Exception {
- return this.createTestType(new DefaultAnnotationWriter() {
- @Override
- public Iterator<String> imports() {
- return new ArrayIterator<String>(JPA.ENTITY, JPA.NAMED_QUERY);
- }
- @Override
- public void appendTypeAnnotationTo(StringBuilder sb) {
- sb.append("@Entity").append(CR);
- sb.append("@NamedQuery(name=\"" + QUERY_NAME + "\", query=\"" + QUERY_QUERY + "\")");
- }
- });
- }
-
-
-
- public JavaNamedQueryTests(String name) {
- super(name);
- }
-
- public void testUpdateName() throws Exception {
- createTestEntityWithNamedQuery();
- addXmlClassRef(FULLY_QUALIFIED_TYPE_NAME);
-
- Entity entity = getJavaEntity();
- NamedQuery namedQuery = entity.getQueryContainer().namedQueries().next();
-
- JavaResourcePersistentType typeResource = getJpaProject().getJavaResourcePersistentType(FULLY_QUALIFIED_TYPE_NAME);
- NamedQueryAnnotation javaNamedQuery = (NamedQueryAnnotation) typeResource.getSupportingAnnotation(NamedQueryAnnotation.ANNOTATION_NAME);
-
- assertEquals(QUERY_NAME, javaNamedQuery.getName());
- assertEquals(QUERY_NAME, namedQuery.getName());
-
- //set name to null in the resource model
- javaNamedQuery.setName(null);
- assertNull(javaNamedQuery.getName());
- assertNull(namedQuery.getName());
-
- //set name in the resource model, verify context model updated
- javaNamedQuery.setName("foo");
- assertEquals("foo", javaNamedQuery.getName());
- assertEquals("foo", namedQuery.getName());
- }
-
- public void testModifyName() throws Exception {
- createTestEntityWithNamedQuery();
- addXmlClassRef(FULLY_QUALIFIED_TYPE_NAME);
- Entity entity = getJavaEntity();
- NamedQuery namedQuery = entity.getQueryContainer().namedQueries().next();
-
- JavaResourcePersistentType typeResource = getJpaProject().getJavaResourcePersistentType(FULLY_QUALIFIED_TYPE_NAME);
- NamedQueryAnnotation javaNamedQuery = (NamedQueryAnnotation) typeResource.getSupportingAnnotation(NamedQueryAnnotation.ANNOTATION_NAME);
-
- assertEquals(QUERY_NAME, javaNamedQuery.getName());
- assertEquals(QUERY_NAME, namedQuery.getName());
-
- //set name to null in the context model
- namedQuery.setName(null);
- assertNull(javaNamedQuery.getName());
- assertNull(namedQuery.getName());
-
- //set name in the context model, verify resource model updated
- namedQuery.setName("foo");
- assertEquals("foo", javaNamedQuery.getName());
- assertEquals("foo", namedQuery.getName());
- }
-
- public void testUpdateQuery() throws Exception {
- createTestEntityWithNamedQuery();
- addXmlClassRef(FULLY_QUALIFIED_TYPE_NAME);
-
- Entity entity = getJavaEntity();
- NamedQuery namedQuery = entity.getQueryContainer().namedQueries().next();
-
- JavaResourcePersistentType typeResource = getJpaProject().getJavaResourcePersistentType(FULLY_QUALIFIED_TYPE_NAME);
- NamedQueryAnnotation javaNamedQuery = (NamedQueryAnnotation) typeResource.getSupportingAnnotation(NamedQueryAnnotation.ANNOTATION_NAME);
-
- assertEquals(QUERY_QUERY, javaNamedQuery.getQuery());
- assertEquals(QUERY_QUERY, namedQuery.getQuery());
-
- //set name to null in the resource model
- javaNamedQuery.setQuery(null);
- assertNull(javaNamedQuery.getQuery());
- assertNull(namedQuery.getQuery());
-
- //set name in the resource model, verify context model updated
- javaNamedQuery.setQuery("foo");
- assertEquals("foo", javaNamedQuery.getQuery());
- assertEquals("foo", namedQuery.getQuery());
- }
-
- public void testModifyQuery() throws Exception {
- createTestEntityWithNamedQuery();
- addXmlClassRef(FULLY_QUALIFIED_TYPE_NAME);
- Entity entity = getJavaEntity();
- NamedQuery namedQuery = entity.getQueryContainer().namedQueries().next();
-
- JavaResourcePersistentType typeResource = getJpaProject().getJavaResourcePersistentType(FULLY_QUALIFIED_TYPE_NAME);
- NamedQueryAnnotation javaNamedQuery = (NamedQueryAnnotation) typeResource.getSupportingAnnotation(NamedQueryAnnotation.ANNOTATION_NAME);
-
- assertEquals(QUERY_QUERY, javaNamedQuery.getQuery());
- assertEquals(QUERY_QUERY, namedQuery.getQuery());
-
- //set name to null in the context model
- namedQuery.setQuery(null);
- assertNull(javaNamedQuery.getQuery());
- assertNull(namedQuery.getQuery());
-
- //set name in the context model, verify resource model updated
- namedQuery.setQuery("foo");
- assertEquals("foo", javaNamedQuery.getQuery());
- assertEquals("foo", namedQuery.getQuery());
- }
-
-
- public void testAddHint() throws Exception {
- createTestEntityWithNamedQuery();
- addXmlClassRef(FULLY_QUALIFIED_TYPE_NAME);
- Entity entity = getJavaEntity();
- NamedQuery namedQuery = entity.getQueryContainer().namedQueries().next();
-
- JavaResourcePersistentType typeResource = getJpaProject().getJavaResourcePersistentType(FULLY_QUALIFIED_TYPE_NAME);
- NamedQueryAnnotation javaNamedQuery = (NamedQueryAnnotation) typeResource.getSupportingAnnotation(NamedQueryAnnotation.ANNOTATION_NAME);
-
-
- QueryHint queryHint = namedQuery.addHint(0);
- queryHint.setName("FOO");
-
- assertEquals("FOO", javaNamedQuery.hintAt(0).getName());
-
- QueryHint queryHint2 = namedQuery.addHint(0);
- queryHint2.setName("BAR");
-
- assertEquals("BAR", javaNamedQuery.hintAt(0).getName());
- assertEquals("FOO", javaNamedQuery.hintAt(1).getName());
-
- QueryHint queryHint3 = namedQuery.addHint(1);
- queryHint3.setName("BAZ");
-
- assertEquals("BAR", javaNamedQuery.hintAt(0).getName());
- assertEquals("BAZ", javaNamedQuery.hintAt(1).getName());
- assertEquals("FOO", javaNamedQuery.hintAt(2).getName());
-
- ListIterator<QueryHint> hints = namedQuery.hints();
- assertEquals(queryHint2, hints.next());
- assertEquals(queryHint3, hints.next());
- assertEquals(queryHint, hints.next());
-
- hints = namedQuery.hints();
- assertEquals("BAR", hints.next().getName());
- assertEquals("BAZ", hints.next().getName());
- assertEquals("FOO", hints.next().getName());
- }
-
- public void testRemoveHint() throws Exception {
- createTestEntityWithNamedQuery();
- addXmlClassRef(FULLY_QUALIFIED_TYPE_NAME);
- Entity entity = getJavaEntity();
- NamedQuery namedQuery = entity.getQueryContainer().namedQueries().next();
-
- JavaResourcePersistentType typeResource = getJpaProject().getJavaResourcePersistentType(FULLY_QUALIFIED_TYPE_NAME);
- NamedQueryAnnotation javaNamedQuery = (NamedQueryAnnotation) typeResource.getSupportingAnnotation(NamedQueryAnnotation.ANNOTATION_NAME);
-
- namedQuery.addHint(0).setName("FOO");
- namedQuery.addHint(1).setName("BAR");
- namedQuery.addHint(2).setName("BAZ");
-
- assertEquals(3, javaNamedQuery.hintsSize());
-
- namedQuery.removeHint(0);
- assertEquals(2, javaNamedQuery.hintsSize());
- assertEquals("BAR", javaNamedQuery.hintAt(0).getName());
- assertEquals("BAZ", javaNamedQuery.hintAt(1).getName());
-
- namedQuery.removeHint(0);
- assertEquals(1, javaNamedQuery.hintsSize());
- assertEquals("BAZ", javaNamedQuery.hintAt(0).getName());
-
- namedQuery.removeHint(0);
- assertEquals(0, javaNamedQuery.hintsSize());
- }
-
- public void testMoveHint() throws Exception {
- createTestEntityWithNamedQuery();
- addXmlClassRef(FULLY_QUALIFIED_TYPE_NAME);
- Entity entity = getJavaEntity();
- NamedQuery namedQuery = entity.getQueryContainer().namedQueries().next();
-
- JavaResourcePersistentType typeResource = getJpaProject().getJavaResourcePersistentType(FULLY_QUALIFIED_TYPE_NAME);
- NamedQueryAnnotation javaNamedQuery = (NamedQueryAnnotation) typeResource.getSupportingAnnotation(NamedQueryAnnotation.ANNOTATION_NAME);
-
- namedQuery.addHint(0).setName("FOO");
- namedQuery.addHint(1).setName("BAR");
- namedQuery.addHint(2).setName("BAZ");
-
- assertEquals(3, javaNamedQuery.hintsSize());
-
-
- namedQuery.moveHint(2, 0);
- ListIterator<QueryHint> hints = namedQuery.hints();
- assertEquals("BAR", hints.next().getName());
- assertEquals("BAZ", hints.next().getName());
- assertEquals("FOO", hints.next().getName());
-
- assertEquals("BAR", javaNamedQuery.hintAt(0).getName());
- assertEquals("BAZ", javaNamedQuery.hintAt(1).getName());
- assertEquals("FOO", javaNamedQuery.hintAt(2).getName());
-
-
- namedQuery.moveHint(0, 1);
- hints = namedQuery.hints();
- assertEquals("BAZ", hints.next().getName());
- assertEquals("BAR", hints.next().getName());
- assertEquals("FOO", hints.next().getName());
-
- assertEquals("BAZ", javaNamedQuery.hintAt(0).getName());
- assertEquals("BAR", javaNamedQuery.hintAt(1).getName());
- assertEquals("FOO", javaNamedQuery.hintAt(2).getName());
- }
-
- public void testUpdateHints() throws Exception {
- createTestEntityWithNamedQuery();
- addXmlClassRef(FULLY_QUALIFIED_TYPE_NAME);
- Entity entity = getJavaEntity();
- NamedQuery namedQuery = entity.getQueryContainer().namedQueries().next();
-
- JavaResourcePersistentType typeResource = getJpaProject().getJavaResourcePersistentType(FULLY_QUALIFIED_TYPE_NAME);
- NamedQueryAnnotation javaNamedQuery = (NamedQueryAnnotation) typeResource.getSupportingAnnotation(NamedQueryAnnotation.ANNOTATION_NAME);
-
- javaNamedQuery.addHint(0);
- javaNamedQuery.addHint(1);
- javaNamedQuery.addHint(2);
-
- javaNamedQuery.hintAt(0).setName("FOO");
- javaNamedQuery.hintAt(1).setName("BAR");
- javaNamedQuery.hintAt(2).setName("BAZ");
-
- ListIterator<QueryHint> hints = namedQuery.hints();
- assertEquals("FOO", hints.next().getName());
- assertEquals("BAR", hints.next().getName());
- assertEquals("BAZ", hints.next().getName());
- assertFalse(hints.hasNext());
-
- javaNamedQuery.moveHint(2, 0);
- hints = namedQuery.hints();
- assertEquals("BAR", hints.next().getName());
- assertEquals("BAZ", hints.next().getName());
- assertEquals("FOO", hints.next().getName());
- assertFalse(hints.hasNext());
-
- javaNamedQuery.moveHint(0, 1);
- hints = namedQuery.hints();
- assertEquals("BAZ", hints.next().getName());
- assertEquals("BAR", hints.next().getName());
- assertEquals("FOO", hints.next().getName());
- assertFalse(hints.hasNext());
-
- javaNamedQuery.removeHint(1);
- hints = namedQuery.hints();
- assertEquals("BAZ", hints.next().getName());
- assertEquals("FOO", hints.next().getName());
- assertFalse(hints.hasNext());
-
- javaNamedQuery.removeHint(1);
- hints = namedQuery.hints();
- assertEquals("BAZ", hints.next().getName());
- assertFalse(hints.hasNext());
-
- javaNamedQuery.removeHint(0);
- assertFalse(namedQuery.hints().hasNext());
- }
-
- public void testHintsSize() throws Exception {
- createTestEntityWithNamedQuery();
- addXmlClassRef(FULLY_QUALIFIED_TYPE_NAME);
- Entity entity = getJavaEntity();
-
- NamedQuery namedQuery = entity.getQueryContainer().namedQueries().next();
- assertEquals(0, namedQuery.hintsSize());
-
- JavaResourcePersistentType typeResource = getJpaProject().getJavaResourcePersistentType(FULLY_QUALIFIED_TYPE_NAME);
- NamedQueryAnnotation javaNamedQuery = (NamedQueryAnnotation) typeResource.getSupportingAnnotation(NamedQueryAnnotation.ANNOTATION_NAME);
-
-
- javaNamedQuery.addHint(0);
- assertEquals(1, namedQuery.hintsSize());
-
- javaNamedQuery.addHint(0);
- assertEquals(2, namedQuery.hintsSize());
-
- javaNamedQuery.removeHint(0);
- javaNamedQuery.removeHint(0);
- assertEquals(0, namedQuery.hintsSize());
- }
-}
diff --git a/jpa/tests/org.eclipse.jpt.core.tests/src/org/eclipse/jpt/core/tests/internal/context/java/JavaOneToManyMappingTests.java b/jpa/tests/org.eclipse.jpt.core.tests/src/org/eclipse/jpt/core/tests/internal/context/java/JavaOneToManyMappingTests.java
deleted file mode 100644
index 29cbf0d5e0..0000000000
--- a/jpa/tests/org.eclipse.jpt.core.tests/src/org/eclipse/jpt/core/tests/internal/context/java/JavaOneToManyMappingTests.java
+++ /dev/null
@@ -1,942 +0,0 @@
-/*******************************************************************************
- * Copyright (c) 2007, 2008 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.
- *
- * Contributors:
- * Oracle - initial API and implementation
- ******************************************************************************/
-package org.eclipse.jpt.core.tests.internal.context.java;
-
-import java.util.Iterator;
-import java.util.ListIterator;
-import org.eclipse.jdt.core.ICompilationUnit;
-import org.eclipse.jpt.core.MappingKeys;
-import org.eclipse.jpt.core.context.BasicMapping;
-import org.eclipse.jpt.core.context.EmbeddedIdMapping;
-import org.eclipse.jpt.core.context.EmbeddedMapping;
-import org.eclipse.jpt.core.context.FetchType;
-import org.eclipse.jpt.core.context.IdMapping;
-import org.eclipse.jpt.core.context.ManyToManyMapping;
-import org.eclipse.jpt.core.context.ManyToOneMapping;
-import org.eclipse.jpt.core.context.OneToManyMapping;
-import org.eclipse.jpt.core.context.OneToOneMapping;
-import org.eclipse.jpt.core.context.PersistentAttribute;
-import org.eclipse.jpt.core.context.TransientMapping;
-import org.eclipse.jpt.core.context.TypeMapping;
-import org.eclipse.jpt.core.context.VersionMapping;
-import org.eclipse.jpt.core.context.java.JavaPersistentType;
-import org.eclipse.jpt.core.context.persistence.ClassRef;
-import org.eclipse.jpt.core.resource.java.BasicAnnotation;
-import org.eclipse.jpt.core.resource.java.EmbeddedAnnotation;
-import org.eclipse.jpt.core.resource.java.EmbeddedIdAnnotation;
-import org.eclipse.jpt.core.resource.java.IdAnnotation;
-import org.eclipse.jpt.core.resource.java.JPA;
-import org.eclipse.jpt.core.resource.java.JavaResourcePersistentAttribute;
-import org.eclipse.jpt.core.resource.java.JavaResourcePersistentType;
-import org.eclipse.jpt.core.resource.java.JoinTableAnnotation;
-import org.eclipse.jpt.core.resource.java.ManyToManyAnnotation;
-import org.eclipse.jpt.core.resource.java.ManyToOneAnnotation;
-import org.eclipse.jpt.core.resource.java.MapKeyAnnotation;
-import org.eclipse.jpt.core.resource.java.OneToManyAnnotation;
-import org.eclipse.jpt.core.resource.java.OneToOneAnnotation;
-import org.eclipse.jpt.core.resource.java.OrderByAnnotation;
-import org.eclipse.jpt.core.resource.java.TransientAnnotation;
-import org.eclipse.jpt.core.resource.java.VersionAnnotation;
-import org.eclipse.jpt.core.tests.internal.context.ContextModelTestCase;
-import org.eclipse.jpt.core.tests.internal.projects.TestJavaProject.SourceWriter;
-import org.eclipse.jpt.utility.internal.iterators.ArrayIterator;
-
-@SuppressWarnings("nls")
-public class JavaOneToManyMappingTests extends ContextModelTestCase
-{
-
- private void createTestTargetEntityAddress() throws Exception {
- SourceWriter sourceWriter = new SourceWriter() {
- public void appendSourceTo(StringBuilder sb) {
- sb.append(CR);
- sb.append("import ");
- sb.append(JPA.ENTITY);
- sb.append(";");
- sb.append(CR);
- sb.append("import ");
- sb.append(JPA.ID);
- sb.append(";");
- sb.append(CR);
- sb.append("@Entity");
- sb.append(CR);
- sb.append("public class ").append("Address").append(" ");
- sb.append("{").append(CR);
- sb.append(CR);
- sb.append(" @Id").append(CR);
- sb.append(" private int id;").append(CR);
- sb.append(CR);
- sb.append(" private String city;").append(CR);
- sb.append(CR);
- sb.append(" private String state;").append(CR);
- sb.append(CR);
- sb.append(" private int zip;").append(CR);
- sb.append(CR);
- sb.append("}").append(CR);
- }
- };
- this.javaProject.createCompilationUnit(PACKAGE_NAME, "Address.java", sourceWriter);
- }
-
- private ICompilationUnit createTestEntityWithOneToManyMapping() throws Exception {
- return this.createTestType(new DefaultAnnotationWriter() {
- @Override
- public Iterator<String> imports() {
- return new ArrayIterator<String>(JPA.ENTITY, JPA.ONE_TO_MANY);
- }
- @Override
- public void appendTypeAnnotationTo(StringBuilder sb) {
- sb.append("@Entity").append(CR);
- }
-
- @Override
- public void appendIdFieldAnnotationTo(StringBuilder sb) {
- sb.append("@OneToMany").append(CR);
- }
- });
- }
-
- private ICompilationUnit createTestEntityWithValidOneToManyMapping() throws Exception {
- return this.createTestType(new DefaultAnnotationWriter() {
- @Override
- public Iterator<String> imports() {
- return new ArrayIterator<String>(JPA.ENTITY, JPA.ONE_TO_MANY, JPA.ID, "java.util.Collection");
- }
- @Override
- public void appendTypeAnnotationTo(StringBuilder sb) {
- sb.append("@Entity").append(CR);
- }
-
- @Override
- public void appendIdFieldAnnotationTo(StringBuilder sb) {
- sb.append(CR);
- sb.append(" @OneToMany").append(CR);
- sb.append(" private Collection<Address> addresses;").append(CR);
- sb.append(CR);
- sb.append(" @Id").append(CR);
- }
- });
- }
-
- private ICompilationUnit createTestEntityWithCollectionOneToManyMapping() throws Exception {
- return this.createTestType(new DefaultAnnotationWriter() {
- @Override
- public Iterator<String> imports() {
- return new ArrayIterator<String>(JPA.ENTITY, JPA.ONE_TO_MANY, JPA.ID, "java.util.Collection");
- }
- @Override
- public void appendTypeAnnotationTo(StringBuilder sb) {
- sb.append("@Entity").append(CR);
- }
-
- @Override
- public void appendIdFieldAnnotationTo(StringBuilder sb) {
- sb.append(CR);
- sb.append(" @OneToMany").append(CR);
- sb.append(" private Collection addresses;").append(CR);
- sb.append(CR);
- sb.append(" @Id").append(CR);
- }
- });
- }
- private ICompilationUnit createTestEntityWithNonCollectionOneToManyMapping() throws Exception {
- return this.createTestType(new DefaultAnnotationWriter() {
- @Override
- public Iterator<String> imports() {
- return new ArrayIterator<String>(JPA.ENTITY, JPA.ONE_TO_MANY, JPA.ID);
- }
- @Override
- public void appendTypeAnnotationTo(StringBuilder sb) {
- sb.append("@Entity").append(CR);
- }
-
- @Override
- public void appendIdFieldAnnotationTo(StringBuilder sb) {
- sb.append(CR);
- sb.append(" @OneToMany").append(CR);
- sb.append(" private Address addresses;").append(CR);
- sb.append(CR);
- sb.append(" @Id").append(CR);
- }
- });
- }
-
- private void createTestDepartment() throws Exception {
- SourceWriter sourceWriter = new SourceWriter() {
- public void appendSourceTo(StringBuilder sb) {
- sb.append(CR);
- sb.append("import ").append(JPA.ENTITY).append(";");
- sb.append(CR);
- sb.append("import ").append(JPA.ID).append(";");
- sb.append(CR);
- sb.append("import java.util.Map;");
- sb.append(CR);
- sb.append("import ").append(JPA.ONE_TO_MANY).append(";");
- sb.append("@Entity");
- sb.append(CR);
- sb.append("public class ").append("Department").append(" ");
- sb.append("{").append(CR);
- sb.append(CR);
- sb.append(" @Id").append(CR);
- sb.append(" private int id;").append(CR);
- sb.append(CR);
- sb.append(" @OneToMany").append(CR);
- sb.append(" private Map<Integer, Employee> employees;").append(CR);
- sb.append(CR);
- sb.append("}").append(CR);
- }
- };
- this.javaProject.createCompilationUnit(PACKAGE_NAME, "Department.java", sourceWriter);
- }
-
- private void createTestEmployee() throws Exception {
- SourceWriter sourceWriter = new SourceWriter() {
- public void appendSourceTo(StringBuilder sb) {
- sb.append(CR);
- sb.append("import ").append(JPA.ENTITY).append(";");
- sb.append(CR);
- sb.append("import ").append(JPA.ID).append(";");
- sb.append(CR);
- sb.append("@Entity");
- sb.append(CR);
- sb.append("public class ").append("Employee").append(" ");
- sb.append("{").append(CR);
- sb.append(CR);
- sb.append(" @Id").append(CR);
- sb.append(" private int empId;").append(CR);
- sb.append(CR);
- sb.append("}").append(CR);
- }
- };
- this.javaProject.createCompilationUnit(PACKAGE_NAME, "Employee.java", sourceWriter);
- }
-
- public JavaOneToManyMappingTests(String name) {
- super(name);
- }
-
- public void testMorphToBasicMapping() throws Exception {
- createTestEntityWithOneToManyMapping();
- addXmlClassRef(FULLY_QUALIFIED_TYPE_NAME);
-
- PersistentAttribute persistentAttribute = getJavaPersistentType().attributes().next();
- OneToManyMapping oneToManyMapping = (OneToManyMapping) persistentAttribute.getMapping();
- oneToManyMapping.setOrderBy("asdf");
- oneToManyMapping.getRelationshipReference().getJoinTableJoiningStrategy().getJoinTable().setSpecifiedName("FOO");
- assertFalse(oneToManyMapping.isDefault());
-
- persistentAttribute.setSpecifiedMappingKey(MappingKeys.BASIC_ATTRIBUTE_MAPPING_KEY);
- assertTrue(persistentAttribute.getMapping() instanceof BasicMapping);
- assertFalse(persistentAttribute.getMapping().isDefault());
-
- JavaResourcePersistentType typeResource = getJpaProject().getJavaResourcePersistentType(FULLY_QUALIFIED_TYPE_NAME);
- JavaResourcePersistentAttribute attributeResource = typeResource.persistableAttributes().next();
- assertNull(attributeResource.getMappingAnnotation(OneToManyAnnotation.ANNOTATION_NAME));
- assertNotNull(attributeResource.getMappingAnnotation(BasicAnnotation.ANNOTATION_NAME));
- assertNull(attributeResource.getSupportingAnnotation(JoinTableAnnotation.ANNOTATION_NAME));
- assertNull(attributeResource.getSupportingAnnotation(OrderByAnnotation.ANNOTATION_NAME));
- }
-
- public void testMorphToDefault() throws Exception {
- createTestEntityWithOneToManyMapping();
- addXmlClassRef(FULLY_QUALIFIED_TYPE_NAME);
-
- PersistentAttribute persistentAttribute = getJavaPersistentType().attributes().next();
- OneToManyMapping oneToManyMapping = (OneToManyMapping) persistentAttribute.getMapping();
- oneToManyMapping.setOrderBy("asdf");
- oneToManyMapping.getRelationshipReference().getJoinTableJoiningStrategy().getJoinTable().setSpecifiedName("FOO");
- assertFalse(oneToManyMapping.isDefault());
-
- persistentAttribute.setSpecifiedMappingKey(MappingKeys.NULL_ATTRIBUTE_MAPPING_KEY);
- assertNull(persistentAttribute.getSpecifiedMapping());
- assertTrue(persistentAttribute.getMapping().isDefault());
-
- JavaResourcePersistentType typeResource = getJpaProject().getJavaResourcePersistentType(FULLY_QUALIFIED_TYPE_NAME);
- JavaResourcePersistentAttribute attributeResource = typeResource.persistableAttributes().next();
- assertNull(attributeResource.getMappingAnnotation(OneToManyAnnotation.ANNOTATION_NAME));
- assertNull(attributeResource.getSupportingAnnotation(JoinTableAnnotation.ANNOTATION_NAME));
- assertNull(attributeResource.getSupportingAnnotation(OrderByAnnotation.ANNOTATION_NAME));
- }
-
- public void testMorphToVersionMapping() throws Exception {
- createTestEntityWithOneToManyMapping();
- addXmlClassRef(FULLY_QUALIFIED_TYPE_NAME);
-
- PersistentAttribute persistentAttribute = getJavaPersistentType().attributes().next();
- OneToManyMapping oneToManyMapping = (OneToManyMapping) persistentAttribute.getMapping();
- oneToManyMapping.setOrderBy("asdf");
- oneToManyMapping.getRelationshipReference().getJoinTableJoiningStrategy().getJoinTable().setSpecifiedName("FOO");
- assertFalse(oneToManyMapping.isDefault());
-
- persistentAttribute.setSpecifiedMappingKey(MappingKeys.VERSION_ATTRIBUTE_MAPPING_KEY);
- assertTrue(persistentAttribute.getMapping() instanceof VersionMapping);
- assertFalse(persistentAttribute.getMapping().isDefault());
-
- JavaResourcePersistentType typeResource = getJpaProject().getJavaResourcePersistentType(FULLY_QUALIFIED_TYPE_NAME);
- JavaResourcePersistentAttribute attributeResource = typeResource.persistableAttributes().next();
- assertNull(attributeResource.getMappingAnnotation(OneToManyAnnotation.ANNOTATION_NAME));
- assertNotNull(attributeResource.getMappingAnnotation(VersionAnnotation.ANNOTATION_NAME));
- assertNull(attributeResource.getSupportingAnnotation(JoinTableAnnotation.ANNOTATION_NAME));
- assertNull(attributeResource.getSupportingAnnotation(OrderByAnnotation.ANNOTATION_NAME));
- }
-
- public void testMorphToIdMapping() throws Exception {
- createTestEntityWithOneToManyMapping();
- addXmlClassRef(FULLY_QUALIFIED_TYPE_NAME);
-
- PersistentAttribute persistentAttribute = getJavaPersistentType().attributes().next();
- OneToManyMapping oneToManyMapping = (OneToManyMapping) persistentAttribute.getMapping();
- oneToManyMapping.setOrderBy("asdf");
- oneToManyMapping.getRelationshipReference().getJoinTableJoiningStrategy().getJoinTable().setSpecifiedName("FOO");
- assertFalse(oneToManyMapping.isDefault());
-
- persistentAttribute.setSpecifiedMappingKey(MappingKeys.ID_ATTRIBUTE_MAPPING_KEY);
- assertTrue(persistentAttribute.getMapping() instanceof IdMapping);
- assertFalse(persistentAttribute.getMapping().isDefault());
-
- JavaResourcePersistentType typeResource = getJpaProject().getJavaResourcePersistentType(FULLY_QUALIFIED_TYPE_NAME);
- JavaResourcePersistentAttribute attributeResource = typeResource.persistableAttributes().next();
- assertNull(attributeResource.getMappingAnnotation(OneToManyAnnotation.ANNOTATION_NAME));
- assertNotNull(attributeResource.getMappingAnnotation(IdAnnotation.ANNOTATION_NAME));
- assertNull(attributeResource.getSupportingAnnotation(JoinTableAnnotation.ANNOTATION_NAME));
- assertNull(attributeResource.getSupportingAnnotation(OrderByAnnotation.ANNOTATION_NAME));
- }
-
- public void testMorphToEmbeddedMapping() throws Exception {
- createTestEntityWithOneToManyMapping();
- addXmlClassRef(FULLY_QUALIFIED_TYPE_NAME);
-
- PersistentAttribute persistentAttribute = getJavaPersistentType().attributes().next();
- OneToManyMapping oneToManyMapping = (OneToManyMapping) persistentAttribute.getMapping();
- oneToManyMapping.setOrderBy("asdf");
- oneToManyMapping.getRelationshipReference().getJoinTableJoiningStrategy().getJoinTable().setSpecifiedName("FOO");
- assertFalse(oneToManyMapping.isDefault());
-
- persistentAttribute.setSpecifiedMappingKey(MappingKeys.EMBEDDED_ATTRIBUTE_MAPPING_KEY);
- assertTrue(persistentAttribute.getMapping() instanceof EmbeddedMapping);
- assertFalse(persistentAttribute.getMapping().isDefault());
-
- JavaResourcePersistentType typeResource = getJpaProject().getJavaResourcePersistentType(FULLY_QUALIFIED_TYPE_NAME);
- JavaResourcePersistentAttribute attributeResource = typeResource.persistableAttributes().next();
- assertNull(attributeResource.getMappingAnnotation(OneToManyAnnotation.ANNOTATION_NAME));
- assertNotNull(attributeResource.getMappingAnnotation(EmbeddedAnnotation.ANNOTATION_NAME));
- assertNull(attributeResource.getSupportingAnnotation(JoinTableAnnotation.ANNOTATION_NAME));
- assertNull(attributeResource.getSupportingAnnotation(OrderByAnnotation.ANNOTATION_NAME));
- }
-
- public void testMorphToEmbeddedIdMapping() throws Exception {
- createTestEntityWithOneToManyMapping();
- addXmlClassRef(FULLY_QUALIFIED_TYPE_NAME);
-
- PersistentAttribute persistentAttribute = getJavaPersistentType().attributes().next();
- OneToManyMapping oneToManyMapping = (OneToManyMapping) persistentAttribute.getMapping();
- oneToManyMapping.setOrderBy("asdf");
- oneToManyMapping.getRelationshipReference().getJoinTableJoiningStrategy().getJoinTable().setSpecifiedName("FOO");
- assertFalse(oneToManyMapping.isDefault());
-
- persistentAttribute.setSpecifiedMappingKey(MappingKeys.EMBEDDED_ID_ATTRIBUTE_MAPPING_KEY);
- assertTrue(persistentAttribute.getMapping() instanceof EmbeddedIdMapping);
- assertFalse(persistentAttribute.getMapping().isDefault());
-
- JavaResourcePersistentType typeResource = getJpaProject().getJavaResourcePersistentType(FULLY_QUALIFIED_TYPE_NAME);
- JavaResourcePersistentAttribute attributeResource = typeResource.persistableAttributes().next();
- assertNull(attributeResource.getMappingAnnotation(OneToManyAnnotation.ANNOTATION_NAME));
- assertNotNull(attributeResource.getMappingAnnotation(EmbeddedIdAnnotation.ANNOTATION_NAME));
- assertNull(attributeResource.getSupportingAnnotation(JoinTableAnnotation.ANNOTATION_NAME));
- assertNull(attributeResource.getSupportingAnnotation(OrderByAnnotation.ANNOTATION_NAME));
- }
-
- public void testMorphToTransientMapping() throws Exception {
- createTestEntityWithOneToManyMapping();
- addXmlClassRef(FULLY_QUALIFIED_TYPE_NAME);
-
- PersistentAttribute persistentAttribute = getJavaPersistentType().attributes().next();
- OneToManyMapping oneToManyMapping = (OneToManyMapping) persistentAttribute.getMapping();
- oneToManyMapping.setOrderBy("asdf");
- oneToManyMapping.getRelationshipReference().getJoinTableJoiningStrategy().getJoinTable().setSpecifiedName("FOO");
- assertFalse(oneToManyMapping.isDefault());
-
- persistentAttribute.setSpecifiedMappingKey(MappingKeys.TRANSIENT_ATTRIBUTE_MAPPING_KEY);
- assertTrue(persistentAttribute.getMapping() instanceof TransientMapping);
- assertFalse(persistentAttribute.getMapping().isDefault());
-
- JavaResourcePersistentType typeResource = getJpaProject().getJavaResourcePersistentType(FULLY_QUALIFIED_TYPE_NAME);
- JavaResourcePersistentAttribute attributeResource = typeResource.persistableAttributes().next();
- assertNull(attributeResource.getMappingAnnotation(OneToManyAnnotation.ANNOTATION_NAME));
- assertNotNull(attributeResource.getMappingAnnotation(TransientAnnotation.ANNOTATION_NAME));
- assertNull(attributeResource.getSupportingAnnotation(JoinTableAnnotation.ANNOTATION_NAME));
- assertNull(attributeResource.getSupportingAnnotation(OrderByAnnotation.ANNOTATION_NAME));
- }
-
- public void testMorphToOneToOneMapping() throws Exception {
- createTestEntityWithOneToManyMapping();
- addXmlClassRef(FULLY_QUALIFIED_TYPE_NAME);
-
- PersistentAttribute persistentAttribute = getJavaPersistentType().attributes().next();
- OneToManyMapping oneToManyMapping = (OneToManyMapping) persistentAttribute.getMapping();
- oneToManyMapping.setOrderBy("asdf");
- oneToManyMapping.getRelationshipReference().getJoinTableJoiningStrategy().getJoinTable().setSpecifiedName("FOO");
- assertFalse(oneToManyMapping.isDefault());
-
- persistentAttribute.setSpecifiedMappingKey(MappingKeys.ONE_TO_ONE_ATTRIBUTE_MAPPING_KEY);
- assertTrue(persistentAttribute.getMapping() instanceof OneToOneMapping);
- assertFalse(persistentAttribute.getMapping().isDefault());
-
- JavaResourcePersistentType typeResource = getJpaProject().getJavaResourcePersistentType(FULLY_QUALIFIED_TYPE_NAME);
- JavaResourcePersistentAttribute attributeResource = typeResource.persistableAttributes().next();
- assertNull(attributeResource.getMappingAnnotation(OneToManyAnnotation.ANNOTATION_NAME));
- assertNotNull(attributeResource.getMappingAnnotation(OneToOneAnnotation.ANNOTATION_NAME));
- assertNotNull(attributeResource.getSupportingAnnotation(JoinTableAnnotation.ANNOTATION_NAME));
- assertNull(attributeResource.getSupportingAnnotation(OrderByAnnotation.ANNOTATION_NAME));
- }
-
- public void testMorphToManyToManyMapping() throws Exception {
- createTestEntityWithOneToManyMapping();
- addXmlClassRef(FULLY_QUALIFIED_TYPE_NAME);
-
- PersistentAttribute persistentAttribute = getJavaPersistentType().attributes().next();
- OneToManyMapping oneToManyMapping = (OneToManyMapping) persistentAttribute.getMapping();
- oneToManyMapping.setOrderBy("asdf");
- oneToManyMapping.getRelationshipReference().getJoinTableJoiningStrategy().getJoinTable().setSpecifiedName("FOO");
- assertFalse(oneToManyMapping.isDefault());
-
- persistentAttribute.setSpecifiedMappingKey(MappingKeys.MANY_TO_MANY_ATTRIBUTE_MAPPING_KEY);
- assertTrue(persistentAttribute.getMapping() instanceof ManyToManyMapping);
- assertFalse(persistentAttribute.getMapping().isDefault());
-
- JavaResourcePersistentType typeResource = getJpaProject().getJavaResourcePersistentType(FULLY_QUALIFIED_TYPE_NAME);
- JavaResourcePersistentAttribute attributeResource = typeResource.persistableAttributes().next();
- assertNull(attributeResource.getMappingAnnotation(OneToManyAnnotation.ANNOTATION_NAME));
- assertNotNull(attributeResource.getMappingAnnotation(ManyToManyAnnotation.ANNOTATION_NAME));
- assertNotNull(attributeResource.getSupportingAnnotation(JoinTableAnnotation.ANNOTATION_NAME));
- assertNotNull(attributeResource.getSupportingAnnotation(OrderByAnnotation.ANNOTATION_NAME));
- }
-
- public void testMorphToManyToOneMapping() throws Exception {
- createTestEntityWithOneToManyMapping();
- addXmlClassRef(FULLY_QUALIFIED_TYPE_NAME);
-
- PersistentAttribute persistentAttribute = getJavaPersistentType().attributes().next();
- OneToManyMapping oneToManyMapping = (OneToManyMapping) persistentAttribute.getMapping();
- oneToManyMapping.setOrderBy("asdf");
- oneToManyMapping.getRelationshipReference().getJoinTableJoiningStrategy().getJoinTable().setSpecifiedName("FOO");
- assertFalse(oneToManyMapping.isDefault());
-
- persistentAttribute.setSpecifiedMappingKey(MappingKeys.MANY_TO_ONE_ATTRIBUTE_MAPPING_KEY);
- assertTrue(persistentAttribute.getMapping() instanceof ManyToOneMapping);
- assertFalse(persistentAttribute.getMapping().isDefault());
-
- JavaResourcePersistentType typeResource = getJpaProject().getJavaResourcePersistentType(FULLY_QUALIFIED_TYPE_NAME);
- JavaResourcePersistentAttribute attributeResource = typeResource.persistableAttributes().next();
- assertNull(attributeResource.getMappingAnnotation(OneToManyAnnotation.ANNOTATION_NAME));
- assertNotNull(attributeResource.getMappingAnnotation(ManyToOneAnnotation.ANNOTATION_NAME));
- assertNotNull(attributeResource.getSupportingAnnotation(JoinTableAnnotation.ANNOTATION_NAME));
- assertNull(attributeResource.getSupportingAnnotation(OrderByAnnotation.ANNOTATION_NAME));
- }
-
-
- public void testUpdateSpecifiedTargetEntity() throws Exception {
- createTestEntityWithOneToManyMapping();
- addXmlClassRef(FULLY_QUALIFIED_TYPE_NAME);
-
- PersistentAttribute persistentAttribute = getJavaPersistentType().attributes().next();
- OneToManyMapping oneToManyMapping = (OneToManyMapping) persistentAttribute.getMapping();
-
- JavaResourcePersistentType typeResource = getJpaProject().getJavaResourcePersistentType(FULLY_QUALIFIED_TYPE_NAME);
- JavaResourcePersistentAttribute attributeResource = typeResource.persistableAttributes().next();
- OneToManyAnnotation oneToMany = (OneToManyAnnotation) attributeResource.getMappingAnnotation();
-
- assertNull(oneToManyMapping.getSpecifiedTargetEntity());
- assertNull(oneToMany.getTargetEntity());
-
- //set target entity in the resource model, verify context model updated
- oneToMany.setTargetEntity("newTargetEntity");
- assertEquals("newTargetEntity", oneToManyMapping.getSpecifiedTargetEntity());
- assertEquals("newTargetEntity", oneToMany.getTargetEntity());
-
- //set target entity to null in the resource model
- oneToMany.setTargetEntity(null);
- assertNull(oneToManyMapping.getSpecifiedTargetEntity());
- assertNull(oneToMany.getTargetEntity());
- }
-
- public void testModifySpecifiedTargetEntity() throws Exception {
- createTestEntityWithOneToManyMapping();
- addXmlClassRef(FULLY_QUALIFIED_TYPE_NAME);
-
- PersistentAttribute persistentAttribute = getJavaPersistentType().attributes().next();
- OneToManyMapping oneToManyMapping = (OneToManyMapping) persistentAttribute.getMapping();
-
- JavaResourcePersistentType typeResource = getJpaProject().getJavaResourcePersistentType(FULLY_QUALIFIED_TYPE_NAME);
- JavaResourcePersistentAttribute attributeResource = typeResource.persistableAttributes().next();
- OneToManyAnnotation oneToMany = (OneToManyAnnotation) attributeResource.getMappingAnnotation();
-
- assertNull(oneToManyMapping.getSpecifiedTargetEntity());
- assertNull(oneToMany.getTargetEntity());
-
- //set target entity in the context model, verify resource model updated
- oneToManyMapping.setSpecifiedTargetEntity("newTargetEntity");
- assertEquals("newTargetEntity", oneToManyMapping.getSpecifiedTargetEntity());
- assertEquals("newTargetEntity", oneToMany.getTargetEntity());
-
- //set target entity to null in the context model
- oneToManyMapping.setSpecifiedTargetEntity(null);
- assertNull(oneToManyMapping.getSpecifiedTargetEntity());
- assertNull(oneToMany.getTargetEntity());
- }
-
- public void testUpdateSpecifiedFetch() throws Exception {
- createTestEntityWithOneToManyMapping();
- addXmlClassRef(FULLY_QUALIFIED_TYPE_NAME);
-
- PersistentAttribute persistentAttribute = getJavaPersistentType().attributes().next();
- OneToManyMapping oneToManyMapping = (OneToManyMapping) persistentAttribute.getMapping();
-
- JavaResourcePersistentType typeResource = getJpaProject().getJavaResourcePersistentType(FULLY_QUALIFIED_TYPE_NAME);
- JavaResourcePersistentAttribute attributeResource = typeResource.persistableAttributes().next();
- OneToManyAnnotation oneToMany = (OneToManyAnnotation) attributeResource.getMappingAnnotation();
-
- assertNull(oneToManyMapping.getSpecifiedFetch());
- assertNull(oneToMany.getFetch());
-
- //set fetch in the resource model, verify context model updated
- oneToMany.setFetch(org.eclipse.jpt.core.resource.java.FetchType.EAGER);
- assertEquals(FetchType.EAGER, oneToManyMapping.getSpecifiedFetch());
- assertEquals(org.eclipse.jpt.core.resource.java.FetchType.EAGER, oneToMany.getFetch());
-
- oneToMany.setFetch(org.eclipse.jpt.core.resource.java.FetchType.LAZY);
- assertEquals(FetchType.LAZY, oneToManyMapping.getSpecifiedFetch());
- assertEquals(org.eclipse.jpt.core.resource.java.FetchType.LAZY, oneToMany.getFetch());
-
-
- //set fetch to null in the resource model
- oneToMany.setFetch(null);
- assertNull(oneToManyMapping.getSpecifiedFetch());
- assertNull(oneToMany.getFetch());
- }
-
- public void testModifySpecifiedFetch() throws Exception {
- createTestEntityWithOneToManyMapping();
- addXmlClassRef(FULLY_QUALIFIED_TYPE_NAME);
-
- PersistentAttribute persistentAttribute = getJavaPersistentType().attributes().next();
- OneToManyMapping oneToManyMapping = (OneToManyMapping) persistentAttribute.getMapping();
-
- JavaResourcePersistentType typeResource = getJpaProject().getJavaResourcePersistentType(FULLY_QUALIFIED_TYPE_NAME);
- JavaResourcePersistentAttribute attributeResource = typeResource.persistableAttributes().next();
- OneToManyAnnotation oneToMany = (OneToManyAnnotation) attributeResource.getMappingAnnotation();
-
- assertNull(oneToManyMapping.getSpecifiedFetch());
- assertNull(oneToMany.getFetch());
-
- //set fetch in the context model, verify resource model updated
- oneToManyMapping.setSpecifiedFetch(FetchType.EAGER);
- assertEquals(FetchType.EAGER, oneToManyMapping.getSpecifiedFetch());
- assertEquals(org.eclipse.jpt.core.resource.java.FetchType.EAGER, oneToMany.getFetch());
-
- oneToManyMapping.setSpecifiedFetch(FetchType.LAZY);
- assertEquals(FetchType.LAZY, oneToManyMapping.getSpecifiedFetch());
- assertEquals(org.eclipse.jpt.core.resource.java.FetchType.LAZY, oneToMany.getFetch());
-
-
- //set fetch to null in the context model
- oneToManyMapping.setSpecifiedFetch(null);
- assertNull(oneToManyMapping.getSpecifiedFetch());
- assertNull(oneToMany.getFetch());
- }
-
- public void testUpdateMappedBy() throws Exception {
- createTestEntityWithOneToManyMapping();
- addXmlClassRef(FULLY_QUALIFIED_TYPE_NAME);
-
- PersistentAttribute persistentAttribute = getJavaPersistentType().attributes().next();
- OneToManyMapping oneToManyMapping = (OneToManyMapping) persistentAttribute.getMapping();
-
- JavaResourcePersistentType typeResource = getJpaProject().getJavaResourcePersistentType(FULLY_QUALIFIED_TYPE_NAME);
- JavaResourcePersistentAttribute attributeResource = typeResource.persistableAttributes().next();
- OneToManyAnnotation oneToMany = (OneToManyAnnotation) attributeResource.getMappingAnnotation();
-
- assertNull(oneToManyMapping.getRelationshipReference().getMappedByJoiningStrategy().getMappedByAttribute());
- assertNull(oneToMany.getMappedBy());
-
- //set mappedBy in the resource model, verify context model updated
- oneToMany.setMappedBy("newMappedBy");
- assertEquals("newMappedBy", oneToManyMapping.getRelationshipReference().getMappedByJoiningStrategy().getMappedByAttribute());
- assertEquals("newMappedBy", oneToMany.getMappedBy());
-
- //set mappedBy to null in the resource model
- oneToMany.setMappedBy(null);
- assertNull(oneToManyMapping.getRelationshipReference().getMappedByJoiningStrategy().getMappedByAttribute());
- assertNull(oneToMany.getMappedBy());
- }
-
- public void testModifyMappedBy() throws Exception {
- createTestEntityWithOneToManyMapping();
- addXmlClassRef(FULLY_QUALIFIED_TYPE_NAME);
-
- PersistentAttribute persistentAttribute = getJavaPersistentType().attributes().next();
- OneToManyMapping oneToManyMapping = (OneToManyMapping) persistentAttribute.getMapping();
-
- JavaResourcePersistentType typeResource = getJpaProject().getJavaResourcePersistentType(FULLY_QUALIFIED_TYPE_NAME);
- JavaResourcePersistentAttribute attributeResource = typeResource.persistableAttributes().next();
- OneToManyAnnotation oneToMany = (OneToManyAnnotation) attributeResource.getMappingAnnotation();
-
- assertNull(oneToManyMapping.getRelationshipReference().getMappedByJoiningStrategy().getMappedByAttribute());
- assertNull(oneToMany.getMappedBy());
-
- //set mappedBy in the context model, verify resource model updated
- oneToManyMapping.getRelationshipReference().getMappedByJoiningStrategy().setMappedByAttribute("newTargetEntity");
- assertEquals("newTargetEntity", oneToManyMapping.getRelationshipReference().getMappedByJoiningStrategy().getMappedByAttribute());
- assertEquals("newTargetEntity", oneToMany.getMappedBy());
-
- //set mappedBy to null in the context model
- oneToManyMapping.getRelationshipReference().getMappedByJoiningStrategy().setMappedByAttribute(null);
- assertNull(oneToManyMapping.getRelationshipReference().getMappedByJoiningStrategy().getMappedByAttribute());
- assertNull(oneToMany.getMappedBy());
- }
-
-
- public void testCandidateMappedByAttributeNames() throws Exception {
- createTestEntityWithValidOneToManyMapping();
- createTestTargetEntityAddress();
- addXmlClassRef(FULLY_QUALIFIED_TYPE_NAME);
- addXmlClassRef(PACKAGE_NAME + ".Address");
-
- PersistentAttribute persistentAttribute = getJavaPersistentType().attributes().next();
- OneToManyMapping oneToManyMapping = (OneToManyMapping) persistentAttribute.getMapping();
-
- Iterator<String> attributeNames =
- oneToManyMapping.getRelationshipReference().getMappedByJoiningStrategy().candidateMappedByAttributeNames();
- assertEquals("id", attributeNames.next());
- assertEquals("city", attributeNames.next());
- assertEquals("state", attributeNames.next());
- assertEquals("zip", attributeNames.next());
- assertFalse(attributeNames.hasNext());
-
- oneToManyMapping.setSpecifiedTargetEntity("foo");
- attributeNames =
- oneToManyMapping.getRelationshipReference().getMappedByJoiningStrategy().candidateMappedByAttributeNames();
- assertFalse(attributeNames.hasNext());
-
- oneToManyMapping.setSpecifiedTargetEntity(null);
- attributeNames =
- oneToManyMapping.getRelationshipReference().getMappedByJoiningStrategy().candidateMappedByAttributeNames();
- assertEquals("id", attributeNames.next());
- assertEquals("city", attributeNames.next());
- assertEquals("state", attributeNames.next());
- assertEquals("zip", attributeNames.next());
- assertFalse(attributeNames.hasNext());
- }
-
- public void testDefaultTargetEntity() throws Exception {
- createTestEntityWithValidOneToManyMapping();
- createTestTargetEntityAddress();
- addXmlClassRef(FULLY_QUALIFIED_TYPE_NAME);
-
- PersistentAttribute persistentAttribute = getJavaPersistentType().attributes().next();
- OneToManyMapping oneToManyMapping = (OneToManyMapping) persistentAttribute.getMapping();
-
- //targetEntity not in the persistence unit, default still set, handled by validation
- assertEquals(PACKAGE_NAME + ".Address", oneToManyMapping.getDefaultTargetEntity());
-
- //add targetEntity to the persistence unit
- addXmlClassRef(PACKAGE_NAME + ".Address");
- assertEquals(PACKAGE_NAME + ".Address", oneToManyMapping.getDefaultTargetEntity());
-
- //test default still the same when specified target entity it set
- oneToManyMapping.setSpecifiedTargetEntity("foo");
- assertEquals(PACKAGE_NAME + ".Address", oneToManyMapping.getDefaultTargetEntity());
-
- ListIterator<ClassRef> classRefs = getPersistenceUnit().specifiedClassRefs();
- classRefs.next();
- ClassRef addressClassRef = classRefs.next();
- JavaPersistentType addressPersistentType = addressClassRef.getJavaPersistentType();
-
- //test target is not an Entity, default target entity still exists, this case handled with validation
- addressPersistentType.setMappingKey(MappingKeys.NULL_TYPE_MAPPING_KEY);
- assertEquals(PACKAGE_NAME + ".Address", oneToManyMapping.getDefaultTargetEntity());
- }
-
- public void testDefaultTargetEntityCollectionType() throws Exception {
- createTestEntityWithCollectionOneToManyMapping();
- createTestTargetEntityAddress();
- addXmlClassRef(FULLY_QUALIFIED_TYPE_NAME);
- addXmlClassRef(PACKAGE_NAME + ".Address");
-
- PersistentAttribute persistentAttribute = getJavaPersistentType().attributes().next();
- OneToManyMapping oneToManyMapping = (OneToManyMapping) persistentAttribute.getMapping();
-
- assertNull(oneToManyMapping.getDefaultTargetEntity());
- }
-
- public void testDefaultTargetEntityNonCollectionType() throws Exception {
- createTestEntityWithNonCollectionOneToManyMapping();
- createTestTargetEntityAddress();
- addXmlClassRef(FULLY_QUALIFIED_TYPE_NAME);
- addXmlClassRef(PACKAGE_NAME + ".Address");
-
- PersistentAttribute persistentAttribute = getJavaPersistentType().attributes().next();
- OneToManyMapping oneToManyMapping = (OneToManyMapping) persistentAttribute.getMapping();
-
- assertNull(oneToManyMapping.getDefaultTargetEntity());
- }
-
- public void testTargetEntity() throws Exception {
- createTestEntityWithValidOneToManyMapping();
- createTestTargetEntityAddress();
- addXmlClassRef(FULLY_QUALIFIED_TYPE_NAME);
-
- PersistentAttribute persistentAttribute = getJavaPersistentType().attributes().next();
- OneToManyMapping oneToManyMapping = (OneToManyMapping) persistentAttribute.getMapping();
-
- assertEquals(PACKAGE_NAME + ".Address", oneToManyMapping.getTargetEntity());
-
- oneToManyMapping.setSpecifiedTargetEntity("foo");
- assertEquals("foo", oneToManyMapping.getTargetEntity());
-
- oneToManyMapping.setSpecifiedTargetEntity(null);
- assertEquals(PACKAGE_NAME + ".Address", oneToManyMapping.getTargetEntity());
- }
-
- public void testResolvedTargetEntity() throws Exception {
- createTestEntityWithValidOneToManyMapping();
- addXmlClassRef(FULLY_QUALIFIED_TYPE_NAME);
-
- PersistentAttribute persistentAttribute = getJavaPersistentType().attributes().next();
- OneToManyMapping oneToManyMapping = (OneToManyMapping) persistentAttribute.getMapping();
-
- //targetEntity not in the persistence unit
- assertNull(oneToManyMapping.getResolvedTargetEntity());
-
- //add targetEntity to the persistence unit, now target entity should resolve
- createTestTargetEntityAddress();
- addXmlClassRef(PACKAGE_NAME + ".Address");
- ListIterator<ClassRef> classRefs = getPersistenceUnit().specifiedClassRefs();
- classRefs.next();
- ClassRef addressClassRef = classRefs.next();
- TypeMapping addressTypeMapping = addressClassRef.getJavaPersistentType().getMapping();
- assertEquals(addressTypeMapping, oneToManyMapping.getResolvedTargetEntity());
-
- //test default still the same when specified target entity it set
- oneToManyMapping.setSpecifiedTargetEntity("foo");
- assertNull(oneToManyMapping.getResolvedTargetEntity());
-
-
- oneToManyMapping.setSpecifiedTargetEntity(PACKAGE_NAME + ".Address");
- assertEquals(addressTypeMapping, oneToManyMapping.getResolvedTargetEntity());
-
-
- oneToManyMapping.setSpecifiedTargetEntity(null);
- assertEquals(addressTypeMapping, oneToManyMapping.getResolvedTargetEntity());
- }
-
-
- public void testUpdateMapKey() throws Exception {
- createTestEntityWithOneToManyMapping();
- addXmlClassRef(FULLY_QUALIFIED_TYPE_NAME);
-
- PersistentAttribute persistentAttribute = getJavaPersistentType().attributes().next();
- OneToManyMapping oneToManyMapping = (OneToManyMapping) persistentAttribute.getMapping();
-
- JavaResourcePersistentType typeResource = getJpaProject().getJavaResourcePersistentType(FULLY_QUALIFIED_TYPE_NAME);
- JavaResourcePersistentAttribute attributeResource = typeResource.persistableAttributes().next();
-
- assertNull(oneToManyMapping.getMapKey());
- assertNull(attributeResource.getSupportingAnnotation(MapKeyAnnotation.ANNOTATION_NAME));
-
- //set mapKey in the resource model, verify context model does not change
- attributeResource.addSupportingAnnotation(MapKeyAnnotation.ANNOTATION_NAME);
- assertNull(oneToManyMapping.getMapKey());
- MapKeyAnnotation mapKey = (MapKeyAnnotation) attributeResource.getSupportingAnnotation(MapKeyAnnotation.ANNOTATION_NAME);
- assertNotNull(mapKey);
-
- //set mapKey name in the resource model, verify context model updated
- mapKey.setName("myMapKey");
- assertEquals("myMapKey", oneToManyMapping.getMapKey());
- assertEquals("myMapKey", mapKey.getName());
-
- //set mapKey name to null in the resource model
- mapKey.setName(null);
- assertNull(oneToManyMapping.getMapKey());
- assertNull(mapKey.getName());
-
- mapKey.setName("myMapKey");
- attributeResource.removeSupportingAnnotation(MapKeyAnnotation.ANNOTATION_NAME);
- assertNull(oneToManyMapping.getMapKey());
- assertNull(attributeResource.getSupportingAnnotation(MapKeyAnnotation.ANNOTATION_NAME));
- }
-
- public void testModifyMapKey() throws Exception {
- createTestEntityWithOneToManyMapping();
- addXmlClassRef(FULLY_QUALIFIED_TYPE_NAME);
-
- PersistentAttribute persistentAttribute = getJavaPersistentType().attributes().next();
- OneToManyMapping oneToManyMapping = (OneToManyMapping) persistentAttribute.getMapping();
-
- JavaResourcePersistentType typeResource = getJpaProject().getJavaResourcePersistentType(FULLY_QUALIFIED_TYPE_NAME);
- JavaResourcePersistentAttribute attributeResource = typeResource.persistableAttributes().next();
-
- assertNull(oneToManyMapping.getMapKey());
- assertNull(attributeResource.getSupportingAnnotation(MapKeyAnnotation.ANNOTATION_NAME));
-
- //set mapKey in the context model, verify resource model updated
- oneToManyMapping.setMapKey("myMapKey");
- MapKeyAnnotation mapKey = (MapKeyAnnotation) attributeResource.getSupportingAnnotation(MapKeyAnnotation.ANNOTATION_NAME);
- assertEquals("myMapKey", oneToManyMapping.getMapKey());
- assertEquals("myMapKey", mapKey.getName());
-
- //set mapKey to null in the context model
- oneToManyMapping.setMapKey(null);
- assertNull(oneToManyMapping.getMapKey());
- assertNull(attributeResource.getSupportingAnnotation(MapKeyAnnotation.ANNOTATION_NAME));
- }
-
- public void testUpdateOrderBy() throws Exception {
- createTestEntityWithOneToManyMapping();
- addXmlClassRef(FULLY_QUALIFIED_TYPE_NAME);
-
- PersistentAttribute persistentAttribute = getJavaPersistentType().attributes().next();
- OneToManyMapping oneToManyMapping = (OneToManyMapping) persistentAttribute.getMapping();
-
- JavaResourcePersistentType typeResource = getJpaProject().getJavaResourcePersistentType(FULLY_QUALIFIED_TYPE_NAME);
- JavaResourcePersistentAttribute attributeResource = typeResource.persistableAttributes().next();
-
- assertNull(oneToManyMapping.getOrderBy());
- assertNull(attributeResource.getSupportingAnnotation(OrderByAnnotation.ANNOTATION_NAME));
-
- //set orderBy in the resource model, verify context model updated
- attributeResource.addSupportingAnnotation(OrderByAnnotation.ANNOTATION_NAME);
- OrderByAnnotation orderBy = (OrderByAnnotation) attributeResource.getSupportingAnnotation(OrderByAnnotation.ANNOTATION_NAME);
- orderBy.setValue("newOrderBy");
- assertEquals("newOrderBy", oneToManyMapping.getOrderBy());
- assertEquals("newOrderBy", orderBy.getValue());
-
- //set orderBy to null in the resource model
- attributeResource.removeSupportingAnnotation(OrderByAnnotation.ANNOTATION_NAME);
- assertNull(oneToManyMapping.getOrderBy());
- assertNull(attributeResource.getSupportingAnnotation(OrderByAnnotation.ANNOTATION_NAME));
- }
-
- public void testModifyOrderBy() throws Exception {
- createTestEntityWithOneToManyMapping();
- addXmlClassRef(FULLY_QUALIFIED_TYPE_NAME);
-
- PersistentAttribute persistentAttribute = getJavaPersistentType().attributes().next();
- OneToManyMapping oneToManyMapping = (OneToManyMapping) persistentAttribute.getMapping();
-
- JavaResourcePersistentType typeResource = getJpaProject().getJavaResourcePersistentType(FULLY_QUALIFIED_TYPE_NAME);
- JavaResourcePersistentAttribute attributeResource = typeResource.persistableAttributes().next();
-
- assertNull(oneToManyMapping.getOrderBy());
- assertNull(attributeResource.getSupportingAnnotation(OrderByAnnotation.ANNOTATION_NAME));
-
- //set mappedBy in the context model, verify resource model updated
- oneToManyMapping.setOrderBy("newOrderBy");
- assertEquals("newOrderBy", oneToManyMapping.getOrderBy());
- OrderByAnnotation orderBy = (OrderByAnnotation) attributeResource.getSupportingAnnotation(OrderByAnnotation.ANNOTATION_NAME);
- assertEquals("newOrderBy", orderBy.getValue());
-
- //set mappedBy to null in the context model
- oneToManyMapping.setOrderBy(null);
- assertNull(oneToManyMapping.getOrderBy());
- assertNull(attributeResource.getSupportingAnnotation(OrderByAnnotation.ANNOTATION_NAME));
- }
-
- public void testUpdateNoOrdering() throws Exception {
- createTestEntityWithOneToManyMapping();
- addXmlClassRef(FULLY_QUALIFIED_TYPE_NAME);
-
- PersistentAttribute persistentAttribute = getJavaPersistentType().attributes().next();
- OneToManyMapping oneToManyMapping = (OneToManyMapping) persistentAttribute.getMapping();
-
- JavaResourcePersistentType typeResource = getJpaProject().getJavaResourcePersistentType(FULLY_QUALIFIED_TYPE_NAME);
- JavaResourcePersistentAttribute attributeResource = typeResource.persistableAttributes().next();
-
- assertTrue(oneToManyMapping.isNoOrdering());
- assertNull(attributeResource.getSupportingAnnotation(OrderByAnnotation.ANNOTATION_NAME));
-
- //set orderBy in the resource model, verify context model updated
- attributeResource.addSupportingAnnotation(OrderByAnnotation.ANNOTATION_NAME);
- assertFalse(oneToManyMapping.isNoOrdering());
-
- OrderByAnnotation orderBy = (OrderByAnnotation) attributeResource.getSupportingAnnotation(OrderByAnnotation.ANNOTATION_NAME);
- orderBy.setValue("newOrderBy");
- assertFalse(oneToManyMapping.isNoOrdering());
-
- //set orderBy to null in the resource model
- attributeResource.removeSupportingAnnotation(OrderByAnnotation.ANNOTATION_NAME);
- assertTrue(oneToManyMapping.isNoOrdering());
- assertNull(attributeResource.getSupportingAnnotation(OrderByAnnotation.ANNOTATION_NAME));
- }
-
- public void testUpdatePkOrdering() throws Exception {
- createTestEntityWithOneToManyMapping();
- addXmlClassRef(FULLY_QUALIFIED_TYPE_NAME);
-
- PersistentAttribute persistentAttribute = getJavaPersistentType().attributes().next();
- OneToManyMapping oneToManyMapping = (OneToManyMapping) persistentAttribute.getMapping();
-
- JavaResourcePersistentType typeResource = getJpaProject().getJavaResourcePersistentType(FULLY_QUALIFIED_TYPE_NAME);
- JavaResourcePersistentAttribute attributeResource = typeResource.persistableAttributes().next();
-
- assertFalse(oneToManyMapping.isPkOrdering());
- assertNull(attributeResource.getSupportingAnnotation(OrderByAnnotation.ANNOTATION_NAME));
-
- //set orderBy in the resource model, verify context model updated
- attributeResource.addSupportingAnnotation(OrderByAnnotation.ANNOTATION_NAME);
- assertTrue(oneToManyMapping.isPkOrdering());
-
- OrderByAnnotation orderBy = (OrderByAnnotation) attributeResource.getSupportingAnnotation(OrderByAnnotation.ANNOTATION_NAME);
- orderBy.setValue("newOrderBy");
- assertFalse(oneToManyMapping.isPkOrdering());
-
- //set orderBy to null in the resource model
- attributeResource.removeSupportingAnnotation(OrderByAnnotation.ANNOTATION_NAME);
- assertFalse(oneToManyMapping.isPkOrdering());
- assertNull(attributeResource.getSupportingAnnotation(OrderByAnnotation.ANNOTATION_NAME));
- }
-
- public void testUpdateCustomOrdering() throws Exception {
- createTestEntityWithOneToManyMapping();
- addXmlClassRef(FULLY_QUALIFIED_TYPE_NAME);
-
- PersistentAttribute persistentAttribute = getJavaPersistentType().attributes().next();
- OneToManyMapping oneToManyMapping = (OneToManyMapping) persistentAttribute.getMapping();
-
- JavaResourcePersistentType typeResource = getJpaProject().getJavaResourcePersistentType(FULLY_QUALIFIED_TYPE_NAME);
- JavaResourcePersistentAttribute attributeResource = typeResource.persistableAttributes().next();
-
- assertFalse(oneToManyMapping.isCustomOrdering());
- assertNull(attributeResource.getSupportingAnnotation(OrderByAnnotation.ANNOTATION_NAME));
-
- //set orderBy in the resource model, verify context model updated
- attributeResource.addSupportingAnnotation(OrderByAnnotation.ANNOTATION_NAME);
- assertFalse(oneToManyMapping.isCustomOrdering());
-
- OrderByAnnotation orderBy = (OrderByAnnotation) attributeResource.getSupportingAnnotation(OrderByAnnotation.ANNOTATION_NAME);
- orderBy.setValue("newOrderBy");
- assertTrue(oneToManyMapping.isCustomOrdering());
-
- //set orderBy to null in the resource model
- attributeResource.removeSupportingAnnotation(OrderByAnnotation.ANNOTATION_NAME);
- assertFalse(oneToManyMapping.isCustomOrdering());
- assertNull(attributeResource.getSupportingAnnotation(OrderByAnnotation.ANNOTATION_NAME));
- }
-
- public void testDefaultTargetEntityForMap() throws Exception {
- createTestEmployee();
- createTestDepartment();
- addXmlClassRef(PACKAGE_NAME + ".Department");
- addXmlClassRef(PACKAGE_NAME + ".Employee");
-
- JavaPersistentType departmentPersistentType = getJavaPersistentType();
- OneToManyMapping employeesMapping = (OneToManyMapping) departmentPersistentType.getAttributeNamed("employees").getSpecifiedMapping();
- assertEquals(PACKAGE_NAME + ".Employee", employeesMapping.getTargetEntity());
- }
-}
diff --git a/jpa/tests/org.eclipse.jpt.core.tests/src/org/eclipse/jpt/core/tests/internal/context/java/JavaOneToOneMappingTests.java b/jpa/tests/org.eclipse.jpt.core.tests/src/org/eclipse/jpt/core/tests/internal/context/java/JavaOneToOneMappingTests.java
deleted file mode 100644
index 6c10347445..0000000000
--- a/jpa/tests/org.eclipse.jpt.core.tests/src/org/eclipse/jpt/core/tests/internal/context/java/JavaOneToOneMappingTests.java
+++ /dev/null
@@ -1,1332 +0,0 @@
-/*******************************************************************************
- * Copyright (c) 2007, 2008 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.
- *
- * Contributors:
- * Oracle - initial API and implementation
- ******************************************************************************/
-package org.eclipse.jpt.core.tests.internal.context.java;
-
-import java.util.Iterator;
-import java.util.ListIterator;
-import org.eclipse.jdt.core.ICompilationUnit;
-import org.eclipse.jpt.core.MappingKeys;
-import org.eclipse.jpt.core.context.BasicMapping;
-import org.eclipse.jpt.core.context.EmbeddedIdMapping;
-import org.eclipse.jpt.core.context.EmbeddedMapping;
-import org.eclipse.jpt.core.context.FetchType;
-import org.eclipse.jpt.core.context.IdMapping;
-import org.eclipse.jpt.core.context.JoinColumn;
-import org.eclipse.jpt.core.context.JoinColumnJoiningStrategy;
-import org.eclipse.jpt.core.context.ManyToManyMapping;
-import org.eclipse.jpt.core.context.ManyToOneMapping;
-import org.eclipse.jpt.core.context.MappedByJoiningStrategy;
-import org.eclipse.jpt.core.context.OneToManyMapping;
-import org.eclipse.jpt.core.context.OneToOneMapping;
-import org.eclipse.jpt.core.context.PersistentAttribute;
-import org.eclipse.jpt.core.context.PrimaryKeyJoinColumn;
-import org.eclipse.jpt.core.context.PrimaryKeyJoinColumnJoiningStrategy;
-import org.eclipse.jpt.core.context.TransientMapping;
-import org.eclipse.jpt.core.context.TypeMapping;
-import org.eclipse.jpt.core.context.VersionMapping;
-import org.eclipse.jpt.core.context.java.JavaPersistentType;
-import org.eclipse.jpt.core.context.java.JavaPrimaryKeyJoinColumn;
-import org.eclipse.jpt.core.context.persistence.ClassRef;
-import org.eclipse.jpt.core.resource.java.BasicAnnotation;
-import org.eclipse.jpt.core.resource.java.EmbeddedAnnotation;
-import org.eclipse.jpt.core.resource.java.EmbeddedIdAnnotation;
-import org.eclipse.jpt.core.resource.java.IdAnnotation;
-import org.eclipse.jpt.core.resource.java.JPA;
-import org.eclipse.jpt.core.resource.java.JavaResourcePersistentAttribute;
-import org.eclipse.jpt.core.resource.java.JavaResourcePersistentType;
-import org.eclipse.jpt.core.resource.java.JoinColumnAnnotation;
-import org.eclipse.jpt.core.resource.java.JoinColumnsAnnotation;
-import org.eclipse.jpt.core.resource.java.ManyToManyAnnotation;
-import org.eclipse.jpt.core.resource.java.ManyToOneAnnotation;
-import org.eclipse.jpt.core.resource.java.NestableAnnotation;
-import org.eclipse.jpt.core.resource.java.OneToManyAnnotation;
-import org.eclipse.jpt.core.resource.java.OneToOneAnnotation;
-import org.eclipse.jpt.core.resource.java.PrimaryKeyJoinColumnAnnotation;
-import org.eclipse.jpt.core.resource.java.PrimaryKeyJoinColumnsAnnotation;
-import org.eclipse.jpt.core.resource.java.TransientAnnotation;
-import org.eclipse.jpt.core.resource.java.VersionAnnotation;
-import org.eclipse.jpt.core.tests.internal.context.ContextModelTestCase;
-import org.eclipse.jpt.core.tests.internal.projects.TestJavaProject.SourceWriter;
-import org.eclipse.jpt.utility.internal.CollectionTools;
-import org.eclipse.jpt.utility.internal.iterators.ArrayIterator;
-
-@SuppressWarnings("nls")
-public class JavaOneToOneMappingTests extends ContextModelTestCase
-{
-
- private void createTestTargetEntityAddress() throws Exception {
- SourceWriter sourceWriter = new SourceWriter() {
- public void appendSourceTo(StringBuilder sb) {
- sb.append(CR);
- sb.append("import ");
- sb.append(JPA.ENTITY);
- sb.append(";");
- sb.append(CR);
- sb.append("import ");
- sb.append(JPA.ID);
- sb.append(";");
- sb.append(CR);
- sb.append("@Entity");
- sb.append(CR);
- sb.append("public class ").append("Address").append(" ");
- sb.append("{").append(CR);
- sb.append(CR);
- sb.append(" @Id").append(CR);
- sb.append(" private int id;").append(CR);
- sb.append(CR);
- sb.append(" private String city;").append(CR);
- sb.append(CR);
- sb.append(" private String state;").append(CR);
- sb.append(CR);
- sb.append(" private int zip;").append(CR);
- sb.append(CR);
- sb.append("}").append(CR);
- }
- };
- this.javaProject.createCompilationUnit(PACKAGE_NAME, "Address.java", sourceWriter);
- }
-
-
- private ICompilationUnit createTestEntityWithOneToOneMapping() throws Exception {
- return this.createTestType(new DefaultAnnotationWriter() {
- @Override
- public Iterator<String> imports() {
- return new ArrayIterator<String>(JPA.ENTITY, JPA.ONE_TO_ONE);
- }
- @Override
- public void appendTypeAnnotationTo(StringBuilder sb) {
- sb.append("@Entity").append(CR);
- }
-
- @Override
- public void appendIdFieldAnnotationTo(StringBuilder sb) {
- sb.append("@OneToOne").append(CR);
- }
- });
- }
-
- private ICompilationUnit createTestEntityWithValidOneToOneMapping() throws Exception {
- return this.createTestType(new DefaultAnnotationWriter() {
- @Override
- public Iterator<String> imports() {
- return new ArrayIterator<String>(JPA.ENTITY, JPA.ONE_TO_ONE, JPA.ID);
- }
- @Override
- public void appendTypeAnnotationTo(StringBuilder sb) {
- sb.append("@Entity").append(CR);
- }
-
- @Override
- public void appendIdFieldAnnotationTo(StringBuilder sb) {
- sb.append(CR);
- sb.append(" @OneToOne").append(CR);
- sb.append(" private Address address;").append(CR);
- sb.append(CR);
- sb.append(" @Id").append(CR);
- }
- });
- }
-
- private ICompilationUnit createTestEntityWithCollectionOneToOneMapping() throws Exception {
- return this.createTestType(new DefaultAnnotationWriter() {
- @Override
- public Iterator<String> imports() {
- return new ArrayIterator<String>(JPA.ENTITY, JPA.ONE_TO_ONE, JPA.ID, "java.util.Collection");
- }
- @Override
- public void appendTypeAnnotationTo(StringBuilder sb) {
- sb.append("@Entity").append(CR);
- }
-
- @Override
- public void appendIdFieldAnnotationTo(StringBuilder sb) {
- sb.append(CR);
- sb.append(" @OneToOne").append(CR);
- sb.append(" private Collection address;").append(CR);
- sb.append(CR);
- sb.append(" @Id").append(CR);
- }
- });
- }
-
- private ICompilationUnit createTestEntityWithGenericizedCollectionOneToOneMapping() throws Exception {
- return this.createTestType(new DefaultAnnotationWriter() {
- @Override
- public Iterator<String> imports() {
- return new ArrayIterator<String>(JPA.ENTITY, JPA.ONE_TO_ONE, JPA.ID, "java.util.Collection");
- }
- @Override
- public void appendTypeAnnotationTo(StringBuilder sb) {
- sb.append("@Entity").append(CR);
- }
-
- @Override
- public void appendIdFieldAnnotationTo(StringBuilder sb) {
- sb.append(CR);
- sb.append(" @OneToOne").append(CR);
- sb.append(" private Collection<Address> address;").append(CR);
- sb.append(CR);
- sb.append(" @Id").append(CR);
- }
- });
- }
-
- public JavaOneToOneMappingTests(String name) {
- super(name);
- }
-
- public void testMorphToBasicMapping() throws Exception {
- createTestEntityWithOneToOneMapping();
- addXmlClassRef(FULLY_QUALIFIED_TYPE_NAME);
-
- PersistentAttribute persistentAttribute = getJavaPersistentType().attributes().next();
- OneToOneMapping oneToOneMapping = (OneToOneMapping) persistentAttribute.getMapping();
- JoinColumnJoiningStrategy joinColumns = oneToOneMapping.getRelationshipReference().getJoinColumnJoiningStrategy();
- joinColumns.addSpecifiedJoinColumn(0);
- assertFalse(oneToOneMapping.isDefault());
-
- persistentAttribute.setSpecifiedMappingKey(MappingKeys.BASIC_ATTRIBUTE_MAPPING_KEY);
- assertTrue(persistentAttribute.getMapping() instanceof BasicMapping);
- assertFalse(persistentAttribute.getMapping().isDefault());
-
- JavaResourcePersistentType typeResource = getJpaProject().getJavaResourcePersistentType(FULLY_QUALIFIED_TYPE_NAME);
- JavaResourcePersistentAttribute attributeResource = typeResource.persistableAttributes().next();
- assertNull(attributeResource.getMappingAnnotation(OneToOneAnnotation.ANNOTATION_NAME));
- assertNotNull(attributeResource.getMappingAnnotation(BasicAnnotation.ANNOTATION_NAME));
- assertNull(attributeResource.getSupportingAnnotation(JoinColumnAnnotation.ANNOTATION_NAME));
- }
-
- public void testMorphToDefault() throws Exception {
- createTestEntityWithOneToOneMapping();
- addXmlClassRef(FULLY_QUALIFIED_TYPE_NAME);
-
- PersistentAttribute persistentAttribute = getJavaPersistentType().attributes().next();
- OneToOneMapping oneToOneMapping = (OneToOneMapping) persistentAttribute.getMapping();
- JoinColumnJoiningStrategy joinColumns = oneToOneMapping.getRelationshipReference().getJoinColumnJoiningStrategy();
- joinColumns.addSpecifiedJoinColumn(0);
- assertFalse(oneToOneMapping.isDefault());
-
- persistentAttribute.setSpecifiedMappingKey(MappingKeys.NULL_ATTRIBUTE_MAPPING_KEY);
- assertNull(persistentAttribute.getSpecifiedMapping());
- assertTrue(persistentAttribute.getMapping().isDefault());
-
- JavaResourcePersistentType typeResource = getJpaProject().getJavaResourcePersistentType(FULLY_QUALIFIED_TYPE_NAME);
- JavaResourcePersistentAttribute attributeResource = typeResource.persistableAttributes().next();
- assertNull(attributeResource.getMappingAnnotation(OneToOneAnnotation.ANNOTATION_NAME));
- assertNull(attributeResource.getSupportingAnnotation(JoinColumnAnnotation.ANNOTATION_NAME));
- }
-
- public void testMorphToVersionMapping() throws Exception {
- createTestEntityWithOneToOneMapping();
- addXmlClassRef(FULLY_QUALIFIED_TYPE_NAME);
-
- PersistentAttribute persistentAttribute = getJavaPersistentType().attributes().next();
- OneToOneMapping oneToOneMapping = (OneToOneMapping) persistentAttribute.getMapping();
- JoinColumnJoiningStrategy joinColumns = oneToOneMapping.getRelationshipReference().getJoinColumnJoiningStrategy();
- joinColumns.addSpecifiedJoinColumn(0);
- assertFalse(oneToOneMapping.isDefault());
-
- persistentAttribute.setSpecifiedMappingKey(MappingKeys.VERSION_ATTRIBUTE_MAPPING_KEY);
- assertTrue(persistentAttribute.getMapping() instanceof VersionMapping);
- assertFalse(persistentAttribute.getMapping().isDefault());
-
- JavaResourcePersistentType typeResource = getJpaProject().getJavaResourcePersistentType(FULLY_QUALIFIED_TYPE_NAME);
- JavaResourcePersistentAttribute attributeResource = typeResource.persistableAttributes().next();
- assertNull(attributeResource.getMappingAnnotation(OneToOneAnnotation.ANNOTATION_NAME));
- assertNotNull(attributeResource.getMappingAnnotation(VersionAnnotation.ANNOTATION_NAME));
- assertNull(attributeResource.getSupportingAnnotation(JoinColumnAnnotation.ANNOTATION_NAME));
- }
-
- public void testMorphToIdMapping() throws Exception {
- createTestEntityWithOneToOneMapping();
- addXmlClassRef(FULLY_QUALIFIED_TYPE_NAME);
-
- PersistentAttribute persistentAttribute = getJavaPersistentType().attributes().next();
- OneToOneMapping oneToOneMapping = (OneToOneMapping) persistentAttribute.getMapping();
- JoinColumnJoiningStrategy joinColumns = oneToOneMapping.getRelationshipReference().getJoinColumnJoiningStrategy();
- joinColumns.addSpecifiedJoinColumn(0);
- assertFalse(oneToOneMapping.isDefault());
-
- persistentAttribute.setSpecifiedMappingKey(MappingKeys.ID_ATTRIBUTE_MAPPING_KEY);
- assertTrue(persistentAttribute.getMapping() instanceof IdMapping);
- assertFalse(persistentAttribute.getMapping().isDefault());
-
- JavaResourcePersistentType typeResource = getJpaProject().getJavaResourcePersistentType(FULLY_QUALIFIED_TYPE_NAME);
- JavaResourcePersistentAttribute attributeResource = typeResource.persistableAttributes().next();
- assertNull(attributeResource.getMappingAnnotation(OneToOneAnnotation.ANNOTATION_NAME));
- assertNotNull(attributeResource.getMappingAnnotation(IdAnnotation.ANNOTATION_NAME));
- assertNull(attributeResource.getSupportingAnnotation(JoinColumnAnnotation.ANNOTATION_NAME));
- }
-
- public void testMorphToEmbeddedMapping() throws Exception {
- createTestEntityWithOneToOneMapping();
- addXmlClassRef(FULLY_QUALIFIED_TYPE_NAME);
-
- PersistentAttribute persistentAttribute = getJavaPersistentType().attributes().next();
- OneToOneMapping oneToOneMapping = (OneToOneMapping) persistentAttribute.getMapping();
- JoinColumnJoiningStrategy joinColumns = oneToOneMapping.getRelationshipReference().getJoinColumnJoiningStrategy();
- joinColumns.addSpecifiedJoinColumn(0);
- assertFalse(oneToOneMapping.isDefault());
-
- persistentAttribute.setSpecifiedMappingKey(MappingKeys.EMBEDDED_ATTRIBUTE_MAPPING_KEY);
- assertTrue(persistentAttribute.getMapping() instanceof EmbeddedMapping);
- assertFalse(persistentAttribute.getMapping().isDefault());
-
- JavaResourcePersistentType typeResource = getJpaProject().getJavaResourcePersistentType(FULLY_QUALIFIED_TYPE_NAME);
- JavaResourcePersistentAttribute attributeResource = typeResource.persistableAttributes().next();
- assertNull(attributeResource.getMappingAnnotation(OneToOneAnnotation.ANNOTATION_NAME));
- assertNotNull(attributeResource.getMappingAnnotation(EmbeddedAnnotation.ANNOTATION_NAME));
- assertNull(attributeResource.getSupportingAnnotation(JoinColumnAnnotation.ANNOTATION_NAME));
- }
-
- public void testMorphToEmbeddedIdMapping() throws Exception {
- createTestEntityWithOneToOneMapping();
- addXmlClassRef(FULLY_QUALIFIED_TYPE_NAME);
-
- PersistentAttribute persistentAttribute = getJavaPersistentType().attributes().next();
- OneToOneMapping oneToOneMapping = (OneToOneMapping) persistentAttribute.getMapping();
- JoinColumnJoiningStrategy joinColumns = oneToOneMapping.getRelationshipReference().getJoinColumnJoiningStrategy();
- joinColumns.addSpecifiedJoinColumn(0);
- assertFalse(oneToOneMapping.isDefault());
-
- persistentAttribute.setSpecifiedMappingKey(MappingKeys.EMBEDDED_ID_ATTRIBUTE_MAPPING_KEY);
- assertTrue(persistentAttribute.getMapping() instanceof EmbeddedIdMapping);
- assertFalse(persistentAttribute.getMapping().isDefault());
-
- JavaResourcePersistentType typeResource = getJpaProject().getJavaResourcePersistentType(FULLY_QUALIFIED_TYPE_NAME);
- JavaResourcePersistentAttribute attributeResource = typeResource.persistableAttributes().next();
- assertNull(attributeResource.getMappingAnnotation(OneToOneAnnotation.ANNOTATION_NAME));
- assertNotNull(attributeResource.getMappingAnnotation(EmbeddedIdAnnotation.ANNOTATION_NAME));
- assertNull(attributeResource.getSupportingAnnotation(JoinColumnAnnotation.ANNOTATION_NAME));
- }
-
- public void testMorphToTransientMapping() throws Exception {
- createTestEntityWithOneToOneMapping();
- addXmlClassRef(FULLY_QUALIFIED_TYPE_NAME);
-
- PersistentAttribute persistentAttribute = getJavaPersistentType().attributes().next();
- OneToOneMapping oneToOneMapping = (OneToOneMapping) persistentAttribute.getMapping();
- JoinColumnJoiningStrategy joinColumns = oneToOneMapping.getRelationshipReference().getJoinColumnJoiningStrategy();
- joinColumns.addSpecifiedJoinColumn(0);
- assertFalse(oneToOneMapping.isDefault());
-
- persistentAttribute.setSpecifiedMappingKey(MappingKeys.TRANSIENT_ATTRIBUTE_MAPPING_KEY);
- assertTrue(persistentAttribute.getMapping() instanceof TransientMapping);
- assertFalse(persistentAttribute.getMapping().isDefault());
-
- JavaResourcePersistentType typeResource = getJpaProject().getJavaResourcePersistentType(FULLY_QUALIFIED_TYPE_NAME);
- JavaResourcePersistentAttribute attributeResource = typeResource.persistableAttributes().next();
- assertNull(attributeResource.getMappingAnnotation(OneToOneAnnotation.ANNOTATION_NAME));
- assertNotNull(attributeResource.getMappingAnnotation(TransientAnnotation.ANNOTATION_NAME));
- assertNull(attributeResource.getSupportingAnnotation(JoinColumnAnnotation.ANNOTATION_NAME));
- }
-
- public void testMorphToManyToOneMapping() throws Exception {
- createTestEntityWithOneToOneMapping();
- addXmlClassRef(FULLY_QUALIFIED_TYPE_NAME);
-
- PersistentAttribute persistentAttribute = getJavaPersistentType().attributes().next();
- OneToOneMapping oneToOneMapping = (OneToOneMapping) persistentAttribute.getMapping();
- JoinColumnJoiningStrategy joinColumns = oneToOneMapping.getRelationshipReference().getJoinColumnJoiningStrategy();
- joinColumns.addSpecifiedJoinColumn(0);
- assertFalse(oneToOneMapping.isDefault());
-
- persistentAttribute.setSpecifiedMappingKey(MappingKeys.MANY_TO_ONE_ATTRIBUTE_MAPPING_KEY);
- assertTrue(persistentAttribute.getMapping() instanceof ManyToOneMapping);
- assertFalse(persistentAttribute.getMapping().isDefault());
-
- JavaResourcePersistentType typeResource = getJpaProject().getJavaResourcePersistentType(FULLY_QUALIFIED_TYPE_NAME);
- JavaResourcePersistentAttribute attributeResource = typeResource.persistableAttributes().next();
- assertNull(attributeResource.getMappingAnnotation(OneToOneAnnotation.ANNOTATION_NAME));
- assertNotNull(attributeResource.getMappingAnnotation(ManyToOneAnnotation.ANNOTATION_NAME));
- assertNotNull(attributeResource.getSupportingAnnotation(JoinColumnAnnotation.ANNOTATION_NAME));
- }
-
- public void testMorphToOneToManyMapping() throws Exception {
- createTestEntityWithOneToOneMapping();
- addXmlClassRef(FULLY_QUALIFIED_TYPE_NAME);
-
- PersistentAttribute persistentAttribute = getJavaPersistentType().attributes().next();
- OneToOneMapping oneToOneMapping = (OneToOneMapping) persistentAttribute.getMapping();
- JoinColumnJoiningStrategy joinColumns = oneToOneMapping.getRelationshipReference().getJoinColumnJoiningStrategy();
- joinColumns.addSpecifiedJoinColumn(0);
- assertFalse(oneToOneMapping.isDefault());
-
- persistentAttribute.setSpecifiedMappingKey(MappingKeys.ONE_TO_MANY_ATTRIBUTE_MAPPING_KEY);
- assertTrue(persistentAttribute.getMapping() instanceof OneToManyMapping);
- assertFalse(persistentAttribute.getMapping().isDefault());
-
- JavaResourcePersistentType typeResource = getJpaProject().getJavaResourcePersistentType(FULLY_QUALIFIED_TYPE_NAME);
- JavaResourcePersistentAttribute attributeResource = typeResource.persistableAttributes().next();
- assertNull(attributeResource.getMappingAnnotation(OneToOneAnnotation.ANNOTATION_NAME));
- assertNotNull(attributeResource.getMappingAnnotation(OneToManyAnnotation.ANNOTATION_NAME));
- assertNotNull(attributeResource.getSupportingAnnotation(JoinColumnAnnotation.ANNOTATION_NAME));
- }
-
- public void testMorphToManyToManyMapping() throws Exception {
- createTestEntityWithOneToOneMapping();
- addXmlClassRef(FULLY_QUALIFIED_TYPE_NAME);
-
- PersistentAttribute persistentAttribute = getJavaPersistentType().attributes().next();
- OneToOneMapping oneToOneMapping = (OneToOneMapping) persistentAttribute.getMapping();
- JoinColumnJoiningStrategy joinColumns = oneToOneMapping.getRelationshipReference().getJoinColumnJoiningStrategy();
- joinColumns.addSpecifiedJoinColumn(0);
- assertFalse(oneToOneMapping.isDefault());
-
- persistentAttribute.setSpecifiedMappingKey(MappingKeys.MANY_TO_MANY_ATTRIBUTE_MAPPING_KEY);
- assertTrue(persistentAttribute.getMapping() instanceof ManyToManyMapping);
- assertFalse(persistentAttribute.getMapping().isDefault());
-
- JavaResourcePersistentType typeResource = getJpaProject().getJavaResourcePersistentType(FULLY_QUALIFIED_TYPE_NAME);
- JavaResourcePersistentAttribute attributeResource = typeResource.persistableAttributes().next();
- assertNull(attributeResource.getMappingAnnotation(OneToOneAnnotation.ANNOTATION_NAME));
- assertNotNull(attributeResource.getMappingAnnotation(ManyToManyAnnotation.ANNOTATION_NAME));
- assertNull(attributeResource.getSupportingAnnotation(JoinColumnAnnotation.ANNOTATION_NAME));
- }
-
-
- public void testUpdateSpecifiedTargetEntity() throws Exception {
- createTestEntityWithOneToOneMapping();
- addXmlClassRef(FULLY_QUALIFIED_TYPE_NAME);
-
- PersistentAttribute persistentAttribute = getJavaPersistentType().attributes().next();
- OneToOneMapping oneToOneMapping = (OneToOneMapping) persistentAttribute.getMapping();
-
- JavaResourcePersistentType typeResource = getJpaProject().getJavaResourcePersistentType(FULLY_QUALIFIED_TYPE_NAME);
- JavaResourcePersistentAttribute attributeResource = typeResource.persistableAttributes().next();
- OneToOneAnnotation oneToOne = (OneToOneAnnotation) attributeResource.getMappingAnnotation();
-
- assertNull(oneToOneMapping.getSpecifiedTargetEntity());
- assertNull(oneToOne.getTargetEntity());
-
- //set target entity in the resource model, verify context model updated
- oneToOne.setTargetEntity("newTargetEntity");
- assertEquals("newTargetEntity", oneToOneMapping.getSpecifiedTargetEntity());
- assertEquals("newTargetEntity", oneToOne.getTargetEntity());
-
- //set target entity to null in the resource model
- oneToOne.setTargetEntity(null);
- assertNull(oneToOneMapping.getSpecifiedTargetEntity());
- assertNull(oneToOne.getTargetEntity());
- }
-
- public void testModifySpecifiedTargetEntity() throws Exception {
- createTestEntityWithOneToOneMapping();
- addXmlClassRef(FULLY_QUALIFIED_TYPE_NAME);
-
- PersistentAttribute persistentAttribute = getJavaPersistentType().attributes().next();
- OneToOneMapping oneToOneMapping = (OneToOneMapping) persistentAttribute.getMapping();
-
- JavaResourcePersistentType typeResource = getJpaProject().getJavaResourcePersistentType(FULLY_QUALIFIED_TYPE_NAME);
- JavaResourcePersistentAttribute attributeResource = typeResource.persistableAttributes().next();
- OneToOneAnnotation oneToOne = (OneToOneAnnotation) attributeResource.getMappingAnnotation();
-
- assertNull(oneToOneMapping.getSpecifiedTargetEntity());
- assertNull(oneToOne.getTargetEntity());
-
- //set target entity in the context model, verify resource model updated
- oneToOneMapping.setSpecifiedTargetEntity("newTargetEntity");
- assertEquals("newTargetEntity", oneToOneMapping.getSpecifiedTargetEntity());
- assertEquals("newTargetEntity", oneToOne.getTargetEntity());
-
- //set target entity to null in the context model
- oneToOneMapping.setSpecifiedTargetEntity(null);
- assertNull(oneToOneMapping.getSpecifiedTargetEntity());
- assertNull(oneToOne.getTargetEntity());
- }
-
- public void testUpdateMappedBy() throws Exception {
- createTestEntityWithOneToOneMapping();
- addXmlClassRef(FULLY_QUALIFIED_TYPE_NAME);
-
- PersistentAttribute persistentAttribute = getJavaPersistentType().attributes().next();
- OneToOneMapping oneToOneMapping = (OneToOneMapping) persistentAttribute.getMapping();
- MappedByJoiningStrategy mappedBy = oneToOneMapping.getRelationshipReference().getMappedByJoiningStrategy();
-
- JavaResourcePersistentType typeResource = getJpaProject().getJavaResourcePersistentType(FULLY_QUALIFIED_TYPE_NAME);
- JavaResourcePersistentAttribute attributeResource = typeResource.persistableAttributes().next();
- OneToOneAnnotation oneToOne = (OneToOneAnnotation) attributeResource.getMappingAnnotation();
-
- assertNull(mappedBy.getMappedByAttribute());
- assertNull(oneToOne.getMappedBy());
-
- //set mappedBy in the resource model, verify context model updated
- oneToOne.setMappedBy("newMappedBy");
- assertEquals("newMappedBy", mappedBy.getMappedByAttribute());
- assertEquals("newMappedBy", oneToOne.getMappedBy());
-
- //set mappedBy to null in the resource model
- oneToOne.setMappedBy(null);
- assertNull(mappedBy.getMappedByAttribute());
- assertNull(oneToOne.getMappedBy());
- }
-
- public void testModifyMappedBy() throws Exception {
- createTestEntityWithOneToOneMapping();
- addXmlClassRef(FULLY_QUALIFIED_TYPE_NAME);
-
- PersistentAttribute persistentAttribute = getJavaPersistentType().attributes().next();
- OneToOneMapping oneToOneMapping = (OneToOneMapping) persistentAttribute.getMapping();
- MappedByJoiningStrategy mappedBy = oneToOneMapping.getRelationshipReference().getMappedByJoiningStrategy();
-
- JavaResourcePersistentType typeResource = getJpaProject().getJavaResourcePersistentType(FULLY_QUALIFIED_TYPE_NAME);
- JavaResourcePersistentAttribute attributeResource = typeResource.persistableAttributes().next();
- OneToOneAnnotation oneToOne = (OneToOneAnnotation) attributeResource.getMappingAnnotation();
-
- assertNull(mappedBy.getMappedByAttribute());
- assertNull(oneToOne.getMappedBy());
-
- //set mappedByJoiningStrategy in the context model, verify resource model updated
- mappedBy.setMappedByAttribute("newTargetEntity");
- assertEquals("newTargetEntity", mappedBy.getMappedByAttribute());
- assertEquals("newTargetEntity", oneToOne.getMappedBy());
-
- //set mappedByJoiningStrategy to null in the context model
- mappedBy.setMappedByAttribute(null);
- assertNull(mappedBy.getMappedByAttribute());
- assertNull(oneToOne.getMappedBy());
- }
-
- public void testUpdateSpecifiedOptional() throws Exception {
- createTestEntityWithOneToOneMapping();
- addXmlClassRef(FULLY_QUALIFIED_TYPE_NAME);
-
- PersistentAttribute persistentAttribute = getJavaPersistentType().attributes().next();
- OneToOneMapping oneToOneMapping = (OneToOneMapping) persistentAttribute.getMapping();
-
- JavaResourcePersistentType typeResource = getJpaProject().getJavaResourcePersistentType(FULLY_QUALIFIED_TYPE_NAME);
- JavaResourcePersistentAttribute attributeResource = typeResource.persistableAttributes().next();
- OneToOneAnnotation oneToOne = (OneToOneAnnotation) attributeResource.getMappingAnnotation();
-
- assertNull(oneToOneMapping.getSpecifiedOptional());
- assertNull(oneToOne.getOptional());
-
- //set optional in the resource model, verify context model updated
- oneToOne.setOptional(Boolean.TRUE);
- assertEquals(Boolean.TRUE, oneToOneMapping.getSpecifiedOptional());
- assertEquals(Boolean.TRUE, oneToOne.getOptional());
-
- oneToOne.setOptional(Boolean.FALSE);
- assertEquals(Boolean.FALSE, oneToOneMapping.getSpecifiedOptional());
- assertEquals(Boolean.FALSE, oneToOne.getOptional());
-
-
- //set optional to null in the resource model
- oneToOne.setOptional(null);
- assertNull(oneToOneMapping.getSpecifiedOptional());
- assertNull(oneToOne.getOptional());
- }
-
- public void testModifySpecifiedOptional() throws Exception {
- createTestEntityWithOneToOneMapping();
- addXmlClassRef(FULLY_QUALIFIED_TYPE_NAME);
-
- PersistentAttribute persistentAttribute = getJavaPersistentType().attributes().next();
- OneToOneMapping oneToOneMapping = (OneToOneMapping) persistentAttribute.getMapping();
-
- JavaResourcePersistentType typeResource = getJpaProject().getJavaResourcePersistentType(FULLY_QUALIFIED_TYPE_NAME);
- JavaResourcePersistentAttribute attributeResource = typeResource.persistableAttributes().next();
- OneToOneAnnotation oneToOne = (OneToOneAnnotation) attributeResource.getMappingAnnotation();
-
- assertNull(oneToOneMapping.getSpecifiedOptional());
- assertNull(oneToOne.getOptional());
-
- //set optional in the context model, verify resource model updated
- oneToOneMapping.setSpecifiedOptional(Boolean.TRUE);
- assertEquals(Boolean.TRUE, oneToOneMapping.getSpecifiedOptional());
- assertEquals(Boolean.TRUE, oneToOne.getOptional());
-
- oneToOneMapping.setSpecifiedOptional(Boolean.FALSE);
- assertEquals(Boolean.FALSE, oneToOneMapping.getSpecifiedOptional());
- assertEquals(Boolean.FALSE, oneToOne.getOptional());
-
-
- //set optional to null in the context model
- oneToOneMapping.setSpecifiedOptional(null);
- assertNull(oneToOneMapping.getSpecifiedOptional());
- assertNull(oneToOne.getOptional());
- }
-
- public void testUpdateSpecifiedFetch() throws Exception {
- createTestEntityWithOneToOneMapping();
- addXmlClassRef(FULLY_QUALIFIED_TYPE_NAME);
-
- PersistentAttribute persistentAttribute = getJavaPersistentType().attributes().next();
- OneToOneMapping oneToOneMapping = (OneToOneMapping) persistentAttribute.getMapping();
-
- JavaResourcePersistentType typeResource = getJpaProject().getJavaResourcePersistentType(FULLY_QUALIFIED_TYPE_NAME);
- JavaResourcePersistentAttribute attributeResource = typeResource.persistableAttributes().next();
- OneToOneAnnotation oneToOne = (OneToOneAnnotation) attributeResource.getMappingAnnotation();
-
- assertNull(oneToOneMapping.getSpecifiedFetch());
- assertNull(oneToOne.getFetch());
-
- //set fetch in the resource model, verify context model updated
- oneToOne.setFetch(org.eclipse.jpt.core.resource.java.FetchType.EAGER);
- assertEquals(FetchType.EAGER, oneToOneMapping.getSpecifiedFetch());
- assertEquals(org.eclipse.jpt.core.resource.java.FetchType.EAGER, oneToOne.getFetch());
-
- oneToOne.setFetch(org.eclipse.jpt.core.resource.java.FetchType.LAZY);
- assertEquals(FetchType.LAZY, oneToOneMapping.getSpecifiedFetch());
- assertEquals(org.eclipse.jpt.core.resource.java.FetchType.LAZY, oneToOne.getFetch());
-
-
- //set fetch to null in the resource model
- oneToOne.setFetch(null);
- assertNull(oneToOneMapping.getSpecifiedFetch());
- assertNull(oneToOne.getFetch());
- }
-
- public void testModifySpecifiedFetch() throws Exception {
- createTestEntityWithOneToOneMapping();
- addXmlClassRef(FULLY_QUALIFIED_TYPE_NAME);
-
- PersistentAttribute persistentAttribute = getJavaPersistentType().attributes().next();
- OneToOneMapping oneToOneMapping = (OneToOneMapping) persistentAttribute.getMapping();
-
- JavaResourcePersistentType typeResource = getJpaProject().getJavaResourcePersistentType(FULLY_QUALIFIED_TYPE_NAME);
- JavaResourcePersistentAttribute attributeResource = typeResource.persistableAttributes().next();
- OneToOneAnnotation oneToOne = (OneToOneAnnotation) attributeResource.getMappingAnnotation();
-
- assertNull(oneToOneMapping.getSpecifiedFetch());
- assertNull(oneToOne.getFetch());
-
- //set fetch in the context model, verify resource model updated
- oneToOneMapping.setSpecifiedFetch(FetchType.EAGER);
- assertEquals(FetchType.EAGER, oneToOneMapping.getSpecifiedFetch());
- assertEquals(org.eclipse.jpt.core.resource.java.FetchType.EAGER, oneToOne.getFetch());
-
- oneToOneMapping.setSpecifiedFetch(FetchType.LAZY);
- assertEquals(FetchType.LAZY, oneToOneMapping.getSpecifiedFetch());
- assertEquals(org.eclipse.jpt.core.resource.java.FetchType.LAZY, oneToOne.getFetch());
-
-
- //set fetch to null in the context model
- oneToOneMapping.setSpecifiedFetch(null);
- assertNull(oneToOneMapping.getSpecifiedFetch());
- assertNull(oneToOne.getFetch());
- }
-
- public void testSpecifiedJoinColumns() throws Exception {
- createTestEntityWithOneToOneMapping();
- addXmlClassRef(FULLY_QUALIFIED_TYPE_NAME);
-
- PersistentAttribute persistentAttribute = getJavaPersistentType().attributes().next();
- OneToOneMapping oneToOneMapping = (OneToOneMapping) persistentAttribute.getMapping();
- JoinColumnJoiningStrategy joinColumns = oneToOneMapping.getRelationshipReference().getJoinColumnJoiningStrategy();
-
- ListIterator<? extends JoinColumn> specifiedJoinColumns = joinColumns.specifiedJoinColumns();
-
- assertFalse(specifiedJoinColumns.hasNext());
-
- JavaResourcePersistentType typeResource = getJpaProject().getJavaResourcePersistentType(FULLY_QUALIFIED_TYPE_NAME);
- JavaResourcePersistentAttribute attributeResource = typeResource.persistableAttributes().next();
-
- //add an annotation to the resource model and verify the context model is updated
- JoinColumnAnnotation joinColumn = (JoinColumnAnnotation) attributeResource.addSupportingAnnotation(0, JPA.JOIN_COLUMN, JPA.JOIN_COLUMNS);
- joinColumn.setName("FOO");
- specifiedJoinColumns = joinColumns.specifiedJoinColumns();
- assertEquals("FOO", specifiedJoinColumns.next().getName());
- assertFalse(specifiedJoinColumns.hasNext());
-
- joinColumn = (JoinColumnAnnotation) attributeResource.addSupportingAnnotation(0, JPA.JOIN_COLUMN, JPA.JOIN_COLUMNS);
- joinColumn.setName("BAR");
- specifiedJoinColumns = joinColumns.specifiedJoinColumns();
- assertEquals("BAR", specifiedJoinColumns.next().getName());
- assertEquals("FOO", specifiedJoinColumns.next().getName());
- assertFalse(specifiedJoinColumns.hasNext());
-
-
- joinColumn = (JoinColumnAnnotation) attributeResource.addSupportingAnnotation(0, JPA.JOIN_COLUMN, JPA.JOIN_COLUMNS);
- joinColumn.setName("BAZ");
- specifiedJoinColumns = joinColumns.specifiedJoinColumns();
- assertEquals("BAZ", specifiedJoinColumns.next().getName());
- assertEquals("BAR", specifiedJoinColumns.next().getName());
- assertEquals("FOO", specifiedJoinColumns.next().getName());
- assertFalse(specifiedJoinColumns.hasNext());
-
- //move an annotation to the resource model and verify the context model is updated
- attributeResource.moveSupportingAnnotation(1, 0, JPA.JOIN_COLUMNS);
- specifiedJoinColumns = joinColumns.specifiedJoinColumns();
- assertEquals("BAR", specifiedJoinColumns.next().getName());
- assertEquals("BAZ", specifiedJoinColumns.next().getName());
- assertEquals("FOO", specifiedJoinColumns.next().getName());
- assertFalse(specifiedJoinColumns.hasNext());
-
- attributeResource.removeSupportingAnnotation(0, JPA.JOIN_COLUMN, JPA.JOIN_COLUMNS);
- specifiedJoinColumns = joinColumns.specifiedJoinColumns();
- assertEquals("BAZ", specifiedJoinColumns.next().getName());
- assertEquals("FOO", specifiedJoinColumns.next().getName());
- assertFalse(specifiedJoinColumns.hasNext());
-
- attributeResource.removeSupportingAnnotation(0, JPA.JOIN_COLUMN, JPA.JOIN_COLUMNS);
- specifiedJoinColumns = joinColumns.specifiedJoinColumns();
- assertEquals("FOO", specifiedJoinColumns.next().getName());
- assertFalse(specifiedJoinColumns.hasNext());
-
-
- attributeResource.removeSupportingAnnotation(0, JPA.JOIN_COLUMN, JPA.JOIN_COLUMNS);
- specifiedJoinColumns = joinColumns.specifiedJoinColumns();
- assertFalse(specifiedJoinColumns.hasNext());
- }
-
- public void testGetDefaultJoin() {
- //TODO
- }
-
- public void testSpecifiedJoinColumnsSize() throws Exception {
- createTestEntityWithOneToOneMapping();
- addXmlClassRef(FULLY_QUALIFIED_TYPE_NAME);
-
- PersistentAttribute persistentAttribute = getJavaPersistentType().attributes().next();
- OneToOneMapping oneToOneMapping = (OneToOneMapping) persistentAttribute.getMapping();
- JoinColumnJoiningStrategy joinColumns = oneToOneMapping.getRelationshipReference().getJoinColumnJoiningStrategy();
-
- assertEquals(0, joinColumns.specifiedJoinColumnsSize());
-
- joinColumns.addSpecifiedJoinColumn(0);
- assertEquals(1, joinColumns.specifiedJoinColumnsSize());
-
- joinColumns.removeSpecifiedJoinColumn(0);
- assertEquals(0, joinColumns.specifiedJoinColumnsSize());
- }
-
- public void testJoinColumnsSize() throws Exception {
- createTestEntityWithOneToOneMapping();
- addXmlClassRef(FULLY_QUALIFIED_TYPE_NAME);
-
- PersistentAttribute persistentAttribute = getJavaPersistentType().attributes().next();
- OneToOneMapping oneToOneMapping = (OneToOneMapping) persistentAttribute.getMapping();
- JoinColumnJoiningStrategy joinColumns = oneToOneMapping.getRelationshipReference().getJoinColumnJoiningStrategy();
-
- assertEquals(1, joinColumns.joinColumnsSize());
-
- joinColumns.addSpecifiedJoinColumn(0);
- assertEquals(1, joinColumns.joinColumnsSize());
-
- joinColumns.addSpecifiedJoinColumn(0);
- assertEquals(2, joinColumns.joinColumnsSize());
-
- joinColumns.removeSpecifiedJoinColumn(0);
- joinColumns.removeSpecifiedJoinColumn(0);
- assertEquals(1, joinColumns.joinColumnsSize());
-
- //if non-owning side of the relationship then no default join column
- oneToOneMapping.getRelationshipReference().getMappedByJoiningStrategy().setMappedByAttribute("foo");
- assertEquals(0, joinColumns.joinColumnsSize());
- }
-
- public void testAddSpecifiedJoinColumn() throws Exception {
- createTestEntityWithOneToOneMapping();
- addXmlClassRef(FULLY_QUALIFIED_TYPE_NAME);
-
- PersistentAttribute persistentAttribute = getJavaPersistentType().attributes().next();
- OneToOneMapping oneToOneMapping = (OneToOneMapping) persistentAttribute.getMapping();
- JoinColumnJoiningStrategy joinColumns = oneToOneMapping.getRelationshipReference().getJoinColumnJoiningStrategy();
-
- joinColumns.addSpecifiedJoinColumn(0).setSpecifiedName("FOO");
- joinColumns.addSpecifiedJoinColumn(0).setSpecifiedName("BAR");
- joinColumns.addSpecifiedJoinColumn(0).setSpecifiedName("BAZ");
-
- JavaResourcePersistentType typeResource = getJpaProject().getJavaResourcePersistentType(FULLY_QUALIFIED_TYPE_NAME);
- JavaResourcePersistentAttribute attributeResource = typeResource.persistableAttributes().next();
- Iterator<NestableAnnotation> joinColumnsIterator =
- attributeResource.supportingAnnotations(JoinColumnAnnotation.ANNOTATION_NAME, JoinColumnsAnnotation.ANNOTATION_NAME);
-
- assertEquals("BAZ", ((JoinColumnAnnotation) joinColumnsIterator.next()).getName());
- assertEquals("BAR", ((JoinColumnAnnotation) joinColumnsIterator.next()).getName());
- assertEquals("FOO", ((JoinColumnAnnotation) joinColumnsIterator.next()).getName());
- assertFalse(joinColumnsIterator.hasNext());
- }
-
- public void testAddSpecifiedJoinColumn2() throws Exception {
- createTestEntityWithOneToOneMapping();
- addXmlClassRef(FULLY_QUALIFIED_TYPE_NAME);
-
- PersistentAttribute persistentAttribute = getJavaPersistentType().attributes().next();
- OneToOneMapping oneToOneMapping = (OneToOneMapping) persistentAttribute.getMapping();
- JoinColumnJoiningStrategy joinColumns = oneToOneMapping.getRelationshipReference().getJoinColumnJoiningStrategy();
-
- joinColumns.addSpecifiedJoinColumn(0).setSpecifiedName("FOO");
- joinColumns.addSpecifiedJoinColumn(1).setSpecifiedName("BAR");
- joinColumns.addSpecifiedJoinColumn(2).setSpecifiedName("BAZ");
-
- JavaResourcePersistentType typeResource = getJpaProject().getJavaResourcePersistentType(FULLY_QUALIFIED_TYPE_NAME);
- JavaResourcePersistentAttribute attributeResource = typeResource.persistableAttributes().next();
- Iterator<NestableAnnotation> joinColumnsIterator =
- attributeResource.supportingAnnotations(JoinColumnAnnotation.ANNOTATION_NAME, JoinColumnsAnnotation.ANNOTATION_NAME);
-
- assertEquals("FOO", ((JoinColumnAnnotation) joinColumnsIterator.next()).getName());
- assertEquals("BAR", ((JoinColumnAnnotation) joinColumnsIterator.next()).getName());
- assertEquals("BAZ", ((JoinColumnAnnotation) joinColumnsIterator.next()).getName());
- assertFalse(joinColumnsIterator.hasNext());
- }
- public void testRemoveSpecifiedJoinColumn() throws Exception {
- createTestEntityWithOneToOneMapping();
- addXmlClassRef(FULLY_QUALIFIED_TYPE_NAME);
-
- PersistentAttribute persistentAttribute = getJavaPersistentType().attributes().next();
- OneToOneMapping oneToOneMapping = (OneToOneMapping) persistentAttribute.getMapping();
- JoinColumnJoiningStrategy joinColumns = oneToOneMapping.getRelationshipReference().getJoinColumnJoiningStrategy();
-
- joinColumns.addSpecifiedJoinColumn(0).setSpecifiedName("FOO");
- joinColumns.addSpecifiedJoinColumn(1).setSpecifiedName("BAR");
- joinColumns.addSpecifiedJoinColumn(2).setSpecifiedName("BAZ");
-
- JavaResourcePersistentType typeResource = getJpaProject().getJavaResourcePersistentType(FULLY_QUALIFIED_TYPE_NAME);
- JavaResourcePersistentAttribute attributeResource = typeResource.persistableAttributes().next();
-
- assertEquals(3, CollectionTools.size(attributeResource.supportingAnnotations(JoinColumnAnnotation.ANNOTATION_NAME, JoinColumnsAnnotation.ANNOTATION_NAME)));
-
- joinColumns.removeSpecifiedJoinColumn(1);
-
- Iterator<NestableAnnotation> joinColumnResources = attributeResource.supportingAnnotations(JoinColumnAnnotation.ANNOTATION_NAME, JoinColumnsAnnotation.ANNOTATION_NAME);
- assertEquals("FOO", ((JoinColumnAnnotation) joinColumnResources.next()).getName());
- assertEquals("BAZ", ((JoinColumnAnnotation) joinColumnResources.next()).getName());
- assertFalse(joinColumnResources.hasNext());
-
- Iterator<? extends JoinColumn> joinColumnsIterator = joinColumns.specifiedJoinColumns();
- assertEquals("FOO", joinColumnsIterator.next().getName());
- assertEquals("BAZ", joinColumnsIterator.next().getName());
- assertFalse(joinColumnsIterator.hasNext());
-
-
- joinColumns.removeSpecifiedJoinColumn(1);
- joinColumnResources = attributeResource.supportingAnnotations(JoinColumnAnnotation.ANNOTATION_NAME, JoinColumnsAnnotation.ANNOTATION_NAME);
- assertEquals("FOO", ((JoinColumnAnnotation) joinColumnResources.next()).getName());
- assertFalse(joinColumnResources.hasNext());
-
- joinColumnsIterator = joinColumns.specifiedJoinColumns();
- assertEquals("FOO", joinColumnsIterator.next().getName());
- assertFalse(joinColumnsIterator.hasNext());
-
-
- joinColumns.removeSpecifiedJoinColumn(0);
- joinColumnResources = attributeResource.supportingAnnotations(JoinColumnAnnotation.ANNOTATION_NAME, JoinColumnsAnnotation.ANNOTATION_NAME);
- assertFalse(joinColumnResources.hasNext());
- joinColumnsIterator = joinColumns.specifiedJoinColumns();
- assertFalse(joinColumnsIterator.hasNext());
-
- assertNull(attributeResource.getSupportingAnnotation(JoinColumnsAnnotation.ANNOTATION_NAME));
- }
-
- public void testMoveSpecifiedJoinColumn() throws Exception {
- createTestEntityWithOneToOneMapping();
- addXmlClassRef(FULLY_QUALIFIED_TYPE_NAME);
-
- PersistentAttribute persistentAttribute = getJavaPersistentType().attributes().next();
- OneToOneMapping oneToOneMapping = (OneToOneMapping) persistentAttribute.getMapping();
- JoinColumnJoiningStrategy joinColumns = oneToOneMapping.getRelationshipReference().getJoinColumnJoiningStrategy();
-
- joinColumns.addSpecifiedJoinColumn(0).setSpecifiedName("FOO");
- joinColumns.addSpecifiedJoinColumn(1).setSpecifiedName("BAR");
- joinColumns.addSpecifiedJoinColumn(2).setSpecifiedName("BAZ");
-
- JavaResourcePersistentAttribute attributeResource = getJpaProject().getJavaResourcePersistentType(FULLY_QUALIFIED_TYPE_NAME).persistableAttributes().next();
-
- ListIterator<NestableAnnotation> javaJoinColumns = attributeResource.supportingAnnotations(JoinColumnAnnotation.ANNOTATION_NAME, JoinColumnsAnnotation.ANNOTATION_NAME);
- assertEquals(3, CollectionTools.size(javaJoinColumns));
-
-
- joinColumns.moveSpecifiedJoinColumn(2, 0);
- ListIterator<? extends JoinColumn> primaryKeyJoinColumns = joinColumns.specifiedJoinColumns();
- assertEquals("BAR", primaryKeyJoinColumns.next().getSpecifiedName());
- assertEquals("BAZ", primaryKeyJoinColumns.next().getSpecifiedName());
- assertEquals("FOO", primaryKeyJoinColumns.next().getSpecifiedName());
-
- javaJoinColumns = attributeResource.supportingAnnotations(JoinColumnAnnotation.ANNOTATION_NAME, JoinColumnsAnnotation.ANNOTATION_NAME);
- assertEquals("BAR", ((JoinColumnAnnotation) javaJoinColumns.next()).getName());
- assertEquals("BAZ", ((JoinColumnAnnotation) javaJoinColumns.next()).getName());
- assertEquals("FOO", ((JoinColumnAnnotation) javaJoinColumns.next()).getName());
-
-
- joinColumns.moveSpecifiedJoinColumn(0, 1);
- primaryKeyJoinColumns = joinColumns.specifiedJoinColumns();
- assertEquals("BAZ", primaryKeyJoinColumns.next().getSpecifiedName());
- assertEquals("BAR", primaryKeyJoinColumns.next().getSpecifiedName());
- assertEquals("FOO", primaryKeyJoinColumns.next().getSpecifiedName());
-
- javaJoinColumns = attributeResource.supportingAnnotations(JoinColumnAnnotation.ANNOTATION_NAME, JoinColumnsAnnotation.ANNOTATION_NAME);
- assertEquals("BAZ", ((JoinColumnAnnotation) javaJoinColumns.next()).getName());
- assertEquals("BAR", ((JoinColumnAnnotation) javaJoinColumns.next()).getName());
- assertEquals("FOO", ((JoinColumnAnnotation) javaJoinColumns.next()).getName());
- }
-
- public void testUpdateSpecifiedJoinColumns() throws Exception {
- createTestEntityWithOneToOneMapping();
- addXmlClassRef(FULLY_QUALIFIED_TYPE_NAME);
-
- PersistentAttribute persistentAttribute = getJavaPersistentType().attributes().next();
- OneToOneMapping oneToOneMapping = (OneToOneMapping) persistentAttribute.getMapping();
- JoinColumnJoiningStrategy joinColumns = oneToOneMapping.getRelationshipReference().getJoinColumnJoiningStrategy();
- JavaResourcePersistentAttribute attributeResource = getJpaProject().getJavaResourcePersistentType(FULLY_QUALIFIED_TYPE_NAME).persistableAttributes().next();
-
- ((JoinColumnAnnotation) attributeResource.addSupportingAnnotation(0, JoinColumnAnnotation.ANNOTATION_NAME, JoinColumnsAnnotation.ANNOTATION_NAME)).setName("FOO");
- ((JoinColumnAnnotation) attributeResource.addSupportingAnnotation(1, JoinColumnAnnotation.ANNOTATION_NAME, JoinColumnsAnnotation.ANNOTATION_NAME)).setName("BAR");
- ((JoinColumnAnnotation) attributeResource.addSupportingAnnotation(2, JoinColumnAnnotation.ANNOTATION_NAME, JoinColumnsAnnotation.ANNOTATION_NAME)).setName("BAZ");
-
- ListIterator<? extends JoinColumn> joinColumnsIterator = joinColumns.specifiedJoinColumns();
- assertEquals("FOO", joinColumnsIterator.next().getName());
- assertEquals("BAR", joinColumnsIterator.next().getName());
- assertEquals("BAZ", joinColumnsIterator.next().getName());
- assertFalse(joinColumnsIterator.hasNext());
-
- attributeResource.moveSupportingAnnotation(2, 0, JoinColumnsAnnotation.ANNOTATION_NAME);
- joinColumnsIterator = joinColumns.specifiedJoinColumns();
- assertEquals("BAR", joinColumnsIterator.next().getName());
- assertEquals("BAZ", joinColumnsIterator.next().getName());
- assertEquals("FOO", joinColumnsIterator.next().getName());
- assertFalse(joinColumnsIterator.hasNext());
-
- attributeResource.moveSupportingAnnotation(0, 1, JoinColumnsAnnotation.ANNOTATION_NAME);
- joinColumnsIterator = joinColumns.specifiedJoinColumns();
- assertEquals("BAZ", joinColumnsIterator.next().getName());
- assertEquals("BAR", joinColumnsIterator.next().getName());
- assertEquals("FOO", joinColumnsIterator.next().getName());
- assertFalse(joinColumnsIterator.hasNext());
-
- attributeResource.removeSupportingAnnotation(1, JoinColumnAnnotation.ANNOTATION_NAME, JoinColumnsAnnotation.ANNOTATION_NAME);
- joinColumnsIterator = joinColumns.specifiedJoinColumns();
- assertEquals("BAZ", joinColumnsIterator.next().getName());
- assertEquals("FOO", joinColumnsIterator.next().getName());
- assertFalse(joinColumnsIterator.hasNext());
-
- attributeResource.removeSupportingAnnotation(1, JoinColumnAnnotation.ANNOTATION_NAME, JoinColumnsAnnotation.ANNOTATION_NAME);
- joinColumnsIterator = joinColumns.specifiedJoinColumns();
- assertEquals("BAZ", joinColumnsIterator.next().getName());
- assertFalse(joinColumnsIterator.hasNext());
-
- attributeResource.removeSupportingAnnotation(0, JoinColumnAnnotation.ANNOTATION_NAME, JoinColumnsAnnotation.ANNOTATION_NAME);
- joinColumnsIterator = joinColumns.specifiedJoinColumns();
- assertFalse(joinColumnsIterator.hasNext());
- }
-
- public void testJoinColumnIsVirtual() throws Exception {
- createTestEntityWithOneToOneMapping();
- addXmlClassRef(FULLY_QUALIFIED_TYPE_NAME);
-
- PersistentAttribute persistentAttribute = getJavaPersistentType().attributes().next();
- OneToOneMapping oneToOneMapping = (OneToOneMapping) persistentAttribute.getMapping();
- JoinColumnJoiningStrategy joinColumns = oneToOneMapping.getRelationshipReference().getJoinColumnJoiningStrategy();
-
- assertTrue(joinColumns.getDefaultJoinColumn().isVirtual());
-
- joinColumns.addSpecifiedJoinColumn(0);
- JoinColumn specifiedJoinColumn = joinColumns.specifiedJoinColumns().next();
- assertFalse(specifiedJoinColumn.isVirtual());
-
- assertNull(joinColumns.getDefaultJoinColumn());
- }
-
- public void testCandidateMappedByAttributeNames() throws Exception {
- createTestEntityWithValidOneToOneMapping();
- createTestTargetEntityAddress();
- addXmlClassRef(FULLY_QUALIFIED_TYPE_NAME);
- addXmlClassRef(PACKAGE_NAME + ".Address");
-
- PersistentAttribute persistentAttribute = getJavaPersistentType().attributes().next();
- OneToOneMapping oneToOneMapping = (OneToOneMapping) persistentAttribute.getMapping();
-
- Iterator<String> attributeNames =
- oneToOneMapping.getRelationshipReference().getMappedByJoiningStrategy().candidateMappedByAttributeNames();
- assertEquals("id", attributeNames.next());
- assertEquals("city", attributeNames.next());
- assertEquals("state", attributeNames.next());
- assertEquals("zip", attributeNames.next());
- assertFalse(attributeNames.hasNext());
-
- oneToOneMapping.setSpecifiedTargetEntity("foo");
- attributeNames =
- oneToOneMapping.getRelationshipReference().getMappedByJoiningStrategy().candidateMappedByAttributeNames();
- assertFalse(attributeNames.hasNext());
-
- oneToOneMapping.setSpecifiedTargetEntity(null);
- attributeNames =
- oneToOneMapping.getRelationshipReference().getMappedByJoiningStrategy().candidateMappedByAttributeNames();
- assertEquals("id", attributeNames.next());
- assertEquals("city", attributeNames.next());
- assertEquals("state", attributeNames.next());
- assertEquals("zip", attributeNames.next());
- assertFalse(attributeNames.hasNext());
- }
-
- public void testDefaultTargetEntity() throws Exception {
- createTestEntityWithValidOneToOneMapping();
- createTestTargetEntityAddress();
- addXmlClassRef(FULLY_QUALIFIED_TYPE_NAME);
-
- PersistentAttribute persistentAttribute = getJavaPersistentType().attributes().next();
- OneToOneMapping oneToOneMapping = (OneToOneMapping) persistentAttribute.getMapping();
-
- //targetEntity not in the persistence unit, default still set, handled by validation
- assertEquals(PACKAGE_NAME + ".Address", oneToOneMapping.getDefaultTargetEntity());
-
- //add targetEntity to the persistence unit
- addXmlClassRef(PACKAGE_NAME + ".Address");
- assertEquals(PACKAGE_NAME + ".Address", oneToOneMapping.getDefaultTargetEntity());
-
- //test default still the same when specified target entity it set
- oneToOneMapping.setSpecifiedTargetEntity("foo");
- assertEquals(PACKAGE_NAME + ".Address", oneToOneMapping.getDefaultTargetEntity());
-
- ListIterator<ClassRef> classRefs = getPersistenceUnit().specifiedClassRefs();
- classRefs.next();
- ClassRef addressClassRef = classRefs.next();
- JavaPersistentType addressPersistentType = addressClassRef.getJavaPersistentType();
-
- //test target is not an Entity, default target entity still exists, this case handled with validation
- addressPersistentType.setMappingKey(MappingKeys.NULL_TYPE_MAPPING_KEY);
- assertEquals(PACKAGE_NAME + ".Address", oneToOneMapping.getDefaultTargetEntity());
- }
-
- public void testDefaultTargetEntityCollectionType() throws Exception {
- createTestEntityWithCollectionOneToOneMapping();
- createTestTargetEntityAddress();
- addXmlClassRef(FULLY_QUALIFIED_TYPE_NAME);
- addXmlClassRef(PACKAGE_NAME + ".Address");
-
- PersistentAttribute persistentAttribute = getJavaPersistentType().attributes().next();
- OneToOneMapping oneToOneMapping = (OneToOneMapping) persistentAttribute.getMapping();
-
- assertNull(oneToOneMapping.getDefaultTargetEntity());
- }
-
- public void testDefaultTargetEntityGenericizedCollectionType() throws Exception {
- createTestEntityWithGenericizedCollectionOneToOneMapping();
- createTestTargetEntityAddress();
- addXmlClassRef(FULLY_QUALIFIED_TYPE_NAME);
- addXmlClassRef(PACKAGE_NAME + ".Address");
-
- PersistentAttribute persistentAttribute = getJavaPersistentType().attributes().next();
- OneToOneMapping oneToOneMapping = (OneToOneMapping) persistentAttribute.getMapping();
-
- assertNull(oneToOneMapping.getDefaultTargetEntity());
- }
-
- public void testTargetEntity() throws Exception {
- createTestEntityWithValidOneToOneMapping();
- createTestTargetEntityAddress();
- addXmlClassRef(FULLY_QUALIFIED_TYPE_NAME);
-
- PersistentAttribute persistentAttribute = getJavaPersistentType().attributes().next();
- OneToOneMapping oneToOneMapping = (OneToOneMapping) persistentAttribute.getMapping();
-
- assertEquals(PACKAGE_NAME + ".Address", oneToOneMapping.getTargetEntity());
-
- oneToOneMapping.setSpecifiedTargetEntity("foo");
- assertEquals("foo", oneToOneMapping.getTargetEntity());
-
- oneToOneMapping.setSpecifiedTargetEntity(null);
- assertEquals(PACKAGE_NAME + ".Address", oneToOneMapping.getTargetEntity());
- }
-
- public void testResolvedTargetEntity() throws Exception {
- createTestEntityWithValidOneToOneMapping();
- addXmlClassRef(FULLY_QUALIFIED_TYPE_NAME);
-
- PersistentAttribute persistentAttribute = getJavaPersistentType().attributes().next();
- OneToOneMapping oneToOneMapping = (OneToOneMapping) persistentAttribute.getMapping();
-
- //targetEntity not in the persistence unit
- assertNull(oneToOneMapping.getResolvedTargetEntity());
-
- //add targetEntity to the persistence unit, now target entity should resolve
- createTestTargetEntityAddress();
- addXmlClassRef(PACKAGE_NAME + ".Address");
- ListIterator<ClassRef> classRefs = getPersistenceUnit().specifiedClassRefs();
- classRefs.next();
- ClassRef addressClassRef = classRefs.next();
- TypeMapping addressTypeMapping = addressClassRef.getJavaPersistentType().getMapping();
- assertEquals(addressTypeMapping, oneToOneMapping.getResolvedTargetEntity());
-
- //test default still the same when specified target entity it set
- oneToOneMapping.setSpecifiedTargetEntity("foo");
- assertNull(oneToOneMapping.getResolvedTargetEntity());
-
-
- oneToOneMapping.setSpecifiedTargetEntity(PACKAGE_NAME + ".Address");
- assertEquals(addressTypeMapping, oneToOneMapping.getResolvedTargetEntity());
-
-
- oneToOneMapping.setSpecifiedTargetEntity(null);
- assertEquals(addressTypeMapping, oneToOneMapping.getResolvedTargetEntity());
- }
-
- public void testPrimaryKeyJoinColumns() throws Exception {
- createTestEntityWithOneToOneMapping();
- addXmlClassRef(FULLY_QUALIFIED_TYPE_NAME);
-
- PersistentAttribute persistentAttribute = getJavaPersistentType().attributes().next();
- OneToOneMapping oneToOneMapping = (OneToOneMapping) persistentAttribute.getMapping();
- PrimaryKeyJoinColumnJoiningStrategy strategy =
- oneToOneMapping.getRelationshipReference().getPrimaryKeyJoinColumnJoiningStrategy();
- ListIterator<JavaPrimaryKeyJoinColumn> primaryKeyJoinColumns =
- strategy.primaryKeyJoinColumns();
-
- assertFalse(primaryKeyJoinColumns.hasNext());
-
- JavaResourcePersistentType typeResource = getJpaProject().getJavaResourcePersistentType(FULLY_QUALIFIED_TYPE_NAME);
- JavaResourcePersistentAttribute attributeResource = typeResource.persistableAttributes().next();
-
- //add an annotation to the resource model and verify the context model is updated
- PrimaryKeyJoinColumnAnnotation joinColumn = (PrimaryKeyJoinColumnAnnotation) attributeResource.addSupportingAnnotation(0, JPA.PRIMARY_KEY_JOIN_COLUMN, JPA.PRIMARY_KEY_JOIN_COLUMNS);
- joinColumn.setName("FOO");
- primaryKeyJoinColumns = strategy.primaryKeyJoinColumns();
- assertEquals("FOO", primaryKeyJoinColumns.next().getName());
- assertFalse(primaryKeyJoinColumns.hasNext());
-
- joinColumn = (PrimaryKeyJoinColumnAnnotation) attributeResource.addSupportingAnnotation(0, JPA.PRIMARY_KEY_JOIN_COLUMN, JPA.PRIMARY_KEY_JOIN_COLUMNS);
- joinColumn.setName("BAR");
- primaryKeyJoinColumns = strategy.primaryKeyJoinColumns();
- assertEquals("BAR", primaryKeyJoinColumns.next().getName());
- assertEquals("FOO", primaryKeyJoinColumns.next().getName());
- assertFalse(primaryKeyJoinColumns.hasNext());
-
-
- joinColumn = (PrimaryKeyJoinColumnAnnotation) attributeResource.addSupportingAnnotation(0, JPA.PRIMARY_KEY_JOIN_COLUMN, JPA.PRIMARY_KEY_JOIN_COLUMNS);
- joinColumn.setName("BAZ");
- primaryKeyJoinColumns = strategy.primaryKeyJoinColumns();
- assertEquals("BAZ", primaryKeyJoinColumns.next().getName());
- assertEquals("BAR", primaryKeyJoinColumns.next().getName());
- assertEquals("FOO", primaryKeyJoinColumns.next().getName());
- assertFalse(primaryKeyJoinColumns.hasNext());
-
- //move an annotation to the resource model and verify the context model is updated
- attributeResource.moveSupportingAnnotation(1, 0, JPA.PRIMARY_KEY_JOIN_COLUMNS);
- primaryKeyJoinColumns = strategy.primaryKeyJoinColumns();
- assertEquals("BAR", primaryKeyJoinColumns.next().getName());
- assertEquals("BAZ", primaryKeyJoinColumns.next().getName());
- assertEquals("FOO", primaryKeyJoinColumns.next().getName());
- assertFalse(primaryKeyJoinColumns.hasNext());
-
- attributeResource.removeSupportingAnnotation(0, JPA.PRIMARY_KEY_JOIN_COLUMN, JPA.PRIMARY_KEY_JOIN_COLUMNS);
- primaryKeyJoinColumns = strategy.primaryKeyJoinColumns();
- assertEquals("BAZ", primaryKeyJoinColumns.next().getName());
- assertEquals("FOO", primaryKeyJoinColumns.next().getName());
- assertFalse(primaryKeyJoinColumns.hasNext());
-
- attributeResource.removeSupportingAnnotation(0, JPA.PRIMARY_KEY_JOIN_COLUMN, JPA.PRIMARY_KEY_JOIN_COLUMNS);
- primaryKeyJoinColumns = strategy.primaryKeyJoinColumns();
- assertEquals("FOO", primaryKeyJoinColumns.next().getName());
- assertFalse(primaryKeyJoinColumns.hasNext());
-
-
- attributeResource.removeSupportingAnnotation(0, JPA.PRIMARY_KEY_JOIN_COLUMN, JPA.PRIMARY_KEY_JOIN_COLUMNS);
- primaryKeyJoinColumns = strategy.primaryKeyJoinColumns();
- assertFalse(primaryKeyJoinColumns.hasNext());
- }
-
- public void testPrimaryKeyJoinColumnsSize() throws Exception {
- createTestEntityWithOneToOneMapping();
- addXmlClassRef(FULLY_QUALIFIED_TYPE_NAME);
-
- PersistentAttribute persistentAttribute = getJavaPersistentType().attributes().next();
- OneToOneMapping oneToOneMapping = (OneToOneMapping) persistentAttribute.getMapping();
- PrimaryKeyJoinColumnJoiningStrategy strategy =
- oneToOneMapping.getRelationshipReference().getPrimaryKeyJoinColumnJoiningStrategy();
-
- assertEquals(0, strategy.primaryKeyJoinColumnsSize());
-
- strategy.addPrimaryKeyJoinColumn(0);
- assertEquals(1, strategy.primaryKeyJoinColumnsSize());
-
- strategy.removePrimaryKeyJoinColumn(0);
- assertEquals(0, strategy.primaryKeyJoinColumnsSize());
- }
-
- public void testAddPrimaryKeyJoinColumn() throws Exception {
- createTestEntityWithOneToOneMapping();
- addXmlClassRef(FULLY_QUALIFIED_TYPE_NAME);
-
- PersistentAttribute persistentAttribute = getJavaPersistentType().attributes().next();
- OneToOneMapping oneToOneMapping = (OneToOneMapping) persistentAttribute.getMapping();
- PrimaryKeyJoinColumnJoiningStrategy strategy =
- oneToOneMapping.getRelationshipReference().getPrimaryKeyJoinColumnJoiningStrategy();
-
- strategy.addPrimaryKeyJoinColumn(0).setSpecifiedName("FOO");
- strategy.addPrimaryKeyJoinColumn(0).setSpecifiedName("BAR");
- strategy.addPrimaryKeyJoinColumn(0).setSpecifiedName("BAZ");
-
- JavaResourcePersistentType typeResource = getJpaProject().getJavaResourcePersistentType(FULLY_QUALIFIED_TYPE_NAME);
- JavaResourcePersistentAttribute attributeResource = typeResource.persistableAttributes().next();
- Iterator<NestableAnnotation> joinColumns = attributeResource.supportingAnnotations(PrimaryKeyJoinColumnAnnotation.ANNOTATION_NAME, PrimaryKeyJoinColumnsAnnotation.ANNOTATION_NAME);
-
- assertEquals("BAZ", ((PrimaryKeyJoinColumnAnnotation) joinColumns.next()).getName());
- assertEquals("BAR", ((PrimaryKeyJoinColumnAnnotation) joinColumns.next()).getName());
- assertEquals("FOO", ((PrimaryKeyJoinColumnAnnotation) joinColumns.next()).getName());
- assertFalse(joinColumns.hasNext());
- }
-
- public void testAddPrimaryKeyJoinColumn2() throws Exception {
- createTestEntityWithOneToOneMapping();
- addXmlClassRef(FULLY_QUALIFIED_TYPE_NAME);
-
- PersistentAttribute persistentAttribute = getJavaPersistentType().attributes().next();
- OneToOneMapping oneToOneMapping = (OneToOneMapping) persistentAttribute.getMapping();
- PrimaryKeyJoinColumnJoiningStrategy strategy =
- oneToOneMapping.getRelationshipReference().getPrimaryKeyJoinColumnJoiningStrategy();
-
- strategy.addPrimaryKeyJoinColumn(0).setSpecifiedName("FOO");
- strategy.addPrimaryKeyJoinColumn(1).setSpecifiedName("BAR");
- strategy.addPrimaryKeyJoinColumn(2).setSpecifiedName("BAZ");
-
- JavaResourcePersistentType typeResource = getJpaProject().getJavaResourcePersistentType(FULLY_QUALIFIED_TYPE_NAME);
- JavaResourcePersistentAttribute attributeResource = typeResource.persistableAttributes().next();
- Iterator<NestableAnnotation> joinColumns = attributeResource.supportingAnnotations(PrimaryKeyJoinColumnAnnotation.ANNOTATION_NAME, PrimaryKeyJoinColumnsAnnotation.ANNOTATION_NAME);
-
- assertEquals("FOO", ((PrimaryKeyJoinColumnAnnotation) joinColumns.next()).getName());
- assertEquals("BAR", ((PrimaryKeyJoinColumnAnnotation) joinColumns.next()).getName());
- assertEquals("BAZ", ((PrimaryKeyJoinColumnAnnotation) joinColumns.next()).getName());
- assertFalse(joinColumns.hasNext());
- }
-
- public void testRemovePrimaryKeyJoinColumn() throws Exception {
- createTestEntityWithOneToOneMapping();
- addXmlClassRef(FULLY_QUALIFIED_TYPE_NAME);
-
- PersistentAttribute persistentAttribute = getJavaPersistentType().attributes().next();
- OneToOneMapping oneToOneMapping = (OneToOneMapping) persistentAttribute.getMapping();
- PrimaryKeyJoinColumnJoiningStrategy strategy =
- oneToOneMapping.getRelationshipReference().getPrimaryKeyJoinColumnJoiningStrategy();
-
- strategy.addPrimaryKeyJoinColumn(0).setSpecifiedName("FOO");
- strategy.addPrimaryKeyJoinColumn(1).setSpecifiedName("BAR");
- strategy.addPrimaryKeyJoinColumn(2).setSpecifiedName("BAZ");
-
- JavaResourcePersistentType typeResource = getJpaProject().getJavaResourcePersistentType(FULLY_QUALIFIED_TYPE_NAME);
- JavaResourcePersistentAttribute attributeResource = typeResource.persistableAttributes().next();
-
- assertEquals(3, CollectionTools.size(attributeResource.supportingAnnotations(PrimaryKeyJoinColumnAnnotation.ANNOTATION_NAME, PrimaryKeyJoinColumnsAnnotation.ANNOTATION_NAME)));
-
- strategy.removePrimaryKeyJoinColumn(1);
-
- Iterator<NestableAnnotation> joinColumnResources = attributeResource.supportingAnnotations(PrimaryKeyJoinColumnAnnotation.ANNOTATION_NAME, PrimaryKeyJoinColumnsAnnotation.ANNOTATION_NAME);
- assertEquals("FOO", ((PrimaryKeyJoinColumnAnnotation) joinColumnResources.next()).getName());
- assertEquals("BAZ", ((PrimaryKeyJoinColumnAnnotation) joinColumnResources.next()).getName());
- assertFalse(joinColumnResources.hasNext());
-
- Iterator<PrimaryKeyJoinColumn> joinColumns = strategy.primaryKeyJoinColumns();
- assertEquals("FOO", joinColumns.next().getName());
- assertEquals("BAZ", joinColumns.next().getName());
- assertFalse(joinColumns.hasNext());
-
-
- strategy.removePrimaryKeyJoinColumn(1);
- joinColumnResources = attributeResource.supportingAnnotations(PrimaryKeyJoinColumnAnnotation.ANNOTATION_NAME, PrimaryKeyJoinColumnsAnnotation.ANNOTATION_NAME);
- assertEquals("FOO", ((PrimaryKeyJoinColumnAnnotation) joinColumnResources.next()).getName());
- assertFalse(joinColumnResources.hasNext());
-
- joinColumns = strategy.primaryKeyJoinColumns();
- assertEquals("FOO", joinColumns.next().getName());
- assertFalse(joinColumns.hasNext());
-
-
- strategy.removePrimaryKeyJoinColumn(0);
- joinColumnResources = attributeResource.supportingAnnotations(PrimaryKeyJoinColumnAnnotation.ANNOTATION_NAME, PrimaryKeyJoinColumnsAnnotation.ANNOTATION_NAME);
- assertFalse(joinColumnResources.hasNext());
- joinColumns = strategy.primaryKeyJoinColumns();
- assertFalse(joinColumns.hasNext());
-
- assertNull(attributeResource.getSupportingAnnotation(PrimaryKeyJoinColumnsAnnotation.ANNOTATION_NAME));
- }
-
- public void testMovePrimaryKeyJoinColumn() throws Exception {
- createTestEntityWithOneToOneMapping();
- addXmlClassRef(FULLY_QUALIFIED_TYPE_NAME);
-
- PersistentAttribute persistentAttribute = getJavaPersistentType().attributes().next();
- OneToOneMapping oneToOneMapping = (OneToOneMapping) persistentAttribute.getMapping();
- PrimaryKeyJoinColumnJoiningStrategy strategy =
- oneToOneMapping.getRelationshipReference().getPrimaryKeyJoinColumnJoiningStrategy();
-
- strategy.addPrimaryKeyJoinColumn(0).setSpecifiedName("FOO");
- strategy.addPrimaryKeyJoinColumn(1).setSpecifiedName("BAR");
- strategy.addPrimaryKeyJoinColumn(2).setSpecifiedName("BAZ");
-
- JavaResourcePersistentAttribute attributeResource = getJpaProject().getJavaResourcePersistentType(FULLY_QUALIFIED_TYPE_NAME).persistableAttributes().next();
-
- ListIterator<NestableAnnotation> javaJoinColumns = attributeResource.supportingAnnotations(PrimaryKeyJoinColumnAnnotation.ANNOTATION_NAME, PrimaryKeyJoinColumnsAnnotation.ANNOTATION_NAME);
- assertEquals(3, CollectionTools.size(javaJoinColumns));
-
-
- strategy.movePrimaryKeyJoinColumn(2, 0);
- ListIterator<PrimaryKeyJoinColumn> primaryKeyJoinColumns = strategy.primaryKeyJoinColumns();
- assertEquals("BAR", primaryKeyJoinColumns.next().getSpecifiedName());
- assertEquals("BAZ", primaryKeyJoinColumns.next().getSpecifiedName());
- assertEquals("FOO", primaryKeyJoinColumns.next().getSpecifiedName());
-
- javaJoinColumns = attributeResource.supportingAnnotations(PrimaryKeyJoinColumnAnnotation.ANNOTATION_NAME, PrimaryKeyJoinColumnsAnnotation.ANNOTATION_NAME);
- assertEquals("BAR", ((PrimaryKeyJoinColumnAnnotation) javaJoinColumns.next()).getName());
- assertEquals("BAZ", ((PrimaryKeyJoinColumnAnnotation) javaJoinColumns.next()).getName());
- assertEquals("FOO", ((PrimaryKeyJoinColumnAnnotation) javaJoinColumns.next()).getName());
-
-
- strategy.movePrimaryKeyJoinColumn(0, 1);
- primaryKeyJoinColumns = strategy.primaryKeyJoinColumns();
- assertEquals("BAZ", primaryKeyJoinColumns.next().getSpecifiedName());
- assertEquals("BAR", primaryKeyJoinColumns.next().getSpecifiedName());
- assertEquals("FOO", primaryKeyJoinColumns.next().getSpecifiedName());
-
- javaJoinColumns = attributeResource.supportingAnnotations(PrimaryKeyJoinColumnAnnotation.ANNOTATION_NAME, PrimaryKeyJoinColumnsAnnotation.ANNOTATION_NAME);
- assertEquals("BAZ", ((PrimaryKeyJoinColumnAnnotation) javaJoinColumns.next()).getName());
- assertEquals("BAR", ((PrimaryKeyJoinColumnAnnotation) javaJoinColumns.next()).getName());
- assertEquals("FOO", ((PrimaryKeyJoinColumnAnnotation) javaJoinColumns.next()).getName());
- }
-
- public void testUpdatePrimaryKeyJoinColumns() throws Exception {
- createTestEntityWithOneToOneMapping();
- addXmlClassRef(FULLY_QUALIFIED_TYPE_NAME);
-
- JavaResourcePersistentAttribute attributeResource = getJpaProject().getJavaResourcePersistentType(FULLY_QUALIFIED_TYPE_NAME).persistableAttributes().next();
- PersistentAttribute persistentAttribute = getJavaPersistentType().attributes().next();
- OneToOneMapping oneToOneMapping = (OneToOneMapping) persistentAttribute.getMapping();
- PrimaryKeyJoinColumnJoiningStrategy strategy =
- oneToOneMapping.getRelationshipReference().getPrimaryKeyJoinColumnJoiningStrategy();
-
- ((PrimaryKeyJoinColumnAnnotation) attributeResource.addSupportingAnnotation(0, PrimaryKeyJoinColumnAnnotation.ANNOTATION_NAME, PrimaryKeyJoinColumnsAnnotation.ANNOTATION_NAME)).setName("FOO");
- ((PrimaryKeyJoinColumnAnnotation) attributeResource.addSupportingAnnotation(1, PrimaryKeyJoinColumnAnnotation.ANNOTATION_NAME, PrimaryKeyJoinColumnsAnnotation.ANNOTATION_NAME)).setName("BAR");
- ((PrimaryKeyJoinColumnAnnotation) attributeResource.addSupportingAnnotation(2, PrimaryKeyJoinColumnAnnotation.ANNOTATION_NAME, PrimaryKeyJoinColumnsAnnotation.ANNOTATION_NAME)).setName("BAZ");
-
- ListIterator<PrimaryKeyJoinColumn> joinColumns = strategy.primaryKeyJoinColumns();
- assertEquals("FOO", joinColumns.next().getName());
- assertEquals("BAR", joinColumns.next().getName());
- assertEquals("BAZ", joinColumns.next().getName());
- assertFalse(joinColumns.hasNext());
-
- attributeResource.moveSupportingAnnotation(2, 0, PrimaryKeyJoinColumnsAnnotation.ANNOTATION_NAME);
- joinColumns = strategy.primaryKeyJoinColumns();
- assertEquals("BAR", joinColumns.next().getName());
- assertEquals("BAZ", joinColumns.next().getName());
- assertEquals("FOO", joinColumns.next().getName());
- assertFalse(joinColumns.hasNext());
-
- attributeResource.moveSupportingAnnotation(0, 1, PrimaryKeyJoinColumnsAnnotation.ANNOTATION_NAME);
- joinColumns = strategy.primaryKeyJoinColumns();
- assertEquals("BAZ", joinColumns.next().getName());
- assertEquals("BAR", joinColumns.next().getName());
- assertEquals("FOO", joinColumns.next().getName());
- assertFalse(joinColumns.hasNext());
-
- attributeResource.removeSupportingAnnotation(1, PrimaryKeyJoinColumnAnnotation.ANNOTATION_NAME, PrimaryKeyJoinColumnsAnnotation.ANNOTATION_NAME);
- joinColumns = strategy.primaryKeyJoinColumns();
- assertEquals("BAZ", joinColumns.next().getName());
- assertEquals("FOO", joinColumns.next().getName());
- assertFalse(joinColumns.hasNext());
-
- attributeResource.removeSupportingAnnotation(1, PrimaryKeyJoinColumnAnnotation.ANNOTATION_NAME, PrimaryKeyJoinColumnsAnnotation.ANNOTATION_NAME);
- joinColumns = strategy.primaryKeyJoinColumns();
- assertEquals("BAZ", joinColumns.next().getName());
- assertFalse(joinColumns.hasNext());
-
- attributeResource.removeSupportingAnnotation(0, PrimaryKeyJoinColumnAnnotation.ANNOTATION_NAME, PrimaryKeyJoinColumnsAnnotation.ANNOTATION_NAME);
- joinColumns = strategy.primaryKeyJoinColumns();
- assertFalse(joinColumns.hasNext());
- }
-}
diff --git a/jpa/tests/org.eclipse.jpt.core.tests/src/org/eclipse/jpt/core/tests/internal/context/java/JavaPrimaryKeyJoinColumnTests.java b/jpa/tests/org.eclipse.jpt.core.tests/src/org/eclipse/jpt/core/tests/internal/context/java/JavaPrimaryKeyJoinColumnTests.java
deleted file mode 100644
index 51d129c09d..0000000000
--- a/jpa/tests/org.eclipse.jpt.core.tests/src/org/eclipse/jpt/core/tests/internal/context/java/JavaPrimaryKeyJoinColumnTests.java
+++ /dev/null
@@ -1,295 +0,0 @@
-/*******************************************************************************
- * Copyright (c) 2007, 2008 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.
- *
- * Contributors:
- * Oracle - initial API and implementation
- ******************************************************************************/
-package org.eclipse.jpt.core.tests.internal.context.java;
-
-import java.util.Iterator;
-import org.eclipse.jdt.core.ICompilationUnit;
-import org.eclipse.jpt.core.MappingKeys;
-import org.eclipse.jpt.core.context.PersistentAttribute;
-import org.eclipse.jpt.core.context.PrimaryKeyJoinColumn;
-import org.eclipse.jpt.core.resource.java.JPA;
-import org.eclipse.jpt.core.resource.java.JavaResourcePersistentType;
-import org.eclipse.jpt.core.resource.java.PrimaryKeyJoinColumnAnnotation;
-import org.eclipse.jpt.core.tests.internal.context.ContextModelTestCase;
-import org.eclipse.jpt.utility.internal.iterators.ArrayIterator;
-
-public class JavaPrimaryKeyJoinColumnTests extends ContextModelTestCase
-{
- private static final String PRIMARY_KEY_JOIN_COLUMN_NAME = "MY_PRIMARY_KEY_JOIN_COLUMN";
- private static final String COLUMN_DEFINITION = "MY_COLUMN_DEFINITION";
-
-
- private ICompilationUnit createTestEntity() 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("@Id");
- }
- });
- }
-
- private ICompilationUnit createTestEntityWithPrimaryKeyJoinColumn() throws Exception {
- return this.createTestType(new DefaultAnnotationWriter() {
- @Override
- public Iterator<String> imports() {
- return new ArrayIterator<String>(JPA.ENTITY, JPA.ID, JPA.PRIMARY_KEY_JOIN_COLUMN);
- }
- @Override
- public void appendTypeAnnotationTo(StringBuilder sb) {
- sb.append("@Entity").append(CR);
- sb.append("@PrimaryKeyJoinColumn(name=\"" + PRIMARY_KEY_JOIN_COLUMN_NAME + "\")");
- }
- @Override
- public void appendIdFieldAnnotationTo(StringBuilder sb) {
- sb.append("@Id");
- }
- });
- }
-
-
- public JavaPrimaryKeyJoinColumnTests(String name) {
- super(name);
- }
-
- public void testGetSpecifiedName() throws Exception {
- createTestEntityWithPrimaryKeyJoinColumn();
- addXmlClassRef(FULLY_QUALIFIED_TYPE_NAME);
-
- PrimaryKeyJoinColumn specifiedPkJoinColumn = getJavaEntity().specifiedPrimaryKeyJoinColumns().next();
- assertEquals(PRIMARY_KEY_JOIN_COLUMN_NAME, specifiedPkJoinColumn.getSpecifiedName());
-
-
- JavaResourcePersistentType typeResource = getJpaProject().getJavaResourcePersistentType(FULLY_QUALIFIED_TYPE_NAME);
- PrimaryKeyJoinColumnAnnotation pkJoinColumnResource = (PrimaryKeyJoinColumnAnnotation) typeResource.getSupportingAnnotation(JPA.PRIMARY_KEY_JOIN_COLUMN);
-
- pkJoinColumnResource.setName("FOO");
- specifiedPkJoinColumn = getJavaEntity().specifiedPrimaryKeyJoinColumns().next();
- assertEquals("FOO", specifiedPkJoinColumn.getName());
- }
-
- public void testGetDefaultNameNoSpecifiedPrimaryKeyJoinColumns() throws Exception {
- createTestEntity();
- addXmlClassRef(FULLY_QUALIFIED_TYPE_NAME);
-
- PrimaryKeyJoinColumn pkJoinColumn = getJavaEntity().getDefaultPrimaryKeyJoinColumn();
- assertEquals("id", pkJoinColumn.getDefaultName());
- }
-
- public void testGetDefaultName() throws Exception {
- createTestEntityWithPrimaryKeyJoinColumn();
- addXmlClassRef(FULLY_QUALIFIED_TYPE_NAME);
-
- assertNull(getJavaEntity().getDefaultPrimaryKeyJoinColumn());
-
- PrimaryKeyJoinColumn specifiedPkJoinColumn = getJavaEntity().specifiedPrimaryKeyJoinColumns().next();
- assertEquals("id", specifiedPkJoinColumn.getDefaultName());
-
- //remove @Id annotation
- PersistentAttribute idAttribute = getJavaPersistentType().getAttributeNamed("id");
- idAttribute.setSpecifiedMappingKey(MappingKeys.NULL_ATTRIBUTE_MAPPING_KEY);
-
- assertNull(specifiedPkJoinColumn.getDefaultName());
- }
-
- public void testGetName() throws Exception {
- createTestEntityWithPrimaryKeyJoinColumn();
- addXmlClassRef(FULLY_QUALIFIED_TYPE_NAME);
-
- PrimaryKeyJoinColumn specifiedPkJoinColumn = getJavaEntity().specifiedPrimaryKeyJoinColumns().next();
- assertEquals(PRIMARY_KEY_JOIN_COLUMN_NAME, specifiedPkJoinColumn.getName());
- }
-
- public void testSetSpecifiedName() throws Exception {
- createTestEntityWithPrimaryKeyJoinColumn();
- addXmlClassRef(FULLY_QUALIFIED_TYPE_NAME);
-
- PrimaryKeyJoinColumn specifiedPkJoinColumn = getJavaEntity().specifiedPrimaryKeyJoinColumns().next();
-
- specifiedPkJoinColumn.setSpecifiedName("foo");
- assertEquals("foo", specifiedPkJoinColumn.getSpecifiedName());
-
- JavaResourcePersistentType typeResource = getJpaProject().getJavaResourcePersistentType(FULLY_QUALIFIED_TYPE_NAME);
- PrimaryKeyJoinColumnAnnotation pkJoinColumn = (PrimaryKeyJoinColumnAnnotation) typeResource.getSupportingAnnotation(JPA.PRIMARY_KEY_JOIN_COLUMN);
-
- assertEquals("foo", pkJoinColumn.getName());
-
- specifiedPkJoinColumn.setSpecifiedName(null);
- assertNull(specifiedPkJoinColumn.getSpecifiedName());
- pkJoinColumn = (PrimaryKeyJoinColumnAnnotation) typeResource.getSupportingAnnotation(JPA.PRIMARY_KEY_JOIN_COLUMN);
- assertNull(pkJoinColumn);
- }
-
- public void testGetColumnDefinition() throws Exception {
- createTestEntityWithPrimaryKeyJoinColumn();
- addXmlClassRef(FULLY_QUALIFIED_TYPE_NAME);
-
- PrimaryKeyJoinColumn specifiedPkJoinColumn = getJavaEntity().specifiedPrimaryKeyJoinColumns().next();
- assertNull(specifiedPkJoinColumn.getColumnDefinition());
-
- JavaResourcePersistentType typeResource = getJpaProject().getJavaResourcePersistentType(FULLY_QUALIFIED_TYPE_NAME);
- PrimaryKeyJoinColumnAnnotation column = (PrimaryKeyJoinColumnAnnotation) typeResource.getSupportingAnnotation(JPA.PRIMARY_KEY_JOIN_COLUMN);
- column.setColumnDefinition(COLUMN_DEFINITION);
-
- assertEquals(COLUMN_DEFINITION, specifiedPkJoinColumn.getColumnDefinition());
-
- column.setColumnDefinition(null);
-
- assertNull(specifiedPkJoinColumn.getColumnDefinition());
-
- typeResource.removeSupportingAnnotation(JPA.PRIMARY_KEY_JOIN_COLUMN);
-
- assertEquals(0, getJavaEntity().specifiedPrimaryKeyJoinColumnsSize());
- }
-
- public void testSetColumnDefinition() throws Exception {
- createTestEntityWithPrimaryKeyJoinColumn();
- addXmlClassRef(FULLY_QUALIFIED_TYPE_NAME);
-
- PrimaryKeyJoinColumn specifiedPkJoinColumn = getJavaEntity().specifiedPrimaryKeyJoinColumns().next();
- specifiedPkJoinColumn.setColumnDefinition("foo");
-
- JavaResourcePersistentType typeResource = getJpaProject().getJavaResourcePersistentType(FULLY_QUALIFIED_TYPE_NAME);
- PrimaryKeyJoinColumnAnnotation column = (PrimaryKeyJoinColumnAnnotation) typeResource.getSupportingAnnotation(JPA.PRIMARY_KEY_JOIN_COLUMN);
-
- assertEquals("foo", column.getColumnDefinition());
-
- specifiedPkJoinColumn.setColumnDefinition(null);
- column = (PrimaryKeyJoinColumnAnnotation) typeResource.getSupportingAnnotation(JPA.PRIMARY_KEY_JOIN_COLUMN);
- assertNull(column.getColumnDefinition());
- }
-
- public void testGetSpecifiedReferencedColumnName() throws Exception {
- createTestEntityWithPrimaryKeyJoinColumn();
- addXmlClassRef(FULLY_QUALIFIED_TYPE_NAME);
-
- PrimaryKeyJoinColumn specifiedPkJoinColumn = getJavaEntity().specifiedPrimaryKeyJoinColumns().next();
- assertNull(specifiedPkJoinColumn.getSpecifiedReferencedColumnName());
-
- JavaResourcePersistentType typeResource = getJpaProject().getJavaResourcePersistentType(FULLY_QUALIFIED_TYPE_NAME);
- PrimaryKeyJoinColumnAnnotation pkJoinColumnResource = (PrimaryKeyJoinColumnAnnotation) typeResource.getSupportingAnnotation(JPA.PRIMARY_KEY_JOIN_COLUMN);
-
- pkJoinColumnResource.setReferencedColumnName("FOO");
- specifiedPkJoinColumn = getJavaEntity().specifiedPrimaryKeyJoinColumns().next();
- assertEquals("FOO", specifiedPkJoinColumn.getSpecifiedReferencedColumnName());
- }
-
- public void testGetDefaultReferencedColumnNameNoSpecifiedPrimaryKeyJoinColumns() throws Exception {
- createTestEntity();
- addXmlClassRef(FULLY_QUALIFIED_TYPE_NAME);
-
- PrimaryKeyJoinColumn pkJoinColumn = getJavaEntity().getDefaultPrimaryKeyJoinColumn();
- assertEquals("id", pkJoinColumn.getDefaultReferencedColumnName());
- }
-
- public void testGetDefaultReferencedColumnName() throws Exception {
- createTestEntityWithPrimaryKeyJoinColumn();
- addXmlClassRef(FULLY_QUALIFIED_TYPE_NAME);
-
- assertNull(getJavaEntity().getDefaultPrimaryKeyJoinColumn());
-
- PrimaryKeyJoinColumn specifiedPkJoinColumn = getJavaEntity().specifiedPrimaryKeyJoinColumns().next();
- assertEquals("id", specifiedPkJoinColumn.getDefaultReferencedColumnName());
-
-
- //remove @Id annotation
- PersistentAttribute idAttribute = getJavaPersistentType().getAttributeNamed("id");
- idAttribute.setSpecifiedMappingKey(MappingKeys.NULL_ATTRIBUTE_MAPPING_KEY);
-
- assertNull(specifiedPkJoinColumn.getDefaultReferencedColumnName());
- }
-
- public void testGetReferencedColumnName() throws Exception {
- createTestEntityWithPrimaryKeyJoinColumn();
- addXmlClassRef(FULLY_QUALIFIED_TYPE_NAME);
-
- JavaResourcePersistentType typeResource = getJpaProject().getJavaResourcePersistentType(FULLY_QUALIFIED_TYPE_NAME);
- PrimaryKeyJoinColumnAnnotation pkJoinColumnResource = (PrimaryKeyJoinColumnAnnotation) typeResource.getSupportingAnnotation(JPA.PRIMARY_KEY_JOIN_COLUMN);
-
- pkJoinColumnResource.setReferencedColumnName("FOO");
-
- PrimaryKeyJoinColumn specifiedPkJoinColumn = getJavaEntity().specifiedPrimaryKeyJoinColumns().next();
- assertEquals("FOO", specifiedPkJoinColumn.getReferencedColumnName());
- }
-
- public void testSetSpecifiedReferencedColumnName() throws Exception {
- createTestEntityWithPrimaryKeyJoinColumn();
- addXmlClassRef(FULLY_QUALIFIED_TYPE_NAME);
-
- PrimaryKeyJoinColumn specifiedPkJoinColumn = getJavaEntity().specifiedPrimaryKeyJoinColumns().next();
-
- specifiedPkJoinColumn.setSpecifiedReferencedColumnName("foo");
- assertEquals("foo", specifiedPkJoinColumn.getSpecifiedReferencedColumnName());
-
- JavaResourcePersistentType typeResource = getJpaProject().getJavaResourcePersistentType(FULLY_QUALIFIED_TYPE_NAME);
- PrimaryKeyJoinColumnAnnotation pkJoinColumn = (PrimaryKeyJoinColumnAnnotation) typeResource.getSupportingAnnotation(JPA.PRIMARY_KEY_JOIN_COLUMN);
-
- assertEquals("foo", pkJoinColumn.getReferencedColumnName());
-
- specifiedPkJoinColumn.setSpecifiedName(null);
- specifiedPkJoinColumn.setSpecifiedReferencedColumnName(null);
- assertNull(specifiedPkJoinColumn.getSpecifiedReferencedColumnName());
- pkJoinColumn = (PrimaryKeyJoinColumnAnnotation) typeResource.getSupportingAnnotation(JPA.PRIMARY_KEY_JOIN_COLUMN);
- assertNull(pkJoinColumn);
- }
-
- public void testIsVirtual() throws Exception {
- createTestEntityWithPrimaryKeyJoinColumn();
- addXmlClassRef(FULLY_QUALIFIED_TYPE_NAME);
-
- PrimaryKeyJoinColumn specifiedPkJoinColumn = getJavaEntity().specifiedPrimaryKeyJoinColumns().next();
- assertFalse(specifiedPkJoinColumn.isVirtual());
-
- assertNull(getJavaEntity().getDefaultPrimaryKeyJoinColumn());
- getJavaEntity().removeSpecifiedPrimaryKeyJoinColumn(0);
- assertTrue(getJavaEntity().getDefaultPrimaryKeyJoinColumn().isVirtual());
- }
-
- public void testIsReferencedColumnResolved() throws Exception {
- createTestEntityWithPrimaryKeyJoinColumn();
- addXmlClassRef(FULLY_QUALIFIED_TYPE_NAME);
-
- PrimaryKeyJoinColumn specifiedPkJoinColumn = getJavaEntity().specifiedPrimaryKeyJoinColumns().next();
- assertFalse(specifiedPkJoinColumn.isReferencedColumnResolved());
- }
-
- public void testDbColumn() throws Exception {
- createTestEntityWithPrimaryKeyJoinColumn();
- addXmlClassRef(FULLY_QUALIFIED_TYPE_NAME);
-
- PrimaryKeyJoinColumn specifiedPkJoinColumn = getJavaEntity().specifiedPrimaryKeyJoinColumns().next();
- assertNull(specifiedPkJoinColumn.getDbColumn());
- }
-
- public void testDbReferencedColumn() throws Exception {
- createTestEntityWithPrimaryKeyJoinColumn();
- addXmlClassRef(FULLY_QUALIFIED_TYPE_NAME);
-
- PrimaryKeyJoinColumn specifiedPkJoinColumn = getJavaEntity().specifiedPrimaryKeyJoinColumns().next();
- assertNull(specifiedPkJoinColumn.getReferencedDbColumn());
- }
-
- public void testDbTable() throws Exception {
- createTestEntityWithPrimaryKeyJoinColumn();
- addXmlClassRef(FULLY_QUALIFIED_TYPE_NAME);
-
- PrimaryKeyJoinColumn specifiedPkJoinColumn = getJavaEntity().specifiedPrimaryKeyJoinColumns().next();
- assertNull(specifiedPkJoinColumn.getDbTable());
- }
-
-}
diff --git a/jpa/tests/org.eclipse.jpt.core.tests/src/org/eclipse/jpt/core/tests/internal/context/java/JavaQueryHintTests.java b/jpa/tests/org.eclipse.jpt.core.tests/src/org/eclipse/jpt/core/tests/internal/context/java/JavaQueryHintTests.java
deleted file mode 100644
index 9fad86298f..0000000000
--- a/jpa/tests/org.eclipse.jpt.core.tests/src/org/eclipse/jpt/core/tests/internal/context/java/JavaQueryHintTests.java
+++ /dev/null
@@ -1,143 +0,0 @@
-/*******************************************************************************
- * Copyright (c) 2007, 2009 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.
- *
- * Contributors:
- * Oracle - initial API and implementation
- ******************************************************************************/
-package org.eclipse.jpt.core.tests.internal.context.java;
-
-import java.util.Iterator;
-import org.eclipse.jdt.core.ICompilationUnit;
-import org.eclipse.jpt.core.context.Entity;
-import org.eclipse.jpt.core.context.QueryHint;
-import org.eclipse.jpt.core.resource.java.JPA;
-import org.eclipse.jpt.core.resource.java.JavaResourcePersistentType;
-import org.eclipse.jpt.core.resource.java.NamedQueryAnnotation;
-import org.eclipse.jpt.core.resource.java.QueryHintAnnotation;
-import org.eclipse.jpt.core.tests.internal.context.ContextModelTestCase;
-import org.eclipse.jpt.utility.internal.iterators.ArrayIterator;
-
-@SuppressWarnings("nls")
-public class JavaQueryHintTests extends ContextModelTestCase
-{
- private static final String QUERY_NAME = "QUERY_NAME";
-
- private ICompilationUnit createTestEntityWithNamedQuery() throws Exception {
- return this.createTestType(new DefaultAnnotationWriter() {
- @Override
- public Iterator<String> imports() {
- return new ArrayIterator<String>(JPA.ENTITY, JPA.NAMED_QUERY, JPA.QUERY_HINT);
- }
- @Override
- public void appendTypeAnnotationTo(StringBuilder sb) {
- sb.append("@Entity").append(CR);
- sb.append("@NamedQuery(name=\"" + QUERY_NAME + "\", hints=@QueryHint())");
- }
- });
- }
-
-
-
- public JavaQueryHintTests(String name) {
- super(name);
- }
-
- public void testUpdateName() throws Exception {
- createTestEntityWithNamedQuery();
- addXmlClassRef(FULLY_QUALIFIED_TYPE_NAME);
-
- Entity entity = getJavaEntity();
- QueryHint queryHint = entity.getQueryContainer().namedQueries().next().hints().next();
-
- JavaResourcePersistentType typeResource = getJpaProject().getJavaResourcePersistentType(FULLY_QUALIFIED_TYPE_NAME);
- QueryHintAnnotation javaQueryHint = ((NamedQueryAnnotation) typeResource.getSupportingAnnotation(NamedQueryAnnotation.ANNOTATION_NAME)).hints().next();
-
- assertNull(javaQueryHint.getName());
- assertNull(queryHint.getName());
-
- //set name in the resource model, verify context model updated
- javaQueryHint.setName("foo");
- assertEquals("foo", javaQueryHint.getName());
- assertEquals("foo", queryHint.getName());
-
- //set name to null in the resource model
- javaQueryHint.setName(null);
- assertNull(javaQueryHint.getName());
- assertEquals(0, entity.getQueryContainer().namedQueries().next().hintsSize());
- }
-
- public void testModifyName() throws Exception {
- createTestEntityWithNamedQuery();
- addXmlClassRef(FULLY_QUALIFIED_TYPE_NAME);
-
- Entity entity = getJavaEntity();
- QueryHint queryHint = entity.getQueryContainer().namedQueries().next().hints().next();
-
- JavaResourcePersistentType typeResource = getJpaProject().getJavaResourcePersistentType(FULLY_QUALIFIED_TYPE_NAME);
- QueryHintAnnotation javaQueryhint = ((NamedQueryAnnotation) typeResource.getSupportingAnnotation(NamedQueryAnnotation.ANNOTATION_NAME)).hints().next();
-
- assertNull(javaQueryhint.getName());
- assertNull(queryHint.getName());
-
- //set name in the context model, verify resource model updated
- queryHint.setName("foo");
- assertEquals("foo", javaQueryhint.getName());
- assertEquals("foo", queryHint.getName());
-
- //set name to null in the context model
- queryHint.setName(null);
- assertNull(javaQueryhint.getName());
- assertNull(queryHint.getName());
- }
-
- public void testUpdateValue() throws Exception {
- createTestEntityWithNamedQuery();
- addXmlClassRef(FULLY_QUALIFIED_TYPE_NAME);
-
- Entity entity = getJavaEntity();
- QueryHint queryHint = entity.getQueryContainer().namedQueries().next().hints().next();
-
- JavaResourcePersistentType typeResource = getJpaProject().getJavaResourcePersistentType(FULLY_QUALIFIED_TYPE_NAME);
- QueryHintAnnotation javaQueryhint = ((NamedQueryAnnotation) typeResource.getSupportingAnnotation(NamedQueryAnnotation.ANNOTATION_NAME)).hints().next();
-
- assertNull(javaQueryhint.getValue());
- assertNull(queryHint.getValue());
-
- //set name in the resource model, verify context model updated
- javaQueryhint.setValue("foo");
- assertEquals("foo", javaQueryhint.getValue());
- assertEquals("foo", queryHint.getValue());
-
- //set name to null in the resource model
- javaQueryhint.setValue(null);
- assertNull(javaQueryhint.getValue());
- assertEquals(0, entity.getQueryContainer().namedQueries().next().hintsSize());
- }
-
- public void testModifyValue() throws Exception {
- createTestEntityWithNamedQuery();
- addXmlClassRef(FULLY_QUALIFIED_TYPE_NAME);
-
- Entity entity = getJavaEntity();
- QueryHint queryHint = entity.getQueryContainer().namedQueries().next().hints().next();
-
- JavaResourcePersistentType typeResource = getJpaProject().getJavaResourcePersistentType(FULLY_QUALIFIED_TYPE_NAME);
- QueryHintAnnotation javaQueryhint = ((NamedQueryAnnotation) typeResource.getSupportingAnnotation(NamedQueryAnnotation.ANNOTATION_NAME)).hints().next();
-
- assertNull(javaQueryhint.getValue());
- assertNull(queryHint.getValue());
-
- //set name in the context model, verify resource model updated
- queryHint.setValue("foo");
- assertEquals("foo", javaQueryhint.getValue());
- assertEquals("foo", queryHint.getValue());
-
- //set name to null in the context model
- queryHint.setValue(null);
- assertNull(javaQueryhint.getValue());
- assertNull(queryHint.getValue());
- }
-}
diff --git a/jpa/tests/org.eclipse.jpt.core.tests/src/org/eclipse/jpt/core/tests/internal/context/java/JavaSecondaryTableTests.java b/jpa/tests/org.eclipse.jpt.core.tests/src/org/eclipse/jpt/core/tests/internal/context/java/JavaSecondaryTableTests.java
deleted file mode 100644
index 6df0ff16fa..0000000000
--- a/jpa/tests/org.eclipse.jpt.core.tests/src/org/eclipse/jpt/core/tests/internal/context/java/JavaSecondaryTableTests.java
+++ /dev/null
@@ -1,734 +0,0 @@
-/*******************************************************************************
- * Copyright (c) 2007, 2009 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.
- *
- * Contributors:
- * Oracle - initial API and implementation
- ******************************************************************************/
-package org.eclipse.jpt.core.tests.internal.context.java;
-
-import java.util.Iterator;
-import java.util.ListIterator;
-import org.eclipse.jdt.core.ICompilationUnit;
-import org.eclipse.jpt.core.MappingKeys;
-import org.eclipse.jpt.core.context.IdMapping;
-import org.eclipse.jpt.core.context.PersistentAttribute;
-import org.eclipse.jpt.core.context.PrimaryKeyJoinColumn;
-import org.eclipse.jpt.core.context.SecondaryTable;
-import org.eclipse.jpt.core.context.UniqueConstraint;
-import org.eclipse.jpt.core.context.java.JavaPrimaryKeyJoinColumn;
-import org.eclipse.jpt.core.context.java.JavaSecondaryTable;
-import org.eclipse.jpt.core.context.java.JavaUniqueConstraint;
-import org.eclipse.jpt.core.resource.java.JPA;
-import org.eclipse.jpt.core.resource.java.JavaResourcePersistentType;
-import org.eclipse.jpt.core.resource.java.NestableAnnotation;
-import org.eclipse.jpt.core.resource.java.PrimaryKeyJoinColumnAnnotation;
-import org.eclipse.jpt.core.resource.java.SecondaryTableAnnotation;
-import org.eclipse.jpt.core.resource.java.UniqueConstraintAnnotation;
-import org.eclipse.jpt.core.tests.internal.context.ContextModelTestCase;
-import org.eclipse.jpt.utility.internal.iterators.ArrayIterator;
-
-@SuppressWarnings("nls")
-public class JavaSecondaryTableTests extends ContextModelTestCase
-{
- private static final String TABLE_NAME = "MY_TABLE";
-
- private ICompilationUnit createTestEntityWithSecondaryTable() throws Exception {
- return this.createTestType(new DefaultAnnotationWriter() {
- @Override
- public Iterator<String> imports() {
- return new ArrayIterator<String>(JPA.ENTITY, JPA.SECONDARY_TABLE, JPA.ID);
- }
- @Override
- public void appendTypeAnnotationTo(StringBuilder sb) {
- sb.append("@Entity").append(CR);
- sb.append("@SecondaryTable(name=\"" + TABLE_NAME + "\")");
- }
- @Override
- public void appendIdFieldAnnotationTo(StringBuilder sb) {
- sb.append("@Id");
- }
- });
- }
-
- private ICompilationUnit createTestEntityWithSecondaryTables() throws Exception {
- return this.createTestType(new DefaultAnnotationWriter() {
- @Override
- public Iterator<String> imports() {
- return new ArrayIterator<String>(JPA.ENTITY, JPA.SECONDARY_TABLE, JPA.SECONDARY_TABLES);
- }
- @Override
- public void appendTypeAnnotationTo(StringBuilder sb) {
- sb.append("@Entity").append(CR);
- sb.append("@SecondaryTables({@SecondaryTable(name=\"foo\"), @SecondaryTable(name=\"bar\")})");
- }
- });
- }
-
-
-
-
- public JavaSecondaryTableTests(String name) {
- super(name);
- }
-
- public void testGetSpecifiedName() throws Exception {
- createTestEntityWithSecondaryTable();
- addXmlClassRef(FULLY_QUALIFIED_TYPE_NAME);
-
- SecondaryTable secondaryTable = getJavaEntity().secondaryTables().next();
- assertEquals(TABLE_NAME, secondaryTable.getSpecifiedName());
- }
-
- public void testGetDefaultNameNull() throws Exception {
- createTestEntityWithSecondaryTable();
- addXmlClassRef(FULLY_QUALIFIED_TYPE_NAME);
-
- SecondaryTable secondaryTable = getJavaEntity().secondaryTables().next();
- assertNull(secondaryTable.getDefaultName());
- }
-
- public void testGetName() throws Exception {
- createTestEntityWithSecondaryTable();
- addXmlClassRef(FULLY_QUALIFIED_TYPE_NAME);
-
- SecondaryTable secondaryTable = getJavaEntity().secondaryTables().next();
- assertEquals(TABLE_NAME, secondaryTable.getName());
- }
-
- public void testSetSpecifiedName() throws Exception {
- createTestEntityWithSecondaryTable();
- addXmlClassRef(FULLY_QUALIFIED_TYPE_NAME);
-
- SecondaryTable secondaryTable = getJavaEntity().secondaryTables().next();
- secondaryTable.setSpecifiedName("foo");
-
- assertEquals("foo", getJavaEntity().secondaryTables().next().getSpecifiedName());
-
- JavaResourcePersistentType typeResource = getJpaProject().getJavaResourcePersistentType(FULLY_QUALIFIED_TYPE_NAME);
- SecondaryTableAnnotation table = (SecondaryTableAnnotation) typeResource.getSupportingAnnotation(JPA.SECONDARY_TABLE);
-
- assertEquals("foo", table.getName());
- }
-
- public void testSetSpecifiedNameNull() throws Exception {
- createTestEntityWithSecondaryTable();
- addXmlClassRef(FULLY_QUALIFIED_TYPE_NAME);
-
- SecondaryTable secondaryTable = getJavaEntity().secondaryTables().next();
- secondaryTable.setSpecifiedName(null);
-
- assertEquals(0, getJavaEntity().secondaryTablesSize());
-
- JavaResourcePersistentType typeResource = getJpaProject().getJavaResourcePersistentType(FULLY_QUALIFIED_TYPE_NAME);
- assertNull(typeResource.getSupportingAnnotation(JPA.SECONDARY_TABLE));
- }
-
- public void testUpdateFromSpecifiedNameChangeInResourceModel() throws Exception {
- createTestEntityWithSecondaryTable();
- addXmlClassRef(FULLY_QUALIFIED_TYPE_NAME);
-
- JavaResourcePersistentType typeResource = getJpaProject().getJavaResourcePersistentType(FULLY_QUALIFIED_TYPE_NAME);
- SecondaryTableAnnotation table = (SecondaryTableAnnotation) typeResource.getSupportingAnnotation(JPA.SECONDARY_TABLE);
- table.setName("foo");
-
- assertEquals("foo", getJavaEntity().secondaryTables().next().getSpecifiedName());
- }
-
- public void testUpdateFromSpecifiedCatalogChangeInResourceModel() throws Exception {
- createTestEntityWithSecondaryTables();
- addXmlClassRef(FULLY_QUALIFIED_TYPE_NAME);
-
- JavaResourcePersistentType typeResource = getJpaProject().getJavaResourcePersistentType(FULLY_QUALIFIED_TYPE_NAME);
- ListIterator<NestableAnnotation> secondaryTableResources = typeResource.supportingAnnotations(JPA.SECONDARY_TABLE, JPA.SECONDARY_TABLES);
- ((SecondaryTableAnnotation) secondaryTableResources.next()).setCatalog("foo");
- ((SecondaryTableAnnotation) secondaryTableResources.next()).setCatalog("bar");
-
- ListIterator<JavaSecondaryTable> secondaryTsbles = getJavaEntity().secondaryTables();
- assertEquals("foo", secondaryTsbles.next().getSpecifiedCatalog());
- assertEquals("bar", secondaryTsbles.next().getSpecifiedCatalog());
- }
-
- public void testUpdateFromSpecifiedSchemaChangeInResourceModel() throws Exception {
- createTestEntityWithSecondaryTables();
- addXmlClassRef(FULLY_QUALIFIED_TYPE_NAME);
-
- JavaResourcePersistentType typeResource = getJpaProject().getJavaResourcePersistentType(FULLY_QUALIFIED_TYPE_NAME);
- ListIterator<NestableAnnotation> secondaryTableResources = typeResource.supportingAnnotations(JPA.SECONDARY_TABLE, JPA.SECONDARY_TABLES);
- ((SecondaryTableAnnotation) secondaryTableResources.next()).setSchema("foo");
- ((SecondaryTableAnnotation) secondaryTableResources.next()).setSchema("bar");
-
- ListIterator<JavaSecondaryTable> secondaryTsbles = getJavaEntity().secondaryTables();
- assertEquals("foo", secondaryTsbles.next().getSpecifiedSchema());
- assertEquals("bar", secondaryTsbles.next().getSpecifiedSchema());
- }
-
- public void testGetCatalog() throws Exception {
- createTestEntityWithSecondaryTable();
- addXmlClassRef(FULLY_QUALIFIED_TYPE_NAME);
-
- JavaResourcePersistentType typeResource = getJpaProject().getJavaResourcePersistentType(FULLY_QUALIFIED_TYPE_NAME);
- SecondaryTableAnnotation table = (SecondaryTableAnnotation) typeResource.getSupportingAnnotation(JPA.SECONDARY_TABLE);
-
- table.setCatalog("myCatalog");
-
- assertEquals("myCatalog", getJavaEntity().secondaryTables().next().getSpecifiedCatalog());
- assertEquals("myCatalog", getJavaEntity().secondaryTables().next().getCatalog());
- }
-
- public void testGetDefaultCatalog() throws Exception {
- createTestEntityWithSecondaryTable();
- addXmlClassRef(FULLY_QUALIFIED_TYPE_NAME);
-
- assertNull(getJavaEntity().secondaryTables().next().getDefaultCatalog());
-
- getJavaEntity().secondaryTables().next().setSpecifiedCatalog("myCatalog");
-
- assertNull(getJavaEntity().secondaryTables().next().getDefaultCatalog());
- }
-
- public void testSetSpecifiedCatalog() throws Exception {
- createTestEntityWithSecondaryTable();
- addXmlClassRef(FULLY_QUALIFIED_TYPE_NAME);
- SecondaryTable table = getJavaEntity().secondaryTables().next();
- table.setSpecifiedCatalog("myCatalog");
- table.setSpecifiedName(null);
-
- JavaResourcePersistentType typeResource = getJpaProject().getJavaResourcePersistentType(FULLY_QUALIFIED_TYPE_NAME);
- SecondaryTableAnnotation tableResource = (SecondaryTableAnnotation) typeResource.getSupportingAnnotation(JPA.SECONDARY_TABLE);
-
- assertEquals("myCatalog", tableResource.getCatalog());
-
- table.setSpecifiedCatalog(null);
- assertNull(typeResource.getSupportingAnnotation(JPA.SECONDARY_TABLE));
- }
-
- public void testGetSchema() throws Exception {
- createTestEntityWithSecondaryTable();
- addXmlClassRef(FULLY_QUALIFIED_TYPE_NAME);
-
- JavaResourcePersistentType typeResource = getJpaProject().getJavaResourcePersistentType(FULLY_QUALIFIED_TYPE_NAME);
- SecondaryTableAnnotation tableResource = (SecondaryTableAnnotation) typeResource.getSupportingAnnotation(JPA.SECONDARY_TABLE);
-
- tableResource.setSchema("mySchema");
-
- assertEquals("mySchema", getJavaEntity().secondaryTables().next().getSpecifiedSchema());
- assertEquals("mySchema", getJavaEntity().secondaryTables().next().getSchema());
- }
-
- public void testGetDefaultSchema() throws Exception {
- createTestEntityWithSecondaryTable();
- addXmlClassRef(FULLY_QUALIFIED_TYPE_NAME);
-
- assertNull(getJavaEntity().secondaryTables().next().getDefaultSchema());
-
- getJavaEntity().secondaryTables().next().setSpecifiedSchema("mySchema");
-
- assertNull(getJavaEntity().secondaryTables().next().getDefaultSchema());
- }
-
- public void testSetSpecifiedSchema() throws Exception {
- createTestEntityWithSecondaryTable();
- addXmlClassRef(FULLY_QUALIFIED_TYPE_NAME);
- SecondaryTable table = getJavaEntity().secondaryTables().next();
- table.setSpecifiedSchema("mySchema");
- table.setSpecifiedName(null);
-
- JavaResourcePersistentType typeResource = getJpaProject().getJavaResourcePersistentType(FULLY_QUALIFIED_TYPE_NAME);
- SecondaryTableAnnotation tableResource = (SecondaryTableAnnotation) typeResource.getSupportingAnnotation(JPA.SECONDARY_TABLE);
-
- assertEquals("mySchema", tableResource.getSchema());
-
- table.setSpecifiedSchema(null);
- assertNull(typeResource.getSupportingAnnotation(JPA.SECONDARY_TABLE));
- }
-
- public void testSpecifiedPrimaryKeyJoinColumns() throws Exception {
- createTestEntityWithSecondaryTable();
- addXmlClassRef(FULLY_QUALIFIED_TYPE_NAME);
-
- SecondaryTable secondaryTable = getJavaEntity().specifiedSecondaryTables().next();
- ListIterator<JavaPrimaryKeyJoinColumn> specifiedPkJoinColumns = secondaryTable.specifiedPrimaryKeyJoinColumns();
-
- assertFalse(specifiedPkJoinColumns.hasNext());
-
- JavaResourcePersistentType typeResource = getJpaProject().getJavaResourcePersistentType(FULLY_QUALIFIED_TYPE_NAME);
- SecondaryTableAnnotation tableResource = (SecondaryTableAnnotation) typeResource.getSupportingAnnotation(JPA.SECONDARY_TABLE);
-
- //add an annotation to the resource model and verify the context model is updated
- PrimaryKeyJoinColumnAnnotation pkJoinColumn = tableResource.addPkJoinColumn(0);
- pkJoinColumn.setName("FOO");
- specifiedPkJoinColumns = secondaryTable.specifiedPrimaryKeyJoinColumns();
- assertEquals("FOO", specifiedPkJoinColumns.next().getName());
- assertFalse(specifiedPkJoinColumns.hasNext());
-
- pkJoinColumn = tableResource.addPkJoinColumn(0);
- pkJoinColumn.setName("BAR");
- specifiedPkJoinColumns = secondaryTable.specifiedPrimaryKeyJoinColumns();
- 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
- tableResource.movePkJoinColumn(1, 0);
- specifiedPkJoinColumns = secondaryTable.specifiedPrimaryKeyJoinColumns();
- assertEquals("FOO", specifiedPkJoinColumns.next().getName());
- assertEquals("BAR", specifiedPkJoinColumns.next().getName());
- assertFalse(specifiedPkJoinColumns.hasNext());
-
- tableResource.removePkJoinColumn(0);
- specifiedPkJoinColumns = secondaryTable.specifiedPrimaryKeyJoinColumns();
- assertEquals("BAR", specifiedPkJoinColumns.next().getName());
- assertFalse(specifiedPkJoinColumns.hasNext());
-
- tableResource.removePkJoinColumn(0);
- specifiedPkJoinColumns = secondaryTable.specifiedPrimaryKeyJoinColumns();
- assertFalse(specifiedPkJoinColumns.hasNext());
- }
-
- public void testSpecifiedPrimaryKeyJoinColumnsSize() throws Exception {
- createTestEntityWithSecondaryTable();
- addXmlClassRef(FULLY_QUALIFIED_TYPE_NAME);
-
- SecondaryTable secondaryTable = getJavaEntity().specifiedSecondaryTables().next();
- assertEquals(0, secondaryTable.specifiedPrimaryKeyJoinColumnsSize());
-
- secondaryTable.addSpecifiedPrimaryKeyJoinColumn(0).setSpecifiedName("FOO");
- secondaryTable.addSpecifiedPrimaryKeyJoinColumn(0).setSpecifiedName("BAR");
- secondaryTable.addSpecifiedPrimaryKeyJoinColumn(0).setSpecifiedName("BAZ");
-
- assertEquals(3, secondaryTable.specifiedPrimaryKeyJoinColumnsSize());
- }
-
- public void testPrimaryKeyJoinColumnsSize() throws Exception {
- createTestEntityWithSecondaryTable();
- addXmlClassRef(FULLY_QUALIFIED_TYPE_NAME);
-
- SecondaryTable secondaryTable = getJavaEntity().specifiedSecondaryTables().next();
- //just the default pkJoinColumn, so 1
- assertEquals(1, secondaryTable.primaryKeyJoinColumnsSize());
-
- secondaryTable.addSpecifiedPrimaryKeyJoinColumn(0).setSpecifiedName("FOO");
- secondaryTable.addSpecifiedPrimaryKeyJoinColumn(0).setSpecifiedName("BAR");
- secondaryTable.addSpecifiedPrimaryKeyJoinColumn(0).setSpecifiedName("BAZ");
-
- //only the specified pkJoinColumns, 3
- assertEquals(3, secondaryTable.primaryKeyJoinColumnsSize());
- }
-
- public void testGetDefaultPrimaryKeyJoinColumn() throws Exception {
- createTestEntityWithSecondaryTable();
- addXmlClassRef(FULLY_QUALIFIED_TYPE_NAME);
-
- SecondaryTable secondaryTable = getJavaEntity().specifiedSecondaryTables().next();
- assertNotNull(secondaryTable.getDefaultPrimaryKeyJoinColumn());
-
- secondaryTable.addSpecifiedPrimaryKeyJoinColumn(0).setSpecifiedName("FOO");
- secondaryTable.addSpecifiedPrimaryKeyJoinColumn(0).setSpecifiedName("BAR");
- secondaryTable.addSpecifiedPrimaryKeyJoinColumn(0).setSpecifiedName("BAZ");
-
- assertNull(secondaryTable.getDefaultPrimaryKeyJoinColumn());
- }
-
- public void testPrimaryKeyJoinColumnDefaults() throws Exception {
- createTestEntityWithSecondaryTable();
- addXmlClassRef(FULLY_QUALIFIED_TYPE_NAME);
-
- SecondaryTable secondaryTable = getJavaEntity().specifiedSecondaryTables().next();
- PrimaryKeyJoinColumn defaultPkJoinColumn = secondaryTable.getDefaultPrimaryKeyJoinColumn();
- assertNotNull(defaultPkJoinColumn);
- assertEquals("id", defaultPkJoinColumn.getDefaultName());
- assertEquals("id", defaultPkJoinColumn.getDefaultReferencedColumnName());
-
-
- IdMapping idMapping = (IdMapping) getJavaEntity().getPersistentType().getAttributeNamed("id").getMapping();
- idMapping.getColumn().setSpecifiedName("FOO");
- assertEquals("FOO", defaultPkJoinColumn.getDefaultName());
- assertEquals("FOO", defaultPkJoinColumn.getDefaultReferencedColumnName());
-
- idMapping.getColumn().setSpecifiedName(null);
- assertEquals("id", defaultPkJoinColumn.getDefaultName());
- assertEquals("id", defaultPkJoinColumn.getDefaultReferencedColumnName());
- }
-
- public void testAddSpecifiedPrimaryKeyJoinColumn() throws Exception {
- createTestEntityWithSecondaryTable();
- addXmlClassRef(FULLY_QUALIFIED_TYPE_NAME);
-
- SecondaryTable secondaryTable = getJavaEntity().specifiedSecondaryTables().next();
- secondaryTable.addSpecifiedPrimaryKeyJoinColumn(0).setSpecifiedName("FOO");
- secondaryTable.addSpecifiedPrimaryKeyJoinColumn(0).setSpecifiedName("BAR");
- secondaryTable.addSpecifiedPrimaryKeyJoinColumn(0).setSpecifiedName("BAZ");
-
- Iterator<PrimaryKeyJoinColumn> specifiedPkJoinColumns = secondaryTable.specifiedPrimaryKeyJoinColumns();
- assertEquals("BAZ", specifiedPkJoinColumns.next().getName());
- assertEquals("BAR", specifiedPkJoinColumns.next().getName());
- assertEquals("FOO", specifiedPkJoinColumns.next().getName());
-
- JavaResourcePersistentType typeResource = getJpaProject().getJavaResourcePersistentType(FULLY_QUALIFIED_TYPE_NAME);
- SecondaryTableAnnotation tableResource = (SecondaryTableAnnotation) typeResource.getSupportingAnnotation(JPA.SECONDARY_TABLE);
- Iterator<PrimaryKeyJoinColumnAnnotation> pkJoinColumns = tableResource.pkJoinColumns();
-
- assertEquals("BAZ", pkJoinColumns.next().getName());
- assertEquals("BAR", pkJoinColumns.next().getName());
- assertEquals("FOO", pkJoinColumns.next().getName());
- assertFalse(pkJoinColumns.hasNext());
- }
-
- public void testAddSpecifiedPrimaryKeyJoinColumn2() throws Exception {
- createTestEntityWithSecondaryTable();
- addXmlClassRef(FULLY_QUALIFIED_TYPE_NAME);
-
- SecondaryTable secondaryTable = getJavaEntity().specifiedSecondaryTables().next();
-
- secondaryTable.addSpecifiedPrimaryKeyJoinColumn(0).setSpecifiedName("FOO");
- secondaryTable.addSpecifiedPrimaryKeyJoinColumn(1).setSpecifiedName("BAR");
- secondaryTable.addSpecifiedPrimaryKeyJoinColumn(2).setSpecifiedName("BAZ");
-
- Iterator<PrimaryKeyJoinColumn> specifiedPkJoinColumns = secondaryTable.specifiedPrimaryKeyJoinColumns();
- assertEquals("FOO", specifiedPkJoinColumns.next().getName());
- assertEquals("BAR", specifiedPkJoinColumns.next().getName());
- assertEquals("BAZ", specifiedPkJoinColumns.next().getName());
-
- JavaResourcePersistentType typeResource = getJpaProject().getJavaResourcePersistentType(FULLY_QUALIFIED_TYPE_NAME);
- SecondaryTableAnnotation tableResource = (SecondaryTableAnnotation) typeResource.getSupportingAnnotation(JPA.SECONDARY_TABLE);
- Iterator<PrimaryKeyJoinColumnAnnotation> pkJoinColumns = tableResource.pkJoinColumns();
-
- assertEquals("FOO", pkJoinColumns.next().getName());
- assertEquals("BAR", pkJoinColumns.next().getName());
- assertEquals("BAZ", pkJoinColumns.next().getName());
- assertFalse(pkJoinColumns.hasNext());
- }
- public void testRemoveSpecifiedPrimaryKeyJoinColumn() throws Exception {
- createTestEntityWithSecondaryTable();
- addXmlClassRef(FULLY_QUALIFIED_TYPE_NAME);
-
- SecondaryTable secondaryTable = getJavaEntity().specifiedSecondaryTables().next();
-
- secondaryTable.addSpecifiedPrimaryKeyJoinColumn(0).setSpecifiedName("FOO");
- secondaryTable.addSpecifiedPrimaryKeyJoinColumn(1).setSpecifiedName("BAR");
- secondaryTable.addSpecifiedPrimaryKeyJoinColumn(2).setSpecifiedName("BAZ");
-
- JavaResourcePersistentType typeResource = getJpaProject().getJavaResourcePersistentType(FULLY_QUALIFIED_TYPE_NAME);
- SecondaryTableAnnotation tableResource = (SecondaryTableAnnotation) typeResource.getSupportingAnnotation(JPA.SECONDARY_TABLE);
-
- assertEquals(3, tableResource.pkJoinColumnsSize());
-
- secondaryTable.removeSpecifiedPrimaryKeyJoinColumn(1);
-
- Iterator<PrimaryKeyJoinColumnAnnotation> pkJoinColumnResources = tableResource.pkJoinColumns();
- assertEquals("FOO", pkJoinColumnResources.next().getName());
- assertEquals("BAZ", pkJoinColumnResources.next().getName());
- assertFalse(pkJoinColumnResources.hasNext());
-
- Iterator<PrimaryKeyJoinColumn> pkJoinColumns = secondaryTable.specifiedPrimaryKeyJoinColumns();
- assertEquals("FOO", pkJoinColumns.next().getName());
- assertEquals("BAZ", pkJoinColumns.next().getName());
- assertFalse(pkJoinColumns.hasNext());
-
-
- secondaryTable.removeSpecifiedPrimaryKeyJoinColumn(1);
- pkJoinColumnResources = tableResource.pkJoinColumns();
- assertEquals("FOO", pkJoinColumnResources.next().getName());
- assertFalse(pkJoinColumnResources.hasNext());
-
- pkJoinColumns = secondaryTable.specifiedPrimaryKeyJoinColumns();
- assertEquals("FOO", pkJoinColumns.next().getName());
- assertFalse(pkJoinColumns.hasNext());
-
-
- secondaryTable.removeSpecifiedPrimaryKeyJoinColumn(0);
- pkJoinColumnResources = tableResource.pkJoinColumns();
- assertFalse(pkJoinColumnResources.hasNext());
- pkJoinColumns = secondaryTable.specifiedPrimaryKeyJoinColumns();
- assertFalse(pkJoinColumns.hasNext());
-
- assertEquals(0, tableResource.pkJoinColumnsSize());
- }
-
- public void testMoveSpecifiedPrimaryKeyJoinColumn() throws Exception {
- createTestEntityWithSecondaryTable();
- addXmlClassRef(FULLY_QUALIFIED_TYPE_NAME);
-
- SecondaryTable secondaryTable = getJavaEntity().specifiedSecondaryTables().next();
- secondaryTable.addSpecifiedPrimaryKeyJoinColumn(0).setSpecifiedName("FOO");
- secondaryTable.addSpecifiedPrimaryKeyJoinColumn(1).setSpecifiedName("BAR");
- secondaryTable.addSpecifiedPrimaryKeyJoinColumn(2).setSpecifiedName("BAZ");
-
- Iterator<PrimaryKeyJoinColumn> specifiedPkJoinColumns = secondaryTable.specifiedPrimaryKeyJoinColumns();
- assertEquals("FOO", specifiedPkJoinColumns.next().getName());
- assertEquals("BAR", specifiedPkJoinColumns.next().getName());
- assertEquals("BAZ", specifiedPkJoinColumns.next().getName());
-
- JavaResourcePersistentType typeResource = getJpaProject().getJavaResourcePersistentType(FULLY_QUALIFIED_TYPE_NAME);
- SecondaryTableAnnotation tableResource = (SecondaryTableAnnotation) typeResource.getSupportingAnnotation(JPA.SECONDARY_TABLE);
- Iterator<PrimaryKeyJoinColumnAnnotation> pkJoinColumns = tableResource.pkJoinColumns();
-
- assertEquals("FOO", pkJoinColumns.next().getName());
- assertEquals("BAR", pkJoinColumns.next().getName());
- assertEquals("BAZ", pkJoinColumns.next().getName());
-
-
- secondaryTable.moveSpecifiedPrimaryKeyJoinColumn(2, 0);
- pkJoinColumns = tableResource.pkJoinColumns();
-
- assertEquals("BAR", pkJoinColumns.next().getName());
- assertEquals("BAZ", pkJoinColumns.next().getName());
- assertEquals("FOO", pkJoinColumns.next().getName());
- }
-
- public void testPrimaryKeyJoinColumnGetDefaultName() throws Exception {
- createTestEntityWithSecondaryTable();
- addXmlClassRef(FULLY_QUALIFIED_TYPE_NAME);
-
- SecondaryTable secondaryTable = getJavaEntity().specifiedSecondaryTables().next();
- PrimaryKeyJoinColumn defaultPkJoinColumn = secondaryTable.getDefaultPrimaryKeyJoinColumn();
- assertEquals("id", defaultPkJoinColumn.getDefaultName());
-
-
- //remove @Id annotation
- PersistentAttribute idAttribute = getJavaPersistentType().getAttributeNamed("id");
- idAttribute.setSpecifiedMappingKey(MappingKeys.NULL_ATTRIBUTE_MAPPING_KEY);
-
- assertNull(defaultPkJoinColumn.getDefaultName());
- }
- public void testPrimaryKeyJoinColumnGetDefaultReferencedColumnName() throws Exception {
- createTestEntityWithSecondaryTable();
- addXmlClassRef(FULLY_QUALIFIED_TYPE_NAME);
-
- SecondaryTable secondaryTable = getJavaEntity().specifiedSecondaryTables().next();
- PrimaryKeyJoinColumn defaultPkJoinColumn = secondaryTable.getDefaultPrimaryKeyJoinColumn();
- assertEquals("id", defaultPkJoinColumn.getDefaultReferencedColumnName());
-
- //remove @Id annotation
- PersistentAttribute idAttribute = getJavaPersistentType().getAttributeNamed("id");
- idAttribute.setSpecifiedMappingKey(MappingKeys.NULL_ATTRIBUTE_MAPPING_KEY);
-
- assertNull(defaultPkJoinColumn.getDefaultReferencedColumnName());
- }
-
- public void testPrimaryKeyJoinColumnIsVirtual() throws Exception {
- createTestEntityWithSecondaryTable();
- addXmlClassRef(FULLY_QUALIFIED_TYPE_NAME);
- SecondaryTable secondaryTable = getJavaEntity().specifiedSecondaryTables().next();
-
- assertTrue(secondaryTable.getDefaultPrimaryKeyJoinColumn().isVirtual());
-
- secondaryTable.addSpecifiedPrimaryKeyJoinColumn(0);
- PrimaryKeyJoinColumn specifiedPkJoinColumn = secondaryTable.specifiedPrimaryKeyJoinColumns().next();
- assertFalse(specifiedPkJoinColumn.isVirtual());
-
- assertNull(secondaryTable.getDefaultPrimaryKeyJoinColumn());
- }
-
-
- public void testUniqueConstraints() throws Exception {
- createTestEntityWithSecondaryTable();
- addXmlClassRef(FULLY_QUALIFIED_TYPE_NAME);
-
- SecondaryTable secondaryTable = getJavaEntity().specifiedSecondaryTables().next();
-
- ListIterator<JavaUniqueConstraint> uniqueConstraints = secondaryTable.uniqueConstraints();
- assertFalse(uniqueConstraints.hasNext());
-
- JavaResourcePersistentType resourcePersistentType = getJpaProject().getJavaResourcePersistentType(FULLY_QUALIFIED_TYPE_NAME);
- SecondaryTableAnnotation secondaryTableAnnotation = (SecondaryTableAnnotation) resourcePersistentType.getSupportingAnnotation(JPA.SECONDARY_TABLE);
- secondaryTableAnnotation.addUniqueConstraint(0).addColumnName(0, "foo");
- secondaryTableAnnotation.addUniqueConstraint(0).addColumnName(0, "bar");
-
- uniqueConstraints = secondaryTable.uniqueConstraints();
- assertTrue(uniqueConstraints.hasNext());
- assertEquals("bar", uniqueConstraints.next().columnNames().next());
- assertEquals("foo", uniqueConstraints.next().columnNames().next());
- assertFalse(uniqueConstraints.hasNext());
- }
-
- public void testUniqueConstraintsSize() throws Exception {
- createTestEntityWithSecondaryTable();
- addXmlClassRef(FULLY_QUALIFIED_TYPE_NAME);
-
- SecondaryTable secondaryTable = getJavaEntity().specifiedSecondaryTables().next();
-
- assertEquals(0, secondaryTable.uniqueConstraintsSize());
-
- JavaResourcePersistentType resourcePersistentType = getJpaProject().getJavaResourcePersistentType(FULLY_QUALIFIED_TYPE_NAME);
- SecondaryTableAnnotation secondaryTableAnnotation = (SecondaryTableAnnotation) resourcePersistentType.getSupportingAnnotation(JPA.SECONDARY_TABLE);
- secondaryTableAnnotation.addUniqueConstraint(0).addColumnName(0, "foo");
- secondaryTableAnnotation.addUniqueConstraint(1).addColumnName(0, "bar");
-
- assertEquals(2, secondaryTable.uniqueConstraintsSize());
- }
-
- public void testAddUniqueConstraint() throws Exception {
- createTestEntityWithSecondaryTable();
- addXmlClassRef(FULLY_QUALIFIED_TYPE_NAME);
-
- SecondaryTable secondaryTable = getJavaEntity().specifiedSecondaryTables().next();
- secondaryTable.addUniqueConstraint(0).addColumnName(0, "FOO");
- secondaryTable.addUniqueConstraint(0).addColumnName(0, "BAR");
- secondaryTable.addUniqueConstraint(0).addColumnName(0, "BAZ");
-
- JavaResourcePersistentType resourcePersistentType = getJpaProject().getJavaResourcePersistentType(FULLY_QUALIFIED_TYPE_NAME);
- SecondaryTableAnnotation secondaryTableAnnotation = (SecondaryTableAnnotation) resourcePersistentType.getSupportingAnnotation(JPA.SECONDARY_TABLE);
- ListIterator<UniqueConstraintAnnotation> uniqueConstraints = secondaryTableAnnotation.uniqueConstraints();
-
- assertEquals("BAZ", uniqueConstraints.next().columnNames().next());
- assertEquals("BAR", uniqueConstraints.next().columnNames().next());
- assertEquals("FOO", uniqueConstraints.next().columnNames().next());
- assertFalse(uniqueConstraints.hasNext());
- }
-
- public void testAddUniqueConstraint2() throws Exception {
- createTestEntityWithSecondaryTable();
- addXmlClassRef(FULLY_QUALIFIED_TYPE_NAME);
-
- SecondaryTable secondaryTable = getJavaEntity().specifiedSecondaryTables().next();
- secondaryTable.addUniqueConstraint(0).addColumnName(0, "FOO");
- secondaryTable.addUniqueConstraint(1).addColumnName(0, "BAR");
- secondaryTable.addUniqueConstraint(0).addColumnName(0, "BAZ");
-
- JavaResourcePersistentType resourcePersistentType = getJpaProject().getJavaResourcePersistentType(FULLY_QUALIFIED_TYPE_NAME);
- SecondaryTableAnnotation secondaryTableAnnotation = (SecondaryTableAnnotation) resourcePersistentType.getSupportingAnnotation(JPA.SECONDARY_TABLE);
- ListIterator<UniqueConstraintAnnotation> uniqueConstraints = secondaryTableAnnotation.uniqueConstraints();
-
- assertEquals("BAZ", uniqueConstraints.next().columnNames().next());
- assertEquals("FOO", uniqueConstraints.next().columnNames().next());
- assertEquals("BAR", uniqueConstraints.next().columnNames().next());
- assertFalse(uniqueConstraints.hasNext());
- }
-
- public void testRemoveUniqueConstraint() throws Exception {
- createTestEntityWithSecondaryTable();
- addXmlClassRef(FULLY_QUALIFIED_TYPE_NAME);
-
- SecondaryTable secondaryTable = getJavaEntity().specifiedSecondaryTables().next();
- secondaryTable.addUniqueConstraint(0).addColumnName(0, "FOO");
- secondaryTable.addUniqueConstraint(1).addColumnName(0, "BAR");
- secondaryTable.addUniqueConstraint(2).addColumnName(0, "BAZ");
-
- JavaResourcePersistentType resourcePersistentType = getJpaProject().getJavaResourcePersistentType(FULLY_QUALIFIED_TYPE_NAME);
- SecondaryTableAnnotation secondaryTableAnnotation = (SecondaryTableAnnotation) resourcePersistentType.getSupportingAnnotation(JPA.SECONDARY_TABLE);
-
- assertEquals(3, secondaryTableAnnotation.uniqueConstraintsSize());
-
- secondaryTable.removeUniqueConstraint(1);
-
- ListIterator<UniqueConstraintAnnotation> uniqueConstraintAnnotations = secondaryTableAnnotation.uniqueConstraints();
- assertEquals("FOO", uniqueConstraintAnnotations.next().columnNames().next());
- assertEquals("BAZ", uniqueConstraintAnnotations.next().columnNames().next());
- assertFalse(uniqueConstraintAnnotations.hasNext());
-
- Iterator<UniqueConstraint> uniqueConstraints = secondaryTable.uniqueConstraints();
- assertEquals("FOO", uniqueConstraints.next().columnNames().next());
- assertEquals("BAZ", uniqueConstraints.next().columnNames().next());
- assertFalse(uniqueConstraints.hasNext());
-
-
- secondaryTable.removeUniqueConstraint(1);
- uniqueConstraintAnnotations = secondaryTableAnnotation.uniqueConstraints();
- assertEquals("FOO", uniqueConstraintAnnotations.next().columnNames().next());
- assertFalse(uniqueConstraintAnnotations.hasNext());
-
- uniqueConstraints = secondaryTable.uniqueConstraints();
- assertEquals("FOO", uniqueConstraints.next().columnNames().next());
- assertFalse(uniqueConstraints.hasNext());
-
-
- secondaryTable.removeUniqueConstraint(0);
- uniqueConstraintAnnotations = secondaryTableAnnotation.uniqueConstraints();
- assertFalse(uniqueConstraintAnnotations.hasNext());
- uniqueConstraints = secondaryTable.uniqueConstraints();
- assertFalse(uniqueConstraints.hasNext());
- }
-
- public void testMoveUniqueConstraint() throws Exception {
- createTestEntityWithSecondaryTable();
- addXmlClassRef(FULLY_QUALIFIED_TYPE_NAME);
-
- SecondaryTable secondaryTable = getJavaEntity().specifiedSecondaryTables().next();
- secondaryTable.addUniqueConstraint(0).addColumnName(0, "FOO");
- secondaryTable.addUniqueConstraint(1).addColumnName(0, "BAR");
- secondaryTable.addUniqueConstraint(2).addColumnName(0, "BAZ");
-
- JavaResourcePersistentType resourcePersistentType = getJpaProject().getJavaResourcePersistentType(FULLY_QUALIFIED_TYPE_NAME);
- SecondaryTableAnnotation secondaryTableAnnotation = (SecondaryTableAnnotation) resourcePersistentType.getSupportingAnnotation(JPA.SECONDARY_TABLE);
-
- assertEquals(3, secondaryTableAnnotation.uniqueConstraintsSize());
-
-
- secondaryTable.moveUniqueConstraint(2, 0);
- ListIterator<UniqueConstraint> uniqueConstraints = secondaryTable.uniqueConstraints();
- assertEquals("BAR", uniqueConstraints.next().columnNames().next());
- assertEquals("BAZ", uniqueConstraints.next().columnNames().next());
- assertEquals("FOO", uniqueConstraints.next().columnNames().next());
-
- ListIterator<UniqueConstraintAnnotation> uniqueConstraintAnnotations = secondaryTableAnnotation.uniqueConstraints();
- assertEquals("BAR", uniqueConstraintAnnotations.next().columnNames().next());
- assertEquals("BAZ", uniqueConstraintAnnotations.next().columnNames().next());
- assertEquals("FOO", uniqueConstraintAnnotations.next().columnNames().next());
-
-
- secondaryTable.moveUniqueConstraint(0, 1);
- uniqueConstraints = secondaryTable.uniqueConstraints();
- assertEquals("BAZ", uniqueConstraints.next().columnNames().next());
- assertEquals("BAR", uniqueConstraints.next().columnNames().next());
- assertEquals("FOO", uniqueConstraints.next().columnNames().next());
-
- uniqueConstraintAnnotations = secondaryTableAnnotation.uniqueConstraints();
- assertEquals("BAZ", uniqueConstraintAnnotations.next().columnNames().next());
- assertEquals("BAR", uniqueConstraintAnnotations.next().columnNames().next());
- assertEquals("FOO", uniqueConstraintAnnotations.next().columnNames().next());
- }
-
- public void testUpdateUniqueConstraints() throws Exception {
- createTestEntityWithSecondaryTable();
- addXmlClassRef(FULLY_QUALIFIED_TYPE_NAME);
-
- SecondaryTable secondaryTable = getJavaEntity().specifiedSecondaryTables().next();
- JavaResourcePersistentType resourcePersistentType = getJpaProject().getJavaResourcePersistentType(FULLY_QUALIFIED_TYPE_NAME);
- SecondaryTableAnnotation secondaryTableAnnotation = (SecondaryTableAnnotation) resourcePersistentType.getSupportingAnnotation(JPA.SECONDARY_TABLE);
-
- secondaryTableAnnotation.addUniqueConstraint(0).addColumnName("FOO");
- secondaryTableAnnotation.addUniqueConstraint(1).addColumnName("BAR");
- secondaryTableAnnotation.addUniqueConstraint(2).addColumnName("BAZ");
-
-
- ListIterator<UniqueConstraint> uniqueConstraints = secondaryTable.uniqueConstraints();
- assertEquals("FOO", uniqueConstraints.next().columnNames().next());
- assertEquals("BAR", uniqueConstraints.next().columnNames().next());
- assertEquals("BAZ", uniqueConstraints.next().columnNames().next());
- assertFalse(uniqueConstraints.hasNext());
-
- secondaryTableAnnotation.moveUniqueConstraint(2, 0);
- uniqueConstraints = secondaryTable.uniqueConstraints();
- assertEquals("BAR", uniqueConstraints.next().columnNames().next());
- assertEquals("BAZ", uniqueConstraints.next().columnNames().next());
- assertEquals("FOO", uniqueConstraints.next().columnNames().next());
- assertFalse(uniqueConstraints.hasNext());
-
- secondaryTableAnnotation.moveUniqueConstraint(0, 1);
- uniqueConstraints = secondaryTable.uniqueConstraints();
- assertEquals("BAZ", uniqueConstraints.next().columnNames().next());
- assertEquals("BAR", uniqueConstraints.next().columnNames().next());
- assertEquals("FOO", uniqueConstraints.next().columnNames().next());
- assertFalse(uniqueConstraints.hasNext());
-
- secondaryTableAnnotation.removeUniqueConstraint(1);
- uniqueConstraints = secondaryTable.uniqueConstraints();
- assertEquals("BAZ", uniqueConstraints.next().columnNames().next());
- assertEquals("FOO", uniqueConstraints.next().columnNames().next());
- assertFalse(uniqueConstraints.hasNext());
-
- secondaryTableAnnotation.removeUniqueConstraint(1);
- uniqueConstraints = secondaryTable.uniqueConstraints();
- assertEquals("BAZ", uniqueConstraints.next().columnNames().next());
- assertFalse(uniqueConstraints.hasNext());
-
- secondaryTableAnnotation.removeUniqueConstraint(0);
- uniqueConstraints = secondaryTable.uniqueConstraints();
- assertFalse(uniqueConstraints.hasNext());
- }
-}
diff --git a/jpa/tests/org.eclipse.jpt.core.tests/src/org/eclipse/jpt/core/tests/internal/context/java/JavaSequenceGeneratorTests.java b/jpa/tests/org.eclipse.jpt.core.tests/src/org/eclipse/jpt/core/tests/internal/context/java/JavaSequenceGeneratorTests.java
deleted file mode 100644
index 5b4f09dab3..0000000000
--- a/jpa/tests/org.eclipse.jpt.core.tests/src/org/eclipse/jpt/core/tests/internal/context/java/JavaSequenceGeneratorTests.java
+++ /dev/null
@@ -1,256 +0,0 @@
-/*******************************************************************************
- * Copyright (c) 2007, 2009 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.
- *
- * Contributors:
- * Oracle - initial API and implementation
- ******************************************************************************/
-package org.eclipse.jpt.core.tests.internal.context.java;
-
-import java.util.Iterator;
-import org.eclipse.jdt.core.ICompilationUnit;
-import org.eclipse.jpt.core.context.Generator;
-import org.eclipse.jpt.core.context.IdMapping;
-import org.eclipse.jpt.core.context.SequenceGenerator;
-import org.eclipse.jpt.core.resource.java.JPA;
-import org.eclipse.jpt.core.resource.java.JavaResourcePersistentAttribute;
-import org.eclipse.jpt.core.resource.java.JavaResourcePersistentType;
-import org.eclipse.jpt.core.resource.java.SequenceGeneratorAnnotation;
-import org.eclipse.jpt.core.tests.internal.context.ContextModelTestCase;
-import org.eclipse.jpt.utility.internal.iterators.ArrayIterator;
-
-@SuppressWarnings("nls")
-public class JavaSequenceGeneratorTests extends ContextModelTestCase
-{
- private static final String SEQUENCE_GENERATOR_NAME = "MY_SEQUENCE_GENERATOR";
-
-
- protected ICompilationUnit createTestEntityWithSequenceGenerator() throws Exception {
- return this.createTestType(new DefaultAnnotationWriter() {
- @Override
- public Iterator<String> imports() {
- return new ArrayIterator<String>(JPA.ENTITY, JPA.SEQUENCE_GENERATOR, JPA.ID);
- }
- @Override
- public void appendTypeAnnotationTo(StringBuilder sb) {
- sb.append("@Entity");
- }
-
- @Override
- public void appendIdFieldAnnotationTo(StringBuilder sb) {
- sb.append("@Id").append(CR);
- sb.append("@SequenceGenerator(name=\"" + SEQUENCE_GENERATOR_NAME + "\")");
- }
- });
- }
-
- public JavaSequenceGeneratorTests(String name) {
- super(name);
- }
-
- public void testGetName() throws Exception {
- createTestEntityWithSequenceGenerator();
- addXmlClassRef(FULLY_QUALIFIED_TYPE_NAME);
-
- IdMapping idMapping = (IdMapping) getJavaPersistentType().getAttributeNamed("id").getMapping();
- assertEquals(SEQUENCE_GENERATOR_NAME, idMapping.getGeneratorContainer().getSequenceGenerator().getName());
-
- //change resource model sequenceGenerator name, verify the context model is updated
- JavaResourcePersistentType typeResource = getJpaProject().getJavaResourcePersistentType(FULLY_QUALIFIED_TYPE_NAME);
- JavaResourcePersistentAttribute attributeResource = typeResource.persistableAttributes().next();
- SequenceGeneratorAnnotation sequenceGenerator = (SequenceGeneratorAnnotation) attributeResource.getSupportingAnnotation(JPA.SEQUENCE_GENERATOR);
-
- sequenceGenerator.setName("foo");
-
- assertEquals("foo", idMapping.getGeneratorContainer().getSequenceGenerator().getName());
- }
-
- public void testSetName() throws Exception {
- createTestEntityWithSequenceGenerator();
- addXmlClassRef(FULLY_QUALIFIED_TYPE_NAME);
-
- IdMapping idMapping = (IdMapping) getJavaPersistentType().getAttributeNamed("id").getMapping();
- assertEquals(SEQUENCE_GENERATOR_NAME, idMapping.getGeneratorContainer().getSequenceGenerator().getName());
-
- idMapping.getGeneratorContainer().getSequenceGenerator().setName("foo");
-
- assertEquals("foo", idMapping.getGeneratorContainer().getSequenceGenerator().getName());
-
- JavaResourcePersistentType typeResource = getJpaProject().getJavaResourcePersistentType(FULLY_QUALIFIED_TYPE_NAME);
- JavaResourcePersistentAttribute attributeResource = typeResource.persistableAttributes().next();
- SequenceGeneratorAnnotation sequenceGenerator = (SequenceGeneratorAnnotation) attributeResource.getSupportingAnnotation(JPA.SEQUENCE_GENERATOR);
-
- assertEquals("foo", sequenceGenerator.getName());
- }
-
- public void testSetSpecifiedNameNull() throws Exception {
- createTestEntityWithSequenceGenerator();
- addXmlClassRef(FULLY_QUALIFIED_TYPE_NAME);
-
- IdMapping idMapping = (IdMapping) getJavaPersistentType().getAttributeNamed("id").getMapping();
- assertEquals(SEQUENCE_GENERATOR_NAME, idMapping.getGeneratorContainer().getSequenceGenerator().getName());
-
- idMapping.getGeneratorContainer().getSequenceGenerator().setName(null);
-
- assertNull(idMapping.getGeneratorContainer().getSequenceGenerator());
-
- JavaResourcePersistentType typeResource = getJpaProject().getJavaResourcePersistentType(FULLY_QUALIFIED_TYPE_NAME);
- JavaResourcePersistentAttribute attributeResource = typeResource.persistableAttributes().next();
- SequenceGeneratorAnnotation sequenceGenerator = (SequenceGeneratorAnnotation) attributeResource.getSupportingAnnotation(JPA.SEQUENCE_GENERATOR);
-
- assertNull(sequenceGenerator);
- }
-
- public void testGetInitialValue() throws Exception {
- createTestEntityWithSequenceGenerator();
- addXmlClassRef(FULLY_QUALIFIED_TYPE_NAME);
-
- IdMapping idMapping = (IdMapping) getJavaPersistentType().getAttributeNamed("id").getMapping();
-
- assertEquals(SequenceGenerator.DEFAULT_INITIAL_VALUE, idMapping.getGeneratorContainer().getSequenceGenerator().getInitialValue());
- JavaResourcePersistentType typeResource = getJpaProject().getJavaResourcePersistentType(FULLY_QUALIFIED_TYPE_NAME);
- JavaResourcePersistentAttribute attributeResource = typeResource.persistableAttributes().next();
- SequenceGeneratorAnnotation sequenceGenerator = (SequenceGeneratorAnnotation) attributeResource.getSupportingAnnotation(JPA.SEQUENCE_GENERATOR);
-
- sequenceGenerator.setInitialValue(Integer.valueOf(82));
-
- assertEquals(82, idMapping.getGeneratorContainer().getSequenceGenerator().getInitialValue());
- assertEquals(Integer.valueOf(82), idMapping.getGeneratorContainer().getSequenceGenerator().getSpecifiedInitialValue());
- }
-
- public void testGetDefaultInitialValue() throws Exception {
- createTestEntityWithSequenceGenerator();
- addXmlClassRef(FULLY_QUALIFIED_TYPE_NAME);
-
- IdMapping idMapping = (IdMapping) getJavaPersistentType().getAttributeNamed("id").getMapping();
-
- assertEquals(SequenceGenerator.DEFAULT_INITIAL_VALUE, idMapping.getGeneratorContainer().getSequenceGenerator().getDefaultInitialValue());
-
- idMapping.getGeneratorContainer().getSequenceGenerator().setSpecifiedInitialValue(Integer.valueOf(82));
-
- assertEquals(SequenceGenerator.DEFAULT_INITIAL_VALUE, idMapping.getGeneratorContainer().getSequenceGenerator().getDefaultInitialValue());
- assertEquals(Integer.valueOf(82), idMapping.getGeneratorContainer().getSequenceGenerator().getSpecifiedInitialValue());
- }
-
- public void testSetSpecifiedInitialValue() throws Exception {
- createTestEntityWithSequenceGenerator();
- addXmlClassRef(FULLY_QUALIFIED_TYPE_NAME);
-
- IdMapping idMapping = (IdMapping) getJavaPersistentType().getAttributeNamed("id").getMapping();
- idMapping.getGeneratorContainer().getSequenceGenerator().setSpecifiedInitialValue(Integer.valueOf(20));
-
- JavaResourcePersistentType typeResource = getJpaProject().getJavaResourcePersistentType(FULLY_QUALIFIED_TYPE_NAME);
- JavaResourcePersistentAttribute attributeResource = typeResource.persistableAttributes().next();
- SequenceGeneratorAnnotation sequenceGenerator = (SequenceGeneratorAnnotation) attributeResource.getSupportingAnnotation(JPA.SEQUENCE_GENERATOR);
-
- assertEquals(Integer.valueOf(20), sequenceGenerator.getInitialValue());
-
- idMapping.getGeneratorContainer().getSequenceGenerator().setName(null);
- idMapping.getGeneratorContainer().getSequenceGenerator().setSpecifiedInitialValue(null);
- assertNull(attributeResource.getSupportingAnnotation(JPA.SEQUENCE_GENERATOR));
- }
-
- public void testGetAllocationSize() throws Exception {
- createTestEntityWithSequenceGenerator();
- addXmlClassRef(FULLY_QUALIFIED_TYPE_NAME);
-
- IdMapping idMapping = (IdMapping) getJavaPersistentType().getAttributeNamed("id").getMapping();
-
- assertEquals(Generator.DEFAULT_ALLOCATION_SIZE, idMapping.getGeneratorContainer().getSequenceGenerator().getAllocationSize());
-
- JavaResourcePersistentType typeResource = getJpaProject().getJavaResourcePersistentType(FULLY_QUALIFIED_TYPE_NAME);
- JavaResourcePersistentAttribute attributeResource = typeResource.persistableAttributes().next();
- SequenceGeneratorAnnotation sequenceGenerator = (SequenceGeneratorAnnotation) attributeResource.getSupportingAnnotation(JPA.SEQUENCE_GENERATOR);
-
- sequenceGenerator.setAllocationSize(Integer.valueOf(20));
-
- assertEquals(20, idMapping.getGeneratorContainer().getSequenceGenerator().getAllocationSize());
- assertEquals(Integer.valueOf(20), idMapping.getGeneratorContainer().getSequenceGenerator().getSpecifiedAllocationSize());
- }
-
- public void testGetDefaultAllocationSize() throws Exception {
- createTestEntityWithSequenceGenerator();
- addXmlClassRef(FULLY_QUALIFIED_TYPE_NAME);
-
- IdMapping idMapping = (IdMapping) getJavaPersistentType().getAttributeNamed("id").getMapping();
-
- assertEquals(Generator.DEFAULT_ALLOCATION_SIZE, idMapping.getGeneratorContainer().getSequenceGenerator().getDefaultAllocationSize());
-
- idMapping.getGeneratorContainer().getSequenceGenerator().setSpecifiedAllocationSize(Integer.valueOf(20));
-
- assertEquals(Generator.DEFAULT_ALLOCATION_SIZE, idMapping.getGeneratorContainer().getSequenceGenerator().getDefaultAllocationSize());
- assertEquals(Integer.valueOf(20), idMapping.getGeneratorContainer().getSequenceGenerator().getSpecifiedAllocationSize());
- }
-
- public void testSetSpecifiedAllocationSize() throws Exception {
- createTestEntityWithSequenceGenerator();
- addXmlClassRef(FULLY_QUALIFIED_TYPE_NAME);
-
- IdMapping idMapping = (IdMapping) getJavaPersistentType().getAttributeNamed("id").getMapping();
- idMapping.getGeneratorContainer().getSequenceGenerator().setSpecifiedAllocationSize(Integer.valueOf(25));
-
- JavaResourcePersistentType typeResource = getJpaProject().getJavaResourcePersistentType(FULLY_QUALIFIED_TYPE_NAME);
- JavaResourcePersistentAttribute attributeResource = typeResource.persistableAttributes().next();
- SequenceGeneratorAnnotation sequenceGenerator = (SequenceGeneratorAnnotation) attributeResource.getSupportingAnnotation(JPA.SEQUENCE_GENERATOR);
-
- assertEquals(Integer.valueOf(25), sequenceGenerator.getAllocationSize());
-
- idMapping.getGeneratorContainer().getSequenceGenerator().setName(null);
- idMapping.getGeneratorContainer().getSequenceGenerator().setSpecifiedAllocationSize(null);
- assertNull(attributeResource.getSupportingAnnotation(JPA.SEQUENCE_GENERATOR));
- }
-
-
-
- public void testGetSequenceName() throws Exception {
- createTestEntityWithSequenceGenerator();
- addXmlClassRef(FULLY_QUALIFIED_TYPE_NAME);
-
- IdMapping idMapping = (IdMapping) getJavaPersistentType().getAttributeNamed("id").getMapping();
-
- assertNull(idMapping.getGeneratorContainer().getSequenceGenerator().getSequenceName());
- JavaResourcePersistentType typeResource = getJpaProject().getJavaResourcePersistentType(FULLY_QUALIFIED_TYPE_NAME);
- JavaResourcePersistentAttribute attributeResource = typeResource.persistableAttributes().next();
- SequenceGeneratorAnnotation sequenceGenerator = (SequenceGeneratorAnnotation) attributeResource.getSupportingAnnotation(JPA.SEQUENCE_GENERATOR);
-
- sequenceGenerator.setSequenceName("mySequenceName");
-
- assertEquals("mySequenceName", idMapping.getGeneratorContainer().getSequenceGenerator().getSequenceName());
- assertEquals("mySequenceName", idMapping.getGeneratorContainer().getSequenceGenerator().getSpecifiedSequenceName());
- }
-
- public void testGetDefaultSequenceName() throws Exception {
- createTestEntityWithSequenceGenerator();
- addXmlClassRef(FULLY_QUALIFIED_TYPE_NAME);
-
- IdMapping idMapping = (IdMapping) getJavaPersistentType().getAttributeNamed("id").getMapping();
-
- assertNull(idMapping.getGeneratorContainer().getSequenceGenerator().getDefaultSequenceName());
-
- idMapping.getGeneratorContainer().getSequenceGenerator().setSpecifiedSequenceName("mySequenceName");
-
- assertNull(idMapping.getGeneratorContainer().getSequenceGenerator().getDefaultSequenceName());
- assertEquals("mySequenceName", idMapping.getGeneratorContainer().getSequenceGenerator().getSpecifiedSequenceName());
- }
-
- public void testSetSpecifiedSequenceName() throws Exception {
- createTestEntityWithSequenceGenerator();
- addXmlClassRef(FULLY_QUALIFIED_TYPE_NAME);
-
- IdMapping idMapping = (IdMapping) getJavaPersistentType().getAttributeNamed("id").getMapping();
- idMapping.getGeneratorContainer().getSequenceGenerator().setSpecifiedSequenceName("mySequenceName");
-
- JavaResourcePersistentType typeResource = getJpaProject().getJavaResourcePersistentType(FULLY_QUALIFIED_TYPE_NAME);
- JavaResourcePersistentAttribute attributeResource = typeResource.persistableAttributes().next();
- SequenceGeneratorAnnotation sequenceGenerator = (SequenceGeneratorAnnotation) attributeResource.getSupportingAnnotation(JPA.SEQUENCE_GENERATOR);
-
- assertEquals("mySequenceName", sequenceGenerator.getSequenceName());
-
- idMapping.getGeneratorContainer().getSequenceGenerator().setName(null);
- idMapping.getGeneratorContainer().getSequenceGenerator().setSpecifiedSequenceName(null);
- assertNull(attributeResource.getSupportingAnnotation(JPA.SEQUENCE_GENERATOR));
- }
-
-}
diff --git a/jpa/tests/org.eclipse.jpt.core.tests/src/org/eclipse/jpt/core/tests/internal/context/java/JavaTableGeneratorTests.java b/jpa/tests/org.eclipse.jpt.core.tests/src/org/eclipse/jpt/core/tests/internal/context/java/JavaTableGeneratorTests.java
deleted file mode 100644
index 7231ee7c23..0000000000
--- a/jpa/tests/org.eclipse.jpt.core.tests/src/org/eclipse/jpt/core/tests/internal/context/java/JavaTableGeneratorTests.java
+++ /dev/null
@@ -1,701 +0,0 @@
-/*******************************************************************************
- * Copyright (c) 2007, 2009 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.
- *
- * Contributors:
- * Oracle - initial API and implementation
- ******************************************************************************/
-package org.eclipse.jpt.core.tests.internal.context.java;
-
-import java.util.Iterator;
-import java.util.ListIterator;
-import org.eclipse.jdt.core.ICompilationUnit;
-import org.eclipse.jpt.core.JptCorePlugin;
-import org.eclipse.jpt.core.MappingKeys;
-import org.eclipse.jpt.core.context.Generator;
-import org.eclipse.jpt.core.context.IdMapping;
-import org.eclipse.jpt.core.context.TableGenerator;
-import org.eclipse.jpt.core.context.UniqueConstraint;
-import org.eclipse.jpt.core.context.java.JavaUniqueConstraint;
-import org.eclipse.jpt.core.context.orm.OrmEntity;
-import org.eclipse.jpt.core.context.orm.OrmPersistentType;
-import org.eclipse.jpt.core.resource.java.JPA;
-import org.eclipse.jpt.core.resource.java.JavaResourcePersistentAttribute;
-import org.eclipse.jpt.core.resource.java.JavaResourcePersistentType;
-import org.eclipse.jpt.core.resource.java.TableGeneratorAnnotation;
-import org.eclipse.jpt.core.resource.java.UniqueConstraintAnnotation;
-import org.eclipse.jpt.core.resource.persistence.PersistenceFactory;
-import org.eclipse.jpt.core.resource.persistence.XmlMappingFileRef;
-import org.eclipse.jpt.core.tests.internal.context.ContextModelTestCase;
-import org.eclipse.jpt.utility.internal.iterators.ArrayIterator;
-
-@SuppressWarnings("nls")
-public class JavaTableGeneratorTests extends ContextModelTestCase
-{
- private static final String TABLE_GENERATOR_NAME = "MY_TABLE_GENERATOR";
-
- private ICompilationUnit createTestEntityWithTableGenerator() throws Exception {
- return this.createTestType(new DefaultAnnotationWriter() {
- @Override
- public Iterator<String> imports() {
- return new ArrayIterator<String>(JPA.ENTITY, JPA.TABLE_GENERATOR, JPA.ID);
- }
- @Override
- public void appendTypeAnnotationTo(StringBuilder sb) {
- sb.append("@Entity");
- }
-
- @Override
- public void appendIdFieldAnnotationTo(StringBuilder sb) {
- sb.append("@Id").append(CR);
- sb.append("@TableGenerator(name=\"" + TABLE_GENERATOR_NAME + "\")");
- }
- });
- }
-
- public JavaTableGeneratorTests(String name) {
- super(name);
- }
-
- public void testGetName() throws Exception {
- createTestEntityWithTableGenerator();
- addXmlClassRef(FULLY_QUALIFIED_TYPE_NAME);
-
- IdMapping idMapping = (IdMapping) getJavaPersistentType().getAttributeNamed("id").getMapping();
- assertEquals(TABLE_GENERATOR_NAME, idMapping.getGeneratorContainer().getTableGenerator().getName());
-
- //change resource model tableGenerator name, verify the context model is updated
- JavaResourcePersistentType typeResource = getJpaProject().getJavaResourcePersistentType(FULLY_QUALIFIED_TYPE_NAME);
- JavaResourcePersistentAttribute attributeResource = typeResource.persistableAttributes().next();
- TableGeneratorAnnotation tableGenerator = (TableGeneratorAnnotation) attributeResource.getSupportingAnnotation(JPA.TABLE_GENERATOR);
-
- tableGenerator.setName("foo");
-
- assertEquals("foo", idMapping.getGeneratorContainer().getTableGenerator().getName());
- }
-
- public void testSetName() throws Exception {
- createTestEntityWithTableGenerator();
- addXmlClassRef(FULLY_QUALIFIED_TYPE_NAME);
-
- IdMapping idMapping = (IdMapping) getJavaPersistentType().getAttributeNamed("id").getMapping();
- assertEquals(TABLE_GENERATOR_NAME, idMapping.getGeneratorContainer().getTableGenerator().getName());
-
- idMapping.getGeneratorContainer().getTableGenerator().setName("foo");
-
- assertEquals("foo", idMapping.getGeneratorContainer().getTableGenerator().getName());
-
- JavaResourcePersistentType typeResource = getJpaProject().getJavaResourcePersistentType(FULLY_QUALIFIED_TYPE_NAME);
- JavaResourcePersistentAttribute attributeResource = typeResource.persistableAttributes().next();
- TableGeneratorAnnotation tableGenerator = (TableGeneratorAnnotation) attributeResource.getSupportingAnnotation(JPA.TABLE_GENERATOR);
-
- assertEquals("foo", tableGenerator.getName());
- }
-
- public void testSetSpecifiedNameNull() throws Exception {
- createTestEntityWithTableGenerator();
- addXmlClassRef(FULLY_QUALIFIED_TYPE_NAME);
-
- IdMapping idMapping = (IdMapping) getJavaPersistentType().getAttributeNamed("id").getMapping();
- assertEquals(TABLE_GENERATOR_NAME, idMapping.getGeneratorContainer().getTableGenerator().getName());
-
- idMapping.getGeneratorContainer().getTableGenerator().setName(null);
-
- assertNull(idMapping.getGeneratorContainer().getTableGenerator());
-
- JavaResourcePersistentType typeResource = getJpaProject().getJavaResourcePersistentType(FULLY_QUALIFIED_TYPE_NAME);
- JavaResourcePersistentAttribute attributeResource = typeResource.persistableAttributes().next();
- TableGeneratorAnnotation tableGenerator = (TableGeneratorAnnotation) attributeResource.getSupportingAnnotation(JPA.TABLE_GENERATOR);
-
- assertNull(tableGenerator);
- }
-
- public void testGetCatalog() throws Exception {
- createTestEntityWithTableGenerator();
- addXmlClassRef(FULLY_QUALIFIED_TYPE_NAME);
-
- IdMapping idMapping = (IdMapping) getJavaPersistentType().getAttributeNamed("id").getMapping();
-
- assertNull(idMapping.getGeneratorContainer().getTableGenerator().getCatalog());
- JavaResourcePersistentType typeResource = getJpaProject().getJavaResourcePersistentType(FULLY_QUALIFIED_TYPE_NAME);
- JavaResourcePersistentAttribute attributeResource = typeResource.persistableAttributes().next();
- TableGeneratorAnnotation tableGenerator = (TableGeneratorAnnotation) attributeResource.getSupportingAnnotation(JPA.TABLE_GENERATOR);
-
- tableGenerator.setCatalog("myCatalog");
-
- assertEquals("myCatalog", idMapping.getGeneratorContainer().getTableGenerator().getCatalog());
- assertEquals("myCatalog", idMapping.getGeneratorContainer().getTableGenerator().getSpecifiedCatalog());
- }
-
- public void testGetDefaultCatalog() throws Exception {
- createTestEntityWithTableGenerator();
- addXmlClassRef(FULLY_QUALIFIED_TYPE_NAME);
-
- IdMapping idMapping = (IdMapping) getJavaPersistentType().getAttributeNamed("id").getMapping();
-
- assertNull(idMapping.getGeneratorContainer().getTableGenerator().getDefaultCatalog());
-
- idMapping.getGeneratorContainer().getTableGenerator().setSpecifiedCatalog("myCatalog");
-
- assertNull(idMapping.getGeneratorContainer().getTableGenerator().getDefaultCatalog());
- assertEquals("myCatalog", idMapping.getGeneratorContainer().getTableGenerator().getSpecifiedCatalog());
- }
-
- public void testSetSpecifiedCatalog() throws Exception {
- createTestEntityWithTableGenerator();
- addXmlClassRef(FULLY_QUALIFIED_TYPE_NAME);
-
- IdMapping idMapping = (IdMapping) getJavaPersistentType().getAttributeNamed("id").getMapping();
- idMapping.getGeneratorContainer().getTableGenerator().setSpecifiedCatalog("myCatalog");
-
- JavaResourcePersistentType typeResource = getJpaProject().getJavaResourcePersistentType(FULLY_QUALIFIED_TYPE_NAME);
- JavaResourcePersistentAttribute attributeResource = typeResource.persistableAttributes().next();
- TableGeneratorAnnotation tableGenerator = (TableGeneratorAnnotation) attributeResource.getSupportingAnnotation(JPA.TABLE_GENERATOR);
-
- assertEquals("myCatalog", tableGenerator.getCatalog());
-
- idMapping.getGeneratorContainer().getTableGenerator().setName(null);
- idMapping.getGeneratorContainer().getTableGenerator().setSpecifiedCatalog(null);
- assertNull(attributeResource.getSupportingAnnotation(JPA.TABLE_GENERATOR));
- }
-
- public void testGetSchema() throws Exception {
- createTestEntityWithTableGenerator();
- addXmlClassRef(FULLY_QUALIFIED_TYPE_NAME);
-
- IdMapping idMapping = (IdMapping) getJavaPersistentType().getAttributeNamed("id").getMapping();
-
- assertNull(idMapping.getGeneratorContainer().getTableGenerator().getSchema());
- JavaResourcePersistentType typeResource = getJpaProject().getJavaResourcePersistentType(FULLY_QUALIFIED_TYPE_NAME);
- JavaResourcePersistentAttribute attributeResource = typeResource.persistableAttributes().next();
- TableGeneratorAnnotation tableGenerator = (TableGeneratorAnnotation) attributeResource.getSupportingAnnotation(JPA.TABLE_GENERATOR);
-
- tableGenerator.setSchema("mySchema");
-
- assertEquals("mySchema", idMapping.getGeneratorContainer().getTableGenerator().getSchema());
- assertEquals("mySchema", idMapping.getGeneratorContainer().getTableGenerator().getSpecifiedSchema());
- }
-
- public void testGetDefaultSchema() throws Exception {
- createTestEntityWithTableGenerator();
- addXmlClassRef(FULLY_QUALIFIED_TYPE_NAME);
-
- IdMapping idMapping = (IdMapping) getJavaPersistentType().getAttributeNamed("id").getMapping();
-
- assertNull(idMapping.getGeneratorContainer().getTableGenerator().getDefaultSchema());
-
- idMapping.getGeneratorContainer().getTableGenerator().setSpecifiedSchema("mySchema");
-
- assertNull(idMapping.getGeneratorContainer().getTableGenerator().getDefaultSchema());
- assertEquals("mySchema", idMapping.getGeneratorContainer().getTableGenerator().getSpecifiedSchema());
- }
-
- public void testUpdateDefaultSchemaFromPersistenceUnitDefaults() throws Exception {
- XmlMappingFileRef mappingFileRef = PersistenceFactory.eINSTANCE.createXmlMappingFileRef();
- mappingFileRef.setFileName(JptCorePlugin.DEFAULT_ORM_XML_FILE_PATH);
- getXmlPersistenceUnit().getMappingFiles().add(mappingFileRef);
-
- createTestEntityWithTableGenerator();
-
- OrmPersistentType ormPersistentType = getEntityMappings().addPersistentType(MappingKeys.ENTITY_TYPE_MAPPING_KEY, FULLY_QUALIFIED_TYPE_NAME);
- OrmEntity ormEntity = (OrmEntity) ormPersistentType.getMapping();
- IdMapping idMapping = (IdMapping) ormPersistentType.getJavaPersistentType().getAttributeNamed("id").getMapping();
-
- assertNull(idMapping.getGeneratorContainer().getTableGenerator().getDefaultSchema());
-
- getEntityMappings().getPersistenceUnitMetadata().getPersistenceUnitDefaults().setSpecifiedSchema("FOO");
- assertEquals("FOO", idMapping.getGeneratorContainer().getTableGenerator().getDefaultSchema());
-
- getEntityMappings().setSpecifiedSchema("BAR");
- assertEquals("BAR", idMapping.getGeneratorContainer().getTableGenerator().getDefaultSchema());
-
- ormEntity.getTable().setSpecifiedSchema("XML_SCHEMA");
- assertEquals("BAR", idMapping.getGeneratorContainer().getTableGenerator().getDefaultSchema());
-
- getEntityMappings().removePersistentType(0);
- addXmlClassRef(FULLY_QUALIFIED_TYPE_NAME);
- //default schema taken from persistence-unit-defaults not entity-mappings since the entity is not in an orm.xml file
- assertEquals("FOO", ((IdMapping) getJavaPersistentType().getAttributeNamed("id").getMapping()).getGeneratorContainer().getTableGenerator().getDefaultSchema());
- }
-
- public void testSetSpecifiedSchema() throws Exception {
- createTestEntityWithTableGenerator();
- addXmlClassRef(FULLY_QUALIFIED_TYPE_NAME);
-
- IdMapping idMapping = (IdMapping) getJavaPersistentType().getAttributeNamed("id").getMapping();
- idMapping.getGeneratorContainer().getTableGenerator().setSpecifiedSchema("mySchema");
-
- JavaResourcePersistentType typeResource = getJpaProject().getJavaResourcePersistentType(FULLY_QUALIFIED_TYPE_NAME);
- JavaResourcePersistentAttribute attributeResource = typeResource.persistableAttributes().next();
- TableGeneratorAnnotation tableGenerator = (TableGeneratorAnnotation) attributeResource.getSupportingAnnotation(JPA.TABLE_GENERATOR);
-
- assertEquals("mySchema", tableGenerator.getSchema());
-
- idMapping.getGeneratorContainer().getTableGenerator().setName(null);
- idMapping.getGeneratorContainer().getTableGenerator().setSpecifiedSchema(null);
- assertNull(attributeResource.getSupportingAnnotation(JPA.TABLE_GENERATOR));
- }
-
- public void testGetPkColumnName() throws Exception {
- createTestEntityWithTableGenerator();
- addXmlClassRef(FULLY_QUALIFIED_TYPE_NAME);
-
- IdMapping idMapping = (IdMapping) getJavaPersistentType().getAttributeNamed("id").getMapping();
-
- assertNull(idMapping.getGeneratorContainer().getTableGenerator().getPkColumnName());
- JavaResourcePersistentType typeResource = getJpaProject().getJavaResourcePersistentType(FULLY_QUALIFIED_TYPE_NAME);
- JavaResourcePersistentAttribute attributeResource = typeResource.persistableAttributes().next();
- TableGeneratorAnnotation tableGenerator = (TableGeneratorAnnotation) attributeResource.getSupportingAnnotation(JPA.TABLE_GENERATOR);
-
- tableGenerator.setPkColumnName("myPkColumnName");
-
- assertEquals("myPkColumnName", idMapping.getGeneratorContainer().getTableGenerator().getPkColumnName());
- assertEquals("myPkColumnName", idMapping.getGeneratorContainer().getTableGenerator().getSpecifiedPkColumnName());
- }
-
- public void testGetDefaultPkColumnName() throws Exception {
- createTestEntityWithTableGenerator();
- addXmlClassRef(FULLY_QUALIFIED_TYPE_NAME);
-
- IdMapping idMapping = (IdMapping) getJavaPersistentType().getAttributeNamed("id").getMapping();
-
- assertNull(idMapping.getGeneratorContainer().getTableGenerator().getDefaultPkColumnName());
-
- idMapping.getGeneratorContainer().getTableGenerator().setSpecifiedPkColumnName("myPkColumnName");
-
- assertNull(idMapping.getGeneratorContainer().getTableGenerator().getDefaultPkColumnName());
- assertEquals("myPkColumnName", idMapping.getGeneratorContainer().getTableGenerator().getSpecifiedPkColumnName());
- }
-
- public void testSetSpecifiedPkColumnName() throws Exception {
- createTestEntityWithTableGenerator();
- addXmlClassRef(FULLY_QUALIFIED_TYPE_NAME);
-
- IdMapping idMapping = (IdMapping) getJavaPersistentType().getAttributeNamed("id").getMapping();
- idMapping.getGeneratorContainer().getTableGenerator().setSpecifiedPkColumnName("myPkColumnName");
-
- JavaResourcePersistentType typeResource = getJpaProject().getJavaResourcePersistentType(FULLY_QUALIFIED_TYPE_NAME);
- JavaResourcePersistentAttribute attributeResource = typeResource.persistableAttributes().next();
- TableGeneratorAnnotation tableGenerator = (TableGeneratorAnnotation) attributeResource.getSupportingAnnotation(JPA.TABLE_GENERATOR);
-
- assertEquals("myPkColumnName", tableGenerator.getPkColumnName());
-
- idMapping.getGeneratorContainer().getTableGenerator().setName(null);
- idMapping.getGeneratorContainer().getTableGenerator().setSpecifiedPkColumnName(null);
- assertNull(attributeResource.getSupportingAnnotation(JPA.TABLE_GENERATOR));
- }
-
- public void testGetValueColumnName() throws Exception {
- createTestEntityWithTableGenerator();
- addXmlClassRef(FULLY_QUALIFIED_TYPE_NAME);
-
- IdMapping idMapping = (IdMapping) getJavaPersistentType().getAttributeNamed("id").getMapping();
-
- assertNull(idMapping.getGeneratorContainer().getTableGenerator().getValueColumnName());
- JavaResourcePersistentType typeResource = getJpaProject().getJavaResourcePersistentType(FULLY_QUALIFIED_TYPE_NAME);
- JavaResourcePersistentAttribute attributeResource = typeResource.persistableAttributes().next();
- TableGeneratorAnnotation tableGenerator = (TableGeneratorAnnotation) attributeResource.getSupportingAnnotation(JPA.TABLE_GENERATOR);
-
- tableGenerator.setValueColumnName("myValueColumnName");
-
- assertEquals("myValueColumnName", idMapping.getGeneratorContainer().getTableGenerator().getValueColumnName());
- assertEquals("myValueColumnName", idMapping.getGeneratorContainer().getTableGenerator().getSpecifiedValueColumnName());
- }
-
- public void testGetDefaultValueColumnName() throws Exception {
- createTestEntityWithTableGenerator();
- addXmlClassRef(FULLY_QUALIFIED_TYPE_NAME);
-
- IdMapping idMapping = (IdMapping) getJavaPersistentType().getAttributeNamed("id").getMapping();
-
- assertNull(idMapping.getGeneratorContainer().getTableGenerator().getDefaultValueColumnName());
-
- idMapping.getGeneratorContainer().getTableGenerator().setSpecifiedValueColumnName("myValueColumnName");
-
- assertNull(idMapping.getGeneratorContainer().getTableGenerator().getDefaultValueColumnName());
- assertEquals("myValueColumnName", idMapping.getGeneratorContainer().getTableGenerator().getSpecifiedValueColumnName());
- }
-
- public void testSetSpecifiedValueColumnName() throws Exception {
- createTestEntityWithTableGenerator();
- addXmlClassRef(FULLY_QUALIFIED_TYPE_NAME);
-
- IdMapping idMapping = (IdMapping) getJavaPersistentType().getAttributeNamed("id").getMapping();
- idMapping.getGeneratorContainer().getTableGenerator().setSpecifiedValueColumnName("myValueColumnName");
-
- JavaResourcePersistentType typeResource = getJpaProject().getJavaResourcePersistentType(FULLY_QUALIFIED_TYPE_NAME);
- JavaResourcePersistentAttribute attributeResource = typeResource.persistableAttributes().next();
- TableGeneratorAnnotation tableGenerator = (TableGeneratorAnnotation) attributeResource.getSupportingAnnotation(JPA.TABLE_GENERATOR);
-
- assertEquals("myValueColumnName", tableGenerator.getValueColumnName());
-
- idMapping.getGeneratorContainer().getTableGenerator().setName(null);
- idMapping.getGeneratorContainer().getTableGenerator().setSpecifiedValueColumnName(null);
- assertNull(attributeResource.getSupportingAnnotation(JPA.TABLE_GENERATOR));
- }
-
- public void testGetPkColumnValue() throws Exception {
- createTestEntityWithTableGenerator();
- addXmlClassRef(FULLY_QUALIFIED_TYPE_NAME);
-
- IdMapping idMapping = (IdMapping) getJavaPersistentType().getAttributeNamed("id").getMapping();
-
- assertNull(idMapping.getGeneratorContainer().getTableGenerator().getPkColumnValue());
- JavaResourcePersistentType typeResource = getJpaProject().getJavaResourcePersistentType(FULLY_QUALIFIED_TYPE_NAME);
- JavaResourcePersistentAttribute attributeResource = typeResource.persistableAttributes().next();
- TableGeneratorAnnotation tableGenerator = (TableGeneratorAnnotation) attributeResource.getSupportingAnnotation(JPA.TABLE_GENERATOR);
-
- tableGenerator.setPkColumnValue("myPkColumnValue");
-
- assertEquals("myPkColumnValue", idMapping.getGeneratorContainer().getTableGenerator().getPkColumnValue());
- assertEquals("myPkColumnValue", idMapping.getGeneratorContainer().getTableGenerator().getSpecifiedPkColumnValue());
- }
-
- public void testGetDefaultPkColumnValue() throws Exception {
- createTestEntityWithTableGenerator();
- addXmlClassRef(FULLY_QUALIFIED_TYPE_NAME);
-
- IdMapping idMapping = (IdMapping) getJavaPersistentType().getAttributeNamed("id").getMapping();
-
- assertNull(idMapping.getGeneratorContainer().getTableGenerator().getDefaultPkColumnValue());
-
- idMapping.getGeneratorContainer().getTableGenerator().setSpecifiedPkColumnValue("myPkColumnValue");
-
- assertNull(idMapping.getGeneratorContainer().getTableGenerator().getDefaultPkColumnValue());
- assertEquals("myPkColumnValue", idMapping.getGeneratorContainer().getTableGenerator().getSpecifiedPkColumnValue());
- }
-
- public void testSetSpecifiedPkColumnValue() throws Exception {
- createTestEntityWithTableGenerator();
- addXmlClassRef(FULLY_QUALIFIED_TYPE_NAME);
-
- IdMapping idMapping = (IdMapping) getJavaPersistentType().getAttributeNamed("id").getMapping();
- idMapping.getGeneratorContainer().getTableGenerator().setSpecifiedPkColumnValue("myPkColumnValue");
-
- JavaResourcePersistentType typeResource = getJpaProject().getJavaResourcePersistentType(FULLY_QUALIFIED_TYPE_NAME);
- JavaResourcePersistentAttribute attributeResource = typeResource.persistableAttributes().next();
- TableGeneratorAnnotation tableGenerator = (TableGeneratorAnnotation) attributeResource.getSupportingAnnotation(JPA.TABLE_GENERATOR);
-
- assertEquals("myPkColumnValue", tableGenerator.getPkColumnValue());
-
- idMapping.getGeneratorContainer().getTableGenerator().setName(null);
- idMapping.getGeneratorContainer().getTableGenerator().setSpecifiedPkColumnValue(null);
- assertNull(attributeResource.getSupportingAnnotation(JPA.TABLE_GENERATOR));
- }
-
- public void testGetInitialValue() throws Exception {
- createTestEntityWithTableGenerator();
- addXmlClassRef(FULLY_QUALIFIED_TYPE_NAME);
-
- IdMapping idMapping = (IdMapping) getJavaPersistentType().getAttributeNamed("id").getMapping();
-
- assertEquals(TableGenerator.DEFAULT_INITIAL_VALUE, idMapping.getGeneratorContainer().getTableGenerator().getInitialValue());
- JavaResourcePersistentType typeResource = getJpaProject().getJavaResourcePersistentType(FULLY_QUALIFIED_TYPE_NAME);
- JavaResourcePersistentAttribute attributeResource = typeResource.persistableAttributes().next();
- TableGeneratorAnnotation tableGenerator = (TableGeneratorAnnotation) attributeResource.getSupportingAnnotation(JPA.TABLE_GENERATOR);
-
- tableGenerator.setInitialValue(Integer.valueOf(82));
-
- assertEquals(82, idMapping.getGeneratorContainer().getTableGenerator().getInitialValue());
- assertEquals(Integer.valueOf(82), idMapping.getGeneratorContainer().getTableGenerator().getSpecifiedInitialValue());
- }
-
- public void testGetDefaultInitialValue() throws Exception {
- createTestEntityWithTableGenerator();
- addXmlClassRef(FULLY_QUALIFIED_TYPE_NAME);
-
- IdMapping idMapping = (IdMapping) getJavaPersistentType().getAttributeNamed("id").getMapping();
-
- assertEquals(TableGenerator.DEFAULT_INITIAL_VALUE, idMapping.getGeneratorContainer().getTableGenerator().getDefaultInitialValue());
-
- idMapping.getGeneratorContainer().getTableGenerator().setSpecifiedInitialValue(Integer.valueOf(82));
-
- assertEquals(TableGenerator.DEFAULT_INITIAL_VALUE, idMapping.getGeneratorContainer().getTableGenerator().getDefaultInitialValue());
- assertEquals(Integer.valueOf(82), idMapping.getGeneratorContainer().getTableGenerator().getSpecifiedInitialValue());
- }
-
- public void testSetSpecifiedInitialValue() throws Exception {
- createTestEntityWithTableGenerator();
- addXmlClassRef(FULLY_QUALIFIED_TYPE_NAME);
-
- IdMapping idMapping = (IdMapping) getJavaPersistentType().getAttributeNamed("id").getMapping();
- idMapping.getGeneratorContainer().getTableGenerator().setSpecifiedInitialValue(Integer.valueOf(20));
-
- JavaResourcePersistentType typeResource = getJpaProject().getJavaResourcePersistentType(FULLY_QUALIFIED_TYPE_NAME);
- JavaResourcePersistentAttribute attributeResource = typeResource.persistableAttributes().next();
- TableGeneratorAnnotation tableGenerator = (TableGeneratorAnnotation) attributeResource.getSupportingAnnotation(JPA.TABLE_GENERATOR);
-
- assertEquals(Integer.valueOf(20), tableGenerator.getInitialValue());
-
- idMapping.getGeneratorContainer().getTableGenerator().setName(null);
- idMapping.getGeneratorContainer().getTableGenerator().setSpecifiedInitialValue(null);
- assertNull(attributeResource.getSupportingAnnotation(JPA.TABLE_GENERATOR));
- }
-
- public void testGetAllocationSize() throws Exception {
- createTestEntityWithTableGenerator();
- addXmlClassRef(FULLY_QUALIFIED_TYPE_NAME);
-
- IdMapping idMapping = (IdMapping) getJavaPersistentType().getAttributeNamed("id").getMapping();
-
- assertEquals(Generator.DEFAULT_ALLOCATION_SIZE, idMapping.getGeneratorContainer().getTableGenerator().getAllocationSize());
-
- JavaResourcePersistentType typeResource = getJpaProject().getJavaResourcePersistentType(FULLY_QUALIFIED_TYPE_NAME);
- JavaResourcePersistentAttribute attributeResource = typeResource.persistableAttributes().next();
- TableGeneratorAnnotation tableGenerator = (TableGeneratorAnnotation) attributeResource.getSupportingAnnotation(JPA.TABLE_GENERATOR);
-
- tableGenerator.setAllocationSize(Integer.valueOf(20));
-
- assertEquals(20, idMapping.getGeneratorContainer().getTableGenerator().getAllocationSize());
- assertEquals(Integer.valueOf(20), idMapping.getGeneratorContainer().getTableGenerator().getSpecifiedAllocationSize());
- }
-
- public void testGetDefaultAllocationSize() throws Exception {
- createTestEntityWithTableGenerator();
- addXmlClassRef(FULLY_QUALIFIED_TYPE_NAME);
-
- IdMapping idMapping = (IdMapping) getJavaPersistentType().getAttributeNamed("id").getMapping();
-
- assertEquals(Generator.DEFAULT_ALLOCATION_SIZE, idMapping.getGeneratorContainer().getTableGenerator().getDefaultAllocationSize());
-
- idMapping.getGeneratorContainer().getTableGenerator().setSpecifiedAllocationSize(Integer.valueOf(20));
-
- assertEquals(Generator.DEFAULT_ALLOCATION_SIZE, idMapping.getGeneratorContainer().getTableGenerator().getDefaultAllocationSize());
- assertEquals(Integer.valueOf(20), idMapping.getGeneratorContainer().getTableGenerator().getSpecifiedAllocationSize());
- }
-
- public void testSetSpecifiedAllocationSize() throws Exception {
- createTestEntityWithTableGenerator();
- addXmlClassRef(FULLY_QUALIFIED_TYPE_NAME);
-
- IdMapping idMapping = (IdMapping) getJavaPersistentType().getAttributeNamed("id").getMapping();
- idMapping.getGeneratorContainer().getTableGenerator().setSpecifiedAllocationSize(Integer.valueOf(25));
-
- JavaResourcePersistentType typeResource = getJpaProject().getJavaResourcePersistentType(FULLY_QUALIFIED_TYPE_NAME);
- JavaResourcePersistentAttribute attributeResource = typeResource.persistableAttributes().next();
- TableGeneratorAnnotation tableGenerator = (TableGeneratorAnnotation) attributeResource.getSupportingAnnotation(JPA.TABLE_GENERATOR);
-
- assertEquals(Integer.valueOf(25), tableGenerator.getAllocationSize());
-
- idMapping.getGeneratorContainer().getTableGenerator().setName(null);
- idMapping.getGeneratorContainer().getTableGenerator().setSpecifiedAllocationSize(null);
- assertNull(attributeResource.getSupportingAnnotation(JPA.TABLE_GENERATOR));
- }
-
-
- public void testUniqueConstraints() throws Exception {
- createTestEntityWithTableGenerator();
- addXmlClassRef(FULLY_QUALIFIED_TYPE_NAME);
-
- TableGenerator tableGenerator = ((IdMapping) getJavaPersistentType().getAttributeNamed("id").getMapping()).getGeneratorContainer().getTableGenerator();
-
- ListIterator<JavaUniqueConstraint> uniqueConstraints = tableGenerator.uniqueConstraints();
- assertFalse(uniqueConstraints.hasNext());
-
- JavaResourcePersistentType typeResource = getJpaProject().getJavaResourcePersistentType(FULLY_QUALIFIED_TYPE_NAME);
- JavaResourcePersistentAttribute attributeResource = typeResource.persistableAttributes().next();
- TableGeneratorAnnotation tableGeneratorAnnotation = (TableGeneratorAnnotation) attributeResource.getSupportingAnnotation(JPA.TABLE_GENERATOR);
- tableGeneratorAnnotation.addUniqueConstraint(0).addColumnName(0, "foo");
- tableGeneratorAnnotation.addUniqueConstraint(0).addColumnName(0, "bar");
-
- uniqueConstraints = tableGenerator.uniqueConstraints();
- assertTrue(uniqueConstraints.hasNext());
- assertEquals("bar", uniqueConstraints.next().columnNames().next());
- assertEquals("foo", uniqueConstraints.next().columnNames().next());
- assertFalse(uniqueConstraints.hasNext());
- }
-
- public void testUniqueConstraintsSize() throws Exception {
- createTestEntityWithTableGenerator();
- addXmlClassRef(FULLY_QUALIFIED_TYPE_NAME);
-
- TableGenerator tableGenerator = ((IdMapping) getJavaPersistentType().getAttributeNamed("id").getMapping()).getGeneratorContainer().getTableGenerator();
-
- assertEquals(0, tableGenerator.uniqueConstraintsSize());
-
- JavaResourcePersistentType typeResource = getJpaProject().getJavaResourcePersistentType(FULLY_QUALIFIED_TYPE_NAME);
- JavaResourcePersistentAttribute attributeResource = typeResource.persistableAttributes().next();
- TableGeneratorAnnotation tableGeneratorAnnotation = (TableGeneratorAnnotation) attributeResource.getSupportingAnnotation(JPA.TABLE_GENERATOR);
- tableGeneratorAnnotation.addUniqueConstraint(0).addColumnName(0, "foo");
- tableGeneratorAnnotation.addUniqueConstraint(1).addColumnName(0, "bar");
-
- assertEquals(2, tableGenerator.uniqueConstraintsSize());
- }
-
- public void testAddUniqueConstraint() throws Exception {
- createTestEntityWithTableGenerator();
- addXmlClassRef(FULLY_QUALIFIED_TYPE_NAME);
-
- TableGenerator tableGenerator = ((IdMapping) getJavaPersistentType().getAttributeNamed("id").getMapping()).getGeneratorContainer().getTableGenerator();
- tableGenerator.addUniqueConstraint(0).addColumnName(0, "FOO");
- tableGenerator.addUniqueConstraint(0).addColumnName(0, "BAR");
- tableGenerator.addUniqueConstraint(0).addColumnName(0, "BAZ");
-
- JavaResourcePersistentType typeResource = getJpaProject().getJavaResourcePersistentType(FULLY_QUALIFIED_TYPE_NAME);
- JavaResourcePersistentAttribute attributeResource = typeResource.persistableAttributes().next();
- TableGeneratorAnnotation tableGeneratorAnnotation = (TableGeneratorAnnotation) attributeResource.getSupportingAnnotation(JPA.TABLE_GENERATOR);
- ListIterator<UniqueConstraintAnnotation> uniqueConstraints = tableGeneratorAnnotation.uniqueConstraints();
-
- assertEquals("BAZ", uniqueConstraints.next().columnNames().next());
- assertEquals("BAR", uniqueConstraints.next().columnNames().next());
- assertEquals("FOO", uniqueConstraints.next().columnNames().next());
- assertFalse(uniqueConstraints.hasNext());
- }
-
- public void testAddUniqueConstraint2() throws Exception {
- createTestEntityWithTableGenerator();
- addXmlClassRef(FULLY_QUALIFIED_TYPE_NAME);
-
- TableGenerator tableGenerator = ((IdMapping) getJavaPersistentType().getAttributeNamed("id").getMapping()).getGeneratorContainer().getTableGenerator();
- tableGenerator.addUniqueConstraint(0).addColumnName(0, "FOO");
- tableGenerator.addUniqueConstraint(1).addColumnName(0, "BAR");
- tableGenerator.addUniqueConstraint(0).addColumnName(0, "BAZ");
-
- JavaResourcePersistentType typeResource = getJpaProject().getJavaResourcePersistentType(FULLY_QUALIFIED_TYPE_NAME);
- JavaResourcePersistentAttribute attributeResource = typeResource.persistableAttributes().next();
- TableGeneratorAnnotation tableGeneratorAnnotation = (TableGeneratorAnnotation) attributeResource.getSupportingAnnotation(JPA.TABLE_GENERATOR);
- ListIterator<UniqueConstraintAnnotation> uniqueConstraints = tableGeneratorAnnotation.uniqueConstraints();
-
- assertEquals("BAZ", uniqueConstraints.next().columnNames().next());
- assertEquals("FOO", uniqueConstraints.next().columnNames().next());
- assertEquals("BAR", uniqueConstraints.next().columnNames().next());
- assertFalse(uniqueConstraints.hasNext());
- }
-
- public void testRemoveUniqueConstraint() throws Exception {
- createTestEntityWithTableGenerator();
- addXmlClassRef(FULLY_QUALIFIED_TYPE_NAME);
-
- TableGenerator tableGenerator = ((IdMapping) getJavaPersistentType().getAttributeNamed("id").getMapping()).getGeneratorContainer().getTableGenerator();
- tableGenerator.addUniqueConstraint(0).addColumnName(0, "FOO");
- tableGenerator.addUniqueConstraint(1).addColumnName(0, "BAR");
- tableGenerator.addUniqueConstraint(2).addColumnName(0, "BAZ");
-
- JavaResourcePersistentType typeResource = getJpaProject().getJavaResourcePersistentType(FULLY_QUALIFIED_TYPE_NAME);
- JavaResourcePersistentAttribute attributeResource = typeResource.persistableAttributes().next();
- TableGeneratorAnnotation tableGeneratorAnnotation = (TableGeneratorAnnotation) attributeResource.getSupportingAnnotation(JPA.TABLE_GENERATOR);
-
- assertEquals(3, tableGeneratorAnnotation.uniqueConstraintsSize());
-
- tableGenerator.removeUniqueConstraint(1);
-
- ListIterator<UniqueConstraintAnnotation> uniqueConstraintAnnotations = tableGeneratorAnnotation.uniqueConstraints();
- assertEquals("FOO", uniqueConstraintAnnotations.next().columnNames().next());
- assertEquals("BAZ", uniqueConstraintAnnotations.next().columnNames().next());
- assertFalse(uniqueConstraintAnnotations.hasNext());
-
- Iterator<UniqueConstraint> uniqueConstraints = tableGenerator.uniqueConstraints();
- assertEquals("FOO", uniqueConstraints.next().columnNames().next());
- assertEquals("BAZ", uniqueConstraints.next().columnNames().next());
- assertFalse(uniqueConstraints.hasNext());
-
-
- tableGenerator.removeUniqueConstraint(1);
- uniqueConstraintAnnotations = tableGeneratorAnnotation.uniqueConstraints();
- assertEquals("FOO", uniqueConstraintAnnotations.next().columnNames().next());
- assertFalse(uniqueConstraintAnnotations.hasNext());
-
- uniqueConstraints = tableGenerator.uniqueConstraints();
- assertEquals("FOO", uniqueConstraints.next().columnNames().next());
- assertFalse(uniqueConstraints.hasNext());
-
-
- tableGenerator.removeUniqueConstraint(0);
- uniqueConstraintAnnotations = tableGeneratorAnnotation.uniqueConstraints();
- assertFalse(uniqueConstraintAnnotations.hasNext());
- uniqueConstraints = tableGenerator.uniqueConstraints();
- assertFalse(uniqueConstraints.hasNext());
- }
-
- public void testMoveUniqueConstraint() throws Exception {
- createTestEntityWithTableGenerator();
- addXmlClassRef(FULLY_QUALIFIED_TYPE_NAME);
-
- TableGenerator tableGenerator = ((IdMapping) getJavaPersistentType().getAttributeNamed("id").getMapping()).getGeneratorContainer().getTableGenerator();
- tableGenerator.addUniqueConstraint(0).addColumnName(0, "FOO");
- tableGenerator.addUniqueConstraint(1).addColumnName(0, "BAR");
- tableGenerator.addUniqueConstraint(2).addColumnName(0, "BAZ");
-
- JavaResourcePersistentType typeResource = getJpaProject().getJavaResourcePersistentType(FULLY_QUALIFIED_TYPE_NAME);
- JavaResourcePersistentAttribute attributeResource = typeResource.persistableAttributes().next();
- TableGeneratorAnnotation tableGeneratorAnnotation = (TableGeneratorAnnotation) attributeResource.getSupportingAnnotation(JPA.TABLE_GENERATOR);
-
- assertEquals(3, tableGeneratorAnnotation.uniqueConstraintsSize());
-
-
- tableGenerator.moveUniqueConstraint(2, 0);
- ListIterator<UniqueConstraint> uniqueConstraints = tableGenerator.uniqueConstraints();
- assertEquals("BAR", uniqueConstraints.next().columnNames().next());
- assertEquals("BAZ", uniqueConstraints.next().columnNames().next());
- assertEquals("FOO", uniqueConstraints.next().columnNames().next());
-
- ListIterator<UniqueConstraintAnnotation> uniqueConstraintAnnotations = tableGeneratorAnnotation.uniqueConstraints();
- assertEquals("BAR", uniqueConstraintAnnotations.next().columnNames().next());
- assertEquals("BAZ", uniqueConstraintAnnotations.next().columnNames().next());
- assertEquals("FOO", uniqueConstraintAnnotations.next().columnNames().next());
-
-
- tableGenerator.moveUniqueConstraint(0, 1);
- uniqueConstraints = tableGenerator.uniqueConstraints();
- assertEquals("BAZ", uniqueConstraints.next().columnNames().next());
- assertEquals("BAR", uniqueConstraints.next().columnNames().next());
- assertEquals("FOO", uniqueConstraints.next().columnNames().next());
-
- uniqueConstraintAnnotations = tableGeneratorAnnotation.uniqueConstraints();
- assertEquals("BAZ", uniqueConstraintAnnotations.next().columnNames().next());
- assertEquals("BAR", uniqueConstraintAnnotations.next().columnNames().next());
- assertEquals("FOO", uniqueConstraintAnnotations.next().columnNames().next());
- }
-
- public void testUpdateUniqueConstraints() throws Exception {
- createTestEntityWithTableGenerator();
- addXmlClassRef(FULLY_QUALIFIED_TYPE_NAME);
-
- TableGenerator tableGenerator = ((IdMapping) getJavaPersistentType().getAttributeNamed("id").getMapping()).getGeneratorContainer().getTableGenerator();
- JavaResourcePersistentType typeResource = getJpaProject().getJavaResourcePersistentType(FULLY_QUALIFIED_TYPE_NAME);
- JavaResourcePersistentAttribute attributeResource = typeResource.persistableAttributes().next();
- TableGeneratorAnnotation tableGeneratorAnnotation = (TableGeneratorAnnotation) attributeResource.getSupportingAnnotation(JPA.TABLE_GENERATOR);
-
- tableGeneratorAnnotation.addUniqueConstraint(0).addColumnName("FOO");
- tableGeneratorAnnotation.addUniqueConstraint(1).addColumnName("BAR");
- tableGeneratorAnnotation.addUniqueConstraint(2).addColumnName("BAZ");
-
-
- ListIterator<UniqueConstraint> uniqueConstraints = tableGenerator.uniqueConstraints();
- assertEquals("FOO", uniqueConstraints.next().columnNames().next());
- assertEquals("BAR", uniqueConstraints.next().columnNames().next());
- assertEquals("BAZ", uniqueConstraints.next().columnNames().next());
- assertFalse(uniqueConstraints.hasNext());
-
- tableGeneratorAnnotation.moveUniqueConstraint(2, 0);
- uniqueConstraints = tableGenerator.uniqueConstraints();
- assertEquals("BAR", uniqueConstraints.next().columnNames().next());
- assertEquals("BAZ", uniqueConstraints.next().columnNames().next());
- assertEquals("FOO", uniqueConstraints.next().columnNames().next());
- assertFalse(uniqueConstraints.hasNext());
-
- tableGeneratorAnnotation.moveUniqueConstraint(0, 1);
- uniqueConstraints = tableGenerator.uniqueConstraints();
- assertEquals("BAZ", uniqueConstraints.next().columnNames().next());
- assertEquals("BAR", uniqueConstraints.next().columnNames().next());
- assertEquals("FOO", uniqueConstraints.next().columnNames().next());
- assertFalse(uniqueConstraints.hasNext());
-
- tableGeneratorAnnotation.removeUniqueConstraint(1);
- uniqueConstraints = tableGenerator.uniqueConstraints();
- assertEquals("BAZ", uniqueConstraints.next().columnNames().next());
- assertEquals("FOO", uniqueConstraints.next().columnNames().next());
- assertFalse(uniqueConstraints.hasNext());
-
- tableGeneratorAnnotation.removeUniqueConstraint(1);
- uniqueConstraints = tableGenerator.uniqueConstraints();
- assertEquals("BAZ", uniqueConstraints.next().columnNames().next());
- assertFalse(uniqueConstraints.hasNext());
-
- tableGeneratorAnnotation.removeUniqueConstraint(0);
- uniqueConstraints = tableGenerator.uniqueConstraints();
- assertFalse(uniqueConstraints.hasNext());
- }
-}
diff --git a/jpa/tests/org.eclipse.jpt.core.tests/src/org/eclipse/jpt/core/tests/internal/context/java/JavaTableTests.java b/jpa/tests/org.eclipse.jpt.core.tests/src/org/eclipse/jpt/core/tests/internal/context/java/JavaTableTests.java
deleted file mode 100644
index f972a4f2be..0000000000
--- a/jpa/tests/org.eclipse.jpt.core.tests/src/org/eclipse/jpt/core/tests/internal/context/java/JavaTableTests.java
+++ /dev/null
@@ -1,599 +0,0 @@
-/*******************************************************************************
- * Copyright (c) 2007, 2009 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.
- *
- * Contributors:
- * Oracle - initial API and implementation
- ******************************************************************************/
-package org.eclipse.jpt.core.tests.internal.context.java;
-
-import java.util.Iterator;
-import java.util.ListIterator;
-import org.eclipse.core.resources.IFile;
-import org.eclipse.jdt.core.ICompilationUnit;
-import org.eclipse.jpt.core.JptCorePlugin;
-import org.eclipse.jpt.core.MappingKeys;
-import org.eclipse.jpt.core.context.Entity;
-import org.eclipse.jpt.core.context.InheritanceType;
-import org.eclipse.jpt.core.context.Table;
-import org.eclipse.jpt.core.context.UniqueConstraint;
-import org.eclipse.jpt.core.context.java.JavaEntity;
-import org.eclipse.jpt.core.context.java.JavaUniqueConstraint;
-import org.eclipse.jpt.core.context.orm.OrmEntity;
-import org.eclipse.jpt.core.context.orm.OrmPersistentType;
-import org.eclipse.jpt.core.context.persistence.ClassRef;
-import org.eclipse.jpt.core.resource.java.JPA;
-import org.eclipse.jpt.core.resource.java.JavaResourcePersistentType;
-import org.eclipse.jpt.core.resource.java.TableAnnotation;
-import org.eclipse.jpt.core.resource.java.UniqueConstraintAnnotation;
-import org.eclipse.jpt.core.resource.persistence.PersistenceFactory;
-import org.eclipse.jpt.core.resource.persistence.XmlMappingFileRef;
-import org.eclipse.jpt.core.tests.internal.context.ContextModelTestCase;
-import org.eclipse.jpt.utility.internal.iterators.ArrayIterator;
-
-@SuppressWarnings("nls")
-public class JavaTableTests extends ContextModelTestCase
-{
- private static final String TABLE_NAME = "MY_TABLE";
-
- private ICompilationUnit createTestEntity() 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");
- }
- });
- }
-
- private ICompilationUnit createTestEntityWithTable() throws Exception {
- return this.createTestType(new DefaultAnnotationWriter() {
- @Override
- public Iterator<String> imports() {
- return new ArrayIterator<String>(JPA.ENTITY, JPA.TABLE);
- }
- @Override
- public void appendTypeAnnotationTo(StringBuilder sb) {
- sb.append("@Entity").append(CR);
- sb.append("@Table(name=\"" + TABLE_NAME + "\")");
- }
- });
- }
-
- private ICompilationUnit createTestSubType() throws Exception {
- return this.createTestType(PACKAGE_NAME, "AnnotationTestTypeChild.java", "AnnotationTestTypeChild", new DefaultAnnotationWriter() {
- @Override
- public Iterator<String> imports() {
- return new ArrayIterator<String>(JPA.ENTITY);
- }
- @Override
- public void appendExtendsImplementsTo(StringBuilder sb) {
- sb.append("extends " + TYPE_NAME + " ");
- }
- @Override
- public void appendTypeAnnotationTo(StringBuilder sb) {
- sb.append("@Entity");
- }
-
- });
- }
-
- private ICompilationUnit createAbstractTestEntity() throws Exception {
- return this.createTestType(new DefaultAnnotationWriter() {
- @Override
- public Iterator<String> imports() {
- return new ArrayIterator<String>(JPA.ENTITY, JPA.INHERITANCE, JPA.INHERITANCE_TYPE);
- }
- @Override
- public void appendTypeAnnotationTo(StringBuilder sb) {
- sb.append("@Entity").append(CR);
- sb.append("@Inheritance(strategy=InheritanceType.TABLE_PER_CLASS)").append(CR);
- sb.append("abstract");
- }
- });
- }
-
-
- public JavaTableTests(String name) {
- super(name);
- }
-
- public void testGetSpecifiedNameNull() throws Exception {
- createTestEntity();
- addXmlClassRef(FULLY_QUALIFIED_TYPE_NAME);
-
- assertNull(getJavaEntity().getTable().getSpecifiedName());
- }
-
- public void testGetSpecifiedName() throws Exception {
- createTestEntityWithTable();
- addXmlClassRef(FULLY_QUALIFIED_TYPE_NAME);
-
- assertEquals(TABLE_NAME, getJavaEntity().getTable().getSpecifiedName());
- }
-
- public void testGetDefaultNameSpecifiedNameNull() throws Exception {
- createTestEntity();
- addXmlClassRef(FULLY_QUALIFIED_TYPE_NAME);
-
- assertEquals(TYPE_NAME, getJavaEntity().getTable().getDefaultName());
- }
-
- public void testGetDefaultName() throws Exception {
- createTestEntityWithTable();
- addXmlClassRef(FULLY_QUALIFIED_TYPE_NAME);
-
- assertEquals(TYPE_NAME, getJavaEntity().getTable().getDefaultName());
-
- //test that setting the java entity name will change the table default name
- getJavaEntity().setSpecifiedName("foo");
- assertEquals("foo", getJavaEntity().getTable().getDefaultName());
- }
-
- public void testGetDefaultNameSingleTableInheritance() throws Exception {
- createTestEntity();
- createTestSubType();
-
- addXmlClassRef(PACKAGE_NAME + ".AnnotationTestTypeChild");
- addXmlClassRef(FULLY_QUALIFIED_TYPE_NAME);
-
- ListIterator<ClassRef> specifiedClassRefs = getPersistenceUnit().specifiedClassRefs();
- Entity childEntity = (Entity) specifiedClassRefs.next().getJavaPersistentType().getMapping();
- Entity rootEntity = (Entity) specifiedClassRefs.next().getJavaPersistentType().getMapping();
-
- assertNotSame(getJavaEntity(), rootEntity);
- assertEquals(TYPE_NAME, childEntity.getTable().getDefaultName());
- assertEquals(TYPE_NAME, rootEntity.getTable().getDefaultName());
-
- //test that setting the root java entity name will change the table default name of the child
- rootEntity.setSpecifiedName("foo");
- assertEquals("foo", childEntity.getTable().getDefaultName());
- }
-
- public void testUpdateDefaultSchemaFromPersistenceUnitDefaults() throws Exception {
- XmlMappingFileRef mappingFileRef = PersistenceFactory.eINSTANCE.createXmlMappingFileRef();
- mappingFileRef.setFileName(JptCorePlugin.DEFAULT_ORM_XML_FILE_PATH);
- getXmlPersistenceUnit().getMappingFiles().add(mappingFileRef);
-
- createTestEntity();
-
- OrmPersistentType ormPersistentType = getEntityMappings().addPersistentType(MappingKeys.ENTITY_TYPE_MAPPING_KEY, FULLY_QUALIFIED_TYPE_NAME);
- OrmEntity ormEntity = (OrmEntity) ormPersistentType.getMapping();
- JavaEntity javaEntity = ormEntity.getJavaEntity();
-
- assertNull(javaEntity.getTable().getDefaultSchema());
-
- getEntityMappings().getPersistenceUnitMetadata().getPersistenceUnitDefaults().setSpecifiedSchema("FOO");
- assertEquals("FOO", javaEntity.getTable().getDefaultSchema());
-
- getEntityMappings().setSpecifiedSchema("BAR");
- assertEquals("BAR", javaEntity.getTable().getDefaultSchema());
-
- ormEntity.getTable().setSpecifiedSchema("XML_SCHEMA");
- assertEquals("BAR", javaEntity.getTable().getDefaultSchema());
-
- getEntityMappings().removePersistentType(0);
- addXmlClassRef(FULLY_QUALIFIED_TYPE_NAME);
- //default schema taken from persistence-unit-defaults not entity-mappings since the entity is not in an orm.xml file
- assertEquals("FOO", getJavaEntity().getTable().getDefaultSchema());
-
- IFile file = getOrmXmlResource().getFile();
- //remove the mapping file reference from the persistence.xml. default schema
- //should still come from persistence-unit-defaults because of implied mapped-file-ref
- getXmlPersistenceUnit().getMappingFiles().remove(mappingFileRef);
- assertEquals("FOO", getJavaEntity().getTable().getDefaultSchema());
-
- file.delete(true, null);
- assertNull(getJavaEntity().getTable().getDefaultSchema());
- }
-
- public void testGetNameSpecifiedNameNull() throws Exception {
- createTestEntity();
- addXmlClassRef(FULLY_QUALIFIED_TYPE_NAME);
-
- assertEquals(TYPE_NAME, getJavaEntity().getTable().getName());
- }
-
- public void testGetName() throws Exception {
- createTestEntityWithTable();
- addXmlClassRef(FULLY_QUALIFIED_TYPE_NAME);
-
- assertEquals(TABLE_NAME, getJavaEntity().getTable().getName());
- }
-
- public void testSetSpecifiedName() throws Exception {
- createTestEntity();
- addXmlClassRef(FULLY_QUALIFIED_TYPE_NAME);
-
- getJavaEntity().getTable().setSpecifiedName("foo");
-
- assertEquals("foo", getJavaEntity().getTable().getSpecifiedName());
-
- JavaResourcePersistentType typeResource = getJpaProject().getJavaResourcePersistentType(FULLY_QUALIFIED_TYPE_NAME);
- TableAnnotation table = (TableAnnotation) typeResource.getSupportingAnnotation(JPA.TABLE);
-
- assertEquals("foo", table.getName());
- }
-
- public void testSetSpecifiedNameNull() throws Exception {
- createTestEntityWithTable();
- addXmlClassRef(FULLY_QUALIFIED_TYPE_NAME);
-
- getJavaEntity().getTable().setSpecifiedName(null);
-
- assertNull(getJavaEntity().getTable().getSpecifiedName());
-
- JavaResourcePersistentType typeResource = getJpaProject().getJavaResourcePersistentType(FULLY_QUALIFIED_TYPE_NAME);
- TableAnnotation table = (TableAnnotation) typeResource.getSupportingAnnotation(JPA.TABLE);
-
- assertNull(table);
- }
-
- public void testUpdateFromSpecifiedNameChangeInResourceModel() throws Exception {
- createTestEntityWithTable();
- addXmlClassRef(FULLY_QUALIFIED_TYPE_NAME);
-
- JavaResourcePersistentType typeResource = getJpaProject().getJavaResourcePersistentType(FULLY_QUALIFIED_TYPE_NAME);
- TableAnnotation table = (TableAnnotation) typeResource.getSupportingAnnotation(JPA.TABLE);
- table.setName("foo");
-
- assertEquals("foo", getJavaEntity().getTable().getSpecifiedName());
-
- typeResource.removeSupportingAnnotation(JPA.TABLE);
- assertNull(getJavaEntity().getTable().getSpecifiedName());
- }
-
- public void testGetCatalog() throws Exception {
- createTestEntityWithTable();
- addXmlClassRef(FULLY_QUALIFIED_TYPE_NAME);
-
- JavaResourcePersistentType typeResource = getJpaProject().getJavaResourcePersistentType(FULLY_QUALIFIED_TYPE_NAME);
- TableAnnotation table = (TableAnnotation) typeResource.getSupportingAnnotation(JPA.TABLE);
-
- table.setCatalog("myCatalog");
-
- assertEquals("myCatalog", getJavaEntity().getTable().getSpecifiedCatalog());
- assertEquals("myCatalog", getJavaEntity().getTable().getCatalog());
- }
-
- public void testGetDefaultCatalog() throws Exception {
- createTestEntity();
- addXmlClassRef(FULLY_QUALIFIED_TYPE_NAME);
-
- assertNull(getJavaEntity().getTable().getDefaultCatalog());
-
- getJavaEntity().getTable().setSpecifiedCatalog("myCatalog");
-
- assertNull(getJavaEntity().getTable().getDefaultCatalog());
- }
-
- public void testUpdateDefaultCatalogFromPersistenceUnitDefaults() throws Exception {
- XmlMappingFileRef mappingFileRef = PersistenceFactory.eINSTANCE.createXmlMappingFileRef();
- mappingFileRef.setFileName(JptCorePlugin.DEFAULT_ORM_XML_FILE_PATH);
- getXmlPersistenceUnit().getMappingFiles().add(mappingFileRef);
-
- createTestEntity();
-
- OrmPersistentType ormPersistentType = getEntityMappings().addPersistentType(MappingKeys.ENTITY_TYPE_MAPPING_KEY, FULLY_QUALIFIED_TYPE_NAME);
- OrmEntity ormEntity = (OrmEntity) ormPersistentType.getMapping();
- JavaEntity javaEntity = ormEntity.getJavaEntity();
-
- assertNull(javaEntity.getTable().getDefaultCatalog());
-
- getEntityMappings().getPersistenceUnitMetadata().getPersistenceUnitDefaults().setSpecifiedCatalog("FOO");
- assertEquals("FOO", javaEntity.getTable().getDefaultCatalog());
-
- getEntityMappings().setSpecifiedCatalog("BAR");
- assertEquals("BAR", javaEntity.getTable().getDefaultCatalog());
-
- ormEntity.getTable().setSpecifiedCatalog("XML_CATALOG");
- assertEquals("BAR", javaEntity.getTable().getDefaultCatalog());
-
- getEntityMappings().removePersistentType(0);
- addXmlClassRef(FULLY_QUALIFIED_TYPE_NAME);
- //default catalog taken from persistence-unite-defaults not entity-mappings since the entity is not in an orm.xml file
- assertEquals("FOO", getJavaEntity().getTable().getDefaultCatalog());
-
- IFile file = getOrmXmlResource().getFile();
- //remove the mapping file reference from the persistence.xml. default schema
- //should still come from persistence-unit-defaults because of implied mapped-file-ref
- getXmlPersistenceUnit().getMappingFiles().remove(mappingFileRef);
- assertEquals("FOO", getJavaEntity().getTable().getDefaultCatalog());
-
- file.delete(true, null);
- assertNull(getJavaEntity().getTable().getDefaultCatalog());
- }
-
- public void testSetSpecifiedCatalog() throws Exception {
- createTestEntity();
- addXmlClassRef(FULLY_QUALIFIED_TYPE_NAME);
- Table table = getJavaEntity().getTable();
- table.setSpecifiedCatalog("myCatalog");
-
- JavaResourcePersistentType typeResource = getJpaProject().getJavaResourcePersistentType(FULLY_QUALIFIED_TYPE_NAME);
- TableAnnotation tableResource = (TableAnnotation) typeResource.getSupportingAnnotation(JPA.TABLE);
-
- assertEquals("myCatalog", tableResource.getCatalog());
-
- table.setSpecifiedCatalog(null);
- assertNull(typeResource.getSupportingAnnotation(JPA.TABLE));
- }
-
- public void testGetSchema() throws Exception {
- createTestEntityWithTable();
- addXmlClassRef(FULLY_QUALIFIED_TYPE_NAME);
-
- JavaResourcePersistentType typeResource = getJpaProject().getJavaResourcePersistentType(FULLY_QUALIFIED_TYPE_NAME);
- TableAnnotation table = (TableAnnotation) typeResource.getSupportingAnnotation(JPA.TABLE);
-
- table.setSchema("mySchema");
-
- assertEquals("mySchema", getJavaEntity().getTable().getSpecifiedSchema());
- assertEquals("mySchema", getJavaEntity().getTable().getSchema());
- }
-
- public void testGetDefaultSchema() throws Exception {
- createTestEntity();
- addXmlClassRef(FULLY_QUALIFIED_TYPE_NAME);
-
- assertNull(getJavaEntity().getTable().getDefaultSchema());
-
- getJavaEntity().getTable().setSpecifiedSchema("mySchema");
-
- assertNull(getJavaEntity().getTable().getDefaultSchema());
- }
-
- public void testSetSpecifiedSchema() throws Exception {
- createTestEntity();
- addXmlClassRef(FULLY_QUALIFIED_TYPE_NAME);
- Table table = getJavaEntity().getTable();
- table.setSpecifiedSchema("mySchema");
-
- JavaResourcePersistentType typeResource = getJpaProject().getJavaResourcePersistentType(FULLY_QUALIFIED_TYPE_NAME);
- TableAnnotation tableResource = (TableAnnotation) typeResource.getSupportingAnnotation(JPA.TABLE);
-
- assertEquals("mySchema", tableResource.getSchema());
-
- table.setSpecifiedSchema(null);
- assertNull(typeResource.getSupportingAnnotation(JPA.TABLE));
- }
-
- public void testUniqueConstraints() throws Exception {
- createTestEntityWithTable();
- addXmlClassRef(FULLY_QUALIFIED_TYPE_NAME);
-
- ListIterator<JavaUniqueConstraint> uniqueConstraints = getJavaEntity().getTable().uniqueConstraints();
- assertFalse(uniqueConstraints.hasNext());
-
- JavaResourcePersistentType typeResource = getJpaProject().getJavaResourcePersistentType(FULLY_QUALIFIED_TYPE_NAME);
- TableAnnotation tableAnnotation = (TableAnnotation) typeResource.getSupportingAnnotation(JPA.TABLE);
- tableAnnotation.addUniqueConstraint(0).addColumnName(0, "foo");
- tableAnnotation.addUniqueConstraint(0).addColumnName(0, "bar");
-
- uniqueConstraints = getJavaEntity().getTable().uniqueConstraints();
- assertTrue(uniqueConstraints.hasNext());
- assertEquals("bar", uniqueConstraints.next().columnNames().next());
- assertEquals("foo", uniqueConstraints.next().columnNames().next());
- assertFalse(uniqueConstraints.hasNext());
- }
-
- public void testUniqueConstraintsSize() throws Exception {
- createTestEntityWithTable();
- addXmlClassRef(FULLY_QUALIFIED_TYPE_NAME);
-
- assertEquals(0, getJavaEntity().getTable().uniqueConstraintsSize());
-
- JavaResourcePersistentType typeResource = getJpaProject().getJavaResourcePersistentType(FULLY_QUALIFIED_TYPE_NAME);
- TableAnnotation tableAnnotation = (TableAnnotation) typeResource.getSupportingAnnotation(JPA.TABLE);
- tableAnnotation.addUniqueConstraint(0).addColumnName(0, "foo");
- tableAnnotation.addUniqueConstraint(1).addColumnName(0, "bar");
-
- assertEquals(2, getJavaEntity().getTable().uniqueConstraintsSize());
- }
-
- public void testAddUniqueConstraint() throws Exception {
- createTestEntity();
- addXmlClassRef(FULLY_QUALIFIED_TYPE_NAME);
-
- Table table = getJavaEntity().getTable();
- table.addUniqueConstraint(0).addColumnName(0, "FOO");
- table.addUniqueConstraint(0).addColumnName(0, "BAR");
- table.addUniqueConstraint(0).addColumnName(0, "BAZ");
-
- JavaResourcePersistentType typeResource = getJpaProject().getJavaResourcePersistentType(FULLY_QUALIFIED_TYPE_NAME);
- TableAnnotation tableAnnotation = (TableAnnotation) typeResource.getSupportingAnnotation(JPA.TABLE);
- ListIterator<UniqueConstraintAnnotation> uniqueConstraints = tableAnnotation.uniqueConstraints();
-
- assertEquals("BAZ", uniqueConstraints.next().columnNames().next());
- assertEquals("BAR", uniqueConstraints.next().columnNames().next());
- assertEquals("FOO", uniqueConstraints.next().columnNames().next());
- assertFalse(uniqueConstraints.hasNext());
- }
-
- public void testAddUniqueConstraint2() throws Exception {
- createTestEntityWithTable();
- addXmlClassRef(FULLY_QUALIFIED_TYPE_NAME);
-
- Table table = getJavaEntity().getTable();
- table.addUniqueConstraint(0).addColumnName(0, "FOO");
- table.addUniqueConstraint(1).addColumnName(0, "BAR");
- table.addUniqueConstraint(0).addColumnName(0, "BAZ");
-
- JavaResourcePersistentType typeResource = getJpaProject().getJavaResourcePersistentType(FULLY_QUALIFIED_TYPE_NAME);
- TableAnnotation tableAnnotation = (TableAnnotation) typeResource.getSupportingAnnotation(JPA.TABLE);
- ListIterator<UniqueConstraintAnnotation> uniqueConstraints = tableAnnotation.uniqueConstraints();
-
- assertEquals("BAZ", uniqueConstraints.next().columnNames().next());
- assertEquals("FOO", uniqueConstraints.next().columnNames().next());
- assertEquals("BAR", uniqueConstraints.next().columnNames().next());
- assertFalse(uniqueConstraints.hasNext());
- }
-
- public void testRemoveUniqueConstraint() throws Exception {
- createTestEntity();
- addXmlClassRef(FULLY_QUALIFIED_TYPE_NAME);
-
- Table table = getJavaEntity().getTable();
- table.addUniqueConstraint(0).addColumnName(0, "FOO");
- table.addUniqueConstraint(1).addColumnName(0, "BAR");
- table.addUniqueConstraint(2).addColumnName(0, "BAZ");
-
- JavaResourcePersistentType typeResource = getJpaProject().getJavaResourcePersistentType(FULLY_QUALIFIED_TYPE_NAME);
- TableAnnotation tableAnnotation = (TableAnnotation) typeResource.getSupportingAnnotation(JPA.TABLE);
-
- assertEquals(3, tableAnnotation.uniqueConstraintsSize());
-
- table.removeUniqueConstraint(1);
-
- ListIterator<UniqueConstraintAnnotation> uniqueConstraintAnnotations = tableAnnotation.uniqueConstraints();
- assertEquals("FOO", uniqueConstraintAnnotations.next().columnNames().next());
- assertEquals("BAZ", uniqueConstraintAnnotations.next().columnNames().next());
- assertFalse(uniqueConstraintAnnotations.hasNext());
-
- Iterator<UniqueConstraint> uniqueConstraints = table.uniqueConstraints();
- assertEquals("FOO", uniqueConstraints.next().columnNames().next());
- assertEquals("BAZ", uniqueConstraints.next().columnNames().next());
- assertFalse(uniqueConstraints.hasNext());
-
-
- table.removeUniqueConstraint(1);
- uniqueConstraintAnnotations = tableAnnotation.uniqueConstraints();
- assertEquals("FOO", uniqueConstraintAnnotations.next().columnNames().next());
- assertFalse(uniqueConstraintAnnotations.hasNext());
-
- uniqueConstraints = table.uniqueConstraints();
- assertEquals("FOO", uniqueConstraints.next().columnNames().next());
- assertFalse(uniqueConstraints.hasNext());
-
-
- table.removeUniqueConstraint(0);
- uniqueConstraintAnnotations = tableAnnotation.uniqueConstraints();
- assertFalse(uniqueConstraintAnnotations.hasNext());
- uniqueConstraints = table.uniqueConstraints();
- assertFalse(uniqueConstraints.hasNext());
- }
-
- public void testMoveUniqueConstraint() throws Exception {
- createTestEntity();
- addXmlClassRef(FULLY_QUALIFIED_TYPE_NAME);
-
- Table table = getJavaEntity().getTable();
- table.addUniqueConstraint(0).addColumnName(0, "FOO");
- table.addUniqueConstraint(1).addColumnName(0, "BAR");
- table.addUniqueConstraint(2).addColumnName(0, "BAZ");
-
- JavaResourcePersistentType typeResource = getJpaProject().getJavaResourcePersistentType(FULLY_QUALIFIED_TYPE_NAME);
- TableAnnotation tableAnnotation = (TableAnnotation) typeResource.getSupportingAnnotation(JPA.TABLE);
-
- assertEquals(3, tableAnnotation.uniqueConstraintsSize());
-
-
- table.moveUniqueConstraint(2, 0);
- ListIterator<UniqueConstraint> uniqueConstraints = table.uniqueConstraints();
- assertEquals("BAR", uniqueConstraints.next().columnNames().next());
- assertEquals("BAZ", uniqueConstraints.next().columnNames().next());
- assertEquals("FOO", uniqueConstraints.next().columnNames().next());
-
- ListIterator<UniqueConstraintAnnotation> uniqueConstraintAnnotations = tableAnnotation.uniqueConstraints();
- assertEquals("BAR", uniqueConstraintAnnotations.next().columnNames().next());
- assertEquals("BAZ", uniqueConstraintAnnotations.next().columnNames().next());
- assertEquals("FOO", uniqueConstraintAnnotations.next().columnNames().next());
-
-
- table.moveUniqueConstraint(0, 1);
- uniqueConstraints = table.uniqueConstraints();
- assertEquals("BAZ", uniqueConstraints.next().columnNames().next());
- assertEquals("BAR", uniqueConstraints.next().columnNames().next());
- assertEquals("FOO", uniqueConstraints.next().columnNames().next());
-
- uniqueConstraintAnnotations = tableAnnotation.uniqueConstraints();
- assertEquals("BAZ", uniqueConstraintAnnotations.next().columnNames().next());
- assertEquals("BAR", uniqueConstraintAnnotations.next().columnNames().next());
- assertEquals("FOO", uniqueConstraintAnnotations.next().columnNames().next());
- }
-
- public void testUpdateUniqueConstraints() throws Exception {
- createTestEntityWithTable();
- addXmlClassRef(FULLY_QUALIFIED_TYPE_NAME);
-
- Table table = getJavaEntity().getTable();
- JavaResourcePersistentType typeResource = getJpaProject().getJavaResourcePersistentType(FULLY_QUALIFIED_TYPE_NAME);
- TableAnnotation tableAnnotation = (TableAnnotation) typeResource.getSupportingAnnotation(JPA.TABLE);
-
- tableAnnotation.addUniqueConstraint(0).addColumnName("FOO");
- tableAnnotation.addUniqueConstraint(1).addColumnName("BAR");
- tableAnnotation.addUniqueConstraint(2).addColumnName("BAZ");
-
-
- ListIterator<UniqueConstraint> uniqueConstraints = table.uniqueConstraints();
- assertEquals("FOO", uniqueConstraints.next().columnNames().next());
- assertEquals("BAR", uniqueConstraints.next().columnNames().next());
- assertEquals("BAZ", uniqueConstraints.next().columnNames().next());
- assertFalse(uniqueConstraints.hasNext());
-
- tableAnnotation.moveUniqueConstraint(2, 0);
- uniqueConstraints = table.uniqueConstraints();
- assertEquals("BAR", uniqueConstraints.next().columnNames().next());
- assertEquals("BAZ", uniqueConstraints.next().columnNames().next());
- assertEquals("FOO", uniqueConstraints.next().columnNames().next());
- assertFalse(uniqueConstraints.hasNext());
-
- tableAnnotation.moveUniqueConstraint(0, 1);
- uniqueConstraints = table.uniqueConstraints();
- assertEquals("BAZ", uniqueConstraints.next().columnNames().next());
- assertEquals("BAR", uniqueConstraints.next().columnNames().next());
- assertEquals("FOO", uniqueConstraints.next().columnNames().next());
- assertFalse(uniqueConstraints.hasNext());
-
- tableAnnotation.removeUniqueConstraint(1);
- uniqueConstraints = table.uniqueConstraints();
- assertEquals("BAZ", uniqueConstraints.next().columnNames().next());
- assertEquals("FOO", uniqueConstraints.next().columnNames().next());
- assertFalse(uniqueConstraints.hasNext());
-
- tableAnnotation.removeUniqueConstraint(1);
- uniqueConstraints = table.uniqueConstraints();
- assertEquals("BAZ", uniqueConstraints.next().columnNames().next());
- assertFalse(uniqueConstraints.hasNext());
-
- tableAnnotation.removeUniqueConstraint(0);
- uniqueConstraints = table.uniqueConstraints();
- assertFalse(uniqueConstraints.hasNext());
- }
-
- public void testAbstractEntityGetDefaultNameTablePerClassInheritance() throws Exception {
- createAbstractTestEntity();
- createTestSubType();
-
- addXmlClassRef(PACKAGE_NAME + ".AnnotationTestTypeChild");
- addXmlClassRef(FULLY_QUALIFIED_TYPE_NAME);
-
- ListIterator<ClassRef> specifiedClassRefs = getPersistenceUnit().specifiedClassRefs();
- Entity concreteEntity = (Entity) specifiedClassRefs.next().getJavaPersistentType().getMapping();
- assertEquals("AnnotationTestTypeChild", concreteEntity.getName());
-
- Entity abstractEntity = (Entity) specifiedClassRefs.next().getJavaPersistentType().getMapping();
- assertEquals(TYPE_NAME, abstractEntity.getName());
-
-
- assertEquals(InheritanceType.TABLE_PER_CLASS, abstractEntity.getSpecifiedInheritanceStrategy());
- assertEquals(null, concreteEntity.getSpecifiedInheritanceStrategy());
- assertEquals(InheritanceType.TABLE_PER_CLASS, concreteEntity.getDefaultInheritanceStrategy());
-
-
- assertEquals(null, abstractEntity.getTable().getDefaultName());
- assertEquals(null, abstractEntity.getTable().getDefaultCatalog());
- assertEquals(null, abstractEntity.getTable().getDefaultSchema());
-
-
- assertEquals("AnnotationTestTypeChild", concreteEntity.getTable().getDefaultName());
- assertEquals(null, concreteEntity.getTable().getDefaultCatalog());
- assertEquals(null, concreteEntity.getTable().getDefaultSchema());
- }
-
-}
diff --git a/jpa/tests/org.eclipse.jpt.core.tests/src/org/eclipse/jpt/core/tests/internal/context/java/JavaTransientMappingTests.java b/jpa/tests/org.eclipse.jpt.core.tests/src/org/eclipse/jpt/core/tests/internal/context/java/JavaTransientMappingTests.java
deleted file mode 100644
index 6f2ca904a6..0000000000
--- a/jpa/tests/org.eclipse.jpt.core.tests/src/org/eclipse/jpt/core/tests/internal/context/java/JavaTransientMappingTests.java
+++ /dev/null
@@ -1,248 +0,0 @@
-/*******************************************************************************
- * Copyright (c) 2007, 2008 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.
- *
- * Contributors:
- * Oracle - initial API and implementation
- ******************************************************************************/
-package org.eclipse.jpt.core.tests.internal.context.java;
-
-import java.util.Iterator;
-import org.eclipse.jdt.core.ICompilationUnit;
-import org.eclipse.jpt.core.MappingKeys;
-import org.eclipse.jpt.core.context.BasicMapping;
-import org.eclipse.jpt.core.context.EmbeddedIdMapping;
-import org.eclipse.jpt.core.context.EmbeddedMapping;
-import org.eclipse.jpt.core.context.IdMapping;
-import org.eclipse.jpt.core.context.ManyToManyMapping;
-import org.eclipse.jpt.core.context.ManyToOneMapping;
-import org.eclipse.jpt.core.context.OneToManyMapping;
-import org.eclipse.jpt.core.context.OneToOneMapping;
-import org.eclipse.jpt.core.context.PersistentAttribute;
-import org.eclipse.jpt.core.context.TransientMapping;
-import org.eclipse.jpt.core.context.VersionMapping;
-import org.eclipse.jpt.core.resource.java.BasicAnnotation;
-import org.eclipse.jpt.core.resource.java.EmbeddedAnnotation;
-import org.eclipse.jpt.core.resource.java.EmbeddedIdAnnotation;
-import org.eclipse.jpt.core.resource.java.IdAnnotation;
-import org.eclipse.jpt.core.resource.java.JPA;
-import org.eclipse.jpt.core.resource.java.JavaResourcePersistentAttribute;
-import org.eclipse.jpt.core.resource.java.JavaResourcePersistentType;
-import org.eclipse.jpt.core.resource.java.ManyToManyAnnotation;
-import org.eclipse.jpt.core.resource.java.ManyToOneAnnotation;
-import org.eclipse.jpt.core.resource.java.OneToManyAnnotation;
-import org.eclipse.jpt.core.resource.java.OneToOneAnnotation;
-import org.eclipse.jpt.core.resource.java.TransientAnnotation;
-import org.eclipse.jpt.core.resource.java.VersionAnnotation;
-import org.eclipse.jpt.core.tests.internal.context.ContextModelTestCase;
-import org.eclipse.jpt.utility.internal.iterators.ArrayIterator;
-
-public class JavaTransientMappingTests extends ContextModelTestCase
-{
-
- private ICompilationUnit createTestEntityWithTransientMapping() throws Exception {
- return this.createTestType(new DefaultAnnotationWriter() {
- @Override
- public Iterator<String> imports() {
- return new ArrayIterator<String>(JPA.ENTITY, JPA.TRANSIENT);
- }
- @Override
- public void appendTypeAnnotationTo(StringBuilder sb) {
- sb.append("@Entity").append(CR);
- }
-
- @Override
- public void appendIdFieldAnnotationTo(StringBuilder sb) {
- sb.append("@Transient").append(CR);
- }
- });
- }
-
- public JavaTransientMappingTests(String name) {
- super(name);
- }
-
- public void testMorphToBasicMapping() throws Exception {
- createTestEntityWithTransientMapping();
- addXmlClassRef(FULLY_QUALIFIED_TYPE_NAME);
-
- PersistentAttribute persistentAttribute = getJavaPersistentType().attributes().next();
- TransientMapping transientMapping = (TransientMapping) persistentAttribute.getMapping();
- assertFalse(transientMapping.isDefault());
-
- persistentAttribute.setSpecifiedMappingKey(MappingKeys.BASIC_ATTRIBUTE_MAPPING_KEY);
- assertTrue(persistentAttribute.getMapping() instanceof BasicMapping);
- assertFalse(persistentAttribute.getMapping().isDefault());
-
- JavaResourcePersistentType typeResource = getJpaProject().getJavaResourcePersistentType(FULLY_QUALIFIED_TYPE_NAME);
- JavaResourcePersistentAttribute attributeResource = typeResource.persistableAttributes().next();
- assertNull(attributeResource.getMappingAnnotation(TransientAnnotation.ANNOTATION_NAME));
- assertNotNull(attributeResource.getMappingAnnotation(BasicAnnotation.ANNOTATION_NAME));
- }
-
- public void testMorphToDefault() throws Exception {
- createTestEntityWithTransientMapping();
- addXmlClassRef(FULLY_QUALIFIED_TYPE_NAME);
-
- PersistentAttribute persistentAttribute = getJavaPersistentType().attributes().next();
- TransientMapping transientMapping = (TransientMapping) persistentAttribute.getMapping();
- assertFalse(transientMapping.isDefault());
-
- persistentAttribute.setSpecifiedMappingKey(MappingKeys.NULL_ATTRIBUTE_MAPPING_KEY);
- assertTrue(persistentAttribute.getMapping() instanceof BasicMapping);
- assertTrue(persistentAttribute.getMapping().isDefault());
-
- JavaResourcePersistentType typeResource = getJpaProject().getJavaResourcePersistentType(FULLY_QUALIFIED_TYPE_NAME);
- JavaResourcePersistentAttribute attributeResource = typeResource.persistableAttributes().next();
- assertNull(attributeResource.getMappingAnnotation(TransientAnnotation.ANNOTATION_NAME));
- }
-
- public void testMorphToVersionMapping() throws Exception {
- createTestEntityWithTransientMapping();
- addXmlClassRef(FULLY_QUALIFIED_TYPE_NAME);
-
- PersistentAttribute persistentAttribute = getJavaPersistentType().attributes().next();
- TransientMapping transientMapping = (TransientMapping) persistentAttribute.getMapping();
- assertFalse(transientMapping.isDefault());
-
- persistentAttribute.setSpecifiedMappingKey(MappingKeys.VERSION_ATTRIBUTE_MAPPING_KEY);
- assertTrue(persistentAttribute.getMapping() instanceof VersionMapping);
-
- JavaResourcePersistentType typeResource = getJpaProject().getJavaResourcePersistentType(FULLY_QUALIFIED_TYPE_NAME);
- JavaResourcePersistentAttribute attributeResource = typeResource.persistableAttributes().next();
- assertNull(attributeResource.getMappingAnnotation(TransientAnnotation.ANNOTATION_NAME));
- assertNotNull(attributeResource.getMappingAnnotation(VersionAnnotation.ANNOTATION_NAME));
- }
-
- public void testMorphToEmbeddedMapping() throws Exception {
- createTestEntityWithTransientMapping();
- addXmlClassRef(FULLY_QUALIFIED_TYPE_NAME);
-
- PersistentAttribute persistentAttribute = getJavaPersistentType().attributes().next();
- TransientMapping transientMapping = (TransientMapping) persistentAttribute.getMapping();
- assertFalse(transientMapping.isDefault());
-
- persistentAttribute.setSpecifiedMappingKey(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.getMappingAnnotation(TransientAnnotation.ANNOTATION_NAME));
- assertNotNull(attributeResource.getMappingAnnotation(EmbeddedAnnotation.ANNOTATION_NAME));
- }
-
- public void testMorphToIdMapping() throws Exception {
- createTestEntityWithTransientMapping();
- addXmlClassRef(FULLY_QUALIFIED_TYPE_NAME);
-
- PersistentAttribute persistentAttribute = getJavaPersistentType().attributes().next();
- TransientMapping transientMapping = (TransientMapping) persistentAttribute.getMapping();
- assertFalse(transientMapping.isDefault());
-
- persistentAttribute.setSpecifiedMappingKey(MappingKeys.ID_ATTRIBUTE_MAPPING_KEY);
- assertTrue(persistentAttribute.getMapping() instanceof IdMapping);
-
- JavaResourcePersistentType typeResource = getJpaProject().getJavaResourcePersistentType(FULLY_QUALIFIED_TYPE_NAME);
- JavaResourcePersistentAttribute attributeResource = typeResource.persistableAttributes().next();
- assertNull(attributeResource.getMappingAnnotation(TransientAnnotation.ANNOTATION_NAME));
- assertNotNull(attributeResource.getMappingAnnotation(IdAnnotation.ANNOTATION_NAME));
- }
-
- public void testMorphToEmbeddedIdMapping() throws Exception {
- createTestEntityWithTransientMapping();
- addXmlClassRef(FULLY_QUALIFIED_TYPE_NAME);
-
- PersistentAttribute persistentAttribute = getJavaPersistentType().attributes().next();
- TransientMapping transientMapping = (TransientMapping) persistentAttribute.getMapping();
- assertFalse(transientMapping.isDefault());
-
- persistentAttribute.setSpecifiedMappingKey(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.getMappingAnnotation(TransientAnnotation.ANNOTATION_NAME));
- assertNotNull(attributeResource.getMappingAnnotation(EmbeddedIdAnnotation.ANNOTATION_NAME));
- }
-
- public void testMorphToOneToOneMapping() throws Exception {
- createTestEntityWithTransientMapping();
- addXmlClassRef(FULLY_QUALIFIED_TYPE_NAME);
-
- PersistentAttribute persistentAttribute = getJavaPersistentType().attributes().next();
- TransientMapping transientMapping = (TransientMapping) persistentAttribute.getMapping();
- assertFalse(transientMapping.isDefault());
-
- persistentAttribute.setSpecifiedMappingKey(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.getMappingAnnotation(TransientAnnotation.ANNOTATION_NAME));
- assertNotNull(attributeResource.getMappingAnnotation(OneToOneAnnotation.ANNOTATION_NAME));
- }
-
- public void testMorphToOneToManyMapping() throws Exception {
- createTestEntityWithTransientMapping();
- addXmlClassRef(FULLY_QUALIFIED_TYPE_NAME);
-
- PersistentAttribute persistentAttribute = getJavaPersistentType().attributes().next();
- TransientMapping transientMapping = (TransientMapping) persistentAttribute.getMapping();
- assertFalse(transientMapping.isDefault());
-
- persistentAttribute.setSpecifiedMappingKey(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.getMappingAnnotation(TransientAnnotation.ANNOTATION_NAME));
- assertNotNull(attributeResource.getMappingAnnotation(OneToManyAnnotation.ANNOTATION_NAME));
- }
-
- public void testMorphToManyToOneMapping() throws Exception {
- createTestEntityWithTransientMapping();
- addXmlClassRef(FULLY_QUALIFIED_TYPE_NAME);
-
- PersistentAttribute persistentAttribute = getJavaPersistentType().attributes().next();
- TransientMapping transientMapping = (TransientMapping) persistentAttribute.getMapping();
- assertFalse(transientMapping.isDefault());
-
- persistentAttribute.setSpecifiedMappingKey(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.getMappingAnnotation(TransientAnnotation.ANNOTATION_NAME));
- assertNotNull(attributeResource.getMappingAnnotation(ManyToOneAnnotation.ANNOTATION_NAME));
- }
-
- public void testMorphToManyToManyMapping() throws Exception {
- createTestEntityWithTransientMapping();
- addXmlClassRef(FULLY_QUALIFIED_TYPE_NAME);
-
- PersistentAttribute persistentAttribute = getJavaPersistentType().attributes().next();
- TransientMapping transientMapping = (TransientMapping) persistentAttribute.getMapping();
- assertFalse(transientMapping.isDefault());
-
- persistentAttribute.setSpecifiedMappingKey(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.getMappingAnnotation(TransientAnnotation.ANNOTATION_NAME));
- assertNotNull(attributeResource.getMappingAnnotation(ManyToManyAnnotation.ANNOTATION_NAME));
- }
-
- public void testTransientMapping() throws Exception {
- createTestEntityWithTransientMapping();
- addXmlClassRef(FULLY_QUALIFIED_TYPE_NAME);
-
- PersistentAttribute persistentAttribute = getJavaPersistentType().attributes().next();
- TransientMapping transientMapping = (TransientMapping) persistentAttribute.getSpecifiedMapping();
-
- assertNotNull(transientMapping);
- }
-
-}
diff --git a/jpa/tests/org.eclipse.jpt.core.tests/src/org/eclipse/jpt/core/tests/internal/context/java/JavaVersionMappingTests.java b/jpa/tests/org.eclipse.jpt.core.tests/src/org/eclipse/jpt/core/tests/internal/context/java/JavaVersionMappingTests.java
deleted file mode 100644
index a8b6f2cce9..0000000000
--- a/jpa/tests/org.eclipse.jpt.core.tests/src/org/eclipse/jpt/core/tests/internal/context/java/JavaVersionMappingTests.java
+++ /dev/null
@@ -1,398 +0,0 @@
-/*******************************************************************************
- * Copyright (c) 2007, 2008 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.
- *
- * Contributors:
- * Oracle - initial API and implementation
- ******************************************************************************/
-package org.eclipse.jpt.core.tests.internal.context.java;
-
-import java.util.Iterator;
-import org.eclipse.jdt.core.ICompilationUnit;
-import org.eclipse.jpt.core.MappingKeys;
-import org.eclipse.jpt.core.context.BasicMapping;
-import org.eclipse.jpt.core.context.Converter;
-import org.eclipse.jpt.core.context.EmbeddedIdMapping;
-import org.eclipse.jpt.core.context.EmbeddedMapping;
-import org.eclipse.jpt.core.context.IdMapping;
-import org.eclipse.jpt.core.context.ManyToManyMapping;
-import org.eclipse.jpt.core.context.ManyToOneMapping;
-import org.eclipse.jpt.core.context.OneToManyMapping;
-import org.eclipse.jpt.core.context.OneToOneMapping;
-import org.eclipse.jpt.core.context.PersistentAttribute;
-import org.eclipse.jpt.core.context.TemporalConverter;
-import org.eclipse.jpt.core.context.TemporalType;
-import org.eclipse.jpt.core.context.TransientMapping;
-import org.eclipse.jpt.core.context.VersionMapping;
-import org.eclipse.jpt.core.resource.java.BasicAnnotation;
-import org.eclipse.jpt.core.resource.java.ColumnAnnotation;
-import org.eclipse.jpt.core.resource.java.EmbeddedAnnotation;
-import org.eclipse.jpt.core.resource.java.EmbeddedIdAnnotation;
-import org.eclipse.jpt.core.resource.java.IdAnnotation;
-import org.eclipse.jpt.core.resource.java.JPA;
-import org.eclipse.jpt.core.resource.java.JavaResourcePersistentAttribute;
-import org.eclipse.jpt.core.resource.java.JavaResourcePersistentType;
-import org.eclipse.jpt.core.resource.java.ManyToManyAnnotation;
-import org.eclipse.jpt.core.resource.java.ManyToOneAnnotation;
-import org.eclipse.jpt.core.resource.java.OneToManyAnnotation;
-import org.eclipse.jpt.core.resource.java.OneToOneAnnotation;
-import org.eclipse.jpt.core.resource.java.TemporalAnnotation;
-import org.eclipse.jpt.core.resource.java.TransientAnnotation;
-import org.eclipse.jpt.core.resource.java.VersionAnnotation;
-import org.eclipse.jpt.core.tests.internal.context.ContextModelTestCase;
-import org.eclipse.jpt.utility.internal.iterators.ArrayIterator;
-
-public class JavaVersionMappingTests extends ContextModelTestCase
-{
- private ICompilationUnit createTestEntityWithVersionMapping() throws Exception {
- return this.createTestType(new DefaultAnnotationWriter() {
- @Override
- public Iterator<String> imports() {
- return new ArrayIterator<String>(JPA.ENTITY, JPA.VERSION);
- }
- @Override
- public void appendTypeAnnotationTo(StringBuilder sb) {
- sb.append("@Entity").append(CR);
- }
-
- @Override
- public void appendIdFieldAnnotationTo(StringBuilder sb) {
- sb.append("@Version").append(CR);
- }
- });
- }
-
- private ICompilationUnit createTestEntityWithTemporal() throws Exception {
- return this.createTestType(new DefaultAnnotationWriter() {
- @Override
- public Iterator<String> imports() {
- return new ArrayIterator<String>(JPA.ENTITY, JPA.VERSION, JPA.TEMPORAL, JPA.TEMPORAL_TYPE);
- }
- @Override
- public void appendTypeAnnotationTo(StringBuilder sb) {
- sb.append("@Entity").append(CR);
- }
-
- @Override
- public void appendIdFieldAnnotationTo(StringBuilder sb) {
- sb.append("@Version").append(CR);
- sb.append("@Temporal(TemporalType.TIMESTAMP)").append(CR);
- }
- });
- }
-
- public JavaVersionMappingTests(String name) {
- super(name);
- }
-
- public void testMorphToBasicMapping() throws Exception {
- createTestEntityWithVersionMapping();
- addXmlClassRef(FULLY_QUALIFIED_TYPE_NAME);
-
- PersistentAttribute persistentAttribute = getJavaPersistentType().attributes().next();
- VersionMapping versionMapping = (VersionMapping) persistentAttribute.getMapping();
- assertFalse(versionMapping.isDefault());
- versionMapping.getColumn().setSpecifiedName("FOO");
- versionMapping.setSpecifiedConverter(Converter.TEMPORAL_CONVERTER);
- ((TemporalConverter) versionMapping.getSpecifiedConverter()).setTemporalType(TemporalType.TIME);
- assertFalse(versionMapping.isDefault());
-
- persistentAttribute.setSpecifiedMappingKey(MappingKeys.BASIC_ATTRIBUTE_MAPPING_KEY);
- 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.getMappingAnnotation(VersionAnnotation.ANNOTATION_NAME));
- assertNotNull(attributeResource.getMappingAnnotation(BasicAnnotation.ANNOTATION_NAME));
- assertNotNull(attributeResource.getSupportingAnnotation(ColumnAnnotation.ANNOTATION_NAME));
- assertNotNull(attributeResource.getSupportingAnnotation(TemporalAnnotation.ANNOTATION_NAME));
- }
-
- public void testMorphToDefault() throws Exception {
- createTestEntityWithVersionMapping();
- addXmlClassRef(FULLY_QUALIFIED_TYPE_NAME);
-
- PersistentAttribute persistentAttribute = getJavaPersistentType().attributes().next();
- VersionMapping versionMapping = (VersionMapping) persistentAttribute.getMapping();
- assertFalse(versionMapping.isDefault());
- versionMapping.getColumn().setSpecifiedName("FOO");
- versionMapping.setSpecifiedConverter(Converter.TEMPORAL_CONVERTER);
- ((TemporalConverter) versionMapping.getSpecifiedConverter()).setTemporalType(TemporalType.TIME);
- assertFalse(versionMapping.isDefault());
-
- persistentAttribute.setSpecifiedMappingKey(MappingKeys.NULL_ATTRIBUTE_MAPPING_KEY);
- 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.getMappingAnnotation(VersionAnnotation.ANNOTATION_NAME));
- assertNotNull(attributeResource.getSupportingAnnotation(ColumnAnnotation.ANNOTATION_NAME));
- assertNotNull(attributeResource.getSupportingAnnotation(TemporalAnnotation.ANNOTATION_NAME));
- }
-
- public void testMorphToIdMapping() throws Exception {
- createTestEntityWithVersionMapping();
- addXmlClassRef(FULLY_QUALIFIED_TYPE_NAME);
-
- PersistentAttribute persistentAttribute = getJavaPersistentType().attributes().next();
- VersionMapping versionMapping = (VersionMapping) persistentAttribute.getMapping();
- assertFalse(versionMapping.isDefault());
- versionMapping.getColumn().setSpecifiedName("FOO");
- versionMapping.setSpecifiedConverter(Converter.TEMPORAL_CONVERTER);
- ((TemporalConverter) versionMapping.getSpecifiedConverter()).setTemporalType(TemporalType.TIME);
- assertFalse(versionMapping.isDefault());
-
- persistentAttribute.setSpecifiedMappingKey(MappingKeys.ID_ATTRIBUTE_MAPPING_KEY);
- assertEquals("FOO", ((IdMapping) persistentAttribute.getMapping()).getColumn().getSpecifiedName());
- assertEquals(TemporalType.TIME, ((TemporalConverter) ((IdMapping) persistentAttribute.getMapping()).getConverter()).getTemporalType());
-
- JavaResourcePersistentType typeResource = getJpaProject().getJavaResourcePersistentType(FULLY_QUALIFIED_TYPE_NAME);
- JavaResourcePersistentAttribute attributeResource = typeResource.persistableAttributes().next();
- assertNull(attributeResource.getMappingAnnotation(VersionAnnotation.ANNOTATION_NAME));
- assertNotNull(attributeResource.getMappingAnnotation(IdAnnotation.ANNOTATION_NAME));
- assertNotNull(attributeResource.getSupportingAnnotation(ColumnAnnotation.ANNOTATION_NAME));
- assertNotNull(attributeResource.getSupportingAnnotation(TemporalAnnotation.ANNOTATION_NAME));
- }
-
- public void testMorphToEmbeddedMapping() throws Exception {
- createTestEntityWithVersionMapping();
- addXmlClassRef(FULLY_QUALIFIED_TYPE_NAME);
-
- PersistentAttribute persistentAttribute = getJavaPersistentType().attributes().next();
- VersionMapping versionMapping = (VersionMapping) persistentAttribute.getMapping();
- assertFalse(versionMapping.isDefault());
- versionMapping.getColumn().setSpecifiedName("FOO");
- versionMapping.setSpecifiedConverter(Converter.TEMPORAL_CONVERTER);
- ((TemporalConverter) versionMapping.getSpecifiedConverter()).setTemporalType(TemporalType.TIME);
- assertFalse(versionMapping.isDefault());
-
- persistentAttribute.setSpecifiedMappingKey(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.getMappingAnnotation(VersionAnnotation.ANNOTATION_NAME));
- assertNotNull(attributeResource.getMappingAnnotation(EmbeddedAnnotation.ANNOTATION_NAME));
- assertNull(attributeResource.getSupportingAnnotation(ColumnAnnotation.ANNOTATION_NAME));
- assertNull(attributeResource.getSupportingAnnotation(TemporalAnnotation.ANNOTATION_NAME));
- }
-
- public void testMorphToTransientMapping() throws Exception {
- createTestEntityWithVersionMapping();
- addXmlClassRef(FULLY_QUALIFIED_TYPE_NAME);
-
- PersistentAttribute persistentAttribute = getJavaPersistentType().attributes().next();
- VersionMapping versionMapping = (VersionMapping) persistentAttribute.getMapping();
- assertFalse(versionMapping.isDefault());
- versionMapping.getColumn().setSpecifiedName("FOO");
- versionMapping.setSpecifiedConverter(Converter.TEMPORAL_CONVERTER);
- ((TemporalConverter) versionMapping.getSpecifiedConverter()).setTemporalType(TemporalType.TIME);
- assertFalse(versionMapping.isDefault());
-
- persistentAttribute.setSpecifiedMappingKey(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.getMappingAnnotation(VersionAnnotation.ANNOTATION_NAME));
- assertNotNull(attributeResource.getMappingAnnotation(TransientAnnotation.ANNOTATION_NAME));
- assertNull(attributeResource.getSupportingAnnotation(ColumnAnnotation.ANNOTATION_NAME));
- assertNull(attributeResource.getSupportingAnnotation(TemporalAnnotation.ANNOTATION_NAME));
- }
-
- public void testMorphToEmbeddedIdMapping() throws Exception {
- createTestEntityWithVersionMapping();
- addXmlClassRef(FULLY_QUALIFIED_TYPE_NAME);
-
- PersistentAttribute persistentAttribute = getJavaPersistentType().attributes().next();
- VersionMapping versionMapping = (VersionMapping) persistentAttribute.getMapping();
- assertFalse(versionMapping.isDefault());
- versionMapping.getColumn().setSpecifiedName("FOO");
- versionMapping.setSpecifiedConverter(Converter.TEMPORAL_CONVERTER);
- ((TemporalConverter) versionMapping.getSpecifiedConverter()).setTemporalType(TemporalType.TIME);
- assertFalse(versionMapping.isDefault());
-
- persistentAttribute.setSpecifiedMappingKey(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.getMappingAnnotation(VersionAnnotation.ANNOTATION_NAME));
- assertNotNull(attributeResource.getMappingAnnotation(EmbeddedIdAnnotation.ANNOTATION_NAME));
- assertNull(attributeResource.getSupportingAnnotation(ColumnAnnotation.ANNOTATION_NAME));
- assertNull(attributeResource.getSupportingAnnotation(TemporalAnnotation.ANNOTATION_NAME));
- }
-
- public void testMorphToOneToOneMapping() throws Exception {
- createTestEntityWithVersionMapping();
- addXmlClassRef(FULLY_QUALIFIED_TYPE_NAME);
-
- PersistentAttribute persistentAttribute = getJavaPersistentType().attributes().next();
- VersionMapping versionMapping = (VersionMapping) persistentAttribute.getMapping();
- assertFalse(versionMapping.isDefault());
- versionMapping.getColumn().setSpecifiedName("FOO");
- versionMapping.setSpecifiedConverter(Converter.TEMPORAL_CONVERTER);
- ((TemporalConverter) versionMapping.getSpecifiedConverter()).setTemporalType(TemporalType.TIME);
- assertFalse(versionMapping.isDefault());
-
- persistentAttribute.setSpecifiedMappingKey(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.getMappingAnnotation(VersionAnnotation.ANNOTATION_NAME));
- assertNotNull(attributeResource.getMappingAnnotation(OneToOneAnnotation.ANNOTATION_NAME));
- assertNull(attributeResource.getSupportingAnnotation(ColumnAnnotation.ANNOTATION_NAME));
- assertNull(attributeResource.getSupportingAnnotation(TemporalAnnotation.ANNOTATION_NAME));
- }
-
- public void testMorphToOneToManyMapping() throws Exception {
- createTestEntityWithVersionMapping();
- addXmlClassRef(FULLY_QUALIFIED_TYPE_NAME);
-
- PersistentAttribute persistentAttribute = getJavaPersistentType().attributes().next();
- VersionMapping versionMapping = (VersionMapping) persistentAttribute.getMapping();
- assertFalse(versionMapping.isDefault());
- versionMapping.getColumn().setSpecifiedName("FOO");
- versionMapping.setSpecifiedConverter(Converter.TEMPORAL_CONVERTER);
- ((TemporalConverter) versionMapping.getSpecifiedConverter()).setTemporalType(TemporalType.TIME);
- assertFalse(versionMapping.isDefault());
-
- persistentAttribute.setSpecifiedMappingKey(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.getMappingAnnotation(VersionAnnotation.ANNOTATION_NAME));
- assertNotNull(attributeResource.getMappingAnnotation(OneToManyAnnotation.ANNOTATION_NAME));
- assertNull(attributeResource.getSupportingAnnotation(ColumnAnnotation.ANNOTATION_NAME));
- assertNull(attributeResource.getSupportingAnnotation(TemporalAnnotation.ANNOTATION_NAME));
- }
-
- public void testMorphToManyToOneMapping() throws Exception {
- createTestEntityWithVersionMapping();
- addXmlClassRef(FULLY_QUALIFIED_TYPE_NAME);
-
- PersistentAttribute persistentAttribute = getJavaPersistentType().attributes().next();
- VersionMapping versionMapping = (VersionMapping) persistentAttribute.getMapping();
- assertFalse(versionMapping.isDefault());
- versionMapping.getColumn().setSpecifiedName("FOO");
- versionMapping.setSpecifiedConverter(Converter.TEMPORAL_CONVERTER);
- ((TemporalConverter) versionMapping.getSpecifiedConverter()).setTemporalType(TemporalType.TIME);
- assertFalse(versionMapping.isDefault());
-
- persistentAttribute.setSpecifiedMappingKey(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.getMappingAnnotation(VersionAnnotation.ANNOTATION_NAME));
- assertNotNull(attributeResource.getMappingAnnotation(ManyToOneAnnotation.ANNOTATION_NAME));
- assertNull(attributeResource.getSupportingAnnotation(ColumnAnnotation.ANNOTATION_NAME));
- assertNull(attributeResource.getSupportingAnnotation(TemporalAnnotation.ANNOTATION_NAME));
- }
-
- public void testMorphToManyToManyMapping() throws Exception {
- createTestEntityWithVersionMapping();
- addXmlClassRef(FULLY_QUALIFIED_TYPE_NAME);
-
- PersistentAttribute persistentAttribute = getJavaPersistentType().attributes().next();
- VersionMapping versionMapping = (VersionMapping) persistentAttribute.getMapping();
- assertFalse(versionMapping.isDefault());
- versionMapping.getColumn().setSpecifiedName("FOO");
- versionMapping.setSpecifiedConverter(Converter.TEMPORAL_CONVERTER);
- ((TemporalConverter) versionMapping.getSpecifiedConverter()).setTemporalType(TemporalType.TIME);
- assertFalse(versionMapping.isDefault());
-
- persistentAttribute.setSpecifiedMappingKey(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.getMappingAnnotation(VersionAnnotation.ANNOTATION_NAME));
- assertNotNull(attributeResource.getMappingAnnotation(ManyToManyAnnotation.ANNOTATION_NAME));
- assertNull(attributeResource.getSupportingAnnotation(ColumnAnnotation.ANNOTATION_NAME));
- assertNull(attributeResource.getSupportingAnnotation(TemporalAnnotation.ANNOTATION_NAME));
- }
-
-
- public void testGetTemporal() throws Exception {
- createTestEntityWithTemporal();
- addXmlClassRef(FULLY_QUALIFIED_TYPE_NAME);
-
- PersistentAttribute persistentAttribute = getJavaPersistentType().attributes().next();
- VersionMapping versionMapping = (VersionMapping) persistentAttribute.getSpecifiedMapping();
-
- assertEquals(TemporalType.TIMESTAMP, ((TemporalConverter) versionMapping.getConverter()).getTemporalType());
- }
-
- public void testSetTemporal() throws Exception {
- createTestEntityWithVersionMapping();
- addXmlClassRef(FULLY_QUALIFIED_TYPE_NAME);
-
- PersistentAttribute persistentAttribute = getJavaPersistentType().attributes().next();
- VersionMapping versionMapping = (VersionMapping) persistentAttribute.getSpecifiedMapping();
- assertEquals(Converter.NO_CONVERTER, versionMapping.getConverter().getType());
-
- versionMapping.setSpecifiedConverter(Converter.TEMPORAL_CONVERTER);
- ((TemporalConverter) versionMapping.getConverter()).setTemporalType(TemporalType.TIME);
-
- JavaResourcePersistentType typeResource = getJpaProject().getJavaResourcePersistentType(FULLY_QUALIFIED_TYPE_NAME);
- JavaResourcePersistentAttribute attributeResource = typeResource.persistableAttributes().next();
- TemporalAnnotation temporal = (TemporalAnnotation) attributeResource.getSupportingAnnotation(TemporalAnnotation.ANNOTATION_NAME);
-
- assertEquals(org.eclipse.jpt.core.resource.java.TemporalType.TIME, temporal.getValue());
-
- versionMapping.setSpecifiedConverter(null);
- assertNull(attributeResource.getSupportingAnnotation(TemporalAnnotation.ANNOTATION_NAME));
- }
-
- public void testGetTemporalUpdatesFromResourceModelChange() throws Exception {
- createTestEntityWithVersionMapping();
- addXmlClassRef(FULLY_QUALIFIED_TYPE_NAME);
-
- PersistentAttribute persistentAttribute = getJavaPersistentType().attributes().next();
- VersionMapping versionMapping = (VersionMapping) persistentAttribute.getSpecifiedMapping();
-
- assertEquals(Converter.NO_CONVERTER, versionMapping.getConverter().getType());
-
-
- JavaResourcePersistentType typeResource = getJpaProject().getJavaResourcePersistentType(FULLY_QUALIFIED_TYPE_NAME);
- JavaResourcePersistentAttribute attributeResource = typeResource.persistableAttributes().next();
- TemporalAnnotation temporal = (TemporalAnnotation) attributeResource.addSupportingAnnotation(TemporalAnnotation.ANNOTATION_NAME);
- temporal.setValue(org.eclipse.jpt.core.resource.java.TemporalType.DATE);
-
- assertEquals(TemporalType.DATE, ((TemporalConverter) versionMapping.getConverter()).getTemporalType());
-
- attributeResource.removeSupportingAnnotation(TemporalAnnotation.ANNOTATION_NAME);
-
- assertEquals(Converter.NO_CONVERTER, versionMapping.getConverter().getType());
- assertFalse(versionMapping.isDefault());
- assertSame(versionMapping, persistentAttribute.getSpecifiedMapping());
- }
-
- public void testGetColumn() throws Exception {
- createTestEntityWithVersionMapping();
- addXmlClassRef(FULLY_QUALIFIED_TYPE_NAME);
-
- PersistentAttribute persistentAttribute = getJavaPersistentType().attributes().next();
- VersionMapping versionMapping = (VersionMapping) persistentAttribute.getSpecifiedMapping();
-
- assertNull(versionMapping.getColumn().getSpecifiedName());
- assertEquals("id", versionMapping.getColumn().getName());
-
- JavaResourcePersistentType typeResource = getJpaProject().getJavaResourcePersistentType(FULLY_QUALIFIED_TYPE_NAME);
- JavaResourcePersistentAttribute attributeResource = typeResource.persistableAttributes().next();
- ColumnAnnotation column = (ColumnAnnotation) attributeResource.addSupportingAnnotation(JPA.COLUMN);
- column.setName("foo");
-
- assertEquals("foo", versionMapping.getColumn().getSpecifiedName());
- assertEquals("foo", versionMapping.getColumn().getName());
- assertEquals("id", versionMapping.getColumn().getDefaultName());
- }
-
-}
diff --git a/jpa/tests/org.eclipse.jpt.core.tests/src/org/eclipse/jpt/core/tests/internal/context/java/JptCoreContextJavaModelTests.java b/jpa/tests/org.eclipse.jpt.core.tests/src/org/eclipse/jpt/core/tests/internal/context/java/JptCoreContextJavaModelTests.java
deleted file mode 100644
index 2777d467f0..0000000000
--- a/jpa/tests/org.eclipse.jpt.core.tests/src/org/eclipse/jpt/core/tests/internal/context/java/JptCoreContextJavaModelTests.java
+++ /dev/null
@@ -1,58 +0,0 @@
-/*******************************************************************************
- * Copyright (c) 2007, 2009 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
- *
- * Contributors:
- * Oracle - initial API and implementation
- *******************************************************************************/
-package org.eclipse.jpt.core.tests.internal.context.java;
-
-import junit.framework.Test;
-import junit.framework.TestCase;
-import junit.framework.TestSuite;
-
-public class JptCoreContextJavaModelTests extends TestCase
-{
- public static Test suite() {
- TestSuite suite = new TestSuite(JptCoreContextJavaModelTests.class.getName());
- suite.addTestSuite(JavaAssociationOverrideTests.class);
- suite.addTestSuite(JavaAttributeOverrideTests.class);
- suite.addTestSuite(JavaBasicMappingTests.class);
- suite.addTestSuite(JavaColumnTests.class);
- suite.addTestSuite(JavaDiscriminatorColumnTests.class);
- suite.addTestSuite(JavaEmbeddableTests.class);
- suite.addTestSuite(JavaEmbeddedIdMappingTests.class);
- suite.addTestSuite(JavaEmbeddedMappingTests.class);
- suite.addTestSuite(JavaEntityTests.class);
- suite.addTestSuite(JavaGeneratedValueTests.class);
- suite.addTestSuite(JavaIdMappingTests.class);
- suite.addTestSuite(JavaJoinColumnTests.class);
- suite.addTestSuite(JavaJoinTableTests.class);
- suite.addTestSuite(JavaMappedSuperclassTests.class);
- suite.addTestSuite(JavaManyToManyMappingTests.class);
- suite.addTestSuite(JavaManyToOneMappingTests.class);
- suite.addTestSuite(JavaNamedQueryTests.class);
- suite.addTestSuite(JavaNamedNativeQueryTests.class);
- suite.addTestSuite(JavaQueryHintTests.class);
- suite.addTestSuite(JavaOneToManyMappingTests.class);
- suite.addTestSuite(JavaOneToOneMappingTests.class);
- suite.addTestSuite(GenericJavaPersistentTypeTests.class);
- suite.addTestSuite(GenericJavaPersistentAttributeTests.class);
- suite.addTestSuite(JavaPrimaryKeyJoinColumnTests.class);
- suite.addTestSuite(JavaSecondaryTableTests.class);
- suite.addTestSuite(JavaSequenceGeneratorTests.class);
- suite.addTestSuite(JavaTableGeneratorTests.class);
- suite.addTestSuite(JavaTableTests.class);
- suite.addTestSuite(JavaTransientMappingTests.class);
- suite.addTestSuite(JavaVersionMappingTests.class);
- return suite;
- }
-
- private JptCoreContextJavaModelTests() {
- super();
- throw new UnsupportedOperationException();
- }
-}
diff --git a/jpa/tests/org.eclipse.jpt.core.tests/src/org/eclipse/jpt/core/tests/internal/context/orm/EntityMappingsTests.java b/jpa/tests/org.eclipse.jpt.core.tests/src/org/eclipse/jpt/core/tests/internal/context/orm/EntityMappingsTests.java
deleted file mode 100644
index 69fe5297eb..0000000000
--- a/jpa/tests/org.eclipse.jpt.core.tests/src/org/eclipse/jpt/core/tests/internal/context/orm/EntityMappingsTests.java
+++ /dev/null
@@ -1,1066 +0,0 @@
-/*******************************************************************************
- * Copyright (c) 2007, 2009 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.
- *
- * Contributors:
- * Oracle - initial API and implementation
- ******************************************************************************/
-package org.eclipse.jpt.core.tests.internal.context.orm;
-
-import java.util.ListIterator;
-import org.eclipse.jpt.core.JptCorePlugin;
-import org.eclipse.jpt.core.MappingKeys;
-import org.eclipse.jpt.core.context.AccessType;
-import org.eclipse.jpt.core.context.SequenceGenerator;
-import org.eclipse.jpt.core.context.TableGenerator;
-import org.eclipse.jpt.core.context.orm.OrmNamedNativeQuery;
-import org.eclipse.jpt.core.context.orm.OrmNamedQuery;
-import org.eclipse.jpt.core.context.orm.OrmSequenceGenerator;
-import org.eclipse.jpt.core.context.orm.OrmTableGenerator;
-import org.eclipse.jpt.core.resource.orm.OrmFactory;
-import org.eclipse.jpt.core.resource.orm.XmlEmbeddable;
-import org.eclipse.jpt.core.resource.orm.XmlEntity;
-import org.eclipse.jpt.core.resource.orm.XmlMappedSuperclass;
-import org.eclipse.jpt.core.resource.orm.XmlSequenceGenerator;
-import org.eclipse.jpt.core.resource.orm.XmlTableGenerator;
-import org.eclipse.jpt.core.resource.persistence.PersistenceFactory;
-import org.eclipse.jpt.core.resource.persistence.XmlMappingFileRef;
-import org.eclipse.jpt.core.tests.internal.context.ContextModelTestCase;
-
-@SuppressWarnings("nls")
-public class EntityMappingsTests extends ContextModelTestCase
-{
- public EntityMappingsTests(String name) {
- super(name);
- }
-
- @Override
- protected void setUp() throws Exception {
- super.setUp();
- XmlMappingFileRef mappingFileRef = PersistenceFactory.eINSTANCE.createXmlMappingFileRef();
- mappingFileRef.setFileName(JptCorePlugin.DEFAULT_ORM_XML_FILE_PATH);
- getXmlPersistenceUnit().getMappingFiles().add(mappingFileRef);
- getPersistenceXmlResource().save(null);
- }
-
- public void testGetVersion() throws Exception {
- assertEquals("1.0", getEntityMappings().getVersion());
- }
-
- public void testUpdateDescription() throws Exception {
- assertNull(getEntityMappings().getDescription());
- assertNull(getXmlEntityMappings().getDescription());
-
- //set description in the resource model, verify context model updated
- getXmlEntityMappings().setDescription("newDescription");
- assertEquals("newDescription", getEntityMappings().getDescription());
- assertEquals("newDescription", getXmlEntityMappings().getDescription());
-
- //set description to null in the resource model
- getXmlEntityMappings().setDescription(null);
- assertNull(getEntityMappings().getDescription());
- assertNull(getXmlEntityMappings().getDescription());
- }
-
- public void testModifyDescription() throws Exception {
- assertNull(getEntityMappings().getDescription());
- assertNull(getXmlEntityMappings().getDescription());
-
- //set description in the context model, verify resource model modified
- getEntityMappings().setDescription("newDescription");
- assertEquals("newDescription", getEntityMappings().getDescription());
- assertEquals("newDescription", getXmlEntityMappings().getDescription());
-
- //set description to null in the context model
- getEntityMappings().setDescription(null);
- assertNull(getEntityMappings().getDescription());
- assertNull(getXmlEntityMappings().getDescription());
- }
-
- public void testUpdatePackage() throws Exception {
- assertNull(getEntityMappings().getPackage());
- assertNull(getXmlEntityMappings().getPackage());
-
- //set package in the resource model, verify context model updated
- getXmlEntityMappings().setPackage("foo.model");
- assertEquals("foo.model", getEntityMappings().getPackage());
- assertEquals("foo.model", getXmlEntityMappings().getPackage());
-
- //set package to null in the resource model
- getXmlEntityMappings().setPackage(null);
- assertNull(getEntityMappings().getPackage());
- assertNull(getXmlEntityMappings().getPackage());
- }
-
- public void testModifyPackage() throws Exception {
- assertNull(getEntityMappings().getPackage());
- assertNull(getXmlEntityMappings().getPackage());
-
- //set package in the context model, verify resource model modified
- getEntityMappings().setPackage("foo.model");
- assertEquals("foo.model", getEntityMappings().getPackage());
- assertEquals("foo.model", getXmlEntityMappings().getPackage());
-
- //set package to null in the context model
- getEntityMappings().setPackage(null);
- assertNull(getEntityMappings().getPackage());
- assertNull(getXmlEntityMappings().getPackage());
- }
-
- public void testUpdateSpecifiedSchema() throws Exception {
- assertNull(getEntityMappings().getSpecifiedSchema());
- assertNull(getXmlEntityMappings().getSchema());
-
- //set schema in the resource model, verify context model updated
- getXmlEntityMappings().setSchema("MY_SCHEMA");
- assertEquals("MY_SCHEMA", getEntityMappings().getSpecifiedSchema());
- assertEquals("MY_SCHEMA", getXmlEntityMappings().getSchema());
-
- //set schema to null in the resource model
- getXmlEntityMappings().setSchema(null);
- assertNull(getEntityMappings().getSpecifiedSchema());
- assertNull(getXmlEntityMappings().getSchema());
- }
-
- public void testModifySpecifiedSchema() throws Exception {
- assertNull(getEntityMappings().getSpecifiedSchema());
- assertNull(getXmlEntityMappings().getSchema());
-
- //set schema in the context model, verify resource model modified
- getEntityMappings().setSpecifiedSchema("MY_SCHEMA");
- assertEquals("MY_SCHEMA", getEntityMappings().getSpecifiedSchema());
- assertEquals("MY_SCHEMA", getXmlEntityMappings().getSchema());
-
- //set schema to null in the context model
- getEntityMappings().setSpecifiedSchema(null);
- assertNull(getEntityMappings().getSpecifiedSchema());
- assertNull(getXmlEntityMappings().getSchema());
- }
-
- public void testUpdateSpecifiedCatalog() throws Exception {
- assertNull(getEntityMappings().getSpecifiedCatalog());
- assertNull(getXmlEntityMappings().getCatalog());
-
- //set catalog in the resource model, verify context model updated
- getXmlEntityMappings().setCatalog("MY_CATALOG");
- assertEquals("MY_CATALOG", getEntityMappings().getSpecifiedCatalog());
- assertEquals("MY_CATALOG", getXmlEntityMappings().getCatalog());
-
- //set catalog to null in the resource model
- getXmlEntityMappings().setCatalog(null);
- assertNull(getEntityMappings().getSpecifiedCatalog());
- assertNull(getXmlEntityMappings().getCatalog());
- }
-
- public void testUpdateDefaultSchema() throws Exception {
- assertNull(getEntityMappings().getDefaultSchema());
- assertNull(getEntityMappings().getSpecifiedSchema());
- assertNull(getXmlEntityMappings().getSchema());
-
- getXmlEntityMappings().setPersistenceUnitMetadata(OrmFactory.eINSTANCE.createXmlPersistenceUnitMetadata());
- org.eclipse.jpt.core.resource.orm.XmlPersistenceUnitDefaults persistenceUnitDefaults = OrmFactory.eINSTANCE.createXmlPersistenceUnitDefaults();
- getXmlEntityMappings().getPersistenceUnitMetadata().setPersistenceUnitDefaults(persistenceUnitDefaults);
- persistenceUnitDefaults.setSchema("MY_SCHEMA");
- assertEquals("MY_SCHEMA", getEntityMappings().getDefaultSchema());
- assertNull(getEntityMappings().getSpecifiedSchema());
- assertNull(getXmlEntityMappings().getSchema());
- assertEquals("MY_SCHEMA", getXmlEntityMappings().getPersistenceUnitMetadata().getPersistenceUnitDefaults().getSchema());
-
- persistenceUnitDefaults.setSchema(null);
- assertNull(getEntityMappings().getDefaultSchema());
- assertNull(getEntityMappings().getSpecifiedSchema());
- assertNull(getXmlEntityMappings().getSchema());
- assertNull(getXmlEntityMappings().getPersistenceUnitMetadata().getPersistenceUnitDefaults().getSchema());
- }
-
- public void testUpdateSchema() throws Exception {
- assertNull(getEntityMappings().getDefaultSchema());
- assertNull(getEntityMappings().getSchema());
- assertNull(getEntityMappings().getSpecifiedSchema());
- assertNull(getXmlEntityMappings().getSchema());
-
- getXmlEntityMappings().setSchema("MY_SCHEMA");
- assertNull(getEntityMappings().getDefaultSchema());
- assertEquals("MY_SCHEMA", getEntityMappings().getSchema());
- assertEquals("MY_SCHEMA", getEntityMappings().getSpecifiedSchema());
- assertEquals("MY_SCHEMA", getXmlEntityMappings().getSchema());
-
- getXmlEntityMappings().setSchema(null);
- assertNull(getEntityMappings().getDefaultSchema());
- assertNull(getEntityMappings().getSchema());
- assertNull(getEntityMappings().getSpecifiedSchema());
- assertNull(getXmlEntityMappings().getSchema());
-
- getEntityMappings().getPersistenceUnitMetadata().getPersistenceUnitDefaults().setSpecifiedSchema("DEFAULT_SCHEMA");
- assertEquals("DEFAULT_SCHEMA", getEntityMappings().getDefaultSchema());
- assertEquals("DEFAULT_SCHEMA", getEntityMappings().getSchema());
- assertNull(getEntityMappings().getSpecifiedSchema());
- assertNull(getXmlEntityMappings().getSchema());
-
- getEntityMappings().getPersistenceUnitMetadata().getPersistenceUnitDefaults().setSpecifiedSchema(null);
- assertNull(getEntityMappings().getDefaultSchema());
- assertNull(getEntityMappings().getSchema());
- assertNull(getEntityMappings().getSpecifiedSchema());
- assertNull(getXmlEntityMappings().getSchema());
- }
-
- public void testModifySpecifiedCatalog() throws Exception {
- assertNull(getEntityMappings().getSpecifiedCatalog());
- assertNull(getXmlEntityMappings().getCatalog());
-
- //set catalog in the context model, verify resource model modified
- getEntityMappings().setSpecifiedCatalog("MY_CATALOG");
- assertEquals("MY_CATALOG", getEntityMappings().getSpecifiedCatalog());
- assertEquals("MY_CATALOG", getXmlEntityMappings().getCatalog());
-
- //set catalog to null in the context model
- getEntityMappings().setSpecifiedCatalog(null);
- assertNull(getEntityMappings().getSpecifiedCatalog());
- assertNull(getXmlEntityMappings().getCatalog());
- }
-
- public void testUpdateDefaultCatalog() throws Exception {
- assertNull(getEntityMappings().getDefaultCatalog());
- assertNull(getEntityMappings().getSpecifiedCatalog());
- assertNull(getXmlEntityMappings().getCatalog());
-
- getXmlEntityMappings().setPersistenceUnitMetadata(OrmFactory.eINSTANCE.createXmlPersistenceUnitMetadata());
- org.eclipse.jpt.core.resource.orm.XmlPersistenceUnitDefaults persistenceUnitDefaults = OrmFactory.eINSTANCE.createXmlPersistenceUnitDefaults();
- getXmlEntityMappings().getPersistenceUnitMetadata().setPersistenceUnitDefaults(persistenceUnitDefaults);
- persistenceUnitDefaults.setCatalog("MY_CATALOG");
- assertEquals("MY_CATALOG", getEntityMappings().getDefaultCatalog());
- assertNull(getEntityMappings().getSpecifiedCatalog());
- assertNull(getXmlEntityMappings().getCatalog());
- assertEquals("MY_CATALOG", getXmlEntityMappings().getPersistenceUnitMetadata().getPersistenceUnitDefaults().getCatalog());
-
- persistenceUnitDefaults.setCatalog(null);
- assertNull(getEntityMappings().getDefaultCatalog());
- assertNull(getEntityMappings().getSpecifiedCatalog());
- assertNull(getXmlEntityMappings().getCatalog());
- assertNull(getXmlEntityMappings().getPersistenceUnitMetadata().getPersistenceUnitDefaults().getCatalog());
- }
-
- public void testUpdateCatalog() throws Exception {
- assertNull(getEntityMappings().getDefaultCatalog());
- assertNull(getEntityMappings().getCatalog());
- assertNull(getEntityMappings().getSpecifiedCatalog());
- assertNull(getXmlEntityMappings().getCatalog());
-
- getXmlEntityMappings().setCatalog("MY_CATALOG");
- assertNull(getEntityMappings().getDefaultCatalog());
- assertEquals("MY_CATALOG", getEntityMappings().getCatalog());
- assertEquals("MY_CATALOG", getEntityMappings().getSpecifiedCatalog());
- assertEquals("MY_CATALOG", getXmlEntityMappings().getCatalog());
-
- getXmlEntityMappings().setCatalog(null);
- assertNull(getEntityMappings().getDefaultCatalog());
- assertNull(getEntityMappings().getCatalog());
- assertNull(getEntityMappings().getSpecifiedCatalog());
- assertNull(getXmlEntityMappings().getCatalog());
-
- getEntityMappings().getPersistenceUnitMetadata().getPersistenceUnitDefaults().setSpecifiedCatalog("DEFAULT_CATALOG");
- assertEquals("DEFAULT_CATALOG", getEntityMappings().getDefaultCatalog());
- assertEquals("DEFAULT_CATALOG", getEntityMappings().getCatalog());
- assertNull(getEntityMappings().getSpecifiedCatalog());
- assertNull(getXmlEntityMappings().getCatalog());
-
- getEntityMappings().getPersistenceUnitMetadata().getPersistenceUnitDefaults().setSpecifiedCatalog(null);
- assertNull(getEntityMappings().getDefaultCatalog());
- assertNull(getEntityMappings().getCatalog());
- assertNull(getEntityMappings().getSpecifiedCatalog());
- assertNull(getXmlEntityMappings().getCatalog());
- }
-
- public void testUpdateSpecifiedAccess() throws Exception {
- assertNull(getEntityMappings().getSpecifiedAccess());
- assertNull(getXmlEntityMappings().getAccess());
-
- //set access in the resource model, verify context model updated
- getXmlEntityMappings().setAccess(org.eclipse.jpt.core.resource.orm.AccessType.PROPERTY);
- assertEquals(AccessType.PROPERTY, getEntityMappings().getSpecifiedAccess());
- assertEquals(org.eclipse.jpt.core.resource.orm.AccessType.PROPERTY, getXmlEntityMappings().getAccess());
-
- //set access to null in the resource model
- getXmlEntityMappings().setAccess(null);
- assertNull(getEntityMappings().getSpecifiedAccess());
- assertNull(getXmlEntityMappings().getAccess());
- }
-
- public void testModifySpecifiedAccess() throws Exception {
- assertNull(getEntityMappings().getSpecifiedAccess());
- assertNull(getXmlEntityMappings().getAccess());
-
- //set access in the context model, verify resource model modified
- getEntityMappings().setSpecifiedAccess(AccessType.PROPERTY);
- assertEquals(AccessType.PROPERTY, getEntityMappings().getSpecifiedAccess());
- assertEquals(org.eclipse.jpt.core.resource.orm.AccessType.PROPERTY, getXmlEntityMappings().getAccess());
-
- //set access to null in the context model
- getEntityMappings().setSpecifiedAccess(null);
- assertNull(getEntityMappings().getSpecifiedAccess());
- assertNull(getXmlEntityMappings().getAccess());
- }
-
- public void testUpdateDefaultAccess() throws Exception {
- assertNull(getEntityMappings().getDefaultAccess());
- assertNull(getEntityMappings().getSpecifiedAccess());
- assertNull(getXmlEntityMappings().getAccess());
-
- getXmlEntityMappings().setPersistenceUnitMetadata(OrmFactory.eINSTANCE.createXmlPersistenceUnitMetadata());
- org.eclipse.jpt.core.resource.orm.XmlPersistenceUnitDefaults persistenceUnitDefaults = OrmFactory.eINSTANCE.createXmlPersistenceUnitDefaults();
- getXmlEntityMappings().getPersistenceUnitMetadata().setPersistenceUnitDefaults(persistenceUnitDefaults);
- persistenceUnitDefaults.setAccess(org.eclipse.jpt.core.resource.orm.AccessType.PROPERTY);
- assertEquals(AccessType.PROPERTY, getEntityMappings().getDefaultAccess());
- assertNull(getEntityMappings().getSpecifiedAccess());
- assertNull(getXmlEntityMappings().getAccess());
-
- persistenceUnitDefaults.setAccess(org.eclipse.jpt.core.resource.orm.AccessType.FIELD);
- assertEquals(AccessType.FIELD, getEntityMappings().getDefaultAccess());
- assertNull(getEntityMappings().getSpecifiedAccess());
- assertNull(getXmlEntityMappings().getAccess());
-
- persistenceUnitDefaults.setAccess(null);
- assertNull(getEntityMappings().getDefaultAccess());
- assertNull(getEntityMappings().getSpecifiedAccess());
- assertNull(getXmlEntityMappings().getAccess());
- }
-
- public void testUpdateAccess() throws Exception {
- assertNull(getEntityMappings().getAccess());
- assertNull(getEntityMappings().getDefaultAccess());
- assertNull(getEntityMappings().getSpecifiedAccess());
- assertNull(getXmlEntityMappings().getAccess());
-
- getXmlEntityMappings().setAccess(org.eclipse.jpt.core.resource.orm.AccessType.FIELD);
- assertNull(getEntityMappings().getDefaultAccess());
- assertEquals(AccessType.FIELD, getEntityMappings().getAccess());
- assertEquals(AccessType.FIELD, getEntityMappings().getSpecifiedAccess());
- assertEquals(org.eclipse.jpt.core.resource.orm.AccessType.FIELD, getXmlEntityMappings().getAccess());
-
- getXmlEntityMappings().setAccess(null);
- assertNull(getEntityMappings().getAccess());
- assertNull(getEntityMappings().getDefaultAccess());
- assertNull(getEntityMappings().getSpecifiedAccess());
- assertNull(getXmlEntityMappings().getAccess());
-
- getEntityMappings().getPersistenceUnitMetadata().getPersistenceUnitDefaults().setAccess(AccessType.FIELD);
- assertEquals(AccessType.FIELD, getEntityMappings().getDefaultAccess());
- assertEquals(AccessType.FIELD, getEntityMappings().getAccess());
- assertNull(getEntityMappings().getSpecifiedAccess());
- assertNull(getXmlEntityMappings().getAccess());
-
- getEntityMappings().getPersistenceUnitMetadata().getPersistenceUnitDefaults().setAccess(null);
- assertNull(getEntityMappings().getDefaultAccess());
- assertNull(getEntityMappings().getAccess());
- assertNull(getEntityMappings().getSpecifiedAccess());
- assertNull(getXmlEntityMappings().getAccess());
- }
-
-
- public void testUpdateOrmPersistentTypes() throws Exception {
- assertFalse(getEntityMappings().persistentTypes().hasNext());
- assertTrue(getXmlEntityMappings().getMappedSuperclasses().isEmpty());
- assertTrue(getXmlEntityMappings().getEntities().isEmpty());
- assertTrue(getXmlEntityMappings().getEmbeddables().isEmpty());
-
- //add embeddable in the resource model, verify context model updated
- XmlEmbeddable embeddable = OrmFactory.eINSTANCE.createXmlEmbeddable();
- getXmlEntityMappings().getEmbeddables().add(embeddable);
- embeddable.setClassName("model.Foo");
- assertTrue(getEntityMappings().persistentTypes().hasNext());
- assertEquals("model.Foo", getEntityMappings().persistentTypes().next().getMapping().getClass_());
- assertTrue(getXmlEntityMappings().getMappedSuperclasses().isEmpty());
- assertTrue(getXmlEntityMappings().getEntities().isEmpty());
- assertFalse(getXmlEntityMappings().getEmbeddables().isEmpty());
- assertEquals("model.Foo", getXmlEntityMappings().getEmbeddables().get(0).getClassName());
-
- //add entity in the resource model, verify context model updated
- XmlEntity entity = OrmFactory.eINSTANCE.createXmlEntity();
- getXmlEntityMappings().getEntities().add(entity);
- entity.setClassName("model.Foo2");
- assertTrue(getEntityMappings().persistentTypes().hasNext());
- assertEquals("model.Foo2", getEntityMappings().persistentTypes().next().getMapping().getClass_());
- assertTrue(getXmlEntityMappings().getMappedSuperclasses().isEmpty());
- assertFalse(getXmlEntityMappings().getEntities().isEmpty());
- assertFalse(getXmlEntityMappings().getEmbeddables().isEmpty());
- assertEquals("model.Foo2", getXmlEntityMappings().getEntities().get(0).getClassName());
-
- //add mapped-superclass in the resource model, verify context model updated
- XmlMappedSuperclass mappedSuperclass = OrmFactory.eINSTANCE.createXmlMappedSuperclass();
- getXmlEntityMappings().getMappedSuperclasses().add(mappedSuperclass);
- mappedSuperclass.setClassName("model.Foo3");
- assertTrue(getEntityMappings().persistentTypes().hasNext());
- assertEquals("model.Foo3", getEntityMappings().persistentTypes().next().getMapping().getClass_());
- assertFalse(getXmlEntityMappings().getMappedSuperclasses().isEmpty());
- assertFalse(getXmlEntityMappings().getEntities().isEmpty());
- assertFalse(getXmlEntityMappings().getEmbeddables().isEmpty());
- assertEquals("model.Foo3", getXmlEntityMappings().getMappedSuperclasses().get(0).getClassName());
- }
-
-
- public void testAddOrmPersistentType() throws Exception {
- assertFalse(getEntityMappings().persistentTypes().hasNext());
- assertTrue(getXmlEntityMappings().getMappedSuperclasses().isEmpty());
- assertTrue(getXmlEntityMappings().getEntities().isEmpty());
- assertTrue(getXmlEntityMappings().getEmbeddables().isEmpty());
-
- //add embeddable in the context model, verify resource model modified
- getEntityMappings().addPersistentType(MappingKeys.EMBEDDABLE_TYPE_MAPPING_KEY, "model.Foo");
- assertTrue(getEntityMappings().persistentTypes().hasNext());
- assertEquals("model.Foo", getEntityMappings().persistentTypes().next().getMapping().getClass_());
- assertEquals(MappingKeys.EMBEDDABLE_TYPE_MAPPING_KEY, getEntityMappings().persistentTypes().next().getMapping().getKey());
- assertTrue(getXmlEntityMappings().getMappedSuperclasses().isEmpty());
- assertTrue(getXmlEntityMappings().getEntities().isEmpty());
- assertFalse(getXmlEntityMappings().getEmbeddables().isEmpty());
- assertEquals("model.Foo", getXmlEntityMappings().getEmbeddables().get(0).getClassName());
-
- //add entity in the context model, verify resource model modified
- getEntityMappings().addPersistentType(MappingKeys.ENTITY_TYPE_MAPPING_KEY, "model.Foo2");
- assertTrue(getEntityMappings().persistentTypes().hasNext());
- assertEquals("model.Foo2", getEntityMappings().persistentTypes().next().getMapping().getClass_());
- assertEquals(MappingKeys.ENTITY_TYPE_MAPPING_KEY, getEntityMappings().persistentTypes().next().getMapping().getKey());
- assertTrue(getXmlEntityMappings().getMappedSuperclasses().isEmpty());
- assertFalse(getXmlEntityMappings().getEntities().isEmpty());
- assertFalse(getXmlEntityMappings().getEmbeddables().isEmpty());
- assertEquals("model.Foo2", getXmlEntityMappings().getEntities().get(0).getClassName());
-
- //add mapped-superclass in the context model, verify resource model modified
- getEntityMappings().addPersistentType(MappingKeys.MAPPED_SUPERCLASS_TYPE_MAPPING_KEY, "model.Foo3");
- assertTrue(getEntityMappings().persistentTypes().hasNext());
- assertEquals("model.Foo3", getEntityMappings().persistentTypes().next().getMapping().getClass_());
- assertEquals(MappingKeys.MAPPED_SUPERCLASS_TYPE_MAPPING_KEY, getEntityMappings().persistentTypes().next().getMapping().getKey());
- assertFalse(getXmlEntityMappings().getMappedSuperclasses().isEmpty());
- assertFalse(getXmlEntityMappings().getEntities().isEmpty());
- assertFalse(getXmlEntityMappings().getEmbeddables().isEmpty());
- assertEquals("model.Foo3", getXmlEntityMappings().getMappedSuperclasses().get(0).getClassName());
- }
-
- public void testRemoveOrmPersistentType() throws Exception {
- assertFalse(getEntityMappings().persistentTypes().hasNext());
- assertTrue(getXmlEntityMappings().getMappedSuperclasses().isEmpty());
- assertTrue(getXmlEntityMappings().getEntities().isEmpty());
- assertTrue(getXmlEntityMappings().getEmbeddables().isEmpty());
-
- getEntityMappings().addPersistentType(MappingKeys.EMBEDDABLE_TYPE_MAPPING_KEY, "model.Foo");
- getEntityMappings().addPersistentType(MappingKeys.ENTITY_TYPE_MAPPING_KEY, "model.Foo2");
- getEntityMappings().addPersistentType(MappingKeys.MAPPED_SUPERCLASS_TYPE_MAPPING_KEY, "model.Foo3");
-
- //remove ormPersistentType from the context model, verify resource model modified
- getEntityMappings().removePersistentType(1);
- assertFalse(getXmlEntityMappings().getMappedSuperclasses().isEmpty());
- assertTrue(getXmlEntityMappings().getEntities().isEmpty());
- assertFalse(getXmlEntityMappings().getEmbeddables().isEmpty());
-
- getEntityMappings().removePersistentType(1);
- assertFalse(getXmlEntityMappings().getMappedSuperclasses().isEmpty());
- assertTrue(getXmlEntityMappings().getEntities().isEmpty());
- assertTrue(getXmlEntityMappings().getEmbeddables().isEmpty());
-
- getEntityMappings().removePersistentType(0);
- assertTrue(getXmlEntityMappings().getMappedSuperclasses().isEmpty());
- assertTrue(getXmlEntityMappings().getEntities().isEmpty());
- assertTrue(getXmlEntityMappings().getEmbeddables().isEmpty());
- }
-
- public void testUpdateTableGenerators() throws Exception {
- assertEquals(0, getEntityMappings().tableGeneratorsSize());
- assertEquals(0, getXmlEntityMappings().getTableGenerators().size());
- assertEquals(0, getEntityMappings().getPersistenceUnit().generatorsSize());
-
- XmlTableGenerator tableGeneratorResource = OrmFactory.eINSTANCE.createXmlTableGenerator();
- getXmlEntityMappings().getTableGenerators().add(tableGeneratorResource);
- tableGeneratorResource.setName("FOO");
-
- TableGenerator tableGenerator = getEntityMappings().tableGenerators().next();
- assertEquals("FOO", tableGenerator.getName());
- assertEquals(1, getEntityMappings().getPersistenceUnit().generatorsSize());
-
- XmlTableGenerator tableGeneratorResource2 = OrmFactory.eINSTANCE.createXmlTableGenerator();
- getXmlEntityMappings().getTableGenerators().add(0, tableGeneratorResource2);
- tableGeneratorResource2.setName("BAR");
-
- ListIterator<OrmTableGenerator> tableGenerators = getEntityMappings().tableGenerators();
- assertEquals("BAR", tableGenerators.next().getName());
- assertEquals("FOO", tableGenerators.next().getName());
- assertFalse(tableGenerators.hasNext());
- assertEquals(2, getEntityMappings().getPersistenceUnit().generatorsSize());
-
- XmlTableGenerator tableGeneratorResource3 = OrmFactory.eINSTANCE.createXmlTableGenerator();
- getXmlEntityMappings().getTableGenerators().add(1, tableGeneratorResource3);
- tableGeneratorResource3.setName("BAZ");
-
- tableGenerators = getEntityMappings().tableGenerators();
- assertEquals("BAR", tableGenerators.next().getName());
- assertEquals("BAZ", tableGenerators.next().getName());
- assertEquals("FOO", tableGenerators.next().getName());
- assertFalse(tableGenerators.hasNext());
- assertEquals(3, getEntityMappings().getPersistenceUnit().generatorsSize());
-
- getXmlEntityMappings().getTableGenerators().move(2, 0);
- tableGenerators = getEntityMappings().tableGenerators();
- assertEquals("BAZ", tableGenerators.next().getName());
- assertEquals("FOO", tableGenerators.next().getName());
- assertEquals("BAR", tableGenerators.next().getName());
- assertFalse(tableGenerators.hasNext());
- assertEquals(3, getEntityMappings().getPersistenceUnit().generatorsSize());
-
- getXmlEntityMappings().getTableGenerators().remove(0);
- tableGenerators = getEntityMappings().tableGenerators();
- assertEquals("FOO", tableGenerators.next().getName());
- assertEquals("BAR", tableGenerators.next().getName());
- assertFalse(tableGenerators.hasNext());
- assertEquals(2, getEntityMappings().getPersistenceUnit().generatorsSize());
-
- getXmlEntityMappings().getTableGenerators().remove(1);
- tableGenerators = getEntityMappings().tableGenerators();
- assertEquals("FOO", tableGenerators.next().getName());
- assertFalse(tableGenerators.hasNext());
- assertEquals(1, getEntityMappings().getPersistenceUnit().generatorsSize());
-
- getXmlEntityMappings().getTableGenerators().clear();
- tableGenerators = getEntityMappings().tableGenerators();
- assertFalse(tableGenerators.hasNext());
- assertEquals(0, getEntityMappings().getPersistenceUnit().generatorsSize());
- }
-
- public void testAddTableGenerator() throws Exception {
- assertEquals(0, getEntityMappings().tableGeneratorsSize());
- assertEquals(0, getXmlEntityMappings().getTableGenerators().size());
- getEntityMappings().addTableGenerator(0).setName("FOO");
-
- assertEquals("FOO", getXmlEntityMappings().getTableGenerators().get(0).getName());
-
- getEntityMappings().addTableGenerator(0).setName("BAR");
- assertEquals("BAR", getXmlEntityMappings().getTableGenerators().get(0).getName());
- assertEquals("FOO", getXmlEntityMappings().getTableGenerators().get(1).getName());
- assertEquals(2, getXmlEntityMappings().getTableGenerators().size());
-
- ListIterator<OrmTableGenerator> tableGenerators = getEntityMappings().tableGenerators();
- assertEquals("BAR", tableGenerators.next().getName());
- assertEquals("FOO", tableGenerators.next().getName());
- assertFalse(tableGenerators.hasNext());
- }
-
- public void testRemoveTableGenerator() throws Exception {
- assertEquals(0, getEntityMappings().tableGeneratorsSize());
- assertEquals(0, getXmlEntityMappings().getTableGenerators().size());
-
- TableGenerator tableGenerator = getEntityMappings().addTableGenerator(0);
- tableGenerator.setName("FOO");
- TableGenerator tableGenerator2 = getEntityMappings().addTableGenerator(1);
- tableGenerator2.setName("BAR");
- TableGenerator tableGenerator3 = getEntityMappings().addTableGenerator(2);
- tableGenerator3.setName("BAZ");
- assertEquals("FOO", getXmlEntityMappings().getTableGenerators().get(0).getName());
- assertEquals("BAR", getXmlEntityMappings().getTableGenerators().get(1).getName());
- assertEquals("BAZ", getXmlEntityMappings().getTableGenerators().get(2).getName());
- assertEquals(3, getXmlEntityMappings().getTableGenerators().size());
-
- getEntityMappings().removeTableGenerator(0);
- assertEquals("BAR", getXmlEntityMappings().getTableGenerators().get(0).getName());
- assertEquals("BAZ", getXmlEntityMappings().getTableGenerators().get(1).getName());
-
- ListIterator<OrmTableGenerator> tableGenerators = getEntityMappings().tableGenerators();
- OrmTableGenerator xmlTableGenerator = tableGenerators.next();
- assertEquals("BAR", xmlTableGenerator.getName());
- assertEquals(tableGenerator2, xmlTableGenerator);
- xmlTableGenerator = tableGenerators.next();
- assertEquals("BAZ", xmlTableGenerator.getName());
- assertEquals(tableGenerator3, xmlTableGenerator);
- assertFalse(tableGenerators.hasNext());
-
-
- getEntityMappings().removeTableGenerator(1);
- assertEquals("BAR", getXmlEntityMappings().getTableGenerators().get(0).getName());
- tableGenerators = getEntityMappings().tableGenerators();
- xmlTableGenerator = tableGenerators.next();
- assertEquals("BAR", xmlTableGenerator.getName());
- assertEquals(tableGenerator2, xmlTableGenerator);
- assertFalse(tableGenerators.hasNext());
-
-
- getEntityMappings().removeTableGenerator(0);
- assertEquals(0, getXmlEntityMappings().getTableGenerators().size());
- tableGenerators = getEntityMappings().tableGenerators();
- assertFalse(tableGenerators.hasNext());
- }
-
- public void testMoveTableGenerator() throws Exception {
- assertEquals(0, getEntityMappings().tableGeneratorsSize());
- assertEquals(0, getXmlEntityMappings().getTableGenerators().size());
-
- TableGenerator tableGenerator = getEntityMappings().addTableGenerator(0);
- tableGenerator.setName("FOO");
- TableGenerator tableGenerator2 = getEntityMappings().addTableGenerator(1);
- tableGenerator2.setName("BAR");
- TableGenerator tableGenerator3 = getEntityMappings().addTableGenerator(2);
- tableGenerator3.setName("BAZ");
- assertEquals("FOO", getXmlEntityMappings().getTableGenerators().get(0).getName());
- assertEquals("BAR", getXmlEntityMappings().getTableGenerators().get(1).getName());
- assertEquals("BAZ", getXmlEntityMappings().getTableGenerators().get(2).getName());
- assertEquals(3, getXmlEntityMappings().getTableGenerators().size());
-
- getEntityMappings().moveTableGenerator(2, 0);
- assertEquals("BAR", getXmlEntityMappings().getTableGenerators().get(0).getName());
- assertEquals("BAZ", getXmlEntityMappings().getTableGenerators().get(1).getName());
- assertEquals("FOO", getXmlEntityMappings().getTableGenerators().get(2).getName());
- assertEquals(3, getXmlEntityMappings().getTableGenerators().size());
-
- getEntityMappings().moveTableGenerator(0, 2);
- assertEquals("FOO", getXmlEntityMappings().getTableGenerators().get(0).getName());
- assertEquals("BAR", getXmlEntityMappings().getTableGenerators().get(1).getName());
- assertEquals("BAZ", getXmlEntityMappings().getTableGenerators().get(2).getName());
- assertEquals(3, getXmlEntityMappings().getTableGenerators().size());
- }
-
- public void testTableGeneratorsSize() throws Exception {
- assertEquals(0, getEntityMappings().tableGeneratorsSize());
- assertEquals(0, getXmlEntityMappings().getTableGenerators().size());
-
-
- TableGenerator tableGenerator = getEntityMappings().addTableGenerator(0);
- tableGenerator.setName("FOO");
- TableGenerator tableGenerator2 = getEntityMappings().addTableGenerator(1);
- tableGenerator2.setName("BAR");
- TableGenerator tableGenerator3 = getEntityMappings().addTableGenerator(2);
- tableGenerator3.setName("BAZ");
-
- assertEquals(3, getEntityMappings().tableGeneratorsSize());
-
- getXmlEntityMappings().getTableGenerators().remove(0);
- assertEquals(2, getEntityMappings().tableGeneratorsSize());
- }
-
- public void testUpdateSequenceGenerators() throws Exception {
- assertEquals(0, getEntityMappings().sequenceGeneratorsSize());
- assertEquals(0, getXmlEntityMappings().getSequenceGenerators().size());
- assertEquals(0, getEntityMappings().getPersistenceUnit().generatorsSize());
-
- XmlSequenceGenerator sequenceGeneratorResource = OrmFactory.eINSTANCE.createXmlSequenceGenerator();
- getXmlEntityMappings().getSequenceGenerators().add(sequenceGeneratorResource);
- sequenceGeneratorResource.setName("FOO");
-
- SequenceGenerator sequenceGenerator = getEntityMappings().sequenceGenerators().next();
- assertEquals("FOO", sequenceGenerator.getName());
- assertEquals(1, getEntityMappings().getPersistenceUnit().generatorsSize());
-
- XmlSequenceGenerator sequenceGeneratorResource2 = OrmFactory.eINSTANCE.createXmlSequenceGenerator();
- getXmlEntityMappings().getSequenceGenerators().add(0, sequenceGeneratorResource2);
- sequenceGeneratorResource2.setName("BAR");
-
- ListIterator<OrmSequenceGenerator> sequenceGenerators = getEntityMappings().sequenceGenerators();
- assertEquals("BAR", sequenceGenerators.next().getName());
- assertEquals("FOO", sequenceGenerators.next().getName());
- assertFalse(sequenceGenerators.hasNext());
- assertEquals(2, getEntityMappings().getPersistenceUnit().generatorsSize());
-
- XmlSequenceGenerator sequenceGeneratorResource3 = OrmFactory.eINSTANCE.createXmlSequenceGenerator();
- getXmlEntityMappings().getSequenceGenerators().add(1, sequenceGeneratorResource3);
- sequenceGeneratorResource3.setName("BAZ");
-
- sequenceGenerators = getEntityMappings().sequenceGenerators();
- assertEquals("BAR", sequenceGenerators.next().getName());
- assertEquals("BAZ", sequenceGenerators.next().getName());
- assertEquals("FOO", sequenceGenerators.next().getName());
- assertFalse(sequenceGenerators.hasNext());
- assertEquals(3, getEntityMappings().getPersistenceUnit().generatorsSize());
-
- getXmlEntityMappings().getSequenceGenerators().move(2, 0);
- sequenceGenerators = getEntityMappings().sequenceGenerators();
- assertEquals("BAZ", sequenceGenerators.next().getName());
- assertEquals("FOO", sequenceGenerators.next().getName());
- assertEquals("BAR", sequenceGenerators.next().getName());
- assertFalse(sequenceGenerators.hasNext());
-
- getXmlEntityMappings().getSequenceGenerators().remove(0);
- sequenceGenerators = getEntityMappings().sequenceGenerators();
- assertEquals("FOO", sequenceGenerators.next().getName());
- assertEquals("BAR", sequenceGenerators.next().getName());
- assertFalse(sequenceGenerators.hasNext());
- assertEquals(2, getEntityMappings().getPersistenceUnit().generatorsSize());
-
- getXmlEntityMappings().getSequenceGenerators().remove(1);
- sequenceGenerators = getEntityMappings().sequenceGenerators();
- assertEquals("FOO", sequenceGenerators.next().getName());
- assertFalse(sequenceGenerators.hasNext());
- assertEquals(1, getEntityMappings().getPersistenceUnit().generatorsSize());
-
- getXmlEntityMappings().getSequenceGenerators().clear();
- sequenceGenerators = getEntityMappings().sequenceGenerators();
- assertFalse(sequenceGenerators.hasNext());
- assertEquals(0, getEntityMappings().getPersistenceUnit().generatorsSize());
- }
-
- public void testAddSequenceGenerator() throws Exception {
- assertEquals(0, getEntityMappings().sequenceGeneratorsSize());
- assertEquals(0, getXmlEntityMappings().getSequenceGenerators().size());
-
- getEntityMappings().addSequenceGenerator(0).setName("FOO");
-
- assertEquals("FOO", getXmlEntityMappings().getSequenceGenerators().get(0).getName());
-
- getEntityMappings().addSequenceGenerator(0).setName("BAR");
- assertEquals("BAR", getXmlEntityMappings().getSequenceGenerators().get(0).getName());
- assertEquals("FOO", getXmlEntityMappings().getSequenceGenerators().get(1).getName());
- assertEquals(2, getXmlEntityMappings().getSequenceGenerators().size());
-
- ListIterator<OrmSequenceGenerator> sequenceGenerators = getEntityMappings().sequenceGenerators();
- assertEquals("BAR", sequenceGenerators.next().getName());
- assertEquals("FOO", sequenceGenerators.next().getName());
- assertFalse(sequenceGenerators.hasNext());
- }
-
- public void testRemoveSequenceGenerator() throws Exception {
- assertEquals(0, getEntityMappings().sequenceGeneratorsSize());
- assertEquals(0, getXmlEntityMappings().getSequenceGenerators().size());
-
- SequenceGenerator sequenceGenerator = getEntityMappings().addSequenceGenerator(0);
- sequenceGenerator.setName("FOO");
- SequenceGenerator sequenceGenerator2 = getEntityMappings().addSequenceGenerator(1);
- sequenceGenerator2.setName("BAR");
- SequenceGenerator sequenceGenerator3 = getEntityMappings().addSequenceGenerator(2);
- sequenceGenerator3.setName("BAZ");
- assertEquals("FOO", getXmlEntityMappings().getSequenceGenerators().get(0).getName());
- assertEquals("BAR", getXmlEntityMappings().getSequenceGenerators().get(1).getName());
- assertEquals("BAZ", getXmlEntityMappings().getSequenceGenerators().get(2).getName());
- assertEquals(3, getXmlEntityMappings().getSequenceGenerators().size());
-
- getEntityMappings().removeSequenceGenerator(0);
- assertEquals("BAR", getXmlEntityMappings().getSequenceGenerators().get(0).getName());
- assertEquals("BAZ", getXmlEntityMappings().getSequenceGenerators().get(1).getName());
-
- ListIterator<OrmSequenceGenerator> sequenceGenerators = getEntityMappings().sequenceGenerators();
- SequenceGenerator xmlSequenceGenerator = sequenceGenerators.next();
- assertEquals("BAR", xmlSequenceGenerator.getName());
- assertEquals(sequenceGenerator2, xmlSequenceGenerator);
- xmlSequenceGenerator = sequenceGenerators.next();
- assertEquals("BAZ", xmlSequenceGenerator.getName());
- assertEquals(sequenceGenerator3, xmlSequenceGenerator);
- assertFalse(sequenceGenerators.hasNext());
-
-
- getEntityMappings().removeSequenceGenerator(1);
- assertEquals("BAR", getXmlEntityMappings().getSequenceGenerators().get(0).getName());
- sequenceGenerators = getEntityMappings().sequenceGenerators();
- xmlSequenceGenerator = sequenceGenerators.next();
- assertEquals("BAR", xmlSequenceGenerator.getName());
- assertEquals(sequenceGenerator2, xmlSequenceGenerator);
- assertFalse(sequenceGenerators.hasNext());
-
-
- getEntityMappings().removeSequenceGenerator(0);
- assertEquals(0, getXmlEntityMappings().getSequenceGenerators().size());
- sequenceGenerators = getEntityMappings().sequenceGenerators();
- assertFalse(sequenceGenerators.hasNext());
- }
-
- public void testMoveSequenceGenerator() throws Exception {
- assertEquals(0, getEntityMappings().sequenceGeneratorsSize());
- assertEquals(0, getXmlEntityMappings().getSequenceGenerators().size());
-
- SequenceGenerator sequenceGenerator = getEntityMappings().addSequenceGenerator(0);
- sequenceGenerator.setName("FOO");
- SequenceGenerator sequenceGenerator2 = getEntityMappings().addSequenceGenerator(1);
- sequenceGenerator2.setName("BAR");
- SequenceGenerator sequenceGenerator3 = getEntityMappings().addSequenceGenerator(2);
- sequenceGenerator3.setName("BAZ");
- assertEquals("FOO", getXmlEntityMappings().getSequenceGenerators().get(0).getName());
- assertEquals("BAR", getXmlEntityMappings().getSequenceGenerators().get(1).getName());
- assertEquals("BAZ", getXmlEntityMappings().getSequenceGenerators().get(2).getName());
- assertEquals(3, getXmlEntityMappings().getSequenceGenerators().size());
-
- getEntityMappings().moveSequenceGenerator(2, 0);
- assertEquals("BAR", getXmlEntityMappings().getSequenceGenerators().get(0).getName());
- assertEquals("BAZ", getXmlEntityMappings().getSequenceGenerators().get(1).getName());
- assertEquals("FOO", getXmlEntityMappings().getSequenceGenerators().get(2).getName());
- assertEquals(3, getXmlEntityMappings().getSequenceGenerators().size());
-
- getEntityMappings().moveSequenceGenerator(0, 2);
- assertEquals("FOO", getXmlEntityMappings().getSequenceGenerators().get(0).getName());
- assertEquals("BAR", getXmlEntityMappings().getSequenceGenerators().get(1).getName());
- assertEquals("BAZ", getXmlEntityMappings().getSequenceGenerators().get(2).getName());
- assertEquals(3, getXmlEntityMappings().getSequenceGenerators().size());
-
- }
-
- public void testSequenceGeneratorsSize() throws Exception {
- assertEquals(0, getEntityMappings().sequenceGeneratorsSize());
- assertEquals(0, getXmlEntityMappings().getSequenceGenerators().size());
-
-
- SequenceGenerator sequenceGenerator = getEntityMappings().addSequenceGenerator(0);
- sequenceGenerator.setName("FOO");
- SequenceGenerator sequenceGenerator2 = getEntityMappings().addSequenceGenerator(1);
- sequenceGenerator2.setName("BAR");
- SequenceGenerator sequenceGenerator3 = getEntityMappings().addSequenceGenerator(2);
- sequenceGenerator3.setName("BAZ");
-
- assertEquals(3, getEntityMappings().sequenceGeneratorsSize());
-
- getXmlEntityMappings().getSequenceGenerators().remove(0);
- assertEquals(2, getEntityMappings().sequenceGeneratorsSize());
- }
-
-
- public void testAddNamedQuery() throws Exception {
- OrmNamedQuery namedQuery = getEntityMappings().getQueryContainer().addNamedQuery(0);
- namedQuery.setName("FOO");
-
- assertEquals("FOO", getXmlEntityMappings().getNamedQueries().get(0).getName());
-
- OrmNamedQuery namedQuery2 = getEntityMappings().getQueryContainer().addNamedQuery(0);
- namedQuery2.setName("BAR");
-
- assertEquals("BAR", getXmlEntityMappings().getNamedQueries().get(0).getName());
- assertEquals("FOO", getXmlEntityMappings().getNamedQueries().get(1).getName());
-
- OrmNamedQuery namedQuery3 = getEntityMappings().getQueryContainer().addNamedQuery(1);
- namedQuery3.setName("BAZ");
-
- assertEquals("BAR", getXmlEntityMappings().getNamedQueries().get(0).getName());
- assertEquals("BAZ", getXmlEntityMappings().getNamedQueries().get(1).getName());
- assertEquals("FOO", getXmlEntityMappings().getNamedQueries().get(2).getName());
-
- ListIterator<OrmNamedQuery> namedQueries = getEntityMappings().getQueryContainer().namedQueries();
- assertEquals(namedQuery2, namedQueries.next());
- assertEquals(namedQuery3, namedQueries.next());
- assertEquals(namedQuery, namedQueries.next());
-
- namedQueries = getEntityMappings().getQueryContainer().namedQueries();
- assertEquals("BAR", namedQueries.next().getName());
- assertEquals("BAZ", namedQueries.next().getName());
- assertEquals("FOO", namedQueries.next().getName());
- }
-
- public void testRemoveNamedQuery() throws Exception {
- getEntityMappings().getQueryContainer().addNamedQuery(0).setName("FOO");
- getEntityMappings().getQueryContainer().addNamedQuery(1).setName("BAR");
- getEntityMappings().getQueryContainer().addNamedQuery(2).setName("BAZ");
-
- assertEquals(3, getXmlEntityMappings().getNamedQueries().size());
-
- getEntityMappings().getQueryContainer().removeNamedQuery(0);
- assertEquals(2, getXmlEntityMappings().getNamedQueries().size());
- assertEquals("BAR", getXmlEntityMappings().getNamedQueries().get(0).getName());
- assertEquals("BAZ", getXmlEntityMappings().getNamedQueries().get(1).getName());
-
- getEntityMappings().getQueryContainer().removeNamedQuery(0);
- assertEquals(1, getXmlEntityMappings().getNamedQueries().size());
- assertEquals("BAZ", getXmlEntityMappings().getNamedQueries().get(0).getName());
-
- getEntityMappings().getQueryContainer().removeNamedQuery(0);
- assertEquals(0, getXmlEntityMappings().getNamedQueries().size());
- }
-
- public void testMoveNamedQuery() throws Exception {
- getEntityMappings().getQueryContainer().addNamedQuery(0).setName("FOO");
- getEntityMappings().getQueryContainer().addNamedQuery(1).setName("BAR");
- getEntityMappings().getQueryContainer().addNamedQuery(2).setName("BAZ");
-
- assertEquals(3, getXmlEntityMappings().getNamedQueries().size());
-
-
- getEntityMappings().getQueryContainer().moveNamedQuery(2, 0);
- ListIterator<OrmNamedQuery> namedQueries = getEntityMappings().getQueryContainer().namedQueries();
- assertEquals("BAR", namedQueries.next().getName());
- assertEquals("BAZ", namedQueries.next().getName());
- assertEquals("FOO", namedQueries.next().getName());
-
- assertEquals("BAR", getXmlEntityMappings().getNamedQueries().get(0).getName());
- assertEquals("BAZ", getXmlEntityMappings().getNamedQueries().get(1).getName());
- assertEquals("FOO", getXmlEntityMappings().getNamedQueries().get(2).getName());
-
-
- getEntityMappings().getQueryContainer().moveNamedQuery(0, 1);
- namedQueries = getEntityMappings().getQueryContainer().namedQueries();
- assertEquals("BAZ", namedQueries.next().getName());
- assertEquals("BAR", namedQueries.next().getName());
- assertEquals("FOO", namedQueries.next().getName());
-
- assertEquals("BAZ", getXmlEntityMappings().getNamedQueries().get(0).getName());
- assertEquals("BAR", getXmlEntityMappings().getNamedQueries().get(1).getName());
- assertEquals("FOO", getXmlEntityMappings().getNamedQueries().get(2).getName());
- }
-
- public void testUpdateNamedQueries() throws Exception {
- assertEquals(0, getEntityMappings().getPersistenceUnit().queriesSize());
-
- getXmlEntityMappings().getNamedQueries().add(OrmFactory.eINSTANCE.createXmlNamedQuery());
- getXmlEntityMappings().getNamedQueries().add(OrmFactory.eINSTANCE.createXmlNamedQuery());
- getXmlEntityMappings().getNamedQueries().add(OrmFactory.eINSTANCE.createXmlNamedQuery());
-
- getXmlEntityMappings().getNamedQueries().get(0).setName("FOO");
- getXmlEntityMappings().getNamedQueries().get(1).setName("BAR");
- getXmlEntityMappings().getNamedQueries().get(2).setName("BAZ");
-
- ListIterator<OrmNamedQuery> namedQueries = getEntityMappings().getQueryContainer().namedQueries();
- assertEquals("FOO", namedQueries.next().getName());
- assertEquals("BAR", namedQueries.next().getName());
- assertEquals("BAZ", namedQueries.next().getName());
- assertFalse(namedQueries.hasNext());
- assertEquals(3, getEntityMappings().getPersistenceUnit().queriesSize());
-
- getXmlEntityMappings().getNamedQueries().move(2, 0);
- namedQueries = getEntityMappings().getQueryContainer().namedQueries();
- assertEquals("BAR", namedQueries.next().getName());
- assertEquals("BAZ", namedQueries.next().getName());
- assertEquals("FOO", namedQueries.next().getName());
- assertFalse(namedQueries.hasNext());
-
- getXmlEntityMappings().getNamedQueries().move(0, 1);
- namedQueries = getEntityMappings().getQueryContainer().namedQueries();
- assertEquals("BAZ", namedQueries.next().getName());
- assertEquals("BAR", namedQueries.next().getName());
- assertEquals("FOO", namedQueries.next().getName());
- assertFalse(namedQueries.hasNext());
-
- getXmlEntityMappings().getNamedQueries().remove(1);
- namedQueries = getEntityMappings().getQueryContainer().namedQueries();
- assertEquals("BAZ", namedQueries.next().getName());
- assertEquals("FOO", namedQueries.next().getName());
- assertFalse(namedQueries.hasNext());
- assertEquals(2, getEntityMappings().getPersistenceUnit().queriesSize());
-
- getXmlEntityMappings().getNamedQueries().remove(1);
- namedQueries = getEntityMappings().getQueryContainer().namedQueries();
- assertEquals("BAZ", namedQueries.next().getName());
- assertFalse(namedQueries.hasNext());
- assertEquals(1, getEntityMappings().getPersistenceUnit().queriesSize());
-
- getXmlEntityMappings().getNamedQueries().remove(0);
- assertFalse(getEntityMappings().getQueryContainer().namedQueries().hasNext());
- assertEquals(0, getEntityMappings().getPersistenceUnit().queriesSize());
- }
-
- public void testAddNamedNativeQuery() throws Exception {
- OrmNamedNativeQuery namedNativeQuery = getEntityMappings().getQueryContainer().addNamedNativeQuery(0);
- namedNativeQuery.setName("FOO");
-
- assertEquals("FOO", getXmlEntityMappings().getNamedNativeQueries().get(0).getName());
-
- OrmNamedNativeQuery namedNativeQuery2 = getEntityMappings().getQueryContainer().addNamedNativeQuery(0);
- namedNativeQuery2.setName("BAR");
-
- assertEquals("BAR", getXmlEntityMappings().getNamedNativeQueries().get(0).getName());
- assertEquals("FOO", getXmlEntityMappings().getNamedNativeQueries().get(1).getName());
-
- OrmNamedNativeQuery namedNativeQuery3 = getEntityMappings().getQueryContainer().addNamedNativeQuery(1);
- namedNativeQuery3.setName("BAZ");
-
- assertEquals("BAR", getXmlEntityMappings().getNamedNativeQueries().get(0).getName());
- assertEquals("BAZ", getXmlEntityMappings().getNamedNativeQueries().get(1).getName());
- assertEquals("FOO", getXmlEntityMappings().getNamedNativeQueries().get(2).getName());
-
- ListIterator<OrmNamedNativeQuery> namedNativeQueries = getEntityMappings().getQueryContainer().namedNativeQueries();
- assertEquals(namedNativeQuery2, namedNativeQueries.next());
- assertEquals(namedNativeQuery3, namedNativeQueries.next());
- assertEquals(namedNativeQuery, namedNativeQueries.next());
-
- namedNativeQueries = getEntityMappings().getQueryContainer().namedNativeQueries();
- assertEquals("BAR", namedNativeQueries.next().getName());
- assertEquals("BAZ", namedNativeQueries.next().getName());
- assertEquals("FOO", namedNativeQueries.next().getName());
- }
-
- public void testRemoveNamedNativeQuery() throws Exception {
- getEntityMappings().getQueryContainer().addNamedNativeQuery(0).setName("FOO");
- getEntityMappings().getQueryContainer().addNamedNativeQuery(1).setName("BAR");
- getEntityMappings().getQueryContainer().addNamedNativeQuery(2).setName("BAZ");
-
- assertEquals(3, getXmlEntityMappings().getNamedNativeQueries().size());
-
- getEntityMappings().getQueryContainer().removeNamedNativeQuery(0);
- assertEquals(2, getXmlEntityMappings().getNamedNativeQueries().size());
- assertEquals("BAR", getXmlEntityMappings().getNamedNativeQueries().get(0).getName());
- assertEquals("BAZ", getXmlEntityMappings().getNamedNativeQueries().get(1).getName());
-
- getEntityMappings().getQueryContainer().removeNamedNativeQuery(0);
- assertEquals(1, getXmlEntityMappings().getNamedNativeQueries().size());
- assertEquals("BAZ", getXmlEntityMappings().getNamedNativeQueries().get(0).getName());
-
- getEntityMappings().getQueryContainer().removeNamedNativeQuery(0);
- assertEquals(0, getXmlEntityMappings().getNamedNativeQueries().size());
- }
-
- public void testMoveNamedNativeQuery() throws Exception {
- getEntityMappings().getQueryContainer().addNamedNativeQuery(0).setName("FOO");
- getEntityMappings().getQueryContainer().addNamedNativeQuery(1).setName("BAR");
- getEntityMappings().getQueryContainer().addNamedNativeQuery(2).setName("BAZ");
-
- assertEquals(3, getXmlEntityMappings().getNamedNativeQueries().size());
-
-
- getEntityMappings().getQueryContainer().moveNamedNativeQuery(2, 0);
- ListIterator<OrmNamedNativeQuery> namedNativeQueries = getEntityMappings().getQueryContainer().namedNativeQueries();
- assertEquals("BAR", namedNativeQueries.next().getName());
- assertEquals("BAZ", namedNativeQueries.next().getName());
- assertEquals("FOO", namedNativeQueries.next().getName());
-
- assertEquals("BAR", getXmlEntityMappings().getNamedNativeQueries().get(0).getName());
- assertEquals("BAZ", getXmlEntityMappings().getNamedNativeQueries().get(1).getName());
- assertEquals("FOO", getXmlEntityMappings().getNamedNativeQueries().get(2).getName());
-
-
- getEntityMappings().getQueryContainer().moveNamedNativeQuery(0, 1);
- namedNativeQueries = getEntityMappings().getQueryContainer().namedNativeQueries();
- assertEquals("BAZ", namedNativeQueries.next().getName());
- assertEquals("BAR", namedNativeQueries.next().getName());
- assertEquals("FOO", namedNativeQueries.next().getName());
-
- assertEquals("BAZ", getXmlEntityMappings().getNamedNativeQueries().get(0).getName());
- assertEquals("BAR", getXmlEntityMappings().getNamedNativeQueries().get(1).getName());
- assertEquals("FOO", getXmlEntityMappings().getNamedNativeQueries().get(2).getName());
- }
-
- public void testUpdateNamedNativeQueries() throws Exception {
- assertEquals(0, getEntityMappings().getPersistenceUnit().queriesSize());
-
- getXmlEntityMappings().getNamedNativeQueries().add(OrmFactory.eINSTANCE.createXmlNamedNativeQuery());
- getXmlEntityMappings().getNamedNativeQueries().add(OrmFactory.eINSTANCE.createXmlNamedNativeQuery());
- getXmlEntityMappings().getNamedNativeQueries().add(OrmFactory.eINSTANCE.createXmlNamedNativeQuery());
-
- getXmlEntityMappings().getNamedNativeQueries().get(0).setName("FOO");
- getXmlEntityMappings().getNamedNativeQueries().get(1).setName("BAR");
- getXmlEntityMappings().getNamedNativeQueries().get(2).setName("BAZ");
-
- ListIterator<OrmNamedNativeQuery> namedNativeQueries = getEntityMappings().getQueryContainer().namedNativeQueries();
- assertEquals("FOO", namedNativeQueries.next().getName());
- assertEquals("BAR", namedNativeQueries.next().getName());
- assertEquals("BAZ", namedNativeQueries.next().getName());
- assertFalse(namedNativeQueries.hasNext());
- assertEquals(3, getEntityMappings().getPersistenceUnit().queriesSize());
-
- getXmlEntityMappings().getNamedNativeQueries().move(2, 0);
- namedNativeQueries = getEntityMappings().getQueryContainer().namedNativeQueries();
- assertEquals("BAR", namedNativeQueries.next().getName());
- assertEquals("BAZ", namedNativeQueries.next().getName());
- assertEquals("FOO", namedNativeQueries.next().getName());
- assertFalse(namedNativeQueries.hasNext());
-
- getXmlEntityMappings().getNamedNativeQueries().move(0, 1);
- namedNativeQueries = getEntityMappings().getQueryContainer().namedNativeQueries();
- assertEquals("BAZ", namedNativeQueries.next().getName());
- assertEquals("BAR", namedNativeQueries.next().getName());
- assertEquals("FOO", namedNativeQueries.next().getName());
- assertFalse(namedNativeQueries.hasNext());
-
- getXmlEntityMappings().getNamedNativeQueries().remove(1);
- namedNativeQueries = getEntityMappings().getQueryContainer().namedNativeQueries();
- assertEquals("BAZ", namedNativeQueries.next().getName());
- assertEquals("FOO", namedNativeQueries.next().getName());
- assertFalse(namedNativeQueries.hasNext());
- assertEquals(2, getEntityMappings().getPersistenceUnit().queriesSize());
-
- getXmlEntityMappings().getNamedNativeQueries().remove(1);
- namedNativeQueries = getEntityMappings().getQueryContainer().namedNativeQueries();
- assertEquals("BAZ", namedNativeQueries.next().getName());
- assertFalse(namedNativeQueries.hasNext());
- assertEquals(1, getEntityMappings().getPersistenceUnit().queriesSize());
-
- getXmlEntityMappings().getNamedNativeQueries().remove(0);
- assertFalse(getEntityMappings().getQueryContainer().namedNativeQueries().hasNext());
- assertEquals(0, getEntityMappings().getPersistenceUnit().queriesSize());
- }
-} \ No newline at end of file
diff --git a/jpa/tests/org.eclipse.jpt.core.tests/src/org/eclipse/jpt/core/tests/internal/context/orm/GenericOrmPersistentAttributeTests.java b/jpa/tests/org.eclipse.jpt.core.tests/src/org/eclipse/jpt/core/tests/internal/context/orm/GenericOrmPersistentAttributeTests.java
deleted file mode 100644
index 4c7fe74ff7..0000000000
--- a/jpa/tests/org.eclipse.jpt.core.tests/src/org/eclipse/jpt/core/tests/internal/context/orm/GenericOrmPersistentAttributeTests.java
+++ /dev/null
@@ -1,316 +0,0 @@
-/*******************************************************************************
- * Copyright (c) 2008, 2009 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.
- *
- * Contributors:
- * Oracle - initial API and implementation
- ******************************************************************************/
-package org.eclipse.jpt.core.tests.internal.context.orm;
-
-import java.util.Iterator;
-import java.util.ListIterator;
-import org.eclipse.jdt.core.ICompilationUnit;
-import org.eclipse.jpt.core.JptCorePlugin;
-import org.eclipse.jpt.core.MappingKeys;
-import org.eclipse.jpt.core.context.AccessType;
-import org.eclipse.jpt.core.context.BasicMapping;
-import org.eclipse.jpt.core.context.IdMapping;
-import org.eclipse.jpt.core.context.java.JavaPersistentAttribute;
-import org.eclipse.jpt.core.context.java.JavaPersistentType;
-import org.eclipse.jpt.core.context.orm.OrmPersistentAttribute;
-import org.eclipse.jpt.core.context.orm.OrmPersistentType;
-import org.eclipse.jpt.core.internal.context.orm.GenericOrmIdMapping;
-import org.eclipse.jpt.core.internal.context.orm.GenericOrmNullAttributeMapping;
-import org.eclipse.jpt.core.internal.context.orm.GenericOrmOneToOneMapping;
-import org.eclipse.jpt.core.resource.java.JPA;
-import org.eclipse.jpt.core.resource.java.JavaResourcePersistentAttribute;
-import org.eclipse.jpt.core.resource.persistence.PersistenceFactory;
-import org.eclipse.jpt.core.resource.persistence.XmlMappingFileRef;
-import org.eclipse.jpt.core.tests.internal.context.ContextModelTestCase;
-import org.eclipse.jpt.utility.internal.iterators.ArrayIterator;
-
-@SuppressWarnings("nls")
-public class GenericOrmPersistentAttributeTests extends ContextModelTestCase
-{
- public GenericOrmPersistentAttributeTests(String name) {
- super(name);
- }
-
- @Override
- protected void setUp() throws Exception {
- super.setUp();
- XmlMappingFileRef mappingFileRef = PersistenceFactory.eINSTANCE.createXmlMappingFileRef();
- mappingFileRef.setFileName(JptCorePlugin.DEFAULT_ORM_XML_FILE_PATH);
- getXmlPersistenceUnit().getMappingFiles().add(mappingFileRef);
- getPersistenceXmlResource().save(null);
- }
-
- private ICompilationUnit createTestTypeNullAttributeMapping() throws Exception {
-
- return this.createTestType(new DefaultAnnotationWriter() {
- @Override
- public void appendIdFieldAnnotationTo(StringBuilder sb) {
- sb.append(CR);
- sb.append(" private Address address;").append(CR);
- sb.append(CR);
- }
- });
- }
-
- private ICompilationUnit createTestEntityIdMapping() throws Exception {
- return this.createTestType(new DefaultAnnotationWriter() {
- @Override
- public Iterator<String> imports() {
- return new ArrayIterator<String>(JPA.ENTITY, JPA.ID, JPA.COLUMN);
- }
- @Override
- public void appendTypeAnnotationTo(StringBuilder sb) {
- sb.append("@Entity");
- }
- @Override
- public void appendIdFieldAnnotationTo(StringBuilder sb) {
- sb.append("@Id");
- sb.append("@Column(name=\"FOO\")");
- }
- });
- }
-
- private ICompilationUnit createTestEntityOneToOneMapping() throws Exception {
- return this.createTestType(new DefaultAnnotationWriter() {
- @Override
- public Iterator<String> imports() {
- return new ArrayIterator<String>(JPA.ENTITY, JPA.ONE_TO_ONE);
- }
- @Override
- public void appendTypeAnnotationTo(StringBuilder sb) {
- sb.append("@Entity");
- }
- @Override
- public void appendIdFieldAnnotationTo(StringBuilder sb) {
- sb.append("@OneToOne");
- sb.append(" private Address address;");
- }
- });
- }
-
- public void testMakeSpecified() throws Exception {
- createTestType();
- OrmPersistentType ormPersistentType = getEntityMappings().addPersistentType(MappingKeys.ENTITY_TYPE_MAPPING_KEY, FULLY_QUALIFIED_TYPE_NAME);
-
- assertEquals(2, ormPersistentType.virtualAttributesSize());
-
- OrmPersistentAttribute ormPersistentAttribute = ormPersistentType.virtualAttributes().next();
- assertEquals("id", ormPersistentAttribute.getName());
- assertTrue(ormPersistentAttribute.isVirtual());
- ormPersistentAttribute.makeSpecified();
-
- assertEquals(1, ormPersistentType.virtualAttributesSize());
- assertEquals(1, ormPersistentType.specifiedAttributesSize());
- OrmPersistentAttribute specifiedOrmPersistentAttribute = ormPersistentType.specifiedAttributes().next();
- assertEquals("id", specifiedOrmPersistentAttribute.getName());
- assertFalse(specifiedOrmPersistentAttribute.isVirtual());
-
- ormPersistentAttribute = ormPersistentType.virtualAttributes().next();
- ormPersistentAttribute.makeSpecified();
-
- assertEquals(0, ormPersistentType.virtualAttributesSize());
- assertEquals(2, ormPersistentType.specifiedAttributesSize());
- ListIterator<OrmPersistentAttribute> specifiedAttributes = ormPersistentType.specifiedAttributes();
- specifiedOrmPersistentAttribute = specifiedAttributes.next();
- assertEquals("id", specifiedOrmPersistentAttribute.getName());
- assertFalse(specifiedOrmPersistentAttribute.isVirtual());
-
- specifiedOrmPersistentAttribute = specifiedAttributes.next();
- assertEquals("name", specifiedOrmPersistentAttribute.getName());
- assertFalse(specifiedOrmPersistentAttribute.isVirtual());
- }
-
- public void testMakeSpecifiedMappingKey() throws Exception {
- createTestTypeNullAttributeMapping();
- OrmPersistentType ormPersistentType = getEntityMappings().addPersistentType(MappingKeys.ENTITY_TYPE_MAPPING_KEY, FULLY_QUALIFIED_TYPE_NAME);
-
- assertEquals(3, ormPersistentType.virtualAttributesSize());
-
- //take a virtual mapping with a mapping type and make it specified
- OrmPersistentAttribute ormPersistentAttribute = ormPersistentType.virtualAttributes().next();
- assertEquals("address", ormPersistentAttribute.getName());
- assertTrue(ormPersistentAttribute.isVirtual());
- assertTrue(ormPersistentAttribute.getMapping() instanceof GenericOrmNullAttributeMapping);
- ormPersistentAttribute.makeSpecified(MappingKeys.ONE_TO_ONE_ATTRIBUTE_MAPPING_KEY);
-
- assertEquals(2, ormPersistentType.virtualAttributesSize());
- assertEquals(1, ormPersistentType.specifiedAttributesSize());
- OrmPersistentAttribute specifiedOrmPersistentAttribute = ormPersistentType.specifiedAttributes().next();
- assertEquals("address", specifiedOrmPersistentAttribute.getName());
- assertFalse(specifiedOrmPersistentAttribute.isVirtual());
- assertTrue(specifiedOrmPersistentAttribute.getMapping() instanceof GenericOrmOneToOneMapping);
-
-
- ormPersistentAttribute = ormPersistentType.virtualAttributes().next();
- ormPersistentAttribute.makeSpecified(MappingKeys.ID_ATTRIBUTE_MAPPING_KEY);
-
- assertEquals(1, ormPersistentType.virtualAttributesSize());
- assertEquals(2, ormPersistentType.specifiedAttributesSize());
- ListIterator<OrmPersistentAttribute> specifiedAttributes = ormPersistentType.specifiedAttributes();
-
- specifiedOrmPersistentAttribute = specifiedAttributes.next();
- assertEquals("id", specifiedOrmPersistentAttribute.getName());
- assertFalse(specifiedOrmPersistentAttribute.isVirtual());
- assertTrue(specifiedOrmPersistentAttribute.getMapping() instanceof GenericOrmIdMapping);
-
- specifiedOrmPersistentAttribute = specifiedAttributes.next();
- assertEquals("address", specifiedOrmPersistentAttribute.getName());
- assertFalse(specifiedOrmPersistentAttribute.isVirtual());
- }
-
- public void testMakeVirtual() throws Exception {
- createTestType();
- OrmPersistentType ormPersistentType = getEntityMappings().addPersistentType(MappingKeys.ENTITY_TYPE_MAPPING_KEY, FULLY_QUALIFIED_TYPE_NAME);
-
- assertEquals(2, ormPersistentType.virtualAttributesSize());
-
- ormPersistentType.virtualAttributes().next().makeSpecified();
- ormPersistentType.virtualAttributes().next().makeSpecified();
-
- assertEquals(0, ormPersistentType.virtualAttributesSize());
- assertEquals(2, ormPersistentType.specifiedAttributesSize());
- OrmPersistentAttribute specifiedOrmPersistentAttribute = ormPersistentType.specifiedAttributes().next();
- assertEquals("id", specifiedOrmPersistentAttribute.getName());
- assertFalse(specifiedOrmPersistentAttribute.isVirtual());
-
- specifiedOrmPersistentAttribute.makeVirtual();
- assertEquals(1, ormPersistentType.virtualAttributesSize());
- assertEquals(1, ormPersistentType.specifiedAttributesSize());
-
- specifiedOrmPersistentAttribute = ormPersistentType.specifiedAttributes().next();
- specifiedOrmPersistentAttribute.makeVirtual();
- assertEquals(2, ormPersistentType.virtualAttributesSize());
- assertEquals(0, ormPersistentType.specifiedAttributesSize());
-
- ListIterator<OrmPersistentAttribute> virtualAttributes = ormPersistentType.virtualAttributes();
- OrmPersistentAttribute virtualAttribute = virtualAttributes.next();
- assertEquals("id", virtualAttribute.getName());
- virtualAttribute = virtualAttributes.next();
- assertEquals("name", virtualAttribute.getName());
- }
-
- public void testMakeVirtualNoUnderlyingJavaAttribute() throws Exception {
- createTestType();
- OrmPersistentType ormPersistentType = getEntityMappings().addPersistentType(MappingKeys.ENTITY_TYPE_MAPPING_KEY, FULLY_QUALIFIED_TYPE_NAME);
-
- assertEquals(2, ormPersistentType.virtualAttributesSize());
-
- ormPersistentType.virtualAttributes().next().makeSpecified();
- ormPersistentType.virtualAttributes().next().makeSpecified();
-
-
- ormPersistentType.specifiedAttributes().next().getMapping().setName("noJavaAttribute");
- assertEquals(1, ormPersistentType.virtualAttributesSize());
- assertEquals(2, ormPersistentType.specifiedAttributesSize());
-
-
- OrmPersistentAttribute specifiedOrmPersistentAttribute = ormPersistentType.specifiedAttributes().next();
- specifiedOrmPersistentAttribute.makeVirtual();
- assertEquals(1, ormPersistentType.virtualAttributesSize());
- assertEquals(1, ormPersistentType.specifiedAttributesSize());
-
- assertEquals("id", ormPersistentType.virtualAttributes().next().getName());
- assertEquals("name", ormPersistentType.specifiedAttributes().next().getName());
- }
-
- public void testVirtualMappingTypeWhenMetadataComplete() throws Exception {
- createTestEntityIdMapping();
- OrmPersistentType ormPersistentType = getEntityMappings().addPersistentType(MappingKeys.ENTITY_TYPE_MAPPING_KEY, FULLY_QUALIFIED_TYPE_NAME);
-
- OrmPersistentAttribute ormPersistentAttribute = ormPersistentType.virtualAttributes().next();
- assertEquals("id", ormPersistentAttribute.getName());
- assertEquals(MappingKeys.ID_ATTRIBUTE_MAPPING_KEY, ormPersistentAttribute.getMappingKey());
- assertEquals("FOO", ((IdMapping) ormPersistentAttribute.getMapping()).getColumn().getName());
-
-
- ormPersistentType.getMapping().setSpecifiedMetadataComplete(Boolean.TRUE);
-
- ormPersistentAttribute = ormPersistentType.virtualAttributes().next();
- assertEquals("id", ormPersistentAttribute.getName());
- assertEquals(MappingKeys.BASIC_ATTRIBUTE_MAPPING_KEY, ormPersistentAttribute.getMappingKey());
- assertEquals("id", ((BasicMapping) ormPersistentAttribute.getMapping()).getColumn().getName());
- }
-
- public void testVirtualMappingTypeWhenMetadataComplete2() throws Exception {
- createTestEntityOneToOneMapping();
- OrmPersistentType ormPersistentType = getEntityMappings().addPersistentType(MappingKeys.ENTITY_TYPE_MAPPING_KEY, FULLY_QUALIFIED_TYPE_NAME);
-
- OrmPersistentAttribute ormPersistentAttribute = ormPersistentType.virtualAttributes().next();
- assertEquals("address", ormPersistentAttribute.getName());
- assertEquals(MappingKeys.ONE_TO_ONE_ATTRIBUTE_MAPPING_KEY, ormPersistentAttribute.getMappingKey());
-
-
- ormPersistentType.getMapping().setSpecifiedMetadataComplete(Boolean.TRUE);
-
- ormPersistentAttribute = ormPersistentType.virtualAttributes().next();
- assertEquals("address", ormPersistentAttribute.getName());
- assertEquals(MappingKeys.NULL_ATTRIBUTE_MAPPING_KEY, ormPersistentAttribute.getMappingKey());
- }
-
- public void testGetJavaPersistentAttribute() throws Exception {
- createTestEntityIdMapping();
- OrmPersistentType ormPersistentType = getEntityMappings().addPersistentType(MappingKeys.ENTITY_TYPE_MAPPING_KEY, FULLY_QUALIFIED_TYPE_NAME);
- JavaPersistentType javaPersistentType = ormPersistentType.getJavaPersistentType();
-
- OrmPersistentAttribute ormPersistentAttribute = ormPersistentType.getAttributeNamed("id");
- JavaPersistentAttribute javaPersistentAttribute = javaPersistentType.getAttributeNamed("id");
-
- //virtual orm attribute, access type matches java : FIELD, name matches java
- assertTrue(ormPersistentAttribute.isVirtual());
- assertNotSame(javaPersistentAttribute, ormPersistentAttribute.getJavaPersistentAttribute());
- assertEquals(AccessType.FIELD, javaPersistentAttribute.getAccess());
- JavaResourcePersistentAttribute javaResourcePersistentAttribute = ormPersistentAttribute.getJavaPersistentAttribute().getResourcePersistentAttribute();
- assertTrue(javaResourcePersistentAttribute.isField());
- assertEquals("id", javaResourcePersistentAttribute.getName());
- assertEquals(javaPersistentType.getResourcePersistentType().persistableFields().next(), javaResourcePersistentAttribute);
-
-
- //specified orm attribute, access type matches java : FIELD, name matches java
- //javaPersistentAttribute should be == to java context model object
- ormPersistentAttribute.makeSpecified();
- ormPersistentAttribute = ormPersistentType.getAttributeNamed("id");
- assertFalse(ormPersistentAttribute.isVirtual());
- assertEquals(javaPersistentAttribute, ormPersistentAttribute.getJavaPersistentAttribute());
-
-
- //virtual orm attribute, java access type FIELD, orm access type PROPERTY, name matches java
- //verify the property java resource persistent attribute is used in orm.
- ormPersistentAttribute.makeVirtual();
- ormPersistentAttribute = ormPersistentType.getAttributeNamed("id");
- ormPersistentType.setSpecifiedAccess(AccessType.PROPERTY);
- assertNotSame(ormPersistentAttribute, ormPersistentType.getAttributeNamed("id"));
- ormPersistentAttribute = ormPersistentType.getAttributeNamed("id");
- assertNotSame(javaPersistentAttribute, ormPersistentAttribute.getJavaPersistentAttribute());
- assertEquals(AccessType.FIELD, javaPersistentAttribute.getAccess());
- assertEquals(AccessType.PROPERTY, ormPersistentAttribute.getJavaPersistentAttribute().getAccess());
- javaResourcePersistentAttribute = ormPersistentAttribute.getJavaPersistentAttribute().getResourcePersistentAttribute();
- assertTrue(javaResourcePersistentAttribute.isProperty());
- assertEquals("id", javaResourcePersistentAttribute.getName());
- assertEquals(javaPersistentType.getResourcePersistentType().persistableProperties().next(), javaResourcePersistentAttribute);
-
-
- ormPersistentType.setSpecifiedAccess(null);//default access will be field
- ormPersistentAttribute = ormPersistentType.getAttributeNamed("id");
- ormPersistentAttribute.makeSpecified();
- ormPersistentAttribute = ormPersistentType.getAttributeNamed("id");
- ormPersistentAttribute.getMapping().setName("id2");
- assertEquals(null, ormPersistentAttribute.getJavaPersistentAttribute());
-
- ormPersistentAttribute.getMapping().setName(null);
- assertEquals(null, ormPersistentAttribute.getJavaPersistentAttribute());
-
- ormPersistentAttribute.getMapping().setName("id");
- assertEquals(javaPersistentAttribute, ormPersistentAttribute.getJavaPersistentAttribute());
-
-
- ormPersistentType.getMapping().setSpecifiedMetadataComplete(Boolean.TRUE);
- assertEquals(javaPersistentAttribute, ormPersistentAttribute.getJavaPersistentAttribute());
- }
-} \ No newline at end of file
diff --git a/jpa/tests/org.eclipse.jpt.core.tests/src/org/eclipse/jpt/core/tests/internal/context/orm/GenericOrmPersistentTypeTests.java b/jpa/tests/org.eclipse.jpt.core.tests/src/org/eclipse/jpt/core/tests/internal/context/orm/GenericOrmPersistentTypeTests.java
deleted file mode 100644
index 777cde1f7b..0000000000
--- a/jpa/tests/org.eclipse.jpt.core.tests/src/org/eclipse/jpt/core/tests/internal/context/orm/GenericOrmPersistentTypeTests.java
+++ /dev/null
@@ -1,577 +0,0 @@
-/*******************************************************************************
- * Copyright (c) 2007, 2009 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.
- *
- * Contributors:
- * Oracle - initial API and implementation
- ******************************************************************************/
-package org.eclipse.jpt.core.tests.internal.context.orm;
-
-import java.util.Iterator;
-import java.util.ListIterator;
-import org.eclipse.jpt.core.JptCorePlugin;
-import org.eclipse.jpt.core.MappingKeys;
-import org.eclipse.jpt.core.context.Converter;
-import org.eclipse.jpt.core.context.TemporalConverter;
-import org.eclipse.jpt.core.context.TemporalType;
-import org.eclipse.jpt.core.context.java.JavaPersistentAttribute;
-import org.eclipse.jpt.core.context.orm.OrmBasicMapping;
-import org.eclipse.jpt.core.context.orm.OrmPersistentAttribute;
-import org.eclipse.jpt.core.context.orm.OrmPersistentType;
-import org.eclipse.jpt.core.resource.java.JavaResourcePersistentType;
-import org.eclipse.jpt.core.resource.orm.OrmFactory;
-import org.eclipse.jpt.core.resource.orm.XmlBasic;
-import org.eclipse.jpt.core.resource.orm.XmlEmbedded;
-import org.eclipse.jpt.core.resource.orm.XmlEmbeddedId;
-import org.eclipse.jpt.core.resource.orm.XmlEntity;
-import org.eclipse.jpt.core.resource.orm.XmlId;
-import org.eclipse.jpt.core.resource.orm.XmlManyToMany;
-import org.eclipse.jpt.core.resource.orm.XmlManyToOne;
-import org.eclipse.jpt.core.resource.orm.XmlOneToMany;
-import org.eclipse.jpt.core.resource.orm.XmlOneToOne;
-import org.eclipse.jpt.core.resource.orm.XmlTransient;
-import org.eclipse.jpt.core.resource.orm.XmlVersion;
-import org.eclipse.jpt.core.resource.persistence.PersistenceFactory;
-import org.eclipse.jpt.core.resource.persistence.XmlMappingFileRef;
-import org.eclipse.jpt.core.tests.internal.context.ContextModelTestCase;
-import org.eclipse.jpt.core.tests.internal.projects.TestJavaProject.SourceWriter;
-import org.eclipse.jpt.utility.internal.ClassTools;
-
-@SuppressWarnings("nls")
-public class GenericOrmPersistentTypeTests extends ContextModelTestCase
-{
- public static final String MODEL_TYPE_NAME = "Model";
- public static final String FULLY_QUALIFIED_MODEL_TYPE_NAME = PACKAGE_NAME + "." + MODEL_TYPE_NAME;
-
- public static final String EMPLOYEE_TYPE_NAME = "Employee";
- public static final String FULLY_QUALIFIED_EMPLOYEE_TYPE_NAME = PACKAGE_NAME + "." + EMPLOYEE_TYPE_NAME;
-
-
- public GenericOrmPersistentTypeTests(String name) {
- super(name);
- }
-
-
- @Override
- protected void setUp() throws Exception {
- super.setUp();
- XmlMappingFileRef mappingFileRef = PersistenceFactory.eINSTANCE.createXmlMappingFileRef();
- mappingFileRef.setFileName(JptCorePlugin.DEFAULT_ORM_XML_FILE_PATH);
- getXmlPersistenceUnit().getMappingFiles().add(mappingFileRef);
- getPersistenceXmlResource().save(null);
- }
-
- private void createModelType() throws Exception {
- SourceWriter sourceWriter = new SourceWriter() {
- public void appendSourceTo(StringBuilder sb) {
- sb.append(CR);
- sb.append("public abstract class ").append(MODEL_TYPE_NAME).append(" {");
- sb.append(CR);
- sb.append(" private int id;").append(CR);
- sb.append(CR);
- sb.append(" private String name;").append(CR);
- sb.append(CR);
- sb.append(" ");
- sb.append("}").append(CR);
- }
- };
- this.javaProject.createCompilationUnit(PACKAGE_NAME, MODEL_TYPE_NAME + ".java", sourceWriter);
- }
-
- private void createEmployeeType() throws Exception {
- SourceWriter sourceWriter = new SourceWriter() {
- public void appendSourceTo(StringBuilder sb) {
- sb.append(CR);
- sb.append("public class ").append(EMPLOYEE_TYPE_NAME).append(" extends ").append(MODEL_TYPE_NAME).append(" {");
- sb.append(CR);
- sb.append(" private String department;").append(CR);
- sb.append(CR);
- sb.append(" private java.util.Date startDate;").append(CR);
- sb.append(CR);
- sb.append(" ");
- sb.append("}").append(CR);
- }
- };
- this.javaProject.createCompilationUnit(PACKAGE_NAME, EMPLOYEE_TYPE_NAME + ".java", sourceWriter);
- }
-
-// public void testUpdateXmlTypeMapping() throws Exception {
-// assertFalse(entityMappings().ormPersistentTypes().hasNext());
-// assertTrue(ormResource().getEntityMappings().getMappedSuperclasses().isEmpty());
-// assertTrue(ormResource().getEntityMappings().getEntities().isEmpty());
-// assertTrue(ormResource().getEntityMappings().getEmbeddables().isEmpty());
-//
-// //add embeddable in the resource model, verify context model updated
-// Embeddable embeddable = OrmFactory.eINSTANCE.createEmbeddable();
-// ormResource().getEntityMappings().getEmbeddables().add(embeddable);
-// embeddable.setClassName("model.Foo");
-// assertTrue(entityMappings().ormPersistentTypes().hasNext());
-// assertEquals("model.Foo", entityMappings().ormPersistentTypes().next().getMapping().getClass_());
-// assertTrue(ormResource().getEntityMappings().getMappedSuperclasses().isEmpty());
-// assertTrue(ormResource().getEntityMappings().getEntities().isEmpty());
-// assertFalse(ormResource().getEntityMappings().getEmbeddables().isEmpty());
-// assertEquals("model.Foo", ormResource().getEntityMappings().getEmbeddables().get(0).getClassName());
-//
-// //add entity in the resource model, verify context model updated
-// Entity entity = OrmFactory.eINSTANCE.createEntity();
-// ormResource().getEntityMappings().getEntities().add(entity);
-// entity.setClassName("model.Foo2");
-// assertTrue(entityMappings().ormPersistentTypes().hasNext());
-// assertEquals("model.Foo2", entityMappings().ormPersistentTypes().next().getMapping().getClass_());
-// assertTrue(ormResource().getEntityMappings().getMappedSuperclasses().isEmpty());
-// assertFalse(ormResource().getEntityMappings().getEntities().isEmpty());
-// assertFalse(ormResource().getEntityMappings().getEmbeddables().isEmpty());
-// assertEquals("model.Foo2", ormResource().getEntityMappings().getEntities().get(0).getClassName());
-//
-// //add mapped-superclass in the resource model, verify context model updated
-// MappedSuperclass mappedSuperclass = OrmFactory.eINSTANCE.createMappedSuperclass();
-// ormResource().getEntityMappings().getMappedSuperclasses().add(mappedSuperclass);
-// mappedSuperclass.setClassName("model.Foo3");
-// assertTrue(entityMappings().ormPersistentTypes().hasNext());
-// assertEquals("model.Foo3", entityMappings().ormPersistentTypes().next().getMapping().getClass_());
-// assertFalse(ormResource().getEntityMappings().getMappedSuperclasses().isEmpty());
-// assertFalse(ormResource().getEntityMappings().getEntities().isEmpty());
-// assertFalse(ormResource().getEntityMappings().getEmbeddables().isEmpty());
-// assertEquals("model.Foo3", ormResource().getEntityMappings().getMappedSuperclasses().get(0).getClassName());
-// }
-//
-
- public void testMorphXmlTypeMapping() throws Exception {
- assertFalse(getEntityMappings().persistentTypes().hasNext());
- assertTrue(getXmlEntityMappings().getMappedSuperclasses().isEmpty());
- assertTrue(getXmlEntityMappings().getEntities().isEmpty());
- assertTrue(getXmlEntityMappings().getEmbeddables().isEmpty());
-
- OrmPersistentType embeddablePersistentType = getEntityMappings().addPersistentType(MappingKeys.EMBEDDABLE_TYPE_MAPPING_KEY, "model.Foo");
- OrmPersistentType entityPersistentType = getEntityMappings().addPersistentType(MappingKeys.ENTITY_TYPE_MAPPING_KEY, "model.Foo2");
- OrmPersistentType mappedSuperclassPersistentType = getEntityMappings().addPersistentType(MappingKeys.MAPPED_SUPERCLASS_TYPE_MAPPING_KEY, "model.Foo3");
-
- OrmPersistentType ormPersistentType = getEntityMappings().persistentTypes().next();
- assertEquals(mappedSuperclassPersistentType, ormPersistentType);
- assertEquals(MappingKeys.MAPPED_SUPERCLASS_TYPE_MAPPING_KEY, ormPersistentType.getMapping().getKey());
-
- ormPersistentType.setMappingKey(MappingKeys.EMBEDDABLE_TYPE_MAPPING_KEY);
- assertEquals(0, getXmlEntityMappings().getMappedSuperclasses().size());
- assertEquals(1, getXmlEntityMappings().getEntities().size());
- assertEquals(2, getXmlEntityMappings().getEmbeddables().size());
-
- Iterator<OrmPersistentType> ormPersistentTypes = getEntityMappings().persistentTypes();
- //the same OrmPersistentTypes should still be in the context model
- assertEquals(ormPersistentTypes.next(), entityPersistentType);
- assertEquals(ormPersistentTypes.next(), embeddablePersistentType);
- assertEquals(ormPersistentTypes.next(), mappedSuperclassPersistentType);
-
- assertEquals("model.Foo", getXmlEntityMappings().getEmbeddables().get(0).getClassName());
- assertEquals("model.Foo3", getXmlEntityMappings().getEmbeddables().get(1).getClassName());
- }
-
- public void testAddSpecifiedPersistentAttribute() throws Exception {
- OrmPersistentType entityPersistentType = getEntityMappings().addPersistentType(MappingKeys.ENTITY_TYPE_MAPPING_KEY, "model.Foo2");
-
- entityPersistentType.addSpecifiedPersistentAttribute(MappingKeys.BASIC_ATTRIBUTE_MAPPING_KEY, "basicAttribute");
-
- XmlEntity entity = getXmlEntityMappings().getEntities().get(0);
- XmlBasic basic = entity.getAttributes().getBasics().get(0);
- assertEquals("basicAttribute", basic.getName());
-
- entityPersistentType.addSpecifiedPersistentAttribute(MappingKeys.EMBEDDED_ATTRIBUTE_MAPPING_KEY, "embeddedAttribute");
-
- XmlEmbedded embedded = entity.getAttributes().getEmbeddeds().get(0);
- assertEquals("embeddedAttribute", embedded.getName());
-
- entityPersistentType.addSpecifiedPersistentAttribute(MappingKeys.TRANSIENT_ATTRIBUTE_MAPPING_KEY, "transientAttribute");
-
- XmlTransient transientResource = entity.getAttributes().getTransients().get(0);
- assertEquals("transientAttribute", transientResource.getName());
-
- entityPersistentType.addSpecifiedPersistentAttribute(MappingKeys.VERSION_ATTRIBUTE_MAPPING_KEY, "versionAttribute");
-
- XmlVersion version = entity.getAttributes().getVersions().get(0);
- assertEquals("versionAttribute", version.getName());
-
- entityPersistentType.addSpecifiedPersistentAttribute(MappingKeys.ID_ATTRIBUTE_MAPPING_KEY, "idAttribute");
-
- XmlId id = entity.getAttributes().getIds().get(0);
- assertEquals("idAttribute", id.getName());
-
-
- ListIterator<OrmPersistentAttribute> persistentAttributes = entityPersistentType.specifiedAttributes();
- assertEquals("idAttribute", persistentAttributes.next().getName());
- assertEquals("basicAttribute", persistentAttributes.next().getName());
- assertEquals("versionAttribute", persistentAttributes.next().getName());
- assertEquals("embeddedAttribute", persistentAttributes.next().getName());
- assertEquals("transientAttribute", persistentAttributes.next().getName());
- assertFalse(persistentAttributes.hasNext());
- }
-
- public void testRemoveSpecifiedPersistentAttribute() throws Exception {
- OrmPersistentType entityPersistentType = getEntityMappings().addPersistentType(MappingKeys.ENTITY_TYPE_MAPPING_KEY, "model.Foo2");
-
- entityPersistentType.addSpecifiedPersistentAttribute(MappingKeys.BASIC_ATTRIBUTE_MAPPING_KEY, "basicAttribute");
- entityPersistentType.addSpecifiedPersistentAttribute(MappingKeys.EMBEDDED_ATTRIBUTE_MAPPING_KEY, "embeddedAttribute");
- entityPersistentType.addSpecifiedPersistentAttribute(MappingKeys.VERSION_ATTRIBUTE_MAPPING_KEY, "versionAttribute");
- entityPersistentType.addSpecifiedPersistentAttribute(MappingKeys.ID_ATTRIBUTE_MAPPING_KEY, "idAttribute");
- entityPersistentType.addSpecifiedPersistentAttribute(MappingKeys.TRANSIENT_ATTRIBUTE_MAPPING_KEY, "transientAttribute");
-
- XmlEntity entity = getXmlEntityMappings().getEntities().get(0);
- assertEquals("basicAttribute", entity.getAttributes().getBasics().get(0).getName());
- assertEquals("embeddedAttribute", entity.getAttributes().getEmbeddeds().get(0).getName());
- assertEquals("versionAttribute", entity.getAttributes().getVersions().get(0).getName());
- assertEquals("idAttribute", entity.getAttributes().getIds().get(0).getName());
- assertEquals("transientAttribute", entity.getAttributes().getTransients().get(0).getName());
-
- entityPersistentType.removeSpecifiedPersistentAttribute(entityPersistentType.getAttributeNamed("basicAttribute"));
- assertEquals("embeddedAttribute", entity.getAttributes().getEmbeddeds().get(0).getName());
- assertEquals("versionAttribute", entity.getAttributes().getVersions().get(0).getName());
- assertEquals("idAttribute", entity.getAttributes().getIds().get(0).getName());
- assertEquals("transientAttribute", entity.getAttributes().getTransients().get(0).getName());
-
- entityPersistentType.removeSpecifiedPersistentAttribute(entityPersistentType.getAttributeNamed("embeddedAttribute"));
- assertEquals("versionAttribute", entity.getAttributes().getVersions().get(0).getName());
- assertEquals("idAttribute", entity.getAttributes().getIds().get(0).getName());
- assertEquals("transientAttribute", entity.getAttributes().getTransients().get(0).getName());
-
- entityPersistentType.removeSpecifiedPersistentAttribute(entityPersistentType.getAttributeNamed("versionAttribute"));
- assertEquals("idAttribute", entity.getAttributes().getIds().get(0).getName());
- assertEquals("transientAttribute", entity.getAttributes().getTransients().get(0).getName());
-
- entityPersistentType.removeSpecifiedPersistentAttribute(entityPersistentType.getAttributeNamed("idAttribute"));
- assertEquals("transientAttribute", entity.getAttributes().getTransients().get(0).getName());
-
- entityPersistentType.removeSpecifiedPersistentAttribute(entityPersistentType.getAttributeNamed("transientAttribute"));
- assertNull(entity.getAttributes());
- }
-
- public void testRemoveId() throws Exception {
- OrmPersistentType entityPersistentType = getEntityMappings().addPersistentType(MappingKeys.ENTITY_TYPE_MAPPING_KEY, "model.Foo2");
- XmlEntity entity = getXmlEntityMappings().getEntities().get(0);
-
- entityPersistentType.addSpecifiedPersistentAttribute(MappingKeys.ID_ATTRIBUTE_MAPPING_KEY, "idAttribute");
- assertEquals("idAttribute", entity.getAttributes().getIds().get(0).getName());
-
- entityPersistentType.removeSpecifiedPersistentAttribute(entityPersistentType.getAttributeNamed("idAttribute"));
- assertNull(entity.getAttributes());
- }
-
- public void testRemoveBasic() throws Exception {
- OrmPersistentType entityPersistentType = getEntityMappings().addPersistentType(MappingKeys.ENTITY_TYPE_MAPPING_KEY, "model.Foo2");
- XmlEntity entity = getXmlEntityMappings().getEntities().get(0);
-
- entityPersistentType.addSpecifiedPersistentAttribute(MappingKeys.BASIC_ATTRIBUTE_MAPPING_KEY, "basicAttribute");
- assertEquals("basicAttribute", entity.getAttributes().getBasics().get(0).getName());
-
- entityPersistentType.removeSpecifiedPersistentAttribute(entityPersistentType.getAttributeNamed("basicAttribute"));
- assertNull(entity.getAttributes());
- }
-
- public void testRemoveVersion() throws Exception {
- OrmPersistentType entityPersistentType = getEntityMappings().addPersistentType(MappingKeys.ENTITY_TYPE_MAPPING_KEY, "model.Foo2");
- XmlEntity entity = getXmlEntityMappings().getEntities().get(0);
-
- entityPersistentType.addSpecifiedPersistentAttribute(MappingKeys.VERSION_ATTRIBUTE_MAPPING_KEY, "versionAttribute");
- assertEquals("versionAttribute", entity.getAttributes().getVersions().get(0).getName());
-
- entityPersistentType.removeSpecifiedPersistentAttribute(entityPersistentType.getAttributeNamed("versionAttribute"));
- assertNull(entity.getAttributes());
- }
-
- public void testRemoveEmbedded() throws Exception {
- OrmPersistentType entityPersistentType = getEntityMappings().addPersistentType(MappingKeys.ENTITY_TYPE_MAPPING_KEY, "model.Foo2");
- XmlEntity entity = getXmlEntityMappings().getEntities().get(0);
-
- entityPersistentType.addSpecifiedPersistentAttribute(MappingKeys.EMBEDDED_ATTRIBUTE_MAPPING_KEY, "embeddedAttribute");
- assertEquals("embeddedAttribute", entity.getAttributes().getEmbeddeds().get(0).getName());
-
- entityPersistentType.removeSpecifiedPersistentAttribute(entityPersistentType.getAttributeNamed("embeddedAttribute"));
- assertNull(entity.getAttributes());
- }
-
- public void testRemoveTransient() throws Exception {
- OrmPersistentType entityPersistentType = getEntityMappings().addPersistentType(MappingKeys.ENTITY_TYPE_MAPPING_KEY, "model.Foo2");
- XmlEntity entity = getXmlEntityMappings().getEntities().get(0);
-
- entityPersistentType.addSpecifiedPersistentAttribute(MappingKeys.TRANSIENT_ATTRIBUTE_MAPPING_KEY, "transientAttribute");
- assertEquals("transientAttribute", entity.getAttributes().getTransients().get(0).getName());
-
- entityPersistentType.removeSpecifiedPersistentAttribute(entityPersistentType.getAttributeNamed("transientAttribute"));
- assertNull(entity.getAttributes());
- }
-
- public void testUpdateSpecifiedPersistentAttributes() throws Exception {
- OrmPersistentType entityPersistentType = getEntityMappings().addPersistentType(MappingKeys.ENTITY_TYPE_MAPPING_KEY, "model.Foo2");
- XmlEntity entity = getXmlEntityMappings().getEntities().get(0);
-
- entity.setAttributes(OrmFactory.eINSTANCE.createAttributes());
- XmlBasic basic = OrmFactory.eINSTANCE.createXmlBasic();
- entity.getAttributes().getBasics().add(basic);
- basic.setName("basicAttribute");
-
- OrmPersistentAttribute ormPersistentAttribute = entityPersistentType.attributes().next();
- assertEquals("basicAttribute", ormPersistentAttribute.getName());
- assertEquals(MappingKeys.BASIC_ATTRIBUTE_MAPPING_KEY, ormPersistentAttribute.getMapping().getKey());
-
- XmlEmbedded embedded = OrmFactory.eINSTANCE.createXmlEmbedded();
- entity.getAttributes().getEmbeddeds().add(embedded);
- embedded.setName("embeddedAttribute");
-
- ListIterator<OrmPersistentAttribute> attributes = entityPersistentType.attributes();
- ormPersistentAttribute = attributes.next();
- assertEquals("basicAttribute", ormPersistentAttribute.getName());
- assertEquals(MappingKeys.BASIC_ATTRIBUTE_MAPPING_KEY, ormPersistentAttribute.getMapping().getKey());
- ormPersistentAttribute = attributes.next();
- assertEquals("embeddedAttribute", ormPersistentAttribute.getName());
- assertEquals(MappingKeys.EMBEDDED_ATTRIBUTE_MAPPING_KEY, ormPersistentAttribute.getMapping().getKey());
- assertFalse(attributes.hasNext());
-
- XmlVersion version = OrmFactory.eINSTANCE.createXmlVersion();
- entity.getAttributes().getVersions().add(version);
- version.setName("versionAttribute");
-
- attributes = entityPersistentType.attributes();
- ormPersistentAttribute = attributes.next();
- assertEquals("basicAttribute", ormPersistentAttribute.getName());
- assertEquals(MappingKeys.BASIC_ATTRIBUTE_MAPPING_KEY, ormPersistentAttribute.getMapping().getKey());
- ormPersistentAttribute = attributes.next();
- assertEquals("versionAttribute", ormPersistentAttribute.getName());
- assertEquals(MappingKeys.VERSION_ATTRIBUTE_MAPPING_KEY, ormPersistentAttribute.getMapping().getKey());
- ormPersistentAttribute = attributes.next();
- assertEquals("embeddedAttribute", ormPersistentAttribute.getName());
- assertEquals(MappingKeys.EMBEDDED_ATTRIBUTE_MAPPING_KEY, ormPersistentAttribute.getMapping().getKey());
- assertFalse(attributes.hasNext());
-
- XmlId id = OrmFactory.eINSTANCE.createXmlId();
- entity.getAttributes().getIds().add(id);
- id.setName("idAttribute");
-
- attributes = entityPersistentType.attributes();
- ormPersistentAttribute = attributes.next();
- assertEquals("idAttribute", ormPersistentAttribute.getName());
- assertEquals(MappingKeys.ID_ATTRIBUTE_MAPPING_KEY, ormPersistentAttribute.getMapping().getKey());
- ormPersistentAttribute = attributes.next();
- assertEquals("basicAttribute", ormPersistentAttribute.getName());
- assertEquals(MappingKeys.BASIC_ATTRIBUTE_MAPPING_KEY, ormPersistentAttribute.getMapping().getKey());
- ormPersistentAttribute = attributes.next();
- assertEquals("versionAttribute", ormPersistentAttribute.getName());
- assertEquals(MappingKeys.VERSION_ATTRIBUTE_MAPPING_KEY, ormPersistentAttribute.getMapping().getKey());
- ormPersistentAttribute = attributes.next();
- assertEquals("embeddedAttribute", ormPersistentAttribute.getName());
- assertEquals(MappingKeys.EMBEDDED_ATTRIBUTE_MAPPING_KEY, ormPersistentAttribute.getMapping().getKey());
- assertFalse(attributes.hasNext());
-
- XmlTransient transientResource = OrmFactory.eINSTANCE.createXmlTransient();
- entity.getAttributes().getTransients().add(transientResource);
- transientResource.setName("transientAttribute");
-
- attributes = entityPersistentType.attributes();
- ormPersistentAttribute = attributes.next();
- assertEquals("idAttribute", ormPersistentAttribute.getName());
- assertEquals(MappingKeys.ID_ATTRIBUTE_MAPPING_KEY, ormPersistentAttribute.getMapping().getKey());
- ormPersistentAttribute = attributes.next();
- assertEquals("basicAttribute", ormPersistentAttribute.getName());
- assertEquals(MappingKeys.BASIC_ATTRIBUTE_MAPPING_KEY, ormPersistentAttribute.getMapping().getKey());
- ormPersistentAttribute = attributes.next();
- assertEquals("versionAttribute", ormPersistentAttribute.getName());
- assertEquals(MappingKeys.VERSION_ATTRIBUTE_MAPPING_KEY, ormPersistentAttribute.getMapping().getKey());
- ormPersistentAttribute = attributes.next();
- assertEquals("embeddedAttribute", ormPersistentAttribute.getName());
- assertEquals(MappingKeys.EMBEDDED_ATTRIBUTE_MAPPING_KEY, ormPersistentAttribute.getMapping().getKey());
- ormPersistentAttribute = attributes.next();
- assertEquals("transientAttribute", ormPersistentAttribute.getName());
- assertEquals(MappingKeys.TRANSIENT_ATTRIBUTE_MAPPING_KEY, ormPersistentAttribute.getMapping().getKey());
- assertFalse(attributes.hasNext());
-
- XmlManyToOne manyToOneResource = OrmFactory.eINSTANCE.createXmlManyToOne();
- entity.getAttributes().getManyToOnes().add(manyToOneResource);
- manyToOneResource.setName("manyToOneAttribute");
-
- attributes = entityPersistentType.attributes();
- ormPersistentAttribute = attributes.next();
- assertEquals("idAttribute", ormPersistentAttribute.getName());
- assertEquals(MappingKeys.ID_ATTRIBUTE_MAPPING_KEY, ormPersistentAttribute.getMapping().getKey());
- ormPersistentAttribute = attributes.next();
- assertEquals("basicAttribute", ormPersistentAttribute.getName());
- assertEquals(MappingKeys.BASIC_ATTRIBUTE_MAPPING_KEY, ormPersistentAttribute.getMapping().getKey());
- ormPersistentAttribute = attributes.next();
- assertEquals("versionAttribute", ormPersistentAttribute.getName());
- assertEquals(MappingKeys.VERSION_ATTRIBUTE_MAPPING_KEY, ormPersistentAttribute.getMapping().getKey());
- ormPersistentAttribute = attributes.next();
- assertEquals("manyToOneAttribute", ormPersistentAttribute.getName());
- assertEquals(MappingKeys.MANY_TO_ONE_ATTRIBUTE_MAPPING_KEY, ormPersistentAttribute.getMapping().getKey());
- ormPersistentAttribute = attributes.next();
- assertEquals("embeddedAttribute", ormPersistentAttribute.getName());
- assertEquals(MappingKeys.EMBEDDED_ATTRIBUTE_MAPPING_KEY, ormPersistentAttribute.getMapping().getKey());
- ormPersistentAttribute = attributes.next();
- assertEquals("transientAttribute", ormPersistentAttribute.getName());
- assertEquals(MappingKeys.TRANSIENT_ATTRIBUTE_MAPPING_KEY, ormPersistentAttribute.getMapping().getKey());
- assertFalse(attributes.hasNext());
-
- XmlManyToMany manyToManyResource = OrmFactory.eINSTANCE.createXmlManyToMany();
- entity.getAttributes().getManyToManys().add(manyToManyResource);
- manyToManyResource.setName("manyToManyAttribute");
-
- attributes = entityPersistentType.attributes();
- ormPersistentAttribute = attributes.next();
- assertEquals("idAttribute", ormPersistentAttribute.getName());
- assertEquals(MappingKeys.ID_ATTRIBUTE_MAPPING_KEY, ormPersistentAttribute.getMapping().getKey());
- ormPersistentAttribute = attributes.next();
- assertEquals("basicAttribute", ormPersistentAttribute.getName());
- assertEquals(MappingKeys.BASIC_ATTRIBUTE_MAPPING_KEY, ormPersistentAttribute.getMapping().getKey());
- ormPersistentAttribute = attributes.next();
- assertEquals("versionAttribute", ormPersistentAttribute.getName());
- assertEquals(MappingKeys.VERSION_ATTRIBUTE_MAPPING_KEY, ormPersistentAttribute.getMapping().getKey());
- ormPersistentAttribute = attributes.next();
- assertEquals("manyToOneAttribute", ormPersistentAttribute.getName());
- assertEquals(MappingKeys.MANY_TO_ONE_ATTRIBUTE_MAPPING_KEY, ormPersistentAttribute.getMapping().getKey());
- ormPersistentAttribute = attributes.next();
- assertEquals("manyToManyAttribute", ormPersistentAttribute.getName());
- assertEquals(MappingKeys.MANY_TO_MANY_ATTRIBUTE_MAPPING_KEY, ormPersistentAttribute.getMapping().getKey());
- ormPersistentAttribute = attributes.next();
- assertEquals("embeddedAttribute", ormPersistentAttribute.getName());
- assertEquals(MappingKeys.EMBEDDED_ATTRIBUTE_MAPPING_KEY, ormPersistentAttribute.getMapping().getKey());
- ormPersistentAttribute = attributes.next();
- assertEquals("transientAttribute", ormPersistentAttribute.getName());
- assertEquals(MappingKeys.TRANSIENT_ATTRIBUTE_MAPPING_KEY, ormPersistentAttribute.getMapping().getKey());
- assertFalse(attributes.hasNext());
-
- XmlOneToMany oneToManyResource = OrmFactory.eINSTANCE.createXmlOneToMany();
- entity.getAttributes().getOneToManys().add(oneToManyResource);
- oneToManyResource.setName("oneToManyAttribute");
-
- attributes = entityPersistentType.attributes();
- ormPersistentAttribute = attributes.next();
- assertEquals("idAttribute", ormPersistentAttribute.getName());
- assertEquals(MappingKeys.ID_ATTRIBUTE_MAPPING_KEY, ormPersistentAttribute.getMapping().getKey());
- ormPersistentAttribute = attributes.next();
- assertEquals("basicAttribute", ormPersistentAttribute.getName());
- assertEquals(MappingKeys.BASIC_ATTRIBUTE_MAPPING_KEY, ormPersistentAttribute.getMapping().getKey());
- ormPersistentAttribute = attributes.next();
- assertEquals("versionAttribute", ormPersistentAttribute.getName());
- assertEquals(MappingKeys.VERSION_ATTRIBUTE_MAPPING_KEY, ormPersistentAttribute.getMapping().getKey());
- ormPersistentAttribute = attributes.next();
- assertEquals("manyToOneAttribute", ormPersistentAttribute.getName());
- assertEquals(MappingKeys.MANY_TO_ONE_ATTRIBUTE_MAPPING_KEY, ormPersistentAttribute.getMapping().getKey());
- ormPersistentAttribute = attributes.next();
- assertEquals("oneToManyAttribute", ormPersistentAttribute.getName());
- assertEquals(MappingKeys.ONE_TO_MANY_ATTRIBUTE_MAPPING_KEY, ormPersistentAttribute.getMapping().getKey());
- ormPersistentAttribute = attributes.next();
- assertEquals("manyToManyAttribute", ormPersistentAttribute.getName());
- assertEquals(MappingKeys.MANY_TO_MANY_ATTRIBUTE_MAPPING_KEY, ormPersistentAttribute.getMapping().getKey());
- ormPersistentAttribute = attributes.next();
- assertEquals("embeddedAttribute", ormPersistentAttribute.getName());
- assertEquals(MappingKeys.EMBEDDED_ATTRIBUTE_MAPPING_KEY, ormPersistentAttribute.getMapping().getKey());
- ormPersistentAttribute = attributes.next();
- assertEquals("transientAttribute", ormPersistentAttribute.getName());
- assertEquals(MappingKeys.TRANSIENT_ATTRIBUTE_MAPPING_KEY, ormPersistentAttribute.getMapping().getKey());
- assertFalse(attributes.hasNext());
-
- XmlOneToOne oneToOneResource = OrmFactory.eINSTANCE.createXmlOneToOne();
- entity.getAttributes().getOneToOnes().add(oneToOneResource);
- oneToOneResource.setName("oneToOneAttribute");
-
- attributes = entityPersistentType.attributes();
- ormPersistentAttribute = attributes.next();
- assertEquals("idAttribute", ormPersistentAttribute.getName());
- assertEquals(MappingKeys.ID_ATTRIBUTE_MAPPING_KEY, ormPersistentAttribute.getMapping().getKey());
- ormPersistentAttribute = attributes.next();
- assertEquals("basicAttribute", ormPersistentAttribute.getName());
- assertEquals(MappingKeys.BASIC_ATTRIBUTE_MAPPING_KEY, ormPersistentAttribute.getMapping().getKey());
- ormPersistentAttribute = attributes.next();
- assertEquals("versionAttribute", ormPersistentAttribute.getName());
- assertEquals(MappingKeys.VERSION_ATTRIBUTE_MAPPING_KEY, ormPersistentAttribute.getMapping().getKey());
- ormPersistentAttribute = attributes.next();
- assertEquals("manyToOneAttribute", ormPersistentAttribute.getName());
- assertEquals(MappingKeys.MANY_TO_ONE_ATTRIBUTE_MAPPING_KEY, ormPersistentAttribute.getMapping().getKey());
- ormPersistentAttribute = attributes.next();
- assertEquals("oneToManyAttribute", ormPersistentAttribute.getName());
- assertEquals(MappingKeys.ONE_TO_MANY_ATTRIBUTE_MAPPING_KEY, ormPersistentAttribute.getMapping().getKey());
- ormPersistentAttribute = attributes.next();
- assertEquals("oneToOneAttribute", ormPersistentAttribute.getName());
- assertEquals(MappingKeys.ONE_TO_ONE_ATTRIBUTE_MAPPING_KEY, ormPersistentAttribute.getMapping().getKey());
- ormPersistentAttribute = attributes.next();
- assertEquals("manyToManyAttribute", ormPersistentAttribute.getName());
- assertEquals(MappingKeys.MANY_TO_MANY_ATTRIBUTE_MAPPING_KEY, ormPersistentAttribute.getMapping().getKey());
- ormPersistentAttribute = attributes.next();
- assertEquals("embeddedAttribute", ormPersistentAttribute.getName());
- assertEquals(MappingKeys.EMBEDDED_ATTRIBUTE_MAPPING_KEY, ormPersistentAttribute.getMapping().getKey());
- ormPersistentAttribute = attributes.next();
- assertEquals("transientAttribute", ormPersistentAttribute.getName());
- assertEquals(MappingKeys.TRANSIENT_ATTRIBUTE_MAPPING_KEY, ormPersistentAttribute.getMapping().getKey());
- assertFalse(attributes.hasNext());
-
-
- XmlEmbeddedId embeddedIdResource = OrmFactory.eINSTANCE.createXmlEmbeddedId();
- entity.getAttributes().getEmbeddedIds().add(embeddedIdResource);
- embeddedIdResource.setName("embeddedIdAttribute");
-
- attributes = entityPersistentType.attributes();
- ormPersistentAttribute = attributes.next();
- assertEquals("idAttribute", ormPersistentAttribute.getName());
- assertEquals(MappingKeys.ID_ATTRIBUTE_MAPPING_KEY, ormPersistentAttribute.getMapping().getKey());
- ormPersistentAttribute = attributes.next();
- assertEquals("embeddedIdAttribute", ormPersistentAttribute.getName());
- assertEquals(MappingKeys.EMBEDDED_ID_ATTRIBUTE_MAPPING_KEY, ormPersistentAttribute.getMapping().getKey());
- ormPersistentAttribute = attributes.next();
- assertEquals("basicAttribute", ormPersistentAttribute.getName());
- assertEquals(MappingKeys.BASIC_ATTRIBUTE_MAPPING_KEY, ormPersistentAttribute.getMapping().getKey());
- ormPersistentAttribute = attributes.next();
- assertEquals("versionAttribute", ormPersistentAttribute.getName());
- assertEquals(MappingKeys.VERSION_ATTRIBUTE_MAPPING_KEY, ormPersistentAttribute.getMapping().getKey());
- ormPersistentAttribute = attributes.next();
- assertEquals("manyToOneAttribute", ormPersistentAttribute.getName());
- assertEquals(MappingKeys.MANY_TO_ONE_ATTRIBUTE_MAPPING_KEY, ormPersistentAttribute.getMapping().getKey());
- ormPersistentAttribute = attributes.next();
- assertEquals("oneToManyAttribute", ormPersistentAttribute.getName());
- assertEquals(MappingKeys.ONE_TO_MANY_ATTRIBUTE_MAPPING_KEY, ormPersistentAttribute.getMapping().getKey());
- ormPersistentAttribute = attributes.next();
- assertEquals("oneToOneAttribute", ormPersistentAttribute.getName());
- assertEquals(MappingKeys.ONE_TO_ONE_ATTRIBUTE_MAPPING_KEY, ormPersistentAttribute.getMapping().getKey());
- ormPersistentAttribute = attributes.next();
- assertEquals("manyToManyAttribute", ormPersistentAttribute.getName());
- assertEquals(MappingKeys.MANY_TO_MANY_ATTRIBUTE_MAPPING_KEY, ormPersistentAttribute.getMapping().getKey());
- ormPersistentAttribute = attributes.next();
- assertEquals("embeddedAttribute", ormPersistentAttribute.getName());
- assertEquals(MappingKeys.EMBEDDED_ATTRIBUTE_MAPPING_KEY, ormPersistentAttribute.getMapping().getKey());
- ormPersistentAttribute = attributes.next();
- assertEquals("transientAttribute", ormPersistentAttribute.getName());
- assertEquals(MappingKeys.TRANSIENT_ATTRIBUTE_MAPPING_KEY, ormPersistentAttribute.getMapping().getKey());
- assertFalse(attributes.hasNext());
-
- entity.getAttributes().getBasics().remove(0);
- entity.getAttributes().getEmbeddeds().remove(0);
- entity.getAttributes().getTransients().remove(0);
- entity.getAttributes().getIds().remove(0);
- entity.getAttributes().getVersions().remove(0);
- entity.getAttributes().getManyToOnes().remove(0);
- entity.getAttributes().getManyToManys().remove(0);
- entity.getAttributes().getOneToManys().remove(0);
- entity.getAttributes().getOneToOnes().remove(0);
- entity.getAttributes().getEmbeddedIds().remove(0);
- assertFalse(entityPersistentType.attributes().hasNext());
- assertNotNull(entity.getAttributes());
- }
-
-
-
- public void testInheritedAttributesResolve() throws Exception {
- createModelType();
- createEmployeeType();
-
- OrmPersistentType employeePersistentType = getEntityMappings().addPersistentType(MappingKeys.ENTITY_TYPE_MAPPING_KEY, FULLY_QUALIFIED_EMPLOYEE_TYPE_NAME);
-
-
- employeePersistentType.addSpecifiedPersistentAttribute(MappingKeys.ID_ATTRIBUTE_MAPPING_KEY, "id");
- employeePersistentType.addSpecifiedPersistentAttribute(MappingKeys.BASIC_ATTRIBUTE_MAPPING_KEY, "name");
- OrmPersistentAttribute startDateAttribute = employeePersistentType.addSpecifiedPersistentAttribute(MappingKeys.BASIC_ATTRIBUTE_MAPPING_KEY, "startDate");
- ((OrmBasicMapping) startDateAttribute.getSpecifiedMapping()).setSpecifiedConverter(Converter.TEMPORAL_CONVERTER);
- ((TemporalConverter) ((OrmBasicMapping) startDateAttribute.getSpecifiedMapping()).getSpecifiedConverter()).setTemporalType(TemporalType.DATE);
-
- OrmPersistentAttribute idAttribute = employeePersistentType.getAttributeNamed("id");
- JavaPersistentAttribute javaPersistentAttribute = idAttribute.getJavaPersistentAttribute();
- assertNotNull(javaPersistentAttribute);
- assertEquals("id", javaPersistentAttribute.getName());
- assertEquals("test.Employee", javaPersistentAttribute.getPersistentType().getName());
- assertEquals("test.Model", ((JavaResourcePersistentType) ClassTools.fieldValue(javaPersistentAttribute.getResourcePersistentAttribute(), "parent")).getQualifiedName());
- }
-} \ No newline at end of file
diff --git a/jpa/tests/org.eclipse.jpt.core.tests/src/org/eclipse/jpt/core/tests/internal/context/orm/JptCoreOrmContextModelTests.java b/jpa/tests/org.eclipse.jpt.core.tests/src/org/eclipse/jpt/core/tests/internal/context/orm/JptCoreOrmContextModelTests.java
deleted file mode 100644
index 88216c47e6..0000000000
--- a/jpa/tests/org.eclipse.jpt.core.tests/src/org/eclipse/jpt/core/tests/internal/context/orm/JptCoreOrmContextModelTests.java
+++ /dev/null
@@ -1,62 +0,0 @@
-/*******************************************************************************
- * Copyright (c) 2007 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
- *
- * Contributors:
- * Oracle - initial API and implementation
- *******************************************************************************/
-package org.eclipse.jpt.core.tests.internal.context.orm;
-
-import junit.framework.Test;
-import junit.framework.TestCase;
-import junit.framework.TestSuite;
-
-public class JptCoreOrmContextModelTests extends TestCase
-{
- public static Test suite() {
- TestSuite suite = new TestSuite(JptCoreOrmContextModelTests.class.getName());
- suite.addTestSuite(OrmXmlTests.class);
- suite.addTestSuite(EntityMappingsTests.class);
- suite.addTestSuite(PersistenceUnitMetadataTests.class);
- suite.addTestSuite(PersistenceUnitDefaultsTests.class);
- suite.addTestSuite(GenericOrmPersistentAttributeTests.class);
- suite.addTestSuite(GenericOrmPersistentTypeTests.class);
- suite.addTestSuite(OrmAssociationOverrideTests.class);
- suite.addTestSuite(OrmAttributeOverrideTests.class);
- suite.addTestSuite(OrmBasicMappingTests.class);
- suite.addTestSuite(OrmCascadeTests.class);
- suite.addTestSuite(OrmColumnTests.class);
- suite.addTestSuite(OrmDiscriminatorColumnTests.class);
- suite.addTestSuite(OrmIdMappingTests.class);
- suite.addTestSuite(OrmEmbeddableTests.class);
- suite.addTestSuite(OrmEmbeddedMappingTests.class);
- suite.addTestSuite(OrmEmbeddedIdMappingTests.class);
- suite.addTestSuite(OrmEntityTests.class);
- suite.addTestSuite(OrmGeneratedValueTests.class);
- suite.addTestSuite(OrmJoinColumnTests.class);
- suite.addTestSuite(OrmJoinTableTests.class);
- suite.addTestSuite(OrmMappedSuperclassTests.class);
- suite.addTestSuite(OrmManyToManyMappingTests.class);
- suite.addTestSuite(OrmManyToOneMappingTests.class);
- suite.addTestSuite(OrmNamedQueryTests.class);
- suite.addTestSuite(OrmNamedNativeQueryTests.class);
- suite.addTestSuite(OrmOneToManyMappingTests.class);
- suite.addTestSuite(OrmOneToOneMappingTests.class);
- suite.addTestSuite(OrmPrimaryKeyJoinColumnTests.class);
- suite.addTestSuite(OrmQueryHintTests.class);
- suite.addTestSuite(OrmSecondaryTableTests.class);
- suite.addTestSuite(OrmSequenceGeneratorTests.class);
- suite.addTestSuite(OrmTableGeneratorTests.class);
- suite.addTestSuite(OrmTableTests.class);
- suite.addTestSuite(OrmTransientMappingTests.class);
- suite.addTestSuite(OrmVersionMappingTests.class);
- return suite;
- }
-
- private JptCoreOrmContextModelTests() {
- throw new UnsupportedOperationException();
- }
-}
diff --git a/jpa/tests/org.eclipse.jpt.core.tests/src/org/eclipse/jpt/core/tests/internal/context/orm/OrmAssociationOverrideTests.java b/jpa/tests/org.eclipse.jpt.core.tests/src/org/eclipse/jpt/core/tests/internal/context/orm/OrmAssociationOverrideTests.java
deleted file mode 100644
index 7c74caa9f9..0000000000
--- a/jpa/tests/org.eclipse.jpt.core.tests/src/org/eclipse/jpt/core/tests/internal/context/orm/OrmAssociationOverrideTests.java
+++ /dev/null
@@ -1,255 +0,0 @@
-/*******************************************************************************
- * Copyright (c) 2008, 2009 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.
- *
- * Contributors:
- * Oracle - initial API and implementation
- ******************************************************************************/
-package org.eclipse.jpt.core.tests.internal.context.orm;
-
-import java.util.ListIterator;
-import org.eclipse.jpt.core.JptCorePlugin;
-import org.eclipse.jpt.core.MappingKeys;
-import org.eclipse.jpt.core.context.orm.OrmAssociationOverride;
-import org.eclipse.jpt.core.context.orm.OrmEntity;
-import org.eclipse.jpt.core.context.orm.OrmJoinColumn;
-import org.eclipse.jpt.core.context.orm.OrmPersistentType;
-import org.eclipse.jpt.core.resource.orm.OrmFactory;
-import org.eclipse.jpt.core.resource.orm.XmlAssociationOverride;
-import org.eclipse.jpt.core.resource.orm.XmlEntity;
-import org.eclipse.jpt.core.resource.persistence.PersistenceFactory;
-import org.eclipse.jpt.core.resource.persistence.XmlMappingFileRef;
-import org.eclipse.jpt.core.tests.internal.context.ContextModelTestCase;
-
-@SuppressWarnings("nls")
-public class OrmAssociationOverrideTests extends ContextModelTestCase
-{
- public OrmAssociationOverrideTests(String name) {
- super(name);
- }
-
- @Override
- protected void setUp() throws Exception {
- super.setUp();
- XmlMappingFileRef mappingFileRef = PersistenceFactory.eINSTANCE.createXmlMappingFileRef();
- mappingFileRef.setFileName(JptCorePlugin.DEFAULT_ORM_XML_FILE_PATH);
- getXmlPersistenceUnit().getMappingFiles().add(mappingFileRef);
- getPersistenceXmlResource().save(null);
- }
-
- public void testUpdateName() throws Exception {
- OrmPersistentType ormPersistentType = getEntityMappings().addPersistentType(MappingKeys.ENTITY_TYPE_MAPPING_KEY, "model.foo");
- OrmEntity ormEntity = (OrmEntity) ormPersistentType.getMapping();
-
- XmlEntity entityResource = getXmlEntityMappings().getEntities().get(0);
- entityResource.getAssociationOverrides().add(OrmFactory.eINSTANCE.createXmlAssociationOverride());
- XmlAssociationOverride xmlAssociationOverride = entityResource.getAssociationOverrides().get(0);
- OrmAssociationOverride ormAssociationOverride = ormEntity.specifiedAssociationOverrides().next();
-
- assertNull(ormAssociationOverride.getName());
- assertNull(xmlAssociationOverride.getName());
- assertTrue(ormEntity.associationOverrides().hasNext());
- assertFalse(entityResource.getAssociationOverrides().isEmpty());
-
- //set name in the resource model, verify context model updated
- xmlAssociationOverride.setName("FOO");
- assertEquals("FOO", ormAssociationOverride.getName());
- assertEquals("FOO", xmlAssociationOverride.getName());
-
- //set name to null in the resource model
- xmlAssociationOverride.setName(null);
- assertNull(ormAssociationOverride.getName());
- assertNull(xmlAssociationOverride.getName());
-
- xmlAssociationOverride.setName("FOO");
- assertEquals("FOO", ormAssociationOverride.getName());
- assertEquals("FOO", xmlAssociationOverride.getName());
-
- entityResource.getAssociationOverrides().remove(0);
- assertFalse(ormEntity.associationOverrides().hasNext());
- assertTrue(entityResource.getAssociationOverrides().isEmpty());
- }
-
- public void testModifyName() throws Exception {
- OrmPersistentType ormPersistentType = getEntityMappings().addPersistentType(MappingKeys.ENTITY_TYPE_MAPPING_KEY, "model.foo");
- OrmEntity ormEntity = (OrmEntity) ormPersistentType.getMapping();
-
- XmlEntity entityResource = getXmlEntityMappings().getEntities().get(0);
- entityResource.getAssociationOverrides().add(OrmFactory.eINSTANCE.createXmlAssociationOverride());
- XmlAssociationOverride xmlAssociationOverride = entityResource.getAssociationOverrides().get(0);
- OrmAssociationOverride ormAssociationOverride = ormEntity.specifiedAssociationOverrides().next();
-
- assertNull(ormAssociationOverride.getName());
- assertNull(xmlAssociationOverride.getName());
-
- //set name in the context model, verify resource model modified
- ormAssociationOverride.setName("foo");
- assertEquals("foo", ormAssociationOverride.getName());
- assertEquals("foo", xmlAssociationOverride.getName());
-
- //set name to null in the context model
- ormAssociationOverride.setName(null);
- assertNull(ormAssociationOverride.getName());
- assertNull(entityResource.getAssociationOverrides().get(0).getName());
- }
-
-
- public void testAddSpecifiedJoinColumn() throws Exception {
- OrmPersistentType ormPersistentType = getEntityMappings().addPersistentType(MappingKeys.ENTITY_TYPE_MAPPING_KEY, "model.Foo");
- OrmEntity ormEntity = (OrmEntity) ormPersistentType.getMapping();
-
- XmlEntity entityResource = getXmlEntityMappings().getEntities().get(0);
- entityResource.getAssociationOverrides().add(OrmFactory.eINSTANCE.createXmlAssociationOverride());
- OrmAssociationOverride ormAssociationOverride = ormEntity.specifiedAssociationOverrides().next();
-
- XmlAssociationOverride xmlAssociationOverride = entityResource.getAssociationOverrides().get(0);
-
- OrmJoinColumn joinColumn = ormAssociationOverride.addSpecifiedJoinColumn(0);
- joinColumn.setSpecifiedName("FOO");
-
- assertEquals("FOO", xmlAssociationOverride.getJoinColumns().get(0).getName());
-
- OrmJoinColumn joinColumn2 = ormAssociationOverride.addSpecifiedJoinColumn(0);
- joinColumn2.setSpecifiedName("BAR");
-
- assertEquals("BAR", xmlAssociationOverride.getJoinColumns().get(0).getName());
- assertEquals("FOO", xmlAssociationOverride.getJoinColumns().get(1).getName());
-
- OrmJoinColumn joinColumn3 = ormAssociationOverride.addSpecifiedJoinColumn(1);
- joinColumn3.setSpecifiedName("BAZ");
-
- assertEquals("BAR", xmlAssociationOverride.getJoinColumns().get(0).getName());
- assertEquals("BAZ", xmlAssociationOverride.getJoinColumns().get(1).getName());
- assertEquals("FOO", xmlAssociationOverride.getJoinColumns().get(2).getName());
-
- ListIterator<OrmJoinColumn> joinColumns = ormAssociationOverride.specifiedJoinColumns();
- assertEquals(joinColumn2, joinColumns.next());
- assertEquals(joinColumn3, joinColumns.next());
- assertEquals(joinColumn, joinColumns.next());
-
- joinColumns = ormAssociationOverride.specifiedJoinColumns();
- assertEquals("BAR", joinColumns.next().getName());
- assertEquals("BAZ", joinColumns.next().getName());
- assertEquals("FOO", joinColumns.next().getName());
- }
-
- public void testRemoveSpecifiedJoinColumn() throws Exception {
- OrmPersistentType ormPersistentType = getEntityMappings().addPersistentType(MappingKeys.ENTITY_TYPE_MAPPING_KEY, "model.Foo");
- OrmEntity ormEntity = (OrmEntity) ormPersistentType.getMapping();
- XmlEntity entityResource = getXmlEntityMappings().getEntities().get(0);
- entityResource.getAssociationOverrides().add(OrmFactory.eINSTANCE.createXmlAssociationOverride());
- OrmAssociationOverride ormAssociationOverride = ormEntity.specifiedAssociationOverrides().next();
-
- XmlAssociationOverride xmlAssociationOverride = entityResource.getAssociationOverrides().get(0);
-
- ormAssociationOverride.addSpecifiedJoinColumn(0).setSpecifiedName("FOO");
- ormAssociationOverride.addSpecifiedJoinColumn(1).setSpecifiedName("BAR");
- ormAssociationOverride.addSpecifiedJoinColumn(2).setSpecifiedName("BAZ");
-
- assertEquals(3, xmlAssociationOverride.getJoinColumns().size());
-
- ormAssociationOverride.removeSpecifiedJoinColumn(0);
- assertEquals(2, xmlAssociationOverride.getJoinColumns().size());
- assertEquals("BAR", xmlAssociationOverride.getJoinColumns().get(0).getName());
- assertEquals("BAZ", xmlAssociationOverride.getJoinColumns().get(1).getName());
-
- ormAssociationOverride.removeSpecifiedJoinColumn(0);
- assertEquals(1, xmlAssociationOverride.getJoinColumns().size());
- assertEquals("BAZ", xmlAssociationOverride.getJoinColumns().get(0).getName());
-
- ormAssociationOverride.removeSpecifiedJoinColumn(0);
- assertEquals(0, xmlAssociationOverride.getJoinColumns().size());
- }
-
- public void testMoveSpecifiedJoinColumn() throws Exception {
- OrmPersistentType ormPersistentType = getEntityMappings().addPersistentType(MappingKeys.ENTITY_TYPE_MAPPING_KEY, "model.Foo");
- OrmEntity ormEntity = (OrmEntity) ormPersistentType.getMapping();
- XmlEntity entityResource = getXmlEntityMappings().getEntities().get(0);
- entityResource.getAssociationOverrides().add(OrmFactory.eINSTANCE.createXmlAssociationOverride());
- OrmAssociationOverride ormAssociationOverride = ormEntity.specifiedAssociationOverrides().next();
-
- XmlAssociationOverride xmlAssociationOverride = entityResource.getAssociationOverrides().get(0);
-
- ormAssociationOverride.addSpecifiedJoinColumn(0).setSpecifiedName("FOO");
- ormAssociationOverride.addSpecifiedJoinColumn(1).setSpecifiedName("BAR");
- ormAssociationOverride.addSpecifiedJoinColumn(2).setSpecifiedName("BAZ");
-
- assertEquals(3, xmlAssociationOverride.getJoinColumns().size());
-
-
- ormAssociationOverride.moveSpecifiedJoinColumn(2, 0);
- ListIterator<OrmJoinColumn> joinColumns = ormAssociationOverride.specifiedJoinColumns();
- assertEquals("BAR", joinColumns.next().getName());
- assertEquals("BAZ", joinColumns.next().getName());
- assertEquals("FOO", joinColumns.next().getName());
-
- assertEquals("BAR", xmlAssociationOverride.getJoinColumns().get(0).getName());
- assertEquals("BAZ", xmlAssociationOverride.getJoinColumns().get(1).getName());
- assertEquals("FOO", xmlAssociationOverride.getJoinColumns().get(2).getName());
-
-
- ormAssociationOverride.moveSpecifiedJoinColumn(0, 1);
- joinColumns = ormAssociationOverride.specifiedJoinColumns();
- assertEquals("BAZ", joinColumns.next().getName());
- assertEquals("BAR", joinColumns.next().getName());
- assertEquals("FOO", joinColumns.next().getName());
-
- assertEquals("BAZ", xmlAssociationOverride.getJoinColumns().get(0).getName());
- assertEquals("BAR", xmlAssociationOverride.getJoinColumns().get(1).getName());
- assertEquals("FOO", xmlAssociationOverride.getJoinColumns().get(2).getName());
- }
-
- public void testUpdateJoinColumns() throws Exception {
- OrmPersistentType ormPersistentType = getEntityMappings().addPersistentType(MappingKeys.ENTITY_TYPE_MAPPING_KEY, "model.Foo");
- OrmEntity ormEntity = (OrmEntity) ormPersistentType.getMapping();
- XmlEntity entityResource = getXmlEntityMappings().getEntities().get(0);
- entityResource.getAssociationOverrides().add(OrmFactory.eINSTANCE.createXmlAssociationOverride());
- OrmAssociationOverride ormAssociationOverride = ormEntity.specifiedAssociationOverrides().next();
-
- XmlAssociationOverride xmlAssociationOverride = entityResource.getAssociationOverrides().get(0);
-
- xmlAssociationOverride.getJoinColumns().add(OrmFactory.eINSTANCE.createXmlJoinColumn());
- xmlAssociationOverride.getJoinColumns().add(OrmFactory.eINSTANCE.createXmlJoinColumn());
- xmlAssociationOverride.getJoinColumns().add(OrmFactory.eINSTANCE.createXmlJoinColumn());
-
- xmlAssociationOverride.getJoinColumns().get(0).setName("FOO");
- xmlAssociationOverride.getJoinColumns().get(1).setName("BAR");
- xmlAssociationOverride.getJoinColumns().get(2).setName("BAZ");
-
- ListIterator<OrmJoinColumn> joinColumns = ormAssociationOverride.specifiedJoinColumns();
- assertEquals("FOO", joinColumns.next().getName());
- assertEquals("BAR", joinColumns.next().getName());
- assertEquals("BAZ", joinColumns.next().getName());
- assertFalse(joinColumns.hasNext());
-
- xmlAssociationOverride.getJoinColumns().move(2, 0);
- joinColumns = ormAssociationOverride.specifiedJoinColumns();
- assertEquals("BAR", joinColumns.next().getName());
- assertEquals("BAZ", joinColumns.next().getName());
- assertEquals("FOO", joinColumns.next().getName());
- assertFalse(joinColumns.hasNext());
-
- xmlAssociationOverride.getJoinColumns().move(0, 1);
- joinColumns = ormAssociationOverride.specifiedJoinColumns();
- assertEquals("BAZ", joinColumns.next().getName());
- assertEquals("BAR", joinColumns.next().getName());
- assertEquals("FOO", joinColumns.next().getName());
- assertFalse(joinColumns.hasNext());
-
- xmlAssociationOverride.getJoinColumns().remove(1);
- joinColumns = ormAssociationOverride.specifiedJoinColumns();
- assertEquals("BAZ", joinColumns.next().getName());
- assertEquals("FOO", joinColumns.next().getName());
- assertFalse(joinColumns.hasNext());
-
- xmlAssociationOverride.getJoinColumns().remove(1);
- joinColumns = ormAssociationOverride.specifiedJoinColumns();
- assertEquals("BAZ", joinColumns.next().getName());
- assertFalse(joinColumns.hasNext());
-
- xmlAssociationOverride.getJoinColumns().remove(0);
- assertFalse(ormAssociationOverride.specifiedJoinColumns().hasNext());
- }
-} \ No newline at end of file
diff --git a/jpa/tests/org.eclipse.jpt.core.tests/src/org/eclipse/jpt/core/tests/internal/context/orm/OrmAttributeOverrideTests.java b/jpa/tests/org.eclipse.jpt.core.tests/src/org/eclipse/jpt/core/tests/internal/context/orm/OrmAttributeOverrideTests.java
deleted file mode 100644
index 9a0fc002a4..0000000000
--- a/jpa/tests/org.eclipse.jpt.core.tests/src/org/eclipse/jpt/core/tests/internal/context/orm/OrmAttributeOverrideTests.java
+++ /dev/null
@@ -1,96 +0,0 @@
-/*******************************************************************************
- * Copyright (c) 2007, 2009 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.
- *
- * Contributors:
- * Oracle - initial API and implementation
- ******************************************************************************/
-package org.eclipse.jpt.core.tests.internal.context.orm;
-
-import org.eclipse.jpt.core.JptCorePlugin;
-import org.eclipse.jpt.core.MappingKeys;
-import org.eclipse.jpt.core.context.orm.OrmAttributeOverride;
-import org.eclipse.jpt.core.context.orm.OrmEntity;
-import org.eclipse.jpt.core.context.orm.OrmPersistentType;
-import org.eclipse.jpt.core.resource.orm.OrmFactory;
-import org.eclipse.jpt.core.resource.orm.XmlAttributeOverride;
-import org.eclipse.jpt.core.resource.orm.XmlEntity;
-import org.eclipse.jpt.core.resource.persistence.PersistenceFactory;
-import org.eclipse.jpt.core.resource.persistence.XmlMappingFileRef;
-import org.eclipse.jpt.core.tests.internal.context.ContextModelTestCase;
-
-@SuppressWarnings("nls")
-public class OrmAttributeOverrideTests extends ContextModelTestCase
-{
- public OrmAttributeOverrideTests(String name) {
- super(name);
- }
-
- @Override
- protected void setUp() throws Exception {
- super.setUp();
- XmlMappingFileRef mappingFileRef = PersistenceFactory.eINSTANCE.createXmlMappingFileRef();
- mappingFileRef.setFileName(JptCorePlugin.DEFAULT_ORM_XML_FILE_PATH);
- getXmlPersistenceUnit().getMappingFiles().add(mappingFileRef);
- getPersistenceXmlResource().save(null);
- }
-
- public void testUpdateName() throws Exception {
- OrmPersistentType ormPersistentType = getEntityMappings().addPersistentType(MappingKeys.ENTITY_TYPE_MAPPING_KEY, "model.foo");
- OrmEntity ormEntity = (OrmEntity) ormPersistentType.getMapping();
-
- XmlEntity entityResource = getXmlEntityMappings().getEntities().get(0);
- entityResource.getAttributeOverrides().add(OrmFactory.eINSTANCE.createXmlAttributeOverride());
- XmlAttributeOverride attributeOverrideResource = entityResource.getAttributeOverrides().get(0);
- OrmAttributeOverride ormAttributeOverride = ormEntity.specifiedAttributeOverrides().next();
-
- assertNull(ormAttributeOverride.getName());
- assertNull(attributeOverrideResource.getName());
- assertTrue(ormEntity.attributeOverrides().hasNext());
- assertFalse(entityResource.getAttributeOverrides().isEmpty());
-
- //set name in the resource model, verify context model updated
- attributeOverrideResource.setName("FOO");
- assertEquals("FOO", ormAttributeOverride.getName());
- assertEquals("FOO", attributeOverrideResource.getName());
-
- //set name to null in the resource model
- attributeOverrideResource.setName(null);
- assertNull(ormAttributeOverride.getName());
- assertNull(attributeOverrideResource.getName());
-
- attributeOverrideResource.setName("FOO");
- assertEquals("FOO", ormAttributeOverride.getName());
- assertEquals("FOO", attributeOverrideResource.getName());
-
- entityResource.getAttributeOverrides().remove(0);
- assertFalse(ormEntity.attributeOverrides().hasNext());
- assertTrue(entityResource.getAttributeOverrides().isEmpty());
- }
-
- public void testModifyName() throws Exception {
- OrmPersistentType ormPersistentType = getEntityMappings().addPersistentType(MappingKeys.ENTITY_TYPE_MAPPING_KEY, "model.foo");
- OrmEntity ormEntity = (OrmEntity) ormPersistentType.getMapping();
-
- XmlEntity entityResource = getXmlEntityMappings().getEntities().get(0);
- entityResource.getAttributeOverrides().add(OrmFactory.eINSTANCE.createXmlAttributeOverride());
- XmlAttributeOverride attributeOverrideResource = entityResource.getAttributeOverrides().get(0);
- OrmAttributeOverride ormAttributeOverride = ormEntity.specifiedAttributeOverrides().next();
-
- assertNull(ormAttributeOverride.getName());
- assertNull(attributeOverrideResource.getName());
-
- //set name in the context model, verify resource model modified
- ormAttributeOverride.setName("foo");
- assertEquals("foo", ormAttributeOverride.getName());
- assertEquals("foo", attributeOverrideResource.getName());
-
- //set name to null in the context model
- ormAttributeOverride.setName(null);
- assertNull(ormAttributeOverride.getName());
- assertNull(entityResource.getAttributeOverrides().get(0).getName());
- }
-
-} \ No newline at end of file
diff --git a/jpa/tests/org.eclipse.jpt.core.tests/src/org/eclipse/jpt/core/tests/internal/context/orm/OrmBasicMappingTests.java b/jpa/tests/org.eclipse.jpt.core.tests/src/org/eclipse/jpt/core/tests/internal/context/orm/OrmBasicMappingTests.java
deleted file mode 100644
index 15a7d50781..0000000000
--- a/jpa/tests/org.eclipse.jpt.core.tests/src/org/eclipse/jpt/core/tests/internal/context/orm/OrmBasicMappingTests.java
+++ /dev/null
@@ -1,709 +0,0 @@
-/*******************************************************************************
- * Copyright (c) 2007, 2009 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.
- *
- * Contributors:
- * Oracle - initial API and implementation
- ******************************************************************************/
-package org.eclipse.jpt.core.tests.internal.context.orm;
-
-import java.util.Iterator;
-import org.eclipse.jdt.core.ICompilationUnit;
-import org.eclipse.jpt.core.JptCorePlugin;
-import org.eclipse.jpt.core.MappingKeys;
-import org.eclipse.jpt.core.context.BasicMapping;
-import org.eclipse.jpt.core.context.Converter;
-import org.eclipse.jpt.core.context.EmbeddedIdMapping;
-import org.eclipse.jpt.core.context.EmbeddedMapping;
-import org.eclipse.jpt.core.context.EnumType;
-import org.eclipse.jpt.core.context.EnumeratedConverter;
-import org.eclipse.jpt.core.context.FetchType;
-import org.eclipse.jpt.core.context.IdMapping;
-import org.eclipse.jpt.core.context.ManyToManyMapping;
-import org.eclipse.jpt.core.context.ManyToOneMapping;
-import org.eclipse.jpt.core.context.OneToManyMapping;
-import org.eclipse.jpt.core.context.OneToOneMapping;
-import org.eclipse.jpt.core.context.TemporalConverter;
-import org.eclipse.jpt.core.context.TemporalType;
-import org.eclipse.jpt.core.context.TransientMapping;
-import org.eclipse.jpt.core.context.VersionMapping;
-import org.eclipse.jpt.core.context.orm.OrmBasicMapping;
-import org.eclipse.jpt.core.context.orm.OrmColumn;
-import org.eclipse.jpt.core.context.orm.OrmPersistentAttribute;
-import org.eclipse.jpt.core.context.orm.OrmPersistentType;
-import org.eclipse.jpt.core.resource.java.JPA;
-import org.eclipse.jpt.core.resource.orm.XmlBasic;
-import org.eclipse.jpt.core.resource.persistence.PersistenceFactory;
-import org.eclipse.jpt.core.resource.persistence.XmlMappingFileRef;
-import org.eclipse.jpt.core.tests.internal.context.ContextModelTestCase;
-import org.eclipse.jpt.utility.internal.iterators.ArrayIterator;
-
-@SuppressWarnings("nls")
-public class OrmBasicMappingTests extends ContextModelTestCase
-{
- public OrmBasicMappingTests(String name) {
- super(name);
- }
-
- @Override
- protected void setUp() throws Exception {
- super.setUp();
- XmlMappingFileRef mappingFileRef = PersistenceFactory.eINSTANCE.createXmlMappingFileRef();
- mappingFileRef.setFileName(JptCorePlugin.DEFAULT_ORM_XML_FILE_PATH);
- getXmlPersistenceUnit().getMappingFiles().add(mappingFileRef);
- getPersistenceXmlResource().save(null);
- }
-
- private ICompilationUnit createTestEntityBasicMapping() throws Exception {
- return this.createTestType(new DefaultAnnotationWriter() {
- @Override
- public Iterator<String> imports() {
- return new ArrayIterator<String>(JPA.ENTITY, JPA.BASIC, JPA.FETCH_TYPE, JPA.COLUMN, JPA.LOB, JPA.TEMPORAL, JPA.TEMPORAL_TYPE, JPA.ENUMERATED, JPA.ENUM_TYPE);
- }
- @Override
- public void appendTypeAnnotationTo(StringBuilder sb) {
- sb.append("@Entity");
- }
-
- @Override
- public void appendIdFieldAnnotationTo(StringBuilder sb) {
- sb.append("@Basic(fetch=FetchType.LAZY, optional=false)");
- sb.append(CR);
- sb.append(" @Column(name=\"MY_COLUMN\", unique=true, nullable=false, insertable=false, updatable=false, columnDefinition=\"COLUMN_DEFINITION\", table=\"MY_TABLE\", length=5, precision=6, scale=7)");
- sb.append(CR);
- sb.append(" @Lob");
- sb.append(CR);
- sb.append(" @Temporal(TemporalType.TIMESTAMP)");
- sb.append(CR);
- sb.append(" @Enumerated(EnumType.STRING)");
- }
- });
- }
-
- public void testUpdateName() throws Exception {
- OrmPersistentType ormPersistentType = getEntityMappings().addPersistentType(MappingKeys.ENTITY_TYPE_MAPPING_KEY, "model.Foo");
- OrmPersistentAttribute ormPersistentAttribute = ormPersistentType.addSpecifiedPersistentAttribute(MappingKeys.BASIC_ATTRIBUTE_MAPPING_KEY, "basicMapping");
- OrmBasicMapping ormBasicMapping = (OrmBasicMapping) ormPersistentAttribute.getMapping();
- XmlBasic basicResource = getXmlEntityMappings().getEntities().get(0).getAttributes().getBasics().get(0);
-
- assertEquals("basicMapping", ormBasicMapping.getName());
- assertEquals("basicMapping", basicResource.getName());
-
- //set name in the resource model, verify context model updated
- basicResource.setName("newName");
- assertEquals("newName", ormBasicMapping.getName());
- assertEquals("newName", basicResource.getName());
-
- //set name to null in the resource model
- basicResource.setName(null);
- assertNull(ormBasicMapping.getName());
- assertNull(basicResource.getName());
- }
-
- public void testModifyName() throws Exception {
- OrmPersistentType ormPersistentType = getEntityMappings().addPersistentType(MappingKeys.ENTITY_TYPE_MAPPING_KEY, "model.Foo");
- OrmPersistentAttribute ormPersistentAttribute = ormPersistentType.addSpecifiedPersistentAttribute(MappingKeys.BASIC_ATTRIBUTE_MAPPING_KEY, "basicMapping");
- OrmBasicMapping ormBasicMapping = (OrmBasicMapping) ormPersistentAttribute.getMapping();
- XmlBasic basicResource = getXmlEntityMappings().getEntities().get(0).getAttributes().getBasics().get(0);
-
- assertEquals("basicMapping", ormBasicMapping.getName());
- assertEquals("basicMapping", basicResource.getName());
-
- //set name in the context model, verify resource model updated
- ormBasicMapping.setName("newName");
- assertEquals("newName", ormBasicMapping.getName());
- assertEquals("newName", basicResource.getName());
-
- //set name to null in the context model
- ormBasicMapping.setName(null);
- assertNull(ormBasicMapping.getName());
- assertNull(basicResource.getName());
- }
-
- public void testUpdateSpecifiedFetch() throws Exception {
- OrmPersistentType ormPersistentType = getEntityMappings().addPersistentType(MappingKeys.ENTITY_TYPE_MAPPING_KEY, "model.Foo");
- OrmPersistentAttribute ormPersistentAttribute = ormPersistentType.addSpecifiedPersistentAttribute(MappingKeys.BASIC_ATTRIBUTE_MAPPING_KEY, "basicMapping");
- OrmBasicMapping ormBasicMapping = (OrmBasicMapping) ormPersistentAttribute.getMapping();
- XmlBasic basicResource = getXmlEntityMappings().getEntities().get(0).getAttributes().getBasics().get(0);
-
- assertNull(ormBasicMapping.getSpecifiedFetch());
- assertNull(basicResource.getFetch());
-
- //set fetch in the resource model, verify context model updated
- basicResource.setFetch(org.eclipse.jpt.core.resource.orm.FetchType.EAGER);
- assertEquals(FetchType.EAGER, ormBasicMapping.getSpecifiedFetch());
- assertEquals(org.eclipse.jpt.core.resource.orm.FetchType.EAGER, basicResource.getFetch());
-
- basicResource.setFetch(org.eclipse.jpt.core.resource.orm.FetchType.LAZY);
- assertEquals(FetchType.LAZY, ormBasicMapping.getSpecifiedFetch());
- assertEquals(org.eclipse.jpt.core.resource.orm.FetchType.LAZY, basicResource.getFetch());
-
- //set fetch to null in the resource model
- basicResource.setFetch(null);
- assertNull(ormBasicMapping.getSpecifiedFetch());
- assertNull(basicResource.getFetch());
- }
-
- public void testModifySpecifiedFetch() throws Exception {
- OrmPersistentType ormPersistentType = getEntityMappings().addPersistentType(MappingKeys.ENTITY_TYPE_MAPPING_KEY, "model.Foo");
- OrmPersistentAttribute ormPersistentAttribute = ormPersistentType.addSpecifiedPersistentAttribute(MappingKeys.BASIC_ATTRIBUTE_MAPPING_KEY, "basicMapping");
- OrmBasicMapping ormBasicMapping = (OrmBasicMapping) ormPersistentAttribute.getMapping();
- XmlBasic basicResource = getXmlEntityMappings().getEntities().get(0).getAttributes().getBasics().get(0);
-
- assertNull(ormBasicMapping.getSpecifiedFetch());
- assertNull(basicResource.getFetch());
-
- //set fetch in the context model, verify resource model updated
- ormBasicMapping.setSpecifiedFetch(FetchType.EAGER);
- assertEquals(org.eclipse.jpt.core.resource.orm.FetchType.EAGER, basicResource.getFetch());
- assertEquals(FetchType.EAGER, ormBasicMapping.getSpecifiedFetch());
-
- ormBasicMapping.setSpecifiedFetch(FetchType.LAZY);
- assertEquals(org.eclipse.jpt.core.resource.orm.FetchType.LAZY, basicResource.getFetch());
- assertEquals(FetchType.LAZY, ormBasicMapping.getSpecifiedFetch());
-
- //set fetch to null in the context model
- ormBasicMapping.setSpecifiedFetch(null);
- assertNull(basicResource.getFetch());
- assertNull(ormBasicMapping.getSpecifiedFetch());
- }
-
- public void testUpdateSpecifiedEnumerated() throws Exception {
- OrmPersistentType ormPersistentType = getEntityMappings().addPersistentType(MappingKeys.ENTITY_TYPE_MAPPING_KEY, "model.Foo");
- OrmPersistentAttribute ormPersistentAttribute = ormPersistentType.addSpecifiedPersistentAttribute(MappingKeys.BASIC_ATTRIBUTE_MAPPING_KEY, "basicMapping");
- OrmBasicMapping ormBasicMapping = (OrmBasicMapping) ormPersistentAttribute.getMapping();
- XmlBasic basicResource = getXmlEntityMappings().getEntities().get(0).getAttributes().getBasics().get(0);
-
- assertNull(ormBasicMapping.getSpecifiedConverter());
- assertNull(basicResource.getEnumerated());
-
- //set enumerated in the resource model, verify context model updated
- basicResource.setEnumerated(org.eclipse.jpt.core.resource.orm.EnumType.ORDINAL);
- assertEquals(EnumType.ORDINAL, ((EnumeratedConverter) ormBasicMapping.getConverter()).getSpecifiedEnumType());
- assertEquals(org.eclipse.jpt.core.resource.orm.EnumType.ORDINAL, basicResource.getEnumerated());
-
- basicResource.setEnumerated(org.eclipse.jpt.core.resource.orm.EnumType.STRING);
- assertEquals(EnumType.STRING, ((EnumeratedConverter) ormBasicMapping.getConverter()).getSpecifiedEnumType());
- assertEquals(org.eclipse.jpt.core.resource.orm.EnumType.STRING, basicResource.getEnumerated());
-
- //set enumerated to null in the resource model
- basicResource.setEnumerated(null);
- assertNull(ormBasicMapping.getSpecifiedConverter());
- assertNull(basicResource.getEnumerated());
- }
-
- public void testModifySpecifiedEnumerated() throws Exception {
- OrmPersistentType ormPersistentType = getEntityMappings().addPersistentType(MappingKeys.ENTITY_TYPE_MAPPING_KEY, "model.Foo");
- OrmPersistentAttribute ormPersistentAttribute = ormPersistentType.addSpecifiedPersistentAttribute(MappingKeys.BASIC_ATTRIBUTE_MAPPING_KEY, "basicMapping");
- OrmBasicMapping ormBasicMapping = (OrmBasicMapping) ormPersistentAttribute.getMapping();
- XmlBasic basicResource = getXmlEntityMappings().getEntities().get(0).getAttributes().getBasics().get(0);
-
- assertNull(ormBasicMapping.getSpecifiedConverter());
- assertNull(basicResource.getEnumerated());
-
- //set enumerated in the context model, verify resource model updated
- ormBasicMapping.setSpecifiedConverter(Converter.ENUMERATED_CONVERTER);
- ((EnumeratedConverter) ormBasicMapping.getConverter()).setSpecifiedEnumType(EnumType.ORDINAL);
- assertEquals(org.eclipse.jpt.core.resource.orm.EnumType.ORDINAL, basicResource.getEnumerated());
- assertEquals(EnumType.ORDINAL, ((EnumeratedConverter) ormBasicMapping.getConverter()).getSpecifiedEnumType());
-
- ((EnumeratedConverter) ormBasicMapping.getConverter()).setSpecifiedEnumType(EnumType.STRING);
- assertEquals(org.eclipse.jpt.core.resource.orm.EnumType.STRING, basicResource.getEnumerated());
- assertEquals(EnumType.STRING, ((EnumeratedConverter) ormBasicMapping.getConverter()).getSpecifiedEnumType());
-
- //set enumerated to null in the context model
- ormBasicMapping.setSpecifiedConverter(null);
- assertNull(basicResource.getEnumerated());
- assertNull(ormBasicMapping.getSpecifiedConverter());
- }
-
- public void testUpdateSpecifiedOptional() throws Exception {
- OrmPersistentType ormPersistentType = getEntityMappings().addPersistentType(MappingKeys.ENTITY_TYPE_MAPPING_KEY, "model.Foo");
- OrmPersistentAttribute ormPersistentAttribute = ormPersistentType.addSpecifiedPersistentAttribute(MappingKeys.BASIC_ATTRIBUTE_MAPPING_KEY, "basicMapping");
- OrmBasicMapping ormBasicMapping = (OrmBasicMapping) ormPersistentAttribute.getMapping();
- XmlBasic basicResource = getXmlEntityMappings().getEntities().get(0).getAttributes().getBasics().get(0);
-
- assertNull(ormBasicMapping.getSpecifiedOptional());
- assertNull(basicResource.getOptional());
-
- //set enumerated in the resource model, verify context model updated
- basicResource.setOptional(Boolean.TRUE);
- assertEquals(Boolean.TRUE, ormBasicMapping.getSpecifiedOptional());
- assertEquals(Boolean.TRUE, basicResource.getOptional());
-
- basicResource.setOptional(Boolean.FALSE);
- assertEquals(Boolean.FALSE, ormBasicMapping.getSpecifiedOptional());
- assertEquals(Boolean.FALSE, basicResource.getOptional());
-
- //set enumerated to null in the resource model
- basicResource.setOptional(null);
- assertNull(ormBasicMapping.getSpecifiedOptional());
- assertNull(basicResource.getOptional());
- }
-
- public void testModifySpecifiedOptional() throws Exception {
- OrmPersistentType ormPersistentType = getEntityMappings().addPersistentType(MappingKeys.ENTITY_TYPE_MAPPING_KEY, "model.Foo");
- OrmPersistentAttribute ormPersistentAttribute = ormPersistentType.addSpecifiedPersistentAttribute(MappingKeys.BASIC_ATTRIBUTE_MAPPING_KEY, "basicMapping");
- OrmBasicMapping ormBasicMapping = (OrmBasicMapping) ormPersistentAttribute.getMapping();
- XmlBasic basicResource = getXmlEntityMappings().getEntities().get(0).getAttributes().getBasics().get(0);
-
- assertNull(ormBasicMapping.getSpecifiedOptional());
- assertNull(basicResource.getOptional());
-
- //set enumerated in the context model, verify resource model updated
- ormBasicMapping.setSpecifiedOptional(Boolean.TRUE);
- assertEquals(Boolean.TRUE, basicResource.getOptional());
- assertEquals(Boolean.TRUE, ormBasicMapping.getSpecifiedOptional());
-
- ormBasicMapping.setSpecifiedOptional(Boolean.FALSE);
- assertEquals(Boolean.FALSE, basicResource.getOptional());
- assertEquals(Boolean.FALSE, ormBasicMapping.getSpecifiedOptional());
-
- //set enumerated to null in the context model
- ormBasicMapping.setSpecifiedOptional(null);
- assertNull(basicResource.getOptional());
- assertNull(ormBasicMapping.getSpecifiedOptional());
- }
-
- public void testUpdateSpecifiedLob() throws Exception {
- OrmPersistentType ormPersistentType = getEntityMappings().addPersistentType(MappingKeys.ENTITY_TYPE_MAPPING_KEY, "model.Foo");
- OrmPersistentAttribute ormPersistentAttribute = ormPersistentType.addSpecifiedPersistentAttribute(MappingKeys.BASIC_ATTRIBUTE_MAPPING_KEY, "basicMapping");
- OrmBasicMapping ormBasicMapping = (OrmBasicMapping) ormPersistentAttribute.getMapping();
- XmlBasic basicResource = getXmlEntityMappings().getEntities().get(0).getAttributes().getBasics().get(0);
-
- assertNull(ormBasicMapping.getSpecifiedConverter());
- assertFalse(basicResource.isLob());
-
- //set lob in the resource model, verify context model updated
- basicResource.setLob(true);
- assertEquals(Converter.LOB_CONVERTER, ormBasicMapping.getConverter().getType());
- assertTrue(basicResource.isLob());
-
- //set lob to null in the resource model
- basicResource.setLob(false);
- assertNull(ormBasicMapping.getSpecifiedConverter());
- assertFalse(basicResource.isLob());
- }
-
- public void testModifySpecifiedLob() throws Exception {
- OrmPersistentType ormPersistentType = getEntityMappings().addPersistentType(MappingKeys.ENTITY_TYPE_MAPPING_KEY, "model.Foo");
- OrmPersistentAttribute ormPersistentAttribute = ormPersistentType.addSpecifiedPersistentAttribute(MappingKeys.BASIC_ATTRIBUTE_MAPPING_KEY, "basicMapping");
- OrmBasicMapping ormBasicMapping = (OrmBasicMapping) ormPersistentAttribute.getMapping();
- XmlBasic basicResource = getXmlEntityMappings().getEntities().get(0).getAttributes().getBasics().get(0);
-
- assertNull(ormBasicMapping.getSpecifiedConverter());
- assertFalse(basicResource.isLob());
-
- //set lob in the context model, verify resource model updated
- ormBasicMapping.setSpecifiedConverter(Converter.LOB_CONVERTER);
- assertTrue(basicResource.isLob());
- assertEquals(Converter.LOB_CONVERTER, ormBasicMapping.getConverter().getType());
-
- //set lob to false in the context model
- ormBasicMapping.setSpecifiedConverter(null);
- assertFalse(basicResource.isLob());
- assertNull(ormBasicMapping.getSpecifiedConverter());
- }
-
- public void testUpdateTemporal() throws Exception {
- OrmPersistentType ormPersistentType = getEntityMappings().addPersistentType(MappingKeys.ENTITY_TYPE_MAPPING_KEY, "model.Foo");
- OrmPersistentAttribute ormPersistentAttribute = ormPersistentType.addSpecifiedPersistentAttribute(MappingKeys.BASIC_ATTRIBUTE_MAPPING_KEY, "basicMapping");
- OrmBasicMapping ormBasicMapping = (OrmBasicMapping) ormPersistentAttribute.getMapping();
- XmlBasic basicResource = getXmlEntityMappings().getEntities().get(0).getAttributes().getBasics().get(0);
-
- assertNull(ormBasicMapping.getSpecifiedConverter());
- assertNull(basicResource.getTemporal());
-
- //set temporal in the resource model, verify context model updated
- basicResource.setTemporal(org.eclipse.jpt.core.resource.orm.TemporalType.DATE);
- assertEquals(TemporalType.DATE, ((TemporalConverter) ormBasicMapping.getConverter()).getTemporalType());
- assertEquals(org.eclipse.jpt.core.resource.orm.TemporalType.DATE, basicResource.getTemporal());
-
- basicResource.setTemporal(org.eclipse.jpt.core.resource.orm.TemporalType.TIME);
- assertEquals(TemporalType.TIME, ((TemporalConverter) ormBasicMapping.getConverter()).getTemporalType());
- assertEquals(org.eclipse.jpt.core.resource.orm.TemporalType.TIME, basicResource.getTemporal());
-
- basicResource.setTemporal(org.eclipse.jpt.core.resource.orm.TemporalType.TIMESTAMP);
- assertEquals(TemporalType.TIMESTAMP, ((TemporalConverter) ormBasicMapping.getConverter()).getTemporalType());
- assertEquals(org.eclipse.jpt.core.resource.orm.TemporalType.TIMESTAMP, basicResource.getTemporal());
-
- //set temporal to null in the resource model
- basicResource.setTemporal(null);
- assertNull(ormBasicMapping.getSpecifiedConverter());
- assertNull(basicResource.getTemporal());
- }
-
- public void testModifyTemporal() throws Exception {
- OrmPersistentType ormPersistentType = getEntityMappings().addPersistentType(MappingKeys.ENTITY_TYPE_MAPPING_KEY, "model.Foo");
- OrmPersistentAttribute ormPersistentAttribute = ormPersistentType.addSpecifiedPersistentAttribute(MappingKeys.BASIC_ATTRIBUTE_MAPPING_KEY, "basicMapping");
- OrmBasicMapping ormBasicMapping = (OrmBasicMapping) ormPersistentAttribute.getMapping();
- XmlBasic basicResource = getXmlEntityMappings().getEntities().get(0).getAttributes().getBasics().get(0);
-
- assertNull(ormBasicMapping.getSpecifiedConverter());
- assertNull(basicResource.getTemporal());
-
- //set temporal in the context model, verify resource model updated
- ormBasicMapping.setSpecifiedConverter(Converter.TEMPORAL_CONVERTER);
- ((TemporalConverter) ormBasicMapping.getSpecifiedConverter()).setTemporalType(TemporalType.DATE);
- assertEquals(org.eclipse.jpt.core.resource.orm.TemporalType.DATE, basicResource.getTemporal());
- assertEquals(TemporalType.DATE, ((TemporalConverter) ormBasicMapping.getSpecifiedConverter()).getTemporalType());
-
- ((TemporalConverter) ormBasicMapping.getSpecifiedConverter()).setTemporalType(TemporalType.TIME);
- assertEquals(org.eclipse.jpt.core.resource.orm.TemporalType.TIME, basicResource.getTemporal());
- assertEquals(TemporalType.TIME, ((TemporalConverter) ormBasicMapping.getSpecifiedConverter()).getTemporalType());
-
- ((TemporalConverter) ormBasicMapping.getSpecifiedConverter()).setTemporalType(TemporalType.TIMESTAMP);
- assertEquals(org.eclipse.jpt.core.resource.orm.TemporalType.TIMESTAMP, basicResource.getTemporal());
- assertEquals(TemporalType.TIMESTAMP, ((TemporalConverter) ormBasicMapping.getSpecifiedConverter()).getTemporalType());
-
- //set temporal to null in the context model
- ormBasicMapping.setSpecifiedConverter(null);
- assertNull(basicResource.getTemporal());
- assertNull(ormBasicMapping.getSpecifiedConverter());
- }
-
- //TODO test defaults
- //TODO test overriding java mapping with a different mapping type in xml
-
-
- public void testBasicMappingNoUnderylingJavaAttribute() throws Exception {
- createTestEntityBasicMapping();
-
- OrmPersistentType ormPersistentType = getEntityMappings().addPersistentType(MappingKeys.ENTITY_TYPE_MAPPING_KEY, FULLY_QUALIFIED_TYPE_NAME);
- ormPersistentType.addSpecifiedPersistentAttribute(MappingKeys.BASIC_ATTRIBUTE_MAPPING_KEY, "foo");
- assertEquals(2, ormPersistentType.virtualAttributesSize());
-
- OrmPersistentAttribute ormPersistentAttribute = ormPersistentType.specifiedAttributes().next();
- OrmBasicMapping ormBasicMapping = (OrmBasicMapping) ormPersistentAttribute.getMapping();
-
- assertEquals("foo", ormBasicMapping.getName());
- assertNull(ormBasicMapping.getSpecifiedConverter());
- assertNull(ormBasicMapping.getSpecifiedFetch());
- assertNull(ormBasicMapping.getSpecifiedOptional());
- assertEquals(FetchType.EAGER, ormBasicMapping.getFetch());
- assertEquals(true, ormBasicMapping.isOptional());
-
-
- OrmColumn ormColumn = ormBasicMapping.getColumn();
- assertNull(ormColumn.getSpecifiedName());
- assertNull(ormColumn.getSpecifiedUnique());
- assertNull(ormColumn.getSpecifiedNullable());
- assertNull(ormColumn.getSpecifiedInsertable());
- assertNull(ormColumn.getSpecifiedUpdatable());
- assertNull(ormColumn.getColumnDefinition());
- assertNull(ormColumn.getSpecifiedTable());
- assertNull(ormColumn.getSpecifiedLength());
- assertNull(ormColumn.getSpecifiedPrecision());
- assertNull(ormColumn.getSpecifiedScale());
-
- assertEquals("foo", ormColumn.getDefaultName());
- assertEquals(false, ormColumn.isDefaultUnique());
- assertEquals(true, ormColumn.isDefaultNullable());
- assertEquals(true, ormColumn.isDefaultInsertable());
- assertEquals(true, ormColumn.isDefaultUpdatable());
- assertEquals(null, ormColumn.getColumnDefinition());
- assertEquals(TYPE_NAME, ormColumn.getDefaultTable());
- assertEquals(255, ormColumn.getDefaultLength());
- assertEquals(0, ormColumn.getDefaultPrecision());
- assertEquals(0, ormColumn.getDefaultScale());
- }
-
- //@Basic(fetch=FetchType.LAZY, optional=false)
- //@Column(name="MY_COLUMN", unique=true, nullable=false, insertable=false, updatable=false,
- // columnDefinition="COLUMN_DEFINITION", table="MY_TABLE", length=5, precision=6, scale=7)");
- //@Column(
- //@Lob
- //@Temporal(TemporalType.TIMESTAMP)
- //@Enumerated(EnumType.STRING)
- public void testVirtualMappingMetadataCompleteFalse() throws Exception {
- createTestEntityBasicMapping();
- OrmPersistentType ormPersistentType = getEntityMappings().addPersistentType(MappingKeys.ENTITY_TYPE_MAPPING_KEY, FULLY_QUALIFIED_TYPE_NAME);
- assertEquals(2, ormPersistentType.virtualAttributesSize());
- OrmPersistentAttribute ormPersistentAttribute = ormPersistentType.virtualAttributes().next();
-
- OrmBasicMapping ormBasicMapping = (OrmBasicMapping) ormPersistentAttribute.getMapping();
- assertEquals("id", ormBasicMapping.getName());
- assertEquals(Converter.ENUMERATED_CONVERTER, ormBasicMapping.getConverter().getType());
- assertEquals(EnumType.STRING, ((EnumeratedConverter) ormBasicMapping.getConverter()).getEnumType());
- assertEquals(FetchType.LAZY, ormBasicMapping.getSpecifiedFetch());
- assertEquals(Boolean.FALSE, ormBasicMapping.getSpecifiedOptional());
-
- OrmColumn ormColumn = ormBasicMapping.getColumn();
- assertEquals("MY_COLUMN", ormColumn.getSpecifiedName());
- assertEquals(Boolean.TRUE, ormColumn.getSpecifiedUnique());
- assertEquals(Boolean.FALSE, ormColumn.getSpecifiedNullable());
- assertEquals(Boolean.FALSE, ormColumn.getSpecifiedInsertable());
- assertEquals(Boolean.FALSE, ormColumn.getSpecifiedUpdatable());
- assertEquals("COLUMN_DEFINITION", ormColumn.getColumnDefinition());
- assertEquals("MY_TABLE", ormColumn.getSpecifiedTable());
- assertEquals(Integer.valueOf(5), ormColumn.getSpecifiedLength());
- assertEquals(Integer.valueOf(6), ormColumn.getSpecifiedPrecision());
- assertEquals(Integer.valueOf(7), ormColumn.getSpecifiedScale());
- }
-
- public void testVirtualMappingMetadataCompleteTrue() throws Exception {
- createTestEntityBasicMapping();
- OrmPersistentType ormPersistentType = getEntityMappings().addPersistentType(MappingKeys.ENTITY_TYPE_MAPPING_KEY, FULLY_QUALIFIED_TYPE_NAME);
- ormPersistentType.getMapping().setSpecifiedMetadataComplete(Boolean.TRUE);
- assertEquals(2, ormPersistentType.virtualAttributesSize());
- OrmPersistentAttribute ormPersistentAttribute = ormPersistentType.virtualAttributes().next();
-
- OrmBasicMapping ormBasicMapping = (OrmBasicMapping) ormPersistentAttribute.getMapping();
- assertEquals("id", ormBasicMapping.getName());
- assertEquals(Converter.NO_CONVERTER, ormBasicMapping.getConverter().getType());
- assertEquals(FetchType.EAGER, ormBasicMapping.getSpecifiedFetch());
- assertEquals(Boolean.TRUE, ormBasicMapping.getSpecifiedOptional());
-
- OrmColumn ormColumn = ormBasicMapping.getColumn();
- assertEquals("id", ormColumn.getSpecifiedName());
- assertEquals(Boolean.FALSE, ormColumn.getSpecifiedUnique());
- assertEquals(Boolean.TRUE, ormColumn.getSpecifiedNullable());
- assertEquals(Boolean.TRUE, ormColumn.getSpecifiedInsertable());
- assertEquals(Boolean.TRUE, ormColumn.getSpecifiedUpdatable());
- assertNull(ormColumn.getColumnDefinition());
- assertEquals(TYPE_NAME, ormColumn.getSpecifiedTable());
- assertEquals(Integer.valueOf(255), ormColumn.getSpecifiedLength());
- assertEquals(Integer.valueOf(0), ormColumn.getSpecifiedPrecision());
- assertEquals(Integer.valueOf(0), ormColumn.getSpecifiedScale());
- }
-
- public void testSpecifiedMapping() throws Exception {
- createTestEntityBasicMapping();
-
- OrmPersistentType ormPersistentType = getEntityMappings().addPersistentType(MappingKeys.ENTITY_TYPE_MAPPING_KEY, FULLY_QUALIFIED_TYPE_NAME);
- ormPersistentType.addSpecifiedPersistentAttribute(MappingKeys.BASIC_ATTRIBUTE_MAPPING_KEY, "id");
- assertEquals(1, ormPersistentType.virtualAttributesSize());
-
- OrmPersistentAttribute ormPersistentAttribute = ormPersistentType.specifiedAttributes().next();
- OrmBasicMapping ormBasicMapping = (OrmBasicMapping) ormPersistentAttribute.getMapping();
-
- assertEquals("id", ormBasicMapping.getName());
- assertEquals(Converter.NO_CONVERTER, ormBasicMapping.getConverter().getType());
- assertNull(ormBasicMapping.getSpecifiedFetch());
- assertNull(ormBasicMapping.getSpecifiedOptional());
- assertEquals(FetchType.EAGER, ormBasicMapping.getDefaultFetch());
- assertEquals(true, ormBasicMapping.isDefaultOptional());
-
- OrmColumn ormColumn = ormBasicMapping.getColumn();
- assertNull(ormColumn.getSpecifiedName());
- assertNull(ormColumn.getSpecifiedUnique());
- assertNull(ormColumn.getSpecifiedNullable());
- assertNull(ormColumn.getSpecifiedInsertable());
- assertNull(ormColumn.getSpecifiedUpdatable());
- assertNull(ormColumn.getColumnDefinition());
- assertNull(ormColumn.getSpecifiedTable());
- assertNull(ormColumn.getSpecifiedLength());
- assertNull(ormColumn.getSpecifiedPrecision());
- assertNull(ormColumn.getSpecifiedScale());
-
- assertEquals("id", ormColumn.getDefaultName());
- assertEquals(false, ormColumn.isDefaultUnique());
- assertEquals(true, ormColumn.isDefaultNullable());
- assertEquals(true, ormColumn.isDefaultInsertable());
- assertEquals(true, ormColumn.isDefaultUpdatable());
- assertEquals(null, ormColumn.getColumnDefinition());
- assertEquals(TYPE_NAME, ormColumn.getDefaultTable());
- assertEquals(255, ormColumn.getDefaultLength());
- assertEquals(0, ormColumn.getDefaultPrecision());
- assertEquals(0, ormColumn.getDefaultScale());
-
- }
- //3 things tested above
- //1. virtual mapping metadata complete=false - defaults are taken from the java annotations
- //2. virtual mapping metadata complete=true - defaults are taken from java defaults,annotations ignored
- //3. specified mapping (metadata complete=true/false - defaults are taken from java annotations
-
-
- public void testBasicMorphToIdMapping() throws Exception {
- createTestEntityBasicMapping();
- OrmPersistentType ormPersistentType = getEntityMappings().addPersistentType(MappingKeys.ENTITY_TYPE_MAPPING_KEY, FULLY_QUALIFIED_TYPE_NAME);
- OrmPersistentAttribute ormPersistentAttribute = ormPersistentType.addSpecifiedPersistentAttribute(MappingKeys.BASIC_ATTRIBUTE_MAPPING_KEY, "basic");
-
- BasicMapping basicMapping = (BasicMapping) ormPersistentAttribute.getMapping();
- assertFalse(basicMapping.isDefault());
- basicMapping.getColumn().setSpecifiedName("FOO");
- basicMapping.setSpecifiedConverter(Converter.TEMPORAL_CONVERTER);
- ((TemporalConverter) basicMapping.getSpecifiedConverter()).setTemporalType(TemporalType.TIME);
- basicMapping.setSpecifiedFetch(FetchType.EAGER);
- basicMapping.setSpecifiedOptional(Boolean.FALSE);
- assertFalse(basicMapping.isDefault());
-
- ormPersistentAttribute.setSpecifiedMappingKey(MappingKeys.ID_ATTRIBUTE_MAPPING_KEY);
- assertEquals(1, ormPersistentType.specifiedAttributesSize());
- assertEquals(ormPersistentAttribute, ormPersistentType.specifiedAttributes().next());
- assertTrue(ormPersistentAttribute.getMapping() instanceof IdMapping);
- assertEquals("basic", ormPersistentAttribute.getMapping().getName());
- assertEquals("FOO", ((IdMapping) ormPersistentAttribute.getMapping()).getColumn().getSpecifiedName());
- }
-
- public void testBasicMorphToVersionMapping() throws Exception {
- createTestEntityBasicMapping();
- OrmPersistentType ormPersistentType = getEntityMappings().addPersistentType(MappingKeys.ENTITY_TYPE_MAPPING_KEY, FULLY_QUALIFIED_TYPE_NAME);
- OrmPersistentAttribute ormPersistentAttribute = ormPersistentType.addSpecifiedPersistentAttribute(MappingKeys.BASIC_ATTRIBUTE_MAPPING_KEY, "basic");
-
- BasicMapping basicMapping = (BasicMapping) ormPersistentAttribute.getMapping();
- assertFalse(basicMapping.isDefault());
- basicMapping.getColumn().setSpecifiedName("FOO");
- basicMapping.setSpecifiedConverter(Converter.TEMPORAL_CONVERTER);
- ((TemporalConverter) basicMapping.getSpecifiedConverter()).setTemporalType(TemporalType.TIME);
- basicMapping.setSpecifiedFetch(FetchType.EAGER);
- basicMapping.setSpecifiedOptional(Boolean.FALSE);
- assertFalse(basicMapping.isDefault());
-
- ormPersistentAttribute.setSpecifiedMappingKey(MappingKeys.VERSION_ATTRIBUTE_MAPPING_KEY);
- assertEquals(1, ormPersistentType.specifiedAttributesSize());
- assertEquals(ormPersistentAttribute, ormPersistentType.specifiedAttributes().next());
- assertTrue(ormPersistentAttribute.getMapping() instanceof VersionMapping);
- assertEquals("basic", ormPersistentAttribute.getMapping().getName());
- assertEquals("FOO", ((VersionMapping) ormPersistentAttribute.getMapping()).getColumn().getSpecifiedName());
- }
-
- public void testBasicMorphToTransientMapping() throws Exception {
- createTestEntityBasicMapping();
- OrmPersistentType ormPersistentType = getEntityMappings().addPersistentType(MappingKeys.ENTITY_TYPE_MAPPING_KEY, FULLY_QUALIFIED_TYPE_NAME);
- OrmPersistentAttribute ormPersistentAttribute = ormPersistentType.addSpecifiedPersistentAttribute(MappingKeys.BASIC_ATTRIBUTE_MAPPING_KEY, "basic");
-
- BasicMapping basicMapping = (BasicMapping) ormPersistentAttribute.getMapping();
- assertFalse(basicMapping.isDefault());
- basicMapping.getColumn().setSpecifiedName("FOO");
- basicMapping.setSpecifiedConverter(Converter.TEMPORAL_CONVERTER);
- ((TemporalConverter) basicMapping.getSpecifiedConverter()).setTemporalType(TemporalType.TIME);
- basicMapping.setSpecifiedFetch(FetchType.EAGER);
- basicMapping.setSpecifiedOptional(Boolean.FALSE);
- assertFalse(basicMapping.isDefault());
-
- ormPersistentAttribute.setSpecifiedMappingKey(MappingKeys.TRANSIENT_ATTRIBUTE_MAPPING_KEY);
- assertEquals(1, ormPersistentType.specifiedAttributesSize());
- assertEquals(ormPersistentAttribute, ormPersistentType.specifiedAttributes().next());
- assertTrue(ormPersistentAttribute.getMapping() instanceof TransientMapping);
- assertEquals("basic", ormPersistentAttribute.getMapping().getName());
- }
-
- public void testBasicMorphToEmbeddedMapping() throws Exception {
- createTestEntityBasicMapping();
- OrmPersistentType ormPersistentType = getEntityMappings().addPersistentType(MappingKeys.ENTITY_TYPE_MAPPING_KEY, FULLY_QUALIFIED_TYPE_NAME);
- OrmPersistentAttribute ormPersistentAttribute = ormPersistentType.addSpecifiedPersistentAttribute(MappingKeys.BASIC_ATTRIBUTE_MAPPING_KEY, "basic");
-
- BasicMapping basicMapping = (BasicMapping) ormPersistentAttribute.getMapping();
- assertFalse(basicMapping.isDefault());
- basicMapping.getColumn().setSpecifiedName("FOO");
- basicMapping.setSpecifiedConverter(Converter.TEMPORAL_CONVERTER);
- ((TemporalConverter) basicMapping.getSpecifiedConverter()).setTemporalType(TemporalType.TIME);
- basicMapping.setSpecifiedFetch(FetchType.EAGER);
- basicMapping.setSpecifiedOptional(Boolean.FALSE);
- assertFalse(basicMapping.isDefault());
-
- ormPersistentAttribute.setSpecifiedMappingKey(MappingKeys.EMBEDDED_ATTRIBUTE_MAPPING_KEY);
- assertEquals(1, ormPersistentType.specifiedAttributesSize());
- assertEquals(ormPersistentAttribute, ormPersistentType.specifiedAttributes().next());
- assertTrue(ormPersistentAttribute.getMapping() instanceof EmbeddedMapping);
- assertEquals("basic", ormPersistentAttribute.getMapping().getName());
- }
-
- public void testBasicMorphToEmbeddedIdMapping() throws Exception {
- createTestEntityBasicMapping();
- OrmPersistentType ormPersistentType = getEntityMappings().addPersistentType(MappingKeys.ENTITY_TYPE_MAPPING_KEY, FULLY_QUALIFIED_TYPE_NAME);
- OrmPersistentAttribute ormPersistentAttribute = ormPersistentType.addSpecifiedPersistentAttribute(MappingKeys.BASIC_ATTRIBUTE_MAPPING_KEY, "basic");
-
- BasicMapping basicMapping = (BasicMapping) ormPersistentAttribute.getMapping();
- assertFalse(basicMapping.isDefault());
- basicMapping.getColumn().setSpecifiedName("FOO");
- basicMapping.setSpecifiedConverter(Converter.TEMPORAL_CONVERTER);
- ((TemporalConverter) basicMapping.getSpecifiedConverter()).setTemporalType(TemporalType.TIME);
- basicMapping.setSpecifiedFetch(FetchType.EAGER);
- basicMapping.setSpecifiedOptional(Boolean.FALSE);
- assertFalse(basicMapping.isDefault());
-
- ormPersistentAttribute.setSpecifiedMappingKey(MappingKeys.EMBEDDED_ID_ATTRIBUTE_MAPPING_KEY);
- assertEquals(1, ormPersistentType.specifiedAttributesSize());
- assertEquals(ormPersistentAttribute, ormPersistentType.specifiedAttributes().next());
- assertTrue(ormPersistentAttribute.getMapping() instanceof EmbeddedIdMapping);
- assertEquals("basic", ormPersistentAttribute.getMapping().getName());
- }
-
- public void testBasicMorphToOneToOneMapping() throws Exception {
- createTestEntityBasicMapping();
- OrmPersistentType ormPersistentType = getEntityMappings().addPersistentType(MappingKeys.ENTITY_TYPE_MAPPING_KEY, FULLY_QUALIFIED_TYPE_NAME);
- OrmPersistentAttribute ormPersistentAttribute = ormPersistentType.addSpecifiedPersistentAttribute(MappingKeys.BASIC_ATTRIBUTE_MAPPING_KEY, "basic");
-
- BasicMapping basicMapping = (BasicMapping) ormPersistentAttribute.getMapping();
- assertFalse(basicMapping.isDefault());
- basicMapping.getColumn().setSpecifiedName("FOO");
- basicMapping.setSpecifiedConverter(Converter.TEMPORAL_CONVERTER);
- ((TemporalConverter) basicMapping.getSpecifiedConverter()).setTemporalType(TemporalType.TIME);
- basicMapping.setSpecifiedFetch(FetchType.EAGER);
- basicMapping.setSpecifiedOptional(Boolean.FALSE);
- assertFalse(basicMapping.isDefault());
-
- ormPersistentAttribute.setSpecifiedMappingKey(MappingKeys.ONE_TO_ONE_ATTRIBUTE_MAPPING_KEY);
- assertEquals(1, ormPersistentType.specifiedAttributesSize());
- assertEquals(ormPersistentAttribute, ormPersistentType.specifiedAttributes().next());
- assertTrue(ormPersistentAttribute.getMapping() instanceof OneToOneMapping);
- assertEquals("basic", ormPersistentAttribute.getMapping().getName());
- }
-
- public void testBasicMorphToOneToManyMapping() throws Exception {
- createTestEntityBasicMapping();
- OrmPersistentType ormPersistentType = getEntityMappings().addPersistentType(MappingKeys.ENTITY_TYPE_MAPPING_KEY, FULLY_QUALIFIED_TYPE_NAME);
- OrmPersistentAttribute ormPersistentAttribute = ormPersistentType.addSpecifiedPersistentAttribute(MappingKeys.BASIC_ATTRIBUTE_MAPPING_KEY, "basic");
-
- BasicMapping basicMapping = (BasicMapping) ormPersistentAttribute.getMapping();
- assertFalse(basicMapping.isDefault());
- basicMapping.getColumn().setSpecifiedName("FOO");
- basicMapping.setSpecifiedConverter(Converter.TEMPORAL_CONVERTER);
- ((TemporalConverter) basicMapping.getSpecifiedConverter()).setTemporalType(TemporalType.TIME);
- basicMapping.setSpecifiedFetch(FetchType.EAGER);
- basicMapping.setSpecifiedOptional(Boolean.FALSE);
- assertFalse(basicMapping.isDefault());
-
- ormPersistentAttribute.setSpecifiedMappingKey(MappingKeys.ONE_TO_MANY_ATTRIBUTE_MAPPING_KEY);
- assertEquals(1, ormPersistentType.specifiedAttributesSize());
- assertEquals(ormPersistentAttribute, ormPersistentType.specifiedAttributes().next());
- assertTrue(ormPersistentAttribute.getMapping() instanceof OneToManyMapping);
- assertEquals("basic", ormPersistentAttribute.getMapping().getName());
- }
-
- public void testBasicMorphToManyToOneMapping() throws Exception {
- createTestEntityBasicMapping();
- OrmPersistentType ormPersistentType = getEntityMappings().addPersistentType(MappingKeys.ENTITY_TYPE_MAPPING_KEY, FULLY_QUALIFIED_TYPE_NAME);
- OrmPersistentAttribute ormPersistentAttribute = ormPersistentType.addSpecifiedPersistentAttribute(MappingKeys.BASIC_ATTRIBUTE_MAPPING_KEY, "basic");
-
- BasicMapping basicMapping = (BasicMapping) ormPersistentAttribute.getMapping();
- assertFalse(basicMapping.isDefault());
- basicMapping.getColumn().setSpecifiedName("FOO");
- basicMapping.setSpecifiedConverter(Converter.TEMPORAL_CONVERTER);
- ((TemporalConverter) basicMapping.getSpecifiedConverter()).setTemporalType(TemporalType.TIME);
- basicMapping.setSpecifiedFetch(FetchType.EAGER);
- basicMapping.setSpecifiedOptional(Boolean.FALSE);
- assertFalse(basicMapping.isDefault());
-
- ormPersistentAttribute.setSpecifiedMappingKey(MappingKeys.MANY_TO_ONE_ATTRIBUTE_MAPPING_KEY);
- assertEquals(1, ormPersistentType.specifiedAttributesSize());
- assertEquals(ormPersistentAttribute, ormPersistentType.specifiedAttributes().next());
- assertTrue(ormPersistentAttribute.getMapping() instanceof ManyToOneMapping);
- assertEquals("basic", ormPersistentAttribute.getMapping().getName());
- }
-
- public void testBasicMorphToManyToManyMapping() throws Exception {
- createTestEntityBasicMapping();
- OrmPersistentType ormPersistentType = getEntityMappings().addPersistentType(MappingKeys.ENTITY_TYPE_MAPPING_KEY, FULLY_QUALIFIED_TYPE_NAME);
- OrmPersistentAttribute ormPersistentAttribute = ormPersistentType.addSpecifiedPersistentAttribute(MappingKeys.BASIC_ATTRIBUTE_MAPPING_KEY, "basic");
-
- BasicMapping basicMapping = (BasicMapping) ormPersistentAttribute.getMapping();
- assertFalse(basicMapping.isDefault());
- basicMapping.getColumn().setSpecifiedName("FOO");
- basicMapping.setSpecifiedConverter(Converter.TEMPORAL_CONVERTER);
- ((TemporalConverter) basicMapping.getSpecifiedConverter()).setTemporalType(TemporalType.TIME);
- basicMapping.setSpecifiedFetch(FetchType.EAGER);
- basicMapping.setSpecifiedOptional(Boolean.FALSE);
- assertFalse(basicMapping.isDefault());
-
- ormPersistentAttribute.setSpecifiedMappingKey(MappingKeys.MANY_TO_MANY_ATTRIBUTE_MAPPING_KEY);
- assertEquals(1, ormPersistentType.specifiedAttributesSize());
- assertEquals(ormPersistentAttribute, ormPersistentType.specifiedAttributes().next());
- assertTrue(ormPersistentAttribute.getMapping() instanceof ManyToManyMapping);
- assertEquals("basic", ormPersistentAttribute.getMapping().getName());
- }
-} \ No newline at end of file
diff --git a/jpa/tests/org.eclipse.jpt.core.tests/src/org/eclipse/jpt/core/tests/internal/context/orm/OrmCascadeTests.java b/jpa/tests/org.eclipse.jpt.core.tests/src/org/eclipse/jpt/core/tests/internal/context/orm/OrmCascadeTests.java
deleted file mode 100644
index d9a7c7b180..0000000000
--- a/jpa/tests/org.eclipse.jpt.core.tests/src/org/eclipse/jpt/core/tests/internal/context/orm/OrmCascadeTests.java
+++ /dev/null
@@ -1,280 +0,0 @@
-/*******************************************************************************
- * Copyright (c) 2007, 2009 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.
- *
- * Contributors:
- * Oracle - initial API and implementation
- ******************************************************************************/
-package org.eclipse.jpt.core.tests.internal.context.orm;
-
-import org.eclipse.jpt.core.JptCorePlugin;
-import org.eclipse.jpt.core.MappingKeys;
-import org.eclipse.jpt.core.context.Cascade;
-import org.eclipse.jpt.core.context.orm.OrmOneToOneMapping;
-import org.eclipse.jpt.core.context.orm.OrmPersistentAttribute;
-import org.eclipse.jpt.core.context.orm.OrmPersistentType;
-import org.eclipse.jpt.core.resource.orm.OrmFactory;
-import org.eclipse.jpt.core.resource.orm.XmlOneToOne;
-import org.eclipse.jpt.core.resource.persistence.PersistenceFactory;
-import org.eclipse.jpt.core.resource.persistence.XmlMappingFileRef;
-import org.eclipse.jpt.core.tests.internal.context.ContextModelTestCase;
-
-@SuppressWarnings("nls")
-public class OrmCascadeTests extends ContextModelTestCase
-{
- public OrmCascadeTests(String name) {
- super(name);
- }
-
-
- @Override
- protected void setUp() throws Exception {
- super.setUp();
- XmlMappingFileRef mappingFileRef = PersistenceFactory.eINSTANCE.createXmlMappingFileRef();
- mappingFileRef.setFileName(JptCorePlugin.DEFAULT_ORM_XML_FILE_PATH);
- getXmlPersistenceUnit().getMappingFiles().add(mappingFileRef);
- getPersistenceXmlResource().save(null);
- }
-
- public void testUpdateCascadeAll() throws Exception {
- OrmPersistentType ormPersistentType = getEntityMappings().addPersistentType(MappingKeys.ENTITY_TYPE_MAPPING_KEY, "model.Foo");
- OrmPersistentAttribute ormPersistentAttribute = ormPersistentType.addSpecifiedPersistentAttribute(MappingKeys.ONE_TO_ONE_ATTRIBUTE_MAPPING_KEY, "oneToOneMapping");
- OrmOneToOneMapping ormOneToOneMapping = (OrmOneToOneMapping) ormPersistentAttribute.getMapping();
- XmlOneToOne oneToOne = getXmlEntityMappings().getEntities().get(0).getAttributes().getOneToOnes().get(0);
- Cascade cascade = ormOneToOneMapping.getCascade();
-
- assertEquals(false, cascade.isAll());
- assertNull(oneToOne.getCascade());
-
- //set cascade in the resource model, verify context model does not change
- oneToOne.setCascade(OrmFactory.eINSTANCE.createCascadeType());
- assertEquals(false, cascade.isAll());
- assertNotNull(oneToOne.getCascade());
-
- //set all in the resource model, verify context model updated
- oneToOne.getCascade().setCascadeAll(true);
- assertEquals(true, cascade.isAll());
- assertEquals(true, oneToOne.getCascade().isCascadeAll());
-
- //set all to false in the resource model
- oneToOne.getCascade().setCascadeAll(false);
- assertEquals(false, cascade.isAll());
- assertEquals(false, oneToOne.getCascade().isCascadeAll());
- }
-
- public void testModifyCascadeAll() throws Exception {
- OrmPersistentType ormPersistentType = getEntityMappings().addPersistentType(MappingKeys.ENTITY_TYPE_MAPPING_KEY, "model.Foo");
- OrmPersistentAttribute ormPersistentAttribute = ormPersistentType.addSpecifiedPersistentAttribute(MappingKeys.ONE_TO_ONE_ATTRIBUTE_MAPPING_KEY, "oneToOneMapping");
- OrmOneToOneMapping ormOneToOneMapping = (OrmOneToOneMapping) ormPersistentAttribute.getMapping();
- XmlOneToOne oneToOne = getXmlEntityMappings().getEntities().get(0).getAttributes().getOneToOnes().get(0);
-
- Cascade cascade = ormOneToOneMapping.getCascade();
-
- assertEquals(false, cascade.isAll());
- assertNull(oneToOne.getCascade());
-
- //set all in the context model, verify resource model updated
- cascade.setAll(true);
- assertEquals(true, cascade.isAll());
- assertEquals(true, oneToOne.getCascade().isCascadeAll());
-
- //set all to false in the context model
- cascade.setAll(false);
- assertEquals(false, cascade.isAll());
- assertNull(oneToOne.getCascade());
- }
-
- public void testUpdateCascadePersist() throws Exception {
- OrmPersistentType ormPersistentType = getEntityMappings().addPersistentType(MappingKeys.ENTITY_TYPE_MAPPING_KEY, "model.Foo");
- OrmPersistentAttribute ormPersistentAttribute = ormPersistentType.addSpecifiedPersistentAttribute(MappingKeys.ONE_TO_ONE_ATTRIBUTE_MAPPING_KEY, "oneToOneMapping");
- OrmOneToOneMapping ormOneToOneMapping = (OrmOneToOneMapping) ormPersistentAttribute.getMapping();
- XmlOneToOne oneToOne = getXmlEntityMappings().getEntities().get(0).getAttributes().getOneToOnes().get(0);
- Cascade cascade = ormOneToOneMapping.getCascade();
-
- assertEquals(false, cascade.isPersist());
- assertNull(oneToOne.getCascade());
-
- //set cascade in the resource model, verify context model does not change
- oneToOne.setCascade(OrmFactory.eINSTANCE.createCascadeType());
- assertEquals(false, cascade.isPersist());
- assertNotNull(oneToOne.getCascade());
-
- //set Persist in the resource model, verify context model updated
- oneToOne.getCascade().setCascadePersist(true);
- assertEquals(true, cascade.isPersist());
- assertEquals(true, oneToOne.getCascade().isCascadePersist());
-
- //set Persist to false in the resource model
- oneToOne.getCascade().setCascadePersist(false);
- assertEquals(false, cascade.isPersist());
- assertEquals(false, oneToOne.getCascade().isCascadePersist());
- }
-
- public void testModifyCascadePersist() throws Exception {
- OrmPersistentType ormPersistentType = getEntityMappings().addPersistentType(MappingKeys.ENTITY_TYPE_MAPPING_KEY, "model.Foo");
- OrmPersistentAttribute ormPersistentAttribute = ormPersistentType.addSpecifiedPersistentAttribute(MappingKeys.ONE_TO_ONE_ATTRIBUTE_MAPPING_KEY, "oneToOneMapping");
- OrmOneToOneMapping ormOneToOneMapping = (OrmOneToOneMapping) ormPersistentAttribute.getMapping();
- XmlOneToOne oneToOne = getXmlEntityMappings().getEntities().get(0).getAttributes().getOneToOnes().get(0);
-
- Cascade cascade = ormOneToOneMapping.getCascade();
-
- assertEquals(false, cascade.isPersist());
- assertNull(oneToOne.getCascade());
-
- //set Persist in the context model, verify resource model updated
- cascade.setPersist(true);
- assertEquals(true, cascade.isPersist());
- assertEquals(true, oneToOne.getCascade().isCascadePersist());
-
- //set Persist to false in the context model
- cascade.setPersist(false);
- assertEquals(false, cascade.isPersist());
- assertNull(oneToOne.getCascade());
- }
-
- public void testUpdateCascadeMerge() throws Exception {
- OrmPersistentType ormPersistentType = getEntityMappings().addPersistentType(MappingKeys.ENTITY_TYPE_MAPPING_KEY, "model.Foo");
- OrmPersistentAttribute ormPersistentAttribute = ormPersistentType.addSpecifiedPersistentAttribute(MappingKeys.ONE_TO_ONE_ATTRIBUTE_MAPPING_KEY, "oneToOneMapping");
- OrmOneToOneMapping ormOneToOneMapping = (OrmOneToOneMapping) ormPersistentAttribute.getMapping();
- XmlOneToOne oneToOne = getXmlEntityMappings().getEntities().get(0).getAttributes().getOneToOnes().get(0);
- Cascade cascade = ormOneToOneMapping.getCascade();
-
- assertEquals(false, cascade.isMerge());
- assertNull(oneToOne.getCascade());
-
- //set cascade in the resource model, verify context model does not change
- oneToOne.setCascade(OrmFactory.eINSTANCE.createCascadeType());
- assertEquals(false, cascade.isMerge());
- assertNotNull(oneToOne.getCascade());
-
- //set Merge in the resource model, verify context model updated
- oneToOne.getCascade().setCascadeMerge(true);
- assertEquals(true, cascade.isMerge());
- assertEquals(true, oneToOne.getCascade().isCascadeMerge());
-
- //set Merge to false in the resource model
- oneToOne.getCascade().setCascadeMerge(false);
- assertEquals(false, cascade.isMerge());
- assertEquals(false, oneToOne.getCascade().isCascadeMerge());
- }
-
- public void testModifyCascadeMerge() throws Exception {
- OrmPersistentType ormPersistentType = getEntityMappings().addPersistentType(MappingKeys.ENTITY_TYPE_MAPPING_KEY, "model.Foo");
- OrmPersistentAttribute ormPersistentAttribute = ormPersistentType.addSpecifiedPersistentAttribute(MappingKeys.ONE_TO_ONE_ATTRIBUTE_MAPPING_KEY, "oneToOneMapping");
- OrmOneToOneMapping ormOneToOneMapping = (OrmOneToOneMapping) ormPersistentAttribute.getMapping();
- XmlOneToOne oneToOne = getXmlEntityMappings().getEntities().get(0).getAttributes().getOneToOnes().get(0);
-
- Cascade cascade = ormOneToOneMapping.getCascade();
-
- assertEquals(false, cascade.isMerge());
- assertNull(oneToOne.getCascade());
-
- //set Merge in the context model, verify resource model updated
- cascade.setMerge(true);
- assertEquals(true, cascade.isMerge());
- assertEquals(true, oneToOne.getCascade().isCascadeMerge());
-
- //set Merge to false in the context model
- cascade.setMerge(false);
- assertEquals(false, cascade.isMerge());
- assertNull(oneToOne.getCascade());
- }
-
- public void testUpdateCascadeRemove() throws Exception {
- OrmPersistentType ormPersistentType = getEntityMappings().addPersistentType(MappingKeys.ENTITY_TYPE_MAPPING_KEY, "model.Foo");
- OrmPersistentAttribute ormPersistentAttribute = ormPersistentType.addSpecifiedPersistentAttribute(MappingKeys.ONE_TO_ONE_ATTRIBUTE_MAPPING_KEY, "oneToOneMapping");
- OrmOneToOneMapping ormOneToOneMapping = (OrmOneToOneMapping) ormPersistentAttribute.getMapping();
- XmlOneToOne oneToOne = getXmlEntityMappings().getEntities().get(0).getAttributes().getOneToOnes().get(0);
- Cascade cascade = ormOneToOneMapping.getCascade();
-
- assertEquals(false, cascade.isRemove());
- assertNull(oneToOne.getCascade());
-
- //set cascade in the resource model, verify context model does not change
- oneToOne.setCascade(OrmFactory.eINSTANCE.createCascadeType());
- assertEquals(false, cascade.isRemove());
- assertNotNull(oneToOne.getCascade());
-
- //set Remove in the resource model, verify context model updated
- oneToOne.getCascade().setCascadeRemove(true);
- assertEquals(true, cascade.isRemove());
- assertEquals(true, oneToOne.getCascade().isCascadeRemove());
-
- //set Remove to false in the resource model
- oneToOne.getCascade().setCascadeRemove(false);
- assertEquals(false, cascade.isRemove());
- assertEquals(false, oneToOne.getCascade().isCascadeRemove());
- }
-
- public void testModifyCascadeRemove() throws Exception {
- OrmPersistentType ormPersistentType = getEntityMappings().addPersistentType(MappingKeys.ENTITY_TYPE_MAPPING_KEY, "model.Foo");
- OrmPersistentAttribute ormPersistentAttribute = ormPersistentType.addSpecifiedPersistentAttribute(MappingKeys.ONE_TO_ONE_ATTRIBUTE_MAPPING_KEY, "oneToOneMapping");
- OrmOneToOneMapping ormOneToOneMapping = (OrmOneToOneMapping) ormPersistentAttribute.getMapping();
- XmlOneToOne oneToOne = getXmlEntityMappings().getEntities().get(0).getAttributes().getOneToOnes().get(0);
-
- Cascade cascade = ormOneToOneMapping.getCascade();
-
- assertEquals(false, cascade.isRemove());
- assertNull(oneToOne.getCascade());
-
- //set Remove in the context model, verify resource model updated
- cascade.setRemove(true);
- assertEquals(true, cascade.isRemove());
- assertEquals(true, oneToOne.getCascade().isCascadeRemove());
-
- //set Remove to false in the context model
- cascade.setRemove(false);
- assertEquals(false, cascade.isRemove());
- assertNull(oneToOne.getCascade());
- }
-
- public void testUpdateCascadeRefresh() throws Exception {
- OrmPersistentType ormPersistentType = getEntityMappings().addPersistentType(MappingKeys.ENTITY_TYPE_MAPPING_KEY, "model.Foo");
- OrmPersistentAttribute ormPersistentAttribute = ormPersistentType.addSpecifiedPersistentAttribute(MappingKeys.ONE_TO_ONE_ATTRIBUTE_MAPPING_KEY, "oneToOneMapping");
- OrmOneToOneMapping ormOneToOneMapping = (OrmOneToOneMapping) ormPersistentAttribute.getMapping();
- XmlOneToOne oneToOne = getXmlEntityMappings().getEntities().get(0).getAttributes().getOneToOnes().get(0);
- Cascade cascade = ormOneToOneMapping.getCascade();
-
- assertEquals(false, cascade.isRefresh());
- assertNull(oneToOne.getCascade());
-
- //set cascade in the resource model, verify context model does not change
- oneToOne.setCascade(OrmFactory.eINSTANCE.createCascadeType());
- assertEquals(false, cascade.isRefresh());
- assertNotNull(oneToOne.getCascade());
-
- //set Refresh in the resource model, verify context model updated
- oneToOne.getCascade().setCascadeRefresh(true);
- assertEquals(true, cascade.isRefresh());
- assertEquals(true, oneToOne.getCascade().isCascadeRefresh());
-
- //set Refresh to false in the resource model
- oneToOne.getCascade().setCascadeRefresh(false);
- assertEquals(false, cascade.isRefresh());
- assertEquals(false, oneToOne.getCascade().isCascadeRefresh());
- }
-
- public void testModifyCascadeRefresh() throws Exception {
- OrmPersistentType ormPersistentType = getEntityMappings().addPersistentType(MappingKeys.ENTITY_TYPE_MAPPING_KEY, "model.Foo");
- OrmPersistentAttribute ormPersistentAttribute = ormPersistentType.addSpecifiedPersistentAttribute(MappingKeys.ONE_TO_ONE_ATTRIBUTE_MAPPING_KEY, "oneToOneMapping");
- OrmOneToOneMapping ormOneToOneMapping = (OrmOneToOneMapping) ormPersistentAttribute.getMapping();
- XmlOneToOne oneToOne = getXmlEntityMappings().getEntities().get(0).getAttributes().getOneToOnes().get(0);
-
- Cascade cascade = ormOneToOneMapping.getCascade();
-
- assertEquals(false, cascade.isRefresh());
- assertNull(oneToOne.getCascade());
-
- //set Refresh in the context model, verify resource model updated
- cascade.setRefresh(true);
- assertEquals(true, cascade.isRefresh());
- assertEquals(true, oneToOne.getCascade().isCascadeRefresh());
-
- //set Refresh to false in the context model
- cascade.setRefresh(false);
- assertEquals(false, cascade.isRefresh());
- assertNull(oneToOne.getCascade());
- }
-} \ No newline at end of file
diff --git a/jpa/tests/org.eclipse.jpt.core.tests/src/org/eclipse/jpt/core/tests/internal/context/orm/OrmColumnTests.java b/jpa/tests/org.eclipse.jpt.core.tests/src/org/eclipse/jpt/core/tests/internal/context/orm/OrmColumnTests.java
deleted file mode 100644
index f41264f148..0000000000
--- a/jpa/tests/org.eclipse.jpt.core.tests/src/org/eclipse/jpt/core/tests/internal/context/orm/OrmColumnTests.java
+++ /dev/null
@@ -1,820 +0,0 @@
-/*******************************************************************************
- * Copyright (c) 2007, 2009 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.
- *
- * Contributors:
- * Oracle - initial API and implementation
- ******************************************************************************/
-package org.eclipse.jpt.core.tests.internal.context.orm;
-
-import java.util.Iterator;
-import java.util.ListIterator;
-import org.eclipse.jdt.core.ICompilationUnit;
-import org.eclipse.jpt.core.JptCorePlugin;
-import org.eclipse.jpt.core.MappingKeys;
-import org.eclipse.jpt.core.context.Column;
-import org.eclipse.jpt.core.context.java.JavaBasicMapping;
-import org.eclipse.jpt.core.context.orm.OrmBasicMapping;
-import org.eclipse.jpt.core.context.orm.OrmColumn;
-import org.eclipse.jpt.core.context.orm.OrmEntity;
-import org.eclipse.jpt.core.context.orm.OrmPersistentAttribute;
-import org.eclipse.jpt.core.context.orm.OrmPersistentType;
-import org.eclipse.jpt.core.resource.java.JPA;
-import org.eclipse.jpt.core.resource.orm.OrmFactory;
-import org.eclipse.jpt.core.resource.orm.XmlBasic;
-import org.eclipse.jpt.core.resource.orm.XmlEntity;
-import org.eclipse.jpt.core.resource.persistence.PersistenceFactory;
-import org.eclipse.jpt.core.resource.persistence.XmlMappingFileRef;
-import org.eclipse.jpt.core.tests.internal.context.ContextModelTestCase;
-import org.eclipse.jpt.utility.internal.iterators.ArrayIterator;
-
-@SuppressWarnings("nls")
-public class OrmColumnTests extends ContextModelTestCase
-{
- public OrmColumnTests(String name) {
- super(name);
- }
-
- @Override
- protected void setUp() throws Exception {
- super.setUp();
- XmlMappingFileRef mappingFileRef = PersistenceFactory.eINSTANCE.createXmlMappingFileRef();
- mappingFileRef.setFileName(JptCorePlugin.DEFAULT_ORM_XML_FILE_PATH);
- getXmlPersistenceUnit().getMappingFiles().add(mappingFileRef);
- getPersistenceXmlResource().save(null);
- }
-
- private ICompilationUnit createTestEntity() 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("@Id");
- }
- });
- }
-
- public void testUpdateSpecifiedName() throws Exception {
- OrmPersistentType ormPersistentType = getEntityMappings().addPersistentType(MappingKeys.ENTITY_TYPE_MAPPING_KEY, "model.foo");
- OrmPersistentAttribute ormPersistentAttribute = ormPersistentType.addSpecifiedPersistentAttribute(MappingKeys.BASIC_ATTRIBUTE_MAPPING_KEY, "basicMapping");
- OrmBasicMapping ormBasicMapping = (OrmBasicMapping) ormPersistentAttribute.getMapping();
- OrmColumn ormColumn = ormBasicMapping.getColumn();
-
- XmlEntity entityResource = getXmlEntityMappings().getEntities().get(0);
- XmlBasic basic = entityResource.getAttributes().getBasics().get(0);
-
- assertNull(ormColumn.getSpecifiedName());
- assertNull(basic.getColumn());
-
- //set name in the resource model, verify context model updated
- basic.setColumn(OrmFactory.eINSTANCE.createXmlColumn());
- basic.getColumn().setName("FOO");
- getOrmXmlResource().save(null);
- assertEquals("FOO", ormColumn.getSpecifiedName());
- assertEquals("FOO", basic.getColumn().getName());
-
- //set name to null in the resource model
- basic.getColumn().setName(null);
- assertNull(ormColumn.getSpecifiedName());
- assertNull(basic.getColumn().getName());
-
- basic.getColumn().setName("FOO");
- assertEquals("FOO", ormColumn.getSpecifiedName());
- assertEquals("FOO", basic.getColumn().getName());
-
- basic.setColumn(null);
- assertNull(ormColumn.getSpecifiedName());
- assertNull(basic.getColumn());
- }
-
- public void testModifySpecifiedName() throws Exception {
- OrmPersistentType ormPersistentType = getEntityMappings().addPersistentType(MappingKeys.ENTITY_TYPE_MAPPING_KEY, "model.foo");
- OrmPersistentAttribute ormPersistentAttribute = ormPersistentType.addSpecifiedPersistentAttribute(MappingKeys.BASIC_ATTRIBUTE_MAPPING_KEY, "basicMapping");
- OrmBasicMapping ormBasicMapping = (OrmBasicMapping) ormPersistentAttribute.getMapping();
- OrmColumn ormColumn = ormBasicMapping.getColumn();
-
- XmlEntity entityResource = getXmlEntityMappings().getEntities().get(0);
- XmlBasic basic = entityResource.getAttributes().getBasics().get(0);
-
- assertNull(ormColumn.getSpecifiedName());
- assertNull(basic.getColumn());
-
- //set name in the context model, verify resource model modified
- ormColumn.setSpecifiedName("foo");
- assertEquals("foo", ormColumn.getSpecifiedName());
- assertEquals("foo", basic.getColumn().getName());
-
- //set name to null in the context model
- ormColumn.setSpecifiedName(null);
- assertNull(ormColumn.getSpecifiedName());
- assertNull(basic.getColumn());
- }
-
- public void testUpdateColumnDefinition() throws Exception {
- OrmPersistentType ormPersistentType = getEntityMappings().addPersistentType(MappingKeys.ENTITY_TYPE_MAPPING_KEY, "model.foo");
- OrmPersistentAttribute ormPersistentAttribute = ormPersistentType.addSpecifiedPersistentAttribute(MappingKeys.BASIC_ATTRIBUTE_MAPPING_KEY, "basicMapping");
- OrmBasicMapping ormBasicMapping = (OrmBasicMapping) ormPersistentAttribute.getMapping();
- OrmColumn ormColumn = ormBasicMapping.getColumn();
-
- XmlEntity entityResource = getXmlEntityMappings().getEntities().get(0);
- XmlBasic basic = entityResource.getAttributes().getBasics().get(0);
-
- assertNull(ormColumn.getColumnDefinition());
- assertNull(basic.getColumn());
-
- //set name in the resource model, verify context model updated
- basic.setColumn(OrmFactory.eINSTANCE.createXmlColumn());
- basic.getColumn().setColumnDefinition("FOO");
- assertEquals("FOO", ormColumn.getColumnDefinition());
- assertEquals("FOO", basic.getColumn().getColumnDefinition());
-
- //set name to null in the resource model
- basic.getColumn().setColumnDefinition(null);
- assertNull(ormColumn.getColumnDefinition());
- assertNull(basic.getColumn().getColumnDefinition());
-
- basic.getColumn().setColumnDefinition("FOO");
- assertEquals("FOO", ormColumn.getColumnDefinition());
- assertEquals("FOO", basic.getColumn().getColumnDefinition());
-
- basic.setColumn(null);
- assertNull(ormColumn.getColumnDefinition());
- assertNull(basic.getColumn());
- }
-
- public void testModifyColumnDefinition() throws Exception {
- OrmPersistentType ormPersistentType = getEntityMappings().addPersistentType(MappingKeys.ENTITY_TYPE_MAPPING_KEY, "model.foo");
- OrmPersistentAttribute ormPersistentAttribute = ormPersistentType.addSpecifiedPersistentAttribute(MappingKeys.BASIC_ATTRIBUTE_MAPPING_KEY, "basicMapping");
- OrmBasicMapping ormBasicMapping = (OrmBasicMapping) ormPersistentAttribute.getMapping();
- OrmColumn ormColumn = ormBasicMapping.getColumn();
-
- XmlEntity entityResource = getXmlEntityMappings().getEntities().get(0);
- XmlBasic basic = entityResource.getAttributes().getBasics().get(0);
-
- assertNull(ormColumn.getColumnDefinition());
- assertNull(basic.getColumn());
-
- //set name in the context model, verify resource model modified
- ormColumn.setColumnDefinition("foo");
- assertEquals("foo", ormColumn.getColumnDefinition());
- assertEquals("foo", basic.getColumn().getColumnDefinition());
-
- //set name to null in the context model
- ormColumn.setColumnDefinition(null);
- assertNull(ormColumn.getColumnDefinition());
- assertNull(basic.getColumn());
- }
-
- public void testUpdateSpecifiedTable() throws Exception {
- OrmPersistentType ormPersistentType = getEntityMappings().addPersistentType(MappingKeys.ENTITY_TYPE_MAPPING_KEY, "model.foo");
- OrmPersistentAttribute ormPersistentAttribute = ormPersistentType.addSpecifiedPersistentAttribute(MappingKeys.BASIC_ATTRIBUTE_MAPPING_KEY, "basicMapping");
- OrmBasicMapping ormBasicMapping = (OrmBasicMapping) ormPersistentAttribute.getMapping();
- OrmColumn ormColumn = ormBasicMapping.getColumn();
-
- XmlEntity entityResource = getXmlEntityMappings().getEntities().get(0);
- XmlBasic basic = entityResource.getAttributes().getBasics().get(0);
-
- assertNull(ormColumn.getSpecifiedTable());
- assertNull(basic.getColumn());
-
- //set name in the resource model, verify context model updated
- basic.setColumn(OrmFactory.eINSTANCE.createXmlColumn());
- basic.getColumn().setTable("FOO");
- assertEquals("FOO", ormColumn.getSpecifiedTable());
- assertEquals("FOO", basic.getColumn().getTable());
-
- //set name to null in the resource model
- basic.getColumn().setTable(null);
- assertNull(ormColumn.getSpecifiedTable());
- assertNull(basic.getColumn().getTable());
-
- basic.getColumn().setTable("FOO");
- assertEquals("FOO", ormColumn.getSpecifiedTable());
- assertEquals("FOO", basic.getColumn().getTable());
-
- basic.setColumn(null);
- assertNull(ormColumn.getSpecifiedTable());
- assertNull(basic.getColumn());
- }
-
- public void testModifySpecifiedTable() throws Exception {
- OrmPersistentType ormPersistentType = getEntityMappings().addPersistentType(MappingKeys.ENTITY_TYPE_MAPPING_KEY, "model.foo");
- OrmPersistentAttribute ormPersistentAttribute = ormPersistentType.addSpecifiedPersistentAttribute(MappingKeys.BASIC_ATTRIBUTE_MAPPING_KEY, "basicMapping");
- OrmBasicMapping ormBasicMapping = (OrmBasicMapping) ormPersistentAttribute.getMapping();
- OrmColumn ormColumn = ormBasicMapping.getColumn();
-
- XmlEntity entityResource = getXmlEntityMappings().getEntities().get(0);
- XmlBasic basic = entityResource.getAttributes().getBasics().get(0);
-
- assertNull(ormColumn.getSpecifiedTable());
- assertNull(basic.getColumn());
-
- //set name in the context model, verify resource model modified
- ormColumn.setSpecifiedTable("foo");
- assertEquals("foo", ormColumn.getSpecifiedTable());
- assertEquals("foo", basic.getColumn().getTable());
-
- //set name to null in the context model
- ormColumn.setSpecifiedTable(null);
- assertNull(ormColumn.getSpecifiedTable());
- assertNull(basic.getColumn());
- }
-
- public void testUpdateSpecifiedNullable() throws Exception {
- OrmPersistentType ormPersistentType = getEntityMappings().addPersistentType(MappingKeys.ENTITY_TYPE_MAPPING_KEY, "model.foo");
- OrmPersistentAttribute ormPersistentAttribute = ormPersistentType.addSpecifiedPersistentAttribute(MappingKeys.BASIC_ATTRIBUTE_MAPPING_KEY, "basicMapping");
- OrmBasicMapping ormBasicMapping = (OrmBasicMapping) ormPersistentAttribute.getMapping();
- OrmColumn ormColumn = ormBasicMapping.getColumn();
-
- XmlEntity entityResource = getXmlEntityMappings().getEntities().get(0);
- XmlBasic basic = entityResource.getAttributes().getBasics().get(0);
-
- assertNull(ormColumn.getSpecifiedNullable());
- assertNull(basic.getColumn());
-
- //set name in the resource model, verify context model updated
- basic.setColumn(OrmFactory.eINSTANCE.createXmlColumn());
- basic.getColumn().setNullable(Boolean.TRUE);
- assertEquals(Boolean.TRUE, ormColumn.getSpecifiedNullable());
- assertEquals(Boolean.TRUE, basic.getColumn().getNullable());
-
- //set name to null in the resource model
- basic.getColumn().setNullable(null);
- assertNull(ormColumn.getSpecifiedNullable());
- assertNull(basic.getColumn().getNullable());
-
- basic.getColumn().setNullable(Boolean.FALSE);
- assertEquals(Boolean.FALSE, ormColumn.getSpecifiedNullable());
- assertEquals(Boolean.FALSE, basic.getColumn().getNullable());
-
- basic.setColumn(null);
- assertNull(ormColumn.getSpecifiedNullable());
- assertNull(basic.getColumn());
- }
-
- public void testModifySpecifiedNullable() throws Exception {
- OrmPersistentType ormPersistentType = getEntityMappings().addPersistentType(MappingKeys.ENTITY_TYPE_MAPPING_KEY, "model.foo");
- OrmPersistentAttribute ormPersistentAttribute = ormPersistentType.addSpecifiedPersistentAttribute(MappingKeys.BASIC_ATTRIBUTE_MAPPING_KEY, "basicMapping");
- OrmBasicMapping ormBasicMapping = (OrmBasicMapping) ormPersistentAttribute.getMapping();
- OrmColumn ormColumn = ormBasicMapping.getColumn();
-
- XmlEntity entityResource = getXmlEntityMappings().getEntities().get(0);
- XmlBasic basic = entityResource.getAttributes().getBasics().get(0);
-
- assertNull(ormColumn.getSpecifiedNullable());
- assertNull(basic.getColumn());
-
- //set name in the context model, verify resource model modified
- ormColumn.setSpecifiedNullable(Boolean.FALSE);
- assertEquals(Boolean.FALSE, ormColumn.getSpecifiedNullable());
- assertEquals(Boolean.FALSE, basic.getColumn().getNullable());
-
- //set name to null in the context model
- ormColumn.setSpecifiedNullable(null);
- assertNull(ormColumn.getSpecifiedNullable());
- assertNull(basic.getColumn());
- }
-
- public void testUpdateSpecifiedUpdatable() throws Exception {
- OrmPersistentType ormPersistentType = getEntityMappings().addPersistentType(MappingKeys.ENTITY_TYPE_MAPPING_KEY, "model.foo");
- OrmPersistentAttribute ormPersistentAttribute = ormPersistentType.addSpecifiedPersistentAttribute(MappingKeys.BASIC_ATTRIBUTE_MAPPING_KEY, "basicMapping");
- OrmBasicMapping ormBasicMapping = (OrmBasicMapping) ormPersistentAttribute.getMapping();
- OrmColumn ormColumn = ormBasicMapping.getColumn();
-
- XmlEntity entityResource = getXmlEntityMappings().getEntities().get(0);
- XmlBasic basic = entityResource.getAttributes().getBasics().get(0);
-
- assertNull(ormColumn.getSpecifiedUpdatable());
- assertNull(basic.getColumn());
-
- //set name in the resource model, verify context model updated
- basic.setColumn(OrmFactory.eINSTANCE.createXmlColumn());
- basic.getColumn().setUpdatable(Boolean.TRUE);
- assertEquals(Boolean.TRUE, ormColumn.getSpecifiedUpdatable());
- assertEquals(Boolean.TRUE, basic.getColumn().getUpdatable());
-
- //set name to null in the resource model
- basic.getColumn().setUpdatable(null);
- assertNull(ormColumn.getSpecifiedUpdatable());
- assertNull(basic.getColumn().getUpdatable());
-
- basic.getColumn().setUpdatable(Boolean.FALSE);
- assertEquals(Boolean.FALSE, ormColumn.getSpecifiedUpdatable());
- assertEquals(Boolean.FALSE, basic.getColumn().getUpdatable());
-
- basic.setColumn(null);
- assertNull(ormColumn.getSpecifiedUpdatable());
- assertNull(basic.getColumn());
- }
-
- public void testModifySpecifiedUpdatable() throws Exception {
- OrmPersistentType ormPersistentType = getEntityMappings().addPersistentType(MappingKeys.ENTITY_TYPE_MAPPING_KEY, "model.foo");
- OrmPersistentAttribute ormPersistentAttribute = ormPersistentType.addSpecifiedPersistentAttribute(MappingKeys.BASIC_ATTRIBUTE_MAPPING_KEY, "basicMapping");
- OrmBasicMapping ormBasicMapping = (OrmBasicMapping) ormPersistentAttribute.getMapping();
- OrmColumn ormColumn = ormBasicMapping.getColumn();
-
- XmlEntity entityResource = getXmlEntityMappings().getEntities().get(0);
- XmlBasic basic = entityResource.getAttributes().getBasics().get(0);
-
- assertNull(ormColumn.getSpecifiedUpdatable());
- assertNull(basic.getColumn());
-
- //set name in the context model, verify resource model modified
- ormColumn.setSpecifiedUpdatable(Boolean.FALSE);
- assertEquals(Boolean.FALSE, ormColumn.getSpecifiedUpdatable());
- assertEquals(Boolean.FALSE, basic.getColumn().getUpdatable());
-
- //set name to null in the context model
- ormColumn.setSpecifiedUpdatable(null);
- assertNull(ormColumn.getSpecifiedUpdatable());
- assertNull(basic.getColumn());
- }
-
- public void testUpdateSpecifiedInsertable() throws Exception {
- OrmPersistentType ormPersistentType = getEntityMappings().addPersistentType(MappingKeys.ENTITY_TYPE_MAPPING_KEY, "model.foo");
- OrmPersistentAttribute ormPersistentAttribute = ormPersistentType.addSpecifiedPersistentAttribute(MappingKeys.BASIC_ATTRIBUTE_MAPPING_KEY, "basicMapping");
- OrmBasicMapping ormBasicMapping = (OrmBasicMapping) ormPersistentAttribute.getMapping();
- OrmColumn ormColumn = ormBasicMapping.getColumn();
-
- XmlEntity entityResource = getXmlEntityMappings().getEntities().get(0);
- XmlBasic basic = entityResource.getAttributes().getBasics().get(0);
-
- assertNull(ormColumn.getSpecifiedInsertable());
- assertNull(basic.getColumn());
-
- //set name in the resource model, verify context model updated
- basic.setColumn(OrmFactory.eINSTANCE.createXmlColumn());
- basic.getColumn().setInsertable(Boolean.TRUE);
- assertEquals(Boolean.TRUE, ormColumn.getSpecifiedInsertable());
- assertEquals(Boolean.TRUE, basic.getColumn().getInsertable());
-
- //set name to null in the resource model
- basic.getColumn().setInsertable(null);
- assertNull(ormColumn.getSpecifiedInsertable());
- assertNull(basic.getColumn().getInsertable());
-
- basic.getColumn().setInsertable(Boolean.FALSE);
- assertEquals(Boolean.FALSE, ormColumn.getSpecifiedInsertable());
- assertEquals(Boolean.FALSE, basic.getColumn().getInsertable());
-
- basic.setColumn(null);
- assertNull(ormColumn.getSpecifiedInsertable());
- assertNull(basic.getColumn());
- }
-
- public void testModifySpecifiedInsertable() throws Exception {
- OrmPersistentType ormPersistentType = getEntityMappings().addPersistentType(MappingKeys.ENTITY_TYPE_MAPPING_KEY, "model.foo");
- OrmPersistentAttribute ormPersistentAttribute = ormPersistentType.addSpecifiedPersistentAttribute(MappingKeys.BASIC_ATTRIBUTE_MAPPING_KEY, "basicMapping");
- OrmBasicMapping ormBasicMapping = (OrmBasicMapping) ormPersistentAttribute.getMapping();
- OrmColumn ormColumn = ormBasicMapping.getColumn();
-
- XmlEntity entityResource = getXmlEntityMappings().getEntities().get(0);
- XmlBasic basic = entityResource.getAttributes().getBasics().get(0);
-
- assertNull(ormColumn.getSpecifiedInsertable());
- assertNull(basic.getColumn());
-
- //set name in the context model, verify resource model modified
- ormColumn.setSpecifiedInsertable(Boolean.FALSE);
- assertEquals(Boolean.FALSE, ormColumn.getSpecifiedInsertable());
- assertEquals(Boolean.FALSE, basic.getColumn().getInsertable());
-
- //set name to null in the context model
- ormColumn.setSpecifiedInsertable(null);
- assertNull(ormColumn.getSpecifiedInsertable());
- assertNull(basic.getColumn());
- }
-
- public void testUpdateSpecifiedUnique() throws Exception {
- OrmPersistentType ormPersistentType = getEntityMappings().addPersistentType(MappingKeys.ENTITY_TYPE_MAPPING_KEY, "model.foo");
- OrmPersistentAttribute ormPersistentAttribute = ormPersistentType.addSpecifiedPersistentAttribute(MappingKeys.BASIC_ATTRIBUTE_MAPPING_KEY, "basicMapping");
- OrmBasicMapping ormBasicMapping = (OrmBasicMapping) ormPersistentAttribute.getMapping();
- OrmColumn ormColumn = ormBasicMapping.getColumn();
-
- XmlEntity entityResource = getXmlEntityMappings().getEntities().get(0);
- XmlBasic basic = entityResource.getAttributes().getBasics().get(0);
-
- assertNull(ormColumn.getSpecifiedUnique());
- assertNull(basic.getColumn());
-
- //set name in the resource model, verify context model updated
- basic.setColumn(OrmFactory.eINSTANCE.createXmlColumn());
- basic.getColumn().setUnique(Boolean.TRUE);
- assertEquals(Boolean.TRUE, ormColumn.getSpecifiedUnique());
- assertEquals(Boolean.TRUE, basic.getColumn().getUnique());
-
- //set name to null in the resource model
- basic.getColumn().setUnique(null);
- assertNull(ormColumn.getSpecifiedUnique());
- assertNull(basic.getColumn().getUnique());
-
- basic.getColumn().setUnique(Boolean.FALSE);
- assertEquals(Boolean.FALSE, ormColumn.getSpecifiedUnique());
- assertEquals(Boolean.FALSE, basic.getColumn().getUnique());
-
- basic.setColumn(null);
- assertNull(ormColumn.getSpecifiedUnique());
- assertNull(basic.getColumn());
- }
-
- public void testModifySpecifiedUnique() throws Exception {
- OrmPersistentType ormPersistentType = getEntityMappings().addPersistentType(MappingKeys.ENTITY_TYPE_MAPPING_KEY, "model.foo");
- OrmPersistentAttribute ormPersistentAttribute = ormPersistentType.addSpecifiedPersistentAttribute(MappingKeys.BASIC_ATTRIBUTE_MAPPING_KEY, "basicMapping");
- OrmBasicMapping ormBasicMapping = (OrmBasicMapping) ormPersistentAttribute.getMapping();
- OrmColumn ormColumn = ormBasicMapping.getColumn();
-
- XmlEntity entityResource = getXmlEntityMappings().getEntities().get(0);
- XmlBasic basic = entityResource.getAttributes().getBasics().get(0);
-
- assertNull(ormColumn.getSpecifiedUnique());
- assertNull(basic.getColumn());
-
- //set name in the context model, verify resource model modified
- ormColumn.setSpecifiedUnique(Boolean.FALSE);
- assertEquals(Boolean.FALSE, ormColumn.getSpecifiedUnique());
- assertEquals(Boolean.FALSE, basic.getColumn().getUnique());
-
- //set name to null in the context model
- ormColumn.setSpecifiedUnique(null);
- assertNull(ormColumn.getSpecifiedUnique());
- assertNull(basic.getColumn());
- }
-
- public void testUpdateSpecifiedLength() throws Exception {
- OrmPersistentType ormPersistentType = getEntityMappings().addPersistentType(MappingKeys.ENTITY_TYPE_MAPPING_KEY, "model.foo");
- OrmPersistentAttribute ormPersistentAttribute = ormPersistentType.addSpecifiedPersistentAttribute(MappingKeys.BASIC_ATTRIBUTE_MAPPING_KEY, "basicMapping");
- OrmBasicMapping ormBasicMapping = (OrmBasicMapping) ormPersistentAttribute.getMapping();
- OrmColumn ormColumn = ormBasicMapping.getColumn();
-
- XmlEntity entityResource = getXmlEntityMappings().getEntities().get(0);
- XmlBasic basic = entityResource.getAttributes().getBasics().get(0);
-
- assertNull(ormColumn.getSpecifiedLength());
- assertNull(basic.getColumn());
-
- //set name in the resource model, verify context model updated
- basic.setColumn(OrmFactory.eINSTANCE.createXmlColumn());
- basic.getColumn().setLength(Integer.valueOf(8));
- assertEquals(Integer.valueOf(8), ormColumn.getSpecifiedLength());
- assertEquals(Integer.valueOf(8), basic.getColumn().getLength());
-
- //set name to null in the resource model
- basic.getColumn().setLength(null);
- assertNull(ormColumn.getSpecifiedLength());
- assertNull(basic.getColumn().getLength());
-
- basic.getColumn().setLength(Integer.valueOf(11));
- assertEquals(Integer.valueOf(11), ormColumn.getSpecifiedLength());
- assertEquals(Integer.valueOf(11), basic.getColumn().getLength());
-
- basic.setColumn(null);
- assertNull(ormColumn.getSpecifiedLength());
- assertNull(basic.getColumn());
- }
-
- public void testModifySpecifiedLength() throws Exception {
- OrmPersistentType ormPersistentType = getEntityMappings().addPersistentType(MappingKeys.ENTITY_TYPE_MAPPING_KEY, "model.foo");
- OrmPersistentAttribute ormPersistentAttribute = ormPersistentType.addSpecifiedPersistentAttribute(MappingKeys.BASIC_ATTRIBUTE_MAPPING_KEY, "basicMapping");
- OrmBasicMapping ormBasicMapping = (OrmBasicMapping) ormPersistentAttribute.getMapping();
- OrmColumn ormColumn = ormBasicMapping.getColumn();
-
- XmlEntity entityResource = getXmlEntityMappings().getEntities().get(0);
- XmlBasic basic = entityResource.getAttributes().getBasics().get(0);
-
- assertNull(ormColumn.getSpecifiedLength());
- assertNull(basic.getColumn());
-
- //set name in the context model, verify resource model modified
- ormColumn.setSpecifiedLength(Integer.valueOf(7));
- assertEquals(Integer.valueOf(7), ormColumn.getSpecifiedLength());
- assertEquals(Integer.valueOf(7), basic.getColumn().getLength());
-
- //set name to null in the context model
- ormColumn.setSpecifiedLength(null);
- assertNull(ormColumn.getSpecifiedLength());
- assertNull(basic.getColumn());
- }
-
- public void testUpdateSpecifiedPrecision() throws Exception {
- OrmPersistentType ormPersistentType = getEntityMappings().addPersistentType(MappingKeys.ENTITY_TYPE_MAPPING_KEY, "model.foo");
- OrmPersistentAttribute ormPersistentAttribute = ormPersistentType.addSpecifiedPersistentAttribute(MappingKeys.BASIC_ATTRIBUTE_MAPPING_KEY, "basicMapping");
- OrmBasicMapping ormBasicMapping = (OrmBasicMapping) ormPersistentAttribute.getMapping();
- OrmColumn ormColumn = ormBasicMapping.getColumn();
-
- XmlEntity entityResource = getXmlEntityMappings().getEntities().get(0);
- XmlBasic basic = entityResource.getAttributes().getBasics().get(0);
-
- assertNull(ormColumn.getSpecifiedLength());
- assertNull(basic.getColumn());
-
- //set name in the resource model, verify context model updated
- basic.setColumn(OrmFactory.eINSTANCE.createXmlColumn());
- basic.getColumn().setPrecision(Integer.valueOf(8));
- assertEquals(Integer.valueOf(8), ormColumn.getSpecifiedPrecision());
- assertEquals(Integer.valueOf(8), basic.getColumn().getPrecision());
-
- //set name to null in the resource model
- basic.getColumn().setPrecision(null);
- assertNull(ormColumn.getSpecifiedLength());
- assertNull(basic.getColumn().getPrecision());
-
- basic.getColumn().setPrecision(Integer.valueOf(11));
- assertEquals(Integer.valueOf(11), ormColumn.getSpecifiedPrecision());
- assertEquals(Integer.valueOf(11), basic.getColumn().getPrecision());
-
- basic.setColumn(null);
- assertNull(ormColumn.getSpecifiedLength());
- assertNull(basic.getColumn());
- }
-
- public void testModifySpecifiedPrecision() throws Exception {
- OrmPersistentType ormPersistentType = getEntityMappings().addPersistentType(MappingKeys.ENTITY_TYPE_MAPPING_KEY, "model.foo");
- OrmPersistentAttribute ormPersistentAttribute = ormPersistentType.addSpecifiedPersistentAttribute(MappingKeys.BASIC_ATTRIBUTE_MAPPING_KEY, "basicMapping");
- OrmBasicMapping ormBasicMapping = (OrmBasicMapping) ormPersistentAttribute.getMapping();
- OrmColumn ormColumn = ormBasicMapping.getColumn();
-
- XmlEntity entityResource = getXmlEntityMappings().getEntities().get(0);
- XmlBasic basic = entityResource.getAttributes().getBasics().get(0);
-
- assertNull(ormColumn.getSpecifiedLength());
- assertNull(basic.getColumn());
-
- //set name in the context model, verify resource model modified
- ormColumn.setSpecifiedPrecision(Integer.valueOf(7));
- assertEquals(Integer.valueOf(7), ormColumn.getSpecifiedPrecision());
- assertEquals(Integer.valueOf(7), basic.getColumn().getPrecision());
-
- //set name to null in the context model
- ormColumn.setSpecifiedPrecision(null);
- assertNull(ormColumn.getSpecifiedLength());
- assertNull(basic.getColumn());
- }
-
- public void testUpdateSpecifiedScale() throws Exception {
- OrmPersistentType ormPersistentType = getEntityMappings().addPersistentType(MappingKeys.ENTITY_TYPE_MAPPING_KEY, "model.foo");
- OrmPersistentAttribute ormPersistentAttribute = ormPersistentType.addSpecifiedPersistentAttribute(MappingKeys.BASIC_ATTRIBUTE_MAPPING_KEY, "basicMapping");
- OrmBasicMapping ormBasicMapping = (OrmBasicMapping) ormPersistentAttribute.getMapping();
- OrmColumn ormColumn = ormBasicMapping.getColumn();
-
- XmlEntity entityResource = getXmlEntityMappings().getEntities().get(0);
- XmlBasic basic = entityResource.getAttributes().getBasics().get(0);
-
- assertNull(ormColumn.getSpecifiedLength());
- assertNull(basic.getColumn());
-
- //set name in the resource model, verify context model updated
- basic.setColumn(OrmFactory.eINSTANCE.createXmlColumn());
- basic.getColumn().setScale(Integer.valueOf(8));
- assertEquals(Integer.valueOf(8), ormColumn.getSpecifiedScale());
- assertEquals(Integer.valueOf(8), basic.getColumn().getScale());
-
- //set name to null in the resource model
- basic.getColumn().setScale(null);
- assertNull(ormColumn.getSpecifiedLength());
- assertNull(basic.getColumn().getScale());
-
- basic.getColumn().setScale(Integer.valueOf(11));
- assertEquals(Integer.valueOf(11), ormColumn.getSpecifiedScale());
- assertEquals(Integer.valueOf(11), basic.getColumn().getScale());
-
- basic.setColumn(null);
- assertNull(ormColumn.getSpecifiedLength());
- assertNull(basic.getColumn());
- }
-
- public void testModifySpecifiedScale() throws Exception {
- OrmPersistentType ormPersistentType = getEntityMappings().addPersistentType(MappingKeys.ENTITY_TYPE_MAPPING_KEY, "model.foo");
- OrmPersistentAttribute ormPersistentAttribute = ormPersistentType.addSpecifiedPersistentAttribute(MappingKeys.BASIC_ATTRIBUTE_MAPPING_KEY, "basicMapping");
- OrmBasicMapping ormBasicMapping = (OrmBasicMapping) ormPersistentAttribute.getMapping();
- OrmColumn ormColumn = ormBasicMapping.getColumn();
-
- XmlEntity entityResource = getXmlEntityMappings().getEntities().get(0);
- XmlBasic basic = entityResource.getAttributes().getBasics().get(0);
-
- assertNull(ormColumn.getSpecifiedLength());
- assertNull(basic.getColumn());
-
- //set name in the context model, verify resource model modified
- ormColumn.setSpecifiedScale(Integer.valueOf(7));
- assertEquals(Integer.valueOf(7), ormColumn.getSpecifiedScale());
- assertEquals(Integer.valueOf(7), basic.getColumn().getScale());
-
- //set name to null in the context model
- ormColumn.setSpecifiedScale(null);
- assertNull(ormColumn.getSpecifiedLength());
- assertNull(basic.getColumn());
- }
-
- public void testVirtualColumnDefaults() throws Exception {
- createTestEntity();
-
- OrmPersistentType ormPersistentType = getEntityMappings().addPersistentType(MappingKeys.ENTITY_TYPE_MAPPING_KEY, FULLY_QUALIFIED_TYPE_NAME);
- ListIterator<OrmPersistentAttribute> attributes = ormPersistentType.virtualAttributes();
- attributes.next();
-
- //virtual attrubte in orm.xml, java attribute has no Column annotation
- OrmPersistentAttribute namePersistentAttribute = attributes.next();
- OrmBasicMapping nameVirtualMapping = (OrmBasicMapping) namePersistentAttribute.getMapping();
- OrmColumn ormColumn = nameVirtualMapping.getColumn();
- assertEquals("name", ormColumn.getSpecifiedName());
- assertEquals(TYPE_NAME, ormColumn.getSpecifiedTable());
- assertEquals(null, ormColumn.getColumnDefinition());
- assertEquals(Boolean.TRUE, ormColumn.getSpecifiedInsertable());
- assertEquals(Boolean.TRUE, ormColumn.getSpecifiedUpdatable());
- assertEquals(Boolean.TRUE, ormColumn.getSpecifiedNullable());
- assertEquals(Boolean.FALSE, ormColumn.getSpecifiedUnique());
- assertEquals(Column.DEFAULT_LENGTH, ormColumn.getSpecifiedLength().intValue());
- assertEquals(Column.DEFAULT_PRECISION, ormColumn.getSpecifiedPrecision().intValue());
- assertEquals(Column.DEFAULT_SCALE, ormColumn.getSpecifiedScale().intValue());
-
- //set Column annotation in Java
- JavaBasicMapping javaBasicMapping = (JavaBasicMapping) ormPersistentType.getJavaPersistentType().getAttributeNamed("name").getMapping();
- javaBasicMapping.getColumn().setSpecifiedName("FOO");
- javaBasicMapping.getColumn().setSpecifiedTable("FOO_TABLE");
- javaBasicMapping.getColumn().setColumnDefinition("COLUMN_DEFINITION");
- javaBasicMapping.getColumn().setSpecifiedInsertable(Boolean.FALSE);
- javaBasicMapping.getColumn().setSpecifiedUpdatable(Boolean.FALSE);
- javaBasicMapping.getColumn().setSpecifiedNullable(Boolean.FALSE);
- javaBasicMapping.getColumn().setSpecifiedUnique(Boolean.TRUE);
- javaBasicMapping.getColumn().setSpecifiedLength(Integer.valueOf(45));
- javaBasicMapping.getColumn().setSpecifiedPrecision(Integer.valueOf(46));
- javaBasicMapping.getColumn().setSpecifiedScale(Integer.valueOf(47));
-
- assertEquals("FOO", ormColumn.getSpecifiedName());
- assertEquals("FOO_TABLE", ormColumn.getSpecifiedTable());
- assertEquals("COLUMN_DEFINITION", ormColumn.getColumnDefinition());
- assertEquals(Boolean.FALSE, ormColumn.getSpecifiedInsertable());
- assertEquals(Boolean.FALSE, ormColumn.getSpecifiedUpdatable());
- assertEquals(Boolean.FALSE, ormColumn.getSpecifiedNullable());
- assertEquals(Boolean.TRUE, ormColumn.getSpecifiedUnique());
- assertEquals(Integer.valueOf(45), ormColumn.getSpecifiedLength());
- assertEquals(Integer.valueOf(46), ormColumn.getSpecifiedPrecision());
- assertEquals(Integer.valueOf(47), ormColumn.getSpecifiedScale());
-
-
- //set metadata-complete, orm.xml virtual column ignores java column annotation
- ormPersistentType.getMapping().setSpecifiedMetadataComplete(Boolean.TRUE);
- assertEquals("name", ormColumn.getSpecifiedName());
- assertEquals(TYPE_NAME, ormColumn.getSpecifiedTable());
- assertEquals(null, ormColumn.getColumnDefinition());
- assertEquals(Boolean.TRUE, ormColumn.getSpecifiedInsertable());
- assertEquals(Boolean.TRUE, ormColumn.getSpecifiedUpdatable());
- assertEquals(Boolean.TRUE, ormColumn.getSpecifiedNullable());
- assertEquals(Boolean.FALSE, ormColumn.getSpecifiedUnique());
- assertEquals(Column.DEFAULT_LENGTH, ormColumn.getSpecifiedLength().intValue());
- assertEquals(Column.DEFAULT_PRECISION, ormColumn.getSpecifiedPrecision().intValue());
- assertEquals(Column.DEFAULT_SCALE, ormColumn.getSpecifiedScale().intValue());
-
- getEntityMappings().getPersistenceUnitMetadata().setXmlMappingMetadataComplete(true);
- ormPersistentType.getMapping().setSpecifiedMetadataComplete(Boolean.FALSE);
- assertEquals("name", ormColumn.getSpecifiedName());
- assertEquals(TYPE_NAME, ormColumn.getSpecifiedTable());
- assertEquals(null, ormColumn.getColumnDefinition());
- assertEquals(Boolean.TRUE, ormColumn.getSpecifiedInsertable());
- assertEquals(Boolean.TRUE, ormColumn.getSpecifiedUpdatable());
- assertEquals(Boolean.TRUE, ormColumn.getSpecifiedNullable());
- assertEquals(Boolean.FALSE, ormColumn.getSpecifiedUnique());
- assertEquals(Column.DEFAULT_LENGTH, ormColumn.getSpecifiedLength().intValue());
- assertEquals(Column.DEFAULT_PRECISION, ormColumn.getSpecifiedPrecision().intValue());
- assertEquals(Column.DEFAULT_SCALE, ormColumn.getSpecifiedScale().intValue());
-
- ormPersistentType.getMapping().setSpecifiedMetadataComplete(null);
- assertEquals("name", ormColumn.getSpecifiedName());
- assertEquals(TYPE_NAME, ormColumn.getSpecifiedTable());
- assertEquals(null, ormColumn.getColumnDefinition());
- assertEquals(Boolean.TRUE, ormColumn.getSpecifiedInsertable());
- assertEquals(Boolean.TRUE, ormColumn.getSpecifiedUpdatable());
- assertEquals(Boolean.TRUE, ormColumn.getSpecifiedNullable());
- assertEquals(Boolean.FALSE, ormColumn.getSpecifiedUnique());
- assertEquals(Column.DEFAULT_LENGTH, ormColumn.getSpecifiedLength().intValue());
- assertEquals(Column.DEFAULT_PRECISION, ormColumn.getSpecifiedPrecision().intValue());
- assertEquals(Column.DEFAULT_SCALE, ormColumn.getSpecifiedScale().intValue());
-
- //set metadata-complete false, orm.xml virtual column gets setting from java annotation
- getEntityMappings().getPersistenceUnitMetadata().setXmlMappingMetadataComplete(false);
- assertEquals("FOO", ormColumn.getSpecifiedName());
- assertEquals("FOO_TABLE", ormColumn.getSpecifiedTable());
- assertEquals("COLUMN_DEFINITION", ormColumn.getColumnDefinition());
- assertEquals(Boolean.FALSE, ormColumn.getSpecifiedInsertable());
- assertEquals(Boolean.FALSE, ormColumn.getSpecifiedUpdatable());
- assertEquals(Boolean.FALSE, ormColumn.getSpecifiedNullable());
- assertEquals(Boolean.TRUE, ormColumn.getSpecifiedUnique());
- assertEquals(Integer.valueOf(45), ormColumn.getSpecifiedLength());
- assertEquals(Integer.valueOf(46), ormColumn.getSpecifiedPrecision());
- assertEquals(Integer.valueOf(47), ormColumn.getSpecifiedScale());
- }
-
- public void testNullColumnDefaults() throws Exception {
- createTestEntity();
-
- OrmPersistentType ormPersistentType = getEntityMappings().addPersistentType(MappingKeys.ENTITY_TYPE_MAPPING_KEY, FULLY_QUALIFIED_TYPE_NAME);
- OrmPersistentAttribute namePersistentAttribute = ormPersistentType.addSpecifiedPersistentAttribute(MappingKeys.BASIC_ATTRIBUTE_MAPPING_KEY, "name");
-
- OrmBasicMapping nameVirtualMapping = (OrmBasicMapping) namePersistentAttribute.getMapping();
- OrmColumn ormColumn = nameVirtualMapping.getColumn();
-
- //set Column annotation in Java
- JavaBasicMapping javaBasicMapping = (JavaBasicMapping) ormPersistentType.getJavaPersistentType().getAttributeNamed("name").getMapping();
- javaBasicMapping.getColumn().setSpecifiedName("FOO");
- javaBasicMapping.getColumn().setSpecifiedTable("FOO_TABLE");
- javaBasicMapping.getColumn().setColumnDefinition("COLUMN_DEFINITION");
- javaBasicMapping.getColumn().setSpecifiedInsertable(Boolean.FALSE);
- javaBasicMapping.getColumn().setSpecifiedUpdatable(Boolean.FALSE);
- javaBasicMapping.getColumn().setSpecifiedNullable(Boolean.FALSE);
- javaBasicMapping.getColumn().setSpecifiedUnique(Boolean.TRUE);
- javaBasicMapping.getColumn().setSpecifiedLength(Integer.valueOf(45));
- javaBasicMapping.getColumn().setSpecifiedPrecision(Integer.valueOf(46));
- javaBasicMapping.getColumn().setSpecifiedScale(Integer.valueOf(47));
-
-
- assertEquals("name", ormColumn.getDefaultName());
- assertEquals(TYPE_NAME, ormColumn.getDefaultTable());
- assertEquals(true, ormColumn.isDefaultInsertable());
- assertEquals(true, ormColumn.isDefaultUpdatable());
- assertEquals(true, ormColumn.isDefaultNullable());
- assertEquals(false, ormColumn.isDefaultUnique());
- assertEquals(Column.DEFAULT_LENGTH, ormColumn.getDefaultLength());
- assertEquals(Column.DEFAULT_PRECISION, ormColumn.getDefaultPrecision());
- assertEquals(Column.DEFAULT_SCALE, ormColumn.getDefaultScale());
- assertNull(ormColumn.getSpecifiedName());
- assertNull(ormColumn.getSpecifiedTable());
- assertNull(ormColumn.getColumnDefinition());
- assertNull(ormColumn.getSpecifiedInsertable());
- assertNull(ormColumn.getSpecifiedUpdatable());
- assertNull(ormColumn.getSpecifiedNullable());
- assertNull(ormColumn.getSpecifiedUnique());
- assertNull(ormColumn.getSpecifiedLength());
- assertNull(ormColumn.getSpecifiedPrecision());
- assertNull(ormColumn.getSpecifiedScale());
- }
-
- public void testVirtualColumnTable() throws Exception {
- createTestEntity();
-
- OrmPersistentType ormPersistentType = getEntityMappings().addPersistentType(MappingKeys.ENTITY_TYPE_MAPPING_KEY, FULLY_QUALIFIED_TYPE_NAME);
- ListIterator<OrmPersistentAttribute> attributes = ormPersistentType.virtualAttributes();
- attributes.next();
-
- //virtual attribute in orm.xml, java attribute has no Column annotation
- OrmPersistentAttribute namePersistentAttribute = attributes.next();
- OrmBasicMapping nameVirtualMapping = (OrmBasicMapping) namePersistentAttribute.getMapping();
- OrmColumn ormColumn = nameVirtualMapping.getColumn();
-
- assertEquals(TYPE_NAME, ormColumn.getSpecifiedTable());
-
- ((OrmEntity) ormPersistentType.getMapping()).getTable().setSpecifiedName("ORM_TABLE");
- assertEquals("ORM_TABLE", ormColumn.getSpecifiedTable());
-
- //set Column table element in Java
- JavaBasicMapping javaBasicMapping = (JavaBasicMapping) ormPersistentType.getJavaPersistentType().getAttributeNamed("name").getMapping();
- javaBasicMapping.getColumn().setSpecifiedTable("JAVA_TABLE");
- assertEquals("JAVA_TABLE", ormColumn.getSpecifiedTable());
-
- //make name persistent attribute not virtual
- namePersistentAttribute = ormPersistentType.addSpecifiedPersistentAttribute(MappingKeys.BASIC_ATTRIBUTE_MAPPING_KEY, "name");
- nameVirtualMapping = (OrmBasicMapping) namePersistentAttribute.getMapping();
- ormColumn = nameVirtualMapping.getColumn();
- assertNull(ormColumn.getSpecifiedTable());
- assertEquals("ORM_TABLE", ormColumn.getDefaultTable());
-
- }
-
-//public void testUpdateDefaultNameNoJava() throws Exception {
-// createTestEntity();
-//
-// OrmPersistentType ormPersistentType = entityMappings().addOrmPersistentType(IMappingKeys.ENTITY_TYPE_MAPPING_KEY, "model.Foo");
-// XmlEntity xmlEntity = (XmlEntity) ormPersistentType.getMapping();
-// assertEquals("Foo", xmlEntity.getTable().getDefaultName());
-//}
-//
-//public void testUpdateDefaultNameFromParent() throws Exception {
-// createTestEntity();
-// createTestSubType();
-//
-// OrmPersistentType parentOrmPersistentType = entityMappings().addOrmPersistentType(IMappingKeys.ENTITY_TYPE_MAPPING_KEY, FULLY_QUALIFIED_TYPE_NAME);
-// OrmPersistentType childOrmPersistentType = entityMappings().addOrmPersistentType(IMappingKeys.ENTITY_TYPE_MAPPING_KEY, PACKAGE_NAME + ".AnnotationTestTypeChild");
-// XmlEntity parentXmlEntity = (XmlEntity) parentOrmPersistentType.getMapping();
-// XmlEntity childXmlEntity = (XmlEntity) childOrmPersistentType.getMapping();
-//
-// assertEquals(TYPE_NAME, parentXmlEntity.getTable().getDefaultName());
-// assertEquals(TYPE_NAME, childXmlEntity.getTable().getDefaultName());
-//
-// parentXmlEntity.getTable().setSpecifiedName("FOO");
-// assertEquals(TYPE_NAME, parentXmlEntity.getTable().getDefaultName());
-// assertEquals("FOO", childXmlEntity.getTable().getDefaultName());
-//
-// parentXmlEntity.setSpecifiedInheritanceStrategy(InheritanceType.JOINED);
-// assertEquals(TYPE_NAME, parentXmlEntity.getTable().getDefaultName());
-// assertEquals("AnnotationTestTypeChild", childXmlEntity.getTable().getDefaultName());
-//}
-
-} \ No newline at end of file
diff --git a/jpa/tests/org.eclipse.jpt.core.tests/src/org/eclipse/jpt/core/tests/internal/context/orm/OrmDiscriminatorColumnTests.java b/jpa/tests/org.eclipse.jpt.core.tests/src/org/eclipse/jpt/core/tests/internal/context/orm/OrmDiscriminatorColumnTests.java
deleted file mode 100644
index 9defed0bcc..0000000000
--- a/jpa/tests/org.eclipse.jpt.core.tests/src/org/eclipse/jpt/core/tests/internal/context/orm/OrmDiscriminatorColumnTests.java
+++ /dev/null
@@ -1,456 +0,0 @@
-/*******************************************************************************
- * Copyright (c) 2007, 2009 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.
- *
- * Contributors:
- * Oracle - initial API and implementation
- ******************************************************************************/
-package org.eclipse.jpt.core.tests.internal.context.orm;
-
-import org.eclipse.jpt.core.JptCorePlugin;
-import org.eclipse.jpt.core.MappingKeys;
-import org.eclipse.jpt.core.context.DiscriminatorColumn;
-import org.eclipse.jpt.core.context.DiscriminatorType;
-import org.eclipse.jpt.core.context.Entity;
-import org.eclipse.jpt.core.context.InheritanceType;
-import org.eclipse.jpt.core.context.orm.OrmDiscriminatorColumn;
-import org.eclipse.jpt.core.context.orm.OrmEntity;
-import org.eclipse.jpt.core.context.orm.OrmPersistentType;
-import org.eclipse.jpt.core.resource.java.JPA;
-import org.eclipse.jpt.core.resource.orm.OrmFactory;
-import org.eclipse.jpt.core.resource.orm.XmlEntity;
-import org.eclipse.jpt.core.resource.persistence.PersistenceFactory;
-import org.eclipse.jpt.core.resource.persistence.XmlMappingFileRef;
-import org.eclipse.jpt.core.tests.internal.context.ContextModelTestCase;
-import org.eclipse.jpt.core.tests.internal.projects.TestJavaProject.SourceWriter;
-
-@SuppressWarnings("nls")
-public class OrmDiscriminatorColumnTests extends ContextModelTestCase
-{
- public OrmDiscriminatorColumnTests(String name) {
- super(name);
- }
-
- @Override
- protected void setUp() throws Exception {
- super.setUp();
- XmlMappingFileRef mappingFileRef = PersistenceFactory.eINSTANCE.createXmlMappingFileRef();
- mappingFileRef.setFileName(JptCorePlugin.DEFAULT_ORM_XML_FILE_PATH);
- getXmlPersistenceUnit().getMappingFiles().add(mappingFileRef);
- getPersistenceXmlResource().save(null);
- }
-
- private void createTestAbstractEntity() throws Exception {
- SourceWriter sourceWriter = new SourceWriter() {
- public void appendSourceTo(StringBuilder sb) {
- sb.append(CR);
- sb.append("import ");
- sb.append(JPA.ENTITY);
- sb.append(";");
- sb.append(CR);
- sb.append("@Entity");
- sb.append(CR);
- sb.append("public abstract class ").append(TYPE_NAME).append(" ");
- sb.append("{}").append(CR);
- }
- };
- this.javaProject.createCompilationUnit(PACKAGE_NAME, FILE_NAME, sourceWriter);
- }
-
-
- private void createTestSubType() throws Exception {
- SourceWriter sourceWriter = new SourceWriter() {
- public void appendSourceTo(StringBuilder sb) {
- sb.append(CR);
- sb.append("import ");
- sb.append(JPA.ENTITY);
- sb.append(";");
- sb.append(CR);
- sb.append("@Entity");
- sb.append(CR);
- sb.append("public class ").append("AnnotationTestTypeChild").append(" ");
- sb.append("extends " + TYPE_NAME + " ");
- sb.append("{}").append(CR);
- }
- };
- this.javaProject.createCompilationUnit(PACKAGE_NAME, "AnnotationTestTypeChild.java", sourceWriter);
- }
-
- public void testUpdateSpecifiedName() throws Exception {
- OrmPersistentType ormPersistentType = getEntityMappings().addPersistentType(MappingKeys.ENTITY_TYPE_MAPPING_KEY, "model.foo");
- OrmEntity ormEntity = (OrmEntity) ormPersistentType.getMapping();
- OrmDiscriminatorColumn ormColumn = ormEntity.getDiscriminatorColumn();
-
- XmlEntity entityResource = getXmlEntityMappings().getEntities().get(0);
-
- assertNull(ormColumn.getSpecifiedName());
- assertNull(entityResource.getDiscriminatorColumn());
-
- //set name in the resource model, verify context model updated
- entityResource.setDiscriminatorColumn(OrmFactory.eINSTANCE.createXmlDiscriminatorColumn());
- entityResource.getDiscriminatorColumn().setName("FOO");
- assertEquals("FOO", ormColumn.getSpecifiedName());
- assertEquals("FOO", entityResource.getDiscriminatorColumn().getName());
-
- //set name to null in the resource model
- entityResource.getDiscriminatorColumn().setName(null);
- assertNull(ormColumn.getSpecifiedName());
- assertNull(entityResource.getDiscriminatorColumn().getName());
-
- entityResource.getDiscriminatorColumn().setName("FOO");
- assertEquals("FOO", ormColumn.getSpecifiedName());
- assertEquals("FOO", entityResource.getDiscriminatorColumn().getName());
-
- entityResource.setDiscriminatorColumn(null);
- assertNull(ormColumn.getSpecifiedName());
- assertNull(entityResource.getDiscriminatorColumn());
- }
-
- public void testModifySpecifiedName() throws Exception {
- OrmPersistentType ormPersistentType = getEntityMappings().addPersistentType(MappingKeys.ENTITY_TYPE_MAPPING_KEY, "model.foo");
- OrmEntity ormEntity = (OrmEntity) ormPersistentType.getMapping();
- OrmDiscriminatorColumn ormColumn = ormEntity.getDiscriminatorColumn();
-
- XmlEntity entityResource = getXmlEntityMappings().getEntities().get(0);
-
- assertNull(ormColumn.getSpecifiedName());
- assertNull(entityResource.getDiscriminatorColumn());
-
- //set name in the context model, verify resource model modified
- ormColumn.setSpecifiedName("foo");
- assertEquals("foo", ormColumn.getSpecifiedName());
- assertEquals("foo", entityResource.getDiscriminatorColumn().getName());
-
- //set name to null in the context model
- ormColumn.setSpecifiedName(null);
- assertNull(ormColumn.getSpecifiedName());
- assertNull(entityResource.getDiscriminatorColumn());
- }
-
-// public void testUpdateDefaultNameFromJavaTable() throws Exception {
-// createTestEntity();
-//
-// OrmPersistentType ormPersistentType = entityMappings().addOrmPersistentType(IMappingKeys.ENTITY_TYPE_MAPPING_KEY, FULLY_QUALIFIED_TYPE_NAME);
-// XmlEntity ormEntity = (XmlEntity) ormPersistentType.getMapping();
-// assertEquals(TYPE_NAME, ormEntity.getTable().getDefaultName());
-//
-// ormEntity.javaEntity().getTable().setSpecifiedName("Foo");
-// assertEquals("Foo", ormEntity.getTable().getDefaultName());
-//
-// ormEntity.setSpecifiedMetadataComplete(Boolean.TRUE);
-// assertEquals(TYPE_NAME, ormEntity.getTable().getDefaultName());
-//
-// ormEntity.entityMappings().getPersistenceUnitMetadata().setXmlMappingMetadataComplete(true);
-// ormEntity.setSpecifiedMetadataComplete(Boolean.FALSE);
-// assertEquals(TYPE_NAME, ormEntity.getTable().getDefaultName());
-//
-// ormEntity.setSpecifiedMetadataComplete(null);
-// assertEquals(TYPE_NAME, ormEntity.getTable().getDefaultName());
-//
-// ormEntity.entityMappings().getPersistenceUnitMetadata().setXmlMappingMetadataComplete(false);
-// assertEquals("Foo", ormEntity.getTable().getDefaultName());
-//
-// ormEntity.getTable().setSpecifiedName("Bar");
-// assertEquals(TYPE_NAME, ormEntity.getTable().getDefaultName());
-// }
-//
-// public void testUpdateDefaultNameNoJava() throws Exception {
-// createTestEntity();
-//
-// OrmPersistentType ormPersistentType = entityMappings().addOrmPersistentType(IMappingKeys.ENTITY_TYPE_MAPPING_KEY, "model.Foo");
-// XmlEntity ormEntity = (XmlEntity) ormPersistentType.getMapping();
-// assertEquals("Foo", ormEntity.getTable().getDefaultName());
-// }
-//
-// public void testUpdateDefaultNameFromParent() throws Exception {
-// createTestEntity();
-// createTestSubType();
-//
-// OrmPersistentType parentOrmPersistentType = entityMappings().addOrmPersistentType(IMappingKeys.ENTITY_TYPE_MAPPING_KEY, FULLY_QUALIFIED_TYPE_NAME);
-// OrmPersistentType childOrmPersistentType = entityMappings().addOrmPersistentType(IMappingKeys.ENTITY_TYPE_MAPPING_KEY, PACKAGE_NAME + ".AnnotationTestTypeChild");
-// XmlEntity parentXmlEntity = (XmlEntity) parentOrmPersistentType.getMapping();
-// XmlEntity childXmlEntity = (XmlEntity) childOrmPersistentType.getMapping();
-//
-// assertEquals(TYPE_NAME, parentXmlEntity.getTable().getDefaultName());
-// assertEquals(TYPE_NAME, childXmlEntity.getTable().getDefaultName());
-//
-// parentXmlEntity.getTable().setSpecifiedName("FOO");
-// assertEquals(TYPE_NAME, parentXmlEntity.getTable().getDefaultName());
-// assertEquals("FOO", childXmlEntity.getTable().getDefaultName());
-//
-// parentXmlEntity.setSpecifiedInheritanceStrategy(InheritanceType.JOINED);
-// assertEquals(TYPE_NAME, parentXmlEntity.getTable().getDefaultName());
-// assertEquals("AnnotationTestTypeChild", childXmlEntity.getTable().getDefaultName());
-// }
-
- public void testUpdateSpecifiedLength() throws Exception {
- OrmPersistentType ormPersistentType = getEntityMappings().addPersistentType(MappingKeys.ENTITY_TYPE_MAPPING_KEY, "model.foo");
- OrmEntity ormEntity = (OrmEntity) ormPersistentType.getMapping();
- OrmDiscriminatorColumn ormColumn = ormEntity.getDiscriminatorColumn();
-
- XmlEntity entityResource = getXmlEntityMappings().getEntities().get(0);
-
- assertNull(ormColumn.getSpecifiedLength());
- assertNull(entityResource.getDiscriminatorColumn());
-
- //set name in the resource model, verify context model updated
- entityResource.setDiscriminatorColumn(OrmFactory.eINSTANCE.createXmlDiscriminatorColumn());
- entityResource.getDiscriminatorColumn().setLength(Integer.valueOf(8));
- assertEquals(Integer.valueOf(8), ormColumn.getSpecifiedLength());
- assertEquals(Integer.valueOf(8), entityResource.getDiscriminatorColumn().getLength());
-
- //set name to null in the resource model
- entityResource.getDiscriminatorColumn().setLength(null);
- assertNull(ormColumn.getSpecifiedLength());
- assertNull(entityResource.getDiscriminatorColumn().getLength());
-
- entityResource.getDiscriminatorColumn().setLength(Integer.valueOf(11));
- assertEquals(Integer.valueOf(11), ormColumn.getSpecifiedLength());
- assertEquals(Integer.valueOf(11), entityResource.getDiscriminatorColumn().getLength());
-
- entityResource.setDiscriminatorColumn(null);
- assertNull(ormColumn.getSpecifiedLength());
- assertNull(entityResource.getDiscriminatorColumn());
- }
-
- public void testModifySpecifiedLength() throws Exception {
- OrmPersistentType ormPersistentType = getEntityMappings().addPersistentType(MappingKeys.ENTITY_TYPE_MAPPING_KEY, "model.foo");
- OrmEntity ormEntity = (OrmEntity) ormPersistentType.getMapping();
- OrmDiscriminatorColumn ormColumn = ormEntity.getDiscriminatorColumn();
-
- XmlEntity entityResource = getXmlEntityMappings().getEntities().get(0);
-
- assertNull(ormColumn.getSpecifiedLength());
- assertNull(entityResource.getDiscriminatorColumn());
-
- //set name in the context model, verify resource model modified
- ormColumn.setSpecifiedLength(Integer.valueOf(7));
- assertEquals(Integer.valueOf(7), ormColumn.getSpecifiedLength());
- assertEquals(Integer.valueOf(7), entityResource.getDiscriminatorColumn().getLength());
-
- //set name to null in the context model
- ormColumn.setSpecifiedLength(null);
- assertNull(ormColumn.getSpecifiedLength());
- assertNull(entityResource.getDiscriminatorColumn());
- }
-
- public void testUpdateSpecifiedColumnDefinition() throws Exception {
- OrmPersistentType ormPersistentType = getEntityMappings().addPersistentType(MappingKeys.ENTITY_TYPE_MAPPING_KEY, "model.foo");
- OrmEntity ormEntity = (OrmEntity) ormPersistentType.getMapping();
- OrmDiscriminatorColumn ormColumn = ormEntity.getDiscriminatorColumn();
-
- XmlEntity entityResource = getXmlEntityMappings().getEntities().get(0);
-
- assertNull(ormColumn.getColumnDefinition());
- assertNull(entityResource.getDiscriminatorColumn());
-
- //set name in the resource model, verify context model updated
- entityResource.setDiscriminatorColumn(OrmFactory.eINSTANCE.createXmlDiscriminatorColumn());
- entityResource.getDiscriminatorColumn().setColumnDefinition("FOO");
- assertEquals("FOO", ormColumn.getColumnDefinition());
- assertEquals("FOO", entityResource.getDiscriminatorColumn().getColumnDefinition());
-
- //set name to null in the resource model
- entityResource.getDiscriminatorColumn().setColumnDefinition(null);
- assertNull(ormColumn.getColumnDefinition());
- assertNull(entityResource.getDiscriminatorColumn().getColumnDefinition());
-
- entityResource.getDiscriminatorColumn().setColumnDefinition("FOO");
- assertEquals("FOO", ormColumn.getColumnDefinition());
- assertEquals("FOO", entityResource.getDiscriminatorColumn().getColumnDefinition());
-
- entityResource.setDiscriminatorColumn(null);
- assertNull(ormColumn.getColumnDefinition());
- assertNull(entityResource.getDiscriminatorColumn());
- }
-
- public void testModifySpecifiedColumnDefinition() throws Exception {
- OrmPersistentType ormPersistentType = getEntityMappings().addPersistentType(MappingKeys.ENTITY_TYPE_MAPPING_KEY, "model.foo");
- OrmEntity ormEntity = (OrmEntity) ormPersistentType.getMapping();
- OrmDiscriminatorColumn ormColumn = ormEntity.getDiscriminatorColumn();
-
- XmlEntity entityResource = getXmlEntityMappings().getEntities().get(0);
-
- assertNull(ormColumn.getColumnDefinition());
- assertNull(entityResource.getDiscriminatorColumn());
-
- //set name in the context model, verify resource model modified
- ormColumn.setColumnDefinition("foo");
- assertEquals("foo", ormColumn.getColumnDefinition());
- assertEquals("foo", entityResource.getDiscriminatorColumn().getColumnDefinition());
-
- //set name to null in the context model
- ormColumn.setColumnDefinition(null);
- assertNull(ormColumn.getColumnDefinition());
- assertNull(entityResource.getDiscriminatorColumn());
- }
-
- public void testUpdateSpecifiedDiscriminatorType() throws Exception {
- OrmPersistentType ormPersistentType = getEntityMappings().addPersistentType(MappingKeys.ENTITY_TYPE_MAPPING_KEY, "model.foo");
- OrmEntity ormEntity = (OrmEntity) ormPersistentType.getMapping();
- OrmDiscriminatorColumn ormColumn = ormEntity.getDiscriminatorColumn();
-
- XmlEntity entityResource = getXmlEntityMappings().getEntities().get(0);
-
- assertNull(ormColumn.getSpecifiedDiscriminatorType());
- assertNull(entityResource.getDiscriminatorColumn());
-
- //set discriminator type in the resource model, verify context model updated
- entityResource.setDiscriminatorColumn(OrmFactory.eINSTANCE.createXmlDiscriminatorColumn());
- entityResource.getDiscriminatorColumn().setDiscriminatorType(org.eclipse.jpt.core.resource.orm.DiscriminatorType.STRING);
- assertEquals(DiscriminatorType.STRING, ormColumn.getSpecifiedDiscriminatorType());
- assertEquals(org.eclipse.jpt.core.resource.orm.DiscriminatorType.STRING, entityResource.getDiscriminatorColumn().getDiscriminatorType());
-
- //set discriminator type to null in the resource model
- entityResource.getDiscriminatorColumn().setDiscriminatorType(null);
- assertNull(ormColumn.getSpecifiedDiscriminatorType());
- assertNull(entityResource.getDiscriminatorColumn().getDiscriminatorType());
-
- entityResource.getDiscriminatorColumn().setDiscriminatorType(org.eclipse.jpt.core.resource.orm.DiscriminatorType.CHAR);
- assertEquals(DiscriminatorType.CHAR, ormColumn.getSpecifiedDiscriminatorType());
- assertEquals(org.eclipse.jpt.core.resource.orm.DiscriminatorType.CHAR, entityResource.getDiscriminatorColumn().getDiscriminatorType());
-
- entityResource.setDiscriminatorColumn(null);
- assertNull(ormColumn.getSpecifiedDiscriminatorType());
- assertNull(entityResource.getDiscriminatorColumn());
- }
-
- public void testModifySpecifiedDiscriminatorType() throws Exception {
- OrmPersistentType ormPersistentType = getEntityMappings().addPersistentType(MappingKeys.ENTITY_TYPE_MAPPING_KEY, "model.foo");
- OrmEntity ormEntity = (OrmEntity) ormPersistentType.getMapping();
- OrmDiscriminatorColumn ormColumn = ormEntity.getDiscriminatorColumn();
-
- XmlEntity entityResource = getXmlEntityMappings().getEntities().get(0);
-
- assertNull(ormColumn.getSpecifiedDiscriminatorType());
- assertNull(entityResource.getDiscriminatorColumn());
-
- //set discriminator type in the context model, verify resource model modified
- ormColumn.setSpecifiedDiscriminatorType(DiscriminatorType.STRING);
- assertEquals(DiscriminatorType.STRING, ormColumn.getSpecifiedDiscriminatorType());
- assertEquals(org.eclipse.jpt.core.resource.orm.DiscriminatorType.STRING, entityResource.getDiscriminatorColumn().getDiscriminatorType());
-
- //set discriminator type to null in the context model
- ormColumn.setSpecifiedDiscriminatorType(null);
- assertNull(ormColumn.getSpecifiedDiscriminatorType());
- assertNull(entityResource.getDiscriminatorColumn());
- }
-
- public void testDefaultsNoDiscriminatorColumnInJava() throws Exception {
- createTestAbstractEntity();
- createTestSubType();
- OrmPersistentType persistentType = getEntityMappings().addPersistentType(MappingKeys.ENTITY_TYPE_MAPPING_KEY, FULLY_QUALIFIED_TYPE_NAME);
- OrmEntity abstractEntity = (OrmEntity) persistentType.getMapping();
-
- OrmPersistentType childPersistentType = getEntityMappings().addPersistentType(MappingKeys.ENTITY_TYPE_MAPPING_KEY, PACKAGE_NAME + "." + "AnnotationTestTypeChild");
- OrmEntity childEntity = (OrmEntity) childPersistentType.getMapping();
-
- //test defaults with single-table inheritance, no specified discriminator column set
- assertEquals(InheritanceType.SINGLE_TABLE, abstractEntity.getDefaultInheritanceStrategy());
- assertEquals(DiscriminatorColumn.DEFAULT_NAME, abstractEntity.getDiscriminatorColumn().getDefaultName());
- assertEquals(DiscriminatorColumn.DEFAULT_LENGTH, abstractEntity.getDiscriminatorColumn().getDefaultLength());
- assertEquals(DiscriminatorColumn.DEFAULT_DISCRIMINATOR_TYPE, abstractEntity.getDiscriminatorColumn().getDefaultDiscriminatorType());
-
- assertEquals(InheritanceType.SINGLE_TABLE, childEntity.getDefaultInheritanceStrategy());
- assertEquals(DiscriminatorColumn.DEFAULT_NAME, childEntity.getDiscriminatorColumn().getDefaultName());
- assertEquals(DiscriminatorColumn.DEFAULT_LENGTH, childEntity.getDiscriminatorColumn().getDefaultLength());
- assertEquals(DiscriminatorColumn.DEFAULT_DISCRIMINATOR_TYPE, childEntity.getDiscriminatorColumn().getDefaultDiscriminatorType());
-
-
- //test defaults with single-table inheritance, specified discriminator column set on root
- abstractEntity.getDiscriminatorColumn().setSpecifiedName("DTYPE2");
- abstractEntity.getDiscriminatorColumn().setSpecifiedLength(Integer.valueOf(5));
- abstractEntity.getDiscriminatorColumn().setSpecifiedDiscriminatorType(DiscriminatorType.CHAR);
-
- assertEquals(InheritanceType.SINGLE_TABLE, abstractEntity.getDefaultInheritanceStrategy());
- assertEquals(DiscriminatorColumn.DEFAULT_NAME, abstractEntity.getDiscriminatorColumn().getDefaultName());
- assertEquals(DiscriminatorColumn.DEFAULT_LENGTH, abstractEntity.getDiscriminatorColumn().getDefaultLength());
- assertEquals(DiscriminatorColumn.DEFAULT_DISCRIMINATOR_TYPE, abstractEntity.getDiscriminatorColumn().getDefaultDiscriminatorType());
- assertEquals("DTYPE2", abstractEntity.getDiscriminatorColumn().getSpecifiedName());
- assertEquals(Integer.valueOf(5), abstractEntity.getDiscriminatorColumn().getSpecifiedLength());
- assertEquals(DiscriminatorType.CHAR, abstractEntity.getDiscriminatorColumn().getSpecifiedDiscriminatorType());
-
- assertEquals(InheritanceType.SINGLE_TABLE, childEntity.getDefaultInheritanceStrategy());
- assertEquals("DTYPE2", childEntity.getDiscriminatorColumn().getDefaultName());
- assertEquals(5, childEntity.getDiscriminatorColumn().getDefaultLength());
- assertEquals(DiscriminatorType.CHAR, childEntity.getDiscriminatorColumn().getDefaultDiscriminatorType());
- assertEquals(null, childEntity.getDiscriminatorColumn().getSpecifiedName());
- assertEquals(null, childEntity.getDiscriminatorColumn().getSpecifiedLength());
- assertEquals(null, childEntity.getDiscriminatorColumn().getSpecifiedDiscriminatorType());
-
-
- //test defaults with table-per-class inheritance, discriminator column does not apply
- abstractEntity.getDiscriminatorColumn().setSpecifiedName(null);
- abstractEntity.getDiscriminatorColumn().setSpecifiedLength(null);
- abstractEntity.getDiscriminatorColumn().setSpecifiedDiscriminatorType(null);
- abstractEntity.setSpecifiedInheritanceStrategy(InheritanceType.TABLE_PER_CLASS);
-
- assertEquals(InheritanceType.TABLE_PER_CLASS, abstractEntity.getInheritanceStrategy());
- assertEquals(null, abstractEntity.getDiscriminatorColumn().getDefaultName());
- assertEquals(0, abstractEntity.getDiscriminatorColumn().getDefaultLength());
- assertEquals(null, abstractEntity.getDiscriminatorColumn().getDefaultDiscriminatorType());
-
- assertEquals(InheritanceType.TABLE_PER_CLASS, childEntity.getDefaultInheritanceStrategy());
- assertEquals(null, childEntity.getDiscriminatorColumn().getDefaultName());
- assertEquals(0, childEntity.getDiscriminatorColumn().getDefaultLength());
- assertEquals(null, childEntity.getDiscriminatorColumn().getDefaultDiscriminatorType());
- }
-
- public void testDefaultsDiscriminatorColumnInJava() throws Exception {
- createTestAbstractEntity();
- createTestSubType();
- OrmPersistentType persistentType = getEntityMappings().addPersistentType(MappingKeys.ENTITY_TYPE_MAPPING_KEY, FULLY_QUALIFIED_TYPE_NAME);
- OrmEntity abstractEntity = (OrmEntity) persistentType.getMapping();
-
- OrmPersistentType childPersistentType = getEntityMappings().addPersistentType(MappingKeys.ENTITY_TYPE_MAPPING_KEY, PACKAGE_NAME + "." + "AnnotationTestTypeChild");
- OrmEntity childEntity = (OrmEntity) childPersistentType.getMapping();
-
- ((Entity) persistentType.getJavaPersistentType().getMapping()).getDiscriminatorColumn().setSpecifiedName("FOO");
- ((Entity) persistentType.getJavaPersistentType().getMapping()).getDiscriminatorColumn().setSpecifiedLength(Integer.valueOf(5));
- ((Entity) persistentType.getJavaPersistentType().getMapping()).getDiscriminatorColumn().setSpecifiedDiscriminatorType(DiscriminatorType.CHAR);
-
- //test defaults with single-table inheritance, specified discriminator column set in java
- assertEquals(InheritanceType.SINGLE_TABLE, abstractEntity.getDefaultInheritanceStrategy());
- assertEquals("FOO", abstractEntity.getDiscriminatorColumn().getDefaultName());
- assertEquals(5, abstractEntity.getDiscriminatorColumn().getDefaultLength());
- assertEquals(DiscriminatorType.CHAR, abstractEntity.getDiscriminatorColumn().getDefaultDiscriminatorType());
-
- assertEquals(InheritanceType.SINGLE_TABLE, childEntity.getDefaultInheritanceStrategy());
- assertEquals("FOO", childEntity.getDiscriminatorColumn().getDefaultName());
- assertEquals(5, childEntity.getDiscriminatorColumn().getDefaultLength());
- assertEquals(DiscriminatorType.CHAR, childEntity.getDiscriminatorColumn().getDefaultDiscriminatorType());
-
-
- //test defaults with single-table inheritance, specified discriminator column set in java, metadata-complete true
- getEntityMappings().getPersistenceUnitMetadata().setXmlMappingMetadataComplete(true);
- assertEquals(InheritanceType.SINGLE_TABLE, abstractEntity.getDefaultInheritanceStrategy());
- assertEquals(DiscriminatorColumn.DEFAULT_NAME, abstractEntity.getDiscriminatorColumn().getDefaultName());
- assertEquals(DiscriminatorColumn.DEFAULT_LENGTH, abstractEntity.getDiscriminatorColumn().getDefaultLength());
- assertEquals(DiscriminatorColumn.DEFAULT_DISCRIMINATOR_TYPE, abstractEntity.getDiscriminatorColumn().getDefaultDiscriminatorType());
-
- assertEquals(InheritanceType.SINGLE_TABLE, childEntity.getDefaultInheritanceStrategy());
- assertEquals(DiscriminatorColumn.DEFAULT_NAME, childEntity.getDiscriminatorColumn().getDefaultName());
- assertEquals(DiscriminatorColumn.DEFAULT_LENGTH, childEntity.getDiscriminatorColumn().getDefaultLength());
- assertEquals(DiscriminatorColumn.DEFAULT_DISCRIMINATOR_TYPE, childEntity.getDiscriminatorColumn().getDefaultDiscriminatorType());
-
-
- //test defaults with single-table inheritance, specified discriminator column set in orm
- getEntityMappings().getPersistenceUnitMetadata().setXmlMappingMetadataComplete(false);
- abstractEntity.getDiscriminatorColumn().setSpecifiedName("BAR");
- abstractEntity.getDiscriminatorColumn().setSpecifiedLength(Integer.valueOf(6));
- abstractEntity.getDiscriminatorColumn().setSpecifiedDiscriminatorType(DiscriminatorType.INTEGER);
-
- assertEquals(InheritanceType.SINGLE_TABLE, abstractEntity.getDefaultInheritanceStrategy());
- assertEquals(DiscriminatorColumn.DEFAULT_NAME, abstractEntity.getDiscriminatorColumn().getDefaultName());
- assertEquals(DiscriminatorColumn.DEFAULT_LENGTH, abstractEntity.getDiscriminatorColumn().getDefaultLength());
- assertEquals(DiscriminatorColumn.DEFAULT_DISCRIMINATOR_TYPE, abstractEntity.getDiscriminatorColumn().getDefaultDiscriminatorType());
-
- assertEquals(InheritanceType.SINGLE_TABLE, childEntity.getDefaultInheritanceStrategy());
- assertEquals("BAR", childEntity.getDiscriminatorColumn().getDefaultName());
- assertEquals(6, childEntity.getDiscriminatorColumn().getDefaultLength());
- assertEquals(DiscriminatorType.INTEGER, childEntity.getDiscriminatorColumn().getDefaultDiscriminatorType());
-
- }
-} \ No newline at end of file
diff --git a/jpa/tests/org.eclipse.jpt.core.tests/src/org/eclipse/jpt/core/tests/internal/context/orm/OrmEmbeddableTests.java b/jpa/tests/org.eclipse.jpt.core.tests/src/org/eclipse/jpt/core/tests/internal/context/orm/OrmEmbeddableTests.java
deleted file mode 100644
index 90edce1588..0000000000
--- a/jpa/tests/org.eclipse.jpt.core.tests/src/org/eclipse/jpt/core/tests/internal/context/orm/OrmEmbeddableTests.java
+++ /dev/null
@@ -1,295 +0,0 @@
-/*******************************************************************************
- * Copyright (c) 2007, 2009 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.
- *
- * Contributors:
- * Oracle - initial API and implementation
- ******************************************************************************/
-package org.eclipse.jpt.core.tests.internal.context.orm;
-
-import java.util.ListIterator;
-import org.eclipse.jpt.core.JptCorePlugin;
-import org.eclipse.jpt.core.MappingKeys;
-import org.eclipse.jpt.core.context.AccessType;
-import org.eclipse.jpt.core.context.orm.OrmEmbeddable;
-import org.eclipse.jpt.core.context.orm.OrmEntity;
-import org.eclipse.jpt.core.context.orm.OrmMappedSuperclass;
-import org.eclipse.jpt.core.context.orm.OrmPersistentType;
-import org.eclipse.jpt.core.resource.orm.OrmFactory;
-import org.eclipse.jpt.core.resource.orm.XmlEmbeddable;
-import org.eclipse.jpt.core.resource.orm.XmlEntity;
-import org.eclipse.jpt.core.resource.orm.XmlMappedSuperclass;
-import org.eclipse.jpt.core.resource.persistence.PersistenceFactory;
-import org.eclipse.jpt.core.resource.persistence.XmlMappingFileRef;
-import org.eclipse.jpt.core.tests.internal.context.ContextModelTestCase;
-
-@SuppressWarnings("nls")
-public class OrmEmbeddableTests extends ContextModelTestCase
-{
- public OrmEmbeddableTests(String name) {
- super(name);
- }
-
-
- @Override
- protected void setUp() throws Exception {
- super.setUp();
- XmlMappingFileRef mappingFileRef = PersistenceFactory.eINSTANCE.createXmlMappingFileRef();
- mappingFileRef.setFileName(JptCorePlugin.DEFAULT_ORM_XML_FILE_PATH);
- getXmlPersistenceUnit().getMappingFiles().add(mappingFileRef);
- getPersistenceXmlResource().save(null);
- }
-
- public void testUpdateClass() throws Exception {
- OrmPersistentType ormPersistentType = getEntityMappings().addPersistentType(MappingKeys.EMBEDDABLE_TYPE_MAPPING_KEY, "model.Foo");
- OrmEmbeddable ormEmbeddable = (OrmEmbeddable) ormPersistentType.getMapping();
- XmlEmbeddable embeddableResource = getXmlEntityMappings().getEmbeddables().get(0);
- assertEquals("model.Foo", ormEmbeddable.getClass_());
- assertEquals("model.Foo", embeddableResource.getClassName());
-
- //set class in the resource model, verify context model updated
- embeddableResource.setClassName("com.Bar");
- assertEquals("com.Bar", ormEmbeddable.getClass_());
- assertEquals("com.Bar", embeddableResource.getClassName());
-
- //set class to null in the resource model
- embeddableResource.setClassName(null);
- assertNull(ormEmbeddable.getClass_());
- assertNull(embeddableResource.getClassName());
- }
-
- public void testModifyClass() throws Exception {
- OrmPersistentType ormPersistentType = getEntityMappings().addPersistentType(MappingKeys.EMBEDDABLE_TYPE_MAPPING_KEY, "model.Foo");
- OrmEmbeddable ormEmbeddable = (OrmEmbeddable) ormPersistentType.getMapping();
- XmlEmbeddable embeddableResource = getXmlEntityMappings().getEmbeddables().get(0);
- assertEquals("model.Foo", ormEmbeddable.getClass_());
- assertEquals("model.Foo", embeddableResource.getClassName());
-
- //set class in the context model, verify resource model modified
- ormEmbeddable.setClass("com.Bar");
- assertEquals("com.Bar", ormEmbeddable.getClass_());
- assertEquals("com.Bar", embeddableResource.getClassName());
-
- //set class to null in the context model
- ormEmbeddable.setClass(null);
- assertNull(ormEmbeddable.getClass_());
- assertNull(embeddableResource.getClassName());
- }
- //TODO add tests for setting the className when the package is set on entity-mappings
-
- public void testUpdateSpecifiedAccess() throws Exception {
- OrmPersistentType ormPersistentType = getEntityMappings().addPersistentType(MappingKeys.EMBEDDABLE_TYPE_MAPPING_KEY, "model.Foo");
- XmlEmbeddable embeddableResource = getXmlEntityMappings().getEmbeddables().get(0);
- assertNull(ormPersistentType.getSpecifiedAccess());
- assertNull(embeddableResource.getAccess());
-
- //set access in the resource model, verify context model updated
- embeddableResource.setAccess(org.eclipse.jpt.core.resource.orm.AccessType.FIELD);
- assertEquals(AccessType.FIELD, ormPersistentType.getSpecifiedAccess());
- assertEquals(org.eclipse.jpt.core.resource.orm.AccessType.FIELD, embeddableResource.getAccess());
-
- //set access to null in the resource model
- embeddableResource.setAccess(null);
- assertNull(ormPersistentType.getSpecifiedAccess());
- assertNull(embeddableResource.getAccess());
- }
-
- public void testModifySpecifiedAccess() throws Exception {
- OrmPersistentType ormPersistentType = getEntityMappings().addPersistentType(MappingKeys.EMBEDDABLE_TYPE_MAPPING_KEY, "model.Foo");
- XmlEmbeddable embeddableResource = getXmlEntityMappings().getEmbeddables().get(0);
- assertNull(ormPersistentType.getSpecifiedAccess());
- assertNull(embeddableResource.getAccess());
-
- //set access in the context model, verify resource model modified
- ormPersistentType.setSpecifiedAccess(AccessType.PROPERTY);
- assertEquals(AccessType.PROPERTY, ormPersistentType.getSpecifiedAccess());
- assertEquals(org.eclipse.jpt.core.resource.orm.AccessType.PROPERTY, embeddableResource.getAccess());
-
- //set access to null in the context model
- ormPersistentType.setSpecifiedAccess(null);
- assertNull(ormPersistentType.getSpecifiedAccess());
- assertNull(embeddableResource.getAccess());
- }
- //TODO test default access from
- //underlying java
- //persistence-unit-defaults
- //entity-mappings
- //with xml-mapping-metadata-complete set
-
- public void testUpdateSpecifiedMetadataComplete() throws Exception {
- OrmPersistentType ormPersistentType = getEntityMappings().addPersistentType(MappingKeys.EMBEDDABLE_TYPE_MAPPING_KEY, "model.Foo");
- OrmEmbeddable ormEmbeddable = (OrmEmbeddable) ormPersistentType.getMapping();
- XmlEmbeddable embeddableResource = getXmlEntityMappings().getEmbeddables().get(0);
- assertNull(embeddableResource.getMetadataComplete());
-
- //set metadata-complete in the resource model, verify context model updated
- embeddableResource.setMetadataComplete(Boolean.TRUE);
- assertEquals(Boolean.TRUE, ormEmbeddable.getSpecifiedMetadataComplete());
- assertEquals(Boolean.TRUE, embeddableResource.getMetadataComplete());
-
- //set access to false in the resource model
- embeddableResource.setMetadataComplete(Boolean.FALSE);
- assertEquals(Boolean.FALSE, ormEmbeddable.getSpecifiedMetadataComplete());
- assertEquals(Boolean.FALSE, embeddableResource.getMetadataComplete());
-
- embeddableResource.setMetadataComplete(null);
- assertNull(ormEmbeddable.getSpecifiedMetadataComplete());
- assertNull(embeddableResource.getMetadataComplete());
- }
-
- public void testModifySpecifiedMetadataComplete() throws Exception {
- OrmPersistentType ormPersistentType = getEntityMappings().addPersistentType(MappingKeys.EMBEDDABLE_TYPE_MAPPING_KEY, "model.Foo");
- OrmEmbeddable ormEmbeddable = (OrmEmbeddable) ormPersistentType.getMapping();
- XmlEmbeddable embeddableResource = getXmlEntityMappings().getEmbeddables().get(0);
- assertNull(embeddableResource.getMetadataComplete());
-
- //set access in the context model, verify resource model modified
- ormEmbeddable.setSpecifiedMetadataComplete(Boolean.TRUE);
- assertEquals(Boolean.TRUE, ormEmbeddable.getSpecifiedMetadataComplete());
- assertEquals(Boolean.TRUE, embeddableResource.getMetadataComplete());
-
- //set access to null in the context model
- ormEmbeddable.setSpecifiedMetadataComplete(Boolean.FALSE);
- assertEquals(Boolean.FALSE, ormEmbeddable.getSpecifiedMetadataComplete());
- assertEquals(Boolean.FALSE, embeddableResource.getMetadataComplete());
-
- ormEmbeddable.setSpecifiedMetadataComplete(null);
- assertNull(ormEmbeddable.getSpecifiedMetadataComplete());
- assertNull(embeddableResource.getMetadataComplete());
- }
-
- public void testUpdateDefaultMetadataComplete() throws Exception {
- OrmPersistentType ormPersistentType = getEntityMappings().addPersistentType(MappingKeys.EMBEDDABLE_TYPE_MAPPING_KEY, "model.Foo");
- OrmEmbeddable ormEmbeddable = (OrmEmbeddable) ormPersistentType.getMapping();
- XmlEmbeddable embeddableResource = getXmlEntityMappings().getEmbeddables().get(0);
- assertNull(ormEmbeddable.getSpecifiedMetadataComplete());
- assertFalse(ormEmbeddable.isDefaultMetadataComplete());
- assertNull(embeddableResource.getMetadataComplete());
-
- getXmlEntityMappings().setPersistenceUnitMetadata(OrmFactory.eINSTANCE.createXmlPersistenceUnitMetadata());
- getXmlEntityMappings().getPersistenceUnitMetadata().setXmlMappingMetadataComplete(true);
- assertTrue(ormEmbeddable.isDefaultMetadataComplete());
- assertNull(ormEmbeddable.getSpecifiedMetadataComplete());
- assertNull(embeddableResource.getMetadataComplete());
-
- getXmlEntityMappings().getPersistenceUnitMetadata().setXmlMappingMetadataComplete(false);
- assertNull(ormEmbeddable.getSpecifiedMetadataComplete());
- assertFalse(ormEmbeddable.isDefaultMetadataComplete());
- assertNull(embeddableResource.getMetadataComplete());
- }
-
- public void testUpdateMetadataComplete() throws Exception {
- OrmPersistentType ormPersistentType = getEntityMappings().addPersistentType(MappingKeys.EMBEDDABLE_TYPE_MAPPING_KEY, "model.Foo");
- OrmEmbeddable ormEmbeddable = (OrmEmbeddable) ormPersistentType.getMapping();
- XmlEmbeddable embeddableResource = getXmlEntityMappings().getEmbeddables().get(0);
- assertNull(ormEmbeddable.getSpecifiedMetadataComplete());
- assertFalse(ormEmbeddable.isMetadataComplete());
- assertNull(embeddableResource.getMetadataComplete());
-
- getXmlEntityMappings().setPersistenceUnitMetadata(OrmFactory.eINSTANCE.createXmlPersistenceUnitMetadata());
- getXmlEntityMappings().getPersistenceUnitMetadata().setXmlMappingMetadataComplete(true);
- assertTrue(ormEmbeddable.isMetadataComplete());
- assertNull(ormEmbeddable.getSpecifiedMetadataComplete());
- assertNull(embeddableResource.getMetadataComplete());
-
- getXmlEntityMappings().getPersistenceUnitMetadata().setXmlMappingMetadataComplete(false);
- assertFalse(ormEmbeddable.isMetadataComplete());
- assertNull(ormEmbeddable.getSpecifiedMetadataComplete());
- assertNull(embeddableResource.getMetadataComplete());
- }
-
- public void testMakeEmbeddableEntity() throws Exception {
- OrmPersistentType embeddablePersistentType = getEntityMappings().addPersistentType(MappingKeys.EMBEDDABLE_TYPE_MAPPING_KEY, "model.Foo");
- OrmEmbeddable embeddable = (OrmEmbeddable) embeddablePersistentType.getMapping();
- embeddablePersistentType.setSpecifiedAccess(AccessType.PROPERTY);
- embeddable.setSpecifiedMetadataComplete(Boolean.TRUE);
-
- embeddablePersistentType.setMappingKey(MappingKeys.ENTITY_TYPE_MAPPING_KEY);
-
- XmlEntity entity = getXmlEntityMappings().getEntities().get(0);
- assertEquals("model.Foo", entity.getClassName());
- assertEquals(Boolean.TRUE, entity.getMetadataComplete());
- assertEquals(org.eclipse.jpt.core.resource.orm.AccessType.PROPERTY, entity.getAccess());
- assertNull(entity.getDiscriminatorValue());
- assertNull(entity.getName());
-
- OrmEntity ormEntity = (OrmEntity) embeddablePersistentType.getMapping();
- assertEquals("model.Foo", ormEntity.getClass_());
- assertEquals(Boolean.TRUE, ormEntity.getSpecifiedMetadataComplete());
- assertEquals(AccessType.PROPERTY, embeddablePersistentType.getSpecifiedAccess());
- }
-
- //test with 2 Embeddables, make the second one an Entity so it has to move to the front of the list
- public void testMakeEmbeddableEntity2() throws Exception {
- getEntityMappings().addPersistentType(MappingKeys.EMBEDDABLE_TYPE_MAPPING_KEY, "model.Foo2");
- OrmPersistentType embeddablePersistentType = getEntityMappings().addPersistentType(MappingKeys.EMBEDDABLE_TYPE_MAPPING_KEY, "model.Foo");
- OrmEmbeddable embeddable = (OrmEmbeddable) embeddablePersistentType.getMapping();
- embeddablePersistentType.setSpecifiedAccess(AccessType.PROPERTY);
- embeddable.setSpecifiedMetadataComplete(Boolean.TRUE);
-
- embeddablePersistentType.setMappingKey(MappingKeys.ENTITY_TYPE_MAPPING_KEY);
-
- XmlEntity entity = getXmlEntityMappings().getEntities().get(0);
- assertEquals("model.Foo", entity.getClassName());
- assertEquals(Boolean.TRUE, entity.getMetadataComplete());
- assertEquals(org.eclipse.jpt.core.resource.orm.AccessType.PROPERTY, entity.getAccess());
- assertNull(entity.getDiscriminatorValue());
- assertNull(entity.getName());
-
- OrmEntity ormEntity = (OrmEntity) embeddablePersistentType.getMapping();
- assertEquals("model.Foo", ormEntity.getClass_());
- assertEquals(Boolean.TRUE, ormEntity.getSpecifiedMetadataComplete());
- assertEquals(AccessType.PROPERTY, embeddablePersistentType.getSpecifiedAccess());
-
- ListIterator<OrmPersistentType> persistentTypes = getEntityMappings().persistentTypes();
- assertEquals(MappingKeys.ENTITY_TYPE_MAPPING_KEY, persistentTypes.next().getMappingKey());
- assertEquals(MappingKeys.EMBEDDABLE_TYPE_MAPPING_KEY, persistentTypes.next().getMappingKey());
- }
-
- public void testMakeEmbeddableMappedSuperclass() throws Exception {
- OrmPersistentType embeddablePersistentType = getEntityMappings().addPersistentType(MappingKeys.EMBEDDABLE_TYPE_MAPPING_KEY, "model.Foo");
- OrmEmbeddable embeddable = (OrmEmbeddable) embeddablePersistentType.getMapping();
- embeddablePersistentType.setSpecifiedAccess(AccessType.PROPERTY);
- embeddable.setSpecifiedMetadataComplete(Boolean.TRUE);
-
- embeddablePersistentType.setMappingKey(MappingKeys.MAPPED_SUPERCLASS_TYPE_MAPPING_KEY);
-
- XmlMappedSuperclass mappedSuperclass = getXmlEntityMappings().getMappedSuperclasses().get(0);
- assertEquals("model.Foo", mappedSuperclass.getClassName());
- assertEquals(Boolean.TRUE, mappedSuperclass.getMetadataComplete());
- assertEquals(org.eclipse.jpt.core.resource.orm.AccessType.PROPERTY, mappedSuperclass.getAccess());
-
- OrmMappedSuperclass ormMappedSuperclass = (OrmMappedSuperclass) embeddablePersistentType.getMapping();
- assertEquals("model.Foo", ormMappedSuperclass.getClass_());
- assertEquals(Boolean.TRUE, ormMappedSuperclass.getSpecifiedMetadataComplete());
- assertEquals(AccessType.PROPERTY, embeddablePersistentType.getSpecifiedAccess());
- }
-
- //test with 2 Embeddables, make the second one a MappedSuperclass so it has to move to the front of the list
- public void testMakeEmbeddableMappedSuperclass2() throws Exception {
- getEntityMappings().addPersistentType(MappingKeys.EMBEDDABLE_TYPE_MAPPING_KEY, "model.Foo2");
- OrmPersistentType embeddablePersistentType = getEntityMappings().addPersistentType(MappingKeys.EMBEDDABLE_TYPE_MAPPING_KEY, "model.Foo");
- OrmEmbeddable embeddable = (OrmEmbeddable) embeddablePersistentType.getMapping();
- embeddablePersistentType.setSpecifiedAccess(AccessType.PROPERTY);
- embeddable.setSpecifiedMetadataComplete(Boolean.TRUE);
-
- embeddablePersistentType.setMappingKey(MappingKeys.MAPPED_SUPERCLASS_TYPE_MAPPING_KEY);
-
- XmlMappedSuperclass mappedSuperclass = getXmlEntityMappings().getMappedSuperclasses().get(0);
- assertEquals("model.Foo", mappedSuperclass.getClassName());
- assertEquals(Boolean.TRUE, mappedSuperclass.getMetadataComplete());
- assertEquals(org.eclipse.jpt.core.resource.orm.AccessType.PROPERTY, mappedSuperclass.getAccess());
-
- OrmMappedSuperclass ormMappedSuperclass = (OrmMappedSuperclass) embeddablePersistentType.getMapping();
- assertEquals("model.Foo", ormMappedSuperclass.getClass_());
- assertEquals(Boolean.TRUE, ormMappedSuperclass.getSpecifiedMetadataComplete());
- assertEquals(AccessType.PROPERTY, embeddablePersistentType.getSpecifiedAccess());
-
- ListIterator<OrmPersistentType> persistentTypes = getEntityMappings().persistentTypes();
- assertEquals(MappingKeys.MAPPED_SUPERCLASS_TYPE_MAPPING_KEY, persistentTypes.next().getMappingKey());
- assertEquals(MappingKeys.EMBEDDABLE_TYPE_MAPPING_KEY, persistentTypes.next().getMappingKey());
- }
-
-} \ No newline at end of file
diff --git a/jpa/tests/org.eclipse.jpt.core.tests/src/org/eclipse/jpt/core/tests/internal/context/orm/OrmEmbeddedIdMappingTests.java b/jpa/tests/org.eclipse.jpt.core.tests/src/org/eclipse/jpt/core/tests/internal/context/orm/OrmEmbeddedIdMappingTests.java
deleted file mode 100644
index ed00b3c2fd..0000000000
--- a/jpa/tests/org.eclipse.jpt.core.tests/src/org/eclipse/jpt/core/tests/internal/context/orm/OrmEmbeddedIdMappingTests.java
+++ /dev/null
@@ -1,903 +0,0 @@
-/*******************************************************************************
- * Copyright (c) 2007, 2009 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.
- *
- * Contributors:
- * Oracle - initial API and implementation
- ******************************************************************************/
-package org.eclipse.jpt.core.tests.internal.context.orm;
-
-import java.util.Iterator;
-import java.util.ListIterator;
-import org.eclipse.jdt.core.ICompilationUnit;
-import org.eclipse.jpt.core.JptCorePlugin;
-import org.eclipse.jpt.core.MappingKeys;
-import org.eclipse.jpt.core.context.AttributeOverride;
-import org.eclipse.jpt.core.context.BasicMapping;
-import org.eclipse.jpt.core.context.Column;
-import org.eclipse.jpt.core.context.EmbeddedIdMapping;
-import org.eclipse.jpt.core.context.EmbeddedMapping;
-import org.eclipse.jpt.core.context.IdMapping;
-import org.eclipse.jpt.core.context.ManyToManyMapping;
-import org.eclipse.jpt.core.context.ManyToOneMapping;
-import org.eclipse.jpt.core.context.OneToManyMapping;
-import org.eclipse.jpt.core.context.OneToOneMapping;
-import org.eclipse.jpt.core.context.TransientMapping;
-import org.eclipse.jpt.core.context.VersionMapping;
-import org.eclipse.jpt.core.context.java.JavaBasicMapping;
-import org.eclipse.jpt.core.context.java.JavaEmbeddedIdMapping;
-import org.eclipse.jpt.core.context.orm.OrmAttributeOverride;
-import org.eclipse.jpt.core.context.orm.OrmColumn;
-import org.eclipse.jpt.core.context.orm.OrmEmbeddedIdMapping;
-import org.eclipse.jpt.core.context.orm.OrmEmbeddedMapping;
-import org.eclipse.jpt.core.context.orm.OrmPersistentAttribute;
-import org.eclipse.jpt.core.context.orm.OrmPersistentType;
-import org.eclipse.jpt.core.resource.java.JPA;
-import org.eclipse.jpt.core.resource.orm.OrmFactory;
-import org.eclipse.jpt.core.resource.orm.XmlEmbeddedId;
-import org.eclipse.jpt.core.resource.persistence.PersistenceFactory;
-import org.eclipse.jpt.core.resource.persistence.XmlMappingFileRef;
-import org.eclipse.jpt.core.tests.internal.context.ContextModelTestCase;
-import org.eclipse.jpt.core.tests.internal.projects.TestJavaProject.SourceWriter;
-import org.eclipse.jpt.utility.internal.iterators.ArrayIterator;
-
-@SuppressWarnings("nls")
-public class OrmEmbeddedIdMappingTests extends ContextModelTestCase
-{
- private static final String ATTRIBUTE_OVERRIDE_NAME = "city";
- private static final String ATTRIBUTE_OVERRIDE_COLUMN_NAME = "E_CITY";
-
- public OrmEmbeddedIdMappingTests(String name) {
- super(name);
- }
-
- @Override
- protected void setUp() throws Exception {
- super.setUp();
- XmlMappingFileRef mappingFileRef = PersistenceFactory.eINSTANCE.createXmlMappingFileRef();
- mappingFileRef.setFileName(JptCorePlugin.DEFAULT_ORM_XML_FILE_PATH);
- getXmlPersistenceUnit().getMappingFiles().add(mappingFileRef);
- getPersistenceXmlResource().save(null);
- }
-
- private ICompilationUnit createTestEntityEmbeddedIdMapping() throws Exception {
- return this.createTestType(new DefaultAnnotationWriter() {
- @Override
- public Iterator<String> imports() {
- return new ArrayIterator<String>(JPA.ENTITY, JPA.EMBEDDED_ID, JPA.ATTRIBUTE_OVERRIDE, JPA.COLUMN);
- }
- @Override
- public void appendTypeAnnotationTo(StringBuilder sb) {
- sb.append("@Entity");
- }
-
- @Override
- public void appendIdFieldAnnotationTo(StringBuilder sb) {
- sb.append(CR);
- sb.append(" @EmbeddedId");
- sb.append(CR);
- sb.append(" @AttributeOverride(name=\"" + ATTRIBUTE_OVERRIDE_NAME + "\", column=@Column(name=\"" + ATTRIBUTE_OVERRIDE_COLUMN_NAME + "\"))");
- sb.append(CR);
- sb.append(" private Address address;").append(CR);
- sb.append(CR);
- sb.append(" @Id");
- }
- });
- }
-
- private void createTestEmbeddableAddress() throws Exception {
- SourceWriter sourceWriter = new SourceWriter() {
- public void appendSourceTo(StringBuilder sb) {
- sb.append(CR);
- sb.append("import ");
- sb.append(JPA.EMBEDDABLE);
- sb.append(";");
- sb.append(CR);
- sb.append("import ");
- sb.append(JPA.ID);
- sb.append(";");
- sb.append(CR);
- sb.append("import ");
- sb.append(JPA.COLUMN);
- sb.append(";");
- sb.append(CR);
- sb.append(CR);
- sb.append("@Embeddable");
- sb.append(CR);
- sb.append("public class ").append("Address").append(" ");
- sb.append("{").append(CR);
- sb.append(CR);
- sb.append(" @Id").append(CR);
- sb.append(" private int id;").append(CR);
- sb.append(CR);
- sb.append(" private String city;").append(CR);
- sb.append(CR);
- sb.append(" @Column(name=\"A_STATE\")").append(CR);
- sb.append(" private String state;").append(CR);
- sb.append(CR);
- sb.append(" private int zip;").append(CR);
- sb.append(CR);
- sb.append("}").append(CR);
- }
- };
- this.javaProject.createCompilationUnit(PACKAGE_NAME, "Address.java", sourceWriter);
- }
-
-// public void testUpdateName() throws Exception {
-// OrmPersistentType ormPersistentType = entityMappings().addOrmPersistentType(IMappingKeys.ENTITY_TYPE_MAPPING_KEY, "model.Foo");
-// XmlPersistentAttribute ormPersistentAttribute = ormPersistentType.addSpecifiedPersistentAttribute(IMappingKeys.EMBEDDED_ID_ATTRIBUTE_MAPPING_KEY, "embeddedIdMapping");
-// XmlEmbeddedIdMapping xmlEmbeddedIdMapping = (XmlEmbeddedIdMapping) ormPersistentAttribute.getMapping();
-// EmbeddedId embeddedIdResource = ormResource().getEntityMappings().getEntities().get(0).getAttributes().getEmbeddedIds().get(0);
-//
-// assertEquals("embeddedIdMapping", xmlEmbeddedIdMapping.getName());
-// assertEquals("embeddedIdMapping", embeddedIdResource.getName());
-//
-// //set name in the resource model, verify context model updated
-// embeddedIdResource.setName("newName");
-// assertEquals("newName", xmlEmbeddedIdMapping.getName());
-// assertEquals("newName", embeddedIdResource.getName());
-//
-// //set name to null in the resource model
-// embeddedIdResource.setName(null);
-// assertNull(xmlEmbeddedIdMapping.getName());
-// assertNull(embeddedIdResource.getName());
-// }
-//
-// public void testModifyName() throws Exception {
-// OrmPersistentType ormPersistentType = entityMappings().addOrmPersistentType(IMappingKeys.ENTITY_TYPE_MAPPING_KEY, "model.Foo");
-// XmlPersistentAttribute ormPersistentAttribute = ormPersistentType.addSpecifiedPersistentAttribute(IMappingKeys.EMBEDDED_ID_ATTRIBUTE_MAPPING_KEY, "embeddedIdMapping");
-// XmlEmbeddedIdMapping xmlEmbeddedIdMapping = (XmlEmbeddedIdMapping) ormPersistentAttribute.getMapping();
-// EmbeddedId embeddedIdResource = ormResource().getEntityMappings().getEntities().get(0).getAttributes().getEmbeddedIds().get(0);
-//
-// assertEquals("embeddedIdMapping", xmlEmbeddedIdMapping.getName());
-// assertEquals("embeddedIdMapping", embeddedIdResource.getName());
-//
-// //set name in the context model, verify resource model updated
-// xmlEmbeddedIdMapping.setName("newName");
-// assertEquals("newName", xmlEmbeddedIdMapping.getName());
-// assertEquals("newName", embeddedIdResource.getName());
-//
-// //set name to null in the context model
-// xmlEmbeddedIdMapping.setName(null);
-// assertNull(xmlEmbeddedIdMapping.getName());
-// assertNull(embeddedIdResource.getName());
-// }
-//
-// public void testAddSpecifiedAttributeOverride() throws Exception {
-// OrmPersistentType ormPersistentType = entityMappings().addOrmPersistentType(IMappingKeys.ENTITY_TYPE_MAPPING_KEY, "model.Foo");
-// XmlPersistentAttribute ormPersistentAttribute = ormPersistentType.addSpecifiedPersistentAttribute(IMappingKeys.EMBEDDED_ID_ATTRIBUTE_MAPPING_KEY, "embeddedIdMapping");
-// XmlEmbeddedIdMapping xmlEmbeddedIdMapping = (XmlEmbeddedIdMapping) ormPersistentAttribute.getMapping();
-// EmbeddedId embeddedIdResource = ormResource().getEntityMappings().getEntities().get(0).getAttributes().getEmbeddedIds().get(0);
-//
-// XmlAttributeOverride attributeOverride = xmlEmbeddedIdMapping.addSpecifiedAttributeOverride(0);
-// ormResource().save(null);
-// attributeOverride.setName("FOO");
-// ormResource().save(null);
-//
-// assertEquals("FOO", embeddedIdResource.getAttributeOverrides().get(0).getName());
-//
-// XmlAttributeOverride attributeOverride2 = xmlEmbeddedIdMapping.addSpecifiedAttributeOverride(0);
-// ormResource().save(null);
-// attributeOverride2.setName("BAR");
-// ormResource().save(null);
-//
-// assertEquals("BAR", embeddedIdResource.getAttributeOverrides().get(0).getName());
-// assertEquals("FOO", embeddedIdResource.getAttributeOverrides().get(1).getName());
-//
-// XmlAttributeOverride attributeOverride3 = xmlEmbeddedIdMapping.addSpecifiedAttributeOverride(1);
-// ormResource().save(null);
-// attributeOverride3.setName("BAZ");
-// ormResource().save(null);
-//
-// assertEquals("BAR", embeddedIdResource.getAttributeOverrides().get(0).getName());
-// assertEquals("BAZ", embeddedIdResource.getAttributeOverrides().get(1).getName());
-// assertEquals("FOO", embeddedIdResource.getAttributeOverrides().get(2).getName());
-//
-// ListIterator<XmlAttributeOverride> attributeOverrides = xmlEmbeddedIdMapping.specifiedAttributeOverrides();
-// assertEquals(attributeOverride2, attributeOverrides.next());
-// assertEquals(attributeOverride3, attributeOverrides.next());
-// assertEquals(attributeOverride, attributeOverrides.next());
-//
-// attributeOverrides = xmlEmbeddedIdMapping.specifiedAttributeOverrides();
-// assertEquals("BAR", attributeOverrides.next().getName());
-// assertEquals("BAZ", attributeOverrides.next().getName());
-// assertEquals("FOO", attributeOverrides.next().getName());
-// }
-//
-// public void testRemoveSpecifiedAttributeOverride() throws Exception {
-// OrmPersistentType ormPersistentType = entityMappings().addOrmPersistentType(IMappingKeys.ENTITY_TYPE_MAPPING_KEY, "model.Foo");
-// XmlPersistentAttribute ormPersistentAttribute = ormPersistentType.addSpecifiedPersistentAttribute(IMappingKeys.EMBEDDED_ID_ATTRIBUTE_MAPPING_KEY, "embeddedIdMapping");
-// XmlEmbeddedIdMapping xmlEmbeddedIdMapping = (XmlEmbeddedIdMapping) ormPersistentAttribute.getMapping();
-// EmbeddedId embeddedIdResource = ormResource().getEntityMappings().getEntities().get(0).getAttributes().getEmbeddedIds().get(0);
-//
-// xmlEmbeddedIdMapping.addSpecifiedAttributeOverride(0).setName("FOO");
-// xmlEmbeddedIdMapping.addSpecifiedAttributeOverride(1).setName("BAR");
-// xmlEmbeddedIdMapping.addSpecifiedAttributeOverride(2).setName("BAZ");
-//
-// assertEquals(3, embeddedIdResource.getAttributeOverrides().size());
-//
-// xmlEmbeddedIdMapping.removeSpecifiedAttributeOverride(0);
-// assertEquals(2, embeddedIdResource.getAttributeOverrides().size());
-// assertEquals("BAR", embeddedIdResource.getAttributeOverrides().get(0).getName());
-// assertEquals("BAZ", embeddedIdResource.getAttributeOverrides().get(1).getName());
-//
-// xmlEmbeddedIdMapping.removeSpecifiedAttributeOverride(0);
-// assertEquals(1, embeddedIdResource.getAttributeOverrides().size());
-// assertEquals("BAZ", embeddedIdResource.getAttributeOverrides().get(0).getName());
-//
-// xmlEmbeddedIdMapping.removeSpecifiedAttributeOverride(0);
-// assertEquals(0, embeddedIdResource.getAttributeOverrides().size());
-// }
-//
-// public void testMoveSpecifiedAttributeOverride() throws Exception {
-// OrmPersistentType ormPersistentType = entityMappings().addOrmPersistentType(IMappingKeys.ENTITY_TYPE_MAPPING_KEY, "model.Foo");
-// XmlPersistentAttribute ormPersistentAttribute = ormPersistentType.addSpecifiedPersistentAttribute(IMappingKeys.EMBEDDED_ID_ATTRIBUTE_MAPPING_KEY, "embeddedIdMapping");
-// XmlEmbeddedIdMapping xmlEmbeddedIdMapping = (XmlEmbeddedIdMapping) ormPersistentAttribute.getMapping();
-// EmbeddedId embeddedIdResource = ormResource().getEntityMappings().getEntities().get(0).getAttributes().getEmbeddedIds().get(0);
-//
-// xmlEmbeddedIdMapping.addSpecifiedAttributeOverride(0).setName("FOO");
-// xmlEmbeddedIdMapping.addSpecifiedAttributeOverride(1).setName("BAR");
-// xmlEmbeddedIdMapping.addSpecifiedAttributeOverride(2).setName("BAZ");
-//
-// assertEquals(3, embeddedIdResource.getAttributeOverrides().size());
-//
-//
-// xmlEmbeddedIdMapping.moveSpecifiedAttributeOverride(2, 0);
-// ListIterator<XmlAttributeOverride> attributeOverrides = xmlEmbeddedIdMapping.specifiedAttributeOverrides();
-// assertEquals("BAR", attributeOverrides.next().getName());
-// assertEquals("BAZ", attributeOverrides.next().getName());
-// assertEquals("FOO", attributeOverrides.next().getName());
-//
-// assertEquals("BAR", embeddedIdResource.getAttributeOverrides().get(0).getName());
-// assertEquals("BAZ", embeddedIdResource.getAttributeOverrides().get(1).getName());
-// assertEquals("FOO", embeddedIdResource.getAttributeOverrides().get(2).getName());
-//
-//
-// xmlEmbeddedIdMapping.moveSpecifiedAttributeOverride(0, 1);
-// attributeOverrides = xmlEmbeddedIdMapping.specifiedAttributeOverrides();
-// assertEquals("BAZ", attributeOverrides.next().getName());
-// assertEquals("BAR", attributeOverrides.next().getName());
-// assertEquals("FOO", attributeOverrides.next().getName());
-//
-// assertEquals("BAZ", embeddedIdResource.getAttributeOverrides().get(0).getName());
-// assertEquals("BAR", embeddedIdResource.getAttributeOverrides().get(1).getName());
-// assertEquals("FOO", embeddedIdResource.getAttributeOverrides().get(2).getName());
-// }
-//
-// public void testUpdateAttributeOverrides() throws Exception {
-// OrmPersistentType ormPersistentType = entityMappings().addOrmPersistentType(IMappingKeys.ENTITY_TYPE_MAPPING_KEY, "model.Foo");
-// XmlPersistentAttribute ormPersistentAttribute = ormPersistentType.addSpecifiedPersistentAttribute(IMappingKeys.EMBEDDED_ID_ATTRIBUTE_MAPPING_KEY, "embeddedIdMapping");
-// XmlEmbeddedIdMapping xmlEmbeddedIdMapping = (XmlEmbeddedIdMapping) ormPersistentAttribute.getMapping();
-// EmbeddedId embeddedIdResource = ormResource().getEntityMappings().getEntities().get(0).getAttributes().getEmbeddedIds().get(0);
-//
-// embeddedIdResource.getAttributeOverrides().add(OrmFactory.eINSTANCE.createAttributeOverride());
-// embeddedIdResource.getAttributeOverrides().add(OrmFactory.eINSTANCE.createAttributeOverride());
-// embeddedIdResource.getAttributeOverrides().add(OrmFactory.eINSTANCE.createAttributeOverride());
-//
-// embeddedIdResource.getAttributeOverrides().get(0).setName("FOO");
-// embeddedIdResource.getAttributeOverrides().get(1).setName("BAR");
-// embeddedIdResource.getAttributeOverrides().get(2).setName("BAZ");
-//
-// ListIterator<XmlAttributeOverride> attributeOverrides = xmlEmbeddedIdMapping.specifiedAttributeOverrides();
-// assertEquals("FOO", attributeOverrides.next().getName());
-// assertEquals("BAR", attributeOverrides.next().getName());
-// assertEquals("BAZ", attributeOverrides.next().getName());
-// assertFalse(attributeOverrides.hasNext());
-//
-// embeddedIdResource.getAttributeOverrides().move(2, 0);
-// attributeOverrides = xmlEmbeddedIdMapping.specifiedAttributeOverrides();
-// assertEquals("BAR", attributeOverrides.next().getName());
-// assertEquals("BAZ", attributeOverrides.next().getName());
-// assertEquals("FOO", attributeOverrides.next().getName());
-// assertFalse(attributeOverrides.hasNext());
-//
-// embeddedIdResource.getAttributeOverrides().move(0, 1);
-// attributeOverrides = xmlEmbeddedIdMapping.specifiedAttributeOverrides();
-// assertEquals("BAZ", attributeOverrides.next().getName());
-// assertEquals("BAR", attributeOverrides.next().getName());
-// assertEquals("FOO", attributeOverrides.next().getName());
-// assertFalse(attributeOverrides.hasNext());
-//
-// embeddedIdResource.getAttributeOverrides().remove(1);
-// attributeOverrides = xmlEmbeddedIdMapping.specifiedAttributeOverrides();
-// assertEquals("BAZ", attributeOverrides.next().getName());
-// assertEquals("FOO", attributeOverrides.next().getName());
-// assertFalse(attributeOverrides.hasNext());
-//
-// embeddedIdResource.getAttributeOverrides().remove(1);
-// attributeOverrides = xmlEmbeddedIdMapping.specifiedAttributeOverrides();
-// assertEquals("BAZ", attributeOverrides.next().getName());
-// assertFalse(attributeOverrides.hasNext());
-//
-// embeddedIdResource.getAttributeOverrides().remove(0);
-// assertFalse(xmlEmbeddedIdMapping.specifiedAttributeOverrides().hasNext());
-// }
-
- public void testEmbeddedIdMorphToIdMapping() throws Exception {
- createTestEntityEmbeddedIdMapping();
- OrmPersistentType ormPersistentType = getEntityMappings().addPersistentType(MappingKeys.ENTITY_TYPE_MAPPING_KEY, FULLY_QUALIFIED_TYPE_NAME);
- OrmPersistentAttribute ormPersistentAttribute = ormPersistentType.addSpecifiedPersistentAttribute(MappingKeys.EMBEDDED_ID_ATTRIBUTE_MAPPING_KEY, "embeddedId");
-
- EmbeddedIdMapping embeddedIdMapping = (EmbeddedIdMapping) ormPersistentAttribute.getMapping();
- assertFalse(embeddedIdMapping.isDefault());
- XmlEmbeddedId embeddedIdResource = getXmlEntityMappings().getEntities().get(0).getAttributes().getEmbeddedIds().get(0);
- embeddedIdResource.getAttributeOverrides().add(OrmFactory.eINSTANCE.createXmlAttributeOverride());
- AttributeOverride attributeOverride = embeddedIdMapping.specifiedAttributeOverrides().next();
- attributeOverride.setName("override");
- attributeOverride.getColumn().setSpecifiedName("OVERRIDE_COLUMN");
- assertFalse(embeddedIdMapping.isDefault());
-
- ormPersistentAttribute.setSpecifiedMappingKey(MappingKeys.ID_ATTRIBUTE_MAPPING_KEY);
- assertEquals(1, ormPersistentType.specifiedAttributesSize());
- assertEquals(ormPersistentAttribute, ormPersistentType.specifiedAttributes().next());
- assertTrue(ormPersistentAttribute.getMapping() instanceof IdMapping);
- assertEquals("embeddedId", ormPersistentAttribute.getMapping().getName());
- }
-
- public void testEmbeddedIdMorphToVersionMapping() throws Exception {
- createTestEntityEmbeddedIdMapping();
- OrmPersistentType ormPersistentType = getEntityMappings().addPersistentType(MappingKeys.ENTITY_TYPE_MAPPING_KEY, FULLY_QUALIFIED_TYPE_NAME);
- OrmPersistentAttribute ormPersistentAttribute = ormPersistentType.addSpecifiedPersistentAttribute(MappingKeys.EMBEDDED_ID_ATTRIBUTE_MAPPING_KEY, "embeddedId");
-
- EmbeddedIdMapping embeddedIdMapping = (EmbeddedIdMapping) ormPersistentAttribute.getMapping();
- assertFalse(embeddedIdMapping.isDefault());
- XmlEmbeddedId embeddedIdResource = getXmlEntityMappings().getEntities().get(0).getAttributes().getEmbeddedIds().get(0);
- embeddedIdResource.getAttributeOverrides().add(OrmFactory.eINSTANCE.createXmlAttributeOverride());
- AttributeOverride attributeOverride = embeddedIdMapping.specifiedAttributeOverrides().next();
- attributeOverride.setName("override");
- attributeOverride.getColumn().setSpecifiedName("OVERRIDE_COLUMN");
- assertFalse(embeddedIdMapping.isDefault());
-
- ormPersistentAttribute.setSpecifiedMappingKey(MappingKeys.VERSION_ATTRIBUTE_MAPPING_KEY);
- assertEquals(1, ormPersistentType.specifiedAttributesSize());
- assertEquals(ormPersistentAttribute, ormPersistentType.specifiedAttributes().next());
- assertTrue(ormPersistentAttribute.getMapping() instanceof VersionMapping);
- assertEquals("embeddedId", ormPersistentAttribute.getMapping().getName());
- }
-
- public void testEmbeddedIdMorphToTransientMapping() throws Exception {
- createTestEntityEmbeddedIdMapping();
- OrmPersistentType ormPersistentType = getEntityMappings().addPersistentType(MappingKeys.ENTITY_TYPE_MAPPING_KEY, FULLY_QUALIFIED_TYPE_NAME);
- OrmPersistentAttribute ormPersistentAttribute = ormPersistentType.addSpecifiedPersistentAttribute(MappingKeys.EMBEDDED_ID_ATTRIBUTE_MAPPING_KEY, "embeddedId");
-
- EmbeddedIdMapping embeddedIdMapping = (EmbeddedIdMapping) ormPersistentAttribute.getMapping();
- assertFalse(embeddedIdMapping.isDefault());
- XmlEmbeddedId embeddedIdResource = getXmlEntityMappings().getEntities().get(0).getAttributes().getEmbeddedIds().get(0);
- embeddedIdResource.getAttributeOverrides().add(OrmFactory.eINSTANCE.createXmlAttributeOverride());
- AttributeOverride attributeOverride = embeddedIdMapping.specifiedAttributeOverrides().next();
- attributeOverride.setName("override");
- attributeOverride.getColumn().setSpecifiedName("OVERRIDE_COLUMN");
- assertFalse(embeddedIdMapping.isDefault());
-
- ormPersistentAttribute.setSpecifiedMappingKey(MappingKeys.TRANSIENT_ATTRIBUTE_MAPPING_KEY);
- assertEquals(1, ormPersistentType.specifiedAttributesSize());
- assertEquals(ormPersistentAttribute, ormPersistentType.specifiedAttributes().next());
- assertTrue(ormPersistentAttribute.getMapping() instanceof TransientMapping);
- assertEquals("embeddedId", ormPersistentAttribute.getMapping().getName());
- }
-
- public void testEmbeddedIdMorphToBasicMapping() throws Exception {
- createTestEntityEmbeddedIdMapping();
- OrmPersistentType ormPersistentType = getEntityMappings().addPersistentType(MappingKeys.ENTITY_TYPE_MAPPING_KEY, FULLY_QUALIFIED_TYPE_NAME);
- OrmPersistentAttribute ormPersistentAttribute = ormPersistentType.addSpecifiedPersistentAttribute(MappingKeys.EMBEDDED_ID_ATTRIBUTE_MAPPING_KEY, "embeddedId");
-
- EmbeddedIdMapping embeddedIdMapping = (EmbeddedIdMapping) ormPersistentAttribute.getMapping();
- assertFalse(embeddedIdMapping.isDefault());
- XmlEmbeddedId embeddedIdResource = getXmlEntityMappings().getEntities().get(0).getAttributes().getEmbeddedIds().get(0);
- embeddedIdResource.getAttributeOverrides().add(OrmFactory.eINSTANCE.createXmlAttributeOverride());
- AttributeOverride attributeOverride = embeddedIdMapping.specifiedAttributeOverrides().next();
- attributeOverride.setName("override");
- attributeOverride.getColumn().setSpecifiedName("OVERRIDE_COLUMN");
- assertFalse(embeddedIdMapping.isDefault());
-
- ormPersistentAttribute.setSpecifiedMappingKey(MappingKeys.BASIC_ATTRIBUTE_MAPPING_KEY);
- assertEquals(1, ormPersistentType.specifiedAttributesSize());
- assertEquals(ormPersistentAttribute, ormPersistentType.specifiedAttributes().next());
- assertTrue(ormPersistentAttribute.getMapping() instanceof BasicMapping);
- assertEquals("embeddedId", ormPersistentAttribute.getMapping().getName());
- }
-
- public void testEmbeddedIdMorphToEmbeddedMapping() throws Exception {
- createTestEntityEmbeddedIdMapping();
- OrmPersistentType ormPersistentType = getEntityMappings().addPersistentType(MappingKeys.ENTITY_TYPE_MAPPING_KEY, FULLY_QUALIFIED_TYPE_NAME);
- OrmPersistentAttribute ormPersistentAttribute = ormPersistentType.addSpecifiedPersistentAttribute(MappingKeys.EMBEDDED_ID_ATTRIBUTE_MAPPING_KEY, "embeddedId");
-
- EmbeddedIdMapping embeddedIdMapping = (EmbeddedIdMapping) ormPersistentAttribute.getMapping();
- assertFalse(embeddedIdMapping.isDefault());
- XmlEmbeddedId embeddedIdResource = getXmlEntityMappings().getEntities().get(0).getAttributes().getEmbeddedIds().get(0);
- embeddedIdResource.getAttributeOverrides().add(OrmFactory.eINSTANCE.createXmlAttributeOverride());
- AttributeOverride attributeOverride = embeddedIdMapping.specifiedAttributeOverrides().next();
- attributeOverride.setName("override");
- attributeOverride.getColumn().setSpecifiedName("OVERRIDE_COLUMN");
- assertFalse(embeddedIdMapping.isDefault());
-
- ormPersistentAttribute.setSpecifiedMappingKey(MappingKeys.EMBEDDED_ATTRIBUTE_MAPPING_KEY);
- assertEquals(1, ormPersistentType.specifiedAttributesSize());
- assertEquals(ormPersistentAttribute, ormPersistentType.specifiedAttributes().next());
- assertTrue(ormPersistentAttribute.getMapping() instanceof EmbeddedMapping);
- assertEquals("embeddedId", ormPersistentAttribute.getMapping().getName());
- attributeOverride = ((EmbeddedMapping) ormPersistentAttribute.getMapping()).specifiedAttributeOverrides().next();
- assertEquals("override", attributeOverride.getName());
- assertEquals("OVERRIDE_COLUMN", attributeOverride.getColumn().getSpecifiedName());
- }
-
- public void testEmbeddedIdMorphToOneToOneMapping() throws Exception {
- createTestEntityEmbeddedIdMapping();
- OrmPersistentType ormPersistentType = getEntityMappings().addPersistentType(MappingKeys.ENTITY_TYPE_MAPPING_KEY, FULLY_QUALIFIED_TYPE_NAME);
- OrmPersistentAttribute ormPersistentAttribute = ormPersistentType.addSpecifiedPersistentAttribute(MappingKeys.EMBEDDED_ID_ATTRIBUTE_MAPPING_KEY, "embeddedId");
-
- EmbeddedIdMapping embeddedIdMapping = (EmbeddedIdMapping) ormPersistentAttribute.getMapping();
- assertFalse(embeddedIdMapping.isDefault());
- XmlEmbeddedId embeddedIdResource = getXmlEntityMappings().getEntities().get(0).getAttributes().getEmbeddedIds().get(0);
- embeddedIdResource.getAttributeOverrides().add(OrmFactory.eINSTANCE.createXmlAttributeOverride());
- AttributeOverride attributeOverride = embeddedIdMapping.specifiedAttributeOverrides().next();
- attributeOverride.setName("override");
- attributeOverride.getColumn().setSpecifiedName("OVERRIDE_COLUMN");
- assertFalse(embeddedIdMapping.isDefault());
-
- ormPersistentAttribute.setSpecifiedMappingKey(MappingKeys.ONE_TO_ONE_ATTRIBUTE_MAPPING_KEY);
- assertEquals(1, ormPersistentType.specifiedAttributesSize());
- assertEquals(ormPersistentAttribute, ormPersistentType.specifiedAttributes().next());
- assertTrue(ormPersistentAttribute.getMapping() instanceof OneToOneMapping);
- assertEquals("embeddedId", ormPersistentAttribute.getMapping().getName());
- }
-
- public void testEmbeddedIdMorphToOneToManyMapping() throws Exception {
- createTestEntityEmbeddedIdMapping();
- OrmPersistentType ormPersistentType = getEntityMappings().addPersistentType(MappingKeys.ENTITY_TYPE_MAPPING_KEY, FULLY_QUALIFIED_TYPE_NAME);
- OrmPersistentAttribute ormPersistentAttribute = ormPersistentType.addSpecifiedPersistentAttribute(MappingKeys.EMBEDDED_ID_ATTRIBUTE_MAPPING_KEY, "embeddedId");
-
- EmbeddedIdMapping embeddedIdMapping = (EmbeddedIdMapping) ormPersistentAttribute.getMapping();
- assertFalse(embeddedIdMapping.isDefault());
- XmlEmbeddedId embeddedIdResource = getXmlEntityMappings().getEntities().get(0).getAttributes().getEmbeddedIds().get(0);
- embeddedIdResource.getAttributeOverrides().add(OrmFactory.eINSTANCE.createXmlAttributeOverride());
- AttributeOverride attributeOverride = embeddedIdMapping.specifiedAttributeOverrides().next();
- attributeOverride.setName("override");
- attributeOverride.getColumn().setSpecifiedName("OVERRIDE_COLUMN");
- assertFalse(embeddedIdMapping.isDefault());
-
- ormPersistentAttribute.setSpecifiedMappingKey(MappingKeys.ONE_TO_MANY_ATTRIBUTE_MAPPING_KEY);
- assertEquals(1, ormPersistentType.specifiedAttributesSize());
- assertEquals(ormPersistentAttribute, ormPersistentType.specifiedAttributes().next());
- assertTrue(ormPersistentAttribute.getMapping() instanceof OneToManyMapping);
- assertEquals("embeddedId", ormPersistentAttribute.getMapping().getName());
- }
-
- public void testEmbeddedIdMorphToManyToOneMapping() throws Exception {
- createTestEntityEmbeddedIdMapping();
- OrmPersistentType ormPersistentType = getEntityMappings().addPersistentType(MappingKeys.ENTITY_TYPE_MAPPING_KEY, FULLY_QUALIFIED_TYPE_NAME);
- OrmPersistentAttribute ormPersistentAttribute = ormPersistentType.addSpecifiedPersistentAttribute(MappingKeys.EMBEDDED_ID_ATTRIBUTE_MAPPING_KEY, "embeddedId");
-
- EmbeddedIdMapping embeddedIdMapping = (EmbeddedIdMapping) ormPersistentAttribute.getMapping();
- assertFalse(embeddedIdMapping.isDefault());
- XmlEmbeddedId embeddedIdResource = getXmlEntityMappings().getEntities().get(0).getAttributes().getEmbeddedIds().get(0);
- embeddedIdResource.getAttributeOverrides().add(OrmFactory.eINSTANCE.createXmlAttributeOverride());
- AttributeOverride attributeOverride = embeddedIdMapping.specifiedAttributeOverrides().next();
- attributeOverride.setName("override");
- attributeOverride.getColumn().setSpecifiedName("OVERRIDE_COLUMN");
- assertFalse(embeddedIdMapping.isDefault());
-
- ormPersistentAttribute.setSpecifiedMappingKey(MappingKeys.MANY_TO_ONE_ATTRIBUTE_MAPPING_KEY);
- assertTrue(ormPersistentAttribute.getMapping() instanceof ManyToOneMapping);
- assertEquals("embeddedId", ormPersistentAttribute.getMapping().getName());
- }
-
- public void testEmbeddedIdMorphToManyToManyMapping() throws Exception {
- createTestEntityEmbeddedIdMapping();
- OrmPersistentType ormPersistentType = getEntityMappings().addPersistentType(MappingKeys.ENTITY_TYPE_MAPPING_KEY, FULLY_QUALIFIED_TYPE_NAME);
- OrmPersistentAttribute ormPersistentAttribute = ormPersistentType.addSpecifiedPersistentAttribute(MappingKeys.EMBEDDED_ID_ATTRIBUTE_MAPPING_KEY, "embeddedId");
-
- EmbeddedIdMapping embeddedIdMapping = (EmbeddedIdMapping) ormPersistentAttribute.getMapping();
- assertFalse(embeddedIdMapping.isDefault());
- XmlEmbeddedId embeddedIdResource = getXmlEntityMappings().getEntities().get(0).getAttributes().getEmbeddedIds().get(0);
- embeddedIdResource.getAttributeOverrides().add(OrmFactory.eINSTANCE.createXmlAttributeOverride());
- AttributeOverride attributeOverride = embeddedIdMapping.specifiedAttributeOverrides().next();
- attributeOverride.setName("override");
- attributeOverride.getColumn().setSpecifiedName("OVERRIDE_COLUMN");
- assertFalse(embeddedIdMapping.isDefault());
-
- ormPersistentAttribute.setSpecifiedMappingKey(MappingKeys.MANY_TO_MANY_ATTRIBUTE_MAPPING_KEY);
- assertEquals(1, ormPersistentType.specifiedAttributesSize());
- assertEquals(ormPersistentAttribute, ormPersistentType.specifiedAttributes().next());
- assertTrue(ormPersistentAttribute.getMapping() instanceof ManyToManyMapping);
- assertEquals("embeddedId", ormPersistentAttribute.getMapping().getName());
- }
-
- public void testUpdateName() throws Exception {
- OrmPersistentType ormPersistentType = getEntityMappings().addPersistentType(MappingKeys.ENTITY_TYPE_MAPPING_KEY, "model.Foo");
- OrmPersistentAttribute ormPersistentAttribute = ormPersistentType.addSpecifiedPersistentAttribute(MappingKeys.EMBEDDED_ID_ATTRIBUTE_MAPPING_KEY, "embeddedMapping");
- OrmEmbeddedIdMapping ormEmbeddedMapping = (OrmEmbeddedIdMapping) ormPersistentAttribute.getMapping();
- XmlEmbeddedId embeddedResource = getXmlEntityMappings().getEntities().get(0).getAttributes().getEmbeddedIds().get(0);
-
- assertEquals("embeddedMapping", ormEmbeddedMapping.getName());
- assertEquals("embeddedMapping", embeddedResource.getName());
-
- //set name in the resource model, verify context model updated
- embeddedResource.setName("newName");
- assertEquals("newName", ormEmbeddedMapping.getName());
- assertEquals("newName", embeddedResource.getName());
-
- //set name to null in the resource model
- embeddedResource.setName(null);
- assertNull(ormEmbeddedMapping.getName());
- assertNull(embeddedResource.getName());
- }
-
- public void testModifyName() throws Exception {
- OrmPersistentType ormPersistentType = getEntityMappings().addPersistentType(MappingKeys.ENTITY_TYPE_MAPPING_KEY, "model.Foo");
- OrmPersistentAttribute ormPersistentAttribute = ormPersistentType.addSpecifiedPersistentAttribute(MappingKeys.EMBEDDED_ID_ATTRIBUTE_MAPPING_KEY, "embeddedMapping");
- OrmEmbeddedIdMapping ormEmbeddedMapping = (OrmEmbeddedIdMapping) ormPersistentAttribute.getMapping();
- XmlEmbeddedId embeddedResource = getXmlEntityMappings().getEntities().get(0).getAttributes().getEmbeddedIds().get(0);
-
- assertEquals("embeddedMapping", ormEmbeddedMapping.getName());
- assertEquals("embeddedMapping", embeddedResource.getName());
-
- //set name in the context model, verify resource model updated
- ormEmbeddedMapping.setName("newName");
- assertEquals("newName", ormEmbeddedMapping.getName());
- assertEquals("newName", embeddedResource.getName());
-
- //set name to null in the context model
- ormEmbeddedMapping.setName(null);
- assertNull(ormEmbeddedMapping.getName());
- assertNull(embeddedResource.getName());
- }
-
- public void testMoveSpecifiedAttributeOverride() throws Exception {
- OrmPersistentType ormPersistentType = getEntityMappings().addPersistentType(MappingKeys.ENTITY_TYPE_MAPPING_KEY, "model.Foo");
- OrmPersistentAttribute ormPersistentAttribute = ormPersistentType.addSpecifiedPersistentAttribute(MappingKeys.EMBEDDED_ID_ATTRIBUTE_MAPPING_KEY, "embeddedMapping");
- OrmEmbeddedIdMapping ormEmbeddedIdMapping = (OrmEmbeddedIdMapping) ormPersistentAttribute.getMapping();
- XmlEmbeddedId embeddedIdResource = getXmlEntityMappings().getEntities().get(0).getAttributes().getEmbeddedIds().get(0);
-
- embeddedIdResource.getAttributeOverrides().add(OrmFactory.eINSTANCE.createXmlAttributeOverride());
- embeddedIdResource.getAttributeOverrides().add(OrmFactory.eINSTANCE.createXmlAttributeOverride());
- embeddedIdResource.getAttributeOverrides().add(OrmFactory.eINSTANCE.createXmlAttributeOverride());
-
- embeddedIdResource.getAttributeOverrides().get(0).setName("FOO");
- embeddedIdResource.getAttributeOverrides().get(1).setName("BAR");
- embeddedIdResource.getAttributeOverrides().get(2).setName("BAZ");
-
- assertEquals(3, embeddedIdResource.getAttributeOverrides().size());
-
- ormEmbeddedIdMapping.moveSpecifiedAttributeOverride(2, 0);
- ListIterator<OrmAttributeOverride> attributeOverrides = ormEmbeddedIdMapping.specifiedAttributeOverrides();
- assertEquals("BAR", attributeOverrides.next().getName());
- assertEquals("BAZ", attributeOverrides.next().getName());
- assertEquals("FOO", attributeOverrides.next().getName());
-
- assertEquals("BAR", embeddedIdResource.getAttributeOverrides().get(0).getName());
- assertEquals("BAZ", embeddedIdResource.getAttributeOverrides().get(1).getName());
- assertEquals("FOO", embeddedIdResource.getAttributeOverrides().get(2).getName());
-
-
- ormEmbeddedIdMapping.moveSpecifiedAttributeOverride(0, 1);
- attributeOverrides = ormEmbeddedIdMapping.specifiedAttributeOverrides();
- assertEquals("BAZ", attributeOverrides.next().getName());
- assertEquals("BAR", attributeOverrides.next().getName());
- assertEquals("FOO", attributeOverrides.next().getName());
-
- assertEquals("BAZ", embeddedIdResource.getAttributeOverrides().get(0).getName());
- assertEquals("BAR", embeddedIdResource.getAttributeOverrides().get(1).getName());
- assertEquals("FOO", embeddedIdResource.getAttributeOverrides().get(2).getName());
- }
-
- public void testUpdateAttributeOverrides() throws Exception {
- OrmPersistentType ormPersistentType = getEntityMappings().addPersistentType(MappingKeys.ENTITY_TYPE_MAPPING_KEY, "model.Foo");
- OrmPersistentAttribute ormPersistentAttribute = ormPersistentType.addSpecifiedPersistentAttribute(MappingKeys.EMBEDDED_ID_ATTRIBUTE_MAPPING_KEY, "embeddedMapping");
- OrmEmbeddedIdMapping ormEmbeddedIdMapping = (OrmEmbeddedIdMapping) ormPersistentAttribute.getMapping();
- XmlEmbeddedId embeddedIdResource = getXmlEntityMappings().getEntities().get(0).getAttributes().getEmbeddedIds().get(0);
-
- embeddedIdResource.getAttributeOverrides().add(OrmFactory.eINSTANCE.createXmlAttributeOverride());
- embeddedIdResource.getAttributeOverrides().add(OrmFactory.eINSTANCE.createXmlAttributeOverride());
- embeddedIdResource.getAttributeOverrides().add(OrmFactory.eINSTANCE.createXmlAttributeOverride());
-
- embeddedIdResource.getAttributeOverrides().get(0).setName("FOO");
- embeddedIdResource.getAttributeOverrides().get(1).setName("BAR");
- embeddedIdResource.getAttributeOverrides().get(2).setName("BAZ");
-
- ListIterator<OrmAttributeOverride> attributeOverrides = ormEmbeddedIdMapping.specifiedAttributeOverrides();
- assertEquals("FOO", attributeOverrides.next().getName());
- assertEquals("BAR", attributeOverrides.next().getName());
- assertEquals("BAZ", attributeOverrides.next().getName());
- assertFalse(attributeOverrides.hasNext());
-
- embeddedIdResource.getAttributeOverrides().move(2, 0);
- attributeOverrides = ormEmbeddedIdMapping.specifiedAttributeOverrides();
- assertEquals("BAR", attributeOverrides.next().getName());
- assertEquals("BAZ", attributeOverrides.next().getName());
- assertEquals("FOO", attributeOverrides.next().getName());
- assertFalse(attributeOverrides.hasNext());
-
- embeddedIdResource.getAttributeOverrides().move(0, 1);
- attributeOverrides = ormEmbeddedIdMapping.specifiedAttributeOverrides();
- assertEquals("BAZ", attributeOverrides.next().getName());
- assertEquals("BAR", attributeOverrides.next().getName());
- assertEquals("FOO", attributeOverrides.next().getName());
- assertFalse(attributeOverrides.hasNext());
-
- embeddedIdResource.getAttributeOverrides().remove(1);
- attributeOverrides = ormEmbeddedIdMapping.specifiedAttributeOverrides();
- assertEquals("BAZ", attributeOverrides.next().getName());
- assertEquals("FOO", attributeOverrides.next().getName());
- assertFalse(attributeOverrides.hasNext());
-
- embeddedIdResource.getAttributeOverrides().remove(1);
- attributeOverrides = ormEmbeddedIdMapping.specifiedAttributeOverrides();
- assertEquals("BAZ", attributeOverrides.next().getName());
- assertFalse(attributeOverrides.hasNext());
-
- embeddedIdResource.getAttributeOverrides().remove(0);
- assertFalse(ormEmbeddedIdMapping.specifiedAttributeOverrides().hasNext());
- }
-
-
- public void testEmbeddedMappingNoUnderylingJavaAttribute() throws Exception {
- createTestEntityEmbeddedIdMapping();
- createTestEmbeddableAddress();
-
- OrmPersistentType ormPersistentType = getEntityMappings().addPersistentType(MappingKeys.ENTITY_TYPE_MAPPING_KEY, FULLY_QUALIFIED_TYPE_NAME);
- getEntityMappings().addPersistentType(MappingKeys.EMBEDDABLE_TYPE_MAPPING_KEY, PACKAGE_NAME + ".Address");
- ormPersistentType.addSpecifiedPersistentAttribute(MappingKeys.EMBEDDED_ID_ATTRIBUTE_MAPPING_KEY, "foo");
- assertEquals(3, ormPersistentType.virtualAttributesSize());
-
- OrmPersistentAttribute ormPersistentAttribute = ormPersistentType.specifiedAttributes().next();
- OrmEmbeddedIdMapping ormEmbeddedIdMapping = (OrmEmbeddedIdMapping) ormPersistentAttribute.getMapping();
-
- assertEquals("foo", ormEmbeddedIdMapping.getName());
-
-
- assertFalse(ormEmbeddedIdMapping.specifiedAttributeOverrides().hasNext());
- assertFalse(ormEmbeddedIdMapping.virtualAttributeOverrides().hasNext());
- }
-
- public void testVirtualAttributeOverrides() throws Exception {
- createTestEntityEmbeddedIdMapping();
- createTestEmbeddableAddress();
- OrmPersistentType persistentType = getEntityMappings().addPersistentType(MappingKeys.ENTITY_TYPE_MAPPING_KEY, FULLY_QUALIFIED_TYPE_NAME);
- OrmPersistentType persistentType2 = getEntityMappings().addPersistentType(MappingKeys.EMBEDDABLE_TYPE_MAPPING_KEY, PACKAGE_NAME + ".Address");
-
- //embedded mapping is virtual, specified attribute overrides should exist
- OrmPersistentAttribute ormPersistentAttribute = persistentType.getAttributeNamed("address");
- OrmEmbeddedIdMapping embeddedIdMapping = (OrmEmbeddedIdMapping) ormPersistentAttribute.getMapping();
- assertEquals(4, embeddedIdMapping.attributeOverridesSize());
- assertEquals(0, embeddedIdMapping.virtualAttributeOverridesSize());
- assertEquals(4, embeddedIdMapping.specifiedAttributeOverridesSize());
- ListIterator<OrmAttributeOverride> specifiedAttributeOverrides = embeddedIdMapping.specifiedAttributeOverrides();
- OrmAttributeOverride attributeOverride = specifiedAttributeOverrides.next();
- assertEquals("city", attributeOverride.getName());
- attributeOverride = specifiedAttributeOverrides.next();
- assertEquals("id", attributeOverride.getName());
- attributeOverride = specifiedAttributeOverrides.next();
- assertEquals("state", attributeOverride.getName());
- attributeOverride = specifiedAttributeOverrides.next();
- assertEquals("zip", attributeOverride.getName());
-
- JavaEmbeddedIdMapping javaEmbeddedIdMapping = (JavaEmbeddedIdMapping) ormPersistentAttribute.getJavaPersistentAttribute().getMapping();
- Column javaAttributeOverrideColumn = javaEmbeddedIdMapping.specifiedAttributeOverrides().next().getColumn();
-
- javaAttributeOverrideColumn.setSpecifiedName("FOO_COLUMN");
- javaAttributeOverrideColumn.setSpecifiedTable("FOO_TABLE");
- javaAttributeOverrideColumn.setColumnDefinition("COLUMN_DEF");
- javaAttributeOverrideColumn.setSpecifiedInsertable(Boolean.FALSE);
- javaAttributeOverrideColumn.setSpecifiedUpdatable(Boolean.FALSE);
- javaAttributeOverrideColumn.setSpecifiedUnique(Boolean.TRUE);
- javaAttributeOverrideColumn.setSpecifiedNullable(Boolean.FALSE);
- javaAttributeOverrideColumn.setSpecifiedLength(Integer.valueOf(5));
- javaAttributeOverrideColumn.setSpecifiedPrecision(Integer.valueOf(6));
- javaAttributeOverrideColumn.setSpecifiedScale(Integer.valueOf(7));
-
- JavaBasicMapping javaBasicMapping = (JavaBasicMapping) persistentType2.getJavaPersistentType().getAttributeNamed("state").getMapping();
- javaBasicMapping.getColumn().setSpecifiedName("MY_STATE_COLUMN");
- assertEquals(4, embeddedIdMapping.attributeOverridesSize());
- assertEquals(0, embeddedIdMapping.virtualAttributeOverridesSize());
- assertEquals(4, embeddedIdMapping.specifiedAttributeOverridesSize());
- specifiedAttributeOverrides = embeddedIdMapping.specifiedAttributeOverrides();
- attributeOverride = specifiedAttributeOverrides.next();
- assertEquals("city", attributeOverride.getName());
- assertEquals("FOO_COLUMN", attributeOverride.getColumn().getSpecifiedName());
- assertEquals("FOO_TABLE", attributeOverride.getColumn().getSpecifiedTable());
- assertEquals("COLUMN_DEF", attributeOverride.getColumn().getColumnDefinition());
- assertEquals(false, attributeOverride.getColumn().isInsertable());
- assertEquals(false, attributeOverride.getColumn().isUpdatable());
- assertEquals(true, attributeOverride.getColumn().isUnique());
- assertEquals(false, attributeOverride.getColumn().isNullable());
- assertEquals(5, attributeOverride.getColumn().getLength());
- assertEquals(6, attributeOverride.getColumn().getPrecision());
- assertEquals(7, attributeOverride.getColumn().getScale());
-
- attributeOverride = specifiedAttributeOverrides.next();
- assertEquals("id", attributeOverride.getName());
- attributeOverride = specifiedAttributeOverrides.next();
- assertEquals("state", attributeOverride.getName());
- assertEquals("MY_STATE_COLUMN", attributeOverride.getColumn().getSpecifiedName());
- attributeOverride = specifiedAttributeOverrides.next();
- assertEquals("zip", attributeOverride.getName());
-
-
-
- //embedded mapping is specified, virtual attribute overrides should exist
- persistentType.getAttributeNamed("address").makeSpecified();
- getOrmXmlResource().save(null);
- embeddedIdMapping = (OrmEmbeddedIdMapping) persistentType.getAttributeNamed("address").getMapping();
- assertEquals(4, embeddedIdMapping.attributeOverridesSize());
- assertEquals(4, embeddedIdMapping.virtualAttributeOverridesSize());
- assertEquals(0, embeddedIdMapping.specifiedAttributeOverridesSize());
- ListIterator<OrmAttributeOverride> virtualAttributeOverrides = embeddedIdMapping.virtualAttributeOverrides();
- attributeOverride = virtualAttributeOverrides.next();
- assertEquals("id", attributeOverride.getName());
- attributeOverride = virtualAttributeOverrides.next();
- assertEquals("city", attributeOverride.getName());
- assertEquals("city", attributeOverride.getColumn().getDefaultName());
- assertEquals(TYPE_NAME, attributeOverride.getColumn().getDefaultTable());
- assertEquals(null, attributeOverride.getColumn().getColumnDefinition());
- assertEquals(true, attributeOverride.getColumn().isInsertable());
- assertEquals(true, attributeOverride.getColumn().isUpdatable());
- assertEquals(false, attributeOverride.getColumn().isUnique());
- assertEquals(true, attributeOverride.getColumn().isNullable());
- assertEquals(255, attributeOverride.getColumn().getLength());
- assertEquals(0, attributeOverride.getColumn().getPrecision());
- assertEquals(0, attributeOverride.getColumn().getScale());
- attributeOverride = virtualAttributeOverrides.next();
- assertEquals("state", attributeOverride.getName());
- assertEquals("MY_STATE_COLUMN", attributeOverride.getColumn().getDefaultName());
- assertEquals(TYPE_NAME, attributeOverride.getColumn().getDefaultTable());
- attributeOverride = virtualAttributeOverrides.next();
- assertEquals("zip", attributeOverride.getName());
-
- //set one of the virtual attribute overrides to specified, verify others are still virtual
- embeddedIdMapping.virtualAttributeOverrides().next().setVirtual(false);
-
- assertEquals(4, embeddedIdMapping.attributeOverridesSize());
- assertEquals(1, embeddedIdMapping.specifiedAttributeOverridesSize());
- assertEquals(3, embeddedIdMapping.virtualAttributeOverridesSize());
- assertEquals("id", embeddedIdMapping.specifiedAttributeOverrides().next().getName());
- virtualAttributeOverrides = embeddedIdMapping.virtualAttributeOverrides();
- attributeOverride = virtualAttributeOverrides.next();
- assertEquals("city", attributeOverride.getName());
- attributeOverride = virtualAttributeOverrides.next();
- assertEquals("state", attributeOverride.getName());
- attributeOverride = virtualAttributeOverrides.next();
- assertEquals("zip", attributeOverride.getName());
- }
-
- public void testVirtualMappingMetadataCompleteFalse() throws Exception {
- createTestEntityEmbeddedIdMapping();
- createTestEmbeddableAddress();
-
- OrmPersistentType ormPersistentType = getEntityMappings().addPersistentType(MappingKeys.ENTITY_TYPE_MAPPING_KEY, FULLY_QUALIFIED_TYPE_NAME);
- getEntityMappings().addPersistentType(MappingKeys.EMBEDDABLE_TYPE_MAPPING_KEY, PACKAGE_NAME + ".Address");
- assertEquals(3, ormPersistentType.virtualAttributesSize());
- OrmPersistentAttribute ormPersistentAttribute = ormPersistentType.virtualAttributes().next();
-
- OrmEmbeddedIdMapping ormEmbeddedIdMapping = (OrmEmbeddedIdMapping) ormPersistentAttribute.getMapping();
- assertEquals("address", ormEmbeddedIdMapping.getName());
-
- assertEquals(4, ormEmbeddedIdMapping.specifiedAttributeOverridesSize());
- assertEquals(0, ormEmbeddedIdMapping.virtualAttributeOverridesSize());
- ListIterator<OrmAttributeOverride> ormAttributeOverrides = ormEmbeddedIdMapping.specifiedAttributeOverrides();
-
- OrmAttributeOverride ormAttributeOverride = ormAttributeOverrides.next();
- assertEquals(ATTRIBUTE_OVERRIDE_NAME, ormAttributeOverride.getName());
- OrmColumn ormColumn = ormAttributeOverride.getColumn();
- assertEquals(ATTRIBUTE_OVERRIDE_COLUMN_NAME, ormColumn.getSpecifiedName());
-
-
- ormAttributeOverride = ormAttributeOverrides.next();
- assertEquals("id", ormAttributeOverride.getName());
- ormColumn = ormAttributeOverride.getColumn();
- assertEquals("id", ormColumn.getSpecifiedName());
-
- ormAttributeOverride = ormAttributeOverrides.next();
- assertEquals("state", ormAttributeOverride.getName());
- ormColumn = ormAttributeOverride.getColumn();
- assertEquals("A_STATE", ormColumn.getSpecifiedName());
-
- ormAttributeOverride = ormAttributeOverrides.next();
- assertEquals("zip", ormAttributeOverride.getName());
- ormColumn = ormAttributeOverride.getColumn();
- assertEquals("zip", ormColumn.getSpecifiedName());
-
- }
-
- public void testVirtualMappingMetadataCompleteTrue() throws Exception {
- createTestEntityEmbeddedIdMapping();
- createTestEmbeddableAddress();
-
- OrmPersistentType ormPersistentType = getEntityMappings().addPersistentType(MappingKeys.ENTITY_TYPE_MAPPING_KEY, FULLY_QUALIFIED_TYPE_NAME);
- getEntityMappings().addPersistentType(MappingKeys.EMBEDDABLE_TYPE_MAPPING_KEY, PACKAGE_NAME + ".Address");
- ormPersistentType.getMapping().setSpecifiedMetadataComplete(Boolean.TRUE);
- assertEquals(3, ormPersistentType.virtualAttributesSize());
- OrmPersistentAttribute ormPersistentAttribute = ormPersistentType.virtualAttributes().next();
-
- //will be an OrmEmbeddedMapping instead of OrmEmbeddedIdMapping since that is the default
- OrmEmbeddedMapping ormEmbeddedMapping = (OrmEmbeddedMapping) ormPersistentAttribute.getMapping();
- assertEquals("address", ormEmbeddedMapping.getName());
-
- //TODO
-// assertEquals(4, ormEmbeddedIdMapping.specifiedAttributeOverridesSize());
-// assertEquals(0, CollectionTools.size(ormEmbeddedIdMapping.defaultAttributeOverrides()));
-// ListIterator<XmlAttributeOverride> ormAttributeOverrides = ormEmbeddedIdMapping.specifiedAttributeOverrides();
-//
-// XmlAttributeOverride ormAttributeOverride = ormAttributeOverrides.next();
-// assertEquals(ATTRIBUTE_OVERRIDE_NAME, ormAttributeOverride.getName());
-// XmlColumn xmlColumn = ormAttributeOverride.getColumn();
-// assertEquals("city", xmlColumn.getSpecifiedName());
-//// assertEquals(Boolean.TRUE, xmlColumn.getSpecifiedUnique());
-//// assertEquals(Boolean.FALSE, xmlColumn.getSpecifiedNullable());
-//// assertEquals(Boolean.FALSE, xmlColumn.getSpecifiedInsertable());
-//// assertEquals(Boolean.FALSE, xmlColumn.getSpecifiedUpdatable());
-//// assertEquals("COLUMN_DEFINITION", xmlColumn.getColumnDefinition());
-//// assertEquals("MY_TABLE", xmlColumn.getSpecifiedTable());
-//// assertEquals(Integer.valueOf(5), xmlColumn.getSpecifiedLength());
-//// assertEquals(Integer.valueOf(6), xmlColumn.getSpecifiedPrecision());
-//// assertEquals(Integer.valueOf(7), xmlColumn.getSpecifiedScale());
-//
-// ormAttributeOverride = ormAttributeOverrides.next();
-// assertEquals("id", ormAttributeOverride.getName());
-// xmlColumn = ormAttributeOverride.getColumn();
-// assertEquals("id", xmlColumn.getSpecifiedName());
-//
-// ormAttributeOverride = ormAttributeOverrides.next();
-// assertEquals("state", ormAttributeOverride.getName());
-// xmlColumn = ormAttributeOverride.getColumn();
-// assertEquals("state", xmlColumn.getSpecifiedName());
-//
-// ormAttributeOverride = ormAttributeOverrides.next();
-// assertEquals("zip", ormAttributeOverride.getName());
-// xmlColumn = ormAttributeOverride.getColumn();
-// assertEquals("zip", xmlColumn.getSpecifiedName());
- }
-
- public void testSpecifiedMapping() throws Exception {
- createTestEntityEmbeddedIdMapping();
- createTestEmbeddableAddress();
-
- OrmPersistentType ormPersistentType = getEntityMappings().addPersistentType(MappingKeys.ENTITY_TYPE_MAPPING_KEY, FULLY_QUALIFIED_TYPE_NAME);
- getEntityMappings().addPersistentType(MappingKeys.EMBEDDABLE_TYPE_MAPPING_KEY, PACKAGE_NAME + ".Address");
-
- ormPersistentType.addSpecifiedPersistentAttribute(MappingKeys.EMBEDDED_ID_ATTRIBUTE_MAPPING_KEY, "address");
- assertEquals(2, ormPersistentType.virtualAttributesSize());
-
- OrmPersistentAttribute ormPersistentAttribute = ormPersistentType.specifiedAttributes().next();
- OrmEmbeddedIdMapping ormEmbeddedIdMapping = (OrmEmbeddedIdMapping) ormPersistentAttribute.getMapping();
-
- assertEquals("address", ormEmbeddedIdMapping.getName());
-
- assertEquals(0, ormEmbeddedIdMapping.specifiedAttributeOverridesSize());
- //TODO
-// assertEquals(4, CollectionTools.size(ormEmbeddedIdMapping.defaultAttributeOverrides()));
-// ListIterator<XmlAttributeOverride> ormAttributeOverrides = ormEmbeddedIdMapping.defaultAttributeOverrides();
-//
-// XmlAttributeOverride ormAttributeOverride = ormAttributeOverrides.next();
-// assertEquals(ATTRIBUTE_OVERRIDE_NAME, ormAttributeOverride.getName());
-// XmlColumn xmlColumn = ormAttributeOverride.getColumn();
-// assertEquals("city", xmlColumn.getDefaultName());
-//// assertEquals(Boolean.TRUE, xmlColumn.getSpecifiedUnique());
-//// assertEquals(Boolean.FALSE, xmlColumn.getSpecifiedNullable());
-//// assertEquals(Boolean.FALSE, xmlColumn.getSpecifiedInsertable());
-//// assertEquals(Boolean.FALSE, xmlColumn.getSpecifiedUpdatable());
-//// assertEquals("COLUMN_DEFINITION", xmlColumn.getColumnDefinition());
-//// assertEquals("MY_TABLE", xmlColumn.getSpecifiedTable());
-//// assertEquals(Integer.valueOf(5), xmlColumn.getSpecifiedLength());
-//// assertEquals(Integer.valueOf(6), xmlColumn.getSpecifiedPrecision());
-//// assertEquals(Integer.valueOf(7), xmlColumn.getSpecifiedScale());
-//
-// ormAttributeOverride = ormAttributeOverrides.next();
-// assertEquals("id", ormAttributeOverride.getName());
-// xmlColumn = ormAttributeOverride.getColumn();
-// assertEquals("id", xmlColumn.getDefaultName());
-//
-// ormAttributeOverride = ormAttributeOverrides.next();
-// assertEquals("state", ormAttributeOverride.getName());
-// xmlColumn = ormAttributeOverride.getColumn();
-// assertEquals("state", xmlColumn.getDefaultName());
-//
-// ormAttributeOverride = ormAttributeOverrides.next();
-// assertEquals("zip", ormAttributeOverride.getName());
-// xmlColumn = ormAttributeOverride.getColumn();
-// assertEquals("zip", xmlColumn.getDefaultName());
- }
-
-} \ No newline at end of file
diff --git a/jpa/tests/org.eclipse.jpt.core.tests/src/org/eclipse/jpt/core/tests/internal/context/orm/OrmEmbeddedMappingTests.java b/jpa/tests/org.eclipse.jpt.core.tests/src/org/eclipse/jpt/core/tests/internal/context/orm/OrmEmbeddedMappingTests.java
deleted file mode 100644
index ab46528dc4..0000000000
--- a/jpa/tests/org.eclipse.jpt.core.tests/src/org/eclipse/jpt/core/tests/internal/context/orm/OrmEmbeddedMappingTests.java
+++ /dev/null
@@ -1,773 +0,0 @@
-/*******************************************************************************
- * Copyright (c) 2007, 2009 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.
- *
- * Contributors:
- * Oracle - initial API and implementation
- ******************************************************************************/
-package org.eclipse.jpt.core.tests.internal.context.orm;
-
-import java.util.Iterator;
-import java.util.ListIterator;
-import org.eclipse.jdt.core.ICompilationUnit;
-import org.eclipse.jpt.core.JptCorePlugin;
-import org.eclipse.jpt.core.MappingKeys;
-import org.eclipse.jpt.core.context.AttributeOverride;
-import org.eclipse.jpt.core.context.BasicMapping;
-import org.eclipse.jpt.core.context.Column;
-import org.eclipse.jpt.core.context.EmbeddedIdMapping;
-import org.eclipse.jpt.core.context.EmbeddedMapping;
-import org.eclipse.jpt.core.context.IdMapping;
-import org.eclipse.jpt.core.context.ManyToManyMapping;
-import org.eclipse.jpt.core.context.ManyToOneMapping;
-import org.eclipse.jpt.core.context.OneToManyMapping;
-import org.eclipse.jpt.core.context.OneToOneMapping;
-import org.eclipse.jpt.core.context.TransientMapping;
-import org.eclipse.jpt.core.context.VersionMapping;
-import org.eclipse.jpt.core.context.java.JavaBasicMapping;
-import org.eclipse.jpt.core.context.java.JavaEmbeddedMapping;
-import org.eclipse.jpt.core.context.orm.OrmAttributeOverride;
-import org.eclipse.jpt.core.context.orm.OrmColumn;
-import org.eclipse.jpt.core.context.orm.OrmEmbeddedMapping;
-import org.eclipse.jpt.core.context.orm.OrmPersistentAttribute;
-import org.eclipse.jpt.core.context.orm.OrmPersistentType;
-import org.eclipse.jpt.core.resource.java.JPA;
-import org.eclipse.jpt.core.resource.orm.OrmFactory;
-import org.eclipse.jpt.core.resource.orm.XmlEmbedded;
-import org.eclipse.jpt.core.resource.persistence.PersistenceFactory;
-import org.eclipse.jpt.core.resource.persistence.XmlMappingFileRef;
-import org.eclipse.jpt.core.tests.internal.context.ContextModelTestCase;
-import org.eclipse.jpt.core.tests.internal.projects.TestJavaProject.SourceWriter;
-import org.eclipse.jpt.utility.internal.iterators.ArrayIterator;
-
-@SuppressWarnings("nls")
-public class OrmEmbeddedMappingTests extends ContextModelTestCase
-{
- private static final String ATTRIBUTE_OVERRIDE_NAME = "city";
- private static final String ATTRIBUTE_OVERRIDE_COLUMN_NAME = "E_CITY";
-
- public OrmEmbeddedMappingTests(String name) {
- super(name);
- }
-
- @Override
- protected void setUp() throws Exception {
- super.setUp();
- XmlMappingFileRef mappingFileRef = PersistenceFactory.eINSTANCE.createXmlMappingFileRef();
- mappingFileRef.setFileName(JptCorePlugin.DEFAULT_ORM_XML_FILE_PATH);
- getXmlPersistenceUnit().getMappingFiles().add(mappingFileRef);
- getPersistenceXmlResource().save(null);
- }
-
- private ICompilationUnit createTestEntityEmbeddedMapping() throws Exception {
- return this.createTestType(new DefaultAnnotationWriter() {
- @Override
- public Iterator<String> imports() {
- return new ArrayIterator<String>(JPA.ENTITY, JPA.EMBEDDED, JPA.ATTRIBUTE_OVERRIDE, JPA.COLUMN);
- }
- @Override
- public void appendTypeAnnotationTo(StringBuilder sb) {
- sb.append("@Entity");
- }
-
- @Override
- public void appendIdFieldAnnotationTo(StringBuilder sb) {
- sb.append(CR);
- sb.append(" @Embedded");
- sb.append(CR);
- sb.append(" @AttributeOverride(name=\"" + ATTRIBUTE_OVERRIDE_NAME + "\", column=@Column(name=\"" + ATTRIBUTE_OVERRIDE_COLUMN_NAME + "\"))");
- sb.append(CR);
- sb.append(" private Address address;").append(CR);
- sb.append(CR);
- sb.append(" @Id");
- }
- });
- }
-
- private void createTestEmbeddableAddress() throws Exception {
- SourceWriter sourceWriter = new SourceWriter() {
- public void appendSourceTo(StringBuilder sb) {
- sb.append(CR);
- sb.append("import ");
- sb.append(JPA.EMBEDDABLE);
- sb.append(";");
- sb.append(CR);
- sb.append("import ");
- sb.append(JPA.ID);
- sb.append(";");
- sb.append(CR);
- sb.append("import ");
- sb.append(JPA.COLUMN);
- sb.append(";");
- sb.append(CR);
- sb.append(CR);
- sb.append("@Embeddable");
- sb.append(CR);
- sb.append("public class ").append("Address").append(" ");
- sb.append("{").append(CR);
- sb.append(CR);
- sb.append(" @Id").append(CR);
- sb.append(" private int id;").append(CR);
- sb.append(CR);
- sb.append(" private String city;").append(CR);
- sb.append(CR);
- sb.append(" @Column(name=\"A_STATE\")").append(CR);
- sb.append(" private String state;").append(CR);
- sb.append(CR);
- sb.append(" private int zip;").append(CR);
- sb.append(CR);
- sb.append("}").append(CR);
- }
- };
- this.javaProject.createCompilationUnit(PACKAGE_NAME, "Address.java", sourceWriter);
- }
-
- public void testUpdateName() throws Exception {
- OrmPersistentType ormPersistentType = getEntityMappings().addPersistentType(MappingKeys.ENTITY_TYPE_MAPPING_KEY, "model.Foo");
- OrmPersistentAttribute ormPersistentAttribute = ormPersistentType.addSpecifiedPersistentAttribute(MappingKeys.EMBEDDED_ATTRIBUTE_MAPPING_KEY, "embeddedMapping");
- OrmEmbeddedMapping ormEmbeddedMapping = (OrmEmbeddedMapping) ormPersistentAttribute.getMapping();
- XmlEmbedded embeddedResource = getXmlEntityMappings().getEntities().get(0).getAttributes().getEmbeddeds().get(0);
-
- assertEquals("embeddedMapping", ormEmbeddedMapping.getName());
- assertEquals("embeddedMapping", embeddedResource.getName());
-
- //set name in the resource model, verify context model updated
- embeddedResource.setName("newName");
- assertEquals("newName", ormEmbeddedMapping.getName());
- assertEquals("newName", embeddedResource.getName());
-
- //set name to null in the resource model
- embeddedResource.setName(null);
- assertNull(ormEmbeddedMapping.getName());
- assertNull(embeddedResource.getName());
- }
-
- public void testModifyName() throws Exception {
- OrmPersistentType ormPersistentType = getEntityMappings().addPersistentType(MappingKeys.ENTITY_TYPE_MAPPING_KEY, "model.Foo");
- OrmPersistentAttribute ormPersistentAttribute = ormPersistentType.addSpecifiedPersistentAttribute(MappingKeys.EMBEDDED_ATTRIBUTE_MAPPING_KEY, "embeddedMapping");
- OrmEmbeddedMapping ormEmbeddedMapping = (OrmEmbeddedMapping) ormPersistentAttribute.getMapping();
- XmlEmbedded embeddedResource = getXmlEntityMappings().getEntities().get(0).getAttributes().getEmbeddeds().get(0);
-
- assertEquals("embeddedMapping", ormEmbeddedMapping.getName());
- assertEquals("embeddedMapping", embeddedResource.getName());
-
- //set name in the context model, verify resource model updated
- ormEmbeddedMapping.setName("newName");
- assertEquals("newName", ormEmbeddedMapping.getName());
- assertEquals("newName", embeddedResource.getName());
-
- //set name to null in the context model
- ormEmbeddedMapping.setName(null);
- assertNull(ormEmbeddedMapping.getName());
- assertNull(embeddedResource.getName());
- }
-
-// public void testAddSpecifiedAttributeOverride() throws Exception {
-// OrmPersistentType ormPersistentType = entityMappings().addOrmPersistentType(MappingKeys.ENTITY_TYPE_MAPPING_KEY, "model.Foo");
-// OrmPersistentAttribute ormPersistentAttribute = ormPersistentType.addSpecifiedPersistentAttribute(MappingKeys.EMBEDDED_ATTRIBUTE_MAPPING_KEY, "embeddedMapping");
-// OrmEmbeddedMapping ormEmbeddedMapping = (OrmEmbeddedMapping) ormPersistentAttribute.getMapping();
-// XmlEmbedded embeddedResource = ormResource().getEntityMappings().getEntities().get(0).getAttributes().getEmbeddeds().get(0);
-//
-// OrmAttributeOverride attributeOverride = ormEmbeddedMapping.addSpecifiedAttributeOverride(0);
-// attributeOverride.setName("FOO");
-//
-// assertEquals("FOO", embeddedResource.getAttributeOverrides().get(0).getName());
-//
-// OrmAttributeOverride attributeOverride2 = ormEmbeddedMapping.addSpecifiedAttributeOverride(0);
-// attributeOverride2.setName("BAR");
-//
-// assertEquals("BAR", embeddedResource.getAttributeOverrides().get(0).getName());
-// assertEquals("FOO", embeddedResource.getAttributeOverrides().get(1).getName());
-//
-// OrmAttributeOverride attributeOverride3 = ormEmbeddedMapping.addSpecifiedAttributeOverride(1);
-// attributeOverride3.setName("BAZ");
-//
-// assertEquals("BAR", embeddedResource.getAttributeOverrides().get(0).getName());
-// assertEquals("BAZ", embeddedResource.getAttributeOverrides().get(1).getName());
-// assertEquals("FOO", embeddedResource.getAttributeOverrides().get(2).getName());
-//
-// ListIterator<OrmAttributeOverride> attributeOverrides = ormEmbeddedMapping.specifiedAttributeOverrides();
-// assertEquals(attributeOverride2, attributeOverrides.next());
-// assertEquals(attributeOverride3, attributeOverrides.next());
-// assertEquals(attributeOverride, attributeOverrides.next());
-//
-// attributeOverrides = ormEmbeddedMapping.specifiedAttributeOverrides();
-// assertEquals("BAR", attributeOverrides.next().getName());
-// assertEquals("BAZ", attributeOverrides.next().getName());
-// assertEquals("FOO", attributeOverrides.next().getName());
-// }
-//
-// public void testRemoveSpecifiedAttributeOverride() throws Exception {
-// OrmPersistentType ormPersistentType = entityMappings().addOrmPersistentType(MappingKeys.ENTITY_TYPE_MAPPING_KEY, "model.Foo");
-// OrmPersistentAttribute ormPersistentAttribute = ormPersistentType.addSpecifiedPersistentAttribute(MappingKeys.EMBEDDED_ATTRIBUTE_MAPPING_KEY, "embeddedMapping");
-// OrmEmbeddedMapping ormEmbeddedMapping = (OrmEmbeddedMapping) ormPersistentAttribute.getMapping();
-// XmlEmbedded embeddedResource = ormResource().getEntityMappings().getEntities().get(0).getAttributes().getEmbeddeds().get(0);
-//
-// ormEmbeddedMapping.addSpecifiedAttributeOverride(0).setName("FOO");
-// ormEmbeddedMapping.addSpecifiedAttributeOverride(1).setName("BAR");
-// ormEmbeddedMapping.addSpecifiedAttributeOverride(2).setName("BAZ");
-//
-// assertEquals(3, embeddedResource.getAttributeOverrides().size());
-//
-// ormEmbeddedMapping.removeSpecifiedAttributeOverride(0);
-// assertEquals(2, embeddedResource.getAttributeOverrides().size());
-// assertEquals("BAR", embeddedResource.getAttributeOverrides().get(0).getName());
-// assertEquals("BAZ", embeddedResource.getAttributeOverrides().get(1).getName());
-//
-// ormEmbeddedMapping.removeSpecifiedAttributeOverride(0);
-// assertEquals(1, embeddedResource.getAttributeOverrides().size());
-// assertEquals("BAZ", embeddedResource.getAttributeOverrides().get(0).getName());
-//
-// ormEmbeddedMapping.removeSpecifiedAttributeOverride(0);
-// assertEquals(0, embeddedResource.getAttributeOverrides().size());
-// }
-
- public void testMoveSpecifiedAttributeOverride() throws Exception {
- OrmPersistentType ormPersistentType = getEntityMappings().addPersistentType(MappingKeys.ENTITY_TYPE_MAPPING_KEY, "model.Foo");
- OrmPersistentAttribute ormPersistentAttribute = ormPersistentType.addSpecifiedPersistentAttribute(MappingKeys.EMBEDDED_ATTRIBUTE_MAPPING_KEY, "embeddedMapping");
- OrmEmbeddedMapping ormEmbeddedMapping = (OrmEmbeddedMapping) ormPersistentAttribute.getMapping();
- XmlEmbedded embeddedResource = getXmlEntityMappings().getEntities().get(0).getAttributes().getEmbeddeds().get(0);
-
- embeddedResource.getAttributeOverrides().add(OrmFactory.eINSTANCE.createXmlAttributeOverride());
- embeddedResource.getAttributeOverrides().add(OrmFactory.eINSTANCE.createXmlAttributeOverride());
- embeddedResource.getAttributeOverrides().add(OrmFactory.eINSTANCE.createXmlAttributeOverride());
-
- embeddedResource.getAttributeOverrides().get(0).setName("FOO");
- embeddedResource.getAttributeOverrides().get(1).setName("BAR");
- embeddedResource.getAttributeOverrides().get(2).setName("BAZ");
-
- assertEquals(3, embeddedResource.getAttributeOverrides().size());
-
- ormEmbeddedMapping.moveSpecifiedAttributeOverride(2, 0);
- ListIterator<OrmAttributeOverride> attributeOverrides = ormEmbeddedMapping.specifiedAttributeOverrides();
- assertEquals("BAR", attributeOverrides.next().getName());
- assertEquals("BAZ", attributeOverrides.next().getName());
- assertEquals("FOO", attributeOverrides.next().getName());
-
- assertEquals("BAR", embeddedResource.getAttributeOverrides().get(0).getName());
- assertEquals("BAZ", embeddedResource.getAttributeOverrides().get(1).getName());
- assertEquals("FOO", embeddedResource.getAttributeOverrides().get(2).getName());
-
-
- ormEmbeddedMapping.moveSpecifiedAttributeOverride(0, 1);
- attributeOverrides = ormEmbeddedMapping.specifiedAttributeOverrides();
- assertEquals("BAZ", attributeOverrides.next().getName());
- assertEquals("BAR", attributeOverrides.next().getName());
- assertEquals("FOO", attributeOverrides.next().getName());
-
- assertEquals("BAZ", embeddedResource.getAttributeOverrides().get(0).getName());
- assertEquals("BAR", embeddedResource.getAttributeOverrides().get(1).getName());
- assertEquals("FOO", embeddedResource.getAttributeOverrides().get(2).getName());
- }
-
- public void testUpdateAttributeOverrides() throws Exception {
- OrmPersistentType ormPersistentType = getEntityMappings().addPersistentType(MappingKeys.ENTITY_TYPE_MAPPING_KEY, "model.Foo");
- OrmPersistentAttribute ormPersistentAttribute = ormPersistentType.addSpecifiedPersistentAttribute(MappingKeys.EMBEDDED_ATTRIBUTE_MAPPING_KEY, "embeddedMapping");
- OrmEmbeddedMapping ormEmbeddedMapping = (OrmEmbeddedMapping) ormPersistentAttribute.getMapping();
- XmlEmbedded embeddedResource = getXmlEntityMappings().getEntities().get(0).getAttributes().getEmbeddeds().get(0);
-
- embeddedResource.getAttributeOverrides().add(OrmFactory.eINSTANCE.createXmlAttributeOverride());
- embeddedResource.getAttributeOverrides().add(OrmFactory.eINSTANCE.createXmlAttributeOverride());
- embeddedResource.getAttributeOverrides().add(OrmFactory.eINSTANCE.createXmlAttributeOverride());
-
- embeddedResource.getAttributeOverrides().get(0).setName("FOO");
- embeddedResource.getAttributeOverrides().get(1).setName("BAR");
- embeddedResource.getAttributeOverrides().get(2).setName("BAZ");
-
- ListIterator<OrmAttributeOverride> attributeOverrides = ormEmbeddedMapping.specifiedAttributeOverrides();
- assertEquals("FOO", attributeOverrides.next().getName());
- assertEquals("BAR", attributeOverrides.next().getName());
- assertEquals("BAZ", attributeOverrides.next().getName());
- assertFalse(attributeOverrides.hasNext());
-
- embeddedResource.getAttributeOverrides().move(2, 0);
- attributeOverrides = ormEmbeddedMapping.specifiedAttributeOverrides();
- assertEquals("BAR", attributeOverrides.next().getName());
- assertEquals("BAZ", attributeOverrides.next().getName());
- assertEquals("FOO", attributeOverrides.next().getName());
- assertFalse(attributeOverrides.hasNext());
-
- embeddedResource.getAttributeOverrides().move(0, 1);
- attributeOverrides = ormEmbeddedMapping.specifiedAttributeOverrides();
- assertEquals("BAZ", attributeOverrides.next().getName());
- assertEquals("BAR", attributeOverrides.next().getName());
- assertEquals("FOO", attributeOverrides.next().getName());
- assertFalse(attributeOverrides.hasNext());
-
- embeddedResource.getAttributeOverrides().remove(1);
- attributeOverrides = ormEmbeddedMapping.specifiedAttributeOverrides();
- assertEquals("BAZ", attributeOverrides.next().getName());
- assertEquals("FOO", attributeOverrides.next().getName());
- assertFalse(attributeOverrides.hasNext());
-
- embeddedResource.getAttributeOverrides().remove(1);
- attributeOverrides = ormEmbeddedMapping.specifiedAttributeOverrides();
- assertEquals("BAZ", attributeOverrides.next().getName());
- assertFalse(attributeOverrides.hasNext());
-
- embeddedResource.getAttributeOverrides().remove(0);
- assertFalse(ormEmbeddedMapping.specifiedAttributeOverrides().hasNext());
- }
-
-
- public void testEmbeddedMappingNoUnderylingJavaAttribute() throws Exception {
- createTestEntityEmbeddedMapping();
- createTestEmbeddableAddress();
-
- OrmPersistentType ormPersistentType = getEntityMappings().addPersistentType(MappingKeys.ENTITY_TYPE_MAPPING_KEY, FULLY_QUALIFIED_TYPE_NAME);
- getEntityMappings().addPersistentType(MappingKeys.EMBEDDABLE_TYPE_MAPPING_KEY, PACKAGE_NAME + ".Address");
- ormPersistentType.addSpecifiedPersistentAttribute(MappingKeys.EMBEDDED_ATTRIBUTE_MAPPING_KEY, "foo");
- assertEquals(3, ormPersistentType.virtualAttributesSize());
-
- OrmPersistentAttribute ormPersistentAttribute = ormPersistentType.specifiedAttributes().next();
- OrmEmbeddedMapping ormEmbeddedMapping = (OrmEmbeddedMapping) ormPersistentAttribute.getMapping();
-
- assertEquals("foo", ormEmbeddedMapping.getName());
-
-
- assertFalse(ormEmbeddedMapping.specifiedAttributeOverrides().hasNext());
- assertFalse(ormEmbeddedMapping.virtualAttributeOverrides().hasNext());
- }
-
- public void testVirtualAttributeOverrides() throws Exception {
- createTestEntityEmbeddedMapping();
- createTestEmbeddableAddress();
- OrmPersistentType persistentType = getEntityMappings().addPersistentType(MappingKeys.ENTITY_TYPE_MAPPING_KEY, FULLY_QUALIFIED_TYPE_NAME);
- OrmPersistentType persistentType2 = getEntityMappings().addPersistentType(MappingKeys.EMBEDDABLE_TYPE_MAPPING_KEY, PACKAGE_NAME + ".Address");
-
- //embedded mapping is virtual, specified attribute overrides should exist
- OrmPersistentAttribute ormPersistentAttribute = persistentType.getAttributeNamed("address");
- OrmEmbeddedMapping embeddedMapping = (OrmEmbeddedMapping) ormPersistentAttribute.getMapping();
- assertEquals(4, embeddedMapping.attributeOverridesSize());
- assertEquals(0, embeddedMapping.virtualAttributeOverridesSize());
- assertEquals(4, embeddedMapping.specifiedAttributeOverridesSize());
- ListIterator<OrmAttributeOverride> specifiedAttributeOverrides = embeddedMapping.specifiedAttributeOverrides();
- OrmAttributeOverride attributeOverride = specifiedAttributeOverrides.next();
- assertEquals("city", attributeOverride.getName());
- attributeOverride = specifiedAttributeOverrides.next();
- assertEquals("id", attributeOverride.getName());
- attributeOverride = specifiedAttributeOverrides.next();
- assertEquals("state", attributeOverride.getName());
- attributeOverride = specifiedAttributeOverrides.next();
- assertEquals("zip", attributeOverride.getName());
-
- JavaEmbeddedMapping javaEmbeddedMapping = (JavaEmbeddedMapping) ormPersistentAttribute.getJavaPersistentAttribute().getMapping();
- Column javaAttributeOverrideColumn = javaEmbeddedMapping.specifiedAttributeOverrides().next().getColumn();
-
- javaAttributeOverrideColumn.setSpecifiedName("FOO_COLUMN");
- javaAttributeOverrideColumn.setSpecifiedTable("FOO_TABLE");
- javaAttributeOverrideColumn.setColumnDefinition("COLUMN_DEF");
- javaAttributeOverrideColumn.setSpecifiedInsertable(Boolean.FALSE);
- javaAttributeOverrideColumn.setSpecifiedUpdatable(Boolean.FALSE);
- javaAttributeOverrideColumn.setSpecifiedUnique(Boolean.TRUE);
- javaAttributeOverrideColumn.setSpecifiedNullable(Boolean.FALSE);
- javaAttributeOverrideColumn.setSpecifiedLength(Integer.valueOf(5));
- javaAttributeOverrideColumn.setSpecifiedPrecision(Integer.valueOf(6));
- javaAttributeOverrideColumn.setSpecifiedScale(Integer.valueOf(7));
-
- JavaBasicMapping javaBasicMapping = (JavaBasicMapping) persistentType2.getJavaPersistentType().getAttributeNamed("state").getMapping();
- javaBasicMapping.getColumn().setSpecifiedName("MY_STATE_COLUMN");
- assertEquals(4, embeddedMapping.attributeOverridesSize());
- assertEquals(0, embeddedMapping.virtualAttributeOverridesSize());
- assertEquals(4, embeddedMapping.specifiedAttributeOverridesSize());
- specifiedAttributeOverrides = embeddedMapping.specifiedAttributeOverrides();
- attributeOverride = specifiedAttributeOverrides.next();
- assertEquals("city", attributeOverride.getName());
- assertEquals("FOO_COLUMN", attributeOverride.getColumn().getSpecifiedName());
- assertEquals("FOO_TABLE", attributeOverride.getColumn().getSpecifiedTable());
- assertEquals("COLUMN_DEF", attributeOverride.getColumn().getColumnDefinition());
- assertEquals(false, attributeOverride.getColumn().isInsertable());
- assertEquals(false, attributeOverride.getColumn().isUpdatable());
- assertEquals(true, attributeOverride.getColumn().isUnique());
- assertEquals(false, attributeOverride.getColumn().isNullable());
- assertEquals(5, attributeOverride.getColumn().getLength());
- assertEquals(6, attributeOverride.getColumn().getPrecision());
- assertEquals(7, attributeOverride.getColumn().getScale());
-
- attributeOverride = specifiedAttributeOverrides.next();
- assertEquals("id", attributeOverride.getName());
- attributeOverride = specifiedAttributeOverrides.next();
- assertEquals("state", attributeOverride.getName());
- assertEquals("MY_STATE_COLUMN", attributeOverride.getColumn().getSpecifiedName());
- attributeOverride = specifiedAttributeOverrides.next();
- assertEquals("zip", attributeOverride.getName());
-
-
-
- //embedded mapping is specified, virtual attribute overrides should exist
- persistentType.getAttributeNamed("address").makeSpecified();
- getOrmXmlResource().save(null);
- embeddedMapping = (OrmEmbeddedMapping) persistentType.getAttributeNamed("address").getMapping();
- assertEquals(4, embeddedMapping.attributeOverridesSize());
- assertEquals(4, embeddedMapping.virtualAttributeOverridesSize());
- assertEquals(0, embeddedMapping.specifiedAttributeOverridesSize());
- ListIterator<OrmAttributeOverride> virtualAttributeOverrides = embeddedMapping.virtualAttributeOverrides();
- attributeOverride = virtualAttributeOverrides.next();
- assertEquals("id", attributeOverride.getName());
- attributeOverride = virtualAttributeOverrides.next();
- assertEquals("city", attributeOverride.getName());
- assertEquals("city", attributeOverride.getColumn().getName());
- assertEquals(TYPE_NAME, attributeOverride.getColumn().getTable());
- assertEquals(null, attributeOverride.getColumn().getColumnDefinition());
- assertEquals(true, attributeOverride.getColumn().isInsertable());
- assertEquals(true, attributeOverride.getColumn().isUpdatable());
- assertEquals(false, attributeOverride.getColumn().isUnique());
- assertEquals(true, attributeOverride.getColumn().isNullable());
- assertEquals(255, attributeOverride.getColumn().getLength());
- assertEquals(0, attributeOverride.getColumn().getPrecision());
- assertEquals(0, attributeOverride.getColumn().getScale());
- attributeOverride = virtualAttributeOverrides.next();
- assertEquals("state", attributeOverride.getName());
- assertEquals("MY_STATE_COLUMN", attributeOverride.getColumn().getDefaultName());
- assertEquals(TYPE_NAME, attributeOverride.getColumn().getDefaultTable());
- attributeOverride = virtualAttributeOverrides.next();
- assertEquals("zip", attributeOverride.getName());
-
- //set one of the virtual attribute overrides to specified, verify others are still virtual
- embeddedMapping.virtualAttributeOverrides().next().setVirtual(false);
-
- assertEquals(4, embeddedMapping.attributeOverridesSize());
- assertEquals(1, embeddedMapping.specifiedAttributeOverridesSize());
- assertEquals(3, embeddedMapping.virtualAttributeOverridesSize());
- assertEquals("id", embeddedMapping.specifiedAttributeOverrides().next().getName());
- virtualAttributeOverrides = embeddedMapping.virtualAttributeOverrides();
- attributeOverride = virtualAttributeOverrides.next();
- assertEquals("city", attributeOverride.getName());
- attributeOverride = virtualAttributeOverrides.next();
- assertEquals("state", attributeOverride.getName());
- attributeOverride = virtualAttributeOverrides.next();
- assertEquals("zip", attributeOverride.getName());
- }
-
-
- public void testVirtualMappingMetadataCompleteFalse() throws Exception {
- createTestEntityEmbeddedMapping();
- createTestEmbeddableAddress();
-
- OrmPersistentType ormPersistentType = getEntityMappings().addPersistentType(MappingKeys.ENTITY_TYPE_MAPPING_KEY, FULLY_QUALIFIED_TYPE_NAME);
- getEntityMappings().addPersistentType(MappingKeys.EMBEDDABLE_TYPE_MAPPING_KEY, PACKAGE_NAME + ".Address");
- assertEquals(3, ormPersistentType.virtualAttributesSize());
- OrmPersistentAttribute ormPersistentAttribute = ormPersistentType.virtualAttributes().next();
-
- OrmEmbeddedMapping ormEmbeddedMapping = (OrmEmbeddedMapping) ormPersistentAttribute.getMapping();
- assertEquals("address", ormEmbeddedMapping.getName());
-
- assertEquals(4, ormEmbeddedMapping.specifiedAttributeOverridesSize());
- assertEquals(0, ormEmbeddedMapping.virtualAttributeOverridesSize());
- ListIterator<OrmAttributeOverride> ormAttributeOverrides = ormEmbeddedMapping.specifiedAttributeOverrides();
-
- OrmAttributeOverride ormAttributeOverride = ormAttributeOverrides.next();
- assertEquals(ATTRIBUTE_OVERRIDE_NAME, ormAttributeOverride.getName());
- OrmColumn ormColumn = ormAttributeOverride.getColumn();
- assertEquals(ATTRIBUTE_OVERRIDE_COLUMN_NAME, ormColumn.getSpecifiedName());
-
-
- ormAttributeOverride = ormAttributeOverrides.next();
- assertEquals("id", ormAttributeOverride.getName());
- ormColumn = ormAttributeOverride.getColumn();
- assertEquals("id", ormColumn.getSpecifiedName());
-
- ormAttributeOverride = ormAttributeOverrides.next();
- assertEquals("state", ormAttributeOverride.getName());
- ormColumn = ormAttributeOverride.getColumn();
- assertEquals("A_STATE", ormColumn.getSpecifiedName());
-
- ormAttributeOverride = ormAttributeOverrides.next();
- assertEquals("zip", ormAttributeOverride.getName());
- ormColumn = ormAttributeOverride.getColumn();
- assertEquals("zip", ormColumn.getSpecifiedName());
-
- }
-
- public void testVirtualMappingMetadataCompleteTrue() throws Exception {
- createTestEntityEmbeddedMapping();
- createTestEmbeddableAddress();
-
- OrmPersistentType ormPersistentType = getEntityMappings().addPersistentType(MappingKeys.ENTITY_TYPE_MAPPING_KEY, FULLY_QUALIFIED_TYPE_NAME);
- getEntityMappings().addPersistentType(MappingKeys.EMBEDDABLE_TYPE_MAPPING_KEY, PACKAGE_NAME + ".Address");
- ormPersistentType.getMapping().setSpecifiedMetadataComplete(Boolean.TRUE);
- assertEquals(3, ormPersistentType.virtualAttributesSize());
- OrmPersistentAttribute ormPersistentAttribute = ormPersistentType.virtualAttributes().next();
-
- OrmEmbeddedMapping ormEmbeddedMapping = (OrmEmbeddedMapping) ormPersistentAttribute.getMapping();
- assertEquals("address", ormEmbeddedMapping.getName());
-
- //TODO
-// assertEquals(4, ormEmbeddedMapping.specifiedAttributeOverridesSize());
-// assertEquals(0, CollectionTools.size(ormEmbeddedMapping.defaultAttributeOverrides()));
-// ListIterator<XmlAttributeOverride> ormAttributeOverrides = ormEmbeddedMapping.specifiedAttributeOverrides();
-//
-// XmlAttributeOverride ormAttributeOverride = ormAttributeOverrides.next();
-// assertEquals(ATTRIBUTE_OVERRIDE_NAME, ormAttributeOverride.getName());
-// XmlColumn xmlColumn = ormAttributeOverride.getColumn();
-// assertEquals("city", xmlColumn.getSpecifiedName());
-//// assertEquals(Boolean.TRUE, xmlColumn.getSpecifiedUnique());
-//// assertEquals(Boolean.FALSE, xmlColumn.getSpecifiedNullable());
-//// assertEquals(Boolean.FALSE, xmlColumn.getSpecifiedInsertable());
-//// assertEquals(Boolean.FALSE, xmlColumn.getSpecifiedUpdatable());
-//// assertEquals("COLUMN_DEFINITION", xmlColumn.getColumnDefinition());
-//// assertEquals("MY_TABLE", xmlColumn.getSpecifiedTable());
-//// assertEquals(Integer.valueOf(5), xmlColumn.getSpecifiedLength());
-//// assertEquals(Integer.valueOf(6), xmlColumn.getSpecifiedPrecision());
-//// assertEquals(Integer.valueOf(7), xmlColumn.getSpecifiedScale());
-//
-// ormAttributeOverride = ormAttributeOverrides.next();
-// assertEquals("id", ormAttributeOverride.getName());
-// xmlColumn = ormAttributeOverride.getColumn();
-// assertEquals("id", xmlColumn.getSpecifiedName());
-//
-// ormAttributeOverride = ormAttributeOverrides.next();
-// assertEquals("state", ormAttributeOverride.getName());
-// xmlColumn = ormAttributeOverride.getColumn();
-// assertEquals("state", xmlColumn.getSpecifiedName());
-//
-// ormAttributeOverride = ormAttributeOverrides.next();
-// assertEquals("zip", ormAttributeOverride.getName());
-// xmlColumn = ormAttributeOverride.getColumn();
-// assertEquals("zip", xmlColumn.getSpecifiedName());
- }
-
- public void testSpecifiedMapping() throws Exception {
- createTestEntityEmbeddedMapping();
- createTestEmbeddableAddress();
-
- OrmPersistentType ormPersistentType = getEntityMappings().addPersistentType(MappingKeys.ENTITY_TYPE_MAPPING_KEY, FULLY_QUALIFIED_TYPE_NAME);
- getEntityMappings().addPersistentType(MappingKeys.EMBEDDABLE_TYPE_MAPPING_KEY, PACKAGE_NAME + ".Address");
-
- ormPersistentType.addSpecifiedPersistentAttribute(MappingKeys.EMBEDDED_ATTRIBUTE_MAPPING_KEY, "address");
- assertEquals(2, ormPersistentType.virtualAttributesSize());
-
- OrmPersistentAttribute ormPersistentAttribute = ormPersistentType.specifiedAttributes().next();
- OrmEmbeddedMapping ormEmbeddedMapping = (OrmEmbeddedMapping) ormPersistentAttribute.getMapping();
-
- assertEquals("address", ormEmbeddedMapping.getName());
-
- assertEquals(0, ormEmbeddedMapping.specifiedAttributeOverridesSize());
- //TODO
-// assertEquals(4, CollectionTools.size(ormEmbeddedMapping.defaultAttributeOverrides()));
-// ListIterator<XmlAttributeOverride> ormAttributeOverrides = ormEmbeddedMapping.defaultAttributeOverrides();
-//
-// XmlAttributeOverride ormAttributeOverride = ormAttributeOverrides.next();
-// assertEquals(ATTRIBUTE_OVERRIDE_NAME, ormAttributeOverride.getName());
-// XmlColumn xmlColumn = ormAttributeOverride.getColumn();
-// assertEquals("city", xmlColumn.getDefaultName());
-//// assertEquals(Boolean.TRUE, xmlColumn.getSpecifiedUnique());
-//// assertEquals(Boolean.FALSE, xmlColumn.getSpecifiedNullable());
-//// assertEquals(Boolean.FALSE, xmlColumn.getSpecifiedInsertable());
-//// assertEquals(Boolean.FALSE, xmlColumn.getSpecifiedUpdatable());
-//// assertEquals("COLUMN_DEFINITION", xmlColumn.getColumnDefinition());
-//// assertEquals("MY_TABLE", xmlColumn.getSpecifiedTable());
-//// assertEquals(Integer.valueOf(5), xmlColumn.getSpecifiedLength());
-//// assertEquals(Integer.valueOf(6), xmlColumn.getSpecifiedPrecision());
-//// assertEquals(Integer.valueOf(7), xmlColumn.getSpecifiedScale());
-//
-// ormAttributeOverride = ormAttributeOverrides.next();
-// assertEquals("id", ormAttributeOverride.getName());
-// xmlColumn = ormAttributeOverride.getColumn();
-// assertEquals("id", xmlColumn.getDefaultName());
-//
-// ormAttributeOverride = ormAttributeOverrides.next();
-// assertEquals("state", ormAttributeOverride.getName());
-// xmlColumn = ormAttributeOverride.getColumn();
-// assertEquals("state", xmlColumn.getDefaultName());
-//
-// ormAttributeOverride = ormAttributeOverrides.next();
-// assertEquals("zip", ormAttributeOverride.getName());
-// xmlColumn = ormAttributeOverride.getColumn();
-// assertEquals("zip", xmlColumn.getDefaultName());
- }
-
-
- public void testEmbeddedMorphToIdMapping() throws Exception {
- createTestEntityEmbeddedMapping();
- OrmPersistentType ormPersistentType = getEntityMappings().addPersistentType(MappingKeys.ENTITY_TYPE_MAPPING_KEY, FULLY_QUALIFIED_TYPE_NAME);
- OrmPersistentAttribute ormPersistentAttribute = ormPersistentType.addSpecifiedPersistentAttribute(MappingKeys.EMBEDDED_ATTRIBUTE_MAPPING_KEY, "embedded");
-
- EmbeddedMapping embeddedMapping = (EmbeddedMapping) ormPersistentAttribute.getMapping();
- assertFalse(embeddedMapping.isDefault());
- XmlEmbedded embeddedResource = getXmlEntityMappings().getEntities().get(0).getAttributes().getEmbeddeds().get(0);
- embeddedResource.getAttributeOverrides().add(OrmFactory.eINSTANCE.createXmlAttributeOverride());
- AttributeOverride attributeOverride = embeddedMapping.specifiedAttributeOverrides().next();
- attributeOverride.setName("override");
- attributeOverride.getColumn().setSpecifiedName("OVERRIDE_COLUMN");
- assertFalse(embeddedMapping.isDefault());
-
- ormPersistentAttribute.setSpecifiedMappingKey(MappingKeys.ID_ATTRIBUTE_MAPPING_KEY);
- assertEquals(1, ormPersistentType.specifiedAttributesSize());
- assertEquals(ormPersistentAttribute, ormPersistentType.specifiedAttributes().next());
- assertTrue(ormPersistentAttribute.getMapping() instanceof IdMapping);
- assertEquals("embedded", ormPersistentAttribute.getMapping().getName());
- }
-
- public void testEmbeddedMorphToVersionMapping() throws Exception {
- createTestEntityEmbeddedMapping();
- OrmPersistentType ormPersistentType = getEntityMappings().addPersistentType(MappingKeys.ENTITY_TYPE_MAPPING_KEY, FULLY_QUALIFIED_TYPE_NAME);
- OrmPersistentAttribute ormPersistentAttribute = ormPersistentType.addSpecifiedPersistentAttribute(MappingKeys.EMBEDDED_ATTRIBUTE_MAPPING_KEY, "embedded");
-
- EmbeddedMapping embeddedMapping = (EmbeddedMapping) ormPersistentAttribute.getMapping();
- assertFalse(embeddedMapping.isDefault());
- XmlEmbedded embeddedResource = getXmlEntityMappings().getEntities().get(0).getAttributes().getEmbeddeds().get(0);
- embeddedResource.getAttributeOverrides().add(OrmFactory.eINSTANCE.createXmlAttributeOverride());
- AttributeOverride attributeOverride = embeddedMapping.specifiedAttributeOverrides().next();
- attributeOverride.setName("override");
- attributeOverride.getColumn().setSpecifiedName("OVERRIDE_COLUMN");
- assertFalse(embeddedMapping.isDefault());
-
- ormPersistentAttribute.setSpecifiedMappingKey(MappingKeys.VERSION_ATTRIBUTE_MAPPING_KEY);
- assertEquals(1, ormPersistentType.specifiedAttributesSize());
- assertEquals(ormPersistentAttribute, ormPersistentType.specifiedAttributes().next());
- assertTrue(ormPersistentAttribute.getMapping() instanceof VersionMapping);
- assertEquals("embedded", ormPersistentAttribute.getMapping().getName());
- }
-
- public void testEmbeddedMorphToTransientMapping() throws Exception {
- createTestEntityEmbeddedMapping();
- OrmPersistentType ormPersistentType = getEntityMappings().addPersistentType(MappingKeys.ENTITY_TYPE_MAPPING_KEY, FULLY_QUALIFIED_TYPE_NAME);
- OrmPersistentAttribute ormPersistentAttribute = ormPersistentType.addSpecifiedPersistentAttribute(MappingKeys.EMBEDDED_ATTRIBUTE_MAPPING_KEY, "embedded");
-
- EmbeddedMapping embeddedMapping = (EmbeddedMapping) ormPersistentAttribute.getMapping();
- assertFalse(embeddedMapping.isDefault());
- XmlEmbedded embeddedResource = getXmlEntityMappings().getEntities().get(0).getAttributes().getEmbeddeds().get(0);
- embeddedResource.getAttributeOverrides().add(OrmFactory.eINSTANCE.createXmlAttributeOverride());
- AttributeOverride attributeOverride = embeddedMapping.specifiedAttributeOverrides().next();
- attributeOverride.setName("override");
- attributeOverride.getColumn().setSpecifiedName("OVERRIDE_COLUMN");
- assertFalse(embeddedMapping.isDefault());
-
- ormPersistentAttribute.setSpecifiedMappingKey(MappingKeys.TRANSIENT_ATTRIBUTE_MAPPING_KEY);
- assertEquals(1, ormPersistentType.specifiedAttributesSize());
- assertEquals(ormPersistentAttribute, ormPersistentType.specifiedAttributes().next());
- assertTrue(ormPersistentAttribute.getMapping() instanceof TransientMapping);
- assertEquals("embedded", ormPersistentAttribute.getMapping().getName());
- }
-
- public void testEmbeddedMorphToBasicMapping() throws Exception {
- createTestEntityEmbeddedMapping();
- OrmPersistentType ormPersistentType = getEntityMappings().addPersistentType(MappingKeys.ENTITY_TYPE_MAPPING_KEY, FULLY_QUALIFIED_TYPE_NAME);
- OrmPersistentAttribute ormPersistentAttribute = ormPersistentType.addSpecifiedPersistentAttribute(MappingKeys.EMBEDDED_ATTRIBUTE_MAPPING_KEY, "embedded");
-
- EmbeddedMapping embeddedMapping = (EmbeddedMapping) ormPersistentAttribute.getMapping();
- assertFalse(embeddedMapping.isDefault());
- XmlEmbedded embeddedResource = getXmlEntityMappings().getEntities().get(0).getAttributes().getEmbeddeds().get(0);
- embeddedResource.getAttributeOverrides().add(OrmFactory.eINSTANCE.createXmlAttributeOverride());
- AttributeOverride attributeOverride = embeddedMapping.specifiedAttributeOverrides().next();
- attributeOverride.setName("override");
- attributeOverride.getColumn().setSpecifiedName("OVERRIDE_COLUMN");
- assertFalse(embeddedMapping.isDefault());
-
- ormPersistentAttribute.setSpecifiedMappingKey(MappingKeys.BASIC_ATTRIBUTE_MAPPING_KEY);
- assertEquals(1, ormPersistentType.specifiedAttributesSize());
- assertEquals(ormPersistentAttribute, ormPersistentType.specifiedAttributes().next());
- assertTrue(ormPersistentAttribute.getMapping() instanceof BasicMapping);
- assertEquals("embedded", ormPersistentAttribute.getMapping().getName());
- }
-
- public void testEmbeddedMorphToEmbeddedIdMapping() throws Exception {
- createTestEntityEmbeddedMapping();
- OrmPersistentType ormPersistentType = getEntityMappings().addPersistentType(MappingKeys.ENTITY_TYPE_MAPPING_KEY, FULLY_QUALIFIED_TYPE_NAME);
- OrmPersistentAttribute ormPersistentAttribute = ormPersistentType.addSpecifiedPersistentAttribute(MappingKeys.EMBEDDED_ATTRIBUTE_MAPPING_KEY, "embedded");
-
- EmbeddedMapping embeddedMapping = (EmbeddedMapping) ormPersistentAttribute.getMapping();
- assertFalse(embeddedMapping.isDefault());
- XmlEmbedded embeddedResource = getXmlEntityMappings().getEntities().get(0).getAttributes().getEmbeddeds().get(0);
- embeddedResource.getAttributeOverrides().add(OrmFactory.eINSTANCE.createXmlAttributeOverride());
- AttributeOverride attributeOverride = embeddedMapping.specifiedAttributeOverrides().next();
- attributeOverride.setName("override");
- attributeOverride.getColumn().setSpecifiedName("OVERRIDE_COLUMN");
- assertFalse(embeddedMapping.isDefault());
-
- ormPersistentAttribute.setSpecifiedMappingKey(MappingKeys.EMBEDDED_ID_ATTRIBUTE_MAPPING_KEY);
- assertTrue(ormPersistentAttribute.getMapping() instanceof EmbeddedIdMapping);
- assertEquals(1, ormPersistentType.specifiedAttributesSize());
- assertEquals(ormPersistentAttribute, ormPersistentType.specifiedAttributes().next());
- assertEquals("embedded", ormPersistentAttribute.getMapping().getName());
- attributeOverride = ((EmbeddedIdMapping) ormPersistentAttribute.getMapping()).specifiedAttributeOverrides().next();
- assertEquals("override", attributeOverride.getName());
- assertEquals("OVERRIDE_COLUMN", attributeOverride.getColumn().getSpecifiedName());
- }
-
- public void testEmbeddedMorphToOneToOneMapping() throws Exception {
- createTestEntityEmbeddedMapping();
- OrmPersistentType ormPersistentType = getEntityMappings().addPersistentType(MappingKeys.ENTITY_TYPE_MAPPING_KEY, FULLY_QUALIFIED_TYPE_NAME);
- OrmPersistentAttribute ormPersistentAttribute = ormPersistentType.addSpecifiedPersistentAttribute(MappingKeys.EMBEDDED_ATTRIBUTE_MAPPING_KEY, "embedded");
-
- EmbeddedMapping embeddedMapping = (EmbeddedMapping) ormPersistentAttribute.getMapping();
- assertFalse(embeddedMapping.isDefault());
- XmlEmbedded embeddedResource = getXmlEntityMappings().getEntities().get(0).getAttributes().getEmbeddeds().get(0);
- embeddedResource.getAttributeOverrides().add(OrmFactory.eINSTANCE.createXmlAttributeOverride());
- AttributeOverride attributeOverride = embeddedMapping.specifiedAttributeOverrides().next();
- attributeOverride.setName("override");
- attributeOverride.getColumn().setSpecifiedName("OVERRIDE_COLUMN");
- assertFalse(embeddedMapping.isDefault());
-
- ormPersistentAttribute.setSpecifiedMappingKey(MappingKeys.ONE_TO_ONE_ATTRIBUTE_MAPPING_KEY);
- assertEquals(1, ormPersistentType.specifiedAttributesSize());
- assertEquals(ormPersistentAttribute, ormPersistentType.specifiedAttributes().next());
- assertTrue(ormPersistentAttribute.getMapping() instanceof OneToOneMapping);
- assertEquals("embedded", ormPersistentAttribute.getMapping().getName());
- }
-
- public void testEmbeddedMorphToOneToManyMapping() throws Exception {
- createTestEntityEmbeddedMapping();
- OrmPersistentType ormPersistentType = getEntityMappings().addPersistentType(MappingKeys.ENTITY_TYPE_MAPPING_KEY, FULLY_QUALIFIED_TYPE_NAME);
- OrmPersistentAttribute ormPersistentAttribute = ormPersistentType.addSpecifiedPersistentAttribute(MappingKeys.EMBEDDED_ATTRIBUTE_MAPPING_KEY, "embedded");
-
- EmbeddedMapping embeddedMapping = (EmbeddedMapping) ormPersistentAttribute.getMapping();
- assertFalse(embeddedMapping.isDefault());
- XmlEmbedded embeddedResource = getXmlEntityMappings().getEntities().get(0).getAttributes().getEmbeddeds().get(0);
- embeddedResource.getAttributeOverrides().add(OrmFactory.eINSTANCE.createXmlAttributeOverride());
- AttributeOverride attributeOverride = embeddedMapping.specifiedAttributeOverrides().next();
- attributeOverride.setName("override");
- attributeOverride.getColumn().setSpecifiedName("OVERRIDE_COLUMN");
- assertFalse(embeddedMapping.isDefault());
-
- ormPersistentAttribute.setSpecifiedMappingKey(MappingKeys.ONE_TO_MANY_ATTRIBUTE_MAPPING_KEY);
- assertEquals(1, ormPersistentType.specifiedAttributesSize());
- assertEquals(ormPersistentAttribute, ormPersistentType.specifiedAttributes().next());
- assertTrue(ormPersistentAttribute.getMapping() instanceof OneToManyMapping);
- assertEquals("embedded", ormPersistentAttribute.getMapping().getName());
- }
-
- public void testEmbeddedMorphToManyToOneMapping() throws Exception {
- createTestEntityEmbeddedMapping();
- OrmPersistentType ormPersistentType = getEntityMappings().addPersistentType(MappingKeys.ENTITY_TYPE_MAPPING_KEY, FULLY_QUALIFIED_TYPE_NAME);
- OrmPersistentAttribute ormPersistentAttribute = ormPersistentType.addSpecifiedPersistentAttribute(MappingKeys.EMBEDDED_ATTRIBUTE_MAPPING_KEY, "embedded");
-
- EmbeddedMapping embeddedMapping = (EmbeddedMapping) ormPersistentAttribute.getMapping();
- assertFalse(embeddedMapping.isDefault());
- XmlEmbedded embeddedResource = getXmlEntityMappings().getEntities().get(0).getAttributes().getEmbeddeds().get(0);
- embeddedResource.getAttributeOverrides().add(OrmFactory.eINSTANCE.createXmlAttributeOverride());
- AttributeOverride attributeOverride = embeddedMapping.specifiedAttributeOverrides().next();
- attributeOverride.setName("override");
- attributeOverride.getColumn().setSpecifiedName("OVERRIDE_COLUMN");
- assertFalse(embeddedMapping.isDefault());
-
- ormPersistentAttribute.setSpecifiedMappingKey(MappingKeys.MANY_TO_ONE_ATTRIBUTE_MAPPING_KEY);
- assertEquals(1, ormPersistentType.specifiedAttributesSize());
- assertEquals(ormPersistentAttribute, ormPersistentType.specifiedAttributes().next());
- assertTrue(ormPersistentAttribute.getMapping() instanceof ManyToOneMapping);
- assertEquals("embedded", ormPersistentAttribute.getMapping().getName());
- }
-
- public void testEmbeddedMorphToManyToManyMapping() throws Exception {
- createTestEntityEmbeddedMapping();
- OrmPersistentType ormPersistentType = getEntityMappings().addPersistentType(MappingKeys.ENTITY_TYPE_MAPPING_KEY, FULLY_QUALIFIED_TYPE_NAME);
- OrmPersistentAttribute ormPersistentAttribute = ormPersistentType.addSpecifiedPersistentAttribute(MappingKeys.EMBEDDED_ATTRIBUTE_MAPPING_KEY, "embedded");
-
- EmbeddedMapping embeddedMapping = (EmbeddedMapping) ormPersistentAttribute.getMapping();
- assertFalse(embeddedMapping.isDefault());
- XmlEmbedded embeddedResource = getXmlEntityMappings().getEntities().get(0).getAttributes().getEmbeddeds().get(0);
- embeddedResource.getAttributeOverrides().add(OrmFactory.eINSTANCE.createXmlAttributeOverride());
- AttributeOverride attributeOverride = embeddedMapping.specifiedAttributeOverrides().next();
- attributeOverride.setName("override");
- attributeOverride.getColumn().setSpecifiedName("OVERRIDE_COLUMN");
- assertFalse(embeddedMapping.isDefault());
-
- ormPersistentAttribute.setSpecifiedMappingKey(MappingKeys.MANY_TO_MANY_ATTRIBUTE_MAPPING_KEY);
- assertTrue(ormPersistentAttribute.getMapping() instanceof ManyToManyMapping);
- assertEquals("embedded", ormPersistentAttribute.getMapping().getName());
- }
-
-} \ No newline at end of file
diff --git a/jpa/tests/org.eclipse.jpt.core.tests/src/org/eclipse/jpt/core/tests/internal/context/orm/OrmEntityTests.java b/jpa/tests/org.eclipse.jpt.core.tests/src/org/eclipse/jpt/core/tests/internal/context/orm/OrmEntityTests.java
deleted file mode 100644
index a8fa928c5c..0000000000
--- a/jpa/tests/org.eclipse.jpt.core.tests/src/org/eclipse/jpt/core/tests/internal/context/orm/OrmEntityTests.java
+++ /dev/null
@@ -1,2699 +0,0 @@
-/*******************************************************************************
- * Copyright (c) 2007, 2009 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.
- *
- * Contributors:
- * Oracle - initial API and implementation
- ******************************************************************************/
-package org.eclipse.jpt.core.tests.internal.context.orm;
-
-import java.util.Iterator;
-import java.util.ListIterator;
-import org.eclipse.jdt.core.ICompilationUnit;
-import org.eclipse.jpt.core.JptCorePlugin;
-import org.eclipse.jpt.core.MappingKeys;
-import org.eclipse.jpt.core.context.AccessType;
-import org.eclipse.jpt.core.context.AttributeOverride;
-import org.eclipse.jpt.core.context.DiscriminatorType;
-import org.eclipse.jpt.core.context.Entity;
-import org.eclipse.jpt.core.context.InheritanceType;
-import org.eclipse.jpt.core.context.PersistentAttribute;
-import org.eclipse.jpt.core.context.PersistentType;
-import org.eclipse.jpt.core.context.java.JavaAssociationOverride;
-import org.eclipse.jpt.core.context.java.JavaColumn;
-import org.eclipse.jpt.core.context.java.JavaEntity;
-import org.eclipse.jpt.core.context.java.JavaJoinColumn;
-import org.eclipse.jpt.core.context.java.JavaPrimaryKeyJoinColumn;
-import org.eclipse.jpt.core.context.java.JavaSecondaryTable;
-import org.eclipse.jpt.core.context.orm.OrmAssociationOverride;
-import org.eclipse.jpt.core.context.orm.OrmAttributeOverride;
-import org.eclipse.jpt.core.context.orm.OrmBasicMapping;
-import org.eclipse.jpt.core.context.orm.OrmEmbeddable;
-import org.eclipse.jpt.core.context.orm.OrmEntity;
-import org.eclipse.jpt.core.context.orm.OrmIdMapping;
-import org.eclipse.jpt.core.context.orm.OrmJoinColumn;
-import org.eclipse.jpt.core.context.orm.OrmManyToOneMapping;
-import org.eclipse.jpt.core.context.orm.OrmMappedSuperclass;
-import org.eclipse.jpt.core.context.orm.OrmNamedNativeQuery;
-import org.eclipse.jpt.core.context.orm.OrmNamedQuery;
-import org.eclipse.jpt.core.context.orm.OrmPersistentAttribute;
-import org.eclipse.jpt.core.context.orm.OrmPersistentType;
-import org.eclipse.jpt.core.context.orm.OrmPrimaryKeyJoinColumn;
-import org.eclipse.jpt.core.context.orm.OrmSecondaryTable;
-import org.eclipse.jpt.core.resource.java.JPA;
-import org.eclipse.jpt.core.resource.orm.OrmFactory;
-import org.eclipse.jpt.core.resource.orm.XmlEmbeddable;
-import org.eclipse.jpt.core.resource.orm.XmlEntity;
-import org.eclipse.jpt.core.resource.orm.XmlMappedSuperclass;
-import org.eclipse.jpt.core.resource.persistence.PersistenceFactory;
-import org.eclipse.jpt.core.resource.persistence.XmlMappingFileRef;
-import org.eclipse.jpt.core.tests.internal.context.ContextModelTestCase;
-import org.eclipse.jpt.core.tests.internal.projects.TestJavaProject.SourceWriter;
-import org.eclipse.jpt.utility.internal.CollectionTools;
-import org.eclipse.jpt.utility.internal.iterators.ArrayIterator;
-
-@SuppressWarnings("nls")
-public class OrmEntityTests extends ContextModelTestCase
-{
-
- protected static final String CHILD_TYPE_NAME = "AnnotationTestTypeChild";
- protected static final String FULLY_QUALIFIED_CHILD_TYPE_NAME = PACKAGE_NAME + "." + CHILD_TYPE_NAME;
-
- public OrmEntityTests(String name) {
- super(name);
- }
-
- @Override
- protected void setUp() throws Exception {
- super.setUp();
- XmlMappingFileRef mappingFileRef = PersistenceFactory.eINSTANCE.createXmlMappingFileRef();
- mappingFileRef.setFileName(JptCorePlugin.DEFAULT_ORM_XML_FILE_PATH);
- getXmlPersistenceUnit().getMappingFiles().add(mappingFileRef);
- getPersistenceXmlResource().save(null);
- }
-
- private ICompilationUnit createTestEntityDefaultFieldAccess() 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");
- }
- });
- }
-
- private ICompilationUnit createTestEntityFieldAccess() 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("@Id");
- }
- });
- }
-
- private ICompilationUnit createTestEntityPropertyAccess() 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 appendGetIdMethodAnnotationTo(StringBuilder sb) {
- sb.append("@Id");
- }
- });
- }
-
- private void createTestSubType() throws Exception {
- SourceWriter sourceWriter = new SourceWriter() {
- public void appendSourceTo(StringBuilder sb) {
- sb.append(CR);
- sb.append("import ");
- sb.append(JPA.ENTITY);
- sb.append(";");
- sb.append(CR);
- sb.append("@Entity");
- sb.append(CR);
- sb.append("public class ").append(CHILD_TYPE_NAME).append(" ");
- sb.append("extends ").append(TYPE_NAME).append(" ");
- sb.append("{}").append(CR);
- }
- };
- this.javaProject.createCompilationUnit(PACKAGE_NAME, "AnnotationTestTypeChild.java", sourceWriter);
- }
-
- private void createTestSubTypeUnmapped() throws Exception {
- SourceWriter sourceWriter = new SourceWriter() {
- public void appendSourceTo(StringBuilder sb) {
- sb.append(CR);
- sb.append("public class ").append(CHILD_TYPE_NAME).append(" ");
- sb.append("extends ").append(TYPE_NAME).append(" ");
- sb.append("{}").append(CR);
- }
- };
- this.javaProject.createCompilationUnit(PACKAGE_NAME, "AnnotationTestTypeChild.java", sourceWriter);
- }
-
-
- private ICompilationUnit createTestMappedSuperclass() throws Exception {
- return this.createTestType(new DefaultAnnotationWriter() {
- @Override
- public Iterator<String> imports() {
- return new ArrayIterator<String>(
- JPA.MAPPED_SUPERCLASS,
- JPA.BASIC,
- JPA.VERSION,
- JPA.TRANSIENT,
- JPA.EMBEDDED,
- JPA.EMBEDDED_ID,
- JPA.ONE_TO_ONE,
- JPA.ONE_TO_MANY,
- JPA.MANY_TO_ONE,
- JPA.MANY_TO_MANY,
- JPA.ID);
- }
- @Override
- public void appendTypeAnnotationTo(StringBuilder sb) {
- sb.append("@MappedSuperclass");
- }
-
- @Override
- public void appendIdFieldAnnotationTo(StringBuilder sb) {
- sb.append("private String foo;").append(CR);
- sb.append(CR);
- sb.append(" @Basic");
- sb.append(CR);
- sb.append(" private int basic;").append(CR);
- sb.append(CR);
- sb.append(" @Version");
- sb.append(CR);
- sb.append(" private int version;").append(CR);
- sb.append(CR);
- sb.append(" @Transient");
- sb.append(CR);
- sb.append(" private int transient;").append(CR);
- sb.append(CR);
- sb.append(" @Embedded");
- sb.append(CR);
- sb.append(" private int embedded;").append(CR);
- sb.append(CR);
- sb.append(" @EmbeddedId");
- sb.append(CR);
- sb.append(" private int embeddedId;").append(CR);
- sb.append(CR);
- sb.append(" @OneToOne");
- sb.append(CR);
- sb.append(" private " + CHILD_TYPE_NAME + " oneToOne;").append(CR);
- sb.append(CR);
- sb.append(" @OneToMany");
- sb.append(CR);
- sb.append(" private int oneToMany;").append(CR);
- sb.append(CR);
- sb.append(" @ManyToOne");
- sb.append(CR);
- sb.append(" private int manyToOne;").append(CR);
- sb.append(CR);
- sb.append(" @ManyToMany");
- sb.append(CR);
- sb.append(" private int manyToMany;").append(CR);
- sb.append(CR);
- sb.append(" @Id");
- }
- });
- }
-
- private void createTestAbstractType() throws Exception {
- SourceWriter sourceWriter = new SourceWriter() {
- public void appendSourceTo(StringBuilder sb) {
- sb.append(CR);
- sb.append("public abstract class ").append(TYPE_NAME).append(" ");
- sb.append("{}").append(CR);
- }
- };
- this.javaProject.createCompilationUnit(PACKAGE_NAME, FILE_NAME, sourceWriter);
- }
-
- private ICompilationUnit createAbstractTestEntity() throws Exception {
- return this.createTestType(new DefaultAnnotationWriter() {
- @Override
- public Iterator<String> imports() {
- return new ArrayIterator<String>(JPA.ENTITY, JPA.INHERITANCE, JPA.INHERITANCE_TYPE);
- }
- @Override
- public void appendTypeAnnotationTo(StringBuilder sb) {
- sb.append("@Entity").append(CR);
- sb.append("@Inheritance(strategy=InheritanceType.TABLE_PER_CLASS)").append(CR);
- sb.append("abstract");
- }
- });
- }
-
- private ICompilationUnit createTestAbstractEntityTablePerClass() throws Exception {
- return this.createTestType(new DefaultAnnotationWriter() {
- @Override
- public Iterator<String> imports() {
- return new ArrayIterator<String>(JPA.ENTITY, JPA.INHERITANCE, JPA.INHERITANCE_TYPE, JPA.ONE_TO_ONE);
- }
- @Override
- public void appendTypeAnnotationTo(StringBuilder sb) {
- sb.append("@Entity").append(CR);
- sb.append("@Inheritance(strategy=InheritanceType.TABLE_PER_CLASS)");
- sb.append("abstract");
- }
-
- @Override
- public void appendGetIdMethodAnnotationTo(StringBuilder sb) {
- sb.append("private String foo;").append(CR);
- sb.append(CR);
- sb.append(" @OneToOne");
- sb.append(CR);
- sb.append(" private int address;").append(CR);
- sb.append(CR);
- sb.append(" @OneToOne");
- sb.append(CR);
- sb.append(" private int address2;").append(CR);
- sb.append(CR);
- sb.append(" ");
- }
- });
- }
-
- public void testUpdateSpecifiedName() throws Exception {
- OrmPersistentType ormPersistentType = getEntityMappings().addPersistentType(MappingKeys.ENTITY_TYPE_MAPPING_KEY, "model.foo");
- OrmEntity ormEntity = (OrmEntity) ormPersistentType.getMapping();
- XmlEntity entityResource = getXmlEntityMappings().getEntities().get(0);
- assertNull(ormEntity.getSpecifiedName());
- assertNull(entityResource.getName());
-
- //set name in the resource model, verify context model updated
- entityResource.setName("foo");
- assertEquals("foo", ormEntity.getSpecifiedName());
- assertEquals("foo", entityResource.getName());
-
- //set name to null in the resource model
- entityResource.setName(null);
- assertNull(ormEntity.getSpecifiedName());
- assertNull(entityResource.getName());
- }
-
- public void testModifySpecifiedName() throws Exception {
- OrmPersistentType ormPersistentType = getEntityMappings().addPersistentType(MappingKeys.ENTITY_TYPE_MAPPING_KEY, "model.foo");
- OrmEntity ormEntity = (OrmEntity) ormPersistentType.getMapping();
- XmlEntity entityResource = getXmlEntityMappings().getEntities().get(0);
- assertNull(ormEntity.getSpecifiedName());
- assertNull(entityResource.getName());
-
- //set name in the context model, verify resource model modified
- ormEntity.setSpecifiedName("foo");
- assertEquals("foo", ormEntity.getSpecifiedName());
- assertEquals("foo", entityResource.getName());
-
- //set name to null in the context model
- ormEntity.setSpecifiedName(null);
- assertNull(ormEntity.getSpecifiedName());
- assertNull(entityResource.getName());
- }
-
- public void testUpdateDefaultName() throws Exception {
- createTestEntityFieldAccess();
-
- OrmPersistentType ormPersistentType = getEntityMappings().addPersistentType(MappingKeys.ENTITY_TYPE_MAPPING_KEY, FULLY_QUALIFIED_TYPE_NAME);
- OrmEntity ormEntity = (OrmEntity) ormPersistentType.getMapping();
- XmlEntity entityResource = getXmlEntityMappings().getEntities().get(0);
- assertEquals(TYPE_NAME, ormEntity.getDefaultName());
-
- ormEntity.getJavaEntity().setSpecifiedName("Foo");
- //xml default entity name comes from java
- assertEquals("Foo", ormEntity.getDefaultName());
-
- //set class in the resource model, verify context model updated
- entityResource.setClassName("com.Bar");
- assertEquals("Bar", ormEntity.getDefaultName());
-
- //set class to null in the resource model
- entityResource.setClassName(null);
- assertNull(ormEntity.getDefaultName());
-
- entityResource.setClassName(FULLY_QUALIFIED_TYPE_NAME);
- assertEquals("Foo", ormEntity.getDefaultName());
- entityResource.setMetadataComplete(Boolean.TRUE);
- assertEquals(TYPE_NAME, ormEntity.getDefaultName());
-
- ormEntity.getJavaEntity().setSpecifiedName("Foo1");
- assertEquals(TYPE_NAME, ormEntity.getDefaultName());
-
- entityResource.setMetadataComplete(null);
- assertEquals("Foo1", ormEntity.getDefaultName());
- }
-
- public void testUpdateName() throws Exception {
- OrmPersistentType ormPersistentType = getEntityMappings().addPersistentType(MappingKeys.ENTITY_TYPE_MAPPING_KEY, "model.Foo");
- OrmEntity ormEntity = (OrmEntity) ormPersistentType.getMapping();
- XmlEntity entityResource = getXmlEntityMappings().getEntities().get(0);
- assertEquals("Foo", ormEntity.getName());
-
- //set class in the resource model, verify context model updated
- entityResource.setClassName("com.Bar");
- assertEquals("Bar", ormEntity.getName());
-
- entityResource.setName("Baz");
- assertEquals("Baz", ormEntity.getName());
-
- //set class to null in the resource model
- entityResource.setClassName(null);
- assertEquals("Baz", ormEntity.getName());
-
- entityResource.setName(null);
- assertNull(ormEntity.getName());
- }
-
- public void testUpdateClass() throws Exception {
- OrmPersistentType ormPersistentType = getEntityMappings().addPersistentType(MappingKeys.ENTITY_TYPE_MAPPING_KEY, "model.Foo");
- OrmEntity ormEntity = (OrmEntity) ormPersistentType.getMapping();
- XmlEntity entityResource = getXmlEntityMappings().getEntities().get(0);
- assertEquals("model.Foo", ormEntity.getClass_());
- assertEquals("model.Foo", entityResource.getClassName());
-
- //set class in the resource model, verify context model updated
- entityResource.setClassName("com.Bar");
- assertEquals("com.Bar", ormEntity.getClass_());
- assertEquals("com.Bar", entityResource.getClassName());
-
- //set class to null in the resource model
- entityResource.setClassName(null);
- assertNull(ormEntity.getClass_());
- assertNull(entityResource.getClassName());
- }
-
- public void testModifyClass() throws Exception {
- OrmPersistentType ormPersistentType = getEntityMappings().addPersistentType(MappingKeys.ENTITY_TYPE_MAPPING_KEY, "model.Foo");
- OrmEntity ormEntity = (OrmEntity) ormPersistentType.getMapping();
- XmlEntity entityResource = getXmlEntityMappings().getEntities().get(0);
- assertEquals("model.Foo", ormEntity.getClass_());
- assertEquals("model.Foo", entityResource.getClassName());
-
- //set class in the context model, verify resource model modified
- ormEntity.setClass("com.Bar");
- assertEquals("com.Bar", ormEntity.getClass_());
- assertEquals("com.Bar", entityResource.getClassName());
-
- //set class to null in the context model
- ormEntity.setClass(null);
- assertNull(ormEntity.getClass_());
- assertNull(entityResource.getClassName());
- }
- //TODO add tests for setting the className when the package is set on entity-mappings
-
- public void testUpdateSpecifiedAccess() throws Exception {
- OrmPersistentType ormPersistentType = getEntityMappings().addPersistentType(MappingKeys.ENTITY_TYPE_MAPPING_KEY, "model.Foo");
- XmlEntity entityResource = getXmlEntityMappings().getEntities().get(0);
- assertNull(ormPersistentType.getSpecifiedAccess());
- assertNull(entityResource.getAccess());
-
- //set access in the resource model, verify context model updated
- entityResource.setAccess(org.eclipse.jpt.core.resource.orm.AccessType.FIELD);
- assertEquals(AccessType.FIELD, ormPersistentType.getSpecifiedAccess());
- assertEquals(org.eclipse.jpt.core.resource.orm.AccessType.FIELD, entityResource.getAccess());
-
- //set access to null in the resource model
- entityResource.setAccess(null);
- assertNull(ormPersistentType.getSpecifiedAccess());
- assertNull(entityResource.getAccess());
- }
-
- public void testModifySpecifiedAccess() throws Exception {
- OrmPersistentType ormPersistentType = getEntityMappings().addPersistentType(MappingKeys.ENTITY_TYPE_MAPPING_KEY, "model.Foo");
- XmlEntity entityResource = getXmlEntityMappings().getEntities().get(0);
- assertNull(ormPersistentType.getSpecifiedAccess());
- assertNull(entityResource.getAccess());
-
- //set access in the context model, verify resource model modified
- ormPersistentType.setSpecifiedAccess(AccessType.PROPERTY);
- assertEquals(AccessType.PROPERTY, ormPersistentType.getSpecifiedAccess());
- assertEquals(org.eclipse.jpt.core.resource.orm.AccessType.PROPERTY, entityResource.getAccess());
-
- //set access to null in the context model
- ormPersistentType.setSpecifiedAccess(null);
- assertNull(ormPersistentType.getSpecifiedAccess());
- assertNull(entityResource.getAccess());
- }
-
- public void testUpdateDefaultAccessFromPersistenceUnitDefaults() throws Exception {
- OrmPersistentType ormPersistentType = getEntityMappings().addPersistentType(MappingKeys.ENTITY_TYPE_MAPPING_KEY, "model.Foo");
- XmlEntity entityResource = getXmlEntityMappings().getEntities().get(0);
- assertNull(ormPersistentType.getSpecifiedAccess());
- assertEquals(AccessType.FIELD, ormPersistentType.getDefaultAccess());
- assertNull(entityResource.getAccess());
-
- getXmlEntityMappings().setPersistenceUnitMetadata(OrmFactory.eINSTANCE.createXmlPersistenceUnitMetadata());
- getXmlEntityMappings().getPersistenceUnitMetadata().setPersistenceUnitDefaults(OrmFactory.eINSTANCE.createXmlPersistenceUnitDefaults());
- getXmlEntityMappings().getPersistenceUnitMetadata().getPersistenceUnitDefaults().setAccess(org.eclipse.jpt.core.resource.orm.AccessType.FIELD);
- assertEquals(AccessType.FIELD, ormPersistentType.getDefaultAccess());
- assertNull(ormPersistentType.getSpecifiedAccess());
- assertNull(entityResource.getAccess());
-
- getXmlEntityMappings().getPersistenceUnitMetadata().getPersistenceUnitDefaults().setAccess(org.eclipse.jpt.core.resource.orm.AccessType.PROPERTY);
- assertEquals(AccessType.PROPERTY, ormPersistentType.getDefaultAccess());
- assertNull(ormPersistentType.getSpecifiedAccess());
- assertNull(entityResource.getAccess());
-
- getXmlEntityMappings().getPersistenceUnitMetadata().getPersistenceUnitDefaults().setAccess(null);
- assertNull(ormPersistentType.getSpecifiedAccess());
- assertEquals(AccessType.FIELD, ormPersistentType.getDefaultAccess());
- assertNull(entityResource.getAccess());
- }
-
- public void testUpdateDefaultAccessFromJava() throws Exception {
- createTestEntityDefaultFieldAccess();
-
- OrmPersistentType ormPersistentType = getEntityMappings().addPersistentType(MappingKeys.ENTITY_TYPE_MAPPING_KEY, FULLY_QUALIFIED_TYPE_NAME);
- //java has no annotations, defaultAccess in xml is FIELD anyway
- assertEquals(AccessType.FIELD, ormPersistentType.getDefaultAccess());
-
- getEntityMappings().setSpecifiedAccess(AccessType.FIELD);
- getEntityMappings().getPersistenceUnitMetadata().getPersistenceUnitDefaults().setAccess(AccessType.PROPERTY);
- //entityMappings access wins over persistence-unit-defaults access
- assertEquals(AccessType.FIELD, ormPersistentType.getDefaultAccess());
-
- getEntityMappings().setSpecifiedAccess(null);
- //persistence-unit-defaults access used now
- assertEquals(AccessType.PROPERTY, ormPersistentType.getDefaultAccess());
-
- getEntityMappings().getPersistenceUnitMetadata().getPersistenceUnitDefaults().setAccess(null);
- assertEquals(AccessType.FIELD, ormPersistentType.getDefaultAccess());
-
- ormPersistentType.getJavaPersistentType().getAttributeNamed("id").setSpecifiedMappingKey(MappingKeys.ID_ATTRIBUTE_MAPPING_KEY);
- //java has annotations on fields now, that should win in all cases
- assertEquals(AccessType.FIELD, ormPersistentType.getDefaultAccess());
-
- getEntityMappings().setSpecifiedAccess(AccessType.PROPERTY);
- getEntityMappings().getPersistenceUnitMetadata().getPersistenceUnitDefaults().setAccess(AccessType.PROPERTY);
- assertEquals(AccessType.FIELD, ormPersistentType.getDefaultAccess());
-
- ormPersistentType.getJavaPersistentType().getAttributeNamed("id").setSpecifiedMappingKey(MappingKeys.NULL_ATTRIBUTE_MAPPING_KEY);
- assertEquals(AccessType.PROPERTY, ormPersistentType.getDefaultAccess());
- }
-
- public void testUpdateDefaultAccessFromJavaFieldAccess() throws Exception {
- createTestEntityFieldAccess();
-
- OrmPersistentType ormPersistentType = getEntityMappings().addPersistentType(MappingKeys.ENTITY_TYPE_MAPPING_KEY, FULLY_QUALIFIED_TYPE_NAME);
- OrmEntity ormEntity = (OrmEntity) ormPersistentType.getMapping();
- assertEquals(AccessType.FIELD, ormPersistentType.getDefaultAccess());
-
- ormEntity.setSpecifiedMetadataComplete(Boolean.TRUE);
- assertEquals(AccessType.FIELD, ormPersistentType.getDefaultAccess());
-
- ormEntity.setSpecifiedMetadataComplete(Boolean.FALSE);
- assertEquals(AccessType.FIELD, ormPersistentType.getDefaultAccess());
-
- getEntityMappings().getPersistenceUnitMetadata().setXmlMappingMetadataComplete(true);
- assertEquals(AccessType.FIELD, ormPersistentType.getDefaultAccess());
-
- ormEntity.setSpecifiedMetadataComplete(null);
- assertEquals(AccessType.FIELD, ormPersistentType.getDefaultAccess());
-
- getEntityMappings().getPersistenceUnitMetadata().setXmlMappingMetadataComplete(false);
- assertEquals(AccessType.FIELD, ormPersistentType.getDefaultAccess());
- }
-
- public void testUpdateDefaultAccessFromJavaPropertyAccess() throws Exception {
- createTestEntityPropertyAccess();
-
- OrmPersistentType ormPersistentType = getEntityMappings().addPersistentType(MappingKeys.ENTITY_TYPE_MAPPING_KEY, FULLY_QUALIFIED_TYPE_NAME);
- OrmEntity ormEntity = (OrmEntity) ormPersistentType.getMapping();
- assertEquals(AccessType.PROPERTY, ormPersistentType.getDefaultAccess());
-
- ormEntity.setSpecifiedMetadataComplete(Boolean.TRUE);
- assertEquals(AccessType.FIELD, ormPersistentType.getDefaultAccess());
-
- ormEntity.setSpecifiedMetadataComplete(Boolean.FALSE);
- assertEquals(AccessType.PROPERTY, ormPersistentType.getDefaultAccess());
-
- getEntityMappings().getPersistenceUnitMetadata().setXmlMappingMetadataComplete(true);
- assertEquals(AccessType.FIELD, ormPersistentType.getDefaultAccess());
-
- ormEntity.setSpecifiedMetadataComplete(null);
- assertEquals(AccessType.FIELD, ormPersistentType.getDefaultAccess());
-
- getEntityMappings().getPersistenceUnitMetadata().setXmlMappingMetadataComplete(false);
- assertEquals(AccessType.PROPERTY, ormPersistentType.getDefaultAccess());
- }
-
- public void testUpdateDefaultAccessNoUnderlyingJava() throws Exception {
- OrmPersistentType ormPersistentType = getEntityMappings().addPersistentType(MappingKeys.ENTITY_TYPE_MAPPING_KEY, "model.Foo");
- assertEquals(AccessType.FIELD, ormPersistentType.getDefaultAccess());
- }
-
- public void testUpdateSpecifiedMetadataComplete() throws Exception {
- OrmPersistentType ormPersistentType = getEntityMappings().addPersistentType(MappingKeys.ENTITY_TYPE_MAPPING_KEY, "model.Foo");
- OrmEntity ormEntity = (OrmEntity) ormPersistentType.getMapping();
- XmlEntity entityResource = getXmlEntityMappings().getEntities().get(0);
- assertNull(ormEntity.getSpecifiedMetadataComplete());
- assertNull(entityResource.getMetadataComplete());
-
- //set metadata-complete in the resource model, verify context model updated
- entityResource.setMetadataComplete(Boolean.TRUE);
- assertEquals(Boolean.TRUE, ormEntity.getSpecifiedMetadataComplete());
- assertEquals(Boolean.TRUE, entityResource.getMetadataComplete());
-
- //set access to false in the resource model
- entityResource.setMetadataComplete(Boolean.FALSE);
- assertEquals(Boolean.FALSE, ormEntity.getSpecifiedMetadataComplete());
- assertEquals(Boolean.FALSE, entityResource.getMetadataComplete());
-
- entityResource.setMetadataComplete(null);
- assertNull(ormEntity.getSpecifiedMetadataComplete());
- assertNull(entityResource.getMetadataComplete());
- }
-
- public void testModifySpecifiedMetadataComplete() throws Exception {
- OrmPersistentType ormPersistentType = getEntityMappings().addPersistentType(MappingKeys.ENTITY_TYPE_MAPPING_KEY, "model.Foo");
- OrmEntity ormEntity = (OrmEntity) ormPersistentType.getMapping();
- XmlEntity entityResource = getXmlEntityMappings().getEntities().get(0);
- assertNull(ormEntity.getSpecifiedMetadataComplete());
- assertNull(entityResource.getMetadataComplete());
-
- //set access in the context model, verify resource model modified
- ormEntity.setSpecifiedMetadataComplete(Boolean.TRUE);
- assertTrue(ormEntity.getSpecifiedMetadataComplete().booleanValue());
- assertTrue(entityResource.getMetadataComplete().booleanValue());
-
- //set access to null in the context model
- ormEntity.setSpecifiedMetadataComplete(Boolean.FALSE);
- assertFalse(ormEntity.getSpecifiedMetadataComplete().booleanValue());
- assertFalse(entityResource.getMetadataComplete().booleanValue());
-
- ormEntity.setSpecifiedMetadataComplete(null);
- assertNull(ormEntity.getSpecifiedMetadataComplete());
- assertNull(entityResource.getMetadataComplete());
- }
-
- public void testUpdateDefaultMetadataComplete() throws Exception {
- OrmPersistentType ormPersistentType = getEntityMappings().addPersistentType(MappingKeys.ENTITY_TYPE_MAPPING_KEY, "model.Foo");
- OrmEntity ormEntity = (OrmEntity) ormPersistentType.getMapping();
- XmlEntity entityResource = getXmlEntityMappings().getEntities().get(0);
- assertNull(ormEntity.getSpecifiedMetadataComplete());
- assertFalse(ormEntity.isDefaultMetadataComplete());
- assertNull(entityResource.getMetadataComplete());
-
- getXmlEntityMappings().setPersistenceUnitMetadata(OrmFactory.eINSTANCE.createXmlPersistenceUnitMetadata());
- getXmlEntityMappings().getPersistenceUnitMetadata().setXmlMappingMetadataComplete(true);
- assertTrue(ormEntity.isDefaultMetadataComplete());
- assertNull(ormEntity.getSpecifiedMetadataComplete());
- assertNull(entityResource.getMetadataComplete());
-
- getXmlEntityMappings().getPersistenceUnitMetadata().setXmlMappingMetadataComplete(false);
- assertNull(ormEntity.getSpecifiedMetadataComplete());
- assertFalse(ormEntity.isDefaultMetadataComplete());
- assertNull(entityResource.getMetadataComplete());
-
- getXmlEntityMappings().getPersistenceUnitMetadata().setXmlMappingMetadataComplete(true);
- ormEntity.setSpecifiedMetadataComplete(Boolean.FALSE);
- assertEquals(Boolean.FALSE, ormEntity.getSpecifiedMetadataComplete());
- assertTrue(ormEntity.isDefaultMetadataComplete());
- assertTrue(ormEntity.isMetadataComplete());
- }
-
- public void testUpdateMetadataComplete() throws Exception {
- OrmPersistentType ormPersistentType = getEntityMappings().addPersistentType(MappingKeys.ENTITY_TYPE_MAPPING_KEY, "model.Foo");
- OrmEntity ormEntity = (OrmEntity) ormPersistentType.getMapping();
- XmlEntity entityResource = getXmlEntityMappings().getEntities().get(0);
- assertNull(ormEntity.getSpecifiedMetadataComplete());
- assertFalse(ormEntity.isMetadataComplete());
- assertNull(entityResource.getMetadataComplete());
-
- getXmlEntityMappings().setPersistenceUnitMetadata(OrmFactory.eINSTANCE.createXmlPersistenceUnitMetadata());
- getXmlEntityMappings().getPersistenceUnitMetadata().setXmlMappingMetadataComplete(true);
- assertTrue(ormEntity.isMetadataComplete());
- assertNull(ormEntity.getSpecifiedMetadataComplete());
- assertNull(entityResource.getMetadataComplete());
-
- getXmlEntityMappings().getPersistenceUnitMetadata().setXmlMappingMetadataComplete(false);
- assertFalse(ormEntity.isMetadataComplete());
- assertNull(ormEntity.getSpecifiedMetadataComplete());
- assertNull(entityResource.getMetadataComplete());
- }
-
-
- public void testUpdateInheritanceStrategy() throws Exception {
- OrmPersistentType ormPersistentType = getEntityMappings().addPersistentType(MappingKeys.ENTITY_TYPE_MAPPING_KEY, "model.Foo");
- OrmEntity ormEntity = (OrmEntity) ormPersistentType.getMapping();
- XmlEntity entityResource = getXmlEntityMappings().getEntities().get(0);
- assertEquals(InheritanceType.SINGLE_TABLE, ormEntity.getInheritanceStrategy());
- assertNull(entityResource.getInheritance());
-
- //set inheritance strategy in the resource model, verify context model updated
- entityResource.setInheritance(OrmFactory.eINSTANCE.createInheritance());
- entityResource.getInheritance().setStrategy(org.eclipse.jpt.core.resource.orm.InheritanceType.TABLE_PER_CLASS);
-
- assertEquals(InheritanceType.TABLE_PER_CLASS, ormEntity.getInheritanceStrategy());
- assertEquals(org.eclipse.jpt.core.resource.orm.InheritanceType.TABLE_PER_CLASS, entityResource.getInheritance().getStrategy());
- }
-
- public void testUpdateDefaultInheritanceStrategyFromJava() throws Exception {
- createTestEntityDefaultFieldAccess();
-
- OrmPersistentType ormPersistentType = getEntityMappings().addPersistentType(MappingKeys.ENTITY_TYPE_MAPPING_KEY, FULLY_QUALIFIED_TYPE_NAME);
- OrmEntity ormEntity = (OrmEntity) ormPersistentType.getMapping();
- //no inheritance strategy specified in java so single-table is default
- assertEquals(InheritanceType.SINGLE_TABLE, ormEntity.getDefaultInheritanceStrategy());
-
- ormEntity.getJavaEntity().setSpecifiedInheritanceStrategy(InheritanceType.JOINED);
- assertEquals(InheritanceType.JOINED, ormEntity.getDefaultInheritanceStrategy());
-
- ormEntity.setSpecifiedInheritanceStrategy(InheritanceType.TABLE_PER_CLASS);
- //inheritance tag exists in xml, so it overrides anything in java
- assertEquals(InheritanceType.SINGLE_TABLE, ormEntity.getDefaultInheritanceStrategy());
-
- ormEntity.setSpecifiedInheritanceStrategy(null);
- assertEquals(InheritanceType.JOINED, ormEntity.getDefaultInheritanceStrategy());
-
- ormEntity.setSpecifiedMetadataComplete(Boolean.TRUE);
- assertEquals(InheritanceType.SINGLE_TABLE, ormEntity.getDefaultInheritanceStrategy());
-
- ormEntity.setSpecifiedMetadataComplete(Boolean.FALSE);
- assertEquals(InheritanceType.JOINED, ormEntity.getDefaultInheritanceStrategy());
-
- getEntityMappings().getPersistenceUnitMetadata().setXmlMappingMetadataComplete(true);
- //this setting overrides the false meta-data complete found on ormEntity
- assertEquals(InheritanceType.SINGLE_TABLE, ormEntity.getDefaultInheritanceStrategy());
- }
-
- public void testUpdateDefaultInheritanceStrategyFromParent() throws Exception {
- createTestEntityDefaultFieldAccess();
- createTestSubType();
-
- OrmPersistentType parentPersistentType = getEntityMappings().addPersistentType(MappingKeys.ENTITY_TYPE_MAPPING_KEY, FULLY_QUALIFIED_TYPE_NAME);
- OrmPersistentType childPersistentType = getEntityMappings().addPersistentType(MappingKeys.ENTITY_TYPE_MAPPING_KEY, PACKAGE_NAME + ".AnnotationTestTypeChild");
- OrmEntity parentXmlEntity = (OrmEntity) parentPersistentType.getMapping();
- OrmEntity childXmlEntity = (OrmEntity) childPersistentType.getMapping();
-
- assertEquals(parentXmlEntity, childXmlEntity.getParentEntity());
- assertEquals(InheritanceType.SINGLE_TABLE, childXmlEntity.getDefaultInheritanceStrategy());
-
- //change root inheritance strategy, verify default is changed for child entity
- parentXmlEntity.setSpecifiedInheritanceStrategy(InheritanceType.TABLE_PER_CLASS);
- assertEquals(InheritanceType.SINGLE_TABLE, parentXmlEntity.getDefaultInheritanceStrategy());
- assertEquals(InheritanceType.TABLE_PER_CLASS, childXmlEntity.getDefaultInheritanceStrategy());
- assertNull(childXmlEntity.getSpecifiedInheritanceStrategy());
-
- //set specified inheritance strategy in java and verify defaults in xml are correct
- parentXmlEntity.setSpecifiedInheritanceStrategy(null);
- parentXmlEntity.getJavaEntity().setSpecifiedInheritanceStrategy(InheritanceType.JOINED);
- assertEquals(InheritanceType.JOINED, parentXmlEntity.getDefaultInheritanceStrategy());
- assertEquals(InheritanceType.JOINED, childXmlEntity.getDefaultInheritanceStrategy());
- assertNull(parentXmlEntity.getSpecifiedInheritanceStrategy());
- assertNull(childXmlEntity.getSpecifiedInheritanceStrategy());
-
- getEntityMappings().getPersistenceUnitMetadata().setXmlMappingMetadataComplete(true);
- assertEquals(InheritanceType.SINGLE_TABLE, parentXmlEntity.getDefaultInheritanceStrategy());
- assertEquals(InheritanceType.SINGLE_TABLE, childXmlEntity.getDefaultInheritanceStrategy());
- }
-
- public void testUpdateSpecifiedInheritanceStrategy() throws Exception {
- OrmPersistentType ormPersistentType = getEntityMappings().addPersistentType(MappingKeys.ENTITY_TYPE_MAPPING_KEY, "model.foo");
- OrmEntity ormEntity = (OrmEntity) ormPersistentType.getMapping();
- XmlEntity entityResource = getXmlEntityMappings().getEntities().get(0);
- assertNull(ormEntity.getSpecifiedInheritanceStrategy());
- assertNull(entityResource.getInheritance());
-
- //set strategy in the resource model, verify context model updated
- entityResource.setInheritance(OrmFactory.eINSTANCE.createInheritance());
- entityResource.getInheritance().setStrategy(org.eclipse.jpt.core.resource.orm.InheritanceType.JOINED);
- assertEquals(InheritanceType.JOINED, ormEntity.getSpecifiedInheritanceStrategy());
- assertEquals(org.eclipse.jpt.core.resource.orm.InheritanceType.JOINED, entityResource.getInheritance().getStrategy());
-
- //set strategy to null in the resource model
- entityResource.getInheritance().setStrategy(null);
- assertNull(ormEntity.getSpecifiedInheritanceStrategy());
- assertNull(entityResource.getInheritance().getStrategy());
-
- entityResource.getInheritance().setStrategy(org.eclipse.jpt.core.resource.orm.InheritanceType.SINGLE_TABLE);
- assertEquals(InheritanceType.SINGLE_TABLE, ormEntity.getSpecifiedInheritanceStrategy());
- assertEquals(org.eclipse.jpt.core.resource.orm.InheritanceType.SINGLE_TABLE, entityResource.getInheritance().getStrategy());
-
- entityResource.setInheritance(null);
- assertNull(ormEntity.getSpecifiedInheritanceStrategy());
- assertNull(entityResource.getInheritance());
- }
-
- public void testModifySpecifiedInheritanceStrategy() throws Exception {
- OrmPersistentType ormPersistentType = getEntityMappings().addPersistentType(MappingKeys.ENTITY_TYPE_MAPPING_KEY, "model.foo");
- OrmEntity ormEntity = (OrmEntity) ormPersistentType.getMapping();
- XmlEntity entityResource = getXmlEntityMappings().getEntities().get(0);
- assertNull(ormEntity.getSpecifiedInheritanceStrategy());
- assertNull(entityResource.getInheritance());
-
- //set strategy in the context model, verify resource model modified
- ormEntity.setSpecifiedInheritanceStrategy(InheritanceType.TABLE_PER_CLASS);
- assertEquals(InheritanceType.TABLE_PER_CLASS, ormEntity.getSpecifiedInheritanceStrategy());
- assertEquals(org.eclipse.jpt.core.resource.orm.InheritanceType.TABLE_PER_CLASS, entityResource.getInheritance().getStrategy());
-
- //set strategy to null in the context model
- ormEntity.setSpecifiedInheritanceStrategy(null);
- assertNull(ormEntity.getSpecifiedInheritanceStrategy());
- assertNull(entityResource.getInheritance());
- }
-
- public void testAddSpecifiedSecondaryTable() throws Exception {
- OrmPersistentType persistentType = getEntityMappings().addPersistentType(MappingKeys.ENTITY_TYPE_MAPPING_KEY, FULLY_QUALIFIED_TYPE_NAME);
- OrmEntity ormEntity = (OrmEntity) persistentType.getMapping();
- XmlEntity entityResource = getXmlEntityMappings().getEntities().get(0);
-
- OrmSecondaryTable secondaryTable = ormEntity.addSpecifiedSecondaryTable(0);
- secondaryTable.setSpecifiedName("FOO");
-
- assertEquals("FOO", entityResource.getSecondaryTables().get(0).getName());
-
- OrmSecondaryTable secondaryTable2 = ormEntity.addSpecifiedSecondaryTable(0);
- secondaryTable2.setSpecifiedName("BAR");
-
- assertEquals("BAR", entityResource.getSecondaryTables().get(0).getName());
- assertEquals("FOO", entityResource.getSecondaryTables().get(1).getName());
-
- OrmSecondaryTable secondaryTable3 = ormEntity.addSpecifiedSecondaryTable(1);
- secondaryTable3.setSpecifiedName("BAZ");
-
- assertEquals("BAR", entityResource.getSecondaryTables().get(0).getName());
- assertEquals("BAZ", entityResource.getSecondaryTables().get(1).getName());
- assertEquals("FOO", entityResource.getSecondaryTables().get(2).getName());
-
- ListIterator<OrmSecondaryTable> secondaryTables = ormEntity.specifiedSecondaryTables();
- assertEquals(secondaryTable2, secondaryTables.next());
- assertEquals(secondaryTable3, secondaryTables.next());
- assertEquals(secondaryTable, secondaryTables.next());
-
- secondaryTables = ormEntity.specifiedSecondaryTables();
- assertEquals("BAR", secondaryTables.next().getName());
- assertEquals("BAZ", secondaryTables.next().getName());
- assertEquals("FOO", secondaryTables.next().getName());
- }
-
- public void testRemoveSpecifiedSecondaryTable() throws Exception {
- OrmPersistentType persistentType = getEntityMappings().addPersistentType(MappingKeys.ENTITY_TYPE_MAPPING_KEY, FULLY_QUALIFIED_TYPE_NAME);
- OrmEntity ormEntity = (OrmEntity) persistentType.getMapping();
-
- ormEntity.addSpecifiedSecondaryTable(0).setSpecifiedName("FOO");
- ormEntity.addSpecifiedSecondaryTable(1).setSpecifiedName("BAR");
- ormEntity.addSpecifiedSecondaryTable(2).setSpecifiedName("BAZ");
-
- XmlEntity entityResource = getXmlEntityMappings().getEntities().get(0);
- assertEquals(3, entityResource.getSecondaryTables().size());
-
- ormEntity.removeSpecifiedSecondaryTable(0);
- assertEquals(2, entityResource.getSecondaryTables().size());
- assertEquals("BAR", entityResource.getSecondaryTables().get(0).getName());
- assertEquals("BAZ", entityResource.getSecondaryTables().get(1).getName());
-
- ormEntity.removeSpecifiedSecondaryTable(0);
- assertEquals(1, entityResource.getSecondaryTables().size());
- assertEquals("BAZ", entityResource.getSecondaryTables().get(0).getName());
-
- ormEntity.removeSpecifiedSecondaryTable(0);
- assertEquals(0, entityResource.getSecondaryTables().size());
- }
-
- public void testMoveSpecifiedSecondaryTable() throws Exception {
- OrmPersistentType persistentType = getEntityMappings().addPersistentType(MappingKeys.ENTITY_TYPE_MAPPING_KEY, FULLY_QUALIFIED_TYPE_NAME);
- OrmEntity ormEntity = (OrmEntity) persistentType.getMapping();
-
- ormEntity.addSpecifiedSecondaryTable(0).setSpecifiedName("FOO");
- ormEntity.addSpecifiedSecondaryTable(1).setSpecifiedName("BAR");
- ormEntity.addSpecifiedSecondaryTable(2).setSpecifiedName("BAZ");
-
- XmlEntity entityResource = getXmlEntityMappings().getEntities().get(0);
- assertEquals(3, entityResource.getSecondaryTables().size());
-
-
- ormEntity.moveSpecifiedSecondaryTable(2, 0);
- ListIterator<OrmSecondaryTable> secondaryTables = ormEntity.specifiedSecondaryTables();
- assertEquals("BAR", secondaryTables.next().getName());
- assertEquals("BAZ", secondaryTables.next().getName());
- assertEquals("FOO", secondaryTables.next().getName());
-
- assertEquals("BAR", entityResource.getSecondaryTables().get(0).getName());
- assertEquals("BAZ", entityResource.getSecondaryTables().get(1).getName());
- assertEquals("FOO", entityResource.getSecondaryTables().get(2).getName());
-
-
- ormEntity.moveSpecifiedSecondaryTable(0, 1);
- secondaryTables = ormEntity.specifiedSecondaryTables();
- assertEquals("BAZ", secondaryTables.next().getName());
- assertEquals("BAR", secondaryTables.next().getName());
- assertEquals("FOO", secondaryTables.next().getName());
-
- assertEquals("BAZ", entityResource.getSecondaryTables().get(0).getName());
- assertEquals("BAR", entityResource.getSecondaryTables().get(1).getName());
- assertEquals("FOO", entityResource.getSecondaryTables().get(2).getName());
- }
-
- public void testUpdateSecondaryTables() throws Exception {
- OrmPersistentType persistentType = getEntityMappings().addPersistentType(MappingKeys.ENTITY_TYPE_MAPPING_KEY, FULLY_QUALIFIED_TYPE_NAME);
- OrmEntity ormEntity = (OrmEntity) persistentType.getMapping();
-
- XmlEntity entityResource = getXmlEntityMappings().getEntities().get(0);
- entityResource.getSecondaryTables().add(OrmFactory.eINSTANCE.createXmlSecondaryTable());
- entityResource.getSecondaryTables().add(OrmFactory.eINSTANCE.createXmlSecondaryTable());
- entityResource.getSecondaryTables().add(OrmFactory.eINSTANCE.createXmlSecondaryTable());
-
- entityResource.getSecondaryTables().get(0).setName("FOO");
- entityResource.getSecondaryTables().get(1).setName("BAR");
- entityResource.getSecondaryTables().get(2).setName("BAZ");
-
- ListIterator<OrmSecondaryTable> secondaryTables = ormEntity.specifiedSecondaryTables();
- assertEquals("FOO", secondaryTables.next().getName());
- assertEquals("BAR", secondaryTables.next().getName());
- assertEquals("BAZ", secondaryTables.next().getName());
- assertFalse(secondaryTables.hasNext());
-
- entityResource.getSecondaryTables().move(2, 0);
- secondaryTables = ormEntity.specifiedSecondaryTables();
- assertEquals("BAR", secondaryTables.next().getName());
- assertEquals("BAZ", secondaryTables.next().getName());
- assertEquals("FOO", secondaryTables.next().getName());
- assertFalse(secondaryTables.hasNext());
-
- entityResource.getSecondaryTables().move(0, 1);
- secondaryTables = ormEntity.specifiedSecondaryTables();
- assertEquals("BAZ", secondaryTables.next().getName());
- assertEquals("BAR", secondaryTables.next().getName());
- assertEquals("FOO", secondaryTables.next().getName());
- assertFalse(secondaryTables.hasNext());
-
- entityResource.getSecondaryTables().remove(1);
- secondaryTables = ormEntity.specifiedSecondaryTables();
- assertEquals("BAZ", secondaryTables.next().getName());
- assertEquals("FOO", secondaryTables.next().getName());
- assertFalse(secondaryTables.hasNext());
-
- entityResource.getSecondaryTables().remove(1);
- secondaryTables = ormEntity.specifiedSecondaryTables();
- assertEquals("BAZ", secondaryTables.next().getName());
- assertFalse(secondaryTables.hasNext());
-
- entityResource.getSecondaryTables().remove(0);
- assertFalse(ormEntity.specifiedSecondaryTables().hasNext());
- }
-
- public void testVirtualSecondaryTables() throws Exception {
- createTestEntityFieldAccess();
- createTestSubType();
-
- OrmPersistentType parentPersistentType = getEntityMappings().addPersistentType(MappingKeys.ENTITY_TYPE_MAPPING_KEY, FULLY_QUALIFIED_TYPE_NAME);
- OrmPersistentType childPersistentType = getEntityMappings().addPersistentType(MappingKeys.ENTITY_TYPE_MAPPING_KEY, PACKAGE_NAME + ".AnnotationTestTypeChild");
- OrmEntity parentOrmEntity = (OrmEntity) parentPersistentType.getMapping();
- OrmEntity childOrmEntity = (OrmEntity) childPersistentType.getMapping();
- JavaEntity javaEntity = childOrmEntity.getJavaEntity();
-
- JavaSecondaryTable javaSecondaryTableFoo = javaEntity.addSpecifiedSecondaryTable(0);
- javaSecondaryTableFoo.setSpecifiedName("FOO");
- OrmSecondaryTable virtualSecondaryTableFoo = childOrmEntity.virtualSecondaryTables().next();
- assertEquals("FOO", childOrmEntity.secondaryTables().next().getName());
- assertEquals("FOO", virtualSecondaryTableFoo.getName());
- assertEquals(0, virtualSecondaryTableFoo.specifiedPrimaryKeyJoinColumnsSize());
- assertEquals("id", virtualSecondaryTableFoo.getDefaultPrimaryKeyJoinColumn().getDefaultName());
- assertEquals("id", virtualSecondaryTableFoo.getDefaultPrimaryKeyJoinColumn().getDefaultReferencedColumnName());
-
- assertEquals(0, childOrmEntity.specifiedSecondaryTablesSize());
- assertEquals(1, childOrmEntity.virtualSecondaryTablesSize());
- assertEquals(1, childOrmEntity.secondaryTablesSize());
-
- javaEntity.addSpecifiedSecondaryTable(0).setSpecifiedName("BAR");
- ListIterator<OrmSecondaryTable> virtualSecondaryTables = childOrmEntity.virtualSecondaryTables();
- ListIterator<OrmSecondaryTable> secondaryTables = childOrmEntity.secondaryTables();
- assertEquals("BAR", virtualSecondaryTables.next().getName());
- assertEquals("FOO", virtualSecondaryTables.next().getName());
- assertEquals("BAR", secondaryTables.next().getName());
- assertEquals("FOO", secondaryTables.next().getName());
- assertEquals(0, childOrmEntity.specifiedSecondaryTablesSize());
- assertEquals(2, childOrmEntity.virtualSecondaryTablesSize());
- assertEquals(2, childOrmEntity.secondaryTablesSize());
-
- childOrmEntity.setSpecifiedMetadataComplete(Boolean.TRUE);
- assertEquals(0, childOrmEntity.virtualSecondaryTablesSize());
-
- childOrmEntity.setSpecifiedMetadataComplete(Boolean.FALSE);
- assertEquals(2, childOrmEntity.virtualSecondaryTablesSize());
-
-
- childOrmEntity.setSecondaryTablesDefinedInXml(true);
- assertEquals(0, childOrmEntity.virtualSecondaryTablesSize());
- assertEquals(2, childOrmEntity.specifiedSecondaryTablesSize());
- assertEquals(2, childOrmEntity.secondaryTablesSize());
- ListIterator<OrmSecondaryTable> specifiedSecondaryTables = childOrmEntity.specifiedSecondaryTables();
- assertEquals("BAR", specifiedSecondaryTables.next().getName());
- OrmSecondaryTable specifiedSecondaryTableFoo = specifiedSecondaryTables.next();
- assertEquals("FOO", specifiedSecondaryTableFoo.getName());
- assertEquals(0, specifiedSecondaryTableFoo.specifiedPrimaryKeyJoinColumnsSize());
- assertEquals("id", specifiedSecondaryTableFoo.getDefaultPrimaryKeyJoinColumn().getDefaultName());
- assertEquals("id", specifiedSecondaryTableFoo.getDefaultPrimaryKeyJoinColumn().getDefaultReferencedColumnName());
-
-
- childOrmEntity.removeSpecifiedSecondaryTable(0);
- assertEquals(0, childOrmEntity.virtualSecondaryTablesSize());
- assertEquals(1, childOrmEntity.specifiedSecondaryTablesSize());
- assertEquals(1, childOrmEntity.secondaryTablesSize());
- assertEquals("FOO", childOrmEntity.specifiedSecondaryTables().next().getName());
-
-
- childOrmEntity.removeSpecifiedSecondaryTable(0);
- assertEquals(0, childOrmEntity.specifiedSecondaryTablesSize());
- assertEquals(2, childOrmEntity.virtualSecondaryTablesSize());
- assertEquals(2, childOrmEntity.secondaryTablesSize());
- virtualSecondaryTables = childOrmEntity.virtualSecondaryTables();
- assertEquals("BAR", virtualSecondaryTables.next().getName());
- assertEquals("FOO", virtualSecondaryTables.next().getName());
-
-
- //add a specified secondary table to the parent, this will not affect virtual secondaryTables in child
- parentOrmEntity.addSpecifiedSecondaryTable(0).setSpecifiedName("PARENT_TABLE");
- assertEquals(2, childOrmEntity.virtualSecondaryTablesSize());
- }
-
- public void testAssociatedTables() throws Exception {
- createTestEntityFieldAccess();
- OrmPersistentType persistentType = getEntityMappings().addPersistentType(MappingKeys.ENTITY_TYPE_MAPPING_KEY, FULLY_QUALIFIED_TYPE_NAME);
-
- OrmEntity entity = (OrmEntity) persistentType.getMapping();
- assertEquals(1, CollectionTools.size(entity.associatedTables()));
-
- entity.addSpecifiedSecondaryTable(0).setSpecifiedName("FOO");
- assertEquals(2, CollectionTools.size(entity.associatedTables()));
-
- entity.addSpecifiedSecondaryTable(0).setSpecifiedName("BAR");
- assertEquals(3, CollectionTools.size(entity.associatedTables()));
- }
-
- public void testAssociatedTableNamesIncludingInherited() throws Exception {
-
- }
-
- public void testTableNameIsInvalid() throws Exception {
-
- }
-
- public void testMakeEntityEmbeddable() throws Exception {
- OrmPersistentType entityPersistentType = getEntityMappings().addPersistentType(MappingKeys.ENTITY_TYPE_MAPPING_KEY, "model.Foo");
- OrmEntity entity = (OrmEntity) entityPersistentType.getMapping();
- entityPersistentType.setSpecifiedAccess(AccessType.PROPERTY);
- entity.setSpecifiedDiscriminatorValue("DISC_VALUE");
- entity.setSpecifiedInheritanceStrategy(InheritanceType.JOINED);
- entity.setSpecifiedMetadataComplete(Boolean.TRUE);
- entity.setSpecifiedName("ENTITY_NAME");
-
- entityPersistentType.setMappingKey(MappingKeys.EMBEDDABLE_TYPE_MAPPING_KEY);
-
- XmlEmbeddable embeddable = getXmlEntityMappings().getEmbeddables().get(0);
- assertEquals("model.Foo", embeddable.getClassName());
- assertEquals(Boolean.TRUE, embeddable.getMetadataComplete());
- assertEquals(org.eclipse.jpt.core.resource.orm.AccessType.PROPERTY, embeddable.getAccess());
-
- OrmEmbeddable ormEmbeddable = (OrmEmbeddable) entityPersistentType.getMapping();
- assertEquals("model.Foo", ormEmbeddable.getClass_());
- assertEquals(Boolean.TRUE, ormEmbeddable.getSpecifiedMetadataComplete());
- assertEquals(AccessType.PROPERTY, entityPersistentType.getSpecifiedAccess());
- }
-
- //TODO test that attribute mappings are not removed when changing type mapping.
- public void testMakeEntityEmbeddable2() throws Exception {
- OrmPersistentType entityPersistentType = getEntityMappings().addPersistentType(MappingKeys.ENTITY_TYPE_MAPPING_KEY, "model.Foo");
- getEntityMappings().addPersistentType(MappingKeys.ENTITY_TYPE_MAPPING_KEY, "model.Foo2");
- OrmEntity entity = (OrmEntity) entityPersistentType.getMapping();
- entityPersistentType.setSpecifiedAccess(AccessType.PROPERTY);
- entity.setSpecifiedDiscriminatorValue("DISC_VALUE");
- entity.setSpecifiedInheritanceStrategy(InheritanceType.JOINED);
- entity.setSpecifiedMetadataComplete(Boolean.TRUE);
- entity.setSpecifiedName("ENTITY_NAME");
-// entityPersistentType.addSpecifiedPersistentAttribute(IMappingKeys.BASIC_ATTRIBUTE_MAPPING_KEY, "basicMapping");
-
- entityPersistentType.setMappingKey(MappingKeys.EMBEDDABLE_TYPE_MAPPING_KEY);
-
- XmlEmbeddable embeddable = getXmlEntityMappings().getEmbeddables().get(0);
- assertEquals("model.Foo", embeddable.getClassName());
- assertEquals(Boolean.TRUE, embeddable.getMetadataComplete());
- assertEquals(org.eclipse.jpt.core.resource.orm.AccessType.PROPERTY, embeddable.getAccess());
-// assertEquals("basicMapping", embeddable.getAttributes().getBasics().get(0).getName());
-
- OrmEmbeddable ormEmbeddable = (OrmEmbeddable) entityPersistentType.getMapping();
- assertEquals("model.Foo", ormEmbeddable.getClass_());
- assertEquals(Boolean.TRUE, ormEmbeddable.getSpecifiedMetadataComplete());
- assertEquals(AccessType.PROPERTY, entityPersistentType.getSpecifiedAccess());
-// assertEquals("basicMapping", ormEmbeddable.persistentType().attributes().next().getName());
- }
-
- public void testMakeEntityMappedSuperclass() throws Exception {
- OrmPersistentType entityPersistentType = getEntityMappings().addPersistentType(MappingKeys.ENTITY_TYPE_MAPPING_KEY, "model.Foo");
- OrmEntity entity = (OrmEntity) entityPersistentType.getMapping();
- entityPersistentType.setSpecifiedAccess(AccessType.PROPERTY);
- entity.setSpecifiedDiscriminatorValue("DISC_VALUE");
- entity.setSpecifiedInheritanceStrategy(InheritanceType.JOINED);
- entity.setSpecifiedMetadataComplete(Boolean.TRUE);
- entity.setSpecifiedName("ENTITY_NAME");
-
- entityPersistentType.setMappingKey(MappingKeys.MAPPED_SUPERCLASS_TYPE_MAPPING_KEY);
-
- XmlMappedSuperclass mappedSuperclass = getXmlEntityMappings().getMappedSuperclasses().get(0);
- assertEquals("model.Foo", mappedSuperclass.getClassName());
- assertEquals(Boolean.TRUE, mappedSuperclass.getMetadataComplete());
- assertEquals(org.eclipse.jpt.core.resource.orm.AccessType.PROPERTY, mappedSuperclass.getAccess());
-
- OrmMappedSuperclass ormMappedSuperclass = (OrmMappedSuperclass) entityPersistentType.getMapping();
- assertEquals("model.Foo", ormMappedSuperclass.getClass_());
- assertEquals(Boolean.TRUE, ormMappedSuperclass.getSpecifiedMetadataComplete());
- assertEquals(AccessType.PROPERTY, entityPersistentType.getSpecifiedAccess());
- }
-
- public void testMakeEntityMappedSuperclass2() throws Exception {
- getEntityMappings().addPersistentType(MappingKeys.ENTITY_TYPE_MAPPING_KEY, "model.Foo2");
- OrmPersistentType entityPersistentType = getEntityMappings().addPersistentType(MappingKeys.ENTITY_TYPE_MAPPING_KEY, "model.Foo");
- OrmEntity entity = (OrmEntity) entityPersistentType.getMapping();
- entityPersistentType.setSpecifiedAccess(AccessType.PROPERTY);
- entity.setSpecifiedDiscriminatorValue("DISC_VALUE");
- entity.setSpecifiedInheritanceStrategy(InheritanceType.JOINED);
- entity.setSpecifiedMetadataComplete(Boolean.TRUE);
- entity.setSpecifiedName("ENTITY_NAME");
-
- entityPersistentType.setMappingKey(MappingKeys.MAPPED_SUPERCLASS_TYPE_MAPPING_KEY);
-
- XmlMappedSuperclass mappedSuperclass = getXmlEntityMappings().getMappedSuperclasses().get(0);
- assertEquals("model.Foo", mappedSuperclass.getClassName());
- assertEquals(Boolean.TRUE, mappedSuperclass.getMetadataComplete());
- assertEquals(org.eclipse.jpt.core.resource.orm.AccessType.PROPERTY, mappedSuperclass.getAccess());
-
- OrmMappedSuperclass ormMappedSuperclass = (OrmMappedSuperclass) entityPersistentType.getMapping();
- assertEquals("model.Foo", ormMappedSuperclass.getClass_());
- assertEquals(Boolean.TRUE, ormMappedSuperclass.getSpecifiedMetadataComplete());
- assertEquals(AccessType.PROPERTY, entityPersistentType.getSpecifiedAccess());
- }
-
-
- public void testAddSequenceGenerator() throws Exception {
- OrmPersistentType ormPersistentType = getEntityMappings().addPersistentType(MappingKeys.ENTITY_TYPE_MAPPING_KEY, "model.Foo");
- OrmEntity ormEntity = (OrmEntity) ormPersistentType.getMapping();
- XmlEntity entityResource = getXmlEntityMappings().getEntities().get(0);
-
- assertNull(ormEntity.getGeneratorContainer().getSequenceGenerator());
- assertNull(entityResource.getSequenceGenerator());
-
- ormEntity.getGeneratorContainer().addSequenceGenerator();
-
- assertNotNull(entityResource.getSequenceGenerator());
- assertNotNull(ormEntity.getGeneratorContainer().getSequenceGenerator());
-
- //try adding another sequence generator, should get an IllegalStateException
- try {
- ormEntity.getGeneratorContainer().addSequenceGenerator();
- } catch (IllegalStateException e) {
- return;
- }
- fail("IllegalStateException not thrown");
- }
-
- public void testRemoveSequenceGenerator() throws Exception {
- OrmPersistentType ormPersistentType = getEntityMappings().addPersistentType(MappingKeys.ENTITY_TYPE_MAPPING_KEY, "model.Foo");
- OrmEntity ormEntity = (OrmEntity) ormPersistentType.getMapping();
- XmlEntity entityResource = getXmlEntityMappings().getEntities().get(0);
-
- assertNull(ormEntity.getGeneratorContainer().getSequenceGenerator());
- assertNull(entityResource.getSequenceGenerator());
-
- ormEntity.getGeneratorContainer().addSequenceGenerator();
- assertNotNull(entityResource.getSequenceGenerator());
- assertNotNull(ormEntity.getGeneratorContainer().getSequenceGenerator());
-
- ormEntity.getGeneratorContainer().removeSequenceGenerator();
-
- assertNull(ormEntity.getGeneratorContainer().getSequenceGenerator());
- assertNull(entityResource.getSequenceGenerator());
-
- //try removing the sequence generator again, should get an IllegalStateException
- try {
- ormEntity.getGeneratorContainer().removeSequenceGenerator();
- } catch (IllegalStateException e) {
- return;
- }
- fail("IllegalStateException not thrown");
- }
-
- public void testUpdateSequenceGenerator() throws Exception {
- OrmPersistentType ormPersistentType = getEntityMappings().addPersistentType(MappingKeys.ENTITY_TYPE_MAPPING_KEY, "model.Foo");
- OrmEntity ormEntity = (OrmEntity) ormPersistentType.getMapping();
- XmlEntity entityResource = getXmlEntityMappings().getEntities().get(0);
-
- assertNull(ormEntity.getGeneratorContainer().getSequenceGenerator());
- assertNull(entityResource.getSequenceGenerator());
- assertEquals(0, ormEntity.getPersistenceUnit().generatorsSize());
-
- entityResource.setSequenceGenerator(OrmFactory.eINSTANCE.createXmlSequenceGenerator());
-
- assertNotNull(ormEntity.getGeneratorContainer().getSequenceGenerator());
- assertNotNull(entityResource.getSequenceGenerator());
- assertEquals(1, ormEntity.getPersistenceUnit().generatorsSize());
-
- ormEntity.getGeneratorContainer().getSequenceGenerator().setName("foo");
- assertEquals(1, ormEntity.getPersistenceUnit().generatorsSize());
-
- entityResource.setSequenceGenerator(null);
- assertNull(ormEntity.getGeneratorContainer().getSequenceGenerator());
- assertNull(entityResource.getSequenceGenerator());
- assertEquals(0, ormEntity.getPersistenceUnit().generatorsSize());
- }
-
- public void testAddTableGenerator() throws Exception {
- OrmPersistentType ormPersistentType = getEntityMappings().addPersistentType(MappingKeys.ENTITY_TYPE_MAPPING_KEY, "model.Foo");
- OrmEntity ormEntity = (OrmEntity) ormPersistentType.getMapping();
- XmlEntity entityResource = getXmlEntityMappings().getEntities().get(0);
-
- assertNull(ormEntity.getGeneratorContainer().getTableGenerator());
- assertNull(entityResource.getTableGenerator());
-
- ormEntity.getGeneratorContainer().addTableGenerator();
-
- assertNotNull(entityResource.getTableGenerator());
- assertNotNull(ormEntity.getGeneratorContainer().getTableGenerator());
-
- //try adding another table generator, should get an IllegalStateException
- try {
- ormEntity.getGeneratorContainer().addTableGenerator();
- } catch (IllegalStateException e) {
- return;
- }
- fail("IllegalStateException not thrown");
- }
-
- public void testRemoveTableGenerator() throws Exception {
- OrmPersistentType ormPersistentType = getEntityMappings().addPersistentType(MappingKeys.ENTITY_TYPE_MAPPING_KEY, "model.Foo");
- OrmEntity ormEntity = (OrmEntity) ormPersistentType.getMapping();
- XmlEntity entityResource = getXmlEntityMappings().getEntities().get(0);
-
- assertNull(ormEntity.getGeneratorContainer().getTableGenerator());
- assertNull(entityResource.getTableGenerator());
-
- ormEntity.getGeneratorContainer().addTableGenerator();
- assertNotNull(entityResource.getTableGenerator());
- assertNotNull(ormEntity.getGeneratorContainer().getTableGenerator());
-
- ormEntity.getGeneratorContainer().removeTableGenerator();
-
- assertNull(ormEntity.getGeneratorContainer().getTableGenerator());
- assertNull(entityResource.getTableGenerator());
-
- //try removing the table generator again, should get an IllegalStateException
- try {
- ormEntity.getGeneratorContainer().removeTableGenerator();
- } catch (IllegalStateException e) {
- return;
- }
- fail("IllegalStateException not thrown");
- }
-
- public void testUpdateTableGenerator() throws Exception {
- OrmPersistentType ormPersistentType = getEntityMappings().addPersistentType(MappingKeys.ENTITY_TYPE_MAPPING_KEY, "model.Foo");
- OrmEntity ormEntity = (OrmEntity) ormPersistentType.getMapping();
- XmlEntity entityResource = getXmlEntityMappings().getEntities().get(0);
-
- assertNull(ormEntity.getGeneratorContainer().getTableGenerator());
- assertNull(entityResource.getTableGenerator());
- assertEquals(0, ormEntity.getPersistenceUnit().generatorsSize());
-
- entityResource.setTableGenerator(OrmFactory.eINSTANCE.createXmlTableGenerator());
-
- assertNotNull(ormEntity.getGeneratorContainer().getTableGenerator());
- assertNotNull(entityResource.getTableGenerator());
- assertEquals(1, ormEntity.getPersistenceUnit().generatorsSize());
-
- ormEntity.getGeneratorContainer().getTableGenerator().setName("foo");
- assertEquals(1, ormEntity.getPersistenceUnit().generatorsSize());
-
- entityResource.setTableGenerator(null);
- assertNull(ormEntity.getGeneratorContainer().getTableGenerator());
- assertNull(entityResource.getTableGenerator());
- assertEquals(0, ormEntity.getPersistenceUnit().generatorsSize());
- }
-
- public void testUpdateDiscriminatorColumn() throws Exception {
- OrmPersistentType ormPersistentType = getEntityMappings().addPersistentType(MappingKeys.ENTITY_TYPE_MAPPING_KEY, "model.Foo");
- OrmEntity ormEntity = (OrmEntity) ormPersistentType.getMapping();
- XmlEntity entityResource = getXmlEntityMappings().getEntities().get(0);
-
- assertNotNull(ormEntity.getDiscriminatorColumn());
-
- entityResource.setDiscriminatorColumn(OrmFactory.eINSTANCE.createXmlDiscriminatorColumn());
- entityResource.getDiscriminatorColumn().setName("FOO");
-
- assertEquals("FOO", ormEntity.getDiscriminatorColumn().getSpecifiedName());
- assertEquals("FOO", entityResource.getDiscriminatorColumn().getName());
-
- entityResource.getDiscriminatorColumn().setName(null);
-
- assertNull(ormEntity.getDiscriminatorColumn().getSpecifiedName());
- assertNull(entityResource.getDiscriminatorColumn().getName());
-
- entityResource.setDiscriminatorColumn(null);
-
- assertNotNull(ormEntity.getDiscriminatorColumn());
- }
-
- public void testUpdateDiscriminatorValue() throws Exception {
- OrmPersistentType ormPersistentType = getEntityMappings().addPersistentType(MappingKeys.ENTITY_TYPE_MAPPING_KEY, "model.Foo");
- OrmEntity ormEntity = (OrmEntity) ormPersistentType.getMapping();
- XmlEntity entityResource = getXmlEntityMappings().getEntities().get(0);
-
- assertNull(ormEntity.getSpecifiedDiscriminatorValue());
- assertNull(entityResource.getDiscriminatorValue());
-
- entityResource.setDiscriminatorValue("FOO");
-
- assertEquals("FOO", ormEntity.getSpecifiedDiscriminatorValue());
- assertEquals("FOO", entityResource.getDiscriminatorValue());
-
- entityResource.setDiscriminatorValue(null);
-
- assertNull(ormEntity.getSpecifiedDiscriminatorValue());
- assertNull(entityResource.getDiscriminatorValue());
- }
-
- public void testModifyDiscriminatorValue() throws Exception {
- OrmPersistentType ormPersistentType = getEntityMappings().addPersistentType(MappingKeys.ENTITY_TYPE_MAPPING_KEY, "model.Foo");
- OrmEntity ormEntity = (OrmEntity) ormPersistentType.getMapping();
- XmlEntity entityResource = getXmlEntityMappings().getEntities().get(0);
-
- assertNull(ormEntity.getSpecifiedDiscriminatorValue());
- assertNull(entityResource.getDiscriminatorValue());
-
- ormEntity.setSpecifiedDiscriminatorValue("FOO");
-
- assertEquals("FOO", ormEntity.getSpecifiedDiscriminatorValue());
- assertEquals("FOO", entityResource.getDiscriminatorValue());
-
- ormEntity.setSpecifiedDiscriminatorValue(null);
-
- assertNull(ormEntity.getSpecifiedDiscriminatorValue());
- assertNull(entityResource.getDiscriminatorValue());
- }
-
- public void testGetDefaultDiscriminatorValue() throws Exception {
- createTestEntityFieldAccess();
- OrmPersistentType persistentType = getEntityMappings().addPersistentType(MappingKeys.ENTITY_TYPE_MAPPING_KEY, FULLY_QUALIFIED_TYPE_NAME);
- OrmEntity ormEntity = (OrmEntity) persistentType.getMapping();
- JavaEntity javaEntity = (JavaEntity) persistentType.getJavaPersistentType().getMapping();
- assertEquals(null, ormEntity.getDefaultDiscriminatorValue());
-
- createTestSubType();
- getEntityMappings().addPersistentType(MappingKeys.ENTITY_TYPE_MAPPING_KEY, FULLY_QUALIFIED_CHILD_TYPE_NAME);
- assertEquals(ormEntity.getName(), ormEntity.getDefaultDiscriminatorValue());
-
- javaEntity.getDiscriminatorColumn().setSpecifiedDiscriminatorType(DiscriminatorType.INTEGER);
- assertNull(ormEntity.getDefaultDiscriminatorValue());
-
- javaEntity.getDiscriminatorColumn().setSpecifiedDiscriminatorType(null);
- javaEntity.setSpecifiedDiscriminatorValue("FOO");
-
- assertEquals("FOO", ormEntity.getDefaultDiscriminatorValue());
-
- ormEntity.setSpecifiedMetadataComplete(Boolean.TRUE);
- assertEquals(ormEntity.getName(), ormEntity.getDefaultDiscriminatorValue());
- }
-
- public void testAddSpecifiedPrimaryKeyJoinColumn() throws Exception {
- OrmPersistentType persistentType = getEntityMappings().addPersistentType(MappingKeys.ENTITY_TYPE_MAPPING_KEY, FULLY_QUALIFIED_TYPE_NAME);
- OrmEntity ormEntity = (OrmEntity) persistentType.getMapping();
- XmlEntity entityResource = getXmlEntityMappings().getEntities().get(0);
-
- OrmPrimaryKeyJoinColumn primaryKeyJoinColumn = ormEntity.addSpecifiedPrimaryKeyJoinColumn(0);
- primaryKeyJoinColumn.setSpecifiedName("FOO");
-
- assertEquals("FOO", entityResource.getPrimaryKeyJoinColumns().get(0).getName());
-
- OrmPrimaryKeyJoinColumn primaryKeyJoinColumn2 = ormEntity.addSpecifiedPrimaryKeyJoinColumn(0);
- primaryKeyJoinColumn2.setSpecifiedName("BAR");
-
- assertEquals("BAR", entityResource.getPrimaryKeyJoinColumns().get(0).getName());
- assertEquals("FOO", entityResource.getPrimaryKeyJoinColumns().get(1).getName());
-
- OrmPrimaryKeyJoinColumn primaryKeyJoinColumn3 = ormEntity.addSpecifiedPrimaryKeyJoinColumn(1);
- primaryKeyJoinColumn3.setSpecifiedName("BAZ");
-
- assertEquals("BAR", entityResource.getPrimaryKeyJoinColumns().get(0).getName());
- assertEquals("BAZ", entityResource.getPrimaryKeyJoinColumns().get(1).getName());
- assertEquals("FOO", entityResource.getPrimaryKeyJoinColumns().get(2).getName());
-
- ListIterator<OrmPrimaryKeyJoinColumn> primaryKeyJoinColumns = ormEntity.specifiedPrimaryKeyJoinColumns();
- assertEquals(primaryKeyJoinColumn2, primaryKeyJoinColumns.next());
- assertEquals(primaryKeyJoinColumn3, primaryKeyJoinColumns.next());
- assertEquals(primaryKeyJoinColumn, primaryKeyJoinColumns.next());
-
- primaryKeyJoinColumns = ormEntity.specifiedPrimaryKeyJoinColumns();
- assertEquals("BAR", primaryKeyJoinColumns.next().getName());
- assertEquals("BAZ", primaryKeyJoinColumns.next().getName());
- assertEquals("FOO", primaryKeyJoinColumns.next().getName());
- }
-
- public void testRemoveSpecifiedPrimaryKeyJoinColumn() throws Exception {
- OrmPersistentType persistentType = getEntityMappings().addPersistentType(MappingKeys.ENTITY_TYPE_MAPPING_KEY, FULLY_QUALIFIED_TYPE_NAME);
- OrmEntity ormEntity = (OrmEntity) persistentType.getMapping();
-
- ormEntity.addSpecifiedPrimaryKeyJoinColumn(0).setSpecifiedName("FOO");
- ormEntity.addSpecifiedPrimaryKeyJoinColumn(1).setSpecifiedName("BAR");
- ormEntity.addSpecifiedPrimaryKeyJoinColumn(2).setSpecifiedName("BAZ");
-
- XmlEntity entityResource = getXmlEntityMappings().getEntities().get(0);
- assertEquals(3, entityResource.getPrimaryKeyJoinColumns().size());
-
- ormEntity.removeSpecifiedPrimaryKeyJoinColumn(0);
- assertEquals(2, entityResource.getPrimaryKeyJoinColumns().size());
- assertEquals("BAR", entityResource.getPrimaryKeyJoinColumns().get(0).getName());
- assertEquals("BAZ", entityResource.getPrimaryKeyJoinColumns().get(1).getName());
-
- ormEntity.removeSpecifiedPrimaryKeyJoinColumn(0);
- assertEquals(1, entityResource.getPrimaryKeyJoinColumns().size());
- assertEquals("BAZ", entityResource.getPrimaryKeyJoinColumns().get(0).getName());
-
- ormEntity.removeSpecifiedPrimaryKeyJoinColumn(0);
- assertEquals(0, entityResource.getPrimaryKeyJoinColumns().size());
- }
-
- public void testMoveSpecifiedPrimaryKeyJoinColumn() throws Exception {
- OrmPersistentType persistentType = getEntityMappings().addPersistentType(MappingKeys.ENTITY_TYPE_MAPPING_KEY, FULLY_QUALIFIED_TYPE_NAME);
- OrmEntity ormEntity = (OrmEntity) persistentType.getMapping();
-
- ormEntity.addSpecifiedPrimaryKeyJoinColumn(0).setSpecifiedName("FOO");
- ormEntity.addSpecifiedPrimaryKeyJoinColumn(1).setSpecifiedName("BAR");
- ormEntity.addSpecifiedPrimaryKeyJoinColumn(2).setSpecifiedName("BAZ");
-
- XmlEntity entityResource = getXmlEntityMappings().getEntities().get(0);
- assertEquals(3, entityResource.getPrimaryKeyJoinColumns().size());
-
-
- ormEntity.moveSpecifiedPrimaryKeyJoinColumn(2, 0);
- ListIterator<OrmPrimaryKeyJoinColumn> primaryKeyJoinColumns = ormEntity.specifiedPrimaryKeyJoinColumns();
- assertEquals("BAR", primaryKeyJoinColumns.next().getName());
- assertEquals("BAZ", primaryKeyJoinColumns.next().getName());
- assertEquals("FOO", primaryKeyJoinColumns.next().getName());
-
- assertEquals("BAR", entityResource.getPrimaryKeyJoinColumns().get(0).getName());
- assertEquals("BAZ", entityResource.getPrimaryKeyJoinColumns().get(1).getName());
- assertEquals("FOO", entityResource.getPrimaryKeyJoinColumns().get(2).getName());
-
-
- ormEntity.moveSpecifiedPrimaryKeyJoinColumn(0, 1);
- primaryKeyJoinColumns = ormEntity.specifiedPrimaryKeyJoinColumns();
- assertEquals("BAZ", primaryKeyJoinColumns.next().getName());
- assertEquals("BAR", primaryKeyJoinColumns.next().getName());
- assertEquals("FOO", primaryKeyJoinColumns.next().getName());
-
- assertEquals("BAZ", entityResource.getPrimaryKeyJoinColumns().get(0).getName());
- assertEquals("BAR", entityResource.getPrimaryKeyJoinColumns().get(1).getName());
- assertEquals("FOO", entityResource.getPrimaryKeyJoinColumns().get(2).getName());
- }
-
- public void testUpdatePrimaryKeyJoinColumns() throws Exception {
- OrmPersistentType persistentType = getEntityMappings().addPersistentType(MappingKeys.ENTITY_TYPE_MAPPING_KEY, FULLY_QUALIFIED_TYPE_NAME);
- OrmEntity ormEntity = (OrmEntity) persistentType.getMapping();
-
- XmlEntity entityResource = getXmlEntityMappings().getEntities().get(0);
- entityResource.getPrimaryKeyJoinColumns().add(OrmFactory.eINSTANCE.createXmlPrimaryKeyJoinColumn());
- entityResource.getPrimaryKeyJoinColumns().add(OrmFactory.eINSTANCE.createXmlPrimaryKeyJoinColumn());
- entityResource.getPrimaryKeyJoinColumns().add(OrmFactory.eINSTANCE.createXmlPrimaryKeyJoinColumn());
-
- entityResource.getPrimaryKeyJoinColumns().get(0).setName("FOO");
- entityResource.getPrimaryKeyJoinColumns().get(1).setName("BAR");
- entityResource.getPrimaryKeyJoinColumns().get(2).setName("BAZ");
-
- ListIterator<OrmPrimaryKeyJoinColumn> primaryKeyJoinColumns = ormEntity.specifiedPrimaryKeyJoinColumns();
- assertEquals("FOO", primaryKeyJoinColumns.next().getName());
- assertEquals("BAR", primaryKeyJoinColumns.next().getName());
- assertEquals("BAZ", primaryKeyJoinColumns.next().getName());
- assertFalse(primaryKeyJoinColumns.hasNext());
-
- entityResource.getPrimaryKeyJoinColumns().move(2, 0);
- primaryKeyJoinColumns = ormEntity.specifiedPrimaryKeyJoinColumns();
- assertEquals("BAR", primaryKeyJoinColumns.next().getName());
- assertEquals("BAZ", primaryKeyJoinColumns.next().getName());
- assertEquals("FOO", primaryKeyJoinColumns.next().getName());
- assertFalse(primaryKeyJoinColumns.hasNext());
-
- entityResource.getPrimaryKeyJoinColumns().move(0, 1);
- primaryKeyJoinColumns = ormEntity.specifiedPrimaryKeyJoinColumns();
- assertEquals("BAZ", primaryKeyJoinColumns.next().getName());
- assertEquals("BAR", primaryKeyJoinColumns.next().getName());
- assertEquals("FOO", primaryKeyJoinColumns.next().getName());
- assertFalse(primaryKeyJoinColumns.hasNext());
-
- entityResource.getPrimaryKeyJoinColumns().remove(1);
- primaryKeyJoinColumns = ormEntity.specifiedPrimaryKeyJoinColumns();
- assertEquals("BAZ", primaryKeyJoinColumns.next().getName());
- assertEquals("FOO", primaryKeyJoinColumns.next().getName());
- assertFalse(primaryKeyJoinColumns.hasNext());
-
- entityResource.getPrimaryKeyJoinColumns().remove(1);
- primaryKeyJoinColumns = ormEntity.specifiedPrimaryKeyJoinColumns();
- assertEquals("BAZ", primaryKeyJoinColumns.next().getName());
- assertFalse(primaryKeyJoinColumns.hasNext());
-
- entityResource.getPrimaryKeyJoinColumns().remove(0);
- assertFalse(ormEntity.specifiedPrimaryKeyJoinColumns().hasNext());
- }
-
- public void testDefaultPrimaryKeyJoinColumns() throws Exception {
- createTestType();
- createTestSubTypeUnmapped();
-
- OrmPersistentType persistentType = getEntityMappings().addPersistentType(MappingKeys.ENTITY_TYPE_MAPPING_KEY, FULLY_QUALIFIED_TYPE_NAME);
- OrmPersistentType childPersistentType = getEntityMappings().addPersistentType(MappingKeys.ENTITY_TYPE_MAPPING_KEY, FULLY_QUALIFIED_CHILD_TYPE_NAME);
- childPersistentType.getJavaPersistentType().setMappingKey(MappingKeys.NULL_TYPE_MAPPING_KEY);
-
- persistentType.getAttributeNamed("id").makeSpecified(MappingKeys.ID_ATTRIBUTE_MAPPING_KEY);
-
- ((OrmEntity) persistentType.getMapping()).setSpecifiedInheritanceStrategy(InheritanceType.JOINED);
-
- OrmEntity childEntity = (OrmEntity) childPersistentType.getMapping();
-
- assertTrue(childEntity.defaultPrimaryKeyJoinColumns().hasNext());
- assertEquals("id", childEntity.defaultPrimaryKeyJoinColumns().next().getDefaultName());
- assertEquals("id", childEntity.defaultPrimaryKeyJoinColumns().next().getDefaultReferencedColumnName());
-
- childPersistentType.getJavaPersistentType().setMappingKey(MappingKeys.ENTITY_TYPE_MAPPING_KEY);
- persistentType.getJavaPersistentType().setMappingKey(MappingKeys.ENTITY_TYPE_MAPPING_KEY);
-
- assertTrue(childEntity.defaultPrimaryKeyJoinColumns().hasNext());
- assertEquals("id", childEntity.defaultPrimaryKeyJoinColumns().next().getDefaultName());
- assertEquals("id", childEntity.defaultPrimaryKeyJoinColumns().next().getDefaultReferencedColumnName());
-
- OrmPrimaryKeyJoinColumn specifiedPkJoinColumn = childEntity.addSpecifiedPrimaryKeyJoinColumn(0);
- specifiedPkJoinColumn.setSpecifiedName("FOO");
- specifiedPkJoinColumn.setSpecifiedReferencedColumnName("BAR");
-
- assertFalse(childEntity.defaultPrimaryKeyJoinColumns().hasNext());
-
- //remove the pkJoinColumn from the context mode, verify context model has a default pkJoinColumn
- childEntity.removeSpecifiedPrimaryKeyJoinColumn(0);
- assertTrue(childEntity.defaultPrimaryKeyJoinColumns().hasNext());
- assertEquals("id", childEntity.defaultPrimaryKeyJoinColumns().next().getDefaultName());
- assertEquals("id", childEntity.defaultPrimaryKeyJoinColumns().next().getDefaultReferencedColumnName());
-
-
- childPersistentType.getJavaPersistentType().setMappingKey(MappingKeys.NULL_TYPE_MAPPING_KEY);
- persistentType.getJavaPersistentType().setMappingKey(MappingKeys.NULL_TYPE_MAPPING_KEY);
-
- specifiedPkJoinColumn = childEntity.addSpecifiedPrimaryKeyJoinColumn(0);
- specifiedPkJoinColumn.setSpecifiedName("FOO");
- specifiedPkJoinColumn.setSpecifiedReferencedColumnName("BAR");
- assertFalse(childEntity.defaultPrimaryKeyJoinColumns().hasNext());
- //now remove the pkJoinColumn from the resource model, verify context model updates and has a default pkJoinColumn
- ((XmlEntity)childEntity.getResourceTypeMapping()).getPrimaryKeyJoinColumns().remove(0);
- assertTrue(childEntity.defaultPrimaryKeyJoinColumns().hasNext());
- assertEquals("id", childEntity.defaultPrimaryKeyJoinColumns().next().getDefaultName());
- assertEquals("id", childEntity.defaultPrimaryKeyJoinColumns().next().getDefaultReferencedColumnName());
- }
-
- public void testDefaultPrimaryKeyJoinColumnsFromJava() throws Exception {
- createTestEntityFieldAccess();
- createTestSubType();
-
- OrmPersistentType persistentType = getEntityMappings().addPersistentType(MappingKeys.ENTITY_TYPE_MAPPING_KEY, FULLY_QUALIFIED_TYPE_NAME);
- OrmPersistentType childPersistentType = getEntityMappings().addPersistentType(MappingKeys.ENTITY_TYPE_MAPPING_KEY, FULLY_QUALIFIED_CHILD_TYPE_NAME);
-
-
- ((JavaEntity) persistentType.getJavaPersistentType().getMapping()).setSpecifiedInheritanceStrategy(InheritanceType.JOINED);
-
- OrmEntity childEntity = (OrmEntity) childPersistentType.getMapping();
-
- assertTrue(childEntity.defaultPrimaryKeyJoinColumns().hasNext());
- assertEquals("id", childEntity.defaultPrimaryKeyJoinColumns().next().getDefaultName());
- assertEquals("id", childEntity.defaultPrimaryKeyJoinColumns().next().getDefaultReferencedColumnName());
-
- JavaEntity javaEntity = (JavaEntity) childPersistentType.getJavaPersistentType().getMapping();
- JavaPrimaryKeyJoinColumn javaPrimaryKeyJoinColumn = javaEntity.addSpecifiedPrimaryKeyJoinColumn(0);
- javaPrimaryKeyJoinColumn.setSpecifiedName("FOO");
- javaPrimaryKeyJoinColumn.setSpecifiedReferencedColumnName("BAR");
-
- JavaPrimaryKeyJoinColumn javaPrimaryKeyJoinColumn2 = javaEntity.addSpecifiedPrimaryKeyJoinColumn(1);
- javaPrimaryKeyJoinColumn2.setSpecifiedName("FOO2");
- javaPrimaryKeyJoinColumn2.setSpecifiedReferencedColumnName("BAR2");
-
- childPersistentType.getJavaPersistentType().setMappingKey(MappingKeys.ENTITY_TYPE_MAPPING_KEY);
- persistentType.getJavaPersistentType().setMappingKey(MappingKeys.ENTITY_TYPE_MAPPING_KEY);
-
- ListIterator<OrmPrimaryKeyJoinColumn> defaultPrimaryKeyJoinColumns = childEntity.defaultPrimaryKeyJoinColumns();
- OrmPrimaryKeyJoinColumn defaultPrimaryKeyJoinColumn = defaultPrimaryKeyJoinColumns.next();
- assertEquals("FOO", defaultPrimaryKeyJoinColumn.getName());
- assertEquals("BAR", defaultPrimaryKeyJoinColumn.getReferencedColumnName());
-
- defaultPrimaryKeyJoinColumn = defaultPrimaryKeyJoinColumns.next();
- assertEquals("FOO2", defaultPrimaryKeyJoinColumn.getName());
- assertEquals("BAR2", defaultPrimaryKeyJoinColumn.getReferencedColumnName());
- assertFalse(defaultPrimaryKeyJoinColumns.hasNext());
-
- childEntity.setSpecifiedMetadataComplete(Boolean.TRUE);
- defaultPrimaryKeyJoinColumns = childEntity.defaultPrimaryKeyJoinColumns();
- defaultPrimaryKeyJoinColumn = defaultPrimaryKeyJoinColumns.next();
- assertEquals("id", defaultPrimaryKeyJoinColumn.getDefaultName());
- assertEquals("id", defaultPrimaryKeyJoinColumn.getDefaultReferencedColumnName());
-
- assertFalse(defaultPrimaryKeyJoinColumns.hasNext());
-
- }
-
- public void testMoveSpecifiedAttributeOverride() throws Exception {
- OrmPersistentType persistentType = getEntityMappings().addPersistentType(MappingKeys.ENTITY_TYPE_MAPPING_KEY, FULLY_QUALIFIED_TYPE_NAME);
- OrmEntity ormEntity = (OrmEntity) persistentType.getMapping();
-
- XmlEntity entityResource = getXmlEntityMappings().getEntities().get(0);
- entityResource.getAttributeOverrides().add(OrmFactory.eINSTANCE.createXmlAttributeOverride());
- entityResource.getAttributeOverrides().add(OrmFactory.eINSTANCE.createXmlAttributeOverride());
- entityResource.getAttributeOverrides().add(OrmFactory.eINSTANCE.createXmlAttributeOverride());
-
- entityResource.getAttributeOverrides().get(0).setName("FOO");
- entityResource.getAttributeOverrides().get(1).setName("BAR");
- entityResource.getAttributeOverrides().get(2).setName("BAZ");
-
- assertEquals(3, entityResource.getAttributeOverrides().size());
-
-
- ormEntity.moveSpecifiedAttributeOverride(2, 0);
- ListIterator<OrmAttributeOverride> attributeOverrides = ormEntity.specifiedAttributeOverrides();
- assertEquals("BAR", attributeOverrides.next().getName());
- assertEquals("BAZ", attributeOverrides.next().getName());
- assertEquals("FOO", attributeOverrides.next().getName());
-
- assertEquals("BAR", entityResource.getAttributeOverrides().get(0).getName());
- assertEquals("BAZ", entityResource.getAttributeOverrides().get(1).getName());
- assertEquals("FOO", entityResource.getAttributeOverrides().get(2).getName());
-
-
- ormEntity.moveSpecifiedAttributeOverride(0, 1);
- attributeOverrides = ormEntity.specifiedAttributeOverrides();
- assertEquals("BAZ", attributeOverrides.next().getName());
- assertEquals("BAR", attributeOverrides.next().getName());
- assertEquals("FOO", attributeOverrides.next().getName());
-
- assertEquals("BAZ", entityResource.getAttributeOverrides().get(0).getName());
- assertEquals("BAR", entityResource.getAttributeOverrides().get(1).getName());
- assertEquals("FOO", entityResource.getAttributeOverrides().get(2).getName());
- }
-
- public void testUpdateAttributeOverrides() throws Exception {
- OrmPersistentType persistentType = getEntityMappings().addPersistentType(MappingKeys.ENTITY_TYPE_MAPPING_KEY, FULLY_QUALIFIED_TYPE_NAME);
- OrmEntity ormEntity = (OrmEntity) persistentType.getMapping();
-
- XmlEntity entityResource = getXmlEntityMappings().getEntities().get(0);
- entityResource.getAttributeOverrides().add(OrmFactory.eINSTANCE.createXmlAttributeOverride());
- entityResource.getAttributeOverrides().add(OrmFactory.eINSTANCE.createXmlAttributeOverride());
- entityResource.getAttributeOverrides().add(OrmFactory.eINSTANCE.createXmlAttributeOverride());
-
- entityResource.getAttributeOverrides().get(0).setName("FOO");
- entityResource.getAttributeOverrides().get(1).setName("BAR");
- entityResource.getAttributeOverrides().get(2).setName("BAZ");
-
- ListIterator<OrmAttributeOverride> attributeOverrides = ormEntity.specifiedAttributeOverrides();
- assertEquals("FOO", attributeOverrides.next().getName());
- assertEquals("BAR", attributeOverrides.next().getName());
- assertEquals("BAZ", attributeOverrides.next().getName());
- assertFalse(attributeOverrides.hasNext());
-
- entityResource.getAttributeOverrides().move(2, 0);
- attributeOverrides = ormEntity.specifiedAttributeOverrides();
- assertEquals("BAR", attributeOverrides.next().getName());
- assertEquals("BAZ", attributeOverrides.next().getName());
- assertEquals("FOO", attributeOverrides.next().getName());
- assertFalse(attributeOverrides.hasNext());
-
- entityResource.getAttributeOverrides().move(0, 1);
- attributeOverrides = ormEntity.specifiedAttributeOverrides();
- assertEquals("BAZ", attributeOverrides.next().getName());
- assertEquals("BAR", attributeOverrides.next().getName());
- assertEquals("FOO", attributeOverrides.next().getName());
- assertFalse(attributeOverrides.hasNext());
-
- entityResource.getAttributeOverrides().remove(1);
- attributeOverrides = ormEntity.specifiedAttributeOverrides();
- assertEquals("BAZ", attributeOverrides.next().getName());
- assertEquals("FOO", attributeOverrides.next().getName());
- assertFalse(attributeOverrides.hasNext());
-
- entityResource.getAttributeOverrides().remove(1);
- attributeOverrides = ormEntity.specifiedAttributeOverrides();
- assertEquals("BAZ", attributeOverrides.next().getName());
- assertFalse(attributeOverrides.hasNext());
-
- entityResource.getAttributeOverrides().remove(0);
- assertFalse(ormEntity.specifiedAttributeOverrides().hasNext());
- }
-
- public void testVirtualAttributeOverrides() throws Exception {
- createTestMappedSuperclass();
- createTestSubType();
- OrmPersistentType persistentType = getEntityMappings().addPersistentType(MappingKeys.ENTITY_TYPE_MAPPING_KEY, FULLY_QUALIFIED_CHILD_TYPE_NAME);
- OrmPersistentType persistentType2 = getEntityMappings().addPersistentType(MappingKeys.MAPPED_SUPERCLASS_TYPE_MAPPING_KEY, FULLY_QUALIFIED_TYPE_NAME);
-
-
- OrmEntity entity = (OrmEntity) persistentType.getMapping();
-
- assertEquals(4, entity.virtualAttributeOverridesSize());
- ListIterator<OrmAttributeOverride> virtualAttributeOverrides = entity.virtualAttributeOverrides();
- OrmAttributeOverride attributeOverride = virtualAttributeOverrides.next();
- assertEquals("foo", attributeOverride.getName());
- attributeOverride = virtualAttributeOverrides.next();
- assertEquals("basic", attributeOverride.getName());
- attributeOverride = virtualAttributeOverrides.next();
- assertEquals("id", attributeOverride.getName());
- attributeOverride = virtualAttributeOverrides.next();
- assertEquals("name", attributeOverride.getName());
- assertEquals("name", attributeOverride.getColumn().getName());
- assertEquals(CHILD_TYPE_NAME, attributeOverride.getColumn().getTable());
- assertEquals(null, attributeOverride.getColumn().getColumnDefinition());
- assertEquals(true, attributeOverride.getColumn().isInsertable());
- assertEquals(true, attributeOverride.getColumn().isUpdatable());
- assertEquals(false, attributeOverride.getColumn().isUnique());
- assertEquals(true, attributeOverride.getColumn().isNullable());
- assertEquals(255, attributeOverride.getColumn().getLength());
- assertEquals(0, attributeOverride.getColumn().getPrecision());
- assertEquals(0, attributeOverride.getColumn().getScale());
-
- entity.virtualAttributeOverrides().next().setVirtual(false);
-
- assertEquals(3, entity.virtualAttributeOverridesSize());
- virtualAttributeOverrides = entity.virtualAttributeOverrides();
- attributeOverride = virtualAttributeOverrides.next();
- assertEquals("basic", attributeOverride.getName());
- attributeOverride = virtualAttributeOverrides.next();
- assertEquals("id", attributeOverride.getName());
- attributeOverride = virtualAttributeOverrides.next();
- assertEquals("name", attributeOverride.getName());
-
- entity.setSpecifiedMetadataComplete(Boolean.TRUE);
- assertEquals(3, entity.virtualAttributeOverridesSize());
- virtualAttributeOverrides = entity.virtualAttributeOverrides();
- attributeOverride = virtualAttributeOverrides.next();
- assertEquals("basic", attributeOverride.getName());
- attributeOverride = virtualAttributeOverrides.next();
- assertEquals("id", attributeOverride.getName());
- attributeOverride = virtualAttributeOverrides.next();
- assertEquals("name", attributeOverride.getName());
-
- entity.specifiedAttributeOverrides().next().setVirtual(true);
- entity.setSpecifiedMetadataComplete(Boolean.FALSE);
- entity.getJavaEntity().virtualAttributeOverrides().next().setVirtual(false);
- JavaColumn javaColumn = entity.getJavaEntity().specifiedAttributeOverrides().next().getColumn();
- javaColumn.setSpecifiedName("FOO");
- javaColumn.setSpecifiedTable("BAR");
- javaColumn.setColumnDefinition("COLUMN_DEF");
- javaColumn.setSpecifiedInsertable(Boolean.FALSE);
- javaColumn.setSpecifiedUpdatable(Boolean.FALSE);
- javaColumn.setSpecifiedUnique(Boolean.TRUE);
- javaColumn.setSpecifiedNullable(Boolean.FALSE);
- javaColumn.setSpecifiedLength(Integer.valueOf(7));
- javaColumn.setSpecifiedPrecision(Integer.valueOf(8));
- javaColumn.setSpecifiedScale(Integer.valueOf(9));
-
- assertEquals(4, entity.virtualAttributeOverridesSize());
- virtualAttributeOverrides = entity.virtualAttributeOverrides();
- attributeOverride = virtualAttributeOverrides.next();
- assertEquals("foo", attributeOverride.getName());
- assertEquals("FOO", attributeOverride.getColumn().getSpecifiedName());//TODO specified or default?
- assertEquals("BAR", attributeOverride.getColumn().getSpecifiedTable());
- assertEquals("COLUMN_DEF", attributeOverride.getColumn().getColumnDefinition());
- assertEquals(Boolean.FALSE, attributeOverride.getColumn().getSpecifiedInsertable());
- assertEquals(Boolean.FALSE, attributeOverride.getColumn().getSpecifiedUpdatable());
- assertEquals(Boolean.TRUE, attributeOverride.getColumn().getSpecifiedUnique());
- assertEquals(Boolean.FALSE, attributeOverride.getColumn().getSpecifiedNullable());
- assertEquals(Integer.valueOf(7), attributeOverride.getColumn().getSpecifiedLength());
- assertEquals(Integer.valueOf(8), attributeOverride.getColumn().getSpecifiedPrecision());
- assertEquals(Integer.valueOf(9), attributeOverride.getColumn().getSpecifiedScale());
-
- attributeOverride = virtualAttributeOverrides.next();
- assertEquals("basic", attributeOverride.getName());
- assertEquals("basic", attributeOverride.getColumn().getSpecifiedName());
- attributeOverride = virtualAttributeOverrides.next();
- assertEquals("id", attributeOverride.getName());
- attributeOverride = virtualAttributeOverrides.next();
- assertEquals("name", attributeOverride.getName());
-
- persistentType2.getAttributeNamed("basic").makeSpecified();
- OrmBasicMapping basicMapping = (OrmBasicMapping) persistentType2.getAttributeNamed("basic").getMapping();
- basicMapping.getColumn().setSpecifiedName("MY_NAME");
- basicMapping.getColumn().setSpecifiedTable("BAR");
- basicMapping.getColumn().setColumnDefinition("COLUMN_DEF");
- basicMapping.getColumn().setSpecifiedInsertable(Boolean.FALSE);
- basicMapping.getColumn().setSpecifiedUpdatable(Boolean.FALSE);
- basicMapping.getColumn().setSpecifiedUnique(Boolean.TRUE);
- basicMapping.getColumn().setSpecifiedNullable(Boolean.FALSE);
- basicMapping.getColumn().setSpecifiedLength(Integer.valueOf(5));
- basicMapping.getColumn().setSpecifiedPrecision(Integer.valueOf(6));
- basicMapping.getColumn().setSpecifiedScale(Integer.valueOf(7));
-
-
-
- assertEquals(4, entity.virtualAttributeOverridesSize());
- virtualAttributeOverrides = entity.virtualAttributeOverrides();
- attributeOverride = virtualAttributeOverrides.next();
- assertEquals("basic", attributeOverride.getName());
- assertEquals("MY_NAME", attributeOverride.getColumn().getSpecifiedName());
- assertEquals("BAR", attributeOverride.getColumn().getTable());
- assertEquals("COLUMN_DEF", attributeOverride.getColumn().getColumnDefinition());
- assertEquals(false, attributeOverride.getColumn().isInsertable());
- assertEquals(false, attributeOverride.getColumn().isUpdatable());
- assertEquals(true, attributeOverride.getColumn().isUnique());
- assertEquals(false, attributeOverride.getColumn().isNullable());
- assertEquals(5, attributeOverride.getColumn().getLength());
- assertEquals(6, attributeOverride.getColumn().getPrecision());
- assertEquals(7, attributeOverride.getColumn().getScale());
-
- attributeOverride = virtualAttributeOverrides.next();
- assertEquals("foo", attributeOverride.getName());
- assertEquals("FOO", attributeOverride.getColumn().getSpecifiedName());//TODO specified or default?
- assertEquals("BAR", attributeOverride.getColumn().getSpecifiedTable());
- assertEquals("COLUMN_DEF", attributeOverride.getColumn().getColumnDefinition());
- assertEquals(Boolean.FALSE, attributeOverride.getColumn().getSpecifiedInsertable());
- assertEquals(Boolean.FALSE, attributeOverride.getColumn().getSpecifiedUpdatable());
- assertEquals(Boolean.TRUE, attributeOverride.getColumn().getSpecifiedUnique());
- assertEquals(Boolean.FALSE, attributeOverride.getColumn().getSpecifiedNullable());
- assertEquals(Integer.valueOf(7), attributeOverride.getColumn().getSpecifiedLength());
- assertEquals(Integer.valueOf(8), attributeOverride.getColumn().getSpecifiedPrecision());
- assertEquals(Integer.valueOf(9), attributeOverride.getColumn().getSpecifiedScale());
- attributeOverride = virtualAttributeOverrides.next();
- assertEquals("id", attributeOverride.getName());
- }
-
- public void testVirtualAttributeOverridesNoJavaEntity() throws Exception {
- createTestMappedSuperclass();
- createTestSubType();
- OrmPersistentType persistentType = getEntityMappings().addPersistentType(MappingKeys.ENTITY_TYPE_MAPPING_KEY, FULLY_QUALIFIED_CHILD_TYPE_NAME);
- getEntityMappings().addPersistentType(MappingKeys.MAPPED_SUPERCLASS_TYPE_MAPPING_KEY, FULLY_QUALIFIED_TYPE_NAME);
-
-
- OrmEntity entity = (OrmEntity) persistentType.getMapping();
-
- persistentType.getJavaPersistentType().setMappingKey(MappingKeys.NULL_TYPE_MAPPING_KEY);
- assertEquals(4, entity.virtualAttributeOverridesSize());
- ListIterator<OrmAttributeOverride> virtualAttributeOverrides = entity.virtualAttributeOverrides();
- OrmAttributeOverride attributeOverride = virtualAttributeOverrides.next();
- assertEquals("foo", attributeOverride.getName());
- attributeOverride = virtualAttributeOverrides.next();
- assertEquals("basic", attributeOverride.getName());
- attributeOverride = virtualAttributeOverrides.next();
- assertEquals("id", attributeOverride.getName());
- attributeOverride = virtualAttributeOverrides.next();
- assertEquals("name", attributeOverride.getName());
- }
-
- public void testAttributeOverrideColumnDefaults() throws Exception {
- createTestMappedSuperclass();
- createTestSubType();
- OrmPersistentType persistentType = getEntityMappings().addPersistentType(MappingKeys.ENTITY_TYPE_MAPPING_KEY, FULLY_QUALIFIED_CHILD_TYPE_NAME);
- getEntityMappings().addPersistentType(MappingKeys.MAPPED_SUPERCLASS_TYPE_MAPPING_KEY, FULLY_QUALIFIED_TYPE_NAME);
-
-
- OrmEntity entity = (OrmEntity) persistentType.getMapping();
-
- entity.virtualAttributeOverrides().next().setVirtual(false);
-
- OrmAttributeOverride attributeOverride = entity.specifiedAttributeOverrides().next();
- assertEquals("foo", attributeOverride.getColumn().getDefaultName());
- assertEquals(CHILD_TYPE_NAME, attributeOverride.getColumn().getDefaultTable());
-
- ((JavaEntity) persistentType.getJavaPersistentType().getMapping()).getTable().setSpecifiedName("FOO");
- assertEquals("foo", attributeOverride.getColumn().getDefaultName());
- assertEquals("FOO", attributeOverride.getColumn().getDefaultTable());
-
- entity.setSpecifiedMetadataComplete(Boolean.TRUE);
- assertEquals("foo", attributeOverride.getColumn().getDefaultName());
- assertEquals(CHILD_TYPE_NAME, attributeOverride.getColumn().getDefaultTable());
-
- entity.setSpecifiedMetadataComplete(Boolean.FALSE);
- entity.getTable().setSpecifiedName("BAR");
- assertEquals("foo", attributeOverride.getColumn().getDefaultName());
- assertEquals("BAR", attributeOverride.getColumn().getDefaultTable());
- }
-
- public void testOverridableAttributes() throws Exception {
- createTestEntityDefaultFieldAccess();
-
- OrmPersistentType persistentType = getEntityMappings().addPersistentType(MappingKeys.ENTITY_TYPE_MAPPING_KEY, FULLY_QUALIFIED_TYPE_NAME);
- Entity entity = (Entity) persistentType.getMapping();
- Iterator<OrmPersistentAttribute> overridableAttributes = persistentType.getMapping().overridableAttributes();
- assertFalse(overridableAttributes.hasNext());
-
-
- entity.setSpecifiedInheritanceStrategy(InheritanceType.TABLE_PER_CLASS);
-
- overridableAttributes = entity.overridableAttributes();
- assertEquals("id", overridableAttributes.next().getName());
- assertEquals("name", overridableAttributes.next().getName());
- assertFalse(overridableAttributes.hasNext());
- }
-
- public void testOverridableAttributeNames() throws Exception {
- createTestEntityDefaultFieldAccess();
-
- OrmPersistentType persistentType = getEntityMappings().addPersistentType(MappingKeys.ENTITY_TYPE_MAPPING_KEY, FULLY_QUALIFIED_TYPE_NAME);
- Entity entity = (Entity) persistentType.getMapping();
- Iterator<String> overridableAttributeNames = persistentType.getMapping().overridableAttributeNames();
-
-
- entity.setSpecifiedInheritanceStrategy(InheritanceType.TABLE_PER_CLASS);
-
- overridableAttributeNames = entity.overridableAttributeNames();
- assertEquals("id", overridableAttributeNames.next());
- assertEquals("name", overridableAttributeNames.next());
- assertFalse(overridableAttributeNames.hasNext());
- }
-
- public void testAllOverridableAttributes() throws Exception {
- createTestMappedSuperclass();
- createTestSubType();
- OrmPersistentType persistentType = getEntityMappings().addPersistentType(MappingKeys.ENTITY_TYPE_MAPPING_KEY, FULLY_QUALIFIED_CHILD_TYPE_NAME);
- getEntityMappings().addPersistentType(MappingKeys.MAPPED_SUPERCLASS_TYPE_MAPPING_KEY, FULLY_QUALIFIED_TYPE_NAME);
- OrmEntity entity = (OrmEntity) persistentType.getMapping();
-
- Iterator<PersistentAttribute> overridableAttributes = entity.allOverridableAttributes();
- assertEquals("foo", overridableAttributes.next().getName());
- assertEquals("basic", overridableAttributes.next().getName());
- assertEquals("id", overridableAttributes.next().getName());
- assertEquals("name", overridableAttributes.next().getName());
- assertFalse(overridableAttributes.hasNext());
- }
-
- public void testAllOverridableAttributesTablePerClass() throws Exception {
- createTestAbstractEntityTablePerClass();
- createTestSubType();
- OrmPersistentType persistentType = getEntityMappings().addPersistentType(MappingKeys.ENTITY_TYPE_MAPPING_KEY, FULLY_QUALIFIED_CHILD_TYPE_NAME);
- OrmPersistentType abstractPersistentType = getEntityMappings().addPersistentType(MappingKeys.ENTITY_TYPE_MAPPING_KEY, FULLY_QUALIFIED_TYPE_NAME);
- OrmEntity entity = (OrmEntity) persistentType.getMapping();
- OrmEntity abstractEntity = (OrmEntity) abstractPersistentType.getMapping();
-
- Iterator<PersistentAttribute> overridableAttributes = entity.allOverridableAttributes();
- assertEquals("id", overridableAttributes.next().getName());
- assertEquals("name", overridableAttributes.next().getName());
- assertEquals("foo", overridableAttributes.next().getName());
- assertFalse(overridableAttributes.hasNext());
-
-
- overridableAttributes = abstractEntity.allOverridableAttributes();
- assertFalse(overridableAttributes.hasNext());
- }
-
- public void testVirtualAttributeOverridesEntityHierachy() throws Exception {
- createTestAbstractEntityTablePerClass();
- createTestSubType();
-
- PersistentType abstractPersistentType = getEntityMappings().addPersistentType(MappingKeys.ENTITY_TYPE_MAPPING_KEY, FULLY_QUALIFIED_TYPE_NAME);
- PersistentType concretePersistentType = getEntityMappings().addPersistentType(MappingKeys.ENTITY_TYPE_MAPPING_KEY, FULLY_QUALIFIED_CHILD_TYPE_NAME);
- Entity concreteEntity =(Entity) concretePersistentType.getMapping();
-
- assertEquals(3, concreteEntity.virtualAttributeOverridesSize());
- AttributeOverride virtualAttributeOverride = concreteEntity.virtualAttributeOverrides().next();
- assertEquals("id", virtualAttributeOverride.getName());
- assertEquals("id", virtualAttributeOverride.getColumn().getName());
- assertEquals(CHILD_TYPE_NAME, virtualAttributeOverride.getColumn().getTable());
-
-
- OrmBasicMapping idMapping = (OrmBasicMapping) abstractPersistentType.getAttributeNamed("id").getMapping();
- idMapping.getPersistentAttribute().makeSpecified();
- idMapping = (OrmBasicMapping) abstractPersistentType.getAttributeNamed("id").getMapping();
- idMapping.getColumn().setSpecifiedName("FOO");
- idMapping.getColumn().setSpecifiedTable("BAR");
-
-
- assertEquals(3, concreteEntity.virtualAttributeOverridesSize());
- virtualAttributeOverride = concreteEntity.virtualAttributeOverrides().next();
- assertEquals("id", virtualAttributeOverride.getName());
- assertEquals("FOO", virtualAttributeOverride.getColumn().getName());
- assertEquals("BAR", virtualAttributeOverride.getColumn().getTable());
-
- idMapping.getColumn().setSpecifiedName(null);
- idMapping.getColumn().setSpecifiedTable(null);
-
- virtualAttributeOverride = concreteEntity.virtualAttributeOverrides().next();
- assertEquals("id", virtualAttributeOverride.getName());
- assertEquals("id", virtualAttributeOverride.getColumn().getName());
- assertEquals(CHILD_TYPE_NAME, virtualAttributeOverride.getColumn().getTable());
-
- virtualAttributeOverride = virtualAttributeOverride.setVirtual(false);
- assertEquals(2, concreteEntity.virtualAttributeOverridesSize());
- }
-
- public void testMoveSpecifiedAssociationOverride() throws Exception {
- OrmPersistentType persistentType = getEntityMappings().addPersistentType(MappingKeys.ENTITY_TYPE_MAPPING_KEY, FULLY_QUALIFIED_TYPE_NAME);
- OrmEntity ormEntity = (OrmEntity) persistentType.getMapping();
-
- XmlEntity entityResource = getXmlEntityMappings().getEntities().get(0);
- entityResource.getAssociationOverrides().add(OrmFactory.eINSTANCE.createXmlAssociationOverride());
- entityResource.getAssociationOverrides().add(OrmFactory.eINSTANCE.createXmlAssociationOverride());
- entityResource.getAssociationOverrides().add(OrmFactory.eINSTANCE.createXmlAssociationOverride());
-
- entityResource.getAssociationOverrides().get(0).setName("FOO");
- entityResource.getAssociationOverrides().get(1).setName("BAR");
- entityResource.getAssociationOverrides().get(2).setName("BAZ");
-
- assertEquals(3, entityResource.getAssociationOverrides().size());
-
-
- ormEntity.moveSpecifiedAssociationOverride(2, 0);
- ListIterator<OrmAssociationOverride> associationOverrides = ormEntity.specifiedAssociationOverrides();
- assertEquals("BAR", associationOverrides.next().getName());
- assertEquals("BAZ", associationOverrides.next().getName());
- assertEquals("FOO", associationOverrides.next().getName());
-
- assertEquals("BAR", entityResource.getAssociationOverrides().get(0).getName());
- assertEquals("BAZ", entityResource.getAssociationOverrides().get(1).getName());
- assertEquals("FOO", entityResource.getAssociationOverrides().get(2).getName());
-
-
- ormEntity.moveSpecifiedAssociationOverride(0, 1);
- associationOverrides = ormEntity.specifiedAssociationOverrides();
- assertEquals("BAZ", associationOverrides.next().getName());
- assertEquals("BAR", associationOverrides.next().getName());
- assertEquals("FOO", associationOverrides.next().getName());
-
- assertEquals("BAZ", entityResource.getAssociationOverrides().get(0).getName());
- assertEquals("BAR", entityResource.getAssociationOverrides().get(1).getName());
- assertEquals("FOO", entityResource.getAssociationOverrides().get(2).getName());
- }
-
- public void testUpdateAssociationOverrides() throws Exception {
- OrmPersistentType persistentType = getEntityMappings().addPersistentType(MappingKeys.ENTITY_TYPE_MAPPING_KEY, FULLY_QUALIFIED_TYPE_NAME);
- OrmEntity ormEntity = (OrmEntity) persistentType.getMapping();
-
- XmlEntity entityResource = getXmlEntityMappings().getEntities().get(0);
- entityResource.getAssociationOverrides().add(OrmFactory.eINSTANCE.createXmlAssociationOverride());
- entityResource.getAssociationOverrides().add(OrmFactory.eINSTANCE.createXmlAssociationOverride());
- entityResource.getAssociationOverrides().add(OrmFactory.eINSTANCE.createXmlAssociationOverride());
-
- entityResource.getAssociationOverrides().get(0).setName("FOO");
- entityResource.getAssociationOverrides().get(1).setName("BAR");
- entityResource.getAssociationOverrides().get(2).setName("BAZ");
-
- ListIterator<OrmAssociationOverride> associationOverrides = ormEntity.specifiedAssociationOverrides();
- assertEquals("FOO", associationOverrides.next().getName());
- assertEquals("BAR", associationOverrides.next().getName());
- assertEquals("BAZ", associationOverrides.next().getName());
- assertFalse(associationOverrides.hasNext());
-
- entityResource.getAssociationOverrides().move(2, 0);
- associationOverrides = ormEntity.specifiedAssociationOverrides();
- assertEquals("BAR", associationOverrides.next().getName());
- assertEquals("BAZ", associationOverrides.next().getName());
- assertEquals("FOO", associationOverrides.next().getName());
- assertFalse(associationOverrides.hasNext());
-
- entityResource.getAssociationOverrides().move(0, 1);
- associationOverrides = ormEntity.specifiedAssociationOverrides();
- assertEquals("BAZ", associationOverrides.next().getName());
- assertEquals("BAR", associationOverrides.next().getName());
- assertEquals("FOO", associationOverrides.next().getName());
- assertFalse(associationOverrides.hasNext());
-
- entityResource.getAssociationOverrides().remove(1);
- associationOverrides = ormEntity.specifiedAssociationOverrides();
- assertEquals("BAZ", associationOverrides.next().getName());
- assertEquals("FOO", associationOverrides.next().getName());
- assertFalse(associationOverrides.hasNext());
-
- entityResource.getAssociationOverrides().remove(1);
- associationOverrides = ormEntity.specifiedAssociationOverrides();
- assertEquals("BAZ", associationOverrides.next().getName());
- assertFalse(associationOverrides.hasNext());
-
- entityResource.getAssociationOverrides().remove(0);
- assertFalse(ormEntity.specifiedAssociationOverrides().hasNext());
- }
-
- public void testVirtualAssociationOverrides() throws Exception {
- createTestMappedSuperclass();
- createTestSubType();
- OrmPersistentType persistentType = getEntityMappings().addPersistentType(MappingKeys.ENTITY_TYPE_MAPPING_KEY, FULLY_QUALIFIED_CHILD_TYPE_NAME);
- OrmPersistentType persistentType2 = getEntityMappings().addPersistentType(MappingKeys.MAPPED_SUPERCLASS_TYPE_MAPPING_KEY, FULLY_QUALIFIED_TYPE_NAME);
-
-
- OrmEntity entity = (OrmEntity) persistentType.getMapping();
-
- assertEquals(2, entity.virtualAssociationOverridesSize());
- ListIterator<OrmAssociationOverride> virtualAssociationOverrides = entity.virtualAssociationOverrides();
- OrmAssociationOverride associationOverride = virtualAssociationOverrides.next();
- assertEquals("oneToOne", associationOverride.getName());
- assertEquals(1, associationOverride.joinColumnsSize());
- OrmJoinColumn joinColumn = associationOverride.joinColumns().next();
- assertEquals("oneToOne_id", joinColumn.getName());
- assertEquals("id", joinColumn.getReferencedColumnName());
- assertEquals(CHILD_TYPE_NAME, joinColumn.getTable());
- assertEquals(null, joinColumn.getColumnDefinition());
- assertEquals(true, joinColumn.isInsertable());
- assertEquals(true, joinColumn.isUpdatable());
- assertEquals(false, joinColumn.isUnique());
- assertEquals(true, joinColumn.isNullable());
-
-
- associationOverride = virtualAssociationOverrides.next();
- assertEquals("manyToOne", associationOverride.getName());
- assertFalse(virtualAssociationOverrides.hasNext());
-
-
- entity.virtualAssociationOverrides().next().setVirtual(false);
-
- assertEquals(1, entity.virtualAssociationOverridesSize());
- virtualAssociationOverrides = entity.virtualAssociationOverrides();
- associationOverride = virtualAssociationOverrides.next();
- assertEquals("manyToOne", associationOverride.getName());
-
- entity.setSpecifiedMetadataComplete(Boolean.TRUE);
- assertEquals(1, entity.virtualAssociationOverridesSize());
- virtualAssociationOverrides = entity.virtualAssociationOverrides();
- associationOverride = virtualAssociationOverrides.next();
- assertEquals("manyToOne", associationOverride.getName());
-
- entity.specifiedAssociationOverrides().next().setVirtual(true);
- entity.setSpecifiedMetadataComplete(Boolean.FALSE);
- entity.getJavaEntity().virtualAssociationOverrides().next().setVirtual(false);
- JavaAssociationOverride javaAssociationOverride = entity.getJavaEntity().specifiedAssociationOverrides().next();
- JavaJoinColumn javaJoinColumn = javaAssociationOverride.addSpecifiedJoinColumn(0);
- javaJoinColumn.setSpecifiedName("FOO");
- javaJoinColumn.setSpecifiedReferencedColumnName("REFERENCE");
- javaJoinColumn.setSpecifiedTable("BAR");
- javaJoinColumn.setColumnDefinition("COLUMN_DEF");
- javaJoinColumn.setSpecifiedInsertable(Boolean.FALSE);
- javaJoinColumn.setSpecifiedUpdatable(Boolean.FALSE);
- javaJoinColumn.setSpecifiedUnique(Boolean.TRUE);
- javaJoinColumn.setSpecifiedNullable(Boolean.FALSE);
-
- assertEquals(2, entity.virtualAssociationOverridesSize());
- virtualAssociationOverrides = entity.virtualAssociationOverrides();
- associationOverride = virtualAssociationOverrides.next();
- assertEquals("oneToOne", associationOverride.getName());
- OrmJoinColumn ormJoinColumn = associationOverride.joinColumns().next();
- assertEquals("FOO", ormJoinColumn.getSpecifiedName());
- assertEquals("REFERENCE", ormJoinColumn.getSpecifiedReferencedColumnName());
- assertEquals("BAR", ormJoinColumn.getSpecifiedTable());
- assertEquals("COLUMN_DEF", ormJoinColumn.getColumnDefinition());
- assertEquals(Boolean.FALSE, ormJoinColumn.getSpecifiedInsertable());
- assertEquals(Boolean.FALSE, ormJoinColumn.getSpecifiedUpdatable());
- assertEquals(Boolean.TRUE, ormJoinColumn.getSpecifiedUnique());
- assertEquals(Boolean.FALSE, ormJoinColumn.getSpecifiedNullable());
-
- associationOverride = virtualAssociationOverrides.next();
- assertEquals("manyToOne", associationOverride.getName());
- assertEquals(null, associationOverride.joinColumns().next().getSpecifiedName());
-
- persistentType2.getAttributeNamed("manyToOne").makeSpecified();
- OrmManyToOneMapping manyToOneMapping = (OrmManyToOneMapping) persistentType2.getAttributeNamed("manyToOne").getMapping();
- joinColumn = manyToOneMapping.getRelationshipReference().getJoinColumnJoiningStrategy().addSpecifiedJoinColumn(0);
- joinColumn.setSpecifiedName("MY_NAME");
- joinColumn.setSpecifiedReferencedColumnName("MY_REFERNCE_NAME");
- joinColumn.setSpecifiedTable("BAR2");
- joinColumn.setColumnDefinition("COLUMN_DEF2");
- joinColumn.setSpecifiedInsertable(Boolean.FALSE);
- joinColumn.setSpecifiedUpdatable(Boolean.FALSE);
- joinColumn.setSpecifiedUnique(Boolean.TRUE);
- joinColumn.setSpecifiedNullable(Boolean.FALSE);
-
-
-
- assertEquals(2, entity.virtualAssociationOverridesSize());
- virtualAssociationOverrides = entity.virtualAssociationOverrides();
- assertEquals("oneToOne", associationOverride.getName());
- ormJoinColumn = associationOverride.joinColumns().next();
- assertEquals("FOO", ormJoinColumn.getSpecifiedName());
- assertEquals("REFERENCE", ormJoinColumn.getSpecifiedReferencedColumnName());
- assertEquals("BAR", ormJoinColumn.getSpecifiedTable());
- assertEquals("COLUMN_DEF", ormJoinColumn.getColumnDefinition());
- assertEquals(Boolean.FALSE, ormJoinColumn.getSpecifiedInsertable());
- assertEquals(Boolean.FALSE, ormJoinColumn.getSpecifiedUpdatable());
- assertEquals(Boolean.TRUE, ormJoinColumn.getSpecifiedUnique());
- assertEquals(Boolean.FALSE, ormJoinColumn.getSpecifiedNullable());
-
-
- associationOverride = entity.virtualAssociationOverrides().next();
- associationOverride = entity.virtualAssociationOverrides().next();
- assertEquals("manyToOne", associationOverride.getName());
- ormJoinColumn = associationOverride.joinColumns().next();
- assertEquals("MY_NAME", ormJoinColumn.getSpecifiedName());
- assertEquals("MY_REFERNCE_NAME", ormJoinColumn.getSpecifiedReferencedColumnName());
- assertEquals("BAR2", ormJoinColumn.getSpecifiedTable());
- assertEquals("COLUMN_DEF2", ormJoinColumn.getColumnDefinition());
- assertEquals(Boolean.FALSE, ormJoinColumn.getSpecifiedInsertable());
- assertEquals(Boolean.FALSE, ormJoinColumn.getSpecifiedUpdatable());
- assertEquals(Boolean.TRUE, ormJoinColumn.getSpecifiedUnique());
- assertEquals(Boolean.FALSE, ormJoinColumn.getSpecifiedNullable());
- }
-//TODO
-// public void testVirtualAssociationOverridesNoJavaEntity() throws Exception {
-// createTestMappedSuperclass();
-// createTestSubType();
-// OrmPersistentType persistentType = getEntityMappings().addPersistentType(MappingKeys.ENTITY_TYPE_MAPPING_KEY, FULLY_QUALIFIED_CHILD_TYPE_NAME);
-// OrmPersistentType persistentType2 = getEntityMappings().addPersistentType(MappingKeys.MAPPED_SUPERCLASS_TYPE_MAPPING_KEY, FULLY_QUALIFIED_TYPE_NAME);
-//
-// persistentType.getJavaPersistentType().setMappingKey(MappingKeys.NULL_TYPE_MAPPING_KEY);
-// persistentType2.getJavaPersistentType().setMappingKey(MappingKeys.NULL_TYPE_MAPPING_KEY);
-//
-// persistentType2.getAttributeNamed("oneToOne").setSpecifiedMappingKey(MappingKeys.ONE_TO_ONE_ATTRIBUTE_MAPPING_KEY);
-// persistentType2.getAttributeNamed("manyToOne").setSpecifiedMappingKey(MappingKeys.MANY_TO_ONE_ATTRIBUTE_MAPPING_KEY);
-//
-// OrmEntity entity = (OrmEntity) persistentType.getMapping();
-//
-// assertEquals(2, entity.virtualAssociationOverridesSize());
-// ListIterator<OrmAssociationOverride> virtualAssociationOverrides = entity.virtualAssociationOverrides();
-// OrmAssociationOverride associationOverride = virtualAssociationOverrides.next();
-// assertEquals("oneToOne", associationOverride.getName());
-// assertEquals(1, associationOverride.joinColumnsSize());
-// OrmJoinColumn joinColumn = associationOverride.joinColumns().next();
-// assertEquals("oneToOne_id", joinColumn.getName());
-// assertEquals("id", joinColumn.getReferencedColumnName());
-// assertEquals(CHILD_TYPE_NAME, joinColumn.getTable());
-// assertEquals(null, joinColumn.getColumnDefinition());
-// assertEquals(true, joinColumn.isInsertable());
-// assertEquals(true, joinColumn.isUpdatable());
-// assertEquals(false, joinColumn.isUnique());
-// assertEquals(true, joinColumn.isNullable());
-//
-//
-// associationOverride = virtualAssociationOverrides.next();
-// assertEquals("manyToOne", associationOverride.getName());
-// assertFalse(virtualAssociationOverrides.hasNext());
-//
-//
-// entity.virtualAssociationOverrides().next().setVirtual(false);
-//
-// assertEquals(1, entity.virtualAssociationOverridesSize());
-// virtualAssociationOverrides = entity.virtualAssociationOverrides();
-// associationOverride = virtualAssociationOverrides.next();
-// assertEquals("manyToOne", associationOverride.getName());
-//
-// entity.setSpecifiedMetadataComplete(Boolean.TRUE);
-// assertEquals(1, entity.virtualAssociationOverridesSize());
-// virtualAssociationOverrides = entity.virtualAssociationOverrides();
-// associationOverride = virtualAssociationOverrides.next();
-// assertEquals("manyToOne", associationOverride.getName());
-//
-// entity.specifiedAssociationOverrides().next().setVirtual(true);
-// entity.setSpecifiedMetadataComplete(Boolean.FALSE);
-// entity.getJavaEntity().virtualAssociationOverrides().next().setVirtual(false);
-// JavaAssociationOverride javaAssociationOverride = entity.getJavaEntity().specifiedAssociationOverrides().next();
-// JavaJoinColumn javaJoinColumn = javaAssociationOverride.addSpecifiedJoinColumn(0);
-// javaJoinColumn.setSpecifiedName("FOO");
-// javaJoinColumn.setSpecifiedReferencedColumnName("REFERENCE");
-// javaJoinColumn.setSpecifiedTable("BAR");
-// javaJoinColumn.setColumnDefinition("COLUMN_DEF");
-// javaJoinColumn.setSpecifiedInsertable(Boolean.FALSE);
-// javaJoinColumn.setSpecifiedUpdatable(Boolean.FALSE);
-// javaJoinColumn.setSpecifiedUnique(Boolean.TRUE);
-// javaJoinColumn.setSpecifiedNullable(Boolean.FALSE);
-//
-// assertEquals(2, entity.virtualAssociationOverridesSize());
-// virtualAssociationOverrides = entity.virtualAssociationOverrides();
-// associationOverride = virtualAssociationOverrides.next();
-// assertEquals("oneToOne", associationOverride.getName());
-// OrmJoinColumn ormJoinColumn = associationOverride.joinColumns().next();
-// assertEquals("FOO", ormJoinColumn.getSpecifiedName());
-// assertEquals("REFERENCE", ormJoinColumn.getSpecifiedReferencedColumnName());
-// assertEquals("BAR", ormJoinColumn.getSpecifiedTable());
-// assertEquals("COLUMN_DEF", ormJoinColumn.getColumnDefinition());
-// assertEquals(Boolean.FALSE, ormJoinColumn.getSpecifiedInsertable());
-// assertEquals(Boolean.FALSE, ormJoinColumn.getSpecifiedUpdatable());
-// assertEquals(Boolean.TRUE, ormJoinColumn.getSpecifiedUnique());
-// assertEquals(Boolean.FALSE, ormJoinColumn.getSpecifiedNullable());
-//
-// associationOverride = virtualAssociationOverrides.next();
-// assertEquals("manyToOne", associationOverride.getName());
-// assertEquals(null, associationOverride.joinColumns().next().getSpecifiedName());
-//
-// persistentType2.getAttributeNamed("manyToOne").makeSpecified();
-// OrmManyToOneMapping manyToOneMapping = (OrmManyToOneMapping) persistentType2.getAttributeNamed("manyToOne").getMapping();
-// joinColumn = manyToOneMapping.getRelationshipReference().getJoinColumnJoiningStrategy().addSpecifiedJoinColumn(0);
-// joinColumn.setSpecifiedName("MY_NAME");
-// joinColumn.setSpecifiedReferencedColumnName("MY_REFERNCE_NAME");
-// joinColumn.setSpecifiedTable("BAR2");
-// joinColumn.setColumnDefinition("COLUMN_DEF2");
-// joinColumn.setSpecifiedInsertable(Boolean.FALSE);
-// joinColumn.setSpecifiedUpdatable(Boolean.FALSE);
-// joinColumn.setSpecifiedUnique(Boolean.TRUE);
-// joinColumn.setSpecifiedNullable(Boolean.FALSE);
-//
-//
-//
-// assertEquals(2, entity.virtualAssociationOverridesSize());
-// virtualAssociationOverrides = entity.virtualAssociationOverrides();
-// assertEquals("oneToOne", associationOverride.getName());
-// ormJoinColumn = associationOverride.joinColumns().next();
-// assertEquals("FOO", ormJoinColumn.getSpecifiedName());
-// assertEquals("REFERENCE", ormJoinColumn.getSpecifiedReferencedColumnName());
-// assertEquals("BAR", ormJoinColumn.getSpecifiedTable());
-// assertEquals("COLUMN_DEF", ormJoinColumn.getColumnDefinition());
-// assertEquals(Boolean.FALSE, ormJoinColumn.getSpecifiedInsertable());
-// assertEquals(Boolean.FALSE, ormJoinColumn.getSpecifiedUpdatable());
-// assertEquals(Boolean.TRUE, ormJoinColumn.getSpecifiedUnique());
-// assertEquals(Boolean.FALSE, ormJoinColumn.getSpecifiedNullable());
-//
-//
-// associationOverride = entity.virtualAssociationOverrides().next();
-// associationOverride = entity.virtualAssociationOverrides().next();
-// assertEquals("manyToOne", associationOverride.getName());
-// ormJoinColumn = associationOverride.joinColumns().next();
-// assertEquals("MY_NAME", ormJoinColumn.getSpecifiedName());
-// assertEquals("MY_REFERNCE_NAME", ormJoinColumn.getSpecifiedReferencedColumnName());
-// assertEquals("BAR2", ormJoinColumn.getSpecifiedTable());
-// assertEquals("COLUMN_DEF2", ormJoinColumn.getColumnDefinition());
-// assertEquals(Boolean.FALSE, ormJoinColumn.getSpecifiedInsertable());
-// assertEquals(Boolean.FALSE, ormJoinColumn.getSpecifiedUpdatable());
-// assertEquals(Boolean.TRUE, ormJoinColumn.getSpecifiedUnique());
-// assertEquals(Boolean.FALSE, ormJoinColumn.getSpecifiedNullable());
-// }
-
- public void testAddNamedQuery() throws Exception {
- OrmPersistentType persistentType = getEntityMappings().addPersistentType(MappingKeys.ENTITY_TYPE_MAPPING_KEY, FULLY_QUALIFIED_TYPE_NAME);
- OrmEntity ormEntity = (OrmEntity) persistentType.getMapping();
- XmlEntity entityResource = getXmlEntityMappings().getEntities().get(0);
-
- OrmNamedQuery namedQuery = ormEntity.getQueryContainer().addNamedQuery(0);
- namedQuery.setName("FOO");
-
- assertEquals("FOO", entityResource.getNamedQueries().get(0).getName());
-
- OrmNamedQuery namedQuery2 = ormEntity.getQueryContainer().addNamedQuery(0);
- namedQuery2.setName("BAR");
-
- assertEquals("BAR", entityResource.getNamedQueries().get(0).getName());
- assertEquals("FOO", entityResource.getNamedQueries().get(1).getName());
-
- OrmNamedQuery namedQuery3 = ormEntity.getQueryContainer().addNamedQuery(1);
- namedQuery3.setName("BAZ");
-
- assertEquals("BAR", entityResource.getNamedQueries().get(0).getName());
- assertEquals("BAZ", entityResource.getNamedQueries().get(1).getName());
- assertEquals("FOO", entityResource.getNamedQueries().get(2).getName());
-
- ListIterator<OrmNamedQuery> namedQueries = ormEntity.getQueryContainer().namedQueries();
- assertEquals(namedQuery2, namedQueries.next());
- assertEquals(namedQuery3, namedQueries.next());
- assertEquals(namedQuery, namedQueries.next());
-
- namedQueries = ormEntity.getQueryContainer().namedQueries();
- assertEquals("BAR", namedQueries.next().getName());
- assertEquals("BAZ", namedQueries.next().getName());
- assertEquals("FOO", namedQueries.next().getName());
- }
-
- public void testRemoveNamedQuery() throws Exception {
- OrmPersistentType persistentType = getEntityMappings().addPersistentType(MappingKeys.ENTITY_TYPE_MAPPING_KEY, FULLY_QUALIFIED_TYPE_NAME);
- OrmEntity ormEntity = (OrmEntity) persistentType.getMapping();
-
- ormEntity.getQueryContainer().addNamedQuery(0).setName("FOO");
- ormEntity.getQueryContainer().addNamedQuery(1).setName("BAR");
- ormEntity.getQueryContainer().addNamedQuery(2).setName("BAZ");
-
- XmlEntity entityResource = getXmlEntityMappings().getEntities().get(0);
- assertEquals(3, entityResource.getNamedQueries().size());
-
- ormEntity.getQueryContainer().removeNamedQuery(0);
- assertEquals(2, entityResource.getNamedQueries().size());
- assertEquals("BAR", entityResource.getNamedQueries().get(0).getName());
- assertEquals("BAZ", entityResource.getNamedQueries().get(1).getName());
-
- ormEntity.getQueryContainer().removeNamedQuery(0);
- assertEquals(1, entityResource.getNamedQueries().size());
- assertEquals("BAZ", entityResource.getNamedQueries().get(0).getName());
-
- ormEntity.getQueryContainer().removeNamedQuery(0);
- assertEquals(0, entityResource.getNamedQueries().size());
- }
-
- public void testMoveNamedQuery() throws Exception {
- OrmPersistentType persistentType = getEntityMappings().addPersistentType(MappingKeys.ENTITY_TYPE_MAPPING_KEY, FULLY_QUALIFIED_TYPE_NAME);
- OrmEntity ormEntity = (OrmEntity) persistentType.getMapping();
-
- ormEntity.getQueryContainer().addNamedQuery(0).setName("FOO");
- ormEntity.getQueryContainer().addNamedQuery(1).setName("BAR");
- ormEntity.getQueryContainer().addNamedQuery(2).setName("BAZ");
-
- XmlEntity entityResource = getXmlEntityMappings().getEntities().get(0);
- assertEquals(3, entityResource.getNamedQueries().size());
-
-
- ormEntity.getQueryContainer().moveNamedQuery(2, 0);
- ListIterator<OrmNamedQuery> namedQueries = ormEntity.getQueryContainer().namedQueries();
- assertEquals("BAR", namedQueries.next().getName());
- assertEquals("BAZ", namedQueries.next().getName());
- assertEquals("FOO", namedQueries.next().getName());
-
- assertEquals("BAR", entityResource.getNamedQueries().get(0).getName());
- assertEquals("BAZ", entityResource.getNamedQueries().get(1).getName());
- assertEquals("FOO", entityResource.getNamedQueries().get(2).getName());
-
-
- ormEntity.getQueryContainer().moveNamedQuery(0, 1);
- namedQueries = ormEntity.getQueryContainer().namedQueries();
- assertEquals("BAZ", namedQueries.next().getName());
- assertEquals("BAR", namedQueries.next().getName());
- assertEquals("FOO", namedQueries.next().getName());
-
- assertEquals("BAZ", entityResource.getNamedQueries().get(0).getName());
- assertEquals("BAR", entityResource.getNamedQueries().get(1).getName());
- assertEquals("FOO", entityResource.getNamedQueries().get(2).getName());
- }
-
- public void testUpdateNamedQueries() throws Exception {
- OrmPersistentType persistentType = getEntityMappings().addPersistentType(MappingKeys.ENTITY_TYPE_MAPPING_KEY, FULLY_QUALIFIED_TYPE_NAME);
- OrmEntity ormEntity = (OrmEntity) persistentType.getMapping();
-
- assertEquals(0, ormEntity.getPersistenceUnit().queriesSize());
-
- XmlEntity entityResource = getXmlEntityMappings().getEntities().get(0);
- entityResource.getNamedQueries().add(OrmFactory.eINSTANCE.createXmlNamedQuery());
- entityResource.getNamedQueries().add(OrmFactory.eINSTANCE.createXmlNamedQuery());
- entityResource.getNamedQueries().add(OrmFactory.eINSTANCE.createXmlNamedQuery());
- entityResource.getNamedQueries().get(0).setName("FOO");
- entityResource.getNamedQueries().get(1).setName("BAR");
- entityResource.getNamedQueries().get(2).setName("BAZ");
-
- ListIterator<OrmNamedQuery> namedQueries = ormEntity.getQueryContainer().namedQueries();
- assertEquals("FOO", namedQueries.next().getName());
- assertEquals("BAR", namedQueries.next().getName());
- assertEquals("BAZ", namedQueries.next().getName());
- assertFalse(namedQueries.hasNext());
- assertEquals(3, ormEntity.getPersistenceUnit().queriesSize());
-
- entityResource.getNamedQueries().move(2, 0);
- namedQueries = ormEntity.getQueryContainer().namedQueries();
- assertEquals("BAR", namedQueries.next().getName());
- assertEquals("BAZ", namedQueries.next().getName());
- assertEquals("FOO", namedQueries.next().getName());
- assertFalse(namedQueries.hasNext());
-
- entityResource.getNamedQueries().move(0, 1);
- namedQueries = ormEntity.getQueryContainer().namedQueries();
- assertEquals("BAZ", namedQueries.next().getName());
- assertEquals("BAR", namedQueries.next().getName());
- assertEquals("FOO", namedQueries.next().getName());
- assertFalse(namedQueries.hasNext());
-
- entityResource.getNamedQueries().remove(1);
- namedQueries = ormEntity.getQueryContainer().namedQueries();
- assertEquals("BAZ", namedQueries.next().getName());
- assertEquals("FOO", namedQueries.next().getName());
- assertFalse(namedQueries.hasNext());
- assertEquals(2, ormEntity.getPersistenceUnit().queriesSize());
-
- entityResource.getNamedQueries().remove(1);
- namedQueries = ormEntity.getQueryContainer().namedQueries();
- assertEquals("BAZ", namedQueries.next().getName());
- assertFalse(namedQueries.hasNext());
- assertEquals(1, ormEntity.getPersistenceUnit().queriesSize());
-
- entityResource.getNamedQueries().remove(0);
- assertFalse(ormEntity.getQueryContainer().namedQueries().hasNext());
- assertEquals(0, ormEntity.getPersistenceUnit().queriesSize());
- }
-
- public void testAddNamedNativeQuery() throws Exception {
- OrmPersistentType persistentType = getEntityMappings().addPersistentType(MappingKeys.ENTITY_TYPE_MAPPING_KEY, FULLY_QUALIFIED_TYPE_NAME);
- OrmEntity ormEntity = (OrmEntity) persistentType.getMapping();
- XmlEntity entityResource = getXmlEntityMappings().getEntities().get(0);
-
- OrmNamedNativeQuery namedNativeQuery = ormEntity.getQueryContainer().addNamedNativeQuery(0);
- namedNativeQuery.setName("FOO");
-
- assertEquals("FOO", entityResource.getNamedNativeQueries().get(0).getName());
-
- OrmNamedNativeQuery namedNativeQuery2 = ormEntity.getQueryContainer().addNamedNativeQuery(0);
- namedNativeQuery2.setName("BAR");
-
- assertEquals("BAR", entityResource.getNamedNativeQueries().get(0).getName());
- assertEquals("FOO", entityResource.getNamedNativeQueries().get(1).getName());
-
- OrmNamedNativeQuery namedNativeQuery3 = ormEntity.getQueryContainer().addNamedNativeQuery(1);
- namedNativeQuery3.setName("BAZ");
-
- assertEquals("BAR", entityResource.getNamedNativeQueries().get(0).getName());
- assertEquals("BAZ", entityResource.getNamedNativeQueries().get(1).getName());
- assertEquals("FOO", entityResource.getNamedNativeQueries().get(2).getName());
-
- ListIterator<OrmNamedNativeQuery> namedNativeQueries = ormEntity.getQueryContainer().namedNativeQueries();
- assertEquals(namedNativeQuery2, namedNativeQueries.next());
- assertEquals(namedNativeQuery3, namedNativeQueries.next());
- assertEquals(namedNativeQuery, namedNativeQueries.next());
-
- namedNativeQueries = ormEntity.getQueryContainer().namedNativeQueries();
- assertEquals("BAR", namedNativeQueries.next().getName());
- assertEquals("BAZ", namedNativeQueries.next().getName());
- assertEquals("FOO", namedNativeQueries.next().getName());
- }
-
- public void testRemoveNamedNativeQuery() throws Exception {
- OrmPersistentType persistentType = getEntityMappings().addPersistentType(MappingKeys.ENTITY_TYPE_MAPPING_KEY, FULLY_QUALIFIED_TYPE_NAME);
- OrmEntity ormEntity = (OrmEntity) persistentType.getMapping();
-
- ormEntity.getQueryContainer().addNamedNativeQuery(0).setName("FOO");
- ormEntity.getQueryContainer().addNamedNativeQuery(1).setName("BAR");
- ormEntity.getQueryContainer().addNamedNativeQuery(2).setName("BAZ");
-
- XmlEntity entityResource = getXmlEntityMappings().getEntities().get(0);
- assertEquals(3, entityResource.getNamedNativeQueries().size());
-
- ormEntity.getQueryContainer().removeNamedNativeQuery(0);
- assertEquals(2, entityResource.getNamedNativeQueries().size());
- assertEquals("BAR", entityResource.getNamedNativeQueries().get(0).getName());
- assertEquals("BAZ", entityResource.getNamedNativeQueries().get(1).getName());
-
- ormEntity.getQueryContainer().removeNamedNativeQuery(0);
- assertEquals(1, entityResource.getNamedNativeQueries().size());
- assertEquals("BAZ", entityResource.getNamedNativeQueries().get(0).getName());
-
- ormEntity.getQueryContainer().removeNamedNativeQuery(0);
- assertEquals(0, entityResource.getNamedNativeQueries().size());
- }
-
- public void testMoveNamedNativeQuery() throws Exception {
- OrmPersistentType persistentType = getEntityMappings().addPersistentType(MappingKeys.ENTITY_TYPE_MAPPING_KEY, FULLY_QUALIFIED_TYPE_NAME);
- OrmEntity ormEntity = (OrmEntity) persistentType.getMapping();
-
- ormEntity.getQueryContainer().addNamedNativeQuery(0).setName("FOO");
- ormEntity.getQueryContainer().addNamedNativeQuery(1).setName("BAR");
- ormEntity.getQueryContainer().addNamedNativeQuery(2).setName("BAZ");
-
- XmlEntity entityResource = getXmlEntityMappings().getEntities().get(0);
- assertEquals(3, entityResource.getNamedNativeQueries().size());
-
-
- ormEntity.getQueryContainer().moveNamedNativeQuery(2, 0);
- ListIterator<OrmNamedNativeQuery> namedNativeQueries = ormEntity.getQueryContainer().namedNativeQueries();
- assertEquals("BAR", namedNativeQueries.next().getName());
- assertEquals("BAZ", namedNativeQueries.next().getName());
- assertEquals("FOO", namedNativeQueries.next().getName());
-
- assertEquals("BAR", entityResource.getNamedNativeQueries().get(0).getName());
- assertEquals("BAZ", entityResource.getNamedNativeQueries().get(1).getName());
- assertEquals("FOO", entityResource.getNamedNativeQueries().get(2).getName());
-
-
- ormEntity.getQueryContainer().moveNamedNativeQuery(0, 1);
- namedNativeQueries = ormEntity.getQueryContainer().namedNativeQueries();
- assertEquals("BAZ", namedNativeQueries.next().getName());
- assertEquals("BAR", namedNativeQueries.next().getName());
- assertEquals("FOO", namedNativeQueries.next().getName());
-
- assertEquals("BAZ", entityResource.getNamedNativeQueries().get(0).getName());
- assertEquals("BAR", entityResource.getNamedNativeQueries().get(1).getName());
- assertEquals("FOO", entityResource.getNamedNativeQueries().get(2).getName());
- }
-
- public void testUpdateNamedNativeQueries() throws Exception {
- OrmPersistentType persistentType = getEntityMappings().addPersistentType(MappingKeys.ENTITY_TYPE_MAPPING_KEY, FULLY_QUALIFIED_TYPE_NAME);
- OrmEntity ormEntity = (OrmEntity) persistentType.getMapping();
-
- assertEquals(0, ormEntity.getPersistenceUnit().queriesSize());
-
- XmlEntity entityResource = getXmlEntityMappings().getEntities().get(0);
- entityResource.getNamedNativeQueries().add(OrmFactory.eINSTANCE.createXmlNamedNativeQuery());
- entityResource.getNamedNativeQueries().add(OrmFactory.eINSTANCE.createXmlNamedNativeQuery());
- entityResource.getNamedNativeQueries().add(OrmFactory.eINSTANCE.createXmlNamedNativeQuery());
- entityResource.getNamedNativeQueries().get(0).setName("FOO");
- entityResource.getNamedNativeQueries().get(1).setName("BAR");
- entityResource.getNamedNativeQueries().get(2).setName("BAZ");
- ListIterator<OrmNamedNativeQuery> namedNativeQueries = ormEntity.getQueryContainer().namedNativeQueries();
- assertEquals("FOO", namedNativeQueries.next().getName());
- assertEquals("BAR", namedNativeQueries.next().getName());
- assertEquals("BAZ", namedNativeQueries.next().getName());
- assertFalse(namedNativeQueries.hasNext());
- assertEquals(3, ormEntity.getPersistenceUnit().queriesSize());
-
- entityResource.getNamedNativeQueries().move(2, 0);
- namedNativeQueries = ormEntity.getQueryContainer().namedNativeQueries();
- assertEquals("BAR", namedNativeQueries.next().getName());
- assertEquals("BAZ", namedNativeQueries.next().getName());
- assertEquals("FOO", namedNativeQueries.next().getName());
- assertFalse(namedNativeQueries.hasNext());
-
- entityResource.getNamedNativeQueries().move(0, 1);
- namedNativeQueries = ormEntity.getQueryContainer().namedNativeQueries();
- assertEquals("BAZ", namedNativeQueries.next().getName());
- assertEquals("BAR", namedNativeQueries.next().getName());
- assertEquals("FOO", namedNativeQueries.next().getName());
- assertFalse(namedNativeQueries.hasNext());
-
- entityResource.getNamedNativeQueries().remove(1);
- namedNativeQueries = ormEntity.getQueryContainer().namedNativeQueries();
- assertEquals("BAZ", namedNativeQueries.next().getName());
- assertEquals("FOO", namedNativeQueries.next().getName());
- assertFalse(namedNativeQueries.hasNext());
- assertEquals(2, ormEntity.getPersistenceUnit().queriesSize());
-
- entityResource.getNamedNativeQueries().remove(1);
- namedNativeQueries = ormEntity.getQueryContainer().namedNativeQueries();
- assertEquals("BAZ", namedNativeQueries.next().getName());
- assertFalse(namedNativeQueries.hasNext());
- assertEquals(1, ormEntity.getPersistenceUnit().queriesSize());
-
- entityResource.getNamedNativeQueries().remove(0);
- assertFalse(ormEntity.getQueryContainer().namedNativeQueries().hasNext());
- assertEquals(0, ormEntity.getPersistenceUnit().queriesSize());
- }
-
- public void testUpdateIdClass() throws Exception {
- OrmPersistentType persistentType = getEntityMappings().addPersistentType(MappingKeys.ENTITY_TYPE_MAPPING_KEY, FULLY_QUALIFIED_TYPE_NAME);
- OrmEntity ormEntity = (OrmEntity) persistentType.getMapping();
-
- XmlEntity entityResource = getXmlEntityMappings().getEntities().get(0);
-
- assertNull(ormEntity.getIdClass());
- assertNull(entityResource.getIdClass());
-
- entityResource.setIdClass(OrmFactory.eINSTANCE.createXmlIdClass());
-
- assertNull(ormEntity.getIdClass());
- assertNotNull(entityResource.getIdClass());
-
- entityResource.getIdClass().setClassName("model.Foo");
- assertEquals("model.Foo", ormEntity.getIdClass());
- assertEquals("model.Foo", entityResource.getIdClass().getClassName());
-
- //test setting @IdClass value to null, id-class tag is not removed
- entityResource.getIdClass().setClassName(null);
- assertNull(ormEntity.getIdClass());
- assertNotNull(entityResource.getIdClass());
-
- //reset @IdClass value and then remove id-class tag
- entityResource.setIdClass(OrmFactory.eINSTANCE.createXmlIdClass());
- entityResource.getIdClass().setClassName("model.Foo");
- entityResource.setIdClass(null);
-
- assertNull(ormEntity.getIdClass());
- assertNull(entityResource.getIdClass());
- }
-
- public void testModifyIdClass() throws Exception {
- OrmPersistentType persistentType = getEntityMappings().addPersistentType(MappingKeys.ENTITY_TYPE_MAPPING_KEY, FULLY_QUALIFIED_TYPE_NAME);
- OrmEntity ormEntity = (OrmEntity) persistentType.getMapping();
-
- XmlEntity entityResource = getXmlEntityMappings().getEntities().get(0);
-
- assertNull(ormEntity.getIdClass());
- assertNull(entityResource.getIdClass());
-
- ormEntity.setIdClass("model.Foo");
- assertEquals("model.Foo", entityResource.getIdClass().getClassName());
- assertEquals("model.Foo", ormEntity.getIdClass());
-
- ormEntity.setIdClass(null);
- assertNull(ormEntity.getIdClass());
- assertNull(entityResource.getIdClass());
- }
-
-
- public void testGetPrimaryKeyColumnNameWithAttributeOverride() throws Exception {
- createTestMappedSuperclass();
- createTestSubType();
- OrmPersistentType parentPersistentType = getEntityMappings().addPersistentType(MappingKeys.MAPPED_SUPERCLASS_TYPE_MAPPING_KEY, FULLY_QUALIFIED_TYPE_NAME);
- OrmPersistentType childPersistentType = getEntityMappings().addPersistentType(MappingKeys.ENTITY_TYPE_MAPPING_KEY, PACKAGE_NAME + ".AnnotationTestTypeChild");
- OrmEntity childXmlEntity = (OrmEntity) childPersistentType.getMapping();
-
- parentPersistentType.getAttributeNamed("id").makeSpecified(MappingKeys.ID_ATTRIBUTE_MAPPING_KEY);
- assertEquals("id", childXmlEntity.getPrimaryKeyColumnName());
-
- ((OrmIdMapping) parentPersistentType.getAttributeNamed("id").getMapping()).getColumn().setSpecifiedName("MY_ID");
- assertEquals("MY_ID", childXmlEntity.getPrimaryKeyColumnName());
-
- //TODO once bug 228718 is fixed
- OrmAttributeOverride ormAttributeOverride = childXmlEntity.virtualAttributeOverrides().next();
- assertEquals("id", ormAttributeOverride.getName());
-
- ormAttributeOverride = (OrmAttributeOverride) ormAttributeOverride.setVirtual(false);
- ormAttributeOverride.getColumn().setSpecifiedName("ID");
- assertEquals("ID", childXmlEntity.getPrimaryKeyColumnName());
- }
-
-
- public void testDiscriminatorValueIsUndefinedConcreteClass() throws Exception {
- createTestType();
- OrmPersistentType persistentType = getEntityMappings().addPersistentType(MappingKeys.ENTITY_TYPE_MAPPING_KEY, FULLY_QUALIFIED_TYPE_NAME);
- OrmEntity entity = (OrmEntity) persistentType.getMapping();
- assertTrue(entity.discriminatorValueIsUndefined());
-
- createTestSubType();
- getEntityMappings().addPersistentType(MappingKeys.ENTITY_TYPE_MAPPING_KEY, FULLY_QUALIFIED_CHILD_TYPE_NAME);
- assertFalse(entity.discriminatorValueIsUndefined());
- }
-
- public void testDiscriminatorValueIsAllowedAbstractClass() throws Exception {
- createTestAbstractType();
- OrmPersistentType persistentType = getEntityMappings().addPersistentType(MappingKeys.ENTITY_TYPE_MAPPING_KEY, FULLY_QUALIFIED_TYPE_NAME);
- OrmEntity entity = (OrmEntity) persistentType.getMapping();
- assertTrue(entity.discriminatorValueIsUndefined());
-
- createTestSubType();
- getEntityMappings().addPersistentType(MappingKeys.ENTITY_TYPE_MAPPING_KEY, FULLY_QUALIFIED_CHILD_TYPE_NAME);
- assertTrue(entity.discriminatorValueIsUndefined());
- }
-
- public void testDiscriminatorColumnIsAllowed() throws Exception {
- createAbstractTestEntity();
- createTestSubType();
- OrmPersistentType concretePersistentType = getEntityMappings().addPersistentType(MappingKeys.ENTITY_TYPE_MAPPING_KEY, PACKAGE_NAME + ".AnnotationTestTypeChild");
- OrmPersistentType abstractPersistentType = getEntityMappings().addPersistentType(MappingKeys.ENTITY_TYPE_MAPPING_KEY, FULLY_QUALIFIED_TYPE_NAME);
-
- Entity concreteEntity = (Entity) concretePersistentType.getMapping();
- assertEquals("AnnotationTestTypeChild", concreteEntity.getName());
-
- Entity abstractEntity = (Entity) abstractPersistentType.getMapping();
- assertEquals(TYPE_NAME, abstractEntity.getName());
-
-
- //table-per-class, no discriminator column allowed
- assertFalse(concreteEntity.specifiedDiscriminatorColumnIsAllowed());
- assertFalse(abstractEntity.specifiedDiscriminatorColumnIsAllowed());
-
-
- //single-table, discriminator column allowed on root entity
- ((JavaEntity) abstractPersistentType.getJavaPersistentType().getMapping()).setSpecifiedInheritanceStrategy(null);
- assertFalse(concreteEntity.specifiedDiscriminatorColumnIsAllowed());
- assertTrue(abstractEntity.specifiedDiscriminatorColumnIsAllowed());
- }
-
- public void testAbstractEntityGetDefaultDiscriminatorColumnNameTablePerClassInheritance() throws Exception {
- createAbstractTestEntity();
- createTestSubType();
-
- OrmPersistentType concretePersistentType = getEntityMappings().addPersistentType(MappingKeys.ENTITY_TYPE_MAPPING_KEY, PACKAGE_NAME + ".AnnotationTestTypeChild");
- OrmPersistentType abstractPersistentType = getEntityMappings().addPersistentType(MappingKeys.ENTITY_TYPE_MAPPING_KEY, FULLY_QUALIFIED_TYPE_NAME);
-
- Entity concreteEntity = (Entity) concretePersistentType.getMapping();
- assertEquals("AnnotationTestTypeChild", concreteEntity.getName());
-
- Entity abstractEntity = (Entity) abstractPersistentType.getMapping();
- assertEquals(TYPE_NAME, abstractEntity.getName());
-
-
- assertEquals(null, abstractEntity.getSpecifiedInheritanceStrategy());
- assertEquals(null, concreteEntity.getSpecifiedInheritanceStrategy());
- assertEquals(InheritanceType.TABLE_PER_CLASS, abstractEntity.getDefaultInheritanceStrategy());
- assertEquals(InheritanceType.TABLE_PER_CLASS, concreteEntity.getDefaultInheritanceStrategy());
-
-
- assertTrue(abstractEntity.discriminatorValueIsUndefined());
- assertFalse(concreteEntity.specifiedDiscriminatorColumnIsAllowed());
- assertEquals(null, abstractEntity.getDiscriminatorColumn().getDefaultName());
- assertEquals(null, concreteEntity.getDiscriminatorColumn().getDefaultName());
-
- assertTrue(abstractEntity.discriminatorValueIsUndefined());
- assertEquals(null, abstractEntity.getDefaultDiscriminatorValue());
- assertTrue(concreteEntity.discriminatorValueIsUndefined());
- assertEquals(null, concreteEntity.getDefaultDiscriminatorValue());
- }
-} \ No newline at end of file
diff --git a/jpa/tests/org.eclipse.jpt.core.tests/src/org/eclipse/jpt/core/tests/internal/context/orm/OrmGeneratedValueTests.java b/jpa/tests/org.eclipse.jpt.core.tests/src/org/eclipse/jpt/core/tests/internal/context/orm/OrmGeneratedValueTests.java
deleted file mode 100644
index ebcc7e5a10..0000000000
--- a/jpa/tests/org.eclipse.jpt.core.tests/src/org/eclipse/jpt/core/tests/internal/context/orm/OrmGeneratedValueTests.java
+++ /dev/null
@@ -1,135 +0,0 @@
-/*******************************************************************************
- * Copyright (c) 2007, 2009 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.
- *
- * Contributors:
- * Oracle - initial API and implementation
- ******************************************************************************/
-package org.eclipse.jpt.core.tests.internal.context.orm;
-
-import java.util.Iterator;
-import org.eclipse.jdt.core.ICompilationUnit;
-import org.eclipse.jpt.core.JptCorePlugin;
-import org.eclipse.jpt.core.MappingKeys;
-import org.eclipse.jpt.core.context.GeneratedValue;
-import org.eclipse.jpt.core.context.GenerationType;
-import org.eclipse.jpt.core.context.IdMapping;
-import org.eclipse.jpt.core.context.orm.OrmGeneratedValue;
-import org.eclipse.jpt.core.context.orm.OrmIdMapping;
-import org.eclipse.jpt.core.context.orm.OrmPersistentAttribute;
-import org.eclipse.jpt.core.context.orm.OrmPersistentType;
-import org.eclipse.jpt.core.resource.java.JPA;
-import org.eclipse.jpt.core.resource.orm.XmlGeneratedValue;
-import org.eclipse.jpt.core.resource.orm.XmlId;
-import org.eclipse.jpt.core.resource.persistence.PersistenceFactory;
-import org.eclipse.jpt.core.resource.persistence.XmlMappingFileRef;
-import org.eclipse.jpt.core.tests.internal.context.ContextModelTestCase;
-import org.eclipse.jpt.utility.internal.iterators.ArrayIterator;
-
-
-@SuppressWarnings("nls")public class OrmGeneratedValueTests extends ContextModelTestCase
-{
- public OrmGeneratedValueTests(String name) {
- super(name);
- }
-
- @Override
- protected void setUp() throws Exception {
- super.setUp();
- XmlMappingFileRef mappingFileRef = PersistenceFactory.eINSTANCE.createXmlMappingFileRef();
- mappingFileRef.setFileName(JptCorePlugin.DEFAULT_ORM_XML_FILE_PATH);
- getXmlPersistenceUnit().getMappingFiles().add(mappingFileRef);
- getPersistenceXmlResource().save(null);
- }
-
- private ICompilationUnit createTestEntity() 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("@Id");
- }
- });
- }
-
- public void testUpdateSpecifiedName() throws Exception {
- OrmPersistentType ormPersistentType = getEntityMappings().addPersistentType(MappingKeys.ENTITY_TYPE_MAPPING_KEY, "model.Foo");
- OrmPersistentAttribute ormPersistentAttribute = ormPersistentType.addSpecifiedPersistentAttribute(MappingKeys.ID_ATTRIBUTE_MAPPING_KEY, "idMapping");
- OrmIdMapping ormIdMapping = (OrmIdMapping) ormPersistentAttribute.getMapping();
- OrmGeneratedValue ormGeneratedValue = ormIdMapping.addGeneratedValue();
- XmlId idResource = getXmlEntityMappings().getEntities().get(0).getAttributes().getIds().get(0);
- XmlGeneratedValue generatedValueResource = idResource.getGeneratedValue();
-
- //set generator in the resource model, verify context model updated
- generatedValueResource.setGenerator("FOO");
- assertEquals("FOO", ormGeneratedValue.getSpecifiedGenerator());
- assertEquals("FOO", generatedValueResource.getGenerator());
-
- //set name to null in the resource model
- generatedValueResource.setGenerator(null);
- assertNull(ormGeneratedValue.getSpecifiedGenerator());
- assertNull(generatedValueResource.getGenerator());
- }
-
- public void testModifySpecifiedName() throws Exception {
- OrmPersistentType ormPersistentType = getEntityMappings().addPersistentType(MappingKeys.ENTITY_TYPE_MAPPING_KEY, "model.Foo");
- OrmPersistentAttribute ormPersistentAttribute = ormPersistentType.addSpecifiedPersistentAttribute(MappingKeys.ID_ATTRIBUTE_MAPPING_KEY, "idMapping");
- OrmIdMapping ormIdMapping = (OrmIdMapping) ormPersistentAttribute.getMapping();
- OrmGeneratedValue ormGeneratedValue = ormIdMapping.addGeneratedValue();
- XmlId idResource = getXmlEntityMappings().getEntities().get(0).getAttributes().getIds().get(0);
- XmlGeneratedValue generatedValueResource = idResource.getGeneratedValue();
-
- //set name in the context model, verify resource model modified
- ormGeneratedValue.setSpecifiedGenerator("FOO");
- assertEquals("FOO", generatedValueResource.getGenerator());
- assertEquals("FOO", ormGeneratedValue.getSpecifiedGenerator());
-
- //set name to null in the context model
- ormGeneratedValue.setSpecifiedGenerator(null);
- assertNull(generatedValueResource.getGenerator());
- assertNull(ormGeneratedValue.getSpecifiedGenerator());
- }
-
- public void testDefaultsFromJava() throws Exception {
- createTestEntity();
- OrmPersistentType ormPersistentType = getEntityMappings().addPersistentType(MappingKeys.ENTITY_TYPE_MAPPING_KEY, FULLY_QUALIFIED_TYPE_NAME);
-
- OrmPersistentAttribute ormIdAttribute = ormPersistentType.virtualAttributes().next();
- IdMapping ormIdMapping = (IdMapping) ormIdAttribute.getMapping();
- assertEquals(null, ormIdMapping.getGeneratedValue());
-
- IdMapping javaIdMapping = (IdMapping) ormPersistentType.getJavaPersistentType().attributes().next().getMapping();
- GeneratedValue javaGeneratedValue = javaIdMapping.addGeneratedValue();
- javaGeneratedValue.setSpecifiedGenerator("Foo");
- javaGeneratedValue.setSpecifiedStrategy(GenerationType.SEQUENCE);
-
- assertEquals("Foo", ormIdMapping.getGeneratedValue().getSpecifiedGenerator());
- assertEquals(GenerationType.SEQUENCE, ormIdMapping.getGeneratedValue().getSpecifiedStrategy());
- assertEquals("Foo", javaGeneratedValue.getSpecifiedGenerator());
- assertEquals(GenerationType.SEQUENCE, javaGeneratedValue.getSpecifiedStrategy());
-
- ormIdAttribute.makeSpecified();
- ormIdAttribute = ormPersistentType.specifiedAttributes().next();
- ormIdMapping = (IdMapping) ormIdAttribute.getMapping();
- assertEquals(null, ormIdMapping.getGeneratedValue());
- assertEquals("Foo", javaGeneratedValue.getSpecifiedGenerator());
- assertEquals(GenerationType.SEQUENCE, javaGeneratedValue.getSpecifiedStrategy());
-
- ormIdAttribute.makeVirtual();
- ormIdAttribute = ormPersistentType.virtualAttributes().next();
- ormIdMapping = (IdMapping) ormIdAttribute.getMapping();
- assertEquals("Foo", ormIdMapping.getGeneratedValue().getSpecifiedGenerator());
- assertEquals(GenerationType.SEQUENCE, ormIdMapping.getGeneratedValue().getSpecifiedStrategy());
- assertEquals("Foo", javaGeneratedValue.getSpecifiedGenerator());
- assertEquals(GenerationType.SEQUENCE, javaGeneratedValue.getSpecifiedStrategy());
- }
-} \ No newline at end of file
diff --git a/jpa/tests/org.eclipse.jpt.core.tests/src/org/eclipse/jpt/core/tests/internal/context/orm/OrmIdMappingTests.java b/jpa/tests/org.eclipse.jpt.core.tests/src/org/eclipse/jpt/core/tests/internal/context/orm/OrmIdMappingTests.java
deleted file mode 100644
index f731478488..0000000000
--- a/jpa/tests/org.eclipse.jpt.core.tests/src/org/eclipse/jpt/core/tests/internal/context/orm/OrmIdMappingTests.java
+++ /dev/null
@@ -1,744 +0,0 @@
-/*******************************************************************************
- * Copyright (c) 2007, 2009 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.
- *
- * Contributors:
- * Oracle - initial API and implementation
- ******************************************************************************/
-package org.eclipse.jpt.core.tests.internal.context.orm;
-
-import java.util.Iterator;
-import org.eclipse.jdt.core.ICompilationUnit;
-import org.eclipse.jpt.core.JptCorePlugin;
-import org.eclipse.jpt.core.MappingKeys;
-import org.eclipse.jpt.core.context.BasicMapping;
-import org.eclipse.jpt.core.context.Converter;
-import org.eclipse.jpt.core.context.EmbeddedIdMapping;
-import org.eclipse.jpt.core.context.EmbeddedMapping;
-import org.eclipse.jpt.core.context.GenerationType;
-import org.eclipse.jpt.core.context.IdMapping;
-import org.eclipse.jpt.core.context.ManyToManyMapping;
-import org.eclipse.jpt.core.context.ManyToOneMapping;
-import org.eclipse.jpt.core.context.OneToManyMapping;
-import org.eclipse.jpt.core.context.OneToOneMapping;
-import org.eclipse.jpt.core.context.TemporalConverter;
-import org.eclipse.jpt.core.context.TemporalType;
-import org.eclipse.jpt.core.context.TransientMapping;
-import org.eclipse.jpt.core.context.VersionMapping;
-import org.eclipse.jpt.core.context.orm.OrmColumn;
-import org.eclipse.jpt.core.context.orm.OrmGeneratedValue;
-import org.eclipse.jpt.core.context.orm.OrmIdMapping;
-import org.eclipse.jpt.core.context.orm.OrmPersistentAttribute;
-import org.eclipse.jpt.core.context.orm.OrmPersistentType;
-import org.eclipse.jpt.core.context.orm.OrmSequenceGenerator;
-import org.eclipse.jpt.core.context.orm.OrmTableGenerator;
-import org.eclipse.jpt.core.resource.java.JPA;
-import org.eclipse.jpt.core.resource.orm.OrmFactory;
-import org.eclipse.jpt.core.resource.orm.XmlId;
-import org.eclipse.jpt.core.resource.persistence.PersistenceFactory;
-import org.eclipse.jpt.core.resource.persistence.XmlMappingFileRef;
-import org.eclipse.jpt.core.tests.internal.context.ContextModelTestCase;
-import org.eclipse.jpt.utility.internal.iterators.ArrayIterator;
-
-@SuppressWarnings("nls")
-public class OrmIdMappingTests extends ContextModelTestCase
-{
- public OrmIdMappingTests(String name) {
- super(name);
- }
-
-
- @Override
- protected void setUp() throws Exception {
- super.setUp();
- XmlMappingFileRef mappingFileRef = PersistenceFactory.eINSTANCE.createXmlMappingFileRef();
- mappingFileRef.setFileName(JptCorePlugin.DEFAULT_ORM_XML_FILE_PATH);
- getXmlPersistenceUnit().getMappingFiles().add(mappingFileRef);
- getPersistenceXmlResource().save(null);
- }
-
- private ICompilationUnit createTestEntityIdMapping() throws Exception {
- return this.createTestType(new DefaultAnnotationWriter() {
- @Override
- public Iterator<String> imports() {
- return new ArrayIterator<String>(JPA.ENTITY, JPA.ID, JPA.COLUMN, JPA.TEMPORAL, JPA.TEMPORAL_TYPE, JPA.GENERATED_VALUE, JPA.GENERATION_TYPE, JPA.TABLE_GENERATOR, JPA.SEQUENCE_GENERATOR);
- }
- @Override
- public void appendTypeAnnotationTo(StringBuilder sb) {
- sb.append("@Entity");
- }
-
- @Override
- public void appendIdFieldAnnotationTo(StringBuilder sb) {
- sb.append("@Id");
- sb.append(CR);
- sb.append(" @Column(name=\"MY_COLUMN\", unique=true, nullable=false, insertable=false, updatable=false, columnDefinition=\"COLUMN_DEFINITION\", table=\"MY_TABLE\", length=5, precision=6, scale=7)");
- sb.append(CR);
- sb.append(" @Temporal(TemporalType.TIMESTAMP)");
- sb.append(CR);
- sb.append(" @GeneratedValue(strategy=GenerationType.TABLE, generator=\"myTableGenerator\")");
- sb.append(CR);
- sb.append(" @TableGenerator(name=\"myTableGenerator\", table=\"myTable\", catalog=\"myCatalog\", schema=\"mySchema\", pkColumnName=\"myPkColumnName\", valueColumnName=\"myValueColumnName\", pkColumnValue=\"myPkColumnValue\", initialValue=1, allocationSize=1)");
- sb.append(CR);
- sb.append(" @SequenceGenerator(name=\"mySequenceGenerator\")");
- }
- });
- }
-
- public void testUpdateName() throws Exception {
- OrmPersistentType ormPersistentType = getEntityMappings().addPersistentType(MappingKeys.ENTITY_TYPE_MAPPING_KEY, "model.Foo");
- OrmPersistentAttribute ormPersistentAttribute = ormPersistentType.addSpecifiedPersistentAttribute(MappingKeys.ID_ATTRIBUTE_MAPPING_KEY, "idMapping");
- OrmIdMapping ormIdMapping = (OrmIdMapping) ormPersistentAttribute.getMapping();
- XmlId idResource = getXmlEntityMappings().getEntities().get(0).getAttributes().getIds().get(0);
-
- assertEquals("idMapping", ormIdMapping.getName());
- assertEquals("idMapping", idResource.getName());
-
- //set name in the resource model, verify context model updated
- idResource.setName("newName");
- assertEquals("newName", ormIdMapping.getName());
- assertEquals("newName", idResource.getName());
-
- //set name to null in the resource model
- idResource.setName(null);
- assertNull(ormIdMapping.getName());
- assertNull(idResource.getName());
- }
-
- public void testModifyName() throws Exception {
- OrmPersistentType ormPersistentType = getEntityMappings().addPersistentType(MappingKeys.ENTITY_TYPE_MAPPING_KEY, "model.Foo");
- OrmPersistentAttribute ormPersistentAttribute = ormPersistentType.addSpecifiedPersistentAttribute(MappingKeys.ID_ATTRIBUTE_MAPPING_KEY, "idMapping");
- OrmIdMapping ormIdMapping = (OrmIdMapping) ormPersistentAttribute.getMapping();
- XmlId idResource = getXmlEntityMappings().getEntities().get(0).getAttributes().getIds().get(0);
-
- assertEquals("idMapping", ormIdMapping.getName());
- assertEquals("idMapping", idResource.getName());
-
- //set name in the context model, verify resource model updated
- ormIdMapping.setName("newName");
- assertEquals("newName", ormIdMapping.getName());
- assertEquals("newName", idResource.getName());
-
- //set name to null in the context model
- ormIdMapping.setName(null);
- assertNull(ormIdMapping.getName());
- assertNull(idResource.getName());
- }
-
- public void testUpdateTemporal() throws Exception {
- OrmPersistentType ormPersistentType = getEntityMappings().addPersistentType(MappingKeys.ENTITY_TYPE_MAPPING_KEY, "model.Foo");
- OrmPersistentAttribute ormPersistentAttribute = ormPersistentType.addSpecifiedPersistentAttribute(MappingKeys.ID_ATTRIBUTE_MAPPING_KEY, "idMapping");
- OrmIdMapping ormIdMapping = (OrmIdMapping) ormPersistentAttribute.getMapping();
- XmlId idResource = getXmlEntityMappings().getEntities().get(0).getAttributes().getIds().get(0);
-
- assertNull(ormIdMapping.getSpecifiedConverter());
- assertNull(idResource.getTemporal());
-
- //set temporal in the resource model, verify context model updated
- idResource.setTemporal(org.eclipse.jpt.core.resource.orm.TemporalType.DATE);
- assertEquals(TemporalType.DATE, ((TemporalConverter) ormIdMapping.getConverter()).getTemporalType());
- assertEquals(org.eclipse.jpt.core.resource.orm.TemporalType.DATE, idResource.getTemporal());
-
- idResource.setTemporal(org.eclipse.jpt.core.resource.orm.TemporalType.TIME);
- assertEquals(TemporalType.TIME, ((TemporalConverter) ormIdMapping.getConverter()).getTemporalType());
- assertEquals(org.eclipse.jpt.core.resource.orm.TemporalType.TIME, idResource.getTemporal());
-
- idResource.setTemporal(org.eclipse.jpt.core.resource.orm.TemporalType.TIMESTAMP);
- assertEquals(TemporalType.TIMESTAMP, ((TemporalConverter) ormIdMapping.getConverter()).getTemporalType());
- assertEquals(org.eclipse.jpt.core.resource.orm.TemporalType.TIMESTAMP, idResource.getTemporal());
-
- //set temporal to null in the resource model
- idResource.setTemporal(null);
- assertNull(ormIdMapping.getSpecifiedConverter());
- assertNull(idResource.getTemporal());
- }
-
- public void testModifyTemporal() throws Exception {
- OrmPersistentType ormPersistentType = getEntityMappings().addPersistentType(MappingKeys.ENTITY_TYPE_MAPPING_KEY, "model.Foo");
- OrmPersistentAttribute ormPersistentAttribute = ormPersistentType.addSpecifiedPersistentAttribute(MappingKeys.ID_ATTRIBUTE_MAPPING_KEY, "idMapping");
- OrmIdMapping ormIdMapping = (OrmIdMapping) ormPersistentAttribute.getMapping();
- XmlId idResource = getXmlEntityMappings().getEntities().get(0).getAttributes().getIds().get(0);
-
- assertNull(ormIdMapping.getSpecifiedConverter());
- assertNull(idResource.getTemporal());
-
- //set temporal in the context model, verify resource model updated
- ormIdMapping.setSpecifiedConverter(Converter.TEMPORAL_CONVERTER);
- ((TemporalConverter) ormIdMapping.getSpecifiedConverter()).setTemporalType(TemporalType.DATE);
- assertEquals(org.eclipse.jpt.core.resource.orm.TemporalType.DATE, idResource.getTemporal());
- assertEquals(TemporalType.DATE, ((TemporalConverter) ormIdMapping.getSpecifiedConverter()).getTemporalType());
-
- ((TemporalConverter) ormIdMapping.getSpecifiedConverter()).setTemporalType(TemporalType.TIME);
- assertEquals(org.eclipse.jpt.core.resource.orm.TemporalType.TIME, idResource.getTemporal());
- assertEquals(TemporalType.TIME, ((TemporalConverter) ormIdMapping.getSpecifiedConverter()).getTemporalType());
-
- ((TemporalConverter) ormIdMapping.getSpecifiedConverter()).setTemporalType(TemporalType.TIMESTAMP);
- assertEquals(org.eclipse.jpt.core.resource.orm.TemporalType.TIMESTAMP, idResource.getTemporal());
- assertEquals(TemporalType.TIMESTAMP, ((TemporalConverter) ormIdMapping.getSpecifiedConverter()).getTemporalType());
-
- //set temporal to null in the context model
- ormIdMapping.setSpecifiedConverter(null);
- assertNull(idResource.getTemporal());
- assertNull(ormIdMapping.getSpecifiedConverter());
- }
-
- //TODO test defaults
- //TODO test overriding java mapping with a different mapping type in xml
-
-
- public void testAddSequenceGenerator() throws Exception {
- OrmPersistentType ormPersistentType = getEntityMappings().addPersistentType(MappingKeys.ENTITY_TYPE_MAPPING_KEY, "model.Foo");
- OrmPersistentAttribute ormPersistentAttribute = ormPersistentType.addSpecifiedPersistentAttribute(MappingKeys.ID_ATTRIBUTE_MAPPING_KEY, "idMapping");
- OrmIdMapping ormIdMapping = (OrmIdMapping) ormPersistentAttribute.getMapping();
- XmlId idResource = getXmlEntityMappings().getEntities().get(0).getAttributes().getIds().get(0);
-
- assertNull(ormIdMapping.getGeneratorContainer().getSequenceGenerator());
- assertNull(idResource.getSequenceGenerator());
-
- ormIdMapping.getGeneratorContainer().addSequenceGenerator();
-
- assertNotNull(idResource.getSequenceGenerator());
- assertNotNull(ormIdMapping.getGeneratorContainer().getSequenceGenerator());
-
- //try adding another sequence generator, should get an IllegalStateException
- try {
- ormIdMapping.getGeneratorContainer().addSequenceGenerator();
- } catch (IllegalStateException e) {
- return;
- }
- fail("IllegalStateException not thrown");
- }
-
- public void testRemoveSequenceGenerator() throws Exception {
- OrmPersistentType ormPersistentType = getEntityMappings().addPersistentType(MappingKeys.ENTITY_TYPE_MAPPING_KEY, "model.Foo");
- OrmPersistentAttribute ormPersistentAttribute = ormPersistentType.addSpecifiedPersistentAttribute(MappingKeys.ID_ATTRIBUTE_MAPPING_KEY, "idMapping");
- OrmIdMapping ormIdMapping = (OrmIdMapping) ormPersistentAttribute.getMapping();
- XmlId idResource = getXmlEntityMappings().getEntities().get(0).getAttributes().getIds().get(0);
-
- assertNull(ormIdMapping.getGeneratorContainer().getSequenceGenerator());
- assertNull(idResource.getSequenceGenerator());
-
- ormIdMapping.getGeneratorContainer().addSequenceGenerator();
- assertNotNull(idResource.getSequenceGenerator());
- assertNotNull(ormIdMapping.getGeneratorContainer().getSequenceGenerator());
-
- ormIdMapping.getGeneratorContainer().removeSequenceGenerator();
-
- assertNull(ormIdMapping.getGeneratorContainer().getSequenceGenerator());
- assertNull(idResource.getSequenceGenerator());
-
- //try removing the sequence generator again, should get an IllegalStateException
- try {
- ormIdMapping.getGeneratorContainer().removeSequenceGenerator();
- } catch (IllegalStateException e) {
- return;
- }
- fail("IllegalStateException not thrown");
- }
-
- public void testUpdateSequenceGenerator() throws Exception {
- OrmPersistentType ormPersistentType = getEntityMappings().addPersistentType(MappingKeys.ENTITY_TYPE_MAPPING_KEY, "model.Foo");
- OrmPersistentAttribute ormPersistentAttribute = ormPersistentType.addSpecifiedPersistentAttribute(MappingKeys.ID_ATTRIBUTE_MAPPING_KEY, "idMapping");
- OrmIdMapping ormIdMapping = (OrmIdMapping) ormPersistentAttribute.getMapping();
- XmlId idResource = getXmlEntityMappings().getEntities().get(0).getAttributes().getIds().get(0);
-
- assertNull(ormIdMapping.getGeneratorContainer().getSequenceGenerator());
- assertNull(idResource.getSequenceGenerator());
- assertEquals(0, ormIdMapping.getPersistenceUnit().generatorsSize());
-
- idResource.setSequenceGenerator(OrmFactory.eINSTANCE.createXmlSequenceGenerator());
- assertNotNull(ormIdMapping.getGeneratorContainer().getSequenceGenerator());
- assertNotNull(idResource.getSequenceGenerator());
- assertEquals(1, ormIdMapping.getPersistenceUnit().generatorsSize());
-
- ormIdMapping.getGeneratorContainer().getSequenceGenerator().setName("foo");
- assertEquals(1, ormIdMapping.getPersistenceUnit().generatorsSize());
-
- idResource.setSequenceGenerator(null);
- assertNull(ormIdMapping.getGeneratorContainer().getSequenceGenerator());
- assertNull(idResource.getSequenceGenerator());
- assertEquals(0, ormIdMapping.getPersistenceUnit().generatorsSize());
- }
-
- public void testAddTableGenerator() throws Exception {
- OrmPersistentType ormPersistentType = getEntityMappings().addPersistentType(MappingKeys.ENTITY_TYPE_MAPPING_KEY, "model.Foo");
- OrmPersistentAttribute ormPersistentAttribute = ormPersistentType.addSpecifiedPersistentAttribute(MappingKeys.ID_ATTRIBUTE_MAPPING_KEY, "idMapping");
- OrmIdMapping ormIdMapping = (OrmIdMapping) ormPersistentAttribute.getMapping();
- XmlId idResource = getXmlEntityMappings().getEntities().get(0).getAttributes().getIds().get(0);
-
- assertNull(ormIdMapping.getGeneratorContainer().getTableGenerator());
- assertNull(idResource.getTableGenerator());
-
- ormIdMapping.getGeneratorContainer().addTableGenerator();
-
- assertNotNull(idResource.getTableGenerator());
- assertNotNull(ormIdMapping.getGeneratorContainer().getTableGenerator());
-
- //try adding another table generator, should get an IllegalStateException
- try {
- ormIdMapping.getGeneratorContainer().addTableGenerator();
- } catch (IllegalStateException e) {
- return;
- }
- fail("IllegalStateException not thrown");
- }
-
- public void testRemoveTableGenerator() throws Exception {
- OrmPersistentType ormPersistentType = getEntityMappings().addPersistentType(MappingKeys.ENTITY_TYPE_MAPPING_KEY, "model.Foo");
- OrmPersistentAttribute ormPersistentAttribute = ormPersistentType.addSpecifiedPersistentAttribute(MappingKeys.ID_ATTRIBUTE_MAPPING_KEY, "idMapping");
- OrmIdMapping ormIdMapping = (OrmIdMapping) ormPersistentAttribute.getMapping();
- XmlId idResource = getXmlEntityMappings().getEntities().get(0).getAttributes().getIds().get(0);
-
- assertNull(ormIdMapping.getGeneratorContainer().getTableGenerator());
- assertNull(idResource.getTableGenerator());
-
- ormIdMapping.getGeneratorContainer().addTableGenerator();
- assertNotNull(idResource.getTableGenerator());
- assertNotNull(ormIdMapping.getGeneratorContainer().getTableGenerator());
-
- ormIdMapping.getGeneratorContainer().removeTableGenerator();
-
- assertNull(ormIdMapping.getGeneratorContainer().getTableGenerator());
- assertNull(idResource.getTableGenerator());
-
- //try removing the table generator again, should get an IllegalStateException
- try {
- ormIdMapping.getGeneratorContainer().removeTableGenerator();
- } catch (IllegalStateException e) {
- return;
- }
- fail("IllegalStateException not thrown");
- }
-
- public void testUpdateTableGenerator() throws Exception {
- OrmPersistentType ormPersistentType = getEntityMappings().addPersistentType(MappingKeys.ENTITY_TYPE_MAPPING_KEY, "model.Foo");
- OrmPersistentAttribute ormPersistentAttribute = ormPersistentType.addSpecifiedPersistentAttribute(MappingKeys.ID_ATTRIBUTE_MAPPING_KEY, "idMapping");
- OrmIdMapping ormIdMapping = (OrmIdMapping) ormPersistentAttribute.getMapping();
- XmlId idResource = getXmlEntityMappings().getEntities().get(0).getAttributes().getIds().get(0);
-
- assertNull(ormIdMapping.getGeneratorContainer().getTableGenerator());
- assertNull(idResource.getTableGenerator());
- assertEquals(0, ormIdMapping.getPersistenceUnit().generatorsSize());
-
- idResource.setTableGenerator(OrmFactory.eINSTANCE.createXmlTableGenerator());
- assertNotNull(ormIdMapping.getGeneratorContainer().getTableGenerator());
- assertNotNull(idResource.getTableGenerator());
- assertEquals(1, ormIdMapping.getPersistenceUnit().generatorsSize());
-
- ormIdMapping.getGeneratorContainer().getTableGenerator().setName("foo");
- assertEquals(1, ormIdMapping.getGeneratorContainer().getPersistenceUnit().generatorsSize());
-
- idResource.setTableGenerator(null);
- assertNull(ormIdMapping.getGeneratorContainer().getTableGenerator());
- assertNull(idResource.getTableGenerator());
- assertEquals(0, ormIdMapping.getPersistenceUnit().generatorsSize());
- }
-
- public void testAddGeneratedValue() throws Exception {
- OrmPersistentType ormPersistentType = getEntityMappings().addPersistentType(MappingKeys.ENTITY_TYPE_MAPPING_KEY, "model.Foo");
- OrmPersistentAttribute ormPersistentAttribute = ormPersistentType.addSpecifiedPersistentAttribute(MappingKeys.ID_ATTRIBUTE_MAPPING_KEY, "idMapping");
- OrmIdMapping ormIdMapping = (OrmIdMapping) ormPersistentAttribute.getMapping();
- XmlId idResource = getXmlEntityMappings().getEntities().get(0).getAttributes().getIds().get(0);
-
- assertNull(ormIdMapping.getGeneratedValue());
- assertNull(idResource.getGeneratedValue());
-
- ormIdMapping.addGeneratedValue();
-
- assertNotNull(idResource.getGeneratedValue());
- assertNotNull(ormIdMapping.getGeneratedValue());
-
- //try adding another sequence generator, should get an IllegalStateException
- try {
- ormIdMapping.addGeneratedValue();
- } catch (IllegalStateException e) {
- return;
- }
- fail("IllegalStateException not thrown");
- }
-
- public void testRemoveGeneratedValue() throws Exception {
- OrmPersistentType ormPersistentType = getEntityMappings().addPersistentType(MappingKeys.ENTITY_TYPE_MAPPING_KEY, "model.Foo");
- OrmPersistentAttribute ormPersistentAttribute = ormPersistentType.addSpecifiedPersistentAttribute(MappingKeys.ID_ATTRIBUTE_MAPPING_KEY, "idMapping");
- OrmIdMapping ormIdMapping = (OrmIdMapping) ormPersistentAttribute.getMapping();
- XmlId idResource = getXmlEntityMappings().getEntities().get(0).getAttributes().getIds().get(0);
-
- assertNull(ormIdMapping.getGeneratedValue());
- assertNull(idResource.getGeneratedValue());
-
- ormIdMapping.addGeneratedValue();
- assertNotNull(idResource.getGeneratedValue());
- assertNotNull(ormIdMapping.getGeneratedValue());
-
- ormIdMapping.removeGeneratedValue();
-
- assertNull(ormIdMapping.getGeneratedValue());
- assertNull(idResource.getGeneratedValue());
-
- //try removing the sequence generator again, should get an IllegalStateException
- try {
- ormIdMapping.removeGeneratedValue();
- } catch (IllegalStateException e) {
- return;
- }
- fail("IllegalStateException not thrown");
- }
-
- public void testUpdateGeneratedValue() throws Exception {
- OrmPersistentType ormPersistentType = getEntityMappings().addPersistentType(MappingKeys.ENTITY_TYPE_MAPPING_KEY, "model.Foo");
- OrmPersistentAttribute ormPersistentAttribute = ormPersistentType.addSpecifiedPersistentAttribute(MappingKeys.ID_ATTRIBUTE_MAPPING_KEY, "idMapping");
- OrmIdMapping ormIdMapping = (OrmIdMapping) ormPersistentAttribute.getMapping();
- XmlId idResource = getXmlEntityMappings().getEntities().get(0).getAttributes().getIds().get(0);
-
- assertNull(ormIdMapping.getGeneratedValue());
- assertNull(idResource.getGeneratedValue());
-
- idResource.setGeneratedValue(OrmFactory.eINSTANCE.createXmlGeneratedValue());
-
- assertNotNull(ormIdMapping.getGeneratedValue());
- assertNotNull(idResource.getGeneratedValue());
-
- idResource.setGeneratedValue(null);
- assertNull(ormIdMapping.getGeneratedValue());
- assertNull(idResource.getGeneratedValue());
- }
-
-
- public void testIdMappingNoUnderylingJavaAttribute() throws Exception {
- createTestEntityIdMapping();
-
- OrmPersistentType ormPersistentType = getEntityMappings().addPersistentType(MappingKeys.ENTITY_TYPE_MAPPING_KEY, FULLY_QUALIFIED_TYPE_NAME);
- ormPersistentType.addSpecifiedPersistentAttribute(MappingKeys.ID_ATTRIBUTE_MAPPING_KEY, "foo");
- assertEquals(2, ormPersistentType.virtualAttributesSize());
-
- OrmPersistentAttribute ormPersistentAttribute = ormPersistentType.specifiedAttributes().next();
- OrmIdMapping ormIdMapping = (OrmIdMapping) ormPersistentAttribute.getMapping();
-
- assertEquals("foo", ormIdMapping.getName());
- assertNull(ormIdMapping.getSpecifiedConverter());
- assertNull(ormIdMapping.getGeneratedValue());
- assertNull(ormIdMapping.getGeneratorContainer().getSequenceGenerator());
- assertNull(ormIdMapping.getGeneratorContainer().getTableGenerator());
-
-
- OrmColumn ormColumn = ormIdMapping.getColumn();
- assertNull(ormColumn.getSpecifiedName());
- assertNull(ormColumn.getSpecifiedUnique());
- assertNull(ormColumn.getSpecifiedNullable());
- assertNull(ormColumn.getSpecifiedInsertable());
- assertNull(ormColumn.getSpecifiedUpdatable());
- assertNull(ormColumn.getColumnDefinition());
- assertNull(ormColumn.getSpecifiedTable());
- assertNull(ormColumn.getSpecifiedLength());
- assertNull(ormColumn.getSpecifiedPrecision());
- assertNull(ormColumn.getSpecifiedScale());
-
- assertEquals("foo", ormColumn.getDefaultName());
- assertEquals(false, ormColumn.isDefaultUnique());
- assertEquals(true, ormColumn.isDefaultNullable());
- assertEquals(true, ormColumn.isDefaultInsertable());
- assertEquals(true, ormColumn.isDefaultUpdatable());
- assertEquals(null, ormColumn.getColumnDefinition());
- assertEquals(TYPE_NAME, ormColumn.getDefaultTable());
- assertEquals(255, ormColumn.getDefaultLength());
- assertEquals(0, ormColumn.getDefaultPrecision());
- assertEquals(0, ormColumn.getDefaultScale());
- }
-
- //@Basic(fetch=FetchType.LAZY, optional=false)
- //@Column(name="MY_COLUMN", unique=true, nullable=false, insertable=false, updatable=false,
- // columnDefinition="COLUMN_DEFINITION", table="MY_TABLE", length=5, precision=6, scale=7)");
- //@Column(
- //@Lob
- //@Temporal(TemporalType.TIMESTAMP)
- //@Enumerated(EnumType.STRING)
- public void testVirtualMappingMetadataCompleteFalse() throws Exception {
- createTestEntityIdMapping();
- OrmPersistentType ormPersistentType = getEntityMappings().addPersistentType(MappingKeys.ENTITY_TYPE_MAPPING_KEY, FULLY_QUALIFIED_TYPE_NAME);
- assertEquals(2, ormPersistentType.virtualAttributesSize());
- OrmPersistentAttribute ormPersistentAttribute = ormPersistentType.virtualAttributes().next();
-
- OrmIdMapping ormIdMapping = (OrmIdMapping) ormPersistentAttribute.getMapping();
- assertEquals("id", ormIdMapping.getName());
- assertEquals(Converter.TEMPORAL_CONVERTER, ormIdMapping.getConverter().getType());
- assertEquals(TemporalType.TIMESTAMP, ((TemporalConverter) ormIdMapping.getConverter()).getTemporalType());
-
- OrmColumn ormColumn = ormIdMapping.getColumn();
- assertEquals("MY_COLUMN", ormColumn.getSpecifiedName());
- assertEquals(Boolean.TRUE, ormColumn.getSpecifiedUnique());
- assertEquals(Boolean.FALSE, ormColumn.getSpecifiedNullable());
- assertEquals(Boolean.FALSE, ormColumn.getSpecifiedInsertable());
- assertEquals(Boolean.FALSE, ormColumn.getSpecifiedUpdatable());
- assertEquals("COLUMN_DEFINITION", ormColumn.getColumnDefinition());
- assertEquals("MY_TABLE", ormColumn.getSpecifiedTable());
- assertEquals(Integer.valueOf(5), ormColumn.getSpecifiedLength());
- assertEquals(Integer.valueOf(6), ormColumn.getSpecifiedPrecision());
- assertEquals(Integer.valueOf(7), ormColumn.getSpecifiedScale());
-
- OrmGeneratedValue ormGeneratedValue = ormIdMapping.getGeneratedValue();
- assertEquals("myTableGenerator", ormGeneratedValue.getSpecifiedGenerator());
- assertEquals(GenerationType.TABLE, ormGeneratedValue.getSpecifiedStrategy());
-
- OrmTableGenerator ormTableGenerator = ormIdMapping.getGeneratorContainer().getTableGenerator();
- assertEquals("myTableGenerator", ormTableGenerator.getName());
- assertEquals("myTable", ormTableGenerator.getSpecifiedTable());
- assertEquals("myCatalog", ormTableGenerator.getSpecifiedCatalog());
- assertEquals("mySchema", ormTableGenerator.getSpecifiedSchema());
- assertEquals("myPkColumnName", ormTableGenerator.getSpecifiedPkColumnName());
- assertEquals("myPkColumnValue", ormTableGenerator.getSpecifiedPkColumnValue());
- assertEquals("myValueColumnName", ormTableGenerator.getSpecifiedValueColumnName());
- assertEquals(Integer.valueOf(1), ormTableGenerator.getSpecifiedInitialValue());
- assertEquals(Integer.valueOf(1), ormTableGenerator.getSpecifiedAllocationSize());
-
- OrmSequenceGenerator ormSequenceGenerator = ormIdMapping.getGeneratorContainer().getSequenceGenerator();
- assertEquals("mySequenceGenerator", ormSequenceGenerator.getName());
- }
-
- public void testVirtualMappingMetadataCompleteTrue() throws Exception {
- createTestEntityIdMapping();
- OrmPersistentType ormPersistentType = getEntityMappings().addPersistentType(MappingKeys.ENTITY_TYPE_MAPPING_KEY, FULLY_QUALIFIED_TYPE_NAME);
- ormPersistentType.getMapping().setSpecifiedMetadataComplete(Boolean.TRUE);
- assertEquals(2, ormPersistentType.virtualAttributesSize());
- OrmPersistentAttribute ormPersistentAttribute = ormPersistentType.virtualAttributes().next();
-
- assertEquals(MappingKeys.BASIC_ATTRIBUTE_MAPPING_KEY, ormPersistentAttribute.getMappingKey());
-
- ormPersistentAttribute.makeSpecified(MappingKeys.ID_ATTRIBUTE_MAPPING_KEY);
- ormPersistentAttribute= ormPersistentType.specifiedAttributes().next();
-
- OrmIdMapping ormIdMapping = (OrmIdMapping) ormPersistentAttribute.getMapping();
- assertEquals("id", ormIdMapping.getName());
- assertNull(ormIdMapping.getSpecifiedConverter());
- assertNull(ormIdMapping.getGeneratedValue());
- assertNull(ormIdMapping.getGeneratorContainer().getSequenceGenerator());
- assertNull(ormIdMapping.getGeneratorContainer().getTableGenerator());
-
- OrmColumn ormColumn = ormIdMapping.getColumn();
- assertEquals("id", ormColumn.getName());
- assertEquals(false, ormColumn.isDefaultUnique());
- assertEquals(true, ormColumn.isDefaultNullable());
- assertEquals(true, ormColumn.isDefaultInsertable());
- assertEquals(true, ormColumn.isDefaultUpdatable());
- assertNull(ormColumn.getColumnDefinition());
- assertEquals(TYPE_NAME, ormColumn.getTable());
- assertEquals(255, ormColumn.getLength());
- assertEquals(0, ormColumn.getPrecision());
- assertEquals(0, ormColumn.getScale());
- }
-
- public void testSpecifiedMapping() throws Exception {
- createTestEntityIdMapping();
-
- OrmPersistentType ormPersistentType = getEntityMappings().addPersistentType(MappingKeys.ENTITY_TYPE_MAPPING_KEY, FULLY_QUALIFIED_TYPE_NAME);
- ormPersistentType.addSpecifiedPersistentAttribute(MappingKeys.ID_ATTRIBUTE_MAPPING_KEY, "id");
- assertEquals(1, ormPersistentType.virtualAttributesSize());
-
- OrmPersistentAttribute ormPersistentAttribute = ormPersistentType.specifiedAttributes().next();
- OrmIdMapping ormIdMapping = (OrmIdMapping) ormPersistentAttribute.getMapping();
-
- assertEquals("id", ormIdMapping.getName());
- assertNull(ormIdMapping.getSpecifiedConverter());
- assertNull(ormIdMapping.getGeneratedValue());
- assertNull(ormIdMapping.getGeneratorContainer().getSequenceGenerator());
- assertNull(ormIdMapping.getGeneratorContainer().getTableGenerator());
-
- OrmColumn ormColumn = ormIdMapping.getColumn();
- assertNull(ormColumn.getSpecifiedName());
- assertNull(ormColumn.getSpecifiedUnique());
- assertNull(ormColumn.getSpecifiedNullable());
- assertNull(ormColumn.getSpecifiedInsertable());
- assertNull(ormColumn.getSpecifiedUpdatable());
- assertNull(ormColumn.getColumnDefinition());
- assertNull(ormColumn.getSpecifiedTable());
- assertNull(ormColumn.getSpecifiedLength());
- assertNull(ormColumn.getSpecifiedPrecision());
- assertNull(ormColumn.getSpecifiedScale());
-
- assertEquals("id", ormColumn.getDefaultName());
- assertEquals(false, ormColumn.isDefaultUnique());
- assertEquals(true, ormColumn.isDefaultNullable());
- assertEquals(true, ormColumn.isDefaultInsertable());
- assertEquals(true, ormColumn.isDefaultUpdatable());
- assertEquals(null, ormColumn.getColumnDefinition());
- assertEquals(TYPE_NAME, ormColumn.getDefaultTable());
- assertEquals(255, ormColumn.getDefaultLength());
- assertEquals(0, ormColumn.getDefaultPrecision());
- assertEquals(0, ormColumn.getDefaultScale());
- }
-
- //3 things tested above
- //1. virtual mapping metadata complete=false - defaults are taken from the java annotations
- //2. virtual mapping metadata complete=true - defaults are taken from java defaults,annotations ignored
- //3. specified mapping (metadata complete=true/false - defaults are taken from java annotations
-
- public void testIdMorphToBasicMapping() throws Exception {
- createTestEntityIdMapping();
- OrmPersistentType ormPersistentType = getEntityMappings().addPersistentType(MappingKeys.ENTITY_TYPE_MAPPING_KEY, FULLY_QUALIFIED_TYPE_NAME);
- OrmPersistentAttribute ormPersistentAttribute = ormPersistentType.addSpecifiedPersistentAttribute(MappingKeys.ID_ATTRIBUTE_MAPPING_KEY, "id");
-
- IdMapping idMapping = (IdMapping) ormPersistentAttribute.getMapping();
- assertFalse(idMapping.isDefault());
- idMapping.getColumn().setSpecifiedName("FOO");
- idMapping.setSpecifiedConverter(Converter.TEMPORAL_CONVERTER);
- ((TemporalConverter) idMapping.getSpecifiedConverter()).setTemporalType(TemporalType.TIME);
- assertFalse(idMapping.isDefault());
-
- ormPersistentAttribute.setSpecifiedMappingKey(MappingKeys.BASIC_ATTRIBUTE_MAPPING_KEY);
- assertEquals(1, ormPersistentType.specifiedAttributesSize());
- assertEquals(ormPersistentAttribute, ormPersistentType.specifiedAttributes().next());
- assertTrue(ormPersistentAttribute.getMapping() instanceof BasicMapping);
- assertEquals("id", ormPersistentAttribute.getMapping().getName());
- assertEquals("FOO", ((BasicMapping) ormPersistentAttribute.getMapping()).getColumn().getSpecifiedName());
- }
-
- public void testIdMorphToVersionMapping() throws Exception {
- createTestEntityIdMapping();
- OrmPersistentType ormPersistentType = getEntityMappings().addPersistentType(MappingKeys.ENTITY_TYPE_MAPPING_KEY, FULLY_QUALIFIED_TYPE_NAME);
- OrmPersistentAttribute ormPersistentAttribute = ormPersistentType.addSpecifiedPersistentAttribute(MappingKeys.ID_ATTRIBUTE_MAPPING_KEY, "id");
-
- IdMapping idMapping = (IdMapping) ormPersistentAttribute.getMapping();
- assertFalse(idMapping.isDefault());
- idMapping.getColumn().setSpecifiedName("FOO");
- idMapping.setSpecifiedConverter(Converter.TEMPORAL_CONVERTER);
- ((TemporalConverter) idMapping.getSpecifiedConverter()).setTemporalType(TemporalType.TIME);
- assertFalse(idMapping.isDefault());
-
- ormPersistentAttribute.setSpecifiedMappingKey(MappingKeys.VERSION_ATTRIBUTE_MAPPING_KEY);
- assertEquals(1, ormPersistentType.specifiedAttributesSize());
- assertEquals(ormPersistentAttribute, ormPersistentType.specifiedAttributes().next());
- assertTrue(ormPersistentAttribute.getMapping() instanceof VersionMapping);
- assertEquals("id", ormPersistentAttribute.getMapping().getName());
- assertEquals("FOO", ((VersionMapping) ormPersistentAttribute.getMapping()).getColumn().getSpecifiedName());
- }
-
- public void testIdMorphToTransientMapping() throws Exception {
- createTestEntityIdMapping();
- OrmPersistentType ormPersistentType = getEntityMappings().addPersistentType(MappingKeys.ENTITY_TYPE_MAPPING_KEY, FULLY_QUALIFIED_TYPE_NAME);
- OrmPersistentAttribute ormPersistentAttribute = ormPersistentType.addSpecifiedPersistentAttribute(MappingKeys.ID_ATTRIBUTE_MAPPING_KEY, "id");
-
- IdMapping idMapping = (IdMapping) ormPersistentAttribute.getMapping();
- assertFalse(idMapping.isDefault());
- idMapping.getColumn().setSpecifiedName("FOO");
- idMapping.setSpecifiedConverter(Converter.TEMPORAL_CONVERTER);
- ((TemporalConverter) idMapping.getSpecifiedConverter()).setTemporalType(TemporalType.TIME);
- assertFalse(idMapping.isDefault());
-
- ormPersistentAttribute.setSpecifiedMappingKey(MappingKeys.TRANSIENT_ATTRIBUTE_MAPPING_KEY);
- assertTrue(ormPersistentAttribute.getMapping() instanceof TransientMapping);
- assertEquals("id", ormPersistentAttribute.getMapping().getName());
- }
-
- public void testIdMorphToEmbeddedMapping() throws Exception {
- createTestEntityIdMapping();
- OrmPersistentType ormPersistentType = getEntityMappings().addPersistentType(MappingKeys.ENTITY_TYPE_MAPPING_KEY, FULLY_QUALIFIED_TYPE_NAME);
- OrmPersistentAttribute ormPersistentAttribute = ormPersistentType.addSpecifiedPersistentAttribute(MappingKeys.ID_ATTRIBUTE_MAPPING_KEY, "id");
-
- IdMapping idMapping = (IdMapping) ormPersistentAttribute.getMapping();
- assertFalse(idMapping.isDefault());
- idMapping.getColumn().setSpecifiedName("FOO");
- idMapping.setSpecifiedConverter(Converter.TEMPORAL_CONVERTER);
- ((TemporalConverter) idMapping.getSpecifiedConverter()).setTemporalType(TemporalType.TIME);
- assertFalse(idMapping.isDefault());
-
- ormPersistentAttribute.setSpecifiedMappingKey(MappingKeys.EMBEDDED_ATTRIBUTE_MAPPING_KEY);
- assertEquals(1, ormPersistentType.specifiedAttributesSize());
- assertEquals(ormPersistentAttribute, ormPersistentType.specifiedAttributes().next());
- assertTrue(ormPersistentAttribute.getMapping() instanceof EmbeddedMapping);
- assertEquals("id", ormPersistentAttribute.getMapping().getName());
- }
-
- public void testIdMorphToEmbeddedIdMapping() throws Exception {
- createTestEntityIdMapping();
- OrmPersistentType ormPersistentType = getEntityMappings().addPersistentType(MappingKeys.ENTITY_TYPE_MAPPING_KEY, FULLY_QUALIFIED_TYPE_NAME);
- OrmPersistentAttribute ormPersistentAttribute = ormPersistentType.addSpecifiedPersistentAttribute(MappingKeys.ID_ATTRIBUTE_MAPPING_KEY, "id");
-
- IdMapping idMapping = (IdMapping) ormPersistentAttribute.getMapping();
- assertFalse(idMapping.isDefault());
- idMapping.getColumn().setSpecifiedName("FOO");
- idMapping.setSpecifiedConverter(Converter.TEMPORAL_CONVERTER);
- ((TemporalConverter) idMapping.getSpecifiedConverter()).setTemporalType(TemporalType.TIME);
- assertFalse(idMapping.isDefault());
-
- ormPersistentAttribute.setSpecifiedMappingKey(MappingKeys.EMBEDDED_ID_ATTRIBUTE_MAPPING_KEY);
- assertTrue(ormPersistentAttribute.getMapping() instanceof EmbeddedIdMapping);
- assertEquals("id", ormPersistentAttribute.getMapping().getName());
- }
-
- public void testIdMorphToOneToOneMapping() throws Exception {
- createTestEntityIdMapping();
- OrmPersistentType ormPersistentType = getEntityMappings().addPersistentType(MappingKeys.ENTITY_TYPE_MAPPING_KEY, FULLY_QUALIFIED_TYPE_NAME);
- OrmPersistentAttribute ormPersistentAttribute = ormPersistentType.addSpecifiedPersistentAttribute(MappingKeys.ID_ATTRIBUTE_MAPPING_KEY, "id");
-
- IdMapping idMapping = (IdMapping) ormPersistentAttribute.getMapping();
- assertFalse(idMapping.isDefault());
- idMapping.getColumn().setSpecifiedName("FOO");
- idMapping.setSpecifiedConverter(Converter.TEMPORAL_CONVERTER);
- ((TemporalConverter) idMapping.getSpecifiedConverter()).setTemporalType(TemporalType.TIME);
- assertFalse(idMapping.isDefault());
-
- ormPersistentAttribute.setSpecifiedMappingKey(MappingKeys.ONE_TO_ONE_ATTRIBUTE_MAPPING_KEY);
- assertEquals(1, ormPersistentType.specifiedAttributesSize());
- assertEquals(ormPersistentAttribute, ormPersistentType.specifiedAttributes().next());
- assertTrue(ormPersistentAttribute.getMapping() instanceof OneToOneMapping);
- assertEquals("id", ormPersistentAttribute.getMapping().getName());
- }
-
- public void testIdMorphToOneToManyMapping() throws Exception {
- createTestEntityIdMapping();
- OrmPersistentType ormPersistentType = getEntityMappings().addPersistentType(MappingKeys.ENTITY_TYPE_MAPPING_KEY, FULLY_QUALIFIED_TYPE_NAME);
- OrmPersistentAttribute ormPersistentAttribute = ormPersistentType.addSpecifiedPersistentAttribute(MappingKeys.ID_ATTRIBUTE_MAPPING_KEY, "id");
-
- IdMapping idMapping = (IdMapping) ormPersistentAttribute.getMapping();
- assertFalse(idMapping.isDefault());
- idMapping.getColumn().setSpecifiedName("FOO");
- idMapping.setSpecifiedConverter(Converter.TEMPORAL_CONVERTER);
- ((TemporalConverter) idMapping.getSpecifiedConverter()).setTemporalType(TemporalType.TIME);
- assertFalse(idMapping.isDefault());
-
- ormPersistentAttribute.setSpecifiedMappingKey(MappingKeys.ONE_TO_MANY_ATTRIBUTE_MAPPING_KEY);
- assertEquals(1, ormPersistentType.specifiedAttributesSize());
- assertEquals(ormPersistentAttribute, ormPersistentType.specifiedAttributes().next());
- assertTrue(ormPersistentAttribute.getMapping() instanceof OneToManyMapping);
- assertEquals("id", ormPersistentAttribute.getMapping().getName());
- }
-
- public void testIdMorphToManyToOneMapping() throws Exception {
- createTestEntityIdMapping();
- OrmPersistentType ormPersistentType = getEntityMappings().addPersistentType(MappingKeys.ENTITY_TYPE_MAPPING_KEY, FULLY_QUALIFIED_TYPE_NAME);
- OrmPersistentAttribute ormPersistentAttribute = ormPersistentType.addSpecifiedPersistentAttribute(MappingKeys.ID_ATTRIBUTE_MAPPING_KEY, "id");
-
- IdMapping idMapping = (IdMapping) ormPersistentAttribute.getMapping();
- assertFalse(idMapping.isDefault());
- idMapping.getColumn().setSpecifiedName("FOO");
- idMapping.setSpecifiedConverter(Converter.TEMPORAL_CONVERTER);
- ((TemporalConverter) idMapping.getSpecifiedConverter()).setTemporalType(TemporalType.TIME);
- assertFalse(idMapping.isDefault());
-
- ormPersistentAttribute.setSpecifiedMappingKey(MappingKeys.MANY_TO_ONE_ATTRIBUTE_MAPPING_KEY);
- assertEquals(1, ormPersistentType.specifiedAttributesSize());
- assertEquals(ormPersistentAttribute, ormPersistentType.specifiedAttributes().next());
- assertTrue(ormPersistentAttribute.getMapping() instanceof ManyToOneMapping);
- assertEquals("id", ormPersistentAttribute.getMapping().getName());
- }
-
- public void testIdMorphToManyToManyMapping() throws Exception {
- createTestEntityIdMapping();
- OrmPersistentType ormPersistentType = getEntityMappings().addPersistentType(MappingKeys.ENTITY_TYPE_MAPPING_KEY, FULLY_QUALIFIED_TYPE_NAME);
- OrmPersistentAttribute ormPersistentAttribute = ormPersistentType.addSpecifiedPersistentAttribute(MappingKeys.ID_ATTRIBUTE_MAPPING_KEY, "id");
-
- IdMapping idMapping = (IdMapping) ormPersistentAttribute.getMapping();
- assertFalse(idMapping.isDefault());
- idMapping.getColumn().setSpecifiedName("FOO");
- idMapping.setSpecifiedConverter(Converter.TEMPORAL_CONVERTER);
- ((TemporalConverter) idMapping.getSpecifiedConverter()).setTemporalType(TemporalType.TIME);
- assertFalse(idMapping.isDefault());
-
- ormPersistentAttribute.setSpecifiedMappingKey(MappingKeys.MANY_TO_MANY_ATTRIBUTE_MAPPING_KEY);
- assertEquals(1, ormPersistentType.specifiedAttributesSize());
- assertEquals(ormPersistentAttribute, ormPersistentType.specifiedAttributes().next());
- assertTrue(ormPersistentAttribute.getMapping() instanceof ManyToManyMapping);
- assertEquals("id", ormPersistentAttribute.getMapping().getName());
- }
-} \ No newline at end of file
diff --git a/jpa/tests/org.eclipse.jpt.core.tests/src/org/eclipse/jpt/core/tests/internal/context/orm/OrmJoinColumnTests.java b/jpa/tests/org.eclipse.jpt.core.tests/src/org/eclipse/jpt/core/tests/internal/context/orm/OrmJoinColumnTests.java
deleted file mode 100644
index b2dc08aaab..0000000000
--- a/jpa/tests/org.eclipse.jpt.core.tests/src/org/eclipse/jpt/core/tests/internal/context/orm/OrmJoinColumnTests.java
+++ /dev/null
@@ -1,506 +0,0 @@
-/*******************************************************************************
- * Copyright (c) 2007, 2009 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.
- *
- * Contributors:
- * Oracle - initial API and implementation
- ******************************************************************************/
-package org.eclipse.jpt.core.tests.internal.context.orm;
-
-import org.eclipse.jpt.core.JptCorePlugin;
-import org.eclipse.jpt.core.MappingKeys;
-import org.eclipse.jpt.core.context.orm.OrmJoinColumn;
-import org.eclipse.jpt.core.context.orm.OrmJoinTable;
-import org.eclipse.jpt.core.context.orm.OrmManyToManyMapping;
-import org.eclipse.jpt.core.context.orm.OrmPersistentAttribute;
-import org.eclipse.jpt.core.context.orm.OrmPersistentType;
-import org.eclipse.jpt.core.resource.orm.XmlJoinColumn;
-import org.eclipse.jpt.core.resource.orm.XmlJoinTable;
-import org.eclipse.jpt.core.resource.orm.XmlManyToMany;
-import org.eclipse.jpt.core.resource.persistence.PersistenceFactory;
-import org.eclipse.jpt.core.resource.persistence.XmlMappingFileRef;
-import org.eclipse.jpt.core.tests.internal.context.ContextModelTestCase;
-
-@SuppressWarnings("nls")
-public class OrmJoinColumnTests extends ContextModelTestCase
-{
- public OrmJoinColumnTests(String name) {
- super(name);
- }
-
- @Override
- protected void setUp() throws Exception {
- super.setUp();
- XmlMappingFileRef mappingFileRef = PersistenceFactory.eINSTANCE.createXmlMappingFileRef();
- mappingFileRef.setFileName(JptCorePlugin.DEFAULT_ORM_XML_FILE_PATH);
- getXmlPersistenceUnit().getMappingFiles().add(mappingFileRef);
- getPersistenceXmlResource().save(null);
- }
-
- public void testUpdateSpecifiedName() throws Exception {
- OrmPersistentType ormPersistentType = getEntityMappings().addPersistentType(MappingKeys.ENTITY_TYPE_MAPPING_KEY, "model.Foo");
- OrmPersistentAttribute ormPersistentAttribute = ormPersistentType.addSpecifiedPersistentAttribute(MappingKeys.MANY_TO_MANY_ATTRIBUTE_MAPPING_KEY, "manyToManyMapping");
- OrmManyToManyMapping ormManyToManyMapping = (OrmManyToManyMapping) ormPersistentAttribute.getMapping();
- XmlManyToMany manyToMany = getXmlEntityMappings().getEntities().get(0).getAttributes().getManyToManys().get(0);
-
- OrmJoinTable ormJoinTable = ormManyToManyMapping.getRelationshipReference().getJoinTableJoiningStrategy().getJoinTable();
- OrmJoinColumn joinColumn = ormJoinTable.addSpecifiedJoinColumn(0);
- XmlJoinTable joinTableResource = manyToMany.getJoinTable();
- XmlJoinColumn joinColumnResource = joinTableResource.getJoinColumns().get(0);
-
- assertNull(joinColumn.getSpecifiedName());
- assertNull(joinColumnResource.getName());
-
- //set name in the resource model, verify context model updated
- joinColumnResource.setName("FOO");
- assertEquals("FOO", joinColumn.getSpecifiedName());
- assertEquals("FOO", joinColumnResource.getName());
-
- //set name to null in the resource model
- joinColumnResource.setName(null);
- assertNull(joinColumn.getSpecifiedName());
- assertNull(joinColumnResource.getName());
-
- joinColumnResource.setName("FOO");
- assertEquals("FOO", joinColumn.getSpecifiedName());
- assertEquals("FOO", joinColumnResource.getName());
-
- joinTableResource.getJoinColumns().remove(0);
- assertFalse(ormJoinTable.specifiedJoinColumns().hasNext());
- assertTrue(joinTableResource.getJoinColumns().isEmpty());
- }
-
- public void testModifySpecifiedName() throws Exception {
- OrmPersistentType ormPersistentType = getEntityMappings().addPersistentType(MappingKeys.ENTITY_TYPE_MAPPING_KEY, "model.Foo");
- OrmPersistentAttribute ormPersistentAttribute = ormPersistentType.addSpecifiedPersistentAttribute(MappingKeys.MANY_TO_MANY_ATTRIBUTE_MAPPING_KEY, "manyToManyMapping");
- OrmManyToManyMapping ormManyToManyMapping = (OrmManyToManyMapping) ormPersistentAttribute.getMapping();
- XmlManyToMany manyToMany = getXmlEntityMappings().getEntities().get(0).getAttributes().getManyToManys().get(0);
-
- OrmJoinTable ormJoinTable = ormManyToManyMapping.getRelationshipReference().getJoinTableJoiningStrategy().getJoinTable();
- OrmJoinColumn joinColumn = ormJoinTable.addSpecifiedJoinColumn(0);
- XmlJoinTable joinTableResource = manyToMany.getJoinTable();
- XmlJoinColumn joinColumnResource = joinTableResource.getJoinColumns().get(0);
-
- assertNull(joinColumn.getSpecifiedName());
- assertNull(joinColumnResource.getName());
-
- //set name in the context model, verify resource model modified
- joinColumn.setSpecifiedName("foo");
- assertEquals("foo", joinColumn.getSpecifiedName());
- assertEquals("foo", joinColumnResource.getName());
-
- //set name to null in the context model
- joinColumn.setSpecifiedName(null);
- assertNull(joinColumn.getSpecifiedName());
- assertNull(joinTableResource.getJoinColumns().get(0).getName());
- }
-
- public void testUpdateSpecifiedReferencedColumnName() throws Exception {
- OrmPersistentType ormPersistentType = getEntityMappings().addPersistentType(MappingKeys.ENTITY_TYPE_MAPPING_KEY, "model.Foo");
- OrmPersistentAttribute ormPersistentAttribute = ormPersistentType.addSpecifiedPersistentAttribute(MappingKeys.MANY_TO_MANY_ATTRIBUTE_MAPPING_KEY, "manyToManyMapping");
- OrmManyToManyMapping ormManyToManyMapping = (OrmManyToManyMapping) ormPersistentAttribute.getMapping();
- XmlManyToMany manyToMany = getXmlEntityMappings().getEntities().get(0).getAttributes().getManyToManys().get(0);
-
- OrmJoinTable ormJoinTable = ormManyToManyMapping.getRelationshipReference().getJoinTableJoiningStrategy().getJoinTable();
- OrmJoinColumn joinColumn = ormJoinTable.addSpecifiedJoinColumn(0);
- XmlJoinTable joinTableResource = manyToMany.getJoinTable();
- XmlJoinColumn joinColumnResource = joinTableResource.getJoinColumns().get(0);
-
- assertNull(joinColumn.getSpecifiedReferencedColumnName());
- assertNull(joinColumnResource.getReferencedColumnName());
-
- //set name in the resource model, verify context model updated
- joinColumnResource.setReferencedColumnName("FOO");
- assertEquals("FOO", joinColumn.getSpecifiedReferencedColumnName());
- assertEquals("FOO", joinColumnResource.getReferencedColumnName());
-
- //set name to null in the resource model
- joinColumnResource.setReferencedColumnName(null);
- assertNull(joinColumn.getSpecifiedReferencedColumnName());
- assertNull(joinColumnResource.getReferencedColumnName());
-
- joinColumnResource.setReferencedColumnName("FOO");
- assertEquals("FOO", joinColumn.getSpecifiedReferencedColumnName());
- assertEquals("FOO", joinColumnResource.getReferencedColumnName());
-
- joinTableResource.getJoinColumns().remove(0);
- assertFalse(ormJoinTable.specifiedJoinColumns().hasNext());
- assertTrue(joinTableResource.getJoinColumns().isEmpty());
- }
-
- public void testModifySpecifiedReferencedColumnName() throws Exception {
- OrmPersistentType ormPersistentType = getEntityMappings().addPersistentType(MappingKeys.ENTITY_TYPE_MAPPING_KEY, "model.Foo");
- OrmPersistentAttribute ormPersistentAttribute = ormPersistentType.addSpecifiedPersistentAttribute(MappingKeys.MANY_TO_MANY_ATTRIBUTE_MAPPING_KEY, "manyToManyMapping");
- OrmManyToManyMapping ormManyToManyMapping = (OrmManyToManyMapping) ormPersistentAttribute.getMapping();
- XmlManyToMany manyToMany = getXmlEntityMappings().getEntities().get(0).getAttributes().getManyToManys().get(0);
-
- OrmJoinTable ormJoinTable = ormManyToManyMapping.getRelationshipReference().getJoinTableJoiningStrategy().getJoinTable();
- OrmJoinColumn joinColumn = ormJoinTable.addSpecifiedJoinColumn(0);
- XmlJoinTable joinTableResource = manyToMany.getJoinTable();
- XmlJoinColumn joinColumnResource = joinTableResource.getJoinColumns().get(0);
-
- assertNull(joinColumn.getSpecifiedReferencedColumnName());
- assertNull(joinColumnResource.getReferencedColumnName());
-
- //set name in the context model, verify resource model modified
- joinColumn.setSpecifiedReferencedColumnName("foo");
- assertEquals("foo", joinColumn.getSpecifiedReferencedColumnName());
- assertEquals("foo", joinColumnResource.getReferencedColumnName());
-
- //set name to null in the context model
- joinColumn.setSpecifiedReferencedColumnName(null);
- assertNull(joinColumn.getSpecifiedReferencedColumnName());
- assertNull(joinTableResource.getJoinColumns().get(0).getReferencedColumnName());
- }
-
- public void testUpdateSpecifiedColumnDefinition() throws Exception {
- OrmPersistentType ormPersistentType = getEntityMappings().addPersistentType(MappingKeys.ENTITY_TYPE_MAPPING_KEY, "model.Foo");
- OrmPersistentAttribute ormPersistentAttribute = ormPersistentType.addSpecifiedPersistentAttribute(MappingKeys.MANY_TO_MANY_ATTRIBUTE_MAPPING_KEY, "manyToManyMapping");
- OrmManyToManyMapping ormManyToManyMapping = (OrmManyToManyMapping) ormPersistentAttribute.getMapping();
- XmlManyToMany manyToMany = getXmlEntityMappings().getEntities().get(0).getAttributes().getManyToManys().get(0);
-
- OrmJoinTable ormJoinTable = ormManyToManyMapping.getRelationshipReference().getJoinTableJoiningStrategy().getJoinTable();
- OrmJoinColumn joinColumn = ormJoinTable.addSpecifiedJoinColumn(0);
- XmlJoinTable joinTableResource = manyToMany.getJoinTable();
- XmlJoinColumn joinColumnResource = joinTableResource.getJoinColumns().get(0);
-
- assertNull(joinColumn.getColumnDefinition());
- assertNull(joinColumnResource.getColumnDefinition());
-
- //set name in the resource model, verify context model updated
- joinColumnResource.setColumnDefinition("FOO");
- assertEquals("FOO", joinColumn.getColumnDefinition());
- assertEquals("FOO", joinColumnResource.getColumnDefinition());
-
- //set name to null in the resource model
- joinColumnResource.setColumnDefinition(null);
- assertNull(joinColumn.getColumnDefinition());
- assertNull(joinColumnResource.getColumnDefinition());
-
- joinColumnResource.setColumnDefinition("FOO");
- assertEquals("FOO", joinColumn.getColumnDefinition());
- assertEquals("FOO", joinColumnResource.getColumnDefinition());
-
- joinTableResource.getJoinColumns().remove(0);
- assertFalse(ormJoinTable.specifiedJoinColumns().hasNext());
- assertTrue(joinTableResource.getJoinColumns().isEmpty());
- }
-
- public void testModifySpecifiedColumnDefinition() throws Exception {
- OrmPersistentType ormPersistentType = getEntityMappings().addPersistentType(MappingKeys.ENTITY_TYPE_MAPPING_KEY, "model.Foo");
- OrmPersistentAttribute ormPersistentAttribute = ormPersistentType.addSpecifiedPersistentAttribute(MappingKeys.MANY_TO_MANY_ATTRIBUTE_MAPPING_KEY, "manyToManyMapping");
- OrmManyToManyMapping ormManyToManyMapping = (OrmManyToManyMapping) ormPersistentAttribute.getMapping();
- XmlManyToMany manyToMany = getXmlEntityMappings().getEntities().get(0).getAttributes().getManyToManys().get(0);
-
- OrmJoinTable ormJoinTable = ormManyToManyMapping.getRelationshipReference().getJoinTableJoiningStrategy().getJoinTable();
- OrmJoinColumn joinColumn = ormJoinTable.addSpecifiedJoinColumn(0);
- XmlJoinTable joinTableResource = manyToMany.getJoinTable();
- XmlJoinColumn joinColumnResource = joinTableResource.getJoinColumns().get(0);
-
- assertNull(joinColumn.getColumnDefinition());
- assertNull(joinColumnResource.getColumnDefinition());
-
- //set name in the context model, verify resource model modified
- joinColumn.setColumnDefinition("foo");
- assertEquals("foo", joinColumn.getColumnDefinition());
- assertEquals("foo", joinColumnResource.getColumnDefinition());
-
- //set name to null in the context model
- joinColumn.setColumnDefinition(null);
- assertNull(joinColumn.getColumnDefinition());
- assertNull(joinTableResource.getJoinColumns().get(0).getColumnDefinition());
- }
-
- public void testUpdateSpecifiedTable() throws Exception {
- OrmPersistentType ormPersistentType = getEntityMappings().addPersistentType(MappingKeys.ENTITY_TYPE_MAPPING_KEY, "model.Foo");
- OrmPersistentAttribute ormPersistentAttribute = ormPersistentType.addSpecifiedPersistentAttribute(MappingKeys.MANY_TO_MANY_ATTRIBUTE_MAPPING_KEY, "manyToManyMapping");
- OrmManyToManyMapping ormManyToManyMapping = (OrmManyToManyMapping) ormPersistentAttribute.getMapping();
- XmlManyToMany manyToMany = getXmlEntityMappings().getEntities().get(0).getAttributes().getManyToManys().get(0);
-
- OrmJoinTable ormJoinTable = ormManyToManyMapping.getRelationshipReference().getJoinTableJoiningStrategy().getJoinTable();
- OrmJoinColumn ormJoinColumn = ormJoinTable.addSpecifiedJoinColumn(0);
- XmlJoinTable joinTableResource = manyToMany.getJoinTable();
- XmlJoinColumn joinColumnResource = joinTableResource.getJoinColumns().get(0);
-
- assertNull(ormJoinColumn.getSpecifiedTable());
- assertNull(joinColumnResource.getTable());
-
- //set table in the resource model, verify context model updated
- joinColumnResource.setTable("FOO");
- assertEquals("FOO", ormJoinColumn.getSpecifiedTable());
- assertEquals("FOO", joinColumnResource.getTable());
-
- //set table to null in the resource model
- joinColumnResource.setTable(null);
- assertNull(ormJoinColumn.getSpecifiedTable());
- assertNull(joinColumnResource.getTable());
-
- joinColumnResource.setTable("FOO");
- assertEquals("FOO", ormJoinColumn.getSpecifiedTable());
- assertEquals("FOO", joinColumnResource.getTable());
-
- joinTableResource.getJoinColumns().remove(0);
- assertFalse(ormJoinTable.specifiedJoinColumns().hasNext());
- assertTrue(joinTableResource.getJoinColumns().isEmpty());
- }
-
- public void testModifySpecifiedTable() throws Exception {
- OrmPersistentType ormPersistentType = getEntityMappings().addPersistentType(MappingKeys.ENTITY_TYPE_MAPPING_KEY, "model.Foo");
- OrmPersistentAttribute ormPersistentAttribute = ormPersistentType.addSpecifiedPersistentAttribute(MappingKeys.MANY_TO_MANY_ATTRIBUTE_MAPPING_KEY, "manyToManyMapping");
- OrmManyToManyMapping ormManyToManyMapping = (OrmManyToManyMapping) ormPersistentAttribute.getMapping();
- XmlManyToMany manyToMany = getXmlEntityMappings().getEntities().get(0).getAttributes().getManyToManys().get(0);
-
- OrmJoinTable ormJoinTable = ormManyToManyMapping.getRelationshipReference().getJoinTableJoiningStrategy().getJoinTable();
- OrmJoinColumn ormJoinColumn = ormJoinTable.addSpecifiedJoinColumn(0);
- XmlJoinTable joinTableResource = manyToMany.getJoinTable();
- XmlJoinColumn joinColumnResource = joinTableResource.getJoinColumns().get(0);
-
- assertNull(ormJoinColumn.getSpecifiedTable());
- assertNull(joinColumnResource.getTable());
-
- //set table in the context model, verify resource model modified
- ormJoinColumn.setSpecifiedTable("foo");
- assertEquals("foo", ormJoinColumn.getSpecifiedTable());
- assertEquals("foo", joinColumnResource.getTable());
-
- //set table to null in the context model
- ormJoinColumn.setSpecifiedTable(null);
- assertNull(ormJoinColumn.getSpecifiedTable());
- assertNull(joinTableResource.getJoinColumns().get(0).getTable());
- }
-
- public void testUpdateSpecifiedNullable() throws Exception {
- OrmPersistentType ormPersistentType = getEntityMappings().addPersistentType(MappingKeys.ENTITY_TYPE_MAPPING_KEY, "model.Foo");
- OrmPersistentAttribute ormPersistentAttribute = ormPersistentType.addSpecifiedPersistentAttribute(MappingKeys.MANY_TO_MANY_ATTRIBUTE_MAPPING_KEY, "manyToManyMapping");
- OrmManyToManyMapping ormManyToManyMapping = (OrmManyToManyMapping) ormPersistentAttribute.getMapping();
- XmlManyToMany manyToMany = getXmlEntityMappings().getEntities().get(0).getAttributes().getManyToManys().get(0);
-
- OrmJoinTable ormJoinTable = ormManyToManyMapping.getRelationshipReference().getJoinTableJoiningStrategy().getJoinTable();
- OrmJoinColumn ormJoinColumn = ormJoinTable.addSpecifiedJoinColumn(0);
- XmlJoinTable joinTableResource = manyToMany.getJoinTable();
- XmlJoinColumn joinColumnResource = joinTableResource.getJoinColumns().get(0);
-
- assertNull(ormJoinColumn.getSpecifiedNullable());
- assertNull(joinColumnResource.getNullable());
-
- //set nullable in the resource model, verify context model updated
- joinColumnResource.setNullable(Boolean.TRUE);
- assertEquals(Boolean.TRUE, ormJoinColumn.getSpecifiedNullable());
- assertEquals(Boolean.TRUE, joinColumnResource.getNullable());
-
- //set nullable to null in the resource model
- joinColumnResource.setNullable(null);
- assertNull(ormJoinColumn.getSpecifiedNullable());
- assertNull(joinColumnResource.getNullable());
-
- joinColumnResource.setNullable(Boolean.FALSE);
- assertEquals(Boolean.FALSE, ormJoinColumn.getSpecifiedNullable());
- assertEquals(Boolean.FALSE, joinColumnResource.getNullable());
-
- joinTableResource.getJoinColumns().remove(0);
- assertFalse(ormJoinTable.specifiedJoinColumns().hasNext());
- assertTrue(joinTableResource.getJoinColumns().isEmpty());
- }
-
- public void testModifySpecifiedNullable() throws Exception {
- OrmPersistentType ormPersistentType = getEntityMappings().addPersistentType(MappingKeys.ENTITY_TYPE_MAPPING_KEY, "model.Foo");
- OrmPersistentAttribute ormPersistentAttribute = ormPersistentType.addSpecifiedPersistentAttribute(MappingKeys.MANY_TO_MANY_ATTRIBUTE_MAPPING_KEY, "manyToManyMapping");
- OrmManyToManyMapping ormManyToManyMapping = (OrmManyToManyMapping) ormPersistentAttribute.getMapping();
- XmlManyToMany manyToMany = getXmlEntityMappings().getEntities().get(0).getAttributes().getManyToManys().get(0);
-
- OrmJoinTable ormJoinTable = ormManyToManyMapping.getRelationshipReference().getJoinTableJoiningStrategy().getJoinTable();
- OrmJoinColumn ormJoinColumn = ormJoinTable.addSpecifiedJoinColumn(0);
- XmlJoinTable joinTableResource = manyToMany.getJoinTable();
- XmlJoinColumn joinColumnResource = joinTableResource.getJoinColumns().get(0);
-
- assertNull(ormJoinColumn.getSpecifiedNullable());
- assertNull(joinColumnResource.getNullable());
-
- //set nullable in the context model, verify resource model modified
- ormJoinColumn.setSpecifiedNullable(Boolean.FALSE);
- assertEquals(Boolean.FALSE, ormJoinColumn.getSpecifiedNullable());
- assertEquals(Boolean.FALSE, joinColumnResource.getNullable());
-
- //set nullable to null in the context model
- ormJoinColumn.setSpecifiedNullable(null);
- assertNull(ormJoinColumn.getSpecifiedNullable());
- assertNull(joinTableResource.getJoinColumns().get(0).getNullable());
- }
-
- public void testUpdateSpecifiedUpdatable() throws Exception {
- OrmPersistentType ormPersistentType = getEntityMappings().addPersistentType(MappingKeys.ENTITY_TYPE_MAPPING_KEY, "model.Foo");
- OrmPersistentAttribute ormPersistentAttribute = ormPersistentType.addSpecifiedPersistentAttribute(MappingKeys.MANY_TO_MANY_ATTRIBUTE_MAPPING_KEY, "manyToManyMapping");
- OrmManyToManyMapping ormManyToManyMapping = (OrmManyToManyMapping) ormPersistentAttribute.getMapping();
- XmlManyToMany manyToMany = getXmlEntityMappings().getEntities().get(0).getAttributes().getManyToManys().get(0);
-
- OrmJoinTable ormJoinTable = ormManyToManyMapping.getRelationshipReference().getJoinTableJoiningStrategy().getJoinTable();
- OrmJoinColumn ormJoinColumn = ormJoinTable.addSpecifiedJoinColumn(0);
- XmlJoinTable joinTableResource = manyToMany.getJoinTable();
- XmlJoinColumn joinColumnResource = joinTableResource.getJoinColumns().get(0);
-
- assertNull(ormJoinColumn.getSpecifiedUpdatable());
- assertNull(joinColumnResource.getUpdatable());
-
- //set updatable in the resource model, verify context model updated
- joinColumnResource.setUpdatable(Boolean.TRUE);
- assertEquals(Boolean.TRUE, ormJoinColumn.getSpecifiedUpdatable());
- assertEquals(Boolean.TRUE, joinColumnResource.getUpdatable());
-
- //set updatable to null in the resource model
- joinColumnResource.setUpdatable(null);
- assertNull(ormJoinColumn.getSpecifiedUpdatable());
- assertNull(joinColumnResource.getUpdatable());
-
- joinColumnResource.setUpdatable(Boolean.FALSE);
- assertEquals(Boolean.FALSE, ormJoinColumn.getSpecifiedUpdatable());
- assertEquals(Boolean.FALSE, joinColumnResource.getUpdatable());
-
- joinTableResource.getJoinColumns().remove(0);
- assertFalse(ormJoinTable.specifiedJoinColumns().hasNext());
- assertTrue(joinTableResource.getJoinColumns().isEmpty());
- }
-
- public void testModifySpecifiedUpdatable() throws Exception {
- OrmPersistentType ormPersistentType = getEntityMappings().addPersistentType(MappingKeys.ENTITY_TYPE_MAPPING_KEY, "model.Foo");
- OrmPersistentAttribute ormPersistentAttribute = ormPersistentType.addSpecifiedPersistentAttribute(MappingKeys.MANY_TO_MANY_ATTRIBUTE_MAPPING_KEY, "manyToManyMapping");
- OrmManyToManyMapping ormManyToManyMapping = (OrmManyToManyMapping) ormPersistentAttribute.getMapping();
- XmlManyToMany manyToMany = getXmlEntityMappings().getEntities().get(0).getAttributes().getManyToManys().get(0);
-
- OrmJoinTable ormJoinTable = ormManyToManyMapping.getRelationshipReference().getJoinTableJoiningStrategy().getJoinTable();
- OrmJoinColumn ormJoinColumn = ormJoinTable.addSpecifiedJoinColumn(0);
- XmlJoinTable joinTableResource = manyToMany.getJoinTable();
- XmlJoinColumn joinColumnResource = joinTableResource.getJoinColumns().get(0);
-
- assertNull(ormJoinColumn.getSpecifiedUpdatable());
- assertNull(joinColumnResource.getUpdatable());
-
- //set updatable in the context model, verify resource model modified
- ormJoinColumn.setSpecifiedUpdatable(Boolean.FALSE);
- assertEquals(Boolean.FALSE, ormJoinColumn.getSpecifiedUpdatable());
- assertEquals(Boolean.FALSE, joinColumnResource.getUpdatable());
-
- //set updatable to null in the context model
- ormJoinColumn.setSpecifiedUpdatable(null);
- assertNull(ormJoinColumn.getSpecifiedUpdatable());
- assertNull(joinTableResource.getJoinColumns().get(0).getUpdatable());
- }
-
- public void testUpdateSpecifiedInsertable() throws Exception {
- OrmPersistentType ormPersistentType = getEntityMappings().addPersistentType(MappingKeys.ENTITY_TYPE_MAPPING_KEY, "model.Foo");
- OrmPersistentAttribute ormPersistentAttribute = ormPersistentType.addSpecifiedPersistentAttribute(MappingKeys.MANY_TO_MANY_ATTRIBUTE_MAPPING_KEY, "manyToManyMapping");
- OrmManyToManyMapping ormManyToManyMapping = (OrmManyToManyMapping) ormPersistentAttribute.getMapping();
- XmlManyToMany manyToMany = getXmlEntityMappings().getEntities().get(0).getAttributes().getManyToManys().get(0);
-
- OrmJoinTable ormJoinTable = ormManyToManyMapping.getRelationshipReference().getJoinTableJoiningStrategy().getJoinTable();
- OrmJoinColumn ormJoinColumn = ormJoinTable.addSpecifiedJoinColumn(0);
- XmlJoinTable joinTableResource = manyToMany.getJoinTable();
- XmlJoinColumn joinColumnResource = joinTableResource.getJoinColumns().get(0);
-
- assertNull(ormJoinColumn.getSpecifiedInsertable());
- assertNull(joinColumnResource.getInsertable());
-
- //set insertable in the resource model, verify context model updated
- joinColumnResource.setInsertable(Boolean.TRUE);
- assertEquals(Boolean.TRUE, ormJoinColumn.getSpecifiedInsertable());
- assertEquals(Boolean.TRUE, joinColumnResource.getInsertable());
-
- //set insertable to null in the resource model
- joinColumnResource.setInsertable(null);
- assertNull(ormJoinColumn.getSpecifiedInsertable());
- assertNull(joinColumnResource.getInsertable());
-
- joinColumnResource.setInsertable(Boolean.FALSE);
- assertEquals(Boolean.FALSE, ormJoinColumn.getSpecifiedInsertable());
- assertEquals(Boolean.FALSE, joinColumnResource.getInsertable());
-
- joinTableResource.getJoinColumns().remove(0);
- assertFalse(ormJoinTable.specifiedJoinColumns().hasNext());
- assertTrue(joinTableResource.getJoinColumns().isEmpty());
- }
-
- public void testModifySpecifiedInsertable() throws Exception {
- OrmPersistentType ormPersistentType = getEntityMappings().addPersistentType(MappingKeys.ENTITY_TYPE_MAPPING_KEY, "model.Foo");
- OrmPersistentAttribute ormPersistentAttribute = ormPersistentType.addSpecifiedPersistentAttribute(MappingKeys.MANY_TO_MANY_ATTRIBUTE_MAPPING_KEY, "manyToManyMapping");
- OrmManyToManyMapping ormManyToManyMapping = (OrmManyToManyMapping) ormPersistentAttribute.getMapping();
- XmlManyToMany manyToMany = getXmlEntityMappings().getEntities().get(0).getAttributes().getManyToManys().get(0);
-
- OrmJoinTable ormJoinTable = ormManyToManyMapping.getRelationshipReference().getJoinTableJoiningStrategy().getJoinTable();
- OrmJoinColumn ormJoinColumn = ormJoinTable.addSpecifiedJoinColumn(0);
- XmlJoinTable joinTableResource = manyToMany.getJoinTable();
- XmlJoinColumn joinColumnResource = joinTableResource.getJoinColumns().get(0);
-
- assertNull(ormJoinColumn.getSpecifiedInsertable());
- assertNull(joinColumnResource.getInsertable());
-
- //set insertable in the context model, verify resource model modified
- ormJoinColumn.setSpecifiedInsertable(Boolean.FALSE);
- assertEquals(Boolean.FALSE, ormJoinColumn.getSpecifiedInsertable());
- assertEquals(Boolean.FALSE, joinColumnResource.getInsertable());
-
- //set insertable to null in the context model
- ormJoinColumn.setSpecifiedInsertable(null);
- assertNull(ormJoinColumn.getSpecifiedInsertable());
- assertNull(joinTableResource.getJoinColumns().get(0).getInsertable());
- }
-
- public void testUpdateSpecifiedUnique() throws Exception {
- OrmPersistentType ormPersistentType = getEntityMappings().addPersistentType(MappingKeys.ENTITY_TYPE_MAPPING_KEY, "model.Foo");
- OrmPersistentAttribute ormPersistentAttribute = ormPersistentType.addSpecifiedPersistentAttribute(MappingKeys.MANY_TO_MANY_ATTRIBUTE_MAPPING_KEY, "manyToManyMapping");
- OrmManyToManyMapping ormManyToManyMapping = (OrmManyToManyMapping) ormPersistentAttribute.getMapping();
- XmlManyToMany manyToMany = getXmlEntityMappings().getEntities().get(0).getAttributes().getManyToManys().get(0);
-
- OrmJoinTable ormJoinTable = ormManyToManyMapping.getRelationshipReference().getJoinTableJoiningStrategy().getJoinTable();
- OrmJoinColumn ormJoinColumn = ormJoinTable.addSpecifiedJoinColumn(0);
- XmlJoinTable joinTableResource = manyToMany.getJoinTable();
- XmlJoinColumn joinColumnResource = joinTableResource.getJoinColumns().get(0);
-
- assertNull(ormJoinColumn.getSpecifiedUnique());
- assertNull(joinColumnResource.getUnique());
-
- //set unique in the resource model, verify context model updated
- joinColumnResource.setUnique(Boolean.TRUE);
- assertEquals(Boolean.TRUE, ormJoinColumn.getSpecifiedUnique());
- assertEquals(Boolean.TRUE, joinColumnResource.getUnique());
-
- //set unique to null in the resource model
- joinColumnResource.setUnique(null);
- assertNull(ormJoinColumn.getSpecifiedUnique());
- assertNull(joinColumnResource.getUnique());
-
- joinColumnResource.setUnique(Boolean.FALSE);
- assertEquals(Boolean.FALSE, ormJoinColumn.getSpecifiedUnique());
- assertEquals(Boolean.FALSE, joinColumnResource.getUnique());
-
- joinTableResource.getJoinColumns().remove(0);
- assertFalse(ormJoinTable.specifiedJoinColumns().hasNext());
- assertTrue(joinTableResource.getJoinColumns().isEmpty());
- }
-
- public void testModifySpecifiedUnique() throws Exception {
- OrmPersistentType ormPersistentType = getEntityMappings().addPersistentType(MappingKeys.ENTITY_TYPE_MAPPING_KEY, "model.Foo");
- OrmPersistentAttribute ormPersistentAttribute = ormPersistentType.addSpecifiedPersistentAttribute(MappingKeys.MANY_TO_MANY_ATTRIBUTE_MAPPING_KEY, "manyToManyMapping");
- OrmManyToManyMapping ormManyToManyMapping = (OrmManyToManyMapping) ormPersistentAttribute.getMapping();
- XmlManyToMany manyToMany = getXmlEntityMappings().getEntities().get(0).getAttributes().getManyToManys().get(0);
-
- OrmJoinTable ormJoinTable = ormManyToManyMapping.getRelationshipReference().getJoinTableJoiningStrategy().getJoinTable();
- OrmJoinColumn ormJoinColumn = ormJoinTable.addSpecifiedJoinColumn(0);
- XmlJoinTable joinTableResource = manyToMany.getJoinTable();
- XmlJoinColumn joinColumnResource = joinTableResource.getJoinColumns().get(0);
-
- assertNull(ormJoinColumn.getSpecifiedUnique());
- assertNull(joinColumnResource.getUnique());
-
- //set unique in the context model, verify resource model modified
- ormJoinColumn.setSpecifiedUnique(Boolean.FALSE);
- assertEquals(Boolean.FALSE, ormJoinColumn.getSpecifiedUnique());
- assertEquals(Boolean.FALSE, joinColumnResource.getUnique());
-
- //set unique to null in the context model
- ormJoinColumn.setSpecifiedUnique(null);
- assertNull(ormJoinColumn.getSpecifiedUnique());
- assertNull(joinTableResource.getJoinColumns().get(0).getUnique());
- }
-
-} \ No newline at end of file
diff --git a/jpa/tests/org.eclipse.jpt.core.tests/src/org/eclipse/jpt/core/tests/internal/context/orm/OrmJoinTableTests.java b/jpa/tests/org.eclipse.jpt.core.tests/src/org/eclipse/jpt/core/tests/internal/context/orm/OrmJoinTableTests.java
deleted file mode 100644
index ec39dcd385..0000000000
--- a/jpa/tests/org.eclipse.jpt.core.tests/src/org/eclipse/jpt/core/tests/internal/context/orm/OrmJoinTableTests.java
+++ /dev/null
@@ -1,1156 +0,0 @@
-/*******************************************************************************
- * Copyright (c) 2007, 2009 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.
- *
- * Contributors:
- * Oracle - initial API and implementation
- ******************************************************************************/
-package org.eclipse.jpt.core.tests.internal.context.orm;
-
-import java.util.Iterator;
-import java.util.ListIterator;
-import org.eclipse.jdt.core.ICompilationUnit;
-import org.eclipse.jpt.core.JptCorePlugin;
-import org.eclipse.jpt.core.MappingKeys;
-import org.eclipse.jpt.core.context.java.JavaEntity;
-import org.eclipse.jpt.core.context.java.JavaJoinColumn;
-import org.eclipse.jpt.core.context.java.JavaJoinTable;
-import org.eclipse.jpt.core.context.java.JavaManyToManyMapping;
-import org.eclipse.jpt.core.context.java.JavaPersistentAttribute;
-import org.eclipse.jpt.core.context.orm.OrmEntity;
-import org.eclipse.jpt.core.context.orm.OrmJoinColumn;
-import org.eclipse.jpt.core.context.orm.OrmJoinTable;
-import org.eclipse.jpt.core.context.orm.OrmManyToManyMapping;
-import org.eclipse.jpt.core.context.orm.OrmPersistentAttribute;
-import org.eclipse.jpt.core.context.orm.OrmPersistentType;
-import org.eclipse.jpt.core.context.orm.OrmUniqueConstraint;
-import org.eclipse.jpt.core.resource.java.JPA;
-import org.eclipse.jpt.core.resource.orm.OrmFactory;
-import org.eclipse.jpt.core.resource.orm.XmlJoinTable;
-import org.eclipse.jpt.core.resource.orm.XmlManyToMany;
-import org.eclipse.jpt.core.resource.orm.XmlUniqueConstraint;
-import org.eclipse.jpt.core.resource.persistence.PersistenceFactory;
-import org.eclipse.jpt.core.resource.persistence.XmlMappingFileRef;
-import org.eclipse.jpt.core.tests.internal.context.ContextModelTestCase;
-import org.eclipse.jpt.core.tests.internal.projects.TestJavaProject.SourceWriter;
-import org.eclipse.jpt.utility.internal.iterators.ArrayIterator;
-
-@SuppressWarnings("nls")
-public class OrmJoinTableTests extends ContextModelTestCase
-{
- public OrmJoinTableTests(String name) {
- super(name);
- }
-
- @Override
- protected void setUp() throws Exception {
- super.setUp();
- XmlMappingFileRef mappingFileRef = PersistenceFactory.eINSTANCE.createXmlMappingFileRef();
- mappingFileRef.setFileName(JptCorePlugin.DEFAULT_ORM_XML_FILE_PATH);
- getXmlPersistenceUnit().getMappingFiles().add(mappingFileRef);
- getPersistenceXmlResource().save(null);
- }
-
- private ICompilationUnit createTestEntityWithValidManyToMany() throws Exception {
- return this.createTestType(new DefaultAnnotationWriter() {
- @Override
- public Iterator<String> imports() {
- return new ArrayIterator<String>(JPA.ENTITY, JPA.MANY_TO_MANY, JPA.ID, "java.util.Collection");
- }
- @Override
- public void appendTypeAnnotationTo(StringBuilder sb) {
- sb.append("@Entity");
- }
- @Override
- public void appendIdFieldAnnotationTo(StringBuilder sb) {
- sb.append("@ManyToMany").append(CR);
- sb.append(" private Collection<Project> projects;").append(CR);
- sb.append("@Id").append(CR);
- }
- });
- }
-
- private void createTargetEntity() throws Exception {
- SourceWriter sourceWriter = new SourceWriter() {
- public void appendSourceTo(StringBuilder sb) {
- sb.append(CR);
- sb.append("import ");
- sb.append(JPA.ENTITY);
- sb.append(";");
- sb.append(CR);
- sb.append("import ");
- sb.append(JPA.ID);
- sb.append(";");
- sb.append(CR);
- sb.append(CR);
- sb.append("@Entity");
- sb.append(CR);
- sb.append("public class Project {").append(CR);
- sb.append(CR);
- sb.append(" @Id").append(CR);
- sb.append(" private int proj_id;").append(CR);
- sb.append(CR);
- }
- };
- this.javaProject.createCompilationUnit(PACKAGE_NAME, "Project.java", sourceWriter);
- }
-
- public void testUpdateSpecifiedName() throws Exception {
- OrmPersistentType ormPersistentType = getEntityMappings().addPersistentType(MappingKeys.ENTITY_TYPE_MAPPING_KEY, "model.Foo");
- OrmPersistentAttribute ormPersistentAttribute = ormPersistentType.addSpecifiedPersistentAttribute(MappingKeys.MANY_TO_MANY_ATTRIBUTE_MAPPING_KEY, "manyToManyMapping");
- OrmManyToManyMapping ormManyToManyMapping = (OrmManyToManyMapping) ormPersistentAttribute.getMapping();
- XmlManyToMany manyToMany = getXmlEntityMappings().getEntities().get(0).getAttributes().getManyToManys().get(0);
-
- OrmJoinTable ormJoinTable = ormManyToManyMapping.getRelationshipReference().getJoinTableJoiningStrategy().getJoinTable();
-
- assertNull(ormJoinTable.getSpecifiedName());
- assertNull(manyToMany.getJoinTable());
-
-
- //set name in the resource model, verify context model updated
- manyToMany.setJoinTable(OrmFactory.eINSTANCE.createXmlJoinTable());
- manyToMany.getJoinTable().setName("FOO");
- assertEquals("FOO", ormJoinTable.getSpecifiedName());
- assertEquals("FOO", manyToMany.getJoinTable().getName());
-
- //set name to null in the resource model
- manyToMany.getJoinTable().setName(null);
- assertNull(ormJoinTable.getSpecifiedName());
- assertNull(manyToMany.getJoinTable().getName());
-
- manyToMany.getJoinTable().setName("FOO");
- assertEquals("FOO", ormJoinTable.getSpecifiedName());
- assertEquals("FOO", manyToMany.getJoinTable().getName());
-
- manyToMany.setJoinTable(null);
- assertNull(ormJoinTable.getSpecifiedName());
- assertNull(manyToMany.getJoinTable());
- }
-
- public void testModifySpecifiedName() throws Exception {
- OrmPersistentType ormPersistentType = getEntityMappings().addPersistentType(MappingKeys.ENTITY_TYPE_MAPPING_KEY, "model.Foo");
- OrmPersistentAttribute ormPersistentAttribute = ormPersistentType.addSpecifiedPersistentAttribute(MappingKeys.MANY_TO_MANY_ATTRIBUTE_MAPPING_KEY, "manyToManyMapping");
- OrmManyToManyMapping ormManyToManyMapping = (OrmManyToManyMapping) ormPersistentAttribute.getMapping();
- XmlManyToMany manyToMany = getXmlEntityMappings().getEntities().get(0).getAttributes().getManyToManys().get(0);
-
- OrmJoinTable ormJoinTable = ormManyToManyMapping.getRelationshipReference().getJoinTableJoiningStrategy().getJoinTable();
-
- assertNull(ormJoinTable.getSpecifiedName());
- assertNull(manyToMany.getJoinTable());
-
- //set name in the context model, verify resource model modified
- ormJoinTable.setSpecifiedName("foo");
- assertEquals("foo", ormJoinTable.getSpecifiedName());
- assertEquals("foo", manyToMany.getJoinTable().getName());
-
- //set name to null in the context model
- ormJoinTable.setSpecifiedName(null);
- assertNull(ormJoinTable.getSpecifiedName());
- assertNull(manyToMany.getJoinTable());
- }
-
- public void testVirtualJoinTable() throws Exception {
- createTestEntityWithValidManyToMany();
-
- OrmPersistentType ormPersistentType = getEntityMappings().addPersistentType(MappingKeys.ENTITY_TYPE_MAPPING_KEY, FULLY_QUALIFIED_TYPE_NAME);
-
- OrmPersistentAttribute ormPersistentAttribute = ormPersistentType.getAttributeNamed("projects");
- OrmManyToManyMapping ormManyToManyMapping = (OrmManyToManyMapping) ormPersistentAttribute.getMapping();
- OrmJoinTable ormJoinTable = ormManyToManyMapping.getRelationshipReference().getJoinTableJoiningStrategy().getJoinTable();
-
- assertTrue(ormPersistentAttribute.isVirtual());
- assertEquals(null, ormJoinTable.getSpecifiedName());
-
- createTargetEntity();
- getEntityMappings().addPersistentType(MappingKeys.ENTITY_TYPE_MAPPING_KEY, PACKAGE_NAME + ".Project");
-
- assertEquals(TYPE_NAME + "_Project", ormJoinTable.getSpecifiedName());
- assertNull(ormJoinTable.getSpecifiedCatalog());
- assertNull(ormJoinTable.getSpecifiedSchema());
- assertEquals(0, ormJoinTable.specifiedJoinColumnsSize());
- assertEquals(0, ormJoinTable.specifiedInverseJoinColumnsSize());
- OrmJoinColumn ormJoinColumn = ormJoinTable.getDefaultJoinColumn();
-//TODO need to test joinColumn defaults here as well as in java and all the relatioship mapping types
-// assertEquals("id_project_id", ormJoinColumn.getDefaultName());
-// assertEquals("id_project_id", ormJoinColumn.getDefaultReferencedColumnName());
- OrmJoinColumn inverseOrmJoinColumn = ormJoinTable.getDefaultInverseJoinColumn();
-// assertEquals("id_project_id", inverseOrmJoinColumn.getDefaultName());
-// assertEquals("id_project_id", inverseOrmJoinColumn.getDefaultReferencedColumnName());
-
- JavaPersistentAttribute javaPersistentAttribute = ormPersistentAttribute.getJavaPersistentAttribute();
- JavaManyToManyMapping javaManyToManyMapping = (JavaManyToManyMapping) javaPersistentAttribute.getMapping();
- JavaJoinTable javaJoinTable = javaManyToManyMapping.getRelationshipReference().getJoinTableJoiningStrategy().getJoinTable();
- javaJoinTable.setSpecifiedName("FOO");
- javaJoinTable.setSpecifiedCatalog("CATALOG");
- javaJoinTable.setSpecifiedSchema("SCHEMA");
- JavaJoinColumn javaJoinColumn = javaJoinTable.addSpecifiedJoinColumn(0);
- javaJoinColumn.setSpecifiedName("NAME");
- javaJoinColumn.setSpecifiedReferencedColumnName("REFERENCED_NAME");
- JavaJoinColumn inverseJavaJoinColumn = javaJoinTable.addSpecifiedInverseJoinColumn(0);
- inverseJavaJoinColumn.setSpecifiedName("INVERSE_NAME");
- inverseJavaJoinColumn.setSpecifiedReferencedColumnName("INVERSE_REFERENCED_NAME");
-
- assertEquals("FOO", ormJoinTable.getSpecifiedName());
- assertEquals("CATALOG", ormJoinTable.getSpecifiedCatalog());
- assertEquals("SCHEMA", ormJoinTable.getSpecifiedSchema());
- assertEquals(1, ormJoinTable.specifiedJoinColumnsSize());
- assertEquals(1, ormJoinTable.specifiedInverseJoinColumnsSize());
- ormJoinColumn = ormJoinTable.specifiedJoinColumns().next();
- assertEquals("NAME", ormJoinColumn.getSpecifiedName());
- assertEquals("REFERENCED_NAME", ormJoinColumn.getSpecifiedReferencedColumnName());
- inverseOrmJoinColumn = ormJoinTable.specifiedInverseJoinColumns().next();
- assertEquals("INVERSE_NAME", inverseOrmJoinColumn.getSpecifiedName());
- assertEquals("INVERSE_REFERENCED_NAME", inverseOrmJoinColumn.getSpecifiedReferencedColumnName());
- }
-
- public void testUpdateDefaultNameFromJavaTable() throws Exception {
- createTestEntityWithValidManyToMany();
-
- OrmPersistentType ormPersistentType = getEntityMappings().addPersistentType(MappingKeys.ENTITY_TYPE_MAPPING_KEY, FULLY_QUALIFIED_TYPE_NAME);
-
- OrmPersistentAttribute ormPersistentAttribute = ormPersistentType.addSpecifiedPersistentAttribute(MappingKeys.MANY_TO_MANY_ATTRIBUTE_MAPPING_KEY, "projects");
- OrmManyToManyMapping ormManyToManyMapping = (OrmManyToManyMapping) ormPersistentAttribute.getMapping();
-
- OrmJoinTable ormJoinTable = ormManyToManyMapping.getRelationshipReference().getJoinTableJoiningStrategy().getJoinTable();
- assertEquals(null, ormJoinTable.getDefaultName());
-
- createTargetEntity();
- OrmPersistentType targetPersistentType = getEntityMappings().addPersistentType(MappingKeys.ENTITY_TYPE_MAPPING_KEY, PACKAGE_NAME + ".Project");
- assertEquals(TYPE_NAME + "_Project", ormJoinTable.getDefaultName());
-
-
- ((JavaEntity) targetPersistentType.getJavaPersistentType().getMapping()).getTable().setSpecifiedName("FOO");
- assertEquals(TYPE_NAME + "_FOO", ormJoinTable.getDefaultName());
-
- ((JavaEntity) ormPersistentType.getJavaPersistentType().getMapping()).getTable().setSpecifiedName("BAR");
- assertEquals("BAR_FOO", ormJoinTable.getDefaultName());
-
- ormPersistentType.getJavaPersistentType().getAttributeNamed("projects").setSpecifiedMappingKey(MappingKeys.MANY_TO_MANY_ATTRIBUTE_MAPPING_KEY);
- JavaManyToManyMapping javaManyMapping = (JavaManyToManyMapping) ormPersistentType.getJavaPersistentType().getAttributeNamed("projects").getMapping();
- javaManyMapping.getRelationshipReference().getJoinTableJoiningStrategy().getJoinTable().setSpecifiedName("JAVA_JOIN_TABLE");
-
- assertEquals("BAR_FOO", ormJoinTable.getDefaultName());
-
-
- //set metadata-complete to true, will ignore java annotation settings
- getEntityMappings().getPersistenceUnitMetadata().setXmlMappingMetadataComplete(true);
- //ormPersistentType.getMapping().setSpecifiedMetadataComplete(Boolean.TRUE);
- assertEquals(TYPE_NAME + "_Project", ormJoinTable.getDefaultName());
-
-
- getEntityMappings().getPersistenceUnitMetadata().setXmlMappingMetadataComplete(false);
- //remove m-m mapping from the orm.xml file
- ormPersistentAttribute.makeVirtual();
- //ormPersistentType.getMapping().setSpecifiedMetadataComplete(null);
- ormPersistentAttribute = ormPersistentType.getAttributeNamed("projects");
- ormManyToManyMapping = (OrmManyToManyMapping) ormPersistentAttribute.getMapping();
- ormJoinTable = ormManyToManyMapping.getRelationshipReference().getJoinTableJoiningStrategy().getJoinTable();
- assertTrue(ormPersistentAttribute.isVirtual());
- assertEquals("JAVA_JOIN_TABLE", ormManyToManyMapping.getRelationshipReference().getJoinTableJoiningStrategy().getJoinTable().getSpecifiedName());//specifiedName since this is a virtual mapping now
-
- javaManyMapping.getRelationshipReference().getJoinTableJoiningStrategy().getJoinTable().setSpecifiedName(null);
- assertEquals("BAR_FOO", ormJoinTable.getSpecifiedName());
- assertEquals("BAR_FOO", ormJoinTable.getDefaultName());
-
- ((OrmEntity) ormPersistentType.getMapping()).getTable().setSpecifiedName("ORM_TABLE_NAME");
- assertEquals("ORM_TABLE_NAME_FOO", ormJoinTable.getDefaultName());
-
- ((OrmEntity) targetPersistentType.getMapping()).getTable().setSpecifiedName("ORM_TARGET");
- assertEquals("ORM_TABLE_NAME_ORM_TARGET", ormJoinTable.getDefaultName());
- }
-
- public void testUpdateSpecifiedSchema() throws Exception {
- OrmPersistentType ormPersistentType = getEntityMappings().addPersistentType(MappingKeys.ENTITY_TYPE_MAPPING_KEY, "model.Foo");
- OrmPersistentAttribute ormPersistentAttribute = ormPersistentType.addSpecifiedPersistentAttribute(MappingKeys.MANY_TO_MANY_ATTRIBUTE_MAPPING_KEY, "manyToManyMapping");
- OrmManyToManyMapping ormManyToManyMapping = (OrmManyToManyMapping) ormPersistentAttribute.getMapping();
- XmlManyToMany manyToMany = getXmlEntityMappings().getEntities().get(0).getAttributes().getManyToManys().get(0);
-
- OrmJoinTable ormJoinTable = ormManyToManyMapping.getRelationshipReference().getJoinTableJoiningStrategy().getJoinTable();
-
- assertNull(ormJoinTable.getSpecifiedSchema());
- assertNull(manyToMany.getJoinTable());
-
- //set schema in the resource model, verify context model updated
- manyToMany.setJoinTable(OrmFactory.eINSTANCE.createXmlJoinTable());
- manyToMany.getJoinTable().setSchema("FOO");
- assertEquals("FOO", ormJoinTable.getSpecifiedSchema());
- assertEquals("FOO", manyToMany.getJoinTable().getSchema());
-
- //set Schema to null in the resource model
- manyToMany.getJoinTable().setSchema(null);
- assertNull(ormJoinTable.getSpecifiedSchema());
- assertNull(manyToMany.getJoinTable().getSchema());
-
- manyToMany.getJoinTable().setSchema("FOO");
- assertEquals("FOO", ormJoinTable.getSpecifiedSchema());
- assertEquals("FOO", manyToMany.getJoinTable().getSchema());
-
- manyToMany.setJoinTable(null);
- assertNull(ormJoinTable.getSpecifiedSchema());
- assertNull(manyToMany.getJoinTable());
- }
-
-// public void testUpdateDefaultSchemaFromJavaTable() throws Exception {
-// createTestEntity();
-//
-// OrmPersistentType ormPersistentType = entityMappings().addOrmPersistentType(IMappingKeys.ENTITY_TYPE_MAPPING_KEY, FULLY_QUALIFIED_TYPE_NAME);
-// XmlEntity xmlEntity = (XmlEntity) ormPersistentType.getMapping();
-// assertNull(xmlEntity.getTable().getDefaultSchema());
-//
-// xmlEntity.javaEntity().getTable().setSpecifiedSchema("Foo");
-// assertEquals("Foo", xmlEntity.getTable().getDefaultSchema());
-//
-// xmlEntity.setSpecifiedMetadataComplete(Boolean.TRUE);
-// assertNull(xmlEntity.getTable().getDefaultSchema());
-//
-// xmlEntity.entityMappings().getPersistenceUnitMetadata().setXmlMappingMetadataComplete(true);
-// xmlEntity.setSpecifiedMetadataComplete(Boolean.FALSE);
-// assertNull(xmlEntity.getTable().getDefaultSchema());
-//
-// xmlEntity.setSpecifiedMetadataComplete(null);
-// assertNull(xmlEntity.getTable().getDefaultSchema());
-//
-// xmlEntity.entityMappings().getPersistenceUnitMetadata().setXmlMappingMetadataComplete(false);
-// assertEquals("Foo", xmlEntity.getTable().getDefaultSchema());
-//
-// xmlEntity.getTable().setSpecifiedName("Bar");
-// assertNull(xmlEntity.getTable().getDefaultSchema());
-// }
-//
-// public void testUpdateDefaultSchemaNoJava() throws Exception {
-// createTestEntity();
-//
-// OrmPersistentType ormPersistentType = entityMappings().addOrmPersistentType(IMappingKeys.ENTITY_TYPE_MAPPING_KEY, "model.Foo");
-// XmlEntity xmlEntity = (XmlEntity) ormPersistentType.getMapping();
-// assertNull(xmlEntity.getTable().getDefaultSchema());
-// }
-//
-// public void testUpdateDefaultSchemaFromParent() throws Exception {
-// createTestEntity();
-// createTestSubType();
-//
-// OrmPersistentType parentOrmPersistentType = entityMappings().addOrmPersistentType(IMappingKeys.ENTITY_TYPE_MAPPING_KEY, FULLY_QUALIFIED_TYPE_NAME);
-// OrmPersistentType childOrmPersistentType = entityMappings().addOrmPersistentType(IMappingKeys.ENTITY_TYPE_MAPPING_KEY, PACKAGE_NAME + ".AnnotationTestTypeChild");
-// XmlEntity parentXmlEntity = (XmlEntity) parentOrmPersistentType.getMapping();
-// XmlEntity childXmlEntity = (XmlEntity) childOrmPersistentType.getMapping();
-//
-// assertNull(parentXmlEntity.getTable().getDefaultSchema());
-// assertNull(childXmlEntity.getTable().getDefaultSchema());
-//
-// parentXmlEntity.getTable().setSpecifiedSchema("FOO");
-// assertNull(parentXmlEntity.getTable().getDefaultSchema());
-// assertEquals("FOO", childXmlEntity.getTable().getDefaultSchema());
-//
-// parentXmlEntity.setSpecifiedInheritanceStrategy(InheritanceType.JOINED);
-// assertNull(parentXmlEntity.getTable().getDefaultSchema());
-// assertNull(childXmlEntity.getTable().getDefaultSchema());
-// }
-//
-// public void testUpdateDefaultSchemaFromPersistenceUnitDefaults() throws Exception {
-// createTestEntity();
-//
-// OrmPersistentType ormPersistentType = entityMappings().addOrmPersistentType(IMappingKeys.ENTITY_TYPE_MAPPING_KEY, FULLY_QUALIFIED_TYPE_NAME);
-// XmlEntity xmlEntity = (XmlEntity) ormPersistentType.getMapping();
-// assertNull(xmlEntity.getTable().getDefaultSchema());
-//
-// xmlEntity.entityMappings().getPersistenceUnitMetadata().getPersistenceUnitDefaults().setSchema("FOO");
-// assertEquals("FOO", xmlEntity.getTable().getDefaultSchema());
-//
-// xmlEntity.entityMappings().setSpecifiedSchema("BAR");
-// assertEquals("BAR", xmlEntity.getTable().getDefaultSchema());
-//
-// xmlEntity.javaEntity().getTable().setSpecifiedSchema("JAVA_SCHEMA");
-// assertEquals("JAVA_SCHEMA", xmlEntity.getTable().getDefaultSchema());
-//
-// xmlEntity.getTable().setSpecifiedName("BLAH");
-// //xml entity now has a table element so default schema is not taken from java
-// assertEquals("BAR", xmlEntity.getTable().getDefaultSchema());
-//
-//
-// xmlEntity.entityMappings().setSpecifiedSchema(null);
-// assertEquals("FOO", xmlEntity.getTable().getDefaultSchema());
-//
-// xmlEntity.entityMappings().getPersistenceUnitMetadata().getPersistenceUnitDefaults().setSchema(null);
-// assertNull(xmlEntity.getTable().getDefaultSchema());
-//
-// xmlEntity.getTable().setSpecifiedName(null);
-// assertEquals("JAVA_SCHEMA", xmlEntity.getTable().getDefaultSchema());
-// }
-
- public void testModifySpecifiedSchema() throws Exception {
- OrmPersistentType ormPersistentType = getEntityMappings().addPersistentType(MappingKeys.ENTITY_TYPE_MAPPING_KEY, "model.Foo");
- OrmPersistentAttribute ormPersistentAttribute = ormPersistentType.addSpecifiedPersistentAttribute(MappingKeys.MANY_TO_MANY_ATTRIBUTE_MAPPING_KEY, "manyToManyMapping");
- OrmManyToManyMapping ormManyToManyMapping = (OrmManyToManyMapping) ormPersistentAttribute.getMapping();
- XmlManyToMany manyToMany = getXmlEntityMappings().getEntities().get(0).getAttributes().getManyToManys().get(0);
-
- OrmJoinTable ormJoinTable = ormManyToManyMapping.getRelationshipReference().getJoinTableJoiningStrategy().getJoinTable();
-
- assertNull(ormJoinTable.getSpecifiedSchema());
- assertNull(manyToMany.getJoinTable());
-
- //set Schema in the context model, verify resource model modified
- ormJoinTable.setSpecifiedSchema("foo");
- assertEquals("foo", ormJoinTable.getSpecifiedSchema());
- assertEquals("foo", manyToMany.getJoinTable().getSchema());
-
- //set Schema to null in the context model
- ormJoinTable.setSpecifiedSchema(null);
- assertNull(ormJoinTable.getSpecifiedSchema());
- assertNull(manyToMany.getJoinTable());
- }
-
- public void testUpdateSpecifiedCatalog() throws Exception {
- OrmPersistentType ormPersistentType = getEntityMappings().addPersistentType(MappingKeys.ENTITY_TYPE_MAPPING_KEY, "model.Foo");
- OrmPersistentAttribute ormPersistentAttribute = ormPersistentType.addSpecifiedPersistentAttribute(MappingKeys.MANY_TO_MANY_ATTRIBUTE_MAPPING_KEY, "manyToManyMapping");
- OrmManyToManyMapping ormManyToManyMapping = (OrmManyToManyMapping) ormPersistentAttribute.getMapping();
- XmlManyToMany manyToMany = getXmlEntityMappings().getEntities().get(0).getAttributes().getManyToManys().get(0);
-
- OrmJoinTable ormJoinTable = ormManyToManyMapping.getRelationshipReference().getJoinTableJoiningStrategy().getJoinTable();
-
- assertNull(ormJoinTable.getSpecifiedCatalog());
- assertNull(manyToMany.getJoinTable());
-
- //set Catalog in the resource model, verify context model updated
- manyToMany.setJoinTable(OrmFactory.eINSTANCE.createXmlJoinTable());
- manyToMany.getJoinTable().setCatalog("FOO");
- assertEquals("FOO", ormJoinTable.getSpecifiedCatalog());
- assertEquals("FOO", manyToMany.getJoinTable().getCatalog());
-
- //set Catalog to null in the resource model
- manyToMany.getJoinTable().setCatalog(null);
- assertNull(ormJoinTable.getSpecifiedCatalog());
- assertNull(manyToMany.getJoinTable().getCatalog());
-
- manyToMany.getJoinTable().setCatalog("FOO");
- assertEquals("FOO", ormJoinTable.getSpecifiedCatalog());
- assertEquals("FOO", manyToMany.getJoinTable().getCatalog());
-
- manyToMany.setJoinTable(null);
- assertNull(ormJoinTable.getSpecifiedCatalog());
- assertNull(manyToMany.getJoinTable());
- }
-
- public void testModifySpecifiedCatalog() throws Exception {
- OrmPersistentType ormPersistentType = getEntityMappings().addPersistentType(MappingKeys.ENTITY_TYPE_MAPPING_KEY, "model.Foo");
- OrmPersistentAttribute ormPersistentAttribute = ormPersistentType.addSpecifiedPersistentAttribute(MappingKeys.MANY_TO_MANY_ATTRIBUTE_MAPPING_KEY, "manyToManyMapping");
- OrmManyToManyMapping ormManyToManyMapping = (OrmManyToManyMapping) ormPersistentAttribute.getMapping();
- XmlManyToMany manyToMany = getXmlEntityMappings().getEntities().get(0).getAttributes().getManyToManys().get(0);
-
- OrmJoinTable ormJoinTable = ormManyToManyMapping.getRelationshipReference().getJoinTableJoiningStrategy().getJoinTable();
-
- assertNull(ormJoinTable.getSpecifiedCatalog());
- assertNull(manyToMany.getJoinTable());
-
- //set Catalog in the context model, verify resource model modified
- ormJoinTable.setSpecifiedCatalog("foo");
- assertEquals("foo", ormJoinTable.getSpecifiedCatalog());
- assertEquals("foo", manyToMany.getJoinTable().getCatalog());
-
- //set Catalog to null in the context model
- ormJoinTable.setSpecifiedCatalog(null);
- assertNull(ormJoinTable.getSpecifiedCatalog());
- assertNull(manyToMany.getJoinTable());
- }
-
-// public void testUpdateDefaultCatalogFromJavaTable() throws Exception {
-// createTestEntity();
-//
-// OrmPersistentType ormPersistentType = entityMappings().addOrmPersistentType(IMappingKeys.ENTITY_TYPE_MAPPING_KEY, FULLY_QUALIFIED_TYPE_NAME);
-// XmlEntity xmlEntity = (XmlEntity) ormPersistentType.getMapping();
-// assertNull(xmlEntity.getTable().getDefaultCatalog());
-//
-// xmlEntity.javaEntity().getTable().setSpecifiedCatalog("Foo");
-// assertEquals("Foo", xmlEntity.getTable().getDefaultCatalog());
-//
-// xmlEntity.setSpecifiedMetadataComplete(Boolean.TRUE);
-// assertNull(xmlEntity.getTable().getDefaultCatalog());
-//
-// xmlEntity.entityMappings().getPersistenceUnitMetadata().setXmlMappingMetadataComplete(true);
-// xmlEntity.setSpecifiedMetadataComplete(Boolean.FALSE);
-// assertNull(xmlEntity.getTable().getDefaultCatalog());
-//
-// xmlEntity.setSpecifiedMetadataComplete(null);
-// assertNull(xmlEntity.getTable().getDefaultCatalog());
-//
-// xmlEntity.entityMappings().getPersistenceUnitMetadata().setXmlMappingMetadataComplete(false);
-// assertEquals("Foo", xmlEntity.getTable().getDefaultCatalog());
-//
-// xmlEntity.getTable().setSpecifiedName("Bar");
-// assertNull(xmlEntity.getTable().getDefaultCatalog());
-// }
-//
-// public void testUpdateDefaultCatalogNoJava() throws Exception {
-// createTestEntity();
-//
-// OrmPersistentType ormPersistentType = entityMappings().addOrmPersistentType(IMappingKeys.ENTITY_TYPE_MAPPING_KEY, "model.Foo");
-// XmlEntity xmlEntity = (XmlEntity) ormPersistentType.getMapping();
-// assertNull(xmlEntity.getTable().getDefaultCatalog());
-// }
-//
-// public void testUpdateDefaultCatalogFromParent() throws Exception {
-// createTestEntity();
-// createTestSubType();
-//
-// OrmPersistentType parentOrmPersistentType = entityMappings().addOrmPersistentType(IMappingKeys.ENTITY_TYPE_MAPPING_KEY, FULLY_QUALIFIED_TYPE_NAME);
-// OrmPersistentType childOrmPersistentType = entityMappings().addOrmPersistentType(IMappingKeys.ENTITY_TYPE_MAPPING_KEY, PACKAGE_NAME + ".AnnotationTestTypeChild");
-// XmlEntity parentXmlEntity = (XmlEntity) parentOrmPersistentType.getMapping();
-// XmlEntity childXmlEntity = (XmlEntity) childOrmPersistentType.getMapping();
-//
-// assertNull(parentXmlEntity.getTable().getDefaultCatalog());
-// assertNull(childXmlEntity.getTable().getDefaultCatalog());
-//
-// parentXmlEntity.getTable().setSpecifiedCatalog("FOO");
-// assertNull(parentXmlEntity.getTable().getDefaultCatalog());
-// assertEquals("FOO", childXmlEntity.getTable().getDefaultCatalog());
-//
-// parentXmlEntity.setSpecifiedInheritanceStrategy(InheritanceType.JOINED);
-// assertNull(parentXmlEntity.getTable().getDefaultCatalog());
-// assertNull(childXmlEntity.getTable().getDefaultCatalog());
-// }
-//
-// public void testUpdateDefaultCatalogFromPersistenceUnitDefaults() throws Exception {
-// createTestEntity();
-//
-// OrmPersistentType ormPersistentType = entityMappings().addOrmPersistentType(IMappingKeys.ENTITY_TYPE_MAPPING_KEY, FULLY_QUALIFIED_TYPE_NAME);
-// XmlEntity xmlEntity = (XmlEntity) ormPersistentType.getMapping();
-// assertNull(xmlEntity.getTable().getDefaultCatalog());
-//
-// xmlEntity.entityMappings().getPersistenceUnitMetadata().getPersistenceUnitDefaults().setCatalog("FOO");
-// assertEquals("FOO", xmlEntity.getTable().getDefaultCatalog());
-//
-// xmlEntity.entityMappings().setSpecifiedCatalog("BAR");
-// assertEquals("BAR", xmlEntity.getTable().getDefaultCatalog());
-//
-// xmlEntity.javaEntity().getTable().setSpecifiedCatalog("JAVA_CATALOG");
-// assertEquals("JAVA_CATALOG", xmlEntity.getTable().getDefaultCatalog());
-//
-// xmlEntity.getTable().setSpecifiedName("BLAH");
-// //xml entity now has a table element so default schema is not taken from java
-// assertEquals("BAR", xmlEntity.getTable().getDefaultCatalog());
-//
-//
-// xmlEntity.entityMappings().setSpecifiedCatalog(null);
-// assertEquals("FOO", xmlEntity.getTable().getDefaultCatalog());
-//
-// xmlEntity.entityMappings().getPersistenceUnitMetadata().getPersistenceUnitDefaults().setCatalog(null);
-// assertNull(xmlEntity.getTable().getDefaultCatalog());
-//
-// xmlEntity.getTable().setSpecifiedName(null);
-// assertEquals("JAVA_CATALOG", xmlEntity.getTable().getDefaultCatalog());
-//}
-
-//
-// public void testUpdateName() throws Exception {
-// OrmPersistentType ormPersistentType = entityMappings().addOrmPersistentType(IMappingKeys.ENTITY_TYPE_MAPPING_KEY, "model.Foo");
-// XmlEntity xmlEntity = (XmlEntity) ormPersistentType.getMapping();
-// Entity entityResource = ormResource().getEntityMappings().getEntities().get(0);
-// assertEquals("Foo", xmlEntity.getName());
-//
-// //set class in the resource model, verify context model updated
-// entityResource.setClassName("com.Bar");
-// assertEquals("Bar", xmlEntity.getName());
-//
-// entityResource.setName("Baz");
-// assertEquals("Baz", xmlEntity.getName());
-//
-// //set class to null in the resource model
-// entityResource.setClassName(null);
-// assertEquals("Baz", xmlEntity.getName());
-//
-// entityResource.setName(null);
-// assertNull(xmlEntity.getName());
-// }
-
-
- public void testAddSpecifiedJoinColumn() throws Exception {
- OrmPersistentType ormPersistentType = getEntityMappings().addPersistentType(MappingKeys.ENTITY_TYPE_MAPPING_KEY, "model.Foo");
- OrmPersistentAttribute ormPersistentAttribute = ormPersistentType.addSpecifiedPersistentAttribute(MappingKeys.MANY_TO_MANY_ATTRIBUTE_MAPPING_KEY, "manyToManyMapping");
- OrmManyToManyMapping ormManyToManyMapping = (OrmManyToManyMapping) ormPersistentAttribute.getMapping();
- XmlManyToMany manyToMany = getXmlEntityMappings().getEntities().get(0).getAttributes().getManyToManys().get(0);
-
- OrmJoinTable ormJoinTable = ormManyToManyMapping.getRelationshipReference().getJoinTableJoiningStrategy().getJoinTable();
-
- OrmJoinColumn joinColumn = ormJoinTable.addSpecifiedJoinColumn(0);
- joinColumn.setSpecifiedName("FOO");
-
- XmlJoinTable joinTableResource = manyToMany.getJoinTable();
- assertEquals("FOO", joinTableResource.getJoinColumns().get(0).getName());
-
- OrmJoinColumn joinColumn2 = ormJoinTable.addSpecifiedJoinColumn(0);
- joinColumn2.setSpecifiedName("BAR");
-
- assertEquals("BAR", joinTableResource.getJoinColumns().get(0).getName());
- assertEquals("FOO", joinTableResource.getJoinColumns().get(1).getName());
-
- OrmJoinColumn joinColumn3 = ormJoinTable.addSpecifiedJoinColumn(1);
- joinColumn3.setSpecifiedName("BAZ");
-
- assertEquals("BAR", joinTableResource.getJoinColumns().get(0).getName());
- assertEquals("BAZ", joinTableResource.getJoinColumns().get(1).getName());
- assertEquals("FOO", joinTableResource.getJoinColumns().get(2).getName());
-
- ListIterator<OrmJoinColumn> joinColumns = ormJoinTable.specifiedJoinColumns();
- assertEquals(joinColumn2, joinColumns.next());
- assertEquals(joinColumn3, joinColumns.next());
- assertEquals(joinColumn, joinColumns.next());
-
- joinColumns = ormJoinTable.specifiedJoinColumns();
- assertEquals("BAR", joinColumns.next().getName());
- assertEquals("BAZ", joinColumns.next().getName());
- assertEquals("FOO", joinColumns.next().getName());
- }
-
- public void testRemoveSpecifiedJoinColumn() throws Exception {
- OrmPersistentType ormPersistentType = getEntityMappings().addPersistentType(MappingKeys.ENTITY_TYPE_MAPPING_KEY, "model.Foo");
- OrmPersistentAttribute ormPersistentAttribute = ormPersistentType.addSpecifiedPersistentAttribute(MappingKeys.MANY_TO_MANY_ATTRIBUTE_MAPPING_KEY, "manyToManyMapping");
- OrmManyToManyMapping ormManyToManyMapping = (OrmManyToManyMapping) ormPersistentAttribute.getMapping();
- XmlManyToMany manyToMany = getXmlEntityMappings().getEntities().get(0).getAttributes().getManyToManys().get(0);
-
- OrmJoinTable ormJoinTable = ormManyToManyMapping.getRelationshipReference().getJoinTableJoiningStrategy().getJoinTable();
-
- ormJoinTable.addSpecifiedJoinColumn(0).setSpecifiedName("FOO");
- ormJoinTable.addSpecifiedJoinColumn(1).setSpecifiedName("BAR");
- ormJoinTable.addSpecifiedJoinColumn(2).setSpecifiedName("BAZ");
-
- XmlJoinTable joinTableResource = manyToMany.getJoinTable();
- assertEquals(3, joinTableResource.getJoinColumns().size());
-
- ormJoinTable.removeSpecifiedJoinColumn(0);
- assertEquals(2, joinTableResource.getJoinColumns().size());
- assertEquals("BAR", joinTableResource.getJoinColumns().get(0).getName());
- assertEquals("BAZ", joinTableResource.getJoinColumns().get(1).getName());
-
- ormJoinTable.removeSpecifiedJoinColumn(0);
- assertEquals(1, joinTableResource.getJoinColumns().size());
- assertEquals("BAZ", joinTableResource.getJoinColumns().get(0).getName());
-
- ormJoinTable.removeSpecifiedJoinColumn(0);
- assertEquals(0, joinTableResource.getJoinColumns().size());
- }
-
- public void testMoveSpecifiedJoinColumn() throws Exception {
- OrmPersistentType ormPersistentType = getEntityMappings().addPersistentType(MappingKeys.ENTITY_TYPE_MAPPING_KEY, "model.Foo");
- OrmPersistentAttribute ormPersistentAttribute = ormPersistentType.addSpecifiedPersistentAttribute(MappingKeys.MANY_TO_MANY_ATTRIBUTE_MAPPING_KEY, "manyToManyMapping");
- OrmManyToManyMapping ormManyToManyMapping = (OrmManyToManyMapping) ormPersistentAttribute.getMapping();
- XmlManyToMany manyToMany = getXmlEntityMappings().getEntities().get(0).getAttributes().getManyToManys().get(0);
-
- OrmJoinTable ormJoinTable = ormManyToManyMapping.getRelationshipReference().getJoinTableJoiningStrategy().getJoinTable();
-
- ormJoinTable.addSpecifiedJoinColumn(0).setSpecifiedName("FOO");
- ormJoinTable.addSpecifiedJoinColumn(1).setSpecifiedName("BAR");
- ormJoinTable.addSpecifiedJoinColumn(2).setSpecifiedName("BAZ");
-
- XmlJoinTable joinTableResource = manyToMany.getJoinTable();
- assertEquals(3, joinTableResource.getJoinColumns().size());
-
-
- ormJoinTable.moveSpecifiedJoinColumn(2, 0);
- ListIterator<OrmJoinColumn> joinColumns = ormJoinTable.specifiedJoinColumns();
- assertEquals("BAR", joinColumns.next().getName());
- assertEquals("BAZ", joinColumns.next().getName());
- assertEquals("FOO", joinColumns.next().getName());
-
- assertEquals("BAR", joinTableResource.getJoinColumns().get(0).getName());
- assertEquals("BAZ", joinTableResource.getJoinColumns().get(1).getName());
- assertEquals("FOO", joinTableResource.getJoinColumns().get(2).getName());
-
-
- ormJoinTable.moveSpecifiedJoinColumn(0, 1);
- joinColumns = ormJoinTable.specifiedJoinColumns();
- assertEquals("BAZ", joinColumns.next().getName());
- assertEquals("BAR", joinColumns.next().getName());
- assertEquals("FOO", joinColumns.next().getName());
-
- assertEquals("BAZ", joinTableResource.getJoinColumns().get(0).getName());
- assertEquals("BAR", joinTableResource.getJoinColumns().get(1).getName());
- assertEquals("FOO", joinTableResource.getJoinColumns().get(2).getName());
- }
-
- public void testUpdateInverseJoinColumns() throws Exception {
- OrmPersistentType ormPersistentType = getEntityMappings().addPersistentType(MappingKeys.ENTITY_TYPE_MAPPING_KEY, "model.Foo");
- OrmPersistentAttribute ormPersistentAttribute = ormPersistentType.addSpecifiedPersistentAttribute(MappingKeys.MANY_TO_MANY_ATTRIBUTE_MAPPING_KEY, "manyToManyMapping");
- OrmManyToManyMapping ormManyToManyMapping = (OrmManyToManyMapping) ormPersistentAttribute.getMapping();
- XmlManyToMany manyToMany = getXmlEntityMappings().getEntities().get(0).getAttributes().getManyToManys().get(0);
-
- OrmJoinTable ormJoinTable = ormManyToManyMapping.getRelationshipReference().getJoinTableJoiningStrategy().getJoinTable();
- manyToMany.setJoinTable(OrmFactory.eINSTANCE.createXmlJoinTable());
- XmlJoinTable joinTableResource = manyToMany.getJoinTable();
-
- joinTableResource.getInverseJoinColumns().add(OrmFactory.eINSTANCE.createXmlJoinColumn());
- joinTableResource.getInverseJoinColumns().add(OrmFactory.eINSTANCE.createXmlJoinColumn());
- joinTableResource.getInverseJoinColumns().add(OrmFactory.eINSTANCE.createXmlJoinColumn());
-
- joinTableResource.getInverseJoinColumns().get(0).setName("FOO");
- joinTableResource.getInverseJoinColumns().get(1).setName("BAR");
- joinTableResource.getInverseJoinColumns().get(2).setName("BAZ");
-
- ListIterator<OrmJoinColumn> joinColumns = ormJoinTable.specifiedInverseJoinColumns();
- assertEquals("FOO", joinColumns.next().getName());
- assertEquals("BAR", joinColumns.next().getName());
- assertEquals("BAZ", joinColumns.next().getName());
- assertFalse(joinColumns.hasNext());
-
- joinTableResource.getInverseJoinColumns().move(2, 0);
- joinColumns = ormJoinTable.specifiedInverseJoinColumns();
- assertEquals("BAR", joinColumns.next().getName());
- assertEquals("BAZ", joinColumns.next().getName());
- assertEquals("FOO", joinColumns.next().getName());
- assertFalse(joinColumns.hasNext());
-
- joinTableResource.getInverseJoinColumns().move(0, 1);
- joinColumns = ormJoinTable.specifiedInverseJoinColumns();
- assertEquals("BAZ", joinColumns.next().getName());
- assertEquals("BAR", joinColumns.next().getName());
- assertEquals("FOO", joinColumns.next().getName());
- assertFalse(joinColumns.hasNext());
-
- joinTableResource.getInverseJoinColumns().remove(1);
- joinColumns = ormJoinTable.specifiedInverseJoinColumns();
- assertEquals("BAZ", joinColumns.next().getName());
- assertEquals("FOO", joinColumns.next().getName());
- assertFalse(joinColumns.hasNext());
-
- joinTableResource.getInverseJoinColumns().remove(1);
- joinColumns = ormJoinTable.specifiedInverseJoinColumns();
- assertEquals("BAZ", joinColumns.next().getName());
- assertFalse(joinColumns.hasNext());
-
- joinTableResource.getInverseJoinColumns().remove(0);
- assertFalse(ormJoinTable.specifiedInverseJoinColumns().hasNext());
- }
-
- public void testAddSpecifiedInverseJoinColumn() throws Exception {
- OrmPersistentType ormPersistentType = getEntityMappings().addPersistentType(MappingKeys.ENTITY_TYPE_MAPPING_KEY, "model.Foo");
- OrmPersistentAttribute ormPersistentAttribute = ormPersistentType.addSpecifiedPersistentAttribute(MappingKeys.MANY_TO_MANY_ATTRIBUTE_MAPPING_KEY, "manyToManyMapping");
- OrmManyToManyMapping ormManyToManyMapping = (OrmManyToManyMapping) ormPersistentAttribute.getMapping();
- XmlManyToMany manyToMany = getXmlEntityMappings().getEntities().get(0).getAttributes().getManyToManys().get(0);
-
- OrmJoinTable ormJoinTable = ormManyToManyMapping.getRelationshipReference().getJoinTableJoiningStrategy().getJoinTable();
-
- OrmJoinColumn joinColumn = ormJoinTable.addSpecifiedInverseJoinColumn(0);
- joinColumn.setSpecifiedName("FOO");
-
- XmlJoinTable joinTableResource = manyToMany.getJoinTable();
- assertEquals("FOO", joinTableResource.getInverseJoinColumns().get(0).getName());
-
- OrmJoinColumn joinColumn2 = ormJoinTable.addSpecifiedInverseJoinColumn(0);
- joinColumn2.setSpecifiedName("BAR");
-
- assertEquals("BAR", joinTableResource.getInverseJoinColumns().get(0).getName());
- assertEquals("FOO", joinTableResource.getInverseJoinColumns().get(1).getName());
-
- OrmJoinColumn joinColumn3 = ormJoinTable.addSpecifiedInverseJoinColumn(1);
- joinColumn3.setSpecifiedName("BAZ");
-
- assertEquals("BAR", joinTableResource.getInverseJoinColumns().get(0).getName());
- assertEquals("BAZ", joinTableResource.getInverseJoinColumns().get(1).getName());
- assertEquals("FOO", joinTableResource.getInverseJoinColumns().get(2).getName());
-
- ListIterator<OrmJoinColumn> joinColumns = ormJoinTable.specifiedInverseJoinColumns();
- assertEquals(joinColumn2, joinColumns.next());
- assertEquals(joinColumn3, joinColumns.next());
- assertEquals(joinColumn, joinColumns.next());
-
- joinColumns = ormJoinTable.specifiedInverseJoinColumns();
- assertEquals("BAR", joinColumns.next().getName());
- assertEquals("BAZ", joinColumns.next().getName());
- assertEquals("FOO", joinColumns.next().getName());
- }
-
- public void testRemoveSpecifiedInverseJoinColumn() throws Exception {
- OrmPersistentType ormPersistentType = getEntityMappings().addPersistentType(MappingKeys.ENTITY_TYPE_MAPPING_KEY, "model.Foo");
- OrmPersistentAttribute ormPersistentAttribute = ormPersistentType.addSpecifiedPersistentAttribute(MappingKeys.MANY_TO_MANY_ATTRIBUTE_MAPPING_KEY, "manyToManyMapping");
- OrmManyToManyMapping ormManyToManyMapping = (OrmManyToManyMapping) ormPersistentAttribute.getMapping();
- XmlManyToMany manyToMany = getXmlEntityMappings().getEntities().get(0).getAttributes().getManyToManys().get(0);
-
- OrmJoinTable ormJoinTable = ormManyToManyMapping.getRelationshipReference().getJoinTableJoiningStrategy().getJoinTable();
-
- ormJoinTable.addSpecifiedInverseJoinColumn(0).setSpecifiedName("FOO");
- ormJoinTable.addSpecifiedInverseJoinColumn(1).setSpecifiedName("BAR");
- ormJoinTable.addSpecifiedInverseJoinColumn(2).setSpecifiedName("BAZ");
-
- XmlJoinTable joinTableResource = manyToMany.getJoinTable();
- assertEquals(3, joinTableResource.getInverseJoinColumns().size());
-
- ormJoinTable.removeSpecifiedInverseJoinColumn(0);
- assertEquals(2, joinTableResource.getInverseJoinColumns().size());
- assertEquals("BAR", joinTableResource.getInverseJoinColumns().get(0).getName());
- assertEquals("BAZ", joinTableResource.getInverseJoinColumns().get(1).getName());
-
- ormJoinTable.removeSpecifiedInverseJoinColumn(0);
- assertEquals(1, joinTableResource.getInverseJoinColumns().size());
- assertEquals("BAZ", joinTableResource.getInverseJoinColumns().get(0).getName());
-
- ormJoinTable.removeSpecifiedInverseJoinColumn(0);
- assertEquals(0, joinTableResource.getInverseJoinColumns().size());
- }
-
- public void testMoveSpecifiedInverseJoinColumn() throws Exception {
- OrmPersistentType ormPersistentType = getEntityMappings().addPersistentType(MappingKeys.ENTITY_TYPE_MAPPING_KEY, "model.Foo");
- OrmPersistentAttribute ormPersistentAttribute = ormPersistentType.addSpecifiedPersistentAttribute(MappingKeys.MANY_TO_MANY_ATTRIBUTE_MAPPING_KEY, "manyToManyMapping");
- OrmManyToManyMapping ormManyToManyMapping = (OrmManyToManyMapping) ormPersistentAttribute.getMapping();
- XmlManyToMany manyToMany = getXmlEntityMappings().getEntities().get(0).getAttributes().getManyToManys().get(0);
-
- OrmJoinTable ormJoinTable = ormManyToManyMapping.getRelationshipReference().getJoinTableJoiningStrategy().getJoinTable();
-
- ormJoinTable.addSpecifiedInverseJoinColumn(0).setSpecifiedName("FOO");
- ormJoinTable.addSpecifiedInverseJoinColumn(1).setSpecifiedName("BAR");
- ormJoinTable.addSpecifiedInverseJoinColumn(2).setSpecifiedName("BAZ");
-
- XmlJoinTable joinTableResource = manyToMany.getJoinTable();
- assertEquals(3, joinTableResource.getInverseJoinColumns().size());
-
-
- ormJoinTable.moveSpecifiedInverseJoinColumn(2, 0);
- ListIterator<OrmJoinColumn> joinColumns = ormJoinTable.specifiedInverseJoinColumns();
- assertEquals("BAR", joinColumns.next().getName());
- assertEquals("BAZ", joinColumns.next().getName());
- assertEquals("FOO", joinColumns.next().getName());
-
- assertEquals("BAR", joinTableResource.getInverseJoinColumns().get(0).getName());
- assertEquals("BAZ", joinTableResource.getInverseJoinColumns().get(1).getName());
- assertEquals("FOO", joinTableResource.getInverseJoinColumns().get(2).getName());
-
-
- ormJoinTable.moveSpecifiedInverseJoinColumn(0, 1);
- joinColumns = ormJoinTable.specifiedInverseJoinColumns();
- assertEquals("BAZ", joinColumns.next().getName());
- assertEquals("BAR", joinColumns.next().getName());
- assertEquals("FOO", joinColumns.next().getName());
-
- assertEquals("BAZ", joinTableResource.getInverseJoinColumns().get(0).getName());
- assertEquals("BAR", joinTableResource.getInverseJoinColumns().get(1).getName());
- assertEquals("FOO", joinTableResource.getInverseJoinColumns().get(2).getName());
- }
-
- public void testUpdateJoinColumns() throws Exception {
- OrmPersistentType ormPersistentType = getEntityMappings().addPersistentType(MappingKeys.ENTITY_TYPE_MAPPING_KEY, "model.Foo");
- OrmPersistentAttribute ormPersistentAttribute = ormPersistentType.addSpecifiedPersistentAttribute(MappingKeys.MANY_TO_MANY_ATTRIBUTE_MAPPING_KEY, "manyToManyMapping");
- OrmManyToManyMapping ormManyToManyMapping = (OrmManyToManyMapping) ormPersistentAttribute.getMapping();
- XmlManyToMany manyToMany = getXmlEntityMappings().getEntities().get(0).getAttributes().getManyToManys().get(0);
-
- OrmJoinTable ormJoinTable = ormManyToManyMapping.getRelationshipReference().getJoinTableJoiningStrategy().getJoinTable();
- manyToMany.setJoinTable(OrmFactory.eINSTANCE.createXmlJoinTable());
- XmlJoinTable joinTableResource = manyToMany.getJoinTable();
-
- joinTableResource.getJoinColumns().add(OrmFactory.eINSTANCE.createXmlJoinColumn());
- joinTableResource.getJoinColumns().add(OrmFactory.eINSTANCE.createXmlJoinColumn());
- joinTableResource.getJoinColumns().add(OrmFactory.eINSTANCE.createXmlJoinColumn());
-
- joinTableResource.getJoinColumns().get(0).setName("FOO");
- joinTableResource.getJoinColumns().get(1).setName("BAR");
- joinTableResource.getJoinColumns().get(2).setName("BAZ");
-
- ListIterator<OrmJoinColumn> joinColumns = ormJoinTable.specifiedJoinColumns();
- assertEquals("FOO", joinColumns.next().getName());
- assertEquals("BAR", joinColumns.next().getName());
- assertEquals("BAZ", joinColumns.next().getName());
- assertFalse(joinColumns.hasNext());
-
- joinTableResource.getJoinColumns().move(2, 0);
- joinColumns = ormJoinTable.specifiedJoinColumns();
- assertEquals("BAR", joinColumns.next().getName());
- assertEquals("BAZ", joinColumns.next().getName());
- assertEquals("FOO", joinColumns.next().getName());
- assertFalse(joinColumns.hasNext());
-
- joinTableResource.getJoinColumns().move(0, 1);
- joinColumns = ormJoinTable.specifiedJoinColumns();
- assertEquals("BAZ", joinColumns.next().getName());
- assertEquals("BAR", joinColumns.next().getName());
- assertEquals("FOO", joinColumns.next().getName());
- assertFalse(joinColumns.hasNext());
-
- joinTableResource.getJoinColumns().remove(1);
- joinColumns = ormJoinTable.specifiedJoinColumns();
- assertEquals("BAZ", joinColumns.next().getName());
- assertEquals("FOO", joinColumns.next().getName());
- assertFalse(joinColumns.hasNext());
-
- joinTableResource.getJoinColumns().remove(1);
- joinColumns = ormJoinTable.specifiedJoinColumns();
- assertEquals("BAZ", joinColumns.next().getName());
- assertFalse(joinColumns.hasNext());
-
- joinTableResource.getJoinColumns().remove(0);
- assertFalse(ormJoinTable.specifiedJoinColumns().hasNext());
- }
-
-
- public void testUniqueConstraints() throws Exception {
- OrmPersistentType ormPersistentType = getEntityMappings().addPersistentType(MappingKeys.ENTITY_TYPE_MAPPING_KEY, "model.Foo");
- OrmPersistentAttribute ormPersistentAttribute = ormPersistentType.addSpecifiedPersistentAttribute(MappingKeys.MANY_TO_MANY_ATTRIBUTE_MAPPING_KEY, "manyToManyMapping");
- OrmManyToManyMapping ormManyToManyMapping = (OrmManyToManyMapping) ormPersistentAttribute.getMapping();
- XmlManyToMany manyToMany = getXmlEntityMappings().getEntities().get(0).getAttributes().getManyToManys().get(0);
-
- OrmJoinTable ormJoinTable = ormManyToManyMapping.getRelationshipReference().getJoinTableJoiningStrategy().getJoinTable();
- manyToMany.setJoinTable(OrmFactory.eINSTANCE.createXmlJoinTable());
- XmlJoinTable joinTableResource = manyToMany.getJoinTable();
-
- ListIterator<OrmUniqueConstraint> uniqueConstraints = ormJoinTable.uniqueConstraints();
- assertFalse(uniqueConstraints.hasNext());
-
- XmlUniqueConstraint uniqueConstraintResource = OrmFactory.eINSTANCE.createXmlUniqueConstraint();
- joinTableResource.getUniqueConstraints().add(0, uniqueConstraintResource);
- uniqueConstraintResource.getColumnNames().add(0, "foo");
-
- uniqueConstraintResource = OrmFactory.eINSTANCE.createXmlUniqueConstraint();
- joinTableResource.getUniqueConstraints().add(0, uniqueConstraintResource);
- uniqueConstraintResource.getColumnNames().add(0, "bar");
-
- uniqueConstraints = ormJoinTable.uniqueConstraints();
- assertTrue(uniqueConstraints.hasNext());
- assertEquals("bar", uniqueConstraints.next().columnNames().next());
- assertEquals("foo", uniqueConstraints.next().columnNames().next());
- assertFalse(uniqueConstraints.hasNext());
- }
-
- public void testUniqueConstraintsSize() throws Exception {
- OrmPersistentType ormPersistentType = getEntityMappings().addPersistentType(MappingKeys.ENTITY_TYPE_MAPPING_KEY, "model.Foo");
- OrmPersistentAttribute ormPersistentAttribute = ormPersistentType.addSpecifiedPersistentAttribute(MappingKeys.MANY_TO_MANY_ATTRIBUTE_MAPPING_KEY, "manyToManyMapping");
- OrmManyToManyMapping ormManyToManyMapping = (OrmManyToManyMapping) ormPersistentAttribute.getMapping();
- XmlManyToMany manyToMany = getXmlEntityMappings().getEntities().get(0).getAttributes().getManyToManys().get(0);
-
- OrmJoinTable ormJoinTable = ormManyToManyMapping.getRelationshipReference().getJoinTableJoiningStrategy().getJoinTable();
- manyToMany.setJoinTable(OrmFactory.eINSTANCE.createXmlJoinTable());
- XmlJoinTable joinTableResource = manyToMany.getJoinTable();
-
- assertEquals(0, ormJoinTable.uniqueConstraintsSize());
-
- XmlUniqueConstraint uniqueConstraintResource = OrmFactory.eINSTANCE.createXmlUniqueConstraint();
- joinTableResource.getUniqueConstraints().add(0, uniqueConstraintResource);
- uniqueConstraintResource.getColumnNames().add(0, "foo");
-
- uniqueConstraintResource = OrmFactory.eINSTANCE.createXmlUniqueConstraint();
- joinTableResource.getUniqueConstraints().add(1, uniqueConstraintResource);
- uniqueConstraintResource.getColumnNames().add(0, "bar");
-
- assertEquals(2, ormJoinTable.uniqueConstraintsSize());
- }
-
- public void testAddUniqueConstraint() throws Exception {
- OrmPersistentType ormPersistentType = getEntityMappings().addPersistentType(MappingKeys.ENTITY_TYPE_MAPPING_KEY, "model.Foo");
- OrmPersistentAttribute ormPersistentAttribute = ormPersistentType.addSpecifiedPersistentAttribute(MappingKeys.MANY_TO_MANY_ATTRIBUTE_MAPPING_KEY, "manyToManyMapping");
- OrmManyToManyMapping ormManyToManyMapping = (OrmManyToManyMapping) ormPersistentAttribute.getMapping();
- XmlManyToMany manyToMany = getXmlEntityMappings().getEntities().get(0).getAttributes().getManyToManys().get(0);
-
- OrmJoinTable ormJoinTable = ormManyToManyMapping.getRelationshipReference().getJoinTableJoiningStrategy().getJoinTable();
- manyToMany.setJoinTable(OrmFactory.eINSTANCE.createXmlJoinTable());
- XmlJoinTable joinTableResource = manyToMany.getJoinTable();
-
- ormJoinTable.addUniqueConstraint(0).addColumnName(0, "FOO");
- ormJoinTable.addUniqueConstraint(0).addColumnName(0, "BAR");
- ormJoinTable.addUniqueConstraint(0).addColumnName(0, "BAZ");
-
- ListIterator<XmlUniqueConstraint> uniqueConstraints = joinTableResource.getUniqueConstraints().listIterator();
-
- assertEquals("BAZ", uniqueConstraints.next().getColumnNames().get(0));
- assertEquals("BAR", uniqueConstraints.next().getColumnNames().get(0));
- assertEquals("FOO", uniqueConstraints.next().getColumnNames().get(0));
- assertFalse(uniqueConstraints.hasNext());
- }
-
- public void testAddUniqueConstraint2() throws Exception {
- OrmPersistentType ormPersistentType = getEntityMappings().addPersistentType(MappingKeys.ENTITY_TYPE_MAPPING_KEY, "model.Foo");
- OrmPersistentAttribute ormPersistentAttribute = ormPersistentType.addSpecifiedPersistentAttribute(MappingKeys.MANY_TO_MANY_ATTRIBUTE_MAPPING_KEY, "manyToManyMapping");
- OrmManyToManyMapping ormManyToManyMapping = (OrmManyToManyMapping) ormPersistentAttribute.getMapping();
- XmlManyToMany manyToMany = getXmlEntityMappings().getEntities().get(0).getAttributes().getManyToManys().get(0);
-
- OrmJoinTable ormJoinTable = ormManyToManyMapping.getRelationshipReference().getJoinTableJoiningStrategy().getJoinTable();
- manyToMany.setJoinTable(OrmFactory.eINSTANCE.createXmlJoinTable());
- XmlJoinTable joinTableResource = manyToMany.getJoinTable();
-
- ormJoinTable.addUniqueConstraint(0).addColumnName(0, "FOO");
- ormJoinTable.addUniqueConstraint(1).addColumnName(0, "BAR");
- ormJoinTable.addUniqueConstraint(0).addColumnName(0, "BAZ");
-
- ListIterator<XmlUniqueConstraint> uniqueConstraints = joinTableResource.getUniqueConstraints().listIterator();
-
- assertEquals("BAZ", uniqueConstraints.next().getColumnNames().get(0));
- assertEquals("FOO", uniqueConstraints.next().getColumnNames().get(0));
- assertEquals("BAR", uniqueConstraints.next().getColumnNames().get(0));
- assertFalse(uniqueConstraints.hasNext());
- }
-
- public void testRemoveUniqueConstraint() throws Exception {
- OrmPersistentType ormPersistentType = getEntityMappings().addPersistentType(MappingKeys.ENTITY_TYPE_MAPPING_KEY, "model.Foo");
- OrmPersistentAttribute ormPersistentAttribute = ormPersistentType.addSpecifiedPersistentAttribute(MappingKeys.MANY_TO_MANY_ATTRIBUTE_MAPPING_KEY, "manyToManyMapping");
- OrmManyToManyMapping ormManyToManyMapping = (OrmManyToManyMapping) ormPersistentAttribute.getMapping();
- XmlManyToMany manyToMany = getXmlEntityMappings().getEntities().get(0).getAttributes().getManyToManys().get(0);
-
- OrmJoinTable ormJoinTable = ormManyToManyMapping.getRelationshipReference().getJoinTableJoiningStrategy().getJoinTable();
- manyToMany.setJoinTable(OrmFactory.eINSTANCE.createXmlJoinTable());
- XmlJoinTable joinTableResource = manyToMany.getJoinTable();
-
- ormJoinTable.addUniqueConstraint(0).addColumnName(0, "FOO");
- ormJoinTable.addUniqueConstraint(1).addColumnName(0, "BAR");
- ormJoinTable.addUniqueConstraint(2).addColumnName(0, "BAZ");
-
- assertEquals(3, joinTableResource.getUniqueConstraints().size());
-
- ormJoinTable.removeUniqueConstraint(1);
-
- ListIterator<XmlUniqueConstraint> uniqueConstraintResources = joinTableResource.getUniqueConstraints().listIterator();
- assertEquals("FOO", uniqueConstraintResources.next().getColumnNames().get(0));
- assertEquals("BAZ", uniqueConstraintResources.next().getColumnNames().get(0));
- assertFalse(uniqueConstraintResources.hasNext());
-
- Iterator<OrmUniqueConstraint> uniqueConstraints = ormJoinTable.uniqueConstraints();
- assertEquals("FOO", uniqueConstraints.next().columnNames().next());
- assertEquals("BAZ", uniqueConstraints.next().columnNames().next());
- assertFalse(uniqueConstraints.hasNext());
-
-
- ormJoinTable.removeUniqueConstraint(1);
- uniqueConstraintResources = joinTableResource.getUniqueConstraints().listIterator();
- assertEquals("FOO", uniqueConstraintResources.next().getColumnNames().get(0));
- assertFalse(uniqueConstraintResources.hasNext());
-
- uniqueConstraints = ormJoinTable.uniqueConstraints();
- assertEquals("FOO", uniqueConstraints.next().columnNames().next());
- assertFalse(uniqueConstraints.hasNext());
-
-
- ormJoinTable.removeUniqueConstraint(0);
- uniqueConstraintResources = joinTableResource.getUniqueConstraints().listIterator();
- assertFalse(uniqueConstraintResources.hasNext());
- uniqueConstraints = ormJoinTable.uniqueConstraints();
- assertFalse(uniqueConstraints.hasNext());
- }
-
- public void testMoveUniqueConstraint() throws Exception {
- OrmPersistentType ormPersistentType = getEntityMappings().addPersistentType(MappingKeys.ENTITY_TYPE_MAPPING_KEY, "model.Foo");
- OrmPersistentAttribute ormPersistentAttribute = ormPersistentType.addSpecifiedPersistentAttribute(MappingKeys.MANY_TO_MANY_ATTRIBUTE_MAPPING_KEY, "manyToManyMapping");
- OrmManyToManyMapping ormManyToManyMapping = (OrmManyToManyMapping) ormPersistentAttribute.getMapping();
- XmlManyToMany manyToMany = getXmlEntityMappings().getEntities().get(0).getAttributes().getManyToManys().get(0);
-
- OrmJoinTable ormJoinTable = ormManyToManyMapping.getRelationshipReference().getJoinTableJoiningStrategy().getJoinTable();
- manyToMany.setJoinTable(OrmFactory.eINSTANCE.createXmlJoinTable());
- XmlJoinTable joinTableResource = manyToMany.getJoinTable();
-
- ormJoinTable.addUniqueConstraint(0).addColumnName(0, "FOO");
- ormJoinTable.addUniqueConstraint(1).addColumnName(0, "BAR");
- ormJoinTable.addUniqueConstraint(2).addColumnName(0, "BAZ");
-
- assertEquals(3, joinTableResource.getUniqueConstraints().size());
-
-
- ormJoinTable.moveUniqueConstraint(2, 0);
- ListIterator<OrmUniqueConstraint> uniqueConstraints = ormJoinTable.uniqueConstraints();
- assertEquals("BAR", uniqueConstraints.next().columnNames().next());
- assertEquals("BAZ", uniqueConstraints.next().columnNames().next());
- assertEquals("FOO", uniqueConstraints.next().columnNames().next());
-
- ListIterator<XmlUniqueConstraint> uniqueConstraintResources = joinTableResource.getUniqueConstraints().listIterator();
- assertEquals("BAR", uniqueConstraintResources.next().getColumnNames().get(0));
- assertEquals("BAZ", uniqueConstraintResources.next().getColumnNames().get(0));
- assertEquals("FOO", uniqueConstraintResources.next().getColumnNames().get(0));
-
-
- ormJoinTable.moveUniqueConstraint(0, 1);
- uniqueConstraints = ormJoinTable.uniqueConstraints();
- assertEquals("BAZ", uniqueConstraints.next().columnNames().next());
- assertEquals("BAR", uniqueConstraints.next().columnNames().next());
- assertEquals("FOO", uniqueConstraints.next().columnNames().next());
-
- uniqueConstraintResources = joinTableResource.getUniqueConstraints().listIterator();
- assertEquals("BAZ", uniqueConstraintResources.next().getColumnNames().get(0));
- assertEquals("BAR", uniqueConstraintResources.next().getColumnNames().get(0));
- assertEquals("FOO", uniqueConstraintResources.next().getColumnNames().get(0));
- }
-
- public void testUpdateUniqueConstraints() throws Exception {
- OrmPersistentType ormPersistentType = getEntityMappings().addPersistentType(MappingKeys.ENTITY_TYPE_MAPPING_KEY, "model.Foo");
- OrmPersistentAttribute ormPersistentAttribute = ormPersistentType.addSpecifiedPersistentAttribute(MappingKeys.MANY_TO_MANY_ATTRIBUTE_MAPPING_KEY, "manyToManyMapping");
- OrmManyToManyMapping ormManyToManyMapping = (OrmManyToManyMapping) ormPersistentAttribute.getMapping();
- XmlManyToMany manyToMany = getXmlEntityMappings().getEntities().get(0).getAttributes().getManyToManys().get(0);
-
- OrmJoinTable ormJoinTable = ormManyToManyMapping.getRelationshipReference().getJoinTableJoiningStrategy().getJoinTable();
- manyToMany.setJoinTable(OrmFactory.eINSTANCE.createXmlJoinTable());
- XmlJoinTable joinTableResource = manyToMany.getJoinTable();
-
- XmlUniqueConstraint uniqueConstraintResource = OrmFactory.eINSTANCE.createXmlUniqueConstraint();
- joinTableResource.getUniqueConstraints().add(0, uniqueConstraintResource);
- uniqueConstraintResource.getColumnNames().add(0, "FOO");
-
- uniqueConstraintResource = OrmFactory.eINSTANCE.createXmlUniqueConstraint();
- joinTableResource.getUniqueConstraints().add(1, uniqueConstraintResource);
- uniqueConstraintResource.getColumnNames().add(0, "BAR");
-
- uniqueConstraintResource = OrmFactory.eINSTANCE.createXmlUniqueConstraint();
- joinTableResource.getUniqueConstraints().add(2, uniqueConstraintResource);
- uniqueConstraintResource.getColumnNames().add(0, "BAZ");
-
-
- ListIterator<OrmUniqueConstraint> uniqueConstraints = ormJoinTable.uniqueConstraints();
- assertEquals("FOO", uniqueConstraints.next().columnNames().next());
- assertEquals("BAR", uniqueConstraints.next().columnNames().next());
- assertEquals("BAZ", uniqueConstraints.next().columnNames().next());
- assertFalse(uniqueConstraints.hasNext());
-
- joinTableResource.getUniqueConstraints().move(2, 0);
- uniqueConstraints = ormJoinTable.uniqueConstraints();
- assertEquals("BAR", uniqueConstraints.next().columnNames().next());
- assertEquals("BAZ", uniqueConstraints.next().columnNames().next());
- assertEquals("FOO", uniqueConstraints.next().columnNames().next());
- assertFalse(uniqueConstraints.hasNext());
-
- joinTableResource.getUniqueConstraints().move(0, 1);
- uniqueConstraints = ormJoinTable.uniqueConstraints();
- assertEquals("BAZ", uniqueConstraints.next().columnNames().next());
- assertEquals("BAR", uniqueConstraints.next().columnNames().next());
- assertEquals("FOO", uniqueConstraints.next().columnNames().next());
- assertFalse(uniqueConstraints.hasNext());
-
- joinTableResource.getUniqueConstraints().remove(1);
- uniqueConstraints = ormJoinTable.uniqueConstraints();
- assertEquals("BAZ", uniqueConstraints.next().columnNames().next());
- assertEquals("FOO", uniqueConstraints.next().columnNames().next());
- assertFalse(uniqueConstraints.hasNext());
-
- joinTableResource.getUniqueConstraints().remove(1);
- uniqueConstraints = ormJoinTable.uniqueConstraints();
- assertEquals("BAZ", uniqueConstraints.next().columnNames().next());
- assertFalse(uniqueConstraints.hasNext());
-
- joinTableResource.getUniqueConstraints().remove(0);
- uniqueConstraints = ormJoinTable.uniqueConstraints();
- assertFalse(uniqueConstraints.hasNext());
- }
-
-
- public void testUniqueConstraintsFromJava() throws Exception {
- createTestEntityWithValidManyToMany();
-
- OrmPersistentType ormPersistentType = getEntityMappings().addPersistentType(MappingKeys.ENTITY_TYPE_MAPPING_KEY, FULLY_QUALIFIED_TYPE_NAME);
- OrmManyToManyMapping ormManyToManyMapping = (OrmManyToManyMapping) ormPersistentType.attributes().next().getMapping();
- OrmJoinTable ormJoinTable = ormManyToManyMapping.getRelationshipReference().getJoinTableJoiningStrategy().getJoinTable();
-
- assertTrue(ormManyToManyMapping.getPersistentAttribute().isVirtual());
-
- ListIterator<OrmUniqueConstraint> uniqueConstraints = ormJoinTable.uniqueConstraints();
- assertFalse(uniqueConstraints.hasNext());
-
- JavaManyToManyMapping javaManyToManyMapping = (JavaManyToManyMapping) ormPersistentType.getJavaPersistentType().attributes().next().getMapping();
- JavaJoinTable javaJoinTable = javaManyToManyMapping.getRelationshipReference().getJoinTableJoiningStrategy().getJoinTable();
-
- javaJoinTable.addUniqueConstraint(0).addColumnName(0, "FOO");
- javaJoinTable.addUniqueConstraint(1).addColumnName(0, "BAR");
- javaJoinTable.addUniqueConstraint(2).addColumnName(0, "BAZ");
-
- uniqueConstraints = ormJoinTable.uniqueConstraints();
- assertTrue(uniqueConstraints.hasNext());
- assertEquals("FOO", uniqueConstraints.next().columnNames().next());
- assertEquals("BAR", uniqueConstraints.next().columnNames().next());
- assertEquals("BAZ", uniqueConstraints.next().columnNames().next());
- assertFalse(uniqueConstraints.hasNext());
-
- ormManyToManyMapping.getPersistentAttribute().makeSpecified();
-
- ormManyToManyMapping = (OrmManyToManyMapping) ormPersistentType.attributes().next().getMapping();
- assertEquals(0, ormManyToManyMapping.getRelationshipReference().getJoinTableJoiningStrategy().getJoinTable().uniqueConstraintsSize());
- }
-
-} \ No newline at end of file
diff --git a/jpa/tests/org.eclipse.jpt.core.tests/src/org/eclipse/jpt/core/tests/internal/context/orm/OrmManyToManyMappingTests.java b/jpa/tests/org.eclipse.jpt.core.tests/src/org/eclipse/jpt/core/tests/internal/context/orm/OrmManyToManyMappingTests.java
deleted file mode 100644
index c405407925..0000000000
--- a/jpa/tests/org.eclipse.jpt.core.tests/src/org/eclipse/jpt/core/tests/internal/context/orm/OrmManyToManyMappingTests.java
+++ /dev/null
@@ -1,592 +0,0 @@
-/*******************************************************************************
- * Copyright (c) 2007, 2009 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.
- *
- * Contributors:
- * Oracle - initial API and implementation
- ******************************************************************************/
-package org.eclipse.jpt.core.tests.internal.context.orm;
-
-import org.eclipse.jpt.core.JptCorePlugin;
-import org.eclipse.jpt.core.MappingKeys;
-import org.eclipse.jpt.core.context.BasicMapping;
-import org.eclipse.jpt.core.context.EmbeddedIdMapping;
-import org.eclipse.jpt.core.context.EmbeddedMapping;
-import org.eclipse.jpt.core.context.FetchType;
-import org.eclipse.jpt.core.context.IdMapping;
-import org.eclipse.jpt.core.context.JoinColumn;
-import org.eclipse.jpt.core.context.JoinTable;
-import org.eclipse.jpt.core.context.ManyToManyMapping;
-import org.eclipse.jpt.core.context.ManyToOneMapping;
-import org.eclipse.jpt.core.context.OneToManyMapping;
-import org.eclipse.jpt.core.context.OneToOneMapping;
-import org.eclipse.jpt.core.context.TransientMapping;
-import org.eclipse.jpt.core.context.VersionMapping;
-import org.eclipse.jpt.core.context.orm.OrmManyToManyMapping;
-import org.eclipse.jpt.core.context.orm.OrmMappedByJoiningStrategy;
-import org.eclipse.jpt.core.context.orm.OrmPersistentAttribute;
-import org.eclipse.jpt.core.context.orm.OrmPersistentType;
-import org.eclipse.jpt.core.resource.orm.OrmFactory;
-import org.eclipse.jpt.core.resource.orm.XmlManyToMany;
-import org.eclipse.jpt.core.resource.persistence.PersistenceFactory;
-import org.eclipse.jpt.core.resource.persistence.XmlMappingFileRef;
-import org.eclipse.jpt.core.tests.internal.context.ContextModelTestCase;
-
-@SuppressWarnings("nls")
-public class OrmManyToManyMappingTests extends ContextModelTestCase
-{
- public OrmManyToManyMappingTests(String name) {
- super(name);
- }
-
-
- @Override
- protected void setUp() throws Exception {
- super.setUp();
- XmlMappingFileRef mappingFileRef = PersistenceFactory.eINSTANCE.createXmlMappingFileRef();
- mappingFileRef.setFileName(JptCorePlugin.DEFAULT_ORM_XML_FILE_PATH);
- getXmlPersistenceUnit().getMappingFiles().add(mappingFileRef);
- getPersistenceXmlResource().save(null);
- }
-
- public void testUpdateName() throws Exception {
- OrmPersistentType ormPersistentType = getEntityMappings().addPersistentType(MappingKeys.ENTITY_TYPE_MAPPING_KEY, "model.Foo");
- OrmPersistentAttribute ormPersistentAttribute = ormPersistentType.addSpecifiedPersistentAttribute(MappingKeys.MANY_TO_MANY_ATTRIBUTE_MAPPING_KEY, "manyToManyMapping");
- OrmManyToManyMapping ormManyToManyMapping = (OrmManyToManyMapping) ormPersistentAttribute.getMapping();
- XmlManyToMany manyToMany = getXmlEntityMappings().getEntities().get(0).getAttributes().getManyToManys().get(0);
-
- assertEquals("manyToManyMapping", ormManyToManyMapping.getName());
- assertEquals("manyToManyMapping", manyToMany.getName());
-
- //set name in the resource model, verify context model updated
- manyToMany.setName("newName");
- assertEquals("newName", ormManyToManyMapping.getName());
- assertEquals("newName", manyToMany.getName());
-
- //set name to null in the resource model
- manyToMany.setName(null);
- assertNull(ormManyToManyMapping.getName());
- assertNull(manyToMany.getName());
- }
-
- public void testModifyName() throws Exception {
- OrmPersistentType ormPersistentType = getEntityMappings().addPersistentType(MappingKeys.ENTITY_TYPE_MAPPING_KEY, "model.Foo");
- OrmPersistentAttribute ormPersistentAttribute = ormPersistentType.addSpecifiedPersistentAttribute(MappingKeys.MANY_TO_MANY_ATTRIBUTE_MAPPING_KEY, "manyToManyMapping");
- OrmManyToManyMapping ormManyToManyMapping = (OrmManyToManyMapping) ormPersistentAttribute.getMapping();
- XmlManyToMany manyToMany = getXmlEntityMappings().getEntities().get(0).getAttributes().getManyToManys().get(0);
-
- assertEquals("manyToManyMapping", ormManyToManyMapping.getName());
- assertEquals("manyToManyMapping", manyToMany.getName());
-
- //set name in the context model, verify resource model updated
- ormManyToManyMapping.setName("newName");
- assertEquals("newName", ormManyToManyMapping.getName());
- assertEquals("newName", manyToMany.getName());
-
- //set name to null in the context model
- ormManyToManyMapping.setName(null);
- assertNull(ormManyToManyMapping.getName());
- assertNull(manyToMany.getName());
- }
-
- public void testUpdateTargetEntity() throws Exception {
- OrmPersistentType ormPersistentType = getEntityMappings().addPersistentType(MappingKeys.ENTITY_TYPE_MAPPING_KEY, "model.Foo");
- OrmPersistentAttribute ormPersistentAttribute = ormPersistentType.addSpecifiedPersistentAttribute(MappingKeys.MANY_TO_MANY_ATTRIBUTE_MAPPING_KEY, "manyToManyMapping");
- OrmManyToManyMapping ormManyToManyMapping = (OrmManyToManyMapping) ormPersistentAttribute.getMapping();
- XmlManyToMany manyToMany = getXmlEntityMappings().getEntities().get(0).getAttributes().getManyToManys().get(0);
-
- assertNull(ormManyToManyMapping.getSpecifiedTargetEntity());
- assertNull(manyToMany.getTargetEntity());
-
- //set target entity in the resource model, verify context model updated
- manyToMany.setTargetEntity("newTargetEntity");
- assertEquals("newTargetEntity", ormManyToManyMapping.getSpecifiedTargetEntity());
- assertEquals("newTargetEntity", manyToMany.getTargetEntity());
-
- //set target entity to null in the resource model
- manyToMany.setTargetEntity(null);
- assertNull(ormManyToManyMapping.getSpecifiedTargetEntity());
- assertNull(manyToMany.getTargetEntity());
- }
-
- public void testModifyTargetEntity() throws Exception {
- OrmPersistentType ormPersistentType = getEntityMappings().addPersistentType(MappingKeys.ENTITY_TYPE_MAPPING_KEY, "model.Foo");
- OrmPersistentAttribute ormPersistentAttribute = ormPersistentType.addSpecifiedPersistentAttribute(MappingKeys.MANY_TO_MANY_ATTRIBUTE_MAPPING_KEY, "manyToManyMapping");
- OrmManyToManyMapping ormManyToManyMapping = (OrmManyToManyMapping) ormPersistentAttribute.getMapping();
- XmlManyToMany manyToMany = getXmlEntityMappings().getEntities().get(0).getAttributes().getManyToManys().get(0);
-
- assertNull(ormManyToManyMapping.getSpecifiedTargetEntity());
- assertNull(manyToMany.getTargetEntity());
-
- //set target entity in the context model, verify resource model updated
- ormManyToManyMapping.setSpecifiedTargetEntity("newTargetEntity");
- assertEquals("newTargetEntity", ormManyToManyMapping.getSpecifiedTargetEntity());
- assertEquals("newTargetEntity", manyToMany.getTargetEntity());
-
- //set target entity to null in the context model
- ormManyToManyMapping.setSpecifiedTargetEntity(null);
- assertNull(ormManyToManyMapping.getSpecifiedTargetEntity());
- assertNull(manyToMany.getTargetEntity());
- }
-
- public void testUpdateSpecifiedFetch() throws Exception {
- OrmPersistentType ormPersistentType = getEntityMappings().addPersistentType(MappingKeys.ENTITY_TYPE_MAPPING_KEY, "model.Foo");
- OrmPersistentAttribute ormPersistentAttribute = ormPersistentType.addSpecifiedPersistentAttribute(MappingKeys.MANY_TO_MANY_ATTRIBUTE_MAPPING_KEY, "manyToManyMapping");
- OrmManyToManyMapping ormManyToManyMapping = (OrmManyToManyMapping) ormPersistentAttribute.getMapping();
- XmlManyToMany manyToManyResource = getXmlEntityMappings().getEntities().get(0).getAttributes().getManyToManys().get(0);
-
- assertNull(ormManyToManyMapping.getSpecifiedFetch());
- assertNull(manyToManyResource.getFetch());
-
- //set fetch in the resource model, verify context model updated
- manyToManyResource.setFetch(org.eclipse.jpt.core.resource.orm.FetchType.EAGER);
- assertEquals(FetchType.EAGER, ormManyToManyMapping.getSpecifiedFetch());
- assertEquals(org.eclipse.jpt.core.resource.orm.FetchType.EAGER, manyToManyResource.getFetch());
-
- manyToManyResource.setFetch(org.eclipse.jpt.core.resource.orm.FetchType.LAZY);
- assertEquals(FetchType.LAZY, ormManyToManyMapping.getSpecifiedFetch());
- assertEquals(org.eclipse.jpt.core.resource.orm.FetchType.LAZY, manyToManyResource.getFetch());
-
- //set fetch to null in the resource model
- manyToManyResource.setFetch(null);
- assertNull(ormManyToManyMapping.getSpecifiedFetch());
- assertNull(manyToManyResource.getFetch());
- }
-
- public void testModifySpecifiedFetch() throws Exception {
- OrmPersistentType ormPersistentType = getEntityMappings().addPersistentType(MappingKeys.ENTITY_TYPE_MAPPING_KEY, "model.Foo");
- OrmPersistentAttribute ormPersistentAttribute = ormPersistentType.addSpecifiedPersistentAttribute(MappingKeys.MANY_TO_MANY_ATTRIBUTE_MAPPING_KEY, "manyToManyMapping");
- OrmManyToManyMapping ormManyToManyMapping = (OrmManyToManyMapping) ormPersistentAttribute.getMapping();
- XmlManyToMany manyToManyResource = getXmlEntityMappings().getEntities().get(0).getAttributes().getManyToManys().get(0);
-
- assertNull(ormManyToManyMapping.getSpecifiedFetch());
- assertNull(manyToManyResource.getFetch());
-
- //set fetch in the context model, verify resource model updated
- ormManyToManyMapping.setSpecifiedFetch(FetchType.EAGER);
- assertEquals(org.eclipse.jpt.core.resource.orm.FetchType.EAGER, manyToManyResource.getFetch());
- assertEquals(FetchType.EAGER, ormManyToManyMapping.getSpecifiedFetch());
-
- ormManyToManyMapping.setSpecifiedFetch(FetchType.LAZY);
- assertEquals(org.eclipse.jpt.core.resource.orm.FetchType.LAZY, manyToManyResource.getFetch());
- assertEquals(FetchType.LAZY, ormManyToManyMapping.getSpecifiedFetch());
-
- //set fetch to null in the context model
- ormManyToManyMapping.setSpecifiedFetch(null);
- assertNull(manyToManyResource.getFetch());
- assertNull(ormManyToManyMapping.getSpecifiedFetch());
- }
-
- public void testUpdateMappedBy() throws Exception {
- OrmPersistentType ormPersistentType = getEntityMappings().addPersistentType(MappingKeys.ENTITY_TYPE_MAPPING_KEY, "model.Foo");
- OrmPersistentAttribute ormPersistentAttribute = ormPersistentType.addSpecifiedPersistentAttribute(MappingKeys.MANY_TO_MANY_ATTRIBUTE_MAPPING_KEY, "manyToManyMapping");
- OrmManyToManyMapping ormManyToManyMapping = (OrmManyToManyMapping) ormPersistentAttribute.getMapping();
- OrmMappedByJoiningStrategy strategy = ormManyToManyMapping.getRelationshipReference().getMappedByJoiningStrategy();
- XmlManyToMany manyToMany = getXmlEntityMappings().getEntities().get(0).getAttributes().getManyToManys().get(0);
-
- assertNull(strategy.getMappedByAttribute());
- assertNull(manyToMany.getMappedBy());
-
- //set mappedBy in the resource model, verify context model updated
- manyToMany.setMappedBy("newMappedBy");
- assertEquals("newMappedBy", strategy.getMappedByAttribute());
- assertEquals("newMappedBy", manyToMany.getMappedBy());
-
- //setmappedBy to null in the resource model
- manyToMany.setMappedBy(null);
- assertNull(strategy.getMappedByAttribute());
- assertNull(manyToMany.getMappedBy());
- }
-
- public void testModifyMappedBy() throws Exception {
- OrmPersistentType ormPersistentType = getEntityMappings().addPersistentType(MappingKeys.ENTITY_TYPE_MAPPING_KEY, "model.Foo");
- OrmPersistentAttribute ormPersistentAttribute = ormPersistentType.addSpecifiedPersistentAttribute(MappingKeys.MANY_TO_MANY_ATTRIBUTE_MAPPING_KEY, "manyToManyMapping");
- OrmManyToManyMapping ormManyToManyMapping = (OrmManyToManyMapping) ormPersistentAttribute.getMapping();
- OrmMappedByJoiningStrategy strategy = ormManyToManyMapping.getRelationshipReference().getMappedByJoiningStrategy();
- XmlManyToMany manyToMany = getXmlEntityMappings().getEntities().get(0).getAttributes().getManyToManys().get(0);
-
- assertNull(strategy.getMappedByAttribute());
- assertNull(manyToMany.getMappedBy());
-
- //set mappedBy in the context model, verify resource model updated
- strategy.setMappedByAttribute("newMappedBy");
- assertEquals("newMappedBy", strategy.getMappedByAttribute());
- assertEquals("newMappedBy", manyToMany.getMappedBy());
-
- //set mappedBy to null in the context model
- strategy.setMappedByAttribute(null);
- assertNull(strategy.getMappedByAttribute());
- assertNull(manyToMany.getMappedBy());
- }
-
- public void testUpdateMapKey() throws Exception {
- OrmPersistentType ormPersistentType = getEntityMappings().addPersistentType(MappingKeys.ENTITY_TYPE_MAPPING_KEY, "model.Foo");
- OrmPersistentAttribute ormPersistentAttribute = ormPersistentType.addSpecifiedPersistentAttribute(MappingKeys.MANY_TO_MANY_ATTRIBUTE_MAPPING_KEY, "manyToManyMapping");
- OrmManyToManyMapping ormManyToManyMapping = (OrmManyToManyMapping) ormPersistentAttribute.getMapping();
- XmlManyToMany manyToMany = getXmlEntityMappings().getEntities().get(0).getAttributes().getManyToManys().get(0);
-
- assertNull(ormManyToManyMapping.getMapKey());
- assertNull(manyToMany.getMapKey());
-
- //set mapKey in the resource model, verify context model does not change
- manyToMany.setMapKey(OrmFactory.eINSTANCE.createMapKey());
- assertNull(ormManyToManyMapping.getMapKey());
- assertNotNull(manyToMany.getMapKey());
-
- //set mapKey name in the resource model, verify context model updated
- manyToMany.getMapKey().setName("myMapKey");
- assertEquals("myMapKey", ormManyToManyMapping.getMapKey());
- assertEquals("myMapKey", manyToMany.getMapKey().getName());
-
- //set mapKey name to null in the resource model
- manyToMany.getMapKey().setName(null);
- assertNull(ormManyToManyMapping.getMapKey());
- assertNull(manyToMany.getMapKey().getName());
-
- manyToMany.getMapKey().setName("myMapKey");
- manyToMany.setMapKey(null);
- assertNull(ormManyToManyMapping.getMapKey());
- assertNull(manyToMany.getMapKey());
- }
-
- public void testModifyMapKey() throws Exception {
- OrmPersistentType ormPersistentType = getEntityMappings().addPersistentType(MappingKeys.ENTITY_TYPE_MAPPING_KEY, "model.Foo");
- OrmPersistentAttribute ormPersistentAttribute = ormPersistentType.addSpecifiedPersistentAttribute(MappingKeys.MANY_TO_MANY_ATTRIBUTE_MAPPING_KEY, "manyToManyMapping");
- OrmManyToManyMapping ormManyToManyMapping = (OrmManyToManyMapping) ormPersistentAttribute.getMapping();
- XmlManyToMany manyToMany = getXmlEntityMappings().getEntities().get(0).getAttributes().getManyToManys().get(0);
-
- assertNull(ormManyToManyMapping.getMapKey());
- assertNull(manyToMany.getMapKey());
-
- //set mapKey in the context model, verify resource model updated
- ormManyToManyMapping.setMapKey("myMapKey");
- assertEquals("myMapKey", ormManyToManyMapping.getMapKey());
- assertEquals("myMapKey", manyToMany.getMapKey().getName());
-
- //set mapKey to null in the context model
- ormManyToManyMapping.setMapKey(null);
- assertNull(ormManyToManyMapping.getMapKey());
- assertNull(manyToMany.getMapKey());
- }
-
- public void testUpdateOrderBy() throws Exception {
- OrmPersistentType ormPersistentType = getEntityMappings().addPersistentType(MappingKeys.ENTITY_TYPE_MAPPING_KEY, "model.Foo");
- OrmPersistentAttribute ormPersistentAttribute = ormPersistentType.addSpecifiedPersistentAttribute(MappingKeys.MANY_TO_MANY_ATTRIBUTE_MAPPING_KEY, "manyToManyMapping");
- OrmManyToManyMapping ormManyToManyMapping = (OrmManyToManyMapping) ormPersistentAttribute.getMapping();
- XmlManyToMany manyToMany = getXmlEntityMappings().getEntities().get(0).getAttributes().getManyToManys().get(0);
-
- assertNull(ormManyToManyMapping.getOrderBy());
- assertNull(manyToMany.getOrderBy());
-
- //set orderBy in the resource model, verify context model updated
- manyToMany.setOrderBy("newOrderBy");
- assertEquals("newOrderBy", ormManyToManyMapping.getOrderBy());
- assertEquals("newOrderBy", manyToMany.getOrderBy());
-
- //set orderBy to null in the resource model
- manyToMany.setOrderBy(null);
- assertNull(ormManyToManyMapping.getOrderBy());
- assertNull(manyToMany.getOrderBy());
- }
-
- public void testModifyOrderBy() throws Exception {
- OrmPersistentType ormPersistentType = getEntityMappings().addPersistentType(MappingKeys.ENTITY_TYPE_MAPPING_KEY, "model.Foo");
- OrmPersistentAttribute ormPersistentAttribute = ormPersistentType.addSpecifiedPersistentAttribute(MappingKeys.MANY_TO_MANY_ATTRIBUTE_MAPPING_KEY, "manyToManyMapping");
- OrmManyToManyMapping ormManyToManyMapping = (OrmManyToManyMapping) ormPersistentAttribute.getMapping();
- XmlManyToMany manyToMany = getXmlEntityMappings().getEntities().get(0).getAttributes().getManyToManys().get(0);
-
- assertNull(ormManyToManyMapping.getOrderBy());
- assertNull(manyToMany.getOrderBy());
-
- //set mappedBy in the context model, verify resource model updated
- ormManyToManyMapping.setOrderBy("newOrderBy");
- assertEquals("newOrderBy", ormManyToManyMapping.getOrderBy());
- assertEquals("newOrderBy", manyToMany.getOrderBy());
-
- //set mappedBy to null in the context model
- ormManyToManyMapping.setOrderBy(null);
- assertNull(ormManyToManyMapping.getOrderBy());
- assertNull(manyToMany.getOrderBy());
- }
-
- public void testIsNoOrdering() throws Exception {
- OrmPersistentType ormPersistentType = getEntityMappings().addPersistentType(MappingKeys.ENTITY_TYPE_MAPPING_KEY, "model.Foo");
- OrmPersistentAttribute ormPersistentAttribute = ormPersistentType.addSpecifiedPersistentAttribute(MappingKeys.MANY_TO_MANY_ATTRIBUTE_MAPPING_KEY, "manyToManyMapping");
- OrmManyToManyMapping ormManyToManyMapping = (OrmManyToManyMapping) ormPersistentAttribute.getMapping();
-
- assertTrue(ormManyToManyMapping.isNoOrdering());
-
- ormManyToManyMapping.setOrderBy("foo");
- assertFalse(ormManyToManyMapping.isNoOrdering());
-
- ormManyToManyMapping.setOrderBy(null);
- assertTrue(ormManyToManyMapping.isNoOrdering());
- }
-
- public void testSetNoOrdering() throws Exception {
- OrmPersistentType ormPersistentType = getEntityMappings().addPersistentType(MappingKeys.ENTITY_TYPE_MAPPING_KEY, "model.Foo");
- OrmPersistentAttribute ormPersistentAttribute = ormPersistentType.addSpecifiedPersistentAttribute(MappingKeys.MANY_TO_MANY_ATTRIBUTE_MAPPING_KEY, "manyToManyMapping");
- OrmManyToManyMapping ormManyToManyMapping = (OrmManyToManyMapping) ormPersistentAttribute.getMapping();
-
- assertTrue(ormManyToManyMapping.isNoOrdering());
-
- ormManyToManyMapping.setOrderBy("foo");
- assertFalse(ormManyToManyMapping.isNoOrdering());
-
- ormManyToManyMapping.setNoOrdering(true);
- assertTrue(ormManyToManyMapping.isNoOrdering());
- assertNull(ormManyToManyMapping.getOrderBy());
- }
-//TODO
-// public boolean isOrderByPk() {
-// return "".equals(getOrderBy());
-// }
-//
-// public void setOrderByPk() {
-// setOrderBy("");
-// }
-
- public void testIsCustomOrdering() throws Exception {
- OrmPersistentType ormPersistentType = getEntityMappings().addPersistentType(MappingKeys.ENTITY_TYPE_MAPPING_KEY, "model.Foo");
- OrmPersistentAttribute ormPersistentAttribute = ormPersistentType.addSpecifiedPersistentAttribute(MappingKeys.MANY_TO_MANY_ATTRIBUTE_MAPPING_KEY, "manyToManyMapping");
- OrmManyToManyMapping ormManyToManyMapping = (OrmManyToManyMapping) ormPersistentAttribute.getMapping();
-
- assertFalse(ormManyToManyMapping.isCustomOrdering());
-
- ormManyToManyMapping.setOrderBy("foo");
- assertTrue(ormManyToManyMapping.isCustomOrdering());
-
- ormManyToManyMapping.setOrderBy(null);
- assertFalse(ormManyToManyMapping.isCustomOrdering());
- }
-
- public void testManyToManyMorphToIdMapping() throws Exception {
- OrmPersistentType ormPersistentType = getEntityMappings().addPersistentType(MappingKeys.ENTITY_TYPE_MAPPING_KEY, FULLY_QUALIFIED_TYPE_NAME);
- OrmPersistentAttribute ormPersistentAttribute = ormPersistentType.addSpecifiedPersistentAttribute(MappingKeys.MANY_TO_MANY_ATTRIBUTE_MAPPING_KEY, "manyToMany");
-
- ManyToManyMapping manyToManyMapping = (ManyToManyMapping) ormPersistentAttribute.getMapping();
- assertFalse(manyToManyMapping.isDefault());
- manyToManyMapping.setSpecifiedFetch(FetchType.EAGER);
- manyToManyMapping.setSpecifiedTargetEntity("TargetEntity");
- manyToManyMapping.setOrderBy("customOrder");
- manyToManyMapping.setMapKey("mapKey");
- assertFalse(manyToManyMapping.isDefault());
-
- ormPersistentAttribute.setSpecifiedMappingKey(MappingKeys.ID_ATTRIBUTE_MAPPING_KEY);
- assertEquals(1, ormPersistentType.specifiedAttributesSize());
- assertEquals(ormPersistentAttribute, ormPersistentType.specifiedAttributes().next());
- assertTrue(ormPersistentAttribute.getMapping() instanceof IdMapping);
- assertEquals("manyToMany", ormPersistentAttribute.getMapping().getName());
- }
-
- public void testManyToManyMorphToVersionMapping() throws Exception {
- OrmPersistentType ormPersistentType = getEntityMappings().addPersistentType(MappingKeys.ENTITY_TYPE_MAPPING_KEY, FULLY_QUALIFIED_TYPE_NAME);
- OrmPersistentAttribute ormPersistentAttribute = ormPersistentType.addSpecifiedPersistentAttribute(MappingKeys.MANY_TO_MANY_ATTRIBUTE_MAPPING_KEY, "manyToMany");
-
- ManyToManyMapping manyToManyMapping = (ManyToManyMapping) ormPersistentAttribute.getMapping();
- assertFalse(manyToManyMapping.isDefault());
- manyToManyMapping.setSpecifiedFetch(FetchType.EAGER);
- manyToManyMapping.setSpecifiedTargetEntity("TargetEntity");
- manyToManyMapping.setOrderBy("customOrder");
- manyToManyMapping.setMapKey("mapKey");
- assertFalse(manyToManyMapping.isDefault());
-
- ormPersistentAttribute.setSpecifiedMappingKey(MappingKeys.VERSION_ATTRIBUTE_MAPPING_KEY);
- assertEquals(1, ormPersistentType.specifiedAttributesSize());
- assertEquals(ormPersistentAttribute, ormPersistentType.specifiedAttributes().next());
- assertTrue(ormPersistentAttribute.getMapping() instanceof VersionMapping);
- assertEquals("manyToMany", ormPersistentAttribute.getMapping().getName());
- }
-
- public void testManyToManyMorphToTransientMapping() throws Exception {
- OrmPersistentType ormPersistentType = getEntityMappings().addPersistentType(MappingKeys.ENTITY_TYPE_MAPPING_KEY, FULLY_QUALIFIED_TYPE_NAME);
- OrmPersistentAttribute ormPersistentAttribute = ormPersistentType.addSpecifiedPersistentAttribute(MappingKeys.MANY_TO_MANY_ATTRIBUTE_MAPPING_KEY, "manyToMany");
-
- ManyToManyMapping manyToManyMapping = (ManyToManyMapping) ormPersistentAttribute.getMapping();
- assertFalse(manyToManyMapping.isDefault());
- manyToManyMapping.setSpecifiedFetch(FetchType.EAGER);
- manyToManyMapping.setSpecifiedTargetEntity("TargetEntity");
- manyToManyMapping.setOrderBy("customOrder");
- manyToManyMapping.setMapKey("mapKey");
- assertFalse(manyToManyMapping.isDefault());
-
- ormPersistentAttribute.setSpecifiedMappingKey(MappingKeys.TRANSIENT_ATTRIBUTE_MAPPING_KEY);
- assertEquals(1, ormPersistentType.specifiedAttributesSize());
- assertEquals(ormPersistentAttribute, ormPersistentType.specifiedAttributes().next());
- assertTrue(ormPersistentAttribute.getMapping() instanceof TransientMapping);
- assertEquals("manyToMany", ormPersistentAttribute.getMapping().getName());
- }
-
- public void testManyToManyMorphToEmbeddedMapping() throws Exception {
- OrmPersistentType ormPersistentType = getEntityMappings().addPersistentType(MappingKeys.ENTITY_TYPE_MAPPING_KEY, FULLY_QUALIFIED_TYPE_NAME);
- OrmPersistentAttribute ormPersistentAttribute = ormPersistentType.addSpecifiedPersistentAttribute(MappingKeys.MANY_TO_MANY_ATTRIBUTE_MAPPING_KEY, "manyToMany");
-
- ManyToManyMapping manyToManyMapping = (ManyToManyMapping) ormPersistentAttribute.getMapping();
- assertFalse(manyToManyMapping.isDefault());
- manyToManyMapping.setSpecifiedFetch(FetchType.EAGER);
- manyToManyMapping.setSpecifiedTargetEntity("TargetEntity");
- manyToManyMapping.setOrderBy("customOrder");
- manyToManyMapping.setMapKey("mapKey");
- assertFalse(manyToManyMapping.isDefault());
-
- ormPersistentAttribute.setSpecifiedMappingKey(MappingKeys.EMBEDDED_ATTRIBUTE_MAPPING_KEY);
- assertEquals(1, ormPersistentType.specifiedAttributesSize());
- assertEquals(ormPersistentAttribute, ormPersistentType.specifiedAttributes().next());
- assertTrue(ormPersistentAttribute.getMapping() instanceof EmbeddedMapping);
- assertEquals("manyToMany", ormPersistentAttribute.getMapping().getName());
- }
-
- public void testManyToManyMorphToEmbeddedIdMapping() throws Exception {
- OrmPersistentType ormPersistentType = getEntityMappings().addPersistentType(MappingKeys.ENTITY_TYPE_MAPPING_KEY, FULLY_QUALIFIED_TYPE_NAME);
- OrmPersistentAttribute ormPersistentAttribute = ormPersistentType.addSpecifiedPersistentAttribute(MappingKeys.MANY_TO_MANY_ATTRIBUTE_MAPPING_KEY, "manyToMany");
-
- ManyToManyMapping manyToManyMapping = (ManyToManyMapping) ormPersistentAttribute.getMapping();
- assertFalse(manyToManyMapping.isDefault());
- manyToManyMapping.setSpecifiedFetch(FetchType.EAGER);
- manyToManyMapping.setSpecifiedTargetEntity("TargetEntity");
- manyToManyMapping.setOrderBy("customOrder");
- manyToManyMapping.setMapKey("mapKey");
- assertFalse(manyToManyMapping.isDefault());
-
- ormPersistentAttribute.setSpecifiedMappingKey(MappingKeys.EMBEDDED_ID_ATTRIBUTE_MAPPING_KEY);
- assertEquals(1, ormPersistentType.specifiedAttributesSize());
- assertEquals(ormPersistentAttribute, ormPersistentType.specifiedAttributes().next());
- assertTrue(ormPersistentAttribute.getMapping() instanceof EmbeddedIdMapping);
- assertEquals("manyToMany", ormPersistentAttribute.getMapping().getName());
- }
-
- public void testManyToManyMorphToOneToOneMapping() throws Exception {
- OrmPersistentType ormPersistentType = getEntityMappings().addPersistentType(MappingKeys.ENTITY_TYPE_MAPPING_KEY, FULLY_QUALIFIED_TYPE_NAME);
- OrmPersistentAttribute ormPersistentAttribute = ormPersistentType.addSpecifiedPersistentAttribute(MappingKeys.MANY_TO_MANY_ATTRIBUTE_MAPPING_KEY, "manyToMany");
-
- ManyToManyMapping manyToManyMapping = (ManyToManyMapping) ormPersistentAttribute.getMapping();
- assertFalse(manyToManyMapping.isDefault());
- manyToManyMapping.setSpecifiedFetch(FetchType.EAGER);
- manyToManyMapping.setSpecifiedTargetEntity("TargetEntity");
- manyToManyMapping.setOrderBy("customOrder");
- manyToManyMapping.setMapKey("mapKey");
- manyToManyMapping.getRelationshipReference().getMappedByJoiningStrategy().setMappedByAttribute("mappedBy");
- manyToManyMapping.getCascade().setAll(true);
- manyToManyMapping.getCascade().setMerge(true);
- manyToManyMapping.getCascade().setPersist(true);
- manyToManyMapping.getCascade().setRefresh(true);
- manyToManyMapping.getCascade().setRemove(true);
- assertFalse(manyToManyMapping.isDefault());
-
- ormPersistentAttribute.setSpecifiedMappingKey(MappingKeys.ONE_TO_ONE_ATTRIBUTE_MAPPING_KEY);
- assertEquals(1, ormPersistentType.specifiedAttributesSize());
- assertEquals(ormPersistentAttribute, ormPersistentType.specifiedAttributes().next());
- assertTrue(ormPersistentAttribute.getMapping() instanceof OneToOneMapping);
- assertEquals("manyToMany", ormPersistentAttribute.getMapping().getName());
- assertEquals(FetchType.EAGER, ((OneToOneMapping) ormPersistentAttribute.getMapping()).getSpecifiedFetch());
- assertEquals("TargetEntity", ((OneToOneMapping) ormPersistentAttribute.getMapping()).getSpecifiedTargetEntity());
- assertEquals("mappedBy", ((OneToOneMapping) ormPersistentAttribute.getMapping()).getRelationshipReference().getMappedByJoiningStrategy().getMappedByAttribute());
- assertTrue(((OneToOneMapping) ormPersistentAttribute.getMapping()).getCascade().isAll());
- assertTrue(((OneToOneMapping) ormPersistentAttribute.getMapping()).getCascade().isMerge());
- assertTrue(((OneToOneMapping) ormPersistentAttribute.getMapping()).getCascade().isPersist());
- assertTrue(((OneToOneMapping) ormPersistentAttribute.getMapping()).getCascade().isRefresh());
- assertTrue(((OneToOneMapping) ormPersistentAttribute.getMapping()).getCascade().isRemove());
- }
-
- public void testManyToManyMorphToOneToManyMapping() throws Exception {
- OrmPersistentType ormPersistentType = getEntityMappings().addPersistentType(MappingKeys.ENTITY_TYPE_MAPPING_KEY, FULLY_QUALIFIED_TYPE_NAME);
- OrmPersistentAttribute ormPersistentAttribute = ormPersistentType.addSpecifiedPersistentAttribute(MappingKeys.MANY_TO_MANY_ATTRIBUTE_MAPPING_KEY, "manyToMany");
-
- ManyToManyMapping manyToManyMapping = (ManyToManyMapping) ormPersistentAttribute.getMapping();
- assertFalse(manyToManyMapping.isDefault());
- manyToManyMapping.setSpecifiedFetch(FetchType.EAGER);
- manyToManyMapping.setSpecifiedTargetEntity("TargetEntity");
- manyToManyMapping.setOrderBy("customOrder");
- manyToManyMapping.setMapKey("mapKey");
- manyToManyMapping.getCascade().setAll(true);
- manyToManyMapping.getCascade().setMerge(true);
- manyToManyMapping.getCascade().setPersist(true);
- manyToManyMapping.getCascade().setRefresh(true);
- manyToManyMapping.getCascade().setRemove(true);
- manyToManyMapping.getRelationshipReference().getJoinTableJoiningStrategy().getJoinTable().setSpecifiedName("MY_JOIN_TABLE");
- JoinColumn joinColumn = manyToManyMapping.getRelationshipReference().getJoinTableJoiningStrategy().getJoinTable().addSpecifiedJoinColumn(0);
- joinColumn.setSpecifiedName("name");
- joinColumn.setSpecifiedReferencedColumnName("referenceName");
- JoinColumn inverseJoinColumn = manyToManyMapping.getRelationshipReference().getJoinTableJoiningStrategy().getJoinTable().addSpecifiedInverseJoinColumn(0);
- inverseJoinColumn.setSpecifiedName("inverseName");
- inverseJoinColumn.setSpecifiedReferencedColumnName("inverseReferenceName");
- assertFalse(manyToManyMapping.isDefault());
-
- ormPersistentAttribute.setSpecifiedMappingKey(MappingKeys.ONE_TO_MANY_ATTRIBUTE_MAPPING_KEY);
- assertEquals(1, ormPersistentType.specifiedAttributesSize());
- assertEquals(ormPersistentAttribute, ormPersistentType.specifiedAttributes().next());
- assertTrue(ormPersistentAttribute.getMapping() instanceof OneToManyMapping);
- assertEquals("manyToMany", ormPersistentAttribute.getMapping().getName());
- assertEquals(FetchType.EAGER, ((OneToManyMapping) ormPersistentAttribute.getMapping()).getSpecifiedFetch());
- assertEquals("TargetEntity", ((OneToManyMapping) ormPersistentAttribute.getMapping()).getSpecifiedTargetEntity());
- assertTrue(((OneToManyMapping) ormPersistentAttribute.getMapping()).getCascade().isAll());
- assertTrue(((OneToManyMapping) ormPersistentAttribute.getMapping()).getCascade().isMerge());
- assertTrue(((OneToManyMapping) ormPersistentAttribute.getMapping()).getCascade().isPersist());
- assertTrue(((OneToManyMapping) ormPersistentAttribute.getMapping()).getCascade().isRefresh());
- assertTrue(((OneToManyMapping) ormPersistentAttribute.getMapping()).getCascade().isRemove());
- JoinTable joinTable = ((OneToManyMapping) ormPersistentAttribute.getMapping()).getRelationshipReference().getJoinTableJoiningStrategy().getJoinTable();
- assertEquals("MY_JOIN_TABLE", joinTable.getName());
- assertEquals("name", joinTable.joinColumns().next().getSpecifiedName());
- assertEquals("referenceName", joinTable.joinColumns().next().getSpecifiedReferencedColumnName());
- assertEquals("inverseName", joinTable.inverseJoinColumns().next().getSpecifiedName());
- assertEquals("inverseReferenceName", joinTable.inverseJoinColumns().next().getSpecifiedReferencedColumnName());
- }
-
- public void testManyToManyMorphToManyToOneMapping() throws Exception {
- OrmPersistentType ormPersistentType = getEntityMappings().addPersistentType(MappingKeys.ENTITY_TYPE_MAPPING_KEY, FULLY_QUALIFIED_TYPE_NAME);
- OrmPersistentAttribute ormPersistentAttribute = ormPersistentType.addSpecifiedPersistentAttribute(MappingKeys.MANY_TO_MANY_ATTRIBUTE_MAPPING_KEY, "manyToMany");
-
- ManyToManyMapping manyToManyMapping = (ManyToManyMapping) ormPersistentAttribute.getMapping();
- assertFalse(manyToManyMapping.isDefault());
- manyToManyMapping.setSpecifiedFetch(FetchType.EAGER);
- manyToManyMapping.setSpecifiedTargetEntity("TargetEntity");
- manyToManyMapping.setOrderBy("customOrder");
- manyToManyMapping.setMapKey("mapKey");
- manyToManyMapping.getCascade().setAll(true);
- manyToManyMapping.getCascade().setMerge(true);
- manyToManyMapping.getCascade().setPersist(true);
- manyToManyMapping.getCascade().setRefresh(true);
- manyToManyMapping.getCascade().setRemove(true);
- assertFalse(manyToManyMapping.isDefault());
-
- ormPersistentAttribute.setSpecifiedMappingKey(MappingKeys.MANY_TO_ONE_ATTRIBUTE_MAPPING_KEY);
- assertEquals(1, ormPersistentType.specifiedAttributesSize());
- assertEquals(ormPersistentAttribute, ormPersistentType.specifiedAttributes().next());
- assertTrue(ormPersistentAttribute.getMapping() instanceof ManyToOneMapping);
- assertEquals("manyToMany", ormPersistentAttribute.getMapping().getName());
- assertEquals(FetchType.EAGER, ((ManyToOneMapping) ormPersistentAttribute.getMapping()).getSpecifiedFetch());
- assertEquals("TargetEntity", ((ManyToOneMapping) ormPersistentAttribute.getMapping()).getSpecifiedTargetEntity());
- assertTrue(((ManyToOneMapping) ormPersistentAttribute.getMapping()).getCascade().isAll());
- assertTrue(((ManyToOneMapping) ormPersistentAttribute.getMapping()).getCascade().isMerge());
- assertTrue(((ManyToOneMapping) ormPersistentAttribute.getMapping()).getCascade().isPersist());
- assertTrue(((ManyToOneMapping) ormPersistentAttribute.getMapping()).getCascade().isRefresh());
- assertTrue(((ManyToOneMapping) ormPersistentAttribute.getMapping()).getCascade().isRemove());
- }
-
- public void testManyToManyMorphToBasicMapping() throws Exception {
- OrmPersistentType ormPersistentType = getEntityMappings().addPersistentType(MappingKeys.ENTITY_TYPE_MAPPING_KEY, FULLY_QUALIFIED_TYPE_NAME);
- OrmPersistentAttribute ormPersistentAttribute = ormPersistentType.addSpecifiedPersistentAttribute(MappingKeys.MANY_TO_MANY_ATTRIBUTE_MAPPING_KEY, "manyToMany");
-
- ManyToManyMapping manyToManyMapping = (ManyToManyMapping) ormPersistentAttribute.getMapping();
- assertFalse(manyToManyMapping.isDefault());
- manyToManyMapping.setSpecifiedFetch(FetchType.EAGER);
- manyToManyMapping.setSpecifiedTargetEntity("TargetEntity");
- manyToManyMapping.setOrderBy("customOrder");
- manyToManyMapping.setMapKey("mapKey");
- manyToManyMapping.getCascade().setAll(true);
- manyToManyMapping.getCascade().setMerge(true);
- manyToManyMapping.getCascade().setPersist(true);
- manyToManyMapping.getCascade().setRefresh(true);
- manyToManyMapping.getCascade().setRemove(true);
- assertFalse(manyToManyMapping.isDefault());
-
- ormPersistentAttribute.setSpecifiedMappingKey(MappingKeys.BASIC_ATTRIBUTE_MAPPING_KEY);
- assertEquals(1, ormPersistentType.specifiedAttributesSize());
- assertEquals(ormPersistentAttribute, ormPersistentType.specifiedAttributes().next());
- assertTrue(ormPersistentAttribute.getMapping() instanceof BasicMapping);
- assertEquals("manyToMany", ormPersistentAttribute.getMapping().getName());
-//TODO assertEquals(FetchType.EAGER, ((IBasicMapping) ormPersistentAttribute.getMapping()).getSpecifiedFetch());
- }
-} \ No newline at end of file
diff --git a/jpa/tests/org.eclipse.jpt.core.tests/src/org/eclipse/jpt/core/tests/internal/context/orm/OrmManyToOneMappingTests.java b/jpa/tests/org.eclipse.jpt.core.tests/src/org/eclipse/jpt/core/tests/internal/context/orm/OrmManyToOneMappingTests.java
deleted file mode 100644
index 43e25d837a..0000000000
--- a/jpa/tests/org.eclipse.jpt.core.tests/src/org/eclipse/jpt/core/tests/internal/context/orm/OrmManyToOneMappingTests.java
+++ /dev/null
@@ -1,548 +0,0 @@
-/*******************************************************************************
- * Copyright (c) 2007, 2009 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.
- *
- * Contributors:
- * Oracle - initial API and implementation
- ******************************************************************************/
-package org.eclipse.jpt.core.tests.internal.context.orm;
-
-import java.util.Iterator;
-import java.util.ListIterator;
-import org.eclipse.jdt.core.ICompilationUnit;
-import org.eclipse.jpt.core.JptCorePlugin;
-import org.eclipse.jpt.core.MappingKeys;
-import org.eclipse.jpt.core.context.Cascade;
-import org.eclipse.jpt.core.context.FetchType;
-import org.eclipse.jpt.core.context.orm.OrmJoinColumn;
-import org.eclipse.jpt.core.context.orm.OrmJoinColumnJoiningStrategy;
-import org.eclipse.jpt.core.context.orm.OrmManyToOneMapping;
-import org.eclipse.jpt.core.context.orm.OrmPersistentAttribute;
-import org.eclipse.jpt.core.context.orm.OrmPersistentType;
-import org.eclipse.jpt.core.resource.java.JPA;
-import org.eclipse.jpt.core.resource.orm.XmlManyToOne;
-import org.eclipse.jpt.core.resource.persistence.PersistenceFactory;
-import org.eclipse.jpt.core.resource.persistence.XmlMappingFileRef;
-import org.eclipse.jpt.core.tests.internal.context.ContextModelTestCase;
-import org.eclipse.jpt.core.tests.internal.projects.TestJavaProject.SourceWriter;
-import org.eclipse.jpt.utility.internal.iterators.ArrayIterator;
-
-@SuppressWarnings("nls")
-public class OrmManyToOneMappingTests extends ContextModelTestCase
-{
- public OrmManyToOneMappingTests(String name) {
- super(name);
- }
-
- @Override
- protected void setUp() throws Exception {
- super.setUp();
- XmlMappingFileRef mappingFileRef = PersistenceFactory.eINSTANCE.createXmlMappingFileRef();
- mappingFileRef.setFileName(JptCorePlugin.DEFAULT_ORM_XML_FILE_PATH);
- getXmlPersistenceUnit().getMappingFiles().add(mappingFileRef);
- getPersistenceXmlResource().save(null);
- }
-
- private ICompilationUnit createTestEntityManyToOneMapping() throws Exception {
- return this.createTestType(new DefaultAnnotationWriter() {
- @Override
- public Iterator<String> imports() {
- return new ArrayIterator<String>(JPA.ENTITY, JPA.MANY_TO_ONE, JPA.JOIN_COLUMN, JPA.FETCH_TYPE, JPA.CASCADE_TYPE);
- }
- @Override
- public void appendTypeAnnotationTo(StringBuilder sb) {
- sb.append("@Entity");
- }
-
- @Override
- public void appendIdFieldAnnotationTo(StringBuilder sb) {
- sb.append(CR);
- sb.append(" @ManyToOne(fetch=FetchType.LAZY, optional=false, targetEntity=Address.class, cascade={CascadeType.ALL, CascadeType.PERSIST, CascadeType.MERGE, CascadeType.REMOVE, CascadeType.REFRESH})");
- sb.append(CR);
- sb.append(" @JoinColumn(name=\"MY_COLUMN\", referencedColumnName=\"MY_REFERENCED_COLUMN\", unique=true, nullable=false, insertable=false, updatable=false, columnDefinition=\"COLUMN_DEFINITION\", table=\"MY_TABLE\")");
- sb.append(CR);
- sb.append(" private Address address;").append(CR);
- sb.append(CR);
- sb.append(" @Id");
- }
- });
- }
-
- private void createTestTargetEntityAddress() throws Exception {
- SourceWriter sourceWriter = new SourceWriter() {
- public void appendSourceTo(StringBuilder sb) {
- sb.append(CR);
- sb.append("import ");
- sb.append(JPA.ENTITY);
- sb.append(";");
- sb.append(CR);
- sb.append("import ");
- sb.append(JPA.ID);
- sb.append(";");
- sb.append(CR);
- sb.append(CR);
- sb.append("@Entity");
- sb.append(CR);
- sb.append("public class ").append("Address").append(" ");
- sb.append("{").append(CR);
- sb.append(CR);
- sb.append(" @Id").append(CR);
- sb.append(" private int id;").append(CR);
- sb.append(CR);
- sb.append(" private String city;").append(CR);
- sb.append(CR);
- sb.append(" private String state;").append(CR);
- sb.append(CR);
- sb.append(" private int zip;").append(CR);
- sb.append(CR);
- sb.append("}").append(CR);
- }
- };
- this.javaProject.createCompilationUnit(PACKAGE_NAME, "Address.java", sourceWriter);
- }
-
- public void testUpdateName() throws Exception {
- OrmPersistentType ormPersistentType = getEntityMappings().addPersistentType(MappingKeys.ENTITY_TYPE_MAPPING_KEY, "model.Foo");
- OrmPersistentAttribute ormPersistentAttribute = ormPersistentType.addSpecifiedPersistentAttribute(MappingKeys.MANY_TO_ONE_ATTRIBUTE_MAPPING_KEY, "manyToOneMapping");
- OrmManyToOneMapping ormManyToOneMapping = (OrmManyToOneMapping) ormPersistentAttribute.getMapping();
- XmlManyToOne manyToOne = getXmlEntityMappings().getEntities().get(0).getAttributes().getManyToOnes().get(0);
-
- assertEquals("manyToOneMapping", ormManyToOneMapping.getName());
- assertEquals("manyToOneMapping", manyToOne.getName());
-
- //set name in the resource model, verify context model updated
- manyToOne.setName("newName");
- assertEquals("newName", ormManyToOneMapping.getName());
- assertEquals("newName", manyToOne.getName());
-
- //set name to null in the resource model
- manyToOne.setName(null);
- assertNull(ormManyToOneMapping.getName());
- assertNull(manyToOne.getName());
- }
-
- public void testModifyName() throws Exception {
- OrmPersistentType ormPersistentType = getEntityMappings().addPersistentType(MappingKeys.ENTITY_TYPE_MAPPING_KEY, "model.Foo");
- OrmPersistentAttribute ormPersistentAttribute = ormPersistentType.addSpecifiedPersistentAttribute(MappingKeys.MANY_TO_ONE_ATTRIBUTE_MAPPING_KEY, "manyToOneMapping");
- OrmManyToOneMapping ormManyToOneMapping = (OrmManyToOneMapping) ormPersistentAttribute.getMapping();
- XmlManyToOne manyToOne = getXmlEntityMappings().getEntities().get(0).getAttributes().getManyToOnes().get(0);
-
- assertEquals("manyToOneMapping", ormManyToOneMapping.getName());
- assertEquals("manyToOneMapping", manyToOne.getName());
-
- //set name in the context model, verify resource model updated
- ormManyToOneMapping.setName("newName");
- assertEquals("newName", ormManyToOneMapping.getName());
- assertEquals("newName", manyToOne.getName());
-
- //set name to null in the context model
- ormManyToOneMapping.setName(null);
- assertNull(ormManyToOneMapping.getName());
- assertNull(manyToOne.getName());
- }
-
- public void testUpdateTargetEntity() throws Exception {
- OrmPersistentType ormPersistentType = getEntityMappings().addPersistentType(MappingKeys.ENTITY_TYPE_MAPPING_KEY, "model.Foo");
- OrmPersistentAttribute ormPersistentAttribute = ormPersistentType.addSpecifiedPersistentAttribute(MappingKeys.MANY_TO_ONE_ATTRIBUTE_MAPPING_KEY, "manyToOneMapping");
- OrmManyToOneMapping ormManyToOneMapping = (OrmManyToOneMapping) ormPersistentAttribute.getMapping();
- XmlManyToOne manyToOne = getXmlEntityMappings().getEntities().get(0).getAttributes().getManyToOnes().get(0);
-
- assertNull(ormManyToOneMapping.getSpecifiedTargetEntity());
- assertNull(manyToOne.getTargetEntity());
-
- //set target entity in the resource model, verify context model updated
- manyToOne.setTargetEntity("newTargetEntity");
- assertEquals("newTargetEntity", ormManyToOneMapping.getSpecifiedTargetEntity());
- assertEquals("newTargetEntity", manyToOne.getTargetEntity());
-
- //set target entity to null in the resource model
- manyToOne.setTargetEntity(null);
- assertNull(ormManyToOneMapping.getSpecifiedTargetEntity());
- assertNull(manyToOne.getTargetEntity());
- }
-
- public void testModifyTargetEntity() throws Exception {
- OrmPersistentType ormPersistentType = getEntityMappings().addPersistentType(MappingKeys.ENTITY_TYPE_MAPPING_KEY, "model.Foo");
- OrmPersistentAttribute ormPersistentAttribute = ormPersistentType.addSpecifiedPersistentAttribute(MappingKeys.MANY_TO_ONE_ATTRIBUTE_MAPPING_KEY, "manyToOneMapping");
- OrmManyToOneMapping ormManyToOneMapping = (OrmManyToOneMapping) ormPersistentAttribute.getMapping();
- XmlManyToOne manyToOne = getXmlEntityMappings().getEntities().get(0).getAttributes().getManyToOnes().get(0);
-
- assertNull(ormManyToOneMapping.getSpecifiedTargetEntity());
- assertNull(manyToOne.getTargetEntity());
-
- //set target entity in the context model, verify resource model updated
- ormManyToOneMapping.setSpecifiedTargetEntity("newTargetEntity");
- assertEquals("newTargetEntity", ormManyToOneMapping.getSpecifiedTargetEntity());
- assertEquals("newTargetEntity", manyToOne.getTargetEntity());
-
- //set target entity to null in the context model
- ormManyToOneMapping.setSpecifiedTargetEntity(null);
- assertNull(ormManyToOneMapping.getSpecifiedTargetEntity());
- assertNull(manyToOne.getTargetEntity());
- }
-
- public void testUpdateSpecifiedFetch() throws Exception {
- OrmPersistentType ormPersistentType = getEntityMappings().addPersistentType(MappingKeys.ENTITY_TYPE_MAPPING_KEY, "model.Foo");
- OrmPersistentAttribute ormPersistentAttribute = ormPersistentType.addSpecifiedPersistentAttribute(MappingKeys.MANY_TO_ONE_ATTRIBUTE_MAPPING_KEY, "manyToOneMapping");
- OrmManyToOneMapping ormManyToOneMapping = (OrmManyToOneMapping) ormPersistentAttribute.getMapping();
- XmlManyToOne manyToOneResource = getXmlEntityMappings().getEntities().get(0).getAttributes().getManyToOnes().get(0);
-
- assertNull(ormManyToOneMapping.getSpecifiedFetch());
- assertNull(manyToOneResource.getFetch());
-
- //set fetch in the resource model, verify context model updated
- manyToOneResource.setFetch(org.eclipse.jpt.core.resource.orm.FetchType.EAGER);
- assertEquals(FetchType.EAGER, ormManyToOneMapping.getSpecifiedFetch());
- assertEquals(org.eclipse.jpt.core.resource.orm.FetchType.EAGER, manyToOneResource.getFetch());
-
- manyToOneResource.setFetch(org.eclipse.jpt.core.resource.orm.FetchType.LAZY);
- assertEquals(FetchType.LAZY, ormManyToOneMapping.getSpecifiedFetch());
- assertEquals(org.eclipse.jpt.core.resource.orm.FetchType.LAZY, manyToOneResource.getFetch());
-
- //set fetch to null in the resource model
- manyToOneResource.setFetch(null);
- assertNull(ormManyToOneMapping.getSpecifiedFetch());
- assertNull(manyToOneResource.getFetch());
- }
-
- public void testModifySpecifiedFetch() throws Exception {
- OrmPersistentType ormPersistentType = getEntityMappings().addPersistentType(MappingKeys.ENTITY_TYPE_MAPPING_KEY, "model.Foo");
- OrmPersistentAttribute ormPersistentAttribute = ormPersistentType.addSpecifiedPersistentAttribute(MappingKeys.MANY_TO_ONE_ATTRIBUTE_MAPPING_KEY, "manyToOneMapping");
- OrmManyToOneMapping ormManyToOneMapping = (OrmManyToOneMapping) ormPersistentAttribute.getMapping();
- XmlManyToOne manyToOneResource = getXmlEntityMappings().getEntities().get(0).getAttributes().getManyToOnes().get(0);
-
- assertNull(ormManyToOneMapping.getSpecifiedFetch());
- assertNull(manyToOneResource.getFetch());
-
- //set fetch in the context model, verify resource model updated
- ormManyToOneMapping.setSpecifiedFetch(FetchType.EAGER);
- assertEquals(org.eclipse.jpt.core.resource.orm.FetchType.EAGER, manyToOneResource.getFetch());
- assertEquals(FetchType.EAGER, ormManyToOneMapping.getSpecifiedFetch());
-
- ormManyToOneMapping.setSpecifiedFetch(FetchType.LAZY);
- assertEquals(org.eclipse.jpt.core.resource.orm.FetchType.LAZY, manyToOneResource.getFetch());
- assertEquals(FetchType.LAZY, ormManyToOneMapping.getSpecifiedFetch());
-
- //set fetch to null in the context model
- ormManyToOneMapping.setSpecifiedFetch(null);
- assertNull(manyToOneResource.getFetch());
- assertNull(ormManyToOneMapping.getSpecifiedFetch());
- }
-
- public void testUpdateSpecifiedOptional() throws Exception {
- OrmPersistentType ormPersistentType = getEntityMappings().addPersistentType(MappingKeys.ENTITY_TYPE_MAPPING_KEY, "model.Foo");
- OrmPersistentAttribute ormPersistentAttribute = ormPersistentType.addSpecifiedPersistentAttribute(MappingKeys.MANY_TO_ONE_ATTRIBUTE_MAPPING_KEY, "manyToOneMapping");
- OrmManyToOneMapping ormManyToOneMapping = (OrmManyToOneMapping) ormPersistentAttribute.getMapping();
- XmlManyToOne manyToOneResource = getXmlEntityMappings().getEntities().get(0).getAttributes().getManyToOnes().get(0);
-
- assertNull(ormManyToOneMapping.getSpecifiedOptional());
- assertNull(manyToOneResource.getOptional());
-
- //set optional in the resource model, verify context model updated
- manyToOneResource.setOptional(Boolean.TRUE);
- assertEquals(Boolean.TRUE, ormManyToOneMapping.getSpecifiedOptional());
- assertEquals(Boolean.TRUE, manyToOneResource.getOptional());
-
- manyToOneResource.setOptional(Boolean.FALSE);
- assertEquals(Boolean.FALSE, ormManyToOneMapping.getSpecifiedOptional());
- assertEquals(Boolean.FALSE, manyToOneResource.getOptional());
-
- //set optional to null in the resource model
- manyToOneResource.setOptional(null);
- assertNull(ormManyToOneMapping.getSpecifiedOptional());
- assertNull(manyToOneResource.getOptional());
- }
-
- public void testModifySpecifiedOptional() throws Exception {
- OrmPersistentType ormPersistentType = getEntityMappings().addPersistentType(MappingKeys.ENTITY_TYPE_MAPPING_KEY, "model.Foo");
- OrmPersistentAttribute ormPersistentAttribute = ormPersistentType.addSpecifiedPersistentAttribute(MappingKeys.MANY_TO_ONE_ATTRIBUTE_MAPPING_KEY, "manyToOneMapping");
- OrmManyToOneMapping ormManyToOneMapping = (OrmManyToOneMapping) ormPersistentAttribute.getMapping();
- XmlManyToOne manyToOneResource = getXmlEntityMappings().getEntities().get(0).getAttributes().getManyToOnes().get(0);
-
- assertNull(ormManyToOneMapping.getSpecifiedOptional());
- assertNull(manyToOneResource.getOptional());
-
- //set optional in the context model, verify resource model updated
- ormManyToOneMapping.setSpecifiedOptional(Boolean.TRUE);
- assertEquals(Boolean.TRUE, manyToOneResource.getOptional());
- assertEquals(Boolean.TRUE, ormManyToOneMapping.getSpecifiedOptional());
-
- ormManyToOneMapping.setSpecifiedOptional(Boolean.FALSE);
- assertEquals(Boolean.FALSE, manyToOneResource.getOptional());
- assertEquals(Boolean.FALSE, ormManyToOneMapping.getSpecifiedOptional());
-
- //set optional to null in the context model
- ormManyToOneMapping.setSpecifiedOptional(null);
- assertNull(manyToOneResource.getOptional());
- assertNull(ormManyToOneMapping.getSpecifiedOptional());
- }
-
- public void testAddSpecifiedJoinColumn() throws Exception {
- OrmPersistentType ormPersistentType = getEntityMappings().addPersistentType(MappingKeys.ENTITY_TYPE_MAPPING_KEY, "model.Foo");
- OrmPersistentAttribute ormPersistentAttribute = ormPersistentType.addSpecifiedPersistentAttribute(MappingKeys.MANY_TO_ONE_ATTRIBUTE_MAPPING_KEY, "manyToOneMapping");
- OrmManyToOneMapping ormManyToOneMapping = (OrmManyToOneMapping) ormPersistentAttribute.getMapping();
- OrmJoinColumnJoiningStrategy strategy = ormManyToOneMapping.getRelationshipReference().getJoinColumnJoiningStrategy();
- XmlManyToOne manyToOneResource = getXmlEntityMappings().getEntities().get(0).getAttributes().getManyToOnes().get(0);
-
- OrmJoinColumn joinColumn = strategy.addSpecifiedJoinColumn(0);
- joinColumn.setSpecifiedName("FOO");
-
- assertEquals("FOO", manyToOneResource.getJoinColumns().get(0).getName());
-
- OrmJoinColumn joinColumn2 = strategy.addSpecifiedJoinColumn(0);
- joinColumn2.setSpecifiedName("BAR");
-
- assertEquals("BAR", manyToOneResource.getJoinColumns().get(0).getName());
- assertEquals("FOO", manyToOneResource.getJoinColumns().get(1).getName());
-
- OrmJoinColumn joinColumn3 = strategy.addSpecifiedJoinColumn(1);
- joinColumn3.setSpecifiedName("BAZ");
-
- assertEquals("BAR", manyToOneResource.getJoinColumns().get(0).getName());
- assertEquals("BAZ", manyToOneResource.getJoinColumns().get(1).getName());
- assertEquals("FOO", manyToOneResource.getJoinColumns().get(2).getName());
-
- ListIterator<OrmJoinColumn> joinColumns = strategy.specifiedJoinColumns();
- assertEquals(joinColumn2, joinColumns.next());
- assertEquals(joinColumn3, joinColumns.next());
- assertEquals(joinColumn, joinColumns.next());
-
- joinColumns = strategy.specifiedJoinColumns();
- assertEquals("BAR", joinColumns.next().getName());
- assertEquals("BAZ", joinColumns.next().getName());
- assertEquals("FOO", joinColumns.next().getName());
- }
-
- public void testRemoveSpecifiedJoinColumn() throws Exception {
- OrmPersistentType ormPersistentType = getEntityMappings().addPersistentType(MappingKeys.ENTITY_TYPE_MAPPING_KEY, "model.Foo");
- OrmPersistentAttribute ormPersistentAttribute = ormPersistentType.addSpecifiedPersistentAttribute(MappingKeys.MANY_TO_ONE_ATTRIBUTE_MAPPING_KEY, "manyToOneMapping");
- OrmManyToOneMapping ormManyToOneMapping = (OrmManyToOneMapping) ormPersistentAttribute.getMapping();
- OrmJoinColumnJoiningStrategy strategy = ormManyToOneMapping.getRelationshipReference().getJoinColumnJoiningStrategy();
- XmlManyToOne manyToOneResource = getXmlEntityMappings().getEntities().get(0).getAttributes().getManyToOnes().get(0);
-
- strategy.addSpecifiedJoinColumn(0).setSpecifiedName("FOO");
- strategy.addSpecifiedJoinColumn(1).setSpecifiedName("BAR");
- strategy.addSpecifiedJoinColumn(2).setSpecifiedName("BAZ");
-
- assertEquals(3, manyToOneResource.getJoinColumns().size());
-
- strategy.removeSpecifiedJoinColumn(0);
- assertEquals(2, manyToOneResource.getJoinColumns().size());
- assertEquals("BAR", manyToOneResource.getJoinColumns().get(0).getName());
- assertEquals("BAZ", manyToOneResource.getJoinColumns().get(1).getName());
-
- strategy.removeSpecifiedJoinColumn(0);
- assertEquals(1, manyToOneResource.getJoinColumns().size());
- assertEquals("BAZ", manyToOneResource.getJoinColumns().get(0).getName());
-
- strategy.removeSpecifiedJoinColumn(0);
- assertEquals(0, manyToOneResource.getJoinColumns().size());
- }
-
- public void testMoveSpecifiedJoinColumn() throws Exception {
- OrmPersistentType ormPersistentType = getEntityMappings().addPersistentType(MappingKeys.ENTITY_TYPE_MAPPING_KEY, "model.Foo");
- OrmPersistentAttribute ormPersistentAttribute = ormPersistentType.addSpecifiedPersistentAttribute(MappingKeys.MANY_TO_ONE_ATTRIBUTE_MAPPING_KEY, "manyToOneMapping");
- OrmManyToOneMapping ormManyToOneMapping = (OrmManyToOneMapping) ormPersistentAttribute.getMapping();
- OrmJoinColumnJoiningStrategy strategy = ormManyToOneMapping.getRelationshipReference().getJoinColumnJoiningStrategy();
- XmlManyToOne manyToOneResource = getXmlEntityMappings().getEntities().get(0).getAttributes().getManyToOnes().get(0);
-
- strategy.addSpecifiedJoinColumn(0).setSpecifiedName("FOO");
- strategy.addSpecifiedJoinColumn(1).setSpecifiedName("BAR");
- strategy.addSpecifiedJoinColumn(2).setSpecifiedName("BAZ");
-
- assertEquals(3, manyToOneResource.getJoinColumns().size());
-
-
- strategy.moveSpecifiedJoinColumn(2, 0);
- ListIterator<OrmJoinColumn> joinColumns = strategy.specifiedJoinColumns();
- assertEquals("BAR", joinColumns.next().getName());
- assertEquals("BAZ", joinColumns.next().getName());
- assertEquals("FOO", joinColumns.next().getName());
-
- assertEquals("BAR", manyToOneResource.getJoinColumns().get(0).getName());
- assertEquals("BAZ", manyToOneResource.getJoinColumns().get(1).getName());
- assertEquals("FOO", manyToOneResource.getJoinColumns().get(2).getName());
-
-
- strategy.moveSpecifiedJoinColumn(0, 1);
- joinColumns = strategy.specifiedJoinColumns();
- assertEquals("BAZ", joinColumns.next().getName());
- assertEquals("BAR", joinColumns.next().getName());
- assertEquals("FOO", joinColumns.next().getName());
-
- assertEquals("BAZ", manyToOneResource.getJoinColumns().get(0).getName());
- assertEquals("BAR", manyToOneResource.getJoinColumns().get(1).getName());
- assertEquals("FOO", manyToOneResource.getJoinColumns().get(2).getName());
- }
-
-
- public void testManyToOneMappingNoUnderylingJavaAttribute() throws Exception {
- createTestEntityManyToOneMapping();
- createTestTargetEntityAddress();
-
- OrmPersistentType ormPersistentType = getEntityMappings().addPersistentType(MappingKeys.ENTITY_TYPE_MAPPING_KEY, FULLY_QUALIFIED_TYPE_NAME);
- getEntityMappings().addPersistentType(MappingKeys.ENTITY_TYPE_MAPPING_KEY, PACKAGE_NAME + ".Address");
- ormPersistentType.addSpecifiedPersistentAttribute(MappingKeys.MANY_TO_ONE_ATTRIBUTE_MAPPING_KEY, "foo");
- assertEquals(3, ormPersistentType.virtualAttributesSize());
-
- OrmPersistentAttribute ormPersistentAttribute = ormPersistentType.specifiedAttributes().next();
- OrmManyToOneMapping ormManyToOneMapping = (OrmManyToOneMapping) ormPersistentAttribute.getMapping();
- OrmJoinColumnJoiningStrategy strategy = ormManyToOneMapping.getRelationshipReference().getJoinColumnJoiningStrategy();
-
- assertEquals("foo", ormManyToOneMapping.getName());
-
- assertNull(ormManyToOneMapping.getSpecifiedFetch());
- assertNull(ormManyToOneMapping.getSpecifiedOptional());
- assertNull(ormManyToOneMapping.getSpecifiedTargetEntity());
- assertEquals(FetchType.EAGER, ormManyToOneMapping.getFetch());
- assertEquals(true, ormManyToOneMapping.isOptional());
- assertNull(ormManyToOneMapping.getTargetEntity());
-
-
- assertFalse(strategy.specifiedJoinColumns().hasNext());
- //TODO default joinColumns
- //assertTrue(ormManyToOneMapping.defaultJoinColumns().hasNext());
-
-
- Cascade cascade = ormManyToOneMapping.getCascade();
- assertFalse(cascade.isAll());
- assertFalse(cascade.isMerge());
- assertFalse(cascade.isPersist());
- assertFalse(cascade.isRemove());
- assertFalse(cascade.isRefresh());
- }
-
- public void testVirtualMappingMetadataCompleteFalse() throws Exception {
- createTestEntityManyToOneMapping();
- createTestTargetEntityAddress();
-
- OrmPersistentType ormPersistentType = getEntityMappings().addPersistentType(MappingKeys.ENTITY_TYPE_MAPPING_KEY, FULLY_QUALIFIED_TYPE_NAME);
- getEntityMappings().addPersistentType(MappingKeys.ENTITY_TYPE_MAPPING_KEY, PACKAGE_NAME + ".Address");
- assertEquals(3, ormPersistentType.virtualAttributesSize());
- OrmPersistentAttribute ormPersistentAttribute = ormPersistentType.virtualAttributes().next();
-
- OrmManyToOneMapping ormManyToOneMapping = (OrmManyToOneMapping) ormPersistentAttribute.getMapping();
- assertEquals("address", ormManyToOneMapping.getName());
- assertEquals(FetchType.LAZY, ormManyToOneMapping.getSpecifiedFetch());
- assertEquals(Boolean.FALSE, ormManyToOneMapping.getSpecifiedOptional());
- assertEquals("Address", ormManyToOneMapping.getSpecifiedTargetEntity());
-
- OrmJoinColumn ormJoinColumn = ormManyToOneMapping.getRelationshipReference().getJoinColumnJoiningStrategy().specifiedJoinColumns().next();
- assertEquals("MY_COLUMN", ormJoinColumn.getSpecifiedName());
- assertEquals("MY_REFERENCED_COLUMN", ormJoinColumn.getSpecifiedReferencedColumnName());
- assertEquals(Boolean.TRUE, ormJoinColumn.getSpecifiedUnique());
- assertEquals(Boolean.FALSE, ormJoinColumn.getSpecifiedNullable());
- assertEquals(Boolean.FALSE, ormJoinColumn.getSpecifiedInsertable());
- assertEquals(Boolean.FALSE, ormJoinColumn.getSpecifiedUpdatable());
- assertEquals("COLUMN_DEFINITION", ormJoinColumn.getColumnDefinition());
- assertEquals("MY_TABLE", ormJoinColumn.getSpecifiedTable());
-
- Cascade cascade = ormManyToOneMapping.getCascade();
- assertTrue(cascade.isAll());
- assertTrue(cascade.isMerge());
- assertTrue(cascade.isPersist());
- assertTrue(cascade.isRemove());
- assertTrue(cascade.isRefresh());
- }
-
- public void testVirtualMappingMetadataCompleteTrue() throws Exception {
- createTestEntityManyToOneMapping();
- createTestTargetEntityAddress();
-
- OrmPersistentType ormPersistentType = getEntityMappings().addPersistentType(MappingKeys.ENTITY_TYPE_MAPPING_KEY, FULLY_QUALIFIED_TYPE_NAME);
- getEntityMappings().addPersistentType(MappingKeys.ENTITY_TYPE_MAPPING_KEY, PACKAGE_NAME + ".Address");
- ormPersistentType.getMapping().setSpecifiedMetadataComplete(Boolean.TRUE);
- assertEquals(3, ormPersistentType.virtualAttributesSize());
- OrmPersistentAttribute ormPersistentAttribute = ormPersistentType.virtualAttributes().next();
-
- assertEquals(MappingKeys.NULL_ATTRIBUTE_MAPPING_KEY, ormPersistentAttribute.getMappingKey());
-
- ormPersistentAttribute.makeSpecified(MappingKeys.MANY_TO_ONE_ATTRIBUTE_MAPPING_KEY);
- ormPersistentAttribute= ormPersistentType.specifiedAttributes().next();
-
- OrmManyToOneMapping ormManyToOneMapping = (OrmManyToOneMapping) ormPersistentAttribute.getMapping();
- assertEquals("address", ormManyToOneMapping.getName());
- assertEquals(FetchType.EAGER, ormManyToOneMapping.getDefaultFetch());
- assertEquals(true, ormManyToOneMapping.isDefaultOptional());
- //TODO hmm, is this correct?
- assertEquals("test.Address", ormManyToOneMapping.getDefaultTargetEntity());
-
- //TODO default join columns in xml one-to-one
-// XmlJoinColumn ormJoinColumn = ormManyToOneMapping.specifiedJoinColumns().next();
-// //TODO java default columns name in JavaSingleRelationshipMapping.JoinColumnOwner
-// //assertEquals("address", ormJoinColumn.getSpecifiedName());
-// //assertEquals("address", ormJoinColumn.getSpecifiedReferencedColumnName());
-// assertEquals(Boolean.FALSE, ormJoinColumn.getSpecifiedUnique());
-// assertEquals(Boolean.TRUE, ormJoinColumn.getSpecifiedNullable());
-// assertEquals(Boolean.TRUE, ormJoinColumn.getSpecifiedInsertable());
-// assertEquals(Boolean.TRUE, ormJoinColumn.getSpecifiedUpdatable());
-// assertNull(ormJoinColumn.getColumnDefinition());
-// assertEquals(TYPE_NAME, ormJoinColumn.getSpecifiedTable());
-
- Cascade cascade = ormManyToOneMapping.getCascade();
- assertFalse(cascade.isAll());
- assertFalse(cascade.isMerge());
- assertFalse(cascade.isPersist());
- assertFalse(cascade.isRemove());
- assertFalse(cascade.isRefresh());
- }
-
- public void testSpecifiedMapping() throws Exception {
- createTestEntityManyToOneMapping();
- createTestTargetEntityAddress();
-
- OrmPersistentType ormPersistentType = getEntityMappings().addPersistentType(MappingKeys.ENTITY_TYPE_MAPPING_KEY, FULLY_QUALIFIED_TYPE_NAME);
- getEntityMappings().addPersistentType(MappingKeys.ENTITY_TYPE_MAPPING_KEY, PACKAGE_NAME + ".Address");
-
- ormPersistentType.addSpecifiedPersistentAttribute(MappingKeys.MANY_TO_ONE_ATTRIBUTE_MAPPING_KEY, "address");
- assertEquals(2, ormPersistentType.virtualAttributesSize());
-
- OrmPersistentAttribute ormPersistentAttribute = ormPersistentType.specifiedAttributes().next();
- OrmManyToOneMapping ormManyToOneMapping = (OrmManyToOneMapping) ormPersistentAttribute.getMapping();
-
- assertEquals("address", ormManyToOneMapping.getName());
- assertNull(ormManyToOneMapping.getSpecifiedFetch());
- assertNull(ormManyToOneMapping.getSpecifiedOptional());
- assertNull(ormManyToOneMapping.getSpecifiedTargetEntity());
- assertEquals(FetchType.EAGER, ormManyToOneMapping.getFetch());
- assertEquals(true, ormManyToOneMapping.isOptional());
- assertEquals("test.Address", ormManyToOneMapping.getDefaultTargetEntity());
-
- assertFalse(ormManyToOneMapping.getRelationshipReference().getJoinColumnJoiningStrategy().specifiedJoinColumns().hasNext());
-
- //TODO default join columns for specified xmlManyToOne mapping
-// XmlJoinColumn ormJoinColumn = ormManyToOneMapping.defaultJoinColumns().next();
-// assertNull(ormJoinColumn.getSpecifiedName());
-// assertNull(ormJoinColumn.getSpecifiedReferencedColumnName());
-// assertNull(ormJoinColumn.getSpecifiedUnique());
-// assertNull(ormJoinColumn.getSpecifiedNullable());
-// assertNull(ormJoinColumn.getSpecifiedInsertable());
-// assertNull(ormJoinColumn.getSpecifiedUpdatable());
-// assertNull(ormJoinColumn.getColumnDefinition());
-// assertNull(ormJoinColumn.getSpecifiedTable());
-//
-// assertEquals("address", ormJoinColumn.getDefaultName());
-// assertEquals("address", ormJoinColumn.getDefaultReferencedColumnName());
-// assertEquals(Boolean.FALSE, ormJoinColumn.getDefaultUnique());
-// assertEquals(Boolean.TRUE, ormJoinColumn.getDefaultNullable());
-// assertEquals(Boolean.TRUE, ormJoinColumn.getDefaultInsertable());
-// assertEquals(Boolean.TRUE, ormJoinColumn.getDefaultUpdatable());
-// assertEquals(null, ormJoinColumn.getColumnDefinition());
-// assertEquals(TYPE_NAME, ormJoinColumn.getDefaultTable());
-
- Cascade cascade = ormManyToOneMapping.getCascade();
- assertFalse(cascade.isAll());
- assertFalse(cascade.isMerge());
- assertFalse(cascade.isPersist());
- assertFalse(cascade.isRemove());
- assertFalse(cascade.isRefresh());
- }
-
- //3 things tested above
- //1. virtual mapping metadata complete=false - defaults are taken from the java annotations
- //2. virtual mapping metadata complete=true - defaults are taken from java defaults,annotations ignored
- //3. specified mapping (metadata complete=true/false - defaults are taken from java annotations
-
-} \ No newline at end of file
diff --git a/jpa/tests/org.eclipse.jpt.core.tests/src/org/eclipse/jpt/core/tests/internal/context/orm/OrmMappedSuperclassTests.java b/jpa/tests/org.eclipse.jpt.core.tests/src/org/eclipse/jpt/core/tests/internal/context/orm/OrmMappedSuperclassTests.java
deleted file mode 100644
index ba21405a0a..0000000000
--- a/jpa/tests/org.eclipse.jpt.core.tests/src/org/eclipse/jpt/core/tests/internal/context/orm/OrmMappedSuperclassTests.java
+++ /dev/null
@@ -1,345 +0,0 @@
-/*******************************************************************************
- * Copyright (c) 2007, 2009 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.
- *
- * Contributors:
- * Oracle - initial API and implementation
- ******************************************************************************/
-package org.eclipse.jpt.core.tests.internal.context.orm;
-
-import java.util.ListIterator;
-import org.eclipse.jpt.core.JptCorePlugin;
-import org.eclipse.jpt.core.MappingKeys;
-import org.eclipse.jpt.core.context.AccessType;
-import org.eclipse.jpt.core.context.orm.OrmEmbeddable;
-import org.eclipse.jpt.core.context.orm.OrmEntity;
-import org.eclipse.jpt.core.context.orm.OrmMappedSuperclass;
-import org.eclipse.jpt.core.context.orm.OrmPersistentType;
-import org.eclipse.jpt.core.resource.orm.OrmFactory;
-import org.eclipse.jpt.core.resource.orm.XmlEmbeddable;
-import org.eclipse.jpt.core.resource.orm.XmlEntity;
-import org.eclipse.jpt.core.resource.orm.XmlMappedSuperclass;
-import org.eclipse.jpt.core.resource.persistence.PersistenceFactory;
-import org.eclipse.jpt.core.resource.persistence.XmlMappingFileRef;
-import org.eclipse.jpt.core.tests.internal.context.ContextModelTestCase;
-
-@SuppressWarnings("nls")
-public class OrmMappedSuperclassTests extends ContextModelTestCase
-{
- public OrmMappedSuperclassTests(String name) {
- super(name);
- }
-
-
- @Override
- protected void setUp() throws Exception {
- super.setUp();
- XmlMappingFileRef mappingFileRef = PersistenceFactory.eINSTANCE.createXmlMappingFileRef();
- mappingFileRef.setFileName(JptCorePlugin.DEFAULT_ORM_XML_FILE_PATH);
- getXmlPersistenceUnit().getMappingFiles().add(mappingFileRef);
- getPersistenceXmlResource().save(null);
- }
-
- public void testUpdateClass() throws Exception {
- OrmPersistentType ormPersistentType = getEntityMappings().addPersistentType(MappingKeys.MAPPED_SUPERCLASS_TYPE_MAPPING_KEY, "model.Foo");
- OrmMappedSuperclass ormMappedSuperclass = (OrmMappedSuperclass) ormPersistentType.getMapping();
- XmlMappedSuperclass mappedSuperclassResource = getXmlEntityMappings().getMappedSuperclasses().get(0);
- assertEquals("model.Foo", ormMappedSuperclass.getClass_());
- assertEquals("model.Foo", mappedSuperclassResource.getClassName());
-
- //set class in the resource model, verify context model updated
- mappedSuperclassResource.setClassName("com.Bar");
- assertEquals("com.Bar", ormMappedSuperclass.getClass_());
- assertEquals("com.Bar", mappedSuperclassResource.getClassName());
-
- //set class to null in the resource model
- mappedSuperclassResource.setClassName(null);
- assertNull(ormMappedSuperclass.getClass_());
- assertNull(mappedSuperclassResource.getClassName());
- }
-
- public void testModifyClass() throws Exception {
- OrmPersistentType ormPersistentType = getEntityMappings().addPersistentType(MappingKeys.MAPPED_SUPERCLASS_TYPE_MAPPING_KEY, "model.Foo");
- OrmMappedSuperclass ormMappedSuperclass = (OrmMappedSuperclass) ormPersistentType.getMapping();
- XmlMappedSuperclass mappedSuperclassResource = getXmlEntityMappings().getMappedSuperclasses().get(0);
- assertEquals("model.Foo", ormMappedSuperclass.getClass_());
- assertEquals("model.Foo", mappedSuperclassResource.getClassName());
-
- //set class in the context model, verify resource model modified
- ormMappedSuperclass.setClass("com.Bar");
- assertEquals("com.Bar", ormMappedSuperclass.getClass_());
- assertEquals("com.Bar", mappedSuperclassResource.getClassName());
-
- //set class to null in the context model
- ormMappedSuperclass.setClass(null);
- assertNull(ormMappedSuperclass.getClass_());
- assertNull(mappedSuperclassResource.getClassName());
- }
- //TODO add tests for setting the className when the package is set on entity-mappings
-
- public void testUpdateSpecifiedAccess() throws Exception {
- OrmPersistentType ormPersistentType = getEntityMappings().addPersistentType(MappingKeys.MAPPED_SUPERCLASS_TYPE_MAPPING_KEY, "model.Foo");
- XmlMappedSuperclass mappedSuperclassResource = getXmlEntityMappings().getMappedSuperclasses().get(0);
- assertNull(ormPersistentType.getSpecifiedAccess());
- assertNull(mappedSuperclassResource.getAccess());
-
- //set access in the resource model, verify context model updated
- mappedSuperclassResource.setAccess(org.eclipse.jpt.core.resource.orm.AccessType.FIELD);
- assertEquals(AccessType.FIELD, ormPersistentType.getSpecifiedAccess());
- assertEquals(org.eclipse.jpt.core.resource.orm.AccessType.FIELD, mappedSuperclassResource.getAccess());
-
- //set access to null in the resource model
- mappedSuperclassResource.setAccess(null);
- assertNull(ormPersistentType.getSpecifiedAccess());
- assertNull(mappedSuperclassResource.getAccess());
- }
-
- public void testModifySpecifiedAccess() throws Exception {
- OrmPersistentType ormPersistentType = getEntityMappings().addPersistentType(MappingKeys.MAPPED_SUPERCLASS_TYPE_MAPPING_KEY, "model.Foo");
- XmlMappedSuperclass mappedSuperclassResource = getXmlEntityMappings().getMappedSuperclasses().get(0);
- assertNull(ormPersistentType.getSpecifiedAccess());
- assertNull(mappedSuperclassResource.getAccess());
-
- //set access in the context model, verify resource model modified
- ormPersistentType.setSpecifiedAccess(AccessType.PROPERTY);
- assertEquals(AccessType.PROPERTY, ormPersistentType.getSpecifiedAccess());
- assertEquals(org.eclipse.jpt.core.resource.orm.AccessType.PROPERTY, mappedSuperclassResource.getAccess());
-
- //set access to null in the context model
- ormPersistentType.setSpecifiedAccess(null);
- assertNull(ormPersistentType.getSpecifiedAccess());
- assertNull(mappedSuperclassResource.getAccess());
- }
- //TODO test default access from
- //underlying java
- //persistence-unit-defaults
- //entity-mappings
- //with xml-mapping-metadata-complete set
-
- public void testUpdateSpecifiedMetadataComplete() throws Exception {
- OrmPersistentType ormPersistentType = getEntityMappings().addPersistentType(MappingKeys.MAPPED_SUPERCLASS_TYPE_MAPPING_KEY, "model.Foo");
- OrmMappedSuperclass ormMappedSuperclass = (OrmMappedSuperclass) ormPersistentType.getMapping();
- XmlMappedSuperclass mappedSuperclassResource = getXmlEntityMappings().getMappedSuperclasses().get(0);
- assertNull(ormMappedSuperclass.getSpecifiedMetadataComplete());
- assertNull(mappedSuperclassResource.getMetadataComplete());
-
- //set metadata-complete in the resource model, verify context model updated
- mappedSuperclassResource.setMetadataComplete(Boolean.TRUE);
- assertEquals(Boolean.TRUE, ormMappedSuperclass.getSpecifiedMetadataComplete());
- assertEquals(Boolean.TRUE, mappedSuperclassResource.getMetadataComplete());
-
- //set access to false in the resource model
- mappedSuperclassResource.setMetadataComplete(Boolean.FALSE);
- assertEquals(Boolean.FALSE, ormMappedSuperclass.getSpecifiedMetadataComplete());
- assertEquals(Boolean.FALSE, mappedSuperclassResource.getMetadataComplete());
-
- mappedSuperclassResource.setMetadataComplete(null);
- assertNull(ormMappedSuperclass.getSpecifiedMetadataComplete());
- assertNull(mappedSuperclassResource.getMetadataComplete());
- }
-
- public void testModifySpecifiedMetadataComplete() throws Exception {
- OrmPersistentType ormPersistentType = getEntityMappings().addPersistentType(MappingKeys.MAPPED_SUPERCLASS_TYPE_MAPPING_KEY, "model.Foo");
- OrmMappedSuperclass ormMappedSuperclass = (OrmMappedSuperclass) ormPersistentType.getMapping();
- XmlMappedSuperclass mappedSuperclassResource = getXmlEntityMappings().getMappedSuperclasses().get(0); assertNull(ormMappedSuperclass.getSpecifiedMetadataComplete());
- assertNull(mappedSuperclassResource.getMetadataComplete());
-
- //set access in the context model, verify resource model modified
- ormMappedSuperclass.setSpecifiedMetadataComplete(Boolean.TRUE);
- assertEquals(Boolean.TRUE, ormMappedSuperclass.getSpecifiedMetadataComplete());
- assertEquals(Boolean.TRUE, mappedSuperclassResource.getMetadataComplete());
-
- //set access to null in the context model
- ormMappedSuperclass.setSpecifiedMetadataComplete(Boolean.FALSE);
- assertEquals(Boolean.FALSE, ormMappedSuperclass.getSpecifiedMetadataComplete());
- assertEquals(Boolean.FALSE, mappedSuperclassResource.getMetadataComplete());
-
- ormMappedSuperclass.setSpecifiedMetadataComplete(null);
- assertNull(ormMappedSuperclass.getSpecifiedMetadataComplete());
- assertNull(mappedSuperclassResource.getMetadataComplete());
- }
-
- public void testUpdateDefaultMetadataComplete() throws Exception {
- OrmPersistentType ormPersistentType = getEntityMappings().addPersistentType(MappingKeys.MAPPED_SUPERCLASS_TYPE_MAPPING_KEY, "model.Foo");
- OrmMappedSuperclass ormMappedSuperclass = (OrmMappedSuperclass) ormPersistentType.getMapping();
- XmlMappedSuperclass mappedSuperclassResource = getXmlEntityMappings().getMappedSuperclasses().get(0);
- assertNull(ormMappedSuperclass.getSpecifiedMetadataComplete());
- assertNull(ormMappedSuperclass.getSpecifiedMetadataComplete());
- assertFalse(ormMappedSuperclass.isDefaultMetadataComplete());
- assertNull(mappedSuperclassResource.getMetadataComplete());
-
- getXmlEntityMappings().setPersistenceUnitMetadata(OrmFactory.eINSTANCE.createXmlPersistenceUnitMetadata());
- getXmlEntityMappings().getPersistenceUnitMetadata().setXmlMappingMetadataComplete(true);
- assertTrue(ormMappedSuperclass.isDefaultMetadataComplete());
- assertNull(ormMappedSuperclass.getSpecifiedMetadataComplete());
- assertNull(mappedSuperclassResource.getMetadataComplete());
-
- getXmlEntityMappings().getPersistenceUnitMetadata().setXmlMappingMetadataComplete(false);
- assertNull(ormMappedSuperclass.getSpecifiedMetadataComplete());
- assertFalse(ormMappedSuperclass.isDefaultMetadataComplete());
- assertNull(mappedSuperclassResource.getMetadataComplete());
- }
-
- public void testUpdateMetadataComplete() throws Exception {
- OrmPersistentType ormPersistentType = getEntityMappings().addPersistentType(MappingKeys.MAPPED_SUPERCLASS_TYPE_MAPPING_KEY, "model.Foo");
- OrmMappedSuperclass ormMappedSuperclass = (OrmMappedSuperclass) ormPersistentType.getMapping();
- XmlMappedSuperclass mappedSuperclassResource = getXmlEntityMappings().getMappedSuperclasses().get(0);
- assertNull(ormMappedSuperclass.getSpecifiedMetadataComplete());
- assertNull(ormMappedSuperclass.getSpecifiedMetadataComplete());
- assertFalse(ormMappedSuperclass.isMetadataComplete());
- assertNull(mappedSuperclassResource.getMetadataComplete());
-
- getXmlEntityMappings().setPersistenceUnitMetadata(OrmFactory.eINSTANCE.createXmlPersistenceUnitMetadata());
- getXmlEntityMappings().getPersistenceUnitMetadata().setXmlMappingMetadataComplete(true);
- assertTrue(ormMappedSuperclass.isMetadataComplete());
- assertNull(ormMappedSuperclass.getSpecifiedMetadataComplete());
- assertNull(mappedSuperclassResource.getMetadataComplete());
-
- getXmlEntityMappings().getPersistenceUnitMetadata().setXmlMappingMetadataComplete(false);
- assertFalse(ormMappedSuperclass.isMetadataComplete());
- assertNull(ormMappedSuperclass.getSpecifiedMetadataComplete());
- assertNull(mappedSuperclassResource.getMetadataComplete());
- }
-
-
- public void testMakeMappedSuperclassEntity() throws Exception {
- OrmPersistentType mappedSuperclassPersistentType = getEntityMappings().addPersistentType(MappingKeys.MAPPED_SUPERCLASS_TYPE_MAPPING_KEY, "model.Foo");
- OrmMappedSuperclass mappedSuperclass = (OrmMappedSuperclass) mappedSuperclassPersistentType.getMapping();
- mappedSuperclassPersistentType.setSpecifiedAccess(AccessType.PROPERTY);
- mappedSuperclass.setSpecifiedMetadataComplete(Boolean.TRUE);
-
- mappedSuperclassPersistentType.setMappingKey(MappingKeys.ENTITY_TYPE_MAPPING_KEY);
-
- XmlEntity entity = getXmlEntityMappings().getEntities().get(0);
- assertEquals("model.Foo", entity.getClassName());
- assertEquals(Boolean.TRUE, entity.getMetadataComplete());
- assertEquals(org.eclipse.jpt.core.resource.orm.AccessType.PROPERTY, entity.getAccess());
- assertNull(entity.getDiscriminatorValue());
- assertNull(entity.getName());
-
- OrmEntity ormEntity = (OrmEntity) mappedSuperclassPersistentType.getMapping();
- assertEquals("model.Foo", ormEntity.getClass_());
- assertEquals(Boolean.TRUE, ormEntity.getSpecifiedMetadataComplete());
- assertEquals(AccessType.PROPERTY, mappedSuperclassPersistentType.getSpecifiedAccess());
- }
-
- //test with 2 MappedSuperclasses, make the first one an Entity so it has to move to the end of the list
- public void testMakeMappedSuperclassEntity2() throws Exception {
- OrmPersistentType mappedSuperclassPersistentType = getEntityMappings().addPersistentType(MappingKeys.MAPPED_SUPERCLASS_TYPE_MAPPING_KEY, "model.Foo");
- getEntityMappings().addPersistentType(MappingKeys.MAPPED_SUPERCLASS_TYPE_MAPPING_KEY, "model.Foo2");
- OrmMappedSuperclass mappedSuperclass = (OrmMappedSuperclass) mappedSuperclassPersistentType.getMapping();
- mappedSuperclassPersistentType.setSpecifiedAccess(AccessType.PROPERTY);
- mappedSuperclass.setSpecifiedMetadataComplete(Boolean.TRUE);
-
- mappedSuperclassPersistentType.setMappingKey(MappingKeys.ENTITY_TYPE_MAPPING_KEY);
-
- XmlEntity entity = getXmlEntityMappings().getEntities().get(0);
- assertEquals("model.Foo", entity.getClassName());
- assertEquals(Boolean.TRUE, entity.getMetadataComplete());
- assertEquals(org.eclipse.jpt.core.resource.orm.AccessType.PROPERTY, entity.getAccess());
- assertNull(entity.getDiscriminatorValue());
- assertNull(entity.getName());
-
- OrmEntity ormEntity = (OrmEntity) mappedSuperclassPersistentType.getMapping();
- assertEquals("model.Foo", ormEntity.getClass_());
- assertEquals(Boolean.TRUE, ormEntity.getSpecifiedMetadataComplete());
- assertEquals(AccessType.PROPERTY, mappedSuperclassPersistentType.getSpecifiedAccess());
-
- ListIterator<OrmPersistentType> persistentTypes = getEntityMappings().persistentTypes();
- assertEquals(MappingKeys.MAPPED_SUPERCLASS_TYPE_MAPPING_KEY, persistentTypes.next().getMappingKey());
- assertEquals(MappingKeys.ENTITY_TYPE_MAPPING_KEY, persistentTypes.next().getMappingKey());
- }
-
- public void testMakeMappedSuperclassEmbeddable() throws Exception {
- OrmPersistentType mappedSuperclassPersistentType = getEntityMappings().addPersistentType(MappingKeys.MAPPED_SUPERCLASS_TYPE_MAPPING_KEY, "model.Foo");
- OrmMappedSuperclass mappedSuperclass = (OrmMappedSuperclass) mappedSuperclassPersistentType.getMapping();
- mappedSuperclassPersistentType.setSpecifiedAccess(AccessType.PROPERTY);
- mappedSuperclass.setSpecifiedMetadataComplete(Boolean.TRUE);
-
- mappedSuperclassPersistentType.setMappingKey(MappingKeys.EMBEDDABLE_TYPE_MAPPING_KEY);
-
- XmlEmbeddable embeddable = getXmlEntityMappings().getEmbeddables().get(0);
- assertEquals("model.Foo", embeddable.getClassName());
- assertEquals(Boolean.TRUE, embeddable.getMetadataComplete());
- assertEquals(org.eclipse.jpt.core.resource.orm.AccessType.PROPERTY, embeddable.getAccess());
-
- OrmEmbeddable ormEmbeddable = (OrmEmbeddable) mappedSuperclassPersistentType.getMapping();
- assertEquals("model.Foo", ormEmbeddable.getClass_());
- assertEquals(Boolean.TRUE, ormEmbeddable.getSpecifiedMetadataComplete());
- assertEquals(AccessType.PROPERTY, mappedSuperclassPersistentType.getSpecifiedAccess());
- }
- //test with 2 MappedSuperclasses, make the first one an Embeddable so it has to move to the end of the list
- public void testMakeMappedSuperclassEmbeddable2() throws Exception {
- OrmPersistentType mappedSuperclassPersistentType = getEntityMappings().addPersistentType(MappingKeys.MAPPED_SUPERCLASS_TYPE_MAPPING_KEY, "model.Foo");
- getEntityMappings().addPersistentType(MappingKeys.MAPPED_SUPERCLASS_TYPE_MAPPING_KEY, "model.Foo2");
- OrmMappedSuperclass mappedSuperclass = (OrmMappedSuperclass) mappedSuperclassPersistentType.getMapping();
- mappedSuperclassPersistentType.setSpecifiedAccess(AccessType.PROPERTY);
- mappedSuperclass.setSpecifiedMetadataComplete(Boolean.TRUE);
-
- mappedSuperclassPersistentType.setMappingKey(MappingKeys.EMBEDDABLE_TYPE_MAPPING_KEY);
-
- XmlEmbeddable embeddable = getXmlEntityMappings().getEmbeddables().get(0);
- assertEquals("model.Foo", embeddable.getClassName());
- assertEquals(Boolean.TRUE, embeddable.getMetadataComplete());
- assertEquals(org.eclipse.jpt.core.resource.orm.AccessType.PROPERTY, embeddable.getAccess());
-
- OrmEmbeddable ormEmbeddable = (OrmEmbeddable) mappedSuperclassPersistentType.getMapping();
- assertEquals("model.Foo", ormEmbeddable.getClass_());
- assertEquals(Boolean.TRUE, ormEmbeddable.getSpecifiedMetadataComplete());
- assertEquals(AccessType.PROPERTY, mappedSuperclassPersistentType.getSpecifiedAccess());
-
- ListIterator<OrmPersistentType> persistentTypes = getEntityMappings().persistentTypes();
- assertEquals(MappingKeys.MAPPED_SUPERCLASS_TYPE_MAPPING_KEY, persistentTypes.next().getMappingKey());
- assertEquals(MappingKeys.EMBEDDABLE_TYPE_MAPPING_KEY, persistentTypes.next().getMappingKey());
- }
-
- public void testUpdateIdClass() throws Exception {
- OrmPersistentType ormPersistentType = getEntityMappings().addPersistentType(MappingKeys.MAPPED_SUPERCLASS_TYPE_MAPPING_KEY, "model.Foo");
- OrmMappedSuperclass ormMappedSuperclass = (OrmMappedSuperclass) ormPersistentType.getMapping();
- XmlMappedSuperclass mappedSuperclassResource = getXmlEntityMappings().getMappedSuperclasses().get(0); assertNull(ormMappedSuperclass.getSpecifiedMetadataComplete());
-
- assertNull(ormMappedSuperclass.getIdClass());
- assertNull(mappedSuperclassResource.getIdClass());
-
- mappedSuperclassResource.setIdClass(OrmFactory.eINSTANCE.createXmlIdClass());
-
- assertNull(ormMappedSuperclass.getIdClass());
- assertNotNull(mappedSuperclassResource.getIdClass());
-
- mappedSuperclassResource.getIdClass().setClassName("model.Foo");
- assertEquals("model.Foo", ormMappedSuperclass.getIdClass());
- assertEquals("model.Foo", mappedSuperclassResource.getIdClass().getClassName());
-
- //test setting @IdClass value to null, id-class tag is not removed
- mappedSuperclassResource.getIdClass().setClassName(null);
- assertNull(ormMappedSuperclass.getIdClass());
- assertNotNull(mappedSuperclassResource.getIdClass());
-
- //reset @IdClass value and then remove id-class tag
- mappedSuperclassResource.setIdClass(OrmFactory.eINSTANCE.createXmlIdClass());
- mappedSuperclassResource.getIdClass().setClassName("model.Foo");
- mappedSuperclassResource.setIdClass(null);
-
- assertNull(ormMappedSuperclass.getIdClass());
- assertNull(mappedSuperclassResource.getIdClass());
- }
-
- public void testModifyIdClass() throws Exception {
- OrmPersistentType ormPersistentType = getEntityMappings().addPersistentType(MappingKeys.MAPPED_SUPERCLASS_TYPE_MAPPING_KEY, "model.Foo");
- OrmMappedSuperclass ormMappedSuperclass = (OrmMappedSuperclass) ormPersistentType.getMapping();
- XmlMappedSuperclass mappedSuperclassResource = getXmlEntityMappings().getMappedSuperclasses().get(0); assertNull(ormMappedSuperclass.getSpecifiedMetadataComplete());
-
- assertNull(ormMappedSuperclass.getIdClass());
- assertNull(mappedSuperclassResource.getIdClass());
-
- ormMappedSuperclass.setIdClass("model.Foo");
- assertEquals("model.Foo", mappedSuperclassResource.getIdClass().getClassName());
- assertEquals("model.Foo", ormMappedSuperclass.getIdClass());
-
- ormMappedSuperclass.setIdClass(null);
- assertNull(ormMappedSuperclass.getIdClass());
- assertNull(mappedSuperclassResource.getIdClass());
- }
-} \ No newline at end of file
diff --git a/jpa/tests/org.eclipse.jpt.core.tests/src/org/eclipse/jpt/core/tests/internal/context/orm/OrmNamedNativeQueryTests.java b/jpa/tests/org.eclipse.jpt.core.tests/src/org/eclipse/jpt/core/tests/internal/context/orm/OrmNamedNativeQueryTests.java
deleted file mode 100644
index 89b4e4cd8f..0000000000
--- a/jpa/tests/org.eclipse.jpt.core.tests/src/org/eclipse/jpt/core/tests/internal/context/orm/OrmNamedNativeQueryTests.java
+++ /dev/null
@@ -1,358 +0,0 @@
-/*******************************************************************************
- * Copyright (c) 2007, 2009 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.
- *
- * Contributors:
- * Oracle - initial API and implementation
- ******************************************************************************/
-package org.eclipse.jpt.core.tests.internal.context.orm;
-
-import java.util.ListIterator;
-import org.eclipse.jpt.core.JptCorePlugin;
-import org.eclipse.jpt.core.MappingKeys;
-import org.eclipse.jpt.core.context.orm.OrmEntity;
-import org.eclipse.jpt.core.context.orm.OrmNamedNativeQuery;
-import org.eclipse.jpt.core.context.orm.OrmPersistentType;
-import org.eclipse.jpt.core.context.orm.OrmQueryHint;
-import org.eclipse.jpt.core.resource.orm.OrmFactory;
-import org.eclipse.jpt.core.resource.orm.XmlNamedNativeQuery;
-import org.eclipse.jpt.core.resource.persistence.PersistenceFactory;
-import org.eclipse.jpt.core.resource.persistence.XmlMappingFileRef;
-import org.eclipse.jpt.core.tests.internal.context.ContextModelTestCase;
-
-@SuppressWarnings("nls")
-public class OrmNamedNativeQueryTests extends ContextModelTestCase
-{
- public OrmNamedNativeQueryTests(String name) {
- super(name);
- }
-
-
- @Override
- protected void setUp() throws Exception {
- super.setUp();
- XmlMappingFileRef mappingFileRef = PersistenceFactory.eINSTANCE.createXmlMappingFileRef();
- mappingFileRef.setFileName(JptCorePlugin.DEFAULT_ORM_XML_FILE_PATH);
- getXmlPersistenceUnit().getMappingFiles().add(mappingFileRef);
- getPersistenceXmlResource().save(null);
- }
-
- public void testUpdateName() throws Exception {
- OrmPersistentType ormPersistentType = getEntityMappings().addPersistentType(MappingKeys.ENTITY_TYPE_MAPPING_KEY, "model.Foo");
- OrmEntity ormEntity = (OrmEntity) ormPersistentType.getMapping();
- OrmNamedNativeQuery ormNamedNativeQuery = ormEntity.getQueryContainer().addNamedNativeQuery(0);
-
- XmlNamedNativeQuery namedNativeQueryResource = getXmlEntityMappings().getEntities().get(0).getNamedNativeQueries().get(0);
-
- assertNull(ormNamedNativeQuery.getName());
- assertNull(namedNativeQueryResource.getName());
-
- //set name in the resource model, verify context model updated
- namedNativeQueryResource.setName("newName");
- assertEquals("newName", ormNamedNativeQuery.getName());
- assertEquals("newName", namedNativeQueryResource.getName());
-
- //set name to null in the resource model
- namedNativeQueryResource.setName(null);
- assertNull(ormNamedNativeQuery.getName());
- assertNull(namedNativeQueryResource.getName());
- }
-
- public void testModifyName() throws Exception {
- OrmPersistentType ormPersistentType = getEntityMappings().addPersistentType(MappingKeys.ENTITY_TYPE_MAPPING_KEY, "model.Foo");
- OrmEntity ormEntity = (OrmEntity) ormPersistentType.getMapping();
- OrmNamedNativeQuery ormNamedNativeQuery = ormEntity.getQueryContainer().addNamedNativeQuery(0);
-
- XmlNamedNativeQuery namedNativeQueryResource = getXmlEntityMappings().getEntities().get(0).getNamedNativeQueries().get(0);
-
- assertNull(ormNamedNativeQuery.getName());
- assertNull(namedNativeQueryResource.getName());
-
- //set name in the context model, verify resource model updated
- ormNamedNativeQuery.setName("newName");
- assertEquals("newName", ormNamedNativeQuery.getName());
- assertEquals("newName", namedNativeQueryResource.getName());
-
- //set name to null in the context model
- ormNamedNativeQuery.setName(null);
- assertNull(ormNamedNativeQuery.getName());
- assertNull(namedNativeQueryResource.getName());
- }
-
- public void testUpdateQuery() throws Exception {
- OrmPersistentType ormPersistentType = getEntityMappings().addPersistentType(MappingKeys.ENTITY_TYPE_MAPPING_KEY, "model.Foo");
- OrmEntity ormEntity = (OrmEntity) ormPersistentType.getMapping();
- OrmNamedNativeQuery ormNamedNativeQuery = ormEntity.getQueryContainer().addNamedNativeQuery(0);
-
- XmlNamedNativeQuery namedNativeQueryResource = getXmlEntityMappings().getEntities().get(0).getNamedNativeQueries().get(0);
-
- assertNull(ormNamedNativeQuery.getQuery());
- assertNull(namedNativeQueryResource.getQuery());
-
- //set name in the resource model, verify context model updated
- namedNativeQueryResource.setQuery("newName");
- assertEquals("newName", ormNamedNativeQuery.getQuery());
- assertEquals("newName", namedNativeQueryResource.getQuery());
-
- //set name to null in the resource model
- namedNativeQueryResource.setQuery(null);
- assertNull(ormNamedNativeQuery.getQuery());
- assertNull(namedNativeQueryResource.getQuery());
- }
-
- public void testModifyQuery() throws Exception {
- OrmPersistentType ormPersistentType = getEntityMappings().addPersistentType(MappingKeys.ENTITY_TYPE_MAPPING_KEY, "model.Foo");
- OrmEntity ormEntity = (OrmEntity) ormPersistentType.getMapping();
- OrmNamedNativeQuery ormNamedNativeQuery = ormEntity.getQueryContainer().addNamedNativeQuery(0);
-
- XmlNamedNativeQuery namedNativeQueryResource = getXmlEntityMappings().getEntities().get(0).getNamedNativeQueries().get(0);
-
- assertNull(ormNamedNativeQuery.getQuery());
- assertNull(namedNativeQueryResource.getQuery());
-
- //set name in the context model, verify resource model updated
- ormNamedNativeQuery.setQuery("newName");
- assertEquals("newName", ormNamedNativeQuery.getQuery());
- assertEquals("newName", namedNativeQueryResource.getQuery());
-
- //set name to null in the context model
- ormNamedNativeQuery.setQuery(null);
- assertNull(ormNamedNativeQuery.getQuery());
- assertNull(namedNativeQueryResource.getQuery());
- }
-
- public void testAddHint() throws Exception {
- OrmPersistentType ormPersistentType = getEntityMappings().addPersistentType(MappingKeys.ENTITY_TYPE_MAPPING_KEY, "model.Foo");
- OrmEntity ormEntity = (OrmEntity) ormPersistentType.getMapping();
- OrmNamedNativeQuery ormNamedNativeQuery = ormEntity.getQueryContainer().addNamedNativeQuery(0);
-
- XmlNamedNativeQuery namedNativeQueryResource = getXmlEntityMappings().getEntities().get(0).getNamedNativeQueries().get(0);
-
- OrmQueryHint queryHint = ormNamedNativeQuery.addHint(0);
- queryHint.setName("FOO");
-
- assertEquals("FOO", namedNativeQueryResource.getHints().get(0).getName());
-
- OrmQueryHint queryHint2 = ormNamedNativeQuery.addHint(0);
- queryHint2.setName("BAR");
-
- assertEquals("BAR", namedNativeQueryResource.getHints().get(0).getName());
- assertEquals("FOO", namedNativeQueryResource.getHints().get(1).getName());
-
- OrmQueryHint queryHint3 = ormNamedNativeQuery.addHint(1);
- queryHint3.setName("BAZ");
-
- assertEquals("BAR", namedNativeQueryResource.getHints().get(0).getName());
- assertEquals("BAZ", namedNativeQueryResource.getHints().get(1).getName());
- assertEquals("FOO", namedNativeQueryResource.getHints().get(2).getName());
-
- ListIterator<OrmQueryHint> queryHints = ormNamedNativeQuery.hints();
- assertEquals(queryHint2, queryHints.next());
- assertEquals(queryHint3, queryHints.next());
- assertEquals(queryHint, queryHints.next());
-
- queryHints = ormNamedNativeQuery.hints();
- assertEquals("BAR", queryHints.next().getName());
- assertEquals("BAZ", queryHints.next().getName());
- assertEquals("FOO", queryHints.next().getName());
- }
-
- public void testRemoveHint() throws Exception {
- OrmPersistentType ormPersistentType = getEntityMappings().addPersistentType(MappingKeys.ENTITY_TYPE_MAPPING_KEY, "model.Foo");
- OrmEntity ormEntity = (OrmEntity) ormPersistentType.getMapping();
- OrmNamedNativeQuery ormNamedNativeQuery = ormEntity.getQueryContainer().addNamedNativeQuery(0);
-
- XmlNamedNativeQuery namedNativeQueryResource = getXmlEntityMappings().getEntities().get(0).getNamedNativeQueries().get(0);
-
- ormNamedNativeQuery.addHint(0).setName("FOO");
- ormNamedNativeQuery.addHint(1).setName("BAR");
- ormNamedNativeQuery.addHint(2).setName("BAZ");
-
- assertEquals(3, namedNativeQueryResource.getHints().size());
-
- ormNamedNativeQuery.removeHint(0);
- assertEquals(2, namedNativeQueryResource.getHints().size());
- assertEquals("BAR", namedNativeQueryResource.getHints().get(0).getName());
- assertEquals("BAZ", namedNativeQueryResource.getHints().get(1).getName());
-
- ormNamedNativeQuery.removeHint(0);
- assertEquals(1, namedNativeQueryResource.getHints().size());
- assertEquals("BAZ", namedNativeQueryResource.getHints().get(0).getName());
-
- ormNamedNativeQuery.removeHint(0);
- assertEquals(0, namedNativeQueryResource.getHints().size());
- }
-
- public void testMoveHint() throws Exception {
- OrmPersistentType ormPersistentType = getEntityMappings().addPersistentType(MappingKeys.ENTITY_TYPE_MAPPING_KEY, "model.Foo");
- OrmEntity ormEntity = (OrmEntity) ormPersistentType.getMapping();
- OrmNamedNativeQuery ormNamedNativeQuery = ormEntity.getQueryContainer().addNamedNativeQuery(0);
-
- XmlNamedNativeQuery namedNativeQueryResource = getXmlEntityMappings().getEntities().get(0).getNamedNativeQueries().get(0);
-
- ormNamedNativeQuery.addHint(0).setName("FOO");
- ormNamedNativeQuery.addHint(1).setName("BAR");
- ormNamedNativeQuery.addHint(2).setName("BAZ");
-
- assertEquals(3, namedNativeQueryResource.getHints().size());
-
-
- ormNamedNativeQuery.moveHint(2, 0);
- ListIterator<OrmQueryHint> hints = ormNamedNativeQuery.hints();
- assertEquals("BAR", hints.next().getName());
- assertEquals("BAZ", hints.next().getName());
- assertEquals("FOO", hints.next().getName());
-
- assertEquals("BAR", namedNativeQueryResource.getHints().get(0).getName());
- assertEquals("BAZ", namedNativeQueryResource.getHints().get(1).getName());
- assertEquals("FOO", namedNativeQueryResource.getHints().get(2).getName());
-
-
- ormNamedNativeQuery.moveHint(0, 1);
- hints = ormNamedNativeQuery.hints();
- assertEquals("BAZ", hints.next().getName());
- assertEquals("BAR", hints.next().getName());
- assertEquals("FOO", hints.next().getName());
-
- assertEquals("BAZ", namedNativeQueryResource.getHints().get(0).getName());
- assertEquals("BAR", namedNativeQueryResource.getHints().get(1).getName());
- assertEquals("FOO", namedNativeQueryResource.getHints().get(2).getName());
- }
-
- public void testUpdateHints() throws Exception {
- OrmPersistentType ormPersistentType = getEntityMappings().addPersistentType(MappingKeys.ENTITY_TYPE_MAPPING_KEY, "model.Foo");
- OrmEntity ormEntity = (OrmEntity) ormPersistentType.getMapping();
- OrmNamedNativeQuery ormNamedNativeQuery = ormEntity.getQueryContainer().addNamedNativeQuery(0);
-
- XmlNamedNativeQuery namedNativeQueryResource = getXmlEntityMappings().getEntities().get(0).getNamedNativeQueries().get(0);
-
- namedNativeQueryResource.getHints().add(OrmFactory.eINSTANCE.createXmlQueryHint());
- namedNativeQueryResource.getHints().add(OrmFactory.eINSTANCE.createXmlQueryHint());
- namedNativeQueryResource.getHints().add(OrmFactory.eINSTANCE.createXmlQueryHint());
-
- namedNativeQueryResource.getHints().get(0).setName("FOO");
- namedNativeQueryResource.getHints().get(1).setName("BAR");
- namedNativeQueryResource.getHints().get(2).setName("BAZ");
-
- ListIterator<OrmQueryHint> hints = ormNamedNativeQuery.hints();
- assertEquals("FOO", hints.next().getName());
- assertEquals("BAR", hints.next().getName());
- assertEquals("BAZ", hints.next().getName());
- assertFalse(hints.hasNext());
-
- namedNativeQueryResource.getHints().move(2, 0);
- hints = ormNamedNativeQuery.hints();
- assertEquals("BAR", hints.next().getName());
- assertEquals("BAZ", hints.next().getName());
- assertEquals("FOO", hints.next().getName());
- assertFalse(hints.hasNext());
-
- namedNativeQueryResource.getHints().move(0, 1);
- hints = ormNamedNativeQuery.hints();
- assertEquals("BAZ", hints.next().getName());
- assertEquals("BAR", hints.next().getName());
- assertEquals("FOO", hints.next().getName());
- assertFalse(hints.hasNext());
-
- namedNativeQueryResource.getHints().remove(1);
- hints = ormNamedNativeQuery.hints();
- assertEquals("BAZ", hints.next().getName());
- assertEquals("FOO", hints.next().getName());
- assertFalse(hints.hasNext());
-
- namedNativeQueryResource.getHints().remove(1);
- hints = ormNamedNativeQuery.hints();
- assertEquals("BAZ", hints.next().getName());
- assertFalse(hints.hasNext());
-
- namedNativeQueryResource.getHints().remove(0);
- assertFalse(ormNamedNativeQuery.hints().hasNext());
- }
-
-
- public void testUpdateResultSetMapping() throws Exception {
- OrmPersistentType ormPersistentType = getEntityMappings().addPersistentType(MappingKeys.ENTITY_TYPE_MAPPING_KEY, "model.Foo");
- OrmEntity ormEntity = (OrmEntity) ormPersistentType.getMapping();
- OrmNamedNativeQuery ormNamedNativeQuery = ormEntity.getQueryContainer().addNamedNativeQuery(0);
-
- XmlNamedNativeQuery namedNativeQueryResource = getXmlEntityMappings().getEntities().get(0).getNamedNativeQueries().get(0);
-
- assertEquals(null, namedNativeQueryResource.getResultSetMapping());
- assertEquals(null, ormNamedNativeQuery.getResultSetMapping());
-
- //set name in the resource model, verify context model updated
- namedNativeQueryResource.setResultSetMapping("foo");
- assertEquals("foo", namedNativeQueryResource.getResultSetMapping());
- assertEquals("foo", ormNamedNativeQuery.getResultSetMapping());
-
- //set name to null in the resource model
- namedNativeQueryResource.setResultSetMapping(null);
- assertNull(namedNativeQueryResource.getResultSetMapping());
- assertNull(ormNamedNativeQuery.getResultSetMapping());
- }
-
- public void testModifyResultSetMapping() throws Exception {
- OrmPersistentType ormPersistentType = getEntityMappings().addPersistentType(MappingKeys.ENTITY_TYPE_MAPPING_KEY, "model.Foo");
- OrmEntity ormEntity = (OrmEntity) ormPersistentType.getMapping();
- OrmNamedNativeQuery ormNamedNativeQuery = ormEntity.getQueryContainer().addNamedNativeQuery(0);
-
- XmlNamedNativeQuery namedNativeQueryResource = getXmlEntityMappings().getEntities().get(0).getNamedNativeQueries().get(0);
-
- assertEquals(null, namedNativeQueryResource.getResultSetMapping());
- assertEquals(null, ormNamedNativeQuery.getResultSetMapping());
-
- //set name in the context model, verify resource model updated
- ormNamedNativeQuery.setResultSetMapping("foo");
- assertEquals("foo", namedNativeQueryResource.getResultSetMapping());
- assertEquals("foo", ormNamedNativeQuery.getResultSetMapping());
-
- //set name to null in the context model
- ormNamedNativeQuery.setResultSetMapping(null);
- assertNull(namedNativeQueryResource.getResultSetMapping());
- assertNull(ormNamedNativeQuery.getResultSetMapping());
- }
-
- public void testUpdateResultClass() throws Exception {
- OrmPersistentType ormPersistentType = getEntityMappings().addPersistentType(MappingKeys.ENTITY_TYPE_MAPPING_KEY, "model.Foo");
- OrmEntity ormEntity = (OrmEntity) ormPersistentType.getMapping();
- OrmNamedNativeQuery ormNamedNativeQuery = ormEntity.getQueryContainer().addNamedNativeQuery(0);
-
- XmlNamedNativeQuery namedNativeQueryResource = getXmlEntityMappings().getEntities().get(0).getNamedNativeQueries().get(0);
-
- assertEquals(null, namedNativeQueryResource.getResultClass());
- assertEquals(null, ormNamedNativeQuery.getResultClass());
-
- //set name in the resource model, verify context model updated
- namedNativeQueryResource.setResultClass("foo");
- assertEquals("foo", namedNativeQueryResource.getResultClass());
- assertEquals("foo", ormNamedNativeQuery.getResultClass());
-
- //set name to null in the resource model
- namedNativeQueryResource.setResultClass(null);
- assertNull(namedNativeQueryResource.getResultClass());
- assertNull(ormNamedNativeQuery.getResultClass());
- }
-
- public void testModifyResultClass() throws Exception {
- OrmPersistentType ormPersistentType = getEntityMappings().addPersistentType(MappingKeys.ENTITY_TYPE_MAPPING_KEY, "model.Foo");
- OrmEntity ormEntity = (OrmEntity) ormPersistentType.getMapping();
- OrmNamedNativeQuery ormNamedNativeQuery = ormEntity.getQueryContainer().addNamedNativeQuery(0);
-
- XmlNamedNativeQuery namedNativeQueryResource = getXmlEntityMappings().getEntities().get(0).getNamedNativeQueries().get(0);
-
- assertEquals(null, namedNativeQueryResource.getResultClass());
- assertEquals(null, ormNamedNativeQuery.getResultClass());
-
- //set name in the context model, verify resource model updated
- ormNamedNativeQuery.setResultClass("foo");
- assertEquals("foo", namedNativeQueryResource.getResultClass());
- assertEquals("foo", ormNamedNativeQuery.getResultClass());
-
- //set name to null in the context model
- ormNamedNativeQuery.setResultClass(null);
- assertNull(namedNativeQueryResource.getResultClass());
- assertNull(ormNamedNativeQuery.getResultClass());
- }
-} \ No newline at end of file
diff --git a/jpa/tests/org.eclipse.jpt.core.tests/src/org/eclipse/jpt/core/tests/internal/context/orm/OrmNamedQueryTests.java b/jpa/tests/org.eclipse.jpt.core.tests/src/org/eclipse/jpt/core/tests/internal/context/orm/OrmNamedQueryTests.java
deleted file mode 100644
index 8e06b59bae..0000000000
--- a/jpa/tests/org.eclipse.jpt.core.tests/src/org/eclipse/jpt/core/tests/internal/context/orm/OrmNamedQueryTests.java
+++ /dev/null
@@ -1,273 +0,0 @@
-/*******************************************************************************
- * Copyright (c) 2007, 2009 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.
- *
- * Contributors:
- * Oracle - initial API and implementation
- ******************************************************************************/
-package org.eclipse.jpt.core.tests.internal.context.orm;
-
-import java.util.ListIterator;
-import org.eclipse.jpt.core.JptCorePlugin;
-import org.eclipse.jpt.core.MappingKeys;
-import org.eclipse.jpt.core.context.orm.OrmEntity;
-import org.eclipse.jpt.core.context.orm.OrmNamedQuery;
-import org.eclipse.jpt.core.context.orm.OrmPersistentType;
-import org.eclipse.jpt.core.context.orm.OrmQueryHint;
-import org.eclipse.jpt.core.resource.orm.OrmFactory;
-import org.eclipse.jpt.core.resource.orm.XmlNamedQuery;
-import org.eclipse.jpt.core.resource.persistence.PersistenceFactory;
-import org.eclipse.jpt.core.resource.persistence.XmlMappingFileRef;
-import org.eclipse.jpt.core.tests.internal.context.ContextModelTestCase;
-
-@SuppressWarnings("nls")
-public class OrmNamedQueryTests extends ContextModelTestCase
-{
- public OrmNamedQueryTests(String name) {
- super(name);
- }
-
-
- @Override
- protected void setUp() throws Exception {
- super.setUp();
- XmlMappingFileRef mappingFileRef = PersistenceFactory.eINSTANCE.createXmlMappingFileRef();
- mappingFileRef.setFileName(JptCorePlugin.DEFAULT_ORM_XML_FILE_PATH);
- getXmlPersistenceUnit().getMappingFiles().add(mappingFileRef);
- getPersistenceXmlResource().save(null);
- }
-
- public void testUpdateName() throws Exception {
- OrmPersistentType ormPersistentType = getEntityMappings().addPersistentType(MappingKeys.ENTITY_TYPE_MAPPING_KEY, "model.Foo");
- OrmEntity ormEntity = (OrmEntity) ormPersistentType.getMapping();
- OrmNamedQuery ormNamedQuery = ormEntity.getQueryContainer().addNamedQuery(0);
-
- XmlNamedQuery namedQueryResource = getXmlEntityMappings().getEntities().get(0).getNamedQueries().get(0);
-
- assertNull(ormNamedQuery.getName());
- assertNull(namedQueryResource.getName());
-
- //set name in the resource model, verify context model updated
- namedQueryResource.setName("newName");
- assertEquals("newName", ormNamedQuery.getName());
- assertEquals("newName", namedQueryResource.getName());
-
- //set name to null in the resource model
- namedQueryResource.setName(null);
- assertNull(ormNamedQuery.getName());
- assertNull(namedQueryResource.getName());
- }
-
- public void testModifyName() throws Exception {
- OrmPersistentType ormPersistentType = getEntityMappings().addPersistentType(MappingKeys.ENTITY_TYPE_MAPPING_KEY, "model.Foo");
- OrmEntity ormEntity = (OrmEntity) ormPersistentType.getMapping();
- OrmNamedQuery ormNamedQuery = ormEntity.getQueryContainer().addNamedQuery(0);
-
- XmlNamedQuery namedQueryResource = getXmlEntityMappings().getEntities().get(0).getNamedQueries().get(0);
-
- assertNull(ormNamedQuery.getName());
- assertNull(namedQueryResource.getName());
-
- //set name in the context model, verify resource model updated
- ormNamedQuery.setName("newName");
- assertEquals("newName", ormNamedQuery.getName());
- assertEquals("newName", namedQueryResource.getName());
-
- //set name to null in the context model
- ormNamedQuery.setName(null);
- assertNull(ormNamedQuery.getName());
- assertNull(namedQueryResource.getName());
- }
-
- public void testUpdateQuery() throws Exception {
- OrmPersistentType ormPersistentType = getEntityMappings().addPersistentType(MappingKeys.ENTITY_TYPE_MAPPING_KEY, "model.Foo");
- OrmEntity ormEntity = (OrmEntity) ormPersistentType.getMapping();
- OrmNamedQuery ormNamedQuery = ormEntity.getQueryContainer().addNamedQuery(0);
-
- XmlNamedQuery namedQueryResource = getXmlEntityMappings().getEntities().get(0).getNamedQueries().get(0);
-
- assertNull(ormNamedQuery.getQuery());
- assertNull(namedQueryResource.getQuery());
-
- //set name in the resource model, verify context model updated
- namedQueryResource.setQuery("newName");
- assertEquals("newName", ormNamedQuery.getQuery());
- assertEquals("newName", namedQueryResource.getQuery());
-
- //set name to null in the resource model
- namedQueryResource.setQuery(null);
- assertNull(ormNamedQuery.getQuery());
- assertNull(namedQueryResource.getQuery());
- }
-
- public void testModifyQuery() throws Exception {
- OrmPersistentType ormPersistentType = getEntityMappings().addPersistentType(MappingKeys.ENTITY_TYPE_MAPPING_KEY, "model.Foo");
- OrmEntity ormEntity = (OrmEntity) ormPersistentType.getMapping();
- OrmNamedQuery ormNamedQuery = ormEntity.getQueryContainer().addNamedQuery(0);
-
- XmlNamedQuery namedQueryResource = getXmlEntityMappings().getEntities().get(0).getNamedQueries().get(0);
-
- assertNull(ormNamedQuery.getQuery());
- assertNull(namedQueryResource.getQuery());
-
- //set name in the context model, verify resource model updated
- ormNamedQuery.setQuery("newName");
- assertEquals("newName", ormNamedQuery.getQuery());
- assertEquals("newName", namedQueryResource.getQuery());
-
- //set name to null in the context model
- ormNamedQuery.setQuery(null);
- assertNull(ormNamedQuery.getQuery());
- assertNull(namedQueryResource.getQuery());
- }
-
- public void testAddHint() throws Exception {
- OrmPersistentType ormPersistentType = getEntityMappings().addPersistentType(MappingKeys.ENTITY_TYPE_MAPPING_KEY, "model.Foo");
- OrmEntity ormEntity = (OrmEntity) ormPersistentType.getMapping();
- OrmNamedQuery ormNamedQuery = ormEntity.getQueryContainer().addNamedQuery(0);
-
- XmlNamedQuery namedQueryResource = getXmlEntityMappings().getEntities().get(0).getNamedQueries().get(0);
-
- OrmQueryHint queryHint = ormNamedQuery.addHint(0);
- queryHint.setName("FOO");
-
- assertEquals("FOO", namedQueryResource.getHints().get(0).getName());
-
- OrmQueryHint queryHint2 = ormNamedQuery.addHint(0);
- queryHint2.setName("BAR");
-
- assertEquals("BAR", namedQueryResource.getHints().get(0).getName());
- assertEquals("FOO", namedQueryResource.getHints().get(1).getName());
-
- OrmQueryHint queryHint3 = ormNamedQuery.addHint(1);
- queryHint3.setName("BAZ");
-
- assertEquals("BAR", namedQueryResource.getHints().get(0).getName());
- assertEquals("BAZ", namedQueryResource.getHints().get(1).getName());
- assertEquals("FOO", namedQueryResource.getHints().get(2).getName());
-
- ListIterator<OrmQueryHint> queryHints = ormNamedQuery.hints();
- assertEquals(queryHint2, queryHints.next());
- assertEquals(queryHint3, queryHints.next());
- assertEquals(queryHint, queryHints.next());
-
- queryHints = ormNamedQuery.hints();
- assertEquals("BAR", queryHints.next().getName());
- assertEquals("BAZ", queryHints.next().getName());
- assertEquals("FOO", queryHints.next().getName());
- }
-
- public void testRemoveHint() throws Exception {
- OrmPersistentType ormPersistentType = getEntityMappings().addPersistentType(MappingKeys.ENTITY_TYPE_MAPPING_KEY, "model.Foo");
- OrmEntity ormEntity = (OrmEntity) ormPersistentType.getMapping();
- OrmNamedQuery ormNamedQuery = ormEntity.getQueryContainer().addNamedQuery(0);
-
- XmlNamedQuery namedQueryResource = getXmlEntityMappings().getEntities().get(0).getNamedQueries().get(0);
-
- ormNamedQuery.addHint(0).setName("FOO");
- ormNamedQuery.addHint(1).setName("BAR");
- ormNamedQuery.addHint(2).setName("BAZ");
-
- assertEquals(3, namedQueryResource.getHints().size());
-
- ormNamedQuery.removeHint(0);
- assertEquals(2, namedQueryResource.getHints().size());
- assertEquals("BAR", namedQueryResource.getHints().get(0).getName());
- assertEquals("BAZ", namedQueryResource.getHints().get(1).getName());
-
- ormNamedQuery.removeHint(0);
- assertEquals(1, namedQueryResource.getHints().size());
- assertEquals("BAZ", namedQueryResource.getHints().get(0).getName());
-
- ormNamedQuery.removeHint(0);
- assertEquals(0, namedQueryResource.getHints().size());
- }
-
- public void testMoveHint() throws Exception {
- OrmPersistentType ormPersistentType = getEntityMappings().addPersistentType(MappingKeys.ENTITY_TYPE_MAPPING_KEY, "model.Foo");
- OrmEntity ormEntity = (OrmEntity) ormPersistentType.getMapping();
- OrmNamedQuery ormNamedQuery = ormEntity.getQueryContainer().addNamedQuery(0);
-
- XmlNamedQuery namedQueryResource = getXmlEntityMappings().getEntities().get(0).getNamedQueries().get(0);
-
- ormNamedQuery.addHint(0).setName("FOO");
- ormNamedQuery.addHint(1).setName("BAR");
- ormNamedQuery.addHint(2).setName("BAZ");
-
- assertEquals(3, namedQueryResource.getHints().size());
-
-
- ormNamedQuery.moveHint(2, 0);
- ListIterator<OrmQueryHint> hints = ormNamedQuery.hints();
- assertEquals("BAR", hints.next().getName());
- assertEquals("BAZ", hints.next().getName());
- assertEquals("FOO", hints.next().getName());
-
- assertEquals("BAR", namedQueryResource.getHints().get(0).getName());
- assertEquals("BAZ", namedQueryResource.getHints().get(1).getName());
- assertEquals("FOO", namedQueryResource.getHints().get(2).getName());
-
-
- ormNamedQuery.moveHint(0, 1);
- hints = ormNamedQuery.hints();
- assertEquals("BAZ", hints.next().getName());
- assertEquals("BAR", hints.next().getName());
- assertEquals("FOO", hints.next().getName());
-
- assertEquals("BAZ", namedQueryResource.getHints().get(0).getName());
- assertEquals("BAR", namedQueryResource.getHints().get(1).getName());
- assertEquals("FOO", namedQueryResource.getHints().get(2).getName());
- }
-
- public void testUpdateHints() throws Exception {
- OrmPersistentType ormPersistentType = getEntityMappings().addPersistentType(MappingKeys.ENTITY_TYPE_MAPPING_KEY, "model.Foo");
- OrmEntity ormEntity = (OrmEntity) ormPersistentType.getMapping();
- OrmNamedQuery ormNamedQuery = ormEntity.getQueryContainer().addNamedQuery(0);
-
- XmlNamedQuery namedQueryResource = getXmlEntityMappings().getEntities().get(0).getNamedQueries().get(0);
-
- namedQueryResource.getHints().add(OrmFactory.eINSTANCE.createXmlQueryHint());
- namedQueryResource.getHints().add(OrmFactory.eINSTANCE.createXmlQueryHint());
- namedQueryResource.getHints().add(OrmFactory.eINSTANCE.createXmlQueryHint());
-
- namedQueryResource.getHints().get(0).setName("FOO");
- namedQueryResource.getHints().get(1).setName("BAR");
- namedQueryResource.getHints().get(2).setName("BAZ");
-
- ListIterator<OrmQueryHint> hints = ormNamedQuery.hints();
- assertEquals("FOO", hints.next().getName());
- assertEquals("BAR", hints.next().getName());
- assertEquals("BAZ", hints.next().getName());
- assertFalse(hints.hasNext());
-
- namedQueryResource.getHints().move(2, 0);
- hints = ormNamedQuery.hints();
- assertEquals("BAR", hints.next().getName());
- assertEquals("BAZ", hints.next().getName());
- assertEquals("FOO", hints.next().getName());
- assertFalse(hints.hasNext());
-
- namedQueryResource.getHints().move(0, 1);
- hints = ormNamedQuery.hints();
- assertEquals("BAZ", hints.next().getName());
- assertEquals("BAR", hints.next().getName());
- assertEquals("FOO", hints.next().getName());
- assertFalse(hints.hasNext());
-
- namedQueryResource.getHints().remove(1);
- hints = ormNamedQuery.hints();
- assertEquals("BAZ", hints.next().getName());
- assertEquals("FOO", hints.next().getName());
- assertFalse(hints.hasNext());
-
- namedQueryResource.getHints().remove(1);
- hints = ormNamedQuery.hints();
- assertEquals("BAZ", hints.next().getName());
- assertFalse(hints.hasNext());
-
- namedQueryResource.getHints().remove(0);
- assertFalse(ormNamedQuery.hints().hasNext());
- }
-} \ No newline at end of file
diff --git a/jpa/tests/org.eclipse.jpt.core.tests/src/org/eclipse/jpt/core/tests/internal/context/orm/OrmOneToManyMappingTests.java b/jpa/tests/org.eclipse.jpt.core.tests/src/org/eclipse/jpt/core/tests/internal/context/orm/OrmOneToManyMappingTests.java
deleted file mode 100644
index 98e671cc9f..0000000000
--- a/jpa/tests/org.eclipse.jpt.core.tests/src/org/eclipse/jpt/core/tests/internal/context/orm/OrmOneToManyMappingTests.java
+++ /dev/null
@@ -1,612 +0,0 @@
-/*******************************************************************************
- * Copyright (c) 2007, 2009 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.
- *
- * Contributors:
- * Oracle - initial API and implementation
- ******************************************************************************/
-package org.eclipse.jpt.core.tests.internal.context.orm;
-
-import org.eclipse.jpt.core.JptCorePlugin;
-import org.eclipse.jpt.core.MappingKeys;
-import org.eclipse.jpt.core.context.BasicMapping;
-import org.eclipse.jpt.core.context.EmbeddedIdMapping;
-import org.eclipse.jpt.core.context.EmbeddedMapping;
-import org.eclipse.jpt.core.context.FetchType;
-import org.eclipse.jpt.core.context.IdMapping;
-import org.eclipse.jpt.core.context.JoinColumn;
-import org.eclipse.jpt.core.context.JoinTable;
-import org.eclipse.jpt.core.context.ManyToManyMapping;
-import org.eclipse.jpt.core.context.ManyToOneMapping;
-import org.eclipse.jpt.core.context.OneToManyMapping;
-import org.eclipse.jpt.core.context.OneToOneMapping;
-import org.eclipse.jpt.core.context.TransientMapping;
-import org.eclipse.jpt.core.context.VersionMapping;
-import org.eclipse.jpt.core.context.orm.OrmMappedByJoiningStrategy;
-import org.eclipse.jpt.core.context.orm.OrmOneToManyMapping;
-import org.eclipse.jpt.core.context.orm.OrmPersistentAttribute;
-import org.eclipse.jpt.core.context.orm.OrmPersistentType;
-import org.eclipse.jpt.core.resource.orm.OrmFactory;
-import org.eclipse.jpt.core.resource.orm.XmlOneToMany;
-import org.eclipse.jpt.core.resource.persistence.PersistenceFactory;
-import org.eclipse.jpt.core.resource.persistence.XmlMappingFileRef;
-import org.eclipse.jpt.core.tests.internal.context.ContextModelTestCase;
-
-@SuppressWarnings("nls")
-public class OrmOneToManyMappingTests extends ContextModelTestCase
-{
- public OrmOneToManyMappingTests(String name) {
- super(name);
- }
-
-
- @Override
- protected void setUp() throws Exception {
- super.setUp();
- XmlMappingFileRef mappingFileRef = PersistenceFactory.eINSTANCE.createXmlMappingFileRef();
- mappingFileRef.setFileName(JptCorePlugin.DEFAULT_ORM_XML_FILE_PATH);
- getXmlPersistenceUnit().getMappingFiles().add(mappingFileRef);
- getPersistenceXmlResource().save(null);
- }
-
- public void testUpdateName() throws Exception {
- OrmPersistentType ormPersistentType = getEntityMappings().addPersistentType(MappingKeys.ENTITY_TYPE_MAPPING_KEY, "model.Foo");
- OrmPersistentAttribute ormPersistentAttribute = ormPersistentType.addSpecifiedPersistentAttribute(MappingKeys.ONE_TO_MANY_ATTRIBUTE_MAPPING_KEY, "oneToManyMapping");
- OrmOneToManyMapping ormOneToManyMapping = (OrmOneToManyMapping) ormPersistentAttribute.getMapping();
- XmlOneToMany oneToMany = getXmlEntityMappings().getEntities().get(0).getAttributes().getOneToManys().get(0);
-
- assertEquals("oneToManyMapping", ormOneToManyMapping.getName());
- assertEquals("oneToManyMapping", oneToMany.getName());
-
- //set name in the resource model, verify context model updated
- oneToMany.setName("newName");
- assertEquals("newName", ormOneToManyMapping.getName());
- assertEquals("newName", oneToMany.getName());
-
- //set name to null in the resource model
- oneToMany.setName(null);
- assertNull(ormOneToManyMapping.getName());
- assertNull(oneToMany.getName());
- }
-
- public void testModifyName() throws Exception {
- OrmPersistentType ormPersistentType = getEntityMappings().addPersistentType(MappingKeys.ENTITY_TYPE_MAPPING_KEY, "model.Foo");
- OrmPersistentAttribute ormPersistentAttribute = ormPersistentType.addSpecifiedPersistentAttribute(MappingKeys.ONE_TO_MANY_ATTRIBUTE_MAPPING_KEY, "oneToManyMapping");
- OrmOneToManyMapping ormOneToManyMapping = (OrmOneToManyMapping) ormPersistentAttribute.getMapping();
- XmlOneToMany oneToMany = getXmlEntityMappings().getEntities().get(0).getAttributes().getOneToManys().get(0);
-
- assertEquals("oneToManyMapping", ormOneToManyMapping.getName());
- assertEquals("oneToManyMapping", oneToMany.getName());
-
- //set name in the context model, verify resource model updated
- ormOneToManyMapping.setName("newName");
- assertEquals("newName", ormOneToManyMapping.getName());
- assertEquals("newName", oneToMany.getName());
-
- //set name to null in the context model
- ormOneToManyMapping.setName(null);
- assertNull(ormOneToManyMapping.getName());
- assertNull(oneToMany.getName());
- }
-
- public void testUpdateTargetEntity() throws Exception {
- OrmPersistentType ormPersistentType = getEntityMappings().addPersistentType(MappingKeys.ENTITY_TYPE_MAPPING_KEY, "model.Foo");
- OrmPersistentAttribute ormPersistentAttribute = ormPersistentType.addSpecifiedPersistentAttribute(MappingKeys.ONE_TO_MANY_ATTRIBUTE_MAPPING_KEY, "oneToManyMapping");
- OrmOneToManyMapping ormOneToManyMapping = (OrmOneToManyMapping) ormPersistentAttribute.getMapping();
- XmlOneToMany oneToMany = getXmlEntityMappings().getEntities().get(0).getAttributes().getOneToManys().get(0);
-
- assertNull(ormOneToManyMapping.getSpecifiedTargetEntity());
- assertNull(oneToMany.getTargetEntity());
-
- //set target entity in the resource model, verify context model updated
- oneToMany.setTargetEntity("newTargetEntity");
- assertEquals("newTargetEntity", ormOneToManyMapping.getSpecifiedTargetEntity());
- assertEquals("newTargetEntity", oneToMany.getTargetEntity());
-
- //set target entity to null in the resource model
- oneToMany.setTargetEntity(null);
- assertNull(ormOneToManyMapping.getSpecifiedTargetEntity());
- assertNull(oneToMany.getTargetEntity());
- }
-
- public void testModifyTargetEntity() throws Exception {
- OrmPersistentType ormPersistentType = getEntityMappings().addPersistentType(MappingKeys.ENTITY_TYPE_MAPPING_KEY, "model.Foo");
- OrmPersistentAttribute ormPersistentAttribute = ormPersistentType.addSpecifiedPersistentAttribute(MappingKeys.ONE_TO_MANY_ATTRIBUTE_MAPPING_KEY, "oneToManyMapping");
- OrmOneToManyMapping ormOneToManyMapping = (OrmOneToManyMapping) ormPersistentAttribute.getMapping();
- XmlOneToMany oneToMany = getXmlEntityMappings().getEntities().get(0).getAttributes().getOneToManys().get(0);
-
- assertNull(ormOneToManyMapping.getSpecifiedTargetEntity());
- assertNull(oneToMany.getTargetEntity());
-
- //set target entity in the context model, verify resource model updated
- ormOneToManyMapping.setSpecifiedTargetEntity("newTargetEntity");
- assertEquals("newTargetEntity", ormOneToManyMapping.getSpecifiedTargetEntity());
- assertEquals("newTargetEntity", oneToMany.getTargetEntity());
-
- //set target entity to null in the context model
- ormOneToManyMapping.setSpecifiedTargetEntity(null);
- assertNull(ormOneToManyMapping.getSpecifiedTargetEntity());
- assertNull(oneToMany.getTargetEntity());
- }
-
- public void testUpdateSpecifiedFetch() throws Exception {
- OrmPersistentType ormPersistentType = getEntityMappings().addPersistentType(MappingKeys.ENTITY_TYPE_MAPPING_KEY, "model.Foo");
- OrmPersistentAttribute ormPersistentAttribute = ormPersistentType.addSpecifiedPersistentAttribute(MappingKeys.ONE_TO_MANY_ATTRIBUTE_MAPPING_KEY, "oneToManyMapping");
- OrmOneToManyMapping ormOneToManyMapping = (OrmOneToManyMapping) ormPersistentAttribute.getMapping();
- XmlOneToMany oneToManyResource = getXmlEntityMappings().getEntities().get(0).getAttributes().getOneToManys().get(0);
-
- assertNull(ormOneToManyMapping.getSpecifiedFetch());
- assertNull(oneToManyResource.getFetch());
-
- //set fetch in the resource model, verify context model updated
- oneToManyResource.setFetch(org.eclipse.jpt.core.resource.orm.FetchType.EAGER);
- assertEquals(FetchType.EAGER, ormOneToManyMapping.getSpecifiedFetch());
- assertEquals(org.eclipse.jpt.core.resource.orm.FetchType.EAGER, oneToManyResource.getFetch());
-
- oneToManyResource.setFetch(org.eclipse.jpt.core.resource.orm.FetchType.LAZY);
- assertEquals(FetchType.LAZY, ormOneToManyMapping.getSpecifiedFetch());
- assertEquals(org.eclipse.jpt.core.resource.orm.FetchType.LAZY, oneToManyResource.getFetch());
-
- //set fetch to null in the resource model
- oneToManyResource.setFetch(null);
- assertNull(ormOneToManyMapping.getSpecifiedFetch());
- assertNull(oneToManyResource.getFetch());
- }
-
- public void testModifySpecifiedFetch() throws Exception {
- OrmPersistentType ormPersistentType = getEntityMappings().addPersistentType(MappingKeys.ENTITY_TYPE_MAPPING_KEY, "model.Foo");
- OrmPersistentAttribute ormPersistentAttribute = ormPersistentType.addSpecifiedPersistentAttribute(MappingKeys.ONE_TO_MANY_ATTRIBUTE_MAPPING_KEY, "oneToManyMapping");
- OrmOneToManyMapping ormOneToManyMapping = (OrmOneToManyMapping) ormPersistentAttribute.getMapping();
- XmlOneToMany oneToManyResource = getXmlEntityMappings().getEntities().get(0).getAttributes().getOneToManys().get(0);
-
- assertNull(ormOneToManyMapping.getSpecifiedFetch());
- assertNull(oneToManyResource.getFetch());
-
- //set fetch in the context model, verify resource model updated
- ormOneToManyMapping.setSpecifiedFetch(FetchType.EAGER);
- assertEquals(org.eclipse.jpt.core.resource.orm.FetchType.EAGER, oneToManyResource.getFetch());
- assertEquals(FetchType.EAGER, ormOneToManyMapping.getSpecifiedFetch());
-
- ormOneToManyMapping.setSpecifiedFetch(FetchType.LAZY);
- assertEquals(org.eclipse.jpt.core.resource.orm.FetchType.LAZY, oneToManyResource.getFetch());
- assertEquals(FetchType.LAZY, ormOneToManyMapping.getSpecifiedFetch());
-
- //set fetch to null in the context model
- ormOneToManyMapping.setSpecifiedFetch(null);
- assertNull(oneToManyResource.getFetch());
- assertNull(ormOneToManyMapping.getSpecifiedFetch());
- }
-
- public void testUpdateMappedBy() throws Exception {
- OrmPersistentType ormPersistentType = getEntityMappings().addPersistentType(MappingKeys.ENTITY_TYPE_MAPPING_KEY, "model.Foo");
- OrmPersistentAttribute ormPersistentAttribute = ormPersistentType.addSpecifiedPersistentAttribute(MappingKeys.ONE_TO_MANY_ATTRIBUTE_MAPPING_KEY, "oneToManyMapping");
- OrmOneToManyMapping ormOneToManyMapping = (OrmOneToManyMapping) ormPersistentAttribute.getMapping();
- OrmMappedByJoiningStrategy strategy = ormOneToManyMapping.getRelationshipReference().getMappedByJoiningStrategy();
- XmlOneToMany oneToMany = getXmlEntityMappings().getEntities().get(0).getAttributes().getOneToManys().get(0);
-
- assertNull(strategy.getMappedByAttribute());
- assertNull(oneToMany.getMappedBy());
-
- //set mappedBy in the resource model, verify context model updated
- oneToMany.setMappedBy("newMappedBy");
- assertEquals("newMappedBy", strategy.getMappedByAttribute());
- assertEquals("newMappedBy", oneToMany.getMappedBy());
-
- //setmappedBy to null in the resource model
- oneToMany.setMappedBy(null);
- assertNull(strategy.getMappedByAttribute());
- assertNull(oneToMany.getMappedBy());
- }
-
- public void testModifyMappedBy() throws Exception {
- OrmPersistentType ormPersistentType = getEntityMappings().addPersistentType(MappingKeys.ENTITY_TYPE_MAPPING_KEY, "model.Foo");
- OrmPersistentAttribute ormPersistentAttribute = ormPersistentType.addSpecifiedPersistentAttribute(MappingKeys.ONE_TO_MANY_ATTRIBUTE_MAPPING_KEY, "oneToManyMapping");
- OrmOneToManyMapping ormOneToManyMapping = (OrmOneToManyMapping) ormPersistentAttribute.getMapping();
- OrmMappedByJoiningStrategy strategy = ormOneToManyMapping.getRelationshipReference().getMappedByJoiningStrategy();
- XmlOneToMany oneToMany = getXmlEntityMappings().getEntities().get(0).getAttributes().getOneToManys().get(0);
-
- assertNull(strategy.getMappedByAttribute());
- assertNull(oneToMany.getMappedBy());
-
- //set mappedBy in the context model, verify resource model updated
- strategy.setMappedByAttribute("newMappedBy");
- assertEquals("newMappedBy", strategy.getMappedByAttribute());
- assertEquals("newMappedBy", oneToMany.getMappedBy());
-
- //set mappedBy to null in the context model
- strategy.setMappedByAttribute(null);
- assertNull(strategy.getMappedByAttribute());
- assertNull(oneToMany.getMappedBy());
- }
-
-
- public void testUpdateMapKey() throws Exception {
- OrmPersistentType ormPersistentType = getEntityMappings().addPersistentType(MappingKeys.ENTITY_TYPE_MAPPING_KEY, "model.Foo");
- OrmPersistentAttribute ormPersistentAttribute = ormPersistentType.addSpecifiedPersistentAttribute(MappingKeys.ONE_TO_MANY_ATTRIBUTE_MAPPING_KEY, "oneToManyMapping");
- OrmOneToManyMapping ormOneToManyMapping = (OrmOneToManyMapping) ormPersistentAttribute.getMapping();
- XmlOneToMany oneToMany = getXmlEntityMappings().getEntities().get(0).getAttributes().getOneToManys().get(0);
-
- assertNull(ormOneToManyMapping.getMapKey());
- assertNull(oneToMany.getMapKey());
-
- //set mapKey in the resource model, verify context model does not change
- oneToMany.setMapKey(OrmFactory.eINSTANCE.createMapKey());
- assertNull(ormOneToManyMapping.getMapKey());
- assertNotNull(oneToMany.getMapKey());
-
- //set mapKey name in the resource model, verify context model updated
- oneToMany.getMapKey().setName("myMapKey");
- assertEquals("myMapKey", ormOneToManyMapping.getMapKey());
- assertEquals("myMapKey", oneToMany.getMapKey().getName());
-
- //set mapKey name to null in the resource model
- oneToMany.getMapKey().setName(null);
- assertNull(ormOneToManyMapping.getMapKey());
- assertNull(oneToMany.getMapKey().getName());
-
- oneToMany.getMapKey().setName("myMapKey");
- oneToMany.setMapKey(null);
- assertNull(ormOneToManyMapping.getMapKey());
- assertNull(oneToMany.getMapKey());
- }
-
- public void testModifyMapKey() throws Exception {
- OrmPersistentType ormPersistentType = getEntityMappings().addPersistentType(MappingKeys.ENTITY_TYPE_MAPPING_KEY, "model.Foo");
- OrmPersistentAttribute ormPersistentAttribute = ormPersistentType.addSpecifiedPersistentAttribute(MappingKeys.ONE_TO_MANY_ATTRIBUTE_MAPPING_KEY, "oneToManyMapping");
- OrmOneToManyMapping ormOneToManyMapping = (OrmOneToManyMapping) ormPersistentAttribute.getMapping();
- XmlOneToMany oneToMany = getXmlEntityMappings().getEntities().get(0).getAttributes().getOneToManys().get(0);
-
- assertNull(ormOneToManyMapping.getMapKey());
- assertNull(oneToMany.getMapKey());
-
- //set mapKey in the context model, verify resource model updated
- ormOneToManyMapping.setMapKey("myMapKey");
- assertEquals("myMapKey", ormOneToManyMapping.getMapKey());
- assertEquals("myMapKey", oneToMany.getMapKey().getName());
-
- //set mapKey to null in the context model
- ormOneToManyMapping.setMapKey(null);
- assertNull(ormOneToManyMapping.getMapKey());
- assertNull(oneToMany.getMapKey());
- }
-
- public void testUpdateOrderBy() throws Exception {
- OrmPersistentType ormPersistentType = getEntityMappings().addPersistentType(MappingKeys.ENTITY_TYPE_MAPPING_KEY, "model.Foo");
- OrmPersistentAttribute ormPersistentAttribute = ormPersistentType.addSpecifiedPersistentAttribute(MappingKeys.ONE_TO_MANY_ATTRIBUTE_MAPPING_KEY, "oneToManyMapping");
- OrmOneToManyMapping ormOneToManyMapping = (OrmOneToManyMapping) ormPersistentAttribute.getMapping();
- XmlOneToMany oneToMany = getXmlEntityMappings().getEntities().get(0).getAttributes().getOneToManys().get(0);
-
- assertNull(ormOneToManyMapping.getOrderBy());
- assertNull(oneToMany.getOrderBy());
-
- //set orderBy in the resource model, verify context model updated
- oneToMany.setOrderBy("newOrderBy");
- assertEquals("newOrderBy", ormOneToManyMapping.getOrderBy());
- assertEquals("newOrderBy", oneToMany.getOrderBy());
-
- //set orderBy to null in the resource model
- oneToMany.setOrderBy(null);
- assertNull(ormOneToManyMapping.getOrderBy());
- assertNull(oneToMany.getOrderBy());
- }
-
- public void testModifyOrderBy() throws Exception {
- OrmPersistentType ormPersistentType = getEntityMappings().addPersistentType(MappingKeys.ENTITY_TYPE_MAPPING_KEY, "model.Foo");
- OrmPersistentAttribute ormPersistentAttribute = ormPersistentType.addSpecifiedPersistentAttribute(MappingKeys.ONE_TO_MANY_ATTRIBUTE_MAPPING_KEY, "oneToManyMapping");
- OrmOneToManyMapping ormOneToManyMapping = (OrmOneToManyMapping) ormPersistentAttribute.getMapping();
- XmlOneToMany oneToMany = getXmlEntityMappings().getEntities().get(0).getAttributes().getOneToManys().get(0);
-
- assertNull(ormOneToManyMapping.getOrderBy());
- assertNull(oneToMany.getOrderBy());
-
- //set mappedBy in the context model, verify resource model updated
- ormOneToManyMapping.setOrderBy("newOrderBy");
- assertEquals("newOrderBy", ormOneToManyMapping.getOrderBy());
- assertEquals("newOrderBy", oneToMany.getOrderBy());
-
- //set mappedBy to null in the context model
- ormOneToManyMapping.setOrderBy(null);
- assertNull(ormOneToManyMapping.getOrderBy());
- assertNull(oneToMany.getOrderBy());
- }
-
- public void testIsNoOrdering() throws Exception {
- OrmPersistentType ormPersistentType = getEntityMappings().addPersistentType(MappingKeys.ENTITY_TYPE_MAPPING_KEY, "model.Foo");
- OrmPersistentAttribute ormPersistentAttribute = ormPersistentType.addSpecifiedPersistentAttribute(MappingKeys.ONE_TO_MANY_ATTRIBUTE_MAPPING_KEY, "oneToManyMapping");
- OrmOneToManyMapping ormOneToManyMapping = (OrmOneToManyMapping) ormPersistentAttribute.getMapping();
-
- assertTrue(ormOneToManyMapping.isNoOrdering());
-
- ormOneToManyMapping.setOrderBy("foo");
- assertFalse(ormOneToManyMapping.isNoOrdering());
-
- ormOneToManyMapping.setOrderBy(null);
- assertTrue(ormOneToManyMapping.isNoOrdering());
- }
-
- public void testSetNoOrdering() throws Exception {
- OrmPersistentType ormPersistentType = getEntityMappings().addPersistentType(MappingKeys.ENTITY_TYPE_MAPPING_KEY, "model.Foo");
- OrmPersistentAttribute ormPersistentAttribute = ormPersistentType.addSpecifiedPersistentAttribute(MappingKeys.ONE_TO_MANY_ATTRIBUTE_MAPPING_KEY, "oneToManyMapping");
- OrmOneToManyMapping ormOneToManyMapping = (OrmOneToManyMapping) ormPersistentAttribute.getMapping();
-
- assertTrue(ormOneToManyMapping.isNoOrdering());
-
- ormOneToManyMapping.setOrderBy("foo");
- assertFalse(ormOneToManyMapping.isNoOrdering());
-
- ormOneToManyMapping.setNoOrdering(true);
- assertTrue(ormOneToManyMapping.isNoOrdering());
- assertNull(ormOneToManyMapping.getOrderBy());
- }
-//TODO
-// public boolean isOrderByPk() {
-// return "".equals(getOrderBy());
-// }
-//
-// public void setOrderByPk() {
-// setOrderBy("");
-// }
-
- public void testIsCustomOrdering() throws Exception {
- OrmPersistentType ormPersistentType = getEntityMappings().addPersistentType(MappingKeys.ENTITY_TYPE_MAPPING_KEY, "model.Foo");
- OrmPersistentAttribute ormPersistentAttribute = ormPersistentType.addSpecifiedPersistentAttribute(MappingKeys.ONE_TO_MANY_ATTRIBUTE_MAPPING_KEY, "oneToManyMapping");
- OrmOneToManyMapping ormOneToManyMapping = (OrmOneToManyMapping) ormPersistentAttribute.getMapping();
-
- assertFalse(ormOneToManyMapping.isCustomOrdering());
-
- ormOneToManyMapping.setOrderBy("foo");
- assertTrue(ormOneToManyMapping.isCustomOrdering());
-
- ormOneToManyMapping.setOrderBy(null);
- assertFalse(ormOneToManyMapping.isCustomOrdering());
- }
-
- public void testOneToManyMorphToIdMapping() throws Exception {
- OrmPersistentType ormPersistentType = getEntityMappings().addPersistentType(MappingKeys.ENTITY_TYPE_MAPPING_KEY, FULLY_QUALIFIED_TYPE_NAME);
- OrmPersistentAttribute ormPersistentAttribute = ormPersistentType.addSpecifiedPersistentAttribute(MappingKeys.ONE_TO_MANY_ATTRIBUTE_MAPPING_KEY, "oneToMany");
-
- OneToManyMapping oneToManyMapping = (OneToManyMapping) ormPersistentAttribute.getMapping();
- assertFalse(oneToManyMapping.isDefault());
- oneToManyMapping.setSpecifiedFetch(FetchType.EAGER);
- oneToManyMapping.setSpecifiedTargetEntity("TargetEntity");
- oneToManyMapping.setOrderBy("customOrder");
- oneToManyMapping.setMapKey("mapKey");
- oneToManyMapping.getRelationshipReference().getMappedByJoiningStrategy().setMappedByAttribute("mappedBy");
- assertFalse(oneToManyMapping.isDefault());
-
- ormPersistentAttribute.setSpecifiedMappingKey(MappingKeys.ID_ATTRIBUTE_MAPPING_KEY);
- assertEquals(1, ormPersistentType.specifiedAttributesSize());
- assertEquals(ormPersistentAttribute, ormPersistentType.specifiedAttributes().next());
- assertTrue(ormPersistentAttribute.getMapping() instanceof IdMapping);
- assertEquals("oneToMany", ormPersistentAttribute.getMapping().getName());
- }
-
- public void testOneToManyMorphToVersionMapping() throws Exception {
- OrmPersistentType ormPersistentType = getEntityMappings().addPersistentType(MappingKeys.ENTITY_TYPE_MAPPING_KEY, FULLY_QUALIFIED_TYPE_NAME);
- OrmPersistentAttribute ormPersistentAttribute = ormPersistentType.addSpecifiedPersistentAttribute(MappingKeys.ONE_TO_MANY_ATTRIBUTE_MAPPING_KEY, "oneToMany");
-
- OneToManyMapping oneToManyMapping = (OneToManyMapping) ormPersistentAttribute.getMapping();
- assertFalse(oneToManyMapping.isDefault());
- oneToManyMapping.setSpecifiedFetch(FetchType.EAGER);
- oneToManyMapping.setSpecifiedTargetEntity("TargetEntity");
- oneToManyMapping.setOrderBy("customOrder");
- oneToManyMapping.setMapKey("mapKey");
- oneToManyMapping.getRelationshipReference().getJoinTableJoiningStrategy().getJoinTable().setSpecifiedName("MY_JOIN_TABLE");
- JoinColumn joinColumn = oneToManyMapping.getRelationshipReference().getJoinTableJoiningStrategy().getJoinTable().addSpecifiedJoinColumn(0);
- joinColumn.setSpecifiedName("name");
- joinColumn.setSpecifiedReferencedColumnName("referenceName");
- JoinColumn inverseJoinColumn = oneToManyMapping.getRelationshipReference().getJoinTableJoiningStrategy().getJoinTable().addSpecifiedInverseJoinColumn(0);
- inverseJoinColumn.setSpecifiedName("inverseName");
- inverseJoinColumn.setSpecifiedReferencedColumnName("inverseReferenceName");
- assertFalse(oneToManyMapping.isDefault());
-
- ormPersistentAttribute.setSpecifiedMappingKey(MappingKeys.VERSION_ATTRIBUTE_MAPPING_KEY);
- assertEquals(1, ormPersistentType.specifiedAttributesSize());
- assertEquals(ormPersistentAttribute, ormPersistentType.specifiedAttributes().next());
- assertTrue(ormPersistentAttribute.getMapping() instanceof VersionMapping);
- assertEquals("oneToMany", ormPersistentAttribute.getMapping().getName());
- }
-
- public void testOneToManyMorphToTransientMapping() throws Exception {
- OrmPersistentType ormPersistentType = getEntityMappings().addPersistentType(MappingKeys.ENTITY_TYPE_MAPPING_KEY, FULLY_QUALIFIED_TYPE_NAME);
- OrmPersistentAttribute ormPersistentAttribute = ormPersistentType.addSpecifiedPersistentAttribute(MappingKeys.ONE_TO_MANY_ATTRIBUTE_MAPPING_KEY, "oneToMany");
-
- OneToManyMapping oneToManyMapping = (OneToManyMapping) ormPersistentAttribute.getMapping();
- assertFalse(oneToManyMapping.isDefault());
- oneToManyMapping.setSpecifiedFetch(FetchType.EAGER);
- oneToManyMapping.setSpecifiedTargetEntity("TargetEntity");
- oneToManyMapping.setOrderBy("customOrder");
- oneToManyMapping.setMapKey("mapKey");
- oneToManyMapping.getRelationshipReference().getMappedByJoiningStrategy().setMappedByAttribute("mappedBy");
- assertFalse(oneToManyMapping.isDefault());
-
- ormPersistentAttribute.setSpecifiedMappingKey(MappingKeys.TRANSIENT_ATTRIBUTE_MAPPING_KEY);
- assertEquals(1, ormPersistentType.specifiedAttributesSize());
- assertEquals(ormPersistentAttribute, ormPersistentType.specifiedAttributes().next());
- assertTrue(ormPersistentAttribute.getMapping() instanceof TransientMapping);
- assertEquals("oneToMany", ormPersistentAttribute.getMapping().getName());
- }
-
- public void testOneToManyMorphToEmbeddedMapping() throws Exception {
- OrmPersistentType ormPersistentType = getEntityMappings().addPersistentType(MappingKeys.ENTITY_TYPE_MAPPING_KEY, FULLY_QUALIFIED_TYPE_NAME);
- OrmPersistentAttribute ormPersistentAttribute = ormPersistentType.addSpecifiedPersistentAttribute(MappingKeys.ONE_TO_MANY_ATTRIBUTE_MAPPING_KEY, "oneToMany");
-
- OneToManyMapping oneToManyMapping = (OneToManyMapping) ormPersistentAttribute.getMapping();
- assertFalse(oneToManyMapping.isDefault());
- oneToManyMapping.setSpecifiedFetch(FetchType.EAGER);
- oneToManyMapping.setSpecifiedTargetEntity("TargetEntity");
- oneToManyMapping.setOrderBy("customOrder");
- oneToManyMapping.setMapKey("mapKey");
- oneToManyMapping.getRelationshipReference().getJoinTableJoiningStrategy().getJoinTable().setSpecifiedName("MY_JOIN_TABLE");
- JoinColumn joinColumn = oneToManyMapping.getRelationshipReference().getJoinTableJoiningStrategy().getJoinTable().addSpecifiedJoinColumn(0);
- joinColumn.setSpecifiedName("name");
- joinColumn.setSpecifiedReferencedColumnName("referenceName");
- JoinColumn inverseJoinColumn = oneToManyMapping.getRelationshipReference().getJoinTableJoiningStrategy().getJoinTable().addSpecifiedInverseJoinColumn(0);
- inverseJoinColumn.setSpecifiedName("inverseName");
- inverseJoinColumn.setSpecifiedReferencedColumnName("inverseReferenceName");
- assertFalse(oneToManyMapping.isDefault());
-
- ormPersistentAttribute.setSpecifiedMappingKey(MappingKeys.EMBEDDED_ATTRIBUTE_MAPPING_KEY);
- assertEquals(1, ormPersistentType.specifiedAttributesSize());
- assertEquals(ormPersistentAttribute, ormPersistentType.specifiedAttributes().next());
- assertTrue(ormPersistentAttribute.getMapping() instanceof EmbeddedMapping);
- assertEquals("oneToMany", ormPersistentAttribute.getMapping().getName());
- }
-
- public void testOneToManyMorphToEmbeddedIdMapping() throws Exception {
- OrmPersistentType ormPersistentType = getEntityMappings().addPersistentType(MappingKeys.ENTITY_TYPE_MAPPING_KEY, FULLY_QUALIFIED_TYPE_NAME);
- OrmPersistentAttribute ormPersistentAttribute = ormPersistentType.addSpecifiedPersistentAttribute(MappingKeys.ONE_TO_MANY_ATTRIBUTE_MAPPING_KEY, "oneToMany");
-
- OneToManyMapping oneToManyMapping = (OneToManyMapping) ormPersistentAttribute.getMapping();
- assertFalse(oneToManyMapping.isDefault());
- oneToManyMapping.setSpecifiedFetch(FetchType.EAGER);
- oneToManyMapping.setSpecifiedTargetEntity("TargetEntity");
- oneToManyMapping.setOrderBy("customOrder");
- oneToManyMapping.setMapKey("mapKey");
- oneToManyMapping.getRelationshipReference().getMappedByJoiningStrategy().setMappedByAttribute("mappedBy");
- assertFalse(oneToManyMapping.isDefault());
-
- ormPersistentAttribute.setSpecifiedMappingKey(MappingKeys.EMBEDDED_ID_ATTRIBUTE_MAPPING_KEY);
- assertEquals(1, ormPersistentType.specifiedAttributesSize());
- assertEquals(ormPersistentAttribute, ormPersistentType.specifiedAttributes().next());
- assertTrue(ormPersistentAttribute.getMapping() instanceof EmbeddedIdMapping);
- assertEquals("oneToMany", ormPersistentAttribute.getMapping().getName());
- }
-
- public void testOneToManyMorphToOneToOneMapping() throws Exception {
- OrmPersistentType ormPersistentType = getEntityMappings().addPersistentType(MappingKeys.ENTITY_TYPE_MAPPING_KEY, FULLY_QUALIFIED_TYPE_NAME);
- OrmPersistentAttribute ormPersistentAttribute = ormPersistentType.addSpecifiedPersistentAttribute(MappingKeys.ONE_TO_MANY_ATTRIBUTE_MAPPING_KEY, "oneToMany");
-
- OneToManyMapping oneToManyMapping = (OneToManyMapping) ormPersistentAttribute.getMapping();
- assertFalse(oneToManyMapping.isDefault());
- oneToManyMapping.setSpecifiedFetch(FetchType.EAGER);
- oneToManyMapping.setSpecifiedTargetEntity("TargetEntity");
- oneToManyMapping.setOrderBy("customOrder");
- oneToManyMapping.setMapKey("mapKey");
- oneToManyMapping.getRelationshipReference().getMappedByJoiningStrategy().setMappedByAttribute("mappedBy");
- oneToManyMapping.getCascade().setAll(true);
- oneToManyMapping.getCascade().setMerge(true);
- oneToManyMapping.getCascade().setPersist(true);
- oneToManyMapping.getCascade().setRefresh(true);
- oneToManyMapping.getCascade().setRemove(true);
- assertFalse(oneToManyMapping.isDefault());
-
- ormPersistentAttribute.setSpecifiedMappingKey(MappingKeys.ONE_TO_ONE_ATTRIBUTE_MAPPING_KEY);
- assertEquals(1, ormPersistentType.specifiedAttributesSize());
- assertEquals(ormPersistentAttribute, ormPersistentType.specifiedAttributes().next());
- assertTrue(ormPersistentAttribute.getMapping() instanceof OneToOneMapping);
- assertEquals("oneToMany", ormPersistentAttribute.getMapping().getName());
- assertEquals(FetchType.EAGER, ((OneToOneMapping) ormPersistentAttribute.getMapping()).getSpecifiedFetch());
- assertEquals("TargetEntity", ((OneToOneMapping) ormPersistentAttribute.getMapping()).getSpecifiedTargetEntity());
- assertEquals("mappedBy", ((OneToOneMapping) ormPersistentAttribute.getMapping()).getRelationshipReference().getMappedByJoiningStrategy().getMappedByAttribute());
- assertTrue(((OneToOneMapping) ormPersistentAttribute.getMapping()).getCascade().isAll());
- assertTrue(((OneToOneMapping) ormPersistentAttribute.getMapping()).getCascade().isMerge());
- assertTrue(((OneToOneMapping) ormPersistentAttribute.getMapping()).getCascade().isPersist());
- assertTrue(((OneToOneMapping) ormPersistentAttribute.getMapping()).getCascade().isRefresh());
- assertTrue(((OneToOneMapping) ormPersistentAttribute.getMapping()).getCascade().isRemove());
- }
-
- public void testOneToManyMorphToManyToManyMapping() throws Exception {
- OrmPersistentType ormPersistentType = getEntityMappings().addPersistentType(MappingKeys.ENTITY_TYPE_MAPPING_KEY, FULLY_QUALIFIED_TYPE_NAME);
- OrmPersistentAttribute ormPersistentAttribute = ormPersistentType.addSpecifiedPersistentAttribute(MappingKeys.ONE_TO_MANY_ATTRIBUTE_MAPPING_KEY, "oneToMany");
-
- OneToManyMapping oneToManyMapping = (OneToManyMapping) ormPersistentAttribute.getMapping();
- assertFalse(oneToManyMapping.isDefault());
- oneToManyMapping.setSpecifiedFetch(FetchType.EAGER);
- oneToManyMapping.setSpecifiedTargetEntity("TargetEntity");
- oneToManyMapping.setOrderBy("customOrder");
- oneToManyMapping.setMapKey("mapKey");
- oneToManyMapping.getCascade().setAll(true);
- oneToManyMapping.getCascade().setMerge(true);
- oneToManyMapping.getCascade().setPersist(true);
- oneToManyMapping.getCascade().setRefresh(true);
- oneToManyMapping.getCascade().setRemove(true);
- oneToManyMapping.getRelationshipReference().getJoinTableJoiningStrategy().getJoinTable().setSpecifiedName("MY_JOIN_TABLE");
- JoinColumn joinColumn = oneToManyMapping.getRelationshipReference().getJoinTableJoiningStrategy().getJoinTable().addSpecifiedJoinColumn(0);
- joinColumn.setSpecifiedName("name");
- joinColumn.setSpecifiedReferencedColumnName("referenceName");
- JoinColumn inverseJoinColumn = oneToManyMapping.getRelationshipReference().getJoinTableJoiningStrategy().getJoinTable().addSpecifiedInverseJoinColumn(0);
- inverseJoinColumn.setSpecifiedName("inverseName");
- inverseJoinColumn.setSpecifiedReferencedColumnName("inverseReferenceName");
- assertFalse(oneToManyMapping.isDefault());
-
- ormPersistentAttribute.setSpecifiedMappingKey(MappingKeys.MANY_TO_MANY_ATTRIBUTE_MAPPING_KEY);
- assertEquals(1, ormPersistentType.specifiedAttributesSize());
- assertEquals(ormPersistentAttribute, ormPersistentType.specifiedAttributes().next());
- assertTrue(ormPersistentAttribute.getMapping() instanceof ManyToManyMapping);
- assertEquals("oneToMany", ormPersistentAttribute.getMapping().getName());
- assertEquals(FetchType.EAGER, ((ManyToManyMapping) ormPersistentAttribute.getMapping()).getSpecifiedFetch());
- assertEquals("TargetEntity", ((ManyToManyMapping) ormPersistentAttribute.getMapping()).getSpecifiedTargetEntity());
- assertTrue(((ManyToManyMapping) ormPersistentAttribute.getMapping()).getCascade().isAll());
- assertTrue(((ManyToManyMapping) ormPersistentAttribute.getMapping()).getCascade().isMerge());
- assertTrue(((ManyToManyMapping) ormPersistentAttribute.getMapping()).getCascade().isPersist());
- assertTrue(((ManyToManyMapping) ormPersistentAttribute.getMapping()).getCascade().isRefresh());
- assertTrue(((ManyToManyMapping) ormPersistentAttribute.getMapping()).getCascade().isRemove());
- JoinTable joinTable = ((ManyToManyMapping) ormPersistentAttribute.getMapping()).getRelationshipReference().getJoinTableJoiningStrategy().getJoinTable();
- assertEquals("MY_JOIN_TABLE", joinTable.getName());
- assertEquals("name", joinTable.joinColumns().next().getSpecifiedName());
- assertEquals("referenceName", joinTable.joinColumns().next().getSpecifiedReferencedColumnName());
- assertEquals("inverseName", joinTable.inverseJoinColumns().next().getSpecifiedName());
- assertEquals("inverseReferenceName", joinTable.inverseJoinColumns().next().getSpecifiedReferencedColumnName());
- }
-
- public void testOneToManyMorphToManyToOneMapping() throws Exception {
- OrmPersistentType ormPersistentType = getEntityMappings().addPersistentType(MappingKeys.ENTITY_TYPE_MAPPING_KEY, FULLY_QUALIFIED_TYPE_NAME);
- OrmPersistentAttribute ormPersistentAttribute = ormPersistentType.addSpecifiedPersistentAttribute(MappingKeys.ONE_TO_MANY_ATTRIBUTE_MAPPING_KEY, "oneToMany");
-
- OneToManyMapping oneToManyMapping = (OneToManyMapping) ormPersistentAttribute.getMapping();
- assertFalse(oneToManyMapping.isDefault());
- oneToManyMapping.setSpecifiedFetch(FetchType.EAGER);
- oneToManyMapping.setSpecifiedTargetEntity("TargetEntity");
- oneToManyMapping.setOrderBy("customOrder");
- oneToManyMapping.setMapKey("mapKey");
- oneToManyMapping.getRelationshipReference().getMappedByJoiningStrategy().setMappedByAttribute("mappedBy");
- oneToManyMapping.getCascade().setAll(true);
- oneToManyMapping.getCascade().setMerge(true);
- oneToManyMapping.getCascade().setPersist(true);
- oneToManyMapping.getCascade().setRefresh(true);
- oneToManyMapping.getCascade().setRemove(true);
- assertFalse(oneToManyMapping.isDefault());
-
- ormPersistentAttribute.setSpecifiedMappingKey(MappingKeys.MANY_TO_ONE_ATTRIBUTE_MAPPING_KEY);
- assertEquals(1, ormPersistentType.specifiedAttributesSize());
- assertEquals(ormPersistentAttribute, ormPersistentType.specifiedAttributes().next());
- assertTrue(ormPersistentAttribute.getMapping() instanceof ManyToOneMapping);
- assertEquals("oneToMany", ormPersistentAttribute.getMapping().getName());
- assertEquals(FetchType.EAGER, ((ManyToOneMapping) ormPersistentAttribute.getMapping()).getSpecifiedFetch());
- assertEquals("TargetEntity", ((ManyToOneMapping) ormPersistentAttribute.getMapping()).getSpecifiedTargetEntity());
- assertTrue(((ManyToOneMapping) ormPersistentAttribute.getMapping()).getCascade().isAll());
- assertTrue(((ManyToOneMapping) ormPersistentAttribute.getMapping()).getCascade().isMerge());
- assertTrue(((ManyToOneMapping) ormPersistentAttribute.getMapping()).getCascade().isPersist());
- assertTrue(((ManyToOneMapping) ormPersistentAttribute.getMapping()).getCascade().isRefresh());
- assertTrue(((ManyToOneMapping) ormPersistentAttribute.getMapping()).getCascade().isRemove());
- }
-
- public void testOneToManyMorphToBasicMapping() throws Exception {
- OrmPersistentType ormPersistentType = getEntityMappings().addPersistentType(MappingKeys.ENTITY_TYPE_MAPPING_KEY, FULLY_QUALIFIED_TYPE_NAME);
- OrmPersistentAttribute ormPersistentAttribute = ormPersistentType.addSpecifiedPersistentAttribute(MappingKeys.ONE_TO_MANY_ATTRIBUTE_MAPPING_KEY, "oneToMany");
-
- OneToManyMapping oneToManyMapping = (OneToManyMapping) ormPersistentAttribute.getMapping();
- assertFalse(oneToManyMapping.isDefault());
- oneToManyMapping.setSpecifiedFetch(FetchType.EAGER);
- oneToManyMapping.setSpecifiedTargetEntity("TargetEntity");
- oneToManyMapping.setOrderBy("customOrder");
- oneToManyMapping.setMapKey("mapKey");
- oneToManyMapping.getRelationshipReference().getMappedByJoiningStrategy().setMappedByAttribute("mappedBy");
- oneToManyMapping.getCascade().setAll(true);
- oneToManyMapping.getCascade().setMerge(true);
- oneToManyMapping.getCascade().setPersist(true);
- oneToManyMapping.getCascade().setRefresh(true);
- oneToManyMapping.getCascade().setRemove(true);
- assertFalse(oneToManyMapping.isDefault());
-
- ormPersistentAttribute.setSpecifiedMappingKey(MappingKeys.BASIC_ATTRIBUTE_MAPPING_KEY);
- assertEquals(1, ormPersistentType.specifiedAttributesSize());
- assertEquals(ormPersistentAttribute, ormPersistentType.specifiedAttributes().next());
- assertTrue(ormPersistentAttribute.getMapping() instanceof BasicMapping);
- assertEquals("oneToMany", ormPersistentAttribute.getMapping().getName());
-//TODO assertEquals(FetchType.EAGER, ((IBasicMapping) ormPersistentAttribute.getMapping()).getSpecifiedFetch());
- }
-} \ No newline at end of file
diff --git a/jpa/tests/org.eclipse.jpt.core.tests/src/org/eclipse/jpt/core/tests/internal/context/orm/OrmOneToOneMappingTests.java b/jpa/tests/org.eclipse.jpt.core.tests/src/org/eclipse/jpt/core/tests/internal/context/orm/OrmOneToOneMappingTests.java
deleted file mode 100644
index 601cf627cf..0000000000
--- a/jpa/tests/org.eclipse.jpt.core.tests/src/org/eclipse/jpt/core/tests/internal/context/orm/OrmOneToOneMappingTests.java
+++ /dev/null
@@ -1,969 +0,0 @@
-/*******************************************************************************
- * Copyright (c) 2007, 2009 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.
- *
- * Contributors:
- * Oracle - initial API and implementation
- ******************************************************************************/
-package org.eclipse.jpt.core.tests.internal.context.orm;
-
-import java.util.Iterator;
-import java.util.ListIterator;
-import org.eclipse.jdt.core.ICompilationUnit;
-import org.eclipse.jpt.core.JptCorePlugin;
-import org.eclipse.jpt.core.MappingKeys;
-import org.eclipse.jpt.core.context.BasicMapping;
-import org.eclipse.jpt.core.context.Cascade;
-import org.eclipse.jpt.core.context.EmbeddedIdMapping;
-import org.eclipse.jpt.core.context.EmbeddedMapping;
-import org.eclipse.jpt.core.context.FetchType;
-import org.eclipse.jpt.core.context.IdMapping;
-import org.eclipse.jpt.core.context.JoinColumn;
-import org.eclipse.jpt.core.context.ManyToManyMapping;
-import org.eclipse.jpt.core.context.ManyToOneMapping;
-import org.eclipse.jpt.core.context.MappedByJoiningStrategy;
-import org.eclipse.jpt.core.context.OneToManyMapping;
-import org.eclipse.jpt.core.context.OneToOneMapping;
-import org.eclipse.jpt.core.context.TransientMapping;
-import org.eclipse.jpt.core.context.VersionMapping;
-import org.eclipse.jpt.core.context.orm.OrmJoinColumn;
-import org.eclipse.jpt.core.context.orm.OrmJoinColumnJoiningStrategy;
-import org.eclipse.jpt.core.context.orm.OrmOneToOneMapping;
-import org.eclipse.jpt.core.context.orm.OrmPersistentAttribute;
-import org.eclipse.jpt.core.context.orm.OrmPersistentType;
-import org.eclipse.jpt.core.context.orm.OrmPrimaryKeyJoinColumn;
-import org.eclipse.jpt.core.context.orm.OrmPrimaryKeyJoinColumnJoiningStrategy;
-import org.eclipse.jpt.core.resource.java.JPA;
-import org.eclipse.jpt.core.resource.orm.XmlOneToOne;
-import org.eclipse.jpt.core.resource.persistence.PersistenceFactory;
-import org.eclipse.jpt.core.resource.persistence.XmlMappingFileRef;
-import org.eclipse.jpt.core.tests.internal.context.ContextModelTestCase;
-import org.eclipse.jpt.core.tests.internal.projects.TestJavaProject.SourceWriter;
-import org.eclipse.jpt.utility.internal.iterators.ArrayIterator;
-
-@SuppressWarnings("nls")
-public class OrmOneToOneMappingTests extends ContextModelTestCase
-{
- public OrmOneToOneMappingTests(String name) {
- super(name);
- }
-
- @Override
- protected void setUp() throws Exception {
- super.setUp();
- XmlMappingFileRef mappingFileRef = PersistenceFactory.eINSTANCE.createXmlMappingFileRef();
- mappingFileRef.setFileName(JptCorePlugin.DEFAULT_ORM_XML_FILE_PATH);
- getXmlPersistenceUnit().getMappingFiles().add(mappingFileRef);
- getPersistenceXmlResource().save(null);
- }
-
- private ICompilationUnit createTestEntityOneToOneMapping() throws Exception {
- return this.createTestType(new DefaultAnnotationWriter() {
- @Override
- public Iterator<String> imports() {
- return new ArrayIterator<String>(JPA.ENTITY, JPA.ONE_TO_ONE, JPA.JOIN_COLUMN, JPA.FETCH_TYPE, JPA.CASCADE_TYPE);
- }
- @Override
- public void appendTypeAnnotationTo(StringBuilder sb) {
- sb.append("@Entity");
- }
-
- @Override
- public void appendIdFieldAnnotationTo(StringBuilder sb) {
- sb.append(CR);
- sb.append(" @OneToOne(fetch=FetchType.LAZY, optional=false, targetEntity=Address.class, cascade={CascadeType.ALL, CascadeType.PERSIST, CascadeType.MERGE, CascadeType.REMOVE, CascadeType.REFRESH})");
- sb.append(CR);
- sb.append(" @JoinColumn(name=\"MY_COLUMN\", referencedColumnName=\"MY_REFERENCED_COLUMN\", unique=true, nullable=false, insertable=false, updatable=false, columnDefinition=\"COLUMN_DEFINITION\", table=\"MY_TABLE\")");
- sb.append(CR);
- sb.append(" private Address address;").append(CR);
- sb.append(CR);
- sb.append(" @Id");
- }
- });
- }
-
- private void createTestTargetEntityAddress() throws Exception {
- SourceWriter sourceWriter = new SourceWriter() {
- public void appendSourceTo(StringBuilder sb) {
- sb.append(CR);
- sb.append("import ");
- sb.append(JPA.ENTITY);
- sb.append(";");
- sb.append(CR);
- sb.append("import ");
- sb.append(JPA.ID);
- sb.append(";");
- sb.append(CR);
- sb.append(CR);
- sb.append("@Entity");
- sb.append(CR);
- sb.append("public class ").append("Address").append(" ");
- sb.append("{").append(CR);
- sb.append(CR);
- sb.append(" @Id").append(CR);
- sb.append(" private int id;").append(CR);
- sb.append(CR);
- sb.append(" private String city;").append(CR);
- sb.append(CR);
- sb.append(" private String state;").append(CR);
- sb.append(CR);
- sb.append(" private int zip;").append(CR);
- sb.append(CR);
- sb.append("}").append(CR);
- }
- };
- this.javaProject.createCompilationUnit(PACKAGE_NAME, "Address.java", sourceWriter);
- }
-
- public void testUpdateName() throws Exception {
- OrmPersistentType ormPersistentType = getEntityMappings().addPersistentType(MappingKeys.ENTITY_TYPE_MAPPING_KEY, "model.Foo");
- OrmPersistentAttribute ormPersistentAttribute = ormPersistentType.addSpecifiedPersistentAttribute(MappingKeys.ONE_TO_ONE_ATTRIBUTE_MAPPING_KEY, "oneToOneMapping");
- OrmOneToOneMapping ormOneToOneMapping = (OrmOneToOneMapping) ormPersistentAttribute.getMapping();
- XmlOneToOne oneToOne = getXmlEntityMappings().getEntities().get(0).getAttributes().getOneToOnes().get(0);
-
- assertEquals("oneToOneMapping", ormOneToOneMapping.getName());
- assertEquals("oneToOneMapping", oneToOne.getName());
-
- //set name in the resource model, verify context model updated
- oneToOne.setName("newName");
- assertEquals("newName", ormOneToOneMapping.getName());
- assertEquals("newName", oneToOne.getName());
-
- //set name to null in the resource model
- oneToOne.setName(null);
- assertNull(ormOneToOneMapping.getName());
- assertNull(oneToOne.getName());
- }
-
- public void testModifyName() throws Exception {
- OrmPersistentType ormPersistentType = getEntityMappings().addPersistentType(MappingKeys.ENTITY_TYPE_MAPPING_KEY, "model.Foo");
- OrmPersistentAttribute ormPersistentAttribute = ormPersistentType.addSpecifiedPersistentAttribute(MappingKeys.ONE_TO_ONE_ATTRIBUTE_MAPPING_KEY, "oneToOneMapping");
- OrmOneToOneMapping ormOneToOneMapping = (OrmOneToOneMapping) ormPersistentAttribute.getMapping();
- XmlOneToOne oneToOne = getXmlEntityMappings().getEntities().get(0).getAttributes().getOneToOnes().get(0);
-
- assertEquals("oneToOneMapping", ormOneToOneMapping.getName());
- assertEquals("oneToOneMapping", oneToOne.getName());
-
- //set name in the context model, verify resource model updated
- ormOneToOneMapping.setName("newName");
- assertEquals("newName", ormOneToOneMapping.getName());
- assertEquals("newName", oneToOne.getName());
-
- //set name to null in the context model
- ormOneToOneMapping.setName(null);
- assertNull(ormOneToOneMapping.getName());
- assertNull(oneToOne.getName());
- }
-
- public void testUpdateSpecifiedTargetEntity() throws Exception {
- OrmPersistentType ormPersistentType = getEntityMappings().addPersistentType(MappingKeys.ENTITY_TYPE_MAPPING_KEY, "model.Foo");
- OrmPersistentAttribute ormPersistentAttribute = ormPersistentType.addSpecifiedPersistentAttribute(MappingKeys.ONE_TO_ONE_ATTRIBUTE_MAPPING_KEY, "oneToOneMapping");
- OrmOneToOneMapping ormOneToOneMapping = (OrmOneToOneMapping) ormPersistentAttribute.getMapping();
- XmlOneToOne oneToOne = getXmlEntityMappings().getEntities().get(0).getAttributes().getOneToOnes().get(0);
-
- assertNull(ormOneToOneMapping.getSpecifiedTargetEntity());
- assertNull(oneToOne.getTargetEntity());
-
- //set target entity in the resource model, verify context model updated
- oneToOne.setTargetEntity("newTargetEntity");
- assertEquals("newTargetEntity", ormOneToOneMapping.getSpecifiedTargetEntity());
- assertEquals("newTargetEntity", oneToOne.getTargetEntity());
-
- //set target entity to null in the resource model
- oneToOne.setTargetEntity(null);
- assertNull(ormOneToOneMapping.getSpecifiedTargetEntity());
- assertNull(oneToOne.getTargetEntity());
- }
-
- public void testModifySpecifiedTargetEntity() throws Exception {
- OrmPersistentType ormPersistentType = getEntityMappings().addPersistentType(MappingKeys.ENTITY_TYPE_MAPPING_KEY, "model.Foo");
- OrmPersistentAttribute ormPersistentAttribute = ormPersistentType.addSpecifiedPersistentAttribute(MappingKeys.ONE_TO_ONE_ATTRIBUTE_MAPPING_KEY, "oneToOneMapping");
- OrmOneToOneMapping ormOneToOneMapping = (OrmOneToOneMapping) ormPersistentAttribute.getMapping();
- XmlOneToOne oneToOne = getXmlEntityMappings().getEntities().get(0).getAttributes().getOneToOnes().get(0);
-
- assertNull(ormOneToOneMapping.getSpecifiedTargetEntity());
- assertNull(oneToOne.getTargetEntity());
-
- //set target entity in the context model, verify resource model updated
- ormOneToOneMapping.setSpecifiedTargetEntity("newTargetEntity");
- assertEquals("newTargetEntity", ormOneToOneMapping.getSpecifiedTargetEntity());
- assertEquals("newTargetEntity", oneToOne.getTargetEntity());
-
- //set target entity to null in the context model
- ormOneToOneMapping.setSpecifiedTargetEntity(null);
- assertNull(ormOneToOneMapping.getSpecifiedTargetEntity());
- assertNull(oneToOne.getTargetEntity());
- }
-
- public void testUpdateSpecifiedFetch() throws Exception {
- OrmPersistentType ormPersistentType = getEntityMappings().addPersistentType(MappingKeys.ENTITY_TYPE_MAPPING_KEY, "model.Foo");
- OrmPersistentAttribute ormPersistentAttribute = ormPersistentType.addSpecifiedPersistentAttribute(MappingKeys.ONE_TO_ONE_ATTRIBUTE_MAPPING_KEY, "oneToOneMapping");
- OrmOneToOneMapping ormOneToOneMapping = (OrmOneToOneMapping) ormPersistentAttribute.getMapping();
- XmlOneToOne oneToOneResource = getXmlEntityMappings().getEntities().get(0).getAttributes().getOneToOnes().get(0);
-
- assertNull(ormOneToOneMapping.getSpecifiedFetch());
- assertNull(oneToOneResource.getFetch());
-
- //set fetch in the resource model, verify context model updated
- oneToOneResource.setFetch(org.eclipse.jpt.core.resource.orm.FetchType.EAGER);
- assertEquals(FetchType.EAGER, ormOneToOneMapping.getSpecifiedFetch());
- assertEquals(org.eclipse.jpt.core.resource.orm.FetchType.EAGER, oneToOneResource.getFetch());
-
- oneToOneResource.setFetch(org.eclipse.jpt.core.resource.orm.FetchType.LAZY);
- assertEquals(FetchType.LAZY, ormOneToOneMapping.getSpecifiedFetch());
- assertEquals(org.eclipse.jpt.core.resource.orm.FetchType.LAZY, oneToOneResource.getFetch());
-
- //set fetch to null in the resource model
- oneToOneResource.setFetch(null);
- assertNull(ormOneToOneMapping.getSpecifiedFetch());
- assertNull(oneToOneResource.getFetch());
- }
-
- public void testModifySpecifiedFetch() throws Exception {
- OrmPersistentType ormPersistentType = getEntityMappings().addPersistentType(MappingKeys.ENTITY_TYPE_MAPPING_KEY, "model.Foo");
- OrmPersistentAttribute ormPersistentAttribute = ormPersistentType.addSpecifiedPersistentAttribute(MappingKeys.ONE_TO_ONE_ATTRIBUTE_MAPPING_KEY, "oneToOneMapping");
- OrmOneToOneMapping ormOneToOneMapping = (OrmOneToOneMapping) ormPersistentAttribute.getMapping();
- XmlOneToOne oneToOneResource = getXmlEntityMappings().getEntities().get(0).getAttributes().getOneToOnes().get(0);
-
- assertNull(ormOneToOneMapping.getSpecifiedFetch());
- assertNull(oneToOneResource.getFetch());
-
- //set fetch in the context model, verify resource model updated
- ormOneToOneMapping.setSpecifiedFetch(FetchType.EAGER);
- assertEquals(org.eclipse.jpt.core.resource.orm.FetchType.EAGER, oneToOneResource.getFetch());
- assertEquals(FetchType.EAGER, ormOneToOneMapping.getSpecifiedFetch());
-
- ormOneToOneMapping.setSpecifiedFetch(FetchType.LAZY);
- assertEquals(org.eclipse.jpt.core.resource.orm.FetchType.LAZY, oneToOneResource.getFetch());
- assertEquals(FetchType.LAZY, ormOneToOneMapping.getSpecifiedFetch());
-
- //set fetch to null in the context model
- ormOneToOneMapping.setSpecifiedFetch(null);
- assertNull(oneToOneResource.getFetch());
- assertNull(ormOneToOneMapping.getSpecifiedFetch());
- }
-
- public void testUpdateMappedBy() throws Exception {
- OrmPersistentType ormPersistentType = getEntityMappings().addPersistentType(MappingKeys.ENTITY_TYPE_MAPPING_KEY, "model.Foo");
- OrmPersistentAttribute ormPersistentAttribute = ormPersistentType.addSpecifiedPersistentAttribute(MappingKeys.ONE_TO_ONE_ATTRIBUTE_MAPPING_KEY, "oneToOneMapping");
- OrmOneToOneMapping ormOneToOneMapping = (OrmOneToOneMapping) ormPersistentAttribute.getMapping();
- MappedByJoiningStrategy strategy = ormOneToOneMapping.getRelationshipReference().getMappedByJoiningStrategy();
- XmlOneToOne oneToOne = getXmlEntityMappings().getEntities().get(0).getAttributes().getOneToOnes().get(0);
-
- assertNull(strategy.getMappedByAttribute());
- assertNull(oneToOne.getMappedBy());
-
- //set mappedBy in the resource model, verify context model updated
- oneToOne.setMappedBy("newMappedBy");
- assertEquals("newMappedBy", strategy.getMappedByAttribute());
- assertEquals("newMappedBy", oneToOne.getMappedBy());
-
- //set mappedBy to null in the resource model
- oneToOne.setMappedBy(null);
- assertNull(strategy.getMappedByAttribute());
- assertNull(oneToOne.getMappedBy());
- }
-
- public void testModifyMappedBy() throws Exception {
- OrmPersistentType ormPersistentType = getEntityMappings().addPersistentType(MappingKeys.ENTITY_TYPE_MAPPING_KEY, "model.Foo");
- OrmPersistentAttribute ormPersistentAttribute = ormPersistentType.addSpecifiedPersistentAttribute(MappingKeys.ONE_TO_ONE_ATTRIBUTE_MAPPING_KEY, "oneToOneMapping");
- OrmOneToOneMapping ormOneToOneMapping = (OrmOneToOneMapping) ormPersistentAttribute.getMapping();
- MappedByJoiningStrategy strategy = ormOneToOneMapping.getRelationshipReference().getMappedByJoiningStrategy();
- XmlOneToOne oneToOne = getXmlEntityMappings().getEntities().get(0).getAttributes().getOneToOnes().get(0);
-
- assertNull(strategy.getMappedByAttribute());
- assertNull(oneToOne.getMappedBy());
-
- //set mappedBy in the context model, verify resource model updated
- strategy.setMappedByAttribute("newMappedBy");
- assertEquals("newMappedBy", strategy.getMappedByAttribute());
- assertEquals("newMappedBy", oneToOne.getMappedBy());
-
- //set mappedBy to null in the context model
- strategy.setMappedByAttribute(null);
- assertNull(strategy.getMappedByAttribute());
- assertNull(oneToOne.getMappedBy());
- }
-
-
- public void testUpdateSpecifiedOptional() throws Exception {
- OrmPersistentType ormPersistentType = getEntityMappings().addPersistentType(MappingKeys.ENTITY_TYPE_MAPPING_KEY, "model.Foo");
- OrmPersistentAttribute ormPersistentAttribute = ormPersistentType.addSpecifiedPersistentAttribute(MappingKeys.ONE_TO_ONE_ATTRIBUTE_MAPPING_KEY, "oneToOneMapping");
- OrmOneToOneMapping ormOneToOneMapping = (OrmOneToOneMapping) ormPersistentAttribute.getMapping();
- XmlOneToOne oneToOneResource = getXmlEntityMappings().getEntities().get(0).getAttributes().getOneToOnes().get(0);
-
- assertNull(ormOneToOneMapping.getSpecifiedOptional());
- assertNull(oneToOneResource.getOptional());
-
- //set optional in the resource model, verify context model updated
- oneToOneResource.setOptional(Boolean.TRUE);
- assertEquals(Boolean.TRUE, ormOneToOneMapping.getSpecifiedOptional());
- assertEquals(Boolean.TRUE, oneToOneResource.getOptional());
-
- oneToOneResource.setOptional(Boolean.FALSE);
- assertEquals(Boolean.FALSE, ormOneToOneMapping.getSpecifiedOptional());
- assertEquals(Boolean.FALSE, oneToOneResource.getOptional());
-
- //set optional to null in the resource model
- oneToOneResource.setOptional(null);
- assertNull(ormOneToOneMapping.getSpecifiedOptional());
- assertNull(oneToOneResource.getOptional());
- }
-
- public void testModifySpecifiedOptional() throws Exception {
- OrmPersistentType ormPersistentType = getEntityMappings().addPersistentType(MappingKeys.ENTITY_TYPE_MAPPING_KEY, "model.Foo");
- OrmPersistentAttribute ormPersistentAttribute = ormPersistentType.addSpecifiedPersistentAttribute(MappingKeys.ONE_TO_ONE_ATTRIBUTE_MAPPING_KEY, "oneToOneMapping");
- OrmOneToOneMapping ormOneToOneMapping = (OrmOneToOneMapping) ormPersistentAttribute.getMapping();
- XmlOneToOne oneToOneResource = getXmlEntityMappings().getEntities().get(0).getAttributes().getOneToOnes().get(0);
-
- assertNull(ormOneToOneMapping.getSpecifiedOptional());
- assertNull(oneToOneResource.getOptional());
-
- //set optional in the context model, verify resource model updated
- ormOneToOneMapping.setSpecifiedOptional(Boolean.TRUE);
- assertEquals(Boolean.TRUE, oneToOneResource.getOptional());
- assertEquals(Boolean.TRUE, ormOneToOneMapping.getSpecifiedOptional());
-
- ormOneToOneMapping.setSpecifiedOptional(Boolean.FALSE);
- assertEquals(Boolean.FALSE, oneToOneResource.getOptional());
- assertEquals(Boolean.FALSE, ormOneToOneMapping.getSpecifiedOptional());
-
- //set optional to null in the context model
- ormOneToOneMapping.setSpecifiedOptional(null);
- assertNull(oneToOneResource.getOptional());
- assertNull(ormOneToOneMapping.getSpecifiedOptional());
- }
-
- public void testAddSpecifiedJoinColumn() throws Exception {
- OrmPersistentType ormPersistentType = getEntityMappings().addPersistentType(MappingKeys.ENTITY_TYPE_MAPPING_KEY, "model.Foo");
- OrmPersistentAttribute ormPersistentAttribute = ormPersistentType.addSpecifiedPersistentAttribute(MappingKeys.ONE_TO_ONE_ATTRIBUTE_MAPPING_KEY, "oneToOneMapping");
- OrmOneToOneMapping ormOneToOneMapping = (OrmOneToOneMapping) ormPersistentAttribute.getMapping();
- OrmJoinColumnJoiningStrategy strategy = ormOneToOneMapping.getRelationshipReference().getJoinColumnJoiningStrategy();
- XmlOneToOne oneToOneResource = getXmlEntityMappings().getEntities().get(0).getAttributes().getOneToOnes().get(0);
-
- OrmJoinColumn joinColumn = strategy.addSpecifiedJoinColumn(0);
- joinColumn.setSpecifiedName("FOO");
-
- assertEquals("FOO", oneToOneResource.getJoinColumns().get(0).getName());
-
- OrmJoinColumn joinColumn2 = strategy.addSpecifiedJoinColumn(0);
- joinColumn2.setSpecifiedName("BAR");
-
- assertEquals("BAR", oneToOneResource.getJoinColumns().get(0).getName());
- assertEquals("FOO", oneToOneResource.getJoinColumns().get(1).getName());
-
- OrmJoinColumn joinColumn3 = strategy.addSpecifiedJoinColumn(1);
- joinColumn3.setSpecifiedName("BAZ");
-
- assertEquals("BAR", oneToOneResource.getJoinColumns().get(0).getName());
- assertEquals("BAZ", oneToOneResource.getJoinColumns().get(1).getName());
- assertEquals("FOO", oneToOneResource.getJoinColumns().get(2).getName());
-
- ListIterator<OrmJoinColumn> joinColumns = strategy.specifiedJoinColumns();
- assertEquals(joinColumn2, joinColumns.next());
- assertEquals(joinColumn3, joinColumns.next());
- assertEquals(joinColumn, joinColumns.next());
-
- joinColumns = strategy.specifiedJoinColumns();
- assertEquals("BAR", joinColumns.next().getName());
- assertEquals("BAZ", joinColumns.next().getName());
- assertEquals("FOO", joinColumns.next().getName());
- }
-
- public void testRemoveSpecifiedJoinColumn() throws Exception {
- OrmPersistentType ormPersistentType = getEntityMappings().addPersistentType(MappingKeys.ENTITY_TYPE_MAPPING_KEY, "model.Foo");
- OrmPersistentAttribute ormPersistentAttribute = ormPersistentType.addSpecifiedPersistentAttribute(MappingKeys.ONE_TO_ONE_ATTRIBUTE_MAPPING_KEY, "oneToOneMapping");
- OrmOneToOneMapping ormOneToOneMapping = (OrmOneToOneMapping) ormPersistentAttribute.getMapping();
- OrmJoinColumnJoiningStrategy strategy = ormOneToOneMapping.getRelationshipReference().getJoinColumnJoiningStrategy();
- XmlOneToOne oneToOneResource = getXmlEntityMappings().getEntities().get(0).getAttributes().getOneToOnes().get(0);
-
- strategy.addSpecifiedJoinColumn(0).setSpecifiedName("FOO");
- strategy.addSpecifiedJoinColumn(1).setSpecifiedName("BAR");
- strategy.addSpecifiedJoinColumn(2).setSpecifiedName("BAZ");
-
- assertEquals(3, oneToOneResource.getJoinColumns().size());
-
- strategy.removeSpecifiedJoinColumn(0);
- assertEquals(2, oneToOneResource.getJoinColumns().size());
- assertEquals("BAR", oneToOneResource.getJoinColumns().get(0).getName());
- assertEquals("BAZ", oneToOneResource.getJoinColumns().get(1).getName());
-
- strategy.removeSpecifiedJoinColumn(0);
- assertEquals(1, oneToOneResource.getJoinColumns().size());
- assertEquals("BAZ", oneToOneResource.getJoinColumns().get(0).getName());
-
- strategy.removeSpecifiedJoinColumn(0);
- assertEquals(0, oneToOneResource.getJoinColumns().size());
- }
-
- public void testMoveSpecifiedJoinColumn() throws Exception {
- OrmPersistentType ormPersistentType = getEntityMappings().addPersistentType(MappingKeys.ENTITY_TYPE_MAPPING_KEY, "model.Foo");
- OrmPersistentAttribute ormPersistentAttribute = ormPersistentType.addSpecifiedPersistentAttribute(MappingKeys.ONE_TO_ONE_ATTRIBUTE_MAPPING_KEY, "oneToOneMapping");
- OrmOneToOneMapping ormOneToOneMapping = (OrmOneToOneMapping) ormPersistentAttribute.getMapping();
- OrmJoinColumnJoiningStrategy strategy = ormOneToOneMapping.getRelationshipReference().getJoinColumnJoiningStrategy();
- XmlOneToOne oneToOneResource = getXmlEntityMappings().getEntities().get(0).getAttributes().getOneToOnes().get(0);
-
- strategy.addSpecifiedJoinColumn(0).setSpecifiedName("FOO");
- strategy.addSpecifiedJoinColumn(1).setSpecifiedName("BAR");
- strategy.addSpecifiedJoinColumn(2).setSpecifiedName("BAZ");
-
- assertEquals(3, oneToOneResource.getJoinColumns().size());
-
-
- strategy.moveSpecifiedJoinColumn(2, 0);
- ListIterator<OrmJoinColumn> joinColumns = strategy.specifiedJoinColumns();
- assertEquals("BAR", joinColumns.next().getName());
- assertEquals("BAZ", joinColumns.next().getName());
- assertEquals("FOO", joinColumns.next().getName());
-
- assertEquals("BAR", oneToOneResource.getJoinColumns().get(0).getName());
- assertEquals("BAZ", oneToOneResource.getJoinColumns().get(1).getName());
- assertEquals("FOO", oneToOneResource.getJoinColumns().get(2).getName());
-
-
- strategy.moveSpecifiedJoinColumn(0, 1);
- joinColumns = strategy.specifiedJoinColumns();
- assertEquals("BAZ", joinColumns.next().getName());
- assertEquals("BAR", joinColumns.next().getName());
- assertEquals("FOO", joinColumns.next().getName());
-
- assertEquals("BAZ", oneToOneResource.getJoinColumns().get(0).getName());
- assertEquals("BAR", oneToOneResource.getJoinColumns().get(1).getName());
- assertEquals("FOO", oneToOneResource.getJoinColumns().get(2).getName());
- }
-
- public void testOneToOneMappingNoUnderylingJavaAttribute() throws Exception {
- createTestEntityOneToOneMapping();
- createTestTargetEntityAddress();
-
- OrmPersistentType ormPersistentType = getEntityMappings().addPersistentType(MappingKeys.ENTITY_TYPE_MAPPING_KEY, FULLY_QUALIFIED_TYPE_NAME);
- getEntityMappings().addPersistentType(MappingKeys.ENTITY_TYPE_MAPPING_KEY, PACKAGE_NAME + ".Address");
- ormPersistentType.addSpecifiedPersistentAttribute(MappingKeys.ONE_TO_ONE_ATTRIBUTE_MAPPING_KEY, "foo");
- assertEquals(3, ormPersistentType.virtualAttributesSize());
-
- OrmPersistentAttribute ormPersistentAttribute = ormPersistentType.specifiedAttributes().next();
- OrmOneToOneMapping ormOneToOneMapping = (OrmOneToOneMapping) ormPersistentAttribute.getMapping();
-
- assertEquals("foo", ormOneToOneMapping.getName());
-
- assertNull(ormOneToOneMapping.getSpecifiedFetch());
- assertNull(ormOneToOneMapping.getSpecifiedOptional());
- assertNull(ormOneToOneMapping.getSpecifiedTargetEntity());
- assertEquals(FetchType.EAGER, ormOneToOneMapping.getFetch());
- assertEquals(true, ormOneToOneMapping.isOptional());
- assertNull(ormOneToOneMapping.getTargetEntity());
-
-
- assertTrue(ormOneToOneMapping.getRelationshipReference().getJoinColumnJoiningStrategy().joinColumnsSize() > 0);
- //TODO default joinColumns
- //assertTrue(ormOneToOneMapping.defaultJoinColumns().hasNext());
-
-
- Cascade cascade = ormOneToOneMapping.getCascade();
- assertFalse(cascade.isAll());
- assertFalse(cascade.isMerge());
- assertFalse(cascade.isPersist());
- assertFalse(cascade.isRemove());
- assertFalse(cascade.isRefresh());
- }
-
-
- public void testVirtualMappingMetadataCompleteFalse() throws Exception {
- createTestEntityOneToOneMapping();
- createTestTargetEntityAddress();
-
- OrmPersistentType ormPersistentType = getEntityMappings().addPersistentType(MappingKeys.ENTITY_TYPE_MAPPING_KEY, FULLY_QUALIFIED_TYPE_NAME);
- getEntityMappings().addPersistentType(MappingKeys.ENTITY_TYPE_MAPPING_KEY, PACKAGE_NAME + ".Address");
- assertEquals(3, ormPersistentType.virtualAttributesSize());
- OrmPersistentAttribute ormPersistentAttribute = ormPersistentType.virtualAttributes().next();
-
- OrmOneToOneMapping ormOneToOneMapping = (OrmOneToOneMapping) ormPersistentAttribute.getMapping();
- assertEquals("address", ormOneToOneMapping.getName());
- assertEquals(FetchType.LAZY, ormOneToOneMapping.getSpecifiedFetch());
- assertEquals(Boolean.FALSE, ormOneToOneMapping.getSpecifiedOptional());
- assertEquals("Address", ormOneToOneMapping.getSpecifiedTargetEntity());
- assertNull(ormOneToOneMapping.getRelationshipReference().
- getMappedByJoiningStrategy().getMappedByAttribute());
-
- OrmJoinColumn ormJoinColumn =
- ormOneToOneMapping.getRelationshipReference().getJoinColumnJoiningStrategy().specifiedJoinColumns().next();
- assertEquals("MY_COLUMN", ormJoinColumn.getSpecifiedName());
- assertEquals("MY_REFERENCED_COLUMN", ormJoinColumn.getSpecifiedReferencedColumnName());
- assertEquals(Boolean.TRUE, ormJoinColumn.getSpecifiedUnique());
- assertEquals(Boolean.FALSE, ormJoinColumn.getSpecifiedNullable());
- assertEquals(Boolean.FALSE, ormJoinColumn.getSpecifiedInsertable());
- assertEquals(Boolean.FALSE, ormJoinColumn.getSpecifiedUpdatable());
- assertEquals("COLUMN_DEFINITION", ormJoinColumn.getColumnDefinition());
- assertEquals("MY_TABLE", ormJoinColumn.getSpecifiedTable());
-
- Cascade cascade = ormOneToOneMapping.getCascade();
- assertTrue(cascade.isAll());
- assertTrue(cascade.isMerge());
- assertTrue(cascade.isPersist());
- assertTrue(cascade.isRemove());
- assertTrue(cascade.isRefresh());
- }
-
- public void testVirtualMappingMetadataCompleteTrue() throws Exception {
- createTestEntityOneToOneMapping();
- createTestTargetEntityAddress();
-
- OrmPersistentType ormPersistentType = getEntityMappings().addPersistentType(MappingKeys.ENTITY_TYPE_MAPPING_KEY, FULLY_QUALIFIED_TYPE_NAME);
- getEntityMappings().addPersistentType(MappingKeys.ENTITY_TYPE_MAPPING_KEY, PACKAGE_NAME + ".Address");
- ormPersistentType.getMapping().setSpecifiedMetadataComplete(Boolean.TRUE);
- assertEquals(3, ormPersistentType.virtualAttributesSize());
- OrmPersistentAttribute ormPersistentAttribute = ormPersistentType.virtualAttributes().next();
-
- assertEquals(MappingKeys.NULL_ATTRIBUTE_MAPPING_KEY, ormPersistentAttribute.getMappingKey());
-
- ormPersistentAttribute.makeSpecified(MappingKeys.ONE_TO_ONE_ATTRIBUTE_MAPPING_KEY);
- ormPersistentAttribute= ormPersistentType.specifiedAttributes().next();
-
- OrmOneToOneMapping ormOneToOneMapping = (OrmOneToOneMapping) ormPersistentAttribute.getMapping();
- assertEquals("address", ormOneToOneMapping.getName());
- assertEquals(FetchType.EAGER, ormOneToOneMapping.getFetch());
- assertEquals(true, ormOneToOneMapping.isOptional());
- assertEquals("test.Address", ormOneToOneMapping.getTargetEntity());
- assertNull(ormOneToOneMapping.getRelationshipReference().getMappedByJoiningStrategy().getMappedByAttribute());
-
- //TODO default join columns in xml one-to-one
-// XmlJoinColumn ormJoinColumn = ormOneToOneMapping.specifiedJoinColumns().next();
-// //TODO java default columns name in JavaSingleRelationshipMapping.JoinColumnOwner
-// //assertEquals("address", ormJoinColumn.getSpecifiedName());
-// //assertEquals("address", ormJoinColumn.getSpecifiedReferencedColumnName());
-// assertEquals(Boolean.FALSE, ormJoinColumn.getSpecifiedUnique());
-// assertEquals(Boolean.TRUE, ormJoinColumn.getSpecifiedNullable());
-// assertEquals(Boolean.TRUE, ormJoinColumn.getSpecifiedInsertable());
-// assertEquals(Boolean.TRUE, ormJoinColumn.getSpecifiedUpdatable());
-// assertNull(ormJoinColumn.getColumnDefinition());
-// assertEquals(TYPE_NAME, ormJoinColumn.getSpecifiedTable());
-
- Cascade cascade = ormOneToOneMapping.getCascade();
- assertFalse(cascade.isAll());
- assertFalse(cascade.isMerge());
- assertFalse(cascade.isPersist());
- assertFalse(cascade.isRemove());
- assertFalse(cascade.isRefresh());
- }
-
- public void testSpecifiedMapping() throws Exception {
- createTestEntityOneToOneMapping();
- createTestTargetEntityAddress();
-
- OrmPersistentType ormPersistentType = getEntityMappings().addPersistentType(MappingKeys.ENTITY_TYPE_MAPPING_KEY, FULLY_QUALIFIED_TYPE_NAME);
- getEntityMappings().addPersistentType(MappingKeys.ENTITY_TYPE_MAPPING_KEY, PACKAGE_NAME + ".Address");
-
- ormPersistentType.addSpecifiedPersistentAttribute(MappingKeys.ONE_TO_ONE_ATTRIBUTE_MAPPING_KEY, "address");
- assertEquals(2, ormPersistentType.virtualAttributesSize());
-
- OrmPersistentAttribute ormPersistentAttribute = ormPersistentType.specifiedAttributes().next();
- OrmOneToOneMapping ormOneToOneMapping = (OrmOneToOneMapping) ormPersistentAttribute.getMapping();
-
- assertEquals("address", ormOneToOneMapping.getName());
- assertNull(ormOneToOneMapping.getSpecifiedFetch());
- assertNull(ormOneToOneMapping.getSpecifiedOptional());
- assertNull(ormOneToOneMapping.getSpecifiedTargetEntity());
- assertNull(ormOneToOneMapping.getRelationshipReference().getMappedByJoiningStrategy().getMappedByAttribute());
- assertEquals(FetchType.EAGER, ormOneToOneMapping.getFetch());
- assertEquals(true, ormOneToOneMapping.isOptional());
- //TODO default target entity in xml
- //assertEquals("test.Address", ormOneToOneMapping.getDefaultTargetEntity());
-
- assertTrue(ormOneToOneMapping.getRelationshipReference().getJoinColumnJoiningStrategy().joinColumnsSize() > 0);
-
- //TODO default join columns for specified xmlOneToOne mapping
-// XmlJoinColumn ormJoinColumn = ormOneToOneMapping.defaultJoinColumns().next();
-// assertNull(ormJoinColumn.getSpecifiedName());
-// assertNull(ormJoinColumn.getSpecifiedReferencedColumnName());
-// assertNull(ormJoinColumn.getSpecifiedUnique());
-// assertNull(ormJoinColumn.getSpecifiedNullable());
-// assertNull(ormJoinColumn.getSpecifiedInsertable());
-// assertNull(ormJoinColumn.getSpecifiedUpdatable());
-// assertNull(ormJoinColumn.getColumnDefinition());
-// assertNull(ormJoinColumn.getSpecifiedTable());
-//
-// assertEquals("address", ormJoinColumn.getDefaultName());
-// assertEquals("address", ormJoinColumn.getDefaultReferencedColumnName());
-// assertEquals(Boolean.FALSE, ormJoinColumn.getDefaultUnique());
-// assertEquals(Boolean.TRUE, ormJoinColumn.getDefaultNullable());
-// assertEquals(Boolean.TRUE, ormJoinColumn.getDefaultInsertable());
-// assertEquals(Boolean.TRUE, ormJoinColumn.getDefaultUpdatable());
-// assertEquals(null, ormJoinColumn.getColumnDefinition());
-// assertEquals(TYPE_NAME, ormJoinColumn.getDefaultTable());
-
- Cascade cascade = ormOneToOneMapping.getCascade();
- assertFalse(cascade.isAll());
- assertFalse(cascade.isMerge());
- assertFalse(cascade.isPersist());
- assertFalse(cascade.isRemove());
- assertFalse(cascade.isRefresh());
- }
-
-
- public void testOneToOneMorphToIdMapping() throws Exception {
- OrmPersistentType ormPersistentType = getEntityMappings().addPersistentType(MappingKeys.ENTITY_TYPE_MAPPING_KEY, FULLY_QUALIFIED_TYPE_NAME);
- OrmPersistentAttribute ormPersistentAttribute = ormPersistentType.addSpecifiedPersistentAttribute(MappingKeys.ONE_TO_ONE_ATTRIBUTE_MAPPING_KEY, "oneToOne");
-
- OneToOneMapping oneToOneMapping = (OneToOneMapping) ormPersistentAttribute.getMapping();
- assertFalse(oneToOneMapping.isDefault());
- oneToOneMapping.setSpecifiedFetch(FetchType.EAGER);
- oneToOneMapping.setSpecifiedTargetEntity("TargetEntity");
- oneToOneMapping.getRelationshipReference().getMappedByJoiningStrategy().setMappedByAttribute("mappedBy");
- oneToOneMapping.getCascade().setAll(true);
- oneToOneMapping.getCascade().setMerge(true);
- oneToOneMapping.getCascade().setPersist(true);
- oneToOneMapping.getCascade().setRefresh(true);
- oneToOneMapping.getCascade().setRemove(true);
- JoinColumn joinColumn = oneToOneMapping.getRelationshipReference().getJoinColumnJoiningStrategy().addSpecifiedJoinColumn(0);
- joinColumn.setSpecifiedName("name");
- joinColumn.setSpecifiedReferencedColumnName("referenceName");
- assertFalse(oneToOneMapping.isDefault());
-
- ormPersistentAttribute.setSpecifiedMappingKey(MappingKeys.ID_ATTRIBUTE_MAPPING_KEY);
- assertEquals(1, ormPersistentType.specifiedAttributesSize());
- assertEquals(ormPersistentAttribute, ormPersistentType.specifiedAttributes().next());
- assertTrue(ormPersistentAttribute.getMapping() instanceof IdMapping);
- assertEquals("oneToOne", ormPersistentAttribute.getMapping().getName());
- }
-
- public void testOneToOneMorphToVersionMapping() throws Exception {
- OrmPersistentType ormPersistentType = getEntityMappings().addPersistentType(MappingKeys.ENTITY_TYPE_MAPPING_KEY, FULLY_QUALIFIED_TYPE_NAME);
- OrmPersistentAttribute ormPersistentAttribute = ormPersistentType.addSpecifiedPersistentAttribute(MappingKeys.ONE_TO_ONE_ATTRIBUTE_MAPPING_KEY, "oneToOne");
-
- OneToOneMapping oneToOneMapping = (OneToOneMapping) ormPersistentAttribute.getMapping();
- assertFalse(oneToOneMapping.isDefault());
- oneToOneMapping.setSpecifiedFetch(FetchType.EAGER);
- oneToOneMapping.setSpecifiedTargetEntity("TargetEntity");
- oneToOneMapping.getRelationshipReference().getMappedByJoiningStrategy().setMappedByAttribute("mappedBy");
- oneToOneMapping.getCascade().setAll(true);
- oneToOneMapping.getCascade().setMerge(true);
- oneToOneMapping.getCascade().setPersist(true);
- oneToOneMapping.getCascade().setRefresh(true);
- oneToOneMapping.getCascade().setRemove(true);
- JoinColumn joinColumn = oneToOneMapping.getRelationshipReference().getJoinColumnJoiningStrategy().addSpecifiedJoinColumn(0);
- joinColumn.setSpecifiedName("name");
- joinColumn.setSpecifiedReferencedColumnName("referenceName");
- assertFalse(oneToOneMapping.isDefault());
-
- ormPersistentAttribute.setSpecifiedMappingKey(MappingKeys.VERSION_ATTRIBUTE_MAPPING_KEY);
- assertEquals(1, ormPersistentType.specifiedAttributesSize());
- assertEquals(ormPersistentAttribute, ormPersistentType.specifiedAttributes().next());
- assertTrue(ormPersistentAttribute.getMapping() instanceof VersionMapping);
- assertEquals("oneToOne", ormPersistentAttribute.getMapping().getName());
- }
-
- public void testOneToOneMorphToTransientMapping() throws Exception {
- OrmPersistentType ormPersistentType = getEntityMappings().addPersistentType(MappingKeys.ENTITY_TYPE_MAPPING_KEY, FULLY_QUALIFIED_TYPE_NAME);
- OrmPersistentAttribute ormPersistentAttribute = ormPersistentType.addSpecifiedPersistentAttribute(MappingKeys.ONE_TO_ONE_ATTRIBUTE_MAPPING_KEY, "oneToOne");
-
- OneToOneMapping oneToOneMapping = (OneToOneMapping) ormPersistentAttribute.getMapping();
- assertFalse(oneToOneMapping.isDefault());
- oneToOneMapping.setSpecifiedFetch(FetchType.EAGER);
- oneToOneMapping.setSpecifiedTargetEntity("TargetEntity");
- oneToOneMapping.getRelationshipReference().getMappedByJoiningStrategy().setMappedByAttribute("mappedBy");
- oneToOneMapping.getCascade().setAll(true);
- oneToOneMapping.getCascade().setMerge(true);
- oneToOneMapping.getCascade().setPersist(true);
- oneToOneMapping.getCascade().setRefresh(true);
- oneToOneMapping.getCascade().setRemove(true);
- JoinColumn joinColumn = oneToOneMapping.getRelationshipReference().getJoinColumnJoiningStrategy().addSpecifiedJoinColumn(0);
- joinColumn.setSpecifiedName("name");
- joinColumn.setSpecifiedReferencedColumnName("referenceName");
- assertFalse(oneToOneMapping.isDefault());
-
- ormPersistentAttribute.setSpecifiedMappingKey(MappingKeys.TRANSIENT_ATTRIBUTE_MAPPING_KEY);
- assertEquals(1, ormPersistentType.specifiedAttributesSize());
- assertEquals(ormPersistentAttribute, ormPersistentType.specifiedAttributes().next());
- assertTrue(ormPersistentAttribute.getMapping() instanceof TransientMapping);
- assertEquals("oneToOne", ormPersistentAttribute.getMapping().getName());
- }
-
- public void testOneToOneMorphToEmbeddedMapping() throws Exception {
- OrmPersistentType ormPersistentType = getEntityMappings().addPersistentType(MappingKeys.ENTITY_TYPE_MAPPING_KEY, FULLY_QUALIFIED_TYPE_NAME);
- OrmPersistentAttribute ormPersistentAttribute = ormPersistentType.addSpecifiedPersistentAttribute(MappingKeys.ONE_TO_ONE_ATTRIBUTE_MAPPING_KEY, "oneToOne");
-
- OneToOneMapping oneToOneMapping = (OneToOneMapping) ormPersistentAttribute.getMapping();
- assertFalse(oneToOneMapping.isDefault());
- oneToOneMapping.setSpecifiedFetch(FetchType.EAGER);
- oneToOneMapping.setSpecifiedTargetEntity("TargetEntity");
- oneToOneMapping.getRelationshipReference().getMappedByJoiningStrategy().setMappedByAttribute("mappedBy");
- oneToOneMapping.getCascade().setAll(true);
- oneToOneMapping.getCascade().setMerge(true);
- oneToOneMapping.getCascade().setPersist(true);
- oneToOneMapping.getCascade().setRefresh(true);
- oneToOneMapping.getCascade().setRemove(true);
- JoinColumn joinColumn = oneToOneMapping.getRelationshipReference().getJoinColumnJoiningStrategy().addSpecifiedJoinColumn(0);
- joinColumn.setSpecifiedName("name");
- joinColumn.setSpecifiedReferencedColumnName("referenceName");
- assertFalse(oneToOneMapping.isDefault());
-
- ormPersistentAttribute.setSpecifiedMappingKey(MappingKeys.EMBEDDED_ATTRIBUTE_MAPPING_KEY);
- assertEquals(1, ormPersistentType.specifiedAttributesSize());
- assertEquals(ormPersistentAttribute, ormPersistentType.specifiedAttributes().next());
- assertTrue(ormPersistentAttribute.getMapping() instanceof EmbeddedMapping);
- assertEquals("oneToOne", ormPersistentAttribute.getMapping().getName());
- }
-
- public void testOneToOneMorphToEmbeddedIdMapping() throws Exception {
- OrmPersistentType ormPersistentType = getEntityMappings().addPersistentType(MappingKeys.ENTITY_TYPE_MAPPING_KEY, FULLY_QUALIFIED_TYPE_NAME);
- OrmPersistentAttribute ormPersistentAttribute = ormPersistentType.addSpecifiedPersistentAttribute(MappingKeys.ONE_TO_ONE_ATTRIBUTE_MAPPING_KEY, "oneToOne");
-
- OneToOneMapping oneToOneMapping = (OneToOneMapping) ormPersistentAttribute.getMapping();
- assertFalse(oneToOneMapping.isDefault());
- oneToOneMapping.setSpecifiedFetch(FetchType.EAGER);
- oneToOneMapping.setSpecifiedTargetEntity("TargetEntity");
- oneToOneMapping.getRelationshipReference().getMappedByJoiningStrategy().setMappedByAttribute("mappedBy");
- oneToOneMapping.getCascade().setAll(true);
- oneToOneMapping.getCascade().setMerge(true);
- oneToOneMapping.getCascade().setPersist(true);
- oneToOneMapping.getCascade().setRefresh(true);
- oneToOneMapping.getCascade().setRemove(true);
- JoinColumn joinColumn = oneToOneMapping.getRelationshipReference().getJoinColumnJoiningStrategy().addSpecifiedJoinColumn(0);
- joinColumn.setSpecifiedName("name");
- joinColumn.setSpecifiedReferencedColumnName("referenceName");
- assertFalse(oneToOneMapping.isDefault());
-
- ormPersistentAttribute.setSpecifiedMappingKey(MappingKeys.EMBEDDED_ID_ATTRIBUTE_MAPPING_KEY);
- assertEquals(1, ormPersistentType.specifiedAttributesSize());
- assertEquals(ormPersistentAttribute, ormPersistentType.specifiedAttributes().next());
- assertTrue(ormPersistentAttribute.getMapping() instanceof EmbeddedIdMapping);
- assertEquals("oneToOne", ormPersistentAttribute.getMapping().getName());
- }
-
- public void testOneToOneMorphToManyToManyMapping() throws Exception {
- OrmPersistentType ormPersistentType = getEntityMappings().addPersistentType(MappingKeys.ENTITY_TYPE_MAPPING_KEY, FULLY_QUALIFIED_TYPE_NAME);
- OrmPersistentAttribute ormPersistentAttribute = ormPersistentType.addSpecifiedPersistentAttribute(MappingKeys.ONE_TO_ONE_ATTRIBUTE_MAPPING_KEY, "oneToOne");
-
- OneToOneMapping oneToOneMapping = (OneToOneMapping) ormPersistentAttribute.getMapping();
- assertFalse(oneToOneMapping.isDefault());
- oneToOneMapping.setSpecifiedFetch(FetchType.EAGER);
- oneToOneMapping.setSpecifiedTargetEntity("TargetEntity");
- oneToOneMapping.getRelationshipReference().getMappedByJoiningStrategy().setMappedByAttribute("mappedBy");
- oneToOneMapping.getCascade().setAll(true);
- oneToOneMapping.getCascade().setMerge(true);
- oneToOneMapping.getCascade().setPersist(true);
- oneToOneMapping.getCascade().setRefresh(true);
- oneToOneMapping.getCascade().setRemove(true);
- JoinColumn joinColumn = oneToOneMapping.getRelationshipReference().getJoinColumnJoiningStrategy().addSpecifiedJoinColumn(0);
- joinColumn.setSpecifiedName("name");
- joinColumn.setSpecifiedReferencedColumnName("referenceName");
- assertFalse(oneToOneMapping.isDefault());
-
- ormPersistentAttribute.setSpecifiedMappingKey(MappingKeys.MANY_TO_MANY_ATTRIBUTE_MAPPING_KEY);
- assertEquals(1, ormPersistentType.specifiedAttributesSize());
- assertEquals(ormPersistentAttribute, ormPersistentType.specifiedAttributes().next());
- assertTrue(ormPersistentAttribute.getMapping() instanceof ManyToManyMapping);
- assertEquals("oneToOne", ormPersistentAttribute.getMapping().getName());
- assertEquals(FetchType.EAGER, ((ManyToManyMapping) ormPersistentAttribute.getMapping()).getSpecifiedFetch());
- assertEquals("TargetEntity", ((ManyToManyMapping) ormPersistentAttribute.getMapping()).getSpecifiedTargetEntity());
- assertEquals("mappedBy", ((ManyToManyMapping) ormPersistentAttribute.getMapping()).getRelationshipReference().getMappedByJoiningStrategy().getMappedByAttribute());
- assertTrue(((ManyToManyMapping) ormPersistentAttribute.getMapping()).getCascade().isAll());
- assertTrue(((ManyToManyMapping) ormPersistentAttribute.getMapping()).getCascade().isMerge());
- assertTrue(((ManyToManyMapping) ormPersistentAttribute.getMapping()).getCascade().isPersist());
- assertTrue(((ManyToManyMapping) ormPersistentAttribute.getMapping()).getCascade().isRefresh());
- assertTrue(((ManyToManyMapping) ormPersistentAttribute.getMapping()).getCascade().isRemove());
- }
-
- public void testOneToOneMorphToOneToManyMapping() throws Exception {
- OrmPersistentType ormPersistentType = getEntityMappings().addPersistentType(MappingKeys.ENTITY_TYPE_MAPPING_KEY, FULLY_QUALIFIED_TYPE_NAME);
- OrmPersistentAttribute ormPersistentAttribute = ormPersistentType.addSpecifiedPersistentAttribute(MappingKeys.ONE_TO_ONE_ATTRIBUTE_MAPPING_KEY, "oneToOne");
-
- OneToOneMapping oneToOneMapping = (OneToOneMapping) ormPersistentAttribute.getMapping();
- assertFalse(oneToOneMapping.isDefault());
- oneToOneMapping.setSpecifiedFetch(FetchType.EAGER);
- oneToOneMapping.setSpecifiedTargetEntity("TargetEntity");
- oneToOneMapping.getRelationshipReference().getMappedByJoiningStrategy().setMappedByAttribute("mappedBy");
- oneToOneMapping.getCascade().setAll(true);
- oneToOneMapping.getCascade().setMerge(true);
- oneToOneMapping.getCascade().setPersist(true);
- oneToOneMapping.getCascade().setRefresh(true);
- oneToOneMapping.getCascade().setRemove(true);
- JoinColumn joinColumn = oneToOneMapping.getRelationshipReference().getJoinColumnJoiningStrategy().addSpecifiedJoinColumn(0);
- joinColumn.setSpecifiedName("name");
- joinColumn.setSpecifiedReferencedColumnName("referenceName");
- assertFalse(oneToOneMapping.isDefault());
-
- ormPersistentAttribute.setSpecifiedMappingKey(MappingKeys.ONE_TO_MANY_ATTRIBUTE_MAPPING_KEY);
- assertEquals(1, ormPersistentType.specifiedAttributesSize());
- assertEquals(ormPersistentAttribute, ormPersistentType.specifiedAttributes().next());
- assertTrue(ormPersistentAttribute.getMapping() instanceof OneToManyMapping);
- assertEquals("oneToOne", ormPersistentAttribute.getMapping().getName());
- assertEquals(FetchType.EAGER, ((OneToManyMapping) ormPersistentAttribute.getMapping()).getSpecifiedFetch());
- assertEquals("TargetEntity", ((OneToManyMapping) ormPersistentAttribute.getMapping()).getSpecifiedTargetEntity());
- assertEquals("mappedBy", ((OneToManyMapping) ormPersistentAttribute.getMapping()).getRelationshipReference().getMappedByJoiningStrategy().getMappedByAttribute());
- assertTrue(((OneToManyMapping) ormPersistentAttribute.getMapping()).getCascade().isAll());
- assertTrue(((OneToManyMapping) ormPersistentAttribute.getMapping()).getCascade().isMerge());
- assertTrue(((OneToManyMapping) ormPersistentAttribute.getMapping()).getCascade().isPersist());
- assertTrue(((OneToManyMapping) ormPersistentAttribute.getMapping()).getCascade().isRefresh());
- assertTrue(((OneToManyMapping) ormPersistentAttribute.getMapping()).getCascade().isRemove());
- }
-
- public void testOneToOneMorphToManyToOneMapping() throws Exception {
- OrmPersistentType ormPersistentType = getEntityMappings().addPersistentType(MappingKeys.ENTITY_TYPE_MAPPING_KEY, FULLY_QUALIFIED_TYPE_NAME);
- OrmPersistentAttribute ormPersistentAttribute = ormPersistentType.addSpecifiedPersistentAttribute(MappingKeys.ONE_TO_ONE_ATTRIBUTE_MAPPING_KEY, "oneToOne");
-
- OneToOneMapping oneToOneMapping = (OneToOneMapping) ormPersistentAttribute.getMapping();
- assertFalse(oneToOneMapping.isDefault());
- oneToOneMapping.setSpecifiedFetch(FetchType.EAGER);
- oneToOneMapping.setSpecifiedTargetEntity("TargetEntity");
- oneToOneMapping.getRelationshipReference().getMappedByJoiningStrategy().setMappedByAttribute("mappedBy");
- oneToOneMapping.getCascade().setAll(true);
- oneToOneMapping.getCascade().setMerge(true);
- oneToOneMapping.getCascade().setPersist(true);
- oneToOneMapping.getCascade().setRefresh(true);
- oneToOneMapping.getCascade().setRemove(true);
- JoinColumn joinColumn = oneToOneMapping.getRelationshipReference().getJoinColumnJoiningStrategy().addSpecifiedJoinColumn(0);
- joinColumn.setSpecifiedName("name");
- joinColumn.setSpecifiedReferencedColumnName("referenceName");
- assertFalse(oneToOneMapping.isDefault());
-
- ormPersistentAttribute.setSpecifiedMappingKey(MappingKeys.MANY_TO_ONE_ATTRIBUTE_MAPPING_KEY);
- assertEquals(1, ormPersistentType.specifiedAttributesSize());
- assertEquals(ormPersistentAttribute, ormPersistentType.specifiedAttributes().next());
- assertTrue(ormPersistentAttribute.getMapping() instanceof ManyToOneMapping);
- assertEquals("oneToOne", ormPersistentAttribute.getMapping().getName());
- assertEquals(FetchType.EAGER, ((ManyToOneMapping) ormPersistentAttribute.getMapping()).getSpecifiedFetch());
- assertEquals("TargetEntity", ((ManyToOneMapping) ormPersistentAttribute.getMapping()).getSpecifiedTargetEntity());
- assertTrue(((ManyToOneMapping) ormPersistentAttribute.getMapping()).getCascade().isAll());
- assertTrue(((ManyToOneMapping) ormPersistentAttribute.getMapping()).getCascade().isMerge());
- assertTrue(((ManyToOneMapping) ormPersistentAttribute.getMapping()).getCascade().isPersist());
- assertTrue(((ManyToOneMapping) ormPersistentAttribute.getMapping()).getCascade().isRefresh());
- assertTrue(((ManyToOneMapping) ormPersistentAttribute.getMapping()).getCascade().isRemove());
-
- joinColumn = ((ManyToOneMapping) ormPersistentAttribute.getMapping()).getRelationshipReference().getJoinColumnJoiningStrategy().specifiedJoinColumns().next();
- assertEquals("name", joinColumn.getName());
- assertEquals("referenceName", joinColumn.getReferencedColumnName());
- }
-
- public void testOneToOneMorphToBasicMapping() throws Exception {
- OrmPersistentType ormPersistentType = getEntityMappings().addPersistentType(MappingKeys.ENTITY_TYPE_MAPPING_KEY, FULLY_QUALIFIED_TYPE_NAME);
- OrmPersistentAttribute ormPersistentAttribute = ormPersistentType.addSpecifiedPersistentAttribute(MappingKeys.ONE_TO_ONE_ATTRIBUTE_MAPPING_KEY, "oneToOne");
-
- OneToOneMapping oneToOneMapping = (OneToOneMapping) ormPersistentAttribute.getMapping();
- assertFalse(oneToOneMapping.isDefault());
- oneToOneMapping.setSpecifiedFetch(FetchType.EAGER);
- oneToOneMapping.setSpecifiedTargetEntity("TargetEntity");
- oneToOneMapping.getRelationshipReference().getMappedByJoiningStrategy().setMappedByAttribute("mappedBy");
- oneToOneMapping.getCascade().setAll(true);
- oneToOneMapping.getCascade().setMerge(true);
- oneToOneMapping.getCascade().setPersist(true);
- oneToOneMapping.getCascade().setRefresh(true);
- oneToOneMapping.getCascade().setRemove(true);
- JoinColumn joinColumn = oneToOneMapping.getRelationshipReference().getJoinColumnJoiningStrategy().addSpecifiedJoinColumn(0);
- joinColumn.setSpecifiedName("name");
- joinColumn.setSpecifiedReferencedColumnName("referenceName");
- assertFalse(oneToOneMapping.isDefault());
-
- ormPersistentAttribute.setSpecifiedMappingKey(MappingKeys.BASIC_ATTRIBUTE_MAPPING_KEY);
- assertEquals(1, ormPersistentType.specifiedAttributesSize());
- assertEquals(ormPersistentAttribute, ormPersistentType.specifiedAttributes().next());
- assertTrue(ormPersistentAttribute.getMapping() instanceof BasicMapping);
- assertEquals("oneToOne", ormPersistentAttribute.getMapping().getName());
-//TODO assertEquals(FetchType.EAGER, ((IBasicMapping) ormPersistentAttribute.getMapping()).getSpecifiedFetch());
- }
-
-
-
-
-
- public void testAddPrimaryKeyJoinColumn() throws Exception {
- OrmPersistentType ormPersistentType = getEntityMappings().addPersistentType(MappingKeys.ENTITY_TYPE_MAPPING_KEY, "model.Foo");
- OrmPersistentAttribute ormPersistentAttribute = ormPersistentType.addSpecifiedPersistentAttribute(MappingKeys.ONE_TO_ONE_ATTRIBUTE_MAPPING_KEY, "oneToOneMapping");
- OrmOneToOneMapping ormOneToOneMapping = (OrmOneToOneMapping) ormPersistentAttribute.getMapping();
- OrmPrimaryKeyJoinColumnJoiningStrategy strategy = ormOneToOneMapping.getRelationshipReference().getPrimaryKeyJoinColumnJoiningStrategy();
- XmlOneToOne oneToOneResource = getXmlEntityMappings().getEntities().get(0).getAttributes().getOneToOnes().get(0);
-
- OrmPrimaryKeyJoinColumn joinColumn = strategy.addPrimaryKeyJoinColumn(0);
- joinColumn.setSpecifiedName("FOO");
-
- assertEquals("FOO", oneToOneResource.getPrimaryKeyJoinColumns().get(0).getName());
-
- OrmPrimaryKeyJoinColumn joinColumn2 = strategy.addPrimaryKeyJoinColumn(0);
- joinColumn2.setSpecifiedName("BAR");
-
- assertEquals("BAR", oneToOneResource.getPrimaryKeyJoinColumns().get(0).getName());
- assertEquals("FOO", oneToOneResource.getPrimaryKeyJoinColumns().get(1).getName());
-
- OrmPrimaryKeyJoinColumn joinColumn3 = strategy.addPrimaryKeyJoinColumn(1);
- joinColumn3.setSpecifiedName("BAZ");
-
- assertEquals("BAR", oneToOneResource.getPrimaryKeyJoinColumns().get(0).getName());
- assertEquals("BAZ", oneToOneResource.getPrimaryKeyJoinColumns().get(1).getName());
- assertEquals("FOO", oneToOneResource.getPrimaryKeyJoinColumns().get(2).getName());
-
- ListIterator<OrmPrimaryKeyJoinColumn> joinColumns = strategy.primaryKeyJoinColumns();
- assertEquals(joinColumn2, joinColumns.next());
- assertEquals(joinColumn3, joinColumns.next());
- assertEquals(joinColumn, joinColumns.next());
-
- joinColumns = strategy.primaryKeyJoinColumns();
- assertEquals("BAR", joinColumns.next().getName());
- assertEquals("BAZ", joinColumns.next().getName());
- assertEquals("FOO", joinColumns.next().getName());
- }
-
- public void testRemovePrimaryKeyJoinColumn() throws Exception {
- OrmPersistentType ormPersistentType = getEntityMappings().addPersistentType(MappingKeys.ENTITY_TYPE_MAPPING_KEY, "model.Foo");
- OrmPersistentAttribute ormPersistentAttribute = ormPersistentType.addSpecifiedPersistentAttribute(MappingKeys.ONE_TO_ONE_ATTRIBUTE_MAPPING_KEY, "oneToOneMapping");
- OrmOneToOneMapping ormOneToOneMapping = (OrmOneToOneMapping) ormPersistentAttribute.getMapping();
- OrmPrimaryKeyJoinColumnJoiningStrategy strategy = ormOneToOneMapping.getRelationshipReference().getPrimaryKeyJoinColumnJoiningStrategy();
- XmlOneToOne oneToOneResource = getXmlEntityMappings().getEntities().get(0).getAttributes().getOneToOnes().get(0);
-
- strategy.addPrimaryKeyJoinColumn(0).setSpecifiedName("FOO");
- strategy.addPrimaryKeyJoinColumn(1).setSpecifiedName("BAR");
- strategy.addPrimaryKeyJoinColumn(2).setSpecifiedName("BAZ");
-
- assertEquals(3, oneToOneResource.getPrimaryKeyJoinColumns().size());
-
- strategy.removePrimaryKeyJoinColumn(0);
- assertEquals(2, oneToOneResource.getPrimaryKeyJoinColumns().size());
- assertEquals("BAR", oneToOneResource.getPrimaryKeyJoinColumns().get(0).getName());
- assertEquals("BAZ", oneToOneResource.getPrimaryKeyJoinColumns().get(1).getName());
-
- strategy.removePrimaryKeyJoinColumn(0);
- assertEquals(1, oneToOneResource.getPrimaryKeyJoinColumns().size());
- assertEquals("BAZ", oneToOneResource.getPrimaryKeyJoinColumns().get(0).getName());
-
- strategy.removePrimaryKeyJoinColumn(0);
- assertEquals(0, oneToOneResource.getPrimaryKeyJoinColumns().size());
- }
-
- public void testMovePrimaryKeyJoinColumn() throws Exception {
- OrmPersistentType ormPersistentType = getEntityMappings().addPersistentType(MappingKeys.ENTITY_TYPE_MAPPING_KEY, "model.Foo");
- OrmPersistentAttribute ormPersistentAttribute = ormPersistentType.addSpecifiedPersistentAttribute(MappingKeys.ONE_TO_ONE_ATTRIBUTE_MAPPING_KEY, "oneToOneMapping");
- OrmOneToOneMapping ormOneToOneMapping = (OrmOneToOneMapping) ormPersistentAttribute.getMapping();
- OrmPrimaryKeyJoinColumnJoiningStrategy strategy = ormOneToOneMapping.getRelationshipReference().getPrimaryKeyJoinColumnJoiningStrategy();
- XmlOneToOne oneToOneResource = getXmlEntityMappings().getEntities().get(0).getAttributes().getOneToOnes().get(0);
-
- strategy.addPrimaryKeyJoinColumn(0).setSpecifiedName("FOO");
- strategy.addPrimaryKeyJoinColumn(1).setSpecifiedName("BAR");
- strategy.addPrimaryKeyJoinColumn(2).setSpecifiedName("BAZ");
-
- assertEquals(3, oneToOneResource.getPrimaryKeyJoinColumns().size());
-
-
- strategy.movePrimaryKeyJoinColumn(2, 0);
- ListIterator<OrmPrimaryKeyJoinColumn> joinColumns = strategy.primaryKeyJoinColumns();
- assertEquals("BAR", joinColumns.next().getName());
- assertEquals("BAZ", joinColumns.next().getName());
- assertEquals("FOO", joinColumns.next().getName());
-
- assertEquals("BAR", oneToOneResource.getPrimaryKeyJoinColumns().get(0).getName());
- assertEquals("BAZ", oneToOneResource.getPrimaryKeyJoinColumns().get(1).getName());
- assertEquals("FOO", oneToOneResource.getPrimaryKeyJoinColumns().get(2).getName());
-
-
- strategy.movePrimaryKeyJoinColumn(0, 1);
- joinColumns = strategy.primaryKeyJoinColumns();
- assertEquals("BAZ", joinColumns.next().getName());
- assertEquals("BAR", joinColumns.next().getName());
- assertEquals("FOO", joinColumns.next().getName());
-
- assertEquals("BAZ", oneToOneResource.getPrimaryKeyJoinColumns().get(0).getName());
- assertEquals("BAR", oneToOneResource.getPrimaryKeyJoinColumns().get(1).getName());
- assertEquals("FOO", oneToOneResource.getPrimaryKeyJoinColumns().get(2).getName());
- }
-
-} \ No newline at end of file
diff --git a/jpa/tests/org.eclipse.jpt.core.tests/src/org/eclipse/jpt/core/tests/internal/context/orm/OrmPrimaryKeyJoinColumnTests.java b/jpa/tests/org.eclipse.jpt.core.tests/src/org/eclipse/jpt/core/tests/internal/context/orm/OrmPrimaryKeyJoinColumnTests.java
deleted file mode 100644
index 910556760d..0000000000
--- a/jpa/tests/org.eclipse.jpt.core.tests/src/org/eclipse/jpt/core/tests/internal/context/orm/OrmPrimaryKeyJoinColumnTests.java
+++ /dev/null
@@ -1,253 +0,0 @@
-/*******************************************************************************
- * Copyright (c) 2007, 2009 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.
- *
- * Contributors:
- * Oracle - initial API and implementation
- ******************************************************************************/
-package org.eclipse.jpt.core.tests.internal.context.orm;
-
-import org.eclipse.jpt.core.JptCorePlugin;
-import org.eclipse.jpt.core.MappingKeys;
-import org.eclipse.jpt.core.context.orm.OrmEntity;
-import org.eclipse.jpt.core.context.orm.OrmPersistentType;
-import org.eclipse.jpt.core.context.orm.OrmPrimaryKeyJoinColumn;
-import org.eclipse.jpt.core.resource.orm.XmlEntity;
-import org.eclipse.jpt.core.resource.orm.XmlPrimaryKeyJoinColumn;
-import org.eclipse.jpt.core.resource.persistence.PersistenceFactory;
-import org.eclipse.jpt.core.resource.persistence.XmlMappingFileRef;
-import org.eclipse.jpt.core.tests.internal.context.ContextModelTestCase;
-
-@SuppressWarnings("nls")
-public class OrmPrimaryKeyJoinColumnTests extends ContextModelTestCase
-{
- public OrmPrimaryKeyJoinColumnTests(String name) {
- super(name);
- }
-
- @Override
- protected void setUp() throws Exception {
- super.setUp();
- XmlMappingFileRef mappingFileRef = PersistenceFactory.eINSTANCE.createXmlMappingFileRef();
- mappingFileRef.setFileName(JptCorePlugin.DEFAULT_ORM_XML_FILE_PATH);
- getXmlPersistenceUnit().getMappingFiles().add(mappingFileRef);
- getPersistenceXmlResource().save(null);
- }
-
- public void testUpdateSpecifiedName() throws Exception {
- OrmPersistentType ormPersistentType = getEntityMappings().addPersistentType(MappingKeys.ENTITY_TYPE_MAPPING_KEY, "model.foo");
- OrmEntity ormEntity = (OrmEntity) ormPersistentType.getMapping();
- OrmPrimaryKeyJoinColumn ormPrimaryKeyJoinColumn = ormEntity.addSpecifiedPrimaryKeyJoinColumn(0);
-
- XmlEntity entityResource = getXmlEntityMappings().getEntities().get(0);
- XmlPrimaryKeyJoinColumn primaryKeyJoinColumnResource = entityResource.getPrimaryKeyJoinColumns().get(0);
-
- assertNull(ormPrimaryKeyJoinColumn.getSpecifiedName());
- assertNull(primaryKeyJoinColumnResource.getName());
-
- //set name in the resource model, verify context model updated
- primaryKeyJoinColumnResource.setName("FOO");
- assertEquals("FOO", ormPrimaryKeyJoinColumn.getSpecifiedName());
- assertEquals("FOO", primaryKeyJoinColumnResource.getName());
-
- //set name to null in the resource model
- primaryKeyJoinColumnResource.setName(null);
- assertNull(ormPrimaryKeyJoinColumn.getSpecifiedName());
- assertNull(primaryKeyJoinColumnResource.getName());
-
- primaryKeyJoinColumnResource.setName("FOO");
- assertEquals("FOO", ormPrimaryKeyJoinColumn.getSpecifiedName());
- assertEquals("FOO", primaryKeyJoinColumnResource.getName());
-
- entityResource.getPrimaryKeyJoinColumns().remove(0);
- assertFalse(ormEntity.specifiedPrimaryKeyJoinColumns().hasNext());
- assertTrue(entityResource.getPrimaryKeyJoinColumns().isEmpty());
- }
-
- public void testModifySpecifiedName() throws Exception {
- OrmPersistentType ormPersistentType = getEntityMappings().addPersistentType(MappingKeys.ENTITY_TYPE_MAPPING_KEY, "model.foo");
- OrmEntity ormEntity = (OrmEntity) ormPersistentType.getMapping();
- OrmPrimaryKeyJoinColumn ormPrimaryKeyJoinColumn = ormEntity.addSpecifiedPrimaryKeyJoinColumn(0);
-
- XmlEntity entityResource = getXmlEntityMappings().getEntities().get(0);
- XmlPrimaryKeyJoinColumn primaryKeyJoinColumnResource = entityResource.getPrimaryKeyJoinColumns().get(0);
-
- assertNull(ormPrimaryKeyJoinColumn.getSpecifiedName());
- assertNull(primaryKeyJoinColumnResource.getName());
-
- //set name in the context model, verify resource model modified
- ormPrimaryKeyJoinColumn.setSpecifiedName("foo");
- assertEquals("foo", ormPrimaryKeyJoinColumn.getSpecifiedName());
- assertEquals("foo", primaryKeyJoinColumnResource.getName());
-
- //set name to null in the context model
- ormPrimaryKeyJoinColumn.setSpecifiedName(null);
- assertNull(ormPrimaryKeyJoinColumn.getSpecifiedName());
- assertNull(entityResource.getPrimaryKeyJoinColumns().get(0).getName());
- }
-
- public void testUpdateSpecifiedReferencedColumnName() throws Exception {
- OrmPersistentType ormPersistentType = getEntityMappings().addPersistentType(MappingKeys.ENTITY_TYPE_MAPPING_KEY, "model.foo");
- OrmEntity ormEntity = (OrmEntity) ormPersistentType.getMapping();
- OrmPrimaryKeyJoinColumn ormPrimaryKeyJoinColumn = ormEntity.addSpecifiedPrimaryKeyJoinColumn(0);
-
- XmlEntity entityResource = getXmlEntityMappings().getEntities().get(0);
- XmlPrimaryKeyJoinColumn primaryKeyJoinColumnResource = entityResource.getPrimaryKeyJoinColumns().get(0);
-
- assertNull(ormPrimaryKeyJoinColumn.getSpecifiedReferencedColumnName());
- assertNull(primaryKeyJoinColumnResource.getReferencedColumnName());
-
- //set name in the resource model, verify context model updated
- primaryKeyJoinColumnResource.setReferencedColumnName("FOO");
- assertEquals("FOO", ormPrimaryKeyJoinColumn.getSpecifiedReferencedColumnName());
- assertEquals("FOO", primaryKeyJoinColumnResource.getReferencedColumnName());
-
- //set name to null in the resource model
- primaryKeyJoinColumnResource.setReferencedColumnName(null);
- assertNull(ormPrimaryKeyJoinColumn.getSpecifiedReferencedColumnName());
- assertNull(primaryKeyJoinColumnResource.getReferencedColumnName());
-
- primaryKeyJoinColumnResource.setReferencedColumnName("FOO");
- assertEquals("FOO", ormPrimaryKeyJoinColumn.getSpecifiedReferencedColumnName());
- assertEquals("FOO", primaryKeyJoinColumnResource.getReferencedColumnName());
-
- entityResource.getPrimaryKeyJoinColumns().remove(0);
- assertFalse(ormEntity.specifiedPrimaryKeyJoinColumns().hasNext());
- assertTrue(entityResource.getPrimaryKeyJoinColumns().isEmpty());
- }
-
- public void testModifySpecifiedReferencedColumnName() throws Exception {
- OrmPersistentType ormPersistentType = getEntityMappings().addPersistentType(MappingKeys.ENTITY_TYPE_MAPPING_KEY, "model.foo");
- OrmEntity ormEntity = (OrmEntity) ormPersistentType.getMapping();
- OrmPrimaryKeyJoinColumn ormPrimaryKeyJoinColumn = ormEntity.addSpecifiedPrimaryKeyJoinColumn(0);
-
- XmlEntity entityResource = getXmlEntityMappings().getEntities().get(0);
- XmlPrimaryKeyJoinColumn primaryKeyJoinColumnResource = entityResource.getPrimaryKeyJoinColumns().get(0);
-
- assertNull(ormPrimaryKeyJoinColumn.getSpecifiedReferencedColumnName());
- assertNull(primaryKeyJoinColumnResource.getReferencedColumnName());
-
- //set name in the context model, verify resource model modified
- ormPrimaryKeyJoinColumn.setSpecifiedReferencedColumnName("foo");
- assertEquals("foo", ormPrimaryKeyJoinColumn.getSpecifiedReferencedColumnName());
- assertEquals("foo", primaryKeyJoinColumnResource.getReferencedColumnName());
-
- //set name to null in the context model
- ormPrimaryKeyJoinColumn.setSpecifiedReferencedColumnName(null);
- assertNull(ormPrimaryKeyJoinColumn.getSpecifiedReferencedColumnName());
- assertNull(entityResource.getPrimaryKeyJoinColumns().get(0).getReferencedColumnName());
- }
-
-// public void testUpdateDefaultNameFromJavaTable() throws Exception {
-// createTestEntity();
-//
-// OrmPersistentType ormPersistentType = entityMappings().addOrmPersistentType(IMappingKeys.ENTITY_TYPE_MAPPING_KEY, FULLY_QUALIFIED_TYPE_NAME);
-// XmlEntity ormEntity = (XmlEntity) ormPersistentType.getMapping();
-// assertEquals(TYPE_NAME, ormEntity.getTable().getDefaultName());
-//
-// ormEntity.javaEntity().getTable().setSpecifiedName("Foo");
-// assertEquals("Foo", ormEntity.getTable().getDefaultName());
-//
-// ormEntity.setSpecifiedMetadataComplete(Boolean.TRUE);
-// assertEquals(TYPE_NAME, ormEntity.getTable().getDefaultName());
-//
-// ormEntity.entityMappings().getPersistenceUnitMetadata().setXmlMappingMetadataComplete(true);
-// ormEntity.setSpecifiedMetadataComplete(Boolean.FALSE);
-// assertEquals(TYPE_NAME, ormEntity.getTable().getDefaultName());
-//
-// ormEntity.setSpecifiedMetadataComplete(null);
-// assertEquals(TYPE_NAME, ormEntity.getTable().getDefaultName());
-//
-// ormEntity.entityMappings().getPersistenceUnitMetadata().setXmlMappingMetadataComplete(false);
-// assertEquals("Foo", ormEntity.getTable().getDefaultName());
-//
-// ormEntity.getTable().setSpecifiedName("Bar");
-// assertEquals(TYPE_NAME, ormEntity.getTable().getDefaultName());
-// }
-//
-// public void testUpdateDefaultNameNoJava() throws Exception {
-// createTestEntity();
-//
-// OrmPersistentType ormPersistentType = entityMappings().addOrmPersistentType(IMappingKeys.ENTITY_TYPE_MAPPING_KEY, "model.Foo");
-// XmlEntity ormEntity = (XmlEntity) ormPersistentType.getMapping();
-// assertEquals("Foo", ormEntity.getTable().getDefaultName());
-// }
-//
-// public void testUpdateDefaultNameFromParent() throws Exception {
-// createTestEntity();
-// createTestSubType();
-//
-// OrmPersistentType parentOrmPersistentType = entityMappings().addOrmPersistentType(IMappingKeys.ENTITY_TYPE_MAPPING_KEY, FULLY_QUALIFIED_TYPE_NAME);
-// OrmPersistentType childOrmPersistentType = entityMappings().addOrmPersistentType(IMappingKeys.ENTITY_TYPE_MAPPING_KEY, PACKAGE_NAME + ".AnnotationTestTypeChild");
-// XmlEntity parentXmlEntity = (XmlEntity) parentOrmPersistentType.getMapping();
-// XmlEntity childXmlEntity = (XmlEntity) childOrmPersistentType.getMapping();
-//
-// assertEquals(TYPE_NAME, parentXmlEntity.getTable().getDefaultName());
-// assertEquals(TYPE_NAME, childXmlEntity.getTable().getDefaultName());
-//
-// parentXmlEntity.getTable().setSpecifiedName("FOO");
-// assertEquals(TYPE_NAME, parentXmlEntity.getTable().getDefaultName());
-// assertEquals("FOO", childXmlEntity.getTable().getDefaultName());
-//
-// parentXmlEntity.setSpecifiedInheritanceStrategy(InheritanceType.JOINED);
-// assertEquals(TYPE_NAME, parentXmlEntity.getTable().getDefaultName());
-// assertEquals("AnnotationTestTypeChild", childXmlEntity.getTable().getDefaultName());
-// }
-
-
- public void testUpdateSpecifiedColumnDefinition() throws Exception {
- OrmPersistentType ormPersistentType = getEntityMappings().addPersistentType(MappingKeys.ENTITY_TYPE_MAPPING_KEY, "model.foo");
- OrmEntity ormEntity = (OrmEntity) ormPersistentType.getMapping();
- OrmPrimaryKeyJoinColumn ormPrimaryKeyJoinColumn = ormEntity.addSpecifiedPrimaryKeyJoinColumn(0);
-
- XmlEntity entityResource = getXmlEntityMappings().getEntities().get(0);
- XmlPrimaryKeyJoinColumn primaryKeyJoinColumnResource = entityResource.getPrimaryKeyJoinColumns().get(0);
-
- assertNull(ormPrimaryKeyJoinColumn.getColumnDefinition());
- assertNull(primaryKeyJoinColumnResource.getColumnDefinition());
-
- //set name in the resource model, verify context model updated
- primaryKeyJoinColumnResource.setColumnDefinition("FOO");
- assertEquals("FOO", ormPrimaryKeyJoinColumn.getColumnDefinition());
- assertEquals("FOO", primaryKeyJoinColumnResource.getColumnDefinition());
-
- //set name to null in the resource model
- primaryKeyJoinColumnResource.setColumnDefinition(null);
- assertNull(ormPrimaryKeyJoinColumn.getColumnDefinition());
- assertNull(primaryKeyJoinColumnResource.getColumnDefinition());
-
- primaryKeyJoinColumnResource.setColumnDefinition("FOO");
- assertEquals("FOO", ormPrimaryKeyJoinColumn.getColumnDefinition());
- assertEquals("FOO", primaryKeyJoinColumnResource.getColumnDefinition());
-
- entityResource.getPrimaryKeyJoinColumns().remove(0);
- assertFalse(ormEntity.specifiedPrimaryKeyJoinColumns().hasNext());
- assertTrue(entityResource.getPrimaryKeyJoinColumns().isEmpty());
- }
-
- public void testModifySpecifiedColumnDefinition() throws Exception {
- OrmPersistentType ormPersistentType = getEntityMappings().addPersistentType(MappingKeys.ENTITY_TYPE_MAPPING_KEY, "model.foo");
- OrmEntity ormEntity = (OrmEntity) ormPersistentType.getMapping();
- OrmPrimaryKeyJoinColumn ormPrimaryKeyJoinColumn = ormEntity.addSpecifiedPrimaryKeyJoinColumn(0);
-
- XmlEntity entityResource = getXmlEntityMappings().getEntities().get(0);
- XmlPrimaryKeyJoinColumn primaryKeyJoinColumnResource = entityResource.getPrimaryKeyJoinColumns().get(0);
-
- assertNull(ormPrimaryKeyJoinColumn.getColumnDefinition());
- assertNull(primaryKeyJoinColumnResource.getColumnDefinition());
-
- //set name in the context model, verify resource model modified
- ormPrimaryKeyJoinColumn.setColumnDefinition("foo");
- assertEquals("foo", ormPrimaryKeyJoinColumn.getColumnDefinition());
- assertEquals("foo", primaryKeyJoinColumnResource.getColumnDefinition());
-
- //set name to null in the context model
- ormPrimaryKeyJoinColumn.setColumnDefinition(null);
- assertNull(ormPrimaryKeyJoinColumn.getColumnDefinition());
- assertNull(entityResource.getPrimaryKeyJoinColumns().get(0).getColumnDefinition());
- }
-
-
-} \ No newline at end of file
diff --git a/jpa/tests/org.eclipse.jpt.core.tests/src/org/eclipse/jpt/core/tests/internal/context/orm/OrmQueryHintTests.java b/jpa/tests/org.eclipse.jpt.core.tests/src/org/eclipse/jpt/core/tests/internal/context/orm/OrmQueryHintTests.java
deleted file mode 100644
index a74145f674..0000000000
--- a/jpa/tests/org.eclipse.jpt.core.tests/src/org/eclipse/jpt/core/tests/internal/context/orm/OrmQueryHintTests.java
+++ /dev/null
@@ -1,122 +0,0 @@
-/*******************************************************************************
- * Copyright (c) 2007, 2009 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.
- *
- * Contributors:
- * Oracle - initial API and implementation
- ******************************************************************************/
-package org.eclipse.jpt.core.tests.internal.context.orm;
-
-import org.eclipse.jpt.core.JptCorePlugin;
-import org.eclipse.jpt.core.MappingKeys;
-import org.eclipse.jpt.core.context.orm.OrmEntity;
-import org.eclipse.jpt.core.context.orm.OrmPersistentType;
-import org.eclipse.jpt.core.context.orm.OrmQueryHint;
-import org.eclipse.jpt.core.resource.orm.XmlQueryHint;
-import org.eclipse.jpt.core.resource.persistence.PersistenceFactory;
-import org.eclipse.jpt.core.resource.persistence.XmlMappingFileRef;
-import org.eclipse.jpt.core.tests.internal.context.ContextModelTestCase;
-
-@SuppressWarnings("nls")
-public class OrmQueryHintTests extends ContextModelTestCase
-{
- public OrmQueryHintTests(String name) {
- super(name);
- }
-
-
- @Override
- protected void setUp() throws Exception {
- super.setUp();
- XmlMappingFileRef mappingFileRef = PersistenceFactory.eINSTANCE.createXmlMappingFileRef();
- mappingFileRef.setFileName(JptCorePlugin.DEFAULT_ORM_XML_FILE_PATH);
- getXmlPersistenceUnit().getMappingFiles().add(mappingFileRef);
- getPersistenceXmlResource().save(null);
- }
-
- public void testUpdateName() throws Exception {
- OrmPersistentType ormPersistentType = getEntityMappings().addPersistentType(MappingKeys.ENTITY_TYPE_MAPPING_KEY, "model.Foo");
- OrmEntity ormEntity = (OrmEntity) ormPersistentType.getMapping();
- OrmQueryHint ormQueryHint = ormEntity.getQueryContainer().addNamedQuery(0).addHint(0);
-
- XmlQueryHint queryHintResource = getXmlEntityMappings().getEntities().get(0).getNamedQueries().get(0).getHints().get(0);
-
- assertNull(ormQueryHint.getName());
- assertNull(queryHintResource.getName());
-
- //set name in the resource model, verify context model updated
- queryHintResource.setName("newName");
- assertEquals("newName", ormQueryHint.getName());
- assertEquals("newName", queryHintResource.getName());
-
- //set name to null in the resource model
- queryHintResource.setName(null);
- assertNull(ormQueryHint.getName());
- assertNull(queryHintResource.getName());
- }
-
- public void testModifyName() throws Exception {
- OrmPersistentType ormPersistentType = getEntityMappings().addPersistentType(MappingKeys.ENTITY_TYPE_MAPPING_KEY, "model.Foo");
- OrmEntity ormEntity = (OrmEntity) ormPersistentType.getMapping();
- OrmQueryHint ormQueryHint = ormEntity.getQueryContainer().addNamedQuery(0).addHint(0);
-
- XmlQueryHint queryHintResource = getXmlEntityMappings().getEntities().get(0).getNamedQueries().get(0).getHints().get(0);
-
- assertNull(ormQueryHint.getName());
- assertNull(queryHintResource.getName());
-
- //set name in the context model, verify resource model updated
- ormQueryHint.setName("newName");
- assertEquals("newName", ormQueryHint.getName());
- assertEquals("newName", queryHintResource.getName());
-
- //set name to null in the context model
- ormQueryHint.setName(null);
- assertNull(ormQueryHint.getName());
- assertNull(queryHintResource.getName());
- }
-
- public void testUpdateValue() throws Exception {
- OrmPersistentType ormPersistentType = getEntityMappings().addPersistentType(MappingKeys.ENTITY_TYPE_MAPPING_KEY, "model.Foo");
- OrmEntity ormEntity = (OrmEntity) ormPersistentType.getMapping();
- OrmQueryHint ormQueryHint = ormEntity.getQueryContainer().addNamedQuery(0).addHint(0);
-
- XmlQueryHint queryHintResource = getXmlEntityMappings().getEntities().get(0).getNamedQueries().get(0).getHints().get(0);
-
- assertNull(ormQueryHint.getValue());
- assertNull(queryHintResource.getValue());
-
- //set name in the resource model, verify context model updated
- queryHintResource.setValue("newName");
- assertEquals("newName", ormQueryHint.getValue());
- assertEquals("newName", queryHintResource.getValue());
-
- //set name to null in the resource model
- queryHintResource.setValue(null);
- assertNull(ormQueryHint.getValue());
- assertNull(queryHintResource.getValue());
- }
-
- public void testModifyValue() throws Exception {
- OrmPersistentType ormPersistentType = getEntityMappings().addPersistentType(MappingKeys.ENTITY_TYPE_MAPPING_KEY, "model.Foo");
- OrmEntity ormEntity = (OrmEntity) ormPersistentType.getMapping();
- OrmQueryHint ormQueryHint = ormEntity.getQueryContainer().addNamedQuery(0).addHint(0);
-
- XmlQueryHint queryHintResource = getXmlEntityMappings().getEntities().get(0).getNamedQueries().get(0).getHints().get(0);
-
- assertNull(ormQueryHint.getValue());
- assertNull(queryHintResource.getValue());
-
- //set name in the context model, verify resource model updated
- ormQueryHint.setValue("newName");
- assertEquals("newName", ormQueryHint.getValue());
- assertEquals("newName", queryHintResource.getValue());
-
- //set name to null in the context model
- ormQueryHint.setValue(null);
- assertNull(ormQueryHint.getValue());
- assertNull(queryHintResource.getValue());
- }
-} \ No newline at end of file
diff --git a/jpa/tests/org.eclipse.jpt.core.tests/src/org/eclipse/jpt/core/tests/internal/context/orm/OrmSecondaryTableTests.java b/jpa/tests/org.eclipse.jpt.core.tests/src/org/eclipse/jpt/core/tests/internal/context/orm/OrmSecondaryTableTests.java
deleted file mode 100644
index c67355d6f3..0000000000
--- a/jpa/tests/org.eclipse.jpt.core.tests/src/org/eclipse/jpt/core/tests/internal/context/orm/OrmSecondaryTableTests.java
+++ /dev/null
@@ -1,764 +0,0 @@
-/*******************************************************************************
- * Copyright (c) 2007, 2009 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.
- *
- * Contributors:
- * Oracle - initial API and implementation
- ******************************************************************************/
-package org.eclipse.jpt.core.tests.internal.context.orm;
-
-import java.util.Iterator;
-import java.util.ListIterator;
-import org.eclipse.jdt.core.ICompilationUnit;
-import org.eclipse.jpt.core.JptCorePlugin;
-import org.eclipse.jpt.core.MappingKeys;
-import org.eclipse.jpt.core.context.InheritanceType;
-import org.eclipse.jpt.core.context.SecondaryTable;
-import org.eclipse.jpt.core.context.java.JavaEntity;
-import org.eclipse.jpt.core.context.java.JavaSecondaryTable;
-import org.eclipse.jpt.core.context.orm.OrmEntity;
-import org.eclipse.jpt.core.context.orm.OrmPersistentType;
-import org.eclipse.jpt.core.context.orm.OrmPrimaryKeyJoinColumn;
-import org.eclipse.jpt.core.context.orm.OrmSecondaryTable;
-import org.eclipse.jpt.core.context.orm.OrmUniqueConstraint;
-import org.eclipse.jpt.core.resource.java.JPA;
-import org.eclipse.jpt.core.resource.orm.OrmFactory;
-import org.eclipse.jpt.core.resource.orm.XmlEntity;
-import org.eclipse.jpt.core.resource.orm.XmlSecondaryTable;
-import org.eclipse.jpt.core.resource.orm.XmlUniqueConstraint;
-import org.eclipse.jpt.core.resource.persistence.PersistenceFactory;
-import org.eclipse.jpt.core.resource.persistence.XmlMappingFileRef;
-import org.eclipse.jpt.core.tests.internal.context.ContextModelTestCase;
-import org.eclipse.jpt.core.tests.internal.projects.TestJavaProject.SourceWriter;
-import org.eclipse.jpt.utility.internal.iterators.ArrayIterator;
-
-@SuppressWarnings("nls")
-public class OrmSecondaryTableTests extends ContextModelTestCase
-{
- public OrmSecondaryTableTests(String name) {
- super(name);
- }
-
- @Override
- protected void setUp() throws Exception {
- super.setUp();
- XmlMappingFileRef mappingFileRef = PersistenceFactory.eINSTANCE.createXmlMappingFileRef();
- mappingFileRef.setFileName(JptCorePlugin.DEFAULT_ORM_XML_FILE_PATH);
- getXmlPersistenceUnit().getMappingFiles().add(mappingFileRef);
- getPersistenceXmlResource().save(null);
- }
-
- private ICompilationUnit createTestEntity() 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("@Id");
- }
- });
- }
-
- private void createTestSubType() throws Exception {
- SourceWriter sourceWriter = new SourceWriter() {
- public void appendSourceTo(StringBuilder sb) {
- sb.append(CR);
- sb.append("import ");
- sb.append(JPA.ENTITY);
- sb.append(";");
- sb.append(CR);
- sb.append("@Entity");
- sb.append(CR);
- sb.append("public class ").append("AnnotationTestTypeChild").append(" ");
- sb.append("extends " + TYPE_NAME + " ");
- sb.append("{}").append(CR);
- }
- };
- this.javaProject.createCompilationUnit(PACKAGE_NAME, "AnnotationTestTypeChild.java", sourceWriter);
- }
-
- public void testUpdateSpecifiedName() throws Exception {
- OrmPersistentType ormPersistentType = getEntityMappings().addPersistentType(MappingKeys.ENTITY_TYPE_MAPPING_KEY, "model.foo");
- OrmEntity ormEntity = (OrmEntity) ormPersistentType.getMapping();
- XmlEntity entityResource = getXmlEntityMappings().getEntities().get(0);
-
- //set name in the resource model, verify context model updated
- entityResource.getSecondaryTables().add(OrmFactory.eINSTANCE.createXmlSecondaryTable());
- entityResource.getSecondaryTables().get(0).setName("FOO");
- OrmSecondaryTable secondaryTable = ormEntity.specifiedSecondaryTables().next();
- assertEquals("FOO", secondaryTable.getSpecifiedName());
- assertEquals("FOO", entityResource.getSecondaryTables().get(0).getName());
-
- //set name to null in the resource model
- entityResource.getSecondaryTables().get(0).setName(null);
- assertNull(secondaryTable.getSpecifiedName());
- assertNull(entityResource.getSecondaryTables().get(0).getName());
-
- entityResource.getSecondaryTables().remove(0);
- assertFalse(ormEntity.specifiedSecondaryTables().hasNext());
- assertEquals(0, entityResource.getSecondaryTables().size());
- }
-
- public void testModifySpecifiedName() throws Exception {
- OrmPersistentType ormPersistentType = getEntityMappings().addPersistentType(MappingKeys.ENTITY_TYPE_MAPPING_KEY, "model.foo");
- OrmEntity ormEntity = (OrmEntity) ormPersistentType.getMapping();
- XmlEntity entityResource = getXmlEntityMappings().getEntities().get(0);
-
- //set name in the context model, verify resource model modified
- OrmSecondaryTable secondaryTable = ormEntity.addSpecifiedSecondaryTable(0);
- secondaryTable.setSpecifiedName("foo");
-
- assertEquals("foo", secondaryTable.getSpecifiedName());
- assertEquals("foo", entityResource.getSecondaryTables().get(0).getName());
-
- //set name to null in the context model
- secondaryTable.setSpecifiedName(null);
- assertNull(secondaryTable.getSpecifiedName());
- assertNull(entityResource.getSecondaryTables().get(0).getName());
-
- ormEntity.removeSpecifiedSecondaryTable(0);
- assertFalse(ormEntity.specifiedSecondaryTables().hasNext());
- assertEquals(0, entityResource.getSecondaryTables().size());
- }
-
- public void testUpdateDefaultNameFromJavaTable() throws Exception {
- createTestEntity();
-
- OrmPersistentType ormPersistentType = getEntityMappings().addPersistentType(MappingKeys.ENTITY_TYPE_MAPPING_KEY, FULLY_QUALIFIED_TYPE_NAME);
- OrmEntity ormEntity = (OrmEntity) ormPersistentType.getMapping();
-
- ormEntity.getJavaEntity().addSpecifiedSecondaryTable(0).setSpecifiedName("FOO");
-
- OrmSecondaryTable ormSecondaryTable = ormEntity.virtualSecondaryTables().next();
- assertEquals("FOO", ormSecondaryTable.getSpecifiedName());
-
- ormEntity.getJavaEntity().specifiedSecondaryTables().next().setSpecifiedName("BAZ");
- assertEquals("BAZ", ormSecondaryTable.getSpecifiedName());
-
- ormEntity.setSecondaryTablesDefinedInXml(true);
- assertNull(ormEntity.specifiedSecondaryTables().next().getDefaultName());
- assertEquals("BAZ", ormEntity.specifiedSecondaryTables().next().getSpecifiedName());
-
- }
-
- public void testUpdateSpecifiedSchema() throws Exception {
- OrmPersistentType ormPersistentType = getEntityMappings().addPersistentType(MappingKeys.ENTITY_TYPE_MAPPING_KEY, "model.foo");
- OrmEntity ormEntity = (OrmEntity) ormPersistentType.getMapping();
- XmlEntity entityResource = getXmlEntityMappings().getEntities().get(0);
-
- //set schema in the resource model, verify context model updated
- entityResource.getSecondaryTables().add(OrmFactory.eINSTANCE.createXmlSecondaryTable());
- entityResource.getSecondaryTables().get(0).setSchema("FOO");
- OrmSecondaryTable secondaryTable = ormEntity.specifiedSecondaryTables().next();
- assertEquals("FOO", secondaryTable.getSpecifiedSchema());
- assertEquals("FOO", entityResource.getSecondaryTables().get(0).getSchema());
-
- //set schema to null in the resource model
- entityResource.getSecondaryTables().get(0).setSchema(null);
- assertNull(secondaryTable.getSpecifiedSchema());
- assertNull(entityResource.getSecondaryTables().get(0).getSchema());
-
- entityResource.getSecondaryTables().remove(0);
- assertFalse(ormEntity.specifiedSecondaryTables().hasNext());
- assertEquals(0, entityResource.getSecondaryTables().size());
- }
-
- public void testModifySpecifiedSchema() throws Exception {
- OrmPersistentType ormPersistentType = getEntityMappings().addPersistentType(MappingKeys.ENTITY_TYPE_MAPPING_KEY, "model.foo");
- OrmEntity ormEntity = (OrmEntity) ormPersistentType.getMapping();
- XmlEntity entityResource = getXmlEntityMappings().getEntities().get(0);
-
- //set schema in the context model, verify resource model modified
- OrmSecondaryTable secondaryTable = ormEntity.addSpecifiedSecondaryTable(0);
- secondaryTable.setSpecifiedSchema("foo");
-
- assertEquals("foo", secondaryTable.getSpecifiedSchema());
- assertEquals("foo", entityResource.getSecondaryTables().get(0).getSchema());
-
- //set schema to null in the context model
- secondaryTable.setSpecifiedSchema(null);
- assertNull(secondaryTable.getSpecifiedSchema());
- assertNull(entityResource.getSecondaryTables().get(0).getSchema());
-
- ormEntity.removeSpecifiedSecondaryTable(0);
- assertFalse(ormEntity.specifiedSecondaryTables().hasNext());
- assertEquals(0, entityResource.getSecondaryTables().size());
- }
-
- public void testUpdateDefaultSchemaFromJavaTable() throws Exception {
- createTestEntity();
-
- OrmPersistentType ormPersistentType = getEntityMappings().addPersistentType(MappingKeys.ENTITY_TYPE_MAPPING_KEY, FULLY_QUALIFIED_TYPE_NAME);
- OrmEntity ormEntity = (OrmEntity) ormPersistentType.getMapping();
- assertEquals(TYPE_NAME, ormEntity.getTable().getDefaultName());
-
- SecondaryTable javaSecondaryTable = ormEntity.getJavaEntity().addSpecifiedSecondaryTable(0);
- javaSecondaryTable.setSpecifiedName("FOO");
- javaSecondaryTable.setSpecifiedSchema("BAR");
-
- OrmSecondaryTable ormSecondaryTable = ormEntity.virtualSecondaryTables().next();
- assertEquals("BAR", ormSecondaryTable.getSpecifiedSchema());
-
- javaSecondaryTable.setSpecifiedSchema("BAZ");
- assertEquals("BAZ", ormSecondaryTable.getSpecifiedSchema());
-
-
- ormEntity.setSecondaryTablesDefinedInXml(true);
- assertNull(ormEntity.specifiedSecondaryTables().next().getDefaultSchema());
- assertEquals("BAZ", ormEntity.specifiedSecondaryTables().next().getSpecifiedSchema());
- }
-
- public void testUpdateDefaultSchemaFromParent() throws Exception {
- createTestEntity();
- createTestSubType();
-
- OrmPersistentType parentOrmPersistentType = getEntityMappings().addPersistentType(MappingKeys.ENTITY_TYPE_MAPPING_KEY, FULLY_QUALIFIED_TYPE_NAME);
- OrmPersistentType childOrmPersistentType = getEntityMappings().addPersistentType(MappingKeys.ENTITY_TYPE_MAPPING_KEY, PACKAGE_NAME + ".AnnotationTestTypeChild");
- OrmEntity parentOrmEntity = (OrmEntity) parentOrmPersistentType.getMapping();
- OrmEntity childOrmEntity = (OrmEntity) childOrmPersistentType.getMapping();
-
- assertNull(parentOrmEntity.getTable().getDefaultSchema());
- assertNull(childOrmEntity.getTable().getDefaultSchema());
-
- parentOrmEntity.getTable().setSpecifiedSchema("FOO");
- assertNull(parentOrmEntity.getTable().getDefaultSchema());
- assertEquals("FOO", childOrmEntity.getTable().getDefaultSchema());
-
- parentOrmEntity.setSpecifiedInheritanceStrategy(InheritanceType.JOINED);
- assertNull(parentOrmEntity.getTable().getDefaultSchema());
- assertNull(childOrmEntity.getTable().getDefaultSchema());
- }
-
- public void testUpdateDefaultSchemaFromPersistenceUnitDefaults() throws Exception {
- createTestEntity();
-
- OrmPersistentType ormPersistentType = getEntityMappings().addPersistentType(MappingKeys.ENTITY_TYPE_MAPPING_KEY, FULLY_QUALIFIED_TYPE_NAME);
- OrmEntity ormEntity = (OrmEntity) ormPersistentType.getMapping();
- OrmSecondaryTable ormSecondaryTable = ormEntity.addSpecifiedSecondaryTable(0);
- ormSecondaryTable.setSpecifiedName("FOO");
- assertNull(ormSecondaryTable.getDefaultSchema());
-
- getEntityMappings().getPersistenceUnitMetadata().getPersistenceUnitDefaults().setSpecifiedSchema("FOO");
- assertEquals("FOO", ormSecondaryTable.getDefaultSchema());
-
- getEntityMappings().setSpecifiedSchema("BAR");
- assertEquals("BAR", ormSecondaryTable.getDefaultSchema());
-
- SecondaryTable javaSecondaryTable = ormEntity.getJavaEntity().addSpecifiedSecondaryTable(0);
- javaSecondaryTable.setSpecifiedName("FOO");
- javaSecondaryTable.setSpecifiedSchema("JAVA_SCHEMA");
- assertEquals("BAR", ormSecondaryTable.getDefaultSchema()); //schema is not defaulted from underlying java
-
- getEntityMappings().setSpecifiedSchema(null);
- assertEquals("FOO", ormSecondaryTable.getDefaultSchema());
-
- getEntityMappings().getPersistenceUnitMetadata().getPersistenceUnitDefaults().setSpecifiedSchema(null);
- assertNull(ormSecondaryTable.getDefaultSchema());
- }
-
- public void testUpdateSpecifiedCatalog() throws Exception {
- OrmPersistentType ormPersistentType = getEntityMappings().addPersistentType(MappingKeys.ENTITY_TYPE_MAPPING_KEY, "model.foo");
- OrmEntity ormEntity = (OrmEntity) ormPersistentType.getMapping();
- XmlEntity entityResource = getXmlEntityMappings().getEntities().get(0);
-
- //set catalog in the resource model, verify context model updated
- entityResource.getSecondaryTables().add(OrmFactory.eINSTANCE.createXmlSecondaryTable());
- entityResource.getSecondaryTables().get(0).setCatalog("FOO");
- OrmSecondaryTable secondaryTable = ormEntity.specifiedSecondaryTables().next();
- assertEquals("FOO", secondaryTable.getSpecifiedCatalog());
- assertEquals("FOO", entityResource.getSecondaryTables().get(0).getCatalog());
-
- //set catalog to null in the resource model
- entityResource.getSecondaryTables().get(0).setCatalog(null);
- assertNull(secondaryTable.getSpecifiedCatalog());
- assertNull(entityResource.getSecondaryTables().get(0).getCatalog());
-
- entityResource.getSecondaryTables().remove(0);
- assertFalse(ormEntity.specifiedSecondaryTables().hasNext());
- assertEquals(0, entityResource.getSecondaryTables().size());
- }
-
- public void testModifySpecifiedCatalog() throws Exception {
- OrmPersistentType ormPersistentType = getEntityMappings().addPersistentType(MappingKeys.ENTITY_TYPE_MAPPING_KEY, "model.foo");
- OrmEntity ormEntity = (OrmEntity) ormPersistentType.getMapping();
- XmlEntity entityResource = getXmlEntityMappings().getEntities().get(0);
-
- //set catalog in the context model, verify resource model modified
- OrmSecondaryTable secondaryTable = ormEntity.addSpecifiedSecondaryTable(0);
- secondaryTable.setSpecifiedCatalog("foo");
-
- assertEquals("foo", secondaryTable.getSpecifiedCatalog());
- assertEquals("foo", entityResource.getSecondaryTables().get(0).getCatalog());
-
- //set catalog to null in the context model
- secondaryTable.setSpecifiedCatalog(null);
- assertNull(secondaryTable.getSpecifiedCatalog());
- assertNull(entityResource.getSecondaryTables().get(0).getCatalog());
-
- ormEntity.removeSpecifiedSecondaryTable(0);
- assertFalse(ormEntity.specifiedSecondaryTables().hasNext());
- assertEquals(0, entityResource.getSecondaryTables().size());
- }
-
- public void testUpdateDefaultCatalogFromJavaTable() throws Exception {
- createTestEntity();
-
- OrmPersistentType ormPersistentType = getEntityMappings().addPersistentType(MappingKeys.ENTITY_TYPE_MAPPING_KEY, FULLY_QUALIFIED_TYPE_NAME);
- OrmEntity ormEntity = (OrmEntity) ormPersistentType.getMapping();
- assertEquals(TYPE_NAME, ormEntity.getTable().getDefaultName());
-
- SecondaryTable javaSecondaryTable = ormEntity.getJavaEntity().addSpecifiedSecondaryTable(0);
- javaSecondaryTable.setSpecifiedName("FOO");
- javaSecondaryTable.setSpecifiedCatalog("BAR");
-
- OrmSecondaryTable ormSecondaryTable = ormEntity.virtualSecondaryTables().next();
- assertEquals("BAR", ormSecondaryTable.getSpecifiedCatalog());
-
- javaSecondaryTable.setSpecifiedCatalog("BAZ");
- assertEquals("BAZ", ormSecondaryTable.getSpecifiedCatalog());
-
- ormEntity.setSecondaryTablesDefinedInXml(true);
- assertNull(ormEntity.specifiedSecondaryTables().next().getDefaultCatalog());
- assertEquals("BAZ", ormEntity.specifiedSecondaryTables().next().getSpecifiedCatalog());
- }
-
- public void testUpdateDefaultCatalogFromPersistenceUnitDefaults() throws Exception {
- createTestEntity();
-
- OrmPersistentType ormPersistentType = getEntityMappings().addPersistentType(MappingKeys.ENTITY_TYPE_MAPPING_KEY, FULLY_QUALIFIED_TYPE_NAME);
- OrmEntity ormEntity = (OrmEntity) ormPersistentType.getMapping();
- OrmSecondaryTable ormSecondaryTable = ormEntity.addSpecifiedSecondaryTable(0);
- ormSecondaryTable.setSpecifiedName("FOO");
- assertNull(ormSecondaryTable.getDefaultCatalog());
-
- getEntityMappings().getPersistenceUnitMetadata().getPersistenceUnitDefaults().setSpecifiedCatalog("FOO");
- assertEquals("FOO", ormSecondaryTable.getDefaultCatalog());
-
- getEntityMappings().setSpecifiedCatalog("BAR");
- assertEquals("BAR", ormSecondaryTable.getDefaultCatalog());
-
- SecondaryTable javaSecondaryTable = ormEntity.getJavaEntity().addSpecifiedSecondaryTable(0);
- javaSecondaryTable.setSpecifiedName("FOO");
- javaSecondaryTable.setSpecifiedCatalog("JAVA_CATALOG");
- assertEquals("BAR", ormSecondaryTable.getDefaultCatalog()); //schema is not defaulted from underlying java
-
- getEntityMappings().setSpecifiedCatalog(null);
- assertEquals("FOO", ormSecondaryTable.getDefaultCatalog());
-
- getEntityMappings().getPersistenceUnitMetadata().getPersistenceUnitDefaults().setSpecifiedCatalog(null);
- assertNull(ormSecondaryTable.getDefaultCatalog());
- }
-
- public void testAddSpecifiedPrimaryKeyJoinColumn() throws Exception {
- OrmPersistentType persistentType = getEntityMappings().addPersistentType(MappingKeys.ENTITY_TYPE_MAPPING_KEY, FULLY_QUALIFIED_TYPE_NAME);
- OrmEntity ormEntity = (OrmEntity) persistentType.getMapping();
- OrmSecondaryTable ormSecondaryTable = ormEntity.addSpecifiedSecondaryTable(0);
- XmlEntity entityResource = getXmlEntityMappings().getEntities().get(0);
- XmlSecondaryTable secondaryTableResource = entityResource.getSecondaryTables().get(0);
-
- OrmPrimaryKeyJoinColumn primaryKeyJoinColumn = ormSecondaryTable.addSpecifiedPrimaryKeyJoinColumn(0);
- primaryKeyJoinColumn.setSpecifiedName("FOO");
-
- assertEquals("FOO", secondaryTableResource.getPrimaryKeyJoinColumns().get(0).getName());
-
- OrmPrimaryKeyJoinColumn primaryKeyJoinColumn2 = ormSecondaryTable.addSpecifiedPrimaryKeyJoinColumn(0);
- primaryKeyJoinColumn2.setSpecifiedName("BAR");
-
- assertEquals("BAR", secondaryTableResource.getPrimaryKeyJoinColumns().get(0).getName());
- assertEquals("FOO", secondaryTableResource.getPrimaryKeyJoinColumns().get(1).getName());
-
- OrmPrimaryKeyJoinColumn primaryKeyJoinColumn3 = ormSecondaryTable.addSpecifiedPrimaryKeyJoinColumn(1);
- primaryKeyJoinColumn3.setSpecifiedName("BAZ");
-
- assertEquals("BAR", secondaryTableResource.getPrimaryKeyJoinColumns().get(0).getName());
- assertEquals("BAZ", secondaryTableResource.getPrimaryKeyJoinColumns().get(1).getName());
- assertEquals("FOO", secondaryTableResource.getPrimaryKeyJoinColumns().get(2).getName());
-
- ListIterator<OrmPrimaryKeyJoinColumn> primaryKeyJoinColumns = ormSecondaryTable.specifiedPrimaryKeyJoinColumns();
- assertEquals(primaryKeyJoinColumn2, primaryKeyJoinColumns.next());
- assertEquals(primaryKeyJoinColumn3, primaryKeyJoinColumns.next());
- assertEquals(primaryKeyJoinColumn, primaryKeyJoinColumns.next());
-
- primaryKeyJoinColumns = ormSecondaryTable.specifiedPrimaryKeyJoinColumns();
- assertEquals("BAR", primaryKeyJoinColumns.next().getName());
- assertEquals("BAZ", primaryKeyJoinColumns.next().getName());
- assertEquals("FOO", primaryKeyJoinColumns.next().getName());
- }
-
- public void testRemoveSpecifiedPrimaryKeyJoinColumn() throws Exception {
- OrmPersistentType persistentType = getEntityMappings().addPersistentType(MappingKeys.ENTITY_TYPE_MAPPING_KEY, FULLY_QUALIFIED_TYPE_NAME);
- OrmEntity ormEntity = (OrmEntity) persistentType.getMapping();
- OrmSecondaryTable ormSecondaryTable = ormEntity.addSpecifiedSecondaryTable(0);
- XmlEntity entityResource = getXmlEntityMappings().getEntities().get(0);
- XmlSecondaryTable secondaryTableResource = entityResource.getSecondaryTables().get(0);
-
- ormSecondaryTable.addSpecifiedPrimaryKeyJoinColumn(0).setSpecifiedName("FOO");
- ormSecondaryTable.addSpecifiedPrimaryKeyJoinColumn(1).setSpecifiedName("BAR");
- ormSecondaryTable.addSpecifiedPrimaryKeyJoinColumn(2).setSpecifiedName("BAZ");
-
- assertEquals(3, secondaryTableResource.getPrimaryKeyJoinColumns().size());
-
- ormSecondaryTable.removeSpecifiedPrimaryKeyJoinColumn(0);
- assertEquals(2, secondaryTableResource.getPrimaryKeyJoinColumns().size());
- assertEquals("BAR", secondaryTableResource.getPrimaryKeyJoinColumns().get(0).getName());
- assertEquals("BAZ", secondaryTableResource.getPrimaryKeyJoinColumns().get(1).getName());
-
- ormSecondaryTable.removeSpecifiedPrimaryKeyJoinColumn(0);
- assertEquals(1, secondaryTableResource.getPrimaryKeyJoinColumns().size());
- assertEquals("BAZ", secondaryTableResource.getPrimaryKeyJoinColumns().get(0).getName());
-
- ormSecondaryTable.removeSpecifiedPrimaryKeyJoinColumn(0);
- assertEquals(0, secondaryTableResource.getPrimaryKeyJoinColumns().size());
- }
-
- public void testMoveSpecifiedPrimaryKeyJoinColumn() throws Exception {
- OrmPersistentType persistentType = getEntityMappings().addPersistentType(MappingKeys.ENTITY_TYPE_MAPPING_KEY, FULLY_QUALIFIED_TYPE_NAME);
- OrmEntity ormEntity = (OrmEntity) persistentType.getMapping();
- OrmSecondaryTable ormSecondaryTable = ormEntity.addSpecifiedSecondaryTable(0);
- XmlEntity entityResource = getXmlEntityMappings().getEntities().get(0);
- XmlSecondaryTable secondaryTableResource = entityResource.getSecondaryTables().get(0);
-
- ormSecondaryTable.addSpecifiedPrimaryKeyJoinColumn(0).setSpecifiedName("FOO");
- ormSecondaryTable.addSpecifiedPrimaryKeyJoinColumn(1).setSpecifiedName("BAR");
- ormSecondaryTable.addSpecifiedPrimaryKeyJoinColumn(2).setSpecifiedName("BAZ");
-
- assertEquals(3, secondaryTableResource.getPrimaryKeyJoinColumns().size());
-
-
- ormSecondaryTable.moveSpecifiedPrimaryKeyJoinColumn(2, 0);
- ListIterator<OrmPrimaryKeyJoinColumn> primaryKeyJoinColumns = ormSecondaryTable.specifiedPrimaryKeyJoinColumns();
- assertEquals("BAR", primaryKeyJoinColumns.next().getName());
- assertEquals("BAZ", primaryKeyJoinColumns.next().getName());
- assertEquals("FOO", primaryKeyJoinColumns.next().getName());
-
- assertEquals("BAR", secondaryTableResource.getPrimaryKeyJoinColumns().get(0).getName());
- assertEquals("BAZ", secondaryTableResource.getPrimaryKeyJoinColumns().get(1).getName());
- assertEquals("FOO", secondaryTableResource.getPrimaryKeyJoinColumns().get(2).getName());
-
-
- ormSecondaryTable.moveSpecifiedPrimaryKeyJoinColumn(0, 1);
- primaryKeyJoinColumns = ormSecondaryTable.specifiedPrimaryKeyJoinColumns();
- assertEquals("BAZ", primaryKeyJoinColumns.next().getName());
- assertEquals("BAR", primaryKeyJoinColumns.next().getName());
- assertEquals("FOO", primaryKeyJoinColumns.next().getName());
-
- assertEquals("BAZ", secondaryTableResource.getPrimaryKeyJoinColumns().get(0).getName());
- assertEquals("BAR", secondaryTableResource.getPrimaryKeyJoinColumns().get(1).getName());
- assertEquals("FOO", secondaryTableResource.getPrimaryKeyJoinColumns().get(2).getName());
- }
-
- public void testUpdatePrimaryKeyJoinColumns() throws Exception {
- OrmPersistentType persistentType = getEntityMappings().addPersistentType(MappingKeys.ENTITY_TYPE_MAPPING_KEY, FULLY_QUALIFIED_TYPE_NAME);
- OrmEntity ormEntity = (OrmEntity) persistentType.getMapping();
- OrmSecondaryTable ormSecondaryTable = ormEntity.addSpecifiedSecondaryTable(0);
- XmlEntity entityResource = getXmlEntityMappings().getEntities().get(0);
- XmlSecondaryTable secondaryTableResource = entityResource.getSecondaryTables().get(0);
-
- secondaryTableResource.getPrimaryKeyJoinColumns().add(OrmFactory.eINSTANCE.createXmlPrimaryKeyJoinColumn());
- secondaryTableResource.getPrimaryKeyJoinColumns().add(OrmFactory.eINSTANCE.createXmlPrimaryKeyJoinColumn());
- secondaryTableResource.getPrimaryKeyJoinColumns().add(OrmFactory.eINSTANCE.createXmlPrimaryKeyJoinColumn());
-
- secondaryTableResource.getPrimaryKeyJoinColumns().get(0).setName("FOO");
- secondaryTableResource.getPrimaryKeyJoinColumns().get(1).setName("BAR");
- secondaryTableResource.getPrimaryKeyJoinColumns().get(2).setName("BAZ");
-
- ListIterator<OrmPrimaryKeyJoinColumn> primaryKeyJoinColumns = ormSecondaryTable.specifiedPrimaryKeyJoinColumns();
- assertEquals("FOO", primaryKeyJoinColumns.next().getName());
- assertEquals("BAR", primaryKeyJoinColumns.next().getName());
- assertEquals("BAZ", primaryKeyJoinColumns.next().getName());
- assertFalse(primaryKeyJoinColumns.hasNext());
-
- secondaryTableResource.getPrimaryKeyJoinColumns().move(2, 0);
- primaryKeyJoinColumns = ormSecondaryTable.specifiedPrimaryKeyJoinColumns();
- assertEquals("BAR", primaryKeyJoinColumns.next().getName());
- assertEquals("BAZ", primaryKeyJoinColumns.next().getName());
- assertEquals("FOO", primaryKeyJoinColumns.next().getName());
- assertFalse(primaryKeyJoinColumns.hasNext());
-
- secondaryTableResource.getPrimaryKeyJoinColumns().move(0, 1);
- primaryKeyJoinColumns = ormSecondaryTable.specifiedPrimaryKeyJoinColumns();
- assertEquals("BAZ", primaryKeyJoinColumns.next().getName());
- assertEquals("BAR", primaryKeyJoinColumns.next().getName());
- assertEquals("FOO", primaryKeyJoinColumns.next().getName());
- assertFalse(primaryKeyJoinColumns.hasNext());
-
- secondaryTableResource.getPrimaryKeyJoinColumns().remove(1);
- primaryKeyJoinColumns = ormSecondaryTable.specifiedPrimaryKeyJoinColumns();
- assertEquals("BAZ", primaryKeyJoinColumns.next().getName());
- assertEquals("FOO", primaryKeyJoinColumns.next().getName());
- assertFalse(primaryKeyJoinColumns.hasNext());
-
- secondaryTableResource.getPrimaryKeyJoinColumns().remove(1);
- primaryKeyJoinColumns = ormSecondaryTable.specifiedPrimaryKeyJoinColumns();
- assertEquals("BAZ", primaryKeyJoinColumns.next().getName());
- assertFalse(primaryKeyJoinColumns.hasNext());
-
- secondaryTableResource.getPrimaryKeyJoinColumns().remove(0);
- assertFalse(ormSecondaryTable.specifiedPrimaryKeyJoinColumns().hasNext());
- }
-
-
- public void testUniqueConstraints() throws Exception {
- OrmPersistentType persistentType = getEntityMappings().addPersistentType(MappingKeys.ENTITY_TYPE_MAPPING_KEY, FULLY_QUALIFIED_TYPE_NAME);
- OrmEntity ormEntity = (OrmEntity) persistentType.getMapping();
- OrmSecondaryTable ormSecondaryTable = ormEntity.addSpecifiedSecondaryTable(0);
- XmlEntity entityResource = getXmlEntityMappings().getEntities().get(0);
- XmlSecondaryTable secondaryTableResource = entityResource.getSecondaryTables().get(0);
-
- ListIterator<OrmUniqueConstraint> uniqueConstraints = ormSecondaryTable.uniqueConstraints();
- assertFalse(uniqueConstraints.hasNext());
-
- XmlUniqueConstraint uniqueConstraintResource = OrmFactory.eINSTANCE.createXmlUniqueConstraint();
- secondaryTableResource.getUniqueConstraints().add(0, uniqueConstraintResource);
- uniqueConstraintResource.getColumnNames().add(0, "foo");
-
- uniqueConstraintResource = OrmFactory.eINSTANCE.createXmlUniqueConstraint();
- secondaryTableResource.getUniqueConstraints().add(0, uniqueConstraintResource);
- uniqueConstraintResource.getColumnNames().add(0, "bar");
-
- uniqueConstraints = ormSecondaryTable.uniqueConstraints();
- assertTrue(uniqueConstraints.hasNext());
- assertEquals("bar", uniqueConstraints.next().columnNames().next());
- assertEquals("foo", uniqueConstraints.next().columnNames().next());
- assertFalse(uniqueConstraints.hasNext());
- }
-
- public void testUniqueConstraintsSize() throws Exception {
- OrmPersistentType persistentType = getEntityMappings().addPersistentType(MappingKeys.ENTITY_TYPE_MAPPING_KEY, FULLY_QUALIFIED_TYPE_NAME);
- OrmEntity ormEntity = (OrmEntity) persistentType.getMapping();
- OrmSecondaryTable ormSecondaryTable = ormEntity.addSpecifiedSecondaryTable(0);
- XmlEntity entityResource = getXmlEntityMappings().getEntities().get(0);
- XmlSecondaryTable secondaryTableResource = entityResource.getSecondaryTables().get(0);
-
- assertEquals(0, ormSecondaryTable.uniqueConstraintsSize());
-
- XmlUniqueConstraint uniqueConstraintResource = OrmFactory.eINSTANCE.createXmlUniqueConstraint();
- secondaryTableResource.getUniqueConstraints().add(0, uniqueConstraintResource);
- uniqueConstraintResource.getColumnNames().add(0, "foo");
-
- uniqueConstraintResource = OrmFactory.eINSTANCE.createXmlUniqueConstraint();
- secondaryTableResource.getUniqueConstraints().add(1, uniqueConstraintResource);
- uniqueConstraintResource.getColumnNames().add(0, "bar");
-
- assertEquals(2, ormSecondaryTable.uniqueConstraintsSize());
- }
-
- public void testAddUniqueConstraint() throws Exception {
- OrmPersistentType persistentType = getEntityMappings().addPersistentType(MappingKeys.ENTITY_TYPE_MAPPING_KEY, FULLY_QUALIFIED_TYPE_NAME);
- OrmEntity ormEntity = (OrmEntity) persistentType.getMapping();
- OrmSecondaryTable ormSecondaryTable = ormEntity.addSpecifiedSecondaryTable(0);
- XmlEntity entityResource = getXmlEntityMappings().getEntities().get(0);
- XmlSecondaryTable secondaryTableResource = entityResource.getSecondaryTables().get(0);
-
- ormSecondaryTable.addUniqueConstraint(0).addColumnName(0, "FOO");
- ormSecondaryTable.addUniqueConstraint(0).addColumnName(0, "BAR");
- ormSecondaryTable.addUniqueConstraint(0).addColumnName(0, "BAZ");
-
- ListIterator<XmlUniqueConstraint> uniqueConstraints = secondaryTableResource.getUniqueConstraints().listIterator();
-
- assertEquals("BAZ", uniqueConstraints.next().getColumnNames().get(0));
- assertEquals("BAR", uniqueConstraints.next().getColumnNames().get(0));
- assertEquals("FOO", uniqueConstraints.next().getColumnNames().get(0));
- assertFalse(uniqueConstraints.hasNext());
- }
-
- public void testAddUniqueConstraint2() throws Exception {
- OrmPersistentType persistentType = getEntityMappings().addPersistentType(MappingKeys.ENTITY_TYPE_MAPPING_KEY, FULLY_QUALIFIED_TYPE_NAME);
- OrmEntity ormEntity = (OrmEntity) persistentType.getMapping();
- OrmSecondaryTable ormSecondaryTable = ormEntity.addSpecifiedSecondaryTable(0);
- XmlEntity entityResource = getXmlEntityMappings().getEntities().get(0);
- XmlSecondaryTable secondaryTableResource = entityResource.getSecondaryTables().get(0);
-
- ormSecondaryTable.addUniqueConstraint(0).addColumnName(0, "FOO");
- ormSecondaryTable.addUniqueConstraint(1).addColumnName(0, "BAR");
- ormSecondaryTable.addUniqueConstraint(0).addColumnName(0, "BAZ");
-
- ListIterator<XmlUniqueConstraint> uniqueConstraints = secondaryTableResource.getUniqueConstraints().listIterator();
-
- assertEquals("BAZ", uniqueConstraints.next().getColumnNames().get(0));
- assertEquals("FOO", uniqueConstraints.next().getColumnNames().get(0));
- assertEquals("BAR", uniqueConstraints.next().getColumnNames().get(0));
- assertFalse(uniqueConstraints.hasNext());
- }
-
- public void testRemoveUniqueConstraint() throws Exception {
- OrmPersistentType persistentType = getEntityMappings().addPersistentType(MappingKeys.ENTITY_TYPE_MAPPING_KEY, FULLY_QUALIFIED_TYPE_NAME);
- OrmEntity ormEntity = (OrmEntity) persistentType.getMapping();
- OrmSecondaryTable ormSecondaryTable = ormEntity.addSpecifiedSecondaryTable(0);
- XmlEntity entityResource = getXmlEntityMappings().getEntities().get(0);
- XmlSecondaryTable secondaryTableResource = entityResource.getSecondaryTables().get(0);
-
- ormSecondaryTable.addUniqueConstraint(0).addColumnName(0, "FOO");
- ormSecondaryTable.addUniqueConstraint(1).addColumnName(0, "BAR");
- ormSecondaryTable.addUniqueConstraint(2).addColumnName(0, "BAZ");
-
- assertEquals(3, secondaryTableResource.getUniqueConstraints().size());
-
- ormSecondaryTable.removeUniqueConstraint(1);
-
- ListIterator<XmlUniqueConstraint> uniqueConstraintResources = secondaryTableResource.getUniqueConstraints().listIterator();
- assertEquals("FOO", uniqueConstraintResources.next().getColumnNames().get(0));
- assertEquals("BAZ", uniqueConstraintResources.next().getColumnNames().get(0));
- assertFalse(uniqueConstraintResources.hasNext());
-
- Iterator<OrmUniqueConstraint> uniqueConstraints = ormSecondaryTable.uniqueConstraints();
- assertEquals("FOO", uniqueConstraints.next().columnNames().next());
- assertEquals("BAZ", uniqueConstraints.next().columnNames().next());
- assertFalse(uniqueConstraints.hasNext());
-
-
- ormSecondaryTable.removeUniqueConstraint(1);
- uniqueConstraintResources = secondaryTableResource.getUniqueConstraints().listIterator();
- assertEquals("FOO", uniqueConstraintResources.next().getColumnNames().get(0));
- assertFalse(uniqueConstraintResources.hasNext());
-
- uniqueConstraints = ormSecondaryTable.uniqueConstraints();
- assertEquals("FOO", uniqueConstraints.next().columnNames().next());
- assertFalse(uniqueConstraints.hasNext());
-
-
- ormSecondaryTable.removeUniqueConstraint(0);
- uniqueConstraintResources = secondaryTableResource.getUniqueConstraints().listIterator();
- assertFalse(uniqueConstraintResources.hasNext());
- uniqueConstraints = ormSecondaryTable.uniqueConstraints();
- assertFalse(uniqueConstraints.hasNext());
- }
-
- public void testMoveUniqueConstraint() throws Exception {
- OrmPersistentType persistentType = getEntityMappings().addPersistentType(MappingKeys.ENTITY_TYPE_MAPPING_KEY, FULLY_QUALIFIED_TYPE_NAME);
- OrmEntity ormEntity = (OrmEntity) persistentType.getMapping();
- OrmSecondaryTable ormSecondaryTable = ormEntity.addSpecifiedSecondaryTable(0);
- XmlEntity entityResource = getXmlEntityMappings().getEntities().get(0);
- XmlSecondaryTable secondaryTableResource = entityResource.getSecondaryTables().get(0);
-
- ormSecondaryTable.addUniqueConstraint(0).addColumnName(0, "FOO");
- ormSecondaryTable.addUniqueConstraint(1).addColumnName(0, "BAR");
- ormSecondaryTable.addUniqueConstraint(2).addColumnName(0, "BAZ");
-
- assertEquals(3, secondaryTableResource.getUniqueConstraints().size());
-
-
- ormSecondaryTable.moveUniqueConstraint(2, 0);
- ListIterator<OrmUniqueConstraint> uniqueConstraints = ormSecondaryTable.uniqueConstraints();
- assertEquals("BAR", uniqueConstraints.next().columnNames().next());
- assertEquals("BAZ", uniqueConstraints.next().columnNames().next());
- assertEquals("FOO", uniqueConstraints.next().columnNames().next());
-
- ListIterator<XmlUniqueConstraint> uniqueConstraintResources = secondaryTableResource.getUniqueConstraints().listIterator();
- assertEquals("BAR", uniqueConstraintResources.next().getColumnNames().get(0));
- assertEquals("BAZ", uniqueConstraintResources.next().getColumnNames().get(0));
- assertEquals("FOO", uniqueConstraintResources.next().getColumnNames().get(0));
-
-
- ormSecondaryTable.moveUniqueConstraint(0, 1);
- uniqueConstraints = ormSecondaryTable.uniqueConstraints();
- assertEquals("BAZ", uniqueConstraints.next().columnNames().next());
- assertEquals("BAR", uniqueConstraints.next().columnNames().next());
- assertEquals("FOO", uniqueConstraints.next().columnNames().next());
-
- uniqueConstraintResources = secondaryTableResource.getUniqueConstraints().listIterator();
- assertEquals("BAZ", uniqueConstraintResources.next().getColumnNames().get(0));
- assertEquals("BAR", uniqueConstraintResources.next().getColumnNames().get(0));
- assertEquals("FOO", uniqueConstraintResources.next().getColumnNames().get(0));
- }
-
- public void testUpdateUniqueConstraints() throws Exception {
- OrmPersistentType persistentType = getEntityMappings().addPersistentType(MappingKeys.ENTITY_TYPE_MAPPING_KEY, FULLY_QUALIFIED_TYPE_NAME);
- OrmEntity ormEntity = (OrmEntity) persistentType.getMapping();
- OrmSecondaryTable ormSecondaryTable = ormEntity.addSpecifiedSecondaryTable(0);
- XmlEntity entityResource = getXmlEntityMappings().getEntities().get(0);
- XmlSecondaryTable secondaryTableResource = entityResource.getSecondaryTables().get(0);
-
- XmlUniqueConstraint uniqueConstraintResource = OrmFactory.eINSTANCE.createXmlUniqueConstraint();
- secondaryTableResource.getUniqueConstraints().add(0, uniqueConstraintResource);
- uniqueConstraintResource.getColumnNames().add(0, "FOO");
-
- uniqueConstraintResource = OrmFactory.eINSTANCE.createXmlUniqueConstraint();
- secondaryTableResource.getUniqueConstraints().add(1, uniqueConstraintResource);
- uniqueConstraintResource.getColumnNames().add(0, "BAR");
-
- uniqueConstraintResource = OrmFactory.eINSTANCE.createXmlUniqueConstraint();
- secondaryTableResource.getUniqueConstraints().add(2, uniqueConstraintResource);
- uniqueConstraintResource.getColumnNames().add(0, "BAZ");
-
-
- ListIterator<OrmUniqueConstraint> uniqueConstraints = ormSecondaryTable.uniqueConstraints();
- assertEquals("FOO", uniqueConstraints.next().columnNames().next());
- assertEquals("BAR", uniqueConstraints.next().columnNames().next());
- assertEquals("BAZ", uniqueConstraints.next().columnNames().next());
- assertFalse(uniqueConstraints.hasNext());
-
- secondaryTableResource.getUniqueConstraints().move(2, 0);
- uniqueConstraints = ormSecondaryTable.uniqueConstraints();
- assertEquals("BAR", uniqueConstraints.next().columnNames().next());
- assertEquals("BAZ", uniqueConstraints.next().columnNames().next());
- assertEquals("FOO", uniqueConstraints.next().columnNames().next());
- assertFalse(uniqueConstraints.hasNext());
-
- secondaryTableResource.getUniqueConstraints().move(0, 1);
- uniqueConstraints = ormSecondaryTable.uniqueConstraints();
- assertEquals("BAZ", uniqueConstraints.next().columnNames().next());
- assertEquals("BAR", uniqueConstraints.next().columnNames().next());
- assertEquals("FOO", uniqueConstraints.next().columnNames().next());
- assertFalse(uniqueConstraints.hasNext());
-
- secondaryTableResource.getUniqueConstraints().remove(1);
- uniqueConstraints = ormSecondaryTable.uniqueConstraints();
- assertEquals("BAZ", uniqueConstraints.next().columnNames().next());
- assertEquals("FOO", uniqueConstraints.next().columnNames().next());
- assertFalse(uniqueConstraints.hasNext());
-
- secondaryTableResource.getUniqueConstraints().remove(1);
- uniqueConstraints = ormSecondaryTable.uniqueConstraints();
- assertEquals("BAZ", uniqueConstraints.next().columnNames().next());
- assertFalse(uniqueConstraints.hasNext());
-
- secondaryTableResource.getUniqueConstraints().remove(0);
- uniqueConstraints = ormSecondaryTable.uniqueConstraints();
- assertFalse(uniqueConstraints.hasNext());
- }
-
-
- public void testUniqueConstraintsFromJava() throws Exception {
- createTestEntity();
- OrmPersistentType ormPersistentType = getEntityMappings().addPersistentType(MappingKeys.ENTITY_TYPE_MAPPING_KEY, FULLY_QUALIFIED_TYPE_NAME);
- OrmEntity ormEntity = (OrmEntity) ormPersistentType.getMapping();
-
- JavaEntity javaEntity = (JavaEntity) ormPersistentType.getJavaPersistentType().getMapping();
- JavaSecondaryTable javaSecondaryTable = javaEntity.addSpecifiedSecondaryTable(0);
- javaSecondaryTable.setSpecifiedName("SECONDARY");
-
- OrmSecondaryTable ormSecondaryTable = ormEntity.secondaryTables().next();
- assertTrue(ormSecondaryTable.isVirtual());
- ListIterator<OrmUniqueConstraint> uniqueConstraints = ormSecondaryTable.uniqueConstraints();
- assertFalse(uniqueConstraints.hasNext());
-
-
- javaSecondaryTable.addUniqueConstraint(0).addColumnName(0, "FOO");
- javaSecondaryTable.addUniqueConstraint(1).addColumnName(0, "BAR");
- javaSecondaryTable.addUniqueConstraint(2).addColumnName(0, "BAZ");
-
- uniqueConstraints = ormSecondaryTable.uniqueConstraints();
- assertTrue(uniqueConstraints.hasNext());
- assertEquals("FOO", uniqueConstraints.next().columnNames().next());
- assertEquals("BAR", uniqueConstraints.next().columnNames().next());
- assertEquals("BAZ", uniqueConstraints.next().columnNames().next());
- assertFalse(uniqueConstraints.hasNext());
-
- ormEntity.setSecondaryTablesDefinedInXml(true);
- OrmSecondaryTable ormSecondaryTable2 = ormEntity.secondaryTables().next();
- ormSecondaryTable2.setSpecifiedName("SECONDARY");
-
- assertEquals("SECONDARY", ormSecondaryTable.getSpecifiedName());
- assertFalse(ormSecondaryTable2.isVirtual());
- assertEquals(0, ormSecondaryTable2.uniqueConstraintsSize());
- }
-} \ No newline at end of file
diff --git a/jpa/tests/org.eclipse.jpt.core.tests/src/org/eclipse/jpt/core/tests/internal/context/orm/OrmSequenceGeneratorTests.java b/jpa/tests/org.eclipse.jpt.core.tests/src/org/eclipse/jpt/core/tests/internal/context/orm/OrmSequenceGeneratorTests.java
deleted file mode 100644
index 08ea9fb7f9..0000000000
--- a/jpa/tests/org.eclipse.jpt.core.tests/src/org/eclipse/jpt/core/tests/internal/context/orm/OrmSequenceGeneratorTests.java
+++ /dev/null
@@ -1,172 +0,0 @@
-/*******************************************************************************
- * Copyright (c) 2007, 2009 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.
- *
- * Contributors:
- * Oracle - initial API and implementation
- ******************************************************************************/
-package org.eclipse.jpt.core.tests.internal.context.orm;
-
-import org.eclipse.jpt.core.JptCorePlugin;
-import org.eclipse.jpt.core.context.SequenceGenerator;
-import org.eclipse.jpt.core.resource.orm.XmlSequenceGenerator;
-import org.eclipse.jpt.core.resource.persistence.PersistenceFactory;
-import org.eclipse.jpt.core.resource.persistence.XmlMappingFileRef;
-import org.eclipse.jpt.core.tests.internal.context.ContextModelTestCase;
-
-@SuppressWarnings("nls")
-public class OrmSequenceGeneratorTests extends ContextModelTestCase
-{
- public OrmSequenceGeneratorTests(String name) {
- super(name);
- }
-
- @Override
- protected void setUp() throws Exception {
- super.setUp();
- XmlMappingFileRef mappingFileRef = PersistenceFactory.eINSTANCE.createXmlMappingFileRef();
- mappingFileRef.setFileName(JptCorePlugin.DEFAULT_ORM_XML_FILE_PATH);
- getXmlPersistenceUnit().getMappingFiles().add(mappingFileRef);
- getPersistenceXmlResource().save(null);
- }
-
- public void testUpdateSpecifiedName() throws Exception {
- SequenceGenerator sequenceGenerator = getEntityMappings().addSequenceGenerator(0);
- XmlSequenceGenerator sequenceGeneratorResource = getXmlEntityMappings().getSequenceGenerators().get(0);
-
- //set name in the resource model, verify context model updated
- sequenceGeneratorResource.setName("FOO");
- assertEquals("FOO", sequenceGenerator.getName());
- assertEquals("FOO", sequenceGeneratorResource.getName());
-
- //set name to null in the resource model
- sequenceGeneratorResource.setName(null);
- assertNull(sequenceGenerator.getName());
- assertNull(sequenceGeneratorResource.getName());
- }
-
- public void testModifySpecifiedName() throws Exception {
- SequenceGenerator sequenceGenerator = getEntityMappings().addSequenceGenerator(0);
- XmlSequenceGenerator sequenceGeneratorResource = getXmlEntityMappings().getSequenceGenerators().get(0);
-
- //set name in the context model, verify resource model modified
- sequenceGenerator.setName("FOO");
- assertEquals("FOO", sequenceGeneratorResource.getName());
- assertEquals("FOO", sequenceGenerator.getName());
-
- //set name to null in the context model
- sequenceGenerator.setName(null);
- assertNull(sequenceGeneratorResource.getName());
- assertNull(sequenceGenerator.getName());
- }
-
- public void testUpdateSpecifiedSequenceName() throws Exception {
- SequenceGenerator sequenceGenerator = getEntityMappings().addSequenceGenerator(0);
- XmlSequenceGenerator sequenceGeneratorResource = getXmlEntityMappings().getSequenceGenerators().get(0);
-
- //set name in the resource model, verify context model updated
- sequenceGeneratorResource.setSequenceName("FOO");
- assertEquals("FOO", sequenceGenerator.getSpecifiedSequenceName());
- assertEquals("FOO", sequenceGeneratorResource.getSequenceName());
-
- //set name to null in the resource model
- sequenceGeneratorResource.setSequenceName(null);
- assertNull(sequenceGenerator.getSpecifiedSequenceName());
- assertNull(sequenceGeneratorResource.getSequenceName());
- }
-
- public void testModifySpecifiedSequenceName() throws Exception {
- SequenceGenerator sequenceGenerator = getEntityMappings().addSequenceGenerator(0);
- XmlSequenceGenerator sequenceGeneratorResource = getXmlEntityMappings().getSequenceGenerators().get(0);
-
- //set name in the context model, verify resource model modified
- sequenceGenerator.setSpecifiedSequenceName("FOO");
- assertEquals("FOO", sequenceGeneratorResource.getSequenceName());
- assertEquals("FOO", sequenceGenerator.getSpecifiedSequenceName());
-
- //set name to null in the context model
- sequenceGenerator.setSpecifiedSequenceName(null);
- assertNull(sequenceGeneratorResource.getSequenceName());
- assertNull(sequenceGenerator.getSpecifiedSequenceName());
- }
-
- public void testUpdateSpecifiedInitialValue() throws Exception {
- SequenceGenerator sequenceGenerator = getEntityMappings().addSequenceGenerator(0);
- XmlSequenceGenerator sequenceGeneratorResource = getXmlEntityMappings().getSequenceGenerators().get(0);
-
- //set initial value in the resource model, verify context model updated
- sequenceGeneratorResource.setInitialValue(Integer.valueOf(10));
- assertEquals(Integer.valueOf(10), sequenceGenerator.getSpecifiedInitialValue());
- assertEquals(Integer.valueOf(10), sequenceGeneratorResource.getInitialValue());
-
- //set initial value to 1, which happens to be the default, in the resource model
- sequenceGeneratorResource.setInitialValue(Integer.valueOf(1));
- assertEquals(Integer.valueOf(1), sequenceGenerator.getSpecifiedInitialValue());
- assertEquals(Integer.valueOf(1), sequenceGeneratorResource.getInitialValue());
-
- //set initial value to null in the resource model
- sequenceGeneratorResource.setInitialValue(null);
- assertNull(sequenceGenerator.getSpecifiedInitialValue());
- assertNull(sequenceGeneratorResource.getInitialValue());
- }
-
- public void testModifySpecifiedInitialValue() throws Exception {
- SequenceGenerator sequenceGenerator = getEntityMappings().addSequenceGenerator(0);
- XmlSequenceGenerator sequenceGeneratorResource = getXmlEntityMappings().getSequenceGenerators().get(0);
-
- //set initial value in the context model, verify resource model modified
- sequenceGenerator.setSpecifiedInitialValue(Integer.valueOf(10));
- assertEquals(Integer.valueOf(10), sequenceGeneratorResource.getInitialValue());
- assertEquals(Integer.valueOf(10), sequenceGenerator.getSpecifiedInitialValue());
-
- sequenceGenerator.setSpecifiedInitialValue(Integer.valueOf(1));
- assertEquals(Integer.valueOf(1), sequenceGeneratorResource.getInitialValue());
- assertEquals(Integer.valueOf(1), sequenceGenerator.getSpecifiedInitialValue());
-
- //set initial value to null in the context model
- sequenceGenerator.setSpecifiedInitialValue(null);
- assertNull(sequenceGeneratorResource.getInitialValue());
- assertNull(sequenceGenerator.getSpecifiedInitialValue());
- }
-
- public void testUpdateSpecifiedAllocationSize() throws Exception {
- SequenceGenerator sequenceGenerator = getEntityMappings().addSequenceGenerator(0);
- XmlSequenceGenerator sequenceGeneratorResource = getXmlEntityMappings().getSequenceGenerators().get(0);
-
- //set allocation size in the resource model, verify context model updated
- sequenceGeneratorResource.setAllocationSize(Integer.valueOf(10));
- assertEquals(Integer.valueOf(10), sequenceGenerator.getSpecifiedAllocationSize());
- assertEquals(Integer.valueOf(10), sequenceGeneratorResource.getAllocationSize());
-
- //set allocation size to 50, which happens to be the default, in the resource model
- sequenceGeneratorResource.setAllocationSize(Integer.valueOf(1));
- assertEquals(Integer.valueOf(1), sequenceGenerator.getSpecifiedAllocationSize());
- assertEquals(Integer.valueOf(1), sequenceGeneratorResource.getAllocationSize());
-
- //set allocation size to null in the resource model
- sequenceGeneratorResource.setAllocationSize(null);
- assertNull(sequenceGenerator.getSpecifiedAllocationSize());
- assertNull(sequenceGeneratorResource.getAllocationSize());
- }
-
- public void testModifySpecifiedAllocationSize() throws Exception {
- SequenceGenerator sequenceGenerator = getEntityMappings().addSequenceGenerator(0);
- XmlSequenceGenerator sequenceGeneratorResource = getXmlEntityMappings().getSequenceGenerators().get(0);
-
- //set allocation size in the context model, verify resource model modified
- sequenceGenerator.setSpecifiedAllocationSize(Integer.valueOf(10));
- assertEquals(Integer.valueOf(10), sequenceGeneratorResource.getAllocationSize());
- assertEquals(Integer.valueOf(10), sequenceGenerator.getSpecifiedAllocationSize());
-
- sequenceGenerator.setSpecifiedAllocationSize(Integer.valueOf(50));
- assertEquals(Integer.valueOf(50), sequenceGeneratorResource.getAllocationSize());
- assertEquals(Integer.valueOf(50), sequenceGenerator.getSpecifiedAllocationSize());
-
- //set allocation size to null in the context model
- sequenceGenerator.setSpecifiedAllocationSize(null);
- assertNull(sequenceGeneratorResource.getAllocationSize());
- assertNull(sequenceGenerator.getSpecifiedAllocationSize());
- }
-} \ No newline at end of file
diff --git a/jpa/tests/org.eclipse.jpt.core.tests/src/org/eclipse/jpt/core/tests/internal/context/orm/OrmTableGeneratorTests.java b/jpa/tests/org.eclipse.jpt.core.tests/src/org/eclipse/jpt/core/tests/internal/context/orm/OrmTableGeneratorTests.java
deleted file mode 100644
index 26de24eb81..0000000000
--- a/jpa/tests/org.eclipse.jpt.core.tests/src/org/eclipse/jpt/core/tests/internal/context/orm/OrmTableGeneratorTests.java
+++ /dev/null
@@ -1,604 +0,0 @@
-/*******************************************************************************
- * Copyright (c) 2007, 2009 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.
- *
- * Contributors:
- * Oracle - initial API and implementation
- ******************************************************************************/
-package org.eclipse.jpt.core.tests.internal.context.orm;
-
-import java.util.Iterator;
-import java.util.ListIterator;
-import org.eclipse.jdt.core.ICompilationUnit;
-import org.eclipse.jpt.core.JptCorePlugin;
-import org.eclipse.jpt.core.MappingKeys;
-import org.eclipse.jpt.core.context.TableGenerator;
-import org.eclipse.jpt.core.context.UniqueConstraint;
-import org.eclipse.jpt.core.context.java.JavaIdMapping;
-import org.eclipse.jpt.core.context.java.JavaTableGenerator;
-import org.eclipse.jpt.core.context.orm.OrmIdMapping;
-import org.eclipse.jpt.core.context.orm.OrmPersistentType;
-import org.eclipse.jpt.core.context.orm.OrmTableGenerator;
-import org.eclipse.jpt.core.context.orm.OrmUniqueConstraint;
-import org.eclipse.jpt.core.resource.java.JPA;
-import org.eclipse.jpt.core.resource.orm.OrmFactory;
-import org.eclipse.jpt.core.resource.orm.XmlTableGenerator;
-import org.eclipse.jpt.core.resource.orm.XmlUniqueConstraint;
-import org.eclipse.jpt.core.resource.persistence.PersistenceFactory;
-import org.eclipse.jpt.core.resource.persistence.XmlMappingFileRef;
-import org.eclipse.jpt.core.tests.internal.context.ContextModelTestCase;
-import org.eclipse.jpt.utility.internal.iterators.ArrayIterator;
-
-@SuppressWarnings("nls")
-public class OrmTableGeneratorTests extends ContextModelTestCase
-{
- public OrmTableGeneratorTests(String name) {
- super(name);
- }
-
- @Override
- protected void setUp() throws Exception {
- super.setUp();
- XmlMappingFileRef mappingFileRef = PersistenceFactory.eINSTANCE.createXmlMappingFileRef();
- mappingFileRef.setFileName(JptCorePlugin.DEFAULT_ORM_XML_FILE_PATH);
- getXmlPersistenceUnit().getMappingFiles().add(mappingFileRef);
- getPersistenceXmlResource().save(null);
- }
-
- private ICompilationUnit createTestEntity() 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("@Id");
- }
- });
- }
-
- public void testUpdateSpecifiedName() throws Exception {
- TableGenerator tableGenerator = getEntityMappings().addTableGenerator(0);
- XmlTableGenerator tableGeneratorResource = getXmlEntityMappings().getTableGenerators().get(0);
-
- //set name in the resource model, verify context model updated
- tableGeneratorResource.setName("FOO");
- assertEquals("FOO", tableGenerator.getName());
- assertEquals("FOO", tableGeneratorResource.getName());
-
- //set name to null in the resource model
- tableGeneratorResource.setName(null);
- assertNull(tableGenerator.getName());
- assertNull(tableGeneratorResource.getName());
- }
-
- public void testModifySpecifiedName() throws Exception {
- TableGenerator tableGenerator = getEntityMappings().addTableGenerator(0);
- XmlTableGenerator tableGeneratorResource = getXmlEntityMappings().getTableGenerators().get(0);
-
- //set name in the context model, verify resource model modified
- tableGenerator.setName("FOO");
- assertEquals("FOO", tableGeneratorResource.getName());
- assertEquals("FOO", tableGenerator.getName());
-
- //set name to null in the context model
- tableGenerator.setName(null);
- assertNull(tableGeneratorResource.getName());
- assertNull(tableGenerator.getName());
- }
-
- public void testUpdateSpecifiedInitialValue() throws Exception {
- TableGenerator tableGenerator = getEntityMappings().addTableGenerator(0);
- XmlTableGenerator tableGeneratorResource = getXmlEntityMappings().getTableGenerators().get(0);
-
- //set initial value in the resource model, verify context model updated
- tableGeneratorResource.setInitialValue(Integer.valueOf(10));
- assertEquals(Integer.valueOf(10), tableGenerator.getSpecifiedInitialValue());
- assertEquals(Integer.valueOf(10), tableGeneratorResource.getInitialValue());
-
- //set initial value to 1, which happens to be the default, in the resource model
- tableGeneratorResource.setInitialValue(Integer.valueOf(1));
- assertEquals(Integer.valueOf(1), tableGenerator.getSpecifiedInitialValue());
- assertEquals(Integer.valueOf(1), tableGeneratorResource.getInitialValue());
-
- //set initial value to null in the resource model
- tableGeneratorResource.setInitialValue(null);
- assertNull(tableGenerator.getSpecifiedInitialValue());
- assertNull(tableGeneratorResource.getInitialValue());
- }
-
- public void testModifySpecifiedInitialValue() throws Exception {
- TableGenerator tableGenerator = getEntityMappings().addTableGenerator(0);
- XmlTableGenerator tableGeneratorResource = getXmlEntityMappings().getTableGenerators().get(0);
-
- //set initial value in the context model, verify resource model modified
- tableGenerator.setSpecifiedInitialValue(Integer.valueOf(10));
- assertEquals(Integer.valueOf(10), tableGeneratorResource.getInitialValue());
- assertEquals(Integer.valueOf(10), tableGenerator.getSpecifiedInitialValue());
-
- tableGenerator.setSpecifiedInitialValue(Integer.valueOf(1));
- assertEquals(Integer.valueOf(1), tableGeneratorResource.getInitialValue());
- assertEquals(Integer.valueOf(1), tableGenerator.getSpecifiedInitialValue());
-
- //set initial value to null in the context model
- tableGenerator.setSpecifiedInitialValue(null);
- assertNull(tableGeneratorResource.getInitialValue());
- assertNull(tableGenerator.getSpecifiedInitialValue());
- }
-
- public void testUpdateSpecifiedAllocationSize() throws Exception {
- TableGenerator tableGenerator = getEntityMappings().addTableGenerator(0);
- XmlTableGenerator tableGeneratorResource = getXmlEntityMappings().getTableGenerators().get(0);
-
- //set allocation size in the resource model, verify context model updated
- tableGeneratorResource.setAllocationSize(Integer.valueOf(10));
- assertEquals(Integer.valueOf(10), tableGenerator.getSpecifiedAllocationSize());
- assertEquals(Integer.valueOf(10), tableGeneratorResource.getAllocationSize());
-
- //set allocation size to 50, which happens to be the default, in the resource model
- tableGeneratorResource.setAllocationSize(Integer.valueOf(1));
- assertEquals(Integer.valueOf(1), tableGenerator.getSpecifiedAllocationSize());
- assertEquals(Integer.valueOf(1), tableGeneratorResource.getAllocationSize());
-
- //set allocation size to null in the resource model
- tableGeneratorResource.setAllocationSize(null);
- assertNull(tableGenerator.getSpecifiedAllocationSize());
- assertNull(tableGeneratorResource.getAllocationSize());
- }
-
- public void testModifySpecifiedAllocationSize() throws Exception {
- TableGenerator tableGenerator = getEntityMappings().addTableGenerator(0);
- XmlTableGenerator tableGeneratorResource = getXmlEntityMappings().getTableGenerators().get(0);
-
- //set allocation size in the context model, verify resource model modified
- tableGenerator.setSpecifiedAllocationSize(Integer.valueOf(10));
- assertEquals(Integer.valueOf(10), tableGeneratorResource.getAllocationSize());
- assertEquals(Integer.valueOf(10), tableGenerator.getSpecifiedAllocationSize());
-
- tableGenerator.setSpecifiedAllocationSize(Integer.valueOf(50));
- assertEquals(Integer.valueOf(50), tableGeneratorResource.getAllocationSize());
- assertEquals(Integer.valueOf(50), tableGenerator.getSpecifiedAllocationSize());
-
- //set allocation size to null in the context model
- tableGenerator.setSpecifiedAllocationSize(null);
- assertNull(tableGeneratorResource.getAllocationSize());
- assertNull(tableGenerator.getSpecifiedAllocationSize());
- }
-
- public void testUpdateSpecifiedTable() throws Exception {
- TableGenerator tableGenerator = getEntityMappings().addTableGenerator(0);
- XmlTableGenerator tableGeneratorResource = getXmlEntityMappings().getTableGenerators().get(0);
-
- //set name in the resource model, verify context model updated
- tableGeneratorResource.setTable("FOO");
- assertEquals("FOO", tableGenerator.getSpecifiedTable());
- assertEquals("FOO", tableGeneratorResource.getTable());
-
- //set name to null in the resource model
- tableGeneratorResource.setTable(null);
- assertNull(tableGenerator.getSpecifiedTable());
- assertNull(tableGeneratorResource.getTable());
- }
-
- public void testModifySpecifiedTable() throws Exception {
- TableGenerator tableGenerator = getEntityMappings().addTableGenerator(0);
- XmlTableGenerator tableGeneratorResource = getXmlEntityMappings().getTableGenerators().get(0);
-
- //set name in the context model, verify resource model modified
- tableGenerator.setSpecifiedTable("FOO");
- assertEquals("FOO", tableGeneratorResource.getTable());
- assertEquals("FOO", tableGenerator.getSpecifiedTable());
-
- //set name to null in the context model
- tableGenerator.setSpecifiedTable(null);
- assertNull(tableGeneratorResource.getTable());
- assertNull(tableGenerator.getSpecifiedTable());
- }
-
- public void testUpdateSpecifiedSchema() throws Exception {
- TableGenerator tableGenerator = getEntityMappings().addTableGenerator(0);
- XmlTableGenerator tableGeneratorResource = getXmlEntityMappings().getTableGenerators().get(0);
-
- //set name in the resource model, verify context model updated
- tableGeneratorResource.setSchema("FOO");
- assertEquals("FOO", tableGenerator.getSpecifiedSchema());
- assertEquals("FOO", tableGeneratorResource.getSchema());
-
- //set name to null in the resource model
- tableGeneratorResource.setSchema(null);
- assertNull(tableGenerator.getSpecifiedSchema());
- assertNull(tableGeneratorResource.getSchema());
- }
-
- public void testModifySpecifiedSchema() throws Exception {
- TableGenerator tableGenerator = getEntityMappings().addTableGenerator(0);
- XmlTableGenerator tableGeneratorResource = getXmlEntityMappings().getTableGenerators().get(0);
-
- //set name in the context model, verify resource model modified
- tableGenerator.setSpecifiedSchema("FOO");
- assertEquals("FOO", tableGeneratorResource.getSchema());
- assertEquals("FOO", tableGenerator.getSpecifiedSchema());
-
- //set name to null in the context model
- tableGenerator.setSpecifiedSchema(null);
- assertNull(tableGeneratorResource.getSchema());
- assertNull(tableGenerator.getSpecifiedSchema());
- }
-
- public void testUpdateDefaultSchemaFromPersistenceUnitDefaults() throws Exception {
- TableGenerator tableGenerator = getEntityMappings().addTableGenerator(0);
-
- assertNull(tableGenerator.getDefaultSchema());
-
- getEntityMappings().getPersistenceUnitMetadata().getPersistenceUnitDefaults().setSpecifiedSchema("FOO");
- assertEquals("FOO", tableGenerator.getDefaultSchema());
-
- getEntityMappings().setSpecifiedSchema("BAR");
- assertEquals("BAR", tableGenerator.getDefaultSchema());
- }
-
- public void testUpdateSpecifiedCatalog() throws Exception {
- TableGenerator tableGenerator = getEntityMappings().addTableGenerator(0);
- XmlTableGenerator tableGeneratorResource = getXmlEntityMappings().getTableGenerators().get(0);
-
- //set name in the resource model, verify context model updated
- tableGeneratorResource.setCatalog("FOO");
- assertEquals("FOO", tableGenerator.getSpecifiedCatalog());
- assertEquals("FOO", tableGeneratorResource.getCatalog());
-
- //set name to null in the resource model
- tableGeneratorResource.setCatalog(null);
- assertNull(tableGenerator.getSpecifiedCatalog());
- assertNull(tableGeneratorResource.getCatalog());
- }
-
- public void testModifySpecifiedCatalog() throws Exception {
- TableGenerator tableGenerator = getEntityMappings().addTableGenerator(0);
- XmlTableGenerator tableGeneratorResource = getXmlEntityMappings().getTableGenerators().get(0);
-
- //set name in the context model, verify resource model modified
- tableGenerator.setSpecifiedCatalog("FOO");
- assertEquals("FOO", tableGeneratorResource.getCatalog());
- assertEquals("FOO", tableGenerator.getSpecifiedCatalog());
-
- //set name to null in the context model
- tableGenerator.setSpecifiedCatalog(null);
- assertNull(tableGeneratorResource.getCatalog());
- assertNull(tableGenerator.getSpecifiedCatalog());
- }
-
- public void testUpdateSpecifiedPkColumnName() throws Exception {
- TableGenerator tableGenerator = getEntityMappings().addTableGenerator(0);
- XmlTableGenerator tableGeneratorResource = getXmlEntityMappings().getTableGenerators().get(0);
-
- //set name in the resource model, verify context model updated
- tableGeneratorResource.setPkColumnName("FOO");
- assertEquals("FOO", tableGenerator.getSpecifiedPkColumnName());
- assertEquals("FOO", tableGeneratorResource.getPkColumnName());
-
- //set name to null in the resource model
- tableGeneratorResource.setPkColumnName(null);
- assertNull(tableGenerator.getSpecifiedPkColumnName());
- assertNull(tableGeneratorResource.getPkColumnName());
- }
-
- public void testModifySpecifiedPkColumnName() throws Exception {
- TableGenerator tableGenerator = getEntityMappings().addTableGenerator(0);
- XmlTableGenerator tableGeneratorResource = getXmlEntityMappings().getTableGenerators().get(0);
-
- //set name in the context model, verify resource model modified
- tableGenerator.setSpecifiedPkColumnName("FOO");
- assertEquals("FOO", tableGeneratorResource.getPkColumnName());
- assertEquals("FOO", tableGenerator.getSpecifiedPkColumnName());
-
- //set name to null in the context model
- tableGenerator.setSpecifiedPkColumnName(null);
- assertNull(tableGeneratorResource.getPkColumnName());
- assertNull(tableGenerator.getSpecifiedPkColumnName());
- }
-
- public void testUpdateSpecifiedValueColumnName() throws Exception {
- TableGenerator tableGenerator = getEntityMappings().addTableGenerator(0);
- XmlTableGenerator tableGeneratorResource = getXmlEntityMappings().getTableGenerators().get(0);
-
- //set name in the resource model, verify context model updated
- tableGeneratorResource.setValueColumnName("FOO");
- assertEquals("FOO", tableGenerator.getSpecifiedValueColumnName());
- assertEquals("FOO", tableGeneratorResource.getValueColumnName());
-
- //set name to null in the resource model
- tableGeneratorResource.setValueColumnName(null);
- assertNull(tableGenerator.getSpecifiedValueColumnName());
- assertNull(tableGeneratorResource.getValueColumnName());
- }
-
- public void testModifySpecifiedValueColumnName() throws Exception {
- TableGenerator tableGenerator = getEntityMappings().addTableGenerator(0);
- XmlTableGenerator tableGeneratorResource = getXmlEntityMappings().getTableGenerators().get(0);
-
- //set name in the context model, verify resource model modified
- tableGenerator.setSpecifiedValueColumnName("FOO");
- assertEquals("FOO", tableGeneratorResource.getValueColumnName());
- assertEquals("FOO", tableGenerator.getSpecifiedValueColumnName());
-
- //set name to null in the context model
- tableGenerator.setSpecifiedValueColumnName(null);
- assertNull(tableGeneratorResource.getValueColumnName());
- assertNull(tableGenerator.getSpecifiedValueColumnName());
- }
-
- public void testUpdateSpecifiedPkColumnValue() throws Exception {
- TableGenerator tableGenerator = getEntityMappings().addTableGenerator(0);
- XmlTableGenerator tableGeneratorResource = getXmlEntityMappings().getTableGenerators().get(0);
-
- //set name in the resource model, verify context model updated
- tableGeneratorResource.setPkColumnValue("FOO");
- assertEquals("FOO", tableGenerator.getSpecifiedPkColumnValue());
- assertEquals("FOO", tableGeneratorResource.getPkColumnValue());
-
- //set name to null in the resource model
- tableGeneratorResource.setPkColumnValue(null);
- assertNull(tableGenerator.getSpecifiedPkColumnValue());
- assertNull(tableGeneratorResource.getPkColumnValue());
- }
-
- public void testModifySpecifiedPkColumnValue() throws Exception {
- TableGenerator tableGenerator = getEntityMappings().addTableGenerator(0);
- XmlTableGenerator tableGeneratorResource = getXmlEntityMappings().getTableGenerators().get(0);
-
- //set name in the context model, verify resource model modified
- tableGenerator.setSpecifiedPkColumnValue("FOO");
- assertEquals("FOO", tableGeneratorResource.getPkColumnValue());
- assertEquals("FOO", tableGenerator.getSpecifiedPkColumnValue());
-
- //set name to null in the context model
- tableGenerator.setSpecifiedPkColumnValue(null);
- assertNull(tableGeneratorResource.getPkColumnValue());
- assertNull(tableGenerator.getSpecifiedPkColumnValue());
- }
-
-
- public void testUniqueConstraints() throws Exception {
- TableGenerator tableGenerator = getEntityMappings().addTableGenerator(0);
- XmlTableGenerator tableGeneratorResource = getXmlEntityMappings().getTableGenerators().get(0);
-
- ListIterator<OrmUniqueConstraint> uniqueConstraints = tableGenerator.uniqueConstraints();
- assertFalse(uniqueConstraints.hasNext());
-
- XmlUniqueConstraint uniqueConstraintResource = OrmFactory.eINSTANCE.createXmlUniqueConstraint();
- tableGeneratorResource.getUniqueConstraints().add(0, uniqueConstraintResource);
- uniqueConstraintResource.getColumnNames().add(0, "foo");
-
- uniqueConstraintResource = OrmFactory.eINSTANCE.createXmlUniqueConstraint();
- tableGeneratorResource.getUniqueConstraints().add(0, uniqueConstraintResource);
- uniqueConstraintResource.getColumnNames().add(0, "bar");
-
- uniqueConstraints = tableGenerator.uniqueConstraints();
- assertTrue(uniqueConstraints.hasNext());
- assertEquals("bar", uniqueConstraints.next().columnNames().next());
- assertEquals("foo", uniqueConstraints.next().columnNames().next());
- assertFalse(uniqueConstraints.hasNext());
- }
-
- public void testUniqueConstraintsSize() throws Exception {
- TableGenerator tableGenerator = getEntityMappings().addTableGenerator(0);
- XmlTableGenerator tableGeneratorResource = getXmlEntityMappings().getTableGenerators().get(0);
-
- assertEquals(0, tableGenerator.uniqueConstraintsSize());
-
- XmlUniqueConstraint uniqueConstraintResource = OrmFactory.eINSTANCE.createXmlUniqueConstraint();
- tableGeneratorResource.getUniqueConstraints().add(0, uniqueConstraintResource);
- uniqueConstraintResource.getColumnNames().add(0, "foo");
-
- uniqueConstraintResource = OrmFactory.eINSTANCE.createXmlUniqueConstraint();
- tableGeneratorResource.getUniqueConstraints().add(1, uniqueConstraintResource);
- uniqueConstraintResource.getColumnNames().add(0, "bar");
-
- assertEquals(2, tableGenerator.uniqueConstraintsSize());
- }
-
- public void testAddUniqueConstraint() throws Exception {
- TableGenerator tableGenerator = getEntityMappings().addTableGenerator(0);
- XmlTableGenerator tableGeneratorResource = getXmlEntityMappings().getTableGenerators().get(0);
-
- tableGenerator.addUniqueConstraint(0).addColumnName(0, "FOO");
- tableGenerator.addUniqueConstraint(0).addColumnName(0, "BAR");
- tableGenerator.addUniqueConstraint(0).addColumnName(0, "BAZ");
-
- ListIterator<XmlUniqueConstraint> uniqueConstraints = tableGeneratorResource.getUniqueConstraints().listIterator();
-
- assertEquals("BAZ", uniqueConstraints.next().getColumnNames().get(0));
- assertEquals("BAR", uniqueConstraints.next().getColumnNames().get(0));
- assertEquals("FOO", uniqueConstraints.next().getColumnNames().get(0));
- assertFalse(uniqueConstraints.hasNext());
- }
-
- public void testAddUniqueConstraint2() throws Exception {
- TableGenerator tableGenerator = getEntityMappings().addTableGenerator(0);
- XmlTableGenerator tableGeneratorResource = getXmlEntityMappings().getTableGenerators().get(0);
-
- tableGenerator.addUniqueConstraint(0).addColumnName(0, "FOO");
- tableGenerator.addUniqueConstraint(1).addColumnName(0, "BAR");
- tableGenerator.addUniqueConstraint(0).addColumnName(0, "BAZ");
-
- ListIterator<XmlUniqueConstraint> uniqueConstraints = tableGeneratorResource.getUniqueConstraints().listIterator();
-
- assertEquals("BAZ", uniqueConstraints.next().getColumnNames().get(0));
- assertEquals("FOO", uniqueConstraints.next().getColumnNames().get(0));
- assertEquals("BAR", uniqueConstraints.next().getColumnNames().get(0));
- assertFalse(uniqueConstraints.hasNext());
- }
-
- public void testRemoveUniqueConstraint() throws Exception {
- TableGenerator tableGenerator = getEntityMappings().addTableGenerator(0);
- XmlTableGenerator tableGeneratorResource = getXmlEntityMappings().getTableGenerators().get(0);
-
- tableGenerator.addUniqueConstraint(0).addColumnName(0, "FOO");
- tableGenerator.addUniqueConstraint(1).addColumnName(0, "BAR");
- tableGenerator.addUniqueConstraint(2).addColumnName(0, "BAZ");
-
- assertEquals(3, tableGeneratorResource.getUniqueConstraints().size());
-
- tableGenerator.removeUniqueConstraint(1);
-
- ListIterator<XmlUniqueConstraint> uniqueConstraintResources = tableGeneratorResource.getUniqueConstraints().listIterator();
- assertEquals("FOO", uniqueConstraintResources.next().getColumnNames().get(0));
- assertEquals("BAZ", uniqueConstraintResources.next().getColumnNames().get(0));
- assertFalse(uniqueConstraintResources.hasNext());
-
- Iterator<UniqueConstraint> uniqueConstraints = tableGenerator.uniqueConstraints();
- assertEquals("FOO", uniqueConstraints.next().columnNames().next());
- assertEquals("BAZ", uniqueConstraints.next().columnNames().next());
- assertFalse(uniqueConstraints.hasNext());
-
-
- tableGenerator.removeUniqueConstraint(1);
- uniqueConstraintResources = tableGeneratorResource.getUniqueConstraints().listIterator();
- assertEquals("FOO", uniqueConstraintResources.next().getColumnNames().get(0));
- assertFalse(uniqueConstraintResources.hasNext());
-
- uniqueConstraints = tableGenerator.uniqueConstraints();
- assertEquals("FOO", uniqueConstraints.next().columnNames().next());
- assertFalse(uniqueConstraints.hasNext());
-
-
- tableGenerator.removeUniqueConstraint(0);
- uniqueConstraintResources = tableGeneratorResource.getUniqueConstraints().listIterator();
- assertFalse(uniqueConstraintResources.hasNext());
- uniqueConstraints = tableGenerator.uniqueConstraints();
- assertFalse(uniqueConstraints.hasNext());
- }
-
- public void testMoveUniqueConstraint() throws Exception {
- TableGenerator tableGenerator = getEntityMappings().addTableGenerator(0);
- XmlTableGenerator tableGeneratorResource = getXmlEntityMappings().getTableGenerators().get(0);
-
- tableGenerator.addUniqueConstraint(0).addColumnName(0, "FOO");
- tableGenerator.addUniqueConstraint(1).addColumnName(0, "BAR");
- tableGenerator.addUniqueConstraint(2).addColumnName(0, "BAZ");
-
- assertEquals(3, tableGeneratorResource.getUniqueConstraints().size());
-
-
- tableGenerator.moveUniqueConstraint(2, 0);
- ListIterator<UniqueConstraint> uniqueConstraints = tableGenerator.uniqueConstraints();
- assertEquals("BAR", uniqueConstraints.next().columnNames().next());
- assertEquals("BAZ", uniqueConstraints.next().columnNames().next());
- assertEquals("FOO", uniqueConstraints.next().columnNames().next());
-
- ListIterator<XmlUniqueConstraint> uniqueConstraintResources = tableGeneratorResource.getUniqueConstraints().listIterator();
- assertEquals("BAR", uniqueConstraintResources.next().getColumnNames().get(0));
- assertEquals("BAZ", uniqueConstraintResources.next().getColumnNames().get(0));
- assertEquals("FOO", uniqueConstraintResources.next().getColumnNames().get(0));
-
-
- tableGenerator.moveUniqueConstraint(0, 1);
- uniqueConstraints = tableGenerator.uniqueConstraints();
- assertEquals("BAZ", uniqueConstraints.next().columnNames().next());
- assertEquals("BAR", uniqueConstraints.next().columnNames().next());
- assertEquals("FOO", uniqueConstraints.next().columnNames().next());
-
- uniqueConstraintResources = tableGeneratorResource.getUniqueConstraints().listIterator();
- assertEquals("BAZ", uniqueConstraintResources.next().getColumnNames().get(0));
- assertEquals("BAR", uniqueConstraintResources.next().getColumnNames().get(0));
- assertEquals("FOO", uniqueConstraintResources.next().getColumnNames().get(0));
- }
-
- public void testUpdateUniqueConstraints() throws Exception {
- TableGenerator tableGenerator = getEntityMappings().addTableGenerator(0);
- XmlTableGenerator tableGeneratorResource = getXmlEntityMappings().getTableGenerators().get(0);
-
- XmlUniqueConstraint uniqueConstraintResource = OrmFactory.eINSTANCE.createXmlUniqueConstraint();
- tableGeneratorResource.getUniqueConstraints().add(0, uniqueConstraintResource);
- uniqueConstraintResource.getColumnNames().add(0, "FOO");
-
- uniqueConstraintResource = OrmFactory.eINSTANCE.createXmlUniqueConstraint();
- tableGeneratorResource.getUniqueConstraints().add(1, uniqueConstraintResource);
- uniqueConstraintResource.getColumnNames().add(0, "BAR");
-
- uniqueConstraintResource = OrmFactory.eINSTANCE.createXmlUniqueConstraint();
- tableGeneratorResource.getUniqueConstraints().add(2, uniqueConstraintResource);
- uniqueConstraintResource.getColumnNames().add(0, "BAZ");
-
-
- ListIterator<UniqueConstraint> uniqueConstraints = tableGenerator.uniqueConstraints();
- assertEquals("FOO", uniqueConstraints.next().columnNames().next());
- assertEquals("BAR", uniqueConstraints.next().columnNames().next());
- assertEquals("BAZ", uniqueConstraints.next().columnNames().next());
- assertFalse(uniqueConstraints.hasNext());
-
- tableGeneratorResource.getUniqueConstraints().move(2, 0);
- uniqueConstraints = tableGenerator.uniqueConstraints();
- assertEquals("BAR", uniqueConstraints.next().columnNames().next());
- assertEquals("BAZ", uniqueConstraints.next().columnNames().next());
- assertEquals("FOO", uniqueConstraints.next().columnNames().next());
- assertFalse(uniqueConstraints.hasNext());
-
- tableGeneratorResource.getUniqueConstraints().move(0, 1);
- uniqueConstraints = tableGenerator.uniqueConstraints();
- assertEquals("BAZ", uniqueConstraints.next().columnNames().next());
- assertEquals("BAR", uniqueConstraints.next().columnNames().next());
- assertEquals("FOO", uniqueConstraints.next().columnNames().next());
- assertFalse(uniqueConstraints.hasNext());
-
- tableGeneratorResource.getUniqueConstraints().remove(1);
- uniqueConstraints = tableGenerator.uniqueConstraints();
- assertEquals("BAZ", uniqueConstraints.next().columnNames().next());
- assertEquals("FOO", uniqueConstraints.next().columnNames().next());
- assertFalse(uniqueConstraints.hasNext());
-
- tableGeneratorResource.getUniqueConstraints().remove(1);
- uniqueConstraints = tableGenerator.uniqueConstraints();
- assertEquals("BAZ", uniqueConstraints.next().columnNames().next());
- assertFalse(uniqueConstraints.hasNext());
-
- tableGeneratorResource.getUniqueConstraints().remove(0);
- uniqueConstraints = tableGenerator.uniqueConstraints();
- assertFalse(uniqueConstraints.hasNext());
- }
-
- public void testUniqueConstraintsFromJava() throws Exception {
- createTestEntity();
- OrmPersistentType ormPersistentType = getEntityMappings().addPersistentType(MappingKeys.ENTITY_TYPE_MAPPING_KEY, FULLY_QUALIFIED_TYPE_NAME);
-
- OrmIdMapping ormIdMapping = (OrmIdMapping) ormPersistentType.attributes().next().getMapping();
-
- JavaIdMapping javaIdMapping = (JavaIdMapping) ormPersistentType.getJavaPersistentType().attributes().next().getMapping();
- JavaTableGenerator javaTableGenerator = javaIdMapping.getGeneratorContainer().addTableGenerator();
- javaTableGenerator.setName("TABLE_GENERATOR");
-
- OrmTableGenerator ormTableGenerator = ormIdMapping.getGeneratorContainer().getTableGenerator();
- assertTrue(ormTableGenerator.isVirtual());
- ListIterator<OrmUniqueConstraint> uniqueConstraints = ormTableGenerator.uniqueConstraints();
- assertFalse(uniqueConstraints.hasNext());
-
-
- javaTableGenerator.addUniqueConstraint(0).addColumnName(0, "FOO");
- javaTableGenerator.addUniqueConstraint(1).addColumnName(0, "BAR");
- javaTableGenerator.addUniqueConstraint(2).addColumnName(0, "BAZ");
-
- uniqueConstraints = ormTableGenerator.uniqueConstraints();
- assertTrue(uniqueConstraints.hasNext());
- assertEquals("FOO", uniqueConstraints.next().columnNames().next());
- assertEquals("BAR", uniqueConstraints.next().columnNames().next());
- assertEquals("BAZ", uniqueConstraints.next().columnNames().next());
- assertFalse(uniqueConstraints.hasNext());
-
- ormIdMapping.getPersistentAttribute().makeSpecified();
- ormIdMapping = (OrmIdMapping) ormPersistentType.attributes().next().getMapping();
-
- OrmTableGenerator ormTableGenerator2 = ormIdMapping.getGeneratorContainer().addTableGenerator();
- ormTableGenerator2.setName("TABLE_GENERATOR");
-
- assertFalse(ormTableGenerator2.isVirtual());
- assertEquals(0, ormTableGenerator2.uniqueConstraintsSize());
- }
-
-} \ No newline at end of file
diff --git a/jpa/tests/org.eclipse.jpt.core.tests/src/org/eclipse/jpt/core/tests/internal/context/orm/OrmTableTests.java b/jpa/tests/org.eclipse.jpt.core.tests/src/org/eclipse/jpt/core/tests/internal/context/orm/OrmTableTests.java
deleted file mode 100644
index 347c17b152..0000000000
--- a/jpa/tests/org.eclipse.jpt.core.tests/src/org/eclipse/jpt/core/tests/internal/context/orm/OrmTableTests.java
+++ /dev/null
@@ -1,827 +0,0 @@
-/*******************************************************************************
- * Copyright (c) 2007, 2009 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.
- *
- * Contributors:
- * Oracle - initial API and implementation
- ******************************************************************************/
-package org.eclipse.jpt.core.tests.internal.context.orm;
-
-import java.util.Iterator;
-import java.util.ListIterator;
-import org.eclipse.jdt.core.ICompilationUnit;
-import org.eclipse.jpt.core.JptCorePlugin;
-import org.eclipse.jpt.core.MappingKeys;
-import org.eclipse.jpt.core.context.InheritanceType;
-import org.eclipse.jpt.core.context.orm.OrmEntity;
-import org.eclipse.jpt.core.context.orm.OrmPersistentType;
-import org.eclipse.jpt.core.context.orm.OrmTable;
-import org.eclipse.jpt.core.context.orm.OrmUniqueConstraint;
-import org.eclipse.jpt.core.resource.java.JPA;
-import org.eclipse.jpt.core.resource.orm.OrmFactory;
-import org.eclipse.jpt.core.resource.orm.XmlEntity;
-import org.eclipse.jpt.core.resource.orm.XmlTable;
-import org.eclipse.jpt.core.resource.orm.XmlUniqueConstraint;
-import org.eclipse.jpt.core.resource.persistence.PersistenceFactory;
-import org.eclipse.jpt.core.resource.persistence.XmlMappingFileRef;
-import org.eclipse.jpt.core.tests.internal.context.ContextModelTestCase;
-import org.eclipse.jpt.core.tests.internal.projects.TestJavaProject.SourceWriter;
-import org.eclipse.jpt.utility.internal.iterators.ArrayIterator;
-
-@SuppressWarnings("nls")
-public class OrmTableTests extends ContextModelTestCase
-{
- public OrmTableTests(String name) {
- super(name);
- }
-
- @Override
- protected void setUp() throws Exception {
- super.setUp();
- XmlMappingFileRef mappingFileRef = PersistenceFactory.eINSTANCE.createXmlMappingFileRef();
- mappingFileRef.setFileName(JptCorePlugin.DEFAULT_ORM_XML_FILE_PATH);
- getXmlPersistenceUnit().getMappingFiles().add(mappingFileRef);
- getPersistenceXmlResource().save(null);
- }
-
- private ICompilationUnit createTestEntity() 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("@Id");
- }
- });
- }
-
- private void createTestSubType() throws Exception {
- SourceWriter sourceWriter = new SourceWriter() {
- public void appendSourceTo(StringBuilder sb) {
- sb.append(CR);
- sb.append("import ");
- sb.append(JPA.ENTITY);
- sb.append(";");
- sb.append(CR);
- sb.append("@Entity");
- sb.append(CR);
- sb.append("public class ").append("AnnotationTestTypeChild").append(" ");
- sb.append("extends " + TYPE_NAME + " ");
- sb.append("{}").append(CR);
- }
- };
- this.javaProject.createCompilationUnit(PACKAGE_NAME, "AnnotationTestTypeChild.java", sourceWriter);
- }
-
- private ICompilationUnit createAbstractTestEntity() throws Exception {
- return this.createTestType(new DefaultAnnotationWriter() {
- @Override
- public Iterator<String> imports() {
- return new ArrayIterator<String>(JPA.ENTITY, JPA.INHERITANCE, JPA.INHERITANCE_TYPE);
- }
- @Override
- public void appendTypeAnnotationTo(StringBuilder sb) {
- sb.append("@Entity").append(CR);
- sb.append("@Inheritance(strategy=InheritanceType.TABLE_PER_CLASS)").append(CR);
- sb.append("abstract");
- }
- });
- }
-
- public void testUpdateSpecifiedName() throws Exception {
- OrmPersistentType ormPersistentType = getEntityMappings().addPersistentType(MappingKeys.ENTITY_TYPE_MAPPING_KEY, "model.foo");
- OrmEntity ormEntity = (OrmEntity) ormPersistentType.getMapping();
- OrmTable ormTable = ormEntity.getTable();
- XmlEntity entityResource = getXmlEntityMappings().getEntities().get(0);
- assertNull(ormTable.getSpecifiedName());
- assertNull(entityResource.getTable());
-
- //set name in the resource model, verify context model updated
- entityResource.setTable(OrmFactory.eINSTANCE.createXmlTable());
- entityResource.getTable().setName("FOO");
- assertEquals("FOO", ormTable.getSpecifiedName());
- assertEquals("FOO", entityResource.getTable().getName());
-
- //set name to null in the resource model
- entityResource.getTable().setName(null);
- assertNull(ormTable.getSpecifiedName());
- assertNull(entityResource.getTable().getName());
-
- entityResource.getTable().setName("FOO");
- assertEquals("FOO", ormTable.getSpecifiedName());
- assertEquals("FOO", entityResource.getTable().getName());
-
- entityResource.setTable(null);
- assertNull(ormTable.getSpecifiedName());
- assertNull(entityResource.getTable());
- }
-
- public void testModifySpecifiedName() throws Exception {
- OrmPersistentType ormPersistentType = getEntityMappings().addPersistentType(MappingKeys.ENTITY_TYPE_MAPPING_KEY, "model.foo");
- OrmTable ormTable = ((OrmEntity) ormPersistentType.getMapping()).getTable();
- XmlEntity entityResource = getXmlEntityMappings().getEntities().get(0);
- assertNull(ormTable.getSpecifiedName());
- assertNull(entityResource.getTable());
-
- //set name in the context model, verify resource model modified
- ormTable.setSpecifiedName("foo");
- assertEquals("foo", ormTable.getSpecifiedName());
- assertEquals("foo", entityResource.getTable().getName());
-
- //set name to null in the context model
- ormTable.setSpecifiedName(null);
- assertNull(ormTable.getSpecifiedName());
- assertNull(entityResource.getTable());
- }
-
- public void testUpdateDefaultNameFromJavaTable() throws Exception {
- createTestEntity();
-
- OrmPersistentType ormPersistentType = getEntityMappings().addPersistentType(MappingKeys.ENTITY_TYPE_MAPPING_KEY, FULLY_QUALIFIED_TYPE_NAME);
- OrmEntity ormEntity = (OrmEntity) ormPersistentType.getMapping();
- assertEquals(TYPE_NAME, ormEntity.getTable().getDefaultName());
-
- ormEntity.getJavaEntity().getTable().setSpecifiedName("Foo");
- assertEquals("Foo", ormEntity.getTable().getDefaultName());
-
- ormEntity.setSpecifiedMetadataComplete(Boolean.TRUE);
- assertEquals(TYPE_NAME, ormEntity.getTable().getDefaultName());
-
- getEntityMappings().getPersistenceUnitMetadata().setXmlMappingMetadataComplete(true);
- ormEntity.setSpecifiedMetadataComplete(Boolean.FALSE);
- assertEquals(TYPE_NAME, ormEntity.getTable().getDefaultName());
-
- ormEntity.setSpecifiedMetadataComplete(null);
- assertEquals(TYPE_NAME, ormEntity.getTable().getDefaultName());
-
- getEntityMappings().getPersistenceUnitMetadata().setXmlMappingMetadataComplete(false);
- assertEquals("Foo", ormEntity.getTable().getDefaultName());
-
- ormEntity.getTable().setSpecifiedName("Bar");
- assertEquals(TYPE_NAME, ormEntity.getTable().getDefaultName());
- }
-
- public void testUpdateDefaultNameNoJava() throws Exception {
- OrmPersistentType ormPersistentType = getEntityMappings().addPersistentType(MappingKeys.ENTITY_TYPE_MAPPING_KEY, "model.Foo");
- OrmEntity ormEntity = (OrmEntity) ormPersistentType.getMapping();
- assertEquals("Foo", ormEntity.getTable().getDefaultName());
- }
-
- public void testUpdateDefaultNameFromEntityName() throws Exception {
- createTestEntity();
-
- OrmPersistentType ormPersistentType = getEntityMappings().addPersistentType(MappingKeys.ENTITY_TYPE_MAPPING_KEY, FULLY_QUALIFIED_TYPE_NAME);
- OrmEntity ormEntity = (OrmEntity) ormPersistentType.getMapping();
-
- assertEquals(TYPE_NAME, ormEntity.getTable().getDefaultName());
- ormEntity.setSpecifiedName("foo");
-
- assertEquals("foo", ormEntity.getTable().getDefaultName());
-
- ormEntity.setSpecifiedName(null);
- assertEquals(TYPE_NAME, ormEntity.getTable().getDefaultName());
-
- ormEntity.getJavaEntity().setSpecifiedName("foo");
- assertEquals("foo", ormEntity.getTable().getDefaultName());
-
- ormEntity.setSpecifiedMetadataComplete(Boolean.TRUE);
- assertEquals(TYPE_NAME, ormEntity.getTable().getDefaultName());
- }
-
- public void testUpdateDefaultNameFromParent() throws Exception {
- createTestEntity();
- createTestSubType();
-
- OrmPersistentType parentOrmPersistentType = getEntityMappings().addPersistentType(MappingKeys.ENTITY_TYPE_MAPPING_KEY, FULLY_QUALIFIED_TYPE_NAME);
- OrmPersistentType childOrmPersistentType = getEntityMappings().addPersistentType(MappingKeys.ENTITY_TYPE_MAPPING_KEY, PACKAGE_NAME + ".AnnotationTestTypeChild");
- OrmEntity parentXmlEntity = (OrmEntity) parentOrmPersistentType.getMapping();
- OrmEntity childXmlEntity = (OrmEntity) childOrmPersistentType.getMapping();
-
- assertEquals(TYPE_NAME, parentXmlEntity.getTable().getDefaultName());
- assertEquals(TYPE_NAME, childXmlEntity.getTable().getDefaultName());
-
- parentXmlEntity.getTable().setSpecifiedName("FOO");
- assertEquals(TYPE_NAME, parentXmlEntity.getTable().getDefaultName());
- assertEquals("FOO", childXmlEntity.getTable().getDefaultName());
-
- parentXmlEntity.setSpecifiedInheritanceStrategy(InheritanceType.JOINED);
- assertEquals(TYPE_NAME, parentXmlEntity.getTable().getDefaultName());
- assertEquals("AnnotationTestTypeChild", childXmlEntity.getTable().getDefaultName());
- }
-
- public void testUpdateSpecifiedSchema() throws Exception {
- OrmPersistentType ormPersistentType = getEntityMappings().addPersistentType(MappingKeys.ENTITY_TYPE_MAPPING_KEY, "model.foo");
- OrmEntity ormEntity = (OrmEntity) ormPersistentType.getMapping();
- OrmTable ormTable = ormEntity.getTable();
- XmlEntity entityResource = getXmlEntityMappings().getEntities().get(0);
- assertNull(ormTable.getSpecifiedSchema());
- assertNull(entityResource.getTable());
-
- //set schema in the resource model, verify context model updated
- entityResource.setTable(OrmFactory.eINSTANCE.createXmlTable());
- entityResource.getTable().setSchema("FOO");
- assertEquals("FOO", ormTable.getSpecifiedSchema());
- assertEquals("FOO", entityResource.getTable().getSchema());
-
- //set Schema to null in the resource model
- entityResource.getTable().setSchema(null);
- assertNull(ormTable.getSpecifiedSchema());
- assertNull(entityResource.getTable().getSchema());
-
- entityResource.getTable().setSchema("FOO");
- assertEquals("FOO", ormTable.getSpecifiedSchema());
- assertEquals("FOO", entityResource.getTable().getSchema());
-
- entityResource.setTable(null);
- assertNull(ormTable.getSpecifiedSchema());
- assertNull(entityResource.getTable());
- }
-
- public void testUpdateDefaultSchemaFromJavaTable() throws Exception {
- createTestEntity();
-
- OrmPersistentType ormPersistentType = getEntityMappings().addPersistentType(MappingKeys.ENTITY_TYPE_MAPPING_KEY, FULLY_QUALIFIED_TYPE_NAME);
- OrmEntity ormEntity = (OrmEntity) ormPersistentType.getMapping();
- assertNull(ormEntity.getTable().getDefaultSchema());
-
- ormEntity.getJavaEntity().getTable().setSpecifiedSchema("Foo");
- assertEquals("Foo", ormEntity.getTable().getDefaultSchema());
-
- ormEntity.setSpecifiedMetadataComplete(Boolean.TRUE);
- assertNull(ormEntity.getTable().getDefaultSchema());
-
- getEntityMappings().getPersistenceUnitMetadata().setXmlMappingMetadataComplete(true);
- ormEntity.setSpecifiedMetadataComplete(Boolean.FALSE);
- assertNull(ormEntity.getTable().getDefaultSchema());
-
- ormEntity.setSpecifiedMetadataComplete(null);
- assertNull(ormEntity.getTable().getDefaultSchema());
-
- getEntityMappings().getPersistenceUnitMetadata().setXmlMappingMetadataComplete(false);
- assertEquals("Foo", ormEntity.getTable().getDefaultSchema());
-
- ormEntity.getTable().setSpecifiedName("Bar");
- assertNull(ormEntity.getTable().getDefaultSchema());
- }
-
- public void testUpdateDefaultSchemaNoJava() throws Exception {
- createTestEntity();
-
- OrmPersistentType ormPersistentType = getEntityMappings().addPersistentType(MappingKeys.ENTITY_TYPE_MAPPING_KEY, "model.Foo");
- OrmEntity ormEntity = (OrmEntity) ormPersistentType.getMapping();
- assertNull(ormEntity.getTable().getDefaultSchema());
- }
-
- public void testUpdateDefaultSchemaFromParent() throws Exception {
- createTestEntity();
- createTestSubType();
-
- OrmPersistentType parentOrmPersistentType = getEntityMappings().addPersistentType(MappingKeys.ENTITY_TYPE_MAPPING_KEY, FULLY_QUALIFIED_TYPE_NAME);
- OrmPersistentType childOrmPersistentType = getEntityMappings().addPersistentType(MappingKeys.ENTITY_TYPE_MAPPING_KEY, PACKAGE_NAME + ".AnnotationTestTypeChild");
- OrmEntity parentXmlEntity = (OrmEntity) parentOrmPersistentType.getMapping();
- OrmEntity childXmlEntity = (OrmEntity) childOrmPersistentType.getMapping();
-
- assertNull(parentXmlEntity.getTable().getDefaultSchema());
- assertNull(childXmlEntity.getTable().getDefaultSchema());
-
- parentXmlEntity.getTable().setSpecifiedSchema("FOO");
- assertNull(parentXmlEntity.getTable().getDefaultSchema());
- assertEquals("FOO", childXmlEntity.getTable().getDefaultSchema());
-
- parentXmlEntity.setSpecifiedInheritanceStrategy(InheritanceType.JOINED);
- assertNull(parentXmlEntity.getTable().getDefaultSchema());
- assertNull(childXmlEntity.getTable().getDefaultSchema());
- }
-
- public void testUpdateDefaultSchemaFromPersistenceUnitDefaults() throws Exception {
- createTestEntity();
-
- OrmPersistentType ormPersistentType = getEntityMappings().addPersistentType(MappingKeys.ENTITY_TYPE_MAPPING_KEY, FULLY_QUALIFIED_TYPE_NAME);
- OrmEntity ormEntity = (OrmEntity) ormPersistentType.getMapping();
- assertNull(ormEntity.getTable().getDefaultSchema());
-
- getEntityMappings().getPersistenceUnitMetadata().getPersistenceUnitDefaults().setSpecifiedSchema("FOO");
- assertEquals("FOO", ormEntity.getTable().getDefaultSchema());
-
- getEntityMappings().setSpecifiedSchema("BAR");
- assertEquals("BAR", ormEntity.getTable().getDefaultSchema());
-
- ormEntity.getJavaEntity().getTable().setSpecifiedSchema("JAVA_SCHEMA");
- assertEquals("JAVA_SCHEMA", ormEntity.getTable().getDefaultSchema());
-
- ormEntity.getTable().setSpecifiedName("BLAH");
- //xml entity now has a table element so default schema is not taken from java
- assertEquals("BAR", ormEntity.getTable().getDefaultSchema());
-
-
- getEntityMappings().setSpecifiedSchema(null);
- assertEquals("FOO", ormEntity.getTable().getDefaultSchema());
-
- getEntityMappings().getPersistenceUnitMetadata().getPersistenceUnitDefaults().setSpecifiedSchema(null);
- assertNull(ormEntity.getTable().getDefaultSchema());
-
- ormEntity.getTable().setSpecifiedName(null);
- assertEquals("JAVA_SCHEMA", ormEntity.getTable().getDefaultSchema());
- }
-
- public void testModifySpecifiedSchema() throws Exception {
- OrmPersistentType ormPersistentType = getEntityMappings().addPersistentType(MappingKeys.ENTITY_TYPE_MAPPING_KEY, "model.foo");
- OrmEntity ormEntity = (OrmEntity) ormPersistentType.getMapping();
- OrmTable ormTable = ormEntity.getTable();
- XmlEntity entityResource = getXmlEntityMappings().getEntities().get(0);
- assertNull(ormTable.getSpecifiedSchema());
- assertNull(entityResource.getTable());
-
- //set Schema in the context model, verify resource model modified
- ormTable.setSpecifiedSchema("foo");
- assertEquals("foo", ormTable.getSpecifiedSchema());
- assertEquals("foo", entityResource.getTable().getSchema());
-
- //set Schema to null in the context model
- ormTable.setSpecifiedSchema(null);
- assertNull(ormTable.getSpecifiedSchema());
- assertNull(entityResource.getTable());
- }
-
- public void testUpdateSpecifiedCatalog() throws Exception {
- OrmPersistentType ormPersistentType = getEntityMappings().addPersistentType(MappingKeys.ENTITY_TYPE_MAPPING_KEY, "model.foo");
- OrmEntity ormEntity = (OrmEntity) ormPersistentType.getMapping();
- OrmTable ormTable = ormEntity.getTable();
- XmlEntity entityResource = getXmlEntityMappings().getEntities().get(0);
- assertNull(ormTable.getSpecifiedCatalog());
- assertNull(entityResource.getTable());
-
- //set Catalog in the resource model, verify context model updated
- entityResource.setTable(OrmFactory.eINSTANCE.createXmlTable());
- entityResource.getTable().setCatalog("FOO");
- assertEquals("FOO", ormTable.getSpecifiedCatalog());
- assertEquals("FOO", entityResource.getTable().getCatalog());
-
- //set Catalog to null in the resource model
- entityResource.getTable().setCatalog(null);
- assertNull(ormTable.getSpecifiedCatalog());
- assertNull(entityResource.getTable().getCatalog());
-
- entityResource.getTable().setCatalog("FOO");
- assertEquals("FOO", ormTable.getSpecifiedCatalog());
- assertEquals("FOO", entityResource.getTable().getCatalog());
-
- entityResource.setTable(null);
- assertNull(ormTable.getSpecifiedCatalog());
- assertNull(entityResource.getTable());
- }
-
- public void testModifySpecifiedCatalog() throws Exception {
- OrmPersistentType ormPersistentType = getEntityMappings().addPersistentType(MappingKeys.ENTITY_TYPE_MAPPING_KEY, "model.foo");
- OrmEntity ormEntity = (OrmEntity) ormPersistentType.getMapping();
- OrmTable ormTable = ormEntity.getTable();
- XmlEntity entityResource = getXmlEntityMappings().getEntities().get(0);
- assertNull(ormTable.getSpecifiedCatalog());
- assertNull(entityResource.getTable());
-
- //set Catalog in the context model, verify resource model modified
- ormTable.setSpecifiedCatalog("foo");
- assertEquals("foo", ormTable.getSpecifiedCatalog());
- assertEquals("foo", entityResource.getTable().getCatalog());
-
- //set Catalog to null in the context model
- ormTable.setSpecifiedCatalog(null);
- assertNull(ormTable.getSpecifiedCatalog());
- assertNull(entityResource.getTable());
- }
-
- public void testUpdateDefaultCatalogFromJavaTable() throws Exception {
- createTestEntity();
-
- OrmPersistentType ormPersistentType = getEntityMappings().addPersistentType(MappingKeys.ENTITY_TYPE_MAPPING_KEY, FULLY_QUALIFIED_TYPE_NAME);
- OrmEntity ormEntity = (OrmEntity) ormPersistentType.getMapping();
- assertNull(ormEntity.getTable().getDefaultCatalog());
-
- ormEntity.getJavaEntity().getTable().setSpecifiedCatalog("Foo");
- assertEquals("Foo", ormEntity.getTable().getDefaultCatalog());
-
- ormEntity.setSpecifiedMetadataComplete(Boolean.TRUE);
- assertNull(ormEntity.getTable().getDefaultCatalog());
-
- getEntityMappings().getPersistenceUnitMetadata().setXmlMappingMetadataComplete(true);
- ormEntity.setSpecifiedMetadataComplete(Boolean.FALSE);
- assertNull(ormEntity.getTable().getDefaultCatalog());
-
- ormEntity.setSpecifiedMetadataComplete(null);
- assertNull(ormEntity.getTable().getDefaultCatalog());
-
- getEntityMappings().getPersistenceUnitMetadata().setXmlMappingMetadataComplete(false);
- assertEquals("Foo", ormEntity.getTable().getDefaultCatalog());
-
- ormEntity.getTable().setSpecifiedName("Bar");
- assertNull(ormEntity.getTable().getDefaultCatalog());
- }
-
- public void testUpdateDefaultCatalogNoJava() throws Exception {
- createTestEntity();
-
- OrmPersistentType ormPersistentType = getEntityMappings().addPersistentType(MappingKeys.ENTITY_TYPE_MAPPING_KEY, "model.Foo");
- OrmEntity ormEntity = (OrmEntity) ormPersistentType.getMapping();
- assertNull(ormEntity.getTable().getDefaultCatalog());
- }
-
- public void testUpdateDefaultCatalogFromParent() throws Exception {
- createTestEntity();
- createTestSubType();
-
- OrmPersistentType parentOrmPersistentType = getEntityMappings().addPersistentType(MappingKeys.ENTITY_TYPE_MAPPING_KEY, FULLY_QUALIFIED_TYPE_NAME);
- OrmPersistentType childOrmPersistentType = getEntityMappings().addPersistentType(MappingKeys.ENTITY_TYPE_MAPPING_KEY, PACKAGE_NAME + ".AnnotationTestTypeChild");
- OrmEntity parentXmlEntity = (OrmEntity) parentOrmPersistentType.getMapping();
- OrmEntity childXmlEntity = (OrmEntity) childOrmPersistentType.getMapping();
-
- assertNull(parentXmlEntity.getTable().getDefaultCatalog());
- assertNull(childXmlEntity.getTable().getDefaultCatalog());
-
- parentXmlEntity.getTable().setSpecifiedCatalog("FOO");
- assertNull(parentXmlEntity.getTable().getDefaultCatalog());
- assertEquals("FOO", childXmlEntity.getTable().getDefaultCatalog());
-
- parentXmlEntity.setSpecifiedInheritanceStrategy(InheritanceType.JOINED);
- assertNull(parentXmlEntity.getTable().getDefaultCatalog());
- assertNull(childXmlEntity.getTable().getDefaultCatalog());
- }
-
- public void testUpdateDefaultCatalogFromPersistenceUnitDefaults() throws Exception {
- createTestEntity();
-
- OrmPersistentType ormPersistentType = getEntityMappings().addPersistentType(MappingKeys.ENTITY_TYPE_MAPPING_KEY, FULLY_QUALIFIED_TYPE_NAME);
- OrmEntity ormEntity = (OrmEntity) ormPersistentType.getMapping();
- assertNull(ormEntity.getTable().getDefaultCatalog());
-
- getEntityMappings().getPersistenceUnitMetadata().getPersistenceUnitDefaults().setSpecifiedCatalog("FOO");
- assertEquals("FOO", ormEntity.getTable().getDefaultCatalog());
-
- getEntityMappings().setSpecifiedCatalog("BAR");
- assertEquals("BAR", ormEntity.getTable().getDefaultCatalog());
-
- ormEntity.getJavaEntity().getTable().setSpecifiedCatalog("JAVA_CATALOG");
- assertEquals("JAVA_CATALOG", ormEntity.getTable().getDefaultCatalog());
-
- ormEntity.getTable().setSpecifiedName("BLAH");
- //xml entity now has a table element so default schema is not taken from java
- assertEquals("BAR", ormEntity.getTable().getDefaultCatalog());
-
-
- getEntityMappings().setSpecifiedCatalog(null);
- assertEquals("FOO", ormEntity.getTable().getDefaultCatalog());
-
- getEntityMappings().getPersistenceUnitMetadata().getPersistenceUnitDefaults().setSpecifiedCatalog(null);
- assertNull(ormEntity.getTable().getDefaultCatalog());
-
- ormEntity.getTable().setSpecifiedName(null);
- assertEquals("JAVA_CATALOG", ormEntity.getTable().getDefaultCatalog());
-}
-
-//
-// public void testUpdateName() throws Exception {
-// OrmPersistentType ormPersistentType = entityMappings().addOrmPersistentType(IMappingKeys.ENTITY_TYPE_MAPPING_KEY, "model.Foo");
-// XmlEntity ormEntity = (XmlEntity) ormPersistentType.getMapping();
-// Entity entityResource = ormResource().getEntityMappings().getEntities().get(0);
-// assertEquals("Foo", ormEntity.getName());
-//
-// //set class in the resource model, verify context model updated
-// entityResource.setClassName("com.Bar");
-// assertEquals("Bar", ormEntity.getName());
-//
-// entityResource.setName("Baz");
-// assertEquals("Baz", ormEntity.getName());
-//
-// //set class to null in the resource model
-// entityResource.setClassName(null);
-// assertEquals("Baz", ormEntity.getName());
-//
-// entityResource.setName(null);
-// assertNull(ormEntity.getName());
-// }
-
- public void testUniqueConstraints() throws Exception {
- createTestEntity();
-
- OrmPersistentType ormPersistentType = getEntityMappings().addPersistentType(MappingKeys.ENTITY_TYPE_MAPPING_KEY, FULLY_QUALIFIED_TYPE_NAME);
- OrmEntity ormEntity = (OrmEntity) ormPersistentType.getMapping();
-
- ListIterator<OrmUniqueConstraint> uniqueConstraints = ormEntity.getTable().uniqueConstraints();
- assertFalse(uniqueConstraints.hasNext());
-
- XmlEntity entityResource = getXmlEntityMappings().getEntities().get(0);
- XmlTable tableResource = OrmFactory.eINSTANCE.createXmlTable();
- entityResource.setTable(tableResource);
-
- XmlUniqueConstraint uniqueConstraintResource = OrmFactory.eINSTANCE.createXmlUniqueConstraint();
- tableResource.getUniqueConstraints().add(0, uniqueConstraintResource);
- uniqueConstraintResource.getColumnNames().add(0, "foo");
-
- uniqueConstraintResource = OrmFactory.eINSTANCE.createXmlUniqueConstraint();
- tableResource.getUniqueConstraints().add(0, uniqueConstraintResource);
- uniqueConstraintResource.getColumnNames().add(0, "bar");
-
- uniqueConstraints = ormEntity.getTable().uniqueConstraints();
- assertTrue(uniqueConstraints.hasNext());
- assertEquals("bar", uniqueConstraints.next().columnNames().next());
- assertEquals("foo", uniqueConstraints.next().columnNames().next());
- assertFalse(uniqueConstraints.hasNext());
- }
-
- public void testUniqueConstraintsSize() throws Exception {
- createTestEntity();
-
- OrmPersistentType ormPersistentType = getEntityMappings().addPersistentType(MappingKeys.ENTITY_TYPE_MAPPING_KEY, FULLY_QUALIFIED_TYPE_NAME);
- OrmEntity ormEntity = (OrmEntity) ormPersistentType.getMapping();
-
- assertEquals(0, ormEntity.getTable().uniqueConstraintsSize());
-
- XmlEntity entityResource = getXmlEntityMappings().getEntities().get(0);
- XmlTable tableResource = OrmFactory.eINSTANCE.createXmlTable();
- entityResource.setTable(tableResource);
-
- XmlUniqueConstraint uniqueConstraintResource = OrmFactory.eINSTANCE.createXmlUniqueConstraint();
- tableResource.getUniqueConstraints().add(0, uniqueConstraintResource);
- uniqueConstraintResource.getColumnNames().add(0, "foo");
-
- uniqueConstraintResource = OrmFactory.eINSTANCE.createXmlUniqueConstraint();
- tableResource.getUniqueConstraints().add(1, uniqueConstraintResource);
- uniqueConstraintResource.getColumnNames().add(0, "bar");
-
- assertEquals(2, ormEntity.getTable().uniqueConstraintsSize());
- }
-
- public void testAddUniqueConstraint() throws Exception {
- createTestEntity();
-
- OrmPersistentType ormPersistentType = getEntityMappings().addPersistentType(MappingKeys.ENTITY_TYPE_MAPPING_KEY, FULLY_QUALIFIED_TYPE_NAME);
- OrmEntity ormEntity = (OrmEntity) ormPersistentType.getMapping();
-
- OrmTable table = ormEntity.getTable();
- table.addUniqueConstraint(0).addColumnName(0, "FOO");
- table.addUniqueConstraint(0).addColumnName(0, "BAR");
- table.addUniqueConstraint(0).addColumnName(0, "BAZ");
-
- XmlEntity entityResource = getXmlEntityMappings().getEntities().get(0);
- XmlTable tableResource = entityResource.getTable();
-
- ListIterator<XmlUniqueConstraint> uniqueConstraints = tableResource.getUniqueConstraints().listIterator();
-
- assertEquals("BAZ", uniqueConstraints.next().getColumnNames().get(0));
- assertEquals("BAR", uniqueConstraints.next().getColumnNames().get(0));
- assertEquals("FOO", uniqueConstraints.next().getColumnNames().get(0));
- assertFalse(uniqueConstraints.hasNext());
- }
-
- public void testAddUniqueConstraint2() throws Exception {
- createTestEntity();
-
- OrmPersistentType ormPersistentType = getEntityMappings().addPersistentType(MappingKeys.ENTITY_TYPE_MAPPING_KEY, FULLY_QUALIFIED_TYPE_NAME);
- OrmEntity ormEntity = (OrmEntity) ormPersistentType.getMapping();
-
- OrmTable table = ormEntity.getTable();
- table.addUniqueConstraint(0).addColumnName(0, "FOO");
- table.addUniqueConstraint(1).addColumnName(0, "BAR");
- table.addUniqueConstraint(0).addColumnName(0, "BAZ");
-
- XmlEntity entityResource = getXmlEntityMappings().getEntities().get(0);
- XmlTable tableResource = entityResource.getTable();
-
- ListIterator<XmlUniqueConstraint> uniqueConstraints = tableResource.getUniqueConstraints().listIterator();
-
- assertEquals("BAZ", uniqueConstraints.next().getColumnNames().get(0));
- assertEquals("FOO", uniqueConstraints.next().getColumnNames().get(0));
- assertEquals("BAR", uniqueConstraints.next().getColumnNames().get(0));
- assertFalse(uniqueConstraints.hasNext());
- }
-
- public void testRemoveUniqueConstraint() throws Exception {
- createTestEntity();
-
- OrmPersistentType ormPersistentType = getEntityMappings().addPersistentType(MappingKeys.ENTITY_TYPE_MAPPING_KEY, FULLY_QUALIFIED_TYPE_NAME);
- OrmEntity ormEntity = (OrmEntity) ormPersistentType.getMapping();
-
- OrmTable table = ormEntity.getTable();
- table.addUniqueConstraint(0).addColumnName(0, "FOO");
- table.addUniqueConstraint(1).addColumnName(0, "BAR");
- table.addUniqueConstraint(2).addColumnName(0, "BAZ");
-
- XmlEntity entityResource = getXmlEntityMappings().getEntities().get(0);
- XmlTable tableResource = entityResource.getTable();
-
- assertEquals(3, tableResource.getUniqueConstraints().size());
-
- table.removeUniqueConstraint(1);
-
- ListIterator<XmlUniqueConstraint> uniqueConstraintResources = tableResource.getUniqueConstraints().listIterator();
- assertEquals("FOO", uniqueConstraintResources.next().getColumnNames().get(0));
- assertEquals("BAZ", uniqueConstraintResources.next().getColumnNames().get(0));
- assertFalse(uniqueConstraintResources.hasNext());
-
- Iterator<OrmUniqueConstraint> uniqueConstraints = table.uniqueConstraints();
- assertEquals("FOO", uniqueConstraints.next().columnNames().next());
- assertEquals("BAZ", uniqueConstraints.next().columnNames().next());
- assertFalse(uniqueConstraints.hasNext());
-
-
- table.removeUniqueConstraint(1);
- uniqueConstraintResources = tableResource.getUniqueConstraints().listIterator();
- assertEquals("FOO", uniqueConstraintResources.next().getColumnNames().get(0));
- assertFalse(uniqueConstraintResources.hasNext());
-
- uniqueConstraints = table.uniqueConstraints();
- assertEquals("FOO", uniqueConstraints.next().columnNames().next());
- assertFalse(uniqueConstraints.hasNext());
-
-
- table.removeUniqueConstraint(0);
- uniqueConstraintResources = tableResource.getUniqueConstraints().listIterator();
- assertFalse(uniqueConstraintResources.hasNext());
- uniqueConstraints = table.uniqueConstraints();
- assertFalse(uniqueConstraints.hasNext());
- }
-
- public void testMoveUniqueConstraint() throws Exception {
- createTestEntity();
-
- OrmPersistentType ormPersistentType = getEntityMappings().addPersistentType(MappingKeys.ENTITY_TYPE_MAPPING_KEY, FULLY_QUALIFIED_TYPE_NAME);
- OrmEntity ormEntity = (OrmEntity) ormPersistentType.getMapping();
-
- OrmTable table = ormEntity.getTable();
- table.addUniqueConstraint(0).addColumnName(0, "FOO");
- table.addUniqueConstraint(1).addColumnName(0, "BAR");
- table.addUniqueConstraint(2).addColumnName(0, "BAZ");
-
- XmlEntity entityResource = getXmlEntityMappings().getEntities().get(0);
- XmlTable tableResource = entityResource.getTable();
-
- assertEquals(3, tableResource.getUniqueConstraints().size());
-
-
- table.moveUniqueConstraint(2, 0);
- ListIterator<OrmUniqueConstraint> uniqueConstraints = table.uniqueConstraints();
- assertEquals("BAR", uniqueConstraints.next().columnNames().next());
- assertEquals("BAZ", uniqueConstraints.next().columnNames().next());
- assertEquals("FOO", uniqueConstraints.next().columnNames().next());
-
- ListIterator<XmlUniqueConstraint> uniqueConstraintResources = tableResource.getUniqueConstraints().listIterator();
- assertEquals("BAR", uniqueConstraintResources.next().getColumnNames().get(0));
- assertEquals("BAZ", uniqueConstraintResources.next().getColumnNames().get(0));
- assertEquals("FOO", uniqueConstraintResources.next().getColumnNames().get(0));
-
-
- table.moveUniqueConstraint(0, 1);
- uniqueConstraints = table.uniqueConstraints();
- assertEquals("BAZ", uniqueConstraints.next().columnNames().next());
- assertEquals("BAR", uniqueConstraints.next().columnNames().next());
- assertEquals("FOO", uniqueConstraints.next().columnNames().next());
-
- uniqueConstraintResources = tableResource.getUniqueConstraints().listIterator();
- assertEquals("BAZ", uniqueConstraintResources.next().getColumnNames().get(0));
- assertEquals("BAR", uniqueConstraintResources.next().getColumnNames().get(0));
- assertEquals("FOO", uniqueConstraintResources.next().getColumnNames().get(0));
- }
-
- public void testUpdateUniqueConstraints() throws Exception {
- createTestEntity();
-
- OrmPersistentType ormPersistentType = getEntityMappings().addPersistentType(MappingKeys.ENTITY_TYPE_MAPPING_KEY, FULLY_QUALIFIED_TYPE_NAME);
- OrmEntity ormEntity = (OrmEntity) ormPersistentType.getMapping();
-
- OrmTable table = ormEntity.getTable();
-
- XmlEntity entityResource = getXmlEntityMappings().getEntities().get(0);
- XmlTable tableResource = OrmFactory.eINSTANCE.createXmlTable();
- entityResource.setTable(tableResource);
-
- XmlUniqueConstraint uniqueConstraintResource = OrmFactory.eINSTANCE.createXmlUniqueConstraint();
- tableResource.getUniqueConstraints().add(0, uniqueConstraintResource);
- uniqueConstraintResource.getColumnNames().add(0, "FOO");
-
- uniqueConstraintResource = OrmFactory.eINSTANCE.createXmlUniqueConstraint();
- tableResource.getUniqueConstraints().add(1, uniqueConstraintResource);
- uniqueConstraintResource.getColumnNames().add(0, "BAR");
-
- uniqueConstraintResource = OrmFactory.eINSTANCE.createXmlUniqueConstraint();
- tableResource.getUniqueConstraints().add(2, uniqueConstraintResource);
- uniqueConstraintResource.getColumnNames().add(0, "BAZ");
-
-
- ListIterator<OrmUniqueConstraint> uniqueConstraints = table.uniqueConstraints();
- assertEquals("FOO", uniqueConstraints.next().columnNames().next());
- assertEquals("BAR", uniqueConstraints.next().columnNames().next());
- assertEquals("BAZ", uniqueConstraints.next().columnNames().next());
- assertFalse(uniqueConstraints.hasNext());
-
- tableResource.getUniqueConstraints().move(2, 0);
- uniqueConstraints = table.uniqueConstraints();
- assertEquals("BAR", uniqueConstraints.next().columnNames().next());
- assertEquals("BAZ", uniqueConstraints.next().columnNames().next());
- assertEquals("FOO", uniqueConstraints.next().columnNames().next());
- assertFalse(uniqueConstraints.hasNext());
-
- tableResource.getUniqueConstraints().move(0, 1);
- uniqueConstraints = table.uniqueConstraints();
- assertEquals("BAZ", uniqueConstraints.next().columnNames().next());
- assertEquals("BAR", uniqueConstraints.next().columnNames().next());
- assertEquals("FOO", uniqueConstraints.next().columnNames().next());
- assertFalse(uniqueConstraints.hasNext());
-
- tableResource.getUniqueConstraints().remove(1);
- uniqueConstraints = table.uniqueConstraints();
- assertEquals("BAZ", uniqueConstraints.next().columnNames().next());
- assertEquals("FOO", uniqueConstraints.next().columnNames().next());
- assertFalse(uniqueConstraints.hasNext());
-
- tableResource.getUniqueConstraints().remove(1);
- uniqueConstraints = table.uniqueConstraints();
- assertEquals("BAZ", uniqueConstraints.next().columnNames().next());
- assertFalse(uniqueConstraints.hasNext());
-
- tableResource.getUniqueConstraints().remove(0);
- uniqueConstraints = table.uniqueConstraints();
- assertFalse(uniqueConstraints.hasNext());
- }
-
-//TODO not yet supporting unique constriants from java
-// public void testUniqueConstraintsFromJava() throws Exception {
-// createTestEntity();
-//
-// OrmPersistentType ormPersistentType = entityMappings().addOrmPersistentType(MappingKeys.ENTITY_TYPE_MAPPING_KEY, FULLY_QUALIFIED_TYPE_NAME);
-// OrmEntity ormEntity = (OrmEntity) ormPersistentType.getMapping();
-//
-// ListIterator<OrmUniqueConstraint> uniqueConstraints = ormEntity.getTable().uniqueConstraints();
-// assertFalse(uniqueConstraints.hasNext());
-//
-// JavaEntity javaEntity = (JavaEntity) ormPersistentType.getJavaPersistentType().getMapping();
-// javaEntity.getTable().addUniqueConstraint(0).addColumnName(0, "FOO");
-// javaEntity.getTable().addUniqueConstraint(1).addColumnName(0, "BAR");
-// javaEntity.getTable().addUniqueConstraint(2).addColumnName(0, "BAZ");
-//
-//
-// XmlEntity entityResource = ormResource().getEntityMappings().getEntities().get(0);
-// assertNull(entityResource.getTable());
-//
-// uniqueConstraints = ormEntity.getTable().uniqueConstraints();
-// assertTrue(uniqueConstraints.hasNext());
-// assertEquals("FOO", uniqueConstraints.next().columnNames().next());
-// assertEquals("BAR", uniqueConstraints.next().columnNames().next());
-// assertEquals("BAZ", uniqueConstraints.next().columnNames().next());
-// assertFalse(uniqueConstraints.hasNext());
-//
-// entityResource.setTable(OrmFactory.eINSTANCE.createXmlTable());
-// assertEquals(0, ormEntity.getTable().uniqueConstraintsSize());
-// }
-
- public void testAbstractEntityGetDefaultNameTablePerClassInheritance() throws Exception {
- createAbstractTestEntity();
- createTestSubType();
- OrmPersistentType abstractPersistentType = getEntityMappings().addPersistentType(MappingKeys.ENTITY_TYPE_MAPPING_KEY, FULLY_QUALIFIED_TYPE_NAME);
- OrmEntity abstractEntity = (OrmEntity) abstractPersistentType.getMapping();
- OrmPersistentType concretePersistentType = getEntityMappings().addPersistentType(MappingKeys.ENTITY_TYPE_MAPPING_KEY, PACKAGE_NAME + ".AnnotationTestTypeChild");
- OrmEntity concreteEntity = (OrmEntity) concretePersistentType.getMapping();
-
- assertEquals(null, abstractEntity.getSpecifiedInheritanceStrategy());
- assertEquals(InheritanceType.TABLE_PER_CLASS, abstractEntity.getDefaultInheritanceStrategy());
- assertEquals(null, concreteEntity.getSpecifiedInheritanceStrategy());
- assertEquals(InheritanceType.TABLE_PER_CLASS, concreteEntity.getDefaultInheritanceStrategy());
-
-
- assertEquals(null, abstractEntity.getTable().getDefaultName());
- assertEquals(null, abstractEntity.getTable().getDefaultCatalog());
- assertEquals(null, abstractEntity.getTable().getDefaultSchema());
-
- assertEquals("AnnotationTestTypeChild", concreteEntity.getTable().getDefaultName());
- assertEquals(null, concreteEntity.getTable().getDefaultCatalog());
- assertEquals(null, concreteEntity.getTable().getDefaultSchema());
-
- //meta-data complete true, inheritance strategy no single-table
- getEntityMappings().getPersistenceUnitMetadata().setXmlMappingMetadataComplete(true);
- assertEquals(TYPE_NAME, abstractEntity.getTable().getDefaultName());
- assertEquals(null, abstractEntity.getTable().getDefaultCatalog());
- assertEquals(null, abstractEntity.getTable().getDefaultSchema());
-
- assertEquals("AnnotationTestType", concreteEntity.getTable().getDefaultName());
- assertEquals(null, concreteEntity.getTable().getDefaultCatalog());
- assertEquals(null, concreteEntity.getTable().getDefaultSchema());
-
-
- //set inheritance strategy to table-per-class in orm.xml
- abstractEntity.setSpecifiedInheritanceStrategy(InheritanceType.TABLE_PER_CLASS);
- assertEquals(null, abstractEntity.getTable().getDefaultName());
- assertEquals(null, abstractEntity.getTable().getDefaultCatalog());
- assertEquals(null, abstractEntity.getTable().getDefaultSchema());
-
- assertEquals("AnnotationTestTypeChild", concreteEntity.getTable().getDefaultName());
- assertEquals(null, concreteEntity.getTable().getDefaultCatalog());
- assertEquals(null, concreteEntity.getTable().getDefaultSchema());
- }
-
-} \ No newline at end of file
diff --git a/jpa/tests/org.eclipse.jpt.core.tests/src/org/eclipse/jpt/core/tests/internal/context/orm/OrmTransientMappingTests.java b/jpa/tests/org.eclipse.jpt.core.tests/src/org/eclipse/jpt/core/tests/internal/context/orm/OrmTransientMappingTests.java
deleted file mode 100644
index 60946a9c1d..0000000000
--- a/jpa/tests/org.eclipse.jpt.core.tests/src/org/eclipse/jpt/core/tests/internal/context/orm/OrmTransientMappingTests.java
+++ /dev/null
@@ -1,302 +0,0 @@
-/*******************************************************************************
- * Copyright (c) 2007, 2009 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.
- *
- * Contributors:
- * Oracle - initial API and implementation
- ******************************************************************************/
-package org.eclipse.jpt.core.tests.internal.context.orm;
-
-import java.util.Iterator;
-import org.eclipse.jdt.core.ICompilationUnit;
-import org.eclipse.jpt.core.JptCorePlugin;
-import org.eclipse.jpt.core.MappingKeys;
-import org.eclipse.jpt.core.context.EmbeddedIdMapping;
-import org.eclipse.jpt.core.context.EmbeddedMapping;
-import org.eclipse.jpt.core.context.IdMapping;
-import org.eclipse.jpt.core.context.ManyToManyMapping;
-import org.eclipse.jpt.core.context.ManyToOneMapping;
-import org.eclipse.jpt.core.context.OneToManyMapping;
-import org.eclipse.jpt.core.context.OneToOneMapping;
-import org.eclipse.jpt.core.context.TransientMapping;
-import org.eclipse.jpt.core.context.VersionMapping;
-import org.eclipse.jpt.core.context.orm.OrmPersistentAttribute;
-import org.eclipse.jpt.core.context.orm.OrmPersistentType;
-import org.eclipse.jpt.core.context.orm.OrmTransientMapping;
-import org.eclipse.jpt.core.resource.java.JPA;
-import org.eclipse.jpt.core.resource.orm.XmlTransient;
-import org.eclipse.jpt.core.resource.persistence.PersistenceFactory;
-import org.eclipse.jpt.core.resource.persistence.XmlMappingFileRef;
-import org.eclipse.jpt.core.tests.internal.context.ContextModelTestCase;
-import org.eclipse.jpt.utility.internal.iterators.ArrayIterator;
-
-@SuppressWarnings("nls")
-public class OrmTransientMappingTests extends ContextModelTestCase
-{
- public OrmTransientMappingTests(String name) {
- super(name);
- }
-
- @Override
- protected void setUp() throws Exception {
- super.setUp();
- XmlMappingFileRef mappingFileRef = PersistenceFactory.eINSTANCE.createXmlMappingFileRef();
- mappingFileRef.setFileName(JptCorePlugin.DEFAULT_ORM_XML_FILE_PATH);
- getXmlPersistenceUnit().getMappingFiles().add(mappingFileRef);
- getPersistenceXmlResource().save(null);
- }
-
- private ICompilationUnit createTestEntityTransientMapping() throws Exception {
- return this.createTestType(new DefaultAnnotationWriter() {
- @Override
- public Iterator<String> imports() {
- return new ArrayIterator<String>(JPA.ENTITY, JPA.TRANSIENT);
- }
- @Override
- public void appendTypeAnnotationTo(StringBuilder sb) {
- sb.append("@Entity");
- }
-
- @Override
- public void appendIdFieldAnnotationTo(StringBuilder sb) {
- sb.append("@Transient");
- }
- });
- }
- public void testUpdateName() throws Exception {
- OrmPersistentType ormPersistentType = getEntityMappings().addPersistentType(MappingKeys.ENTITY_TYPE_MAPPING_KEY, "model.Foo");
- OrmPersistentAttribute ormPersistentAttribute = ormPersistentType.addSpecifiedPersistentAttribute(MappingKeys.TRANSIENT_ATTRIBUTE_MAPPING_KEY, "transientMapping");
- OrmTransientMapping xmlTransientnMapping = (OrmTransientMapping) ormPersistentAttribute.getMapping();
- XmlTransient transientResource = getXmlEntityMappings().getEntities().get(0).getAttributes().getTransients().get(0);
-
- assertEquals("transientMapping", xmlTransientnMapping.getName());
- assertEquals("transientMapping", transientResource.getName());
-
- //set name in the resource model, verify context model updated
- transientResource.setName("newName");
- assertEquals("newName", xmlTransientnMapping.getName());
- assertEquals("newName", transientResource.getName());
-
- //set name to null in the resource model
- transientResource.setName(null);
- assertNull(xmlTransientnMapping.getName());
- assertNull(transientResource.getName());
- }
-
- public void testModifyName() throws Exception {
- OrmPersistentType ormPersistentType = getEntityMappings().addPersistentType(MappingKeys.ENTITY_TYPE_MAPPING_KEY, "model.Foo");
- OrmPersistentAttribute ormPersistentAttribute = ormPersistentType.addSpecifiedPersistentAttribute(MappingKeys.TRANSIENT_ATTRIBUTE_MAPPING_KEY, "transientMapping");
- OrmTransientMapping xmlTransientnMapping = (OrmTransientMapping) ormPersistentAttribute.getMapping();
- XmlTransient transientResource = getXmlEntityMappings().getEntities().get(0).getAttributes().getTransients().get(0);
-
- assertEquals("transientMapping", xmlTransientnMapping.getName());
- assertEquals("transientMapping", transientResource.getName());
-
- //set name in the context model, verify resource model updated
- xmlTransientnMapping.setName("newName");
- assertEquals("newName", xmlTransientnMapping.getName());
- assertEquals("newName", transientResource.getName());
-
- //set name to null in the context model
- xmlTransientnMapping.setName(null);
- assertNull(xmlTransientnMapping.getName());
- assertNull(transientResource.getName());
- }
-
-
- public void testTransientMappingNoUnderylingJavaAttribute() throws Exception {
- createTestEntityTransientMapping();
-
- OrmPersistentType ormPersistentType = getEntityMappings().addPersistentType(MappingKeys.ENTITY_TYPE_MAPPING_KEY, FULLY_QUALIFIED_TYPE_NAME);
- ormPersistentType.addSpecifiedPersistentAttribute(MappingKeys.TRANSIENT_ATTRIBUTE_MAPPING_KEY, "foo");
- assertEquals(2, ormPersistentType.virtualAttributesSize());
-
- OrmPersistentAttribute ormPersistentAttribute = ormPersistentType.specifiedAttributes().next();
- OrmTransientMapping ormTransientMapping = (OrmTransientMapping) ormPersistentAttribute.getMapping();
-
- assertEquals("foo", ormTransientMapping.getName());
- }
-
- //@Basic(fetch=FetchType.LAZY, optional=false)
- //@Column(name="MY_COLUMN", unique=true, nullable=false, insertable=false, updatable=false,
- // columnDefinition="COLUMN_DEFINITION", table="MY_TABLE", length=5, precision=6, scale=7)");
- //@Column(
- //@Lob
- //@Temporal(TemporalType.TIMESTAMP)
- //@Enumerated(EnumType.STRING)
- public void testVirtualMappingMetadataCompleteFalse() throws Exception {
- createTestEntityTransientMapping();
- OrmPersistentType ormPersistentType = getEntityMappings().addPersistentType(MappingKeys.ENTITY_TYPE_MAPPING_KEY, FULLY_QUALIFIED_TYPE_NAME);
- assertEquals(2, ormPersistentType.virtualAttributesSize());
- OrmPersistentAttribute ormPersistentAttribute = ormPersistentType.virtualAttributes().next();
-
- OrmTransientMapping ormTransientMapping = (OrmTransientMapping) ormPersistentAttribute.getMapping();
- assertEquals("id", ormTransientMapping.getName());
- }
-
- public void testVirtualMappingMetadataCompleteTrue() throws Exception {
- createTestEntityTransientMapping();
- OrmPersistentType ormPersistentType = getEntityMappings().addPersistentType(MappingKeys.ENTITY_TYPE_MAPPING_KEY, FULLY_QUALIFIED_TYPE_NAME);
- ormPersistentType.getMapping().setSpecifiedMetadataComplete(Boolean.TRUE);
- assertEquals(2, ormPersistentType.virtualAttributesSize());
- OrmPersistentAttribute ormPersistentAttribute = ormPersistentType.virtualAttributes().next();
-
- assertEquals(MappingKeys.BASIC_ATTRIBUTE_MAPPING_KEY, ormPersistentAttribute.getMappingKey());
-
- ormPersistentAttribute.makeSpecified(MappingKeys.TRANSIENT_ATTRIBUTE_MAPPING_KEY);
- ormPersistentAttribute= ormPersistentType.specifiedAttributes().next();
-
- OrmTransientMapping ormTransientMapping = (OrmTransientMapping) ormPersistentAttribute.getMapping();
- assertEquals("id", ormTransientMapping.getName());
- }
-
- public void testSpecifiedMapping() throws Exception {
- createTestEntityTransientMapping();
-
- OrmPersistentType ormPersistentType = getEntityMappings().addPersistentType(MappingKeys.ENTITY_TYPE_MAPPING_KEY, FULLY_QUALIFIED_TYPE_NAME);
- ormPersistentType.addSpecifiedPersistentAttribute(MappingKeys.TRANSIENT_ATTRIBUTE_MAPPING_KEY, "id");
- assertEquals(1, ormPersistentType.virtualAttributesSize());
-
- OrmPersistentAttribute ormPersistentAttribute = ormPersistentType.specifiedAttributes().next();
- OrmTransientMapping ormTransientMapping = (OrmTransientMapping) ormPersistentAttribute.getMapping();
-
- assertEquals("id", ormTransientMapping.getName());
- }
-
- public void testTransientMorphToIdMapping() throws Exception {
- createTestEntityTransientMapping();
- OrmPersistentType ormPersistentType = getEntityMappings().addPersistentType(MappingKeys.ENTITY_TYPE_MAPPING_KEY, FULLY_QUALIFIED_TYPE_NAME);
- OrmPersistentAttribute ormPersistentAttribute = ormPersistentType.addSpecifiedPersistentAttribute(MappingKeys.TRANSIENT_ATTRIBUTE_MAPPING_KEY, "transient");
-
- TransientMapping transientMapping = (TransientMapping) ormPersistentAttribute.getMapping();
- assertFalse(transientMapping.isDefault());
-
- ormPersistentAttribute.setSpecifiedMappingKey(MappingKeys.ID_ATTRIBUTE_MAPPING_KEY);
- assertEquals(1, ormPersistentType.specifiedAttributesSize());
- assertEquals(ormPersistentAttribute, ormPersistentType.specifiedAttributes().next());
- assertTrue(ormPersistentAttribute.getMapping() instanceof IdMapping);
- assertEquals("transient", ormPersistentAttribute.getMapping().getName());
- }
-
- public void testTransientMorphToVersionMapping() throws Exception {
- createTestEntityTransientMapping();
- OrmPersistentType ormPersistentType = getEntityMappings().addPersistentType(MappingKeys.ENTITY_TYPE_MAPPING_KEY, FULLY_QUALIFIED_TYPE_NAME);
- OrmPersistentAttribute ormPersistentAttribute = ormPersistentType.addSpecifiedPersistentAttribute(MappingKeys.TRANSIENT_ATTRIBUTE_MAPPING_KEY, "transient");
-
- TransientMapping transientMapping = (TransientMapping) ormPersistentAttribute.getMapping();
- assertFalse(transientMapping.isDefault());
-
- ormPersistentAttribute.setSpecifiedMappingKey(MappingKeys.VERSION_ATTRIBUTE_MAPPING_KEY);
- assertEquals(1, ormPersistentType.specifiedAttributesSize());
- assertEquals(ormPersistentAttribute, ormPersistentType.specifiedAttributes().next());
- assertTrue(ormPersistentAttribute.getMapping() instanceof VersionMapping);
- assertEquals("transient", ormPersistentAttribute.getMapping().getName());
- }
-
- public void testTransientMorphToTransientMapping() throws Exception {
- createTestEntityTransientMapping();
- OrmPersistentType ormPersistentType = getEntityMappings().addPersistentType(MappingKeys.ENTITY_TYPE_MAPPING_KEY, FULLY_QUALIFIED_TYPE_NAME);
- OrmPersistentAttribute ormPersistentAttribute = ormPersistentType.addSpecifiedPersistentAttribute(MappingKeys.TRANSIENT_ATTRIBUTE_MAPPING_KEY, "transient");
-
- TransientMapping transientMapping = (TransientMapping) ormPersistentAttribute.getMapping();
- assertFalse(transientMapping.isDefault());
-
- ormPersistentAttribute.setSpecifiedMappingKey(MappingKeys.TRANSIENT_ATTRIBUTE_MAPPING_KEY);
- assertEquals(1, ormPersistentType.specifiedAttributesSize());
- assertEquals(ormPersistentAttribute, ormPersistentType.specifiedAttributes().next());
- assertTrue(ormPersistentAttribute.getMapping() instanceof TransientMapping);
- assertEquals("transient", ormPersistentAttribute.getMapping().getName());
- }
-
- public void testTransientMorphToEmbeddedMapping() throws Exception {
- createTestEntityTransientMapping();
- OrmPersistentType ormPersistentType = getEntityMappings().addPersistentType(MappingKeys.ENTITY_TYPE_MAPPING_KEY, FULLY_QUALIFIED_TYPE_NAME);
- OrmPersistentAttribute ormPersistentAttribute = ormPersistentType.addSpecifiedPersistentAttribute(MappingKeys.TRANSIENT_ATTRIBUTE_MAPPING_KEY, "transient");
-
- TransientMapping transientMapping = (TransientMapping) ormPersistentAttribute.getMapping();
- assertFalse(transientMapping.isDefault());
-
- ormPersistentAttribute.setSpecifiedMappingKey(MappingKeys.EMBEDDED_ATTRIBUTE_MAPPING_KEY);
- assertEquals(1, ormPersistentType.specifiedAttributesSize());
- assertEquals(ormPersistentAttribute, ormPersistentType.specifiedAttributes().next());
- assertTrue(ormPersistentAttribute.getMapping() instanceof EmbeddedMapping);
- assertEquals("transient", ormPersistentAttribute.getMapping().getName());
- }
-
- public void testTransientMorphToEmbeddedIdMapping() throws Exception {
- createTestEntityTransientMapping();
- OrmPersistentType ormPersistentType = getEntityMappings().addPersistentType(MappingKeys.ENTITY_TYPE_MAPPING_KEY, FULLY_QUALIFIED_TYPE_NAME);
- OrmPersistentAttribute ormPersistentAttribute = ormPersistentType.addSpecifiedPersistentAttribute(MappingKeys.TRANSIENT_ATTRIBUTE_MAPPING_KEY, "transient");
-
- TransientMapping transientMapping = (TransientMapping) ormPersistentAttribute.getMapping();
- assertFalse(transientMapping.isDefault());
-
- ormPersistentAttribute.setSpecifiedMappingKey(MappingKeys.EMBEDDED_ID_ATTRIBUTE_MAPPING_KEY);
- assertEquals(1, ormPersistentType.specifiedAttributesSize());
- assertEquals(ormPersistentAttribute, ormPersistentType.specifiedAttributes().next());
- assertTrue(ormPersistentAttribute.getMapping() instanceof EmbeddedIdMapping);
- assertEquals("transient", ormPersistentAttribute.getMapping().getName());
- }
-
- public void testTransientMorphToOneToOneMapping() throws Exception {
- createTestEntityTransientMapping();
- OrmPersistentType ormPersistentType = getEntityMappings().addPersistentType(MappingKeys.ENTITY_TYPE_MAPPING_KEY, FULLY_QUALIFIED_TYPE_NAME);
- OrmPersistentAttribute ormPersistentAttribute = ormPersistentType.addSpecifiedPersistentAttribute(MappingKeys.TRANSIENT_ATTRIBUTE_MAPPING_KEY, "transient");
-
- TransientMapping transientMapping = (TransientMapping) ormPersistentAttribute.getMapping();
- assertFalse(transientMapping.isDefault());
-
- ormPersistentAttribute.setSpecifiedMappingKey(MappingKeys.ONE_TO_ONE_ATTRIBUTE_MAPPING_KEY);
- assertEquals(1, ormPersistentType.specifiedAttributesSize());
- assertEquals(ormPersistentAttribute, ormPersistentType.specifiedAttributes().next());
- assertTrue(ormPersistentAttribute.getMapping() instanceof OneToOneMapping);
- assertEquals("transient", ormPersistentAttribute.getMapping().getName());
- }
-
- public void testTransientMorphToOneToManyMapping() throws Exception {
- createTestEntityTransientMapping();
- OrmPersistentType ormPersistentType = getEntityMappings().addPersistentType(MappingKeys.ENTITY_TYPE_MAPPING_KEY, FULLY_QUALIFIED_TYPE_NAME);
- OrmPersistentAttribute ormPersistentAttribute = ormPersistentType.addSpecifiedPersistentAttribute(MappingKeys.TRANSIENT_ATTRIBUTE_MAPPING_KEY, "transient");
-
- TransientMapping transientMapping = (TransientMapping) ormPersistentAttribute.getMapping();
- assertFalse(transientMapping.isDefault());
-
- ormPersistentAttribute.setSpecifiedMappingKey(MappingKeys.ONE_TO_MANY_ATTRIBUTE_MAPPING_KEY);
- assertEquals(1, ormPersistentType.specifiedAttributesSize());
- assertEquals(ormPersistentAttribute, ormPersistentType.specifiedAttributes().next());
- assertTrue(ormPersistentAttribute.getMapping() instanceof OneToManyMapping);
- assertEquals("transient", ormPersistentAttribute.getMapping().getName());
- }
-
- public void testTransientMorphToManyToOneMapping() throws Exception {
- createTestEntityTransientMapping();
- OrmPersistentType ormPersistentType = getEntityMappings().addPersistentType(MappingKeys.ENTITY_TYPE_MAPPING_KEY, FULLY_QUALIFIED_TYPE_NAME);
- OrmPersistentAttribute ormPersistentAttribute = ormPersistentType.addSpecifiedPersistentAttribute(MappingKeys.TRANSIENT_ATTRIBUTE_MAPPING_KEY, "transient");
-
- TransientMapping transientMapping = (TransientMapping) ormPersistentAttribute.getMapping();
- assertFalse(transientMapping.isDefault());
-
- ormPersistentAttribute.setSpecifiedMappingKey(MappingKeys.MANY_TO_ONE_ATTRIBUTE_MAPPING_KEY);
- assertEquals(1, ormPersistentType.specifiedAttributesSize());
- assertEquals(ormPersistentAttribute, ormPersistentType.specifiedAttributes().next());
- assertTrue(ormPersistentAttribute.getMapping() instanceof ManyToOneMapping);
- assertEquals("transient", ormPersistentAttribute.getMapping().getName());
- }
-
- public void testTransientMorphToManyToManyMapping() throws Exception {
- createTestEntityTransientMapping();
- OrmPersistentType ormPersistentType = getEntityMappings().addPersistentType(MappingKeys.ENTITY_TYPE_MAPPING_KEY, FULLY_QUALIFIED_TYPE_NAME);
- OrmPersistentAttribute ormPersistentAttribute = ormPersistentType.addSpecifiedPersistentAttribute(MappingKeys.TRANSIENT_ATTRIBUTE_MAPPING_KEY, "transient");
-
- TransientMapping transientMapping = (TransientMapping) ormPersistentAttribute.getMapping();
- assertFalse(transientMapping.isDefault());
-
- ormPersistentAttribute.setSpecifiedMappingKey(MappingKeys.MANY_TO_MANY_ATTRIBUTE_MAPPING_KEY);
- assertEquals(1, ormPersistentType.specifiedAttributesSize());
- assertEquals(ormPersistentAttribute, ormPersistentType.specifiedAttributes().next());
- assertTrue(ormPersistentAttribute.getMapping() instanceof ManyToManyMapping);
- assertEquals("transient", ormPersistentAttribute.getMapping().getName());
- }
-} \ No newline at end of file
diff --git a/jpa/tests/org.eclipse.jpt.core.tests/src/org/eclipse/jpt/core/tests/internal/context/orm/OrmVersionMappingTests.java b/jpa/tests/org.eclipse.jpt.core.tests/src/org/eclipse/jpt/core/tests/internal/context/orm/OrmVersionMappingTests.java
deleted file mode 100644
index 61829a4231..0000000000
--- a/jpa/tests/org.eclipse.jpt.core.tests/src/org/eclipse/jpt/core/tests/internal/context/orm/OrmVersionMappingTests.java
+++ /dev/null
@@ -1,486 +0,0 @@
-/*******************************************************************************
- * Copyright (c) 2007, 2009 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.
- *
- * Contributors:
- * Oracle - initial API and implementation
- ******************************************************************************/
-package org.eclipse.jpt.core.tests.internal.context.orm;
-
-import java.util.Iterator;
-import org.eclipse.jdt.core.ICompilationUnit;
-import org.eclipse.jpt.core.JptCorePlugin;
-import org.eclipse.jpt.core.MappingKeys;
-import org.eclipse.jpt.core.context.BasicMapping;
-import org.eclipse.jpt.core.context.Converter;
-import org.eclipse.jpt.core.context.EmbeddedIdMapping;
-import org.eclipse.jpt.core.context.EmbeddedMapping;
-import org.eclipse.jpt.core.context.IdMapping;
-import org.eclipse.jpt.core.context.ManyToManyMapping;
-import org.eclipse.jpt.core.context.ManyToOneMapping;
-import org.eclipse.jpt.core.context.OneToManyMapping;
-import org.eclipse.jpt.core.context.OneToOneMapping;
-import org.eclipse.jpt.core.context.TemporalConverter;
-import org.eclipse.jpt.core.context.TemporalType;
-import org.eclipse.jpt.core.context.TransientMapping;
-import org.eclipse.jpt.core.context.VersionMapping;
-import org.eclipse.jpt.core.context.orm.OrmColumn;
-import org.eclipse.jpt.core.context.orm.OrmPersistentAttribute;
-import org.eclipse.jpt.core.context.orm.OrmPersistentType;
-import org.eclipse.jpt.core.context.orm.OrmVersionMapping;
-import org.eclipse.jpt.core.resource.java.JPA;
-import org.eclipse.jpt.core.resource.orm.XmlVersion;
-import org.eclipse.jpt.core.resource.persistence.PersistenceFactory;
-import org.eclipse.jpt.core.resource.persistence.XmlMappingFileRef;
-import org.eclipse.jpt.core.tests.internal.context.ContextModelTestCase;
-import org.eclipse.jpt.utility.internal.iterators.ArrayIterator;
-
-@SuppressWarnings("nls")
-public class OrmVersionMappingTests extends ContextModelTestCase
-{
- public OrmVersionMappingTests(String name) {
- super(name);
- }
-
- @Override
- protected void setUp() throws Exception {
- super.setUp();
- XmlMappingFileRef mappingFileRef = PersistenceFactory.eINSTANCE.createXmlMappingFileRef();
- mappingFileRef.setFileName(JptCorePlugin.DEFAULT_ORM_XML_FILE_PATH);
- getXmlPersistenceUnit().getMappingFiles().add(mappingFileRef);
- getPersistenceXmlResource().save(null);
- }
-
- private ICompilationUnit createTestEntityVersionMapping() throws Exception {
- return this.createTestType(new DefaultAnnotationWriter() {
- @Override
- public Iterator<String> imports() {
- return new ArrayIterator<String>(JPA.ENTITY, JPA.VERSION, JPA.COLUMN, JPA.TEMPORAL, JPA.TEMPORAL_TYPE);
- }
- @Override
- public void appendTypeAnnotationTo(StringBuilder sb) {
- sb.append("@Entity");
- }
-
- @Override
- public void appendIdFieldAnnotationTo(StringBuilder sb) {
- sb.append("@Version");
- sb.append(CR);
- sb.append(" @Column(name=\"MY_COLUMN\", unique=true, nullable=false, insertable=false, updatable=false, columnDefinition=\"COLUMN_DEFINITION\", table=\"MY_TABLE\", length=5, precision=6, scale=7)");
- sb.append(CR);
- sb.append(" @Temporal(TemporalType.TIMESTAMP)");
- }
- });
- }
-
- public void testUpdateName() throws Exception {
- OrmPersistentType ormPersistentType = getEntityMappings().addPersistentType(MappingKeys.ENTITY_TYPE_MAPPING_KEY, "model.Foo");
- OrmPersistentAttribute ormPersistentAttribute = ormPersistentType.addSpecifiedPersistentAttribute(MappingKeys.VERSION_ATTRIBUTE_MAPPING_KEY, "versionMapping");
- OrmVersionMapping ormVersionMapping = (OrmVersionMapping) ormPersistentAttribute.getMapping();
- XmlVersion versionResource = getXmlEntityMappings().getEntities().get(0).getAttributes().getVersions().get(0);
-
- assertEquals("versionMapping", ormVersionMapping.getName());
- assertEquals("versionMapping", versionResource.getName());
-
- //set name in the resource model, verify context model updated
- versionResource.setName("newName");
- assertEquals("newName", ormVersionMapping.getName());
- assertEquals("newName", versionResource.getName());
-
- //set name to null in the resource model
- versionResource.setName(null);
- assertNull(ormVersionMapping.getName());
- assertNull(versionResource.getName());
- }
-
- public void testModifyName() throws Exception {
- OrmPersistentType ormPersistentType = getEntityMappings().addPersistentType(MappingKeys.ENTITY_TYPE_MAPPING_KEY, "model.Foo");
- OrmPersistentAttribute ormPersistentAttribute = ormPersistentType.addSpecifiedPersistentAttribute(MappingKeys.VERSION_ATTRIBUTE_MAPPING_KEY, "versionMapping");
- OrmVersionMapping ormVersionMapping = (OrmVersionMapping) ormPersistentAttribute.getMapping();
- XmlVersion versionResource = getXmlEntityMappings().getEntities().get(0).getAttributes().getVersions().get(0);
-
- assertEquals("versionMapping", ormVersionMapping.getName());
- assertEquals("versionMapping", versionResource.getName());
-
- //set name in the context model, verify resource model updated
- ormVersionMapping.setName("newName");
- assertEquals("newName", ormVersionMapping.getName());
- assertEquals("newName", versionResource.getName());
-
- //set name to null in the context model
- ormVersionMapping.setName(null);
- assertNull(ormVersionMapping.getName());
- assertNull(versionResource.getName());
- }
-
- public void testUpdateTemporal() throws Exception {
- OrmPersistentType ormPersistentType = getEntityMappings().addPersistentType(MappingKeys.ENTITY_TYPE_MAPPING_KEY, "model.Foo");
- OrmPersistentAttribute ormPersistentAttribute = ormPersistentType.addSpecifiedPersistentAttribute(MappingKeys.VERSION_ATTRIBUTE_MAPPING_KEY, "versionMapping");
- OrmVersionMapping ormVersionMapping = (OrmVersionMapping) ormPersistentAttribute.getMapping();
- XmlVersion versionResource = getXmlEntityMappings().getEntities().get(0).getAttributes().getVersions().get(0);
-
- assertNull(ormVersionMapping.getSpecifiedConverter());
- assertNull(versionResource.getTemporal());
-
- //set temporal in the resource model, verify context model updated
- versionResource.setTemporal(org.eclipse.jpt.core.resource.orm.TemporalType.DATE);
- assertEquals(TemporalType.DATE, ((TemporalConverter) ormVersionMapping.getConverter()).getTemporalType());
- assertEquals(org.eclipse.jpt.core.resource.orm.TemporalType.DATE, versionResource.getTemporal());
-
- versionResource.setTemporal(org.eclipse.jpt.core.resource.orm.TemporalType.TIME);
- assertEquals(TemporalType.TIME, ((TemporalConverter) ormVersionMapping.getConverter()).getTemporalType());
- assertEquals(org.eclipse.jpt.core.resource.orm.TemporalType.TIME, versionResource.getTemporal());
-
- versionResource.setTemporal(org.eclipse.jpt.core.resource.orm.TemporalType.TIMESTAMP);
- assertEquals(TemporalType.TIMESTAMP, ((TemporalConverter) ormVersionMapping.getConverter()).getTemporalType());
- assertEquals(org.eclipse.jpt.core.resource.orm.TemporalType.TIMESTAMP, versionResource.getTemporal());
-
- //set temporal to null in the resource model
- versionResource.setTemporal(null);
- assertNull(ormVersionMapping.getSpecifiedConverter());
- assertNull(versionResource.getTemporal());
- }
-
- public void testModifyTemporal() throws Exception {
- OrmPersistentType ormPersistentType = getEntityMappings().addPersistentType(MappingKeys.ENTITY_TYPE_MAPPING_KEY, "model.Foo");
- OrmPersistentAttribute ormPersistentAttribute = ormPersistentType.addSpecifiedPersistentAttribute(MappingKeys.VERSION_ATTRIBUTE_MAPPING_KEY, "versionMapping");
- OrmVersionMapping ormVersionMapping = (OrmVersionMapping) ormPersistentAttribute.getMapping();
- XmlVersion versionResource = getXmlEntityMappings().getEntities().get(0).getAttributes().getVersions().get(0);
-
- assertNull(ormVersionMapping.getSpecifiedConverter());
- assertNull(versionResource.getTemporal());
-
- //set temporal in the context model, verify resource model updated
- ormVersionMapping.setSpecifiedConverter(Converter.TEMPORAL_CONVERTER);
- ((TemporalConverter) ormVersionMapping.getSpecifiedConverter()).setTemporalType(TemporalType.DATE);
- assertEquals(org.eclipse.jpt.core.resource.orm.TemporalType.DATE, versionResource.getTemporal());
- assertEquals(TemporalType.DATE, ((TemporalConverter) ormVersionMapping.getSpecifiedConverter()).getTemporalType());
-
- ((TemporalConverter) ormVersionMapping.getSpecifiedConverter()).setTemporalType(TemporalType.TIME);
- assertEquals(org.eclipse.jpt.core.resource.orm.TemporalType.TIME, versionResource.getTemporal());
- assertEquals(TemporalType.TIME, ((TemporalConverter) ormVersionMapping.getSpecifiedConverter()).getTemporalType());
-
- ((TemporalConverter) ormVersionMapping.getSpecifiedConverter()).setTemporalType(TemporalType.TIMESTAMP);
- assertEquals(org.eclipse.jpt.core.resource.orm.TemporalType.TIMESTAMP, versionResource.getTemporal());
- assertEquals(TemporalType.TIMESTAMP, ((TemporalConverter) ormVersionMapping.getSpecifiedConverter()).getTemporalType());
-
- //set temporal to null in the context model
- ormVersionMapping.setSpecifiedConverter(null);
- assertNull(versionResource.getTemporal());
- assertNull(ormVersionMapping.getSpecifiedConverter());
- }
-
- //TODO test defaults
- //TODO test overriding java mapping with a different mapping type in xml
-
- public void testVersionMappingNoUnderylingJavaAttribute() throws Exception {
- createTestEntityVersionMapping();
-
- OrmPersistentType ormPersistentType = getEntityMappings().addPersistentType(MappingKeys.ENTITY_TYPE_MAPPING_KEY, FULLY_QUALIFIED_TYPE_NAME);
- ormPersistentType.addSpecifiedPersistentAttribute(MappingKeys.VERSION_ATTRIBUTE_MAPPING_KEY, "foo");
- assertEquals(2, ormPersistentType.virtualAttributesSize());
-
- OrmPersistentAttribute ormPersistentAttribute = ormPersistentType.specifiedAttributes().next();
- OrmVersionMapping ormVersionMapping = (OrmVersionMapping) ormPersistentAttribute.getMapping();
-
- assertEquals("foo", ormVersionMapping.getName());
- assertNull(ormVersionMapping.getSpecifiedConverter());
-
-
- OrmColumn ormColumn = ormVersionMapping.getColumn();
- assertNull(ormColumn.getSpecifiedName());
- assertNull(ormColumn.getSpecifiedUnique());
- assertNull(ormColumn.getSpecifiedNullable());
- assertNull(ormColumn.getSpecifiedInsertable());
- assertNull(ormColumn.getSpecifiedUpdatable());
- assertNull(ormColumn.getColumnDefinition());
- assertNull(ormColumn.getSpecifiedTable());
- assertNull(ormColumn.getSpecifiedLength());
- assertNull(ormColumn.getSpecifiedPrecision());
- assertNull(ormColumn.getSpecifiedScale());
-
- assertEquals("foo", ormColumn.getDefaultName());
- assertEquals(false, ormColumn.isDefaultUnique());
- assertEquals(true, ormColumn.isDefaultNullable());
- assertEquals(true, ormColumn.isDefaultInsertable());
- assertEquals(true, ormColumn.isDefaultUpdatable());
- assertEquals(null, ormColumn.getColumnDefinition());
- assertEquals(TYPE_NAME, ormColumn.getDefaultTable());
- assertEquals(255, ormColumn.getDefaultLength());
- assertEquals(0, ormColumn.getDefaultPrecision());
- assertEquals(0, ormColumn.getDefaultScale());
- }
-
- //@Basic(fetch=FetchType.LAZY, optional=false)
- //@Column(name="MY_COLUMN", unique=true, nullable=false, insertable=false, updatable=false,
- // columnDefinition="COLUMN_DEFINITION", table="MY_TABLE", length=5, precision=6, scale=7)");
- //@Column(
- //@Lob
- //@Temporal(TemporalType.TIMESTAMP)
- //@Enumerated(EnumType.STRING)
- public void testVirtualMappingMetadataCompleteFalse() throws Exception {
- createTestEntityVersionMapping();
- OrmPersistentType ormPersistentType = getEntityMappings().addPersistentType(MappingKeys.ENTITY_TYPE_MAPPING_KEY, FULLY_QUALIFIED_TYPE_NAME);
- assertEquals(2, ormPersistentType.virtualAttributesSize());
- OrmPersistentAttribute ormPersistentAttribute = ormPersistentType.virtualAttributes().next();
-
- OrmVersionMapping ormVersionMapping = (OrmVersionMapping) ormPersistentAttribute.getMapping();
- assertEquals("id", ormVersionMapping.getName());
- assertEquals(Converter.TEMPORAL_CONVERTER, ormVersionMapping.getConverter().getType());
- assertEquals(TemporalType.TIMESTAMP, ((TemporalConverter) ormVersionMapping.getConverter()).getTemporalType());
-
- OrmColumn ormColumn = ormVersionMapping.getColumn();
- assertEquals("MY_COLUMN", ormColumn.getSpecifiedName());
- assertEquals(Boolean.TRUE, ormColumn.getSpecifiedUnique());
- assertEquals(Boolean.FALSE, ormColumn.getSpecifiedNullable());
- assertEquals(Boolean.FALSE, ormColumn.getSpecifiedInsertable());
- assertEquals(Boolean.FALSE, ormColumn.getSpecifiedUpdatable());
- assertEquals("COLUMN_DEFINITION", ormColumn.getColumnDefinition());
- assertEquals("MY_TABLE", ormColumn.getSpecifiedTable());
- assertEquals(Integer.valueOf(5), ormColumn.getSpecifiedLength());
- assertEquals(Integer.valueOf(6), ormColumn.getSpecifiedPrecision());
- assertEquals(Integer.valueOf(7), ormColumn.getSpecifiedScale());
- }
-
- public void testVirtualMappingMetadataCompleteTrue() throws Exception {
- createTestEntityVersionMapping();
- OrmPersistentType ormPersistentType = getEntityMappings().addPersistentType(MappingKeys.ENTITY_TYPE_MAPPING_KEY, FULLY_QUALIFIED_TYPE_NAME);
- ormPersistentType.getMapping().setSpecifiedMetadataComplete(Boolean.TRUE);
- assertEquals(2, ormPersistentType.virtualAttributesSize());
- OrmPersistentAttribute ormPersistentAttribute = ormPersistentType.virtualAttributes().next();
-
- assertEquals(MappingKeys.BASIC_ATTRIBUTE_MAPPING_KEY, ormPersistentAttribute.getMappingKey());
-
- ormPersistentAttribute.makeSpecified(MappingKeys.VERSION_ATTRIBUTE_MAPPING_KEY);
- ormPersistentAttribute= ormPersistentType.specifiedAttributes().next();
-
- OrmVersionMapping ormVersionMapping = (OrmVersionMapping) ormPersistentAttribute.getMapping();
- assertEquals("id", ormVersionMapping.getName());
- assertNull(ormVersionMapping.getSpecifiedConverter());
-
- OrmColumn ormColumn = ormVersionMapping.getColumn();
- assertEquals("id", ormColumn.getName());
- assertEquals(false, ormColumn.isDefaultUnique());
- assertEquals(true, ormColumn.isDefaultNullable());
- assertEquals(true, ormColumn.isDefaultInsertable());
- assertEquals(true, ormColumn.isDefaultUpdatable());
- assertNull(ormColumn.getColumnDefinition());
- assertEquals(TYPE_NAME, ormColumn.getTable());
- assertEquals(255, ormColumn.getLength());
- assertEquals(0, ormColumn.getPrecision());
- assertEquals(0, ormColumn.getScale());
- }
-
- public void testSpecifiedMapping() throws Exception {
- createTestEntityVersionMapping();
-
- OrmPersistentType ormPersistentType = getEntityMappings().addPersistentType(MappingKeys.ENTITY_TYPE_MAPPING_KEY, FULLY_QUALIFIED_TYPE_NAME);
- ormPersistentType.addSpecifiedPersistentAttribute(MappingKeys.VERSION_ATTRIBUTE_MAPPING_KEY, "id");
- assertEquals(1, ormPersistentType.virtualAttributesSize());
-
- OrmPersistentAttribute ormPersistentAttribute = ormPersistentType.specifiedAttributes().next();
- OrmVersionMapping ormVersionMapping = (OrmVersionMapping) ormPersistentAttribute.getMapping();
-
- assertEquals("id", ormVersionMapping.getName());
- assertNull(ormVersionMapping.getSpecifiedConverter());
-
- OrmColumn ormColumn = ormVersionMapping.getColumn();
- assertNull(ormColumn.getSpecifiedName());
- assertNull(ormColumn.getSpecifiedUnique());
- assertNull(ormColumn.getSpecifiedNullable());
- assertNull(ormColumn.getSpecifiedInsertable());
- assertNull(ormColumn.getSpecifiedUpdatable());
- assertNull(ormColumn.getColumnDefinition());
- assertNull(ormColumn.getSpecifiedTable());
- assertNull(ormColumn.getSpecifiedLength());
- assertNull(ormColumn.getSpecifiedPrecision());
- assertNull(ormColumn.getSpecifiedScale());
-
- assertEquals("id", ormColumn.getDefaultName());
- assertEquals(false, ormColumn.isDefaultUnique());
- assertEquals(true, ormColumn.isDefaultNullable());
- assertEquals(true, ormColumn.isDefaultInsertable());
- assertEquals(true, ormColumn.isDefaultUpdatable());
- assertEquals(null, ormColumn.getColumnDefinition());
- assertEquals(TYPE_NAME, ormColumn.getDefaultTable());
- assertEquals(255, ormColumn.getDefaultLength());
- assertEquals(0, ormColumn.getDefaultPrecision());
- assertEquals(0, ormColumn.getDefaultScale());
- }
-
- public void testVersionMorphToIdMapping() throws Exception {
- createTestEntityVersionMapping();
- OrmPersistentType ormPersistentType = getEntityMappings().addPersistentType(MappingKeys.ENTITY_TYPE_MAPPING_KEY, FULLY_QUALIFIED_TYPE_NAME);
- OrmPersistentAttribute ormPersistentAttribute = ormPersistentType.addSpecifiedPersistentAttribute(MappingKeys.VERSION_ATTRIBUTE_MAPPING_KEY, "version");
-
- VersionMapping versionMapping = (VersionMapping) ormPersistentAttribute.getMapping();
- assertFalse(versionMapping.isDefault());
- versionMapping.getColumn().setSpecifiedName("FOO");
- versionMapping.setSpecifiedConverter(Converter.TEMPORAL_CONVERTER);
- ((TemporalConverter) versionMapping.getSpecifiedConverter()).setTemporalType(TemporalType.TIME);
- assertFalse(versionMapping.isDefault());
-
- ormPersistentAttribute.setSpecifiedMappingKey(MappingKeys.ID_ATTRIBUTE_MAPPING_KEY);
- assertEquals(1, ormPersistentType.specifiedAttributesSize());
- assertEquals(ormPersistentAttribute, ormPersistentType.specifiedAttributes().next());
- assertTrue(ormPersistentAttribute.getMapping() instanceof IdMapping);
- assertEquals("version", ormPersistentAttribute.getMapping().getName());
- assertEquals("FOO", ((IdMapping) ormPersistentAttribute.getMapping()).getColumn().getSpecifiedName());
- }
-
- public void testVersionMorphToBasicMapping() throws Exception {
- createTestEntityVersionMapping();
- OrmPersistentType ormPersistentType = getEntityMappings().addPersistentType(MappingKeys.ENTITY_TYPE_MAPPING_KEY, FULLY_QUALIFIED_TYPE_NAME);
- OrmPersistentAttribute ormPersistentAttribute = ormPersistentType.addSpecifiedPersistentAttribute(MappingKeys.VERSION_ATTRIBUTE_MAPPING_KEY, "version");
-
- VersionMapping versionMapping = (VersionMapping) ormPersistentAttribute.getMapping();
- assertFalse(versionMapping.isDefault());
- versionMapping.getColumn().setSpecifiedName("FOO");
- versionMapping.setSpecifiedConverter(Converter.TEMPORAL_CONVERTER);
- ((TemporalConverter) versionMapping.getSpecifiedConverter()).setTemporalType(TemporalType.TIME);
- assertFalse(versionMapping.isDefault());
-
- ormPersistentAttribute.setSpecifiedMappingKey(MappingKeys.BASIC_ATTRIBUTE_MAPPING_KEY);
- assertEquals(1, ormPersistentType.specifiedAttributesSize());
- assertEquals(ormPersistentAttribute, ormPersistentType.specifiedAttributes().next());
- assertTrue(ormPersistentAttribute.getMapping() instanceof BasicMapping);
- assertEquals("version", ormPersistentAttribute.getMapping().getName());
- assertEquals("FOO", ((BasicMapping) ormPersistentAttribute.getMapping()).getColumn().getSpecifiedName());
- }
-
- public void testVersionMorphToTransientMapping() throws Exception {
- createTestEntityVersionMapping();
- OrmPersistentType ormPersistentType = getEntityMappings().addPersistentType(MappingKeys.ENTITY_TYPE_MAPPING_KEY, FULLY_QUALIFIED_TYPE_NAME);
- OrmPersistentAttribute ormPersistentAttribute = ormPersistentType.addSpecifiedPersistentAttribute(MappingKeys.VERSION_ATTRIBUTE_MAPPING_KEY, "version");
-
- VersionMapping versionMapping = (VersionMapping) ormPersistentAttribute.getMapping();
- assertFalse(versionMapping.isDefault());
- versionMapping.getColumn().setSpecifiedName("FOO");
- versionMapping.setSpecifiedConverter(Converter.TEMPORAL_CONVERTER);
- ((TemporalConverter) versionMapping.getSpecifiedConverter()).setTemporalType(TemporalType.TIME);
- assertFalse(versionMapping.isDefault());
-
- ormPersistentAttribute.setSpecifiedMappingKey(MappingKeys.TRANSIENT_ATTRIBUTE_MAPPING_KEY);
- assertEquals(1, ormPersistentType.specifiedAttributesSize());
- assertEquals(ormPersistentAttribute, ormPersistentType.specifiedAttributes().next());
- assertTrue(ormPersistentAttribute.getMapping() instanceof TransientMapping);
- assertEquals("version", ormPersistentAttribute.getMapping().getName());
- }
-
- public void testVersionMorphToEmbeddedMapping() throws Exception {
- createTestEntityVersionMapping();
- OrmPersistentType ormPersistentType = getEntityMappings().addPersistentType(MappingKeys.ENTITY_TYPE_MAPPING_KEY, FULLY_QUALIFIED_TYPE_NAME);
- OrmPersistentAttribute ormPersistentAttribute = ormPersistentType.addSpecifiedPersistentAttribute(MappingKeys.VERSION_ATTRIBUTE_MAPPING_KEY, "version");
-
- VersionMapping versionMapping = (VersionMapping) ormPersistentAttribute.getMapping();
- assertFalse(versionMapping.isDefault());
- versionMapping.getColumn().setSpecifiedName("FOO");
- versionMapping.setSpecifiedConverter(Converter.TEMPORAL_CONVERTER);
- ((TemporalConverter) versionMapping.getSpecifiedConverter()).setTemporalType(TemporalType.TIME);
- assertFalse(versionMapping.isDefault());
-
- ormPersistentAttribute.setSpecifiedMappingKey(MappingKeys.EMBEDDED_ATTRIBUTE_MAPPING_KEY);
- assertEquals(1, ormPersistentType.specifiedAttributesSize());
- assertEquals(ormPersistentAttribute, ormPersistentType.specifiedAttributes().next());
- assertTrue(ormPersistentAttribute.getMapping() instanceof EmbeddedMapping);
- assertEquals("version", ormPersistentAttribute.getMapping().getName());
- }
-
- public void testVersionMorphToEmbeddedIdMapping() throws Exception {
- createTestEntityVersionMapping();
- OrmPersistentType ormPersistentType = getEntityMappings().addPersistentType(MappingKeys.ENTITY_TYPE_MAPPING_KEY, FULLY_QUALIFIED_TYPE_NAME);
- OrmPersistentAttribute ormPersistentAttribute = ormPersistentType.addSpecifiedPersistentAttribute(MappingKeys.VERSION_ATTRIBUTE_MAPPING_KEY, "version");
-
- VersionMapping versionMapping = (VersionMapping) ormPersistentAttribute.getMapping();
- assertFalse(versionMapping.isDefault());
- versionMapping.getColumn().setSpecifiedName("FOO");
- versionMapping.setSpecifiedConverter(Converter.TEMPORAL_CONVERTER);
- ((TemporalConverter) versionMapping.getSpecifiedConverter()).setTemporalType(TemporalType.TIME);
- assertFalse(versionMapping.isDefault());
-
- ormPersistentAttribute.setSpecifiedMappingKey(MappingKeys.EMBEDDED_ID_ATTRIBUTE_MAPPING_KEY);
- assertEquals(1, ormPersistentType.specifiedAttributesSize());
- assertEquals(ormPersistentAttribute, ormPersistentType.specifiedAttributes().next());
- assertTrue(ormPersistentAttribute.getMapping() instanceof EmbeddedIdMapping);
- assertEquals("version", ormPersistentAttribute.getMapping().getName());
- }
-
- public void testVersionMorphToOneToOneMapping() throws Exception {
- createTestEntityVersionMapping();
- OrmPersistentType ormPersistentType = getEntityMappings().addPersistentType(MappingKeys.ENTITY_TYPE_MAPPING_KEY, FULLY_QUALIFIED_TYPE_NAME);
- OrmPersistentAttribute ormPersistentAttribute = ormPersistentType.addSpecifiedPersistentAttribute(MappingKeys.VERSION_ATTRIBUTE_MAPPING_KEY, "version");
-
- VersionMapping versionMapping = (VersionMapping) ormPersistentAttribute.getMapping();
- assertFalse(versionMapping.isDefault());
- versionMapping.getColumn().setSpecifiedName("FOO");
- versionMapping.setSpecifiedConverter(Converter.TEMPORAL_CONVERTER);
- ((TemporalConverter) versionMapping.getSpecifiedConverter()).setTemporalType(TemporalType.TIME);
- assertFalse(versionMapping.isDefault());
-
- ormPersistentAttribute.setSpecifiedMappingKey(MappingKeys.ONE_TO_ONE_ATTRIBUTE_MAPPING_KEY);
- assertEquals(1, ormPersistentType.specifiedAttributesSize());
- assertEquals(ormPersistentAttribute, ormPersistentType.specifiedAttributes().next());
- assertTrue(ormPersistentAttribute.getMapping() instanceof OneToOneMapping);
- assertEquals("version", ormPersistentAttribute.getMapping().getName());
- }
-
- public void testVersionMorphToOneToManyMapping() throws Exception {
- createTestEntityVersionMapping();
- OrmPersistentType ormPersistentType = getEntityMappings().addPersistentType(MappingKeys.ENTITY_TYPE_MAPPING_KEY, FULLY_QUALIFIED_TYPE_NAME);
- OrmPersistentAttribute ormPersistentAttribute = ormPersistentType.addSpecifiedPersistentAttribute(MappingKeys.VERSION_ATTRIBUTE_MAPPING_KEY, "version");
-
- VersionMapping versionMapping = (VersionMapping) ormPersistentAttribute.getMapping();
- assertFalse(versionMapping.isDefault());
- versionMapping.getColumn().setSpecifiedName("FOO");
- versionMapping.setSpecifiedConverter(Converter.TEMPORAL_CONVERTER);
- ((TemporalConverter) versionMapping.getSpecifiedConverter()).setTemporalType(TemporalType.TIME);
- assertFalse(versionMapping.isDefault());
-
- ormPersistentAttribute.setSpecifiedMappingKey(MappingKeys.ONE_TO_MANY_ATTRIBUTE_MAPPING_KEY);
- assertEquals(1, ormPersistentType.specifiedAttributesSize());
- assertEquals(ormPersistentAttribute, ormPersistentType.specifiedAttributes().next());
- assertTrue(ormPersistentAttribute.getMapping() instanceof OneToManyMapping);
- assertEquals("version", ormPersistentAttribute.getMapping().getName());
- }
-
- public void testVersionMorphToManyToOneMapping() throws Exception {
- createTestEntityVersionMapping();
- OrmPersistentType ormPersistentType = getEntityMappings().addPersistentType(MappingKeys.ENTITY_TYPE_MAPPING_KEY, FULLY_QUALIFIED_TYPE_NAME);
- OrmPersistentAttribute ormPersistentAttribute = ormPersistentType.addSpecifiedPersistentAttribute(MappingKeys.VERSION_ATTRIBUTE_MAPPING_KEY, "version");
-
- VersionMapping versionMapping = (VersionMapping) ormPersistentAttribute.getMapping();
- assertFalse(versionMapping.isDefault());
- versionMapping.getColumn().setSpecifiedName("FOO");
- versionMapping.setSpecifiedConverter(Converter.TEMPORAL_CONVERTER);
- ((TemporalConverter) versionMapping.getSpecifiedConverter()).setTemporalType(TemporalType.TIME);
- assertFalse(versionMapping.isDefault());
-
- ormPersistentAttribute.setSpecifiedMappingKey(MappingKeys.MANY_TO_ONE_ATTRIBUTE_MAPPING_KEY);
- assertEquals(1, ormPersistentType.specifiedAttributesSize());
- assertEquals(ormPersistentAttribute, ormPersistentType.specifiedAttributes().next());
- assertTrue(ormPersistentAttribute.getMapping() instanceof ManyToOneMapping);
- assertEquals("version", ormPersistentAttribute.getMapping().getName());
- }
-
- public void testVersionMorphToManyToManyMapping() throws Exception {
- createTestEntityVersionMapping();
- OrmPersistentType ormPersistentType = getEntityMappings().addPersistentType(MappingKeys.ENTITY_TYPE_MAPPING_KEY, FULLY_QUALIFIED_TYPE_NAME);
- OrmPersistentAttribute ormPersistentAttribute = ormPersistentType.addSpecifiedPersistentAttribute(MappingKeys.VERSION_ATTRIBUTE_MAPPING_KEY, "version");
-
- VersionMapping versionMapping = (VersionMapping) ormPersistentAttribute.getMapping();
- assertFalse(versionMapping.isDefault());
- versionMapping.getColumn().setSpecifiedName("FOO");
- versionMapping.setSpecifiedConverter(Converter.TEMPORAL_CONVERTER);
- ((TemporalConverter) versionMapping.getSpecifiedConverter()).setTemporalType(TemporalType.TIME);
- assertFalse(versionMapping.isDefault());
-
- ormPersistentAttribute.setSpecifiedMappingKey(MappingKeys.MANY_TO_MANY_ATTRIBUTE_MAPPING_KEY);
- assertEquals(1, ormPersistentType.specifiedAttributesSize());
- assertEquals(ormPersistentAttribute, ormPersistentType.specifiedAttributes().next());
- assertTrue(ormPersistentAttribute.getMapping() instanceof ManyToManyMapping);
- assertEquals("version", ormPersistentAttribute.getMapping().getName());
- }
-
-} \ No newline at end of file
diff --git a/jpa/tests/org.eclipse.jpt.core.tests/src/org/eclipse/jpt/core/tests/internal/context/orm/OrmXmlTests.java b/jpa/tests/org.eclipse.jpt.core.tests/src/org/eclipse/jpt/core/tests/internal/context/orm/OrmXmlTests.java
deleted file mode 100644
index 2f7a845fef..0000000000
--- a/jpa/tests/org.eclipse.jpt.core.tests/src/org/eclipse/jpt/core/tests/internal/context/orm/OrmXmlTests.java
+++ /dev/null
@@ -1,113 +0,0 @@
-/*******************************************************************************
- * Copyright (c) 2007, 2009 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.
- *
- * Contributors:
- * Oracle - initial API and implementation
- ******************************************************************************/
-package org.eclipse.jpt.core.tests.internal.context.orm;
-
-import org.eclipse.jpt.core.JptCorePlugin;
-import org.eclipse.jpt.core.context.orm.OrmXml;
-import org.eclipse.jpt.core.resource.orm.OrmFactory;
-import org.eclipse.jpt.core.resource.orm.XmlEntityMappings;
-import org.eclipse.jpt.core.resource.persistence.PersistenceFactory;
-import org.eclipse.jpt.core.resource.persistence.XmlMappingFileRef;
-import org.eclipse.jpt.core.resource.xml.JpaXmlResource;
-import org.eclipse.jpt.core.tests.internal.context.ContextModelTestCase;
-
-@SuppressWarnings("nls")
-public class OrmXmlTests extends ContextModelTestCase
-{
- public OrmXmlTests(String name) {
- super(name);
- }
-
- @Override
- protected void setUp() throws Exception {
- super.setUp();
- getXmlPersistenceUnit().setName("foo");
- XmlMappingFileRef mappingFileRef = PersistenceFactory.eINSTANCE.createXmlMappingFileRef();
- mappingFileRef.setFileName(JptCorePlugin.DEFAULT_ORM_XML_FILE_PATH);
- getXmlPersistenceUnit().getMappingFiles().add(mappingFileRef);
- getPersistenceXmlResource().save(null);
- }
-
- protected OrmXml getOrmXml() {
- return (OrmXml) getPersistenceUnit().mappingFileRefs().next().getMappingFile();
- }
-
- public void testUpdateAddEntityMappings() throws Exception {
- assertEquals(2, getJpaProject().jpaFilesSize());
- JpaXmlResource ormResource = getOrmXmlResource();
- ormResource.getContents().clear();
- ormResource.save(null);
-
- //the ContentType of the orm.xml file is no longer orm, so the jpa file is removed
- assertNull(getOrmXml());
- assertEquals(1, getJpaProject().jpaFilesSize()); //should only be the persistence.xml file
-
- XmlEntityMappings xmlEntityMappings = OrmFactory.eINSTANCE.createXmlEntityMappings();
- xmlEntityMappings.setVersion("1.0");
- ormResource.getContents().add(xmlEntityMappings);
- ormResource.save(null);
-
- assertNotNull(getOrmXml().getEntityMappings());
- assertEquals(2, getJpaProject().jpaFilesSize());
- }
-
- public void testModifyAddEntityMappings() {
- JpaXmlResource ormResource = getOrmXmlResource();
- ormResource.getContents().remove(getXmlEntityMappings());
- assertNull(getXmlEntityMappings());
-
- OrmXml ormXml = getOrmXml();
- assertNull(ormXml.getRoot());
-
- ormXml.addEntityMappings();
-
- assertNotNull(ormXml.getRoot());
-
- boolean exceptionThrown = false;
- try {
- ormXml.addEntityMappings();
- }
- catch (IllegalStateException ise) {
- exceptionThrown = true;
- }
-
- assertTrue("IllegalStateException was not thrown", exceptionThrown);
- }
-
- public void testUpdateRemoveEntityMappings() throws Exception {
- JpaXmlResource ormResource = getOrmXmlResource();
-
- assertNotNull(getOrmXml().getRoot());
-
- ormResource.getContents().clear();
-
- assertNull(getOrmXml().getRoot());
- }
-
- public void testModifyRemoveEntityMappings() {
- OrmXml ormXml = getOrmXml();
-
- assertNotNull(ormXml.getRoot());
-
- ormXml.removeEntityMappings();
-
- assertNull(ormXml.getRoot());
-
- boolean exceptionThrown = false;
- try {
- ormXml.removeEntityMappings();
- }
- catch (IllegalStateException ise) {
- exceptionThrown = true;
- }
-
- assertTrue("IllegalStateException was not thrown", exceptionThrown);
- }
-}
diff --git a/jpa/tests/org.eclipse.jpt.core.tests/src/org/eclipse/jpt/core/tests/internal/context/orm/PersistenceUnitDefaultsTests.java b/jpa/tests/org.eclipse.jpt.core.tests/src/org/eclipse/jpt/core/tests/internal/context/orm/PersistenceUnitDefaultsTests.java
deleted file mode 100644
index 9a3d6adee6..0000000000
--- a/jpa/tests/org.eclipse.jpt.core.tests/src/org/eclipse/jpt/core/tests/internal/context/orm/PersistenceUnitDefaultsTests.java
+++ /dev/null
@@ -1,369 +0,0 @@
-/*******************************************************************************
- * Copyright (c) 2007, 2009 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.
- *
- * Contributors:
- * Oracle - initial API and implementation
- ******************************************************************************/
-package org.eclipse.jpt.core.tests.internal.context.orm;
-
-import org.eclipse.jpt.core.JptCorePlugin;
-import org.eclipse.jpt.core.context.AccessType;
-import org.eclipse.jpt.core.context.orm.OrmPersistenceUnitDefaults;
-import org.eclipse.jpt.core.resource.orm.OrmFactory;
-import org.eclipse.jpt.core.resource.orm.XmlPersistenceUnitMetadata;
-import org.eclipse.jpt.core.resource.persistence.PersistenceFactory;
-import org.eclipse.jpt.core.resource.persistence.XmlMappingFileRef;
-import org.eclipse.jpt.core.tests.internal.context.ContextModelTestCase;
-
-@SuppressWarnings("nls")
-public class PersistenceUnitDefaultsTests extends ContextModelTestCase
-{
- public PersistenceUnitDefaultsTests(String name) {
- super(name);
- }
-
-
- @Override
- protected void setUp() throws Exception {
- super.setUp();
- XmlMappingFileRef mappingFileRef = PersistenceFactory.eINSTANCE.createXmlMappingFileRef();
- mappingFileRef.setFileName(JptCorePlugin.DEFAULT_ORM_XML_FILE_PATH);
- getXmlPersistenceUnit().getMappingFiles().add(mappingFileRef);
- getPersistenceXmlResource().save(null);
- }
-
- protected OrmPersistenceUnitDefaults getPersistenceUnitDefaults() {
- return getEntityMappings().getPersistenceUnitMetadata().getPersistenceUnitDefaults();
- }
-
- public void testIsAllFeaturesUnset() throws Exception {
- OrmPersistenceUnitDefaults persistenceUnitDefaults = getPersistenceUnitDefaults();
- assertNull(persistenceUnitDefaults.getAccess());
- assertNull(getXmlEntityMappings().getPersistenceUnitMetadata());
-
- XmlPersistenceUnitMetadata persistenceUnitMetadata = OrmFactory.eINSTANCE.createXmlPersistenceUnitMetadata();
- getXmlEntityMappings().setPersistenceUnitMetadata(persistenceUnitMetadata);
- assertTrue(persistenceUnitMetadata.isUnset());
-
- org.eclipse.jpt.core.resource.orm.XmlPersistenceUnitDefaults persistenceUnitDefaultsResource = OrmFactory.eINSTANCE.createXmlPersistenceUnitDefaults();
- persistenceUnitMetadata.setPersistenceUnitDefaults(persistenceUnitDefaultsResource);
- assertTrue(persistenceUnitDefaultsResource.isUnset());
-
- persistenceUnitDefaultsResource.setCascadePersist(true);
- assertFalse(persistenceUnitDefaultsResource.isUnset());
-
- persistenceUnitDefaultsResource.setCascadePersist(false);
- assertTrue(persistenceUnitDefaultsResource.isUnset());
-
- persistenceUnitDefaultsResource.setSchema("asdf");
- assertFalse(persistenceUnitDefaultsResource.isUnset());
-
- persistenceUnitDefaultsResource.setSchema(null);
- assertTrue(persistenceUnitDefaultsResource.isUnset());
-
- persistenceUnitDefaultsResource.setCatalog("asdf");
- assertFalse(persistenceUnitDefaultsResource.isUnset());
-
- persistenceUnitDefaultsResource.setCatalog(null);
- assertTrue(persistenceUnitDefaultsResource.isUnset());
-
-
- persistenceUnitDefaultsResource.setAccess(org.eclipse.jpt.core.resource.orm.AccessType.PROPERTY);
- assertFalse(persistenceUnitDefaultsResource.isUnset());
-
- persistenceUnitDefaultsResource.setAccess(org.eclipse.jpt.core.resource.orm.AccessType.FIELD);
- assertFalse(persistenceUnitDefaultsResource.isUnset());
-
- persistenceUnitDefaultsResource.setAccess(null);
- assertTrue(persistenceUnitDefaultsResource.isUnset());
- }
-
- public void testUpdateSchema() throws Exception {
- OrmPersistenceUnitDefaults persistenceUnitDefaults = getPersistenceUnitDefaults();
- assertNull(persistenceUnitDefaults.getSchema());
- assertNull(getXmlEntityMappings().getPersistenceUnitMetadata());
-
- //set schema in the resource model, verify context model updated
- getXmlEntityMappings().setPersistenceUnitMetadata(OrmFactory.eINSTANCE.createXmlPersistenceUnitMetadata());
- getXmlEntityMappings().getPersistenceUnitMetadata().setPersistenceUnitDefaults(OrmFactory.eINSTANCE.createXmlPersistenceUnitDefaults());
- getXmlEntityMappings().getPersistenceUnitMetadata().getPersistenceUnitDefaults().setSchema("MY_SCHEMA");
- assertEquals("MY_SCHEMA", persistenceUnitDefaults.getSchema());
- assertEquals("MY_SCHEMA", getXmlEntityMappings().getPersistenceUnitMetadata().getPersistenceUnitDefaults().getSchema());
-
- //set schema to null in the resource model
- getXmlEntityMappings().getPersistenceUnitMetadata().getPersistenceUnitDefaults().setSchema(null);
- assertNull(persistenceUnitDefaults.getSchema());
- assertNull(getXmlEntityMappings().getPersistenceUnitMetadata().getPersistenceUnitDefaults().getSchema());
- }
-
- public void testModifySchema() throws Exception {
- OrmPersistenceUnitDefaults persistenceUnitDefaults = getPersistenceUnitDefaults();
- assertNull(persistenceUnitDefaults.getSchema());
- assertNull(getXmlEntityMappings().getPersistenceUnitMetadata());
-
- //set schema in the context model, verify resource model modified
- persistenceUnitDefaults.setSpecifiedSchema("MY_SCHEMA");
- assertEquals("MY_SCHEMA", persistenceUnitDefaults.getSchema());
- assertEquals("MY_SCHEMA", getXmlEntityMappings().getPersistenceUnitMetadata().getPersistenceUnitDefaults().getSchema());
-
- //set schema to null in the context model
- persistenceUnitDefaults.setSpecifiedSchema(null);
- assertNull(persistenceUnitDefaults.getSchema());
- assertNull(getXmlEntityMappings().getPersistenceUnitMetadata());
- }
-
- public void testModifySchema2() throws Exception {
- OrmPersistenceUnitDefaults persistenceUnitDefaults = getPersistenceUnitDefaults();
- assertNull(persistenceUnitDefaults.getSchema());
- assertNull(getXmlEntityMappings().getPersistenceUnitMetadata());
-
- //set schema in the context model, verify resource model modified
- persistenceUnitDefaults.setSpecifiedSchema("MY_SCHEMA");
- assertEquals("MY_SCHEMA", persistenceUnitDefaults.getSchema());
- assertEquals("MY_SCHEMA", getXmlEntityMappings().getPersistenceUnitMetadata().getPersistenceUnitDefaults().getSchema());
-
- //set another element on the persistence-unit-defaults element so it doesn't get removed
- getXmlEntityMappings().getPersistenceUnitMetadata().getPersistenceUnitDefaults().setCatalog("MY_CATALOG");
- //set schema to null in the context model
- persistenceUnitDefaults.setSpecifiedSchema(null);
- assertNull(persistenceUnitDefaults.getSchema());
- assertNull(getXmlEntityMappings().getPersistenceUnitMetadata().getPersistenceUnitDefaults().getSchema());
- }
-
- public void testModifySchema3() throws Exception {
- OrmPersistenceUnitDefaults persistenceUnitDefaults = getPersistenceUnitDefaults();
- assertNull(persistenceUnitDefaults.getSchema());
- assertNull(getXmlEntityMappings().getPersistenceUnitMetadata());
- //set another element on the persistence-unit-metadata element so only persistence-unit-defaults element gets removed
- getXmlEntityMappings().setPersistenceUnitMetadata(OrmFactory.eINSTANCE.createXmlPersistenceUnitMetadata());
- getXmlEntityMappings().getPersistenceUnitMetadata().setXmlMappingMetadataComplete(true);
-
- //set schema in the context model, verify resource model modified
- persistenceUnitDefaults.setSpecifiedSchema("MY_SCHEMA");
- assertEquals("MY_SCHEMA", persistenceUnitDefaults.getSchema());
- assertEquals("MY_SCHEMA", getXmlEntityMappings().getPersistenceUnitMetadata().getPersistenceUnitDefaults().getSchema());
-
- //set schema to null in the context model
- persistenceUnitDefaults.setSpecifiedSchema(null);
- assertNull(persistenceUnitDefaults.getSchema());
- assertNull(getXmlEntityMappings().getPersistenceUnitMetadata().getPersistenceUnitDefaults());
- }
-
- public void testUpdateCatalog() throws Exception {
- OrmPersistenceUnitDefaults persistenceUnitDefaults = getPersistenceUnitDefaults();
- assertNull(persistenceUnitDefaults.getCatalog());
- assertNull(getXmlEntityMappings().getPersistenceUnitMetadata());
-
- //set catalog in the resource model, verify context model updated
- getXmlEntityMappings().setPersistenceUnitMetadata(OrmFactory.eINSTANCE.createXmlPersistenceUnitMetadata());
- getXmlEntityMappings().getPersistenceUnitMetadata().setPersistenceUnitDefaults(OrmFactory.eINSTANCE.createXmlPersistenceUnitDefaults());
- getXmlEntityMappings().getPersistenceUnitMetadata().getPersistenceUnitDefaults().setCatalog("MY_CATALOG");
- assertEquals("MY_CATALOG", persistenceUnitDefaults.getCatalog());
- assertEquals("MY_CATALOG", getXmlEntityMappings().getPersistenceUnitMetadata().getPersistenceUnitDefaults().getCatalog());
-
- //set catalog to null in the resource model
- getXmlEntityMappings().getPersistenceUnitMetadata().getPersistenceUnitDefaults().setCatalog(null);
- assertNull(persistenceUnitDefaults.getCatalog());
- assertNull(getXmlEntityMappings().getPersistenceUnitMetadata().getPersistenceUnitDefaults().getCatalog());
- }
-
- public void testModifyCatalog() throws Exception {
- OrmPersistenceUnitDefaults persistenceUnitDefaults = getPersistenceUnitDefaults();
- assertNull(persistenceUnitDefaults.getCatalog());
- assertNull(getXmlEntityMappings().getPersistenceUnitMetadata());
-
- //set catalog in the context model, verify resource model modified
- persistenceUnitDefaults.setSpecifiedCatalog("MY_CATALOG");
- assertEquals("MY_CATALOG", persistenceUnitDefaults.getCatalog());
- assertEquals("MY_CATALOG", getXmlEntityMappings().getPersistenceUnitMetadata().getPersistenceUnitDefaults().getCatalog());
-
- //set catalog to null in the context model
- persistenceUnitDefaults.setSpecifiedCatalog(null);
- assertNull(persistenceUnitDefaults.getCatalog());
- assertNull(getXmlEntityMappings().getPersistenceUnitMetadata());
- }
-
- public void testModifyCatalog2() throws Exception {
- OrmPersistenceUnitDefaults persistenceUnitDefaults = getPersistenceUnitDefaults();
- assertNull(persistenceUnitDefaults.getCatalog());
- assertNull(getXmlEntityMappings().getPersistenceUnitMetadata());
-
- //set catalog in the context model, verify resource model modified
- persistenceUnitDefaults.setSpecifiedCatalog("MY_CATALOG");
- assertEquals("MY_CATALOG", persistenceUnitDefaults.getCatalog());
- assertEquals("MY_CATALOG", getXmlEntityMappings().getPersistenceUnitMetadata().getPersistenceUnitDefaults().getCatalog());
-
- //set another element on the persistence-unit-defaults element so it doesn't get removed
- getXmlEntityMappings().getPersistenceUnitMetadata().getPersistenceUnitDefaults().setSchema("MY_SCHEMA");
- //set catalog to null in the context model
- persistenceUnitDefaults.setSpecifiedCatalog(null);
- assertNull(persistenceUnitDefaults.getCatalog());
- assertNull(getXmlEntityMappings().getPersistenceUnitMetadata().getPersistenceUnitDefaults().getCatalog());
- }
-
- public void testModifyCatalog3() throws Exception {
- OrmPersistenceUnitDefaults persistenceUnitDefaults = getPersistenceUnitDefaults();
- assertNull(persistenceUnitDefaults.getCatalog());
- assertNull(getXmlEntityMappings().getPersistenceUnitMetadata());
- //set another element on the persistence-unit-metadata element so only persistence-unit-defaults element gets removed
- getXmlEntityMappings().setPersistenceUnitMetadata(OrmFactory.eINSTANCE.createXmlPersistenceUnitMetadata());
- getXmlEntityMappings().getPersistenceUnitMetadata().setXmlMappingMetadataComplete(true);
-
- //set catalog in the context model, verify resource model modified
- persistenceUnitDefaults.setSpecifiedCatalog("MY_CATALOG");
- assertEquals("MY_CATALOG", persistenceUnitDefaults.getCatalog());
- assertEquals("MY_CATALOG", getXmlEntityMappings().getPersistenceUnitMetadata().getPersistenceUnitDefaults().getCatalog());
-
- //set catalog to null in the context model
- persistenceUnitDefaults.setSpecifiedCatalog(null);
- assertNull(persistenceUnitDefaults.getCatalog());
- assertNull(getXmlEntityMappings().getPersistenceUnitMetadata().getPersistenceUnitDefaults());
- }
-
- public void testUpdateCascadePersist() throws Exception {
- OrmPersistenceUnitDefaults persistenceUnitDefaults = getPersistenceUnitDefaults();
- assertFalse(persistenceUnitDefaults.isCascadePersist());
- assertNull(getXmlEntityMappings().getPersistenceUnitMetadata());
-
- //set cascadePersist in the resource model, verify context model updated
- getXmlEntityMappings().setPersistenceUnitMetadata(OrmFactory.eINSTANCE.createXmlPersistenceUnitMetadata());
- getXmlEntityMappings().getPersistenceUnitMetadata().setPersistenceUnitDefaults(OrmFactory.eINSTANCE.createXmlPersistenceUnitDefaults());
- getXmlEntityMappings().getPersistenceUnitMetadata().getPersistenceUnitDefaults().setCascadePersist(true);
- assertTrue(persistenceUnitDefaults.isCascadePersist());
- assertTrue(getXmlEntityMappings().getPersistenceUnitMetadata().getPersistenceUnitDefaults().isCascadePersist());
-
- //set cascadePersist to null in the resource model, persistence-unit-defaults tag not removed
- getXmlEntityMappings().getPersistenceUnitMetadata().getPersistenceUnitDefaults().setCascadePersist(false);
- assertFalse(persistenceUnitDefaults.isCascadePersist());
- assertFalse(getXmlEntityMappings().getPersistenceUnitMetadata().getPersistenceUnitDefaults().isCascadePersist());
- }
-
- public void testModifyCascadePersist() throws Exception {
- OrmPersistenceUnitDefaults persistenceUnitDefaults = getPersistenceUnitDefaults();
- assertFalse(persistenceUnitDefaults.isCascadePersist());
- assertNull(getXmlEntityMappings().getPersistenceUnitMetadata());
-
- //set cascadePersist in the context model, verify resource model modified
- persistenceUnitDefaults.setCascadePersist(true);
- assertTrue(persistenceUnitDefaults.isCascadePersist());
- assertTrue(getXmlEntityMappings().getPersistenceUnitMetadata().getPersistenceUnitDefaults().isCascadePersist());
-
- //set cascadePersist to null in the context model
- persistenceUnitDefaults.setCascadePersist(false);
- assertFalse(persistenceUnitDefaults.isCascadePersist());
- assertNull(getXmlEntityMappings().getPersistenceUnitMetadata());
- }
-
- public void testModifyCascadePersist2() throws Exception {
- OrmPersistenceUnitDefaults persistenceUnitDefaults = getPersistenceUnitDefaults();
- assertFalse(persistenceUnitDefaults.isCascadePersist());
- assertNull(getXmlEntityMappings().getPersistenceUnitMetadata());
-
- //set cascadePersist in the context model, verify resource model modified
- persistenceUnitDefaults.setCascadePersist(true);
- assertTrue(persistenceUnitDefaults.isCascadePersist());
- assertTrue(getXmlEntityMappings().getPersistenceUnitMetadata().getPersistenceUnitDefaults().isCascadePersist());
-
- //set another element on the persistence-unit-defaults element so it doesn't get removed
- getXmlEntityMappings().getPersistenceUnitMetadata().getPersistenceUnitDefaults().setCatalog("MY_CATALOG");
- //set cascadePersist to null in the context model
- persistenceUnitDefaults.setCascadePersist(false);
- assertFalse(persistenceUnitDefaults.isCascadePersist());
- assertFalse(getXmlEntityMappings().getPersistenceUnitMetadata().getPersistenceUnitDefaults().isCascadePersist());
- }
-
- public void testModifyCascadePersist3() throws Exception {
- OrmPersistenceUnitDefaults persistenceUnitDefaults = getPersistenceUnitDefaults();
- assertFalse(persistenceUnitDefaults.isCascadePersist());
- assertNull(getXmlEntityMappings().getPersistenceUnitMetadata());
- //set another element on the persistence-unit-metadata element so only persistence-unit-defaults element gets removed
- getXmlEntityMappings().setPersistenceUnitMetadata(OrmFactory.eINSTANCE.createXmlPersistenceUnitMetadata());
- getXmlEntityMappings().getPersistenceUnitMetadata().setXmlMappingMetadataComplete(true);
-
- //set cascadePersist in the context model, verify resource model modified
- persistenceUnitDefaults.setCascadePersist(true);
- assertTrue(persistenceUnitDefaults.isCascadePersist());
- assertTrue(getXmlEntityMappings().getPersistenceUnitMetadata().getPersistenceUnitDefaults().isCascadePersist());
-
- //set cascadePersist to null in the context model
- persistenceUnitDefaults.setCascadePersist(false);
- assertFalse(persistenceUnitDefaults.isCascadePersist());
- assertNull(getXmlEntityMappings().getPersistenceUnitMetadata().getPersistenceUnitDefaults());
- }
-
-
- public void testUpdateAccess() throws Exception {
- OrmPersistenceUnitDefaults persistenceUnitDefaults = getPersistenceUnitDefaults();
- assertNull(persistenceUnitDefaults.getAccess());
- assertNull(getXmlEntityMappings().getPersistenceUnitMetadata());
-
- //set access in the resource model, verify context model updated
- getXmlEntityMappings().setPersistenceUnitMetadata(OrmFactory.eINSTANCE.createXmlPersistenceUnitMetadata());
- getXmlEntityMappings().getPersistenceUnitMetadata().setPersistenceUnitDefaults(OrmFactory.eINSTANCE.createXmlPersistenceUnitDefaults());
- getXmlEntityMappings().getPersistenceUnitMetadata().getPersistenceUnitDefaults().setAccess(org.eclipse.jpt.core.resource.orm.AccessType.FIELD);
- assertEquals(AccessType.FIELD, persistenceUnitDefaults.getAccess());
- assertEquals(org.eclipse.jpt.core.resource.orm.AccessType.FIELD, getXmlEntityMappings().getPersistenceUnitMetadata().getPersistenceUnitDefaults().getAccess());
-
- //set access to null in the resource model
- getXmlEntityMappings().getPersistenceUnitMetadata().getPersistenceUnitDefaults().setAccess(null);
- assertNull(persistenceUnitDefaults.getAccess());
- assertNull(getXmlEntityMappings().getPersistenceUnitMetadata().getPersistenceUnitDefaults().getAccess());
- }
-
- public void testModifyAccess() throws Exception {
- OrmPersistenceUnitDefaults persistenceUnitDefaults = getPersistenceUnitDefaults();
- assertNull(persistenceUnitDefaults.getAccess());
- assertNull(getXmlEntityMappings().getPersistenceUnitMetadata());
-
- //set access in the context model, verify resource model modified
- persistenceUnitDefaults.setAccess(AccessType.PROPERTY);
- assertEquals(AccessType.PROPERTY, persistenceUnitDefaults.getAccess());
- assertEquals(org.eclipse.jpt.core.resource.orm.AccessType.PROPERTY, getXmlEntityMappings().getPersistenceUnitMetadata().getPersistenceUnitDefaults().getAccess());
-
- //set access to null in the context model
- persistenceUnitDefaults.setAccess(null);
- assertNull(persistenceUnitDefaults.getAccess());
- assertNull(getXmlEntityMappings().getPersistenceUnitMetadata());
- }
-
- public void testModifyAccess2() throws Exception {
- OrmPersistenceUnitDefaults persistenceUnitDefaults = getPersistenceUnitDefaults();
- assertNull(persistenceUnitDefaults.getAccess());
- assertNull(getXmlEntityMappings().getPersistenceUnitMetadata());
-
- //set access in the context model, verify resource model modified
- persistenceUnitDefaults.setAccess(AccessType.FIELD);
- assertEquals(AccessType.FIELD, persistenceUnitDefaults.getAccess());
- assertEquals(org.eclipse.jpt.core.resource.orm.AccessType.FIELD, getXmlEntityMappings().getPersistenceUnitMetadata().getPersistenceUnitDefaults().getAccess());
-
- //set another element on the persistence-unit-defaults element so it doesn't get removed
- getXmlEntityMappings().getPersistenceUnitMetadata().getPersistenceUnitDefaults().setCascadePersist(true);
- //set access to null in the context model
- persistenceUnitDefaults.setAccess(null);
- assertNull(persistenceUnitDefaults.getAccess());
- assertNull(getXmlEntityMappings().getPersistenceUnitMetadata().getPersistenceUnitDefaults().getAccess());
- }
-
- public void testModifyAccess3() throws Exception {
- OrmPersistenceUnitDefaults persistenceUnitDefaults = getPersistenceUnitDefaults();
- assertNull(persistenceUnitDefaults.getAccess());
- assertNull(getXmlEntityMappings().getPersistenceUnitMetadata());
- //set another element on the persistence-unit-metadata element so only persistence-unit-defaults element gets removed
- getXmlEntityMappings().setPersistenceUnitMetadata(OrmFactory.eINSTANCE.createXmlPersistenceUnitMetadata());
- getXmlEntityMappings().getPersistenceUnitMetadata().setXmlMappingMetadataComplete(true);
-
- //set access in the context model, verify resource model modified
- persistenceUnitDefaults.setAccess(AccessType.FIELD);
- assertEquals(AccessType.FIELD, persistenceUnitDefaults.getAccess());
- assertEquals(org.eclipse.jpt.core.resource.orm.AccessType.FIELD, getXmlEntityMappings().getPersistenceUnitMetadata().getPersistenceUnitDefaults().getAccess());
-
- //set access to null in the context model
- persistenceUnitDefaults.setAccess(null);
- assertNull(persistenceUnitDefaults.getAccess());
- assertNull(getXmlEntityMappings().getPersistenceUnitMetadata().getPersistenceUnitDefaults());
- }
-
-} \ No newline at end of file
diff --git a/jpa/tests/org.eclipse.jpt.core.tests/src/org/eclipse/jpt/core/tests/internal/context/orm/PersistenceUnitMetadataTests.java b/jpa/tests/org.eclipse.jpt.core.tests/src/org/eclipse/jpt/core/tests/internal/context/orm/PersistenceUnitMetadataTests.java
deleted file mode 100644
index 1d9850e322..0000000000
--- a/jpa/tests/org.eclipse.jpt.core.tests/src/org/eclipse/jpt/core/tests/internal/context/orm/PersistenceUnitMetadataTests.java
+++ /dev/null
@@ -1,104 +0,0 @@
-/*******************************************************************************
- * Copyright (c) 2007, 2009 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.
- *
- * Contributors:
- * Oracle - initial API and implementation
- ******************************************************************************/
-package org.eclipse.jpt.core.tests.internal.context.orm;
-
-import org.eclipse.jpt.core.JptCorePlugin;
-import org.eclipse.jpt.core.context.orm.PersistenceUnitMetadata;
-import org.eclipse.jpt.core.resource.orm.OrmFactory;
-import org.eclipse.jpt.core.resource.persistence.PersistenceFactory;
-import org.eclipse.jpt.core.resource.persistence.XmlMappingFileRef;
-import org.eclipse.jpt.core.tests.internal.context.ContextModelTestCase;
-
-public class PersistenceUnitMetadataTests extends ContextModelTestCase
-{
- public PersistenceUnitMetadataTests(String name) {
- super(name);
- }
-
-
- @Override
- protected void setUp() throws Exception {
- super.setUp();
- XmlMappingFileRef mappingFileRef = PersistenceFactory.eINSTANCE.createXmlMappingFileRef();
- mappingFileRef.setFileName(JptCorePlugin.DEFAULT_ORM_XML_FILE_PATH);
- getXmlPersistenceUnit().getMappingFiles().add(mappingFileRef);
- getPersistenceXmlResource().save(null);
- }
-
- protected PersistenceUnitMetadata persistenceUnitMetadata() {
- return getEntityMappings().getPersistenceUnitMetadata();
- }
-
- public void testIsAllFeaturesUnset() throws Exception {
- org.eclipse.jpt.core.resource.orm.XmlPersistenceUnitMetadata persistenceUnitMetadata = OrmFactory.eINSTANCE.createXmlPersistenceUnitMetadata();
- getXmlEntityMappings().setPersistenceUnitMetadata(persistenceUnitMetadata);
- assertTrue(persistenceUnitMetadata.isUnset());
-
- persistenceUnitMetadata.setXmlMappingMetadataComplete(true);
- assertFalse(persistenceUnitMetadata.isUnset());
-
- persistenceUnitMetadata.setXmlMappingMetadataComplete(false);
- assertTrue(persistenceUnitMetadata.isUnset());
-
- persistenceUnitMetadata.setPersistenceUnitDefaults(OrmFactory.eINSTANCE.createXmlPersistenceUnitDefaults());
- assertFalse(persistenceUnitMetadata.isUnset());
- }
-
- public void testUpdateXmlMappingMetadataComplete() throws Exception {
- PersistenceUnitMetadata persistenceUnitMetadata = getEntityMappings().getPersistenceUnitMetadata();
- assertFalse(persistenceUnitMetadata.isXmlMappingMetadataComplete());
- assertNull(getXmlEntityMappings().getPersistenceUnitMetadata());
-
- //set xmlMappingMetadataComplete in the resource model, verify context model updated
- getXmlEntityMappings().setPersistenceUnitMetadata(OrmFactory.eINSTANCE.createXmlPersistenceUnitMetadata());
- getXmlEntityMappings().getPersistenceUnitMetadata().setXmlMappingMetadataComplete(true);
- assertTrue(persistenceUnitMetadata.isXmlMappingMetadataComplete());
- assertTrue(getXmlEntityMappings().getPersistenceUnitMetadata().isXmlMappingMetadataComplete());
-
- //set xmlMappingMetadataComplete to null in the resource model
- getXmlEntityMappings().getPersistenceUnitMetadata().setXmlMappingMetadataComplete(false);
- assertFalse(persistenceUnitMetadata.isXmlMappingMetadataComplete());
- assertFalse(getXmlEntityMappings().getPersistenceUnitMetadata().isXmlMappingMetadataComplete());
- }
-
- public void testModifyXmlMappingMetadataComplete() throws Exception {
- PersistenceUnitMetadata persistenceUnitMetadata = getEntityMappings().getPersistenceUnitMetadata();
- assertFalse(persistenceUnitMetadata.isXmlMappingMetadataComplete());
- assertNull(getXmlEntityMappings().getPersistenceUnitMetadata());
-
- //set xmlMappingMetadataComplete in the context model, verify resource model modified
- persistenceUnitMetadata.setXmlMappingMetadataComplete(true);
- assertTrue(persistenceUnitMetadata.isXmlMappingMetadataComplete());
- assertTrue(getXmlEntityMappings().getPersistenceUnitMetadata().isXmlMappingMetadataComplete());
-
- //set xmlMappingMetadataComplete to null in the context model
- persistenceUnitMetadata.setXmlMappingMetadataComplete(false);
- assertFalse(persistenceUnitMetadata.isXmlMappingMetadataComplete());
- assertNull(getXmlEntityMappings().getPersistenceUnitMetadata());
- }
-
- public void testModifyXmlMappingMetadataComplete2() throws Exception {
- PersistenceUnitMetadata persistenceUnitMetadata = getEntityMappings().getPersistenceUnitMetadata();
- assertFalse(persistenceUnitMetadata.isXmlMappingMetadataComplete());
- assertNull(getXmlEntityMappings().getPersistenceUnitMetadata());
-
- //set xmlMappingMetadataComplete in the context model, verify resource model modified
- persistenceUnitMetadata.setXmlMappingMetadataComplete(true);
- assertTrue(persistenceUnitMetadata.isXmlMappingMetadataComplete());
- assertTrue(getXmlEntityMappings().getPersistenceUnitMetadata().isXmlMappingMetadataComplete());
-
- //set xmlMappingMetadataComplete to null in the context model
- //set another element on the persistence-unit-metadata element so it doesn't get removed
- getXmlEntityMappings().getPersistenceUnitMetadata().setPersistenceUnitDefaults(OrmFactory.eINSTANCE.createXmlPersistenceUnitDefaults());
- persistenceUnitMetadata.setXmlMappingMetadataComplete(false);
- assertFalse(persistenceUnitMetadata.isXmlMappingMetadataComplete());
- assertFalse(getXmlEntityMappings().getPersistenceUnitMetadata().isXmlMappingMetadataComplete());
- }
-} \ No newline at end of file
diff --git a/jpa/tests/org.eclipse.jpt.core.tests/src/org/eclipse/jpt/core/tests/internal/context/persistence/ClassRefTests.java b/jpa/tests/org.eclipse.jpt.core.tests/src/org/eclipse/jpt/core/tests/internal/context/persistence/ClassRefTests.java
deleted file mode 100644
index 3773551b2b..0000000000
--- a/jpa/tests/org.eclipse.jpt.core.tests/src/org/eclipse/jpt/core/tests/internal/context/persistence/ClassRefTests.java
+++ /dev/null
@@ -1,112 +0,0 @@
-/*******************************************************************************
- * Copyright (c) 2007, 2008 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
- *
- * Contributors:
- * Oracle - initial API and implementation
- *******************************************************************************/
-package org.eclipse.jpt.core.tests.internal.context.persistence;
-
-import org.eclipse.jpt.core.context.persistence.ClassRef;
-import org.eclipse.jpt.core.context.persistence.PersistenceUnit;
-import org.eclipse.jpt.core.resource.persistence.PersistenceFactory;
-import org.eclipse.jpt.core.resource.persistence.XmlJavaClassRef;
-import org.eclipse.jpt.core.resource.persistence.XmlPersistenceUnit;
-import org.eclipse.jpt.core.tests.internal.context.ContextModelTestCase;
-
-public class ClassRefTests extends ContextModelTestCase
-{
- public ClassRefTests(String name) {
- super(name);
- }
-
- public void testUpdateClassName() {
- XmlPersistenceUnit xmlPersistenceUnit = getXmlPersistenceUnit();
- PersistenceUnit persistenceUnit = getPersistenceUnit();
-
- // add class ref
- XmlJavaClassRef xmlClassRef = PersistenceFactory.eINSTANCE.createXmlJavaClassRef();
- xmlClassRef.setJavaClass("com.foo.Bar");
- xmlPersistenceUnit.getClasses().add(xmlClassRef);
- ClassRef classRef = persistenceUnit.specifiedClassRefs().next();
-
- // test that class names are initially equal
- assertEquals(classRef.getClassName(), xmlClassRef.getJavaClass());
-
- // set xml class name to different name, test equality
- xmlClassRef.setJavaClass("com.bar.Foo");
-
- classRef = persistenceUnit.specifiedClassRefs().next();
- assertEquals(classRef.getClassName(), xmlClassRef.getJavaClass());
-
- // set class name to empty string, test equality
- xmlClassRef.setJavaClass("");
-
- classRef = persistenceUnit.specifiedClassRefs().next();
- assertEquals(classRef.getClassName(), xmlClassRef.getJavaClass());
-
- // set name back to non empty string, test equality
- xmlClassRef.setJavaClass("com.foo.Bar");
-
- classRef = persistenceUnit.specifiedClassRefs().next();
- assertEquals(classRef.getClassName(), xmlClassRef.getJavaClass());
- }
-
- public void testModifyClassName() {
- XmlPersistenceUnit xmlPersistenceUnit = getXmlPersistenceUnit();
- PersistenceUnit persistenceUnit = getPersistenceUnit();
-
- // add class ref
- XmlJavaClassRef xmlClassRef = PersistenceFactory.eINSTANCE.createXmlJavaClassRef();
- xmlClassRef.setJavaClass("com.foo.Bar");
- xmlPersistenceUnit.getClasses().add(xmlClassRef);
- ClassRef classRef = persistenceUnit.specifiedClassRefs().next();
-
- // test that class names are initially equal
- assertEquals(classRef.getClassName(), xmlClassRef.getJavaClass());
-
- // set context class name to different name, test equality
- classRef.setClassName("com.bar.Foo");
-
- assertEquals(classRef.getClassName(), xmlClassRef.getJavaClass());
-
- // set class name to empty string, test equality
- classRef.setClassName("");
-
- assertEquals(classRef.getClassName(), xmlClassRef.getJavaClass());
-
- // set class name to null, test equality
- classRef.setClassName(null);
-
- assertEquals(classRef.getClassName(), xmlClassRef.getJavaClass());
-
- // set name back to non-null, test equality
- classRef.setClassName("com.foo.Bar");
-
- assertEquals(classRef.getClassName(), xmlClassRef.getJavaClass());
- }
-
-
- public void testGetPersistentType() throws Exception {
- createTestType();
-
- XmlPersistenceUnit xmlPersistenceUnit = getXmlPersistenceUnit();
-
- XmlJavaClassRef xmlClassRef = PersistenceFactory.eINSTANCE.createXmlJavaClassRef();
- xmlClassRef.setJavaClass(FULLY_QUALIFIED_TYPE_NAME);
- xmlPersistenceUnit.getClasses().add(xmlClassRef);
-
- ClassRef classRef = getSpecifiedClassRef();
-
- assertEquals(FULLY_QUALIFIED_TYPE_NAME, classRef.getJavaPersistentType().getName());
-
- //test setting to a class that does not exist in the project
- xmlClassRef.setJavaClass("com.foo.Bar");
-
- classRef = getSpecifiedClassRef();
- assertNull(classRef.getJavaPersistentType());
- }
-}
diff --git a/jpa/tests/org.eclipse.jpt.core.tests/src/org/eclipse/jpt/core/tests/internal/context/persistence/JptCorePersistenceContextModelTests.java b/jpa/tests/org.eclipse.jpt.core.tests/src/org/eclipse/jpt/core/tests/internal/context/persistence/JptCorePersistenceContextModelTests.java
deleted file mode 100644
index daeeb47e76..0000000000
--- a/jpa/tests/org.eclipse.jpt.core.tests/src/org/eclipse/jpt/core/tests/internal/context/persistence/JptCorePersistenceContextModelTests.java
+++ /dev/null
@@ -1,33 +0,0 @@
-/*******************************************************************************
- * Copyright (c) 2007 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
- *
- * Contributors:
- * Oracle - initial API and implementation
- *******************************************************************************/
-package org.eclipse.jpt.core.tests.internal.context.persistence;
-
-import junit.framework.Test;
-import junit.framework.TestCase;
-import junit.framework.TestSuite;
-
-public class JptCorePersistenceContextModelTests extends TestCase
-{
- public static Test suite() {
- TestSuite suite = new TestSuite(JptCorePersistenceContextModelTests.class.getName());
- suite.addTestSuite(RootContextNodeTests.class);
- suite.addTestSuite(PersistenceXmlTests.class);
- suite.addTestSuite(PersistenceTests.class);
- suite.addTestSuite(PersistenceUnitTests.class);
- suite.addTestSuite(MappingFileRefTests.class);
- suite.addTestSuite(ClassRefTests.class);
- return suite;
- }
-
- private JptCorePersistenceContextModelTests() {
- throw new UnsupportedOperationException();
- }
-}
diff --git a/jpa/tests/org.eclipse.jpt.core.tests/src/org/eclipse/jpt/core/tests/internal/context/persistence/MappingFileRefTests.java b/jpa/tests/org.eclipse.jpt.core.tests/src/org/eclipse/jpt/core/tests/internal/context/persistence/MappingFileRefTests.java
deleted file mode 100644
index caadd6cb26..0000000000
--- a/jpa/tests/org.eclipse.jpt.core.tests/src/org/eclipse/jpt/core/tests/internal/context/persistence/MappingFileRefTests.java
+++ /dev/null
@@ -1,97 +0,0 @@
-/*******************************************************************************
- * Copyright (c) 2007 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
- *
- * Contributors:
- * Oracle - initial API and implementation
- *******************************************************************************/
-package org.eclipse.jpt.core.tests.internal.context.persistence;
-
-import org.eclipse.jpt.core.context.persistence.MappingFileRef;
-import org.eclipse.jpt.core.context.persistence.PersistenceUnit;
-import org.eclipse.jpt.core.resource.persistence.PersistenceFactory;
-import org.eclipse.jpt.core.resource.persistence.XmlMappingFileRef;
-import org.eclipse.jpt.core.resource.persistence.XmlPersistenceUnit;
-import org.eclipse.jpt.core.tests.internal.context.ContextModelTestCase;
-
-public class MappingFileRefTests extends ContextModelTestCase
-{
- public MappingFileRefTests(String name) {
- super(name);
- }
-
- protected MappingFileRef mappingFileRef() {
- return getPersistenceUnit().mappingFileRefs().next();
- }
-
- public void testUpdateFileName() {
- XmlPersistenceUnit xmlPersistenceUnit = getXmlPersistenceUnit();
- PersistenceUnit persistenceUnit = getPersistenceUnit();
-
- // add mapping file ref
- XmlMappingFileRef xmlFileRef = PersistenceFactory.eINSTANCE.createXmlMappingFileRef();
- xmlFileRef.setFileName("foo.xml");
- xmlPersistenceUnit.getMappingFiles().add(xmlFileRef);
- MappingFileRef fileRef = persistenceUnit.specifiedMappingFileRefs().next();
-
- // test that file names are initially equal
- assertEquals(fileRef.getFileName(), xmlFileRef.getFileName());
-
- // set xml to different file name, test equality
- xmlFileRef.setFileName("bar.xml");
-
- assertEquals(fileRef.getFileName(), xmlFileRef.getFileName());
-
- // set file name to empty string, test equality
- xmlFileRef.setFileName("");
-
- assertEquals(fileRef.getFileName(), xmlFileRef.getFileName());
-
- // set file name to null, test equality
- xmlFileRef.setFileName(null);
-
- assertEquals(fileRef.getFileName(), xmlFileRef.getFileName());
-
- // set file name back to non-null, test equality
- xmlFileRef.setFileName("baz.xml");
-
- assertEquals(fileRef.getFileName(), xmlFileRef.getFileName());
- }
-
- public void testModifyFileName() {
- XmlPersistenceUnit xmlPersistenceUnit = getXmlPersistenceUnit();
- PersistenceUnit persistenceUnit = getPersistenceUnit();
-
- // add mapping file ref
- XmlMappingFileRef xmlFileRef = PersistenceFactory.eINSTANCE.createXmlMappingFileRef();
- xmlFileRef.setFileName("foo.xml");
- xmlPersistenceUnit.getMappingFiles().add(xmlFileRef);
- MappingFileRef fileRef = persistenceUnit.specifiedMappingFileRefs().next();
-
- // test that file names are initially equal
- assertEquals(fileRef.getFileName(), xmlFileRef.getFileName());
-
- // set context to different file name, test equality
- fileRef.setFileName("bar.xml");
-
- assertEquals(fileRef.getFileName(), xmlFileRef.getFileName());
-
- // set file name to empty string, test equality
- fileRef.setFileName("");
-
- assertEquals(fileRef.getFileName(), xmlFileRef.getFileName());
-
- // set file name to null, test equality
- fileRef.setFileName(null);
-
- assertEquals(fileRef.getFileName(), xmlFileRef.getFileName());
-
- // set file name back to non-null, test equality
- fileRef.setFileName("baz.xml");
-
- assertEquals(fileRef.getFileName(), xmlFileRef.getFileName());
- }
-}
diff --git a/jpa/tests/org.eclipse.jpt.core.tests/src/org/eclipse/jpt/core/tests/internal/context/persistence/PersistenceTests.java b/jpa/tests/org.eclipse.jpt.core.tests/src/org/eclipse/jpt/core/tests/internal/context/persistence/PersistenceTests.java
deleted file mode 100644
index 5fb73d8693..0000000000
--- a/jpa/tests/org.eclipse.jpt.core.tests/src/org/eclipse/jpt/core/tests/internal/context/persistence/PersistenceTests.java
+++ /dev/null
@@ -1,134 +0,0 @@
-/*******************************************************************************
- * Copyright (c) 2007, 2009 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.
- *
- * Contributors:
- * Oracle - initial API and implementation
- ******************************************************************************/
-package org.eclipse.jpt.core.tests.internal.context.persistence;
-
-import org.eclipse.jpt.core.context.persistence.Persistence;
-import org.eclipse.jpt.core.resource.persistence.PersistenceFactory;
-import org.eclipse.jpt.core.resource.persistence.XmlPersistence;
-import org.eclipse.jpt.core.resource.persistence.XmlPersistenceUnit;
-import org.eclipse.jpt.core.tests.internal.context.ContextModelTestCase;
-
-@SuppressWarnings("nls")
-public class PersistenceTests extends ContextModelTestCase
-{
- public PersistenceTests(String name) {
- super(name);
- }
-
- protected Persistence persistence() {
- return getRootContextNode().getPersistenceXml().getPersistence();
- }
-
- public void testUpdateAddPersistenceUnit() throws Exception {
- XmlPersistence xmlPersistence = getXmlPersistence();
- Persistence persistence = getRootContextNode().getPersistenceXml().getPersistence();
-
- // clear xml persistence units, test that it's clear in context
- xmlPersistence.getPersistenceUnits().clear();
-
- assertEquals(0, persistence.persistenceUnitsSize());
-
- // add xml persistence unit, test that it's added to context
- XmlPersistenceUnit xmlPersistenceUnit = PersistenceFactory.eINSTANCE.createXmlPersistenceUnit();
- xmlPersistenceUnit.setName("test");
- xmlPersistence.getPersistenceUnits().add(xmlPersistenceUnit);
-
- assertEquals(1, persistence.persistenceUnitsSize());
-
- // add another, test that it *isn't* add to context
- xmlPersistenceUnit = PersistenceFactory.eINSTANCE.createXmlPersistenceUnit();
- xmlPersistenceUnit.setName("test2");
- xmlPersistence.getPersistenceUnits().add(xmlPersistenceUnit);
-
- assertEquals(1, persistence.persistenceUnitsSize());
- }
-
- public void testModifyAddPersistencUnit() {
- XmlPersistence xmlPersistence = getXmlPersistence();
- Persistence persistence = persistence();
-
- // clear xml persistence units, test that it's clear in context
- xmlPersistence.getPersistenceUnits().clear();
- assertEquals(0, persistence.persistenceUnitsSize());
-
- // add persistence unit, test that it's added to resource
- persistence.addPersistenceUnit();
-
- assertEquals(1, persistence.persistenceUnitsSize());
-
- // add another, test that we get an exception
- boolean exception = false;
- try {
- persistence.addPersistenceUnit();
- }
- catch (IllegalStateException e) {
- exception = true;
- }
-
- assertTrue(exception);
- }
-
- public void testUpdateRemovePersistenceUnit() throws Exception {
- XmlPersistence xmlPersistence = getXmlPersistence();
- Persistence persistence = getRootContextNode().getPersistenceXml().getPersistence();
-
- // add a persistence unit and test that there are two existing xml and
- // one context persistence unit
- XmlPersistenceUnit xmlPersistenceUnit = PersistenceFactory.eINSTANCE.createXmlPersistenceUnit();
- xmlPersistenceUnit.setName("test");
- xmlPersistence.getPersistenceUnits().add(xmlPersistenceUnit);
-
- assertEquals(2, xmlPersistence.getPersistenceUnits().size());
- assertEquals(1, persistence.persistenceUnitsSize());
-
- // remove persistence unit from xml, test that context remains unchanged
- xmlPersistenceUnit = xmlPersistence.getPersistenceUnits().get(0);
- xmlPersistence.getPersistenceUnits().remove(xmlPersistenceUnit);
-
- assertEquals(1, xmlPersistence.getPersistenceUnits().size());
- assertEquals(1, persistence.persistenceUnitsSize());
-
- // remove another one from xml, text that it's now removed from context
- xmlPersistenceUnit = xmlPersistence.getPersistenceUnits().get(0);
- xmlPersistence.getPersistenceUnits().remove(xmlPersistenceUnit);
-
- assertEquals(0, xmlPersistence.getPersistenceUnits().size());
- assertEquals(0, persistence.persistenceUnitsSize());
- }
-
- public void testModifyRemovePersistenceUnit() {
- XmlPersistence xmlPersistence = getXmlPersistence();
- Persistence persistence = persistence();
-
- // add a persistence unit and test that there are two existing xml and
- // one context persistence unit
- XmlPersistenceUnit xmlPersistenceUnit = PersistenceFactory.eINSTANCE.createXmlPersistenceUnit();
- xmlPersistenceUnit.setName("test");
- xmlPersistence.getPersistenceUnits().add(xmlPersistenceUnit);
-
- assertEquals(2, xmlPersistence.getPersistenceUnits().size());
- assertEquals(1, persistence.persistenceUnitsSize());
-
- // remove persistence unit, test that it's removed from resource and that
- // a *new* persistence unit representing the previously unrepresented one
- // is present
- persistence.removePersistenceUnit(0);
-
- assertEquals(1, xmlPersistence.getPersistenceUnits().size());
- assertEquals(1, persistence.persistenceUnitsSize());
-
- // remove new persistence unit, test that it's removed from resource and
- // context
- persistence.removePersistenceUnit(0);
-
- assertEquals(0, xmlPersistence.getPersistenceUnits().size());
- assertEquals(0, persistence.persistenceUnitsSize());
- }
-}
diff --git a/jpa/tests/org.eclipse.jpt.core.tests/src/org/eclipse/jpt/core/tests/internal/context/persistence/PersistenceUnitTests.java b/jpa/tests/org.eclipse.jpt.core.tests/src/org/eclipse/jpt/core/tests/internal/context/persistence/PersistenceUnitTests.java
deleted file mode 100644
index 4eb8a6fa3c..0000000000
--- a/jpa/tests/org.eclipse.jpt.core.tests/src/org/eclipse/jpt/core/tests/internal/context/persistence/PersistenceUnitTests.java
+++ /dev/null
@@ -1,1211 +0,0 @@
-/*******************************************************************************
- * Copyright (c) 2007, 2009 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.
- *
- * Contributors:
- * Oracle - initial API and implementation
- *******************************************************************************/
-package org.eclipse.jpt.core.tests.internal.context.persistence;
-
-import java.io.IOException;
-import java.util.Iterator;
-import java.util.ListIterator;
-import org.eclipse.jdt.core.ICompilationUnit;
-import org.eclipse.jpt.core.JptCorePlugin;
-import org.eclipse.jpt.core.MappingKeys;
-import org.eclipse.jpt.core.context.AccessType;
-import org.eclipse.jpt.core.context.java.JavaPersistentType;
-import org.eclipse.jpt.core.context.orm.OrmPersistentType;
-import org.eclipse.jpt.core.context.orm.OrmXml;
-import org.eclipse.jpt.core.context.persistence.ClassRef;
-import org.eclipse.jpt.core.context.persistence.MappingFileRef;
-import org.eclipse.jpt.core.context.persistence.PersistenceUnit;
-import org.eclipse.jpt.core.context.persistence.PersistenceUnitTransactionType;
-import org.eclipse.jpt.core.internal.resource.orm.OrmXmlResourceProvider;
-import org.eclipse.jpt.core.resource.java.JPA;
-import org.eclipse.jpt.core.resource.persistence.PersistenceFactory;
-import org.eclipse.jpt.core.resource.persistence.XmlJavaClassRef;
-import org.eclipse.jpt.core.resource.persistence.XmlMappingFileRef;
-import org.eclipse.jpt.core.resource.persistence.XmlPersistenceUnit;
-import org.eclipse.jpt.core.resource.persistence.XmlPersistenceUnitTransactionType;
-import org.eclipse.jpt.core.resource.persistence.XmlProperties;
-import org.eclipse.jpt.core.resource.persistence.XmlProperty;
-import org.eclipse.jpt.core.resource.xml.JpaXmlResource;
-import org.eclipse.jpt.core.tests.internal.context.ContextModelTestCase;
-import org.eclipse.jpt.utility.internal.iterators.ArrayIterator;
-
-@SuppressWarnings("nls")
-public class PersistenceUnitTests extends ContextModelTestCase
-{
-
- protected static final String INNER_CLASS_NAME = "InnerAnnotationTestType";
- protected static final String FULLY_QUALIFIED_INNER_CLASS_NAME = PACKAGE_NAME + "." + TYPE_NAME + "." + INNER_CLASS_NAME;
-
- public static final String OTHER_TYPE_NAME = "OtherTestType";
- public static final String FULLY_QUALIFIED_OTHER_TYPE_NAME = PACKAGE_NAME + "." + OTHER_TYPE_NAME;
-
-
- public PersistenceUnitTests(String name) {
- super(name);
- }
-
- public void testUpdateName() {
- XmlPersistenceUnit xmlPersistenceUnit = getXmlPersistenceUnit();
- PersistenceUnit persistenceUnit = getPersistenceUnit();
-
- // test that names are initially equal
- assertEquals(xmlPersistenceUnit.getName(), persistenceUnit.getName());
-
- // set name to different name, test equality
- xmlPersistenceUnit.setName("newName");
-
- assertEquals(xmlPersistenceUnit.getName(), persistenceUnit.getName());
-
- // set name to empty string, test equality
- xmlPersistenceUnit.setName("");
-
- assertEquals(xmlPersistenceUnit.getName(), persistenceUnit.getName());
-
- // set name to null, test equality
- xmlPersistenceUnit.setName(null);
-
- assertEquals(xmlPersistenceUnit.getName(), persistenceUnit.getName());
-
- // set name back to non-null, test equality
- xmlPersistenceUnit.setName("newName");
-
- assertEquals(xmlPersistenceUnit.getName(), persistenceUnit.getName());
- }
-
- public void testModifyName() {
- XmlPersistenceUnit xmlPersistenceUnit = getXmlPersistenceUnit();
- PersistenceUnit persistenceUnit = getPersistenceUnit();
-
- // test that names are initially equal
- assertEquals(xmlPersistenceUnit.getName(), persistenceUnit.getName());
-
- // set name to different name, test equality
- persistenceUnit.setName("newName");
-
- assertEquals(xmlPersistenceUnit.getName(), persistenceUnit.getName());
-
- // set name to empty string, test equality
- persistenceUnit.setName("");
-
- assertEquals(xmlPersistenceUnit.getName(), persistenceUnit.getName());
-
- // set name to null, test equality
- persistenceUnit.setName(null);
-
- assertEquals(xmlPersistenceUnit.getName(), persistenceUnit.getName());
-
- // set name back to non-null, test equality
- persistenceUnit.setName("newName");
-
- assertEquals(xmlPersistenceUnit.getName(), persistenceUnit.getName());
- }
-
- public void testUpdateTransactionType() {
- XmlPersistenceUnit xmlPersistenceUnit = getXmlPersistenceUnit();
- PersistenceUnit persistenceUnit = getPersistenceUnit();
-
- // 1 - initial value is default
- assertNull(xmlPersistenceUnit.getTransactionType());
- assertNull(persistenceUnit.getSpecifiedTransactionType());
-
- // 2 - set value, context changed
- xmlPersistenceUnit.setTransactionType(XmlPersistenceUnitTransactionType.JTA);
-
- assertEquals(PersistenceUnitTransactionType.JTA, persistenceUnit.getSpecifiedTransactionType());
-
- xmlPersistenceUnit.setTransactionType(XmlPersistenceUnitTransactionType.RESOURCE_LOCAL);
-
- assertEquals(PersistenceUnitTransactionType.RESOURCE_LOCAL, persistenceUnit.getSpecifiedTransactionType());
-
- // 3 - unset value, context changed
- xmlPersistenceUnit.setTransactionType(null);
-
- assertNull(persistenceUnit.getSpecifiedTransactionType());
- }
-
- public void testModifyTransactionType() {
- XmlPersistenceUnit xmlPersistenceUnit = getXmlPersistenceUnit();
- PersistenceUnit persistenceUnit = getPersistenceUnit();
-
- // 1 - initial value is default
- assertNull(xmlPersistenceUnit.getTransactionType());
- assertNull(persistenceUnit.getSpecifiedTransactionType());
-
- // 2 - set context value, resource changed
- persistenceUnit.setSpecifiedTransactionType(PersistenceUnitTransactionType.JTA);
-
- assertEquals(XmlPersistenceUnitTransactionType.JTA, xmlPersistenceUnit.getTransactionType());
-
- persistenceUnit.setSpecifiedTransactionType(PersistenceUnitTransactionType.RESOURCE_LOCAL);
-
- assertEquals(XmlPersistenceUnitTransactionType.RESOURCE_LOCAL, xmlPersistenceUnit.getTransactionType());
-
- // 3 - set context value to default, resource unset
- persistenceUnit.setSpecifiedTransactionType(null);
-
- assertNull(persistenceUnit.getSpecifiedTransactionType());
- assertNull(xmlPersistenceUnit.getTransactionType());
- }
-
- public void testUpdateDescription() {
- XmlPersistenceUnit xmlPersistenceUnit = getXmlPersistenceUnit();
- PersistenceUnit persistenceUnit = getPersistenceUnit();
-
- // test that descriptions are initially equal
- assertEquals(xmlPersistenceUnit.getDescription(), persistenceUnit.getDescription());
-
- // set description to different description, test equality
- xmlPersistenceUnit.setDescription("newDescription");
-
- assertEquals(xmlPersistenceUnit.getDescription(), persistenceUnit.getDescription());
-
- // set description to empty string, test equality
- xmlPersistenceUnit.setDescription("");
-
- assertEquals(xmlPersistenceUnit.getDescription(), persistenceUnit.getDescription());
-
- // set description to null, test equality
- xmlPersistenceUnit.setDescription(null);
-
- assertEquals(xmlPersistenceUnit.getDescription(), persistenceUnit.getDescription());
-
- // set description back to non-null, test equality
- xmlPersistenceUnit.setDescription("newDescription");
-
- assertEquals(xmlPersistenceUnit.getDescription(), persistenceUnit.getDescription());
- }
-
- public void testModifyDescription() {
- XmlPersistenceUnit xmlPersistenceUnit = getXmlPersistenceUnit();
- PersistenceUnit persistenceUnit = getPersistenceUnit();
-
- // test that descriptions are initially equal
- assertEquals(xmlPersistenceUnit.getDescription(), persistenceUnit.getDescription());
-
- // set description to different description, test equality
- persistenceUnit.setDescription("newDescription");
-
- assertEquals(xmlPersistenceUnit.getDescription(), persistenceUnit.getDescription());
-
- // set description to empty string, test equality
- persistenceUnit.setDescription("");
-
- assertEquals(xmlPersistenceUnit.getDescription(), persistenceUnit.getDescription());
-
- // set description to null, test equality
- persistenceUnit.setDescription(null);
-
- assertEquals(xmlPersistenceUnit.getDescription(), persistenceUnit.getDescription());
-
- // set description back to non-null, test equality
- persistenceUnit.setDescription("newDescription");
-
- assertEquals(xmlPersistenceUnit.getDescription(), persistenceUnit.getDescription());
- }
-
- public void testUpdateProvider() {
- XmlPersistenceUnit xmlPersistenceUnit = getXmlPersistenceUnit();
- PersistenceUnit persistenceUnit = getPersistenceUnit();
-
- // test that providers are initially equal
- assertEquals(xmlPersistenceUnit.getProvider(), persistenceUnit.getProvider());
-
- // set provider to different provider, test equality
- xmlPersistenceUnit.setProvider("newProvider");
-
- assertEquals(xmlPersistenceUnit.getProvider(), persistenceUnit.getProvider());
-
- // set provider to empty string, test equality
- xmlPersistenceUnit.setProvider("");
-
- assertEquals(xmlPersistenceUnit.getProvider(), persistenceUnit.getProvider());
-
- // set provider to null, test equality
- xmlPersistenceUnit.setProvider(null);
-
- assertEquals(xmlPersistenceUnit.getProvider(), persistenceUnit.getProvider());
-
- // set provider back to non-null, test equality
- xmlPersistenceUnit.setProvider("newProvider");
-
- assertEquals(xmlPersistenceUnit.getProvider(), persistenceUnit.getProvider());
- }
-
- public void testModifyProvider() {
- XmlPersistenceUnit xmlPersistenceUnit = getXmlPersistenceUnit();
- PersistenceUnit persistenceUnit = getPersistenceUnit();
-
- // test that providers are initially equal
- assertEquals(xmlPersistenceUnit.getProvider(), persistenceUnit.getProvider());
-
- // set provider to different provider, test equality
- persistenceUnit.setProvider("newProvider");
-
- assertEquals(xmlPersistenceUnit.getProvider(), persistenceUnit.getProvider());
-
- // set provider to empty string, test equality
- persistenceUnit.setProvider("");
-
- assertEquals(xmlPersistenceUnit.getProvider(), persistenceUnit.getProvider());
-
- // set provider to null, test equality
- persistenceUnit.setProvider(null);
-
- assertEquals(xmlPersistenceUnit.getProvider(), persistenceUnit.getProvider());
-
- // set provider back to non-null, test equality
- persistenceUnit.setProvider("newProvider");
-
- assertEquals(xmlPersistenceUnit.getProvider(), persistenceUnit.getProvider());
- }
-
- public void testUpdateJtaDataSource() {
- XmlPersistenceUnit xmlPersistenceUnit = getXmlPersistenceUnit();
- PersistenceUnit persistenceUnit = getPersistenceUnit();
-
- // test that jtaDataSources are initially equal
- assertEquals(xmlPersistenceUnit.getJtaDataSource(), persistenceUnit.getJtaDataSource());
-
- // set jtaDataSource to different jtaDataSource, test equality
- xmlPersistenceUnit.setJtaDataSource("newJtaDataSource");
-
- assertEquals(xmlPersistenceUnit.getJtaDataSource(), persistenceUnit.getJtaDataSource());
-
- // set jtaDataSource to empty string, test equality
- xmlPersistenceUnit.setJtaDataSource("");
-
- assertEquals(xmlPersistenceUnit.getJtaDataSource(), persistenceUnit.getJtaDataSource());
-
- // set jtaDataSource to null, test equality
- xmlPersistenceUnit.setJtaDataSource(null);
-
- assertEquals(xmlPersistenceUnit.getJtaDataSource(), persistenceUnit.getJtaDataSource());
-
- // set jtaDataSource back to non-null, test equality
- xmlPersistenceUnit.setJtaDataSource("newJtaDataSource");
-
- assertEquals(xmlPersistenceUnit.getJtaDataSource(), persistenceUnit.getJtaDataSource());
- }
-
- public void testModifyJtaDataSource() {
- XmlPersistenceUnit xmlPersistenceUnit = getXmlPersistenceUnit();
- PersistenceUnit persistenceUnit = getPersistenceUnit();
-
- // test that jtaDataSources are initially equal
- assertEquals(xmlPersistenceUnit.getJtaDataSource(), persistenceUnit.getJtaDataSource());
-
- // set jtaDataSource to different jtaDataSource, test equality
- persistenceUnit.setJtaDataSource("newJtaDataSource");
-
- assertEquals(xmlPersistenceUnit.getJtaDataSource(), persistenceUnit.getJtaDataSource());
-
- // set jtaDataSource to empty string, test equality
- persistenceUnit.setJtaDataSource("");
-
- assertEquals(xmlPersistenceUnit.getJtaDataSource(), persistenceUnit.getJtaDataSource());
-
- // set jtaDataSource to null, test equality
- persistenceUnit.setJtaDataSource(null);
-
- assertEquals(xmlPersistenceUnit.getJtaDataSource(), persistenceUnit.getJtaDataSource());
-
- // set jtaDataSource back to non-null, test equality
- persistenceUnit.setJtaDataSource("newJtaDataSource");
-
- assertEquals(xmlPersistenceUnit.getJtaDataSource(), persistenceUnit.getJtaDataSource());
- }
-
- public void testUpdateNonJtaDataSource() {
- XmlPersistenceUnit xmlPersistenceUnit = getXmlPersistenceUnit();
- PersistenceUnit persistenceUnit = getPersistenceUnit();
-
- // test that nonJtaDataSources are initially equal
- assertEquals(xmlPersistenceUnit.getNonJtaDataSource(), persistenceUnit.getNonJtaDataSource());
-
- // set nonJtaDataSource to different nonJtaDataSource, test equality
- xmlPersistenceUnit.setNonJtaDataSource("newNonJtaDataSource");
-
- assertEquals(xmlPersistenceUnit.getNonJtaDataSource(), persistenceUnit.getNonJtaDataSource());
-
- // set nonJtaDataSource to empty string, test equality
- xmlPersistenceUnit.setNonJtaDataSource("");
-
- assertEquals(xmlPersistenceUnit.getNonJtaDataSource(), persistenceUnit.getNonJtaDataSource());
-
- // set nonJtaDataSource to null, test equality
- xmlPersistenceUnit.setNonJtaDataSource(null);
-
- assertEquals(xmlPersistenceUnit.getNonJtaDataSource(), persistenceUnit.getNonJtaDataSource());
-
- // set nonJtaDataSource back to non-null, test equality
- xmlPersistenceUnit.setNonJtaDataSource("newNonJtaDataSource");
-
- assertEquals(xmlPersistenceUnit.getNonJtaDataSource(), persistenceUnit.getNonJtaDataSource());
- }
-
- public void testModifyNonJtaDataSource() {
- XmlPersistenceUnit xmlPersistenceUnit = getXmlPersistenceUnit();
- PersistenceUnit persistenceUnit = getPersistenceUnit();
-
- // test that nonJtaDataSources are initially equal
- assertEquals(xmlPersistenceUnit.getNonJtaDataSource(), persistenceUnit.getNonJtaDataSource());
-
- // set nonJtaDataSource to different nonJtaDataSource, test equality
- persistenceUnit.setNonJtaDataSource("newNonJtaDataSource");
-
- assertEquals(xmlPersistenceUnit.getNonJtaDataSource(), persistenceUnit.getNonJtaDataSource());
-
- // set nonJtaDataSource to empty string, test equality
- persistenceUnit.setNonJtaDataSource("");
-
- assertEquals(xmlPersistenceUnit.getNonJtaDataSource(), persistenceUnit.getNonJtaDataSource());
-
- // set nonJtaDataSource to null, test equality
- persistenceUnit.setNonJtaDataSource(null);
-
- assertEquals(xmlPersistenceUnit.getNonJtaDataSource(), persistenceUnit.getNonJtaDataSource());
-
- // set nonJtaDataSource back to non-null, test equality
- persistenceUnit.setNonJtaDataSource("newNonJtaDataSource");
-
- assertEquals(xmlPersistenceUnit.getNonJtaDataSource(), persistenceUnit.getNonJtaDataSource());
- }
-
- public void testUpdateJarFileRefs1() {
- // TODO
- }
-
- public void testUpdateJarFileRefs2() {
- // TODO
- }
-
- public void testUpdateImpliedMappingFileRef1() throws Exception {
- PersistenceUnit persistenceUnit = getPersistenceUnit();
-
- // test that there is one initially
- JpaXmlResource ormResource = getOrmXmlResource();
- assertTrue(ormResource.fileExists());
- assertNotNull(persistenceUnit.getImpliedMappingFileRef());
-
- // remove orm.xml
- deleteResource(ormResource);
-
- assertFalse(ormResource.fileExists());
- assertNull(persistenceUnit.getImpliedMappingFileRef());
- }
-
- public void testUpdateImpliedMappingFileRef2() {
- XmlPersistenceUnit xmlPersistenceUnit = getXmlPersistenceUnit();
- PersistenceUnit persistenceUnit = getPersistenceUnit();
-
- // test that there is one initially
- JpaXmlResource ormResource = getOrmXmlResource();
- assertTrue(ormResource.fileExists());
- assertNotNull(persistenceUnit.getImpliedMappingFileRef());
-
- // add specified orm.xml
- XmlMappingFileRef xmlMappingFileRef = PersistenceFactory.eINSTANCE.createXmlMappingFileRef();
- xmlMappingFileRef.setFileName("META-INF/orm.xml");
- xmlPersistenceUnit.getMappingFiles().add(xmlMappingFileRef);
-
- assertEquals(1, persistenceUnit.specifiedMappingFileRefsSize());
-
- assertTrue(ormResource.fileExists());
- assertNull(persistenceUnit.getImpliedMappingFileRef());
- }
-
- public void testUpdateSpecifiedMappingFileRefs1() {
- XmlPersistenceUnit xmlPersistenceUnit = getXmlPersistenceUnit();
- PersistenceUnit persistenceUnit = getPersistenceUnit();
-
- // test there are none initially
- assertEquals(0, xmlPersistenceUnit.getMappingFiles().size());
- assertEquals(0, persistenceUnit.specifiedMappingFileRefsSize());
-
- // add mapping file ref, test that it's added to context
- XmlMappingFileRef xmlMappingFileRef = PersistenceFactory.eINSTANCE.createXmlMappingFileRef();
- xmlMappingFileRef.setFileName("orm.xml");
- xmlPersistenceUnit.getMappingFiles().add(xmlMappingFileRef);
-
- assertEquals(1, persistenceUnit.specifiedMappingFileRefsSize());
-
- // add another ...
- xmlMappingFileRef = PersistenceFactory.eINSTANCE.createXmlMappingFileRef();
- xmlMappingFileRef.setFileName("orm2.xml");
- xmlPersistenceUnit.getMappingFiles().add(xmlMappingFileRef);
-
- assertEquals(2, persistenceUnit.specifiedMappingFileRefsSize());
- }
-
- public void testUpdateSpecifiedMappingFileRefs2() {
- XmlPersistenceUnit xmlPersistenceUnit = getXmlPersistenceUnit();
- PersistenceUnit persistenceUnit = getPersistenceUnit();
-
- // add two mapping file refs and test that there are two existing in xml and context
- XmlMappingFileRef xmlMappingFileRef = PersistenceFactory.eINSTANCE.createXmlMappingFileRef();
- xmlMappingFileRef.setFileName("orm.xml");
- xmlPersistenceUnit.getMappingFiles().add(xmlMappingFileRef);
- xmlMappingFileRef = PersistenceFactory.eINSTANCE.createXmlMappingFileRef();
- xmlMappingFileRef.setFileName("orm2.xml");
- xmlPersistenceUnit.getMappingFiles().add(xmlMappingFileRef);
-
- assertEquals(xmlPersistenceUnit.getMappingFiles().size(), 2);
- assertEquals(2, persistenceUnit.specifiedMappingFileRefsSize());
-
- // remove mapping file ref from xml, test that it's removed from context
- xmlMappingFileRef = xmlPersistenceUnit.getMappingFiles().get(0);
- xmlPersistenceUnit.getMappingFiles().remove(xmlMappingFileRef);
-
- assertEquals(1, persistenceUnit.specifiedMappingFileRefsSize());
-
- // remove another one ...
- xmlMappingFileRef = xmlPersistenceUnit.getMappingFiles().get(0);
- xmlPersistenceUnit.getMappingFiles().remove(xmlMappingFileRef);
-
- assertEquals(0, persistenceUnit.specifiedMappingFileRefsSize());
- }
-
- public void testModifySpecifiedMappingFileRefs1() {
- XmlPersistenceUnit xmlPersistenceUnit = getXmlPersistenceUnit();
- PersistenceUnit persistenceUnit = getPersistenceUnit();
-
- // test there are none initially
- assertEquals(0, xmlPersistenceUnit.getMappingFiles().size());
- assertEquals(0, persistenceUnit.specifiedMappingFileRefsSize());
-
- // add mapping file ref, test that it's added to resource
- persistenceUnit.addSpecifiedMappingFileRef().setFileName("foo");
-
- assertEquals(1, xmlPersistenceUnit.getMappingFiles().size());
- assertEquals("foo", xmlPersistenceUnit.getMappingFiles().get(0).getFileName());
-
- // add another ...
- persistenceUnit.addSpecifiedMappingFileRef().setFileName("bar");
- assertEquals("foo", xmlPersistenceUnit.getMappingFiles().get(0).getFileName());
- assertEquals("bar", xmlPersistenceUnit.getMappingFiles().get(1).getFileName());
-
- assertEquals(2, xmlPersistenceUnit.getMappingFiles().size());
-
- // add another, testing order
- persistenceUnit.addSpecifiedMappingFileRef(0).setFileName("baz");
- assertEquals(3, xmlPersistenceUnit.getMappingFiles().size());
- assertEquals("baz", xmlPersistenceUnit.getMappingFiles().get(0).getFileName());
- assertEquals("foo", xmlPersistenceUnit.getMappingFiles().get(1).getFileName());
- assertEquals("bar", xmlPersistenceUnit.getMappingFiles().get(2).getFileName());
- }
-
- public void testModifySpecifiedMappingFileRefs2() {
- XmlPersistenceUnit xmlPersistenceUnit = getXmlPersistenceUnit();
- PersistenceUnit persistenceUnit = getPersistenceUnit();
-
- // add two mapping file refs and test that there are two existing in xml and context
- XmlMappingFileRef xmlMappingFileRef = PersistenceFactory.eINSTANCE.createXmlMappingFileRef();
- xmlMappingFileRef.setFileName("orm.xml");
- xmlPersistenceUnit.getMappingFiles().add(xmlMappingFileRef);
- xmlMappingFileRef = PersistenceFactory.eINSTANCE.createXmlMappingFileRef();
- xmlMappingFileRef.setFileName("orm2.xml");
- xmlPersistenceUnit.getMappingFiles().add(xmlMappingFileRef);
-
- assertEquals(2, xmlPersistenceUnit.getMappingFiles().size());
- assertEquals(2, persistenceUnit.specifiedMappingFileRefsSize());
-
- // remove mapping file ref from context, test that it's removed from xml
- persistenceUnit.removeSpecifiedMappingFileRef(0);
-
- assertEquals(1, xmlPersistenceUnit.getMappingFiles().size());
-
- // remove another one ...
- persistenceUnit.removeSpecifiedMappingFileRef(0);
-
- assertEquals(0, xmlPersistenceUnit.getMappingFiles().size());
- }
-
- public void testUpdateClassRefs1() {
- XmlPersistenceUnit xmlPersistenceUnit = getXmlPersistenceUnit();
- PersistenceUnit persistenceUnit = getPersistenceUnit();
-
- // test there are none initially
- assertEquals(0, xmlPersistenceUnit.getClasses().size());
- assertEquals(0, persistenceUnit.specifiedClassRefsSize());
-
- // add mapping file ref, test that it's added to context
- XmlJavaClassRef xmlClassRef = PersistenceFactory.eINSTANCE.createXmlJavaClassRef();
- xmlClassRef.setJavaClass("com.foo.Bar");
- xmlPersistenceUnit.getClasses().add(xmlClassRef);
-
- assertEquals(1, persistenceUnit.specifiedClassRefsSize());
-
- // add another ...
- xmlClassRef = PersistenceFactory.eINSTANCE.createXmlJavaClassRef();
- xmlClassRef.setJavaClass("com.foo.Baz");
- xmlPersistenceUnit.getClasses().add(xmlClassRef);
-
- assertEquals(2, persistenceUnit.specifiedClassRefsSize());
- }
-
- public void testUpdateClassRefs2() {
- XmlPersistenceUnit xmlPersistenceUnit = getXmlPersistenceUnit();
- PersistenceUnit persistenceUnit = getPersistenceUnit();
-
- // add two class refs and test that there are two existing in xml and context
- XmlJavaClassRef xmlClassRef = PersistenceFactory.eINSTANCE.createXmlJavaClassRef();
- xmlClassRef.setJavaClass("com.foo.Bar");
- xmlPersistenceUnit.getClasses().add(xmlClassRef);
- xmlClassRef = PersistenceFactory.eINSTANCE.createXmlJavaClassRef();
- xmlClassRef.setJavaClass("com.foo.Baz");
- xmlPersistenceUnit.getClasses().add(xmlClassRef);
-
- assertEquals(2, xmlPersistenceUnit.getClasses().size());
- assertEquals(2, persistenceUnit.specifiedClassRefsSize());
-
- // remove class ref from xml, test that it's removed from context
- xmlClassRef = xmlPersistenceUnit.getClasses().get(0);
- xmlPersistenceUnit.getClasses().remove(xmlClassRef);
-
- assertEquals(1, persistenceUnit.specifiedClassRefsSize());
-
- // remove another one ...
- xmlClassRef = xmlPersistenceUnit.getClasses().get(0);
- xmlPersistenceUnit.getClasses().remove(xmlClassRef);
-
- assertEquals(0, persistenceUnit.specifiedClassRefsSize());
- }
-
- public void testModifyClassRefs1() {
- XmlPersistenceUnit xmlPersistenceUnit = getXmlPersistenceUnit();
- PersistenceUnit persistenceUnit = getPersistenceUnit();
-
- // test there are none initially
- assertEquals(0, xmlPersistenceUnit.getClasses().size());
- assertEquals(0, persistenceUnit.specifiedClassRefsSize());
-
- // add class ref, test that it's added to context
- persistenceUnit.addSpecifiedClassRef().setClassName("Foo");
-
- try {
- getPersistenceXmlResource().save(null);
- }
- catch (IOException e) {
- // TODO Auto-generated catch block
- e.printStackTrace();
- }
- assertEquals(1, xmlPersistenceUnit.getClasses().size());
- assertEquals("Foo", xmlPersistenceUnit.getClasses().get(0).getJavaClass());
-
- // add another ...
- persistenceUnit.addSpecifiedClassRef().setClassName("Bar");
-
- assertEquals(2, xmlPersistenceUnit.getClasses().size());
- assertEquals("Foo", xmlPersistenceUnit.getClasses().get(0).getJavaClass());
- assertEquals("Bar", xmlPersistenceUnit.getClasses().get(1).getJavaClass());
-
-
- persistenceUnit.addSpecifiedClassRef(0).setClassName("Baz");
-
- assertEquals(3, xmlPersistenceUnit.getClasses().size());
- assertEquals("Baz", xmlPersistenceUnit.getClasses().get(0).getJavaClass());
- assertEquals("Foo", xmlPersistenceUnit.getClasses().get(1).getJavaClass());
- assertEquals("Bar", xmlPersistenceUnit.getClasses().get(2).getJavaClass());
- }
-
- public void testModifyClassRefs2() {
- XmlPersistenceUnit xmlPersistenceUnit = getXmlPersistenceUnit();
- PersistenceUnit persistenceUnit = getPersistenceUnit();
-
- // add two class refs and test that there are two existing in xml and context
- XmlJavaClassRef xmlClassRef = PersistenceFactory.eINSTANCE.createXmlJavaClassRef();
- xmlClassRef.setJavaClass("com.foo.Bar");
- xmlPersistenceUnit.getClasses().add(xmlClassRef);
- xmlClassRef = PersistenceFactory.eINSTANCE.createXmlJavaClassRef();
- xmlClassRef.setJavaClass("com.foo.Baz");
- xmlPersistenceUnit.getClasses().add(xmlClassRef);
-
- assertEquals(2, xmlPersistenceUnit.getClasses().size());
- assertEquals(2, persistenceUnit.specifiedClassRefsSize());
-
- // remove class ref from context, test that it's removed from xml
- persistenceUnit.removeSpecifiedClassRef(0);
-
- assertEquals(1, xmlPersistenceUnit.getClasses().size());
-
- // remove another one ...
- persistenceUnit.removeSpecifiedClassRef(0);
-
- assertEquals(0, xmlPersistenceUnit.getClasses().size());
- }
-
- public void testImpliedClassRefs() throws Exception {
- createTestEntityWithPersistentInnerClass();
- Iterator<ClassRef> classRefs = getPersistenceUnit().impliedClassRefs();
- assertEquals(FULLY_QUALIFIED_TYPE_NAME, classRefs.next().getClassName());
- assertEquals(FULLY_QUALIFIED_INNER_CLASS_NAME, classRefs.next().getClassName());
-
- getJpaProject().setDiscoversAnnotatedClasses(true);
- classRefs = getPersistenceUnit().impliedClassRefs();
- assertEquals(FULLY_QUALIFIED_TYPE_NAME, classRefs.next().getClassName());
- assertEquals(FULLY_QUALIFIED_INNER_CLASS_NAME, classRefs.next().getClassName());
-
- addXmlClassRef(FULLY_QUALIFIED_TYPE_NAME);
- classRefs = getPersistenceUnit().impliedClassRefs();
- assertEquals(FULLY_QUALIFIED_INNER_CLASS_NAME, classRefs.next().getClassName());
- assertFalse(classRefs.hasNext());
-
-
- removeXmlClassRef(FULLY_QUALIFIED_TYPE_NAME);
- classRefs = getPersistenceUnit().impliedClassRefs();
- assertEquals(FULLY_QUALIFIED_INNER_CLASS_NAME, classRefs.next().getClassName());
- assertEquals(FULLY_QUALIFIED_TYPE_NAME, classRefs.next().getClassName());
-
- getEntityMappings().addPersistentType(MappingKeys.ENTITY_TYPE_MAPPING_KEY, FULLY_QUALIFIED_TYPE_NAME);
- classRefs = getPersistenceUnit().impliedClassRefs();
- assertEquals(FULLY_QUALIFIED_INNER_CLASS_NAME, classRefs.next().getClassName());
- assertFalse(classRefs.hasNext());
-
- addXmlClassRef(FULLY_QUALIFIED_INNER_CLASS_NAME);
- classRefs = getPersistenceUnit().impliedClassRefs();
- assertFalse(classRefs.hasNext());
-
- removeXmlClassRef(FULLY_QUALIFIED_INNER_CLASS_NAME);
- classRefs = getPersistenceUnit().impliedClassRefs();
- assertEquals(FULLY_QUALIFIED_INNER_CLASS_NAME, classRefs.next().getClassName());
- assertFalse(classRefs.hasNext());
-
- getEntityMappings().addPersistentType(MappingKeys.ENTITY_TYPE_MAPPING_KEY, FULLY_QUALIFIED_INNER_CLASS_NAME);
- classRefs = getPersistenceUnit().impliedClassRefs();
- assertFalse(classRefs.hasNext());
- }
-
- public void testRenamePersistentTypeImpliedClassRefs() throws Exception {
- getJavaProject().getJpaProject().setDiscoversAnnotatedClasses(true);
- ICompilationUnit testType = createTestEntity();
- @SuppressWarnings("unused")
- ICompilationUnit otherTestType = this.createTestOtherTypeEntity();
-
- Iterator<ClassRef> classRefs = getPersistenceUnit().impliedClassRefs();
- ClassRef testTypeClassRef = classRefs.next();
- ClassRef otherTestTypeClassRef = classRefs.next();
-
- assertEquals(FULLY_QUALIFIED_TYPE_NAME, testTypeClassRef.getClassName());
- assertEquals(FULLY_QUALIFIED_OTHER_TYPE_NAME, otherTestTypeClassRef.getClassName());
-
- JavaPersistentType testJavaPersistentType = testTypeClassRef.getJavaPersistentType();
- JavaPersistentType otherTestJavaPersistentType = otherTestTypeClassRef.getJavaPersistentType();
-
- testType.findPrimaryType().rename("TestType2", false, null);
-
- classRefs = getPersistenceUnit().impliedClassRefs();
- otherTestTypeClassRef = classRefs.next();
- testTypeClassRef = classRefs.next();
-
- assertEquals(FULLY_QUALIFIED_OTHER_TYPE_NAME, otherTestTypeClassRef.getClassName());
- assertEquals("test.TestType2", testTypeClassRef.getClassName());
-
- assertEquals(otherTestJavaPersistentType, otherTestTypeClassRef.getJavaPersistentType());
- assertNotSame(testJavaPersistentType, testTypeClassRef.getJavaPersistentType());
- }
-
- public void testUpdateExcludeUnlistedClasses() throws Exception {
- XmlPersistenceUnit xmlPersistenceUnit = getXmlPersistenceUnit();
- PersistenceUnit persistenceUnit = getPersistenceUnit();
-
- // 1 - initial value is default
- assertNull(persistenceUnit.getSpecifiedExcludeUnlistedClasses());
- assertFalse(persistenceUnit.excludesUnlistedClasses());
- assertNull(xmlPersistenceUnit.getExcludeUnlistedClasses());
-
- // 2 - set value, context changed
- xmlPersistenceUnit.setExcludeUnlistedClasses(Boolean.TRUE);
-
- assertEquals(Boolean.TRUE, persistenceUnit.getSpecifiedExcludeUnlistedClasses());
- assertTrue(persistenceUnit.excludesUnlistedClasses());
- assertEquals(Boolean.TRUE, xmlPersistenceUnit.getExcludeUnlistedClasses());
-
- xmlPersistenceUnit.setExcludeUnlistedClasses(Boolean.FALSE);
-
- assertEquals(Boolean.FALSE, persistenceUnit.getSpecifiedExcludeUnlistedClasses());
- assertFalse(persistenceUnit.excludesUnlistedClasses());
- assertEquals(Boolean.FALSE, xmlPersistenceUnit.getExcludeUnlistedClasses());
-
- // 3 - unset value, context changed
- xmlPersistenceUnit.setExcludeUnlistedClasses(null);
-
- assertNull(persistenceUnit.getSpecifiedExcludeUnlistedClasses());
- assertFalse(persistenceUnit.excludesUnlistedClasses());
- assertNull(xmlPersistenceUnit.getExcludeUnlistedClasses());
- }
-
- public void testModifyExcludeUnlistedClasses() {
- XmlPersistenceUnit xmlPersistenceUnit = getXmlPersistenceUnit();
- PersistenceUnit persistenceUnit = getPersistenceUnit();
-
- // 1 - initial value is default
- assertNull(persistenceUnit.getSpecifiedExcludeUnlistedClasses());
- assertFalse(persistenceUnit.excludesUnlistedClasses());
- assertNull(xmlPersistenceUnit.getExcludeUnlistedClasses());
-
- // 2 - set value, resource changed
- persistenceUnit.setSpecifiedExcludeUnlistedClasses(Boolean.TRUE);
-
- assertEquals(Boolean.TRUE, persistenceUnit.getSpecifiedExcludeUnlistedClasses());
- assertTrue(persistenceUnit.excludesUnlistedClasses());
- assertEquals(Boolean.TRUE, xmlPersistenceUnit.getExcludeUnlistedClasses());
-
- persistenceUnit.setSpecifiedExcludeUnlistedClasses(Boolean.FALSE);
-
- assertEquals(Boolean.FALSE, persistenceUnit.getSpecifiedExcludeUnlistedClasses());
- assertFalse(persistenceUnit.excludesUnlistedClasses());
- assertEquals(Boolean.FALSE, xmlPersistenceUnit.getExcludeUnlistedClasses());
-
- // 3 - set context to default, resource unset
- persistenceUnit.setSpecifiedExcludeUnlistedClasses(null);
-
- assertNull(persistenceUnit.getSpecifiedExcludeUnlistedClasses());
- assertFalse(persistenceUnit.excludesUnlistedClasses());
- assertNull(xmlPersistenceUnit.getExcludeUnlistedClasses());
- }
-
- public void testUpdateProperties1() {
- XmlPersistenceUnit xmlPersistenceUnit = getXmlPersistenceUnit();
- PersistenceUnit persistenceUnit = getPersistenceUnit();
-
- // test there are none initially
- assertNull(xmlPersistenceUnit.getProperties());
- assertEquals(0, persistenceUnit.propertiesSize());
-
- // add "properties", test that there's no real change to context
- XmlProperties xmlProperties = PersistenceFactory.eINSTANCE.createXmlProperties();
- xmlPersistenceUnit.setProperties(xmlProperties);
- assertEquals(0, persistenceUnit.propertiesSize());
-
- // add property, test that it's added to context
- XmlProperty xmlProperty = PersistenceFactory.eINSTANCE.createXmlProperty();
- xmlProperty.setName("foo");
- xmlProperty.setValue("bar");
- xmlProperties.getProperties().add(xmlProperty);
-
- assertEquals(1, persistenceUnit.propertiesSize());
-
- // add another ...
- xmlProperty = PersistenceFactory.eINSTANCE.createXmlProperty();
- xmlProperty.setName("FOO");
- xmlProperty.setValue("BAR");
- xmlProperties.getProperties().add(xmlProperty);
-
- assertEquals(2, persistenceUnit.propertiesSize());
- }
-
- public void testUpdateProperties2() {
- XmlPersistenceUnit xmlPersistenceUnit = getXmlPersistenceUnit();
- PersistenceUnit persistenceUnit = getPersistenceUnit();
-
- // add two properties and test that there are two existing in xml and context
- XmlProperties xmlProperties = PersistenceFactory.eINSTANCE.createXmlProperties();
- xmlPersistenceUnit.setProperties(xmlProperties);
- XmlProperty xmlProperty = PersistenceFactory.eINSTANCE.createXmlProperty();
- xmlProperty.setName("foo");
- xmlProperty.setValue("bar");
- xmlProperties.getProperties().add(xmlProperty);
- xmlProperty = PersistenceFactory.eINSTANCE.createXmlProperty();
- xmlProperty.setName("FOO");
- xmlProperty.setValue("BAR");
- xmlProperties.getProperties().add(xmlProperty);
-
- assertEquals(2, xmlPersistenceUnit.getProperties().getProperties().size());
- assertEquals(2, persistenceUnit.propertiesSize());
-
- // remove property from xml, test that it's removed from context
- xmlProperty = xmlProperties.getProperties().get(0);
- xmlProperties.getProperties().remove(xmlProperty);
-
- assertEquals(1, persistenceUnit.propertiesSize());
-
- // remove another one ...
- xmlProperty = xmlProperties.getProperties().get(0);
- xmlProperties.getProperties().remove(xmlProperty);
-
- assertEquals(0, persistenceUnit.propertiesSize());
- }
-
- public void testModifyProperties1() {
- XmlPersistenceUnit xmlPersistenceUnit = getXmlPersistenceUnit();
- PersistenceUnit persistenceUnit = getPersistenceUnit();
-
- // test there are none initially
- assertNull(xmlPersistenceUnit.getProperties());
- assertEquals(0, persistenceUnit.propertiesSize());
-
- // add property, test that it's added to resource
- persistenceUnit.addProperty().setName("foo");
-
- assertNotNull(xmlPersistenceUnit.getProperties());
- assertEquals(1, xmlPersistenceUnit.getProperties().getProperties().size());
- assertEquals("foo", xmlPersistenceUnit.getProperties().getProperties().get(0).getName());
-
- // add another ...
- persistenceUnit.addProperty().setName("bar");
-
- assertEquals(2, xmlPersistenceUnit.getProperties().getProperties().size());
- assertEquals("foo", xmlPersistenceUnit.getProperties().getProperties().get(0).getName());
- assertEquals("bar", xmlPersistenceUnit.getProperties().getProperties().get(1).getName());
-
- // add another testing order
- persistenceUnit.addProperty(0).setName("baz");
-
- assertEquals(3, xmlPersistenceUnit.getProperties().getProperties().size());
- assertEquals("baz", xmlPersistenceUnit.getProperties().getProperties().get(0).getName());
- assertEquals("foo", xmlPersistenceUnit.getProperties().getProperties().get(1).getName());
- assertEquals("bar", xmlPersistenceUnit.getProperties().getProperties().get(2).getName());
- }
-
- public void testModifyProperties2() {
- XmlPersistenceUnit xmlPersistenceUnit = getXmlPersistenceUnit();
- PersistenceUnit persistenceUnit = getPersistenceUnit();
-
- // add two properties and test that there are two existing in xml and context
- XmlProperties xmlProperties = PersistenceFactory.eINSTANCE.createXmlProperties();
- xmlPersistenceUnit.setProperties(xmlProperties);
- XmlProperty xmlProperty = PersistenceFactory.eINSTANCE.createXmlProperty();
- xmlProperty.setName("foo");
- xmlProperty.setValue("bar");
- xmlProperties.getProperties().add(xmlProperty);
- xmlProperty = PersistenceFactory.eINSTANCE.createXmlProperty();
- xmlProperty.setName("FOO");
- xmlProperty.setValue("BAR");
- xmlProperties.getProperties().add(xmlProperty);
-
- assertEquals(2, xmlPersistenceUnit.getProperties().getProperties().size());
- assertEquals(2, persistenceUnit.propertiesSize());
-
- // remove property from context, test that it's removed from resource
- persistenceUnit.removeProperty("foo");
-
- assertEquals(1, xmlPersistenceUnit.getProperties().getProperties().size());
-
- // remove another one. test that properties object is nulled
- persistenceUnit.removeProperty("FOO", "BAR");
-
- assertNull(xmlPersistenceUnit.getProperties());
- }
-
- public void testModifyProperties3() {
- XmlPersistenceUnit xmlPersistenceUnit = getXmlPersistenceUnit();
- PersistenceUnit persistenceUnit = getPersistenceUnit();
-
- // add two properties and test that there are two existing in xml and context
- persistenceUnit.setProperty("foo", "bar", false);
- persistenceUnit.setProperty("FOO", "BAR", false);
-
- assertEquals(2, xmlPersistenceUnit.getProperties().getProperties().size());
- assertEquals(2, persistenceUnit.propertiesSize());
-
- // remove property from context, test that it's removed from resource
- persistenceUnit.removeProperty("foo", "bar");
-
- assertEquals(1, xmlPersistenceUnit.getProperties().getProperties().size());
-
- // remove another one, test that properties object is nulled
- persistenceUnit.removeProperty("FOO");
-
- assertNull(xmlPersistenceUnit.getProperties());
- }
-
- public void testModifyProperties4() {
- XmlPersistenceUnit xmlPersistenceUnit = getXmlPersistenceUnit();
- PersistenceUnit persistenceUnit = getPersistenceUnit();
-
- // add two properties and test that there are two existing in xml and context
- persistenceUnit.setProperty("foo", "bar", false);
- persistenceUnit.setProperty("FOO", "BAR", false);
-
- assertEquals(2, xmlPersistenceUnit.getProperties().getProperties().size());
- assertEquals(2, persistenceUnit.propertiesSize());
-
- // modify a property, test its value
- persistenceUnit.setProperty("foo", "", false);
- assertEquals("", persistenceUnit.getProperty("foo").getValue());
-
- persistenceUnit.setProperty("foo", "BAR", false);
- assertEquals("BAR", persistenceUnit.getProperty("foo").getValue());
-
- // remove property from context, test that it's removed from resource
- persistenceUnit.removeProperty("FOO");
- assertNull(persistenceUnit.getProperty("FOO"));
- assertEquals(1, xmlPersistenceUnit.getProperties().getProperties().size());
-
- // remove by setting value to null, test that properties object is nulled
- persistenceUnit.setProperty("notExist", null, false);
- assertNull(persistenceUnit.getProperty("notExist"));
-
- persistenceUnit.setProperty("foo", null, false);
- assertNull(persistenceUnit.getProperty("foo"));
- assertNull(xmlPersistenceUnit.getProperties());
- }
-
- public void testModifyProperties5() {
- XmlPersistenceUnit xmlPersistenceUnit = getXmlPersistenceUnit();
- PersistenceUnit persistenceUnit = getPersistenceUnit();
-
- // testing duplicate keys, add four properties and test that there are four existing in xml and context
- persistenceUnit.setProperty("FOO", "BAR", false);
- persistenceUnit.setProperty("foo", "bar 3", true);
- persistenceUnit.setProperty("foo", "bar 2", true);
- persistenceUnit.setProperty("foo", "bar 1", true);
-
- assertEquals(4, xmlPersistenceUnit.getProperties().getProperties().size());
- assertEquals(4, persistenceUnit.propertiesSize());
-
- // remove a property, test that there are four existing in xml and context
- persistenceUnit.removeProperty("foo", "bar 1");
- assertEquals(3, xmlPersistenceUnit.getProperties().getProperties().size());
- assertEquals(3, persistenceUnit.propertiesSize());
- }
-
- public void testAccessProperty() {
- PersistenceUnit persistenceUnit = getPersistenceUnit();
-
- // add two properties and try to access it.
- persistenceUnit.setProperty("foo", "bar", false);
- persistenceUnit.setProperty("FOO", "BAR", false);
-
- PersistenceUnit.Property property = persistenceUnit.getProperty("foo");
- assertNotNull(property);
- assertEquals("bar", property.getValue());
- assertNotNull(persistenceUnit.getProperty("FOO"));
- assertEquals("BAR", persistenceUnit.getProperty("FOO").getValue());
- assertNull(persistenceUnit.getProperty("notExist"));
- }
-
- private PersistenceUnit.Property persistenceUnitFirstProperty() {
- return getPersistenceUnit().properties().next();
- }
-
- public void testUpdatePropertyName() {
- XmlPersistenceUnit xmlPersistenceUnit = getXmlPersistenceUnit();
-
- // add property for testing
- XmlProperties xmlProperties = PersistenceFactory.eINSTANCE.createXmlProperties();
- xmlPersistenceUnit.setProperties(xmlProperties);
- XmlProperty xmlProperty = PersistenceFactory.eINSTANCE.createXmlProperty();
- xmlProperties.getProperties().add(xmlProperty);
-
- // test that names are initially equal
- assertEquals(xmlProperty.getName(), persistenceUnitFirstProperty().getName());
-
- // set name to different name, test equality
- xmlProperty.setName("newName");
-
- assertEquals(xmlProperty.getName(), persistenceUnitFirstProperty().getName());
-
- // set name to empty string, test equality
- xmlProperty.setName("");
-
- assertEquals(xmlProperty.getName(), persistenceUnitFirstProperty().getName());
-
- // set name back to non-null, test equality
- xmlProperty.setName("newName");
-
- assertEquals(xmlProperty.getName(), persistenceUnitFirstProperty().getName());
- }
-
- public void testUpdatePropertyValue() {
- XmlPersistenceUnit xmlPersistenceUnit = getXmlPersistenceUnit();
-
- // add property for testing
- XmlProperties xmlProperties = PersistenceFactory.eINSTANCE.createXmlProperties();
- xmlPersistenceUnit.setProperties(xmlProperties);
- XmlProperty xmlProperty = PersistenceFactory.eINSTANCE.createXmlProperty();
- xmlProperties.getProperties().add(xmlProperty);
-
- // test that values are initially equal
- assertEquals(xmlProperty.getValue(), persistenceUnitFirstProperty().getValue());
-
- // set value to different value, test equality
- xmlProperty.setValue("newValue");
-
- assertEquals(xmlProperty.getValue(), persistenceUnitFirstProperty().getValue());
-
- // set value to empty string, test equality
- xmlProperty.setValue("");
-
- assertEquals(xmlProperty.getValue(), persistenceUnitFirstProperty().getValue());
-
- // set value to null, test equality
- xmlProperty.setValue(null);
-
- assertEquals(xmlProperty.getValue(), persistenceUnitFirstProperty().getValue());
-
- // set value back to non-null, test equality
- xmlProperty.setValue("newValue");
-
- assertEquals(xmlProperty.getValue(), persistenceUnitFirstProperty().getValue());
- }
-
- public void testGetDefaultAccess() throws Exception {
- addXmlMappingFileRef(JptCorePlugin.DEFAULT_ORM_XML_FILE_PATH);
- createOrm2XmlFile();
- PersistenceUnit persistenceUnit = getPersistenceUnit();
- ListIterator<MappingFileRef> mappingFileRefs = getPersistenceUnit().mappingFileRefs();
- OrmXml ormMappingFile = (OrmXml) mappingFileRefs.next().getMappingFile();
- OrmXml orm2MappingFile = (OrmXml) mappingFileRefs.next().getMappingFile();
-
- assertEquals(null, persistenceUnit.getDefaultAccess());
-
- ormMappingFile.getEntityMappings().getPersistenceUnitMetadata().getPersistenceUnitDefaults().setAccess(AccessType.PROPERTY);
- assertEquals(AccessType.PROPERTY, persistenceUnit.getDefaultAccess());
-
- ormMappingFile.getEntityMappings().getPersistenceUnitMetadata().getPersistenceUnitDefaults().setAccess(AccessType.FIELD);
- assertEquals(AccessType.FIELD, persistenceUnit.getDefaultAccess());
-
- ormMappingFile.getEntityMappings().getPersistenceUnitMetadata().getPersistenceUnitDefaults().setAccess(null);
- assertFalse(ormMappingFile.getEntityMappings().getPersistenceUnitMetadata().getPersistenceUnitDefaults().resourceExists());
- assertEquals(null, persistenceUnit.getDefaultAccess());
-
- orm2MappingFile.getEntityMappings().getPersistenceUnitMetadata().getPersistenceUnitDefaults().setAccess(AccessType.FIELD);
- assertEquals(AccessType.FIELD, persistenceUnit.getDefaultAccess());
- }
-
- public void testGetDefaultSchema() throws Exception {
- addXmlMappingFileRef(JptCorePlugin.DEFAULT_ORM_XML_FILE_PATH);
- createOrm2XmlFile();
- PersistenceUnit persistenceUnit = getPersistenceUnit();
- ListIterator<MappingFileRef> mappingFileRefs = getPersistenceUnit().mappingFileRefs();
- OrmXml ormMappingFile = (OrmXml) mappingFileRefs.next().getMappingFile();
- OrmXml orm2MappingFile = (OrmXml) mappingFileRefs.next().getMappingFile();
-
- assertEquals(null, persistenceUnit.getDefaultSchema());
-
- ormMappingFile.getEntityMappings().getPersistenceUnitMetadata().getPersistenceUnitDefaults().setSpecifiedSchema("FOO");
- assertEquals("FOO", persistenceUnit.getDefaultSchema());
-
- ormMappingFile.getEntityMappings().getPersistenceUnitMetadata().getPersistenceUnitDefaults().setSpecifiedSchema(null);
- assertFalse(ormMappingFile.getEntityMappings().getPersistenceUnitMetadata().getPersistenceUnitDefaults().resourceExists());
- assertEquals(null, persistenceUnit.getDefaultSchema());
-
- orm2MappingFile.getEntityMappings().getPersistenceUnitMetadata().getPersistenceUnitDefaults().setSpecifiedSchema("BAR");
- assertEquals("BAR", persistenceUnit.getDefaultSchema());
- }
-
- public void testGetDefaultCatalog() throws Exception {
- addXmlMappingFileRef(JptCorePlugin.DEFAULT_ORM_XML_FILE_PATH);
- createOrm2XmlFile();
- PersistenceUnit persistenceUnit = getPersistenceUnit();
- ListIterator<MappingFileRef> mappingFileRefs = getPersistenceUnit().mappingFileRefs();
- OrmXml ormMappingFile = (OrmXml) mappingFileRefs.next().getMappingFile();
- OrmXml orm2MappingFile = (OrmXml) mappingFileRefs.next().getMappingFile();
-
- assertEquals(null, persistenceUnit.getDefaultCatalog());
-
- ormMappingFile.getEntityMappings().getPersistenceUnitMetadata().getPersistenceUnitDefaults().setSpecifiedCatalog("FOO");
- assertEquals("FOO", persistenceUnit.getDefaultCatalog());
-
- ormMappingFile.getEntityMappings().getPersistenceUnitMetadata().getPersistenceUnitDefaults().setSpecifiedCatalog(null);
- assertFalse(ormMappingFile.getEntityMappings().getPersistenceUnitMetadata().getPersistenceUnitDefaults().resourceExists());
- assertEquals(null, persistenceUnit.getDefaultCatalog());
-
- orm2MappingFile.getEntityMappings().getPersistenceUnitMetadata().getPersistenceUnitDefaults().setSpecifiedCatalog("BAR");
- assertEquals("BAR", persistenceUnit.getDefaultCatalog());
- }
-
- protected void createOrm2XmlFile() throws Exception {
- OrmXmlResourceProvider resourceProvider =
- OrmXmlResourceProvider.getXmlResourceProvider(getJavaProject().getProject(), "META-INF/orm2.xml");
- resourceProvider.createFileAndResource();
-
-
- addXmlMappingFileRef("META-INF/orm2.xml");
- getPersistenceXmlResource().save(null);
- }
-
- private ICompilationUnit createTestEntity() 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").append(CR);
- }
- });
- }
-
- private ICompilationUnit createTestOtherTypeEntity() throws Exception {
- return this.createTestType(PACKAGE_NAME, OTHER_TYPE_NAME + ".java", OTHER_TYPE_NAME, new DefaultAnnotationWriter() {
- @Override
- public Iterator<String> imports() {
- return new ArrayIterator<String>(JPA.ENTITY);
- }
- @Override
- public void appendTypeAnnotationTo(StringBuilder sb) {
- sb.append("@Entity");
- }
-
- });
- }
-
- private ICompilationUnit createTestEntityWithPersistentInnerClass() 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").append(CR);
- }
-
- @Override
- public void appendMemberTypeTo(StringBuilder sb) {
- sb.append("@Entity").append(CR);
- sb.append(" public static class " + INNER_CLASS_NAME + " {}").append(CR);
- }
- });
- }
-
- public void testPersistentType() throws Exception {
- getJpaProject().setDiscoversAnnotatedClasses(false);
- PersistenceUnit persistenceUnit = getPersistenceUnit();
- createTestEntity();
-
- //persistentType not listed in persistence.xml and discoverAnnotatedClasses is false
- //still find the persistentType because of changes for bug 190317
- assertFalse(getJpaProject().discoversAnnotatedClasses());
- assertNotNull(persistenceUnit.getPersistentType(FULLY_QUALIFIED_TYPE_NAME));
-
- //test persistentType not listed in persistence.xml, discover annotated classes set to true
- getJpaProject().setDiscoversAnnotatedClasses(true);
- assertNotNull(persistenceUnit.getPersistentType(FULLY_QUALIFIED_TYPE_NAME));
-
- //test persistentType list as class in persistence.xml
- getJpaProject().setDiscoversAnnotatedClasses(false);
- XmlJavaClassRef classRef = PersistenceFactory.eINSTANCE.createXmlJavaClassRef();
- classRef.setJavaClass(FULLY_QUALIFIED_TYPE_NAME);
- getXmlPersistenceUnit().getClasses().add(classRef);
- assertNotNull(persistenceUnit.getPersistentType(FULLY_QUALIFIED_TYPE_NAME));
-
-
- //test persistentType from orm.xml file that is specified in the persistence.xml
- addXmlMappingFileRef(JptCorePlugin.DEFAULT_ORM_XML_FILE_PATH);
- OrmPersistentType ormPersistentType = getEntityMappings().addPersistentType(MappingKeys.ENTITY_TYPE_MAPPING_KEY, "model.Foo");
- assertNotNull(persistenceUnit.getPersistentType("model.Foo"));
- assertEquals(ormPersistentType, persistenceUnit.getPersistentType("model.Foo"));
-
- //test persistentType from orm.xml file that is implied(not specified) in the persistence.xml
- getXmlPersistenceUnit().getMappingFiles().remove(0);
- assertNotNull(persistenceUnit.getPersistentType("model.Foo"));
- }
-
-//TODO
-// String getDefaultSchema();
-// String getDefaultCatalog();
-// AccessType getDefaultAccess();
-// boolean getDefaultCascadePersist();
-
-}
diff --git a/jpa/tests/org.eclipse.jpt.core.tests/src/org/eclipse/jpt/core/tests/internal/context/persistence/PersistenceXmlTests.java b/jpa/tests/org.eclipse.jpt.core.tests/src/org/eclipse/jpt/core/tests/internal/context/persistence/PersistenceXmlTests.java
deleted file mode 100644
index 999d11cf34..0000000000
--- a/jpa/tests/org.eclipse.jpt.core.tests/src/org/eclipse/jpt/core/tests/internal/context/persistence/PersistenceXmlTests.java
+++ /dev/null
@@ -1,98 +0,0 @@
-/*******************************************************************************
- * Copyright (c) 2007, 2009 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.
- *
- * Contributors:
- * Oracle - initial API and implementation
- ******************************************************************************/
-package org.eclipse.jpt.core.tests.internal.context.persistence;
-
-import org.eclipse.jpt.core.context.persistence.PersistenceXml;
-import org.eclipse.jpt.core.resource.persistence.PersistenceFactory;
-import org.eclipse.jpt.core.resource.persistence.XmlPersistence;
-import org.eclipse.jpt.core.resource.xml.JpaXmlResource;
-import org.eclipse.jpt.core.tests.internal.context.ContextModelTestCase;
-
-public class PersistenceXmlTests extends ContextModelTestCase
-{
- public PersistenceXmlTests(String name) {
- super(name);
- }
-
- protected PersistenceXml getPersistenceXml() {
- return getRootContextNode().getPersistenceXml();
- }
-
- public void testUpdateAddPersistence() throws Exception {
- assertEquals(2, getJpaProject().jpaFilesSize());
- JpaXmlResource prm = getPersistenceXmlResource();
- prm.getContents().clear();
- prm.save(null);
-
- //the ContentType of the persistence.xml file is no longer persistence, so the jpa file is removed
- assertNull(getPersistenceXml());
- assertEquals(1, getJpaProject().jpaFilesSize()); //should only be the orm.xml file
-
- XmlPersistence xmlPersistence = PersistenceFactory.eINSTANCE.createXmlPersistence();
- xmlPersistence.setVersion("1.0");
- prm.getContents().add(xmlPersistence);
- prm.save(null);
-
- assertNotNull(getPersistenceXml().getPersistence());
- assertEquals(2, getJpaProject().jpaFilesSize());
- }
-
- public void testModifyAddPersistence() {
- JpaXmlResource prm = getPersistenceXmlResource();
- prm.getContents().remove(getXmlPersistence());
- assertNull(getXmlPersistence());
-
- PersistenceXml persistenceXml = getPersistenceXml();
-
- persistenceXml.addPersistence();
-
- assertNotNull(persistenceXml.getPersistence());
-
- boolean exceptionThrown = false;
- try {
- persistenceXml.addPersistence();
- }
- catch (IllegalStateException ise) {
- exceptionThrown = true;
- }
-
- assertTrue(exceptionThrown);
- }
-
- public void testUpdateRemovePersistence() throws Exception {
- JpaXmlResource prm = getPersistenceXmlResource();
-
- assertNotNull(getPersistenceXml().getPersistence());
-
- prm.getContents().clear();
-
- assertNull(getPersistenceXml().getPersistence());
- }
-
- public void testModifyRemovePersistence() {
- PersistenceXml persistenceXml = getPersistenceXml();
-
- assertNotNull(persistenceXml.getPersistence());
-
- persistenceXml.removePersistence();
-
- assertNull(persistenceXml.getPersistence());
-
- boolean exceptionThrown = false;
- try {
- persistenceXml.removePersistence();
- }
- catch (IllegalStateException ise) {
- exceptionThrown = true;
- }
-
- assertTrue(exceptionThrown);
- }
-}
diff --git a/jpa/tests/org.eclipse.jpt.core.tests/src/org/eclipse/jpt/core/tests/internal/context/persistence/RootContextNodeTests.java b/jpa/tests/org.eclipse.jpt.core.tests/src/org/eclipse/jpt/core/tests/internal/context/persistence/RootContextNodeTests.java
deleted file mode 100644
index 72fb62b06b..0000000000
--- a/jpa/tests/org.eclipse.jpt.core.tests/src/org/eclipse/jpt/core/tests/internal/context/persistence/RootContextNodeTests.java
+++ /dev/null
@@ -1,50 +0,0 @@
-/*******************************************************************************
- * Copyright (c) 2007, 2009 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.
- *
- * Contributors:
- * Oracle - initial API and implementation
- ******************************************************************************/
-package org.eclipse.jpt.core.tests.internal.context.persistence;
-
-import org.eclipse.jpt.core.context.JpaRootContextNode;
-import org.eclipse.jpt.core.resource.persistence.PersistenceFactory;
-import org.eclipse.jpt.core.resource.persistence.XmlPersistence;
-import org.eclipse.jpt.core.resource.xml.JpaXmlResource;
-import org.eclipse.jpt.core.tests.internal.context.ContextModelTestCase;
-
-public class RootContextNodeTests extends ContextModelTestCase
-{
- public RootContextNodeTests(String name) {
- super(name);
- }
-
- public void testUpdateAddPersistenceXml() throws Exception {
- JpaXmlResource pr = getPersistenceXmlResource();
- deleteResource(pr);
-
- assertFalse(pr.fileExists());
-
- JpaRootContextNode baseJpaContent = getJavaProject().getJpaProject().getRootContextNode();
- assertNull(baseJpaContent.getPersistenceXml());
-
- XmlPersistence xmlPersistence = PersistenceFactory.eINSTANCE.createXmlPersistence();
- xmlPersistence.setVersion("1.0");
- pr.getContents().add(xmlPersistence);
- pr.save(null);
- assertNotNull(baseJpaContent.getPersistenceXml());
- }
-
- public void testUpdateRemovePersistenceXml() throws Exception {
- JpaXmlResource pr = getPersistenceXmlResource();
- JpaRootContextNode baseJpaContent = getJavaProject().getJpaProject().getRootContextNode();
-
- assertNotNull(baseJpaContent.getPersistenceXml());
-
- deleteResource(pr);
-
- assertNull(baseJpaContent.getPersistenceXml());
- }
-}
diff --git a/jpa/tests/org.eclipse.jpt.core.tests/src/org/eclipse/jpt/core/tests/internal/model/JpaModelTests.java b/jpa/tests/org.eclipse.jpt.core.tests/src/org/eclipse/jpt/core/tests/internal/model/JpaModelTests.java
deleted file mode 100644
index d634056999..0000000000
--- a/jpa/tests/org.eclipse.jpt.core.tests/src/org/eclipse/jpt/core/tests/internal/model/JpaModelTests.java
+++ /dev/null
@@ -1,227 +0,0 @@
-/*******************************************************************************
- * Copyright (c) 2006, 2008 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.
- *
- * Contributors:
- * Oracle - initial API and implementation
- ******************************************************************************/
-package org.eclipse.jpt.core.tests.internal.model;
-
-import java.io.BufferedInputStream;
-import java.io.ByteArrayInputStream;
-import java.io.InputStream;
-import junit.framework.TestCase;
-import org.eclipse.core.resources.IFile;
-import org.eclipse.core.resources.IProject;
-import org.eclipse.core.resources.ResourcesPlugin;
-import org.eclipse.core.runtime.Path;
-import org.eclipse.jpt.core.JpaProject;
-import org.eclipse.jpt.core.JptCorePlugin;
-import org.eclipse.jpt.core.internal.GenericJpaModel;
-import org.eclipse.jpt.core.internal.JpaModelManager;
-import org.eclipse.jpt.core.tests.internal.projects.TestFacetedProject;
-import org.eclipse.jpt.core.tests.internal.projects.TestJavaProject;
-import org.eclipse.jpt.core.tests.internal.projects.TestPlatformProject;
-import org.eclipse.jpt.utility.internal.ClassTools;
-
-@SuppressWarnings("nls")
-public class JpaModelTests extends TestCase {
-
- /** carriage return */
- public static final String CR = System.getProperty("line.separator");
-
- protected TestFacetedProject testProject;
- public JpaModelTests(String name) {
- super(name);
- }
-
- @Override
- protected void setUp() throws Exception {
- super.setUp();
- if (this.debug()) {
- this.printName();
- }
- this.testProject = this.buildTestProject();
- }
-
- private boolean debug() {
- Boolean debug = (Boolean) ClassTools.staticFieldValue(JpaModelManager.class, "DEBUG");
- return debug.booleanValue();
- }
-
- private void printName() {
- String name = this.getName();
- System.out.println();
- System.out.println();
- this.printNameBorder(name);
- System.out.println(name);
- this.printNameBorder(name);
- }
-
- private void printNameBorder(String name) {
- for (int i = name.length(); i-- > 0; ) {
- System.out.print('=');
- }
- System.out.println();
- }
-
- @Override
- protected void tearDown() throws Exception {
- this.testProject.getProject().delete(true, true, null);
- this.testProject = null;
- super.tearDown();
- }
-
- /**
- * Builds a project with the java and utility facets installed, and with
- * pre-existing entities added.
- */
- private TestFacetedProject buildTestProject() throws Exception {
- TestJavaProject testProject = TestJavaProject.buildJavaProject(ClassTools.shortClassNameForObject(this), true);
- testProject.installFacet("jst.utility", "1.0");
- testProject.createCompilationUnit("test.pkg", "TestEntity.java", "@Entity public class TestEntity {}");
- testProject.createCompilationUnit("test.pkg", "TestEntity2.java", "@Entity public class TestEntity2 {}");
- return testProject;
- }
-
- private IFile getFile(TestPlatformProject p, String path) {
- return p.getProject().getFile(new Path(path));
- }
-
- public void testJpaModel() {
- assertNotNull(JptCorePlugin.getJpaModel());
- }
-
- public void testProjectCloseReopen() throws Exception {
- this.testProject.installFacet("jpt.jpa", "1.0");
-
- this.testProject.getProject().close(null);
- assertFalse(this.testProject.getProject().isOpen());
- JpaProject jpaProject = JptCorePlugin.getJpaProject(this.testProject.getProject());
- assertNull(jpaProject);
-
- this.testProject.getProject().open(null);
- assertTrue(this.testProject.getProject().isOpen());
- jpaProject = JptCorePlugin.getJpaProject(this.testProject.getProject());
- assertNotNull(jpaProject);
- assertEquals(4, jpaProject.jpaFilesSize());
- assertNotNull(jpaProject.getJpaFile(this.getFile(this.testProject, "src/test/pkg/TestEntity.java")));
- assertNotNull(jpaProject.getJpaFile(this.getFile(this.testProject, "src/test/pkg/TestEntity2.java")));
-
- assertNotNull(jpaProject.getJpaFile(this.getFile(this.testProject, "src/META-INF/persistence.xml")));
- assertNotNull(jpaProject.getJpaFile(this.getFile(this.testProject, "src/META-INF/orm.xml")));
- }
-
- public void testProjectDeleteReimport() throws Exception {
- this.testProject.installFacet("jpt.jpa", "1.0");
- JpaProject jpaProject = JptCorePlugin.getJpaProject(this.testProject.getProject());
- assertNotNull(jpaProject);
- assertEquals(1, JptCorePlugin.getJpaModel().jpaProjectsSize());
-
- this.testProject.getProject().delete(false, true, null);
- jpaProject = JptCorePlugin.getJpaProject(this.testProject.getProject());
- assertNull(jpaProject);
- assertEquals(0, JptCorePlugin.getJpaModel().jpaProjectsSize());
- assertEquals(0, ResourcesPlugin.getWorkspace().getRoot().getProjects().length);
-
- IProject project = ResourcesPlugin.getWorkspace().getRoot().getProject(this.testProject.getProject().getName());
- project.create(null);
- assertEquals(1, ResourcesPlugin.getWorkspace().getRoot().getProjects().length);
- project.open(null);
-
- assertTrue(project.isOpen());
- assertTrue(JptCorePlugin.projectHasJpaFacet(project));
- jpaProject = JptCorePlugin.getJpaProject(project);
- assertNotNull(jpaProject);
- assertEquals(4, jpaProject.jpaFilesSize());
- assertNotNull(jpaProject.getJpaFile(this.getFile(this.testProject, "src/test/pkg/TestEntity.java")));
- assertNotNull(jpaProject.getJpaFile(this.getFile(this.testProject, "src/test/pkg/TestEntity2.java")));
- assertNotNull(jpaProject.getJpaFile(this.getFile(this.testProject, "src/META-INF/persistence.xml")));
- assertNotNull(jpaProject.getJpaFile(this.getFile(this.testProject, "src/META-INF/orm.xml")));
- }
-
- public void testFacetInstallUninstall() throws Exception {
- assertNull(JptCorePlugin.getJpaProject(this.testProject.getProject()));
-
- this.testProject.installFacet("jpt.jpa", "1.0");
- assertEquals(1, JptCorePlugin.getJpaModel().jpaProjectsSize());
- JpaProject jpaProject = JptCorePlugin.getJpaProject(this.testProject.getProject());
- assertNotNull(jpaProject);
- assertEquals(4, jpaProject.jpaFilesSize());
- assertNotNull(jpaProject.getJpaFile(this.getFile(this.testProject, "src/test/pkg/TestEntity.java")));
- assertNotNull(jpaProject.getJpaFile(this.getFile(this.testProject, "src/test/pkg/TestEntity2.java")));
-
- assertNotNull(jpaProject.getJpaFile(this.getFile(this.testProject, "src/META-INF/persistence.xml")));
- assertNotNull(jpaProject.getJpaFile(this.getFile(this.testProject, "src/META-INF/orm.xml")));
-
- this.testProject.uninstallFacet("jpt.jpa", "1.0");
- assertEquals(0, JptCorePlugin.getJpaModel().jpaProjectsSize());
- jpaProject = JptCorePlugin.getJpaProject(this.testProject.getProject());
- assertNull(jpaProject);
- }
-
- //TODO - Commented out this test, since it was failing in the I-Build and we're not sure why.
- //See bug 221757
- public void testEditFacetSettingsFile() throws Exception {
- assertNull(JptCorePlugin.getJpaProject(this.testProject.getProject()));
-
- // add the JPA facet by modifying the facet settings file directly
- IFile facetSettingsFile = this.getFile(this.testProject, ".settings/org.eclipse.wst.common.project.facet.core.xml");
- InputStream inStream = new BufferedInputStream(facetSettingsFile.getContents());
- int fileSize = inStream.available();
- byte[] buf = new byte[fileSize];
- inStream.read(buf);
- inStream.close();
-
- String oldDocument = new String(buf);
- String oldString = "<installed facet=\"jst.utility\" version=\"1.0\"/>";
- String newString = oldString + CR + " " + "<installed facet=\"jpt.jpa\" version=\"1.0\"/>";
- String newDocument = oldDocument.replaceAll(oldString, newString);
-
- facetSettingsFile.setContents(new ByteArrayInputStream(newDocument.getBytes()), false, false, null);
-
- // TODO moved more stuff to the error console until we can figure out why it fails intermittently ~kfb
-// assertEquals(1, JptCorePlugin.getJpaModel().jpaProjectsSize());
-// JpaProject jpaProject = JptCorePlugin.getJpaProject(this.testProject.getProject());
-// assertNotNull(jpaProject);
-// // persistence.xml and orm.xml do not get created in this situation (?)
-// assertEquals(2, jpaProject.jpaFilesSize());
-// assertNotNull(jpaProject.getJpaFile(this.getFile(this.testProject, "src/test/pkg/TestEntity.java")));
-// assertNotNull(jpaProject.getJpaFile(this.getFile(this.testProject, "src/test/pkg/TestEntity2.java")));
-//// assertNotNull(jpaProject.getJpaFile(this.getFile(this.testProject, "src/META-INF/persistence.xml")));
-//// assertNotNull(jpaProject.getJpaFile(this.getFile(this.testProject, "src/META-INF/orm.xml")));
- int size = JptCorePlugin.getJpaModel().jpaProjectsSize();
- if (size != 1) {
- System.err.println("bogus size: " + size);
- System.err.println("bogus project: " + JptCorePlugin.getJpaProject(this.testProject.getProject()));
- }
-
- // now remove the JPA facet
- facetSettingsFile.setContents(new ByteArrayInputStream(oldDocument.getBytes()), false, false, null);
-// TODO moved this stuff to the error console until we can figure out why it fails intermittently ~bjv
-// assertEquals(0, JptCorePlugin.jpaModel().jpaProjectsSize());
-// jpaProject = JptCorePlugin.jpaProject(testProject.getProject());
-// assertNull(jpaProject);
- int newSize = JptCorePlugin.getJpaModel().jpaProjectsSize();
- if (newSize != 0) {
- System.err.println("bogus size: " + newSize);
- System.err.println("bogus project: " + JptCorePlugin.getJpaProject(this.testProject.getProject()));
- }
- }
-
- /**
- * make sure the DEBUG constants are 'false' before checking in the code
- */
- public void testDEBUG() {
- this.verifyDEBUG(JpaModelManager.class);
- this.verifyDEBUG(GenericJpaModel.class);
- }
-
- private void verifyDEBUG(Class<?> clazz) {
- assertFalse("Recompile with \"DEBUG = false\": " + clazz.getName(),
- ((Boolean) ClassTools.staticFieldValue(clazz, "DEBUG")).booleanValue());
- }
-
-}
diff --git a/jpa/tests/org.eclipse.jpt.core.tests/src/org/eclipse/jpt/core/tests/internal/model/JptCoreModelTests.java b/jpa/tests/org.eclipse.jpt.core.tests/src/org/eclipse/jpt/core/tests/internal/model/JptCoreModelTests.java
deleted file mode 100644
index 1a90dc6134..0000000000
--- a/jpa/tests/org.eclipse.jpt.core.tests/src/org/eclipse/jpt/core/tests/internal/model/JptCoreModelTests.java
+++ /dev/null
@@ -1,28 +0,0 @@
-/*******************************************************************************
- * Copyright (c) 2007 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.
- *
- * Contributors:
- * Oracle - initial API and implementation
- ******************************************************************************/
-package org.eclipse.jpt.core.tests.internal.model;
-
-import junit.framework.Test;
-import junit.framework.TestSuite;
-
-public class JptCoreModelTests {
-
- public static Test suite() {
- TestSuite suite = new TestSuite(JptCoreModelTests.class.getPackage().getName());
- suite.addTestSuite(JpaModelTests.class);
- return suite;
- }
-
- private JptCoreModelTests() {
- super();
- throw new UnsupportedOperationException();
- }
-
-}
diff --git a/jpa/tests/org.eclipse.jpt.core.tests/src/org/eclipse/jpt/core/tests/internal/platform/BaseJpaPlatformTests.java b/jpa/tests/org.eclipse.jpt.core.tests/src/org/eclipse/jpt/core/tests/internal/platform/BaseJpaPlatformTests.java
deleted file mode 100644
index b27caa31ae..0000000000
--- a/jpa/tests/org.eclipse.jpt.core.tests/src/org/eclipse/jpt/core/tests/internal/platform/BaseJpaPlatformTests.java
+++ /dev/null
@@ -1,76 +0,0 @@
-/*******************************************************************************
- * Copyright (c) 2008 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
- *
- * Contributors:
- * Oracle - initial API and implementation
- *******************************************************************************/
-package org.eclipse.jpt.core.tests.internal.platform;
-
-import junit.framework.TestCase;
-import org.eclipse.jpt.core.tests.internal.projects.TestJpaProject;
-
-public class BaseJpaPlatformTests extends TestCase
-{
- protected TestJpaProject jpaProject;
-
- protected static final String PROJECT_NAME = "PlatformTestProject";
- protected static final String PACKAGE_NAME = "platform.test";
- protected static final String PERSISTENCE_XML_LOCATION = "src/META-INF/persistence.xml";
- protected static final String ORM_XML_LOCATION = "src/META-INF/orm.xml";
-
-
- public BaseJpaPlatformTests(String name) {
- super(name);
- }
-
- @Override
- protected void setUp() throws Exception {
- super.setUp();
- this.jpaProject = this.buildJpaProject(PROJECT_NAME, false); // false = no auto-build
- }
-
- protected TestJpaProject buildJpaProject(String projectName, boolean autoBuild) throws Exception {
- return new TestJpaProject(projectName, autoBuild); // false = no auto-build
- }
-
- @Override
- protected void tearDown() throws Exception {
- this.jpaProject.getProject().delete(true, true, null);
- this.jpaProject = null;
- super.tearDown();
- }
-
-// public void testPersistentTypes() throws CoreException, IOException {
-// IFile persistenceXmlIFile = jpaProject.getProject().getFile(PERSISTENCE_XML_LOCATION);
-// IJpaFile persistenceXmlJpaFile = jpaProject.getJpaProject().getJpaFile(persistenceXmlIFile);
-// PersistenceXmlRootContentNode persistenceRoot = (PersistenceXmlRootContentNode) persistenceXmlJpaFile.getContent();
-// XmlPersistence persistence = persistenceRoot.getPersistence();
-//
-// IFile ormXmlIFile = jpaProject.getProject().getFile(ORM_XML_LOCATION);
-// IJpaFile ormXmlJpaFile = jpaProject.getJpaProject().getJpaFile(ormXmlIFile);
-// XmlRootContentNode ormRoot = (XmlRootContentNode) ormXmlJpaFile.getContent();
-// EntityMappingsInternal entityMappings = ormRoot.getEntityMappings();
-//
-// // add xml persistent type
-// XmlEntityInternal xmlEntity = OrmFactory.eINSTANCE.createXmlEntityInternal();
-// xmlEntity.setSpecifiedName("XmlEntity");
-// entityMappings.getTypeMappings().add(xmlEntity);
-// entityMappings.eResource().save(null);
-// assertEquals(1, CollectionTools.size(jpaProject.getJpaProject().getPlatform().persistentTypes(PROJECT_NAME)));
-//
-// // add java persistent type
-// jpaProject.createType(PACKAGE_NAME, "JavaEntity.java",
-// "@Entity public class JavaEntity {}"
-// );
-// XmlJavaClassRef javaClassRef = PersistenceFactory.eINSTANCE.createJavaClassRef();
-// javaClassRef.setJavaClass(PACKAGE_NAME + ".JavaEntity");
-// persistence.getPersistenceUnits().get(0).getClasses().add(javaClassRef);
-// persistence.eResource().save(null);
-//
-// assertEquals(2, CollectionTools.size(jpaProject.getJpaProject().getPlatform().persistentTypes(PROJECT_NAME)));
-// }
-}
diff --git a/jpa/tests/org.eclipse.jpt.core.tests/src/org/eclipse/jpt/core/tests/internal/platform/JpaPlatformExtensionTests.java b/jpa/tests/org.eclipse.jpt.core.tests/src/org/eclipse/jpt/core/tests/internal/platform/JpaPlatformExtensionTests.java
deleted file mode 100644
index d145f18f5d..0000000000
--- a/jpa/tests/org.eclipse.jpt.core.tests/src/org/eclipse/jpt/core/tests/internal/platform/JpaPlatformExtensionTests.java
+++ /dev/null
@@ -1,92 +0,0 @@
-/*******************************************************************************
- * Copyright (c) 2007, 2008 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.
- *
- * Contributors:
- * Oracle - initial API and implementation
- ******************************************************************************/
-package org.eclipse.jpt.core.tests.internal.platform;
-
-import org.eclipse.core.runtime.IExtension;
-import org.eclipse.core.runtime.IExtensionPoint;
-import org.eclipse.core.runtime.IExtensionRegistry;
-import org.eclipse.core.runtime.Platform;
-import org.eclipse.jpt.core.JptCorePlugin;
-import org.eclipse.jpt.core.internal.facet.JpaFacetDataModelProperties;
-import org.eclipse.jpt.core.internal.facet.JpaFacetDataModelProvider;
-import org.eclipse.jpt.core.internal.platform.JpaPlatformRegistry;
-import org.eclipse.jpt.core.tests.extension.resource.ExtensionTestPlugin;
-import org.eclipse.jpt.core.tests.extension.resource.TestJpaPlatformProvider;
-import org.eclipse.jpt.core.tests.internal.context.ContextModelTestCase;
-import org.eclipse.jpt.core.tests.internal.projects.TestJavaProject;
-import org.eclipse.jpt.core.tests.internal.projects.TestJpaProject;
-import org.eclipse.jpt.utility.internal.CollectionTools;
-import org.eclipse.wst.common.frameworks.datamodel.IDataModel;
-import org.eclipse.wst.common.project.facet.core.IActionConfigFactory;
-
-@SuppressWarnings("nls")
-public class JpaPlatformExtensionTests extends ContextModelTestCase
-{
- public static final String TEST_PLATFORM_ID = TestJpaPlatformProvider.ID;
- public static final String TEST_PLATFORM_LABEL = "Test Jpa Platform";
-
- protected TestJpaProject testProject;
-
- public JpaPlatformExtensionTests(String name) {
- super(name);
- }
-
- @Override
- protected void setUp() throws Exception {
- super.setUp();
- verifyExtensionTestProjectExists();
- }
-
- @Override
- protected TestJavaProject buildJavaProject(boolean autoBuild) throws Exception {
- return super.buildJpaProject(PROJECT_NAME, autoBuild, this.buildConfig());
- }
-
- protected IDataModel buildConfig() throws Exception {
- IActionConfigFactory configFactory = new JpaFacetDataModelProvider();
- IDataModel config = (IDataModel) configFactory.create();
- config.setProperty(JpaFacetDataModelProperties.PLATFORM_ID, TEST_PLATFORM_ID);
- return config;
- }
-
- public static void verifyExtensionTestProjectExists() {
- IExtensionRegistry registry = Platform.getExtensionRegistry();
- IExtensionPoint extensionPoint =
- registry.getExtensionPoint(JptCorePlugin.PLUGIN_ID, "jpaPlatform");
- IExtension[] extensions = extensionPoint.getExtensions();
- boolean extensionFound = false;
- for (IExtension extension : extensions) {
- if (extension.getContributor().getName().equals(ExtensionTestPlugin.PLUGIN_ID)) {
- extensionFound = true;
- }
- }
- if (!extensionFound) {
- throw new RuntimeException("Missing Extension " + TEST_PLATFORM_ID + ". The ExtensionTestProject plugin must be in your testing workspace.");
- }
- }
-
- @Override
- protected void tearDown() throws Exception {
- super.tearDown();
- }
-
- public void testAllJpaPlatformIds() {
- assertTrue(CollectionTools.size(JpaPlatformRegistry.instance().jpaPlatformIds()) >= 2);
- }
-
- public void testJpaPlatformLabel() {
- assertEquals(TEST_PLATFORM_LABEL, JpaPlatformRegistry.instance().getJpaPlatformLabel(TEST_PLATFORM_ID));
- }
-
- public void testJpaPlatform() {
- assertNotNull(JpaPlatformRegistry.instance().getJpaPlatform(this.testProject.getProject()));
- }
-
-}
diff --git a/jpa/tests/org.eclipse.jpt.core.tests/src/org/eclipse/jpt/core/tests/internal/platform/JpaPlatformTests.java b/jpa/tests/org.eclipse.jpt.core.tests/src/org/eclipse/jpt/core/tests/internal/platform/JpaPlatformTests.java
deleted file mode 100644
index 1bbd9abf41..0000000000
--- a/jpa/tests/org.eclipse.jpt.core.tests/src/org/eclipse/jpt/core/tests/internal/platform/JpaPlatformTests.java
+++ /dev/null
@@ -1,120 +0,0 @@
-/*******************************************************************************
- * Copyright (c) 2007, 2008 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.
- *
- * Contributors:
- * Oracle - initial API and implementation
- ******************************************************************************/
-package org.eclipse.jpt.core.tests.internal.platform;
-
-
-import java.util.Iterator;
-import org.eclipse.jdt.core.ICompilationUnit;
-import org.eclipse.jpt.core.JpaPlatform;
-import org.eclipse.jpt.core.MappingKeys;
-import org.eclipse.jpt.core.context.java.JavaAttributeMapping;
-import org.eclipse.jpt.core.context.java.JavaTypeMapping;
-import org.eclipse.jpt.core.internal.facet.JpaFacetDataModelProperties;
-import org.eclipse.jpt.core.internal.facet.JpaFacetDataModelProvider;
-import org.eclipse.jpt.core.resource.java.JPA;
-import org.eclipse.jpt.core.tests.extension.resource.ExtensionTestPlugin;
-import org.eclipse.jpt.core.tests.extension.resource.JavaTestAttributeMapping;
-import org.eclipse.jpt.core.tests.extension.resource.JavaTestAttributeMappingProvider;
-import org.eclipse.jpt.core.tests.extension.resource.JavaTestTypeMapping;
-import org.eclipse.jpt.core.tests.extension.resource.JavaTestTypeMappingProvider;
-import org.eclipse.jpt.core.tests.extension.resource.TestJavaBasicMapping;
-import org.eclipse.jpt.core.tests.extension.resource.TestJavaEntity;
-import org.eclipse.jpt.core.tests.extension.resource.TestJpaFactory;
-import org.eclipse.jpt.core.tests.extension.resource.TestJpaPlatformProvider;
-import org.eclipse.jpt.core.tests.internal.context.ContextModelTestCase;
-import org.eclipse.jpt.core.tests.internal.projects.TestJavaProject;
-import org.eclipse.jpt.core.tests.internal.projects.TestJpaProject;
-import org.eclipse.jpt.utility.internal.iterators.ArrayIterator;
-import org.eclipse.wst.common.frameworks.datamodel.IDataModel;
-import org.eclipse.wst.common.project.facet.core.IActionConfigFactory;
-
-public class JpaPlatformTests extends ContextModelTestCase
-{
- protected TestJpaProject testProject;
-
- protected static final String PROJECT_NAME = "ExtensionTestProject";
- protected static final String PACKAGE_NAME = "extension.test";
-
- public static final String TEST_PLUGIN_CLASS = ExtensionTestPlugin.class.getName();
- public static final String TEST_PLUGIN_ID = "org.eclipse.jpt.core.tests.extension.resource";
-
- public static final String TEST_PLATFORM_CLASS_NAME = TestJpaPlatformProvider.class.getName();
- public static final String TEST_PLATFORM_LABEL = "Test Jpa Platform";
- public static final String TEST_JPA_FACTORY = TestJpaFactory.class.getName();
- public static final String TEST_TYPE_MAPPING_PROVIDER_CLASS = JavaTestTypeMappingProvider.class.getName();
- public static final String TEST_ATTRIBUTE_MAPPING_PROVIDER_CLASS = JavaTestAttributeMappingProvider.class.getName();
-
- public JpaPlatformTests(String name) {
- super(name);
- }
-
- @Override
- protected void setUp() throws Exception {
- super.setUp();
- JpaPlatformExtensionTests.verifyExtensionTestProjectExists();
- }
-
- @Override
- protected TestJavaProject buildJavaProject(boolean autoBuild) throws Exception {
- return super.buildJpaProject(PROJECT_NAME, autoBuild, this.buildConfig());
- }
-
- protected IDataModel buildConfig() throws Exception {
- IActionConfigFactory configFactory = new JpaFacetDataModelProvider();
- IDataModel config = (IDataModel) configFactory.create();
- config.setProperty(JpaFacetDataModelProperties.PLATFORM_ID, TestJpaPlatformProvider.ID);
- return config;
- }
-
- private ICompilationUnit createTestEntity() 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").append(CR);
- }
- });
- }
-
-
- protected JpaPlatform jpaPlatform() {
- return this.getJpaProject().getJpaPlatform();
- }
-
- public void testJpaFactory() {
- assertTrue(jpaPlatform().getJpaFactory().getClass().getName().equals(TEST_JPA_FACTORY));
- }
-
- public void testBuildJavaTypeMappingFromMappingKey() throws Exception {
- createTestEntity();
- addXmlClassRef(FULLY_QUALIFIED_TYPE_NAME);
-
- JavaTypeMapping javaTypeMapping = getJpaProject().getJpaPlatform().buildJavaTypeMappingFromMappingKey(JavaTestTypeMapping.TEST_TYPE_MAPPING_KEY, getJavaPersistentType());
- assertTrue(javaTypeMapping instanceof JavaTestTypeMapping);
-
- javaTypeMapping = jpaPlatform().buildJavaTypeMappingFromMappingKey(MappingKeys.ENTITY_TYPE_MAPPING_KEY, getJavaPersistentType());
- assertTrue(javaTypeMapping instanceof TestJavaEntity);
- }
-
- public void testBuildJavaAttributeMappingFromMappingKey() throws Exception {
- createTestEntity();
- addXmlClassRef(FULLY_QUALIFIED_TYPE_NAME);
-
- JavaAttributeMapping javaAttributeMapping = getJpaProject().getJpaPlatform().buildJavaAttributeMappingFromMappingKey(JavaTestAttributeMapping.TEST_ATTRIBUTE_MAPPING_KEY, getJavaPersistentType().getAttributeNamed("name"));
- assertTrue(javaAttributeMapping instanceof JavaTestAttributeMapping);
-
- javaAttributeMapping = jpaPlatform().buildJavaAttributeMappingFromMappingKey(MappingKeys.BASIC_ATTRIBUTE_MAPPING_KEY, getJavaPersistentType().getAttributeNamed("name"));
- assertTrue(javaAttributeMapping instanceof TestJavaBasicMapping);
- }
-
-}
diff --git a/jpa/tests/org.eclipse.jpt.core.tests/src/org/eclipse/jpt/core/tests/internal/projects/TestFacetedProject.java b/jpa/tests/org.eclipse.jpt.core.tests/src/org/eclipse/jpt/core/tests/internal/projects/TestFacetedProject.java
deleted file mode 100644
index 22f66e3171..0000000000
--- a/jpa/tests/org.eclipse.jpt.core.tests/src/org/eclipse/jpt/core/tests/internal/projects/TestFacetedProject.java
+++ /dev/null
@@ -1,80 +0,0 @@
-/*******************************************************************************
- * Copyright (c) 2005, 2007 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.
- *
- * Contributors:
- * Oracle - initial API and implementation
- ******************************************************************************/
-package org.eclipse.jpt.core.tests.internal.projects;
-
-import org.eclipse.core.runtime.CoreException;
-import org.eclipse.wst.common.frameworks.datamodel.IDataModel;
-import org.eclipse.wst.common.project.facet.core.IFacetedProject;
-import org.eclipse.wst.common.project.facet.core.IProjectFacetVersion;
-import org.eclipse.wst.common.project.facet.core.ProjectFacetsManager;
-
-/**
- * This builds and holds a "faceted" project.
- * Support for installing facets.
- */
-public class TestFacetedProject extends TestPlatformProject {
- private final IFacetedProject facetedProject;
-
-
- // ********** builders *****************************
-
- public static TestFacetedProject buildFacetedProject(String baseProjectName, boolean autoBuild)
- throws CoreException {
- return new TestFacetedProject(baseProjectName, autoBuild);
- }
-
-
- // ********** constructors/initialization **********
-
- public TestFacetedProject(String projectName) throws CoreException {
- this(projectName, true);
- }
-
- public TestFacetedProject(String projectName, boolean autoBuild) throws CoreException {
- super(projectName, autoBuild);
- this.facetedProject = this.createFacetedProject();
- }
-
- private IFacetedProject createFacetedProject() throws CoreException {
- return ProjectFacetsManager.create(this.getProject(), true, null); // true = "convert if necessary"
- }
-
-
- // ********** public methods **********
-
- public IFacetedProject getFacetedProject() {
- return this.facetedProject;
- }
-
- public void installFacet(String facetName, String versionName) throws CoreException {
- this.installFacet(facetName, versionName, null);
- }
-
- public void uninstallFacet(String facetName, String versionName) throws CoreException {
- this.uninstallFacet(facetName, versionName, null);
- }
-
- /**
- * if 'config' is null, the JPA project will be built with the defaults
- * defined in JpaFacetDataModelProvider#getDefaultProperty(String)
- */
- public void installFacet(String facetName, String versionName, IDataModel config) throws CoreException {
- this.facetedProject.installProjectFacet(this.facetVersion(facetName, versionName), config, null);
- }
-
- public void uninstallFacet(String facetName, String versionName, IDataModel config) throws CoreException {
- this.facetedProject.uninstallProjectFacet(this.facetVersion(facetName, versionName), config, null);
- }
-
- private IProjectFacetVersion facetVersion(String facetName, String versionName) {
- return ProjectFacetsManager.getProjectFacet(facetName).getVersion(versionName);
- }
-
-}
diff --git a/jpa/tests/org.eclipse.jpt.core.tests/src/org/eclipse/jpt/core/tests/internal/projects/TestJavaProject.java b/jpa/tests/org.eclipse.jpt.core.tests/src/org/eclipse/jpt/core/tests/internal/projects/TestJavaProject.java
deleted file mode 100644
index dd6a29410c..0000000000
--- a/jpa/tests/org.eclipse.jpt.core.tests/src/org/eclipse/jpt/core/tests/internal/projects/TestJavaProject.java
+++ /dev/null
@@ -1,123 +0,0 @@
-/*******************************************************************************
- * Copyright (c) 2005, 2009 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.
- *
- * Contributors:
- * Oracle - initial API and implementation
- ******************************************************************************/
-package org.eclipse.jpt.core.tests.internal.projects;
-
-import org.eclipse.core.runtime.CoreException;
-import org.eclipse.core.runtime.Path;
-import org.eclipse.jdt.core.IClasspathEntry;
-import org.eclipse.jdt.core.ICompilationUnit;
-import org.eclipse.jdt.core.IJavaProject;
-import org.eclipse.jdt.core.IPackageFragment;
-import org.eclipse.jdt.core.IPackageFragmentRoot;
-import org.eclipse.jdt.core.JavaCore;
-import org.eclipse.jdt.core.JavaModelException;
-import org.eclipse.jpt.utility.internal.CollectionTools;
-
-/**
- * This builds and holds a "Java" project.
- * Support for adding packages and types.
- *
- * "Java" projects aren't required to be "faceted" projects, but for JPA
- * testing they are.
- */
-@SuppressWarnings("nls")
-public class TestJavaProject extends TestFacetedProject {
- private final IJavaProject javaProject;
- private final IPackageFragmentRoot sourceFolder;
-
-
- // ********** builders *****************************
-
- public static TestJavaProject buildJavaProject(String baseProjectName, boolean autoBuild)
- throws CoreException {
- return new TestJavaProject(baseProjectName, autoBuild);
- }
-
-
- // ********** constructors/initialization **********
-
- public TestJavaProject(String projectName) throws CoreException {
- this(projectName, false);
- }
-
- public TestJavaProject(String projectName, boolean autoBuild) throws CoreException {
- super(projectName, autoBuild);
- this.installFacet("jst.java", "5.0");
- this.javaProject = JavaCore.create(this.getProject());
- this.sourceFolder = this.javaProject.getPackageFragmentRoot(this.getProject().getFolder("src"));
- }
-
- public void addJar(String jarPath) throws JavaModelException {
- this.addClasspathEntry(JavaCore.newLibraryEntry(new Path(jarPath), null, null));
- }
-
- private void addClasspathEntry(IClasspathEntry entry) throws JavaModelException {
- this.javaProject.setRawClasspath(CollectionTools.add(this.javaProject.getRawClasspath(), entry), null);
- }
-
-
- // ********** public methods **********
-
- public IJavaProject getJavaProject() {
- return this.javaProject;
- }
-
- public IPackageFragment createPackage(String packageName) throws CoreException {
- return this.sourceFolder.createPackageFragment(packageName, false, null); // false = "no force"
- }
-
- /**
- * The source should NOT contain a package declaration;
- * it will be added here.
- */
- public ICompilationUnit createCompilationUnit(String packageName, String compilationUnitName, String source) throws CoreException {
- return this.createCompilationUnit(this.createPackage(packageName), compilationUnitName, new SimpleSourceWriter(source));
- }
-
- /**
- * The source should NOT contain a package declaration;
- * it will be added here.
- */
- public ICompilationUnit createCompilationUnit(String packageName, String compilationUnitName, SourceWriter sourceWriter) throws CoreException {
- return this.createCompilationUnit(this.createPackage(packageName), compilationUnitName, sourceWriter);
- }
-
- /**
- * The source should NOT contain a package declaration;
- * it will be added here.
- */
- public ICompilationUnit createCompilationUnit(IPackageFragment packageFragment, String compilationUnitName, SourceWriter sourceWriter) throws CoreException {
- StringBuilder sb = new StringBuilder(2000);
- sb.append("package ").append(packageFragment.getElementName()).append(";").append(CR);
- sb.append(CR);
- sourceWriter.appendSourceTo(sb);
- String source = sb.toString();
- return packageFragment.createCompilationUnit(compilationUnitName, source, false, null); // false = "no force"
- }
-
-
- // ********** member classes **********
-
- public interface SourceWriter {
- void appendSourceTo(StringBuilder sb);
- }
-
- public class SimpleSourceWriter implements SourceWriter {
- private final String source;
- public SimpleSourceWriter(String source) {
- super();
- this.source = source;
- }
- public void appendSourceTo(StringBuilder sb) {
- sb.append(source);
- }
- }
-
-}
diff --git a/jpa/tests/org.eclipse.jpt.core.tests/src/org/eclipse/jpt/core/tests/internal/projects/TestJpaProject.java b/jpa/tests/org.eclipse.jpt.core.tests/src/org/eclipse/jpt/core/tests/internal/projects/TestJpaProject.java
deleted file mode 100644
index bac417bee8..0000000000
--- a/jpa/tests/org.eclipse.jpt.core.tests/src/org/eclipse/jpt/core/tests/internal/projects/TestJpaProject.java
+++ /dev/null
@@ -1,92 +0,0 @@
-/*******************************************************************************
- * Copyright (c) 2005, 2009 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.
- *
- * Contributors:
- * Oracle - initial API and implementation
- ******************************************************************************/
-package org.eclipse.jpt.core.tests.internal.projects;
-
-import org.eclipse.core.runtime.CoreException;
-import org.eclipse.jpt.core.JpaProject;
-import org.eclipse.jpt.core.JptCorePlugin;
-import org.eclipse.jpt.core.internal.SynchronousJpaProjectUpdater;
-import org.eclipse.wst.common.componentcore.datamodel.properties.IFacetDataModelProperties;
-import org.eclipse.wst.common.frameworks.datamodel.IDataModel;
-
-/**
- * This builds and holds a "JPA" project.
- * Support for adding packages and types.
- *
- * The JPA project's settings (platform, database connection, etc.) can be
- * controlled by building a data model and passing it into the constructor.
- */
-@SuppressWarnings("nls")
-public class TestJpaProject extends TestJavaProject {
- private final JpaProject jpaProject;
-
- public static final String JPA_JAR_NAME_SYSTEM_PROPERTY = "org.eclipse.jpt.jpa.jar";
- public static final String ECLIPSELINK_JAR_NAME_SYSTEM_PROPERTY = "org.eclipse.jpt.eclipselink.jar";
-
-
- // ********** builders **********
-
- public static TestJpaProject buildJpaProject(String baseProjectName, boolean autoBuild, IDataModel jpaConfig)
- throws CoreException {
- return new TestJpaProject(baseProjectName, autoBuild, jpaConfig);
- }
-
- public static TestJpaProject buildJpaProject(String baseProjectName, boolean autoBuild)
- throws CoreException {
- return buildJpaProject(baseProjectName, autoBuild, null);
- }
-
- // ********** constructors/initialization **********
-
- public TestJpaProject(String projectName) throws CoreException {
- this(projectName, false);
- }
-
- public TestJpaProject(String projectName, boolean autoBuild) throws CoreException {
- this(projectName, autoBuild, null);
- }
-
- public TestJpaProject(String projectName, boolean autoBuild, IDataModel jpaConfig) throws CoreException {
- super(projectName, autoBuild);
- String jpaFacetVersion = "1.0";
- if (jpaConfig != null) {
- jpaFacetVersion = jpaConfig.getStringProperty(IFacetDataModelProperties.FACET_VERSION_STR);
- }
- this.installFacet("jst.utility", "1.0");
- this.installFacet("jpt.jpa", jpaFacetVersion, jpaConfig);
- this.addJar(jpaJarName());
- if (eclipseLinkJarName() != null) {
- this.addJar(eclipseLinkJarName());
- }
- this.jpaProject = JptCorePlugin.getJpaProject(this.getProject());
- this.jpaProject.setDiscoversAnnotatedClasses(true);
- this.jpaProject.setUpdater(new SynchronousJpaProjectUpdater(this.jpaProject));
- }
-
- public static String jpaJarName() {
- return getSystemProperty(JPA_JAR_NAME_SYSTEM_PROPERTY);
- }
-
- public static String eclipseLinkJarName() {
- return getSystemProperty(ECLIPSELINK_JAR_NAME_SYSTEM_PROPERTY);
- }
-
- private static String getSystemProperty(String propertyName) {
- return System.getProperty(propertyName);
- }
-
-
- // ********** public methods **********
-
- public JpaProject getJpaProject() {
- return this.jpaProject;
- }
-
-}
diff --git a/jpa/tests/org.eclipse.jpt.core.tests/src/org/eclipse/jpt/core/tests/internal/projects/TestPlatformProject.java b/jpa/tests/org.eclipse.jpt.core.tests/src/org/eclipse/jpt/core/tests/internal/projects/TestPlatformProject.java
deleted file mode 100644
index 20e9b0b8cc..0000000000
--- a/jpa/tests/org.eclipse.jpt.core.tests/src/org/eclipse/jpt/core/tests/internal/projects/TestPlatformProject.java
+++ /dev/null
@@ -1,78 +0,0 @@
-/*******************************************************************************
- * Copyright (c) 2005, 2008 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.
- *
- * Contributors:
- * Oracle - initial API and implementation
- ******************************************************************************/
-package org.eclipse.jpt.core.tests.internal.projects;
-
-import org.eclipse.core.resources.IProject;
-import org.eclipse.core.resources.IProjectDescription;
-import org.eclipse.core.resources.IWorkspaceDescription;
-import org.eclipse.core.resources.ResourcesPlugin;
-import org.eclipse.core.runtime.CoreException;
-import org.eclipse.jpt.utility.internal.CollectionTools;
-
-/**
- * This builds and holds a "general" Eclipse project.
- * Support for adding natures, folders, and files.
- */
-public class TestPlatformProject {
- private final IProject project;
-
- /** carriage return */
- public static final String CR = System.getProperty("line.separator");
-
-
- // ********** builders **********
-
- public static TestPlatformProject buildPlatformProject(String baseProjectName, boolean autoBuild)
- throws CoreException {
- return new TestPlatformProject(baseProjectName, autoBuild);
- }
-
-
- // ********** constructors/initialization **********
-
- public TestPlatformProject(String projectName, boolean autoBuild) throws CoreException {
- super();
- this.setAutoBuild(autoBuild); // workspace-wide setting
- this.project = this.buildPlatformProject(projectName);
- }
-
- private void setAutoBuild(boolean autoBuild) throws CoreException {
- IWorkspaceDescription description = ResourcesPlugin.getWorkspace().getDescription();
- description.setAutoBuilding(autoBuild);
- ResourcesPlugin.getWorkspace().setDescription(description);
- }
-
- private IProject buildPlatformProject(String projectName) throws CoreException {
- IProject p = ResourcesPlugin.getWorkspace().getRoot().getProject(projectName);
- p.create(null);
- p.open(null);
- return p;
- }
-
-
- // ********** public methods **********
-
- public IProject getProject() {
- return this.project;
- }
-
- public void addProjectNature(String natureID) throws CoreException {
- IProjectDescription description = this.project.getDescription();
- description.setNatureIds(CollectionTools.add(description.getNatureIds(), natureID));
- this.project.setDescription(description, null);
- }
-
- public void removeProjectNature(String natureID) throws CoreException {
- IProjectDescription description = this.project.getDescription();
- description.setNatureIds(CollectionTools.removeAllOccurrences(description.getNatureIds(), natureID));
- this.project.setDescription(description, null);
- }
-
-}
diff --git a/jpa/tests/org.eclipse.jpt.core.tests/src/org/eclipse/jpt/core/tests/internal/resource/JptCoreResourceModelTests.java b/jpa/tests/org.eclipse.jpt.core.tests/src/org/eclipse/jpt/core/tests/internal/resource/JptCoreResourceModelTests.java
deleted file mode 100644
index f02dac64d2..0000000000
--- a/jpa/tests/org.eclipse.jpt.core.tests/src/org/eclipse/jpt/core/tests/internal/resource/JptCoreResourceModelTests.java
+++ /dev/null
@@ -1,32 +0,0 @@
-/*******************************************************************************
- * Copyright (c) 2007, 2009 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
- *
- * Contributors:
- * Oracle - initial API and implementation
- *******************************************************************************/
-package org.eclipse.jpt.core.tests.internal.resource;
-
-import junit.framework.Test;
-import junit.framework.TestCase;
-import junit.framework.TestSuite;
-import org.eclipse.jpt.core.tests.internal.resource.java.JptJavaResourceTests;
-import org.eclipse.jpt2_0.core.tests.internal.resource.java.Generic2_0JavaResourceTests;
-
-public class JptCoreResourceModelTests extends TestCase
-{
- public static Test suite() {
- TestSuite suite = new TestSuite(JptCoreResourceModelTests.class.getName());
- suite.addTest(JptJavaResourceTests.suite());
- suite.addTest(Generic2_0JavaResourceTests.suite());
- return suite;
- }
-
- private JptCoreResourceModelTests() {
- super();
- throw new UnsupportedOperationException();
- }
-}
diff --git a/jpa/tests/org.eclipse.jpt.core.tests/src/org/eclipse/jpt/core/tests/internal/resource/java/AssociationOverrideTests.java b/jpa/tests/org.eclipse.jpt.core.tests/src/org/eclipse/jpt/core/tests/internal/resource/java/AssociationOverrideTests.java
deleted file mode 100644
index d86c38e831..0000000000
--- a/jpa/tests/org.eclipse.jpt.core.tests/src/org/eclipse/jpt/core/tests/internal/resource/java/AssociationOverrideTests.java
+++ /dev/null
@@ -1,253 +0,0 @@
-/*******************************************************************************
- * Copyright (c) 2007, 2009 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.
- *
- * Contributors:
- * Oracle - initial API and implementation
- ******************************************************************************/
-package org.eclipse.jpt.core.tests.internal.resource.java;
-
-import java.util.Iterator;
-import org.eclipse.jdt.core.ICompilationUnit;
-import org.eclipse.jpt.core.resource.java.AssociationOverrideAnnotation;
-import org.eclipse.jpt.core.resource.java.JPA;
-import org.eclipse.jpt.core.resource.java.JavaResourcePersistentAttribute;
-import org.eclipse.jpt.core.resource.java.JavaResourcePersistentType;
-import org.eclipse.jpt.core.resource.java.JoinColumnAnnotation;
-import org.eclipse.jpt.utility.internal.iterators.ArrayIterator;
-
-@SuppressWarnings("nls")
-public class AssociationOverrideTests extends JavaResourceModelTestCase {
-
- private static final String ASSOCIATION_OVERRIDE_NAME = "MY_ASSOCIATION_OVERRIDE";
-
- public AssociationOverrideTests(String name) {
- super(name);
- }
-
- private ICompilationUnit createTestAssociationOverrideOnField() throws Exception {
- return this.createTestType(new DefaultAnnotationWriter() {
- @Override
- public Iterator<String> imports() {
- return new ArrayIterator<String>(JPA.ASSOCIATION_OVERRIDE, JPA.COLUMN);
- }
- @Override
- public void appendIdFieldAnnotationTo(StringBuilder sb) {
- sb.append("@AssociationOverride(name = \"" + ASSOCIATION_OVERRIDE_NAME + "\")");
- }
- });
- }
-
- private ICompilationUnit createTestAssociationOverrideWithJoinColumns() throws Exception {
- return this.createTestType(new DefaultAnnotationWriter() {
- @Override
- public Iterator<String> imports() {
- return new ArrayIterator<String>(JPA.ASSOCIATION_OVERRIDE, JPA.JOIN_COLUMN);
- }
- @Override
- public void appendIdFieldAnnotationTo(StringBuilder sb) {
- sb.append("@AssociationOverride(name = \"" + ASSOCIATION_OVERRIDE_NAME + "\", joinColumns = {@JoinColumn(name = \"BAR\"), @JoinColumn})");
- }
- });
- }
-
- public void testGetName() throws Exception {
- ICompilationUnit cu = this.createTestAssociationOverrideOnField();
- JavaResourcePersistentType typeResource = buildJavaTypeResource(cu);
- JavaResourcePersistentAttribute attributeResource = typeResource.fields().next();
- AssociationOverrideAnnotation associationOverride = (AssociationOverrideAnnotation) attributeResource.getSupportingAnnotation(JPA.ASSOCIATION_OVERRIDE);
-
- assertNotNull(associationOverride);
- assertEquals(ASSOCIATION_OVERRIDE_NAME, associationOverride.getName());
- }
-
- public void testSetName() throws Exception {
- ICompilationUnit cu = this.createTestAssociationOverrideOnField();
- JavaResourcePersistentType typeResource = buildJavaTypeResource(cu);
- JavaResourcePersistentAttribute attributeResource = typeResource.fields().next();
- AssociationOverrideAnnotation associationOverride = (AssociationOverrideAnnotation) attributeResource.getSupportingAnnotation(JPA.ASSOCIATION_OVERRIDE);
-
- assertNotNull(associationOverride);
- assertEquals(ASSOCIATION_OVERRIDE_NAME, associationOverride.getName());
-
- associationOverride.setName("Foo");
- assertEquals("Foo", associationOverride.getName());
- assertSourceContains("@AssociationOverride(name = \"Foo\")", cu);
- }
-
- public void testSetNameNull() throws Exception {
- ICompilationUnit cu = this.createTestAssociationOverrideOnField();
- JavaResourcePersistentType typeResource = buildJavaTypeResource(cu);
- JavaResourcePersistentAttribute attributeResource = typeResource.fields().next();
- AssociationOverrideAnnotation associationOverride = (AssociationOverrideAnnotation) attributeResource.getSupportingAnnotation(JPA.ASSOCIATION_OVERRIDE);
-
- assertEquals(ASSOCIATION_OVERRIDE_NAME, associationOverride.getName());
-
- associationOverride.setName(null);
- assertNull(associationOverride.getName());
-
- assertSourceDoesNotContain("@AssociationOverride(name = \"" + ASSOCIATION_OVERRIDE_NAME + "\")", cu);
- assertSourceContains("@AssociationOverride", cu);
- }
-
-
- public void testJoinColumns() throws Exception {
- ICompilationUnit cu = this.createTestAssociationOverrideOnField();
- JavaResourcePersistentType typeResource = buildJavaTypeResource(cu);
- JavaResourcePersistentAttribute attributeResource = typeResource.fields().next();
-
- AssociationOverrideAnnotation associationOverride = (AssociationOverrideAnnotation) attributeResource.getSupportingAnnotation(JPA.ASSOCIATION_OVERRIDE);
-
- assertEquals(0, associationOverride.joinColumnsSize());
- }
-
- public void testJoinColumns2() throws Exception {
- ICompilationUnit cu = this.createTestAssociationOverrideOnField();
- JavaResourcePersistentType typeResource = buildJavaTypeResource(cu);
- JavaResourcePersistentAttribute attributeResource = typeResource.fields().next();
-
- AssociationOverrideAnnotation associationOverride = (AssociationOverrideAnnotation) attributeResource.getSupportingAnnotation(JPA.ASSOCIATION_OVERRIDE);
-
-
- associationOverride.addJoinColumn(0);
- associationOverride.addJoinColumn(1);
-
- assertEquals(2, associationOverride.joinColumnsSize());
- }
-
- public void testJoinColumns3() throws Exception {
- ICompilationUnit cu = this.createTestAssociationOverrideWithJoinColumns();
- JavaResourcePersistentType typeResource = buildJavaTypeResource(cu);
- JavaResourcePersistentAttribute attributeResource = typeResource.fields().next();
-
- AssociationOverrideAnnotation associationOverride = (AssociationOverrideAnnotation) attributeResource.getSupportingAnnotation(JPA.ASSOCIATION_OVERRIDE);
-
- assertEquals(2, associationOverride.joinColumnsSize());
- }
-
- public void testAddJoinColumn() throws Exception {
- ICompilationUnit cu = this.createTestAssociationOverrideOnField();
- JavaResourcePersistentType typeResource = buildJavaTypeResource(cu);
- JavaResourcePersistentAttribute attributeResource = typeResource.fields().next();
-
- AssociationOverrideAnnotation associationOverride = (AssociationOverrideAnnotation) attributeResource.getSupportingAnnotation(JPA.ASSOCIATION_OVERRIDE);
-
- associationOverride.addJoinColumn(0).setName("FOO");
- associationOverride.addJoinColumn(1);
- associationOverride.addJoinColumn(0).setName("BAR");
-
- assertEquals("BAR", associationOverride.joinColumnAt(0).getName());
- assertEquals("FOO", associationOverride.joinColumnAt(1).getName());
- assertNull(associationOverride.joinColumnAt(2).getName());
-
- assertSourceContains("@AssociationOverride(name = \"" + ASSOCIATION_OVERRIDE_NAME + "\", joinColumns = {@JoinColumn(name = \"BAR\"),@JoinColumn(name = \"FOO\"), @JoinColumn})", cu);
- }
-
- public void testRemoveJoinColumn() throws Exception {
- ICompilationUnit cu = this.createTestAssociationOverrideWithJoinColumns();
- JavaResourcePersistentType typeResource = buildJavaTypeResource(cu);
- JavaResourcePersistentAttribute attributeResource = typeResource.fields().next();
-
- AssociationOverrideAnnotation associationOverride = (AssociationOverrideAnnotation) attributeResource.getSupportingAnnotation(JPA.ASSOCIATION_OVERRIDE);
- associationOverride.addJoinColumn(0).setName("FOO");
-
- Iterator<JoinColumnAnnotation> joinColumns = associationOverride.joinColumns();
- assertEquals("FOO", joinColumns.next().getName());
- assertEquals("BAR", joinColumns.next().getName());
- assertNull(joinColumns.next().getName());
- assertEquals(false, joinColumns.hasNext());
- assertSourceContains("@AssociationOverride(name = \"" + ASSOCIATION_OVERRIDE_NAME + "\", joinColumns = {@JoinColumn(name = \"FOO\"), @JoinColumn(name = \"BAR\"), @JoinColumn})", cu);
-
- associationOverride.removeJoinColumn(1);
- joinColumns = associationOverride.joinColumns();
- assertEquals("FOO", joinColumns.next().getName());
- assertNull(joinColumns.next().getName());
- assertEquals(false, joinColumns.hasNext());
- assertSourceContains("@AssociationOverride(name = \"" + ASSOCIATION_OVERRIDE_NAME + "\", joinColumns = {@JoinColumn(name = \"FOO\"), @JoinColumn})", cu);
-
- associationOverride.removeJoinColumn(0);
- joinColumns = associationOverride.joinColumns();
- assertNull(joinColumns.next().getName());
- assertEquals(false, joinColumns.hasNext());
- assertSourceContains("@AssociationOverride(name = \"" + ASSOCIATION_OVERRIDE_NAME + "\", joinColumns = @JoinColumn)", cu);
-
-
- associationOverride.setName(null);
- associationOverride.removeJoinColumn(0);
- assertSourceDoesNotContain("@AssociationOverride", cu);
- }
-
- public void testMoveJoinColumn() throws Exception {
- ICompilationUnit cu = this.createTestAssociationOverrideWithJoinColumns();
- JavaResourcePersistentType typeResource = buildJavaTypeResource(cu);
- JavaResourcePersistentAttribute attributeResource = typeResource.fields().next();
-
- AssociationOverrideAnnotation associationOverride = (AssociationOverrideAnnotation) attributeResource.getSupportingAnnotation(JPA.ASSOCIATION_OVERRIDE);
- JoinColumnAnnotation joinColumn = associationOverride.joinColumnAt(0);
- joinColumn.setReferencedColumnName("REF_NAME");
- joinColumn.setUnique(Boolean.FALSE);
- joinColumn.setNullable(Boolean.FALSE);
- joinColumn.setInsertable(Boolean.FALSE);
- joinColumn.setUpdatable(Boolean.FALSE);
- joinColumn.setColumnDefinition("COLUMN_DEF");
- joinColumn.setTable("TABLE");
- associationOverride.addJoinColumn(0).setName("FOO");
-
- assertSourceContains("@AssociationOverride(name = \"" + ASSOCIATION_OVERRIDE_NAME + "\", joinColumns = {@JoinColumn(name = \"FOO\"), @JoinColumn(name = \"BAR\", referencedColumnName = \"REF_NAME\", unique = false, nullable = false, insertable = false, updatable = false, columnDefinition = \"COLUMN_DEF\", table = \"TABLE\"), @JoinColumn})", cu);
-
- associationOverride.moveJoinColumn(2, 0);
- assertEquals("BAR", associationOverride.joinColumnAt(0).getName());
- assertNull(associationOverride.joinColumnAt(1).getName());
- assertEquals("FOO", associationOverride.joinColumnAt(2).getName());
- assertEquals(3, associationOverride.joinColumnsSize());
- assertSourceContains("@AssociationOverride(name = \"" + ASSOCIATION_OVERRIDE_NAME + "\", joinColumns = {@JoinColumn(name = \"BAR\", referencedColumnName = \"REF_NAME\", unique = false, nullable = false, insertable = false, updatable = false, columnDefinition = \"COLUMN_DEF\", table = \"TABLE\"), @JoinColumn, @JoinColumn(name = \"FOO\")})", cu);
- }
-
- public void testMoveJoinColumn2() throws Exception {
- ICompilationUnit cu = this.createTestAssociationOverrideWithJoinColumns();
- JavaResourcePersistentType typeResource = buildJavaTypeResource(cu);
- JavaResourcePersistentAttribute attributeResource = typeResource.fields().next();
-
- AssociationOverrideAnnotation associationOverride = (AssociationOverrideAnnotation) attributeResource.getSupportingAnnotation(JPA.ASSOCIATION_OVERRIDE);
-
- JoinColumnAnnotation joinColumn = associationOverride.joinColumnAt(0);
- joinColumn.setReferencedColumnName("REF_NAME");
- joinColumn.setUnique(Boolean.FALSE);
- joinColumn.setNullable(Boolean.FALSE);
- joinColumn.setInsertable(Boolean.FALSE);
- joinColumn.setUpdatable(Boolean.FALSE);
- joinColumn.setColumnDefinition("COLUMN_DEF");
- joinColumn.setTable("TABLE");
- associationOverride.addJoinColumn(0).setName("FOO");
-
- assertSourceContains("@AssociationOverride(name = \"" + ASSOCIATION_OVERRIDE_NAME + "\", joinColumns = {@JoinColumn(name = \"FOO\"), @JoinColumn(name = \"BAR\", referencedColumnName = \"REF_NAME\", unique = false, nullable = false, insertable = false, updatable = false, columnDefinition = \"COLUMN_DEF\", table = \"TABLE\"), @JoinColumn})", cu);
-
- associationOverride.moveJoinColumn(0, 2);
- assertNull(associationOverride.joinColumnAt(0).getName());
- assertEquals("FOO", associationOverride.joinColumnAt(1).getName());
- assertEquals("BAR", associationOverride.joinColumnAt(2).getName());
- assertEquals(3, associationOverride.joinColumnsSize());
- assertSourceContains("@AssociationOverride(name = \"" + ASSOCIATION_OVERRIDE_NAME + "\", joinColumns = {@JoinColumn, @JoinColumn(name = \"FOO\"), @JoinColumn(name = \"BAR\", referencedColumnName = \"REF_NAME\", unique = false, nullable = false, insertable = false, updatable = false, columnDefinition = \"COLUMN_DEF\", table = \"TABLE\")})", cu);
- }
-
- public void testSetJoinColumnName() throws Exception {
- ICompilationUnit cu = this.createTestAssociationOverrideWithJoinColumns();
- JavaResourcePersistentType typeResource = buildJavaTypeResource(cu);
- JavaResourcePersistentAttribute attributeResource = typeResource.fields().next();
-
- AssociationOverrideAnnotation associationOverride = (AssociationOverrideAnnotation) attributeResource.getSupportingAnnotation(JPA.ASSOCIATION_OVERRIDE);
-
- assertEquals(2, associationOverride.joinColumnsSize());
-
- JoinColumnAnnotation joinColumn = associationOverride.joinColumns().next();
-
- assertEquals("BAR", joinColumn.getName());
-
- joinColumn.setName("foo");
- assertEquals("foo", joinColumn.getName());
-
- assertSourceContains("@AssociationOverride(name = \"" + ASSOCIATION_OVERRIDE_NAME + "\", joinColumns = {@JoinColumn(name = \"foo\"), @JoinColumn})", cu);
- }
-}
diff --git a/jpa/tests/org.eclipse.jpt.core.tests/src/org/eclipse/jpt/core/tests/internal/resource/java/AssociationOverridesTests.java b/jpa/tests/org.eclipse.jpt.core.tests/src/org/eclipse/jpt/core/tests/internal/resource/java/AssociationOverridesTests.java
deleted file mode 100644
index c7a207c3c5..0000000000
--- a/jpa/tests/org.eclipse.jpt.core.tests/src/org/eclipse/jpt/core/tests/internal/resource/java/AssociationOverridesTests.java
+++ /dev/null
@@ -1,320 +0,0 @@
-/*******************************************************************************
- * Copyright (c) 2007, 2009 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.
- *
- * Contributors:
- * Oracle - initial API and implementation
- ******************************************************************************/
-package org.eclipse.jpt.core.tests.internal.resource.java;
-
-import java.util.Iterator;
-
-import org.eclipse.jdt.core.ICompilationUnit;
-import org.eclipse.jpt.core.resource.java.AssociationOverrideAnnotation;
-import org.eclipse.jpt.core.resource.java.AssociationOverridesAnnotation;
-import org.eclipse.jpt.core.resource.java.JPA;
-import org.eclipse.jpt.core.resource.java.JavaResourcePersistentAttribute;
-import org.eclipse.jpt.core.resource.java.JavaResourcePersistentType;
-import org.eclipse.jpt.core.resource.java.JoinColumnAnnotation;
-import org.eclipse.jpt.core.resource.java.NestableAnnotation;
-import org.eclipse.jpt.utility.internal.CollectionTools;
-import org.eclipse.jpt.utility.internal.iterators.ArrayIterator;
-
-@SuppressWarnings("nls")
-public class AssociationOverridesTests extends JavaResourceModelTestCase {
-
- private static final String ASSOCIATION_OVERRIDE_NAME = "MY_ASSOCIATION_OVERRIDE";
-
- public AssociationOverridesTests(String name) {
- super(name);
- }
-
- private ICompilationUnit createTestAssociationOverrideOnField() throws Exception {
- return this.createTestType(new DefaultAnnotationWriter() {
- @Override
- public Iterator<String> imports() {
- return new ArrayIterator<String>(JPA.ASSOCIATION_OVERRIDE, JPA.ASSOCIATION_OVERRIDES);
- }
- @Override
- public void appendIdFieldAnnotationTo(StringBuilder sb) {
- sb.append("@AssociationOverrides(@AssociationOverride(name = \"" + ASSOCIATION_OVERRIDE_NAME + "\"))");
- }
- });
- }
-
- private ICompilationUnit createTestAssociationOverrideWithJoinColumns() throws Exception {
- return this.createTestType(new DefaultAnnotationWriter() {
- @Override
- public Iterator<String> imports() {
- return new ArrayIterator<String>(JPA.ASSOCIATION_OVERRIDE, JPA.ASSOCIATION_OVERRIDES, JPA.JOIN_COLUMN);
- }
- @Override
- public void appendIdFieldAnnotationTo(StringBuilder sb) {
- sb.append("@AssociationOverrides(@AssociationOverride(name = \"" + ASSOCIATION_OVERRIDE_NAME + "\", joinColumns = {@JoinColumn(name = \"BAR\"), @JoinColumn}))");
- }
- });
- }
-
- private ICompilationUnit createTestAssociationOverride() throws Exception {
- return this.createTestType(new DefaultAnnotationWriter() {
- @Override
- public Iterator<String> imports() {
- return new ArrayIterator<String>(JPA.ENTITY, JPA.ASSOCIATION_OVERRIDE, JPA.JOIN_COLUMN);
- }
- @Override
- public void appendTypeAnnotationTo(StringBuilder sb) {
- sb.append("@Entity");
- sb.append(CR);
- sb.append("@AssociationOverride(name = \"FOO\", joinColumns = @JoinColumn(name = \"FOO\", columnDefinition = \"BAR\", referencedColumnName = \"BAZ\"))");
- }
- });
- }
-
- public void testGetName() throws Exception {
- ICompilationUnit cu = this.createTestAssociationOverrideOnField();
- JavaResourcePersistentType typeResource = buildJavaTypeResource(cu);
- JavaResourcePersistentAttribute attributeResource = typeResource.fields().next();
- AssociationOverridesAnnotation associationOverrides = (AssociationOverridesAnnotation) attributeResource.getSupportingAnnotation(JPA.ASSOCIATION_OVERRIDES);
- AssociationOverrideAnnotation associationOverride = associationOverrides.nestedAnnotations().next();
-
- assertNotNull(associationOverride);
- assertEquals(ASSOCIATION_OVERRIDE_NAME, associationOverride.getName());
- }
-
- public void testSetName() throws Exception {
- ICompilationUnit cu = this.createTestAssociationOverrideOnField();
- JavaResourcePersistentType typeResource = buildJavaTypeResource(cu);
- JavaResourcePersistentAttribute attributeResource = typeResource.fields().next();
- AssociationOverridesAnnotation associationOverrides = (AssociationOverridesAnnotation) attributeResource.getSupportingAnnotation(JPA.ASSOCIATION_OVERRIDES);
- AssociationOverrideAnnotation associationOverride = associationOverrides.nestedAnnotations().next();
-
- assertNotNull(associationOverride);
- assertEquals(ASSOCIATION_OVERRIDE_NAME, associationOverride.getName());
-
- associationOverride.setName("Foo");
- assertEquals("Foo", associationOverride.getName());
- assertSourceContains("@AssociationOverrides(@AssociationOverride(name = \"Foo\"))", cu);
- }
-
- public void testSetNameNull() throws Exception {
- ICompilationUnit cu = this.createTestAssociationOverrideOnField();
- JavaResourcePersistentType typeResource = buildJavaTypeResource(cu);
- JavaResourcePersistentAttribute attributeResource = typeResource.fields().next();
- AssociationOverridesAnnotation associationOverrides = (AssociationOverridesAnnotation) attributeResource.getSupportingAnnotation(JPA.ASSOCIATION_OVERRIDES);
- AssociationOverrideAnnotation associationOverride = associationOverrides.nestedAnnotations().next();
- assertEquals(ASSOCIATION_OVERRIDE_NAME, associationOverride.getName());
-
- associationOverride.setName(null);
- assertNull(associationOverride.getName());
-
- assertSourceDoesNotContain("@AssociationOverride(name = \"" + ASSOCIATION_OVERRIDE_NAME + "\")", cu);
- assertSourceContains("@AssociationOverride", cu);
- assertSourceContains("@AssociationOverrides", cu);
- }
-
- public void testAddAssociationOverrideCopyExisting() throws Exception {
- ICompilationUnit cu = createTestAssociationOverride();
- JavaResourcePersistentType typeResource = buildJavaTypeResource(cu);
-
- AssociationOverrideAnnotation associationOverride = (AssociationOverrideAnnotation) typeResource.addSupportingAnnotation(1, JPA.ASSOCIATION_OVERRIDE, JPA.ASSOCIATION_OVERRIDES);
- associationOverride.setName("BAR");
- assertSourceContains("@AssociationOverrides({@AssociationOverride(name = \"FOO\", joinColumns = @JoinColumn(name = \"FOO\", columnDefinition = \"BAR\", referencedColumnName = \"BAZ\")),@AssociationOverride(name = \"BAR\")})", cu);
-
- assertNull(typeResource.getSupportingAnnotation(JPA.ASSOCIATION_OVERRIDE));
- assertNotNull(typeResource.getSupportingAnnotation(JPA.ASSOCIATION_OVERRIDES));
- assertEquals(2, CollectionTools.size(typeResource.supportingAnnotations(JPA.ASSOCIATION_OVERRIDE, JPA.ASSOCIATION_OVERRIDES)));
- }
-
- public void testAddAssociationOverrideToBeginningOfList() throws Exception {
- ICompilationUnit cu = createTestAssociationOverride();
- JavaResourcePersistentType typeResource = buildJavaTypeResource(cu);
-
- AssociationOverrideAnnotation associationOverride = (AssociationOverrideAnnotation) typeResource.addSupportingAnnotation(1, JPA.ASSOCIATION_OVERRIDE, JPA.ASSOCIATION_OVERRIDES);
- associationOverride.setName("BAR");
- assertSourceContains("@AssociationOverrides({@AssociationOverride(name = \"FOO\", joinColumns = @JoinColumn(name = \"FOO\", columnDefinition = \"BAR\", referencedColumnName = \"BAZ\")),@AssociationOverride(name = \"BAR\")})", cu);
-
- associationOverride = (AssociationOverrideAnnotation) typeResource.addSupportingAnnotation(0, JPA.ASSOCIATION_OVERRIDE, JPA.ASSOCIATION_OVERRIDES);
- associationOverride.setName("BAZ");
- assertSourceContains("@AssociationOverrides({@AssociationOverride(name = \"BAZ\"),@AssociationOverride(name = \"FOO\", joinColumns = @JoinColumn(name = \"FOO\", columnDefinition = \"BAR\", referencedColumnName = \"BAZ\")), @AssociationOverride(name = \"BAR\")})", cu);
-
- Iterator<NestableAnnotation> associationOverrides = typeResource.supportingAnnotations(JPA.ASSOCIATION_OVERRIDE, JPA.ASSOCIATION_OVERRIDES);
- assertEquals("BAZ", ((AssociationOverrideAnnotation) associationOverrides.next()).getName());
- assertEquals("FOO", ((AssociationOverrideAnnotation) associationOverrides.next()).getName());
- assertEquals("BAR", ((AssociationOverrideAnnotation) associationOverrides.next()).getName());
-
- assertNull(typeResource.getSupportingAnnotation(JPA.ASSOCIATION_OVERRIDE));
- assertNotNull(typeResource.getSupportingAnnotation(JPA.ASSOCIATION_OVERRIDES));
- assertEquals(3, CollectionTools.size(typeResource.supportingAnnotations(JPA.ASSOCIATION_OVERRIDE, JPA.ASSOCIATION_OVERRIDES)));
- }
-
- public void testRemoveAssociationOverrideCopyExisting() throws Exception {
- ICompilationUnit cu = createTestAssociationOverride();
- JavaResourcePersistentType typeResource = buildJavaTypeResource(cu);
-
- AssociationOverrideAnnotation associationOverride = (AssociationOverrideAnnotation) typeResource.addSupportingAnnotation(1, JPA.ASSOCIATION_OVERRIDE, JPA.ASSOCIATION_OVERRIDES);
- associationOverride.setName("BAR");
- assertSourceContains("@AssociationOverrides({@AssociationOverride(name = \"FOO\", joinColumns = @JoinColumn(name = \"FOO\", columnDefinition = \"BAR\", referencedColumnName = \"BAZ\")),@AssociationOverride(name = \"BAR\")})", cu);
-
- typeResource.removeSupportingAnnotation(1, JPA.ASSOCIATION_OVERRIDE, JPA.ASSOCIATION_OVERRIDES);
- assertSourceContains("@AssociationOverride(name = \"FOO\", joinColumns = @JoinColumn(name = \"FOO\", columnDefinition = \"BAR\", referencedColumnName = \"BAZ\"))", cu);
- }
-
- public void testJoinColumns() throws Exception {
- ICompilationUnit cu = this.createTestAssociationOverrideOnField();
- JavaResourcePersistentType typeResource = buildJavaTypeResource(cu);
- JavaResourcePersistentAttribute attributeResource = typeResource.fields().next();
-
- AssociationOverrideAnnotation associationOverride = (AssociationOverrideAnnotation) attributeResource.supportingAnnotations(JPA.ASSOCIATION_OVERRIDE, JPA.ASSOCIATION_OVERRIDES).next();
-
- assertEquals(0, associationOverride.joinColumnsSize());
- }
-
- public void testJoinColumns2() throws Exception {
- ICompilationUnit cu = this.createTestAssociationOverrideOnField();
- JavaResourcePersistentType typeResource = buildJavaTypeResource(cu);
- JavaResourcePersistentAttribute attributeResource = typeResource.fields().next();
-
- AssociationOverrideAnnotation associationOverride = (AssociationOverrideAnnotation) attributeResource.supportingAnnotations(JPA.ASSOCIATION_OVERRIDE, JPA.ASSOCIATION_OVERRIDES).next();
-
- associationOverride.addJoinColumn(0);
- associationOverride.addJoinColumn(1);
-
- assertEquals(2, associationOverride.joinColumnsSize());
- }
-
- public void testJoinColumns3() throws Exception {
- ICompilationUnit cu = this.createTestAssociationOverrideWithJoinColumns();
- JavaResourcePersistentType typeResource = buildJavaTypeResource(cu);
- JavaResourcePersistentAttribute attributeResource = typeResource.fields().next();
-
- AssociationOverrideAnnotation associationOverride = (AssociationOverrideAnnotation) attributeResource.supportingAnnotations(JPA.ASSOCIATION_OVERRIDE, JPA.ASSOCIATION_OVERRIDES).next();
-
- assertEquals(2, associationOverride.joinColumnsSize());
- }
-
- public void testAddJoinColumn() throws Exception {
- ICompilationUnit cu = this.createTestAssociationOverrideOnField();
- JavaResourcePersistentType typeResource = buildJavaTypeResource(cu);
- JavaResourcePersistentAttribute attributeResource = typeResource.fields().next();
-
- AssociationOverrideAnnotation associationOverride = (AssociationOverrideAnnotation) attributeResource.supportingAnnotations(JPA.ASSOCIATION_OVERRIDE, JPA.ASSOCIATION_OVERRIDES).next();
-
- associationOverride.addJoinColumn(0).setName("FOO");
- associationOverride.addJoinColumn(1);
- associationOverride.addJoinColumn(0).setName("BAR");
-
-
- Iterator<JoinColumnAnnotation> joinColumns = associationOverride.joinColumns();
- assertEquals("BAR", joinColumns.next().getName());
- assertEquals("FOO", joinColumns.next().getName());
- assertNull(joinColumns.next().getName());
-
- assertSourceContains("@AssociationOverrides(@AssociationOverride(name = \"" + ASSOCIATION_OVERRIDE_NAME + "\", joinColumns = {@JoinColumn(name = \"BAR\"),@JoinColumn(name = \"FOO\"), @JoinColumn}))", cu);
- }
-
- public void testRemoveJoinColumn() throws Exception {
- ICompilationUnit cu = this.createTestAssociationOverrideWithJoinColumns();
- JavaResourcePersistentType typeResource = buildJavaTypeResource(cu);
- JavaResourcePersistentAttribute attributeResource = typeResource.fields().next();
-
- AssociationOverrideAnnotation associationOverride = (AssociationOverrideAnnotation) attributeResource.supportingAnnotations(JPA.ASSOCIATION_OVERRIDE, JPA.ASSOCIATION_OVERRIDES).next();
- associationOverride.addJoinColumn(0).setName("FOO");
-
- Iterator<JoinColumnAnnotation> joinColumns = associationOverride.joinColumns();
- assertEquals("FOO", joinColumns.next().getName());
- assertEquals("BAR", joinColumns.next().getName());
- assertNull(joinColumns.next().getName());
- assertEquals(false, joinColumns.hasNext());
- assertSourceContains("@AssociationOverrides(@AssociationOverride(name = \"" + ASSOCIATION_OVERRIDE_NAME + "\", joinColumns = {@JoinColumn(name = \"FOO\"), @JoinColumn(name = \"BAR\"), @JoinColumn}))", cu);
-
- associationOverride.removeJoinColumn(1);
- joinColumns = associationOverride.joinColumns();
- assertEquals("FOO", joinColumns.next().getName());
- assertNull(joinColumns.next().getName());
- assertEquals(false, joinColumns.hasNext());
- assertSourceContains("@AssociationOverrides(@AssociationOverride(name = \"" + ASSOCIATION_OVERRIDE_NAME + "\", joinColumns = {@JoinColumn(name = \"FOO\"), @JoinColumn}))", cu);
-
- associationOverride.removeJoinColumn(0);
- joinColumns = associationOverride.joinColumns();
- assertNull(joinColumns.next().getName());
- assertEquals(false, joinColumns.hasNext());
- assertSourceContains("@AssociationOverrides(@AssociationOverride(name = \"" + ASSOCIATION_OVERRIDE_NAME + "\", joinColumns = @JoinColumn))", cu);
-
-
- associationOverride.setName(null);
- associationOverride.removeJoinColumn(0);
- assertSourceDoesNotContain("@AssociationOverride", cu);
- }
-
- public void testMoveJoinColumn() throws Exception {
- ICompilationUnit cu = this.createTestAssociationOverrideWithJoinColumns();
- JavaResourcePersistentType typeResource = buildJavaTypeResource(cu);
- JavaResourcePersistentAttribute attributeResource = typeResource.fields().next();
-
- AssociationOverrideAnnotation associationOverride = (AssociationOverrideAnnotation) attributeResource.supportingAnnotations(JPA.ASSOCIATION_OVERRIDE, JPA.ASSOCIATION_OVERRIDES).next();
- JoinColumnAnnotation joinColumn = associationOverride.joinColumnAt(0);
- joinColumn.setReferencedColumnName("REF_NAME");
- joinColumn.setUnique(Boolean.FALSE);
- joinColumn.setNullable(Boolean.FALSE);
- joinColumn.setInsertable(Boolean.FALSE);
- joinColumn.setUpdatable(Boolean.FALSE);
- joinColumn.setColumnDefinition("COLUMN_DEF");
- joinColumn.setTable("TABLE");
- associationOverride.addJoinColumn(0).setName("FOO");
- assertSourceContains("@AssociationOverrides(@AssociationOverride(name = \"" + ASSOCIATION_OVERRIDE_NAME + "\", joinColumns = {@JoinColumn(name = \"FOO\"), @JoinColumn(name = \"BAR\", referencedColumnName = \"REF_NAME\", unique = false, nullable = false, insertable = false, updatable = false, columnDefinition = \"COLUMN_DEF\", table = \"TABLE\"), @JoinColumn}))", cu);
-
- associationOverride.moveJoinColumn(2, 0);
- assertEquals("BAR", associationOverride.joinColumnAt(0).getName());
- assertNull(associationOverride.joinColumnAt(1).getName());
- assertEquals("FOO", associationOverride.joinColumnAt(2).getName());
- assertEquals(3, associationOverride.joinColumnsSize());
- assertSourceContains("@AssociationOverrides(@AssociationOverride(name = \"" + ASSOCIATION_OVERRIDE_NAME + "\", joinColumns = {@JoinColumn(name = \"BAR\", referencedColumnName = \"REF_NAME\", unique = false, nullable = false, insertable = false, updatable = false, columnDefinition = \"COLUMN_DEF\", table = \"TABLE\"), @JoinColumn, @JoinColumn(name = \"FOO\")}))", cu);
- }
-
- public void testMoveJoinColumn2() throws Exception {
- ICompilationUnit cu = this.createTestAssociationOverrideWithJoinColumns();
- JavaResourcePersistentType typeResource = buildJavaTypeResource(cu);
- JavaResourcePersistentAttribute attributeResource = typeResource.fields().next();
-
- AssociationOverrideAnnotation associationOverride = (AssociationOverrideAnnotation) attributeResource.supportingAnnotations(JPA.ASSOCIATION_OVERRIDE, JPA.ASSOCIATION_OVERRIDES).next();
-
- JoinColumnAnnotation joinColumn = associationOverride.joinColumnAt(0);
- joinColumn.setReferencedColumnName("REF_NAME");
- joinColumn.setUnique(Boolean.FALSE);
- joinColumn.setNullable(Boolean.FALSE);
- joinColumn.setInsertable(Boolean.FALSE);
- joinColumn.setUpdatable(Boolean.FALSE);
- joinColumn.setColumnDefinition("COLUMN_DEF");
- joinColumn.setTable("TABLE");
- associationOverride.addJoinColumn(0).setName("FOO");
-
- assertSourceContains("@AssociationOverrides(@AssociationOverride(name = \"" + ASSOCIATION_OVERRIDE_NAME + "\", joinColumns = {@JoinColumn(name = \"FOO\"), @JoinColumn(name = \"BAR\", referencedColumnName = \"REF_NAME\", unique = false, nullable = false, insertable = false, updatable = false, columnDefinition = \"COLUMN_DEF\", table = \"TABLE\"), @JoinColumn}))", cu);
- associationOverride.moveJoinColumn(0, 2);
- assertNull(associationOverride.joinColumnAt(0).getName());
- assertEquals("FOO", associationOverride.joinColumnAt(1).getName());
- assertEquals("BAR", associationOverride.joinColumnAt(2).getName());
- assertEquals(3, associationOverride.joinColumnsSize());
- assertSourceContains("@AssociationOverrides(@AssociationOverride(name = \"" + ASSOCIATION_OVERRIDE_NAME + "\", joinColumns = {@JoinColumn, @JoinColumn(name = \"FOO\"), @JoinColumn(name = \"BAR\", referencedColumnName = \"REF_NAME\", unique = false, nullable = false, insertable = false, updatable = false, columnDefinition = \"COLUMN_DEF\", table = \"TABLE\")}))", cu);
- }
-
- public void testSetJoinColumnName() throws Exception {
- ICompilationUnit cu = this.createTestAssociationOverrideWithJoinColumns();
- JavaResourcePersistentType typeResource = buildJavaTypeResource(cu);
- JavaResourcePersistentAttribute attributeResource = typeResource.fields().next();
-
- AssociationOverrideAnnotation associationOverride = (AssociationOverrideAnnotation) attributeResource.supportingAnnotations(JPA.ASSOCIATION_OVERRIDE, JPA.ASSOCIATION_OVERRIDES).next();
-
- assertEquals(2, associationOverride.joinColumnsSize());
-
- JoinColumnAnnotation joinColumn = associationOverride.joinColumns().next();
-
- assertEquals("BAR", joinColumn.getName());
-
- joinColumn.setName("foo");
- assertEquals("foo", joinColumn.getName());
-
- assertSourceContains("@AssociationOverrides(@AssociationOverride(name = \"" + ASSOCIATION_OVERRIDE_NAME + "\", joinColumns = {@JoinColumn(name = \"foo\"), @JoinColumn}))", cu);
- }
-}
diff --git a/jpa/tests/org.eclipse.jpt.core.tests/src/org/eclipse/jpt/core/tests/internal/resource/java/AttributeOverrideTests.java b/jpa/tests/org.eclipse.jpt.core.tests/src/org/eclipse/jpt/core/tests/internal/resource/java/AttributeOverrideTests.java
deleted file mode 100644
index 2b62b55107..0000000000
--- a/jpa/tests/org.eclipse.jpt.core.tests/src/org/eclipse/jpt/core/tests/internal/resource/java/AttributeOverrideTests.java
+++ /dev/null
@@ -1,155 +0,0 @@
-/*******************************************************************************
- * Copyright (c) 2007, 2009 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.
- *
- * Contributors:
- * Oracle - initial API and implementation
- ******************************************************************************/
-package org.eclipse.jpt.core.tests.internal.resource.java;
-
-import java.util.Iterator;
-import org.eclipse.jdt.core.ICompilationUnit;
-import org.eclipse.jpt.core.resource.java.AttributeOverrideAnnotation;
-import org.eclipse.jpt.core.resource.java.ColumnAnnotation;
-import org.eclipse.jpt.core.resource.java.JPA;
-import org.eclipse.jpt.core.resource.java.JavaResourcePersistentAttribute;
-import org.eclipse.jpt.core.resource.java.JavaResourcePersistentType;
-import org.eclipse.jpt.utility.internal.iterators.ArrayIterator;
-
-@SuppressWarnings("nls")
-public class AttributeOverrideTests extends JavaResourceModelTestCase {
-
- private static final String COLUMN_NAME = "MY_COLUMN";
- private static final String ATTRIBUTE_OVERRIDE_NAME = "MY_ATTRIBUTE_OVERRIDE";
-
- public AttributeOverrideTests(String name) {
- super(name);
- }
-
- private ICompilationUnit createTestAttributeOverrideOnField() throws Exception {
- return this.createTestType(new DefaultAnnotationWriter() {
- @Override
- public Iterator<String> imports() {
- return new ArrayIterator<String>(JPA.ATTRIBUTE_OVERRIDE, JPA.COLUMN);
- }
- @Override
- public void appendIdFieldAnnotationTo(StringBuilder sb) {
- sb.append("@AttributeOverride(name = \"" + ATTRIBUTE_OVERRIDE_NAME + "\")");
- }
- });
- }
-
- private ICompilationUnit createTestAttributeOverrideWithColumnOnField() throws Exception {
- return this.createTestType(new DefaultAnnotationWriter() {
- @Override
- public Iterator<String> imports() {
- return new ArrayIterator<String>(JPA.ATTRIBUTE_OVERRIDE, JPA.COLUMN);
- }
- @Override
- public void appendIdFieldAnnotationTo(StringBuilder sb) {
- sb.append("@AttributeOverride(name = \"" + ATTRIBUTE_OVERRIDE_NAME + "\", column = @Column(name = \"" + COLUMN_NAME + "\"))");
- }
- });
- }
-
- public void testGetName() throws Exception {
- ICompilationUnit cu = this.createTestAttributeOverrideOnField();
- JavaResourcePersistentType typeResource = buildJavaTypeResource(cu);
- JavaResourcePersistentAttribute attributeResource = typeResource.fields().next();
- AttributeOverrideAnnotation attributeOverride = (AttributeOverrideAnnotation) attributeResource.getSupportingAnnotation(JPA.ATTRIBUTE_OVERRIDE);
-
- assertNotNull(attributeOverride);
- assertEquals(ATTRIBUTE_OVERRIDE_NAME, attributeOverride.getName());
- }
-
- public void testGetNullColumn() throws Exception {
- ICompilationUnit cu = this.createTestAttributeOverrideOnField();
- JavaResourcePersistentType typeResource = buildJavaTypeResource(cu);
- JavaResourcePersistentAttribute attributeResource = typeResource.fields().next();
- AttributeOverrideAnnotation attributeOverride = (AttributeOverrideAnnotation) attributeResource.getSupportingAnnotation(JPA.ATTRIBUTE_OVERRIDE);
- ColumnAnnotation column = attributeOverride.getColumn();
- assertNotNull(attributeOverride);
- assertNull(column);
- }
-
- public void testSetName() throws Exception {
- ICompilationUnit cu = this.createTestAttributeOverrideOnField();
- JavaResourcePersistentType typeResource = buildJavaTypeResource(cu);
- JavaResourcePersistentAttribute attributeResource = typeResource.fields().next();
- AttributeOverrideAnnotation attributeOverride = (AttributeOverrideAnnotation) attributeResource.getSupportingAnnotation(JPA.ATTRIBUTE_OVERRIDE);
-
- assertNotNull(attributeOverride);
- assertEquals(ATTRIBUTE_OVERRIDE_NAME, attributeOverride.getName());
-
- attributeOverride.setName("Foo");
- assertEquals("Foo", attributeOverride.getName());
- assertSourceContains("@AttributeOverride(name = \"Foo\")", cu);
- }
-
- public void testSetNameNull() throws Exception {
- ICompilationUnit cu = this.createTestAttributeOverrideOnField();
- JavaResourcePersistentType typeResource = buildJavaTypeResource(cu);
- JavaResourcePersistentAttribute attributeResource = typeResource.fields().next();
- AttributeOverrideAnnotation attributeOverride = (AttributeOverrideAnnotation) attributeResource.getSupportingAnnotation(JPA.ATTRIBUTE_OVERRIDE);
-
- assertEquals(ATTRIBUTE_OVERRIDE_NAME, attributeOverride.getName());
-
- attributeOverride.setName(null);
- assertNull(attributeOverride.getName());
-
- assertSourceDoesNotContain("@AttributeOverride(name=\"" + ATTRIBUTE_OVERRIDE_NAME + "\")", cu);
- assertSourceContains("@AttributeOverride", cu);
- }
-
- public void testColumnGetName() throws Exception {
- ICompilationUnit cu = this.createTestAttributeOverrideWithColumnOnField();
- JavaResourcePersistentType typeResource = buildJavaTypeResource(cu);
- JavaResourcePersistentAttribute attributeResource = typeResource.fields().next();
- AttributeOverrideAnnotation attributeOverride = (AttributeOverrideAnnotation) attributeResource.getSupportingAnnotation(JPA.ATTRIBUTE_OVERRIDE);
- ColumnAnnotation column = attributeOverride.getColumn();
- assertEquals(COLUMN_NAME, column.getName());
- }
-
- public void testColumnSetName() throws Exception {
- ICompilationUnit cu = this.createTestAttributeOverrideWithColumnOnField();
- JavaResourcePersistentType typeResource = buildJavaTypeResource(cu);
- JavaResourcePersistentAttribute attributeResource = typeResource.fields().next();
- AttributeOverrideAnnotation attributeOverride = (AttributeOverrideAnnotation) attributeResource.getSupportingAnnotation(JPA.ATTRIBUTE_OVERRIDE);
- ColumnAnnotation column = attributeOverride.getColumn();
- assertEquals(COLUMN_NAME, column.getName());
-
- column.setName("Foo");
-
- assertSourceContains("@AttributeOverride(name = \"" + ATTRIBUTE_OVERRIDE_NAME + "\", column = @Column(name = \"Foo\"))", cu);
-
- column.setName(null);
- assertNull(attributeOverride.getColumn());
- assertSourceContains("@AttributeOverride(name = \"" + ATTRIBUTE_OVERRIDE_NAME + "\")", cu);
- }
-
- public void testAddColumn() throws Exception {
- ICompilationUnit cu = this.createTestAttributeOverrideOnField();
- JavaResourcePersistentType typeResource = buildJavaTypeResource(cu);
- JavaResourcePersistentAttribute attributeResource = typeResource.fields().next();
- AttributeOverrideAnnotation attributeOverride = (AttributeOverrideAnnotation) attributeResource.getSupportingAnnotation(JPA.ATTRIBUTE_OVERRIDE);
- ColumnAnnotation column = attributeOverride.getColumn();
- assertNull(column);
-
- attributeOverride.addColumn();
- column = attributeOverride.getColumn();
- assertNotNull(column);
- assertSourceContains("@AttributeOverride(name = \"" + ATTRIBUTE_OVERRIDE_NAME + "\", column = @Column)", cu);
- }
-
- public void testRemoveColumn() throws Exception {
- ICompilationUnit cu = this.createTestAttributeOverrideOnField();
- JavaResourcePersistentType typeResource = buildJavaTypeResource(cu);
- JavaResourcePersistentAttribute attributeResource = typeResource.fields().next();
- AttributeOverrideAnnotation attributeOverride = (AttributeOverrideAnnotation) attributeResource.getSupportingAnnotation(JPA.ATTRIBUTE_OVERRIDE);
- ColumnAnnotation column = attributeOverride.getColumn();
- assertNull(column);
- }
-
-}
diff --git a/jpa/tests/org.eclipse.jpt.core.tests/src/org/eclipse/jpt/core/tests/internal/resource/java/AttributeOverridesTests.java b/jpa/tests/org.eclipse.jpt.core.tests/src/org/eclipse/jpt/core/tests/internal/resource/java/AttributeOverridesTests.java
deleted file mode 100644
index 51b5418cc6..0000000000
--- a/jpa/tests/org.eclipse.jpt.core.tests/src/org/eclipse/jpt/core/tests/internal/resource/java/AttributeOverridesTests.java
+++ /dev/null
@@ -1,272 +0,0 @@
-/*******************************************************************************
- * Copyright (c) 2007, 2009 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.
- *
- * Contributors:
- * Oracle - initial API and implementation
- ******************************************************************************/
-package org.eclipse.jpt.core.tests.internal.resource.java;
-
-import java.util.Iterator;
-
-import org.eclipse.jdt.core.ICompilationUnit;
-import org.eclipse.jpt.core.resource.java.AttributeOverrideAnnotation;
-import org.eclipse.jpt.core.resource.java.AttributeOverridesAnnotation;
-import org.eclipse.jpt.core.resource.java.ColumnAnnotation;
-import org.eclipse.jpt.core.resource.java.JPA;
-import org.eclipse.jpt.core.resource.java.JavaResourcePersistentAttribute;
-import org.eclipse.jpt.core.resource.java.JavaResourcePersistentType;
-import org.eclipse.jpt.core.resource.java.NestableAnnotation;
-import org.eclipse.jpt.utility.internal.CollectionTools;
-import org.eclipse.jpt.utility.internal.iterators.ArrayIterator;
-
-@SuppressWarnings("nls")
-public class AttributeOverridesTests extends JavaResourceModelTestCase {
-
- private static final String COLUMN_NAME = "MY_COLUMN";
- private static final String ATTRIBUTE_OVERRIDE_NAME = "MY_ATTRIBUTE_OVERRIDE";
-
- public AttributeOverridesTests(String name) {
- super(name);
- }
-
- private ICompilationUnit createTestAttributeOverrideOnField() throws Exception {
- return this.createTestType(new DefaultAnnotationWriter() {
- @Override
- public Iterator<String> imports() {
- return new ArrayIterator<String>(JPA.ATTRIBUTE_OVERRIDE, JPA.ATTRIBUTE_OVERRIDES, JPA.COLUMN);
- }
- @Override
- public void appendIdFieldAnnotationTo(StringBuilder sb) {
- sb.append("@AttributeOverrides(@AttributeOverride(name = \"" + ATTRIBUTE_OVERRIDE_NAME + "\"))");
- }
- });
- }
-
- private ICompilationUnit createTestAttributeOverrideWithColumnOnField() throws Exception {
- return this.createTestType(new DefaultAnnotationWriter() {
- @Override
- public Iterator<String> imports() {
- return new ArrayIterator<String>(JPA.ATTRIBUTE_OVERRIDE, JPA.ATTRIBUTE_OVERRIDES, JPA.COLUMN);
- }
- @Override
- public void appendIdFieldAnnotationTo(StringBuilder sb) {
- sb.append("@AttributeOverrides(@AttributeOverride(name = \"" + ATTRIBUTE_OVERRIDE_NAME + "\", column = @Column(name = \"" + COLUMN_NAME + "\")))");
- }
- });
- }
-
- private ICompilationUnit createTestAttributeOverride() throws Exception {
- return this.createTestType(new DefaultAnnotationWriter() {
- @Override
- public Iterator<String> imports() {
- return new ArrayIterator<String>(JPA.ENTITY, JPA.ATTRIBUTE_OVERRIDE, JPA.COLUMN);
- }
- @Override
- public void appendTypeAnnotationTo(StringBuilder sb) {
- sb.append("@Entity");
- sb.append(CR);
- sb.append("@AttributeOverride(name = \"FOO\", column = @Column(name = \"FOO\", columnDefinition = \"BAR\", table = \"BAZ\", unique = false, nullable = false, insertable = false, updatable = false, length = 1, precision = 1, scale = 1))");
- }
- });
- }
-
- public void testGetName() throws Exception {
- ICompilationUnit cu = this.createTestAttributeOverrideOnField();
- JavaResourcePersistentType typeResource = buildJavaTypeResource(cu);
- JavaResourcePersistentAttribute attributeResource = typeResource.fields().next();
- AttributeOverridesAnnotation attributeOverrides = (AttributeOverridesAnnotation) attributeResource.getSupportingAnnotation(JPA.ATTRIBUTE_OVERRIDES);
- AttributeOverrideAnnotation attributeOverride = attributeOverrides.nestedAnnotations().next();
-
- assertNotNull(attributeOverride);
- assertEquals(ATTRIBUTE_OVERRIDE_NAME, attributeOverride.getName());
- }
-
- public void testGetNullColumn() throws Exception {
- ICompilationUnit cu = this.createTestAttributeOverrideOnField();
- JavaResourcePersistentType typeResource = buildJavaTypeResource(cu);
- JavaResourcePersistentAttribute attributeResource = typeResource.fields().next();
- AttributeOverridesAnnotation attributeOverrides = (AttributeOverridesAnnotation) attributeResource.getSupportingAnnotation(JPA.ATTRIBUTE_OVERRIDES);
- AttributeOverrideAnnotation attributeOverride = attributeOverrides.nestedAnnotations().next();
- ColumnAnnotation column = attributeOverride.getColumn();
- assertNotNull(attributeOverride);
- assertNull(column);
- }
-
- public void testSetName() throws Exception {
- ICompilationUnit cu = this.createTestAttributeOverrideOnField();
- JavaResourcePersistentType typeResource = buildJavaTypeResource(cu);
- JavaResourcePersistentAttribute attributeResource = typeResource.fields().next();
- AttributeOverridesAnnotation attributeOverrides = (AttributeOverridesAnnotation) attributeResource.getSupportingAnnotation(JPA.ATTRIBUTE_OVERRIDES);
- AttributeOverrideAnnotation attributeOverride = attributeOverrides.nestedAnnotations().next();
-
- assertNotNull(attributeOverride);
- assertEquals(ATTRIBUTE_OVERRIDE_NAME, attributeOverride.getName());
-
- attributeOverride.setName("Foo");
- assertEquals("Foo", attributeOverride.getName());
- assertSourceContains("@AttributeOverrides(@AttributeOverride(name = \"Foo\"))", cu);
- }
-
- public void testSetNameNull() throws Exception {
- ICompilationUnit cu = this.createTestAttributeOverrideOnField();
- JavaResourcePersistentType typeResource = buildJavaTypeResource(cu);
- JavaResourcePersistentAttribute attributeResource = typeResource.fields().next();
- AttributeOverridesAnnotation attributeOverrides = (AttributeOverridesAnnotation) attributeResource.getSupportingAnnotation(JPA.ATTRIBUTE_OVERRIDES);
- AttributeOverrideAnnotation attributeOverride = attributeOverrides.nestedAnnotations().next();
- assertEquals(ATTRIBUTE_OVERRIDE_NAME, attributeOverride.getName());
-
- attributeOverride.setName(null);
- assertNull(attributeOverride.getName());
-
- assertSourceDoesNotContain("@AttributeOverride(name=\"" + ATTRIBUTE_OVERRIDE_NAME + "\")", cu);
- assertSourceContains("@AttributeOverride", cu);
- assertSourceContains("@AttributeOverrides", cu);
- }
-
- public void testColumnGetName() throws Exception {
- ICompilationUnit cu = this.createTestAttributeOverrideWithColumnOnField();
- JavaResourcePersistentType typeResource = buildJavaTypeResource(cu);
- JavaResourcePersistentAttribute attributeResource = typeResource.fields().next();
- AttributeOverridesAnnotation attributeOverrides = (AttributeOverridesAnnotation) attributeResource.getSupportingAnnotation(JPA.ATTRIBUTE_OVERRIDES);
- AttributeOverrideAnnotation attributeOverride = attributeOverrides.nestedAnnotations().next();
-
- ColumnAnnotation column = attributeOverride.getColumn();
- assertEquals(COLUMN_NAME, column.getName());
- }
-
- public void testColumnSetName() throws Exception {
- ICompilationUnit cu = this.createTestAttributeOverrideWithColumnOnField();
- JavaResourcePersistentType typeResource = buildJavaTypeResource(cu);
- JavaResourcePersistentAttribute attributeResource = typeResource.fields().next();
- AttributeOverrideAnnotation attributeOverride = (AttributeOverrideAnnotation) attributeResource.supportingAnnotations(JPA.ATTRIBUTE_OVERRIDE, JPA.ATTRIBUTE_OVERRIDES).next();
-
- ColumnAnnotation column = attributeOverride.getColumn();
-
- assertEquals(COLUMN_NAME, column.getName());
-
- column.setName("Foo");
-
- assertSourceContains("@AttributeOverrides(@AttributeOverride(name = \"" + ATTRIBUTE_OVERRIDE_NAME + "\", column = @Column(name = \"Foo\")))", cu);
-
- column.setName(null);
- assertNull(attributeOverride.getColumn());
- assertSourceContains("@AttributeOverride(name = \"" + ATTRIBUTE_OVERRIDE_NAME + "\")", cu);
- }
-
- public void testAddAttributeOverrideCopyExisting() throws Exception {
- ICompilationUnit cu = createTestAttributeOverride();
- JavaResourcePersistentType typeResource = buildJavaTypeResource(cu);
-
- AttributeOverrideAnnotation attributeOverride = (AttributeOverrideAnnotation) typeResource.addSupportingAnnotation(1, JPA.ATTRIBUTE_OVERRIDE, JPA.ATTRIBUTE_OVERRIDES);
- attributeOverride.setName("BAR");
- assertSourceContains("@AttributeOverrides({@AttributeOverride(name = \"FOO\", column = @Column(name = \"FOO\", columnDefinition = \"BAR\", table = \"BAZ\", unique = false, nullable = false, insertable = false, updatable = false, length = 1, precision = 1, scale = 1)),@AttributeOverride(name = \"BAR\")})", cu);
-
- assertNull(typeResource.getSupportingAnnotation(JPA.ATTRIBUTE_OVERRIDE));
- assertNotNull(typeResource.getSupportingAnnotation(JPA.ATTRIBUTE_OVERRIDES));
- assertEquals(2, CollectionTools.size(typeResource.supportingAnnotations(JPA.ATTRIBUTE_OVERRIDE, JPA.ATTRIBUTE_OVERRIDES)));
- }
-
- public void testAddAttributeOverrideToBeginningOfList() throws Exception {
- ICompilationUnit cu = createTestAttributeOverride();
- JavaResourcePersistentType typeResource = buildJavaTypeResource(cu);
-
- AttributeOverrideAnnotation attributeOverride = (AttributeOverrideAnnotation) typeResource.addSupportingAnnotation(1, JPA.ATTRIBUTE_OVERRIDE, JPA.ATTRIBUTE_OVERRIDES);
- attributeOverride.setName("BAR");
- assertSourceContains("@AttributeOverrides({@AttributeOverride(name = \"FOO\", column = @Column(name = \"FOO\", columnDefinition = \"BAR\", table = \"BAZ\", unique = false, nullable = false, insertable = false, updatable = false, length = 1, precision = 1, scale = 1)),@AttributeOverride(name = \"BAR\")})", cu);
-
- attributeOverride = (AttributeOverrideAnnotation) typeResource.addSupportingAnnotation(0, JPA.ATTRIBUTE_OVERRIDE, JPA.ATTRIBUTE_OVERRIDES);
- attributeOverride.setName("BAZ");
- assertSourceContains("@AttributeOverrides({@AttributeOverride(name = \"BAZ\"),@AttributeOverride(name = \"FOO\", column = @Column(name = \"FOO\", columnDefinition = \"BAR\", table = \"BAZ\", unique = false, nullable = false, insertable = false, updatable = false, length = 1, precision = 1, scale = 1)), @AttributeOverride(name = \"BAR\")})", cu);
-
- Iterator<NestableAnnotation> attributeOverrides = typeResource.supportingAnnotations(JPA.ATTRIBUTE_OVERRIDE, JPA.ATTRIBUTE_OVERRIDES);
- assertEquals("BAZ", ((AttributeOverrideAnnotation) attributeOverrides.next()).getName());
- assertEquals("FOO", ((AttributeOverrideAnnotation) attributeOverrides.next()).getName());
- assertEquals("BAR", ((AttributeOverrideAnnotation) attributeOverrides.next()).getName());
-
- assertNull(typeResource.getSupportingAnnotation(JPA.ATTRIBUTE_OVERRIDE));
- assertNotNull(typeResource.getSupportingAnnotation(JPA.ATTRIBUTE_OVERRIDES));
- assertEquals(3, CollectionTools.size(typeResource.supportingAnnotations(JPA.ATTRIBUTE_OVERRIDE, JPA.ATTRIBUTE_OVERRIDES)));
- }
-
- public void testRemoveAttributeOverrideCopyExisting() throws Exception {
- ICompilationUnit cu = createTestAttributeOverride();
- JavaResourcePersistentType typeResource = buildJavaTypeResource(cu);
-
- AttributeOverrideAnnotation attributeOverride = (AttributeOverrideAnnotation) typeResource.addSupportingAnnotation(1, JPA.ATTRIBUTE_OVERRIDE, JPA.ATTRIBUTE_OVERRIDES);
- attributeOverride.setName("BAR");
- assertSourceContains("@AttributeOverrides({@AttributeOverride(name = \"FOO\", column = @Column(name = \"FOO\", columnDefinition = \"BAR\", table = \"BAZ\", unique = false, nullable = false, insertable = false, updatable = false, length = 1, precision = 1, scale = 1)),@AttributeOverride(name = \"BAR\")})", cu);
-
- typeResource.removeSupportingAnnotation(1, JPA.ATTRIBUTE_OVERRIDE, JPA.ATTRIBUTE_OVERRIDES);
- assertSourceContains("@AttributeOverride(name = \"FOO\", column = @Column(name = \"FOO\", columnDefinition = \"BAR\", table = \"BAZ\", unique = false, nullable = false, insertable = false, updatable = false, length = 1, precision = 1, scale = 1))", cu);
- }
- //not sure i want to test this api, how can we keep ContainerAnnotation.add, move, remove from being public?
- //users should go throught AbstractJavapersistenceResource. this gets confusing because you would handle it differently
- //for non top-level annotations
-// public void testAdd() throws Exception {
-// ICompilationUnit cu = this.createTestType();
-// JavaPersistentTypeResource typeResource = buildJavaTypeResource(cu);
-// JavaPersistentAttributeResource attributeResource = typeResource.fields().next();
-// AttributeOverrides attributeOverrides = (AttributeOverrides) attributeResource.annotation(JPA.ATTRIBUTE_OVERRIDES);
-// assertNull(attributeOverrides);
-//
-// attributeResource.addAnnotation(JPA.ATTRIBUTE_OVERRIDES);
-// attributeOverrides = (AttributeOverrides) attributeResource.annotation(JPA.ATTRIBUTE_OVERRIDES);
-// assertNotNull(attributeOverrides);
-//
-// assertSourceContains("@AttributeOverrides");
-//
-// AttributeOverride fooAttributeOverride = attributeOverrides.add(0);
-// fooAttributeOverride.setName("Foo");
-//
-// assertSourceContains("@AttributeOverrides(@AttributeOverride(name=\"Foo\"))");
-//
-// AttributeOverride barAttributeOverride = attributeOverrides.add(0);
-// barAttributeOverride.setName("Bar");
-//
-// assertSourceContains("@AttributeOverrides({@AttributeOverride(name=\"Bar\"), @AttributeOverride(name=\"Foo\")})");
-//
-// }
-//
-// public void testMove() throws Exception {
-// ICompilationUnit cu = this.createTestAttributeOverrideWithColumnOnField();
-// JavaPersistentTypeResource typeResource = buildJavaTypeResource(cu);
-// JavaPersistentAttributeResource attributeResource = typeResource.fields().next();
-// AttributeOverrides attributeOverrides = (AttributeOverrides) attributeResource.annotation(JPA.ATTRIBUTE_OVERRIDES);
-//
-// AttributeOverride fooAttributeOverride = attributeOverrides.add(1);
-// fooAttributeOverride.setName("Foo");
-//
-// assertSourceContains("@AttributeOverrides({@AttributeOverride(name=\"" + ATTRIBUTE_OVERRIDE_NAME + "\"), @AttributeOverride(name=\"Foo\")})");
-//
-// attributeOverrides.move(0, 1);
-//
-// assertSourceContains("@AttributeOverrides({@AttributeOverride(name=\"Foo\"), @AttributeOverride(name=\"" + ATTRIBUTE_OVERRIDE_NAME + "\")})");
-// }
-//
-// public void testRemove() throws Exception {
-// ICompilationUnit cu = this.createTestAttributeOverrideWithColumnOnField();
-// JavaPersistentTypeResource typeResource = buildJavaTypeResource(cu);
-// JavaPersistentAttributeResource attributeResource = typeResource.fields().next();
-// AttributeOverrides attributeOverrides = (AttributeOverrides) attributeResource.annotation(JPA.ATTRIBUTE_OVERRIDES);
-//
-// AttributeOverride fooAttributeOverride = attributeOverrides.add(1);
-// fooAttributeOverride.setName("Foo");
-//
-// assertSourceContains("@AttributeOverrides({@AttributeOverride(name=\"" + ATTRIBUTE_OVERRIDE_NAME + "\"), @AttributeOverride(name=\"Foo\")})");
-//
-// attributeOverrides.remove(0);
-//
-// assertSourceContains("@AttributeOverrides(@AttributeOverride(name=\"Foo\"))");
-//
-// attributeOverrides.remove(0);
-//
-// assertSourceContains("@AttributeOverrides()");
-//
-// }
-
-
-
-}
diff --git a/jpa/tests/org.eclipse.jpt.core.tests/src/org/eclipse/jpt/core/tests/internal/resource/java/BasicTests.java b/jpa/tests/org.eclipse.jpt.core.tests/src/org/eclipse/jpt/core/tests/internal/resource/java/BasicTests.java
deleted file mode 100644
index f2077b9595..0000000000
--- a/jpa/tests/org.eclipse.jpt.core.tests/src/org/eclipse/jpt/core/tests/internal/resource/java/BasicTests.java
+++ /dev/null
@@ -1,151 +0,0 @@
-/*******************************************************************************
- * Copyright (c) 2007, 2009 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.
- *
- * Contributors:
- * Oracle - initial API and implementation
- ******************************************************************************/
-package org.eclipse.jpt.core.tests.internal.resource.java;
-
-import java.util.Iterator;
-import org.eclipse.jdt.core.ICompilationUnit;
-import org.eclipse.jpt.core.resource.java.BasicAnnotation;
-import org.eclipse.jpt.core.resource.java.FetchType;
-import org.eclipse.jpt.core.resource.java.JPA;
-import org.eclipse.jpt.core.resource.java.JavaResourcePersistentAttribute;
-import org.eclipse.jpt.core.resource.java.JavaResourcePersistentType;
-import org.eclipse.jpt.utility.internal.iterators.ArrayIterator;
-
-@SuppressWarnings("nls")
-public class BasicTests extends JavaResourceModelTestCase {
-
- public BasicTests(String name) {
- super(name);
- }
-
- private ICompilationUnit createTestBasic() throws Exception {
- return this.createTestType(new DefaultAnnotationWriter() {
- @Override
- public Iterator<String> imports() {
- return new ArrayIterator<String>(JPA.BASIC);
- }
- @Override
- public void appendIdFieldAnnotationTo(StringBuilder sb) {
- sb.append("@Basic");
- }
- });
- }
-
- private ICompilationUnit createTestBasicWithOptional() throws Exception {
- return this.createTestType(new DefaultAnnotationWriter() {
- @Override
- public Iterator<String> imports() {
- return new ArrayIterator<String>(JPA.BASIC);
- }
- @Override
- public void appendIdFieldAnnotationTo(StringBuilder sb) {
- sb.append("@Basic(optional = true)");
- }
- });
- }
-
- private ICompilationUnit createTestBasicWithFetch() throws Exception {
- return this.createTestType(new DefaultAnnotationWriter() {
- @Override
- public Iterator<String> imports() {
- return new ArrayIterator<String>(JPA.BASIC, JPA.FETCH_TYPE);
- }
- @Override
- public void appendIdFieldAnnotationTo(StringBuilder sb) {
- sb.append("@Basic(fetch = FetchType.EAGER)");
- }
- });
- }
-
- public void testBasic() throws Exception {
- ICompilationUnit cu = this.createTestBasic();
- JavaResourcePersistentType typeResource = buildJavaTypeResource(cu);
- JavaResourcePersistentAttribute attributeResource = typeResource.fields().next();
-
- BasicAnnotation basic = (BasicAnnotation) attributeResource.getMappingAnnotation(JPA.BASIC);
- assertNotNull(basic);
- }
-
- public void testGetOptional() throws Exception {
- ICompilationUnit cu = this.createTestBasicWithOptional();
- JavaResourcePersistentType typeResource = buildJavaTypeResource(cu);
- JavaResourcePersistentAttribute attributeResource = typeResource.fields().next();
-
- BasicAnnotation basic = (BasicAnnotation) attributeResource.getMappingAnnotation(JPA.BASIC);
- assertEquals(Boolean.TRUE, basic.getOptional());
- }
-
- public void testSetOptional() throws Exception {
- ICompilationUnit cu = this.createTestBasicWithOptional();
- JavaResourcePersistentType typeResource = buildJavaTypeResource(cu);
- JavaResourcePersistentAttribute attributeResource = typeResource.fields().next();
-
- BasicAnnotation basic = (BasicAnnotation) attributeResource.getMappingAnnotation(JPA.BASIC);
- assertEquals(Boolean.TRUE, basic.getOptional());
-
- basic.setOptional(Boolean.FALSE);
- assertEquals(Boolean.FALSE, basic.getOptional());
-
- assertSourceContains("@Basic(optional = false)", cu);
- }
-
- public void testSetOptionalNull() throws Exception {
- ICompilationUnit cu = this.createTestBasicWithOptional();
- JavaResourcePersistentType typeResource = buildJavaTypeResource(cu);
- JavaResourcePersistentAttribute attributeResource = typeResource.fields().next();
-
- BasicAnnotation basic = (BasicAnnotation) attributeResource.getMappingAnnotation(JPA.BASIC);
- assertEquals(Boolean.TRUE, basic.getOptional());
-
- basic.setOptional(null);
- assertNull(basic.getOptional());
-
- assertSourceContains("@Basic", cu);
- assertSourceDoesNotContain("optional", cu);
- }
-
- public void testGetFetch() throws Exception {
- ICompilationUnit cu = this.createTestBasicWithFetch();
- JavaResourcePersistentType typeResource = buildJavaTypeResource(cu);
- JavaResourcePersistentAttribute attributeResource = typeResource.fields().next();
-
- BasicAnnotation basic = (BasicAnnotation) attributeResource.getMappingAnnotation(JPA.BASIC);
- assertEquals(FetchType.EAGER, basic.getFetch());
- }
-
- public void testSetFetch() throws Exception {
- ICompilationUnit cu = this.createTestBasicWithFetch();
- JavaResourcePersistentType typeResource = buildJavaTypeResource(cu);
- JavaResourcePersistentAttribute attributeResource = typeResource.fields().next();
-
- BasicAnnotation basic = (BasicAnnotation) attributeResource.getMappingAnnotation(JPA.BASIC);
- assertEquals(FetchType.EAGER, basic.getFetch());
-
- basic.setFetch(FetchType.LAZY);
- assertEquals(FetchType.LAZY, basic.getFetch());
-
- assertSourceContains("@Basic(fetch = LAZY)", cu);
- }
-
- public void testSetFetchNull() throws Exception {
- ICompilationUnit cu = this.createTestBasicWithFetch();
- JavaResourcePersistentType typeResource = buildJavaTypeResource(cu);
- JavaResourcePersistentAttribute attributeResource = typeResource.fields().next();
-
- BasicAnnotation basic = (BasicAnnotation) attributeResource.getMappingAnnotation(JPA.BASIC);
- assertEquals(FetchType.EAGER, basic.getFetch());
-
- basic.setFetch(null);
- assertNull(basic.getFetch());
-
- assertSourceContains("@Basic", cu);
- assertSourceDoesNotContain("fetch", cu);
- }
-}
diff --git a/jpa/tests/org.eclipse.jpt.core.tests/src/org/eclipse/jpt/core/tests/internal/resource/java/ColumnTests.java b/jpa/tests/org.eclipse.jpt.core.tests/src/org/eclipse/jpt/core/tests/internal/resource/java/ColumnTests.java
deleted file mode 100644
index f82a4966ea..0000000000
--- a/jpa/tests/org.eclipse.jpt.core.tests/src/org/eclipse/jpt/core/tests/internal/resource/java/ColumnTests.java
+++ /dev/null
@@ -1,404 +0,0 @@
-/*******************************************************************************
- * Copyright (c) 2007, 2009 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.
- *
- * Contributors:
- * Oracle - initial API and implementation
- ******************************************************************************/
-package org.eclipse.jpt.core.tests.internal.resource.java;
-
-import java.util.Iterator;
-import org.eclipse.jdt.core.ICompilationUnit;
-import org.eclipse.jpt.core.resource.java.ColumnAnnotation;
-import org.eclipse.jpt.core.resource.java.JPA;
-import org.eclipse.jpt.core.resource.java.JavaResourcePersistentAttribute;
-import org.eclipse.jpt.core.resource.java.JavaResourcePersistentType;
-import org.eclipse.jpt.utility.internal.iterators.ArrayIterator;
-
-@SuppressWarnings("nls")
-public class ColumnTests extends JavaResourceModelTestCase {
-
- private static final String COLUMN_NAME = "MY_COLUMN";
- private static final String COLUMN_TABLE = "MY_TABLE";
- private static final String COLUMN_COLUMN_DEFINITION = "COLUMN_DEFINITION";
-
- public ColumnTests(String name) {
- super(name);
- }
-
- private ICompilationUnit createTestColumn() throws Exception {
- return this.createTestType(new DefaultAnnotationWriter() {
- @Override
- public Iterator<String> imports() {
- return new ArrayIterator<String>(JPA.COLUMN);
- }
- @Override
- public void appendIdFieldAnnotationTo(StringBuilder sb) {
- sb.append("@Column");
- }
- });
- }
-
- private ICompilationUnit createTestColumnWithName() throws Exception {
- return this.createTestType(new DefaultAnnotationWriter() {
- @Override
- public Iterator<String> imports() {
- return new ArrayIterator<String>(JPA.COLUMN);
- }
- @Override
- public void appendIdFieldAnnotationTo(StringBuilder sb) {
- sb.append("@Column(name = \"" + COLUMN_NAME + "\")");
- }
- });
- }
-
- private ICompilationUnit createTestColumnWithTable() throws Exception {
- return this.createTestType(new DefaultAnnotationWriter() {
- @Override
- public Iterator<String> imports() {
- return new ArrayIterator<String>(JPA.COLUMN);
- }
- @Override
- public void appendIdFieldAnnotationTo(StringBuilder sb) {
- sb.append("@Column(table = \"" + COLUMN_TABLE + "\")");
- }
- });
- }
-
- private ICompilationUnit createTestColumnWithColumnDefinition() throws Exception {
- return this.createTestType(new DefaultAnnotationWriter() {
- @Override
- public Iterator<String> imports() {
- return new ArrayIterator<String>(JPA.COLUMN);
- }
- @Override
- public void appendIdFieldAnnotationTo(StringBuilder sb) {
- sb.append("@Column(columnDefinition = \"" + COLUMN_COLUMN_DEFINITION + "\")");
- }
- });
- }
-
- private ICompilationUnit createTestColumnWithBooleanElement(final String booleanElement) throws Exception {
- return this.createTestType(new DefaultAnnotationWriter() {
- @Override
- public Iterator<String> imports() {
- return new ArrayIterator<String>(JPA.COLUMN);
- }
- @Override
- public void appendIdFieldAnnotationTo(StringBuilder sb) {
- sb.append("@Column(" + booleanElement + " = true)");
- }
- });
- }
-
- private ICompilationUnit createTestColumnWithIntElement(final String intElement) throws Exception {
- return this.createTestType(new DefaultAnnotationWriter() {
- @Override
- public Iterator<String> imports() {
- return new ArrayIterator<String>(JPA.COLUMN);
- }
- @Override
- public void appendIdFieldAnnotationTo(StringBuilder sb) {
- sb.append("@Column(" + intElement + " = 5)");
- }
- });
- }
-
- public void testGetName() throws Exception {
- ICompilationUnit cu = this.createTestColumnWithName();
- JavaResourcePersistentType typeResource = buildJavaTypeResource(cu);
- JavaResourcePersistentAttribute attributeResource = typeResource.fields().next();
- ColumnAnnotation column = (ColumnAnnotation) attributeResource.getSupportingAnnotation(JPA.COLUMN);
- assertNotNull(column);
- assertEquals(COLUMN_NAME, column.getName());
- }
-
- public void testGetNull() throws Exception {
- ICompilationUnit cu = this.createTestColumn();
- JavaResourcePersistentType typeResource = buildJavaTypeResource(cu);
- JavaResourcePersistentAttribute attributeResource = typeResource.fields().next();
- ColumnAnnotation column = (ColumnAnnotation) attributeResource.getSupportingAnnotation(JPA.COLUMN);
- assertNotNull(column);
- assertNull(column.getName());
- assertNull(column.getNullable());
- assertNull(column.getInsertable());
- assertNull(column.getUnique());
- assertNull(column.getUpdatable());
- assertNull(column.getTable());
- assertNull(column.getColumnDefinition());
- }
-
- public void testSetName() throws Exception {
- ICompilationUnit cu = this.createTestColumn();
- JavaResourcePersistentType typeResource = buildJavaTypeResource(cu);
- JavaResourcePersistentAttribute attributeResource = typeResource.fields().next();
- ColumnAnnotation column = (ColumnAnnotation) attributeResource.getSupportingAnnotation(JPA.COLUMN);
-
- assertNotNull(column);
- assertNull(column.getName());
-
- column.setName("Foo");
- assertEquals("Foo", column.getName());
-
- assertSourceContains("@Column(name = \"Foo\")", cu);
- }
-
- public void testSetNameNull() throws Exception {
- ICompilationUnit cu = this.createTestColumnWithName();
- JavaResourcePersistentType typeResource = buildJavaTypeResource(cu);
- JavaResourcePersistentAttribute attributeResource = typeResource.fields().next();
- ColumnAnnotation column = (ColumnAnnotation) attributeResource.getSupportingAnnotation(JPA.COLUMN);
-
- assertEquals(COLUMN_NAME, column.getName());
-
- column.setName(null);
- assertNull(column.getName());
-
- assertSourceDoesNotContain("@Column", cu);
- }
-
- public void testGetTable() throws Exception {
- ICompilationUnit cu = this.createTestColumnWithTable();
- JavaResourcePersistentType typeResource = buildJavaTypeResource(cu);
- JavaResourcePersistentAttribute attributeResource = typeResource.fields().next();
- ColumnAnnotation column = (ColumnAnnotation) attributeResource.getSupportingAnnotation(JPA.COLUMN);
- assertEquals(COLUMN_TABLE, column.getTable());
- }
-
- public void testSetTable() throws Exception {
- ICompilationUnit cu = this.createTestColumn();
- JavaResourcePersistentType typeResource = buildJavaTypeResource(cu);
- JavaResourcePersistentAttribute attributeResource = typeResource.fields().next();
- ColumnAnnotation column = (ColumnAnnotation) attributeResource.getSupportingAnnotation(JPA.COLUMN);
-
- assertNotNull(column);
- assertNull(column.getTable());
-
- column.setTable("Foo");
- assertEquals("Foo", column.getTable());
-
- assertSourceContains("@Column(table = \"Foo\")", cu);
-
-
- column.setTable(null);
- assertSourceDoesNotContain("@Column", cu);
- }
-
- public void testGetColumnDefinition() throws Exception {
- ICompilationUnit cu = this.createTestColumnWithColumnDefinition();
- JavaResourcePersistentType typeResource = buildJavaTypeResource(cu);
- JavaResourcePersistentAttribute attributeResource = typeResource.fields().next();
- ColumnAnnotation column = (ColumnAnnotation) attributeResource.getSupportingAnnotation(JPA.COLUMN);
- assertEquals(COLUMN_COLUMN_DEFINITION, column.getColumnDefinition());
- }
-
- public void testSetColumnDefinition() throws Exception {
- ICompilationUnit cu = this.createTestColumn();
- JavaResourcePersistentType typeResource = buildJavaTypeResource(cu);
- JavaResourcePersistentAttribute attributeResource = typeResource.fields().next();
- ColumnAnnotation column = (ColumnAnnotation) attributeResource.getSupportingAnnotation(JPA.COLUMN);
-
- assertNotNull(column);
- assertNull(column.getColumnDefinition());
-
- column.setColumnDefinition("Foo");
- assertEquals("Foo", column.getColumnDefinition());
-
- assertSourceContains("@Column(columnDefinition = \"Foo\")", cu);
-
-
- column.setColumnDefinition(null);
- assertSourceDoesNotContain("@Column", cu);
- }
-
- public void testGetUnique() throws Exception {
- ICompilationUnit cu = this.createTestColumnWithBooleanElement("unique");
- JavaResourcePersistentType typeResource = buildJavaTypeResource(cu);
- JavaResourcePersistentAttribute attributeResource = typeResource.fields().next();
- ColumnAnnotation column = (ColumnAnnotation) attributeResource.getSupportingAnnotation(JPA.COLUMN);
-
- assertEquals(Boolean.TRUE, column.getUnique());
- }
-
- public void testSetUnique() throws Exception {
- ICompilationUnit cu = this.createTestColumn();
- JavaResourcePersistentType typeResource = buildJavaTypeResource(cu);
- JavaResourcePersistentAttribute attributeResource = typeResource.fields().next();
- ColumnAnnotation column = (ColumnAnnotation) attributeResource.getSupportingAnnotation(JPA.COLUMN);
-
- assertNotNull(column);
- assertNull(column.getUnique());
-
- column.setUnique(Boolean.FALSE);
- assertEquals(Boolean.FALSE, column.getUnique());
-
- assertSourceContains("@Column(unique = false)", cu);
-
- column.setUnique(null);
- assertSourceDoesNotContain("@Column", cu);
- }
-
- public void testGetNullable() throws Exception {
- ICompilationUnit cu = this.createTestColumnWithBooleanElement("nullable");
- JavaResourcePersistentType typeResource = buildJavaTypeResource(cu);
- JavaResourcePersistentAttribute attributeResource = typeResource.fields().next();
- ColumnAnnotation column = (ColumnAnnotation) attributeResource.getSupportingAnnotation(JPA.COLUMN);
-
- assertEquals(Boolean.TRUE, column.getNullable());
- }
-
- public void testSetNullable() throws Exception {
- ICompilationUnit cu = this.createTestColumn();
- JavaResourcePersistentType typeResource = buildJavaTypeResource(cu);
- JavaResourcePersistentAttribute attributeResource = typeResource.fields().next();
- ColumnAnnotation column = (ColumnAnnotation) attributeResource.getSupportingAnnotation(JPA.COLUMN);
-
- assertNotNull(column);
- assertNull(column.getNullable());
-
- column.setNullable(Boolean.FALSE);
- assertEquals(Boolean.FALSE, column.getNullable());
-
- assertSourceContains("@Column(nullable = false)", cu);
-
- column.setNullable(null);
- assertSourceDoesNotContain("@Column", cu);
- }
-
- public void testGetInsertable() throws Exception {
- ICompilationUnit cu = this.createTestColumnWithBooleanElement("insertable");
- JavaResourcePersistentType typeResource = buildJavaTypeResource(cu);
- JavaResourcePersistentAttribute attributeResource = typeResource.fields().next();
- ColumnAnnotation column = (ColumnAnnotation) attributeResource.getSupportingAnnotation(JPA.COLUMN);
-
- assertEquals(Boolean.TRUE, column.getInsertable());
- }
-
- public void testSetInsertable() throws Exception {
- ICompilationUnit cu = this.createTestColumn();
- JavaResourcePersistentType typeResource = buildJavaTypeResource(cu);
- JavaResourcePersistentAttribute attributeResource = typeResource.fields().next();
- ColumnAnnotation column = (ColumnAnnotation) attributeResource.getSupportingAnnotation(JPA.COLUMN);
-
- assertNotNull(column);
- assertNull(column.getInsertable());
-
- column.setInsertable(Boolean.FALSE);
- assertEquals(Boolean.FALSE, column.getInsertable());
-
- assertSourceContains("@Column(insertable = false)", cu);
-
- column.setInsertable(null);
- assertSourceDoesNotContain("@Column", cu);
- }
-
- public void testGetUpdatable() throws Exception {
- ICompilationUnit cu = this.createTestColumnWithBooleanElement("updatable");
- JavaResourcePersistentType typeResource = buildJavaTypeResource(cu);
- JavaResourcePersistentAttribute attributeResource = typeResource.fields().next();
- ColumnAnnotation column = (ColumnAnnotation) attributeResource.getSupportingAnnotation(JPA.COLUMN);
-
- assertEquals(Boolean.TRUE, column.getUpdatable());
- }
-
- public void testSetUpdatable() throws Exception {
- ICompilationUnit cu = this.createTestColumn();
- JavaResourcePersistentType typeResource = buildJavaTypeResource(cu);
- JavaResourcePersistentAttribute attributeResource = typeResource.fields().next();
- ColumnAnnotation column = (ColumnAnnotation) attributeResource.getSupportingAnnotation(JPA.COLUMN);
-
- assertNotNull(column);
- assertNull(column.getUpdatable());
-
- column.setUpdatable(Boolean.FALSE);
- assertEquals(Boolean.FALSE, column.getUpdatable());
-
- assertSourceContains("@Column(updatable = false)", cu);
-
- column.setUpdatable(null);
- assertSourceDoesNotContain("@Column", cu);
- }
-
- public void testGetLength() throws Exception {
- ICompilationUnit cu = this.createTestColumnWithIntElement("length");
- JavaResourcePersistentType typeResource = buildJavaTypeResource(cu);
- JavaResourcePersistentAttribute attributeResource = typeResource.fields().next();
- ColumnAnnotation column = (ColumnAnnotation) attributeResource.getSupportingAnnotation(JPA.COLUMN);
-
- assertEquals(Integer.valueOf(5), column.getLength());
- }
-
- public void testSetLength() throws Exception {
- ICompilationUnit cu = this.createTestColumn();
- JavaResourcePersistentType typeResource = buildJavaTypeResource(cu);
- JavaResourcePersistentAttribute attributeResource = typeResource.fields().next();
- ColumnAnnotation column = (ColumnAnnotation) attributeResource.getSupportingAnnotation(JPA.COLUMN);
-
- assertNotNull(column);
- assertNull(column.getLength());
-
- column.setLength(Integer.valueOf(5));
- assertEquals(Integer.valueOf(5), column.getLength());
-
- assertSourceContains("@Column(length = 5)", cu);
-
- column.setLength(null);
- assertSourceDoesNotContain("@Column", cu);
- }
-
- public void testGetPrecision() throws Exception {
- ICompilationUnit cu = this.createTestColumnWithIntElement("precision");
- JavaResourcePersistentType typeResource = buildJavaTypeResource(cu);
- JavaResourcePersistentAttribute attributeResource = typeResource.fields().next();
- ColumnAnnotation column = (ColumnAnnotation) attributeResource.getSupportingAnnotation(JPA.COLUMN);
-
- assertEquals(Integer.valueOf(5), column.getPrecision());
- }
-
- public void testSetPrecision() throws Exception {
- ICompilationUnit cu = this.createTestColumn();
- JavaResourcePersistentType typeResource = buildJavaTypeResource(cu);
- JavaResourcePersistentAttribute attributeResource = typeResource.fields().next();
- ColumnAnnotation column = (ColumnAnnotation) attributeResource.getSupportingAnnotation(JPA.COLUMN);
-
- assertNotNull(column);
- assertEquals(null, column.getPrecision());
-
- column.setPrecision(Integer.valueOf(5));
- assertEquals(Integer.valueOf(5), column.getPrecision());
-
- assertSourceContains("@Column(precision = 5)", cu);
-
- column.setPrecision(null);
- assertSourceDoesNotContain("@Column", cu);
- }
-
- public void testGetScale() throws Exception {
- ICompilationUnit cu = this.createTestColumnWithIntElement("scale");
- JavaResourcePersistentType typeResource = buildJavaTypeResource(cu);
- JavaResourcePersistentAttribute attributeResource = typeResource.fields().next();
- ColumnAnnotation column = (ColumnAnnotation) attributeResource.getSupportingAnnotation(JPA.COLUMN);
-
- assertEquals(Integer.valueOf(5), column.getScale());
- }
-
- public void testSetScale() throws Exception {
- ICompilationUnit cu = this.createTestColumn();
- JavaResourcePersistentType typeResource = buildJavaTypeResource(cu);
- JavaResourcePersistentAttribute attributeResource = typeResource.fields().next();
- ColumnAnnotation column = (ColumnAnnotation) attributeResource.getSupportingAnnotation(JPA.COLUMN);
-
- assertNotNull(column);
- assertNull(column.getScale());
-
- column.setScale(Integer.valueOf(5));
- assertEquals(Integer.valueOf(5), column.getScale());
-
- assertSourceContains("@Column(scale = 5)", cu);
-
- column.setScale(null);
- assertSourceDoesNotContain("@Column", cu);
- }
-}
diff --git a/jpa/tests/org.eclipse.jpt.core.tests/src/org/eclipse/jpt/core/tests/internal/resource/java/DiscriminatorColumnTests.java b/jpa/tests/org.eclipse.jpt.core.tests/src/org/eclipse/jpt/core/tests/internal/resource/java/DiscriminatorColumnTests.java
deleted file mode 100644
index 3ca4deeb88..0000000000
--- a/jpa/tests/org.eclipse.jpt.core.tests/src/org/eclipse/jpt/core/tests/internal/resource/java/DiscriminatorColumnTests.java
+++ /dev/null
@@ -1,212 +0,0 @@
-/*******************************************************************************
- * Copyright (c) 2007, 2009 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.
- *
- * Contributors:
- * Oracle - initial API and implementation
- ******************************************************************************/
-package org.eclipse.jpt.core.tests.internal.resource.java;
-
-import java.util.Iterator;
-import org.eclipse.jdt.core.ICompilationUnit;
-import org.eclipse.jpt.core.resource.java.DiscriminatorColumnAnnotation;
-import org.eclipse.jpt.core.resource.java.DiscriminatorType;
-import org.eclipse.jpt.core.resource.java.JPA;
-import org.eclipse.jpt.core.resource.java.JavaResourcePersistentType;
-import org.eclipse.jpt.utility.internal.iterators.ArrayIterator;
-
-@SuppressWarnings("nls")
-public class DiscriminatorColumnTests extends JavaResourceModelTestCase {
-
- private static final String COLUMN_NAME = "MY_COLUMN";
- private static final String COLUMN_COLUMN_DEFINITION = "COLUMN_DEFINITION";
-
- public DiscriminatorColumnTests(String name) {
- super(name);
- }
-
- private ICompilationUnit createTestDiscriminatorColumn() throws Exception {
- return this.createTestType(new DefaultAnnotationWriter() {
- @Override
- public Iterator<String> imports() {
- return new ArrayIterator<String>(JPA.DISCRIMINATOR_COLUMN);
- }
- @Override
- public void appendTypeAnnotationTo(StringBuilder sb) {
- sb.append("@DiscriminatorColumn");
- }
- });
- }
-
- private ICompilationUnit createTestDiscriminatorColumnWithName() throws Exception {
- return this.createTestType(new DefaultAnnotationWriter() {
- @Override
- public Iterator<String> imports() {
- return new ArrayIterator<String>(JPA.DISCRIMINATOR_COLUMN);
- }
- @Override
- public void appendTypeAnnotationTo(StringBuilder sb) {
- sb.append("@DiscriminatorColumn(name = \"" + COLUMN_NAME + "\")");
- }
- });
- }
-
- private ICompilationUnit createTestDiscriminatorColumnWithColumnDefinition() throws Exception {
- return this.createTestType(new DefaultAnnotationWriter() {
- @Override
- public Iterator<String> imports() {
- return new ArrayIterator<String>(JPA.DISCRIMINATOR_COLUMN);
- }
- @Override
- public void appendTypeAnnotationTo(StringBuilder sb) {
- sb.append("@DiscriminatorColumn(columnDefinition = \"" + COLUMN_COLUMN_DEFINITION + "\")");
- }
- });
- }
-
- private ICompilationUnit createTestDiscriminatorColumnWithDiscriminatorType() throws Exception {
- return this.createTestType(new DefaultAnnotationWriter() {
- @Override
- public Iterator<String> imports() {
- return new ArrayIterator<String>(JPA.DISCRIMINATOR_COLUMN, JPA.DISCRIMINATOR_TYPE);
- }
- @Override
- public void appendTypeAnnotationTo(StringBuilder sb) {
- sb.append("@DiscriminatorColumn(discriminatorType = DiscriminatorType.CHAR)");
- }
- });
- }
-
- private ICompilationUnit createTestColumnWithIntElement(final String intElement) throws Exception {
- return this.createTestType(new DefaultAnnotationWriter() {
- @Override
- public Iterator<String> imports() {
- return new ArrayIterator<String>(JPA.DISCRIMINATOR_COLUMN);
- }
- @Override
- public void appendTypeAnnotationTo(StringBuilder sb) {
- sb.append("@DiscriminatorColumn(" + intElement + " = 5)");
- }
- });
- }
-
- public void testGetName() throws Exception {
- ICompilationUnit cu = this.createTestDiscriminatorColumnWithName();
- JavaResourcePersistentType typeResource = buildJavaTypeResource(cu);
- DiscriminatorColumnAnnotation column = (DiscriminatorColumnAnnotation) typeResource.getSupportingAnnotation(JPA.DISCRIMINATOR_COLUMN);
- assertNotNull(column);
- assertEquals(COLUMN_NAME, column.getName());
- }
-
- public void testGetNull() throws Exception {
- ICompilationUnit cu = this.createTestDiscriminatorColumn();
- JavaResourcePersistentType typeResource = buildJavaTypeResource(cu);
- DiscriminatorColumnAnnotation column = (DiscriminatorColumnAnnotation) typeResource.getSupportingAnnotation(JPA.DISCRIMINATOR_COLUMN);
- assertNotNull(column);
- assertNull(column.getName());
- assertNull(column.getDiscriminatorType());
- assertNull(column.getColumnDefinition());
- }
-
- public void testSetName() throws Exception {
- ICompilationUnit cu = this.createTestDiscriminatorColumn();
- JavaResourcePersistentType typeResource = buildJavaTypeResource(cu);
- DiscriminatorColumnAnnotation column = (DiscriminatorColumnAnnotation) typeResource.getSupportingAnnotation(JPA.DISCRIMINATOR_COLUMN);
-
- assertNotNull(column);
- assertNull(column.getName());
-
- column.setName("Foo");
- assertEquals("Foo", column.getName());
-
- assertSourceContains("@DiscriminatorColumn(name = \"Foo\")", cu);
- }
-
- public void testSetNameNull() throws Exception {
- ICompilationUnit cu = this.createTestDiscriminatorColumnWithName();
- JavaResourcePersistentType typeResource = buildJavaTypeResource(cu);
- DiscriminatorColumnAnnotation column = (DiscriminatorColumnAnnotation) typeResource.getSupportingAnnotation(JPA.DISCRIMINATOR_COLUMN);
-
- assertEquals(COLUMN_NAME, column.getName());
-
- column.setName(null);
- assertNull(column.getName());
-
- assertSourceDoesNotContain("@DiscriminatorColumn", cu);
- }
-
- public void testGetColumnDefinition() throws Exception {
- ICompilationUnit cu = this.createTestDiscriminatorColumnWithColumnDefinition();
- JavaResourcePersistentType typeResource = buildJavaTypeResource(cu);
- DiscriminatorColumnAnnotation column = (DiscriminatorColumnAnnotation) typeResource.getSupportingAnnotation(JPA.DISCRIMINATOR_COLUMN);
- assertEquals(COLUMN_COLUMN_DEFINITION, column.getColumnDefinition());
- }
-
- public void testSetColumnDefinition() throws Exception {
- ICompilationUnit cu = this.createTestDiscriminatorColumn();
- JavaResourcePersistentType typeResource = buildJavaTypeResource(cu);
- DiscriminatorColumnAnnotation column = (DiscriminatorColumnAnnotation) typeResource.getSupportingAnnotation(JPA.DISCRIMINATOR_COLUMN);
-
- assertNotNull(column);
- assertNull(column.getColumnDefinition());
-
- column.setColumnDefinition("Foo");
- assertEquals("Foo", column.getColumnDefinition());
-
- assertSourceContains("@DiscriminatorColumn(columnDefinition = \"Foo\")", cu);
-
-
- column.setColumnDefinition(null);
- assertSourceDoesNotContain("@DiscriminatorColumn", cu);
- }
-
- public void testGetLength() throws Exception {
- ICompilationUnit cu = this.createTestColumnWithIntElement("length");
- JavaResourcePersistentType typeResource = buildJavaTypeResource(cu);
- DiscriminatorColumnAnnotation column = (DiscriminatorColumnAnnotation) typeResource.getSupportingAnnotation(JPA.DISCRIMINATOR_COLUMN);
-
- assertEquals(Integer.valueOf(5), column.getLength());
- }
-
- public void testSetLength() throws Exception {
- ICompilationUnit cu = this.createTestDiscriminatorColumn();
- JavaResourcePersistentType typeResource = buildJavaTypeResource(cu);
- DiscriminatorColumnAnnotation column = (DiscriminatorColumnAnnotation) typeResource.getSupportingAnnotation(JPA.DISCRIMINATOR_COLUMN);
-
- assertNotNull(column);
- assertNull(column.getLength());
-
- column.setLength(Integer.valueOf(5));
- assertEquals(Integer.valueOf(5), column.getLength());
-
- assertSourceContains("@DiscriminatorColumn(length = 5)", cu);
-
- column.setLength(null);
- assertSourceDoesNotContain("@DiscriminatorColumn", cu);
- }
-
- public void testGetDiscriminatorType() throws Exception {
- ICompilationUnit cu = this.createTestDiscriminatorColumnWithDiscriminatorType();
- JavaResourcePersistentType typeResource = buildJavaTypeResource(cu);
- DiscriminatorColumnAnnotation column = (DiscriminatorColumnAnnotation) typeResource.getSupportingAnnotation(JPA.DISCRIMINATOR_COLUMN);
- assertEquals(DiscriminatorType.CHAR, column.getDiscriminatorType());
- }
-
- public void testSetDiscriminatorType() throws Exception {
- ICompilationUnit cu = this.createTestDiscriminatorColumn();
- JavaResourcePersistentType typeResource = buildJavaTypeResource(cu);
- DiscriminatorColumnAnnotation column = (DiscriminatorColumnAnnotation) typeResource.getSupportingAnnotation(JPA.DISCRIMINATOR_COLUMN);
-
- assertNull(column.getDiscriminatorType());
-
- column.setDiscriminatorType(DiscriminatorType.INTEGER);
- assertEquals(DiscriminatorType.INTEGER, column.getDiscriminatorType());
-
- assertSourceContains("@DiscriminatorColumn(discriminatorType = INTEGER)", cu);
-
- column.setDiscriminatorType(null);
- assertSourceDoesNotContain("@DiscriminatorColumn", cu);
- }
-}
diff --git a/jpa/tests/org.eclipse.jpt.core.tests/src/org/eclipse/jpt/core/tests/internal/resource/java/DiscriminatorValueTests.java b/jpa/tests/org.eclipse.jpt.core.tests/src/org/eclipse/jpt/core/tests/internal/resource/java/DiscriminatorValueTests.java
deleted file mode 100644
index c5beed484f..0000000000
--- a/jpa/tests/org.eclipse.jpt.core.tests/src/org/eclipse/jpt/core/tests/internal/resource/java/DiscriminatorValueTests.java
+++ /dev/null
@@ -1,83 +0,0 @@
-/*******************************************************************************
- * Copyright (c) 2007, 2009 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.
- *
- * Contributors:
- * Oracle - initial API and implementation
- ******************************************************************************/
-package org.eclipse.jpt.core.tests.internal.resource.java;
-
-import java.util.Iterator;
-import org.eclipse.jdt.core.ICompilationUnit;
-import org.eclipse.jpt.core.resource.java.DiscriminatorValueAnnotation;
-import org.eclipse.jpt.core.resource.java.JPA;
-import org.eclipse.jpt.core.resource.java.JavaResourcePersistentType;
-import org.eclipse.jpt.utility.internal.iterators.ArrayIterator;
-
-@SuppressWarnings("nls")
-public class DiscriminatorValueTests extends JavaResourceModelTestCase {
-
- public DiscriminatorValueTests(String name) {
- super(name);
- }
-
- private ICompilationUnit createTestDiscriminatorValue() throws Exception {
- return this.createTestType(new DefaultAnnotationWriter() {
- @Override
- public Iterator<String> imports() {
- return new ArrayIterator<String>(JPA.DISCRIMINATOR_VALUE);
- }
- @Override
- public void appendTypeAnnotationTo(StringBuilder sb) {
- sb.append("@DiscriminatorValue");
- }
- });
- }
-
- private ICompilationUnit createTestDiscriminatorValueWithValue() throws Exception {
- return this.createTestType(new DefaultAnnotationWriter() {
- @Override
- public Iterator<String> imports() {
- return new ArrayIterator<String>(JPA.DISCRIMINATOR_VALUE);
- }
- @Override
- public void appendTypeAnnotationTo(StringBuilder sb) {
- sb.append("@DiscriminatorValue(value = \"discriminator\")");
- }
- });
- }
-
- public void testDiscriminatorValue() throws Exception {
- ICompilationUnit cu = this.createTestDiscriminatorValue();
- JavaResourcePersistentType typeResource = buildJavaTypeResource(cu);
-
- DiscriminatorValueAnnotation discriminatorValue = (DiscriminatorValueAnnotation) typeResource.getSupportingAnnotation(JPA.DISCRIMINATOR_VALUE);
- assertNotNull(discriminatorValue);
- }
-
- public void testGetValue() throws Exception {
- ICompilationUnit cu = this.createTestDiscriminatorValueWithValue();
- JavaResourcePersistentType typeResource = buildJavaTypeResource(cu);
-
- DiscriminatorValueAnnotation discriminatorValue = (DiscriminatorValueAnnotation) typeResource.getSupportingAnnotation(JPA.DISCRIMINATOR_VALUE);
- assertEquals("discriminator", discriminatorValue.getValue());
- }
-
- public void testSetValue() throws Exception {
- ICompilationUnit cu = this.createTestDiscriminatorValue();
- JavaResourcePersistentType typeResource = buildJavaTypeResource(cu);
-
- DiscriminatorValueAnnotation discriminatorValue = (DiscriminatorValueAnnotation) typeResource.getSupportingAnnotation(JPA.DISCRIMINATOR_VALUE);
-
- discriminatorValue.setValue("foo");
-
- assertSourceContains("@DiscriminatorValue(\"foo\")", cu);
-
- discriminatorValue.setValue(null);
-
- assertSourceDoesNotContain("@DiscriminatorValue", cu);
- }
-
-}
diff --git a/jpa/tests/org.eclipse.jpt.core.tests/src/org/eclipse/jpt/core/tests/internal/resource/java/EmbeddableTests.java b/jpa/tests/org.eclipse.jpt.core.tests/src/org/eclipse/jpt/core/tests/internal/resource/java/EmbeddableTests.java
deleted file mode 100644
index 6ad9f3b0c8..0000000000
--- a/jpa/tests/org.eclipse.jpt.core.tests/src/org/eclipse/jpt/core/tests/internal/resource/java/EmbeddableTests.java
+++ /dev/null
@@ -1,74 +0,0 @@
-/*******************************************************************************
- * Copyright (c) 2007, 2009 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.
- *
- * Contributors:
- * Oracle - initial API and implementation
- ******************************************************************************/
-package org.eclipse.jpt.core.tests.internal.resource.java;
-
-import java.util.Iterator;
-import org.eclipse.jdt.core.ICompilationUnit;
-import org.eclipse.jpt.core.resource.java.EmbeddableAnnotation;
-import org.eclipse.jpt.core.resource.java.EntityAnnotation;
-import org.eclipse.jpt.core.resource.java.JPA;
-import org.eclipse.jpt.core.resource.java.JavaResourceNode;
-import org.eclipse.jpt.core.resource.java.JavaResourcePersistentType;
-import org.eclipse.jpt.utility.internal.iterators.ArrayIterator;
-
-@SuppressWarnings("nls")
-public class EmbeddableTests extends JavaResourceModelTestCase {
-
- public EmbeddableTests(String name) {
- super(name);
- }
-
- private ICompilationUnit createTestEmbeddable() throws Exception {
- return this.createTestType(new DefaultAnnotationWriter() {
- @Override
- public Iterator<String> imports() {
- return new ArrayIterator<String>(JPA.EMBEDDABLE);
- }
- @Override
- public void appendTypeAnnotationTo(StringBuilder sb) {
- sb.append("@Embeddable");
- }
- });
- }
-
- private ICompilationUnit createTestEmbeddableAndEntity() throws Exception {
- return this.createTestType(new DefaultAnnotationWriter() {
- @Override
- public Iterator<String> imports() {
- return new ArrayIterator<String>(JPA.EMBEDDABLE, JPA.ENTITY);
- }
- @Override
- public void appendTypeAnnotationTo(StringBuilder sb) {
- sb.append("@Entity");
- sb.append("@Embeddable");
- }
- });
- }
-
- public void testEmbeddable() throws Exception {
- ICompilationUnit cu = this.createTestEmbeddable();
- JavaResourcePersistentType typeResource = buildJavaTypeResource(cu);
-
- JavaResourceNode mappingAnnotation = typeResource.getMappingAnnotation();
- assertTrue(mappingAnnotation instanceof EmbeddableAnnotation);
- }
-
- public void testEmbeddableAndEntity() throws Exception {
- ICompilationUnit cu = this.createTestEmbeddableAndEntity();
- JavaResourcePersistentType typeResource = buildJavaTypeResource(cu);
-
- JavaResourceNode mappingAnnotation = typeResource.getMappingAnnotation();
- assertTrue(mappingAnnotation instanceof EmbeddableAnnotation);
-
- EntityAnnotation entity = (EntityAnnotation) typeResource.getMappingAnnotation(JPA.ENTITY);
- assertNotNull(entity);
- }
-
-}
diff --git a/jpa/tests/org.eclipse.jpt.core.tests/src/org/eclipse/jpt/core/tests/internal/resource/java/EmbeddedIdTests.java b/jpa/tests/org.eclipse.jpt.core.tests/src/org/eclipse/jpt/core/tests/internal/resource/java/EmbeddedIdTests.java
deleted file mode 100644
index 42acc30c0c..0000000000
--- a/jpa/tests/org.eclipse.jpt.core.tests/src/org/eclipse/jpt/core/tests/internal/resource/java/EmbeddedIdTests.java
+++ /dev/null
@@ -1,50 +0,0 @@
-/*******************************************************************************
- * Copyright (c) 2007, 2009 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.
- *
- * Contributors:
- * Oracle - initial API and implementation
- ******************************************************************************/
-package org.eclipse.jpt.core.tests.internal.resource.java;
-
-import java.util.Iterator;
-import org.eclipse.jdt.core.ICompilationUnit;
-import org.eclipse.jpt.core.resource.java.EmbeddedIdAnnotation;
-import org.eclipse.jpt.core.resource.java.JPA;
-import org.eclipse.jpt.core.resource.java.JavaResourceNode;
-import org.eclipse.jpt.core.resource.java.JavaResourcePersistentAttribute;
-import org.eclipse.jpt.core.resource.java.JavaResourcePersistentType;
-import org.eclipse.jpt.utility.internal.iterators.ArrayIterator;
-
-@SuppressWarnings("nls")
-public class EmbeddedIdTests extends JavaResourceModelTestCase {
-
- public EmbeddedIdTests(String name) {
- super(name);
- }
-
- private ICompilationUnit createTestEmbeddedId() throws Exception {
- return this.createTestType(new DefaultAnnotationWriter() {
- @Override
- public Iterator<String> imports() {
- return new ArrayIterator<String>(JPA.EMBEDDED_ID);
- }
- @Override
- public void appendIdFieldAnnotationTo(StringBuilder sb) {
- sb.append("@EmbeddedId");
- }
- });
- }
-
- public void testEmbeddedId() throws Exception {
- ICompilationUnit cu = this.createTestEmbeddedId();
- JavaResourcePersistentType typeResource = buildJavaTypeResource(cu);
- JavaResourcePersistentAttribute attributeResource = typeResource.fields().next();
-
- JavaResourceNode mappingAnnotation = attributeResource.getMappingAnnotation();
- assertTrue(mappingAnnotation instanceof EmbeddedIdAnnotation);
- }
-
-}
diff --git a/jpa/tests/org.eclipse.jpt.core.tests/src/org/eclipse/jpt/core/tests/internal/resource/java/EmbeddedTests.java b/jpa/tests/org.eclipse.jpt.core.tests/src/org/eclipse/jpt/core/tests/internal/resource/java/EmbeddedTests.java
deleted file mode 100644
index f34354a840..0000000000
--- a/jpa/tests/org.eclipse.jpt.core.tests/src/org/eclipse/jpt/core/tests/internal/resource/java/EmbeddedTests.java
+++ /dev/null
@@ -1,50 +0,0 @@
-/*******************************************************************************
- * Copyright (c) 2007, 2009 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.
- *
- * Contributors:
- * Oracle - initial API and implementation
- ******************************************************************************/
-package org.eclipse.jpt.core.tests.internal.resource.java;
-
-import java.util.Iterator;
-import org.eclipse.jdt.core.ICompilationUnit;
-import org.eclipse.jpt.core.resource.java.EmbeddedAnnotation;
-import org.eclipse.jpt.core.resource.java.JPA;
-import org.eclipse.jpt.core.resource.java.JavaResourceNode;
-import org.eclipse.jpt.core.resource.java.JavaResourcePersistentAttribute;
-import org.eclipse.jpt.core.resource.java.JavaResourcePersistentType;
-import org.eclipse.jpt.utility.internal.iterators.ArrayIterator;
-
-@SuppressWarnings("nls")
-public class EmbeddedTests extends JavaResourceModelTestCase {
-
- public EmbeddedTests(String name) {
- super(name);
- }
-
- private ICompilationUnit createTestEmbedded() throws Exception {
- return this.createTestType(new DefaultAnnotationWriter() {
- @Override
- public Iterator<String> imports() {
- return new ArrayIterator<String>(JPA.EMBEDDED);
- }
- @Override
- public void appendIdFieldAnnotationTo(StringBuilder sb) {
- sb.append("@Embedded");
- }
- });
- }
-
- public void testEmbedded() throws Exception {
- ICompilationUnit cu = this.createTestEmbedded();
- JavaResourcePersistentType typeResource = buildJavaTypeResource(cu);
- JavaResourcePersistentAttribute attributeResource = typeResource.fields().next();
-
- JavaResourceNode mappingAnnotation = attributeResource.getMappingAnnotation();
- assertTrue(mappingAnnotation instanceof EmbeddedAnnotation);
- }
-
-}
diff --git a/jpa/tests/org.eclipse.jpt.core.tests/src/org/eclipse/jpt/core/tests/internal/resource/java/EntityTests.java b/jpa/tests/org.eclipse.jpt.core.tests/src/org/eclipse/jpt/core/tests/internal/resource/java/EntityTests.java
deleted file mode 100644
index 6297416b63..0000000000
--- a/jpa/tests/org.eclipse.jpt.core.tests/src/org/eclipse/jpt/core/tests/internal/resource/java/EntityTests.java
+++ /dev/null
@@ -1,125 +0,0 @@
-/*******************************************************************************
- * Copyright (c) 2007, 2009 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.
- *
- * Contributors:
- * Oracle - initial API and implementation
- ******************************************************************************/
-package org.eclipse.jpt.core.tests.internal.resource.java;
-
-import java.util.Iterator;
-import org.eclipse.jdt.core.ICompilationUnit;
-import org.eclipse.jpt.core.resource.java.EntityAnnotation;
-import org.eclipse.jpt.core.resource.java.JPA;
-import org.eclipse.jpt.core.resource.java.JavaResourceNode;
-import org.eclipse.jpt.core.resource.java.JavaResourcePersistentType;
-import org.eclipse.jpt.core.resource.java.MappedSuperclassAnnotation;
-import org.eclipse.jpt.utility.internal.iterators.ArrayIterator;
-
-@SuppressWarnings("nls")
-public class EntityTests extends JavaResourceModelTestCase {
-
- private static final String ENTITY_NAME = "Foo";
-
- public EntityTests(String name) {
- super(name);
- }
-
- private ICompilationUnit createTestEntity() 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");
- }
- });
- }
-
- private ICompilationUnit createTestEntityWithName() 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(name = \"" + ENTITY_NAME + "\")");
- }
- });
- }
-
- private ICompilationUnit createTestMappedSuperclassAndEntity() throws Exception {
- return this.createTestType(new DefaultAnnotationWriter() {
- @Override
- public Iterator<String> imports() {
- return new ArrayIterator<String>(JPA.MAPPED_SUPERCLASS, JPA.ENTITY);
- }
- @Override
- public void appendTypeAnnotationTo(StringBuilder sb) {
- sb.append("@MappedSuperclass");
- sb.append("@Entity");
- }
- });
- }
-
- public void testGetName() throws Exception {
- ICompilationUnit cu = this.createTestEntityWithName();
- JavaResourcePersistentType typeResource = buildJavaTypeResource(cu);
-
- EntityAnnotation entity = (EntityAnnotation) typeResource.getMappingAnnotation(JPA.ENTITY);
- assertTrue(entity != null);
- assertEquals(ENTITY_NAME, entity.getName());
- }
-
- public void testGetNameNull() throws Exception {
- ICompilationUnit cu = this.createTestEntity();
- JavaResourcePersistentType typeResource = buildJavaTypeResource(cu);
-
- EntityAnnotation entity = (EntityAnnotation) typeResource.getMappingAnnotation(JPA.ENTITY);
- assertTrue(entity != null);
- assertNull(entity.getName());
- }
-
- public void testSetName() throws Exception {
- ICompilationUnit cu = this.createTestEntity();
- JavaResourcePersistentType typeResource = buildJavaTypeResource(cu);
-
- EntityAnnotation entity = (EntityAnnotation) typeResource.getMappingAnnotation(JPA.ENTITY);
- assertNull(entity.getName());
- entity.setName("Foo");
- assertEquals("Foo", entity.getName());
-
- assertSourceContains("@Entity(name = \"Foo\")", cu);
- }
-
- public void testSetNameNull() throws Exception {
- ICompilationUnit cu = this.createTestEntityWithName();
- JavaResourcePersistentType typeResource = buildJavaTypeResource(cu);
-
- EntityAnnotation entity = (EntityAnnotation) typeResource.getMappingAnnotation(JPA.ENTITY);
- assertEquals(ENTITY_NAME, entity.getName());
-
- entity.setName(null);
- assertNull(entity.getName());
-
- assertSourceContains("@Entity", cu);
- assertSourceDoesNotContain("@Entity(name = \"Foo\")", cu);
- }
-
- public void testMappedSuperclassAndEntity() throws Exception {
- ICompilationUnit cu = this.createTestMappedSuperclassAndEntity();
- JavaResourcePersistentType typeResource = buildJavaTypeResource(cu);
-
- JavaResourceNode mappingAnnotation = typeResource.getMappingAnnotation();
- assertTrue(mappingAnnotation instanceof EntityAnnotation);
-
- MappedSuperclassAnnotation mappedSuperclass = (MappedSuperclassAnnotation) typeResource.getMappingAnnotation(JPA.MAPPED_SUPERCLASS);
- assertNotNull(mappedSuperclass);
- }
-
-}
diff --git a/jpa/tests/org.eclipse.jpt.core.tests/src/org/eclipse/jpt/core/tests/internal/resource/java/EnumeratedTests.java b/jpa/tests/org.eclipse.jpt.core.tests/src/org/eclipse/jpt/core/tests/internal/resource/java/EnumeratedTests.java
deleted file mode 100644
index 919676c0f0..0000000000
--- a/jpa/tests/org.eclipse.jpt.core.tests/src/org/eclipse/jpt/core/tests/internal/resource/java/EnumeratedTests.java
+++ /dev/null
@@ -1,89 +0,0 @@
-/*******************************************************************************
- * Copyright (c) 2007, 2009 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.
- *
- * Contributors:
- * Oracle - initial API and implementation
- ******************************************************************************/
-package org.eclipse.jpt.core.tests.internal.resource.java;
-
-import java.util.Iterator;
-import org.eclipse.jdt.core.ICompilationUnit;
-import org.eclipse.jpt.core.resource.java.EnumType;
-import org.eclipse.jpt.core.resource.java.EnumeratedAnnotation;
-import org.eclipse.jpt.core.resource.java.JPA;
-import org.eclipse.jpt.core.resource.java.JavaResourcePersistentAttribute;
-import org.eclipse.jpt.core.resource.java.JavaResourcePersistentType;
-import org.eclipse.jpt.utility.internal.iterators.ArrayIterator;
-
-@SuppressWarnings("nls")
-public class EnumeratedTests extends JavaResourceModelTestCase {
-
- public EnumeratedTests(String name) {
- super(name);
- }
-
- private ICompilationUnit createTestEnumerated() throws Exception {
- return this.createTestType(new DefaultAnnotationWriter() {
- @Override
- public Iterator<String> imports() {
- return new ArrayIterator<String>(JPA.ENUMERATED);
- }
- @Override
- public void appendIdFieldAnnotationTo(StringBuilder sb) {
- sb.append("@Enumerated");
- }
- });
- }
-
- private ICompilationUnit createTestEnumeratedWithValue() throws Exception {
- return this.createTestType(new DefaultAnnotationWriter() {
- @Override
- public Iterator<String> imports() {
- return new ArrayIterator<String>(JPA.ENUMERATED, JPA.ENUM_TYPE);
- }
- @Override
- public void appendIdFieldAnnotationTo(StringBuilder sb) {
- sb.append("@Enumerated(EnumType.ORDINAL)");
- }
- });
- }
-
- public void testEnumerated() throws Exception {
- ICompilationUnit cu = this.createTestEnumerated();
- JavaResourcePersistentType typeResource = buildJavaTypeResource(cu);
- JavaResourcePersistentAttribute attributeResource = typeResource.fields().next();
-
- EnumeratedAnnotation enumerated = (EnumeratedAnnotation) attributeResource.getSupportingAnnotation(JPA.ENUMERATED);
- assertNotNull(enumerated);
- }
-
- public void testGetValue() throws Exception {
- ICompilationUnit cu = this.createTestEnumeratedWithValue();
- JavaResourcePersistentType typeResource = buildJavaTypeResource(cu);
- JavaResourcePersistentAttribute attributeResource = typeResource.fields().next();
-
- EnumeratedAnnotation enumerated = (EnumeratedAnnotation) attributeResource.getSupportingAnnotation(JPA.ENUMERATED);
- assertEquals(EnumType.ORDINAL, enumerated.getValue());
- }
-
- public void testSetValue() throws Exception {
- ICompilationUnit cu = this.createTestEnumerated();
- JavaResourcePersistentType typeResource = buildJavaTypeResource(cu);
- JavaResourcePersistentAttribute attributeResource = typeResource.fields().next();
-
- EnumeratedAnnotation enumerated = (EnumeratedAnnotation) attributeResource.getSupportingAnnotation(JPA.ENUMERATED);
-
- enumerated.setValue(EnumType.STRING);
-
- assertSourceContains("@Enumerated(STRING)", cu);
-
- enumerated.setValue(null);
-
- assertSourceDoesNotContain("@Enumerated(", cu);
- assertSourceContains("@Enumerated", cu);
- }
-
-}
diff --git a/jpa/tests/org.eclipse.jpt.core.tests/src/org/eclipse/jpt/core/tests/internal/resource/java/GeneratedValueTests.java b/jpa/tests/org.eclipse.jpt.core.tests/src/org/eclipse/jpt/core/tests/internal/resource/java/GeneratedValueTests.java
deleted file mode 100644
index e65a912113..0000000000
--- a/jpa/tests/org.eclipse.jpt.core.tests/src/org/eclipse/jpt/core/tests/internal/resource/java/GeneratedValueTests.java
+++ /dev/null
@@ -1,133 +0,0 @@
-/*******************************************************************************
- * Copyright (c) 2007, 2009 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.
- *
- * Contributors:
- * Oracle - initial API and implementation
- ******************************************************************************/
-package org.eclipse.jpt.core.tests.internal.resource.java;
-
-import java.util.Iterator;
-import org.eclipse.jdt.core.ICompilationUnit;
-import org.eclipse.jpt.core.resource.java.GeneratedValueAnnotation;
-import org.eclipse.jpt.core.resource.java.GenerationType;
-import org.eclipse.jpt.core.resource.java.JPA;
-import org.eclipse.jpt.core.resource.java.JavaResourcePersistentAttribute;
-import org.eclipse.jpt.core.resource.java.JavaResourcePersistentType;
-import org.eclipse.jpt.utility.internal.iterators.ArrayIterator;
-
-@SuppressWarnings("nls")
-public class GeneratedValueTests extends JavaResourceModelTestCase {
-
- private static final String GENERATOR = "MY_GENERATOR";
- public GeneratedValueTests(String name) {
- super(name);
- }
-
- private ICompilationUnit createTestGeneratedValue() throws Exception {
- return this.createTestType(new DefaultAnnotationWriter() {
- @Override
- public Iterator<String> imports() {
- return new ArrayIterator<String>(JPA.GENERATED_VALUE, JPA.GENERATION_TYPE);
- }
- @Override
- public void appendIdFieldAnnotationTo(StringBuilder sb) {
- sb.append("@GeneratedValue");
- }
- });
- }
-
- private ICompilationUnit createTestGeneratedValueWithGenerator() throws Exception {
- return this.createTestType(new DefaultAnnotationWriter() {
- @Override
- public Iterator<String> imports() {
- return new ArrayIterator<String>(JPA.GENERATED_VALUE, JPA.GENERATION_TYPE);
- }
- @Override
- public void appendIdFieldAnnotationTo(StringBuilder sb) {
- sb.append("@GeneratedValue(generator = \"" + GENERATOR + "\")");
- }
- });
- }
-
- private ICompilationUnit createTestGeneratedValueWithStrategy() throws Exception {
- return this.createTestType(new DefaultAnnotationWriter() {
- @Override
- public Iterator<String> imports() {
- return new ArrayIterator<String>(JPA.GENERATED_VALUE, JPA.GENERATION_TYPE);
- }
- @Override
- public void appendIdFieldAnnotationTo(StringBuilder sb) {
- sb.append("@GeneratedValue(strategy = GenerationType.SEQUENCE)");
- }
- });
- }
-
- public void testGeneratedValue() throws Exception {
- ICompilationUnit cu = this.createTestGeneratedValue();
- JavaResourcePersistentType typeResource = buildJavaTypeResource(cu);
- JavaResourcePersistentAttribute attributeResource = typeResource.fields().next();
-
- GeneratedValueAnnotation generatedValue = (GeneratedValueAnnotation) attributeResource.getSupportingAnnotation(JPA.GENERATED_VALUE);
- assertNotNull(generatedValue);
- }
-
- public void testGetGenerator() throws Exception {
- ICompilationUnit cu = this.createTestGeneratedValueWithGenerator();
- JavaResourcePersistentType typeResource = buildJavaTypeResource(cu);
- JavaResourcePersistentAttribute attributeResource = typeResource.fields().next();
-
- GeneratedValueAnnotation generatedValue = (GeneratedValueAnnotation) attributeResource.getSupportingAnnotation(JPA.GENERATED_VALUE);
- assertEquals(GENERATOR, generatedValue.getGenerator());
- }
-
- public void testSetGenerator() throws Exception {
- ICompilationUnit cu = this.createTestGeneratedValueWithGenerator();
- JavaResourcePersistentType typeResource = buildJavaTypeResource(cu);
- JavaResourcePersistentAttribute attributeResource = typeResource.fields().next();
-
- GeneratedValueAnnotation generatedValue = (GeneratedValueAnnotation) attributeResource.getSupportingAnnotation(JPA.GENERATED_VALUE);
- assertEquals(GENERATOR, generatedValue.getGenerator());
-
- generatedValue.setGenerator("foo");
- assertEquals("foo", generatedValue.getGenerator());
-
- assertSourceContains("@GeneratedValue(generator = \"foo\")", cu);
-
- generatedValue.setGenerator(null);
- assertNull(generatedValue.getGenerator());
-
- assertSourceDoesNotContain("generator", cu);
- assertSourceContains("@GeneratedValue", cu);
- }
-
- public void testGetStrategy() throws Exception {
- ICompilationUnit cu = this.createTestGeneratedValueWithStrategy();
- JavaResourcePersistentType typeResource = buildJavaTypeResource(cu);
- JavaResourcePersistentAttribute attributeResource = typeResource.fields().next();
-
- GeneratedValueAnnotation generatedValue = (GeneratedValueAnnotation) attributeResource.getSupportingAnnotation(JPA.GENERATED_VALUE);
- assertEquals(GenerationType.SEQUENCE, generatedValue.getStrategy());
- }
-
- public void testSetStrategy() throws Exception {
- ICompilationUnit cu = this.createTestGeneratedValueWithStrategy();
- JavaResourcePersistentType typeResource = buildJavaTypeResource(cu);
- JavaResourcePersistentAttribute attributeResource = typeResource.fields().next();
-
- GeneratedValueAnnotation generatedValue = (GeneratedValueAnnotation) attributeResource.getSupportingAnnotation(JPA.GENERATED_VALUE);
- assertEquals(GenerationType.SEQUENCE, generatedValue.getStrategy());
-
- generatedValue.setStrategy(GenerationType.TABLE);
- assertEquals(GenerationType.TABLE, generatedValue.getStrategy());
-
- assertSourceContains("@GeneratedValue(strategy = TABLE)", cu);
-
- generatedValue.setStrategy(null);
- assertNull(generatedValue.getStrategy());
- assertSourceDoesNotContain("strategy", cu);
- assertSourceContains("@GeneratedValue", cu);
- }
-}
diff --git a/jpa/tests/org.eclipse.jpt.core.tests/src/org/eclipse/jpt/core/tests/internal/resource/java/IdClassTests.java b/jpa/tests/org.eclipse.jpt.core.tests/src/org/eclipse/jpt/core/tests/internal/resource/java/IdClassTests.java
deleted file mode 100644
index c6ce1260ff..0000000000
--- a/jpa/tests/org.eclipse.jpt.core.tests/src/org/eclipse/jpt/core/tests/internal/resource/java/IdClassTests.java
+++ /dev/null
@@ -1,106 +0,0 @@
-/*******************************************************************************
- * Copyright (c) 2007, 2009 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.
- *
- * Contributors:
- * Oracle - initial API and implementation
- ******************************************************************************/
-package org.eclipse.jpt.core.tests.internal.resource.java;
-
-import java.util.Iterator;
-import org.eclipse.jdt.core.ICompilationUnit;
-import org.eclipse.jpt.core.resource.java.IdClassAnnotation;
-import org.eclipse.jpt.core.resource.java.JPA;
-import org.eclipse.jpt.core.resource.java.JavaResourcePersistentType;
-import org.eclipse.jpt.utility.internal.iterators.ArrayIterator;
-
-@SuppressWarnings("nls")
-public class IdClassTests extends JavaResourceModelTestCase {
-
- private static final String ID_CLASS_VALUE = "MyClass";
-
- public IdClassTests(String name) {
- super(name);
- }
-
- private ICompilationUnit createTestIdClass() throws Exception {
- return this.createTestType(new DefaultAnnotationWriter() {
- @Override
- public Iterator<String> imports() {
- return new ArrayIterator<String>(JPA.ID_CLASS);
- }
- @Override
- public void appendTypeAnnotationTo(StringBuilder sb) {
- sb.append("@IdClass");
- }
- });
- }
-
- private ICompilationUnit createTestIdClassWithValue() throws Exception {
- return this.createTestType(new DefaultAnnotationWriter() {
- @Override
- public Iterator<String> imports() {
- return new ArrayIterator<String>(JPA.ID_CLASS);
- }
- @Override
- public void appendTypeAnnotationTo(StringBuilder sb) {
- sb.append("@IdClass(" + ID_CLASS_VALUE + ".class)");
- }
- });
- }
-
- public void testIdClass() throws Exception {
- ICompilationUnit cu = this.createTestIdClass();
- JavaResourcePersistentType typeResource = buildJavaTypeResource(cu);
-
- IdClassAnnotation idClass = (IdClassAnnotation) typeResource.getSupportingAnnotation(JPA.ID_CLASS);
- assertNotNull(idClass);
- assertNull(idClass.getValue());
- }
-
- public void testGetValue() throws Exception {
- ICompilationUnit cu = this.createTestIdClassWithValue();
- JavaResourcePersistentType typeResource = buildJavaTypeResource(cu);
-
- IdClassAnnotation idClass = (IdClassAnnotation) typeResource.getSupportingAnnotation(JPA.ID_CLASS);
- assertEquals(ID_CLASS_VALUE, idClass.getValue());
- }
-
- public void testSetValue() throws Exception {
- ICompilationUnit cu = this.createTestIdClassWithValue();
- JavaResourcePersistentType typeResource = buildJavaTypeResource(cu);
-
- IdClassAnnotation idClass = (IdClassAnnotation) typeResource.getSupportingAnnotation(JPA.ID_CLASS);
- assertEquals(ID_CLASS_VALUE, idClass.getValue());
-
- idClass.setValue("foo");
- assertEquals("foo", idClass.getValue());
-
- assertSourceContains("@IdClass(foo.class)", cu);
-
- idClass.setValue(null);
-
- assertSourceDoesNotContain("@IdClass", cu);
-
- idClass = (IdClassAnnotation) typeResource.getSupportingAnnotation(JPA.ID_CLASS);
- assertNull(idClass);
- }
-
- public void testGetFullyQualifiedClass() throws Exception {
- ICompilationUnit cu = this.createTestIdClassWithValue();
- JavaResourcePersistentType typeResource = buildJavaTypeResource(cu);
-
- IdClassAnnotation idClass = (IdClassAnnotation) typeResource.getSupportingAnnotation(JPA.ID_CLASS);
- assertNotNull(idClass.getValue());
- assertEquals("MyClass", idClass.getFullyQualifiedClassName()); //bug 196200 changed this
-
-
- idClass.setValue(TYPE_NAME);
-
- assertEquals(FULLY_QUALIFIED_TYPE_NAME, idClass.getFullyQualifiedClassName());
- assertSourceContains("@IdClass(" + TYPE_NAME + ".class)", cu);
- }
-
-}
diff --git a/jpa/tests/org.eclipse.jpt.core.tests/src/org/eclipse/jpt/core/tests/internal/resource/java/IdTests.java b/jpa/tests/org.eclipse.jpt.core.tests/src/org/eclipse/jpt/core/tests/internal/resource/java/IdTests.java
deleted file mode 100644
index 3574e4d649..0000000000
--- a/jpa/tests/org.eclipse.jpt.core.tests/src/org/eclipse/jpt/core/tests/internal/resource/java/IdTests.java
+++ /dev/null
@@ -1,50 +0,0 @@
-/*******************************************************************************
- * Copyright (c) 2007, 2009 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.
- *
- * Contributors:
- * Oracle - initial API and implementation
- ******************************************************************************/
-package org.eclipse.jpt.core.tests.internal.resource.java;
-
-import java.util.Iterator;
-import org.eclipse.jdt.core.ICompilationUnit;
-import org.eclipse.jpt.core.resource.java.IdAnnotation;
-import org.eclipse.jpt.core.resource.java.JPA;
-import org.eclipse.jpt.core.resource.java.JavaResourceNode;
-import org.eclipse.jpt.core.resource.java.JavaResourcePersistentAttribute;
-import org.eclipse.jpt.core.resource.java.JavaResourcePersistentType;
-import org.eclipse.jpt.utility.internal.iterators.ArrayIterator;
-
-@SuppressWarnings("nls")
-public class IdTests extends JavaResourceModelTestCase {
-
- public IdTests(String name) {
- super(name);
- }
-
- private ICompilationUnit createTestId() throws Exception {
- return this.createTestType(new DefaultAnnotationWriter() {
- @Override
- public Iterator<String> imports() {
- return new ArrayIterator<String>(JPA.ID);
- }
- @Override
- public void appendIdFieldAnnotationTo(StringBuilder sb) {
- sb.append("@Id");
- }
- });
- }
-
- public void testId() throws Exception {
- ICompilationUnit cu = this.createTestId();
- JavaResourcePersistentType typeResource = buildJavaTypeResource(cu);
- JavaResourcePersistentAttribute attributeResource = typeResource.fields().next();
-
- JavaResourceNode mappingAnnotation = attributeResource.getMappingAnnotation();
- assertTrue(mappingAnnotation instanceof IdAnnotation);
- }
-
-}
diff --git a/jpa/tests/org.eclipse.jpt.core.tests/src/org/eclipse/jpt/core/tests/internal/resource/java/InheritanceTests.java b/jpa/tests/org.eclipse.jpt.core.tests/src/org/eclipse/jpt/core/tests/internal/resource/java/InheritanceTests.java
deleted file mode 100644
index d3901a3956..0000000000
--- a/jpa/tests/org.eclipse.jpt.core.tests/src/org/eclipse/jpt/core/tests/internal/resource/java/InheritanceTests.java
+++ /dev/null
@@ -1,83 +0,0 @@
-/*******************************************************************************
- * Copyright (c) 2007, 2008 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.
- *
- * Contributors:
- * Oracle - initial API and implementation
- ******************************************************************************/
-package org.eclipse.jpt.core.tests.internal.resource.java;
-
-import java.util.Iterator;
-import org.eclipse.jdt.core.ICompilationUnit;
-import org.eclipse.jpt.core.resource.java.InheritanceAnnotation;
-import org.eclipse.jpt.core.resource.java.InheritanceType;
-import org.eclipse.jpt.core.resource.java.JPA;
-import org.eclipse.jpt.core.resource.java.JavaResourcePersistentType;
-import org.eclipse.jpt.utility.internal.iterators.ArrayIterator;
-
-@SuppressWarnings("nls")
-public class InheritanceTests extends JavaResourceModelTestCase {
-
- public InheritanceTests(String name) {
- super(name);
- }
-
- private ICompilationUnit createTestInheritance() throws Exception {
- return this.createTestType(new DefaultAnnotationWriter() {
- @Override
- public Iterator<String> imports() {
- return new ArrayIterator<String>(JPA.INHERITANCE);
- }
- @Override
- public void appendTypeAnnotationTo(StringBuilder sb) {
- sb.append("@Inheritance");
- }
- });
- }
-
- private ICompilationUnit createTestInheritanceWithStrategy() throws Exception {
- return this.createTestType(new DefaultAnnotationWriter() {
- @Override
- public Iterator<String> imports() {
- return new ArrayIterator<String>(JPA.INHERITANCE, JPA.INHERITANCE_TYPE);
- }
- @Override
- public void appendTypeAnnotationTo(StringBuilder sb) {
- sb.append("@Inheritance(strategy = InheritanceType.JOINED)");
- }
- });
- }
-
- public void testInheritance() throws Exception {
- ICompilationUnit cu = this.createTestInheritance();
- JavaResourcePersistentType typeResource = buildJavaTypeResource(cu);
-
- InheritanceAnnotation inheritance = (InheritanceAnnotation) typeResource.getSupportingAnnotation(JPA.INHERITANCE);
- assertNotNull(inheritance);
- }
-
- public void testGetStrategy() throws Exception {
- ICompilationUnit cu = this.createTestInheritanceWithStrategy();
- JavaResourcePersistentType typeResource = buildJavaTypeResource(cu);
-
- InheritanceAnnotation inheritance = (InheritanceAnnotation) typeResource.getSupportingAnnotation(JPA.INHERITANCE);
- assertEquals(InheritanceType.JOINED, inheritance.getStrategy());
- }
-
- public void testSetStrategy() throws Exception {
- ICompilationUnit cu = this.createTestInheritance();
- JavaResourcePersistentType typeResource = buildJavaTypeResource(cu);
-
- InheritanceAnnotation inheritance = (InheritanceAnnotation) typeResource.getSupportingAnnotation(JPA.INHERITANCE);
- inheritance.setStrategy(InheritanceType.TABLE_PER_CLASS);
-
- assertSourceContains("@Inheritance(strategy = TABLE_PER_CLASS)", cu);
-
- inheritance.setStrategy(null);
-
- assertSourceDoesNotContain("@Inheritance", cu);
- }
-
-}
diff --git a/jpa/tests/org.eclipse.jpt.core.tests/src/org/eclipse/jpt/core/tests/internal/resource/java/JPTToolsTests.java b/jpa/tests/org.eclipse.jpt.core.tests/src/org/eclipse/jpt/core/tests/internal/resource/java/JPTToolsTests.java
deleted file mode 100644
index 2a1e78605d..0000000000
--- a/jpa/tests/org.eclipse.jpt.core.tests/src/org/eclipse/jpt/core/tests/internal/resource/java/JPTToolsTests.java
+++ /dev/null
@@ -1,479 +0,0 @@
-/*******************************************************************************
- * Copyright (c) 2007, 2009 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.
- *
- * Contributors:
- * Oracle - initial API and implementation
- ******************************************************************************/
-package org.eclipse.jpt.core.tests.internal.resource.java;
-
-import java.util.Iterator;
-
-import org.eclipse.jdt.core.ICompilationUnit;
-import org.eclipse.jdt.core.dom.CompilationUnit;
-import org.eclipse.jpt.core.utility.jdt.FieldAttribute;
-import org.eclipse.jpt.core.utility.jdt.MethodAttribute;
-import org.eclipse.jpt.core.utility.jdt.Type;
-import org.eclipse.jpt.utility.internal.iterators.ArrayIterator;
-
-@SuppressWarnings("nls")
-public class JPTToolsTests extends JavaResourceModelTestCase {
-
- public JPTToolsTests(String name) {
- super(name);
- }
-
- private ICompilationUnit createTestTypeFieldWithModifier(final String modifier) throws Exception {
- return this.createTestType(new DefaultAnnotationWriter() {
-
- @Override
- public void appendIdFieldAnnotationTo(StringBuilder sb) {
- sb.append(CR);
- sb.append(" " + modifier + " String foo;").append(CR);
- sb.append(CR);
- }
- });
- }
-
- protected FieldAttribute fooField(ICompilationUnit cu) {
- return this.buildField("foo", cu);
- }
-
-
- private ICompilationUnit createTestTypeGetMethodWithModifier(final String modifier) throws Exception {
- return this.createTestType(new DefaultAnnotationWriter() {
-
- @Override
- public void appendGetIdMethodAnnotationTo(StringBuilder sb) {
- sb.append(CR);
- sb.append(" " + modifier + " int getFoo() {").append(CR);
- sb.append(" return this.id;").append(CR);
- sb.append(" }").append(CR);
- sb.append(CR);
- sb.append(" public void setFoo(int id) {").append(CR);
- sb.append(" this.id = id;").append(CR);
- sb.append(" }").append(CR);
- sb.append(CR);
- }
- });
- }
-
- private ICompilationUnit createTestTypeInvalidMethodName() throws Exception {
- return this.createTestType(new DefaultAnnotationWriter() {
-
- @Override
- public void appendGetIdMethodAnnotationTo(StringBuilder sb) {
- sb.append(CR);
- sb.append(" public int foo() {").append(CR);
- sb.append(" return this.id;").append(CR);
- sb.append(" }").append(CR);
- sb.append(CR);
- sb.append(" public void setFoo(int id) {").append(CR);
- sb.append(" this.id = id;").append(CR);
- sb.append(" }").append(CR);
- sb.append(CR);
- }
- });
- }
-
- private ICompilationUnit createTestTypeConstructor() throws Exception {
- return this.createTestType(new DefaultAnnotationWriter() {
-
- @Override
- public void appendGetIdMethodAnnotationTo(StringBuilder sb) {
- sb.append(CR);
- sb.append(" public " + TYPE_NAME + "() {").append(CR);
- sb.append(" super();").append(CR);
- sb.append(" }").append(CR);
- sb.append(CR);
- }
- });
- }
-
- private ICompilationUnit createTestTypeVoidMethodReturnType() throws Exception {
- return this.createTestType(new DefaultAnnotationWriter() {
-
- @Override
- public void appendGetIdMethodAnnotationTo(StringBuilder sb) {
- sb.append(CR);
- sb.append(" public void getFoo() {").append(CR);
- sb.append(" return this.id;").append(CR);
- sb.append(" }").append(CR);
- sb.append(CR);
- sb.append(" public void setFoo(int id) {").append(CR);
- sb.append(" this.id = id;").append(CR);
- sb.append(" }").append(CR);
- sb.append(CR);
- }
- });
- }
-
- private ICompilationUnit createTestTypeInvalidMethodReturnType() throws Exception {
- return this.createTestType(new DefaultAnnotationWriter() {
-
- @Override
- public Iterator<String> imports() {
- return new ArrayIterator<String>("com.foo.Foo");
- }
- @Override
- public void appendGetIdMethodAnnotationTo(StringBuilder sb) {
- sb.append(CR);
- sb.append(" public Foo getFoo() {").append(CR);
- sb.append(" return null;").append(CR);
- sb.append(" }").append(CR);
- sb.append(CR);
- sb.append(" public void setFoo(Foo id) {").append(CR);
- sb.append(" this.id = id;").append(CR);
- sb.append(" }").append(CR);
- sb.append(CR);
- }
- });
- }
-
- private ICompilationUnit createTestTypeIsMethod() throws Exception {
- return this.createTestType(new DefaultAnnotationWriter() {
-
- @Override
- public void appendGetIdMethodAnnotationTo(StringBuilder sb) {
- sb.append(CR);
- sb.append(" public boolean isFoo() {").append(CR);
- sb.append(" return this.id;").append(CR);
- sb.append(" }").append(CR);
- sb.append(CR);
- sb.append(" public void setFoo(boolean id) {").append(CR);
- sb.append(" this.id = id;").append(CR);
- sb.append(" }").append(CR);
- sb.append(CR);
- }
- });
- }
-
- private ICompilationUnit createTestTypeIsMethodReturnInt() throws Exception {
- return this.createTestType(new DefaultAnnotationWriter() {
-
- @Override
- public void appendGetIdMethodAnnotationTo(StringBuilder sb) {
- sb.append(CR);
- sb.append(" public int isFoo() {").append(CR);
- sb.append(" return this.id;").append(CR);
- sb.append(" }").append(CR);
- sb.append(CR);
- sb.append(" public void setFoo(int id) {").append(CR);
- sb.append(" this.id = id;").append(CR);
- sb.append(" }").append(CR);
- sb.append(CR);
- }
- });
- }
-
- private ICompilationUnit createTestTypeIsAndGetMethodWithModifier(final String modifier) throws Exception {
- return this.createTestType(new DefaultAnnotationWriter() {
-
- @Override
- public void appendGetIdMethodAnnotationTo(StringBuilder sb) {
- sb.append(CR);
- sb.append(" " + modifier + " boolean isFoo() {").append(CR);
- sb.append(" return this.id;").append(CR);
- sb.append(" }").append(CR);
- sb.append(CR);
- sb.append(" " + modifier + " boolean getFoo() {").append(CR);
- sb.append(" return this.id;").append(CR);
- sb.append(" }").append(CR);
- sb.append(CR);
- sb.append(" public void setFoo(boolean id) {").append(CR);
- sb.append(" this.id = id;").append(CR);
- sb.append(" }").append(CR);
- sb.append(CR);
- }
- });
- }
-
- private ICompilationUnit createTestTypeSetMethodWithModifier(final String modifier) throws Exception {
- return this.createTestType(new DefaultAnnotationWriter() {
-
- @Override
- public void appendGetIdMethodAnnotationTo(StringBuilder sb) {
- sb.append(CR);
- sb.append(" public int getFoo() {").append(CR);
- sb.append(" return this.id;").append(CR);
- sb.append(" }").append(CR);
- sb.append(CR);
- sb.append(" " + modifier + " void setFoo(int id) {").append(CR);
- sb.append(" this.id = id;").append(CR);
- sb.append(" }").append(CR);
- sb.append(CR);
- }
- });
- }
-
- private ICompilationUnit createTestTypeWithMemberTypes() throws Exception {
- return this.createTestType(new DefaultAnnotationWriter() {
- @Override
- public void appendMemberTypeTo(StringBuilder sb) {
- sb.append(" public static class FooStatic {}").append(CR);
- sb.append(CR);
- sb.append(" public class FooNotStatic {}").append(CR);
- sb.append(CR);
- sb.append(" public @interface MyAnnotation {}").append(CR);
- sb.append(CR);
- sb.append(" public enum MyEnum {}").append(CR);
- }
- });
- }
-
- protected MethodAttribute fooMethod(ICompilationUnit cu) {
- return this.buildMethod("getFoo", cu);
- }
-
- //private String foo; - persistable
- public void testFieldIsPersistable1() throws Exception {
- ICompilationUnit cu = createTestTypeFieldWithModifier("private");
- FieldAttribute fieldAttribute = fooField(cu);
- assertTrue(fieldAttribute.isPersistable(this.buildASTRoot(cu)));
- }
-
- //private static String foo; - not persistable
- public void testFieldIsPersistable2() throws Exception {
- ICompilationUnit cu = createTestTypeFieldWithModifier("private static");
- FieldAttribute fieldAttribute = fooField(cu);
- assertFalse(fieldAttribute.isPersistable(this.buildASTRoot(cu)));
- }
-
- //private transient String foo; - not persistable
- public void testFieldIsPersistable3() throws Exception {
- ICompilationUnit cu = createTestTypeFieldWithModifier("private transient");
- FieldAttribute fieldAttribute = fooField(cu);
- assertFalse(fieldAttribute.isPersistable(this.buildASTRoot(cu)));
- }
-
- //private final String foo; - persistable
- public void testFieldIsPersistable4() throws Exception {
- ICompilationUnit cu = createTestTypeFieldWithModifier("private final");
- FieldAttribute fieldAttribute = fooField(cu);
- assertTrue(fieldAttribute.isPersistable(this.buildASTRoot(cu)));
- }
-
- //public String foo; - persistable
- public void testFieldIsPersistable5() throws Exception {
- ICompilationUnit cu = createTestTypeFieldWithModifier("public");
- FieldAttribute fieldAttribute = fooField(cu);
- assertTrue(fieldAttribute.isPersistable(this.buildASTRoot(cu)));
- }
-
-
- //public int getFoo() {} - persistable
- public void testMethodIsPersistablePropertyGetter01() throws Exception {
- ICompilationUnit cu = createTestTypeGetMethodWithModifier("public");
- MethodAttribute methodAttribute = fooMethod(cu);
- assertTrue(methodAttribute.isPersistable(this.buildASTRoot(cu)));
- }
-
- //protected int getFoo() {} - persistable
- public void testMethodIsPersistablePropertyGetter02() throws Exception {
- ICompilationUnit cu = createTestTypeGetMethodWithModifier("protected");
- MethodAttribute methodAttribute = fooMethod(cu);
- assertTrue(methodAttribute.isPersistable(this.buildASTRoot(cu)));
- }
-
- //int getFoo() {} - not persistable
- public void testMethodIsPersistablePropertyGetter03() throws Exception {
- ICompilationUnit cu = createTestTypeGetMethodWithModifier("");
- MethodAttribute methodAttribute = fooMethod(cu);
- assertFalse(methodAttribute.isPersistable(this.buildASTRoot(cu)));
- }
-
- //private int getFoo() {} - not persistable
- public void testMethodIsPersistablePropertyGetter04() throws Exception {
- ICompilationUnit cu = createTestTypeGetMethodWithModifier("private");
- MethodAttribute methodAttribute = fooMethod(cu);
- assertFalse(methodAttribute.isPersistable(this.buildASTRoot(cu)));
- }
-
- //public static int getFoo() {} - not persistable
- public void testMethodIsPersistablePropertyGetter05() throws Exception {
- ICompilationUnit cu = createTestTypeGetMethodWithModifier("public static");
- MethodAttribute methodAttribute = fooMethod(cu);
- assertFalse(methodAttribute.isPersistable(this.buildASTRoot(cu)));
- }
-
- //public final int getFoo() {} - not persistable
- public void testMethodIsPersistablePropertyGetter06() throws Exception {
- ICompilationUnit cu = createTestTypeGetMethodWithModifier("public final");
- MethodAttribute methodAttribute = fooMethod(cu);
- assertFalse(methodAttribute.isPersistable(this.buildASTRoot(cu)));
- }
-
- //public void setFoo(int foo) {} - persistable
- public void testMethodIsPersistablePropertyGetter07() throws Exception {
- ICompilationUnit cu = createTestTypeSetMethodWithModifier("public");
- MethodAttribute methodAttribute = fooMethod(cu);
- assertTrue(methodAttribute.isPersistable(this.buildASTRoot(cu)));
- }
-
- //protected void setFoo(int foo) {} - persistable
- public void testMethodIsPersistablePropertyGetter08() throws Exception {
- ICompilationUnit cu = createTestTypeSetMethodWithModifier("protected");
- MethodAttribute methodAttribute = fooMethod(cu);
- assertTrue(methodAttribute.isPersistable(this.buildASTRoot(cu)));
- }
-
- //void setFoo(int foo) {} - not persistable
- public void testMethodIsPersistablePropertyGetter09() throws Exception {
- ICompilationUnit cu = createTestTypeSetMethodWithModifier("");
- MethodAttribute methodAttribute = fooMethod(cu);
- assertFalse(methodAttribute.isPersistable(this.buildASTRoot(cu)));
- }
-
- //private void setFoo(int foo) {} - not persistable
- public void testMethodIsPersistablePropertyGetter10() throws Exception {
- ICompilationUnit cu = createTestTypeSetMethodWithModifier("private");
- MethodAttribute methodAttribute = fooMethod(cu);
- assertFalse(methodAttribute.isPersistable(this.buildASTRoot(cu)));
- }
-
- //public static void setFoo(int foo) {} - not persistable
- public void testMethodIsPersistablePropertyGetter11() throws Exception {
- ICompilationUnit cu = createTestTypeSetMethodWithModifier("public static");
- MethodAttribute methodAttribute = fooMethod(cu);
- assertFalse(methodAttribute.isPersistable(this.buildASTRoot(cu)));
- }
-
- //public final void setFoo(int foo) {} - not persistable
- public void testMethodIsPersistablePropertyGetter12() throws Exception {
- ICompilationUnit cu = createTestTypeSetMethodWithModifier("public final");
- MethodAttribute methodAttribute = fooMethod(cu);
- assertFalse(methodAttribute.isPersistable(this.buildASTRoot(cu)));
- }
-
- //public boolean isFoo() {} - persistable
- public void testMethodIsPersistablePropertyGetter13() throws Exception {
- ICompilationUnit cu = createTestTypeIsMethod();
- MethodAttribute methodAttribute = this.buildMethod("isFoo", cu);
- assertTrue(methodAttribute.isPersistable(this.buildASTRoot(cu)));
- }
-
- //public int isFoo() {} - not persistable
- public void testMethodIsPersistablePropertyGetter14() throws Exception {
- ICompilationUnit cu = createTestTypeIsMethodReturnInt();
- MethodAttribute methodAttribute = this.buildMethod("isFoo", cu);
- assertFalse(methodAttribute.isPersistable(this.buildASTRoot(cu)));
- }
-
- //public int isFoo() {} - persistable
- //public int getFoo() {} - not persistable
- public void testMethodIsPersistablePropertyGetter15() throws Exception {
- ICompilationUnit cu = createTestTypeIsAndGetMethodWithModifier("public");
- MethodAttribute isFooMethod = this.buildMethod("isFoo", cu);
- MethodAttribute getFooMethod = this.buildMethod("getFoo", cu);
-
- CompilationUnit astRoot = this.buildASTRoot(cu);
- assertTrue(isFooMethod.isPersistable(astRoot));
- assertFalse(getFooMethod.isPersistable(astRoot));
- }
-
- //public int foo() {} - not persistable
- public void testMethodIsPersistablePropertyGetter16() throws Exception {
- ICompilationUnit cu = createTestTypeInvalidMethodName();
- MethodAttribute fooMethod = this.buildMethod("foo", cu);
- assertFalse(fooMethod.isPersistable(this.buildASTRoot(cu)));
- }
-
- //public void getFoo() {} - not persistable - void return type
- public void testMethodIsPersistablePropertyGetter17() throws Exception {
- ICompilationUnit cu = createTestTypeVoidMethodReturnType();
- MethodAttribute fooMethod = this.buildMethod("getFoo", cu);
- assertFalse(fooMethod.isPersistable(this.buildASTRoot(cu)));
- }
-
- //public Foo getFoo() {} - persistable??? - Foo does not resolve
- public void testMethodIsPersistablePropertyGetter18() throws Exception {
- ICompilationUnit cu = createTestTypeInvalidMethodReturnType();
- MethodAttribute getFooMethod = this.buildMethod("getFoo", cu);
- assertTrue(getFooMethod.isPersistable(this.buildASTRoot(cu)));
- }
-
- //method with parameters - not persistable
- public void testMethodIsPersistablePropertyGetter19() throws Exception {
- ICompilationUnit cu = createTestType();
- MethodAttribute setIdMethod = idSetMethod(cu);
- assertFalse(setIdMethod.isPersistable(this.buildASTRoot(cu)));
- }
-
- //constructor - not persistable
- public void testMethodIsPersistablePropertyGetter20() throws Exception {
- ICompilationUnit cu = createTestTypeConstructor();
- MethodAttribute constructor = buildMethod(TYPE_NAME, cu);
- assertFalse(constructor.isPersistable(this.buildASTRoot(cu)));
- }
-
- //no corresponding set method - not persistable
- public void testMethodIsPersistablePropertyGetter21() throws Exception {
- ICompilationUnit cu = createTestType();
- MethodAttribute getNameMethod = nameGetMethod(cu);
- assertFalse(getNameMethod.isPersistable(this.buildASTRoot(cu)));
- }
-
- //public class AnnotationTestType
- public void testTypeIsPersistable1() throws Exception {
- ICompilationUnit cu = createTestType();
- Type type = testType(cu);
- CompilationUnit astRoot = this.buildASTRoot(cu);
- assertTrue(type.isPersistable(astRoot));
- }
-
- //public final class MyFinal
- public void testTypeIsPersistable2() throws Exception {
- ICompilationUnit cu = this.javaProject.createCompilationUnit("finals", "MyFinal.java", "public final class MyFinal { }");
- Type type = buildType("MyFinal", cu);
- CompilationUnit astRoot = this.buildASTRoot(cu);
- assertFalse(type.isPersistable(astRoot));
- }
-
- //public interface MyInterface
- public void testTypeIsPersistable3() throws Exception {
- ICompilationUnit cu = this.javaProject.createCompilationUnit("interfaces", "MyInterface.java", "public interface MyInterface { }");
- Type type = buildType("MyInterface", cu);
- CompilationUnit astRoot = this.buildASTRoot(cu);
- assertFalse(type.isPersistable(astRoot));
- }
-
- //enum not persistable
- public void testTypeIsPersistable4() throws Exception {
- ICompilationUnit cu = this.createEnumAndMembers("TestEnum", "FOO, BAR, BAZ");
- Type type = buildType("TestEnum", cu);
- CompilationUnit astRoot = this.buildASTRoot(cu);
- assertFalse(type.isPersistable(astRoot));
- }
-
- //annotation not persistable
- public void testTypeIsPersistable5() throws Exception {
- ICompilationUnit cu = this.createAnnotationAndMembers("TestAnnotation", "TestEnum foo();");
- Type type = buildType("TestAnnotation", cu);
- CompilationUnit astRoot = this.buildASTRoot(cu);
- assertFalse(type.isPersistable(astRoot));
- }
-
- //public static member type is persistable
- public void testTypeIsPersistable6() throws Exception {
- ICompilationUnit cu = this.createTestTypeWithMemberTypes();
- Type testType = this.testType(cu);
- Type memberType = this.buildType(testType, "FooStatic", 1, cu);
- CompilationUnit astRoot = this.buildASTRoot(cu);
- assertTrue(memberType.isPersistable(astRoot));
- }
-
- //non-static member type is not persistable
- public void testTypeIsPersistable7() throws Exception {
- ICompilationUnit cu = this.createTestTypeWithMemberTypes();
- Type testType = this.testType(cu);
- Type memberType = this.buildType(testType, "FooNotStatic", 1, cu);
- CompilationUnit astRoot = this.buildASTRoot(cu);
- assertFalse(memberType.isPersistable(astRoot));
- }
- //TODO still need to test typeIsPersistable() returns false for local and anonymous classes
-
-
-}
-
diff --git a/jpa/tests/org.eclipse.jpt.core.tests/src/org/eclipse/jpt/core/tests/internal/resource/java/JavaResourceModelTestCase.java b/jpa/tests/org.eclipse.jpt.core.tests/src/org/eclipse/jpt/core/tests/internal/resource/java/JavaResourceModelTestCase.java
deleted file mode 100644
index e8d156f345..0000000000
--- a/jpa/tests/org.eclipse.jpt.core.tests/src/org/eclipse/jpt/core/tests/internal/resource/java/JavaResourceModelTestCase.java
+++ /dev/null
@@ -1,171 +0,0 @@
-/*******************************************************************************
- * Copyright (c) 2007, 2009 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.
- *
- * Contributors:
- * Oracle - initial API and implementation
- ******************************************************************************/
-package org.eclipse.jpt.core.tests.internal.resource.java;
-
-import org.eclipse.jdt.core.ElementChangedEvent;
-import org.eclipse.jdt.core.ICompilationUnit;
-import org.eclipse.jdt.core.IElementChangedListener;
-import org.eclipse.jdt.core.IJavaElement;
-import org.eclipse.jdt.core.IJavaElementDelta;
-import org.eclipse.jdt.core.JavaCore;
-import org.eclipse.jpt.core.JpaAnnotationDefinitionProvider;
-import org.eclipse.jpt.core.JpaAnnotationProvider;
-import org.eclipse.jpt.core.internal.platform.GenericJpaAnnotationDefinitionProvider;
-import org.eclipse.jpt.core.internal.platform.GenericJpaAnnotationProvider;
-import org.eclipse.jpt.core.internal.resource.java.source.SourceCompilationUnit;
-import org.eclipse.jpt.core.internal.utility.jdt.NullAnnotationEditFormatter;
-import org.eclipse.jpt.core.resource.java.JavaResourceCompilationUnit;
-import org.eclipse.jpt.core.resource.java.JavaResourcePersistentType;
-import org.eclipse.jpt.core.tests.internal.projects.TestJpaProject;
-import org.eclipse.jpt.core.tests.internal.utility.jdt.AnnotationTestCase;
-import org.eclipse.jpt.utility.CommandExecutor;
-import org.eclipse.jpt.utility.internal.BitTools;
-import org.eclipse.jpt.utility.internal.ClassTools;
-import org.eclipse.jpt.utility.internal.StringTools;
-
-@SuppressWarnings("nls")
-public class JavaResourceModelTestCase extends AnnotationTestCase
-{
- public static final String JAVAX_PERSISTENCE_PACKAGE_NAME = "javax.persistence"; //$NON-NLS-1$
-
- private JavaElementChangeListener javaElementChangeListener;
- protected JavaResourceCompilationUnit javaResourceCompilationUnit;
-
-
- public JavaResourceModelTestCase(String name) {
- super(name);
- }
- @Override
- protected void setUp() throws Exception {
- super.setUp();
- this.javaProject.addJar(TestJpaProject.jpaJarName());
- if (TestJpaProject.eclipseLinkJarName() != null) {
- this.javaProject.addJar(TestJpaProject.eclipseLinkJarName());
- }
- this.javaElementChangeListener = new JavaElementChangeListener();
- JavaCore.addElementChangedListener(this.javaElementChangeListener);
- }
-
- @Override
- protected void tearDown() throws Exception {
- super.tearDown();
- JavaCore.removeElementChangedListener(this.javaElementChangeListener);
- this.javaElementChangeListener = null;
- }
-
- /**
- * Forward the Java element change event back to the JPA model manager.
- */
- private class JavaElementChangeListener implements IElementChangedListener {
- JavaElementChangeListener() {
- super();
- }
- public void elementChanged(ElementChangedEvent event) {
- JavaResourceModelTestCase.this.javaElementChanged(event);
- }
- @Override
- public String toString() {
- return StringTools.buildToStringFor(this);
- }
- }
-
- void javaElementChanged(ElementChangedEvent event) {
- if (this.javaResourceCompilationUnit == null) {
- return;
- }
- this.synchWithJavaDelta(event.getDelta());
- }
-
- /**
- * NB: this is copied from GenericJpaProject, so it might need to be
- * kept in synch with that code if it changes... yech...
- */
- protected void synchWithJavaDelta(IJavaElementDelta delta) {
- switch (delta.getElement().getElementType()) {
- case IJavaElement.JAVA_MODEL :
- case IJavaElement.JAVA_PROJECT :
- case IJavaElement.PACKAGE_FRAGMENT_ROOT :
- case IJavaElement.PACKAGE_FRAGMENT :
- this.synchWithJavaDeltaChildren(delta);
- break;
- case IJavaElement.COMPILATION_UNIT :
- this.javaCompilationUnitChanged(delta);
- break;
- default :
- break; // ignore the elements inside a compilation unit
- }
- }
-
- protected void synchWithJavaDeltaChildren(IJavaElementDelta delta) {
- for (IJavaElementDelta child : delta.getAffectedChildren()) {
- this.synchWithJavaDelta(child); // recurse
- }
- }
-
- protected void javaCompilationUnitChanged(IJavaElementDelta delta) {
- if (this.deltaIsRelevant(delta)) {
- this.javaResourceCompilationUnit.update();
- }
- }
-
- protected boolean deltaIsRelevant(IJavaElementDelta delta) {
- if (BitTools.onlyFlagIsSet(delta.getFlags(), IJavaElementDelta.F_PRIMARY_WORKING_COPY)) {
- return false;
- }
- return delta.getKind() == IJavaElementDelta.CHANGED;
- }
-
- protected ICompilationUnit createAnnotationAndMembers(String annotationName, String annotationBody) throws Exception {
- return createAnnotationAndMembers(JAVAX_PERSISTENCE_PACKAGE_NAME, annotationName, annotationBody);
- }
-
- protected ICompilationUnit createAnnotationAndMembers(String packageName, String annotationName, String annotationBody) throws Exception {
- return this.javaProject.createCompilationUnit(packageName, annotationName + ".java", "public @interface " + annotationName + " { " + annotationBody + " }");
- }
-
- protected ICompilationUnit createEnumAndMembers(String enumName, String enumBody) throws Exception {
- return createEnumAndMembers(JAVAX_PERSISTENCE_PACKAGE_NAME, enumName, enumBody);
- }
-
- protected ICompilationUnit createEnumAndMembers(String packageName, String enumName, String enumBody) throws Exception {
- return this.javaProject.createCompilationUnit(packageName, enumName + ".java", "public enum " + enumName + " { " + enumBody + " }");
- }
-
- protected JavaResourcePersistentType buildJavaTypeResource(ICompilationUnit cu) {
- this.javaResourceCompilationUnit = this.buildJavaResourceCompilationUnit(cu);
- this.javaResourceCompilationUnit.resolveTypes();
- return this.hackJavaResourcePersistentType();
- }
-
- protected JavaResourcePersistentType hackJavaResourcePersistentType() {
- return (JavaResourcePersistentType) ClassTools.fieldValue(this.javaResourceCompilationUnit, "persistentType");
- }
-
- protected JavaResourceCompilationUnit buildJavaResourceCompilationUnit(ICompilationUnit cu) {
- if (this.javaResourceCompilationUnit != null) {
- throw new IllegalStateException();
- }
- return new SourceCompilationUnit(
- cu,
- this.buildAnnotationProvider(),
- NullAnnotationEditFormatter.instance(),
- CommandExecutor.Default.instance()
- );
- }
-
- protected JpaAnnotationProvider buildAnnotationProvider() {
- return new GenericJpaAnnotationProvider(this.annotationDefinitionProvider());
- }
-
- protected JpaAnnotationDefinitionProvider annotationDefinitionProvider() {
- return GenericJpaAnnotationDefinitionProvider.instance();
- }
-
-}
diff --git a/jpa/tests/org.eclipse.jpt.core.tests/src/org/eclipse/jpt/core/tests/internal/resource/java/JavaResourcePersistentAttributeTests.java b/jpa/tests/org.eclipse.jpt.core.tests/src/org/eclipse/jpt/core/tests/internal/resource/java/JavaResourcePersistentAttributeTests.java
deleted file mode 100644
index 1a8cb78a59..0000000000
--- a/jpa/tests/org.eclipse.jpt.core.tests/src/org/eclipse/jpt/core/tests/internal/resource/java/JavaResourcePersistentAttributeTests.java
+++ /dev/null
@@ -1,859 +0,0 @@
-/*******************************************************************************
- * Copyright (c) 2007, 2009 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.
- *
- * Contributors:
- * Oracle - initial API and implementation
- ******************************************************************************/
-package org.eclipse.jpt.core.tests.internal.resource.java;
-
-import java.lang.reflect.Modifier;
-import java.util.Iterator;
-import java.util.List;
-import org.eclipse.core.runtime.NullProgressMonitor;
-import org.eclipse.jdt.core.ICompilationUnit;
-import org.eclipse.jpt.core.internal.resource.java.source.SourceIdAnnotation;
-import org.eclipse.jpt.core.internal.resource.java.source.SourceOneToOneAnnotation;
-import org.eclipse.jpt.core.resource.java.AttributeOverrideAnnotation;
-import org.eclipse.jpt.core.resource.java.BasicAnnotation;
-import org.eclipse.jpt.core.resource.java.ColumnAnnotation;
-import org.eclipse.jpt.core.resource.java.IdAnnotation;
-import org.eclipse.jpt.core.resource.java.JPA;
-import org.eclipse.jpt.core.resource.java.JavaResourceNode;
-import org.eclipse.jpt.core.resource.java.JavaResourcePersistentAttribute;
-import org.eclipse.jpt.core.resource.java.JavaResourcePersistentType;
-import org.eclipse.jpt.core.resource.java.NestableAnnotation;
-import org.eclipse.jpt.core.resource.java.OneToManyAnnotation;
-import org.eclipse.jpt.core.utility.jdt.ModifiedDeclaration;
-import org.eclipse.jpt.core.utility.jdt.Member.Editor;
-import org.eclipse.jpt.utility.internal.ClassTools;
-import org.eclipse.jpt.utility.internal.CollectionTools;
-import org.eclipse.jpt.utility.internal.iterators.ArrayIterator;
-
-@SuppressWarnings("nls")
-public class JavaResourcePersistentAttributeTests extends JavaResourceModelTestCase {
-
- public JavaResourcePersistentAttributeTests(String name) {
- super(name);
- }
-
- private ICompilationUnit createTestEntity() 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");
- }
- });
- }
-
- 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);
- }
- @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(" ");
- }
- });
- }
-
- private ICompilationUnit createTestEntityMultipleVariableDeclarationsPerLine() throws Exception {
- return this.createTestType(new DefaultAnnotationWriter() {
- @Override
- public Iterator<String> imports() {
- return new ArrayIterator<String>(JPA.ENTITY, JPA.ID, JPA.COLUMN);
- }
- @Override
- public void appendTypeAnnotationTo(StringBuilder sb) {
- sb.append("@Entity");
- }
-
- @Override
- public void appendIdFieldAnnotationTo(StringBuilder sb) {
- sb.append(CR);
- sb.append(" ");
- sb.append("@Id");
- sb.append(CR);
- sb.append(" ");
- sb.append("@Column(name = \"baz\")");
- sb.append(" private String foo, bar;").append(CR);
- sb.append(CR);
- }
- });
- }
-
- private ICompilationUnit createTestEntityWithIdAndBasic() throws Exception {
- return this.createTestType(new DefaultAnnotationWriter() {
- @Override
- public Iterator<String> imports() {
- return new ArrayIterator<String>(JPA.ENTITY, JPA.ID, JPA.BASIC);
- }
- @Override
- public void appendTypeAnnotationTo(StringBuilder sb) {
- sb.append("@Entity");
- }
-
- @Override
- public void appendIdFieldAnnotationTo(StringBuilder sb) {
- sb.append("@Id");
- sb.append(CR);
- sb.append("@Basic");
- }
- });
- }
-
- private ICompilationUnit createTestEntityAnnotatedField() throws Exception {
- return this.createTestType(new DefaultAnnotationWriter() {
- @Override
- public Iterator<String> imports() {
- return new ArrayIterator<String>(JPA.ENTITY, JPA.ID, JPA.COLUMN);
- }
- @Override
- public void appendTypeAnnotationTo(StringBuilder sb) {
- sb.append("@Entity");
- }
-
- @Override
- public void appendIdFieldAnnotationTo(StringBuilder sb) {
- sb.append("@Id");
- sb.append(CR);
- sb.append(" ");
- sb.append("@Column");
- }
- });
- }
-
- private ICompilationUnit createTestEntityWithColumn() 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(name = \"FOO\", table = \"MY_TABLE\")");
- }
- });
- }
-
- private ICompilationUnit createTestEntityWithIdColumnGeneratedValue() throws Exception {
- return this.createTestType(new DefaultAnnotationWriter() {
- @Override
- public Iterator<String> imports() {
- return new ArrayIterator<String>(JPA.ENTITY, JPA.COLUMN, JPA.ID, JPA.GENERATED_VALUE);
- }
- @Override
- public void appendTypeAnnotationTo(StringBuilder sb) {
- sb.append("@Entity");
- }
- @Override
- public void appendIdFieldAnnotationTo(StringBuilder sb) {
- sb.append("@Id");
- sb.append(CR);
- sb.append("@Column");
- sb.append(CR);
- sb.append("@GeneratedValue");
- }
- });
- }
-
-
- private ICompilationUnit createTestEntityMultipleColumns() 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(name = \"FOO\")");
- sb.append(CR);
- sb.append("@Column(name = \"BAR\")");
- }
- });
- }
-
- private ICompilationUnit createTestEmbeddedWithAttributeOverride() throws Exception {
- return this.createTestType(new DefaultAnnotationWriter() {
- @Override
- public Iterator<String> imports() {
- return new ArrayIterator<String>(JPA.EMBEDDED, JPA.ATTRIBUTE_OVERRIDE);
- }
- @Override
- public void appendIdFieldAnnotationTo(StringBuilder sb) {
- sb.append("@Embedded");
- sb.append(CR);
- sb.append("@AttributeOverride(name = \"FOO\")");
- }
- });
- }
- private ICompilationUnit createTestEmbeddedWithAttributeOverrides() throws Exception {
- return this.createTestType(new DefaultAnnotationWriter() {
- @Override
- public Iterator<String> imports() {
- return new ArrayIterator<String>(JPA.EMBEDDED, JPA.ATTRIBUTE_OVERRIDE, JPA.ATTRIBUTE_OVERRIDES);
- }
- @Override
- public void appendIdFieldAnnotationTo(StringBuilder sb) {
- sb.append("@Embedded");
- sb.append(CR);
- sb.append("@AttributeOverrides(@AttributeOverride(name = \"FOO\"))");
- }
- });
- }
- private ICompilationUnit createTestEmbeddedWithAttributeOverridesEmpty() throws Exception {
- return this.createTestType(new DefaultAnnotationWriter() {
- @Override
- public Iterator<String> imports() {
- return new ArrayIterator<String>(JPA.EMBEDDED, JPA.ATTRIBUTE_OVERRIDE, JPA.ATTRIBUTE_OVERRIDES);
- }
- @Override
- public void appendIdFieldAnnotationTo(StringBuilder sb) {
- sb.append("@Embedded");
- sb.append(CR);
- sb.append("@AttributeOverrides()");
- }
- });
- }
-
- private ICompilationUnit createTestEmbeddedWith2AttributeOverrides() throws Exception {
- return this.createTestType(new DefaultAnnotationWriter() {
- @Override
- public Iterator<String> imports() {
- return new ArrayIterator<String>(JPA.EMBEDDED, JPA.ATTRIBUTE_OVERRIDE, JPA.ATTRIBUTE_OVERRIDES);
- }
- @Override
- public void appendIdFieldAnnotationTo(StringBuilder sb) {
- sb.append("@Embedded");
- sb.append(CR);
- sb.append("@AttributeOverrides({@AttributeOverride(name = \"FOO\"), @AttributeOverride(name = \"BAR\")})");
- }
- });
- }
-
- private ICompilationUnit createTestEmbeddedWithAttributeOverrideAndAttributeOverrides() throws Exception {
- return this.createTestType(new DefaultAnnotationWriter() {
- @Override
- public Iterator<String> imports() {
- return new ArrayIterator<String>(JPA.EMBEDDED, JPA.ATTRIBUTE_OVERRIDE, JPA.ATTRIBUTE_OVERRIDES);
- }
- @Override
- public void appendIdFieldAnnotationTo(StringBuilder sb) {
- sb.append("@Embedded");
- sb.append(CR);
- sb.append("@AttributeOverride(name = \"FOO\")");
- sb.append(CR);
- sb.append("@AttributeOverrides({@AttributeOverride(name = \"BAR\"), @AttributeOverride(name = \"BAZ\")})");
- }
- });
- }
-
- private ICompilationUnit createTestTypePublicAttribute() throws Exception {
-
- return this.createTestType(new DefaultAnnotationWriter() {
-
- @Override
- public void appendIdFieldAnnotationTo(StringBuilder sb) {
- sb.append(CR);
- sb.append(" public String foo;");
- sb.append(CR);
- }
- });
- }
-
- private ICompilationUnit createTestTypePackageAttribute() throws Exception {
-
- return this.createTestType(new DefaultAnnotationWriter() {
-
- @Override
- public void appendIdFieldAnnotationTo(StringBuilder sb) {
- sb.append(CR);
- sb.append(" String foo;");
- sb.append(CR);
- }
- });
- }
-
- private ICompilationUnit createTestTypeFinalAttribute() throws Exception {
-
- return this.createTestType(new DefaultAnnotationWriter() {
-
- @Override
- public void appendIdFieldAnnotationTo(StringBuilder sb) {
- sb.append(CR);
- sb.append(" public final String foo;");
- sb.append(CR);
- }
- });
- }
-
- public void testJavaAttributeAnnotations() throws Exception {
- ICompilationUnit cu = this.createTestEntityWithColumn();
- JavaResourcePersistentType typeResource = buildJavaTypeResource(cu);
- JavaResourcePersistentAttribute attributeResource = typeResource.fields().next();
- assertEquals(1, attributeResource.supportingAnnotationsSize());
- }
-
- public void testJavaAttributeAnnotation() throws Exception {
- ICompilationUnit cu = this.createTestEntityWithColumn();
- JavaResourcePersistentType typeResource = buildJavaTypeResource(cu);
- JavaResourcePersistentAttribute attributeResource = typeResource.fields().next();
- assertNotNull(attributeResource.getSupportingAnnotation(JPA.COLUMN));
- }
-
- public void testJavaAttributeAnnotationNull() throws Exception {
- ICompilationUnit cu = this.createTestEntity();
- JavaResourcePersistentType typeResource = buildJavaTypeResource(cu);
- JavaResourcePersistentAttribute attributeResource = typeResource.fields().next();
- assertNull(attributeResource.getSupportingAnnotation(JPA.TABLE));
- }
-
- //This will result in a compilation error, but we assume the first column found
- public void testDuplicateAnnotations() throws Exception {
- ICompilationUnit cu = this.createTestEntityMultipleColumns();
- JavaResourcePersistentType typeResource = buildJavaTypeResource(cu);
- JavaResourcePersistentAttribute attributeResource = typeResource.fields().next();
- ColumnAnnotation columnResource = (ColumnAnnotation) attributeResource.getSupportingAnnotation(JPA.COLUMN);
- assertEquals("FOO", columnResource.getName());
- }
-
- public void testRemoveColumn() throws Exception {
- ICompilationUnit cu = this.createTestEntityWithColumn();
- JavaResourcePersistentType typeResource = buildJavaTypeResource(cu);
- JavaResourcePersistentAttribute attributeResource = typeResource.fields().next();
- attributeResource.removeSupportingAnnotation(JPA.COLUMN);
-
- assertSourceDoesNotContain("@Column", cu);
- }
-
- public void testRemoveColumnName() throws Exception {
- ICompilationUnit cu = this.createTestEntityWithColumn();
- JavaResourcePersistentType typeResource = buildJavaTypeResource(cu);
- JavaResourcePersistentAttribute attributeResource = typeResource.fields().next();
-
- ColumnAnnotation columnResource = (ColumnAnnotation) attributeResource.getSupportingAnnotation(JPA.COLUMN);
- columnResource.setTable(null);
- assertSourceContains("@Column(name = \"FOO\")", cu);
-
- columnResource.setName(null);
- assertSourceDoesNotContain("@Column", cu);
-
- assertNull(typeResource.getSupportingAnnotation(JPA.TABLE));
- }
-
- public void testMultipleAttributeMappings() throws Exception {
- ICompilationUnit cu = this.createTestEntityWithIdAndBasic();
- JavaResourcePersistentType typeResource = buildJavaTypeResource(cu);
- JavaResourcePersistentAttribute attributeResource = typeResource.fields().next();
-
- assertEquals(2, attributeResource.mappingAnnotationsSize());
- assertEquals(0, attributeResource.supportingAnnotationsSize());
- assertNotNull(attributeResource.getMappingAnnotation(JPA.BASIC));
- assertNotNull(attributeResource.getMappingAnnotation(JPA.ID));
-
- JavaResourceNode javaAttributeMappingAnnotation = attributeResource.getMappingAnnotation();
- assertTrue(javaAttributeMappingAnnotation instanceof BasicAnnotation);
- assertSourceContains("@Basic", cu);
- assertSourceContains("@Id", cu);
-
- attributeResource.setMappingAnnotation(JPA.ONE_TO_MANY);
- assertEquals(1, attributeResource.mappingAnnotationsSize());
- javaAttributeMappingAnnotation = attributeResource.getMappingAnnotation();
- assertTrue(javaAttributeMappingAnnotation instanceof OneToManyAnnotation);
- assertSourceDoesNotContain("@Id", cu);
- assertSourceContains("@OneToMany", cu);
- assertSourceDoesNotContain("@Basic", cu);
- }
-
- public void testSetJavaAttributeMappingAnnotation() throws Exception {
- ICompilationUnit cu = createTestType();
- JavaResourcePersistentType typeResource = buildJavaTypeResource(cu);
- JavaResourcePersistentAttribute attributeResource = typeResource.fields().next();
- assertEquals(0, attributeResource.mappingAnnotationsSize());
-
- attributeResource.setMappingAnnotation(JPA.ID);
- assertTrue(attributeResource.getMappingAnnotation() instanceof IdAnnotation);
- assertSourceContains("@Id", cu);
- }
-
- public void testSetJavaAttributeMappingAnnotation2() throws Exception {
- ICompilationUnit cu = createTestEntityWithColumn();
- JavaResourcePersistentType typeResource = buildJavaTypeResource(cu);
- JavaResourcePersistentAttribute attributeResource = typeResource.fields().next();
- assertNull(attributeResource.getMappingAnnotation());
-
- attributeResource.setMappingAnnotation(JPA.ID);
- assertTrue(attributeResource.getMappingAnnotation() instanceof IdAnnotation);
-
- assertSourceContains("@Id", cu);
- assertSourceContains("@Column", cu);
- }
-
- public void testSetJavaAttributeMappingAnnotation3() throws Exception {
- ICompilationUnit cu = createTestEntityWithIdColumnGeneratedValue();
- JavaResourcePersistentType typeResource = buildJavaTypeResource(cu);
- JavaResourcePersistentAttribute attributeResource = typeResource.fields().next();
- assertTrue(attributeResource.getMappingAnnotation() instanceof IdAnnotation);
-
- attributeResource.setMappingAnnotation(JPA.BASIC);
- assertTrue(attributeResource.getMappingAnnotation() instanceof BasicAnnotation);
-
- assertSourceDoesNotContain("@Id", cu);
- assertSourceContains("@GeneratedValue", cu); //not supported by Basic
- assertSourceContains("@Column", cu); //common between Id and Basic
- }
-
- public void testSetJavaAttributeMappingAnnotationNull() throws Exception {
- ICompilationUnit cu = createTestEntityWithIdColumnGeneratedValue();
- JavaResourcePersistentType typeResource = buildJavaTypeResource(cu);
- JavaResourcePersistentAttribute attributeResource = typeResource.fields().next();
- assertTrue(attributeResource.getMappingAnnotation() instanceof IdAnnotation);
-
- attributeResource.setMappingAnnotation(null);
- assertNull(attributeResource.getMappingAnnotation());
-
- assertSourceDoesNotContain("@Id", cu);
- assertSourceContains("@GeneratedValue", cu); //not supported by Basic
- assertSourceContains("@Column", cu); //common between Id and Basic
- }
-
- public void testAddJavaAttributeAnnotation() throws Exception {
- ICompilationUnit cu = createTestEntity();
- JavaResourcePersistentType typeResource = buildJavaTypeResource(cu);
-
- JavaResourcePersistentAttribute attributeResource = typeResource.fields().next();
-
- assertSourceDoesNotContain("@Column", cu);
- attributeResource.addSupportingAnnotation(JPA.COLUMN);
- assertSourceContains("@Column", cu);
- }
-
- public void testRemoveJavaAttributeAnnotation() throws Exception {
- ICompilationUnit cu = createTestEntityAnnotatedField();
- JavaResourcePersistentType typeResource = buildJavaTypeResource(cu);
- JavaResourcePersistentAttribute attributeResource = typeResource.fields().next();
- assertSourceContains("@Column", cu);
- attributeResource.removeSupportingAnnotation(JPA.COLUMN);
- assertSourceDoesNotContain("@Column", cu);
- }
-
- //update source code to change from @Id to @OneToOne and make sure @Column is not removed
- public void testChangeAttributeMappingInSource() throws Exception {
- ICompilationUnit cu = createTestEntityAnnotatedField();
- JavaResourcePersistentType typeResource = buildJavaTypeResource(cu);
- final JavaResourcePersistentAttribute attributeResource = typeResource.fields().next();
-
- idField(cu).edit(new Editor() {
- public void edit(ModifiedDeclaration declaration) {
- SourceIdAnnotation.DECLARATION_ANNOTATION_ADAPTER.removeAnnotation(declaration);
- }
- });
-
- cu.createImport("javax.persistence.OneToOne", null, new NullProgressMonitor());
-
- idField(cu).edit(new Editor() {
- public void edit(ModifiedDeclaration declaration) {
- SourceOneToOneAnnotation.DECLARATION_ANNOTATION_ADAPTER.newMarkerAnnotation(declaration);
- }
- });
-
- assertNotNull(attributeResource.getSupportingAnnotation(JPA.COLUMN));
- assertNull(attributeResource.getMappingAnnotation(JPA.ID));
- assertNotNull(attributeResource.getMappingAnnotation(JPA.ONE_TO_ONE));
- assertSourceContains("@Column", cu);
- }
-
- public void testJavaAttributeAnnotationsNestable() throws Exception {
- ICompilationUnit cu = createTestEmbeddedWithAttributeOverride();
- JavaResourcePersistentType typeResource = buildJavaTypeResource(cu);
- JavaResourcePersistentAttribute attributeResource = typeResource.fields().next();
-
- assertEquals(1, CollectionTools.size(attributeResource.supportingAnnotations(JPA.ATTRIBUTE_OVERRIDE, JPA.ATTRIBUTE_OVERRIDES)));
-
- AttributeOverrideAnnotation attributeOverride = (AttributeOverrideAnnotation) attributeResource.supportingAnnotations(JPA.ATTRIBUTE_OVERRIDE, JPA.ATTRIBUTE_OVERRIDES).next();
-
- assertEquals("FOO", attributeOverride.getName());
- }
-
- public void testJavaAttributeAnnotationsNoNestable() throws Exception {
- ICompilationUnit cu = createTestEntity();
- JavaResourcePersistentType typeResource = buildJavaTypeResource(cu);
- JavaResourcePersistentAttribute attributeResource = typeResource.fields().next();
-
- assertEquals(0, CollectionTools.size(attributeResource.supportingAnnotations(JPA.ATTRIBUTE_OVERRIDE, JPA.ATTRIBUTE_OVERRIDES)));
- }
-
- public void testJavaAttributeAnnotationsContainerNoNestable() throws Exception {
- ICompilationUnit cu = createTestEmbeddedWithAttributeOverridesEmpty();
- JavaResourcePersistentType typeResource = buildJavaTypeResource(cu);
- JavaResourcePersistentAttribute attributeResource = typeResource.fields().next();
-
- assertEquals(0, CollectionTools.size(attributeResource.supportingAnnotations(JPA.ATTRIBUTE_OVERRIDE, JPA.ATTRIBUTE_OVERRIDES)));
- }
-
- public void testJavaAttributeAnnotationsNestableAndContainer() throws Exception {
- ICompilationUnit cu = createTestEmbeddedWithAttributeOverrideAndAttributeOverrides();
- JavaResourcePersistentType typeResource = buildJavaTypeResource(cu);
- JavaResourcePersistentAttribute attributeResource = typeResource.fields().next();
- assertNotNull(attributeResource.getSupportingAnnotation(JPA.ATTRIBUTE_OVERRIDE));
- assertNotNull(attributeResource.getSupportingAnnotation(JPA.ATTRIBUTE_OVERRIDES));
- assertEquals(2, CollectionTools.size(attributeResource.supportingAnnotations(JPA.ATTRIBUTE_OVERRIDE, JPA.ATTRIBUTE_OVERRIDES)));
-
- AttributeOverrideAnnotation attributeOverrideResource = (AttributeOverrideAnnotation) attributeResource.supportingAnnotations(JPA.ATTRIBUTE_OVERRIDE, JPA.ATTRIBUTE_OVERRIDES).next();
- assertEquals("BAR", attributeOverrideResource.getName());
- }
-
- // -->> @AttributeOverride(name="FOO")
- public void testAddJavaAttributeAnnotationNestableContainer() throws Exception {
- ICompilationUnit cu = createTestEntity();
- JavaResourcePersistentType typeResource = buildJavaTypeResource(cu);
- JavaResourcePersistentAttribute attributeResource = typeResource.fields().next();
- AttributeOverrideAnnotation attributeOverride = (AttributeOverrideAnnotation) attributeResource.addSupportingAnnotation(0, JPA.ATTRIBUTE_OVERRIDE, JPA.ATTRIBUTE_OVERRIDES);
- attributeOverride.setName("FOO");
- assertSourceContains("@AttributeOverride(name = \"FOO\")", cu);
- }
-
- // @Embedded -->> @Embedded
- // @AttributeOverride(name="FOO") @AttributeOverrides({@AttributeOverride(name="FOO"), @AttributeOverride(name="BAR")})
- public void testAddJavaAttributeAnnotationNestableContainer2() throws Exception {
- ICompilationUnit cu = createTestEmbeddedWithAttributeOverride();
- JavaResourcePersistentType typeResource = buildJavaTypeResource(cu);
- JavaResourcePersistentAttribute attributeResource = typeResource.fields().next();
-
- AttributeOverrideAnnotation attributeOverride = (AttributeOverrideAnnotation) attributeResource.addSupportingAnnotation(1, JPA.ATTRIBUTE_OVERRIDE, JPA.ATTRIBUTE_OVERRIDES);
- attributeOverride.setName("BAR");
- assertSourceContains("@AttributeOverrides({@AttributeOverride(name = \"FOO\"),@AttributeOverride(name = \"BAR\")})", cu);
-
- assertNull(attributeResource.getSupportingAnnotation(JPA.ATTRIBUTE_OVERRIDE));
- assertNotNull(attributeResource.getSupportingAnnotation(JPA.ATTRIBUTE_OVERRIDES));
- assertEquals(2, CollectionTools.size(attributeResource.supportingAnnotations(JPA.ATTRIBUTE_OVERRIDE, JPA.ATTRIBUTE_OVERRIDES)));
- }
-
- // @Embedded
- // @AttributeOverrides(@AttributeOverride(name="FOO"))
- // ||
- // \/
- // @Embedded
- // @AttributeOverrides({@AttributeOverride(name="FOO"), @AttributeOverride(name="BAR")})
- public void testAddJavaAttributeAnnotationNestableContainer3() throws Exception {
- ICompilationUnit cu = createTestEmbeddedWithAttributeOverrides();
- JavaResourcePersistentType typeResource = buildJavaTypeResource(cu);
- JavaResourcePersistentAttribute attributeResource = typeResource.fields().next();
-
- AttributeOverrideAnnotation attributeOverride = (AttributeOverrideAnnotation) attributeResource.addSupportingAnnotation(1, JPA.ATTRIBUTE_OVERRIDE, JPA.ATTRIBUTE_OVERRIDES);
- attributeOverride.setName("BAR");
- assertSourceContains("@AttributeOverrides({@AttributeOverride(name = \"FOO\"),@AttributeOverride(name = \"BAR\")})", cu);
-
- assertNull(attributeResource.getSupportingAnnotation(JPA.ATTRIBUTE_OVERRIDE));
- assertNotNull(attributeResource.getSupportingAnnotation(JPA.ATTRIBUTE_OVERRIDES));
- assertEquals(2, CollectionTools.size(attributeResource.supportingAnnotations(JPA.ATTRIBUTE_OVERRIDE, JPA.ATTRIBUTE_OVERRIDES)));
- }
-
- public void testAddJavaAttributeAnnotationNestableContainer5() throws Exception {
- ICompilationUnit cu = createTestEmbeddedWithAttributeOverrides();
- JavaResourcePersistentType typeResource = buildJavaTypeResource(cu);
- JavaResourcePersistentAttribute attributeResource = typeResource.fields().next();
-
- AttributeOverrideAnnotation attributeOverride = (AttributeOverrideAnnotation) attributeResource.addSupportingAnnotation(0, JPA.ATTRIBUTE_OVERRIDE, JPA.ATTRIBUTE_OVERRIDES);
- attributeOverride.setName("BAR");
- assertSourceContains("@AttributeOverrides({@AttributeOverride(name = \"BAR\"),@AttributeOverride(name = \"FOO\")})", cu);
-
- assertNull(attributeResource.getSupportingAnnotation(JPA.ATTRIBUTE_OVERRIDE));
- assertNotNull(attributeResource.getSupportingAnnotation(JPA.ATTRIBUTE_OVERRIDES));
- assertEquals(2, CollectionTools.size(attributeResource.supportingAnnotations(JPA.ATTRIBUTE_OVERRIDE, JPA.ATTRIBUTE_OVERRIDES)));
- }
-
- // @Embedded
- // @SecondaryTable(name=\"FOO\")
- // @AttributeOverrides({@AttributeOverride(name=\"BAR\"), @AttributeOverride(name=\"BAZ\")})
- // ||
- // \/
- // @Embedded
- // @AttributeOverride(name=\"FOO\")
- // @AttributeOverrides({@AttributeOverride(name=\"BAR\"), @AttributeOverride(name=\"BAZ\"), @AttributeOverride(name=\"BOO\")})
- public void testAddJavaAttributeAnnotationNestableContainer4() throws Exception {
- ICompilationUnit cu = createTestEmbeddedWithAttributeOverrideAndAttributeOverrides();
- JavaResourcePersistentType typeResource = buildJavaTypeResource(cu);
- JavaResourcePersistentAttribute attributeResource = typeResource.fields().next();
-
- assertNotNull(attributeResource.getSupportingAnnotation(JPA.ATTRIBUTE_OVERRIDE));
- assertNotNull(attributeResource.getSupportingAnnotation(JPA.ATTRIBUTE_OVERRIDES));
- assertEquals(2, CollectionTools.size(attributeResource.supportingAnnotations(JPA.ATTRIBUTE_OVERRIDE, JPA.ATTRIBUTE_OVERRIDES)));
-
- AttributeOverrideAnnotation attributeOverride = (AttributeOverrideAnnotation) attributeResource.addSupportingAnnotation(2, JPA.ATTRIBUTE_OVERRIDE, JPA.ATTRIBUTE_OVERRIDES);
- assertSourceContains("@AttributeOverrides({@AttributeOverride(name = \"BAR\"), @AttributeOverride(name = \"BAZ\"),", cu);
- assertSourceContains("@AttributeOverride})", cu);
- attributeOverride.setName("BOO");
-
- assertNotNull(attributeResource.getSupportingAnnotation(JPA.ATTRIBUTE_OVERRIDE));
- assertNotNull(attributeResource.getSupportingAnnotation(JPA.ATTRIBUTE_OVERRIDES));
- assertEquals(3, CollectionTools.size(attributeResource.supportingAnnotations(JPA.ATTRIBUTE_OVERRIDE, JPA.ATTRIBUTE_OVERRIDES)));
-
- Iterator<NestableAnnotation> attributeOverrideAnnotations = attributeResource.supportingAnnotations(JPA.ATTRIBUTE_OVERRIDE, JPA.ATTRIBUTE_OVERRIDES);
- attributeOverride = (AttributeOverrideAnnotation) attributeOverrideAnnotations.next();
- assertEquals("BAR", attributeOverride.getName());
- attributeOverride = (AttributeOverrideAnnotation) attributeOverrideAnnotations.next();
- assertEquals("BAZ", attributeOverride.getName());
- attributeOverride = (AttributeOverrideAnnotation) attributeOverrideAnnotations.next();
- assertEquals("BOO", attributeOverride.getName());
-
- assertSourceContains("@AttributeOverrides({@AttributeOverride(name = \"BAR\"), @AttributeOverride(name = \"BAZ\"),", cu);
- assertSourceContains("@AttributeOverride(name = \"BOO\")})", cu);
- }
-
- //@Entity
- //@AttributeOverride(name="FOO")
- public void testRemoveJavaAttributeAnnotationNestableContainer() throws Exception {
- ICompilationUnit cu = createTestEmbeddedWithAttributeOverride();
- JavaResourcePersistentType typeResource = buildJavaTypeResource(cu);
- JavaResourcePersistentAttribute attributeResource = typeResource.fields().next();
-
- attributeResource.removeSupportingAnnotation(0, JPA.ATTRIBUTE_OVERRIDE, JPA.ATTRIBUTE_OVERRIDES);
-
- assertSourceDoesNotContain("@AttributeOverride", cu);
- }
-
-
- //@Entity
- //@SecondaryTables(@SecondaryTable(name="FOO"))
- public void testRemoveJavaAttributeAnnotationNestableContainer2() throws Exception {
- ICompilationUnit cu = createTestEmbeddedWithAttributeOverrides();
- JavaResourcePersistentType typeResource = buildJavaTypeResource(cu);
- JavaResourcePersistentAttribute attributeResource = typeResource.fields().next();
-
- attributeResource.removeSupportingAnnotation(0, JPA.ATTRIBUTE_OVERRIDE, JPA.ATTRIBUTE_OVERRIDES);
-
- assertSourceDoesNotContain("@AttributeOverride", cu);
- assertSourceDoesNotContain("@AttributeOverrides", cu);
- }
-
- public void testRemoveJavaAttributeAnnotationIndex() throws Exception {
- ICompilationUnit cu = createTestEmbeddedWith2AttributeOverrides();
- JavaResourcePersistentType typeResource = buildJavaTypeResource(cu);
- JavaResourcePersistentAttribute attributeResource = typeResource.fields().next();
-
- attributeResource.removeSupportingAnnotation(0, JPA.ATTRIBUTE_OVERRIDE , JPA.ATTRIBUTE_OVERRIDES);
-
- assertSourceDoesNotContain("@AttributeOverride(name = \"FOO\"", cu);
- assertSourceContains("@AttributeOverride(name = \"BAR\"", cu);
- assertSourceDoesNotContain("@AttributeOverrides", cu);
- }
-
- public void testRemoveJavaAttributeAnnotationIndex2() throws Exception {
- ICompilationUnit cu = createTestEmbeddedWith2AttributeOverrides();
- JavaResourcePersistentType typeResource = buildJavaTypeResource(cu);
- JavaResourcePersistentAttribute attributeResource = typeResource.fields().next();
-
- AttributeOverrideAnnotation newAnnotation = (AttributeOverrideAnnotation)attributeResource.addSupportingAnnotation(2, JPA.ATTRIBUTE_OVERRIDE, JPA.ATTRIBUTE_OVERRIDES);
- newAnnotation.setName("BAZ");
- assertSourceContains("@AttributeOverrides({@AttributeOverride(name = \"FOO\"), @AttributeOverride(name = \"BAR\"),", cu);
- assertSourceContains("@AttributeOverride(name = \"BAZ\")})", cu);
-
- attributeResource.removeSupportingAnnotation(1, JPA.ATTRIBUTE_OVERRIDE, JPA.ATTRIBUTE_OVERRIDES);
- assertSourceContains("@AttributeOverrides({@AttributeOverride(name = \"FOO\"), @AttributeOverride(name = \"BAZ\")})", cu);
- }
-
- public void testMoveJavaTypeAnnotation() throws Exception {
- ICompilationUnit cu = createTestEmbeddedWith2AttributeOverrides();
- JavaResourcePersistentType typeResource = buildJavaTypeResource(cu);
- JavaResourcePersistentAttribute attributeResource = typeResource.fields().next();
-
- AttributeOverrideAnnotation newAnnotation = (AttributeOverrideAnnotation)attributeResource.addSupportingAnnotation(2, JPA.ATTRIBUTE_OVERRIDE, JPA.ATTRIBUTE_OVERRIDES);
- newAnnotation.setName("BAZ");
- assertSourceContains("@AttributeOverrides({@AttributeOverride(name = \"FOO\"), @AttributeOverride(name = \"BAR\"),", cu);
- assertSourceContains("@AttributeOverride(name = \"BAZ\")})", cu);
-
-
- attributeResource.moveSupportingAnnotation(0, 2, JPA.ATTRIBUTE_OVERRIDES);
- assertSourceContains("@AttributeOverrides({@AttributeOverride(name = \"BAZ\"), @AttributeOverride(name = \"FOO\"),", cu);
- assertSourceContains("@AttributeOverride(name = \"BAR\")})", cu);
- }
-
- public void testMoveJavaTypeAnnotation2() throws Exception {
- ICompilationUnit cu = createTestEmbeddedWith2AttributeOverrides();
- JavaResourcePersistentType typeResource = buildJavaTypeResource(cu);
- JavaResourcePersistentAttribute attributeResource = typeResource.fields().next();
-
- AttributeOverrideAnnotation newAnnotation = (AttributeOverrideAnnotation) attributeResource.addSupportingAnnotation(2, JPA.ATTRIBUTE_OVERRIDE, JPA.ATTRIBUTE_OVERRIDES);
- newAnnotation.setName("BAZ");
- assertSourceContains("@AttributeOverrides({@AttributeOverride(name = \"FOO\"), @AttributeOverride(name = \"BAR\"),", cu);
- assertSourceContains("@AttributeOverride(name = \"BAZ\")})", cu);
-
- attributeResource.moveSupportingAnnotation(1, 0, JPA.ATTRIBUTE_OVERRIDES);
- assertSourceContains("@AttributeOverrides({@AttributeOverride(name = \"BAR\"), @AttributeOverride(name = \"FOO\"),", cu);
- assertSourceContains("@AttributeOverride(name = \"BAZ\")})", cu);
- }
-
- //more detailed tests in JPTToolsTests
- public void testIsPersistableField() throws Exception {
- ICompilationUnit cu = createTestEntity();
- JavaResourcePersistentType typeResource = buildJavaTypeResource(cu);
- JavaResourcePersistentAttribute attributeResource = typeResource.fields().next();
-
- assertTrue(attributeResource.isPersistable());
- }
-
- public void testIsPersistableField2() throws Exception {
- ICompilationUnit cu = createTestEntityWithNonResolvingField();
- JavaResourcePersistentType typeResource = buildJavaTypeResource(cu);
- @SuppressWarnings("unchecked")
- List<JavaResourcePersistentAttribute> attributes = (List<JavaResourcePersistentAttribute>) ClassTools.fieldValue(typeResource, "fields");
- JavaResourcePersistentAttribute attributeResource = attributes.get(0);
-
- assertEquals("foo", attributeResource.getName());
- assertTrue(attributeResource.isField());
- assertTrue(attributeResource.isPersistable()); //bug 196200 changed this
-
- this.javaProject.createCompilationUnit("test", "Foo.java", "public class Foo {}");
-
- assertTrue(attributeResource.isPersistable());
- }
-
- public void testGetTypeName() throws Exception {
- ICompilationUnit cu = createTestEntityWithNonResolvingField();
- JavaResourcePersistentType typeResource = buildJavaTypeResource(cu);
- @SuppressWarnings("unchecked")
- List<JavaResourcePersistentAttribute> attributes = (List<JavaResourcePersistentAttribute>) ClassTools.fieldValue(typeResource, "fields");
- JavaResourcePersistentAttribute attributeResource = attributes.get(0);
-
- assertEquals("foo", attributeResource.getName());
- assertEquals("test.Foo", attributeResource.getTypeName()); //bug 196200 changed this
-
- this.javaProject.createCompilationUnit("test", "Foo.java", "public class Foo {}");
-
- assertEquals("test.Foo", attributeResource.getTypeName());
- }
-
-
- //more detailed tests in JPTToolsTests
- public void testIsPersistableMethod() throws Exception {
- ICompilationUnit cu = createTestEntity();
- JavaResourcePersistentType typeResource = buildJavaTypeResource(cu);
- JavaResourcePersistentAttribute attributeResource = typeResource.persistableProperties().next();
-
- assertTrue(attributeResource.isPersistable());
- }
-
- public void testIsPersistableMethod2() throws Exception {
- ICompilationUnit cu = createTestEntityWithNonResolvingMethod();
- JavaResourcePersistentType typeResource = buildJavaTypeResource(cu);
- @SuppressWarnings("unchecked")
- List<JavaResourcePersistentAttribute> attributes = (List<JavaResourcePersistentAttribute>) ClassTools.fieldValue(typeResource, "methods");
- JavaResourcePersistentAttribute attributeResource = attributes.get(0);
-
- assertEquals("foo", attributeResource.getName());
- assertTrue(attributeResource.isProperty());
- assertTrue(attributeResource.isPersistable());//bug 196200 changed this
-
- this.javaProject.createCompilationUnit("test", "Foo.java", "public class Foo {}");
-
- assertTrue(attributeResource.isPersistable());
- }
-
- //this tests that we handle mutliple variable declarations in one line.
- //The annotations should apply to all fields defined. This is not really a useful
- //thing to do with JPA beyond the most basic things that use default column names
- public void testMultipleVariableDeclarationsPerLine() throws Exception {
- ICompilationUnit cu = createTestEntityMultipleVariableDeclarationsPerLine();
- JavaResourcePersistentType typeResource = buildJavaTypeResource(cu);
-
- assertEquals(4, CollectionTools.size(typeResource.fields()));
- Iterator<JavaResourcePersistentAttribute> fields = typeResource.fields();
- JavaResourcePersistentAttribute attributeResource = fields.next();
- ColumnAnnotation column = (ColumnAnnotation) attributeResource.getSupportingAnnotation(JPA.COLUMN);
- assertEquals("baz", column.getName());
-
- attributeResource = fields.next();
- column = (ColumnAnnotation) attributeResource.getSupportingAnnotation(JPA.COLUMN);
- assertEquals("baz", column.getName());
- }
-
- public void testIsPublic() throws Exception {
- ICompilationUnit cu = createTestTypePublicAttribute();
- JavaResourcePersistentType typeResource = buildJavaTypeResource(cu);
- JavaResourcePersistentAttribute attribute = typeResource.persistableAttributes().next();
-
- assertTrue(Modifier.isPublic(attribute.getModifiers()));
- }
-
- public void testIsPublicFalse() throws Exception {
- ICompilationUnit cu = createTestTypePackageAttribute();
- JavaResourcePersistentType typeResource = buildJavaTypeResource(cu);
- JavaResourcePersistentAttribute attribute = typeResource.persistableAttributes().next();
-
- assertFalse(Modifier.isPublic(attribute.getModifiers()));
- }
-
- public void testIsFinal() throws Exception {
- ICompilationUnit cu = createTestTypeFinalAttribute();
- JavaResourcePersistentType typeResource = buildJavaTypeResource(cu);
- JavaResourcePersistentAttribute attribute = typeResource.persistableAttributes().next();
-
- assertTrue(Modifier.isFinal(attribute.getModifiers()));
- }
-
- public void testIsFinalFalse() throws Exception {
- ICompilationUnit cu = createTestTypePackageAttribute();
- JavaResourcePersistentType typeResource = buildJavaTypeResource(cu);
- JavaResourcePersistentAttribute attribute = typeResource.persistableAttributes().next();
-
- assertFalse(Modifier.isFinal(attribute.getModifiers()));
- }
-
- //TODO add tests for JPTTools static methods
-}
diff --git a/jpa/tests/org.eclipse.jpt.core.tests/src/org/eclipse/jpt/core/tests/internal/resource/java/JavaResourcePersistentTypeTests.java b/jpa/tests/org.eclipse.jpt.core.tests/src/org/eclipse/jpt/core/tests/internal/resource/java/JavaResourcePersistentTypeTests.java
deleted file mode 100644
index 1ff5585102..0000000000
--- a/jpa/tests/org.eclipse.jpt.core.tests/src/org/eclipse/jpt/core/tests/internal/resource/java/JavaResourcePersistentTypeTests.java
+++ /dev/null
@@ -1,921 +0,0 @@
-/*******************************************************************************
- * Copyright (c) 2007, 2009 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.
- *
- * Contributors:
- * Oracle - initial API and implementation
- ******************************************************************************/
-package org.eclipse.jpt.core.tests.internal.resource.java;
-
-import java.util.Iterator;
-
-import org.eclipse.core.runtime.NullProgressMonitor;
-import org.eclipse.jdt.core.ICompilationUnit;
-import org.eclipse.jpt.core.internal.resource.java.source.SourceEmbeddableAnnotation;
-import org.eclipse.jpt.core.internal.resource.java.source.SourceEntityAnnotation;
-import org.eclipse.jpt.core.resource.java.AccessType;
-import org.eclipse.jpt.core.resource.java.EmbeddableAnnotation;
-import org.eclipse.jpt.core.resource.java.EntityAnnotation;
-import org.eclipse.jpt.core.resource.java.JPA;
-import org.eclipse.jpt.core.resource.java.JavaResourceNode;
-import org.eclipse.jpt.core.resource.java.JavaResourcePersistentAttribute;
-import org.eclipse.jpt.core.resource.java.JavaResourcePersistentType;
-import org.eclipse.jpt.core.resource.java.MappedSuperclassAnnotation;
-import org.eclipse.jpt.core.resource.java.NestableAnnotation;
-import org.eclipse.jpt.core.resource.java.SecondaryTableAnnotation;
-import org.eclipse.jpt.core.resource.java.TableAnnotation;
-import org.eclipse.jpt.core.utility.jdt.ModifiedDeclaration;
-import org.eclipse.jpt.core.utility.jdt.Member.Editor;
-import org.eclipse.jpt.utility.internal.CollectionTools;
-import org.eclipse.jpt.utility.internal.iterators.ArrayIterator;
-
-@SuppressWarnings("nls")
-public class JavaResourcePersistentTypeTests extends JavaResourceModelTestCase {
-
- public JavaResourcePersistentTypeTests(String name) {
- super(name);
- }
-
- private ICompilationUnit createTestEntity() 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");
- }
- });
- }
-
- private ICompilationUnit createTestInvalidAnnotations() throws Exception {
- return this.createTestType(new DefaultAnnotationWriter() {
- @Override
- public Iterator<String> imports() {
- return new ArrayIterator<String>("javax.persistence.Foo");
- }
- @Override
- public void appendTypeAnnotationTo(StringBuilder sb) {
- sb.append("@Foo");
- }
-
- @Override
- public void appendIdFieldAnnotationTo(StringBuilder sb) {
- sb.append("@Foo");
- }
- });
- }
-
- private ICompilationUnit createTestEntityWithMemberEmbeddable() throws Exception {
- return this.createTestType(new DefaultAnnotationWriter() {
- @Override
- public Iterator<String> imports() {
- return new ArrayIterator<String>(JPA.ENTITY, JPA.EMBEDDABLE);
- }
- @Override
- public void appendTypeAnnotationTo(StringBuilder sb) {
- sb.append("@Entity");
- }
-
- @Override
- public void appendMemberTypeTo(StringBuilder sb) {
- sb.append(" @Embeddable");
- sb.append(CR);
- sb.append(" public static class Foo { }").append(CR);
-
- }
- });
- }
-
- private ICompilationUnit createTestEntityDuplicates() 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(name = \"FirstEntity\")").append(CR);
- sb.append("@Entity(name = \"SecondEntity\")");
- }
- });
- }
-
- private ICompilationUnit createTestEntityWithEmbeddable() throws Exception {
- return this.createTestType(new DefaultAnnotationWriter() {
- @Override
- public Iterator<String> imports() {
- return new ArrayIterator<String>(JPA.ENTITY, JPA.EMBEDDABLE);
- }
- @Override
- public void appendTypeAnnotationTo(StringBuilder sb) {
- sb.append("@Entity");
- sb.append(CR);
- sb.append("@Embeddable");
- }
- });
- }
-
- private ICompilationUnit createTestEntityAnnotatedField() 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("@Id");
- }
- });
- }
-
- private ICompilationUnit createTestEntityAnnotatedMethod() 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 appendGetIdMethodAnnotationTo(StringBuilder sb) {
- sb.append("@Id");
- }
- });
- }
-
- private ICompilationUnit createTestEntityAnnotatedFieldAndMethod() 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 appendGetIdMethodAnnotationTo(StringBuilder sb) {
- sb.append("@Id");
- }
-
- @Override
- public void appendIdFieldAnnotationTo(StringBuilder sb) {
- sb.append("@Id");
- }
- });
- }
-
- 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());
- }
- });
- }
-
-// private ICompilationUnit createTestEntityLarge(final int i) throws Exception {
-// return this.createTestType(new DefaultAnnotationWriter() {
-// @Override
-// public Iterator<String> imports() {
-// return new ArrayIterator<String>(JPA.ENTITY + i);
-// }
-// @Override
-// public void appendTypeAnnotationTo(StringBuilder sb) {
-// sb.append("@Entity" + i);
-// sb.append(CR);
-// }
-// @Override
-// public String typeName() {
-// return TYPE_NAME + i;
-// }
-// });
-// }
-//
-// public void testLarge() throws Exception {
-// for (int i = START; i <= END; i++) {
-// this.createAnnotationAndMembers("Entity" +i, "String name();");
-// }
-//
-// List<ICompilationUnit> cus = new ArrayList<ICompilationUnit>();
-// for (int i = START; i <= END; i++) {
-// cus.add(createTestEntityLarge(i));
-// }
-// long start = System.currentTimeMillis();
-// List<JavaPersistentTypeResource> typeResources = new ArrayList<JavaPersistentTypeResource>();
-// for (int i = 0; i < END; i++) {
-// typeResources.add(buildJavaTypeResource(cus.get(i)));
-// }
-// long end = System.currentTimeMillis();
-//
-// System.out.println(end-start + "ms");
-// for (int i = 0; i < END; i++) {
-// assertEquals(1, CollectionTools.size(typeResources.get(i).javaTypeMappingAnnotations()));
-// assertNotNull(typeResources.get(i).javaTypeMappingAnnotation(JPA.ENTITY + (i+1)));
-// }
-//
-//
-//// assertEquals(0, CollectionTools.size(typeResource.javaTypeAnnotations()));
-// }
-
-
-
- private ICompilationUnit createTestEntityWithTable() throws Exception {
- return this.createTestType(new DefaultAnnotationWriter() {
- @Override
- public Iterator<String> imports() {
- return new ArrayIterator<String>(JPA.ENTITY, JPA.TABLE);
- }
- @Override
- public void appendTypeAnnotationTo(StringBuilder sb) {
- sb.append("@Entity");
- sb.append(CR);
- sb.append("@Table(name = \"FOO\", schema = \"BAR\")");
- }
- });
- }
-
-// private ICompilationUnit createTestEntityWithTableAndIdClass() throws Exception {
-// createEntityAnnotation();
-// this.createAnnotationAndMembers("Table", "String name(); String schema();");
-// this.createAnnotationAndMembers("IdClass", "Class value();");
-// return this.createTestType(new DefaultAnnotationWriter() {
-// @Override
-// public Iterator<String> imports() {
-// return new ArrayIterator<String>(JPA.ENTITY, JPA.TABLE, JPA.ID_CLASS);
-// }
-// @Override
-// public void appendTypeAnnotationTo(StringBuilder sb) {
-// sb.append("@Entity");
-// sb.append(CR);
-// sb.append("@Table");
-// sb.append(CR);
-// sb.append("@IdClass");
-// }
-// });
-// }
-//
-
- private ICompilationUnit createTestEntityMultipleTables() throws Exception {
- return this.createTestType(new DefaultAnnotationWriter() {
- @Override
- public Iterator<String> imports() {
- return new ArrayIterator<String>(JPA.ENTITY, JPA.TABLE);
- }
- @Override
- public void appendTypeAnnotationTo(StringBuilder sb) {
- sb.append("@Entity");
- sb.append(CR);
- sb.append("@Table(name = \"FOO\")");
- sb.append(CR);
- sb.append("@Table(name = \"BAR\")");
- }
- });
- }
-
- private ICompilationUnit createTestEntityWithSecondaryTable() throws Exception {
- return this.createTestType(new DefaultAnnotationWriter() {
- @Override
- public Iterator<String> imports() {
- return new ArrayIterator<String>(JPA.ENTITY, JPA.SECONDARY_TABLE);
- }
- @Override
- public void appendTypeAnnotationTo(StringBuilder sb) {
- sb.append("@Entity");
- sb.append(CR);
- sb.append("@SecondaryTable(name = \"FOO\")");
- }
- });
- }
- private ICompilationUnit createTestEntityWithEmptySecondaryTables() throws Exception {
- return this.createTestType(new DefaultAnnotationWriter() {
- @Override
- public Iterator<String> imports() {
- return new ArrayIterator<String>(JPA.ENTITY, JPA.SECONDARY_TABLE, JPA.SECONDARY_TABLES);
- }
- @Override
- public void appendTypeAnnotationTo(StringBuilder sb) {
- sb.append("@Entity");
- sb.append(CR);
- sb.append("@SecondaryTables()");
- }
- });
- }
-
- private ICompilationUnit createTestEntityWithSecondaryTables() throws Exception {
- return this.createTestType(new DefaultAnnotationWriter() {
- @Override
- public Iterator<String> imports() {
- return new ArrayIterator<String>(JPA.ENTITY, JPA.SECONDARY_TABLE, JPA.SECONDARY_TABLES);
- }
- @Override
- public void appendTypeAnnotationTo(StringBuilder sb) {
- sb.append("@Entity");
- sb.append(CR);
- sb.append("@SecondaryTables(@SecondaryTable(name = \"FOO\"))");
- }
- });
- }
-
- private ICompilationUnit createTestEntityWith2SecondaryTables() throws Exception {
- return this.createTestType(new DefaultAnnotationWriter() {
- @Override
- public Iterator<String> imports() {
- return new ArrayIterator<String>(JPA.ENTITY, JPA.SECONDARY_TABLE, JPA.SECONDARY_TABLES);
- }
- @Override
- public void appendTypeAnnotationTo(StringBuilder sb) {
- sb.append("@Entity");
- sb.append(CR);
- sb.append("@SecondaryTables({@SecondaryTable(name = \"FOO\"), @SecondaryTable(name = \"BAR\")})");
- }
- });
- }
-
- private ICompilationUnit createTestEntityWithSecondaryTableAndSecondaryTables() throws Exception {
- return this.createTestType(new DefaultAnnotationWriter() {
- @Override
- public Iterator<String> imports() {
- return new ArrayIterator<String>(JPA.ENTITY, JPA.SECONDARY_TABLE, JPA.SECONDARY_TABLES);
- }
- @Override
- public void appendTypeAnnotationTo(StringBuilder sb) {
- sb.append("@Entity");
- sb.append(CR);
- sb.append("@SecondaryTable(name = \"FOO\")");
- sb.append(CR);
- sb.append("@SecondaryTables({@SecondaryTable(name = \"BAR\"), @SecondaryTable(name = \"BAZ\")})");
- }
- });
- }
-
- private ICompilationUnit createTestEntityWithMemberTypes() 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.append(" static class FooStatic {}").append(CR);
- sb.append(CR);
- sb.append(" class FooNotStatic {}").append(CR);
- sb.append(CR);
- sb.append(" @interface MyAnnotation {}").append(CR);
- sb.append(CR);
- sb.append(" enum MyEnum {}").append(CR);
- }
- });
- }
-
- public void testJavaTypeAnnotations() throws Exception {
- ICompilationUnit cu = this.createTestEntityWithTable();
- JavaResourcePersistentType typeResource = buildJavaTypeResource(cu);
- assertEquals(1, typeResource.supportingAnnotationsSize());
- }
-
- public void testJavaTypeAnnotation() throws Exception {
- ICompilationUnit cu = this.createTestEntityWithTable();
- JavaResourcePersistentType typeResource = buildJavaTypeResource(cu);
- assertNotNull(typeResource.getSupportingAnnotation(JPA.TABLE));
- }
-
- public void testJavaTypeAnnotationNull() throws Exception {
- ICompilationUnit cu = this.createTestEntity();
- JavaResourcePersistentType typeResource = buildJavaTypeResource(cu);
- assertNull(typeResource.getSupportingAnnotation(JPA.TABLE));
- }
-
- //This will result in a compilation error, but we assume the first table found
- public void testDuplicateAnnotations() throws Exception {
- ICompilationUnit cu = this.createTestEntityMultipleTables();
- JavaResourcePersistentType typeResource = buildJavaTypeResource(cu);
- TableAnnotation tableResource = (TableAnnotation) typeResource.getSupportingAnnotation(JPA.TABLE);
- assertEquals("FOO", tableResource.getName());
- }
-
- public void testRemoveTable() throws Exception {
- ICompilationUnit cu = this.createTestEntityWithTable();
- JavaResourcePersistentType typeResource = buildJavaTypeResource(cu);
- typeResource.removeSupportingAnnotation(JPA.TABLE);
-
- assertSourceDoesNotContain("@Table", cu);
- }
-
- public void testRemoveTableName() throws Exception {
- ICompilationUnit cu = this.createTestEntityWithTable();
- JavaResourcePersistentType jrpt = buildJavaTypeResource(cu);
-
- TableAnnotation tableAnnotation = (TableAnnotation) jrpt.getSupportingAnnotation(JPA.TABLE);
- tableAnnotation.setSchema(null);
- assertSourceContains("@Table(name = \"FOO\")", cu);
-
- tableAnnotation.setName(null);
- assertSourceDoesNotContain("@Table", cu);
-
- assertNull(jrpt.getSupportingAnnotation(JPA.TABLE));
- }
-
- public void testMultipleTypeMappings() throws Exception {
- ICompilationUnit cu = this.createTestEntityWithEmbeddable();
-
- JavaResourcePersistentType typeResource = buildJavaTypeResource(cu);
-
- assertEquals(2, typeResource.mappingAnnotationsSize());
- assertEquals(0, typeResource.supportingAnnotationsSize());
- assertNotNull(typeResource.getMappingAnnotation(JPA.EMBEDDABLE));
- assertNotNull(typeResource.getMappingAnnotation(JPA.ENTITY));
-
- JavaResourceNode javaTypeMappingAnnotation = typeResource.getMappingAnnotation();
- assertTrue(javaTypeMappingAnnotation instanceof EmbeddableAnnotation);
- assertSourceContains("@Entity", cu);
- assertSourceContains("@Embeddable", cu);
-
- typeResource.setMappingAnnotation(JPA.MAPPED_SUPERCLASS);
- assertEquals(1, typeResource.mappingAnnotationsSize());
- javaTypeMappingAnnotation = typeResource.getMappingAnnotation();
- assertTrue(javaTypeMappingAnnotation instanceof MappedSuperclassAnnotation);
- assertSourceDoesNotContain("@Entity", cu);
- assertSourceContains("@MappedSuperclass", cu);
- assertSourceDoesNotContain("@Embeddable", cu);
- }
-
- public void testSetJavaTypeMappingAnnotation() throws Exception {
- ICompilationUnit cu = createTestType();
- JavaResourcePersistentType typeResource = buildJavaTypeResource(cu);
- assertEquals(0, typeResource.mappingAnnotationsSize());
-
- typeResource.setMappingAnnotation(JPA.ENTITY);
- assertTrue(typeResource.getMappingAnnotation() instanceof EntityAnnotation);
- assertSourceContains("@Entity", cu);
- }
-
- public void testSetJavaTypeMappingAnnotation2() throws Exception {
- ICompilationUnit cu = createTestEntityWithTable();
- JavaResourcePersistentType typeResource = buildJavaTypeResource(cu);
- assertTrue(typeResource.getMappingAnnotation() instanceof EntityAnnotation);
-
- typeResource.setMappingAnnotation(JPA.EMBEDDABLE);
- assertTrue(typeResource.getMappingAnnotation() instanceof EmbeddableAnnotation);
-
- assertSourceDoesNotContain("@Entity", cu);
- assertSourceContains("@Table", cu);
- }
-
- public void testAddJavaTypeAnnotation() throws Exception {
- ICompilationUnit cu = createTestEntity();
- JavaResourcePersistentType typeResource = buildJavaTypeResource(cu);
-
- assertSourceDoesNotContain("@Table", cu);
- typeResource.addSupportingAnnotation(JPA.TABLE);
-
- assertSourceContains("@Table", cu);
- }
-
- public void testRemoveJavaTypeAnnotation() throws Exception {
- ICompilationUnit cu = createTestEntityWithTable();
- JavaResourcePersistentType typeResource = buildJavaTypeResource(cu);
- assertSourceContains("@Table", cu);
- typeResource.removeSupportingAnnotation(JPA.TABLE);
- assertSourceDoesNotContain("@Table", cu);
- }
-
- //update source code to change from @Entity to @Embeddable and make sure @Table is not removed
- public void testChangeTypeMappingInSource() throws Exception {
- ICompilationUnit cu = createTestEntityWithTable();
- final JavaResourcePersistentType typeResource = buildJavaTypeResource(cu);
-
- testType(cu).edit(new Editor() {
- public void edit(ModifiedDeclaration declaration) {
- SourceEntityAnnotation.DECLARATION_ANNOTATION_ADAPTER.removeAnnotation(declaration);
- }
- });
-
- cu.createImport("javax.persistence.Embeddable", null, new NullProgressMonitor());
-
- this.testType(cu).edit(new Editor() {
- public void edit(ModifiedDeclaration declaration) {
- SourceEmbeddableAnnotation.DECLARATION_ANNOTATION_ADAPTER.newMarkerAnnotation(declaration);
- }
- });
-
- assertNotNull(typeResource.getSupportingAnnotation(JPA.TABLE));
- assertNull(typeResource.getMappingAnnotation(JPA.ENTITY));
- assertNotNull(typeResource.getMappingAnnotation(JPA.EMBEDDABLE));
- assertSourceContains("@Table", cu);
- }
-
- public void testJavaTypeAnnotationsNestable() throws Exception {
- ICompilationUnit cu = createTestEntityWithSecondaryTable();
- JavaResourcePersistentType typeResource = buildJavaTypeResource(cu);
-
- assertEquals(1, CollectionTools.size(typeResource.supportingAnnotations(JPA.SECONDARY_TABLE, JPA.SECONDARY_TABLES)));
-
- SecondaryTableAnnotation secondaryTableResource = (SecondaryTableAnnotation) typeResource.supportingAnnotations(JPA.SECONDARY_TABLE, JPA.SECONDARY_TABLES).next();
-
- assertEquals("FOO", secondaryTableResource.getName());
- }
-
- public void testJavaTypeAnnotationsNoNestable() throws Exception {
- ICompilationUnit cu = createTestEntity();
- JavaResourcePersistentType typeResource = buildJavaTypeResource(cu);
-
- assertEquals(0, CollectionTools.size(typeResource.supportingAnnotations(JPA.SECONDARY_TABLE, JPA.SECONDARY_TABLES)));
- }
-
- public void testJavaTypeAnnotationsContainerNoNestable() throws Exception {
- ICompilationUnit cu = createTestEntityWithEmptySecondaryTables();
- JavaResourcePersistentType typeResource = buildJavaTypeResource(cu);
-
- assertEquals(0, CollectionTools.size(typeResource.supportingAnnotations(JPA.SECONDARY_TABLE, JPA.SECONDARY_TABLES)));
- }
-
- public void testJavaTypeAnnotationsNestableAndContainer() throws Exception {
- ICompilationUnit cu = createTestEntityWithSecondaryTableAndSecondaryTables();
- JavaResourcePersistentType typeResource = buildJavaTypeResource(cu);
-
- assertNotNull(typeResource.getSupportingAnnotation(JPA.SECONDARY_TABLE));
- assertNotNull(typeResource.getSupportingAnnotation(JPA.SECONDARY_TABLES));
- assertEquals(2, CollectionTools.size(typeResource.supportingAnnotations(JPA.SECONDARY_TABLE, JPA.SECONDARY_TABLES)));
-
- SecondaryTableAnnotation secondaryTableResource = (SecondaryTableAnnotation) typeResource.supportingAnnotations(JPA.SECONDARY_TABLE, JPA.SECONDARY_TABLES).next();
- assertEquals("BAR", secondaryTableResource.getName());
- }
-
- // @Entity -->> @Entity
- // @SecondaryTable(name="FOO")
- public void testAddJavaTypeAnnotationNestableContainer() throws Exception {
- ICompilationUnit cu = createTestEntity();
- JavaResourcePersistentType typeResource = buildJavaTypeResource(cu);
- SecondaryTableAnnotation secondaryTableResource = (SecondaryTableAnnotation) typeResource.addSupportingAnnotation(0, JPA.SECONDARY_TABLE, JPA.SECONDARY_TABLES);
- secondaryTableResource.setName("FOO");
- assertSourceContains("@SecondaryTable(name = \"FOO\")", cu);
- }
-
- // @Entity -->> @Entity
- // @SecondaryTable(name="FOO") @SecondaryTables({@SecondaryTable(name="FOO"), @SecondaryTable(name="BAR")})
- public void testAddJavaTypeAnnotationNestableContainer2() throws Exception {
- ICompilationUnit cu = createTestEntityWithSecondaryTable();
- JavaResourcePersistentType typeResource = buildJavaTypeResource(cu);
-
- SecondaryTableAnnotation secondaryTableResource = (SecondaryTableAnnotation) typeResource.addSupportingAnnotation(1, JPA.SECONDARY_TABLE, JPA.SECONDARY_TABLES);
- secondaryTableResource.setName("BAR");
- assertSourceContains("@SecondaryTables({@SecondaryTable(name = \"FOO\"),@SecondaryTable(name = \"BAR\")})", cu);
-
- assertNull(typeResource.getSupportingAnnotation(JPA.SECONDARY_TABLE));
- assertNotNull(typeResource.getSupportingAnnotation(JPA.SECONDARY_TABLES));
- assertEquals(2, CollectionTools.size(typeResource.supportingAnnotations(JPA.SECONDARY_TABLE, JPA.SECONDARY_TABLES)));
- }
-
- // @Entity
- // @SecondaryTables(@SecondaryTable(name="FOO"))
- // ||
- // \/
- // @Entity
- // @SecondaryTables({@SecondaryTable(name="FOO"), @SecondaryTable(name="BAR")})
- public void testAddJavaTypeAnnotationNestableContainer3() throws Exception {
- ICompilationUnit cu = createTestEntityWithSecondaryTables();
- JavaResourcePersistentType typeResource = buildJavaTypeResource(cu);
-
- SecondaryTableAnnotation secondaryTableResource = (SecondaryTableAnnotation) typeResource.addSupportingAnnotation(1, JPA.SECONDARY_TABLE, JPA.SECONDARY_TABLES);
- secondaryTableResource.setName("BAR");
- assertSourceContains("@SecondaryTables({@SecondaryTable(name = \"FOO\"),@SecondaryTable(name = \"BAR\")})", cu);
-
- assertNull(typeResource.getSupportingAnnotation(JPA.SECONDARY_TABLE));
- assertNotNull(typeResource.getSupportingAnnotation(JPA.SECONDARY_TABLES));
- assertEquals(2, CollectionTools.size(typeResource.supportingAnnotations(JPA.SECONDARY_TABLE, JPA.SECONDARY_TABLES)));
- }
-
- public void testAddJavaTypeAnnotationNestableContainer5() throws Exception {
- ICompilationUnit cu = createTestEntityWithSecondaryTables();
- JavaResourcePersistentType typeResource = buildJavaTypeResource(cu);
-
- SecondaryTableAnnotation secondaryTableResource = (SecondaryTableAnnotation) typeResource.addSupportingAnnotation(0, JPA.SECONDARY_TABLE, JPA.SECONDARY_TABLES);
- secondaryTableResource.setName("BAR");
- assertSourceContains("@SecondaryTables({@SecondaryTable(name = \"BAR\"),@SecondaryTable(name = \"FOO\")})", cu);
-
- assertNull(typeResource.getSupportingAnnotation(JPA.SECONDARY_TABLE));
- assertNotNull(typeResource.getSupportingAnnotation(JPA.SECONDARY_TABLES));
- assertEquals(2, CollectionTools.size(typeResource.supportingAnnotations(JPA.SECONDARY_TABLE, JPA.SECONDARY_TABLES)));
- }
-
- public void testAddJavaTypeAnnotationNestableContainer6() throws Exception {
- ICompilationUnit cu = createTestEntityWithSecondaryTables();
- JavaResourcePersistentType typeResource = buildJavaTypeResource(cu);
-
- SecondaryTableAnnotation secondaryTableResource = (SecondaryTableAnnotation) typeResource.addSupportingAnnotation(0, JPA.SECONDARY_TABLE, JPA.SECONDARY_TABLES);
- secondaryTableResource.setName("BAR");
- assertSourceContains("@SecondaryTables({@SecondaryTable(name = \"BAR\"),@SecondaryTable(name = \"FOO\")})", cu);
-
- assertNull(typeResource.getSupportingAnnotation(JPA.SECONDARY_TABLE));
- assertNotNull(typeResource.getSupportingAnnotation(JPA.SECONDARY_TABLES));
- assertEquals(2, CollectionTools.size(typeResource.supportingAnnotations(JPA.SECONDARY_TABLE, JPA.SECONDARY_TABLES)));
-
- secondaryTableResource = (SecondaryTableAnnotation) typeResource.addSupportingAnnotation(0, JPA.SECONDARY_TABLE, JPA.SECONDARY_TABLES);
- secondaryTableResource.setName("BAZ");
- assertSourceContains("@SecondaryTables({@SecondaryTable(name = \"BAZ\"),@SecondaryTable(name = \"BAR\"), @SecondaryTable(name = \"FOO\")})", cu);
-
- assertEquals(3, CollectionTools.size(typeResource.supportingAnnotations(JPA.SECONDARY_TABLE, JPA.SECONDARY_TABLES)));
- }
-
- // @Entity
- // @SecondaryTable(name=\"FOO\")
- // @SecondaryTables({@SecondaryTable(name=\"BAR\"), @SecondaryTable(name=\"BAZ\")})
- // ||
- // \/
- // @Entity
- // @SecondaryTable(name=\"FOO\")
- // @SecondaryTables({@SecondaryTable(name=\"BAR\"), @SecondaryTable(name=\"BAZ\"), @SecondaryTable(name=\"BOO\")})
- public void testAddJavaTypeAnnotationNestableContainer4() throws Exception {
- ICompilationUnit cu = createTestEntityWithSecondaryTableAndSecondaryTables();
- JavaResourcePersistentType typeResource = buildJavaTypeResource(cu);
-
- assertNotNull(typeResource.getSupportingAnnotation(JPA.SECONDARY_TABLE));
- assertNotNull(typeResource.getSupportingAnnotation(JPA.SECONDARY_TABLES));
- assertEquals(2, CollectionTools.size(typeResource.supportingAnnotations(JPA.SECONDARY_TABLE, JPA.SECONDARY_TABLES)));
-
- SecondaryTableAnnotation secondaryTableResource = (SecondaryTableAnnotation) typeResource.addSupportingAnnotation(2, JPA.SECONDARY_TABLE, JPA.SECONDARY_TABLES);
- assertSourceContains("@SecondaryTables({@SecondaryTable(name = \"BAR\"), @SecondaryTable(name = \"BAZ\"), @SecondaryTable})", cu);
- secondaryTableResource.setName("BOO");
-
- assertNotNull(typeResource.getSupportingAnnotation(JPA.SECONDARY_TABLE));
- assertNotNull(typeResource.getSupportingAnnotation(JPA.SECONDARY_TABLES));
- assertEquals(3, CollectionTools.size(typeResource.supportingAnnotations(JPA.SECONDARY_TABLE, JPA.SECONDARY_TABLES)));
-
- Iterator<NestableAnnotation> secondaryTableAnnotations = typeResource.supportingAnnotations(JPA.SECONDARY_TABLE, JPA.SECONDARY_TABLES);
- secondaryTableResource = (SecondaryTableAnnotation) secondaryTableAnnotations.next();
- assertEquals("BAR", secondaryTableResource.getName());
- secondaryTableResource = (SecondaryTableAnnotation) secondaryTableAnnotations.next();
- assertEquals("BAZ", secondaryTableResource.getName());
- secondaryTableResource = (SecondaryTableAnnotation) secondaryTableAnnotations.next();
- assertEquals("BOO", secondaryTableResource.getName());
-
- assertSourceContains("@SecondaryTables({@SecondaryTable(name = \"BAR\"), @SecondaryTable(name = \"BAZ\"), @SecondaryTable(name = \"BOO\")})", cu);
- }
-
- //@Entity
- //@SecondaryTable(name="FOO")
- public void testRemoveJavaTypeAnnotationNestableContainer() throws Exception {
- ICompilationUnit cu = createTestEntityWithSecondaryTable();
- JavaResourcePersistentType typeResource = buildJavaTypeResource(cu);
-
- typeResource.removeSupportingAnnotation(0, JPA.SECONDARY_TABLE, JPA.SECONDARY_TABLES);
-
- assertSourceDoesNotContain("@SecondaryTable", cu);
- }
-
-
- //@Entity
- //@SecondaryTables(@SecondaryTable(name="FOO"))
- public void testRemoveJavaTypeAnnotationNestableContainer2() throws Exception {
- ICompilationUnit cu = createTestEntityWithSecondaryTables();
- JavaResourcePersistentType typeResource = buildJavaTypeResource(cu);
-
- typeResource.removeSupportingAnnotation(0, JPA.SECONDARY_TABLE, JPA.SECONDARY_TABLES);
-
- assertSourceDoesNotContain("@SecondaryTable", cu);
- assertSourceDoesNotContain("@SecondaryTables", cu);
- }
-
- public void testRemoveJavaTypeAnnotationIndex() throws Exception {
- ICompilationUnit cu = createTestEntityWith2SecondaryTables();
- JavaResourcePersistentType typeResource = buildJavaTypeResource(cu);
-
- typeResource.removeSupportingAnnotation(0, JPA.SECONDARY_TABLE, JPA.SECONDARY_TABLES);
-
- assertSourceDoesNotContain("@SecondaryTable(name = \"FOO\"", cu);
- assertSourceContains("@SecondaryTable(name = \"BAR\"", cu);
- assertSourceDoesNotContain("@SecondaryTables", cu);
- }
-
- public void testRemoveJavaTypeAnnotationIndex2() throws Exception {
- ICompilationUnit cu = createTestEntityWith2SecondaryTables();
- JavaResourcePersistentType typeResource = buildJavaTypeResource(cu);
-
- SecondaryTableAnnotation newAnnotation = (SecondaryTableAnnotation)typeResource.addSupportingAnnotation(2, JPA.SECONDARY_TABLE, JPA.SECONDARY_TABLES);
- newAnnotation.setName("BAZ");
- assertSourceContains("@SecondaryTables({@SecondaryTable(name = \"FOO\"), @SecondaryTable(name = \"BAR\"), @SecondaryTable(name = \"BAZ", cu);
-
- typeResource.removeSupportingAnnotation(1, JPA.SECONDARY_TABLE, JPA.SECONDARY_TABLES);
- assertSourceContains("@SecondaryTables({@SecondaryTable(name = \"FOO\"), @SecondaryTable(name = \"BAZ\")})", cu);
- }
-
- public void testMoveJavaTypeAnnotation() throws Exception {
- ICompilationUnit cu = createTestEntityWith2SecondaryTables();
- JavaResourcePersistentType typeResource = buildJavaTypeResource(cu);
-
- SecondaryTableAnnotation newAnnotation = (SecondaryTableAnnotation)typeResource.addSupportingAnnotation(2, JPA.SECONDARY_TABLE, JPA.SECONDARY_TABLES);
- newAnnotation.setName("BAZ");
- assertSourceContains("@SecondaryTables({@SecondaryTable(name = \"FOO\"), @SecondaryTable(name = \"BAR\"), @SecondaryTable(name = \"BAZ\")})", cu);
-
- typeResource.moveSupportingAnnotation(0, 2, JPA.SECONDARY_TABLES);
- assertSourceContains("@SecondaryTables({@SecondaryTable(name = \"BAZ\"), @SecondaryTable(name = \"FOO\"), @SecondaryTable(name = \"BAR\")})", cu);
- }
-
- public void testMoveJavaTypeAnnotation2() throws Exception {
- ICompilationUnit cu = createTestEntityWith2SecondaryTables();
- JavaResourcePersistentType typeResource = buildJavaTypeResource(cu);
-
- SecondaryTableAnnotation newAnnotation = (SecondaryTableAnnotation)typeResource.addSupportingAnnotation(2, JPA.SECONDARY_TABLE, JPA.SECONDARY_TABLES);
- newAnnotation.setName("BAZ");
- assertSourceContains("@SecondaryTables({@SecondaryTable(name = \"FOO\"), @SecondaryTable(name = \"BAR\"), @SecondaryTable(name = \"BAZ\")})", cu);
-
- typeResource.moveSupportingAnnotation(2, 0, JPA.SECONDARY_TABLES);
- assertSourceContains("@SecondaryTables({@SecondaryTable(name = \"BAR\"), @SecondaryTable(name = \"BAZ\"), @SecondaryTable(name = \"FOO\")})", cu);
- }
-
- public void testNestedTypes() throws Exception {
- ICompilationUnit cu = createTestEntityWithMemberTypes();
- JavaResourcePersistentType persistentType = buildJavaTypeResource(cu);
-
- assertEquals("only persistable types should be returned by #persistableTypes()", 1, CollectionTools.size(persistentType.persistableTypes()));
- assertEquals("enums and interfaces should be ignored", 2, CollectionTools.size(persistentType.types()));
- }
-
- public void testDuplicateEntityAnnotations() throws Exception {
- ICompilationUnit cu = createTestEntityDuplicates();
- JavaResourcePersistentType persistentType = buildJavaTypeResource(cu);
-
- EntityAnnotation javaTypeMappingAnnotation = (EntityAnnotation) persistentType.getMappingAnnotation(JPA.ENTITY);
- assertEquals("FirstEntity", javaTypeMappingAnnotation.getName());
-
- assertEquals(1, persistentType.mappingAnnotationsSize());
-
- javaTypeMappingAnnotation = (EntityAnnotation) persistentType.getMappingAnnotation();
- assertEquals("FirstEntity", javaTypeMappingAnnotation.getName());
-
- }
-
-
- public void testAttributes() throws Exception {
- // TODO
- }
-
- public void testFields() throws Exception {
- // TODO
- }
-
- public void testProperties() throws Exception {
- // TODO
- }
-
- public void testGetAccessNoAttributesAnnotated() throws Exception {
- ICompilationUnit cu = createTestEntity();
- JavaResourcePersistentType persistentType = buildJavaTypeResource(cu);
-
- assertNull(persistentType.getAccess());
- }
-
- public void testGetAccessFieldsAnnotated() throws Exception {
- ICompilationUnit cu = createTestEntityAnnotatedField();
- JavaResourcePersistentType persistentType = buildJavaTypeResource(cu);
-
- assertEquals(AccessType.FIELD, persistentType.getAccess());
- }
-
- public void testGetAccessMethodsAnnotated() throws Exception {
- ICompilationUnit cu = createTestEntityAnnotatedMethod();
- JavaResourcePersistentType persistentType = buildJavaTypeResource(cu);
-
- assertEquals(AccessType.PROPERTY, persistentType.getAccess());
- }
-
- public void testGetAccessFieldsAndMethodsAnnotated() throws Exception {
- ICompilationUnit cu = createTestEntityAnnotatedFieldAndMethod();
- JavaResourcePersistentType persistentType = buildJavaTypeResource(cu);
-
- assertEquals(AccessType.FIELD, persistentType.getAccess());
- }
-
- public void testGetAccessNonPersistableMethodAnnotated() throws Exception {
- ICompilationUnit cu = createTestEntityAnnotatedNonPersistableMethod();
- JavaResourcePersistentType persistentType = buildJavaTypeResource(cu);
-
- assertNull(persistentType.getAccess());
- }
-
- public void testGetAccessPersistableMethodAndNonPersistableFieldAnnotated() throws Exception {
- ICompilationUnit cu = createTestEntityAnnotatedPersistableMethodNonPersistableField();
- JavaResourcePersistentType persistentType = buildJavaTypeResource(cu);
-
- assertEquals(AccessType.PROPERTY, persistentType.getAccess());
- }
-
- public void testGetAccessNoPersistableFieldsAnnotated() throws Exception {
- ICompilationUnit cu = createTestEntityNoPersistableFields();
- JavaResourcePersistentType persistentType = buildJavaTypeResource(cu);
-
- assertEquals(AccessType.PROPERTY, persistentType.getAccess());
- }
-
- //TODO more tests here with superclasses other than Object.
- //1. Test where the superclass does not resolve
- //2. Test a superclass that does resolve
- //3. What about a superclass that is a class file in a jar??
- //4.
- public void testGetSuperclassQualifiedName() throws Exception {
- ICompilationUnit cu = createTestEntity();
- JavaResourcePersistentType persistentType = buildJavaTypeResource(cu);
-
- assertEquals("java.lang.Object", persistentType.getSuperclassQualifiedName());
-
- }
-
- //more detailed tests in JPTToolsTests
- public void testIsPersistable() throws Exception {
- ICompilationUnit cu = createTestEntity();
- JavaResourcePersistentType persistentType = buildJavaTypeResource(cu);
-
- assertTrue(persistentType.isPersistable());
- }
-
- public void testAnnotatedMemberType() throws Exception {
- ICompilationUnit cu = this.createTestEntityWithMemberEmbeddable();
- JavaResourcePersistentType typeResource = buildJavaTypeResource(cu);
- assertNotNull(typeResource.getMappingAnnotation(JPA.ENTITY));
- assertNull(typeResource.getMappingAnnotation(JPA.EMBEDDABLE));
-
- JavaResourcePersistentType nestedType = typeResource.persistableTypes().next();
- assertNull(nestedType.getMappingAnnotation(JPA.ENTITY));
- assertNotNull(nestedType.getMappingAnnotation(JPA.EMBEDDABLE));
- }
-
- public void testInvalidAnnotations() throws Exception {
- ICompilationUnit cu = this.createTestInvalidAnnotations();
- JavaResourcePersistentType typeResource = buildJavaTypeResource(cu);
- assertEquals(0, typeResource.mappingAnnotationsSize());
- assertEquals(0, typeResource.supportingAnnotationsSize());
-
- JavaResourcePersistentAttribute attributeResource = typeResource.fields().next();
- assertEquals(0, attributeResource.mappingAnnotationsSize());
- assertEquals(0, attributeResource.supportingAnnotationsSize());
- }
-
-}
diff --git a/jpa/tests/org.eclipse.jpt.core.tests/src/org/eclipse/jpt/core/tests/internal/resource/java/JoinColumnTests.java b/jpa/tests/org.eclipse.jpt.core.tests/src/org/eclipse/jpt/core/tests/internal/resource/java/JoinColumnTests.java
deleted file mode 100644
index 7b5953c283..0000000000
--- a/jpa/tests/org.eclipse.jpt.core.tests/src/org/eclipse/jpt/core/tests/internal/resource/java/JoinColumnTests.java
+++ /dev/null
@@ -1,352 +0,0 @@
-/*******************************************************************************
- * Copyright (c) 2007, 2009 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.
- *
- * Contributors:
- * Oracle - initial API and implementation
- ******************************************************************************/
-package org.eclipse.jpt.core.tests.internal.resource.java;
-
-import java.util.Iterator;
-import org.eclipse.jdt.core.ICompilationUnit;
-import org.eclipse.jpt.core.resource.java.JPA;
-import org.eclipse.jpt.core.resource.java.JavaResourcePersistentAttribute;
-import org.eclipse.jpt.core.resource.java.JavaResourcePersistentType;
-import org.eclipse.jpt.core.resource.java.JoinColumnAnnotation;
-import org.eclipse.jpt.utility.internal.iterators.ArrayIterator;
-
-@SuppressWarnings("nls")
-public class JoinColumnTests extends JavaResourceModelTestCase {
-
- private static final String COLUMN_NAME = "MY_COLUMN";
- private static final String COLUMN_TABLE = "MY_TABLE";
- private static final String COLUMN_COLUMN_DEFINITION = "COLUMN_DEFINITION";
- private static final String COLUMN_REFERENCED_COLUMN_NAME = "MY_REF_COLUMN_NAME";
-
- public JoinColumnTests(String name) {
- super(name);
- }
-
- private ICompilationUnit createTestJoinColumn() throws Exception {
- return this.createTestType(new DefaultAnnotationWriter() {
- @Override
- public Iterator<String> imports() {
- return new ArrayIterator<String>(JPA.JOIN_COLUMN);
- }
- @Override
- public void appendIdFieldAnnotationTo(StringBuilder sb) {
- sb.append("@JoinColumn");
- }
- });
- }
-
- private ICompilationUnit createTestJoinColumnWithName() throws Exception {
- return this.createTestType(new DefaultAnnotationWriter() {
- @Override
- public Iterator<String> imports() {
- return new ArrayIterator<String>(JPA.JOIN_COLUMN);
- }
- @Override
- public void appendIdFieldAnnotationTo(StringBuilder sb) {
- sb.append("@JoinColumn(name = \"" + COLUMN_NAME + "\")");
- }
- });
- }
-
- private ICompilationUnit createTestJoinColumnWithTable() throws Exception {
- return this.createTestType(new DefaultAnnotationWriter() {
- @Override
- public Iterator<String> imports() {
- return new ArrayIterator<String>(JPA.JOIN_COLUMN);
- }
- @Override
- public void appendIdFieldAnnotationTo(StringBuilder sb) {
- sb.append("@JoinColumn(table = \"" + COLUMN_TABLE + "\")");
- }
- });
- }
-
- private ICompilationUnit createTestJoinColumnWithReferencedColumnName() throws Exception {
- return this.createTestType(new DefaultAnnotationWriter() {
- @Override
- public Iterator<String> imports() {
- return new ArrayIterator<String>(JPA.JOIN_COLUMN);
- }
- @Override
- public void appendIdFieldAnnotationTo(StringBuilder sb) {
- sb.append("@JoinColumn(referencedColumnName = \"" + COLUMN_REFERENCED_COLUMN_NAME + "\")");
- }
- });
- }
-
- private ICompilationUnit createTestJoinColumnWithColumnDefinition() throws Exception {
- return this.createTestType(new DefaultAnnotationWriter() {
- @Override
- public Iterator<String> imports() {
- return new ArrayIterator<String>(JPA.JOIN_COLUMN);
- }
- @Override
- public void appendIdFieldAnnotationTo(StringBuilder sb) {
- sb.append("@JoinColumn(columnDefinition = \"" + COLUMN_COLUMN_DEFINITION + "\")");
- }
- });
- }
-
- private ICompilationUnit createTestJoinColumnWithBooleanElement(final String booleanElement) throws Exception {
- return this.createTestType(new DefaultAnnotationWriter() {
- @Override
- public Iterator<String> imports() {
- return new ArrayIterator<String>(JPA.JOIN_COLUMN);
- }
- @Override
- public void appendIdFieldAnnotationTo(StringBuilder sb) {
- sb.append("@JoinColumn(" + booleanElement + " = true)");
- }
- });
- }
-
- public void testGetName() throws Exception {
- ICompilationUnit cu = this.createTestJoinColumnWithName();
- JavaResourcePersistentType typeResource = buildJavaTypeResource(cu);
- JavaResourcePersistentAttribute attributeResource = typeResource.fields().next();
- JoinColumnAnnotation column = (JoinColumnAnnotation) attributeResource.getSupportingAnnotation(JPA.JOIN_COLUMN);
- assertNotNull(column);
- assertEquals(COLUMN_NAME, column.getName());
- }
-
- public void testGetNull() throws Exception {
- ICompilationUnit cu = this.createTestJoinColumn();
- JavaResourcePersistentType typeResource = buildJavaTypeResource(cu);
- JavaResourcePersistentAttribute attributeResource = typeResource.fields().next();
- JoinColumnAnnotation column = (JoinColumnAnnotation) attributeResource.getSupportingAnnotation(JPA.JOIN_COLUMN);
- assertNotNull(column);
- assertNull(column.getName());
- assertNull(column.getNullable());
- assertNull(column.getInsertable());
- assertNull(column.getUnique());
- assertNull(column.getUpdatable());
- assertNull(column.getTable());
- assertNull(column.getReferencedColumnName());
- assertNull(column.getColumnDefinition());
- }
-
- public void testSetName() throws Exception {
- ICompilationUnit cu = this.createTestJoinColumn();
- JavaResourcePersistentType typeResource = buildJavaTypeResource(cu);
- JavaResourcePersistentAttribute attributeResource = typeResource.fields().next();
- JoinColumnAnnotation column = (JoinColumnAnnotation) attributeResource.getSupportingAnnotation(JPA.JOIN_COLUMN);
-
- assertNotNull(column);
- assertNull(column.getName());
-
- column.setName("Foo");
- assertEquals("Foo", column.getName());
-
- assertSourceContains("@JoinColumn(name = \"Foo\")", cu);
- }
-
- public void testSetNameNull() throws Exception {
- ICompilationUnit cu = this.createTestJoinColumnWithName();
- JavaResourcePersistentType typeResource = buildJavaTypeResource(cu);
- JavaResourcePersistentAttribute attributeResource = typeResource.fields().next();
- JoinColumnAnnotation column = (JoinColumnAnnotation) attributeResource.getSupportingAnnotation(JPA.JOIN_COLUMN);
-
- assertEquals(COLUMN_NAME, column.getName());
-
- column.setName(null);
- assertNull(column.getName());
-
- assertSourceDoesNotContain("@JoinColumn", cu);
- }
-
- public void testGetTable() throws Exception {
- ICompilationUnit cu = this.createTestJoinColumnWithTable();
- JavaResourcePersistentType typeResource = buildJavaTypeResource(cu);
- JavaResourcePersistentAttribute attributeResource = typeResource.fields().next();
- JoinColumnAnnotation column = (JoinColumnAnnotation) attributeResource.getSupportingAnnotation(JPA.JOIN_COLUMN);
- assertEquals(COLUMN_TABLE, column.getTable());
- }
-
- public void testSetTable() throws Exception {
- ICompilationUnit cu = this.createTestJoinColumn();
- JavaResourcePersistentType typeResource = buildJavaTypeResource(cu);
- JavaResourcePersistentAttribute attributeResource = typeResource.fields().next();
- JoinColumnAnnotation column = (JoinColumnAnnotation) attributeResource.getSupportingAnnotation(JPA.JOIN_COLUMN);
-
- assertNotNull(column);
- assertNull(column.getTable());
-
- column.setTable("Foo");
- assertEquals("Foo", column.getTable());
-
- assertSourceContains("@JoinColumn(table = \"Foo\")", cu);
-
-
- column.setTable(null);
- assertSourceDoesNotContain("@JoinColumn", cu);
- }
-
- public void testGetReferencedColumnName() throws Exception {
- ICompilationUnit cu = this.createTestJoinColumnWithReferencedColumnName();
- JavaResourcePersistentType typeResource = buildJavaTypeResource(cu);
- JavaResourcePersistentAttribute attributeResource = typeResource.fields().next();
- JoinColumnAnnotation column = (JoinColumnAnnotation) attributeResource.getSupportingAnnotation(JPA.JOIN_COLUMN);
- assertEquals(COLUMN_REFERENCED_COLUMN_NAME, column.getReferencedColumnName());
- }
-
- public void testSetReferencedColumnName() throws Exception {
- ICompilationUnit cu = this.createTestJoinColumn();
- JavaResourcePersistentType typeResource = buildJavaTypeResource(cu);
- JavaResourcePersistentAttribute attributeResource = typeResource.fields().next();
- JoinColumnAnnotation column = (JoinColumnAnnotation) attributeResource.getSupportingAnnotation(JPA.JOIN_COLUMN);
-
- assertNotNull(column);
- assertNull(column.getReferencedColumnName());
-
- column.setReferencedColumnName("Foo");
- assertEquals("Foo", column.getReferencedColumnName());
-
- assertSourceContains("@JoinColumn(referencedColumnName = \"Foo\")", cu);
-
-
- column.setReferencedColumnName(null);
- assertSourceDoesNotContain("@JoinColumn", cu);
- }
-
- public void testGetColumnDefinition() throws Exception {
- ICompilationUnit cu = this.createTestJoinColumnWithColumnDefinition();
- JavaResourcePersistentType typeResource = buildJavaTypeResource(cu);
- JavaResourcePersistentAttribute attributeResource = typeResource.fields().next();
- JoinColumnAnnotation column = (JoinColumnAnnotation) attributeResource.getSupportingAnnotation(JPA.JOIN_COLUMN);
- assertEquals(COLUMN_COLUMN_DEFINITION, column.getColumnDefinition());
- }
-
- public void testSetColumnDefinition() throws Exception {
- ICompilationUnit cu = this.createTestJoinColumn();
- JavaResourcePersistentType typeResource = buildJavaTypeResource(cu);
- JavaResourcePersistentAttribute attributeResource = typeResource.fields().next();
- JoinColumnAnnotation column = (JoinColumnAnnotation) attributeResource.getSupportingAnnotation(JPA.JOIN_COLUMN);
-
- assertNotNull(column);
- assertNull(column.getColumnDefinition());
-
- column.setColumnDefinition("Foo");
- assertEquals("Foo", column.getColumnDefinition());
-
- assertSourceContains("@JoinColumn(columnDefinition = \"Foo\")", cu);
-
-
- column.setColumnDefinition(null);
- assertSourceDoesNotContain("@JoinColumn", cu);
- }
-
- public void testGetUnique() throws Exception {
- ICompilationUnit cu = this.createTestJoinColumnWithBooleanElement("unique");
- JavaResourcePersistentType typeResource = buildJavaTypeResource(cu);
- JavaResourcePersistentAttribute attributeResource = typeResource.fields().next();
- JoinColumnAnnotation column = (JoinColumnAnnotation) attributeResource.getSupportingAnnotation(JPA.JOIN_COLUMN);
-
- assertEquals(Boolean.TRUE, column.getUnique());
- }
-
- public void testSetUnique() throws Exception {
- ICompilationUnit cu = this.createTestJoinColumn();
- JavaResourcePersistentType typeResource = buildJavaTypeResource(cu);
- JavaResourcePersistentAttribute attributeResource = typeResource.fields().next();
- JoinColumnAnnotation column = (JoinColumnAnnotation) attributeResource.getSupportingAnnotation(JPA.JOIN_COLUMN);
-
- assertNotNull(column);
- assertNull(column.getUnique());
-
- column.setUnique(Boolean.FALSE);
- assertEquals(Boolean.FALSE, column.getUnique());
-
- assertSourceContains("@JoinColumn(unique = false)", cu);
-
- column.setUnique(null);
- assertSourceDoesNotContain("@JoinColumn", cu);
- }
-
- public void testGetNullable() throws Exception {
- ICompilationUnit cu = this.createTestJoinColumnWithBooleanElement("nullable");
- JavaResourcePersistentType typeResource = buildJavaTypeResource(cu);
- JavaResourcePersistentAttribute attributeResource = typeResource.fields().next();
- JoinColumnAnnotation column = (JoinColumnAnnotation) attributeResource.getSupportingAnnotation(JPA.JOIN_COLUMN);
-
- assertEquals(Boolean.TRUE, column.getNullable());
- }
-
- public void testSetNullable() throws Exception {
- ICompilationUnit cu = this.createTestJoinColumn();
- JavaResourcePersistentType typeResource = buildJavaTypeResource(cu);
- JavaResourcePersistentAttribute attributeResource = typeResource.fields().next();
- JoinColumnAnnotation column = (JoinColumnAnnotation) attributeResource.getSupportingAnnotation(JPA.JOIN_COLUMN);
-
- assertNotNull(column);
- assertNull(column.getNullable());
-
- column.setNullable(Boolean.FALSE);
- assertEquals(Boolean.FALSE, column.getNullable());
-
- assertSourceContains("@JoinColumn(nullable = false)", cu);
-
- column.setNullable(null);
- assertSourceDoesNotContain("@JoinColumn", cu);
- }
-
- public void testGetInsertable() throws Exception {
- ICompilationUnit cu = this.createTestJoinColumnWithBooleanElement("insertable");
- JavaResourcePersistentType typeResource = buildJavaTypeResource(cu);
- JavaResourcePersistentAttribute attributeResource = typeResource.fields().next();
- JoinColumnAnnotation column = (JoinColumnAnnotation) attributeResource.getSupportingAnnotation(JPA.JOIN_COLUMN);
-
- assertEquals(Boolean.TRUE, column.getInsertable());
- }
-
- public void testSetInsertable() throws Exception {
- ICompilationUnit cu = this.createTestJoinColumn();
- JavaResourcePersistentType typeResource = buildJavaTypeResource(cu);
- JavaResourcePersistentAttribute attributeResource = typeResource.fields().next();
- JoinColumnAnnotation column = (JoinColumnAnnotation) attributeResource.getSupportingAnnotation(JPA.JOIN_COLUMN);
-
- assertNotNull(column);
- assertNull(column.getInsertable());
-
- column.setInsertable(Boolean.FALSE);
- assertEquals(Boolean.FALSE, column.getInsertable());
-
- assertSourceContains("@JoinColumn(insertable = false)", cu);
-
- column.setInsertable(null);
- assertSourceDoesNotContain("@JoinColumn", cu);
- }
-
- public void testGetUpdatable() throws Exception {
- ICompilationUnit cu = this.createTestJoinColumnWithBooleanElement("updatable");
- JavaResourcePersistentType typeResource = buildJavaTypeResource(cu);
- JavaResourcePersistentAttribute attributeResource = typeResource.fields().next();
- JoinColumnAnnotation column = (JoinColumnAnnotation) attributeResource.getSupportingAnnotation(JPA.JOIN_COLUMN);
-
- assertEquals(Boolean.TRUE, column.getUpdatable());
- }
-
- public void testSetUpdatable() throws Exception {
- ICompilationUnit cu = this.createTestJoinColumn();
- JavaResourcePersistentType typeResource = buildJavaTypeResource(cu);
- JavaResourcePersistentAttribute attributeResource = typeResource.fields().next();
- JoinColumnAnnotation column = (JoinColumnAnnotation) attributeResource.getSupportingAnnotation(JPA.JOIN_COLUMN);
-
- assertNotNull(column);
- assertNull(column.getUpdatable());
-
- column.setUpdatable(Boolean.FALSE);
- assertEquals(Boolean.FALSE, column.getUpdatable());
-
- assertSourceContains("@JoinColumn(updatable = false)", cu);
-
- column.setUpdatable(null);
- assertSourceDoesNotContain("@JoinColumn", cu);
- }
-}
diff --git a/jpa/tests/org.eclipse.jpt.core.tests/src/org/eclipse/jpt/core/tests/internal/resource/java/JoinColumnsTests.java b/jpa/tests/org.eclipse.jpt.core.tests/src/org/eclipse/jpt/core/tests/internal/resource/java/JoinColumnsTests.java
deleted file mode 100644
index 8be5c3e571..0000000000
--- a/jpa/tests/org.eclipse.jpt.core.tests/src/org/eclipse/jpt/core/tests/internal/resource/java/JoinColumnsTests.java
+++ /dev/null
@@ -1,421 +0,0 @@
-/*******************************************************************************
- * Copyright (c) 2007, 2009 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.
- *
- * Contributors:
- * Oracle - initial API and implementation
- ******************************************************************************/
-package org.eclipse.jpt.core.tests.internal.resource.java;
-
-import java.util.Iterator;
-
-import org.eclipse.jdt.core.ICompilationUnit;
-import org.eclipse.jpt.core.resource.java.JPA;
-import org.eclipse.jpt.core.resource.java.JavaResourcePersistentAttribute;
-import org.eclipse.jpt.core.resource.java.JavaResourcePersistentType;
-import org.eclipse.jpt.core.resource.java.JoinColumnAnnotation;
-import org.eclipse.jpt.core.resource.java.NestableAnnotation;
-import org.eclipse.jpt.utility.internal.CollectionTools;
-import org.eclipse.jpt.utility.internal.iterators.ArrayIterator;
-
-@SuppressWarnings("nls")
-public class JoinColumnsTests extends JavaResourceModelTestCase {
-
- private static final String COLUMN_NAME = "MY_COLUMN";
- private static final String COLUMN_TABLE = "MY_TABLE";
- private static final String COLUMN_COLUMN_DEFINITION = "COLUMN_DEFINITION";
- private static final String COLUMN_REFERENCED_COLUMN_NAME = "MY_REF_COLUMN_NAME";
-
- public JoinColumnsTests(String name) {
- super(name);
- }
-
- private ICompilationUnit createTestJoinColumns() throws Exception {
- return this.createTestType(new DefaultAnnotationWriter() {
- @Override
- public Iterator<String> imports() {
- return new ArrayIterator<String>(JPA.JOIN_COLUMN, JPA.JOIN_COLUMNS);
- }
- @Override
- public void appendIdFieldAnnotationTo(StringBuilder sb) {
- sb.append("@JoinColumns(@JoinColumn)");
- }
- });
- }
-
- private ICompilationUnit createTestJoinColumnWithName() throws Exception {
- return this.createTestType(new DefaultAnnotationWriter() {
- @Override
- public Iterator<String> imports() {
- return new ArrayIterator<String>(JPA.JOIN_COLUMN, JPA.JOIN_COLUMNS);
- }
- @Override
- public void appendIdFieldAnnotationTo(StringBuilder sb) {
- sb.append("@JoinColumns(@JoinColumn(name = \"" + COLUMN_NAME + "\"))");
- }
- });
- }
-
- private ICompilationUnit createTestJoinColumnWithTable() throws Exception {
- return this.createTestType(new DefaultAnnotationWriter() {
- @Override
- public Iterator<String> imports() {
- return new ArrayIterator<String>(JPA.JOIN_COLUMN, JPA.JOIN_COLUMNS);
- }
- @Override
- public void appendIdFieldAnnotationTo(StringBuilder sb) {
- sb.append("@JoinColumns(@JoinColumn(table = \"" + COLUMN_TABLE + "\"))");
- }
- });
- }
-
- private ICompilationUnit createTestJoinColumnWithReferencedColumnName() throws Exception {
- return this.createTestType(new DefaultAnnotationWriter() {
- @Override
- public Iterator<String> imports() {
- return new ArrayIterator<String>(JPA.JOIN_COLUMN, JPA.JOIN_COLUMNS);
- }
- @Override
- public void appendIdFieldAnnotationTo(StringBuilder sb) {
- sb.append("@JoinColumns(@JoinColumn(referencedColumnName = \"" + COLUMN_REFERENCED_COLUMN_NAME + "\"))");
- }
- });
- }
-
- private ICompilationUnit createTestJoinColumnWithColumnDefinition() throws Exception {
- return this.createTestType(new DefaultAnnotationWriter() {
- @Override
- public Iterator<String> imports() {
- return new ArrayIterator<String>(JPA.JOIN_COLUMN, JPA.JOIN_COLUMNS);
- }
- @Override
- public void appendIdFieldAnnotationTo(StringBuilder sb) {
- sb.append("@JoinColumns(@JoinColumn(columnDefinition = \"" + COLUMN_COLUMN_DEFINITION + "\"))");
- }
- });
- }
-
- private ICompilationUnit createTestJoinColumnWithBooleanElement(final String booleanElement) throws Exception {
- return this.createTestType(new DefaultAnnotationWriter() {
- @Override
- public Iterator<String> imports() {
- return new ArrayIterator<String>(JPA.JOIN_COLUMN, JPA.JOIN_COLUMNS);
- }
- @Override
- public void appendIdFieldAnnotationTo(StringBuilder sb) {
- sb.append("@JoinColumns(@JoinColumn(" + booleanElement + " = true))");
- }
- });
- }
-
- private ICompilationUnit createTestJoinColumn() throws Exception {
- return this.createTestType(new DefaultAnnotationWriter() {
- @Override
- public Iterator<String> imports() {
- return new ArrayIterator<String>(JPA.JOIN_COLUMN, JPA.JOIN_COLUMNS);
- }
- @Override
- public void appendIdFieldAnnotationTo(StringBuilder sb) {
- sb.append("@JoinColumn(name = \"BAR\", referencedColumnName = \"REF_NAME\", unique = false, nullable = false, insertable = false, updatable = false, columnDefinition = \"COLUMN_DEF\", table = \"TABLE\")");
- }
- });
- }
-
- public void testGetName() throws Exception {
- ICompilationUnit cu = this.createTestJoinColumnWithName();
- JavaResourcePersistentType typeResource = buildJavaTypeResource(cu);
- JavaResourcePersistentAttribute attributeResource = typeResource.fields().next();
- JoinColumnAnnotation column = (JoinColumnAnnotation) attributeResource.supportingAnnotations(JPA.JOIN_COLUMN, JPA.JOIN_COLUMNS).next();
- assertNotNull(column);
- assertEquals(COLUMN_NAME, column.getName());
- }
-
- public void testGetNull() throws Exception {
- ICompilationUnit cu = this.createTestJoinColumns();
- JavaResourcePersistentType typeResource = buildJavaTypeResource(cu);
- JavaResourcePersistentAttribute attributeResource = typeResource.fields().next();
- JoinColumnAnnotation column = (JoinColumnAnnotation) attributeResource.supportingAnnotations(JPA.JOIN_COLUMN, JPA.JOIN_COLUMNS).next();
- assertNotNull(column);
- assertNull(column.getName());
- assertNull(column.getNullable());
- assertNull(column.getInsertable());
- assertNull(column.getUnique());
- assertNull(column.getUpdatable());
- assertNull(column.getTable());
- assertNull(column.getColumnDefinition());
- }
-
- public void testSetName() throws Exception {
- ICompilationUnit cu = this.createTestJoinColumns();
- JavaResourcePersistentType typeResource = buildJavaTypeResource(cu);
- JavaResourcePersistentAttribute attributeResource = typeResource.fields().next();
- JoinColumnAnnotation column = (JoinColumnAnnotation) attributeResource.supportingAnnotations(JPA.JOIN_COLUMN, JPA.JOIN_COLUMNS).next();
-
- assertNotNull(column);
- assertNull(column.getName());
-
- column.setName("Foo");
- assertEquals("Foo", column.getName());
-
- assertSourceContains("@JoinColumns(@JoinColumn(name = \"Foo\"))", cu);
- }
-
- public void testSetNameNull() throws Exception {
- ICompilationUnit cu = this.createTestJoinColumnWithName();
- JavaResourcePersistentType typeResource = buildJavaTypeResource(cu);
- JavaResourcePersistentAttribute attributeResource = typeResource.fields().next();
- JoinColumnAnnotation column = (JoinColumnAnnotation) attributeResource.supportingAnnotations(JPA.JOIN_COLUMN, JPA.JOIN_COLUMNS).next();
-
- assertEquals(COLUMN_NAME, column.getName());
-
- column.setName(null);
- assertNull(column.getName());
-
- assertSourceDoesNotContain("@JoinColumn", cu);
- }
-
- public void testGetTable() throws Exception {
- ICompilationUnit cu = this.createTestJoinColumnWithTable();
- JavaResourcePersistentType typeResource = buildJavaTypeResource(cu);
- JavaResourcePersistentAttribute attributeResource = typeResource.fields().next();
- JoinColumnAnnotation column = (JoinColumnAnnotation) attributeResource.supportingAnnotations(JPA.JOIN_COLUMN, JPA.JOIN_COLUMNS).next();
- assertEquals(COLUMN_TABLE, column.getTable());
- }
-
- public void testSetTable() throws Exception {
- ICompilationUnit cu = this.createTestJoinColumns();
- JavaResourcePersistentType typeResource = buildJavaTypeResource(cu);
- JavaResourcePersistentAttribute attributeResource = typeResource.fields().next();
- JoinColumnAnnotation column = (JoinColumnAnnotation) attributeResource.supportingAnnotations(JPA.JOIN_COLUMN, JPA.JOIN_COLUMNS).next();
-
- assertNotNull(column);
- assertNull(column.getTable());
-
- column.setTable("Foo");
- assertEquals("Foo", column.getTable());
-
- assertSourceContains("@JoinColumns(@JoinColumn(table = \"Foo\"))", cu);
-
-
- column.setTable(null);
- assertSourceDoesNotContain("@JoinColumn", cu);
- }
-
- public void testGetReferencedColumnName() throws Exception {
- ICompilationUnit cu = this.createTestJoinColumnWithReferencedColumnName();
- JavaResourcePersistentType typeResource = buildJavaTypeResource(cu);
- JavaResourcePersistentAttribute attributeResource = typeResource.fields().next();
- JoinColumnAnnotation column = (JoinColumnAnnotation) attributeResource.supportingAnnotations(JPA.JOIN_COLUMN, JPA.JOIN_COLUMNS).next();
- assertEquals(COLUMN_REFERENCED_COLUMN_NAME, column.getReferencedColumnName());
- }
-
- public void testSetReferencedColumnName() throws Exception {
- ICompilationUnit cu = this.createTestJoinColumns();
- JavaResourcePersistentType typeResource = buildJavaTypeResource(cu);
- JavaResourcePersistentAttribute attributeResource = typeResource.fields().next();
- JoinColumnAnnotation column = (JoinColumnAnnotation) attributeResource.supportingAnnotations(JPA.JOIN_COLUMN, JPA.JOIN_COLUMNS).next();
-
- assertNotNull(column);
- assertNull(column.getReferencedColumnName());
-
- column.setReferencedColumnName("Foo");
- assertEquals("Foo", column.getReferencedColumnName());
-
- assertSourceContains("@JoinColumns(@JoinColumn(referencedColumnName = \"Foo\"))", cu);
-
-
- column.setReferencedColumnName(null);
- assertSourceDoesNotContain("@JoinColumn", cu);
- }
-
- public void testGetColumnDefinition() throws Exception {
- ICompilationUnit cu = this.createTestJoinColumnWithColumnDefinition();
- JavaResourcePersistentType typeResource = buildJavaTypeResource(cu);
- JavaResourcePersistentAttribute attributeResource = typeResource.fields().next();
- JoinColumnAnnotation column = (JoinColumnAnnotation) attributeResource.supportingAnnotations(JPA.JOIN_COLUMN, JPA.JOIN_COLUMNS).next();
- assertEquals(COLUMN_COLUMN_DEFINITION, column.getColumnDefinition());
- }
-
- public void testSetColumnDefinition() throws Exception {
- ICompilationUnit cu = this.createTestJoinColumns();
- JavaResourcePersistentType typeResource = buildJavaTypeResource(cu);
- JavaResourcePersistentAttribute attributeResource = typeResource.fields().next();
- JoinColumnAnnotation column = (JoinColumnAnnotation) attributeResource.supportingAnnotations(JPA.JOIN_COLUMN, JPA.JOIN_COLUMNS).next();
-
- assertNotNull(column);
- assertNull(column.getColumnDefinition());
-
- column.setColumnDefinition("Foo");
- assertEquals("Foo", column.getColumnDefinition());
-
- assertSourceContains("@JoinColumns(@JoinColumn(columnDefinition = \"Foo\"))", cu);
-
-
- column.setColumnDefinition(null);
- assertSourceDoesNotContain("@JoinColumn", cu);
- }
-
- public void testGetUnique() throws Exception {
- ICompilationUnit cu = this.createTestJoinColumnWithBooleanElement("unique");
- JavaResourcePersistentType typeResource = buildJavaTypeResource(cu);
- JavaResourcePersistentAttribute attributeResource = typeResource.fields().next();
- JoinColumnAnnotation column = (JoinColumnAnnotation) attributeResource.supportingAnnotations(JPA.JOIN_COLUMN, JPA.JOIN_COLUMNS).next();
-
- assertTrue(column.getUnique().booleanValue());
- }
-
- public void testSetUnique() throws Exception {
- ICompilationUnit cu = this.createTestJoinColumns();
- JavaResourcePersistentType typeResource = buildJavaTypeResource(cu);
- JavaResourcePersistentAttribute attributeResource = typeResource.fields().next();
- JoinColumnAnnotation column = (JoinColumnAnnotation) attributeResource.supportingAnnotations(JPA.JOIN_COLUMN, JPA.JOIN_COLUMNS).next();
-
- assertNotNull(column);
- assertNull(column.getUnique());
-
- column.setUnique(Boolean.FALSE);
- assertFalse(column.getUnique().booleanValue());
-
- assertSourceContains("@JoinColumns(@JoinColumn(unique = false))", cu);
-
- column.setUnique(null);
- assertSourceDoesNotContain("@JoinColumn", cu);
- }
-
- public void testGetNullable() throws Exception {
- ICompilationUnit cu = this.createTestJoinColumnWithBooleanElement("nullable");
- JavaResourcePersistentType typeResource = buildJavaTypeResource(cu);
- JavaResourcePersistentAttribute attributeResource = typeResource.fields().next();
- JoinColumnAnnotation column = (JoinColumnAnnotation) attributeResource.supportingAnnotations(JPA.JOIN_COLUMN, JPA.JOIN_COLUMNS).next();
-
- assertTrue(column.getNullable().booleanValue());
- }
-
- public void testSetNullable() throws Exception {
- ICompilationUnit cu = this.createTestJoinColumns();
- JavaResourcePersistentType typeResource = buildJavaTypeResource(cu);
- JavaResourcePersistentAttribute attributeResource = typeResource.fields().next();
- JoinColumnAnnotation column = (JoinColumnAnnotation) attributeResource.supportingAnnotations(JPA.JOIN_COLUMN, JPA.JOIN_COLUMNS).next();
-
- assertNotNull(column);
- assertNull(column.getNullable());
-
- column.setNullable(Boolean.FALSE);
- assertFalse(column.getNullable().booleanValue());
-
- assertSourceContains("@JoinColumns(@JoinColumn(nullable = false))", cu);
-
- column.setNullable(null);
- assertSourceDoesNotContain("@JoinColumn", cu);
- }
-
- public void testGetInsertable() throws Exception {
- ICompilationUnit cu = this.createTestJoinColumnWithBooleanElement("insertable");
- JavaResourcePersistentType typeResource = buildJavaTypeResource(cu);
- JavaResourcePersistentAttribute attributeResource = typeResource.fields().next();
- JoinColumnAnnotation column = (JoinColumnAnnotation) attributeResource.supportingAnnotations(JPA.JOIN_COLUMN, JPA.JOIN_COLUMNS).next();
-
- assertTrue(column.getInsertable().booleanValue());
- }
-
- public void testSetInsertable() throws Exception {
- ICompilationUnit cu = this.createTestJoinColumns();
- JavaResourcePersistentType typeResource = buildJavaTypeResource(cu);
- JavaResourcePersistentAttribute attributeResource = typeResource.fields().next();
- JoinColumnAnnotation column = (JoinColumnAnnotation) attributeResource.supportingAnnotations(JPA.JOIN_COLUMN, JPA.JOIN_COLUMNS).next();
-
- assertNotNull(column);
- assertNull(column.getInsertable());
-
- column.setInsertable(Boolean.FALSE);
- assertFalse(column.getInsertable().booleanValue());
-
- assertSourceContains("@JoinColumns(@JoinColumn(insertable = false))", cu);
-
- column.setInsertable(null);
- assertSourceDoesNotContain("@JoinColumn", cu);
- }
-
- public void testGetUpdatable() throws Exception {
- ICompilationUnit cu = this.createTestJoinColumnWithBooleanElement("updatable");
- JavaResourcePersistentType typeResource = buildJavaTypeResource(cu);
- JavaResourcePersistentAttribute attributeResource = typeResource.fields().next();
- JoinColumnAnnotation column = (JoinColumnAnnotation) attributeResource.supportingAnnotations(JPA.JOIN_COLUMN, JPA.JOIN_COLUMNS).next();
-
- assertTrue(column.getUpdatable().booleanValue());
- }
-
- public void testSetUpdatable() throws Exception {
- ICompilationUnit cu = this.createTestJoinColumns();
- JavaResourcePersistentType typeResource = buildJavaTypeResource(cu);
- JavaResourcePersistentAttribute attributeResource = typeResource.fields().next();
- JoinColumnAnnotation column = (JoinColumnAnnotation) attributeResource.supportingAnnotations(JPA.JOIN_COLUMN, JPA.JOIN_COLUMNS).next();
-
- assertNotNull(column);
- assertNull(column.getUpdatable());
-
- column.setUpdatable(Boolean.FALSE);
- assertFalse(column.getUpdatable().booleanValue());
-
- assertSourceContains("@JoinColumns(@JoinColumn(updatable = false))", cu);
-
- column.setUpdatable(null);
- assertSourceDoesNotContain("@JoinColumn", cu);
- assertSourceDoesNotContain("@JoinColumns", cu);
- }
-
-
- public void testAddJoinColumnCopyExisting() throws Exception {
- ICompilationUnit cu = createTestJoinColumn();
- JavaResourcePersistentType typeResource = buildJavaTypeResource(cu);
- JavaResourcePersistentAttribute attributeResource = typeResource.fields().next();
-
- JoinColumnAnnotation joinColumn = (JoinColumnAnnotation) attributeResource.addSupportingAnnotation(1, JPA.JOIN_COLUMN, JPA.JOIN_COLUMNS);
- joinColumn.setName("FOO");
- assertSourceContains("@JoinColumns({@JoinColumn(name = \"BAR\", columnDefinition = \"COLUMN_DEF\", table = \"TABLE\", unique = false, nullable = false, insertable = false, updatable = false, referencedColumnName = \"REF_NAME\"),@JoinColumn(name = \"FOO\")})", cu);
-
- assertNull(attributeResource.getSupportingAnnotation(JPA.JOIN_COLUMN));
- assertNotNull(attributeResource.getSupportingAnnotation(JPA.JOIN_COLUMNS));
- assertEquals(2, CollectionTools.size(attributeResource.supportingAnnotations(JPA.JOIN_COLUMN, JPA.JOIN_COLUMNS)));
- }
-
- public void testAddJoinColumnToBeginningOfList() throws Exception {
- ICompilationUnit cu = createTestJoinColumn();
- JavaResourcePersistentType typeResource = buildJavaTypeResource(cu);
- JavaResourcePersistentAttribute attributeResource = typeResource.fields().next();
-
- JoinColumnAnnotation joinColumn = (JoinColumnAnnotation) attributeResource.addSupportingAnnotation(1, JPA.JOIN_COLUMN, JPA.JOIN_COLUMNS);
- joinColumn.setName("FOO");
- assertSourceContains("@JoinColumns({@JoinColumn(name = \"BAR\", columnDefinition = \"COLUMN_DEF\", table = \"TABLE\", unique = false, nullable = false, insertable = false, updatable = false, referencedColumnName = \"REF_NAME\"),@JoinColumn(name = \"FOO\")})", cu);
-
- joinColumn = (JoinColumnAnnotation) attributeResource.addSupportingAnnotation(0, JPA.JOIN_COLUMN, JPA.JOIN_COLUMNS);
- joinColumn.setName("BAZ");
- assertSourceContains("@JoinColumns({@JoinColumn(name = \"BAZ\"),@JoinColumn(name = \"BAR\", columnDefinition = \"COLUMN_DEF\", table = \"TABLE\", unique = false, nullable = false, insertable = false, updatable = false, referencedColumnName = \"REF_NAME\"), @JoinColumn(name = \"FOO\")})", cu);
-
- Iterator<NestableAnnotation> joinColumns = attributeResource.supportingAnnotations(JPA.JOIN_COLUMN, JPA.JOIN_COLUMNS);
- assertEquals("BAZ", ((JoinColumnAnnotation) joinColumns.next()).getName());
- assertEquals("BAR", ((JoinColumnAnnotation) joinColumns.next()).getName());
- assertEquals("FOO", ((JoinColumnAnnotation) joinColumns.next()).getName());
-
- assertNull(attributeResource.getSupportingAnnotation(JPA.JOIN_COLUMN));
- assertNotNull(attributeResource.getSupportingAnnotation(JPA.JOIN_COLUMNS));
- assertEquals(3, CollectionTools.size(attributeResource.supportingAnnotations(JPA.JOIN_COLUMN, JPA.JOIN_COLUMNS)));
- }
-
-
- public void testRemoveJoinColumnCopyExisting() throws Exception {
- ICompilationUnit cu = createTestJoinColumn();
- JavaResourcePersistentType typeResource = buildJavaTypeResource(cu);
- JavaResourcePersistentAttribute attributeResource = typeResource.fields().next();
-
- JoinColumnAnnotation joinColumn = (JoinColumnAnnotation) attributeResource.addSupportingAnnotation(1, JPA.JOIN_COLUMN, JPA.JOIN_COLUMNS);
- joinColumn.setName("FOO");
- assertSourceContains("@JoinColumns({@JoinColumn(name = \"BAR\", columnDefinition = \"COLUMN_DEF\", table = \"TABLE\", unique = false, nullable = false, insertable = false, updatable = false, referencedColumnName = \"REF_NAME\"),@JoinColumn(name = \"FOO\")})", cu);
-
- attributeResource.removeSupportingAnnotation(1, JPA.JOIN_COLUMN, JPA.JOIN_COLUMNS);
- assertSourceContains("@JoinColumn(name = \"BAR\", columnDefinition = \"COLUMN_DEF\", table = \"TABLE\", unique = false, nullable = false, insertable = false, updatable = false, referencedColumnName = \"REF_NAME\")", cu);
- }
-
-}
diff --git a/jpa/tests/org.eclipse.jpt.core.tests/src/org/eclipse/jpt/core/tests/internal/resource/java/JoinTableTests.java b/jpa/tests/org.eclipse.jpt.core.tests/src/org/eclipse/jpt/core/tests/internal/resource/java/JoinTableTests.java
deleted file mode 100644
index ef488c5f90..0000000000
--- a/jpa/tests/org.eclipse.jpt.core.tests/src/org/eclipse/jpt/core/tests/internal/resource/java/JoinTableTests.java
+++ /dev/null
@@ -1,656 +0,0 @@
-/*******************************************************************************
- * Copyright (c) 2007, 2009 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.
- *
- * Contributors:
- * Oracle - initial API and implementation
- ******************************************************************************/
-package org.eclipse.jpt.core.tests.internal.resource.java;
-
-import java.util.Iterator;
-import org.eclipse.jdt.core.ICompilationUnit;
-import org.eclipse.jpt.core.resource.java.JPA;
-import org.eclipse.jpt.core.resource.java.JavaResourcePersistentAttribute;
-import org.eclipse.jpt.core.resource.java.JavaResourcePersistentType;
-import org.eclipse.jpt.core.resource.java.JoinColumnAnnotation;
-import org.eclipse.jpt.core.resource.java.JoinTableAnnotation;
-import org.eclipse.jpt.utility.internal.iterators.ArrayIterator;
-
-@SuppressWarnings("nls")
-public class JoinTableTests extends JavaResourceModelTestCase {
-
- private static final String TABLE_NAME = "MY_TABLE";
- private static final String SCHEMA_NAME = "MY_SCHEMA";
- private static final String CATALOG_NAME = "MY_CATALOG";
-
- public JoinTableTests(String name) {
- super(name);
- }
-
- private ICompilationUnit createTestJoinTable() throws Exception {
- return this.createTestType(new DefaultAnnotationWriter() {
- @Override
- public Iterator<String> imports() {
- return new ArrayIterator<String>(JPA.JOIN_TABLE);
- }
- @Override
- public void appendIdFieldAnnotationTo(StringBuilder sb) {
- sb.append("@JoinTable");
- }
- });
- }
-
- private ICompilationUnit createTestJoinTableWithName() throws Exception {
- return this.createTestType(new DefaultAnnotationWriter() {
- @Override
- public Iterator<String> imports() {
- return new ArrayIterator<String>(JPA.JOIN_TABLE);
- }
- @Override
- public void appendIdFieldAnnotationTo(StringBuilder sb) {
- sb.append("@JoinTable(name = \"" + TABLE_NAME + "\")");
- }
- });
- }
-
- private ICompilationUnit createTestJoinTableWithSchema() throws Exception {
- return this.createTestType(new DefaultAnnotationWriter() {
- @Override
- public Iterator<String> imports() {
- return new ArrayIterator<String>(JPA.JOIN_TABLE);
- }
-
- @Override
- public void appendIdFieldAnnotationTo(StringBuilder sb) {
- sb.append("@JoinTable(schema = \"" + SCHEMA_NAME + "\")");
- }
- });
- }
-
- private ICompilationUnit createTestJoinTableWithCatalog() throws Exception {
- return this.createTestType(new DefaultAnnotationWriter() {
- @Override
- public Iterator<String> imports() {
- return new ArrayIterator<String>(JPA.JOIN_TABLE);
- }
- @Override
- public void appendIdFieldAnnotationTo(StringBuilder sb) {
- sb.append("@JoinTable(catalog = \"" + CATALOG_NAME + "\")");
- }
- });
- }
-
- private ICompilationUnit createTestJoinTableWithUniqueConstraints() throws Exception {
- return this.createTestType(new DefaultAnnotationWriter() {
- @Override
- public Iterator<String> imports() {
- return new ArrayIterator<String>(JPA.JOIN_TABLE, JPA.UNIQUE_CONSTRAINT);
- }
- @Override
- public void appendIdFieldAnnotationTo(StringBuilder sb) {
- sb.append("@JoinTable(uniqueConstraints = {@UniqueConstraint(columnNames = {\"BAR\"}), @UniqueConstraint(columnNames = {\"FOO\"}), @UniqueConstraint(columnNames = {\"BAZ\"})})");
- }
- });
- }
-
- private ICompilationUnit createTestJoinTableWithJoinColumns() throws Exception {
- return this.createTestType(new DefaultAnnotationWriter() {
- @Override
- public Iterator<String> imports() {
- return new ArrayIterator<String>(JPA.JOIN_TABLE, JPA.JOIN_COLUMN);
- }
- @Override
- public void appendIdFieldAnnotationTo(StringBuilder sb) {
- sb.append("@JoinTable(joinColumns = {@JoinColumn(name = \"BAR\"), @JoinColumn})");
- }
- });
- }
-
- private ICompilationUnit createTestJoinTableWithInverseJoinColumns() throws Exception {
- return this.createTestType(new DefaultAnnotationWriter() {
- @Override
- public Iterator<String> imports() {
- return new ArrayIterator<String>(JPA.JOIN_TABLE, JPA.JOIN_COLUMN);
- }
- @Override
- public void appendIdFieldAnnotationTo(StringBuilder sb) {
- sb.append("@JoinTable(inverseJoinColumns = {@JoinColumn(name = \"BAR\"), @JoinColumn})");
- }
- });
- }
-
- public void testGetName() throws Exception {
- ICompilationUnit cu = this.createTestJoinTableWithName();
- JavaResourcePersistentType typeResource = buildJavaTypeResource(cu);
- JavaResourcePersistentAttribute attributeResource = typeResource.fields().next();
-
- JoinTableAnnotation table = (JoinTableAnnotation) attributeResource.getSupportingAnnotation(JPA.JOIN_TABLE);
- assertNotNull(table);
- assertEquals(TABLE_NAME, table.getName());
- }
-
- public void testGetNull() throws Exception {
- ICompilationUnit cu = this.createTestJoinTable();
- JavaResourcePersistentType typeResource = buildJavaTypeResource(cu);
- JavaResourcePersistentAttribute attributeResource = typeResource.fields().next();
-
- JoinTableAnnotation table = (JoinTableAnnotation) attributeResource.getSupportingAnnotation(JPA.JOIN_TABLE);
- assertNotNull(table);
- assertNull(table.getName());
- assertNull(table.getCatalog());
- assertNull(table.getSchema());
- }
-
- public void testSetName() throws Exception {
- ICompilationUnit cu = this.createTestJoinTable();
- JavaResourcePersistentType typeResource = buildJavaTypeResource(cu);
- JavaResourcePersistentAttribute attributeResource = typeResource.fields().next();
-
- JoinTableAnnotation table = (JoinTableAnnotation) attributeResource.getSupportingAnnotation(JPA.JOIN_TABLE);
- assertNotNull(table);
- assertNull(table.getName());
-
- table.setName("Foo");
- assertEquals("Foo", table.getName());
-
- assertSourceContains("@JoinTable(name = \"Foo\")", cu);
- }
-
- public void testSetNameNull() throws Exception {
- ICompilationUnit cu = this.createTestJoinTableWithName();
- JavaResourcePersistentType typeResource = buildJavaTypeResource(cu);
- JavaResourcePersistentAttribute attributeResource = typeResource.fields().next();
-
- JoinTableAnnotation table = (JoinTableAnnotation) attributeResource.getSupportingAnnotation(JPA.JOIN_TABLE);
- assertEquals(TABLE_NAME, table.getName());
-
- table.setName(null);
- assertNull(table.getName());
-
- assertSourceDoesNotContain("@JoinTable", cu);
- }
-
- public void testGetCatalog() throws Exception {
- ICompilationUnit cu = this.createTestJoinTableWithCatalog();
- JavaResourcePersistentType typeResource = buildJavaTypeResource(cu);
- JavaResourcePersistentAttribute attributeResource = typeResource.fields().next();
-
- JoinTableAnnotation table = (JoinTableAnnotation) attributeResource.getSupportingAnnotation(JPA.JOIN_TABLE);
- assertNotNull(table);
- assertEquals(CATALOG_NAME, table.getCatalog());
- }
-
- public void testSetCatalog() throws Exception {
- ICompilationUnit cu = this.createTestJoinTable();
- JavaResourcePersistentType typeResource = buildJavaTypeResource(cu);
- JavaResourcePersistentAttribute attributeResource = typeResource.fields().next();
-
- JoinTableAnnotation table = (JoinTableAnnotation) attributeResource.getSupportingAnnotation(JPA.JOIN_TABLE);
- assertNotNull(table);
- assertNull(table.getCatalog());
-
- table.setCatalog("Foo");
- assertEquals("Foo", table.getCatalog());
-
- assertSourceContains("@JoinTable(catalog = \"Foo\")", cu);
- }
-
- public void testSetCatalogNull() throws Exception {
- ICompilationUnit cu = this.createTestJoinTableWithCatalog();
- JavaResourcePersistentType typeResource = buildJavaTypeResource(cu);
- JavaResourcePersistentAttribute attributeResource = typeResource.fields().next();
-
- JoinTableAnnotation table = (JoinTableAnnotation) attributeResource.getSupportingAnnotation(JPA.JOIN_TABLE);
- assertEquals(CATALOG_NAME, table.getCatalog());
-
- table.setCatalog(null);
- assertNull(table.getCatalog());
-
- assertSourceDoesNotContain("@JoinTable", cu);
- }
-
- public void testGetSchema() throws Exception {
- ICompilationUnit cu = this.createTestJoinTableWithSchema();
- JavaResourcePersistentType typeResource = buildJavaTypeResource(cu);
- JavaResourcePersistentAttribute attributeResource = typeResource.fields().next();
-
- JoinTableAnnotation table = (JoinTableAnnotation) attributeResource.getSupportingAnnotation(JPA.JOIN_TABLE);
- assertNotNull(table);
- assertEquals(SCHEMA_NAME, table.getSchema());
- }
-
- public void testSetSchema() throws Exception {
- ICompilationUnit cu = this.createTestJoinTable();
- JavaResourcePersistentType typeResource = buildJavaTypeResource(cu);
- JavaResourcePersistentAttribute attributeResource = typeResource.fields().next();
-
- JoinTableAnnotation table = (JoinTableAnnotation) attributeResource.getSupportingAnnotation(JPA.JOIN_TABLE);
- assertNotNull(table);
- assertNull(table.getSchema());
-
- table.setSchema("Foo");
- assertEquals("Foo", table.getSchema());
-
- assertSourceContains("@JoinTable(schema = \"Foo\")", cu);
- }
-
- public void testSetSchemaNull() throws Exception {
- ICompilationUnit cu = this.createTestJoinTableWithSchema();
- JavaResourcePersistentType typeResource = buildJavaTypeResource(cu);
- JavaResourcePersistentAttribute attributeResource = typeResource.fields().next();
-
- JoinTableAnnotation table = (JoinTableAnnotation) attributeResource.getSupportingAnnotation(JPA.JOIN_TABLE);
- assertEquals(SCHEMA_NAME, table.getSchema());
-
- table.setSchema(null);
- assertNull(table.getSchema());
-
- assertSourceDoesNotContain("@JoinTable", cu);
- }
-
- public void testUniqueConstraints() throws Exception {
- ICompilationUnit cu = this.createTestJoinTable();
- JavaResourcePersistentType typeResource = buildJavaTypeResource(cu);
- JavaResourcePersistentAttribute attributeResource = typeResource.fields().next();
-
- JoinTableAnnotation table = (JoinTableAnnotation) attributeResource.getSupportingAnnotation(JPA.JOIN_TABLE);
-
- assertEquals(0, table.uniqueConstraintsSize());
- }
-
- public void testUniqueConstraints2() throws Exception {
- ICompilationUnit cu = this.createTestJoinTable();
- JavaResourcePersistentType typeResource = buildJavaTypeResource(cu);
- JavaResourcePersistentAttribute attributeResource = typeResource.fields().next();
-
- JoinTableAnnotation table = (JoinTableAnnotation) attributeResource.getSupportingAnnotation(JPA.JOIN_TABLE);
-
-
- table.addUniqueConstraint(0);
- table.addUniqueConstraint(1);
-
- assertEquals(2, table.uniqueConstraintsSize());
- }
-
- public void testUniqueConstraints3() throws Exception {
- ICompilationUnit cu = this.createTestJoinTableWithUniqueConstraints();
- JavaResourcePersistentType typeResource = buildJavaTypeResource(cu);
- JavaResourcePersistentAttribute attributeResource = typeResource.fields().next();
-
- JoinTableAnnotation table = (JoinTableAnnotation) attributeResource.getSupportingAnnotation(JPA.JOIN_TABLE);
-
- assertEquals(3, table.uniqueConstraintsSize());
- }
-
- public void testAddUniqueConstraint() throws Exception {
- ICompilationUnit cu = this.createTestJoinTable();
- JavaResourcePersistentType typeResource = buildJavaTypeResource(cu);
- JavaResourcePersistentAttribute attributeResource = typeResource.fields().next();
-
- JoinTableAnnotation table = (JoinTableAnnotation) attributeResource.getSupportingAnnotation(JPA.JOIN_TABLE);
-
- table.addUniqueConstraint(0).addColumnName("FOO");
- table.addUniqueConstraint(1);
- table.addUniqueConstraint(0).addColumnName("BAR");
-
- assertEquals("BAR", table.uniqueConstraintAt(0).columnNames().next());
- assertEquals("FOO", table.uniqueConstraintAt(1).columnNames().next());
- assertEquals(0, table.uniqueConstraintAt(2).columnNamesSize());
-
- assertSourceContains("@JoinTable(uniqueConstraints = {@UniqueConstraint(columnNames = \"BAR\"),@UniqueConstraint(columnNames = \"FOO\"), @UniqueConstraint})", cu);
- }
-
- public void testRemoveUniqueConstraint() throws Exception {
- ICompilationUnit cu = this.createTestJoinTableWithUniqueConstraints();
- JavaResourcePersistentType typeResource = buildJavaTypeResource(cu);
- JavaResourcePersistentAttribute attributeResource = typeResource.fields().next();
-
- JoinTableAnnotation table = (JoinTableAnnotation) attributeResource.getSupportingAnnotation(JPA.JOIN_TABLE);
- assertEquals("BAR", table.uniqueConstraintAt(0).columnNames().next());
- assertEquals("FOO", table.uniqueConstraintAt(1).columnNames().next());
- assertEquals("BAZ", table.uniqueConstraintAt(2).columnNames().next());
- assertEquals(3, table.uniqueConstraintsSize());
-
- table.removeUniqueConstraint(1);
- assertEquals("BAR", table.uniqueConstraintAt(0).columnNames().next());
- assertEquals("BAZ", table.uniqueConstraintAt(1).columnNames().next());
- assertEquals(2, table.uniqueConstraintsSize());
- assertSourceContains("@JoinTable(uniqueConstraints = {@UniqueConstraint(columnNames = {\"BAR\"}), @UniqueConstraint(columnNames = {\"BAZ\"})})", cu);
-
- table.removeUniqueConstraint(0);
- assertEquals("BAZ", table.uniqueConstraintAt(0).columnNames().next());
- assertEquals(1, table.uniqueConstraintsSize());
- assertSourceContains("@JoinTable(uniqueConstraints = @UniqueConstraint(columnNames = {\"BAZ\"}))", cu);
-
- table.removeUniqueConstraint(0);
- assertEquals(0, table.uniqueConstraintsSize());
- assertSourceDoesNotContain("@JoinTable", cu);
- }
-
- public void testMoveUniqueConstraint() throws Exception {
- ICompilationUnit cu = this.createTestJoinTableWithUniqueConstraints();
- JavaResourcePersistentType typeResource = buildJavaTypeResource(cu);
- JavaResourcePersistentAttribute attributeResource = typeResource.fields().next();
-
- JoinTableAnnotation table = (JoinTableAnnotation) attributeResource.getSupportingAnnotation(JPA.JOIN_TABLE);
- assertSourceContains("@JoinTable(uniqueConstraints = {@UniqueConstraint(columnNames = {\"BAR\"}), @UniqueConstraint(columnNames = {\"FOO\"}), @UniqueConstraint(columnNames = {\"BAZ\"})})", cu);
-
- table.moveUniqueConstraint(2, 0);
- assertSourceContains("@JoinTable(uniqueConstraints = {@UniqueConstraint(columnNames = {\"FOO\"}), @UniqueConstraint(columnNames = {\"BAZ\"}), @UniqueConstraint(columnNames = {\"BAR\"})})", cu);
- }
-
- public void testMoveUniqueConstraint2() throws Exception {
- ICompilationUnit cu = this.createTestJoinTableWithUniqueConstraints();
- JavaResourcePersistentType typeResource = buildJavaTypeResource(cu);
- JavaResourcePersistentAttribute attributeResource = typeResource.fields().next();
-
- JoinTableAnnotation table = (JoinTableAnnotation) attributeResource.getSupportingAnnotation(JPA.JOIN_TABLE);
- assertSourceContains("@JoinTable(uniqueConstraints = {@UniqueConstraint(columnNames = {\"BAR\"}), @UniqueConstraint(columnNames = {\"FOO\"}), @UniqueConstraint(columnNames = {\"BAZ\"})})", cu);
-
- table.moveUniqueConstraint(0, 2);
- assertSourceContains("@JoinTable(uniqueConstraints = {@UniqueConstraint(columnNames = {\"BAZ\"}), @UniqueConstraint(columnNames = {\"BAR\"}), @UniqueConstraint(columnNames = {\"FOO\"})})", cu);
- }
-
- public void testJoinColumns() throws Exception {
- ICompilationUnit cu = this.createTestJoinTable();
- JavaResourcePersistentType typeResource = buildJavaTypeResource(cu);
- JavaResourcePersistentAttribute attributeResource = typeResource.fields().next();
-
- JoinTableAnnotation table = (JoinTableAnnotation) attributeResource.getSupportingAnnotation(JPA.JOIN_TABLE);
-
- assertEquals(0, table.joinColumnsSize());
- }
-
- public void testJoinColumns2() throws Exception {
- ICompilationUnit cu = this.createTestJoinTable();
- JavaResourcePersistentType typeResource = buildJavaTypeResource(cu);
- JavaResourcePersistentAttribute attributeResource = typeResource.fields().next();
-
- JoinTableAnnotation table = (JoinTableAnnotation) attributeResource.getSupportingAnnotation(JPA.JOIN_TABLE);
-
-
- table.addJoinColumn(0);
- table.addJoinColumn(1);
-
- assertEquals(2, table.joinColumnsSize());
- }
-
- public void testJoinColumns3() throws Exception {
- ICompilationUnit cu = this.createTestJoinTableWithJoinColumns();
- JavaResourcePersistentType typeResource = buildJavaTypeResource(cu);
- JavaResourcePersistentAttribute attributeResource = typeResource.fields().next();
-
- JoinTableAnnotation table = (JoinTableAnnotation) attributeResource.getSupportingAnnotation(JPA.JOIN_TABLE);
-
- assertEquals(2, table.joinColumnsSize());
- }
-
- public void testAddJoinColumn() throws Exception {
- ICompilationUnit cu = this.createTestJoinTable();
- JavaResourcePersistentType typeResource = buildJavaTypeResource(cu);
- JavaResourcePersistentAttribute attributeResource = typeResource.fields().next();
-
- JoinTableAnnotation table = (JoinTableAnnotation) attributeResource.getSupportingAnnotation(JPA.JOIN_TABLE);
-
- table.addJoinColumn(0).setName("FOO");
- table.addJoinColumn(1);
- table.addJoinColumn(0).setName("BAR");
-
- assertEquals("BAR", table.joinColumnAt(0).getName());
- assertEquals("FOO", table.joinColumnAt(1).getName());
- assertNull(table.joinColumnAt(2).getName());
- assertSourceContains("@JoinTable(joinColumns = {@JoinColumn(name = \"BAR\"),@JoinColumn(name = \"FOO\"), @JoinColumn})", cu);
- }
-
- public void testRemoveJoinColumn() throws Exception {
- ICompilationUnit cu = this.createTestJoinTableWithJoinColumns();
- JavaResourcePersistentType typeResource = buildJavaTypeResource(cu);
- JavaResourcePersistentAttribute attributeResource = typeResource.fields().next();
-
- JoinTableAnnotation table = (JoinTableAnnotation) attributeResource.getSupportingAnnotation(JPA.JOIN_TABLE);
- table.addJoinColumn(0).setName("FOO");
-
- assertEquals("FOO", table.joinColumnAt(0).getName());
- assertEquals("BAR", table.joinColumnAt(1).getName());
- assertNull(table.joinColumnAt(2).getName());
- assertEquals(3, table.joinColumnsSize());
-
- table.removeJoinColumn(1);
- assertEquals("FOO", table.joinColumnAt(0).getName());
- assertNull(table.joinColumnAt(1).getName());
- assertEquals(2, table.joinColumnsSize());
- assertSourceContains("@JoinTable(joinColumns = {@JoinColumn(name = \"FOO\"), @JoinColumn})", cu);
-
- table.removeJoinColumn(0);
- assertNull(table.joinColumnAt(0).getName());
- assertEquals(1, table.joinColumnsSize());
- assertSourceContains("@JoinTable(joinColumns = @JoinColumn)", cu);
-
-
- table.removeJoinColumn(0);
- assertEquals(0, table.joinColumnsSize());
- assertSourceDoesNotContain("@JoinTable", cu);
- }
-
- public void testMoveJoinColumn() throws Exception {
- ICompilationUnit cu = this.createTestJoinTableWithJoinColumns();
- JavaResourcePersistentType typeResource = buildJavaTypeResource(cu);
- JavaResourcePersistentAttribute attributeResource = typeResource.fields().next();
-
- JoinTableAnnotation table = (JoinTableAnnotation) attributeResource.getSupportingAnnotation(JPA.JOIN_TABLE);
- JoinColumnAnnotation joinColumn = table.joinColumnAt(0);
- joinColumn.setReferencedColumnName("REF_NAME");
- joinColumn.setUnique(Boolean.FALSE);
- joinColumn.setNullable(Boolean.FALSE);
- joinColumn.setInsertable(Boolean.FALSE);
- joinColumn.setUpdatable(Boolean.FALSE);
- joinColumn.setColumnDefinition("COLUMN_DEF");
- joinColumn.setTable("TABLE");
- table.addJoinColumn(0).setName("FOO");
-
- assertSourceContains("@JoinTable(joinColumns = {@JoinColumn(name = \"FOO\"), @JoinColumn(name = \"BAR\", referencedColumnName = \"REF_NAME\", unique = false, nullable = false, insertable = false, updatable = false, columnDefinition = \"COLUMN_DEF\", table = \"TABLE\"), @JoinColumn})", cu);
-
- table.moveJoinColumn(2, 0);
- assertEquals("BAR", table.joinColumnAt(0).getName());
- assertNull(table.joinColumnAt(1).getName());
- assertEquals("FOO", table.joinColumnAt(2).getName());
- assertEquals(3, table.joinColumnsSize());
- assertSourceContains("@JoinTable(joinColumns = {@JoinColumn(name = \"BAR\", referencedColumnName = \"REF_NAME\", unique = false, nullable = false, insertable = false, updatable = false, columnDefinition = \"COLUMN_DEF\", table = \"TABLE\"), @JoinColumn, @JoinColumn(name = \"FOO\")})", cu);
- }
-
- public void testMoveJoinColumn2() throws Exception {
- ICompilationUnit cu = this.createTestJoinTableWithJoinColumns();
- JavaResourcePersistentType typeResource = buildJavaTypeResource(cu);
- JavaResourcePersistentAttribute attributeResource = typeResource.fields().next();
-
- JoinTableAnnotation table = (JoinTableAnnotation) attributeResource.getSupportingAnnotation(JPA.JOIN_TABLE);
-
- JoinColumnAnnotation joinColumn = table.joinColumnAt(0);
- joinColumn.setReferencedColumnName("REF_NAME");
- joinColumn.setUnique(Boolean.FALSE);
- joinColumn.setNullable(Boolean.FALSE);
- joinColumn.setInsertable(Boolean.FALSE);
- joinColumn.setUpdatable(Boolean.FALSE);
- joinColumn.setColumnDefinition("COLUMN_DEF");
- joinColumn.setTable("TABLE");
-
- table.addJoinColumn(0).setName("FOO");
-
- assertSourceContains("@JoinTable(joinColumns = {@JoinColumn(name = \"FOO\"), @JoinColumn(name = \"BAR\", referencedColumnName = \"REF_NAME\", unique = false, nullable = false, insertable = false, updatable = false, columnDefinition = \"COLUMN_DEF\", table = \"TABLE\"), @JoinColumn})", cu);
-
-
- table.moveJoinColumn(0, 2);
- assertNull(table.joinColumnAt(0).getName());
- assertEquals("FOO", table.joinColumnAt(1).getName());
- assertEquals("BAR", table.joinColumnAt(2).getName());
- assertEquals(3, table.joinColumnsSize());
- assertSourceContains("@JoinTable(joinColumns = {@JoinColumn, @JoinColumn(name = \"FOO\"), @JoinColumn(name = \"BAR\", referencedColumnName = \"REF_NAME\", unique = false, nullable = false, insertable = false, updatable = false, columnDefinition = \"COLUMN_DEF\", table = \"TABLE\")})", cu);
- }
-
- public void testSetJoinColumnName() throws Exception {
- ICompilationUnit cu = this.createTestJoinTableWithJoinColumns();
- JavaResourcePersistentType typeResource = buildJavaTypeResource(cu);
- JavaResourcePersistentAttribute attributeResource = typeResource.fields().next();
-
- JoinTableAnnotation table = (JoinTableAnnotation) attributeResource.getSupportingAnnotation(JPA.JOIN_TABLE);
-
- assertEquals(2, table.joinColumnsSize());
-
- JoinColumnAnnotation joinColumn = table.joinColumns().next();
-
- assertEquals("BAR", joinColumn.getName());
-
- joinColumn.setName("foo");
- assertEquals("foo", joinColumn.getName());
-
- assertSourceContains("@JoinTable(joinColumns = {@JoinColumn(name = \"foo\"), @JoinColumn})", cu);
- }
-
- public void testInverseJoinColumns() throws Exception {
- ICompilationUnit cu = this.createTestJoinTable();
- JavaResourcePersistentType typeResource = buildJavaTypeResource(cu);
- JavaResourcePersistentAttribute attributeResource = typeResource.fields().next();
-
- JoinTableAnnotation table = (JoinTableAnnotation) attributeResource.getSupportingAnnotation(JPA.JOIN_TABLE);
-
- assertEquals(0, table.inverseJoinColumnsSize());
- }
-
- public void testInverseJoinColumns2() throws Exception {
- ICompilationUnit cu = this.createTestJoinTable();
- JavaResourcePersistentType typeResource = buildJavaTypeResource(cu);
- JavaResourcePersistentAttribute attributeResource = typeResource.fields().next();
-
- JoinTableAnnotation table = (JoinTableAnnotation) attributeResource.getSupportingAnnotation(JPA.JOIN_TABLE);
-
-
- table.addInverseJoinColumn(0);
- table.addInverseJoinColumn(1);
-
- assertEquals(2, table.inverseJoinColumnsSize());
- }
-
- public void testInverseJoinColumns3() throws Exception {
- ICompilationUnit cu = this.createTestJoinTableWithInverseJoinColumns();
- JavaResourcePersistentType typeResource = buildJavaTypeResource(cu);
- JavaResourcePersistentAttribute attributeResource = typeResource.fields().next();
-
- JoinTableAnnotation table = (JoinTableAnnotation) attributeResource.getSupportingAnnotation(JPA.JOIN_TABLE);
-
- assertEquals(2, table.inverseJoinColumnsSize());
- }
-
- public void testAddInverseJoinColumn() throws Exception {
- ICompilationUnit cu = this.createTestJoinTable();
- JavaResourcePersistentType typeResource = buildJavaTypeResource(cu);
- JavaResourcePersistentAttribute attributeResource = typeResource.fields().next();
-
- JoinTableAnnotation table = (JoinTableAnnotation) attributeResource.getSupportingAnnotation(JPA.JOIN_TABLE);
-
- table.addInverseJoinColumn(0).setName("FOO");
- table.addInverseJoinColumn(1);
- table.addInverseJoinColumn(0).setName("BAR");
-
- assertEquals("BAR", table.inverseJoinColumnAt(0).getName());
- assertEquals("FOO", table.inverseJoinColumnAt(1).getName());
- assertNull(table.inverseJoinColumnAt(2).getName());
- assertSourceContains("@JoinTable(inverseJoinColumns = {@JoinColumn(name = \"BAR\"),@JoinColumn(name = \"FOO\"), @JoinColumn})", cu);
- }
-
- public void testRemoveInverseJoinColumn() throws Exception {
- ICompilationUnit cu = this.createTestJoinTableWithInverseJoinColumns();
- JavaResourcePersistentType typeResource = buildJavaTypeResource(cu);
- JavaResourcePersistentAttribute attributeResource = typeResource.fields().next();
-
- JoinTableAnnotation table = (JoinTableAnnotation) attributeResource.getSupportingAnnotation(JPA.JOIN_TABLE);
- table.addInverseJoinColumn(2).setName("FOO");
-
- Iterator<JoinColumnAnnotation> inverseJoinColumns = table.inverseJoinColumns();
- assertEquals("BAR", inverseJoinColumns.next().getName());
- assertNull(inverseJoinColumns.next().getName());
- assertEquals("FOO", inverseJoinColumns.next().getName());
- assertFalse(inverseJoinColumns.hasNext());
-
- table.removeInverseJoinColumn(1);
- assertSourceContains("@JoinTable(inverseJoinColumns = {@JoinColumn(name = \"BAR\"), @JoinColumn(name = \"FOO\")})", cu);
- inverseJoinColumns = table.inverseJoinColumns();
- assertEquals("BAR", inverseJoinColumns.next().getName());
- assertEquals("FOO", inverseJoinColumns.next().getName());
- assertFalse(inverseJoinColumns.hasNext());
-
- table.removeInverseJoinColumn(0);
- assertSourceContains("@JoinTable(inverseJoinColumns = @JoinColumn(name = \"FOO\"))", cu);
- inverseJoinColumns = table.inverseJoinColumns();
- assertEquals("FOO", inverseJoinColumns.next().getName());
- assertFalse(inverseJoinColumns.hasNext());
-
- table.removeInverseJoinColumn(0);
- assertSourceDoesNotContain("@JoinTable", cu);
- }
-
- public void testMoveInverseJoinColumn() throws Exception {
- ICompilationUnit cu = this.createTestJoinTableWithInverseJoinColumns();
- JavaResourcePersistentType typeResource = buildJavaTypeResource(cu);
- JavaResourcePersistentAttribute attributeResource = typeResource.fields().next();
-
- JoinTableAnnotation table = (JoinTableAnnotation) attributeResource.getSupportingAnnotation(JPA.JOIN_TABLE);
- table.addInverseJoinColumn(0).setName("FOO");
-
- Iterator<JoinColumnAnnotation> inverseJoinColumns = table.inverseJoinColumns();
- assertEquals("FOO", inverseJoinColumns.next().getName());
- assertEquals("BAR", inverseJoinColumns.next().getName());
- assertNull(inverseJoinColumns.next().getName());
-
- table.moveInverseJoinColumn(2, 0);
- inverseJoinColumns = table.inverseJoinColumns();
- assertEquals("BAR", inverseJoinColumns.next().getName());
- assertNull(inverseJoinColumns.next().getName());
- assertEquals("FOO", inverseJoinColumns.next().getName());
-
- assertSourceContains("@JoinTable(inverseJoinColumns = {@JoinColumn(name = \"BAR\"), @JoinColumn, @JoinColumn(name = \"FOO\")})", cu);
- }
-
- public void testMoveInverseJoinColumn2() throws Exception {
- ICompilationUnit cu = this.createTestJoinTableWithInverseJoinColumns();
- JavaResourcePersistentType typeResource = buildJavaTypeResource(cu);
- JavaResourcePersistentAttribute attributeResource = typeResource.fields().next();
-
- JoinTableAnnotation table = (JoinTableAnnotation) attributeResource.getSupportingAnnotation(JPA.JOIN_TABLE);
- table.addInverseJoinColumn(1).setName("FOO");
-
- Iterator<JoinColumnAnnotation> inverseJoinColumns = table.inverseJoinColumns();
- assertEquals("BAR", inverseJoinColumns.next().getName());
- assertEquals("FOO", inverseJoinColumns.next().getName());
- assertNull(inverseJoinColumns.next().getName());
-
- table.moveInverseJoinColumn(0, 2);
- inverseJoinColumns = table.inverseJoinColumns();
- assertNull(inverseJoinColumns.next().getName());
- assertEquals("BAR", inverseJoinColumns.next().getName());
- assertEquals("FOO", inverseJoinColumns.next().getName());
-
- assertSourceContains("@JoinTable(inverseJoinColumns = {@JoinColumn, @JoinColumn(name = \"BAR\"), @JoinColumn(name = \"FOO\")})", cu);
- }
-
- public void testSetInverseJoinColumnName() throws Exception {
- ICompilationUnit cu = this.createTestJoinTableWithInverseJoinColumns();
- JavaResourcePersistentType typeResource = buildJavaTypeResource(cu);
- JavaResourcePersistentAttribute attributeResource = typeResource.fields().next();
-
- JoinTableAnnotation table = (JoinTableAnnotation) attributeResource.getSupportingAnnotation(JPA.JOIN_TABLE);
-
- assertEquals(2, table.inverseJoinColumnsSize());
-
- JoinColumnAnnotation joinColumn = table.inverseJoinColumns().next();
-
- assertEquals("BAR", joinColumn.getName());
-
- joinColumn.setName("foo");
- assertEquals("foo", joinColumn.getName());
-
- assertSourceContains("@JoinTable(inverseJoinColumns = {@JoinColumn(name = \"foo\"), @JoinColumn})", cu);
- }
-
-}
diff --git a/jpa/tests/org.eclipse.jpt.core.tests/src/org/eclipse/jpt/core/tests/internal/resource/java/JptJavaResourceTests.java b/jpa/tests/org.eclipse.jpt.core.tests/src/org/eclipse/jpt/core/tests/internal/resource/java/JptJavaResourceTests.java
deleted file mode 100644
index 065c4ac7ff..0000000000
--- a/jpa/tests/org.eclipse.jpt.core.tests/src/org/eclipse/jpt/core/tests/internal/resource/java/JptJavaResourceTests.java
+++ /dev/null
@@ -1,75 +0,0 @@
-/*******************************************************************************
- * Copyright (c) 2007, 2009 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.
- *
- * Contributors:
- * Oracle - initial API and implementation
- ******************************************************************************/
-package org.eclipse.jpt.core.tests.internal.resource.java;
-
-import junit.framework.Test;
-import junit.framework.TestSuite;
-
-public class JptJavaResourceTests {
-
- public static Test suite() {
- TestSuite suite = new TestSuite(JptJavaResourceTests.class.getName());
- suite.addTestSuite(JavaResourcePersistentTypeTests.class);
- suite.addTestSuite(JavaResourcePersistentAttributeTests.class);
- suite.addTestSuite(JPTToolsTests.class);
-
- suite.addTestSuite(AssociationOverrideTests.class);
- suite.addTestSuite(AssociationOverridesTests.class);
- suite.addTestSuite(AttributeOverrideTests.class);
- suite.addTestSuite(AttributeOverridesTests.class);
- suite.addTestSuite(BasicTests.class);
- suite.addTestSuite(ColumnTests.class);
- suite.addTestSuite(DiscriminatorValueTests.class);
- suite.addTestSuite(DiscriminatorColumnTests.class);
- suite.addTestSuite(EmbeddableTests.class);
- suite.addTestSuite(EmbeddedTests.class);
- suite.addTestSuite(EmbeddedIdTests.class);
- suite.addTestSuite(EntityTests.class);
- suite.addTestSuite(EnumeratedTests.class);
- suite.addTestSuite(GeneratedValueTests.class);
- suite.addTestSuite(IdClassTests.class);
- suite.addTestSuite(IdTests.class);
- suite.addTestSuite(InheritanceTests.class);
- suite.addTestSuite(JoinColumnTests.class);
- suite.addTestSuite(JoinColumnsTests.class);
- suite.addTestSuite(JoinTableTests.class);
- suite.addTestSuite(LobTests.class);
- suite.addTestSuite(ManyToManyTests.class);
- suite.addTestSuite(ManyToOneTests.class);
- suite.addTestSuite(MapKeyTests.class);
- suite.addTestSuite(MappedSuperclassTests.class);
- suite.addTestSuite(NamedNativeQueryTests.class);
- suite.addTestSuite(NamedNativeQueriesTests.class);
- suite.addTestSuite(NamedQueryTests.class);
- suite.addTestSuite(NamedQueriesTests.class);
- suite.addTestSuite(OneToManyTests.class);
- suite.addTestSuite(OneToOneTests.class);
- suite.addTestSuite(OrderByTests.class);
- suite.addTestSuite(PrimaryKeyJoinColumnTests.class);
- suite.addTestSuite(PrimaryKeyJoinColumnsTests.class);
- suite.addTestSuite(QueryHintTests.class);
- suite.addTestSuite(SecondaryTableTests.class);
- suite.addTestSuite(SecondaryTablesTests.class);
- suite.addTestSuite(SequenceGeneratorTests.class);
- suite.addTestSuite(TableGeneratorTests.class);
- suite.addTestSuite(TableTests.class);
- suite.addTestSuite(TemporalTests.class);
- suite.addTestSuite(TransientTests.class);
- suite.addTestSuite(VersionTests.class);
-
- return suite;
- }
-
- private JptJavaResourceTests() {
- super();
- throw new UnsupportedOperationException();
- }
-
-}
diff --git a/jpa/tests/org.eclipse.jpt.core.tests/src/org/eclipse/jpt/core/tests/internal/resource/java/LobTests.java b/jpa/tests/org.eclipse.jpt.core.tests/src/org/eclipse/jpt/core/tests/internal/resource/java/LobTests.java
deleted file mode 100644
index 908fd5a763..0000000000
--- a/jpa/tests/org.eclipse.jpt.core.tests/src/org/eclipse/jpt/core/tests/internal/resource/java/LobTests.java
+++ /dev/null
@@ -1,49 +0,0 @@
-/*******************************************************************************
- * Copyright (c) 2007, 2009 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.
- *
- * Contributors:
- * Oracle - initial API and implementation
- ******************************************************************************/
-package org.eclipse.jpt.core.tests.internal.resource.java;
-
-import java.util.Iterator;
-import org.eclipse.jdt.core.ICompilationUnit;
-import org.eclipse.jpt.core.resource.java.JPA;
-import org.eclipse.jpt.core.resource.java.JavaResourcePersistentAttribute;
-import org.eclipse.jpt.core.resource.java.JavaResourcePersistentType;
-import org.eclipse.jpt.core.resource.java.LobAnnotation;
-import org.eclipse.jpt.utility.internal.iterators.ArrayIterator;
-
-@SuppressWarnings("nls")
-public class LobTests extends JavaResourceModelTestCase {
-
- public LobTests(String name) {
- super(name);
- }
-
- private ICompilationUnit createTestLob() throws Exception {
- return this.createTestType(new DefaultAnnotationWriter() {
- @Override
- public Iterator<String> imports() {
- return new ArrayIterator<String>(JPA.LOB);
- }
- @Override
- public void appendIdFieldAnnotationTo(StringBuilder sb) {
- sb.append("@Lob");
- }
- });
- }
-
- public void testLob() throws Exception {
- ICompilationUnit cu = this.createTestLob();
- JavaResourcePersistentType typeResource = buildJavaTypeResource(cu);
- JavaResourcePersistentAttribute attributeResource = typeResource.fields().next();
-
- LobAnnotation lob = (LobAnnotation) attributeResource.getSupportingAnnotation(JPA.LOB);
- assertNotNull(lob);
- }
-
-}
diff --git a/jpa/tests/org.eclipse.jpt.core.tests/src/org/eclipse/jpt/core/tests/internal/resource/java/ManyToManyTests.java b/jpa/tests/org.eclipse.jpt.core.tests/src/org/eclipse/jpt/core/tests/internal/resource/java/ManyToManyTests.java
deleted file mode 100644
index 91e8b65994..0000000000
--- a/jpa/tests/org.eclipse.jpt.core.tests/src/org/eclipse/jpt/core/tests/internal/resource/java/ManyToManyTests.java
+++ /dev/null
@@ -1,394 +0,0 @@
-/*******************************************************************************
- * Copyright (c) 2007, 2009 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.
- *
- * Contributors:
- * Oracle - initial API and implementation
- ******************************************************************************/
-package org.eclipse.jpt.core.tests.internal.resource.java;
-
-import java.util.Iterator;
-import org.eclipse.jdt.core.ICompilationUnit;
-import org.eclipse.jpt.core.resource.java.FetchType;
-import org.eclipse.jpt.core.resource.java.JPA;
-import org.eclipse.jpt.core.resource.java.JavaResourcePersistentAttribute;
-import org.eclipse.jpt.core.resource.java.JavaResourcePersistentType;
-import org.eclipse.jpt.core.resource.java.ManyToManyAnnotation;
-import org.eclipse.jpt.utility.internal.iterators.ArrayIterator;
-
-@SuppressWarnings("nls")
-public class ManyToManyTests extends JavaResourceModelTestCase {
-
- public ManyToManyTests(String name) {
- super(name);
- }
-
- private ICompilationUnit createTestManyToMany() throws Exception {
- return this.createTestType(new DefaultAnnotationWriter() {
- @Override
- public Iterator<String> imports() {
- return new ArrayIterator<String>(JPA.MANY_TO_MANY);
- }
- @Override
- public void appendIdFieldAnnotationTo(StringBuilder sb) {
- sb.append("@ManyToMany");
- }
- });
- }
-
- private ICompilationUnit createTestManyToManyWithFetch() throws Exception {
- return this.createTestType(new DefaultAnnotationWriter() {
- @Override
- public Iterator<String> imports() {
- return new ArrayIterator<String>(JPA.MANY_TO_MANY, JPA.FETCH_TYPE);
- }
- @Override
- public void appendIdFieldAnnotationTo(StringBuilder sb) {
- sb.append("@ManyToMany(fetch = FetchType.EAGER)");
- }
- });
- }
-
- private ICompilationUnit createTestManyToManyWithTargetEntity() throws Exception {
- return this.createTestType(new DefaultAnnotationWriter() {
- @Override
- public Iterator<String> imports() {
- return new ArrayIterator<String>(JPA.MANY_TO_MANY);
- }
- @Override
- public void appendIdFieldAnnotationTo(StringBuilder sb) {
- sb.append("@ManyToMany(targetEntity = AnnotationTestType.class)");
- }
- });
- }
-
- private ICompilationUnit createTestManyToManyWithMappedBy() throws Exception {
- return this.createTestType(new DefaultAnnotationWriter() {
- @Override
- public Iterator<String> imports() {
- return new ArrayIterator<String>(JPA.MANY_TO_MANY);
- }
- @Override
- public void appendIdFieldAnnotationTo(StringBuilder sb) {
- sb.append("@ManyToMany(mappedBy = \"foo\")");
- }
- });
- }
-
- private ICompilationUnit createTestManyToManyWithCascade() throws Exception {
- return this.createTestType(new DefaultAnnotationWriter() {
- @Override
- public Iterator<String> imports() {
- return new ArrayIterator<String>(JPA.MANY_TO_MANY, JPA.CASCADE_TYPE);
- }
- @Override
- public void appendIdFieldAnnotationTo(StringBuilder sb) {
- sb.append("@ManyToMany(cascade = CascadeType.ALL)");
- }
- });
- }
-
- private ICompilationUnit createTestManyToManyWithMultipleCascade() throws Exception {
- return this.createTestType(new DefaultAnnotationWriter() {
- @Override
- public Iterator<String> imports() {
- return new ArrayIterator<String>(JPA.MANY_TO_MANY, JPA.CASCADE_TYPE);
- }
- @Override
- public void appendIdFieldAnnotationTo(StringBuilder sb) {
- sb.append("@ManyToMany(cascade = {CascadeType.MERGE, CascadeType.REMOVE})");
- }
- });
- }
-
- private ICompilationUnit createTestManyToManyWithDuplicateCascade() throws Exception {
- return this.createTestType(new DefaultAnnotationWriter() {
- @Override
- public Iterator<String> imports() {
- return new ArrayIterator<String>(JPA.MANY_TO_MANY, JPA.CASCADE_TYPE);
- }
- @Override
- public void appendIdFieldAnnotationTo(StringBuilder sb) {
- sb.append("@ManyToMany(cascade = {CascadeType.MERGE, CascadeType.MERGE})");
- }
- });
- }
-
- public void testManyToMany() throws Exception {
- ICompilationUnit cu = this.createTestManyToMany();
- JavaResourcePersistentType typeResource = buildJavaTypeResource(cu);
- JavaResourcePersistentAttribute attributeResource = typeResource.fields().next();
-
- ManyToManyAnnotation manyToMany = (ManyToManyAnnotation) attributeResource.getMappingAnnotation(JPA.MANY_TO_MANY);
- assertNotNull(manyToMany);
- }
-
- public void testGetFetch() throws Exception {
- ICompilationUnit cu = this.createTestManyToManyWithFetch();
- JavaResourcePersistentType typeResource = buildJavaTypeResource(cu);
- JavaResourcePersistentAttribute attributeResource = typeResource.fields().next();
-
- ManyToManyAnnotation manyToMany = (ManyToManyAnnotation) attributeResource.getMappingAnnotation(JPA.MANY_TO_MANY);
- assertEquals(FetchType.EAGER, manyToMany.getFetch());
- }
-
- public void testSetFetch() throws Exception {
- ICompilationUnit cu = this.createTestManyToManyWithFetch();
- JavaResourcePersistentType typeResource = buildJavaTypeResource(cu);
- JavaResourcePersistentAttribute attributeResource = typeResource.fields().next();
-
- ManyToManyAnnotation manyToMany = (ManyToManyAnnotation) attributeResource.getMappingAnnotation(JPA.MANY_TO_MANY);
- assertEquals(FetchType.EAGER, manyToMany.getFetch());
-
- manyToMany.setFetch(FetchType.LAZY);
- assertEquals(FetchType.LAZY, manyToMany.getFetch());
-
- assertSourceContains("@ManyToMany(fetch = LAZY)", cu);
- }
-
- public void testSetFetchNull() throws Exception {
- ICompilationUnit cu = this.createTestManyToManyWithFetch();
- JavaResourcePersistentType typeResource = buildJavaTypeResource(cu);
- JavaResourcePersistentAttribute attributeResource = typeResource.fields().next();
-
- ManyToManyAnnotation manyToMany = (ManyToManyAnnotation) attributeResource.getMappingAnnotation(JPA.MANY_TO_MANY);
- assertEquals(FetchType.EAGER, manyToMany.getFetch());
-
- manyToMany.setFetch(null);
- assertNull(manyToMany.getFetch());
-
- assertSourceContains("@ManyToMany", cu);
- assertSourceDoesNotContain("fetch", cu);
- }
-
- public void testGetTargetEntity() throws Exception {
- ICompilationUnit cu = this.createTestManyToManyWithTargetEntity();
- JavaResourcePersistentType typeResource = buildJavaTypeResource(cu);
- JavaResourcePersistentAttribute attributeResource = typeResource.fields().next();
-
- ManyToManyAnnotation manyToMany = (ManyToManyAnnotation) attributeResource.getMappingAnnotation(JPA.MANY_TO_MANY);
- assertEquals(TYPE_NAME, manyToMany.getTargetEntity());
- }
-
- public void testSetTargetEntity() throws Exception {
- ICompilationUnit cu = this.createTestManyToManyWithTargetEntity();
- JavaResourcePersistentType typeResource = buildJavaTypeResource(cu);
- JavaResourcePersistentAttribute attributeResource = typeResource.fields().next();
-
- ManyToManyAnnotation manyToMany = (ManyToManyAnnotation) attributeResource.getMappingAnnotation(JPA.MANY_TO_MANY);
- assertEquals(TYPE_NAME, manyToMany.getTargetEntity());
-
- manyToMany.setTargetEntity("Foo");
-
- assertSourceContains("@ManyToMany(targetEntity = Foo.class)", cu);
- }
-
- public void testSetTargetEntityNull() throws Exception {
- ICompilationUnit cu = this.createTestManyToManyWithTargetEntity();
- JavaResourcePersistentType typeResource = buildJavaTypeResource(cu);
- JavaResourcePersistentAttribute attributeResource = typeResource.fields().next();
-
- ManyToManyAnnotation manyToMany = (ManyToManyAnnotation) attributeResource.getMappingAnnotation(JPA.MANY_TO_MANY);
- assertEquals(TYPE_NAME, manyToMany.getTargetEntity());
-
- manyToMany.setTargetEntity(null);
-
- assertSourceContains("@ManyToMany", cu);
- assertSourceDoesNotContain("targetEntity", cu);
- }
-
-
- public void testGetFullyQualifiedTargetEntity() throws Exception {
- ICompilationUnit cu = this.createTestManyToManyWithTargetEntity();
- JavaResourcePersistentType typeResource = buildJavaTypeResource(cu);
- JavaResourcePersistentAttribute attributeResource = typeResource.fields().next();
-
- ManyToManyAnnotation manyToMany = (ManyToManyAnnotation) attributeResource.getMappingAnnotation(JPA.MANY_TO_MANY);
- assertEquals(FULLY_QUALIFIED_TYPE_NAME, manyToMany.getFullyQualifiedTargetEntityClassName());
-
- manyToMany.setTargetEntity("Foo");
-
- assertSourceContains("@ManyToMany(targetEntity = Foo.class)", cu);
-
- assertEquals("Foo", manyToMany.getTargetEntity());
-
- assertEquals("Foo", manyToMany.getFullyQualifiedTargetEntityClassName()); //bug 196200 changed this
- }
-
- public void testGetMappedBy() throws Exception {
- ICompilationUnit cu = this.createTestManyToManyWithMappedBy();
- JavaResourcePersistentType typeResource = buildJavaTypeResource(cu);
- JavaResourcePersistentAttribute attributeResource = typeResource.fields().next();
-
- ManyToManyAnnotation manyToMany = (ManyToManyAnnotation) attributeResource.getMappingAnnotation(JPA.MANY_TO_MANY);
- assertEquals("foo", manyToMany.getMappedBy());
- }
-
- public void testGetMappedByNull() throws Exception {
- ICompilationUnit cu = this.createTestManyToMany();
- JavaResourcePersistentType typeResource = buildJavaTypeResource(cu);
- JavaResourcePersistentAttribute attributeResource = typeResource.fields().next();
-
- ManyToManyAnnotation manyToMany = (ManyToManyAnnotation) attributeResource.getMappingAnnotation(JPA.MANY_TO_MANY);
- assertEquals(null, manyToMany.getMappedBy());
- }
-
- public void testSetMappedBy() throws Exception {
- ICompilationUnit cu = this.createTestManyToMany();
- JavaResourcePersistentType typeResource = buildJavaTypeResource(cu);
- JavaResourcePersistentAttribute attributeResource = typeResource.fields().next();
-
- ManyToManyAnnotation manyToMany = (ManyToManyAnnotation) attributeResource.getMappingAnnotation(JPA.MANY_TO_MANY);
- assertNull(manyToMany.getMappedBy());
- manyToMany.setMappedBy("bar");
- assertEquals("bar", manyToMany.getMappedBy());
-
- assertSourceContains("@ManyToMany(mappedBy = \"bar\")", cu);
- }
-
- public void testSetMappedByNull() throws Exception {
- ICompilationUnit cu = this.createTestManyToManyWithMappedBy();
- JavaResourcePersistentType typeResource = buildJavaTypeResource(cu);
- JavaResourcePersistentAttribute attributeResource = typeResource.fields().next();
-
- ManyToManyAnnotation manyToMany = (ManyToManyAnnotation) attributeResource.getMappingAnnotation(JPA.MANY_TO_MANY);
- assertEquals("foo", manyToMany.getMappedBy());
-
- manyToMany.setMappedBy(null);
- assertNull(manyToMany.getMappedBy());
-
- assertSourceContains("@ManyToMany", cu);
- assertSourceDoesNotContain("mappedBy", cu);
- }
-
- public void testSetCascadeAll() throws Exception {
- ICompilationUnit cu = this.createTestManyToMany();
- JavaResourcePersistentType typeResource = buildJavaTypeResource(cu);
- JavaResourcePersistentAttribute attributeResource = typeResource.fields().next();
-
- ManyToManyAnnotation manyToMany = (ManyToManyAnnotation) attributeResource.getMappingAnnotation(JPA.MANY_TO_MANY);
- assertFalse(manyToMany.isCascadeAll());
-
- manyToMany.setCascadeAll(true);
- assertSourceContains("@ManyToMany(cascade = ALL)", cu);
-
- assertTrue(manyToMany.isCascadeAll());
- }
-
- public void testSetCascadeMerge() throws Exception {
- ICompilationUnit cu = this.createTestManyToMany();
- JavaResourcePersistentType typeResource = buildJavaTypeResource(cu);
- JavaResourcePersistentAttribute attributeResource = typeResource.fields().next();
-
- ManyToManyAnnotation manyToMany = (ManyToManyAnnotation) attributeResource.getMappingAnnotation(JPA.MANY_TO_MANY);
- assertFalse(manyToMany.isCascadeMerge());
-
- manyToMany.setCascadeMerge(true);
- assertSourceContains("@ManyToMany(cascade = MERGE)", cu);
-
- assertTrue(manyToMany.isCascadeMerge());
- }
-
- public void testSetCascadePersist() throws Exception {
- ICompilationUnit cu = this.createTestManyToMany();
- JavaResourcePersistentType typeResource = buildJavaTypeResource(cu);
- JavaResourcePersistentAttribute attributeResource = typeResource.fields().next();
-
- ManyToManyAnnotation manyToMany = (ManyToManyAnnotation) attributeResource.getMappingAnnotation(JPA.MANY_TO_MANY);
- assertFalse(manyToMany.isCascadePersist());
-
- manyToMany.setCascadePersist(true);
- assertSourceContains("@ManyToMany(cascade = PERSIST)", cu);
-
- assertTrue(manyToMany.isCascadePersist());
- }
-
- public void testSetCascadeRemove() throws Exception {
- ICompilationUnit cu = this.createTestManyToMany();
- JavaResourcePersistentType typeResource = buildJavaTypeResource(cu);
- JavaResourcePersistentAttribute attributeResource = typeResource.fields().next();
-
- ManyToManyAnnotation manyToMany = (ManyToManyAnnotation) attributeResource.getMappingAnnotation(JPA.MANY_TO_MANY);
- assertFalse(manyToMany.isCascadeRemove());
-
- manyToMany.setCascadeRemove(true);
- assertSourceContains("@ManyToMany(cascade = REMOVE)", cu);
-
- assertTrue(manyToMany.isCascadeRemove());
- }
-
- public void testSetCascadeRefresh() throws Exception {
- ICompilationUnit cu = this.createTestManyToMany();
- JavaResourcePersistentType typeResource = buildJavaTypeResource(cu);
- JavaResourcePersistentAttribute attributeResource = typeResource.fields().next();
-
- ManyToManyAnnotation manyToMany = (ManyToManyAnnotation) attributeResource.getMappingAnnotation(JPA.MANY_TO_MANY);
- assertFalse(manyToMany.isCascadeRefresh());
-
- manyToMany.setCascadeRefresh(true);
- assertSourceContains("@ManyToMany(cascade = REFRESH)", cu);
-
- assertTrue(manyToMany.isCascadeRefresh());
- }
-
- public void testCascadeMoreThanOnce() throws Exception {
- ICompilationUnit cu = this.createTestManyToManyWithCascade();
- JavaResourcePersistentType typeResource = buildJavaTypeResource(cu);
- JavaResourcePersistentAttribute attributeResource = typeResource.fields().next();
-
- ManyToManyAnnotation manyToMany = (ManyToManyAnnotation) attributeResource.getMappingAnnotation(JPA.MANY_TO_MANY);
- assertTrue(manyToMany.isCascadeAll());
-
- manyToMany.setCascadeAll(true);
- assertTrue(manyToMany.isCascadeAll());
- //a second CascadeType.All should not have been added
- assertSourceContains("@ManyToMany(cascade = CascadeType.ALL)", cu);
-
- manyToMany.setCascadeAll(false);
- assertFalse(manyToMany.isCascadeAll());
-
- assertSourceDoesNotContain("cascade", cu);
-
- //test setting cascadeAll to false again, should just do nothing
- manyToMany.setCascadeAll(false);
- assertFalse(manyToMany.isCascadeAll());
-
- assertSourceDoesNotContain("cascade", cu);
- }
-
- public void testDuplicateCascade() throws Exception {
- ICompilationUnit cu = this.createTestManyToManyWithDuplicateCascade();
- JavaResourcePersistentType typeResource = buildJavaTypeResource(cu);
- JavaResourcePersistentAttribute attributeResource = typeResource.fields().next();
-
- ManyToManyAnnotation manyToMany = (ManyToManyAnnotation) attributeResource.getMappingAnnotation(JPA.MANY_TO_MANY);
- assertTrue(manyToMany.isCascadeMerge());
-
- manyToMany.setCascadeMerge(false); //TODO should the resource model handle this and remove both MERGE
- //settings instead of having to set it false twice?
- assertTrue(manyToMany.isCascadeMerge());
-
- manyToMany.setCascadeMerge(false);
- assertFalse(manyToMany.isCascadeMerge());
-
- assertSourceDoesNotContain("cascade", cu);
- }
-
- public void testMultipleCascade() throws Exception {
- ICompilationUnit cu = this.createTestManyToManyWithMultipleCascade();
- JavaResourcePersistentType typeResource = buildJavaTypeResource(cu);
- JavaResourcePersistentAttribute attributeResource = typeResource.fields().next();
-
- ManyToManyAnnotation manyToMany = (ManyToManyAnnotation) attributeResource.getMappingAnnotation(JPA.MANY_TO_MANY);
- assertTrue(manyToMany.isCascadeMerge());
- assertTrue(manyToMany.isCascadeRemove());
-
- manyToMany.setCascadeMerge(false);
- assertSourceContains("@ManyToMany(cascade = REMOVE)", cu);
-
- manyToMany.setCascadeRemove(false);
- assertSourceDoesNotContain("cascade", cu);
- }
-}
diff --git a/jpa/tests/org.eclipse.jpt.core.tests/src/org/eclipse/jpt/core/tests/internal/resource/java/ManyToOneTests.java b/jpa/tests/org.eclipse.jpt.core.tests/src/org/eclipse/jpt/core/tests/internal/resource/java/ManyToOneTests.java
deleted file mode 100644
index d11ab1494c..0000000000
--- a/jpa/tests/org.eclipse.jpt.core.tests/src/org/eclipse/jpt/core/tests/internal/resource/java/ManyToOneTests.java
+++ /dev/null
@@ -1,387 +0,0 @@
-/*******************************************************************************
- * Copyright (c) 2007, 2009 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.
- *
- * Contributors:
- * Oracle - initial API and implementation
- ******************************************************************************/
-package org.eclipse.jpt.core.tests.internal.resource.java;
-
-import java.util.Iterator;
-import org.eclipse.jdt.core.ICompilationUnit;
-import org.eclipse.jpt.core.resource.java.FetchType;
-import org.eclipse.jpt.core.resource.java.JPA;
-import org.eclipse.jpt.core.resource.java.JavaResourcePersistentAttribute;
-import org.eclipse.jpt.core.resource.java.JavaResourcePersistentType;
-import org.eclipse.jpt.core.resource.java.ManyToOneAnnotation;
-import org.eclipse.jpt.utility.internal.iterators.ArrayIterator;
-
-@SuppressWarnings("nls")
-public class ManyToOneTests extends JavaResourceModelTestCase {
-
- public ManyToOneTests(String name) {
- super(name);
- }
-
- private ICompilationUnit createTestManyToOne() throws Exception {
- return this.createTestType(new DefaultAnnotationWriter() {
- @Override
- public Iterator<String> imports() {
- return new ArrayIterator<String>(JPA.MANY_TO_ONE);
- }
- @Override
- public void appendIdFieldAnnotationTo(StringBuilder sb) {
- sb.append("@ManyToOne");
- }
- });
- }
-
- private ICompilationUnit createTestManyToOneWithFetch() throws Exception {
- return this.createTestType(new DefaultAnnotationWriter() {
- @Override
- public Iterator<String> imports() {
- return new ArrayIterator<String>(JPA.MANY_TO_ONE, JPA.FETCH_TYPE);
- }
- @Override
- public void appendIdFieldAnnotationTo(StringBuilder sb) {
- sb.append("@ManyToOne(fetch = FetchType.EAGER)");
- }
- });
- }
-
- private ICompilationUnit createTestManyToOneWithTargetEntity() throws Exception {
- return this.createTestType(new DefaultAnnotationWriter() {
- @Override
- public Iterator<String> imports() {
- return new ArrayIterator<String>(JPA.MANY_TO_ONE);
- }
- @Override
- public void appendIdFieldAnnotationTo(StringBuilder sb) {
- sb.append("@ManyToOne(targetEntity = AnnotationTestType.class)");
- }
- });
- }
-
- private ICompilationUnit createTestManyToOneWithOptional() throws Exception {
- return this.createTestType(new DefaultAnnotationWriter() {
- @Override
- public Iterator<String> imports() {
- return new ArrayIterator<String>(JPA.MANY_TO_ONE);
- }
- @Override
- public void appendIdFieldAnnotationTo(StringBuilder sb) {
- sb.append("@ManyToOne(optional = true)");
- }
- });
- }
-
- private ICompilationUnit createTestManyToOneWithCascade() throws Exception {
- return this.createTestType(new DefaultAnnotationWriter() {
- @Override
- public Iterator<String> imports() {
- return new ArrayIterator<String>(JPA.MANY_TO_ONE, JPA.CASCADE_TYPE);
- }
- @Override
- public void appendIdFieldAnnotationTo(StringBuilder sb) {
- sb.append("@ManyToOne(cascade = CascadeType.ALL)");
- }
- });
- }
-
- private ICompilationUnit createTestManyToOneWithMultipleCascade() throws Exception {
- return this.createTestType(new DefaultAnnotationWriter() {
- @Override
- public Iterator<String> imports() {
- return new ArrayIterator<String>(JPA.MANY_TO_ONE, JPA.CASCADE_TYPE);
- }
- @Override
- public void appendIdFieldAnnotationTo(StringBuilder sb) {
- sb.append("@ManyToOne(cascade = {CascadeType.MERGE, CascadeType.REMOVE})");
- }
- });
- }
-
- private ICompilationUnit createTestManyToOneWithDuplicateCascade() throws Exception {
- return this.createTestType(new DefaultAnnotationWriter() {
- @Override
- public Iterator<String> imports() {
- return new ArrayIterator<String>(JPA.MANY_TO_ONE, JPA.CASCADE_TYPE);
- }
- @Override
- public void appendIdFieldAnnotationTo(StringBuilder sb) {
- sb.append("@ManyToOne(cascade = {CascadeType.MERGE, CascadeType.MERGE})");
- }
- });
- }
-
- public void testManyToOne() throws Exception {
- ICompilationUnit cu = this.createTestManyToOne();
- JavaResourcePersistentType typeResource = buildJavaTypeResource(cu);
- JavaResourcePersistentAttribute attributeResource = typeResource.fields().next();
-
- ManyToOneAnnotation manyToOne = (ManyToOneAnnotation) attributeResource.getMappingAnnotation(JPA.MANY_TO_ONE);
- assertNotNull(manyToOne);
- }
-
- public void testGetFetch() throws Exception {
- ICompilationUnit cu = this.createTestManyToOneWithFetch();
- JavaResourcePersistentType typeResource = buildJavaTypeResource(cu);
- JavaResourcePersistentAttribute attributeResource = typeResource.fields().next();
-
- ManyToOneAnnotation manyToOne = (ManyToOneAnnotation) attributeResource.getMappingAnnotation(JPA.MANY_TO_ONE);
- assertEquals(FetchType.EAGER, manyToOne.getFetch());
- }
-
- public void testSetFetch() throws Exception {
- ICompilationUnit cu = this.createTestManyToOneWithFetch();
- JavaResourcePersistentType typeResource = buildJavaTypeResource(cu);
- JavaResourcePersistentAttribute attributeResource = typeResource.fields().next();
-
- ManyToOneAnnotation manyToOne = (ManyToOneAnnotation) attributeResource.getMappingAnnotation(JPA.MANY_TO_ONE);
- assertEquals(FetchType.EAGER, manyToOne.getFetch());
-
- manyToOne.setFetch(FetchType.LAZY);
- assertEquals(FetchType.LAZY, manyToOne.getFetch());
-
- assertSourceContains("@ManyToOne(fetch = LAZY)", cu);
- }
-
- public void testSetFetchNull() throws Exception {
- ICompilationUnit cu = this.createTestManyToOneWithFetch();
- JavaResourcePersistentType typeResource = buildJavaTypeResource(cu);
- JavaResourcePersistentAttribute attributeResource = typeResource.fields().next();
-
- ManyToOneAnnotation manyToOne = (ManyToOneAnnotation) attributeResource.getMappingAnnotation(JPA.MANY_TO_ONE);
- assertEquals(FetchType.EAGER, manyToOne.getFetch());
-
- manyToOne.setFetch(null);
- assertNull(manyToOne.getFetch());
-
- assertSourceContains("@ManyToOne", cu);
- assertSourceDoesNotContain("fetch", cu);
- }
-
-
- public void testGetTargetEntity() throws Exception {
- ICompilationUnit cu = this.createTestManyToOneWithTargetEntity();
- JavaResourcePersistentType typeResource = buildJavaTypeResource(cu);
- JavaResourcePersistentAttribute attributeResource = typeResource.fields().next();
-
- ManyToOneAnnotation manyToOne = (ManyToOneAnnotation) attributeResource.getMappingAnnotation(JPA.MANY_TO_ONE);
- assertEquals(TYPE_NAME, manyToOne.getTargetEntity());
- }
-
- public void testSetTargetEntity() throws Exception {
- ICompilationUnit cu = this.createTestManyToOneWithTargetEntity();
- JavaResourcePersistentType typeResource = buildJavaTypeResource(cu);
- JavaResourcePersistentAttribute attributeResource = typeResource.fields().next();
-
- ManyToOneAnnotation manyToOne = (ManyToOneAnnotation) attributeResource.getMappingAnnotation(JPA.MANY_TO_ONE);
- assertEquals(TYPE_NAME, manyToOne.getTargetEntity());
-
- manyToOne.setTargetEntity("Foo");
-
- assertSourceContains("@ManyToOne(targetEntity = Foo.class)", cu);
- }
-
- public void testSetTargetEntityNull() throws Exception {
- ICompilationUnit cu = this.createTestManyToOneWithTargetEntity();
- JavaResourcePersistentType typeResource = buildJavaTypeResource(cu);
- JavaResourcePersistentAttribute attributeResource = typeResource.fields().next();
-
- ManyToOneAnnotation manyToOne = (ManyToOneAnnotation) attributeResource.getMappingAnnotation(JPA.MANY_TO_ONE);
- assertEquals(TYPE_NAME, manyToOne.getTargetEntity());
-
- manyToOne.setTargetEntity(null);
-
- assertSourceContains("@ManyToOne", cu);
- assertSourceDoesNotContain("targetEntity", cu);
- }
-
-
- public void testGetFullyQualifiedTargetEntity() throws Exception {
- ICompilationUnit cu = this.createTestManyToOneWithTargetEntity();
- JavaResourcePersistentType typeResource = buildJavaTypeResource(cu);
- JavaResourcePersistentAttribute attributeResource = typeResource.fields().next();
-
- ManyToOneAnnotation manyToOne = (ManyToOneAnnotation) attributeResource.getMappingAnnotation(JPA.MANY_TO_ONE);
- assertEquals(FULLY_QUALIFIED_TYPE_NAME, manyToOne.getFullyQualifiedTargetEntityClassName());
-
- manyToOne.setTargetEntity("Foo");
-
- assertSourceContains("@ManyToOne(targetEntity = Foo.class)", cu);
-
- assertEquals("Foo", manyToOne.getTargetEntity());
-
- assertEquals("Foo", manyToOne.getFullyQualifiedTargetEntityClassName());//bug 196200 changed this
- }
-
- public void testGetOptional() throws Exception {
- ICompilationUnit cu = this.createTestManyToOneWithOptional();
- JavaResourcePersistentType typeResource = buildJavaTypeResource(cu);
- JavaResourcePersistentAttribute attributeResource = typeResource.fields().next();
-
- ManyToOneAnnotation manyToOne = (ManyToOneAnnotation) attributeResource.getMappingAnnotation(JPA.MANY_TO_ONE);
- assertEquals(Boolean.TRUE, manyToOne.getOptional());
- }
-
- public void testSetOptional() throws Exception {
- ICompilationUnit cu = this.createTestManyToOneWithOptional();
- JavaResourcePersistentType typeResource = buildJavaTypeResource(cu);
- JavaResourcePersistentAttribute attributeResource = typeResource.fields().next();
-
- ManyToOneAnnotation manyToOne = (ManyToOneAnnotation) attributeResource.getMappingAnnotation(JPA.MANY_TO_ONE);
- assertEquals(Boolean.TRUE, manyToOne.getOptional());
-
- manyToOne.setOptional(Boolean.FALSE);
- assertEquals(Boolean.FALSE, manyToOne.getOptional());
-
- assertSourceContains("@ManyToOne(optional = false)", cu);
- }
-
- public void testSetOptionalNull() throws Exception {
- ICompilationUnit cu = this.createTestManyToOneWithOptional();
- JavaResourcePersistentType typeResource = buildJavaTypeResource(cu);
- JavaResourcePersistentAttribute attributeResource = typeResource.fields().next();
-
- ManyToOneAnnotation manyToOne = (ManyToOneAnnotation) attributeResource.getMappingAnnotation(JPA.MANY_TO_ONE);
- assertEquals(Boolean.TRUE, manyToOne.getOptional());
-
- manyToOne.setOptional(null);
- assertNull(manyToOne.getOptional());
-
- assertSourceContains("@ManyToOne", cu);
- assertSourceDoesNotContain("optional", cu);
- }
-
- public void testSetCascadeAll() throws Exception {
- ICompilationUnit cu = this.createTestManyToOne();
- JavaResourcePersistentType typeResource = buildJavaTypeResource(cu);
- JavaResourcePersistentAttribute attributeResource = typeResource.fields().next();
-
- ManyToOneAnnotation manyToOne = (ManyToOneAnnotation) attributeResource.getMappingAnnotation(JPA.MANY_TO_ONE);
- assertFalse(manyToOne.isCascadeAll());
-
- manyToOne.setCascadeAll(true);
- assertSourceContains("@ManyToOne(cascade = ALL)", cu);
-
- assertTrue(manyToOne.isCascadeAll());
- }
-
- public void testSetCascadeMerge() throws Exception {
- ICompilationUnit cu = this.createTestManyToOne();
- JavaResourcePersistentType typeResource = buildJavaTypeResource(cu);
- JavaResourcePersistentAttribute attributeResource = typeResource.fields().next();
-
- ManyToOneAnnotation manyToOne = (ManyToOneAnnotation) attributeResource.getMappingAnnotation(JPA.MANY_TO_ONE);
- assertFalse(manyToOne.isCascadeMerge());
-
- manyToOne.setCascadeMerge(true);
- assertSourceContains("@ManyToOne(cascade = MERGE)", cu);
-
- assertTrue(manyToOne.isCascadeMerge());
- }
-
- public void testSetCascadePersist() throws Exception {
- ICompilationUnit cu = this.createTestManyToOne();
- JavaResourcePersistentType typeResource = buildJavaTypeResource(cu);
- JavaResourcePersistentAttribute attributeResource = typeResource.fields().next();
-
- ManyToOneAnnotation manyToOne = (ManyToOneAnnotation) attributeResource.getMappingAnnotation(JPA.MANY_TO_ONE);
- assertFalse(manyToOne.isCascadePersist());
-
- manyToOne.setCascadePersist(true);
- assertSourceContains("@ManyToOne(cascade = PERSIST)", cu);
-
- assertTrue(manyToOne.isCascadePersist());
- }
-
- public void testSetCascadeRemove() throws Exception {
- ICompilationUnit cu = this.createTestManyToOne();
- JavaResourcePersistentType typeResource = buildJavaTypeResource(cu);
- JavaResourcePersistentAttribute attributeResource = typeResource.fields().next();
-
- ManyToOneAnnotation manyToOne = (ManyToOneAnnotation) attributeResource.getMappingAnnotation(JPA.MANY_TO_ONE);
- assertFalse(manyToOne.isCascadeRemove());
-
- manyToOne.setCascadeRemove(true);
- assertSourceContains("@ManyToOne(cascade = REMOVE)", cu);
-
- assertTrue(manyToOne.isCascadeRemove());
- }
-
- public void testSetCascadeRefresh() throws Exception {
- ICompilationUnit cu = this.createTestManyToOne();
- JavaResourcePersistentType typeResource = buildJavaTypeResource(cu);
- JavaResourcePersistentAttribute attributeResource = typeResource.fields().next();
-
- ManyToOneAnnotation manyToOne = (ManyToOneAnnotation) attributeResource.getMappingAnnotation(JPA.MANY_TO_ONE);
- assertFalse(manyToOne.isCascadeRefresh());
-
- manyToOne.setCascadeRefresh(true);
- assertSourceContains("@ManyToOne(cascade = REFRESH)", cu);
-
- assertTrue(manyToOne.isCascadeRefresh());
- }
-
- public void testCascadeMoreThanOnce() throws Exception {
- ICompilationUnit cu = this.createTestManyToOneWithCascade();
- JavaResourcePersistentType typeResource = buildJavaTypeResource(cu);
- JavaResourcePersistentAttribute attributeResource = typeResource.fields().next();
-
- ManyToOneAnnotation manyToOne = (ManyToOneAnnotation) attributeResource.getMappingAnnotation(JPA.MANY_TO_ONE);
- assertTrue(manyToOne.isCascadeAll());
-
- manyToOne.setCascadeAll(true);
- assertTrue(manyToOne.isCascadeAll());
- //a second CascadeType.All should not have been added
- assertSourceContains("@ManyToOne(cascade = CascadeType.ALL)", cu);
-
- manyToOne.setCascadeAll(false);
- assertFalse(manyToOne.isCascadeAll());
-
- assertSourceDoesNotContain("cascade", cu);
-
- //test setting cascadeAll to false again, should just do nothing
- manyToOne.setCascadeAll(false);
- assertFalse(manyToOne.isCascadeAll());
-
- assertSourceDoesNotContain("cascade", cu);
- }
-
- public void testDuplicateCascade() throws Exception {
- ICompilationUnit cu = this.createTestManyToOneWithDuplicateCascade();
- JavaResourcePersistentType typeResource = buildJavaTypeResource(cu);
- JavaResourcePersistentAttribute attributeResource = typeResource.fields().next();
-
- ManyToOneAnnotation manyToOne = (ManyToOneAnnotation) attributeResource.getMappingAnnotation(JPA.MANY_TO_ONE);
- assertTrue(manyToOne.isCascadeMerge());
-
- manyToOne.setCascadeMerge(false);//TODO should the resource model handle this and remove both MERGE
- //settings instead of having to set it false twice?
- assertTrue(manyToOne.isCascadeMerge());
-
- manyToOne.setCascadeMerge(false);
- assertFalse(manyToOne.isCascadeMerge());
-
- assertSourceDoesNotContain("cascade", cu);
- }
-
- public void testMultipleCascade() throws Exception {
- ICompilationUnit cu = this.createTestManyToOneWithMultipleCascade();
- JavaResourcePersistentType typeResource = buildJavaTypeResource(cu);
- JavaResourcePersistentAttribute attributeResource = typeResource.fields().next();
-
- ManyToOneAnnotation manyToOne = (ManyToOneAnnotation) attributeResource.getMappingAnnotation(JPA.MANY_TO_ONE);
- assertTrue(manyToOne.isCascadeMerge());
- assertTrue(manyToOne.isCascadeRemove());
-
- manyToOne.setCascadeMerge(false);
- assertSourceContains("@ManyToOne(cascade = REMOVE)", cu);
-
- manyToOne.setCascadeRemove(false);
- assertSourceDoesNotContain("cascade", cu);
- }
-}
diff --git a/jpa/tests/org.eclipse.jpt.core.tests/src/org/eclipse/jpt/core/tests/internal/resource/java/MapKeyTests.java b/jpa/tests/org.eclipse.jpt.core.tests/src/org/eclipse/jpt/core/tests/internal/resource/java/MapKeyTests.java
deleted file mode 100644
index 409de12160..0000000000
--- a/jpa/tests/org.eclipse.jpt.core.tests/src/org/eclipse/jpt/core/tests/internal/resource/java/MapKeyTests.java
+++ /dev/null
@@ -1,88 +0,0 @@
-/*******************************************************************************
- * Copyright (c) 2007, 2009 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.
- *
- * Contributors:
- * Oracle - initial API and implementation
- ******************************************************************************/
-package org.eclipse.jpt.core.tests.internal.resource.java;
-
-import java.util.Iterator;
-import org.eclipse.jdt.core.ICompilationUnit;
-import org.eclipse.jpt.core.resource.java.JPA;
-import org.eclipse.jpt.core.resource.java.JavaResourcePersistentAttribute;
-import org.eclipse.jpt.core.resource.java.JavaResourcePersistentType;
-import org.eclipse.jpt.core.resource.java.MapKeyAnnotation;
-import org.eclipse.jpt.utility.internal.iterators.ArrayIterator;
-
-@SuppressWarnings("nls")
-public class MapKeyTests extends JavaResourceModelTestCase {
-
- public MapKeyTests(String name) {
- super(name);
- }
-
- private ICompilationUnit createTestMapKey() throws Exception {
- return this.createTestType(new DefaultAnnotationWriter() {
- @Override
- public Iterator<String> imports() {
- return new ArrayIterator<String>(JPA.MAP_KEY);
- }
- @Override
- public void appendIdFieldAnnotationTo(StringBuilder sb) {
- sb.append("@MapKey");
- }
- });
- }
-
- private ICompilationUnit createTestMapKeyWithName() throws Exception {
- return this.createTestType(new DefaultAnnotationWriter() {
- @Override
- public Iterator<String> imports() {
- return new ArrayIterator<String>(JPA.MAP_KEY);
- }
- @Override
- public void appendIdFieldAnnotationTo(StringBuilder sb) {
- sb.append("@MapKey(name = \"key\")");
- }
- });
- }
-
- public void testMapKey() throws Exception {
- ICompilationUnit cu = this.createTestMapKey();
- JavaResourcePersistentType typeResource = buildJavaTypeResource(cu);
- JavaResourcePersistentAttribute attributeResource = typeResource.fields().next();
-
- MapKeyAnnotation mapKey = (MapKeyAnnotation) attributeResource.getSupportingAnnotation(JPA.MAP_KEY);
- assertNotNull(mapKey);
- }
-
- public void testGetName() throws Exception {
- ICompilationUnit cu = this.createTestMapKeyWithName();
- JavaResourcePersistentType typeResource = buildJavaTypeResource(cu);
- JavaResourcePersistentAttribute attributeResource = typeResource.fields().next();
-
- MapKeyAnnotation mapKey = (MapKeyAnnotation) attributeResource.getSupportingAnnotation(JPA.MAP_KEY);
- assertEquals("key", mapKey.getName());
- }
-
- public void testSetName() throws Exception {
- ICompilationUnit cu = this.createTestMapKey();
- JavaResourcePersistentType typeResource = buildJavaTypeResource(cu);
- JavaResourcePersistentAttribute attributeResource = typeResource.fields().next();
-
- MapKeyAnnotation mapKey = (MapKeyAnnotation) attributeResource.getSupportingAnnotation(JPA.MAP_KEY);
-
- mapKey.setName("foo");
-
- assertSourceContains("@MapKey(name = \"foo\")", cu);
-
- mapKey.setName(null);
-
- assertSourceContains("@MapKey", cu);
- assertSourceDoesNotContain("@MapKey(name = \"foo\")", cu);
- }
-
-}
diff --git a/jpa/tests/org.eclipse.jpt.core.tests/src/org/eclipse/jpt/core/tests/internal/resource/java/MappedSuperclassTests.java b/jpa/tests/org.eclipse.jpt.core.tests/src/org/eclipse/jpt/core/tests/internal/resource/java/MappedSuperclassTests.java
deleted file mode 100644
index 5f20d3d322..0000000000
--- a/jpa/tests/org.eclipse.jpt.core.tests/src/org/eclipse/jpt/core/tests/internal/resource/java/MappedSuperclassTests.java
+++ /dev/null
@@ -1,74 +0,0 @@
-/*******************************************************************************
- * Copyright (c) 2007, 2009 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.
- *
- * Contributors:
- * Oracle - initial API and implementation
- ******************************************************************************/
-package org.eclipse.jpt.core.tests.internal.resource.java;
-
-import java.util.Iterator;
-import org.eclipse.jdt.core.ICompilationUnit;
-import org.eclipse.jpt.core.resource.java.EntityAnnotation;
-import org.eclipse.jpt.core.resource.java.JPA;
-import org.eclipse.jpt.core.resource.java.JavaResourceNode;
-import org.eclipse.jpt.core.resource.java.JavaResourcePersistentType;
-import org.eclipse.jpt.core.resource.java.MappedSuperclassAnnotation;
-import org.eclipse.jpt.utility.internal.iterators.ArrayIterator;
-
-@SuppressWarnings("nls")
-public class MappedSuperclassTests extends JavaResourceModelTestCase {
-
- public MappedSuperclassTests(String name) {
- super(name);
- }
-
- private ICompilationUnit createTestMappedSuperclass() throws Exception {
- return this.createTestType(new DefaultAnnotationWriter() {
- @Override
- public Iterator<String> imports() {
- return new ArrayIterator<String>(JPA.MAPPED_SUPERCLASS);
- }
- @Override
- public void appendTypeAnnotationTo(StringBuilder sb) {
- sb.append("@MappedSuperclass");
- }
- });
- }
-
- private ICompilationUnit createTestMappedSuperclassAndEntity() throws Exception {
- return this.createTestType(new DefaultAnnotationWriter() {
- @Override
- public Iterator<String> imports() {
- return new ArrayIterator<String>(JPA.MAPPED_SUPERCLASS, JPA.ENTITY);
- }
- @Override
- public void appendTypeAnnotationTo(StringBuilder sb) {
- sb.append("@MappedSuperclass");
- sb.append("@Entity");
- }
- });
- }
-
- public void testMappedSuperclass() throws Exception {
- ICompilationUnit cu = this.createTestMappedSuperclass();
- JavaResourcePersistentType typeResource = buildJavaTypeResource(cu);
-
- JavaResourceNode mappingAnnotation = typeResource.getMappingAnnotation();
- assertTrue(mappingAnnotation instanceof MappedSuperclassAnnotation);
- }
-
- public void testMappedSuperclassAndEntity() throws Exception {
- ICompilationUnit cu = this.createTestMappedSuperclassAndEntity();
- JavaResourcePersistentType typeResource = buildJavaTypeResource(cu);
-
- JavaResourceNode mappingAnnotation = typeResource.getMappingAnnotation();
- assertTrue(mappingAnnotation instanceof EntityAnnotation);
-
- MappedSuperclassAnnotation mappedSuperclass = (MappedSuperclassAnnotation) typeResource.getMappingAnnotation(JPA.MAPPED_SUPERCLASS);
- assertNotNull(mappedSuperclass);
- }
-
-}
diff --git a/jpa/tests/org.eclipse.jpt.core.tests/src/org/eclipse/jpt/core/tests/internal/resource/java/NamedNativeQueriesTests.java b/jpa/tests/org.eclipse.jpt.core.tests/src/org/eclipse/jpt/core/tests/internal/resource/java/NamedNativeQueriesTests.java
deleted file mode 100644
index 274a1b6a25..0000000000
--- a/jpa/tests/org.eclipse.jpt.core.tests/src/org/eclipse/jpt/core/tests/internal/resource/java/NamedNativeQueriesTests.java
+++ /dev/null
@@ -1,421 +0,0 @@
-/*******************************************************************************
- * Copyright (c) 2007, 2009 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.
- *
- * Contributors:
- * Oracle - initial API and implementation
- ******************************************************************************/
-package org.eclipse.jpt.core.tests.internal.resource.java;
-
-import java.util.Iterator;
-
-import org.eclipse.jdt.core.ICompilationUnit;
-import org.eclipse.jpt.core.resource.java.JPA;
-import org.eclipse.jpt.core.resource.java.JavaResourcePersistentType;
-import org.eclipse.jpt.core.resource.java.NamedNativeQueriesAnnotation;
-import org.eclipse.jpt.core.resource.java.NamedNativeQueryAnnotation;
-import org.eclipse.jpt.core.resource.java.NestableAnnotation;
-import org.eclipse.jpt.utility.internal.CollectionTools;
-import org.eclipse.jpt.utility.internal.iterators.ArrayIterator;
-
-@SuppressWarnings("nls")
-public class NamedNativeQueriesTests extends JavaResourceModelTestCase {
-
- private static final String QUERY_NAME = "myQuery";
- private static final String QUERY_QUERY = "SELECT name FROM Employee";
- private static final String QUERY_RESULT_CLASS = "Result";
- private static final String QUERY_RESULT_SET_MAPPING = "resultSetMapping";
-
- public NamedNativeQueriesTests(String name) {
- super(name);
- }
-
- private ICompilationUnit createTestNamedNativeQueries() throws Exception {
- return this.createTestType(new DefaultAnnotationWriter() {
- @Override
- public Iterator<String> imports() {
- return new ArrayIterator<String>(JPA.NAMED_NATIVE_QUERIES, JPA.NAMED_NATIVE_QUERY);
- }
- @Override
- public void appendTypeAnnotationTo(StringBuilder sb) {
- sb.append("@NamedNativeQueries(@NamedNativeQuery)");
- }
- });
- }
-
- private ICompilationUnit createTestNamedNativeQueryWithName() throws Exception {
- return createTestNamedNativeQueryWithStringElement("name", QUERY_NAME);
- }
-
- private ICompilationUnit createTestNamedNativeQueryWithQuery() throws Exception {
- return createTestNamedNativeQueryWithStringElement("query", QUERY_QUERY);
- }
-
- private ICompilationUnit createTestNamedNativeQueryWithResultSetMapping() throws Exception {
- return createTestNamedNativeQueryWithStringElement("resultSetMapping", QUERY_RESULT_SET_MAPPING);
- }
-
-
- private ICompilationUnit createTestNamedNativeQueryWithStringElement(final String elementName, final String value) throws Exception {
- return this.createTestType(new DefaultAnnotationWriter() {
- @Override
- public Iterator<String> imports() {
- return new ArrayIterator<String>(JPA.NAMED_NATIVE_QUERIES, JPA.NAMED_NATIVE_QUERY);
- }
- @Override
- public void appendTypeAnnotationTo(StringBuilder sb) {
- sb.append("@NamedNativeQueries(@NamedNativeQuery(" + elementName + " = \"" + value + "\"))");
- }
- });
- }
-
- private ICompilationUnit createTestNamedNativeQueryWithResultClass() throws Exception {
- return this.createTestType(new DefaultAnnotationWriter() {
- @Override
- public Iterator<String> imports() {
- return new ArrayIterator<String>(JPA.NAMED_NATIVE_QUERIES, JPA.NAMED_NATIVE_QUERY);
- }
- @Override
- public void appendTypeAnnotationTo(StringBuilder sb) {
- sb.append("@NamedNativeQueries(@NamedNativeQuery(resultClass = " + QUERY_RESULT_CLASS + ".class))");
- }
- });
- }
-
- private ICompilationUnit createTestNamedNativeQueryWithQueryHints() throws Exception {
- return this.createTestType(new DefaultAnnotationWriter() {
- @Override
- public Iterator<String> imports() {
- return new ArrayIterator<String>(JPA.NAMED_NATIVE_QUERIES, JPA.NAMED_NATIVE_QUERY, JPA.QUERY_HINT);
- }
- @Override
- public void appendTypeAnnotationTo(StringBuilder sb) {
- sb.append("@NamedNativeQueries(@NamedNativeQuery(hints = {@QueryHint(name = \"BAR\", value = \"FOO\"), @QueryHint}))");
- }
- });
- }
-
- private ICompilationUnit createTestNamedNativeQuery() throws Exception {
- return this.createTestType(new DefaultAnnotationWriter() {
- @Override
- public Iterator<String> imports() {
- return new ArrayIterator<String>(JPA.NAMED_NATIVE_QUERY, JPA.QUERY_HINT);
- }
- @Override
- public void appendTypeAnnotationTo(StringBuilder sb) {
- sb.append("@NamedNativeQuery(name = \"foo\", query = \"bar\", hints = @QueryHint(name = \"BAR\", value = \"FOO\"), resultClass = Foo.class, resultSetMapping = \"mapping\")");
- }
- });
- }
-
- public void testNamedNativeQuery() throws Exception {
- ICompilationUnit cu = this.createTestNamedNativeQueries();
- JavaResourcePersistentType typeResource = buildJavaTypeResource(cu);
-
- NamedNativeQueriesAnnotation namedQueries = (NamedNativeQueriesAnnotation) typeResource.getSupportingAnnotation(JPA.NAMED_NATIVE_QUERIES);
- NamedNativeQueryAnnotation namedQuery = namedQueries.nestedAnnotations().next();
- assertNotNull(namedQuery);
- }
-
- public void testGetName() throws Exception {
- ICompilationUnit cu = this.createTestNamedNativeQueryWithName();
- JavaResourcePersistentType typeResource = buildJavaTypeResource(cu);
-
- NamedNativeQueriesAnnotation namedQueries = (NamedNativeQueriesAnnotation) typeResource.getSupportingAnnotation(JPA.NAMED_NATIVE_QUERIES);
- NamedNativeQueryAnnotation namedQuery = namedQueries.nestedAnnotations().next();
- assertEquals(QUERY_NAME, namedQuery.getName());
- }
-
- public void testSetName() throws Exception {
- ICompilationUnit cu = this.createTestNamedNativeQueryWithName();
- JavaResourcePersistentType typeResource = buildJavaTypeResource(cu);
-
- NamedNativeQueriesAnnotation namedQueries = (NamedNativeQueriesAnnotation) typeResource.getSupportingAnnotation(JPA.NAMED_NATIVE_QUERIES);
- NamedNativeQueryAnnotation namedQuery = namedQueries.nestedAnnotations().next();
- assertEquals(QUERY_NAME, namedQuery.getName());
-
- namedQuery.setName("foo");
- assertEquals("foo", namedQuery.getName());
-
- assertSourceContains("@NamedNativeQuery(name = \"foo\")", cu);
-
- namedQuery.setName(null);
- assertNull(namedQuery.getName());
-
- assertSourceDoesNotContain("@NamedNativeQuery", cu);
- }
-
- public void testGetQuery() throws Exception {
- ICompilationUnit cu = this.createTestNamedNativeQueryWithQuery();
- JavaResourcePersistentType typeResource = buildJavaTypeResource(cu);
-
- NamedNativeQueriesAnnotation namedQueries = (NamedNativeQueriesAnnotation) typeResource.getSupportingAnnotation(JPA.NAMED_NATIVE_QUERIES);
- NamedNativeQueryAnnotation namedQuery = namedQueries.nestedAnnotations().next();
- assertEquals(QUERY_QUERY, namedQuery.getQuery());
- }
-
- public void testSetQuery() throws Exception {
- ICompilationUnit cu = this.createTestNamedNativeQueryWithQuery();
- JavaResourcePersistentType typeResource = buildJavaTypeResource(cu);
-
- NamedNativeQueriesAnnotation namedQueries = (NamedNativeQueriesAnnotation) typeResource.getSupportingAnnotation(JPA.NAMED_NATIVE_QUERIES);
- NamedNativeQueryAnnotation namedQuery = namedQueries.nestedAnnotations().next();
- assertEquals(QUERY_QUERY, namedQuery.getQuery());
-
- namedQuery.setQuery("foo");
- assertEquals("foo", namedQuery.getQuery());
-
- assertSourceContains("@NamedNativeQuery(query = \"foo\")", cu);
-
- namedQuery.setQuery(null);
- assertNull(namedQuery.getQuery());
-
- assertSourceDoesNotContain("@NamedNativeQuery", cu);
- }
-
- public void testGetResultClass() throws Exception {
- ICompilationUnit cu = this.createTestNamedNativeQueryWithResultClass();
- JavaResourcePersistentType typeResource = buildJavaTypeResource(cu);
-
- NamedNativeQueriesAnnotation namedQueries = (NamedNativeQueriesAnnotation) typeResource.getSupportingAnnotation(JPA.NAMED_NATIVE_QUERIES);
- NamedNativeQueryAnnotation namedQuery = namedQueries.nestedAnnotations().next();
- assertEquals(QUERY_RESULT_CLASS, namedQuery.getResultClass());
- }
-
- public void testSetResultClass() throws Exception {
- ICompilationUnit cu = this.createTestNamedNativeQueryWithResultClass();
- JavaResourcePersistentType typeResource = buildJavaTypeResource(cu);
-
- NamedNativeQueriesAnnotation namedQueries = (NamedNativeQueriesAnnotation) typeResource.getSupportingAnnotation(JPA.NAMED_NATIVE_QUERIES);
- NamedNativeQueryAnnotation namedQuery = namedQueries.nestedAnnotations().next();
- assertEquals(QUERY_RESULT_CLASS, namedQuery.getResultClass());
-
- namedQuery.setResultClass("foo");
- assertEquals("foo", namedQuery.getResultClass());
-
- assertSourceContains("@NamedNativeQuery(resultClass = foo.class)", cu);
-
- namedQuery.setResultClass(null);
- assertNull(namedQuery.getResultClass());
-
- assertSourceDoesNotContain("@NamedNativeQuery", cu);
- }
-
- public void testGetFullyQualifiedClass() throws Exception {
- ICompilationUnit cu = this.createTestNamedNativeQueryWithResultClass();
- JavaResourcePersistentType typeResource = buildJavaTypeResource(cu);
-
- NamedNativeQueriesAnnotation namedQueries = (NamedNativeQueriesAnnotation) typeResource.getSupportingAnnotation(JPA.NAMED_NATIVE_QUERIES);
- NamedNativeQueryAnnotation namedQuery = namedQueries.nestedAnnotations().next();
- assertNotNull(namedQuery.getResultClass());
- assertEquals("Result", namedQuery.getFullyQualifiedResultClassName());//bug 196200 changed this
-
- namedQuery.setResultClass(TYPE_NAME);
-
- assertEquals(FULLY_QUALIFIED_TYPE_NAME, namedQuery.getFullyQualifiedResultClassName());
- assertSourceContains("@NamedNativeQuery(resultClass = " + TYPE_NAME + ".class)", cu);
- }
-
- public void testGetResultSetMapping() throws Exception {
- ICompilationUnit cu = this.createTestNamedNativeQueryWithResultSetMapping();
- JavaResourcePersistentType typeResource = buildJavaTypeResource(cu);
-
- NamedNativeQueriesAnnotation namedQueries = (NamedNativeQueriesAnnotation) typeResource.getSupportingAnnotation(JPA.NAMED_NATIVE_QUERIES);
- NamedNativeQueryAnnotation namedQuery = namedQueries.nestedAnnotations().next();
- assertEquals(QUERY_RESULT_SET_MAPPING, namedQuery.getResultSetMapping());
- }
-
- public void testSetResultSetMapping() throws Exception {
- ICompilationUnit cu = this.createTestNamedNativeQueryWithResultSetMapping();
- JavaResourcePersistentType typeResource = buildJavaTypeResource(cu);
-
- NamedNativeQueriesAnnotation namedQueries = (NamedNativeQueriesAnnotation) typeResource.getSupportingAnnotation(JPA.NAMED_NATIVE_QUERIES);
- NamedNativeQueryAnnotation namedQuery = namedQueries.nestedAnnotations().next();
- assertEquals(QUERY_RESULT_SET_MAPPING, namedQuery.getResultSetMapping());
-
- namedQuery.setResultSetMapping("foo");
- assertEquals("foo", namedQuery.getResultSetMapping());
-
- assertSourceContains("@NamedNativeQuery(resultSetMapping = \"foo\")", cu);
-
- namedQuery.setResultSetMapping(null);
- assertNull(namedQuery.getResultSetMapping());
-
- assertSourceDoesNotContain("@NamedNativeQuery", cu);
- }
-
- public void testHints() throws Exception {
- ICompilationUnit cu = this.createTestNamedNativeQueries();
- JavaResourcePersistentType typeResource = buildJavaTypeResource(cu);
-
- NamedNativeQueriesAnnotation namedQueries = (NamedNativeQueriesAnnotation) typeResource.getSupportingAnnotation(JPA.NAMED_NATIVE_QUERIES);
- NamedNativeQueryAnnotation namedQuery = namedQueries.nestedAnnotations().next();
-
- assertEquals(0, namedQuery.hintsSize());
- }
-
- public void testHints2() throws Exception {
- ICompilationUnit cu = this.createTestNamedNativeQueries();
- JavaResourcePersistentType typeResource = buildJavaTypeResource(cu);
-
- NamedNativeQueriesAnnotation namedQueries = (NamedNativeQueriesAnnotation) typeResource.getSupportingAnnotation(JPA.NAMED_NATIVE_QUERIES);
- NamedNativeQueryAnnotation namedQuery = namedQueries.nestedAnnotations().next();
-
- namedQuery.addHint(0);
- namedQuery.addHint(1);
-
- assertEquals(2, namedQuery.hintsSize());
- }
-
- public void testHints3() throws Exception {
- ICompilationUnit cu = this.createTestNamedNativeQueryWithQueryHints();
- JavaResourcePersistentType typeResource = buildJavaTypeResource(cu);
-
- NamedNativeQueriesAnnotation namedQueries = (NamedNativeQueriesAnnotation) typeResource.getSupportingAnnotation(JPA.NAMED_NATIVE_QUERIES);
- NamedNativeQueryAnnotation namedQuery = namedQueries.nestedAnnotations().next();
-
- assertEquals(2, namedQuery.hintsSize());
- }
-
- public void testAddHint() throws Exception {
- ICompilationUnit cu = this.createTestNamedNativeQueries();
- JavaResourcePersistentType typeResource = buildJavaTypeResource(cu);
-
- NamedNativeQueriesAnnotation namedQueries = (NamedNativeQueriesAnnotation) typeResource.getSupportingAnnotation(JPA.NAMED_NATIVE_QUERIES);
- NamedNativeQueryAnnotation namedQuery = namedQueries.nestedAnnotations().next();
-
- namedQuery.addHint(0).setName("FOO");
- namedQuery.addHint(1);
- namedQuery.addHint(0).setName("BAR");
-
- assertEquals("BAR", namedQuery.hintAt(0).getName());
- assertEquals("FOO", namedQuery.hintAt(1).getName());
- assertNull(namedQuery.hintAt(2).getName());
- assertSourceContains("@NamedNativeQuery(hints = {@QueryHint(name = \"BAR\"),@QueryHint(name = \"FOO\"), @QueryHint})", cu);
- }
-
- public void testRemoveHint() throws Exception {
- ICompilationUnit cu = this.createTestNamedNativeQueryWithQueryHints();
- JavaResourcePersistentType typeResource = buildJavaTypeResource(cu);
-
- NamedNativeQueriesAnnotation namedQueries = (NamedNativeQueriesAnnotation) typeResource.getSupportingAnnotation(JPA.NAMED_NATIVE_QUERIES);
- NamedNativeQueryAnnotation namedQuery = namedQueries.nestedAnnotations().next();
- namedQuery.addHint(0).setName("BAZ");
-
- assertEquals("BAZ", namedQuery.hintAt(0).getName());
- assertEquals("BAR", namedQuery.hintAt(1).getName());
- assertNull(namedQuery.hintAt(2).getName());
- assertEquals(3, namedQuery.hintsSize());
-
- namedQuery.removeHint(2);
- assertEquals("BAZ", namedQuery.hintAt(0).getName());
- assertEquals("BAR", namedQuery.hintAt(1).getName());
- assertEquals(2, namedQuery.hintsSize());
- assertSourceContains("@NamedNativeQueries(@NamedNativeQuery(hints = {@QueryHint(name = \"BAZ\"), @QueryHint(name = \"BAR\", value = \"FOO\")}))", cu);
-
- namedQuery.removeHint(0);
- assertEquals("BAR", namedQuery.hintAt(0).getName());
- assertEquals(1, namedQuery.hintsSize());
- assertSourceContains("@NamedNativeQueries(@NamedNativeQuery(hints = @QueryHint(name = \"BAR\", value = \"FOO\")))", cu);
-
-
- namedQuery.removeHint(0);
- assertEquals(0, namedQuery.hintsSize());
- assertSourceDoesNotContain("@NamedNativeQuery", cu);
- }
-
- public void testMoveHint() throws Exception {
- ICompilationUnit cu = this.createTestNamedNativeQueryWithQueryHints();
- JavaResourcePersistentType typeResource = buildJavaTypeResource(cu);
-
- NamedNativeQueriesAnnotation namedQueries = (NamedNativeQueriesAnnotation) typeResource.getSupportingAnnotation(JPA.NAMED_NATIVE_QUERIES);
- NamedNativeQueryAnnotation namedQuery = namedQueries.nestedAnnotations().next();
-
- namedQuery.addHint(0).setName("BAZ");
-
- assertEquals("BAZ", namedQuery.hintAt(0).getName());
- assertEquals("BAR", namedQuery.hintAt(1).getName());
- assertNull(namedQuery.hintAt(2).getName());
- assertEquals(3, namedQuery.hintsSize());
-
- namedQuery.moveHint(2, 0);
-
- assertEquals("BAR", namedQuery.hintAt(0).getName());
- assertNull(namedQuery.hintAt(1).getName());
- assertEquals("BAZ", namedQuery.hintAt(2).getName());
- assertEquals(3, namedQuery.hintsSize());
- assertSourceContains("@NamedNativeQueries(@NamedNativeQuery(hints = {@QueryHint(name = \"BAR\", value = \"FOO\"), @QueryHint, @QueryHint(name = \"BAZ\")}))", cu);
- }
-
- public void testMoveHint2() throws Exception {
- ICompilationUnit cu = this.createTestNamedNativeQueryWithQueryHints();
- JavaResourcePersistentType typeResource = buildJavaTypeResource(cu);
-
- NamedNativeQueriesAnnotation namedQueries = (NamedNativeQueriesAnnotation) typeResource.getSupportingAnnotation(JPA.NAMED_NATIVE_QUERIES);
- NamedNativeQueryAnnotation namedQuery = namedQueries.nestedAnnotations().next();
-
- namedQuery.addHint(0).setName("BAZ");
-
- assertEquals("BAZ", namedQuery.hintAt(0).getName());
- assertEquals("BAR", namedQuery.hintAt(1).getName());
- assertNull(namedQuery.hintAt(2).getName());
- assertEquals(3, namedQuery.hintsSize());
-
- namedQuery.moveHint(0, 2);
-
- assertNull(namedQuery.hintAt(0).getName());
- assertEquals("BAZ", namedQuery.hintAt(1).getName());
- assertEquals("BAR", namedQuery.hintAt(2).getName());
- assertEquals(3, namedQuery.hintsSize());
- assertSourceContains("@NamedNativeQueries(@NamedNativeQuery(hints = {@QueryHint, @QueryHint(name = \"BAZ\"), @QueryHint(name = \"BAR\", value = \"FOO\")}))", cu);
- }
-
- public void testAddNamedNativeQueryCopyExisting() throws Exception {
- ICompilationUnit cu = createTestNamedNativeQuery();
- JavaResourcePersistentType typeResource = buildJavaTypeResource(cu);
-
- NamedNativeQueryAnnotation namedQuery = (NamedNativeQueryAnnotation) typeResource.addSupportingAnnotation(1, JPA.NAMED_NATIVE_QUERY, JPA.NAMED_NATIVE_QUERIES);
- namedQuery.setName("BAR");
- assertSourceContains("@NamedNativeQueries({@NamedNativeQuery(name = \"foo\", query = \"bar\", hints = @QueryHint(name = \"BAR\", value = \"FOO\"), resultClass = Foo.class, resultSetMapping = \"mapping\"),@NamedNativeQuery(name = \"BAR\")})", cu);
-
- assertNull(typeResource.getSupportingAnnotation(JPA.NAMED_NATIVE_QUERY));
- assertNotNull(typeResource.getSupportingAnnotation(JPA.NAMED_NATIVE_QUERIES));
- assertEquals(2, CollectionTools.size(typeResource.supportingAnnotations(JPA.NAMED_NATIVE_QUERY, JPA.NAMED_NATIVE_QUERIES)));
- }
-
- public void testAddNamedNativeQueryToBeginningOfList() throws Exception {
- ICompilationUnit cu = createTestNamedNativeQuery();
- JavaResourcePersistentType typeResource = buildJavaTypeResource(cu);
-
- NamedNativeQueryAnnotation namedQuery = (NamedNativeQueryAnnotation) typeResource.addSupportingAnnotation(1, JPA.NAMED_NATIVE_QUERY, JPA.NAMED_NATIVE_QUERIES);
- namedQuery.setName("BAR");
- assertSourceContains("@NamedNativeQueries({@NamedNativeQuery(name = \"foo\", query = \"bar\", hints = @QueryHint(name = \"BAR\", value = \"FOO\"), resultClass = Foo.class, resultSetMapping = \"mapping\"),@NamedNativeQuery(name = \"BAR\")})", cu);
-
- namedQuery = (NamedNativeQueryAnnotation) typeResource.addSupportingAnnotation(0, JPA.NAMED_NATIVE_QUERY, JPA.NAMED_NATIVE_QUERIES);
- namedQuery.setName("BAZ");
- assertSourceContains("@NamedNativeQueries({@NamedNativeQuery(name = \"BAZ\"),@NamedNativeQuery(name = \"foo\", query = \"bar\", hints = @QueryHint(name = \"BAR\", value = \"FOO\"), resultClass = Foo.class, resultSetMapping = \"mapping\"), @NamedNativeQuery(name = \"BAR\")})", cu);
-
- Iterator<NestableAnnotation> namedQueries = typeResource.supportingAnnotations(JPA.NAMED_NATIVE_QUERY, JPA.NAMED_NATIVE_QUERIES);
- assertEquals("BAZ", ((NamedNativeQueryAnnotation) namedQueries.next()).getName());
- assertEquals("foo", ((NamedNativeQueryAnnotation) namedQueries.next()).getName());
- assertEquals("BAR", ((NamedNativeQueryAnnotation) namedQueries.next()).getName());
-
- assertNull(typeResource.getSupportingAnnotation(JPA.NAMED_NATIVE_QUERY));
- assertNotNull(typeResource.getSupportingAnnotation(JPA.NAMED_NATIVE_QUERIES));
- assertEquals(3, CollectionTools.size(typeResource.supportingAnnotations(JPA.NAMED_NATIVE_QUERY, JPA.NAMED_NATIVE_QUERIES)));
- }
-
- public void testRemoveNamedNativeQueryCopyExisting() throws Exception {
- ICompilationUnit cu = createTestNamedNativeQuery();
- JavaResourcePersistentType typeResource = buildJavaTypeResource(cu);
-
- NamedNativeQueryAnnotation namedQuery = (NamedNativeQueryAnnotation) typeResource.addSupportingAnnotation(1, JPA.NAMED_NATIVE_QUERY, JPA.NAMED_NATIVE_QUERIES);
- namedQuery.setName("BAR");
- assertSourceContains("@NamedNativeQueries({@NamedNativeQuery(name = \"foo\", query = \"bar\", hints = @QueryHint(name = \"BAR\", value = \"FOO\"), resultClass = Foo.class, resultSetMapping = \"mapping\"),@NamedNativeQuery(name = \"BAR\")})", cu);
-
- typeResource.removeSupportingAnnotation(1, JPA.NAMED_NATIVE_QUERY, JPA.NAMED_NATIVE_QUERIES);
- assertSourceContains("@NamedNativeQuery(name = \"foo\", query = \"bar\", hints = @QueryHint(name = \"BAR\", value = \"FOO\"), resultClass = Foo.class, resultSetMapping = \"mapping\")", cu);
- }
-}
diff --git a/jpa/tests/org.eclipse.jpt.core.tests/src/org/eclipse/jpt/core/tests/internal/resource/java/NamedNativeQueryTests.java b/jpa/tests/org.eclipse.jpt.core.tests/src/org/eclipse/jpt/core/tests/internal/resource/java/NamedNativeQueryTests.java
deleted file mode 100644
index 79b0fe3d3b..0000000000
--- a/jpa/tests/org.eclipse.jpt.core.tests/src/org/eclipse/jpt/core/tests/internal/resource/java/NamedNativeQueryTests.java
+++ /dev/null
@@ -1,341 +0,0 @@
-/*******************************************************************************
- * Copyright (c) 2007, 2009 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.
- *
- * Contributors:
- * Oracle - initial API and implementation
- ******************************************************************************/
-package org.eclipse.jpt.core.tests.internal.resource.java;
-
-import java.util.Iterator;
-import org.eclipse.jdt.core.ICompilationUnit;
-import org.eclipse.jpt.core.resource.java.JPA;
-import org.eclipse.jpt.core.resource.java.JavaResourcePersistentType;
-import org.eclipse.jpt.core.resource.java.NamedNativeQueryAnnotation;
-import org.eclipse.jpt.utility.internal.iterators.ArrayIterator;
-
-@SuppressWarnings("nls")
-public class NamedNativeQueryTests extends JavaResourceModelTestCase {
-
- private static final String QUERY_NAME = "myQuery";
- private static final String QUERY_QUERY = "SELECT name FROM Employee";
- private static final String QUERY_RESULT_CLASS = "Result";
- private static final String QUERY_RESULT_SET_MAPPING = "resultSetMapping";
-
- public NamedNativeQueryTests(String name) {
- super(name);
- }
-
- private ICompilationUnit createTestNamedNativeQuery() throws Exception {
- return this.createTestType(new DefaultAnnotationWriter() {
- @Override
- public Iterator<String> imports() {
- return new ArrayIterator<String>(JPA.NAMED_NATIVE_QUERY);
- }
- @Override
- public void appendTypeAnnotationTo(StringBuilder sb) {
- sb.append("@NamedNativeQuery");
- }
- });
- }
-
- private ICompilationUnit createTestNamedNativeQueryWithName() throws Exception {
- return createTestNamedNativeQueryWithStringElement("name", QUERY_NAME);
- }
-
- private ICompilationUnit createTestNamedNativeQueryWithQuery() throws Exception {
- return createTestNamedNativeQueryWithStringElement("query", QUERY_QUERY);
- }
-
- private ICompilationUnit createTestNamedNativeQueryWithResultSetMapping() throws Exception {
- return createTestNamedNativeQueryWithStringElement("resultSetMapping", QUERY_RESULT_SET_MAPPING);
- }
-
-
- private ICompilationUnit createTestNamedNativeQueryWithStringElement(final String elementName, final String value) throws Exception {
- return this.createTestType(new DefaultAnnotationWriter() {
- @Override
- public Iterator<String> imports() {
- return new ArrayIterator<String>(JPA.NAMED_NATIVE_QUERY);
- }
- @Override
- public void appendTypeAnnotationTo(StringBuilder sb) {
- sb.append("@NamedNativeQuery(" + elementName + " = \"" + value + "\")");
- }
- });
- }
-
- private ICompilationUnit createTestNamedNativeQueryWithResultClass() throws Exception {
- return this.createTestType(new DefaultAnnotationWriter() {
- @Override
- public Iterator<String> imports() {
- return new ArrayIterator<String>(JPA.NAMED_NATIVE_QUERY);
- }
- @Override
- public void appendTypeAnnotationTo(StringBuilder sb) {
- sb.append("@NamedNativeQuery(resultClass = " + QUERY_RESULT_CLASS + ".class)");
- }
- });
- }
-
- private ICompilationUnit createTestNamedNativeQueryWithQueryHints() throws Exception {
- return this.createTestType(new DefaultAnnotationWriter() {
- @Override
- public Iterator<String> imports() {
- return new ArrayIterator<String>(JPA.NAMED_NATIVE_QUERY, JPA.QUERY_HINT);
- }
- @Override
- public void appendTypeAnnotationTo(StringBuilder sb) {
- sb.append("@NamedNativeQuery(hints = {@QueryHint(name = \"BAR\", value = \"FOO\"), @QueryHint})");
- }
- });
- }
-
- public void testNamedNativeQuery() throws Exception {
- ICompilationUnit cu = this.createTestNamedNativeQuery();
- JavaResourcePersistentType typeResource = buildJavaTypeResource(cu);
-
- NamedNativeQueryAnnotation namedQuery = (NamedNativeQueryAnnotation) typeResource.getSupportingAnnotation(JPA.NAMED_NATIVE_QUERY);
- assertNotNull(namedQuery);
- }
-
- public void testGetName() throws Exception {
- ICompilationUnit cu = this.createTestNamedNativeQueryWithName();
- JavaResourcePersistentType typeResource = buildJavaTypeResource(cu);
-
- NamedNativeQueryAnnotation namedQuery = (NamedNativeQueryAnnotation) typeResource.getSupportingAnnotation(JPA.NAMED_NATIVE_QUERY);
- assertEquals(QUERY_NAME, namedQuery.getName());
- }
-
- public void testSetName() throws Exception {
- ICompilationUnit cu = this.createTestNamedNativeQueryWithName();
- JavaResourcePersistentType typeResource = buildJavaTypeResource(cu);
-
- NamedNativeQueryAnnotation namedQuery = (NamedNativeQueryAnnotation) typeResource.getSupportingAnnotation(JPA.NAMED_NATIVE_QUERY);
- assertEquals(QUERY_NAME, namedQuery.getName());
-
- namedQuery.setName("foo");
- assertEquals("foo", namedQuery.getName());
-
- assertSourceContains("@NamedNativeQuery(name = \"foo\")", cu);
-
- namedQuery.setName(null);
- assertNull(namedQuery.getName());
-
- assertSourceDoesNotContain("@NamedNativeQuery", cu);
- }
-
- public void testGetQuery() throws Exception {
- ICompilationUnit cu = this.createTestNamedNativeQueryWithQuery();
- JavaResourcePersistentType typeResource = buildJavaTypeResource(cu);
-
- NamedNativeQueryAnnotation namedQuery = (NamedNativeQueryAnnotation) typeResource.getSupportingAnnotation(JPA.NAMED_NATIVE_QUERY);
- assertEquals(QUERY_QUERY, namedQuery.getQuery());
- }
-
- public void testSetQuery() throws Exception {
- ICompilationUnit cu = this.createTestNamedNativeQueryWithQuery();
- JavaResourcePersistentType typeResource = buildJavaTypeResource(cu);
-
- NamedNativeQueryAnnotation namedQuery = (NamedNativeQueryAnnotation) typeResource.getSupportingAnnotation(JPA.NAMED_NATIVE_QUERY);
- assertEquals(QUERY_QUERY, namedQuery.getQuery());
-
- namedQuery.setQuery("foo");
- assertEquals("foo", namedQuery.getQuery());
-
- assertSourceContains("@NamedNativeQuery(query = \"foo\")", cu);
-
- namedQuery.setQuery(null);
- assertNull(namedQuery.getQuery());
-
- assertSourceDoesNotContain("@NamedNativeQuery", cu);
- }
-
- public void testGetResultClass() throws Exception {
- ICompilationUnit cu = this.createTestNamedNativeQueryWithResultClass();
- JavaResourcePersistentType typeResource = buildJavaTypeResource(cu);
-
- NamedNativeQueryAnnotation namedQuery = (NamedNativeQueryAnnotation) typeResource.getSupportingAnnotation(JPA.NAMED_NATIVE_QUERY);
- assertEquals(QUERY_RESULT_CLASS, namedQuery.getResultClass());
- }
-
- public void testSetResultClass() throws Exception {
- ICompilationUnit cu = this.createTestNamedNativeQueryWithResultClass();
- JavaResourcePersistentType typeResource = buildJavaTypeResource(cu);
-
- NamedNativeQueryAnnotation namedQuery = (NamedNativeQueryAnnotation) typeResource.getSupportingAnnotation(JPA.NAMED_NATIVE_QUERY);
- assertEquals(QUERY_RESULT_CLASS, namedQuery.getResultClass());
-
- namedQuery.setResultClass("foo");
- assertEquals("foo", namedQuery.getResultClass());
-
- assertSourceContains("@NamedNativeQuery(resultClass = foo.class)", cu);
-
- namedQuery.setResultClass(null);
- assertNull(namedQuery.getResultClass());
-
- assertSourceDoesNotContain("@NamedNativeQuery", cu);
- }
-
- public void testGetFullyQualifiedClass() throws Exception {
- ICompilationUnit cu = this.createTestNamedNativeQueryWithResultClass();
- JavaResourcePersistentType typeResource = buildJavaTypeResource(cu);
-
- NamedNativeQueryAnnotation namedQuery = (NamedNativeQueryAnnotation) typeResource.getSupportingAnnotation(JPA.NAMED_NATIVE_QUERY);
- assertNotNull(namedQuery.getResultClass());
- assertEquals("Result", namedQuery.getFullyQualifiedResultClassName());//bug 196200 changed this
-
- namedQuery.setResultClass(TYPE_NAME);
-
- assertEquals(FULLY_QUALIFIED_TYPE_NAME, namedQuery.getFullyQualifiedResultClassName());
- assertSourceContains("@NamedNativeQuery(resultClass = " + TYPE_NAME + ".class)", cu);
- }
-
- public void testGetResultSetMapping() throws Exception {
- ICompilationUnit cu = this.createTestNamedNativeQueryWithResultSetMapping();
- JavaResourcePersistentType typeResource = buildJavaTypeResource(cu);
-
- NamedNativeQueryAnnotation namedQuery = (NamedNativeQueryAnnotation) typeResource.getSupportingAnnotation(JPA.NAMED_NATIVE_QUERY);
- assertEquals(QUERY_RESULT_SET_MAPPING, namedQuery.getResultSetMapping());
- }
-
- public void testSetResultSetMapping() throws Exception {
- ICompilationUnit cu = this.createTestNamedNativeQueryWithResultSetMapping();
- JavaResourcePersistentType typeResource = buildJavaTypeResource(cu);
-
- NamedNativeQueryAnnotation namedQuery = (NamedNativeQueryAnnotation) typeResource.getSupportingAnnotation(JPA.NAMED_NATIVE_QUERY);
- assertEquals(QUERY_RESULT_SET_MAPPING, namedQuery.getResultSetMapping());
-
- namedQuery.setResultSetMapping("foo");
- assertEquals("foo", namedQuery.getResultSetMapping());
-
- assertSourceContains("@NamedNativeQuery(resultSetMapping = \"foo\")", cu);
-
- namedQuery.setResultSetMapping(null);
- assertNull(namedQuery.getResultSetMapping());
-
- assertSourceDoesNotContain("@NamedNativeQuery", cu);
- }
-
- public void testHints() throws Exception {
- ICompilationUnit cu = this.createTestNamedNativeQuery();
- JavaResourcePersistentType typeResource = buildJavaTypeResource(cu);
-
- NamedNativeQueryAnnotation namedQuery = (NamedNativeQueryAnnotation) typeResource.getSupportingAnnotation(JPA.NAMED_NATIVE_QUERY);
-
- assertEquals(0, namedQuery.hintsSize());
- }
-
- public void testHints2() throws Exception {
- ICompilationUnit cu = this.createTestNamedNativeQuery();
- JavaResourcePersistentType typeResource = buildJavaTypeResource(cu);
-
- NamedNativeQueryAnnotation namedQuery = (NamedNativeQueryAnnotation) typeResource.getSupportingAnnotation(JPA.NAMED_NATIVE_QUERY);
-
- namedQuery.addHint(0);
- namedQuery.addHint(1);
-
- assertEquals(2, namedQuery.hintsSize());
- }
-
- public void testHints3() throws Exception {
- ICompilationUnit cu = this.createTestNamedNativeQueryWithQueryHints();
- JavaResourcePersistentType typeResource = buildJavaTypeResource(cu);
-
- NamedNativeQueryAnnotation namedQuery = (NamedNativeQueryAnnotation) typeResource.getSupportingAnnotation(JPA.NAMED_NATIVE_QUERY);
-
- assertEquals(2, namedQuery.hintsSize());
- }
-
-
- public void testAddHint() throws Exception {
- ICompilationUnit cu = this.createTestNamedNativeQuery();
- JavaResourcePersistentType typeResource = buildJavaTypeResource(cu);
-
- NamedNativeQueryAnnotation namedQuery = (NamedNativeQueryAnnotation) typeResource.getSupportingAnnotation(JPA.NAMED_NATIVE_QUERY);
-
- namedQuery.addHint(0).setName("FOO");
- namedQuery.addHint(1);
- namedQuery.addHint(0).setName("BAR");
-
- assertEquals("BAR", namedQuery.hintAt(0).getName());
- assertEquals("FOO", namedQuery.hintAt(1).getName());
- assertNull(namedQuery.hintAt(2).getName());
- assertSourceContains("@NamedNativeQuery(hints = {@QueryHint(name = \"BAR\"),@QueryHint(name = \"FOO\"), @QueryHint})", cu);
- }
-
- public void testRemoveHint() throws Exception {
- ICompilationUnit cu = this.createTestNamedNativeQueryWithQueryHints();
- JavaResourcePersistentType typeResource = buildJavaTypeResource(cu);
-
- NamedNativeQueryAnnotation namedQuery = (NamedNativeQueryAnnotation) typeResource.getSupportingAnnotation(JPA.NAMED_NATIVE_QUERY);
- namedQuery.addHint(0).setName("BAZ");
-
- assertEquals("BAZ", namedQuery.hintAt(0).getName());
- assertEquals("BAR", namedQuery.hintAt(1).getName());
- assertNull(namedQuery.hintAt(2).getName());
- assertEquals(3, namedQuery.hintsSize());
-
- namedQuery.removeHint(2);
- assertEquals("BAZ", namedQuery.hintAt(0).getName());
- assertEquals("BAR", namedQuery.hintAt(1).getName());
- assertEquals(2, namedQuery.hintsSize());
- assertSourceContains("@NamedNativeQuery(hints = {@QueryHint(name = \"BAZ\"), @QueryHint(name = \"BAR\", value = \"FOO\")})", cu);
-
- namedQuery.removeHint(0);
- assertEquals("BAR", namedQuery.hintAt(0).getName());
- assertEquals(1, namedQuery.hintsSize());
- assertSourceContains("@NamedNativeQuery(hints = @QueryHint(name = \"BAR\", value = \"FOO\"))", cu);
-
-
- namedQuery.removeHint(0);
- assertEquals(0, namedQuery.hintsSize());
- assertSourceDoesNotContain("@NamedNativeQuery", cu);
- }
-
- public void testMoveHint() throws Exception {
- ICompilationUnit cu = this.createTestNamedNativeQueryWithQueryHints();
- JavaResourcePersistentType typeResource = buildJavaTypeResource(cu);
-
- NamedNativeQueryAnnotation namedQuery = (NamedNativeQueryAnnotation) typeResource.getSupportingAnnotation(JPA.NAMED_NATIVE_QUERY);
-
- namedQuery.addHint(0).setName("BAZ");
-
- assertEquals("BAZ", namedQuery.hintAt(0).getName());
- assertEquals("BAR", namedQuery.hintAt(1).getName());
- assertNull(namedQuery.hintAt(2).getName());
- assertEquals(3, namedQuery.hintsSize());
-
- namedQuery.moveHint(2, 0);
-
- assertEquals("BAR", namedQuery.hintAt(0).getName());
- assertNull(namedQuery.hintAt(1).getName());
- assertEquals("BAZ", namedQuery.hintAt(2).getName());
- assertEquals(3, namedQuery.hintsSize());
- assertSourceContains("@NamedNativeQuery(hints = {@QueryHint(name = \"BAR\", value = \"FOO\"), @QueryHint, @QueryHint(name = \"BAZ\")})", cu);
- }
-
- public void testMoveHint2() throws Exception {
- ICompilationUnit cu = this.createTestNamedNativeQueryWithQueryHints();
- JavaResourcePersistentType typeResource = buildJavaTypeResource(cu);
-
- NamedNativeQueryAnnotation namedQuery = (NamedNativeQueryAnnotation) typeResource.getSupportingAnnotation(JPA.NAMED_NATIVE_QUERY);
- namedQuery.addHint(0).setName("BAZ");
-
- assertEquals("BAZ", namedQuery.hintAt(0).getName());
- assertEquals("BAR", namedQuery.hintAt(1).getName());
- assertNull(namedQuery.hintAt(2).getName());
- assertEquals(3, namedQuery.hintsSize());
-
- namedQuery.moveHint(0, 2);
-
- assertNull(namedQuery.hintAt(0).getName());
- assertEquals("BAZ", namedQuery.hintAt(1).getName());
- assertEquals("BAR", namedQuery.hintAt(2).getName());
- assertEquals(3, namedQuery.hintsSize());
- assertSourceContains("@NamedNativeQuery(hints = {@QueryHint, @QueryHint(name = \"BAZ\"), @QueryHint(name = \"BAR\", value = \"FOO\")})", cu);
- }
-
-}
diff --git a/jpa/tests/org.eclipse.jpt.core.tests/src/org/eclipse/jpt/core/tests/internal/resource/java/NamedQueriesTests.java b/jpa/tests/org.eclipse.jpt.core.tests/src/org/eclipse/jpt/core/tests/internal/resource/java/NamedQueriesTests.java
deleted file mode 100644
index 20796246b3..0000000000
--- a/jpa/tests/org.eclipse.jpt.core.tests/src/org/eclipse/jpt/core/tests/internal/resource/java/NamedQueriesTests.java
+++ /dev/null
@@ -1,331 +0,0 @@
-/*******************************************************************************
- * Copyright (c) 2007, 2009 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.
- *
- * Contributors:
- * Oracle - initial API and implementation
- ******************************************************************************/
-package org.eclipse.jpt.core.tests.internal.resource.java;
-
-import java.util.Iterator;
-
-import org.eclipse.jdt.core.ICompilationUnit;
-import org.eclipse.jpt.core.resource.java.JPA;
-import org.eclipse.jpt.core.resource.java.JavaResourcePersistentType;
-import org.eclipse.jpt.core.resource.java.NamedQueriesAnnotation;
-import org.eclipse.jpt.core.resource.java.NamedQueryAnnotation;
-import org.eclipse.jpt.core.resource.java.NestableAnnotation;
-import org.eclipse.jpt.utility.internal.CollectionTools;
-import org.eclipse.jpt.utility.internal.iterators.ArrayIterator;
-
-@SuppressWarnings("nls")
-public class NamedQueriesTests extends JavaResourceModelTestCase {
-
- private static final String QUERY_NAME = "myQuery";
- private static final String QUERY_QUERY = "SELECT name FROM Employee";
-
- public NamedQueriesTests(String name) {
- super(name);
- }
-
- private ICompilationUnit createTestNamedQueries() throws Exception {
- return this.createTestType(new DefaultAnnotationWriter() {
- @Override
- public Iterator<String> imports() {
- return new ArrayIterator<String>(JPA.NAMED_QUERIES, JPA.NAMED_QUERY);
- }
- @Override
- public void appendTypeAnnotationTo(StringBuilder sb) {
- sb.append("@NamedQueries(@NamedQuery)");
- }
- });
- }
-
- private ICompilationUnit createTestNamedQueryWithName() throws Exception {
- return createTestNamedQueryWithStringElement("name", QUERY_NAME);
- }
-
- private ICompilationUnit createTestNamedQueryWithQuery() throws Exception {
- return createTestNamedQueryWithStringElement("query", QUERY_QUERY);
- }
-
- private ICompilationUnit createTestNamedQueryWithStringElement(final String elementName, final String value) throws Exception {
- return this.createTestType(new DefaultAnnotationWriter() {
- @Override
- public Iterator<String> imports() {
- return new ArrayIterator<String>(JPA.NAMED_QUERIES, JPA.NAMED_QUERY);
- }
- @Override
- public void appendTypeAnnotationTo(StringBuilder sb) {
- sb.append("@NamedQueries(@NamedQuery(" + elementName + " = \"" + value + "\"))");
- }
- });
- }
-
- private ICompilationUnit createTestNamedQueryWithQueryHints() throws Exception {
- return this.createTestType(new DefaultAnnotationWriter() {
- @Override
- public Iterator<String> imports() {
- return new ArrayIterator<String>(JPA.NAMED_QUERIES, JPA.NAMED_QUERY, JPA.QUERY_HINT);
- }
- @Override
- public void appendTypeAnnotationTo(StringBuilder sb) {
- sb.append("@NamedQueries(@NamedQuery(hints = {@QueryHint(name = \"BAR\", value = \"FOO\"), @QueryHint}))");
- }
- });
- }
-
-
- private ICompilationUnit createTestNamedQuery() throws Exception {
- return this.createTestType(new DefaultAnnotationWriter() {
- @Override
- public Iterator<String> imports() {
- return new ArrayIterator<String>(JPA.NAMED_QUERY, JPA.QUERY_HINT);
- }
- @Override
- public void appendTypeAnnotationTo(StringBuilder sb) {
- sb.append("@NamedQuery(name = \"foo\", query = \"bar\", hints = @QueryHint(name = \"BAR\", value = \"FOO\"))");
- }
- });
- }
-
- public void testNamedQuery() throws Exception {
- ICompilationUnit cu = this.createTestNamedQueries();
- JavaResourcePersistentType typeResource = buildJavaTypeResource(cu);
-
- NamedQueriesAnnotation namedQueries = (NamedQueriesAnnotation) typeResource.getSupportingAnnotation(JPA.NAMED_QUERIES);
- NamedQueryAnnotation namedQuery = namedQueries.nestedAnnotations().next();
- assertNotNull(namedQuery);
- }
-
- public void testGetName() throws Exception {
- ICompilationUnit cu = this.createTestNamedQueryWithName();
- JavaResourcePersistentType typeResource = buildJavaTypeResource(cu);
-
- NamedQueriesAnnotation namedQueries = (NamedQueriesAnnotation) typeResource.getSupportingAnnotation(JPA.NAMED_QUERIES);
- NamedQueryAnnotation namedQuery = namedQueries.nestedAnnotations().next();
- assertEquals(QUERY_NAME, namedQuery.getName());
- }
-
- public void testSetName() throws Exception {
- ICompilationUnit cu = this.createTestNamedQueryWithName();
- JavaResourcePersistentType typeResource = buildJavaTypeResource(cu);
-
- NamedQueriesAnnotation namedQueries = (NamedQueriesAnnotation) typeResource.getSupportingAnnotation(JPA.NAMED_QUERIES);
- NamedQueryAnnotation namedQuery = namedQueries.nestedAnnotations().next();
- assertEquals(QUERY_NAME, namedQuery.getName());
-
- namedQuery.setName("foo");
- assertEquals("foo", namedQuery.getName());
-
- assertSourceContains("@NamedQuery(name = \"foo\")", cu);
-
- namedQuery.setName(null);
- assertNull(namedQuery.getName());
-
- assertSourceDoesNotContain("@NamedQuery", cu);
- }
-
- public void testGetQuery() throws Exception {
- ICompilationUnit cu = this.createTestNamedQueryWithQuery();
- JavaResourcePersistentType typeResource = buildJavaTypeResource(cu);
-
- NamedQueriesAnnotation namedQueries = (NamedQueriesAnnotation) typeResource.getSupportingAnnotation(JPA.NAMED_QUERIES);
- NamedQueryAnnotation namedQuery = namedQueries.nestedAnnotations().next();
- assertEquals(QUERY_QUERY, namedQuery.getQuery());
- }
-
- public void testSetQuery() throws Exception {
- ICompilationUnit cu = this.createTestNamedQueryWithQuery();
- JavaResourcePersistentType typeResource = buildJavaTypeResource(cu);
-
- NamedQueriesAnnotation namedQueries = (NamedQueriesAnnotation) typeResource.getSupportingAnnotation(JPA.NAMED_QUERIES);
- NamedQueryAnnotation namedQuery = namedQueries.nestedAnnotations().next();
- assertEquals(QUERY_QUERY, namedQuery.getQuery());
-
- namedQuery.setQuery("foo");
- assertEquals("foo", namedQuery.getQuery());
-
- assertSourceContains("@NamedQuery(query = \"foo\")", cu);
-
- namedQuery.setQuery(null);
- assertNull(namedQuery.getQuery());
-
- assertSourceDoesNotContain("@NamedQuery", cu);
- }
-
- public void testHints() throws Exception {
- ICompilationUnit cu = this.createTestNamedQueries();
- JavaResourcePersistentType typeResource = buildJavaTypeResource(cu);
-
- NamedQueriesAnnotation namedQueries = (NamedQueriesAnnotation) typeResource.getSupportingAnnotation(JPA.NAMED_QUERIES);
- NamedQueryAnnotation namedQuery = namedQueries.nestedAnnotations().next();
-
- assertEquals(0, namedQuery.hintsSize());
- }
-
- public void testHints2() throws Exception {
- ICompilationUnit cu = this.createTestNamedQueries();
- JavaResourcePersistentType typeResource = buildJavaTypeResource(cu);
-
- NamedQueriesAnnotation namedQueries = (NamedQueriesAnnotation) typeResource.getSupportingAnnotation(JPA.NAMED_QUERIES);
- NamedQueryAnnotation namedQuery = namedQueries.nestedAnnotations().next();
-
- namedQuery.addHint(0);
- namedQuery.addHint(1);
-
- assertEquals(2, namedQuery.hintsSize());
- }
-
- public void testHints3() throws Exception {
- ICompilationUnit cu = this.createTestNamedQueryWithQueryHints();
- JavaResourcePersistentType typeResource = buildJavaTypeResource(cu);
-
- NamedQueriesAnnotation namedQueries = (NamedQueriesAnnotation) typeResource.getSupportingAnnotation(JPA.NAMED_QUERIES);
- NamedQueryAnnotation namedQuery = namedQueries.nestedAnnotations().next();
-
- assertEquals(2, namedQuery.hintsSize());
- }
-
- public void testAddHint() throws Exception {
- ICompilationUnit cu = this.createTestNamedQueries();
- JavaResourcePersistentType typeResource = buildJavaTypeResource(cu);
-
- NamedQueriesAnnotation namedQueries = (NamedQueriesAnnotation) typeResource.getSupportingAnnotation(JPA.NAMED_QUERIES);
- NamedQueryAnnotation namedQuery = namedQueries.nestedAnnotations().next();
-
- namedQuery.addHint(0).setName("FOO");
- namedQuery.addHint(1);
- namedQuery.addHint(0).setName("BAR");
-
- assertEquals("BAR", namedQuery.hintAt(0).getName());
- assertEquals("FOO", namedQuery.hintAt(1).getName());
- assertNull(namedQuery.hintAt(2).getName());
-
- assertSourceContains("@NamedQuery(hints = {@QueryHint(name = \"BAR\"),@QueryHint(name = \"FOO\"), @QueryHint})", cu);
- }
-
- public void testRemoveHint() throws Exception {
- ICompilationUnit cu = this.createTestNamedQueryWithQueryHints();
- JavaResourcePersistentType typeResource = buildJavaTypeResource(cu);
-
- NamedQueriesAnnotation namedQueries = (NamedQueriesAnnotation) typeResource.getSupportingAnnotation(JPA.NAMED_QUERIES);
- NamedQueryAnnotation namedQuery = namedQueries.nestedAnnotations().next();
- namedQuery.addHint(0).setName("BAZ");
-
- assertEquals("BAZ", namedQuery.hintAt(0).getName());
- assertEquals("BAR", namedQuery.hintAt(1).getName());
- assertNull(namedQuery.hintAt(2).getName());
- assertEquals(3, namedQuery.hintsSize());
-
- namedQuery.removeHint(2);
- assertEquals("BAZ", namedQuery.hintAt(0).getName());
- assertEquals("BAR", namedQuery.hintAt(1).getName());
- assertEquals(2, namedQuery.hintsSize());
- assertSourceContains("@NamedQueries(@NamedQuery(hints = {@QueryHint(name = \"BAZ\"), @QueryHint(name = \"BAR\", value = \"FOO\")}))", cu);
-
- namedQuery.removeHint(0);
- assertEquals("BAR", namedQuery.hintAt(0).getName());
- assertEquals(1, namedQuery.hintsSize());
- assertSourceContains("@NamedQueries(@NamedQuery(hints = @QueryHint(name = \"BAR\", value = \"FOO\")))", cu);
-
- namedQuery.removeHint(0);
- assertEquals(0, namedQuery.hintsSize());
- assertSourceDoesNotContain("@NamedQueries", cu);
- }
-
- public void testMoveHint() throws Exception {
- ICompilationUnit cu = this.createTestNamedQueryWithQueryHints();
- JavaResourcePersistentType typeResource = buildJavaTypeResource(cu);
-
- NamedQueriesAnnotation namedQueries = (NamedQueriesAnnotation) typeResource.getSupportingAnnotation(JPA.NAMED_QUERIES);
- NamedQueryAnnotation namedQuery = namedQueries.nestedAnnotations().next();
- namedQuery.addHint(0).setName("BAZ");
-
- assertEquals("BAZ", namedQuery.hintAt(0).getName());
- assertEquals("BAR", namedQuery.hintAt(1).getName());
- assertNull(namedQuery.hintAt(2).getName());
- assertEquals(3, namedQuery.hintsSize());
-
- namedQuery.moveHint(2, 0);
-
- assertEquals("BAR", namedQuery.hintAt(0).getName());
- assertNull(namedQuery.hintAt(1).getName());
- assertEquals("BAZ", namedQuery.hintAt(2).getName());
- assertEquals(3, namedQuery.hintsSize());
- assertSourceContains("@NamedQueries(@NamedQuery(hints = {@QueryHint(name = \"BAR\", value = \"FOO\"), @QueryHint, @QueryHint(name = \"BAZ\")}))", cu);
- }
-
- public void testMoveHint2() throws Exception {
- ICompilationUnit cu = this.createTestNamedQueryWithQueryHints();
- JavaResourcePersistentType typeResource = buildJavaTypeResource(cu);
-
- NamedQueriesAnnotation namedQueries = (NamedQueriesAnnotation) typeResource.getSupportingAnnotation(JPA.NAMED_QUERIES);
- NamedQueryAnnotation namedQuery = namedQueries.nestedAnnotations().next();
- namedQuery.addHint(0).setName("BAZ");
-
- assertEquals("BAZ", namedQuery.hintAt(0).getName());
- assertEquals("BAR", namedQuery.hintAt(1).getName());
- assertNull(namedQuery.hintAt(2).getName());
- assertEquals(3, namedQuery.hintsSize());
-
- namedQuery.moveHint(0, 2);
-
- assertNull(namedQuery.hintAt(0).getName());
- assertEquals("BAZ", namedQuery.hintAt(1).getName());
- assertEquals("BAR", namedQuery.hintAt(2).getName());
- assertEquals(3, namedQuery.hintsSize());
- assertSourceContains("@NamedQueries(@NamedQuery(hints = {@QueryHint, @QueryHint(name = \"BAZ\"), @QueryHint(name = \"BAR\", value = \"FOO\")}))", cu);
- }
-
- public void testAddNamedQueryCopyExisting() throws Exception {
- ICompilationUnit cu = createTestNamedQuery();
- JavaResourcePersistentType typeResource = buildJavaTypeResource(cu);
-
- NamedQueryAnnotation namedQuery = (NamedQueryAnnotation) typeResource.addSupportingAnnotation(1, JPA.NAMED_QUERY, JPA.NAMED_QUERIES);
- namedQuery.setName("BAR");
- assertSourceContains("@NamedQueries({@NamedQuery(name = \"foo\", query = \"bar\", hints = @QueryHint(name = \"BAR\", value = \"FOO\")),@NamedQuery(name = \"BAR\")})", cu);
-
- assertNull(typeResource.getSupportingAnnotation(JPA.NAMED_QUERY));
- assertNotNull(typeResource.getSupportingAnnotation(JPA.NAMED_QUERIES));
- assertEquals(2, CollectionTools.size(typeResource.supportingAnnotations(JPA.NAMED_QUERY, JPA.NAMED_QUERIES)));
- }
-
- public void testAddNamedQueryToBeginningOfList() throws Exception {
- ICompilationUnit cu = createTestNamedQuery();
- JavaResourcePersistentType typeResource = buildJavaTypeResource(cu);
-
- NamedQueryAnnotation namedQuery = (NamedQueryAnnotation) typeResource.addSupportingAnnotation(1, JPA.NAMED_QUERY, JPA.NAMED_QUERIES);
- namedQuery.setName("BAR");
- assertSourceContains("@NamedQueries({@NamedQuery(name = \"foo\", query = \"bar\", hints = @QueryHint(name = \"BAR\", value = \"FOO\")),@NamedQuery(name = \"BAR\")})", cu);
-
-
- namedQuery = (NamedQueryAnnotation) typeResource.addSupportingAnnotation(0, JPA.NAMED_QUERY, JPA.NAMED_QUERIES);
- namedQuery.setName("BAZ");
- assertSourceContains("@NamedQueries({@NamedQuery(name = \"BAZ\"),@NamedQuery(name = \"foo\", query = \"bar\", hints = @QueryHint(name = \"BAR\", value = \"FOO\")), @NamedQuery(name = \"BAR\")})", cu);
-
- Iterator<NestableAnnotation> namedQueries = typeResource.supportingAnnotations(JPA.NAMED_QUERY, JPA.NAMED_QUERIES);
- assertEquals("BAZ", ((NamedQueryAnnotation) namedQueries.next()).getName());
- assertEquals("foo", ((NamedQueryAnnotation) namedQueries.next()).getName());
- assertEquals("BAR", ((NamedQueryAnnotation) namedQueries.next()).getName());
-
- assertNull(typeResource.getSupportingAnnotation(JPA.NAMED_QUERY));
- assertNotNull(typeResource.getSupportingAnnotation(JPA.NAMED_QUERIES));
- assertEquals(3, CollectionTools.size(typeResource.supportingAnnotations(JPA.NAMED_QUERY, JPA.NAMED_QUERIES)));
- }
-
- public void testRemoveNamedQueryCopyExisting() throws Exception {
- ICompilationUnit cu = createTestNamedQuery();
- JavaResourcePersistentType typeResource = buildJavaTypeResource(cu);
-
- NamedQueryAnnotation namedQuery = (NamedQueryAnnotation) typeResource.addSupportingAnnotation(1, JPA.NAMED_QUERY, JPA.NAMED_QUERIES);
- namedQuery.setName("BAR");
- assertSourceContains("@NamedQueries({@NamedQuery(name = \"foo\", query = \"bar\", hints = @QueryHint(name = \"BAR\", value = \"FOO\")),@NamedQuery(name = \"BAR\")})", cu);
-
- typeResource.removeSupportingAnnotation(1, JPA.NAMED_QUERY, JPA.NAMED_QUERIES);
- assertSourceContains("@NamedQuery(name = \"foo\", query = \"bar\", hints = @QueryHint(name = \"BAR\", value = \"FOO\"))", cu);
- }
-
-}
diff --git a/jpa/tests/org.eclipse.jpt.core.tests/src/org/eclipse/jpt/core/tests/internal/resource/java/NamedQueryTests.java b/jpa/tests/org.eclipse.jpt.core.tests/src/org/eclipse/jpt/core/tests/internal/resource/java/NamedQueryTests.java
deleted file mode 100644
index 520c3c6425..0000000000
--- a/jpa/tests/org.eclipse.jpt.core.tests/src/org/eclipse/jpt/core/tests/internal/resource/java/NamedQueryTests.java
+++ /dev/null
@@ -1,259 +0,0 @@
-/*******************************************************************************
- * Copyright (c) 2007, 2009 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.
- *
- * Contributors:
- * Oracle - initial API and implementation
- ******************************************************************************/
-package org.eclipse.jpt.core.tests.internal.resource.java;
-
-import java.util.Iterator;
-import java.util.ListIterator;
-import org.eclipse.jdt.core.ICompilationUnit;
-import org.eclipse.jpt.core.resource.java.JPA;
-import org.eclipse.jpt.core.resource.java.JavaResourcePersistentType;
-import org.eclipse.jpt.core.resource.java.NamedQueryAnnotation;
-import org.eclipse.jpt.core.resource.java.QueryHintAnnotation;
-import org.eclipse.jpt.utility.internal.iterators.ArrayIterator;
-
-@SuppressWarnings("nls")
-public class NamedQueryTests extends JavaResourceModelTestCase {
-
- private static final String QUERY_NAME = "myQuery";
- private static final String QUERY_QUERY = "SELECT name FROM Employee";
-
- public NamedQueryTests(String name) {
- super(name);
- }
-
- private ICompilationUnit createTestNamedQuery() throws Exception {
- return this.createTestType(new DefaultAnnotationWriter() {
- @Override
- public Iterator<String> imports() {
- return new ArrayIterator<String>(JPA.NAMED_QUERY);
- }
- @Override
- public void appendTypeAnnotationTo(StringBuilder sb) {
- sb.append("@NamedQuery");
- }
- });
- }
-
- private ICompilationUnit createTestNamedQueryWithName() throws Exception {
- return createTestNamedQueryWithStringElement("name", QUERY_NAME);
- }
-
- private ICompilationUnit createTestNamedQueryWithQuery() throws Exception {
- return createTestNamedQueryWithStringElement("query", QUERY_QUERY);
- }
-
- private ICompilationUnit createTestNamedQueryWithStringElement(final String elementName, final String value) throws Exception {
- return this.createTestType(new DefaultAnnotationWriter() {
- @Override
- public Iterator<String> imports() {
- return new ArrayIterator<String>(JPA.NAMED_QUERY);
- }
- @Override
- public void appendTypeAnnotationTo(StringBuilder sb) {
- sb.append("@NamedQuery(" + elementName + " = \"" + value + "\")");
- }
- });
- }
-
- private ICompilationUnit createTestNamedQueryWithQueryHints() throws Exception {
- return this.createTestType(new DefaultAnnotationWriter() {
- @Override
- public Iterator<String> imports() {
- return new ArrayIterator<String>(JPA.NAMED_QUERY, JPA.QUERY_HINT);
- }
- @Override
- public void appendTypeAnnotationTo(StringBuilder sb) {
- sb.append("@NamedQuery(hints = {@QueryHint(name = \"BAR\", value = \"FOO\"), @QueryHint})");
- }
- });
- }
-
- public void testNamedQuery() throws Exception {
- ICompilationUnit cu = this.createTestNamedQuery();
- JavaResourcePersistentType typeResource = buildJavaTypeResource(cu);
-
- NamedQueryAnnotation namedQuery = (NamedQueryAnnotation) typeResource.getSupportingAnnotation(JPA.NAMED_QUERY);
- assertNotNull(namedQuery);
- }
-
- public void testGetName() throws Exception {
- ICompilationUnit cu = this.createTestNamedQueryWithName();
- JavaResourcePersistentType typeResource = buildJavaTypeResource(cu);
-
- NamedQueryAnnotation namedQuery = (NamedQueryAnnotation) typeResource.getSupportingAnnotation(JPA.NAMED_QUERY);
- assertEquals(QUERY_NAME, namedQuery.getName());
- }
-
- public void testSetName() throws Exception {
- ICompilationUnit cu = this.createTestNamedQueryWithName();
- JavaResourcePersistentType typeResource = buildJavaTypeResource(cu);
-
- NamedQueryAnnotation namedQuery = (NamedQueryAnnotation) typeResource.getSupportingAnnotation(JPA.NAMED_QUERY);
- assertEquals(QUERY_NAME, namedQuery.getName());
-
- namedQuery.setName("foo");
- assertEquals("foo", namedQuery.getName());
-
- assertSourceContains("@NamedQuery(name = \"foo\")", cu);
-
- namedQuery.setName(null);
- assertNull(namedQuery.getName());
-
- assertSourceDoesNotContain("@NamedQuery", cu);
- }
-
- public void testGetQuery() throws Exception {
- ICompilationUnit cu = this.createTestNamedQueryWithQuery();
- JavaResourcePersistentType typeResource = buildJavaTypeResource(cu);
-
- NamedQueryAnnotation namedQuery = (NamedQueryAnnotation) typeResource.getSupportingAnnotation(JPA.NAMED_QUERY);
- assertEquals(QUERY_QUERY, namedQuery.getQuery());
- }
-
- public void testSetQuery() throws Exception {
- ICompilationUnit cu = this.createTestNamedQueryWithQuery();
- JavaResourcePersistentType typeResource = buildJavaTypeResource(cu);
-
- NamedQueryAnnotation namedQuery = (NamedQueryAnnotation) typeResource.getSupportingAnnotation(JPA.NAMED_QUERY);
- assertEquals(QUERY_QUERY, namedQuery.getQuery());
-
- namedQuery.setQuery("foo");
- assertEquals("foo", namedQuery.getQuery());
-
- assertSourceContains("@NamedQuery(query = \"foo\")", cu);
-
- namedQuery.setQuery(null);
- assertNull(namedQuery.getQuery());
-
- assertSourceDoesNotContain("@NamedQuery", cu);
- }
-
- public void testHints() throws Exception {
- ICompilationUnit cu = this.createTestNamedQuery();
- JavaResourcePersistentType typeResource = buildJavaTypeResource(cu);
-
- NamedQueryAnnotation namedQuery = (NamedQueryAnnotation) typeResource.getSupportingAnnotation(JPA.NAMED_QUERY);
-
- assertEquals(0, namedQuery.hintsSize());
- }
-
- public void testHints2() throws Exception {
- ICompilationUnit cu = this.createTestNamedQuery();
- JavaResourcePersistentType typeResource = buildJavaTypeResource(cu);
-
- NamedQueryAnnotation namedQuery = (NamedQueryAnnotation) typeResource.getSupportingAnnotation(JPA.NAMED_QUERY);
-
- namedQuery.addHint(0);
- namedQuery.addHint(1);
-
- assertEquals(2, namedQuery.hintsSize());
- }
-
- public void testHints3() throws Exception {
- ICompilationUnit cu = this.createTestNamedQueryWithQueryHints();
- JavaResourcePersistentType typeResource = buildJavaTypeResource(cu);
-
- NamedQueryAnnotation namedQuery = (NamedQueryAnnotation) typeResource.getSupportingAnnotation(JPA.NAMED_QUERY);
-
- assertEquals(2, namedQuery.hintsSize());
-
- ListIterator<QueryHintAnnotation> iterator = namedQuery.hints();
- assertEquals("BAR", iterator.next().getName());
- assertNull(iterator.next().getName());
- }
-
- public void testAddHint() throws Exception {
- ICompilationUnit cu = this.createTestNamedQuery();
- JavaResourcePersistentType typeResource = buildJavaTypeResource(cu);
-
- NamedQueryAnnotation namedQuery = (NamedQueryAnnotation) typeResource.getSupportingAnnotation(JPA.NAMED_QUERY);
-
- namedQuery.addHint(0).setName("FOO");
- namedQuery.addHint(1);
- QueryHintAnnotation queryHint = namedQuery.addHint(0);
- queryHint.setName("BAR");
-
- assertEquals("BAR", namedQuery.hintAt(0).getName());
- assertEquals("FOO", namedQuery.hintAt(1).getName());
- assertNull(namedQuery.hintAt(2).getName());
- assertSourceContains("@NamedQuery(hints = {@QueryHint(name = \"BAR\"),@QueryHint(name = \"FOO\"), @QueryHint})", cu);
- }
-
- public void testRemoveHint() throws Exception {
- ICompilationUnit cu = this.createTestNamedQueryWithQueryHints();
- JavaResourcePersistentType typeResource = buildJavaTypeResource(cu);
-
- NamedQueryAnnotation namedQuery = (NamedQueryAnnotation) typeResource.getSupportingAnnotation(JPA.NAMED_QUERY);
- namedQuery.addHint(0).setName("BAZ");
-
- assertEquals("BAZ", namedQuery.hintAt(0).getName());
- assertEquals("BAR", namedQuery.hintAt(1).getName());
- assertNull(namedQuery.hintAt(2).getName());
- assertEquals(3, namedQuery.hintsSize());
-
- namedQuery.removeHint(2);
- assertEquals("BAZ", namedQuery.hintAt(0).getName());
- assertEquals("BAR", namedQuery.hintAt(1).getName());
- assertEquals(2, namedQuery.hintsSize());
- assertSourceContains("@NamedQuery(hints = {@QueryHint(name = \"BAZ\"), @QueryHint(name = \"BAR\", value = \"FOO\")})", cu);
-
- namedQuery.removeHint(0);
- assertEquals("BAR", namedQuery.hintAt(0).getName());
- assertEquals(1, namedQuery.hintsSize());
- assertSourceContains("@NamedQuery(hints = @QueryHint(name = \"BAR\", value = \"FOO\"))", cu);
-
- namedQuery.removeHint(0);
- assertEquals(0, namedQuery.hintsSize());
- assertSourceDoesNotContain("@NamedQuery", cu);
- }
-
- public void testMoveHint() throws Exception {
- ICompilationUnit cu = this.createTestNamedQueryWithQueryHints();
- JavaResourcePersistentType typeResource = buildJavaTypeResource(cu);
-
- NamedQueryAnnotation namedQuery = (NamedQueryAnnotation) typeResource.getSupportingAnnotation(JPA.NAMED_QUERY);
- namedQuery.addHint(0).setName("BAZ");
-
- assertEquals("BAZ", namedQuery.hintAt(0).getName());
- assertEquals("BAR", namedQuery.hintAt(1).getName());
- assertNull(namedQuery.hintAt(2).getName());
- assertEquals(3, namedQuery.hintsSize());
-
- namedQuery.moveHint(2, 0);
-
- assertEquals("BAR", namedQuery.hintAt(0).getName());
- assertNull(namedQuery.hintAt(1).getName());
- assertEquals("BAZ", namedQuery.hintAt(2).getName());
- assertEquals(3, namedQuery.hintsSize());
- assertSourceContains("@NamedQuery(hints = {@QueryHint(name = \"BAR\", value = \"FOO\"), @QueryHint, @QueryHint(name = \"BAZ\")})", cu);
- }
-
- public void testMoveHint2() throws Exception {
- ICompilationUnit cu = this.createTestNamedQueryWithQueryHints();
- JavaResourcePersistentType typeResource = buildJavaTypeResource(cu);
-
- NamedQueryAnnotation namedQuery = (NamedQueryAnnotation) typeResource.getSupportingAnnotation(JPA.NAMED_QUERY);
- namedQuery.addHint(0).setName("BAZ");
-
- assertEquals("BAZ", namedQuery.hintAt(0).getName());
- assertEquals("BAR", namedQuery.hintAt(1).getName());
- assertNull(namedQuery.hintAt(2).getName());
- assertEquals(3, namedQuery.hintsSize());
-
- namedQuery.moveHint(0, 2);
-
- assertNull(namedQuery.hintAt(0).getName());
- assertEquals("BAZ", namedQuery.hintAt(1).getName());
- assertEquals("BAR", namedQuery.hintAt(2).getName());
- assertEquals(3, namedQuery.hintsSize());
- assertSourceContains("@NamedQuery(hints = {@QueryHint, @QueryHint(name = \"BAZ\"), @QueryHint(name = \"BAR\", value = \"FOO\")})", cu);
- }
-
-}
diff --git a/jpa/tests/org.eclipse.jpt.core.tests/src/org/eclipse/jpt/core/tests/internal/resource/java/OneToManyTests.java b/jpa/tests/org.eclipse.jpt.core.tests/src/org/eclipse/jpt/core/tests/internal/resource/java/OneToManyTests.java
deleted file mode 100644
index 3040f80089..0000000000
--- a/jpa/tests/org.eclipse.jpt.core.tests/src/org/eclipse/jpt/core/tests/internal/resource/java/OneToManyTests.java
+++ /dev/null
@@ -1,397 +0,0 @@
-/*******************************************************************************
- * Copyright (c) 2007, 2009 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.
- *
- * Contributors:
- * Oracle - initial API and implementation
- ******************************************************************************/
-package org.eclipse.jpt.core.tests.internal.resource.java;
-
-import java.util.Iterator;
-import org.eclipse.jdt.core.ICompilationUnit;
-import org.eclipse.jpt.core.resource.java.FetchType;
-import org.eclipse.jpt.core.resource.java.JPA;
-import org.eclipse.jpt.core.resource.java.JavaResourcePersistentAttribute;
-import org.eclipse.jpt.core.resource.java.JavaResourcePersistentType;
-import org.eclipse.jpt.core.resource.java.OneToManyAnnotation;
-import org.eclipse.jpt.utility.internal.iterators.ArrayIterator;
-
-@SuppressWarnings("nls")
-public class OneToManyTests extends JavaResourceModelTestCase {
-
- public OneToManyTests(String name) {
- super(name);
- }
-
- private ICompilationUnit createTestOneToMany() throws Exception {
- return this.createTestType(new DefaultAnnotationWriter() {
- @Override
- public Iterator<String> imports() {
- return new ArrayIterator<String>(JPA.ONE_TO_MANY);
- }
- @Override
- public void appendIdFieldAnnotationTo(StringBuilder sb) {
- sb.append("@OneToMany");
- }
- });
- }
-
- private ICompilationUnit createTestOneToManyWithFetch() throws Exception {
- return this.createTestType(new DefaultAnnotationWriter() {
- @Override
- public Iterator<String> imports() {
- return new ArrayIterator<String>(JPA.ONE_TO_MANY, JPA.FETCH_TYPE);
- }
- @Override
- public void appendIdFieldAnnotationTo(StringBuilder sb) {
- sb.append("@OneToMany(fetch = FetchType.EAGER)");
- }
- });
- }
-
- private ICompilationUnit createTestOneToManyWithTargetEntity() throws Exception {
- return this.createTestType(new DefaultAnnotationWriter() {
- @Override
- public Iterator<String> imports() {
- return new ArrayIterator<String>(JPA.ONE_TO_MANY);
- }
- @Override
- public void appendIdFieldAnnotationTo(StringBuilder sb) {
- sb.append("@OneToMany(targetEntity = AnnotationTestType.class)");
- }
- });
- }
-
- private ICompilationUnit createTestOneToManyWithMappedBy() throws Exception {
- return this.createTestType(new DefaultAnnotationWriter() {
- @Override
- public Iterator<String> imports() {
- return new ArrayIterator<String>(JPA.ONE_TO_MANY);
- }
- @Override
- public void appendIdFieldAnnotationTo(StringBuilder sb) {
- sb.append("@OneToMany(mappedBy = \"foo\")");
- }
- });
- }
-
- private ICompilationUnit createTestOneToManyWithCascade() throws Exception {
- return this.createTestType(new DefaultAnnotationWriter() {
- @Override
- public Iterator<String> imports() {
- return new ArrayIterator<String>(JPA.ONE_TO_MANY, JPA.CASCADE_TYPE);
- }
- @Override
- public void appendIdFieldAnnotationTo(StringBuilder sb) {
- sb.append("@OneToMany(cascade = CascadeType.ALL)");
- }
- });
- }
-
- private ICompilationUnit createTestOneToManyWithMultipleCascade() throws Exception {
- return this.createTestType(new DefaultAnnotationWriter() {
- @Override
- public Iterator<String> imports() {
- return new ArrayIterator<String>(JPA.ONE_TO_MANY, JPA.CASCADE_TYPE);
- }
- @Override
- public void appendIdFieldAnnotationTo(StringBuilder sb) {
- sb.append("@OneToMany(cascade = {CascadeType.MERGE, CascadeType.REMOVE})");
- }
- });
- }
-
- private ICompilationUnit createTestOneToManyWithDuplicateCascade() throws Exception {
- return this.createTestType(new DefaultAnnotationWriter() {
- @Override
- public Iterator<String> imports() {
- return new ArrayIterator<String>(JPA.ONE_TO_MANY, JPA.CASCADE_TYPE);
- }
- @Override
- public void appendIdFieldAnnotationTo(StringBuilder sb) {
- sb.append("@OneToMany(cascade = {CascadeType.MERGE, CascadeType.MERGE})");
- }
- });
- }
-
- public void testOneToMany() throws Exception {
- ICompilationUnit cu = this.createTestOneToMany();
- JavaResourcePersistentType typeResource = buildJavaTypeResource(cu);
- JavaResourcePersistentAttribute attributeResource = typeResource.fields().next();
-
- OneToManyAnnotation oneToMany = (OneToManyAnnotation) attributeResource.getMappingAnnotation(JPA.ONE_TO_MANY);
- assertNotNull(oneToMany);
- }
-
- public void testGetFetch() throws Exception {
- ICompilationUnit cu = this.createTestOneToManyWithFetch();
- JavaResourcePersistentType typeResource = buildJavaTypeResource(cu);
- JavaResourcePersistentAttribute attributeResource = typeResource.fields().next();
-
- OneToManyAnnotation oneToMany = (OneToManyAnnotation) attributeResource.getMappingAnnotation(JPA.ONE_TO_MANY);
- assertEquals(FetchType.EAGER, oneToMany.getFetch());
- }
-
- public void testSetFetch() throws Exception {
- ICompilationUnit cu = this.createTestOneToManyWithFetch();
- JavaResourcePersistentType typeResource = buildJavaTypeResource(cu);
- JavaResourcePersistentAttribute attributeResource = typeResource.fields().next();
-
- OneToManyAnnotation oneToMany = (OneToManyAnnotation) attributeResource.getMappingAnnotation(JPA.ONE_TO_MANY);
- assertEquals(FetchType.EAGER, oneToMany.getFetch());
-
- oneToMany.setFetch(FetchType.LAZY);
- assertEquals(FetchType.LAZY, oneToMany.getFetch());
-
- assertSourceContains("@OneToMany(fetch = LAZY)", cu);
- }
-
- public void testSetFetchNull() throws Exception {
- ICompilationUnit cu = this.createTestOneToManyWithFetch();
- JavaResourcePersistentType typeResource = buildJavaTypeResource(cu);
- JavaResourcePersistentAttribute attributeResource = typeResource.fields().next();
-
- OneToManyAnnotation oneToMany = (OneToManyAnnotation) attributeResource.getMappingAnnotation(JPA.ONE_TO_MANY);
- assertEquals(FetchType.EAGER, oneToMany.getFetch());
-
- oneToMany.setFetch(null);
- assertNull(oneToMany.getFetch());
-
- assertSourceContains("@OneToMany", cu);
- assertSourceDoesNotContain("fetch", cu);
- }
-
-
- public void testGetTargetEntity() throws Exception {
- ICompilationUnit cu = this.createTestOneToManyWithTargetEntity();
- JavaResourcePersistentType typeResource = buildJavaTypeResource(cu);
- JavaResourcePersistentAttribute attributeResource = typeResource.fields().next();
-
- OneToManyAnnotation oneToMany = (OneToManyAnnotation) attributeResource.getMappingAnnotation(JPA.ONE_TO_MANY);
- assertEquals(TYPE_NAME, oneToMany.getTargetEntity());
- }
-
- public void testSetTargetEntity() throws Exception {
- ICompilationUnit cu = this.createTestOneToManyWithTargetEntity();
- JavaResourcePersistentType typeResource = buildJavaTypeResource(cu);
- JavaResourcePersistentAttribute attributeResource = typeResource.fields().next();
-
- OneToManyAnnotation oneToMany = (OneToManyAnnotation) attributeResource.getMappingAnnotation(JPA.ONE_TO_MANY);
- assertEquals(TYPE_NAME, oneToMany.getTargetEntity());
-
- oneToMany.setTargetEntity("Foo");
-
- assertSourceContains("@OneToMany(targetEntity = Foo.class)", cu);
- }
-
- public void testSetTargetEntityNull() throws Exception {
- ICompilationUnit cu = this.createTestOneToManyWithTargetEntity();
- JavaResourcePersistentType typeResource = buildJavaTypeResource(cu);
- JavaResourcePersistentAttribute attributeResource = typeResource.fields().next();
-
- OneToManyAnnotation oneToMany = (OneToManyAnnotation) attributeResource.getMappingAnnotation(JPA.ONE_TO_MANY);
- assertEquals(TYPE_NAME, oneToMany.getTargetEntity());
-
- oneToMany.setTargetEntity(null);
-
- assertSourceContains("@OneToMany", cu);
- assertSourceDoesNotContain("targetEntity", cu);
- }
-
-
- public void testGetFullyQualifiedTargetEntity() throws Exception {
- ICompilationUnit cu = this.createTestOneToManyWithTargetEntity();
- JavaResourcePersistentType typeResource = buildJavaTypeResource(cu);
- JavaResourcePersistentAttribute attributeResource = typeResource.fields().next();
-
- OneToManyAnnotation oneToMany = (OneToManyAnnotation) attributeResource.getMappingAnnotation(JPA.ONE_TO_MANY);
- assertEquals(FULLY_QUALIFIED_TYPE_NAME, oneToMany.getFullyQualifiedTargetEntityClassName());
-
- oneToMany.setTargetEntity("Foo");
-
- assertSourceContains("@OneToMany(targetEntity = Foo.class)", cu);
-
- assertEquals("Foo", oneToMany.getTargetEntity());
-
- assertEquals("Foo", oneToMany.getFullyQualifiedTargetEntityClassName()); //bug 196200 changed this
- }
-
- public void testGetMappedBy() throws Exception {
- ICompilationUnit cu = this.createTestOneToManyWithMappedBy();
- JavaResourcePersistentType typeResource = buildJavaTypeResource(cu);
- JavaResourcePersistentAttribute attributeResource = typeResource.fields().next();
-
- OneToManyAnnotation oneToMany = (OneToManyAnnotation) attributeResource.getMappingAnnotation(JPA.ONE_TO_MANY);
- assertEquals("foo", oneToMany.getMappedBy());
- }
-
-
- public void testGetMappedByNull() throws Exception {
- ICompilationUnit cu = this.createTestOneToMany();
- JavaResourcePersistentType typeResource = buildJavaTypeResource(cu);
- JavaResourcePersistentAttribute attributeResource = typeResource.fields().next();
-
- OneToManyAnnotation oneToMany = (OneToManyAnnotation) attributeResource.getMappingAnnotation(JPA.ONE_TO_MANY);
- assertEquals(null, oneToMany.getMappedBy());
- }
-
- public void testSetMappedBy() throws Exception {
- ICompilationUnit cu = this.createTestOneToMany();
- JavaResourcePersistentType typeResource = buildJavaTypeResource(cu);
- JavaResourcePersistentAttribute attributeResource = typeResource.fields().next();
-
- OneToManyAnnotation oneToMany = (OneToManyAnnotation) attributeResource.getMappingAnnotation(JPA.ONE_TO_MANY);
- assertNull(oneToMany.getMappedBy());
- oneToMany.setMappedBy("bar");
- assertEquals("bar", oneToMany.getMappedBy());
-
- assertSourceContains("@OneToMany(mappedBy = \"bar\")", cu);
- }
-
- public void testSetMappedByNull() throws Exception {
- ICompilationUnit cu = this.createTestOneToManyWithMappedBy();
- JavaResourcePersistentType typeResource = buildJavaTypeResource(cu);
- JavaResourcePersistentAttribute attributeResource = typeResource.fields().next();
-
- OneToManyAnnotation oneToMany = (OneToManyAnnotation) attributeResource.getMappingAnnotation(JPA.ONE_TO_MANY);
- assertEquals("foo", oneToMany.getMappedBy());
-
- oneToMany.setMappedBy(null);
- assertNull(oneToMany.getMappedBy());
-
- assertSourceContains("@OneToMany", cu);
- assertSourceDoesNotContain("mappedBy", cu);
- }
-
- public void testSetCascadeAll() throws Exception {
- ICompilationUnit cu = this.createTestOneToMany();
- JavaResourcePersistentType typeResource = buildJavaTypeResource(cu);
- JavaResourcePersistentAttribute attributeResource = typeResource.fields().next();
-
- OneToManyAnnotation oneToMany = (OneToManyAnnotation) attributeResource.getMappingAnnotation(JPA.ONE_TO_MANY);
- assertFalse(oneToMany.isCascadeAll());
-
- oneToMany.setCascadeAll(true);
- assertSourceContains("@OneToMany(cascade = ALL)", cu);
-
- assertTrue(oneToMany.isCascadeAll());
- }
-
- public void testSetCascadeMerge() throws Exception {
- ICompilationUnit cu = this.createTestOneToMany();
- JavaResourcePersistentType typeResource = buildJavaTypeResource(cu);
- JavaResourcePersistentAttribute attributeResource = typeResource.fields().next();
-
- OneToManyAnnotation oneToMany = (OneToManyAnnotation) attributeResource.getMappingAnnotation(JPA.ONE_TO_MANY);
- assertFalse(oneToMany.isCascadeMerge());
-
- oneToMany.setCascadeMerge(true);
- assertSourceContains("@OneToMany(cascade = MERGE)", cu);
-
- assertTrue(oneToMany.isCascadeMerge());
- }
-
- public void testSetCascadePersist() throws Exception {
- ICompilationUnit cu = this.createTestOneToMany();
- JavaResourcePersistentType typeResource = buildJavaTypeResource(cu);
- JavaResourcePersistentAttribute attributeResource = typeResource.fields().next();
-
- OneToManyAnnotation oneToMany = (OneToManyAnnotation) attributeResource.getMappingAnnotation(JPA.ONE_TO_MANY);
- assertFalse(oneToMany.isCascadePersist());
-
- oneToMany.setCascadePersist(true);
- assertSourceContains("@OneToMany(cascade = PERSIST)", cu);
-
- assertTrue(oneToMany.isCascadePersist());
- }
-
- public void testSetCascadeRemove() throws Exception {
- ICompilationUnit cu = this.createTestOneToMany();
- JavaResourcePersistentType typeResource = buildJavaTypeResource(cu);
- JavaResourcePersistentAttribute attributeResource = typeResource.fields().next();
-
- OneToManyAnnotation oneToMany = (OneToManyAnnotation) attributeResource.getMappingAnnotation(JPA.ONE_TO_MANY);
- assertFalse(oneToMany.isCascadeRemove());
-
- oneToMany.setCascadeRemove(true);
- assertSourceContains("@OneToMany(cascade = REMOVE)", cu);
-
- assertTrue(oneToMany.isCascadeRemove());
- }
-
- public void testSetCascadeRefresh() throws Exception {
- ICompilationUnit cu = this.createTestOneToMany();
- JavaResourcePersistentType typeResource = buildJavaTypeResource(cu);
- JavaResourcePersistentAttribute attributeResource = typeResource.fields().next();
-
- OneToManyAnnotation oneToMany = (OneToManyAnnotation) attributeResource.getMappingAnnotation(JPA.ONE_TO_MANY);
- assertFalse(oneToMany.isCascadeRefresh());
-
- oneToMany.setCascadeRefresh(true);
- assertSourceContains("@OneToMany(cascade = REFRESH)", cu);
-
- assertTrue(oneToMany.isCascadeRefresh());
- }
-
- public void testCascadeMoreThanOnce() throws Exception {
- ICompilationUnit cu = this.createTestOneToManyWithCascade();
- JavaResourcePersistentType typeResource = buildJavaTypeResource(cu);
- JavaResourcePersistentAttribute attributeResource = typeResource.fields().next();
-
- OneToManyAnnotation oneToMany = (OneToManyAnnotation) attributeResource.getMappingAnnotation(JPA.ONE_TO_MANY);
- assertTrue(oneToMany.isCascadeAll());
-
- oneToMany.setCascadeAll(true);
- assertTrue(oneToMany.isCascadeAll());
- //a second CascadeType.All should not have been added
- assertSourceContains("@OneToMany(cascade = CascadeType.ALL)", cu);
-
- oneToMany.setCascadeAll(false);
- assertFalse(oneToMany.isCascadeAll());
-
- assertSourceDoesNotContain("cascade", cu);
-
- //test setting cascadeAll to false again, should just do nothing
- oneToMany.setCascadeAll(false);
- assertFalse(oneToMany.isCascadeAll());
-
- assertSourceDoesNotContain("cascade", cu);
- }
-
- public void testDuplicateCascade() throws Exception {
- ICompilationUnit cu = this.createTestOneToManyWithDuplicateCascade();
- JavaResourcePersistentType typeResource = buildJavaTypeResource(cu);
- JavaResourcePersistentAttribute attributeResource = typeResource.fields().next();
-
- OneToManyAnnotation oneToMany = (OneToManyAnnotation) attributeResource.getMappingAnnotation(JPA.ONE_TO_MANY);
- assertTrue(oneToMany.isCascadeMerge());
-
- oneToMany.setCascadeMerge(false);//TODO should the resource model handle this and remove both MERGE
- //settings instead of having to set it false twice?
- assertTrue(oneToMany.isCascadeMerge());
-
- oneToMany.setCascadeMerge(false);
- assertFalse(oneToMany.isCascadeMerge());
-
- assertSourceDoesNotContain("cascade", cu);
- }
-
- public void testMultipleCascade() throws Exception {
- ICompilationUnit cu = this.createTestOneToManyWithMultipleCascade();
- JavaResourcePersistentType typeResource = buildJavaTypeResource(cu);
- JavaResourcePersistentAttribute attributeResource = typeResource.fields().next();
-
- OneToManyAnnotation oneToMany = (OneToManyAnnotation) attributeResource.getMappingAnnotation(JPA.ONE_TO_MANY);
- assertTrue(oneToMany.isCascadeMerge());
- assertTrue(oneToMany.isCascadeRemove());
-
- oneToMany.setCascadeMerge(false);
- assertSourceContains("@OneToMany(cascade = REMOVE)", cu);
-
- oneToMany.setCascadeRemove(false);
- assertSourceDoesNotContain("cascade", cu);
- }
-
-}
diff --git a/jpa/tests/org.eclipse.jpt.core.tests/src/org/eclipse/jpt/core/tests/internal/resource/java/OneToOneTests.java b/jpa/tests/org.eclipse.jpt.core.tests/src/org/eclipse/jpt/core/tests/internal/resource/java/OneToOneTests.java
deleted file mode 100644
index 681f49478e..0000000000
--- a/jpa/tests/org.eclipse.jpt.core.tests/src/org/eclipse/jpt/core/tests/internal/resource/java/OneToOneTests.java
+++ /dev/null
@@ -1,447 +0,0 @@
-/*******************************************************************************
- * Copyright (c) 2007, 2009 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.
- *
- * Contributors:
- * Oracle - initial API and implementation
- ******************************************************************************/
-package org.eclipse.jpt.core.tests.internal.resource.java;
-
-import java.util.Iterator;
-import org.eclipse.jdt.core.ICompilationUnit;
-import org.eclipse.jpt.core.resource.java.FetchType;
-import org.eclipse.jpt.core.resource.java.JPA;
-import org.eclipse.jpt.core.resource.java.JavaResourcePersistentAttribute;
-import org.eclipse.jpt.core.resource.java.JavaResourcePersistentType;
-import org.eclipse.jpt.core.resource.java.OneToOneAnnotation;
-import org.eclipse.jpt.utility.internal.iterators.ArrayIterator;
-
-@SuppressWarnings("nls")
-public class OneToOneTests extends JavaResourceModelTestCase {
-
- public OneToOneTests(String name) {
- super(name);
- }
-
- private ICompilationUnit createTestOneToOne() throws Exception {
- return this.createTestType(new DefaultAnnotationWriter() {
- @Override
- public Iterator<String> imports() {
- return new ArrayIterator<String>(JPA.ONE_TO_ONE);
- }
- @Override
- public void appendIdFieldAnnotationTo(StringBuilder sb) {
- sb.append("@OneToOne");
- }
- });
- }
-
- private ICompilationUnit createTestOneToOneWithFetch() throws Exception {
- return this.createTestType(new DefaultAnnotationWriter() {
- @Override
- public Iterator<String> imports() {
- return new ArrayIterator<String>(JPA.ONE_TO_ONE, JPA.FETCH_TYPE);
- }
- @Override
- public void appendIdFieldAnnotationTo(StringBuilder sb) {
- sb.append("@OneToOne(fetch = FetchType.EAGER)");
- }
- });
- }
-
- private ICompilationUnit createTestOneToOneWithTargetEntity() throws Exception {
- return this.createTestType(new DefaultAnnotationWriter() {
- @Override
- public Iterator<String> imports() {
- return new ArrayIterator<String>(JPA.ONE_TO_ONE);
- }
- @Override
- public void appendIdFieldAnnotationTo(StringBuilder sb) {
- sb.append("@OneToOne(targetEntity = AnnotationTestType.class)");
- }
- });
- }
-
- private ICompilationUnit createTestOneToOneWithOptional() throws Exception {
- return this.createTestType(new DefaultAnnotationWriter() {
- @Override
- public Iterator<String> imports() {
- return new ArrayIterator<String>(JPA.ONE_TO_ONE);
- }
- @Override
- public void appendIdFieldAnnotationTo(StringBuilder sb) {
- sb.append("@OneToOne(optional = true)");
- }
- });
- }
-
- private ICompilationUnit createTestOneToOneWithMappedBy() throws Exception {
- return this.createTestType(new DefaultAnnotationWriter() {
- @Override
- public Iterator<String> imports() {
- return new ArrayIterator<String>(JPA.ONE_TO_ONE);
- }
- @Override
- public void appendIdFieldAnnotationTo(StringBuilder sb) {
- sb.append("@OneToOne(mappedBy = \"foo\")");
- }
- });
- }
-
- private ICompilationUnit createTestOneToOneWithCascade() throws Exception {
- return this.createTestType(new DefaultAnnotationWriter() {
- @Override
- public Iterator<String> imports() {
- return new ArrayIterator<String>(JPA.ONE_TO_ONE, JPA.CASCADE_TYPE);
- }
- @Override
- public void appendIdFieldAnnotationTo(StringBuilder sb) {
- sb.append("@OneToOne(cascade = CascadeType.ALL)");
- }
- });
- }
-
- private ICompilationUnit createTestOneToOneWithMultipleCascade() throws Exception {
- return this.createTestType(new DefaultAnnotationWriter() {
- @Override
- public Iterator<String> imports() {
- return new ArrayIterator<String>(JPA.ONE_TO_ONE, JPA.CASCADE_TYPE);
- }
- @Override
- public void appendIdFieldAnnotationTo(StringBuilder sb) {
- sb.append("@OneToOne(cascade = {CascadeType.MERGE, CascadeType.REMOVE})");
- }
- });
- }
-
- private ICompilationUnit createTestOneToOneWithDuplicateCascade() throws Exception {
- return this.createTestType(new DefaultAnnotationWriter() {
- @Override
- public Iterator<String> imports() {
- return new ArrayIterator<String>(JPA.ONE_TO_ONE, JPA.CASCADE_TYPE);
- }
- @Override
- public void appendIdFieldAnnotationTo(StringBuilder sb) {
- sb.append("@OneToOne(cascade = {CascadeType.MERGE, CascadeType.MERGE})");
- }
- });
- }
-
- public void testOneToOne() throws Exception {
- ICompilationUnit cu = this.createTestOneToOne();
- JavaResourcePersistentType typeResource = buildJavaTypeResource(cu);
- JavaResourcePersistentAttribute attributeResource = typeResource.fields().next();
-
- OneToOneAnnotation oneToOne = (OneToOneAnnotation) attributeResource.getMappingAnnotation(JPA.ONE_TO_ONE);
- assertNotNull(oneToOne);
- }
-
- public void testGetFetch() throws Exception {
- ICompilationUnit cu = this.createTestOneToOneWithFetch();
- JavaResourcePersistentType typeResource = buildJavaTypeResource(cu);
- JavaResourcePersistentAttribute attributeResource = typeResource.fields().next();
-
- OneToOneAnnotation oneToOne = (OneToOneAnnotation) attributeResource.getMappingAnnotation(JPA.ONE_TO_ONE);
- assertEquals(FetchType.EAGER, oneToOne.getFetch());
- }
-
- public void testSetFetch() throws Exception {
- ICompilationUnit cu = this.createTestOneToOneWithFetch();
- JavaResourcePersistentType typeResource = buildJavaTypeResource(cu);
- JavaResourcePersistentAttribute attributeResource = typeResource.fields().next();
-
- OneToOneAnnotation oneToOne = (OneToOneAnnotation) attributeResource.getMappingAnnotation(JPA.ONE_TO_ONE);
- assertEquals(FetchType.EAGER, oneToOne.getFetch());
-
- oneToOne.setFetch(FetchType.LAZY);
- assertEquals(FetchType.LAZY, oneToOne.getFetch());
-
- assertSourceContains("@OneToOne(fetch = LAZY)", cu);
- }
-
- public void testSetFetchNull() throws Exception {
- ICompilationUnit cu = this.createTestOneToOneWithFetch();
- JavaResourcePersistentType typeResource = buildJavaTypeResource(cu);
- JavaResourcePersistentAttribute attributeResource = typeResource.fields().next();
-
- OneToOneAnnotation oneToOne = (OneToOneAnnotation) attributeResource.getMappingAnnotation(JPA.ONE_TO_ONE);
- assertEquals(FetchType.EAGER, oneToOne.getFetch());
-
- oneToOne.setFetch(null);
- assertNull(oneToOne.getFetch());
-
- assertSourceContains("@OneToOne", cu);
- assertSourceDoesNotContain("fetch", cu);
- }
-
-
- public void testGetTargetEntity() throws Exception {
- ICompilationUnit cu = this.createTestOneToOneWithTargetEntity();
- JavaResourcePersistentType typeResource = buildJavaTypeResource(cu);
- JavaResourcePersistentAttribute attributeResource = typeResource.fields().next();
-
- OneToOneAnnotation oneToOne = (OneToOneAnnotation) attributeResource.getMappingAnnotation(JPA.ONE_TO_ONE);
- assertEquals(TYPE_NAME, oneToOne.getTargetEntity());
- }
-
- public void testSetTargetEntity() throws Exception {
- ICompilationUnit cu = this.createTestOneToOneWithTargetEntity();
- JavaResourcePersistentType typeResource = buildJavaTypeResource(cu);
- JavaResourcePersistentAttribute attributeResource = typeResource.fields().next();
-
- OneToOneAnnotation oneToOne = (OneToOneAnnotation) attributeResource.getMappingAnnotation(JPA.ONE_TO_ONE);
- assertEquals(TYPE_NAME, oneToOne.getTargetEntity());
-
- oneToOne.setTargetEntity("Foo");
-
- assertSourceContains("@OneToOne(targetEntity = Foo.class)", cu);
- }
-
- public void testSetTargetEntityNull() throws Exception {
- ICompilationUnit cu = this.createTestOneToOneWithTargetEntity();
- JavaResourcePersistentType typeResource = buildJavaTypeResource(cu);
- JavaResourcePersistentAttribute attributeResource = typeResource.fields().next();
-
- OneToOneAnnotation oneToOne = (OneToOneAnnotation) attributeResource.getMappingAnnotation(JPA.ONE_TO_ONE);
- assertEquals(TYPE_NAME, oneToOne.getTargetEntity());
-
- oneToOne.setTargetEntity(null);
-
- assertSourceContains("@OneToOne", cu);
- assertSourceDoesNotContain("targetEntity", cu);
- }
-
-
- public void testGetFullyQualifiedTargetEntity() throws Exception {
- ICompilationUnit cu = this.createTestOneToOneWithTargetEntity();
- JavaResourcePersistentType typeResource = buildJavaTypeResource(cu);
- JavaResourcePersistentAttribute attributeResource = typeResource.fields().next();
-
- OneToOneAnnotation oneToOne = (OneToOneAnnotation) attributeResource.getMappingAnnotation(JPA.ONE_TO_ONE);
- assertEquals(FULLY_QUALIFIED_TYPE_NAME, oneToOne.getFullyQualifiedTargetEntityClassName());
-
- oneToOne.setTargetEntity("Foo");
-
- assertSourceContains("@OneToOne(targetEntity = Foo.class)", cu);
-
- assertEquals("Foo", oneToOne.getTargetEntity());
-
- assertEquals("Foo", oneToOne.getFullyQualifiedTargetEntityClassName()); //bug 196200 changed this
- }
-
- public void testGetOptional() throws Exception {
- ICompilationUnit cu = this.createTestOneToOneWithOptional();
- JavaResourcePersistentType typeResource = buildJavaTypeResource(cu);
- JavaResourcePersistentAttribute attributeResource = typeResource.fields().next();
-
- OneToOneAnnotation oneToOne = (OneToOneAnnotation) attributeResource.getMappingAnnotation(JPA.ONE_TO_ONE);
- assertEquals(Boolean.TRUE, oneToOne.getOptional());
- }
-
- public void testSetOptional() throws Exception {
- ICompilationUnit cu = this.createTestOneToOneWithOptional();
- JavaResourcePersistentType typeResource = buildJavaTypeResource(cu);
- JavaResourcePersistentAttribute attributeResource = typeResource.fields().next();
-
- OneToOneAnnotation oneToOne = (OneToOneAnnotation) attributeResource.getMappingAnnotation(JPA.ONE_TO_ONE);
- assertEquals(Boolean.TRUE, oneToOne.getOptional());
-
- oneToOne.setOptional(Boolean.FALSE);
- assertEquals(Boolean.FALSE, oneToOne.getOptional());
-
- assertSourceContains("@OneToOne(optional = false)", cu);
- }
-
- public void testSetOptionalNull() throws Exception {
- ICompilationUnit cu = this.createTestOneToOneWithOptional();
- JavaResourcePersistentType typeResource = buildJavaTypeResource(cu);
- JavaResourcePersistentAttribute attributeResource = typeResource.fields().next();
-
- OneToOneAnnotation oneToOne = (OneToOneAnnotation) attributeResource.getMappingAnnotation(JPA.ONE_TO_ONE);
- assertEquals(Boolean.TRUE, oneToOne.getOptional());
-
- oneToOne.setOptional(null);
- assertNull(oneToOne.getOptional());
-
- assertSourceContains("@OneToOne", cu);
- assertSourceDoesNotContain("optional", cu);
- }
-
- public void testGetMappedBy() throws Exception {
- ICompilationUnit cu = this.createTestOneToOneWithMappedBy();
- JavaResourcePersistentType typeResource = buildJavaTypeResource(cu);
- JavaResourcePersistentAttribute attributeResource = typeResource.fields().next();
-
- OneToOneAnnotation oneToOne = (OneToOneAnnotation) attributeResource.getMappingAnnotation(JPA.ONE_TO_ONE);
- assertEquals("foo", oneToOne.getMappedBy());
- }
-
- public void testGetMappedByNull() throws Exception {
- ICompilationUnit cu = this.createTestOneToOne();
- JavaResourcePersistentType typeResource = buildJavaTypeResource(cu);
- JavaResourcePersistentAttribute attributeResource = typeResource.fields().next();
-
- OneToOneAnnotation oneToOne = (OneToOneAnnotation) attributeResource.getMappingAnnotation(JPA.ONE_TO_ONE);
- assertEquals(null, oneToOne.getMappedBy());
- }
-
- public void testSetMappedBy() throws Exception {
- ICompilationUnit cu = this.createTestOneToOne();
- JavaResourcePersistentType typeResource = buildJavaTypeResource(cu);
- JavaResourcePersistentAttribute attributeResource = typeResource.fields().next();
-
- OneToOneAnnotation oneToOne = (OneToOneAnnotation) attributeResource.getMappingAnnotation(JPA.ONE_TO_ONE);
- assertNull(oneToOne.getMappedBy());
- oneToOne.setMappedBy("bar");
- assertEquals("bar", oneToOne.getMappedBy());
-
- assertSourceContains("@OneToOne(mappedBy = \"bar\")", cu);
- }
-
- public void testSetMappedByNull() throws Exception {
- ICompilationUnit cu = this.createTestOneToOneWithMappedBy();
- JavaResourcePersistentType typeResource = buildJavaTypeResource(cu);
- JavaResourcePersistentAttribute attributeResource = typeResource.fields().next();
-
- OneToOneAnnotation oneToOne = (OneToOneAnnotation) attributeResource.getMappingAnnotation(JPA.ONE_TO_ONE);
- assertEquals("foo", oneToOne.getMappedBy());
-
- oneToOne.setMappedBy(null);
- assertNull(oneToOne.getMappedBy());
-
- assertSourceContains("@OneToOne", cu);
- assertSourceDoesNotContain("mappedBy", cu);
- }
-
- public void testSetCascadeAll() throws Exception {
- ICompilationUnit cu = this.createTestOneToOne();
- JavaResourcePersistentType typeResource = buildJavaTypeResource(cu);
- JavaResourcePersistentAttribute attributeResource = typeResource.fields().next();
-
- OneToOneAnnotation oneToOne = (OneToOneAnnotation) attributeResource.getMappingAnnotation(JPA.ONE_TO_ONE);
- assertFalse(oneToOne.isCascadeAll());
-
- oneToOne.setCascadeAll(true);
- assertSourceContains("@OneToOne(cascade = ALL)", cu);
-
- assertTrue(oneToOne.isCascadeAll());
- }
-
- public void testSetCascadeMerge() throws Exception {
- ICompilationUnit cu = this.createTestOneToOne();
- JavaResourcePersistentType typeResource = buildJavaTypeResource(cu);
- JavaResourcePersistentAttribute attributeResource = typeResource.fields().next();
-
- OneToOneAnnotation oneToOne = (OneToOneAnnotation) attributeResource.getMappingAnnotation(JPA.ONE_TO_ONE);
- assertFalse(oneToOne.isCascadeMerge());
-
- oneToOne.setCascadeMerge(true);
- assertSourceContains("@OneToOne(cascade = MERGE)", cu);
-
- assertTrue(oneToOne.isCascadeMerge());
- }
-
- public void testSetCascadePersist() throws Exception {
- ICompilationUnit cu = this.createTestOneToOne();
- JavaResourcePersistentType typeResource = buildJavaTypeResource(cu);
- JavaResourcePersistentAttribute attributeResource = typeResource.fields().next();
-
- OneToOneAnnotation oneToOne = (OneToOneAnnotation) attributeResource.getMappingAnnotation(JPA.ONE_TO_ONE);
- assertFalse(oneToOne.isCascadePersist());
-
- oneToOne.setCascadePersist(true);
- assertSourceContains("@OneToOne(cascade = PERSIST)", cu);
-
- assertTrue(oneToOne.isCascadePersist());
- }
-
- public void testSetCascadeRemove() throws Exception {
- ICompilationUnit cu = this.createTestOneToOne();
- JavaResourcePersistentType typeResource = buildJavaTypeResource(cu);
- JavaResourcePersistentAttribute attributeResource = typeResource.fields().next();
-
- OneToOneAnnotation oneToOne = (OneToOneAnnotation) attributeResource.getMappingAnnotation(JPA.ONE_TO_ONE);
- assertFalse(oneToOne.isCascadeRemove());
-
- oneToOne.setCascadeRemove(true);
- assertSourceContains("@OneToOne(cascade = REMOVE)", cu);
-
- assertTrue(oneToOne.isCascadeRemove());
- }
-
- public void testSetCascadeRefresh() throws Exception {
- ICompilationUnit cu = this.createTestOneToOne();
- JavaResourcePersistentType typeResource = buildJavaTypeResource(cu);
- JavaResourcePersistentAttribute attributeResource = typeResource.fields().next();
-
- OneToOneAnnotation oneToOne = (OneToOneAnnotation) attributeResource.getMappingAnnotation(JPA.ONE_TO_ONE);
- assertFalse(oneToOne.isCascadeRefresh());
-
- oneToOne.setCascadeRefresh(true);
- assertSourceContains("@OneToOne(cascade = REFRESH)", cu);
-
- assertTrue(oneToOne.isCascadeRefresh());
- }
-
- public void testCascadeMoreThanOnce() throws Exception {
- ICompilationUnit cu = this.createTestOneToOneWithCascade();
- JavaResourcePersistentType typeResource = buildJavaTypeResource(cu);
- JavaResourcePersistentAttribute attributeResource = typeResource.fields().next();
-
- OneToOneAnnotation oneToOne = (OneToOneAnnotation) attributeResource.getMappingAnnotation(JPA.ONE_TO_ONE);
- assertTrue(oneToOne.isCascadeAll());
-
- oneToOne.setCascadeAll(true);
- assertTrue(oneToOne.isCascadeAll());
- //a second CascadeType.All should not have been added
- assertSourceContains("@OneToOne(cascade = CascadeType.ALL)", cu);
-
- oneToOne.setCascadeAll(false);
- assertFalse(oneToOne.isCascadeAll());
-
- assertSourceDoesNotContain("cascade", cu);
-
- //test setting cascadeAll to false again, should just do nothing
- oneToOne.setCascadeAll(false);
- assertFalse(oneToOne.isCascadeAll());
-
- assertSourceDoesNotContain("cascade", cu);
- }
-
- public void testDuplicateCascade() throws Exception {
- ICompilationUnit cu = this.createTestOneToOneWithDuplicateCascade();
- JavaResourcePersistentType typeResource = buildJavaTypeResource(cu);
- JavaResourcePersistentAttribute attributeResource = typeResource.fields().next();
-
- OneToOneAnnotation oneToOne = (OneToOneAnnotation) attributeResource.getMappingAnnotation(JPA.ONE_TO_ONE);
- assertTrue(oneToOne.isCascadeMerge());
-
- oneToOne.setCascadeMerge(false);//TODO should the resource model handle this and remove both MERGE
- //settings instead of having to set it false twice?
- assertTrue(oneToOne.isCascadeMerge());
-
- oneToOne.setCascadeMerge(false);
- assertFalse(oneToOne.isCascadeMerge());
-
- assertSourceDoesNotContain("cascade", cu);
- }
-
- public void testMultipleCascade() throws Exception {
- ICompilationUnit cu = this.createTestOneToOneWithMultipleCascade();
- JavaResourcePersistentType typeResource = buildJavaTypeResource(cu);
- JavaResourcePersistentAttribute attributeResource = typeResource.fields().next();
-
- OneToOneAnnotation oneToOne = (OneToOneAnnotation) attributeResource.getMappingAnnotation(JPA.ONE_TO_ONE);
- assertTrue(oneToOne.isCascadeMerge());
- assertTrue(oneToOne.isCascadeRemove());
-
- oneToOne.setCascadeMerge(false);
- assertSourceContains("@OneToOne(cascade = REMOVE)", cu);
-
- oneToOne.setCascadeRemove(false);
- assertSourceDoesNotContain("cascade", cu);
- }
-
-}
diff --git a/jpa/tests/org.eclipse.jpt.core.tests/src/org/eclipse/jpt/core/tests/internal/resource/java/OrderByTests.java b/jpa/tests/org.eclipse.jpt.core.tests/src/org/eclipse/jpt/core/tests/internal/resource/java/OrderByTests.java
deleted file mode 100644
index 55120e4a94..0000000000
--- a/jpa/tests/org.eclipse.jpt.core.tests/src/org/eclipse/jpt/core/tests/internal/resource/java/OrderByTests.java
+++ /dev/null
@@ -1,87 +0,0 @@
-/*******************************************************************************
- * Copyright (c) 2007, 2009 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.
- *
- * Contributors:
- * Oracle - initial API and implementation
- ******************************************************************************/
-package org.eclipse.jpt.core.tests.internal.resource.java;
-
-import java.util.Iterator;
-import org.eclipse.jdt.core.ICompilationUnit;
-import org.eclipse.jpt.core.resource.java.JPA;
-import org.eclipse.jpt.core.resource.java.JavaResourcePersistentAttribute;
-import org.eclipse.jpt.core.resource.java.JavaResourcePersistentType;
-import org.eclipse.jpt.core.resource.java.OrderByAnnotation;
-import org.eclipse.jpt.utility.internal.iterators.ArrayIterator;
-
-@SuppressWarnings("nls")
-public class OrderByTests extends JavaResourceModelTestCase {
-
- public OrderByTests(String name) {
- super(name);
- }
-
- private ICompilationUnit createTestOrderBy() throws Exception {
- return this.createTestType(new DefaultAnnotationWriter() {
- @Override
- public Iterator<String> imports() {
- return new ArrayIterator<String>(JPA.ORDER_BY);
- }
- @Override
- public void appendIdFieldAnnotationTo(StringBuilder sb) {
- sb.append("@OrderBy");
- }
- });
- }
-
- private ICompilationUnit createTestOrderByWithValue() throws Exception {
- return this.createTestType(new DefaultAnnotationWriter() {
- @Override
- public Iterator<String> imports() {
- return new ArrayIterator<String>(JPA.ORDER_BY);
- }
- @Override
- public void appendIdFieldAnnotationTo(StringBuilder sb) {
- sb.append("@OrderBy(value = \"key\")");
- }
- });
- }
-
- public void testOrderBy() throws Exception {
- ICompilationUnit cu = this.createTestOrderBy();
- JavaResourcePersistentType typeResource = buildJavaTypeResource(cu);
- JavaResourcePersistentAttribute attributeResource = typeResource.fields().next();
-
- OrderByAnnotation orderBy = (OrderByAnnotation) attributeResource.getSupportingAnnotation(JPA.ORDER_BY);
- assertNotNull(orderBy);
- }
-
- public void testGetValue() throws Exception {
- ICompilationUnit cu = this.createTestOrderByWithValue();
- JavaResourcePersistentType typeResource = buildJavaTypeResource(cu);
- JavaResourcePersistentAttribute attributeResource = typeResource.fields().next();
-
- OrderByAnnotation orderBy = (OrderByAnnotation) attributeResource.getSupportingAnnotation(JPA.ORDER_BY);
- assertEquals("key", orderBy.getValue());
- }
-
- public void testSetValue() throws Exception {
- ICompilationUnit cu = this.createTestOrderBy();
- JavaResourcePersistentType typeResource = buildJavaTypeResource(cu);
- JavaResourcePersistentAttribute attributeResource = typeResource.fields().next();
-
- OrderByAnnotation orderBy = (OrderByAnnotation) attributeResource.getSupportingAnnotation(JPA.ORDER_BY);
-
- orderBy.setValue("foo");
-
- assertSourceContains("@OrderBy(\"foo\")", cu);
-
- orderBy.setValue(null);
-
- assertSourceContains("@OrderBy", cu);
- }
-
-}
diff --git a/jpa/tests/org.eclipse.jpt.core.tests/src/org/eclipse/jpt/core/tests/internal/resource/java/PrimaryKeyJoinColumnTests.java b/jpa/tests/org.eclipse.jpt.core.tests/src/org/eclipse/jpt/core/tests/internal/resource/java/PrimaryKeyJoinColumnTests.java
deleted file mode 100644
index 025e347a3f..0000000000
--- a/jpa/tests/org.eclipse.jpt.core.tests/src/org/eclipse/jpt/core/tests/internal/resource/java/PrimaryKeyJoinColumnTests.java
+++ /dev/null
@@ -1,187 +0,0 @@
-/*******************************************************************************
- * Copyright (c) 2007, 2009 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.
- *
- * Contributors:
- * Oracle - initial API and implementation
- ******************************************************************************/
-package org.eclipse.jpt.core.tests.internal.resource.java;
-
-import java.util.Iterator;
-import org.eclipse.jdt.core.ICompilationUnit;
-import org.eclipse.jpt.core.resource.java.JPA;
-import org.eclipse.jpt.core.resource.java.JavaResourcePersistentAttribute;
-import org.eclipse.jpt.core.resource.java.JavaResourcePersistentType;
-import org.eclipse.jpt.core.resource.java.PrimaryKeyJoinColumnAnnotation;
-import org.eclipse.jpt.utility.internal.iterators.ArrayIterator;
-
-@SuppressWarnings("nls")
-public class PrimaryKeyJoinColumnTests extends JavaResourceModelTestCase {
-
- private static final String COLUMN_NAME = "MY_COLUMN";
- private static final String COLUMN_COLUMN_DEFINITION = "COLUMN_DEFINITION";
- private static final String COLUMN_REFERENCED_COLUMN_NAME = "MY_REF_COLUMN_NAME";
-
- public PrimaryKeyJoinColumnTests(String name) {
- super(name);
- }
-
- private ICompilationUnit createTestPrimaryKeyJoinColumn() throws Exception {
- return this.createTestType(new DefaultAnnotationWriter() {
- @Override
- public Iterator<String> imports() {
- return new ArrayIterator<String>(JPA.PRIMARY_KEY_JOIN_COLUMN);
- }
- @Override
- public void appendIdFieldAnnotationTo(StringBuilder sb) {
- sb.append("@PrimaryKeyJoinColumn");
- }
- });
- }
-
- private ICompilationUnit createTestPrimaryKeyJoinColumnWithName() throws Exception {
- return this.createTestType(new DefaultAnnotationWriter() {
- @Override
- public Iterator<String> imports() {
- return new ArrayIterator<String>(JPA.PRIMARY_KEY_JOIN_COLUMN);
- }
- @Override
- public void appendIdFieldAnnotationTo(StringBuilder sb) {
- sb.append("@PrimaryKeyJoinColumn(name = \"" + COLUMN_NAME + "\")");
- }
- });
- }
-
- private ICompilationUnit createTestPrimaryKeyJoinColumnWithReferencedColumnName() throws Exception {
- return this.createTestType(new DefaultAnnotationWriter() {
- @Override
- public Iterator<String> imports() {
- return new ArrayIterator<String>(JPA.PRIMARY_KEY_JOIN_COLUMN);
- }
- @Override
- public void appendIdFieldAnnotationTo(StringBuilder sb) {
- sb.append("@PrimaryKeyJoinColumn(referencedColumnName = \"" + COLUMN_REFERENCED_COLUMN_NAME + "\")");
- }
- });
- }
-
- private ICompilationUnit createTestPrimaryKeyJoinColumnWithColumnDefinition() throws Exception {
- return this.createTestType(new DefaultAnnotationWriter() {
- @Override
- public Iterator<String> imports() {
- return new ArrayIterator<String>(JPA.PRIMARY_KEY_JOIN_COLUMN);
- }
- @Override
- public void appendIdFieldAnnotationTo(StringBuilder sb) {
- sb.append("@PrimaryKeyJoinColumn(columnDefinition = \"" + COLUMN_COLUMN_DEFINITION + "\")");
- }
- });
- }
-
- public void testGetName() throws Exception {
- ICompilationUnit cu = this.createTestPrimaryKeyJoinColumnWithName();
- JavaResourcePersistentType typeResource = buildJavaTypeResource(cu);
- JavaResourcePersistentAttribute attributeResource = typeResource.fields().next();
- PrimaryKeyJoinColumnAnnotation column = (PrimaryKeyJoinColumnAnnotation) attributeResource.getSupportingAnnotation(JPA.PRIMARY_KEY_JOIN_COLUMN);
- assertNotNull(column);
- assertEquals(COLUMN_NAME, column.getName());
- }
-
- public void testGetNull() throws Exception {
- ICompilationUnit cu = this.createTestPrimaryKeyJoinColumn();
- JavaResourcePersistentType typeResource = buildJavaTypeResource(cu);
- JavaResourcePersistentAttribute attributeResource = typeResource.fields().next();
- PrimaryKeyJoinColumnAnnotation column = (PrimaryKeyJoinColumnAnnotation) attributeResource.getSupportingAnnotation(JPA.PRIMARY_KEY_JOIN_COLUMN);
- assertNotNull(column);
- assertNull(column.getReferencedColumnName());
- assertNull(column.getColumnDefinition());
- }
-
- public void testSetName() throws Exception {
- ICompilationUnit cu = this.createTestPrimaryKeyJoinColumn();
- JavaResourcePersistentType typeResource = buildJavaTypeResource(cu);
- JavaResourcePersistentAttribute attributeResource = typeResource.fields().next();
- PrimaryKeyJoinColumnAnnotation column = (PrimaryKeyJoinColumnAnnotation) attributeResource.getSupportingAnnotation(JPA.PRIMARY_KEY_JOIN_COLUMN);
-
- assertNotNull(column);
- assertNull(column.getName());
-
- column.setName("Foo");
- assertEquals("Foo", column.getName());
-
- assertSourceContains("@PrimaryKeyJoinColumn(name = \"Foo\")", cu);
- }
-
- public void testSetNameNull() throws Exception {
- ICompilationUnit cu = this.createTestPrimaryKeyJoinColumnWithName();
- JavaResourcePersistentType typeResource = buildJavaTypeResource(cu);
- JavaResourcePersistentAttribute attributeResource = typeResource.fields().next();
- PrimaryKeyJoinColumnAnnotation column = (PrimaryKeyJoinColumnAnnotation) attributeResource.getSupportingAnnotation(JPA.PRIMARY_KEY_JOIN_COLUMN);
-
- assertEquals(COLUMN_NAME, column.getName());
-
- column.setName(null);
- assertNull(column.getName());
-
- assertSourceDoesNotContain("@PrimaryKeyJoinColumn", cu);
- }
-
-
-
- public void testGetReferencedColumnName() throws Exception {
- ICompilationUnit cu = this.createTestPrimaryKeyJoinColumnWithReferencedColumnName();
- JavaResourcePersistentType typeResource = buildJavaTypeResource(cu);
- JavaResourcePersistentAttribute attributeResource = typeResource.fields().next();
- PrimaryKeyJoinColumnAnnotation column = (PrimaryKeyJoinColumnAnnotation) attributeResource.getSupportingAnnotation(JPA.PRIMARY_KEY_JOIN_COLUMN);
- assertEquals(COLUMN_REFERENCED_COLUMN_NAME, column.getReferencedColumnName());
- }
-
- public void testSetReferencedColumnName() throws Exception {
- ICompilationUnit cu = this.createTestPrimaryKeyJoinColumn();
- JavaResourcePersistentType typeResource = buildJavaTypeResource(cu);
- JavaResourcePersistentAttribute attributeResource = typeResource.fields().next();
- PrimaryKeyJoinColumnAnnotation column = (PrimaryKeyJoinColumnAnnotation) attributeResource.getSupportingAnnotation(JPA.PRIMARY_KEY_JOIN_COLUMN);
-
- assertNotNull(column);
- assertNull(column.getReferencedColumnName());
-
- column.setReferencedColumnName("Foo");
- assertEquals("Foo", column.getReferencedColumnName());
-
- assertSourceContains("@PrimaryKeyJoinColumn(referencedColumnName = \"Foo\")", cu);
-
-
- column.setReferencedColumnName(null);
- assertSourceDoesNotContain("@PrimaryKeyJoinColumn", cu);
- }
-
- public void testGetColumnDefinition() throws Exception {
- ICompilationUnit cu = this.createTestPrimaryKeyJoinColumnWithColumnDefinition();
- JavaResourcePersistentType typeResource = buildJavaTypeResource(cu);
- JavaResourcePersistentAttribute attributeResource = typeResource.fields().next();
- PrimaryKeyJoinColumnAnnotation column = (PrimaryKeyJoinColumnAnnotation) attributeResource.getSupportingAnnotation(JPA.PRIMARY_KEY_JOIN_COLUMN);
- assertEquals(COLUMN_COLUMN_DEFINITION, column.getColumnDefinition());
- }
-
- public void testSetColumnDefinition() throws Exception {
- ICompilationUnit cu = this.createTestPrimaryKeyJoinColumn();
- JavaResourcePersistentType typeResource = buildJavaTypeResource(cu);
- JavaResourcePersistentAttribute attributeResource = typeResource.fields().next();
- PrimaryKeyJoinColumnAnnotation column = (PrimaryKeyJoinColumnAnnotation) attributeResource.getSupportingAnnotation(JPA.PRIMARY_KEY_JOIN_COLUMN);
-
- assertNotNull(column);
- assertNull(column.getColumnDefinition());
-
- column.setColumnDefinition("Foo");
- assertEquals("Foo", column.getColumnDefinition());
-
- assertSourceContains("@PrimaryKeyJoinColumn(columnDefinition = \"Foo\")", cu);
-
-
- column.setColumnDefinition(null);
- assertSourceDoesNotContain("@PrimaryKeyJoinColumn", cu);
- }
-
-}
diff --git a/jpa/tests/org.eclipse.jpt.core.tests/src/org/eclipse/jpt/core/tests/internal/resource/java/PrimaryKeyJoinColumnsTests.java b/jpa/tests/org.eclipse.jpt.core.tests/src/org/eclipse/jpt/core/tests/internal/resource/java/PrimaryKeyJoinColumnsTests.java
deleted file mode 100644
index 1e01f24d38..0000000000
--- a/jpa/tests/org.eclipse.jpt.core.tests/src/org/eclipse/jpt/core/tests/internal/resource/java/PrimaryKeyJoinColumnsTests.java
+++ /dev/null
@@ -1,252 +0,0 @@
-/*******************************************************************************
- * Copyright (c) 2007, 2009 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.
- *
- * Contributors:
- * Oracle - initial API and implementation
- ******************************************************************************/
-package org.eclipse.jpt.core.tests.internal.resource.java;
-
-import java.util.Iterator;
-
-import org.eclipse.jdt.core.ICompilationUnit;
-import org.eclipse.jpt.core.resource.java.JPA;
-import org.eclipse.jpt.core.resource.java.JavaResourcePersistentAttribute;
-import org.eclipse.jpt.core.resource.java.JavaResourcePersistentType;
-import org.eclipse.jpt.core.resource.java.NestableAnnotation;
-import org.eclipse.jpt.core.resource.java.PrimaryKeyJoinColumnAnnotation;
-import org.eclipse.jpt.utility.internal.CollectionTools;
-import org.eclipse.jpt.utility.internal.iterators.ArrayIterator;
-
-@SuppressWarnings("nls")
-public class PrimaryKeyJoinColumnsTests extends JavaResourceModelTestCase {
-
- private static final String COLUMN_NAME = "MY_COLUMN";
- private static final String COLUMN_COLUMN_DEFINITION = "COLUMN_DEFINITION";
- private static final String COLUMN_REFERENCED_COLUMN_NAME = "MY_REF_COLUMN_NAME";
-
- public PrimaryKeyJoinColumnsTests(String name) {
- super(name);
- }
-
- private ICompilationUnit createTestPrimaryKeyJoinColumns() throws Exception {
- return this.createTestType(new DefaultAnnotationWriter() {
- @Override
- public Iterator<String> imports() {
- return new ArrayIterator<String>(JPA.PRIMARY_KEY_JOIN_COLUMN, JPA.PRIMARY_KEY_JOIN_COLUMNS);
- }
- @Override
- public void appendIdFieldAnnotationTo(StringBuilder sb) {
- sb.append("@PrimaryKeyJoinColumns(@PrimaryKeyJoinColumn)");
- }
- });
- }
-
- private ICompilationUnit createTestPrimaryKeyJoinColumnWithName() throws Exception {
- return this.createTestType(new DefaultAnnotationWriter() {
- @Override
- public Iterator<String> imports() {
- return new ArrayIterator<String>(JPA.PRIMARY_KEY_JOIN_COLUMN, JPA.PRIMARY_KEY_JOIN_COLUMNS);
- }
- @Override
- public void appendIdFieldAnnotationTo(StringBuilder sb) {
- sb.append("@PrimaryKeyJoinColumns(@PrimaryKeyJoinColumn(name = \"" + COLUMN_NAME + "\"))");
- }
- });
- }
-
- private ICompilationUnit createTestPrimaryKeyJoinColumnWithReferencedColumnName() throws Exception {
- return this.createTestType(new DefaultAnnotationWriter() {
- @Override
- public Iterator<String> imports() {
- return new ArrayIterator<String>(JPA.PRIMARY_KEY_JOIN_COLUMN, JPA.PRIMARY_KEY_JOIN_COLUMNS);
- }
- @Override
- public void appendIdFieldAnnotationTo(StringBuilder sb) {
- sb.append("@PrimaryKeyJoinColumns(@PrimaryKeyJoinColumn(referencedColumnName = \"" + COLUMN_REFERENCED_COLUMN_NAME + "\"))");
- }
- });
- }
-
- private ICompilationUnit createTestPrimaryKeyJoinColumnWithColumnDefinition() throws Exception {
- return this.createTestType(new DefaultAnnotationWriter() {
- @Override
- public Iterator<String> imports() {
- return new ArrayIterator<String>(JPA.PRIMARY_KEY_JOIN_COLUMN, JPA.PRIMARY_KEY_JOIN_COLUMNS);
- }
- @Override
- public void appendIdFieldAnnotationTo(StringBuilder sb) {
- sb.append("@PrimaryKeyJoinColumns(@PrimaryKeyJoinColumn(columnDefinition = \"" + COLUMN_COLUMN_DEFINITION + "\"))");
- }
- });
- }
-
- private ICompilationUnit createTestPrimaryKeyJoinColumn() throws Exception {
- return this.createTestType(new DefaultAnnotationWriter() {
- @Override
- public Iterator<String> imports() {
- return new ArrayIterator<String>(JPA.PRIMARY_KEY_JOIN_COLUMN, JPA.PRIMARY_KEY_JOIN_COLUMNS);
- }
- @Override
- public void appendIdFieldAnnotationTo(StringBuilder sb) {
- sb.append("@PrimaryKeyJoinColumn(name = \"BAR\", columnDefinition = \"COLUMN_DEF\", referencedColumnName = \"REF_NAME\")");
- }
- });
- }
-
- public void testGetName() throws Exception {
- ICompilationUnit cu = this.createTestPrimaryKeyJoinColumnWithName();
- JavaResourcePersistentType typeResource = buildJavaTypeResource(cu);
- JavaResourcePersistentAttribute attributeResource = typeResource.fields().next();
- PrimaryKeyJoinColumnAnnotation column = (PrimaryKeyJoinColumnAnnotation) attributeResource.supportingAnnotations(JPA.PRIMARY_KEY_JOIN_COLUMN, JPA.PRIMARY_KEY_JOIN_COLUMNS).next();
- assertNotNull(column);
- assertEquals(COLUMN_NAME, column.getName());
- }
-
- public void testGetNull() throws Exception {
- ICompilationUnit cu = this.createTestPrimaryKeyJoinColumns();
- JavaResourcePersistentType typeResource = buildJavaTypeResource(cu);
- JavaResourcePersistentAttribute attributeResource = typeResource.fields().next();
- PrimaryKeyJoinColumnAnnotation column = (PrimaryKeyJoinColumnAnnotation) attributeResource.supportingAnnotations(JPA.PRIMARY_KEY_JOIN_COLUMN, JPA.PRIMARY_KEY_JOIN_COLUMNS).next();
- assertNotNull(column);
- assertNull(column.getName());
- assertNull(column.getReferencedColumnName());
- assertNull(column.getColumnDefinition());
- }
-
- public void testSetName() throws Exception {
- ICompilationUnit cu = this.createTestPrimaryKeyJoinColumns();
- JavaResourcePersistentType typeResource = buildJavaTypeResource(cu);
- JavaResourcePersistentAttribute attributeResource = typeResource.fields().next();
- PrimaryKeyJoinColumnAnnotation column = (PrimaryKeyJoinColumnAnnotation) attributeResource.supportingAnnotations(JPA.PRIMARY_KEY_JOIN_COLUMN, JPA.PRIMARY_KEY_JOIN_COLUMNS).next();
-
- assertNotNull(column);
- assertNull(column.getName());
-
- column.setName("Foo");
- assertEquals("Foo", column.getName());
-
- assertSourceContains("@PrimaryKeyJoinColumns(@PrimaryKeyJoinColumn(name = \"Foo\"))", cu);
- }
-
- public void testSetNameNull() throws Exception {
- ICompilationUnit cu = this.createTestPrimaryKeyJoinColumnWithName();
- JavaResourcePersistentType typeResource = buildJavaTypeResource(cu);
- JavaResourcePersistentAttribute attributeResource = typeResource.fields().next();
- PrimaryKeyJoinColumnAnnotation column = (PrimaryKeyJoinColumnAnnotation) attributeResource.supportingAnnotations(JPA.PRIMARY_KEY_JOIN_COLUMN, JPA.PRIMARY_KEY_JOIN_COLUMNS).next();
-
- assertEquals(COLUMN_NAME, column.getName());
-
- column.setName(null);
- assertNull(column.getName());
-
- assertSourceDoesNotContain("@PrimaryKeyJoinColumn", cu);
- }
-
- public void testGetReferencedColumnName() throws Exception {
- ICompilationUnit cu = this.createTestPrimaryKeyJoinColumnWithReferencedColumnName();
- JavaResourcePersistentType typeResource = buildJavaTypeResource(cu);
- JavaResourcePersistentAttribute attributeResource = typeResource.fields().next();
- PrimaryKeyJoinColumnAnnotation column = (PrimaryKeyJoinColumnAnnotation) attributeResource.supportingAnnotations(JPA.PRIMARY_KEY_JOIN_COLUMN, JPA.PRIMARY_KEY_JOIN_COLUMNS).next();
- assertEquals(COLUMN_REFERENCED_COLUMN_NAME, column.getReferencedColumnName());
- }
-
- public void testSetReferencedColumnName() throws Exception {
- ICompilationUnit cu = this.createTestPrimaryKeyJoinColumns();
- JavaResourcePersistentType typeResource = buildJavaTypeResource(cu);
- JavaResourcePersistentAttribute attributeResource = typeResource.fields().next();
- PrimaryKeyJoinColumnAnnotation column = (PrimaryKeyJoinColumnAnnotation) attributeResource.supportingAnnotations(JPA.PRIMARY_KEY_JOIN_COLUMN, JPA.PRIMARY_KEY_JOIN_COLUMNS).next();
-
- assertNotNull(column);
- assertNull(column.getReferencedColumnName());
-
- column.setReferencedColumnName("Foo");
- assertEquals("Foo", column.getReferencedColumnName());
-
- assertSourceContains("@PrimaryKeyJoinColumns(@PrimaryKeyJoinColumn(referencedColumnName = \"Foo\"))", cu);
-
-
- column.setReferencedColumnName(null);
- assertSourceDoesNotContain("@PrimaryKeyJoinColumn", cu);
- }
-
- public void testGetColumnDefinition() throws Exception {
- ICompilationUnit cu = this.createTestPrimaryKeyJoinColumnWithColumnDefinition();
- JavaResourcePersistentType typeResource = buildJavaTypeResource(cu);
- JavaResourcePersistentAttribute attributeResource = typeResource.fields().next();
- PrimaryKeyJoinColumnAnnotation column = (PrimaryKeyJoinColumnAnnotation) attributeResource.supportingAnnotations(JPA.PRIMARY_KEY_JOIN_COLUMN, JPA.PRIMARY_KEY_JOIN_COLUMNS).next();
- assertEquals(COLUMN_COLUMN_DEFINITION, column.getColumnDefinition());
- }
-
- public void testSetColumnDefinition() throws Exception {
- ICompilationUnit cu = this.createTestPrimaryKeyJoinColumns();
- JavaResourcePersistentType typeResource = buildJavaTypeResource(cu);
- JavaResourcePersistentAttribute attributeResource = typeResource.fields().next();
- PrimaryKeyJoinColumnAnnotation column = (PrimaryKeyJoinColumnAnnotation) attributeResource.supportingAnnotations(JPA.PRIMARY_KEY_JOIN_COLUMN, JPA.PRIMARY_KEY_JOIN_COLUMNS).next();
-
- assertNotNull(column);
- assertNull(column.getColumnDefinition());
-
- column.setColumnDefinition("Foo");
- assertEquals("Foo", column.getColumnDefinition());
-
- assertSourceContains("@PrimaryKeyJoinColumns(@PrimaryKeyJoinColumn(columnDefinition = \"Foo\"))", cu);
-
-
- column.setColumnDefinition(null);
- assertSourceDoesNotContain("@PrimaryKeyJoinColumn", cu);
- }
-
-
- public void testAddPrimaryKeyJoinColumnCopyExisting() throws Exception {
- ICompilationUnit cu = createTestPrimaryKeyJoinColumn();
- JavaResourcePersistentType typeResource = buildJavaTypeResource(cu);
- JavaResourcePersistentAttribute attributeResource = typeResource.fields().next();
-
- PrimaryKeyJoinColumnAnnotation joinColumn = (PrimaryKeyJoinColumnAnnotation) attributeResource.addSupportingAnnotation(1, JPA.PRIMARY_KEY_JOIN_COLUMN, JPA.PRIMARY_KEY_JOIN_COLUMNS);
- joinColumn.setName("FOO");
- assertSourceContains("@PrimaryKeyJoinColumns({@PrimaryKeyJoinColumn(name = \"BAR\", columnDefinition = \"COLUMN_DEF\", referencedColumnName = \"REF_NAME\"),@PrimaryKeyJoinColumn(name = \"FOO\")})", cu);
-
- assertNull(attributeResource.getSupportingAnnotation(JPA.PRIMARY_KEY_JOIN_COLUMN));
- assertNotNull(attributeResource.getSupportingAnnotation(JPA.PRIMARY_KEY_JOIN_COLUMNS));
- assertEquals(2, CollectionTools.size(attributeResource.supportingAnnotations(JPA.PRIMARY_KEY_JOIN_COLUMN, JPA.PRIMARY_KEY_JOIN_COLUMNS)));
- }
- public void testAddPrimaryKeyJoinColumnToBeginningOfList() throws Exception {
- ICompilationUnit cu = createTestPrimaryKeyJoinColumn();
- JavaResourcePersistentType typeResource = buildJavaTypeResource(cu);
- JavaResourcePersistentAttribute attributeResource = typeResource.fields().next();
-
- PrimaryKeyJoinColumnAnnotation joinColumn = (PrimaryKeyJoinColumnAnnotation) attributeResource.addSupportingAnnotation(1, JPA.PRIMARY_KEY_JOIN_COLUMN, JPA.PRIMARY_KEY_JOIN_COLUMNS);
- joinColumn.setName("FOO");
- assertSourceContains("@PrimaryKeyJoinColumns({@PrimaryKeyJoinColumn(name = \"BAR\", columnDefinition = \"COLUMN_DEF\", referencedColumnName = \"REF_NAME\"),@PrimaryKeyJoinColumn(name = \"FOO\")})", cu);
-
- joinColumn = (PrimaryKeyJoinColumnAnnotation) attributeResource.addSupportingAnnotation(0, JPA.PRIMARY_KEY_JOIN_COLUMN, JPA.PRIMARY_KEY_JOIN_COLUMNS);
- joinColumn.setName("BAZ");
- assertSourceContains("@PrimaryKeyJoinColumns({@PrimaryKeyJoinColumn(name = \"BAZ\"),@PrimaryKeyJoinColumn(name = \"BAR\", columnDefinition = \"COLUMN_DEF\", referencedColumnName = \"REF_NAME\"), @PrimaryKeyJoinColumn(name = \"FOO\")})", cu);
-
- Iterator<NestableAnnotation> pkJoinColumns = attributeResource.supportingAnnotations(JPA.PRIMARY_KEY_JOIN_COLUMN, JPA.PRIMARY_KEY_JOIN_COLUMNS);
- assertEquals("BAZ", ((PrimaryKeyJoinColumnAnnotation) pkJoinColumns.next()).getName());
- assertEquals("BAR", ((PrimaryKeyJoinColumnAnnotation) pkJoinColumns.next()).getName());
- assertEquals("FOO", ((PrimaryKeyJoinColumnAnnotation) pkJoinColumns.next()).getName());
-
- assertNull(attributeResource.getSupportingAnnotation(JPA.PRIMARY_KEY_JOIN_COLUMN));
- assertNotNull(attributeResource.getSupportingAnnotation(JPA.PRIMARY_KEY_JOIN_COLUMNS));
- assertEquals(3, CollectionTools.size(attributeResource.supportingAnnotations(JPA.PRIMARY_KEY_JOIN_COLUMN, JPA.PRIMARY_KEY_JOIN_COLUMNS)));
- }
-
- public void testRemovePrimaryKeyJoinColumnCopyExisting() throws Exception {
- ICompilationUnit cu = createTestPrimaryKeyJoinColumn();
- JavaResourcePersistentType typeResource = buildJavaTypeResource(cu);
- JavaResourcePersistentAttribute attributeResource = typeResource.fields().next();
-
- PrimaryKeyJoinColumnAnnotation joinColumn = (PrimaryKeyJoinColumnAnnotation) attributeResource.addSupportingAnnotation(1, JPA.PRIMARY_KEY_JOIN_COLUMN, JPA.PRIMARY_KEY_JOIN_COLUMNS);
- joinColumn.setName("FOO");
- assertSourceContains("@PrimaryKeyJoinColumns({@PrimaryKeyJoinColumn(name = \"BAR\", columnDefinition = \"COLUMN_DEF\", referencedColumnName = \"REF_NAME\"),@PrimaryKeyJoinColumn(name = \"FOO\")})", cu);
-
- attributeResource.removeSupportingAnnotation(1, JPA.PRIMARY_KEY_JOIN_COLUMN, JPA.PRIMARY_KEY_JOIN_COLUMNS);
- assertSourceContains("@PrimaryKeyJoinColumn(name = \"BAR\", columnDefinition = \"COLUMN_DEF\", referencedColumnName = \"REF_NAME\")", cu);
- }
-
-}
diff --git a/jpa/tests/org.eclipse.jpt.core.tests/src/org/eclipse/jpt/core/tests/internal/resource/java/QueryHintTests.java b/jpa/tests/org.eclipse.jpt.core.tests/src/org/eclipse/jpt/core/tests/internal/resource/java/QueryHintTests.java
deleted file mode 100644
index b522972feb..0000000000
--- a/jpa/tests/org.eclipse.jpt.core.tests/src/org/eclipse/jpt/core/tests/internal/resource/java/QueryHintTests.java
+++ /dev/null
@@ -1,65 +0,0 @@
-/*******************************************************************************
- * Copyright (c) 2007, 2009 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.
- *
- * Contributors:
- * Oracle - initial API and implementation
- ******************************************************************************/
-package org.eclipse.jpt.core.tests.internal.resource.java;
-
-import java.util.Iterator;
-import org.eclipse.jdt.core.ICompilationUnit;
-import org.eclipse.jpt.core.resource.java.JPA;
-import org.eclipse.jpt.core.resource.java.JavaResourcePersistentType;
-import org.eclipse.jpt.core.resource.java.NamedQueryAnnotation;
-import org.eclipse.jpt.core.resource.java.QueryHintAnnotation;
-import org.eclipse.jpt.utility.internal.iterators.ArrayIterator;
-
-@SuppressWarnings("nls")
-public class QueryHintTests extends JavaResourceModelTestCase {
-
- private static final String QUERY_HINT_NAME = "myHint";
- private static final String QUERY_HINT_VALUE = "myValue";
-
- public QueryHintTests(String name) {
- super(name);
- }
-
- private ICompilationUnit createTestNamedQueryWithQueryHints() throws Exception {
- return this.createTestType(new DefaultAnnotationWriter() {
- @Override
- public Iterator<String> imports() {
- return new ArrayIterator<String>(JPA.NAMED_QUERY, JPA.QUERY_HINT);
- }
- @Override
- public void appendTypeAnnotationTo(StringBuilder sb) {
- sb.append("@NamedQuery(hints = {@QueryHint(name = \"" + QUERY_HINT_NAME + "\", value = \"" + QUERY_HINT_VALUE + "\"), @QueryHint})");
- }
- });
- }
-
- public void testGetName() throws Exception {
- ICompilationUnit cu = this.createTestNamedQueryWithQueryHints();
- JavaResourcePersistentType typeResource = buildJavaTypeResource(cu);
-
- NamedQueryAnnotation namedQuery = (NamedQueryAnnotation) typeResource.getSupportingAnnotation(JPA.NAMED_QUERY);
- QueryHintAnnotation queryHint = namedQuery.hints().next();
- assertEquals(QUERY_HINT_NAME, queryHint.getName());
- }
-
- public void testSetName() throws Exception {
- ICompilationUnit cu = this.createTestNamedQueryWithQueryHints();
- JavaResourcePersistentType typeResource = buildJavaTypeResource(cu);
-
- NamedQueryAnnotation namedQuery = (NamedQueryAnnotation) typeResource.getSupportingAnnotation(JPA.NAMED_QUERY);
- QueryHintAnnotation queryHint = namedQuery.hints().next();
- assertEquals(QUERY_HINT_NAME, queryHint.getName());
-
- queryHint.setName("foo");
- assertEquals("foo", queryHint.getName());
-
- assertSourceContains("@QueryHint(name = \"foo\", value = \"" + QUERY_HINT_VALUE + "\")", cu);
- }
-}
diff --git a/jpa/tests/org.eclipse.jpt.core.tests/src/org/eclipse/jpt/core/tests/internal/resource/java/SecondaryTableTests.java b/jpa/tests/org.eclipse.jpt.core.tests/src/org/eclipse/jpt/core/tests/internal/resource/java/SecondaryTableTests.java
deleted file mode 100644
index 357596a1f6..0000000000
--- a/jpa/tests/org.eclipse.jpt.core.tests/src/org/eclipse/jpt/core/tests/internal/resource/java/SecondaryTableTests.java
+++ /dev/null
@@ -1,436 +0,0 @@
-/*******************************************************************************
- * Copyright (c) 2007, 2009 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.
- *
- * Contributors:
- * Oracle - initial API and implementation
- ******************************************************************************/
-package org.eclipse.jpt.core.tests.internal.resource.java;
-
-import java.util.Iterator;
-import org.eclipse.jdt.core.ICompilationUnit;
-import org.eclipse.jpt.core.resource.java.JPA;
-import org.eclipse.jpt.core.resource.java.JavaResourcePersistentType;
-import org.eclipse.jpt.core.resource.java.PrimaryKeyJoinColumnAnnotation;
-import org.eclipse.jpt.core.resource.java.SecondaryTableAnnotation;
-import org.eclipse.jpt.core.resource.java.UniqueConstraintAnnotation;
-import org.eclipse.jpt.utility.internal.iterators.ArrayIterator;
-
-@SuppressWarnings("nls")
-public class SecondaryTableTests extends JavaResourceModelTestCase {
-
- private static final String TABLE_NAME = "MY_TABLE";
- private static final String SCHEMA_NAME = "MY_SCHEMA";
- private static final String CATALOG_NAME = "MY_CATALOG";
-
- public SecondaryTableTests(String name) {
- super(name);
- }
-
- private ICompilationUnit createTestSecondaryTable() throws Exception {
- return this.createTestType(new DefaultAnnotationWriter() {
- @Override
- public Iterator<String> imports() {
- return new ArrayIterator<String>(JPA.SECONDARY_TABLE);
- }
- @Override
- public void appendTypeAnnotationTo(StringBuilder sb) {
- sb.append("@SecondaryTable");
- }
- });
- }
-
- private ICompilationUnit createTestSecondaryTableWithName() throws Exception {
- return this.createTestType(new DefaultAnnotationWriter() {
- @Override
- public Iterator<String> imports() {
- return new ArrayIterator<String>(JPA.SECONDARY_TABLE);
- }
- @Override
- public void appendTypeAnnotationTo(StringBuilder sb) {
- sb.append("@SecondaryTable(name = \"" + TABLE_NAME + "\")");
- }
- });
- }
-
- private ICompilationUnit createTestSecondaryTableWithSchema() throws Exception {
- return this.createTestType(new DefaultAnnotationWriter() {
- @Override
- public Iterator<String> imports() {
- return new ArrayIterator<String>(JPA.SECONDARY_TABLE);
- }
- @Override
- public void appendTypeAnnotationTo(StringBuilder sb) {
- sb.append("@SecondaryTable(schema = \"" + SCHEMA_NAME + "\")");
- }
- });
- }
-
- private ICompilationUnit createTestSecondaryTableWithCatalog() throws Exception {
- return this.createTestType(new DefaultAnnotationWriter() {
- @Override
- public Iterator<String> imports() {
- return new ArrayIterator<String>(JPA.SECONDARY_TABLE);
- }
- @Override
- public void appendTypeAnnotationTo(StringBuilder sb) {
- sb.append("@SecondaryTable(catalog = \"" + CATALOG_NAME + "\")");
- }
- });
- }
-
- private ICompilationUnit createTestSecondaryTableWithUniqueConstraints() throws Exception {
- return this.createTestType(new DefaultAnnotationWriter() {
- @Override
- public Iterator<String> imports() {
- return new ArrayIterator<String>(JPA.SECONDARY_TABLE, JPA.UNIQUE_CONSTRAINT);
- }
- @Override
- public void appendTypeAnnotationTo(StringBuilder sb) {
- sb.append("@SecondaryTable(uniqueConstraints = {@UniqueConstraint(columnNames = {\"BAR\"}), @UniqueConstraint(columnNames = {\"FOO\"}), @UniqueConstraint(columnNames = {\"BAZ\"})})");
- }
- });
- }
-
- private ICompilationUnit createTestSecondaryTableWithPkJoinColumns() throws Exception {
- return this.createTestType(new DefaultAnnotationWriter() {
- @Override
- public Iterator<String> imports() {
- return new ArrayIterator<String>(JPA.SECONDARY_TABLE, JPA.PRIMARY_KEY_JOIN_COLUMN);
- }
- @Override
- public void appendTypeAnnotationTo(StringBuilder sb) {
- sb.append("@SecondaryTable(pkJoinColumns = {@PrimaryKeyJoinColumn(name = \"BAR\"), @PrimaryKeyJoinColumn(name = \"FOO\"), @PrimaryKeyJoinColumn(name = \"BAZ\")})");
- }
- });
- }
-
- public void testGetName() throws Exception {
- ICompilationUnit cu = this.createTestSecondaryTableWithName();
- JavaResourcePersistentType typeResource = buildJavaTypeResource(cu);
-
- SecondaryTableAnnotation table = (SecondaryTableAnnotation) typeResource.getSupportingAnnotation(JPA.SECONDARY_TABLE);
- assertNotNull(table);
- assertEquals(TABLE_NAME, table.getName());
- }
-
- public void testGetNull() throws Exception {
- ICompilationUnit cu = this.createTestSecondaryTable();
- JavaResourcePersistentType typeResource = buildJavaTypeResource(cu);
-
- SecondaryTableAnnotation table = (SecondaryTableAnnotation) typeResource.getSupportingAnnotation(JPA.SECONDARY_TABLE);
- assertNotNull(table);
- assertNull(table.getName());
- assertNull(table.getCatalog());
- assertNull(table.getSchema());
- }
-
- public void testSetName() throws Exception {
- ICompilationUnit cu = this.createTestSecondaryTable();
- JavaResourcePersistentType typeResource = buildJavaTypeResource(cu);
-
- SecondaryTableAnnotation table = (SecondaryTableAnnotation) typeResource.getSupportingAnnotation(JPA.SECONDARY_TABLE);
- assertNotNull(table);
- assertNull(table.getName());
-
- table.setName("Foo");
- assertEquals("Foo", table.getName());
-
- assertSourceContains("@SecondaryTable(name = \"Foo\")", cu);
- }
-
- public void testSetNameNull() throws Exception {
- ICompilationUnit cu = this.createTestSecondaryTableWithName();
- JavaResourcePersistentType typeResource = buildJavaTypeResource(cu);
-
- SecondaryTableAnnotation table = (SecondaryTableAnnotation) typeResource.getSupportingAnnotation(JPA.SECONDARY_TABLE);
- assertEquals(TABLE_NAME, table.getName());
-
- table.setName(null);
- assertNull(table.getName());
-
- assertSourceDoesNotContain("@SecondaryTable", cu);
- }
-
- public void testGetCatalog() throws Exception {
- ICompilationUnit cu = this.createTestSecondaryTableWithCatalog();
- JavaResourcePersistentType typeResource = buildJavaTypeResource(cu);
-
- SecondaryTableAnnotation table = (SecondaryTableAnnotation) typeResource.getSupportingAnnotation(JPA.SECONDARY_TABLE);
- assertNotNull(table);
- assertEquals(CATALOG_NAME, table.getCatalog());
- }
-
- public void testSetCatalog() throws Exception {
- ICompilationUnit cu = this.createTestSecondaryTable();
- JavaResourcePersistentType typeResource = buildJavaTypeResource(cu);
-
- SecondaryTableAnnotation table = (SecondaryTableAnnotation) typeResource.getSupportingAnnotation(JPA.SECONDARY_TABLE);
- assertNotNull(table);
- assertNull(table.getCatalog());
-
- table.setCatalog("Foo");
- assertEquals("Foo", table.getCatalog());
-
- assertSourceContains("@SecondaryTable(catalog = \"Foo\")", cu);
- }
-
- public void testSetCatalogNull() throws Exception {
- ICompilationUnit cu = this.createTestSecondaryTableWithCatalog();
- JavaResourcePersistentType typeResource = buildJavaTypeResource(cu);
-
- SecondaryTableAnnotation table = (SecondaryTableAnnotation) typeResource.getSupportingAnnotation(JPA.SECONDARY_TABLE);
- assertEquals(CATALOG_NAME, table.getCatalog());
-
- table.setCatalog(null);
- assertNull(table.getCatalog());
-
- assertSourceDoesNotContain("@SecondaryTable", cu);
- }
-
- public void testGetSchema() throws Exception {
- ICompilationUnit cu = this.createTestSecondaryTableWithSchema();
- JavaResourcePersistentType typeResource = buildJavaTypeResource(cu);
-
- SecondaryTableAnnotation table = (SecondaryTableAnnotation) typeResource.getSupportingAnnotation(JPA.SECONDARY_TABLE);
- assertNotNull(table);
- assertEquals(SCHEMA_NAME, table.getSchema());
- }
-
- public void testSetSchema() throws Exception {
- ICompilationUnit cu = this.createTestSecondaryTable();
- JavaResourcePersistentType typeResource = buildJavaTypeResource(cu);
-
- SecondaryTableAnnotation table = (SecondaryTableAnnotation) typeResource.getSupportingAnnotation(JPA.SECONDARY_TABLE);
- assertNotNull(table);
- assertNull(table.getSchema());
-
- table.setSchema("Foo");
- assertEquals("Foo", table.getSchema());
-
- assertSourceContains("@SecondaryTable(schema = \"Foo\")", cu);
- }
-
- public void testSetSchemaNull() throws Exception {
- ICompilationUnit cu = this.createTestSecondaryTableWithSchema();
- JavaResourcePersistentType typeResource = buildJavaTypeResource(cu);
-
- SecondaryTableAnnotation table = (SecondaryTableAnnotation) typeResource.getSupportingAnnotation(JPA.SECONDARY_TABLE);
- assertEquals(SCHEMA_NAME, table.getSchema());
-
- table.setSchema(null);
- assertNull(table.getSchema());
-
- assertSourceDoesNotContain("@SecondaryTable", cu);
- }
-
-
- public void testUniqueConstraints() throws Exception {
- ICompilationUnit cu = this.createTestSecondaryTable();
- JavaResourcePersistentType typeResource = buildJavaTypeResource(cu);
- SecondaryTableAnnotation table = (SecondaryTableAnnotation) typeResource.getSupportingAnnotation(JPA.SECONDARY_TABLE);
-
- assertEquals(0, table.uniqueConstraintsSize());
- }
-
- public void testUniqueConstraints2() throws Exception {
- ICompilationUnit cu = this.createTestSecondaryTable();
- JavaResourcePersistentType typeResource = buildJavaTypeResource(cu);
- SecondaryTableAnnotation table = (SecondaryTableAnnotation) typeResource.getSupportingAnnotation(JPA.SECONDARY_TABLE);
-
- table.addUniqueConstraint(0);
- table.addUniqueConstraint(1);
-
- assertEquals(2, table.uniqueConstraintsSize());
- }
-
- public void testUniqueConstraints3() throws Exception {
- ICompilationUnit cu = this.createTestSecondaryTableWithUniqueConstraints();
- JavaResourcePersistentType typeResource = buildJavaTypeResource(cu);
- SecondaryTableAnnotation table = (SecondaryTableAnnotation) typeResource.getSupportingAnnotation(JPA.SECONDARY_TABLE);
-
- assertEquals(3, table.uniqueConstraintsSize());
- }
-
- public void testAddUniqueConstraint() throws Exception {
- ICompilationUnit cu = this.createTestSecondaryTable();
- JavaResourcePersistentType typeResource = buildJavaTypeResource(cu);
- SecondaryTableAnnotation table = (SecondaryTableAnnotation) typeResource.getSupportingAnnotation(JPA.SECONDARY_TABLE);
-
- table.addUniqueConstraint(0).addColumnName("FOO");
- table.addUniqueConstraint(1);
- table.addUniqueConstraint(0).addColumnName("BAR");
-
- assertEquals("BAR", table.uniqueConstraintAt(0).columnNames().next());
- assertEquals("FOO", table.uniqueConstraintAt(1).columnNames().next());
- assertEquals(0, table.uniqueConstraintAt(2).columnNamesSize());
-
- assertSourceContains("@SecondaryTable(uniqueConstraints = {@UniqueConstraint(columnNames = \"BAR\"),@UniqueConstraint(columnNames = \"FOO\"), @UniqueConstraint})", cu);
- }
-
- public void testRemoveUniqueConstraint() throws Exception {
- ICompilationUnit cu = this.createTestSecondaryTableWithUniqueConstraints();
- JavaResourcePersistentType typeResource = buildJavaTypeResource(cu);
- SecondaryTableAnnotation table = (SecondaryTableAnnotation) typeResource.getSupportingAnnotation(JPA.SECONDARY_TABLE);
-
- table.removeUniqueConstraint(1);
- Iterator<UniqueConstraintAnnotation> uniqueConstraints = table.uniqueConstraints();
- assertEquals("BAR", uniqueConstraints.next().columnNames().next());
- assertEquals("BAZ", uniqueConstraints.next().columnNames().next());
- assertFalse(uniqueConstraints.hasNext());
- assertSourceContains("@SecondaryTable(uniqueConstraints = {@UniqueConstraint(columnNames = {\"BAR\"}), @UniqueConstraint(columnNames = {\"BAZ\"})})", cu);
-
- table.removeUniqueConstraint(0);
- uniqueConstraints = table.uniqueConstraints();
- assertEquals("BAZ", uniqueConstraints.next().columnNames().next());
- assertFalse(uniqueConstraints.hasNext());
- assertSourceContains("@SecondaryTable(uniqueConstraints = @UniqueConstraint(columnNames = {\"BAZ\"}))", cu);
-
- table.removeUniqueConstraint(0);
- uniqueConstraints = table.uniqueConstraints();
- assertFalse(uniqueConstraints.hasNext());
- assertSourceDoesNotContain("@SecondaryTable", cu);
- }
-
- public void testMoveUniqueConstraint() throws Exception {
- ICompilationUnit cu = this.createTestSecondaryTableWithUniqueConstraints();
- JavaResourcePersistentType typeResource = buildJavaTypeResource(cu);
- SecondaryTableAnnotation secondaryTable = (SecondaryTableAnnotation) typeResource.getSupportingAnnotation(JPA.SECONDARY_TABLE);
-
- assertEquals("BAR", secondaryTable.uniqueConstraintAt(0).columnNames().next());
- assertEquals("FOO", secondaryTable.uniqueConstraintAt(1).columnNames().next());
- assertEquals("BAZ", secondaryTable.uniqueConstraintAt(2).columnNames().next());
- assertEquals(3, secondaryTable.uniqueConstraintsSize());
-
- secondaryTable.moveUniqueConstraint(2, 0);
- assertEquals("FOO", secondaryTable.uniqueConstraintAt(0).columnNames().next());
- assertEquals("BAZ", secondaryTable.uniqueConstraintAt(1).columnNames().next());
- assertEquals("BAR", secondaryTable.uniqueConstraintAt(2).columnNames().next());
- assertEquals(3, secondaryTable.uniqueConstraintsSize());
- assertSourceContains("@SecondaryTable(uniqueConstraints = {@UniqueConstraint(columnNames = {\"FOO\"}), @UniqueConstraint(columnNames = {\"BAZ\"}), @UniqueConstraint(columnNames = {\"BAR\"})})", cu);
- }
-
- public void testMoveUniqueConstraint2() throws Exception {
- ICompilationUnit cu = this.createTestSecondaryTableWithUniqueConstraints();
- JavaResourcePersistentType typeResource = buildJavaTypeResource(cu);
- SecondaryTableAnnotation secondaryTable = (SecondaryTableAnnotation) typeResource.getSupportingAnnotation(JPA.SECONDARY_TABLE);
-
- assertEquals("BAR", secondaryTable.uniqueConstraintAt(0).columnNames().next());
- assertEquals("FOO", secondaryTable.uniqueConstraintAt(1).columnNames().next());
- assertEquals("BAZ", secondaryTable.uniqueConstraintAt(2).columnNames().next());
- assertEquals(3, secondaryTable.uniqueConstraintsSize());
-
- secondaryTable.moveUniqueConstraint(0, 2);
- assertEquals("BAZ", secondaryTable.uniqueConstraintAt(0).columnNames().next());
- assertEquals("BAR", secondaryTable.uniqueConstraintAt(1).columnNames().next());
- assertEquals("FOO", secondaryTable.uniqueConstraintAt(2).columnNames().next());
- assertEquals(3, secondaryTable.uniqueConstraintsSize());
- assertSourceContains("@SecondaryTable(uniqueConstraints = {@UniqueConstraint(columnNames = {\"BAZ\"}), @UniqueConstraint(columnNames = {\"BAR\"}), @UniqueConstraint(columnNames = {\"FOO\"})})", cu);
- }
-
-
- public void testPkJoinColumns() throws Exception {
- ICompilationUnit cu = this.createTestSecondaryTable();
- JavaResourcePersistentType typeResource = buildJavaTypeResource(cu);
- SecondaryTableAnnotation table = (SecondaryTableAnnotation) typeResource.getSupportingAnnotation(JPA.SECONDARY_TABLE);
-
- assertEquals(0, table.pkJoinColumnsSize());
- }
-
- public void testPkJoinColumns2() throws Exception {
- ICompilationUnit cu = this.createTestSecondaryTable();
- JavaResourcePersistentType typeResource = buildJavaTypeResource(cu);
- SecondaryTableAnnotation table = (SecondaryTableAnnotation) typeResource.getSupportingAnnotation(JPA.SECONDARY_TABLE);
-
- table.addPkJoinColumn(0);
- table.addPkJoinColumn(1);
-
- assertEquals(2, table.pkJoinColumnsSize());
- }
-
- public void testPkJoinColumns3() throws Exception {
- ICompilationUnit cu = this.createTestSecondaryTableWithPkJoinColumns();
- JavaResourcePersistentType typeResource = buildJavaTypeResource(cu);
- SecondaryTableAnnotation table = (SecondaryTableAnnotation) typeResource.getSupportingAnnotation(JPA.SECONDARY_TABLE);
-
- assertEquals(3, table.pkJoinColumnsSize());
- }
-
- public void testAddPkJoinColumn() throws Exception {
- ICompilationUnit cu = this.createTestSecondaryTable();
- JavaResourcePersistentType typeResource = buildJavaTypeResource(cu);
- SecondaryTableAnnotation table = (SecondaryTableAnnotation) typeResource.getSupportingAnnotation(JPA.SECONDARY_TABLE);
-
-
- table.addPkJoinColumn(0).setName("FOO");
- table.addPkJoinColumn(0);
- table.addPkJoinColumn(0).setName("BAR");//test adding a pkJoinColumn in front of 2 other joinColumns
-
- assertEquals("BAR", table.pkJoinColumnAt(0).getName());
- assertNull(table.pkJoinColumnAt(1).getName());
- assertEquals("FOO", table.pkJoinColumnAt(2).getName());
-
- assertEquals(3, table.pkJoinColumnsSize());
- assertSourceContains("@SecondaryTable(pkJoinColumns = {@PrimaryKeyJoinColumn(name = \"BAR\"),@PrimaryKeyJoinColumn, @PrimaryKeyJoinColumn(name = \"FOO\")})", cu);
- }
-
- public void testRemovePkJoinColumn() throws Exception {
- ICompilationUnit cu = this.createTestSecondaryTableWithPkJoinColumns();
- JavaResourcePersistentType typeResource = buildJavaTypeResource(cu);
- SecondaryTableAnnotation table = (SecondaryTableAnnotation) typeResource.getSupportingAnnotation(JPA.SECONDARY_TABLE);
-
- table.removePkJoinColumn(1);
- assertSourceContains("@SecondaryTable(pkJoinColumns = {@PrimaryKeyJoinColumn(name = \"BAR\"), @PrimaryKeyJoinColumn(name = \"BAZ\")})", cu);
-
- table.removePkJoinColumn(0);
- assertSourceContains("@SecondaryTable(pkJoinColumns = @PrimaryKeyJoinColumn(name = \"BAZ\"))", cu);
-
-
- table.removePkJoinColumn(0);
- assertSourceDoesNotContain("@SecondaryTable", cu);
- }
-
- public void testMovePkJoinColumn() throws Exception {
- ICompilationUnit cu = this.createTestSecondaryTableWithPkJoinColumns();
- JavaResourcePersistentType typeResource = buildJavaTypeResource(cu);
- SecondaryTableAnnotation table = (SecondaryTableAnnotation) typeResource.getSupportingAnnotation(JPA.SECONDARY_TABLE);
- PrimaryKeyJoinColumnAnnotation joinColumn = table.pkJoinColumnAt(0);
- joinColumn.setReferencedColumnName("REF_NAME");
- joinColumn.setColumnDefinition("COLUMN_DEF");
- table.movePkJoinColumn(2, 0);
- assertSourceContains("@SecondaryTable(pkJoinColumns = {@PrimaryKeyJoinColumn(name = \"FOO\"), @PrimaryKeyJoinColumn(name = \"BAZ\"), @PrimaryKeyJoinColumn(name = \"BAR\", referencedColumnName = \"REF_NAME\", columnDefinition = \"COLUMN_DEF\")})", cu);
- }
-
- public void testMovePkJoinColumn2() throws Exception {
- ICompilationUnit cu = this.createTestSecondaryTableWithPkJoinColumns();
- JavaResourcePersistentType typeResource = buildJavaTypeResource(cu);
- SecondaryTableAnnotation table = (SecondaryTableAnnotation) typeResource.getSupportingAnnotation(JPA.SECONDARY_TABLE);
-
-
- PrimaryKeyJoinColumnAnnotation joinColumn = table.pkJoinColumnAt(0);
- joinColumn.setReferencedColumnName("REF_NAME");
- joinColumn.setColumnDefinition("COLUMN_DEF");
- table.movePkJoinColumn(0, 2);
- assertSourceContains("@SecondaryTable(pkJoinColumns = {@PrimaryKeyJoinColumn(name = \"BAZ\"), @PrimaryKeyJoinColumn(name = \"BAR\", referencedColumnName = \"REF_NAME\", columnDefinition = \"COLUMN_DEF\"), @PrimaryKeyJoinColumn(name = \"FOO\")})", cu);
- }
-
- public void testSetPkJoinColumnName() throws Exception {
- ICompilationUnit cu = this.createTestSecondaryTableWithPkJoinColumns();
- JavaResourcePersistentType typeResource = buildJavaTypeResource(cu);
- SecondaryTableAnnotation table = (SecondaryTableAnnotation) typeResource.getSupportingAnnotation(JPA.SECONDARY_TABLE);
-
- assertEquals(3, table.pkJoinColumnsSize());
-
- PrimaryKeyJoinColumnAnnotation joinColumn = table.pkJoinColumns().next();
-
- assertEquals("BAR", joinColumn.getName());
-
- joinColumn.setName("foo");
- assertEquals("foo", joinColumn.getName());
-
- assertSourceContains("@SecondaryTable(pkJoinColumns = {@PrimaryKeyJoinColumn(name = \"foo\"), @PrimaryKeyJoinColumn(name = \"FOO\"), @PrimaryKeyJoinColumn(name = \"BAZ\")})", cu);
- }
-
-}
diff --git a/jpa/tests/org.eclipse.jpt.core.tests/src/org/eclipse/jpt/core/tests/internal/resource/java/SecondaryTablesTests.java b/jpa/tests/org.eclipse.jpt.core.tests/src/org/eclipse/jpt/core/tests/internal/resource/java/SecondaryTablesTests.java
deleted file mode 100644
index 278f0f0f75..0000000000
--- a/jpa/tests/org.eclipse.jpt.core.tests/src/org/eclipse/jpt/core/tests/internal/resource/java/SecondaryTablesTests.java
+++ /dev/null
@@ -1,503 +0,0 @@
-/*******************************************************************************
- * Copyright (c) 2007, 2009 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.
- *
- * Contributors:
- * Oracle - initial API and implementation
- ******************************************************************************/
-package org.eclipse.jpt.core.tests.internal.resource.java;
-
-import java.util.Iterator;
-
-import org.eclipse.jdt.core.ICompilationUnit;
-import org.eclipse.jpt.core.resource.java.JPA;
-import org.eclipse.jpt.core.resource.java.JavaResourcePersistentType;
-import org.eclipse.jpt.core.resource.java.NestableAnnotation;
-import org.eclipse.jpt.core.resource.java.PrimaryKeyJoinColumnAnnotation;
-import org.eclipse.jpt.core.resource.java.SecondaryTableAnnotation;
-import org.eclipse.jpt.core.resource.java.SecondaryTablesAnnotation;
-import org.eclipse.jpt.utility.internal.CollectionTools;
-import org.eclipse.jpt.utility.internal.iterators.ArrayIterator;
-
-@SuppressWarnings("nls")
-public class SecondaryTablesTests extends JavaResourceModelTestCase {
-
- private static final String TABLE_NAME = "MY_TABLE";
- private static final String SCHEMA_NAME = "MY_SCHEMA";
- private static final String CATALOG_NAME = "MY_CATALOG";
-
- public SecondaryTablesTests(String name) {
- super(name);
- }
-
- private ICompilationUnit createTestSecondaryTables() throws Exception {
- return this.createTestType(new DefaultAnnotationWriter() {
- @Override
- public Iterator<String> imports() {
- return new ArrayIterator<String>(JPA.SECONDARY_TABLE, JPA.SECONDARY_TABLES);
- }
- @Override
- public void appendTypeAnnotationTo(StringBuilder sb) {
- sb.append("@SecondaryTables(@SecondaryTable)");
- }
- });
- }
-
- private ICompilationUnit createTestSecondaryTableWithName() throws Exception {
- return this.createTestType(new DefaultAnnotationWriter() {
- @Override
- public Iterator<String> imports() {
- return new ArrayIterator<String>(JPA.SECONDARY_TABLE, JPA.SECONDARY_TABLES);
- }
- @Override
- public void appendTypeAnnotationTo(StringBuilder sb) {
- sb.append("@SecondaryTables(@SecondaryTable(name = \"" + TABLE_NAME + "\"))");
- }
- });
- }
-
- private ICompilationUnit createTestSecondaryTableWithSchema() throws Exception {
- return this.createTestType(new DefaultAnnotationWriter() {
- @Override
- public Iterator<String> imports() {
- return new ArrayIterator<String>(JPA.SECONDARY_TABLE, JPA.SECONDARY_TABLES);
- }
- @Override
- public void appendTypeAnnotationTo(StringBuilder sb) {
- sb.append("@SecondaryTables(@SecondaryTable(schema = \"" + SCHEMA_NAME + "\"))");
- }
- });
- }
- private ICompilationUnit createTestSecondaryTableWithCatalog() throws Exception {
- return this.createTestType(new DefaultAnnotationWriter() {
- @Override
- public Iterator<String> imports() {
- return new ArrayIterator<String>(JPA.SECONDARY_TABLE, JPA.SECONDARY_TABLES);
- }
- @Override
- public void appendTypeAnnotationTo(StringBuilder sb) {
- sb.append("@SecondaryTables(@SecondaryTable(catalog = \"" + CATALOG_NAME + "\"))");
- }
- });
- }
-
-
- private ICompilationUnit createTestSecondaryTableWithUniqueConstraints() throws Exception {
- return this.createTestType(new DefaultAnnotationWriter() {
- @Override
- public Iterator<String> imports() {
- return new ArrayIterator<String>(JPA.SECONDARY_TABLE, JPA.SECONDARY_TABLES, JPA.UNIQUE_CONSTRAINT);
- }
- @Override
- public void appendTypeAnnotationTo(StringBuilder sb) {
- sb.append("@SecondaryTables(@SecondaryTable(uniqueConstraints = {@UniqueConstraint(columnNames = {\"BAR\"}), @UniqueConstraint}))");
- }
- });
- }
-
- private ICompilationUnit createTestSecondaryTable() throws Exception {
- return this.createTestType(new DefaultAnnotationWriter() {
- @Override
- public Iterator<String> imports() {
- return new ArrayIterator<String>(JPA.ENTITY, JPA.SECONDARY_TABLE, JPA.UNIQUE_CONSTRAINT);
- }
- @Override
- public void appendTypeAnnotationTo(StringBuilder sb) {
- sb.append("@Entity");
- sb.append(CR);
- sb.append("@SecondaryTable(name = \"FOO\", catalog = \"BAR\", schema = \"BAZ\", uniqueConstraints = @UniqueConstraint(columnNames = {\"BAR\"}))");
- }
- });
- }
-
- private ICompilationUnit createTestSecondaryTablesWithPkJoinColumns() throws Exception {
- return this.createTestType(new DefaultAnnotationWriter() {
- @Override
- public Iterator<String> imports() {
- return new ArrayIterator<String>(JPA.SECONDARY_TABLES, JPA.SECONDARY_TABLE, JPA.PRIMARY_KEY_JOIN_COLUMN);
- }
- @Override
- public void appendTypeAnnotationTo(StringBuilder sb) {
- sb.append("@SecondaryTables(@SecondaryTable(pkJoinColumns = {@PrimaryKeyJoinColumn(name = \"BAR\"), @PrimaryKeyJoinColumn(name = \"FOO\"), @PrimaryKeyJoinColumn(name = \"BAZ\")}))");
- }
- });
- }
-
- public void testGetName() throws Exception {
- ICompilationUnit cu = this.createTestSecondaryTableWithName();
- JavaResourcePersistentType typeResource = buildJavaTypeResource(cu);
-
- SecondaryTableAnnotation table = (SecondaryTableAnnotation) typeResource.getSupportingAnnotation(JPA.SECONDARY_TABLE);
- assertNull(table);
- SecondaryTablesAnnotation secondaryTables = (SecondaryTablesAnnotation) typeResource.getSupportingAnnotation(JPA.SECONDARY_TABLES);
- assertNotNull(secondaryTables);
-
- SecondaryTableAnnotation secondaryTable = secondaryTables.nestedAnnotations().next();
- assertEquals(TABLE_NAME, secondaryTable.getName());
- }
-
- public void testGetNull() throws Exception {
- ICompilationUnit cu = this.createTestSecondaryTables();
- JavaResourcePersistentType typeResource = buildJavaTypeResource(cu);
-
- SecondaryTablesAnnotation secondaryTables = (SecondaryTablesAnnotation) typeResource.getSupportingAnnotation(JPA.SECONDARY_TABLES);
- SecondaryTableAnnotation secondaryTable = secondaryTables.nestedAnnotations().next();
- assertNull(secondaryTable.getName());
- assertNull(secondaryTable.getCatalog());
- assertNull(secondaryTable.getSchema());
- }
-
- public void testSetName() throws Exception {
- ICompilationUnit cu = this.createTestSecondaryTables();
- JavaResourcePersistentType typeResource = buildJavaTypeResource(cu);
-
- SecondaryTablesAnnotation secondaryTables = (SecondaryTablesAnnotation) typeResource.getSupportingAnnotation(JPA.SECONDARY_TABLES);
- SecondaryTableAnnotation secondaryTable = secondaryTables.nestedAnnotations().next();
-
- assertNull(secondaryTable.getName());
-
- secondaryTable.setName("Foo");
- assertEquals("Foo", secondaryTable.getName());
-
- assertSourceContains("@SecondaryTables(@SecondaryTable(name = \"Foo\"))", cu);
- }
-
- public void testSetNameNull() throws Exception {
- ICompilationUnit cu = this.createTestSecondaryTableWithName();
- JavaResourcePersistentType typeResource = buildJavaTypeResource(cu);
-
- SecondaryTablesAnnotation secondaryTables = (SecondaryTablesAnnotation) typeResource.getSupportingAnnotation(JPA.SECONDARY_TABLES);
- SecondaryTableAnnotation secondaryTable = secondaryTables.nestedAnnotations().next();
- assertEquals(TABLE_NAME, secondaryTable.getName());
-
- secondaryTable.setName(null);
- assertNull(secondaryTable.getName());
-
- assertSourceDoesNotContain("@SecondaryTable", cu);
- }
-
- public void testGetCatalog() throws Exception {
- ICompilationUnit cu = this.createTestSecondaryTableWithCatalog();
- JavaResourcePersistentType typeResource = buildJavaTypeResource(cu);
-
- SecondaryTablesAnnotation secondaryTables = (SecondaryTablesAnnotation) typeResource.getSupportingAnnotation(JPA.SECONDARY_TABLES);
- SecondaryTableAnnotation secondaryTable = secondaryTables.nestedAnnotations().next();
- assertEquals(CATALOG_NAME, secondaryTable.getCatalog());
- }
-
- public void testSetCatalog() throws Exception {
- ICompilationUnit cu = this.createTestSecondaryTables();
- JavaResourcePersistentType typeResource = buildJavaTypeResource(cu);
-
- SecondaryTablesAnnotation secondaryTables = (SecondaryTablesAnnotation) typeResource.getSupportingAnnotation(JPA.SECONDARY_TABLES);
- SecondaryTableAnnotation secondaryTable = secondaryTables.nestedAnnotations().next();
- assertNull(secondaryTable.getCatalog());
-
- secondaryTable.setCatalog("Foo");
- assertEquals("Foo", secondaryTable.getCatalog());
-
- assertSourceContains("@SecondaryTables(@SecondaryTable(catalog = \"Foo\"))", cu);
- }
-
- public void testSetCatalogNull() throws Exception {
- ICompilationUnit cu = this.createTestSecondaryTableWithCatalog();
- JavaResourcePersistentType typeResource = buildJavaTypeResource(cu);
-
- SecondaryTablesAnnotation secondaryTables = (SecondaryTablesAnnotation) typeResource.getSupportingAnnotation(JPA.SECONDARY_TABLES);
- SecondaryTableAnnotation secondaryTable = secondaryTables.nestedAnnotations().next();
- assertEquals(CATALOG_NAME, secondaryTable.getCatalog());
-
- secondaryTable.setCatalog(null);
- assertNull(secondaryTable.getCatalog());
-
- assertSourceDoesNotContain("@SecondaryTable", cu);
- }
-
- public void testGetSchema() throws Exception {
- ICompilationUnit cu = this.createTestSecondaryTableWithSchema();
- JavaResourcePersistentType typeResource = buildJavaTypeResource(cu);
-
- SecondaryTablesAnnotation secondaryTables = (SecondaryTablesAnnotation) typeResource.getSupportingAnnotation(JPA.SECONDARY_TABLES);
- SecondaryTableAnnotation secondaryTable = secondaryTables.nestedAnnotations().next();
- assertNotNull(secondaryTable);
- assertEquals(SCHEMA_NAME, secondaryTable.getSchema());
- }
-
- public void testSetSchema() throws Exception {
- ICompilationUnit cu = this.createTestSecondaryTables();
- JavaResourcePersistentType typeResource = buildJavaTypeResource(cu);
-
- SecondaryTablesAnnotation secondaryTables = (SecondaryTablesAnnotation) typeResource.getSupportingAnnotation(JPA.SECONDARY_TABLES);
- SecondaryTableAnnotation secondaryTable = secondaryTables.nestedAnnotations().next();
- assertNull(secondaryTable.getSchema());
-
- secondaryTable.setSchema("Foo");
- assertEquals("Foo", secondaryTable.getSchema());
-
- assertSourceContains("@SecondaryTables(@SecondaryTable(schema = \"Foo\"))", cu);
- }
-
- public void testSetSchemaNull() throws Exception {
- ICompilationUnit cu = this.createTestSecondaryTableWithSchema();
- JavaResourcePersistentType typeResource = buildJavaTypeResource(cu);
-
- SecondaryTablesAnnotation secondaryTables = (SecondaryTablesAnnotation) typeResource.getSupportingAnnotation(JPA.SECONDARY_TABLES);
- SecondaryTableAnnotation secondaryTable = secondaryTables.nestedAnnotations().next();
- assertEquals(SCHEMA_NAME, secondaryTable.getSchema());
-
- secondaryTable.setSchema(null);
- assertNull(secondaryTable.getSchema());
-
- assertSourceDoesNotContain("@SecondaryTable", cu);
- }
-
-
- public void testUniqueConstraints() throws Exception {
- ICompilationUnit cu = this.createTestSecondaryTables();
- JavaResourcePersistentType typeResource = buildJavaTypeResource(cu);
- SecondaryTablesAnnotation secondaryTables = (SecondaryTablesAnnotation) typeResource.getSupportingAnnotation(JPA.SECONDARY_TABLES);
- SecondaryTableAnnotation secondaryTable = secondaryTables.nestedAnnotations().next();
-
- assertEquals(0, secondaryTable.uniqueConstraintsSize());
- }
-
- public void testUniqueConstraints2() throws Exception {
- ICompilationUnit cu = this.createTestSecondaryTables();
- JavaResourcePersistentType typeResource = buildJavaTypeResource(cu);
- SecondaryTablesAnnotation secondaryTables = (SecondaryTablesAnnotation) typeResource.getSupportingAnnotation(JPA.SECONDARY_TABLES);
- SecondaryTableAnnotation secondaryTable = secondaryTables.nestedAnnotations().next();
-
- secondaryTable.addUniqueConstraint(0);
- secondaryTable.addUniqueConstraint(1);
-
- assertEquals(2, secondaryTable.uniqueConstraintsSize());
- }
-
- public void testUniqueConstraints3() throws Exception {
- ICompilationUnit cu = this.createTestSecondaryTableWithUniqueConstraints();
- JavaResourcePersistentType typeResource = buildJavaTypeResource(cu);
- SecondaryTablesAnnotation secondaryTables = (SecondaryTablesAnnotation) typeResource.getSupportingAnnotation(JPA.SECONDARY_TABLES);
- SecondaryTableAnnotation secondaryTable = secondaryTables.nestedAnnotations().next();
-
- assertEquals(2, secondaryTable.uniqueConstraintsSize());
- }
-
- public void testAddUniqueConstraint() throws Exception {
- ICompilationUnit cu = this.createTestSecondaryTables();
- JavaResourcePersistentType typeResource = buildJavaTypeResource(cu);
- SecondaryTablesAnnotation secondaryTables = (SecondaryTablesAnnotation) typeResource.getSupportingAnnotation(JPA.SECONDARY_TABLES);
- SecondaryTableAnnotation secondaryTable = secondaryTables.nestedAnnotations().next();
-
- secondaryTable.addUniqueConstraint(0).addColumnName("FOO");
- secondaryTable.addUniqueConstraint(1);
- secondaryTable.addUniqueConstraint(0).addColumnName("BAR");
-
- assertEquals("BAR", secondaryTable.uniqueConstraintAt(0).columnNames().next());
- assertEquals("FOO", secondaryTable.uniqueConstraintAt(1).columnNames().next());
- assertEquals(0, secondaryTable.uniqueConstraintAt(2).columnNamesSize());
-
- assertSourceContains("@SecondaryTables(@SecondaryTable(uniqueConstraints = {@UniqueConstraint(columnNames = \"BAR\"),@UniqueConstraint(columnNames = \"FOO\"), @UniqueConstraint}))", cu);
- }
-
- public void testRemoveUniqueConstraint() throws Exception {
- ICompilationUnit cu = this.createTestSecondaryTableWithUniqueConstraints();
- JavaResourcePersistentType typeResource = buildJavaTypeResource(cu);
- SecondaryTablesAnnotation secondaryTables = (SecondaryTablesAnnotation) typeResource.getSupportingAnnotation(JPA.SECONDARY_TABLES);
- SecondaryTableAnnotation secondaryTable = secondaryTables.nestedAnnotations().next();
- secondaryTable.addUniqueConstraint(0).addColumnName("FOO");
-
- secondaryTable.removeUniqueConstraint(2);
- assertSourceContains("@SecondaryTables(@SecondaryTable(uniqueConstraints = {@UniqueConstraint(columnNames = \"FOO\"), @UniqueConstraint(columnNames = {\"BAR\"})})", cu);
-
- secondaryTable.removeUniqueConstraint(0);
- assertSourceContains("@SecondaryTables(@SecondaryTable(uniqueConstraints = @UniqueConstraint(columnNames = {\"BAR\"}))", cu);
-
- secondaryTable.removeUniqueConstraint(0);
- assertSourceDoesNotContain("@SecondaryTable", cu);
- }
-
- public void testMoveUniqueConstraint() throws Exception {
- ICompilationUnit cu = this.createTestSecondaryTableWithUniqueConstraints();
- JavaResourcePersistentType typeResource = buildJavaTypeResource(cu);
- SecondaryTablesAnnotation secondaryTables = (SecondaryTablesAnnotation) typeResource.getSupportingAnnotation(JPA.SECONDARY_TABLES);
- SecondaryTableAnnotation secondaryTable = secondaryTables.nestedAnnotations().next();
- secondaryTable.addUniqueConstraint(0).addColumnName("FOO");
-
- assertEquals("FOO", secondaryTable.uniqueConstraintAt(0).columnNames().next());
- assertEquals("BAR", secondaryTable.uniqueConstraintAt(1).columnNames().next());
- assertFalse(secondaryTable.uniqueConstraintAt(2).columnNames().hasNext());
-
- secondaryTable.moveUniqueConstraint(2, 0);
- assertEquals("BAR", secondaryTable.uniqueConstraintAt(0).columnNames().next());
- assertFalse(secondaryTable.uniqueConstraintAt(1).columnNames().hasNext());
- assertEquals("FOO", secondaryTable.uniqueConstraintAt(2).columnNames().next());
- assertSourceContains("@SecondaryTables(@SecondaryTable(uniqueConstraints = {@UniqueConstraint(columnNames = {\"BAR\"}), @UniqueConstraint, @UniqueConstraint(columnNames = \"FOO\")}))", cu);
- }
-
- public void testMoveUniqueConstraint2() throws Exception {
- ICompilationUnit cu = this.createTestSecondaryTableWithUniqueConstraints();
- JavaResourcePersistentType typeResource = buildJavaTypeResource(cu);
- SecondaryTablesAnnotation secondaryTables = (SecondaryTablesAnnotation) typeResource.getSupportingAnnotation(JPA.SECONDARY_TABLES);
- SecondaryTableAnnotation secondaryTable = secondaryTables.nestedAnnotations().next();
- secondaryTable.addUniqueConstraint(0).addColumnName("FOO");
-
- assertEquals("FOO", secondaryTable.uniqueConstraintAt(0).columnNames().next());
- assertEquals("BAR", secondaryTable.uniqueConstraintAt(1).columnNames().next());
- assertFalse(secondaryTable.uniqueConstraintAt(2).columnNames().hasNext());
-
- secondaryTable.moveUniqueConstraint(0, 2);
- assertFalse(secondaryTable.uniqueConstraintAt(0).columnNames().hasNext());
- assertEquals("FOO", secondaryTable.uniqueConstraintAt(1).columnNames().next());
- assertEquals("BAR", secondaryTable.uniqueConstraintAt(2).columnNames().next());
- assertSourceContains("@SecondaryTables(@SecondaryTable(uniqueConstraints = {@UniqueConstraint, @UniqueConstraint(columnNames = \"FOO\"), @UniqueConstraint(columnNames = {\"BAR\"})}))", cu);
- }
-
-
- // @Entity -->> @Entity
- // @SecondaryTable(name="FOO") @SecondaryTables({@SecondaryTable(name="FOO"), @SecondaryTable(name="BAR")})
- public void testAddSecondaryTableCopyExisting() throws Exception {
- ICompilationUnit cu = createTestSecondaryTable();
- JavaResourcePersistentType typeResource = buildJavaTypeResource(cu);
-
- SecondaryTableAnnotation secondaryTable = (SecondaryTableAnnotation) typeResource.addSupportingAnnotation(1, JPA.SECONDARY_TABLE, JPA.SECONDARY_TABLES);
- secondaryTable.setName("BAR");
- assertSourceContains("@SecondaryTables({@SecondaryTable(name = \"FOO\", schema = \"BAZ\", catalog = \"BAR\", uniqueConstraints = @UniqueConstraint(columnNames = \"BAR\")),@SecondaryTable(name = \"BAR\")})", cu);
-
- assertNull(typeResource.getSupportingAnnotation(JPA.SECONDARY_TABLE));
- assertNotNull(typeResource.getSupportingAnnotation(JPA.SECONDARY_TABLES));
- assertEquals(2, CollectionTools.size(typeResource.supportingAnnotations(JPA.SECONDARY_TABLE, JPA.SECONDARY_TABLES)));
- }
-
- public void testAddSecondaryTable() throws Exception {
- ICompilationUnit cu = createTestSecondaryTable();
- JavaResourcePersistentType typeResource = buildJavaTypeResource(cu);
-
- SecondaryTableAnnotation secondaryTable = (SecondaryTableAnnotation) typeResource.addSupportingAnnotation(1, JPA.SECONDARY_TABLE, JPA.SECONDARY_TABLES);
- secondaryTable.setName("BAR");
- assertSourceContains("@SecondaryTables({@SecondaryTable(name = \"FOO\", schema = \"BAZ\", catalog = \"BAR\", uniqueConstraints = @UniqueConstraint(columnNames = \"BAR\")),@SecondaryTable(name = \"BAR\")})", cu);
-
- secondaryTable = (SecondaryTableAnnotation) typeResource.addSupportingAnnotation(0, JPA.SECONDARY_TABLE, JPA.SECONDARY_TABLES);
- secondaryTable.setName("BAZ");
- assertSourceContains("@SecondaryTables({@SecondaryTable(name = \"BAZ\"),@SecondaryTable(name = \"FOO\", schema = \"BAZ\", catalog = \"BAR\", uniqueConstraints = @UniqueConstraint(columnNames = \"BAR\")), @SecondaryTable(name = \"BAR\")})", cu);
-
- Iterator<NestableAnnotation> secondaryTables = typeResource.supportingAnnotations(JPA.SECONDARY_TABLE, JPA.SECONDARY_TABLES);
- assertEquals("BAZ", ((SecondaryTableAnnotation) secondaryTables.next()).getName());
- assertEquals("FOO", ((SecondaryTableAnnotation) secondaryTables.next()).getName());
- assertEquals("BAR", ((SecondaryTableAnnotation) secondaryTables.next()).getName());
-
- assertNull(typeResource.getSupportingAnnotation(JPA.SECONDARY_TABLE));
- assertNotNull(typeResource.getSupportingAnnotation(JPA.SECONDARY_TABLES));
- assertEquals(3, CollectionTools.size(typeResource.supportingAnnotations(JPA.SECONDARY_TABLE, JPA.SECONDARY_TABLES)));
- }
-
- public void testRemoveSecondaryTableCopyExisting() throws Exception {
- ICompilationUnit cu = createTestSecondaryTable();
- JavaResourcePersistentType typeResource = buildJavaTypeResource(cu);
-
- SecondaryTableAnnotation secondaryTable = (SecondaryTableAnnotation) typeResource.addSupportingAnnotation(1, JPA.SECONDARY_TABLE, JPA.SECONDARY_TABLES);
- secondaryTable.setName("BAR");
- assertSourceContains("@SecondaryTables({@SecondaryTable(name = \"FOO\", schema = \"BAZ\", catalog = \"BAR\", uniqueConstraints = @UniqueConstraint(columnNames = \"BAR\")),@SecondaryTable(name = \"BAR\")})", cu);
-
- typeResource.removeSupportingAnnotation(1, JPA.SECONDARY_TABLE, JPA.SECONDARY_TABLES);
- assertSourceContains("@SecondaryTable(name = \"FOO\", schema = \"BAZ\", catalog = \"BAR\", uniqueConstraints = @UniqueConstraint(columnNames = \"BAR\"))", cu);
- }
-
-
- public void testPkJoinColumns() throws Exception {
- ICompilationUnit cu = this.createTestSecondaryTables();
- JavaResourcePersistentType typeResource = buildJavaTypeResource(cu);
- SecondaryTableAnnotation table = (SecondaryTableAnnotation) typeResource.supportingAnnotations(JPA.SECONDARY_TABLE, JPA.SECONDARY_TABLES).next();
-
- assertEquals(0, table.pkJoinColumnsSize());
- }
-
- public void testPkJoinColumns2() throws Exception {
- ICompilationUnit cu = this.createTestSecondaryTables();
- JavaResourcePersistentType typeResource = buildJavaTypeResource(cu);
- SecondaryTableAnnotation table = (SecondaryTableAnnotation) typeResource.supportingAnnotations(JPA.SECONDARY_TABLE, JPA.SECONDARY_TABLES).next();
-
- table.addPkJoinColumn(0);
- table.addPkJoinColumn(1);
-
- assertEquals(2, table.pkJoinColumnsSize());
- }
-
- public void testPkJoinColumns3() throws Exception {
- ICompilationUnit cu = this.createTestSecondaryTablesWithPkJoinColumns();
- JavaResourcePersistentType typeResource = buildJavaTypeResource(cu);
- SecondaryTableAnnotation table = (SecondaryTableAnnotation) typeResource.supportingAnnotations(JPA.SECONDARY_TABLE, JPA.SECONDARY_TABLES).next();
-
- assertEquals(3, table.pkJoinColumnsSize());
- }
-
- public void testAddPkJoinColumn() throws Exception {
- ICompilationUnit cu = this.createTestSecondaryTables();
- JavaResourcePersistentType typeResource = buildJavaTypeResource(cu);
- SecondaryTableAnnotation table = (SecondaryTableAnnotation) typeResource.supportingAnnotations(JPA.SECONDARY_TABLE, JPA.SECONDARY_TABLES).next();
-
- table.addPkJoinColumn(0).setName("FOO");
- table.addPkJoinColumn(1);
- table.addPkJoinColumn(0).setName("BAR");
-
- assertSourceContains("@SecondaryTables(@SecondaryTable(pkJoinColumns = {@PrimaryKeyJoinColumn(name = \"BAR\"),@PrimaryKeyJoinColumn(name = \"FOO\"), @PrimaryKeyJoinColumn}))", cu);
- }
-
- public void testRemovePkJoinColumn() throws Exception {
- ICompilationUnit cu = this.createTestSecondaryTablesWithPkJoinColumns();
- JavaResourcePersistentType typeResource = buildJavaTypeResource(cu);
- SecondaryTableAnnotation table = (SecondaryTableAnnotation) typeResource.supportingAnnotations(JPA.SECONDARY_TABLE, JPA.SECONDARY_TABLES).next();
-
- table.removePkJoinColumn(1);
- assertSourceContains("@SecondaryTables(@SecondaryTable(pkJoinColumns = {@PrimaryKeyJoinColumn(name = \"BAR\"), @PrimaryKeyJoinColumn(name = \"BAZ\")}))", cu);
-
- table.removePkJoinColumn(0);
- assertSourceContains("@SecondaryTables(@SecondaryTable(pkJoinColumns = @PrimaryKeyJoinColumn(name = \"BAZ\")))", cu);
-
- table.removePkJoinColumn(0);
- assertSourceDoesNotContain("@SecondaryTable", cu);
- }
-
- public void testMovePkJoinColumn() throws Exception {
- ICompilationUnit cu = this.createTestSecondaryTablesWithPkJoinColumns();
- JavaResourcePersistentType typeResource = buildJavaTypeResource(cu);
- SecondaryTableAnnotation table = (SecondaryTableAnnotation) typeResource.supportingAnnotations(JPA.SECONDARY_TABLE, JPA.SECONDARY_TABLES).next();
- PrimaryKeyJoinColumnAnnotation joinColumn = table.pkJoinColumnAt(0);
- joinColumn.setReferencedColumnName("REF_NAME");
- joinColumn.setColumnDefinition("COLUMN_DEF");
- table.movePkJoinColumn(2, 0);
- assertSourceContains("@SecondaryTables(@SecondaryTable(pkJoinColumns = {@PrimaryKeyJoinColumn(name = \"FOO\"), @PrimaryKeyJoinColumn(name = \"BAZ\"), @PrimaryKeyJoinColumn(name = \"BAR\", referencedColumnName = \"REF_NAME\", columnDefinition = \"COLUMN_DEF\")}))", cu);
- }
-
- public void testMovePkJoinColumn2() throws Exception {
- ICompilationUnit cu = this.createTestSecondaryTablesWithPkJoinColumns();
- JavaResourcePersistentType typeResource = buildJavaTypeResource(cu);
- SecondaryTableAnnotation table = (SecondaryTableAnnotation) typeResource.supportingAnnotations(JPA.SECONDARY_TABLE, JPA.SECONDARY_TABLES).next();
-
-
- PrimaryKeyJoinColumnAnnotation joinColumn = table.pkJoinColumnAt(0);
- joinColumn.setReferencedColumnName("REF_NAME");
- joinColumn.setColumnDefinition("COLUMN_DEF");
- table.movePkJoinColumn(0, 2);
- assertSourceContains("@SecondaryTables(@SecondaryTable(pkJoinColumns = {@PrimaryKeyJoinColumn(name = \"BAZ\"), @PrimaryKeyJoinColumn(name = \"BAR\", referencedColumnName = \"REF_NAME\", columnDefinition = \"COLUMN_DEF\"), @PrimaryKeyJoinColumn(name = \"FOO\")}))", cu);
- }
-
- public void testSetPkJoinColumnName() throws Exception {
- ICompilationUnit cu = this.createTestSecondaryTablesWithPkJoinColumns();
- JavaResourcePersistentType typeResource = buildJavaTypeResource(cu);
- SecondaryTableAnnotation table = (SecondaryTableAnnotation) typeResource.supportingAnnotations(JPA.SECONDARY_TABLE, JPA.SECONDARY_TABLES).next();
-
- assertEquals(3, table.pkJoinColumnsSize());
-
- PrimaryKeyJoinColumnAnnotation joinColumn = table.pkJoinColumns().next();
-
- assertEquals("BAR", joinColumn.getName());
-
- joinColumn.setName("foo");
- assertEquals("foo", joinColumn.getName());
-
- assertSourceContains("@SecondaryTables(@SecondaryTable(pkJoinColumns = {@PrimaryKeyJoinColumn(name = \"foo\"), @PrimaryKeyJoinColumn(name = \"FOO\"), @PrimaryKeyJoinColumn(name = \"BAZ\")}))", cu);
- }
-
-}
diff --git a/jpa/tests/org.eclipse.jpt.core.tests/src/org/eclipse/jpt/core/tests/internal/resource/java/SequenceGeneratorTests.java b/jpa/tests/org.eclipse.jpt.core.tests/src/org/eclipse/jpt/core/tests/internal/resource/java/SequenceGeneratorTests.java
deleted file mode 100644
index bf2c26bbb0..0000000000
--- a/jpa/tests/org.eclipse.jpt.core.tests/src/org/eclipse/jpt/core/tests/internal/resource/java/SequenceGeneratorTests.java
+++ /dev/null
@@ -1,234 +0,0 @@
-/*******************************************************************************
- * Copyright (c) 2007, 2009 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.
- *
- * Contributors:
- * Oracle - initial API and implementation
- ******************************************************************************/
-package org.eclipse.jpt.core.tests.internal.resource.java;
-
-import java.util.Iterator;
-
-import org.eclipse.jdt.core.ICompilationUnit;
-import org.eclipse.jpt.core.resource.java.JPA;
-import org.eclipse.jpt.core.resource.java.JavaResourcePersistentAttribute;
-import org.eclipse.jpt.core.resource.java.JavaResourcePersistentType;
-import org.eclipse.jpt.core.resource.java.SequenceGeneratorAnnotation;
-import org.eclipse.jpt.utility.internal.iterators.ArrayIterator;
-
-@SuppressWarnings("nls")
-public class SequenceGeneratorTests extends JavaResourceModelTestCase {
-
- private static final String GENERATOR_NAME = "MY_GENERATOR";
- private static final String GENERATOR_SEQUENCE_NAME = "MY_SEQUENCE";
- private static final Integer GENERATOR_ALLOCATION_SIZE = Integer.valueOf(5);
- private static final Integer GENERATOR_INITIAL_VALUE = Integer.valueOf(5);
-
- public SequenceGeneratorTests(String name) {
- super(name);
- }
-
- private ICompilationUnit createTestSequenceGeneratorOnField() throws Exception {
- return this.createTestType(new DefaultAnnotationWriter() {
- @Override
- public Iterator<String> imports() {
- return new ArrayIterator<String>(JPA.SEQUENCE_GENERATOR);
- }
- @Override
- public void appendIdFieldAnnotationTo(StringBuilder sb) {
- sb.append("@SequenceGenerator");
- }
- });
- }
-
- private ICompilationUnit createTestSequenceGeneratorOnType() throws Exception {
- return this.createTestType(new DefaultAnnotationWriter() {
- @Override
- public Iterator<String> imports() {
- return new ArrayIterator<String>(JPA.SEQUENCE_GENERATOR);
- }
- @Override
- public void appendTypeAnnotationTo(StringBuilder sb) {
- sb.append("@SequenceGenerator");
- }
- });
- }
-
- private ICompilationUnit createTestSequenceGeneratorWithName() throws Exception {
- return createTestSequenceGeneratorWithStringElement("name", GENERATOR_NAME);
- }
-
- private ICompilationUnit createTestSequenceGeneratorWithSequenceName() throws Exception {
- return createTestSequenceGeneratorWithStringElement("sequenceName", GENERATOR_SEQUENCE_NAME);
- }
-
- protected ICompilationUnit createTestSequenceGeneratorWithStringElement(final String elementName, final String value) throws Exception {
- return this.createTestType(new DefaultAnnotationWriter() {
- @Override
- public Iterator<String> imports() {
- return new ArrayIterator<String>(JPA.SEQUENCE_GENERATOR);
- }
- @Override
- public void appendIdFieldAnnotationTo(StringBuilder sb) {
- sb.append("@SequenceGenerator(" + elementName + " = \"" + value + "\")");
- }
- });
- }
-
- private ICompilationUnit createTestSequenceGeneratorWithAllocationSize() throws Exception {
- return createTestSequenceGeneratorWithIntElement("allocationSize", GENERATOR_ALLOCATION_SIZE.intValue());
- }
-
- private ICompilationUnit createTestSequenceGeneratorWithInitialValue() throws Exception {
- return createTestSequenceGeneratorWithIntElement("initialValue", GENERATOR_INITIAL_VALUE.intValue());
- }
-
- private ICompilationUnit createTestSequenceGeneratorWithIntElement(final String elementName, final int value) throws Exception {
- return this.createTestType(new DefaultAnnotationWriter() {
- @Override
- public Iterator<String> imports() {
- return new ArrayIterator<String>(JPA.SEQUENCE_GENERATOR);
- }
- @Override
- public void appendIdFieldAnnotationTo(StringBuilder sb) {
- sb.append("@SequenceGenerator(" + elementName + " = " + value + ")");
- }
- });
- }
-
- public void testSequenceGeneratorOnField() throws Exception {
- ICompilationUnit cu = this.createTestSequenceGeneratorOnField();
- JavaResourcePersistentType typeResource = buildJavaTypeResource(cu);
- JavaResourcePersistentAttribute attributeResource = typeResource.fields().next();
-
- SequenceGeneratorAnnotation sequenceGenerator = (SequenceGeneratorAnnotation) attributeResource.getSupportingAnnotation(JPA.SEQUENCE_GENERATOR);
- assertNotNull(sequenceGenerator);
- }
-
- public void testSequenceGeneratorOnType() throws Exception {
- ICompilationUnit cu = this.createTestSequenceGeneratorOnType();
- JavaResourcePersistentType typeResource = buildJavaTypeResource(cu);
-
- SequenceGeneratorAnnotation sequenceGenerator = (SequenceGeneratorAnnotation) typeResource.getSupportingAnnotation(JPA.SEQUENCE_GENERATOR);
- assertNotNull(sequenceGenerator);
- }
-
- public void testGetName() throws Exception {
- ICompilationUnit cu = this.createTestSequenceGeneratorWithName();
- JavaResourcePersistentType typeResource = buildJavaTypeResource(cu);
- JavaResourcePersistentAttribute attributeResource = typeResource.fields().next();
-
- SequenceGeneratorAnnotation sequenceGenerator = (SequenceGeneratorAnnotation) attributeResource.getSupportingAnnotation(JPA.SEQUENCE_GENERATOR);
- assertEquals(GENERATOR_NAME, sequenceGenerator.getName());
- }
-
- public void testSetName() throws Exception {
- ICompilationUnit cu = this.createTestSequenceGeneratorWithName();
- JavaResourcePersistentType typeResource = buildJavaTypeResource(cu);
- JavaResourcePersistentAttribute attributeResource = typeResource.fields().next();
-
- SequenceGeneratorAnnotation sequenceGenerator = (SequenceGeneratorAnnotation) attributeResource.getSupportingAnnotation(JPA.SEQUENCE_GENERATOR);
- assertEquals(GENERATOR_NAME, sequenceGenerator.getName());
-
- sequenceGenerator.setName("foo");
- assertEquals("foo", sequenceGenerator.getName());
-
- assertSourceContains("@SequenceGenerator(name = \"foo\")", cu);
-
- sequenceGenerator.setName(null);
- assertNull(sequenceGenerator.getName());
-
- assertSourceDoesNotContain("@SequenceGenerator", cu);
- }
-
- public void testGetSequenceName() throws Exception {
- ICompilationUnit cu = this.createTestSequenceGeneratorWithSequenceName();
- JavaResourcePersistentType typeResource = buildJavaTypeResource(cu);
- JavaResourcePersistentAttribute attributeResource = typeResource.fields().next();
-
- SequenceGeneratorAnnotation sequenceGenerator = (SequenceGeneratorAnnotation) attributeResource.getSupportingAnnotation(JPA.SEQUENCE_GENERATOR);
- assertEquals(GENERATOR_SEQUENCE_NAME, sequenceGenerator.getSequenceName());
- }
-
- public void testSetSequenceName() throws Exception {
- ICompilationUnit cu = this.createTestSequenceGeneratorWithSequenceName();
- JavaResourcePersistentType typeResource = buildJavaTypeResource(cu);
- JavaResourcePersistentAttribute attributeResource = typeResource.fields().next();
-
- SequenceGeneratorAnnotation sequenceGenerator = (SequenceGeneratorAnnotation) attributeResource.getSupportingAnnotation(JPA.SEQUENCE_GENERATOR);
- assertEquals(GENERATOR_SEQUENCE_NAME, sequenceGenerator.getSequenceName());
-
- sequenceGenerator.setSequenceName("foo");
- assertEquals("foo", sequenceGenerator.getSequenceName());
-
- assertSourceContains("@SequenceGenerator(sequenceName = \"foo\")", cu);
-
- sequenceGenerator.setSequenceName(null);
- assertNull(sequenceGenerator.getSequenceName());
-
- assertSourceDoesNotContain("@SequenceGenerator", cu);
- }
-
- public void testGetAllocationSize() throws Exception {
- ICompilationUnit cu = this.createTestSequenceGeneratorWithAllocationSize();
- JavaResourcePersistentType typeResource = buildJavaTypeResource(cu);
- JavaResourcePersistentAttribute attributeResource = typeResource.fields().next();
-
- SequenceGeneratorAnnotation sequenceGenerator = (SequenceGeneratorAnnotation) attributeResource.getSupportingAnnotation(JPA.SEQUENCE_GENERATOR);
- assertEquals(GENERATOR_ALLOCATION_SIZE, sequenceGenerator.getAllocationSize());
- }
-
- public void testSetAllocationSize() throws Exception {
- ICompilationUnit cu = this.createTestSequenceGeneratorWithAllocationSize();
- JavaResourcePersistentType typeResource = buildJavaTypeResource(cu);
- JavaResourcePersistentAttribute attributeResource = typeResource.fields().next();
-
- SequenceGeneratorAnnotation sequenceGenerator = (SequenceGeneratorAnnotation) attributeResource.getSupportingAnnotation(JPA.SEQUENCE_GENERATOR);
- assertEquals(GENERATOR_ALLOCATION_SIZE, sequenceGenerator.getAllocationSize());
-
- sequenceGenerator.setAllocationSize(Integer.valueOf(500));
- assertEquals(Integer.valueOf(500), sequenceGenerator.getAllocationSize());
-
- assertSourceContains("@SequenceGenerator(allocationSize = 500)", cu);
-
- sequenceGenerator.setAllocationSize(null);
-
- assertSourceDoesNotContain("@SequenceGenerator", cu);
-
- sequenceGenerator.setAllocationSize(Integer.valueOf(0));
- assertSourceContains("@SequenceGenerator(allocationSize = 0)", cu);
- }
-
- public void testGetInitialValue() throws Exception {
- ICompilationUnit cu = this.createTestSequenceGeneratorWithInitialValue();
- JavaResourcePersistentType typeResource = buildJavaTypeResource(cu);
- JavaResourcePersistentAttribute attributeResource = typeResource.fields().next();
-
- SequenceGeneratorAnnotation sequenceGenerator = (SequenceGeneratorAnnotation) attributeResource.getSupportingAnnotation(JPA.SEQUENCE_GENERATOR);
- assertEquals(GENERATOR_INITIAL_VALUE, sequenceGenerator.getInitialValue());
- }
-
- public void testSetInitialValue() throws Exception {
- ICompilationUnit cu = this.createTestSequenceGeneratorWithInitialValue();
- JavaResourcePersistentType typeResource = buildJavaTypeResource(cu);
- JavaResourcePersistentAttribute attributeResource = typeResource.fields().next();
-
- SequenceGeneratorAnnotation sequenceGenerator = (SequenceGeneratorAnnotation) attributeResource.getSupportingAnnotation(JPA.SEQUENCE_GENERATOR);
- assertEquals(GENERATOR_INITIAL_VALUE, sequenceGenerator.getInitialValue());
-
- sequenceGenerator.setInitialValue(Integer.valueOf(500));
- assertEquals(Integer.valueOf(500), sequenceGenerator.getInitialValue());
-
- assertSourceContains("@SequenceGenerator(initialValue = 500)", cu);
-
- sequenceGenerator.setInitialValue(null);
-
- assertSourceDoesNotContain("@SequenceGenerator", cu);
-
- sequenceGenerator.setInitialValue(Integer.valueOf(0));
- assertSourceContains("@SequenceGenerator(initialValue = 0)", cu);
- }
-
-}
diff --git a/jpa/tests/org.eclipse.jpt.core.tests/src/org/eclipse/jpt/core/tests/internal/resource/java/TableGeneratorTests.java b/jpa/tests/org.eclipse.jpt.core.tests/src/org/eclipse/jpt/core/tests/internal/resource/java/TableGeneratorTests.java
deleted file mode 100644
index c4067dec1c..0000000000
--- a/jpa/tests/org.eclipse.jpt.core.tests/src/org/eclipse/jpt/core/tests/internal/resource/java/TableGeneratorTests.java
+++ /dev/null
@@ -1,501 +0,0 @@
-/*******************************************************************************
- * Copyright (c) 2007, 2009 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.
- *
- * Contributors:
- * Oracle - initial API and implementation
- ******************************************************************************/
-package org.eclipse.jpt.core.tests.internal.resource.java;
-
-import java.util.Iterator;
-import org.eclipse.jdt.core.ICompilationUnit;
-import org.eclipse.jpt.core.resource.java.JPA;
-import org.eclipse.jpt.core.resource.java.JavaResourcePersistentAttribute;
-import org.eclipse.jpt.core.resource.java.JavaResourcePersistentType;
-import org.eclipse.jpt.core.resource.java.TableGeneratorAnnotation;
-import org.eclipse.jpt.utility.internal.iterators.ArrayIterator;
-
-@SuppressWarnings("nls")
-public class TableGeneratorTests extends JavaResourceModelTestCase {
-
- private static final String GENERATOR_NAME = "MY_GENERATOR";
- private static final String GENERATOR_TABLE = "MY_TABLE";
- private static final String GENERATOR_CATALOG = "MY_CATALOG";
- private static final String GENERATOR_SCHEMA = "MY_SCHEMA";
- private static final String GENERATOR_PK_COLUMN_NAME = "MY_PK_COLUMN_NAME";
- private static final String GENERATOR_VALUE_COLUMN_NAME = "MY_VALUE_COLUMN_NAME";
- private static final String GENERATOR_PK_COLUMN_VALUE = "MY_PK_COLUMN_VALUE";
- private static final Integer GENERATOR_ALLOCATION_SIZE = Integer.valueOf(5);
- private static final Integer GENERATOR_INITIAL_VALUE = Integer.valueOf(5);
-
- public TableGeneratorTests(String name) {
- super(name);
- }
-
- private ICompilationUnit createTestTableGeneratorOnField() throws Exception {
- return this.createTestType(new DefaultAnnotationWriter() {
- @Override
- public Iterator<String> imports() {
- return new ArrayIterator<String>(JPA.TABLE_GENERATOR);
- }
- @Override
- public void appendIdFieldAnnotationTo(StringBuilder sb) {
- sb.append("@TableGenerator");
- }
- });
- }
-
- private ICompilationUnit createTestTableGeneratorOnType() throws Exception {
- return this.createTestType(new DefaultAnnotationWriter() {
- @Override
- public Iterator<String> imports() {
- return new ArrayIterator<String>(JPA.TABLE_GENERATOR);
- }
- @Override
- public void appendTypeAnnotationTo(StringBuilder sb) {
- sb.append("@TableGenerator");
- }
- });
- }
-
- private ICompilationUnit createTestTableGeneratorWithName() throws Exception {
- return createTestTableGeneratorWithStringElement("name", GENERATOR_NAME);
- }
-
- private ICompilationUnit createTestTableGeneratorWithTable() throws Exception {
- return createTestTableGeneratorWithStringElement("table", GENERATOR_TABLE);
- }
-
- private ICompilationUnit createTestTableGeneratorWithCatalog() throws Exception {
- return createTestTableGeneratorWithStringElement("catalog", GENERATOR_CATALOG);
- }
-
- private ICompilationUnit createTestTableGeneratorWithSchema() throws Exception {
- return createTestTableGeneratorWithStringElement("schema", GENERATOR_SCHEMA);
- }
- private ICompilationUnit createTestTableGeneratorWithPkColumnName() throws Exception {
- return createTestTableGeneratorWithStringElement("pkColumnName", GENERATOR_PK_COLUMN_NAME);
- }
-
- private ICompilationUnit createTestTableGeneratorWithValueColumnName() throws Exception {
- return createTestTableGeneratorWithStringElement("valueColumnName", GENERATOR_VALUE_COLUMN_NAME);
- }
-
- private ICompilationUnit createTestTableGeneratorWithPkColumnValue() throws Exception {
- return createTestTableGeneratorWithStringElement("pkColumnValue", GENERATOR_PK_COLUMN_VALUE);
- }
-
- private ICompilationUnit createTestTableGeneratorWithStringElement(final String elementName, final String value) throws Exception {
- return this.createTestType(new DefaultAnnotationWriter() {
- @Override
- public Iterator<String> imports() {
- return new ArrayIterator<String>(JPA.TABLE_GENERATOR);
- }
- @Override
- public void appendIdFieldAnnotationTo(StringBuilder sb) {
- sb.append("@TableGenerator(" + elementName + " = \"" + value + "\")");
- }
- });
- }
-
- private ICompilationUnit createTestTableGeneratorWithAllocationSize() throws Exception {
- return createTestTableGeneratorWithIntElement("allocationSize", GENERATOR_ALLOCATION_SIZE.intValue());
- }
-
- private ICompilationUnit createTestTableGeneratorWithInitialValue() throws Exception {
- return createTestTableGeneratorWithIntElement("initialValue", GENERATOR_INITIAL_VALUE.intValue());
- }
-
- private ICompilationUnit createTestTableGeneratorWithIntElement(final String elementName, final int value) throws Exception {
- return this.createTestType(new DefaultAnnotationWriter() {
- @Override
- public Iterator<String> imports() {
- return new ArrayIterator<String>(JPA.TABLE_GENERATOR);
- }
- @Override
- public void appendIdFieldAnnotationTo(StringBuilder sb) {
- sb.append("@TableGenerator(" + elementName + " = " + value + ")");
- }
- });
- }
-
- private ICompilationUnit createTestTableGeneratorWithUniqueConstraints() throws Exception {
- return this.createTestType(new DefaultAnnotationWriter() {
- @Override
- public Iterator<String> imports() {
- return new ArrayIterator<String>(JPA.TABLE_GENERATOR, JPA.UNIQUE_CONSTRAINT);
- }
- @Override
- public void appendIdFieldAnnotationTo(StringBuilder sb) {
- sb.append("@TableGenerator(uniqueConstraints = {@UniqueConstraint(columnNames = {\"BAR\"}), @UniqueConstraint(columnNames = {\"FOO\"}), @UniqueConstraint(columnNames = {\"BAZ\"})})");
- }
- });
- }
-
- public void testTableGeneratorOnField() throws Exception {
- ICompilationUnit cu = this.createTestTableGeneratorOnField();
- JavaResourcePersistentType typeResource = buildJavaTypeResource(cu);
- JavaResourcePersistentAttribute attributeResource = typeResource.fields().next();
-
- TableGeneratorAnnotation tableGenerator = (TableGeneratorAnnotation) attributeResource.getSupportingAnnotation(JPA.TABLE_GENERATOR);
- assertNotNull(tableGenerator);
- }
-
- public void testTableGeneratorOnType() throws Exception {
- ICompilationUnit cu = this.createTestTableGeneratorOnType();
- JavaResourcePersistentType typeResource = buildJavaTypeResource(cu);
-
- TableGeneratorAnnotation tableGenerator = (TableGeneratorAnnotation) typeResource.getSupportingAnnotation(JPA.TABLE_GENERATOR);
- assertNotNull(tableGenerator);
- }
-
- public void testGetName() throws Exception {
- ICompilationUnit cu = this.createTestTableGeneratorWithName();
- JavaResourcePersistentType typeResource = buildJavaTypeResource(cu);
- JavaResourcePersistentAttribute attributeResource = typeResource.fields().next();
-
- TableGeneratorAnnotation tableGenerator = (TableGeneratorAnnotation) attributeResource.getSupportingAnnotation(JPA.TABLE_GENERATOR);
- assertEquals(GENERATOR_NAME, tableGenerator.getName());
- }
-
- public void testSetName() throws Exception {
- ICompilationUnit cu = this.createTestTableGeneratorWithName();
- JavaResourcePersistentType typeResource = buildJavaTypeResource(cu);
- JavaResourcePersistentAttribute attributeResource = typeResource.fields().next();
-
- TableGeneratorAnnotation tableGenerator = (TableGeneratorAnnotation) attributeResource.getSupportingAnnotation(JPA.TABLE_GENERATOR);
- assertEquals(GENERATOR_NAME, tableGenerator.getName());
-
- tableGenerator.setName("foo");
- assertEquals("foo", tableGenerator.getName());
-
- assertSourceContains("@TableGenerator(name = \"foo\")", cu);
-
- tableGenerator.setName(null);
- assertNull(tableGenerator.getName());
-
- assertSourceDoesNotContain("@TableGenerator", cu);
- }
-
- public void testGetTable() throws Exception {
- ICompilationUnit cu = this.createTestTableGeneratorWithTable();
- JavaResourcePersistentType typeResource = buildJavaTypeResource(cu);
- JavaResourcePersistentAttribute attributeResource = typeResource.fields().next();
-
- TableGeneratorAnnotation tableGenerator = (TableGeneratorAnnotation) attributeResource.getSupportingAnnotation(JPA.TABLE_GENERATOR);
- assertEquals(GENERATOR_TABLE, tableGenerator.getTable());
- }
-
- public void testSetTable() throws Exception {
- ICompilationUnit cu = this.createTestTableGeneratorWithTable();
- JavaResourcePersistentType typeResource = buildJavaTypeResource(cu);
- JavaResourcePersistentAttribute attributeResource = typeResource.fields().next();
-
- TableGeneratorAnnotation tableGenerator = (TableGeneratorAnnotation) attributeResource.getSupportingAnnotation(JPA.TABLE_GENERATOR);
- assertEquals(GENERATOR_TABLE, tableGenerator.getTable());
-
- tableGenerator.setTable("foo");
- assertEquals("foo", tableGenerator.getTable());
-
- assertSourceContains("@TableGenerator(table = \"foo\")", cu);
-
- tableGenerator.setTable(null);
- assertNull(tableGenerator.getTable());
-
- assertSourceDoesNotContain("@TableGenerator", cu);
- }
-
- public void testGetCatalog() throws Exception {
- ICompilationUnit cu = this.createTestTableGeneratorWithCatalog();
- JavaResourcePersistentType typeResource = buildJavaTypeResource(cu);
- JavaResourcePersistentAttribute attributeResource = typeResource.fields().next();
-
- TableGeneratorAnnotation tableGenerator = (TableGeneratorAnnotation) attributeResource.getSupportingAnnotation(JPA.TABLE_GENERATOR);
- assertEquals(GENERATOR_CATALOG, tableGenerator.getCatalog());
- }
-
- public void testSetCatalog() throws Exception {
- ICompilationUnit cu = this.createTestTableGeneratorWithCatalog();
- JavaResourcePersistentType typeResource = buildJavaTypeResource(cu);
- JavaResourcePersistentAttribute attributeResource = typeResource.fields().next();
-
- TableGeneratorAnnotation tableGenerator = (TableGeneratorAnnotation) attributeResource.getSupportingAnnotation(JPA.TABLE_GENERATOR);
- assertEquals(GENERATOR_CATALOG, tableGenerator.getCatalog());
-
- tableGenerator.setCatalog("foo");
- assertEquals("foo", tableGenerator.getCatalog());
-
- assertSourceContains("@TableGenerator(catalog = \"foo\")", cu);
-
- tableGenerator.setCatalog(null);
- assertNull(tableGenerator.getCatalog());
-
- assertSourceDoesNotContain("@TableGenerator", cu);
- }
-
- public void testGetSchema() throws Exception {
- ICompilationUnit cu = this.createTestTableGeneratorWithSchema();
- JavaResourcePersistentType typeResource = buildJavaTypeResource(cu);
- JavaResourcePersistentAttribute attributeResource = typeResource.fields().next();
-
- TableGeneratorAnnotation tableGenerator = (TableGeneratorAnnotation) attributeResource.getSupportingAnnotation(JPA.TABLE_GENERATOR);
- assertEquals(GENERATOR_SCHEMA, tableGenerator.getSchema());
- }
-
- public void testSetSchema() throws Exception {
- ICompilationUnit cu = this.createTestTableGeneratorWithSchema();
- JavaResourcePersistentType typeResource = buildJavaTypeResource(cu);
- JavaResourcePersistentAttribute attributeResource = typeResource.fields().next();
-
- TableGeneratorAnnotation tableGenerator = (TableGeneratorAnnotation) attributeResource.getSupportingAnnotation(JPA.TABLE_GENERATOR);
- assertEquals(GENERATOR_SCHEMA, tableGenerator.getSchema());
-
- tableGenerator.setSchema("foo");
- assertEquals("foo", tableGenerator.getSchema());
-
- assertSourceContains("@TableGenerator(schema = \"foo\")", cu);
-
- tableGenerator.setSchema(null);
- assertNull(tableGenerator.getSchema());
-
- assertSourceDoesNotContain("@TableGenerator", cu);
- }
-
- public void testGetPkColumnName() throws Exception {
- ICompilationUnit cu = this.createTestTableGeneratorWithPkColumnName();
- JavaResourcePersistentType typeResource = buildJavaTypeResource(cu);
- JavaResourcePersistentAttribute attributeResource = typeResource.fields().next();
-
- TableGeneratorAnnotation tableGenerator = (TableGeneratorAnnotation) attributeResource.getSupportingAnnotation(JPA.TABLE_GENERATOR);
- assertEquals(GENERATOR_PK_COLUMN_NAME, tableGenerator.getPkColumnName());
- }
-
- public void testSetPkColumnName() throws Exception {
- ICompilationUnit cu = this.createTestTableGeneratorWithPkColumnName();
- JavaResourcePersistentType typeResource = buildJavaTypeResource(cu);
- JavaResourcePersistentAttribute attributeResource = typeResource.fields().next();
-
- TableGeneratorAnnotation tableGenerator = (TableGeneratorAnnotation) attributeResource.getSupportingAnnotation(JPA.TABLE_GENERATOR);
- assertEquals(GENERATOR_PK_COLUMN_NAME, tableGenerator.getPkColumnName());
-
- tableGenerator.setPkColumnName("foo");
- assertEquals("foo", tableGenerator.getPkColumnName());
-
- assertSourceContains("@TableGenerator(pkColumnName = \"foo\")", cu);
-
- tableGenerator.setPkColumnName(null);
- assertNull(tableGenerator.getPkColumnName());
-
- assertSourceDoesNotContain("@TableGenerator", cu);
- }
-
- public void testGetValueColumnName() throws Exception {
- ICompilationUnit cu = this.createTestTableGeneratorWithValueColumnName();
- JavaResourcePersistentType typeResource = buildJavaTypeResource(cu);
- JavaResourcePersistentAttribute attributeResource = typeResource.fields().next();
-
- TableGeneratorAnnotation tableGenerator = (TableGeneratorAnnotation) attributeResource.getSupportingAnnotation(JPA.TABLE_GENERATOR);
- assertEquals(GENERATOR_VALUE_COLUMN_NAME, tableGenerator.getValueColumnName());
- }
-
- public void testSetValueColumnName() throws Exception {
- ICompilationUnit cu = this.createTestTableGeneratorWithValueColumnName();
- JavaResourcePersistentType typeResource = buildJavaTypeResource(cu);
- JavaResourcePersistentAttribute attributeResource = typeResource.fields().next();
-
- TableGeneratorAnnotation tableGenerator = (TableGeneratorAnnotation) attributeResource.getSupportingAnnotation(JPA.TABLE_GENERATOR);
- assertEquals(GENERATOR_VALUE_COLUMN_NAME, tableGenerator.getValueColumnName());
-
- tableGenerator.setValueColumnName("foo");
- assertEquals("foo", tableGenerator.getValueColumnName());
-
- assertSourceContains("@TableGenerator(valueColumnName = \"foo\")", cu);
-
- tableGenerator.setValueColumnName(null);
- assertNull(tableGenerator.getValueColumnName());
-
- assertSourceDoesNotContain("@TableGenerator", cu);
- }
-
- public void testGetPkColumnValue() throws Exception {
- ICompilationUnit cu = this.createTestTableGeneratorWithPkColumnValue();
- JavaResourcePersistentType typeResource = buildJavaTypeResource(cu);
- JavaResourcePersistentAttribute attributeResource = typeResource.fields().next();
-
- TableGeneratorAnnotation tableGenerator = (TableGeneratorAnnotation) attributeResource.getSupportingAnnotation(JPA.TABLE_GENERATOR);
- assertEquals(GENERATOR_PK_COLUMN_VALUE, tableGenerator.getPkColumnValue());
- }
-
- public void testSetPkColumnValue() throws Exception {
- ICompilationUnit cu = this.createTestTableGeneratorWithPkColumnValue();
- JavaResourcePersistentType typeResource = buildJavaTypeResource(cu);
- JavaResourcePersistentAttribute attributeResource = typeResource.fields().next();
-
- TableGeneratorAnnotation tableGenerator = (TableGeneratorAnnotation) attributeResource.getSupportingAnnotation(JPA.TABLE_GENERATOR);
- assertEquals(GENERATOR_PK_COLUMN_VALUE, tableGenerator.getPkColumnValue());
-
- tableGenerator.setPkColumnValue("foo");
- assertEquals("foo", tableGenerator.getPkColumnValue());
-
- assertSourceContains("@TableGenerator(pkColumnValue = \"foo\")", cu);
-
- tableGenerator.setPkColumnValue(null);
- assertNull(tableGenerator.getPkColumnValue());
-
- assertSourceDoesNotContain("@TableGenerator", cu);
- }
-
- public void testGetAllocationSize() throws Exception {
- ICompilationUnit cu = this.createTestTableGeneratorWithAllocationSize();
- JavaResourcePersistentType typeResource = buildJavaTypeResource(cu);
- JavaResourcePersistentAttribute attributeResource = typeResource.fields().next();
-
- TableGeneratorAnnotation tableGenerator = (TableGeneratorAnnotation) attributeResource.getSupportingAnnotation(JPA.TABLE_GENERATOR);
- assertEquals(GENERATOR_ALLOCATION_SIZE, tableGenerator.getAllocationSize());
- }
-
- public void testSetAllocationSize() throws Exception {
- ICompilationUnit cu = this.createTestTableGeneratorWithAllocationSize();
- JavaResourcePersistentType typeResource = buildJavaTypeResource(cu);
- JavaResourcePersistentAttribute attributeResource = typeResource.fields().next();
-
- TableGeneratorAnnotation tableGenerator = (TableGeneratorAnnotation) attributeResource.getSupportingAnnotation(JPA.TABLE_GENERATOR);
- assertEquals(GENERATOR_ALLOCATION_SIZE, tableGenerator.getAllocationSize());
-
- tableGenerator.setAllocationSize(Integer.valueOf(500));
- assertEquals(Integer.valueOf(500), tableGenerator.getAllocationSize());
-
- assertSourceContains("@TableGenerator(allocationSize = 500)", cu);
-
- tableGenerator.setAllocationSize(null);
-
- assertSourceDoesNotContain("@TableGenerator", cu);
-
- tableGenerator.setAllocationSize(Integer.valueOf(0));
- assertSourceContains("@TableGenerator(allocationSize = 0)", cu);
- }
-
- public void testGetInitialValue() throws Exception {
- ICompilationUnit cu = this.createTestTableGeneratorWithInitialValue();
- JavaResourcePersistentType typeResource = buildJavaTypeResource(cu);
- JavaResourcePersistentAttribute attributeResource = typeResource.fields().next();
-
- TableGeneratorAnnotation tableGenerator = (TableGeneratorAnnotation) attributeResource.getSupportingAnnotation(JPA.TABLE_GENERATOR);
- assertEquals(GENERATOR_INITIAL_VALUE, tableGenerator.getInitialValue());
- }
-
- public void testSetInitialValue() throws Exception {
- ICompilationUnit cu = this.createTestTableGeneratorWithInitialValue();
- JavaResourcePersistentType typeResource = buildJavaTypeResource(cu);
- JavaResourcePersistentAttribute attributeResource = typeResource.fields().next();
-
- TableGeneratorAnnotation tableGenerator = (TableGeneratorAnnotation) attributeResource.getSupportingAnnotation(JPA.TABLE_GENERATOR);
- assertEquals(GENERATOR_INITIAL_VALUE, tableGenerator.getInitialValue());
-
- tableGenerator.setInitialValue(Integer.valueOf(500));
- assertEquals(Integer.valueOf(500), tableGenerator.getInitialValue());
-
- assertSourceContains("@TableGenerator(initialValue = 500)", cu);
-
- tableGenerator.setInitialValue(null);
-
- assertSourceDoesNotContain("@TableGenerator", cu);
-
- tableGenerator.setInitialValue(Integer.valueOf(0));
- assertSourceContains("@TableGenerator(initialValue = 0)", cu);
- }
-
- public void testUniqueConstraints() throws Exception {
- ICompilationUnit cu = this.createTestTableGeneratorOnField();
- JavaResourcePersistentType typeResource = buildJavaTypeResource(cu);
- JavaResourcePersistentAttribute attributeResource = typeResource.fields().next();
-
- TableGeneratorAnnotation tableGenerator = (TableGeneratorAnnotation) attributeResource.getSupportingAnnotation(JPA.TABLE_GENERATOR);
-
- assertEquals(0, tableGenerator.uniqueConstraintsSize());
- }
-
- public void testUniqueConstraints2() throws Exception {
- ICompilationUnit cu = this.createTestTableGeneratorOnField();
- JavaResourcePersistentType typeResource = buildJavaTypeResource(cu);
- JavaResourcePersistentAttribute attributeResource = typeResource.fields().next();
-
- TableGeneratorAnnotation tableGenerator = (TableGeneratorAnnotation) attributeResource.getSupportingAnnotation(JPA.TABLE_GENERATOR);
-
- tableGenerator.addUniqueConstraint(0);
- tableGenerator.addUniqueConstraint(1);
-
- assertEquals(2, tableGenerator.uniqueConstraintsSize());
- }
-
- public void testUniqueConstraints3() throws Exception {
- ICompilationUnit cu = this.createTestTableGeneratorWithUniqueConstraints();
- JavaResourcePersistentType typeResource = buildJavaTypeResource(cu);
- JavaResourcePersistentAttribute attributeResource = typeResource.fields().next();
-
- TableGeneratorAnnotation tableGenerator = (TableGeneratorAnnotation) attributeResource.getSupportingAnnotation(JPA.TABLE_GENERATOR);
-
- assertEquals(3, tableGenerator.uniqueConstraintsSize());
- }
-
- public void testAddUniqueConstraint() throws Exception {
- ICompilationUnit cu = this.createTestTableGeneratorOnField();
- JavaResourcePersistentType typeResource = buildJavaTypeResource(cu);
- JavaResourcePersistentAttribute attributeResource = typeResource.fields().next();
-
- TableGeneratorAnnotation tableGenerator = (TableGeneratorAnnotation) attributeResource.getSupportingAnnotation(JPA.TABLE_GENERATOR);
-
- tableGenerator.addUniqueConstraint(0).addColumnName("FOO");
- tableGenerator.addUniqueConstraint(1);
- tableGenerator.addUniqueConstraint(0).addColumnName("BAR");
-
- assertEquals("BAR", tableGenerator.uniqueConstraintAt(0).columnNames().next());
- assertEquals("FOO", tableGenerator.uniqueConstraintAt(1).columnNames().next());
- assertEquals(0, tableGenerator.uniqueConstraintAt(2).columnNamesSize());
-
- assertEquals(3, tableGenerator.uniqueConstraintsSize());
- assertSourceContains("@TableGenerator(uniqueConstraints = {@UniqueConstraint(columnNames = \"BAR\"),@UniqueConstraint(columnNames = \"FOO\"), @UniqueConstraint})", cu);
- }
-
- public void testRemoveUniqueConstraint() throws Exception {
- ICompilationUnit cu = this.createTestTableGeneratorWithUniqueConstraints();
- JavaResourcePersistentType typeResource = buildJavaTypeResource(cu);
- JavaResourcePersistentAttribute attributeResource = typeResource.fields().next();
-
- TableGeneratorAnnotation tableGenerator = (TableGeneratorAnnotation) attributeResource.getSupportingAnnotation(JPA.TABLE_GENERATOR);
-
- tableGenerator.removeUniqueConstraint(1);
- assertSourceContains("@TableGenerator(uniqueConstraints = {@UniqueConstraint(columnNames = {\"BAR\"}), @UniqueConstraint(columnNames = {\"BAZ\"})})", cu);
-
- tableGenerator.removeUniqueConstraint(0);
- assertSourceContains("@TableGenerator(uniqueConstraints = @UniqueConstraint(columnNames = {\"BAZ\"}))", cu);
-
- tableGenerator.removeUniqueConstraint(0);
- assertSourceDoesNotContain("@TableGenerator", cu);
- }
-
- public void testMoveUniqueConstraint() throws Exception {
- ICompilationUnit cu = this.createTestTableGeneratorWithUniqueConstraints();
- JavaResourcePersistentType typeResource = buildJavaTypeResource(cu);
- JavaResourcePersistentAttribute attributeResource = typeResource.fields().next();
-
- TableGeneratorAnnotation tableGenerator = (TableGeneratorAnnotation) attributeResource.getSupportingAnnotation(JPA.TABLE_GENERATOR);
-
- tableGenerator.moveUniqueConstraint(2, 0);
- assertSourceContains("@TableGenerator(uniqueConstraints = {@UniqueConstraint(columnNames = {\"FOO\"}), @UniqueConstraint(columnNames = {\"BAZ\"}), @UniqueConstraint(columnNames = {\"BAR\"})})", cu);
- }
-
- public void testMoveUniqueConstraint2() throws Exception {
- ICompilationUnit cu = this.createTestTableGeneratorWithUniqueConstraints();
- JavaResourcePersistentType typeResource = buildJavaTypeResource(cu);
- JavaResourcePersistentAttribute attributeResource = typeResource.fields().next();
-
- TableGeneratorAnnotation tableGenerator = (TableGeneratorAnnotation) attributeResource.getSupportingAnnotation(JPA.TABLE_GENERATOR);
-
- tableGenerator.moveUniqueConstraint(0, 2);
- assertSourceContains("@TableGenerator(uniqueConstraints = {@UniqueConstraint(columnNames = {\"BAZ\"}), @UniqueConstraint(columnNames = {\"BAR\"}), @UniqueConstraint(columnNames = {\"FOO\"})})", cu);
- }
-
-}
diff --git a/jpa/tests/org.eclipse.jpt.core.tests/src/org/eclipse/jpt/core/tests/internal/resource/java/TableTests.java b/jpa/tests/org.eclipse.jpt.core.tests/src/org/eclipse/jpt/core/tests/internal/resource/java/TableTests.java
deleted file mode 100644
index a2cf4d9c83..0000000000
--- a/jpa/tests/org.eclipse.jpt.core.tests/src/org/eclipse/jpt/core/tests/internal/resource/java/TableTests.java
+++ /dev/null
@@ -1,346 +0,0 @@
-/*******************************************************************************
- * Copyright (c) 2007, 2009 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.
- *
- * Contributors:
- * Oracle - initial API and implementation
- ******************************************************************************/
-package org.eclipse.jpt.core.tests.internal.resource.java;
-
-import java.util.Iterator;
-import java.util.ListIterator;
-import org.eclipse.jdt.core.ICompilationUnit;
-import org.eclipse.jpt.core.resource.java.JPA;
-import org.eclipse.jpt.core.resource.java.JavaResourcePersistentType;
-import org.eclipse.jpt.core.resource.java.TableAnnotation;
-import org.eclipse.jpt.utility.internal.iterators.ArrayIterator;
-
-@SuppressWarnings("nls")
-public class TableTests extends JavaResourceModelTestCase {
-
- private static final String TABLE_NAME = "MY_TABLE";
- private static final String SCHEMA_NAME = "MY_SCHEMA";
- private static final String CATALOG_NAME = "MY_CATALOG";
-
- public TableTests(String name) {
- super(name);
- }
-
- private ICompilationUnit createTestTable() throws Exception {
- return this.createTestType(new DefaultAnnotationWriter() {
- @Override
- public Iterator<String> imports() {
- return new ArrayIterator<String>(JPA.TABLE);
- }
- @Override
- public void appendTypeAnnotationTo(StringBuilder sb) {
- sb.append("@Table");
- }
- });
- }
-
- private ICompilationUnit createTestTableWithName() throws Exception {
- return this.createTestType(new DefaultAnnotationWriter() {
- @Override
- public Iterator<String> imports() {
- return new ArrayIterator<String>(JPA.TABLE);
- }
- @Override
- public void appendTypeAnnotationTo(StringBuilder sb) {
- sb.append("@Table(name = \"" + TABLE_NAME + "\")");
- }
- });
- }
-
- private ICompilationUnit createTestTableWithSchema() throws Exception {
- return this.createTestType(new DefaultAnnotationWriter() {
- @Override
- public Iterator<String> imports() {
- return new ArrayIterator<String>(JPA.TABLE);
- }
- @Override
- public void appendTypeAnnotationTo(StringBuilder sb) {
- sb.append("@Table(schema = \"" + SCHEMA_NAME + "\")");
- }
- });
- }
-
- private ICompilationUnit createTestTableWithCatalog() throws Exception {
- return this.createTestType(new DefaultAnnotationWriter() {
- @Override
- public Iterator<String> imports() {
- return new ArrayIterator<String>(JPA.TABLE);
- }
- @Override
- public void appendTypeAnnotationTo(StringBuilder sb) {
- sb.append("@Table(catalog = \"" + CATALOG_NAME + "\")");
- }
- });
- }
-
- private ICompilationUnit createTestTableWithUniqueConstraints() throws Exception {
- return this.createTestType(new DefaultAnnotationWriter() {
- @Override
- public Iterator<String> imports() {
- return new ArrayIterator<String>(JPA.TABLE, JPA.UNIQUE_CONSTRAINT);
- }
- @Override
- public void appendTypeAnnotationTo(StringBuilder sb) {
- sb.append("@Table(uniqueConstraints = {@UniqueConstraint(columnNames = {\"BAR\"}), @UniqueConstraint(columnNames = {\"FOO\"}), @UniqueConstraint(columnNames = {\"BAZ\"})})");
- }
- });
- }
-
- public void testGetName() throws Exception {
- ICompilationUnit cu = this.createTestTableWithName();
- JavaResourcePersistentType typeResource = buildJavaTypeResource(cu);
-
- TableAnnotation table = (TableAnnotation) typeResource.getSupportingAnnotation(JPA.TABLE);
- assertNotNull(table);
- assertEquals(TABLE_NAME, table.getName());
- }
-
- public void testGetNull() throws Exception {
- ICompilationUnit cu = this.createTestTable();
- JavaResourcePersistentType typeResource = buildJavaTypeResource(cu);
-
- TableAnnotation table = (TableAnnotation) typeResource.getSupportingAnnotation(JPA.TABLE);
- assertNotNull(table);
- assertNull(table.getName());
- assertNull(table.getCatalog());
- assertNull(table.getSchema());
- }
-
- public void testSetName() throws Exception {
- ICompilationUnit cu = this.createTestTable();
- JavaResourcePersistentType typeResource = buildJavaTypeResource(cu);
-
- TableAnnotation table = (TableAnnotation) typeResource.getSupportingAnnotation(JPA.TABLE);
- assertNotNull(table);
- assertNull(table.getName());
-
- table.setName("Foo");
- assertEquals("Foo", table.getName());
-
- assertSourceContains("@Table(name = \"Foo\")", cu);
- }
-
- public void testSetNameNull() throws Exception {
- ICompilationUnit cu = this.createTestTableWithName();
- JavaResourcePersistentType typeResource = buildJavaTypeResource(cu);
-
- TableAnnotation table = (TableAnnotation) typeResource.getSupportingAnnotation(JPA.TABLE);
- assertEquals(TABLE_NAME, table.getName());
-
- table.setName(null);
- assertNull(table.getName());
-
- assertSourceDoesNotContain("@Table", cu);
- }
-
- public void testGetCatalog() throws Exception {
- ICompilationUnit cu = this.createTestTableWithCatalog();
- JavaResourcePersistentType typeResource = buildJavaTypeResource(cu);
-
- TableAnnotation table = (TableAnnotation) typeResource.getSupportingAnnotation(JPA.TABLE);
- assertNotNull(table);
- assertEquals(CATALOG_NAME, table.getCatalog());
- }
-
- public void testSetCatalog() throws Exception {
- ICompilationUnit cu = this.createTestTable();
- JavaResourcePersistentType typeResource = buildJavaTypeResource(cu);
-
- TableAnnotation table = (TableAnnotation) typeResource.getSupportingAnnotation(JPA.TABLE);
- assertNotNull(table);
- assertNull(table.getCatalog());
-
- table.setCatalog("Foo");
- assertEquals("Foo", table.getCatalog());
-
- assertSourceContains("@Table(catalog = \"Foo\")", cu);
- }
-
- public void testSetCatalogNull() throws Exception {
- ICompilationUnit cu = this.createTestTableWithCatalog();
- JavaResourcePersistentType typeResource = buildJavaTypeResource(cu);
-
- TableAnnotation table = (TableAnnotation) typeResource.getSupportingAnnotation(JPA.TABLE);
- assertEquals(CATALOG_NAME, table.getCatalog());
-
- table.setCatalog(null);
- assertNull(table.getCatalog());
-
- assertSourceDoesNotContain("@Table", cu);
- }
-
- public void testGetSchema() throws Exception {
- ICompilationUnit cu = this.createTestTableWithSchema();
- JavaResourcePersistentType typeResource = buildJavaTypeResource(cu);
-
- TableAnnotation table = (TableAnnotation) typeResource.getSupportingAnnotation(JPA.TABLE);
- assertNotNull(table);
- assertEquals(SCHEMA_NAME, table.getSchema());
- }
-
- public void testSetSchema() throws Exception {
- ICompilationUnit cu = this.createTestTable();
- JavaResourcePersistentType typeResource = buildJavaTypeResource(cu);
-
- TableAnnotation table = (TableAnnotation) typeResource.getSupportingAnnotation(JPA.TABLE);
- assertNotNull(table);
- assertNull(table.getSchema());
-
- table.setSchema("Foo");
- assertEquals("Foo", table.getSchema());
-
- assertSourceContains("@Table(schema = \"Foo\")", cu);
- }
-
- public void testSetSchemaNull() throws Exception {
- ICompilationUnit cu = this.createTestTableWithSchema();
- JavaResourcePersistentType typeResource = buildJavaTypeResource(cu);
-
- TableAnnotation table = (TableAnnotation) typeResource.getSupportingAnnotation(JPA.TABLE);
- assertEquals(SCHEMA_NAME, table.getSchema());
-
- table.setSchema(null);
- assertNull(table.getSchema());
-
- assertSourceDoesNotContain("@Table", cu);
- }
-
- public void testUniqueConstraints() throws Exception {
- ICompilationUnit cu = this.createTestTable();
- JavaResourcePersistentType typeResource = buildJavaTypeResource(cu);
- TableAnnotation table = (TableAnnotation) typeResource.getSupportingAnnotation(JPA.TABLE);
-
- assertEquals(0, table.uniqueConstraintsSize());
- }
-
- public void testUniqueConstraints2() throws Exception {
- ICompilationUnit cu = this.createTestTable();
- JavaResourcePersistentType typeResource = buildJavaTypeResource(cu);
- TableAnnotation table = (TableAnnotation) typeResource.getSupportingAnnotation(JPA.TABLE);
-
- table.addUniqueConstraint(0);
- table.addUniqueConstraint(1);
-
- assertEquals(2, table.uniqueConstraintsSize());
- }
-
- public void testUniqueConstraints3() throws Exception {
- ICompilationUnit cu = this.createTestTableWithUniqueConstraints();
- JavaResourcePersistentType typeResource = buildJavaTypeResource(cu);
- TableAnnotation table = (TableAnnotation) typeResource.getSupportingAnnotation(JPA.TABLE);
-
- assertEquals(3, table.uniqueConstraintsSize());
- }
-
- public void testAddUniqueConstraint() throws Exception {
- ICompilationUnit cu = this.createTestTable();
- JavaResourcePersistentType typeResource = buildJavaTypeResource(cu);
- TableAnnotation table = (TableAnnotation) typeResource.getSupportingAnnotation(JPA.TABLE);
-
- table.addUniqueConstraint(0).addColumnName("FOO");
- table.addUniqueConstraint(1);
- table.addUniqueConstraint(0).addColumnName("BAR");
-
- assertEquals("BAR", table.uniqueConstraintAt(0).columnNames().next());
- assertEquals("FOO", table.uniqueConstraintAt(1).columnNames().next());
- assertEquals(0, table.uniqueConstraintAt(2).columnNamesSize());
-
- assertSourceContains("@Table(uniqueConstraints = {@UniqueConstraint(columnNames = \"BAR\"),@UniqueConstraint(columnNames = \"FOO\"), @UniqueConstraint})", cu);
- }
-
- public void testAddUniqueConstraint2() throws Exception {
- ICompilationUnit cu = this.createTestTable();
- JavaResourcePersistentType typeResource = buildJavaTypeResource(cu);
- TableAnnotation table = (TableAnnotation) typeResource.getSupportingAnnotation(JPA.TABLE);
-
- table.addUniqueConstraint(0).addColumnName("FOO");
- table.addUniqueConstraint(0);
- table.addUniqueConstraint(1).addColumnName("BAR");
- table.uniqueConstraintAt(1).addColumnName("BAZ");
-
- assertSourceContains("@Table(uniqueConstraints = {@UniqueConstraint,@UniqueConstraint(columnNames = { \"BAR\", \"BAZ\" }), @UniqueConstraint(columnNames = \"FOO\")})", cu);
-
- assertEquals("FOO", table.uniqueConstraintAt(2).columnNames().next());
- ListIterator<String> columnNames = table.uniqueConstraintAt(1).columnNames();
- assertEquals("BAR", columnNames.next());
- assertEquals("BAZ", columnNames.next());
- }
- public void testRemoveUniqueConstraint() throws Exception {
- ICompilationUnit cu = this.createTestTableWithUniqueConstraints();
- JavaResourcePersistentType typeResource = buildJavaTypeResource(cu);
- TableAnnotation table = (TableAnnotation) typeResource.getSupportingAnnotation(JPA.TABLE);
-
- table.removeUniqueConstraint(1);
- assertSourceContains("@Table(uniqueConstraints = {@UniqueConstraint(columnNames = {\"BAR\"}), @UniqueConstraint(columnNames = {\"BAZ\"})})", cu);
-
- table.removeUniqueConstraint(0);
- assertSourceContains("@Table(uniqueConstraints = @UniqueConstraint(columnNames = {\"BAZ\"}))", cu);
-
- table.removeUniqueConstraint(0);
- assertSourceDoesNotContain("@Table", cu);
- }
-
- public void testRemoveUniqueConstraint2() throws Exception {
- ICompilationUnit cu = this.createTestTable();
- JavaResourcePersistentType typeResource = buildJavaTypeResource(cu);
- TableAnnotation table = (TableAnnotation) typeResource.getSupportingAnnotation(JPA.TABLE);
- table.addUniqueConstraint(0).addColumnName("FOO");
- table.addUniqueConstraint(1).addColumnName("BAR");
- table.addUniqueConstraint(2).addColumnName("BAZ");
- assertSourceContains("@Table(uniqueConstraints = {@UniqueConstraint(columnNames = \"FOO\"),@UniqueConstraint(columnNames = \"BAR\"), @UniqueConstraint(columnNames = \"BAZ\")})", cu);
-
- table.removeUniqueConstraint(0);
- assertSourceContains("@Table(uniqueConstraints = {@UniqueConstraint(columnNames = \"BAR\"),@UniqueConstraint(columnNames = \"BAZ\")})", cu);
-
- table.removeUniqueConstraint(0);
- assertSourceContains("@Table(uniqueConstraints = @UniqueConstraint(columnNames = \"BAZ\"))", cu);
-
- table.removeUniqueConstraint(0);
- assertSourceDoesNotContain("@Table", cu);
- }
-
- public void testRemoveUniqueConstraint3() throws Exception {
- ICompilationUnit cu = this.createTestTable();
- JavaResourcePersistentType typeResource = buildJavaTypeResource(cu);
- TableAnnotation table = (TableAnnotation) typeResource.getSupportingAnnotation(JPA.TABLE);
- table.addUniqueConstraint(0).addColumnName("FOO");
- table.addUniqueConstraint(1).addColumnName("BAR");
- table.addUniqueConstraint(2).addColumnName("BAZ");
- assertSourceContains("@Table(uniqueConstraints = {@UniqueConstraint(columnNames = \"FOO\"),@UniqueConstraint(columnNames = \"BAR\"), @UniqueConstraint(columnNames = \"BAZ\")})", cu);
-
- table.removeUniqueConstraint(2);
- assertSourceContains("@Table(uniqueConstraints = {@UniqueConstraint(columnNames = \"FOO\"),@UniqueConstraint(columnNames = \"BAR\")})", cu);
-
- table.removeUniqueConstraint(1);
- assertSourceContains("@Table(uniqueConstraints = @UniqueConstraint(columnNames = \"FOO\"))", cu);
-
- table.removeUniqueConstraint(0);
- assertSourceDoesNotContain("@Table", cu);
- }
-
- public void testMoveUniqueConstraint() throws Exception {
- ICompilationUnit cu = this.createTestTableWithUniqueConstraints();
- JavaResourcePersistentType typeResource = buildJavaTypeResource(cu);
- TableAnnotation table = (TableAnnotation) typeResource.getSupportingAnnotation(JPA.TABLE);
-
- table.moveUniqueConstraint(2, 0);
- assertSourceContains("@Table(uniqueConstraints = {@UniqueConstraint(columnNames = {\"FOO\"}), @UniqueConstraint(columnNames = {\"BAZ\"}), @UniqueConstraint(columnNames = {\"BAR\"})})", cu);
- }
-
- public void testMoveUniqueConstraint2() throws Exception {
- ICompilationUnit cu = this.createTestTableWithUniqueConstraints();
- JavaResourcePersistentType typeResource = buildJavaTypeResource(cu);
- TableAnnotation table = (TableAnnotation) typeResource.getSupportingAnnotation(JPA.TABLE);
-
- table.moveUniqueConstraint(0, 2);
- assertSourceContains("@Table(uniqueConstraints = {@UniqueConstraint(columnNames = {\"BAZ\"}), @UniqueConstraint(columnNames = {\"BAR\"}), @UniqueConstraint(columnNames = {\"FOO\"})})", cu);
- }
-
-}
diff --git a/jpa/tests/org.eclipse.jpt.core.tests/src/org/eclipse/jpt/core/tests/internal/resource/java/TemporalTests.java b/jpa/tests/org.eclipse.jpt.core.tests/src/org/eclipse/jpt/core/tests/internal/resource/java/TemporalTests.java
deleted file mode 100644
index 0769884ced..0000000000
--- a/jpa/tests/org.eclipse.jpt.core.tests/src/org/eclipse/jpt/core/tests/internal/resource/java/TemporalTests.java
+++ /dev/null
@@ -1,88 +0,0 @@
-/*******************************************************************************
- * Copyright (c) 2007, 2009 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.
- *
- * Contributors:
- * Oracle - initial API and implementation
- ******************************************************************************/
-package org.eclipse.jpt.core.tests.internal.resource.java;
-
-import java.util.Iterator;
-import org.eclipse.jdt.core.ICompilationUnit;
-import org.eclipse.jpt.core.resource.java.JPA;
-import org.eclipse.jpt.core.resource.java.JavaResourcePersistentAttribute;
-import org.eclipse.jpt.core.resource.java.JavaResourcePersistentType;
-import org.eclipse.jpt.core.resource.java.TemporalAnnotation;
-import org.eclipse.jpt.core.resource.java.TemporalType;
-import org.eclipse.jpt.utility.internal.iterators.ArrayIterator;
-
-@SuppressWarnings("nls")
-public class TemporalTests extends JavaResourceModelTestCase {
-
- public TemporalTests(String name) {
- super(name);
- }
-
- private ICompilationUnit createTestTemporal() throws Exception {
- return this.createTestType(new DefaultAnnotationWriter() {
- @Override
- public Iterator<String> imports() {
- return new ArrayIterator<String>(JPA.TEMPORAL);
- }
- @Override
- public void appendIdFieldAnnotationTo(StringBuilder sb) {
- sb.append("@Temporal");
- }
- });
- }
-
- private ICompilationUnit createTestTemporalWithValue() throws Exception {
- return this.createTestType(new DefaultAnnotationWriter() {
- @Override
- public Iterator<String> imports() {
- return new ArrayIterator<String>(JPA.TEMPORAL, JPA.TEMPORAL_TYPE);
- }
- @Override
- public void appendIdFieldAnnotationTo(StringBuilder sb) {
- sb.append("@Temporal(TemporalType.DATE)");
- }
- });
- }
-
- public void testTemporal() throws Exception {
- ICompilationUnit cu = this.createTestTemporal();
- JavaResourcePersistentType typeResource = buildJavaTypeResource(cu);
- JavaResourcePersistentAttribute attributeResource = typeResource.fields().next();
-
- TemporalAnnotation temporal = (TemporalAnnotation) attributeResource.getSupportingAnnotation(JPA.TEMPORAL);
- assertNotNull(temporal);
- }
-
- public void testGetValue() throws Exception {
- ICompilationUnit cu = this.createTestTemporalWithValue();
- JavaResourcePersistentType typeResource = buildJavaTypeResource(cu);
- JavaResourcePersistentAttribute attributeResource = typeResource.fields().next();
-
- TemporalAnnotation temporal = (TemporalAnnotation) attributeResource.getSupportingAnnotation(JPA.TEMPORAL);
- assertEquals(TemporalType.DATE, temporal.getValue());
- }
-
- public void testSetValue() throws Exception {
- ICompilationUnit cu = this.createTestTemporal();
- JavaResourcePersistentType typeResource = buildJavaTypeResource(cu);
- JavaResourcePersistentAttribute attributeResource = typeResource.fields().next();
-
- TemporalAnnotation temporal = (TemporalAnnotation) attributeResource.getSupportingAnnotation(JPA.TEMPORAL);
-
- temporal.setValue(TemporalType.TIME);
-
- assertSourceContains("@Temporal(TIME)", cu);
-
- temporal.setValue(null);
-
- assertSourceDoesNotContain("@Temporal", cu);
- }
-
-}
diff --git a/jpa/tests/org.eclipse.jpt.core.tests/src/org/eclipse/jpt/core/tests/internal/resource/java/TransientTests.java b/jpa/tests/org.eclipse.jpt.core.tests/src/org/eclipse/jpt/core/tests/internal/resource/java/TransientTests.java
deleted file mode 100644
index e268318116..0000000000
--- a/jpa/tests/org.eclipse.jpt.core.tests/src/org/eclipse/jpt/core/tests/internal/resource/java/TransientTests.java
+++ /dev/null
@@ -1,50 +0,0 @@
-/*******************************************************************************
- * Copyright (c) 2007, 2009 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.
- *
- * Contributors:
- * Oracle - initial API and implementation
- ******************************************************************************/
-package org.eclipse.jpt.core.tests.internal.resource.java;
-
-import java.util.Iterator;
-import org.eclipse.jdt.core.ICompilationUnit;
-import org.eclipse.jpt.core.resource.java.JPA;
-import org.eclipse.jpt.core.resource.java.JavaResourceNode;
-import org.eclipse.jpt.core.resource.java.JavaResourcePersistentAttribute;
-import org.eclipse.jpt.core.resource.java.JavaResourcePersistentType;
-import org.eclipse.jpt.core.resource.java.TransientAnnotation;
-import org.eclipse.jpt.utility.internal.iterators.ArrayIterator;
-
-@SuppressWarnings("nls")
-public class TransientTests extends JavaResourceModelTestCase {
-
- public TransientTests(String name) {
- super(name);
- }
-
- private ICompilationUnit createTestTransient() throws Exception {
- return this.createTestType(new DefaultAnnotationWriter() {
- @Override
- public Iterator<String> imports() {
- return new ArrayIterator<String>(JPA.TRANSIENT);
- }
- @Override
- public void appendIdFieldAnnotationTo(StringBuilder sb) {
- sb.append("@Transient");
- }
- });
- }
-
- public void testTransient() throws Exception {
- ICompilationUnit cu = this.createTestTransient();
- JavaResourcePersistentType typeResource = buildJavaTypeResource(cu);
- JavaResourcePersistentAttribute attributeResource = typeResource.fields().next();
-
- JavaResourceNode mappingAnnotation = attributeResource.getMappingAnnotation();
- assertTrue(mappingAnnotation instanceof TransientAnnotation);
- }
-
-}
diff --git a/jpa/tests/org.eclipse.jpt.core.tests/src/org/eclipse/jpt/core/tests/internal/resource/java/VersionTests.java b/jpa/tests/org.eclipse.jpt.core.tests/src/org/eclipse/jpt/core/tests/internal/resource/java/VersionTests.java
deleted file mode 100644
index 5abf709599..0000000000
--- a/jpa/tests/org.eclipse.jpt.core.tests/src/org/eclipse/jpt/core/tests/internal/resource/java/VersionTests.java
+++ /dev/null
@@ -1,49 +0,0 @@
-/*******************************************************************************
- * Copyright (c) 2007, 2009 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.
- *
- * Contributors:
- * Oracle - initial API and implementation
- ******************************************************************************/
-package org.eclipse.jpt.core.tests.internal.resource.java;
-
-import java.util.Iterator;
-import org.eclipse.jdt.core.ICompilationUnit;
-import org.eclipse.jpt.core.resource.java.JPA;
-import org.eclipse.jpt.core.resource.java.JavaResourceNode;
-import org.eclipse.jpt.core.resource.java.JavaResourcePersistentAttribute;
-import org.eclipse.jpt.core.resource.java.JavaResourcePersistentType;
-import org.eclipse.jpt.core.resource.java.VersionAnnotation;
-import org.eclipse.jpt.utility.internal.iterators.ArrayIterator;
-
-@SuppressWarnings("nls")
-public class VersionTests extends JavaResourceModelTestCase {
-
- public VersionTests(String name) {
- super(name);
- }
-
- private ICompilationUnit createTestVersion() throws Exception {
- return this.createTestType(new DefaultAnnotationWriter() {
- @Override
- public Iterator<String> imports() {
- return new ArrayIterator<String>(JPA.VERSION);
- }
- @Override
- public void appendIdFieldAnnotationTo(StringBuilder sb) {
- sb.append("@Version");
- }
- });
- }
-
- public void testVersion() throws Exception {
- ICompilationUnit cu = this.createTestVersion();
- JavaResourcePersistentType typeResource = buildJavaTypeResource(cu);
- JavaResourcePersistentAttribute attributeResource = typeResource.fields().next();
-
- JavaResourceNode mappingAnnotation = attributeResource.getMappingAnnotation();
- assertTrue(mappingAnnotation instanceof VersionAnnotation);
- }
-}
diff --git a/jpa/tests/org.eclipse.jpt.core.tests/src/org/eclipse/jpt/core/tests/internal/utility/jdt/AnnotationTestCase.java b/jpa/tests/org.eclipse.jpt.core.tests/src/org/eclipse/jpt/core/tests/internal/utility/jdt/AnnotationTestCase.java
deleted file mode 100644
index 81c8d7f83b..0000000000
--- a/jpa/tests/org.eclipse.jpt.core.tests/src/org/eclipse/jpt/core/tests/internal/utility/jdt/AnnotationTestCase.java
+++ /dev/null
@@ -1,512 +0,0 @@
-/*******************************************************************************
- * Copyright (c) 2006, 2008 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.
- *
- * Contributors:
- * Oracle - initial API and implementation
- ******************************************************************************/
-package org.eclipse.jpt.core.tests.internal.utility.jdt;
-
-import java.io.File;
-import java.util.Iterator;
-import java.util.List;
-import junit.framework.TestCase;
-import org.eclipse.core.runtime.CoreException;
-import org.eclipse.core.runtime.IPath;
-import org.eclipse.core.runtime.Path;
-import org.eclipse.jdt.core.ICompilationUnit;
-import org.eclipse.jdt.core.JavaModelException;
-import org.eclipse.jdt.core.dom.AST;
-import org.eclipse.jdt.core.dom.Annotation;
-import org.eclipse.jdt.core.dom.CompilationUnit;
-import org.eclipse.jdt.core.dom.Expression;
-import org.eclipse.jdt.core.dom.MemberValuePair;
-import org.eclipse.jdt.core.dom.NormalAnnotation;
-import org.eclipse.jdt.core.dom.NumberLiteral;
-import org.eclipse.jdt.core.dom.SimpleName;
-import org.eclipse.jdt.core.dom.SingleMemberAnnotation;
-import org.eclipse.jdt.core.dom.StringLiteral;
-import org.eclipse.jpt.core.internal.utility.jdt.JDTFieldAttribute;
-import org.eclipse.jpt.core.internal.utility.jdt.JDTMethodAttribute;
-import org.eclipse.jpt.core.internal.utility.jdt.JDTTools;
-import org.eclipse.jpt.core.internal.utility.jdt.JDTType;
-import org.eclipse.jpt.core.tests.internal.projects.TestJavaProject;
-import org.eclipse.jpt.core.tests.internal.projects.TestJavaProject.SourceWriter;
-import org.eclipse.jpt.core.utility.jdt.Type;
-import org.eclipse.jpt.utility.internal.iterators.EmptyIterator;
-import org.eclipse.jpt.utility.internal.iterators.SingleElementIterator;
-import org.eclipse.jpt.utility.tests.internal.TestTools;
-
-/**
- * Provide an easy(?) way to build an annotated source file.
- * The type must be created by calling one of the #createType() methods
- * before calling any of the various helper methods (i.e. the type is *not*
- * created during #setUp()).
- */
-@SuppressWarnings("nls")
-public abstract class AnnotationTestCase extends TestCase {
- protected TestJavaProject javaProject;
-
- public static final String CR = System.getProperty("line.separator");
- public static final String SEP = File.separator;
- public static final String PROJECT_NAME = "AnnotationTestProject";
- public static final String PACKAGE_NAME = "test";
- public static final String TYPE_NAME = "AnnotationTestType";
- public static final String FULLY_QUALIFIED_TYPE_NAME = PACKAGE_NAME + "." + TYPE_NAME;
- public static final String FILE_NAME = TYPE_NAME + ".java";
- public static final IPath FILE_PATH = new Path("src" + SEP + PACKAGE_NAME + SEP + FILE_NAME);
-
- public static final String[] EMPTY_STRING_ARRAY = new String[0];
-
-
- // ********** TestCase behavior **********
-
- protected AnnotationTestCase(String name) {
- super(name);
- }
-
- @Override
- protected void setUp() throws Exception {
- super.setUp();
- this.javaProject = this.buildJavaProject(false); // false = no auto-build
- }
-
- protected TestJavaProject buildJavaProject(boolean autoBuild) throws Exception {
- return this.buildJavaProject(PROJECT_NAME, autoBuild);
- }
-
- protected TestJavaProject buildJavaProject(String projectName, boolean autoBuild) throws Exception {
- return new TestJavaProject(projectName, autoBuild);
- }
-
- @Override
- protected void tearDown() throws Exception {
-// this.dumpSource();
- this.javaProject.getProject().delete(true, true, null);
- TestTools.clear(this);
- super.tearDown();
- }
-
- protected void dumpSource(ICompilationUnit cu) throws Exception {
- System.out.println("*** " + this.getName() + " ****");
- System.out.println(this.getSource(cu));
- System.out.println();
- }
-
-
- // ********** type creation **********
-
- /**
- * create an un-annotated type
- */
- protected ICompilationUnit createTestType() throws CoreException {
- return this.createTestType(new DefaultAnnotationWriter());
- }
-
- /**
- * shortcut for simply adding an annotation to the 'id' field
- */
- protected ICompilationUnit createTestType(final String annotationImport, final String idFieldAnnotation) throws CoreException {
- return this.createTestType(new DefaultAnnotationWriter() {
- @Override
- public Iterator<String> imports() {
- return (annotationImport == null) ?
- EmptyIterator.<String>instance()
- :
- new SingleElementIterator<String>(annotationImport);
- }
- @Override
- public void appendIdFieldAnnotationTo(StringBuilder sb) {
- sb.append(idFieldAnnotation);
- }
- });
- }
-
- /**
- * shortcut for simply adding a fully-qualified annotation to the 'id' field
- */
- protected ICompilationUnit createTestType(final String idFieldAnnotation) throws CoreException {
- return this.createTestType(null, idFieldAnnotation);
- }
-
-
- protected ICompilationUnit createTestType(AnnotationWriter annotationWriter) throws CoreException {
- return this.javaProject.createCompilationUnit(PACKAGE_NAME, FILE_NAME, this.createSourceWriter(annotationWriter));
- }
-
- protected ICompilationUnit createTestType(String packageName, String fileName, String typeName, AnnotationWriter annotationWriter) throws CoreException {
- return this.javaProject.createCompilationUnit(packageName, fileName, this.createSourceWriter(annotationWriter, typeName));
- }
-
- protected SourceWriter createSourceWriter(AnnotationWriter annotationWriter) {
- return new AnnotatedSourceWriter(annotationWriter);
- }
-
- protected SourceWriter createSourceWriter(AnnotationWriter annotationWriter, String typeName) {
- return new AnnotatedSourceWriter(annotationWriter, typeName);
- }
-
- protected void appendSourceTo(StringBuilder sb, AnnotationWriter annotationWriter, String typeName) {
- sb.append(CR);
- for (Iterator<String> stream = annotationWriter.imports(); stream.hasNext(); ) {
- sb.append("import ");
- sb.append(stream.next());
- sb.append(";");
- sb.append(CR);
- }
- sb.append(CR);
- annotationWriter.appendTypeAnnotationTo(sb);
- sb.append(CR);
- sb.append("public class ").append(typeName).append(" ");
- annotationWriter.appendExtendsImplementsTo(sb);
- sb.append("{").append(CR);
- sb.append(CR);
- sb.append(" ");
- annotationWriter.appendIdFieldAnnotationTo(sb);
- sb.append(CR);
- sb.append(" private int id;").append(CR);
- sb.append(CR);
- sb.append(" ");
- annotationWriter.appendNameFieldAnnotationTo(sb);
- sb.append(CR);
- sb.append(" private String name;").append(CR);
- sb.append(CR);
- sb.append(" ");
- annotationWriter.appendGetIdMethodAnnotationTo(sb);
- sb.append(CR);
- sb.append(" public int getId() {").append(CR);
- sb.append(" return this.id;").append(CR);
- sb.append(" }").append(CR);
- sb.append(CR);
- sb.append(" ");
- annotationWriter.appendSetIdMethodAnnotationTo(sb);
- sb.append(CR);
- sb.append(" public void setId(int id) {").append(CR);
- sb.append(" this.id = id;").append(CR);
- sb.append(" }").append(CR);
- sb.append(CR);
- sb.append(" ");
- annotationWriter.appendGetNameMethodAnnotationTo(sb);
- sb.append(CR);
- sb.append(" public String getName() {").append(CR);
- sb.append(" return this.name;").append(CR);
- sb.append(" }").append(CR);
- sb.append(CR);
- sb.append(" ");
- annotationWriter.appendSetNameMethodAnnotationTo(sb);
- sb.append(CR);
- sb.append(" public void setTestField(String testField) {").append(CR);
- sb.append(" this.testField = testField;").append(CR);
- sb.append(" }").append(CR);
- sb.append(CR);
- annotationWriter.appendMemberTypeTo(sb);
- sb.append(CR);
- sb.append("}").append(CR);
- annotationWriter.appendTopLevelTypesTo(sb);
- sb.append(CR);
- }
-
-
- // ********** queries **********
-
- protected TestJavaProject getJavaProject() {
- return this.javaProject;
- }
-
- protected JDTType testType(ICompilationUnit cu) {
- return this.buildType(TYPE_NAME, cu);
- }
-
- protected JDTType buildType(String name, ICompilationUnit cu) {
- return this.buildType(name, 1, cu);
- }
-
- protected JDTType buildType(String name, int occurrence, ICompilationUnit cu) {
- return this.buildType(null, name, occurrence, cu);
- }
-
- protected JDTType buildType(Type declaringType, String name, int occurrence, ICompilationUnit cu) {
- return new JDTType(declaringType, name, occurrence, cu);
- }
-
- protected JDTFieldAttribute idField(ICompilationUnit cu) {
- return this.buildField("id", cu);
- }
-
- protected JDTFieldAttribute nameField(ICompilationUnit cu) {
- return this.buildField("name", cu);
- }
-
- protected JDTFieldAttribute buildField(String name, ICompilationUnit cu) {
- return this.buildField(name, 1, cu);
- }
-
- protected JDTFieldAttribute buildField(String name, int occurrence, ICompilationUnit cu) {
- return this.buildField(this.testType(cu), name, occurrence, cu);
- }
-
- protected JDTFieldAttribute buildField(Type declaringType, String name, int occurrence, ICompilationUnit cu) {
- return new JDTFieldAttribute(declaringType, name, occurrence, cu);
- }
-
- protected JDTMethodAttribute idGetMethod(ICompilationUnit cu) {
- return this.buildMethod("getId", cu);
- }
-
- protected JDTMethodAttribute idSetMethod(ICompilationUnit cu) {
- return this.buildMethod("setId", new String[] {"int"}, cu);
- }
-
- protected JDTMethodAttribute nameGetMethod(ICompilationUnit cu) {
- return this.buildMethod("getName", cu);
- }
-
- protected JDTMethodAttribute buildMethod(String name, ICompilationUnit cu) {
- return this.buildMethod(name, EMPTY_STRING_ARRAY, cu);
- }
-
- protected JDTMethodAttribute buildMethod(String name, String[] parameterTypeNames, ICompilationUnit cu) {
- return this.buildMethod(name, parameterTypeNames, 1, cu);
- }
-
- protected JDTMethodAttribute buildMethod(String name, String[] parameterTypeNames, int occurrence, ICompilationUnit cu) {
- return new JDTMethodAttribute(this.testType(cu), name, parameterTypeNames, occurrence, cu);
- }
-
- protected JDTMethodAttribute buildMethod(Type declaringType, String name, String[] parameterTypeNames, int occurrence, ICompilationUnit cu) {
- return new JDTMethodAttribute(declaringType, name, parameterTypeNames, occurrence, cu);
- }
-
- protected String getSource(ICompilationUnit cu) throws JavaModelException {
- return cu.getBuffer().getContents();
- }
-
- protected CompilationUnit buildASTRoot(ICompilationUnit cu) {
- return JDTTools.buildASTRoot(cu);
- }
-
-
- // ********** test validation **********
-
- protected void assertSourceContains(String s, ICompilationUnit cu) throws JavaModelException {
- String source = this.getSource(cu);
- boolean found = source.indexOf(s) > -1;
- if ( ! found) {
- String msg = "source does not contain the expected string: " + s + " (see System console)";
- System.out.println("*** " + this.getName() + " ****");
- System.out.println(msg);
- System.out.println(source);
- System.out.println();
- fail(msg);
- }
- }
-
- protected void assertSourceDoesNotContain(String s, ICompilationUnit cu) throws JavaModelException {
- String source = this.getSource(cu);
- int pos = source.indexOf(s);
- if (pos != -1) {
- String msg = "unexpected string in source (position: " + pos + "): " + s + " (see System console)";
- System.out.println("*** " + this.getName() + " ****");
- System.out.println(msg);
- System.out.println(source);
- System.out.println();
- fail(msg);
- }
- }
-
-
- // ********** manipulate annotations **********
-
- /**
- * Return the *first* member value pair for the specified annotation element
- * with the specified name.
- * Return null if the annotation has no such element.
- */
- protected MemberValuePair memberValuePair(NormalAnnotation annotation, String elementName) {
- for (MemberValuePair pair : this.values(annotation)) {
- if (pair.getName().getFullyQualifiedName().equals(elementName)) {
- return pair;
- }
- }
- return null;
- }
-
- /**
- * minimize the scope of the suppressed warnings
- */
- @SuppressWarnings("unchecked")
- protected List<MemberValuePair> values(NormalAnnotation na) {
- return na.values();
- }
-
- /**
- * check for null member value pair
- */
- protected Expression value_(MemberValuePair pair) {
- return (pair == null) ? null : pair.getValue();
- }
-
- /**
- * Return the value of the *first* annotation element
- * with the specified name.
- * Return null if the annotation has no such element.
- */
- protected Expression annotationElementValue(NormalAnnotation annotation, String elementName) {
- return this.value_(this.memberValuePair(annotation, elementName));
- }
-
- /**
- * Return the value of the *first* annotation element
- * with the specified name.
- * Return null if the annotation has no such element.
- */
- protected Expression annotationElementValue(SingleMemberAnnotation annotation, String elementName) {
- return elementName.equals("value") ? annotation.getValue() : null;
- }
-
- /**
- * Return the value of the *first* annotation element
- * with the specified name.
- * Return null if the annotation has no such element.
- * (An element name of "value" will return the value of a single
- * member annotation.)
- */
- protected Expression annotationElementValue(Annotation annotation, String elementName) {
- if (annotation.isNormalAnnotation()) {
- return this.annotationElementValue((NormalAnnotation) annotation, elementName);
- }
- if (annotation.isSingleMemberAnnotation()) {
- return this.annotationElementValue((SingleMemberAnnotation) annotation, elementName);
- }
- return null;
- }
-
- /**
- * Build a number literal and set its initial value to the specified literal.
- */
- protected NumberLiteral newNumberLiteral(AST ast, int value) {
- return ast.newNumberLiteral(Integer.toString(value));
- }
-
- /**
- * Build a string literal and set its initial value.
- */
- protected StringLiteral newStringLiteral(AST ast, String value) {
- StringLiteral stringLiteral = ast.newStringLiteral();
- stringLiteral.setLiteralValue(value);
- return stringLiteral;
- }
-
- protected MemberValuePair newMemberValuePair(AST ast, SimpleName name, Expression value) {
- MemberValuePair pair = ast.newMemberValuePair();
- pair.setName(name);
- pair.setValue(value);
- return pair;
- }
-
- protected MemberValuePair newMemberValuePair(AST ast, String name, Expression value) {
- return this.newMemberValuePair(ast, ast.newSimpleName(name), value);
- }
-
- protected MemberValuePair newMemberValuePair(AST ast, String name, String value) {
- return this.newMemberValuePair(ast, name, this.newStringLiteral(ast, value));
- }
-
- protected MemberValuePair newMemberValuePair(AST ast, String name, int value) {
- return this.newMemberValuePair(ast, name, this.newNumberLiteral(ast, value));
- }
-
- /**
- * Add the specified member value pair to the specified annotation.
- * Return the resulting annotation.
- */
- protected NormalAnnotation addMemberValuePair(NormalAnnotation annotation, MemberValuePair pair) {
- this.values(annotation).add(pair);
- return annotation;
- }
-
- /**
- * Add the specified member value pair to the specified annotation.
- * Return the resulting annotation.
- */
- protected NormalAnnotation addMemberValuePair(NormalAnnotation annotation, String name, int value) {
- return this.addMemberValuePair(annotation, this.newMemberValuePair(annotation.getAST(), name, value));
- }
-
- /**
- * Add the specified member value pair to the specified annotation.
- * Return the resulting annotation.
- */
- protected NormalAnnotation addMemberValuePair(NormalAnnotation annotation, String name, String value) {
- return this.addMemberValuePair(annotation, this.newMemberValuePair(annotation.getAST(), name, value));
- }
-
-
- // ********** member classes **********
-
- public interface AnnotationWriter {
- Iterator<String> imports();
- void appendTypeAnnotationTo(StringBuilder sb);
- void appendExtendsImplementsTo(StringBuilder sb);
- void appendIdFieldAnnotationTo(StringBuilder sb);
- void appendNameFieldAnnotationTo(StringBuilder sb);
- void appendGetIdMethodAnnotationTo(StringBuilder sb);
- void appendSetIdMethodAnnotationTo(StringBuilder sb);
- void appendGetNameMethodAnnotationTo(StringBuilder sb);
- void appendSetNameMethodAnnotationTo(StringBuilder sb);
- void appendMemberTypeTo(StringBuilder sb);
- void appendTopLevelTypesTo(StringBuilder sb);
- }
-
- public static class DefaultAnnotationWriter implements AnnotationWriter {
- public Iterator<String> imports() {return EmptyIterator.instance();}
- public void appendTypeAnnotationTo(StringBuilder sb) {/* do nothing */}
- public void appendExtendsImplementsTo(StringBuilder sb) {/* do nothing */}
- public void appendIdFieldAnnotationTo(StringBuilder sb) {/* do nothing */}
- public void appendNameFieldAnnotationTo(StringBuilder sb) {/* do nothing */}
- public void appendGetIdMethodAnnotationTo(StringBuilder sb) {/* do nothing */}
- public void appendSetIdMethodAnnotationTo(StringBuilder sb) {/* do nothing */}
- public void appendGetNameMethodAnnotationTo(StringBuilder sb) {/* do nothing */}
- public void appendSetNameMethodAnnotationTo(StringBuilder sb) {/* do nothing */}
- public void appendMemberTypeTo(StringBuilder sb) {/* do nothing */}
- public void appendTopLevelTypesTo(StringBuilder sb) {/* do nothing */}
- }
-
- public static class AnnotationWriterWrapper implements AnnotationWriter {
- private final AnnotationWriter aw;
- public AnnotationWriterWrapper(AnnotationWriter aw) {
- super();
- this.aw = aw;
- }
- public Iterator<String> imports() {return aw.imports();}
- public void appendTypeAnnotationTo(StringBuilder sb) {aw.appendTypeAnnotationTo(sb);}
- public void appendExtendsImplementsTo(StringBuilder sb) {aw.appendExtendsImplementsTo(sb);}
- public void appendIdFieldAnnotationTo(StringBuilder sb) {aw.appendIdFieldAnnotationTo(sb);}
- public void appendNameFieldAnnotationTo(StringBuilder sb) {aw.appendNameFieldAnnotationTo(sb);}
- public void appendGetIdMethodAnnotationTo(StringBuilder sb) {aw.appendGetIdMethodAnnotationTo(sb);}
- public void appendSetIdMethodAnnotationTo(StringBuilder sb) {aw.appendSetIdMethodAnnotationTo(sb);}
- public void appendGetNameMethodAnnotationTo(StringBuilder sb) {aw.appendGetNameMethodAnnotationTo(sb);}
- public void appendSetNameMethodAnnotationTo(StringBuilder sb) {aw.appendSetNameMethodAnnotationTo(sb);}
- public void appendMemberTypeTo(StringBuilder sb) {aw.appendMemberTypeTo(sb);}
- public void appendTopLevelTypesTo(StringBuilder sb) {aw.appendTopLevelTypesTo(sb);}
- }
-
- public class AnnotatedSourceWriter implements SourceWriter {
- private AnnotationWriter annotationWriter;
- private String typeName;
- public AnnotatedSourceWriter(AnnotationWriter annotationWriter) {
- this(annotationWriter, TYPE_NAME);
- }
- public AnnotatedSourceWriter(AnnotationWriter annotationWriter, String typeName) {
- super();
- this.annotationWriter = annotationWriter;
- this.typeName = typeName;
- }
- public void appendSourceTo(StringBuilder sb) {
- AnnotationTestCase.this.appendSourceTo(sb, this.annotationWriter, typeName);
- }
- }
-
-}
diff --git a/jpa/tests/org.eclipse.jpt.core.tests/src/org/eclipse/jpt/core/tests/internal/utility/jdt/CombinationIndexedDeclarationAnnotationAdapterTests.java b/jpa/tests/org.eclipse.jpt.core.tests/src/org/eclipse/jpt/core/tests/internal/utility/jdt/CombinationIndexedDeclarationAnnotationAdapterTests.java
deleted file mode 100644
index e5145d95af..0000000000
--- a/jpa/tests/org.eclipse.jpt.core.tests/src/org/eclipse/jpt/core/tests/internal/utility/jdt/CombinationIndexedDeclarationAnnotationAdapterTests.java
+++ /dev/null
@@ -1,733 +0,0 @@
-/*******************************************************************************
- * Copyright (c) 2006, 2009 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.
- *
- * Contributors:
- * Oracle - initial API and implementation
- ******************************************************************************/
-package org.eclipse.jpt.core.tests.internal.utility.jdt;
-
-import org.eclipse.jdt.core.ICompilationUnit;
-import org.eclipse.jdt.core.dom.Annotation;
-import org.eclipse.jdt.core.dom.MemberValuePair;
-import org.eclipse.jdt.core.dom.NormalAnnotation;
-import org.eclipse.jdt.core.dom.StringLiteral;
-import org.eclipse.jpt.core.internal.utility.jdt.CombinationIndexedDeclarationAnnotationAdapter;
-import org.eclipse.jpt.core.internal.utility.jdt.MemberAnnotationAdapter;
-import org.eclipse.jpt.core.internal.utility.jdt.MemberIndexedAnnotationAdapter;
-import org.eclipse.jpt.core.utility.jdt.AnnotationAdapter;
-import org.eclipse.jpt.core.utility.jdt.DeclarationAnnotationAdapter;
-import org.eclipse.jpt.core.utility.jdt.IndexedAnnotationAdapter;
-import org.eclipse.jpt.core.utility.jdt.IndexedDeclarationAnnotationAdapter;
-
-@SuppressWarnings("nls")
-public class CombinationIndexedDeclarationAnnotationAdapterTests extends AnnotationTestCase {
-
- public CombinationIndexedDeclarationAnnotationAdapterTests(String name) {
- super(name);
- }
-
- private void createAnnotationAndMembers(String annotationName, String annotationBody) throws Exception {
- this.javaProject.createCompilationUnit("annot", annotationName + ".java", "public @interface " + annotationName + " { " + annotationBody + " }");
- }
-
- public void testAnnotation1() throws Exception {
- this.createAnnotationAndMembers("JoinColumn", "String name();");
- this.createAnnotationAndMembers("JoinColumns", "JoinColumn[] value();");
- ICompilationUnit cu = this.createTestType("@annot.JoinColumn(name=\"ADDRESS_ID\")");
- DeclarationAnnotationAdapter daa = new CombinationIndexedDeclarationAnnotationAdapter(
- "annot.JoinColumn", "annot.JoinColumns", 0);
- AnnotationAdapter aa = new MemberAnnotationAdapter(this.idField(cu), daa);
- Annotation annotation = aa.getAnnotation(this.buildASTRoot(cu));
- assertNotNull(annotation);
- assertEquals("annot.JoinColumn", annotation.getTypeName().getFullyQualifiedName());
- assertTrue(annotation.isNormalAnnotation());
- }
-
- public void testAnnotation2() throws Exception {
- this.createAnnotationAndMembers("JoinColumn", "String name();");
- this.createAnnotationAndMembers("JoinColumns", "JoinColumn[] value();");
- ICompilationUnit cu = this.createTestType("@annot.JoinColumn(name=\"ADDRESS_ID\")");
- DeclarationAnnotationAdapter daa = new CombinationIndexedDeclarationAnnotationAdapter(
- "annot.JoinColumn", "annot.JoinColumns", 1);
- AnnotationAdapter aa = new MemberAnnotationAdapter(this.idField(cu), daa);
- Annotation annotation = aa.getAnnotation(this.buildASTRoot(cu));
- assertNull(annotation);
- }
-
- public void testAnnotation3() throws Exception {
- this.createAnnotationAndMembers("JoinColumn", "String name();");
- this.createAnnotationAndMembers("JoinColumns", "JoinColumn[] value();");
- ICompilationUnit cu = this.createTestType("@annot.JoinColumns(@annot.JoinColumn(name=\"ADDRESS_ID\"))");
- DeclarationAnnotationAdapter daa = new CombinationIndexedDeclarationAnnotationAdapter(
- "annot.JoinColumn", "annot.JoinColumns", 0);
- AnnotationAdapter aa = new MemberAnnotationAdapter(this.idField(cu), daa);
- Annotation annotation = aa.getAnnotation(this.buildASTRoot(cu));
- assertNotNull(annotation);
- assertEquals("annot.JoinColumn", annotation.getTypeName().getFullyQualifiedName());
- assertTrue(annotation.isNormalAnnotation());
- }
-
- public void testAnnotation4() throws Exception {
- this.createAnnotationAndMembers("JoinColumn", "String name();");
- this.createAnnotationAndMembers("JoinColumns", "JoinColumn[] value();");
- ICompilationUnit cu = this.createTestType("@annot.JoinColumns(@annot.JoinColumn(name=\"ADDRESS_ID\"))");
- DeclarationAnnotationAdapter daa = new CombinationIndexedDeclarationAnnotationAdapter(
- "annot.JoinColumn", "annot.JoinColumns", 1);
- AnnotationAdapter aa = new MemberAnnotationAdapter(this.idField(cu), daa);
- Annotation annotation = aa.getAnnotation(this.buildASTRoot(cu));
- assertNull(annotation);
- }
-
- public void testAnnotation5() throws Exception {
- this.createAnnotationAndMembers("JoinColumn", "String name();");
- this.createAnnotationAndMembers("JoinColumns", "JoinColumn[] value();");
- ICompilationUnit cu = this.createTestType("@annot.JoinColumns({@annot.JoinColumn(name=\"ADDRESS_ID1\"), @annot.JoinColumn(name=\"ADDRESS_ID2\")})");
- DeclarationAnnotationAdapter daa = new CombinationIndexedDeclarationAnnotationAdapter(
- "annot.JoinColumn", "annot.JoinColumns", 1);
- AnnotationAdapter aa = new MemberAnnotationAdapter(this.idField(cu), daa);
- Annotation annotation = aa.getAnnotation(this.buildASTRoot(cu));
- assertNotNull(annotation);
- assertEquals("annot.JoinColumn", annotation.getTypeName().getFullyQualifiedName());
- assertTrue(annotation.isNormalAnnotation());
- String value = ((StringLiteral) ((MemberValuePair) ((NormalAnnotation) annotation).values().get(0)).getValue()).getLiteralValue();
- assertEquals("ADDRESS_ID2", value);
- }
-
- public void testAnnotation6() throws Exception {
- this.createAnnotationAndMembers("JoinColumn", "String name();");
- this.createAnnotationAndMembers("JoinColumns", "JoinColumn[] value();");
- ICompilationUnit cu = this.createTestType("@annot.JoinColumns({@annot.JoinColumn(name=\"ADDRESS_ID1\"), @annot.JoinColumn(name=\"ADDRESS_ID2\")})");
- DeclarationAnnotationAdapter daa = new CombinationIndexedDeclarationAnnotationAdapter(
- "annot.JoinColumn", "annot.JoinColumns", "columns", 1);
- AnnotationAdapter aa = new MemberAnnotationAdapter(this.idField(cu), daa);
- Annotation annotation = aa.getAnnotation(this.buildASTRoot(cu));
- assertNull(annotation);
- }
-
- public void testAnnotation7() throws Exception {
- this.createAnnotationAndMembers("JoinColumn", "String name();");
- this.createAnnotationAndMembers("JoinColumns", "JoinColumn[] columns();");
- ICompilationUnit cu = this.createTestType("@annot.JoinColumns(columns={@annot.JoinColumn(name=\"ADDRESS_ID1\"), @annot.JoinColumn(name=\"ADDRESS_ID2\")})");
- DeclarationAnnotationAdapter daa = new CombinationIndexedDeclarationAnnotationAdapter(
- "annot.JoinColumn", "annot.JoinColumns", "columns", 1);
- AnnotationAdapter aa = new MemberAnnotationAdapter(this.idField(cu), daa);
- Annotation annotation = aa.getAnnotation(this.buildASTRoot(cu));
- assertNotNull(annotation);
- assertEquals("annot.JoinColumn", annotation.getTypeName().getFullyQualifiedName());
- assertTrue(annotation.isNormalAnnotation());
- String value = ((StringLiteral) ((MemberValuePair) ((NormalAnnotation) annotation).values().get(0)).getValue()).getLiteralValue();
- assertEquals("ADDRESS_ID2", value);
- }
-
- public void testAnnotation8() throws Exception {
- this.createAnnotationAndMembers("JoinColumn", "String name();");
- this.createAnnotationAndMembers("JoinColumns", "JoinColumn[] columns();");
- ICompilationUnit cu = this.createTestType("@annot.JoinColumns(columns={@annot.JoinColumn(name=\"ADDRESS_ID1\"), @annot.JoinColumn(name=\"ADDRESS_ID2\")})");
- DeclarationAnnotationAdapter daa = new CombinationIndexedDeclarationAnnotationAdapter(
- "annot.JoinColumn", "annot.JoinColumns", 1);
- AnnotationAdapter aa = new MemberAnnotationAdapter(this.idField(cu), daa);
- Annotation annotation = aa.getAnnotation(this.buildASTRoot(cu));
- assertNull(annotation);
- }
-
- public void testRemoveAnnotation1() throws Exception {
- this.createAnnotationAndMembers("JoinColumn", "String name();");
- this.createAnnotationAndMembers("JoinColumns", "JoinColumn[] value();");
- ICompilationUnit cu = this.createTestType("@annot.JoinColumn(name=\"ADDRESS_ID\")");
- DeclarationAnnotationAdapter daa = new CombinationIndexedDeclarationAnnotationAdapter(
- "annot.JoinColumn", "annot.JoinColumns", 0);
- AnnotationAdapter aa = new MemberAnnotationAdapter(this.idField(cu), daa);
- aa.removeAnnotation();
- this.assertSourceDoesNotContain("JoinColumn", cu);
- }
-
- public void testRemoveAnnotation2() throws Exception {
- this.createAnnotationAndMembers("JoinColumn", "String name();");
- this.createAnnotationAndMembers("JoinColumns", "JoinColumn[] value();");
- ICompilationUnit cu = this.createTestType("@annot.JoinColumns(@annot.JoinColumn(name=\"ADDRESS_ID\"))");
- DeclarationAnnotationAdapter daa = new CombinationIndexedDeclarationAnnotationAdapter(
- "annot.JoinColumn", "annot.JoinColumns", 0);
- AnnotationAdapter aa = new MemberAnnotationAdapter(this.idField(cu), daa);
- aa.removeAnnotation();
- this.assertSourceDoesNotContain("JoinColumns", cu);
- this.assertSourceDoesNotContain("JoinColumn", cu);
- }
-
- public void testRemoveAnnotation3() throws Exception {
- this.createAnnotationAndMembers("JoinColumn", "String name();");
- this.createAnnotationAndMembers("JoinColumns", "JoinColumn[] value();");
- ICompilationUnit cu = this.createTestType("@annot.JoinColumns({@annot.JoinColumn(name=\"ADDRESS_ID1\"), @annot.JoinColumn(name=\"ADDRESS_ID2\")})");
- DeclarationAnnotationAdapter daa = new CombinationIndexedDeclarationAnnotationAdapter(
- "annot.JoinColumn", "annot.JoinColumns", 1);
- AnnotationAdapter aa = new MemberAnnotationAdapter(this.idField(cu), daa);
- aa.removeAnnotation();
- this.assertSourceDoesNotContain("JoinColumns", cu);
- this.assertSourceDoesNotContain("ADDRESS_ID2", cu);
- this.assertSourceContains("@JoinColumn(name=\"ADDRESS_ID1\")", cu);
- }
-
- public void testRemoveAnnotation4() throws Exception {
- this.createAnnotationAndMembers("JoinColumn", "String name();");
- this.createAnnotationAndMembers("JoinColumns", "JoinColumn[] columns();");
- ICompilationUnit cu = this.createTestType("@annot.JoinColumns(columns={@annot.JoinColumn(name=\"ADDRESS_ID1\"), @annot.JoinColumn(name=\"ADDRESS_ID2\")})");
- DeclarationAnnotationAdapter daa = new CombinationIndexedDeclarationAnnotationAdapter(
- "annot.JoinColumn", "annot.JoinColumns", "columns", 1);
- AnnotationAdapter aa = new MemberAnnotationAdapter(this.idField(cu), daa);
- aa.removeAnnotation();
- this.assertSourceDoesNotContain("JoinColumns", cu);
- this.assertSourceDoesNotContain("ADDRESS_ID2", cu);
- this.assertSourceContains("@JoinColumn(name=\"ADDRESS_ID1\")", cu);
- }
-
- public void testRemoveAnnotation5() throws Exception {
- this.createAnnotationAndMembers("JoinColumn", "String name();");
- this.createAnnotationAndMembers("JoinColumns", "String comment(); JoinColumn[] columns();");
- ICompilationUnit cu = this.createTestType("@annot.JoinColumns(comment=\"test\",columns={@annot.JoinColumn(name=\"ADDRESS_ID1\"), @annot.JoinColumn(name=\"ADDRESS_ID2\")})");
- DeclarationAnnotationAdapter daa = new CombinationIndexedDeclarationAnnotationAdapter(
- "annot.JoinColumn", "annot.JoinColumns", "columns", 1);
- AnnotationAdapter aa = new MemberAnnotationAdapter(this.idField(cu), daa);
- aa.removeAnnotation();
- this.assertSourceContains("@annot.JoinColumns(comment=\"test\",columns=@annot.JoinColumn(name=\"ADDRESS_ID1\"))", cu);
- }
-
- public void testRemoveAnnotation6() throws Exception {
- this.createAnnotationAndMembers("JoinColumn", "String name();");
- this.createAnnotationAndMembers("JoinColumns", "JoinColumn[] value();");
- ICompilationUnit cu = this.createTestType("@annot.JoinColumns(null)");
- DeclarationAnnotationAdapter daa = new CombinationIndexedDeclarationAnnotationAdapter(
- "annot.JoinColumn", "annot.JoinColumns", 0);
- AnnotationAdapter aa = new MemberAnnotationAdapter(this.idField(cu), daa);
- aa.removeAnnotation();
- this.assertSourceContains("@annot.JoinColumns(null)", cu);
- }
-
- public void testRemoveAnnotation12() throws Exception {
- this.createAnnotationAndMembers("JoinColumn", "String name();");
- this.createAnnotationAndMembers("JoinColumns", "JoinColumn[] value();");
- ICompilationUnit cu = this.createTestType("@annot.JoinColumns({@annot.JoinColumn(name=\"ADDRESS_ID0\"), null, @annot.JoinColumn(name=\"ADDRESS_ID2\")})");
- String expected = "@JoinColumn(name=\"ADDRESS_ID0\")";
- DeclarationAnnotationAdapter daa = new CombinationIndexedDeclarationAnnotationAdapter(
- "annot.JoinColumn", "annot.JoinColumns", "value", 2);
- AnnotationAdapter aa = new MemberAnnotationAdapter(this.idField(cu), daa);
- Annotation annotation = aa.getAnnotation(this.buildASTRoot(cu));
- assertNotNull(annotation);
-
- aa.removeAnnotation();
- this.assertSourceContains(expected, cu);
- this.assertSourceDoesNotContain("JoinColumns", cu);
- }
-
- public void testRemoveAnnotation13() throws Exception {
- this.createAnnotationAndMembers("JoinColumn", "String name();");
- this.createAnnotationAndMembers("JoinColumns", "JoinColumn[] value();");
- ICompilationUnit cu = this.createTestType("@annot.JoinColumns({null, @annot.JoinColumn(name=\"ADDRESS_ID1\")})");
- this.assertSourceContains("@annot.JoinColumn", cu);
- DeclarationAnnotationAdapter daa = new CombinationIndexedDeclarationAnnotationAdapter(
- "annot.JoinColumn", "annot.JoinColumns", "value", 1);
- AnnotationAdapter aa = new MemberAnnotationAdapter(this.idField(cu), daa);
- Annotation annotation = aa.getAnnotation(this.buildASTRoot(cu));
- assertNotNull(annotation);
-
- aa.removeAnnotation();
- this.assertSourceDoesNotContain("JoinColumn", cu);
- }
-
- public void testRemoveAnnotation14() throws Exception {
- this.createAnnotationAndMembers("JoinColumn", "String name();");
- this.createAnnotationAndMembers("JoinColumns", "JoinColumn[] value();");
- ICompilationUnit cu = this.createTestType("@annot.JoinColumns({@annot.JoinColumn(name=\"ADDRESS_ID0\"), null, @annot.JoinColumn(name=\"ADDRESS_ID2\"), null})");
- String expected = "@JoinColumn(name=\"ADDRESS_ID0\")";
- DeclarationAnnotationAdapter daa = new CombinationIndexedDeclarationAnnotationAdapter(
- "annot.JoinColumn", "annot.JoinColumns", "value", 2);
- AnnotationAdapter aa = new MemberAnnotationAdapter(this.idField(cu), daa);
- Annotation annotation = aa.getAnnotation(this.buildASTRoot(cu));
- assertNotNull(annotation);
-
- aa.removeAnnotation();
- this.assertSourceContains(expected, cu);
- }
-
- public void testRemoveAnnotation15() throws Exception {
- this.createAnnotationAndMembers("JoinColumn", "String name();");
- this.createAnnotationAndMembers("JoinColumns", "JoinColumn[] value();");
- ICompilationUnit cu = this.createTestType("@annot.JoinColumns({@annot.JoinColumn(name=\"ADDRESS_ID0\"), null, @annot.JoinColumn(name=\"ADDRESS_ID2\"), @annot.JoinColumn(name=\"ADDRESS_ID3\")})");
- String expected = "@annot.JoinColumns({@annot.JoinColumn(name=\"ADDRESS_ID0\"), null, null, @annot.JoinColumn(name=\"ADDRESS_ID3\")})";
- DeclarationAnnotationAdapter daa = new CombinationIndexedDeclarationAnnotationAdapter(
- "annot.JoinColumn", "annot.JoinColumns", "value", 2);
- AnnotationAdapter aa = new MemberAnnotationAdapter(this.idField(cu), daa);
- Annotation annotation = aa.getAnnotation(this.buildASTRoot(cu));
- assertNotNull(annotation);
-
- aa.removeAnnotation();
- this.assertSourceContains(expected, cu);
- }
-
- public void testRemoveAnnotation16() throws Exception {
- this.createAnnotationAndMembers("JoinColumn", "String name();");
- this.createAnnotationAndMembers("JoinColumns", "JoinColumn[] value();");
- ICompilationUnit cu = this.createTestType("@annot.JoinColumns({@annot.JoinColumn(name=\"ADDRESS_ID0\"), null, @annot.JoinColumn(name=\"ADDRESS_ID2\"), @annot.JoinColumn(name=\"ADDRESS_ID3\")})");
- String expected = "@annot.JoinColumns({@annot.JoinColumn(name=\"ADDRESS_ID0\"), null, @annot.JoinColumn(name=\"ADDRESS_ID2\")})";
- DeclarationAnnotationAdapter daa = new CombinationIndexedDeclarationAnnotationAdapter(
- "annot.JoinColumn", "annot.JoinColumns", "value", 3);
- AnnotationAdapter aa = new MemberAnnotationAdapter(this.idField(cu), daa);
- Annotation annotation = aa.getAnnotation(this.buildASTRoot(cu));
- assertNotNull(annotation);
-
- aa.removeAnnotation();
- this.assertSourceContains(expected, cu);
- }
-
- public void testRemoveAnnotation17() throws Exception {
- this.createAnnotationAndMembers("JoinColumn", "String name();");
- this.createAnnotationAndMembers("JoinColumns", "JoinColumn[] value();");
- ICompilationUnit cu = this.createTestType("@annot.JoinColumns({null, null, @annot.JoinColumn(name=\"ADDRESS_ID2\")})");
- this.assertSourceContains("@annot.JoinColumn", cu);
- DeclarationAnnotationAdapter daa = new CombinationIndexedDeclarationAnnotationAdapter(
- "annot.JoinColumn", "annot.JoinColumns", "value", 2);
- AnnotationAdapter aa = new MemberAnnotationAdapter(this.idField(cu), daa);
- Annotation annotation = aa.getAnnotation(this.buildASTRoot(cu));
- assertNotNull(annotation);
-
- aa.removeAnnotation();
- this.assertSourceDoesNotContain("JoinColumn", cu);
- }
-
- public void testNewMarkerAnnotation1() throws Exception {
- this.createAnnotationAndMembers("JoinColumn", "String name();");
- this.createAnnotationAndMembers("JoinColumns", "JoinColumn[] columns();");
- ICompilationUnit cu = this.createTestType();
- this.assertSourceDoesNotContain("JoinColumn", cu);
- DeclarationAnnotationAdapter daa = new CombinationIndexedDeclarationAnnotationAdapter(
- "annot.JoinColumn", "annot.JoinColumns", "columns", 0);
- AnnotationAdapter aa = new MemberAnnotationAdapter(this.idField(cu), daa);
- Annotation annotation = aa.getAnnotation(this.buildASTRoot(cu));
- assertNull(annotation);
-
- aa.newMarkerAnnotation();
- this.assertSourceContains("JoinColumn", cu);
- this.assertSourceDoesNotContain("JoinColumns", cu);
- }
-
- public void testNewMarkerAnnotation2() throws Exception {
- this.createAnnotationAndMembers("JoinColumn", "String name();");
- this.createAnnotationAndMembers("JoinColumns", "JoinColumn[] columns();");
- ICompilationUnit cu = this.createTestType("@annot.JoinColumn");
- this.assertSourceDoesNotContain("JoinColumns", cu);
- DeclarationAnnotationAdapter daa = new CombinationIndexedDeclarationAnnotationAdapter(
- "annot.JoinColumn", "annot.JoinColumns", "columns", 1);
- AnnotationAdapter aa = new MemberAnnotationAdapter(this.idField(cu), daa);
- Annotation annotation = aa.getAnnotation(this.buildASTRoot(cu));
- assertNull(annotation);
-
- aa.newMarkerAnnotation();
- this.assertSourceContains("@JoinColumns(columns = { @JoinColumn, @JoinColumn })", cu);
- }
-
- public void testNewMarkerAnnotation3() throws Exception {
- this.createAnnotationAndMembers("JoinColumn", "String name();");
- this.createAnnotationAndMembers("JoinColumns", "JoinColumn[] columns();");
- ICompilationUnit cu = this.createTestType("@annot.JoinColumns(columns={@annot.JoinColumn, @annot.JoinColumn})");
- DeclarationAnnotationAdapter daa = new CombinationIndexedDeclarationAnnotationAdapter(
- "annot.JoinColumn", "annot.JoinColumns", "columns", 2);
- AnnotationAdapter aa = new MemberAnnotationAdapter(this.idField(cu), daa);
- Annotation annotation = aa.getAnnotation(this.buildASTRoot(cu));
- assertNull(annotation);
-
- aa.newMarkerAnnotation();
- this.assertSourceContains("@annot.JoinColumns(columns={@annot.JoinColumn, @annot.JoinColumn," + CR + " @JoinColumn})", cu);
- }
-
- public void testNewMarkerAnnotation4() throws Exception {
- this.createAnnotationAndMembers("JoinColumn", "String name();");
- this.createAnnotationAndMembers("JoinColumns", "JoinColumn[] columns();");
- ICompilationUnit cu = this.createTestType("@annot.JoinColumn(77)");
- DeclarationAnnotationAdapter daa = new CombinationIndexedDeclarationAnnotationAdapter(
- "annot.JoinColumn", "annot.JoinColumns", "columns", 0);
- AnnotationAdapter aa = new MemberAnnotationAdapter(this.idField(cu), daa);
- Annotation annotation = aa.getAnnotation(this.buildASTRoot(cu));
- assertNotNull(annotation);
-
- aa.newMarkerAnnotation();
- this.assertSourceContains("JoinColumn", cu);
- this.assertSourceDoesNotContain("JoinColumns", cu);
- this.assertSourceDoesNotContain("77", cu);
- }
-
- public void testNewMarkerAnnotation5() throws Exception {
- this.createAnnotationAndMembers("JoinColumn", "String name();");
- this.createAnnotationAndMembers("JoinColumns", "JoinColumn[] columns();");
- ICompilationUnit cu = this.createTestType("@annot.JoinColumns(columns=@annot.JoinColumn(77))");
- DeclarationAnnotationAdapter daa = new CombinationIndexedDeclarationAnnotationAdapter(
- "annot.JoinColumn", "annot.JoinColumns", "columns", 0);
- AnnotationAdapter aa = new MemberAnnotationAdapter(this.idField(cu), daa);
- Annotation annotation = aa.getAnnotation(this.buildASTRoot(cu));
- assertNotNull(annotation);
-
- aa.newMarkerAnnotation();
- this.assertSourceContains("@annot.JoinColumns(columns=@JoinColumn)", cu);
- this.assertSourceDoesNotContain("77", cu);
- }
-
- public void testNewMarkerAnnotation6() throws Exception {
- this.createAnnotationAndMembers("JoinColumn", "String name();");
- this.createAnnotationAndMembers("JoinColumns", "JoinColumn[] columns();");
- ICompilationUnit cu = this.createTestType("@annot.JoinColumns(columns=@annot.JoinColumn(77))");
- DeclarationAnnotationAdapter daa = new CombinationIndexedDeclarationAnnotationAdapter(
- "annot.JoinColumn", "annot.JoinColumns", "columns", 1);
- AnnotationAdapter aa = new MemberAnnotationAdapter(this.idField(cu), daa);
- Annotation annotation = aa.getAnnotation(this.buildASTRoot(cu));
- assertNull(annotation);
-
- aa.newMarkerAnnotation();
- this.assertSourceContains("@annot.JoinColumns(columns={@annot.JoinColumn(77),@JoinColumn})", cu);
- }
-
- public void testNewMarkerAnnotation7() throws Exception {
- this.createAnnotationAndMembers("JoinColumn", "String name();");
- this.createAnnotationAndMembers("JoinColumns", "JoinColumn[] columns();");
- ICompilationUnit cu = this.createTestType("@annot.JoinColumn(77)");
- DeclarationAnnotationAdapter daa = new CombinationIndexedDeclarationAnnotationAdapter(
- "annot.JoinColumn", "annot.JoinColumns", "columns", 1);
- AnnotationAdapter aa = new MemberAnnotationAdapter(this.idField(cu), daa);
- Annotation annotation = aa.getAnnotation(this.buildASTRoot(cu));
- assertNull(annotation);
-
- aa.newMarkerAnnotation();
- this.assertSourceContains("@JoinColumns(columns = { @JoinColumn(77), @JoinColumn })", cu);
- }
-
- public void testNewMarkerAnnotation8() throws Exception {
- this.createAnnotationAndMembers("JoinColumn", "String name();");
- this.createAnnotationAndMembers("JoinColumns", "JoinColumn[] columns();");
- ICompilationUnit cu = this.createTestType("@annot.JoinColumns(columns={@annot.JoinColumn(77),@annot.JoinColumn(88)})");
- DeclarationAnnotationAdapter daa = new CombinationIndexedDeclarationAnnotationAdapter(
- "annot.JoinColumn", "annot.JoinColumns", "columns", 1);
- AnnotationAdapter aa = new MemberAnnotationAdapter(this.idField(cu), daa);
- Annotation annotation = aa.getAnnotation(this.buildASTRoot(cu));
- assertNotNull(annotation);
-
- aa.newMarkerAnnotation();
- this.assertSourceContains("@annot.JoinColumns(columns={@annot.JoinColumn(77),@JoinColumn})", cu);
- }
-
- public void testNewMarkerAnnotation9() throws Exception {
- this.createAnnotationAndMembers("JoinColumn", "String name(); String text(); int num();");
- this.createAnnotationAndMembers("JoinColumns", "JoinColumn[] columns();");
- ICompilationUnit cu = this.createTestType("@annot.JoinColumn(text=\"blah\",num=42)");
- DeclarationAnnotationAdapter daa = new CombinationIndexedDeclarationAnnotationAdapter(
- "annot.JoinColumn", "annot.JoinColumns", "columns", 1);
- AnnotationAdapter aa = new MemberAnnotationAdapter(this.idField(cu), daa);
- Annotation annotation = aa.getAnnotation(this.buildASTRoot(cu));
- assertNull(annotation);
-
- aa.newMarkerAnnotation();
- this.assertSourceContains("@JoinColumns(columns = { @JoinColumn(text = \"blah\", num = 42), @JoinColumn })", cu);
- }
-
- public void testNewMarkerAnnotation23() throws Exception {
- this.createAnnotationAndMembers("JoinColumn", "String name(); String text(); int num();");
- this.createAnnotationAndMembers("JoinColumns", "JoinColumn[] columns();");
- ICompilationUnit cu = this.createTestType("@annot.JoinColumn(text=\"b\",num=4)");
- String expected1 = "@JoinColumns(columns = { @JoinColumn(text = \"b\", num = 4), null,";
- String expected2 = "@JoinColumn })";
- this.assertSourceDoesNotContain(expected1, cu);
- this.assertSourceDoesNotContain(expected2, cu);
- DeclarationAnnotationAdapter daa = new CombinationIndexedDeclarationAnnotationAdapter(
- "annot.JoinColumn", "annot.JoinColumns", "columns", 2);
- AnnotationAdapter aa = new MemberAnnotationAdapter(this.idField(cu), daa);
- aa.newMarkerAnnotation();
- this.assertSourceContains(expected1, cu);
- this.assertSourceContains(expected2, cu);
- }
-
- public void testNewMarkerAnnotation24() throws Exception {
- this.createAnnotationAndMembers("JoinColumn", "String name(); String text(); int num();");
- this.createAnnotationAndMembers("JoinColumns", "JoinColumn[] value();");
- ICompilationUnit cu = this.createTestType("@annot.JoinColumn(text=\"blah\",num=42)");
- String expected1 = "@JoinColumns( {";
- String expected2 = "@JoinColumn(text = \"blah\", num = 42), null,";
- String expected3 = "@JoinColumn " + CR + " })";
- this.assertSourceDoesNotContain(expected1, cu);
- this.assertSourceDoesNotContain(expected2, cu);
- this.assertSourceDoesNotContain(expected3, cu);
- DeclarationAnnotationAdapter daa = new CombinationIndexedDeclarationAnnotationAdapter(
- "annot.JoinColumn", "annot.JoinColumns", "value", 2);
- AnnotationAdapter aa = new MemberAnnotationAdapter(this.idField(cu), daa);
- aa.newMarkerAnnotation();
- this.assertSourceContains(expected1, cu);
- this.assertSourceContains(expected2, cu);
- this.assertSourceContains(expected3, cu);
- }
-
- public void testNewMarkerAnnotation25() throws Exception {
- this.createAnnotationAndMembers("JoinColumn", "String name();");
- this.createAnnotationAndMembers("JoinColumns", "JoinColumn[] columns();");
- ICompilationUnit cu = this.createTestType("@annot.JoinColumns(columns={@annot.JoinColumn(name=\"ADDRESS_ID0\"), @annot.JoinColumn(name=\"ADDRESS_ID1\")})");
- String expected1 = "@annot.JoinColumns(columns={@annot.JoinColumn(name=\"ADDRESS_ID0\"), @annot.JoinColumn(name=\"ADDRESS_ID1\"), null, null,"; // the line gets split
- String expected2 = "@JoinColumn})";
- this.assertSourceDoesNotContain(expected1, cu);
- this.assertSourceDoesNotContain(expected2, cu);
- DeclarationAnnotationAdapter daa = new CombinationIndexedDeclarationAnnotationAdapter(
- "annot.JoinColumn", "annot.JoinColumns", "columns", 4);
- AnnotationAdapter aa = new MemberAnnotationAdapter(this.idField(cu), daa);
- aa.newMarkerAnnotation();
- this.assertSourceContains(expected1, cu);
- this.assertSourceContains(expected2, cu);
- }
-
- public void testNewMarkerAnnotation26() throws Exception {
- this.createAnnotationAndMembers("JoinColumn", "String name();");
- this.createAnnotationAndMembers("JoinColumns", "JoinColumn[] value();");
- ICompilationUnit cu = this.createTestType("@annot.JoinColumns({@annot.JoinColumn(name=\"ADDRESS_ID0\"), @annot.JoinColumn(name=\"ADDRESS_ID1\")})");
- String expected1 = "@annot.JoinColumns({@annot.JoinColumn(name=\"ADDRESS_ID0\"), @annot.JoinColumn(name=\"ADDRESS_ID1\"), null, null,"; // the line gets split
- String expected2 = "@JoinColumn})";
- this.assertSourceDoesNotContain(expected1, cu);
- this.assertSourceDoesNotContain(expected2, cu);
- DeclarationAnnotationAdapter daa = new CombinationIndexedDeclarationAnnotationAdapter(
- "annot.JoinColumn", "annot.JoinColumns", "value", 4);
- AnnotationAdapter aa = new MemberAnnotationAdapter(this.idField(cu), daa);
- aa.newMarkerAnnotation();
- this.assertSourceContains(expected1, cu);
- this.assertSourceContains(expected2, cu);
- }
-
- public void testMoveAnnotation1() throws Exception {
- this.createAnnotationAndMembers("JoinColumn", "String name();");
- this.createAnnotationAndMembers("JoinColumns", "JoinColumn[] columns();");
- ICompilationUnit cu = this.createTestType("@annot.JoinColumn(name=\"ADDRESS_ID0\")");
- String expected = "@JoinColumns(columns = { null, @JoinColumn(name = \"ADDRESS_ID0\") })";
- this.assertSourceDoesNotContain(expected, cu);
- IndexedDeclarationAnnotationAdapter cidaa = new CombinationIndexedDeclarationAnnotationAdapter(
- "annot.JoinColumn", "annot.JoinColumns", "columns", 0);
- IndexedAnnotationAdapter iaa = new MemberIndexedAnnotationAdapter(this.idField(cu), cidaa);
- Annotation annotation = iaa.getAnnotation(this.buildASTRoot(cu));
- assertNotNull(annotation);
-
- iaa.moveAnnotation(1);
- this.assertSourceContains(expected, cu);
- }
-
- public void testMoveAnnotation2() throws Exception {
- this.createAnnotationAndMembers("JoinColumn", "String name();");
- this.createAnnotationAndMembers("JoinColumns", "JoinColumn[] columns();");
- ICompilationUnit cu = this.createTestType("@annot.JoinColumns(columns={null,@annot.JoinColumn(name=\"ADDRESS_ID1\")})");
- String expected = "@JoinColumn(name=\"ADDRESS_ID1\")";
- IndexedDeclarationAnnotationAdapter cidaa = new CombinationIndexedDeclarationAnnotationAdapter(
- "annot.JoinColumn", "annot.JoinColumns", "columns", 1);
- IndexedAnnotationAdapter iaa = new MemberIndexedAnnotationAdapter(this.idField(cu), cidaa);
- Annotation annotation = iaa.getAnnotation(this.buildASTRoot(cu));
- assertNotNull(annotation);
-
- iaa.moveAnnotation(0);
- this.assertSourceContains(expected, cu);
- this.assertSourceDoesNotContain("JoinColumns", cu);
- }
-
- public void testMoveAnnotation2a() throws Exception {
- this.createAnnotationAndMembers("JoinColumn", "String name();");
- this.createAnnotationAndMembers("JoinColumns", "JoinColumn[] value();");
- ICompilationUnit cu = this.createTestType("@annot.JoinColumns({null,@annot.JoinColumn(name=\"ADDRESS_ID1\")})");
- String expected = "@JoinColumn(name=\"ADDRESS_ID1\")";
- IndexedDeclarationAnnotationAdapter cidaa = new CombinationIndexedDeclarationAnnotationAdapter(
- "annot.JoinColumn", "annot.JoinColumns", "value", 1);
- IndexedAnnotationAdapter iaa = new MemberIndexedAnnotationAdapter(this.idField(cu), cidaa);
- Annotation annotation = iaa.getAnnotation(this.buildASTRoot(cu));
- assertNotNull(annotation);
-
- iaa.moveAnnotation(0);
- this.assertSourceContains(expected, cu);
- this.assertSourceDoesNotContain("JoinColumns", cu);
- }
-
- public void testMoveAnnotation3() throws Exception {
- this.createAnnotationAndMembers("JoinColumn", "String name();");
- this.createAnnotationAndMembers("JoinColumns", "JoinColumn[] columns();");
- ICompilationUnit cu = this.createTestType("@annot.JoinColumns(columns={@annot.JoinColumn(name=\"ADDRESS_ID0\"), @annot.JoinColumn(name=\"ADDRESS_ID1\"), @annot.JoinColumn(name=\"ADDRESS_ID2\"), @annot.JoinColumn(name=\"ADDRESS_ID3\")})");
- String expected = "@annot.JoinColumns(columns={@annot.JoinColumn(name=\"ADDRESS_ID3\"), @annot.JoinColumn(name=\"ADDRESS_ID1\"), @annot.JoinColumn(name=\"ADDRESS_ID2\")})";
- this.assertSourceDoesNotContain(expected, cu);
- IndexedDeclarationAnnotationAdapter cidaa = new CombinationIndexedDeclarationAnnotationAdapter(
- "annot.JoinColumn", "annot.JoinColumns", "columns", 3);
- IndexedAnnotationAdapter iaa = new MemberIndexedAnnotationAdapter(this.idField(cu), cidaa);
- Annotation annotation = iaa.getAnnotation(this.buildASTRoot(cu));
- assertNotNull(annotation);
-
- iaa.moveAnnotation(0);
- this.assertSourceContains(expected, cu);
- }
-
- public void testMoveAnnotation4() throws Exception {
- this.createAnnotationAndMembers("JoinColumn", "String name();");
- this.createAnnotationAndMembers("JoinColumns", "JoinColumn[] columns();");
- ICompilationUnit cu = this.createTestType("@annot.JoinColumns(columns={@annot.JoinColumn(name=\"ADDRESS_ID0\"), @annot.JoinColumn(name=\"ADDRESS_ID1\"), @annot.JoinColumn(name=\"ADDRESS_ID2\"), @annot.JoinColumn(name=\"ADDRESS_ID3\"), @annot.JoinColumn(name=\"ADDRESS_ID4\")})");
- String expected = "@annot.JoinColumns(columns={@annot.JoinColumn(name=\"ADDRESS_ID3\"), @annot.JoinColumn(name=\"ADDRESS_ID1\"), @annot.JoinColumn(name=\"ADDRESS_ID2\"), null, @annot.JoinColumn(name=\"ADDRESS_ID4\")})";
- this.assertSourceDoesNotContain(expected, cu);
- IndexedDeclarationAnnotationAdapter cidaa = new CombinationIndexedDeclarationAnnotationAdapter(
- "annot.JoinColumn", "annot.JoinColumns", "columns", 3);
- IndexedAnnotationAdapter iaa = new MemberIndexedAnnotationAdapter(this.idField(cu), cidaa);
- Annotation annotation = iaa.getAnnotation(this.buildASTRoot(cu));
- assertNotNull(annotation);
-
- iaa.moveAnnotation(0);
- this.assertSourceContains(expected, cu);
- }
-
- public void testMoveAnnotation5() throws Exception {
- this.createAnnotationAndMembers("JoinColumn", "String name();");
- this.createAnnotationAndMembers("JoinColumns", "JoinColumn[] columns();");
- ICompilationUnit cu = this.createTestType("@annot.JoinColumns(columns={@annot.JoinColumn(name=\"ADDRESS_ID0\"), @annot.JoinColumn(name=\"ADDRESS_ID1\"), @annot.JoinColumn(name=\"ADDRESS_ID2\")})");
- String expected = "@annot.JoinColumns(columns={@annot.JoinColumn(name=\"ADDRESS_ID0\"), @annot.JoinColumn(name=\"ADDRESS_ID1\"), null, @annot.JoinColumn(name=\"ADDRESS_ID2\")})";
- this.assertSourceDoesNotContain(expected, cu);
- IndexedDeclarationAnnotationAdapter cidaa = new CombinationIndexedDeclarationAnnotationAdapter(
- "annot.JoinColumn", "annot.JoinColumns", "columns", 2);
- IndexedAnnotationAdapter iaa = new MemberIndexedAnnotationAdapter(this.idField(cu), cidaa);
- Annotation annotation = iaa.getAnnotation(this.buildASTRoot(cu));
- assertNotNull(annotation);
-
- iaa.moveAnnotation(3);
- this.assertSourceContains(expected, cu);
- }
-
- public void testMoveAnnotation6() throws Exception {
- this.createAnnotationAndMembers("JoinColumn", "String name();");
- this.createAnnotationAndMembers("JoinColumns", "JoinColumn[] columns();");
- ICompilationUnit cu = this.createTestType("@annot.JoinColumns(columns={@annot.JoinColumn(name=\"ADDRESS_ID0\"), @annot.JoinColumn(name=\"ADDRESS_ID1\"), @annot.JoinColumn(name=\"ADDRESS_ID2\")})");
- String expected = "@annot.JoinColumns(columns={null, @annot.JoinColumn(name=\"ADDRESS_ID1\"), @annot.JoinColumn(name=\"ADDRESS_ID2\"), @annot.JoinColumn(name=\"ADDRESS_ID0\")})";
- this.assertSourceDoesNotContain(expected, cu);
- IndexedDeclarationAnnotationAdapter cidaa = new CombinationIndexedDeclarationAnnotationAdapter(
- "annot.JoinColumn", "annot.JoinColumns", "columns", 0);
- IndexedAnnotationAdapter iaa = new MemberIndexedAnnotationAdapter(this.idField(cu), cidaa);
- Annotation annotation = iaa.getAnnotation(this.buildASTRoot(cu));
- assertNotNull(annotation);
-
- iaa.moveAnnotation(3);
- this.assertSourceContains(expected, cu);
- }
-
- public void testMoveAnnotation7() throws Exception {
- this.createAnnotationAndMembers("JoinColumn", "String name();");
- this.createAnnotationAndMembers("JoinColumns", "JoinColumn[] columns();");
- ICompilationUnit cu = this.createTestType("@annot.JoinColumns(columns={@annot.JoinColumn(name=\"ADDRESS_ID0\"), @annot.JoinColumn(name=\"ADDRESS_ID1\"), @annot.JoinColumn(name=\"ADDRESS_ID2\")})");
- String expected = "@annot.JoinColumns(columns={null, @annot.JoinColumn(name=\"ADDRESS_ID1\"), @annot.JoinColumn(name=\"ADDRESS_ID2\")})";
- this.assertSourceDoesNotContain(expected, cu);
- IndexedDeclarationAnnotationAdapter cidaa = new CombinationIndexedDeclarationAnnotationAdapter(
- "annot.JoinColumn", "annot.JoinColumns", "columns", 3);
- IndexedAnnotationAdapter iaa = new MemberIndexedAnnotationAdapter(this.idField(cu), cidaa);
- Annotation annotation = iaa.getAnnotation(this.buildASTRoot(cu));
- assertNull(annotation);
-
- iaa.moveAnnotation(0);
- this.assertSourceContains(expected, cu);
- }
-
- public void testMoveAnnotation8() throws Exception {
- this.createAnnotationAndMembers("JoinColumn", "String name();");
- this.createAnnotationAndMembers("JoinColumns", "JoinColumn[] columns();");
- ICompilationUnit cu = this.createTestType("@annot.JoinColumns(columns={@annot.JoinColumn(name=\"ADDRESS_ID0\"), @annot.JoinColumn(name=\"ADDRESS_ID1\"), @annot.JoinColumn(name=\"ADDRESS_ID2\"), null, @annot.JoinColumn(name=\"ADDRESS_ID4\")})");
- String expected = "@annot.JoinColumns(columns={null, @annot.JoinColumn(name=\"ADDRESS_ID1\"), @annot.JoinColumn(name=\"ADDRESS_ID2\"), null, @annot.JoinColumn(name=\"ADDRESS_ID4\")})";
- this.assertSourceDoesNotContain(expected, cu);
- IndexedDeclarationAnnotationAdapter cidaa = new CombinationIndexedDeclarationAnnotationAdapter(
- "annot.JoinColumn", "annot.JoinColumns", "columns", 3);
- IndexedAnnotationAdapter iaa = new MemberIndexedAnnotationAdapter(this.idField(cu), cidaa);
- Annotation annotation = iaa.getAnnotation(this.buildASTRoot(cu));
- assertNull(annotation);
-
- iaa.moveAnnotation(0);
- this.assertSourceContains(expected, cu);
- }
-
- public void testMoveAnnotation9() throws Exception {
- this.createAnnotationAndMembers("JoinColumn", "String name();");
- this.createAnnotationAndMembers("JoinColumns", "JoinColumn[] columns();");
- String expected = "@annot.JoinColumns(columns={null, @annot.JoinColumn(name=\"ADDRESS_ID1\"), @annot.JoinColumn(name=\"ADDRESS_ID2\")})";
- ICompilationUnit cu = this.createTestType(expected); // the source should be unchanged
- IndexedDeclarationAnnotationAdapter cidaa = new CombinationIndexedDeclarationAnnotationAdapter(
- "annot.JoinColumn", "annot.JoinColumns", "columns", 0);
- IndexedAnnotationAdapter iaa = new MemberIndexedAnnotationAdapter(this.idField(cu), cidaa);
- Annotation annotation = iaa.getAnnotation(this.buildASTRoot(cu));
- assertNull(annotation);
-
- iaa.moveAnnotation(3);
- this.assertSourceContains(expected, cu);
- }
-
- public void testMoveAnnotation10() throws Exception {
- this.createAnnotationAndMembers("JoinColumn", "String name();");
- this.createAnnotationAndMembers("JoinColumns", "JoinColumn[] columns();");
- ICompilationUnit cu = this.createTestType("@annot.JoinColumns(columns={@annot.JoinColumn(name=\"ADDRESS_ID0\"), @annot.JoinColumn(name=\"ADDRESS_ID1\")})");
- String expected = "@JoinColumn(name=\"ADDRESS_ID0\")";
- IndexedDeclarationAnnotationAdapter cidaa = new CombinationIndexedDeclarationAnnotationAdapter(
- "annot.JoinColumn", "annot.JoinColumns", "columns", 2);
- IndexedAnnotationAdapter iaa = new MemberIndexedAnnotationAdapter(this.idField(cu), cidaa);
- Annotation annotation = iaa.getAnnotation(this.buildASTRoot(cu));
- assertNull(annotation);
-
- iaa.moveAnnotation(1);
- this.assertSourceContains(expected, cu);
- this.assertSourceDoesNotContain("@annot.JoinColumns", cu);
- }
-
- public void testMoveAnnotation10a() throws Exception {
- this.createAnnotationAndMembers("JoinColumn", "String name();");
- this.createAnnotationAndMembers("JoinColumns", "JoinColumn[] value();");
- ICompilationUnit cu = this.createTestType("@annot.JoinColumns({@annot.JoinColumn(name=\"ADDRESS_ID0\"), @annot.JoinColumn(name=\"ADDRESS_ID1\")})");
- String expected = "@JoinColumn(name=\"ADDRESS_ID0\")";
- IndexedDeclarationAnnotationAdapter cidaa = new CombinationIndexedDeclarationAnnotationAdapter(
- "annot.JoinColumn", "annot.JoinColumns", "value", 2);
- IndexedAnnotationAdapter iaa = new MemberIndexedAnnotationAdapter(this.idField(cu), cidaa);
- Annotation annotation = iaa.getAnnotation(this.buildASTRoot(cu));
- assertNull(annotation);
-
- iaa.moveAnnotation(1);
- this.assertSourceContains(expected, cu);
- this.assertSourceDoesNotContain("@annot.JoinColumns", cu);
- }
-
- public void testMoveAnnotation11() throws Exception {
- this.createAnnotationAndMembers("JoinColumn", "String name();");
- this.createAnnotationAndMembers("JoinColumns", "JoinColumn[] columns();");
- ICompilationUnit cu = this.createTestType("@annot.JoinColumn(name=\"ADDRESS_ID0\")");
- IndexedDeclarationAnnotationAdapter cidaa = new CombinationIndexedDeclarationAnnotationAdapter(
- "annot.JoinColumn", "annot.JoinColumns", "columns", 1);
- IndexedAnnotationAdapter iaa = new MemberIndexedAnnotationAdapter(this.idField(cu), cidaa);
- Annotation annotation = iaa.getAnnotation(this.buildASTRoot(cu));
- assertNull(annotation);
-
- iaa.moveAnnotation(0);
- this.assertSourceDoesNotContain("JoinColumn", cu);
- }
-
- public void testMoveAnnotation12() throws Exception {
- this.createAnnotationAndMembers("JoinColumn", "String name();");
- this.createAnnotationAndMembers("JoinColumns", "JoinColumn[] columns();");
- ICompilationUnit cu = this.createTestType("@annot.JoinColumns(columns={@annot.JoinColumn(name=\"ADDRESS_ID0\"), null, @annot.JoinColumn(name=\"ADDRESS_ID2\")})");
- String expected = "@JoinColumn(name=\"ADDRESS_ID2\")";
- IndexedDeclarationAnnotationAdapter cidaa = new CombinationIndexedDeclarationAnnotationAdapter(
- "annot.JoinColumn", "annot.JoinColumns", "columns", 2);
- IndexedAnnotationAdapter iaa = new MemberIndexedAnnotationAdapter(this.idField(cu), cidaa);
- Annotation annotation = iaa.getAnnotation(this.buildASTRoot(cu));
- assertNotNull(annotation);
-
- iaa.moveAnnotation(0);
- this.assertSourceContains(expected, cu);
- this.assertSourceDoesNotContain("@annot.JoinColumns", cu);
- }
-
- public void testMoveAnnotation13() throws Exception {
- this.createAnnotationAndMembers("JoinColumn", "String name();");
- this.createAnnotationAndMembers("JoinColumns", "JoinColumn[] columns();");
- ICompilationUnit cu = this.createTestType("@annot.JoinColumns(columns={@annot.JoinColumn(name=\"ADDRESS_ID0\"), @annot.JoinColumn(name=\"ADDRESS_ID1\"), null, @annot.JoinColumn(name=\"ADDRESS_ID3\")})");
- String expected = "@annot.JoinColumns(columns={@annot.JoinColumn(name=\"ADDRESS_ID3\"), @annot.JoinColumn(name=\"ADDRESS_ID1\")})";
- IndexedDeclarationAnnotationAdapter cidaa = new CombinationIndexedDeclarationAnnotationAdapter(
- "annot.JoinColumn", "annot.JoinColumns", "columns", 3);
- IndexedAnnotationAdapter iaa = new MemberIndexedAnnotationAdapter(this.idField(cu), cidaa);
- Annotation annotation = iaa.getAnnotation(this.buildASTRoot(cu));
- assertNotNull(annotation);
-
- iaa.moveAnnotation(0);
- this.assertSourceContains(expected, cu);
- }
-
-}
diff --git a/jpa/tests/org.eclipse.jpt.core.tests/src/org/eclipse/jpt/core/tests/internal/utility/jdt/DefaultAnnotationEditFormatterTests.java b/jpa/tests/org.eclipse.jpt.core.tests/src/org/eclipse/jpt/core/tests/internal/utility/jdt/DefaultAnnotationEditFormatterTests.java
deleted file mode 100644
index e3e909794a..0000000000
--- a/jpa/tests/org.eclipse.jpt.core.tests/src/org/eclipse/jpt/core/tests/internal/utility/jdt/DefaultAnnotationEditFormatterTests.java
+++ /dev/null
@@ -1,74 +0,0 @@
-/*******************************************************************************
- * Copyright (c) 2007, 2008 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.
- *
- * Contributors:
- * Oracle - initial API and implementation
- ******************************************************************************/
-package org.eclipse.jpt.core.tests.internal.utility.jdt;
-
-import org.eclipse.jpt.core.internal.utility.jdt.DefaultAnnotationEditFormatter;
-import org.eclipse.jpt.utility.internal.ClassTools;
-
-public class DefaultAnnotationEditFormatterTests extends AnnotationTestCase {
-
-
- // ********** TestCase behavior **********
-
- public DefaultAnnotationEditFormatterTests(String name) {
- super(name);
- }
-
-
- // ********** tests **********
-
- public void testCommaLength() throws Exception {
- assertEquals(1, this.commaLength(","));
- assertEquals(1, this.commaLength(", "));
- assertEquals(1, this.commaLength(", "));
-
- assertEquals(2, this.commaLength(" ,"));
- assertEquals(2, this.commaLength(" , "));
- assertEquals(2, this.commaLength(" , "));
-
- assertEquals(3, this.commaLength(" ,"));
- assertEquals(3, this.commaLength(" , "));
- assertEquals(3, this.commaLength(" , "));
-
- assertEquals(0, this.commaLength(" ,,,"));
- assertEquals(0, this.commaLength(" ,,, "));
- assertEquals(0, this.commaLength(" , ,"));
-
- assertEquals(0, this.commaLength(" ,x"));
- assertEquals(0, this.commaLength(" ,x "));
- assertEquals(0, this.commaLength(" , x"));
-
- assertEquals(0, this.commaLength("x ,"));
- assertEquals(0, this.commaLength("x , "));
- assertEquals(0, this.commaLength("x , "));
- }
-
- private int commaLength(String s) {
- Integer len = (Integer) ClassTools.executeMethod(DefaultAnnotationEditFormatter.instance(), "commaLength", String.class, s);
- return len.intValue();
- }
-
- public void testStringIsAnnotation() throws Exception {
- assertTrue(this.stringIsAnnotation("@F"));
- assertTrue(this.stringIsAnnotation("@Foo"));
- assertTrue(this.stringIsAnnotation("@org.bar.Foo"));
-
- assertFalse(this.stringIsAnnotation(""));
- assertFalse(this.stringIsAnnotation("@"));
- assertFalse(this.stringIsAnnotation("Foo"));
- assertFalse(this.stringIsAnnotation("Foo@"));
- }
-
- private boolean stringIsAnnotation(String s) {
- Boolean b = (Boolean) ClassTools.executeMethod(DefaultAnnotationEditFormatter.instance(), "stringIsAnnotation", String.class, s);
- return b.booleanValue();
- }
-
-}
diff --git a/jpa/tests/org.eclipse.jpt.core.tests/src/org/eclipse/jpt/core/tests/internal/utility/jdt/JDTToolsTests.java b/jpa/tests/org.eclipse.jpt.core.tests/src/org/eclipse/jpt/core/tests/internal/utility/jdt/JDTToolsTests.java
deleted file mode 100644
index f644cabc17..0000000000
--- a/jpa/tests/org.eclipse.jpt.core.tests/src/org/eclipse/jpt/core/tests/internal/utility/jdt/JDTToolsTests.java
+++ /dev/null
@@ -1,87 +0,0 @@
-/*******************************************************************************
- * Copyright (c) 2006, 2008 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.
- *
- * Contributors:
- * Oracle - initial API and implementation
- ******************************************************************************/
-package org.eclipse.jpt.core.tests.internal.utility.jdt;
-
-import org.eclipse.jdt.core.ICompilationUnit;
-import org.eclipse.jdt.core.dom.Name;
-import org.eclipse.jpt.core.internal.utility.jdt.ConversionDeclarationAnnotationElementAdapter;
-import org.eclipse.jpt.core.internal.utility.jdt.JDTFieldAttribute;
-import org.eclipse.jpt.core.internal.utility.jdt.JDTTools;
-import org.eclipse.jpt.core.internal.utility.jdt.SimpleDeclarationAnnotationAdapter;
-import org.eclipse.jpt.core.utility.jdt.DeclarationAnnotationAdapter;
-import org.eclipse.jpt.core.utility.jdt.DeclarationAnnotationElementAdapter;
-
-public class JDTToolsTests extends AnnotationTestCase {
-
- public JDTToolsTests(String name) {
- super(name);
- }
-
- private void createEnumAndMembers(String enumName, String enumBody) throws Exception {
- this.javaProject.createCompilationUnit("enums", enumName + ".java", "public enum " + enumName + " { " + enumBody + " }");
- }
-
- private void createAnnotationAndMembers(String annotationName, String annotationBody) throws Exception {
- this.javaProject.createCompilationUnit("annot", annotationName + ".java", "public @interface " + annotationName + " { " + annotationBody + " }");
- }
-
- public void testResolveEnum1() throws Exception {
- this.createEnumAndMembers("TestEnum", "FOO, BAR, BAZ");
- this.createAnnotationAndMembers("TestAnnotation", "TestEnum foo();");
-
- ICompilationUnit cu = this.createTestType("@annot.TestAnnotation(foo=enums.TestEnum.BAZ)");
- DeclarationAnnotationAdapter daa = new SimpleDeclarationAnnotationAdapter("annot.TestAnnotation");
- DeclarationAnnotationElementAdapter<String> daea = ConversionDeclarationAnnotationElementAdapter.forStrings(daa, "foo");
- JDTFieldAttribute field = this.idField(cu);
-
- String actual = JDTTools.resolveEnum((Name) daea.getExpression(field.getModifiedDeclaration(this.buildASTRoot(cu))));
- assertEquals("enums.TestEnum.BAZ", actual);
- }
-
- public void testResolveEnum2() throws Exception {
- this.createEnumAndMembers("TestEnum", "FOO, BAR, BAZ");
- this.createAnnotationAndMembers("TestAnnotation", "TestEnum foo();");
-
- ICompilationUnit cu = this.createTestType("static enums.TestEnum.BAZ", "@annot.TestAnnotation(foo=BAZ)");
- DeclarationAnnotationAdapter daa = new SimpleDeclarationAnnotationAdapter("annot.TestAnnotation");
- DeclarationAnnotationElementAdapter<String> daea = ConversionDeclarationAnnotationElementAdapter.forStrings(daa, "foo");
- JDTFieldAttribute field = this.idField(cu);
-
- String actual = JDTTools.resolveEnum((Name) daea.getExpression(field.getModifiedDeclaration(this.buildASTRoot(cu))));
- assertEquals("enums.TestEnum.BAZ", actual);
- }
-
- public void testResolveEnum3() throws Exception {
- this.createEnumAndMembers("TestEnum", "FOO, BAR, BAZ");
- this.createAnnotationAndMembers("TestAnnotation", "TestEnum foo();");
-
- ICompilationUnit cu = this.createTestType("static enums.TestEnum.*", "@annot.TestAnnotation(foo=BAZ)");
- DeclarationAnnotationAdapter daa = new SimpleDeclarationAnnotationAdapter("annot.TestAnnotation");
- DeclarationAnnotationElementAdapter<String> daea = ConversionDeclarationAnnotationElementAdapter.forStrings(daa, "foo");
- JDTFieldAttribute field = this.idField(cu);
-
- String actual = JDTTools.resolveEnum((Name)daea.getExpression(field.getModifiedDeclaration(this.buildASTRoot(cu))));
- assertEquals("enums.TestEnum.BAZ", actual);
- }
-
- public void testResolveEnum4() throws Exception {
- this.createEnumAndMembers("TestEnum", "FOO, BAR, BAZ");
- this.createAnnotationAndMembers("TestAnnotation", "TestEnum foo();");
-
- ICompilationUnit cu = this.createTestType("enums.TestEnum", "@annot.TestAnnotation(foo=TestEnum.BAZ)");
- DeclarationAnnotationAdapter daa = new SimpleDeclarationAnnotationAdapter("annot.TestAnnotation");
- DeclarationAnnotationElementAdapter<String> daea = ConversionDeclarationAnnotationElementAdapter.forStrings(daa, "foo");
- JDTFieldAttribute field = this.idField(cu);
-
- String actual = JDTTools.resolveEnum((Name) daea.getExpression(field.getModifiedDeclaration(this.buildASTRoot(cu))));
- assertEquals("enums.TestEnum.BAZ", actual);
- }
-
-}
diff --git a/jpa/tests/org.eclipse.jpt.core.tests/src/org/eclipse/jpt/core/tests/internal/utility/jdt/JptCoreUtilityJdtTests.java b/jpa/tests/org.eclipse.jpt.core.tests/src/org/eclipse/jpt/core/tests/internal/utility/jdt/JptCoreUtilityJdtTests.java
deleted file mode 100644
index 5810dc11de..0000000000
--- a/jpa/tests/org.eclipse.jpt.core.tests/src/org/eclipse/jpt/core/tests/internal/utility/jdt/JptCoreUtilityJdtTests.java
+++ /dev/null
@@ -1,35 +0,0 @@
-/*******************************************************************************
- * Copyright (c) 2006, 2008 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.
- *
- * Contributors:
- * Oracle - initial API and implementation
- ******************************************************************************/
-package org.eclipse.jpt.core.tests.internal.utility.jdt;
-
-import junit.framework.Test;
-import junit.framework.TestSuite;
-
-public class JptCoreUtilityJdtTests {
-
- public static Test suite() {
- TestSuite suite = new TestSuite(JptCoreUtilityJdtTests.class.getPackage().getName());
- suite.addTestSuite(CombinationIndexedDeclarationAnnotationAdapterTests.class);
- suite.addTestSuite(DefaultAnnotationEditFormatterTests.class);
- suite.addTestSuite(JDTToolsTests.class);
- suite.addTestSuite(MemberAnnotationElementAdapterTests.class);
- suite.addTestSuite(NestedDeclarationAnnotationAdapterTests.class);
- suite.addTestSuite(NestedIndexedDeclarationAnnotationAdapterTests.class);
- suite.addTestSuite(SimpleDeclarationAnnotationAdapterTests.class);
- suite.addTestSuite(TypeTests.class);
- return suite;
- }
-
- private JptCoreUtilityJdtTests() {
- super();
- throw new UnsupportedOperationException();
- }
-
-}
diff --git a/jpa/tests/org.eclipse.jpt.core.tests/src/org/eclipse/jpt/core/tests/internal/utility/jdt/MemberAnnotationElementAdapterTests.java b/jpa/tests/org.eclipse.jpt.core.tests/src/org/eclipse/jpt/core/tests/internal/utility/jdt/MemberAnnotationElementAdapterTests.java
deleted file mode 100644
index 0f0f35ef29..0000000000
--- a/jpa/tests/org.eclipse.jpt.core.tests/src/org/eclipse/jpt/core/tests/internal/utility/jdt/MemberAnnotationElementAdapterTests.java
+++ /dev/null
@@ -1,1297 +0,0 @@
-/*******************************************************************************
- * Copyright (c) 2006, 2009 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.
- *
- * Contributors:
- * Oracle - initial API and implementation
- ******************************************************************************/
-package org.eclipse.jpt.core.tests.internal.utility.jdt;
-
-import java.util.Arrays;
-import org.eclipse.jdt.core.ICompilationUnit;
-import org.eclipse.jpt.core.internal.utility.jdt.ASTNodeTextRange;
-import org.eclipse.jpt.core.internal.utility.jdt.AnnotationStringArrayExpressionConverter;
-import org.eclipse.jpt.core.internal.utility.jdt.BooleanExpressionConverter;
-import org.eclipse.jpt.core.internal.utility.jdt.CharacterStringExpressionConverter;
-import org.eclipse.jpt.core.internal.utility.jdt.ConversionDeclarationAnnotationElementAdapter;
-import org.eclipse.jpt.core.internal.utility.jdt.EnumArrayDeclarationAnnotationElementAdapter;
-import org.eclipse.jpt.core.internal.utility.jdt.EnumDeclarationAnnotationElementAdapter;
-import org.eclipse.jpt.core.internal.utility.jdt.MemberAnnotationElementAdapter;
-import org.eclipse.jpt.core.internal.utility.jdt.NestedDeclarationAnnotationAdapter;
-import org.eclipse.jpt.core.internal.utility.jdt.NestedIndexedDeclarationAnnotationAdapter;
-import org.eclipse.jpt.core.internal.utility.jdt.NumberIntegerExpressionConverter;
-import org.eclipse.jpt.core.internal.utility.jdt.PrimitiveTypeStringExpressionConverter;
-import org.eclipse.jpt.core.internal.utility.jdt.SimpleDeclarationAnnotationAdapter;
-import org.eclipse.jpt.core.internal.utility.jdt.SimpleTypeStringExpressionConverter;
-import org.eclipse.jpt.core.internal.utility.jdt.StringExpressionConverter;
-import org.eclipse.jpt.core.internal.utility.jdt.TypeStringExpressionConverter;
-import org.eclipse.jpt.core.utility.TextRange;
-import org.eclipse.jpt.core.utility.jdt.AnnotationElementAdapter;
-import org.eclipse.jpt.core.utility.jdt.DeclarationAnnotationAdapter;
-import org.eclipse.jpt.core.utility.jdt.DeclarationAnnotationElementAdapter;
-import org.eclipse.jpt.core.utility.jdt.ExpressionConverter;
-
-@SuppressWarnings("nls")
-public class MemberAnnotationElementAdapterTests extends AnnotationTestCase {
-
- public MemberAnnotationElementAdapterTests(String name) {
- super(name);
- }
-
- private void createAnnotationAndMembers(String annotationName, String annotationBody) throws Exception {
- this.javaProject.createCompilationUnit("annot", annotationName + ".java", "public @interface " + annotationName + " { " + annotationBody + " }");
- }
-
- private void createEnum(String enumName, String enumBody) throws Exception {
- this.createEnum("enums", enumName, enumBody);
- }
-
- private void createEnum(String packageName, String enumName, String enumBody) throws Exception {
- this.javaProject.createCompilationUnit(packageName, enumName + ".java", "public enum " + enumName + " { " + enumBody + " }");
- }
-
- public void testValue1() throws Exception {
- this.createAnnotationAndMembers("Foo", "String bar();");
- ICompilationUnit cu = this.createTestType("@annot.Foo(bar=\"xxx\")");
- DeclarationAnnotationAdapter daa = new SimpleDeclarationAnnotationAdapter("annot.Foo");
- DeclarationAnnotationElementAdapter<String> daea = ConversionDeclarationAnnotationElementAdapter.forStrings(daa, "bar");
- AnnotationElementAdapter<String> aea = new MemberAnnotationElementAdapter<String>(this.idField(cu), daea);
- assertEquals("xxx", aea.getValue());
- }
-
- public void testValue2() throws Exception {
- this.createAnnotationAndMembers("Foo", "int bar();");
- ICompilationUnit cu = this.createTestType("@annot.Foo(bar=48)");
- DeclarationAnnotationAdapter daa = new SimpleDeclarationAnnotationAdapter("annot.Foo");
- DeclarationAnnotationElementAdapter<Integer> daea = new ConversionDeclarationAnnotationElementAdapter<Integer>(daa, "bar", NumberIntegerExpressionConverter.instance());
- AnnotationElementAdapter<Integer> aea = new MemberAnnotationElementAdapter<Integer>(this.idField(cu), daea);
- assertEquals(Integer.valueOf(48), aea.getValue());
- }
-
- public void testValue3() throws Exception {
- this.createAnnotationAndMembers("Foo", "char bar();");
- ICompilationUnit cu = this.createTestType("@annot.Foo(bar='c')");
- DeclarationAnnotationAdapter daa = new SimpleDeclarationAnnotationAdapter("annot.Foo");
- DeclarationAnnotationElementAdapter<String> daea = new ConversionDeclarationAnnotationElementAdapter<String>(daa, "bar", CharacterStringExpressionConverter.instance());
- AnnotationElementAdapter<String> aea = new MemberAnnotationElementAdapter<String>(this.idField(cu), daea);
- assertEquals("c", aea.getValue());
- }
-
- public void testValue4() throws Exception {
- this.createAnnotationAndMembers("Foo", "boolean bar();");
- ICompilationUnit cu = this.createTestType("@annot.Foo(bar=false)");
- DeclarationAnnotationAdapter daa = new SimpleDeclarationAnnotationAdapter("annot.Foo");
- DeclarationAnnotationElementAdapter<Boolean> daea = new ConversionDeclarationAnnotationElementAdapter<Boolean>(daa, "bar", BooleanExpressionConverter.instance());
- AnnotationElementAdapter<Boolean> aea = new MemberAnnotationElementAdapter<Boolean>(this.idField(cu), daea);
- assertEquals(Boolean.FALSE, aea.getValue());
- }
-
- public void testValue5() throws Exception {
- this.createAnnotationAndMembers("Baz", "boolean fred();");
- this.createAnnotationAndMembers("Bar", "annot.Baz jimmy();");
- this.createAnnotationAndMembers("Foo", "annot.Bar value();");
- ICompilationUnit cu = this.createTestType("@annot.Foo(@annot.Bar(jimmy=@annot.Baz(fred=false)))");
- DeclarationAnnotationAdapter daa1 = new SimpleDeclarationAnnotationAdapter("annot.Foo");
- DeclarationAnnotationAdapter daa2 = new NestedDeclarationAnnotationAdapter(daa1, "value", "annot.Bar");
- DeclarationAnnotationAdapter daa3 = new NestedDeclarationAnnotationAdapter(daa2, "jimmy", "annot.Baz");
- DeclarationAnnotationElementAdapter<Boolean> daea = new ConversionDeclarationAnnotationElementAdapter<Boolean>(daa3, "fred", BooleanExpressionConverter.instance());
- AnnotationElementAdapter<Boolean> aea = new MemberAnnotationElementAdapter<Boolean>(this.idField(cu), daea);
- assertEquals(Boolean.FALSE, aea.getValue());
- }
-
- public void testValue6() throws Exception {
- this.createAnnotationAndMembers("Foo", "boolean value();");
- ICompilationUnit cu = this.createTestType("@annot.Foo(false)");
- DeclarationAnnotationAdapter daa = new SimpleDeclarationAnnotationAdapter("annot.Foo");
- DeclarationAnnotationElementAdapter<Boolean> daea = new ConversionDeclarationAnnotationElementAdapter<Boolean>(daa, BooleanExpressionConverter.instance());
- AnnotationElementAdapter<Boolean> aea = new MemberAnnotationElementAdapter<Boolean>(this.idField(cu), daea);
- assertEquals(Boolean.FALSE, aea.getValue());
- }
-
- public void testValueNull1() throws Exception {
- this.createAnnotationAndMembers("Foo", "String bar();");
- ICompilationUnit cu = this.createTestType("@annot.Foo");
- DeclarationAnnotationAdapter daa = new SimpleDeclarationAnnotationAdapter("annot.Foo");
- DeclarationAnnotationElementAdapter<String> daea = ConversionDeclarationAnnotationElementAdapter.forStrings(daa, "bar");
- AnnotationElementAdapter<String> aea = new MemberAnnotationElementAdapter<String>(this.idField(cu), daea);
- assertNull(aea.getValue());
- }
-
- public void testValueNull2() throws Exception {
- this.createAnnotationAndMembers("Foo", "String bar();");
- ICompilationUnit cu = this.createTestType();
- DeclarationAnnotationAdapter daa = new SimpleDeclarationAnnotationAdapter("Foo");
- DeclarationAnnotationElementAdapter<String> daea = ConversionDeclarationAnnotationElementAdapter.forStrings(daa, "bar");
- AnnotationElementAdapter<String> aea = new MemberAnnotationElementAdapter<String>(this.idField(cu), daea);
- assertNull(aea.getValue());
- }
-
- public void testValueNull3() throws Exception {
- this.createAnnotationAndMembers("Baz", "String fred();");
- this.createAnnotationAndMembers("Bar", "annot.Baz jimmy();");
- this.createAnnotationAndMembers("Foo", "annot.Bar value();");
- ICompilationUnit cu = this.createTestType("@annot.Foo(@annot.Bar(jimmy=@annot.Baz))");
- DeclarationAnnotationAdapter daa1 = new SimpleDeclarationAnnotationAdapter("annot.Foo");
- DeclarationAnnotationAdapter daa2 = new NestedDeclarationAnnotationAdapter(daa1, "value", "annot.Bar");
- DeclarationAnnotationAdapter daa3 = new NestedDeclarationAnnotationAdapter(daa2, "jimmy", "annot.Baz");
- DeclarationAnnotationElementAdapter<String> daea = ConversionDeclarationAnnotationElementAdapter.forStrings(daa3, "fred");
- AnnotationElementAdapter<String> aea = new MemberAnnotationElementAdapter<String>(this.idField(cu), daea);
- assertNull(aea.getValue());
- }
-
- public void testValueStringConcatenation() throws Exception {
- this.createAnnotationAndMembers("Foo", "String bar();");
- ICompilationUnit cu = this.createTestType("@annot.Foo(bar=\"xxx\" + \"yyy\" + \"zzz\")");
- DeclarationAnnotationAdapter daa = new SimpleDeclarationAnnotationAdapter("annot.Foo");
- DeclarationAnnotationElementAdapter<String> daea = ConversionDeclarationAnnotationElementAdapter.forStrings(daa, "bar");
- AnnotationElementAdapter<String> aea = new MemberAnnotationElementAdapter<String>(this.idField(cu), daea);
- assertEquals("xxxyyyzzz", aea.getValue());
- }
-
- public void testValueStringConstant() throws Exception {
- this.createAnnotationAndMembers("Foo", "String bar();");
- // just a bit hacky:
- ICompilationUnit cu = this.createTestType("private static final String FOO_BAR = \"xxx\"; @annot.Foo(bar=FOO_BAR + \"yyy\" + \"zzz\")");
- DeclarationAnnotationAdapter daa = new SimpleDeclarationAnnotationAdapter("annot.Foo");
- DeclarationAnnotationElementAdapter<String> daea = ConversionDeclarationAnnotationElementAdapter.forStrings(daa, "bar");
- AnnotationElementAdapter<String> aea = new MemberAnnotationElementAdapter<String>(this.idField(cu), daea);
- assertEquals("xxxyyyzzz", aea.getValue());
- }
-
- public void testValueNumberArithmetic() throws Exception {
- this.createAnnotationAndMembers("Foo", "int bar();");
- ICompilationUnit cu = this.createTestType("@annot.Foo(bar=47 - 7 + 2 * 1 / 1)");
- DeclarationAnnotationAdapter daa = new SimpleDeclarationAnnotationAdapter("annot.Foo");
- DeclarationAnnotationElementAdapter<Integer> daea = ConversionDeclarationAnnotationElementAdapter.forNumbers(daa, "bar");
- AnnotationElementAdapter<Integer> aea = new MemberAnnotationElementAdapter<Integer>(this.idField(cu), daea);
- assertEquals(Integer.valueOf(42), aea.getValue());
- }
-
- public void testValueNumberShift() throws Exception {
- this.createAnnotationAndMembers("Foo", "int bar();");
- ICompilationUnit cu = this.createTestType("@annot.Foo(bar=2 << 2)");
- DeclarationAnnotationAdapter daa = new SimpleDeclarationAnnotationAdapter("annot.Foo");
- DeclarationAnnotationElementAdapter<Integer> daea = ConversionDeclarationAnnotationElementAdapter.forNumbers(daa, "bar");
- AnnotationElementAdapter<Integer> aea = new MemberAnnotationElementAdapter<Integer>(this.idField(cu), daea);
- assertEquals(Integer.valueOf(8), aea.getValue());
- }
-
- public void testValueNumberConstant() throws Exception {
- this.createAnnotationAndMembers("Foo", "int bar();");
- // just a bit hacky:
- ICompilationUnit cu = this.createTestType("private static final int FOO_BAR = 77; @annot.Foo(bar=FOO_BAR)");
- DeclarationAnnotationAdapter daa = new SimpleDeclarationAnnotationAdapter("annot.Foo");
- DeclarationAnnotationElementAdapter<Integer> daea = ConversionDeclarationAnnotationElementAdapter.forNumbers(daa, "bar");
- AnnotationElementAdapter<Integer> aea = new MemberAnnotationElementAdapter<Integer>(this.idField(cu), daea);
- assertEquals(Integer.valueOf(77), aea.getValue());
- }
-
- public void testValueCharacterConstant() throws Exception {
- this.createAnnotationAndMembers("Foo", "char bar();");
- // just a bit hacky:
- ICompilationUnit cu = this.createTestType("private static final char FOO_BAR = 'Q'; @annot.Foo(bar=FOO_BAR)");
- DeclarationAnnotationAdapter daa = new SimpleDeclarationAnnotationAdapter("annot.Foo");
- DeclarationAnnotationElementAdapter<String> daea = ConversionDeclarationAnnotationElementAdapter.forCharacters(daa, "bar");
- AnnotationElementAdapter<String> aea = new MemberAnnotationElementAdapter<String>(this.idField(cu), daea);
- assertEquals("Q", aea.getValue());
- }
-
- public void testValueCharacterCast() throws Exception {
- this.createAnnotationAndMembers("Foo", "char bar();");
- ICompilationUnit cu = this.createTestType("@annot.Foo(bar=(char) 0x41)");
- DeclarationAnnotationAdapter daa = new SimpleDeclarationAnnotationAdapter("annot.Foo");
- DeclarationAnnotationElementAdapter<String> daea = ConversionDeclarationAnnotationElementAdapter.forCharacters(daa, "bar");
- AnnotationElementAdapter<String> aea = new MemberAnnotationElementAdapter<String>(this.idField(cu), daea);
- assertEquals("A", aea.getValue());
- }
-
- public void testValueBooleanOperator1() throws Exception {
- this.createAnnotationAndMembers("Foo", "boolean bar();");
- ICompilationUnit cu = this.createTestType("@annot.Foo(bar=7 > 2)");
- DeclarationAnnotationAdapter daa = new SimpleDeclarationAnnotationAdapter("annot.Foo");
- DeclarationAnnotationElementAdapter<Boolean> daea = ConversionDeclarationAnnotationElementAdapter.forBooleans(daa, "bar");
- AnnotationElementAdapter<Boolean> aea = new MemberAnnotationElementAdapter<Boolean>(this.idField(cu), daea);
- assertEquals(Boolean.TRUE, aea.getValue());
- }
-
- public void testValueBooleanOperator2() throws Exception {
- this.createAnnotationAndMembers("Foo", "boolean bar();");
- ICompilationUnit cu = this.createTestType("@annot.Foo(bar=7 == 2)");
- DeclarationAnnotationAdapter daa = new SimpleDeclarationAnnotationAdapter("annot.Foo");
- DeclarationAnnotationElementAdapter<Boolean> daea = ConversionDeclarationAnnotationElementAdapter.forBooleans(daa, "bar");
- AnnotationElementAdapter<Boolean> aea = new MemberAnnotationElementAdapter<Boolean>(this.idField(cu), daea);
- assertEquals(Boolean.FALSE, aea.getValue());
- }
-
- public void testValueBooleanOperator3() throws Exception {
- this.createAnnotationAndMembers("Foo", "boolean bar();");
- ICompilationUnit cu = this.createTestType("@annot.Foo(bar=(7 != 2) && false)");
- DeclarationAnnotationAdapter daa = new SimpleDeclarationAnnotationAdapter("annot.Foo");
- DeclarationAnnotationElementAdapter<Boolean> daea = ConversionDeclarationAnnotationElementAdapter.forBooleans(daa, "bar");
- AnnotationElementAdapter<Boolean> aea = new MemberAnnotationElementAdapter<Boolean>(this.idField(cu), daea);
- assertEquals(Boolean.FALSE, aea.getValue());
- }
-
- public void testValueBooleanOperator4() throws Exception {
- this.createAnnotationAndMembers("Foo", "boolean bar();");
- ICompilationUnit cu = this.createTestType("@annot.Foo(bar=(7 != 2) ? false : true)");
- DeclarationAnnotationAdapter daa = new SimpleDeclarationAnnotationAdapter("annot.Foo");
- DeclarationAnnotationElementAdapter<Boolean> daea = ConversionDeclarationAnnotationElementAdapter.forBooleans(daa, "bar");
- AnnotationElementAdapter<Boolean> aea = new MemberAnnotationElementAdapter<Boolean>(this.idField(cu), daea);
- assertEquals(Boolean.FALSE, aea.getValue());
- }
-
- public void testValueInvalidValue1() throws Exception {
- this.createAnnotationAndMembers("Foo", "String bar();");
- ICompilationUnit cu = this.createTestType("@annot.Foo(bar=77)");
- DeclarationAnnotationAdapter daa = new SimpleDeclarationAnnotationAdapter("annot.Foo");
- DeclarationAnnotationElementAdapter<String> daea = ConversionDeclarationAnnotationElementAdapter.forStrings(daa, "bar");
- AnnotationElementAdapter<String> aea = new MemberAnnotationElementAdapter<String>(this.idField(cu), daea);
- assertNull(aea.getValue());
- }
-
- public void testValueInvalidValue2() throws Exception {
- this.createAnnotationAndMembers("Foo", "String bar();");
- ICompilationUnit cu = this.createTestType("@annot.Foo(bar=bazzzz)");
- DeclarationAnnotationAdapter daa = new SimpleDeclarationAnnotationAdapter("annot.Foo");
- DeclarationAnnotationElementAdapter<String> daea = ConversionDeclarationAnnotationElementAdapter.forStrings(daa, "bar");
- AnnotationElementAdapter<String> aea = new MemberAnnotationElementAdapter<String>(this.idField(cu), daea);
- assertNull(aea.getValue());
- }
-
- public void testValueInvalidValue3() throws Exception {
- this.createAnnotationAndMembers("Foo", "boolean bar();");
- ICompilationUnit cu = this.createTestType("@annot.Foo(bar=bazzzz)");
- DeclarationAnnotationAdapter daa = new SimpleDeclarationAnnotationAdapter("annot.Foo");
- DeclarationAnnotationElementAdapter<Boolean> daea = ConversionDeclarationAnnotationElementAdapter.forBooleans(daa, "bar");
- AnnotationElementAdapter<Boolean> aea = new MemberAnnotationElementAdapter<Boolean>(this.idField(cu), daea);
- assertNull(aea.getValue());
- }
-
- public void testValueInvalidValue4() throws Exception {
- this.createAnnotationAndMembers("Foo", "char bar();");
- ICompilationUnit cu = this.createTestType("@annot.Foo(bar=\"bazzzz\")");
- DeclarationAnnotationAdapter daa = new SimpleDeclarationAnnotationAdapter("annot.Foo");
- DeclarationAnnotationElementAdapter<String> daea = ConversionDeclarationAnnotationElementAdapter.forCharacters(daa, "bar");
- AnnotationElementAdapter<String> aea = new MemberAnnotationElementAdapter<String>(this.idField(cu), daea);
- assertNull(aea.getValue());
- }
-
- public void testValueInvalidValue5() throws Exception {
- this.createAnnotationAndMembers("Foo", "Class bar();");
- ICompilationUnit cu = this.createTestType("@annot.Foo(bar=\"java.lang.Object\")");
- DeclarationAnnotationAdapter daa = new SimpleDeclarationAnnotationAdapter("annot.Foo");
- DeclarationAnnotationElementAdapter<String> daea = new ConversionDeclarationAnnotationElementAdapter<String>(daa, "bar", SimpleTypeStringExpressionConverter.instance());
- AnnotationElementAdapter<String> aea = new MemberAnnotationElementAdapter<String>(this.idField(cu), daea);
- assertNull(aea.getValue());
- }
-
- public void testValueInvalidValue6() throws Exception {
- this.createEnum("TestEnum", "XXX, YYY, ZZZ");
- this.createAnnotationAndMembers("Foo", "enums.TestEnum bar();");
- ICompilationUnit cu = this.createTestType("@annot.Foo(bar=enums.TestEnum.class)");
- DeclarationAnnotationAdapter daa = new SimpleDeclarationAnnotationAdapter("annot.Foo");
- DeclarationAnnotationElementAdapter<String> daea = new EnumDeclarationAnnotationElementAdapter(daa, "bar");
- AnnotationElementAdapter<String> aea = new MemberAnnotationElementAdapter<String>(this.idField(cu), daea);
- assertNull(aea.getValue());
- }
-
- public void testValueInvalidValue7() throws Exception {
- this.createAnnotationAndMembers("Baz", "boolean fred();");
- this.createAnnotationAndMembers("Bar", "annot.Baz jimmy();");
- this.createAnnotationAndMembers("Foo", "annot.Bar value();");
- String value = "\"false\"";
- String element = "fred=" + value;
- String annotation = "@annot.Foo(@annot.Bar(jimmy=@annot.Baz(" + element + ")))";
- ICompilationUnit cu = this.createTestType(annotation);
- DeclarationAnnotationAdapter daa1 = new SimpleDeclarationAnnotationAdapter("annot.Foo");
- DeclarationAnnotationAdapter daa2 = new NestedDeclarationAnnotationAdapter(daa1, "value", "annot.Bar");
- DeclarationAnnotationAdapter daa3 = new NestedDeclarationAnnotationAdapter(daa2, "jimmy", "annot.Baz");
- DeclarationAnnotationElementAdapter<Boolean> daea = new ConversionDeclarationAnnotationElementAdapter<Boolean>(daa3, "fred", BooleanExpressionConverter.instance());
- AnnotationElementAdapter<Boolean> aea = new MemberAnnotationElementAdapter<Boolean>(this.idField(cu), daea);
- assertNull(aea.getValue());
- }
-
- public void testValueInvalidValue8() throws Exception {
- this.createAnnotationAndMembers("Foo", "String[] bar();");
- ICompilationUnit cu = this.createTestType("@annot.Foo(bar={true, false})");
- DeclarationAnnotationAdapter daa = new SimpleDeclarationAnnotationAdapter("annot.Foo");
- DeclarationAnnotationElementAdapter<String[]> daea = new ConversionDeclarationAnnotationElementAdapter<String[]>(daa, "bar", AnnotationStringArrayExpressionConverter.forStrings());
- AnnotationElementAdapter<String[]> aea = new MemberAnnotationElementAdapter<String[]>(this.idField(cu), daea);
- assertTrue(Arrays.equals(new String[] {null, null}, aea.getValue()));
- }
-
- public void testValueInvalidValue9() throws Exception {
- this.createAnnotationAndMembers("Foo", "String[] bar();");
- ICompilationUnit cu = this.createTestType("@annot.Foo(bar=77)");
- DeclarationAnnotationAdapter daa = new SimpleDeclarationAnnotationAdapter("annot.Foo");
- DeclarationAnnotationElementAdapter<String[]> daea = new ConversionDeclarationAnnotationElementAdapter<String[]>(daa, "bar", AnnotationStringArrayExpressionConverter.forStrings());
- AnnotationElementAdapter<String[]> aea = new MemberAnnotationElementAdapter<String[]>(this.idField(cu), daea);
- assertTrue(Arrays.equals(new String[] {null}, aea.getValue()));
- }
-
- public void testASTNode1() throws Exception {
- this.createAnnotationAndMembers("Foo", "String bar();");
- String value = "\"xxx\"";
- String element = "bar=" + value;
- String annotation = "@annot.Foo(" + element + ")";
- ICompilationUnit cu = this.createTestType(annotation);
- DeclarationAnnotationAdapter daa = new SimpleDeclarationAnnotationAdapter("annot.Foo");
- DeclarationAnnotationElementAdapter<String> daea = ConversionDeclarationAnnotationElementAdapter.forStrings(daa, "bar");
- AnnotationElementAdapter<String> aea = new MemberAnnotationElementAdapter<String>(this.idField(cu), daea);
-
- TextRange textRange = new ASTNodeTextRange(aea.getAstNode(this.buildASTRoot(cu)));
- assertEquals(this.getSource(cu).indexOf(value), textRange.getOffset());
- assertEquals(value.length(), textRange.getLength());
- assertEquals(8, textRange.getLineNumber());
- }
-
- public void testASTNode2() throws Exception {
- this.createAnnotationAndMembers("Baz", "boolean fred();");
- this.createAnnotationAndMembers("Bar", "annot.Baz jimmy();");
- this.createAnnotationAndMembers("Foo", "annot.Bar value();");
- String value = "false";
- String element = "fred=" + value;
- String annotation = "@annot.Foo(@annot.Bar(jimmy=@annot.Baz(" + element + ")))";
- ICompilationUnit cu = this.createTestType(annotation);
- DeclarationAnnotationAdapter daa1 = new SimpleDeclarationAnnotationAdapter("annot.Foo");
- DeclarationAnnotationAdapter daa2 = new NestedDeclarationAnnotationAdapter(daa1, "value", "annot.Bar");
- DeclarationAnnotationAdapter daa3 = new NestedDeclarationAnnotationAdapter(daa2, "jimmy", "annot.Baz");
- DeclarationAnnotationElementAdapter<Boolean> daea = new ConversionDeclarationAnnotationElementAdapter<Boolean>(daa3, "fred", BooleanExpressionConverter.instance());
- AnnotationElementAdapter<Boolean> aea = new MemberAnnotationElementAdapter<Boolean>(this.idField(cu), daea);
- assertEquals(Boolean.FALSE, aea.getValue());
- TextRange textRange = new ASTNodeTextRange(aea.getAstNode(this.buildASTRoot(cu)));
- assertEquals(value.length(), textRange.getLength());
- }
-
- public void testASTNode3() throws Exception {
- this.createAnnotationAndMembers("Foo", "String value();");
- String element = "\"xxx\"";
- String annotation = "@annot.Foo(" + element + ")";
- ICompilationUnit cu = this.createTestType(annotation);
- DeclarationAnnotationAdapter daa = new SimpleDeclarationAnnotationAdapter("annot.Foo");
- DeclarationAnnotationElementAdapter<String> daea = ConversionDeclarationAnnotationElementAdapter.forStrings(daa);
- AnnotationElementAdapter<String> aea = new MemberAnnotationElementAdapter<String>(this.idField(cu), daea);
-
- TextRange textRange = new ASTNodeTextRange(aea.getAstNode(this.buildASTRoot(cu)));
- assertEquals(this.getSource(cu).indexOf(element), textRange.getOffset());
- assertEquals(element.length(), textRange.getLength());
- }
-
- public void testASTNode4() throws Exception {
- this.createAnnotationAndMembers("Foo", "String value();");
- String annotation = "@annot.Foo";
- ICompilationUnit cu = this.createTestType(annotation);
- DeclarationAnnotationAdapter daa = new SimpleDeclarationAnnotationAdapter("annot.Foo");
- DeclarationAnnotationElementAdapter<String> daea = ConversionDeclarationAnnotationElementAdapter.forStrings(daa);
- AnnotationElementAdapter<String> aea = new MemberAnnotationElementAdapter<String>(this.idField(cu), daea);
-
- TextRange textRange = new ASTNodeTextRange(aea.getAstNode(this.buildASTRoot(cu)));
- assertEquals(this.getSource(cu).indexOf(annotation), textRange.getOffset());
- assertEquals(annotation.length(), textRange.getLength());
- }
-
- public void testSetValue1() throws Exception {
- this.createAnnotationAndMembers("Foo", "String bar();");
- String annotation = "@annot.Foo(bar=\"xxx\")";
- ICompilationUnit cu = this.createTestType(annotation);
- this.assertSourceContains(annotation, cu);
- DeclarationAnnotationAdapter daa = new SimpleDeclarationAnnotationAdapter("annot.Foo");
- DeclarationAnnotationElementAdapter<String> daea = ConversionDeclarationAnnotationElementAdapter.forStrings(daa, "bar");
- AnnotationElementAdapter<String> aea = new MemberAnnotationElementAdapter<String>(this.idField(cu), daea);
-
- aea.setValue(null);
- this.assertSourceDoesNotContain("Foo", cu);
- }
-
- public void testSetValue2() throws Exception {
- this.createAnnotationAndMembers("Foo", "String bar();");
- String annotation = "@annot.Foo(bar=\"xxx\")";
- ICompilationUnit cu = this.createTestType(annotation);
- this.assertSourceContains(annotation, cu);
- DeclarationAnnotationAdapter daa = new SimpleDeclarationAnnotationAdapter("annot.Foo");
- DeclarationAnnotationElementAdapter<String> daea = ConversionDeclarationAnnotationElementAdapter.forStrings(daa, "bar", false);
- AnnotationElementAdapter<String> aea = new MemberAnnotationElementAdapter<String>(this.idField(cu), daea);
-
- aea.setValue(null);
- this.assertSourceDoesNotContain(annotation, cu);
- this.assertSourceContains("@Foo", cu);
- }
-
- public void testSetValue3() throws Exception {
- this.createAnnotationAndMembers("Baz", "boolean fred();");
- this.createAnnotationAndMembers("Bar", "annot.Baz jimmy();");
- this.createAnnotationAndMembers("Foo", "annot.Bar value();");
- String annotation = "@annot.Foo(@annot.Bar(jimmy=@annot.Baz(fred=false)))";
- ICompilationUnit cu = this.createTestType(annotation);
- this.assertSourceContains(annotation, cu);
- DeclarationAnnotationAdapter daa1 = new SimpleDeclarationAnnotationAdapter("annot.Foo");
- DeclarationAnnotationAdapter daa2 = new NestedDeclarationAnnotationAdapter(daa1, "value", "annot.Bar");
- DeclarationAnnotationAdapter daa3 = new NestedDeclarationAnnotationAdapter(daa2, "jimmy", "annot.Baz");
- DeclarationAnnotationElementAdapter<Boolean> daea = new ConversionDeclarationAnnotationElementAdapter<Boolean>(daa3, "fred", BooleanExpressionConverter.instance());
- AnnotationElementAdapter<Boolean> aea = new MemberAnnotationElementAdapter<Boolean>(this.idField(cu), daea);
-
- aea.setValue(null);
- this.assertSourceDoesNotContain(annotation, cu);
- this.assertSourceDoesNotContain("Foo", cu);
- this.assertSourceDoesNotContain("Bar", cu);
- }
-
- public void testSetValue3a() throws Exception {
- this.createAnnotationAndMembers("Baz", "boolean fred();");
- this.createAnnotationAndMembers("Bar", "annot.Baz jimmy();");
- this.createAnnotationAndMembers("Foo", "annot.Bar value();");
- String annotation = "@annot.Foo(@annot.Bar(jimmy=@annot.Baz(fred=false)))";
- ICompilationUnit cu = this.createTestType(annotation);
- this.assertSourceContains(annotation, cu);
- DeclarationAnnotationAdapter daa1 = new SimpleDeclarationAnnotationAdapter("annot.Foo");
- DeclarationAnnotationAdapter daa2 = new NestedDeclarationAnnotationAdapter(daa1, "value", "annot.Bar", false);
- DeclarationAnnotationAdapter daa3 = new NestedDeclarationAnnotationAdapter(daa2, "jimmy", "annot.Baz", false);
- DeclarationAnnotationElementAdapter<Boolean> daea = new ConversionDeclarationAnnotationElementAdapter<Boolean>(daa3, "fred", BooleanExpressionConverter.instance());
- AnnotationElementAdapter<Boolean> aea = new MemberAnnotationElementAdapter<Boolean>(this.idField(cu), daea);
-
- aea.setValue(null);
- this.assertSourceDoesNotContain(annotation, cu);
- this.assertSourceContains("@annot.Foo(@Bar)", cu);
- }
-
- public void testSetValue4() throws Exception {
- this.createAnnotationAndMembers("Foo", "String bar();");
- ICompilationUnit cu = this.createTestType();
- DeclarationAnnotationAdapter daa = new SimpleDeclarationAnnotationAdapter("Foo");
- DeclarationAnnotationElementAdapter<String> daea = ConversionDeclarationAnnotationElementAdapter.forStrings(daa, "bar");
- AnnotationElementAdapter<String> aea = new MemberAnnotationElementAdapter<String>(this.idField(cu), daea);
-
- aea.setValue("xxx");
- this.assertSourceContains("@Foo(bar = \"xxx\")", cu);
- }
-
- public void testSetValue5() throws Exception {
- this.createAnnotationAndMembers("Baz", "boolean fred();");
- this.createAnnotationAndMembers("Bar", "annot.Baz jimmy();");
- this.createAnnotationAndMembers("Foo", "annot.Bar value();");
- String annotation = "@annot.Foo(@annot.Bar(jimmy=@annot.Baz(fred=false)))";
- ICompilationUnit cu = this.createTestType(annotation);
- this.assertSourceContains(annotation, cu);
- DeclarationAnnotationAdapter daa1 = new SimpleDeclarationAnnotationAdapter("annot.Foo");
- DeclarationAnnotationAdapter daa2 = new NestedDeclarationAnnotationAdapter(daa1, "value", "annot.Bar");
- DeclarationAnnotationAdapter daa3 = new NestedDeclarationAnnotationAdapter(daa2, "jimmy", "annot.Baz");
- DeclarationAnnotationElementAdapter<Boolean> daea = new ConversionDeclarationAnnotationElementAdapter<Boolean>(daa3, "fred", BooleanExpressionConverter.instance());
- AnnotationElementAdapter<Boolean> aea = new MemberAnnotationElementAdapter<Boolean>(this.idField(cu), daea);
-
- aea.setValue(Boolean.TRUE);
- this.assertSourceDoesNotContain(annotation, cu);
- this.assertSourceContains("@annot.Foo(@annot.Bar(jimmy=@annot.Baz(fred=true)))", cu);
- }
-
- public void testSetValue6() throws Exception {
- this.createAnnotationAndMembers("Baz", "boolean fred();");
- this.createAnnotationAndMembers("Bar", "annot.Baz jimmy();");
- this.createAnnotationAndMembers("Foo", "annot.Bar value();");
- ICompilationUnit cu = this.createTestType();
- DeclarationAnnotationAdapter daa1 = new SimpleDeclarationAnnotationAdapter("annot.Foo");
- DeclarationAnnotationAdapter daa2 = new NestedDeclarationAnnotationAdapter(daa1, "value", "annot.Bar");
- DeclarationAnnotationAdapter daa3 = new NestedDeclarationAnnotationAdapter(daa2, "jimmy", "annot.Baz");
- DeclarationAnnotationElementAdapter<Boolean> daea = new ConversionDeclarationAnnotationElementAdapter<Boolean>(daa3, "fred", BooleanExpressionConverter.instance());
- AnnotationElementAdapter<Boolean> aea = new MemberAnnotationElementAdapter<Boolean>(this.idField(cu), daea);
-
- aea.setValue(Boolean.TRUE);
- this.assertSourceContains("@Foo(@Bar(jimmy = @Baz(fred = true)))", cu);
- }
-
- public void testSetValue7() throws Exception {
- this.createAnnotationAndMembers("Foo", "String bar();");
- String annotation = "@annot.Foo(bar=\"xxx\")";
- ICompilationUnit cu = this.createTestType(annotation);
- this.assertSourceContains(annotation, cu);
- DeclarationAnnotationAdapter daa = new SimpleDeclarationAnnotationAdapter("annot.Foo");
- DeclarationAnnotationElementAdapter<String> daea = ConversionDeclarationAnnotationElementAdapter.forStrings(daa, "bar");
- AnnotationElementAdapter<String> aea = new MemberAnnotationElementAdapter<String>(this.idField(cu), daea);
-
- aea.setValue("yyy");
- this.assertSourceDoesNotContain(annotation, cu);
- this.assertSourceContains("@annot.Foo(bar=\"yyy\")", cu);
- }
-
- public void testSetValue8() throws Exception {
- this.createAnnotationAndMembers("Foo", "String bar();");
- String annotation = "@annot.Foo";
- ICompilationUnit cu = this.createTestType(annotation);
- this.assertSourceContains(annotation, cu);
- DeclarationAnnotationAdapter daa = new SimpleDeclarationAnnotationAdapter("annot.Foo");
- DeclarationAnnotationElementAdapter<String> daea = ConversionDeclarationAnnotationElementAdapter.forStrings(daa, "bar");
- AnnotationElementAdapter<String> aea = new MemberAnnotationElementAdapter<String>(this.idField(cu), daea);
-
- aea.setValue("xxx");
- this.assertSourceContains("@Foo(bar = \"xxx\")", cu);
- }
-
- public void testSetValue9() throws Exception {
- this.createAnnotationAndMembers("Foo", "String value(); String bar();");
- String annotation = "@annot.Foo(\"zzz\")";
- ICompilationUnit cu = this.createTestType(annotation);
- this.assertSourceContains(annotation, cu);
- DeclarationAnnotationAdapter daa = new SimpleDeclarationAnnotationAdapter("annot.Foo");
- DeclarationAnnotationElementAdapter<String> daea = ConversionDeclarationAnnotationElementAdapter.forStrings(daa, "bar");
- AnnotationElementAdapter<String> aea = new MemberAnnotationElementAdapter<String>(this.idField(cu), daea);
-
- aea.setValue("xxx");
- this.assertSourceDoesNotContain(annotation, cu);
- this.assertSourceContains("@Foo(value = \"zzz\", bar = \"xxx\")", cu);
- }
-
- public void testSetValue10() throws Exception {
- this.createAnnotationAndMembers("Foo", "String bar(); String baz();");
- String annotation = "@annot.Foo(bar=\"xxx\")";
- ICompilationUnit cu = this.createTestType(annotation);
- this.assertSourceContains(annotation, cu);
- DeclarationAnnotationAdapter daa = new SimpleDeclarationAnnotationAdapter("annot.Foo");
- DeclarationAnnotationElementAdapter<String> daea = ConversionDeclarationAnnotationElementAdapter.forStrings(daa, "baz");
- AnnotationElementAdapter<String> aea = new MemberAnnotationElementAdapter<String>(this.idField(cu), daea);
-
- aea.setValue("yyy");
- this.assertSourceDoesNotContain(annotation, cu);
- this.assertSourceContains("@annot.Foo(bar=\"xxx\", baz = \"yyy\")", cu);
- }
-
- public void testSetValue11() throws Exception {
- this.createAnnotationAndMembers("Baz", "int fred();");
- this.createAnnotationAndMembers("Bar", "annot.Baz[] jimmy();");
- this.createAnnotationAndMembers("Foo", "annot.Bar value();");
- String annotation = "@annot.Foo(@annot.Bar(jimmy={@annot.Baz(fred=0), @annot.Baz(fred=1), @annot.Baz(fred=2), @annot.Baz(fred=3)}))";
- ICompilationUnit cu = this.createTestType(annotation);
- this.assertSourceContains(annotation, cu);
- DeclarationAnnotationAdapter daa1 = new SimpleDeclarationAnnotationAdapter("annot.Foo");
- DeclarationAnnotationAdapter daa2 = new NestedDeclarationAnnotationAdapter(daa1, "value", "annot.Bar");
- DeclarationAnnotationAdapter daa3 = new NestedIndexedDeclarationAnnotationAdapter(daa2, "jimmy", 2, "annot.Baz");
- DeclarationAnnotationElementAdapter<Integer> daea = new ConversionDeclarationAnnotationElementAdapter<Integer>(daa3, "fred", NumberIntegerExpressionConverter.instance());
- AnnotationElementAdapter<Integer> aea = new MemberAnnotationElementAdapter<Integer>(this.idField(cu), daea);
-
- assertEquals(Integer.valueOf(2), aea.getValue());
- aea.setValue(Integer.valueOf(48));
- this.assertSourceContains("@annot.Foo(@annot.Bar(jimmy={@annot.Baz(fred=0), @annot.Baz(fred=1), @annot.Baz(fred=48), @annot.Baz(fred=3)}))", cu);
- }
-
- public void testSetValue12() throws Exception {
- this.createAnnotationAndMembers("Foo", "String value();");
- String annotation = "@annot.Foo";
- ICompilationUnit cu = this.createTestType(annotation);
- this.assertSourceContains(annotation, cu);
- DeclarationAnnotationAdapter daa = new SimpleDeclarationAnnotationAdapter("annot.Foo");
- DeclarationAnnotationElementAdapter<String> daea = ConversionDeclarationAnnotationElementAdapter.forStrings(daa, "value");
- AnnotationElementAdapter<String> aea = new MemberAnnotationElementAdapter<String>(this.idField(cu), daea);
-
- aea.setValue("xxx");
- this.assertSourceContains("@Foo(\"xxx\")", cu);
- }
-
- public void testSetValue13() throws Exception {
- this.createAnnotationAndMembers("Foo", "String value();");
- String annotation = "@annot.Foo(\"zzz\")";
- ICompilationUnit cu = this.createTestType(annotation);
- this.assertSourceContains(annotation, cu);
- DeclarationAnnotationAdapter daa = new SimpleDeclarationAnnotationAdapter("annot.Foo");
- DeclarationAnnotationElementAdapter<String> daea = ConversionDeclarationAnnotationElementAdapter.forStrings(daa, "value");
- AnnotationElementAdapter<String> aea = new MemberAnnotationElementAdapter<String>(this.idField(cu), daea);
-
- aea.setValue("xxx");
- this.assertSourceDoesNotContain(annotation, cu);
- this.assertSourceContains("@annot.Foo(\"xxx\")", cu);
- }
-
- public void testSimpleTypeLiteral1() throws Exception {
- this.createAnnotationAndMembers("Foo", "Class bar();");
- ICompilationUnit cu = this.createTestType("@annot.Foo(bar=java.lang.Object.class)");
- DeclarationAnnotationAdapter daa = new SimpleDeclarationAnnotationAdapter("annot.Foo");
- DeclarationAnnotationElementAdapter<String> daea = new ConversionDeclarationAnnotationElementAdapter<String>(daa, "bar", SimpleTypeStringExpressionConverter.instance());
- AnnotationElementAdapter<String> aea = new MemberAnnotationElementAdapter<String>(this.idField(cu), daea);
- assertEquals("java.lang.Object", aea.getValue());
- }
-
- public void testSimpleTypeLiteral2() throws Exception {
- this.createAnnotationAndMembers("Foo", "Class bar();");
- ICompilationUnit cu = this.createTestType();
- DeclarationAnnotationAdapter daa = new SimpleDeclarationAnnotationAdapter("annot.Foo");
- DeclarationAnnotationElementAdapter<String> daea = new ConversionDeclarationAnnotationElementAdapter<String>(daa, "bar", SimpleTypeStringExpressionConverter.instance());
- AnnotationElementAdapter<String> aea = new MemberAnnotationElementAdapter<String>(this.idField(cu), daea);
- aea.setValue("java.lang.Object");
- this.assertSourceContains("@Foo(bar = java.lang.Object.class)", cu);
- }
-
- public void testSimpleTypeLiteral3() throws Exception {
- this.createAnnotationAndMembers("Foo", "Class bar();");
- ICompilationUnit cu = this.createTestType("@annot.Foo(bar=int.class)");
- DeclarationAnnotationAdapter daa = new SimpleDeclarationAnnotationAdapter("annot.Foo");
- DeclarationAnnotationElementAdapter<String> daea = new ConversionDeclarationAnnotationElementAdapter<String>(daa, "bar", SimpleTypeStringExpressionConverter.instance());
- AnnotationElementAdapter<String> aea = new MemberAnnotationElementAdapter<String>(this.idField(cu), daea);
- assertNull(aea.getValue());
- }
-
- public void testSimpleTypeLiteral4() throws Exception {
- this.createAnnotationAndMembers("Foo", "Class bar();");
- ICompilationUnit cu = this.createTestType("@annot.Foo(bar=java.util.Map.Entry.class)");
- DeclarationAnnotationAdapter daa = new SimpleDeclarationAnnotationAdapter("annot.Foo");
- DeclarationAnnotationElementAdapter<String> daea = new ConversionDeclarationAnnotationElementAdapter<String>(daa, "bar", SimpleTypeStringExpressionConverter.instance());
- AnnotationElementAdapter<String> aea = new MemberAnnotationElementAdapter<String>(this.idField(cu), daea);
- assertEquals("java.util.Map.Entry", aea.getValue());
- }
-
- public void testPrimitiveTypeLiteral1() throws Exception {
- this.createAnnotationAndMembers("Foo", "Class bar();");
- ICompilationUnit cu = this.createTestType("@annot.Foo(bar=int.class)");
- DeclarationAnnotationAdapter daa = new SimpleDeclarationAnnotationAdapter("annot.Foo");
- DeclarationAnnotationElementAdapter<String> daea = new ConversionDeclarationAnnotationElementAdapter<String>(daa, "bar", PrimitiveTypeStringExpressionConverter.instance());
- AnnotationElementAdapter<String> aea = new MemberAnnotationElementAdapter<String>(this.idField(cu), daea);
- assertEquals("int", aea.getValue());
- }
-
- public void testPrimitiveTypeLiteral2() throws Exception {
- this.createAnnotationAndMembers("Foo", "Class bar();");
- ICompilationUnit cu = this.createTestType();
- DeclarationAnnotationAdapter daa = new SimpleDeclarationAnnotationAdapter("annot.Foo");
- DeclarationAnnotationElementAdapter<String> daea = new ConversionDeclarationAnnotationElementAdapter<String>(daa, "bar", PrimitiveTypeStringExpressionConverter.instance());
- AnnotationElementAdapter<String> aea = new MemberAnnotationElementAdapter<String>(this.idField(cu), daea);
- aea.setValue("int");
- this.assertSourceContains("@Foo(bar = int.class)", cu);
- }
-
- public void testPrimitiveTypeLiteral3() throws Exception {
- this.createAnnotationAndMembers("Foo", "Class bar();");
- ICompilationUnit cu = this.createTestType("@annot.Foo(bar=java.lang.Object.class)");
- DeclarationAnnotationAdapter daa = new SimpleDeclarationAnnotationAdapter("annot.Foo");
- DeclarationAnnotationElementAdapter<String> daea = new ConversionDeclarationAnnotationElementAdapter<String>(daa, "bar", PrimitiveTypeStringExpressionConverter.instance());
- AnnotationElementAdapter<String> aea = new MemberAnnotationElementAdapter<String>(this.idField(cu), daea);
- assertNull(aea.getValue());
- }
-
- public void testPrimitiveTypeLiteral4() throws Exception {
- this.createAnnotationAndMembers("Foo", "Class bar();");
- ICompilationUnit cu = this.createTestType("@annot.Foo(bar=void.class)");
- DeclarationAnnotationAdapter daa = new SimpleDeclarationAnnotationAdapter("annot.Foo");
- DeclarationAnnotationElementAdapter<String> daea = new ConversionDeclarationAnnotationElementAdapter<String>(daa, "bar", PrimitiveTypeStringExpressionConverter.instance());
- AnnotationElementAdapter<String> aea = new MemberAnnotationElementAdapter<String>(this.idField(cu), daea);
- assertEquals("void", aea.getValue());
- }
-
- public void testTypeLiteral1() throws Exception {
- this.createAnnotationAndMembers("Foo", "Class bar();");
- ICompilationUnit cu = this.createTestType("@annot.Foo(bar=java.lang.Object.class)");
- DeclarationAnnotationAdapter daa = new SimpleDeclarationAnnotationAdapter("annot.Foo");
- DeclarationAnnotationElementAdapter<String> daea = new ConversionDeclarationAnnotationElementAdapter<String>(daa, "bar", TypeStringExpressionConverter.instance());
- AnnotationElementAdapter<String> aea = new MemberAnnotationElementAdapter<String>(this.idField(cu), daea);
- assertEquals("java.lang.Object", aea.getValue());
- }
-
- public void testTypeLiteral2() throws Exception {
- this.createAnnotationAndMembers("Foo", "Class bar();");
- ICompilationUnit cu = this.createTestType();
- DeclarationAnnotationAdapter daa = new SimpleDeclarationAnnotationAdapter("annot.Foo");
- DeclarationAnnotationElementAdapter<String> daea = new ConversionDeclarationAnnotationElementAdapter<String>(daa, "bar", TypeStringExpressionConverter.instance());
- AnnotationElementAdapter<String> aea = new MemberAnnotationElementAdapter<String>(this.idField(cu), daea);
- aea.setValue("java.lang.Object");
- this.assertSourceContains("@Foo(bar = java.lang.Object.class)", cu);
- }
-
- public void testTypeLiteral3() throws Exception {
- this.createAnnotationAndMembers("Foo", "Class bar();");
- ICompilationUnit cu = this.createTestType("@annot.Foo(bar=java.util.Map.Entry.class)");
- DeclarationAnnotationAdapter daa = new SimpleDeclarationAnnotationAdapter("annot.Foo");
- DeclarationAnnotationElementAdapter<String> daea = new ConversionDeclarationAnnotationElementAdapter<String>(daa, "bar", TypeStringExpressionConverter.instance());
- AnnotationElementAdapter<String> aea = new MemberAnnotationElementAdapter<String>(this.idField(cu), daea);
- assertEquals("java.util.Map.Entry", aea.getValue());
- }
-
- public void testTypeLiteral14() throws Exception {
- this.createAnnotationAndMembers("Foo", "Class bar();");
- ICompilationUnit cu = this.createTestType("@annot.Foo(bar=int.class)");
- DeclarationAnnotationAdapter daa = new SimpleDeclarationAnnotationAdapter("annot.Foo");
- DeclarationAnnotationElementAdapter<String> daea = new ConversionDeclarationAnnotationElementAdapter<String>(daa, "bar", TypeStringExpressionConverter.instance());
- AnnotationElementAdapter<String> aea = new MemberAnnotationElementAdapter<String>(this.idField(cu), daea);
- assertEquals("int", aea.getValue());
- }
-
- public void testTypeLiteral5() throws Exception {
- this.createAnnotationAndMembers("Foo", "Class bar();");
- ICompilationUnit cu = this.createTestType();
- DeclarationAnnotationAdapter daa = new SimpleDeclarationAnnotationAdapter("annot.Foo");
- DeclarationAnnotationElementAdapter<String> daea = new ConversionDeclarationAnnotationElementAdapter<String>(daa, "bar", TypeStringExpressionConverter.instance());
- AnnotationElementAdapter<String> aea = new MemberAnnotationElementAdapter<String>(this.idField(cu), daea);
- aea.setValue("int");
- this.assertSourceContains("@Foo(bar = int.class)", cu);
- }
-
- public void testTypeLiteral6() throws Exception {
- this.createAnnotationAndMembers("Foo", "Class bar();");
- ICompilationUnit cu = this.createTestType("@annot.Foo(bar=void.class)");
- DeclarationAnnotationAdapter daa = new SimpleDeclarationAnnotationAdapter("annot.Foo");
- DeclarationAnnotationElementAdapter<String> daea = new ConversionDeclarationAnnotationElementAdapter<String>(daa, "bar", TypeStringExpressionConverter.instance());
- AnnotationElementAdapter<String> aea = new MemberAnnotationElementAdapter<String>(this.idField(cu), daea);
- assertEquals("void", aea.getValue());
- }
-
- public void testValueEnum1() throws Exception {
- this.createEnum("TestEnum", "XXX, YYY, ZZZ");
- this.createAnnotationAndMembers("Foo", "enums.TestEnum bar();");
- ICompilationUnit cu = this.createTestType("@annot.Foo(bar=enums.TestEnum.XXX)");
- DeclarationAnnotationAdapter daa = new SimpleDeclarationAnnotationAdapter("annot.Foo");
- DeclarationAnnotationElementAdapter<String> daea = new EnumDeclarationAnnotationElementAdapter(daa, "bar");
- AnnotationElementAdapter<String> aea = new MemberAnnotationElementAdapter<String>(this.idField(cu), daea);
- assertEquals("enums.TestEnum.XXX", aea.getValue());
- }
-
- public void testValueEnum2() throws Exception {
- this.createEnum("TestEnum", "XXX, YYY, ZZZ");
- this.createAnnotationAndMembers("Foo", "enums.TestEnum bar();");
- ICompilationUnit cu = this.createTestType("static enums.TestEnum.XXX", "@annot.Foo(bar=XXX)");
- DeclarationAnnotationAdapter daa = new SimpleDeclarationAnnotationAdapter("annot.Foo");
- DeclarationAnnotationElementAdapter<String> daea = new EnumDeclarationAnnotationElementAdapter(daa, "bar");
- AnnotationElementAdapter<String> aea = new MemberAnnotationElementAdapter<String>(this.idField(cu), daea);
- assertEquals("enums.TestEnum.XXX", aea.getValue());
- }
-
- public void testValueEnum3() throws Exception {
- this.createEnum("TestEnum", "XXX, YYY, ZZZ");
- this.createAnnotationAndMembers("Foo", "enums.TestEnum bar();");
- ICompilationUnit cu = this.createTestType("@annot.Foo");
- DeclarationAnnotationAdapter daa = new SimpleDeclarationAnnotationAdapter("annot.Foo");
- DeclarationAnnotationElementAdapter<String> daea = new EnumDeclarationAnnotationElementAdapter(daa, "bar");
- AnnotationElementAdapter<String> aea = new MemberAnnotationElementAdapter<String>(this.idField(cu), daea);
- assertNull(aea.getValue());
- }
-
- public void testValueEnum4() throws Exception {
- this.createEnum("TestEnum", "XXX, YYY, ZZZ");
- this.createAnnotationAndMembers("Foo", "enums.TestEnum bar();");
- ICompilationUnit cu = this.createTestType("enums.TestEnum", "@annot.Foo(bar=TestEnum.XXX)");
- DeclarationAnnotationAdapter daa = new SimpleDeclarationAnnotationAdapter("annot.Foo");
- DeclarationAnnotationElementAdapter<String> daea = new EnumDeclarationAnnotationElementAdapter(daa, "bar");
- AnnotationElementAdapter<String> aea = new MemberAnnotationElementAdapter<String>(this.idField(cu), daea);
- assertEquals("enums.TestEnum.XXX", aea.getValue());
- }
-
- public void testSetValueEnum1() throws Exception {
- this.createEnum("TestEnum", "XXX, YYY, ZZZ");
- this.createAnnotationAndMembers("Foo", "enums.TestEnum bar();");
- String expected = "@annot.Foo(bar=XXX)";
- ICompilationUnit cu = this.createTestType("static enums.TestEnum.XXX", expected);
- this.assertSourceContains(expected, cu);
- DeclarationAnnotationAdapter daa = new SimpleDeclarationAnnotationAdapter("annot.Foo");
- DeclarationAnnotationElementAdapter<String> daea = new EnumDeclarationAnnotationElementAdapter(daa, "bar");
- AnnotationElementAdapter<String> aea = new MemberAnnotationElementAdapter<String>(this.idField(cu), daea);
- aea.setValue(null);
- this.assertSourceDoesNotContain("Foo", cu);
- }
-
- public void testSetValueEnum2() throws Exception {
- this.createEnum("TestEnum", "XXX, YYY, ZZZ");
- this.createAnnotationAndMembers("Foo", "enums.TestEnum bar();");
- String expected = "@Foo(bar = XXX)";
- ICompilationUnit cu = this.createTestType();
- this.assertSourceDoesNotContain(expected, cu);
- DeclarationAnnotationAdapter daa = new SimpleDeclarationAnnotationAdapter("annot.Foo");
- DeclarationAnnotationElementAdapter<String> daea = new EnumDeclarationAnnotationElementAdapter(daa, "bar");
- AnnotationElementAdapter<String> aea = new MemberAnnotationElementAdapter<String>(this.idField(cu), daea);
- aea.setValue("enums.TestEnum.XXX");
- this.assertSourceContains("import static enums.TestEnum.XXX;", cu);
- this.assertSourceContains(expected, cu);
- }
-
- public void testSetValueEnumImportCollision1() throws Exception {
- this.createEnum("enums1", "TestEnum", "XXX, YYY, ZZZ");
- this.createEnum("enums2", "TestEnum", "XXX, YYY, ZZZ");
- this.createAnnotationAndMembers("Foo", "enums1.TestEnum bar1(); enums2.TestEnum bar2();");
- String expected = "@Foo(bar1 = XXX, bar2 = TestEnum.XXX)";
- ICompilationUnit cu = this.createTestType();
- this.assertSourceDoesNotContain(expected, cu);
-
- DeclarationAnnotationAdapter daa = new SimpleDeclarationAnnotationAdapter("annot.Foo");
-
- DeclarationAnnotationElementAdapter<String> daea1 = new EnumDeclarationAnnotationElementAdapter(daa, "bar1");
- AnnotationElementAdapter<String> aea1 = new MemberAnnotationElementAdapter<String>(this.idField(cu), daea1);
- aea1.setValue("enums1.TestEnum.XXX");
-
- DeclarationAnnotationElementAdapter<String> daea2 = new EnumDeclarationAnnotationElementAdapter(daa, "bar2");
- AnnotationElementAdapter<String> aea2 = new MemberAnnotationElementAdapter<String>(this.idField(cu), daea2);
- aea2.setValue("enums2.TestEnum.XXX");
-
- this.assertSourceContains("import static enums1.TestEnum.XXX;", cu);
- this.assertSourceDoesNotContain("import static enums2.TestEnum.XXX;", cu);
- this.assertSourceContains("import enums2.TestEnum;", cu);
- this.assertSourceContains(expected, cu);
- }
-
- public void testSetValueEnumImportCollision2() throws Exception {
- this.createEnum("enums1", "TestEnum", "XXX, YYY, ZZZ");
- this.createEnum("enums2", "TestEnum", "XXX, YYY, ZZZ");
- this.createAnnotationAndMembers("Foo", "enums1.TestEnum bar1(); enums2.TestEnum bar2();");
- String expected = "@annot.Foo(bar1=XXX, bar2 = TestEnum.XXX)";
- ICompilationUnit cu = this.createTestType("static enums1.TestEnum.*", "@annot.Foo(bar1=XXX)");
- this.assertSourceDoesNotContain(expected, cu);
-
- DeclarationAnnotationAdapter daa = new SimpleDeclarationAnnotationAdapter("annot.Foo");
-
- DeclarationAnnotationElementAdapter<String> daea1 = new EnumDeclarationAnnotationElementAdapter(daa, "bar1");
- AnnotationElementAdapter<String> aea1 = new MemberAnnotationElementAdapter<String>(this.idField(cu), daea1);
- assertNotNull(aea1.getValue());
-
- DeclarationAnnotationElementAdapter<String> daea2 = new EnumDeclarationAnnotationElementAdapter(daa, "bar2");
- AnnotationElementAdapter<String> aea2 = new MemberAnnotationElementAdapter<String>(this.idField(cu), daea2);
- aea2.setValue("enums2.TestEnum.XXX");
-
- this.assertSourceContains("import static enums1.TestEnum.*;", cu);
- this.assertSourceDoesNotContain("import static enums2.TestEnum.XXX;", cu);
- this.assertSourceContains("import enums2.TestEnum;", cu);
- this.assertSourceContains(expected, cu);
- }
-
- public void testSetValueEnumImportCollision3() throws Exception {
- this.createEnum("TestEnum1", "XXX, YYY, ZZZ");
- this.createEnum("TestEnum2", "XXX, YYY, ZZZ");
- this.createAnnotationAndMembers("Foo", "enums.TestEnum1 bar1(); enums.TestEnum2 bar2();");
- String expected = "@Foo(bar1 = XXX, bar2 = TestEnum2.XXX)";
- ICompilationUnit cu = this.createTestType();
- this.assertSourceDoesNotContain(expected, cu);
-
- DeclarationAnnotationAdapter daa = new SimpleDeclarationAnnotationAdapter("annot.Foo");
-
- DeclarationAnnotationElementAdapter<String> daea1 = new EnumDeclarationAnnotationElementAdapter(daa, "bar1");
- AnnotationElementAdapter<String> aea1 = new MemberAnnotationElementAdapter<String>(this.idField(cu), daea1);
- aea1.setValue("enums.TestEnum1.XXX");
-
- DeclarationAnnotationElementAdapter<String> daea2 = new EnumDeclarationAnnotationElementAdapter(daa, "bar2");
- AnnotationElementAdapter<String> aea2 = new MemberAnnotationElementAdapter<String>(this.idField(cu), daea2);
- aea2.setValue("enums.TestEnum2.XXX");
-
- this.assertSourceContains("import static enums.TestEnum1.XXX;", cu);
- this.assertSourceContains("import enums.TestEnum2;", cu);
- this.assertSourceContains(expected, cu);
- }
-
- public void testSetValueEnumImportCollision4() throws Exception {
- this.createEnum("TestEnum1", "XXX, YYY, ZZZ");
- this.createEnum("TestEnum2", "XXX, YYY, ZZZ");
- this.createAnnotationAndMembers("Foo", "enums.TestEnum1 bar1(); enums.TestEnum2 bar2();");
- String expected = "@annot.Foo(bar1=XXX, bar2 = TestEnum2.XXX)";
- ICompilationUnit cu = this.createTestType("static enums.TestEnum1.*", "@annot.Foo(bar1=XXX)");
- this.assertSourceDoesNotContain(expected, cu);
-
- DeclarationAnnotationAdapter daa = new SimpleDeclarationAnnotationAdapter("annot.Foo");
-
- DeclarationAnnotationElementAdapter<String> daea1 = new EnumDeclarationAnnotationElementAdapter(daa, "bar1");
- AnnotationElementAdapter<String> aea1 = new MemberAnnotationElementAdapter<String>(this.idField(cu), daea1);
- assertNotNull(aea1.getValue());
-
- DeclarationAnnotationElementAdapter<String> daea2 = new EnumDeclarationAnnotationElementAdapter(daa, "bar2");
- AnnotationElementAdapter<String> aea2 = new MemberAnnotationElementAdapter<String>(this.idField(cu), daea2);
- aea2.setValue("enums.TestEnum2.XXX");
-
- this.assertSourceContains("import static enums.TestEnum1.*;", cu);
- this.assertSourceContains("import enums.TestEnum2;", cu);
- this.assertSourceContains(expected, cu);
- }
-
- /**
- * not sure this is exactly what we want...
- * it would be nice if we just skip the static import; but it's a matter of taste...
- */
- public void testSetValueEnumImportCollision5() throws Exception {
- this.createEnum("TestEnum1", "XXX, YYY, ZZZ");
- this.createEnum("TestEnum2", "XXX, YYY, ZZZ");
- this.createAnnotationAndMembers("Foo", "enums.TestEnum1 bar1(); enums.TestEnum2 bar2();");
- String expected = "@Foo(bar1 = XXX, bar2 = TestEnum2.XXX)";
- ICompilationUnit cu = this.createTestType("enums.*", "");
- this.assertSourceDoesNotContain(expected, cu);
-
- DeclarationAnnotationAdapter daa = new SimpleDeclarationAnnotationAdapter("annot.Foo");
-
- DeclarationAnnotationElementAdapter<String> daea1 = new EnumDeclarationAnnotationElementAdapter(daa, "bar1");
- AnnotationElementAdapter<String> aea1 = new MemberAnnotationElementAdapter<String>(this.idField(cu), daea1);
- aea1.setValue("enums.TestEnum1.XXX");
-
- DeclarationAnnotationElementAdapter<String> daea2 = new EnumDeclarationAnnotationElementAdapter(daa, "bar2");
- AnnotationElementAdapter<String> aea2 = new MemberAnnotationElementAdapter<String>(this.idField(cu), daea2);
- aea2.setValue("enums.TestEnum2.XXX");
-
- this.assertSourceContains("import enums.*;", cu);
- this.assertSourceContains("import static enums.TestEnum1.XXX;", cu);
- this.assertSourceDoesNotContain("import enums.TestEnum2;", cu);
- this.assertSourceContains(expected, cu);
- }
-
- public void testSetValueEnumImportCollision6() throws Exception {
- this.createEnum("enums1", "TestEnum", "XXX, YYY, ZZZ");
- this.createEnum("enums2", "TestEnum", "XXX, YYY, ZZZ");
- this.createEnum("enums3", "TestEnum", "XXX, YYY, ZZZ");
- this.createAnnotationAndMembers("Foo", "enums1.TestEnum bar1(); enums2.TestEnum bar2(); enums3.TestEnum bar3();");
- String expected = "@Foo(bar1 = XXX, bar2 = TestEnum.XXX, bar3 = enums3.TestEnum.XXX)";
- ICompilationUnit cu = this.createTestType();
- this.assertSourceDoesNotContain(expected, cu);
-
- DeclarationAnnotationAdapter daa = new SimpleDeclarationAnnotationAdapter("annot.Foo");
-
- DeclarationAnnotationElementAdapter<String> daea1 = new EnumDeclarationAnnotationElementAdapter(daa, "bar1");
- AnnotationElementAdapter<String> aea1 = new MemberAnnotationElementAdapter<String>(this.idField(cu), daea1);
- aea1.setValue("enums1.TestEnum.XXX");
-
- DeclarationAnnotationElementAdapter<String> daea2 = new EnumDeclarationAnnotationElementAdapter(daa, "bar2");
- AnnotationElementAdapter<String> aea2 = new MemberAnnotationElementAdapter<String>(this.idField(cu), daea2);
- aea2.setValue("enums2.TestEnum.XXX");
-
- DeclarationAnnotationElementAdapter<String> daea3 = new EnumDeclarationAnnotationElementAdapter(daa, "bar3");
- AnnotationElementAdapter<String> aea3 = new MemberAnnotationElementAdapter<String>(this.idField(cu), daea3);
- aea3.setValue("enums3.TestEnum.XXX");
-
- this.assertSourceContains("import static enums1.TestEnum.XXX;", cu);
- this.assertSourceDoesNotContain("import static enums2.TestEnum.XXX;", cu);
- this.assertSourceContains("import enums2.TestEnum;", cu);
- this.assertSourceDoesNotContain("import static enums3", cu);
- this.assertSourceDoesNotContain("import enums3", cu);
- this.assertSourceContains(expected, cu);
- }
-
- public void testValueStringArray() throws Exception {
- this.createAnnotationAndMembers("Foo", "String[] bar();");
- ICompilationUnit cu = this.createTestType("@annot.Foo(bar={\"string0\", \"string1\"})");
- DeclarationAnnotationAdapter daa = new SimpleDeclarationAnnotationAdapter("annot.Foo");
- DeclarationAnnotationElementAdapter<String[]> daea = new ConversionDeclarationAnnotationElementAdapter<String[]>(daa, "bar", AnnotationStringArrayExpressionConverter.forStrings());
- AnnotationElementAdapter<String[]> aea = new MemberAnnotationElementAdapter<String[]>(this.idField(cu), daea);
- assertTrue(Arrays.equals(new String[] {"string0", "string1"}, aea.getValue()));
- }
-
- public void testValueStringArrayConcatenation() throws Exception {
- this.createAnnotationAndMembers("Foo", "String[] bar();");
- ICompilationUnit cu = this.createTestType("@annot.Foo(bar={\"stri\" + \"ng0\", \"s\" + \"tring1\"})");
- DeclarationAnnotationAdapter daa = new SimpleDeclarationAnnotationAdapter("annot.Foo");
- DeclarationAnnotationElementAdapter<String[]> daea = new ConversionDeclarationAnnotationElementAdapter<String[]>(daa, "bar", AnnotationStringArrayExpressionConverter.forStrings());
- AnnotationElementAdapter<String[]> aea = new MemberAnnotationElementAdapter<String[]>(this.idField(cu), daea);
- assertTrue(Arrays.equals(new String[] {"string0", "string1"}, aea.getValue()));
- }
-
- public void testValueStringArrayEmpty() throws Exception {
- this.createAnnotationAndMembers("Foo", "String[] bar();");
- ICompilationUnit cu = this.createTestType("@annot.Foo(bar={})");
- DeclarationAnnotationAdapter daa = new SimpleDeclarationAnnotationAdapter("annot.Foo");
- DeclarationAnnotationElementAdapter<String[]> daea = new ConversionDeclarationAnnotationElementAdapter<String[]>(daa, "bar", AnnotationStringArrayExpressionConverter.forStrings());
- AnnotationElementAdapter<String[]> aea = new MemberAnnotationElementAdapter<String[]>(this.idField(cu), daea);
- assertTrue(Arrays.equals(new String[0], aea.getValue()));
- }
-
- public void testValueStringArraySingleElement() throws Exception {
- this.createAnnotationAndMembers("Foo", "String[] bar();");
- ICompilationUnit cu = this.createTestType("@annot.Foo(bar=\"string0\")");
- DeclarationAnnotationAdapter daa = new SimpleDeclarationAnnotationAdapter("annot.Foo");
- DeclarationAnnotationElementAdapter<String[]> daea = new ConversionDeclarationAnnotationElementAdapter<String[]>(daa, "bar", AnnotationStringArrayExpressionConverter.forStrings());
- AnnotationElementAdapter<String[]> aea = new MemberAnnotationElementAdapter<String[]>(this.idField(cu), daea);
- assertTrue(Arrays.equals(new String[] {"string0"}, aea.getValue()));
- }
-
- public void testValueNullStringArray() throws Exception {
- this.createAnnotationAndMembers("Foo", "String[] bar();");
- ICompilationUnit cu = this.createTestType("@annot.Foo()");
- DeclarationAnnotationAdapter daa = new SimpleDeclarationAnnotationAdapter("annot.Foo");
- DeclarationAnnotationElementAdapter<String[]> daea = new ConversionDeclarationAnnotationElementAdapter<String[]>(daa, "bar", AnnotationStringArrayExpressionConverter.forStrings());
- AnnotationElementAdapter<String[]> aea = new MemberAnnotationElementAdapter<String[]>(this.idField(cu), daea);
- assertTrue(Arrays.equals(new String[0], aea.getValue()));
- }
-
- public void testSetValueStringArray() throws Exception {
- this.createAnnotationAndMembers("Foo", "String[] bar();");
- String expected = "@Foo(bar = { \"string0\", \"string1\" })";
- ICompilationUnit cu = this.createTestType();
- this.assertSourceDoesNotContain(expected, cu);
- DeclarationAnnotationAdapter daa = new SimpleDeclarationAnnotationAdapter("annot.Foo");
- DeclarationAnnotationElementAdapter<String[]> daea = new ConversionDeclarationAnnotationElementAdapter<String[]>(daa, "bar", AnnotationStringArrayExpressionConverter.forStrings());
- AnnotationElementAdapter<String[]> aea = new MemberAnnotationElementAdapter<String[]>(this.idField(cu), daea);
- aea.setValue(new String[] {"string0", "string1"});
- this.assertSourceContains(expected, cu);
- }
-
- public void testSetValueStringArrayEmptyRemove() throws Exception {
- this.createAnnotationAndMembers("Foo", "String[] bar();");
- String expected = "@Foo";
- ICompilationUnit cu = this.createTestType();
- this.assertSourceDoesNotContain(expected, cu);
- DeclarationAnnotationAdapter daa = new SimpleDeclarationAnnotationAdapter("annot.Foo");
- DeclarationAnnotationElementAdapter<String[]> daea = new ConversionDeclarationAnnotationElementAdapter<String[]>(daa, "bar", AnnotationStringArrayExpressionConverter.forStrings());
- AnnotationElementAdapter<String[]> aea = new MemberAnnotationElementAdapter<String[]>(this.idField(cu), daea);
- aea.setValue(new String[0]);
- this.assertSourceDoesNotContain(expected, cu);
- }
-
- public void testSetValueStringArrayEmpty() throws Exception {
- this.createAnnotationAndMembers("Foo", "String[] bar();");
- String expected = "@Foo(bar = {})";
- ICompilationUnit cu = this.createTestType();
- this.assertSourceDoesNotContain(expected, cu);
- DeclarationAnnotationAdapter daa = new SimpleDeclarationAnnotationAdapter("annot.Foo");
- ExpressionConverter<String[]> expressionConverter = new AnnotationStringArrayExpressionConverter(StringExpressionConverter.instance(), false);
- DeclarationAnnotationElementAdapter<String[]> daea = new ConversionDeclarationAnnotationElementAdapter<String[]>(daa, "bar", expressionConverter);
- AnnotationElementAdapter<String[]> aea = new MemberAnnotationElementAdapter<String[]>(this.idField(cu), daea);
- aea.setValue(new String[0]);
- this.assertSourceContains(expected, cu);
- }
-
- public void testSetValueStringArraySingleElement() throws Exception {
- this.createAnnotationAndMembers("Foo", "String[] bar();");
- String annotation = "@Foo(bar = \"string0\")";
- ICompilationUnit cu = this.createTestType();
- this.assertSourceDoesNotContain(annotation, cu);
- DeclarationAnnotationAdapter daa = new SimpleDeclarationAnnotationAdapter("annot.Foo");
- DeclarationAnnotationElementAdapter<String[]> daea = new ConversionDeclarationAnnotationElementAdapter<String[]>(daa, "bar", AnnotationStringArrayExpressionConverter.forStrings());
- AnnotationElementAdapter<String[]> aea = new MemberAnnotationElementAdapter<String[]>(this.idField(cu), daea);
- aea.setValue(new String[] {"string0"});
- this.assertSourceContains(annotation, cu);
- }
-
- public void testValueEnumArray() throws Exception {
- this.createEnum("TestEnum", "XXX, YYY, ZZZ");
- this.createAnnotationAndMembers("Foo", "enums.TestEnum[] bar();");
- ICompilationUnit cu = this.createTestType("@annot.Foo(bar={enums.TestEnum.XXX, enums.TestEnum.YYY})");
- DeclarationAnnotationAdapter daa = new SimpleDeclarationAnnotationAdapter("annot.Foo");
- DeclarationAnnotationElementAdapter<String[]> daea = new EnumArrayDeclarationAnnotationElementAdapter(daa, "bar");
- AnnotationElementAdapter<String[]> aea = new MemberAnnotationElementAdapter<String[]>(this.idField(cu), daea);
- assertTrue(Arrays.equals(new String[] {"enums.TestEnum.XXX", "enums.TestEnum.YYY"}, aea.getValue()));
- }
-
- public void testValueEnumArrayInvalidEntry() throws Exception {
- this.createEnum("TestEnum", "XXX, YYY, ZZZ");
- this.createAnnotationAndMembers("Foo", "enums.TestEnum[] bar();");
- ICompilationUnit cu = this.createTestType("@annot.Foo(bar={enums.TestEnum.XXX, 88})");
- DeclarationAnnotationAdapter daa = new SimpleDeclarationAnnotationAdapter("annot.Foo");
- DeclarationAnnotationElementAdapter<String[]> daea = new EnumArrayDeclarationAnnotationElementAdapter(daa, "bar");
- AnnotationElementAdapter<String[]> aea = new MemberAnnotationElementAdapter<String[]>(this.idField(cu), daea);
- assertTrue(Arrays.equals(new String[] {"enums.TestEnum.XXX", null}, aea.getValue()));
- }
-
- public void testValueEnumArrayEmpty() throws Exception {
- this.createEnum("TestEnum", "XXX, YYY, ZZZ");
- this.createAnnotationAndMembers("Foo", "enums.TestEnum[] bar();");
- ICompilationUnit cu = this.createTestType("@annot.Foo(bar={})");
- DeclarationAnnotationAdapter daa = new SimpleDeclarationAnnotationAdapter("annot.Foo");
- DeclarationAnnotationElementAdapter<String[]> daea = new EnumArrayDeclarationAnnotationElementAdapter(daa, "bar");
- AnnotationElementAdapter<String[]> aea = new MemberAnnotationElementAdapter<String[]>(this.idField(cu), daea);
- assertTrue(Arrays.equals(new String[0], aea.getValue()));
- }
-
- public void testValueEnumArraySingleElement() throws Exception {
- this.createEnum("TestEnum", "XXX, YYY, ZZZ");
- this.createAnnotationAndMembers("Foo", "enums.TestEnum[] bar();");
- ICompilationUnit cu = this.createTestType("@annot.Foo(bar=enums.TestEnum.XXX)");
- DeclarationAnnotationAdapter daa = new SimpleDeclarationAnnotationAdapter("annot.Foo");
- DeclarationAnnotationElementAdapter<String[]> daea = new EnumArrayDeclarationAnnotationElementAdapter(daa, "bar");
- AnnotationElementAdapter<String[]> aea = new MemberAnnotationElementAdapter<String[]>(this.idField(cu), daea);
- assertTrue(Arrays.equals(new String[] {"enums.TestEnum.XXX"}, aea.getValue()));
- }
-
- public void testValueEnumArraySingleElementInvalid() throws Exception {
- this.createEnum("TestEnum", "XXX, YYY, ZZZ");
- this.createAnnotationAndMembers("Foo", "enums.TestEnum[] bar();");
- ICompilationUnit cu = this.createTestType("@annot.Foo(bar=\"\")");
- DeclarationAnnotationAdapter daa = new SimpleDeclarationAnnotationAdapter("annot.Foo");
- DeclarationAnnotationElementAdapter<String[]> daea = new EnumArrayDeclarationAnnotationElementAdapter(daa, "bar");
- AnnotationElementAdapter<String[]> aea = new MemberAnnotationElementAdapter<String[]>(this.idField(cu), daea);
- assertTrue(Arrays.equals(new String[] {null}, aea.getValue()));
- }
-
- public void testValueNullEnumArray() throws Exception {
- this.createEnum("TestEnum", "XXX, YYY, ZZZ");
- this.createAnnotationAndMembers("Foo", "enums.TestEnum[] bar();");
- ICompilationUnit cu = this.createTestType("@annot.Foo()");
- DeclarationAnnotationAdapter daa = new SimpleDeclarationAnnotationAdapter("annot.Foo");
- DeclarationAnnotationElementAdapter<String[]> daea = new EnumArrayDeclarationAnnotationElementAdapter(daa, "bar");
- AnnotationElementAdapter<String[]> aea = new MemberAnnotationElementAdapter<String[]>(this.idField(cu), daea);
- assertTrue(Arrays.equals(new String[0], aea.getValue()));
- }
-
- public void testSetValueEnumArray() throws Exception {
- this.createEnum("TestEnum", "XXX, YYY, ZZZ");
- this.createAnnotationAndMembers("Foo", "enums.TestEnum[] bar();");
- String expected = "@Foo(bar = { XXX, YYY })";
- ICompilationUnit cu = this.createTestType();
- this.assertSourceDoesNotContain(expected, cu);
- DeclarationAnnotationAdapter daa = new SimpleDeclarationAnnotationAdapter("annot.Foo");
- DeclarationAnnotationElementAdapter<String[]> daea = new EnumArrayDeclarationAnnotationElementAdapter(daa, "bar");
- AnnotationElementAdapter<String[]> aea = new MemberAnnotationElementAdapter<String[]>(this.idField(cu), daea);
- aea.setValue(new String[] {"enums.TestEnum.XXX", "enums.TestEnum.YYY"});
- this.assertSourceContains("import static enums.TestEnum.XXX;", cu);
- this.assertSourceContains("import static enums.TestEnum.YYY;", cu);
- this.assertSourceContains(expected, cu);
- }
-
- public void testSetValueEnumArrayEmptyRemove() throws Exception {
- this.createEnum("TestEnum", "XXX, YYY, ZZZ");
- this.createAnnotationAndMembers("Foo", "enums.TestEnum[] bar();");
- String expected = "@Foo";
- ICompilationUnit cu = this.createTestType();
- this.assertSourceDoesNotContain(expected, cu);
- DeclarationAnnotationAdapter daa = new SimpleDeclarationAnnotationAdapter("annot.Foo");
- DeclarationAnnotationElementAdapter<String[]> daea = new EnumArrayDeclarationAnnotationElementAdapter(daa, "bar");
- AnnotationElementAdapter<String[]> aea = new MemberAnnotationElementAdapter<String[]>(this.idField(cu), daea);
- aea.setValue(new String[0]);
- this.assertSourceDoesNotContain(expected, cu);
- }
-
- public void testSetValueEnumArrayEmpty() throws Exception {
- this.createEnum("TestEnum", "XXX, YYY, ZZZ");
- this.createAnnotationAndMembers("Foo", "enums.TestEnum[] bar();");
- String expected = "@Foo(bar = {})";
- ICompilationUnit cu = this.createTestType();
- this.assertSourceDoesNotContain(expected, cu);
- DeclarationAnnotationAdapter daa = new SimpleDeclarationAnnotationAdapter("annot.Foo");
- DeclarationAnnotationElementAdapter<String[]> daea = new EnumArrayDeclarationAnnotationElementAdapter(daa, "bar", true, false);
- AnnotationElementAdapter<String[]> aea = new MemberAnnotationElementAdapter<String[]>(this.idField(cu), daea);
- aea.setValue(new String[0]);
- this.assertSourceContains(expected, cu);
- }
-
- public void testSetValueEnumArraySingleElement() throws Exception {
- this.createEnum("TestEnum", "XXX, YYY, ZZZ");
- this.createAnnotationAndMembers("Foo", "enums.TestEnum[] bar();");
- String expected = "@Foo(bar = XXX)";
- ICompilationUnit cu = this.createTestType();
- this.assertSourceDoesNotContain(expected, cu);
- DeclarationAnnotationAdapter daa = new SimpleDeclarationAnnotationAdapter("annot.Foo");
- DeclarationAnnotationElementAdapter<String[]> daea = new EnumArrayDeclarationAnnotationElementAdapter(daa, "bar");
- AnnotationElementAdapter<String[]> aea = new MemberAnnotationElementAdapter<String[]>(this.idField(cu), daea);
- aea.setValue(new String[] {"enums.TestEnum.XXX"});
- this.assertSourceContains("import static enums.TestEnum.XXX;", cu);
- this.assertSourceContains(expected, cu);
- }
-
- public void testSetValueEnumArrayImportCollision1() throws Exception {
- this.createEnum("enums1", "TestEnum", "XXX, YYY, ZZZ");
- this.createEnum("enums2", "TestEnum", "XXX, YYY, ZZZ");
- this.createAnnotationAndMembers("Foo", "enums1.TestEnum[] bar1(); enums2.TestEnum[] bar2();");
- String expected = "@Foo(bar1 = { XXX, YYY }, bar2 = { TestEnum.XXX, TestEnum.YYY })";
- ICompilationUnit cu = this.createTestType();
- this.assertSourceDoesNotContain(expected, cu);
-
- DeclarationAnnotationAdapter daa = new SimpleDeclarationAnnotationAdapter("annot.Foo");
-
- DeclarationAnnotationElementAdapter<String[]> daea1 = new EnumArrayDeclarationAnnotationElementAdapter(daa, "bar1");
- AnnotationElementAdapter<String[]> aea1 = new MemberAnnotationElementAdapter<String[]>(this.idField(cu), daea1);
- aea1.setValue(new String[] {"enums1.TestEnum.XXX", "enums1.TestEnum.YYY"});
-
- DeclarationAnnotationElementAdapter<String[]> daea2 = new EnumArrayDeclarationAnnotationElementAdapter(daa, "bar2");
- AnnotationElementAdapter<String[]> aea2 = new MemberAnnotationElementAdapter<String[]>(this.idField(cu), daea2);
- aea2.setValue(new String[] {"enums2.TestEnum.XXX", "enums2.TestEnum.YYY"});
-
- this.assertSourceContains("import static enums1.TestEnum.XXX;", cu);
- this.assertSourceContains("import static enums1.TestEnum.YYY;", cu);
- this.assertSourceDoesNotContain("import static enums2.TestEnum.XXX;", cu);
- this.assertSourceDoesNotContain("import static enums2.TestEnum.YYY;", cu);
- this.assertSourceContains("import enums2.TestEnum;", cu);
- this.assertSourceContains(expected, cu);
- }
-
- public void testSetValueEnumArrayImportCollision2() throws Exception {
- this.createEnum("enums1", "TestEnum", "XXX, YYY, ZZZ");
- this.createEnum("enums2", "TestEnum", "XXX, YYY, ZZZ");
- this.createAnnotationAndMembers("Foo", "enums1.TestEnum[] bar1(); enums2.TestEnum[] bar2();");
- String expected = "@annot.Foo(bar1={XXX,YYY}, bar2 = { TestEnum.XXX, TestEnum.YYY })";
- ICompilationUnit cu = this.createTestType("static enums1.TestEnum.*", "@annot.Foo(bar1={XXX,YYY})");
- this.assertSourceDoesNotContain(expected, cu);
-
- DeclarationAnnotationAdapter daa = new SimpleDeclarationAnnotationAdapter("annot.Foo");
-
- DeclarationAnnotationElementAdapter<String[]> daea1 = new EnumArrayDeclarationAnnotationElementAdapter(daa, "bar1");
- AnnotationElementAdapter<String[]> aea1 = new MemberAnnotationElementAdapter<String[]>(this.idField(cu), daea1);
- assertNotNull(aea1.getValue());
-
- DeclarationAnnotationElementAdapter<String[]> daea2 = new EnumArrayDeclarationAnnotationElementAdapter(daa, "bar2");
- AnnotationElementAdapter<String[]> aea2 = new MemberAnnotationElementAdapter<String[]>(this.idField(cu), daea2);
- aea2.setValue(new String[] {"enums2.TestEnum.XXX", "enums2.TestEnum.YYY"});
-
- this.assertSourceContains("import static enums1.TestEnum.*;", cu);
- this.assertSourceDoesNotContain("import static enums2.TestEnum.XXX;", cu);
- this.assertSourceDoesNotContain("import static enums2.TestEnum.YYY;", cu);
- this.assertSourceContains("import enums2.TestEnum;", cu);
- this.assertSourceContains(expected, cu);
- }
-
- public void testSetValueEnumArrayImportCollision3() throws Exception {
- this.createEnum("TestEnum1", "XXX, YYY, ZZZ");
- this.createEnum("TestEnum2", "XXX, YYY, ZZZ");
- this.createAnnotationAndMembers("Foo", "enums.TestEnum1[] bar1(); enums.TestEnum2[] bar2();");
- String expected = "@Foo(bar1 = { XXX, YYY }, bar2 = { TestEnum2.XXX, TestEnum2.YYY })";
- ICompilationUnit cu = this.createTestType();
- this.assertSourceDoesNotContain(expected, cu);
-
- DeclarationAnnotationAdapter daa = new SimpleDeclarationAnnotationAdapter("annot.Foo");
-
- DeclarationAnnotationElementAdapter<String[]> daea1 = new EnumArrayDeclarationAnnotationElementAdapter(daa, "bar1");
- AnnotationElementAdapter<String[]> aea1 = new MemberAnnotationElementAdapter<String[]>(this.idField(cu), daea1);
- aea1.setValue(new String[] {"enums.TestEnum1.XXX", "enums.TestEnum1.YYY"});
-
- DeclarationAnnotationElementAdapter<String[]> daea2 = new EnumArrayDeclarationAnnotationElementAdapter(daa, "bar2");
- AnnotationElementAdapter<String[]> aea2 = new MemberAnnotationElementAdapter<String[]>(this.idField(cu), daea2);
- aea2.setValue(new String[] {"enums.TestEnum2.XXX", "enums.TestEnum2.YYY"});
-
- this.assertSourceContains("import static enums.TestEnum1.XXX;", cu);
- this.assertSourceContains("import static enums.TestEnum1.YYY;", cu);
- this.assertSourceDoesNotContain("import static enums.TestEnum2.XXX;", cu);
- this.assertSourceDoesNotContain("import static enums.TestEnum2.YYY;", cu);
- this.assertSourceContains("import enums.TestEnum2;", cu);
- this.assertSourceContains(expected, cu);
- }
-
- public void testSetValueEnumArrayImportCollision4() throws Exception {
- this.createEnum("TestEnum1", "XXX, YYY, ZZZ");
- this.createEnum("TestEnum2", "XXX, YYY, ZZZ");
- this.createAnnotationAndMembers("Foo", "enums.TestEnum1[] bar1(); enums.TestEnum2[] bar2();");
- String expected = "@annot.Foo(bar1={XXX,YYY}, bar2 = { TestEnum2.XXX, TestEnum2.YYY })";
- ICompilationUnit cu = this.createTestType("static enums.TestEnum1.*", "@annot.Foo(bar1={XXX,YYY})");
- this.assertSourceDoesNotContain(expected, cu);
-
- DeclarationAnnotationAdapter daa = new SimpleDeclarationAnnotationAdapter("annot.Foo");
-
- DeclarationAnnotationElementAdapter<String[]> daea1 = new EnumArrayDeclarationAnnotationElementAdapter(daa, "bar1");
- AnnotationElementAdapter<String[]> aea1 = new MemberAnnotationElementAdapter<String[]>(this.idField(cu), daea1);
- assertNotNull(aea1.getValue());
-
- DeclarationAnnotationElementAdapter<String[]> daea2 = new EnumArrayDeclarationAnnotationElementAdapter(daa, "bar2");
- AnnotationElementAdapter<String[]> aea2 = new MemberAnnotationElementAdapter<String[]>(this.idField(cu), daea2);
- aea2.setValue(new String[] {"enums.TestEnum2.XXX", "enums.TestEnum2.YYY"});
-
- this.assertSourceContains("import static enums.TestEnum1.*;", cu);
- this.assertSourceDoesNotContain("import static enums.TestEnum2.XXX;", cu);
- this.assertSourceDoesNotContain("import static enums.TestEnum2.YYY;", cu);
- this.assertSourceContains("import enums.TestEnum2;", cu);
- this.assertSourceContains(expected, cu);
- }
-
- public void testSetValueEnumArrayImportCollision6() throws Exception {
- this.createEnum("enums1", "TestEnum", "XXX, YYY, ZZZ");
- this.createEnum("enums2", "TestEnum", "XXX, YYY, ZZZ");
- this.createEnum("enums3", "TestEnum", "XXX, YYY, ZZZ");
- this.createAnnotationAndMembers("Foo", "enums1.TestEnum[] bar1(); enums2.TestEnum[] bar2(); enums3.TestEnum[] bar3();");
- String expected = "@Foo(bar1 = { XXX, YYY }, bar2 = { TestEnum.XXX, TestEnum.YYY }, bar3 = { enums3.TestEnum.XXX, enums3.TestEnum.YYY })";
- ICompilationUnit cu = this.createTestType();
- this.assertSourceDoesNotContain(expected, cu);
-
- DeclarationAnnotationAdapter daa = new SimpleDeclarationAnnotationAdapter("annot.Foo");
-
- DeclarationAnnotationElementAdapter<String[]> daea1 = new EnumArrayDeclarationAnnotationElementAdapter(daa, "bar1");
- AnnotationElementAdapter<String[]> aea1 = new MemberAnnotationElementAdapter<String[]>(this.idField(cu), daea1);
- aea1.setValue(new String[] {"enums1.TestEnum.XXX", "enums1.TestEnum.YYY"});
-
- DeclarationAnnotationElementAdapter<String[]> daea2 = new EnumArrayDeclarationAnnotationElementAdapter(daa, "bar2");
- AnnotationElementAdapter<String[]> aea2 = new MemberAnnotationElementAdapter<String[]>(this.idField(cu), daea2);
- aea2.setValue(new String[] {"enums2.TestEnum.XXX", "enums2.TestEnum.YYY"});
-
- DeclarationAnnotationElementAdapter<String[]> daea3 = new EnumArrayDeclarationAnnotationElementAdapter(daa, "bar3");
- AnnotationElementAdapter<String[]> aea3 = new MemberAnnotationElementAdapter<String[]>(this.idField(cu), daea3);
- aea3.setValue(new String[] {"enums3.TestEnum.XXX", "enums3.TestEnum.YYY"});
-
- this.assertSourceContains("import static enums1.TestEnum.XXX;", cu);
- this.assertSourceContains("import static enums1.TestEnum.YYY;", cu);
- this.assertSourceDoesNotContain("import static enums2", cu);
- this.assertSourceContains("import enums2.TestEnum;", cu);
- this.assertSourceDoesNotContain("import static enums3", cu);
- this.assertSourceDoesNotContain("import enums3", cu);
- this.assertSourceContains(expected, cu);
- }
-
-}
diff --git a/jpa/tests/org.eclipse.jpt.core.tests/src/org/eclipse/jpt/core/tests/internal/utility/jdt/MiscTests.java b/jpa/tests/org.eclipse.jpt.core.tests/src/org/eclipse/jpt/core/tests/internal/utility/jdt/MiscTests.java
deleted file mode 100644
index 361e0a8790..0000000000
--- a/jpa/tests/org.eclipse.jpt.core.tests/src/org/eclipse/jpt/core/tests/internal/utility/jdt/MiscTests.java
+++ /dev/null
@@ -1,48 +0,0 @@
-/*******************************************************************************
- * Copyright (c) 2009 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.
- *
- * Contributors:
- * Oracle - initial API and implementation
- ******************************************************************************/
-package org.eclipse.jpt.core.tests.internal.utility.jdt;
-
-import org.eclipse.jdt.core.IField;
-import org.eclipse.jdt.core.IType;
-import org.eclipse.jdt.core.Signature;
-
-@SuppressWarnings("nls")
-public class MiscTests extends AnnotationTestCase {
-
- public MiscTests(String name) {
- super(name);
- }
-
- /*
- * Signature.toString(...) returns a dot-qualified name for member types
- */
- public void testSignature() throws Exception {
- IType hashTableType = this.getJavaProject().getJavaProject().findType("java.util.Hashtable");
- IField tableField = hashTableType.getField("table");
- String tableFieldTypeSignature = tableField.getTypeSignature();
- String tableFieldTypeName = Signature.toString(tableFieldTypeSignature);
- assertEquals(tableFieldTypeName, "java.util.Hashtable.Entry[]");
- }
-
- /*
- * IType.getFullyQualifiedName() returns a dollar-qualified name for member types
- * (but the lookup on IJavaProject takes a dot-qualified name!)
- */
- public void testITypeName() throws Exception {
- IType hashTableEntryType = this.getJavaProject().getJavaProject().findType("java.util.Hashtable.Entry");
- assertEquals(hashTableEntryType.getFullyQualifiedName(), "java.util.Hashtable$Entry");
- }
-
- public void testITypeParameterizedName() throws Exception {
- IType mapType = this.getJavaProject().getJavaProject().findType("java.util.Map");
- assertEquals(mapType.getFullyQualifiedParameterizedName(), "java.util.Map<K extends java.lang.Object, V extends java.lang.Object>");
- }
-
-}
diff --git a/jpa/tests/org.eclipse.jpt.core.tests/src/org/eclipse/jpt/core/tests/internal/utility/jdt/NestedDeclarationAnnotationAdapterTests.java b/jpa/tests/org.eclipse.jpt.core.tests/src/org/eclipse/jpt/core/tests/internal/utility/jdt/NestedDeclarationAnnotationAdapterTests.java
deleted file mode 100644
index a6687e348b..0000000000
--- a/jpa/tests/org.eclipse.jpt.core.tests/src/org/eclipse/jpt/core/tests/internal/utility/jdt/NestedDeclarationAnnotationAdapterTests.java
+++ /dev/null
@@ -1,765 +0,0 @@
-/*******************************************************************************
- * Copyright (c) 2006, 2009 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.
- *
- * Contributors:
- * Oracle - initial API and implementation
- ******************************************************************************/
-package org.eclipse.jpt.core.tests.internal.utility.jdt;
-
-import org.eclipse.jdt.core.ICompilationUnit;
-import org.eclipse.jdt.core.dom.Annotation;
-import org.eclipse.jdt.core.dom.NormalAnnotation;
-import org.eclipse.jdt.core.dom.SingleMemberAnnotation;
-import org.eclipse.jdt.core.dom.StringLiteral;
-import org.eclipse.jpt.core.internal.utility.jdt.MemberAnnotationAdapter;
-import org.eclipse.jpt.core.internal.utility.jdt.NestedDeclarationAnnotationAdapter;
-import org.eclipse.jpt.core.internal.utility.jdt.SimpleDeclarationAnnotationAdapter;
-import org.eclipse.jpt.core.utility.jdt.AnnotationAdapter;
-import org.eclipse.jpt.core.utility.jdt.DeclarationAnnotationAdapter;
-import org.eclipse.jpt.core.utility.jdt.Member;
-import org.eclipse.jpt.core.utility.jdt.ModifiedDeclaration;
-
-@SuppressWarnings("nls")
-public class NestedDeclarationAnnotationAdapterTests extends AnnotationTestCase {
-
- public NestedDeclarationAnnotationAdapterTests(String name) {
- super(name);
- }
-
- private void createAnnotationAndMembers(String annotationName, String annotationBody) throws Exception {
- this.javaProject.createCompilationUnit("annot", annotationName + ".java", "public @interface " + annotationName + " { " + annotationBody + " }");
- }
-
- public void testAnnotation1() throws Exception {
- this.createAnnotationAndMembers("Bar", "String value();");
- this.createAnnotationAndMembers("Foo", "annot.Bar nestedAnnotation();");
- ICompilationUnit cu = this.createTestType("@annot.Foo(nestedAnnotation=@annot.Bar)");
-
- DeclarationAnnotationAdapter daa = new NestedDeclarationAnnotationAdapter(
- new SimpleDeclarationAnnotationAdapter("annot.Foo"), "nestedAnnotation", "annot.Bar");
- AnnotationAdapter aa = new MemberAnnotationAdapter(this.idField(cu), daa);
- Annotation annotation = aa.getAnnotation(this.buildASTRoot(cu));
- assertNotNull(annotation);
- assertEquals("annot.Bar", annotation.getTypeName().getFullyQualifiedName());
- assertTrue(annotation.isMarkerAnnotation());
- }
-
- public void testAnnotation2() throws Exception {
- this.createAnnotationAndMembers("Baz", "String value();");
- this.createAnnotationAndMembers("Bar", "annot.Baz yana();");
- this.createAnnotationAndMembers("Foo", "annot.Bar nestedAnnotation();");
- ICompilationUnit cu = this.createTestType("@annot.Foo(nestedAnnotation=@annot.Bar(yana=@annot.Baz))");
-
- DeclarationAnnotationAdapter daa1 = new SimpleDeclarationAnnotationAdapter("annot.Foo");
- DeclarationAnnotationAdapter daa2 = new NestedDeclarationAnnotationAdapter(daa1, "nestedAnnotation", "annot.Bar");
- DeclarationAnnotationAdapter daa3 = new NestedDeclarationAnnotationAdapter(daa2, "yana", "annot.Baz");
- AnnotationAdapter aa = new MemberAnnotationAdapter(this.idField(cu), daa3);
- Annotation annotation = aa.getAnnotation(this.buildASTRoot(cu));
- assertNotNull(annotation);
- assertEquals("annot.Baz", annotation.getTypeName().getFullyQualifiedName());
- assertTrue(annotation.isMarkerAnnotation());
- }
-
- public void testAnnotationNull1() throws Exception {
- this.createAnnotationAndMembers("Bar", "String value();");
- this.createAnnotationAndMembers("Foo", "annot.Bar nestedAnnotation();");
- ICompilationUnit cu = this.createTestType("@annot.Foo()");
-
- DeclarationAnnotationAdapter daa = new NestedDeclarationAnnotationAdapter(
- new SimpleDeclarationAnnotationAdapter("annot.Foo"), "nestedAnnotation", "annot.Bar");
- AnnotationAdapter aa = new MemberAnnotationAdapter(this.idField(cu), daa);
- Annotation annotation = aa.getAnnotation(this.buildASTRoot(cu));
- assertNull(annotation);
- }
-
- public void testAnnotationNull2() throws Exception {
- this.createAnnotationAndMembers("Bar", "String value();");
- this.createAnnotationAndMembers("Foo", "annot.Bar nestedAnnotation();");
- ICompilationUnit cu = this.createTestType();
-
- DeclarationAnnotationAdapter daa = new NestedDeclarationAnnotationAdapter(
- new SimpleDeclarationAnnotationAdapter("annot.Foo"), "nestedAnnotation", "annot.Bar");
- AnnotationAdapter aa = new MemberAnnotationAdapter(this.idField(cu), daa);
- Annotation annotation = aa.getAnnotation(this.buildASTRoot(cu));
- assertNull(annotation);
- }
-
- public void testAnnotationNull3() throws Exception {
- this.createAnnotationAndMembers("Bar", "String value();");
- this.createAnnotationAndMembers("Foo", "String nestedAnnotation();");
- ICompilationUnit cu = this.createTestType("@annot.Foo(nestedAnnotation=\"annot.Bar\")");
-
- DeclarationAnnotationAdapter daa = new NestedDeclarationAnnotationAdapter(
- new SimpleDeclarationAnnotationAdapter("annot.Foo"), "nestedAnnotation", "annot.Bar");
- AnnotationAdapter aa = new MemberAnnotationAdapter(this.idField(cu), daa);
- Annotation annotation = aa.getAnnotation(this.buildASTRoot(cu));
- assertNull(annotation);
- }
-
- public void testAnnotationNull4() throws Exception {
- this.createAnnotationAndMembers("Bar", "String value();");
- this.createAnnotationAndMembers("Bar2", "String value();");
- this.createAnnotationAndMembers("Foo", "annot.Bar2 nestedAnnotation();");
- ICompilationUnit cu = this.createTestType("@annot.Foo(nestedAnnotation=@annot.Bar2)");
-
- DeclarationAnnotationAdapter daa = new NestedDeclarationAnnotationAdapter(
- new SimpleDeclarationAnnotationAdapter("annot.Foo"), "nestedAnnotation", "annot.Bar");
- AnnotationAdapter aa = new MemberAnnotationAdapter(this.idField(cu), daa);
- Annotation annotation = aa.getAnnotation(this.buildASTRoot(cu));
- assertNull(annotation);
- }
-
- public void testRemoveAnnotation1() throws Exception {
- this.createAnnotationAndMembers("Bar", "String value();");
- this.createAnnotationAndMembers("Foo", "annot.Bar nestedAnnotation();");
- String na = "@annot.Foo(nestedAnnotation=@annot.Bar)";
- ICompilationUnit cu = this.createTestType(na);
- this.assertSourceContains(na, cu);
-
- DeclarationAnnotationAdapter daa = new NestedDeclarationAnnotationAdapter(
- new SimpleDeclarationAnnotationAdapter("annot.Foo"), "nestedAnnotation", "annot.Bar");
- AnnotationAdapter aa = new MemberAnnotationAdapter(this.idField(cu), daa);
- Annotation annotation = aa.getAnnotation(this.buildASTRoot(cu));
- assertNotNull(annotation);
-
- aa.removeAnnotation();
- this.assertSourceDoesNotContain(na, cu);
- this.assertSourceDoesNotContain("Foo", cu);
- }
-
- public void testRemoveAnnotation1a() throws Exception {
- this.createAnnotationAndMembers("Bar", "String value();");
- this.createAnnotationAndMembers("Foo", "annot.Bar nestedAnnotation();");
- String na = "@annot.Foo(nestedAnnotation=@annot.Bar)";
- ICompilationUnit cu = this.createTestType(na);
- this.assertSourceContains(na, cu);
-
- DeclarationAnnotationAdapter daa = new NestedDeclarationAnnotationAdapter(
- new SimpleDeclarationAnnotationAdapter("annot.Foo"), "nestedAnnotation", "annot.Bar", false);
- AnnotationAdapter aa = new MemberAnnotationAdapter(this.idField(cu), daa);
- Annotation annotation = aa.getAnnotation(this.buildASTRoot(cu));
- assertNotNull(annotation);
-
- aa.removeAnnotation();
- this.assertSourceDoesNotContain(na, cu);
- this.assertSourceContains("Foo", cu);
- }
-
- public void testRemoveAnnotation2() throws Exception {
- this.createAnnotationAndMembers("Bar", "String value();");
- this.createAnnotationAndMembers("Foo", "annot.Bar nestedAnnotation();");
- ICompilationUnit cu = this.createTestType();
- this.assertSourceDoesNotContain("Foo", cu);
-
- DeclarationAnnotationAdapter daa = new NestedDeclarationAnnotationAdapter(
- new SimpleDeclarationAnnotationAdapter("annot.Foo"), "nestedAnnotation", "annot.Bar");
- AnnotationAdapter aa = new MemberAnnotationAdapter(this.idField(cu), daa);
- Annotation annotation = aa.getAnnotation(this.buildASTRoot(cu));
- assertNull(annotation);
-
- aa.removeAnnotation();
- this.assertSourceDoesNotContain("Foo", cu);
- }
-
- public void testRemoveAnnotation3() throws Exception {
- this.createAnnotationAndMembers("Bar", "String value();");
- this.createAnnotationAndMembers("Foo", "String nestedAnnotation();");
- String na = "@annot.Foo(nestedAnnotation=\"annot.Bar\")";
- ICompilationUnit cu = this.createTestType(na);
- this.assertSourceContains(na, cu);
-
- DeclarationAnnotationAdapter daa = new NestedDeclarationAnnotationAdapter(
- new SimpleDeclarationAnnotationAdapter("annot.Foo"), "nestedAnnotation", "annot.Bar");
- AnnotationAdapter aa = new MemberAnnotationAdapter(this.idField(cu), daa);
- Annotation annotation = aa.getAnnotation(this.buildASTRoot(cu));
- assertNull(annotation);
-
- aa.removeAnnotation();
- this.assertSourceContains(na, cu);
- }
-
- public void testRemoveAnnotation4() throws Exception {
- this.createAnnotationAndMembers("Bar", "String value();");
- this.createAnnotationAndMembers("Bar2", "String value();");
- this.createAnnotationAndMembers("Foo", "annot.Bar2 nestedAnnotation();");
- String na = "@annot.Foo(nestedAnnotation=@annot.Bar2)";
- ICompilationUnit cu = this.createTestType(na);
- this.assertSourceContains(na, cu);
-
- DeclarationAnnotationAdapter daa = new NestedDeclarationAnnotationAdapter(
- new SimpleDeclarationAnnotationAdapter("annot.Foo"), "nestedAnnotation", "annot.Bar");
- AnnotationAdapter aa = new MemberAnnotationAdapter(this.idField(cu), daa);
- Annotation annotation = aa.getAnnotation(this.buildASTRoot(cu));
- assertNull(annotation);
-
- aa.removeAnnotation();
- this.assertSourceContains(na, cu);
- }
-
- public void testRemoveAnnotation5() throws Exception {
- this.createAnnotationAndMembers("Baz", "String value();");
- this.createAnnotationAndMembers("Bar", "annot.Baz nestedAnnotation2();");
- this.createAnnotationAndMembers("Foo", "annot.Bar nestedAnnotation1();");
- String na = "@annot.Foo(nestedAnnotation1=@annot.Bar(nestedAnnotation2=@annot.Baz))";
- ICompilationUnit cu = this.createTestType(na);
- this.assertSourceContains(na, cu);
-
- DeclarationAnnotationAdapter daaFoo = new SimpleDeclarationAnnotationAdapter("annot.Foo");
- DeclarationAnnotationAdapter daaBar = new NestedDeclarationAnnotationAdapter(daaFoo, "nestedAnnotation1", "annot.Bar");
- DeclarationAnnotationAdapter daa = new NestedDeclarationAnnotationAdapter(daaBar, "nestedAnnotation2", "annot.Baz");
- AnnotationAdapter aa = new MemberAnnotationAdapter(this.idField(cu), daa);
- Annotation annotation = aa.getAnnotation(this.buildASTRoot(cu));
- assertNotNull(annotation);
-
- aa.removeAnnotation();
- this.assertSourceDoesNotContain(na, cu);
- this.assertSourceDoesNotContain("Foo", cu);
- this.assertSourceDoesNotContain("Bar", cu);
- this.assertSourceDoesNotContain("Baz", cu);
- }
-
- public void testRemoveAnnotation5a() throws Exception {
- this.createAnnotationAndMembers("Baz", "String value();");
- this.createAnnotationAndMembers("Bar", "annot.Baz nestedAnnotation2();");
- this.createAnnotationAndMembers("Foo", "annot.Bar nestedAnnotation1();");
- String na = "@annot.Foo(nestedAnnotation1=@annot.Bar(nestedAnnotation2=@annot.Baz))";
- ICompilationUnit cu = this.createTestType(na);
- this.assertSourceContains(na, cu);
-
- DeclarationAnnotationAdapter daaFoo = new SimpleDeclarationAnnotationAdapter("annot.Foo");
- DeclarationAnnotationAdapter daaBar = new NestedDeclarationAnnotationAdapter(daaFoo, "nestedAnnotation1", "annot.Bar", false);
- DeclarationAnnotationAdapter daa = new NestedDeclarationAnnotationAdapter(daaBar, "nestedAnnotation2", "annot.Baz", false);
- AnnotationAdapter aa = new MemberAnnotationAdapter(this.idField(cu), daa);
- Annotation annotation = aa.getAnnotation(this.buildASTRoot(cu));
- assertNotNull(annotation);
-
- aa.removeAnnotation();
- this.assertSourceDoesNotContain(na, cu);
- this.assertSourceContains("@annot.Foo(nestedAnnotation1=@Bar)", cu);
- }
-
- public void testNewMarkerAnnotation1() throws Exception {
- this.createAnnotationAndMembers("Bar", "String value();");
- this.createAnnotationAndMembers("Foo", "annot.Bar nestedAnnotation();");
- ICompilationUnit cu = this.createTestType();
- this.assertSourceDoesNotContain("Foo", cu);
-
- DeclarationAnnotationAdapter daa = new NestedDeclarationAnnotationAdapter(
- new SimpleDeclarationAnnotationAdapter("annot.Foo"), "nestedAnnotation", "annot.Bar");
- AnnotationAdapter aa = new MemberAnnotationAdapter(this.idField(cu), daa);
- Annotation annotation = aa.getAnnotation(this.buildASTRoot(cu));
- assertNull(annotation);
-
- aa.newMarkerAnnotation();
- this.assertSourceContains("@Foo(nestedAnnotation = @Bar)", cu);
- }
-
- public void testNewMarkerAnnotation2() throws Exception {
- this.createAnnotationAndMembers("Bar", "String value();");
- this.createAnnotationAndMembers("Foo", "annot.Bar value();");
- ICompilationUnit cu = this.createTestType();
- this.assertSourceDoesNotContain("Foo", cu);
-
- DeclarationAnnotationAdapter daa = new NestedDeclarationAnnotationAdapter(
- new SimpleDeclarationAnnotationAdapter("annot.Foo"), "value", "annot.Bar");
- AnnotationAdapter aa = new MemberAnnotationAdapter(this.idField(cu), daa);
- Annotation annotation = aa.getAnnotation(this.buildASTRoot(cu));
- assertNull(annotation);
-
- aa.newMarkerAnnotation();
- this.assertSourceContains("@Foo(@Bar)", cu);
- }
-
- public void testNewMarkerAnnotation3() throws Exception {
- this.createAnnotationAndMembers("Bar", "String value();");
- this.createAnnotationAndMembers("Foo", "annot.Bar nestedAnnotation();");
- ICompilationUnit cu = this.createTestType("@annot.Foo");
- String expected = "@Foo(nestedAnnotation = @Bar)";
- this.assertSourceDoesNotContain(expected, cu);
-
- DeclarationAnnotationAdapter daa = new NestedDeclarationAnnotationAdapter(
- new SimpleDeclarationAnnotationAdapter("annot.Foo"), "nestedAnnotation", "annot.Bar");
- AnnotationAdapter aa = new MemberAnnotationAdapter(this.idField(cu), daa);
- Annotation annotation = aa.getAnnotation(this.buildASTRoot(cu));
- assertNull(annotation);
-
- aa.newMarkerAnnotation();
- this.assertSourceContains(expected, cu);
- }
-
- public void testNewMarkerAnnotation4() throws Exception {
- this.createAnnotationAndMembers("Bar", "String value();");
- this.createAnnotationAndMembers("Foo", "annot.Bar value();");
- ICompilationUnit cu = this.createTestType("@annot.Foo");
- String expected = "@Foo(@Bar)";
- this.assertSourceDoesNotContain(expected, cu);
-
- DeclarationAnnotationAdapter daa = new NestedDeclarationAnnotationAdapter(
- new SimpleDeclarationAnnotationAdapter("annot.Foo"), "value", "annot.Bar");
- AnnotationAdapter aa = new MemberAnnotationAdapter(this.idField(cu), daa);
- Annotation annotation = aa.getAnnotation(this.buildASTRoot(cu));
- assertNull(annotation);
-
- aa.newMarkerAnnotation();
- this.assertSourceContains(expected, cu);
- }
-
- public void testNewMarkerAnnotation5() throws Exception {
- this.createAnnotationAndMembers("Bar", "String value();");
- this.createAnnotationAndMembers("Foo", "annot.Bar nestedAnnotation(); String value();");
- ICompilationUnit cu = this.createTestType("@annot.Foo(\"something\")");
- String expected = "@Foo(value = \"something\", nestedAnnotation = @Bar)";
- this.assertSourceDoesNotContain(expected, cu);
-
- DeclarationAnnotationAdapter daa = new NestedDeclarationAnnotationAdapter(
- new SimpleDeclarationAnnotationAdapter("annot.Foo"), "nestedAnnotation", "annot.Bar");
- AnnotationAdapter aa = new MemberAnnotationAdapter(this.idField(cu), daa);
- Annotation annotation = aa.getAnnotation(this.buildASTRoot(cu));
- assertNull(annotation);
-
- aa.newMarkerAnnotation();
- this.assertSourceContains(expected, cu);
- }
-
- public void testNewMarkerAnnotation6() throws Exception {
- this.createAnnotationAndMembers("Bar", "String value();");
- this.createAnnotationAndMembers("Foo", "Object value();");
- ICompilationUnit cu = this.createTestType("@annot.Foo(\"something\")");
- String expected = "@annot.Foo(@Bar)";
- this.assertSourceDoesNotContain(expected, cu);
-
- DeclarationAnnotationAdapter daa = new NestedDeclarationAnnotationAdapter(
- new SimpleDeclarationAnnotationAdapter("annot.Foo"), "value", "annot.Bar");
- AnnotationAdapter aa = new MemberAnnotationAdapter(this.idField(cu), daa);
- Annotation annotation = aa.getAnnotation(this.buildASTRoot(cu));
- assertNull(annotation);
-
- aa.newMarkerAnnotation();
- this.assertSourceContains(expected, cu);
- }
-
- public void testNewMarkerAnnotation7() throws Exception {
- this.createAnnotationAndMembers("Bar", "String value();");
- this.createAnnotationAndMembers("Foo", "String xxx(); annot.Bar nestedAnnotation();");
- ICompilationUnit cu = this.createTestType("@annot.Foo(xxx=\"something\")");
- String expected = "@annot.Foo(xxx=\"something\", nestedAnnotation = @Bar)";
- this.assertSourceDoesNotContain(expected, cu);
-
- DeclarationAnnotationAdapter daa = new NestedDeclarationAnnotationAdapter(
- new SimpleDeclarationAnnotationAdapter("annot.Foo"), "nestedAnnotation", "annot.Bar");
- AnnotationAdapter aa = new MemberAnnotationAdapter(this.idField(cu), daa);
- Annotation annotation = aa.getAnnotation(this.buildASTRoot(cu));
- assertNull(annotation);
-
- aa.newMarkerAnnotation();
- this.assertSourceContains(expected, cu);
- }
-
- public void testNewMarkerAnnotation8() throws Exception {
- this.createAnnotationAndMembers("Bar", "String value();");
- this.createAnnotationAndMembers("Foo", "String xxx(); annot.Bar value();");
- ICompilationUnit cu = this.createTestType("@annot.Foo(xxx=\"something\")");
- String expected = "@annot.Foo(xxx=\"something\", value = @Bar)";
- this.assertSourceDoesNotContain(expected, cu);
-
- DeclarationAnnotationAdapter daa = new NestedDeclarationAnnotationAdapter(
- new SimpleDeclarationAnnotationAdapter("annot.Foo"), "value", "annot.Bar");
- AnnotationAdapter aa = new MemberAnnotationAdapter(this.idField(cu), daa);
- Annotation annotation = aa.getAnnotation(this.buildASTRoot(cu));
- assertNull(annotation);
-
- aa.newMarkerAnnotation();
- this.assertSourceContains(expected, cu);
- }
-
- public void testNewSingleMemberAnnotation1() throws Exception {
- this.createAnnotationAndMembers("Bar", "String value();");
- this.createAnnotationAndMembers("Foo", "annot.Bar nestedAnnotation();");
- ICompilationUnit cu = this.createTestType();
- this.assertSourceDoesNotContain("Foo", cu);
- this.idField(cu).edit(new Member.Editor() {
- public void edit(ModifiedDeclaration declaration) {
- NestedDeclarationAnnotationAdapterTests.this.editNewSingleMemberAnnotation1(declaration);
- }
- });
- this.assertSourceContains("@Foo(nestedAnnotation = @Bar(\"test string literal\"))", cu);
- }
-
- void editNewSingleMemberAnnotation1(ModifiedDeclaration declaration) {
- DeclarationAnnotationAdapter daa = new NestedDeclarationAnnotationAdapter(
- new SimpleDeclarationAnnotationAdapter("annot.Foo"), "nestedAnnotation", "annot.Bar");
- SingleMemberAnnotation annotation = (SingleMemberAnnotation) daa.getAnnotation(declaration);
- assertNull(annotation);
- annotation = daa.newSingleMemberAnnotation(declaration);
- StringLiteral stringLiteral = annotation.getAST().newStringLiteral();
- stringLiteral.setLiteralValue("test string literal");
- annotation.setValue(stringLiteral);
- }
-
- public void testNewSingleMemberAnnotation2() throws Exception {
- this.createAnnotationAndMembers("Bar", "String value();");
- this.createAnnotationAndMembers("Foo", "annot.Bar nestedAnnotation();");
- ICompilationUnit cu = this.createTestType();
- this.assertSourceDoesNotContain("Foo", cu);
-
- DeclarationAnnotationAdapter daa = new NestedDeclarationAnnotationAdapter(
- new SimpleDeclarationAnnotationAdapter("annot.Foo"), "value", "annot.Bar");
- AnnotationAdapter aa = new MemberAnnotationAdapter(this.idField(cu), daa);
- SingleMemberAnnotation annotation = (SingleMemberAnnotation) aa.getAnnotation(this.buildASTRoot(cu));
- assertNull(annotation);
-
- this.idField(cu).edit(new Member.Editor() {
- public void edit(ModifiedDeclaration declaration) {
- NestedDeclarationAnnotationAdapterTests.this.editNewSingleMemberAnnotation2(declaration);
- }
- });
- this.assertSourceContains("@Foo(@Bar(\"test string literal\"))", cu);
- }
-
- void editNewSingleMemberAnnotation2(ModifiedDeclaration declaration) {
- DeclarationAnnotationAdapter daa = new NestedDeclarationAnnotationAdapter(
- new SimpleDeclarationAnnotationAdapter("annot.Foo"), "value", "annot.Bar");
- SingleMemberAnnotation annotation = (SingleMemberAnnotation) daa.getAnnotation(declaration);
- assertNull(annotation);
- annotation = daa.newSingleMemberAnnotation(declaration);
- StringLiteral stringLiteral = annotation.getAST().newStringLiteral();
- stringLiteral.setLiteralValue("test string literal");
- annotation.setValue(stringLiteral);
- }
-
- public void testNewSingleMemberAnnotation3() throws Exception {
- this.createAnnotationAndMembers("Bar", "String value();");
- this.createAnnotationAndMembers("Foo", "annot.Bar nestedAnnotation();");
- ICompilationUnit cu = this.createTestType("@annot.Foo");
- String expected = "@Foo(nestedAnnotation = @Bar(\"test string literal\"))";
- this.assertSourceDoesNotContain(expected, cu);
- this.idField(cu).edit(new Member.Editor() {
- public void edit(ModifiedDeclaration declaration) {
- NestedDeclarationAnnotationAdapterTests.this.editNewSingleMemberAnnotation3(declaration);
- }
- });
- this.assertSourceContains(expected, cu);
- }
-
- void editNewSingleMemberAnnotation3(ModifiedDeclaration declaration) {
- DeclarationAnnotationAdapter daa = new NestedDeclarationAnnotationAdapter(
- new SimpleDeclarationAnnotationAdapter("annot.Foo"), "nestedAnnotation", "annot.Bar");
- SingleMemberAnnotation annotation = (SingleMemberAnnotation) daa.getAnnotation(declaration);
- assertNull(annotation);
- annotation = daa.newSingleMemberAnnotation(declaration);
- StringLiteral stringLiteral = annotation.getAST().newStringLiteral();
- stringLiteral.setLiteralValue("test string literal");
- annotation.setValue(stringLiteral);
- }
-
- public void testNewSingleMemberAnnotation4() throws Exception {
- this.createAnnotationAndMembers("Bar", "String value();");
- this.createAnnotationAndMembers("Foo", "annot.Bar value();");
- ICompilationUnit cu = this.createTestType("@annot.Foo");
- String expected = "@Foo(@Bar(\"test string literal\"))";
- this.assertSourceDoesNotContain(expected, cu);
- this.idField(cu).edit(new Member.Editor() {
- public void edit(ModifiedDeclaration declaration) {
- NestedDeclarationAnnotationAdapterTests.this.editNewSingleMemberAnnotation4(declaration);
- }
- });
- this.assertSourceContains(expected, cu);
- }
-
- void editNewSingleMemberAnnotation4(ModifiedDeclaration declaration) {
- DeclarationAnnotationAdapter daa = new NestedDeclarationAnnotationAdapter(
- new SimpleDeclarationAnnotationAdapter("annot.Foo"), "value", "annot.Bar");
- SingleMemberAnnotation annotation = (SingleMemberAnnotation) daa.getAnnotation(declaration);
- assertNull(annotation);
- annotation = daa.newSingleMemberAnnotation(declaration);
- StringLiteral stringLiteral = annotation.getAST().newStringLiteral();
- stringLiteral.setLiteralValue("test string literal");
- annotation.setValue(stringLiteral);
- }
-
- public void testNewSingleMemberAnnotation5() throws Exception {
- this.createAnnotationAndMembers("Bar", "String value();");
- this.createAnnotationAndMembers("Foo", "annot.Bar nestedAnnotation(); String value();");
- ICompilationUnit cu = this.createTestType("@annot.Foo(\"something\")");
- String expected = "@Foo(value = \"something\", nestedAnnotation = @Bar(\"test string literal\"))";
- this.assertSourceDoesNotContain(expected, cu);
- this.idField(cu).edit(new Member.Editor() {
- public void edit(ModifiedDeclaration declaration) {
- NestedDeclarationAnnotationAdapterTests.this.editNewSingleMemberAnnotation5(declaration);
- }
- });
- this.assertSourceContains(expected, cu);
- }
-
- void editNewSingleMemberAnnotation5(ModifiedDeclaration declaration) {
- DeclarationAnnotationAdapter daa = new NestedDeclarationAnnotationAdapter(
- new SimpleDeclarationAnnotationAdapter("annot.Foo"), "nestedAnnotation", "annot.Bar");
- SingleMemberAnnotation annotation = (SingleMemberAnnotation) daa.getAnnotation(declaration);
- assertNull(annotation);
- annotation = daa.newSingleMemberAnnotation(declaration);
- StringLiteral stringLiteral = annotation.getAST().newStringLiteral();
- stringLiteral.setLiteralValue("test string literal");
- annotation.setValue(stringLiteral);
- }
-
- public void testNewSingleMemberAnnotation6() throws Exception {
- this.createAnnotationAndMembers("Bar", "String value();");
- this.createAnnotationAndMembers("Foo", "Object value();");
- ICompilationUnit cu = this.createTestType("@annot.Foo(\"something\")");
- String expected = "@annot.Foo(@Bar(\"test string literal\"))";
- this.assertSourceDoesNotContain(expected, cu);
- this.idField(cu).edit(new Member.Editor() {
- public void edit(ModifiedDeclaration declaration) {
- NestedDeclarationAnnotationAdapterTests.this.editNewSingleMemberAnnotation6(declaration);
- }
- });
- this.assertSourceContains(expected, cu);
- }
-
- void editNewSingleMemberAnnotation6(ModifiedDeclaration declaration) {
- DeclarationAnnotationAdapter daa = new NestedDeclarationAnnotationAdapter(
- new SimpleDeclarationAnnotationAdapter("annot.Foo"), "value", "annot.Bar");
- SingleMemberAnnotation annotation = (SingleMemberAnnotation) daa.getAnnotation(declaration);
- assertNull(annotation);
- annotation = daa.newSingleMemberAnnotation(declaration);
- StringLiteral stringLiteral = annotation.getAST().newStringLiteral();
- stringLiteral.setLiteralValue("test string literal");
- annotation.setValue(stringLiteral);
- }
-
- public void testNewSingleMemberAnnotation7() throws Exception {
- this.createAnnotationAndMembers("Bar", "String value();");
- this.createAnnotationAndMembers("Foo", "annot.Bar nestedAnnotation(); String xxx();");
- ICompilationUnit cu = this.createTestType("@annot.Foo(xxx=\"something\")");
- String expected = "@annot.Foo(xxx=\"something\", nestedAnnotation = @Bar(\"test string literal\"))";
- this.assertSourceDoesNotContain(expected, cu);
- this.idField(cu).edit(new Member.Editor() {
- public void edit(ModifiedDeclaration declaration) {
- NestedDeclarationAnnotationAdapterTests.this.editNewSingleMemberAnnotation7(declaration);
- }
- });
- this.assertSourceContains(expected, cu);
- }
-
- void editNewSingleMemberAnnotation7(ModifiedDeclaration declaration) {
- DeclarationAnnotationAdapter daa = new NestedDeclarationAnnotationAdapter(
- new SimpleDeclarationAnnotationAdapter("annot.Foo"), "nestedAnnotation", "annot.Bar");
- SingleMemberAnnotation annotation = (SingleMemberAnnotation) daa.getAnnotation(declaration);
- assertNull(annotation);
- annotation = daa.newSingleMemberAnnotation(declaration);
- StringLiteral stringLiteral = annotation.getAST().newStringLiteral();
- stringLiteral.setLiteralValue("test string literal");
- annotation.setValue(stringLiteral);
- }
-
- public void testNewSingleMemberAnnotation8() throws Exception {
- this.createAnnotationAndMembers("Bar", "String value();");
- this.createAnnotationAndMembers("Foo", "annot.Bar value(); String xxx();");
- ICompilationUnit cu = this.createTestType("@annot.Foo(xxx=\"something\")");
- String expected = "@annot.Foo(xxx=\"something\", value = @Bar(\"test string literal\"))";
- this.assertSourceDoesNotContain(expected, cu);
- this.idField(cu).edit(new Member.Editor() {
- public void edit(ModifiedDeclaration declaration) {
- NestedDeclarationAnnotationAdapterTests.this.editNewSingleMemberAnnotation8(declaration);
- }
- });
- this.assertSourceContains(expected, cu);
- }
-
- void editNewSingleMemberAnnotation8(ModifiedDeclaration declaration) {
- DeclarationAnnotationAdapter daa = new NestedDeclarationAnnotationAdapter(
- new SimpleDeclarationAnnotationAdapter("annot.Foo"), "value", "annot.Bar");
- SingleMemberAnnotation annotation = (SingleMemberAnnotation) daa.getAnnotation(declaration);
- assertNull(annotation);
- annotation = daa.newSingleMemberAnnotation(declaration);
- StringLiteral stringLiteral = annotation.getAST().newStringLiteral();
- stringLiteral.setLiteralValue("test string literal");
- annotation.setValue(stringLiteral);
- }
-
- public void testNewNormalAnnotation1() throws Exception {
- this.createAnnotationAndMembers("Bar", "String yyy();");
- this.createAnnotationAndMembers("Foo", "annot.Bar nestedAnnotation();");
- ICompilationUnit cu = this.createTestType();
- this.assertSourceDoesNotContain("Foo", cu);
- this.idField(cu).edit(new Member.Editor() {
- public void edit(ModifiedDeclaration declaration) {
- NestedDeclarationAnnotationAdapterTests.this.editNewNormalAnnotation1(declaration);
- }
- });
- this.assertSourceContains("@Foo(nestedAnnotation = @Bar(yyy = \"test string literal\"))", cu);
- }
-
- void editNewNormalAnnotation1(ModifiedDeclaration declaration) {
- DeclarationAnnotationAdapter daa = new NestedDeclarationAnnotationAdapter(
- new SimpleDeclarationAnnotationAdapter("annot.Foo"), "nestedAnnotation", "annot.Bar");
- NormalAnnotation annotation = (NormalAnnotation) daa.getAnnotation(declaration);
- assertNull(annotation);
- annotation = daa.newNormalAnnotation(declaration);
- this.addMemberValuePair(annotation, "yyy", "test string literal");
- }
-
- public void testNewNormalAnnotation2() throws Exception {
- this.createAnnotationAndMembers("Bar", "String yyy();");
- this.createAnnotationAndMembers("Foo", "annot.Bar value();");
- ICompilationUnit cu = this.createTestType();
- this.assertSourceDoesNotContain("Foo", cu);
- this.idField(cu).edit(new Member.Editor() {
- public void edit(ModifiedDeclaration declaration) {
- NestedDeclarationAnnotationAdapterTests.this.editNewNormalAnnotation2(declaration);
- }
- });
- this.assertSourceContains("@Foo(@Bar(yyy = \"test string literal\"))", cu);
- }
-
- void editNewNormalAnnotation2(ModifiedDeclaration declaration) {
- DeclarationAnnotationAdapter daa = new NestedDeclarationAnnotationAdapter(
- new SimpleDeclarationAnnotationAdapter("annot.Foo"), "value", "annot.Bar");
- NormalAnnotation annotation = (NormalAnnotation) daa.getAnnotation(declaration);
- assertNull(annotation);
- annotation = daa.newNormalAnnotation(declaration);
- this.addMemberValuePair(annotation, "yyy", "test string literal");
- }
-
- public void testNewNormalAnnotation3() throws Exception {
- this.createAnnotationAndMembers("Bar", "String yyy();");
- this.createAnnotationAndMembers("Foo", "annot.Bar nestedAnnotation();");
- ICompilationUnit cu = this.createTestType("@annot.Foo");
- String expected = "@Foo(nestedAnnotation = @Bar(yyy = \"test string literal\"))";
- this.assertSourceDoesNotContain(expected, cu);
- this.idField(cu).edit(new Member.Editor() {
- public void edit(ModifiedDeclaration declaration) {
- NestedDeclarationAnnotationAdapterTests.this.editNewNormalAnnotation3(declaration);
- }
- });
- this.assertSourceContains(expected, cu);
- }
-
- void editNewNormalAnnotation3(ModifiedDeclaration declaration) {
- DeclarationAnnotationAdapter daa = new NestedDeclarationAnnotationAdapter(
- new SimpleDeclarationAnnotationAdapter("annot.Foo"), "nestedAnnotation", "annot.Bar");
- NormalAnnotation annotation = (NormalAnnotation) daa.getAnnotation(declaration);
- assertNull(annotation);
- annotation = daa.newNormalAnnotation(declaration);
- this.addMemberValuePair(annotation, "yyy", "test string literal");
- }
-
- public void testNewNormalAnnotation4() throws Exception {
- this.createAnnotationAndMembers("Bar", "String yyy();");
- this.createAnnotationAndMembers("Foo", "annot.Bar value();");
- ICompilationUnit cu = this.createTestType("@annot.Foo");
- String expected = "@Foo(@Bar(yyy = \"test string literal\"))";
- this.assertSourceDoesNotContain(expected, cu);
- this.idField(cu).edit(new Member.Editor() {
- public void edit(ModifiedDeclaration declaration) {
- NestedDeclarationAnnotationAdapterTests.this.editNewNormalAnnotation4(declaration);
- }
- });
- this.assertSourceContains(expected, cu);
- }
-
- void editNewNormalAnnotation4(ModifiedDeclaration declaration) {
- DeclarationAnnotationAdapter daa = new NestedDeclarationAnnotationAdapter(
- new SimpleDeclarationAnnotationAdapter("annot.Foo"), "value", "annot.Bar");
- NormalAnnotation annotation = (NormalAnnotation) daa.getAnnotation(declaration);
- assertNull(annotation);
- annotation = daa.newNormalAnnotation(declaration);
- this.addMemberValuePair(annotation, "yyy", "test string literal");
- }
-
- public void testNewNormalAnnotation5() throws Exception {
- this.createAnnotationAndMembers("Bar", "String yyy();");
- this.createAnnotationAndMembers("Foo", "annot.Bar nestedAnnotation(); String value();");
- ICompilationUnit cu = this.createTestType("@annot.Foo(\"something\")");
- String expected = "@Foo(value = \"something\", nestedAnnotation = @Bar(yyy = \"test string literal\"))";
- this.assertSourceDoesNotContain(expected, cu);
- this.idField(cu).edit(new Member.Editor() {
- public void edit(ModifiedDeclaration declaration) {
- NestedDeclarationAnnotationAdapterTests.this.editNewNormalAnnotation5(declaration);
- }
- });
- this.assertSourceContains(expected, cu);
- }
-
- void editNewNormalAnnotation5(ModifiedDeclaration declaration) {
- DeclarationAnnotationAdapter daa = new NestedDeclarationAnnotationAdapter(
- new SimpleDeclarationAnnotationAdapter("annot.Foo"), "nestedAnnotation", "annot.Bar");
- NormalAnnotation annotation = (NormalAnnotation) daa.getAnnotation(declaration);
- assertNull(annotation);
- annotation = daa.newNormalAnnotation(declaration);
- this.addMemberValuePair(annotation, "yyy", "test string literal");
- }
-
- public void testNewNormalAnnotation6() throws Exception {
- this.createAnnotationAndMembers("Bar", "String yyy();");
- this.createAnnotationAndMembers("Foo", "Object value();");
- ICompilationUnit cu = this.createTestType("@annot.Foo(\"something\")");
- String expected = "@annot.Foo(@Bar(yyy = \"test string literal\"))";
- this.assertSourceDoesNotContain(expected, cu);
- this.idField(cu).edit(new Member.Editor() {
- public void edit(ModifiedDeclaration declaration) {
- NestedDeclarationAnnotationAdapterTests.this.editNewNormalAnnotation6(declaration);
- }
- });
- this.assertSourceContains(expected, cu);
- }
-
- void editNewNormalAnnotation6(ModifiedDeclaration declaration) {
- DeclarationAnnotationAdapter daa = new NestedDeclarationAnnotationAdapter(
- new SimpleDeclarationAnnotationAdapter("annot.Foo"), "value", "annot.Bar");
- NormalAnnotation annotation = (NormalAnnotation) daa.getAnnotation(declaration);
- assertNull(annotation);
- annotation = daa.newNormalAnnotation(declaration);
- this.addMemberValuePair(annotation, "yyy", "test string literal");
- }
-
- public void testNewNormalAnnotation7() throws Exception {
- this.createAnnotationAndMembers("Bar", "String yyy();");
- this.createAnnotationAndMembers("Foo", "String xxx(); annot.Bar nestedAnnotation();");
- ICompilationUnit cu = this.createTestType("@annot.Foo(xxx=\"something\")");
- String expected = "@annot.Foo(xxx=\"something\", nestedAnnotation = @Bar(yyy = \"test string literal\"))";
- this.assertSourceDoesNotContain(expected, cu);
- this.idField(cu).edit(new Member.Editor() {
- public void edit(ModifiedDeclaration declaration) {
- NestedDeclarationAnnotationAdapterTests.this.editNewNormalAnnotation7(declaration);
- }
- });
- this.assertSourceContains(expected, cu);
- }
-
- void editNewNormalAnnotation7(ModifiedDeclaration declaration) {
- DeclarationAnnotationAdapter daa = new NestedDeclarationAnnotationAdapter(
- new SimpleDeclarationAnnotationAdapter("annot.Foo"), "nestedAnnotation", "annot.Bar");
- NormalAnnotation annotation = (NormalAnnotation) daa.getAnnotation(declaration);
- assertNull(annotation);
- annotation = daa.newNormalAnnotation(declaration);
- this.addMemberValuePair(annotation, "yyy", "test string literal");
- }
-
- public void testNewNormalAnnotation8() throws Exception {
- this.createAnnotationAndMembers("Bar", "String yyy();");
- this.createAnnotationAndMembers("Foo", "String xxx(); annot.Bar value();");
- ICompilationUnit cu = this.createTestType("@annot.Foo(xxx=\"something\")");
- String expected = "@annot.Foo(xxx=\"something\", value = @Bar(yyy = \"test string literal\"))";
- this.assertSourceDoesNotContain(expected, cu);
- this.idField(cu).edit(new Member.Editor() {
- public void edit(ModifiedDeclaration declaration) {
- NestedDeclarationAnnotationAdapterTests.this.editNewNormalAnnotation8(declaration);
- }
- });
- this.assertSourceContains(expected, cu);
- }
-
- void editNewNormalAnnotation8(ModifiedDeclaration declaration) {
- DeclarationAnnotationAdapter daa = new NestedDeclarationAnnotationAdapter(
- new SimpleDeclarationAnnotationAdapter("annot.Foo"), "value", "annot.Bar");
- NormalAnnotation annotation = (NormalAnnotation) daa.getAnnotation(declaration);
- assertNull(annotation);
- annotation = daa.newNormalAnnotation(declaration);
- this.addMemberValuePair(annotation, "yyy", "test string literal");
- }
-
-}
diff --git a/jpa/tests/org.eclipse.jpt.core.tests/src/org/eclipse/jpt/core/tests/internal/utility/jdt/NestedIndexedDeclarationAnnotationAdapterTests.java b/jpa/tests/org.eclipse.jpt.core.tests/src/org/eclipse/jpt/core/tests/internal/utility/jdt/NestedIndexedDeclarationAnnotationAdapterTests.java
deleted file mode 100644
index 383ad73660..0000000000
--- a/jpa/tests/org.eclipse.jpt.core.tests/src/org/eclipse/jpt/core/tests/internal/utility/jdt/NestedIndexedDeclarationAnnotationAdapterTests.java
+++ /dev/null
@@ -1,2229 +0,0 @@
-/*******************************************************************************
- * Copyright (c) 2006, 2009 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.
- *
- * Contributors:
- * Oracle - initial API and implementation
- ******************************************************************************/
-package org.eclipse.jpt.core.tests.internal.utility.jdt;
-
-import org.eclipse.jdt.core.ICompilationUnit;
-import org.eclipse.jdt.core.dom.ASTNode;
-import org.eclipse.jdt.core.dom.Annotation;
-import org.eclipse.jdt.core.dom.CompilationUnit;
-import org.eclipse.jdt.core.dom.NormalAnnotation;
-import org.eclipse.jdt.core.dom.NumberLiteral;
-import org.eclipse.jdt.core.dom.SingleMemberAnnotation;
-import org.eclipse.jpt.core.internal.utility.jdt.MemberAnnotationAdapter;
-import org.eclipse.jpt.core.internal.utility.jdt.MemberIndexedAnnotationAdapter;
-import org.eclipse.jpt.core.internal.utility.jdt.NestedIndexedDeclarationAnnotationAdapter;
-import org.eclipse.jpt.core.internal.utility.jdt.SimpleDeclarationAnnotationAdapter;
-import org.eclipse.jpt.core.utility.jdt.AnnotationAdapter;
-import org.eclipse.jpt.core.utility.jdt.DeclarationAnnotationAdapter;
-import org.eclipse.jpt.core.utility.jdt.IndexedAnnotationAdapter;
-import org.eclipse.jpt.core.utility.jdt.IndexedDeclarationAnnotationAdapter;
-import org.eclipse.jpt.core.utility.jdt.Member;
-import org.eclipse.jpt.core.utility.jdt.ModifiedDeclaration;
-
-@SuppressWarnings("nls")
-public class NestedIndexedDeclarationAnnotationAdapterTests extends AnnotationTestCase {
-
- public NestedIndexedDeclarationAnnotationAdapterTests(String name) {
- super(name);
- }
-
- private void createAnnotation(String annotationName) throws Exception {
- this.createAnnotationAndMembers(annotationName, "");
- }
-
- private void createAnnotationAndMembers(String annotationName, String annotationBody) throws Exception {
- this.javaProject.createCompilationUnit("annot", annotationName + ".java", "public @interface " + annotationName + " { " + annotationBody + " }");
- }
-
- public void testAnnotation1() throws Exception {
- this.createAnnotationAndMembers("Bar", "String value();");
- this.createAnnotationAndMembers("Foo", "annot.Bar[] nestedAnnotations();");
- ICompilationUnit cu = this.createTestType("@annot.Foo(nestedAnnotations={@annot.Bar, @annot.Bar(\"two\")})");
- // 0
- DeclarationAnnotationAdapter daa = new NestedIndexedDeclarationAnnotationAdapter(
- new SimpleDeclarationAnnotationAdapter("annot.Foo"), "nestedAnnotations", 0, "annot.Bar");
- AnnotationAdapter aa = new MemberAnnotationAdapter(this.idField(cu), daa);
- CompilationUnit astRoot = this.buildASTRoot(cu);
- Annotation annotation = aa.getAnnotation(astRoot);
- assertNotNull(annotation);
- assertEquals("annot.Bar", annotation.getTypeName().getFullyQualifiedName());
- assertTrue(annotation.isMarkerAnnotation());
-
- // 1
- daa = new NestedIndexedDeclarationAnnotationAdapter(
- new SimpleDeclarationAnnotationAdapter("annot.Foo"), "nestedAnnotations", 1, "annot.Bar");
- aa = new MemberAnnotationAdapter(this.idField(cu), daa);
- annotation = aa.getAnnotation(astRoot);
- assertNotNull(annotation);
- assertEquals("annot.Bar", annotation.getTypeName().getFullyQualifiedName());
- assertTrue(annotation.isSingleMemberAnnotation());
- }
-
- public void testAnnotation2() throws Exception {
- this.createAnnotation("Baz");
- this.createAnnotationAndMembers("Bar", "annot.Baz[] yana();");
- this.createAnnotationAndMembers("Foo", "annot.Bar[] nestedAnnotations();");
- ICompilationUnit cu = this.createTestType("@annot.Foo(nestedAnnotations=@annot.Bar(yana=@annot.Baz))");
- DeclarationAnnotationAdapter daa1 = new SimpleDeclarationAnnotationAdapter("annot.Foo");
- DeclarationAnnotationAdapter daa2 = new NestedIndexedDeclarationAnnotationAdapter(daa1, "nestedAnnotations", 0, "annot.Bar");
- DeclarationAnnotationAdapter daa3 = new NestedIndexedDeclarationAnnotationAdapter(daa2, "yana", 0, "annot.Baz");
- AnnotationAdapter aa = new MemberAnnotationAdapter(this.idField(cu), daa3);
- Annotation annotation = aa.getAnnotation(this.buildASTRoot(cu));
- assertNotNull(annotation);
- assertEquals("annot.Baz", annotation.getTypeName().getFullyQualifiedName());
- assertTrue(annotation.isMarkerAnnotation());
- }
-
- public void testAnnotation3() throws Exception {
- this.createAnnotation("Baz");
- this.createAnnotationAndMembers("Bar", "annot.Baz[] yana();");
- this.createAnnotationAndMembers("Foo", "annot.Bar[] nestedAnnotations();");
- ICompilationUnit cu = this.createTestType("@annot.Foo(nestedAnnotations=@annot.Bar(yana={@annot.Baz}))");
- DeclarationAnnotationAdapter daa1 = new SimpleDeclarationAnnotationAdapter("annot.Foo");
- DeclarationAnnotationAdapter daa2 = new NestedIndexedDeclarationAnnotationAdapter(daa1, "nestedAnnotations", 0, "annot.Bar");
- DeclarationAnnotationAdapter daa3 = new NestedIndexedDeclarationAnnotationAdapter(daa2, "yana", 0, "annot.Baz");
- AnnotationAdapter aa = new MemberAnnotationAdapter(this.idField(cu), daa3);
- CompilationUnit astRoot = this.buildASTRoot(cu);
- Annotation annotation = aa.getAnnotation(astRoot);
- assertNotNull(annotation);
- assertEquals("annot.Baz", annotation.getTypeName().getFullyQualifiedName());
- assertTrue(annotation.isMarkerAnnotation());
-
- // name mismatch
- daa3 = new NestedIndexedDeclarationAnnotationAdapter(daa2, "yana", 0, "annot.Xyz");
- aa = new MemberAnnotationAdapter(this.idField(cu), daa3);
- annotation = aa.getAnnotation(astRoot);
- assertNull(annotation);
- }
-
- public void testAnnotationNull1() throws Exception {
- this.createAnnotation("Bar");
- this.createAnnotationAndMembers("Foo", "annot.Bar[] nestedAnnotations();");
- ICompilationUnit cu = this.createTestType("@annot.Foo()");
- DeclarationAnnotationAdapter daa = new NestedIndexedDeclarationAnnotationAdapter(
- new SimpleDeclarationAnnotationAdapter("annot.Foo"), "nestedAnnotations", 0, "annot.Bar");
- AnnotationAdapter aa = new MemberAnnotationAdapter(this.idField(cu), daa);
- Annotation annotation = aa.getAnnotation(this.buildASTRoot(cu));
- assertNull(annotation);
- }
-
- public void testAnnotationNull2() throws Exception {
- this.createAnnotation("Bar");
- this.createAnnotationAndMembers("Foo", "annot.Bar[] nestedAnnotations();");
- ICompilationUnit cu = this.createTestType();
- DeclarationAnnotationAdapter daa = new NestedIndexedDeclarationAnnotationAdapter(
- new SimpleDeclarationAnnotationAdapter("annot.Foo"), "nestedAnnotations", 0, "annot.Bar");
- AnnotationAdapter aa = new MemberAnnotationAdapter(this.idField(cu), daa);
- Annotation annotation = aa.getAnnotation(this.buildASTRoot(cu));
- assertNull(annotation);
- }
-
- public void testAnnotationNull3() throws Exception {
- this.createAnnotation("Bar");
- this.createAnnotationAndMembers("Foo", "annot.Bar[] nestedAnnotations();");
- ICompilationUnit cu = this.createTestType("@annot.Foo(nestedAnnotations=\"annot.Bar\")");
- DeclarationAnnotationAdapter daa = new NestedIndexedDeclarationAnnotationAdapter(
- new SimpleDeclarationAnnotationAdapter("annot.Foo"), "nestedAnnotations", 0, "annot.Bar");
- AnnotationAdapter aa = new MemberAnnotationAdapter(this.idField(cu), daa);
- Annotation annotation = aa.getAnnotation(this.buildASTRoot(cu));
- assertNull(annotation);
- }
-
- public void testAnnotationNull4() throws Exception {
- this.createAnnotation("NotBar");
- this.createAnnotation("Bar");
- this.createAnnotationAndMembers("Foo", "annot.Bar[] nestedAnnotations();");
- ICompilationUnit cu = this.createTestType("@annot.Foo(nestedAnnotations=@annot.NotBar)");
- DeclarationAnnotationAdapter daa = new NestedIndexedDeclarationAnnotationAdapter(
- new SimpleDeclarationAnnotationAdapter("annot.Foo"), "nestedAnnotations", 0, "annot.Bar");
- AnnotationAdapter aa = new MemberAnnotationAdapter(this.idField(cu), daa);
- Annotation annotation = aa.getAnnotation(this.buildASTRoot(cu));
- assertNull(annotation);
- }
-
- public void testAnnotationNull5() throws Exception {
- this.createAnnotationAndMembers("Bar", "String value();");
- this.createAnnotationAndMembers("Foo", "annot.Bar[] nestedAnnotations();");
- ICompilationUnit cu = this.createTestType("@annot.Foo(nestedAnnotations={@annot.Bar, @annot.Bar(\"two\")})");
- DeclarationAnnotationAdapter daa = new NestedIndexedDeclarationAnnotationAdapter(
- new SimpleDeclarationAnnotationAdapter("annot.Foo"), "nestedAnnotations", 2, "annot.Bar");
- AnnotationAdapter aa = new MemberAnnotationAdapter(this.idField(cu), daa);
- Annotation annotation = aa.getAnnotation(this.buildASTRoot(cu));
- assertNull(annotation);
- }
-
- public void testAnnotationNull6() throws Exception {
- this.createAnnotation("Xyz");
- this.createAnnotation("Baz");
- this.createAnnotationAndMembers("Bar", "annot.Baz[] yana();");
- this.createAnnotationAndMembers("Foo", "annot.Bar[] nestedAnnotations();");
- ICompilationUnit cu = this.createTestType("@annot.Foo(nestedAnnotations=@annot.Bar(yana={@annot.Baz}))");
- DeclarationAnnotationAdapter daa1 = new SimpleDeclarationAnnotationAdapter("Foo");
- DeclarationAnnotationAdapter daa2 = new NestedIndexedDeclarationAnnotationAdapter(daa1, "nestedAnnotations", 0, "annot.Bar");
- DeclarationAnnotationAdapter daa3 = new NestedIndexedDeclarationAnnotationAdapter(daa2, "yana", 0, "annot.Xyz");
- AnnotationAdapter aa = new MemberAnnotationAdapter(this.idField(cu), daa3);
- Annotation annotation = aa.getAnnotation(this.buildASTRoot(cu));
- assertNull(annotation);
- }
-
- public void testRemoveAnnotation1() throws Exception {
- this.createAnnotationAndMembers("Bar", "int value();");
- this.createAnnotationAndMembers("Foo", "annot.Bar[] nestedAnnotations();");
- String na = "@annot.Foo(nestedAnnotations={@annot.Bar(0), @annot.Bar(1)})";
- String expected = "@annot.Foo(nestedAnnotations={null, @annot.Bar(1)})";
- ICompilationUnit cu = this.createTestType(na);
- this.assertSourceDoesNotContain(expected, cu);
- this.assertSourceContains(na, cu);
-
- DeclarationAnnotationAdapter daa1 = new SimpleDeclarationAnnotationAdapter("annot.Foo");
- DeclarationAnnotationAdapter daa2 = new NestedIndexedDeclarationAnnotationAdapter(daa1, "nestedAnnotations", 0, "annot.Bar");
- AnnotationAdapter aa = new MemberAnnotationAdapter(this.idField(cu), daa2);
- Annotation annotation = aa.getAnnotation(this.buildASTRoot(cu));
- assertNotNull(annotation);
-
- aa.removeAnnotation();
- this.assertSourceDoesNotContain(na, cu);
- this.assertSourceContains(expected, cu);
- }
-
- public void testRemoveAnnotation2() throws Exception {
- this.createAnnotationAndMembers("Bar", "int value();");
- this.createAnnotationAndMembers("Foo", "annot.Bar[] nestedAnnotations();");
- ICompilationUnit cu = this.createTestType();
- this.assertSourceDoesNotContain("Foo", cu);
-
- DeclarationAnnotationAdapter daa = new NestedIndexedDeclarationAnnotationAdapter(
- new SimpleDeclarationAnnotationAdapter("annot.Foo"), "nestedAnnotations", 0, "annot.Bar");
- AnnotationAdapter aa = new MemberAnnotationAdapter(this.idField(cu), daa);
- Annotation annotation = aa.getAnnotation(this.buildASTRoot(cu));
- assertNull(annotation);
-
- aa.removeAnnotation();
- this.assertSourceDoesNotContain("Foo", cu);
- }
-
- public void testRemoveAnnotation3() throws Exception {
- this.createAnnotationAndMembers("Bar", "int value();");
- this.createAnnotationAndMembers("Foo", "String[] nestedAnnotations();");
- String na = "@annot.Foo(nestedAnnotations={\"annot.Bar1\", \"annot.Bar2\", \"annot.Bar3\"})";
- ICompilationUnit cu = this.createTestType(na);
- this.assertSourceContains(na, cu);
-
- DeclarationAnnotationAdapter daa = new NestedIndexedDeclarationAnnotationAdapter(
- new SimpleDeclarationAnnotationAdapter("annot.Foo"), "nestedAnnotations", 0, "annot.Bar");
- AnnotationAdapter aa = new MemberAnnotationAdapter(this.idField(cu), daa);
- Annotation annotation = aa.getAnnotation(this.buildASTRoot(cu));
- assertNull(annotation);
-
- aa.removeAnnotation();
- this.assertSourceContains(na, cu);
- }
-
- public void testRemoveAnnotation4() throws Exception {
- this.createAnnotationAndMembers("NotBar", "int value();");
- this.createAnnotationAndMembers("Bar", "int value();");
- this.createAnnotationAndMembers("Foo", "annot.NotBar[] nestedAnnotations();");
- String na = "@annot.Foo(nestedAnnotations={@annot.NotBar(0), @annot.NotBar(1)})";
- ICompilationUnit cu = this.createTestType(na);
- this.assertSourceContains(na, cu);
-
- DeclarationAnnotationAdapter daa = new NestedIndexedDeclarationAnnotationAdapter(
- new SimpleDeclarationAnnotationAdapter("annot.Foo"), "nestedAnnotations", 0, "annot.Bar");
- AnnotationAdapter aa = new MemberAnnotationAdapter(this.idField(cu), daa);
- Annotation annotation = aa.getAnnotation(this.buildASTRoot(cu));
- assertNull(annotation);
-
- aa.removeAnnotation();
- this.assertSourceContains(na, cu);
- }
-
- public void testRemoveAnnotation5() throws Exception {
- this.createAnnotationAndMembers("Bar", "int value();");
- this.createAnnotationAndMembers("Foo", "annot.Bar[] nestedAnnotations();");
- String na = "@annot.Foo(nestedAnnotations=@annot.Bar)";
- ICompilationUnit cu = this.createTestType(na);
- this.assertSourceContains(na, cu);
-
- DeclarationAnnotationAdapter daa1 = new SimpleDeclarationAnnotationAdapter("annot.Foo");
- DeclarationAnnotationAdapter daa2 = new NestedIndexedDeclarationAnnotationAdapter(daa1, "nestedAnnotations", 0, "annot.Bar");
- AnnotationAdapter aa = new MemberAnnotationAdapter(this.idField(cu), daa2);
- Annotation annotation = aa.getAnnotation(this.buildASTRoot(cu));
- assertNotNull(annotation);
-
- aa.removeAnnotation();
- assertNull(aa.getAnnotation(this.buildASTRoot(cu)));
- this.assertSourceDoesNotContain(na, cu);
- this.assertSourceDoesNotContain("Foo", cu);
- }
-
- public void testRemoveAnnotation5a() throws Exception {
- this.createAnnotationAndMembers("Bar", "int value();");
- this.createAnnotationAndMembers("Foo", "annot.Bar[] nestedAnnotations();");
- String na = "@annot.Foo(nestedAnnotations=@annot.Bar)";
- ICompilationUnit cu = this.createTestType(na);
- this.assertSourceContains(na, cu);
-
- DeclarationAnnotationAdapter daa1 = new SimpleDeclarationAnnotationAdapter("annot.Foo");
- AnnotationAdapter aa1 = new MemberAnnotationAdapter(this.idField(cu), daa1);
- DeclarationAnnotationAdapter daa2 = new NestedIndexedDeclarationAnnotationAdapter(daa1, "nestedAnnotations", 0, "annot.Bar", false);
- AnnotationAdapter aa2 = new MemberAnnotationAdapter(this.idField(cu), daa2);
- Annotation annotation = aa2.getAnnotation(this.buildASTRoot(cu));
- assertNotNull(annotation);
-
- aa2.removeAnnotation();
- assertTrue(aa1.getAnnotation(this.buildASTRoot(cu)).isMarkerAnnotation());
- this.assertSourceDoesNotContain(na, cu);
- this.assertSourceContains("import annot.Foo;", cu);
- this.assertSourceContains("@Foo", cu);
- }
-
- public void testRemoveAnnotation6() throws Exception {
- this.createAnnotationAndMembers("Bar", "int value();");
- this.createAnnotationAndMembers("Foo", "String[] nestedAnnotations();");
- String na = "@annot.Foo(nestedAnnotations=\"annot.Bar\")";
- ICompilationUnit cu = this.createTestType(na);
- this.assertSourceContains(na, cu);
-
- DeclarationAnnotationAdapter daa = new NestedIndexedDeclarationAnnotationAdapter(
- new SimpleDeclarationAnnotationAdapter("annot.Foo"), "nestedAnnotations", 0, "annot.Bar");
- AnnotationAdapter aa = new MemberAnnotationAdapter(this.idField(cu), daa);
- Annotation annotation = aa.getAnnotation(this.buildASTRoot(cu));
- assertNull(annotation);
-
- aa.removeAnnotation();
- this.assertSourceContains(na, cu);
- }
-
- public void testRemoveAnnotation7() throws Exception {
- this.createAnnotationAndMembers("NotBar", "int value();");
- this.createAnnotationAndMembers("Bar", "int value();");
- this.createAnnotationAndMembers("Foo", "annot.NotBar[] nestedAnnotations();");
- String na = "@annot.Foo(nestedAnnotations=@annot.NotBar)";
- ICompilationUnit cu = this.createTestType(na);
- this.assertSourceContains(na, cu);
-
- DeclarationAnnotationAdapter daa = new NestedIndexedDeclarationAnnotationAdapter(
- new SimpleDeclarationAnnotationAdapter("annot.Foo"), "nestedAnnotations", 0, "annot.Bar");
- AnnotationAdapter aa = new MemberAnnotationAdapter(this.idField(cu), daa);
- Annotation annotation = aa.getAnnotation(this.buildASTRoot(cu));
- assertNull(annotation);
-
- aa.removeAnnotation();
- this.assertSourceContains(na, cu);
- }
-
- public void testRemoveAnnotation8() throws Exception {
- this.createAnnotationAndMembers("Bar", "int value();");
- this.createAnnotationAndMembers("Foo", "annot.Bar[] nestedAnnotations();");
- String na = "@annot.Foo(nestedAnnotations={@annot.Bar(0), @annot.Bar(1), @annot.Bar(2), @annot.Bar(3)})";
- ICompilationUnit cu = this.createTestType(na);
- this.assertSourceContains(na, cu);
-
- DeclarationAnnotationAdapter daa1 = new SimpleDeclarationAnnotationAdapter("annot.Foo");
- AnnotationAdapter aa1 = new MemberAnnotationAdapter(this.idField(cu), daa1);
- DeclarationAnnotationAdapter daa2 = new NestedIndexedDeclarationAnnotationAdapter(daa1, "nestedAnnotations", 2, "annot.Bar");
- AnnotationAdapter aa2 = new MemberAnnotationAdapter(this.idField(cu), daa2);
- CompilationUnit astRoot = this.buildASTRoot(cu);
- Annotation annotation = aa2.getAnnotation(astRoot);
- assertNotNull(annotation);
-
- aa2.removeAnnotation();
- assertTrue(aa1.getAnnotation(astRoot).isNormalAnnotation());
- assertEquals(ASTNode.ARRAY_INITIALIZER, this.annotationElementValue(aa1.getAnnotation(astRoot), "nestedAnnotations").getNodeType());
- this.assertSourceDoesNotContain(na, cu);
- this.assertSourceContains("@annot.Foo(nestedAnnotations={@annot.Bar(0), @annot.Bar(1), null, @annot.Bar(3)})", cu);
- }
-
- public void testRemoveAnnotation9() throws Exception {
- this.createAnnotationAndMembers("Bar", "int value();");
- this.createAnnotationAndMembers("Foo", "annot.Bar[] value();");
- String na = "@annot.Foo({@annot.Bar(0), @annot.Bar(1), @annot.Bar(2), @annot.Bar(3)})";
- ICompilationUnit cu = this.createTestType(na);
- this.assertSourceContains(na, cu);
-
- DeclarationAnnotationAdapter daa1 = new SimpleDeclarationAnnotationAdapter("annot.Foo");
- AnnotationAdapter aa1 = new MemberAnnotationAdapter(this.idField(cu), daa1);
- DeclarationAnnotationAdapter daa2 = new NestedIndexedDeclarationAnnotationAdapter(daa1, "value", 2, "annot.Bar");
- AnnotationAdapter aa2 = new MemberAnnotationAdapter(this.idField(cu), daa2);
- CompilationUnit astRoot = this.buildASTRoot(cu);
- Annotation annotation = aa2.getAnnotation(astRoot);
- assertNotNull(annotation);
-
- aa2.removeAnnotation();
- assertTrue(aa1.getAnnotation(astRoot).isSingleMemberAnnotation());
- assertEquals(ASTNode.ARRAY_INITIALIZER, this.annotationElementValue(aa1.getAnnotation(astRoot), "value").getNodeType());
- this.assertSourceDoesNotContain(na, cu);
- this.assertSourceContains("@annot.Foo({@annot.Bar(0), @annot.Bar(1), null, @annot.Bar(3)})", cu);
- }
-
- public void testRemoveAnnotation10() throws Exception {
- this.createAnnotationAndMembers("Bar", "int value();");
- this.createAnnotationAndMembers("Foo", "annot.Bar[] value();");
- String na = "@annot.Foo({@annot.Bar(0), @annot.Bar(1)})";
- String expected = "@annot.Foo({null, @annot.Bar(1)})";
- ICompilationUnit cu = this.createTestType(na);
- this.assertSourceDoesNotContain(expected, cu);
- this.assertSourceContains(na, cu);
-
- DeclarationAnnotationAdapter daa1 = new SimpleDeclarationAnnotationAdapter("annot.Foo");
- DeclarationAnnotationAdapter daa2 = new NestedIndexedDeclarationAnnotationAdapter(daa1, "value", 0, "annot.Bar");
- AnnotationAdapter aa2 = new MemberAnnotationAdapter(this.idField(cu), daa2);
- Annotation annotation = aa2.getAnnotation(this.buildASTRoot(cu));
- assertNotNull(annotation);
-
- aa2.removeAnnotation();
- this.assertSourceDoesNotContain(na, cu);
- this.assertSourceContains(expected, cu);
- }
-
- public void testRemoveAnnotation11() throws Exception {
- this.createAnnotationAndMembers("Bar", "int value();");
- this.createAnnotationAndMembers("Foo", "annot.Bar[] value();");
- String na = "@annot.Foo({@annot.Bar(0), @annot.Bar(1)})";
- String expected = "@annot.Foo(@annot.Bar(0))";
- ICompilationUnit cu = this.createTestType(na);
- this.assertSourceDoesNotContain(expected, cu);
- this.assertSourceContains(na, cu);
-
- DeclarationAnnotationAdapter daa1 = new SimpleDeclarationAnnotationAdapter("annot.Foo");
- AnnotationAdapter aa1 = new MemberAnnotationAdapter(this.idField(cu), daa1);
- DeclarationAnnotationAdapter daa2 = new NestedIndexedDeclarationAnnotationAdapter(daa1, "value", 1, "annot.Bar");
- AnnotationAdapter aa2 = new MemberAnnotationAdapter(this.idField(cu), daa2);
- Annotation annotation = aa2.getAnnotation(this.buildASTRoot(cu));
- assertNotNull(annotation);
-
- aa2.removeAnnotation();
- assertEquals(ASTNode.SINGLE_MEMBER_ANNOTATION, this.annotationElementValue(aa1.getAnnotation(this.buildASTRoot(cu)), "value").getNodeType());
- this.assertSourceDoesNotContain(na, cu);
- this.assertSourceContains(expected, cu);
- }
-
- public void testRemoveAnnotation12() throws Exception {
- this.createAnnotationAndMembers("Bar", "int value();");
- this.createAnnotationAndMembers("Foo", "annot.Bar[] value();");
- String na = "@annot.Foo({@annot.Bar(0), null, @annot.Bar(2)})";
- String expected = "@annot.Foo(@annot.Bar(0))";
- ICompilationUnit cu = this.createTestType(na);
- this.assertSourceDoesNotContain(expected, cu);
- this.assertSourceContains(na, cu);
-
- DeclarationAnnotationAdapter daa1 = new SimpleDeclarationAnnotationAdapter("annot.Foo");
- AnnotationAdapter aa1 = new MemberAnnotationAdapter(this.idField(cu), daa1);
- DeclarationAnnotationAdapter daa2 = new NestedIndexedDeclarationAnnotationAdapter(daa1, "value", 2, "annot.Bar");
- AnnotationAdapter aa2 = new MemberAnnotationAdapter(this.idField(cu), daa2);
- Annotation annotation = aa2.getAnnotation(this.buildASTRoot(cu));
- assertNotNull(annotation);
-
- aa2.removeAnnotation();
- assertEquals(ASTNode.SINGLE_MEMBER_ANNOTATION, this.annotationElementValue(aa1.getAnnotation(this.buildASTRoot(cu)), "value").getNodeType());
- this.assertSourceDoesNotContain(na, cu);
- this.assertSourceContains(expected, cu);
- }
-
- public void testRemoveAnnotation13() throws Exception {
- this.createAnnotationAndMembers("Bar", "int value();");
- this.createAnnotationAndMembers("Foo", "annot.Bar[] value();");
- String na = "@annot.Foo({null, @annot.Bar(1)})";
- ICompilationUnit cu = this.createTestType(na);
- this.assertSourceContains(na, cu);
-
- DeclarationAnnotationAdapter daa1 = new SimpleDeclarationAnnotationAdapter("annot.Foo");
- DeclarationAnnotationAdapter daa2 = new NestedIndexedDeclarationAnnotationAdapter(daa1, "value", 1, "annot.Bar");
- AnnotationAdapter aa2 = new MemberAnnotationAdapter(this.idField(cu), daa2);
- Annotation annotation = aa2.getAnnotation(this.buildASTRoot(cu));
- assertNotNull(annotation);
-
- aa2.removeAnnotation();
- this.assertSourceDoesNotContain("Foo", cu);
- }
-
- public void testRemoveAnnotation14() throws Exception {
- this.createAnnotationAndMembers("Bar", "int value();");
- this.createAnnotationAndMembers("Foo", "annot.Bar[] value();");
- String na = "@annot.Foo({@annot.Bar(0), null, @annot.Bar(2), null})";
- String expected = "@annot.Foo(@annot.Bar(0))";
- ICompilationUnit cu = this.createTestType(na);
- this.assertSourceDoesNotContain(expected, cu);
- this.assertSourceContains(na, cu);
-
- DeclarationAnnotationAdapter daa1 = new SimpleDeclarationAnnotationAdapter("annot.Foo");
- AnnotationAdapter aa1 = new MemberAnnotationAdapter(this.idField(cu), daa1);
- DeclarationAnnotationAdapter daa2 = new NestedIndexedDeclarationAnnotationAdapter(daa1, "value", 2, "annot.Bar");
- AnnotationAdapter aa2 = new MemberAnnotationAdapter(this.idField(cu), daa2);
- Annotation annotation = aa2.getAnnotation(this.buildASTRoot(cu));
- assertNotNull(annotation);
-
- aa2.removeAnnotation();
- assertEquals(ASTNode.SINGLE_MEMBER_ANNOTATION, this.annotationElementValue(aa1.getAnnotation(this.buildASTRoot(cu)), "value").getNodeType());
- this.assertSourceDoesNotContain(na, cu);
- this.assertSourceContains(expected, cu);
- }
-
- public void testRemoveAnnotation15() throws Exception {
- this.createAnnotationAndMembers("Bar", "int value();");
- this.createAnnotationAndMembers("Foo", "annot.Bar[] value();");
- String na = "@annot.Foo({@annot.Bar(0), null, @annot.Bar(2), @annot.Bar(3)})";
- String expected = "@annot.Foo({@annot.Bar(0), null, null, @annot.Bar(3)})";
- ICompilationUnit cu = this.createTestType(na);
- this.assertSourceDoesNotContain(expected, cu);
- this.assertSourceContains(na, cu);
-
- DeclarationAnnotationAdapter daa1 = new SimpleDeclarationAnnotationAdapter("annot.Foo");
- AnnotationAdapter aa1 = new MemberAnnotationAdapter(this.idField(cu), daa1);
- DeclarationAnnotationAdapter daa2 = new NestedIndexedDeclarationAnnotationAdapter(daa1, "value", 2, "annot.Bar");
- AnnotationAdapter aa2 = new MemberAnnotationAdapter(this.idField(cu), daa2);
- CompilationUnit astRoot = this.buildASTRoot(cu);
- Annotation annotation = aa2.getAnnotation(astRoot);
- assertNotNull(annotation);
-
- aa2.removeAnnotation();
- assertEquals(ASTNode.ARRAY_INITIALIZER, this.annotationElementValue(aa1.getAnnotation(astRoot), "value").getNodeType());
- this.assertSourceDoesNotContain(na, cu);
- this.assertSourceContains(expected, cu);
- }
-
- public void testRemoveAnnotation16() throws Exception {
- this.createAnnotationAndMembers("Bar", "int value();");
- this.createAnnotationAndMembers("Foo", "annot.Bar[] value();");
- String na = "@annot.Foo({@annot.Bar(0), null, @annot.Bar(2), @annot.Bar(3)})";
- String expected = "@annot.Foo({@annot.Bar(0), null, @annot.Bar(2)})";
- ICompilationUnit cu = this.createTestType(na);
- this.assertSourceDoesNotContain(expected, cu);
- this.assertSourceContains(na, cu);
-
- DeclarationAnnotationAdapter daa1 = new SimpleDeclarationAnnotationAdapter("annot.Foo");
- AnnotationAdapter aa1 = new MemberAnnotationAdapter(this.idField(cu), daa1);
- DeclarationAnnotationAdapter daa2 = new NestedIndexedDeclarationAnnotationAdapter(daa1, "value", 3, "annot.Bar");
- AnnotationAdapter aa2 = new MemberAnnotationAdapter(this.idField(cu), daa2);
- CompilationUnit astRoot = this.buildASTRoot(cu);
- Annotation annotation = aa2.getAnnotation(astRoot);
- assertNotNull(annotation);
-
- aa2.removeAnnotation();
- assertEquals(ASTNode.ARRAY_INITIALIZER, this.annotationElementValue(aa1.getAnnotation(astRoot), "value").getNodeType());
- this.assertSourceDoesNotContain(na, cu);
- this.assertSourceContains(expected, cu);
- }
-
- public void testRemoveAnnotation17() throws Exception {
- this.createAnnotationAndMembers("Bar", "int value();");
- this.createAnnotationAndMembers("Foo", "annot.Bar[] nestedAnnotations();");
- String na = "@annot.Foo(nestedAnnotations={@annot.Bar(0), null, @annot.Bar(2)})";
- String expected = "@annot.Foo(nestedAnnotations=@annot.Bar(0))";
- ICompilationUnit cu = this.createTestType(na);
- this.assertSourceDoesNotContain(expected, cu);
- this.assertSourceContains(na, cu);
-
- DeclarationAnnotationAdapter daa1 = new SimpleDeclarationAnnotationAdapter("annot.Foo");
- AnnotationAdapter aa1 = new MemberAnnotationAdapter(this.idField(cu), daa1);
- DeclarationAnnotationAdapter daa2 = new NestedIndexedDeclarationAnnotationAdapter(daa1, "nestedAnnotations", 2, "annot.Bar");
- AnnotationAdapter aa2 = new MemberAnnotationAdapter(this.idField(cu), daa2);
- Annotation annotation = aa2.getAnnotation(this.buildASTRoot(cu));
- assertNotNull(annotation);
-
- aa2.removeAnnotation();
- assertEquals(ASTNode.SINGLE_MEMBER_ANNOTATION, this.annotationElementValue(aa1.getAnnotation(this.buildASTRoot(cu)), "nestedAnnotations").getNodeType());
- this.assertSourceDoesNotContain(na, cu);
- this.assertSourceContains(expected, cu);
- }
-
- public void testRemoveAnnotation18() throws Exception {
- this.createAnnotationAndMembers("Bar", "int value();");
- this.createAnnotationAndMembers("Foo", "annot.Bar[] nestedAnnotations();");
- String na = "@annot.Foo(nestedAnnotations={null, @annot.Bar(1)})";
- ICompilationUnit cu = this.createTestType(na);
- this.assertSourceContains(na, cu);
-
- DeclarationAnnotationAdapter daa1 = new SimpleDeclarationAnnotationAdapter("annot.Foo");
- DeclarationAnnotationAdapter daa2 = new NestedIndexedDeclarationAnnotationAdapter(daa1, "nestedAnnotations", 1, "annot.Bar");
- AnnotationAdapter aa2 = new MemberAnnotationAdapter(this.idField(cu), daa2);
- Annotation annotation = aa2.getAnnotation(this.buildASTRoot(cu));
- assertNotNull(annotation);
-
- aa2.removeAnnotation();
- this.assertSourceDoesNotContain("Foo", cu);
- }
-
- public void testRemoveAnnotation19() throws Exception {
- this.createAnnotationAndMembers("Bar", "int value();");
- this.createAnnotationAndMembers("Foo", "annot.Bar[] nestedAnnotations();");
- String na = "@annot.Foo(nestedAnnotations={@annot.Bar(0), null, @annot.Bar(2), null})";
- String expected = "@annot.Foo(nestedAnnotations=@annot.Bar(0))";
- ICompilationUnit cu = this.createTestType(na);
- this.assertSourceDoesNotContain(expected, cu);
- this.assertSourceContains(na, cu);
-
- DeclarationAnnotationAdapter daa1 = new SimpleDeclarationAnnotationAdapter("annot.Foo");
- AnnotationAdapter aa1 = new MemberAnnotationAdapter(this.idField(cu), daa1);
- DeclarationAnnotationAdapter daa2 = new NestedIndexedDeclarationAnnotationAdapter(daa1, "nestedAnnotations", 2, "annot.Bar");
- AnnotationAdapter aa2 = new MemberAnnotationAdapter(this.idField(cu), daa2);
- Annotation annotation = aa2.getAnnotation(this.buildASTRoot(cu));
- assertNotNull(annotation);
-
- aa2.removeAnnotation();
- assertEquals(ASTNode.SINGLE_MEMBER_ANNOTATION, this.annotationElementValue(aa1.getAnnotation(this.buildASTRoot(cu)), "nestedAnnotations").getNodeType());
- this.assertSourceDoesNotContain(na, cu);
- this.assertSourceContains(expected, cu);
- }
-
- public void testRemoveAnnotation20() throws Exception {
- this.createAnnotationAndMembers("Bar", "int value();");
- this.createAnnotationAndMembers("Foo", "annot.Bar[] nestedAnnotations();");
- String na = "@annot.Foo(nestedAnnotations={@annot.Bar(0), null, @annot.Bar(2), @annot.Bar(3)})";
- String expected = "@annot.Foo(nestedAnnotations={@annot.Bar(0), null, null, @annot.Bar(3)})";
- ICompilationUnit cu = this.createTestType(na);
- this.assertSourceDoesNotContain(expected, cu);
- this.assertSourceContains(na, cu);
-
- DeclarationAnnotationAdapter daa1 = new SimpleDeclarationAnnotationAdapter("annot.Foo");
- AnnotationAdapter aa1 = new MemberAnnotationAdapter(this.idField(cu), daa1);
- DeclarationAnnotationAdapter daa2 = new NestedIndexedDeclarationAnnotationAdapter(daa1, "nestedAnnotations", 2, "annot.Bar");
- AnnotationAdapter aa2 = new MemberAnnotationAdapter(this.idField(cu), daa2);
- CompilationUnit astRoot = this.buildASTRoot(cu);
- Annotation annotation = aa2.getAnnotation(astRoot);
- assertNotNull(annotation);
-
- aa2.removeAnnotation();
- assertEquals(ASTNode.ARRAY_INITIALIZER, this.annotationElementValue(aa1.getAnnotation(astRoot), "nestedAnnotations").getNodeType());
- this.assertSourceDoesNotContain(na, cu);
- this.assertSourceContains(expected, cu);
- }
-
- public void testRemoveAnnotation21() throws Exception {
- this.createAnnotationAndMembers("Bar", "int value();");
- this.createAnnotationAndMembers("Foo", "annot.Bar[] nestedAnnotations();");
- String na = "@annot.Foo(nestedAnnotations={@annot.Bar(0), null, @annot.Bar(2), @annot.Bar(3)})";
- String expected = "@annot.Foo(nestedAnnotations={@annot.Bar(0), null, @annot.Bar(2)})";
- ICompilationUnit cu = this.createTestType(na);
- this.assertSourceDoesNotContain(expected, cu);
- this.assertSourceContains(na, cu);
-
- DeclarationAnnotationAdapter daa1 = new SimpleDeclarationAnnotationAdapter("annot.Foo");
- AnnotationAdapter aa1 = new MemberAnnotationAdapter(this.idField(cu), daa1);
- DeclarationAnnotationAdapter daa2 = new NestedIndexedDeclarationAnnotationAdapter(daa1, "nestedAnnotations", 3, "annot.Bar");
- AnnotationAdapter aa2 = new MemberAnnotationAdapter(this.idField(cu), daa2);
- CompilationUnit astRoot = this.buildASTRoot(cu);
- Annotation annotation = aa2.getAnnotation(astRoot);
- assertNotNull(annotation);
-
- aa2.removeAnnotation();
- assertEquals(ASTNode.ARRAY_INITIALIZER, this.annotationElementValue(aa1.getAnnotation(astRoot), "nestedAnnotations").getNodeType());
- this.assertSourceDoesNotContain(na, cu);
- this.assertSourceContains(expected, cu);
- }
-
- public void testNewMarkerAnnotation1() throws Exception {
- this.createAnnotationAndMembers("Bar", "int value();");
- this.createAnnotationAndMembers("Foo", "annot.Bar[] nestedAnnotations();");
- ICompilationUnit cu = this.createTestType();
- this.assertSourceDoesNotContain("Foo", cu);
-
- DeclarationAnnotationAdapter daa = new NestedIndexedDeclarationAnnotationAdapter(
- new SimpleDeclarationAnnotationAdapter("annot.Foo"), "nestedAnnotations", 0, "annot.Bar");
- AnnotationAdapter aa = new MemberAnnotationAdapter(this.idField(cu), daa);
- Annotation annotation = aa.getAnnotation(this.buildASTRoot(cu));
- assertNull(annotation);
-
- aa.newMarkerAnnotation();
- this.assertSourceContains("@Foo(nestedAnnotations = @Bar)", cu);
- }
-
- public void testNewMarkerAnnotation2() throws Exception {
- this.createAnnotationAndMembers("Bar", "int value();");
- this.createAnnotationAndMembers("Foo", "annot.Bar[] value();");
- ICompilationUnit cu = this.createTestType();
- this.assertSourceDoesNotContain("Foo", cu);
-
- DeclarationAnnotationAdapter daa = new NestedIndexedDeclarationAnnotationAdapter(
- new SimpleDeclarationAnnotationAdapter("annot.Foo"), "value", 0, "annot.Bar");
- AnnotationAdapter aa = new MemberAnnotationAdapter(this.idField(cu), daa);
- Annotation annotation = aa.getAnnotation(this.buildASTRoot(cu));
- assertNull(annotation);
-
- aa.newMarkerAnnotation();
- this.assertSourceContains("@Foo(@Bar)", cu);
- }
-
- public void testNewMarkerAnnotation3() throws Exception {
- this.createAnnotationAndMembers("Bar", "int value();");
- this.createAnnotationAndMembers("Foo", "annot.Bar[] nestedAnnotations();");
- ICompilationUnit cu = this.createTestType("@annot.Foo");
- String expected = "@Foo(nestedAnnotations = @Bar)";
- this.assertSourceDoesNotContain(expected, cu);
-
- DeclarationAnnotationAdapter daa = new NestedIndexedDeclarationAnnotationAdapter(
- new SimpleDeclarationAnnotationAdapter("annot.Foo"), "nestedAnnotations", 0, "annot.Bar");
- AnnotationAdapter aa = new MemberAnnotationAdapter(this.idField(cu), daa);
- Annotation annotation = aa.getAnnotation(this.buildASTRoot(cu));
- assertNull(annotation);
-
- aa.newMarkerAnnotation();
- this.assertSourceContains(expected, cu);
- }
-
- public void testNewMarkerAnnotation4() throws Exception {
- this.createAnnotationAndMembers("Bar", "int value();");
- this.createAnnotationAndMembers("Foo", "annot.Bar[] value();");
- ICompilationUnit cu = this.createTestType("@annot.Foo");
- String expected = "@Foo(@Bar)";
- this.assertSourceDoesNotContain(expected, cu);
-
- DeclarationAnnotationAdapter daa = new NestedIndexedDeclarationAnnotationAdapter(
- new SimpleDeclarationAnnotationAdapter("annot.Foo"), "value", 0, "annot.Bar");
- AnnotationAdapter aa = new MemberAnnotationAdapter(this.idField(cu), daa);
- Annotation annotation = aa.getAnnotation(this.buildASTRoot(cu));
- assertNull(annotation);
-
- aa.newMarkerAnnotation();
- this.assertSourceContains(expected, cu);
- }
-
- public void testNewMarkerAnnotation5() throws Exception {
- this.createAnnotationAndMembers("Bar", "int value();");
- this.createAnnotationAndMembers("Foo", "String value(); annot.Bar[] nestedAnnotations();");
- ICompilationUnit cu = this.createTestType("@annot.Foo(\"something\")");
- String expected = "@Foo(value = \"something\", nestedAnnotations = @Bar)";
- this.assertSourceDoesNotContain(expected, cu);
-
- DeclarationAnnotationAdapter daa = new NestedIndexedDeclarationAnnotationAdapter(
- new SimpleDeclarationAnnotationAdapter("annot.Foo"), "nestedAnnotations", 0, "annot.Bar");
- AnnotationAdapter aa = new MemberAnnotationAdapter(this.idField(cu), daa);
- Annotation annotation = aa.getAnnotation(this.buildASTRoot(cu));
- assertNull(annotation);
-
- aa.newMarkerAnnotation();
- this.assertSourceContains(expected, cu);
- }
-
- public void testNewMarkerAnnotation6() throws Exception {
- this.createAnnotationAndMembers("Bar", "int value();");
- this.createAnnotationAndMembers("Foo", "annot.Bar[] value();");
- ICompilationUnit cu = this.createTestType("@annot.Foo(\"something\")");
- String expected = "@annot.Foo(@Bar)";
- this.assertSourceDoesNotContain(expected, cu);
-
- DeclarationAnnotationAdapter daa = new NestedIndexedDeclarationAnnotationAdapter(
- new SimpleDeclarationAnnotationAdapter("annot.Foo"), "value", 0, "annot.Bar");
- AnnotationAdapter aa = new MemberAnnotationAdapter(this.idField(cu), daa);
- Annotation annotation = aa.getAnnotation(this.buildASTRoot(cu));
- assertNull(annotation);
-
- aa.newMarkerAnnotation();
- this.assertSourceContains(expected, cu);
- }
-
- public void testNewMarkerAnnotation7() throws Exception {
- this.createAnnotationAndMembers("Bar", "int value();");
- this.createAnnotationAndMembers("Foo", "String xxx(); annot.Bar[] nestedAnnotations();");
- ICompilationUnit cu = this.createTestType("@annot.Foo(xxx=\"something\")");
- String expected = "@annot.Foo(xxx=\"something\", nestedAnnotations = @Bar)";
- this.assertSourceDoesNotContain(expected, cu);
-
- DeclarationAnnotationAdapter daa = new NestedIndexedDeclarationAnnotationAdapter(
- new SimpleDeclarationAnnotationAdapter("annot.Foo"), "nestedAnnotations", 0, "annot.Bar");
- AnnotationAdapter aa = new MemberAnnotationAdapter(this.idField(cu), daa);
- Annotation annotation = aa.getAnnotation(this.buildASTRoot(cu));
- assertNull(annotation);
-
- aa.newMarkerAnnotation();
- this.assertSourceContains(expected, cu);
- }
-
- public void testNewMarkerAnnotation8() throws Exception {
- this.createAnnotationAndMembers("Bar", "int value();");
- this.createAnnotationAndMembers("Foo", "String xxx(); annot.Bar[] value();");
- ICompilationUnit cu = this.createTestType("@annot.Foo(xxx=\"something\")");
- String expected = "@annot.Foo(xxx=\"something\", value = @Bar)";
- this.assertSourceDoesNotContain(expected, cu);
-
- DeclarationAnnotationAdapter daa = new NestedIndexedDeclarationAnnotationAdapter(
- new SimpleDeclarationAnnotationAdapter("annot.Foo"), "value", 0, "annot.Bar");
- AnnotationAdapter aa = new MemberAnnotationAdapter(this.idField(cu), daa);
- Annotation annotation = aa.getAnnotation(this.buildASTRoot(cu));
- assertNull(annotation);
-
- aa.newMarkerAnnotation();
- this.assertSourceContains(expected, cu);
- }
-
- public void testNewMarkerAnnotation9() throws Exception {
- this.createAnnotationAndMembers("Bar", "int value();");
- this.createAnnotationAndMembers("Foo", "annot.Bar[] nestedAnnotations();");
- ICompilationUnit cu = this.createTestType();
-
- DeclarationAnnotationAdapter daa = new NestedIndexedDeclarationAnnotationAdapter(
- new SimpleDeclarationAnnotationAdapter("annot.Foo"), "nestedAnnotations", 5, "annot.Bar");
- AnnotationAdapter aa = new MemberAnnotationAdapter(this.idField(cu), daa);
- assertNull(aa.getAnnotation(this.buildASTRoot(cu)));
-
- aa.newMarkerAnnotation();
- this.assertSourceContains("@Foo(nestedAnnotations = { null, null, null, null, null, @Bar })", cu);
- }
-
- public void testNewMarkerAnnotation10() throws Exception {
- this.createAnnotationAndMembers("Bar", "int value();");
- this.createAnnotationAndMembers("Foo", "String value(); annot.Bar[] nestedAnnotations();");
- ICompilationUnit cu = this.createTestType("@annot.Foo(\"something\")");
- String expected1 = "@Foo(value = \"something\", nestedAnnotations = { null, null, null, null,";
- String expected2 = "null, @Bar })";
- this.assertSourceDoesNotContain("Bar", cu);
-
- DeclarationAnnotationAdapter daa = new NestedIndexedDeclarationAnnotationAdapter(
- new SimpleDeclarationAnnotationAdapter("annot.Foo"), "nestedAnnotations", 5, "annot.Bar");
- AnnotationAdapter aa = new MemberAnnotationAdapter(this.idField(cu), daa);
- Annotation annotation = aa.getAnnotation(this.buildASTRoot(cu));
- assertNull(annotation);
-
- aa.newMarkerAnnotation();
- this.assertSourceContains(expected1, cu);
- this.assertSourceContains(expected2, cu);
- }
-
- public void testNewMarkerAnnotation11() throws Exception {
- this.createAnnotationAndMembers("Bar", "int value();");
- this.createAnnotationAndMembers("Foo", "Object[] value();");
- ICompilationUnit cu = this.createTestType("@annot.Foo({\"one\", \"two\"})");
- String expected = "@annot.Foo({@Bar, \"two\"})";
- this.assertSourceDoesNotContain(expected, cu);
-
- DeclarationAnnotationAdapter daa = new NestedIndexedDeclarationAnnotationAdapter(
- new SimpleDeclarationAnnotationAdapter("annot.Foo"), "value", 0, "annot.Bar");
- AnnotationAdapter aa = new MemberAnnotationAdapter(this.idField(cu), daa);
- Annotation annotation = aa.getAnnotation(this.buildASTRoot(cu));
- assertNull(annotation);
-
- aa.newMarkerAnnotation();
- this.assertSourceContains(expected, cu);
- }
-
- public void testNewMarkerAnnotation12() throws Exception {
- this.createAnnotationAndMembers("Bar", "int value();");
- this.createAnnotationAndMembers("Foo", "Object[] value();");
- ICompilationUnit cu = this.createTestType("@annot.Foo({\"one\", \"two\"})");
- this.assertSourceDoesNotContain("Bar", cu);
-
- DeclarationAnnotationAdapter daa = new NestedIndexedDeclarationAnnotationAdapter(
- new SimpleDeclarationAnnotationAdapter("annot.Foo"), "value", 5, "annot.Bar");
- AnnotationAdapter aa = new MemberAnnotationAdapter(this.idField(cu), daa);
- Annotation annotation = aa.getAnnotation(this.buildASTRoot(cu));
- assertNull(annotation);
-
- aa.newMarkerAnnotation();
- this.assertSourceContains("Bar})", cu); // split line
- }
-
- public void testNewMarkerAnnotation13() throws Exception {
- this.createAnnotationAndMembers("Bar", "int value();");
- this.createAnnotationAndMembers("Foo", "annot.Bar[] value();");
- ICompilationUnit cu = this.createTestType("@annot.Foo(7)");
- String expected = "@annot.Foo(@Bar)";
- this.assertSourceDoesNotContain(expected, cu);
-
- DeclarationAnnotationAdapter daa = new NestedIndexedDeclarationAnnotationAdapter(
- new SimpleDeclarationAnnotationAdapter("annot.Foo"), "value", 0, "annot.Bar");
- AnnotationAdapter aa = new MemberAnnotationAdapter(this.idField(cu), daa);
- Annotation annotation = aa.getAnnotation(this.buildASTRoot(cu));
- assertNull(annotation);
-
- aa.newMarkerAnnotation();
- this.assertSourceContains(expected, cu);
- }
-
- public void testNewMarkerAnnotation14() throws Exception {
- this.createAnnotationAndMembers("Bar", "int value();");
- this.createAnnotationAndMembers("Foo", "annot.Bar[] value();");
- ICompilationUnit cu = this.createTestType("@annot.Foo(7)");
- this.assertSourceDoesNotContain("Bar", cu);
-
- DeclarationAnnotationAdapter daa = new NestedIndexedDeclarationAnnotationAdapter(
- new SimpleDeclarationAnnotationAdapter("annot.Foo"), "value", 5, "annot.Bar");
- AnnotationAdapter aa = new MemberAnnotationAdapter(this.idField(cu), daa);
- Annotation annotation = aa.getAnnotation(this.buildASTRoot(cu));
- assertNull(annotation);
-
- aa.newMarkerAnnotation();
- this.assertSourceContains("@annot.Foo({7,null,null,null,null,@Bar})", cu);
- }
-
- public void testNewMarkerAnnotation15() throws Exception {
- this.createAnnotationAndMembers("NotBar", "int value();");
- this.createAnnotationAndMembers("Bar", "int value();");
- this.createAnnotationAndMembers("Foo", "annot.Bar[] value();");
- ICompilationUnit cu = this.createTestType("@annot.Foo(@annot.NotBar)");
- String expected = "@annot.Foo(@Bar)";
- this.assertSourceDoesNotContain(expected, cu);
-
- DeclarationAnnotationAdapter daa = new NestedIndexedDeclarationAnnotationAdapter(
- new SimpleDeclarationAnnotationAdapter("annot.Foo"), "value", 0, "annot.Bar");
- AnnotationAdapter aa = new MemberAnnotationAdapter(this.idField(cu), daa);
- Annotation annotation = aa.getAnnotation(this.buildASTRoot(cu));
- assertNull(annotation);
-
- aa.newMarkerAnnotation();
- this.assertSourceContains(expected, cu);
- }
-
- public void testNewMarkerAnnotation16() throws Exception {
- this.createAnnotationAndMembers("Bar", "int value();");
- this.createAnnotationAndMembers("Foo", "annot.Bar[] value();");
- ICompilationUnit cu = this.createTestType("@annot.Foo(@annot.Bar(55))");
- String expected = "@annot.Foo({@annot.Bar(55),@Bar})";
- this.assertSourceDoesNotContain(expected, cu);
-
- DeclarationAnnotationAdapter daa = new NestedIndexedDeclarationAnnotationAdapter(
- new SimpleDeclarationAnnotationAdapter("annot.Foo"), "value", 1, "annot.Bar");
- AnnotationAdapter aa = new MemberAnnotationAdapter(this.idField(cu), daa);
- Annotation annotation = aa.getAnnotation(this.buildASTRoot(cu));
- assertNull(annotation);
-
- aa.newMarkerAnnotation();
- this.assertSourceContains(expected, cu);
- }
-
- public void testNewMarkerAnnotation17() throws Exception {
- this.createAnnotationAndMembers("Bar", "int value();");
- this.createAnnotationAndMembers("Foo", "annot.Bar[] nestedAnnotations();");
- ICompilationUnit cu = this.createTestType("@annot.Foo(nestedAnnotations={\"something\"})");
- String expected = "@annot.Foo(nestedAnnotations={@Bar})";
- this.assertSourceDoesNotContain(expected, cu);
-
- DeclarationAnnotationAdapter daa = new NestedIndexedDeclarationAnnotationAdapter(
- new SimpleDeclarationAnnotationAdapter("annot.Foo"), "nestedAnnotations", 0, "annot.Bar");
- AnnotationAdapter aa = new MemberAnnotationAdapter(this.idField(cu), daa);
- Annotation annotation = aa.getAnnotation(this.buildASTRoot(cu));
- assertNull(annotation);
-
- aa.newMarkerAnnotation();
- this.assertSourceContains(expected, cu);
- }
-
- public void testNewMarkerAnnotation18() throws Exception {
- this.createAnnotationAndMembers("Bar", "int value();");
- this.createAnnotationAndMembers("Foo", "annot.Bar[] nestedAnnotations();");
- ICompilationUnit cu = this.createTestType("@annot.Foo(nestedAnnotations={\"something\"})");
- this.assertSourceDoesNotContain("Bar", cu);
-
- DeclarationAnnotationAdapter daa = new NestedIndexedDeclarationAnnotationAdapter(
- new SimpleDeclarationAnnotationAdapter("annot.Foo"), "nestedAnnotations", 5, "annot.Bar");
- AnnotationAdapter aa = new MemberAnnotationAdapter(this.idField(cu), daa);
- Annotation annotation = aa.getAnnotation(this.buildASTRoot(cu));
- assertNull(annotation);
-
- aa.newMarkerAnnotation();
- this.assertSourceContains("Bar})", cu); // split line
- }
-
- public void testNewMarkerAnnotation19() throws Exception {
- this.createAnnotationAndMembers("Bar", "int value();");
- this.createAnnotationAndMembers("Foo", "annot.Bar[] nestedAnnotations();");
- ICompilationUnit cu = this.createTestType("@annot.Foo(nestedAnnotations=\"something\")");
- String expected = "@annot.Foo(nestedAnnotations=@Bar)";
- this.assertSourceDoesNotContain(expected, cu);
-
- DeclarationAnnotationAdapter daa = new NestedIndexedDeclarationAnnotationAdapter(
- new SimpleDeclarationAnnotationAdapter("annot.Foo"), "nestedAnnotations", 0, "annot.Bar");
- AnnotationAdapter aa = new MemberAnnotationAdapter(this.idField(cu), daa);
- Annotation annotation = aa.getAnnotation(this.buildASTRoot(cu));
- assertNull(annotation);
-
- aa.newMarkerAnnotation();
- this.assertSourceContains(expected, cu);
- }
-
- public void testNewMarkerAnnotation20() throws Exception {
- this.createAnnotationAndMembers("NotBar", "int value();");
- this.createAnnotationAndMembers("Bar", "int value();");
- this.createAnnotationAndMembers("Foo", "annot.Bar[] nestedAnnotations();");
- ICompilationUnit cu = this.createTestType("@annot.Foo(nestedAnnotations=@annot.NotBar)");
- String expected = "@annot.Foo(nestedAnnotations=@Bar)";
- this.assertSourceDoesNotContain(expected, cu);
-
- DeclarationAnnotationAdapter daa = new NestedIndexedDeclarationAnnotationAdapter(
- new SimpleDeclarationAnnotationAdapter("annot.Foo"), "nestedAnnotations", 0, "annot.Bar");
- AnnotationAdapter aa = new MemberAnnotationAdapter(this.idField(cu), daa);
- Annotation annotation = aa.getAnnotation(this.buildASTRoot(cu));
- assertNull(annotation);
-
- aa.newMarkerAnnotation();
- this.assertSourceContains(expected, cu);
- }
-
- public void testNewMarkerAnnotation21() throws Exception {
- this.createAnnotationAndMembers("NotBar", "int value();");
- this.createAnnotationAndMembers("Bar", "int value();");
- this.createAnnotationAndMembers("Foo", "Object[] nestedAnnotations();");
- ICompilationUnit cu = this.createTestType("@annot.Foo(nestedAnnotations=@annot.NotBar)");
- this.assertSourceDoesNotContain("@Bar", cu);
-
- DeclarationAnnotationAdapter daa = new NestedIndexedDeclarationAnnotationAdapter(
- new SimpleDeclarationAnnotationAdapter("annot.Foo"), "nestedAnnotations", 5, "annot.Bar");
- AnnotationAdapter aa = new MemberAnnotationAdapter(this.idField(cu), daa);
- Annotation annotation = aa.getAnnotation(this.buildASTRoot(cu));
- assertNull(annotation);
-
- aa.newMarkerAnnotation();
- this.assertSourceContains("@annot.Foo(nestedAnnotations={@annot.NotBar,null,null,null,null,@Bar})", cu);
- }
-
- public void testNewMarkerAnnotation22() throws Exception {
- this.createAnnotationAndMembers("Bar", "int value();");
- this.createAnnotationAndMembers("Foo", "Object[] nestedAnnotations();");
- ICompilationUnit cu = this.createTestType("@annot.Foo(nestedAnnotations=@annot.Bar(88))");
- String expected = "@annot.Foo(nestedAnnotations=@Bar)";
- this.assertSourceDoesNotContain(expected, cu);
-
- DeclarationAnnotationAdapter daa = new NestedIndexedDeclarationAnnotationAdapter(
- new SimpleDeclarationAnnotationAdapter("annot.Foo"), "nestedAnnotations", 0, "annot.Bar");
- AnnotationAdapter aa = new MemberAnnotationAdapter(this.idField(cu), daa);
- aa.newMarkerAnnotation();
- this.assertSourceContains(expected, cu);
- }
-
- public void testNewMarkerAnnotation23() throws Exception {
- this.createAnnotationAndMembers("Bar", "int value();");
- this.createAnnotationAndMembers("Foo", "Object[] nestedAnnotations();");
- ICompilationUnit cu = this.createTestType("@annot.Foo(nestedAnnotations=@annot.Bar(88))");
- String expected = "@annot.Foo(nestedAnnotations={@annot.Bar(88),null,@Bar})";
- this.assertSourceDoesNotContain(expected, cu);
-
- DeclarationAnnotationAdapter daa = new NestedIndexedDeclarationAnnotationAdapter(
- new SimpleDeclarationAnnotationAdapter("annot.Foo"), "nestedAnnotations", 2, "annot.Bar");
- AnnotationAdapter aa = new MemberAnnotationAdapter(this.idField(cu), daa);
- aa.newMarkerAnnotation();
- this.assertSourceContains(expected, cu);
- }
-
- public void testNewMarkerAnnotation24() throws Exception {
- this.createAnnotationAndMembers("Bar", "int value();");
- this.createAnnotationAndMembers("Foo", "Object[] value();");
- ICompilationUnit cu = this.createTestType("@annot.Foo(@annot.Bar(88))");
- String expected = "@annot.Foo({@annot.Bar(88),null,@Bar})";
- this.assertSourceDoesNotContain(expected, cu);
-
- DeclarationAnnotationAdapter daa = new NestedIndexedDeclarationAnnotationAdapter(
- new SimpleDeclarationAnnotationAdapter("annot.Foo"), "value", 2, "annot.Bar");
- AnnotationAdapter aa = new MemberAnnotationAdapter(this.idField(cu), daa);
- aa.newMarkerAnnotation();
- this.assertSourceContains(expected, cu);
- }
-
- public void testNewMarkerAnnotation25() throws Exception {
- this.createAnnotationAndMembers("Bar", "int value();");
- this.createAnnotationAndMembers("Foo", "Object[] nestedAnnotations();");
- ICompilationUnit cu = this.createTestType("@annot.Foo(nestedAnnotations={@annot.Bar(88), @annot.Bar(77)})");
- String expected1 = "@annot.Foo(nestedAnnotations={@annot.Bar(88), @annot.Bar(77), null, null,"; // the line gets split
- String expected2 = "@Bar})";
- this.assertSourceDoesNotContain(expected1, cu);
- this.assertSourceDoesNotContain(expected2, cu);
-
- DeclarationAnnotationAdapter daa = new NestedIndexedDeclarationAnnotationAdapter(
- new SimpleDeclarationAnnotationAdapter("annot.Foo"), "nestedAnnotations", 4, "annot.Bar");
- AnnotationAdapter aa = new MemberAnnotationAdapter(this.idField(cu), daa);
- aa.newMarkerAnnotation();
- this.assertSourceContains(expected1, cu);
- this.assertSourceContains(expected2, cu);
- }
-
- public void testNewMarkerAnnotation26() throws Exception {
- this.createAnnotationAndMembers("Bar", "int value();");
- this.createAnnotationAndMembers("Foo", "Object[] value();");
- ICompilationUnit cu = this.createTestType("@annot.Foo({@annot.Bar(88), @annot.Bar(77)})");
- String expected1 = "@annot.Foo({@annot.Bar(88), @annot.Bar(77), null, null,"; // the line gets split
- String expected2 = "@Bar})";
- this.assertSourceDoesNotContain(expected1, cu);
- this.assertSourceDoesNotContain(expected2, cu);
-
- DeclarationAnnotationAdapter daa = new NestedIndexedDeclarationAnnotationAdapter(
- new SimpleDeclarationAnnotationAdapter("annot.Foo"), "value", 4, "annot.Bar");
- AnnotationAdapter aa = new MemberAnnotationAdapter(this.idField(cu), daa);
- aa.newMarkerAnnotation();
- this.assertSourceContains(expected1, cu);
- this.assertSourceContains(expected2, cu);
- }
-
- public void testNewSingleMemberAnnotation1() throws Exception {
- this.createAnnotationAndMembers("Bar", "int value();");
- this.createAnnotationAndMembers("Foo", "annot.Bar[] nestedAnnotations();");
- ICompilationUnit cu = this.createTestType();
- this.assertSourceDoesNotContain("@Foo", cu);
- this.idField(cu).edit(new Member.Editor() {
- public void edit(ModifiedDeclaration declaration) {
- NestedIndexedDeclarationAnnotationAdapterTests.this.editNewSingleMemberAnnotation1(declaration);
- }
- });
- this.assertSourceContains("@Foo(nestedAnnotations = @Bar(88))", cu);
- }
-
- void editNewSingleMemberAnnotation1(ModifiedDeclaration declaration) {
- DeclarationAnnotationAdapter daa = new NestedIndexedDeclarationAnnotationAdapter(
- new SimpleDeclarationAnnotationAdapter("annot.Foo"), "nestedAnnotations", 0, "annot.Bar");
- SingleMemberAnnotation annotation = (SingleMemberAnnotation) daa.getAnnotation(declaration);
- assertNull(annotation);
- annotation = daa.newSingleMemberAnnotation(declaration);
- NumberLiteral numberLiteral = annotation.getAST().newNumberLiteral();
- numberLiteral.setToken("88");
- annotation.setValue(numberLiteral);
- }
-
- public void testNewSingleMemberAnnotation2() throws Exception {
- this.createAnnotationAndMembers("Bar", "int value();");
- this.createAnnotationAndMembers("Foo", "annot.Bar[] value();");
- ICompilationUnit cu = this.createTestType();
- this.assertSourceDoesNotContain("@Foo", cu);
- this.idField(cu).edit(new Member.Editor() {
- public void edit(ModifiedDeclaration declaration) {
- NestedIndexedDeclarationAnnotationAdapterTests.this.editNewSingleMemberAnnotation2(declaration);
- }
- });
- this.assertSourceContains("@Foo(@Bar(88))", cu);
- }
-
- void editNewSingleMemberAnnotation2(ModifiedDeclaration declaration) {
- DeclarationAnnotationAdapter daa = new NestedIndexedDeclarationAnnotationAdapter(
- new SimpleDeclarationAnnotationAdapter("annot.Foo"), "value", 0, "annot.Bar");
- SingleMemberAnnotation annotation = (SingleMemberAnnotation) daa.getAnnotation(declaration);
- assertNull(annotation);
- annotation = daa.newSingleMemberAnnotation(declaration);
- NumberLiteral numberLiteral = annotation.getAST().newNumberLiteral();
- numberLiteral.setToken("88");
- annotation.setValue(numberLiteral);
- }
-
- public void testNewSingleMemberAnnotation3() throws Exception {
- this.createAnnotationAndMembers("Bar", "int value();");
- this.createAnnotationAndMembers("Foo", "annot.Bar[] nestedAnnotations();");
- ICompilationUnit cu = this.createTestType("@annot.Foo");
- String expected = "@Foo(nestedAnnotations = @Bar(88))";
- this.assertSourceDoesNotContain(expected, cu);
- this.idField(cu).edit(new Member.Editor() {
- public void edit(ModifiedDeclaration declaration) {
- NestedIndexedDeclarationAnnotationAdapterTests.this.editNewSingleMemberAnnotation3(declaration);
- }
- });
- this.assertSourceContains(expected, cu);
- }
-
- void editNewSingleMemberAnnotation3(ModifiedDeclaration declaration) {
- DeclarationAnnotationAdapter daa = new NestedIndexedDeclarationAnnotationAdapter(
- new SimpleDeclarationAnnotationAdapter("annot.Foo"), "nestedAnnotations", 0, "annot.Bar");
- SingleMemberAnnotation annotation = (SingleMemberAnnotation) daa.getAnnotation(declaration);
- assertNull(annotation);
- annotation = daa.newSingleMemberAnnotation(declaration);
- NumberLiteral numberLiteral = annotation.getAST().newNumberLiteral();
- numberLiteral.setToken("88");
- annotation.setValue(numberLiteral);
- }
-
- public void testNewSingleMemberAnnotation4() throws Exception {
- this.createAnnotationAndMembers("Bar", "int value();");
- this.createAnnotationAndMembers("Foo", "annot.Bar[] value();");
- ICompilationUnit cu = this.createTestType("@annot.Foo");
- String expected = "@Foo(@Bar(88))";
- this.assertSourceDoesNotContain(expected, cu);
- this.idField(cu).edit(new Member.Editor() {
- public void edit(ModifiedDeclaration declaration) {
- NestedIndexedDeclarationAnnotationAdapterTests.this.editNewSingleMemberAnnotation4(declaration);
- }
- });
- this.assertSourceContains(expected, cu);
- }
-
- void editNewSingleMemberAnnotation4(ModifiedDeclaration declaration) {
- DeclarationAnnotationAdapter daa = new NestedIndexedDeclarationAnnotationAdapter(
- new SimpleDeclarationAnnotationAdapter("annot.Foo"), "value", 0, "annot.Bar");
- SingleMemberAnnotation annotation = (SingleMemberAnnotation) daa.getAnnotation(declaration);
- assertNull(annotation);
- annotation = daa.newSingleMemberAnnotation(declaration);
- NumberLiteral numberLiteral = annotation.getAST().newNumberLiteral();
- numberLiteral.setToken("88");
- annotation.setValue(numberLiteral);
- }
-
- public void testNewSingleMemberAnnotation5() throws Exception {
- this.createAnnotationAndMembers("Bar", "int value();");
- this.createAnnotationAndMembers("Foo", "String value(); annot.Bar[] nestedAnnotations();");
- ICompilationUnit cu = this.createTestType("@annot.Foo(\"something\")");
- String expected = "@Foo(value = \"something\", nestedAnnotations = @Bar(88))";
- this.assertSourceDoesNotContain(expected, cu);
- this.idField(cu).edit(new Member.Editor() {
- public void edit(ModifiedDeclaration declaration) {
- NestedIndexedDeclarationAnnotationAdapterTests.this.editNewSingleMemberAnnotation5(declaration);
- }
- });
- this.assertSourceContains(expected, cu);
- }
-
- void editNewSingleMemberAnnotation5(ModifiedDeclaration declaration) {
- DeclarationAnnotationAdapter daa = new NestedIndexedDeclarationAnnotationAdapter(
- new SimpleDeclarationAnnotationAdapter("annot.Foo"), "nestedAnnotations", 0, "annot.Bar");
- SingleMemberAnnotation annotation = (SingleMemberAnnotation) daa.getAnnotation(declaration);
- assertNull(annotation);
- annotation = daa.newSingleMemberAnnotation(declaration);
- NumberLiteral numberLiteral = annotation.getAST().newNumberLiteral();
- numberLiteral.setToken("88");
- annotation.setValue(numberLiteral);
- }
-
- public void testNewSingleMemberAnnotation6() throws Exception {
- this.createAnnotationAndMembers("Bar", "int value();");
- this.createAnnotationAndMembers("Foo", "Object[] value();");
- ICompilationUnit cu = this.createTestType("@annot.Foo(\"something\")");
- String expected = "@annot.Foo(@Bar(88))";
- this.assertSourceDoesNotContain(expected, cu);
- this.idField(cu).edit(new Member.Editor() {
- public void edit(ModifiedDeclaration declaration) {
- NestedIndexedDeclarationAnnotationAdapterTests.this.editNewSingleMemberAnnotation6(declaration);
- }
- });
- this.assertSourceContains(expected, cu);
- }
-
- void editNewSingleMemberAnnotation6(ModifiedDeclaration declaration) {
- DeclarationAnnotationAdapter daa = new NestedIndexedDeclarationAnnotationAdapter(
- new SimpleDeclarationAnnotationAdapter("annot.Foo"), "value", 0, "annot.Bar");
- SingleMemberAnnotation annotation = (SingleMemberAnnotation) daa.getAnnotation(declaration);
- assertNull(annotation);
- annotation = daa.newSingleMemberAnnotation(declaration);
- NumberLiteral numberLiteral = annotation.getAST().newNumberLiteral();
- numberLiteral.setToken("88");
- annotation.setValue(numberLiteral);
- }
-
- public void testNewSingleMemberAnnotation7() throws Exception {
- this.createAnnotationAndMembers("Bar", "int value();");
- this.createAnnotationAndMembers("Foo", "String xxx(); annot.Bar[] nestedAnnotations();");
- ICompilationUnit cu = this.createTestType("@annot.Foo(xxx=\"something\")");
- String expected = "@annot.Foo(xxx=\"something\", nestedAnnotations = @Bar(88))";
- this.assertSourceDoesNotContain(expected, cu);
- this.idField(cu).edit(new Member.Editor() {
- public void edit(ModifiedDeclaration declaration) {
- NestedIndexedDeclarationAnnotationAdapterTests.this.editNewSingleMemberAnnotation7(declaration);
- }
- });
- this.assertSourceContains(expected, cu);
- }
-
- void editNewSingleMemberAnnotation7(ModifiedDeclaration declaration) {
- DeclarationAnnotationAdapter daa = new NestedIndexedDeclarationAnnotationAdapter(
- new SimpleDeclarationAnnotationAdapter("annot.Foo"), "nestedAnnotations", 0, "annot.Bar");
- SingleMemberAnnotation annotation = (SingleMemberAnnotation) daa.getAnnotation(declaration);
- assertNull(annotation);
- annotation = daa.newSingleMemberAnnotation(declaration);
- NumberLiteral numberLiteral = annotation.getAST().newNumberLiteral();
- numberLiteral.setToken("88");
- annotation.setValue(numberLiteral);
- }
-
- public void testNewSingleMemberAnnotation8() throws Exception {
- this.createAnnotationAndMembers("Bar", "int value();");
- this.createAnnotationAndMembers("Foo", "String xxx(); annot.Bar[] value();");
- ICompilationUnit cu = this.createTestType("@annot.Foo(xxx=\"something\")");
- String expected = "@annot.Foo(xxx=\"something\", value = @Bar(88))";
- this.assertSourceDoesNotContain(expected, cu);
- this.idField(cu).edit(new Member.Editor() {
- public void edit(ModifiedDeclaration declaration) {
- NestedIndexedDeclarationAnnotationAdapterTests.this.editNewSingleMemberAnnotation8(declaration);
- }
- });
- this.assertSourceContains(expected, cu);
- }
-
- void editNewSingleMemberAnnotation8(ModifiedDeclaration declaration) {
- DeclarationAnnotationAdapter daa = new NestedIndexedDeclarationAnnotationAdapter(
- new SimpleDeclarationAnnotationAdapter("annot.Foo"), "value", 0, "annot.Bar");
- SingleMemberAnnotation annotation = (SingleMemberAnnotation) daa.getAnnotation(declaration);
- assertNull(annotation);
- annotation = daa.newSingleMemberAnnotation(declaration);
- NumberLiteral numberLiteral = annotation.getAST().newNumberLiteral();
- numberLiteral.setToken("88");
- annotation.setValue(numberLiteral);
- }
-
- public void testNewSingleMemberAnnotation9() throws Exception {
- this.createAnnotationAndMembers("Bar", "int value();");
- this.createAnnotationAndMembers("Foo", "annot.Bar[] nestedAnnotations();");
- ICompilationUnit cu = this.createTestType();
- this.assertSourceDoesNotContain("@Bar", cu);
-
- DeclarationAnnotationAdapter daa = new NestedIndexedDeclarationAnnotationAdapter(
- new SimpleDeclarationAnnotationAdapter("annot.Foo"), "nestedAnnotations", 5, "annot.Bar");
- AnnotationAdapter aa = new MemberAnnotationAdapter(this.idField(cu), daa);
- Annotation annotation = aa.getAnnotation(this.buildASTRoot(cu));
- assertNull(annotation);
-
- aa.newSingleMemberAnnotation();
- this.assertSourceContains("@Foo(nestedAnnotations = { null, null, null, null, null, @Bar(MISSING) })", cu); // ???
- }
-
- public void testNewSingleMemberAnnotation10() throws Exception {
- this.createAnnotationAndMembers("Bar", "int value();");
- this.createAnnotationAndMembers("Foo", "String value(); annot.Bar[] nestedAnnotations();");
- ICompilationUnit cu = this.createTestType("@annot.Foo(\"something\")");
- String expected1 = "@Foo(value = \"something\", nestedAnnotations = { null, null, null, null,";
- String expected2 = "null, @Bar(MISSING) })"; // ???
- this.assertSourceDoesNotContain("@Bar", cu);
-
- DeclarationAnnotationAdapter daa = new NestedIndexedDeclarationAnnotationAdapter(
- new SimpleDeclarationAnnotationAdapter("annot.Foo"), "nestedAnnotations", 5, "annot.Bar");
- AnnotationAdapter aa = new MemberAnnotationAdapter(this.idField(cu), daa);
- Annotation annotation = aa.getAnnotation(this.buildASTRoot(cu));
- assertNull(annotation);
-
- aa.newSingleMemberAnnotation();
- this.assertSourceContains(expected1, cu);
- this.assertSourceContains(expected2, cu);
- }
-
- public void testNewSingleMemberAnnotation11() throws Exception {
- this.createAnnotationAndMembers("Bar", "int value();");
- this.createAnnotationAndMembers("Foo", "Object[] value();");
- ICompilationUnit cu = this.createTestType("@annot.Foo({\"one\", \"two\"})");
- String expected = "@annot.Foo({@Bar(88), \"two\"})";
- this.assertSourceDoesNotContain(expected, cu);
- this.idField(cu).edit(new Member.Editor() {
- public void edit(ModifiedDeclaration declaration) {
- NestedIndexedDeclarationAnnotationAdapterTests.this.editNewSingleMemberAnnotation11(declaration);
- }
- });
- this.assertSourceContains(expected, cu);
- }
-
- void editNewSingleMemberAnnotation11(ModifiedDeclaration declaration) {
- DeclarationAnnotationAdapter daa = new NestedIndexedDeclarationAnnotationAdapter(
- new SimpleDeclarationAnnotationAdapter("annot.Foo"), "value", 0, "annot.Bar");
- SingleMemberAnnotation annotation = (SingleMemberAnnotation) daa.getAnnotation(declaration);
- assertNull(annotation);
- annotation = daa.newSingleMemberAnnotation(declaration);
- NumberLiteral numberLiteral = annotation.getAST().newNumberLiteral();
- numberLiteral.setToken("88");
- annotation.setValue(numberLiteral);
- }
-
- public void testNewSingleMemberAnnotation12() throws Exception {
- this.createAnnotationAndMembers("Bar", "int value();");
- this.createAnnotationAndMembers("Foo", "Object[] value();");
- ICompilationUnit cu = this.createTestType("@annot.Foo({\"one\", \"two\"})");
- this.assertSourceDoesNotContain("@Bar", cu);
-
- DeclarationAnnotationAdapter daa = new NestedIndexedDeclarationAnnotationAdapter(
- new SimpleDeclarationAnnotationAdapter("annot.Foo"), "value", 5, "annot.Bar");
- AnnotationAdapter aa = new MemberAnnotationAdapter(this.idField(cu), daa);
- Annotation annotation = aa.getAnnotation(this.buildASTRoot(cu));
- assertNull(annotation);
-
- aa.newSingleMemberAnnotation();
- this.assertSourceContains("@Bar(MISSING)})", cu); // split line
- }
-
- public void testNewSingleMemberAnnotation13() throws Exception {
- this.createAnnotationAndMembers("Bar", "int value();");
- this.createAnnotationAndMembers("Foo", "Object[] value();");
- ICompilationUnit cu = this.createTestType("@annot.Foo(7)");
- String expected = "@annot.Foo(@Bar(88))";
- this.assertSourceDoesNotContain(expected, cu);
- this.idField(cu).edit(new Member.Editor() {
- public void edit(ModifiedDeclaration declaration) {
- NestedIndexedDeclarationAnnotationAdapterTests.this.editNewSingleMemberAnnotation13(declaration);
- }
- });
- this.assertSourceContains(expected, cu);
- }
-
- void editNewSingleMemberAnnotation13(ModifiedDeclaration declaration) {
- DeclarationAnnotationAdapter daa = new NestedIndexedDeclarationAnnotationAdapter(
- new SimpleDeclarationAnnotationAdapter("annot.Foo"), "value", 0, "annot.Bar");
- SingleMemberAnnotation annotation = (SingleMemberAnnotation) daa.getAnnotation(declaration);
- assertNull(annotation);
- annotation = daa.newSingleMemberAnnotation(declaration);
- NumberLiteral numberLiteral = annotation.getAST().newNumberLiteral();
- numberLiteral.setToken("88");
- annotation.setValue(numberLiteral);
- }
-
- public void testNewSingleMemberAnnotation14() throws Exception {
- this.createAnnotationAndMembers("Bar", "int value();");
- this.createAnnotationAndMembers("Foo", "Object[] value();");
- ICompilationUnit cu = this.createTestType("@annot.Foo(7)");
- this.assertSourceDoesNotContain("@Bar", cu);
-
- DeclarationAnnotationAdapter daa = new NestedIndexedDeclarationAnnotationAdapter(
- new SimpleDeclarationAnnotationAdapter("annot.Foo"), "value", 5, "annot.Bar");
- AnnotationAdapter aa = new MemberAnnotationAdapter(this.idField(cu), daa);
- Annotation annotation = aa.getAnnotation(this.buildASTRoot(cu));
- assertNull(annotation);
-
- aa.newSingleMemberAnnotation();
- this.assertSourceContains("@annot.Foo({7,null,null,null,null,@Bar(MISSING)})", cu);
- }
-
- public void testNewSingleMemberAnnotation15() throws Exception {
- this.createAnnotationAndMembers("NotBar", "int value();");
- this.createAnnotationAndMembers("Bar", "int value();");
- this.createAnnotationAndMembers("Foo", "Object[] value();");
- ICompilationUnit cu = this.createTestType("@annot.Foo(@annot.NotBar)");
- String expected = "@annot.Foo(@Bar(88))";
- this.assertSourceDoesNotContain(expected, cu);
- this.idField(cu).edit(new Member.Editor() {
- public void edit(ModifiedDeclaration declaration) {
- NestedIndexedDeclarationAnnotationAdapterTests.this.editNewSingleMemberAnnotation15(declaration);
- }
- });
- this.assertSourceContains(expected, cu);
- }
-
- void editNewSingleMemberAnnotation15(ModifiedDeclaration declaration) {
- DeclarationAnnotationAdapter daa = new NestedIndexedDeclarationAnnotationAdapter(
- new SimpleDeclarationAnnotationAdapter("annot.Foo"), "value", 0, "annot.Bar");
- SingleMemberAnnotation annotation = (SingleMemberAnnotation) daa.getAnnotation(declaration);
- assertNull(annotation);
- annotation = daa.newSingleMemberAnnotation(declaration);
- NumberLiteral numberLiteral = annotation.getAST().newNumberLiteral();
- numberLiteral.setToken("88");
- annotation.setValue(numberLiteral);
- }
-
- public void testNewSingleMemberAnnotation16() throws Exception {
- this.createAnnotationAndMembers("Bar", "int value();");
- this.createAnnotationAndMembers("Foo", "annot.Bar[] value();");
- ICompilationUnit cu = this.createTestType("@annot.Foo(@annot.Bar(55))");
- String expected = "@annot.Foo({@annot.Bar(55),@Bar(88)})";
- this.assertSourceDoesNotContain(expected, cu);
- this.idField(cu).edit(new Member.Editor() {
- public void edit(ModifiedDeclaration declaration) {
- NestedIndexedDeclarationAnnotationAdapterTests.this.editNewSingleMemberAnnotation16(declaration);
- }
- });
- this.assertSourceContains(expected, cu);
- }
-
- void editNewSingleMemberAnnotation16(ModifiedDeclaration declaration) {
- DeclarationAnnotationAdapter daa = new NestedIndexedDeclarationAnnotationAdapter(
- new SimpleDeclarationAnnotationAdapter("annot.Foo"), "value", 1, "annot.Bar");
- SingleMemberAnnotation annotation = (SingleMemberAnnotation) daa.getAnnotation(declaration);
- assertNull(annotation);
- annotation = daa.newSingleMemberAnnotation(declaration);
- NumberLiteral numberLiteral = annotation.getAST().newNumberLiteral();
- numberLiteral.setToken("88");
- annotation.setValue(numberLiteral);
- }
-
- public void testNewSingleMemberAnnotation17() throws Exception {
- this.createAnnotationAndMembers("Bar", "int value();");
- this.createAnnotationAndMembers("Foo", "annot.Bar[] nestedAnnotations();");
- ICompilationUnit cu = this.createTestType("@annot.Foo(nestedAnnotations={\"something\"})");
- String expected = "@annot.Foo(nestedAnnotations={@Bar(88)})";
- this.assertSourceDoesNotContain(expected, cu);
- this.idField(cu).edit(new Member.Editor() {
- public void edit(ModifiedDeclaration declaration) {
- NestedIndexedDeclarationAnnotationAdapterTests.this.editNewSingleMemberAnnotation17(declaration);
- }
- });
- this.assertSourceContains(expected, cu);
- }
-
- void editNewSingleMemberAnnotation17(ModifiedDeclaration declaration) {
- DeclarationAnnotationAdapter daa = new NestedIndexedDeclarationAnnotationAdapter(
- new SimpleDeclarationAnnotationAdapter("annot.Foo"), "nestedAnnotations", 0, "annot.Bar");
- SingleMemberAnnotation annotation = (SingleMemberAnnotation) daa.getAnnotation(declaration);
- assertNull(annotation);
- annotation = daa.newSingleMemberAnnotation(declaration);
- NumberLiteral numberLiteral = annotation.getAST().newNumberLiteral();
- numberLiteral.setToken("88");
- annotation.setValue(numberLiteral);
- }
-
- public void testNewSingleMemberAnnotation18() throws Exception {
- this.createAnnotationAndMembers("Bar", "int value();");
- this.createAnnotationAndMembers("Foo", "Object[] nestedAnnotations();");
- ICompilationUnit cu = this.createTestType("@annot.Foo(nestedAnnotations={\"something\"})");
- this.assertSourceDoesNotContain("@Bar", cu);
-
- DeclarationAnnotationAdapter daa = new NestedIndexedDeclarationAnnotationAdapter(
- new SimpleDeclarationAnnotationAdapter("annot.Foo"), "nestedAnnotations", 5, "annot.Bar");
- AnnotationAdapter aa = new MemberAnnotationAdapter(this.idField(cu), daa);
- Annotation annotation = aa.getAnnotation(this.buildASTRoot(cu));
- assertNull(annotation);
-
- aa.newSingleMemberAnnotation();
- this.assertSourceContains("@Bar(MISSING)})", cu); // ???
- }
-
- public void testNewSingleMemberAnnotation19() throws Exception {
- this.createAnnotationAndMembers("Bar", "int value();");
- this.createAnnotationAndMembers("Foo", "Object[] nestedAnnotations();");
- ICompilationUnit cu = this.createTestType("@annot.Foo(nestedAnnotations=\"something\")");
- String expected = "@annot.Foo(nestedAnnotations=@Bar(88))";
- this.assertSourceDoesNotContain(expected, cu);
- this.idField(cu).edit(new Member.Editor() {
- public void edit(ModifiedDeclaration declaration) {
- NestedIndexedDeclarationAnnotationAdapterTests.this.editNewSingleMemberAnnotation19(declaration);
- }
- });
- this.assertSourceContains(expected, cu);
- }
-
- void editNewSingleMemberAnnotation19(ModifiedDeclaration declaration) {
- DeclarationAnnotationAdapter daa = new NestedIndexedDeclarationAnnotationAdapter(
- new SimpleDeclarationAnnotationAdapter("annot.Foo"), "nestedAnnotations", 0, "annot.Bar");
- SingleMemberAnnotation annotation = (SingleMemberAnnotation) daa.getAnnotation(declaration);
- assertNull(annotation);
- annotation = daa.newSingleMemberAnnotation(declaration);
- NumberLiteral numberLiteral = annotation.getAST().newNumberLiteral();
- numberLiteral.setToken("88");
- annotation.setValue(numberLiteral);
- }
-
- public void testNewSingleMemberAnnotation20() throws Exception {
- this.createAnnotationAndMembers("NotBar", "int value();");
- this.createAnnotationAndMembers("Bar", "int value();");
- this.createAnnotationAndMembers("Foo", "Object[] nestedAnnotations();");
- ICompilationUnit cu = this.createTestType("@annot.Foo(nestedAnnotations=@annot.NotBar)");
- String expected = "@annot.Foo(nestedAnnotations=@Bar(88))";
- this.assertSourceDoesNotContain(expected, cu);
- this.idField(cu).edit(new Member.Editor() {
- public void edit(ModifiedDeclaration declaration) {
- NestedIndexedDeclarationAnnotationAdapterTests.this.editNewSingleMemberAnnotation20(declaration);
- }
- });
- this.assertSourceContains(expected, cu);
- }
-
- void editNewSingleMemberAnnotation20(ModifiedDeclaration declaration) {
- DeclarationAnnotationAdapter daa = new NestedIndexedDeclarationAnnotationAdapter(
- new SimpleDeclarationAnnotationAdapter("annot.Foo"), "nestedAnnotations", 0, "annot.Bar");
- SingleMemberAnnotation annotation = (SingleMemberAnnotation) daa.getAnnotation(declaration);
- assertNull(annotation);
- annotation = daa.newSingleMemberAnnotation(declaration);
- NumberLiteral numberLiteral = annotation.getAST().newNumberLiteral();
- numberLiteral.setToken("88");
- annotation.setValue(numberLiteral);
- }
-
- public void testNewSingleMemberAnnotation21() throws Exception {
- this.createAnnotationAndMembers("NotBar", "int value();");
- this.createAnnotationAndMembers("Bar", "int value();");
- this.createAnnotationAndMembers("Foo", "Object[] nestedAnnotations();");
- ICompilationUnit cu = this.createTestType("@annot.Foo(nestedAnnotations=@annot.NotBar)");
- this.assertSourceDoesNotContain("@Bar", cu);
-
- DeclarationAnnotationAdapter daa = new NestedIndexedDeclarationAnnotationAdapter(
- new SimpleDeclarationAnnotationAdapter("annot.Foo"), "nestedAnnotations", 5, "annot.Bar");
- AnnotationAdapter aa = new MemberAnnotationAdapter(this.idField(cu), daa);
- Annotation annotation = aa.getAnnotation(this.buildASTRoot(cu));
- assertNull(annotation);
-
- aa.newSingleMemberAnnotation();
- this.assertSourceContains("@annot.Foo(nestedAnnotations={@annot.NotBar,null,null,null,null,@Bar(MISSING)})", cu);
- }
-
- public void testNewSingleMemberAnnotation22() throws Exception {
- this.createAnnotationAndMembers("Bar", "int value();");
- this.createAnnotationAndMembers("Foo", "annot.Bar[] nestedAnnotations();");
- ICompilationUnit cu = this.createTestType("@annot.Foo(nestedAnnotations=@annot.Bar(77))");
- String expected = "@annot.Foo(nestedAnnotations=@Bar(88))";
- this.assertSourceDoesNotContain(expected, cu);
- this.idField(cu).edit(new Member.Editor() {
- public void edit(ModifiedDeclaration declaration) {
- NestedIndexedDeclarationAnnotationAdapterTests.this.editNewSingleMemberAnnotation22(declaration);
- }
- });
- this.assertSourceContains(expected, cu);
- }
-
- void editNewSingleMemberAnnotation22(ModifiedDeclaration declaration) {
- DeclarationAnnotationAdapter daa = new NestedIndexedDeclarationAnnotationAdapter(
- new SimpleDeclarationAnnotationAdapter("annot.Foo"), "nestedAnnotations", 0, "annot.Bar");
- SingleMemberAnnotation annotation = daa.newSingleMemberAnnotation(declaration);
- NumberLiteral numberLiteral = annotation.getAST().newNumberLiteral();
- numberLiteral.setToken("88");
- annotation.setValue(numberLiteral);
- }
-
- public void testNewNormalAnnotation1() throws Exception {
- this.createAnnotationAndMembers("Bar", "int value();");
- this.createAnnotationAndMembers("Foo", "annot.Bar[] nestedAnnotations();");
- ICompilationUnit cu = this.createTestType();
- this.assertSourceDoesNotContain("@Foo", cu);
- this.idField(cu).edit(new Member.Editor() {
- public void edit(ModifiedDeclaration declaration) {
- NestedIndexedDeclarationAnnotationAdapterTests.this.editNewNormalAnnotation1(declaration);
- }
- });
- this.assertSourceContains("@Foo(nestedAnnotations = @Bar(xxx = 88))", cu);
- }
-
- void editNewNormalAnnotation1(ModifiedDeclaration declaration) {
- DeclarationAnnotationAdapter daa = new NestedIndexedDeclarationAnnotationAdapter(
- new SimpleDeclarationAnnotationAdapter("annot.Foo"), "nestedAnnotations", 0, "annot.Bar");
- NormalAnnotation annotation = (NormalAnnotation) daa.getAnnotation(declaration);
- assertNull(annotation);
- annotation = daa.newNormalAnnotation(declaration);
- this.addMemberValuePair(annotation, "xxx", 88);
- }
-
- public void testNewNormalAnnotation2() throws Exception {
- this.createAnnotationAndMembers("Bar", "int xxx();");
- this.createAnnotationAndMembers("Foo", "annot.Bar[] nestedAnnotations();");
- ICompilationUnit cu = this.createTestType();
- this.assertSourceDoesNotContain("@Foo", cu);
- this.idField(cu).edit(new Member.Editor() {
- public void edit(ModifiedDeclaration declaration) {
- NestedIndexedDeclarationAnnotationAdapterTests.this.editNewNormalAnnotation2(declaration);
- }
- });
- this.assertSourceContains("@Foo(@Bar(xxx = 88))", cu);
- }
-
- void editNewNormalAnnotation2(ModifiedDeclaration declaration) {
- DeclarationAnnotationAdapter daa = new NestedIndexedDeclarationAnnotationAdapter(
- new SimpleDeclarationAnnotationAdapter("annot.Foo"), "value", 0, "annot.Bar");
- NormalAnnotation annotation = (NormalAnnotation) daa.getAnnotation(declaration);
- assertNull(annotation);
- annotation = daa.newNormalAnnotation(declaration);
- this.addMemberValuePair(annotation, "xxx", 88);
- }
-
- public void testNewNormalAnnotation3() throws Exception {
- this.createAnnotationAndMembers("Bar", "int xxx();");
- this.createAnnotationAndMembers("Foo", "annot.Bar[] nestedAnnotations();");
- ICompilationUnit cu = this.createTestType("@annot.Foo");
- String expected = "@Foo(nestedAnnotations = @Bar(xxx = 88))";
- this.assertSourceDoesNotContain(expected, cu);
- this.idField(cu).edit(new Member.Editor() {
- public void edit(ModifiedDeclaration declaration) {
- NestedIndexedDeclarationAnnotationAdapterTests.this.editNewNormalAnnotation3(declaration);
- }
- });
- this.assertSourceContains(expected, cu);
- }
-
- void editNewNormalAnnotation3(ModifiedDeclaration declaration) {
- DeclarationAnnotationAdapter daa = new NestedIndexedDeclarationAnnotationAdapter(
- new SimpleDeclarationAnnotationAdapter("annot.Foo"), "nestedAnnotations", 0, "annot.Bar");
- NormalAnnotation annotation = (NormalAnnotation) daa.getAnnotation(declaration);
- assertNull(annotation);
- annotation = daa.newNormalAnnotation(declaration);
- this.addMemberValuePair(annotation, "xxx", 88);
- }
-
- public void testNewNormalAnnotation4() throws Exception {
- this.createAnnotationAndMembers("Bar", "int xxx();");
- this.createAnnotationAndMembers("Foo", "annot.Bar[] nestedAnnotations();");
- ICompilationUnit cu = this.createTestType("@annot.Foo");
- String expected = "@Foo(@Bar(xxx = 88))";
- this.assertSourceDoesNotContain(expected, cu);
- this.idField(cu).edit(new Member.Editor() {
- public void edit(ModifiedDeclaration declaration) {
- NestedIndexedDeclarationAnnotationAdapterTests.this.editNewNormalAnnotation4(declaration);
- }
- });
- this.assertSourceContains(expected, cu);
- }
-
- void editNewNormalAnnotation4(ModifiedDeclaration declaration) {
- DeclarationAnnotationAdapter daa = new NestedIndexedDeclarationAnnotationAdapter(
- new SimpleDeclarationAnnotationAdapter("annot.Foo"), "value", 0, "annot.Bar");
- NormalAnnotation annotation = (NormalAnnotation) daa.getAnnotation(declaration);
- assertNull(annotation);
- annotation = daa.newNormalAnnotation(declaration);
- this.addMemberValuePair(annotation, "xxx", 88);
- }
-
- public void testNewNormalAnnotation5() throws Exception {
- this.createAnnotationAndMembers("Bar", "int xxx();");
- this.createAnnotationAndMembers("Foo", "annot.Bar[] nestedAnnotations(); String value();");
- ICompilationUnit cu = this.createTestType("@annot.Foo(\"something\")");
- String expected = "@Foo(value = \"something\", nestedAnnotations = @Bar(xxx = 88))";
- this.assertSourceDoesNotContain(expected, cu);
- this.idField(cu).edit(new Member.Editor() {
- public void edit(ModifiedDeclaration declaration) {
- NestedIndexedDeclarationAnnotationAdapterTests.this.editNewNormalAnnotation5(declaration);
- }
- });
- this.assertSourceContains(expected, cu);
- }
-
- void editNewNormalAnnotation5(ModifiedDeclaration declaration) {
- DeclarationAnnotationAdapter daa = new NestedIndexedDeclarationAnnotationAdapter(
- new SimpleDeclarationAnnotationAdapter("annot.Foo"), "nestedAnnotations", 0, "annot.Bar");
- NormalAnnotation annotation = (NormalAnnotation) daa.getAnnotation(declaration);
- assertNull(annotation);
- annotation = daa.newNormalAnnotation(declaration);
- this.addMemberValuePair(annotation, "xxx", 88);
- }
-
- public void testNewNormalAnnotation6() throws Exception {
- this.createAnnotationAndMembers("Bar", "int xxx();");
- this.createAnnotationAndMembers("Foo", "annot.Bar[] value();");
- ICompilationUnit cu = this.createTestType("@annot.Foo(\"something\")");
- String expected = "@annot.Foo(@Bar(xxx = 88))";
- this.assertSourceDoesNotContain(expected, cu);
- this.idField(cu).edit(new Member.Editor() {
- public void edit(ModifiedDeclaration declaration) {
- NestedIndexedDeclarationAnnotationAdapterTests.this.editNewNormalAnnotation6(declaration);
- }
- });
- this.assertSourceContains(expected, cu);
- }
-
- void editNewNormalAnnotation6(ModifiedDeclaration declaration) {
- DeclarationAnnotationAdapter daa = new NestedIndexedDeclarationAnnotationAdapter(
- new SimpleDeclarationAnnotationAdapter("annot.Foo"), "value", 0, "annot.Bar");
- NormalAnnotation annotation = (NormalAnnotation) daa.getAnnotation(declaration);
- assertNull(annotation);
- annotation = daa.newNormalAnnotation(declaration);
- this.addMemberValuePair(annotation, "xxx", 88);
- }
-
- public void testNewNormalAnnotation7() throws Exception {
- this.createAnnotationAndMembers("Bar", "int xxx();");
- this.createAnnotationAndMembers("Foo", "annot.Bar[] nestedAnnotations(); String xxx();");
- ICompilationUnit cu = this.createTestType("@annot.Foo(xxx=\"something\")");
- String expected = "@annot.Foo(xxx=\"something\", nestedAnnotations = @Bar(xxx = 88))";
- this.assertSourceDoesNotContain(expected, cu);
- this.idField(cu).edit(new Member.Editor() {
- public void edit(ModifiedDeclaration declaration) {
- NestedIndexedDeclarationAnnotationAdapterTests.this.editNewNormalAnnotation7(declaration);
- }
- });
- this.assertSourceContains(expected, cu);
- }
-
- void editNewNormalAnnotation7(ModifiedDeclaration declaration) {
- DeclarationAnnotationAdapter daa = new NestedIndexedDeclarationAnnotationAdapter(
- new SimpleDeclarationAnnotationAdapter("annot.Foo"), "nestedAnnotations", 0, "annot.Bar");
- NormalAnnotation annotation = (NormalAnnotation) daa.getAnnotation(declaration);
- assertNull(annotation);
- annotation = daa.newNormalAnnotation(declaration);
- this.addMemberValuePair(annotation, "xxx", 88);
- }
-
- public void testNewNormalAnnotation8() throws Exception {
- this.createAnnotationAndMembers("Bar", "int xxx();");
- this.createAnnotationAndMembers("Foo", "annot.Bar[] value(); String xxx();");
- ICompilationUnit cu = this.createTestType("@annot.Foo(xxx=\"something\")");
- String expected = "@annot.Foo(xxx=\"something\", value = @Bar(xxx = 88))";
- this.assertSourceDoesNotContain(expected, cu);
- this.idField(cu).edit(new Member.Editor() {
- public void edit(ModifiedDeclaration declaration) {
- NestedIndexedDeclarationAnnotationAdapterTests.this.editNewNormalAnnotation8(declaration);
- }
- });
- this.assertSourceContains(expected, cu);
- }
-
- void editNewNormalAnnotation8(ModifiedDeclaration declaration) {
- DeclarationAnnotationAdapter daa = new NestedIndexedDeclarationAnnotationAdapter(
- new SimpleDeclarationAnnotationAdapter("annot.Foo"), "value", 0, "annot.Bar");
- NormalAnnotation annotation = (NormalAnnotation) daa.getAnnotation(declaration);
- assertNull(annotation);
- annotation = daa.newNormalAnnotation(declaration);
- this.addMemberValuePair(annotation, "xxx", 88);
- }
-
- public void testNewNormalAnnotation9() throws Exception {
- this.createAnnotationAndMembers("Bar", "int xxx();");
- this.createAnnotationAndMembers("Foo", "annot.Bar[] nestedAnnotations(); String xxx();");
- ICompilationUnit cu = this.createTestType();
- this.assertSourceDoesNotContain("@Bar", cu);
-
- DeclarationAnnotationAdapter daa = new NestedIndexedDeclarationAnnotationAdapter(
- new SimpleDeclarationAnnotationAdapter("annot.Foo"), "nestedAnnotations", 5, "annot.Bar");
- AnnotationAdapter aa = new MemberAnnotationAdapter(this.idField(cu), daa);
- Annotation annotation = aa.getAnnotation(this.buildASTRoot(cu));
- assertNull(annotation);
-
- aa.newNormalAnnotation();
- this.assertSourceContains("@Foo(nestedAnnotations = { null, null, null, null, null, @Bar() })", cu);
- }
-
- public void testNewNormalAnnotation10() throws Exception {
- this.createAnnotationAndMembers("Bar", "int xxx();");
- this.createAnnotationAndMembers("Foo", "annot.Bar[] nestedAnnotations(); String value();");
- ICompilationUnit cu = this.createTestType("@annot.Foo(\"something\")");
- String expected1 = "@Foo(value = \"something\", nestedAnnotations = { null, null, null, null,";
- String expected2 = "null, @Bar() })";
- this.assertSourceDoesNotContain("@Bar", cu);
-
- DeclarationAnnotationAdapter daa = new NestedIndexedDeclarationAnnotationAdapter(
- new SimpleDeclarationAnnotationAdapter("annot.Foo"), "nestedAnnotations", 5, "annot.Bar");
- AnnotationAdapter aa = new MemberAnnotationAdapter(this.idField(cu), daa);
- Annotation annotation = aa.getAnnotation(this.buildASTRoot(cu));
- assertNull(annotation);
-
- aa.newNormalAnnotation();
- this.assertSourceContains(expected1, cu);
- this.assertSourceContains(expected2, cu);
- }
-
- public void testNewNormalAnnotation11() throws Exception {
- this.createAnnotationAndMembers("Bar", "int xxx();");
- this.createAnnotationAndMembers("Foo", "Object[] value();");
- ICompilationUnit cu = this.createTestType("@annot.Foo({ \"one\", \"two\" })");
- String expected = "@annot.Foo({ @Bar(xxx = 88), \"two\" })";
- this.assertSourceDoesNotContain(expected, cu);
- this.idField(cu).edit(new Member.Editor() {
- public void edit(ModifiedDeclaration declaration) {
- NestedIndexedDeclarationAnnotationAdapterTests.this.editNewNormalAnnotation11(declaration);
- }
- });
- this.assertSourceContains(expected, cu);
- }
-
- void editNewNormalAnnotation11(ModifiedDeclaration declaration) {
- DeclarationAnnotationAdapter daa = new NestedIndexedDeclarationAnnotationAdapter(
- new SimpleDeclarationAnnotationAdapter("annot.Foo"), "value", 0, "annot.Bar");
- NormalAnnotation annotation = (NormalAnnotation) daa.getAnnotation(declaration);
- assertNull(annotation);
- annotation = daa.newNormalAnnotation(declaration);
- this.addMemberValuePair(annotation, "xxx", 88);
- }
-
- public void testNewNormalAnnotation12() throws Exception {
- this.createAnnotationAndMembers("Bar", "int xxx();");
- this.createAnnotationAndMembers("Foo", "Object[] value();");
- ICompilationUnit cu = this.createTestType("@annot.Foo({\"one\", \"two\"})");
- this.assertSourceDoesNotContain("@Bar", cu);
-
- DeclarationAnnotationAdapter daa = new NestedIndexedDeclarationAnnotationAdapter(
- new SimpleDeclarationAnnotationAdapter("annot.Foo"), "value", 5, "annot.Bar");
- AnnotationAdapter aa = new MemberAnnotationAdapter(this.idField(cu), daa);
- Annotation annotation = aa.getAnnotation(this.buildASTRoot(cu));
- assertNull(annotation);
-
- aa.newNormalAnnotation();
- this.assertSourceContains("@Bar()})", cu); // split line
- }
-
- public void testNewNormalAnnotation13() throws Exception {
- this.createAnnotationAndMembers("Bar", "int xxx();");
- this.createAnnotationAndMembers("Foo", "Object[] value();");
- ICompilationUnit cu = this.createTestType("@annot.Foo(7)");
- String expected = "@annot.Foo(@Bar(xxx = 88))";
- this.assertSourceDoesNotContain(expected, cu);
- this.idField(cu).edit(new Member.Editor() {
- public void edit(ModifiedDeclaration declaration) {
- NestedIndexedDeclarationAnnotationAdapterTests.this.editNewNormalAnnotation13(declaration);
- }
- });
- this.assertSourceContains(expected, cu);
- }
-
- void editNewNormalAnnotation13(ModifiedDeclaration declaration) {
- DeclarationAnnotationAdapter daa = new NestedIndexedDeclarationAnnotationAdapter(
- new SimpleDeclarationAnnotationAdapter("annot.Foo"), "value", 0, "annot.Bar");
- NormalAnnotation annotation = (NormalAnnotation) daa.getAnnotation(declaration);
- assertNull(annotation);
- annotation = daa.newNormalAnnotation(declaration);
- this.addMemberValuePair(annotation, "xxx", 88);
- }
-
- public void testNewNormalAnnotation14() throws Exception {
- this.createAnnotationAndMembers("Bar", "int xxx();");
- this.createAnnotationAndMembers("Foo", "Object[] value();");
- ICompilationUnit cu = this.createTestType("@annot.Foo(7)");
- this.assertSourceDoesNotContain("@Bar", cu);
-
- DeclarationAnnotationAdapter daa = new NestedIndexedDeclarationAnnotationAdapter(
- new SimpleDeclarationAnnotationAdapter("annot.Foo"), "value", 5, "annot.Bar");
- AnnotationAdapter aa = new MemberAnnotationAdapter(this.idField(cu), daa);
- Annotation annotation = aa.getAnnotation(this.buildASTRoot(cu));
- assertNull(annotation);
-
- aa.newNormalAnnotation();
- this.assertSourceContains("@annot.Foo({7,null,null,null,null,@Bar()})", cu);
- }
-
- public void testNewNormalAnnotation15() throws Exception {
- this.createAnnotationAndMembers("NotBar", "int xxx();");
- this.createAnnotationAndMembers("Bar", "int xxx();");
- this.createAnnotationAndMembers("Foo", "Object[] value();");
- ICompilationUnit cu = this.createTestType("@annot.Foo(@annot.NotBar)");
- String expected = "@annot.Foo(@Bar(xxx = 88))";
- this.assertSourceDoesNotContain(expected, cu);
- this.idField(cu).edit(new Member.Editor() {
- public void edit(ModifiedDeclaration declaration) {
- NestedIndexedDeclarationAnnotationAdapterTests.this.editNewNormalAnnotation15(declaration);
- }
- });
- this.assertSourceContains(expected, cu);
- }
-
- void editNewNormalAnnotation15(ModifiedDeclaration declaration) {
- DeclarationAnnotationAdapter daa = new NestedIndexedDeclarationAnnotationAdapter(
- new SimpleDeclarationAnnotationAdapter("annot.Foo"), "value", 0, "annot.Bar");
- NormalAnnotation annotation = (NormalAnnotation) daa.getAnnotation(declaration);
- assertNull(annotation);
- annotation = daa.newNormalAnnotation(declaration);
- this.addMemberValuePair(annotation, "xxx", 88);
- }
-
- public void testNewNormalAnnotation16() throws Exception {
- this.createAnnotationAndMembers("Bar", "int xxx();");
- this.createAnnotationAndMembers("Foo", "annot.Bar[] value();");
- ICompilationUnit cu = this.createTestType("@annot.Foo(@annot.Bar(55))");
- String expected = "@annot.Foo({@annot.Bar(55),@Bar(xxx=88)})";
- this.assertSourceDoesNotContain(expected, cu);
- this.idField(cu).edit(new Member.Editor() {
- public void edit(ModifiedDeclaration declaration) {
- NestedIndexedDeclarationAnnotationAdapterTests.this.editNewNormalAnnotation16(declaration);
- }
- });
- this.assertSourceContains(expected, cu);
- }
-
- void editNewNormalAnnotation16(ModifiedDeclaration declaration) {
- DeclarationAnnotationAdapter daa = new NestedIndexedDeclarationAnnotationAdapter(
- new SimpleDeclarationAnnotationAdapter("annot.Foo"), "value", 1, "annot.Bar");
- NormalAnnotation annotation = (NormalAnnotation) daa.getAnnotation(declaration);
- assertNull(annotation);
- annotation = daa.newNormalAnnotation(declaration);
- this.addMemberValuePair(annotation, "xxx", 88);
- }
-
- public void testNewNormalAnnotation17() throws Exception {
- this.createAnnotationAndMembers("Bar", "int xxx();");
- this.createAnnotationAndMembers("Foo", "Object[] nestedAnnotations();");
- ICompilationUnit cu = this.createTestType("@annot.Foo(nestedAnnotations = { \"something\" })");
- String expected = "@annot.Foo(nestedAnnotations = { @Bar(xxx = 88) })";
- this.assertSourceDoesNotContain(expected, cu);
- this.idField(cu).edit(new Member.Editor() {
- public void edit(ModifiedDeclaration declaration) {
- NestedIndexedDeclarationAnnotationAdapterTests.this.editNewNormalAnnotation17(declaration);
- }
- });
- this.assertSourceContains(expected, cu);
- }
-
- void editNewNormalAnnotation17(ModifiedDeclaration declaration) {
- DeclarationAnnotationAdapter daa = new NestedIndexedDeclarationAnnotationAdapter(
- new SimpleDeclarationAnnotationAdapter("annot.Foo"), "nestedAnnotations", 0, "annot.Bar");
- NormalAnnotation annotation = (NormalAnnotation) daa.getAnnotation(declaration);
- assertNull(annotation);
- annotation = daa.newNormalAnnotation(declaration);
- this.addMemberValuePair(annotation, "xxx", 88);
- }
-
- public void testNewNormalAnnotation18() throws Exception {
- this.createAnnotationAndMembers("Bar", "int xxx();");
- this.createAnnotationAndMembers("Foo", "Object[] nestedAnnotations();");
- ICompilationUnit cu = this.createTestType("@annot.Foo(nestedAnnotations={\"something\"})");
- this.assertSourceDoesNotContain("@Bar", cu);
-
- DeclarationAnnotationAdapter daa = new NestedIndexedDeclarationAnnotationAdapter(
- new SimpleDeclarationAnnotationAdapter("annot.Foo"), "nestedAnnotations", 5, "annot.Bar");
- AnnotationAdapter aa = new MemberAnnotationAdapter(this.idField(cu), daa);
- Annotation annotation = aa.getAnnotation(this.buildASTRoot(cu));
- assertNull(annotation);
-
- aa.newNormalAnnotation();
- this.assertSourceContains("@Bar()})", cu); // split line
- }
-
- public void testNewNormalAnnotation19() throws Exception {
- this.createAnnotationAndMembers("Bar", "int xxx();");
- this.createAnnotationAndMembers("Foo", "Object[] nestedAnnotations();");
- ICompilationUnit cu = this.createTestType("@annot.Foo(nestedAnnotations = \"something\")");
- String expected = "@annot.Foo(nestedAnnotations = @Bar(xxx = 88))";
- this.assertSourceDoesNotContain(expected, cu);
- this.idField(cu).edit(new Member.Editor() {
- public void edit(ModifiedDeclaration declaration) {
- NestedIndexedDeclarationAnnotationAdapterTests.this.editNewNormalAnnotation19(declaration);
- }
- });
- this.assertSourceContains(expected, cu);
- }
-
- void editNewNormalAnnotation19(ModifiedDeclaration declaration) {
- DeclarationAnnotationAdapter daa = new NestedIndexedDeclarationAnnotationAdapter(
- new SimpleDeclarationAnnotationAdapter("annot.Foo"), "nestedAnnotations", 0, "annot.Bar");
- NormalAnnotation annotation = (NormalAnnotation) daa.getAnnotation(declaration);
- assertNull(annotation);
- annotation = daa.newNormalAnnotation(declaration);
- this.addMemberValuePair(annotation, "xxx", 88);
- }
-
- public void testNewNormalAnnotation20() throws Exception {
- this.createAnnotationAndMembers("NotBar", "int xxx();");
- this.createAnnotationAndMembers("Bar", "int xxx();");
- this.createAnnotationAndMembers("Foo", "Object[] nestedAnnotations();");
- ICompilationUnit cu = this.createTestType("@annot.Foo(nestedAnnotations = @annot.NotBar)");
- String expected = "@annot.Foo(nestedAnnotations = @Bar(xxx = 88))";
- this.assertSourceDoesNotContain(expected, cu);
- this.idField(cu).edit(new Member.Editor() {
- public void edit(ModifiedDeclaration declaration) {
- NestedIndexedDeclarationAnnotationAdapterTests.this.editNewNormalAnnotation20(declaration);
- }
- });
- this.assertSourceContains(expected, cu);
- }
-
- void editNewNormalAnnotation20(ModifiedDeclaration declaration) {
- DeclarationAnnotationAdapter daa = new NestedIndexedDeclarationAnnotationAdapter(
- new SimpleDeclarationAnnotationAdapter("annot.Foo"), "nestedAnnotations", 0, "annot.Bar");
- NormalAnnotation annotation = (NormalAnnotation) daa.getAnnotation(declaration);
- assertNull(annotation);
- annotation = daa.newNormalAnnotation(declaration);
- this.addMemberValuePair(annotation, "xxx", 88);
- }
-
- public void testNewNormalAnnotation21() throws Exception {
- this.createAnnotationAndMembers("NotBar", "int xxx();");
- this.createAnnotationAndMembers("Bar", "int xxx();");
- this.createAnnotationAndMembers("Foo", "Object[] nestedAnnotations();");
- ICompilationUnit cu = this.createTestType("@annot.Foo(nestedAnnotations=@annot.NotBar)");
- this.assertSourceDoesNotContain("@Bar", cu);
-
- DeclarationAnnotationAdapter daa = new NestedIndexedDeclarationAnnotationAdapter(
- new SimpleDeclarationAnnotationAdapter("annot.Foo"), "nestedAnnotations", 5, "annot.Bar");
- AnnotationAdapter aa = new MemberAnnotationAdapter(this.idField(cu), daa);
- Annotation annotation = aa.getAnnotation(this.buildASTRoot(cu));
- assertNull(annotation);
-
- aa.newNormalAnnotation();
- this.assertSourceContains("@annot.Foo(nestedAnnotations={@annot.NotBar,null,null,null,null,@Bar()})", cu);
- }
-
- public void testNewNormalAnnotation22() throws Exception {
- this.createAnnotationAndMembers("Bar", "int xxx();");
- this.createAnnotationAndMembers("Foo", "Object[] nestedAnnotations();");
- ICompilationUnit cu = this.createTestType("@annot.Foo(nestedAnnotations = @annot.Bar(77))");
- String expected = "@annot.Foo(nestedAnnotations = @Bar(xxx = 88))";
- this.assertSourceDoesNotContain(expected, cu);
- this.idField(cu).edit(new Member.Editor() {
- public void edit(ModifiedDeclaration declaration) {
- NestedIndexedDeclarationAnnotationAdapterTests.this.editNewNormalAnnotation22(declaration);
- }
- });
- this.assertSourceContains(expected, cu);
- }
-
- void editNewNormalAnnotation22(ModifiedDeclaration declaration) {
- DeclarationAnnotationAdapter daa = new NestedIndexedDeclarationAnnotationAdapter(
- new SimpleDeclarationAnnotationAdapter("annot.Foo"), "nestedAnnotations", 0, "annot.Bar");
- NormalAnnotation annotation = daa.newNormalAnnotation(declaration);
- this.addMemberValuePair(annotation, "xxx", 88);
- }
-
- public void testMoveAnnotation1() throws Exception {
- this.createAnnotationAndMembers("Bar", "int value();");
- this.createAnnotationAndMembers("Foo", "annot.Bar[] value();");
- ICompilationUnit cu = this.createTestType("@annot.Foo(@annot.Bar(00))");
- String expected = "@annot.Foo({null,@annot.Bar(00)})";
- this.assertSourceDoesNotContain(expected, cu);
-
- IndexedDeclarationAnnotationAdapter idaa = new NestedIndexedDeclarationAnnotationAdapter(
- new SimpleDeclarationAnnotationAdapter("annot.Foo"), "value", 0, "annot.Bar");
- IndexedAnnotationAdapter iaa = new MemberIndexedAnnotationAdapter(this.idField(cu), idaa);
- Annotation annotation = iaa.getAnnotation(this.buildASTRoot(cu));
- assertNotNull(annotation);
-
- iaa.moveAnnotation(1);
- this.assertSourceContains(expected, cu);
- }
-
- public void testMoveAnnotation2() throws Exception {
- this.createAnnotationAndMembers("Bar", "int value();");
- this.createAnnotationAndMembers("Foo", "annot.Bar[] value();");
- ICompilationUnit cu = this.createTestType("@annot.Foo({null, @annot.Bar(11)})");
- String expected = "@annot.Foo(@annot.Bar(11))";
- this.assertSourceDoesNotContain(expected, cu);
-
- IndexedDeclarationAnnotationAdapter idaa = new NestedIndexedDeclarationAnnotationAdapter(
- new SimpleDeclarationAnnotationAdapter("annot.Foo"), "value", 1, "annot.Bar");
- IndexedAnnotationAdapter iaa = new MemberIndexedAnnotationAdapter(this.idField(cu), idaa);
- Annotation annotation = iaa.getAnnotation(this.buildASTRoot(cu));
- assertNotNull(annotation);
-
- iaa.moveAnnotation(0);
- this.assertSourceContains(expected, cu);
- }
-
- public void testMoveAnnotation3() throws Exception {
- this.createAnnotationAndMembers("Bar", "int value();");
- this.createAnnotationAndMembers("Foo", "annot.Bar[] value();");
- ICompilationUnit cu = this.createTestType("@annot.Foo({@annot.Bar(00), @annot.Bar(11), @annot.Bar(22), @annot.Bar(33)})");
- String expected = "@annot.Foo({@annot.Bar(33), @annot.Bar(11), @annot.Bar(22)})";
- this.assertSourceDoesNotContain(expected, cu);
-
- IndexedDeclarationAnnotationAdapter idaa = new NestedIndexedDeclarationAnnotationAdapter(
- new SimpleDeclarationAnnotationAdapter("annot.Foo"), "value", 3, "annot.Bar");
- IndexedAnnotationAdapter iaa = new MemberIndexedAnnotationAdapter(this.idField(cu), idaa);
- Annotation annotation = iaa.getAnnotation(this.buildASTRoot(cu));
- assertNotNull(annotation);
-
- iaa.moveAnnotation(0);
- this.assertSourceContains(expected, cu);
- }
-
- public void testMoveAnnotation4() throws Exception {
- this.createAnnotationAndMembers("Bar", "int value();");
- this.createAnnotationAndMembers("Foo", "annot.Bar[] value();");
- ICompilationUnit cu = this.createTestType("@annot.Foo({@annot.Bar(00), @annot.Bar(11), @annot.Bar(22), @annot.Bar(33), @annot.Bar(44)})");
- String expected = "@annot.Foo({@annot.Bar(33), @annot.Bar(11), @annot.Bar(22), null, @annot.Bar(44)})";
- this.assertSourceDoesNotContain(expected, cu);
-
- IndexedDeclarationAnnotationAdapter idaa = new NestedIndexedDeclarationAnnotationAdapter(
- new SimpleDeclarationAnnotationAdapter("annot.Foo"), "value", 3, "annot.Bar");
- IndexedAnnotationAdapter iaa = new MemberIndexedAnnotationAdapter(this.idField(cu), idaa);
- Annotation annotation = iaa.getAnnotation(this.buildASTRoot(cu));
- assertNotNull(annotation);
-
- iaa.moveAnnotation(0);
- this.assertSourceContains(expected, cu);
- }
-
- public void testMoveAnnotation5() throws Exception {
- this.createAnnotationAndMembers("Bar", "int value();");
- this.createAnnotationAndMembers("Foo", "annot.Bar[] value();");
- ICompilationUnit cu = this.createTestType("@annot.Foo({@annot.Bar(00), @annot.Bar(11), @annot.Bar(22)})");
- String expected = "@annot.Foo({@annot.Bar(00), @annot.Bar(11), null, @annot.Bar(22)})";
- this.assertSourceDoesNotContain(expected, cu);
-
- IndexedDeclarationAnnotationAdapter idaa = new NestedIndexedDeclarationAnnotationAdapter(
- new SimpleDeclarationAnnotationAdapter("annot.Foo"), "value", 2, "annot.Bar");
- IndexedAnnotationAdapter iaa = new MemberIndexedAnnotationAdapter(this.idField(cu), idaa);
- Annotation annotation = iaa.getAnnotation(this.buildASTRoot(cu));
- assertNotNull(annotation);
-
- iaa.moveAnnotation(3);
- this.assertSourceContains(expected, cu);
- }
-
- public void testMoveAnnotation6() throws Exception {
- this.createAnnotationAndMembers("Bar", "int value();");
- this.createAnnotationAndMembers("Foo", "annot.Bar[] value();");
- ICompilationUnit cu = this.createTestType("@annot.Foo({@annot.Bar(00), @annot.Bar(11), @annot.Bar(22)})");
- String expected = "@annot.Foo({null, @annot.Bar(11), @annot.Bar(22), @annot.Bar(00)})";
- this.assertSourceDoesNotContain(expected, cu);
-
- IndexedDeclarationAnnotationAdapter idaa = new NestedIndexedDeclarationAnnotationAdapter(
- new SimpleDeclarationAnnotationAdapter("annot.Foo"), "value", 0, "annot.Bar");
- IndexedAnnotationAdapter iaa = new MemberIndexedAnnotationAdapter(this.idField(cu), idaa);
- Annotation annotation = iaa.getAnnotation(this.buildASTRoot(cu));
- assertNotNull(annotation);
-
- iaa.moveAnnotation(3);
- this.assertSourceContains(expected, cu);
- }
-
- public void testMoveAnnotation7() throws Exception {
- this.createAnnotationAndMembers("Bar", "int value();");
- this.createAnnotationAndMembers("Foo", "annot.Bar[] value();");
- ICompilationUnit cu = this.createTestType("@annot.Foo({@annot.Bar(00), @annot.Bar(11), @annot.Bar(22)})");
- String expected = "@annot.Foo({null, @annot.Bar(11), @annot.Bar(22)})";
- this.assertSourceDoesNotContain(expected, cu);
-
- IndexedDeclarationAnnotationAdapter idaa = new NestedIndexedDeclarationAnnotationAdapter(
- new SimpleDeclarationAnnotationAdapter("annot.Foo"), "value", 3, "annot.Bar");
- IndexedAnnotationAdapter iaa = new MemberIndexedAnnotationAdapter(this.idField(cu), idaa);
- Annotation annotation = iaa.getAnnotation(this.buildASTRoot(cu));
- assertNull(annotation);
-
- iaa.moveAnnotation(0);
- this.assertSourceContains(expected, cu);
- }
-
- public void testMoveAnnotation8() throws Exception {
- this.createAnnotationAndMembers("Bar", "int value();");
- this.createAnnotationAndMembers("Foo", "annot.Bar[] value();");
- ICompilationUnit cu = this.createTestType("@annot.Foo({@annot.Bar(00), @annot.Bar(11), @annot.Bar(22), null, @annot.Bar(44)})");
- String expected = "@annot.Foo({null, @annot.Bar(11), @annot.Bar(22), null, @annot.Bar(44)})";
- this.assertSourceDoesNotContain(expected, cu);
-
- IndexedDeclarationAnnotationAdapter idaa = new NestedIndexedDeclarationAnnotationAdapter(
- new SimpleDeclarationAnnotationAdapter("annot.Foo"), "value", 3, "annot.Bar");
- IndexedAnnotationAdapter iaa = new MemberIndexedAnnotationAdapter(this.idField(cu), idaa);
- Annotation annotation = iaa.getAnnotation(this.buildASTRoot(cu));
- assertNull(annotation);
-
- iaa.moveAnnotation(0);
- this.assertSourceContains(expected, cu);
- }
-
- public void testMoveAnnotation9() throws Exception {
- this.createAnnotationAndMembers("Bar", "int value();");
- this.createAnnotationAndMembers("Foo", "annot.Bar[] value();");
- String expected = "@annot.Foo({null, @annot.Bar(11), @annot.Bar(22)})";
- ICompilationUnit cu = this.createTestType(expected); // the source should be unchanged
-
- IndexedDeclarationAnnotationAdapter idaa = new NestedIndexedDeclarationAnnotationAdapter(
- new SimpleDeclarationAnnotationAdapter("annot.Foo"), "value", 0, "annot.Bar");
- IndexedAnnotationAdapter iaa = new MemberIndexedAnnotationAdapter(this.idField(cu), idaa);
- Annotation annotation = iaa.getAnnotation(this.buildASTRoot(cu));
- assertNull(annotation);
-
- iaa.moveAnnotation(3);
- this.assertSourceContains(expected, cu);
- }
-
- public void testMoveAnnotation10() throws Exception {
- this.createAnnotationAndMembers("Bar", "int value();");
- this.createAnnotationAndMembers("Foo", "annot.Bar[] value();");
- ICompilationUnit cu = this.createTestType("@annot.Foo({@annot.Bar(00), @annot.Bar(11)})");
- String expected = "@annot.Foo(@annot.Bar(00))";
-
- IndexedDeclarationAnnotationAdapter idaa = new NestedIndexedDeclarationAnnotationAdapter(
- new SimpleDeclarationAnnotationAdapter("annot.Foo"), "value", 2, "annot.Bar");
- IndexedAnnotationAdapter iaa = new MemberIndexedAnnotationAdapter(this.idField(cu), idaa);
- Annotation annotation = iaa.getAnnotation(this.buildASTRoot(cu));
- assertNull(annotation);
- iaa.moveAnnotation(1);
- this.assertSourceContains(expected, cu);
- }
-
- public void testMoveAnnotation11() throws Exception {
- this.createAnnotationAndMembers("Bar", "int value();");
- this.createAnnotationAndMembers("Foo", "annot.Bar[] value();");
- ICompilationUnit cu = this.createTestType("@annot.Foo(@annot.Bar(00))");
-
- IndexedDeclarationAnnotationAdapter idaa = new NestedIndexedDeclarationAnnotationAdapter(
- new SimpleDeclarationAnnotationAdapter("annot.Foo"), "value", 1, "annot.Bar");
- IndexedAnnotationAdapter iaa = new MemberIndexedAnnotationAdapter(this.idField(cu), idaa);
- Annotation annotation = iaa.getAnnotation(this.buildASTRoot(cu));
- assertNull(annotation);
-
- iaa.moveAnnotation(0);
- this.assertSourceDoesNotContain("Foo", cu);
- }
-
- public void testMoveAnnotation12() throws Exception {
- this.createAnnotationAndMembers("Bar", "int value();");
- this.createAnnotationAndMembers("Foo", "annot.Bar[] value();");
- ICompilationUnit cu = this.createTestType("@annot.Foo({@annot.Bar(00), null, @annot.Bar(22)})");
- String expected = "@annot.Foo(@annot.Bar(22))";
-
- IndexedDeclarationAnnotationAdapter idaa = new NestedIndexedDeclarationAnnotationAdapter(
- new SimpleDeclarationAnnotationAdapter("annot.Foo"), "value", 2, "annot.Bar");
- IndexedAnnotationAdapter iaa = new MemberIndexedAnnotationAdapter(this.idField(cu), idaa);
- Annotation annotation = iaa.getAnnotation(this.buildASTRoot(cu));
- assertNotNull(annotation);
-
- iaa.moveAnnotation(0);
- this.assertSourceContains(expected, cu);
- }
-
- public void testMoveAnnotation13() throws Exception {
- this.createAnnotationAndMembers("Bar", "int value();");
- this.createAnnotationAndMembers("Foo", "annot.Bar[] value();");
- ICompilationUnit cu = this.createTestType("@annot.Foo({@annot.Bar(00), @annot.Bar(11), null, @annot.Bar(33)})");
- String expected = "@annot.Foo({@annot.Bar(33), @annot.Bar(11)})";
-
- IndexedDeclarationAnnotationAdapter idaa = new NestedIndexedDeclarationAnnotationAdapter(
- new SimpleDeclarationAnnotationAdapter("annot.Foo"), "value", 3, "annot.Bar");
- IndexedAnnotationAdapter iaa = new MemberIndexedAnnotationAdapter(this.idField(cu), idaa);
- Annotation annotation = iaa.getAnnotation(this.buildASTRoot(cu));
- assertNotNull(annotation);
-
- iaa.moveAnnotation(0);
- this.assertSourceContains(expected, cu);
- }
-
-}
diff --git a/jpa/tests/org.eclipse.jpt.core.tests/src/org/eclipse/jpt/core/tests/internal/utility/jdt/SimpleDeclarationAnnotationAdapterTests.java b/jpa/tests/org.eclipse.jpt.core.tests/src/org/eclipse/jpt/core/tests/internal/utility/jdt/SimpleDeclarationAnnotationAdapterTests.java
deleted file mode 100644
index 58846359db..0000000000
--- a/jpa/tests/org.eclipse.jpt.core.tests/src/org/eclipse/jpt/core/tests/internal/utility/jdt/SimpleDeclarationAnnotationAdapterTests.java
+++ /dev/null
@@ -1,274 +0,0 @@
-/*******************************************************************************
- * Copyright (c) 2006, 2009 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.
- *
- * Contributors:
- * Oracle - initial API and implementation
- ******************************************************************************/
-package org.eclipse.jpt.core.tests.internal.utility.jdt;
-
-import org.eclipse.jdt.core.ICompilationUnit;
-import org.eclipse.jdt.core.dom.ASTNode;
-import org.eclipse.jdt.core.dom.Annotation;
-import org.eclipse.jdt.core.dom.Expression;
-import org.eclipse.jdt.core.dom.MemberValuePair;
-import org.eclipse.jdt.core.dom.NormalAnnotation;
-import org.eclipse.jdt.core.dom.NumberLiteral;
-import org.eclipse.jdt.core.dom.SingleMemberAnnotation;
-import org.eclipse.jdt.core.dom.StringLiteral;
-import org.eclipse.jpt.core.internal.utility.jdt.MemberAnnotationAdapter;
-import org.eclipse.jpt.core.internal.utility.jdt.SimpleDeclarationAnnotationAdapter;
-import org.eclipse.jpt.core.utility.jdt.AnnotationAdapter;
-import org.eclipse.jpt.core.utility.jdt.DeclarationAnnotationAdapter;
-import org.eclipse.jpt.core.utility.jdt.Member;
-import org.eclipse.jpt.core.utility.jdt.ModifiedDeclaration;
-
-@SuppressWarnings("nls")
-public class SimpleDeclarationAnnotationAdapterTests extends AnnotationTestCase {
-
- public SimpleDeclarationAnnotationAdapterTests(String name) {
- super(name);
- }
-
- private void createAnnotation(String annotationName) throws Exception {
- this.createAnnotation("annot", annotationName);
- }
-
- private void createAnnotation(String packageName, String annotationName) throws Exception {
- this.javaProject.createCompilationUnit(packageName, annotationName + ".java", "public @interface " + annotationName + " {}");
- }
-
- public void testAnnotation1() throws Exception {
- this.createAnnotation("Foo");
- ICompilationUnit cu = this.createTestType("@annot.Foo");
- DeclarationAnnotationAdapter daa = new SimpleDeclarationAnnotationAdapter("annot.Foo");
- AnnotationAdapter aa = new MemberAnnotationAdapter(this.idField(cu), daa);
- Annotation annotation = aa.getAnnotation(this.buildASTRoot(cu));
- assertNotNull(annotation);
- assertEquals("annot.Foo", annotation.getTypeName().getFullyQualifiedName());
- assertTrue(annotation.isMarkerAnnotation());
- }
-
- public void testAnnotation2() throws Exception {
- this.createAnnotation("Foo");
- ICompilationUnit cu = this.createTestType("@annot.Foo(1) @annot.Foo(2)");
- DeclarationAnnotationAdapter daa = new SimpleDeclarationAnnotationAdapter("annot.Foo");
- AnnotationAdapter aa = new MemberAnnotationAdapter(this.idField(cu), daa);
- Annotation annotation = aa.getAnnotation(this.buildASTRoot(cu));
- assertNotNull(annotation);
- assertEquals("annot.Foo", annotation.getTypeName().getFullyQualifiedName());
- assertTrue(annotation.isSingleMemberAnnotation());
- Expression value = ((SingleMemberAnnotation) annotation).getValue();
- assertEquals(ASTNode.NUMBER_LITERAL, value.getNodeType());
- assertEquals("1", ((NumberLiteral) value).getToken());
- }
-
- public void testAnnotation3() throws Exception {
- this.createAnnotation("Foo");
- ICompilationUnit cu = this.createTestType("annot.Foo", "@Foo");
- DeclarationAnnotationAdapter daa = new SimpleDeclarationAnnotationAdapter("annot.Foo");
- AnnotationAdapter aa = new MemberAnnotationAdapter(this.idField(cu), daa);
- Annotation annotation = aa.getAnnotation(this.buildASTRoot(cu));
- assertNotNull(annotation);
- assertEquals("Foo", annotation.getTypeName().getFullyQualifiedName());
- assertTrue(annotation.isMarkerAnnotation());
- }
-
- public void testAnnotationNull1() throws Exception {
- this.createAnnotation("Foo");
- ICompilationUnit cu = this.createTestType();
- DeclarationAnnotationAdapter daa = new SimpleDeclarationAnnotationAdapter("annot.Foo");
- AnnotationAdapter aa = new MemberAnnotationAdapter(this.idField(cu), daa);
- Annotation annotation = aa.getAnnotation(this.buildASTRoot(cu));
- assertNull(annotation);
- }
-
- public void testAnnotationNull2() throws Exception {
- this.createAnnotation("Foo");
- this.createAnnotation("Fop");
- ICompilationUnit cu = this.createTestType("@annot.Fop");
- DeclarationAnnotationAdapter daa = new SimpleDeclarationAnnotationAdapter("annot.Foo");
- AnnotationAdapter aa = new MemberAnnotationAdapter(this.idField(cu), daa);
- Annotation annotation = aa.getAnnotation(this.buildASTRoot(cu));
- assertNull(annotation);
- this.assertSourceContains("@annot.Fop", cu);
- }
-
- public void testAnnotationNull3() throws Exception {
- this.createAnnotation("Foo");
- ICompilationUnit cu = this.createTestType("@annot.Foo");
- // un-qualified name
- DeclarationAnnotationAdapter daa = new SimpleDeclarationAnnotationAdapter("Foo");
- AnnotationAdapter aa = new MemberAnnotationAdapter(this.idField(cu), daa);
- Annotation annotation = aa.getAnnotation(this.buildASTRoot(cu));
- assertNull(annotation);
- this.assertSourceContains("@annot.Foo", cu);
- }
-
- public void testRemoveAnnotation1() throws Exception {
- this.createAnnotation("Foo");
- ICompilationUnit cu = this.createTestType("@annot.Foo");
- this.assertSourceContains("@annot.Foo", cu);
- DeclarationAnnotationAdapter daa = new SimpleDeclarationAnnotationAdapter("annot.Foo");
- AnnotationAdapter aa = new MemberAnnotationAdapter(this.idField(cu), daa);
- Annotation annotation = aa.getAnnotation(this.buildASTRoot(cu));
- assertNotNull(annotation);
-
- aa.removeAnnotation();
- this.assertSourceDoesNotContain("@annot.Foo", cu);
- }
-
- public void testRemoveAnnotation2() throws Exception {
- this.createAnnotation("Foo");
- ICompilationUnit cu = this.createTestType("@annot.Foo(1) @annot.Foo(2)");
- this.assertSourceContains("@annot.Foo(1) @annot.Foo(2)", cu);
- DeclarationAnnotationAdapter daa = new SimpleDeclarationAnnotationAdapter("annot.Foo");
- AnnotationAdapter aa = new MemberAnnotationAdapter(this.idField(cu), daa);
- Annotation annotation = aa.getAnnotation(this.buildASTRoot(cu));
- assertNotNull(annotation);
-
- aa.removeAnnotation();
- this.assertSourceDoesNotContain("@annot.Foo(1)", cu);
- this.assertSourceContains("@annot.Foo(2)", cu);
- }
-
- public void testNewMarkerAnnotation1() throws Exception {
- this.createAnnotation("Foo");
- ICompilationUnit cu = this.createTestType();
- this.assertSourceDoesNotContain("import annot.Foo;", cu);
- this.assertSourceDoesNotContain("@Foo", cu);
- DeclarationAnnotationAdapter daa = new SimpleDeclarationAnnotationAdapter("annot.Foo");
- AnnotationAdapter aa = new MemberAnnotationAdapter(this.idField(cu), daa);
- Annotation annotation = aa.getAnnotation(this.buildASTRoot(cu));
- assertNull(annotation);
-
- aa.newMarkerAnnotation();
- this.assertSourceContains("import annot.Foo;", cu);
- this.assertSourceContains("@Foo", cu);
- }
-
- public void testNewMarkerAnnotation2() throws Exception {
- this.createAnnotation("Foo");
- ICompilationUnit cu = this.createTestType("@annot.Foo(88)");
- DeclarationAnnotationAdapter daa = new SimpleDeclarationAnnotationAdapter("annot.Foo");
- AnnotationAdapter aa = new MemberAnnotationAdapter(this.idField(cu), daa);
- Annotation annotation = aa.getAnnotation(this.buildASTRoot(cu));
- assertNotNull(annotation);
-
- aa.newMarkerAnnotation();
- this.assertSourceContains("import annot.Foo;", cu);
- this.assertSourceContains("@Foo", cu);
- this.assertSourceDoesNotContain("@annot.Foo(88)", cu);
- }
-
- public void testNewSingleMemberAnnotation() throws Exception {
- this.createAnnotation("Foo");
- ICompilationUnit cu = this.createTestType();
- this.assertSourceDoesNotContain("@Foo", cu);
- this.idField(cu).edit(new Member.Editor() {
- public void edit(ModifiedDeclaration declaration) {
- SimpleDeclarationAnnotationAdapterTests.this.editNewSingleMemberAnnotation(declaration);
- }
- });
- this.assertSourceContains("import annot.Foo;", cu);
- this.assertSourceContains("@Foo(\"test string literal\")", cu);
- }
-
- void editNewSingleMemberAnnotation(ModifiedDeclaration declaration) {
- DeclarationAnnotationAdapter daa = new SimpleDeclarationAnnotationAdapter("annot.Foo");
- SingleMemberAnnotation annotation = (SingleMemberAnnotation) daa.getAnnotation(declaration);
- assertNull(annotation);
- annotation = daa.newSingleMemberAnnotation(declaration);
- StringLiteral stringLiteral = annotation.getAST().newStringLiteral();
- stringLiteral.setLiteralValue("test string literal");
- annotation.setValue(stringLiteral);
- }
-
- public void testNewNormalAnnotation() throws Exception {
- this.createAnnotation("Foo");
- ICompilationUnit cu = this.createTestType();
- this.assertSourceDoesNotContain("@Foo", cu);
- this.idField(cu).edit(new Member.Editor() {
- public void edit(ModifiedDeclaration declaration) {
- SimpleDeclarationAnnotationAdapterTests.this.editNewNormalAnnotation(declaration);
- }
- });
- this.assertSourceContains("import annot.Foo;", cu);
- this.assertSourceContains("@Foo(bar = \"test string literal\")", cu);
- }
-
- void editNewNormalAnnotation(ModifiedDeclaration declaration) {
- DeclarationAnnotationAdapter daa = new SimpleDeclarationAnnotationAdapter("annot.Foo");
- NormalAnnotation annotation = (NormalAnnotation) daa.getAnnotation(declaration);
- assertNull(annotation);
- annotation = daa.newNormalAnnotation(declaration);
- MemberValuePair mvp = this.newMemberValuePair(annotation.getAST(), "bar", "test string literal");
- this.values(annotation).add(mvp);
- }
-
- public void testImportCollision1() throws Exception {
- this.createAnnotation("annot1", "Foo");
- this.createAnnotation("annot2", "Foo");
- ICompilationUnit cu = this.createTestType();
- this.assertSourceDoesNotContain("@Foo", cu);
- DeclarationAnnotationAdapter daa1 = new SimpleDeclarationAnnotationAdapter("annot1.Foo");
- DeclarationAnnotationAdapter daa2 = new SimpleDeclarationAnnotationAdapter("annot2.Foo");
-
- AnnotationAdapter aa1 = new MemberAnnotationAdapter(this.idField(cu), daa1);
- Annotation annotation1 = aa1.getAnnotation(this.buildASTRoot(cu));
- assertNull(annotation1);
-
- AnnotationAdapter aa2 = new MemberAnnotationAdapter(this.idField(cu), daa2);
- Annotation annotation2 = aa2.getAnnotation(this.buildASTRoot(cu));
- assertNull(annotation2);
-
- aa1.newMarkerAnnotation();
- this.assertSourceContains("import annot1.Foo;", cu);
- this.assertSourceContains("@Foo", cu);
-
- aa2.newMarkerAnnotation();
- this.assertSourceDoesNotContain("import annot2.Foo;", cu);
- this.assertSourceContains("@annot2.Foo", cu);
- }
-
- public void testImportCollision2() throws Exception {
- this.createAnnotation("annot1", "Foo");
- this.createAnnotation("annot2", "Foo");
- ICompilationUnit cu = this.createTestType("annot1.*", "@Foo");
- this.assertSourceContains("import annot1.*;", cu);
- this.assertSourceContains("@Foo", cu);
- DeclarationAnnotationAdapter daa1 = new SimpleDeclarationAnnotationAdapter("annot1.Foo");
- DeclarationAnnotationAdapter daa2 = new SimpleDeclarationAnnotationAdapter("annot2.Foo");
-
- AnnotationAdapter aa1 = new MemberAnnotationAdapter(this.idField(cu), daa1);
- Annotation annotation1 = aa1.getAnnotation(this.buildASTRoot(cu));
- assertNotNull(annotation1);
-
- AnnotationAdapter aa2 = new MemberAnnotationAdapter(this.idField(cu), daa2);
- Annotation annotation2 = aa2.getAnnotation(this.buildASTRoot(cu));
- assertNull(annotation2);
-
- aa2.newMarkerAnnotation();
- this.assertSourceDoesNotContain("import annot2.Foo;", cu);
- this.assertSourceContains("@annot2.Foo", cu);
- }
-
- public void testImportWildCard() throws Exception {
- this.createAnnotation("Foo");
- ICompilationUnit cu = this.createTestType("annot.*", "");
- this.assertSourceContains("import annot.*;", cu);
- this.assertSourceDoesNotContain("@Foo", cu);
- DeclarationAnnotationAdapter daa1 = new SimpleDeclarationAnnotationAdapter("annot.Foo");
-
- AnnotationAdapter aa1 = new MemberAnnotationAdapter(this.idField(cu), daa1);
- Annotation annotation1 = aa1.getAnnotation(this.buildASTRoot(cu));
- assertNull(annotation1);
-
- aa1.newMarkerAnnotation();
- this.assertSourceDoesNotContain("import annot.Foo;", cu);
- this.assertSourceContains("@Foo", cu);
- }
-
-}
diff --git a/jpa/tests/org.eclipse.jpt.core.tests/src/org/eclipse/jpt/core/tests/internal/utility/jdt/TypeTests.java b/jpa/tests/org.eclipse.jpt.core.tests/src/org/eclipse/jpt/core/tests/internal/utility/jdt/TypeTests.java
deleted file mode 100644
index 8efb3bef1b..0000000000
--- a/jpa/tests/org.eclipse.jpt.core.tests/src/org/eclipse/jpt/core/tests/internal/utility/jdt/TypeTests.java
+++ /dev/null
@@ -1,51 +0,0 @@
-/*******************************************************************************
- * Copyright (c) 2006, 2008 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.
- *
- * Contributors:
- * Oracle - initial API and implementation
- ******************************************************************************/
-package org.eclipse.jpt.core.tests.internal.utility.jdt;
-
-import org.eclipse.core.runtime.CoreException;
-import org.eclipse.jdt.core.ICompilationUnit;
-
-public class TypeTests extends AnnotationTestCase {
-
- public TypeTests(String name) {
- super(name);
- }
-
- @Override
- protected void setUp() throws Exception {
- super.setUp();
- }
-
- protected ICompilationUnit createCompilationUnit(String source) throws CoreException {
- return this.javaProject.createCompilationUnit(PACKAGE_NAME, FILE_NAME, source);
- }
-
- @Override
- protected void tearDown() throws Exception {
- super.tearDown();
- }
-
- public void test1() throws Exception {
- ICompilationUnit jdtCompilationUnit = this.createCompilationUnit(this.buildTest1Source());
- assertNotNull(jdtCompilationUnit);
- }
-
- private String buildTest1Source() {
- StringBuilder sb = new StringBuilder();
- sb.append("public class ").append(TYPE_NAME).append(" {").append(CR);
- sb.append(" private int id;").append(CR);
- sb.append(" public int getId() {").append(CR);
- sb.append(" return this.id;").append(CR);
- sb.append(" }").append(CR);
- sb.append("}").append(CR);
- return sb.toString();
- }
-
-}
diff --git a/jpa/tests/org.eclipse.jpt.core.tests/src/org/eclipse/jpt2_0/core/tests/internal/context/java/Generic2_0ContextModelTestCase.java b/jpa/tests/org.eclipse.jpt.core.tests/src/org/eclipse/jpt2_0/core/tests/internal/context/java/Generic2_0ContextModelTestCase.java
deleted file mode 100644
index e29e649be5..0000000000
--- a/jpa/tests/org.eclipse.jpt.core.tests/src/org/eclipse/jpt2_0/core/tests/internal/context/java/Generic2_0ContextModelTestCase.java
+++ /dev/null
@@ -1,35 +0,0 @@
-/*******************************************************************************
- * Copyright (c) 2009 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
- *
- * Contributors:
- * Oracle - initial API and implementation
- *******************************************************************************/
-package org.eclipse.jpt2_0.core.tests.internal.context.java;
-
-import org.eclipse.jpt.core.internal.facet.JpaFacetDataModelProperties;
-import org.eclipse.jpt.core.internal.facet.JpaFacetDataModelProvider;
-import org.eclipse.jpt.core.tests.internal.context.ContextModelTestCase;
-import org.eclipse.jpt2_0.core.internal.platform.Generic2_0JpaPlatformProvider;
-import org.eclipse.wst.common.componentcore.datamodel.properties.IFacetDataModelProperties;
-import org.eclipse.wst.common.frameworks.datamodel.DataModelFactory;
-import org.eclipse.wst.common.frameworks.datamodel.IDataModel;
-
-public abstract class Generic2_0ContextModelTestCase extends ContextModelTestCase
-{
- protected Generic2_0ContextModelTestCase(String name) {
- super(name);
- }
-
- @Override
- protected IDataModel buildJpaConfigDataModel() {
- IDataModel dataModel = DataModelFactory.createDataModel(new JpaFacetDataModelProvider());
- dataModel.setProperty(IFacetDataModelProperties.FACET_VERSION_STR, "2.0"); //$NON-NLS-1$
- dataModel.setProperty(JpaFacetDataModelProperties.PLATFORM_ID, Generic2_0JpaPlatformProvider.ID);
- dataModel.setProperty(JpaFacetDataModelProperties.CREATE_ORM_XML, Boolean.TRUE);
- return dataModel;
- }
-}
diff --git a/jpa/tests/org.eclipse.jpt.core.tests/src/org/eclipse/jpt2_0/core/tests/internal/context/java/Generic2_0JavaContextModelTests.java b/jpa/tests/org.eclipse.jpt.core.tests/src/org/eclipse/jpt2_0/core/tests/internal/context/java/Generic2_0JavaContextModelTests.java
deleted file mode 100644
index f569828914..0000000000
--- a/jpa/tests/org.eclipse.jpt.core.tests/src/org/eclipse/jpt2_0/core/tests/internal/context/java/Generic2_0JavaContextModelTests.java
+++ /dev/null
@@ -1,32 +0,0 @@
-/*******************************************************************************
- * Copyright (c) 2009 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
- *
- * Contributors:
- * Oracle - initial API and implementation
- *******************************************************************************/
-package org.eclipse.jpt2_0.core.tests.internal.context.java;
-
-import junit.framework.Test;
-import junit.framework.TestCase;
-import junit.framework.TestSuite;
-
-public class Generic2_0JavaContextModelTests extends TestCase
-{
- public static Test suite() {
- TestSuite suite = new TestSuite(Generic2_0JavaContextModelTests.class.getName());
- suite.addTestSuite(Generic2_0JavaPersistentTypeTests.class);
- suite.addTestSuite(Generic2_0JavaPersistentAttributeTests.class);
-
- suite.addTestSuite(Generic2_0JavaSequenceGeneratorTests.class);
- return suite;
- }
-
- private Generic2_0JavaContextModelTests() {
- super();
- throw new UnsupportedOperationException();
- }
-}
diff --git a/jpa/tests/org.eclipse.jpt.core.tests/src/org/eclipse/jpt2_0/core/tests/internal/context/java/Generic2_0JavaPersistentAttributeTests.java b/jpa/tests/org.eclipse.jpt.core.tests/src/org/eclipse/jpt2_0/core/tests/internal/context/java/Generic2_0JavaPersistentAttributeTests.java
deleted file mode 100644
index 7c8503f831..0000000000
--- a/jpa/tests/org.eclipse.jpt.core.tests/src/org/eclipse/jpt2_0/core/tests/internal/context/java/Generic2_0JavaPersistentAttributeTests.java
+++ /dev/null
@@ -1,110 +0,0 @@
-/*******************************************************************************
- * Copyright (c) 2009 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.
- *
- * Contributors:
- * Oracle - initial API and implementation
- ******************************************************************************/
-package org.eclipse.jpt2_0.core.tests.internal.context.java;
-
-import java.util.Iterator;
-import org.eclipse.jdt.core.ICompilationUnit;
-import org.eclipse.jpt.core.MappingKeys;
-import org.eclipse.jpt.core.context.AccessType;
-import org.eclipse.jpt.core.context.PersistentAttribute;
-import org.eclipse.jpt.core.resource.java.JPA;
-import org.eclipse.jpt.utility.internal.iterators.ArrayIterator;
-
-@SuppressWarnings("nls")
-public class Generic2_0JavaPersistentAttributeTests extends Generic2_0ContextModelTestCase
-{
-
- private ICompilationUnit createTestEntitySpecifiedAccessField() throws Exception {
- return this.createTestType(new DefaultAnnotationWriter() {
- @Override
- public Iterator<String> imports() {
- return new ArrayIterator<String>(JPA.ENTITY, JPA.ID, JPA.BASIC, JPA.TRANSIENT, JPA.ACCESS, JPA.ACCESS_TYPE);
- }
- @Override
- public void appendTypeAnnotationTo(StringBuilder sb) {
- sb.append("@Entity");
- sb.append("@Access(AccessType.FIELD)");
- }
- @Override
- public void appendNameFieldAnnotationTo(StringBuilder sb) {
- sb.append("@Basic");
- }
- @Override
- public void appendIdFieldAnnotationTo(StringBuilder sb) {
- sb.append("transient");
- }
- @Override
- public void appendGetIdMethodAnnotationTo(StringBuilder sb) {
- sb.append("@Id");
- sb.append("@Access(AccessType.PROPERTY)");
- }
- });
- }
-
- private ICompilationUnit createTestEntitySpecifiedAccessProperty() throws Exception {
- return this.createTestType(new DefaultAnnotationWriter() {
- @Override
- public Iterator<String> imports() {
- return new ArrayIterator<String>(JPA.ENTITY, JPA.ID, JPA.BASIC, JPA.ACCESS, JPA.ACCESS_TYPE);
- }
- @Override
- public void appendTypeAnnotationTo(StringBuilder sb) {
- sb.append("@Entity");
- sb.append("@Access(AccessType.PROPERTY)");
- }
- @Override
- public void appendNameFieldAnnotationTo(StringBuilder sb) {
- sb.append("@Basic");
- sb.append("@Access(AccessType.FIELD)");
- }
- @Override
- public void appendGetIdMethodAnnotationTo(StringBuilder sb) {
- sb.append("@Id");
- }
- });
- }
-
-
- public Generic2_0JavaPersistentAttributeTests(String name) {
- super(name);
- }
-
- public void testGetAccessField() throws Exception {
- createTestEntitySpecifiedAccessField();
- addXmlClassRef(FULLY_QUALIFIED_TYPE_NAME);
-
- PersistentAttribute namePersistentAttribute = getJavaPersistentType().getAttributeNamed("name");
- assertEquals(AccessType.FIELD, namePersistentAttribute.getAccess());
- assertEquals(AccessType.FIELD, namePersistentAttribute.getDefaultAccess());
- assertEquals(null, namePersistentAttribute.getSpecifiedAccess());
-
- PersistentAttribute idPersistentAttribute = getJavaPersistentType().getAttributeNamed("id");
- assertEquals(MappingKeys.ID_ATTRIBUTE_MAPPING_KEY, idPersistentAttribute.getMappingKey());
- assertEquals(AccessType.PROPERTY, idPersistentAttribute.getAccess());
- assertEquals(AccessType.PROPERTY, idPersistentAttribute.getDefaultAccess());
- assertEquals(AccessType.PROPERTY, idPersistentAttribute.getSpecifiedAccess());
- }
-
- public void testGetAccessProperty() throws Exception {
- createTestEntitySpecifiedAccessProperty();
- addXmlClassRef(FULLY_QUALIFIED_TYPE_NAME);
-
- PersistentAttribute namePersistentAttribute = getJavaPersistentType().getAttributeNamed("name");
- assertEquals(AccessType.FIELD, namePersistentAttribute.getAccess());
- assertEquals(AccessType.FIELD, namePersistentAttribute.getDefaultAccess());
- assertEquals(AccessType.FIELD, namePersistentAttribute.getSpecifiedAccess());
-
- PersistentAttribute idPersistentAttribute = getJavaPersistentType().getAttributeNamed("id");
- assertEquals(MappingKeys.ID_ATTRIBUTE_MAPPING_KEY, idPersistentAttribute.getMappingKey());
- assertEquals(AccessType.PROPERTY, idPersistentAttribute.getAccess());
- assertEquals(AccessType.PROPERTY, idPersistentAttribute.getDefaultAccess());
- assertEquals(null, idPersistentAttribute.getSpecifiedAccess());
- }
-}
diff --git a/jpa/tests/org.eclipse.jpt.core.tests/src/org/eclipse/jpt2_0/core/tests/internal/context/java/Generic2_0JavaPersistentTypeTests.java b/jpa/tests/org.eclipse.jpt.core.tests/src/org/eclipse/jpt2_0/core/tests/internal/context/java/Generic2_0JavaPersistentTypeTests.java
deleted file mode 100644
index 7bed521743..0000000000
--- a/jpa/tests/org.eclipse.jpt.core.tests/src/org/eclipse/jpt2_0/core/tests/internal/context/java/Generic2_0JavaPersistentTypeTests.java
+++ /dev/null
@@ -1,853 +0,0 @@
-/*******************************************************************************
- * Copyright (c) 2009 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.
- *
- * Contributors:
- * Oracle - initial API and implementation
- ******************************************************************************/
-package org.eclipse.jpt2_0.core.tests.internal.context.java;
-
-import java.util.Iterator;
-import java.util.ListIterator;
-import org.eclipse.jdt.core.ICompilationUnit;
-import org.eclipse.jdt.core.IField;
-import org.eclipse.jpt.core.MappingKeys;
-import org.eclipse.jpt.core.context.AccessType;
-import org.eclipse.jpt.core.context.PersistentAttribute;
-import org.eclipse.jpt.core.context.PersistentType;
-import org.eclipse.jpt.core.context.java.JavaPersistentAttribute;
-import org.eclipse.jpt.core.context.java.JavaPersistentType;
-import org.eclipse.jpt.core.context.orm.OrmPersistentType;
-import org.eclipse.jpt.core.context.persistence.ClassRef;
-import org.eclipse.jpt.core.resource.java.EmbeddableAnnotation;
-import org.eclipse.jpt.core.resource.java.EntityAnnotation;
-import org.eclipse.jpt.core.resource.java.JPA;
-import org.eclipse.jpt.core.resource.java.JavaResourcePersistentType;
-import org.eclipse.jpt.core.resource.java.TransientAnnotation;
-import org.eclipse.jpt.core.tests.internal.projects.TestJavaProject.SourceWriter;
-import org.eclipse.jpt.utility.internal.iterators.ArrayIterator;
-
-@SuppressWarnings("nls")
-public class Generic2_0JavaPersistentTypeTests extends Generic2_0ContextModelTestCase
-{
-
- private ICompilationUnit createTestEntity() 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");
- }
- });
- }
-
- private ICompilationUnit createTestEntityAnnotatedField() 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("@Id");
- }
- });
- }
-
- private ICompilationUnit createTestEntityAnnotatedMethod() 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 appendGetIdMethodAnnotationTo(StringBuilder sb) {
- sb.append("@Id");
- }
- });
- }
-
- private ICompilationUnit createTestEntityAnnotatedFieldAndMethod() 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 appendGetIdMethodAnnotationTo(StringBuilder sb) {
- sb.append("@Id");
- }
-
- @Override
- public void appendIdFieldAnnotationTo(StringBuilder sb) {
- sb.append("@Id");
- }
- });
- }
-
- private ICompilationUnit createTestEntityAnnotatedFieldPropertySpecified() throws Exception {
- return this.createTestType(new DefaultAnnotationWriter() {
- @Override
- public Iterator<String> imports() {
- return new ArrayIterator<String>(JPA.ENTITY, JPA.BASIC, JPA.ID, JPA.ACCESS, JPA.ACCESS_TYPE);
- }
- @Override
- public void appendTypeAnnotationTo(StringBuilder sb) {
- sb.append("@Entity").append(CR);
- sb.append("@Access(AccessType.PROPERTY)");
- }
-
- @Override
- public void appendNameFieldAnnotationTo(StringBuilder sb) {
- sb.append("@Basic").append(CR);
- sb.append(" @Access(AccessType.FIELD)");
- }
-
- @Override
- public void appendGetIdMethodAnnotationTo(StringBuilder sb) {
- sb.append("@Id");
- }
- });
- }
-
- private ICompilationUnit createTestEntityAnnotatedPropertyFieldSpecified() throws Exception {
- return this.createTestType(new DefaultAnnotationWriter() {
- @Override
- public Iterator<String> imports() {
- return new ArrayIterator<String>(JPA.ENTITY, JPA.ID, JPA.ACCESS, JPA.ACCESS_TYPE);
- }
- @Override
- public void appendTypeAnnotationTo(StringBuilder sb) {
- sb.append("@Entity");
- sb.append("@Access(AccessType.FIELD)");
- }
-
- @Override
- public void appendGetIdMethodAnnotationTo(StringBuilder sb) {
- sb.append("@Id");
- sb.append("@Access(AccessType.PROPERTY)");
- }
- });
- }
-
- private ICompilationUnit createTestSubType() throws Exception {
- return this.createTestType(PACKAGE_NAME, "AnnotationTestTypeChild.java", "AnnotationTestTypeChild", new DefaultAnnotationWriter() {
- @Override
- public Iterator<String> imports() {
- return new ArrayIterator<String>(JPA.ENTITY);
- }
- @Override
- public void appendExtendsImplementsTo(StringBuilder sb) {
- sb.append("extends " + TYPE_NAME + " ");
- }
- @Override
- public void appendTypeAnnotationTo(StringBuilder sb) {
- sb.append("@Entity");
- }
-
- });
- }
-
- private ICompilationUnit createTestSubTypeWithFieldAnnotation() throws Exception {
- return this.createTestType(PACKAGE_NAME, "AnnotationTestTypeChild.java", "AnnotationTestTypeChild", new DefaultAnnotationWriter() {
- @Override
- public Iterator<String> imports() {
- return new ArrayIterator<String>(JPA.ENTITY, JPA.ID);
- }
- @Override
- public void appendExtendsImplementsTo(StringBuilder sb) {
- sb.append("extends " + TYPE_NAME + " ");
- }
- @Override
- public void appendTypeAnnotationTo(StringBuilder sb) {
- sb.append("@Entity");
- }
-
- @Override
- public void appendIdFieldAnnotationTo(StringBuilder sb) {
- sb.append("@Id");
- }
- });
- }
-
- private ICompilationUnit createTestSubTypeWithMethodAnnotation() throws Exception {
- return this.createTestType(PACKAGE_NAME, "AnnotationTestTypeChild.java", "AnnotationTestTypeChild", new DefaultAnnotationWriter() {
- @Override
- public Iterator<String> imports() {
- return new ArrayIterator<String>(JPA.ENTITY, JPA.ID);
- }
- @Override
- public void appendExtendsImplementsTo(StringBuilder sb) {
- sb.append("extends " + TYPE_NAME + " ");
- }
- @Override
- public void appendTypeAnnotationTo(StringBuilder sb) {
- sb.append("@Entity");
- }
-
- @Override
- public void appendGetIdMethodAnnotationTo(StringBuilder sb) {
- sb.append("@Id");
- }
- });
- }
-
- private ICompilationUnit createTestSubTypeNonPersistent() throws Exception {
- return this.createTestType(PACKAGE_NAME, "AnnotationTestTypeChild.java", "AnnotationTestTypeChild", new DefaultAnnotationWriter() {
- @Override
- public void appendExtendsImplementsTo(StringBuilder sb) {
- sb.append("extends " + TYPE_NAME + " ");
- }
- });
- }
-
- private ICompilationUnit createTestSubTypePersistentExtendsNonPersistent() throws Exception {
- return this.createTestType(PACKAGE_NAME, "AnnotationTestTypeChild2.java", "AnnotationTestTypeChild2", new DefaultAnnotationWriter() {
- @Override
- public Iterator<String> imports() {
- return new ArrayIterator<String>(JPA.ENTITY, JPA.ID);
- }
- @Override
- public void appendExtendsImplementsTo(StringBuilder sb) {
- sb.append("extends AnnotationTestTypeChild ");
- }
- @Override
- public void appendTypeAnnotationTo(StringBuilder sb) {
- sb.append("@Entity");
- }
-
- @Override
- public void appendGetIdMethodAnnotationTo(StringBuilder sb) {
- sb.append("@Id");
- }
- });
- }
-
- public Generic2_0JavaPersistentTypeTests(String name) {
- super(name);
- }
-
- public void testGetName() throws Exception {
- createTestType();
- addXmlClassRef(FULLY_QUALIFIED_TYPE_NAME);
-
- assertEquals(FULLY_QUALIFIED_TYPE_NAME, getJavaPersistentType().getName());
- }
-
- public void testGetAccessNothingAnnotated() throws Exception {
- createTestType();
- addXmlClassRef(FULLY_QUALIFIED_TYPE_NAME);
-
- assertEquals(AccessType.FIELD, getJavaPersistentType().getAccess());
- }
-
- public void testAccessField() throws Exception {
- createTestEntityAnnotatedField();
- addXmlClassRef(FULLY_QUALIFIED_TYPE_NAME);
-
- assertEquals(AccessType.FIELD, getJavaPersistentType().getAccess());
- }
-
- public void testAccessProperty() throws Exception {
- createTestEntityAnnotatedMethod();
- addXmlClassRef(FULLY_QUALIFIED_TYPE_NAME);
-
- assertEquals(AccessType.PROPERTY, getJavaPersistentType().getAccess());
- }
-
- public void testAccessFieldAndMethodAnnotated() throws Exception {
- createTestEntityAnnotatedFieldAndMethod();
- addXmlClassRef(FULLY_QUALIFIED_TYPE_NAME);
-
- assertEquals(AccessType.FIELD, getJavaPersistentType().getAccess());
- }
-
- public void testAccessFieldAnnotatedPropertySpecified() throws Exception {
- createTestEntityAnnotatedFieldPropertySpecified();
- addXmlClassRef(FULLY_QUALIFIED_TYPE_NAME);
-
- assertEquals(AccessType.PROPERTY, getJavaPersistentType().getAccess());
-
- ListIterator<JavaPersistentAttribute> attributes = getJavaPersistentType().attributes();
- JavaPersistentAttribute javaPersistentAttribute = attributes.next();
- assertEquals("id", javaPersistentAttribute.getName());
- assertEquals(AccessType.PROPERTY, javaPersistentAttribute.getAccess());
- assertEquals(MappingKeys.ID_ATTRIBUTE_MAPPING_KEY, javaPersistentAttribute.getMappingKey());
-
- javaPersistentAttribute = attributes.next();
- assertEquals("name", javaPersistentAttribute.getName());
- assertEquals(AccessType.FIELD, javaPersistentAttribute.getAccess());
- assertEquals(MappingKeys.BASIC_ATTRIBUTE_MAPPING_KEY, javaPersistentAttribute.getSpecifiedMapping().getKey());
-
- assertFalse(attributes.hasNext());
- }
-
- public void testAccessPropertyAnnotatedFieldSpecified() throws Exception {
- createTestEntityAnnotatedPropertyFieldSpecified();
- addXmlClassRef(FULLY_QUALIFIED_TYPE_NAME);
-
- assertEquals(AccessType.FIELD, getJavaPersistentType().getAccess());
-
- ListIterator<JavaPersistentAttribute> attributes = getJavaPersistentType().attributes();
- JavaPersistentAttribute javaPersistentAttribute = attributes.next();
- assertEquals("id", javaPersistentAttribute.getName());
- assertEquals(AccessType.FIELD, javaPersistentAttribute.getAccess());
- assertEquals(MappingKeys.BASIC_ATTRIBUTE_MAPPING_KEY, javaPersistentAttribute.getMappingKey());
-
- javaPersistentAttribute = attributes.next();
- assertEquals("name", javaPersistentAttribute.getName());
- assertEquals(AccessType.FIELD, javaPersistentAttribute.getAccess());
- assertEquals(MappingKeys.BASIC_ATTRIBUTE_MAPPING_KEY, javaPersistentAttribute.getMappingKey());
-
- javaPersistentAttribute = attributes.next();
- assertEquals("id", javaPersistentAttribute.getName());
- assertEquals(AccessType.PROPERTY, javaPersistentAttribute.getAccess());
- assertEquals(MappingKeys.ID_ATTRIBUTE_MAPPING_KEY, javaPersistentAttribute.getMappingKey());
-
- assertFalse(attributes.hasNext());
-
-
- getJavaPersistentType().attributes().next().getResourcePersistentAttribute().setMappingAnnotation(TransientAnnotation.ANNOTATION_NAME);
- attributes = getJavaPersistentType().attributes();
- javaPersistentAttribute = attributes.next();
-
- javaPersistentAttribute = attributes.next();
- assertEquals("name", javaPersistentAttribute.getName());
- assertEquals(AccessType.FIELD, javaPersistentAttribute.getAccess());
- assertEquals(MappingKeys.BASIC_ATTRIBUTE_MAPPING_KEY, javaPersistentAttribute.getMappingKey());
-
- javaPersistentAttribute = attributes.next();
- assertEquals("id", javaPersistentAttribute.getName());
- assertEquals(AccessType.PROPERTY, javaPersistentAttribute.getAccess());
- assertEquals(MappingKeys.ID_ATTRIBUTE_MAPPING_KEY, javaPersistentAttribute.getMappingKey());
- assertFalse(attributes.hasNext());
- }
-
- public void testAccessInheritance() throws Exception {
- createTestEntityAnnotatedMethod();
- createTestSubType();
-
- addXmlClassRef(FULLY_QUALIFIED_TYPE_NAME);
- addXmlClassRef(PACKAGE_NAME + ".AnnotationTestTypeChild");
-
- ListIterator<ClassRef> classRefs = getPersistenceUnit().specifiedClassRefs();
- classRefs.next();
- ClassRef classRef = classRefs.next();
-
- JavaPersistentType javaPersistentType = classRef.getJavaPersistentType();
- assertEquals(PACKAGE_NAME + ".AnnotationTestTypeChild", javaPersistentType.getName());
-
- assertEquals(AccessType.PROPERTY, javaPersistentType.getAccess());
- }
-
- public void testAccessInheritance2() throws Exception {
- createTestEntityAnnotatedField();
- createTestSubType();
-
- addXmlClassRef(FULLY_QUALIFIED_TYPE_NAME);
- addXmlClassRef(PACKAGE_NAME + ".AnnotationTestTypeChild");
-
- ListIterator<ClassRef> classRefs = getPersistenceUnit().specifiedClassRefs();
- classRefs.next();
- ClassRef classRef = classRefs.next();
-
- JavaPersistentType javaPersistentType = classRef.getJavaPersistentType();
- assertEquals(PACKAGE_NAME + ".AnnotationTestTypeChild", javaPersistentType.getName());
-
- assertEquals(AccessType.FIELD, javaPersistentType.getAccess());
- }
-
- public void testAccessInheritance3() throws Exception {
- createTestEntityAnnotatedField();
- createTestSubTypeWithMethodAnnotation();
-
- addXmlClassRef(FULLY_QUALIFIED_TYPE_NAME);
- addXmlClassRef(PACKAGE_NAME + ".AnnotationTestTypeChild");
-
- ListIterator<ClassRef> classRefs = getPersistenceUnit().specifiedClassRefs();
- classRefs.next();
- ClassRef classRef = classRefs.next();
-
- JavaPersistentType javaPersistentType = classRef.getJavaPersistentType();
- assertEquals(PACKAGE_NAME + ".AnnotationTestTypeChild", javaPersistentType.getName());
-
- assertEquals(AccessType.PROPERTY, javaPersistentType.getAccess());
- }
-
- public void testAccessInheritance4() throws Exception {
- createTestEntityAnnotatedMethod();
- createTestSubTypeWithFieldAnnotation();
-
- addXmlClassRef(FULLY_QUALIFIED_TYPE_NAME);
- addXmlClassRef(PACKAGE_NAME + ".AnnotationTestTypeChild");
-
- ListIterator<ClassRef> classRefs = getPersistenceUnit().specifiedClassRefs();
- classRefs.next();
- ClassRef classRef = classRefs.next();
- JavaPersistentType javaPersistentType = classRef.getJavaPersistentType();
-
- assertEquals(PACKAGE_NAME + ".AnnotationTestTypeChild", javaPersistentType.getName());
-
- assertEquals(AccessType.FIELD, javaPersistentType.getAccess());
- }
-
- //inherited class having annotations set wins over the default access set on persistence-unit-defaults
- public void testAccessInheritancePersistenceUnitDefaultAccess() throws Exception {
- createTestEntityAnnotatedMethod();
- createTestSubType();
-
- addXmlClassRef(FULLY_QUALIFIED_TYPE_NAME);
- addXmlClassRef(PACKAGE_NAME + ".AnnotationTestTypeChild");
- getEntityMappings().getPersistenceUnitMetadata().getPersistenceUnitDefaults().setAccess(AccessType.FIELD);
-
- ListIterator<ClassRef> classRefs = getPersistenceUnit().specifiedClassRefs();
- classRefs.next();
- ClassRef classRef = classRefs.next();
- JavaPersistentType javaPersistentType = classRef.getJavaPersistentType();
-
- assertEquals(PACKAGE_NAME + ".AnnotationTestTypeChild", javaPersistentType.getName());
-
- assertEquals(AccessType.PROPERTY, javaPersistentType.getAccess());
- }
-
- public void testAccessXmlNoAccessNoAnnotations() throws Exception {
- OrmPersistentType entityPersistentType = getEntityMappings().addPersistentType(MappingKeys.ENTITY_TYPE_MAPPING_KEY, FULLY_QUALIFIED_TYPE_NAME);
- createTestEntity();
-
- JavaPersistentType javaPersistentType = entityPersistentType.getJavaPersistentType();
- assertEquals(AccessType.FIELD, javaPersistentType.getAccess());
- }
-
- public void testAccessXmlEntityAccessNoAnnotations() throws Exception {
- OrmPersistentType entityPersistentType = getEntityMappings().addPersistentType(MappingKeys.ENTITY_TYPE_MAPPING_KEY, FULLY_QUALIFIED_TYPE_NAME);
- createTestEntity();
- JavaPersistentType javaPersistentType = entityPersistentType.getJavaPersistentType();
-
- entityPersistentType.setSpecifiedAccess(AccessType.FIELD);
- assertEquals(AccessType.FIELD, javaPersistentType.getAccess());
-
- entityPersistentType.setSpecifiedAccess(AccessType.PROPERTY);
- assertEquals(AccessType.PROPERTY, javaPersistentType.getAccess());
- }
-
- public void testAccessXmlPersistenceUnitDefaultsAccessNoAnnotations() throws Exception {
- OrmPersistentType entityPersistentType = getEntityMappings().addPersistentType(MappingKeys.ENTITY_TYPE_MAPPING_KEY, FULLY_QUALIFIED_TYPE_NAME);
- createTestEntity();
- JavaPersistentType javaPersistentType = entityPersistentType.getJavaPersistentType();
-
- getEntityMappings().getPersistenceUnitMetadata().getPersistenceUnitDefaults().setAccess(AccessType.FIELD);
- assertEquals(AccessType.FIELD, javaPersistentType.getAccess());
-
- getEntityMappings().getPersistenceUnitMetadata().getPersistenceUnitDefaults().setAccess(AccessType.PROPERTY);
- assertEquals(AccessType.PROPERTY, javaPersistentType.getAccess());
- }
-
- public void testAccessXmlEntityPropertyAccessAndFieldAnnotations() throws Exception {
- //xml access set to property, field annotations, JavaPersistentType access is field
- OrmPersistentType entityPersistentType = getEntityMappings().addPersistentType(MappingKeys.ENTITY_TYPE_MAPPING_KEY, FULLY_QUALIFIED_TYPE_NAME);
- createTestEntityAnnotatedField();
- JavaPersistentType javaPersistentType = entityPersistentType.getJavaPersistentType();
-
- entityPersistentType.setSpecifiedAccess(AccessType.PROPERTY);
- assertEquals(AccessType.FIELD, javaPersistentType.getAccess());
- }
-
- public void testAccessXmlEntityFieldAccessAndPropertyAnnotations() throws Exception {
- //xml access set to field, property annotations, JavaPersistentType access is property
- OrmPersistentType entityPersistentType = getEntityMappings().addPersistentType(MappingKeys.ENTITY_TYPE_MAPPING_KEY, FULLY_QUALIFIED_TYPE_NAME);
- createTestEntityAnnotatedMethod();
- JavaPersistentType javaPersistentType = entityPersistentType.getJavaPersistentType();
-
- entityPersistentType.setSpecifiedAccess(AccessType.FIELD);
- assertEquals(AccessType.PROPERTY, javaPersistentType.getAccess());
- }
-
- public void testAccessXmlPersistenceUnitDefaultsAccessFieldAnnotations() throws Exception {
- OrmPersistentType entityPersistentType = getEntityMappings().addPersistentType(MappingKeys.ENTITY_TYPE_MAPPING_KEY, FULLY_QUALIFIED_TYPE_NAME);
- createTestEntityAnnotatedField();
- JavaPersistentType javaPersistentType = entityPersistentType.getJavaPersistentType();
-
- getEntityMappings().getPersistenceUnitMetadata().getPersistenceUnitDefaults().setAccess(AccessType.PROPERTY);
- assertEquals(AccessType.FIELD, javaPersistentType.getAccess());
- }
-
- //inheritance wins over entity-mappings specified access
- public void testAccessXmlEntityMappingsAccessWithInheritance() throws Exception {
- OrmPersistentType entityPersistentType = getEntityMappings().addPersistentType(MappingKeys.ENTITY_TYPE_MAPPING_KEY, FULLY_QUALIFIED_TYPE_NAME);
- OrmPersistentType childEntityPersistentType = getEntityMappings().addPersistentType(MappingKeys.ENTITY_TYPE_MAPPING_KEY, PACKAGE_NAME + ".AnnotationTestTypeChild");
-
- createTestEntityAnnotatedMethod();
- createTestSubType();
- JavaPersistentType childJavaPersistentType = childEntityPersistentType.getJavaPersistentType();
-
- getEntityMappings().setSpecifiedAccess(AccessType.FIELD);
- assertEquals(AccessType.PROPERTY, entityPersistentType.getJavaPersistentType().getAccess());
- assertEquals(AccessType.PROPERTY, childJavaPersistentType.getAccess());
- }
-
- public void testAccessXmlMetadataCompleteFieldAnnotations() throws Exception {
- //xml access set to property, java has field annotations so the access should be field
- OrmPersistentType entityPersistentType = getEntityMappings().addPersistentType(MappingKeys.ENTITY_TYPE_MAPPING_KEY, FULLY_QUALIFIED_TYPE_NAME);
- createTestEntityAnnotatedField();
- JavaPersistentType javaPersistentType = entityPersistentType.getJavaPersistentType();
-
- getEntityMappings().getPersistenceUnitMetadata().getPersistenceUnitDefaults().setAccess(AccessType.PROPERTY);
- getEntityMappings().getPersistenceUnitMetadata().setXmlMappingMetadataComplete(true);
- assertEquals(AccessType.FIELD, javaPersistentType.getAccess());
-
- }
-
- public void testAccessNoXmlAccessXmlMetdataCompletePropertyAnnotations() throws Exception {
- //xml access not set, metadata complete set. JavaPersistentType access is property because properties are annotated
- OrmPersistentType entityPersistentType = getEntityMappings().addPersistentType(MappingKeys.ENTITY_TYPE_MAPPING_KEY, FULLY_QUALIFIED_TYPE_NAME);
- createTestEntityAnnotatedMethod();
- JavaPersistentType javaPersistentType = entityPersistentType.getJavaPersistentType();
-
- getEntityMappings().getPersistenceUnitMetadata().setXmlMappingMetadataComplete(true);
- assertEquals(AccessType.PROPERTY, javaPersistentType.getAccess());
- }
-
- public void testParentPersistentType() throws Exception {
- createTestEntityAnnotatedMethod();
- createTestSubTypeWithFieldAnnotation();
-
- addXmlClassRef(FULLY_QUALIFIED_TYPE_NAME);
- addXmlClassRef(PACKAGE_NAME + ".AnnotationTestTypeChild");
-
- ListIterator<ClassRef> classRefs = getPersistenceUnit().specifiedClassRefs();
- ClassRef classRef = classRefs.next();
- JavaPersistentType rootJavaPersistentType = classRef.getJavaPersistentType();
-
- classRef = classRefs.next();
- JavaPersistentType childJavaPersistentType = classRef.getJavaPersistentType();
-
- assertEquals(rootJavaPersistentType, childJavaPersistentType.getParentPersistentType());
- assertNull(rootJavaPersistentType.getParentPersistentType());
- }
-
- public void testParentPersistentType2() throws Exception {
- createTestEntityAnnotatedMethod();
- createTestSubTypeWithFieldAnnotation();
-
- //parent is not added to the getPersistenceUnit, but it should still be found
- //as the parentPersistentType because of impliedClassRefs and changes for bug 190317
- addXmlClassRef(PACKAGE_NAME + ".AnnotationTestTypeChild");
-
- ListIterator<ClassRef> classRefs = getPersistenceUnit().specifiedClassRefs();
- JavaPersistentType javaPersistentType = classRefs.next().getJavaPersistentType();
-
- assertNotNull(javaPersistentType.getParentPersistentType());
- }
-
- //Entity extends Non-Entity extends Entity
- public void testParentPersistentType3() throws Exception {
- createTestEntityAnnotatedMethod();
- createTestSubTypeNonPersistent();
- createTestSubTypePersistentExtendsNonPersistent();
-
- addXmlClassRef(FULLY_QUALIFIED_TYPE_NAME);
- addXmlClassRef(PACKAGE_NAME + ".AnnotationTestTypeChild2");
-
- ListIterator<ClassRef> classRefs = getPersistenceUnit().specifiedClassRefs();
- ClassRef classRef = classRefs.next();
- JavaPersistentType rootJavaPersistentType = classRef.getJavaPersistentType();
-
- classRef = classRefs.next();
- JavaPersistentType childJavaPersistentType = classRef.getJavaPersistentType();
-
- assertEquals(rootJavaPersistentType, childJavaPersistentType.getParentPersistentType());
- assertNull(rootJavaPersistentType.getParentPersistentType());
- }
-
- public void testInheritanceHierarchy() throws Exception {
- createTestEntityAnnotatedMethod();
- createTestSubTypeNonPersistent();
- createTestSubTypePersistentExtendsNonPersistent();
-
- addXmlClassRef(FULLY_QUALIFIED_TYPE_NAME);
- addXmlClassRef(PACKAGE_NAME + ".AnnotationTestTypeChild2");
-
- ListIterator<ClassRef> classRefs = getPersistenceUnit().specifiedClassRefs();
- JavaPersistentType rootJavaPersistentType = classRefs.next().getJavaPersistentType();
- JavaPersistentType childJavaPersistentType = classRefs.next().getJavaPersistentType();
-
- Iterator<PersistentType> inheritanceHierarchy = childJavaPersistentType.inheritanceHierarchy();
-
- assertEquals(childJavaPersistentType, inheritanceHierarchy.next());
- assertEquals(rootJavaPersistentType, inheritanceHierarchy.next());
- }
-
- public void testInheritanceHierarchy2() throws Exception {
- createTestEntityAnnotatedMethod();
- createTestSubTypeNonPersistent();
- createTestSubTypePersistentExtendsNonPersistent();
-
- addXmlClassRef(PACKAGE_NAME + ".AnnotationTestTypeChild2");
- addXmlClassRef(FULLY_QUALIFIED_TYPE_NAME);
-
- ListIterator<ClassRef> classRefs = getPersistenceUnit().specifiedClassRefs();
- JavaPersistentType childJavaPersistentType = classRefs.next().getJavaPersistentType();
- JavaPersistentType rootJavaPersistentType = classRefs.next().getJavaPersistentType();
-
- Iterator<PersistentType> inheritanceHierarchy = childJavaPersistentType.inheritanceHierarchy();
-
- assertEquals(childJavaPersistentType, inheritanceHierarchy.next());
- assertEquals(rootJavaPersistentType, inheritanceHierarchy.next());
- }
-
- public void testGetMapping() throws Exception {
- createTestEntityAnnotatedMethod();
- addXmlClassRef(FULLY_QUALIFIED_TYPE_NAME);
-
- assertEquals(MappingKeys.ENTITY_TYPE_MAPPING_KEY, getJavaPersistentType().getMapping().getKey());
- }
-
- public void testGetMappingNull() throws Exception {
- createTestType();
- addXmlClassRef(FULLY_QUALIFIED_TYPE_NAME);
-
- assertEquals(MappingKeys.NULL_TYPE_MAPPING_KEY, getJavaPersistentType().getMapping().getKey());
- }
-
- public void testMappingKey() throws Exception {
- createTestEntityAnnotatedMethod();
- addXmlClassRef(FULLY_QUALIFIED_TYPE_NAME);
-
- assertEquals(MappingKeys.ENTITY_TYPE_MAPPING_KEY, getJavaPersistentType().getMappingKey());
- }
-
- public void testMappingKeyNull() throws Exception {
- createTestType();
- addXmlClassRef(FULLY_QUALIFIED_TYPE_NAME);
-
- assertEquals(MappingKeys.NULL_TYPE_MAPPING_KEY, getJavaPersistentType().getMappingKey());
- }
-
- public void testSetMappingKey() throws Exception {
- createTestType();
- addXmlClassRef(FULLY_QUALIFIED_TYPE_NAME);
-
- assertEquals(MappingKeys.NULL_TYPE_MAPPING_KEY, getJavaPersistentType().getMappingKey());
-
- getJavaPersistentType().setMappingKey(MappingKeys.ENTITY_TYPE_MAPPING_KEY);
-
- JavaResourcePersistentType typeResource = getJpaProject().getJavaResourcePersistentType(FULLY_QUALIFIED_TYPE_NAME);
- assertNotNull(typeResource.getMappingAnnotation());
- assertTrue(typeResource.getMappingAnnotation() instanceof EntityAnnotation);
-
- assertEquals(MappingKeys.ENTITY_TYPE_MAPPING_KEY, getJavaPersistentType().getMappingKey());
- }
-
- public void testSetMappingKey2() throws Exception {
- createTestEntityAnnotatedField();
- addXmlClassRef(FULLY_QUALIFIED_TYPE_NAME);
-
- assertEquals(MappingKeys.ENTITY_TYPE_MAPPING_KEY, getJavaPersistentType().getMappingKey());
-
- getJavaPersistentType().setMappingKey(MappingKeys.EMBEDDABLE_TYPE_MAPPING_KEY);
-
- JavaResourcePersistentType typeResource = getJpaProject().getJavaResourcePersistentType(FULLY_QUALIFIED_TYPE_NAME);
- assertNotNull(typeResource.getMappingAnnotation());
- assertTrue(typeResource.getMappingAnnotation() instanceof EmbeddableAnnotation);
-
- assertEquals(MappingKeys.EMBEDDABLE_TYPE_MAPPING_KEY, getJavaPersistentType().getMappingKey());
- }
-
- public void testSetMappingKeyNull() throws Exception {
- createTestEntityAnnotatedMethod();
- addXmlClassRef(FULLY_QUALIFIED_TYPE_NAME);
-
- assertEquals(MappingKeys.ENTITY_TYPE_MAPPING_KEY, getJavaPersistentType().getMappingKey());
-
- getJavaPersistentType().setMappingKey(MappingKeys.NULL_TYPE_MAPPING_KEY);
-
- JavaResourcePersistentType typeResource = getJpaProject().getJavaResourcePersistentType(FULLY_QUALIFIED_TYPE_NAME);
- assertNull(typeResource.getMappingAnnotation());
- assertNull(typeResource.getMappingAnnotation(EntityAnnotation.ANNOTATION_NAME));
-
- assertEquals(MappingKeys.NULL_TYPE_MAPPING_KEY, getJavaPersistentType().getMappingKey());
- }
-
- public void testGetMappingKeyMappingChangeInResourceModel() throws Exception {
- createTestEntityAnnotatedField();
- addXmlClassRef(FULLY_QUALIFIED_TYPE_NAME);
-
- assertEquals(MappingKeys.ENTITY_TYPE_MAPPING_KEY, getJavaPersistentType().getMappingKey());
-
- JavaResourcePersistentType typeResource = getJpaProject().getJavaResourcePersistentType(FULLY_QUALIFIED_TYPE_NAME);
- typeResource.setMappingAnnotation(EmbeddableAnnotation.ANNOTATION_NAME);
-
- assertEquals(MappingKeys.EMBEDDABLE_TYPE_MAPPING_KEY, getJavaPersistentType().getMappingKey());
- }
-
- public void testGetMappingKeyMappingChangeInResourceModel2() throws Exception {
- createTestType();
- addXmlClassRef(FULLY_QUALIFIED_TYPE_NAME);
-
- assertEquals(MappingKeys.NULL_TYPE_MAPPING_KEY, getJavaPersistentType().getMappingKey());
-
- JavaResourcePersistentType typeResource = getJpaProject().getJavaResourcePersistentType(FULLY_QUALIFIED_TYPE_NAME);
- typeResource.setMappingAnnotation(EntityAnnotation.ANNOTATION_NAME);
-
- assertEquals(MappingKeys.ENTITY_TYPE_MAPPING_KEY, getJavaPersistentType().getMappingKey());
- }
-
- public void testIsMapped() throws Exception {
- createTestEntityAnnotatedMethod();
- addXmlClassRef(FULLY_QUALIFIED_TYPE_NAME);
-
- assertTrue(getJavaPersistentType().isMapped());
-
- getJavaPersistentType().setMappingKey(MappingKeys.NULL_TYPE_MAPPING_KEY);
- assertFalse(getJavaPersistentType().isMapped());
- }
-
- public void testAttributes() throws Exception {
- createTestEntityAnnotatedMethod();
- addXmlClassRef(FULLY_QUALIFIED_TYPE_NAME);
- ListIterator<JavaPersistentAttribute> attributes = getJavaPersistentType().attributes();
-
- assertEquals("id", attributes.next().getName());
- assertFalse(attributes.hasNext());
- }
-
- public void testAttributes2() throws Exception {
- createTestEntityAnnotatedFieldAndMethod();
- addXmlClassRef(FULLY_QUALIFIED_TYPE_NAME);
-
- ListIterator<JavaPersistentAttribute> attributes = getJavaPersistentType().attributes();
-
- assertEquals("id", attributes.next().getName());
- assertEquals("name", attributes.next().getName());
- assertFalse(attributes.hasNext());
- }
-
- public void testAttributesSize() throws Exception {
- createTestEntityAnnotatedMethod();
- addXmlClassRef(FULLY_QUALIFIED_TYPE_NAME);
-
- assertEquals(1, getJavaPersistentType().attributesSize());
- }
-
- public void testAttributesSize2() throws Exception {
- createTestEntityAnnotatedFieldAndMethod();
- addXmlClassRef(FULLY_QUALIFIED_TYPE_NAME);
-
- assertEquals(2, getJavaPersistentType().attributesSize());
- }
-
- public void testAttributeNamed() throws Exception {
- createTestEntityAnnotatedMethod();
- addXmlClassRef(FULLY_QUALIFIED_TYPE_NAME);
-
- PersistentAttribute attribute = getJavaPersistentType().getAttributeNamed("id");
-
- assertEquals("id", attribute.getName());
- assertNull(getJavaPersistentType().getAttributeNamed("name"));
- assertNull(getJavaPersistentType().getAttributeNamed("foo"));
- }
-
- public void testAttributeNamed2() throws Exception {
- createTestEntityAnnotatedField();
- addXmlClassRef(FULLY_QUALIFIED_TYPE_NAME);
-
- PersistentAttribute attribute = getJavaPersistentType().getAttributeNamed("name");
-
- assertEquals("name", attribute.getName());
-
- assertNull(getJavaPersistentType().getAttributeNamed("foo"));
- }
-
- public void testRenameAttribute() throws Exception {
- ICompilationUnit testType = createTestEntityAnnotatedField();
- addXmlClassRef(FULLY_QUALIFIED_TYPE_NAME);
-
- ListIterator<JavaPersistentAttribute> attributes = getJavaPersistentType().attributes();
- JavaPersistentAttribute idAttribute = attributes.next();
- JavaPersistentAttribute nameAttribute = attributes.next();
-
-
- assertEquals("id", idAttribute.getName());
- assertEquals("name", nameAttribute.getName());
-
- IField idField = testType.findPrimaryType().getField("id");
- idField.rename("id2", false, null);
-
- attributes = getJavaPersistentType().attributes();
- JavaPersistentAttribute nameAttribute2 = attributes.next();
- JavaPersistentAttribute id2Attribute = attributes.next();
-
- assertNotSame(idAttribute, id2Attribute);
- assertEquals("id2", id2Attribute.getName());
- assertEquals(nameAttribute, nameAttribute2);
- assertEquals("name", nameAttribute2.getName());
- assertFalse(attributes.hasNext());
- }
-
- public void testParentPersistentTypeGeneric() throws Exception {
- createTestGenericEntity();
- createTestGenericMappedSuperclass();
-
- addXmlClassRef(PACKAGE_NAME + ".Entity1");
- addXmlClassRef(PACKAGE_NAME + ".Entity2");
-
- JavaPersistentType javaPersistentType = getJavaPersistentType();
- assertEquals("test.Entity1", javaPersistentType.getName());
- assertNotNull(javaPersistentType.getParentPersistentType());
-
- assertEquals("test.Entity2", javaPersistentType.getParentPersistentType().getName());
- }
-
- private void createTestGenericEntity() throws Exception {
- SourceWriter sourceWriter = new SourceWriter() {
- public void appendSourceTo(StringBuilder sb) {
- sb.append(CR);
- sb.append("import ");
- sb.append(JPA.ENTITY);
- sb.append(";");
- sb.append(CR);
- sb.append("@Entity");
- sb.append(CR);
- sb.append("public class Entity1 ");
- sb.append("extends Entity2<Integer> {}").append(CR);
- }
- };
- this.javaProject.createCompilationUnit(PACKAGE_NAME, "Entity1.java", sourceWriter);
- }
-
- private void createTestGenericMappedSuperclass() throws Exception {
- SourceWriter sourceWriter = new SourceWriter() {
- public void appendSourceTo(StringBuilder sb) {
- sb.append(CR);
- sb.append("import ");
- sb.append(JPA.MAPPED_SUPERCLASS);
- sb.append(";");
- sb.append(CR);
- sb.append("@MappedSuperclass");
- sb.append(CR);
- sb.append("public class Entity2<K> {}").append(CR);
- }
- };
- this.javaProject.createCompilationUnit(PACKAGE_NAME, "Entity2.java", sourceWriter);
- }
-}
diff --git a/jpa/tests/org.eclipse.jpt.core.tests/src/org/eclipse/jpt2_0/core/tests/internal/context/java/Generic2_0JavaSequenceGeneratorTests.java b/jpa/tests/org.eclipse.jpt.core.tests/src/org/eclipse/jpt2_0/core/tests/internal/context/java/Generic2_0JavaSequenceGeneratorTests.java
deleted file mode 100644
index 0305c4a7a1..0000000000
--- a/jpa/tests/org.eclipse.jpt.core.tests/src/org/eclipse/jpt2_0/core/tests/internal/context/java/Generic2_0JavaSequenceGeneratorTests.java
+++ /dev/null
@@ -1,208 +0,0 @@
-/*******************************************************************************
-* Copyright (c) 2009 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.
-*
-* Contributors:
-* Oracle - initial API and implementation
-*******************************************************************************/
-package org.eclipse.jpt2_0.core.tests.internal.context.java;
-
-import java.util.Iterator;
-
-import org.eclipse.jdt.core.ICompilationUnit;
-import org.eclipse.jpt.core.JptCorePlugin;
-import org.eclipse.jpt.core.MappingKeys;
-import org.eclipse.jpt.core.context.GeneratorContainer;
-import org.eclipse.jpt.core.context.IdMapping;
-import org.eclipse.jpt.core.context.SequenceGenerator;
-import org.eclipse.jpt.core.context.orm.OrmEntity;
-import org.eclipse.jpt.core.context.orm.OrmPersistentType;
-import org.eclipse.jpt.core.resource.java.JPA;
-import org.eclipse.jpt.core.resource.java.JavaResourcePersistentAttribute;
-import org.eclipse.jpt.core.resource.java.JavaResourcePersistentType;
-import org.eclipse.jpt.core.resource.persistence.PersistenceFactory;
-import org.eclipse.jpt.core.resource.persistence.XmlMappingFileRef;
-import org.eclipse.jpt.utility.internal.iterators.ArrayIterator;
-import org.eclipse.jpt2_0.core.context.SequenceGenerator2_0;
-import org.eclipse.jpt2_0.core.resource.java.SequenceGenerator2_0Annotation;
-
-/**
- * Generic2_0JavaSequenceGeneratorTests
- */
-@SuppressWarnings("nls")
-public class Generic2_0JavaSequenceGeneratorTests extends Generic2_0ContextModelTestCase
-{
- private static final String SEQUENCE_GENERATOR_NAME = "TEST_SEQUENCE_GENERATOR";
-
- public Generic2_0JavaSequenceGeneratorTests(String name) {
- super(name);
- }
-
- // ********** catalog **********
-
- public void testGetCatalog() throws Exception {
- this.createTestEntityWithSequenceGenerator();
- this.addXmlClassRef(FULLY_QUALIFIED_TYPE_NAME);
-
- IdMapping idMapping = (IdMapping) getJavaPersistentType().getAttributeNamed("id").getMapping();
-
- GeneratorContainer cc = idMapping.getGeneratorContainer();
- SequenceGenerator sg = cc.getSequenceGenerator();
-
- SequenceGenerator2_0 sequenceGenerator = (SequenceGenerator2_0) idMapping.getGeneratorContainer().getSequenceGenerator();
-
- assertNull(sequenceGenerator.getCatalog());
- JavaResourcePersistentType typeResource = getJpaProject().getJavaResourcePersistentType(FULLY_QUALIFIED_TYPE_NAME);
- JavaResourcePersistentAttribute attributeResource = typeResource.persistableAttributes().next();
- SequenceGenerator2_0Annotation annotation = (SequenceGenerator2_0Annotation) attributeResource.getSupportingAnnotation(JPA.SEQUENCE_GENERATOR);
-
- annotation.setCatalog("testCatalog");
-
- assertEquals("testCatalog", sequenceGenerator.getCatalog());
- assertEquals("testCatalog", sequenceGenerator.getSpecifiedCatalog());
- }
-
- public void testGetDefaultCatalog() throws Exception {
- this.createTestEntityWithSequenceGenerator();
- this.addXmlClassRef(FULLY_QUALIFIED_TYPE_NAME);
-
- IdMapping idMapping = (IdMapping) getJavaPersistentType().getAttributeNamed("id").getMapping();
- SequenceGenerator2_0 sequenceGenerator = (SequenceGenerator2_0) idMapping.getGeneratorContainer().getSequenceGenerator();
-
- assertNull(sequenceGenerator.getDefaultCatalog());
-
- sequenceGenerator.setSpecifiedCatalog("testCatalog");
-
- assertNull(sequenceGenerator.getDefaultCatalog());
- assertEquals("testCatalog", sequenceGenerator.getSpecifiedCatalog());
- }
-
- public void testSetSpecifiedCatalog() throws Exception {
- this.createTestEntityWithSequenceGenerator();
- this.addXmlClassRef(FULLY_QUALIFIED_TYPE_NAME);
-
- IdMapping idMapping = (IdMapping) getJavaPersistentType().getAttributeNamed("id").getMapping();
- SequenceGenerator2_0 sequenceGenerator = (SequenceGenerator2_0) idMapping.getGeneratorContainer().getSequenceGenerator();
-
- sequenceGenerator.setSpecifiedCatalog("testCatalog");
-
- JavaResourcePersistentType typeResource = getJpaProject().getJavaResourcePersistentType(FULLY_QUALIFIED_TYPE_NAME);
- JavaResourcePersistentAttribute attributeResource = typeResource.persistableAttributes().next();
- SequenceGenerator2_0Annotation annotation = (SequenceGenerator2_0Annotation) attributeResource.getSupportingAnnotation(JPA.SEQUENCE_GENERATOR);
-
- assertEquals("testCatalog", annotation.getCatalog());
-
- sequenceGenerator.setName(null);
- sequenceGenerator.setSpecifiedCatalog(null);
- assertNull(attributeResource.getSupportingAnnotation(JPA.SEQUENCE_GENERATOR));
- }
-
- // ********** schema **********
-
- public void testGetSchema() throws Exception {
- this.createTestEntityWithSequenceGenerator();
- this.addXmlClassRef(FULLY_QUALIFIED_TYPE_NAME);
-
- IdMapping idMapping = (IdMapping) this.getJavaPersistentType().getAttributeNamed("id").getMapping();
- SequenceGenerator2_0 sequenceGenerator = (SequenceGenerator2_0) idMapping.getGeneratorContainer().getSequenceGenerator();
-
- assertNull(sequenceGenerator.getSchema());
- JavaResourcePersistentType typeResource = getJpaProject().getJavaResourcePersistentType(FULLY_QUALIFIED_TYPE_NAME);
- JavaResourcePersistentAttribute attributeResource = typeResource.persistableAttributes().next();
- SequenceGenerator2_0Annotation annotation = (SequenceGenerator2_0Annotation) attributeResource.getSupportingAnnotation(JPA.SEQUENCE_GENERATOR);
-
- annotation.setSchema("testSchema");
-
- assertEquals("testSchema", sequenceGenerator.getSchema());
- assertEquals("testSchema", sequenceGenerator.getSpecifiedSchema());
- }
-
- public void testGetDefaultSchema() throws Exception {
- this.createTestEntityWithSequenceGenerator();
- this.addXmlClassRef(FULLY_QUALIFIED_TYPE_NAME);
-
- IdMapping idMapping = (IdMapping) getJavaPersistentType().getAttributeNamed("id").getMapping();
- SequenceGenerator2_0 sequenceGenerator = (SequenceGenerator2_0) idMapping.getGeneratorContainer().getSequenceGenerator();
-
- assertNull(sequenceGenerator.getDefaultSchema());
-
- sequenceGenerator.setSpecifiedSchema("testSchema");
-
- assertNull(sequenceGenerator.getDefaultSchema());
- assertEquals("testSchema", sequenceGenerator.getSpecifiedSchema());
- }
-
- public void testUpdateDefaultSchemaFromPersistenceUnitDefaults() throws Exception {
- XmlMappingFileRef mappingFileRef = PersistenceFactory.eINSTANCE.createXmlMappingFileRef();
- mappingFileRef.setFileName(JptCorePlugin.DEFAULT_ORM_XML_FILE_PATH);
- getXmlPersistenceUnit().getMappingFiles().add(mappingFileRef);
-
- createTestEntityWithSequenceGenerator();
-
- OrmPersistentType ormPersistentType = getEntityMappings().addPersistentType(MappingKeys.ENTITY_TYPE_MAPPING_KEY, FULLY_QUALIFIED_TYPE_NAME);
- OrmEntity ormEntity = (OrmEntity) ormPersistentType.getMapping();
- IdMapping idMapping = (IdMapping) ormPersistentType.getJavaPersistentType().getAttributeNamed("id").getMapping();
- SequenceGenerator2_0 sequenceGenerator = (SequenceGenerator2_0) idMapping.getGeneratorContainer().getSequenceGenerator();
-
- assertNull(sequenceGenerator.getDefaultSchema());
-
- this.getEntityMappings().getPersistenceUnitMetadata().getPersistenceUnitDefaults().setSpecifiedSchema("FOO");
- assertEquals("FOO", sequenceGenerator.getDefaultSchema());
-
- this.getEntityMappings().setSpecifiedSchema("BAR");
- assertEquals("BAR", sequenceGenerator.getDefaultSchema());
-
- ormEntity.getTable().setSpecifiedSchema("XML_SCHEMA");
- assertEquals("BAR", sequenceGenerator.getDefaultSchema());
-
- this.getEntityMappings().removePersistentType(0);
- this.addXmlClassRef(FULLY_QUALIFIED_TYPE_NAME);
- //default schema taken from persistence-unit-defaults not entity-mappings since the entity is not in an orm.xml file
- idMapping = (IdMapping) getJavaPersistentType().getAttributeNamed("id").getMapping();
- sequenceGenerator = (SequenceGenerator2_0) idMapping.getGeneratorContainer().getSequenceGenerator();
- assertEquals("FOO", sequenceGenerator.getDefaultSchema());
- }
-
- public void testSetSpecifiedSchema() throws Exception {
- this.createTestEntityWithSequenceGenerator();
- this.addXmlClassRef(FULLY_QUALIFIED_TYPE_NAME);
-
- IdMapping idMapping = (IdMapping) getJavaPersistentType().getAttributeNamed("id").getMapping();
- SequenceGenerator2_0 sequenceGenerator = (SequenceGenerator2_0) idMapping.getGeneratorContainer().getSequenceGenerator();
-
- sequenceGenerator.setSpecifiedSchema("testSchema");
-
- JavaResourcePersistentType typeResource = getJpaProject().getJavaResourcePersistentType(FULLY_QUALIFIED_TYPE_NAME);
- JavaResourcePersistentAttribute attributeResource = typeResource.persistableAttributes().next();
- SequenceGenerator2_0Annotation annotation = (SequenceGenerator2_0Annotation) attributeResource.getSupportingAnnotation(JPA.SEQUENCE_GENERATOR);
-
- assertEquals("testSchema", annotation.getSchema());
-
- sequenceGenerator.setName(null);
- sequenceGenerator.setSpecifiedSchema(null);
- assertNull(attributeResource.getSupportingAnnotation(JPA.SEQUENCE_GENERATOR));
- }
-
- // ********** utility **********
-
- protected ICompilationUnit createTestEntityWithSequenceGenerator() throws Exception {
- return this.createTestType(new DefaultAnnotationWriter() {
- @Override
- public Iterator<String> imports() {
- return new ArrayIterator<String>(JPA.ENTITY, JPA.SEQUENCE_GENERATOR, JPA.ID);
- }
- @Override
- public void appendTypeAnnotationTo(StringBuilder sb) {
- sb.append("@Entity");
- }
-
- @Override
- public void appendIdFieldAnnotationTo(StringBuilder sb) {
- sb.append("@Id").append(CR);
- sb.append("@SequenceGenerator(name=\"" + SEQUENCE_GENERATOR_NAME + "\")");
- }
- });
- }
-}
diff --git a/jpa/tests/org.eclipse.jpt.core.tests/src/org/eclipse/jpt2_0/core/tests/internal/context/orm/Generic2_0OrmContextModelTestCase.java b/jpa/tests/org.eclipse.jpt.core.tests/src/org/eclipse/jpt2_0/core/tests/internal/context/orm/Generic2_0OrmContextModelTestCase.java
deleted file mode 100644
index be3a615578..0000000000
--- a/jpa/tests/org.eclipse.jpt.core.tests/src/org/eclipse/jpt2_0/core/tests/internal/context/orm/Generic2_0OrmContextModelTestCase.java
+++ /dev/null
@@ -1,85 +0,0 @@
-/*******************************************************************************
- * Copyright (c) 2009 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.
- *
- * Contributors:
- * Oracle - initial API and implementation
- *******************************************************************************/
-package org.eclipse.jpt2_0.core.tests.internal.context.orm;
-
-import org.eclipse.jpt.core.internal.facet.JpaFacetDataModelProperties;
-import org.eclipse.jpt.core.internal.facet.JpaFacetDataModelProvider;
-import org.eclipse.jpt.core.internal.operations.OrmFileCreationDataModelProperties;
-import org.eclipse.jpt.core.internal.operations.OrmFileCreationDataModelProvider;
-import org.eclipse.jpt.core.resource.xml.JpaXmlResource;
-import org.eclipse.jpt.core.tests.internal.projects.TestJpaProject;
-import org.eclipse.jpt2_0.core.internal.operations.Orm2_0FileCreationOperation;
-import org.eclipse.jpt2_0.core.internal.platform.Generic2_0JpaPlatformProvider;
-import org.eclipse.jpt2_0.core.resource.orm.XmlEntityMappings;
-import org.eclipse.jpt2_0.core.tests.internal.context.java.Generic2_0ContextModelTestCase;
-import org.eclipse.wst.common.componentcore.datamodel.properties.IFacetDataModelProperties;
-import org.eclipse.wst.common.frameworks.datamodel.DataModelFactory;
-import org.eclipse.wst.common.frameworks.datamodel.IDataModel;
-
-public abstract class Generic2_0OrmContextModelTestCase
- extends Generic2_0ContextModelTestCase
-{
- protected JpaXmlResource generic2_0OrmXmlResource;
-
-
- protected Generic2_0OrmContextModelTestCase(String name) {
- super(name);
- }
-
- @Override
- protected void setUp() throws Exception {
- super.setUp();
- this.generic2_0OrmXmlResource = getJpaProject().getDefaultOrmXmlResource();
- }
-
- @Override
- protected IDataModel buildJpaConfigDataModel() {
- IDataModel dataModel = DataModelFactory.createDataModel(new JpaFacetDataModelProvider());
- dataModel.setProperty(IFacetDataModelProperties.FACET_VERSION_STR, "2.0"); //$NON-NLS-1$
- dataModel.setProperty(JpaFacetDataModelProperties.PLATFORM_ID, Generic2_0JpaPlatformProvider.ID);
- dataModel.setProperty(JpaFacetDataModelProperties.CREATE_ORM_XML, Boolean.FALSE);
- return dataModel;
- }
-
- @Override
- protected TestJpaProject buildJpaProject(String projectName, boolean autoBuild, IDataModel jpaConfig) throws Exception {
- TestJpaProject testJpaProject = super.buildJpaProject(projectName, autoBuild, jpaConfig);
-
- Orm2_0FileCreationOperation operation =
- new Orm2_0FileCreationOperation(build2_0OrmConfig(testJpaProject));
- operation.execute(null, null);
-
- return testJpaProject;
- }
-
- protected IDataModel build2_0OrmConfig(TestJpaProject testJpaProject) {
- IDataModel dataModel =
- DataModelFactory.createDataModel(new OrmFileCreationDataModelProvider());
- dataModel.setProperty(OrmFileCreationDataModelProperties.PROJECT_NAME, testJpaProject.getProject().getName());
- dataModel.setProperty(OrmFileCreationDataModelProperties.ADD_TO_PERSISTENCE_UNIT, Boolean.TRUE);
- return dataModel;
- }
-
- @Override
- protected void tearDown() throws Exception {
- this.generic2_0OrmXmlResource = null;
- super.tearDown();
- }
-
- @Override
- protected JpaXmlResource getOrmXmlResource() {
- return this.generic2_0OrmXmlResource;
- }
-
- @Override
- protected XmlEntityMappings getXmlEntityMappings() {
- return (XmlEntityMappings) super.getXmlEntityMappings();
- }
-}
diff --git a/jpa/tests/org.eclipse.jpt.core.tests/src/org/eclipse/jpt2_0/core/tests/internal/context/orm/Generic2_0OrmContextModelTests.java b/jpa/tests/org.eclipse.jpt.core.tests/src/org/eclipse/jpt2_0/core/tests/internal/context/orm/Generic2_0OrmContextModelTests.java
deleted file mode 100644
index 6d15b0d6fb..0000000000
--- a/jpa/tests/org.eclipse.jpt.core.tests/src/org/eclipse/jpt2_0/core/tests/internal/context/orm/Generic2_0OrmContextModelTests.java
+++ /dev/null
@@ -1,32 +0,0 @@
-/*******************************************************************************
- * Copyright (c) 2009 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
- *
- * Contributors:
- * Oracle - initial API and implementation
- *******************************************************************************/
-package org.eclipse.jpt2_0.core.tests.internal.context.orm;
-
-import junit.framework.Test;
-import junit.framework.TestCase;
-import junit.framework.TestSuite;
-
-public class Generic2_0OrmContextModelTests extends TestCase
-{
-
- public static Test suite() {
- TestSuite suite = new TestSuite(Generic2_0OrmContextModelTests.class.getName());
- suite.addTestSuite(Generic2_0OrmPersistentTypeTests.class);
- suite.addTestSuite(Generic2_0OrmPersistentAttributeTests.class);
- suite.addTestSuite(Generic2_0OrmSequenceGeneratorTests.class);
- return suite;
- }
-
- private Generic2_0OrmContextModelTests() {
- super();
- throw new UnsupportedOperationException();
- }
-}
diff --git a/jpa/tests/org.eclipse.jpt.core.tests/src/org/eclipse/jpt2_0/core/tests/internal/context/orm/Generic2_0OrmPersistentAttributeTests.java b/jpa/tests/org.eclipse.jpt.core.tests/src/org/eclipse/jpt2_0/core/tests/internal/context/orm/Generic2_0OrmPersistentAttributeTests.java
deleted file mode 100644
index 48f538b8a9..0000000000
--- a/jpa/tests/org.eclipse.jpt.core.tests/src/org/eclipse/jpt2_0/core/tests/internal/context/orm/Generic2_0OrmPersistentAttributeTests.java
+++ /dev/null
@@ -1,549 +0,0 @@
-/*******************************************************************************
- * Copyright (c) 2009 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.
- *
- * Contributors:
- * Oracle - initial API and implementation
- *******************************************************************************/
-package org.eclipse.jpt2_0.core.tests.internal.context.orm;
-
-import java.util.Iterator;
-import java.util.ListIterator;
-import org.eclipse.jdt.core.ICompilationUnit;
-import org.eclipse.jpt.core.MappingKeys;
-import org.eclipse.jpt.core.context.AccessType;
-import org.eclipse.jpt.core.context.BasicMapping;
-import org.eclipse.jpt.core.context.IdMapping;
-import org.eclipse.jpt.core.context.java.JavaPersistentAttribute;
-import org.eclipse.jpt.core.context.java.JavaPersistentType;
-import org.eclipse.jpt.core.context.orm.OrmIdMapping;
-import org.eclipse.jpt.core.context.orm.OrmOneToOneMapping;
-import org.eclipse.jpt.core.context.orm.OrmPersistentAttribute;
-import org.eclipse.jpt.core.context.orm.OrmPersistentType;
-import org.eclipse.jpt.core.internal.context.orm.GenericOrmNullAttributeMapping;
-import org.eclipse.jpt.core.resource.java.JPA;
-import org.eclipse.jpt.core.resource.java.JavaResourcePersistentAttribute;
-import org.eclipse.jpt.utility.internal.iterators.ArrayIterator;
-
-@SuppressWarnings("nls")
-public class Generic2_0OrmPersistentAttributeTests extends Generic2_0OrmContextModelTestCase
-{
-
- public Generic2_0OrmPersistentAttributeTests(String name) {
- super(name);
- }
-
-
- private ICompilationUnit createTestTypeNullAttributeMapping() throws Exception {
-
- return this.createTestType(new DefaultAnnotationWriter() {
- @Override
- public void appendIdFieldAnnotationTo(StringBuilder sb) {
- sb.append(CR);
- sb.append(" private Address address;").append(CR);
- sb.append(CR);
- }
- });
- }
-
- private ICompilationUnit createTestEntityIdMapping() throws Exception {
- return this.createTestType(new DefaultAnnotationWriter() {
- @Override
- public Iterator<String> imports() {
- return new ArrayIterator<String>(JPA.ENTITY, JPA.ID, JPA.COLUMN);
- }
- @Override
- public void appendTypeAnnotationTo(StringBuilder sb) {
- sb.append("@Entity");
- }
- @Override
- public void appendIdFieldAnnotationTo(StringBuilder sb) {
- sb.append("@Id");
- sb.append("@Column(name=\"FOO\")");
- }
- });
- }
-
- private ICompilationUnit createTestEntityIdMappingPropertyAccess() throws Exception {
- return this.createTestType(new DefaultAnnotationWriter() {
- @Override
- public Iterator<String> imports() {
- return new ArrayIterator<String>(JPA.ENTITY, JPA.ID, JPA.COLUMN);
- }
- @Override
- public void appendTypeAnnotationTo(StringBuilder sb) {
- sb.append("@Entity");
- }
- @Override
- public void appendGetIdMethodAnnotationTo(StringBuilder sb) {
- sb.append("@Id");
- sb.append("@Column(name=\"FOO\")");
- }
- });
- }
-
- private ICompilationUnit createTestEntityOneToOneMapping() throws Exception {
- return this.createTestType(new DefaultAnnotationWriter() {
- @Override
- public Iterator<String> imports() {
- return new ArrayIterator<String>(JPA.ENTITY, JPA.ONE_TO_ONE);
- }
- @Override
- public void appendTypeAnnotationTo(StringBuilder sb) {
- sb.append("@Entity");
- }
- @Override
- public void appendIdFieldAnnotationTo(StringBuilder sb) {
- sb.append("@OneToOne");
- sb.append(" private Address address;");
- }
- });
- }
-
- private ICompilationUnit createTestEntityAnnotatedFieldPropertySpecified() throws Exception {
- return this.createTestType(new DefaultAnnotationWriter() {
- @Override
- public Iterator<String> imports() {
- return new ArrayIterator<String>(JPA.ENTITY, JPA.BASIC, JPA.ID, JPA.ACCESS, JPA.ACCESS_TYPE);
- }
- @Override
- public void appendTypeAnnotationTo(StringBuilder sb) {
- sb.append("@Entity");
- sb.append("@Access(AccessType.PROPERTY)");
- }
-
- @Override
- public void appendNameFieldAnnotationTo(StringBuilder sb) {
- sb.append("@Basic");
- sb.append("@Access(AccessType.FIELD)");
- }
-
- @Override
- public void appendGetIdMethodAnnotationTo(StringBuilder sb) {
- sb.append("@Id");
- }
- });
- }
-
- public void testMakeSpecified() throws Exception {
- createTestType();
- OrmPersistentType ormPersistentType = getEntityMappings().addPersistentType(MappingKeys.ENTITY_TYPE_MAPPING_KEY, FULLY_QUALIFIED_TYPE_NAME);
-
- assertEquals(2, ormPersistentType.virtualAttributesSize());
-
- OrmPersistentAttribute ormPersistentAttribute = ormPersistentType.virtualAttributes().next();
- assertEquals("id", ormPersistentAttribute.getName());
- assertTrue(ormPersistentAttribute.isVirtual());
- ormPersistentAttribute.makeSpecified();
-
- assertEquals(1, ormPersistentType.virtualAttributesSize());
- assertEquals(1, ormPersistentType.specifiedAttributesSize());
- OrmPersistentAttribute specifiedOrmPersistentAttribute = ormPersistentType.specifiedAttributes().next();
- assertEquals("id", specifiedOrmPersistentAttribute.getName());
- assertFalse(specifiedOrmPersistentAttribute.isVirtual());
-
- ormPersistentAttribute = ormPersistentType.virtualAttributes().next();
- ormPersistentAttribute.makeSpecified();
-
- assertEquals(0, ormPersistentType.virtualAttributesSize());
- assertEquals(2, ormPersistentType.specifiedAttributesSize());
- ListIterator<OrmPersistentAttribute> specifiedAttributes = ormPersistentType.specifiedAttributes();
- specifiedOrmPersistentAttribute = specifiedAttributes.next();
- assertEquals("id", specifiedOrmPersistentAttribute.getName());
- assertFalse(specifiedOrmPersistentAttribute.isVirtual());
-
- specifiedOrmPersistentAttribute = specifiedAttributes.next();
- assertEquals("name", specifiedOrmPersistentAttribute.getName());
- assertFalse(specifiedOrmPersistentAttribute.isVirtual());
- }
-
- public void testMakeSpecifiedWithAccess() throws Exception {
- createTestEntityAnnotatedFieldPropertySpecified();
- OrmPersistentType ormPersistentType = getEntityMappings().addPersistentType(MappingKeys.ENTITY_TYPE_MAPPING_KEY, FULLY_QUALIFIED_TYPE_NAME);
-
- assertEquals(2, ormPersistentType.virtualAttributesSize());
-
- OrmPersistentAttribute ormPersistentAttribute = ormPersistentType.virtualAttributes().next();
- assertEquals("id", ormPersistentAttribute.getName());
- assertTrue(ormPersistentAttribute.isVirtual());
- assertEquals(AccessType.PROPERTY, ormPersistentAttribute.getAccess());
- assertEquals(AccessType.PROPERTY, ormPersistentAttribute.getSpecifiedAccess());
- assertEquals(null, ormPersistentAttribute.getJavaPersistentAttribute().getSpecifiedAccess());
- ormPersistentAttribute.makeSpecified();
-
- assertEquals(1, ormPersistentType.virtualAttributesSize());
- assertEquals(1, ormPersistentType.specifiedAttributesSize());
- OrmPersistentAttribute specifiedOrmPersistentAttribute = ormPersistentType.specifiedAttributes().next();
- assertEquals("id", specifiedOrmPersistentAttribute.getName());
- assertEquals(null, specifiedOrmPersistentAttribute.getSpecifiedAccess());
- assertEquals(AccessType.PROPERTY, specifiedOrmPersistentAttribute.getAccess());
- assertFalse(specifiedOrmPersistentAttribute.isVirtual());
-
- ormPersistentAttribute = ormPersistentType.virtualAttributes().next();
- assertEquals("name", ormPersistentAttribute.getName());
- assertTrue(ormPersistentAttribute.isVirtual());
- assertEquals(AccessType.FIELD, ormPersistentAttribute.getSpecifiedAccess());
- ormPersistentAttribute.makeSpecified();
-
- assertEquals(0, ormPersistentType.virtualAttributesSize());
- assertEquals(2, ormPersistentType.specifiedAttributesSize());
- ListIterator<OrmPersistentAttribute> specifiedAttributes = ormPersistentType.specifiedAttributes();
- specifiedOrmPersistentAttribute = specifiedAttributes.next();
- assertEquals("id", specifiedOrmPersistentAttribute.getName());
- assertFalse(specifiedOrmPersistentAttribute.isVirtual());
- assertEquals(AccessType.PROPERTY, specifiedOrmPersistentAttribute.getAccess());
- assertEquals(null, specifiedOrmPersistentAttribute.getSpecifiedAccess());
-
- specifiedOrmPersistentAttribute = specifiedAttributes.next();
- assertEquals("name", specifiedOrmPersistentAttribute.getName());
- assertFalse(specifiedOrmPersistentAttribute.isVirtual());
- assertEquals(AccessType.FIELD, specifiedOrmPersistentAttribute.getSpecifiedAccess());
- }
-
- public void testMakeSpecifiedMappingKey() throws Exception {
- createTestTypeNullAttributeMapping();
- OrmPersistentType ormPersistentType = getEntityMappings().addPersistentType(MappingKeys.ENTITY_TYPE_MAPPING_KEY, FULLY_QUALIFIED_TYPE_NAME);
-
- assertEquals(3, ormPersistentType.virtualAttributesSize());
-
- //take a virtual mapping with a mapping type and make it specified
- OrmPersistentAttribute ormPersistentAttribute = ormPersistentType.virtualAttributes().next();
- assertEquals("address", ormPersistentAttribute.getName());
- assertTrue(ormPersistentAttribute.isVirtual());
- assertTrue(ormPersistentAttribute.getMapping() instanceof GenericOrmNullAttributeMapping);
- ormPersistentAttribute.makeSpecified(MappingKeys.ONE_TO_ONE_ATTRIBUTE_MAPPING_KEY);
-
- assertEquals(2, ormPersistentType.virtualAttributesSize());
- assertEquals(1, ormPersistentType.specifiedAttributesSize());
- OrmPersistentAttribute specifiedOrmPersistentAttribute = ormPersistentType.specifiedAttributes().next();
- assertEquals("address", specifiedOrmPersistentAttribute.getName());
- assertFalse(specifiedOrmPersistentAttribute.isVirtual());
- assertTrue(specifiedOrmPersistentAttribute.getMapping() instanceof OrmOneToOneMapping);
-
-
- ormPersistentAttribute = ormPersistentType.virtualAttributes().next();
- ormPersistentAttribute.makeSpecified(MappingKeys.ID_ATTRIBUTE_MAPPING_KEY);
-
- assertEquals(1, ormPersistentType.virtualAttributesSize());
- assertEquals(2, ormPersistentType.specifiedAttributesSize());
- ListIterator<OrmPersistentAttribute> specifiedAttributes = ormPersistentType.specifiedAttributes();
-
- specifiedOrmPersistentAttribute = specifiedAttributes.next();
- assertEquals("id", specifiedOrmPersistentAttribute.getName());
- assertFalse(specifiedOrmPersistentAttribute.isVirtual());
- assertTrue(specifiedOrmPersistentAttribute.getMapping() instanceof OrmIdMapping);
-
- specifiedOrmPersistentAttribute = specifiedAttributes.next();
- assertEquals("address", specifiedOrmPersistentAttribute.getName());
- assertFalse(specifiedOrmPersistentAttribute.isVirtual());
- }
-
- public void testMakeVirtual() throws Exception {
- createTestType();
- OrmPersistentType ormPersistentType = getEntityMappings().addPersistentType(MappingKeys.ENTITY_TYPE_MAPPING_KEY, FULLY_QUALIFIED_TYPE_NAME);
-
- assertEquals(2, ormPersistentType.virtualAttributesSize());
-
- ormPersistentType.virtualAttributes().next().makeSpecified();
- ormPersistentType.virtualAttributes().next().makeSpecified();
-
- assertEquals(0, ormPersistentType.virtualAttributesSize());
- assertEquals(2, ormPersistentType.specifiedAttributesSize());
- OrmPersistentAttribute specifiedOrmPersistentAttribute = ormPersistentType.specifiedAttributes().next();
- assertEquals("id", specifiedOrmPersistentAttribute.getName());
- assertFalse(specifiedOrmPersistentAttribute.isVirtual());
-
- specifiedOrmPersistentAttribute.makeVirtual();
- assertEquals(1, ormPersistentType.virtualAttributesSize());
- assertEquals(1, ormPersistentType.specifiedAttributesSize());
-
- specifiedOrmPersistentAttribute = ormPersistentType.specifiedAttributes().next();
- specifiedOrmPersistentAttribute.makeVirtual();
- assertEquals(2, ormPersistentType.virtualAttributesSize());
- assertEquals(0, ormPersistentType.specifiedAttributesSize());
-
- ListIterator<OrmPersistentAttribute> virtualAttributes = ormPersistentType.virtualAttributes();
- OrmPersistentAttribute virtualAttribute = virtualAttributes.next();
- assertEquals("id", virtualAttribute.getName());
- virtualAttribute = virtualAttributes.next();
- assertEquals("name", virtualAttribute.getName());
- }
-
- public void testMakeVirtualNoUnderlyingJavaAttribute() throws Exception {
- createTestType();
- OrmPersistentType ormPersistentType = getEntityMappings().addPersistentType(MappingKeys.ENTITY_TYPE_MAPPING_KEY, FULLY_QUALIFIED_TYPE_NAME);
-
- assertEquals(2, ormPersistentType.virtualAttributesSize());
-
- ormPersistentType.virtualAttributes().next().makeSpecified();
- ormPersistentType.virtualAttributes().next().makeSpecified();
-
-
- ormPersistentType.specifiedAttributes().next().getMapping().setName("noJavaAttribute");
- assertEquals(1, ormPersistentType.virtualAttributesSize());
- assertEquals(2, ormPersistentType.specifiedAttributesSize());
-
-
- OrmPersistentAttribute specifiedOrmPersistentAttribute = ormPersistentType.specifiedAttributes().next();
- specifiedOrmPersistentAttribute.makeVirtual();
- assertEquals(1, ormPersistentType.virtualAttributesSize());
- assertEquals(1, ormPersistentType.specifiedAttributesSize());
-
- assertEquals("id", ormPersistentType.virtualAttributes().next().getName());
- assertEquals("name", ormPersistentType.specifiedAttributes().next().getName());
- }
-
- public void testVirtualMappingTypeWhenMetadataComplete() throws Exception {
- createTestEntityIdMapping();
- OrmPersistentType ormPersistentType = getEntityMappings().addPersistentType(MappingKeys.ENTITY_TYPE_MAPPING_KEY, FULLY_QUALIFIED_TYPE_NAME);
-
- OrmPersistentAttribute ormPersistentAttribute = ormPersistentType.virtualAttributes().next();
- assertEquals("id", ormPersistentAttribute.getName());
- assertEquals(MappingKeys.ID_ATTRIBUTE_MAPPING_KEY, ormPersistentAttribute.getMappingKey());
- assertEquals("FOO", ((IdMapping) ormPersistentAttribute.getMapping()).getColumn().getName());
-
-
- ormPersistentType.getMapping().setSpecifiedMetadataComplete(Boolean.TRUE);
-
- ormPersistentAttribute = ormPersistentType.virtualAttributes().next();
- assertEquals("id", ormPersistentAttribute.getName());
- assertEquals(MappingKeys.BASIC_ATTRIBUTE_MAPPING_KEY, ormPersistentAttribute.getMappingKey());
- assertEquals("id", ((BasicMapping) ormPersistentAttribute.getMapping()).getColumn().getName());
- }
-
- public void testVirtualMappingTypeWhenMetadataComplete2() throws Exception {
- createTestEntityOneToOneMapping();
- OrmPersistentType ormPersistentType = getEntityMappings().addPersistentType(MappingKeys.ENTITY_TYPE_MAPPING_KEY, FULLY_QUALIFIED_TYPE_NAME);
-
- OrmPersistentAttribute ormPersistentAttribute = ormPersistentType.virtualAttributes().next();
- assertEquals("address", ormPersistentAttribute.getName());
- assertEquals(MappingKeys.ONE_TO_ONE_ATTRIBUTE_MAPPING_KEY, ormPersistentAttribute.getMappingKey());
-
-
- ormPersistentType.getMapping().setSpecifiedMetadataComplete(Boolean.TRUE);
-
- ormPersistentAttribute = ormPersistentType.virtualAttributes().next();
- assertEquals("address", ormPersistentAttribute.getName());
- assertEquals(MappingKeys.NULL_ATTRIBUTE_MAPPING_KEY, ormPersistentAttribute.getMappingKey());
- }
-
- public void testGetJavaPersistentAttribute() throws Exception {
- createTestEntityIdMapping();
- OrmPersistentType ormPersistentType = getEntityMappings().addPersistentType(MappingKeys.ENTITY_TYPE_MAPPING_KEY, FULLY_QUALIFIED_TYPE_NAME);
- JavaPersistentType javaPersistentType = ormPersistentType.getJavaPersistentType();
-
- OrmPersistentAttribute ormPersistentAttribute = ormPersistentType.getAttributeNamed("id");
- JavaPersistentAttribute javaPersistentAttribute = javaPersistentType.getAttributeNamed("id");
-
- //virtual orm attribute, access type matches java : FIELD, name matches java
- assertTrue(ormPersistentAttribute.isVirtual());
- assertNotSame(javaPersistentAttribute, ormPersistentAttribute.getJavaPersistentAttribute());
- JavaResourcePersistentAttribute javaResourcePersistentAttribute = ormPersistentAttribute.getJavaPersistentAttribute().getResourcePersistentAttribute();
- assertTrue(javaResourcePersistentAttribute.isField());
- assertEquals("id", javaResourcePersistentAttribute.getName());
- assertEquals(javaPersistentType.getResourcePersistentType().persistableFields().next(), javaResourcePersistentAttribute);
-
-
- //specified orm attribute, access type matches java : FIELD, name matches java
- //javaPersistentAttribute should be == to java context model object
- ormPersistentAttribute.makeSpecified();
- ormPersistentAttribute = ormPersistentType.getAttributeNamed("id");
- assertFalse(ormPersistentAttribute.isVirtual());
- assertEquals(javaPersistentAttribute, ormPersistentAttribute.getJavaPersistentAttribute());
-
-
- //virtual orm attribute, java access type FIELD, orm access type PROPERTY, name matches java
- //verify the property java resource persistent attribute is used in orm.
- ormPersistentAttribute.makeVirtual();
- ormPersistentAttribute = ormPersistentType.getAttributeNamed("id");
- ormPersistentType.setSpecifiedAccess(AccessType.PROPERTY);
- assertNotSame(ormPersistentAttribute, ormPersistentType.getAttributeNamed("id"));
- ormPersistentAttribute = ormPersistentType.getAttributeNamed("id");
- assertNotSame(javaPersistentAttribute, ormPersistentAttribute.getJavaPersistentAttribute());
- javaResourcePersistentAttribute = ormPersistentAttribute.getJavaPersistentAttribute().getResourcePersistentAttribute();
- assertTrue(javaResourcePersistentAttribute.isProperty());
- assertEquals("id", javaResourcePersistentAttribute.getName());
- assertEquals(javaPersistentType.getResourcePersistentType().persistableProperties().next(), javaResourcePersistentAttribute);
-
-
- ormPersistentType.setSpecifiedAccess(null);//default access will be field
- ormPersistentAttribute = ormPersistentType.getAttributeNamed("id");
- ormPersistentAttribute.makeSpecified();
- ormPersistentAttribute = ormPersistentType.getAttributeNamed("id");
- ormPersistentAttribute.getMapping().setName("id2");
- assertEquals(null, ormPersistentAttribute.getJavaPersistentAttribute());
-
- ormPersistentAttribute.getMapping().setName(null);
- assertEquals(null, ormPersistentAttribute.getJavaPersistentAttribute());
-
- ormPersistentAttribute.getMapping().setName("id");
- assertEquals(javaPersistentAttribute, ormPersistentAttribute.getJavaPersistentAttribute());
-
-
- ormPersistentType.getMapping().setSpecifiedMetadataComplete(Boolean.TRUE);
- assertEquals(javaPersistentAttribute, ormPersistentAttribute.getJavaPersistentAttribute());
- }
-
- public void testGetJavaPersistentAttributeMixedAccess() throws Exception {
- createTestEntityIdMapping();
- OrmPersistentType ormPersistentType = getEntityMappings().addPersistentType(MappingKeys.ENTITY_TYPE_MAPPING_KEY, FULLY_QUALIFIED_TYPE_NAME);
- ormPersistentType.setSpecifiedAccess(AccessType.PROPERTY);
- JavaPersistentType javaPersistentType = ormPersistentType.getJavaPersistentType();
-
- OrmPersistentAttribute ormPersistentAttribute = ormPersistentType.getAttributeNamed("id");
- JavaPersistentAttribute javaPersistentAttribute = javaPersistentType.getAttributeNamed("id");
-
- assertEquals(AccessType.PROPERTY, ormPersistentAttribute.getAccess());
- assertEquals(AccessType.FIELD, javaPersistentAttribute.getPersistentType().getAccess());
- assertTrue(ormPersistentAttribute.isVirtual());
- assertNotSame(javaPersistentAttribute, ormPersistentAttribute.getJavaPersistentAttribute());
- assertEquals(MappingKeys.BASIC_ATTRIBUTE_MAPPING_KEY, ormPersistentAttribute.getMappingKey());
- assertEquals(MappingKeys.ID_ATTRIBUTE_MAPPING_KEY, javaPersistentAttribute.getMappingKey());
-
-
- ormPersistentAttribute.makeSpecified();
- ormPersistentAttribute = ormPersistentType.getAttributeNamed("id");
- assertFalse(ormPersistentAttribute.isVirtual());
- assertEquals(AccessType.PROPERTY, ormPersistentAttribute.getAccess());
- assertNotSame(javaPersistentAttribute, ormPersistentAttribute.getJavaPersistentAttribute());
- assertTrue(ormPersistentAttribute.getJavaPersistentAttribute().getResourcePersistentAttribute().isProperty());
- assertTrue(javaPersistentAttribute.getResourcePersistentAttribute().isField());
-
- ormPersistentAttribute.setSpecifiedAccess(AccessType.FIELD);
- ormPersistentAttribute = ormPersistentType.getAttributeNamed("id");
- assertFalse(ormPersistentAttribute.isVirtual());
- assertEquals(AccessType.FIELD, ormPersistentAttribute.getAccess());
- assertEquals(javaPersistentAttribute, ormPersistentAttribute.getJavaPersistentAttribute());
- assertTrue(ormPersistentAttribute.getJavaPersistentAttribute().getResourcePersistentAttribute().isField());
- assertTrue(javaPersistentAttribute.getResourcePersistentAttribute().isField());
- }
-
- public void testGetAccess() throws Exception {
- createTestEntityIdMapping();
- OrmPersistentType ormPersistentType = getEntityMappings().addPersistentType(MappingKeys.ENTITY_TYPE_MAPPING_KEY, FULLY_QUALIFIED_TYPE_NAME);
- JavaPersistentType javaPersistentType = ormPersistentType.getJavaPersistentType();
-
- OrmPersistentAttribute ormPersistentAttribute = ormPersistentType.getAttributeNamed("id");
- JavaPersistentAttribute javaPersistentAttribute = javaPersistentType.getAttributeNamed("id");
-
- assertTrue(ormPersistentAttribute.isVirtual());
- assertEquals(AccessType.FIELD, ormPersistentAttribute.getAccess());
- assertTrue(ormPersistentAttribute.getJavaPersistentAttribute().getResourcePersistentAttribute().isField());
- assertEquals(AccessType.FIELD, javaPersistentAttribute.getAccess());
- assertTrue(javaPersistentAttribute.getResourcePersistentAttribute().isField());
-
-
- ormPersistentAttribute.makeSpecified();
- ormPersistentAttribute = ormPersistentType.getAttributeNamed("id");
- assertFalse(ormPersistentAttribute.isVirtual());
- assertEquals(AccessType.FIELD, ormPersistentAttribute.getAccess());
- assertTrue(ormPersistentAttribute.getJavaPersistentAttribute().getResourcePersistentAttribute().isField());
- assertEquals(AccessType.FIELD, javaPersistentAttribute.getAccess());
- assertTrue(javaPersistentAttribute.getResourcePersistentAttribute().isField());
-
-
- ormPersistentType.getMapping().setSpecifiedMetadataComplete(Boolean.TRUE);
- assertFalse(ormPersistentAttribute.isVirtual());
- assertEquals(AccessType.FIELD, ormPersistentAttribute.getAccess());
- assertEquals(javaPersistentAttribute, ormPersistentAttribute.getJavaPersistentAttribute());
- assertEquals(AccessType.FIELD, ormPersistentAttribute.getJavaPersistentAttribute().getAccess());
- assertEquals(AccessType.FIELD, javaPersistentAttribute.getAccess());
- assertTrue(javaPersistentAttribute.getResourcePersistentAttribute().isField());
- }
-
- public void testGetAccessPropertyInJava() throws Exception {
- createTestEntityIdMappingPropertyAccess();
- OrmPersistentType ormPersistentType = getEntityMappings().addPersistentType(MappingKeys.ENTITY_TYPE_MAPPING_KEY, FULLY_QUALIFIED_TYPE_NAME);
- JavaPersistentType javaPersistentType = ormPersistentType.getJavaPersistentType();
-
- OrmPersistentAttribute ormPersistentAttribute = ormPersistentType.getAttributeNamed("id");
- JavaPersistentAttribute javaPersistentAttribute = javaPersistentType.getAttributeNamed("id");
-
- assertTrue(ormPersistentAttribute.isVirtual());
- assertEquals(AccessType.PROPERTY, ormPersistentAttribute.getAccess());
- assertTrue(ormPersistentAttribute.getJavaPersistentAttribute().getResourcePersistentAttribute().isProperty());
- assertEquals(AccessType.PROPERTY, javaPersistentAttribute.getAccess());
- assertTrue(javaPersistentAttribute.getResourcePersistentAttribute().isProperty());
-
-
- ormPersistentAttribute.makeSpecified();
- ormPersistentAttribute = ormPersistentType.getAttributeNamed("id");
- assertFalse(ormPersistentAttribute.isVirtual());
- assertEquals(AccessType.PROPERTY, ormPersistentAttribute.getAccess());
- assertTrue(ormPersistentAttribute.getJavaPersistentAttribute().getResourcePersistentAttribute().isProperty());
- assertEquals(AccessType.PROPERTY, javaPersistentAttribute.getAccess());
- assertTrue(javaPersistentAttribute.getResourcePersistentAttribute().isProperty());
-
-
- ormPersistentType.getMapping().setSpecifiedMetadataComplete(Boolean.TRUE);
- assertFalse(ormPersistentAttribute.isVirtual());
- assertEquals(AccessType.FIELD, ormPersistentAttribute.getAccess());
- assertNotSame(javaPersistentAttribute, ormPersistentAttribute.getJavaPersistentAttribute());
- assertEquals(AccessType.FIELD, ormPersistentAttribute.getJavaPersistentAttribute().getAccess());
- assertEquals(AccessType.PROPERTY, javaPersistentAttribute.getAccess());
- assertTrue(javaPersistentAttribute.getResourcePersistentAttribute().isProperty());
- }
-
- public void testGetAccessPropertyInJava2() throws Exception {
- createTestEntityAnnotatedFieldPropertySpecified();
- OrmPersistentType ormPersistentType = getEntityMappings().addPersistentType(MappingKeys.ENTITY_TYPE_MAPPING_KEY, FULLY_QUALIFIED_TYPE_NAME);
- JavaPersistentType javaPersistentType = ormPersistentType.getJavaPersistentType();
-
- OrmPersistentAttribute ormPersistentAttribute = ormPersistentType.getAttributeNamed("id");
- JavaPersistentAttribute javaPersistentAttribute = javaPersistentType.getAttributeNamed("id");
-
- assertTrue(ormPersistentAttribute.isVirtual());
- assertEquals(AccessType.PROPERTY, ormPersistentAttribute.getAccess());
- assertTrue(ormPersistentAttribute.getJavaPersistentAttribute().getResourcePersistentAttribute().isProperty());
- assertEquals(AccessType.PROPERTY, javaPersistentAttribute.getAccess());
- assertTrue(javaPersistentAttribute.getResourcePersistentAttribute().isProperty());
-
-
- OrmPersistentAttribute nameOrmPersistentAttribute = ormPersistentType.getAttributeNamed("name");
- JavaPersistentAttribute nameJavaPersistentAttribute = javaPersistentType.getAttributeNamed("name");
-
- assertTrue(nameOrmPersistentAttribute.isVirtual());
- assertEquals(AccessType.FIELD, nameOrmPersistentAttribute.getAccess());
- assertTrue(nameOrmPersistentAttribute.getJavaPersistentAttribute().getResourcePersistentAttribute().isField());
- assertEquals(AccessType.FIELD, nameJavaPersistentAttribute.getAccess());
- assertTrue(nameJavaPersistentAttribute.getResourcePersistentAttribute().isField());
-
-
- ormPersistentAttribute.makeSpecified();
- ormPersistentAttribute = ormPersistentType.getAttributeNamed("id");
- assertFalse(ormPersistentAttribute.isVirtual());
- assertEquals(AccessType.PROPERTY, ormPersistentAttribute.getAccess());
- assertTrue(ormPersistentAttribute.getJavaPersistentAttribute().getResourcePersistentAttribute().isProperty());
- assertEquals(AccessType.PROPERTY, javaPersistentAttribute.getAccess());
- assertTrue(javaPersistentAttribute.getResourcePersistentAttribute().isProperty());
-
- nameOrmPersistentAttribute.makeSpecified();
- nameOrmPersistentAttribute = ormPersistentType.getAttributeNamed("name");
- assertFalse(nameOrmPersistentAttribute.isVirtual());
- assertEquals(AccessType.FIELD, nameOrmPersistentAttribute.getAccess());
- assertEquals(AccessType.FIELD, nameOrmPersistentAttribute.getJavaPersistentAttribute().getAccess());
- assertTrue(nameOrmPersistentAttribute.getJavaPersistentAttribute().getResourcePersistentAttribute().isField());
- assertEquals(AccessType.FIELD, nameJavaPersistentAttribute.getAccess());
- assertTrue(nameJavaPersistentAttribute.getResourcePersistentAttribute().isField());
- assertEquals(nameJavaPersistentAttribute, nameOrmPersistentAttribute.getJavaPersistentAttribute());
-
- ormPersistentType.getMapping().setSpecifiedMetadataComplete(Boolean.TRUE);
- assertFalse(ormPersistentAttribute.isVirtual());
- assertEquals(AccessType.FIELD, ormPersistentAttribute.getAccess());
- assertNotSame(javaPersistentAttribute, ormPersistentAttribute.getJavaPersistentAttribute());
- assertEquals(AccessType.FIELD, ormPersistentAttribute.getJavaPersistentAttribute().getAccess());
- assertEquals(AccessType.PROPERTY, javaPersistentAttribute.getAccess());
- assertTrue(javaPersistentAttribute.getResourcePersistentAttribute().isProperty());
-
- assertFalse(nameOrmPersistentAttribute.isVirtual());
- assertEquals(AccessType.FIELD, nameOrmPersistentAttribute.getAccess());
- assertNotSame(javaPersistentAttribute, nameOrmPersistentAttribute.getJavaPersistentAttribute());
- assertEquals(AccessType.FIELD, nameOrmPersistentAttribute.getJavaPersistentAttribute().getAccess());
- assertEquals(AccessType.FIELD, nameJavaPersistentAttribute.getAccess());
- assertTrue(nameJavaPersistentAttribute.getResourcePersistentAttribute().isField());
-
- }
-
-} \ No newline at end of file
diff --git a/jpa/tests/org.eclipse.jpt.core.tests/src/org/eclipse/jpt2_0/core/tests/internal/context/orm/Generic2_0OrmPersistentTypeTests.java b/jpa/tests/org.eclipse.jpt.core.tests/src/org/eclipse/jpt2_0/core/tests/internal/context/orm/Generic2_0OrmPersistentTypeTests.java
deleted file mode 100644
index 477c69a7e7..0000000000
--- a/jpa/tests/org.eclipse.jpt.core.tests/src/org/eclipse/jpt2_0/core/tests/internal/context/orm/Generic2_0OrmPersistentTypeTests.java
+++ /dev/null
@@ -1,280 +0,0 @@
-/*******************************************************************************
- * Copyright (c) 2009 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.
- *
- * Contributors:
- * Oracle - initial API and implementation
- *******************************************************************************/
-package org.eclipse.jpt2_0.core.tests.internal.context.orm;
-
-import java.util.Iterator;
-import java.util.ListIterator;
-import org.eclipse.jdt.core.ICompilationUnit;
-import org.eclipse.jpt.core.MappingKeys;
-import org.eclipse.jpt.core.context.AccessType;
-import org.eclipse.jpt.core.context.java.JavaPersistentType;
-import org.eclipse.jpt.core.context.orm.OrmPersistentAttribute;
-import org.eclipse.jpt.core.context.orm.OrmPersistentType;
-import org.eclipse.jpt.core.resource.java.JPA;
-import org.eclipse.jpt.utility.internal.iterators.ArrayIterator;
-
-@SuppressWarnings("nls")
-public class Generic2_0OrmPersistentTypeTests extends Generic2_0OrmContextModelTestCase
-{
-
- public Generic2_0OrmPersistentTypeTests(String name) {
- super(name);
- }
-
-
- private ICompilationUnit createTestEntityIdMapping() throws Exception {
- return this.createTestType(new DefaultAnnotationWriter() {
- @Override
- public Iterator<String> imports() {
- return new ArrayIterator<String>(JPA.ENTITY, JPA.ID, JPA.COLUMN);
- }
- @Override
- public void appendTypeAnnotationTo(StringBuilder sb) {
- sb.append("@Entity");
- }
- @Override
- public void appendIdFieldAnnotationTo(StringBuilder sb) {
- sb.append("@Id");
- sb.append("@Column(name=\"FOO\")");
- }
- });
- }
-
- private ICompilationUnit createTestEntityAnnotatedFieldPropertySpecified() throws Exception {
- return this.createTestType(new DefaultAnnotationWriter() {
- @Override
- public Iterator<String> imports() {
- return new ArrayIterator<String>(JPA.ENTITY, JPA.BASIC, JPA.ID, JPA.ACCESS, JPA.ACCESS_TYPE);
- }
- @Override
- public void appendTypeAnnotationTo(StringBuilder sb) {
- sb.append("@Entity");
- sb.append("@Access(AccessType.PROPERTY)");
- }
-
- @Override
- public void appendNameFieldAnnotationTo(StringBuilder sb) {
- sb.append("@Basic");
- sb.append("@Access(AccessType.FIELD)");
- }
-
- @Override
- public void appendGetIdMethodAnnotationTo(StringBuilder sb) {
- sb.append("@Id");
- }
- });
- }
-
- private ICompilationUnit createTestEntityFieldSpecifiedPropertyAnnotated() throws Exception {
- return this.createTestType(new DefaultAnnotationWriter() {
- @Override
- public Iterator<String> imports() {
- return new ArrayIterator<String>(JPA.ENTITY, JPA.BASIC, JPA.ID, JPA.ACCESS, JPA.ACCESS_TYPE);
- }
- @Override
- public void appendTypeAnnotationTo(StringBuilder sb) {
- sb.append("@Entity");
- sb.append("@Access(AccessType.FIELD)");
- }
-
- @Override
- public void appendGetIdMethodAnnotationTo(StringBuilder sb) {
- sb.append("@Id");
- sb.append("@Access(AccessType.PROPERTY)");
- }
- });
- }
-
- private ICompilationUnit createTestEntityPropertySpecified() throws Exception {
- return this.createTestType(new DefaultAnnotationWriter() {
- @Override
- public Iterator<String> imports() {
- return new ArrayIterator<String>(JPA.ENTITY, JPA.ACCESS, JPA.ACCESS_TYPE);
- }
- @Override
- public void appendTypeAnnotationTo(StringBuilder sb) {
- sb.append("@Entity");
- sb.append("@Access(AccessType.PROPERTY)");
- }
- });
- }
-
- public void testGetAccessWithJavaAnnotations() throws Exception {
- createTestEntityIdMapping();
- OrmPersistentType ormPersistentType = getEntityMappings().addPersistentType(MappingKeys.ENTITY_TYPE_MAPPING_KEY, FULLY_QUALIFIED_TYPE_NAME);
- JavaPersistentType javaPersistentType = ormPersistentType.getJavaPersistentType();
-
- assertEquals(AccessType.FIELD, ormPersistentType.getAccess());
- assertEquals(AccessType.FIELD, javaPersistentType.getAccess());
- assertEquals(null, javaPersistentType.getSpecifiedAccess());
-
-
- OrmPersistentAttribute ormPersistentAttribute = ormPersistentType.getAttributeNamed("id");
- ormPersistentAttribute.makeSpecified();
- assertEquals(AccessType.FIELD, ormPersistentType.getAccess());
- assertEquals(AccessType.FIELD, javaPersistentType.getAccess());
- assertEquals(null, javaPersistentType.getSpecifiedAccess());
-
- ormPersistentType.getMapping().setSpecifiedMetadataComplete(Boolean.TRUE);
- assertEquals(AccessType.FIELD, ormPersistentType.getAccess());
- assertEquals(AccessType.FIELD, javaPersistentType.getAccess());
- }
-
- public void testGetAccessWithJavaAnnotationsProperty() throws Exception {
- createTestEntityAnnotatedFieldPropertySpecified();
- OrmPersistentType ormPersistentType = getEntityMappings().addPersistentType(MappingKeys.ENTITY_TYPE_MAPPING_KEY, FULLY_QUALIFIED_TYPE_NAME);
- JavaPersistentType javaPersistentType = ormPersistentType.getJavaPersistentType();
-
- assertEquals(AccessType.PROPERTY, ormPersistentType.getAccess());
- assertEquals(AccessType.PROPERTY, javaPersistentType.getAccess());
- assertEquals(AccessType.PROPERTY, javaPersistentType.getSpecifiedAccess());
-
-
- OrmPersistentAttribute ormPersistentAttribute = ormPersistentType.getAttributeNamed("id");
- ormPersistentAttribute.makeSpecified();
- assertEquals(AccessType.PROPERTY, ormPersistentType.getAccess());
- assertEquals(AccessType.PROPERTY, javaPersistentType.getAccess());
- assertEquals(AccessType.PROPERTY, javaPersistentType.getSpecifiedAccess());
-
- ormPersistentType.getMapping().setSpecifiedMetadataComplete(Boolean.TRUE);
- assertEquals(AccessType.FIELD, ormPersistentType.getAccess());
- assertEquals(AccessType.PROPERTY, javaPersistentType.getAccess());
- }
-
- public void testVirtualAttributes() throws Exception {
- createTestEntityAnnotatedFieldPropertySpecified();
- OrmPersistentType ormPersistentType = getEntityMappings().addPersistentType(MappingKeys.ENTITY_TYPE_MAPPING_KEY, FULLY_QUALIFIED_TYPE_NAME);
-
- ListIterator<OrmPersistentAttribute> virtualAttributes = ormPersistentType.virtualAttributes();
- OrmPersistentAttribute ormPersistentAttribute = virtualAttributes.next();
- assertEquals("id", ormPersistentAttribute.getName());
- assertEquals(AccessType.PROPERTY, ormPersistentAttribute.getAccess());
-
-
- ormPersistentAttribute = virtualAttributes.next();
- assertEquals("name", ormPersistentAttribute.getName());
- assertEquals(AccessType.FIELD, ormPersistentAttribute.getAccess());
-
- assertFalse(virtualAttributes.hasNext());
-
- ormPersistentType.getMapping().setSpecifiedMetadataComplete(Boolean.TRUE);
- virtualAttributes = ormPersistentType.virtualAttributes();
- ormPersistentAttribute = virtualAttributes.next();
- assertEquals("id", ormPersistentAttribute.getName());
- assertEquals(AccessType.FIELD, ormPersistentAttribute.getAccess());
-
-
- ormPersistentAttribute = virtualAttributes.next();
- assertEquals("name", ormPersistentAttribute.getName());
- assertEquals(AccessType.FIELD, ormPersistentAttribute.getAccess());
-
- assertFalse(virtualAttributes.hasNext());
- }
-
- public void testVirtualAttributes2() throws Exception {
- createTestEntityPropertySpecified();
- OrmPersistentType ormPersistentType = getEntityMappings().addPersistentType(MappingKeys.ENTITY_TYPE_MAPPING_KEY, FULLY_QUALIFIED_TYPE_NAME);
-
- ListIterator<OrmPersistentAttribute> virtualAttributes = ormPersistentType.virtualAttributes();
- OrmPersistentAttribute ormPersistentAttribute = virtualAttributes.next();
- assertEquals("id", ormPersistentAttribute.getName());
- assertEquals(AccessType.PROPERTY, ormPersistentAttribute.getAccess());
-
- assertFalse(virtualAttributes.hasNext());
-
- ormPersistentType.getMapping().setSpecifiedMetadataComplete(Boolean.TRUE);
- virtualAttributes = ormPersistentType.virtualAttributes();
- ormPersistentAttribute = virtualAttributes.next();
- assertEquals("id", ormPersistentAttribute.getName());
- assertEquals(AccessType.FIELD, ormPersistentAttribute.getAccess());
-
-
- ormPersistentAttribute = virtualAttributes.next();
- assertEquals("name", ormPersistentAttribute.getName());
- assertEquals(AccessType.FIELD, ormPersistentAttribute.getAccess());
-
- assertFalse(virtualAttributes.hasNext());
-
- ormPersistentType.getMapping().setSpecifiedMetadataComplete(Boolean.FALSE);
- virtualAttributes = ormPersistentType.virtualAttributes();
- ormPersistentAttribute = virtualAttributes.next();
- assertEquals("id", ormPersistentAttribute.getName());
- assertEquals(AccessType.PROPERTY, ormPersistentAttribute.getAccess());
-
- assertFalse(virtualAttributes.hasNext());
- }
-
- public void testVirtualAttributes3() throws Exception {
- createTestEntityFieldSpecifiedPropertyAnnotated();
- OrmPersistentType ormPersistentType = getEntityMappings().addPersistentType(MappingKeys.ENTITY_TYPE_MAPPING_KEY, FULLY_QUALIFIED_TYPE_NAME);
-
- ListIterator<OrmPersistentAttribute> virtualAttributes = ormPersistentType.virtualAttributes();
- OrmPersistentAttribute ormPersistentAttribute = virtualAttributes.next();
- assertEquals("id", ormPersistentAttribute.getName());
- assertEquals(AccessType.FIELD, ormPersistentAttribute.getAccess());
-
- ormPersistentAttribute = virtualAttributes.next();
- assertEquals("name", ormPersistentAttribute.getName());
- assertEquals(AccessType.FIELD, ormPersistentAttribute.getAccess());
-
- ormPersistentAttribute = virtualAttributes.next();
- assertEquals("id", ormPersistentAttribute.getName());
- assertEquals(AccessType.PROPERTY, ormPersistentAttribute.getAccess());
-
- assertFalse(virtualAttributes.hasNext());
-
-
- ormPersistentAttribute.makeSpecified();
-
- virtualAttributes = ormPersistentType.virtualAttributes();
- ormPersistentAttribute = virtualAttributes.next();
- assertEquals("id", ormPersistentAttribute.getName());
- assertEquals(AccessType.FIELD, ormPersistentAttribute.getAccess());
-
- ormPersistentAttribute = virtualAttributes.next();
- assertEquals("name", ormPersistentAttribute.getName());
- assertEquals(AccessType.FIELD, ormPersistentAttribute.getAccess());
-
- assertFalse(virtualAttributes.hasNext());
-
-
- OrmPersistentAttribute specifiedPersistentAttribute = ormPersistentType.specifiedAttributes().next();
- assertEquals("id", specifiedPersistentAttribute.getName());
- assertEquals(AccessType.PROPERTY, specifiedPersistentAttribute.getSpecifiedAccess());
-
-
- ormPersistentType.virtualAttributes().next().makeSpecified();
- virtualAttributes = ormPersistentType.virtualAttributes();
- ormPersistentAttribute = virtualAttributes.next();
- assertEquals("name", ormPersistentAttribute.getName());
- assertEquals(AccessType.FIELD, ormPersistentAttribute.getAccess());
-
- assertFalse(virtualAttributes.hasNext());
- }
-
- public void testGetDefaultAccess() throws Exception {
- createTestEntityPropertySpecified();
- OrmPersistentType ormPersistentType = getEntityMappings().addPersistentType(MappingKeys.ENTITY_TYPE_MAPPING_KEY, FULLY_QUALIFIED_TYPE_NAME);
- JavaPersistentType javaPersistentType = ormPersistentType.getJavaPersistentType();
-
- assertEquals(AccessType.PROPERTY, ormPersistentType.getDefaultAccess());
-
- javaPersistentType.setSpecifiedAccess(AccessType.FIELD);
- assertEquals(AccessType.FIELD, ormPersistentType.getDefaultAccess());
-
- javaPersistentType.setSpecifiedAccess(AccessType.PROPERTY);
- assertEquals(AccessType.PROPERTY, ormPersistentType.getDefaultAccess());
-
-
- ormPersistentType.getMapping().setSpecifiedMetadataComplete(Boolean.TRUE);
- assertEquals(AccessType.FIELD, ormPersistentType.getDefaultAccess());
- }
-
-} \ No newline at end of file
diff --git a/jpa/tests/org.eclipse.jpt.core.tests/src/org/eclipse/jpt2_0/core/tests/internal/context/orm/Generic2_0OrmSequenceGeneratorTests.java b/jpa/tests/org.eclipse.jpt.core.tests/src/org/eclipse/jpt2_0/core/tests/internal/context/orm/Generic2_0OrmSequenceGeneratorTests.java
deleted file mode 100644
index a0fe7c293a..0000000000
--- a/jpa/tests/org.eclipse.jpt.core.tests/src/org/eclipse/jpt2_0/core/tests/internal/context/orm/Generic2_0OrmSequenceGeneratorTests.java
+++ /dev/null
@@ -1,88 +0,0 @@
-/*******************************************************************************
-* Copyright (c) 2009 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.
-*
-* Contributors:
-* Oracle - initial API and implementation
-*******************************************************************************/
-package org.eclipse.jpt2_0.core.tests.internal.context.orm;
-
-import org.eclipse.jpt2_0.core.context.SequenceGenerator2_0;
-import org.eclipse.jpt2_0.core.resource.orm.XmlSequenceGenerator;
-
-/**
- * Generic2_0OrmSequenceGenerator2_0Tests
- */
-public class Generic2_0OrmSequenceGeneratorTests extends Generic2_0OrmContextModelTestCase
-{
-
- public Generic2_0OrmSequenceGeneratorTests(String name) {
- super(name);
- }
-
- // ********** catalog **********
-
- public void testUpdateSpecifiedCatalog() throws Exception {
- SequenceGenerator2_0 sequenceGenerator = (SequenceGenerator2_0) getEntityMappings().addSequenceGenerator(0);
- XmlSequenceGenerator sequenceGeneratorResource = (XmlSequenceGenerator) getXmlEntityMappings().getSequenceGenerators().get(0);
-
- //set name in the resource model, verify context model updated
- sequenceGeneratorResource.setCatalog("FOO");
- assertEquals("FOO", sequenceGenerator.getSpecifiedCatalog());
- assertEquals("FOO", sequenceGeneratorResource.getCatalog());
-
- //set name to null in the resource model
- sequenceGeneratorResource.setCatalog(null);
- assertNull(sequenceGenerator.getSpecifiedCatalog());
- assertNull(sequenceGeneratorResource.getCatalog());
- }
-
- public void testModifySpecifiedCatalog() throws Exception {
- SequenceGenerator2_0 sequenceGenerator = (SequenceGenerator2_0) getEntityMappings().addSequenceGenerator(0);
- XmlSequenceGenerator sequenceGeneratorResource = (XmlSequenceGenerator) getXmlEntityMappings().getSequenceGenerators().get(0);
-
- //set name in the context model, verify resource model modified
- sequenceGenerator.setSpecifiedCatalog("FOO");
- assertEquals("FOO", sequenceGeneratorResource.getCatalog());
- assertEquals("FOO", sequenceGenerator.getSpecifiedCatalog());
-
- //set name to null in the context model
- sequenceGenerator.setSpecifiedCatalog(null);
- assertNull(sequenceGeneratorResource.getCatalog());
- assertNull(sequenceGenerator.getSpecifiedCatalog());
- }
-
- // ********** schema **********
-
- public void testUpdateSpecifiedSchema() throws Exception {
- SequenceGenerator2_0 sequenceGenerator = (SequenceGenerator2_0) getEntityMappings().addSequenceGenerator(0);
- XmlSequenceGenerator sequenceGeneratorResource = (XmlSequenceGenerator) getXmlEntityMappings().getSequenceGenerators().get(0);
-
- //set name in the resource model, verify context model updated
- sequenceGeneratorResource.setSchema("FOO");
- assertEquals("FOO", sequenceGenerator.getSpecifiedSchema());
- assertEquals("FOO", sequenceGeneratorResource.getSchema());
-
- //set name to null in the resource model
- sequenceGeneratorResource.setSchema(null);
- assertNull(sequenceGenerator.getSpecifiedSchema());
- assertNull(sequenceGeneratorResource.getSchema());
- }
-
- public void testModifySpecifiedSchema() throws Exception {
- SequenceGenerator2_0 sequenceGenerator = (SequenceGenerator2_0) getEntityMappings().addSequenceGenerator(0);
- XmlSequenceGenerator sequenceGeneratorResource = (XmlSequenceGenerator) getXmlEntityMappings().getSequenceGenerators().get(0);
-
- //set name in the context model, verify resource model modified
- sequenceGenerator.setSpecifiedSchema("FOO");
- assertEquals("FOO", sequenceGeneratorResource.getSchema());
- assertEquals("FOO", sequenceGenerator.getSpecifiedSchema());
-
- //set name to null in the context model
- sequenceGenerator.setSpecifiedSchema(null);
- assertNull(sequenceGeneratorResource.getSchema());
- assertNull(sequenceGenerator.getSpecifiedSchema());
- }
-} \ No newline at end of file
diff --git a/jpa/tests/org.eclipse.jpt.core.tests/src/org/eclipse/jpt2_0/core/tests/internal/resource/java/AccessAnnotationTests.java b/jpa/tests/org.eclipse.jpt.core.tests/src/org/eclipse/jpt2_0/core/tests/internal/resource/java/AccessAnnotationTests.java
deleted file mode 100644
index 1314c7d60d..0000000000
--- a/jpa/tests/org.eclipse.jpt.core.tests/src/org/eclipse/jpt2_0/core/tests/internal/resource/java/AccessAnnotationTests.java
+++ /dev/null
@@ -1,178 +0,0 @@
-/*******************************************************************************
- * Copyright (c) 2009 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.
- *
- * Contributors:
- * Oracle - initial API and implementation
- ******************************************************************************/
-package org.eclipse.jpt2_0.core.tests.internal.resource.java;
-
-import java.util.Iterator;
-import org.eclipse.jdt.core.ICompilationUnit;
-import org.eclipse.jpt.core.resource.java.AccessType;
-import org.eclipse.jpt.core.resource.java.JPA;
-import org.eclipse.jpt.core.resource.java.JavaResourcePersistentAttribute;
-import org.eclipse.jpt.core.resource.java.JavaResourcePersistentType;
-import org.eclipse.jpt.utility.internal.iterators.ArrayIterator;
-import org.eclipse.jpt2_0.core.resource.java.AccessAnnotation;
-
-@SuppressWarnings("nls")
-public class AccessAnnotationTests extends Generic2_0JavaResourceModelTestCase {
-
- public AccessAnnotationTests(String name) {
- super(name);
- }
-
- private ICompilationUnit createTestAccessOnType() throws Exception {
- return this.createTestType(new DefaultAnnotationWriter() {
- @Override
- public Iterator<String> imports() {
- return new ArrayIterator<String>(JPA.ACCESS, JPA.ACCESS_TYPE);
- }
-
- @Override
- public void appendTypeAnnotationTo(StringBuilder sb) {
- sb.append("@Access(AccessType.PROPERTY)");
- }
- });
- }
-
- private ICompilationUnit createTestAccessOnField() throws Exception {
- return this.createTestType(new DefaultAnnotationWriter() {
- @Override
- public Iterator<String> imports() {
- return new ArrayIterator<String>(JPA.ACCESS, JPA.ACCESS_TYPE);
- }
-
- @Override
- public void appendIdFieldAnnotationTo(StringBuilder sb) {
- sb.append("@Access(AccessType.FIELD)");
- }
- });
- }
-
- private ICompilationUnit createTestAccessOnProperty() throws Exception {
- return this.createTestType(new DefaultAnnotationWriter() {
- @Override
- public Iterator<String> imports() {
- return new ArrayIterator<String>(JPA.ACCESS, JPA.ACCESS_TYPE);
- }
-
- @Override
- public void appendGetIdMethodAnnotationTo(StringBuilder sb) {
- sb.append("@Access(AccessType.PROPERTY)");
- }
- });
- }
-
- public void testGetAccessOnType() throws Exception {
- ICompilationUnit cu = this.createTestAccessOnType();
- JavaResourcePersistentType typeResource = buildJavaTypeResource(cu);
-
- AccessAnnotation access = (AccessAnnotation) typeResource.getSupportingAnnotation(JPA.ACCESS);
- assertNotNull(access);
- assertEquals(AccessType.PROPERTY, access.getValue());
- }
-
- public void testSetAccessOnType() throws Exception {
- ICompilationUnit cu = this.createTestType();
- JavaResourcePersistentType typeResource = buildJavaTypeResource(cu);
-
- AccessAnnotation access = (AccessAnnotation) typeResource.getSupportingAnnotation(JPA.ACCESS);
- assertNull(access);
-
- typeResource.addSupportingAnnotation(JPA.ACCESS);
- assertSourceContains("@Access", cu);
-
- access = (AccessAnnotation) typeResource.getSupportingAnnotation(JPA.ACCESS);
- assertNotNull(access);
-
- access.setValue(AccessType.FIELD);
- assertEquals(AccessType.FIELD, access.getValue());
- assertSourceContains("@Access(FIELD)", cu);
-
- access.setValue(AccessType.PROPERTY);
- assertEquals(AccessType.PROPERTY, access.getValue());
- assertSourceContains("@Access(PROPERTY)", cu);
-
- access.setValue(null);
- assertNull(typeResource.getSupportingAnnotation(JPA.ACCESS));
- assertSourceDoesNotContain("@Access", cu);
- }
-
- public void testGetAccessOnField() throws Exception {
- ICompilationUnit cu = this.createTestAccessOnField();
- JavaResourcePersistentType typeResource = buildJavaTypeResource(cu);
- JavaResourcePersistentAttribute attributeResource = typeResource.persistableFields().next();
-
- AccessAnnotation access = (AccessAnnotation) attributeResource.getSupportingAnnotation(JPA.ACCESS);
- assertNotNull(access);
- assertEquals(AccessType.FIELD, access.getValue());
- }
-
- public void testSetAccessOnField() throws Exception {
- ICompilationUnit cu = this.createTestType();
- JavaResourcePersistentType typeResource = buildJavaTypeResource(cu);
- JavaResourcePersistentAttribute attributeResource = typeResource.persistableFields().next();
-
- AccessAnnotation access = (AccessAnnotation) attributeResource.getSupportingAnnotation(JPA.ACCESS);
- assertNull(access);
-
- attributeResource.addSupportingAnnotation(JPA.ACCESS);
- assertSourceContains("@Access", cu);
-
- access = (AccessAnnotation) attributeResource.getSupportingAnnotation(JPA.ACCESS);
- assertNotNull(access);
-
- access.setValue(AccessType.FIELD);
- assertEquals(AccessType.FIELD, access.getValue());
- assertSourceContains("@Access(FIELD)", cu);
-
- access.setValue(AccessType.PROPERTY);
- assertEquals(AccessType.PROPERTY, access.getValue());
- assertSourceContains("@Access(PROPERTY)", cu);
-
- access.setValue(null);
- assertNull(attributeResource.getSupportingAnnotation(JPA.ACCESS));
- assertSourceDoesNotContain("@Access", cu);
- }
-
- public void testGetAccessOnProperty() throws Exception {
- ICompilationUnit cu = this.createTestAccessOnProperty();
- JavaResourcePersistentType typeResource = buildJavaTypeResource(cu);
- JavaResourcePersistentAttribute attributeResource = typeResource.persistableProperties().next();
-
- AccessAnnotation access = (AccessAnnotation) attributeResource.getSupportingAnnotation(JPA.ACCESS);
- assertNotNull(access);
- assertEquals(AccessType.PROPERTY, access.getValue());
- }
-
- public void testSetAccessOnProperty() throws Exception {
- ICompilationUnit cu = this.createTestType();
- JavaResourcePersistentType typeResource = buildJavaTypeResource(cu);
- JavaResourcePersistentAttribute attributeResource = typeResource.persistableProperties().next();
-
- AccessAnnotation access = (AccessAnnotation) attributeResource.getSupportingAnnotation(JPA.ACCESS);
- assertNull(access);
-
- attributeResource.addSupportingAnnotation(JPA.ACCESS);
- assertSourceContains("@Access", cu);
-
- access = (AccessAnnotation) attributeResource.getSupportingAnnotation(JPA.ACCESS);
- assertNotNull(access);
-
- access.setValue(AccessType.FIELD);
- assertEquals(AccessType.FIELD, access.getValue());
- assertSourceContains("@Access(FIELD)", cu);
-
- access.setValue(AccessType.PROPERTY);
- assertEquals(AccessType.PROPERTY, access.getValue());
- assertSourceContains("@Access(PROPERTY)", cu);
-
- access.setValue(null);
- assertNull(attributeResource.getSupportingAnnotation(JPA.ACCESS));
- assertSourceDoesNotContain("@Access", cu);
- }
-}
diff --git a/jpa/tests/org.eclipse.jpt.core.tests/src/org/eclipse/jpt2_0/core/tests/internal/resource/java/AssociationOverride2_0Tests.java b/jpa/tests/org.eclipse.jpt.core.tests/src/org/eclipse/jpt2_0/core/tests/internal/resource/java/AssociationOverride2_0Tests.java
deleted file mode 100644
index 0b499a3639..0000000000
--- a/jpa/tests/org.eclipse.jpt.core.tests/src/org/eclipse/jpt2_0/core/tests/internal/resource/java/AssociationOverride2_0Tests.java
+++ /dev/null
@@ -1,885 +0,0 @@
-/*******************************************************************************
- * Copyright (c) 2009 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.
- *
- * Contributors:
- * Oracle - initial API and implementation
- ******************************************************************************/
-package org.eclipse.jpt2_0.core.tests.internal.resource.java;
-
-import java.util.Iterator;
-import org.eclipse.jdt.core.ICompilationUnit;
-import org.eclipse.jpt.core.resource.java.AssociationOverrideAnnotation;
-import org.eclipse.jpt.core.resource.java.JPA;
-import org.eclipse.jpt.core.resource.java.JavaResourcePersistentAttribute;
-import org.eclipse.jpt.core.resource.java.JavaResourcePersistentType;
-import org.eclipse.jpt.core.resource.java.JoinColumnAnnotation;
-import org.eclipse.jpt.core.resource.java.JoinTableAnnotation;
-import org.eclipse.jpt.utility.internal.iterators.ArrayIterator;
-import org.eclipse.jpt2_0.core.resource.java.AssociationOverride2_0Annotation;
-
-@SuppressWarnings("nls")
-public class AssociationOverride2_0Tests extends Generic2_0JavaResourceModelTestCase {
-
- private static final String ASSOCIATION_OVERRIDE_NAME = "MY_ASSOCIATION_OVERRIDE";
- private static final String JOIN_TABLE_NAME = "MY_JOIN_TABLE";
- private static final String CATALOG_NAME = "MY_CATALOG";
- private static final String SCHEMA_NAME = "MY_SCHEMA";
-
- public AssociationOverride2_0Tests(String name) {
- super(name);
- }
-
- private ICompilationUnit createTestAssociationOverrideOnField() throws Exception {
- return this.createTestType(new DefaultAnnotationWriter() {
- @Override
- public Iterator<String> imports() {
- return new ArrayIterator<String>(JPA.ASSOCIATION_OVERRIDE);
- }
- @Override
- public void appendIdFieldAnnotationTo(StringBuilder sb) {
- sb.append("@AssociationOverride(name = \"" + ASSOCIATION_OVERRIDE_NAME + "\")");
- }
- });
- }
-
- private ICompilationUnit createTestAssociationOverrideOnType() throws Exception {
- return this.createTestType(new DefaultAnnotationWriter() {
- @Override
- public Iterator<String> imports() {
- return new ArrayIterator<String>(JPA.ASSOCIATION_OVERRIDE);
- }
- @Override
- public void appendTypeAnnotationTo(StringBuilder sb) {
- sb.append("@AssociationOverride(name = \"" + ASSOCIATION_OVERRIDE_NAME + "\")");
- }
- });
- }
-
- private ICompilationUnit createTestAssociationOverrideWithJoinColumns() throws Exception {
- return this.createTestType(new DefaultAnnotationWriter() {
- @Override
- public Iterator<String> imports() {
- return new ArrayIterator<String>(JPA.ASSOCIATION_OVERRIDE, JPA.JOIN_COLUMN);
- }
- @Override
- public void appendIdFieldAnnotationTo(StringBuilder sb) {
- sb.append("@AssociationOverride(name = \"" + ASSOCIATION_OVERRIDE_NAME + "\", joinColumns = {@JoinColumn(name = \"BAR\"), @JoinColumn})");
- }
- });
- }
-
- private ICompilationUnit createTestAssociationOverrideWithJoinTable() throws Exception {
- return this.createTestType(new DefaultAnnotationWriter() {
- @Override
- public Iterator<String> imports() {
- return new ArrayIterator<String>(JPA.ASSOCIATION_OVERRIDE, JPA.JOIN_TABLE);
- }
- @Override
- public void appendTypeAnnotationTo(StringBuilder sb) {
- sb.append("@AssociationOverride(name = \"" + ASSOCIATION_OVERRIDE_NAME + "\", joinTable = @JoinTable(name = \"" + JOIN_TABLE_NAME + "\"))");
- }
- });
- }
-
- private ICompilationUnit createTestAssociationOverrideJoinTableWithCatalog() throws Exception {
- return this.createTestType(new DefaultAnnotationWriter() {
- @Override
- public Iterator<String> imports() {
- return new ArrayIterator<String>(JPA.ASSOCIATION_OVERRIDE, JPA.JOIN_TABLE);
- }
- @Override
- public void appendTypeAnnotationTo(StringBuilder sb) {
- sb.append("@AssociationOverride(name = \"" + ASSOCIATION_OVERRIDE_NAME + "\", joinTable = @JoinTable(catalog = \"" + CATALOG_NAME + "\"))");
- }
- });
- }
-
- private ICompilationUnit createTestAssociationOverrideJoinTableWithSchema() throws Exception {
- return this.createTestType(new DefaultAnnotationWriter() {
- @Override
- public Iterator<String> imports() {
- return new ArrayIterator<String>(JPA.ASSOCIATION_OVERRIDE, JPA.JOIN_TABLE);
- }
- @Override
- public void appendTypeAnnotationTo(StringBuilder sb) {
- sb.append("@AssociationOverride(name = \"" + ASSOCIATION_OVERRIDE_NAME + "\", joinTable = @JoinTable(schema = \"" + SCHEMA_NAME + "\"))");
- }
- });
- }
-
- private ICompilationUnit createTestAssociationOverrideJoinTableWithUniqueConstraints() throws Exception {
- return this.createTestType(new DefaultAnnotationWriter() {
- @Override
- public Iterator<String> imports() {
- return new ArrayIterator<String>(JPA.ASSOCIATION_OVERRIDE, JPA.JOIN_TABLE, JPA.UNIQUE_CONSTRAINT);
- }
- @Override
- public void appendTypeAnnotationTo(StringBuilder sb) {
- sb.append("@AssociationOverride(name = \"" + ASSOCIATION_OVERRIDE_NAME + "\", joinTable = @JoinTable(uniqueConstraints = {@UniqueConstraint(columnNames = {\"BAR\"}), @UniqueConstraint(columnNames = {\"FOO\"}), @UniqueConstraint(columnNames = {\"BAZ\"})}))");
- }
- });
- }
-
- private ICompilationUnit createTestAssociationOverrideJoinTableWithJoinColumns() throws Exception {
- return this.createTestType(new DefaultAnnotationWriter() {
- @Override
- public Iterator<String> imports() {
- return new ArrayIterator<String>(JPA.ASSOCIATION_OVERRIDE, JPA.JOIN_TABLE, JPA.JOIN_COLUMN);
- }
- @Override
- public void appendTypeAnnotationTo(StringBuilder sb) {
- sb.append("@AssociationOverride(name = \"" + ASSOCIATION_OVERRIDE_NAME + "\", joinTable = @JoinTable(joinColumns = {@JoinColumn(name = \"BAR\"), @JoinColumn}))");
- }
- });
- }
-
- private ICompilationUnit createTestAssociationOverrideJoinTableWithInverseJoinColumns() throws Exception {
- return this.createTestType(new DefaultAnnotationWriter() {
- @Override
- public Iterator<String> imports() {
- return new ArrayIterator<String>(JPA.ASSOCIATION_OVERRIDE, JPA.JOIN_TABLE, JPA.JOIN_COLUMN);
- }
- @Override
- public void appendTypeAnnotationTo(StringBuilder sb) {
- sb.append("@AssociationOverride(name = \"" + ASSOCIATION_OVERRIDE_NAME + "\", joinTable = @JoinTable(inverseJoinColumns = {@JoinColumn(name = \"BAR\"), @JoinColumn}))");
- }
- });
- }
-
- public void testGetName() throws Exception {
- ICompilationUnit cu = this.createTestAssociationOverrideOnField();
- JavaResourcePersistentType typeResource = buildJavaTypeResource(cu);
- JavaResourcePersistentAttribute attributeResource = typeResource.fields().next();
- AssociationOverrideAnnotation associationOverride = (AssociationOverrideAnnotation) attributeResource.getSupportingAnnotation(JPA.ASSOCIATION_OVERRIDE);
-
- assertNotNull(associationOverride);
- assertEquals(ASSOCIATION_OVERRIDE_NAME, associationOverride.getName());
- }
-
- public void testSetName() throws Exception {
- ICompilationUnit cu = this.createTestAssociationOverrideOnField();
- JavaResourcePersistentType typeResource = buildJavaTypeResource(cu);
- JavaResourcePersistentAttribute attributeResource = typeResource.fields().next();
- AssociationOverrideAnnotation associationOverride = (AssociationOverrideAnnotation) attributeResource.getSupportingAnnotation(JPA.ASSOCIATION_OVERRIDE);
-
- assertNotNull(associationOverride);
- assertEquals(ASSOCIATION_OVERRIDE_NAME, associationOverride.getName());
-
- associationOverride.setName("Foo");
- assertEquals("Foo", associationOverride.getName());
- assertSourceContains("@AssociationOverride(name = \"Foo\")", cu);
- }
-
- public void testSetNameNull() throws Exception {
- ICompilationUnit cu = this.createTestAssociationOverrideOnField();
- JavaResourcePersistentType typeResource = buildJavaTypeResource(cu);
- JavaResourcePersistentAttribute attributeResource = typeResource.fields().next();
- AssociationOverrideAnnotation associationOverride = (AssociationOverrideAnnotation) attributeResource.getSupportingAnnotation(JPA.ASSOCIATION_OVERRIDE);
-
- assertEquals(ASSOCIATION_OVERRIDE_NAME, associationOverride.getName());
-
- associationOverride.setName(null);
- assertNull(associationOverride.getName());
-
- assertSourceDoesNotContain("@AssociationOverride(name = \"" + ASSOCIATION_OVERRIDE_NAME + "\")", cu);
- assertSourceContains("@AssociationOverride", cu);
- }
-
-
- public void testJoinColumns() throws Exception {
- ICompilationUnit cu = this.createTestAssociationOverrideOnField();
- JavaResourcePersistentType typeResource = buildJavaTypeResource(cu);
- JavaResourcePersistentAttribute attributeResource = typeResource.fields().next();
-
- AssociationOverrideAnnotation associationOverride = (AssociationOverrideAnnotation) attributeResource.getSupportingAnnotation(JPA.ASSOCIATION_OVERRIDE);
-
- assertEquals(0, associationOverride.joinColumnsSize());
- }
-
- public void testJoinColumns2() throws Exception {
- ICompilationUnit cu = this.createTestAssociationOverrideOnField();
- JavaResourcePersistentType typeResource = buildJavaTypeResource(cu);
- JavaResourcePersistentAttribute attributeResource = typeResource.fields().next();
-
- AssociationOverrideAnnotation associationOverride = (AssociationOverrideAnnotation) attributeResource.getSupportingAnnotation(JPA.ASSOCIATION_OVERRIDE);
-
-
- associationOverride.addJoinColumn(0);
- associationOverride.addJoinColumn(1);
-
- assertEquals(2, associationOverride.joinColumnsSize());
- }
-
- public void testJoinColumns3() throws Exception {
- ICompilationUnit cu = this.createTestAssociationOverrideWithJoinColumns();
- JavaResourcePersistentType typeResource = buildJavaTypeResource(cu);
- JavaResourcePersistentAttribute attributeResource = typeResource.fields().next();
-
- AssociationOverrideAnnotation associationOverride = (AssociationOverrideAnnotation) attributeResource.getSupportingAnnotation(JPA.ASSOCIATION_OVERRIDE);
-
- assertEquals(2, associationOverride.joinColumnsSize());
- }
-
- public void testAddJoinColumn() throws Exception {
- ICompilationUnit cu = this.createTestAssociationOverrideOnField();
- JavaResourcePersistentType typeResource = buildJavaTypeResource(cu);
- JavaResourcePersistentAttribute attributeResource = typeResource.fields().next();
-
- AssociationOverrideAnnotation associationOverride = (AssociationOverrideAnnotation) attributeResource.getSupportingAnnotation(JPA.ASSOCIATION_OVERRIDE);
-
- associationOverride.addJoinColumn(0).setName("FOO");
- associationOverride.addJoinColumn(1);
- associationOverride.addJoinColumn(0).setName("BAR");
-
- assertEquals("BAR", associationOverride.joinColumnAt(0).getName());
- assertEquals("FOO", associationOverride.joinColumnAt(1).getName());
- assertNull(associationOverride.joinColumnAt(2).getName());
-
- assertSourceContains("@AssociationOverride(name = \"" + ASSOCIATION_OVERRIDE_NAME + "\", joinColumns = {@JoinColumn(name = \"BAR\"),@JoinColumn(name = \"FOO\"), @JoinColumn})", cu);
- }
-
- public void testRemoveJoinColumn() throws Exception {
- ICompilationUnit cu = this.createTestAssociationOverrideWithJoinColumns();
- JavaResourcePersistentType typeResource = buildJavaTypeResource(cu);
- JavaResourcePersistentAttribute attributeResource = typeResource.fields().next();
-
- AssociationOverrideAnnotation associationOverride = (AssociationOverrideAnnotation) attributeResource.getSupportingAnnotation(JPA.ASSOCIATION_OVERRIDE);
- associationOverride.addJoinColumn(0).setName("FOO");
-
- Iterator<JoinColumnAnnotation> joinColumns = associationOverride.joinColumns();
- assertEquals("FOO", joinColumns.next().getName());
- assertEquals("BAR", joinColumns.next().getName());
- assertNull(joinColumns.next().getName());
- assertEquals(false, joinColumns.hasNext());
- assertSourceContains("@AssociationOverride(name = \"" + ASSOCIATION_OVERRIDE_NAME + "\", joinColumns = {@JoinColumn(name = \"FOO\"), @JoinColumn(name = \"BAR\"), @JoinColumn})", cu);
-
- associationOverride.removeJoinColumn(1);
- joinColumns = associationOverride.joinColumns();
- assertEquals("FOO", joinColumns.next().getName());
- assertNull(joinColumns.next().getName());
- assertEquals(false, joinColumns.hasNext());
- assertSourceContains("@AssociationOverride(name = \"" + ASSOCIATION_OVERRIDE_NAME + "\", joinColumns = {@JoinColumn(name = \"FOO\"), @JoinColumn})", cu);
-
- associationOverride.removeJoinColumn(0);
- joinColumns = associationOverride.joinColumns();
- assertNull(joinColumns.next().getName());
- assertEquals(false, joinColumns.hasNext());
- assertSourceContains("@AssociationOverride(name = \"" + ASSOCIATION_OVERRIDE_NAME + "\", joinColumns = @JoinColumn)", cu);
-
-
- associationOverride.setName(null);
- associationOverride.removeJoinColumn(0);
- assertSourceDoesNotContain("@AssociationOverride", cu);
- }
-
- public void testMoveJoinColumn() throws Exception {
- ICompilationUnit cu = this.createTestAssociationOverrideWithJoinColumns();
- JavaResourcePersistentType typeResource = buildJavaTypeResource(cu);
- JavaResourcePersistentAttribute attributeResource = typeResource.fields().next();
-
- AssociationOverrideAnnotation associationOverride = (AssociationOverrideAnnotation) attributeResource.getSupportingAnnotation(JPA.ASSOCIATION_OVERRIDE);
- JoinColumnAnnotation joinColumn = associationOverride.joinColumnAt(0);
- joinColumn.setReferencedColumnName("REF_NAME");
- joinColumn.setUnique(Boolean.FALSE);
- joinColumn.setNullable(Boolean.FALSE);
- joinColumn.setInsertable(Boolean.FALSE);
- joinColumn.setUpdatable(Boolean.FALSE);
- joinColumn.setColumnDefinition("COLUMN_DEF");
- joinColumn.setTable("TABLE");
- associationOverride.addJoinColumn(0).setName("FOO");
-
- assertSourceContains("@AssociationOverride(name = \"" + ASSOCIATION_OVERRIDE_NAME + "\", joinColumns = {@JoinColumn(name = \"FOO\"), @JoinColumn(name = \"BAR\", referencedColumnName = \"REF_NAME\", unique = false, nullable = false, insertable = false, updatable = false, columnDefinition = \"COLUMN_DEF\", table = \"TABLE\"), @JoinColumn})", cu);
-
- associationOverride.moveJoinColumn(2, 0);
- assertEquals("BAR", associationOverride.joinColumnAt(0).getName());
- assertNull(associationOverride.joinColumnAt(1).getName());
- assertEquals("FOO", associationOverride.joinColumnAt(2).getName());
- assertEquals(3, associationOverride.joinColumnsSize());
- assertSourceContains("@AssociationOverride(name = \"" + ASSOCIATION_OVERRIDE_NAME + "\", joinColumns = {@JoinColumn(name = \"BAR\", referencedColumnName = \"REF_NAME\", unique = false, nullable = false, insertable = false, updatable = false, columnDefinition = \"COLUMN_DEF\", table = \"TABLE\"), @JoinColumn, @JoinColumn(name = \"FOO\")})", cu);
- }
-
- public void testMoveJoinColumn2() throws Exception {
- ICompilationUnit cu = this.createTestAssociationOverrideWithJoinColumns();
- JavaResourcePersistentType typeResource = buildJavaTypeResource(cu);
- JavaResourcePersistentAttribute attributeResource = typeResource.fields().next();
-
- AssociationOverrideAnnotation associationOverride = (AssociationOverrideAnnotation) attributeResource.getSupportingAnnotation(JPA.ASSOCIATION_OVERRIDE);
-
- JoinColumnAnnotation joinColumn = associationOverride.joinColumnAt(0);
- joinColumn.setReferencedColumnName("REF_NAME");
- joinColumn.setUnique(Boolean.FALSE);
- joinColumn.setNullable(Boolean.FALSE);
- joinColumn.setInsertable(Boolean.FALSE);
- joinColumn.setUpdatable(Boolean.FALSE);
- joinColumn.setColumnDefinition("COLUMN_DEF");
- joinColumn.setTable("TABLE");
- associationOverride.addJoinColumn(0).setName("FOO");
-
- assertSourceContains("@AssociationOverride(name = \"" + ASSOCIATION_OVERRIDE_NAME + "\", joinColumns = {@JoinColumn(name = \"FOO\"), @JoinColumn(name = \"BAR\", referencedColumnName = \"REF_NAME\", unique = false, nullable = false, insertable = false, updatable = false, columnDefinition = \"COLUMN_DEF\", table = \"TABLE\"), @JoinColumn})", cu);
-
- associationOverride.moveJoinColumn(0, 2);
- assertNull(associationOverride.joinColumnAt(0).getName());
- assertEquals("FOO", associationOverride.joinColumnAt(1).getName());
- assertEquals("BAR", associationOverride.joinColumnAt(2).getName());
- assertEquals(3, associationOverride.joinColumnsSize());
- assertSourceContains("@AssociationOverride(name = \"" + ASSOCIATION_OVERRIDE_NAME + "\", joinColumns = {@JoinColumn, @JoinColumn(name = \"FOO\"), @JoinColumn(name = \"BAR\", referencedColumnName = \"REF_NAME\", unique = false, nullable = false, insertable = false, updatable = false, columnDefinition = \"COLUMN_DEF\", table = \"TABLE\")})", cu);
- }
-
- public void testSetJoinColumnName() throws Exception {
- ICompilationUnit cu = this.createTestAssociationOverrideWithJoinColumns();
- JavaResourcePersistentType typeResource = buildJavaTypeResource(cu);
- JavaResourcePersistentAttribute attributeResource = typeResource.fields().next();
-
- AssociationOverrideAnnotation associationOverride = (AssociationOverrideAnnotation) attributeResource.getSupportingAnnotation(JPA.ASSOCIATION_OVERRIDE);
-
- assertEquals(2, associationOverride.joinColumnsSize());
-
- JoinColumnAnnotation joinColumn = associationOverride.joinColumns().next();
-
- assertEquals("BAR", joinColumn.getName());
-
- joinColumn.setName("foo");
- assertEquals("foo", joinColumn.getName());
-
- assertSourceContains("@AssociationOverride(name = \"" + ASSOCIATION_OVERRIDE_NAME + "\", joinColumns = {@JoinColumn(name = \"foo\"), @JoinColumn})", cu);
- }
-
- public void testGetNullJoinTable() throws Exception {
- ICompilationUnit cu = this.createTestAssociationOverrideOnType();
- JavaResourcePersistentType typeResource = buildJavaTypeResource(cu);
- AssociationOverride2_0Annotation associationOverride = (AssociationOverride2_0Annotation) typeResource.getSupportingAnnotation(JPA.ASSOCIATION_OVERRIDE);
- JoinTableAnnotation joinTable = associationOverride.getJoinTable();
- assertNotNull(associationOverride);
- assertNull(joinTable);
- }
-
- public void testJoinTableGetName() throws Exception {
- ICompilationUnit cu = this.createTestAssociationOverrideWithJoinTable();
- JavaResourcePersistentType typeResource = buildJavaTypeResource(cu);
- AssociationOverride2_0Annotation associationOverride = (AssociationOverride2_0Annotation) typeResource.getSupportingAnnotation(JPA.ASSOCIATION_OVERRIDE);
- JoinTableAnnotation joinTable = associationOverride.getJoinTable();
- assertEquals(JOIN_TABLE_NAME, joinTable.getName());
- }
-
- public void testJoinTableSetName() throws Exception {
- ICompilationUnit cu = this.createTestAssociationOverrideWithJoinTable();
- JavaResourcePersistentType typeResource = buildJavaTypeResource(cu);
- AssociationOverride2_0Annotation associationOverride = (AssociationOverride2_0Annotation) typeResource.getSupportingAnnotation(JPA.ASSOCIATION_OVERRIDE);
- JoinTableAnnotation joinTable = associationOverride.getJoinTable();
- assertEquals(JOIN_TABLE_NAME, joinTable.getName());
-
- joinTable.setName("Foo");
-
- assertSourceContains("@AssociationOverride(name = \"" + ASSOCIATION_OVERRIDE_NAME + "\", joinTable = @JoinTable(name = \"Foo\"))", cu);
-
- joinTable.setName(null);
- assertNull(associationOverride.getJoinTable());
- assertSourceContains("@AssociationOverride(name = \"" + ASSOCIATION_OVERRIDE_NAME + "\")", cu);
- }
-
- public void testAddJoinTable() throws Exception {
- ICompilationUnit cu = this.createTestAssociationOverrideOnType();
- JavaResourcePersistentType typeResource = buildJavaTypeResource(cu);
- AssociationOverride2_0Annotation associationOverride = (AssociationOverride2_0Annotation) typeResource.getSupportingAnnotation(JPA.ASSOCIATION_OVERRIDE);
- JoinTableAnnotation joinTable = associationOverride.getJoinTable();
- assertNull(joinTable);
-
- associationOverride.addJoinTable();
- joinTable = associationOverride.getJoinTable();
- assertNotNull(joinTable);
- assertSourceContains("@AssociationOverride(name = \"" + ASSOCIATION_OVERRIDE_NAME + "\", joinTable = @JoinTable)", cu);
- }
-
- public void testRemoveJoinTable() throws Exception {
- ICompilationUnit cu = this.createTestAssociationOverrideOnType();
- JavaResourcePersistentType typeResource = buildJavaTypeResource(cu);
- AssociationOverride2_0Annotation associationOverride = (AssociationOverride2_0Annotation) typeResource.getSupportingAnnotation(JPA.ASSOCIATION_OVERRIDE);
- JoinTableAnnotation joinTable = associationOverride.getJoinTable();
- assertNull(joinTable);
- }
-
- public void testJoinTableGetCatalog() throws Exception {
- ICompilationUnit cu = this.createTestAssociationOverrideJoinTableWithCatalog();
- JavaResourcePersistentType typeResource = buildJavaTypeResource(cu);
-
- AssociationOverride2_0Annotation associationOverride = (AssociationOverride2_0Annotation) typeResource.getSupportingAnnotation(JPA.ASSOCIATION_OVERRIDE);
- JoinTableAnnotation table = associationOverride.getJoinTable();
- assertNotNull(table);
- assertEquals(CATALOG_NAME, table.getCatalog());
- }
-
- public void testJoinTableSetCatalog() throws Exception {
- ICompilationUnit cu = this.createTestAssociationOverrideWithJoinTable();
- JavaResourcePersistentType typeResource = buildJavaTypeResource(cu);
-
- AssociationOverride2_0Annotation associationOverride = (AssociationOverride2_0Annotation) typeResource.getSupportingAnnotation(JPA.ASSOCIATION_OVERRIDE);
- JoinTableAnnotation table = associationOverride.getJoinTable();
- assertNotNull(table);
- assertNull(table.getCatalog());
-
- table.setCatalog("Foo");
- assertEquals("Foo", table.getCatalog());
-
- assertSourceContains("@AssociationOverride(name = \"" + ASSOCIATION_OVERRIDE_NAME + "\", joinTable = @JoinTable(name = \"MY_JOIN_TABLE\", catalog = \"Foo\"))", cu);
- }
-
- public void testJoinTableSetCatalogNull() throws Exception {
- ICompilationUnit cu = this.createTestAssociationOverrideJoinTableWithCatalog();
- JavaResourcePersistentType typeResource = buildJavaTypeResource(cu);
-
- AssociationOverride2_0Annotation associationOverride = (AssociationOverride2_0Annotation) typeResource.getSupportingAnnotation(JPA.ASSOCIATION_OVERRIDE);
- JoinTableAnnotation table = associationOverride.getJoinTable();
- assertEquals(CATALOG_NAME, table.getCatalog());
-
- table.setCatalog(null);
- assertNull(table.getCatalog());
-
- assertSourceDoesNotContain("@JoinTable", cu);
- }
-
- public void testJoinTableGetSchema() throws Exception {
- ICompilationUnit cu = this.createTestAssociationOverrideJoinTableWithSchema();
- JavaResourcePersistentType typeResource = buildJavaTypeResource(cu);
-
- AssociationOverride2_0Annotation associationOverride = (AssociationOverride2_0Annotation) typeResource.getSupportingAnnotation(JPA.ASSOCIATION_OVERRIDE);
- JoinTableAnnotation table = associationOverride.getJoinTable();
- assertNotNull(table);
- assertEquals(SCHEMA_NAME, table.getSchema());
- }
-
- public void testJoinTableSetSchema() throws Exception {
- ICompilationUnit cu = this.createTestAssociationOverrideWithJoinTable();
- JavaResourcePersistentType typeResource = buildJavaTypeResource(cu);
-
- AssociationOverride2_0Annotation associationOverride = (AssociationOverride2_0Annotation) typeResource.getSupportingAnnotation(JPA.ASSOCIATION_OVERRIDE);
- JoinTableAnnotation table = associationOverride.getJoinTable();
- assertNotNull(table);
- assertNull(table.getSchema());
-
- table.setSchema("Foo");
- assertEquals("Foo", table.getSchema());
-
- assertSourceContains("@AssociationOverride(name = \"" + ASSOCIATION_OVERRIDE_NAME + "\", joinTable = @JoinTable(name = \"MY_JOIN_TABLE\", schema = \"Foo\"))", cu);
- }
-
- public void testJoinTableSetSchemaNull() throws Exception {
- ICompilationUnit cu = this.createTestAssociationOverrideJoinTableWithSchema();
- JavaResourcePersistentType typeResource = buildJavaTypeResource(cu);
-
- AssociationOverride2_0Annotation associationOverride = (AssociationOverride2_0Annotation) typeResource.getSupportingAnnotation(JPA.ASSOCIATION_OVERRIDE);
- JoinTableAnnotation table = associationOverride.getJoinTable();
- assertEquals(SCHEMA_NAME, table.getSchema());
-
- table.setSchema(null);
- assertNull(table.getSchema());
-
- assertSourceDoesNotContain("@JoinTable", cu);
- }
-
- public void testJoinTableUniqueConstraints() throws Exception {
- ICompilationUnit cu = this.createTestAssociationOverrideWithJoinTable();
- JavaResourcePersistentType typeResource = buildJavaTypeResource(cu);
-
- AssociationOverride2_0Annotation associationOverride = (AssociationOverride2_0Annotation) typeResource.getSupportingAnnotation(JPA.ASSOCIATION_OVERRIDE);
- JoinTableAnnotation table = associationOverride.getJoinTable();
-
- assertEquals(0, table.uniqueConstraintsSize());
- }
-
- public void testJoinTableUniqueConstraints2() throws Exception {
- ICompilationUnit cu = this.createTestAssociationOverrideWithJoinTable();
- JavaResourcePersistentType typeResource = buildJavaTypeResource(cu);
-
- AssociationOverride2_0Annotation associationOverride = (AssociationOverride2_0Annotation) typeResource.getSupportingAnnotation(JPA.ASSOCIATION_OVERRIDE);
- JoinTableAnnotation table = associationOverride.getJoinTable();
-
-
- table.addUniqueConstraint(0);
- table.addUniqueConstraint(1);
-
- assertEquals(2, table.uniqueConstraintsSize());
- }
-
- public void testJoinTableUniqueConstraints3() throws Exception {
- ICompilationUnit cu = this.createTestAssociationOverrideJoinTableWithUniqueConstraints();
- JavaResourcePersistentType typeResource = buildJavaTypeResource(cu);
-
- AssociationOverride2_0Annotation associationOverride = (AssociationOverride2_0Annotation) typeResource.getSupportingAnnotation(JPA.ASSOCIATION_OVERRIDE);
- JoinTableAnnotation table = associationOverride.getJoinTable();
-
- assertEquals(3, table.uniqueConstraintsSize());
- }
-
- public void testJoinTableAddUniqueConstraint() throws Exception {
- ICompilationUnit cu = this.createTestAssociationOverrideWithJoinTable();
- JavaResourcePersistentType typeResource = buildJavaTypeResource(cu);
-
- AssociationOverride2_0Annotation associationOverride = (AssociationOverride2_0Annotation) typeResource.getSupportingAnnotation(JPA.ASSOCIATION_OVERRIDE);
- JoinTableAnnotation table = associationOverride.getJoinTable();
-
- table.addUniqueConstraint(0).addColumnName("FOO");
- table.addUniqueConstraint(1);
- table.addUniqueConstraint(0).addColumnName("BAR");
-
- assertEquals("BAR", table.uniqueConstraintAt(0).columnNames().next());
- assertEquals("FOO", table.uniqueConstraintAt(1).columnNames().next());
- assertEquals(0, table.uniqueConstraintAt(2).columnNamesSize());
-
- assertSourceContains("@AssociationOverride(name = \"" + ASSOCIATION_OVERRIDE_NAME + "\", joinTable = @JoinTable(name = \"MY_JOIN_TABLE\", uniqueConstraints = {@UniqueConstraint(columnNames = \"BAR\"),@UniqueConstraint(columnNames = \"FOO\"), @UniqueConstraint}))", cu);
- }
-
- public void testJoinTableRemoveUniqueConstraint() throws Exception {
- ICompilationUnit cu = this.createTestAssociationOverrideJoinTableWithUniqueConstraints();
- JavaResourcePersistentType typeResource = buildJavaTypeResource(cu);
-
- AssociationOverride2_0Annotation associationOverride = (AssociationOverride2_0Annotation) typeResource.getSupportingAnnotation(JPA.ASSOCIATION_OVERRIDE);
- JoinTableAnnotation table = associationOverride.getJoinTable();
- assertEquals("BAR", table.uniqueConstraintAt(0).columnNames().next());
- assertEquals("FOO", table.uniqueConstraintAt(1).columnNames().next());
- assertEquals("BAZ", table.uniqueConstraintAt(2).columnNames().next());
- assertEquals(3, table.uniqueConstraintsSize());
-
- table.removeUniqueConstraint(1);
- assertEquals("BAR", table.uniqueConstraintAt(0).columnNames().next());
- assertEquals("BAZ", table.uniqueConstraintAt(1).columnNames().next());
- assertEquals(2, table.uniqueConstraintsSize());
- assertSourceContains("@AssociationOverride(name = \"" + ASSOCIATION_OVERRIDE_NAME + "\", joinTable = @JoinTable(uniqueConstraints = {@UniqueConstraint(columnNames = {\"BAR\"}), @UniqueConstraint(columnNames = {\"BAZ\"})}))", cu);
-
- table.removeUniqueConstraint(0);
- assertEquals("BAZ", table.uniqueConstraintAt(0).columnNames().next());
- assertEquals(1, table.uniqueConstraintsSize());
- assertSourceContains("@AssociationOverride(name = \"" + ASSOCIATION_OVERRIDE_NAME + "\", joinTable = @JoinTable(uniqueConstraints = @UniqueConstraint(columnNames = {\"BAZ\"})))", cu);
-
- table.removeUniqueConstraint(0);
- assertEquals(0, table.uniqueConstraintsSize());
- assertSourceDoesNotContain("@JoinTable", cu);
- }
-
- public void testJoinTableMoveUniqueConstraint() throws Exception {
- ICompilationUnit cu = this.createTestAssociationOverrideJoinTableWithUniqueConstraints();
- JavaResourcePersistentType typeResource = buildJavaTypeResource(cu);
-
- AssociationOverride2_0Annotation associationOverride = (AssociationOverride2_0Annotation) typeResource.getSupportingAnnotation(JPA.ASSOCIATION_OVERRIDE);
- JoinTableAnnotation table = associationOverride.getJoinTable();
- assertSourceContains("@AssociationOverride(name = \"" + ASSOCIATION_OVERRIDE_NAME + "\", joinTable = @JoinTable(uniqueConstraints = {@UniqueConstraint(columnNames = {\"BAR\"}), @UniqueConstraint(columnNames = {\"FOO\"}), @UniqueConstraint(columnNames = {\"BAZ\"})}))", cu);
-
- table.moveUniqueConstraint(2, 0);
- assertSourceContains("@AssociationOverride(name = \"" + ASSOCIATION_OVERRIDE_NAME + "\", joinTable = @JoinTable(uniqueConstraints = {@UniqueConstraint(columnNames = {\"FOO\"}), @UniqueConstraint(columnNames = {\"BAZ\"}), @UniqueConstraint(columnNames = {\"BAR\"})}))", cu);
- }
-
- public void testJoinTableMoveUniqueConstraint2() throws Exception {
- ICompilationUnit cu = this.createTestAssociationOverrideJoinTableWithUniqueConstraints();
- JavaResourcePersistentType typeResource = buildJavaTypeResource(cu);
-
- AssociationOverride2_0Annotation associationOverride = (AssociationOverride2_0Annotation) typeResource.getSupportingAnnotation(JPA.ASSOCIATION_OVERRIDE);
- JoinTableAnnotation table = associationOverride.getJoinTable();
- assertSourceContains("@AssociationOverride(name = \"" + ASSOCIATION_OVERRIDE_NAME + "\", joinTable = @JoinTable(uniqueConstraints = {@UniqueConstraint(columnNames = {\"BAR\"}), @UniqueConstraint(columnNames = {\"FOO\"}), @UniqueConstraint(columnNames = {\"BAZ\"})}))", cu);
-
- table.moveUniqueConstraint(0, 2);
- assertSourceContains("@AssociationOverride(name = \"" + ASSOCIATION_OVERRIDE_NAME + "\", joinTable = @JoinTable(uniqueConstraints = {@UniqueConstraint(columnNames = {\"BAZ\"}), @UniqueConstraint(columnNames = {\"BAR\"}), @UniqueConstraint(columnNames = {\"FOO\"})}))", cu);
- }
-
- public void testJoinTableJoinColumns() throws Exception {
- ICompilationUnit cu = this.createTestAssociationOverrideWithJoinTable();
- JavaResourcePersistentType typeResource = buildJavaTypeResource(cu);
-
- AssociationOverride2_0Annotation associationOverride = (AssociationOverride2_0Annotation) typeResource.getSupportingAnnotation(JPA.ASSOCIATION_OVERRIDE);
- JoinTableAnnotation table = associationOverride.getJoinTable();
-
- assertEquals(0, table.joinColumnsSize());
- }
-
- public void testJoinTableJoinColumns2() throws Exception {
- ICompilationUnit cu = this.createTestAssociationOverrideWithJoinTable();
- JavaResourcePersistentType typeResource = buildJavaTypeResource(cu);
-
- AssociationOverride2_0Annotation associationOverride = (AssociationOverride2_0Annotation) typeResource.getSupportingAnnotation(JPA.ASSOCIATION_OVERRIDE);
- JoinTableAnnotation table = associationOverride.getJoinTable();
-
-
- table.addJoinColumn(0);
- table.addJoinColumn(1);
-
- assertEquals(2, table.joinColumnsSize());
- }
-
- public void testJoinTableJoinColumns3() throws Exception {
- ICompilationUnit cu = this.createTestAssociationOverrideJoinTableWithJoinColumns();
- JavaResourcePersistentType typeResource = buildJavaTypeResource(cu);
-
- AssociationOverride2_0Annotation associationOverride = (AssociationOverride2_0Annotation) typeResource.getSupportingAnnotation(JPA.ASSOCIATION_OVERRIDE);
- JoinTableAnnotation table = associationOverride.getJoinTable();
-
- assertEquals(2, table.joinColumnsSize());
- }
-
- public void testJoinTableAddJoinColumn() throws Exception {
- ICompilationUnit cu = this.createTestAssociationOverrideWithJoinTable();
- JavaResourcePersistentType typeResource = buildJavaTypeResource(cu);
-
- AssociationOverride2_0Annotation associationOverride = (AssociationOverride2_0Annotation) typeResource.getSupportingAnnotation(JPA.ASSOCIATION_OVERRIDE);
- JoinTableAnnotation table = associationOverride.getJoinTable();
-
- table.addJoinColumn(0).setName("FOO");
- table.addJoinColumn(1);
- table.addJoinColumn(0).setName("BAR");
-
- assertEquals("BAR", table.joinColumnAt(0).getName());
- assertEquals("FOO", table.joinColumnAt(1).getName());
- assertNull(table.joinColumnAt(2).getName());
- assertSourceContains("@AssociationOverride(name = \"" + ASSOCIATION_OVERRIDE_NAME + "\", joinTable = @JoinTable(name = \"MY_JOIN_TABLE\", joinColumns = {@JoinColumn(name = \"BAR\"),@JoinColumn(name = \"FOO\"), @JoinColumn}))", cu);
- }
-
- public void testJoinTableRemoveJoinColumn() throws Exception {
- ICompilationUnit cu = this.createTestAssociationOverrideJoinTableWithJoinColumns();
- JavaResourcePersistentType typeResource = buildJavaTypeResource(cu);
-
- AssociationOverride2_0Annotation associationOverride = (AssociationOverride2_0Annotation) typeResource.getSupportingAnnotation(JPA.ASSOCIATION_OVERRIDE);
- JoinTableAnnotation table = associationOverride.getJoinTable();
- table.addJoinColumn(0).setName("FOO");
-
- assertEquals("FOO", table.joinColumnAt(0).getName());
- assertEquals("BAR", table.joinColumnAt(1).getName());
- assertNull(table.joinColumnAt(2).getName());
- assertEquals(3, table.joinColumnsSize());
-
- table.removeJoinColumn(1);
- assertEquals("FOO", table.joinColumnAt(0).getName());
- assertNull(table.joinColumnAt(1).getName());
- assertEquals(2, table.joinColumnsSize());
- assertSourceContains("@AssociationOverride(name = \"" + ASSOCIATION_OVERRIDE_NAME + "\", joinTable = @JoinTable(joinColumns = {@JoinColumn(name = \"FOO\"), @JoinColumn}))", cu);
-
- table.removeJoinColumn(0);
- assertNull(table.joinColumnAt(0).getName());
- assertEquals(1, table.joinColumnsSize());
- assertSourceContains("@AssociationOverride(name = \"" + ASSOCIATION_OVERRIDE_NAME + "\", joinTable = @JoinTable(joinColumns = @JoinColumn))", cu);
-
-
- table.removeJoinColumn(0);
- assertEquals(0, table.joinColumnsSize());
- assertSourceDoesNotContain("@JoinTable", cu);
- }
-
- public void testJoinTableMoveJoinColumn() throws Exception {
- ICompilationUnit cu = this.createTestAssociationOverrideJoinTableWithJoinColumns();
- JavaResourcePersistentType typeResource = buildJavaTypeResource(cu);
-
- AssociationOverride2_0Annotation associationOverride = (AssociationOverride2_0Annotation) typeResource.getSupportingAnnotation(JPA.ASSOCIATION_OVERRIDE);
- JoinTableAnnotation table = associationOverride.getJoinTable();
- JoinColumnAnnotation joinColumn = table.joinColumnAt(0);
- joinColumn.setReferencedColumnName("REF_NAME");
- joinColumn.setUnique(Boolean.FALSE);
- joinColumn.setNullable(Boolean.FALSE);
- joinColumn.setInsertable(Boolean.FALSE);
- joinColumn.setUpdatable(Boolean.FALSE);
- joinColumn.setColumnDefinition("COLUMN_DEF");
- joinColumn.setTable("TABLE");
- table.addJoinColumn(0).setName("FOO");
-
- assertSourceContains("@AssociationOverride(name = \"" + ASSOCIATION_OVERRIDE_NAME + "\", joinTable = @JoinTable(joinColumns = {@JoinColumn(name = \"FOO\"), @JoinColumn(name = \"BAR\", referencedColumnName = \"REF_NAME\", unique = false, nullable = false, insertable = false, updatable = false, columnDefinition = \"COLUMN_DEF\", table = \"TABLE\"), @JoinColumn}))", cu);
-
- table.moveJoinColumn(2, 0);
- assertEquals("BAR", table.joinColumnAt(0).getName());
- assertNull(table.joinColumnAt(1).getName());
- assertEquals("FOO", table.joinColumnAt(2).getName());
- assertEquals(3, table.joinColumnsSize());
- assertSourceContains("@AssociationOverride(name = \"" + ASSOCIATION_OVERRIDE_NAME + "\", joinTable = @JoinTable(joinColumns = {@JoinColumn(name = \"BAR\", referencedColumnName = \"REF_NAME\", unique = false, nullable = false, insertable = false, updatable = false, columnDefinition = \"COLUMN_DEF\", table = \"TABLE\"), @JoinColumn, @JoinColumn(name = \"FOO\")}))", cu);
- }
-
- public void testJoinTableMoveJoinColumn2() throws Exception {
- ICompilationUnit cu = this.createTestAssociationOverrideJoinTableWithJoinColumns();
- JavaResourcePersistentType typeResource = buildJavaTypeResource(cu);
-
- AssociationOverride2_0Annotation associationOverride = (AssociationOverride2_0Annotation) typeResource.getSupportingAnnotation(JPA.ASSOCIATION_OVERRIDE);
- JoinTableAnnotation table = associationOverride.getJoinTable();
-
- JoinColumnAnnotation joinColumn = table.joinColumnAt(0);
- joinColumn.setReferencedColumnName("REF_NAME");
- joinColumn.setUnique(Boolean.FALSE);
- joinColumn.setNullable(Boolean.FALSE);
- joinColumn.setInsertable(Boolean.FALSE);
- joinColumn.setUpdatable(Boolean.FALSE);
- joinColumn.setColumnDefinition("COLUMN_DEF");
- joinColumn.setTable("TABLE");
-
- table.addJoinColumn(0).setName("FOO");
-
- assertSourceContains("@AssociationOverride(name = \"" + ASSOCIATION_OVERRIDE_NAME + "\", joinTable = @JoinTable(joinColumns = {@JoinColumn(name = \"FOO\"), @JoinColumn(name = \"BAR\", referencedColumnName = \"REF_NAME\", unique = false, nullable = false, insertable = false, updatable = false, columnDefinition = \"COLUMN_DEF\", table = \"TABLE\"), @JoinColumn}))", cu);
-
-
- table.moveJoinColumn(0, 2);
- assertNull(table.joinColumnAt(0).getName());
- assertEquals("FOO", table.joinColumnAt(1).getName());
- assertEquals("BAR", table.joinColumnAt(2).getName());
- assertEquals(3, table.joinColumnsSize());
- assertSourceContains("@AssociationOverride(name = \"" + ASSOCIATION_OVERRIDE_NAME + "\", joinTable = @JoinTable(joinColumns = {@JoinColumn, @JoinColumn(name = \"FOO\"), @JoinColumn(name = \"BAR\", referencedColumnName = \"REF_NAME\", unique = false, nullable = false, insertable = false, updatable = false, columnDefinition = \"COLUMN_DEF\", table = \"TABLE\")}))", cu);
- }
-
- public void testJoinTableSetJoinColumnName() throws Exception {
- ICompilationUnit cu = this.createTestAssociationOverrideJoinTableWithJoinColumns();
- JavaResourcePersistentType typeResource = buildJavaTypeResource(cu);
-
- AssociationOverride2_0Annotation associationOverride = (AssociationOverride2_0Annotation) typeResource.getSupportingAnnotation(JPA.ASSOCIATION_OVERRIDE);
- JoinTableAnnotation table = associationOverride.getJoinTable();
-
- assertEquals(2, table.joinColumnsSize());
-
- JoinColumnAnnotation joinColumn = table.joinColumns().next();
-
- assertEquals("BAR", joinColumn.getName());
-
- joinColumn.setName("foo");
- assertEquals("foo", joinColumn.getName());
-
- assertSourceContains("@AssociationOverride(name = \"" + ASSOCIATION_OVERRIDE_NAME + "\", joinTable = @JoinTable(joinColumns = {@JoinColumn(name = \"foo\"), @JoinColumn}))", cu);
- }
-
- public void testJoinTableInverseJoinColumns() throws Exception {
- ICompilationUnit cu = this.createTestAssociationOverrideWithJoinTable();
- JavaResourcePersistentType typeResource = buildJavaTypeResource(cu);
-
- AssociationOverride2_0Annotation associationOverride = (AssociationOverride2_0Annotation) typeResource.getSupportingAnnotation(JPA.ASSOCIATION_OVERRIDE);
- JoinTableAnnotation table = associationOverride.getJoinTable();
-
- assertEquals(0, table.inverseJoinColumnsSize());
- }
-
- public void testInverseJoinColumns2() throws Exception {
- ICompilationUnit cu = this.createTestAssociationOverrideWithJoinTable();
- JavaResourcePersistentType typeResource = buildJavaTypeResource(cu);
-
- AssociationOverride2_0Annotation associationOverride = (AssociationOverride2_0Annotation) typeResource.getSupportingAnnotation(JPA.ASSOCIATION_OVERRIDE);
- JoinTableAnnotation table = associationOverride.getJoinTable();
-
-
- table.addInverseJoinColumn(0);
- table.addInverseJoinColumn(1);
-
- assertEquals(2, table.inverseJoinColumnsSize());
- }
-
- public void testJoinTableInverseJoinColumns3() throws Exception {
- ICompilationUnit cu = this.createTestAssociationOverrideJoinTableWithInverseJoinColumns();
- JavaResourcePersistentType typeResource = buildJavaTypeResource(cu);
-
- AssociationOverride2_0Annotation associationOverride = (AssociationOverride2_0Annotation) typeResource.getSupportingAnnotation(JPA.ASSOCIATION_OVERRIDE);
- JoinTableAnnotation table = associationOverride.getJoinTable();
-
- assertEquals(2, table.inverseJoinColumnsSize());
- }
-
- public void testAddInverseJoinColumn() throws Exception {
- ICompilationUnit cu = this.createTestAssociationOverrideWithJoinTable();
- JavaResourcePersistentType typeResource = buildJavaTypeResource(cu);
-
- AssociationOverride2_0Annotation associationOverride = (AssociationOverride2_0Annotation) typeResource.getSupportingAnnotation(JPA.ASSOCIATION_OVERRIDE);
- JoinTableAnnotation table = associationOverride.getJoinTable();
-
- table.addInverseJoinColumn(0).setName("FOO");
- table.addInverseJoinColumn(1);
- table.addInverseJoinColumn(0).setName("BAR");
-
- assertEquals("BAR", table.inverseJoinColumnAt(0).getName());
- assertEquals("FOO", table.inverseJoinColumnAt(1).getName());
- assertNull(table.inverseJoinColumnAt(2).getName());
- assertSourceContains("@AssociationOverride(name = \"" + ASSOCIATION_OVERRIDE_NAME + "\", joinTable = @JoinTable(name = \"MY_JOIN_TABLE\", inverseJoinColumns = {@JoinColumn(name = \"BAR\"),@JoinColumn(name = \"FOO\"), @JoinColumn}))", cu);
- }
-
- public void testJoinTableRemoveInverseJoinColumn() throws Exception {
- ICompilationUnit cu = this.createTestAssociationOverrideJoinTableWithInverseJoinColumns();
- JavaResourcePersistentType typeResource = buildJavaTypeResource(cu);
-
- AssociationOverride2_0Annotation associationOverride = (AssociationOverride2_0Annotation) typeResource.getSupportingAnnotation(JPA.ASSOCIATION_OVERRIDE);
- JoinTableAnnotation table = associationOverride.getJoinTable();
- table.addInverseJoinColumn(2).setName("FOO");
-
- Iterator<JoinColumnAnnotation> inverseJoinColumns = table.inverseJoinColumns();
- assertEquals("BAR", inverseJoinColumns.next().getName());
- assertNull(inverseJoinColumns.next().getName());
- assertEquals("FOO", inverseJoinColumns.next().getName());
- assertFalse(inverseJoinColumns.hasNext());
-
- table.removeInverseJoinColumn(1);
- assertSourceContains("@AssociationOverride(name = \"" + ASSOCIATION_OVERRIDE_NAME + "\", joinTable = @JoinTable(inverseJoinColumns = {@JoinColumn(name = \"BAR\"), @JoinColumn(name = \"FOO\")}))", cu);
- inverseJoinColumns = table.inverseJoinColumns();
- assertEquals("BAR", inverseJoinColumns.next().getName());
- assertEquals("FOO", inverseJoinColumns.next().getName());
- assertFalse(inverseJoinColumns.hasNext());
-
- table.removeInverseJoinColumn(0);
- assertSourceContains("@AssociationOverride(name = \"" + ASSOCIATION_OVERRIDE_NAME + "\", joinTable = @JoinTable(inverseJoinColumns = @JoinColumn(name = \"FOO\")))", cu);
- inverseJoinColumns = table.inverseJoinColumns();
- assertEquals("FOO", inverseJoinColumns.next().getName());
- assertFalse(inverseJoinColumns.hasNext());
-
- table.removeInverseJoinColumn(0);
- assertSourceDoesNotContain("@JoinTable", cu);
- }
-
- public void testJoinTableMoveInverseJoinColumn() throws Exception {
- ICompilationUnit cu = this.createTestAssociationOverrideJoinTableWithInverseJoinColumns();
- JavaResourcePersistentType typeResource = buildJavaTypeResource(cu);
-
- AssociationOverride2_0Annotation associationOverride = (AssociationOverride2_0Annotation) typeResource.getSupportingAnnotation(JPA.ASSOCIATION_OVERRIDE);
- JoinTableAnnotation table = associationOverride.getJoinTable();
- table.addInverseJoinColumn(0).setName("FOO");
-
- Iterator<JoinColumnAnnotation> inverseJoinColumns = table.inverseJoinColumns();
- assertEquals("FOO", inverseJoinColumns.next().getName());
- assertEquals("BAR", inverseJoinColumns.next().getName());
- assertNull(inverseJoinColumns.next().getName());
-
- table.moveInverseJoinColumn(2, 0);
- inverseJoinColumns = table.inverseJoinColumns();
- assertEquals("BAR", inverseJoinColumns.next().getName());
- assertNull(inverseJoinColumns.next().getName());
- assertEquals("FOO", inverseJoinColumns.next().getName());
-
- assertSourceContains("@AssociationOverride(name = \"" + ASSOCIATION_OVERRIDE_NAME + "\", joinTable = @JoinTable(inverseJoinColumns = {@JoinColumn(name = \"BAR\"), @JoinColumn, @JoinColumn(name = \"FOO\")}))", cu);
- }
-
- public void testJoinTableMoveInverseJoinColumn2() throws Exception {
- ICompilationUnit cu = this.createTestAssociationOverrideJoinTableWithInverseJoinColumns();
- JavaResourcePersistentType typeResource = buildJavaTypeResource(cu);
-
- AssociationOverride2_0Annotation associationOverride = (AssociationOverride2_0Annotation) typeResource.getSupportingAnnotation(JPA.ASSOCIATION_OVERRIDE);
- JoinTableAnnotation table = associationOverride.getJoinTable();
- table.addInverseJoinColumn(1).setName("FOO");
-
- Iterator<JoinColumnAnnotation> inverseJoinColumns = table.inverseJoinColumns();
- assertEquals("BAR", inverseJoinColumns.next().getName());
- assertEquals("FOO", inverseJoinColumns.next().getName());
- assertNull(inverseJoinColumns.next().getName());
-
- table.moveInverseJoinColumn(0, 2);
- inverseJoinColumns = table.inverseJoinColumns();
- assertNull(inverseJoinColumns.next().getName());
- assertEquals("BAR", inverseJoinColumns.next().getName());
- assertEquals("FOO", inverseJoinColumns.next().getName());
-
- assertSourceContains("@AssociationOverride(name = \"" + ASSOCIATION_OVERRIDE_NAME + "\", joinTable = @JoinTable(inverseJoinColumns = {@JoinColumn, @JoinColumn(name = \"BAR\"), @JoinColumn(name = \"FOO\")}))", cu);
- }
-
- public void testJoinTableSetInverseJoinColumnName() throws Exception {
- ICompilationUnit cu = this.createTestAssociationOverrideJoinTableWithInverseJoinColumns();
- JavaResourcePersistentType typeResource = buildJavaTypeResource(cu);
-
- AssociationOverride2_0Annotation associationOverride = (AssociationOverride2_0Annotation) typeResource.getSupportingAnnotation(JPA.ASSOCIATION_OVERRIDE);
- JoinTableAnnotation table = associationOverride.getJoinTable();
-
- assertEquals(2, table.inverseJoinColumnsSize());
-
- JoinColumnAnnotation joinColumn = table.inverseJoinColumns().next();
-
- assertEquals("BAR", joinColumn.getName());
-
- joinColumn.setName("foo");
- assertEquals("foo", joinColumn.getName());
-
- assertSourceContains("@AssociationOverride(name = \"" + ASSOCIATION_OVERRIDE_NAME + "\", joinTable = @JoinTable(inverseJoinColumns = {@JoinColumn(name = \"foo\"), @JoinColumn}))", cu);
- }
-
-}
diff --git a/jpa/tests/org.eclipse.jpt.core.tests/src/org/eclipse/jpt2_0/core/tests/internal/resource/java/AssociationOverrides2_0Tests.java b/jpa/tests/org.eclipse.jpt.core.tests/src/org/eclipse/jpt2_0/core/tests/internal/resource/java/AssociationOverrides2_0Tests.java
deleted file mode 100644
index 0b4e8fec03..0000000000
--- a/jpa/tests/org.eclipse.jpt.core.tests/src/org/eclipse/jpt2_0/core/tests/internal/resource/java/AssociationOverrides2_0Tests.java
+++ /dev/null
@@ -1,988 +0,0 @@
-/*******************************************************************************
- * Copyright (c) 2009 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.
- *
- * Contributors:
- * Oracle - initial API and implementation
- ******************************************************************************/
-package org.eclipse.jpt2_0.core.tests.internal.resource.java;
-
-import java.util.Iterator;
-
-import org.eclipse.jdt.core.ICompilationUnit;
-import org.eclipse.jpt.core.resource.java.AssociationOverrideAnnotation;
-import org.eclipse.jpt.core.resource.java.AssociationOverridesAnnotation;
-import org.eclipse.jpt.core.resource.java.JPA;
-import org.eclipse.jpt.core.resource.java.JavaResourcePersistentAttribute;
-import org.eclipse.jpt.core.resource.java.JavaResourcePersistentType;
-import org.eclipse.jpt.core.resource.java.JoinColumnAnnotation;
-import org.eclipse.jpt.core.resource.java.JoinTableAnnotation;
-import org.eclipse.jpt.core.resource.java.NestableAnnotation;
-import org.eclipse.jpt.utility.internal.CollectionTools;
-import org.eclipse.jpt.utility.internal.iterators.ArrayIterator;
-import org.eclipse.jpt2_0.core.resource.java.AssociationOverride2_0Annotation;
-
-@SuppressWarnings("nls")
-public class AssociationOverrides2_0Tests extends Generic2_0JavaResourceModelTestCase {
-
- private static final String ASSOCIATION_OVERRIDE_NAME = "MY_ASSOCIATION_OVERRIDE";
- private static final String JOIN_TABLE_NAME = "MY_JOIN_TABLE";
- private static final String CATALOG_NAME = "MY_CATALOG";
- private static final String SCHEMA_NAME = "MY_SCHEMA";
-
- public AssociationOverrides2_0Tests(String name) {
- super(name);
- }
-
- private ICompilationUnit createTestAssociationOverrideOnField() throws Exception {
- return this.createTestType(new DefaultAnnotationWriter() {
- @Override
- public Iterator<String> imports() {
- return new ArrayIterator<String>(JPA.ASSOCIATION_OVERRIDE, JPA.ASSOCIATION_OVERRIDES);
- }
- @Override
- public void appendIdFieldAnnotationTo(StringBuilder sb) {
- sb.append("@AssociationOverrides(@AssociationOverride(name = \"" + ASSOCIATION_OVERRIDE_NAME + "\"))");
- }
- });
- }
-
- private ICompilationUnit createTestAssociationOverrideWithJoinColumns() throws Exception {
- return this.createTestType(new DefaultAnnotationWriter() {
- @Override
- public Iterator<String> imports() {
- return new ArrayIterator<String>(JPA.ASSOCIATION_OVERRIDE, JPA.ASSOCIATION_OVERRIDES, JPA.JOIN_COLUMN);
- }
- @Override
- public void appendIdFieldAnnotationTo(StringBuilder sb) {
- sb.append("@AssociationOverrides(@AssociationOverride(name = \"" + ASSOCIATION_OVERRIDE_NAME + "\", joinColumns = {@JoinColumn(name = \"BAR\"), @JoinColumn}))");
- }
- });
- }
-
- private ICompilationUnit createTestAssociationOverride() throws Exception {
- return this.createTestType(new DefaultAnnotationWriter() {
- @Override
- public Iterator<String> imports() {
- return new ArrayIterator<String>(JPA.ENTITY, JPA.ASSOCIATION_OVERRIDE, JPA.JOIN_COLUMN);
- }
- @Override
- public void appendTypeAnnotationTo(StringBuilder sb) {
- sb.append("@Entity");
- sb.append(CR);
- sb.append("@AssociationOverride(name = \"FOO\", joinColumns = @JoinColumn(name = \"FOO\", columnDefinition = \"BAR\", referencedColumnName = \"BAZ\"))");
- }
- });
- }
-
- private ICompilationUnit createTestAssociationOverrideOnType() throws Exception {
- return this.createTestType(new DefaultAnnotationWriter() {
- @Override
- public Iterator<String> imports() {
- return new ArrayIterator<String>(JPA.ASSOCIATION_OVERRIDES, JPA.ASSOCIATION_OVERRIDE);
- }
- @Override
- public void appendTypeAnnotationTo(StringBuilder sb) {
- sb.append("@AssociationOverrides(@AssociationOverride(name = \"" + ASSOCIATION_OVERRIDE_NAME + "\"))");
- }
- });
- }
-
- private ICompilationUnit createTestAssociationOverrideWithJoinTable() throws Exception {
- return this.createTestType(new DefaultAnnotationWriter() {
- @Override
- public Iterator<String> imports() {
- return new ArrayIterator<String>(JPA.ASSOCIATION_OVERRIDES, JPA.ASSOCIATION_OVERRIDE, JPA.JOIN_TABLE);
- }
- @Override
- public void appendTypeAnnotationTo(StringBuilder sb) {
- sb.append("@AssociationOverrides(@AssociationOverride(name = \"" + ASSOCIATION_OVERRIDE_NAME + "\", joinTable = @JoinTable(name = \"" + JOIN_TABLE_NAME + "\")))");
- }
- });
- }
-
- private ICompilationUnit createTestAssociationOverrideJoinTableWithCatalog() throws Exception {
- return this.createTestType(new DefaultAnnotationWriter() {
- @Override
- public Iterator<String> imports() {
- return new ArrayIterator<String>(JPA.ASSOCIATION_OVERRIDES, JPA.ASSOCIATION_OVERRIDE, JPA.JOIN_TABLE);
- }
- @Override
- public void appendTypeAnnotationTo(StringBuilder sb) {
- sb.append("@AssociationOverrides(@AssociationOverride(name = \"" + ASSOCIATION_OVERRIDE_NAME + "\", joinTable = @JoinTable(catalog = \"" + CATALOG_NAME + "\")))");
- }
- });
- }
-
- private ICompilationUnit createTestAssociationOverrideJoinTableWithSchema() throws Exception {
- return this.createTestType(new DefaultAnnotationWriter() {
- @Override
- public Iterator<String> imports() {
- return new ArrayIterator<String>(JPA.ASSOCIATION_OVERRIDES, JPA.ASSOCIATION_OVERRIDE, JPA.JOIN_TABLE);
- }
- @Override
- public void appendTypeAnnotationTo(StringBuilder sb) {
- sb.append("@AssociationOverrides(@AssociationOverride(name = \"" + ASSOCIATION_OVERRIDE_NAME + "\", joinTable = @JoinTable(schema = \"" + SCHEMA_NAME + "\")))");
- }
- });
- }
-
- private ICompilationUnit createTestAssociationOverrideJoinTableWithUniqueConstraints() throws Exception {
- return this.createTestType(new DefaultAnnotationWriter() {
- @Override
- public Iterator<String> imports() {
- return new ArrayIterator<String>(JPA.ASSOCIATION_OVERRIDES, JPA.ASSOCIATION_OVERRIDE, JPA.JOIN_TABLE, JPA.UNIQUE_CONSTRAINT);
- }
- @Override
- public void appendTypeAnnotationTo(StringBuilder sb) {
- sb.append("@AssociationOverrides(@AssociationOverride(name = \"" + ASSOCIATION_OVERRIDE_NAME + "\", joinTable = @JoinTable(uniqueConstraints = {@UniqueConstraint(columnNames = {\"BAR\"}), @UniqueConstraint(columnNames = {\"FOO\"}), @UniqueConstraint(columnNames = {\"BAZ\"})})))");
- }
- });
- }
-
- private ICompilationUnit createTestAssociationOverrideJoinTableWithJoinColumns() throws Exception {
- return this.createTestType(new DefaultAnnotationWriter() {
- @Override
- public Iterator<String> imports() {
- return new ArrayIterator<String>(JPA.ASSOCIATION_OVERRIDES, JPA.ASSOCIATION_OVERRIDE, JPA.JOIN_TABLE, JPA.JOIN_COLUMN);
- }
- @Override
- public void appendTypeAnnotationTo(StringBuilder sb) {
- sb.append("@AssociationOverrides(@AssociationOverride(name = \"" + ASSOCIATION_OVERRIDE_NAME + "\", joinTable = @JoinTable(joinColumns = {@JoinColumn(name = \"BAR\"), @JoinColumn})))");
- }
- });
- }
-
- private ICompilationUnit createTestAssociationOverrideJoinTableWithInverseJoinColumns() throws Exception {
- return this.createTestType(new DefaultAnnotationWriter() {
- @Override
- public Iterator<String> imports() {
- return new ArrayIterator<String>(JPA.ASSOCIATION_OVERRIDES, JPA.ASSOCIATION_OVERRIDE, JPA.JOIN_TABLE, JPA.JOIN_COLUMN);
- }
- @Override
- public void appendTypeAnnotationTo(StringBuilder sb) {
- sb.append("@AssociationOverrides(@AssociationOverride(name = \"" + ASSOCIATION_OVERRIDE_NAME + "\", joinTable = @JoinTable(inverseJoinColumns = {@JoinColumn(name = \"BAR\"), @JoinColumn})))");
- }
- });
- }
-
-
- public void testGetName() throws Exception {
- ICompilationUnit cu = this.createTestAssociationOverrideOnField();
- JavaResourcePersistentType typeResource = buildJavaTypeResource(cu);
- JavaResourcePersistentAttribute attributeResource = typeResource.fields().next();
- AssociationOverridesAnnotation associationOverrides = (AssociationOverridesAnnotation) attributeResource.getSupportingAnnotation(JPA.ASSOCIATION_OVERRIDES);
- AssociationOverrideAnnotation associationOverride = associationOverrides.nestedAnnotations().next();
-
- assertNotNull(associationOverride);
- assertEquals(ASSOCIATION_OVERRIDE_NAME, associationOverride.getName());
- }
-
- public void testSetName() throws Exception {
- ICompilationUnit cu = this.createTestAssociationOverrideOnField();
- JavaResourcePersistentType typeResource = buildJavaTypeResource(cu);
- JavaResourcePersistentAttribute attributeResource = typeResource.fields().next();
- AssociationOverridesAnnotation associationOverrides = (AssociationOverridesAnnotation) attributeResource.getSupportingAnnotation(JPA.ASSOCIATION_OVERRIDES);
- AssociationOverrideAnnotation associationOverride = associationOverrides.nestedAnnotations().next();
-
- assertNotNull(associationOverride);
- assertEquals(ASSOCIATION_OVERRIDE_NAME, associationOverride.getName());
-
- associationOverride.setName("Foo");
- assertEquals("Foo", associationOverride.getName());
- assertSourceContains("@AssociationOverrides(@AssociationOverride(name = \"Foo\"))", cu);
- }
-
- public void testSetNameNull() throws Exception {
- ICompilationUnit cu = this.createTestAssociationOverrideOnField();
- JavaResourcePersistentType typeResource = buildJavaTypeResource(cu);
- JavaResourcePersistentAttribute attributeResource = typeResource.fields().next();
- AssociationOverridesAnnotation associationOverrides = (AssociationOverridesAnnotation) attributeResource.getSupportingAnnotation(JPA.ASSOCIATION_OVERRIDES);
- AssociationOverrideAnnotation associationOverride = associationOverrides.nestedAnnotations().next();
- assertEquals(ASSOCIATION_OVERRIDE_NAME, associationOverride.getName());
-
- associationOverride.setName(null);
- assertNull(associationOverride.getName());
-
- assertSourceDoesNotContain("@AssociationOverride(name = \"" + ASSOCIATION_OVERRIDE_NAME + "\")", cu);
- assertSourceContains("@AssociationOverride", cu);
- assertSourceContains("@AssociationOverrides", cu);
- }
-
- public void testAddAssociationOverrideCopyExisting() throws Exception {
- ICompilationUnit cu = createTestAssociationOverride();
- JavaResourcePersistentType typeResource = buildJavaTypeResource(cu);
-
- AssociationOverrideAnnotation associationOverride = (AssociationOverrideAnnotation) typeResource.addSupportingAnnotation(1, JPA.ASSOCIATION_OVERRIDE, JPA.ASSOCIATION_OVERRIDES);
- associationOverride.setName("BAR");
- assertSourceContains("@AssociationOverrides({@AssociationOverride(name = \"FOO\", joinColumns = @JoinColumn(name = \"FOO\", columnDefinition = \"BAR\", referencedColumnName = \"BAZ\")),@AssociationOverride(name = \"BAR\")})", cu);
-
- assertNull(typeResource.getSupportingAnnotation(JPA.ASSOCIATION_OVERRIDE));
- assertNotNull(typeResource.getSupportingAnnotation(JPA.ASSOCIATION_OVERRIDES));
- assertEquals(2, CollectionTools.size(typeResource.supportingAnnotations(JPA.ASSOCIATION_OVERRIDE, JPA.ASSOCIATION_OVERRIDES)));
- }
-
- public void testAddAssociationOverrideToBeginningOfList() throws Exception {
- ICompilationUnit cu = createTestAssociationOverride();
- JavaResourcePersistentType typeResource = buildJavaTypeResource(cu);
-
- AssociationOverrideAnnotation associationOverride = (AssociationOverrideAnnotation) typeResource.addSupportingAnnotation(1, JPA.ASSOCIATION_OVERRIDE, JPA.ASSOCIATION_OVERRIDES);
- associationOverride.setName("BAR");
- assertSourceContains("@AssociationOverrides({@AssociationOverride(name = \"FOO\", joinColumns = @JoinColumn(name = \"FOO\", columnDefinition = \"BAR\", referencedColumnName = \"BAZ\")),@AssociationOverride(name = \"BAR\")})", cu);
-
- associationOverride = (AssociationOverrideAnnotation) typeResource.addSupportingAnnotation(0, JPA.ASSOCIATION_OVERRIDE, JPA.ASSOCIATION_OVERRIDES);
- associationOverride.setName("BAZ");
- assertSourceContains("@AssociationOverrides({@AssociationOverride(name = \"BAZ\"),@AssociationOverride(name = \"FOO\", joinColumns = @JoinColumn(name = \"FOO\", columnDefinition = \"BAR\", referencedColumnName = \"BAZ\")), @AssociationOverride(name = \"BAR\")})", cu);
-
- Iterator<NestableAnnotation> associationOverrides = typeResource.supportingAnnotations(JPA.ASSOCIATION_OVERRIDE, JPA.ASSOCIATION_OVERRIDES);
- assertEquals("BAZ", ((AssociationOverrideAnnotation) associationOverrides.next()).getName());
- assertEquals("FOO", ((AssociationOverrideAnnotation) associationOverrides.next()).getName());
- assertEquals("BAR", ((AssociationOverrideAnnotation) associationOverrides.next()).getName());
-
- assertNull(typeResource.getSupportingAnnotation(JPA.ASSOCIATION_OVERRIDE));
- assertNotNull(typeResource.getSupportingAnnotation(JPA.ASSOCIATION_OVERRIDES));
- assertEquals(3, CollectionTools.size(typeResource.supportingAnnotations(JPA.ASSOCIATION_OVERRIDE, JPA.ASSOCIATION_OVERRIDES)));
- }
-
- public void testRemoveAssociationOverrideCopyExisting() throws Exception {
- ICompilationUnit cu = createTestAssociationOverride();
- JavaResourcePersistentType typeResource = buildJavaTypeResource(cu);
-
- AssociationOverrideAnnotation associationOverride = (AssociationOverrideAnnotation) typeResource.addSupportingAnnotation(1, JPA.ASSOCIATION_OVERRIDE, JPA.ASSOCIATION_OVERRIDES);
- associationOverride.setName("BAR");
- assertSourceContains("@AssociationOverrides({@AssociationOverride(name = \"FOO\", joinColumns = @JoinColumn(name = \"FOO\", columnDefinition = \"BAR\", referencedColumnName = \"BAZ\")),@AssociationOverride(name = \"BAR\")})", cu);
-
- typeResource.removeSupportingAnnotation(1, JPA.ASSOCIATION_OVERRIDE, JPA.ASSOCIATION_OVERRIDES);
- assertSourceContains("@AssociationOverride(name = \"FOO\", joinColumns = @JoinColumn(name = \"FOO\", columnDefinition = \"BAR\", referencedColumnName = \"BAZ\"))", cu);
- }
-
- public void testJoinColumns() throws Exception {
- ICompilationUnit cu = this.createTestAssociationOverrideOnField();
- JavaResourcePersistentType typeResource = buildJavaTypeResource(cu);
- JavaResourcePersistentAttribute attributeResource = typeResource.fields().next();
-
- AssociationOverrideAnnotation associationOverride = (AssociationOverrideAnnotation) attributeResource.supportingAnnotations(JPA.ASSOCIATION_OVERRIDE, JPA.ASSOCIATION_OVERRIDES).next();
-
- assertEquals(0, associationOverride.joinColumnsSize());
- }
-
- public void testJoinColumns2() throws Exception {
- ICompilationUnit cu = this.createTestAssociationOverrideOnField();
- JavaResourcePersistentType typeResource = buildJavaTypeResource(cu);
- JavaResourcePersistentAttribute attributeResource = typeResource.fields().next();
-
- AssociationOverrideAnnotation associationOverride = (AssociationOverrideAnnotation) attributeResource.supportingAnnotations(JPA.ASSOCIATION_OVERRIDE, JPA.ASSOCIATION_OVERRIDES).next();
-
- associationOverride.addJoinColumn(0);
- associationOverride.addJoinColumn(1);
-
- assertEquals(2, associationOverride.joinColumnsSize());
- }
-
- public void testJoinColumns3() throws Exception {
- ICompilationUnit cu = this.createTestAssociationOverrideWithJoinColumns();
- JavaResourcePersistentType typeResource = buildJavaTypeResource(cu);
- JavaResourcePersistentAttribute attributeResource = typeResource.fields().next();
-
- AssociationOverrideAnnotation associationOverride = (AssociationOverrideAnnotation) attributeResource.supportingAnnotations(JPA.ASSOCIATION_OVERRIDE, JPA.ASSOCIATION_OVERRIDES).next();
-
- assertEquals(2, associationOverride.joinColumnsSize());
- }
-
- public void testAddJoinColumn() throws Exception {
- ICompilationUnit cu = this.createTestAssociationOverrideOnField();
- JavaResourcePersistentType typeResource = buildJavaTypeResource(cu);
- JavaResourcePersistentAttribute attributeResource = typeResource.fields().next();
-
- AssociationOverrideAnnotation associationOverride = (AssociationOverrideAnnotation) attributeResource.supportingAnnotations(JPA.ASSOCIATION_OVERRIDE, JPA.ASSOCIATION_OVERRIDES).next();
-
- associationOverride.addJoinColumn(0).setName("FOO");
- associationOverride.addJoinColumn(1);
- associationOverride.addJoinColumn(0).setName("BAR");
-
-
- Iterator<JoinColumnAnnotation> joinColumns = associationOverride.joinColumns();
- assertEquals("BAR", joinColumns.next().getName());
- assertEquals("FOO", joinColumns.next().getName());
- assertNull(joinColumns.next().getName());
-
- assertSourceContains("@AssociationOverrides(@AssociationOverride(name = \"" + ASSOCIATION_OVERRIDE_NAME + "\", joinColumns = {@JoinColumn(name = \"BAR\"),@JoinColumn(name = \"FOO\"), @JoinColumn}))", cu);
- }
-
- public void testRemoveJoinColumn() throws Exception {
- ICompilationUnit cu = this.createTestAssociationOverrideWithJoinColumns();
- JavaResourcePersistentType typeResource = buildJavaTypeResource(cu);
- JavaResourcePersistentAttribute attributeResource = typeResource.fields().next();
-
- AssociationOverrideAnnotation associationOverride = (AssociationOverrideAnnotation) attributeResource.supportingAnnotations(JPA.ASSOCIATION_OVERRIDE, JPA.ASSOCIATION_OVERRIDES).next();
- associationOverride.addJoinColumn(0).setName("FOO");
-
- Iterator<JoinColumnAnnotation> joinColumns = associationOverride.joinColumns();
- assertEquals("FOO", joinColumns.next().getName());
- assertEquals("BAR", joinColumns.next().getName());
- assertNull(joinColumns.next().getName());
- assertEquals(false, joinColumns.hasNext());
- assertSourceContains("@AssociationOverrides(@AssociationOverride(name = \"" + ASSOCIATION_OVERRIDE_NAME + "\", joinColumns = {@JoinColumn(name = \"FOO\"), @JoinColumn(name = \"BAR\"), @JoinColumn}))", cu);
-
- associationOverride.removeJoinColumn(1);
- joinColumns = associationOverride.joinColumns();
- assertEquals("FOO", joinColumns.next().getName());
- assertNull(joinColumns.next().getName());
- assertEquals(false, joinColumns.hasNext());
- assertSourceContains("@AssociationOverrides(@AssociationOverride(name = \"" + ASSOCIATION_OVERRIDE_NAME + "\", joinColumns = {@JoinColumn(name = \"FOO\"), @JoinColumn}))", cu);
-
- associationOverride.removeJoinColumn(0);
- joinColumns = associationOverride.joinColumns();
- assertNull(joinColumns.next().getName());
- assertEquals(false, joinColumns.hasNext());
- assertSourceContains("@AssociationOverrides(@AssociationOverride(name = \"" + ASSOCIATION_OVERRIDE_NAME + "\", joinColumns = @JoinColumn))", cu);
-
-
- associationOverride.setName(null);
- associationOverride.removeJoinColumn(0);
- assertSourceDoesNotContain("@AssociationOverride", cu);
- }
-
- public void testMoveJoinColumn() throws Exception {
- ICompilationUnit cu = this.createTestAssociationOverrideWithJoinColumns();
- JavaResourcePersistentType typeResource = buildJavaTypeResource(cu);
- JavaResourcePersistentAttribute attributeResource = typeResource.fields().next();
-
- AssociationOverrideAnnotation associationOverride = (AssociationOverrideAnnotation) attributeResource.supportingAnnotations(JPA.ASSOCIATION_OVERRIDE, JPA.ASSOCIATION_OVERRIDES).next();
- JoinColumnAnnotation joinColumn = associationOverride.joinColumnAt(0);
- joinColumn.setReferencedColumnName("REF_NAME");
- joinColumn.setUnique(Boolean.FALSE);
- joinColumn.setNullable(Boolean.FALSE);
- joinColumn.setInsertable(Boolean.FALSE);
- joinColumn.setUpdatable(Boolean.FALSE);
- joinColumn.setColumnDefinition("COLUMN_DEF");
- joinColumn.setTable("TABLE");
- associationOverride.addJoinColumn(0).setName("FOO");
- assertSourceContains("@AssociationOverrides(@AssociationOverride(name = \"" + ASSOCIATION_OVERRIDE_NAME + "\", joinColumns = {@JoinColumn(name = \"FOO\"), @JoinColumn(name = \"BAR\", referencedColumnName = \"REF_NAME\", unique = false, nullable = false, insertable = false, updatable = false, columnDefinition = \"COLUMN_DEF\", table = \"TABLE\"), @JoinColumn}))", cu);
-
- associationOverride.moveJoinColumn(2, 0);
- assertEquals("BAR", associationOverride.joinColumnAt(0).getName());
- assertNull(associationOverride.joinColumnAt(1).getName());
- assertEquals("FOO", associationOverride.joinColumnAt(2).getName());
- assertEquals(3, associationOverride.joinColumnsSize());
- assertSourceContains("@AssociationOverrides(@AssociationOverride(name = \"" + ASSOCIATION_OVERRIDE_NAME + "\", joinColumns = {@JoinColumn(name = \"BAR\", referencedColumnName = \"REF_NAME\", unique = false, nullable = false, insertable = false, updatable = false, columnDefinition = \"COLUMN_DEF\", table = \"TABLE\"), @JoinColumn, @JoinColumn(name = \"FOO\")}))", cu);
- }
-
- public void testMoveJoinColumn2() throws Exception {
- ICompilationUnit cu = this.createTestAssociationOverrideWithJoinColumns();
- JavaResourcePersistentType typeResource = buildJavaTypeResource(cu);
- JavaResourcePersistentAttribute attributeResource = typeResource.fields().next();
-
- AssociationOverrideAnnotation associationOverride = (AssociationOverrideAnnotation) attributeResource.supportingAnnotations(JPA.ASSOCIATION_OVERRIDE, JPA.ASSOCIATION_OVERRIDES).next();
-
- JoinColumnAnnotation joinColumn = associationOverride.joinColumnAt(0);
- joinColumn.setReferencedColumnName("REF_NAME");
- joinColumn.setUnique(Boolean.FALSE);
- joinColumn.setNullable(Boolean.FALSE);
- joinColumn.setInsertable(Boolean.FALSE);
- joinColumn.setUpdatable(Boolean.FALSE);
- joinColumn.setColumnDefinition("COLUMN_DEF");
- joinColumn.setTable("TABLE");
- associationOverride.addJoinColumn(0).setName("FOO");
-
- assertSourceContains("@AssociationOverrides(@AssociationOverride(name = \"" + ASSOCIATION_OVERRIDE_NAME + "\", joinColumns = {@JoinColumn(name = \"FOO\"), @JoinColumn(name = \"BAR\", referencedColumnName = \"REF_NAME\", unique = false, nullable = false, insertable = false, updatable = false, columnDefinition = \"COLUMN_DEF\", table = \"TABLE\"), @JoinColumn}))", cu);
- associationOverride.moveJoinColumn(0, 2);
- assertNull(associationOverride.joinColumnAt(0).getName());
- assertEquals("FOO", associationOverride.joinColumnAt(1).getName());
- assertEquals("BAR", associationOverride.joinColumnAt(2).getName());
- assertEquals(3, associationOverride.joinColumnsSize());
- assertSourceContains("@AssociationOverrides(@AssociationOverride(name = \"" + ASSOCIATION_OVERRIDE_NAME + "\", joinColumns = {@JoinColumn, @JoinColumn(name = \"FOO\"), @JoinColumn(name = \"BAR\", referencedColumnName = \"REF_NAME\", unique = false, nullable = false, insertable = false, updatable = false, columnDefinition = \"COLUMN_DEF\", table = \"TABLE\")}))", cu);
- }
-
- public void testSetJoinColumnName() throws Exception {
- ICompilationUnit cu = this.createTestAssociationOverrideWithJoinColumns();
- JavaResourcePersistentType typeResource = buildJavaTypeResource(cu);
- JavaResourcePersistentAttribute attributeResource = typeResource.fields().next();
-
- AssociationOverrideAnnotation associationOverride = (AssociationOverrideAnnotation) attributeResource.supportingAnnotations(JPA.ASSOCIATION_OVERRIDE, JPA.ASSOCIATION_OVERRIDES).next();
-
- assertEquals(2, associationOverride.joinColumnsSize());
-
- JoinColumnAnnotation joinColumn = associationOverride.joinColumns().next();
-
- assertEquals("BAR", joinColumn.getName());
-
- joinColumn.setName("foo");
- assertEquals("foo", joinColumn.getName());
-
- assertSourceContains("@AssociationOverrides(@AssociationOverride(name = \"" + ASSOCIATION_OVERRIDE_NAME + "\", joinColumns = {@JoinColumn(name = \"foo\"), @JoinColumn}))", cu);
- }
-
- public void testGetNullJoinTable() throws Exception {
- ICompilationUnit cu = this.createTestAssociationOverrideOnType();
- JavaResourcePersistentType typeResource = buildJavaTypeResource(cu);
- AssociationOverridesAnnotation associationOverrides = (AssociationOverridesAnnotation) typeResource.getSupportingAnnotation(JPA.ASSOCIATION_OVERRIDES);
- AssociationOverride2_0Annotation associationOverride = (AssociationOverride2_0Annotation) associationOverrides.nestedAnnotations().next();
- JoinTableAnnotation joinTable = associationOverride.getJoinTable();
- assertNotNull(associationOverride);
- assertNull(joinTable);
- }
-
- public void testJoinTableGetName() throws Exception {
- ICompilationUnit cu = this.createTestAssociationOverrideWithJoinTable();
- JavaResourcePersistentType typeResource = buildJavaTypeResource(cu);
- AssociationOverridesAnnotation associationOverrides = (AssociationOverridesAnnotation) typeResource.getSupportingAnnotation(JPA.ASSOCIATION_OVERRIDES);
- AssociationOverride2_0Annotation associationOverride = (AssociationOverride2_0Annotation) associationOverrides.nestedAnnotations().next();
- JoinTableAnnotation joinTable = associationOverride.getJoinTable();
- assertEquals(JOIN_TABLE_NAME, joinTable.getName());
- }
-
- public void testJoinTableSetName() throws Exception {
- ICompilationUnit cu = this.createTestAssociationOverrideWithJoinTable();
- JavaResourcePersistentType typeResource = buildJavaTypeResource(cu);
- AssociationOverridesAnnotation associationOverrides = (AssociationOverridesAnnotation) typeResource.getSupportingAnnotation(JPA.ASSOCIATION_OVERRIDES);
- AssociationOverride2_0Annotation associationOverride = (AssociationOverride2_0Annotation) associationOverrides.nestedAnnotations().next();
- JoinTableAnnotation joinTable = associationOverride.getJoinTable();
- assertEquals(JOIN_TABLE_NAME, joinTable.getName());
-
- joinTable.setName("Foo");
-
- assertSourceContains("@AssociationOverride(name = \"" + ASSOCIATION_OVERRIDE_NAME + "\", joinTable = @JoinTable(name = \"Foo\"))", cu);
-
- joinTable.setName(null);
- assertNull(associationOverride.getJoinTable());
- assertSourceContains("@AssociationOverride(name = \"" + ASSOCIATION_OVERRIDE_NAME + "\")", cu);
- }
-
- public void testAddJoinTable() throws Exception {
- ICompilationUnit cu = this.createTestAssociationOverrideOnType();
- JavaResourcePersistentType typeResource = buildJavaTypeResource(cu);
- AssociationOverridesAnnotation associationOverrides = (AssociationOverridesAnnotation) typeResource.getSupportingAnnotation(JPA.ASSOCIATION_OVERRIDES);
- AssociationOverride2_0Annotation associationOverride = (AssociationOverride2_0Annotation) associationOverrides.nestedAnnotations().next();
- JoinTableAnnotation joinTable = associationOverride.getJoinTable();
- assertNull(joinTable);
-
- associationOverride.addJoinTable();
- joinTable = associationOverride.getJoinTable();
- assertNotNull(joinTable);
- assertSourceContains("@AssociationOverride(name = \"" + ASSOCIATION_OVERRIDE_NAME + "\", joinTable = @JoinTable)", cu);
- }
-
- public void testRemoveJoinTable() throws Exception {
- ICompilationUnit cu = this.createTestAssociationOverrideOnType();
- JavaResourcePersistentType typeResource = buildJavaTypeResource(cu);
- AssociationOverridesAnnotation associationOverrides = (AssociationOverridesAnnotation) typeResource.getSupportingAnnotation(JPA.ASSOCIATION_OVERRIDES);
- AssociationOverride2_0Annotation associationOverride = (AssociationOverride2_0Annotation) associationOverrides.nestedAnnotations().next();
- JoinTableAnnotation joinTable = associationOverride.getJoinTable();
- assertNull(joinTable);
- }
-
- public void testJoinTableGetCatalog() throws Exception {
- ICompilationUnit cu = this.createTestAssociationOverrideJoinTableWithCatalog();
- JavaResourcePersistentType typeResource = buildJavaTypeResource(cu);
-
- AssociationOverridesAnnotation associationOverrides = (AssociationOverridesAnnotation) typeResource.getSupportingAnnotation(JPA.ASSOCIATION_OVERRIDES);
- AssociationOverride2_0Annotation associationOverride = (AssociationOverride2_0Annotation) associationOverrides.nestedAnnotations().next();
- JoinTableAnnotation table = associationOverride.getJoinTable();
- assertNotNull(table);
- assertEquals(CATALOG_NAME, table.getCatalog());
- }
-
- public void testJoinTableSetCatalog() throws Exception {
- ICompilationUnit cu = this.createTestAssociationOverrideWithJoinTable();
- JavaResourcePersistentType typeResource = buildJavaTypeResource(cu);
-
- AssociationOverridesAnnotation associationOverrides = (AssociationOverridesAnnotation) typeResource.getSupportingAnnotation(JPA.ASSOCIATION_OVERRIDES);
- AssociationOverride2_0Annotation associationOverride = (AssociationOverride2_0Annotation) associationOverrides.nestedAnnotations().next();
- JoinTableAnnotation table = associationOverride.getJoinTable();
- assertNotNull(table);
- assertNull(table.getCatalog());
-
- table.setCatalog("Foo");
- assertEquals("Foo", table.getCatalog());
-
- assertSourceContains("@AssociationOverride(name = \"" + ASSOCIATION_OVERRIDE_NAME + "\", joinTable = @JoinTable(name = \"MY_JOIN_TABLE\", catalog = \"Foo\"))", cu);
- }
-
- public void testJoinTableSetCatalogNull() throws Exception {
- ICompilationUnit cu = this.createTestAssociationOverrideJoinTableWithCatalog();
- JavaResourcePersistentType typeResource = buildJavaTypeResource(cu);
-
- AssociationOverridesAnnotation associationOverrides = (AssociationOverridesAnnotation) typeResource.getSupportingAnnotation(JPA.ASSOCIATION_OVERRIDES);
- AssociationOverride2_0Annotation associationOverride = (AssociationOverride2_0Annotation) associationOverrides.nestedAnnotations().next();
- JoinTableAnnotation table = associationOverride.getJoinTable();
- assertEquals(CATALOG_NAME, table.getCatalog());
-
- table.setCatalog(null);
- assertNull(table.getCatalog());
-
- assertSourceDoesNotContain("@JoinTable", cu);
- }
-
- public void testJoinTableGetSchema() throws Exception {
- ICompilationUnit cu = this.createTestAssociationOverrideJoinTableWithSchema();
- JavaResourcePersistentType typeResource = buildJavaTypeResource(cu);
-
- AssociationOverridesAnnotation associationOverrides = (AssociationOverridesAnnotation) typeResource.getSupportingAnnotation(JPA.ASSOCIATION_OVERRIDES);
- AssociationOverride2_0Annotation associationOverride = (AssociationOverride2_0Annotation) associationOverrides.nestedAnnotations().next();
- JoinTableAnnotation table = associationOverride.getJoinTable();
- assertNotNull(table);
- assertEquals(SCHEMA_NAME, table.getSchema());
- }
-
- public void testJoinTableSetSchema() throws Exception {
- ICompilationUnit cu = this.createTestAssociationOverrideWithJoinTable();
- JavaResourcePersistentType typeResource = buildJavaTypeResource(cu);
-
- AssociationOverridesAnnotation associationOverrides = (AssociationOverridesAnnotation) typeResource.getSupportingAnnotation(JPA.ASSOCIATION_OVERRIDES);
- AssociationOverride2_0Annotation associationOverride = (AssociationOverride2_0Annotation) associationOverrides.nestedAnnotations().next();
- JoinTableAnnotation table = associationOverride.getJoinTable();
- assertNotNull(table);
- assertNull(table.getSchema());
-
- table.setSchema("Foo");
- assertEquals("Foo", table.getSchema());
-
- assertSourceContains("@AssociationOverride(name = \"" + ASSOCIATION_OVERRIDE_NAME + "\", joinTable = @JoinTable(name = \"MY_JOIN_TABLE\", schema = \"Foo\"))", cu);
- }
-
- public void testJoinTableSetSchemaNull() throws Exception {
- ICompilationUnit cu = this.createTestAssociationOverrideJoinTableWithSchema();
- JavaResourcePersistentType typeResource = buildJavaTypeResource(cu);
-
- AssociationOverridesAnnotation associationOverrides = (AssociationOverridesAnnotation) typeResource.getSupportingAnnotation(JPA.ASSOCIATION_OVERRIDES);
- AssociationOverride2_0Annotation associationOverride = (AssociationOverride2_0Annotation) associationOverrides.nestedAnnotations().next();
- JoinTableAnnotation table = associationOverride.getJoinTable();
- assertEquals(SCHEMA_NAME, table.getSchema());
-
- table.setSchema(null);
- assertNull(table.getSchema());
-
- assertSourceDoesNotContain("@JoinTable", cu);
- }
-
- public void testJoinTableUniqueConstraints() throws Exception {
- ICompilationUnit cu = this.createTestAssociationOverrideWithJoinTable();
- JavaResourcePersistentType typeResource = buildJavaTypeResource(cu);
-
- AssociationOverridesAnnotation associationOverrides = (AssociationOverridesAnnotation) typeResource.getSupportingAnnotation(JPA.ASSOCIATION_OVERRIDES);
- AssociationOverride2_0Annotation associationOverride = (AssociationOverride2_0Annotation) associationOverrides.nestedAnnotations().next();
- JoinTableAnnotation table = associationOverride.getJoinTable();
-
- assertEquals(0, table.uniqueConstraintsSize());
- }
-
- public void testJoinTableUniqueConstraints2() throws Exception {
- ICompilationUnit cu = this.createTestAssociationOverrideWithJoinTable();
- JavaResourcePersistentType typeResource = buildJavaTypeResource(cu);
-
- AssociationOverridesAnnotation associationOverrides = (AssociationOverridesAnnotation) typeResource.getSupportingAnnotation(JPA.ASSOCIATION_OVERRIDES);
- AssociationOverride2_0Annotation associationOverride = (AssociationOverride2_0Annotation) associationOverrides.nestedAnnotations().next();
- JoinTableAnnotation table = associationOverride.getJoinTable();
-
-
- table.addUniqueConstraint(0);
- table.addUniqueConstraint(1);
-
- assertEquals(2, table.uniqueConstraintsSize());
- }
-
- public void testJoinTableUniqueConstraints3() throws Exception {
- ICompilationUnit cu = this.createTestAssociationOverrideJoinTableWithUniqueConstraints();
- JavaResourcePersistentType typeResource = buildJavaTypeResource(cu);
-
- AssociationOverridesAnnotation associationOverrides = (AssociationOverridesAnnotation) typeResource.getSupportingAnnotation(JPA.ASSOCIATION_OVERRIDES);
- AssociationOverride2_0Annotation associationOverride = (AssociationOverride2_0Annotation) associationOverrides.nestedAnnotations().next();
- JoinTableAnnotation table = associationOverride.getJoinTable();
-
- assertEquals(3, table.uniqueConstraintsSize());
- }
-
- public void testJoinTableAddUniqueConstraint() throws Exception {
- ICompilationUnit cu = this.createTestAssociationOverrideWithJoinTable();
- JavaResourcePersistentType typeResource = buildJavaTypeResource(cu);
-
- AssociationOverridesAnnotation associationOverrides = (AssociationOverridesAnnotation) typeResource.getSupportingAnnotation(JPA.ASSOCIATION_OVERRIDES);
- AssociationOverride2_0Annotation associationOverride = (AssociationOverride2_0Annotation) associationOverrides.nestedAnnotations().next();
- JoinTableAnnotation table = associationOverride.getJoinTable();
-
- table.addUniqueConstraint(0).addColumnName("FOO");
- table.addUniqueConstraint(1);
- table.addUniqueConstraint(0).addColumnName("BAR");
-
- assertEquals("BAR", table.uniqueConstraintAt(0).columnNames().next());
- assertEquals("FOO", table.uniqueConstraintAt(1).columnNames().next());
- assertEquals(0, table.uniqueConstraintAt(2).columnNamesSize());
-
- assertSourceContains("@AssociationOverride(name = \"" + ASSOCIATION_OVERRIDE_NAME + "\", joinTable = @JoinTable(name = \"MY_JOIN_TABLE\", uniqueConstraints = {@UniqueConstraint(columnNames = \"BAR\"),@UniqueConstraint(columnNames = \"FOO\"), @UniqueConstraint}))", cu);
- }
-
- public void testJoinTableRemoveUniqueConstraint() throws Exception {
- ICompilationUnit cu = this.createTestAssociationOverrideJoinTableWithUniqueConstraints();
- JavaResourcePersistentType typeResource = buildJavaTypeResource(cu);
-
- AssociationOverridesAnnotation associationOverrides = (AssociationOverridesAnnotation) typeResource.getSupportingAnnotation(JPA.ASSOCIATION_OVERRIDES);
- AssociationOverride2_0Annotation associationOverride = (AssociationOverride2_0Annotation) associationOverrides.nestedAnnotations().next();
- JoinTableAnnotation table = associationOverride.getJoinTable();
- assertEquals("BAR", table.uniqueConstraintAt(0).columnNames().next());
- assertEquals("FOO", table.uniqueConstraintAt(1).columnNames().next());
- assertEquals("BAZ", table.uniqueConstraintAt(2).columnNames().next());
- assertEquals(3, table.uniqueConstraintsSize());
-
- table.removeUniqueConstraint(1);
- assertEquals("BAR", table.uniqueConstraintAt(0).columnNames().next());
- assertEquals("BAZ", table.uniqueConstraintAt(1).columnNames().next());
- assertEquals(2, table.uniqueConstraintsSize());
- assertSourceContains("@AssociationOverride(name = \"" + ASSOCIATION_OVERRIDE_NAME + "\", joinTable = @JoinTable(uniqueConstraints = {@UniqueConstraint(columnNames = {\"BAR\"}), @UniqueConstraint(columnNames = {\"BAZ\"})}))", cu);
-
- table.removeUniqueConstraint(0);
- assertEquals("BAZ", table.uniqueConstraintAt(0).columnNames().next());
- assertEquals(1, table.uniqueConstraintsSize());
- assertSourceContains("@AssociationOverride(name = \"" + ASSOCIATION_OVERRIDE_NAME + "\", joinTable = @JoinTable(uniqueConstraints = @UniqueConstraint(columnNames = {\"BAZ\"})))", cu);
-
- table.removeUniqueConstraint(0);
- assertEquals(0, table.uniqueConstraintsSize());
- assertSourceDoesNotContain("@JoinTable", cu);
- }
-
- public void testJoinTableMoveUniqueConstraint() throws Exception {
- ICompilationUnit cu = this.createTestAssociationOverrideJoinTableWithUniqueConstraints();
- JavaResourcePersistentType typeResource = buildJavaTypeResource(cu);
-
- AssociationOverridesAnnotation associationOverrides = (AssociationOverridesAnnotation) typeResource.getSupportingAnnotation(JPA.ASSOCIATION_OVERRIDES);
- AssociationOverride2_0Annotation associationOverride = (AssociationOverride2_0Annotation) associationOverrides.nestedAnnotations().next();
- JoinTableAnnotation table = associationOverride.getJoinTable();
- assertSourceContains("@AssociationOverride(name = \"" + ASSOCIATION_OVERRIDE_NAME + "\", joinTable = @JoinTable(uniqueConstraints = {@UniqueConstraint(columnNames = {\"BAR\"}), @UniqueConstraint(columnNames = {\"FOO\"}), @UniqueConstraint(columnNames = {\"BAZ\"})}))", cu);
-
- table.moveUniqueConstraint(2, 0);
- assertSourceContains("@AssociationOverride(name = \"" + ASSOCIATION_OVERRIDE_NAME + "\", joinTable = @JoinTable(uniqueConstraints = {@UniqueConstraint(columnNames = {\"FOO\"}), @UniqueConstraint(columnNames = {\"BAZ\"}), @UniqueConstraint(columnNames = {\"BAR\"})}))", cu);
- }
-
- public void testJoinTableMoveUniqueConstraint2() throws Exception {
- ICompilationUnit cu = this.createTestAssociationOverrideJoinTableWithUniqueConstraints();
- JavaResourcePersistentType typeResource = buildJavaTypeResource(cu);
-
- AssociationOverridesAnnotation associationOverrides = (AssociationOverridesAnnotation) typeResource.getSupportingAnnotation(JPA.ASSOCIATION_OVERRIDES);
- AssociationOverride2_0Annotation associationOverride = (AssociationOverride2_0Annotation) associationOverrides.nestedAnnotations().next();
- JoinTableAnnotation table = associationOverride.getJoinTable();
- assertSourceContains("@AssociationOverride(name = \"" + ASSOCIATION_OVERRIDE_NAME + "\", joinTable = @JoinTable(uniqueConstraints = {@UniqueConstraint(columnNames = {\"BAR\"}), @UniqueConstraint(columnNames = {\"FOO\"}), @UniqueConstraint(columnNames = {\"BAZ\"})}))", cu);
-
- table.moveUniqueConstraint(0, 2);
- assertSourceContains("@AssociationOverride(name = \"" + ASSOCIATION_OVERRIDE_NAME + "\", joinTable = @JoinTable(uniqueConstraints = {@UniqueConstraint(columnNames = {\"BAZ\"}), @UniqueConstraint(columnNames = {\"BAR\"}), @UniqueConstraint(columnNames = {\"FOO\"})}))", cu);
- }
-
- public void testJoinTableJoinColumns() throws Exception {
- ICompilationUnit cu = this.createTestAssociationOverrideWithJoinTable();
- JavaResourcePersistentType typeResource = buildJavaTypeResource(cu);
-
- AssociationOverridesAnnotation associationOverrides = (AssociationOverridesAnnotation) typeResource.getSupportingAnnotation(JPA.ASSOCIATION_OVERRIDES);
- AssociationOverride2_0Annotation associationOverride = (AssociationOverride2_0Annotation) associationOverrides.nestedAnnotations().next();
- JoinTableAnnotation table = associationOverride.getJoinTable();
-
- assertEquals(0, table.joinColumnsSize());
- }
-
- public void testJoinTableJoinColumns2() throws Exception {
- ICompilationUnit cu = this.createTestAssociationOverrideWithJoinTable();
- JavaResourcePersistentType typeResource = buildJavaTypeResource(cu);
-
- AssociationOverridesAnnotation associationOverrides = (AssociationOverridesAnnotation) typeResource.getSupportingAnnotation(JPA.ASSOCIATION_OVERRIDES);
- AssociationOverride2_0Annotation associationOverride = (AssociationOverride2_0Annotation) associationOverrides.nestedAnnotations().next();
- JoinTableAnnotation table = associationOverride.getJoinTable();
-
-
- table.addJoinColumn(0);
- table.addJoinColumn(1);
-
- assertEquals(2, table.joinColumnsSize());
- }
-
- public void testJoinTableJoinColumns3() throws Exception {
- ICompilationUnit cu = this.createTestAssociationOverrideJoinTableWithJoinColumns();
- JavaResourcePersistentType typeResource = buildJavaTypeResource(cu);
-
- AssociationOverridesAnnotation associationOverrides = (AssociationOverridesAnnotation) typeResource.getSupportingAnnotation(JPA.ASSOCIATION_OVERRIDES);
- AssociationOverride2_0Annotation associationOverride = (AssociationOverride2_0Annotation) associationOverrides.nestedAnnotations().next();
- JoinTableAnnotation table = associationOverride.getJoinTable();
-
- assertEquals(2, table.joinColumnsSize());
- }
-
- public void testJoinTableAddJoinColumn() throws Exception {
- ICompilationUnit cu = this.createTestAssociationOverrideWithJoinTable();
- JavaResourcePersistentType typeResource = buildJavaTypeResource(cu);
-
- AssociationOverridesAnnotation associationOverrides = (AssociationOverridesAnnotation) typeResource.getSupportingAnnotation(JPA.ASSOCIATION_OVERRIDES);
- AssociationOverride2_0Annotation associationOverride = (AssociationOverride2_0Annotation) associationOverrides.nestedAnnotations().next();
- JoinTableAnnotation table = associationOverride.getJoinTable();
-
- table.addJoinColumn(0).setName("FOO");
- table.addJoinColumn(1);
- table.addJoinColumn(0).setName("BAR");
-
- assertEquals("BAR", table.joinColumnAt(0).getName());
- assertEquals("FOO", table.joinColumnAt(1).getName());
- assertNull(table.joinColumnAt(2).getName());
- assertSourceContains("@AssociationOverride(name = \"" + ASSOCIATION_OVERRIDE_NAME + "\", joinTable = @JoinTable(name = \"MY_JOIN_TABLE\", joinColumns = {@JoinColumn(name = \"BAR\"),@JoinColumn(name = \"FOO\"), @JoinColumn}))", cu);
- }
-
- public void testJoinTableRemoveJoinColumn() throws Exception {
- ICompilationUnit cu = this.createTestAssociationOverrideJoinTableWithJoinColumns();
- JavaResourcePersistentType typeResource = buildJavaTypeResource(cu);
-
- AssociationOverridesAnnotation associationOverrides = (AssociationOverridesAnnotation) typeResource.getSupportingAnnotation(JPA.ASSOCIATION_OVERRIDES);
- AssociationOverride2_0Annotation associationOverride = (AssociationOverride2_0Annotation) associationOverrides.nestedAnnotations().next();
- JoinTableAnnotation table = associationOverride.getJoinTable();
- table.addJoinColumn(0).setName("FOO");
-
- assertEquals("FOO", table.joinColumnAt(0).getName());
- assertEquals("BAR", table.joinColumnAt(1).getName());
- assertNull(table.joinColumnAt(2).getName());
- assertEquals(3, table.joinColumnsSize());
-
- table.removeJoinColumn(1);
- assertEquals("FOO", table.joinColumnAt(0).getName());
- assertNull(table.joinColumnAt(1).getName());
- assertEquals(2, table.joinColumnsSize());
- assertSourceContains("@AssociationOverride(name = \"" + ASSOCIATION_OVERRIDE_NAME + "\", joinTable = @JoinTable(joinColumns = {@JoinColumn(name = \"FOO\"), @JoinColumn}))", cu);
-
- table.removeJoinColumn(0);
- assertNull(table.joinColumnAt(0).getName());
- assertEquals(1, table.joinColumnsSize());
- assertSourceContains("@AssociationOverride(name = \"" + ASSOCIATION_OVERRIDE_NAME + "\", joinTable = @JoinTable(joinColumns = @JoinColumn))", cu);
-
-
- table.removeJoinColumn(0);
- assertEquals(0, table.joinColumnsSize());
- assertSourceDoesNotContain("@JoinTable", cu);
- }
-
- public void testJoinTableMoveJoinColumn() throws Exception {
- ICompilationUnit cu = this.createTestAssociationOverrideJoinTableWithJoinColumns();
- JavaResourcePersistentType typeResource = buildJavaTypeResource(cu);
-
- AssociationOverridesAnnotation associationOverrides = (AssociationOverridesAnnotation) typeResource.getSupportingAnnotation(JPA.ASSOCIATION_OVERRIDES);
- AssociationOverride2_0Annotation associationOverride = (AssociationOverride2_0Annotation) associationOverrides.nestedAnnotations().next();
- JoinTableAnnotation table = associationOverride.getJoinTable();
- JoinColumnAnnotation joinColumn = table.joinColumnAt(0);
- joinColumn.setReferencedColumnName("REF_NAME");
- joinColumn.setUnique(Boolean.FALSE);
- joinColumn.setNullable(Boolean.FALSE);
- joinColumn.setInsertable(Boolean.FALSE);
- joinColumn.setUpdatable(Boolean.FALSE);
- joinColumn.setColumnDefinition("COLUMN_DEF");
- joinColumn.setTable("TABLE");
- table.addJoinColumn(0).setName("FOO");
-
- assertSourceContains("@AssociationOverride(name = \"" + ASSOCIATION_OVERRIDE_NAME + "\", joinTable = @JoinTable(joinColumns = {@JoinColumn(name = \"FOO\"), @JoinColumn(name = \"BAR\", referencedColumnName = \"REF_NAME\", unique = false, nullable = false, insertable = false, updatable = false, columnDefinition = \"COLUMN_DEF\", table = \"TABLE\"), @JoinColumn}))", cu);
-
- table.moveJoinColumn(2, 0);
- assertEquals("BAR", table.joinColumnAt(0).getName());
- assertNull(table.joinColumnAt(1).getName());
- assertEquals("FOO", table.joinColumnAt(2).getName());
- assertEquals(3, table.joinColumnsSize());
- assertSourceContains("@AssociationOverride(name = \"" + ASSOCIATION_OVERRIDE_NAME + "\", joinTable = @JoinTable(joinColumns = {@JoinColumn(name = \"BAR\", referencedColumnName = \"REF_NAME\", unique = false, nullable = false, insertable = false, updatable = false, columnDefinition = \"COLUMN_DEF\", table = \"TABLE\"), @JoinColumn, @JoinColumn(name = \"FOO\")}))", cu);
- }
-
- public void testJoinTableMoveJoinColumn2() throws Exception {
- ICompilationUnit cu = this.createTestAssociationOverrideJoinTableWithJoinColumns();
- JavaResourcePersistentType typeResource = buildJavaTypeResource(cu);
-
- AssociationOverridesAnnotation associationOverrides = (AssociationOverridesAnnotation) typeResource.getSupportingAnnotation(JPA.ASSOCIATION_OVERRIDES);
- AssociationOverride2_0Annotation associationOverride = (AssociationOverride2_0Annotation) associationOverrides.nestedAnnotations().next();
- JoinTableAnnotation table = associationOverride.getJoinTable();
-
- JoinColumnAnnotation joinColumn = table.joinColumnAt(0);
- joinColumn.setReferencedColumnName("REF_NAME");
- joinColumn.setUnique(Boolean.FALSE);
- joinColumn.setNullable(Boolean.FALSE);
- joinColumn.setInsertable(Boolean.FALSE);
- joinColumn.setUpdatable(Boolean.FALSE);
- joinColumn.setColumnDefinition("COLUMN_DEF");
- joinColumn.setTable("TABLE");
-
- table.addJoinColumn(0).setName("FOO");
-
- assertSourceContains("@AssociationOverride(name = \"" + ASSOCIATION_OVERRIDE_NAME + "\", joinTable = @JoinTable(joinColumns = {@JoinColumn(name = \"FOO\"), @JoinColumn(name = \"BAR\", referencedColumnName = \"REF_NAME\", unique = false, nullable = false, insertable = false, updatable = false, columnDefinition = \"COLUMN_DEF\", table = \"TABLE\"), @JoinColumn}))", cu);
-
-
- table.moveJoinColumn(0, 2);
- assertNull(table.joinColumnAt(0).getName());
- assertEquals("FOO", table.joinColumnAt(1).getName());
- assertEquals("BAR", table.joinColumnAt(2).getName());
- assertEquals(3, table.joinColumnsSize());
- assertSourceContains("@AssociationOverride(name = \"" + ASSOCIATION_OVERRIDE_NAME + "\", joinTable = @JoinTable(joinColumns = {@JoinColumn, @JoinColumn(name = \"FOO\"), @JoinColumn(name = \"BAR\", referencedColumnName = \"REF_NAME\", unique = false, nullable = false, insertable = false, updatable = false, columnDefinition = \"COLUMN_DEF\", table = \"TABLE\")}))", cu);
- }
-
- public void testJoinTableSetJoinColumnName() throws Exception {
- ICompilationUnit cu = this.createTestAssociationOverrideJoinTableWithJoinColumns();
- JavaResourcePersistentType typeResource = buildJavaTypeResource(cu);
-
- AssociationOverridesAnnotation associationOverrides = (AssociationOverridesAnnotation) typeResource.getSupportingAnnotation(JPA.ASSOCIATION_OVERRIDES);
- AssociationOverride2_0Annotation associationOverride = (AssociationOverride2_0Annotation) associationOverrides.nestedAnnotations().next();
- JoinTableAnnotation table = associationOverride.getJoinTable();
-
- assertEquals(2, table.joinColumnsSize());
-
- JoinColumnAnnotation joinColumn = table.joinColumns().next();
-
- assertEquals("BAR", joinColumn.getName());
-
- joinColumn.setName("foo");
- assertEquals("foo", joinColumn.getName());
-
- assertSourceContains("@AssociationOverride(name = \"" + ASSOCIATION_OVERRIDE_NAME + "\", joinTable = @JoinTable(joinColumns = {@JoinColumn(name = \"foo\"), @JoinColumn}))", cu);
- }
-
- public void testJoinTableInverseJoinColumns() throws Exception {
- ICompilationUnit cu = this.createTestAssociationOverrideWithJoinTable();
- JavaResourcePersistentType typeResource = buildJavaTypeResource(cu);
-
- AssociationOverridesAnnotation associationOverrides = (AssociationOverridesAnnotation) typeResource.getSupportingAnnotation(JPA.ASSOCIATION_OVERRIDES);
- AssociationOverride2_0Annotation associationOverride = (AssociationOverride2_0Annotation) associationOverrides.nestedAnnotations().next();
- JoinTableAnnotation table = associationOverride.getJoinTable();
-
- assertEquals(0, table.inverseJoinColumnsSize());
- }
-
- public void testInverseJoinColumns2() throws Exception {
- ICompilationUnit cu = this.createTestAssociationOverrideWithJoinTable();
- JavaResourcePersistentType typeResource = buildJavaTypeResource(cu);
-
- AssociationOverridesAnnotation associationOverrides = (AssociationOverridesAnnotation) typeResource.getSupportingAnnotation(JPA.ASSOCIATION_OVERRIDES);
- AssociationOverride2_0Annotation associationOverride = (AssociationOverride2_0Annotation) associationOverrides.nestedAnnotations().next();
- JoinTableAnnotation table = associationOverride.getJoinTable();
-
-
- table.addInverseJoinColumn(0);
- table.addInverseJoinColumn(1);
-
- assertEquals(2, table.inverseJoinColumnsSize());
- }
-
- public void testJoinTableInverseJoinColumns3() throws Exception {
- ICompilationUnit cu = this.createTestAssociationOverrideJoinTableWithInverseJoinColumns();
- JavaResourcePersistentType typeResource = buildJavaTypeResource(cu);
-
- AssociationOverridesAnnotation associationOverrides = (AssociationOverridesAnnotation) typeResource.getSupportingAnnotation(JPA.ASSOCIATION_OVERRIDES);
- AssociationOverride2_0Annotation associationOverride = (AssociationOverride2_0Annotation) associationOverrides.nestedAnnotations().next();
- JoinTableAnnotation table = associationOverride.getJoinTable();
-
- assertEquals(2, table.inverseJoinColumnsSize());
- }
-
- public void testAddInverseJoinColumn() throws Exception {
- ICompilationUnit cu = this.createTestAssociationOverrideWithJoinTable();
- JavaResourcePersistentType typeResource = buildJavaTypeResource(cu);
-
- AssociationOverridesAnnotation associationOverrides = (AssociationOverridesAnnotation) typeResource.getSupportingAnnotation(JPA.ASSOCIATION_OVERRIDES);
- AssociationOverride2_0Annotation associationOverride = (AssociationOverride2_0Annotation) associationOverrides.nestedAnnotations().next();
- JoinTableAnnotation table = associationOverride.getJoinTable();
-
- table.addInverseJoinColumn(0).setName("FOO");
- table.addInverseJoinColumn(1);
- table.addInverseJoinColumn(0).setName("BAR");
-
- assertEquals("BAR", table.inverseJoinColumnAt(0).getName());
- assertEquals("FOO", table.inverseJoinColumnAt(1).getName());
- assertNull(table.inverseJoinColumnAt(2).getName());
- assertSourceContains("@AssociationOverride(name = \"" + ASSOCIATION_OVERRIDE_NAME + "\", joinTable = @JoinTable(name = \"MY_JOIN_TABLE\", inverseJoinColumns = {@JoinColumn(name = \"BAR\"),@JoinColumn(name = \"FOO\"), @JoinColumn}))", cu);
- }
-
- public void testJoinTableRemoveInverseJoinColumn() throws Exception {
- ICompilationUnit cu = this.createTestAssociationOverrideJoinTableWithInverseJoinColumns();
- JavaResourcePersistentType typeResource = buildJavaTypeResource(cu);
-
- AssociationOverridesAnnotation associationOverrides = (AssociationOverridesAnnotation) typeResource.getSupportingAnnotation(JPA.ASSOCIATION_OVERRIDES);
- AssociationOverride2_0Annotation associationOverride = (AssociationOverride2_0Annotation) associationOverrides.nestedAnnotations().next();
- JoinTableAnnotation table = associationOverride.getJoinTable();
- table.addInverseJoinColumn(2).setName("FOO");
-
- Iterator<JoinColumnAnnotation> inverseJoinColumns = table.inverseJoinColumns();
- assertEquals("BAR", inverseJoinColumns.next().getName());
- assertNull(inverseJoinColumns.next().getName());
- assertEquals("FOO", inverseJoinColumns.next().getName());
- assertFalse(inverseJoinColumns.hasNext());
-
- table.removeInverseJoinColumn(1);
- assertSourceContains("@AssociationOverride(name = \"" + ASSOCIATION_OVERRIDE_NAME + "\", joinTable = @JoinTable(inverseJoinColumns = {@JoinColumn(name = \"BAR\"), @JoinColumn(name = \"FOO\")}))", cu);
- inverseJoinColumns = table.inverseJoinColumns();
- assertEquals("BAR", inverseJoinColumns.next().getName());
- assertEquals("FOO", inverseJoinColumns.next().getName());
- assertFalse(inverseJoinColumns.hasNext());
-
- table.removeInverseJoinColumn(0);
- assertSourceContains("@AssociationOverride(name = \"" + ASSOCIATION_OVERRIDE_NAME + "\", joinTable = @JoinTable(inverseJoinColumns = @JoinColumn(name = \"FOO\")))", cu);
- inverseJoinColumns = table.inverseJoinColumns();
- assertEquals("FOO", inverseJoinColumns.next().getName());
- assertFalse(inverseJoinColumns.hasNext());
-
- table.removeInverseJoinColumn(0);
- assertSourceDoesNotContain("@JoinTable", cu);
- }
-
- public void testJoinTableMoveInverseJoinColumn() throws Exception {
- ICompilationUnit cu = this.createTestAssociationOverrideJoinTableWithInverseJoinColumns();
- JavaResourcePersistentType typeResource = buildJavaTypeResource(cu);
-
- AssociationOverridesAnnotation associationOverrides = (AssociationOverridesAnnotation) typeResource.getSupportingAnnotation(JPA.ASSOCIATION_OVERRIDES);
- AssociationOverride2_0Annotation associationOverride = (AssociationOverride2_0Annotation) associationOverrides.nestedAnnotations().next();
- JoinTableAnnotation table = associationOverride.getJoinTable();
- table.addInverseJoinColumn(0).setName("FOO");
-
- Iterator<JoinColumnAnnotation> inverseJoinColumns = table.inverseJoinColumns();
- assertEquals("FOO", inverseJoinColumns.next().getName());
- assertEquals("BAR", inverseJoinColumns.next().getName());
- assertNull(inverseJoinColumns.next().getName());
-
- table.moveInverseJoinColumn(2, 0);
- inverseJoinColumns = table.inverseJoinColumns();
- assertEquals("BAR", inverseJoinColumns.next().getName());
- assertNull(inverseJoinColumns.next().getName());
- assertEquals("FOO", inverseJoinColumns.next().getName());
-
- assertSourceContains("@AssociationOverride(name = \"" + ASSOCIATION_OVERRIDE_NAME + "\", joinTable = @JoinTable(inverseJoinColumns = {@JoinColumn(name = \"BAR\"), @JoinColumn, @JoinColumn(name = \"FOO\")}))", cu);
- }
-
- public void testJoinTableMoveInverseJoinColumn2() throws Exception {
- ICompilationUnit cu = this.createTestAssociationOverrideJoinTableWithInverseJoinColumns();
- JavaResourcePersistentType typeResource = buildJavaTypeResource(cu);
-
- AssociationOverridesAnnotation associationOverrides = (AssociationOverridesAnnotation) typeResource.getSupportingAnnotation(JPA.ASSOCIATION_OVERRIDES);
- AssociationOverride2_0Annotation associationOverride = (AssociationOverride2_0Annotation) associationOverrides.nestedAnnotations().next();
- JoinTableAnnotation table = associationOverride.getJoinTable();
- table.addInverseJoinColumn(1).setName("FOO");
-
- Iterator<JoinColumnAnnotation> inverseJoinColumns = table.inverseJoinColumns();
- assertEquals("BAR", inverseJoinColumns.next().getName());
- assertEquals("FOO", inverseJoinColumns.next().getName());
- assertNull(inverseJoinColumns.next().getName());
-
- table.moveInverseJoinColumn(0, 2);
- inverseJoinColumns = table.inverseJoinColumns();
- assertNull(inverseJoinColumns.next().getName());
- assertEquals("BAR", inverseJoinColumns.next().getName());
- assertEquals("FOO", inverseJoinColumns.next().getName());
-
- assertSourceContains("@AssociationOverride(name = \"" + ASSOCIATION_OVERRIDE_NAME + "\", joinTable = @JoinTable(inverseJoinColumns = {@JoinColumn, @JoinColumn(name = \"BAR\"), @JoinColumn(name = \"FOO\")}))", cu);
- }
-
- public void testJoinTableSetInverseJoinColumnName() throws Exception {
- ICompilationUnit cu = this.createTestAssociationOverrideJoinTableWithInverseJoinColumns();
- JavaResourcePersistentType typeResource = buildJavaTypeResource(cu);
-
- AssociationOverridesAnnotation associationOverrides = (AssociationOverridesAnnotation) typeResource.getSupportingAnnotation(JPA.ASSOCIATION_OVERRIDES);
- AssociationOverride2_0Annotation associationOverride = (AssociationOverride2_0Annotation) associationOverrides.nestedAnnotations().next();
- JoinTableAnnotation table = associationOverride.getJoinTable();
-
- assertEquals(2, table.inverseJoinColumnsSize());
-
- JoinColumnAnnotation joinColumn = table.inverseJoinColumns().next();
-
- assertEquals("BAR", joinColumn.getName());
-
- joinColumn.setName("foo");
- assertEquals("foo", joinColumn.getName());
-
- assertSourceContains("@AssociationOverride(name = \"" + ASSOCIATION_OVERRIDE_NAME + "\", joinTable = @JoinTable(inverseJoinColumns = {@JoinColumn(name = \"foo\"), @JoinColumn}))", cu);
- }
-
-
-}
diff --git a/jpa/tests/org.eclipse.jpt.core.tests/src/org/eclipse/jpt2_0/core/tests/internal/resource/java/Generic2_0JavaResourceModelTestCase.java b/jpa/tests/org.eclipse.jpt.core.tests/src/org/eclipse/jpt2_0/core/tests/internal/resource/java/Generic2_0JavaResourceModelTestCase.java
deleted file mode 100644
index 2f8651df86..0000000000
--- a/jpa/tests/org.eclipse.jpt.core.tests/src/org/eclipse/jpt2_0/core/tests/internal/resource/java/Generic2_0JavaResourceModelTestCase.java
+++ /dev/null
@@ -1,29 +0,0 @@
-/*******************************************************************************
- * Copyright (c) 2009 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.
- *
- * Contributors:
- * Oracle - initial API and implementation
- ******************************************************************************/
-package org.eclipse.jpt2_0.core.tests.internal.resource.java;
-
-import org.eclipse.jpt.core.JpaAnnotationProvider;
-import org.eclipse.jpt.core.internal.platform.GenericJpaAnnotationProvider;
-import org.eclipse.jpt.core.tests.internal.resource.java.JavaResourceModelTestCase;
-import org.eclipse.jpt2_0.core.internal.platform.Generic2_0JpaAnnotationDefinitionProvider;
-
-public class Generic2_0JavaResourceModelTestCase extends JavaResourceModelTestCase
-{
-
- public Generic2_0JavaResourceModelTestCase(String name) {
- super(name);
- }
-
- @Override
- protected JpaAnnotationProvider buildAnnotationProvider() {
- return new GenericJpaAnnotationProvider(
- Generic2_0JpaAnnotationDefinitionProvider.instance());
- }
-}
diff --git a/jpa/tests/org.eclipse.jpt.core.tests/src/org/eclipse/jpt2_0/core/tests/internal/resource/java/Generic2_0JavaResourceTests.java b/jpa/tests/org.eclipse.jpt.core.tests/src/org/eclipse/jpt2_0/core/tests/internal/resource/java/Generic2_0JavaResourceTests.java
deleted file mode 100644
index bded6c3f96..0000000000
--- a/jpa/tests/org.eclipse.jpt.core.tests/src/org/eclipse/jpt2_0/core/tests/internal/resource/java/Generic2_0JavaResourceTests.java
+++ /dev/null
@@ -1,33 +0,0 @@
-/*******************************************************************************
- * Copyright (c) 2009 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.
- *
- * Contributors:
- * Oracle - initial API and implementation
- ******************************************************************************/
-package org.eclipse.jpt2_0.core.tests.internal.resource.java;
-
-import junit.framework.Test;
-import junit.framework.TestSuite;
-
-public class Generic2_0JavaResourceTests {
-
- public static Test suite() {
- TestSuite suite = new TestSuite(Generic2_0JavaResourceTests.class.getName());
-
- suite.addTestSuite(AccessAnnotationTests.class);
- suite.addTestSuite(AssociationOverride2_0Tests.class);
- suite.addTestSuite(AssociationOverrides2_0Tests.class);
- suite.addTestSuite(SequenceGenerator2_0Tests.class);
-
- return suite;
- }
-
- private Generic2_0JavaResourceTests() {
- super();
- throw new UnsupportedOperationException();
- }
-
-}
diff --git a/jpa/tests/org.eclipse.jpt.core.tests/src/org/eclipse/jpt2_0/core/tests/internal/resource/java/SequenceGenerator2_0Tests.java b/jpa/tests/org.eclipse.jpt.core.tests/src/org/eclipse/jpt2_0/core/tests/internal/resource/java/SequenceGenerator2_0Tests.java
deleted file mode 100644
index 1eca5b622b..0000000000
--- a/jpa/tests/org.eclipse.jpt.core.tests/src/org/eclipse/jpt2_0/core/tests/internal/resource/java/SequenceGenerator2_0Tests.java
+++ /dev/null
@@ -1,123 +0,0 @@
-/*******************************************************************************
-* Copyright (c) 2009 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.
-*
-* Contributors:
-* Oracle - initial API and implementation
-*******************************************************************************/
-package org.eclipse.jpt2_0.core.tests.internal.resource.java;
-
-import java.util.Iterator;
-
-import org.eclipse.jdt.core.ICompilationUnit;
-import org.eclipse.jpt.core.JpaAnnotationDefinitionProvider;
-import org.eclipse.jpt.core.resource.java.JPA;
-import org.eclipse.jpt.core.resource.java.JavaResourcePersistentAttribute;
-import org.eclipse.jpt.core.resource.java.JavaResourcePersistentType;
-import org.eclipse.jpt.utility.internal.iterators.ArrayIterator;
-import org.eclipse.jpt2_0.core.internal.platform.Generic2_0JpaAnnotationDefinitionProvider;
-import org.eclipse.jpt2_0.core.resource.java.SequenceGenerator2_0Annotation;
-
-/**
- * SequenceGenerator2_0Tests
- */
-@SuppressWarnings("nls")
-public class SequenceGenerator2_0Tests extends Generic2_0JavaResourceModelTestCase {
-
- private static final String GENERATOR_CATALOG = "TEST_CATALOG";
- private static final String GENERATOR_SCHEMA = "TEST_SCHEMA";
-
- public SequenceGenerator2_0Tests(String name) {
- super(name);
- }
-
- @Override
- protected JpaAnnotationDefinitionProvider annotationDefinitionProvider() {
- return Generic2_0JpaAnnotationDefinitionProvider.instance();
- }
-
- // ********** catalog **********
-
- public void testGetCatalog() throws Exception {
- ICompilationUnit cu = this.createTestSequenceGeneratorWithCatalog();
- JavaResourcePersistentType typeResource = this.buildJavaTypeResource(cu);
- JavaResourcePersistentAttribute attributeResource = typeResource.fields().next();
-
- SequenceGenerator2_0Annotation sequenceGenerator = (SequenceGenerator2_0Annotation) attributeResource.getSupportingAnnotation(JPA.SEQUENCE_GENERATOR);
- assertEquals(GENERATOR_CATALOG, sequenceGenerator.getCatalog());
- }
-
- public void testSetCatalog() throws Exception {
- ICompilationUnit cu = this.createTestSequenceGeneratorWithCatalog();
- JavaResourcePersistentType typeResource = buildJavaTypeResource(cu);
- JavaResourcePersistentAttribute attributeResource = typeResource.fields().next();
-
- SequenceGenerator2_0Annotation sequenceGenerator = (SequenceGenerator2_0Annotation) attributeResource.getSupportingAnnotation(JPA.SEQUENCE_GENERATOR);
- assertEquals(GENERATOR_CATALOG, sequenceGenerator.getCatalog());
-
- sequenceGenerator.setCatalog("foo");
- assertEquals("foo", sequenceGenerator.getCatalog());
-
- assertSourceContains("@SequenceGenerator(catalog = \"foo\")", cu);
-
- sequenceGenerator.setCatalog(null);
- assertNull(sequenceGenerator.getCatalog());
-
- assertSourceDoesNotContain("@SequenceGenerator", cu);
- }
-
- // ********** schema **********
-
- public void testGetSchema() throws Exception {
- ICompilationUnit cu = this.createTestSequenceGeneratorWithSchema();
- JavaResourcePersistentType typeResource = this.buildJavaTypeResource(cu);
- JavaResourcePersistentAttribute attributeResource = typeResource.fields().next();
-
- SequenceGenerator2_0Annotation sequenceGenerator = (SequenceGenerator2_0Annotation) attributeResource.getSupportingAnnotation(JPA.SEQUENCE_GENERATOR);
- assertEquals(GENERATOR_SCHEMA, sequenceGenerator.getSchema());
- }
-
- public void testSetSchema() throws Exception {
- ICompilationUnit cu = this.createTestSequenceGeneratorWithSchema();
- JavaResourcePersistentType typeResource = this.buildJavaTypeResource(cu);
- JavaResourcePersistentAttribute attributeResource = typeResource.fields().next();
-
- SequenceGenerator2_0Annotation sequenceGenerator = (SequenceGenerator2_0Annotation) attributeResource.getSupportingAnnotation(JPA.SEQUENCE_GENERATOR);
- assertEquals(GENERATOR_SCHEMA, sequenceGenerator.getSchema());
-
- sequenceGenerator.setSchema("foo");
- assertEquals("foo", sequenceGenerator.getSchema());
-
- assertSourceContains("@SequenceGenerator(schema = \"foo\")", cu);
-
- sequenceGenerator.setSchema(null);
- assertNull(sequenceGenerator.getSchema());
-
- assertSourceDoesNotContain("@SequenceGenerator", cu);
- }
-
- // ********** utility **********
-
- protected ICompilationUnit createTestSequenceGeneratorWithStringElement(final String elementName, final String value) throws Exception {
- return this.createTestType(new DefaultAnnotationWriter() {
- @Override
- public Iterator<String> imports() {
- return new ArrayIterator<String>(JPA.SEQUENCE_GENERATOR);
- }
- @Override
- public void appendIdFieldAnnotationTo(StringBuilder sb) {
- sb.append("@SequenceGenerator(" + elementName + " = \"" + value + "\")");
- }
- });
- }
-
- private ICompilationUnit createTestSequenceGeneratorWithCatalog() throws Exception {
- return this.createTestSequenceGeneratorWithStringElement("catalog", GENERATOR_CATALOG);
- }
-
- private ICompilationUnit createTestSequenceGeneratorWithSchema() throws Exception {
- return this.createTestSequenceGeneratorWithStringElement("schema", GENERATOR_SCHEMA);
- }
-}
diff --git a/jpa/tests/org.eclipse.jpt.core.tests/test.xml b/jpa/tests/org.eclipse.jpt.core.tests/test.xml
deleted file mode 100644
index a670c0f697..0000000000
--- a/jpa/tests/org.eclipse.jpt.core.tests/test.xml
+++ /dev/null
@@ -1,47 +0,0 @@
-<?xml version="1.0"?>
-<project name="testsuite" default="run" basedir=".">
- <!-- The property ${eclipse-home} should be passed into this script -->
- <!-- Set a meaningful default value for when it is not. -->
- <echo message="basedir ${basedir}" />
- <echo message="eclipse place ${eclipse-home}" />
- <!-- sets the properties plugin-name -->
- <property name="plugin-name" value="org.eclipse.jpt.core.tests"/>
- <echo level="debug" message="testRoot: ${testRoot}" />
- <fail message="testRoot must be set" unless="testRoot" />
-
- <!-- This target holds all initialization code that needs to be done for -->
- <!-- all tests that are to be run. Initialization for individual tests -->
- <!-- should be done within the body of the suite target. -->
- <target name="init">
- <tstamp/>
- <delete>
- <fileset dir="${eclipse-home}" includes="org*.xml"/>
- </delete>
- </target>
-
- <!-- This target defines the tests that need to be run. -->
- <target name="suite">
- <property file="${testRoot}/testServer.properties"/>
- <property name="jpt-folder" value="${eclipse-home}/jpt_folder"/>
- <delete dir="${jpt-folder}" quiet="true"/>
-
- <ant target="core-test" antfile="${library-file}" dir="${eclipse-home}">
- <property name="data-dir" value="${jpt-folder}"/>
- <property name="plugin-name" value="${plugin-name}"/>
- <property name="classname" value="org.eclipse.jpt.core.tests.internal.JptCoreTests" />
- <property name="plugin-path" value="${eclipse-home}/plugins/${plugin-name}"/>
- <property name="extraVMargs" value="-Dorg.eclipse.jpt.jpa.jar=${testDir}/${jpt-persistence-jar}"/>
- </ant>
- </target>
-
- <!-- This target holds code to cleanup the testing environment after -->
- <!-- after all of the tests have been run. You can use this target to -->
- <!-- delete temporary files that have been created. -->
- <target name="cleanup">
- </target>
-
- <!-- This target runs the test suite. Any actions that need to happen -->
- <!-- after all the tests have been run should go here. -->
- <target name="run" depends="init, suite, cleanup">
- </target>
-</project> \ No newline at end of file
diff --git a/jpa/tests/org.eclipse.jpt.db.tests/.classpath b/jpa/tests/org.eclipse.jpt.db.tests/.classpath
deleted file mode 100644
index ef8d91ca94..0000000000
--- a/jpa/tests/org.eclipse.jpt.db.tests/.classpath
+++ /dev/null
@@ -1,11 +0,0 @@
-<?xml version="1.0" encoding="UTF-8"?>
-<classpath>
- <classpathentry kind="src" path="src"/>
- <classpathentry kind="con" path="org.eclipse.jdt.launching.JRE_CONTAINER/org.eclipse.jdt.internal.debug.ui.launcher.StandardVMType/J2SE-1.5"/>
- <classpathentry kind="con" path="org.eclipse.pde.core.requiredPlugins">
- <accessrules>
- <accessrule kind="accessible" pattern="org/eclipse/jpt/utility/**"/>
- </accessrules>
- </classpathentry>
- <classpathentry kind="output" path="bin"/>
-</classpath>
diff --git a/jpa/tests/org.eclipse.jpt.db.tests/.cvsignore b/jpa/tests/org.eclipse.jpt.db.tests/.cvsignore
deleted file mode 100644
index ba077a4031..0000000000
--- a/jpa/tests/org.eclipse.jpt.db.tests/.cvsignore
+++ /dev/null
@@ -1 +0,0 @@
-bin
diff --git a/jpa/tests/org.eclipse.jpt.db.tests/.project b/jpa/tests/org.eclipse.jpt.db.tests/.project
deleted file mode 100644
index f5b0127a1e..0000000000
--- a/jpa/tests/org.eclipse.jpt.db.tests/.project
+++ /dev/null
@@ -1,28 +0,0 @@
-<?xml version="1.0" encoding="UTF-8"?>
-<projectDescription>
- <name>org.eclipse.jpt.db.tests</name>
- <comment></comment>
- <projects>
- </projects>
- <buildSpec>
- <buildCommand>
- <name>org.eclipse.jdt.core.javabuilder</name>
- <arguments>
- </arguments>
- </buildCommand>
- <buildCommand>
- <name>org.eclipse.pde.ManifestBuilder</name>
- <arguments>
- </arguments>
- </buildCommand>
- <buildCommand>
- <name>org.eclipse.pde.SchemaBuilder</name>
- <arguments>
- </arguments>
- </buildCommand>
- </buildSpec>
- <natures>
- <nature>org.eclipse.pde.PluginNature</nature>
- <nature>org.eclipse.jdt.core.javanature</nature>
- </natures>
-</projectDescription>
diff --git a/jpa/tests/org.eclipse.jpt.db.tests/.settings/org.eclipse.core.resources.prefs b/jpa/tests/org.eclipse.jpt.db.tests/.settings/org.eclipse.core.resources.prefs
deleted file mode 100644
index b23d0c7038..0000000000
--- a/jpa/tests/org.eclipse.jpt.db.tests/.settings/org.eclipse.core.resources.prefs
+++ /dev/null
@@ -1,3 +0,0 @@
-#Tue Jan 15 11:11:11 EST 2008
-eclipse.preferences.version=1
-encoding/<project>=ISO-8859-1
diff --git a/jpa/tests/org.eclipse.jpt.db.tests/META-INF/MANIFEST.MF b/jpa/tests/org.eclipse.jpt.db.tests/META-INF/MANIFEST.MF
deleted file mode 100644
index 0d3b08ea14..0000000000
--- a/jpa/tests/org.eclipse.jpt.db.tests/META-INF/MANIFEST.MF
+++ /dev/null
@@ -1,19 +0,0 @@
-Manifest-Version: 1.0
-Bundle-ManifestVersion: 2
-Bundle-Name: %pluginName
-Bundle-Vendor: %providerName
-Bundle-SymbolicName: org.eclipse.jpt.db.tests
-Bundle-Version: 1.0.100.qualifier
-Bundle-Activator: org.eclipse.jpt.db.tests.internal.JptDbTestsPlugin
-Bundle-ActivationPolicy: lazy
-Bundle-Localization: plugin
-Bundle-RequiredExecutionEnvironment: J2SE-1.5
-Require-Bundle: org.eclipse.core.runtime;bundle-version="[3.4.0,4.0.0)",
- org.junit;bundle-version="[3.8.2,4.0.0)",
- org.eclipse.datatools.connectivity;bundle-version="[1.1.0,1.2.0)",
- org.eclipse.datatools.connectivity.sqm.core;bundle-version="1.0.1",
- org.eclipse.datatools.modelbase.sql;bundle-version="1.0.0",
- org.eclipse.jpt.utility;bundle-version="[1.2.0,2.0.0)",
- org.eclipse.jpt.db;bundle-version="[1.2.0,2.0.0)"
-Export-Package: org.eclipse.jpt.db.tests.internal;x-internal:=true,
- org.eclipse.jpt.db.tests.internal.platforms;x-internal:=true
diff --git a/jpa/tests/org.eclipse.jpt.db.tests/about.html b/jpa/tests/org.eclipse.jpt.db.tests/about.html
deleted file mode 100644
index be534ba44f..0000000000
--- a/jpa/tests/org.eclipse.jpt.db.tests/about.html
+++ /dev/null
@@ -1,34 +0,0 @@
-<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.0//EN">
-<HTML>
-
-<head>
-<title>About</title>
-<meta http-equiv=Content-Type content="text/html; charset=ISO-8859-1">
-</head>
-
-<BODY lang="EN-US">
-
-<H3>About This Content</H3>
-
-<P>May 02, 2008</P>
-
-<H3>License</H3>
-
-<P>The Eclipse Foundation makes available all content in this plug-in
-("Content"). Unless otherwise indicated below, the Content is provided to you
-under the terms and conditions of the Eclipse Public License Version 1.0
-("EPL"). A copy of the EPL is available at
-<A href="http://www.eclipse.org/org/documents/epl-v10.php">http://www.eclipse.org/org/documents/epl-v10.php</A>.
-For purposes of the EPL, "Program" will mean the Content.</P>
-
-<P>If you did not receive this Content directly from the Eclipse Foundation, the
-Content is being redistributed by another party ("Redistributor") and different
-terms and conditions may apply to your use of any object code in the Content.
-Check the Redistributor's license that was provided with the Content. If no such
-license exists, contact the Redistributor. Unless otherwise indicated below, the
-terms and conditions of the EPL still apply to any source code in the Content
-and such source code may be obtained at
-<A href="http://www.eclipse.org/">http://www.eclipse.org/</A>.</P>
-
-</BODY>
-</HTML>
diff --git a/jpa/tests/org.eclipse.jpt.db.tests/build.properties b/jpa/tests/org.eclipse.jpt.db.tests/build.properties
deleted file mode 100644
index cd0d010fd1..0000000000
--- a/jpa/tests/org.eclipse.jpt.db.tests/build.properties
+++ /dev/null
@@ -1,15 +0,0 @@
-###############################################################################
-# Copyright (c) 2007 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
-#
-# Contributors:
-# Oracle - initial API and implementation
-###############################################################################
-source.. = src/
-output.. = bin/
-bin.includes = .,\
- META-INF/,\
- plugin.properties
diff --git a/jpa/tests/org.eclipse.jpt.db.tests/config/derby.properties b/jpa/tests/org.eclipse.jpt.db.tests/config/derby.properties
deleted file mode 100644
index 242d156070..0000000000
--- a/jpa/tests/org.eclipse.jpt.db.tests/config/derby.properties
+++ /dev/null
@@ -1,24 +0,0 @@
-################################################################################
-# Copyright (c) 2007, 2008 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.
-#
-# Contributors:
-# Oracle - initial API and implementation
-################################################################################
-
-# Configure the workspace- and database server-specific settings here.
-
-# user and password are optional for Derby
-userID =
-password =
-
-# the JDBC driver JAR(s) must be specified;
-# if there are multiple JARs, separate the names with commas
-# jars = C:/derby/lib/derby.jar
-jars =
-
-# the JDBC URL is required for Derby
-# url = jdbc:derby:C:/derby/data/testdb;create=true
-url =
diff --git a/jpa/tests/org.eclipse.jpt.db.tests/config/mysql.properties b/jpa/tests/org.eclipse.jpt.db.tests/config/mysql.properties
deleted file mode 100644
index d6407deb25..0000000000
--- a/jpa/tests/org.eclipse.jpt.db.tests/config/mysql.properties
+++ /dev/null
@@ -1,23 +0,0 @@
-################################################################################
-# Copyright (c) 2007, 2008 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.
-#
-# Contributors:
-# Oracle - initial API and implementation
-################################################################################
-
-# Configure the workspace- and database server-specific settings here.
-
-# user and password are optional, depending on the platform
-userID =
-password =
-
-# the JDBC driver JAR(s) must be specified;
-# if there are multiple JARs, separate the names with commas
-# jars = C:/mysql/mysql-connector-java-5.0.6-bin.jar
-jars =
-
-# the JDBC URL is optional for MySQL
-# url = jdbc:mysql://localhost:3306
diff --git a/jpa/tests/org.eclipse.jpt.db.tests/config/oracle10g.properties b/jpa/tests/org.eclipse.jpt.db.tests/config/oracle10g.properties
deleted file mode 100644
index 4b911b44e1..0000000000
--- a/jpa/tests/org.eclipse.jpt.db.tests/config/oracle10g.properties
+++ /dev/null
@@ -1,24 +0,0 @@
-################################################################################
-# Copyright (c) 2007, 2008 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.
-#
-# Contributors:
-# Oracle - initial API and implementation
-################################################################################
-
-# Configure the workspace- and database server-specific settings here.
-
-# user and password are optional, depending on the platform
-userID = scott
-password = tiger
-
-# the JDBC driver JAR(s) must be specified;
-# if there are multiple JARs, separate the names with commas
-# jars = C:/oracle/jdbc/lib/ojdbc5.jar
-jars =
-
-# the JDBC URL is required
-# url = jdbc:oracle:thin:@localhost:1521:testdb
-url =
diff --git a/jpa/tests/org.eclipse.jpt.db.tests/config/oracle10gXE.properties b/jpa/tests/org.eclipse.jpt.db.tests/config/oracle10gXE.properties
deleted file mode 100644
index e67c01a28e..0000000000
--- a/jpa/tests/org.eclipse.jpt.db.tests/config/oracle10gXE.properties
+++ /dev/null
@@ -1,24 +0,0 @@
-################################################################################
-# Copyright (c) 2007, 2008 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.
-#
-# Contributors:
-# Oracle - initial API and implementation
-################################################################################
-
-# Configure the workspace- and database server-specific settings here.
-
-# user and password are optional, depending on the platform
-userID = scott
-password = tiger
-
-# the JDBC driver JAR(s) must be specified;
-# if there are multiple JARs, separate the names with commas
-# jars = C:/oracle/jdbc/lib/ojdbc5.jar
-jars =
-
-# the JDBC URL is required
-# url = jdbc:oracle:thin:@localhost:1521:XE
-url =
diff --git a/jpa/tests/org.eclipse.jpt.db.tests/config/oracle9i.properties b/jpa/tests/org.eclipse.jpt.db.tests/config/oracle9i.properties
deleted file mode 100644
index 4b911b44e1..0000000000
--- a/jpa/tests/org.eclipse.jpt.db.tests/config/oracle9i.properties
+++ /dev/null
@@ -1,24 +0,0 @@
-################################################################################
-# Copyright (c) 2007, 2008 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.
-#
-# Contributors:
-# Oracle - initial API and implementation
-################################################################################
-
-# Configure the workspace- and database server-specific settings here.
-
-# user and password are optional, depending on the platform
-userID = scott
-password = tiger
-
-# the JDBC driver JAR(s) must be specified;
-# if there are multiple JARs, separate the names with commas
-# jars = C:/oracle/jdbc/lib/ojdbc5.jar
-jars =
-
-# the JDBC URL is required
-# url = jdbc:oracle:thin:@localhost:1521:testdb
-url =
diff --git a/jpa/tests/org.eclipse.jpt.db.tests/config/postgresql.properties b/jpa/tests/org.eclipse.jpt.db.tests/config/postgresql.properties
deleted file mode 100644
index 32fafe463b..0000000000
--- a/jpa/tests/org.eclipse.jpt.db.tests/config/postgresql.properties
+++ /dev/null
@@ -1,23 +0,0 @@
-################################################################################
-# Copyright (c) 2007, 2008 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.
-#
-# Contributors:
-# Oracle - initial API and implementation
-################################################################################
-
-# Configure the workspace- and database server-specific settings here.
-
-# user and password are optional, depending on the platform
-userID =
-password =
-
-# the JDBC driver JAR(s) must be specified;
-# if there are multiple JARs, separate the names with commas
-# jars = C:/postgresql/jdbc/postgresql-8.2-505.jdbc3.jar
-jars =
-
-# the JDBC URL is optional for PostgreSQL
-# url = jdbc:postgresql
diff --git a/jpa/tests/org.eclipse.jpt.db.tests/config/sqlserver.properties b/jpa/tests/org.eclipse.jpt.db.tests/config/sqlserver.properties
deleted file mode 100644
index f72b645c52..0000000000
--- a/jpa/tests/org.eclipse.jpt.db.tests/config/sqlserver.properties
+++ /dev/null
@@ -1,24 +0,0 @@
-################################################################################
-# Copyright (c) 2007, 2008 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.
-#
-# Contributors:
-# Oracle - initial API and implementation
-################################################################################
-
-# Configure the workspace- and database server-specific settings here.
-
-# user and password are optional, depending on the platform
-userID =
-password =
-
-# the JDBC driver JAR(s) must be specified;
-# if there are multiple JARs, separate the names with commas
-# jars = C:/sqlserver/lib/sqljdbc.jar
-jars =
-
-# the JDBC URL is required
-# url = jdbc:sqlserver://localhost:1433
-url =
diff --git a/jpa/tests/org.eclipse.jpt.db.tests/config/sybase.properties b/jpa/tests/org.eclipse.jpt.db.tests/config/sybase.properties
deleted file mode 100644
index 493d5d4ad9..0000000000
--- a/jpa/tests/org.eclipse.jpt.db.tests/config/sybase.properties
+++ /dev/null
@@ -1,24 +0,0 @@
-################################################################################
-# Copyright (c) 2007, 2008 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.
-#
-# Contributors:
-# Oracle - initial API and implementation
-################################################################################
-
-# Configure the workspace- and database server-specific settings here.
-
-# user and password are optional, depending on the platform
-userID =
-password =
-
-# the JDBC driver JAR(s) must be specified;
-# if there are multiple JARs, separate the names with commas
-# jars = C:/sybase/lib/jconn3.jar
-jars =
-
-# the JDBC URL is required
-# url = jdbc:sybase:Tds:localhost:5000
-url =
diff --git a/jpa/tests/org.eclipse.jpt.db.tests/plugin.properties b/jpa/tests/org.eclipse.jpt.db.tests/plugin.properties
deleted file mode 100644
index b04fe27976..0000000000
--- a/jpa/tests/org.eclipse.jpt.db.tests/plugin.properties
+++ /dev/null
@@ -1,25 +0,0 @@
-###############################################################################
-# Copyright (c) 2007 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
-#
-# Contributors:
-# Oracle - initial API and implementation
-###############################################################################
-# ====================================================================
-# To code developer:
-# Do NOT change the properties between this line and the
-# "%%% END OF TRANSLATED PROPERTIES %%%" line.
-# Make a new property name, append to the end of the file and change
-# the code to use the new property.
-# ====================================================================
-
-# ====================================================================
-# %%% END OF TRANSLATED PROPERTIES %%%
-# ====================================================================
-
-pluginName = JPA DB Tests
-providerName = Eclipse.org
-
diff --git a/jpa/tests/org.eclipse.jpt.db.tests/src/org/eclipse/jpt/db/tests/internal/JDBCTests.java b/jpa/tests/org.eclipse.jpt.db.tests/src/org/eclipse/jpt/db/tests/internal/JDBCTests.java
deleted file mode 100644
index ce05d768f8..0000000000
--- a/jpa/tests/org.eclipse.jpt.db.tests/src/org/eclipse/jpt/db/tests/internal/JDBCTests.java
+++ /dev/null
@@ -1,135 +0,0 @@
-/*******************************************************************************
- * Copyright (c) 2009 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.
- *
- * Contributors:
- * Oracle - initial API and implementation
- ******************************************************************************/
-package org.eclipse.jpt.db.tests.internal;
-
-import java.sql.Connection;
-import java.sql.DriverManager;
-
-import junit.framework.TestCase;
-
-/**
- * These aren't tests. They are just an easy way to dump JDBC metadata to the
- * console.
- */
-@SuppressWarnings("nls")
-public class JDBCTests extends TestCase {
-
- public JDBCTests(String name) {
- super(name);
- }
-
- public void testDerby() throws Exception {
- this.dumpMetaData(DERBY);
- }
-
- public void testMySQL() throws Exception {
- this.dumpMetaData(MYSQL);
- }
-
- public void testOracle() throws Exception {
- this.dumpMetaData(ORACLE);
- }
-
- public void testPostgreSQL() throws Exception {
- this.dumpMetaData(POSTGRESQL);
- }
-
- public void testSybase() throws Exception {
- this.dumpMetaData(SYBASE);
- }
-
- protected void dumpMetaData(ConnectionConfig config) throws Exception {
- System.out.println("***** PLATFORM: " + config.platformName + " *****");
- System.out.println();
- Class.forName(config.driverClassName);
- Connection connection = DriverManager.getConnection(this.buildURL(config), config.user, config.password);
- System.out.println("CATALOGS:");
- JDBCTools.dump(connection.getMetaData().getCatalogs());
- System.out.println();
- System.out.println("SCHEMATA:");
- JDBCTools.dump(connection.getMetaData().getSchemas());
- connection.close();
- System.out.println();
- }
-
- protected String buildURL(ConnectionConfig config) {
- return "jdbc:" + config.databaseURL;
- }
-
- protected static final ConnectionConfig DERBY =
- new ConnectionConfig(
- "Derby",
- "org.apache.derby.jdbc.EmbeddedDriver",
- "derby:C:/derby/data/test",
- null,
- null
- );
-
- protected static final ConnectionConfig MYSQL =
- new ConnectionConfig(
- "MySQL",
- "com.mysql.jdbc.Driver",
- "mysql://localhost:3306",
- "root",
- "oracle"
- );
-
- protected static final ConnectionConfig ORACLE =
- new ConnectionConfig(
- "Oracle",
- "oracle.jdbc.OracleDriver",
- "oracle:thin:@localhost:1521:orcl",
- "scott",
- "tiger"
- );
-
- protected static final ConnectionConfig POSTGRESQL =
- new ConnectionConfig(
- "PostgreSQL",
- "org.postgresql.Driver",
- "postgresql:postgres",
- "postgres",
- "oracle"
- );
-
- // the Sybase server must be configured explicitly to "localhost"
- // in the config file [SYBASE]/ini/sql.ini
- protected static final ConnectionConfig SYBASE =
- new ConnectionConfig(
- "Sybase",
- "com.sybase.jdbc3.jdbc.SybDriver",
- "sybase:Tds:localhost:5000",
- "sa",
- "oracle"
- );
-
- protected static class ConnectionConfig {
- protected final String platformName;
- protected final String driverClassName;
- protected final String databaseURL;
- protected final String user;
- protected final String password;
- protected ConnectionConfig(
- String platformName,
- String driverClassName,
- String databaseURL,
- String user,
- String password
- ) {
- super();
- this.platformName = platformName;
- this.driverClassName = driverClassName;
- this.databaseURL = databaseURL;
- this.user = user;
- this.password = password;
- }
- }
-
-}
diff --git a/jpa/tests/org.eclipse.jpt.db.tests/src/org/eclipse/jpt/db/tests/internal/JDBCTools.java b/jpa/tests/org.eclipse.jpt.db.tests/src/org/eclipse/jpt/db/tests/internal/JDBCTools.java
deleted file mode 100644
index 57c98feafb..0000000000
--- a/jpa/tests/org.eclipse.jpt.db.tests/src/org/eclipse/jpt/db/tests/internal/JDBCTools.java
+++ /dev/null
@@ -1,105 +0,0 @@
-/*******************************************************************************
- * Copyright (c) 2009 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.
- *
- * Contributors:
- * Oracle - initial API and implementation
- ******************************************************************************/
-package org.eclipse.jpt.db.tests.internal;
-
-import java.io.OutputStreamWriter;
-import java.io.PrintWriter;
-import java.sql.Connection;
-import java.sql.ResultSet;
-import java.sql.SQLException;
-import java.sql.Statement;
-import java.util.ArrayList;
-import java.util.HashMap;
-import java.util.Iterator;
-import java.util.Map;
-
-import org.eclipse.jpt.utility.internal.iterators.ResultSetIterator;
-
-@SuppressWarnings("nls")
-public class JDBCTools {
-
- public static void dump(Connection connection, String sql) throws SQLException {
- dump(execute(connection, sql));
- }
-
- public static void dump(ResultSet resultSet) throws SQLException {
- PrintWriter pw = new PrintWriter(new OutputStreamWriter(System.out));
- // synchronize the console so everything is contiguous
- synchronized (System.out) {
- dumpOn(resultSet, pw);
- }
- pw.flush();
- }
-
- public static void dumpOn(ResultSet resultSet, PrintWriter pw) throws SQLException {
- ArrayList<HashMap<String, Object>> maps = convertToMaps(resultSet);
- for (Iterator<HashMap<String, Object>> mapStream = maps.iterator(); mapStream.hasNext(); ) {
- for (Iterator<Map.Entry<String, Object>> entryStream = mapStream.next().entrySet().iterator(); entryStream.hasNext(); ) {
- Map.Entry<String, Object> entry = entryStream.next();
- pw.print(entry.getKey());
- pw.print(" = ");
- pw.print(entry.getValue());
- pw.println();
- }
- if (mapStream.hasNext()) {
- pw.println();
- }
- }
- pw.println("total rows: " + maps.size());
- }
-
- public static ArrayList<HashMap<String, Object>> convertToMaps(Connection connection, String sql) throws SQLException {
- return convertToMaps(execute(connection, sql));
- }
-
- public static ResultSet execute(Connection connection, String sql) throws SQLException {
- Statement statement = connection.createStatement();
- statement.execute(sql);
- ResultSet resultSet = statement.getResultSet();
- statement.close();
- return resultSet;
- }
-
- public static ArrayList<HashMap<String, Object>> convertToMaps(ResultSet resultSet) throws SQLException {
- ArrayList<HashMap<String, Object>> rows = new ArrayList<HashMap<String, Object>>();
- for (Iterator<HashMap<String, Object>> stream = buildMapIterator(resultSet); stream.hasNext(); ) {
- rows.add(stream.next());
- }
- return rows;
- }
-
- public static Iterator<HashMap<String, Object>> buildMapIterator(ResultSet resultSet) throws SQLException {
- return new ResultSetIterator<HashMap<String, Object>>(resultSet, new MapResultSetIteratorAdapter(buildColumnNames(resultSet)));
- }
-
- public static String[] buildColumnNames(ResultSet resultSet) throws SQLException {
- String[] names = new String[resultSet.getMetaData().getColumnCount()];
- for (int i = 0; i < names.length; i++) {
- names[i] = resultSet.getMetaData().getColumnName(i + 1); // NB: ResultSet index/subscript is 1-based
- }
- return names;
- }
-
- public static class MapResultSetIteratorAdapter implements ResultSetIterator.Adapter<HashMap<String, Object>> {
- private final String[] columnNames;
- public MapResultSetIteratorAdapter(String[] columnNames) {
- super();
- this.columnNames = columnNames;
- }
- public HashMap<String, Object> buildNext(ResultSet rs) throws SQLException {
- HashMap<String, Object> map = new HashMap<String, Object>(this.columnNames.length);
- for (int i = 0; i < this.columnNames.length; i++) {
- map.put(this.columnNames[i], rs.getObject(i + 1)); // NB: ResultSet index/subscript is 1-based
- }
- return map;
- }
- }
-
-}
diff --git a/jpa/tests/org.eclipse.jpt.db.tests/src/org/eclipse/jpt/db/tests/internal/JptDbTests.java b/jpa/tests/org.eclipse.jpt.db.tests/src/org/eclipse/jpt/db/tests/internal/JptDbTests.java
deleted file mode 100644
index ea34d083f6..0000000000
--- a/jpa/tests/org.eclipse.jpt.db.tests/src/org/eclipse/jpt/db/tests/internal/JptDbTests.java
+++ /dev/null
@@ -1,34 +0,0 @@
-/*******************************************************************************
- * Copyright (c) 2006, 2008 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.
- *
- * Contributors:
- * Oracle - initial API and implementation
- ******************************************************************************/
-package org.eclipse.jpt.db.tests.internal;
-
-import junit.framework.Test;
-import junit.framework.TestSuite;
-import org.eclipse.jpt.db.tests.internal.platforms.AllPlatformTests;
-
-/**
- * JPT DB Tests
- */
-public class JptDbTests {
-
- public static Test suite() {
- TestSuite suite = new TestSuite(JptDbTests.class.getPackage().getName());
-
- suite.addTest( AllPlatformTests.suite());
-
- return suite;
- }
-
- private JptDbTests() {
- super();
- throw new UnsupportedOperationException();
- }
-
-}
diff --git a/jpa/tests/org.eclipse.jpt.db.tests/src/org/eclipse/jpt/db/tests/internal/JptDbTestsPlugin.java b/jpa/tests/org.eclipse.jpt.db.tests/src/org/eclipse/jpt/db/tests/internal/JptDbTestsPlugin.java
deleted file mode 100644
index 6d517b5635..0000000000
--- a/jpa/tests/org.eclipse.jpt.db.tests/src/org/eclipse/jpt/db/tests/internal/JptDbTestsPlugin.java
+++ /dev/null
@@ -1,56 +0,0 @@
-/*******************************************************************************
- * Copyright (c) 2006, 2009 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.
- *
- * Contributors:
- * Oracle - initial API and implementation
- ******************************************************************************/
-package org.eclipse.jpt.db.tests.internal;
-
-import org.eclipse.core.runtime.Plugin;
-import org.osgi.framework.BundleContext;
-
-/**
- * JptDbTestsPlugin
- */
-public class JptDbTestsPlugin extends Plugin {
-
- // The shared instance
- private static JptDbTestsPlugin INSTANCE;
-
- public static final String BUNDLE_ID = "org.eclipse.jpt.db.tests"; //$NON-NLS-1$
-
- /**
- * Returns the shared instance
- */
- public static JptDbTestsPlugin instance() {
- return INSTANCE;
- }
-
- /**
- * The constructor
- */
- public JptDbTestsPlugin() {
- super();
- INSTANCE = this;
- }
-
- /**
- * This method is called upon plug-in activation
- */
- @Override
- public void start(BundleContext context) throws Exception {
- super.start(context);
- }
-
- /**
- * This method is called when the plug-in is stopped
- */
- @Override
- public void stop(BundleContext context) throws Exception {
- INSTANCE = null;
- super.stop(context);
- }
-}
diff --git a/jpa/tests/org.eclipse.jpt.db.tests/src/org/eclipse/jpt/db/tests/internal/platforms/AllPlatformTests.java b/jpa/tests/org.eclipse.jpt.db.tests/src/org/eclipse/jpt/db/tests/internal/platforms/AllPlatformTests.java
deleted file mode 100644
index 22ece7e151..0000000000
--- a/jpa/tests/org.eclipse.jpt.db.tests/src/org/eclipse/jpt/db/tests/internal/platforms/AllPlatformTests.java
+++ /dev/null
@@ -1,37 +0,0 @@
-/*******************************************************************************
- * Copyright (c) 2006, 2008 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.
- *
- * Contributors:
- * Oracle - initial API and implementation
- ******************************************************************************/
-package org.eclipse.jpt.db.tests.internal.platforms;
-
-import junit.framework.Test;
-import junit.framework.TestSuite;
-
-public class AllPlatformTests {
-
- public static Test suite() {
- TestSuite suite = new TestSuite(AllPlatformTests.class.getPackage().getName());
-
- suite.addTestSuite(DerbyTests.class);
- suite.addTestSuite(MySQLTests.class);
- suite.addTestSuite(Oracle10gTests.class);
-// suite.addTestSuite(Oracle10gXETests.class);
-// suite.addTestSuite(Oracle9iTests.class);
- suite.addTestSuite(PostgreSQLTests.class);
-// suite.addTestSuite(SQLServerTests.class);
- suite.addTestSuite(SybaseTests.class);
-
- return suite;
- }
-
- private AllPlatformTests() {
- super();
- throw new UnsupportedOperationException();
- }
-
-}
diff --git a/jpa/tests/org.eclipse.jpt.db.tests/src/org/eclipse/jpt/db/tests/internal/platforms/DTPPlatformTests.java b/jpa/tests/org.eclipse.jpt.db.tests/src/org/eclipse/jpt/db/tests/internal/platforms/DTPPlatformTests.java
deleted file mode 100644
index 7080bdb8b8..0000000000
--- a/jpa/tests/org.eclipse.jpt.db.tests/src/org/eclipse/jpt/db/tests/internal/platforms/DTPPlatformTests.java
+++ /dev/null
@@ -1,1020 +0,0 @@
-/*******************************************************************************
- * Copyright (c) 2006, 2009 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.
- *
- * Contributors:
- * Oracle - initial API and implementation
- ******************************************************************************/
-package org.eclipse.jpt.db.tests.internal.platforms;
-
-import java.io.File;
-import java.io.IOException;
-import java.io.OutputStreamWriter;
-import java.net.URL;
-import java.sql.Connection;
-import java.sql.DatabaseMetaData;
-import java.sql.ResultSet;
-import java.sql.SQLException;
-import java.sql.Statement;
-import java.util.ArrayList;
-import java.util.Iterator;
-import java.util.List;
-import java.util.Properties;
-
-import junit.framework.TestCase;
-
-import org.eclipse.core.runtime.CoreException;
-import org.eclipse.core.runtime.IPath;
-import org.eclipse.core.runtime.IStatus;
-import org.eclipse.core.runtime.Platform;
-import org.eclipse.datatools.connectivity.ConnectionProfileException;
-import org.eclipse.datatools.connectivity.IConnectionProfile;
-import org.eclipse.datatools.connectivity.IManagedConnection;
-import org.eclipse.datatools.connectivity.ProfileManager;
-import org.eclipse.datatools.connectivity.drivers.IDriverMgmtConstants;
-import org.eclipse.datatools.connectivity.drivers.IPropertySet;
-import org.eclipse.datatools.connectivity.drivers.PropertySetImpl;
-import org.eclipse.datatools.connectivity.drivers.XMLFileManager;
-import org.eclipse.datatools.connectivity.drivers.jdbc.IJDBCDriverDefinitionConstants;
-import org.eclipse.datatools.connectivity.internal.ConnectivityPlugin;
-import org.eclipse.datatools.connectivity.sqm.core.connection.ConnectionInfo;
-import org.eclipse.datatools.connectivity.sqm.core.rte.ICatalogObject;
-import org.eclipse.jpt.db.Catalog;
-import org.eclipse.jpt.db.Column;
-import org.eclipse.jpt.db.ConnectionListener;
-import org.eclipse.jpt.db.ConnectionProfile;
-import org.eclipse.jpt.db.ConnectionProfileFactory;
-import org.eclipse.jpt.db.ConnectionProfileListener;
-import org.eclipse.jpt.db.Database;
-import org.eclipse.jpt.db.DatabaseFinder;
-import org.eclipse.jpt.db.ForeignKey;
-import org.eclipse.jpt.db.JptDbPlugin;
-import org.eclipse.jpt.db.Schema;
-import org.eclipse.jpt.db.SchemaContainer;
-import org.eclipse.jpt.db.Sequence;
-import org.eclipse.jpt.db.Table;
-import org.eclipse.jpt.db.ForeignKey.ColumnPair;
-import org.eclipse.jpt.db.tests.internal.JptDbTestsPlugin;
-import org.eclipse.jpt.utility.internal.ClassTools;
-import org.eclipse.jpt.utility.internal.IndentingPrintWriter;
-import org.eclipse.jpt.utility.internal.StringTools;
-import org.eclipse.jpt.utility.internal.iterators.ResultSetIterator;
-
-/**
- * Base class for testing DTP wrappers on various databases.
- */
-@SuppressWarnings("nls")
-public abstract class DTPPlatformTests extends TestCase {
-
- /**
- * The platform properties are loaded from a Java properties file in the
- * 'org.eclipse.jpt.db.tests/config' directory. Each database platform has
- * its own properties file (e.g. 'derby.properties').
- */
- private Properties platformProperties;
-
- /**
- * This is the Dali connection profile wrapper.
- */
- protected ConnectionProfile connectionProfile;
-
-
- // ********** constants **********
-
- private static final String PLATFORM_CONFIG_DIRECTORY = "config";
-
- private static final String DB_USER_ID_PROPERTY = "userID";
- private static final String DB_USER_ID_DEFAULT = "user";
-
- private static final String DB_PASSWORD_PROPERTY = "password";
- private static final String DB_PASSWORD_DEFAULT = "";
-
- private static final String DB_DRIVER_JARS_PROPERTY = "jars";
- // required - no default
-
- private static final String DB_URL_PROPERTY = "url";
- // required - no default
-
-
-
- // ********** constructor **********
-
- protected DTPPlatformTests(String name) {
- super(name);
- }
-
-
- // ********** set-up/tear-down **********
-
- @Override
- protected void setUp() throws Exception {
- super.setUp();
-
- this.platformProperties = this.loadPlatformProperties();
- this.buildDTPDriverDefinitionFile();
- this.buildDTPConnectionProfile();
- this.connectionProfile = this.getConnectionProfileFactory().buildConnectionProfile(this.getProfileName(), DatabaseFinder.Default.instance());
- }
-
- @Override
- protected void tearDown() throws Exception {
- this.connectionProfile = null;
- this.platformProperties = null;
-
- super.tearDown();
- }
-
- // ***** platform properties file
- private Properties loadPlatformProperties() throws IOException {
- Properties p = new Properties();
- p.load(this.buildPlatformPropertiesFileURL().openStream());
- return p;
- }
-
- private URL buildPlatformPropertiesFileURL() {
- return Platform.getBundle(this.getTestPluginBundleID()).getEntry(this.getPlatformPropertiesFilePath());
- }
-
- private String getTestPluginBundleID() {
- return JptDbTestsPlugin.BUNDLE_ID;
- }
-
- private String getPlatformPropertiesFilePath() {
- return this.getPlatformPropertiesDirectoryName() + '/' + this.getPlatformPropertiesFileName();
- }
-
- private String getPlatformPropertiesDirectoryName() {
- return PLATFORM_CONFIG_DIRECTORY;
- }
-
- /**
- * Each database platform has a separate properties file in the 'config'
- * directory that must be customized by whomever is executing the tests.
- */
- protected abstract String getPlatformPropertiesFileName();
-
- // ***** driver definition file
- private void buildDTPDriverDefinitionFile() throws CoreException {
- XMLFileManager.setStorageLocation(this.getDTPDriverDefinitionLocation());
- XMLFileManager.setFileName(this.getDTPDriverFileName());
-
- IPropertySet[] sets = XMLFileManager.loadPropertySets();
- for (IPropertySet set : sets) {
- if (set.getID().equals(this.getDriverDefinitionID())) {
- return; // property sets live across tests
- }
- }
-
- XMLFileManager.saveNamedPropertySet(this.buildDTPDriverDefinitionPropertySets());
-
- // verify the file was created:
- File driverDefinitioneFile = this.getDTPDriverDefinitionLocation().append(this.getDTPDriverFileName()).toFile();
- assertTrue(driverDefinitioneFile.exists());
- }
-
- private IPath getDTPDriverDefinitionLocation() {
- return ConnectivityPlugin.getDefault().getStateLocation();
- }
-
- private String getDTPDriverFileName() {
- return IDriverMgmtConstants.DRIVER_FILE;
- }
-
- private IPropertySet[] buildDTPDriverDefinitionPropertySets() {
- IPropertySet[] propertySets = new IPropertySet[1];
- PropertySetImpl propertySet = new PropertySetImpl(this.getDriverName(), this.getDriverDefinitionID());
- propertySet.setProperties(this.getDriverDefinitionID(), this.buildDTPDriverDefinitionProperties());
- propertySets[0] = propertySet;
- return propertySets;
- }
-
- protected abstract String getDriverName();
-
- protected abstract String getDriverDefinitionID();
-
- private Properties buildDTPDriverDefinitionProperties() {
- Properties p = new Properties();
- p.setProperty(ConnectionProfile.DRIVER_DEFINITION_TYPE_PROP_ID, this.getDriverDefinitionType());
- p.setProperty(ConnectionProfile.DRIVER_JAR_LIST_PROP_ID, this.getJDBCDriverJarList());
- p.setProperty(IJDBCDriverDefinitionConstants.DATABASE_VENDOR_PROP_ID, this.getDatabaseVendor());
- p.setProperty(IJDBCDriverDefinitionConstants.DATABASE_VERSION_PROP_ID, this.getDatabaseVersion());
- p.setProperty(IJDBCDriverDefinitionConstants.DRIVER_CLASS_PROP_ID, this.getDriverClass());
- p.setProperty(IJDBCDriverDefinitionConstants.URL_PROP_ID, this.getJDBCURL());
- p.setProperty(IJDBCDriverDefinitionConstants.USERNAME_PROP_ID, this.getUserID());
- p.setProperty(IJDBCDriverDefinitionConstants.PASSWORD_PROP_ID, this.getPassword());
- return p;
- }
-
- protected abstract String getDriverDefinitionType();
-
- /**
- * The JAR list is workspace-specific and is set in the properties file.
- */
- private String getJDBCDriverJarList() {
- return this.getRequiredPlatformProperty(DB_DRIVER_JARS_PROPERTY);
- }
-
- protected abstract String getDatabaseVendor();
-
- protected abstract String getDatabaseVersion();
-
- protected abstract String getDriverClass();
-
- /**
- * The database URL is workspace-specific and is set in the properties file
- * for some databases.
- */
- private String getJDBCURL() {
- return this.platformProperties.getProperty(DB_URL_PROPERTY, this.getDefaultJDBCURL());
- }
-
- protected String getDefaultJDBCURL() {
- return "";
- }
-
- /**
- * The user ID is optional and can be set in the properties file.
- */
- protected String getUserID() {
- return this.platformProperties.getProperty(DB_USER_ID_PROPERTY, DB_USER_ID_DEFAULT);
- }
-
- /**
- * The password is optional and can be set in the properties file.
- */
- private String getPassword() {
- return this.platformProperties.getProperty(DB_PASSWORD_PROPERTY, DB_PASSWORD_DEFAULT);
- }
-
- // ***** DTP connection profile
- private void buildDTPConnectionProfile() throws ConnectionProfileException {
- if (this.getDTPProfileManager().getProfileByName(this.getProfileName()) != null) {
- return; // profiles live across tests
- }
- this.createProfile(this.getProfileName());
- assertNotNull(this.getDTPProfileManager().getProfileByName(this.getProfileName()));
- }
-
- protected void createProfile(String profileName) throws ConnectionProfileException {
- this.getDTPProfileManager().createProfile(
- profileName,
- this.getProfileDescription(),
- this.getProviderID(),
- this.buildDTPConnectionProfileProperties()
- );
- }
-
- protected abstract String getProfileName();
-
- protected abstract String getProfileDescription();
-
- protected String getProviderID() {
- return ConnectionProfile.CONNECTION_PROFILE_TYPE;
- }
-
- protected Properties buildDTPConnectionProfileProperties() {
- Properties p = new Properties();
- p.setProperty(IJDBCDriverDefinitionConstants.USERNAME_PROP_ID, this.getUserID());
- p.setProperty(IJDBCDriverDefinitionConstants.PASSWORD_PROP_ID, this.getPassword());
- p.setProperty(ConnectionProfile.DRIVER_DEFINITION_PROP_ID, this.getDriverDefinitionID());
-
- p.setProperty(IJDBCDriverDefinitionConstants.DRIVER_CLASS_PROP_ID, this.getDriverClass());
- p.setProperty(IJDBCDriverDefinitionConstants.URL_PROP_ID, this.getJDBCURL());
- p.setProperty(IJDBCDriverDefinitionConstants.DATABASE_VENDOR_PROP_ID, this.getDatabaseVendor());
- p.setProperty(IJDBCDriverDefinitionConstants.DATABASE_VERSION_PROP_ID, this.getDatabaseVersion());
-
- p.setProperty(ConnectionProfile.DATABASE_SAVE_PWD_PROP_ID, this.passwordIsSaved());
- return p;
- }
-
- private String passwordIsSaved() {
- return "true";
- }
-
-
- // ********** tests **********
-
- public void testConnectionProfileListener() throws ConnectionProfileException {
- TestConnectionProfileListener listener = new TestConnectionProfileListener();
- this.getConnectionProfileFactory().addConnectionProfileListener(listener);
-
- String cpName1 = this.getProfileName() + "1";
- this.createProfile(cpName1);
- IConnectionProfile dtpCP = this.getDTPProfileManager().getProfileByName(cpName1);
- assertNotNull(dtpCP);
-
- assertEquals(cpName1, listener.addedName);
- listener.clear();
-
- String cpName2 = this.getProfileName() + "2";
- this.getDTPProfileManager().modifyProfile(dtpCP, cpName2, null);
- assertEquals(cpName1, listener.renamedOldName);
- assertEquals(cpName2, listener.renamedNewName);
- listener.clear();
-
- ConnectionProfile cp = this.getConnectionProfileFactory().buildConnectionProfile(cpName2);
- assertNotNull(cp);
-
- this.getDTPProfileManager().deleteProfile(dtpCP);
- assertEquals(cpName2, listener.removedName);
- listener.clear();
-
- cp = this.getConnectionProfileFactory().buildConnectionProfile(cpName2);
- assertNull(cp);
-
- this.getConnectionProfileFactory().removeConnectionProfileListener(listener);
- }
-
- public void testName() {
- assertEquals(this.getProfileName(), this.connectionProfile.getName());
- }
-
- public void testConnection() throws Exception {
- assertTrue(this.connectionProfile.isInactive());
- assertTrue(this.connectionProfile.isDisconnected());
- this.connectionProfile.connect();
- assertTrue(this.connectionProfile.isActive());
- assertTrue(this.connectionProfile.isConnected());
-
- this.verifyDatabaseVersionNumber();
- this.verifyDatabaseVendor();
- this.verifyDatabaseContent();
-
- this.connectionProfile.disconnect();
- assertTrue(this.connectionProfile.isInactive());
- assertTrue(this.connectionProfile.isDisconnected());
- }
-
- private void verifyDatabaseVersionNumber() {
- Database database = this.connectionProfile.getDatabase();
- assertNotNull(database);
-
- String actual = database.getVersion();
- String expected = this.getDatabaseVersion();
- String errorMessage = "expected: " + expected + " - actual: " + actual;
- // partial match is good enough
- assertTrue(errorMessage, actual.indexOf(expected) != -1);
- }
-
- private void verifyDatabaseVendor() {
- Database database = this.connectionProfile.getDatabase();
- String actual = database.getVendorName();
- String expected = this.getDatabaseVendor();
- assertEquals(expected, actual);
- }
-
- private void verifyDatabaseContent() {
- Database database = this.connectionProfile.getDatabase();
- assertTrue(database.schemataSize() >= 0);
-
- Schema schema = database.getDefaultSchema();
- if (schema != null) {
- if (schema.tablesSize() > 0) {
- Table table = schema.tables().next();
- assertTrue(table.columnsSize() >= 0);
- assertTrue(table.primaryKeyColumnsSize() >= 0);
- assertTrue(table.foreignKeysSize() >= 0);
- }
- }
- }
-
- protected abstract boolean executeOfflineTests();
-
- public final void testOffline() {
- if ( ! this.executeOfflineTests()) {
- return;
- }
- if ( ! this.connectionProfile.supportsWorkOfflineMode()) {
- return;
- }
-
- this.prepareForOfflineWork();
-
- IStatus status = this.connectionProfile.workOffline();
- assertTrue(status.isOK());
- assertTrue(this.connectionProfile.isActive());
- assertTrue(this.connectionProfile.isWorkingOffline());
-
- this.connectionProfile.disconnect();
- assertTrue(this.connectionProfile.isInactive());
- assertTrue(this.connectionProfile.isDisconnected());
- }
-
- protected void prepareForOfflineWork() {
- if ( ! this.connectionProfile.canWorkOffline()) {
- this.connectionProfile.connect();
- IStatus status = this.connectionProfile.saveWorkOfflineData();
- assertTrue(status.isOK());
- this.connectionProfile.disconnect();
- assertTrue(this.connectionProfile.canWorkOffline());
- }
- }
-
- public void testConnectionListenerConnect() {
- assertTrue(this.connectionProfileHasNoListeners());
- TestConnectionListener listener = new TestConnectionListener();
- this.connectionProfile.addConnectionListener(listener);
- assertTrue(this.connectionProfileHasAnyListeners());
-
- this.connectionProfile.connect();
- assertSame(this.connectionProfile, listener.openedProfile);
- listener.clear();
-
- this.connectionProfile.disconnect();
- assertSame(this.connectionProfile, listener.okToCloseProfile);
- assertSame(this.connectionProfile, listener.aboutToCloseProfile);
- assertSame(this.connectionProfile, listener.closedProfile);
-
- this.connectionProfile.removeConnectionListener(listener);
- assertTrue(this.connectionProfileHasNoListeners());
- }
-
- public final void testConnectionListenerOffline() {
- if ( ! this.executeOfflineTests()) {
- return;
- }
- TestConnectionListener listener = new TestConnectionListener();
- this.connectionProfile.addConnectionListener(listener);
-
- this.prepareForOfflineWork();
- listener.clear();
-
- this.connectionProfile.workOffline();
- assertSame(this.connectionProfile, listener.openedProfile);
- listener.clear();
-
- this.connectionProfile.disconnect();
- assertSame(this.connectionProfile, listener.okToCloseProfile);
- assertSame(this.connectionProfile, listener.aboutToCloseProfile);
- assertSame(this.connectionProfile, listener.closedProfile);
- listener.clear();
-
- this.connectionProfile.removeConnectionListener(listener);
- }
-
- public void testConnectionListenerDatabase() {
- this.connectionProfile.connect();
- TestConnectionListener listener = new TestConnectionListener();
- this.connectionProfile.addConnectionListener(listener);
-
- ((ICatalogObject) this.getDTPDatabase()).refresh();
- assertSame(this.connectionProfile.getDatabase(), listener.changedDatabase);
-
- this.connectionProfile.removeConnectionListener(listener);
- this.connectionProfile.disconnect();
- }
-
- public void testConnectionListenerCatalog() {
- this.connectionProfile.connect();
- if ( ! this.connectionProfile.getDatabase().supportsCatalogs()) {
- this.connectionProfile.disconnect();
- return;
- }
-
- TestConnectionListener listener = new TestConnectionListener();
- this.connectionProfile.addConnectionListener(listener);
-
- // take the first catalog
- org.eclipse.datatools.modelbase.sql.schema.Catalog dtpCatalog = this.getFirstDTPCatalog();
- Catalog catalog = this.getCatalogNamed(dtpCatalog.getName());
- ((ICatalogObject) dtpCatalog).refresh();
- assertSame(catalog, listener.changedCatalog);
-
- this.connectionProfile.removeConnectionListener(listener);
- this.connectionProfile.disconnect();
- }
-
- public void testConnectionListenerSchema() {
- this.connectionProfile.connect();
- TestConnectionListener listener = new TestConnectionListener();
- this.connectionProfile.addConnectionListener(listener);
-
- List<org.eclipse.datatools.modelbase.sql.schema.Catalog> dtpCatalogs = this.getDTPCatalogs();
- org.eclipse.datatools.modelbase.sql.schema.Catalog dtpCatalog = null;
- org.eclipse.datatools.modelbase.sql.schema.Schema dtpSchema = null;
- Schema schema = null;
- if (this.connectionProfile.getDatabase().supportsCatalogs()) {
- dtpCatalog = dtpCatalogs.get(0);
- dtpSchema = (org.eclipse.datatools.modelbase.sql.schema.Schema) dtpCatalog.getSchemas().get(0);
- schema = this.getCatalogNamed(dtpCatalog.getName()).getSchemaNamed(dtpSchema.getName());
- } else {
- if (dtpCatalogs.isEmpty()) {
- dtpSchema = (org.eclipse.datatools.modelbase.sql.schema.Schema) this.getDTPDatabase().getSchemas().get(0);
- schema = this.connectionProfile.getDatabase().getSchemaNamed(dtpSchema.getName());
- } else {
- dtpCatalog = dtpCatalogs.get(0); // should be the "virtual" catalog
- assertEquals("", dtpCatalog.getName());
- dtpSchema = (org.eclipse.datatools.modelbase.sql.schema.Schema) dtpCatalog.getSchemas().get(0);
- // the schemata are held directly by the database in this situation
- schema = this.getDatabase().getSchemaNamed(dtpSchema.getName());
- }
- }
- assertTrue(schema.tablesSize() >= 0); // force tables to be loaded
- ((ICatalogObject) dtpSchema).refresh();
- assertSame(schema, listener.changedSchema);
-
- this.connectionProfile.removeConnectionListener(listener);
- this.connectionProfile.disconnect();
- }
-
- public void testSupportsCatalogs() {
- this.connectionProfile.connect();
- TestConnectionListener listener = new TestConnectionListener();
- this.connectionProfile.addConnectionListener(listener);
-
- boolean supportsCatalogs = this.supportsCatalogs();
- assertEquals(supportsCatalogs, this.connectionProfile.getDatabase().supportsCatalogs());
- if (supportsCatalogs) {
- assertTrue(this.connectionProfile.getDatabase().catalogsSize() > 0);
- assertEquals(0, this.connectionProfile.getDatabase().schemataSize());
- } else {
- assertEquals(0, this.connectionProfile.getDatabase().catalogsSize());
- assertTrue(this.connectionProfile.getDatabase().schemataSize() > 0);
- }
-
- this.connectionProfile.removeConnectionListener(listener);
- this.connectionProfile.disconnect();
- }
-
- protected abstract boolean supportsCatalogs();
-
-// public void testDEBUG() throws Exception {
-// this.connectionProfile.connect();
-// this.dumpJDBCCatalogs();
-// this.dumpJDBCSchemata();
-// this.dumpDatabaseContainers();
-// this.connectionProfile.disconnect();
-// }
-
-
- // ********** convenience methods **********
-
- protected ConnectionProfileFactory getConnectionProfileFactory() {
- return JptDbPlugin.instance().getConnectionProfileFactory();
- }
-
- protected ConnectionProfile getConnectionProfile() {
- return this.connectionProfile;
- }
-
- protected Database getDatabase() {
- return this.connectionProfile.getDatabase();
- }
-
- protected Catalog getDefaultCatalog() {
- return this.getDatabase().getDefaultCatalog();
- }
-
- protected Catalog getCatalogNamed(String catalogName) {
- return this.connectionProfile.getDatabase().getCatalogNamed(catalogName);
- }
-
- protected String getRequiredPlatformProperty(String propertyKey) {
- String propertyValue = this.platformProperties.getProperty(propertyKey);
- if (StringTools.stringIsEmpty(propertyValue)) {
- throw new IllegalArgumentException("The database platform properties file '" + this.getPlatformPropertiesFilePath()
- + "' is missing a value for the property '" + propertyKey + "'.");
- }
- return propertyValue;
- }
-
- protected boolean connectionProfileHasAnyListeners() {
- return connectionProfileHasAnyListeners(this.connectionProfile);
- }
-
- protected static boolean connectionProfileHasAnyListeners(ConnectionProfile cp) {
- return ((Boolean) ClassTools.executeMethod(cp, "hasAnyListeners")).booleanValue();
- }
-
- protected boolean connectionProfileHasNoListeners() {
- return connectionProfileHasNoListeners(this.connectionProfile);
- }
-
- protected static boolean connectionProfileHasNoListeners(ConnectionProfile cp) {
- return ((Boolean) ClassTools.executeMethod(cp, "hasNoListeners")).booleanValue();
- }
-
-
- // ********** DTP model **********
-
- protected ProfileManager getDTPProfileManager() {
- return ProfileManager.getInstance();
- }
-
- protected IConnectionProfile getDTPConnectionProfile() {
- return getDTPConnectionProfile(this.connectionProfile);
- }
-
- protected static IConnectionProfile getDTPConnectionProfile(ConnectionProfile cp) {
- return (IConnectionProfile) ClassTools.fieldValue(cp, "dtpConnectionProfile");
- }
-
- protected IManagedConnection getDTPManagedConnection() {
- return (IManagedConnection) ClassTools.fieldValue(this.connectionProfile, "dtpManagedConnection");
- }
-
- protected org.eclipse.datatools.modelbase.sql.schema.Database getDTPDatabase() {
- return getDTPDatabase(this.connectionProfile.getDatabase());
- }
-
- protected static org.eclipse.datatools.modelbase.sql.schema.Database getDTPDatabase(Database database) {
- return (org.eclipse.datatools.modelbase.sql.schema.Database) ClassTools.fieldValue(database, "dtpDatabase");
- }
-
- @SuppressWarnings("unchecked")
- protected List<org.eclipse.datatools.modelbase.sql.schema.Catalog> getDTPCatalogs() {
- return this.getDTPDatabase().getCatalogs();
- }
-
- protected org.eclipse.datatools.modelbase.sql.schema.Catalog getFirstDTPCatalog() {
- return this.getDTPCatalogs().get(0);
- }
-
- protected org.eclipse.datatools.modelbase.sql.schema.Catalog getDTPCatalogNamed(String name) {
- return getDTPCatalog(this.getDatabase().getCatalogNamed(name));
- }
-
- protected static org.eclipse.datatools.modelbase.sql.schema.Catalog getDTPCatalog(Catalog catalog) {
- return (org.eclipse.datatools.modelbase.sql.schema.Catalog) ClassTools.fieldValue(catalog, "dtpCatalog");
- }
-
- protected org.eclipse.datatools.modelbase.sql.schema.Schema getDTPSchemaNamed(String name) {
- return getDTPSchema(this.getDatabase().getSchemaNamed(name));
- }
-
- protected static org.eclipse.datatools.modelbase.sql.schema.Schema getDTPSchema(Schema schema) {
- return (org.eclipse.datatools.modelbase.sql.schema.Schema) ClassTools.fieldValue(schema, "dtpSchema");
- }
-
-
- // ********** execute SQL **********
-
- /**
- * ignore any errors (useful for dropping database objects that might
- * not be there)
- */
- protected void executeUpdateIgnoreErrors(String sql) {
- try {
- this.executeUpdate(sql);
- } catch (Exception ex) {
-// System.err.println("SQL: " + sql);
-// ex.printStackTrace();
- }
- }
-
- protected void executeUpdate(String sql) throws SQLException {
- Statement jdbcStatement = this.createJDBCStatement();
- try {
- jdbcStatement.executeUpdate(sql);
- } finally {
- jdbcStatement.close();
- }
- }
-
- protected void dump(String sql) throws SQLException {
- this.dump(sql, 20);
- }
-
- protected void dump(String sql, int columnWidth) throws SQLException {
- IndentingPrintWriter pw = new IndentingPrintWriter(new OutputStreamWriter(System.out));
- // synchronize the console so everything is contiguous
- synchronized (System.out) {
- this.dumpOn(sql, pw, columnWidth);
- }
- pw.flush();
- }
-
- protected void dumpOn(String sql, IndentingPrintWriter pw, int columnWidth) throws SQLException {
- pw.println(sql);
- for (ArrayList<Object> row : this.execute(sql)) {
- for (Object columnValue : row) {
- StringTools.padOrTruncateOn(String.valueOf(columnValue), columnWidth, pw);
- pw.print(' ');
- }
- pw.println();
- }
- }
-
- protected ArrayList<ArrayList<Object>> execute(String sql) throws SQLException {
- Statement jdbcStatement = this.createJDBCStatement();
- jdbcStatement.execute(sql);
- ArrayList<ArrayList<Object>> rows = this.buildRows(jdbcStatement.getResultSet());
- jdbcStatement.close();
- return rows;
- }
-
- protected ArrayList<ArrayList<Object>> buildRows(ResultSet resultSet) throws SQLException {
- ArrayList<ArrayList<Object>> rows = new ArrayList<ArrayList<Object>>();
- for (Iterator<ArrayList<Object>> stream = this.buildArrayIterator(resultSet); stream.hasNext(); ) {
- rows.add(stream.next());
- }
- return rows;
- }
-
- protected Iterator<ArrayList<Object>> buildArrayIterator(ResultSet resultSet) throws SQLException {
- return new ResultSetIterator<ArrayList<Object>>(resultSet, new ListResultSetIteratorAdapter(resultSet.getMetaData().getColumnCount()));
- }
-
- public static class ListResultSetIteratorAdapter implements ResultSetIterator.Adapter<ArrayList<Object>> {
- private final int columnCount;
- public ListResultSetIteratorAdapter(int columnCount) {
- super();
- this.columnCount = columnCount;
- }
- public ArrayList<Object> buildNext(ResultSet rs) throws SQLException {
- ArrayList<Object> list = new ArrayList<Object>(this.columnCount);
- for (int i = 1; i <= this.columnCount; i++) { // NB: ResultSet index/subscript is 1-based
- list.add(rs.getObject(i));
- }
- return list;
- }
- }
-
- protected Statement createJDBCStatement() throws SQLException {
- return this.getJDBCConnection().createStatement();
- }
-
- protected Connection getJDBCConnection() {
- return ((ConnectionInfo) this.getDTPManagedConnection().getConnection().getRawConnection()).getSharedConnection();
- }
-
- protected DatabaseMetaData getDatabaseMetaData() throws SQLException {
- return this.getJDBCConnection().getMetaData();
- }
-
-
- // ********** dump DTP metadata **********
-
- /**
- * dump all the database metadata to the console
- */
- protected void dumpDatabase() {
- this.dumpDatabase(true);
- }
-
- /**
- * dump the database catalogs and schemata to the console
- */
- protected void dumpDatabaseContainers() {
- this.dumpDatabase(false);
- }
-
- protected void dumpDatabase(boolean deep) {
- IndentingPrintWriter pw = new IndentingPrintWriter(new OutputStreamWriter(System.out));
- // synchronize the console so everything is contiguous
- synchronized (System.out) {
- this.dumpDatabaseOn(pw, deep);
- }
- pw.flush();
- }
-
- protected void dumpDatabaseOn(IndentingPrintWriter pw, boolean deep) {
- Database database = this.connectionProfile.getDatabase();
- pw.print("database: ");
- pw.println(database.getName());
- if (database.supportsCatalogs()) {
- for (Iterator<Catalog> stream = database.catalogs(); stream.hasNext(); ) {
- this.dumpCatalogOn(stream.next(), pw, deep);
- }
- } else {
- this.dumpSchemaContainerOn(database, pw, deep);
- }
- }
-
- protected void dumpCatalogOn(Catalog catalog, IndentingPrintWriter pw, boolean deep) {
- pw.print("catalog: ");
- pw.println(catalog.getName());
- pw.indent();
- this.dumpSchemaContainerOn(catalog, pw, deep);
- pw.undent();
- }
-
- protected void dumpSchemaContainerOn(SchemaContainer schemaContainer, IndentingPrintWriter pw, boolean deep) {
- for (Iterator<Schema> stream = schemaContainer.schemata(); stream.hasNext(); ) {
- this.dumpSchemaOn(stream.next(), pw, deep);
- }
- }
-
- protected void dumpSchema(Schema schema) {
- this.dumpSchema(schema, true);
- }
-
- protected void dumpSchema(Schema schema, boolean deep) {
- IndentingPrintWriter pw = new IndentingPrintWriter(new OutputStreamWriter(System.out));
- // synchronize the console so everything is contiguous
- synchronized (System.out) {
- this.dumpSchemaOn(schema, pw, deep);
- }
- pw.flush();
- }
-
- protected void dumpSchemaOn(Schema schema, IndentingPrintWriter pw, boolean deep) {
- pw.print("schema: ");
- pw.println(schema.getName());
- if (deep) {
- pw.indent();
- for (Iterator<Table> stream = schema.tables(); stream.hasNext(); ) {
- this.dumpTableOn(stream.next(), pw);
- }
- for (Iterator<Sequence> stream = schema.sequences(); stream.hasNext(); ) {
- this.dumpSequenceOn(stream.next(), pw);
- }
- pw.undent();
- }
- }
-
- protected void dumpTableOn(Table table, IndentingPrintWriter pw) {
- pw.print("table: ");
- pw.println(table.getName());
- pw.indent();
- for (Iterator<Column> stream = table.columns(); stream.hasNext(); ) {
- this.dumpColumnOn(stream.next(), pw);
- }
- for (Iterator<ForeignKey> stream = table.foreignKeys(); stream.hasNext(); ) {
- this.dumpForeignKeyOn(stream.next(), pw);
- }
- pw.undent();
- }
-
- protected void dumpColumnOn(Column column, IndentingPrintWriter pw) {
- pw.print("column: ");
- pw.print(column.getName());
- pw.print(" : ");
- pw.print(column.getDataTypeName());
- if (column.isPartOfPrimaryKey()) {
- pw.print(" [primary key]");
- }
- pw.println();
- }
-
- protected void dumpForeignKeyOn(ForeignKey foreignKey, IndentingPrintWriter pw) {
- pw.print("foreign key: ");
- pw.print(foreignKey.getName());
- pw.print("=>");
- pw.print(foreignKey.getReferencedTable().getName());
- pw.print(" (");
- for (Iterator<ColumnPair> stream = foreignKey.columnPairs(); stream.hasNext(); ) {
- ColumnPair cp = stream.next();
- pw.print(cp.getBaseColumn().getName());
- pw.print("=>");
- pw.print(cp.getReferencedColumn().getName());
- if (stream.hasNext()) {
- pw.print(", ");
- }
- }
- pw.print(')');
- pw.println();
- }
-
- protected void dumpSequenceOn(Sequence sequence, IndentingPrintWriter pw) {
- pw.print("sequence: ");
- pw.println(sequence.getName());
- }
-
-
- // ********** dump JDBC metadata **********
-
- protected void dumpJDBCCatalogs() throws SQLException {
- IndentingPrintWriter pw = new IndentingPrintWriter(new OutputStreamWriter(System.out));
- // synchronize the console so everything is contiguous
- synchronized (System.out) {
- this.dumpJDBCCatalogsOn(pw);
- }
- pw.flush();
- }
-
- protected void dumpJDBCCatalogsOn(IndentingPrintWriter pw) throws SQLException {
- pw.println("JDBC catalogs: ");
- pw.indent();
- ArrayList<ArrayList<Object>> rows = this.buildRows(this.getDatabaseMetaData().getCatalogs());
- for (Iterator<ArrayList<Object>> stream = rows.iterator(); stream.hasNext(); ) {
- pw.println(stream.next().get(0));
- }
- pw.undent();
- }
-
- protected void dumpJDBCSchemata() throws SQLException {
- IndentingPrintWriter pw = new IndentingPrintWriter(new OutputStreamWriter(System.out));
- // synchronize the console so everything is contiguous
- synchronized (System.out) {
- this.dumpJDBCSchemataOn(pw);
- }
- pw.flush();
- }
-
- protected void dumpJDBCSchemataOn(IndentingPrintWriter pw) throws SQLException {
- pw.println("JDBC schemata: ");
- pw.indent();
- ArrayList<ArrayList<Object>> rows = this.buildRows(this.getDatabaseMetaData().getSchemas());
- for (ArrayList<Object> row : rows) {
- if (row.size() == 2) { // catalogs were added in jdk 1.4
- Object catalog = row.get(1);
- pw.print(catalog);
- pw.print('.');
- }
- Object schema = row.get(0);
- pw.println(schema);
- }
- pw.undent();
- }
-
-
- // ********** connection profile listener **********
-
- protected static class TestConnectionProfileListener implements ConnectionProfileListener {
- public String addedName;
- public String removedName;
- public String renamedOldName;
- public String renamedNewName;
-
- public void connectionProfileAdded(String name) {
- this.addedName = name;
- }
- public void connectionProfileRemoved(String name) {
- this.removedName = name;
- }
- public void connectionProfileRenamed(String oldName, String newName) {
- this.renamedOldName = oldName;
- this.renamedNewName = newName;
- }
- public void clear() {
- this.addedName = null;
- this.removedName = null;
- this.renamedOldName = null;
- this.renamedNewName = null;
- }
- }
-
-
- // ********** connection listener **********
-
- protected static class TestConnectionListener implements ConnectionListener {
- public ConnectionProfile openedProfile;
- public ConnectionProfile modifiedProfile;
- public ConnectionProfile okToCloseProfile;
- public ConnectionProfile aboutToCloseProfile;
- public ConnectionProfile closedProfile;
- public Database changedDatabase;
- public Catalog changedCatalog;
- public Schema changedSchema;
- public Sequence changedSequence;
- public Table changedTable;
- public Column changedColumn;
- public ForeignKey changedForeignKey;
-
- public void opened(ConnectionProfile profile) {
- this.openedProfile = profile;
- }
- public void modified(ConnectionProfile profile) {
- this.modifiedProfile = profile;
- }
- public boolean okToClose(ConnectionProfile profile) {
- this.okToCloseProfile = profile;
- return true;
- }
- public void aboutToClose(ConnectionProfile profile) {
- this.aboutToCloseProfile = profile;
- }
- public void closed(ConnectionProfile profile) {
- this.closedProfile = profile;
- }
- public void databaseChanged(ConnectionProfile profile, Database database) {
- this.changedDatabase = database;
- }
- public void catalogChanged(ConnectionProfile profile, Catalog catalog) {
- this.changedCatalog = catalog;
- }
- public void schemaChanged(ConnectionProfile profile, Schema schema) {
- this.changedSchema = schema;
- }
- public void sequenceChanged(ConnectionProfile profile, Sequence sequence) {
- this.changedSequence = sequence;
- }
- public void tableChanged(ConnectionProfile profile, Table table) {
- this.changedTable = table;
- }
- public void columnChanged(ConnectionProfile profile, Column column) {
- this.changedColumn = column;
- }
- public void foreignKeyChanged(ConnectionProfile profile, ForeignKey foreignKey) {
- this.changedForeignKey = foreignKey;
- }
- public void clear() {
- this.openedProfile = null;
- this.modifiedProfile = null;
- this.okToCloseProfile = null;
- this.aboutToCloseProfile = null;
- this.closedProfile = null;
- this.changedDatabase = null;
- this.changedCatalog = null;
- this.changedSchema = null;
- this.changedSequence = null;
- this.changedTable = null;
- this.changedColumn = null;
- this.changedForeignKey = null;
- }
- }
-
-}
diff --git a/jpa/tests/org.eclipse.jpt.db.tests/src/org/eclipse/jpt/db/tests/internal/platforms/DerbyTests.java b/jpa/tests/org.eclipse.jpt.db.tests/src/org/eclipse/jpt/db/tests/internal/platforms/DerbyTests.java
deleted file mode 100644
index e2aacd8656..0000000000
--- a/jpa/tests/org.eclipse.jpt.db.tests/src/org/eclipse/jpt/db/tests/internal/platforms/DerbyTests.java
+++ /dev/null
@@ -1,482 +0,0 @@
-/*******************************************************************************
- * Copyright (c) 2006, 2008 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.
- *
- * Contributors:
- * Oracle - initial API and implementation
- ******************************************************************************/
-package org.eclipse.jpt.db.tests.internal.platforms;
-
-import org.eclipse.datatools.connectivity.sqm.core.rte.ICatalogObject;
-import org.eclipse.jpt.db.Column;
-import org.eclipse.jpt.db.ForeignKey;
-import org.eclipse.jpt.db.Schema;
-import org.eclipse.jpt.db.Table;
-
-@SuppressWarnings("nls")
-public class DerbyTests extends DTPPlatformTests {
-
- public DerbyTests(String name) {
- super(name);
- }
-
- @Override
- protected void setUp() throws Exception {
- super.setUp();
- }
-
- @Override
- protected void tearDown() throws Exception {
- super.tearDown();
- }
-
- @Override
- protected String getPlatformPropertiesFileName() {
- return "derby.properties";
- }
-
- @Override
- protected String getDriverName() {
- return "Derby Embedded JDBC Driver";
- }
-
- @Override
- protected String getDriverDefinitionID() {
- return "DriverDefn.Derby Embedded JDBC Driver";
- }
-
- @Override
- protected String getDriverDefinitionType() {
- return "org.eclipse.datatools.connectivity.db.derby101.genericDriverTemplate";
- }
-
- @Override
- protected String getDatabaseVendor() {
- return "Derby";
- }
-
- @Override
- protected String getDatabaseVersion() {
- return "10.1";
- }
-
- @Override
- protected String getDriverClass() {
- return "org.apache.derby.jdbc.EmbeddedDriver";
- }
-
- @Override
- protected String getProfileName() {
- return "Derby_10.1_Embedded";
- }
-
- @Override
- protected String getProfileDescription() {
- return "Derby 10.1 Embedded JDBC Profile [Test]";
- }
-
- @Override
- protected String getProviderID() {
- return "org.eclipse.datatools.connectivity.db.derby.embedded.connectionProfile";
- }
-
- @Override
- protected boolean supportsCatalogs() {
- return false;
- }
-
- @Override
- protected boolean executeOfflineTests() {
- return true;
- }
-
- public void testSchema() throws Exception {
- this.connectionProfile.connect();
- TestConnectionListener listener = new TestConnectionListener();
- this.connectionProfile.addConnectionListener(listener);
-
- this.dropSchema("TEST1");
- this.dropSchema("TEST2");
-
- this.executeUpdate("CREATE SCHEMA TEST1");
- ((ICatalogObject) this.getDTPDatabase()).refresh();
-
- Schema schema1 = this.getDatabase().getSchemaNamed("TEST1");
- assertNotNull(schema1);
-
- this.executeUpdate("CREATE SCHEMA TEST2");
- Schema schema2 = this.getDatabase().getSchemaNamed("TEST2");
- assertNull(schema2); // should be null until refresh
-
- ((ICatalogObject) this.getDTPDatabase()).refresh();
- assertSame(this.getDatabase(), listener.changedDatabase);
-
- schema2 = this.getDatabase().getSchemaNamed("TEST2");
- assertNotNull(schema2);
- assertNotSame(schema1, this.getDatabase().getSchemaNamed("TEST1")); // we should have a new schema after the refresh
-
- this.dropSchema("TEST2");
- this.dropSchema("TEST1");
- this.connectionProfile.removeConnectionListener(listener);
- this.connectionProfile.disconnect();
- }
-
- public void testSchemaLookup() throws Exception {
- this.connectionProfile.connect();
- TestConnectionListener listener = new TestConnectionListener();
- this.connectionProfile.addConnectionListener(listener);
-
- this.dropSchema("LOOKUP_TEST");
- this.dropSchema("\"lookup_TEST\"");
- ((ICatalogObject) this.getDTPDatabase()).refresh();
-
- this.executeUpdate("CREATE SCHEMA LOOKUP_TEST");
- ((ICatalogObject) this.getDTPDatabase()).refresh();
-
- assertNotNull(this.getDatabase().getSchemaNamed("LOOKUP_TEST"));
- assertNotNull(this.getDatabase().getSchemaForIdentifier("LOOKUP_TEST"));
-
- assertNull(this.getDatabase().getSchemaNamed("lookup_test"));
- assertNotNull(this.getDatabase().getSchemaForIdentifier("lookup_test"));
-
- assertNull(this.getDatabase().getSchemaNamed("lookup_TEST"));
- assertNotNull(this.getDatabase().getSchemaForIdentifier("lookup_TEST"));
-
- assertNotNull(this.getDatabase().getSchemaForIdentifier("\"LOOKUP_TEST\""));
- assertNull(this.getDatabase().getSchemaForIdentifier("\"lookup_TEST\""));
-
- this.dropSchema("LOOKUP_TEST");
-
- this.executeUpdate("CREATE SCHEMA \"lookup_TEST\"");
- ((ICatalogObject) this.getDTPDatabase()).refresh();
-
- assertNull(this.getDatabase().getSchemaNamed("LOOKUP_TEST"));
- assertNull(this.getDatabase().getSchemaForIdentifier("LOOKUP_TEST"));
-
- assertNull(this.getDatabase().getSchemaNamed("lookup_test"));
- assertNull(this.getDatabase().getSchemaForIdentifier("lookup_test"));
-
- assertNotNull(this.getDatabase().getSchemaNamed("lookup_TEST"));
- assertNull(this.getDatabase().getSchemaForIdentifier("lookup_TEST"));
-
- assertNull(this.getDatabase().getSchemaForIdentifier("\"LOOKUP_TEST\""));
- assertNotNull(this.getDatabase().getSchemaForIdentifier("\"lookup_TEST\""));
-
- this.dropSchema("\"lookup_TEST\"");
-
- this.connectionProfile.removeConnectionListener(listener);
- this.connectionProfile.disconnect();
- }
-
- public void testSchemaIdentifier() throws Exception {
- this.connectionProfile.connect();
- TestConnectionListener listener = new TestConnectionListener();
- this.connectionProfile.addConnectionListener(listener);
-
- this.dropSchema("LOOKUP_TEST");
- this.dropSchema("\"lookup_TEST\"");
-
- this.executeUpdate("CREATE SCHEMA lookup_test"); // this gets folded to uppercase
- this.executeUpdate("CREATE SCHEMA \"lookup_TEST\"");
- ((ICatalogObject) this.getDTPDatabase()).refresh();
-
- Schema schema = this.getDatabase().getSchemaForIdentifier("LOOKUP_TEST");
- assertEquals("LOOKUP_TEST", schema.getIdentifier());
- assertEquals("LOOKUP_TEST", schema.getIdentifier("LookupTest"));
- assertNull(schema.getIdentifier("Lookup_Test"));
-
- schema = this.getDatabase().getSchemaForIdentifier("lookup_test");
- assertEquals("LOOKUP_TEST", schema.getIdentifier());
-
- schema = this.getDatabase().getSchemaForIdentifier("\"lookup_TEST\"");
- assertEquals("\"lookup_TEST\"", schema.getIdentifier());
- assertEquals("\"lookup_TEST\"", schema.getIdentifier("lookup_TEST"));
-
- this.dropSchema("\"lookup_TEST\"");
- this.dropSchema("LOOKUP_TEST");
-
- this.connectionProfile.removeConnectionListener(listener);
- this.connectionProfile.disconnect();
- }
-
- public void testTable() throws Exception {
- this.connectionProfile.connect();
- TestConnectionListener listener = new TestConnectionListener();
- this.connectionProfile.addConnectionListener(listener);
-
- this.dropTable("TABLE_TEST", "FOO_BAZ");
- this.dropTable("TABLE_TEST", "BAZ");
- this.dropTable("TABLE_TEST", "FOO");
- this.dropTable("TABLE_TEST", "BAR");
- this.dropSchema("TABLE_TEST");
-
- this.executeUpdate("CREATE SCHEMA TABLE_TEST");
- this.executeUpdate("SET SCHEMA = TABLE_TEST");
-
- this.executeUpdate(this.buildBarDDL());
- this.executeUpdate(this.buildFooDDL());
- this.executeUpdate(this.buildBazDDL());
- this.executeUpdate(this.buildFooBazDDL());
- ((ICatalogObject) this.getDTPDatabase()).refresh();
-
- Schema schema = this.getDatabase().getSchemaNamed("TABLE_TEST");
-
- // FOO
- Table fooTable = schema.getTableNamed("FOO");
- assertEquals(4, fooTable.columnsSize());
- assertEquals(1, fooTable.primaryKeyColumnsSize());
- assertEquals(1, fooTable.foreignKeysSize());
-
- Column pkColumn = fooTable.getPrimaryKeyColumn();
- assertEquals("ID", pkColumn.getName());
- Column idColumn = fooTable.getColumnNamed("ID");
- assertSame(pkColumn, idColumn);
- assertEquals("INTEGER", idColumn.getDataTypeName());
- assertSame(fooTable, idColumn.getTable());
- assertTrue(idColumn.isPartOfPrimaryKey());
- assertFalse(idColumn.isPartOfForeignKey());
- assertEquals("int", idColumn.getJavaTypeDeclaration());
-
- Column nameColumn = fooTable.getColumnNamed("NAME");
- assertEquals("VARCHAR", nameColumn.getDataTypeName());
- assertEquals("java.lang.String", nameColumn.getJavaTypeDeclaration());
- assertEquals(20, nameColumn.getLength());
- assertFalse(nameColumn.isPartOfPrimaryKey());
- assertFalse(nameColumn.isNumeric());
- assertTrue(nameColumn.isNullable());
-
- Column barColumn = fooTable.getColumnNamed("BAR_ID");
- assertEquals("INTEGER", barColumn.getDataTypeName());
- assertTrue(barColumn.isPartOfForeignKey());
- assertFalse(barColumn.isPartOfPrimaryKey());
-
- Column salaryColumn = fooTable.getColumnNamed("SALARY");
- assertEquals("DECIMAL", salaryColumn.getDataTypeName());
- assertTrue(salaryColumn.isNullable());
- assertTrue(salaryColumn.isNumeric());
- assertEquals(11, salaryColumn.getPrecision());
- assertEquals(2, salaryColumn.getScale());
- assertEquals(-1, salaryColumn.getLength());
-
- ForeignKey barFK = fooTable.foreignKeys().next(); // there should only be 1 foreign key
- assertEquals(1, barFK.columnPairsSize());
- assertEquals("BAR", barFK.getAttributeName());
- assertNull(barFK.getJoinColumnAnnotationIdentifier("bar"));
- assertEquals("BAR_ID", barFK.getJoinColumnAnnotationIdentifier("primaryBar"));
- assertSame(fooTable, barFK.getBaseTable());
-
- assertFalse(fooTable.isPossibleJoinTable());
- assertSame(schema, fooTable.getSchema());
-
- // BAR
- Table barTable = schema.getTableNamed("BAR");
- assertEquals(3, barTable.columnsSize());
- assertEquals(1, barTable.primaryKeyColumnsSize());
- assertEquals(0, barTable.foreignKeysSize());
- assertEquals("ID", barTable.getPrimaryKeyColumn().getName());
- assertFalse(barTable.isPossibleJoinTable());
-
- Column id2Column = barTable.getColumnNamed("ID2");
- assertEquals("INTEGER", id2Column.getDataTypeName());
-// assertTrue(id2Column.isPartOfUniqueConstraint()); // doesn't work(?)
- assertFalse(id2Column.isNullable());
- assertTrue(id2Column.isNumeric());
- assertEquals(0, id2Column.getPrecision()); // not sure what to expect here...
- assertEquals(0, id2Column.getScale()); // not sure what to expect here either...
- assertEquals("BLOB", barTable.getColumnNamed("CHUNK").getDataTypeName());
- assertEquals("byte[]", barTable.getColumnNamed("CHUNK").getJavaTypeDeclaration());
- assertTrue(barTable.getColumnNamed("CHUNK").isLOB());
- assertSame(barTable, barFK.getReferencedTable());
-
- // BAZ
- Table bazTable = schema.getTableNamed("BAZ");
- Column nicknameColumn = bazTable.getColumnNamed("NICKNAME");
- assertEquals(20, nicknameColumn.getLength());
-// assertTrue(nicknameColumn.isPartOfUniqueConstraint()); // doesn't work(?)
-
- // FOO_BAZ
- Table foo_bazTable = schema.getTableNamed("FOO_BAZ");
- assertEquals(2, foo_bazTable.columnsSize());
- assertEquals(0, foo_bazTable.primaryKeyColumnsSize());
- assertEquals(2, foo_bazTable.foreignKeysSize());
- assertTrue(foo_bazTable.isPossibleJoinTable());
- assertTrue(foo_bazTable.joinTableNameIsDefault());
- assertTrue(foo_bazTable.getColumnNamed("FOO_ID").isPartOfForeignKey());
-
- this.dropTable("TABLE_TEST", "FOO_BAZ");
- this.dropTable("TABLE_TEST", "BAZ");
- this.dropTable("TABLE_TEST", "FOO");
- this.dropTable("TABLE_TEST", "BAR");
- this.dropSchema("TABLE_TEST");
-
- this.connectionProfile.removeConnectionListener(listener);
- this.connectionProfile.disconnect();
- }
-
- private static final String CR = System.getProperty("line.separator"); //$NON-NLS-1$
-
- private String buildBarDDL() {
- StringBuilder sb = new StringBuilder(200);
- sb.append("CREATE TABLE BAR (").append(CR);
- sb.append(" ID INT PRIMARY KEY,").append(CR);
- sb.append(" ID2 INT UNIQUE NOT NULL,").append(CR);
- sb.append(" CHUNK BLOB(100K)").append(CR);
- sb.append(")").append(CR);
- return sb.toString();
- }
-
- private String buildFooDDL() {
- StringBuilder sb = new StringBuilder(200);
- sb.append("CREATE TABLE FOO (").append(CR);
- sb.append(" ID INT PRIMARY KEY,").append(CR);
- sb.append(" NAME VARCHAR(20),").append(CR);
- sb.append(" SALARY DECIMAL(11, 2),").append(CR);
- sb.append(" BAR_ID INT REFERENCES BAR(ID)").append(CR);
- sb.append(")").append(CR);
- return sb.toString();
- }
-
- private String buildBazDDL() {
- StringBuilder sb = new StringBuilder(200);
- sb.append("CREATE TABLE BAZ (").append(CR);
- sb.append(" ID INT PRIMARY KEY,").append(CR);
- sb.append(" NICKNAME VARCHAR(20) NOT NULL UNIQUE").append(CR);
- sb.append(")").append(CR);
- return sb.toString();
- }
-
- private String buildFooBazDDL() {
- StringBuilder sb = new StringBuilder(200);
- sb.append("CREATE TABLE FOO_BAZ (").append(CR);
- sb.append(" FOO_ID INT REFERENCES FOO(ID),").append(CR);
- sb.append(" BAZ_ID INT REFERENCES BAZ(ID)").append(CR);
- sb.append(")").append(CR);
- return sb.toString();
- }
-
- public void testColumnLookup() throws Exception {
- this.connectionProfile.connect();
- TestConnectionListener listener = new TestConnectionListener();
- this.connectionProfile.addConnectionListener(listener);
-
- this.dropTable("COLUMN_TEST", "test");
- this.dropSchema("COLUMN_TEST");
-
- this.executeUpdate("CREATE SCHEMA COLUMN_TEST");
- this.executeUpdate("SET SCHEMA = COLUMN_TEST");
-
- // lowercase
- this.executeUpdate("CREATE TABLE test (id INTEGER, name VARCHAR(20))");
- ((ICatalogObject) this.getDTPDatabase()).refresh();
-
- Table table = this.getDatabase().getSchemaNamed("COLUMN_TEST").getTableForIdentifier("test");
- assertNotNull(table.getColumnForIdentifier("id"));
- assertNotNull(table.getColumnForIdentifier("name"));
-
- this.dropTable("COLUMN_TEST", "test");
-
- // uppercase
- this.executeUpdate("CREATE TABLE test (ID INTEGER, NAME VARCHAR(20))");
- ((ICatalogObject) this.getDTPDatabase()).refresh();
-
- table = this.getDatabase().getSchemaNamed("COLUMN_TEST").getTableForIdentifier("test");
- assertNotNull(table.getColumnForIdentifier("ID"));
- assertNotNull(table.getColumnForIdentifier("NAME"));
-
- this.dropTable("COLUMN_TEST", "test");
-
- // mixed case
- this.executeUpdate("CREATE TABLE test (Id INTEGER, Name VARCHAR(20))");
- ((ICatalogObject) this.getDTPDatabase()).refresh();
-
- table = this.getDatabase().getSchemaNamed("COLUMN_TEST").getTableForIdentifier("test");
- assertNotNull(table.getColumnForIdentifier("Id"));
- assertNotNull(table.getColumnForIdentifier("Name"));
-
- this.dropTable("COLUMN_TEST", "test");
-
- // delimited
- this.executeUpdate("CREATE TABLE test (\"Id\" INTEGER, \"Name\" VARCHAR(20))");
- ((ICatalogObject) this.getDTPDatabase()).refresh();
-
- table = this.getDatabase().getSchemaNamed("COLUMN_TEST").getTableForIdentifier("test");
- assertNotNull(table.getColumnForIdentifier("\"Id\""));
- assertNotNull(table.getColumnForIdentifier("\"Name\""));
-
- this.dropTable("COLUMN_TEST", "test");
- this.dropSchema("COLUMN_TEST");
-
- this.connectionProfile.removeConnectionListener(listener);
- this.connectionProfile.disconnect();
- }
-
- public void testCrossSchemaReference() throws Exception {
- this.connectionProfile.connect();
- TestConnectionListener listener = new TestConnectionListener();
- this.connectionProfile.addConnectionListener(listener);
-
- this.dropTable("XREF_TEST2", "EMP");
- this.dropSchema("XREF_TEST2");
- this.dropTable("XREF_TEST1", "ORG");
- this.dropSchema("XREF_TEST1");
-
- this.executeUpdate("CREATE SCHEMA XREF_TEST1");
- this.executeUpdate("SET SCHEMA = XREF_TEST1");
- this.executeUpdate("CREATE TABLE ORG (ID INTEGER PRIMARY KEY, NAME VARCHAR(20))");
-
- this.executeUpdate("CREATE SCHEMA XREF_TEST2");
- this.executeUpdate("SET SCHEMA = XREF_TEST2");
- this.executeUpdate("CREATE TABLE EMP (ID INTEGER PRIMARY KEY, NAME VARCHAR(20), " +
- "ORG_ID INTEGER REFERENCES XREF_TEST1.ORG(ID))");
-
- ((ICatalogObject) this.getDTPDatabase()).refresh();
- Schema schema1 = this.getDatabase().getSchemaNamed("XREF_TEST1");
- assertNotNull(schema1);
- Table orgTable = schema1.getTableNamed("ORG");
- assertNotNull(orgTable);
-
- Schema schema2 = this.getDatabase().getSchemaNamed("XREF_TEST2");
- assertNotNull(schema2);
- Table empTable = schema2.getTableNamed("EMP");
- assertNotNull(empTable);
- assertEquals(1, empTable.foreignKeysSize());
- ForeignKey fk = empTable.foreignKeys().next();
- Table refTable = fk.getReferencedTable();
- assertNotNull(refTable);
- assertEquals("ORG", refTable.getName());
- assertEquals(1, fk.columnPairsSize());
- ForeignKey.ColumnPair cp = fk.columnPairs().next();
- Column baseColumn = cp.getBaseColumn();
- assertEquals("ORG_ID", baseColumn.getName());
- Column refColumn = cp.getReferencedColumn();
- assertEquals("ID", refColumn.getName());
-
- this.dropTable("XREF_TEST2", "EMP");
- this.dropSchema("XREF_TEST2");
- this.dropTable("XREF_TEST1", "ORG");
- this.dropSchema("XREF_TEST1");
- this.connectionProfile.removeConnectionListener(listener);
- this.connectionProfile.disconnect();
- }
-
- private void dropTable(String schemaName, String tableName) throws Exception {
- Schema schema= this.getDatabase().getSchemaForIdentifier(schemaName);
- if (schema != null) {
- if (schema.getTableForIdentifier(tableName) != null) {
- this.executeUpdate("DROP TABLE " + schemaName + '.' + tableName);
- }
- }
- }
-
- /**
- * NB: A Derby schema must be empty before it can be dropped.
- */
- private void dropSchema(String name) throws Exception {
- if (this.getDatabase().getSchemaForIdentifier(name) != null) {
- this.executeUpdate("DROP SCHEMA " + name + " RESTRICT");
- }
- }
-
-}
diff --git a/jpa/tests/org.eclipse.jpt.db.tests/src/org/eclipse/jpt/db/tests/internal/platforms/MySQLTests.java b/jpa/tests/org.eclipse.jpt.db.tests/src/org/eclipse/jpt/db/tests/internal/platforms/MySQLTests.java
deleted file mode 100644
index 4b65142baf..0000000000
--- a/jpa/tests/org.eclipse.jpt.db.tests/src/org/eclipse/jpt/db/tests/internal/platforms/MySQLTests.java
+++ /dev/null
@@ -1,404 +0,0 @@
-/*******************************************************************************
- * Copyright (c) 2007, 2008 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.
- *
- * Contributors:
- * Oracle - initial API and implementation
- ******************************************************************************/
-package org.eclipse.jpt.db.tests.internal.platforms;
-
-import java.util.Properties;
-
-import org.eclipse.datatools.connectivity.drivers.jdbc.IJDBCDriverDefinitionConstants;
-import org.eclipse.datatools.connectivity.sqm.core.rte.ICatalogObject;
-import org.eclipse.jpt.db.Column;
-import org.eclipse.jpt.db.ForeignKey;
-import org.eclipse.jpt.db.Schema;
-import org.eclipse.jpt.db.Table;
-
-/**
- * MySQL
- *
- * Notes:
- * - We can only get database objects from the database associated with our
- * connection profile.
- * - We can reference objects across multiple databases, so they are sorta like
- * schemas....
- * - Foreign keys must be defined as table-level constraints; they cannot be
- * defined as part of the column clause.
- * - Case-sensitivity and -folding is whacked on MySQL....
- */
-@SuppressWarnings("nls")
-public class MySQLTests extends DTPPlatformTests {
-
- public MySQLTests( String name) {
- super(name);
- }
-
- @Override
- protected String getPlatformPropertiesFileName() {
- return "mysql.properties";
- }
-
- @Override
- protected String getDriverName() {
- return "MySQL JDBC Driver";
- }
-
- @Override
- protected String getDriverDefinitionID() {
- return "DriverDefn.MySQL JDBC Driver";
- }
-
- @Override
- protected String getDriverDefinitionType() {
- return "org.eclipse.datatools.enablement.mysql.4_1.driverTemplate";
- }
-
- @Override
- protected String getDatabaseVendor() {
- return "MySql";
- }
-
- @Override
- protected String getDatabaseVersion() {
- return "4.1";
- }
-
- @Override
- protected String getDriverClass() {
- return "com.mysql.jdbc.Driver";
- }
-
- @Override
- protected String getDefaultJDBCURL() {
- return "jdbc:mysql://localhost:3306";
- }
-
- @Override
- protected String getProfileName() {
- return "MySQL_4.1";
- }
-
- @Override
- protected String getProfileDescription() {
- return "MySQL 4.1 JDBC Profile [Test]";
- }
-
- @Override
- protected boolean supportsCatalogs() {
- return false;
- }
-
- @Override
- protected Properties buildDTPConnectionProfileProperties() {
- Properties p = super.buildDTPConnectionProfileProperties();
- p.setProperty(IJDBCDriverDefinitionConstants.DATABASE_NAME_PROP_ID, this.getDatabaseName());
- return p;
- }
-
- private String getDatabaseName() {
- return "dalitest";
- }
-
- @Override
- protected boolean executeOfflineTests() {
- return true; // seems to work...
- }
-
- public void testDatabase() throws Exception {
- this.connectionProfile.connect();
- TestConnectionListener listener = new TestConnectionListener();
- this.connectionProfile.addConnectionListener(listener);
-
- // DTP: MySQL has a single schema with the same name as the database
- Schema schema = this.getDatabase().getSchemaNamed(this.getDatabaseName());
- assertNotNull(schema);
- assertSame(this.getDatabase().getDefaultSchema(), schema);
-
- this.connectionProfile.removeConnectionListener(listener);
- this.connectionProfile.disconnect();
- }
-
- public void testTable() throws Exception {
- this.connectionProfile.connect();
- TestConnectionListener listener = new TestConnectionListener();
- this.connectionProfile.addConnectionListener(listener);
-
- this.dropDatabase(this.getDatabaseName());
- this.executeUpdate("CREATE DATABASE " + this.getDatabaseName());
- this.getJDBCConnection().setCatalog(this.getDatabaseName());
-
- this.dropTable(this.getDatabaseName(), "foo_baz");
- this.dropTable(this.getDatabaseName(), "baz");
- this.dropTable(this.getDatabaseName(), "foo");
- this.dropTable(this.getDatabaseName(), "bar");
-
- this.executeUpdate(this.buildBarDDL());
- this.executeUpdate(this.buildFooDDL());
- this.executeUpdate(this.buildBazDDL());
- this.executeUpdate(this.buildFooBazDDL());
- ((ICatalogObject) this.getDTPDatabase()).refresh();
-
- Schema schema = this.getDatabase().getDefaultSchema();
-
- // foo
- Table fooTable = schema.getTableNamed("foo");
- assertEquals(3, fooTable.columnsSize());
- assertEquals(1, fooTable.primaryKeyColumnsSize());
- assertEquals(1, fooTable.foreignKeysSize());
-
- Column pkColumn = fooTable.getPrimaryKeyColumn();
- assertEquals("id", pkColumn.getName());
- Column idColumn = fooTable.getColumnNamed("id");
- assertSame(pkColumn, idColumn);
- assertEquals("INT", idColumn.getDataTypeName());
- assertSame(fooTable, idColumn.getTable());
- assertTrue(idColumn.isPartOfPrimaryKey());
- assertFalse(idColumn.isPartOfForeignKey());
- assertEquals("int", idColumn.getJavaTypeDeclaration());
-
- Column nameColumn = fooTable.getColumnNamed("name");
- assertEquals("VARCHAR", nameColumn.getDataTypeName());
- assertEquals("java.lang.String", nameColumn.getJavaTypeDeclaration());
- assertFalse(nameColumn.isPartOfPrimaryKey());
-
- Column barColumn = fooTable.getColumnNamed("bar_id");
- assertEquals("INT", barColumn.getDataTypeName());
- assertTrue(barColumn.isPartOfForeignKey());
- assertFalse(barColumn.isPartOfPrimaryKey());
-
- ForeignKey barFK = fooTable.foreignKeys().next(); // there should only be 1 foreign key
- assertEquals(1, barFK.columnPairsSize());
- assertEquals("bar", barFK.getAttributeName());
- assertNull(barFK.getJoinColumnAnnotationIdentifier("bar"));
- assertEquals("bar_id", barFK.getJoinColumnAnnotationIdentifier("primaryBar"));
- assertSame(fooTable, barFK.getBaseTable());
-
- assertFalse(fooTable.isPossibleJoinTable());
- assertSame(schema, fooTable.getSchema());
-
- // BAR
- Table barTable = schema.getTableNamed("bar");
- assertEquals(2, barTable.columnsSize());
- assertEquals(1, barTable.primaryKeyColumnsSize());
- assertEquals(0, barTable.foreignKeysSize());
- assertEquals("id", barTable.getPrimaryKeyColumn().getName());
- assertFalse(barTable.isPossibleJoinTable());
- assertEquals("BLOB", barTable.getColumnNamed("chunk").getDataTypeName());
- assertEquals("byte[]", barTable.getColumnNamed("chunk").getJavaTypeDeclaration());
- assertTrue(barTable.getColumnNamed("chunk").isLOB());
- assertSame(barTable, barFK.getReferencedTable());
-
- // FOO_BAZ
- Table foo_bazTable = schema.getTableNamed("foo_baz");
- assertEquals(2, foo_bazTable.columnsSize());
- assertEquals(0, foo_bazTable.primaryKeyColumnsSize());
- assertEquals(2, foo_bazTable.foreignKeysSize());
- assertTrue(foo_bazTable.isPossibleJoinTable());
- assertTrue(foo_bazTable.joinTableNameIsDefault());
- assertTrue(foo_bazTable.getColumnNamed("foo_id").isPartOfForeignKey());
-
- this.dropTable(this.getDatabaseName(), "foo_baz");
- this.dropTable(this.getDatabaseName(), "baz");
- this.dropTable(this.getDatabaseName(), "foo");
- this.dropTable(this.getDatabaseName(), "bar");
-
- this.dropDatabase(this.getDatabaseName());
-
- this.connectionProfile.removeConnectionListener(listener);
- this.connectionProfile.disconnect();
- }
-
- private static final String CR = System.getProperty("line.separator"); //$NON-NLS-1$
-
- private String buildBarDDL() {
- StringBuilder sb = new StringBuilder(200);
- sb.append("CREATE TABLE bar (").append(CR);
- sb.append(" id INTEGER PRIMARY KEY,").append(CR);
- sb.append(" chunk BLOB").append(CR);
- sb.append(")").append(CR);
- return sb.toString();
- }
-
- private String buildFooDDL() {
- StringBuilder sb = new StringBuilder(200);
- sb.append("CREATE TABLE foo (").append(CR);
- sb.append(" id INTEGER PRIMARY KEY,").append(CR);
- sb.append(" name VARCHAR(20),").append(CR);
- sb.append(" bar_id INTEGER,").append(CR);
- sb.append(" FOREIGN KEY (bar_id) REFERENCES bar(id)").append(CR);
- sb.append(")").append(CR);
- return sb.toString();
- }
-
- private String buildBazDDL() {
- StringBuilder sb = new StringBuilder(200);
- sb.append("CREATE TABLE baz (").append(CR);
- sb.append(" id INTEGER PRIMARY KEY,").append(CR);
- sb.append(" name VARCHAR(20)").append(CR);
- sb.append(")").append(CR);
- return sb.toString();
- }
-
- private String buildFooBazDDL() {
- StringBuilder sb = new StringBuilder(200);
- sb.append("CREATE TABLE foo_baz (").append(CR);
- sb.append(" foo_id INT,").append(CR);
- sb.append(" baz_id INT,").append(CR);
- sb.append(" FOREIGN KEY (foo_id) REFERENCES foo(id),").append(CR);
- sb.append(" FOREIGN KEY (baz_id) REFERENCES baz(id)").append(CR);
- sb.append(")").append(CR);
- return sb.toString();
- }
-
- /**
- * On Windows, table names get folded to lowercase by default;
- * even if the name is delimited (apparently).
- */
- public void testTableLookup() throws Exception {
- this.connectionProfile.connect();
- TestConnectionListener listener = new TestConnectionListener();
- this.connectionProfile.addConnectionListener(listener);
-
- this.dropDatabase(this.getDatabaseName());
- this.executeUpdate("CREATE DATABASE " + this.getDatabaseName());
- this.getJDBCConnection().setCatalog(this.getDatabaseName());
-
- this.dropTable(this.getDatabaseName(), "test1");
- this.dropTable(this.getDatabaseName(), "TEST2");
- this.dropTable(this.getDatabaseName(), "`TEST3`");
-
- this.executeUpdate("CREATE TABLE test1 (id INTEGER, name VARCHAR(20))");
- this.executeUpdate("CREATE TABLE TEST2 (id INTEGER, name VARCHAR(20))");
- this.executeUpdate("CREATE TABLE `TEST3` (id INTEGER, name VARCHAR(20))");
- ((ICatalogObject) this.getDTPDatabase()).refresh();
-
- Schema schema = this.getDatabase().getDefaultSchema();
-
- Table test1Table = schema.getTableForIdentifier("test1");
- assertNotNull(test1Table);
-
- // this probably only works on Windows
- Table test2Table = schema.getTableForIdentifier("test2");
- assertNotNull(test2Table);
-
- // this probably only works on Windows
- Table test3Table = schema.getTableForIdentifier("`test3`");
- assertNotNull(test3Table);
-
- this.dropTable(this.getDatabaseName(), "test1");
- this.dropTable(this.getDatabaseName(), "TEST2");
- this.dropTable(this.getDatabaseName(), "`TEST3`");
-
- this.dropDatabase(this.getDatabaseName());
-
- this.connectionProfile.removeConnectionListener(listener);
- this.connectionProfile.disconnect();
- }
-
- public void testColumnLookup() throws Exception {
- this.connectionProfile.connect();
- TestConnectionListener listener = new TestConnectionListener();
- this.connectionProfile.addConnectionListener(listener);
-
- this.dropDatabase(this.getDatabaseName());
- this.executeUpdate("CREATE DATABASE " + this.getDatabaseName());
- this.getJDBCConnection().setCatalog(this.getDatabaseName());
-
- this.dropTable(this.getDatabaseName(), "test");
-
- // lowercase
- this.executeUpdate("CREATE TABLE test (id INTEGER, name VARCHAR(20))");
- ((ICatalogObject) this.getDTPDatabase()).refresh();
-
- Table table = this.getDatabase().getDefaultSchema().getTableNamed("test");
- assertNotNull(table.getColumnNamed("id"));
- assertNotNull(table.getColumnNamed("name"));
-
- this.dropTable(this.getDatabaseName(), "test");
-
- // uppercase
- this.executeUpdate("CREATE TABLE test (ID INTEGER, NAME VARCHAR(20))");
- ((ICatalogObject) this.getDTPDatabase()).refresh();
-
- table = this.getDatabase().getDefaultSchema().getTableNamed("test");
- assertNotNull(table.getColumnNamed("ID"));
- assertNotNull(table.getColumnNamed("NAME"));
-
- this.dropTable(this.getDatabaseName(), "test");
-
- // mixed case
- this.executeUpdate("CREATE TABLE test (Id INTEGER, Name VARCHAR(20))");
- ((ICatalogObject) this.getDTPDatabase()).refresh();
-
- table = this.getDatabase().getDefaultSchema().getTableNamed("test");
- assertNotNull(table.getColumnNamed("Id"));
- assertNotNull(table.getColumnNamed("Name"));
-
- this.dropTable(this.getDatabaseName(), "test");
-
- // delimited
- this.executeUpdate("CREATE TABLE test (`Id` INTEGER, `Name` VARCHAR(20))");
- ((ICatalogObject) this.getDTPDatabase()).refresh();
-
- table = this.getDatabase().getDefaultSchema().getTableNamed("test");
- assertNotNull(table.getColumnForIdentifier("`Id`"));
- assertNotNull(table.getColumnForIdentifier("`Name`"));
-
- this.dropTable(this.getDatabaseName(), "test");
-
- this.dropDatabase(this.getDatabaseName());
-
- this.connectionProfile.removeConnectionListener(listener);
- this.connectionProfile.disconnect();
- }
-
- /**
- * We can only get a single "schema" per connection via DTP,
- * so cross-schema references are not visible.
- */
- public void testCrossSchemaReference() throws Exception {
- this.connectionProfile.connect();
- TestConnectionListener listener = new TestConnectionListener();
- this.connectionProfile.addConnectionListener(listener);
-
- this.dropDatabase("xref_test2");
- this.dropDatabase("xref_test1");
-
- this.executeUpdate("CREATE DATABASE xref_test1");
- this.getJDBCConnection().setCatalog("xref_test1");
- this.executeUpdate("CREATE TABLE org (id INTEGER PRIMARY KEY, name VARCHAR(20))");
-
- this.executeUpdate("CREATE DATABASE xref_test2");
- this.getJDBCConnection().setCatalog("xref_test2");
- this.executeUpdate("CREATE TABLE emp (id INTEGER PRIMARY KEY, name VARCHAR(20), " +
- "org_id INTEGER, FOREIGN KEY (org_id) REFERENCES xref_test1.org(id))");
-
- this.getJDBCConnection().setCatalog("xref_test2");
- ((ICatalogObject) this.getDTPDatabase()).refresh();
- Schema schema2 = this.getDatabase().getDefaultSchema();
- assertNotNull(schema2);
- Table empTable = schema2.getTableNamed("emp");
- assertNotNull(empTable);
- // no foreign keys
- assertEquals(0, empTable.foreignKeysSize());
-
- this.dropDatabase("xref_test2");
- this.dropDatabase("xref_test1");
-
- this.connectionProfile.removeConnectionListener(listener);
- this.connectionProfile.disconnect();
- }
-
- private void dropTable(String dbName, String tableName) throws Exception {
- this.executeUpdate("DROP TABLE IF EXISTS " + dbName + '.' + tableName);
- }
-
- private void dropDatabase(String name) throws Exception {
- this.executeUpdate("DROP DATABASE IF EXISTS " + name);
- }
-
-}
diff --git a/jpa/tests/org.eclipse.jpt.db.tests/src/org/eclipse/jpt/db/tests/internal/platforms/Oracle10gTests.java b/jpa/tests/org.eclipse.jpt.db.tests/src/org/eclipse/jpt/db/tests/internal/platforms/Oracle10gTests.java
deleted file mode 100644
index bd70825d3f..0000000000
--- a/jpa/tests/org.eclipse.jpt.db.tests/src/org/eclipse/jpt/db/tests/internal/platforms/Oracle10gTests.java
+++ /dev/null
@@ -1,397 +0,0 @@
-/*******************************************************************************
- * Copyright (c) 2007, 2008 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.
- *
- * Contributors:
- * Oracle - initial API and implementation
- ******************************************************************************/
-package org.eclipse.jpt.db.tests.internal.platforms;
-
-import java.sql.SQLException;
-
-import org.eclipse.datatools.connectivity.sqm.core.rte.ICatalogObject;
-import org.eclipse.jpt.db.Column;
-import org.eclipse.jpt.db.ForeignKey;
-import org.eclipse.jpt.db.Schema;
-import org.eclipse.jpt.db.Table;
-
-@SuppressWarnings("nls")
-public class Oracle10gTests extends DTPPlatformTests {
-
- public Oracle10gTests( String name) {
- super( name);
- }
-
- @Override
- protected String getPlatformPropertiesFileName() {
- return "oracle10g.properties";
- }
-
- @Override
- protected String getDriverName() {
- return "Oracle 10g Thin Driver";
- }
-
- @Override
- protected String getDriverDefinitionID() {
- return "DriverDefn.Oracle Thin Driver";
- }
-
- @Override
- protected String getDriverDefinitionType() {
- return "org.eclipse.datatools.enablement.oracle.10.driverTemplate";
- }
-
- @Override
- protected String getDatabaseVendor() {
- return "Oracle";
- }
-
- @Override
- protected String getDatabaseVersion() {
- return "10";
- }
-
- @Override
- protected String getDriverClass() {
- return "oracle.jdbc.OracleDriver";
- }
-
- @Override
- protected String getProfileName() {
- return "Oracle10g_10.1.0.4";
- }
-
- @Override
- protected String getProfileDescription() {
- return "Oracle10g (10.1.0.4) JDBC Profile [Test]";
- }
-
- @Override
- protected boolean supportsCatalogs() {
- return false;
- }
-
- @Override
- protected boolean executeOfflineTests() {
- // working offline is pretty ugly
- return false;
- }
-
- public void testDatabase() throws Exception {
- if (this.connectionProfile.getUserName().toUpperCase().equals("SYS")) {
- System.out.println("skipped test: " + this.getClass() + '.' + this.getName());
- return; // SYS does not have a schema
- }
- this.connectionProfile.connect();
- TestConnectionListener listener = new TestConnectionListener();
- this.connectionProfile.addConnectionListener(listener);
-
- // Oracle should have a schema with the same name as the user
- Schema schema = this.getDatabase().getSchemaForIdentifier(this.getUserID());
- assertNotNull(schema);
- assertSame(this.getDatabase().getDefaultSchema(), schema);
-
- this.connectionProfile.removeConnectionListener(listener);
- this.connectionProfile.disconnect();
- }
-
- public void testTable() throws Exception {
- this.connectionProfile.connect();
- TestConnectionListener listener = new TestConnectionListener();
- this.connectionProfile.addConnectionListener(listener);
-
- this.dropTable("foo_baz");
- this.dropTable("baz");
- this.dropTable("foo");
- this.dropTable("bar");
-
- this.executeUpdate(this.buildBarDDL());
- this.executeUpdate(this.buildFooDDL());
- this.executeUpdate(this.buildBazDDL());
- this.executeUpdate(this.buildFooBazDDL());
- ((ICatalogObject) this.getDTPDatabase()).refresh();
-
- Schema schema = this.getDatabase().getDefaultSchema();
-
- // foo
- Table fooTable = schema.getTableForIdentifier("foo");
- assertEquals(3, fooTable.columnsSize());
- assertEquals(1, fooTable.primaryKeyColumnsSize());
- assertEquals(1, fooTable.foreignKeysSize());
-
- Column pkColumn = fooTable.getPrimaryKeyColumn();
- assertEquals("ID", pkColumn.getName());
- Column idColumn = fooTable.getColumnForIdentifier("id");
- assertSame(pkColumn, idColumn);
- assertEquals("NUMBER", idColumn.getDataTypeName());
- assertSame(fooTable, idColumn.getTable());
- assertTrue(idColumn.isPartOfPrimaryKey());
- assertFalse(idColumn.isPartOfForeignKey());
- assertEquals("java.math.BigDecimal", idColumn.getJavaTypeDeclaration());
-
- Column nameColumn = fooTable.getColumnForIdentifier("name");
- assertEquals("VARCHAR2", nameColumn.getDataTypeName());
- assertEquals("java.lang.String", nameColumn.getJavaTypeDeclaration());
- assertFalse(nameColumn.isPartOfPrimaryKey());
-
- Column barColumn = fooTable.getColumnForIdentifier("bar_id");
- assertEquals("NUMBER", barColumn.getDataTypeName());
- assertTrue(barColumn.isPartOfForeignKey());
- assertFalse(barColumn.isPartOfPrimaryKey());
-
- ForeignKey barFK = fooTable.foreignKeys().next(); // there should only be 1 foreign key
- assertEquals(1, barFK.columnPairsSize());
- assertEquals("BAR", barFK.getAttributeName());
- assertNull(barFK.getJoinColumnAnnotationIdentifier("bar"));
- assertEquals("BAR_ID", barFK.getJoinColumnAnnotationIdentifier("primaryBar"));
- assertSame(fooTable, barFK.getBaseTable());
-
- assertFalse(fooTable.isPossibleJoinTable());
- assertSame(schema, fooTable.getSchema());
-
- // BAR
- Table barTable = schema.getTableForIdentifier("bar");
- assertEquals(2, barTable.columnsSize());
- assertEquals(1, barTable.primaryKeyColumnsSize());
- assertEquals(0, barTable.foreignKeysSize());
- assertEquals("ID", barTable.getPrimaryKeyColumn().getName());
- assertFalse(barTable.isPossibleJoinTable());
- assertEquals("BLOB", barTable.getColumnForIdentifier("chunk").getDataTypeName());
- assertEquals("byte[]", barTable.getColumnForIdentifier("chunk").getJavaTypeDeclaration());
- assertTrue(barTable.getColumnForIdentifier("chunk").isLOB());
- assertSame(barTable, barFK.getReferencedTable());
-
- // FOO_BAZ
- Table foo_bazTable = schema.getTableForIdentifier("foo_baz");
- assertEquals(2, foo_bazTable.columnsSize());
- assertEquals(0, foo_bazTable.primaryKeyColumnsSize());
- assertEquals(2, foo_bazTable.foreignKeysSize());
- assertTrue(foo_bazTable.isPossibleJoinTable());
- assertTrue(foo_bazTable.joinTableNameIsDefault());
- assertTrue(foo_bazTable.getColumnForIdentifier("foo_id").isPartOfForeignKey());
-
- this.dropTable("foo_baz");
- this.dropTable("baz");
- this.dropTable("foo");
- this.dropTable("bar");
-
- this.connectionProfile.removeConnectionListener(listener);
- this.connectionProfile.disconnect();
- }
-
- private static final String CR = System.getProperty("line.separator"); //$NON-NLS-1$
-
- private String buildBarDDL() {
- StringBuilder sb = new StringBuilder(200);
- sb.append("CREATE TABLE bar (").append(CR);
- sb.append(" id NUMBER(10) PRIMARY KEY,").append(CR);
- sb.append(" chunk BLOB").append(CR);
- sb.append(")").append(CR);
- return sb.toString();
- }
-
- private String buildFooDDL() {
- StringBuilder sb = new StringBuilder(200);
- sb.append("CREATE TABLE foo (").append(CR);
- sb.append(" id NUMBER(10) PRIMARY KEY,").append(CR);
- sb.append(" name VARCHAR2(20),").append(CR);
- sb.append(" bar_id REFERENCES bar(id)").append(CR);
- sb.append(")").append(CR);
- return sb.toString();
- }
-
- private String buildBazDDL() {
- StringBuilder sb = new StringBuilder(200);
- sb.append("CREATE TABLE baz (").append(CR);
- sb.append(" id NUMBER(10) PRIMARY KEY,").append(CR);
- sb.append(" name VARCHAR2(20)").append(CR);
- sb.append(")").append(CR);
- return sb.toString();
- }
-
- private String buildFooBazDDL() {
- StringBuilder sb = new StringBuilder(200);
- sb.append("CREATE TABLE foo_baz (").append(CR);
- sb.append(" foo_id NUMBER(10) REFERENCES foo(id),").append(CR);
- sb.append(" baz_id NUMBER(10) REFERENCES baz(id)").append(CR);
- sb.append(")").append(CR);
- return sb.toString();
- }
-
- public void testTableLookup() throws Exception {
- this.connectionProfile.connect();
- TestConnectionListener listener = new TestConnectionListener();
- this.connectionProfile.addConnectionListener(listener);
-
- this.dropTable("test1");
- this.dropTable("TEST2");
- this.dropTable("\"test3\"");
-
- this.executeUpdate("CREATE TABLE test1 (id NUMBER(10), name VARCHAR2(20))");
- this.executeUpdate("CREATE TABLE TEST2 (id NUMBER(10), name VARCHAR2(20))");
- this.executeUpdate("CREATE TABLE \"test3\" (id NUMBER(10), name VARCHAR2(20))");
- ((ICatalogObject) this.getDTPDatabase()).refresh();
-
- Schema schema = this.getDatabase().getDefaultSchema();
-
- Table test1Table = schema.getTableForIdentifier("test1");
- assertNotNull(test1Table);
- test1Table = schema.getTableForIdentifier("TEST1");
- assertNotNull(test1Table);
-
- Table test2Table = schema.getTableForIdentifier("test2");
- assertNotNull(test2Table);
- test2Table = schema.getTableForIdentifier("TEST2");
- assertNotNull(test2Table);
-
- Table test3Table = schema.getTableForIdentifier("\"test3\"");
- assertNotNull(test3Table);
- test3Table = schema.getTableForIdentifier("test3");
- assertNull(test3Table);
-
- this.dropTable("test1");
- this.dropTable("TEST2");
- this.dropTable("\"test3\"");
-
- this.connectionProfile.removeConnectionListener(listener);
- this.connectionProfile.disconnect();
- }
-
- public void testColumnLookup() throws Exception {
- this.connectionProfile.connect();
- TestConnectionListener listener = new TestConnectionListener();
- this.connectionProfile.addConnectionListener(listener);
-
- this.dropTable("test");
-
- // lowercase
- this.executeUpdate("CREATE TABLE test (id NUMBER(10), name VARCHAR2(20))");
- ((ICatalogObject) this.getDTPDatabase()).refresh();
-
- Table table = this.getDatabase().getDefaultSchema().getTableForIdentifier("test");
- assertNotNull(table.getColumnForIdentifier("id"));
- assertNotNull(table.getColumnForIdentifier("name"));
-
- this.dropTable("test");
-
- // uppercase
- this.executeUpdate("CREATE TABLE test (ID NUMBER(10), NAME VARCHAR2(20))");
- ((ICatalogObject) this.getDTPDatabase()).refresh();
-
- table = this.getDatabase().getDefaultSchema().getTableForIdentifier("test");
- assertNotNull(table.getColumnForIdentifier("ID"));
- assertNotNull(table.getColumnForIdentifier("NAME"));
-
- this.dropTable("test");
-
- // mixed case
- this.executeUpdate("CREATE TABLE test (Id NUMBER(10), Name VARCHAR2(20))");
- ((ICatalogObject) this.getDTPDatabase()).refresh();
-
- table = this.getDatabase().getDefaultSchema().getTableForIdentifier("test");
- assertNotNull(table.getColumnForIdentifier("Id"));
- assertNotNull(table.getColumnForIdentifier("Name"));
-
- this.dropTable("test");
-
- // delimited
- this.executeUpdate("CREATE TABLE test (\"Id\" NUMBER(10), \"Name\" VARCHAR2(20))");
- ((ICatalogObject) this.getDTPDatabase()).refresh();
-
- table = this.getDatabase().getDefaultSchema().getTableForIdentifier("test");
- assertNotNull(table.getColumnForIdentifier("\"Id\""));
- assertNotNull(table.getColumnForIdentifier("\"Name\""));
-
- this.dropTable("test");
-
- this.connectionProfile.removeConnectionListener(listener);
- this.connectionProfile.disconnect();
- }
-
- public void testCrossSchemaReference() throws Exception {
- if ( ! this.connectionProfile.getUserName().toUpperCase().equals("SYS")) {
- System.out.println("skipped test: " + this.getClass() + '.' + this.getName());
- return; // SYS does not have a schema
- }
- this.connectionProfile.connect();
- TestConnectionListener listener = new TestConnectionListener();
- this.connectionProfile.addConnectionListener(listener);
-
- this.executeUpdateIgnoreErrors("DROP USER XREF_TEST2 CASCADE");
- this.executeUpdateIgnoreErrors("DROP USER XREF_TEST1 CASCADE");
-
- this.executeUpdate("CREATE USER XREF_TEST1 IDENTIFIED BY foo");
- this.executeUpdate("ALTER USER XREF_TEST1 QUOTA UNLIMITED ON USERS");
- this.executeUpdate("CREATE TABLE XREF_TEST1.ORG (ID NUMBER(10) PRIMARY KEY, NAME VARCHAR2(20))");
-
- this.executeUpdate("CREATE USER XREF_TEST2 IDENTIFIED BY foo");
- this.executeUpdate("ALTER USER XREF_TEST2 QUOTA UNLIMITED ON USERS");
- this.executeUpdate("GRANT ALL ON XREF_TEST1.ORG TO XREF_TEST2");
- this.executeUpdate("CREATE TABLE XREF_TEST2.EMP (ID NUMBER(10) PRIMARY KEY, NAME VARCHAR2(20), " +
- "ORG_ID NUMBER(10) REFERENCES XREF_TEST1.ORG(ID))");
-
- ((ICatalogObject) this.getDTPDatabase()).refresh();
- Schema schema1 = this.getDatabase().getSchemaNamed("XREF_TEST1");
- assertNotNull(schema1);
- Table orgTable = schema1.getTableNamed("ORG");
- assertNotNull(orgTable);
-
- Schema schema2 = this.getDatabase().getSchemaNamed("XREF_TEST2");
- assertNotNull(schema2);
- Table empTable = schema2.getTableNamed("EMP");
- assertNotNull(empTable);
- assertEquals(1, empTable.foreignKeysSize());
- ForeignKey fk = empTable.foreignKeys().next();
- Table refTable = fk.getReferencedTable();
- assertNotNull(refTable);
- assertEquals("ORG", refTable.getName());
- assertEquals(1, fk.columnPairsSize());
- ForeignKey.ColumnPair cp = fk.columnPairs().next();
- Column baseColumn = cp.getBaseColumn();
- assertEquals("ORG_ID", baseColumn.getName());
- Column refColumn = cp.getReferencedColumn();
- assertEquals("ID", refColumn.getName());
-
- this.executeUpdate("DROP USER XREF_TEST2 CASCADE");
- this.executeUpdate("DROP USER XREF_TEST1 CASCADE");
- this.connectionProfile.removeConnectionListener(listener);
- this.connectionProfile.disconnect();
- }
-
- private void dropTable(String tableName) throws Exception {
- this.executeUpdateIgnoreErrors("DROP TABLE " + tableName + " CASCADE CONSTRAINTS");
- }
-
-// need Oracle enablement plug-in
-// public void testSequence() throws Exception {
-// this.connectionProfile.connect();
-// TestConnectionListener listener = new TestConnectionListener();
-// this.connectionProfile.addConnectionListener(listener);
-//
-// this.dropSequence("FOO_SEQ");
-//
-// this.executeUpdate("CREATE SEQUENCE FOO_SEQ");
-// ((ICatalogObject) this.getDTPDatabase()).refresh();
-//
-// Sequence sequence = this.getDatabase().getDefaultSchema().getSequenceForIdentifier("FOO");
-// assertNotNull(sequence);
-// assertEquals("FOO_SEQ", sequence.getName());
-//
-// this.dropSequence("FOO_SEQ");
-//
-// this.connectionProfile.removeConnectionListener(listener);
-// this.connectionProfile.disconnect();
-// }
-//
-// private void dropSequence(String sequenceName) throws Exception {
-// this.executeUpdateIgnoreErrors("DROP SEQUENCE " + sequenceName);
-// }
-//
- protected void dumpUserObjects() throws SQLException {
- this.dump("select * from user_objects");
- }
-
-}
diff --git a/jpa/tests/org.eclipse.jpt.db.tests/src/org/eclipse/jpt/db/tests/internal/platforms/Oracle10gXETests.java b/jpa/tests/org.eclipse.jpt.db.tests/src/org/eclipse/jpt/db/tests/internal/platforms/Oracle10gXETests.java
deleted file mode 100644
index 7f309f8520..0000000000
--- a/jpa/tests/org.eclipse.jpt.db.tests/src/org/eclipse/jpt/db/tests/internal/platforms/Oracle10gXETests.java
+++ /dev/null
@@ -1,79 +0,0 @@
-/*******************************************************************************
- * Copyright (c) 2007, 2008 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.
- *
- * Contributors:
- * Oracle - initial API and implementation
- ******************************************************************************/
-package org.eclipse.jpt.db.tests.internal.platforms;
-
-
-/**
- * Oracle 10g Thin Driver Test
- */
-@SuppressWarnings("nls")
-public class Oracle10gXETests extends DTPPlatformTests {
-
- public Oracle10gXETests( String name) {
- super( name);
- }
-
- @Override
- protected String getPlatformPropertiesFileName() {
- return "oracle10gXE.properties";
- }
-
- @Override
- protected String getDriverName() {
- return "Oracle 10g Thin Driver";
- }
-
- @Override
- protected String getDriverDefinitionID() {
- return "DriverDefn.Oracle Thin Driver";
- }
-
- @Override
- protected String getDriverDefinitionType() {
- return "org.eclipse.datatools.enablement.oracle.10.driverTemplate";
- }
-
- @Override
- protected String getDatabaseVendor() {
- return "Oracle";
- }
-
- @Override
- protected String getDatabaseVersion() {
- return "10";
- }
-
- @Override
- protected String getDriverClass() {
- return "oracle.jdbc.OracleDriver";
- }
-
- @Override
- protected String getProfileName() {
- return "Oracle10g_XE";
- }
-
- @Override
- protected String getProfileDescription() {
- return "Oracle10g XE Release 2 (10.2) JDBC Profile [Test]";
- }
-
- @Override
- protected boolean supportsCatalogs() {
- return false;
- }
-
- @Override
- protected boolean executeOfflineTests() {
- // working offline is pretty ugly
- return false;
- }
-
-}
diff --git a/jpa/tests/org.eclipse.jpt.db.tests/src/org/eclipse/jpt/db/tests/internal/platforms/Oracle9iTests.java b/jpa/tests/org.eclipse.jpt.db.tests/src/org/eclipse/jpt/db/tests/internal/platforms/Oracle9iTests.java
deleted file mode 100644
index 9d1c474849..0000000000
--- a/jpa/tests/org.eclipse.jpt.db.tests/src/org/eclipse/jpt/db/tests/internal/platforms/Oracle9iTests.java
+++ /dev/null
@@ -1,79 +0,0 @@
-/*******************************************************************************
- * Copyright (c) 2007, 2008 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.
- *
- * Contributors:
- * Oracle - initial API and implementation
- ******************************************************************************/
-package org.eclipse.jpt.db.tests.internal.platforms;
-
-
-/**
- * Oracle 9i Thin Driver Test
- */
-@SuppressWarnings("nls")
-public class Oracle9iTests extends DTPPlatformTests {
-
- public Oracle9iTests( String name) {
- super( name);
- }
-
- @Override
- protected String getPlatformPropertiesFileName() {
- return "oracle9i.properties";
- }
-
- @Override
- protected String getDriverName() {
- return "Oracle 9i Thin Driver";
- }
-
- @Override
- protected String getDriverDefinitionID() {
- return "DriverDefn.Oracle Thin Driver";
- }
-
- @Override
- protected String getDriverDefinitionType() {
- return "org.eclipse.datatools.enablement.oracle.9.driverTemplate";
- }
-
- @Override
- protected String getDatabaseVendor() {
- return "Oracle";
- }
-
- @Override
- protected String getDatabaseVersion() {
- return "9";
- }
-
- @Override
- protected String getDriverClass() {
- return "oracle.jdbc.OracleDriver";
- }
-
- @Override
- protected String getProfileName() {
- return "Oracle9i";
- }
-
- @Override
- protected String getProfileDescription() {
- return "Oracle9i JDBC Profile [Test]";
- }
-
- @Override
- protected boolean supportsCatalogs() {
- return false;
- }
-
- @Override
- protected boolean executeOfflineTests() {
- // working offline is pretty ugly
- return false;
- }
-
-}
diff --git a/jpa/tests/org.eclipse.jpt.db.tests/src/org/eclipse/jpt/db/tests/internal/platforms/PostgreSQLTests.java b/jpa/tests/org.eclipse.jpt.db.tests/src/org/eclipse/jpt/db/tests/internal/platforms/PostgreSQLTests.java
deleted file mode 100644
index 7066141a5c..0000000000
--- a/jpa/tests/org.eclipse.jpt.db.tests/src/org/eclipse/jpt/db/tests/internal/platforms/PostgreSQLTests.java
+++ /dev/null
@@ -1,486 +0,0 @@
-/*******************************************************************************
- * Copyright (c) 2007, 2009 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.
- *
- * Contributors:
- * Oracle - initial API and implementation
- ******************************************************************************/
-package org.eclipse.jpt.db.tests.internal.platforms;
-
-import org.eclipse.datatools.connectivity.sqm.core.rte.ICatalogObject;
-import org.eclipse.jpt.db.Column;
-import org.eclipse.jpt.db.ForeignKey;
-import org.eclipse.jpt.db.Schema;
-import org.eclipse.jpt.db.Table;
-
-@SuppressWarnings("nls")
-public class PostgreSQLTests extends DTPPlatformTests {
-
- public PostgreSQLTests( String name) {
- super( name);
- }
-
- @Override
- protected String getPlatformPropertiesFileName() {
- return "postgresql.properties";
- }
-
- @Override
- protected String getDriverName() {
- return "PostgreSQL JDBC Driver";
- }
-
- @Override
- protected String getDriverDefinitionID() {
- return "DriverDefn.PostgreSQL JDBC Driver";
- }
-
- @Override
- protected String getDriverDefinitionType() {
- return "org.eclipse.datatools.enablement.postgresql.postgresqlDriverTemplate";
- }
-
- @Override
- protected String getDatabaseVendor() {
- return "postgres";
- }
-
- @Override
- protected String getDatabaseVersion() {
- return "8.x";
- }
-
- @Override
- protected String getDriverClass() {
- return "org.postgresql.Driver";
- }
-
- @Override
- protected String getDefaultJDBCURL() {
- // using this URL will result in the DTP database containing a single
- // catalog named "" - which, unfortunately, resembles the pseudo-catalog
- // generated by DTP for databases that do not return any catalogs via
- // JDBC metadata calls...
- return "jdbc:postgresql";
- }
-
- @Override
- protected String getProfileName() {
- return "PostgreSQL";
- }
-
- @Override
- protected String getProfileDescription() {
- return "PostgreSQL 8.2 JDBC Profile [Test]";
- }
-
- @Override
- protected boolean supportsCatalogs() {
- return true;
- }
-
- @Override
- protected boolean executeOfflineTests() {
- // DTP does not support PostgreSQL off-line - see 226704/241558
- return false;
- }
-
- public void testSchema() throws Exception {
- this.connectionProfile.connect();
- TestConnectionListener listener = new TestConnectionListener();
- this.connectionProfile.addConnectionListener(listener);
-
- this.dropSchema("TEST1");
- this.dropSchema("TEST2");
-
- this.executeUpdate("CREATE SCHEMA TEST1");
- ((ICatalogObject) this.getDTPDatabase()).refresh();
-
- Schema schema1 = this.getDefaultCatalog().getSchemaForIdentifier("TEST1");
- assertNotNull(schema1);
-
- this.executeUpdate("CREATE SCHEMA TEST2");
- Schema schema2 = this.getDefaultCatalog().getSchemaForIdentifier("TEST2");
- assertNull(schema2); // should be null until refresh
-
- ((ICatalogObject) this.getDTPDatabase()).refresh();
- assertSame(this.getDatabase(), listener.changedDatabase);
-
- schema2 = this.getDefaultCatalog().getSchemaForIdentifier("TEST2");
- assertNotNull(schema2);
- assertNotSame(schema1, this.getDefaultCatalog().getSchemaForIdentifier("TEST1")); // we should have a new schema after the refresh
-
- this.dropSchema("TEST2");
- this.dropSchema("TEST1");
- this.connectionProfile.removeConnectionListener(listener);
- this.connectionProfile.disconnect();
- }
-
- public void testSchemaLookup() throws Exception {
- this.connectionProfile.connect();
- TestConnectionListener listener = new TestConnectionListener();
- this.connectionProfile.addConnectionListener(listener);
-
- this.dropSchema("LOOKUP_TEST");
- this.dropSchema("\"lookup_TEST\"");
-
- this.executeUpdate("CREATE SCHEMA LOOKUP_TEST");
- ((ICatalogObject) this.getDTPDatabase()).refresh();
-
- assertNull(this.getDefaultCatalog().getSchemaNamed("LOOKUP_TEST"));
- assertNotNull(this.getDefaultCatalog().getSchemaForIdentifier("LOOKUP_TEST"));
-
- assertNotNull(this.getDefaultCatalog().getSchemaNamed("lookup_test"));
- assertNotNull(this.getDefaultCatalog().getSchemaForIdentifier("lookup_test"));
-
- assertNull(this.getDefaultCatalog().getSchemaNamed("lookup_TEST"));
- assertNotNull(this.getDefaultCatalog().getSchemaForIdentifier("lookup_TEST"));
-
- assertNotNull(this.getDefaultCatalog().getSchemaForIdentifier("\"lookup_test\""));
- assertNull(this.getDefaultCatalog().getSchemaForIdentifier("\"lookup_TEST\""));
- assertNull(this.getDefaultCatalog().getSchemaForIdentifier("\"LOOKUP_TEST\""));
-
- this.dropSchema("LOOKUP_TEST");
-
- this.executeUpdate("CREATE SCHEMA \"lookup_TEST\"");
- ((ICatalogObject) this.getDTPDatabase()).refresh();
-
- assertNull(this.getDefaultCatalog().getSchemaNamed("LOOKUP_TEST"));
- assertNull(this.getDefaultCatalog().getSchemaForIdentifier("LOOKUP_TEST"));
-
- assertNull(this.getDefaultCatalog().getSchemaNamed("lookup_test"));
- assertNull(this.getDefaultCatalog().getSchemaForIdentifier("lookup_test"));
-
- assertNotNull(this.getDefaultCatalog().getSchemaNamed("lookup_TEST"));
- assertNull(this.getDefaultCatalog().getSchemaForIdentifier("lookup_TEST"));
-
- assertNull(this.getDefaultCatalog().getSchemaForIdentifier("\"LOOKUP_TEST\""));
- assertNotNull(this.getDefaultCatalog().getSchemaForIdentifier("\"lookup_TEST\""));
-
- this.dropSchema("\"lookup_TEST\"");
-
- this.connectionProfile.removeConnectionListener(listener);
- this.connectionProfile.disconnect();
- }
-
- public void testSchemaIdentifier() throws Exception {
- this.connectionProfile.connect();
- TestConnectionListener listener = new TestConnectionListener();
- this.connectionProfile.addConnectionListener(listener);
-
- this.dropSchema("LOOKUP_TEST");
- this.dropSchema("\"lookup_TEST\"");
-
- this.executeUpdate("CREATE SCHEMA lookup_test"); // this gets folded to lowercase
- this.executeUpdate("CREATE SCHEMA \"lookup_TEST\"");
- ((ICatalogObject) this.getDTPDatabase()).refresh();
-
- Schema schema = this.getDefaultCatalog().getSchemaForIdentifier("LOOKUP_TEST");
- assertEquals("lookup_test", schema.getIdentifier());
- assertEquals("lookup_test", schema.getIdentifier("LookupTest"));
- assertNull(schema.getIdentifier("Lookup_Test"));
-
- schema = this.getDefaultCatalog().getSchemaNamed("lookup_test");
- assertEquals("lookup_test", schema.getIdentifier());
-
- schema = this.getDefaultCatalog().getSchemaForIdentifier("\"lookup_TEST\"");
- assertEquals("\"lookup_TEST\"", schema.getIdentifier());
- assertEquals("\"lookup_TEST\"", schema.getIdentifier("lookup_TEST"));
-
- this.dropSchema("\"lookup_TEST\"");
- this.dropSchema("LOOKUP_TEST");
-
- this.connectionProfile.removeConnectionListener(listener);
- this.connectionProfile.disconnect();
- }
-
- public void testTable() throws Exception {
- this.connectionProfile.connect();
- TestConnectionListener listener = new TestConnectionListener();
- this.connectionProfile.addConnectionListener(listener);
-
- this.dropTable("TABLE_TEST", "FOO_BAZ");
- this.dropTable("TABLE_TEST", "BAZ");
- this.dropTable("TABLE_TEST", "FOO");
- this.dropTable("TABLE_TEST", "BAR");
- this.dropSchema("TABLE_TEST");
-
- this.executeUpdate("CREATE SCHEMA TABLE_TEST");
- this.executeUpdate("SET search_path TO TABLE_TEST");
-
- this.executeUpdate(this.buildBarDDL());
- this.executeUpdate(this.buildFooDDL());
- this.executeUpdate(this.buildBazDDL());
- this.executeUpdate(this.buildFooBazDDL());
- ((ICatalogObject) this.getDTPDatabase()).refresh();
-
- Schema schema = this.getDefaultCatalog().getSchemaForIdentifier("TABLE_TEST");
-
- // FOO
- Table fooTable = schema.getTableForIdentifier("FOO");
- assertEquals(3, fooTable.columnsSize());
- assertEquals(1, fooTable.primaryKeyColumnsSize());
- assertEquals(1, fooTable.foreignKeysSize());
-
- Column pkColumn = fooTable.getPrimaryKeyColumn();
- assertEquals("id", pkColumn.getName());
- Column idColumn = fooTable.getColumnForIdentifier("ID");
- assertSame(pkColumn, idColumn);
- assertEquals("INT4", idColumn.getDataTypeName());
- assertSame(fooTable, idColumn.getTable());
- assertTrue(idColumn.isPartOfPrimaryKey());
- assertFalse(idColumn.isPartOfForeignKey());
- assertEquals("java.lang.Integer", idColumn.getJavaTypeDeclaration());
-
- Column nameColumn = fooTable.getColumnForIdentifier("NAME");
- assertEquals("VARCHAR", nameColumn.getDataTypeName());
- assertEquals("java.lang.String", nameColumn.getJavaTypeDeclaration());
- assertFalse(nameColumn.isPartOfPrimaryKey());
-
- Column barColumn = fooTable.getColumnForIdentifier("BAR_ID");
- assertEquals("INT4", barColumn.getDataTypeName());
- assertTrue(barColumn.isPartOfForeignKey());
- assertFalse(barColumn.isPartOfPrimaryKey());
-
- ForeignKey barFK = fooTable.foreignKeys().next(); // there should only be 1 foreign key
- assertEquals(1, barFK.columnPairsSize());
- assertEquals("bar", barFK.getAttributeName());
- assertNull(barFK.getJoinColumnAnnotationIdentifier("bar"));
- assertEquals("bar_id", barFK.getJoinColumnAnnotationIdentifier("primaryBar"));
- assertSame(fooTable, barFK.getBaseTable());
-
- assertFalse(fooTable.isPossibleJoinTable());
- assertSame(schema, fooTable.getSchema());
-
- // BAR
- Table barTable = schema.getTableForIdentifier("BAR");
- assertEquals(2, barTable.columnsSize());
- assertEquals(1, barTable.primaryKeyColumnsSize());
- assertEquals(0, barTable.foreignKeysSize());
- assertEquals("id", barTable.getPrimaryKeyColumn().getName());
- assertFalse(barTable.isPossibleJoinTable());
- assertEquals("BYTEA", barTable.getColumnForIdentifier("CHUNK").getDataTypeName());
- assertEquals("byte[]", barTable.getColumnForIdentifier("CHUNK").getJavaTypeDeclaration());
- // assertTrue(barTable.getColumnForIdentifier("CHUNK").dataTypeIsLOB());
- assertSame(barTable, barFK.getReferencedTable());
-
- // FOO_BAZ
- Table foo_bazTable = schema.getTableForIdentifier("FOO_BAZ");
- assertEquals(2, foo_bazTable.columnsSize());
- assertEquals(0, foo_bazTable.primaryKeyColumnsSize());
- assertEquals(2, foo_bazTable.foreignKeysSize());
- assertTrue(foo_bazTable.isPossibleJoinTable());
- assertTrue(foo_bazTable.joinTableNameIsDefault());
- assertTrue(foo_bazTable.getColumnForIdentifier("FOO_ID").isPartOfForeignKey());
-
- this.dropTable("TABLE_TEST", "FOO_BAZ");
- this.dropTable("TABLE_TEST", "BAZ");
- this.dropTable("TABLE_TEST", "FOO");
- this.dropTable("TABLE_TEST", "BAR");
- this.dropSchema("TABLE_TEST");
-
- this.connectionProfile.removeConnectionListener(listener);
- this.connectionProfile.disconnect();
- }
-
- private static final String CR = System.getProperty("line.separator"); //$NON-NLS-1$
-
- private String buildBarDDL() {
- StringBuilder sb = new StringBuilder(200);
- sb.append("CREATE TABLE BAR (").append(CR);
- sb.append(" ID integer PRIMARY KEY,").append(CR);
- sb.append(" CHUNK bytea").append(CR);
- sb.append(")").append(CR);
- return sb.toString();
- }
-
- private String buildFooDDL() {
- StringBuilder sb = new StringBuilder(200);
- sb.append("CREATE TABLE FOO (").append(CR);
- sb.append(" ID integer PRIMARY KEY,").append(CR);
- sb.append(" NAME varchar(20),").append(CR);
- sb.append(" BAR_ID integer REFERENCES BAR(ID)").append(CR);
- sb.append(")").append(CR);
- return sb.toString();
- }
-
- private String buildBazDDL() {
- StringBuilder sb = new StringBuilder(200);
- sb.append("CREATE TABLE BAZ (").append(CR);
- sb.append(" ID integer PRIMARY KEY,").append(CR);
- sb.append(" NAME varchar(20)").append(CR);
- sb.append(")").append(CR);
- return sb.toString();
- }
-
- private String buildFooBazDDL() {
- StringBuilder sb = new StringBuilder(200);
- sb.append("CREATE TABLE FOO_BAZ (").append(CR);
- sb.append(" FOO_ID int REFERENCES FOO(ID),").append(CR);
- sb.append(" BAZ_ID int REFERENCES BAZ(ID)").append(CR);
- sb.append(")").append(CR);
- return sb.toString();
- }
-
- public void testColumnLookup() throws Exception {
- this.connectionProfile.connect();
- TestConnectionListener listener = new TestConnectionListener();
- this.connectionProfile.addConnectionListener(listener);
-
- this.dropTable("TABLE_TEST", "test");
- this.dropSchema("TABLE_TEST");
-
- this.executeUpdate("CREATE SCHEMA TABLE_TEST");
- this.executeUpdate("SET search_path TO TABLE_TEST");
-
- // lowercase
- this.executeUpdate("CREATE TABLE test (id int, name varchar(20))");
- ((ICatalogObject) this.getDTPDatabase()).refresh();
-
- Table table = this.getDefaultCatalog().getSchemaForIdentifier("TABLE_TEST").getTableForIdentifier("test");
- assertNotNull(table.getColumnForIdentifier("id"));
- assertNotNull(table.getColumnForIdentifier("name"));
-
- this.dropTable("TABLE_TEST", "test");
-
- // uppercase
- this.executeUpdate("CREATE TABLE test (ID int, NAME varchar(20))");
- ((ICatalogObject) this.getDTPDatabase()).refresh();
-
- table = this.getDefaultCatalog().getSchemaForIdentifier("TABLE_TEST").getTableForIdentifier("test");
- assertNotNull(table.getColumnForIdentifier("ID"));
- assertNotNull(table.getColumnForIdentifier("NAME"));
-
- this.dropTable("TABLE_TEST", "test");
-
- // mixed case
- this.executeUpdate("CREATE TABLE test (Id int, Name varchar(20))");
- ((ICatalogObject) this.getDTPDatabase()).refresh();
-
- table = this.getDefaultCatalog().getSchemaForIdentifier("TABLE_TEST").getTableForIdentifier("test");
- assertNotNull(table.getColumnForIdentifier("Id"));
- assertNotNull(table.getColumnForIdentifier("Name"));
-
- this.dropTable("TABLE_TEST", "test");
-
- // delimited
- this.executeUpdate("CREATE TABLE test (\"Id\" int, \"Name\" varchar(20))");
- ((ICatalogObject) this.getDTPDatabase()).refresh();
-
- table = this.getDefaultCatalog().getSchemaForIdentifier("TABLE_TEST").getTableForIdentifier("test");
- assertNotNull(table.getColumnForIdentifier("\"Id\""));
- assertNotNull(table.getColumnForIdentifier("\"Name\""));
-
- this.dropTable("TABLE_TEST", "test");
- this.dropSchema("TABLE_TEST");
-
- this.connectionProfile.removeConnectionListener(listener);
- this.connectionProfile.disconnect();
- }
-
- public void testCrossSchemaReference() throws Exception {
- this.connectionProfile.connect();
- TestConnectionListener listener = new TestConnectionListener();
- this.connectionProfile.addConnectionListener(listener);
-
- this.dropTable("XREF_TEST2", "EMP");
- this.dropSchema("XREF_TEST2");
- this.dropTable("XREF_TEST1", "ORG");
- this.dropSchema("XREF_TEST1");
-
- this.executeUpdate("CREATE SCHEMA XREF_TEST1");
- this.executeUpdate("SET search_path TO XREF_TEST1");
- this.executeUpdate("CREATE TABLE ORG (ID integer PRIMARY KEY, NAME varchar(20))");
-
- this.executeUpdate("CREATE SCHEMA XREF_TEST2");
- this.executeUpdate("SET search_path TO XREF_TEST2");
- this.executeUpdate("CREATE TABLE EMP (ID integer PRIMARY KEY, NAME varchar(20), " +
- "ORG_ID integer REFERENCES XREF_TEST1.ORG(ID))");
-
- ((ICatalogObject) this.getDTPDatabase()).refresh();
- Schema schema1 = this.getDatabase().getDefaultCatalog().getSchemaNamed("xref_test1");
- assertNotNull(schema1);
- Table orgTable = schema1.getTableNamed("org");
- assertNotNull(orgTable);
-
- Schema schema2 = this.getDatabase().getDefaultCatalog().getSchemaNamed("xref_test2");
- assertNotNull(schema2);
- Table empTable = schema2.getTableNamed("emp");
- assertNotNull(empTable);
- assertEquals(1, empTable.foreignKeysSize());
- ForeignKey fk = empTable.foreignKeys().next();
- Table refTable = fk.getReferencedTable();
- assertNotNull(refTable);
- assertEquals("org", refTable.getName());
- assertEquals(1, fk.columnPairsSize());
- ForeignKey.ColumnPair cp = fk.columnPairs().next();
- Column baseColumn = cp.getBaseColumn();
- assertEquals("org_id", baseColumn.getName());
- Column refColumn = cp.getReferencedColumn();
- assertEquals("id", refColumn.getName());
-
- this.dropTable("XREF_TEST2", "EMP");
- this.dropSchema("XREF_TEST2");
- this.dropTable("XREF_TEST1", "ORG");
- this.dropSchema("XREF_TEST1");
- this.connectionProfile.removeConnectionListener(listener);
- this.connectionProfile.disconnect();
- }
-
- private void dropTable(String schemaName, String tableName) throws Exception {
- Schema schema= this.getDefaultCatalog().getSchemaForIdentifier(schemaName);
- if (schema != null) {
- if (schema.getTableForIdentifier(tableName) != null) {
- this.executeUpdate("DROP TABLE " + schemaName + '.' + tableName);
- }
- }
- }
-
- private void dropSchema(String name) throws Exception {
- if (this.getDefaultCatalog().getSchemaForIdentifier(name) != null) {
- this.executeUpdate("DROP SCHEMA " + name + " CASCADE");
- }
- }
-
-// see 241578/241557
-// public void testSequence() throws Exception {
-// this.connectionProfile.connect();
-// TestConnectionListener listener = new TestConnectionListener();
-// this.connectionProfile.addConnectionListener(listener);
-//
-// this.dropSequence("SEQUENCE_TEST", "FOO");
-// this.dropSchema("SEQUENCE_TEST");
-//
-// this.executeUpdate("CREATE SCHEMA SEQUENCE_TEST");
-// this.executeUpdate("SET search_path TO SEQUENCE_TEST");
-//
-// this.executeUpdate(this.buildBarDDL());
-// this.executeUpdate("CREATE SEQUENCE FOO START 1");
-//// List<Object[]> list = this.execute("SELECT nextval('foo')");
-//// System.out.println(list);
-// ((ICatalogObject) this.getDTPDatabase()).refresh();
-//
-// Schema schema = this.getDefaultCatalog().getSchemaNamed("SEQUENCE_TEST");
-// Sequence sequence = schema.getSequenceNamed("FOO");
-// assertNotNull(sequence);
-// assertEquals("foo_seq", sequence.getName());
-//
-// this.dropSequence("SEQUENCE_TEST", "FOO");
-// this.dropSchema("SEQUENCE_TEST");
-//
-// this.connectionProfile.removeConnectionListener(listener);
-// this.connectionProfile.disconnect();
-// }
-//
-// private void dropSequence(String schemaName, String sequenceName) throws Exception {
-// Schema schema= this.getDefaultCatalog().getSchemaNamed(schemaName);
-// if (schema != null) {
-// if (schema.getSequenceNamed(sequenceName) != null) {
-// this.executeUpdate("DROP SEQUENCE " + schemaName + '.' + sequenceName);
-// }
-// }
-// }
-//
-}
diff --git a/jpa/tests/org.eclipse.jpt.db.tests/src/org/eclipse/jpt/db/tests/internal/platforms/SQLServerTests.java b/jpa/tests/org.eclipse.jpt.db.tests/src/org/eclipse/jpt/db/tests/internal/platforms/SQLServerTests.java
deleted file mode 100644
index cedde5d7c4..0000000000
--- a/jpa/tests/org.eclipse.jpt.db.tests/src/org/eclipse/jpt/db/tests/internal/platforms/SQLServerTests.java
+++ /dev/null
@@ -1,83 +0,0 @@
-/*******************************************************************************
- * Copyright (c) 2007, 2008 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.
- *
- * Contributors:
- * Oracle - initial API and implementation
- ******************************************************************************/
-package org.eclipse.jpt.db.tests.internal.platforms;
-
-
-/**
- * SQL Server 2005 Driver Test
- */
-@SuppressWarnings("nls")
-public class SQLServerTests extends DTPPlatformTests {
-
- public SQLServerTests( String name) {
- super( name);
- }
-
- @Override
- protected String getPlatformPropertiesFileName() {
- return "sqlserver.properties";
- }
-
- @Override
- protected String getDriverName() {
- return "Microsoft SQL Server 2005 JDBC Driver";
- }
-
- @Override
- protected String getDriverDefinitionID() {
- return "DriverDefn.Microsoft SQL Server 2005 JDBC Driver";
- }
-
- @Override
- protected String getDriverDefinitionType() {
- return "org.eclipse.datatools.enablement.msft.sqlserver.2005.driverTemplate";
- }
-
- @Override
- protected String getDatabaseVendor() {
- return "SQLServer";
- }
-
- @Override
- protected String getDatabaseVersion() {
- return "2005";
- }
-
- @Override
- protected String getDriverClass() {
- return "com.microsoft.sqlserver.jdbc.SQLServerDriver";
- }
-
- @Override
- protected String getProfileName() {
- return "SQLServer_2005";
- }
-
- @Override
- protected String getProfileDescription() {
- return "Microsoft SQL Server 2005 JDBC Profile [Test]";
- }
-
- @Override
- protected String getProviderID() {
- return "org.eclipse.datatools.connectivity.db.generic.connectionProfile";
- }
-
- @Override
- protected boolean supportsCatalogs() {
- return true;
- }
-
- @Override
- protected boolean executeOfflineTests() {
- return true; // haven't actually tried this yet...
- }
-
-}
diff --git a/jpa/tests/org.eclipse.jpt.db.tests/src/org/eclipse/jpt/db/tests/internal/platforms/SybaseTests.java b/jpa/tests/org.eclipse.jpt.db.tests/src/org/eclipse/jpt/db/tests/internal/platforms/SybaseTests.java
deleted file mode 100644
index b5f54cb8f8..0000000000
--- a/jpa/tests/org.eclipse.jpt.db.tests/src/org/eclipse/jpt/db/tests/internal/platforms/SybaseTests.java
+++ /dev/null
@@ -1,443 +0,0 @@
-/*******************************************************************************
- * Copyright (c) 2007, 2009 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.
- *
- * Contributors:
- * Oracle - initial API and implementation
- ******************************************************************************/
-package org.eclipse.jpt.db.tests.internal.platforms;
-
-import org.eclipse.datatools.connectivity.sqm.core.rte.ICatalogObject;
-import org.eclipse.jpt.db.Catalog;
-import org.eclipse.jpt.db.Column;
-import org.eclipse.jpt.db.ForeignKey;
-import org.eclipse.jpt.db.Schema;
-import org.eclipse.jpt.db.Table;
-
-@SuppressWarnings("nls")
-public class SybaseTests extends DTPPlatformTests {
-
- public SybaseTests( String name) {
- super( name);
- }
-
- @Override
- protected String getPlatformPropertiesFileName() {
- return "sybase.properties";
- }
-
- @Override
- protected String getDriverName() {
- return "Sybase JDBC Driver for Sybase ASE 15.x";
- }
-
- @Override
- protected String getDriverDefinitionID() {
- return "DriverDefn.Sybase JDBC Driver for Sybase ASE 15.x";
- }
-
- @Override
- protected String getDriverDefinitionType() {
- return "org.eclipse.datatools.connectivity.db.sybase.ase.genericDriverTemplate_15";
- }
-
- @Override
- protected String getDatabaseVendor() {
- return "Sybase_ASE";
- }
-
- @Override
- protected String getDatabaseVersion() {
- return "15.x";
- }
-
- @Override
- protected String getDriverClass() {
- return "com.sybase.jdbc3.jdbc.SybDriver";
- }
-
- @Override
- protected String getProfileName() {
- return "Sybase_15";
- }
-
- @Override
- protected String getProfileDescription() {
- return "Sybase ASE 15 jConnect JDBC Profile [Test]";
- }
-
- @Override
- protected boolean supportsCatalogs() {
- return true;
- }
-
- @Override
- protected boolean executeOfflineTests() {
- // working offline is pretty ugly
- return false;
- }
-
- /**
- * Sybase "databases" become DTP "catalogs"
- */
- public void testCatalog() throws Exception {
- this.connectionProfile.connect();
- TestConnectionListener listener = new TestConnectionListener();
- this.connectionProfile.addConnectionListener(listener);
-
- this.getJDBCConnection().setCatalog("master");
- this.executeUpdateIgnoreErrors("drop database test1");
- this.executeUpdateIgnoreErrors("drop database test2");
-
- this.executeUpdate("create database test1");
- ((ICatalogObject) this.getDTPDatabase()).refresh();
-
- Catalog catalog1 = this.getDatabase().getCatalogNamed("test1");
- assertNotNull(catalog1);
- Schema schema1 = catalog1.getSchemaNamed("dbo");
- assertNotNull(schema1);
- assertSame(schema1, catalog1.getDefaultSchema());
-
- this.executeUpdate("create database test2");
- Catalog catalog2 = this.getDatabase().getCatalogNamed("test2");
- assertNull(catalog2); // should be null until refresh
-
- ((ICatalogObject) this.getDTPDatabase()).refresh();
- assertSame(this.getDatabase(), listener.changedDatabase);
-
- catalog2 = this.getDatabase().getCatalogNamed("test2");
- assertNotNull(catalog2);
- Schema schema2 = catalog2.getDefaultSchema();
- assertNotNull(schema2);
-
- assertNotSame(catalog1, this.getDatabase().getCatalogNamed("test1")); // we should have a new catalog after the refresh
- assertNotSame(schema1, this.getDatabase().getCatalogNamed("test1").getDefaultSchema()); // we should have a new schema after the refresh
-
- this.executeUpdate("drop database test2");
- this.executeUpdate("drop database test1");
- this.connectionProfile.removeConnectionListener(listener);
- this.connectionProfile.disconnect();
- }
-
- public void testTable() throws Exception {
- this.connectionProfile.connect();
- TestConnectionListener listener = new TestConnectionListener();
- this.connectionProfile.addConnectionListener(listener);
-
- this.getJDBCConnection().setCatalog("master");
- this.executeUpdateIgnoreErrors("drop database table_test");
- this.executeUpdate("create database table_test");
- this.getJDBCConnection().setCatalog("table_test");
-
- this.executeUpdate(this.buildBarDDL());
- this.executeUpdate(this.buildFooDDL());
- this.executeUpdate(this.buildBazDDL());
- this.executeUpdate(this.buildFooBazDDL());
- ((ICatalogObject) this.getDTPDatabase()).refresh();
-
- Schema schema = this.getDatabase().getCatalogNamed("table_test").getDefaultSchema();
-
- // foo
- Table fooTable = schema.getTableNamed("foo");
- assertEquals(3, fooTable.columnsSize());
- assertEquals(1, fooTable.primaryKeyColumnsSize());
- assertEquals(1, fooTable.foreignKeysSize());
-
- Column pkColumn = fooTable.getPrimaryKeyColumn();
- assertEquals("id", pkColumn.getName());
- Column idColumn = fooTable.getColumnNamed("id");
- assertSame(fooTable, idColumn.getTable());
- assertSame(pkColumn, idColumn);
- assertTrue(idColumn.isPartOfPrimaryKey());
- assertFalse(idColumn.isPartOfForeignKey());
- assertTrue(idColumn.isPartOfUniqueConstraint());
- assertFalse(idColumn.isNullable());
-
- assertEquals("INT", idColumn.getDataTypeName());
- assertTrue(idColumn.isNumeric());
- assertEquals(0, idColumn.getPrecision());
- assertEquals(0, idColumn.getScale());
- assertEquals(-1, idColumn.getLength());
- assertFalse(idColumn.isLOB());
- assertEquals("int", idColumn.getJavaTypeDeclaration());
-
- Column nameColumn = fooTable.getColumnNamed("name");
- assertFalse(nameColumn.isPartOfPrimaryKey());
- assertFalse(nameColumn.isPartOfForeignKey());
- assertTrue(nameColumn.isPartOfUniqueConstraint());
- assertFalse(nameColumn.isNullable()); // implied "NOT NULL" ?
-
- assertEquals("VARCHAR", nameColumn.getDataTypeName());
- assertFalse(nameColumn.isNumeric());
- assertEquals(-1, nameColumn.getPrecision());
- assertEquals(-1, nameColumn.getScale());
- assertEquals(20, nameColumn.getLength());
- assertFalse(nameColumn.isLOB());
- assertEquals("java.lang.String", nameColumn.getJavaTypeDeclaration());
-
- Column barColumn = fooTable.getColumnNamed("bar_id");
- assertEquals("INT", barColumn.getDataTypeName());
- assertTrue(barColumn.isPartOfForeignKey());
- assertFalse(barColumn.isPartOfPrimaryKey());
-
- ForeignKey barFK = fooTable.foreignKeys().next(); // there should only be 1 foreign key
- assertEquals(1, barFK.columnPairsSize());
- assertEquals("bar", barFK.getAttributeName());
- assertNull(barFK.getJoinColumnAnnotationIdentifier("bar"));
- assertEquals("bar_id", barFK.getJoinColumnAnnotationIdentifier("primaryBar"));
- assertSame(fooTable, barFK.getBaseTable());
-
- assertFalse(fooTable.isPossibleJoinTable());
- assertSame(schema, fooTable.getSchema());
-
- // BAR
- Table barTable = schema.getTableNamed("bar");
- assertEquals(2, barTable.columnsSize());
- assertEquals(1, barTable.primaryKeyColumnsSize());
- assertEquals(0, barTable.foreignKeysSize());
- assertEquals("id", barTable.getPrimaryKeyColumn().getName());
- assertFalse(barTable.isPossibleJoinTable());
- Column chunkColumn = barTable.getColumnNamed("chunk");
- assertEquals("IMAGE", chunkColumn.getDataTypeName());
- assertFalse(chunkColumn.isNumeric());
- assertTrue(chunkColumn.isLOB());
- assertEquals("byte[]", chunkColumn.getJavaTypeDeclaration());
- assertSame(barTable, barFK.getReferencedTable());
-
- // BAZ
- Table bazTable = schema.getTableNamed("baz");
- assertEquals(4, bazTable.columnsSize());
- assertEquals(1, bazTable.primaryKeyColumnsSize());
- assertEquals(0, bazTable.foreignKeysSize());
-
- Column nicknameColumn = bazTable.getColumnNamed("nickname");
- assertTrue(nicknameColumn.isNullable());
-
- Column songColumn = bazTable.getColumnNamed("song");
- assertFalse(songColumn.isNullable());
-
- Column salaryColumn = bazTable.getColumnNamed("salary");
- assertFalse(salaryColumn.isPartOfUniqueConstraint());
- assertEquals("DECIMAL", salaryColumn.getDataTypeName());
- assertTrue(salaryColumn.isNumeric());
- assertEquals(10, salaryColumn.getPrecision());
- assertEquals(2, salaryColumn.getScale());
- assertEquals(-1, salaryColumn.getLength());
- assertFalse(salaryColumn.isLOB());
-
- // FOO_BAZ
- Table foo_bazTable = schema.getTableNamed("foo_baz");
- assertEquals(2, foo_bazTable.columnsSize());
- assertEquals(0, foo_bazTable.primaryKeyColumnsSize());
- assertEquals(2, foo_bazTable.foreignKeysSize());
- assertTrue(foo_bazTable.isPossibleJoinTable());
- assertTrue(foo_bazTable.joinTableNameIsDefault());
- assertTrue(foo_bazTable.getColumnNamed("foo_id").isPartOfForeignKey());
-
- this.executeUpdate("drop table foo_baz");
- this.executeUpdate("drop table baz");
- this.executeUpdate("drop table foo");
- this.executeUpdate("drop table bar");
-
- this.getJDBCConnection().setCatalog("master");
- this.executeUpdate("drop database table_test");
-
- this.connectionProfile.removeConnectionListener(listener);
- this.connectionProfile.disconnect();
- }
-
- private static final String CR = System.getProperty("line.separator"); //$NON-NLS-1$
-
- private String buildBarDDL() {
- StringBuilder sb = new StringBuilder(200);
- sb.append("create table bar (").append(CR);
- sb.append(" id integer primary key,").append(CR);
- sb.append(" chunk image").append(CR);
- sb.append(")").append(CR);
- return sb.toString();
- }
-
- private String buildFooDDL() {
- StringBuilder sb = new StringBuilder(200);
- sb.append("create table foo (").append(CR);
- sb.append(" id integer primary key,").append(CR);
- sb.append(" name varchar(20) unique,").append(CR);
- sb.append(" bar_id integer references bar(id)").append(CR);
- sb.append(")").append(CR);
- return sb.toString();
- }
-
- private String buildBazDDL() {
- StringBuilder sb = new StringBuilder(200);
- sb.append("create table baz (").append(CR);
- sb.append(" id integer primary key,").append(CR);
- sb.append(" nickname varchar(20) null,").append(CR);
- sb.append(" song varchar(20) not null,").append(CR);
- sb.append(" salary decimal(10, 2)").append(CR);
- sb.append(")").append(CR);
- return sb.toString();
- }
-
- private String buildFooBazDDL() {
- StringBuilder sb = new StringBuilder(200);
- sb.append("create table foo_baz (").append(CR);
- sb.append(" foo_id integer references foo(id),").append(CR);
- sb.append(" baz_id integer references baz(id)").append(CR);
- sb.append(")").append(CR);
- return sb.toString();
- }
-
- public void testTableLookup() throws Exception {
- this.connectionProfile.connect();
- TestConnectionListener listener = new TestConnectionListener();
- this.connectionProfile.addConnectionListener(listener);
-
- this.getJDBCConnection().setCatalog("master");
- this.executeUpdateIgnoreErrors("drop database table_lookup_test");
- this.executeUpdate("create database table_lookup_test");
- this.getJDBCConnection().setCatalog("table_lookup_test");
-
- this.executeUpdate("create table test1 (id integer, name varchar(20))");
- this.executeUpdate("create table TEST2 (id integer, name varchar(20))");
- this.executeUpdate("create table [Test3] (id integer, name varchar(20))");
- ((ICatalogObject) this.getDTPDatabase()).refresh();
-
- Schema schema = this.getDatabase().getCatalogNamed("table_lookup_test").getDefaultSchema();
-
- assertNotNull(schema.getTableNamed("test1"));
- assertNotNull(schema.getTableForIdentifier("test1"));
-
- assertNotNull(schema.getTableNamed("TEST2"));
- assertNotNull(schema.getTableForIdentifier("TEST2"));
-
- assertNotNull(schema.getTableForIdentifier("[Test3]"));
-
- this.executeUpdate("drop table [Test3]");
- this.executeUpdate("drop table TEST2");
- this.executeUpdate("drop table test1");
-
- this.getJDBCConnection().setCatalog("master");
- this.executeUpdate("drop database table_lookup_test");
-
- this.connectionProfile.removeConnectionListener(listener);
- this.connectionProfile.disconnect();
- }
-
- public void testColumnLookup() throws Exception {
- this.connectionProfile.connect();
- TestConnectionListener listener = new TestConnectionListener();
- this.connectionProfile.addConnectionListener(listener);
-
- this.getJDBCConnection().setCatalog("master");
- this.executeUpdateIgnoreErrors("drop database column_lookup_test");
- this.executeUpdate("create database column_lookup_test");
- this.getJDBCConnection().setCatalog("column_lookup_test");
-
- // lowercase
- this.executeUpdate("create table test (id integer, name varchar(20))");
- ((ICatalogObject) this.getDTPDatabase()).refresh();
-
- Table table = this.getDatabase().getCatalogNamed("column_lookup_test").getDefaultSchema().getTableNamed("test");
- assertNotNull(table.getColumnNamed("id"));
- assertNotNull(table.getColumnNamed("name"));
-
- this.executeUpdate("drop table test");
-
- // uppercase
- this.executeUpdate("create table test (ID integer, NAME varchar(20))");
- ((ICatalogObject) this.getDTPDatabase()).refresh();
-
- table = this.getDatabase().getCatalogNamed("column_lookup_test").getDefaultSchema().getTableNamed("test");
- assertNotNull(table.getColumnForIdentifier("ID"));
- assertNotNull(table.getColumnForIdentifier("NAME"));
-
- this.executeUpdate("drop table test");
-
- // mixed case
- this.executeUpdate("create table test (Id integer, Name varchar(20))");
- ((ICatalogObject) this.getDTPDatabase()).refresh();
-
- table = this.getDatabase().getCatalogNamed("column_lookup_test").getDefaultSchema().getTableNamed("test");
- assertNotNull(table.getColumnForIdentifier("Id"));
- assertNotNull(table.getColumnForIdentifier("Name"));
-
- this.executeUpdate("drop table test");
-
- // delimited
- this.executeUpdate("create table test ([Id] integer, [Name] varchar(20))");
- ((ICatalogObject) this.getDTPDatabase()).refresh();
-
- table = this.getDatabase().getCatalogNamed("column_lookup_test").getDefaultSchema().getTableNamed("test");
- assertNotNull(table.getColumnForIdentifier("[Id]"));
- assertNotNull(table.getColumnForIdentifier("[Name]"));
-
- this.executeUpdate("drop table test");
-
- this.getJDBCConnection().setCatalog("master");
- this.executeUpdate("drop database column_lookup_test");
-
- this.connectionProfile.removeConnectionListener(listener);
- this.connectionProfile.disconnect();
- }
-
- public void testCrossSchemaReference() throws Exception {
- this.connectionProfile.connect();
- TestConnectionListener listener = new TestConnectionListener();
- this.connectionProfile.addConnectionListener(listener);
-
- this.getJDBCConnection().setCatalog("master");
- this.executeUpdateIgnoreErrors("drop database xref_test2");
- this.executeUpdateIgnoreErrors("drop database xref_test1");
-
- this.getJDBCConnection().setCatalog("master");
- this.executeUpdate("create database xref_test1");
- this.getJDBCConnection().setCatalog("xref_test1");
- this.executeUpdate("create table org (id integer primary key, name varchar(20))");
-
- this.getJDBCConnection().setCatalog("master");
- this.executeUpdate("create database xref_test2");
- this.getJDBCConnection().setCatalog("xref_test2");
- this.executeUpdate("create table emp (id integer primary key, name varchar(20), " +
- "org_id integer references xref_test1..org(id))");
-
- ((ICatalogObject) this.getDTPDatabase()).refresh();
- Catalog catalog1 = this.getDatabase().getCatalogNamed("xref_test1");
- assertNotNull(catalog1);
- Schema schema1 = catalog1.getSchemaNamed("dbo");
- assertNotNull(schema1);
- Table orgTable = schema1.getTableNamed("org");
- assertNotNull(orgTable);
-
- Catalog catalog2 = this.getDatabase().getCatalogNamed("xref_test2");
- assertNotNull(catalog2);
- Schema schema2 = catalog2.getSchemaNamed("dbo");
- assertNotNull(schema2);
- Table empTable = schema2.getTableNamed("emp");
- assertNotNull(empTable);
- assertEquals(1, empTable.foreignKeysSize());
- ForeignKey fk = empTable.foreignKeys().next();
- Table refTable = fk.getReferencedTable();
- assertNotNull(refTable);
- assertEquals("org", refTable.getName());
- assertEquals(1, fk.columnPairsSize());
- ForeignKey.ColumnPair cp = fk.columnPairs().next();
- Column baseColumn = cp.getBaseColumn();
- assertEquals("org_id", baseColumn.getName());
- Column refColumn = cp.getReferencedColumn();
- assertEquals("id", refColumn.getName());
-
- this.getJDBCConnection().setCatalog("xref_test2");
- this.executeUpdate("drop table emp");
- this.getJDBCConnection().setCatalog("xref_test1");
- this.executeUpdate("drop table org");
- this.getJDBCConnection().setCatalog("master");
- this.executeUpdate("drop database xref_test2");
- this.executeUpdate("drop database xref_test1");
-
- this.connectionProfile.removeConnectionListener(listener);
- this.connectionProfile.disconnect();
- }
-
-}
diff --git a/jpa/tests/org.eclipse.jpt.eclipselink.core.tests/.classpath b/jpa/tests/org.eclipse.jpt.eclipselink.core.tests/.classpath
deleted file mode 100644
index db34e47716..0000000000
--- a/jpa/tests/org.eclipse.jpt.eclipselink.core.tests/.classpath
+++ /dev/null
@@ -1,13 +0,0 @@
-<?xml version="1.0" encoding="UTF-8"?>
-<classpath>
- <classpathentry kind="src" path="src"/>
- <classpathentry kind="con" path="org.eclipse.jdt.launching.JRE_CONTAINER/org.eclipse.jdt.internal.debug.ui.launcher.StandardVMType/J2SE-1.5"/>
- <classpathentry kind="con" path="org.eclipse.pde.core.requiredPlugins">
- <accessrules>
- <accessrule kind="accessible" pattern="org/eclipse/wst/**"/>
- <accessrule kind="accessible" pattern="org/eclipse/jst/**"/>
- <accessrule kind="accessible" pattern="org/eclipse/jpt/**"/>
- </accessrules>
- </classpathentry>
- <classpathentry kind="output" path="bin"/>
-</classpath>
diff --git a/jpa/tests/org.eclipse.jpt.eclipselink.core.tests/.cvsignore b/jpa/tests/org.eclipse.jpt.eclipselink.core.tests/.cvsignore
deleted file mode 100644
index c4ba612bad..0000000000
--- a/jpa/tests/org.eclipse.jpt.eclipselink.core.tests/.cvsignore
+++ /dev/null
@@ -1,5 +0,0 @@
-bin
-@dot
-temp.folder
-build.xml
-javaCompiler...args \ No newline at end of file
diff --git a/jpa/tests/org.eclipse.jpt.eclipselink.core.tests/.project b/jpa/tests/org.eclipse.jpt.eclipselink.core.tests/.project
deleted file mode 100644
index 26141a5bbf..0000000000
--- a/jpa/tests/org.eclipse.jpt.eclipselink.core.tests/.project
+++ /dev/null
@@ -1,28 +0,0 @@
-<?xml version="1.0" encoding="UTF-8"?>
-<projectDescription>
- <name>org.eclipse.jpt.eclipselink.core.tests</name>
- <comment></comment>
- <projects>
- </projects>
- <buildSpec>
- <buildCommand>
- <name>org.eclipse.jdt.core.javabuilder</name>
- <arguments>
- </arguments>
- </buildCommand>
- <buildCommand>
- <name>org.eclipse.pde.ManifestBuilder</name>
- <arguments>
- </arguments>
- </buildCommand>
- <buildCommand>
- <name>org.eclipse.pde.SchemaBuilder</name>
- <arguments>
- </arguments>
- </buildCommand>
- </buildSpec>
- <natures>
- <nature>org.eclipse.pde.PluginNature</nature>
- <nature>org.eclipse.jdt.core.javanature</nature>
- </natures>
-</projectDescription>
diff --git a/jpa/tests/org.eclipse.jpt.eclipselink.core.tests/.settings/org.eclipse.core.resources.prefs b/jpa/tests/org.eclipse.jpt.eclipselink.core.tests/.settings/org.eclipse.core.resources.prefs
deleted file mode 100644
index 11155f4708..0000000000
--- a/jpa/tests/org.eclipse.jpt.eclipselink.core.tests/.settings/org.eclipse.core.resources.prefs
+++ /dev/null
@@ -1,3 +0,0 @@
-#Mon Apr 07 14:26:54 EDT 2008
-eclipse.preferences.version=1
-encoding/<project>=ISO-8859-1
diff --git a/jpa/tests/org.eclipse.jpt.eclipselink.core.tests/META-INF/MANIFEST.MF b/jpa/tests/org.eclipse.jpt.eclipselink.core.tests/META-INF/MANIFEST.MF
deleted file mode 100644
index fe0a5f5936..0000000000
--- a/jpa/tests/org.eclipse.jpt.eclipselink.core.tests/META-INF/MANIFEST.MF
+++ /dev/null
@@ -1,39 +0,0 @@
-Manifest-Version: 1.0
-Bundle-ManifestVersion: 2
-Bundle-Name: %pluginName
-Bundle-Vendor: %providerName
-Bundle-SymbolicName: org.eclipse.jpt.eclipselink.core.tests
-Bundle-Version: 1.2.0
-Bundle-Localization: plugin
-Require-Bundle: org.eclipse.core.commands;bundle-version="[3.4.0,4.0.0)",
- org.eclipse.core.resources;bundle-version="[3.4.0,4.0.0)",
- org.eclipse.core.runtime;bundle-version="[3.4.0,4.0.0)",
- org.eclipse.emf.ecore.xmi;bundle-version="2.4.0",
- org.eclipse.jdt.core;bundle-version="[3.4.0,4.0.0)",
- org.eclipse.jpt.core;bundle-version="[2.0.0,3.0.0)",
- org.eclipse.jpt.core.tests;bundle-version="[2.0.0,3.0.0)",
- org.eclipse.jpt.eclipselink.core;bundle-version="[1.0.0,2.0.0)",
- org.eclipse.jpt.utility;bundle-version="[1.2.0,2.0.0)",
- org.eclipse.wst.common.emf;bundle-version="[1.1.201,2.0.0)",
- org.eclipse.wst.common.emfworkbench.integration;bundle-version="1.1.201",
- org.eclipse.wst.common.frameworks;bundle-version="[1.1.200,1.2.0)",
- org.eclipse.wst.common.modulecore;bundle-version="[1.1.200,2.0.0)",
- org.eclipse.wst.common.project.facet.core;bundle-version="[1.3.0,2.0.0)",
- org.junit;bundle-version="[3.8.2,4.0.0)"
-Bundle-RequiredExecutionEnvironment: J2SE-1.5
-Export-Package: org.eclipse.jpt.eclipselink.core.tests.internal;x-internal:=true,
- org.eclipse.jpt.eclipselink.core.tests.internal.context;x-internal:=true,
- org.eclipse.jpt.eclipselink.core.tests.internal.context.java;x-internal:=true,
- org.eclipse.jpt.eclipselink.core.tests.internal.context.orm;x-internal:=true,
- org.eclipse.jpt.eclipselink.core.tests.internal.context.persistence;x-internal:=true,
- org.eclipse.jpt.eclipselink.core.tests.internal.context.persistence.caching;x-internal:=true,
- org.eclipse.jpt.eclipselink.core.tests.internal.context.persistence.connection;x-internal:=true,
- org.eclipse.jpt.eclipselink.core.tests.internal.context.persistence.customization;x-internal:=true,
- org.eclipse.jpt.eclipselink.core.tests.internal.context.persistence.general;x-internal:=true,
- org.eclipse.jpt.eclipselink.core.tests.internal.context.persistence.logging;x-internal:=true,
- org.eclipse.jpt.eclipselink.core.tests.internal.context.persistence.options;x-internal:=true,
- org.eclipse.jpt.eclipselink.core.tests.internal.context.persistence.schema.generation;x-internal:=true,
- org.eclipse.jpt.eclipselink.core.tests.internal.resource;x-internal:=true,
- org.eclipse.jpt.eclipselink.core.tests.internal.resource.java;x-internal:=true,
- org.eclipse.jpt.eclipselink1_1.core.tests.internal.context,
- org.eclipse.jpt.eclipselink1_1.core.tests.internal.context.orm
diff --git a/jpa/tests/org.eclipse.jpt.eclipselink.core.tests/about.html b/jpa/tests/org.eclipse.jpt.eclipselink.core.tests/about.html
deleted file mode 100644
index be534ba44f..0000000000
--- a/jpa/tests/org.eclipse.jpt.eclipselink.core.tests/about.html
+++ /dev/null
@@ -1,34 +0,0 @@
-<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.0//EN">
-<HTML>
-
-<head>
-<title>About</title>
-<meta http-equiv=Content-Type content="text/html; charset=ISO-8859-1">
-</head>
-
-<BODY lang="EN-US">
-
-<H3>About This Content</H3>
-
-<P>May 02, 2008</P>
-
-<H3>License</H3>
-
-<P>The Eclipse Foundation makes available all content in this plug-in
-("Content"). Unless otherwise indicated below, the Content is provided to you
-under the terms and conditions of the Eclipse Public License Version 1.0
-("EPL"). A copy of the EPL is available at
-<A href="http://www.eclipse.org/org/documents/epl-v10.php">http://www.eclipse.org/org/documents/epl-v10.php</A>.
-For purposes of the EPL, "Program" will mean the Content.</P>
-
-<P>If you did not receive this Content directly from the Eclipse Foundation, the
-Content is being redistributed by another party ("Redistributor") and different
-terms and conditions may apply to your use of any object code in the Content.
-Check the Redistributor's license that was provided with the Content. If no such
-license exists, contact the Redistributor. Unless otherwise indicated below, the
-terms and conditions of the EPL still apply to any source code in the Content
-and such source code may be obtained at
-<A href="http://www.eclipse.org/">http://www.eclipse.org/</A>.</P>
-
-</BODY>
-</HTML>
diff --git a/jpa/tests/org.eclipse.jpt.eclipselink.core.tests/build.properties b/jpa/tests/org.eclipse.jpt.eclipselink.core.tests/build.properties
deleted file mode 100644
index 9bf11f791e..0000000000
--- a/jpa/tests/org.eclipse.jpt.eclipselink.core.tests/build.properties
+++ /dev/null
@@ -1,19 +0,0 @@
-###############################################################################
-# Copyright (c) 2006, 2007 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
-#
-# Contributors:
-# Oracle. - initial API and implementation
-###############################################################################
-javacSource = 1.5
-javacTarget = 1.5
-bin.includes = .,\
- META-INF/,\
- about.html,\
- test.xml,\
- plugin.properties
-source.. = src/
-output.. = bin/
diff --git a/jpa/tests/org.eclipse.jpt.eclipselink.core.tests/plugin.properties b/jpa/tests/org.eclipse.jpt.eclipselink.core.tests/plugin.properties
deleted file mode 100644
index 8fdd1d374a..0000000000
--- a/jpa/tests/org.eclipse.jpt.eclipselink.core.tests/plugin.properties
+++ /dev/null
@@ -1,22 +0,0 @@
-###############################################################################
-# Copyright (c) 2006, 2008 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
-#
-# Contributors: Oracle. - initial API and implementation
-###############################################################################
-# ====================================================================
-# To code developer:
-# Do NOT change the properties between this line and the
-# "%%% END OF TRANSLATED PROPERTIES %%%" line.
-# Make a new property name, append to the end of the file and change
-# the code to use the new property.
-# ====================================================================
-
-# ====================================================================
-# %%% END OF TRANSLATED PROPERTIES %%%
-# ====================================================================
-
-pluginName=Dali Java Persistence Tools - EclipseLink Support - Core Tests
-providerName=Eclipse Web Tools Platform
diff --git a/jpa/tests/org.eclipse.jpt.eclipselink.core.tests/src/org/eclipse/jpt/eclipselink/core/tests/internal/JptEclipseLinkCoreTests.java b/jpa/tests/org.eclipse.jpt.eclipselink.core.tests/src/org/eclipse/jpt/eclipselink/core/tests/internal/JptEclipseLinkCoreTests.java
deleted file mode 100644
index f7f5ba8409..0000000000
--- a/jpa/tests/org.eclipse.jpt.eclipselink.core.tests/src/org/eclipse/jpt/eclipselink/core/tests/internal/JptEclipseLinkCoreTests.java
+++ /dev/null
@@ -1,101 +0,0 @@
-/*******************************************************************************
- * Copyright (c) 2009 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.
- *
- * Contributors:
- * Oracle - initial API and implementation
- ******************************************************************************/
-package org.eclipse.jpt.eclipselink.core.tests.internal;
-
-import java.io.File;
-import junit.framework.Test;
-import junit.framework.TestSuite;
-import org.eclipse.jpt.core.tests.internal.projects.TestJpaProject;
-import org.eclipse.jpt.eclipselink.core.tests.internal.context.JptEclipseLinkCoreContextModelTests;
-import org.eclipse.jpt.eclipselink.core.tests.internal.resource.JptEclipselinkCoreResourceModelTests;
-import org.eclipse.jpt.eclipselink1_1.core.tests.internal.context.JptEclipseLink1_1CoreContextModelTests;
-
-/**
- * decentralize test creation code
- *
- * Required Java system property:
- * -Dorg.eclipse.jpt.jpa.jar=<jpa.jar path>
- * -Dorg.eclipse.jpt.eclipselink.jar=<eclipselink.jar path>
- */
-@SuppressWarnings("nls")
-public class JptEclipseLinkCoreTests
-{
- private static final String JPA_JAR_PROPERTY = TestJpaProject.JPA_JAR_NAME_SYSTEM_PROPERTY;
- private static final String ECLIPSELINK_JAR_PROPERTY = TestJpaProject.ECLIPSELINK_JAR_NAME_SYSTEM_PROPERTY;
-
- public static Test suite() {
- TestSuite suite = new TestSuite(JptEclipseLinkCoreTests.class.getPackage().getName());
-
- if(requiredJarsExists()) {
- suite.addTest(JptEclipselinkCoreResourceModelTests.suite());
- suite.addTest(JptEclipseLinkCoreContextModelTests.suite());
- suite.addTest(JptEclipseLink1_1CoreContextModelTests.suite());
- }
- else {
- suite.addTest(TestSuite.warning(buildMissingJarErrorMessage()));
- }
- return suite;
- }
-
- public static boolean requiredJarsExists() {
- return jpaJarPropertyExists()
- && jpaJarFileExists()
- && eclipselinkJarPropertyExists()
- && eclipselinkJarFileExists();
- }
-
- public static boolean jpaJarPropertyExists() {
- return getSystemProperty(JPA_JAR_PROPERTY) != null;
- }
-
- public static boolean jpaJarFileExists() {
- return (new File(getSystemProperty(JPA_JAR_PROPERTY))).exists();
- }
-
- public static boolean eclipselinkJarPropertyExists() {
- return getSystemProperty(ECLIPSELINK_JAR_PROPERTY) != null;
- }
-
- public static boolean eclipselinkJarFileExists() {
- return (new File(getSystemProperty(ECLIPSELINK_JAR_PROPERTY))).exists();
- }
-
- /*********** private **********/
- private static String buildMissingJarErrorMessage() {
-
- if( ! jpaJarPropertyExists()) {
- return errorMissingProperty(JPA_JAR_PROPERTY);
- }
- else if( ! jpaJarFileExists()) {
- return errorJarFileDoesNotExist(getSystemProperty(JPA_JAR_PROPERTY));
- }
- else if( ! eclipselinkJarPropertyExists()) {
- return errorMissingProperty(ECLIPSELINK_JAR_PROPERTY);
- }
- return errorJarFileDoesNotExist(getSystemProperty(ECLIPSELINK_JAR_PROPERTY));
- }
-
- private static String errorMissingProperty(String propertyName) {
- return "missing Java system property: \"" + propertyName + "\"";
- }
-
- private static String errorJarFileDoesNotExist(String propertyValue) {
- return "JAR file doesn't exist: \"" + propertyValue + "\"";
- }
-
- private static String getSystemProperty(String propertyName) {
- return System.getProperty(propertyName);
- }
-
- private JptEclipseLinkCoreTests() {
- super();
- throw new UnsupportedOperationException();
- }
-}
diff --git a/jpa/tests/org.eclipse.jpt.eclipselink.core.tests/src/org/eclipse/jpt/eclipselink/core/tests/internal/context/EclipseLinkContextModelTestCase.java b/jpa/tests/org.eclipse.jpt.eclipselink.core.tests/src/org/eclipse/jpt/eclipselink/core/tests/internal/context/EclipseLinkContextModelTestCase.java
deleted file mode 100644
index 88e14d8358..0000000000
--- a/jpa/tests/org.eclipse.jpt.eclipselink.core.tests/src/org/eclipse/jpt/eclipselink/core/tests/internal/context/EclipseLinkContextModelTestCase.java
+++ /dev/null
@@ -1,52 +0,0 @@
-/*******************************************************************************
- * Copyright (c) 2008, 2009 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
- *
- * Contributors:
- * Oracle - initial API and implementation
- *******************************************************************************/
-package org.eclipse.jpt.eclipselink.core.tests.internal.context;
-
-import org.eclipse.jpt.core.internal.facet.JpaFacetDataModelProperties;
-import org.eclipse.jpt.core.internal.facet.JpaFacetDataModelProvider;
-import org.eclipse.jpt.core.tests.internal.context.ContextModelTestCase;
-import org.eclipse.jpt.eclipselink.core.EclipseLinkJpaProject;
-import org.eclipse.jpt.eclipselink.core.context.java.EclipseLinkJavaEntity;
-import org.eclipse.jpt.eclipselink.core.internal.EclipseLinkJpaPlatformProvider;
-import org.eclipse.jpt.eclipselink.core.internal.context.persistence.EclipseLinkPersistenceUnit;
-import org.eclipse.wst.common.frameworks.datamodel.DataModelFactory;
-import org.eclipse.wst.common.frameworks.datamodel.IDataModel;
-
-public abstract class EclipseLinkContextModelTestCase extends ContextModelTestCase
-{
- protected EclipseLinkContextModelTestCase(String name) {
- super(name);
- }
-
-
- @Override
- protected IDataModel buildJpaConfigDataModel() {
- IDataModel dataModel = DataModelFactory.createDataModel(new JpaFacetDataModelProvider());
- dataModel.setProperty(JpaFacetDataModelProperties.PLATFORM_ID, EclipseLinkJpaPlatformProvider.ID);
- dataModel.setProperty(JpaFacetDataModelProperties.CREATE_ORM_XML, Boolean.FALSE);
- return dataModel;
- }
-
- @Override
- protected EclipseLinkJpaProject getJpaProject() {
- return (EclipseLinkJpaProject) super.getJpaProject();
- }
-
- @Override
- protected EclipseLinkPersistenceUnit getPersistenceUnit() {
- return (EclipseLinkPersistenceUnit) super.getPersistenceUnit();
- }
-
- @Override
- protected EclipseLinkJavaEntity getJavaEntity() {
- return (EclipseLinkJavaEntity) getJavaPersistentType().getMapping();
- }
-}
diff --git a/jpa/tests/org.eclipse.jpt.eclipselink.core.tests/src/org/eclipse/jpt/eclipselink/core/tests/internal/context/EclipseLinkJpaProjectTests.java b/jpa/tests/org.eclipse.jpt.eclipselink.core.tests/src/org/eclipse/jpt/eclipselink/core/tests/internal/context/EclipseLinkJpaProjectTests.java
deleted file mode 100644
index 6ae3501f49..0000000000
--- a/jpa/tests/org.eclipse.jpt.eclipselink.core.tests/src/org/eclipse/jpt/eclipselink/core/tests/internal/context/EclipseLinkJpaProjectTests.java
+++ /dev/null
@@ -1,134 +0,0 @@
-/*******************************************************************************
- * Copyright (c) 2009 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.
- *
- * Contributors:
- * Oracle - initial API and implementation
- ******************************************************************************/
-package org.eclipse.jpt.eclipselink.core.tests.internal.context;
-
-import org.eclipse.jpt.core.JptCorePlugin;
-import org.eclipse.jpt.core.internal.resource.orm.OrmXmlResourceProvider;
-import org.eclipse.jpt.core.resource.xml.JpaXmlResource;
-import org.eclipse.jpt.eclipselink.core.internal.JptEclipseLinkCorePlugin;
-import org.eclipse.jpt.eclipselink.core.internal.resource.orm.EclipseLinkOrmXmlResourceProvider;
-
-@SuppressWarnings("nls")
-public class EclipseLinkJpaProjectTests extends EclipseLinkContextModelTestCase
-{
-
- public EclipseLinkJpaProjectTests(String name) {
- super(name);
- }
-
- public void testGetDefaultOrmXmlResource() throws Exception {
- JpaXmlResource resource = this.getJpaProject().getDefaultOrmXmlResource();
- assertNull(resource);
-
- //add the orm.xml file with eclipselink orm content type
- createDefaultOrmXmlFileWithEclipseLinkContentType();
- resource = this.getJpaProject().getDefaultOrmXmlResource();
- assertNotNull(resource);
- assertEquals(JptEclipseLinkCorePlugin.ECLIPSELINK_ORM_XML_CONTENT_TYPE, resource.getContentType());
- assertEquals("src/META-INF/orm.xml", resource.getFile().getProjectRelativePath().toString());
-
-
- //delete the orm.xml file and verify it is not returned from getDefaultOrmXmlResource()
- resource.delete(null);
- resource = this.getJpaProject().getDefaultOrmXmlResource();
- assertNull(resource);
-
-
- //add the orm.xml file this time with orm content type
- createDefaultOrmXmlFile();
- resource = this.getJpaProject().getDefaultOrmXmlResource();
- assertNotNull(resource);
- assertEquals(JptCorePlugin.ORM_XML_CONTENT_TYPE, resource.getContentType());
- assertEquals("src/META-INF/orm.xml", resource.getFile().getProjectRelativePath().toString());
- }
-
- public void testGetDefaultEclipseLinkOrmXmlResource() throws Exception {
- JpaXmlResource resource = this.getJpaProject().getDefaultEclipseLinkOrmXmlResource();
- assertNull(resource);
-
- //add the eclipselink-orm.xml file
- createDefaultEclipseLinkOrmXmlFile();
- resource = this.getJpaProject().getDefaultEclipseLinkOrmXmlResource();
- assertNotNull(resource);
- assertEquals(JptEclipseLinkCorePlugin.ECLIPSELINK_ORM_XML_CONTENT_TYPE, resource.getContentType());
- assertEquals("src/META-INF/eclipselink-orm.xml", resource.getFile().getProjectRelativePath().toString());
-
-
- //delete the eclipselink-orm.xml file and verify it is not returned from getDefaultOrmXmlResource()
- resource.delete(null);
- resource = this.getJpaProject().getDefaultEclipseLinkOrmXmlResource();
- assertNull(resource);
- }
-
- private void createDefaultOrmXmlFileWithEclipseLinkContentType() throws Exception {
- EclipseLinkOrmXmlResourceProvider resourceProvider =
- EclipseLinkOrmXmlResourceProvider.getXmlResourceProvider(this.getJavaProject().getProject(), JptCorePlugin.DEFAULT_ORM_XML_FILE_PATH);
- resourceProvider.createFileAndResource();
- }
-
- private void createDefaultOrmXmlFile() throws Exception {
- OrmXmlResourceProvider resourceProvider =
- OrmXmlResourceProvider.getDefaultXmlResourceProvider(this.getJavaProject().getProject());
- resourceProvider.createFileAndResource();
- }
-
- private void createDefaultEclipseLinkOrmXmlFile() throws Exception {
- EclipseLinkOrmXmlResourceProvider resourceProvider =
- EclipseLinkOrmXmlResourceProvider.getDefaultXmlResourceProvider(this.getJavaProject().getProject());
- resourceProvider.createFileAndResource();
- }
-
- private void createEclipseLinkOrmXmlFile(String filePath) throws Exception {
- EclipseLinkOrmXmlResourceProvider resourceProvider =
- EclipseLinkOrmXmlResourceProvider.getXmlResourceProvider(this.getJavaProject().getProject(), filePath);
- resourceProvider.createFileAndResource();
- }
-
- public void testGetMappingFileResource() throws Exception {
- JpaXmlResource resource = this.getJpaProject().getMappingFileXmlResource(JptEclipseLinkCorePlugin.DEFAULT_ECLIPSELINK_ORM_XML_FILE_PATH);
- assertNull(resource);
-
- //add the eclipselink-orm.xml file
- createDefaultEclipseLinkOrmXmlFile();
- resource = this.getJpaProject().getMappingFileXmlResource(JptEclipseLinkCorePlugin.DEFAULT_ECLIPSELINK_ORM_XML_FILE_PATH);
- assertNotNull(resource);
- assertEquals(JptEclipseLinkCorePlugin.ECLIPSELINK_ORM_XML_CONTENT_TYPE, resource.getContentType());
- assertEquals("src/META-INF/eclipselink-orm.xml", resource.getFile().getProjectRelativePath().toString());
-
- //delete the eclipselink-orm.xml file and verify it is not returned from getMappingFileResource()
- resource.delete(null);
- resource = this.getJpaProject().getMappingFileXmlResource(JptEclipseLinkCorePlugin.DEFAULT_ECLIPSELINK_ORM_XML_FILE_PATH);
- assertNull(resource);
- }
-
- public void testGetDifferentlyNamedMappingFileResource() throws Exception {
- JpaXmlResource resource = this.getJpaProject().getMappingFileXmlResource("META-INF/orm2.xml");
- assertNull(resource);
-
- //create the orm2.xml file
- createEclipseLinkOrmXmlFile("META-INF/orm2.xml");
- resource = this.getJpaProject().getMappingFileXmlResource("META-INF/orm2.xml");
- assertNotNull(resource);
- assertEquals(JptEclipseLinkCorePlugin.ECLIPSELINK_ORM_XML_CONTENT_TYPE, resource.getContentType());
- assertEquals("src/META-INF/orm2.xml", resource.getFile().getProjectRelativePath().toString());
-
- //delete the orm2.xml file and verify it is not returned from getMappingFileResource()
- resource.delete(null);
- resource = this.getJpaProject().getMappingFileXmlResource("META-INF/orm2.xml");
- assertNull(resource);
-
- //add the orm2.xml file back
- createEclipseLinkOrmXmlFile("META-INF/orm2.xml");
- resource = this.getJpaProject().getMappingFileXmlResource("META-INF/orm2.xml");
- assertNotNull(resource);
- assertEquals(JptEclipseLinkCorePlugin.ECLIPSELINK_ORM_XML_CONTENT_TYPE, resource.getContentType());
- assertEquals("src/META-INF/orm2.xml", resource.getFile().getProjectRelativePath().toString());
- }
-}
diff --git a/jpa/tests/org.eclipse.jpt.eclipselink.core.tests/src/org/eclipse/jpt/eclipselink/core/tests/internal/context/JptEclipseLinkCoreContextModelTests.java b/jpa/tests/org.eclipse.jpt.eclipselink.core.tests/src/org/eclipse/jpt/eclipselink/core/tests/internal/context/JptEclipseLinkCoreContextModelTests.java
deleted file mode 100644
index 38c0f3cc95..0000000000
--- a/jpa/tests/org.eclipse.jpt.eclipselink.core.tests/src/org/eclipse/jpt/eclipselink/core/tests/internal/context/JptEclipseLinkCoreContextModelTests.java
+++ /dev/null
@@ -1,39 +0,0 @@
-/*******************************************************************************
- * Copyright (c) 2007, 2009 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
- *
- * Contributors:
- * Oracle - initial API and implementation
- *******************************************************************************/
-package org.eclipse.jpt.eclipselink.core.tests.internal.context;
-
-import junit.framework.Test;
-import junit.framework.TestCase;
-import junit.framework.TestSuite;
-import org.eclipse.jpt.eclipselink.core.tests.internal.context.java.JptEclipseLinkCoreJavaContextModelTests;
-import org.eclipse.jpt.eclipselink.core.tests.internal.context.orm.JptEclipseLinkCoreOrmContextModelTests;
-import org.eclipse.jpt.eclipselink.core.tests.internal.context.persistence.JptEclipseLinkCorePersistenceContextModelTests;
-
-public class JptEclipseLinkCoreContextModelTests extends TestCase
-{
- public static Test suite() {
- return suite(true);
- }
-
- public static Test suite(boolean all) {
- TestSuite suite = new TestSuite(JptEclipseLinkCoreContextModelTests.class.getName());
- suite.addTestSuite(EclipseLinkJpaProjectTests.class);
- suite.addTest(JptEclipseLinkCorePersistenceContextModelTests.suite(all));
- suite.addTest(JptEclipseLinkCoreJavaContextModelTests.suite(all));
- suite.addTest(JptEclipseLinkCoreOrmContextModelTests.suite(all));
- return suite;
- }
-
- private JptEclipseLinkCoreContextModelTests() {
- super();
- throw new UnsupportedOperationException();
- }
-}
diff --git a/jpa/tests/org.eclipse.jpt.eclipselink.core.tests/src/org/eclipse/jpt/eclipselink/core/tests/internal/context/java/EclipseLinkJavaBasicMappingTests.java b/jpa/tests/org.eclipse.jpt.eclipselink.core.tests/src/org/eclipse/jpt/eclipselink/core/tests/internal/context/java/EclipseLinkJavaBasicMappingTests.java
deleted file mode 100644
index 0a6e7e5c88..0000000000
--- a/jpa/tests/org.eclipse.jpt.eclipselink.core.tests/src/org/eclipse/jpt/eclipselink/core/tests/internal/context/java/EclipseLinkJavaBasicMappingTests.java
+++ /dev/null
@@ -1,315 +0,0 @@
-/*******************************************************************************
- * Copyright (c) 2007, 2009 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.
- *
- * Contributors:
- * Oracle - initial API and implementation
- ******************************************************************************/
-package org.eclipse.jpt.eclipselink.core.tests.internal.context.java;
-
-import java.util.Iterator;
-import org.eclipse.jdt.core.ICompilationUnit;
-import org.eclipse.jpt.core.context.BasicMapping;
-import org.eclipse.jpt.core.context.Converter;
-import org.eclipse.jpt.core.context.PersistentAttribute;
-import org.eclipse.jpt.core.context.TemporalConverter;
-import org.eclipse.jpt.core.context.TemporalType;
-import org.eclipse.jpt.core.resource.java.JPA;
-import org.eclipse.jpt.core.resource.java.JavaResourcePersistentAttribute;
-import org.eclipse.jpt.core.resource.java.JavaResourcePersistentType;
-import org.eclipse.jpt.core.resource.java.TemporalAnnotation;
-import org.eclipse.jpt.eclipselink.core.context.Convert;
-import org.eclipse.jpt.eclipselink.core.context.EclipseLinkBasicMapping;
-import org.eclipse.jpt.eclipselink.core.context.Mutable;
-import org.eclipse.jpt.eclipselink.core.resource.java.ConvertAnnotation;
-import org.eclipse.jpt.eclipselink.core.resource.java.EclipseLinkJPA;
-import org.eclipse.jpt.eclipselink.core.resource.java.MutableAnnotation;
-import org.eclipse.jpt.eclipselink.core.tests.internal.context.EclipseLinkContextModelTestCase;
-import org.eclipse.jpt.utility.internal.iterators.ArrayIterator;
-
-@SuppressWarnings("nls")
-public class EclipseLinkJavaBasicMappingTests extends EclipseLinkContextModelTestCase
-{
-
- private ICompilationUnit createTestEntityWithBasicMapping() throws Exception {
- return this.createTestType(new DefaultAnnotationWriter() {
- @Override
- public Iterator<String> imports() {
- return new ArrayIterator<String>(JPA.ENTITY, JPA.BASIC);
- }
- @Override
- public void appendTypeAnnotationTo(StringBuilder sb) {
- sb.append("@Entity").append(CR);
- }
-
- @Override
- public void appendIdFieldAnnotationTo(StringBuilder sb) {
- sb.append("@Basic").append(CR);
- }
- });
- }
-
-
- private ICompilationUnit createTestEntityWithConvert() throws Exception {
- return this.createTestType(new DefaultAnnotationWriter() {
- @Override
- public Iterator<String> imports() {
- return new ArrayIterator<String>(JPA.ENTITY, EclipseLinkJPA.CONVERT);
- }
- @Override
- public void appendTypeAnnotationTo(StringBuilder sb) {
- sb.append("@Entity").append(CR);
- }
-
- @Override
- public void appendIdFieldAnnotationTo(StringBuilder sb) {
- sb.append("@Convert(\"class-instance\")").append(CR);
- }
- });
- }
-
- private ICompilationUnit createTestEntityWithMutableBasic() throws Exception {
- return this.createTestType(new DefaultAnnotationWriter() {
- @Override
- public Iterator<String> imports() {
- return new ArrayIterator<String>(JPA.ENTITY, JPA.BASIC, EclipseLinkJPA.MUTABLE);
- }
- @Override
- public void appendTypeAnnotationTo(StringBuilder sb) {
- sb.append("@Entity").append(CR);
- }
-
- @Override
- public void appendIdFieldAnnotationTo(StringBuilder sb) {
- sb.append("@Basic").append(CR);
- sb.append("@Mutable").append(CR);
- }
- });
- }
-
- private ICompilationUnit createTestEntityWithMutableBasicDate() throws Exception {
- return this.createTestType(new DefaultAnnotationWriter() {
- @Override
- public Iterator<String> imports() {
- return new ArrayIterator<String>(JPA.ENTITY, JPA.BASIC, EclipseLinkJPA.MUTABLE, "java.util.Date");
- }
- @Override
- public void appendTypeAnnotationTo(StringBuilder sb) {
- sb.append("@Entity").append(CR);
- }
-
- @Override
- public void appendIdFieldAnnotationTo(StringBuilder sb) {
- sb.append("@Basic").append(CR);
- sb.append(" @Mutable").append(CR);
- sb.append(" private Date myDate;").append(CR);
- sb.append(CR);
- sb.append(" ");
- }
- });
- }
-
- public EclipseLinkJavaBasicMappingTests(String name) {
- super(name);
- }
-
-
- public void testGetConvert() throws Exception {
- createTestEntityWithBasicMapping();
- addXmlClassRef(FULLY_QUALIFIED_TYPE_NAME);
-
- JavaResourcePersistentType typeResource = getJpaProject().getJavaResourcePersistentType(FULLY_QUALIFIED_TYPE_NAME);
- JavaResourcePersistentAttribute attributeResource = typeResource.persistableAttributes().next();
- attributeResource.addSupportingAnnotation(ConvertAnnotation.ANNOTATION_NAME);
-
- PersistentAttribute persistentAttribute = getJavaPersistentType().attributes().next();
- BasicMapping basicMapping = (BasicMapping) persistentAttribute.getSpecifiedMapping();
-
- assertEquals(Convert.ECLIPSE_LINK_CONVERTER, basicMapping.getConverter().getType());
- }
-
- public void testGetConvert2() throws Exception {
- createTestEntityWithConvert();
- addXmlClassRef(FULLY_QUALIFIED_TYPE_NAME);
-
- PersistentAttribute persistentAttribute = getJavaPersistentType().attributes().next();
- BasicMapping basicMapping = (BasicMapping) persistentAttribute.getMapping();
-
- assertEquals(Convert.ECLIPSE_LINK_CONVERTER, basicMapping.getConverter().getType());
- assertEquals(Convert.CLASS_INSTANCE_CONVERTER, ((Convert) basicMapping.getConverter()).getConverterName());
- }
-
- public void testSetConvert() throws Exception {
- createTestEntityWithBasicMapping();
- addXmlClassRef(FULLY_QUALIFIED_TYPE_NAME);
-
- PersistentAttribute persistentAttribute = getJavaPersistentType().attributes().next();
- BasicMapping basicMapping = (BasicMapping) persistentAttribute.getSpecifiedMapping();
- assertEquals(Converter.NO_CONVERTER, basicMapping.getConverter().getType());
-
- basicMapping.setSpecifiedConverter(Converter.TEMPORAL_CONVERTER);
- ((TemporalConverter) basicMapping.getSpecifiedConverter()).setTemporalType(TemporalType.TIME);
-
- JavaResourcePersistentType typeResource = getJpaProject().getJavaResourcePersistentType(FULLY_QUALIFIED_TYPE_NAME);
- JavaResourcePersistentAttribute attributeResource = typeResource.persistableAttributes().next();
- TemporalAnnotation temporal = (TemporalAnnotation) attributeResource.getSupportingAnnotation(TemporalAnnotation.ANNOTATION_NAME);
-
- assertEquals(org.eclipse.jpt.core.resource.java.TemporalType.TIME, temporal.getValue());
-
- basicMapping.setSpecifiedConverter(null);
- assertNull(attributeResource.getSupportingAnnotation(TemporalAnnotation.ANNOTATION_NAME));
- }
-
- public void testGetConvertUpdatesFromResourceModelChange() throws Exception {
- createTestEntityWithBasicMapping();
- addXmlClassRef(FULLY_QUALIFIED_TYPE_NAME);
-
- PersistentAttribute persistentAttribute = getJavaPersistentType().attributes().next();
- BasicMapping basicMapping = (BasicMapping) persistentAttribute.getSpecifiedMapping();
-
- assertEquals(Converter.NO_CONVERTER, basicMapping.getConverter().getType());
-
-
- JavaResourcePersistentType typeResource = getJpaProject().getJavaResourcePersistentType(FULLY_QUALIFIED_TYPE_NAME);
- JavaResourcePersistentAttribute attributeResource = typeResource.persistableAttributes().next();
- ConvertAnnotation convert = (ConvertAnnotation) attributeResource.addSupportingAnnotation(ConvertAnnotation.ANNOTATION_NAME);
- convert.setValue("foo");
-
- assertEquals(Convert.ECLIPSE_LINK_CONVERTER, basicMapping.getConverter().getType());
- assertEquals("foo", ((Convert) basicMapping.getConverter()).getConverterName());
-
- attributeResource.removeSupportingAnnotation(ConvertAnnotation.ANNOTATION_NAME);
-
- assertEquals(Converter.NO_CONVERTER, basicMapping.getConverter().getType());
- assertFalse(basicMapping.isDefault());
- assertSame(basicMapping, persistentAttribute.getSpecifiedMapping());
- }
-
- public void testGetSpecifiedMutable() throws Exception {
- createTestEntityWithMutableBasic();
- addXmlClassRef(FULLY_QUALIFIED_TYPE_NAME);
-
- PersistentAttribute persistentAttribute = getJavaPersistentType().attributes().next();
- EclipseLinkBasicMapping basicMapping = (EclipseLinkBasicMapping) persistentAttribute.getSpecifiedMapping();
- Mutable mutable = basicMapping.getMutable();
- assertEquals(Boolean.TRUE, mutable.getSpecifiedMutable());
-
- JavaResourcePersistentType typeResource = getJpaProject().getJavaResourcePersistentType(FULLY_QUALIFIED_TYPE_NAME);
- JavaResourcePersistentAttribute attributeResource = typeResource.persistableAttributes().next();
- MutableAnnotation mutableAnnotation = (MutableAnnotation) attributeResource.getSupportingAnnotation(MutableAnnotation.ANNOTATION_NAME);
- mutableAnnotation.setValue(Boolean.TRUE);
-
- assertEquals(Boolean.TRUE, mutable.getSpecifiedMutable());
-
- mutableAnnotation.setValue(null);
- assertEquals(Boolean.TRUE, mutable.getSpecifiedMutable());
-
- mutableAnnotation.setValue(Boolean.FALSE);
- assertEquals(Boolean.FALSE, mutable.getSpecifiedMutable());
-
- attributeResource.removeSupportingAnnotation(MutableAnnotation.ANNOTATION_NAME);
- assertEquals(null, mutable.getSpecifiedMutable());
-
- attributeResource.addSupportingAnnotation(MutableAnnotation.ANNOTATION_NAME);
- assertEquals(Boolean.TRUE, mutable.getSpecifiedMutable());
- }
-
- public void testSetSpecifiedMutable() throws Exception {
- createTestEntityWithMutableBasic();
- addXmlClassRef(FULLY_QUALIFIED_TYPE_NAME);
-
- PersistentAttribute persistentAttribute = getJavaPersistentType().attributes().next();
- EclipseLinkBasicMapping basicMapping = (EclipseLinkBasicMapping) persistentAttribute.getSpecifiedMapping();
- Mutable mutable = basicMapping.getMutable();
- assertEquals(Boolean.TRUE, mutable.getSpecifiedMutable());
-
- JavaResourcePersistentType typeResource = getJpaProject().getJavaResourcePersistentType(FULLY_QUALIFIED_TYPE_NAME);
- JavaResourcePersistentAttribute attributeResource = typeResource.persistableAttributes().next();
- MutableAnnotation mutableAnnotation = (MutableAnnotation) attributeResource.getSupportingAnnotation(MutableAnnotation.ANNOTATION_NAME);
- assertEquals(null, mutableAnnotation.getValue());
-
- mutable.setSpecifiedMutable(Boolean.TRUE);
- assertEquals(null, mutableAnnotation.getValue());
-
- mutable.setSpecifiedMutable(null);
- mutableAnnotation = (MutableAnnotation) attributeResource.getSupportingAnnotation(MutableAnnotation.ANNOTATION_NAME);
- assertEquals(null, mutableAnnotation);
-
- mutable.setSpecifiedMutable(Boolean.FALSE);
- mutableAnnotation = (MutableAnnotation) attributeResource.getSupportingAnnotation(MutableAnnotation.ANNOTATION_NAME);
- assertEquals(Boolean.FALSE, mutableAnnotation.getValue());
-
- mutable.setSpecifiedMutable(Boolean.TRUE);
- assertEquals(null, mutableAnnotation.getValue());
- }
-
- public void testIsDefaultMutable() throws Exception {
- createTestEntityWithMutableBasic();
- addXmlClassRef(FULLY_QUALIFIED_TYPE_NAME);
-
- PersistentAttribute persistentAttribute = getJavaPersistentType().attributes().next();
- EclipseLinkBasicMapping basicMapping = (EclipseLinkBasicMapping) persistentAttribute.getSpecifiedMapping();
- Mutable mutable = basicMapping.getMutable();
- assertTrue(mutable.isDefaultMutable());
-
- JavaResourcePersistentType typeResource = getJpaProject().getJavaResourcePersistentType(FULLY_QUALIFIED_TYPE_NAME);
- JavaResourcePersistentAttribute attributeResource = typeResource.persistableAttributes().next();
- attributeResource.removeSupportingAnnotation(MutableAnnotation.ANNOTATION_NAME);
- assertTrue(mutable.isDefaultMutable());
-
- mutable.setSpecifiedMutable(Boolean.FALSE);
- assertTrue(mutable.isDefaultMutable());
-
- //set mutable default to false in the persistence unit properties, verify default in java still true since this is not a Date/Calendar
- getPersistenceUnit().getOptions().setTemporalMutable(Boolean.FALSE);
- assertTrue(mutable.isDefaultMutable());
- }
-
- public void testIsDefaultMutableForDate() throws Exception {
- createTestEntityWithMutableBasicDate();
- addXmlClassRef(FULLY_QUALIFIED_TYPE_NAME);
-
- PersistentAttribute persistentAttribute = getJavaPersistentType().attributes().next();
- EclipseLinkBasicMapping basicMapping = (EclipseLinkBasicMapping) persistentAttribute.getSpecifiedMapping();
- Mutable mutable = basicMapping.getMutable();
- assertFalse(mutable.isDefaultMutable());
-
- JavaResourcePersistentType typeResource = getJpaProject().getJavaResourcePersistentType(FULLY_QUALIFIED_TYPE_NAME);
- JavaResourcePersistentAttribute attributeResource = typeResource.persistableAttributes().next();
- attributeResource.removeSupportingAnnotation(MutableAnnotation.ANNOTATION_NAME);
- assertFalse(mutable.isDefaultMutable());
-
- mutable.setSpecifiedMutable(Boolean.TRUE);
- assertFalse(mutable.isDefaultMutable());
-
- //set mutable default to false in the persistence unit properties, verify default in java still true since this is not a Date/Calendar
- getPersistenceUnit().getOptions().setTemporalMutable(Boolean.TRUE);
- assertTrue(mutable.isDefaultMutable());
-
- getPersistenceUnit().getOptions().setTemporalMutable(Boolean.FALSE);
- assertFalse(mutable.isDefaultMutable());
-
- getPersistenceUnit().getOptions().setTemporalMutable(null);
- assertFalse(mutable.isDefaultMutable());
- }
-
- public void testIsMutable() throws Exception {
- createTestEntityWithMutableBasic();
- addXmlClassRef(FULLY_QUALIFIED_TYPE_NAME);
-
- PersistentAttribute persistentAttribute = getJavaPersistentType().attributes().next();
- EclipseLinkBasicMapping basicMapping = (EclipseLinkBasicMapping) persistentAttribute.getSpecifiedMapping();
- Mutable mutable = basicMapping.getMutable();
- assertTrue(mutable.isMutable());
-
- JavaResourcePersistentType typeResource = getJpaProject().getJavaResourcePersistentType(FULLY_QUALIFIED_TYPE_NAME);
- JavaResourcePersistentAttribute attributeResource = typeResource.persistableAttributes().next();
- attributeResource.removeSupportingAnnotation(MutableAnnotation.ANNOTATION_NAME);
- assertTrue(mutable.isMutable());
-
- mutable.setSpecifiedMutable(Boolean.TRUE);
- assertTrue(mutable.isMutable());
- }
-}
diff --git a/jpa/tests/org.eclipse.jpt.eclipselink.core.tests/src/org/eclipse/jpt/eclipselink/core/tests/internal/context/java/EclipseLinkJavaCachingTests.java b/jpa/tests/org.eclipse.jpt.eclipselink.core.tests/src/org/eclipse/jpt/eclipselink/core/tests/internal/context/java/EclipseLinkJavaCachingTests.java
deleted file mode 100644
index 5c8c30410f..0000000000
--- a/jpa/tests/org.eclipse.jpt.eclipselink.core.tests/src/org/eclipse/jpt/eclipselink/core/tests/internal/context/java/EclipseLinkJavaCachingTests.java
+++ /dev/null
@@ -1,632 +0,0 @@
-/*******************************************************************************
- * Copyright (c) 2007, 2009 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.
- *
- * Contributors:
- * Oracle - initial API and implementation
- ******************************************************************************/
-package org.eclipse.jpt.eclipselink.core.tests.internal.context.java;
-
-import java.util.Iterator;
-import org.eclipse.jdt.core.ICompilationUnit;
-import org.eclipse.jpt.core.resource.java.JPA;
-import org.eclipse.jpt.core.resource.java.JavaResourcePersistentType;
-import org.eclipse.jpt.eclipselink.core.context.CacheCoordinationType;
-import org.eclipse.jpt.eclipselink.core.context.CacheType;
-import org.eclipse.jpt.eclipselink.core.context.ExpiryTimeOfDay;
-import org.eclipse.jpt.eclipselink.core.context.ExistenceType;
-import org.eclipse.jpt.eclipselink.core.context.java.JavaCaching;
-import org.eclipse.jpt.eclipselink.core.context.java.EclipseLinkJavaEntity;
-import org.eclipse.jpt.eclipselink.core.resource.java.CacheAnnotation;
-import org.eclipse.jpt.eclipselink.core.resource.java.EclipseLinkJPA;
-import org.eclipse.jpt.eclipselink.core.resource.java.ExistenceCheckingAnnotation;
-import org.eclipse.jpt.eclipselink.core.tests.internal.context.EclipseLinkContextModelTestCase;
-import org.eclipse.jpt.utility.internal.iterators.ArrayIterator;
-
-@SuppressWarnings("nls")
-public class EclipseLinkJavaCachingTests extends EclipseLinkContextModelTestCase
-{
- public EclipseLinkJavaCachingTests(String name) {
- super(name);
- }
-
- private ICompilationUnit createTestEntity() 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");
- }
- });
- }
-
- public void testSetSpecifiedShared() throws Exception {
- createTestEntity();
- addXmlClassRef(FULLY_QUALIFIED_TYPE_NAME);
-
- EclipseLinkJavaEntity entity = (EclipseLinkJavaEntity) getJavaPersistentType().getMapping();
- JavaCaching caching = entity.getCaching();
-
- assertEquals(true, caching.isShared());
-
- caching.setSpecifiedShared(Boolean.FALSE);
-
-
- assertEquals(Boolean.FALSE, entity.getCaching().getSpecifiedShared());
- assertEquals(false, entity.getCaching().isShared());
-
- JavaResourcePersistentType typeResource = getJpaProject().getJavaResourcePersistentType(FULLY_QUALIFIED_TYPE_NAME);
-
- CacheAnnotation cacheAnnotation = (CacheAnnotation) typeResource.getSupportingAnnotation(EclipseLinkJPA.CACHE);
-
- assertEquals(Boolean.FALSE, cacheAnnotation.getShared());
- }
-
- public void testSetSpecifiedSharedFalseUnsetsOtherCacheSettings() throws Exception {
- createTestEntity();
- addXmlClassRef(FULLY_QUALIFIED_TYPE_NAME);
-
- EclipseLinkJavaEntity entity = (EclipseLinkJavaEntity) getJavaPersistentType().getMapping();
- JavaCaching caching = entity.getCaching();
-
- caching.setSpecifiedType(CacheType.HARD_WEAK);
- caching.setSpecifiedSize(Integer.valueOf(500));
- caching.setSpecifiedAlwaysRefresh(Boolean.FALSE);
- caching.setSpecifiedRefreshOnlyIfNewer(Boolean.FALSE);
- caching.setSpecifiedDisableHits(Boolean.FALSE);
- caching.setSpecifiedCoordinationType(CacheCoordinationType.INVALIDATE_CHANGED_OBJECTS);
- caching.setExistenceChecking(true);
- caching.setSpecifiedExistenceType(ExistenceType.CHECK_CACHE);
- caching.setExpiry(Integer.valueOf(8000));
-
- caching.setSpecifiedShared(Boolean.FALSE);
-
- assertEquals(null, caching.getSpecifiedType());
- assertEquals(null, caching.getSpecifiedSize());
- assertEquals(null, caching.getSpecifiedAlwaysRefresh());
- assertEquals(null, caching.getSpecifiedRefreshOnlyIfNewer());
- assertEquals(null, caching.getSpecifiedDisableHits());
- assertEquals(null, caching.getSpecifiedCoordinationType());
- assertEquals(null, caching.getExpiry());
-
-
- //existence checking is the only thing that isn't unset when shared is set to false
- assertTrue(caching.hasExistenceChecking());
- assertEquals(ExistenceType.CHECK_CACHE, caching.getSpecifiedExistenceType());
-
- caching.setSpecifiedShared(null);
- ExpiryTimeOfDay timeOfDayExpiry = caching.addExpiryTimeOfDay();
- timeOfDayExpiry.setHour(Integer.valueOf(5));
-
- caching.setSpecifiedShared(Boolean.FALSE);
- assertNull(caching.getExpiryTimeOfDay());
-
-
- JavaResourcePersistentType typeResource = getJpaProject().getJavaResourcePersistentType(FULLY_QUALIFIED_TYPE_NAME);
- CacheAnnotation cacheAnnotation = (CacheAnnotation) typeResource.getSupportingAnnotation(EclipseLinkJPA.CACHE);
-
- assertEquals(Boolean.FALSE, cacheAnnotation.getShared());
- assertNull(cacheAnnotation.getExpiryTimeOfDay());
- }
-
- public void testGetSpecifiedShared() throws Exception {
- createTestEntity();
- addXmlClassRef(FULLY_QUALIFIED_TYPE_NAME);
-
- EclipseLinkJavaEntity entity = (EclipseLinkJavaEntity) getJavaPersistentType().getMapping();
- JavaCaching caching = entity.getCaching();
-
- assertEquals(true, caching.isShared());
-
- JavaResourcePersistentType typeResource = getJpaProject().getJavaResourcePersistentType(FULLY_QUALIFIED_TYPE_NAME);
- CacheAnnotation cacheAnnotation = (CacheAnnotation) typeResource.addSupportingAnnotation(EclipseLinkJPA.CACHE);
- cacheAnnotation.setShared(Boolean.FALSE);
-
- assertEquals(Boolean.FALSE, cacheAnnotation.getShared());
- assertEquals(Boolean.FALSE, entity.getCaching().getSpecifiedShared());
- assertEquals(false, entity.getCaching().isShared());
- }
-
- public void testSetSpecifiedType() throws Exception {
- createTestEntity();
- addXmlClassRef(FULLY_QUALIFIED_TYPE_NAME);
-
- EclipseLinkJavaEntity entity = (EclipseLinkJavaEntity) getJavaPersistentType().getMapping();
- JavaCaching caching = entity.getCaching();
-
- assertEquals(CacheType.SOFT_WEAK, caching.getType());
-
- caching.setSpecifiedType(CacheType.HARD_WEAK);
-
-
- assertEquals(CacheType.HARD_WEAK, entity.getCaching().getSpecifiedType());
- assertEquals(CacheType.HARD_WEAK, entity.getCaching().getType());
-
- JavaResourcePersistentType typeResource = getJpaProject().getJavaResourcePersistentType(FULLY_QUALIFIED_TYPE_NAME);
-
- CacheAnnotation cacheAnnotation = (CacheAnnotation) typeResource.getSupportingAnnotation(EclipseLinkJPA.CACHE);
-
- assertEquals(org.eclipse.jpt.eclipselink.core.resource.java.CacheType.HARD_WEAK, cacheAnnotation.getType());
-
-
- //set specified type to the same as the default, verify it is not set to default
- caching.setSpecifiedType(CacheType.SOFT_WEAK);
- assertEquals(CacheType.SOFT_WEAK, caching.getSpecifiedType());
- assertEquals(org.eclipse.jpt.eclipselink.core.resource.java.CacheType.SOFT_WEAK, cacheAnnotation.getType());
-
- caching.setSpecifiedType(null);
- assertNull(caching.getSpecifiedType());
- assertEquals(CacheType.SOFT_WEAK, caching.getType());
- }
-
- public void testGetSpecifiedType() throws Exception {
- createTestEntity();
- addXmlClassRef(FULLY_QUALIFIED_TYPE_NAME);
-
- EclipseLinkJavaEntity entity = (EclipseLinkJavaEntity) getJavaPersistentType().getMapping();
- JavaCaching caching = entity.getCaching();
-
- assertEquals(CacheType.SOFT_WEAK, caching.getType());
-
- JavaResourcePersistentType typeResource = getJpaProject().getJavaResourcePersistentType(FULLY_QUALIFIED_TYPE_NAME);
- CacheAnnotation cacheAnnotation = (CacheAnnotation) typeResource.addSupportingAnnotation(EclipseLinkJPA.CACHE);
- cacheAnnotation.setType(org.eclipse.jpt.eclipselink.core.resource.java.CacheType.HARD_WEAK);
-
- assertEquals(org.eclipse.jpt.eclipselink.core.resource.java.CacheType.HARD_WEAK, cacheAnnotation.getType());
- assertEquals(CacheType.HARD_WEAK, entity.getCaching().getSpecifiedType());
- assertEquals(CacheType.HARD_WEAK, entity.getCaching().getType());
- }
-
- public void testSetSpecifiedAlwaysRefresh() throws Exception {
- createTestEntity();
- addXmlClassRef(FULLY_QUALIFIED_TYPE_NAME);
-
- EclipseLinkJavaEntity entity = (EclipseLinkJavaEntity) getJavaPersistentType().getMapping();
- JavaCaching caching = entity.getCaching();
-
- assertEquals(false, caching.isAlwaysRefresh());
-
- caching.setSpecifiedAlwaysRefresh(Boolean.FALSE);
-
-
- assertEquals(Boolean.FALSE, entity.getCaching().getSpecifiedAlwaysRefresh());
- assertEquals(false, entity.getCaching().isAlwaysRefresh());
-
- JavaResourcePersistentType typeResource = getJpaProject().getJavaResourcePersistentType(FULLY_QUALIFIED_TYPE_NAME);
-
- CacheAnnotation cacheAnnotation = (CacheAnnotation) typeResource.getSupportingAnnotation(EclipseLinkJPA.CACHE);
-
- assertEquals(Boolean.FALSE, cacheAnnotation.getAlwaysRefresh());
- }
-
- public void testGetSpecifiedAlwaysRefresh() throws Exception {
- createTestEntity();
- addXmlClassRef(FULLY_QUALIFIED_TYPE_NAME);
-
- EclipseLinkJavaEntity entity = (EclipseLinkJavaEntity) getJavaPersistentType().getMapping();
- JavaCaching caching = entity.getCaching();
-
- assertEquals(false, caching.isAlwaysRefresh());
-
- JavaResourcePersistentType typeResource = getJpaProject().getJavaResourcePersistentType(FULLY_QUALIFIED_TYPE_NAME);
- CacheAnnotation cacheAnnotation = (CacheAnnotation) typeResource.addSupportingAnnotation(EclipseLinkJPA.CACHE);
- cacheAnnotation.setAlwaysRefresh(Boolean.TRUE);
-
- assertEquals(Boolean.TRUE, cacheAnnotation.getAlwaysRefresh());
- assertEquals(Boolean.TRUE, entity.getCaching().getSpecifiedAlwaysRefresh());
- assertEquals(true, entity.getCaching().isAlwaysRefresh());
- }
-
- public void testSetSpecifiedRefreshOnlyIfNewer() throws Exception {
- createTestEntity();
- addXmlClassRef(FULLY_QUALIFIED_TYPE_NAME);
-
- EclipseLinkJavaEntity entity = (EclipseLinkJavaEntity) getJavaPersistentType().getMapping();
- JavaCaching caching = entity.getCaching();
-
- assertEquals(false, caching.isRefreshOnlyIfNewer());
-
- caching.setSpecifiedRefreshOnlyIfNewer(Boolean.TRUE);
-
-
- assertEquals(Boolean.TRUE, entity.getCaching().getSpecifiedRefreshOnlyIfNewer());
- assertEquals(true, entity.getCaching().isRefreshOnlyIfNewer());
-
- JavaResourcePersistentType typeResource = getJpaProject().getJavaResourcePersistentType(FULLY_QUALIFIED_TYPE_NAME);
-
- CacheAnnotation cacheAnnotation = (CacheAnnotation) typeResource.getSupportingAnnotation(EclipseLinkJPA.CACHE);
-
- assertEquals(Boolean.TRUE, cacheAnnotation.getRefreshOnlyIfNewer());
- }
-
- public void testGetSpecifiedRefreshOnlyIfNewer() throws Exception {
- createTestEntity();
- addXmlClassRef(FULLY_QUALIFIED_TYPE_NAME);
-
- EclipseLinkJavaEntity entity = (EclipseLinkJavaEntity) getJavaPersistentType().getMapping();
- JavaCaching caching = entity.getCaching();
-
- assertEquals(false, caching.isRefreshOnlyIfNewer());
-
- JavaResourcePersistentType typeResource = getJpaProject().getJavaResourcePersistentType(FULLY_QUALIFIED_TYPE_NAME);
- CacheAnnotation cacheAnnotation = (CacheAnnotation) typeResource.addSupportingAnnotation(EclipseLinkJPA.CACHE);
- cacheAnnotation.setRefreshOnlyIfNewer(Boolean.TRUE);
-
- assertEquals(Boolean.TRUE, cacheAnnotation.getRefreshOnlyIfNewer());
- assertEquals(Boolean.TRUE, entity.getCaching().getSpecifiedRefreshOnlyIfNewer());
- assertEquals(true, entity.getCaching().isRefreshOnlyIfNewer());
- }
-
- public void testSetSpecifiedDisableHits() throws Exception {
- createTestEntity();
- addXmlClassRef(FULLY_QUALIFIED_TYPE_NAME);
-
- EclipseLinkJavaEntity entity = (EclipseLinkJavaEntity) getJavaPersistentType().getMapping();
- JavaCaching caching = entity.getCaching();
-
- assertEquals(false, caching.isDisableHits());
-
- caching.setSpecifiedDisableHits(Boolean.TRUE);
-
-
- assertEquals(Boolean.TRUE, entity.getCaching().getSpecifiedDisableHits());
- assertEquals(true, entity.getCaching().isDisableHits());
-
- JavaResourcePersistentType typeResource = getJpaProject().getJavaResourcePersistentType(FULLY_QUALIFIED_TYPE_NAME);
-
- CacheAnnotation cacheAnnotation = (CacheAnnotation) typeResource.getSupportingAnnotation(EclipseLinkJPA.CACHE);
-
- assertEquals(Boolean.TRUE, cacheAnnotation.getDisableHits());
- }
-
- public void testGetSpecifiedDisableHits() throws Exception {
- createTestEntity();
- addXmlClassRef(FULLY_QUALIFIED_TYPE_NAME);
-
- EclipseLinkJavaEntity entity = (EclipseLinkJavaEntity) getJavaPersistentType().getMapping();
- JavaCaching caching = entity.getCaching();
-
- assertEquals(false, caching.isDisableHits());
-
- JavaResourcePersistentType typeResource = getJpaProject().getJavaResourcePersistentType(FULLY_QUALIFIED_TYPE_NAME);
- CacheAnnotation cacheAnnotation = (CacheAnnotation) typeResource.addSupportingAnnotation(EclipseLinkJPA.CACHE);
- cacheAnnotation.setDisableHits(Boolean.TRUE);
-
- assertEquals(Boolean.TRUE, cacheAnnotation.getDisableHits());
- assertEquals(Boolean.TRUE, entity.getCaching().getSpecifiedDisableHits());
- assertEquals(true, entity.getCaching().isDisableHits());
- }
-
- public void testSetSpecifiedCoordinationType() throws Exception {
- createTestEntity();
- addXmlClassRef(FULLY_QUALIFIED_TYPE_NAME);
-
- EclipseLinkJavaEntity entity = (EclipseLinkJavaEntity) getJavaPersistentType().getMapping();
- JavaCaching caching = entity.getCaching();
-
- assertEquals(CacheCoordinationType.SEND_OBJECT_CHANGES, caching.getCoordinationType());
-
- caching.setSpecifiedCoordinationType(CacheCoordinationType.INVALIDATE_CHANGED_OBJECTS);
-
-
- assertEquals(CacheCoordinationType.INVALIDATE_CHANGED_OBJECTS, entity.getCaching().getSpecifiedCoordinationType());
- assertEquals(CacheCoordinationType.INVALIDATE_CHANGED_OBJECTS, entity.getCaching().getCoordinationType());
-
- JavaResourcePersistentType typeResource = getJpaProject().getJavaResourcePersistentType(FULLY_QUALIFIED_TYPE_NAME);
-
- CacheAnnotation cacheAnnotation = (CacheAnnotation) typeResource.getSupportingAnnotation(EclipseLinkJPA.CACHE);
-
- assertEquals(org.eclipse.jpt.eclipselink.core.resource.java.CacheCoordinationType.INVALIDATE_CHANGED_OBJECTS, cacheAnnotation.getCoordinationType());
-
-
- //set specified coordination type to the same as the default, verify it is not set to default
- caching.setSpecifiedCoordinationType(CacheCoordinationType.SEND_OBJECT_CHANGES);
- assertEquals(CacheCoordinationType.SEND_OBJECT_CHANGES, caching.getSpecifiedCoordinationType());
- assertEquals(org.eclipse.jpt.eclipselink.core.resource.java.CacheCoordinationType.SEND_OBJECT_CHANGES, cacheAnnotation.getCoordinationType());
-
- caching.setSpecifiedCoordinationType(null);
- assertNull(caching.getSpecifiedCoordinationType());
- assertEquals(CacheCoordinationType.SEND_OBJECT_CHANGES, caching.getCoordinationType());
- }
-
- public void testGetSpecifiedCoordinationType() throws Exception {
- createTestEntity();
- addXmlClassRef(FULLY_QUALIFIED_TYPE_NAME);
-
- EclipseLinkJavaEntity entity = (EclipseLinkJavaEntity) getJavaPersistentType().getMapping();
- JavaCaching caching = entity.getCaching();
-
- assertEquals(CacheCoordinationType.SEND_OBJECT_CHANGES, caching.getCoordinationType());
-
- JavaResourcePersistentType typeResource = getJpaProject().getJavaResourcePersistentType(FULLY_QUALIFIED_TYPE_NAME);
- CacheAnnotation cacheAnnotation = (CacheAnnotation) typeResource.addSupportingAnnotation(EclipseLinkJPA.CACHE);
- cacheAnnotation.setCoordinationType(org.eclipse.jpt.eclipselink.core.resource.java.CacheCoordinationType.INVALIDATE_CHANGED_OBJECTS);
-
- assertEquals(org.eclipse.jpt.eclipselink.core.resource.java.CacheCoordinationType.INVALIDATE_CHANGED_OBJECTS, cacheAnnotation.getCoordinationType());
- assertEquals(CacheCoordinationType.INVALIDATE_CHANGED_OBJECTS, entity.getCaching().getSpecifiedCoordinationType());
- assertEquals(CacheCoordinationType.INVALIDATE_CHANGED_OBJECTS, entity.getCaching().getCoordinationType());
- }
-
- public void testHasExistenceChecking() throws Exception {
- createTestEntity();
- addXmlClassRef(FULLY_QUALIFIED_TYPE_NAME);
-
- EclipseLinkJavaEntity entity = (EclipseLinkJavaEntity) getJavaPersistentType().getMapping();
- JavaCaching caching = entity.getCaching();
-
- assertEquals(false, caching.hasExistenceChecking());
-
- JavaResourcePersistentType typeResource = getJpaProject().getJavaResourcePersistentType(FULLY_QUALIFIED_TYPE_NAME);
- typeResource.addSupportingAnnotation(EclipseLinkJPA.EXISTENCE_CHECKING);
- assertEquals(true, caching.hasExistenceChecking());
-
- typeResource.removeSupportingAnnotation(EclipseLinkJPA.EXISTENCE_CHECKING);
- assertEquals(false, caching.hasExistenceChecking());
- }
-
- public void testSetExistenceChecking() throws Exception {
- createTestEntity();
- addXmlClassRef(FULLY_QUALIFIED_TYPE_NAME);
-
- EclipseLinkJavaEntity entity = (EclipseLinkJavaEntity) getJavaPersistentType().getMapping();
- JavaCaching caching = entity.getCaching();
- JavaResourcePersistentType typeResource = getJpaProject().getJavaResourcePersistentType(FULLY_QUALIFIED_TYPE_NAME);
-
- assertEquals(false, caching.hasExistenceChecking());
- assertNull(typeResource.getSupportingAnnotation(EclipseLinkJPA.EXISTENCE_CHECKING));
-
- caching.setExistenceChecking(true);
-
- assertEquals(true, caching.hasExistenceChecking());
- assertNotNull(typeResource.getSupportingAnnotation(EclipseLinkJPA.EXISTENCE_CHECKING));
- }
-
- public void testGetDefaultExistenceType() throws Exception {
- createTestEntity();
- addXmlClassRef(FULLY_QUALIFIED_TYPE_NAME);
-
- EclipseLinkJavaEntity entity = (EclipseLinkJavaEntity) getJavaPersistentType().getMapping();
- JavaCaching caching = entity.getCaching();
-
- assertEquals(ExistenceType.CHECK_DATABASE, caching.getDefaultExistenceType());
-
- caching.setExistenceChecking(true);
- assertEquals(ExistenceType.CHECK_CACHE, caching.getDefaultExistenceType());
- }
-
- public void testGetSpecifiedExistenceType() throws Exception {
- createTestEntity();
- addXmlClassRef(FULLY_QUALIFIED_TYPE_NAME);
-
- EclipseLinkJavaEntity entity = (EclipseLinkJavaEntity) getJavaPersistentType().getMapping();
- JavaCaching caching = entity.getCaching();
-
- assertEquals(ExistenceType.CHECK_DATABASE, caching.getExistenceType());
-
- JavaResourcePersistentType typeResource = getJpaProject().getJavaResourcePersistentType(FULLY_QUALIFIED_TYPE_NAME);
- ExistenceCheckingAnnotation existenceCheckingAnnotation = (ExistenceCheckingAnnotation) typeResource.addSupportingAnnotation(EclipseLinkJPA.EXISTENCE_CHECKING);
- existenceCheckingAnnotation.setValue(org.eclipse.jpt.eclipselink.core.resource.java.ExistenceType.ASSUME_NON_EXISTENCE);
-
- assertEquals(org.eclipse.jpt.eclipselink.core.resource.java.ExistenceType.ASSUME_NON_EXISTENCE, existenceCheckingAnnotation.getValue());
- assertEquals(ExistenceType.ASSUME_NON_EXISTENCE, entity.getCaching().getSpecifiedExistenceType());
- assertEquals(ExistenceType.ASSUME_NON_EXISTENCE, entity.getCaching().getExistenceType());
- }
-
- public void testSetSpecifiedExistenceType() throws Exception {
- createTestEntity();
- addXmlClassRef(FULLY_QUALIFIED_TYPE_NAME);
-
- EclipseLinkJavaEntity entity = (EclipseLinkJavaEntity) getJavaPersistentType().getMapping();
- JavaCaching caching = entity.getCaching();
-
- assertEquals(ExistenceType.CHECK_DATABASE, caching.getExistenceType());
-
- caching.setExistenceChecking(true);
- caching.setSpecifiedExistenceType(ExistenceType.ASSUME_NON_EXISTENCE);
-
-
- assertEquals(ExistenceType.ASSUME_NON_EXISTENCE, entity.getCaching().getSpecifiedExistenceType());
- assertEquals(ExistenceType.ASSUME_NON_EXISTENCE, entity.getCaching().getExistenceType());
-
- JavaResourcePersistentType typeResource = getJpaProject().getJavaResourcePersistentType(FULLY_QUALIFIED_TYPE_NAME);
-
- ExistenceCheckingAnnotation existenceCheckingAnnotation = (ExistenceCheckingAnnotation) typeResource.getSupportingAnnotation(EclipseLinkJPA.EXISTENCE_CHECKING);
-
- assertEquals(org.eclipse.jpt.eclipselink.core.resource.java.ExistenceType.ASSUME_NON_EXISTENCE, existenceCheckingAnnotation.getValue());
-
-
- //set specified coordination type to the same as the default, verify it is not set to default
- caching.setSpecifiedExistenceType(ExistenceType.CHECK_DATABASE);
- assertEquals(ExistenceType.CHECK_DATABASE, caching.getSpecifiedExistenceType());
- assertEquals(org.eclipse.jpt.eclipselink.core.resource.java.ExistenceType.CHECK_DATABASE, existenceCheckingAnnotation.getValue());
-
- caching.setSpecifiedExistenceType(null);
- assertNull(caching.getSpecifiedExistenceType());
- assertEquals(ExistenceType.CHECK_CACHE, caching.getExistenceType());
- }
-
- public void testGetExpiry() throws Exception {
- createTestEntity();
- addXmlClassRef(FULLY_QUALIFIED_TYPE_NAME);
-
- EclipseLinkJavaEntity entity = (EclipseLinkJavaEntity) getJavaPersistentType().getMapping();
-
- assertNull(entity.getCaching().getExpiry());
-
- JavaResourcePersistentType typeResource = getJpaProject().getJavaResourcePersistentType(FULLY_QUALIFIED_TYPE_NAME);
- CacheAnnotation cacheAnnotation = (CacheAnnotation) typeResource.addSupportingAnnotation(EclipseLinkJPA.CACHE);
- assertNull(entity.getCaching().getExpiry());
-
- cacheAnnotation.setExpiry(Integer.valueOf(57));
-
- assertEquals(Integer.valueOf(57), entity.getCaching().getExpiry());
-
- typeResource.removeSupportingAnnotation(EclipseLinkJPA.CACHE);
- assertNull(entity.getCaching().getExpiry());
- }
-
- public void testSetExpiry() throws Exception {
- createTestEntity();
- addXmlClassRef(FULLY_QUALIFIED_TYPE_NAME);
-
- EclipseLinkJavaEntity entity = (EclipseLinkJavaEntity) getJavaPersistentType().getMapping();
- JavaCaching caching = entity.getCaching();
-
- JavaResourcePersistentType typeResource = getJpaProject().getJavaResourcePersistentType(FULLY_QUALIFIED_TYPE_NAME);
-
- caching.setExpiry(Integer.valueOf(58));
- CacheAnnotation cacheAnnotation = (CacheAnnotation) typeResource.getSupportingAnnotation(EclipseLinkJPA.CACHE);
- assertEquals(Integer.valueOf(58), cacheAnnotation.getExpiry());
-
-
- caching.setExpiry(null);
- cacheAnnotation = (CacheAnnotation) typeResource.getSupportingAnnotation(EclipseLinkJPA.CACHE);
- assertNull(cacheAnnotation);
- }
-
- public void testSetExpiryUnsetsExpiryTimeOfDay() throws Exception {
- createTestEntity();
- addXmlClassRef(FULLY_QUALIFIED_TYPE_NAME);
-
- EclipseLinkJavaEntity entity = (EclipseLinkJavaEntity) getJavaPersistentType().getMapping();
- JavaCaching caching = entity.getCaching();
-
- JavaResourcePersistentType typeResource = getJpaProject().getJavaResourcePersistentType(FULLY_QUALIFIED_TYPE_NAME);
-
- caching.addExpiryTimeOfDay();
- caching.getExpiryTimeOfDay().setHour(Integer.valueOf(5));
- CacheAnnotation cacheAnnotation = (CacheAnnotation) typeResource.getSupportingAnnotation(EclipseLinkJPA.CACHE);
- assertEquals(Integer.valueOf(5), cacheAnnotation.getExpiryTimeOfDay().getHour());
-
- caching.setExpiry(Integer.valueOf(900));
-
- assertNull(caching.getExpiryTimeOfDay());
- assertNull(cacheAnnotation.getExpiryTimeOfDay());
- assertEquals(Integer.valueOf(900), cacheAnnotation.getExpiry());
- assertEquals(Integer.valueOf(900), caching.getExpiry());
- }
-
- public void testGetTimeOfDayExpiry() throws Exception {
- createTestEntity();
- addXmlClassRef(FULLY_QUALIFIED_TYPE_NAME);
-
- EclipseLinkJavaEntity entity = (EclipseLinkJavaEntity) getJavaPersistentType().getMapping();
- JavaCaching caching = entity.getCaching();
-
- assertNull(caching.getExpiryTimeOfDay());
-
- JavaResourcePersistentType typeResource = getJpaProject().getJavaResourcePersistentType(FULLY_QUALIFIED_TYPE_NAME);
- CacheAnnotation cacheAnnotation = (CacheAnnotation) typeResource.addSupportingAnnotation(EclipseLinkJPA.CACHE);
-
- cacheAnnotation.addExpiryTimeOfDay();
-
- assertNotNull(caching.getExpiryTimeOfDay());
- }
-
- public void testAddTimeOfDayExpiry() throws Exception {
- createTestEntity();
- addXmlClassRef(FULLY_QUALIFIED_TYPE_NAME);
-
- EclipseLinkJavaEntity entity = (EclipseLinkJavaEntity) getJavaPersistentType().getMapping();
- JavaCaching caching = entity.getCaching();
-
- assertNull(caching.getExpiryTimeOfDay());
-
- JavaResourcePersistentType typeResource = getJpaProject().getJavaResourcePersistentType(FULLY_QUALIFIED_TYPE_NAME);
-
- ExpiryTimeOfDay timeOfDayExpiry = caching.addExpiryTimeOfDay();
-
- CacheAnnotation cacheAnnotation = (CacheAnnotation) typeResource.getSupportingAnnotation(EclipseLinkJPA.CACHE);
- assertNotNull(cacheAnnotation.getExpiryTimeOfDay());
- assertNotNull(caching.getExpiryTimeOfDay());
- assertEquals(timeOfDayExpiry, caching.getExpiryTimeOfDay());
- }
-
- public void testRemoveTimeOfDayExpiry() throws Exception {
- createTestEntity();
- addXmlClassRef(FULLY_QUALIFIED_TYPE_NAME);
-
- EclipseLinkJavaEntity entity = (EclipseLinkJavaEntity) getJavaPersistentType().getMapping();
- JavaCaching caching = entity.getCaching();
-
- assertNull(caching.getExpiryTimeOfDay());
-
- JavaResourcePersistentType typeResource = getJpaProject().getJavaResourcePersistentType(FULLY_QUALIFIED_TYPE_NAME);
- CacheAnnotation cacheAnnotation = (CacheAnnotation) typeResource.addSupportingAnnotation(EclipseLinkJPA.CACHE);
- cacheAnnotation.addExpiryTimeOfDay();
-
- assertNotNull(caching.getExpiryTimeOfDay());
-
- caching.removeExpiryTimeOfDay();
- assertNull(caching.getExpiryTimeOfDay());
- assertNull(typeResource.getSupportingAnnotation(EclipseLinkJPA.CACHE));
- }
-
- public void testAddTimeOfDayExpiryUnsetsExpiry() throws Exception {
- createTestEntity();
- addXmlClassRef(FULLY_QUALIFIED_TYPE_NAME);
-
- EclipseLinkJavaEntity entity = (EclipseLinkJavaEntity) getJavaPersistentType().getMapping();
- JavaCaching caching = entity.getCaching();
-
- JavaResourcePersistentType typeResource = getJpaProject().getJavaResourcePersistentType(FULLY_QUALIFIED_TYPE_NAME);
- caching.setExpiry(Integer.valueOf(800));
- CacheAnnotation cacheAnnotation = (CacheAnnotation) typeResource.getSupportingAnnotation(EclipseLinkJPA.CACHE);
- assertEquals(Integer.valueOf(800), cacheAnnotation.getExpiry());
-
-
- caching.addExpiryTimeOfDay();
-
-
- assertNull(caching.getExpiry());
- assertNull(cacheAnnotation.getExpiry());
- assertNotNull(cacheAnnotation.getExpiryTimeOfDay());
- }
-
-
- public void testSetSpecifiedSize() throws Exception {
- createTestEntity();
- addXmlClassRef(FULLY_QUALIFIED_TYPE_NAME);
-
- EclipseLinkJavaEntity entity = (EclipseLinkJavaEntity) getJavaPersistentType().getMapping();
- JavaCaching caching = entity.getCaching();
-
- assertEquals(100, caching.getSize());
-
- caching.setSpecifiedSize(new Integer(50));
-
-
- assertEquals(new Integer(50), entity.getCaching().getSpecifiedSize());
- assertEquals(50, entity.getCaching().getSize());
-
- JavaResourcePersistentType typeResource = getJpaProject().getJavaResourcePersistentType(FULLY_QUALIFIED_TYPE_NAME);
-
- CacheAnnotation cacheAnnotation = (CacheAnnotation) typeResource.getSupportingAnnotation(EclipseLinkJPA.CACHE);
-
- assertEquals(new Integer(50), cacheAnnotation.getSize());
- }
-
- public void testGetSpecifiedSize() throws Exception {
- createTestEntity();
- addXmlClassRef(FULLY_QUALIFIED_TYPE_NAME);
-
- EclipseLinkJavaEntity entity = (EclipseLinkJavaEntity) getJavaPersistentType().getMapping();
- JavaCaching caching = entity.getCaching();
-
- assertEquals(100, caching.getSize());
-
- JavaResourcePersistentType typeResource = getJpaProject().getJavaResourcePersistentType(FULLY_QUALIFIED_TYPE_NAME);
- CacheAnnotation cacheAnnotation = (CacheAnnotation) typeResource.addSupportingAnnotation(EclipseLinkJPA.CACHE);
- cacheAnnotation.setSize(new Integer(50));
-
- assertEquals(new Integer(50), cacheAnnotation.getSize());
- assertEquals(new Integer(50), entity.getCaching().getSpecifiedSize());
- assertEquals(50, entity.getCaching().getSize());
- }
-
-}
diff --git a/jpa/tests/org.eclipse.jpt.eclipselink.core.tests/src/org/eclipse/jpt/eclipselink/core/tests/internal/context/java/EclipseLinkJavaConvertTests.java b/jpa/tests/org.eclipse.jpt.eclipselink.core.tests/src/org/eclipse/jpt/eclipselink/core/tests/internal/context/java/EclipseLinkJavaConvertTests.java
deleted file mode 100644
index 736274b531..0000000000
--- a/jpa/tests/org.eclipse.jpt.eclipselink.core.tests/src/org/eclipse/jpt/eclipselink/core/tests/internal/context/java/EclipseLinkJavaConvertTests.java
+++ /dev/null
@@ -1,221 +0,0 @@
-/*******************************************************************************
- * Copyright (c) 2007, 2009 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.
- *
- * Contributors:
- * Oracle - initial API and implementation
- ******************************************************************************/
-package org.eclipse.jpt.eclipselink.core.tests.internal.context.java;
-
-import java.util.Iterator;
-import org.eclipse.jdt.core.ICompilationUnit;
-import org.eclipse.jpt.core.context.BasicMapping;
-import org.eclipse.jpt.core.context.Converter;
-import org.eclipse.jpt.core.context.PersistentAttribute;
-import org.eclipse.jpt.core.resource.java.JPA;
-import org.eclipse.jpt.core.resource.java.JavaResourcePersistentAttribute;
-import org.eclipse.jpt.core.resource.java.JavaResourcePersistentType;
-import org.eclipse.jpt.eclipselink.core.context.Convert;
-import org.eclipse.jpt.eclipselink.core.context.EclipseLinkConverter;
-import org.eclipse.jpt.eclipselink.core.resource.java.ConvertAnnotation;
-import org.eclipse.jpt.eclipselink.core.resource.java.EclipseLinkJPA;
-import org.eclipse.jpt.eclipselink.core.resource.java.StructConverterAnnotation;
-import org.eclipse.jpt.eclipselink.core.resource.java.TypeConverterAnnotation;
-import org.eclipse.jpt.eclipselink.core.tests.internal.context.EclipseLinkContextModelTestCase;
-import org.eclipse.jpt.utility.internal.iterators.ArrayIterator;
-
-@SuppressWarnings("nls")
-public class EclipseLinkJavaConvertTests extends EclipseLinkContextModelTestCase
-{
-
- private ICompilationUnit createTestEntityWithBasicMapping() throws Exception {
- return this.createTestType(new DefaultAnnotationWriter() {
- @Override
- public Iterator<String> imports() {
- return new ArrayIterator<String>(JPA.ENTITY, JPA.BASIC);
- }
- @Override
- public void appendTypeAnnotationTo(StringBuilder sb) {
- sb.append("@Entity").append(CR);
- }
-
- @Override
- public void appendIdFieldAnnotationTo(StringBuilder sb) {
- sb.append("@Basic").append(CR);
- }
- });
- }
-
-
- private ICompilationUnit createTestEntityWithConvert() throws Exception {
- return this.createTestType(new DefaultAnnotationWriter() {
- @Override
- public Iterator<String> imports() {
- return new ArrayIterator<String>(JPA.ENTITY, EclipseLinkJPA.CONVERT);
- }
- @Override
- public void appendTypeAnnotationTo(StringBuilder sb) {
- sb.append("@Entity").append(CR);
- }
-
- @Override
- public void appendIdFieldAnnotationTo(StringBuilder sb) {
- sb.append("@Convert(\"class-instance\")").append(CR);
- }
- });
- }
-
- private ICompilationUnit createTestEntityWithConvertAndTypeConverter() throws Exception {
- return this.createTestType(new DefaultAnnotationWriter() {
- @Override
- public Iterator<String> imports() {
- return new ArrayIterator<String>(JPA.ENTITY, EclipseLinkJPA.CONVERT, EclipseLinkJPA.TYPE_CONVERTER);
- }
- @Override
- public void appendTypeAnnotationTo(StringBuilder sb) {
- sb.append("@Entity");
- }
-
- @Override
- public void appendIdFieldAnnotationTo(StringBuilder sb) {
- sb.append("@Convert(\"class-instance\")").append(CR);
- sb.append(" @TypeConverter");
- }
- });
- }
-
- public EclipseLinkJavaConvertTests(String name) {
- super(name);
- }
-
-
- public void testGetConverterName() throws Exception {
- createTestEntityWithBasicMapping();
- addXmlClassRef(FULLY_QUALIFIED_TYPE_NAME);
-
- JavaResourcePersistentType typeResource = getJpaProject().getJavaResourcePersistentType(FULLY_QUALIFIED_TYPE_NAME);
- JavaResourcePersistentAttribute attributeResource = typeResource.persistableAttributes().next();
- attributeResource.addSupportingAnnotation(ConvertAnnotation.ANNOTATION_NAME);
-
- PersistentAttribute persistentAttribute = getJavaPersistentType().attributes().next();
- BasicMapping basicMapping = (BasicMapping) persistentAttribute.getSpecifiedMapping();
- Convert eclipseLinkConvert = (Convert) basicMapping.getConverter();
-
- assertEquals(Convert.NO_CONVERTER, eclipseLinkConvert.getConverterName());
- assertEquals(Convert.NO_CONVERTER, eclipseLinkConvert.getDefaultConverterName());
- assertEquals(null, eclipseLinkConvert.getSpecifiedConverterName());
- }
-
- public void testGetConvertName2() throws Exception {
- createTestEntityWithConvert();
- addXmlClassRef(FULLY_QUALIFIED_TYPE_NAME);
-
- PersistentAttribute persistentAttribute = getJavaPersistentType().attributes().next();
- BasicMapping basicMapping = (BasicMapping) persistentAttribute.getMapping();
- Convert eclipseLinkConvert = (Convert) basicMapping.getConverter();
-
- assertEquals(Convert.CLASS_INSTANCE_CONVERTER, eclipseLinkConvert.getConverterName());
- }
-
- public void testSetSpecifiedConverterName() throws Exception {
- createTestEntityWithBasicMapping();
- addXmlClassRef(FULLY_QUALIFIED_TYPE_NAME);
-
- PersistentAttribute persistentAttribute = getJavaPersistentType().attributes().next();
- BasicMapping basicMapping = (BasicMapping) persistentAttribute.getSpecifiedMapping();
- basicMapping.setSpecifiedConverter(Convert.ECLIPSE_LINK_CONVERTER);
- Convert eclipseLinkConvert = (Convert) basicMapping.getConverter();
- assertEquals(null, eclipseLinkConvert.getSpecifiedConverterName());
-
- eclipseLinkConvert.setSpecifiedConverterName("foo");
-
- JavaResourcePersistentType typeResource = getJpaProject().getJavaResourcePersistentType(FULLY_QUALIFIED_TYPE_NAME);
- JavaResourcePersistentAttribute attributeResource = typeResource.persistableAttributes().next();
- ConvertAnnotation convertAnnotation = (ConvertAnnotation) attributeResource.getSupportingAnnotation(ConvertAnnotation.ANNOTATION_NAME);
-
- assertEquals("foo", convertAnnotation.getValue());
-
- eclipseLinkConvert.setSpecifiedConverterName(null);
- convertAnnotation = (ConvertAnnotation) attributeResource.getSupportingAnnotation(ConvertAnnotation.ANNOTATION_NAME);
- assertNotNull(convertAnnotation);
- assertEquals(null, convertAnnotation.getValue());
- }
-
- public void testGetConverterNameUpdatesFromResourceModelChange() throws Exception {
- createTestEntityWithBasicMapping();
- addXmlClassRef(FULLY_QUALIFIED_TYPE_NAME);
-
- PersistentAttribute persistentAttribute = getJavaPersistentType().attributes().next();
- BasicMapping basicMapping = (BasicMapping) persistentAttribute.getSpecifiedMapping();
-
- assertEquals(Converter.NO_CONVERTER, basicMapping.getConverter().getType());
-
-
- JavaResourcePersistentType typeResource = getJpaProject().getJavaResourcePersistentType(FULLY_QUALIFIED_TYPE_NAME);
- JavaResourcePersistentAttribute attributeResource = typeResource.persistableAttributes().next();
- ConvertAnnotation convert = (ConvertAnnotation) attributeResource.addSupportingAnnotation(ConvertAnnotation.ANNOTATION_NAME);
- convert.setValue("foo");
-
- assertEquals(Convert.ECLIPSE_LINK_CONVERTER, basicMapping.getConverter().getType());
- assertEquals("foo", ((Convert) basicMapping.getConverter()).getConverterName());
-
- attributeResource.removeSupportingAnnotation(ConvertAnnotation.ANNOTATION_NAME);
-
- assertEquals(Converter.NO_CONVERTER, basicMapping.getConverter().getType());
- assertFalse(basicMapping.isDefault());
- assertSame(basicMapping, persistentAttribute.getSpecifiedMapping());
- }
-
-
- public void testGetConverter() throws Exception {
- createTestEntityWithConvertAndTypeConverter();
- addXmlClassRef(FULLY_QUALIFIED_TYPE_NAME);
-
- PersistentAttribute persistentAttribute = getJavaPersistentType().attributes().next();
- BasicMapping basicMapping = (BasicMapping) persistentAttribute.getMapping();
- Convert eclipseLinkConvert = (Convert) basicMapping.getConverter();
-
- assertEquals(EclipseLinkConverter.TYPE_CONVERTER, eclipseLinkConvert.getConverter().getType());
- }
-
- public void testSetConverter() throws Exception {
- createTestEntityWithConvert();
- addXmlClassRef(FULLY_QUALIFIED_TYPE_NAME);
-
- PersistentAttribute persistentAttribute = getJavaPersistentType().attributes().next();
- BasicMapping basicMapping = (BasicMapping) persistentAttribute.getMapping();
- Convert eclipseLinkConvert = (Convert) basicMapping.getConverter();
-
- assertEquals(null, eclipseLinkConvert.getConverter());
-
- eclipseLinkConvert.setConverter(EclipseLinkConverter.TYPE_CONVERTER);
- assertEquals(EclipseLinkConverter.TYPE_CONVERTER, eclipseLinkConvert.getConverter().getType());
-
- JavaResourcePersistentType typeResource = getJpaProject().getJavaResourcePersistentType(FULLY_QUALIFIED_TYPE_NAME);
- JavaResourcePersistentAttribute attributeResource = typeResource.persistableAttributes().next();
- assertNotNull(attributeResource.getSupportingAnnotation(TypeConverterAnnotation.ANNOTATION_NAME));
-
- eclipseLinkConvert.setConverter(EclipseLinkConverter.STRUCT_CONVERTER);
- assertEquals(EclipseLinkConverter.STRUCT_CONVERTER, eclipseLinkConvert.getConverter().getType());
- assertNotNull(attributeResource.getSupportingAnnotation(StructConverterAnnotation.ANNOTATION_NAME));
- assertNull(attributeResource.getSupportingAnnotation(TypeConverterAnnotation.ANNOTATION_NAME));
-
- eclipseLinkConvert.setConverter(EclipseLinkConverter.NO_CONVERTER);
- assertEquals(null, eclipseLinkConvert.getConverter());
- assertNull(attributeResource.getSupportingAnnotation(StructConverterAnnotation.ANNOTATION_NAME));
- assertNull(attributeResource.getSupportingAnnotation(TypeConverterAnnotation.ANNOTATION_NAME));
-
- eclipseLinkConvert.setConverter(EclipseLinkConverter.STRUCT_CONVERTER);
- assertEquals(EclipseLinkConverter.STRUCT_CONVERTER, eclipseLinkConvert.getConverter().getType());
- assertNotNull(attributeResource.getSupportingAnnotation(StructConverterAnnotation.ANNOTATION_NAME));
-
-
- basicMapping.setSpecifiedConverter(null);
- assertNull(attributeResource.getSupportingAnnotation(StructConverterAnnotation.ANNOTATION_NAME));
- assertNull(attributeResource.getSupportingAnnotation(ConvertAnnotation.ANNOTATION_NAME));
-
- }
-
-}
diff --git a/jpa/tests/org.eclipse.jpt.eclipselink.core.tests/src/org/eclipse/jpt/eclipselink/core/tests/internal/context/java/EclipseLinkJavaConverterTests.java b/jpa/tests/org.eclipse.jpt.eclipselink.core.tests/src/org/eclipse/jpt/eclipselink/core/tests/internal/context/java/EclipseLinkJavaConverterTests.java
deleted file mode 100644
index 2628328397..0000000000
--- a/jpa/tests/org.eclipse.jpt.eclipselink.core.tests/src/org/eclipse/jpt/eclipselink/core/tests/internal/context/java/EclipseLinkJavaConverterTests.java
+++ /dev/null
@@ -1,214 +0,0 @@
-/*******************************************************************************
- * Copyright (c) 2007, 2009 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.
- *
- * Contributors:
- * Oracle - initial API and implementation
- ******************************************************************************/
-package org.eclipse.jpt.eclipselink.core.tests.internal.context.java;
-
-import java.util.Iterator;
-import org.eclipse.jdt.core.ICompilationUnit;
-import org.eclipse.jpt.core.context.BasicMapping;
-import org.eclipse.jpt.core.context.PersistentAttribute;
-import org.eclipse.jpt.core.resource.java.JPA;
-import org.eclipse.jpt.core.resource.java.JavaResourcePersistentAttribute;
-import org.eclipse.jpt.core.resource.java.JavaResourcePersistentType;
-import org.eclipse.jpt.eclipselink.core.context.Convert;
-import org.eclipse.jpt.eclipselink.core.context.CustomConverter;
-import org.eclipse.jpt.eclipselink.core.resource.java.ConverterAnnotation;
-import org.eclipse.jpt.eclipselink.core.resource.java.EclipseLinkJPA;
-import org.eclipse.jpt.eclipselink.core.tests.internal.context.EclipseLinkContextModelTestCase;
-import org.eclipse.jpt.utility.internal.iterators.ArrayIterator;
-
-@SuppressWarnings("nls")
-public class EclipseLinkJavaConverterTests extends EclipseLinkContextModelTestCase
-{
-
-
- private ICompilationUnit createTestEntityWithConvertAndConverter() throws Exception {
- return this.createTestType(new DefaultAnnotationWriter() {
- @Override
- public Iterator<String> imports() {
- return new ArrayIterator<String>(JPA.ENTITY, EclipseLinkJPA.CONVERT, EclipseLinkJPA.CONVERTER);
- }
- @Override
- public void appendTypeAnnotationTo(StringBuilder sb) {
- sb.append("@Entity");
- }
-
- @Override
- public void appendIdFieldAnnotationTo(StringBuilder sb) {
- sb.append("@Convert(\"foo\")").append(CR);
- sb.append(" @Converter(name=\"foo\"");
- }
- });
- }
-
- private ICompilationUnit createTestEntityWithConvertAndConverterClass() throws Exception {
- return this.createTestType(new DefaultAnnotationWriter() {
- @Override
- public Iterator<String> imports() {
- return new ArrayIterator<String>(JPA.ENTITY, EclipseLinkJPA.CONVERT, EclipseLinkJPA.CONVERTER);
- }
- @Override
- public void appendTypeAnnotationTo(StringBuilder sb) {
- sb.append("@Entity");
- }
-
- @Override
- public void appendIdFieldAnnotationTo(StringBuilder sb) {
- sb.append("@Convert(\"foo\")").append(CR);
- sb.append(" @Converter(converterClass=Foo.class");
- }
- });
- }
-
- public EclipseLinkJavaConverterTests(String name) {
- super(name);
- }
-
-
- public void testGetName() throws Exception {
- createTestEntityWithConvertAndConverter();
- addXmlClassRef(FULLY_QUALIFIED_TYPE_NAME);
-
- PersistentAttribute persistentAttribute = getJavaPersistentType().attributes().next();
- BasicMapping basicMapping = (BasicMapping) persistentAttribute.getMapping();
- Convert eclipseLinkConvert = (Convert) basicMapping.getConverter();
- CustomConverter converter = (CustomConverter) eclipseLinkConvert.getConverter();
-
- assertEquals("foo", converter.getName());
- }
-
- public void testSetName() throws Exception {
- createTestEntityWithConvertAndConverter();
- addXmlClassRef(FULLY_QUALIFIED_TYPE_NAME);
-
- PersistentAttribute persistentAttribute = getJavaPersistentType().attributes().next();
- BasicMapping basicMapping = (BasicMapping) persistentAttribute.getMapping();
- Convert eclipseLinkConvert = (Convert) basicMapping.getConverter();
- CustomConverter converter = (CustomConverter) eclipseLinkConvert.getConverter();
- assertEquals("foo", converter.getName());
-
- converter.setName("bar");
- assertEquals("bar", converter.getName());
-
- JavaResourcePersistentType typeResource = getJpaProject().getJavaResourcePersistentType(FULLY_QUALIFIED_TYPE_NAME);
- JavaResourcePersistentAttribute attributeResource = typeResource.persistableAttributes().next();
- ConverterAnnotation converterAnnotation = (ConverterAnnotation) attributeResource.getSupportingAnnotation(ConverterAnnotation.ANNOTATION_NAME);
- assertEquals("bar", converterAnnotation.getName());
-
-
- converter.setName(null);
- assertEquals(null, converter.getName());
- converterAnnotation = (ConverterAnnotation) attributeResource.getSupportingAnnotation(ConverterAnnotation.ANNOTATION_NAME);
- assertEquals(null, converterAnnotation.getName());
-
-
- converter.setName("bar");
- assertEquals("bar", converter.getName());
- converterAnnotation = (ConverterAnnotation) attributeResource.getSupportingAnnotation(ConverterAnnotation.ANNOTATION_NAME);
- assertEquals("bar", converterAnnotation.getName());
- }
-
- public void testGetNameUpdatesFromResourceModelChange() throws Exception {
- createTestEntityWithConvertAndConverter();
- addXmlClassRef(FULLY_QUALIFIED_TYPE_NAME);
-
- PersistentAttribute persistentAttribute = getJavaPersistentType().attributes().next();
- BasicMapping basicMapping = (BasicMapping) persistentAttribute.getMapping();
- Convert eclipseLinkConvert = (Convert) basicMapping.getConverter();
- CustomConverter converter = (CustomConverter) eclipseLinkConvert.getConverter();
-
- assertEquals("foo", converter.getName());
-
- JavaResourcePersistentType typeResource = getJpaProject().getJavaResourcePersistentType(FULLY_QUALIFIED_TYPE_NAME);
- JavaResourcePersistentAttribute attributeResource = typeResource.persistableAttributes().next();
- ConverterAnnotation converterAnnotation = (ConverterAnnotation) attributeResource.getSupportingAnnotation(ConverterAnnotation.ANNOTATION_NAME);
- converterAnnotation.setName("bar");
- assertEquals("bar", converter.getName());
-
- attributeResource.removeSupportingAnnotation(ConverterAnnotation.ANNOTATION_NAME);
- assertEquals(null, eclipseLinkConvert.getConverter());
-
- converterAnnotation = (ConverterAnnotation) attributeResource.addSupportingAnnotation(ConverterAnnotation.ANNOTATION_NAME);
- assertNotNull(eclipseLinkConvert.getConverter());
-
- converterAnnotation.setName("FOO");
- assertEquals("FOO", eclipseLinkConvert.getConverter().getName());
- }
-
-
- public void testGetConverterClass() throws Exception {
- createTestEntityWithConvertAndConverterClass();
- addXmlClassRef(FULLY_QUALIFIED_TYPE_NAME);
-
- PersistentAttribute persistentAttribute = getJavaPersistentType().attributes().next();
- BasicMapping basicMapping = (BasicMapping) persistentAttribute.getMapping();
- Convert eclipseLinkConvert = (Convert) basicMapping.getConverter();
- CustomConverter converter = (CustomConverter) eclipseLinkConvert.getConverter();
-
- assertEquals("Foo", converter.getConverterClass());
- }
-
- public void testSetConverterClass() throws Exception {
- createTestEntityWithConvertAndConverterClass();
- addXmlClassRef(FULLY_QUALIFIED_TYPE_NAME);
-
- PersistentAttribute persistentAttribute = getJavaPersistentType().attributes().next();
- BasicMapping basicMapping = (BasicMapping) persistentAttribute.getMapping();
- Convert eclipseLinkConvert = (Convert) basicMapping.getConverter();
- CustomConverter converter = (CustomConverter) eclipseLinkConvert.getConverter();
- assertEquals("Foo", converter.getConverterClass());
-
- converter.setConverterClass("Bar");
- assertEquals("Bar", converter.getConverterClass());
-
- JavaResourcePersistentType typeResource = getJpaProject().getJavaResourcePersistentType(FULLY_QUALIFIED_TYPE_NAME);
- JavaResourcePersistentAttribute attributeResource = typeResource.persistableAttributes().next();
- ConverterAnnotation converterAnnotation = (ConverterAnnotation) attributeResource.getSupportingAnnotation(ConverterAnnotation.ANNOTATION_NAME);
- assertEquals("Bar", converterAnnotation.getConverterClass());
-
-
- converter.setConverterClass(null);
- assertEquals(null, converter.getConverterClass());
- converterAnnotation = (ConverterAnnotation) attributeResource.getSupportingAnnotation(ConverterAnnotation.ANNOTATION_NAME);
- assertEquals(null, converterAnnotation.getConverterClass());
-
-
- converter.setConverterClass("Bar");
- assertEquals("Bar", converter.getConverterClass());
- converterAnnotation = (ConverterAnnotation) attributeResource.getSupportingAnnotation(ConverterAnnotation.ANNOTATION_NAME);
- assertEquals("Bar", converterAnnotation.getConverterClass());
- }
-
- public void testGetConverterClassUpdatesFromResourceModelChange() throws Exception {
- createTestEntityWithConvertAndConverterClass();
- addXmlClassRef(FULLY_QUALIFIED_TYPE_NAME);
-
- PersistentAttribute persistentAttribute = getJavaPersistentType().attributes().next();
- BasicMapping basicMapping = (BasicMapping) persistentAttribute.getMapping();
- Convert eclipseLinkConvert = (Convert) basicMapping.getConverter();
- CustomConverter converter = (CustomConverter) eclipseLinkConvert.getConverter();
-
- assertEquals("Foo", converter.getConverterClass());
-
- JavaResourcePersistentType typeResource = getJpaProject().getJavaResourcePersistentType(FULLY_QUALIFIED_TYPE_NAME);
- JavaResourcePersistentAttribute attributeResource = typeResource.persistableAttributes().next();
- ConverterAnnotation converterAnnotation = (ConverterAnnotation) attributeResource.getSupportingAnnotation(ConverterAnnotation.ANNOTATION_NAME);
- converterAnnotation.setConverterClass("Bar");
- assertEquals("Bar", converter.getConverterClass());
-
- attributeResource.removeSupportingAnnotation(ConverterAnnotation.ANNOTATION_NAME);
- assertEquals(null, eclipseLinkConvert.getConverter());
-
- converterAnnotation = (ConverterAnnotation) attributeResource.addSupportingAnnotation(ConverterAnnotation.ANNOTATION_NAME);
- assertNotNull(eclipseLinkConvert.getConverter());
-
- converterAnnotation.setConverterClass("FooBar");
- assertEquals("FooBar", ((CustomConverter) eclipseLinkConvert.getConverter()).getConverterClass());
- }
-}
diff --git a/jpa/tests/org.eclipse.jpt.eclipselink.core.tests/src/org/eclipse/jpt/eclipselink/core/tests/internal/context/java/EclipseLinkJavaEmbeddableTests.java b/jpa/tests/org.eclipse.jpt.eclipselink.core.tests/src/org/eclipse/jpt/eclipselink/core/tests/internal/context/java/EclipseLinkJavaEmbeddableTests.java
deleted file mode 100644
index 321bf343e1..0000000000
--- a/jpa/tests/org.eclipse.jpt.eclipselink.core.tests/src/org/eclipse/jpt/eclipselink/core/tests/internal/context/java/EclipseLinkJavaEmbeddableTests.java
+++ /dev/null
@@ -1,251 +0,0 @@
-/*******************************************************************************
- * Copyright (c) 2008, 2009 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.
- *
- * Contributors:
- * Oracle - initial API and implementation
- ******************************************************************************/
-package org.eclipse.jpt.eclipselink.core.tests.internal.context.java;
-
-import java.util.Iterator;
-
-import org.eclipse.jdt.core.ICompilationUnit;
-import org.eclipse.jpt.core.resource.java.JPA;
-import org.eclipse.jpt.core.resource.java.JavaResourcePersistentType;
-import org.eclipse.jpt.eclipselink.core.context.ChangeTracking;
-import org.eclipse.jpt.eclipselink.core.context.ChangeTrackingType;
-import org.eclipse.jpt.eclipselink.core.context.Customizer;
-import org.eclipse.jpt.eclipselink.core.context.EclipseLinkEmbeddable;
-import org.eclipse.jpt.eclipselink.core.resource.java.ChangeTrackingAnnotation;
-import org.eclipse.jpt.eclipselink.core.resource.java.CustomizerAnnotation;
-import org.eclipse.jpt.eclipselink.core.resource.java.EclipseLinkJPA;
-import org.eclipse.jpt.eclipselink.core.tests.internal.context.EclipseLinkContextModelTestCase;
-import org.eclipse.jpt.utility.internal.iterators.ArrayIterator;
-
-@SuppressWarnings("nls")
-public class EclipseLinkJavaEmbeddableTests extends EclipseLinkContextModelTestCase
-{
-
- private ICompilationUnit createTestEmbeddableWithConvertAndCustomizerClass() throws Exception {
- return this.createTestType(new DefaultAnnotationWriter() {
- @Override
- public Iterator<String> imports() {
- return new ArrayIterator<String>(JPA.EMBEDDABLE, EclipseLinkJPA.CUSTOMIZER);
- }
- @Override
- public void appendTypeAnnotationTo(StringBuilder sb) {
- sb.append("@Embeddable").append(CR);
- sb.append(" @Customizer(Foo.class");
- }
- });
- }
-
- private ICompilationUnit createTestEmbeddableWithChangeTracking() throws Exception {
- return this.createTestType(new DefaultAnnotationWriter() {
- @Override
- public Iterator<String> imports() {
- return new ArrayIterator<String>(JPA.EMBEDDABLE, EclipseLinkJPA.CHANGE_TRACKING);
- }
- @Override
- public void appendTypeAnnotationTo(StringBuilder sb) {
- sb.append("@Embeddable").append(CR);
- sb.append(" @ChangeTracking").append(CR);
- }
- });
- }
-
- public EclipseLinkJavaEmbeddableTests(String name) {
- super(name);
- }
-
-
- public void testGetCustomizerClass() throws Exception {
- createTestEmbeddableWithConvertAndCustomizerClass();
- addXmlClassRef(FULLY_QUALIFIED_TYPE_NAME);
-
- Customizer customizer = ((EclipseLinkEmbeddable) getJavaPersistentType().getMapping()).getCustomizer();
-
- assertEquals("Foo", customizer.getSpecifiedCustomizerClass());
- }
-
- public void testSetCustomizerClass() throws Exception {
- createTestEmbeddableWithConvertAndCustomizerClass();
- addXmlClassRef(FULLY_QUALIFIED_TYPE_NAME);
-
- Customizer customizer = ((EclipseLinkEmbeddable) getJavaPersistentType().getMapping()).getCustomizer();
- assertEquals("Foo", customizer.getSpecifiedCustomizerClass());
-
- customizer.setSpecifiedCustomizerClass("Bar");
- assertEquals("Bar", customizer.getSpecifiedCustomizerClass());
-
- JavaResourcePersistentType typeResource = getJpaProject().getJavaResourcePersistentType(FULLY_QUALIFIED_TYPE_NAME);
- CustomizerAnnotation customizerAnnotation = (CustomizerAnnotation) typeResource.getSupportingAnnotation(CustomizerAnnotation.ANNOTATION_NAME);
- assertEquals("Bar", customizerAnnotation.getValue());
-
-
- customizer.setSpecifiedCustomizerClass(null);
- assertEquals(null, customizer.getSpecifiedCustomizerClass());
- customizerAnnotation = (CustomizerAnnotation) typeResource.getSupportingAnnotation(CustomizerAnnotation.ANNOTATION_NAME);
- assertEquals(null, customizerAnnotation);
-
-
- customizer.setSpecifiedCustomizerClass("Bar");
- assertEquals("Bar", customizer.getSpecifiedCustomizerClass());
- customizerAnnotation = (CustomizerAnnotation) typeResource.getSupportingAnnotation(CustomizerAnnotation.ANNOTATION_NAME);
- assertEquals("Bar", customizerAnnotation.getValue());
- }
-
- public void testGetCustomizerClassUpdatesFromResourceModelChange() throws Exception {
- createTestEmbeddableWithConvertAndCustomizerClass();
- addXmlClassRef(FULLY_QUALIFIED_TYPE_NAME);
- EclipseLinkEmbeddable embeddable = (EclipseLinkEmbeddable) getJavaPersistentType().getMapping();
- Customizer customizer = embeddable.getCustomizer();
-
- assertEquals("Foo", customizer.getSpecifiedCustomizerClass());
-
- JavaResourcePersistentType typeResource = getJpaProject().getJavaResourcePersistentType(FULLY_QUALIFIED_TYPE_NAME);
- CustomizerAnnotation customizerAnnotation = (CustomizerAnnotation) typeResource.getSupportingAnnotation(CustomizerAnnotation.ANNOTATION_NAME);
- customizerAnnotation.setValue("Bar");
- assertEquals("Bar", customizer.getSpecifiedCustomizerClass());
-
- typeResource.removeSupportingAnnotation(CustomizerAnnotation.ANNOTATION_NAME);
- assertEquals(null, customizer.getSpecifiedCustomizerClass());
-
- customizerAnnotation = (CustomizerAnnotation) typeResource.addSupportingAnnotation(CustomizerAnnotation.ANNOTATION_NAME);
- assertEquals(null, customizer.getSpecifiedCustomizerClass());
-
- customizerAnnotation.setValue("FooBar");
- assertEquals("FooBar", customizer.getSpecifiedCustomizerClass());
- }
-
- public void testGetChangeTracking() throws Exception {
- createTestEmbeddableWithChangeTracking();
- addXmlClassRef(FULLY_QUALIFIED_TYPE_NAME);
-
- EclipseLinkEmbeddable embeddable = (EclipseLinkEmbeddable) getJavaPersistentType().getMapping();
- ChangeTracking contextChangeTracking = embeddable.getChangeTracking();
- JavaResourcePersistentType typeResource = getJpaProject().getJavaResourcePersistentType(FULLY_QUALIFIED_TYPE_NAME);
- ChangeTrackingAnnotation resourceChangeTracking = (ChangeTrackingAnnotation) typeResource.getSupportingAnnotation(ChangeTrackingAnnotation.ANNOTATION_NAME);
-
- // base annotated, test context value
-
- assertNull(resourceChangeTracking.getValue());
- assertEquals(ChangeTrackingType.AUTO, contextChangeTracking.getType());
- assertEquals(ChangeTrackingType.AUTO, contextChangeTracking.getDefaultType());
- assertEquals(ChangeTrackingType.AUTO, contextChangeTracking.getSpecifiedType());
-
- // change resource to ATTRIBUTE specifically, test context
-
- resourceChangeTracking.setValue(org.eclipse.jpt.eclipselink.core.resource.java.ChangeTrackingType.ATTRIBUTE);
-
- assertEquals(org.eclipse.jpt.eclipselink.core.resource.java.ChangeTrackingType.ATTRIBUTE, resourceChangeTracking.getValue());
- assertEquals(ChangeTrackingType.ATTRIBUTE, contextChangeTracking.getType());
- assertEquals(ChangeTrackingType.AUTO, contextChangeTracking.getDefaultType());
- assertEquals(ChangeTrackingType.ATTRIBUTE, contextChangeTracking.getSpecifiedType());
-
- // change resource to OBJECT specifically, test context
-
- resourceChangeTracking.setValue(org.eclipse.jpt.eclipselink.core.resource.java.ChangeTrackingType.OBJECT);
-
- assertEquals(org.eclipse.jpt.eclipselink.core.resource.java.ChangeTrackingType.OBJECT, resourceChangeTracking.getValue());
- assertEquals(ChangeTrackingType.OBJECT, contextChangeTracking.getType());
- assertEquals(ChangeTrackingType.AUTO, contextChangeTracking.getDefaultType());
- assertEquals(ChangeTrackingType.OBJECT, contextChangeTracking.getSpecifiedType());
-
- // change resource to DEFERRED specifically, test context
-
- resourceChangeTracking.setValue(org.eclipse.jpt.eclipselink.core.resource.java.ChangeTrackingType.DEFERRED);
-
- assertEquals(org.eclipse.jpt.eclipselink.core.resource.java.ChangeTrackingType.DEFERRED, resourceChangeTracking.getValue());
- assertEquals(ChangeTrackingType.DEFERRED, contextChangeTracking.getType());
- assertEquals(ChangeTrackingType.AUTO, contextChangeTracking.getDefaultType());
- assertEquals(ChangeTrackingType.DEFERRED, contextChangeTracking.getSpecifiedType());
-
- // change resource to AUTO specifically, test context
-
- resourceChangeTracking.setValue(org.eclipse.jpt.eclipselink.core.resource.java.ChangeTrackingType.AUTO);
-
- assertEquals(org.eclipse.jpt.eclipselink.core.resource.java.ChangeTrackingType.AUTO, resourceChangeTracking.getValue());
- assertEquals(ChangeTrackingType.AUTO, contextChangeTracking.getType());
- assertEquals(ChangeTrackingType.AUTO, contextChangeTracking.getDefaultType());
- assertEquals(ChangeTrackingType.AUTO, contextChangeTracking.getSpecifiedType());
-
- // remove value from resource, test context
-
- resourceChangeTracking.setValue(null);
-
- assertNull(resourceChangeTracking.getValue());
- assertEquals(ChangeTrackingType.AUTO, contextChangeTracking.getType());
- assertEquals(ChangeTrackingType.AUTO, contextChangeTracking.getDefaultType());
- assertEquals(ChangeTrackingType.AUTO, contextChangeTracking.getSpecifiedType());
-
- // remove annotation, text context
-
- typeResource.removeSupportingAnnotation(ChangeTrackingAnnotation.ANNOTATION_NAME);
-
- assertNull(resourceChangeTracking.getValue());
- assertEquals(ChangeTrackingType.AUTO, contextChangeTracking.getType());
- assertEquals(ChangeTrackingType.AUTO, contextChangeTracking.getDefaultType());
- assertNull(contextChangeTracking.getSpecifiedType());
- }
-
- public void testSetChangeTracking() throws Exception {
- createTestEmbeddableWithChangeTracking();
- addXmlClassRef(FULLY_QUALIFIED_TYPE_NAME);
-
- EclipseLinkEmbeddable embeddable = (EclipseLinkEmbeddable) getJavaPersistentType().getMapping();
- ChangeTracking contextChangeTracking = embeddable.getChangeTracking();
- JavaResourcePersistentType typeResource = getJpaProject().getJavaResourcePersistentType(FULLY_QUALIFIED_TYPE_NAME);
- ChangeTrackingAnnotation resourceChangeTracking = (ChangeTrackingAnnotation) typeResource.getSupportingAnnotation(ChangeTrackingAnnotation.ANNOTATION_NAME);
-
- // base annotated, test resource value
-
- assertNull(resourceChangeTracking.getValue());
- assertEquals(ChangeTrackingType.AUTO, contextChangeTracking.getSpecifiedType());
-
- // change context to AUTO specifically, test resource
-
- contextChangeTracking.setSpecifiedType(ChangeTrackingType.AUTO);
-
- assertNull(resourceChangeTracking.getValue());
- assertEquals(ChangeTrackingType.AUTO, contextChangeTracking.getSpecifiedType());
-
- // change context to ATTRIBUTE specifically, test resource
-
- contextChangeTracking.setSpecifiedType(ChangeTrackingType.ATTRIBUTE);
-
- assertEquals(org.eclipse.jpt.eclipselink.core.resource.java.ChangeTrackingType.ATTRIBUTE, resourceChangeTracking.getValue());
- assertEquals(ChangeTrackingType.ATTRIBUTE, contextChangeTracking.getSpecifiedType());
-
- // change context to OBJECT specifically, test resource
-
- contextChangeTracking.setSpecifiedType(ChangeTrackingType.OBJECT);
-
- assertEquals(org.eclipse.jpt.eclipselink.core.resource.java.ChangeTrackingType.OBJECT, resourceChangeTracking.getValue());
- assertEquals(ChangeTrackingType.OBJECT, contextChangeTracking.getSpecifiedType());
-
- // change context to DEFERRED specifically, test resource
-
- contextChangeTracking.setSpecifiedType(ChangeTrackingType.DEFERRED);
-
- assertEquals(org.eclipse.jpt.eclipselink.core.resource.java.ChangeTrackingType.DEFERRED, resourceChangeTracking.getValue());
- assertEquals(ChangeTrackingType.DEFERRED, contextChangeTracking.getSpecifiedType());
-
- // change context to null, test resource
-
- contextChangeTracking.setSpecifiedType(null);
-
- assertNull(typeResource.getSupportingAnnotation(ChangeTrackingAnnotation.ANNOTATION_NAME));
- assertNull(contextChangeTracking.getSpecifiedType());
-
- // change context to AUTO specifically (this time from no annotation), test resource
-
- contextChangeTracking.setSpecifiedType(ChangeTrackingType.AUTO);
- resourceChangeTracking = (ChangeTrackingAnnotation) typeResource.getSupportingAnnotation(ChangeTrackingAnnotation.ANNOTATION_NAME);
-
- assertEquals(org.eclipse.jpt.eclipselink.core.resource.java.ChangeTrackingType.AUTO, resourceChangeTracking.getValue());
- assertEquals(ChangeTrackingType.AUTO, contextChangeTracking.getSpecifiedType());
- }
-} \ No newline at end of file
diff --git a/jpa/tests/org.eclipse.jpt.eclipselink.core.tests/src/org/eclipse/jpt/eclipselink/core/tests/internal/context/java/EclipseLinkJavaEntityTests.java b/jpa/tests/org.eclipse.jpt.eclipselink.core.tests/src/org/eclipse/jpt/eclipselink/core/tests/internal/context/java/EclipseLinkJavaEntityTests.java
deleted file mode 100644
index c5d70ec1e8..0000000000
--- a/jpa/tests/org.eclipse.jpt.eclipselink.core.tests/src/org/eclipse/jpt/eclipselink/core/tests/internal/context/java/EclipseLinkJavaEntityTests.java
+++ /dev/null
@@ -1,338 +0,0 @@
-/*******************************************************************************
- * Copyright (c) 2008, 2009 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.
- *
- * Contributors:
- * Oracle - initial API and implementation
- ******************************************************************************/
-package org.eclipse.jpt.eclipselink.core.tests.internal.context.java;
-
-import java.util.Iterator;
-import org.eclipse.jdt.core.ICompilationUnit;
-import org.eclipse.jpt.core.resource.java.JPA;
-import org.eclipse.jpt.core.resource.java.JavaResourcePersistentType;
-import org.eclipse.jpt.eclipselink.core.context.ChangeTracking;
-import org.eclipse.jpt.eclipselink.core.context.ChangeTrackingType;
-import org.eclipse.jpt.eclipselink.core.context.Customizer;
-import org.eclipse.jpt.eclipselink.core.context.EclipseLinkEntity;
-import org.eclipse.jpt.eclipselink.core.context.ReadOnly;
-import org.eclipse.jpt.eclipselink.core.resource.java.ChangeTrackingAnnotation;
-import org.eclipse.jpt.eclipselink.core.resource.java.CustomizerAnnotation;
-import org.eclipse.jpt.eclipselink.core.resource.java.EclipseLinkJPA;
-import org.eclipse.jpt.eclipselink.core.resource.java.ReadOnlyAnnotation;
-import org.eclipse.jpt.eclipselink.core.tests.internal.context.EclipseLinkContextModelTestCase;
-import org.eclipse.jpt.utility.internal.iterators.ArrayIterator;
-
-@SuppressWarnings("nls")
-public class EclipseLinkJavaEntityTests extends EclipseLinkContextModelTestCase
-{
-
- private ICompilationUnit createTestEntityWithConvertAndCustomizerClass() throws Exception {
- return this.createTestType(new DefaultAnnotationWriter() {
- @Override
- public Iterator<String> imports() {
- return new ArrayIterator<String>(JPA.ENTITY, EclipseLinkJPA.CUSTOMIZER);
- }
- @Override
- public void appendTypeAnnotationTo(StringBuilder sb) {
- sb.append("@Entity").append(CR);
- sb.append(" @Customizer(Foo.class");
- }
- });
- }
-
- private ICompilationUnit createTestEntityWithChangeTracking() throws Exception {
- return this.createTestType(new DefaultAnnotationWriter() {
- @Override
- public Iterator<String> imports() {
- return new ArrayIterator<String>(JPA.ENTITY, EclipseLinkJPA.CHANGE_TRACKING);
- }
- @Override
- public void appendTypeAnnotationTo(StringBuilder sb) {
- sb.append("@Entity").append(CR);
- sb.append(" @ChangeTracking").append(CR);
- }
- });
- }
-
- private ICompilationUnit createTestEntityWithReadOnly() throws Exception {
- return this.createTestType(new DefaultAnnotationWriter() {
- @Override
- public Iterator<String> imports() {
- return new ArrayIterator<String>(JPA.ENTITY, EclipseLinkJPA.READ_ONLY);
- }
- @Override
- public void appendTypeAnnotationTo(StringBuilder sb) {
- sb.append("@Entity").append(CR);
- sb.append("@ReadOnly").append(CR);
- }
- });
- }
-
- public EclipseLinkJavaEntityTests(String name) {
- super(name);
- }
-
-
- public void testGetCustomizerClass() throws Exception {
- createTestEntityWithConvertAndCustomizerClass();
- addXmlClassRef(FULLY_QUALIFIED_TYPE_NAME);
-
- Customizer customizer = ((EclipseLinkEntity) getJavaPersistentType().getMapping()).getCustomizer();
-
- assertEquals("Foo", customizer.getSpecifiedCustomizerClass());
- }
-
- public void testSetCustomizerClass() throws Exception {
- createTestEntityWithConvertAndCustomizerClass();
- addXmlClassRef(FULLY_QUALIFIED_TYPE_NAME);
-
- Customizer customizer = ((EclipseLinkEntity) getJavaPersistentType().getMapping()).getCustomizer();
- assertEquals("Foo", customizer.getSpecifiedCustomizerClass());
-
- customizer.setSpecifiedCustomizerClass("Bar");
- assertEquals("Bar", customizer.getSpecifiedCustomizerClass());
-
- JavaResourcePersistentType typeResource = getJpaProject().getJavaResourcePersistentType(FULLY_QUALIFIED_TYPE_NAME);
- CustomizerAnnotation customizerAnnotation = (CustomizerAnnotation) typeResource.getSupportingAnnotation(CustomizerAnnotation.ANNOTATION_NAME);
- assertEquals("Bar", customizerAnnotation.getValue());
-
-
- customizer.setSpecifiedCustomizerClass(null);
- assertEquals(null, customizer.getSpecifiedCustomizerClass());
- customizerAnnotation = (CustomizerAnnotation) typeResource.getSupportingAnnotation(CustomizerAnnotation.ANNOTATION_NAME);
- assertEquals(null, customizerAnnotation);
-
-
- customizer.setSpecifiedCustomizerClass("Bar");
- assertEquals("Bar", customizer.getSpecifiedCustomizerClass());
- customizerAnnotation = (CustomizerAnnotation) typeResource.getSupportingAnnotation(CustomizerAnnotation.ANNOTATION_NAME);
- assertEquals("Bar", customizerAnnotation.getValue());
- }
-
- public void testGetCustomizerClassUpdatesFromResourceModelChange() throws Exception {
- createTestEntityWithConvertAndCustomizerClass();
- addXmlClassRef(FULLY_QUALIFIED_TYPE_NAME);
- EclipseLinkEntity entity = (EclipseLinkEntity) getJavaPersistentType().getMapping();
- Customizer customizer = entity.getCustomizer();
-
- assertEquals("Foo", customizer.getSpecifiedCustomizerClass());
-
- JavaResourcePersistentType typeResource = getJpaProject().getJavaResourcePersistentType(FULLY_QUALIFIED_TYPE_NAME);
- CustomizerAnnotation customizerAnnotation = (CustomizerAnnotation) typeResource.getSupportingAnnotation(CustomizerAnnotation.ANNOTATION_NAME);
- customizerAnnotation.setValue("Bar");
- assertEquals("Bar", customizer.getSpecifiedCustomizerClass());
-
- typeResource.removeSupportingAnnotation(CustomizerAnnotation.ANNOTATION_NAME);
- assertEquals(null, customizer.getSpecifiedCustomizerClass());
-
- customizerAnnotation = (CustomizerAnnotation) typeResource.addSupportingAnnotation(CustomizerAnnotation.ANNOTATION_NAME);
- assertEquals(null, customizer.getSpecifiedCustomizerClass());
-
- customizerAnnotation.setValue("FooBar");
- assertEquals("FooBar", customizer.getSpecifiedCustomizerClass());
- }
-
- public void testGetChangeTracking() throws Exception {
- createTestEntityWithChangeTracking();
- addXmlClassRef(FULLY_QUALIFIED_TYPE_NAME);
-
- EclipseLinkEntity entity = (EclipseLinkEntity) getJavaPersistentType().getMapping();
- ChangeTracking contextChangeTracking = entity.getChangeTracking();
- JavaResourcePersistentType typeResource = getJpaProject().getJavaResourcePersistentType(FULLY_QUALIFIED_TYPE_NAME);
- ChangeTrackingAnnotation resourceChangeTracking = (ChangeTrackingAnnotation) typeResource.getSupportingAnnotation(ChangeTrackingAnnotation.ANNOTATION_NAME);
-
- // base annotated, test context value
-
- assertNull(resourceChangeTracking.getValue());
- assertEquals(ChangeTrackingType.AUTO, contextChangeTracking.getType());
- assertEquals(ChangeTrackingType.AUTO, contextChangeTracking.getDefaultType());
- assertEquals(ChangeTrackingType.AUTO, contextChangeTracking.getSpecifiedType());
-
- // change resource to ATTRIBUTE specifically, test context
-
- resourceChangeTracking.setValue(org.eclipse.jpt.eclipselink.core.resource.java.ChangeTrackingType.ATTRIBUTE);
-
- assertEquals(org.eclipse.jpt.eclipselink.core.resource.java.ChangeTrackingType.ATTRIBUTE, resourceChangeTracking.getValue());
- assertEquals(ChangeTrackingType.ATTRIBUTE, contextChangeTracking.getType());
- assertEquals(ChangeTrackingType.AUTO, contextChangeTracking.getDefaultType());
- assertEquals(ChangeTrackingType.ATTRIBUTE, contextChangeTracking.getSpecifiedType());
-
- // change resource to OBJECT specifically, test context
-
- resourceChangeTracking.setValue(org.eclipse.jpt.eclipselink.core.resource.java.ChangeTrackingType.OBJECT);
-
- assertEquals(org.eclipse.jpt.eclipselink.core.resource.java.ChangeTrackingType.OBJECT, resourceChangeTracking.getValue());
- assertEquals(ChangeTrackingType.OBJECT, contextChangeTracking.getType());
- assertEquals(ChangeTrackingType.AUTO, contextChangeTracking.getDefaultType());
- assertEquals(ChangeTrackingType.OBJECT, contextChangeTracking.getSpecifiedType());
-
- // change resource to DEFERRED specifically, test context
-
- resourceChangeTracking.setValue(org.eclipse.jpt.eclipselink.core.resource.java.ChangeTrackingType.DEFERRED);
-
- assertEquals(org.eclipse.jpt.eclipselink.core.resource.java.ChangeTrackingType.DEFERRED, resourceChangeTracking.getValue());
- assertEquals(ChangeTrackingType.DEFERRED, contextChangeTracking.getType());
- assertEquals(ChangeTrackingType.AUTO, contextChangeTracking.getDefaultType());
- assertEquals(ChangeTrackingType.DEFERRED, contextChangeTracking.getSpecifiedType());
-
- // change resource to AUTO specifically, test context
-
- resourceChangeTracking.setValue(org.eclipse.jpt.eclipselink.core.resource.java.ChangeTrackingType.AUTO);
-
- assertEquals(org.eclipse.jpt.eclipselink.core.resource.java.ChangeTrackingType.AUTO, resourceChangeTracking.getValue());
- assertEquals(ChangeTrackingType.AUTO, contextChangeTracking.getType());
- assertEquals(ChangeTrackingType.AUTO, contextChangeTracking.getDefaultType());
- assertEquals(ChangeTrackingType.AUTO, contextChangeTracking.getSpecifiedType());
-
- // remove value from resource, test context
-
- resourceChangeTracking.setValue(null);
-
- assertNull(resourceChangeTracking.getValue());
- assertEquals(ChangeTrackingType.AUTO, contextChangeTracking.getType());
- assertEquals(ChangeTrackingType.AUTO, contextChangeTracking.getDefaultType());
- assertEquals(ChangeTrackingType.AUTO, contextChangeTracking.getSpecifiedType());
-
- // remove annotation, text context
-
- typeResource.removeSupportingAnnotation(ChangeTrackingAnnotation.ANNOTATION_NAME);
-
- assertNull(resourceChangeTracking.getValue());
- assertEquals(ChangeTrackingType.AUTO, contextChangeTracking.getType());
- assertEquals(ChangeTrackingType.AUTO, contextChangeTracking.getDefaultType());
- assertNull(contextChangeTracking.getSpecifiedType());
- }
-
- public void testSetChangeTracking() throws Exception {
- createTestEntityWithChangeTracking();
- addXmlClassRef(FULLY_QUALIFIED_TYPE_NAME);
-
- EclipseLinkEntity entity = (EclipseLinkEntity) getJavaPersistentType().getMapping();
- ChangeTracking contextChangeTracking = entity.getChangeTracking();
- JavaResourcePersistentType typeResource = getJpaProject().getJavaResourcePersistentType(FULLY_QUALIFIED_TYPE_NAME);
- ChangeTrackingAnnotation resourceChangeTracking = (ChangeTrackingAnnotation) typeResource.getSupportingAnnotation(ChangeTrackingAnnotation.ANNOTATION_NAME);
-
- // base annotated, test resource value
-
- assertNull(resourceChangeTracking.getValue());
- assertEquals(ChangeTrackingType.AUTO, contextChangeTracking.getSpecifiedType());
-
- // change context to AUTO specifically, test resource
-
- contextChangeTracking.setSpecifiedType(ChangeTrackingType.AUTO);
-
- assertNull(resourceChangeTracking.getValue());
- assertEquals(ChangeTrackingType.AUTO, contextChangeTracking.getSpecifiedType());
-
- // change context to ATTRIBUTE specifically, test resource
-
- contextChangeTracking.setSpecifiedType(ChangeTrackingType.ATTRIBUTE);
-
- assertEquals(org.eclipse.jpt.eclipselink.core.resource.java.ChangeTrackingType.ATTRIBUTE, resourceChangeTracking.getValue());
- assertEquals(ChangeTrackingType.ATTRIBUTE, contextChangeTracking.getSpecifiedType());
-
- // change context to OBJECT specifically, test resource
-
- contextChangeTracking.setSpecifiedType(ChangeTrackingType.OBJECT);
-
- assertEquals(org.eclipse.jpt.eclipselink.core.resource.java.ChangeTrackingType.OBJECT, resourceChangeTracking.getValue());
- assertEquals(ChangeTrackingType.OBJECT, contextChangeTracking.getSpecifiedType());
-
- // change context to DEFERRED specifically, test resource
-
- contextChangeTracking.setSpecifiedType(ChangeTrackingType.DEFERRED);
-
- assertEquals(org.eclipse.jpt.eclipselink.core.resource.java.ChangeTrackingType.DEFERRED, resourceChangeTracking.getValue());
- assertEquals(ChangeTrackingType.DEFERRED, contextChangeTracking.getSpecifiedType());
-
- // change context to null, test resource
-
- contextChangeTracking.setSpecifiedType(null);
-
- assertNull(typeResource.getSupportingAnnotation(ChangeTrackingAnnotation.ANNOTATION_NAME));
- assertNull(contextChangeTracking.getSpecifiedType());
-
- // change context to AUTO specifically (this time from no annotation), test resource
-
- contextChangeTracking.setSpecifiedType(ChangeTrackingType.AUTO);
- resourceChangeTracking = (ChangeTrackingAnnotation) typeResource.getSupportingAnnotation(ChangeTrackingAnnotation.ANNOTATION_NAME);
-
- assertEquals(org.eclipse.jpt.eclipselink.core.resource.java.ChangeTrackingType.AUTO, resourceChangeTracking.getValue());
- assertEquals(ChangeTrackingType.AUTO, contextChangeTracking.getSpecifiedType());
- }
-
- public void testGetReadOnly() throws Exception {
- createTestEntityWithReadOnly();
- addXmlClassRef(FULLY_QUALIFIED_TYPE_NAME);
-
- EclipseLinkEntity mappedSuperclass = (EclipseLinkEntity) getJavaPersistentType().getMapping();
- ReadOnly readOnly = mappedSuperclass.getReadOnly();
- assertEquals(true, readOnly.isReadOnly());
- }
-
- public void testGetSpecifiedReadOnly() throws Exception {
- createTestEntityWithReadOnly();
- addXmlClassRef(FULLY_QUALIFIED_TYPE_NAME);
-
- EclipseLinkEntity mappedSuperclass = (EclipseLinkEntity) getJavaPersistentType().getMapping();
- ReadOnly readOnly = mappedSuperclass.getReadOnly();
- assertEquals(Boolean.TRUE, readOnly.getSpecifiedReadOnly());
- }
-
- //TODO test inheriting a default readonly from you superclass
- public void testGetDefaultReadOnly() throws Exception {
- createTestEntityWithReadOnly();
- addXmlClassRef(FULLY_QUALIFIED_TYPE_NAME);
-
- EclipseLinkEntity mappedSuperclass = (EclipseLinkEntity) getJavaPersistentType().getMapping();
- ReadOnly readOnly = mappedSuperclass.getReadOnly();
- assertEquals(false, readOnly.isDefaultReadOnly());
- }
-
- public void testSetSpecifiedReadOnly() throws Exception {
- createTestEntityWithReadOnly();
- addXmlClassRef(FULLY_QUALIFIED_TYPE_NAME);
-
- EclipseLinkEntity mappedSuperclass = (EclipseLinkEntity) getJavaPersistentType().getMapping();
- ReadOnly readOnly = mappedSuperclass.getReadOnly();
- assertEquals(true, readOnly.isReadOnly());
-
- readOnly.setSpecifiedReadOnly(Boolean.FALSE);
-
- JavaResourcePersistentType typeResource = getJpaProject().getJavaResourcePersistentType(FULLY_QUALIFIED_TYPE_NAME);
- assertNull(typeResource.getSupportingAnnotation(ReadOnlyAnnotation.ANNOTATION_NAME));
- assertEquals(null, readOnly.getSpecifiedReadOnly());//Boolean.FALSE and null really mean the same thing since there are only 2 states in the java resource model
-
- readOnly.setSpecifiedReadOnly(Boolean.TRUE);
- assertNotNull(typeResource.getSupportingAnnotation(ReadOnlyAnnotation.ANNOTATION_NAME));
- assertEquals(Boolean.TRUE, readOnly.getSpecifiedReadOnly());
-
- readOnly.setSpecifiedReadOnly(null);
- assertNull(typeResource.getSupportingAnnotation(ReadOnlyAnnotation.ANNOTATION_NAME));
- assertEquals(null, readOnly.getSpecifiedReadOnly());//Boolean.FALSE and null really mean the same thing since there are only 2 states in the java resource model
- }
-
- public void testSpecifiedReadOnlyUpdatesFromResourceModelChange() throws Exception {
- createTestEntityWithReadOnly();
- addXmlClassRef(FULLY_QUALIFIED_TYPE_NAME);
-
- EclipseLinkEntity mappedSuperclass = (EclipseLinkEntity) getJavaPersistentType().getMapping();
- ReadOnly readOnly = mappedSuperclass.getReadOnly();
- assertEquals(Boolean.TRUE, readOnly.getSpecifiedReadOnly());
-
-
- JavaResourcePersistentType typeResource = getJpaProject().getJavaResourcePersistentType(FULLY_QUALIFIED_TYPE_NAME);
- typeResource.removeSupportingAnnotation(ReadOnlyAnnotation.ANNOTATION_NAME);
-
- assertEquals(null, readOnly.getSpecifiedReadOnly());
- assertEquals(false, readOnly.isDefaultReadOnly());
-
- typeResource.addSupportingAnnotation(ReadOnlyAnnotation.ANNOTATION_NAME);
- assertEquals(Boolean.TRUE, readOnly.getSpecifiedReadOnly());
- }
-
-
-}
diff --git a/jpa/tests/org.eclipse.jpt.eclipselink.core.tests/src/org/eclipse/jpt/eclipselink/core/tests/internal/context/java/EclipseLinkJavaIdMappingTests.java b/jpa/tests/org.eclipse.jpt.eclipselink.core.tests/src/org/eclipse/jpt/eclipselink/core/tests/internal/context/java/EclipseLinkJavaIdMappingTests.java
deleted file mode 100644
index b5a8be7e35..0000000000
--- a/jpa/tests/org.eclipse.jpt.eclipselink.core.tests/src/org/eclipse/jpt/eclipselink/core/tests/internal/context/java/EclipseLinkJavaIdMappingTests.java
+++ /dev/null
@@ -1,316 +0,0 @@
-/*******************************************************************************
- * Copyright (c) 2007, 2009 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.
- *
- * Contributors:
- * Oracle - initial API and implementation
- ******************************************************************************/
-package org.eclipse.jpt.eclipselink.core.tests.internal.context.java;
-
-import java.util.Iterator;
-import org.eclipse.jdt.core.ICompilationUnit;
-import org.eclipse.jpt.core.context.Converter;
-import org.eclipse.jpt.core.context.IdMapping;
-import org.eclipse.jpt.core.context.PersistentAttribute;
-import org.eclipse.jpt.core.context.TemporalConverter;
-import org.eclipse.jpt.core.context.TemporalType;
-import org.eclipse.jpt.core.resource.java.JPA;
-import org.eclipse.jpt.core.resource.java.JavaResourcePersistentAttribute;
-import org.eclipse.jpt.core.resource.java.JavaResourcePersistentType;
-import org.eclipse.jpt.core.resource.java.TemporalAnnotation;
-import org.eclipse.jpt.eclipselink.core.context.Convert;
-import org.eclipse.jpt.eclipselink.core.context.EclipseLinkIdMapping;
-import org.eclipse.jpt.eclipselink.core.context.Mutable;
-import org.eclipse.jpt.eclipselink.core.resource.java.ConvertAnnotation;
-import org.eclipse.jpt.eclipselink.core.resource.java.EclipseLinkJPA;
-import org.eclipse.jpt.eclipselink.core.resource.java.MutableAnnotation;
-import org.eclipse.jpt.eclipselink.core.tests.internal.context.EclipseLinkContextModelTestCase;
-import org.eclipse.jpt.utility.internal.iterators.ArrayIterator;
-
-@SuppressWarnings("nls")
-public class EclipseLinkJavaIdMappingTests extends EclipseLinkContextModelTestCase
-{
-
- private ICompilationUnit createTestEntityWithIdMapping() 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").append(CR);
- }
-
- @Override
- public void appendIdFieldAnnotationTo(StringBuilder sb) {
- sb.append("@Id").append(CR);
- }
- });
- }
-
-
- private ICompilationUnit createTestEntityWithConvert() throws Exception {
- return this.createTestType(new DefaultAnnotationWriter() {
- @Override
- public Iterator<String> imports() {
- return new ArrayIterator<String>(JPA.ENTITY, JPA.ID, EclipseLinkJPA.CONVERT);
- }
- @Override
- public void appendTypeAnnotationTo(StringBuilder sb) {
- sb.append("@Entity").append(CR);
- }
-
- @Override
- public void appendIdFieldAnnotationTo(StringBuilder sb) {
- sb.append("@Id").append(CR);
- sb.append("@Convert(\"class-instance\")").append(CR);
- }
- });
- }
-
- private ICompilationUnit createTestEntityWithMutableId() throws Exception {
- return this.createTestType(new DefaultAnnotationWriter() {
- @Override
- public Iterator<String> imports() {
- return new ArrayIterator<String>(JPA.ENTITY, JPA.ID, EclipseLinkJPA.MUTABLE);
- }
- @Override
- public void appendTypeAnnotationTo(StringBuilder sb) {
- sb.append("@Entity").append(CR);
- }
-
- @Override
- public void appendIdFieldAnnotationTo(StringBuilder sb) {
- sb.append("@Id").append(CR);
- sb.append("@Mutable").append(CR);
- }
- });
- }
-
- private ICompilationUnit createTestEntityWithMutableIdDate() throws Exception {
- return this.createTestType(new DefaultAnnotationWriter() {
- @Override
- public Iterator<String> imports() {
- return new ArrayIterator<String>(JPA.ENTITY, JPA.ID, EclipseLinkJPA.MUTABLE, "java.util.Date");
- }
- @Override
- public void appendTypeAnnotationTo(StringBuilder sb) {
- sb.append("@Entity").append(CR);
- }
-
- @Override
- public void appendIdFieldAnnotationTo(StringBuilder sb) {
- sb.append("@Id").append(CR);
- sb.append(" @Mutable").append(CR);
- sb.append(" private Date myDate;").append(CR);
- sb.append(CR);
- sb.append(" ");
- }
- });
- }
-
- public EclipseLinkJavaIdMappingTests(String name) {
- super(name);
- }
-
-
- public void testGetConvert() throws Exception {
- createTestEntityWithIdMapping();
- addXmlClassRef(FULLY_QUALIFIED_TYPE_NAME);
-
- JavaResourcePersistentType typeResource = getJpaProject().getJavaResourcePersistentType(FULLY_QUALIFIED_TYPE_NAME);
- JavaResourcePersistentAttribute attributeResource = typeResource.persistableAttributes().next();
- attributeResource.addSupportingAnnotation(ConvertAnnotation.ANNOTATION_NAME);
-
- PersistentAttribute persistentAttribute = getJavaPersistentType().attributes().next();
- IdMapping idMapping = (IdMapping) persistentAttribute.getSpecifiedMapping();
-
- assertEquals(Convert.ECLIPSE_LINK_CONVERTER, idMapping.getConverter().getType());
- }
-
- public void testGetConvert2() throws Exception {
- createTestEntityWithConvert();
- addXmlClassRef(FULLY_QUALIFIED_TYPE_NAME);
-
- PersistentAttribute persistentAttribute = getJavaPersistentType().attributes().next();
- IdMapping idMapping = (IdMapping) persistentAttribute.getMapping();
-
- assertEquals(Convert.ECLIPSE_LINK_CONVERTER, idMapping.getConverter().getType());
- assertEquals(Convert.CLASS_INSTANCE_CONVERTER, ((Convert) idMapping.getConverter()).getConverterName());
- }
-
- public void testSetConvert() throws Exception {
- createTestEntityWithIdMapping();
- addXmlClassRef(FULLY_QUALIFIED_TYPE_NAME);
-
- PersistentAttribute persistentAttribute = getJavaPersistentType().attributes().next();
- IdMapping idMapping = (IdMapping) persistentAttribute.getSpecifiedMapping();
- assertEquals(Converter.NO_CONVERTER, idMapping.getConverter().getType());
-
- idMapping.setSpecifiedConverter(Converter.TEMPORAL_CONVERTER);
- ((TemporalConverter) idMapping.getSpecifiedConverter()).setTemporalType(TemporalType.TIME);
-
- JavaResourcePersistentType typeResource = getJpaProject().getJavaResourcePersistentType(FULLY_QUALIFIED_TYPE_NAME);
- JavaResourcePersistentAttribute attributeResource = typeResource.persistableAttributes().next();
- TemporalAnnotation temporal = (TemporalAnnotation) attributeResource.getSupportingAnnotation(TemporalAnnotation.ANNOTATION_NAME);
-
- assertEquals(org.eclipse.jpt.core.resource.java.TemporalType.TIME, temporal.getValue());
-
- idMapping.setSpecifiedConverter(null);
- assertNull(attributeResource.getSupportingAnnotation(TemporalAnnotation.ANNOTATION_NAME));
- }
-
- public void testGetConvertUpdatesFromResourceModelChange() throws Exception {
- createTestEntityWithIdMapping();
- addXmlClassRef(FULLY_QUALIFIED_TYPE_NAME);
-
- PersistentAttribute persistentAttribute = getJavaPersistentType().attributes().next();
- IdMapping idMapping = (IdMapping) persistentAttribute.getSpecifiedMapping();
-
- assertEquals(Converter.NO_CONVERTER, idMapping.getConverter().getType());
-
-
- JavaResourcePersistentType typeResource = getJpaProject().getJavaResourcePersistentType(FULLY_QUALIFIED_TYPE_NAME);
- JavaResourcePersistentAttribute attributeResource = typeResource.persistableAttributes().next();
- ConvertAnnotation convert = (ConvertAnnotation) attributeResource.addSupportingAnnotation(ConvertAnnotation.ANNOTATION_NAME);
- convert.setValue("foo");
-
- assertEquals(Convert.ECLIPSE_LINK_CONVERTER, idMapping.getConverter().getType());
- assertEquals("foo", ((Convert) idMapping.getConverter()).getConverterName());
-
- attributeResource.removeSupportingAnnotation(ConvertAnnotation.ANNOTATION_NAME);
-
- assertEquals(Converter.NO_CONVERTER, idMapping.getConverter().getType());
- assertFalse(idMapping.isDefault());
- assertSame(idMapping, persistentAttribute.getSpecifiedMapping());
- }
-
- public void testGetSpecifiedMutable() throws Exception {
- createTestEntityWithMutableId();
- addXmlClassRef(FULLY_QUALIFIED_TYPE_NAME);
-
- PersistentAttribute persistentAttribute = getJavaPersistentType().attributes().next();
- EclipseLinkIdMapping idMapping = (EclipseLinkIdMapping) persistentAttribute.getSpecifiedMapping();
- Mutable mutable = idMapping.getMutable();
- assertEquals(Boolean.TRUE, mutable.getSpecifiedMutable());
-
- JavaResourcePersistentType typeResource = getJpaProject().getJavaResourcePersistentType(FULLY_QUALIFIED_TYPE_NAME);
- JavaResourcePersistentAttribute attributeResource = typeResource.persistableAttributes().next();
- MutableAnnotation mutableAnnotation = (MutableAnnotation) attributeResource.getSupportingAnnotation(MutableAnnotation.ANNOTATION_NAME);
- mutableAnnotation.setValue(Boolean.TRUE);
-
- assertEquals(Boolean.TRUE, mutable.getSpecifiedMutable());
-
- mutableAnnotation.setValue(null);
- assertEquals(Boolean.TRUE, mutable.getSpecifiedMutable());
-
- mutableAnnotation.setValue(Boolean.FALSE);
- assertEquals(Boolean.FALSE, mutable.getSpecifiedMutable());
-
- attributeResource.removeSupportingAnnotation(MutableAnnotation.ANNOTATION_NAME);
- assertEquals(null, mutable.getSpecifiedMutable());
-
- attributeResource.addSupportingAnnotation(MutableAnnotation.ANNOTATION_NAME);
- assertEquals(Boolean.TRUE, mutable.getSpecifiedMutable());
- }
-
- public void testSetSpecifiedMutable() throws Exception {
- createTestEntityWithMutableId();
- addXmlClassRef(FULLY_QUALIFIED_TYPE_NAME);
-
- PersistentAttribute persistentAttribute = getJavaPersistentType().attributes().next();
- EclipseLinkIdMapping idMapping = (EclipseLinkIdMapping) persistentAttribute.getSpecifiedMapping();
- Mutable mutable = idMapping.getMutable();
- assertEquals(Boolean.TRUE, mutable.getSpecifiedMutable());
-
- JavaResourcePersistentType typeResource = getJpaProject().getJavaResourcePersistentType(FULLY_QUALIFIED_TYPE_NAME);
- JavaResourcePersistentAttribute attributeResource = typeResource.persistableAttributes().next();
- MutableAnnotation mutableAnnotation = (MutableAnnotation) attributeResource.getSupportingAnnotation(MutableAnnotation.ANNOTATION_NAME);
- assertEquals(null, mutableAnnotation.getValue());
-
- mutable.setSpecifiedMutable(Boolean.TRUE);
- assertEquals(null, mutableAnnotation.getValue());
-
- mutable.setSpecifiedMutable(null);
- mutableAnnotation = (MutableAnnotation) attributeResource.getSupportingAnnotation(MutableAnnotation.ANNOTATION_NAME);
- assertEquals(null, mutableAnnotation);
-
- mutable.setSpecifiedMutable(Boolean.FALSE);
- mutableAnnotation = (MutableAnnotation) attributeResource.getSupportingAnnotation(MutableAnnotation.ANNOTATION_NAME);
- assertEquals(Boolean.FALSE, mutableAnnotation.getValue());
-
- mutable.setSpecifiedMutable(Boolean.TRUE);
- assertEquals(null, mutableAnnotation.getValue());
- }
-
- public void testIsDefaultMutable() throws Exception {
- createTestEntityWithMutableId();
- addXmlClassRef(FULLY_QUALIFIED_TYPE_NAME);
-
- PersistentAttribute persistentAttribute = getJavaPersistentType().attributes().next();
- EclipseLinkIdMapping idMapping = (EclipseLinkIdMapping) persistentAttribute.getSpecifiedMapping();
- Mutable mutable = idMapping.getMutable();
- assertTrue(mutable.isDefaultMutable());
-
- JavaResourcePersistentType typeResource = getJpaProject().getJavaResourcePersistentType(FULLY_QUALIFIED_TYPE_NAME);
- JavaResourcePersistentAttribute attributeResource = typeResource.persistableAttributes().next();
- attributeResource.removeSupportingAnnotation(MutableAnnotation.ANNOTATION_NAME);
- assertTrue(mutable.isDefaultMutable());
-
- mutable.setSpecifiedMutable(Boolean.FALSE);
- assertTrue(mutable.isDefaultMutable());
-
- //set mutable default to false in the persistence unit properties, verify default in java still true since this is not a Date/Calendar
- (getPersistenceUnit()).getOptions().setTemporalMutable(Boolean.FALSE);
- assertTrue(mutable.isDefaultMutable());
- }
-
- public void testIsDefaultMutableForDate() throws Exception {
- createTestEntityWithMutableIdDate();
- addXmlClassRef(FULLY_QUALIFIED_TYPE_NAME);
-
- PersistentAttribute persistentAttribute = getJavaPersistentType().attributes().next();
- EclipseLinkIdMapping idMapping = (EclipseLinkIdMapping) persistentAttribute.getSpecifiedMapping();
- Mutable mutable = idMapping.getMutable();
- assertFalse(mutable.isDefaultMutable());
-
- JavaResourcePersistentType typeResource = getJpaProject().getJavaResourcePersistentType(FULLY_QUALIFIED_TYPE_NAME);
- JavaResourcePersistentAttribute attributeResource = typeResource.persistableAttributes().next();
- attributeResource.removeSupportingAnnotation(MutableAnnotation.ANNOTATION_NAME);
- assertFalse(mutable.isDefaultMutable());
-
- mutable.setSpecifiedMutable(Boolean.TRUE);
- assertFalse(mutable.isDefaultMutable());
-
- //set mutable default to false in the persistence unit properties, verify default in java still true since this is not a Date/Calendar
- (getPersistenceUnit()).getOptions().setTemporalMutable(Boolean.TRUE);
- assertTrue(mutable.isDefaultMutable());
-
- (getPersistenceUnit()).getOptions().setTemporalMutable(Boolean.FALSE);
- assertFalse(mutable.isDefaultMutable());
-
- (getPersistenceUnit()).getOptions().setTemporalMutable(null);
- assertFalse(mutable.isDefaultMutable());
- }
-
- public void testIsMutable() throws Exception {
- createTestEntityWithMutableId();
- addXmlClassRef(FULLY_QUALIFIED_TYPE_NAME);
-
- PersistentAttribute persistentAttribute = getJavaPersistentType().attributes().next();
- EclipseLinkIdMapping idMapping = (EclipseLinkIdMapping) persistentAttribute.getSpecifiedMapping();
- Mutable mutable = idMapping.getMutable();
- assertTrue(mutable.isMutable());
-
- JavaResourcePersistentType typeResource = getJpaProject().getJavaResourcePersistentType(FULLY_QUALIFIED_TYPE_NAME);
- JavaResourcePersistentAttribute attributeResource = typeResource.persistableAttributes().next();
- attributeResource.removeSupportingAnnotation(MutableAnnotation.ANNOTATION_NAME);
- assertTrue(mutable.isMutable());
-
- mutable.setSpecifiedMutable(Boolean.TRUE);
- assertTrue(mutable.isMutable());
- }
-}
diff --git a/jpa/tests/org.eclipse.jpt.eclipselink.core.tests/src/org/eclipse/jpt/eclipselink/core/tests/internal/context/java/EclipseLinkJavaManyToManyMappingTests.java b/jpa/tests/org.eclipse.jpt.eclipselink.core.tests/src/org/eclipse/jpt/eclipselink/core/tests/internal/context/java/EclipseLinkJavaManyToManyMappingTests.java
deleted file mode 100644
index 3f828f4028..0000000000
--- a/jpa/tests/org.eclipse.jpt.eclipselink.core.tests/src/org/eclipse/jpt/eclipselink/core/tests/internal/context/java/EclipseLinkJavaManyToManyMappingTests.java
+++ /dev/null
@@ -1,145 +0,0 @@
-/*******************************************************************************
- * Copyright (c) 2007, 2009 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.
- *
- * Contributors:
- * Oracle - initial API and implementation
- ******************************************************************************/
-package org.eclipse.jpt.eclipselink.core.tests.internal.context.java;
-
-import java.util.Iterator;
-import org.eclipse.jdt.core.ICompilationUnit;
-import org.eclipse.jpt.core.context.PersistentAttribute;
-import org.eclipse.jpt.core.resource.java.JPA;
-import org.eclipse.jpt.core.resource.java.JavaResourcePersistentAttribute;
-import org.eclipse.jpt.core.resource.java.JavaResourcePersistentType;
-import org.eclipse.jpt.eclipselink.core.context.EclipseLinkRelationshipMapping;
-import org.eclipse.jpt.eclipselink.core.context.JoinFetch;
-import org.eclipse.jpt.eclipselink.core.context.JoinFetchType;
-import org.eclipse.jpt.eclipselink.core.resource.java.EclipseLinkJPA;
-import org.eclipse.jpt.eclipselink.core.resource.java.JoinFetchAnnotation;
-import org.eclipse.jpt.eclipselink.core.tests.internal.context.EclipseLinkContextModelTestCase;
-import org.eclipse.jpt.utility.internal.iterators.ArrayIterator;
-
-
-@SuppressWarnings("nls")
-public class EclipseLinkJavaManyToManyMappingTests extends EclipseLinkContextModelTestCase
-{
-
- private ICompilationUnit createTestEntityWithJoinFetchManyToMany() throws Exception {
- return this.createTestType(new DefaultAnnotationWriter() {
- @Override
- public Iterator<String> imports() {
- return new ArrayIterator<String>(JPA.ENTITY, JPA.MANY_TO_MANY, EclipseLinkJPA.JOIN_FETCH);
- }
- @Override
- public void appendTypeAnnotationTo(StringBuilder sb) {
- sb.append("@Entity").append(CR);
- }
-
- @Override
- public void appendIdFieldAnnotationTo(StringBuilder sb) {
- sb.append("@ManyToMany").append(CR);
- sb.append("@JoinFetch").append(CR);
- }
- });
- }
-
- public EclipseLinkJavaManyToManyMappingTests(String name) {
- super(name);
- }
-
-
- public void testGetJoinFetchValue() throws Exception {
- createTestEntityWithJoinFetchManyToMany();
- addXmlClassRef(FULLY_QUALIFIED_TYPE_NAME);
-
- PersistentAttribute persistentAttribute = getJavaPersistentType().attributes().next();
- EclipseLinkRelationshipMapping manyToManyMapping = (EclipseLinkRelationshipMapping) persistentAttribute.getSpecifiedMapping();
- JoinFetch contextJoinFetch = manyToManyMapping.getJoinFetch();
- JavaResourcePersistentType typeResource = getJpaProject().getJavaResourcePersistentType(FULLY_QUALIFIED_TYPE_NAME);
- JavaResourcePersistentAttribute attributeResource = typeResource.persistableAttributes().next();
- JoinFetchAnnotation joinFetchAnnotation = (JoinFetchAnnotation) attributeResource.getSupportingAnnotation(JoinFetchAnnotation.ANNOTATION_NAME);
-
- // base annotated, test context value
-
- assertNull(joinFetchAnnotation.getValue());
- assertEquals(JoinFetchType.INNER, contextJoinFetch.getValue());
-
- // change resource to INNER specifically, test context
-
- joinFetchAnnotation.setValue(org.eclipse.jpt.eclipselink.core.resource.java.JoinFetchType.INNER);
-
- assertEquals(org.eclipse.jpt.eclipselink.core.resource.java.JoinFetchType.INNER, joinFetchAnnotation.getValue());
- assertEquals(JoinFetchType.INNER, contextJoinFetch.getValue());
-
- // change resource to OUTER, test context
-
- joinFetchAnnotation.setValue(org.eclipse.jpt.eclipselink.core.resource.java.JoinFetchType.OUTER);
-
- assertEquals(org.eclipse.jpt.eclipselink.core.resource.java.JoinFetchType.OUTER, joinFetchAnnotation.getValue());
- assertEquals(JoinFetchType.OUTER, contextJoinFetch.getValue());
-
- // remove value from resource, test context
-
- joinFetchAnnotation.setValue(null);
-
- assertNull(joinFetchAnnotation.getValue());
- assertEquals(JoinFetchType.INNER, contextJoinFetch.getValue());
-
- // remove annotation, text context
-
- attributeResource.removeSupportingAnnotation(JoinFetchAnnotation.ANNOTATION_NAME);
-
- assertNull(joinFetchAnnotation.getValue());
- assertNull(contextJoinFetch.getValue());
- }
-
- public void testSetJoinFetchValue() throws Exception {
- createTestEntityWithJoinFetchManyToMany();
- addXmlClassRef(FULLY_QUALIFIED_TYPE_NAME);
-
- PersistentAttribute persistentAttribute = getJavaPersistentType().attributes().next();
- EclipseLinkRelationshipMapping manyToManyMapping = (EclipseLinkRelationshipMapping) persistentAttribute.getSpecifiedMapping();
- JoinFetch contextJoinFetch = manyToManyMapping.getJoinFetch();
- JavaResourcePersistentType typeResource = getJpaProject().getJavaResourcePersistentType(FULLY_QUALIFIED_TYPE_NAME);
- JavaResourcePersistentAttribute attributeResource = typeResource.persistableAttributes().next();
- JoinFetchAnnotation joinFetchAnnotation = (JoinFetchAnnotation) attributeResource.getSupportingAnnotation(JoinFetchAnnotation.ANNOTATION_NAME);
-
- // base annotated, test resource value
-
- assertNull(joinFetchAnnotation.getValue());
- assertEquals(JoinFetchType.INNER, contextJoinFetch.getValue());
-
- // change context to INNER specifically, test resource
-
- contextJoinFetch.setValue(JoinFetchType.INNER);
-
- assertNull(joinFetchAnnotation.getValue());
- assertEquals(JoinFetchType.INNER, contextJoinFetch.getValue());
-
- // change context to OUTER, test resource
-
- contextJoinFetch.setValue(JoinFetchType.OUTER);
-
- assertEquals(org.eclipse.jpt.eclipselink.core.resource.java.JoinFetchType.OUTER, joinFetchAnnotation.getValue());
- assertEquals(JoinFetchType.OUTER, contextJoinFetch.getValue());
-
- // set context to null, test resource
-
- contextJoinFetch.setValue(null);
-
- assertNull(attributeResource.getSupportingAnnotation(JoinFetchAnnotation.ANNOTATION_NAME));
- assertNull(contextJoinFetch.getValue());
-
- // change context to INNER specifically (this time from no annotation), test resource
-
- contextJoinFetch.setValue(JoinFetchType.INNER);
- joinFetchAnnotation = (JoinFetchAnnotation) attributeResource.getSupportingAnnotation(JoinFetchAnnotation.ANNOTATION_NAME);
-
- assertEquals(org.eclipse.jpt.eclipselink.core.resource.java.JoinFetchType.INNER, joinFetchAnnotation.getValue());
- assertEquals(JoinFetchType.INNER, contextJoinFetch.getValue());
- }
-}
diff --git a/jpa/tests/org.eclipse.jpt.eclipselink.core.tests/src/org/eclipse/jpt/eclipselink/core/tests/internal/context/java/EclipseLinkJavaManyToOneMappingTests.java b/jpa/tests/org.eclipse.jpt.eclipselink.core.tests/src/org/eclipse/jpt/eclipselink/core/tests/internal/context/java/EclipseLinkJavaManyToOneMappingTests.java
deleted file mode 100644
index e2d514940a..0000000000
--- a/jpa/tests/org.eclipse.jpt.eclipselink.core.tests/src/org/eclipse/jpt/eclipselink/core/tests/internal/context/java/EclipseLinkJavaManyToOneMappingTests.java
+++ /dev/null
@@ -1,144 +0,0 @@
-/*******************************************************************************
- * Copyright (c) 2007, 2009 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.
- *
- * Contributors:
- * Oracle - initial API and implementation
- ******************************************************************************/
-package org.eclipse.jpt.eclipselink.core.tests.internal.context.java;
-
-import java.util.Iterator;
-import org.eclipse.jdt.core.ICompilationUnit;
-import org.eclipse.jpt.core.context.PersistentAttribute;
-import org.eclipse.jpt.core.resource.java.JPA;
-import org.eclipse.jpt.core.resource.java.JavaResourcePersistentAttribute;
-import org.eclipse.jpt.core.resource.java.JavaResourcePersistentType;
-import org.eclipse.jpt.eclipselink.core.context.EclipseLinkRelationshipMapping;
-import org.eclipse.jpt.eclipselink.core.context.JoinFetch;
-import org.eclipse.jpt.eclipselink.core.context.JoinFetchType;
-import org.eclipse.jpt.eclipselink.core.resource.java.EclipseLinkJPA;
-import org.eclipse.jpt.eclipselink.core.resource.java.JoinFetchAnnotation;
-import org.eclipse.jpt.eclipselink.core.tests.internal.context.EclipseLinkContextModelTestCase;
-import org.eclipse.jpt.utility.internal.iterators.ArrayIterator;
-
-@SuppressWarnings("nls")
-public class EclipseLinkJavaManyToOneMappingTests extends EclipseLinkContextModelTestCase
-{
-
- private ICompilationUnit createTestEntityWithJoinFetchManyToOne() throws Exception {
- return this.createTestType(new DefaultAnnotationWriter() {
- @Override
- public Iterator<String> imports() {
- return new ArrayIterator<String>(JPA.ENTITY, JPA.MANY_TO_ONE, EclipseLinkJPA.JOIN_FETCH);
- }
- @Override
- public void appendTypeAnnotationTo(StringBuilder sb) {
- sb.append("@Entity").append(CR);
- }
-
- @Override
- public void appendIdFieldAnnotationTo(StringBuilder sb) {
- sb.append("@ManyToOne").append(CR);
- sb.append("@JoinFetch").append(CR);
- }
- });
- }
-
- public EclipseLinkJavaManyToOneMappingTests(String name) {
- super(name);
- }
-
-
- public void testGetJoinFetchValue() throws Exception {
- createTestEntityWithJoinFetchManyToOne();
- addXmlClassRef(FULLY_QUALIFIED_TYPE_NAME);
-
- PersistentAttribute persistentAttribute = getJavaPersistentType().attributes().next();
- EclipseLinkRelationshipMapping manyToManyMapping = (EclipseLinkRelationshipMapping) persistentAttribute.getSpecifiedMapping();
- JoinFetch contextJoinFetch = manyToManyMapping.getJoinFetch();
- JavaResourcePersistentType typeResource = getJpaProject().getJavaResourcePersistentType(FULLY_QUALIFIED_TYPE_NAME);
- JavaResourcePersistentAttribute attributeResource = typeResource.persistableAttributes().next();
- JoinFetchAnnotation joinFetchAnnotation = (JoinFetchAnnotation) attributeResource.getSupportingAnnotation(JoinFetchAnnotation.ANNOTATION_NAME);
-
- // base annotated, test context value
-
- assertNull(joinFetchAnnotation.getValue());
- assertEquals(JoinFetchType.INNER, contextJoinFetch.getValue());
-
- // change resource to INNER specifically, test context
-
- joinFetchAnnotation.setValue(org.eclipse.jpt.eclipselink.core.resource.java.JoinFetchType.INNER);
-
- assertEquals(org.eclipse.jpt.eclipselink.core.resource.java.JoinFetchType.INNER, joinFetchAnnotation.getValue());
- assertEquals(JoinFetchType.INNER, contextJoinFetch.getValue());
-
- // change resource to OUTER, test context
-
- joinFetchAnnotation.setValue(org.eclipse.jpt.eclipselink.core.resource.java.JoinFetchType.OUTER);
-
- assertEquals(org.eclipse.jpt.eclipselink.core.resource.java.JoinFetchType.OUTER, joinFetchAnnotation.getValue());
- assertEquals(JoinFetchType.OUTER, contextJoinFetch.getValue());
-
- // remove value from resource, test context
-
- joinFetchAnnotation.setValue(null);
-
- assertNull(joinFetchAnnotation.getValue());
- assertEquals(JoinFetchType.INNER, contextJoinFetch.getValue());
-
- // remove annotation, text context
-
- attributeResource.removeSupportingAnnotation(JoinFetchAnnotation.ANNOTATION_NAME);
-
- assertNull(joinFetchAnnotation.getValue());
- assertNull(contextJoinFetch.getValue());
- }
-
- public void testSetJoinFetchValue() throws Exception {
- createTestEntityWithJoinFetchManyToOne();
- addXmlClassRef(FULLY_QUALIFIED_TYPE_NAME);
-
- PersistentAttribute persistentAttribute = getJavaPersistentType().attributes().next();
- EclipseLinkRelationshipMapping manyToManyMapping = (EclipseLinkRelationshipMapping) persistentAttribute.getSpecifiedMapping();
- JoinFetch contextJoinFetch = manyToManyMapping.getJoinFetch();
- JavaResourcePersistentType typeResource = getJpaProject().getJavaResourcePersistentType(FULLY_QUALIFIED_TYPE_NAME);
- JavaResourcePersistentAttribute attributeResource = typeResource.persistableAttributes().next();
- JoinFetchAnnotation joinFetchAnnotation = (JoinFetchAnnotation) attributeResource.getSupportingAnnotation(JoinFetchAnnotation.ANNOTATION_NAME);
-
- // base annotated, test resource value
-
- assertNull(joinFetchAnnotation.getValue());
- assertEquals(JoinFetchType.INNER, contextJoinFetch.getValue());
-
- // change context to INNER specifically, test resource
-
- contextJoinFetch.setValue(JoinFetchType.INNER);
-
- assertNull(joinFetchAnnotation.getValue());
- assertEquals(JoinFetchType.INNER, contextJoinFetch.getValue());
-
- // change context to OUTER, test resource
-
- contextJoinFetch.setValue(JoinFetchType.OUTER);
-
- assertEquals(org.eclipse.jpt.eclipselink.core.resource.java.JoinFetchType.OUTER, joinFetchAnnotation.getValue());
- assertEquals(JoinFetchType.OUTER, contextJoinFetch.getValue());
-
- // set context to null, test resource
-
- contextJoinFetch.setValue(null);
-
- assertNull(attributeResource.getSupportingAnnotation(JoinFetchAnnotation.ANNOTATION_NAME));
- assertNull(contextJoinFetch.getValue());
-
- // change context to INNER specifically (this time from no annotation), test resource
-
- contextJoinFetch.setValue(JoinFetchType.INNER);
- joinFetchAnnotation = (JoinFetchAnnotation) attributeResource.getSupportingAnnotation(JoinFetchAnnotation.ANNOTATION_NAME);
-
- assertEquals(org.eclipse.jpt.eclipselink.core.resource.java.JoinFetchType.INNER, joinFetchAnnotation.getValue());
- assertEquals(JoinFetchType.INNER, contextJoinFetch.getValue());
- }
-}
diff --git a/jpa/tests/org.eclipse.jpt.eclipselink.core.tests/src/org/eclipse/jpt/eclipselink/core/tests/internal/context/java/EclipseLinkJavaMappedSuperclassTests.java b/jpa/tests/org.eclipse.jpt.eclipselink.core.tests/src/org/eclipse/jpt/eclipselink/core/tests/internal/context/java/EclipseLinkJavaMappedSuperclassTests.java
deleted file mode 100644
index 1c56294944..0000000000
--- a/jpa/tests/org.eclipse.jpt.eclipselink.core.tests/src/org/eclipse/jpt/eclipselink/core/tests/internal/context/java/EclipseLinkJavaMappedSuperclassTests.java
+++ /dev/null
@@ -1,336 +0,0 @@
-/*******************************************************************************
- * Copyright (c) 2008, 2009 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.
- *
- * Contributors:
- * Oracle - initial API and implementation
- ******************************************************************************/
-package org.eclipse.jpt.eclipselink.core.tests.internal.context.java;
-
-import java.util.Iterator;
-import org.eclipse.jdt.core.ICompilationUnit;
-import org.eclipse.jpt.core.resource.java.JPA;
-import org.eclipse.jpt.core.resource.java.JavaResourcePersistentType;
-import org.eclipse.jpt.eclipselink.core.context.ChangeTracking;
-import org.eclipse.jpt.eclipselink.core.context.ChangeTrackingType;
-import org.eclipse.jpt.eclipselink.core.context.Customizer;
-import org.eclipse.jpt.eclipselink.core.context.EclipseLinkMappedSuperclass;
-import org.eclipse.jpt.eclipselink.core.context.ReadOnly;
-import org.eclipse.jpt.eclipselink.core.resource.java.ChangeTrackingAnnotation;
-import org.eclipse.jpt.eclipselink.core.resource.java.CustomizerAnnotation;
-import org.eclipse.jpt.eclipselink.core.resource.java.EclipseLinkJPA;
-import org.eclipse.jpt.eclipselink.core.resource.java.ReadOnlyAnnotation;
-import org.eclipse.jpt.eclipselink.core.tests.internal.context.EclipseLinkContextModelTestCase;
-import org.eclipse.jpt.utility.internal.iterators.ArrayIterator;
-
-@SuppressWarnings("nls")
-public class EclipseLinkJavaMappedSuperclassTests extends EclipseLinkContextModelTestCase
-{
-
- private ICompilationUnit createTestMappedSuperclassWithReadOnly() throws Exception {
- return this.createTestType(new DefaultAnnotationWriter() {
- @Override
- public Iterator<String> imports() {
- return new ArrayIterator<String>(JPA.MAPPED_SUPERCLASS, EclipseLinkJPA.READ_ONLY);
- }
- @Override
- public void appendTypeAnnotationTo(StringBuilder sb) {
- sb.append("@MappedSuperclass").append(CR);
- sb.append("@ReadOnly").append(CR);
- }
- });
- }
-
- private ICompilationUnit createTestMappedSuperclassWithConvertAndCustomizerClass() throws Exception {
- return this.createTestType(new DefaultAnnotationWriter() {
- @Override
- public Iterator<String> imports() {
- return new ArrayIterator<String>(JPA.MAPPED_SUPERCLASS, EclipseLinkJPA.CUSTOMIZER);
- }
- @Override
- public void appendTypeAnnotationTo(StringBuilder sb) {
- sb.append("@MappedSuperclass").append(CR);
- sb.append(" @Customizer(Foo.class");
- }
- });
- }
-
- private ICompilationUnit createTestMappedSuperclassWithChangeTracking() throws Exception {
- return this.createTestType(new DefaultAnnotationWriter() {
- @Override
- public Iterator<String> imports() {
- return new ArrayIterator<String>(JPA.MAPPED_SUPERCLASS, EclipseLinkJPA.CHANGE_TRACKING);
- }
- @Override
- public void appendTypeAnnotationTo(StringBuilder sb) {
- sb.append("@MappedSuperclass").append(CR);
- sb.append(" @ChangeTracking").append(CR);
- }
- });
- }
-
- public EclipseLinkJavaMappedSuperclassTests(String name) {
- super(name);
- }
-
-
- public void testGetReadOnly() throws Exception {
- createTestMappedSuperclassWithReadOnly();
- addXmlClassRef(FULLY_QUALIFIED_TYPE_NAME);
-
- EclipseLinkMappedSuperclass mappedSuperclass = (EclipseLinkMappedSuperclass) getJavaPersistentType().getMapping();
- ReadOnly readOnly = mappedSuperclass.getReadOnly();
- assertEquals(true, readOnly.isReadOnly());
- }
-
- public void testGetSpecifiedReadOnly() throws Exception {
- createTestMappedSuperclassWithReadOnly();
- addXmlClassRef(FULLY_QUALIFIED_TYPE_NAME);
-
- EclipseLinkMappedSuperclass mappedSuperclass = (EclipseLinkMappedSuperclass) getJavaPersistentType().getMapping();
- ReadOnly readOnly = mappedSuperclass.getReadOnly();
- assertEquals(Boolean.TRUE, readOnly.getSpecifiedReadOnly());
- }
-
- //TODO test inheriting a default readonly from you superclass
- public void testGetDefaultReadOnly() throws Exception {
- createTestMappedSuperclassWithReadOnly();
- addXmlClassRef(FULLY_QUALIFIED_TYPE_NAME);
-
- EclipseLinkMappedSuperclass mappedSuperclass = (EclipseLinkMappedSuperclass) getJavaPersistentType().getMapping();
- ReadOnly readOnly = mappedSuperclass.getReadOnly();
- assertEquals(false, readOnly.isDefaultReadOnly());
- }
-
- public void testSetSpecifiedReadOnly() throws Exception {
- createTestMappedSuperclassWithReadOnly();
- addXmlClassRef(FULLY_QUALIFIED_TYPE_NAME);
-
- EclipseLinkMappedSuperclass mappedSuperclass = (EclipseLinkMappedSuperclass) getJavaPersistentType().getMapping();
- ReadOnly readOnly = mappedSuperclass.getReadOnly();
- assertEquals(true, readOnly.isReadOnly());
-
- readOnly.setSpecifiedReadOnly(Boolean.FALSE);
-
- JavaResourcePersistentType typeResource = getJpaProject().getJavaResourcePersistentType(FULLY_QUALIFIED_TYPE_NAME);
- assertNull(typeResource.getSupportingAnnotation(ReadOnlyAnnotation.ANNOTATION_NAME));
- assertEquals(null, readOnly.getSpecifiedReadOnly());//Boolean.FALSE and null really mean the same thing since there are only 2 states in the java resource model
-
- readOnly.setSpecifiedReadOnly(Boolean.TRUE);
- assertNotNull(typeResource.getSupportingAnnotation(ReadOnlyAnnotation.ANNOTATION_NAME));
- assertEquals(Boolean.TRUE, readOnly.getSpecifiedReadOnly());
-
- readOnly.setSpecifiedReadOnly(null);
- assertNull(typeResource.getSupportingAnnotation(ReadOnlyAnnotation.ANNOTATION_NAME));
- assertEquals(null, readOnly.getSpecifiedReadOnly());//Boolean.FALSE and null really mean the same thing since there are only 2 states in the java resource model
- }
-
- public void testSpecifiedReadOnlyUpdatesFromResourceModelChange() throws Exception {
- createTestMappedSuperclassWithReadOnly();
- addXmlClassRef(FULLY_QUALIFIED_TYPE_NAME);
-
- EclipseLinkMappedSuperclass mappedSuperclass = (EclipseLinkMappedSuperclass) getJavaPersistentType().getMapping();
- ReadOnly readOnly = mappedSuperclass.getReadOnly();
- assertEquals(Boolean.TRUE, readOnly.getSpecifiedReadOnly());
-
-
- JavaResourcePersistentType typeResource = getJpaProject().getJavaResourcePersistentType(FULLY_QUALIFIED_TYPE_NAME);
- typeResource.removeSupportingAnnotation(ReadOnlyAnnotation.ANNOTATION_NAME);
-
- assertEquals(null, readOnly.getSpecifiedReadOnly());
- assertEquals(false, readOnly.isDefaultReadOnly());
-
- typeResource.addSupportingAnnotation(ReadOnlyAnnotation.ANNOTATION_NAME);
- assertEquals(Boolean.TRUE, readOnly.getSpecifiedReadOnly());
- }
-
- public void testGetCustomizerClass() throws Exception {
- createTestMappedSuperclassWithConvertAndCustomizerClass();
- addXmlClassRef(FULLY_QUALIFIED_TYPE_NAME);
-
- Customizer customizer = ((EclipseLinkMappedSuperclass) getJavaPersistentType().getMapping()).getCustomizer();
-
- assertEquals("Foo", customizer.getSpecifiedCustomizerClass());
- }
-
- public void testSetCustomizerClass() throws Exception {
- createTestMappedSuperclassWithConvertAndCustomizerClass();
- addXmlClassRef(FULLY_QUALIFIED_TYPE_NAME);
-
- Customizer customizer = ((EclipseLinkMappedSuperclass) getJavaPersistentType().getMapping()).getCustomizer();
- assertEquals("Foo", customizer.getSpecifiedCustomizerClass());
-
- customizer.setSpecifiedCustomizerClass("Bar");
- assertEquals("Bar", customizer.getSpecifiedCustomizerClass());
-
- JavaResourcePersistentType typeResource = getJpaProject().getJavaResourcePersistentType(FULLY_QUALIFIED_TYPE_NAME);
- CustomizerAnnotation customizerAnnotation = (CustomizerAnnotation) typeResource.getSupportingAnnotation(CustomizerAnnotation.ANNOTATION_NAME);
- assertEquals("Bar", customizerAnnotation.getValue());
-
-
- customizer.setSpecifiedCustomizerClass(null);
- assertEquals(null, customizer.getSpecifiedCustomizerClass());
- customizerAnnotation = (CustomizerAnnotation) typeResource.getSupportingAnnotation(CustomizerAnnotation.ANNOTATION_NAME);
- assertEquals(null, customizerAnnotation);
-
-
- customizer.setSpecifiedCustomizerClass("Bar");
- assertEquals("Bar", customizer.getSpecifiedCustomizerClass());
- customizerAnnotation = (CustomizerAnnotation) typeResource.getSupportingAnnotation(CustomizerAnnotation.ANNOTATION_NAME);
- assertEquals("Bar", customizerAnnotation.getValue());
- }
-
- public void testGetCustomizerClassUpdatesFromResourceModelChange() throws Exception {
- createTestMappedSuperclassWithConvertAndCustomizerClass();
- addXmlClassRef(FULLY_QUALIFIED_TYPE_NAME);
- EclipseLinkMappedSuperclass mappedSuperclass = (EclipseLinkMappedSuperclass) getJavaPersistentType().getMapping();
- Customizer customizer = mappedSuperclass.getCustomizer();
-
- assertEquals("Foo", customizer.getSpecifiedCustomizerClass());
-
- JavaResourcePersistentType typeResource = getJpaProject().getJavaResourcePersistentType(FULLY_QUALIFIED_TYPE_NAME);
- CustomizerAnnotation customizerAnnotation = (CustomizerAnnotation) typeResource.getSupportingAnnotation(CustomizerAnnotation.ANNOTATION_NAME);
- customizerAnnotation.setValue("Bar");
- assertEquals("Bar", customizer.getSpecifiedCustomizerClass());
-
- typeResource.removeSupportingAnnotation(CustomizerAnnotation.ANNOTATION_NAME);
- assertEquals(null, customizer.getSpecifiedCustomizerClass());
-
- customizerAnnotation = (CustomizerAnnotation) typeResource.addSupportingAnnotation(CustomizerAnnotation.ANNOTATION_NAME);
- assertEquals(null, customizer.getSpecifiedCustomizerClass());
-
- customizerAnnotation.setValue("FooBar");
- assertEquals("FooBar", customizer.getSpecifiedCustomizerClass());
- }
-
- public void testGetChangeTracking() throws Exception {
- createTestMappedSuperclassWithChangeTracking();
- addXmlClassRef(FULLY_QUALIFIED_TYPE_NAME);
-
- EclipseLinkMappedSuperclass mappedSuperclass = (EclipseLinkMappedSuperclass) getJavaPersistentType().getMapping();
- ChangeTracking contextChangeTracking = mappedSuperclass.getChangeTracking();
- JavaResourcePersistentType typeResource = getJpaProject().getJavaResourcePersistentType(FULLY_QUALIFIED_TYPE_NAME);
- ChangeTrackingAnnotation resourceChangeTracking = (ChangeTrackingAnnotation) typeResource.getSupportingAnnotation(ChangeTrackingAnnotation.ANNOTATION_NAME);
-
- // base annotated, test context value
-
- assertNull(resourceChangeTracking.getValue());
- assertEquals(ChangeTrackingType.AUTO, contextChangeTracking.getType());
- assertEquals(ChangeTrackingType.AUTO, contextChangeTracking.getDefaultType());
- assertEquals(ChangeTrackingType.AUTO, contextChangeTracking.getSpecifiedType());
-
- // change resource to ATTRIBUTE specifically, test context
-
- resourceChangeTracking.setValue(org.eclipse.jpt.eclipselink.core.resource.java.ChangeTrackingType.ATTRIBUTE);
-
- assertEquals(org.eclipse.jpt.eclipselink.core.resource.java.ChangeTrackingType.ATTRIBUTE, resourceChangeTracking.getValue());
- assertEquals(ChangeTrackingType.ATTRIBUTE, contextChangeTracking.getType());
- assertEquals(ChangeTrackingType.AUTO, contextChangeTracking.getDefaultType());
- assertEquals(ChangeTrackingType.ATTRIBUTE, contextChangeTracking.getSpecifiedType());
-
- // change resource to OBJECT specifically, test context
-
- resourceChangeTracking.setValue(org.eclipse.jpt.eclipselink.core.resource.java.ChangeTrackingType.OBJECT);
-
- assertEquals(org.eclipse.jpt.eclipselink.core.resource.java.ChangeTrackingType.OBJECT, resourceChangeTracking.getValue());
- assertEquals(ChangeTrackingType.OBJECT, contextChangeTracking.getType());
- assertEquals(ChangeTrackingType.AUTO, contextChangeTracking.getDefaultType());
- assertEquals(ChangeTrackingType.OBJECT, contextChangeTracking.getSpecifiedType());
-
- // change resource to DEFERRED specifically, test context
-
- resourceChangeTracking.setValue(org.eclipse.jpt.eclipselink.core.resource.java.ChangeTrackingType.DEFERRED);
-
- assertEquals(org.eclipse.jpt.eclipselink.core.resource.java.ChangeTrackingType.DEFERRED, resourceChangeTracking.getValue());
- assertEquals(ChangeTrackingType.DEFERRED, contextChangeTracking.getType());
- assertEquals(ChangeTrackingType.AUTO, contextChangeTracking.getDefaultType());
- assertEquals(ChangeTrackingType.DEFERRED, contextChangeTracking.getSpecifiedType());
-
- // change resource to AUTO specifically, test context
-
- resourceChangeTracking.setValue(org.eclipse.jpt.eclipselink.core.resource.java.ChangeTrackingType.AUTO);
-
- assertEquals(org.eclipse.jpt.eclipselink.core.resource.java.ChangeTrackingType.AUTO, resourceChangeTracking.getValue());
- assertEquals(ChangeTrackingType.AUTO, contextChangeTracking.getType());
- assertEquals(ChangeTrackingType.AUTO, contextChangeTracking.getDefaultType());
- assertEquals(ChangeTrackingType.AUTO, contextChangeTracking.getSpecifiedType());
-
- // remove value from resource, test context
-
- resourceChangeTracking.setValue(null);
-
- assertNull(resourceChangeTracking.getValue());
- assertEquals(ChangeTrackingType.AUTO, contextChangeTracking.getType());
- assertEquals(ChangeTrackingType.AUTO, contextChangeTracking.getDefaultType());
- assertEquals(ChangeTrackingType.AUTO, contextChangeTracking.getSpecifiedType());
-
- // remove annotation, text context
-
- typeResource.removeSupportingAnnotation(ChangeTrackingAnnotation.ANNOTATION_NAME);
-
- assertNull(resourceChangeTracking.getValue());
- assertEquals(ChangeTrackingType.AUTO, contextChangeTracking.getType());
- assertEquals(ChangeTrackingType.AUTO, contextChangeTracking.getDefaultType());
- assertNull(contextChangeTracking.getSpecifiedType());
- }
-
- public void testSetChangeTracking() throws Exception {
- createTestMappedSuperclassWithChangeTracking();
- addXmlClassRef(FULLY_QUALIFIED_TYPE_NAME);
-
- EclipseLinkMappedSuperclass mappedSuperclass = (EclipseLinkMappedSuperclass) getJavaPersistentType().getMapping();
- ChangeTracking contextChangeTracking = mappedSuperclass.getChangeTracking();
- JavaResourcePersistentType typeResource = getJpaProject().getJavaResourcePersistentType(FULLY_QUALIFIED_TYPE_NAME);
- ChangeTrackingAnnotation resourceChangeTracking = (ChangeTrackingAnnotation) typeResource.getSupportingAnnotation(ChangeTrackingAnnotation.ANNOTATION_NAME);
-
- // base annotated, test resource value
-
- assertNull(resourceChangeTracking.getValue());
- assertEquals(ChangeTrackingType.AUTO, contextChangeTracking.getSpecifiedType());
-
- // change context to AUTO specifically, test resource
-
- contextChangeTracking.setSpecifiedType(ChangeTrackingType.AUTO);
-
- assertNull(resourceChangeTracking.getValue());
- assertEquals(ChangeTrackingType.AUTO, contextChangeTracking.getSpecifiedType());
-
- // change context to ATTRIBUTE specifically, test resource
-
- contextChangeTracking.setSpecifiedType(ChangeTrackingType.ATTRIBUTE);
-
- assertEquals(org.eclipse.jpt.eclipselink.core.resource.java.ChangeTrackingType.ATTRIBUTE, resourceChangeTracking.getValue());
- assertEquals(ChangeTrackingType.ATTRIBUTE, contextChangeTracking.getSpecifiedType());
-
- // change context to OBJECT specifically, test resource
-
- contextChangeTracking.setSpecifiedType(ChangeTrackingType.OBJECT);
-
- assertEquals(org.eclipse.jpt.eclipselink.core.resource.java.ChangeTrackingType.OBJECT, resourceChangeTracking.getValue());
- assertEquals(ChangeTrackingType.OBJECT, contextChangeTracking.getSpecifiedType());
-
- // change context to DEFERRED specifically, test resource
-
- contextChangeTracking.setSpecifiedType(ChangeTrackingType.DEFERRED);
-
- assertEquals(org.eclipse.jpt.eclipselink.core.resource.java.ChangeTrackingType.DEFERRED, resourceChangeTracking.getValue());
- assertEquals(ChangeTrackingType.DEFERRED, contextChangeTracking.getSpecifiedType());
-
- // change context to null, test resource
-
- contextChangeTracking.setSpecifiedType(null);
-
- assertNull(typeResource.getSupportingAnnotation(ChangeTrackingAnnotation.ANNOTATION_NAME));
- assertNull(contextChangeTracking.getSpecifiedType());
-
- // change context to AUTO specifically (this time from no annotation), test resource
-
- contextChangeTracking.setSpecifiedType(ChangeTrackingType.AUTO);
- resourceChangeTracking = (ChangeTrackingAnnotation) typeResource.getSupportingAnnotation(ChangeTrackingAnnotation.ANNOTATION_NAME);
-
- assertEquals(org.eclipse.jpt.eclipselink.core.resource.java.ChangeTrackingType.AUTO, resourceChangeTracking.getValue());
- assertEquals(ChangeTrackingType.AUTO, contextChangeTracking.getSpecifiedType());
- }
-}
diff --git a/jpa/tests/org.eclipse.jpt.eclipselink.core.tests/src/org/eclipse/jpt/eclipselink/core/tests/internal/context/java/EclipseLinkJavaObjectTypeConverterTests.java b/jpa/tests/org.eclipse.jpt.eclipselink.core.tests/src/org/eclipse/jpt/eclipselink/core/tests/internal/context/java/EclipseLinkJavaObjectTypeConverterTests.java
deleted file mode 100644
index ce132dc859..0000000000
--- a/jpa/tests/org.eclipse.jpt.eclipselink.core.tests/src/org/eclipse/jpt/eclipselink/core/tests/internal/context/java/EclipseLinkJavaObjectTypeConverterTests.java
+++ /dev/null
@@ -1,621 +0,0 @@
-/*******************************************************************************
- * Copyright (c) 2007, 2009 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.
- *
- * Contributors:
- * Oracle - initial API and implementation
- ******************************************************************************/
-package org.eclipse.jpt.eclipselink.core.tests.internal.context.java;
-
-import java.util.Iterator;
-import java.util.ListIterator;
-import org.eclipse.jdt.core.ICompilationUnit;
-import org.eclipse.jpt.core.context.BasicMapping;
-import org.eclipse.jpt.core.context.PersistentAttribute;
-import org.eclipse.jpt.core.resource.java.JPA;
-import org.eclipse.jpt.core.resource.java.JavaResourcePersistentAttribute;
-import org.eclipse.jpt.core.resource.java.JavaResourcePersistentType;
-import org.eclipse.jpt.eclipselink.core.context.ConversionValue;
-import org.eclipse.jpt.eclipselink.core.context.Convert;
-import org.eclipse.jpt.eclipselink.core.context.ObjectTypeConverter;
-import org.eclipse.jpt.eclipselink.core.resource.java.ConversionValueAnnotation;
-import org.eclipse.jpt.eclipselink.core.resource.java.EclipseLinkJPA;
-import org.eclipse.jpt.eclipselink.core.resource.java.ObjectTypeConverterAnnotation;
-import org.eclipse.jpt.eclipselink.core.tests.internal.context.EclipseLinkContextModelTestCase;
-import org.eclipse.jpt.utility.internal.CollectionTools;
-import org.eclipse.jpt.utility.internal.iterators.ArrayIterator;
-
-@SuppressWarnings("nls")
-public class EclipseLinkJavaObjectTypeConverterTests extends EclipseLinkContextModelTestCase
-{
-
- private ICompilationUnit createTestEntityWithConvertAndObjectTypeConverter() throws Exception {
- return this.createTestType(new DefaultAnnotationWriter() {
- @Override
- public Iterator<String> imports() {
- return new ArrayIterator<String>(JPA.ENTITY, EclipseLinkJPA.CONVERT, EclipseLinkJPA.OBJECT_TYPE_CONVERTER, EclipseLinkJPA.CONVERSION_VALUE);
- }
- @Override
- public void appendTypeAnnotationTo(StringBuilder sb) {
- sb.append("@Entity");
- }
-
- @Override
- public void appendIdFieldAnnotationTo(StringBuilder sb) {
- sb.append("@Convert(\"foo\")").append(CR);
- sb.append(" @ObjectTypeConverter(name=\"foo\", defaultObjectValue=\"bar\")");
- }
- });
- }
-
- private ICompilationUnit createTestEntityWithConvertAndDataType() throws Exception {
- return this.createTestType(new DefaultAnnotationWriter() {
- @Override
- public Iterator<String> imports() {
- return new ArrayIterator<String>(JPA.ENTITY, EclipseLinkJPA.CONVERT, EclipseLinkJPA.OBJECT_TYPE_CONVERTER);
- }
- @Override
- public void appendTypeAnnotationTo(StringBuilder sb) {
- sb.append("@Entity");
- }
-
- @Override
- public void appendIdFieldAnnotationTo(StringBuilder sb) {
- sb.append("@Convert(\"foo\")").append(CR);
- sb.append(" @ObjectTypeConverter(dataType=Foo.class)");
- }
- });
- }
-
- private ICompilationUnit createTestEntityWithConvertAndObjectType() throws Exception {
- return this.createTestType(new DefaultAnnotationWriter() {
- @Override
- public Iterator<String> imports() {
- return new ArrayIterator<String>(JPA.ENTITY, EclipseLinkJPA.CONVERT, EclipseLinkJPA.OBJECT_TYPE_CONVERTER);
- }
- @Override
- public void appendTypeAnnotationTo(StringBuilder sb) {
- sb.append("@Entity");
- }
-
- @Override
- public void appendIdFieldAnnotationTo(StringBuilder sb) {
- sb.append("@Convert(\"foo\")").append(CR);
- sb.append(" @ObjectTypeConverter(objectType=Foo.class)");
- }
- });
- }
-
- private ICompilationUnit createTestEntityWithConvertAndObjectTypeConverterConversionValue() throws Exception {
- return this.createTestType(new DefaultAnnotationWriter() {
- @Override
- public Iterator<String> imports() {
- return new ArrayIterator<String>(JPA.ENTITY, EclipseLinkJPA.CONVERT, EclipseLinkJPA.OBJECT_TYPE_CONVERTER, EclipseLinkJPA.CONVERSION_VALUE);
- }
- @Override
- public void appendTypeAnnotationTo(StringBuilder sb) {
- sb.append("@Entity");
- }
-
- @Override
- public void appendIdFieldAnnotationTo(StringBuilder sb) {
- sb.append("@Convert(\"foo\")").append(CR);
- sb.append(" @ObjectTypeConverter(name=\"foo\", defaultObjectValue=\"bar\", conversionValues = @ConversionValue(dataValue=\"f\", objectValue=\"female\"))");
- }
- });
- }
-
- public EclipseLinkJavaObjectTypeConverterTests(String name) {
- super(name);
- }
-
-
- public void testGetName() throws Exception {
- createTestEntityWithConvertAndObjectTypeConverter();
- addXmlClassRef(FULLY_QUALIFIED_TYPE_NAME);
-
- PersistentAttribute persistentAttribute = getJavaPersistentType().attributes().next();
- BasicMapping basicMapping = (BasicMapping) persistentAttribute.getMapping();
- Convert eclipseLinkConvert = (Convert) basicMapping.getConverter();
- ObjectTypeConverter converter = (ObjectTypeConverter) eclipseLinkConvert.getConverter();
-
- assertEquals("foo", converter.getName());
- }
-
- public void testSetName() throws Exception {
- createTestEntityWithConvertAndObjectTypeConverter();
- addXmlClassRef(FULLY_QUALIFIED_TYPE_NAME);
-
- PersistentAttribute persistentAttribute = getJavaPersistentType().attributes().next();
- BasicMapping basicMapping = (BasicMapping) persistentAttribute.getMapping();
- Convert eclipseLinkConvert = (Convert) basicMapping.getConverter();
- ObjectTypeConverter converter = (ObjectTypeConverter) eclipseLinkConvert.getConverter();
- assertEquals("foo", converter.getName());
-
- converter.setName("bar");
- assertEquals("bar", converter.getName());
-
- JavaResourcePersistentType typeResource = getJpaProject().getJavaResourcePersistentType(FULLY_QUALIFIED_TYPE_NAME);
- JavaResourcePersistentAttribute attributeResource = typeResource.persistableAttributes().next();
- ObjectTypeConverterAnnotation converterAnnotation = (ObjectTypeConverterAnnotation) attributeResource.getSupportingAnnotation(ObjectTypeConverterAnnotation.ANNOTATION_NAME);
- assertEquals("bar", converterAnnotation.getName());
-
-
- converter.setName(null);
- assertEquals(null, converter.getName());
- converterAnnotation = (ObjectTypeConverterAnnotation) attributeResource.getSupportingAnnotation(ObjectTypeConverterAnnotation.ANNOTATION_NAME);
- assertEquals(null, converterAnnotation.getName());
-
-
- converter.setName("bar");
- assertEquals("bar", converter.getName());
- converterAnnotation = (ObjectTypeConverterAnnotation) attributeResource.getSupportingAnnotation(ObjectTypeConverterAnnotation.ANNOTATION_NAME);
- assertEquals("bar", converterAnnotation.getName());
- }
-
- public void testGetNameUpdatesFromResourceModelChange() throws Exception {
- createTestEntityWithConvertAndObjectTypeConverter();
- addXmlClassRef(FULLY_QUALIFIED_TYPE_NAME);
-
- PersistentAttribute persistentAttribute = getJavaPersistentType().attributes().next();
- BasicMapping basicMapping = (BasicMapping) persistentAttribute.getMapping();
- Convert eclipseLinkConvert = (Convert) basicMapping.getConverter();
- ObjectTypeConverter converter = (ObjectTypeConverter) eclipseLinkConvert.getConverter();
-
- assertEquals("foo", converter.getName());
-
- JavaResourcePersistentType typeResource = getJpaProject().getJavaResourcePersistentType(FULLY_QUALIFIED_TYPE_NAME);
- JavaResourcePersistentAttribute attributeResource = typeResource.persistableAttributes().next();
- ObjectTypeConverterAnnotation converterAnnotation = (ObjectTypeConverterAnnotation) attributeResource.getSupportingAnnotation(ObjectTypeConverterAnnotation.ANNOTATION_NAME);
- converterAnnotation.setName("bar");
- assertEquals("bar", converter.getName());
-
- attributeResource.removeSupportingAnnotation(ObjectTypeConverterAnnotation.ANNOTATION_NAME);
- assertEquals(null, eclipseLinkConvert.getConverter());
-
- converterAnnotation = (ObjectTypeConverterAnnotation) attributeResource.addSupportingAnnotation(ObjectTypeConverterAnnotation.ANNOTATION_NAME);
- assertNotNull(eclipseLinkConvert.getConverter());
-
- converterAnnotation.setName("FOO");
- assertEquals("FOO", eclipseLinkConvert.getConverter().getName());
- }
-
- public void testGetDataType() throws Exception {
- createTestEntityWithConvertAndDataType();
- addXmlClassRef(FULLY_QUALIFIED_TYPE_NAME);
-
- PersistentAttribute persistentAttribute = getJavaPersistentType().attributes().next();
- BasicMapping basicMapping = (BasicMapping) persistentAttribute.getMapping();
- Convert eclipseLinkConvert = (Convert) basicMapping.getConverter();
- ObjectTypeConverter converter = (ObjectTypeConverter) eclipseLinkConvert.getConverter();
-
- assertEquals("Foo", converter.getDataType());
- }
-
- public void testSetDataType() throws Exception {
- createTestEntityWithConvertAndDataType();
- addXmlClassRef(FULLY_QUALIFIED_TYPE_NAME);
-
- PersistentAttribute persistentAttribute = getJavaPersistentType().attributes().next();
- BasicMapping basicMapping = (BasicMapping) persistentAttribute.getMapping();
- Convert eclipseLinkConvert = (Convert) basicMapping.getConverter();
- ObjectTypeConverter converter = (ObjectTypeConverter) eclipseLinkConvert.getConverter();
- assertEquals("Foo", converter.getDataType());
-
- converter.setDataType("Bar");
- assertEquals("Bar", converter.getDataType());
-
- JavaResourcePersistentType typeResource = getJpaProject().getJavaResourcePersistentType(FULLY_QUALIFIED_TYPE_NAME);
- JavaResourcePersistentAttribute attributeResource = typeResource.persistableAttributes().next();
- ObjectTypeConverterAnnotation converterAnnotation = (ObjectTypeConverterAnnotation) attributeResource.getSupportingAnnotation(ObjectTypeConverterAnnotation.ANNOTATION_NAME);
- assertEquals("Bar", converterAnnotation.getDataType());
-
-
- converter.setDataType(null);
- assertEquals(null, converter.getDataType());
- converterAnnotation = (ObjectTypeConverterAnnotation) attributeResource.getSupportingAnnotation(ObjectTypeConverterAnnotation.ANNOTATION_NAME);
- assertEquals(null, converterAnnotation.getDataType());
-
-
- converter.setDataType("Bar");
- assertEquals("Bar", converter.getDataType());
- converterAnnotation = (ObjectTypeConverterAnnotation) attributeResource.getSupportingAnnotation(ObjectTypeConverterAnnotation.ANNOTATION_NAME);
- assertEquals("Bar", converterAnnotation.getDataType());
- }
-
- public void testGetDataTypeUpdatesFromResourceModelChange() throws Exception {
- createTestEntityWithConvertAndDataType();
- addXmlClassRef(FULLY_QUALIFIED_TYPE_NAME);
-
- PersistentAttribute persistentAttribute = getJavaPersistentType().attributes().next();
- BasicMapping basicMapping = (BasicMapping) persistentAttribute.getMapping();
- Convert eclipseLinkConvert = (Convert) basicMapping.getConverter();
- ObjectTypeConverter converter = (ObjectTypeConverter) eclipseLinkConvert.getConverter();
-
- assertEquals("Foo", converter.getDataType());
-
- JavaResourcePersistentType typeResource = getJpaProject().getJavaResourcePersistentType(FULLY_QUALIFIED_TYPE_NAME);
- JavaResourcePersistentAttribute attributeResource = typeResource.persistableAttributes().next();
- ObjectTypeConverterAnnotation converterAnnotation = (ObjectTypeConverterAnnotation) attributeResource.getSupportingAnnotation(ObjectTypeConverterAnnotation.ANNOTATION_NAME);
- converterAnnotation.setDataType("Bar");
- assertEquals("Bar", converter.getDataType());
-
- attributeResource.removeSupportingAnnotation(ObjectTypeConverterAnnotation.ANNOTATION_NAME);
- assertEquals(null, eclipseLinkConvert.getConverter());
-
- converterAnnotation = (ObjectTypeConverterAnnotation) attributeResource.addSupportingAnnotation(ObjectTypeConverterAnnotation.ANNOTATION_NAME);
- assertNotNull(eclipseLinkConvert.getConverter());
-
- converterAnnotation.setDataType("FooBar");
- assertEquals("FooBar", ((ObjectTypeConverter) eclipseLinkConvert.getConverter()).getDataType());
- }
-
- public void testGetObjectType() throws Exception {
- createTestEntityWithConvertAndObjectType();
- addXmlClassRef(FULLY_QUALIFIED_TYPE_NAME);
-
- PersistentAttribute persistentAttribute = getJavaPersistentType().attributes().next();
- BasicMapping basicMapping = (BasicMapping) persistentAttribute.getMapping();
- Convert eclipseLinkConvert = (Convert) basicMapping.getConverter();
- ObjectTypeConverter converter = (ObjectTypeConverter) eclipseLinkConvert.getConverter();
-
- assertEquals("Foo", converter.getObjectType());
- }
-
- public void testSetObjectType() throws Exception {
- createTestEntityWithConvertAndObjectType();
- addXmlClassRef(FULLY_QUALIFIED_TYPE_NAME);
-
- PersistentAttribute persistentAttribute = getJavaPersistentType().attributes().next();
- BasicMapping basicMapping = (BasicMapping) persistentAttribute.getMapping();
- Convert eclipseLinkConvert = (Convert) basicMapping.getConverter();
- ObjectTypeConverter converter = (ObjectTypeConverter) eclipseLinkConvert.getConverter();
- assertEquals("Foo", converter.getObjectType());
-
- converter.setObjectType("Bar");
- assertEquals("Bar", converter.getObjectType());
-
- JavaResourcePersistentType typeResource = getJpaProject().getJavaResourcePersistentType(FULLY_QUALIFIED_TYPE_NAME);
- JavaResourcePersistentAttribute attributeResource = typeResource.persistableAttributes().next();
- ObjectTypeConverterAnnotation converterAnnotation = (ObjectTypeConverterAnnotation) attributeResource.getSupportingAnnotation(ObjectTypeConverterAnnotation.ANNOTATION_NAME);
- assertEquals("Bar", converterAnnotation.getObjectType());
-
-
- converter.setObjectType(null);
- assertEquals(null, converter.getObjectType());
- converterAnnotation = (ObjectTypeConverterAnnotation) attributeResource.getSupportingAnnotation(ObjectTypeConverterAnnotation.ANNOTATION_NAME);
- assertEquals(null, converterAnnotation.getObjectType());
-
-
- converter.setObjectType("Bar");
- assertEquals("Bar", converter.getObjectType());
- converterAnnotation = (ObjectTypeConverterAnnotation) attributeResource.getSupportingAnnotation(ObjectTypeConverterAnnotation.ANNOTATION_NAME);
- assertEquals("Bar", converterAnnotation.getObjectType());
- }
-
- public void testGetObjectTypeUpdatesFromResourceModelChange() throws Exception {
- createTestEntityWithConvertAndObjectType();
- addXmlClassRef(FULLY_QUALIFIED_TYPE_NAME);
-
- PersistentAttribute persistentAttribute = getJavaPersistentType().attributes().next();
- BasicMapping basicMapping = (BasicMapping) persistentAttribute.getMapping();
- Convert eclipseLinkConvert = (Convert) basicMapping.getConverter();
- ObjectTypeConverter converter = (ObjectTypeConverter) eclipseLinkConvert.getConverter();
-
- assertEquals("Foo", converter.getObjectType());
-
- JavaResourcePersistentType typeResource = getJpaProject().getJavaResourcePersistentType(FULLY_QUALIFIED_TYPE_NAME);
- JavaResourcePersistentAttribute attributeResource = typeResource.persistableAttributes().next();
- ObjectTypeConverterAnnotation converterAnnotation = (ObjectTypeConverterAnnotation) attributeResource.getSupportingAnnotation(ObjectTypeConverterAnnotation.ANNOTATION_NAME);
- converterAnnotation.setObjectType("Bar");
- assertEquals("Bar", converter.getObjectType());
-
- attributeResource.removeSupportingAnnotation(ObjectTypeConverterAnnotation.ANNOTATION_NAME);
- assertEquals(null, eclipseLinkConvert.getConverter());
-
- converterAnnotation = (ObjectTypeConverterAnnotation) attributeResource.addSupportingAnnotation(ObjectTypeConverterAnnotation.ANNOTATION_NAME);
- assertNotNull(eclipseLinkConvert.getConverter());
-
- converterAnnotation.setObjectType("FooBar");
- assertEquals("FooBar", ((ObjectTypeConverter) eclipseLinkConvert.getConverter()).getObjectType());
- }
-
-
- public void testAddConversionValue() throws Exception {
- createTestEntityWithConvertAndObjectTypeConverter();
- addXmlClassRef(FULLY_QUALIFIED_TYPE_NAME);
-
- PersistentAttribute persistentAttribute = getJavaPersistentType().attributes().next();
- BasicMapping basicMapping = (BasicMapping) persistentAttribute.getMapping();
- Convert eclipseLinkConvert = (Convert) basicMapping.getConverter();
- ObjectTypeConverter converter = (ObjectTypeConverter) eclipseLinkConvert.getConverter();
-
- JavaResourcePersistentType typeResource = getJpaProject().getJavaResourcePersistentType(FULLY_QUALIFIED_TYPE_NAME);
- JavaResourcePersistentAttribute attributeResource = typeResource.persistableAttributes().next();
- ObjectTypeConverterAnnotation converterAnnotation = (ObjectTypeConverterAnnotation) attributeResource.getSupportingAnnotation(ObjectTypeConverterAnnotation.ANNOTATION_NAME);
-
- ConversionValue conversionValue = converter.addConversionValue(0);
- conversionValue.setDataValue("F");
- conversionValue.setObjectValue("female");
-
- ListIterator<ConversionValueAnnotation> resourceConversionValues = converterAnnotation.conversionValues();
- ConversionValueAnnotation resourceConversionValue = resourceConversionValues.next();
- assertEquals("F", resourceConversionValue.getDataValue());
- assertEquals("female", resourceConversionValue.getObjectValue());
-
- ConversionValue conversionValue2 = converter.addConversionValue(0);
- conversionValue2.setDataValue("M");
- conversionValue2.setObjectValue("male");
-
- resourceConversionValues = converterAnnotation.conversionValues();
- resourceConversionValue = resourceConversionValues.next();
- assertEquals("M", resourceConversionValue.getDataValue());
- assertEquals("male", resourceConversionValue.getObjectValue());
- resourceConversionValue = resourceConversionValues.next();
- assertEquals("F", resourceConversionValue.getDataValue());
- assertEquals("female", resourceConversionValue.getObjectValue());
-
- ConversionValue conversionValue3 = converter.addConversionValue(1);
- conversionValue3.setDataValue("O");
- conversionValue3.setObjectValue("male");
-
- resourceConversionValues = converterAnnotation.conversionValues();
- resourceConversionValue = resourceConversionValues.next();
- assertEquals("M", resourceConversionValue.getDataValue());
- assertEquals("male", resourceConversionValue.getObjectValue());
- resourceConversionValue = resourceConversionValues.next();
- assertEquals("O", resourceConversionValue.getDataValue());
- assertEquals("male", resourceConversionValue.getObjectValue());
- resourceConversionValue = resourceConversionValues.next();
- assertEquals("F", resourceConversionValue.getDataValue());
- assertEquals("female", resourceConversionValue.getObjectValue());
-
- ListIterator<ConversionValue> conversionValues = converter.conversionValues();
- assertEquals(conversionValue2, conversionValues.next());
- assertEquals(conversionValue3, conversionValues.next());
- assertEquals(conversionValue, conversionValues.next());
-
- conversionValues = converter.conversionValues();
- assertEquals("M", conversionValues.next().getDataValue());
- assertEquals("O", conversionValues.next().getDataValue());
- assertEquals("F", conversionValues.next().getDataValue());
- }
-
- public void testRemoveConversionValue() throws Exception {
- createTestEntityWithConvertAndObjectTypeConverter();
- addXmlClassRef(FULLY_QUALIFIED_TYPE_NAME);
-
- PersistentAttribute persistentAttribute = getJavaPersistentType().attributes().next();
- BasicMapping basicMapping = (BasicMapping) persistentAttribute.getMapping();
- Convert eclipseLinkConvert = (Convert) basicMapping.getConverter();
- ObjectTypeConverter converter = (ObjectTypeConverter) eclipseLinkConvert.getConverter();
-
- JavaResourcePersistentType typeResource = getJpaProject().getJavaResourcePersistentType(FULLY_QUALIFIED_TYPE_NAME);
- JavaResourcePersistentAttribute attributeResource = typeResource.persistableAttributes().next();
- ObjectTypeConverterAnnotation converterAnnotation = (ObjectTypeConverterAnnotation) attributeResource.getSupportingAnnotation(ObjectTypeConverterAnnotation.ANNOTATION_NAME);
-
- converter.addConversionValue(0).setDataValue("F");
- converter.addConversionValue(1).setDataValue("M");
- converter.addConversionValue(2).setDataValue("O");
-
- ListIterator<ConversionValueAnnotation> resourceConversionValues = converterAnnotation.conversionValues();
- assertEquals(3, CollectionTools.size(resourceConversionValues));
-
- converter.removeConversionValue(0);
- resourceConversionValues = converterAnnotation.conversionValues();
- assertEquals(2, CollectionTools.size(resourceConversionValues));
- resourceConversionValues = converterAnnotation.conversionValues();
- assertEquals("M", resourceConversionValues.next().getDataValue());
- assertEquals("O", resourceConversionValues.next().getDataValue());
-
- converter.removeConversionValue(0);
- resourceConversionValues = converterAnnotation.conversionValues();
- assertEquals(1, CollectionTools.size(resourceConversionValues));
- resourceConversionValues = converterAnnotation.conversionValues();
- assertEquals("O", resourceConversionValues.next().getDataValue());
-
- converter.removeConversionValue(0);
- resourceConversionValues = converterAnnotation.conversionValues();
- assertEquals(0, CollectionTools.size(resourceConversionValues));
- }
-
- public void testMoveConversionValue() throws Exception {
- createTestEntityWithConvertAndObjectTypeConverter();
- addXmlClassRef(FULLY_QUALIFIED_TYPE_NAME);
-
- PersistentAttribute persistentAttribute = getJavaPersistentType().attributes().next();
- BasicMapping basicMapping = (BasicMapping) persistentAttribute.getMapping();
- Convert eclipseLinkConvert = (Convert) basicMapping.getConverter();
- ObjectTypeConverter converter = (ObjectTypeConverter) eclipseLinkConvert.getConverter();
-
- JavaResourcePersistentType typeResource = getJpaProject().getJavaResourcePersistentType(FULLY_QUALIFIED_TYPE_NAME);
- JavaResourcePersistentAttribute attributeResource = typeResource.persistableAttributes().next();
- ObjectTypeConverterAnnotation converterAnnotation = (ObjectTypeConverterAnnotation) attributeResource.getSupportingAnnotation(ObjectTypeConverterAnnotation.ANNOTATION_NAME);
-
- converter.addConversionValue(0).setDataValue("F");
- converter.addConversionValue(1).setDataValue("M");
- converter.addConversionValue(2).setDataValue("O");
-
- ListIterator<ConversionValueAnnotation> resourceConversionValues = converterAnnotation.conversionValues();
- assertEquals(3, CollectionTools.size(resourceConversionValues));
-
- converter.moveConversionValue(2,0);
- resourceConversionValues = converterAnnotation.conversionValues();
- assertEquals(3, CollectionTools.size(resourceConversionValues));
- resourceConversionValues = converterAnnotation.conversionValues();
- assertEquals("M", resourceConversionValues.next().getDataValue());
- assertEquals("O", resourceConversionValues.next().getDataValue());
- assertEquals("F", resourceConversionValues.next().getDataValue());
-
- converter.moveConversionValue(0,1);
- resourceConversionValues = converterAnnotation.conversionValues();
- assertEquals(3, CollectionTools.size(resourceConversionValues));
- resourceConversionValues = converterAnnotation.conversionValues();
- assertEquals("O", resourceConversionValues.next().getDataValue());
- assertEquals("M", resourceConversionValues.next().getDataValue());
- assertEquals("F", resourceConversionValues.next().getDataValue());
- }
-
- public void testUpdateConversionValues() throws Exception {
- createTestEntityWithConvertAndObjectTypeConverter();
- addXmlClassRef(FULLY_QUALIFIED_TYPE_NAME);
-
- PersistentAttribute persistentAttribute = getJavaPersistentType().attributes().next();
- BasicMapping basicMapping = (BasicMapping) persistentAttribute.getMapping();
- Convert eclipseLinkConvert = (Convert) basicMapping.getConverter();
- ObjectTypeConverter converter = (ObjectTypeConverter) eclipseLinkConvert.getConverter();
-
- JavaResourcePersistentType typeResource = getJpaProject().getJavaResourcePersistentType(FULLY_QUALIFIED_TYPE_NAME);
- JavaResourcePersistentAttribute attributeResource = typeResource.persistableAttributes().next();
- ObjectTypeConverterAnnotation converterAnnotation = (ObjectTypeConverterAnnotation) attributeResource.getSupportingAnnotation(ObjectTypeConverterAnnotation.ANNOTATION_NAME);
-
- converterAnnotation.addConversionValue(0).setDataValue("F");
- converterAnnotation.addConversionValue(1).setDataValue("M");
- converterAnnotation.addConversionValue(2).setDataValue("O");
-
- ListIterator<ConversionValue> conversionValues = converter.conversionValues();
- assertEquals("F", conversionValues.next().getDataValue());
- assertEquals("M", conversionValues.next().getDataValue());
- assertEquals("O", conversionValues.next().getDataValue());
- assertFalse(conversionValues.hasNext());
-
- converterAnnotation.moveConversionValue(2, 0);
- conversionValues = converter.conversionValues();
- assertEquals("M", conversionValues.next().getDataValue());
- assertEquals("O", conversionValues.next().getDataValue());
- assertEquals("F", conversionValues.next().getDataValue());
- assertFalse(conversionValues.hasNext());
-
- converterAnnotation.moveConversionValue(0, 1);
- conversionValues = converter.conversionValues();
- assertEquals("O", conversionValues.next().getDataValue());
- assertEquals("M", conversionValues.next().getDataValue());
- assertEquals("F", conversionValues.next().getDataValue());
- assertFalse(conversionValues.hasNext());
-
- converterAnnotation.removeConversionValue(1);
- conversionValues = converter.conversionValues();
- assertEquals("O", conversionValues.next().getDataValue());
- assertEquals("F", conversionValues.next().getDataValue());
- assertFalse(conversionValues.hasNext());
-
- converterAnnotation.removeConversionValue(1);
- conversionValues = converter.conversionValues();
- assertEquals("O", conversionValues.next().getDataValue());
- assertFalse(conversionValues.hasNext());
-
- converterAnnotation.removeConversionValue(0);
- conversionValues = converter.conversionValues();
- assertFalse(conversionValues.hasNext());
- }
-
- public void testConversionValuesSize() throws Exception {
- createTestEntityWithConvertAndObjectTypeConverter();
- addXmlClassRef(FULLY_QUALIFIED_TYPE_NAME);
-
-
- PersistentAttribute persistentAttribute = getJavaPersistentType().attributes().next();
- BasicMapping basicMapping = (BasicMapping) persistentAttribute.getMapping();
- Convert eclipseLinkConvert = (Convert) basicMapping.getConverter();
- ObjectTypeConverter converter = (ObjectTypeConverter) eclipseLinkConvert.getConverter();
-
- JavaResourcePersistentType typeResource = getJpaProject().getJavaResourcePersistentType(FULLY_QUALIFIED_TYPE_NAME);
- JavaResourcePersistentAttribute attributeResource = typeResource.persistableAttributes().next();
- ObjectTypeConverterAnnotation converterAnnotation = (ObjectTypeConverterAnnotation) attributeResource.getSupportingAnnotation(ObjectTypeConverterAnnotation.ANNOTATION_NAME);
-
- assertEquals(0, converter.conversionValuesSize());
-
- converterAnnotation.addConversionValue(0).setDataValue("F");
- converterAnnotation.addConversionValue(1).setDataValue("M");
- converterAnnotation.addConversionValue(2).setDataValue("O");
-
- assertEquals(3, converter.conversionValuesSize());
- }
-
-
- public void testGetDefaultObjectValue() throws Exception {
- createTestEntityWithConvertAndObjectTypeConverter();
- addXmlClassRef(FULLY_QUALIFIED_TYPE_NAME);
-
- PersistentAttribute persistentAttribute = getJavaPersistentType().attributes().next();
- BasicMapping basicMapping = (BasicMapping) persistentAttribute.getMapping();
- Convert eclipseLinkConvert = (Convert) basicMapping.getConverter();
- ObjectTypeConverter converter = (ObjectTypeConverter) eclipseLinkConvert.getConverter();
-
- assertEquals("bar", converter.getDefaultObjectValue());
- }
-
- public void testSetDefaultObjectValue() throws Exception {
- createTestEntityWithConvertAndObjectTypeConverter();
- addXmlClassRef(FULLY_QUALIFIED_TYPE_NAME);
-
- PersistentAttribute persistentAttribute = getJavaPersistentType().attributes().next();
- BasicMapping basicMapping = (BasicMapping) persistentAttribute.getMapping();
- Convert eclipseLinkConvert = (Convert) basicMapping.getConverter();
- ObjectTypeConverter converter = (ObjectTypeConverter) eclipseLinkConvert.getConverter();
- assertEquals("bar", converter.getDefaultObjectValue());
-
- converter.setDefaultObjectValue("baz");
- assertEquals("baz", converter.getDefaultObjectValue());
-
- JavaResourcePersistentType typeResource = getJpaProject().getJavaResourcePersistentType(FULLY_QUALIFIED_TYPE_NAME);
- JavaResourcePersistentAttribute attributeResource = typeResource.persistableAttributes().next();
- ObjectTypeConverterAnnotation converterAnnotation = (ObjectTypeConverterAnnotation) attributeResource.getSupportingAnnotation(ObjectTypeConverterAnnotation.ANNOTATION_NAME);
- assertEquals("baz", converterAnnotation.getDefaultObjectValue());
-
-
- converter.setDefaultObjectValue(null);
- assertEquals(null, converter.getDefaultObjectValue());
- converterAnnotation = (ObjectTypeConverterAnnotation) attributeResource.getSupportingAnnotation(ObjectTypeConverterAnnotation.ANNOTATION_NAME);
- assertEquals(null, converterAnnotation.getDefaultObjectValue());
-
-
- converter.setDefaultObjectValue("bar");
- assertEquals("bar", converter.getDefaultObjectValue());
- converterAnnotation = (ObjectTypeConverterAnnotation) attributeResource.getSupportingAnnotation(ObjectTypeConverterAnnotation.ANNOTATION_NAME);
- assertEquals("bar", converterAnnotation.getDefaultObjectValue());
- }
-
- public void testGetDefaultObjectValueUpdatesFromResourceModelChange() throws Exception {
- createTestEntityWithConvertAndObjectTypeConverter();
- addXmlClassRef(FULLY_QUALIFIED_TYPE_NAME);
-
- PersistentAttribute persistentAttribute = getJavaPersistentType().attributes().next();
- BasicMapping basicMapping = (BasicMapping) persistentAttribute.getMapping();
- Convert eclipseLinkConvert = (Convert) basicMapping.getConverter();
- ObjectTypeConverter converter = (ObjectTypeConverter) eclipseLinkConvert.getConverter();
-
- assertEquals("bar", converter.getDefaultObjectValue());
-
- JavaResourcePersistentType typeResource = getJpaProject().getJavaResourcePersistentType(FULLY_QUALIFIED_TYPE_NAME);
- JavaResourcePersistentAttribute attributeResource = typeResource.persistableAttributes().next();
- ObjectTypeConverterAnnotation converterAnnotation = (ObjectTypeConverterAnnotation) attributeResource.getSupportingAnnotation(ObjectTypeConverterAnnotation.ANNOTATION_NAME);
- converterAnnotation.setDefaultObjectValue("baz");
- assertEquals("baz", converter.getDefaultObjectValue());
-
- attributeResource.removeSupportingAnnotation(ObjectTypeConverterAnnotation.ANNOTATION_NAME);
- assertEquals(null, eclipseLinkConvert.getConverter());
-
- converterAnnotation = (ObjectTypeConverterAnnotation) attributeResource.addSupportingAnnotation(ObjectTypeConverterAnnotation.ANNOTATION_NAME);
- assertNotNull(eclipseLinkConvert.getConverter());
-
- converterAnnotation.setDefaultObjectValue("FOO");
- assertEquals("FOO", ((ObjectTypeConverter) eclipseLinkConvert.getConverter()).getDefaultObjectValue());
- }
-
- public void testInitializeConversionValues() throws Exception {
- createTestEntityWithConvertAndObjectTypeConverterConversionValue();
- addXmlClassRef(FULLY_QUALIFIED_TYPE_NAME);
-
- PersistentAttribute persistentAttribute = getJavaPersistentType().attributes().next();
- BasicMapping basicMapping = (BasicMapping) persistentAttribute.getMapping();
- Convert eclipseLinkConvert = (Convert) basicMapping.getConverter();
- ObjectTypeConverter converter = (ObjectTypeConverter) eclipseLinkConvert.getConverter();
-
- assertEquals(1, converter.conversionValuesSize());
- assertEquals("f", converter.conversionValues().next().getDataValue());
- assertEquals("female", converter.conversionValues().next().getObjectValue());
- }
-}
diff --git a/jpa/tests/org.eclipse.jpt.eclipselink.core.tests/src/org/eclipse/jpt/eclipselink/core/tests/internal/context/java/EclipseLinkJavaOneToManyMappingTests.java b/jpa/tests/org.eclipse.jpt.eclipselink.core.tests/src/org/eclipse/jpt/eclipselink/core/tests/internal/context/java/EclipseLinkJavaOneToManyMappingTests.java
deleted file mode 100644
index 041b9b2d37..0000000000
--- a/jpa/tests/org.eclipse.jpt.eclipselink.core.tests/src/org/eclipse/jpt/eclipselink/core/tests/internal/context/java/EclipseLinkJavaOneToManyMappingTests.java
+++ /dev/null
@@ -1,436 +0,0 @@
-/*******************************************************************************
- * Copyright (c) 2008, 2009 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.
- *
- * Contributors:
- * Oracle - initial API and implementation
- ******************************************************************************/
-package org.eclipse.jpt.eclipselink.core.tests.internal.context.java;
-
-import java.util.Iterator;
-import java.util.ListIterator;
-import org.eclipse.jdt.core.ICompilationUnit;
-import org.eclipse.jpt.core.MappingKeys;
-import org.eclipse.jpt.core.context.FetchType;
-import org.eclipse.jpt.core.context.PersistentAttribute;
-import org.eclipse.jpt.core.context.java.JavaPersistentAttribute;
-import org.eclipse.jpt.core.resource.java.JPA;
-import org.eclipse.jpt.core.resource.java.JavaResourcePersistentAttribute;
-import org.eclipse.jpt.core.resource.java.JavaResourcePersistentType;
-import org.eclipse.jpt.core.resource.java.OneToManyAnnotation;
-import org.eclipse.jpt.eclipselink.core.context.EclipseLinkOneToManyMapping;
-import org.eclipse.jpt.eclipselink.core.context.EclipseLinkRelationshipMapping;
-import org.eclipse.jpt.eclipselink.core.context.JoinFetch;
-import org.eclipse.jpt.eclipselink.core.context.JoinFetchType;
-import org.eclipse.jpt.eclipselink.core.context.PrivateOwned;
-import org.eclipse.jpt.eclipselink.core.resource.java.EclipseLinkJPA;
-import org.eclipse.jpt.eclipselink.core.resource.java.JoinFetchAnnotation;
-import org.eclipse.jpt.eclipselink.core.resource.java.PrivateOwnedAnnotation;
-import org.eclipse.jpt.eclipselink.core.tests.internal.context.EclipseLinkContextModelTestCase;
-import org.eclipse.jpt.utility.internal.iterators.ArrayIterator;
-
-@SuppressWarnings("nls")
-public class EclipseLinkJavaOneToManyMappingTests extends EclipseLinkContextModelTestCase
-{
-
- private ICompilationUnit createTestEntityWithPrivateOwnedOneToMany() throws Exception {
- return this.createTestType(new DefaultAnnotationWriter() {
- @Override
- public Iterator<String> imports() {
- return new ArrayIterator<String>(JPA.ENTITY, JPA.ONE_TO_MANY, EclipseLinkJPA.PRIVATE_OWNED);
- }
- @Override
- public void appendTypeAnnotationTo(StringBuilder sb) {
- sb.append("@Entity").append(CR);
- }
-
- @Override
- public void appendIdFieldAnnotationTo(StringBuilder sb) {
- sb.append("@OneToMany").append(CR);
- sb.append("@PrivateOwned").append(CR);
- }
- });
- }
-
- private ICompilationUnit createTestEntityWithJoinFetchOneToMany() throws Exception {
- return this.createTestType(new DefaultAnnotationWriter() {
- @Override
- public Iterator<String> imports() {
- return new ArrayIterator<String>(JPA.ENTITY, JPA.ONE_TO_MANY, EclipseLinkJPA.JOIN_FETCH);
- }
- @Override
- public void appendTypeAnnotationTo(StringBuilder sb) {
- sb.append("@Entity").append(CR);
- }
-
- @Override
- public void appendIdFieldAnnotationTo(StringBuilder sb) {
- sb.append("@OneToMany").append(CR);
- sb.append("@JoinFetch").append(CR);
- }
- });
- }
-
- private ICompilationUnit createTestEntityWithDefaultOneToMany() throws Exception {
- return this.createTestType(new DefaultAnnotationWriter() {
- @Override
- public Iterator<String> imports() {
- return new ArrayIterator<String>(JPA.ENTITY);
- }
-
- @Override
- public void appendExtendsImplementsTo(StringBuilder sb) {
- sb.append("implements java.io.Serializable");
- }
-
- @Override
- public void appendTypeAnnotationTo(StringBuilder sb) {
- sb.append("@Entity").append(CR);
- }
-
- @Override
- public void appendIdFieldAnnotationTo(StringBuilder sb) {
- sb.append("private java.util.Collection<" + TYPE_NAME + "> myTypes;").append(CR);
- sb.append(CR);
- }
- });
- }
-
- public EclipseLinkJavaOneToManyMappingTests(String name) {
- super(name);
- }
-
-
- public void testGetPrivateOwned() throws Exception {
- createTestEntityWithPrivateOwnedOneToMany();
- addXmlClassRef(FULLY_QUALIFIED_TYPE_NAME);
-
- PersistentAttribute persistentAttribute = getJavaPersistentType().attributes().next();
- EclipseLinkOneToManyMapping oneToManyMapping = (EclipseLinkOneToManyMapping) persistentAttribute.getSpecifiedMapping();
- PrivateOwned privateOwnable = oneToManyMapping.getPrivateOwned();
- assertEquals(true, privateOwnable.isPrivateOwned());
- }
-
- public void testSetPrivateOwned() throws Exception {
- createTestEntityWithPrivateOwnedOneToMany();
- addXmlClassRef(FULLY_QUALIFIED_TYPE_NAME);
-
- PersistentAttribute persistentAttribute = getJavaPersistentType().attributes().next();
- EclipseLinkOneToManyMapping oneToManyMapping = (EclipseLinkOneToManyMapping) persistentAttribute.getSpecifiedMapping();
- PrivateOwned privateOwnable = oneToManyMapping.getPrivateOwned();
- assertEquals(true, privateOwnable.isPrivateOwned());
-
- privateOwnable.setPrivateOwned(false);
-
- JavaResourcePersistentType typeResource = getJpaProject().getJavaResourcePersistentType(FULLY_QUALIFIED_TYPE_NAME);
- JavaResourcePersistentAttribute attributeResource = typeResource.persistableAttributes().next();
- assertNull(attributeResource.getSupportingAnnotation(PrivateOwnedAnnotation.ANNOTATION_NAME));
- assertEquals(false, privateOwnable.isPrivateOwned());
-
- privateOwnable.setPrivateOwned(true);
- assertNotNull(attributeResource.getSupportingAnnotation(PrivateOwnedAnnotation.ANNOTATION_NAME));
- assertEquals(true, privateOwnable.isPrivateOwned());
- }
-
- public void testPrivateOwnedUpdatesFromResourceModelChange() throws Exception {
- createTestEntityWithPrivateOwnedOneToMany();
- addXmlClassRef(FULLY_QUALIFIED_TYPE_NAME);
-
- PersistentAttribute persistentAttribute = getJavaPersistentType().attributes().next();
- EclipseLinkOneToManyMapping oneToManyMapping = (EclipseLinkOneToManyMapping) persistentAttribute.getSpecifiedMapping();
- PrivateOwned privateOwnable = oneToManyMapping.getPrivateOwned();
- assertEquals(true, privateOwnable.isPrivateOwned());
-
-
- JavaResourcePersistentType typeResource = getJpaProject().getJavaResourcePersistentType(FULLY_QUALIFIED_TYPE_NAME);
- JavaResourcePersistentAttribute attributeResource = typeResource.persistableAttributes().next();
- attributeResource.removeSupportingAnnotation(PrivateOwnedAnnotation.ANNOTATION_NAME);
-
- assertEquals(false, privateOwnable.isPrivateOwned());
-
- attributeResource.addSupportingAnnotation(PrivateOwnedAnnotation.ANNOTATION_NAME);
- assertEquals(true, privateOwnable.isPrivateOwned());
- }
-
- public void testGetJoinFetchValue() throws Exception {
- createTestEntityWithJoinFetchOneToMany();
- addXmlClassRef(FULLY_QUALIFIED_TYPE_NAME);
-
- PersistentAttribute persistentAttribute = getJavaPersistentType().attributes().next();
- EclipseLinkRelationshipMapping manyToManyMapping = (EclipseLinkRelationshipMapping) persistentAttribute.getSpecifiedMapping();
- JoinFetch contextJoinFetch = manyToManyMapping.getJoinFetch();
- JavaResourcePersistentType typeResource = getJpaProject().getJavaResourcePersistentType(FULLY_QUALIFIED_TYPE_NAME);
- JavaResourcePersistentAttribute attributeResource = typeResource.persistableAttributes().next();
- JoinFetchAnnotation joinFetchAnnotation = (JoinFetchAnnotation) attributeResource.getSupportingAnnotation(JoinFetchAnnotation.ANNOTATION_NAME);
-
- // base annotated, test context value
-
- assertNull(joinFetchAnnotation.getValue());
- assertEquals(JoinFetchType.INNER, contextJoinFetch.getValue());
-
- // change resource to INNER specifically, test context
-
- joinFetchAnnotation.setValue(org.eclipse.jpt.eclipselink.core.resource.java.JoinFetchType.INNER);
-
- assertEquals(org.eclipse.jpt.eclipselink.core.resource.java.JoinFetchType.INNER, joinFetchAnnotation.getValue());
- assertEquals(JoinFetchType.INNER, contextJoinFetch.getValue());
-
- // change resource to OUTER, test context
-
- joinFetchAnnotation.setValue(org.eclipse.jpt.eclipselink.core.resource.java.JoinFetchType.OUTER);
-
- assertEquals(org.eclipse.jpt.eclipselink.core.resource.java.JoinFetchType.OUTER, joinFetchAnnotation.getValue());
- assertEquals(JoinFetchType.OUTER, contextJoinFetch.getValue());
-
- // remove value from resource, test context
-
- joinFetchAnnotation.setValue(null);
-
- assertNull(joinFetchAnnotation.getValue());
- assertEquals(JoinFetchType.INNER, contextJoinFetch.getValue());
-
- // remove annotation, text context
-
- attributeResource.removeSupportingAnnotation(JoinFetchAnnotation.ANNOTATION_NAME);
-
- assertNull(joinFetchAnnotation.getValue());
- assertNull(contextJoinFetch.getValue());
- }
-
- public void testSetJoinFetchValue() throws Exception {
- createTestEntityWithJoinFetchOneToMany();
- addXmlClassRef(FULLY_QUALIFIED_TYPE_NAME);
-
- PersistentAttribute persistentAttribute = getJavaPersistentType().attributes().next();
- EclipseLinkRelationshipMapping manyToManyMapping = (EclipseLinkRelationshipMapping) persistentAttribute.getSpecifiedMapping();
- JoinFetch contextJoinFetch = manyToManyMapping.getJoinFetch();
- JavaResourcePersistentType typeResource = getJpaProject().getJavaResourcePersistentType(FULLY_QUALIFIED_TYPE_NAME);
- JavaResourcePersistentAttribute attributeResource = typeResource.persistableAttributes().next();
- JoinFetchAnnotation joinFetchAnnotation = (JoinFetchAnnotation) attributeResource.getSupportingAnnotation(JoinFetchAnnotation.ANNOTATION_NAME);
-
- // base annotated, test resource value
-
- assertNull(joinFetchAnnotation.getValue());
- assertEquals(JoinFetchType.INNER, contextJoinFetch.getValue());
-
- // change context to INNER specifically, test resource
-
- contextJoinFetch.setValue(JoinFetchType.INNER);
-
- assertNull(joinFetchAnnotation.getValue());
- assertEquals(JoinFetchType.INNER, contextJoinFetch.getValue());
-
- // change context to OUTER, test resource
-
- contextJoinFetch.setValue(JoinFetchType.OUTER);
-
- assertEquals(org.eclipse.jpt.eclipselink.core.resource.java.JoinFetchType.OUTER, joinFetchAnnotation.getValue());
- assertEquals(JoinFetchType.OUTER, contextJoinFetch.getValue());
-
- // set context to null, test resource
-
- contextJoinFetch.setValue(null);
-
- assertNull(attributeResource.getSupportingAnnotation(JoinFetchAnnotation.ANNOTATION_NAME));
- assertNull(contextJoinFetch.getValue());
-
- // change context to INNER specifically (this time from no annotation), test resource
-
- contextJoinFetch.setValue(JoinFetchType.INNER);
- joinFetchAnnotation = (JoinFetchAnnotation) attributeResource.getSupportingAnnotation(JoinFetchAnnotation.ANNOTATION_NAME);
-
- assertEquals(org.eclipse.jpt.eclipselink.core.resource.java.JoinFetchType.INNER, joinFetchAnnotation.getValue());
- assertEquals(JoinFetchType.INNER, contextJoinFetch.getValue());
- }
-
-
- public void testDefaultOneToMany() throws Exception {
- createTestEntityWithDefaultOneToMany();
- addXmlClassRef(FULLY_QUALIFIED_TYPE_NAME);
-
- ListIterator<JavaPersistentAttribute> attributes = getJavaPersistentType().attributes();
- JavaPersistentAttribute persistentAttribute = attributes.next();
- assertNull(persistentAttribute.getSpecifiedMapping());
- assertEquals(MappingKeys.ONE_TO_MANY_ATTRIBUTE_MAPPING_KEY, persistentAttribute.getDefaultMappingKey());
-
- assertEquals(MappingKeys.BASIC_ATTRIBUTE_MAPPING_KEY, attributes.next().getDefaultMappingKey());
- }
-
- public void testDefaultOneToManySetFetch() throws Exception {
- createTestEntityWithDefaultOneToMany();
- addXmlClassRef(FULLY_QUALIFIED_TYPE_NAME);
-
- ListIterator<JavaPersistentAttribute> attributes = getJavaPersistentType().attributes();
- JavaPersistentAttribute persistentAttribute = attributes.next();
- assertNull(persistentAttribute.getSpecifiedMapping());
- assertEquals(MappingKeys.ONE_TO_MANY_ATTRIBUTE_MAPPING_KEY, persistentAttribute.getDefaultMappingKey());
-
- EclipseLinkOneToManyMapping oneToManyMapping = (EclipseLinkOneToManyMapping) persistentAttribute.getMapping();
- oneToManyMapping.setSpecifiedFetch(FetchType.LAZY);
-
- EclipseLinkOneToManyMapping specifiedOneToManyMapping = (EclipseLinkOneToManyMapping) getJavaPersistentType().attributes().next().getSpecifiedMapping();
- assertEquals(FetchType.LAZY, specifiedOneToManyMapping.getFetch());
-
- JavaResourcePersistentType typeResource = getJpaProject().getJavaResourcePersistentType(FULLY_QUALIFIED_TYPE_NAME);
- JavaResourcePersistentAttribute attributeResource = typeResource.persistableAttributes().next();
- assertNotNull(attributeResource.getMappingAnnotation());
- assertTrue(attributeResource.getMappingAnnotation() instanceof OneToManyAnnotation);
- assertEquals(org.eclipse.jpt.core.resource.java.FetchType.LAZY, ((OneToManyAnnotation) attributeResource.getMappingAnnotation()).getFetch());
- }
-
- public void testDefaultOneToManySetTargetEntity() throws Exception {
- createTestEntityWithDefaultOneToMany();
- addXmlClassRef(FULLY_QUALIFIED_TYPE_NAME);
-
- ListIterator<JavaPersistentAttribute> attributes = getJavaPersistentType().attributes();
- JavaPersistentAttribute persistentAttribute = attributes.next();
- assertNull(persistentAttribute.getSpecifiedMapping());
- assertEquals(MappingKeys.ONE_TO_MANY_ATTRIBUTE_MAPPING_KEY, persistentAttribute.getDefaultMappingKey());
-
- EclipseLinkOneToManyMapping oneToManyMapping = (EclipseLinkOneToManyMapping) persistentAttribute.getMapping();
- oneToManyMapping.setSpecifiedTargetEntity("Foo");
-
- EclipseLinkOneToManyMapping specifiedOneToManyMapping = (EclipseLinkOneToManyMapping) getJavaPersistentType().attributes().next().getSpecifiedMapping();
- assertEquals("Foo", specifiedOneToManyMapping.getSpecifiedTargetEntity());
-
- JavaResourcePersistentType typeResource = getJpaProject().getJavaResourcePersistentType(FULLY_QUALIFIED_TYPE_NAME);
- JavaResourcePersistentAttribute attributeResource = typeResource.persistableAttributes().next();
- assertNotNull(attributeResource.getMappingAnnotation());
- assertTrue(attributeResource.getMappingAnnotation() instanceof OneToManyAnnotation);
- assertEquals("Foo", ((OneToManyAnnotation) attributeResource.getMappingAnnotation()).getTargetEntity());
- }
-
- public void testDefaultOneToManySetMappedBy() throws Exception {
- createTestEntityWithDefaultOneToMany();
- addXmlClassRef(FULLY_QUALIFIED_TYPE_NAME);
-
- ListIterator<JavaPersistentAttribute> attributes = getJavaPersistentType().attributes();
- JavaPersistentAttribute persistentAttribute = attributes.next();
- assertNull(persistentAttribute.getSpecifiedMapping());
- assertEquals(MappingKeys.ONE_TO_MANY_ATTRIBUTE_MAPPING_KEY, persistentAttribute.getDefaultMappingKey());
-
- EclipseLinkOneToManyMapping oneToManyMapping = (EclipseLinkOneToManyMapping) persistentAttribute.getMapping();
- oneToManyMapping.getRelationshipReference().getMappedByJoiningStrategy().setMappedByAttribute("Foo");
-
- EclipseLinkOneToManyMapping specifiedOneToManyMapping = (EclipseLinkOneToManyMapping) getJavaPersistentType().attributes().next().getSpecifiedMapping();
- assertEquals("Foo", specifiedOneToManyMapping.getRelationshipReference().getMappedByJoiningStrategy().getMappedByAttribute());
-
- JavaResourcePersistentType typeResource = getJpaProject().getJavaResourcePersistentType(FULLY_QUALIFIED_TYPE_NAME);
- JavaResourcePersistentAttribute attributeResource = typeResource.persistableAttributes().next();
- assertNotNull(attributeResource.getMappingAnnotation());
- assertTrue(attributeResource.getMappingAnnotation() instanceof OneToManyAnnotation);
- assertEquals("Foo", ((OneToManyAnnotation) attributeResource.getMappingAnnotation()).getMappedBy());
- }
-
- public void testDefaultOneToManySetCascadeAll() throws Exception {
- createTestEntityWithDefaultOneToMany();
- addXmlClassRef(FULLY_QUALIFIED_TYPE_NAME);
-
- ListIterator<JavaPersistentAttribute> attributes = getJavaPersistentType().attributes();
- JavaPersistentAttribute persistentAttribute = attributes.next();
- assertNull(persistentAttribute.getSpecifiedMapping());
- assertEquals(MappingKeys.ONE_TO_MANY_ATTRIBUTE_MAPPING_KEY, persistentAttribute.getDefaultMappingKey());
-
- EclipseLinkOneToManyMapping oneToManyMapping = (EclipseLinkOneToManyMapping) persistentAttribute.getMapping();
- oneToManyMapping.getCascade().setAll(true);
-
- EclipseLinkOneToManyMapping specifiedOneToManyMapping = (EclipseLinkOneToManyMapping) getJavaPersistentType().attributes().next().getSpecifiedMapping();
- assertEquals(true, specifiedOneToManyMapping.getCascade().isAll());
-
- JavaResourcePersistentType typeResource = getJpaProject().getJavaResourcePersistentType(FULLY_QUALIFIED_TYPE_NAME);
- JavaResourcePersistentAttribute attributeResource = typeResource.persistableAttributes().next();
- assertNotNull(attributeResource.getMappingAnnotation());
- assertTrue(attributeResource.getMappingAnnotation() instanceof OneToManyAnnotation);
- assertEquals(true, ((OneToManyAnnotation) attributeResource.getMappingAnnotation()).isCascadeAll());
- }
-
- public void testDefaultOneToManySetCascadeMerge() throws Exception {
- createTestEntityWithDefaultOneToMany();
- addXmlClassRef(FULLY_QUALIFIED_TYPE_NAME);
-
- ListIterator<JavaPersistentAttribute> attributes = getJavaPersistentType().attributes();
- JavaPersistentAttribute persistentAttribute = attributes.next();
- assertNull(persistentAttribute.getSpecifiedMapping());
- assertEquals(MappingKeys.ONE_TO_MANY_ATTRIBUTE_MAPPING_KEY, persistentAttribute.getDefaultMappingKey());
-
- EclipseLinkOneToManyMapping oneToManyMapping = (EclipseLinkOneToManyMapping) persistentAttribute.getMapping();
- oneToManyMapping.getCascade().setMerge(true);
-
- EclipseLinkOneToManyMapping specifiedOneToManyMapping = (EclipseLinkOneToManyMapping) getJavaPersistentType().attributes().next().getSpecifiedMapping();
- assertEquals(true, specifiedOneToManyMapping.getCascade().isMerge());
-
- JavaResourcePersistentType typeResource = getJpaProject().getJavaResourcePersistentType(FULLY_QUALIFIED_TYPE_NAME);
- JavaResourcePersistentAttribute attributeResource = typeResource.persistableAttributes().next();
- assertNotNull(attributeResource.getMappingAnnotation());
- assertTrue(attributeResource.getMappingAnnotation() instanceof OneToManyAnnotation);
- assertEquals(true, ((OneToManyAnnotation) attributeResource.getMappingAnnotation()).isCascadeMerge());
- }
-
- public void testDefaultOneToManySetCascadePersist() throws Exception {
- createTestEntityWithDefaultOneToMany();
- addXmlClassRef(FULLY_QUALIFIED_TYPE_NAME);
-
- ListIterator<JavaPersistentAttribute> attributes = getJavaPersistentType().attributes();
- JavaPersistentAttribute persistentAttribute = attributes.next();
- assertNull(persistentAttribute.getSpecifiedMapping());
- assertEquals(MappingKeys.ONE_TO_MANY_ATTRIBUTE_MAPPING_KEY, persistentAttribute.getDefaultMappingKey());
-
- EclipseLinkOneToManyMapping oneToManyMapping = (EclipseLinkOneToManyMapping) persistentAttribute.getMapping();
- oneToManyMapping.getCascade().setPersist(true);
-
- EclipseLinkOneToManyMapping specifiedOneToManyMapping = (EclipseLinkOneToManyMapping) getJavaPersistentType().attributes().next().getSpecifiedMapping();
- assertEquals(true, specifiedOneToManyMapping.getCascade().isPersist());
-
- JavaResourcePersistentType typeResource = getJpaProject().getJavaResourcePersistentType(FULLY_QUALIFIED_TYPE_NAME);
- JavaResourcePersistentAttribute attributeResource = typeResource.persistableAttributes().next();
- assertNotNull(attributeResource.getMappingAnnotation());
- assertTrue(attributeResource.getMappingAnnotation() instanceof OneToManyAnnotation);
- assertEquals(true, ((OneToManyAnnotation) attributeResource.getMappingAnnotation()).isCascadePersist());
- }
-
- public void testDefaultOneToManySetCascadeRefresh() throws Exception {
- createTestEntityWithDefaultOneToMany();
- addXmlClassRef(FULLY_QUALIFIED_TYPE_NAME);
-
- ListIterator<JavaPersistentAttribute> attributes = getJavaPersistentType().attributes();
- JavaPersistentAttribute persistentAttribute = attributes.next();
- assertNull(persistentAttribute.getSpecifiedMapping());
- assertEquals(MappingKeys.ONE_TO_MANY_ATTRIBUTE_MAPPING_KEY, persistentAttribute.getDefaultMappingKey());
-
- EclipseLinkOneToManyMapping oneToManyMapping = (EclipseLinkOneToManyMapping) persistentAttribute.getMapping();
- oneToManyMapping.getCascade().setRefresh(true);
-
- EclipseLinkOneToManyMapping specifiedOneToManyMapping = (EclipseLinkOneToManyMapping) getJavaPersistentType().attributes().next().getSpecifiedMapping();
- assertEquals(true, specifiedOneToManyMapping.getCascade().isRefresh());
-
- JavaResourcePersistentType typeResource = getJpaProject().getJavaResourcePersistentType(FULLY_QUALIFIED_TYPE_NAME);
- JavaResourcePersistentAttribute attributeResource = typeResource.persistableAttributes().next();
- assertNotNull(attributeResource.getMappingAnnotation());
- assertTrue(attributeResource.getMappingAnnotation() instanceof OneToManyAnnotation);
- assertEquals(true, ((OneToManyAnnotation) attributeResource.getMappingAnnotation()).isCascadeRefresh());
- }
-
- public void testDefaultOneToManySetCascadeRemove() throws Exception {
- createTestEntityWithDefaultOneToMany();
- addXmlClassRef(FULLY_QUALIFIED_TYPE_NAME);
-
- ListIterator<JavaPersistentAttribute> attributes = getJavaPersistentType().attributes();
- JavaPersistentAttribute persistentAttribute = attributes.next();
- assertNull(persistentAttribute.getSpecifiedMapping());
- assertEquals(MappingKeys.ONE_TO_MANY_ATTRIBUTE_MAPPING_KEY, persistentAttribute.getDefaultMappingKey());
-
- EclipseLinkOneToManyMapping oneToManyMapping = (EclipseLinkOneToManyMapping) persistentAttribute.getMapping();
- oneToManyMapping.getCascade().setRemove(true);
-
- EclipseLinkOneToManyMapping specifiedOneToManyMapping = (EclipseLinkOneToManyMapping) getJavaPersistentType().attributes().next().getSpecifiedMapping();
- assertEquals(true, specifiedOneToManyMapping.getCascade().isRemove());
-
- JavaResourcePersistentType typeResource = getJpaProject().getJavaResourcePersistentType(FULLY_QUALIFIED_TYPE_NAME);
- JavaResourcePersistentAttribute attributeResource = typeResource.persistableAttributes().next();
- assertNotNull(attributeResource.getMappingAnnotation());
- assertTrue(attributeResource.getMappingAnnotation() instanceof OneToManyAnnotation);
- assertEquals(true, ((OneToManyAnnotation) attributeResource.getMappingAnnotation()).isCascadeRemove());
- }
-}
diff --git a/jpa/tests/org.eclipse.jpt.eclipselink.core.tests/src/org/eclipse/jpt/eclipselink/core/tests/internal/context/java/EclipseLinkJavaOneToOneMappingTests.java b/jpa/tests/org.eclipse.jpt.eclipselink.core.tests/src/org/eclipse/jpt/eclipselink/core/tests/internal/context/java/EclipseLinkJavaOneToOneMappingTests.java
deleted file mode 100644
index 3747ae38b3..0000000000
--- a/jpa/tests/org.eclipse.jpt.eclipselink.core.tests/src/org/eclipse/jpt/eclipselink/core/tests/internal/context/java/EclipseLinkJavaOneToOneMappingTests.java
+++ /dev/null
@@ -1,435 +0,0 @@
-/*******************************************************************************
- * Copyright (c) 2008, 2009 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.
- *
- * Contributors:
- * Oracle - initial API and implementation
- ******************************************************************************/
-package org.eclipse.jpt.eclipselink.core.tests.internal.context.java;
-
-import java.util.Iterator;
-import java.util.ListIterator;
-import org.eclipse.jdt.core.ICompilationUnit;
-import org.eclipse.jpt.core.MappingKeys;
-import org.eclipse.jpt.core.context.FetchType;
-import org.eclipse.jpt.core.context.PersistentAttribute;
-import org.eclipse.jpt.core.context.java.JavaPersistentAttribute;
-import org.eclipse.jpt.core.resource.java.JPA;
-import org.eclipse.jpt.core.resource.java.JavaResourcePersistentAttribute;
-import org.eclipse.jpt.core.resource.java.JavaResourcePersistentType;
-import org.eclipse.jpt.core.resource.java.OneToOneAnnotation;
-import org.eclipse.jpt.eclipselink.core.context.EclipseLinkOneToOneMapping;
-import org.eclipse.jpt.eclipselink.core.context.EclipseLinkRelationshipMapping;
-import org.eclipse.jpt.eclipselink.core.context.JoinFetch;
-import org.eclipse.jpt.eclipselink.core.context.JoinFetchType;
-import org.eclipse.jpt.eclipselink.core.context.PrivateOwned;
-import org.eclipse.jpt.eclipselink.core.resource.java.EclipseLinkJPA;
-import org.eclipse.jpt.eclipselink.core.resource.java.JoinFetchAnnotation;
-import org.eclipse.jpt.eclipselink.core.resource.java.PrivateOwnedAnnotation;
-import org.eclipse.jpt.eclipselink.core.tests.internal.context.EclipseLinkContextModelTestCase;
-import org.eclipse.jpt.utility.internal.iterators.ArrayIterator;
-
-@SuppressWarnings("nls")
-public class EclipseLinkJavaOneToOneMappingTests extends EclipseLinkContextModelTestCase
-{
-
- private ICompilationUnit createTestEntityWithPrivateOwnedOneToOne() throws Exception {
- return this.createTestType(new DefaultAnnotationWriter() {
- @Override
- public Iterator<String> imports() {
- return new ArrayIterator<String>(JPA.ENTITY, JPA.ONE_TO_ONE, EclipseLinkJPA.PRIVATE_OWNED);
- }
- @Override
- public void appendTypeAnnotationTo(StringBuilder sb) {
- sb.append("@Entity").append(CR);
- }
-
- @Override
- public void appendIdFieldAnnotationTo(StringBuilder sb) {
- sb.append("@OneToOne").append(CR);
- sb.append("@PrivateOwned").append(CR);
- }
- });
- }
-
- private ICompilationUnit createTestEntityWithJoinFetchOneToOne() throws Exception {
- return this.createTestType(new DefaultAnnotationWriter() {
- @Override
- public Iterator<String> imports() {
- return new ArrayIterator<String>(JPA.ENTITY, JPA.ONE_TO_ONE, EclipseLinkJPA.JOIN_FETCH);
- }
- @Override
- public void appendTypeAnnotationTo(StringBuilder sb) {
- sb.append("@Entity").append(CR);
- }
-
- @Override
- public void appendIdFieldAnnotationTo(StringBuilder sb) {
- sb.append("@OneToOne").append(CR);
- sb.append("@JoinFetch").append(CR);
- }
- });
- }
-
- private ICompilationUnit createTestEntityWithDefaultOneToOne() throws Exception {
- return this.createTestType(new DefaultAnnotationWriter() {
- @Override
- public Iterator<String> imports() {
- return new ArrayIterator<String>(JPA.ENTITY);
- }
-
- @Override
- public void appendExtendsImplementsTo(StringBuilder sb) {
- sb.append("implements java.io.Serializable");
- }
-
- @Override
- public void appendTypeAnnotationTo(StringBuilder sb) {
- sb.append("@Entity").append(CR);
- }
-
- @Override
- public void appendIdFieldAnnotationTo(StringBuilder sb) {
- sb.append("private " + TYPE_NAME + " myType;").append(CR);
- sb.append(CR);
- }
- });
- }
-
- public EclipseLinkJavaOneToOneMappingTests(String name) {
- super(name);
- }
-
-
- public void testGetPrivateOwned() throws Exception {
- createTestEntityWithPrivateOwnedOneToOne();
- addXmlClassRef(FULLY_QUALIFIED_TYPE_NAME);
-
- PersistentAttribute persistentAttribute = getJavaPersistentType().attributes().next();
- EclipseLinkOneToOneMapping oneToOneMapping = (EclipseLinkOneToOneMapping) persistentAttribute.getSpecifiedMapping();
- PrivateOwned privateOwnable = oneToOneMapping.getPrivateOwned();
- assertEquals(true, privateOwnable.isPrivateOwned());
- }
-
- public void testSetPrivateOwned() throws Exception {
- createTestEntityWithPrivateOwnedOneToOne();
- addXmlClassRef(FULLY_QUALIFIED_TYPE_NAME);
-
- PersistentAttribute persistentAttribute = getJavaPersistentType().attributes().next();
- EclipseLinkOneToOneMapping oneToOneMapping = (EclipseLinkOneToOneMapping) persistentAttribute.getSpecifiedMapping();
- PrivateOwned privateOwnable = oneToOneMapping.getPrivateOwned();
- assertEquals(true, privateOwnable.isPrivateOwned());
-
- privateOwnable.setPrivateOwned(false);
-
- JavaResourcePersistentType typeResource = getJpaProject().getJavaResourcePersistentType(FULLY_QUALIFIED_TYPE_NAME);
- JavaResourcePersistentAttribute attributeResource = typeResource.persistableAttributes().next();
- assertNull(attributeResource.getSupportingAnnotation(PrivateOwnedAnnotation.ANNOTATION_NAME));
- assertEquals(false, privateOwnable.isPrivateOwned());
-
- privateOwnable.setPrivateOwned(true);
- assertNotNull(attributeResource.getSupportingAnnotation(PrivateOwnedAnnotation.ANNOTATION_NAME));
- assertEquals(true, privateOwnable.isPrivateOwned());
- }
-
- public void testPrivateOwnedUpdatesFromResourceModelChange() throws Exception {
- createTestEntityWithPrivateOwnedOneToOne();
- addXmlClassRef(FULLY_QUALIFIED_TYPE_NAME);
-
- PersistentAttribute persistentAttribute = getJavaPersistentType().attributes().next();
- EclipseLinkOneToOneMapping oneToOneMapping = (EclipseLinkOneToOneMapping) persistentAttribute.getSpecifiedMapping();
- PrivateOwned privateOwnable = oneToOneMapping.getPrivateOwned();
- assertEquals(true, privateOwnable.isPrivateOwned());
-
-
- JavaResourcePersistentType typeResource = getJpaProject().getJavaResourcePersistentType(FULLY_QUALIFIED_TYPE_NAME);
- JavaResourcePersistentAttribute attributeResource = typeResource.persistableAttributes().next();
- attributeResource.removeSupportingAnnotation(PrivateOwnedAnnotation.ANNOTATION_NAME);
-
- assertEquals(false, privateOwnable.isPrivateOwned());
-
- attributeResource.addSupportingAnnotation(PrivateOwnedAnnotation.ANNOTATION_NAME);
- assertEquals(true, privateOwnable.isPrivateOwned());
- }
-
- public void testGetJoinFetchValue() throws Exception {
- createTestEntityWithJoinFetchOneToOne();
- addXmlClassRef(FULLY_QUALIFIED_TYPE_NAME);
-
- PersistentAttribute persistentAttribute = getJavaPersistentType().attributes().next();
- EclipseLinkRelationshipMapping manyToManyMapping = (EclipseLinkRelationshipMapping) persistentAttribute.getSpecifiedMapping();
- JoinFetch contextJoinFetch = manyToManyMapping.getJoinFetch();
- JavaResourcePersistentType typeResource = getJpaProject().getJavaResourcePersistentType(FULLY_QUALIFIED_TYPE_NAME);
- JavaResourcePersistentAttribute attributeResource = typeResource.persistableAttributes().next();
- JoinFetchAnnotation joinFetchAnnotation = (JoinFetchAnnotation) attributeResource.getSupportingAnnotation(JoinFetchAnnotation.ANNOTATION_NAME);
-
- // base annotated, test context value
-
- assertNull(joinFetchAnnotation.getValue());
- assertEquals(JoinFetchType.INNER, contextJoinFetch.getValue());
-
- // change resource to INNER specifically, test context
-
- joinFetchAnnotation.setValue(org.eclipse.jpt.eclipselink.core.resource.java.JoinFetchType.INNER);
-
- assertEquals(org.eclipse.jpt.eclipselink.core.resource.java.JoinFetchType.INNER, joinFetchAnnotation.getValue());
- assertEquals(JoinFetchType.INNER, contextJoinFetch.getValue());
-
- // change resource to OUTER, test context
-
- joinFetchAnnotation.setValue(org.eclipse.jpt.eclipselink.core.resource.java.JoinFetchType.OUTER);
-
- assertEquals(org.eclipse.jpt.eclipselink.core.resource.java.JoinFetchType.OUTER, joinFetchAnnotation.getValue());
- assertEquals(JoinFetchType.OUTER, contextJoinFetch.getValue());
-
- // remove value from resource, test context
-
- joinFetchAnnotation.setValue(null);
-
- assertNull(joinFetchAnnotation.getValue());
- assertEquals(JoinFetchType.INNER, contextJoinFetch.getValue());
-
- // remove annotation, text context
-
- attributeResource.removeSupportingAnnotation(JoinFetchAnnotation.ANNOTATION_NAME);
-
- assertNull(joinFetchAnnotation.getValue());
- assertNull(contextJoinFetch.getValue());
- }
-
- public void testSetJoinFetchValue() throws Exception {
- createTestEntityWithJoinFetchOneToOne();
- addXmlClassRef(FULLY_QUALIFIED_TYPE_NAME);
-
- PersistentAttribute persistentAttribute = getJavaPersistentType().attributes().next();
- EclipseLinkRelationshipMapping manyToManyMapping = (EclipseLinkRelationshipMapping) persistentAttribute.getSpecifiedMapping();
- JoinFetch contextJoinFetch = manyToManyMapping.getJoinFetch();
- JavaResourcePersistentType typeResource = getJpaProject().getJavaResourcePersistentType(FULLY_QUALIFIED_TYPE_NAME);
- JavaResourcePersistentAttribute attributeResource = typeResource.persistableAttributes().next();
- JoinFetchAnnotation joinFetchAnnotation = (JoinFetchAnnotation) attributeResource.getSupportingAnnotation(JoinFetchAnnotation.ANNOTATION_NAME);
-
- // base annotated, test resource value
-
- assertNull(joinFetchAnnotation.getValue());
- assertEquals(JoinFetchType.INNER, contextJoinFetch.getValue());
-
- // change context to INNER specifically, test resource
-
- contextJoinFetch.setValue(JoinFetchType.INNER);
-
- assertNull(joinFetchAnnotation.getValue());
- assertEquals(JoinFetchType.INNER, contextJoinFetch.getValue());
-
- // change context to OUTER, test resource
-
- contextJoinFetch.setValue(JoinFetchType.OUTER);
-
- assertEquals(org.eclipse.jpt.eclipselink.core.resource.java.JoinFetchType.OUTER, joinFetchAnnotation.getValue());
- assertEquals(JoinFetchType.OUTER, contextJoinFetch.getValue());
-
- // set context to null, test resource
-
- contextJoinFetch.setValue(null);
-
- assertNull(attributeResource.getSupportingAnnotation(JoinFetchAnnotation.ANNOTATION_NAME));
- assertNull(contextJoinFetch.getValue());
-
- // change context to INNER specifically (this time from no annotation), test resource
-
- contextJoinFetch.setValue(JoinFetchType.INNER);
- joinFetchAnnotation = (JoinFetchAnnotation) attributeResource.getSupportingAnnotation(JoinFetchAnnotation.ANNOTATION_NAME);
-
- assertEquals(org.eclipse.jpt.eclipselink.core.resource.java.JoinFetchType.INNER, joinFetchAnnotation.getValue());
- assertEquals(JoinFetchType.INNER, contextJoinFetch.getValue());
- }
-
- public void testDefaultOneToOne() throws Exception {
- createTestEntityWithDefaultOneToOne();
- addXmlClassRef(FULLY_QUALIFIED_TYPE_NAME);
-
- ListIterator<JavaPersistentAttribute> attributes = getJavaPersistentType().attributes();
- JavaPersistentAttribute persistentAttribute = attributes.next();
- assertNull(persistentAttribute.getSpecifiedMapping());
- assertEquals(MappingKeys.ONE_TO_ONE_ATTRIBUTE_MAPPING_KEY, persistentAttribute.getDefaultMappingKey());
-
- assertEquals(MappingKeys.BASIC_ATTRIBUTE_MAPPING_KEY, attributes.next().getDefaultMappingKey());
- }
-
- public void testDefaultOneToOneSetFetch() throws Exception {
- createTestEntityWithDefaultOneToOne();
- addXmlClassRef(FULLY_QUALIFIED_TYPE_NAME);
-
- ListIterator<JavaPersistentAttribute> attributes = getJavaPersistentType().attributes();
- JavaPersistentAttribute persistentAttribute = attributes.next();
- assertNull(persistentAttribute.getSpecifiedMapping());
- assertEquals(MappingKeys.ONE_TO_ONE_ATTRIBUTE_MAPPING_KEY, persistentAttribute.getDefaultMappingKey());
-
- EclipseLinkOneToOneMapping oneToOneMapping = (EclipseLinkOneToOneMapping) persistentAttribute.getMapping();
- oneToOneMapping.setSpecifiedFetch(FetchType.LAZY);
-
- EclipseLinkOneToOneMapping specifiedOneToOneMapping = (EclipseLinkOneToOneMapping) getJavaPersistentType().attributes().next().getSpecifiedMapping();
- assertEquals(FetchType.LAZY, specifiedOneToOneMapping.getFetch());
-
- JavaResourcePersistentType typeResource = getJpaProject().getJavaResourcePersistentType(FULLY_QUALIFIED_TYPE_NAME);
- JavaResourcePersistentAttribute attributeResource = typeResource.persistableAttributes().next();
- assertNotNull(attributeResource.getMappingAnnotation());
- assertTrue(attributeResource.getMappingAnnotation() instanceof OneToOneAnnotation);
- assertEquals(org.eclipse.jpt.core.resource.java.FetchType.LAZY, ((OneToOneAnnotation) attributeResource.getMappingAnnotation()).getFetch());
- }
-
- public void testDefaultOneToOneSetTargetEntity() throws Exception {
- createTestEntityWithDefaultOneToOne();
- addXmlClassRef(FULLY_QUALIFIED_TYPE_NAME);
-
- ListIterator<JavaPersistentAttribute> attributes = getJavaPersistentType().attributes();
- JavaPersistentAttribute persistentAttribute = attributes.next();
- assertNull(persistentAttribute.getSpecifiedMapping());
- assertEquals(MappingKeys.ONE_TO_ONE_ATTRIBUTE_MAPPING_KEY, persistentAttribute.getDefaultMappingKey());
-
- EclipseLinkOneToOneMapping oneToOneMapping = (EclipseLinkOneToOneMapping) persistentAttribute.getMapping();
- oneToOneMapping.setSpecifiedTargetEntity("Foo");
-
- EclipseLinkOneToOneMapping specifiedOneToOneMapping = (EclipseLinkOneToOneMapping) getJavaPersistentType().attributes().next().getSpecifiedMapping();
- assertEquals("Foo", specifiedOneToOneMapping.getSpecifiedTargetEntity());
-
- JavaResourcePersistentType typeResource = getJpaProject().getJavaResourcePersistentType(FULLY_QUALIFIED_TYPE_NAME);
- JavaResourcePersistentAttribute attributeResource = typeResource.persistableAttributes().next();
- assertNotNull(attributeResource.getMappingAnnotation());
- assertTrue(attributeResource.getMappingAnnotation() instanceof OneToOneAnnotation);
- assertEquals("Foo", ((OneToOneAnnotation) attributeResource.getMappingAnnotation()).getTargetEntity());
- }
-
- public void testDefaultOneToOneSetMappedBy() throws Exception {
- createTestEntityWithDefaultOneToOne();
- addXmlClassRef(FULLY_QUALIFIED_TYPE_NAME);
-
- ListIterator<JavaPersistentAttribute> attributes = getJavaPersistentType().attributes();
- JavaPersistentAttribute persistentAttribute = attributes.next();
- assertNull(persistentAttribute.getSpecifiedMapping());
- assertEquals(MappingKeys.ONE_TO_ONE_ATTRIBUTE_MAPPING_KEY, persistentAttribute.getDefaultMappingKey());
-
- EclipseLinkOneToOneMapping oneToOneMapping = (EclipseLinkOneToOneMapping) persistentAttribute.getMapping();
- oneToOneMapping.getRelationshipReference().getMappedByJoiningStrategy().setMappedByAttribute("Foo");
-
- EclipseLinkOneToOneMapping specifiedOneToOneMapping = (EclipseLinkOneToOneMapping) getJavaPersistentType().attributes().next().getSpecifiedMapping();
- assertEquals("Foo", specifiedOneToOneMapping.getRelationshipReference().getMappedByJoiningStrategy().getMappedByAttribute());
-
- JavaResourcePersistentType typeResource = getJpaProject().getJavaResourcePersistentType(FULLY_QUALIFIED_TYPE_NAME);
- JavaResourcePersistentAttribute attributeResource = typeResource.persistableAttributes().next();
- assertNotNull(attributeResource.getMappingAnnotation());
- assertTrue(attributeResource.getMappingAnnotation() instanceof OneToOneAnnotation);
- assertEquals("Foo", ((OneToOneAnnotation) attributeResource.getMappingAnnotation()).getMappedBy());
- }
-
- public void testDefaultOneToOneSetCascadeAll() throws Exception {
- createTestEntityWithDefaultOneToOne();
- addXmlClassRef(FULLY_QUALIFIED_TYPE_NAME);
-
- ListIterator<JavaPersistentAttribute> attributes = getJavaPersistentType().attributes();
- JavaPersistentAttribute persistentAttribute = attributes.next();
- assertNull(persistentAttribute.getSpecifiedMapping());
- assertEquals(MappingKeys.ONE_TO_ONE_ATTRIBUTE_MAPPING_KEY, persistentAttribute.getDefaultMappingKey());
-
- EclipseLinkOneToOneMapping oneToOneMapping = (EclipseLinkOneToOneMapping) persistentAttribute.getMapping();
- oneToOneMapping.getCascade().setAll(true);
-
- EclipseLinkOneToOneMapping specifiedOneToOneMapping = (EclipseLinkOneToOneMapping) getJavaPersistentType().attributes().next().getSpecifiedMapping();
- assertEquals(true, specifiedOneToOneMapping.getCascade().isAll());
-
- JavaResourcePersistentType typeResource = getJpaProject().getJavaResourcePersistentType(FULLY_QUALIFIED_TYPE_NAME);
- JavaResourcePersistentAttribute attributeResource = typeResource.persistableAttributes().next();
- assertNotNull(attributeResource.getMappingAnnotation());
- assertTrue(attributeResource.getMappingAnnotation() instanceof OneToOneAnnotation);
- assertEquals(true, ((OneToOneAnnotation) attributeResource.getMappingAnnotation()).isCascadeAll());
- }
-
- public void testDefaultOneToOneSetCascadeMerge() throws Exception {
- createTestEntityWithDefaultOneToOne();
- addXmlClassRef(FULLY_QUALIFIED_TYPE_NAME);
-
- ListIterator<JavaPersistentAttribute> attributes = getJavaPersistentType().attributes();
- JavaPersistentAttribute persistentAttribute = attributes.next();
- assertNull(persistentAttribute.getSpecifiedMapping());
- assertEquals(MappingKeys.ONE_TO_ONE_ATTRIBUTE_MAPPING_KEY, persistentAttribute.getDefaultMappingKey());
-
- EclipseLinkOneToOneMapping oneToOneMapping = (EclipseLinkOneToOneMapping) persistentAttribute.getMapping();
- oneToOneMapping.getCascade().setMerge(true);
-
- EclipseLinkOneToOneMapping specifiedOneToOneMapping = (EclipseLinkOneToOneMapping) getJavaPersistentType().attributes().next().getSpecifiedMapping();
- assertEquals(true, specifiedOneToOneMapping.getCascade().isMerge());
-
- JavaResourcePersistentType typeResource = getJpaProject().getJavaResourcePersistentType(FULLY_QUALIFIED_TYPE_NAME);
- JavaResourcePersistentAttribute attributeResource = typeResource.persistableAttributes().next();
- assertNotNull(attributeResource.getMappingAnnotation());
- assertTrue(attributeResource.getMappingAnnotation() instanceof OneToOneAnnotation);
- assertEquals(true, ((OneToOneAnnotation) attributeResource.getMappingAnnotation()).isCascadeMerge());
- }
-
- public void testDefaultOneToOneSetCascadePersist() throws Exception {
- createTestEntityWithDefaultOneToOne();
- addXmlClassRef(FULLY_QUALIFIED_TYPE_NAME);
-
- ListIterator<JavaPersistentAttribute> attributes = getJavaPersistentType().attributes();
- JavaPersistentAttribute persistentAttribute = attributes.next();
- assertNull(persistentAttribute.getSpecifiedMapping());
- assertEquals(MappingKeys.ONE_TO_ONE_ATTRIBUTE_MAPPING_KEY, persistentAttribute.getDefaultMappingKey());
-
- EclipseLinkOneToOneMapping oneToOneMapping = (EclipseLinkOneToOneMapping) persistentAttribute.getMapping();
- oneToOneMapping.getCascade().setPersist(true);
-
- EclipseLinkOneToOneMapping specifiedOneToOneMapping = (EclipseLinkOneToOneMapping) getJavaPersistentType().attributes().next().getSpecifiedMapping();
- assertEquals(true, specifiedOneToOneMapping.getCascade().isPersist());
-
- JavaResourcePersistentType typeResource = getJpaProject().getJavaResourcePersistentType(FULLY_QUALIFIED_TYPE_NAME);
- JavaResourcePersistentAttribute attributeResource = typeResource.persistableAttributes().next();
- assertNotNull(attributeResource.getMappingAnnotation());
- assertTrue(attributeResource.getMappingAnnotation() instanceof OneToOneAnnotation);
- assertEquals(true, ((OneToOneAnnotation) attributeResource.getMappingAnnotation()).isCascadePersist());
- }
-
- public void testDefaultOneToOneSetCascadeRefresh() throws Exception {
- createTestEntityWithDefaultOneToOne();
- addXmlClassRef(FULLY_QUALIFIED_TYPE_NAME);
-
- ListIterator<JavaPersistentAttribute> attributes = getJavaPersistentType().attributes();
- JavaPersistentAttribute persistentAttribute = attributes.next();
- assertNull(persistentAttribute.getSpecifiedMapping());
- assertEquals(MappingKeys.ONE_TO_ONE_ATTRIBUTE_MAPPING_KEY, persistentAttribute.getDefaultMappingKey());
-
- EclipseLinkOneToOneMapping oneToOneMapping = (EclipseLinkOneToOneMapping) persistentAttribute.getMapping();
- oneToOneMapping.getCascade().setRefresh(true);
-
- EclipseLinkOneToOneMapping specifiedOneToOneMapping = (EclipseLinkOneToOneMapping) getJavaPersistentType().attributes().next().getSpecifiedMapping();
- assertEquals(true, specifiedOneToOneMapping.getCascade().isRefresh());
-
- JavaResourcePersistentType typeResource = getJpaProject().getJavaResourcePersistentType(FULLY_QUALIFIED_TYPE_NAME);
- JavaResourcePersistentAttribute attributeResource = typeResource.persistableAttributes().next();
- assertNotNull(attributeResource.getMappingAnnotation());
- assertTrue(attributeResource.getMappingAnnotation() instanceof OneToOneAnnotation);
- assertEquals(true, ((OneToOneAnnotation) attributeResource.getMappingAnnotation()).isCascadeRefresh());
- }
-
- public void testDefaultOneToOneSetCascadeRemove() throws Exception {
- createTestEntityWithDefaultOneToOne();
- addXmlClassRef(FULLY_QUALIFIED_TYPE_NAME);
-
- ListIterator<JavaPersistentAttribute> attributes = getJavaPersistentType().attributes();
- JavaPersistentAttribute persistentAttribute = attributes.next();
- assertNull(persistentAttribute.getSpecifiedMapping());
- assertEquals(MappingKeys.ONE_TO_ONE_ATTRIBUTE_MAPPING_KEY, persistentAttribute.getDefaultMappingKey());
-
- EclipseLinkOneToOneMapping oneToOneMapping = (EclipseLinkOneToOneMapping) persistentAttribute.getMapping();
- oneToOneMapping.getCascade().setRemove(true);
-
- EclipseLinkOneToOneMapping specifiedOneToOneMapping = (EclipseLinkOneToOneMapping) getJavaPersistentType().attributes().next().getSpecifiedMapping();
- assertEquals(true, specifiedOneToOneMapping.getCascade().isRemove());
-
- JavaResourcePersistentType typeResource = getJpaProject().getJavaResourcePersistentType(FULLY_QUALIFIED_TYPE_NAME);
- JavaResourcePersistentAttribute attributeResource = typeResource.persistableAttributes().next();
- assertNotNull(attributeResource.getMappingAnnotation());
- assertTrue(attributeResource.getMappingAnnotation() instanceof OneToOneAnnotation);
- assertEquals(true, ((OneToOneAnnotation) attributeResource.getMappingAnnotation()).isCascadeRemove());
- }
-}
diff --git a/jpa/tests/org.eclipse.jpt.eclipselink.core.tests/src/org/eclipse/jpt/eclipselink/core/tests/internal/context/java/EclipseLinkJavaStructConverterTests.java b/jpa/tests/org.eclipse.jpt.eclipselink.core.tests/src/org/eclipse/jpt/eclipselink/core/tests/internal/context/java/EclipseLinkJavaStructConverterTests.java
deleted file mode 100644
index 8eb7318ec1..0000000000
--- a/jpa/tests/org.eclipse.jpt.eclipselink.core.tests/src/org/eclipse/jpt/eclipselink/core/tests/internal/context/java/EclipseLinkJavaStructConverterTests.java
+++ /dev/null
@@ -1,213 +0,0 @@
-/*******************************************************************************
- * Copyright (c) 2007, 2009 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.
- *
- * Contributors:
- * Oracle - initial API and implementation
- ******************************************************************************/
-package org.eclipse.jpt.eclipselink.core.tests.internal.context.java;
-
-import java.util.Iterator;
-import org.eclipse.jdt.core.ICompilationUnit;
-import org.eclipse.jpt.core.context.BasicMapping;
-import org.eclipse.jpt.core.context.PersistentAttribute;
-import org.eclipse.jpt.core.resource.java.JPA;
-import org.eclipse.jpt.core.resource.java.JavaResourcePersistentAttribute;
-import org.eclipse.jpt.core.resource.java.JavaResourcePersistentType;
-import org.eclipse.jpt.eclipselink.core.context.Convert;
-import org.eclipse.jpt.eclipselink.core.context.StructConverter;
-import org.eclipse.jpt.eclipselink.core.resource.java.EclipseLinkJPA;
-import org.eclipse.jpt.eclipselink.core.resource.java.StructConverterAnnotation;
-import org.eclipse.jpt.eclipselink.core.tests.internal.context.EclipseLinkContextModelTestCase;
-import org.eclipse.jpt.utility.internal.iterators.ArrayIterator;
-
-@SuppressWarnings("nls")
-public class EclipseLinkJavaStructConverterTests extends EclipseLinkContextModelTestCase
-{
-
- private ICompilationUnit createTestEntityWithConvertAndStructConverter() throws Exception {
- return this.createTestType(new DefaultAnnotationWriter() {
- @Override
- public Iterator<String> imports() {
- return new ArrayIterator<String>(JPA.ENTITY, EclipseLinkJPA.CONVERT, EclipseLinkJPA.STRUCT_CONVERTER);
- }
- @Override
- public void appendTypeAnnotationTo(StringBuilder sb) {
- sb.append("@Entity");
- }
-
- @Override
- public void appendIdFieldAnnotationTo(StringBuilder sb) {
- sb.append("@Convert(\"foo\")").append(CR);
- sb.append(" @StructConverter(name=\"foo\"");
- }
- });
- }
-
- private ICompilationUnit createTestEntityWithConvertAndStructConverterClass() throws Exception {
- return this.createTestType(new DefaultAnnotationWriter() {
- @Override
- public Iterator<String> imports() {
- return new ArrayIterator<String>(JPA.ENTITY, EclipseLinkJPA.CONVERT, EclipseLinkJPA.STRUCT_CONVERTER);
- }
- @Override
- public void appendTypeAnnotationTo(StringBuilder sb) {
- sb.append("@Entity");
- }
-
- @Override
- public void appendIdFieldAnnotationTo(StringBuilder sb) {
- sb.append("@Convert(\"foo\")").append(CR);
- sb.append(" @StructConverter(converter=\"Foo\"");
- }
- });
- }
-
- public EclipseLinkJavaStructConverterTests(String name) {
- super(name);
- }
-
-
- public void testGetName() throws Exception {
- createTestEntityWithConvertAndStructConverter();
- addXmlClassRef(FULLY_QUALIFIED_TYPE_NAME);
-
- PersistentAttribute persistentAttribute = getJavaPersistentType().attributes().next();
- BasicMapping basicMapping = (BasicMapping) persistentAttribute.getMapping();
- Convert eclipseLinkConvert = (Convert) basicMapping.getConverter();
- StructConverter converter = (StructConverter) eclipseLinkConvert.getConverter();
-
- assertEquals("foo", converter.getName());
- }
-
- public void testSetName() throws Exception {
- createTestEntityWithConvertAndStructConverter();
- addXmlClassRef(FULLY_QUALIFIED_TYPE_NAME);
-
- PersistentAttribute persistentAttribute = getJavaPersistentType().attributes().next();
- BasicMapping basicMapping = (BasicMapping) persistentAttribute.getMapping();
- Convert eclipseLinkConvert = (Convert) basicMapping.getConverter();
- StructConverter converter = (StructConverter) eclipseLinkConvert.getConverter();
- assertEquals("foo", converter.getName());
-
- converter.setName("bar");
- assertEquals("bar", converter.getName());
-
- JavaResourcePersistentType typeResource = getJpaProject().getJavaResourcePersistentType(FULLY_QUALIFIED_TYPE_NAME);
- JavaResourcePersistentAttribute attributeResource = typeResource.persistableAttributes().next();
- StructConverterAnnotation converterAnnotation = (StructConverterAnnotation) attributeResource.getSupportingAnnotation(StructConverterAnnotation.ANNOTATION_NAME);
- assertEquals("bar", converterAnnotation.getName());
-
-
- converter.setName(null);
- assertEquals(null, converter.getName());
- converterAnnotation = (StructConverterAnnotation) attributeResource.getSupportingAnnotation(StructConverterAnnotation.ANNOTATION_NAME);
- assertEquals(null, converterAnnotation.getName());
-
-
- converter.setName("bar");
- assertEquals("bar", converter.getName());
- converterAnnotation = (StructConverterAnnotation) attributeResource.getSupportingAnnotation(StructConverterAnnotation.ANNOTATION_NAME);
- assertEquals("bar", converterAnnotation.getName());
- }
-
- public void testGetNameUpdatesFromResourceModelChange() throws Exception {
- createTestEntityWithConvertAndStructConverter();
- addXmlClassRef(FULLY_QUALIFIED_TYPE_NAME);
-
- PersistentAttribute persistentAttribute = getJavaPersistentType().attributes().next();
- BasicMapping basicMapping = (BasicMapping) persistentAttribute.getMapping();
- Convert eclipseLinkConvert = (Convert) basicMapping.getConverter();
- StructConverter converter = (StructConverter) eclipseLinkConvert.getConverter();
-
- assertEquals("foo", converter.getName());
-
- JavaResourcePersistentType typeResource = getJpaProject().getJavaResourcePersistentType(FULLY_QUALIFIED_TYPE_NAME);
- JavaResourcePersistentAttribute attributeResource = typeResource.persistableAttributes().next();
- StructConverterAnnotation converterAnnotation = (StructConverterAnnotation) attributeResource.getSupportingAnnotation(StructConverterAnnotation.ANNOTATION_NAME);
- converterAnnotation.setName("bar");
- assertEquals("bar", converter.getName());
-
- attributeResource.removeSupportingAnnotation(StructConverterAnnotation.ANNOTATION_NAME);
- assertEquals(null, eclipseLinkConvert.getConverter());
-
- converterAnnotation = (StructConverterAnnotation) attributeResource.addSupportingAnnotation(StructConverterAnnotation.ANNOTATION_NAME);
- assertNotNull(eclipseLinkConvert.getConverter());
-
- converterAnnotation.setName("FOO");
- assertEquals("FOO", eclipseLinkConvert.getConverter().getName());
- }
-
-
- public void testGetConverterClass() throws Exception {
- createTestEntityWithConvertAndStructConverterClass();
- addXmlClassRef(FULLY_QUALIFIED_TYPE_NAME);
-
- PersistentAttribute persistentAttribute = getJavaPersistentType().attributes().next();
- BasicMapping basicMapping = (BasicMapping) persistentAttribute.getMapping();
- Convert eclipseLinkConvert = (Convert) basicMapping.getConverter();
- StructConverter converter = (StructConverter) eclipseLinkConvert.getConverter();
-
- assertEquals("Foo", converter.getConverterClass());
- }
-
- public void testSetConverterClass() throws Exception {
- createTestEntityWithConvertAndStructConverterClass();
- addXmlClassRef(FULLY_QUALIFIED_TYPE_NAME);
-
- PersistentAttribute persistentAttribute = getJavaPersistentType().attributes().next();
- BasicMapping basicMapping = (BasicMapping) persistentAttribute.getMapping();
- Convert eclipseLinkConvert = (Convert) basicMapping.getConverter();
- StructConverter converter = (StructConverter) eclipseLinkConvert.getConverter();
- assertEquals("Foo", converter.getConverterClass());
-
- converter.setConverterClass("Bar");
- assertEquals("Bar", converter.getConverterClass());
-
- JavaResourcePersistentType typeResource = getJpaProject().getJavaResourcePersistentType(FULLY_QUALIFIED_TYPE_NAME);
- JavaResourcePersistentAttribute attributeResource = typeResource.persistableAttributes().next();
- StructConverterAnnotation converterAnnotation = (StructConverterAnnotation) attributeResource.getSupportingAnnotation(StructConverterAnnotation.ANNOTATION_NAME);
- assertEquals("Bar", converterAnnotation.getConverter());
-
-
- converter.setConverterClass(null);
- assertEquals(null, converter.getConverterClass());
- converterAnnotation = (StructConverterAnnotation) attributeResource.getSupportingAnnotation(StructConverterAnnotation.ANNOTATION_NAME);
- assertEquals(null, converterAnnotation.getConverter());
-
-
- converter.setConverterClass("Bar");
- assertEquals("Bar", converter.getConverterClass());
- converterAnnotation = (StructConverterAnnotation) attributeResource.getSupportingAnnotation(StructConverterAnnotation.ANNOTATION_NAME);
- assertEquals("Bar", converterAnnotation.getConverter());
- }
-
- public void testGetConverterClassUpdatesFromResourceModelChange() throws Exception {
- createTestEntityWithConvertAndStructConverterClass();
- addXmlClassRef(FULLY_QUALIFIED_TYPE_NAME);
-
- PersistentAttribute persistentAttribute = getJavaPersistentType().attributes().next();
- BasicMapping basicMapping = (BasicMapping) persistentAttribute.getMapping();
- Convert eclipseLinkConvert = (Convert) basicMapping.getConverter();
- StructConverter converter = (StructConverter) eclipseLinkConvert.getConverter();
-
- assertEquals("Foo", converter.getConverterClass());
-
- JavaResourcePersistentType typeResource = getJpaProject().getJavaResourcePersistentType(FULLY_QUALIFIED_TYPE_NAME);
- JavaResourcePersistentAttribute attributeResource = typeResource.persistableAttributes().next();
- StructConverterAnnotation converterAnnotation = (StructConverterAnnotation) attributeResource.getSupportingAnnotation(StructConverterAnnotation.ANNOTATION_NAME);
- converterAnnotation.setConverter("Bar");
- assertEquals("Bar", converter.getConverterClass());
-
- attributeResource.removeSupportingAnnotation(StructConverterAnnotation.ANNOTATION_NAME);
- assertEquals(null, eclipseLinkConvert.getConverter());
-
- converterAnnotation = (StructConverterAnnotation) attributeResource.addSupportingAnnotation(StructConverterAnnotation.ANNOTATION_NAME);
- assertNotNull(eclipseLinkConvert.getConverter());
-
- converterAnnotation.setConverter("FooBar");
- assertEquals("FooBar", ((StructConverter) eclipseLinkConvert.getConverter()).getConverterClass());
- }
-}
diff --git a/jpa/tests/org.eclipse.jpt.eclipselink.core.tests/src/org/eclipse/jpt/eclipselink/core/tests/internal/context/java/EclipseLinkJavaTypeConverterTests.java b/jpa/tests/org.eclipse.jpt.eclipselink.core.tests/src/org/eclipse/jpt/eclipselink/core/tests/internal/context/java/EclipseLinkJavaTypeConverterTests.java
deleted file mode 100644
index d4247051eb..0000000000
--- a/jpa/tests/org.eclipse.jpt.eclipselink.core.tests/src/org/eclipse/jpt/eclipselink/core/tests/internal/context/java/EclipseLinkJavaTypeConverterTests.java
+++ /dev/null
@@ -1,301 +0,0 @@
-/*******************************************************************************
- * Copyright (c) 2007, 2009 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.
- *
- * Contributors:
- * Oracle - initial API and implementation
- ******************************************************************************/
-package org.eclipse.jpt.eclipselink.core.tests.internal.context.java;
-
-import java.util.Iterator;
-import org.eclipse.jdt.core.ICompilationUnit;
-import org.eclipse.jpt.core.context.BasicMapping;
-import org.eclipse.jpt.core.context.PersistentAttribute;
-import org.eclipse.jpt.core.resource.java.JPA;
-import org.eclipse.jpt.core.resource.java.JavaResourcePersistentAttribute;
-import org.eclipse.jpt.core.resource.java.JavaResourcePersistentType;
-import org.eclipse.jpt.eclipselink.core.context.Convert;
-import org.eclipse.jpt.eclipselink.core.context.TypeConverter;
-import org.eclipse.jpt.eclipselink.core.resource.java.EclipseLinkJPA;
-import org.eclipse.jpt.eclipselink.core.resource.java.TypeConverterAnnotation;
-import org.eclipse.jpt.eclipselink.core.tests.internal.context.EclipseLinkContextModelTestCase;
-import org.eclipse.jpt.utility.internal.iterators.ArrayIterator;
-
-@SuppressWarnings("nls")
-public class EclipseLinkJavaTypeConverterTests extends EclipseLinkContextModelTestCase
-{
-
- private ICompilationUnit createTestEntityWithConvertAndTypeConverter() throws Exception {
- return this.createTestType(new DefaultAnnotationWriter() {
- @Override
- public Iterator<String> imports() {
- return new ArrayIterator<String>(JPA.ENTITY, EclipseLinkJPA.CONVERT, EclipseLinkJPA.TYPE_CONVERTER);
- }
- @Override
- public void appendTypeAnnotationTo(StringBuilder sb) {
- sb.append("@Entity");
- }
-
- @Override
- public void appendIdFieldAnnotationTo(StringBuilder sb) {
- sb.append("@Convert(\"foo\")").append(CR);
- sb.append(" @TypeConverter(name=\"foo\"");
- }
- });
- }
-
- private ICompilationUnit createTestEntityWithConvertAndDataType() throws Exception {
- return this.createTestType(new DefaultAnnotationWriter() {
- @Override
- public Iterator<String> imports() {
- return new ArrayIterator<String>(JPA.ENTITY, EclipseLinkJPA.CONVERT, EclipseLinkJPA.TYPE_CONVERTER);
- }
- @Override
- public void appendTypeAnnotationTo(StringBuilder sb) {
- sb.append("@Entity");
- }
-
- @Override
- public void appendIdFieldAnnotationTo(StringBuilder sb) {
- sb.append("@Convert(\"foo\")").append(CR);
- sb.append(" @TypeConverter(dataType=Foo.class");
- }
- });
- }
-
- private ICompilationUnit createTestEntityWithConvertAndObjectType() throws Exception {
- return this.createTestType(new DefaultAnnotationWriter() {
- @Override
- public Iterator<String> imports() {
- return new ArrayIterator<String>(JPA.ENTITY, EclipseLinkJPA.CONVERT, EclipseLinkJPA.TYPE_CONVERTER);
- }
- @Override
- public void appendTypeAnnotationTo(StringBuilder sb) {
- sb.append("@Entity");
- }
-
- @Override
- public void appendIdFieldAnnotationTo(StringBuilder sb) {
- sb.append("@Convert(\"foo\")").append(CR);
- sb.append(" @TypeConverter(objectType=Foo.class");
- }
- });
- }
-
- public EclipseLinkJavaTypeConverterTests(String name) {
- super(name);
- }
-
-
- public void testGetName() throws Exception {
- createTestEntityWithConvertAndTypeConverter();
- addXmlClassRef(FULLY_QUALIFIED_TYPE_NAME);
-
- PersistentAttribute persistentAttribute = getJavaPersistentType().attributes().next();
- BasicMapping basicMapping = (BasicMapping) persistentAttribute.getMapping();
- Convert eclipseLinkConvert = (Convert) basicMapping.getConverter();
- TypeConverter converter = (TypeConverter) eclipseLinkConvert.getConverter();
-
- assertEquals("foo", converter.getName());
- }
-
- public void testSetName() throws Exception {
- createTestEntityWithConvertAndTypeConverter();
- addXmlClassRef(FULLY_QUALIFIED_TYPE_NAME);
-
- PersistentAttribute persistentAttribute = getJavaPersistentType().attributes().next();
- BasicMapping basicMapping = (BasicMapping) persistentAttribute.getMapping();
- Convert eclipseLinkConvert = (Convert) basicMapping.getConverter();
- TypeConverter converter = (TypeConverter) eclipseLinkConvert.getConverter();
- assertEquals("foo", converter.getName());
-
- converter.setName("bar");
- assertEquals("bar", converter.getName());
-
- JavaResourcePersistentType typeResource = getJpaProject().getJavaResourcePersistentType(FULLY_QUALIFIED_TYPE_NAME);
- JavaResourcePersistentAttribute attributeResource = typeResource.persistableAttributes().next();
- TypeConverterAnnotation converterAnnotation = (TypeConverterAnnotation) attributeResource.getSupportingAnnotation(TypeConverterAnnotation.ANNOTATION_NAME);
- assertEquals("bar", converterAnnotation.getName());
-
-
- converter.setName(null);
- assertEquals(null, converter.getName());
- converterAnnotation = (TypeConverterAnnotation) attributeResource.getSupportingAnnotation(TypeConverterAnnotation.ANNOTATION_NAME);
- assertEquals(null, converterAnnotation.getName());
-
-
- converter.setName("bar");
- assertEquals("bar", converter.getName());
- converterAnnotation = (TypeConverterAnnotation) attributeResource.getSupportingAnnotation(TypeConverterAnnotation.ANNOTATION_NAME);
- assertEquals("bar", converterAnnotation.getName());
- }
-
- public void testGetNameUpdatesFromResourceModelChange() throws Exception {
- createTestEntityWithConvertAndTypeConverter();
- addXmlClassRef(FULLY_QUALIFIED_TYPE_NAME);
-
- PersistentAttribute persistentAttribute = getJavaPersistentType().attributes().next();
- BasicMapping basicMapping = (BasicMapping) persistentAttribute.getMapping();
- Convert eclipseLinkConvert = (Convert) basicMapping.getConverter();
- TypeConverter converter = (TypeConverter) eclipseLinkConvert.getConverter();
-
- assertEquals("foo", converter.getName());
-
- JavaResourcePersistentType typeResource = getJpaProject().getJavaResourcePersistentType(FULLY_QUALIFIED_TYPE_NAME);
- JavaResourcePersistentAttribute attributeResource = typeResource.persistableAttributes().next();
- TypeConverterAnnotation converterAnnotation = (TypeConverterAnnotation) attributeResource.getSupportingAnnotation(TypeConverterAnnotation.ANNOTATION_NAME);
- converterAnnotation.setName("bar");
- assertEquals("bar", converter.getName());
-
- attributeResource.removeSupportingAnnotation(TypeConverterAnnotation.ANNOTATION_NAME);
- assertEquals(null, eclipseLinkConvert.getConverter());
-
- converterAnnotation = (TypeConverterAnnotation) attributeResource.addSupportingAnnotation(TypeConverterAnnotation.ANNOTATION_NAME);
- assertNotNull(eclipseLinkConvert.getConverter());
-
- converterAnnotation.setName("FOO");
- assertEquals("FOO", eclipseLinkConvert.getConverter().getName());
- }
-
- public void testGetDataType() throws Exception {
- createTestEntityWithConvertAndDataType();
- addXmlClassRef(FULLY_QUALIFIED_TYPE_NAME);
-
- PersistentAttribute persistentAttribute = getJavaPersistentType().attributes().next();
- BasicMapping basicMapping = (BasicMapping) persistentAttribute.getMapping();
- Convert eclipseLinkConvert = (Convert) basicMapping.getConverter();
- TypeConverter converter = (TypeConverter) eclipseLinkConvert.getConverter();
-
- assertEquals("Foo", converter.getDataType());
- }
-
- public void testSetDataType() throws Exception {
- createTestEntityWithConvertAndDataType();
- addXmlClassRef(FULLY_QUALIFIED_TYPE_NAME);
-
- PersistentAttribute persistentAttribute = getJavaPersistentType().attributes().next();
- BasicMapping basicMapping = (BasicMapping) persistentAttribute.getMapping();
- Convert eclipseLinkConvert = (Convert) basicMapping.getConverter();
- TypeConverter converter = (TypeConverter) eclipseLinkConvert.getConverter();
- assertEquals("Foo", converter.getDataType());
-
- converter.setDataType("Bar");
- assertEquals("Bar", converter.getDataType());
-
- JavaResourcePersistentType typeResource = getJpaProject().getJavaResourcePersistentType(FULLY_QUALIFIED_TYPE_NAME);
- JavaResourcePersistentAttribute attributeResource = typeResource.persistableAttributes().next();
- TypeConverterAnnotation converterAnnotation = (TypeConverterAnnotation) attributeResource.getSupportingAnnotation(TypeConverterAnnotation.ANNOTATION_NAME);
- assertEquals("Bar", converterAnnotation.getDataType());
-
-
- converter.setDataType(null);
- assertEquals(null, converter.getDataType());
- converterAnnotation = (TypeConverterAnnotation) attributeResource.getSupportingAnnotation(TypeConverterAnnotation.ANNOTATION_NAME);
- assertEquals(null, converterAnnotation.getDataType());
-
-
- converter.setDataType("Bar");
- assertEquals("Bar", converter.getDataType());
- converterAnnotation = (TypeConverterAnnotation) attributeResource.getSupportingAnnotation(TypeConverterAnnotation.ANNOTATION_NAME);
- assertEquals("Bar", converterAnnotation.getDataType());
- }
-
- public void testGetDataTypeUpdatesFromResourceModelChange() throws Exception {
- createTestEntityWithConvertAndDataType();
- addXmlClassRef(FULLY_QUALIFIED_TYPE_NAME);
-
- PersistentAttribute persistentAttribute = getJavaPersistentType().attributes().next();
- BasicMapping basicMapping = (BasicMapping) persistentAttribute.getMapping();
- Convert eclipseLinkConvert = (Convert) basicMapping.getConverter();
- TypeConverter converter = (TypeConverter) eclipseLinkConvert.getConverter();
-
- assertEquals("Foo", converter.getDataType());
-
- JavaResourcePersistentType typeResource = getJpaProject().getJavaResourcePersistentType(FULLY_QUALIFIED_TYPE_NAME);
- JavaResourcePersistentAttribute attributeResource = typeResource.persistableAttributes().next();
- TypeConverterAnnotation converterAnnotation = (TypeConverterAnnotation) attributeResource.getSupportingAnnotation(TypeConverterAnnotation.ANNOTATION_NAME);
- converterAnnotation.setDataType("Bar");
- assertEquals("Bar", converter.getDataType());
-
- attributeResource.removeSupportingAnnotation(TypeConverterAnnotation.ANNOTATION_NAME);
- assertEquals(null, eclipseLinkConvert.getConverter());
-
- converterAnnotation = (TypeConverterAnnotation) attributeResource.addSupportingAnnotation(TypeConverterAnnotation.ANNOTATION_NAME);
- assertNotNull(eclipseLinkConvert.getConverter());
-
- converterAnnotation.setDataType("FooBar");
- assertEquals("FooBar", ((TypeConverter) eclipseLinkConvert.getConverter()).getDataType());
- }
-
- public void testGetObjectType() throws Exception {
- createTestEntityWithConvertAndObjectType();
- addXmlClassRef(FULLY_QUALIFIED_TYPE_NAME);
-
- PersistentAttribute persistentAttribute = getJavaPersistentType().attributes().next();
- BasicMapping basicMapping = (BasicMapping) persistentAttribute.getMapping();
- Convert eclipseLinkConvert = (Convert) basicMapping.getConverter();
- TypeConverter converter = (TypeConverter) eclipseLinkConvert.getConverter();
-
- assertEquals("Foo", converter.getObjectType());
- }
-
- public void testSetObjectType() throws Exception {
- createTestEntityWithConvertAndObjectType();
- addXmlClassRef(FULLY_QUALIFIED_TYPE_NAME);
-
- PersistentAttribute persistentAttribute = getJavaPersistentType().attributes().next();
- BasicMapping basicMapping = (BasicMapping) persistentAttribute.getMapping();
- Convert eclipseLinkConvert = (Convert) basicMapping.getConverter();
- TypeConverter converter = (TypeConverter) eclipseLinkConvert.getConverter();
- assertEquals("Foo", converter.getObjectType());
-
- converter.setObjectType("Bar");
- assertEquals("Bar", converter.getObjectType());
-
- JavaResourcePersistentType typeResource = getJpaProject().getJavaResourcePersistentType(FULLY_QUALIFIED_TYPE_NAME);
- JavaResourcePersistentAttribute attributeResource = typeResource.persistableAttributes().next();
- TypeConverterAnnotation converterAnnotation = (TypeConverterAnnotation) attributeResource.getSupportingAnnotation(TypeConverterAnnotation.ANNOTATION_NAME);
- assertEquals("Bar", converterAnnotation.getObjectType());
-
-
- converter.setObjectType(null);
- assertEquals(null, converter.getObjectType());
- converterAnnotation = (TypeConverterAnnotation) attributeResource.getSupportingAnnotation(TypeConverterAnnotation.ANNOTATION_NAME);
- assertEquals(null, converterAnnotation.getObjectType());
-
-
- converter.setObjectType("Bar");
- assertEquals("Bar", converter.getObjectType());
- converterAnnotation = (TypeConverterAnnotation) attributeResource.getSupportingAnnotation(TypeConverterAnnotation.ANNOTATION_NAME);
- assertEquals("Bar", converterAnnotation.getObjectType());
- }
-
- public void testGetObjectTypeUpdatesFromResourceModelChange() throws Exception {
- createTestEntityWithConvertAndObjectType();
- addXmlClassRef(FULLY_QUALIFIED_TYPE_NAME);
-
- PersistentAttribute persistentAttribute = getJavaPersistentType().attributes().next();
- BasicMapping basicMapping = (BasicMapping) persistentAttribute.getMapping();
- Convert eclipseLinkConvert = (Convert) basicMapping.getConverter();
- TypeConverter converter = (TypeConverter) eclipseLinkConvert.getConverter();
-
- assertEquals("Foo", converter.getObjectType());
-
- JavaResourcePersistentType typeResource = getJpaProject().getJavaResourcePersistentType(FULLY_QUALIFIED_TYPE_NAME);
- JavaResourcePersistentAttribute attributeResource = typeResource.persistableAttributes().next();
- TypeConverterAnnotation converterAnnotation = (TypeConverterAnnotation) attributeResource.getSupportingAnnotation(TypeConverterAnnotation.ANNOTATION_NAME);
- converterAnnotation.setObjectType("Bar");
- assertEquals("Bar", converter.getObjectType());
-
- attributeResource.removeSupportingAnnotation(TypeConverterAnnotation.ANNOTATION_NAME);
- assertEquals(null, eclipseLinkConvert.getConverter());
-
- converterAnnotation = (TypeConverterAnnotation) attributeResource.addSupportingAnnotation(TypeConverterAnnotation.ANNOTATION_NAME);
- assertNotNull(eclipseLinkConvert.getConverter());
-
- converterAnnotation.setObjectType("FooBar");
- assertEquals("FooBar", ((TypeConverter) eclipseLinkConvert.getConverter()).getObjectType());
- }
-}
diff --git a/jpa/tests/org.eclipse.jpt.eclipselink.core.tests/src/org/eclipse/jpt/eclipselink/core/tests/internal/context/java/EclipseLinkJavaVersionMappingTests.java b/jpa/tests/org.eclipse.jpt.eclipselink.core.tests/src/org/eclipse/jpt/eclipselink/core/tests/internal/context/java/EclipseLinkJavaVersionMappingTests.java
deleted file mode 100644
index f8010508e1..0000000000
--- a/jpa/tests/org.eclipse.jpt.eclipselink.core.tests/src/org/eclipse/jpt/eclipselink/core/tests/internal/context/java/EclipseLinkJavaVersionMappingTests.java
+++ /dev/null
@@ -1,315 +0,0 @@
-/*******************************************************************************
- * Copyright (c) 2007, 2009 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.
- *
- * Contributors:
- * Oracle - initial API and implementation
- ******************************************************************************/
-package org.eclipse.jpt.eclipselink.core.tests.internal.context.java;
-
-import java.util.Iterator;
-import org.eclipse.jdt.core.ICompilationUnit;
-import org.eclipse.jpt.core.context.Converter;
-import org.eclipse.jpt.core.context.PersistentAttribute;
-import org.eclipse.jpt.core.context.TemporalConverter;
-import org.eclipse.jpt.core.context.TemporalType;
-import org.eclipse.jpt.core.context.VersionMapping;
-import org.eclipse.jpt.core.resource.java.JPA;
-import org.eclipse.jpt.core.resource.java.JavaResourcePersistentAttribute;
-import org.eclipse.jpt.core.resource.java.JavaResourcePersistentType;
-import org.eclipse.jpt.core.resource.java.TemporalAnnotation;
-import org.eclipse.jpt.eclipselink.core.context.Convert;
-import org.eclipse.jpt.eclipselink.core.context.EclipseLinkVersionMapping;
-import org.eclipse.jpt.eclipselink.core.context.Mutable;
-import org.eclipse.jpt.eclipselink.core.resource.java.ConvertAnnotation;
-import org.eclipse.jpt.eclipselink.core.resource.java.EclipseLinkJPA;
-import org.eclipse.jpt.eclipselink.core.resource.java.MutableAnnotation;
-import org.eclipse.jpt.eclipselink.core.tests.internal.context.EclipseLinkContextModelTestCase;
-import org.eclipse.jpt.utility.internal.iterators.ArrayIterator;
-
-@SuppressWarnings("nls")
-public class EclipseLinkJavaVersionMappingTests extends EclipseLinkContextModelTestCase
-{
-
- private ICompilationUnit createTestEntityWithVersionMapping() throws Exception {
- return this.createTestType(new DefaultAnnotationWriter() {
- @Override
- public Iterator<String> imports() {
- return new ArrayIterator<String>(JPA.ENTITY, JPA.VERSION);
- }
- @Override
- public void appendTypeAnnotationTo(StringBuilder sb) {
- sb.append("@Entity").append(CR);
- }
-
- @Override
- public void appendIdFieldAnnotationTo(StringBuilder sb) {
- sb.append("@Version").append(CR);
- }
- });
- }
-
-
- private ICompilationUnit createTestEntityWithConvert() throws Exception {
- return this.createTestType(new DefaultAnnotationWriter() {
- @Override
- public Iterator<String> imports() {
- return new ArrayIterator<String>(JPA.ENTITY, JPA.VERSION, EclipseLinkJPA.CONVERT);
- }
- @Override
- public void appendTypeAnnotationTo(StringBuilder sb) {
- sb.append("@Entity").append(CR);
- }
-
- @Override
- public void appendIdFieldAnnotationTo(StringBuilder sb) {
- sb.append("@Version").append(CR);
- sb.append("@Convert(\"class-instance\")").append(CR);
- }
- });
- }
-
- private ICompilationUnit createTestEntityWithMutableVersion() throws Exception {
- return this.createTestType(new DefaultAnnotationWriter() {
- @Override
- public Iterator<String> imports() {
- return new ArrayIterator<String>(JPA.ENTITY, JPA.VERSION, EclipseLinkJPA.MUTABLE);
- }
- @Override
- public void appendTypeAnnotationTo(StringBuilder sb) {
- sb.append("@Entity").append(CR);
- }
-
- @Override
- public void appendIdFieldAnnotationTo(StringBuilder sb) {
- sb.append("@Version").append(CR);
- sb.append("@Mutable").append(CR);
- }
- });
- }
-
- private ICompilationUnit createTestEntityWithMutableVersionDate() throws Exception {
- return this.createTestType(new DefaultAnnotationWriter() {
- @Override
- public Iterator<String> imports() {
- return new ArrayIterator<String>(JPA.ENTITY, JPA.VERSION, EclipseLinkJPA.MUTABLE, "java.util.Date");
- }
- @Override
- public void appendTypeAnnotationTo(StringBuilder sb) {
- sb.append("@Entity").append(CR);
- }
-
- @Override
- public void appendIdFieldAnnotationTo(StringBuilder sb) {
- sb.append("@Version").append(CR);
- sb.append(" @Mutable").append(CR);
- sb.append(" private Date myDate;").append(CR);
- sb.append(CR);
- sb.append(" ");
- }
- });
- }
-
- public EclipseLinkJavaVersionMappingTests(String name) {
- super(name);
- }
-
- public void testGetConvert() throws Exception {
- createTestEntityWithVersionMapping();
- addXmlClassRef(FULLY_QUALIFIED_TYPE_NAME);
-
- JavaResourcePersistentType typeResource = getJpaProject().getJavaResourcePersistentType(FULLY_QUALIFIED_TYPE_NAME);
- JavaResourcePersistentAttribute attributeResource = typeResource.persistableAttributes().next();
- attributeResource.addSupportingAnnotation(ConvertAnnotation.ANNOTATION_NAME);
-
- PersistentAttribute persistentAttribute = getJavaPersistentType().attributes().next();
- VersionMapping versionMapping = (VersionMapping) persistentAttribute.getSpecifiedMapping();
-
- assertEquals(Convert.ECLIPSE_LINK_CONVERTER, versionMapping.getConverter().getType());
- }
-
- public void testGetConvert2() throws Exception {
- createTestEntityWithConvert();
- addXmlClassRef(FULLY_QUALIFIED_TYPE_NAME);
-
- PersistentAttribute persistentAttribute = getJavaPersistentType().attributes().next();
- VersionMapping versionMapping = (VersionMapping) persistentAttribute.getMapping();
-
- assertEquals(Convert.ECLIPSE_LINK_CONVERTER, versionMapping.getConverter().getType());
- assertEquals(Convert.CLASS_INSTANCE_CONVERTER, ((Convert) versionMapping.getConverter()).getConverterName());
- }
-
- public void testSetConvert() throws Exception {
- createTestEntityWithVersionMapping();
- addXmlClassRef(FULLY_QUALIFIED_TYPE_NAME);
-
- PersistentAttribute persistentAttribute = getJavaPersistentType().attributes().next();
- VersionMapping versionMapping = (VersionMapping) persistentAttribute.getSpecifiedMapping();
- assertEquals(Converter.NO_CONVERTER, versionMapping.getConverter().getType());
-
- versionMapping.setSpecifiedConverter(Converter.TEMPORAL_CONVERTER);
- ((TemporalConverter) versionMapping.getSpecifiedConverter()).setTemporalType(TemporalType.TIME);
-
- JavaResourcePersistentType typeResource = getJpaProject().getJavaResourcePersistentType(FULLY_QUALIFIED_TYPE_NAME);
- JavaResourcePersistentAttribute attributeResource = typeResource.persistableAttributes().next();
- TemporalAnnotation temporal = (TemporalAnnotation) attributeResource.getSupportingAnnotation(TemporalAnnotation.ANNOTATION_NAME);
-
- assertEquals(org.eclipse.jpt.core.resource.java.TemporalType.TIME, temporal.getValue());
-
- versionMapping.setSpecifiedConverter(null);
- assertNull(attributeResource.getSupportingAnnotation(TemporalAnnotation.ANNOTATION_NAME));
- }
-
- public void testGetConvertUpdatesFromResourceModelChange() throws Exception {
- createTestEntityWithVersionMapping();
- addXmlClassRef(FULLY_QUALIFIED_TYPE_NAME);
-
- PersistentAttribute persistentAttribute = getJavaPersistentType().attributes().next();
- VersionMapping versionMapping = (VersionMapping) persistentAttribute.getSpecifiedMapping();
-
- assertEquals(Converter.NO_CONVERTER, versionMapping.getConverter().getType());
-
-
- JavaResourcePersistentType typeResource = getJpaProject().getJavaResourcePersistentType(FULLY_QUALIFIED_TYPE_NAME);
- JavaResourcePersistentAttribute attributeResource = typeResource.persistableAttributes().next();
- ConvertAnnotation convert = (ConvertAnnotation) attributeResource.addSupportingAnnotation(ConvertAnnotation.ANNOTATION_NAME);
- convert.setValue("foo");
-
- assertEquals(Convert.ECLIPSE_LINK_CONVERTER, versionMapping.getConverter().getType());
- assertEquals("foo", ((Convert) versionMapping.getConverter()).getConverterName());
-
- attributeResource.removeSupportingAnnotation(ConvertAnnotation.ANNOTATION_NAME);
-
- assertEquals(Converter.NO_CONVERTER, versionMapping.getConverter().getType());
- assertFalse(versionMapping.isDefault());
- assertSame(versionMapping, persistentAttribute.getSpecifiedMapping());
- }
-
- public void testGetSpecifiedMutable() throws Exception {
- createTestEntityWithMutableVersion();
- addXmlClassRef(FULLY_QUALIFIED_TYPE_NAME);
-
- PersistentAttribute persistentAttribute = getJavaPersistentType().attributes().next();
- EclipseLinkVersionMapping versionMapping = (EclipseLinkVersionMapping) persistentAttribute.getSpecifiedMapping();
- Mutable mutable = versionMapping.getMutable();
- assertEquals(Boolean.TRUE, mutable.getSpecifiedMutable());
-
- JavaResourcePersistentType typeResource = getJpaProject().getJavaResourcePersistentType(FULLY_QUALIFIED_TYPE_NAME);
- JavaResourcePersistentAttribute attributeResource = typeResource.persistableAttributes().next();
- MutableAnnotation mutableAnnotation = (MutableAnnotation) attributeResource.getSupportingAnnotation(MutableAnnotation.ANNOTATION_NAME);
- mutableAnnotation.setValue(Boolean.TRUE);
-
- assertEquals(Boolean.TRUE, mutable.getSpecifiedMutable());
-
- mutableAnnotation.setValue(null);
- assertEquals(Boolean.TRUE, mutable.getSpecifiedMutable());
-
- mutableAnnotation.setValue(Boolean.FALSE);
- assertEquals(Boolean.FALSE, mutable.getSpecifiedMutable());
-
- attributeResource.removeSupportingAnnotation(MutableAnnotation.ANNOTATION_NAME);
- assertEquals(null, mutable.getSpecifiedMutable());
-
- attributeResource.addSupportingAnnotation(MutableAnnotation.ANNOTATION_NAME);
- assertEquals(Boolean.TRUE, mutable.getSpecifiedMutable());
- }
-
- public void testSetSpecifiedMutable() throws Exception {
- createTestEntityWithMutableVersion();
- addXmlClassRef(FULLY_QUALIFIED_TYPE_NAME);
-
- PersistentAttribute persistentAttribute = getJavaPersistentType().attributes().next();
- EclipseLinkVersionMapping versionMapping = (EclipseLinkVersionMapping) persistentAttribute.getSpecifiedMapping();
- Mutable mutable = versionMapping.getMutable();
- assertEquals(Boolean.TRUE, mutable.getSpecifiedMutable());
-
- JavaResourcePersistentType typeResource = getJpaProject().getJavaResourcePersistentType(FULLY_QUALIFIED_TYPE_NAME);
- JavaResourcePersistentAttribute attributeResource = typeResource.persistableAttributes().next();
- MutableAnnotation mutableAnnotation = (MutableAnnotation) attributeResource.getSupportingAnnotation(MutableAnnotation.ANNOTATION_NAME);
- assertEquals(null, mutableAnnotation.getValue());
-
- mutable.setSpecifiedMutable(Boolean.TRUE);
- assertEquals(null, mutableAnnotation.getValue());
-
- mutable.setSpecifiedMutable(null);
- mutableAnnotation = (MutableAnnotation) attributeResource.getSupportingAnnotation(MutableAnnotation.ANNOTATION_NAME);
- assertEquals(null, mutableAnnotation);
-
- mutable.setSpecifiedMutable(Boolean.FALSE);
- mutableAnnotation = (MutableAnnotation) attributeResource.getSupportingAnnotation(MutableAnnotation.ANNOTATION_NAME);
- assertEquals(Boolean.FALSE, mutableAnnotation.getValue());
-
- mutable.setSpecifiedMutable(Boolean.TRUE);
- assertEquals(null, mutableAnnotation.getValue());
- }
-
- public void testIsDefaultMutable() throws Exception {
- createTestEntityWithMutableVersion();
- addXmlClassRef(FULLY_QUALIFIED_TYPE_NAME);
-
- PersistentAttribute persistentAttribute = getJavaPersistentType().attributes().next();
- EclipseLinkVersionMapping versionMapping = (EclipseLinkVersionMapping) persistentAttribute.getSpecifiedMapping();
- Mutable mutable = versionMapping.getMutable();
- assertTrue(mutable.isDefaultMutable());
-
- JavaResourcePersistentType typeResource = getJpaProject().getJavaResourcePersistentType(FULLY_QUALIFIED_TYPE_NAME);
- JavaResourcePersistentAttribute attributeResource = typeResource.persistableAttributes().next();
- attributeResource.removeSupportingAnnotation(MutableAnnotation.ANNOTATION_NAME);
- assertTrue(mutable.isDefaultMutable());
-
- mutable.setSpecifiedMutable(Boolean.FALSE);
- assertTrue(mutable.isDefaultMutable());
-
- //set mutable default to false in the persistence unit properties, verify default in java still true since this is not a Date/Calendar
- (getPersistenceUnit()).getOptions().setTemporalMutable(Boolean.FALSE);
- assertTrue(mutable.isDefaultMutable());
- }
-
- public void testIsDefaultMutableForDate() throws Exception {
- createTestEntityWithMutableVersionDate();
- addXmlClassRef(FULLY_QUALIFIED_TYPE_NAME);
-
- PersistentAttribute persistentAttribute = getJavaPersistentType().attributes().next();
- EclipseLinkVersionMapping versionMapping = (EclipseLinkVersionMapping) persistentAttribute.getSpecifiedMapping();
- Mutable mutable = versionMapping.getMutable();
- assertFalse(mutable.isDefaultMutable());
-
- JavaResourcePersistentType typeResource = getJpaProject().getJavaResourcePersistentType(FULLY_QUALIFIED_TYPE_NAME);
- JavaResourcePersistentAttribute attributeResource = typeResource.persistableAttributes().next();
- attributeResource.removeSupportingAnnotation(MutableAnnotation.ANNOTATION_NAME);
- assertFalse(mutable.isDefaultMutable());
-
- mutable.setSpecifiedMutable(Boolean.TRUE);
- assertFalse(mutable.isDefaultMutable());
-
- //set mutable default to false in the persistence unit properties, verify default in java still true since this is not a Date/Calendar
- (getPersistenceUnit()).getOptions().setTemporalMutable(Boolean.TRUE);
- assertTrue(mutable.isDefaultMutable());
-
- (getPersistenceUnit()).getOptions().setTemporalMutable(Boolean.FALSE);
- assertFalse(mutable.isDefaultMutable());
-
- (getPersistenceUnit()).getOptions().setTemporalMutable(null);
- assertFalse(mutable.isDefaultMutable());
- }
-
- public void testIsMutable() throws Exception {
- createTestEntityWithMutableVersion();
- addXmlClassRef(FULLY_QUALIFIED_TYPE_NAME);
-
- PersistentAttribute persistentAttribute = getJavaPersistentType().attributes().next();
- EclipseLinkVersionMapping versionMapping = (EclipseLinkVersionMapping) persistentAttribute.getSpecifiedMapping();
- Mutable mutable = versionMapping.getMutable();
- assertTrue(mutable.isMutable());
-
- JavaResourcePersistentType typeResource = getJpaProject().getJavaResourcePersistentType(FULLY_QUALIFIED_TYPE_NAME);
- JavaResourcePersistentAttribute attributeResource = typeResource.persistableAttributes().next();
- attributeResource.removeSupportingAnnotation(MutableAnnotation.ANNOTATION_NAME);
- assertTrue(mutable.isMutable());
-
- mutable.setSpecifiedMutable(Boolean.TRUE);
- assertTrue(mutable.isMutable());
- }
-}
diff --git a/jpa/tests/org.eclipse.jpt.eclipselink.core.tests/src/org/eclipse/jpt/eclipselink/core/tests/internal/context/java/JptEclipseLinkCoreJavaContextModelTests.java b/jpa/tests/org.eclipse.jpt.eclipselink.core.tests/src/org/eclipse/jpt/eclipselink/core/tests/internal/context/java/JptEclipseLinkCoreJavaContextModelTests.java
deleted file mode 100644
index de9d15f97b..0000000000
--- a/jpa/tests/org.eclipse.jpt.eclipselink.core.tests/src/org/eclipse/jpt/eclipselink/core/tests/internal/context/java/JptEclipseLinkCoreJavaContextModelTests.java
+++ /dev/null
@@ -1,48 +0,0 @@
-/*******************************************************************************
- * Copyright (c) 2008, 2009 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
- *
- * Contributors:
- * Oracle - initial API and implementation
- *******************************************************************************/
-package org.eclipse.jpt.eclipselink.core.tests.internal.context.java;
-
-import junit.framework.Test;
-import junit.framework.TestCase;
-import junit.framework.TestSuite;
-
-public class JptEclipseLinkCoreJavaContextModelTests extends TestCase
-{
- public static Test suite() {
- return suite(true);
- }
-
- public static Test suite(boolean all) {
- TestSuite suite = new TestSuite(JptEclipseLinkCoreJavaContextModelTests.class.getName());
- suite.addTestSuite(EclipseLinkJavaBasicMappingTests.class);
- suite.addTestSuite(EclipseLinkJavaCachingTests.class);
- suite.addTestSuite(EclipseLinkJavaConvertTests.class);
- suite.addTestSuite(EclipseLinkJavaConverterTests.class);
- suite.addTestSuite(EclipseLinkJavaEmbeddableTests.class);
- suite.addTestSuite(EclipseLinkJavaEntityTests.class);
- suite.addTestSuite(EclipseLinkJavaIdMappingTests.class);
- suite.addTestSuite(EclipseLinkJavaMappedSuperclassTests.class);
- suite.addTestSuite(EclipseLinkJavaObjectTypeConverterTests.class);
- suite.addTestSuite(EclipseLinkJavaOneToManyMappingTests.class);
- suite.addTestSuite(EclipseLinkJavaOneToOneMappingTests.class);
- suite.addTestSuite(EclipseLinkJavaManyToManyMappingTests.class);
- suite.addTestSuite(EclipseLinkJavaManyToOneMappingTests.class);
- suite.addTestSuite(EclipseLinkJavaStructConverterTests.class);
- suite.addTestSuite(EclipseLinkJavaTypeConverterTests.class);
- suite.addTestSuite(EclipseLinkJavaVersionMappingTests.class);
- return suite;
- }
-
- private JptEclipseLinkCoreJavaContextModelTests() {
- super();
- throw new UnsupportedOperationException();
- }
-}
diff --git a/jpa/tests/org.eclipse.jpt.eclipselink.core.tests/src/org/eclipse/jpt/eclipselink/core/tests/internal/context/orm/EclipseLinkEntityMappingsTests.java b/jpa/tests/org.eclipse.jpt.eclipselink.core.tests/src/org/eclipse/jpt/eclipselink/core/tests/internal/context/orm/EclipseLinkEntityMappingsTests.java
deleted file mode 100644
index fa686b131b..0000000000
--- a/jpa/tests/org.eclipse.jpt.eclipselink.core.tests/src/org/eclipse/jpt/eclipselink/core/tests/internal/context/orm/EclipseLinkEntityMappingsTests.java
+++ /dev/null
@@ -1,675 +0,0 @@
-/*******************************************************************************
- * Copyright (c) 2008, 2009 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.
- *
- * Contributors:
- * Oracle - initial API and implementation
- *******************************************************************************/
-package org.eclipse.jpt.eclipselink.core.tests.internal.context.orm;
-
-import java.util.ListIterator;
-import org.eclipse.jpt.eclipselink.core.context.CustomConverter;
-import org.eclipse.jpt.eclipselink.core.context.ObjectTypeConverter;
-import org.eclipse.jpt.eclipselink.core.context.StructConverter;
-import org.eclipse.jpt.eclipselink.core.context.TypeConverter;
-import org.eclipse.jpt.eclipselink.core.internal.context.orm.ConverterHolder;
-import org.eclipse.jpt.eclipselink.core.internal.context.orm.EclipseLinkEntityMappings;
-import org.eclipse.jpt.eclipselink.core.internal.context.persistence.EclipseLinkPersistenceUnit;
-import org.eclipse.jpt.eclipselink.core.resource.orm.EclipseLinkOrmFactory;
-import org.eclipse.jpt.eclipselink.core.resource.orm.XmlConverter;
-import org.eclipse.jpt.eclipselink.core.resource.orm.XmlEntityMappings;
-import org.eclipse.jpt.eclipselink.core.resource.orm.XmlObjectTypeConverter;
-import org.eclipse.jpt.eclipselink.core.resource.orm.XmlStructConverter;
-import org.eclipse.jpt.eclipselink.core.resource.orm.XmlTypeConverter;
-import org.eclipse.jpt.utility.internal.CollectionTools;
-
-@SuppressWarnings("nls")
-public class EclipseLinkEntityMappingsTests extends EclipseLinkOrmContextModelTestCase
-{
- public EclipseLinkEntityMappingsTests(String name) {
- super(name);
- }
-
-
- public void testUpdateCustomConverters() throws Exception {
- XmlEntityMappings resourceEntityMappings = getXmlEntityMappings();
- EclipseLinkPersistenceUnit persistenceUnit = getPersistenceUnit();
- EclipseLinkEntityMappings contextEntityMappings = getEntityMappings();
- ConverterHolder ormContextConverterHolder = contextEntityMappings.getConverterHolder();
-
- assertEquals(0, ormContextConverterHolder.customConvertersSize());
- assertEquals(0, resourceEntityMappings.getConverters().size());
- assertEquals(0, CollectionTools.size(persistenceUnit.allConverters()));
-
- //add a converter to the resource model, check context model
- XmlConverter resourceConverter = EclipseLinkOrmFactory.eINSTANCE.createXmlConverter();
- resourceEntityMappings.getConverters().add(resourceConverter);
- resourceConverter.setClassName("Foo");
- resourceConverter.setName("myConverter");
-
- assertEquals(1, ormContextConverterHolder.customConvertersSize());
- ListIterator<CustomConverter> ormContextConverters = ormContextConverterHolder.customConverters();
- CustomConverter ormContextConverter = ormContextConverters.next();
- assertEquals("Foo", ormContextConverter.getConverterClass());
- assertEquals("myConverter", ormContextConverter.getName());
- assertEquals(1, resourceEntityMappings.getConverters().size());
- assertEquals(1, CollectionTools.size(persistenceUnit.allConverters()));
-
- //add another converter to the resource model, check context model
- XmlConverter resourceConverter2 = EclipseLinkOrmFactory.eINSTANCE.createXmlConverter();
- resourceEntityMappings.getConverters().add(0, resourceConverter2);
- resourceConverter2.setClassName("Foo2");
- resourceConverter2.setName("myConverter2");
-
- assertEquals(2, ormContextConverterHolder.customConvertersSize());
- ormContextConverters = ormContextConverterHolder.customConverters();
- ormContextConverter = ormContextConverters.next();
- assertEquals("Foo2", ormContextConverter.getConverterClass());
- assertEquals("myConverter2", ormContextConverter.getName());
- ormContextConverter = ormContextConverters.next();
- assertEquals("Foo", ormContextConverter.getConverterClass());
- assertEquals("myConverter", ormContextConverter.getName());
- assertEquals(2, resourceEntityMappings.getConverters().size());
- assertEquals(2, CollectionTools.size(persistenceUnit.allConverters()));
-
- //move a converter in the resource model, check context model
- resourceEntityMappings.getConverters().move(0, 1);
-
- assertEquals(2, ormContextConverterHolder.customConvertersSize());
- ormContextConverters = ormContextConverterHolder.customConverters();
- ormContextConverter = ormContextConverters.next();
- assertEquals("Foo", ormContextConverter.getConverterClass());
- assertEquals("myConverter", ormContextConverter.getName());
- ormContextConverter = ormContextConverters.next();
- assertEquals("Foo2", ormContextConverter.getConverterClass());
- assertEquals("myConverter2", ormContextConverter.getName());
- assertEquals(2, resourceEntityMappings.getConverters().size());
- assertEquals(2, CollectionTools.size(persistenceUnit.allConverters()));
-
- //remove a converter from the resource model, check context model
- resourceEntityMappings.getConverters().remove(0);
-
- assertEquals(1, ormContextConverterHolder.customConvertersSize());
- ormContextConverters = ormContextConverterHolder.customConverters();
- ormContextConverter = ormContextConverters.next();
- assertEquals("Foo2", ormContextConverter.getConverterClass());
- assertEquals("myConverter2", ormContextConverter.getName());
- assertEquals(1, resourceEntityMappings.getConverters().size());
- assertEquals(1, CollectionTools.size(persistenceUnit.allConverters()));
-
- //remove a converter from the resource model, check context model
- resourceEntityMappings.getConverters().remove(resourceConverter2);
-
- assertEquals(0, ormContextConverterHolder.customConvertersSize());
- assertFalse(ormContextConverterHolder.customConverters().hasNext());
- assertEquals(0, resourceEntityMappings.getConverters().size());
- assertEquals(0, CollectionTools.size(persistenceUnit.allConverters()));
- }
-
- public void testModifyCustomConverters() throws Exception {
- XmlEntityMappings resourceEntityMappings = getXmlEntityMappings();
- EclipseLinkPersistenceUnit persistenceUnit = getPersistenceUnit();
- EclipseLinkEntityMappings contextEntityMappings = getEntityMappings();
- ConverterHolder ormContextConverterHolder = contextEntityMappings.getConverterHolder();
-
- assertEquals(0, ormContextConverterHolder.customConvertersSize());
- assertEquals(0, resourceEntityMappings.getConverters().size());
- assertEquals(0, CollectionTools.size(persistenceUnit.allConverters()));
-
- //add a converter to the context model, check resource model
- CustomConverter contextConverter = ormContextConverterHolder.addCustomConverter(0);
- contextConverter.setConverterClass("Foo");
- contextConverter.setName("myConverter");
-
- assertEquals(1, resourceEntityMappings.getConverters().size());
- assertEquals("Foo", resourceEntityMappings.getConverters().get(0).getClassName());
- assertEquals("myConverter", resourceEntityMappings.getConverters().get(0).getName());
- assertEquals(1, ormContextConverterHolder.customConvertersSize());
- ListIterator<CustomConverter> ormContextConverters = ormContextConverterHolder.customConverters();
- CustomConverter ormContextConverter = ormContextConverters.next();
- assertEquals("Foo", ormContextConverter.getConverterClass());
- assertEquals("myConverter", ormContextConverter.getName());
- assertEquals(1, CollectionTools.size(persistenceUnit.allConverters()));
-
- //add another converter to the context model, check resource model
- CustomConverter contextConverter2 = ormContextConverterHolder.addCustomConverter(0);
- contextConverter2.setConverterClass("Foo2");
- contextConverter2.setName("myConverter2");
-
- assertEquals(2, resourceEntityMappings.getConverters().size());
- assertEquals("Foo2", resourceEntityMappings.getConverters().get(0).getClassName());
- assertEquals("myConverter2", resourceEntityMappings.getConverters().get(0).getName());
- assertEquals("Foo", resourceEntityMappings.getConverters().get(1).getClassName());
- assertEquals("myConverter", resourceEntityMappings.getConverters().get(1).getName());
- assertEquals(2, ormContextConverterHolder.customConvertersSize());
- ormContextConverters = ormContextConverterHolder.customConverters();
- ormContextConverter = ormContextConverters.next();
- assertEquals("Foo2", ormContextConverter.getConverterClass());
- assertEquals("myConverter2", ormContextConverter.getName());
- ormContextConverter = ormContextConverters.next();
- assertEquals("Foo", ormContextConverter.getConverterClass());
- assertEquals("myConverter", ormContextConverter.getName());
- assertEquals(2, CollectionTools.size(persistenceUnit.allConverters()));
-
- //move a converter in the context model, check resource model
- ormContextConverterHolder.moveCustomConverter(0, 1);
-
- assertEquals(2, resourceEntityMappings.getConverters().size());
- assertEquals("Foo", resourceEntityMappings.getConverters().get(0).getClassName());
- assertEquals("myConverter", resourceEntityMappings.getConverters().get(0).getName());
- assertEquals("Foo2", resourceEntityMappings.getConverters().get(1).getClassName());
- assertEquals("myConverter2", resourceEntityMappings.getConverters().get(1).getName());
- assertEquals(2, ormContextConverterHolder.customConvertersSize());
- ormContextConverters = ormContextConverterHolder.customConverters();
- ormContextConverter = ormContextConverters.next();
- assertEquals("Foo", ormContextConverter.getConverterClass());
- assertEquals("myConverter", ormContextConverter.getName());
- ormContextConverter = ormContextConverters.next();
- assertEquals("Foo2", ormContextConverter.getConverterClass());
- assertEquals("myConverter2", ormContextConverter.getName());
- assertEquals(2, CollectionTools.size(persistenceUnit.allConverters()));
-
- //remove a converter from the context model, check resource model
- ormContextConverterHolder.removeCustomConverter(0);
-
- assertEquals(1, resourceEntityMappings.getConverters().size());
- assertEquals("Foo2", resourceEntityMappings.getConverters().get(0).getClassName());
- assertEquals("myConverter2", resourceEntityMappings.getConverters().get(0).getName());
- assertEquals(1, ormContextConverterHolder.customConvertersSize());
- ormContextConverters = ormContextConverterHolder.customConverters();
- ormContextConverter = ormContextConverters.next();
- assertEquals("Foo2", ormContextConverter.getConverterClass());
- assertEquals("myConverter2", ormContextConverter.getName());
- assertEquals(1, CollectionTools.size(persistenceUnit.allConverters()));
-
- //remove a converter from the context model, check resource model
- ormContextConverterHolder.removeCustomConverter(contextConverter2);
-
- assertEquals(0, ormContextConverterHolder.customConvertersSize());
- assertFalse(ormContextConverterHolder.customConverters().hasNext());
- assertEquals(0, resourceEntityMappings.getConverters().size());
- assertEquals(0, CollectionTools.size(persistenceUnit.allConverters()));
- }
-
- public void testUpdateTypeConverters() throws Exception {
- XmlEntityMappings resourceEntityMappings = getXmlEntityMappings();
- EclipseLinkPersistenceUnit persistenceUnit = getPersistenceUnit();
- EclipseLinkEntityMappings contextEntityMappings = getEntityMappings();
- ConverterHolder ormContextConverterHolder = contextEntityMappings.getConverterHolder();
-
- assertEquals(0, ormContextConverterHolder.typeConvertersSize());
- assertEquals(0, resourceEntityMappings.getTypeConverters().size());
- assertEquals(0, CollectionTools.size(persistenceUnit.allConverters()));
-
- //add a converter to the resource model, check context model
- XmlTypeConverter resourceTypeConverter = EclipseLinkOrmFactory.eINSTANCE.createXmlTypeConverter();
- resourceEntityMappings.getTypeConverters().add(resourceTypeConverter);
- resourceTypeConverter.setDataType("Foo");
- resourceTypeConverter.setName("myTypeConverter");
-
- assertEquals(1, ormContextConverterHolder.typeConvertersSize());
- ListIterator<TypeConverter> ormContextTypeConverters = ormContextConverterHolder.typeConverters();
- TypeConverter ormContextTypeConverter = ormContextTypeConverters.next();
- assertEquals("Foo", ormContextTypeConverter.getDataType());
- assertEquals("myTypeConverter", ormContextTypeConverter.getName());
- assertEquals(1, resourceEntityMappings.getTypeConverters().size());
- assertEquals(1, CollectionTools.size(persistenceUnit.allConverters()));
-
- //add another converter to the resource model, check context model
- XmlTypeConverter resourceTypeConverter2 = EclipseLinkOrmFactory.eINSTANCE.createXmlTypeConverter();
- resourceEntityMappings.getTypeConverters().add(0, resourceTypeConverter2);
- resourceTypeConverter2.setDataType("Foo2");
- resourceTypeConverter2.setName("myTypeConverter2");
-
- assertEquals(2, ormContextConverterHolder.typeConvertersSize());
- ormContextTypeConverters = ormContextConverterHolder.typeConverters();
- ormContextTypeConverter = ormContextTypeConverters.next();
- assertEquals("Foo2", ormContextTypeConverter.getDataType());
- assertEquals("myTypeConverter2", ormContextTypeConverter.getName());
- ormContextTypeConverter = ormContextTypeConverters.next();
- assertEquals("Foo", ormContextTypeConverter.getDataType());
- assertEquals("myTypeConverter", ormContextTypeConverter.getName());
- assertEquals(2, resourceEntityMappings.getTypeConverters().size());
- assertEquals(2, CollectionTools.size(persistenceUnit.allConverters()));
-
- //move a converter in the resource model, check context model
- resourceEntityMappings.getTypeConverters().move(0, 1);
-
- assertEquals(2, ormContextConverterHolder.typeConvertersSize());
- ormContextTypeConverters = ormContextConverterHolder.typeConverters();
- ormContextTypeConverter = ormContextTypeConverters.next();
- assertEquals("Foo", ormContextTypeConverter.getDataType());
- assertEquals("myTypeConverter", ormContextTypeConverter.getName());
- ormContextTypeConverter = ormContextTypeConverters.next();
- assertEquals("Foo2", ormContextTypeConverter.getDataType());
- assertEquals("myTypeConverter2", ormContextTypeConverter.getName());
- assertEquals(2, resourceEntityMappings.getTypeConverters().size());
- assertEquals(2, CollectionTools.size(persistenceUnit.allConverters()));
-
- //remove a converter from the resource model, check context model
- resourceEntityMappings.getTypeConverters().remove(0);
-
- assertEquals(1, ormContextConverterHolder.typeConvertersSize());
- ormContextTypeConverters = ormContextConverterHolder.typeConverters();
- ormContextTypeConverter = ormContextTypeConverters.next();
- assertEquals("Foo2", ormContextTypeConverter.getDataType());
- assertEquals("myTypeConverter2", ormContextTypeConverter.getName());
- assertEquals(1, resourceEntityMappings.getTypeConverters().size());
- assertEquals(1, CollectionTools.size(persistenceUnit.allConverters()));
-
- //remove a converter from the resource model, check context model
- resourceEntityMappings.getTypeConverters().remove(resourceTypeConverter2);
-
- assertEquals(0, ormContextConverterHolder.typeConvertersSize());
- assertFalse(ormContextConverterHolder.typeConverters().hasNext());
- assertEquals(0, resourceEntityMappings.getTypeConverters().size());
- assertEquals(0, CollectionTools.size(persistenceUnit.allConverters()));
- }
-
- public void testModifyTypeConverters() throws Exception {
- XmlEntityMappings resourceEntityMappings = getXmlEntityMappings();
- EclipseLinkPersistenceUnit persistenceUnit = getPersistenceUnit();
- EclipseLinkEntityMappings contextEntityMappings = getEntityMappings();
- ConverterHolder ormContextConverterHolder = contextEntityMappings.getConverterHolder();
-
- assertEquals(0, ormContextConverterHolder.typeConvertersSize());
- assertEquals(0, resourceEntityMappings.getTypeConverters().size());
- assertEquals(0, CollectionTools.size(persistenceUnit.allConverters()));
-
- //add a converter to the context model, check resource model
- TypeConverter contextTypeConverter = ormContextConverterHolder.addTypeConverter(0);
- contextTypeConverter.setDataType("Foo");
- contextTypeConverter.setName("myTypeConverter");
-
- assertEquals(1, resourceEntityMappings.getTypeConverters().size());
- assertEquals("Foo", resourceEntityMappings.getTypeConverters().get(0).getDataType());
- assertEquals("myTypeConverter", resourceEntityMappings.getTypeConverters().get(0).getName());
- assertEquals(1, ormContextConverterHolder.typeConvertersSize());
- ListIterator<TypeConverter> ormContextTypeConverters = ormContextConverterHolder.typeConverters();
- TypeConverter ormContextTypeConverter = ormContextTypeConverters.next();
- assertEquals("Foo", ormContextTypeConverter.getDataType());
- assertEquals("myTypeConverter", ormContextTypeConverter.getName());
- assertEquals(1, CollectionTools.size(persistenceUnit.allConverters()));
-
- //add another converter to the context model, check resource model
- TypeConverter contextTypeConverter2 = ormContextConverterHolder.addTypeConverter(0);
- contextTypeConverter2.setDataType("Foo2");
- contextTypeConverter2.setName("myTypeConverter2");
-
- assertEquals(2, resourceEntityMappings.getTypeConverters().size());
- assertEquals("Foo2", resourceEntityMappings.getTypeConverters().get(0).getDataType());
- assertEquals("myTypeConverter2", resourceEntityMappings.getTypeConverters().get(0).getName());
- assertEquals("Foo", resourceEntityMappings.getTypeConverters().get(1).getDataType());
- assertEquals("myTypeConverter", resourceEntityMappings.getTypeConverters().get(1).getName());
- assertEquals(2, ormContextConverterHolder.typeConvertersSize());
- ormContextTypeConverters = ormContextConverterHolder.typeConverters();
- ormContextTypeConverter = ormContextTypeConverters.next();
- assertEquals("Foo2", ormContextTypeConverter.getDataType());
- assertEquals("myTypeConverter2", ormContextTypeConverter.getName());
- ormContextTypeConverter = ormContextTypeConverters.next();
- assertEquals("Foo", ormContextTypeConverter.getDataType());
- assertEquals("myTypeConverter", ormContextTypeConverter.getName());
- assertEquals(2, CollectionTools.size(persistenceUnit.allConverters()));
-
- //move a converter in the context model, check resource model
- ormContextConverterHolder.moveTypeConverter(0, 1);
-
- assertEquals(2, resourceEntityMappings.getTypeConverters().size());
- assertEquals("Foo", resourceEntityMappings.getTypeConverters().get(0).getDataType());
- assertEquals("myTypeConverter", resourceEntityMappings.getTypeConverters().get(0).getName());
- assertEquals("Foo2", resourceEntityMappings.getTypeConverters().get(1).getDataType());
- assertEquals("myTypeConverter2", resourceEntityMappings.getTypeConverters().get(1).getName());
- assertEquals(2, ormContextConverterHolder.typeConvertersSize());
- ormContextTypeConverters = ormContextConverterHolder.typeConverters();
- ormContextTypeConverter = ormContextTypeConverters.next();
- assertEquals("Foo", ormContextTypeConverter.getDataType());
- assertEquals("myTypeConverter", ormContextTypeConverter.getName());
- ormContextTypeConverter = ormContextTypeConverters.next();
- assertEquals("Foo2", ormContextTypeConverter.getDataType());
- assertEquals("myTypeConverter2", ormContextTypeConverter.getName());
- assertEquals(2, CollectionTools.size(persistenceUnit.allConverters()));
-
- //remove a converter from the context model, check resource model
- ormContextConverterHolder.removeTypeConverter(0);
-
- assertEquals(1, resourceEntityMappings.getTypeConverters().size());
- assertEquals("Foo2", resourceEntityMappings.getTypeConverters().get(0).getDataType());
- assertEquals("myTypeConverter2", resourceEntityMappings.getTypeConverters().get(0).getName());
- assertEquals(1, ormContextConverterHolder.typeConvertersSize());
- ormContextTypeConverters = ormContextConverterHolder.typeConverters();
- ormContextTypeConverter = ormContextTypeConverters.next();
- assertEquals("Foo2", ormContextTypeConverter.getDataType());
- assertEquals("myTypeConverter2", ormContextTypeConverter.getName());
- assertEquals(1, CollectionTools.size(persistenceUnit.allConverters()));
-
- //remove a converter from the context model, check resource model
- ormContextConverterHolder.removeTypeConverter(contextTypeConverter2);
-
- assertEquals(0, ormContextConverterHolder.typeConvertersSize());
- assertFalse(ormContextConverterHolder.typeConverters().hasNext());
- assertEquals(0, resourceEntityMappings.getTypeConverters().size());
- assertEquals(0, CollectionTools.size(persistenceUnit.allConverters()));
- }
-
- public void testUpdateObjectTypeConverters() throws Exception {
- XmlEntityMappings resourceEntityMappings = getXmlEntityMappings();
- EclipseLinkPersistenceUnit persistenceUnit = getPersistenceUnit();
- EclipseLinkEntityMappings contextEntityMappings = getEntityMappings();
- ConverterHolder ormContextConverterHolder = contextEntityMappings.getConverterHolder();
-
- assertEquals(0, ormContextConverterHolder.objectTypeConvertersSize());
- assertEquals(0, resourceEntityMappings.getObjectTypeConverters().size());
- assertEquals(0, CollectionTools.size(persistenceUnit.allConverters()));
-
- //add a converter to the resource model, check context model
- XmlObjectTypeConverter resourceObjectTypeConverter = EclipseLinkOrmFactory.eINSTANCE.createXmlObjectTypeConverter();
- resourceEntityMappings.getObjectTypeConverters().add(resourceObjectTypeConverter);
- resourceObjectTypeConverter.setDataType("Foo");
- resourceObjectTypeConverter.setName("myObjectTypeConverter");
-
- assertEquals(1, ormContextConverterHolder.objectTypeConvertersSize());
- ListIterator<ObjectTypeConverter> ormContextObjectTypeConverters = ormContextConverterHolder.objectTypeConverters();
- ObjectTypeConverter ormContextObjectTypeConverter = ormContextObjectTypeConverters.next();
- assertEquals("Foo", ormContextObjectTypeConverter.getDataType());
- assertEquals("myObjectTypeConverter", ormContextObjectTypeConverter.getName());
- assertEquals(1, resourceEntityMappings.getObjectTypeConverters().size());
- assertEquals(1, CollectionTools.size(persistenceUnit.allConverters()));
-
- //add another converter to the resource model, check context model
- XmlObjectTypeConverter resourceObjectTypeConverter2 = EclipseLinkOrmFactory.eINSTANCE.createXmlObjectTypeConverter();
- resourceEntityMappings.getObjectTypeConverters().add(0, resourceObjectTypeConverter2);
- resourceObjectTypeConverter2.setDataType("Foo2");
- resourceObjectTypeConverter2.setName("myObjectTypeConverter2");
-
- assertEquals(2, ormContextConverterHolder.objectTypeConvertersSize());
- ormContextObjectTypeConverters = ormContextConverterHolder.objectTypeConverters();
- ormContextObjectTypeConverter = ormContextObjectTypeConverters.next();
- assertEquals("Foo2", ormContextObjectTypeConverter.getDataType());
- assertEquals("myObjectTypeConverter2", ormContextObjectTypeConverter.getName());
- ormContextObjectTypeConverter = ormContextObjectTypeConverters.next();
- assertEquals("Foo", ormContextObjectTypeConverter.getDataType());
- assertEquals("myObjectTypeConverter", ormContextObjectTypeConverter.getName());
- assertEquals(2, resourceEntityMappings.getObjectTypeConverters().size());
- assertEquals(2, CollectionTools.size(persistenceUnit.allConverters()));
-
- //move a converter in the resource model, check context model
- resourceEntityMappings.getObjectTypeConverters().move(0, 1);
-
- assertEquals(2, ormContextConverterHolder.objectTypeConvertersSize());
- ormContextObjectTypeConverters = ormContextConverterHolder.objectTypeConverters();
- ormContextObjectTypeConverter = ormContextObjectTypeConverters.next();
- assertEquals("Foo", ormContextObjectTypeConverter.getDataType());
- assertEquals("myObjectTypeConverter", ormContextObjectTypeConverter.getName());
- ormContextObjectTypeConverter = ormContextObjectTypeConverters.next();
- assertEquals("Foo2", ormContextObjectTypeConverter.getDataType());
- assertEquals("myObjectTypeConverter2", ormContextObjectTypeConverter.getName());
- assertEquals(2, resourceEntityMappings.getObjectTypeConverters().size());
- assertEquals(2, CollectionTools.size(persistenceUnit.allConverters()));
-
- //remove a converter from the resource model, check context model
- resourceEntityMappings.getObjectTypeConverters().remove(0);
-
- assertEquals(1, ormContextConverterHolder.objectTypeConvertersSize());
- ormContextObjectTypeConverters = ormContextConverterHolder.objectTypeConverters();
- ormContextObjectTypeConverter = ormContextObjectTypeConverters.next();
- assertEquals("Foo2", ormContextObjectTypeConverter.getDataType());
- assertEquals("myObjectTypeConverter2", ormContextObjectTypeConverter.getName());
- assertEquals(1, resourceEntityMappings.getObjectTypeConverters().size());
- assertEquals(1, CollectionTools.size(persistenceUnit.allConverters()));
-
- //remove a converter from the resource model, check context model
- resourceEntityMappings.getObjectTypeConverters().remove(resourceObjectTypeConverter2);
-
- assertEquals(0, ormContextConverterHolder.objectTypeConvertersSize());
- assertFalse(ormContextConverterHolder.objectTypeConverters().hasNext());
- assertEquals(0, resourceEntityMappings.getObjectTypeConverters().size());
- assertEquals(0, CollectionTools.size(persistenceUnit.allConverters()));
- }
-
- public void testModifyObjectTypeConverters() throws Exception {
- XmlEntityMappings resourceEntityMappings = getXmlEntityMappings();
- EclipseLinkPersistenceUnit persistenceUnit = getPersistenceUnit();
- EclipseLinkEntityMappings contextEntityMappings = getEntityMappings();
- ConverterHolder ormContextConverterHolder = contextEntityMappings.getConverterHolder();
-
- assertEquals(0, ormContextConverterHolder.objectTypeConvertersSize());
- assertEquals(0, resourceEntityMappings.getObjectTypeConverters().size());
- assertEquals(0, CollectionTools.size(persistenceUnit.allConverters()));
-
- //add a converter to the context model, check resource model
- ObjectTypeConverter contextObjectTypeConverter = ormContextConverterHolder.addObjectTypeConverter(0);
- contextObjectTypeConverter.setDataType("Foo");
- contextObjectTypeConverter.setName("myObjectTypeConverter");
-
- assertEquals(1, resourceEntityMappings.getObjectTypeConverters().size());
- assertEquals("Foo", resourceEntityMappings.getObjectTypeConverters().get(0).getDataType());
- assertEquals("myObjectTypeConverter", resourceEntityMappings.getObjectTypeConverters().get(0).getName());
- assertEquals(1, ormContextConverterHolder.objectTypeConvertersSize());
- ListIterator<ObjectTypeConverter> ormContextObjectTypeConverters = ormContextConverterHolder.objectTypeConverters();
- ObjectTypeConverter ormContextObjectTypeConverter = ormContextObjectTypeConverters.next();
- assertEquals("Foo", ormContextObjectTypeConverter.getDataType());
- assertEquals("myObjectTypeConverter", ormContextObjectTypeConverter.getName());
- assertEquals(1, CollectionTools.size(persistenceUnit.allConverters()));
-
- //add another converter to the context model, check resource model
- ObjectTypeConverter contextObjectTypeConverter2 = ormContextConverterHolder.addObjectTypeConverter(0);
- contextObjectTypeConverter2.setDataType("Foo2");
- contextObjectTypeConverter2.setName("myObjectTypeConverter2");
-
- assertEquals(2, resourceEntityMappings.getObjectTypeConverters().size());
- assertEquals("Foo2", resourceEntityMappings.getObjectTypeConverters().get(0).getDataType());
- assertEquals("myObjectTypeConverter2", resourceEntityMappings.getObjectTypeConverters().get(0).getName());
- assertEquals("Foo", resourceEntityMappings.getObjectTypeConverters().get(1).getDataType());
- assertEquals("myObjectTypeConverter", resourceEntityMappings.getObjectTypeConverters().get(1).getName());
- assertEquals(2, ormContextConverterHolder.objectTypeConvertersSize());
- ormContextObjectTypeConverters = ormContextConverterHolder.objectTypeConverters();
- ormContextObjectTypeConverter = ormContextObjectTypeConverters.next();
- assertEquals("Foo2", ormContextObjectTypeConverter.getDataType());
- assertEquals("myObjectTypeConverter2", ormContextObjectTypeConverter.getName());
- ormContextObjectTypeConverter = ormContextObjectTypeConverters.next();
- assertEquals("Foo", ormContextObjectTypeConverter.getDataType());
- assertEquals("myObjectTypeConverter", ormContextObjectTypeConverter.getName());
- assertEquals(2, CollectionTools.size(persistenceUnit.allConverters()));
-
- //move a converter in the context model, check resource model
- ormContextConverterHolder.moveObjectTypeConverter(0, 1);
-
- assertEquals(2, resourceEntityMappings.getObjectTypeConverters().size());
- assertEquals("Foo", resourceEntityMappings.getObjectTypeConverters().get(0).getDataType());
- assertEquals("myObjectTypeConverter", resourceEntityMappings.getObjectTypeConverters().get(0).getName());
- assertEquals("Foo2", resourceEntityMappings.getObjectTypeConverters().get(1).getDataType());
- assertEquals("myObjectTypeConverter2", resourceEntityMappings.getObjectTypeConverters().get(1).getName());
- assertEquals(2, ormContextConverterHolder.objectTypeConvertersSize());
- ormContextObjectTypeConverters = ormContextConverterHolder.objectTypeConverters();
- ormContextObjectTypeConverter = ormContextObjectTypeConverters.next();
- assertEquals("Foo", ormContextObjectTypeConverter.getDataType());
- assertEquals("myObjectTypeConverter", ormContextObjectTypeConverter.getName());
- ormContextObjectTypeConverter = ormContextObjectTypeConverters.next();
- assertEquals("Foo2", ormContextObjectTypeConverter.getDataType());
- assertEquals("myObjectTypeConverter2", ormContextObjectTypeConverter.getName());
- assertEquals(2, CollectionTools.size(persistenceUnit.allConverters()));
-
- //remove a converter from the context model, check resource model
- ormContextConverterHolder.removeObjectTypeConverter(0);
-
- assertEquals(1, resourceEntityMappings.getObjectTypeConverters().size());
- assertEquals("Foo2", resourceEntityMappings.getObjectTypeConverters().get(0).getDataType());
- assertEquals("myObjectTypeConverter2", resourceEntityMappings.getObjectTypeConverters().get(0).getName());
- assertEquals(1, ormContextConverterHolder.objectTypeConvertersSize());
- ormContextObjectTypeConverters = ormContextConverterHolder.objectTypeConverters();
- ormContextObjectTypeConverter = ormContextObjectTypeConverters.next();
- assertEquals("Foo2", ormContextObjectTypeConverter.getDataType());
- assertEquals("myObjectTypeConverter2", ormContextObjectTypeConverter.getName());
- assertEquals(1, CollectionTools.size(persistenceUnit.allConverters()));
-
- //remove a converter from the context model, check resource model
- ormContextConverterHolder.removeObjectTypeConverter(contextObjectTypeConverter2);
-
- assertEquals(0, ormContextConverterHolder.objectTypeConvertersSize());
- assertFalse(ormContextConverterHolder.objectTypeConverters().hasNext());
- assertEquals(0, resourceEntityMappings.getObjectTypeConverters().size());
- assertEquals(0, CollectionTools.size(persistenceUnit.allConverters()));
- }
-
- public void testUpdateStructConverters() throws Exception {
- XmlEntityMappings resourceEntityMappings = getXmlEntityMappings();
- EclipseLinkPersistenceUnit persistenceUnit = getPersistenceUnit();
- EclipseLinkEntityMappings contextEntityMappings = getEntityMappings();
- ConverterHolder ormContextConverterHolder = contextEntityMappings.getConverterHolder();
-
- assertEquals(0, ormContextConverterHolder.structConvertersSize());
- assertEquals(0, resourceEntityMappings.getStructConverters().size());
- assertEquals(0, CollectionTools.size(persistenceUnit.allConverters()));
-
- //add a converter to the resource model, check context model
- XmlStructConverter resourceStructConverter = EclipseLinkOrmFactory.eINSTANCE.createXmlStructConverter();
- resourceEntityMappings.getStructConverters().add(resourceStructConverter);
- resourceStructConverter.setConverter("Foo");
- resourceStructConverter.setName("myStructConverter");
-
- assertEquals(1, ormContextConverterHolder.structConvertersSize());
- ListIterator<StructConverter> ormContextStructConverters = ormContextConverterHolder.structConverters();
- StructConverter ormContextStructConverter = ormContextStructConverters.next();
- assertEquals("Foo", ormContextStructConverter.getConverterClass());
- assertEquals("myStructConverter", ormContextStructConverter.getName());
- assertEquals(1, resourceEntityMappings.getStructConverters().size());
- assertEquals(1, CollectionTools.size(persistenceUnit.allConverters()));
-
- //add another converter to the resource model, check context model
- XmlStructConverter resourceStructConverter2 = EclipseLinkOrmFactory.eINSTANCE.createXmlStructConverter();
- resourceEntityMappings.getStructConverters().add(0, resourceStructConverter2);
- resourceStructConverter2.setConverter("Foo2");
- resourceStructConverter2.setName("myStructConverter2");
-
- assertEquals(2, ormContextConverterHolder.structConvertersSize());
- ormContextStructConverters = ormContextConverterHolder.structConverters();
- ormContextStructConverter = ormContextStructConverters.next();
- assertEquals("Foo2", ormContextStructConverter.getConverterClass());
- assertEquals("myStructConverter2", ormContextStructConverter.getName());
- ormContextStructConverter = ormContextStructConverters.next();
- assertEquals("Foo", ormContextStructConverter.getConverterClass());
- assertEquals("myStructConverter", ormContextStructConverter.getName());
- assertEquals(2, resourceEntityMappings.getStructConverters().size());
- assertEquals(2, CollectionTools.size(persistenceUnit.allConverters()));
-
- //move a converter in the resource model, check context model
- resourceEntityMappings.getStructConverters().move(0, 1);
-
- assertEquals(2, ormContextConverterHolder.structConvertersSize());
- ormContextStructConverters = ormContextConverterHolder.structConverters();
- ormContextStructConverter = ormContextStructConverters.next();
- assertEquals("Foo", ormContextStructConverter.getConverterClass());
- assertEquals("myStructConverter", ormContextStructConverter.getName());
- ormContextStructConverter = ormContextStructConverters.next();
- assertEquals("Foo2", ormContextStructConverter.getConverterClass());
- assertEquals("myStructConverter2", ormContextStructConverter.getName());
- assertEquals(2, resourceEntityMappings.getStructConverters().size());
- assertEquals(2, CollectionTools.size(persistenceUnit.allConverters()));
-
- //remove a converter from the resource model, check context model
- resourceEntityMappings.getStructConverters().remove(0);
-
- assertEquals(1, ormContextConverterHolder.structConvertersSize());
- ormContextStructConverters = ormContextConverterHolder.structConverters();
- ormContextStructConverter = ormContextStructConverters.next();
- assertEquals("Foo2", ormContextStructConverter.getConverterClass());
- assertEquals("myStructConverter2", ormContextStructConverter.getName());
- assertEquals(1, resourceEntityMappings.getStructConverters().size());
- assertEquals(1, CollectionTools.size(persistenceUnit.allConverters()));
-
- //remove a converter from the resource model, check context model
- resourceEntityMappings.getStructConverters().remove(resourceStructConverter2);
-
- assertEquals(0, ormContextConverterHolder.structConvertersSize());
- assertFalse(ormContextConverterHolder.structConverters().hasNext());
- assertEquals(0, resourceEntityMappings.getStructConverters().size());
- assertEquals(0, CollectionTools.size(persistenceUnit.allConverters()));
- }
-
- public void testModifyStructConverters() throws Exception {
- XmlEntityMappings resourceEntityMappings = getXmlEntityMappings();
- EclipseLinkPersistenceUnit persistenceUnit = getPersistenceUnit();
- EclipseLinkEntityMappings contextEntityMappings = getEntityMappings();
- ConverterHolder ormContextConverterHolder = contextEntityMappings.getConverterHolder();
-
- assertEquals(0, ormContextConverterHolder.structConvertersSize());
- assertEquals(0, resourceEntityMappings.getStructConverters().size());
- assertEquals(0, CollectionTools.size(persistenceUnit.allConverters()));
-
- //add a converter to the context model, check resource model
- StructConverter contextStructConverter = ormContextConverterHolder.addStructConverter(0);
- contextStructConverter.setConverterClass("Foo");
- contextStructConverter.setName("myStructConverter");
-
- assertEquals(1, resourceEntityMappings.getStructConverters().size());
- assertEquals("Foo", resourceEntityMappings.getStructConverters().get(0).getConverter());
- assertEquals("myStructConverter", resourceEntityMappings.getStructConverters().get(0).getName());
- assertEquals(1, ormContextConverterHolder.structConvertersSize());
- ListIterator<StructConverter> ormContextStructConverters = ormContextConverterHolder.structConverters();
- StructConverter ormContextStructConverter = ormContextStructConverters.next();
- assertEquals("Foo", ormContextStructConverter.getConverterClass());
- assertEquals("myStructConverter", ormContextStructConverter.getName());
- assertEquals(1, CollectionTools.size(persistenceUnit.allConverters()));
-
- //add another converter to the context model, check resource model
- StructConverter contextStructConverter2 = ormContextConverterHolder.addStructConverter(0);
- contextStructConverter2.setConverterClass("Foo2");
- contextStructConverter2.setName("myStructConverter2");
-
- assertEquals(2, resourceEntityMappings.getStructConverters().size());
- assertEquals("Foo2", resourceEntityMappings.getStructConverters().get(0).getConverter());
- assertEquals("myStructConverter2", resourceEntityMappings.getStructConverters().get(0).getName());
- assertEquals("Foo", resourceEntityMappings.getStructConverters().get(1).getConverter());
- assertEquals("myStructConverter", resourceEntityMappings.getStructConverters().get(1).getName());
- assertEquals(2, ormContextConverterHolder.structConvertersSize());
- ormContextStructConverters = ormContextConverterHolder.structConverters();
- ormContextStructConverter = ormContextStructConverters.next();
- assertEquals("Foo2", ormContextStructConverter.getConverterClass());
- assertEquals("myStructConverter2", ormContextStructConverter.getName());
- ormContextStructConverter = ormContextStructConverters.next();
- assertEquals("Foo", ormContextStructConverter.getConverterClass());
- assertEquals("myStructConverter", ormContextStructConverter.getName());
- assertEquals(2, CollectionTools.size(persistenceUnit.allConverters()));
-
- //move a converter in the context model, check resource model
- ormContextConverterHolder.moveStructConverter(0, 1);
-
- assertEquals(2, resourceEntityMappings.getStructConverters().size());
- assertEquals("Foo", resourceEntityMappings.getStructConverters().get(0).getConverter());
- assertEquals("myStructConverter", resourceEntityMappings.getStructConverters().get(0).getName());
- assertEquals("Foo2", resourceEntityMappings.getStructConverters().get(1).getConverter());
- assertEquals("myStructConverter2", resourceEntityMappings.getStructConverters().get(1).getName());
- assertEquals(2, ormContextConverterHolder.structConvertersSize());
- ormContextStructConverters = ormContextConverterHolder.structConverters();
- ormContextStructConverter = ormContextStructConverters.next();
- assertEquals("Foo", ormContextStructConverter.getConverterClass());
- assertEquals("myStructConverter", ormContextStructConverter.getName());
- ormContextStructConverter = ormContextStructConverters.next();
- assertEquals("Foo2", ormContextStructConverter.getConverterClass());
- assertEquals("myStructConverter2", ormContextStructConverter.getName());
- assertEquals(2, CollectionTools.size(persistenceUnit.allConverters()));
-
- //remove a converter from the context model, check resource model
- ormContextConverterHolder.removeStructConverter(0);
-
- assertEquals(1, resourceEntityMappings.getStructConverters().size());
- assertEquals("Foo2", resourceEntityMappings.getStructConverters().get(0).getConverter());
- assertEquals("myStructConverter2", resourceEntityMappings.getStructConverters().get(0).getName());
- assertEquals(1, ormContextConverterHolder.structConvertersSize());
- ormContextStructConverters = ormContextConverterHolder.structConverters();
- ormContextStructConverter = ormContextStructConverters.next();
- assertEquals("Foo2", ormContextStructConverter.getConverterClass());
- assertEquals("myStructConverter2", ormContextStructConverter.getName());
- assertEquals(1, CollectionTools.size(persistenceUnit.allConverters()));
-
- //remove a converter from the context model, check resource model
- ormContextConverterHolder.removeStructConverter(contextStructConverter2);
-
- assertEquals(0, ormContextConverterHolder.structConvertersSize());
- assertFalse(ormContextConverterHolder.structConverters().hasNext());
- assertEquals(0, resourceEntityMappings.getStructConverters().size());
- assertEquals(0, CollectionTools.size(persistenceUnit.allConverters()));
- }
-} \ No newline at end of file
diff --git a/jpa/tests/org.eclipse.jpt.eclipselink.core.tests/src/org/eclipse/jpt/eclipselink/core/tests/internal/context/orm/EclipseLinkOrmBasicMappingTests.java b/jpa/tests/org.eclipse.jpt.eclipselink.core.tests/src/org/eclipse/jpt/eclipselink/core/tests/internal/context/orm/EclipseLinkOrmBasicMappingTests.java
deleted file mode 100644
index 792a24fb61..0000000000
--- a/jpa/tests/org.eclipse.jpt.eclipselink.core.tests/src/org/eclipse/jpt/eclipselink/core/tests/internal/context/orm/EclipseLinkOrmBasicMappingTests.java
+++ /dev/null
@@ -1,389 +0,0 @@
-/*******************************************************************************
- * Copyright (c) 2008, 2009 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.
- *
- * Contributors:
- * Oracle - initial API and implementation
- *******************************************************************************/
-package org.eclipse.jpt.eclipselink.core.tests.internal.context.orm;
-
-import java.util.Iterator;
-import org.eclipse.jdt.core.ICompilationUnit;
-import org.eclipse.jpt.core.MappingKeys;
-import org.eclipse.jpt.core.context.Converter;
-import org.eclipse.jpt.core.context.java.JavaBasicMapping;
-import org.eclipse.jpt.core.context.orm.OrmBasicMapping;
-import org.eclipse.jpt.core.context.orm.OrmPersistentAttribute;
-import org.eclipse.jpt.core.context.orm.OrmPersistentType;
-import org.eclipse.jpt.core.resource.java.JPA;
-import org.eclipse.jpt.eclipselink.core.context.Convert;
-import org.eclipse.jpt.eclipselink.core.context.EclipseLinkBasicMapping;
-import org.eclipse.jpt.eclipselink.core.internal.context.orm.EclipseLinkOrmBasicMapping;
-import org.eclipse.jpt.eclipselink.core.resource.java.EclipseLinkJPA;
-import org.eclipse.jpt.eclipselink.core.resource.orm.XmlBasic;
-import org.eclipse.jpt.eclipselink.core.resource.orm.XmlEntity;
-import org.eclipse.jpt.utility.internal.iterators.ArrayIterator;
-
-@SuppressWarnings("nls")
-public class EclipseLinkOrmBasicMappingTests
- extends EclipseLinkOrmContextModelTestCase
-{
-
- private ICompilationUnit createTestEntityWithBasicMapping() throws Exception {
- return this.createTestType(new DefaultAnnotationWriter() {
- @Override
- public Iterator<String> imports() {
- return new ArrayIterator<String>(JPA.ENTITY, JPA.BASIC);
- }
- @Override
- public void appendTypeAnnotationTo(StringBuilder sb) {
- sb.append("@Entity").append(CR);
- }
-
- @Override
- public void appendIdFieldAnnotationTo(StringBuilder sb) {
- sb.append("@Basic").append(CR);
- }
- });
- }
-
- private ICompilationUnit createTestEntityWithMutableBasicDate() throws Exception {
- return this.createTestType(new DefaultAnnotationWriter() {
- @Override
- public Iterator<String> imports() {
- return new ArrayIterator<String>(JPA.ENTITY, JPA.BASIC, EclipseLinkJPA.MUTABLE, "java.util.Date");
- }
- @Override
- public void appendTypeAnnotationTo(StringBuilder sb) {
- sb.append("@Entity").append(CR);
- }
-
- @Override
- public void appendIdFieldAnnotationTo(StringBuilder sb) {
- sb.append("@Basic").append(CR);
- sb.append(" @Mutable").append(CR);
- sb.append(" private Date myDate;").append(CR);
- sb.append(CR);
- sb.append(" ");
- }
- });
- }
-
- public EclipseLinkOrmBasicMappingTests(String name) {
- super(name);
- }
-
-
- public void testUpdateMutable() throws Exception {
- createTestEntityWithBasicMapping();
- OrmPersistentType ormPersistentType =
- getEntityMappings().addPersistentType(MappingKeys.ENTITY_TYPE_MAPPING_KEY, FULLY_QUALIFIED_TYPE_NAME);
- OrmPersistentAttribute ormPersistentAttribute =
- ormPersistentType.addSpecifiedPersistentAttribute(MappingKeys.BASIC_ATTRIBUTE_MAPPING_KEY, "id");
- EclipseLinkOrmBasicMapping contextBasic =
- (EclipseLinkOrmBasicMapping) ormPersistentAttribute.getMapping();
- XmlEntity resourceEntity =
- (XmlEntity)getXmlEntityMappings().getEntities().get(0);
- XmlBasic resourceBasic =
- (XmlBasic) resourceEntity.getAttributes().getBasics().get(0);
- EclipseLinkBasicMapping javaBasicMapping = (EclipseLinkBasicMapping) ormPersistentType.getJavaPersistentType().getAttributeNamed("id").getMapping();
-
- // check defaults
-
- assertNull(resourceBasic.getMutable());
- assertTrue(contextBasic.getMutable().isDefaultMutable());
- assertNull(contextBasic.getMutable().getSpecifiedMutable());
- assertTrue(contextBasic.getMutable().isMutable());
-
- // set xml mutable to false, check context
-
- resourceBasic.setMutable(Boolean.FALSE);
-
- assertEquals(Boolean.FALSE, resourceBasic.getMutable());
- assertTrue(contextBasic.getMutable().isDefaultMutable());
- assertEquals(Boolean.FALSE, contextBasic.getMutable().getSpecifiedMutable());
- assertFalse(contextBasic.getMutable().isMutable());
-
- // set xml mutable to true, check context
-
- resourceBasic.setMutable(Boolean.TRUE);
-
- assertEquals(Boolean.TRUE, resourceBasic.getMutable());
- assertTrue(contextBasic.getMutable().isDefaultMutable());
- assertEquals(Boolean.TRUE, contextBasic.getMutable().getSpecifiedMutable());
- assertTrue(contextBasic.getMutable().isMutable());
-
- // clear xml mutable, check context
-
- resourceBasic.setMutable(null);
-
- assertNull(resourceBasic.getMutable());
- assertTrue(contextBasic.getMutable().isDefaultMutable());
- assertNull(contextBasic.getMutable().getSpecifiedMutable());
- assertTrue(contextBasic.getMutable().isMutable());
-
- // TODO - test defaults for java serializable and date/time types,
- // with and without persistence property
-
- // set mutable on java basic mapping
-
- javaBasicMapping.getMutable().setSpecifiedMutable(Boolean.FALSE);
- assertNull(resourceBasic.getMutable());
- assertTrue(contextBasic.getMutable().isDefaultMutable());
- assertNull(contextBasic.getMutable().getSpecifiedMutable());
- assertTrue(contextBasic.getMutable().isMutable());
- assertFalse(javaBasicMapping.getMutable().isMutable());
-
- // remove attribute from xml, test default mutable from java
-
- ormPersistentType.removeSpecifiedPersistentAttribute(ormPersistentAttribute);
- ormPersistentAttribute = ormPersistentType.virtualAttributes().next();
- contextBasic = (EclipseLinkOrmBasicMapping) ormPersistentAttribute.getMapping();
-
- assertNull(resourceBasic.getMutable());
- assertTrue(contextBasic.getMutable().isDefaultMutable());
- assertEquals(Boolean.FALSE, contextBasic.getMutable().getSpecifiedMutable());
- assertFalse(contextBasic.getMutable().isMutable());
- assertFalse(javaBasicMapping.getMutable().isMutable());
-
- // set metadata complete
- ormPersistentType.getMapping().setSpecifiedMetadataComplete(Boolean.TRUE);
- ormPersistentAttribute = ormPersistentType.virtualAttributes().next();
- contextBasic = (EclipseLinkOrmBasicMapping) ormPersistentAttribute.getMapping();
- assertNull(resourceBasic.getMutable());
- assertTrue(contextBasic.getMutable().isDefaultMutable());
- assertEquals(Boolean.TRUE, contextBasic.getMutable().getSpecifiedMutable());
- assertTrue(contextBasic.getMutable().isMutable());
- assertFalse(javaBasicMapping.getMutable().isMutable());
- }
-
- public void testUpdateMutableDate() throws Exception {
- createTestEntityWithMutableBasicDate();
- OrmPersistentType ormPersistentType =
- getEntityMappings().addPersistentType(MappingKeys.ENTITY_TYPE_MAPPING_KEY, FULLY_QUALIFIED_TYPE_NAME);
- OrmPersistentAttribute ormPersistentAttribute =
- ormPersistentType.addSpecifiedPersistentAttribute(MappingKeys.BASIC_ATTRIBUTE_MAPPING_KEY, "myDate");
- EclipseLinkOrmBasicMapping contextBasic =
- (EclipseLinkOrmBasicMapping) ormPersistentAttribute.getMapping();
- XmlEntity resourceEntity =
- (XmlEntity)getXmlEntityMappings().getEntities().get(0);
- XmlBasic resourceBasic =
- (XmlBasic) resourceEntity.getAttributes().getBasics().get(0);
- EclipseLinkBasicMapping javaBasicMapping = (EclipseLinkBasicMapping) ormPersistentType.getJavaPersistentType().getAttributeNamed("myDate").getMapping();
-
- // check defaults
-
- assertNull(resourceBasic.getMutable());
- assertFalse(contextBasic.getMutable().isDefaultMutable());
- assertNull(contextBasic.getMutable().getSpecifiedMutable());
- assertFalse(contextBasic.getMutable().isMutable());
-
- // set xml mutable to false, check context
-
- resourceBasic.setMutable(Boolean.FALSE);
-
- assertEquals(Boolean.FALSE, resourceBasic.getMutable());
- assertFalse(contextBasic.getMutable().isDefaultMutable());
- assertEquals(Boolean.FALSE, contextBasic.getMutable().getSpecifiedMutable());
- assertFalse(contextBasic.getMutable().isMutable());
-
- // set xml mutable to true, check context
-
- resourceBasic.setMutable(Boolean.TRUE);
-
- assertEquals(Boolean.TRUE, resourceBasic.getMutable());
- assertFalse(contextBasic.getMutable().isDefaultMutable());
- assertEquals(Boolean.TRUE, contextBasic.getMutable().getSpecifiedMutable());
- assertTrue(contextBasic.getMutable().isMutable());
-
- // clear xml mutable, check context
-
- resourceBasic.setMutable(null);
-
- assertNull(resourceBasic.getMutable());
- assertFalse(contextBasic.getMutable().isDefaultMutable());
- assertNull(contextBasic.getMutable().getSpecifiedMutable());
- assertFalse(contextBasic.getMutable().isMutable());
-
-
- getPersistenceUnit().getOptions().setTemporalMutable(Boolean.TRUE);
- assertNull(resourceBasic.getMutable());
- assertTrue(contextBasic.getMutable().isDefaultMutable());
- assertNull(contextBasic.getMutable().getSpecifiedMutable());
- assertTrue(contextBasic.getMutable().isMutable());
-
- getPersistenceUnit().getOptions().setTemporalMutable(Boolean.FALSE);
- assertNull(resourceBasic.getMutable());
- assertFalse(contextBasic.getMutable().isDefaultMutable());
- assertNull(contextBasic.getMutable().getSpecifiedMutable());
- assertFalse(contextBasic.getMutable().isMutable());
-
- getPersistenceUnit().getOptions().setTemporalMutable(null);
- assertNull(resourceBasic.getMutable());
- assertFalse(contextBasic.getMutable().isDefaultMutable());
- assertNull(contextBasic.getMutable().getSpecifiedMutable());
- assertFalse(contextBasic.getMutable().isMutable());
-
- // set mutable on java basic mapping
-
- javaBasicMapping.getMutable().setSpecifiedMutable(Boolean.TRUE);
- assertNull(resourceBasic.getMutable());
- assertFalse(contextBasic.getMutable().isDefaultMutable());
- assertNull(contextBasic.getMutable().getSpecifiedMutable());
- assertFalse(contextBasic.getMutable().isMutable());
- assertTrue(javaBasicMapping.getMutable().isMutable());
-
- // remove attribute from xml, test default mutable from java
-
- ormPersistentType.removeSpecifiedPersistentAttribute(ormPersistentAttribute);
- ormPersistentAttribute = ormPersistentType.virtualAttributes().next();
- contextBasic = (EclipseLinkOrmBasicMapping) ormPersistentAttribute.getMapping();
-
- assertNull(resourceBasic.getMutable());
- assertFalse(contextBasic.getMutable().isDefaultMutable());
- assertEquals(Boolean.TRUE, contextBasic.getMutable().getSpecifiedMutable());
- assertTrue(contextBasic.getMutable().isMutable());
- assertTrue(javaBasicMapping.getMutable().isMutable());
-
- // set metadata complete
- ormPersistentType.getMapping().setSpecifiedMetadataComplete(Boolean.TRUE);
- ormPersistentAttribute = ormPersistentType.virtualAttributes().next();
- contextBasic = (EclipseLinkOrmBasicMapping) ormPersistentAttribute.getMapping();
- assertNull(resourceBasic.getMutable());
- assertFalse(contextBasic.getMutable().isDefaultMutable());
- assertEquals(Boolean.FALSE, contextBasic.getMutable().getSpecifiedMutable());
- assertFalse(contextBasic.getMutable().isMutable());
- assertTrue(javaBasicMapping.getMutable().isMutable());
- }
-
- public void testModifyMutable() throws Exception {
- OrmPersistentType ormPersistentType =
- getEntityMappings().addPersistentType(MappingKeys.ENTITY_TYPE_MAPPING_KEY, FULLY_QUALIFIED_TYPE_NAME);
- OrmPersistentAttribute ormPersistentAttribute =
- ormPersistentType.addSpecifiedPersistentAttribute(MappingKeys.BASIC_ATTRIBUTE_MAPPING_KEY, "basic");
- EclipseLinkOrmBasicMapping contextBasic =
- (EclipseLinkOrmBasicMapping) ormPersistentAttribute.getMapping();
- XmlEntity resourceEntity =
- (XmlEntity)getXmlEntityMappings().getEntities().get(0);
- XmlBasic resourceBasic =
- (XmlBasic) resourceEntity.getAttributes().getBasics().get(0);
-
- // check defaults
-
- assertNull(resourceBasic.getMutable());
- assertFalse(contextBasic.getMutable().isDefaultMutable());
- assertNull(contextBasic.getMutable().getSpecifiedMutable());
- assertFalse(contextBasic.getMutable().isMutable());
-
- // set context mutable to true, check resource
-
- contextBasic.getMutable().setSpecifiedMutable(Boolean.TRUE);
-
- assertEquals(Boolean.TRUE, resourceBasic.getMutable());
- assertFalse(contextBasic.getMutable().isDefaultMutable());
- assertEquals(Boolean.TRUE, contextBasic.getMutable().getSpecifiedMutable());
- assertTrue(contextBasic.getMutable().isMutable());
-
- // set context mutable to false, check resource
-
- contextBasic.getMutable().setSpecifiedMutable(Boolean.FALSE);
-
- assertEquals(Boolean.FALSE, resourceBasic.getMutable());
- assertFalse(contextBasic.getMutable().isDefaultMutable());
- assertEquals(Boolean.FALSE, contextBasic.getMutable().getSpecifiedMutable());
- assertFalse(contextBasic.getMutable().isMutable());
-
- // set context mutable to null, check resource
-
- contextBasic.getMutable().setSpecifiedMutable(null);
-
- assertNull(resourceBasic.getMutable());
- assertFalse(contextBasic.getMutable().isDefaultMutable());
- assertNull(contextBasic.getMutable().getSpecifiedMutable());
- assertFalse(contextBasic.getMutable().isMutable());
- }
-
- public void testUpdateConvert() throws Exception {
- createTestEntityWithBasicMapping();
-
- OrmPersistentType ormPersistentType = getEntityMappings().addPersistentType(MappingKeys.ENTITY_TYPE_MAPPING_KEY, FULLY_QUALIFIED_TYPE_NAME);
- OrmPersistentAttribute ormPersistentAttribute = ormPersistentType.addSpecifiedPersistentAttribute(MappingKeys.BASIC_ATTRIBUTE_MAPPING_KEY, "id");
- OrmBasicMapping ormBasicMapping = (OrmBasicMapping) ormPersistentAttribute.getMapping();
- XmlBasic basicResource = (XmlBasic) getXmlEntityMappings().getEntities().get(0).getAttributes().getBasics().get(0);
- JavaBasicMapping javaBasicMapping = (JavaBasicMapping) ormPersistentType.getJavaPersistentType().getAttributeNamed("id").getMapping();
-
- assertEquals(null, ormBasicMapping.getSpecifiedConverter());
- assertEquals(null, basicResource.getConvert());
-
- //set lob in the resource model, verify context model updated
- basicResource.setConvert("myConvert");
- assertEquals(Convert.ECLIPSE_LINK_CONVERTER, ormBasicMapping.getConverter().getType());
- assertEquals("myConvert", basicResource.getConvert());
-
- //set lob to null in the resource model
- basicResource.setConvert(null);
- assertEquals(null, ormBasicMapping.getSpecifiedConverter());
- assertEquals(null, basicResource.getConvert());
-
-
- javaBasicMapping.setSpecifiedConverter(Convert.ECLIPSE_LINK_CONVERTER);
- ((Convert) javaBasicMapping.getSpecifiedConverter()).setSpecifiedConverterName("foo");
-
- assertEquals(null, ormBasicMapping.getSpecifiedConverter());
- assertEquals(null, basicResource.getConvert());
- assertEquals("foo", ((Convert) javaBasicMapping.getSpecifiedConverter()).getSpecifiedConverterName());
-
-
- ormPersistentType.removeSpecifiedPersistentAttribute(ormPersistentAttribute);
- ormPersistentAttribute = ormPersistentType.virtualAttributes().next();
- ormBasicMapping = (OrmBasicMapping) ormPersistentAttribute.getMapping();
-
- assertEquals(Convert.ECLIPSE_LINK_CONVERTER, ormBasicMapping.getSpecifiedConverter().getType());
- assertEquals("foo", ((Convert) ormBasicMapping.getSpecifiedConverter()).getSpecifiedConverterName());
- assertEquals(null, basicResource.getConvert());
- assertEquals("foo", ((Convert) javaBasicMapping.getSpecifiedConverter()).getSpecifiedConverterName());
-
- ((Convert) javaBasicMapping.getSpecifiedConverter()).setSpecifiedConverterName("bar");
- assertEquals(Convert.ECLIPSE_LINK_CONVERTER, ormBasicMapping.getSpecifiedConverter().getType());
- assertEquals("bar", ((Convert) ormBasicMapping.getSpecifiedConverter()).getSpecifiedConverterName());
- assertEquals(null, basicResource.getConvert());
- assertEquals("bar", ((Convert) javaBasicMapping.getSpecifiedConverter()).getSpecifiedConverterName());
-
- javaBasicMapping.setSpecifiedConverter(Converter.NO_CONVERTER);
- assertEquals(null, ormBasicMapping.getSpecifiedConverter());
- assertEquals(null, basicResource.getConvert());
- assertEquals(null, javaBasicMapping.getSpecifiedConverter());
- }
-
- public void testModifyConvert() throws Exception {
- OrmPersistentType ormPersistentType = getEntityMappings().addPersistentType(MappingKeys.ENTITY_TYPE_MAPPING_KEY, "model.Foo");
- OrmPersistentAttribute ormPersistentAttribute = ormPersistentType.addSpecifiedPersistentAttribute(MappingKeys.BASIC_ATTRIBUTE_MAPPING_KEY, "basicMapping");
- OrmBasicMapping ormBasicMapping = (OrmBasicMapping) ormPersistentAttribute.getMapping();
- XmlBasic basicResource = (XmlBasic) getXmlEntityMappings().getEntities().get(0).getAttributes().getBasics().get(0);
-
- assertEquals(null, ormBasicMapping.getSpecifiedConverter());
- assertEquals(null, basicResource.getConvert());
-
- //set lob in the context model, verify resource model updated
- ormBasicMapping.setSpecifiedConverter(Convert.ECLIPSE_LINK_CONVERTER);
- assertEquals("", basicResource.getConvert());
- assertEquals(Convert.ECLIPSE_LINK_CONVERTER, ormBasicMapping.getConverter().getType());
-
- ((Convert) ormBasicMapping.getSpecifiedConverter()).setSpecifiedConverterName("bar");
- assertEquals("bar", basicResource.getConvert());
- assertEquals(Convert.ECLIPSE_LINK_CONVERTER, ormBasicMapping.getConverter().getType());
- assertEquals("bar", ((Convert) ormBasicMapping.getConverter()).getSpecifiedConverterName());
-
- ((Convert) ormBasicMapping.getSpecifiedConverter()).setSpecifiedConverterName(null);
-
- assertEquals(null, ormBasicMapping.getSpecifiedConverter());
- assertEquals(null, basicResource.getConvert());
-
- //set lob to false in the context model
- ormBasicMapping.setSpecifiedConverter(null);
- assertEquals(null, ormBasicMapping.getSpecifiedConverter());
- assertEquals(null, basicResource.getConvert());
- }
-}
diff --git a/jpa/tests/org.eclipse.jpt.eclipselink.core.tests/src/org/eclipse/jpt/eclipselink/core/tests/internal/context/orm/EclipseLinkOrmContextModelTestCase.java b/jpa/tests/org.eclipse.jpt.eclipselink.core.tests/src/org/eclipse/jpt/eclipselink/core/tests/internal/context/orm/EclipseLinkOrmContextModelTestCase.java
deleted file mode 100644
index fcc1187872..0000000000
--- a/jpa/tests/org.eclipse.jpt.eclipselink.core.tests/src/org/eclipse/jpt/eclipselink/core/tests/internal/context/orm/EclipseLinkOrmContextModelTestCase.java
+++ /dev/null
@@ -1,84 +0,0 @@
-/*******************************************************************************
- * Copyright (c) 2008, 2009 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.
- *
- * Contributors:
- * Oracle - initial API and implementation
- *******************************************************************************/
-package org.eclipse.jpt.eclipselink.core.tests.internal.context.orm;
-
-import org.eclipse.jpt.core.internal.operations.OrmFileCreationDataModelProperties;
-import org.eclipse.jpt.core.resource.xml.JpaXmlResource;
-import org.eclipse.jpt.core.tests.internal.projects.TestJpaProject;
-import org.eclipse.jpt.eclipselink.core.EclipseLinkJpaProject;
-import org.eclipse.jpt.eclipselink.core.internal.context.orm.EclipseLinkEntityMappings;
-import org.eclipse.jpt.eclipselink.core.internal.operations.EclipseLinkOrmFileCreationDataModelProvider;
-import org.eclipse.jpt.eclipselink.core.internal.operations.EclipseLinkOrmFileCreationOperation;
-import org.eclipse.jpt.eclipselink.core.resource.orm.XmlEntityMappings;
-import org.eclipse.jpt.eclipselink.core.tests.internal.context.EclipseLinkContextModelTestCase;
-import org.eclipse.wst.common.frameworks.datamodel.DataModelFactory;
-import org.eclipse.wst.common.frameworks.datamodel.IDataModel;
-
-public abstract class EclipseLinkOrmContextModelTestCase
- extends EclipseLinkContextModelTestCase
-{
- protected JpaXmlResource eclipseLinkOrmXmlResource;
-
-
- protected EclipseLinkOrmContextModelTestCase(String name) {
- super(name);
- }
-
- @Override
- protected EclipseLinkJpaProject getJpaProject() {
- return (EclipseLinkJpaProject) super.getJpaProject();
- }
-
- @Override
- protected void setUp() throws Exception {
- super.setUp();
- this.eclipseLinkOrmXmlResource = getJpaProject().getDefaultEclipseLinkOrmXmlResource();
- }
-
- @Override
- protected TestJpaProject buildJpaProject(String projectName, boolean autoBuild, IDataModel jpaConfig) throws Exception {
- TestJpaProject testJpaProject = super.buildJpaProject(projectName, autoBuild, jpaConfig);
-
- EclipseLinkOrmFileCreationOperation operation =
- new EclipseLinkOrmFileCreationOperation(buildEclipseLinkOrmConfig(testJpaProject));
- operation.execute(null, null);
-
- return testJpaProject;
- }
-
- protected IDataModel buildEclipseLinkOrmConfig(TestJpaProject testJpaProject) {
- IDataModel dataModel =
- DataModelFactory.createDataModel(new EclipseLinkOrmFileCreationDataModelProvider());
- dataModel.setProperty(OrmFileCreationDataModelProperties.PROJECT_NAME, testJpaProject.getProject().getName());
- dataModel.setProperty(OrmFileCreationDataModelProperties.ADD_TO_PERSISTENCE_UNIT, Boolean.TRUE);
- return dataModel;
- }
-
- @Override
- protected void tearDown() throws Exception {
- this.eclipseLinkOrmXmlResource = null;
- super.tearDown();
- }
-
- @Override
- protected JpaXmlResource getOrmXmlResource() {
- return this.eclipseLinkOrmXmlResource;
- }
-
- @Override
- protected XmlEntityMappings getXmlEntityMappings() {
- return (XmlEntityMappings) super.getXmlEntityMappings();
- }
-
- @Override
- protected EclipseLinkEntityMappings getEntityMappings() {
- return (EclipseLinkEntityMappings) super.getEntityMappings();
- }
-}
diff --git a/jpa/tests/org.eclipse.jpt.eclipselink.core.tests/src/org/eclipse/jpt/eclipselink/core/tests/internal/context/orm/EclipseLinkOrmConverterTests.java b/jpa/tests/org.eclipse.jpt.eclipselink.core.tests/src/org/eclipse/jpt/eclipselink/core/tests/internal/context/orm/EclipseLinkOrmConverterTests.java
deleted file mode 100644
index 633eb135f6..0000000000
--- a/jpa/tests/org.eclipse.jpt.eclipselink.core.tests/src/org/eclipse/jpt/eclipselink/core/tests/internal/context/orm/EclipseLinkOrmConverterTests.java
+++ /dev/null
@@ -1,195 +0,0 @@
-/*******************************************************************************
- * Copyright (c) 2008, 2009 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.
- *
- * Contributors:
- * Oracle - initial API and implementation
- *******************************************************************************/
-package org.eclipse.jpt.eclipselink.core.tests.internal.context.orm;
-
-import java.util.Iterator;
-import org.eclipse.jdt.core.ICompilationUnit;
-import org.eclipse.jpt.core.MappingKeys;
-import org.eclipse.jpt.core.context.java.JavaBasicMapping;
-import org.eclipse.jpt.core.context.orm.OrmBasicMapping;
-import org.eclipse.jpt.core.context.orm.OrmPersistentAttribute;
-import org.eclipse.jpt.core.context.orm.OrmPersistentType;
-import org.eclipse.jpt.core.resource.java.JPA;
-import org.eclipse.jpt.eclipselink.core.context.Convert;
-import org.eclipse.jpt.eclipselink.core.context.CustomConverter;
-import org.eclipse.jpt.eclipselink.core.context.EclipseLinkConverter;
-import org.eclipse.jpt.eclipselink.core.internal.context.orm.EclipseLinkOrmCustomConverter;
-import org.eclipse.jpt.eclipselink.core.resource.java.EclipseLinkJPA;
-import org.eclipse.jpt.eclipselink.core.resource.orm.XmlBasic;
-import org.eclipse.jpt.eclipselink.core.resource.orm.XmlConverter;
-import org.eclipse.jpt.utility.internal.iterators.ArrayIterator;
-
-@SuppressWarnings("nls")
-public class EclipseLinkOrmConverterTests
- extends EclipseLinkOrmContextModelTestCase
-{
-
- private ICompilationUnit createTestEntityWithBasicMapping() throws Exception {
- return this.createTestType(new DefaultAnnotationWriter() {
- @Override
- public Iterator<String> imports() {
- return new ArrayIterator<String>(JPA.ENTITY, JPA.BASIC, EclipseLinkJPA.CONVERT, EclipseLinkJPA.CONVERTER);
- }
- @Override
- public void appendTypeAnnotationTo(StringBuilder sb) {
- sb.append("@Entity").append(CR);
- }
-
- @Override
- public void appendIdFieldAnnotationTo(StringBuilder sb) {
- sb.append("@Basic").append(CR);
- sb.append(" @Convert(name=\"foo\")").append(CR);
- sb.append(" @Converter");
- }
- });
- }
-
-
- public EclipseLinkOrmConverterTests(String name) {
- super(name);
- }
-
-
- public void testUpdateConverterClass() throws Exception {
- createTestEntityWithBasicMapping();
-
- OrmPersistentType ormPersistentType = getEntityMappings().addPersistentType(MappingKeys.ENTITY_TYPE_MAPPING_KEY, FULLY_QUALIFIED_TYPE_NAME);
- OrmPersistentAttribute ormPersistentAttribute = ormPersistentType.addSpecifiedPersistentAttribute(MappingKeys.BASIC_ATTRIBUTE_MAPPING_KEY, "id");
- OrmBasicMapping ormBasicMapping = (OrmBasicMapping) ormPersistentAttribute.getMapping();
- ormBasicMapping.setSpecifiedConverter(Convert.ECLIPSE_LINK_CONVERTER);
- ((Convert) ormBasicMapping.getConverter()).setConverter(EclipseLinkConverter.CUSTOM_CONVERTER);
- EclipseLinkOrmCustomConverter ormConverter = (EclipseLinkOrmCustomConverter) ((Convert) ormBasicMapping.getConverter()).getConverter();
- XmlConverter converterResource = ((XmlBasic) getXmlEntityMappings().getEntities().get(0).getAttributes().getBasics().get(0)).getConverter();
- JavaBasicMapping javaBasicMapping = (JavaBasicMapping) ormPersistentType.getJavaPersistentType().getAttributeNamed("id").getMapping();
-
- assertEquals(null, ormConverter.getConverterClass());
- assertEquals(null, converterResource.getClassName());
-
- //set converter class name in the resource model, verify context model updated
- converterResource.setClassName("myConvert");
- assertEquals("myConvert", ormConverter.getConverterClass());
- assertEquals("myConvert", converterResource.getClassName());
-
- //set converter class name to null in the resource model
- converterResource.setClassName(null);
- assertEquals(null, ormConverter.getConverterClass());
- assertEquals(null, converterResource.getClassName());
-
- //remove the specified persistent attribute, test virtual mapping
- ormPersistentType.removeSpecifiedPersistentAttribute(ormPersistentAttribute);
-
- ormPersistentAttribute = ormPersistentType.virtualAttributes().next();
- ormBasicMapping = (OrmBasicMapping) ormPersistentAttribute.getMapping();
- ormConverter = (EclipseLinkOrmCustomConverter) ((Convert) ormBasicMapping.getSpecifiedConverter()).getConverter();
-
- CustomConverter javaConverter = ((CustomConverter) ((Convert) javaBasicMapping.getSpecifiedConverter()).getConverter());
- javaConverter.setConverterClass("bar");
- assertEquals("bar", ormConverter.getConverterClass());
- assertEquals("bar", javaConverter.getConverterClass());
-
- //set metadata-complete, test virtual mapping
- ormPersistentType.getMapping().setSpecifiedMetadataComplete(Boolean.TRUE);
- ormPersistentAttribute = ormPersistentType.virtualAttributes().next();
- ormBasicMapping = (OrmBasicMapping) ormPersistentAttribute.getMapping();
- assertEquals(null, ormBasicMapping.getSpecifiedConverter());
- assertEquals(org.eclipse.jpt.core.context.Converter.NO_CONVERTER, ormBasicMapping.getConverter().getType());
- assertEquals("bar", javaConverter.getConverterClass());
- }
-
- public void testModifyConverterClass() throws Exception {
- OrmPersistentType ormPersistentType = getEntityMappings().addPersistentType(MappingKeys.ENTITY_TYPE_MAPPING_KEY, "model.Foo");
- OrmPersistentAttribute ormPersistentAttribute = ormPersistentType.addSpecifiedPersistentAttribute(MappingKeys.BASIC_ATTRIBUTE_MAPPING_KEY, "basicMapping");
- OrmBasicMapping ormBasicMapping = ((OrmBasicMapping) ormPersistentAttribute.getMapping());
- ormBasicMapping.setSpecifiedConverter(Convert.ECLIPSE_LINK_CONVERTER);
- ((Convert) ormBasicMapping.getConverter()).setConverter(EclipseLinkConverter.CUSTOM_CONVERTER);
- EclipseLinkOrmCustomConverter ormConverter = (EclipseLinkOrmCustomConverter) ((Convert) ormBasicMapping.getConverter()).getConverter();
- XmlConverter converterResource = ((XmlBasic) getXmlEntityMappings().getEntities().get(0).getAttributes().getBasics().get(0)).getConverter();
-
- assertEquals(null, ormConverter.getConverterClass());
- assertEquals(null, converterResource.getClassName());
-
- //set converter class in the context model, verify resource model updated
- ormConverter.setConverterClass("foo");
- assertEquals("foo", ormConverter.getConverterClass());
- assertEquals("foo", converterResource.getClassName());
-
- ormConverter.setConverterClass(null);
- assertEquals(null, ormConverter.getConverterClass());
- assertEquals(null, converterResource.getClassName());
- }
-
- public void testUpdateName() throws Exception {
- createTestEntityWithBasicMapping();
-
- OrmPersistentType ormPersistentType = getEntityMappings().addPersistentType(MappingKeys.ENTITY_TYPE_MAPPING_KEY, FULLY_QUALIFIED_TYPE_NAME);
- OrmPersistentAttribute ormPersistentAttribute = ormPersistentType.addSpecifiedPersistentAttribute(MappingKeys.BASIC_ATTRIBUTE_MAPPING_KEY, "id");
- OrmBasicMapping ormBasicMapping = ((OrmBasicMapping) ormPersistentAttribute.getMapping());
- ormBasicMapping.setSpecifiedConverter(Convert.ECLIPSE_LINK_CONVERTER);
- ((Convert) ormBasicMapping.getConverter()).setConverter(EclipseLinkConverter.CUSTOM_CONVERTER);
- EclipseLinkOrmCustomConverter ormConverter = (EclipseLinkOrmCustomConverter) ((Convert) ormBasicMapping.getConverter()).getConverter();
- XmlConverter converterResource = ((XmlBasic) getXmlEntityMappings().getEntities().get(0).getAttributes().getBasics().get(0)).getConverter();
- JavaBasicMapping javaBasicMapping = (JavaBasicMapping) ormPersistentType.getJavaPersistentType().getAttributeNamed("id").getMapping();
-
- assertEquals(null, ormConverter.getName());
- assertEquals(null, converterResource.getName());
-
- //set converter class name in the resource model, verify context model updated
- converterResource.setName("myConvert");
- assertEquals("myConvert", ormConverter.getName());
- assertEquals("myConvert", converterResource.getName());
-
- //set converter class name to null in the resource model
- converterResource.setName(null);
- assertEquals(null, ormConverter.getName());
- assertEquals(null, converterResource.getName());
-
- //remove the specified persistent attribute, test virtual mapping
- ormPersistentType.removeSpecifiedPersistentAttribute(ormPersistentAttribute);
-
- ormPersistentAttribute = ormPersistentType.virtualAttributes().next();
- ormBasicMapping = (OrmBasicMapping) ormPersistentAttribute.getMapping();
- ormConverter = (EclipseLinkOrmCustomConverter) ((Convert) ormBasicMapping.getSpecifiedConverter()).getConverter();
-
- CustomConverter javaConverter = ((CustomConverter) ((Convert) javaBasicMapping.getSpecifiedConverter()).getConverter());
- javaConverter.setName("bar");
- assertEquals("bar", ormConverter.getName());
- assertEquals("bar", javaConverter.getName());
-
- //set metadata-complete, test virtual mapping
- ormPersistentType.getMapping().setSpecifiedMetadataComplete(Boolean.TRUE);
- ormPersistentAttribute = ormPersistentType.virtualAttributes().next();
- ormBasicMapping = (OrmBasicMapping) ormPersistentAttribute.getMapping();
- assertEquals(null, ormBasicMapping.getSpecifiedConverter());
- assertEquals(org.eclipse.jpt.core.context.Converter.NO_CONVERTER, ormBasicMapping.getConverter().getType());
- assertEquals("bar", javaConverter.getName());
- }
-
- public void testModifyName() throws Exception {
- OrmPersistentType ormPersistentType = getEntityMappings().addPersistentType(MappingKeys.ENTITY_TYPE_MAPPING_KEY, "model.Foo");
- OrmPersistentAttribute ormPersistentAttribute = ormPersistentType.addSpecifiedPersistentAttribute(MappingKeys.BASIC_ATTRIBUTE_MAPPING_KEY, "basicMapping");
- OrmBasicMapping ormBasicMapping = ((OrmBasicMapping) ormPersistentAttribute.getMapping());
- ormBasicMapping.setSpecifiedConverter(Convert.ECLIPSE_LINK_CONVERTER);
- ((Convert) ormBasicMapping.getConverter()).setConverter(EclipseLinkConverter.CUSTOM_CONVERTER);
- EclipseLinkOrmCustomConverter ormConverter = (EclipseLinkOrmCustomConverter) ((Convert) ormBasicMapping.getConverter()).getConverter();
- XmlConverter converterResource = ((XmlBasic) getXmlEntityMappings().getEntities().get(0).getAttributes().getBasics().get(0)).getConverter();
-
- assertEquals(null, ormConverter.getName());
- assertEquals(null, converterResource.getName());
-
- //set converter class in the context model, verify resource model updated
- ormConverter.setName("foo");
- assertEquals("foo", ormConverter.getName());
- assertEquals("foo", converterResource.getName());
-
- ormConverter.setName(null);
- assertEquals(null, ormConverter.getName());
- assertEquals(null, converterResource.getName());
- }
-}
diff --git a/jpa/tests/org.eclipse.jpt.eclipselink.core.tests/src/org/eclipse/jpt/eclipselink/core/tests/internal/context/orm/EclipseLinkOrmEmbeddableTests.java b/jpa/tests/org.eclipse.jpt.eclipselink.core.tests/src/org/eclipse/jpt/eclipselink/core/tests/internal/context/orm/EclipseLinkOrmEmbeddableTests.java
deleted file mode 100644
index 0a7c324185..0000000000
--- a/jpa/tests/org.eclipse.jpt.eclipselink.core.tests/src/org/eclipse/jpt/eclipselink/core/tests/internal/context/orm/EclipseLinkOrmEmbeddableTests.java
+++ /dev/null
@@ -1,1034 +0,0 @@
-/*******************************************************************************
- * Copyright (c) 2008, 2009 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.
- *
- * Contributors:
- * Oracle - initial API and implementation
- *******************************************************************************/
-package org.eclipse.jpt.eclipselink.core.tests.internal.context.orm;
-
-import java.util.Iterator;
-import java.util.ListIterator;
-import org.eclipse.jdt.core.ICompilationUnit;
-import org.eclipse.jpt.core.MappingKeys;
-import org.eclipse.jpt.core.context.orm.OrmPersistentType;
-import org.eclipse.jpt.core.resource.java.JPA;
-import org.eclipse.jpt.eclipselink.core.context.ChangeTrackingType;
-import org.eclipse.jpt.eclipselink.core.context.CustomConverter;
-import org.eclipse.jpt.eclipselink.core.context.ObjectTypeConverter;
-import org.eclipse.jpt.eclipselink.core.context.StructConverter;
-import org.eclipse.jpt.eclipselink.core.context.TypeConverter;
-import org.eclipse.jpt.eclipselink.core.context.java.EclipseLinkJavaEmbeddable;
-import org.eclipse.jpt.eclipselink.core.internal.context.orm.ConverterHolder;
-import org.eclipse.jpt.eclipselink.core.internal.context.orm.EclipseLinkOrmEmbeddable;
-import org.eclipse.jpt.eclipselink.core.internal.context.persistence.EclipseLinkPersistenceUnit;
-import org.eclipse.jpt.eclipselink.core.resource.java.EclipseLinkJPA;
-import org.eclipse.jpt.eclipselink.core.resource.orm.EclipseLinkOrmFactory;
-import org.eclipse.jpt.eclipselink.core.resource.orm.XmlChangeTrackingType;
-import org.eclipse.jpt.eclipselink.core.resource.orm.XmlConverter;
-import org.eclipse.jpt.eclipselink.core.resource.orm.XmlEmbeddable;
-import org.eclipse.jpt.eclipselink.core.resource.orm.XmlObjectTypeConverter;
-import org.eclipse.jpt.eclipselink.core.resource.orm.XmlStructConverter;
-import org.eclipse.jpt.eclipselink.core.resource.orm.XmlTypeConverter;
-import org.eclipse.jpt.utility.internal.CollectionTools;
-import org.eclipse.jpt.utility.internal.iterators.ArrayIterator;
-
-@SuppressWarnings("nls")
-public class EclipseLinkOrmEmbeddableTests extends EclipseLinkOrmContextModelTestCase
-{
- public EclipseLinkOrmEmbeddableTests(String name) {
- super(name);
- }
-
- private ICompilationUnit createTestEmbeddableForCustomizer() throws Exception {
- return this.createTestType(new DefaultAnnotationWriter() {
- @Override
- public Iterator<String> imports() {
- return new ArrayIterator<String>(JPA.EMBEDDABLE, EclipseLinkJPA.CUSTOMIZER);
- }
-
- @Override
- public void appendTypeAnnotationTo(StringBuilder sb) {
- sb.append("@Embeddable").append(CR);
- }
- });
- }
-
- private ICompilationUnit createTestEmbeddableForChangeTracking() throws Exception {
- return this.createTestType(new DefaultAnnotationWriter() {
- @Override
- public Iterator<String> imports() {
- return new ArrayIterator<String>(JPA.EMBEDDABLE, EclipseLinkJPA.CHANGE_TRACKING);
- }
-
- @Override
- public void appendTypeAnnotationTo(StringBuilder sb) {
- sb.append("@Embeddable").append(CR);
- }
- });
- }
-
- private ICompilationUnit createTestEmbeddableForCustomConverters() throws Exception {
- return this.createTestType(new DefaultAnnotationWriter() {
- @Override
- public Iterator<String> imports() {
- return new ArrayIterator<String>(JPA.EMBEDDABLE);
- }
- @Override
- public void appendTypeAnnotationTo(StringBuilder sb) {
- sb.append("@Embeddable").append(CR);
- }
- });
- }
-
- private ICompilationUnit createTestEmbeddableForTypeConverters() throws Exception {
- return this.createTestType(new DefaultAnnotationWriter() {
- @Override
- public Iterator<String> imports() {
- return new ArrayIterator<String>(JPA.EMBEDDABLE);
- }
- @Override
- public void appendTypeAnnotationTo(StringBuilder sb) {
- sb.append("@Embeddable").append(CR);
- }
- });
- }
-
- private ICompilationUnit createTestEmbeddableForObjectTypeConverters() throws Exception {
- return this.createTestType(new DefaultAnnotationWriter() {
- @Override
- public Iterator<String> imports() {
- return new ArrayIterator<String>(JPA.EMBEDDABLE);
- }
- @Override
- public void appendTypeAnnotationTo(StringBuilder sb) {
- sb.append("@Embeddable").append(CR);
- }
- });
- }
-
- private ICompilationUnit createTestEmbeddableForStructConverters() throws Exception {
- return this.createTestType(new DefaultAnnotationWriter() {
- @Override
- public Iterator<String> imports() {
- return new ArrayIterator<String>(JPA.EMBEDDABLE);
- }
- @Override
- public void appendTypeAnnotationTo(StringBuilder sb) {
- sb.append("@Embeddable").append(CR);
- }
- });
- }
-
- public void testUpdateCustomizerClass() throws Exception {
- createTestEmbeddableForCustomizer();
- OrmPersistentType ormPersistentType = getEntityMappings().addPersistentType(MappingKeys.EMBEDDABLE_TYPE_MAPPING_KEY, FULLY_QUALIFIED_TYPE_NAME);
- EclipseLinkJavaEmbeddable javaContextEmbeddable = (EclipseLinkJavaEmbeddable) ormPersistentType.getJavaPersistentType().getMapping();
- EclipseLinkOrmEmbeddable ormContextEmbeddable = (EclipseLinkOrmEmbeddable) ormPersistentType.getMapping();
- XmlEmbeddable resourceEmbeddable = (XmlEmbeddable) getXmlEntityMappings().getEmbeddables().get(0);
-
-
- // check defaults
-
- assertNull(resourceEmbeddable.getCustomizer());
- assertNull(javaContextEmbeddable.getCustomizer().getCustomizerClass());
- assertNull(ormContextEmbeddable.getCustomizer().getCustomizerClass());
- assertNull(ormContextEmbeddable.getCustomizer().getDefaultCustomizerClass());
- assertNull(ormContextEmbeddable.getCustomizer().getSpecifiedCustomizerClass());
-
- // set xml customizer, check defaults
- resourceEmbeddable.setCustomizer(EclipseLinkOrmFactory.eINSTANCE.createXmlCustomizer());
- assertNull(resourceEmbeddable.getCustomizer().getCustomizerClassName());
- assertNull(javaContextEmbeddable.getCustomizer().getCustomizerClass());
- assertNull(ormContextEmbeddable.getCustomizer().getCustomizerClass());
- assertNull(ormContextEmbeddable.getCustomizer().getDefaultCustomizerClass());
- assertNull(ormContextEmbeddable.getCustomizer().getSpecifiedCustomizerClass());
-
-
- // set xml customizer class, check override
-
- resourceEmbeddable.getCustomizer().setCustomizerClassName("foo");
-
- assertEquals("foo", resourceEmbeddable.getCustomizer().getCustomizerClassName());
- assertNull(javaContextEmbeddable.getCustomizer().getCustomizerClass());
- assertEquals("foo", ormContextEmbeddable.getCustomizer().getCustomizerClass());
- assertNull(ormContextEmbeddable.getCustomizer().getDefaultCustomizerClass());
- assertEquals("foo", ormContextEmbeddable.getCustomizer().getSpecifiedCustomizerClass());
-
- // clear xml customizer class, set java customizer class, check defaults
-
- resourceEmbeddable.getCustomizer().setCustomizerClassName(null);
- javaContextEmbeddable.getCustomizer().setSpecifiedCustomizerClass("bar");
-
- assertNull(resourceEmbeddable.getCustomizer().getCustomizerClassName());
- assertEquals("bar", javaContextEmbeddable.getCustomizer().getCustomizerClass());
- assertEquals("bar", ormContextEmbeddable.getCustomizer().getCustomizerClass());
- assertEquals("bar", ormContextEmbeddable.getCustomizer().getDefaultCustomizerClass());
- assertNull(ormContextEmbeddable.getCustomizer().getSpecifiedCustomizerClass());
-
- // set metadataComplete to True, check defaults not from java
-
- ormContextEmbeddable.setSpecifiedMetadataComplete(Boolean.TRUE);
-
- assertNull(resourceEmbeddable.getCustomizer().getCustomizerClassName());
- assertEquals("bar", javaContextEmbeddable.getCustomizer().getCustomizerClass());
- assertNull(ormContextEmbeddable.getCustomizer().getCustomizerClass());
- assertNull(ormContextEmbeddable.getCustomizer().getDefaultCustomizerClass());
- assertNull(ormContextEmbeddable.getCustomizer().getSpecifiedCustomizerClass());
-
- ormContextEmbeddable.setSpecifiedMetadataComplete(null);
-
- // set xml customizer class, check override
-
- resourceEmbeddable.getCustomizer().setCustomizerClassName("foo");
-
- assertEquals("foo", resourceEmbeddable.getCustomizer().getCustomizerClassName());
- assertEquals("bar", javaContextEmbeddable.getCustomizer().getCustomizerClass());
- assertEquals("foo", ormContextEmbeddable.getCustomizer().getCustomizerClass());
- assertEquals("bar", ormContextEmbeddable.getCustomizer().getDefaultCustomizerClass());
- assertEquals("foo", ormContextEmbeddable.getCustomizer().getSpecifiedCustomizerClass());
-
- //set xml customizer null
- javaContextEmbeddable.getCustomizer().setSpecifiedCustomizerClass(null);
- resourceEmbeddable.setCustomizer(null);
- assertNull(resourceEmbeddable.getCustomizer());
- assertNull(javaContextEmbeddable.getCustomizer().getCustomizerClass());
- assertNull(ormContextEmbeddable.getCustomizer().getCustomizerClass());
- assertNull(ormContextEmbeddable.getCustomizer().getDefaultCustomizerClass());
- assertNull(ormContextEmbeddable.getCustomizer().getSpecifiedCustomizerClass());
-
- }
-
- public void testModifyCustomizerClass() throws Exception {
- createTestEmbeddableForCustomizer();
- OrmPersistentType ormPersistentType = getEntityMappings().addPersistentType(MappingKeys.EMBEDDABLE_TYPE_MAPPING_KEY, FULLY_QUALIFIED_TYPE_NAME);
- EclipseLinkOrmEmbeddable ormContextEmbeddable = (EclipseLinkOrmEmbeddable) ormPersistentType.getMapping();
- XmlEmbeddable resourceEmbeddable = (XmlEmbeddable) getXmlEntityMappings().getEmbeddables().get(0);
-
- // check defaults
-
- assertNull(resourceEmbeddable.getCustomizer());
- assertNull(ormContextEmbeddable.getCustomizer().getCustomizerClass());
- assertNull(ormContextEmbeddable.getCustomizer().getDefaultCustomizerClass());
- assertNull(ormContextEmbeddable.getCustomizer().getSpecifiedCustomizerClass());
-
- // set context customizer, check resource
-
- ormContextEmbeddable.getCustomizer().setSpecifiedCustomizerClass("foo");
-
- assertEquals("foo", resourceEmbeddable.getCustomizer().getCustomizerClassName());
- assertEquals("foo", ormContextEmbeddable.getCustomizer().getCustomizerClass());
- assertNull(ormContextEmbeddable.getCustomizer().getDefaultCustomizerClass());
- assertEquals("foo", ormContextEmbeddable.getCustomizer().getSpecifiedCustomizerClass());
-
- // set context customizer to null, check resource
-
- ormContextEmbeddable.getCustomizer().setSpecifiedCustomizerClass(null);
-
- assertNull(resourceEmbeddable.getCustomizer());
- assertNull(ormContextEmbeddable.getCustomizer().getCustomizerClass());
- assertNull(ormContextEmbeddable.getCustomizer().getDefaultCustomizerClass());
- assertNull(ormContextEmbeddable.getCustomizer().getSpecifiedCustomizerClass());
- }
-
- public void testUpdateChangeTracking() throws Exception {
- createTestEmbeddableForChangeTracking();
- OrmPersistentType ormPersistentType = getEntityMappings().addPersistentType(MappingKeys.EMBEDDABLE_TYPE_MAPPING_KEY, FULLY_QUALIFIED_TYPE_NAME);
- EclipseLinkJavaEmbeddable javaContextEmbeddable = (EclipseLinkJavaEmbeddable) ormPersistentType.getJavaPersistentType().getMapping();
- EclipseLinkOrmEmbeddable ormContextEmbeddable = (EclipseLinkOrmEmbeddable) ormPersistentType.getMapping();
- XmlEmbeddable resourceEmbeddable = (XmlEmbeddable) getXmlEntityMappings().getEmbeddables().get(0);
-
- // check defaults
-
- assertNull(resourceEmbeddable.getChangeTracking());
- assertEquals(ChangeTrackingType.AUTO, javaContextEmbeddable.getChangeTracking().getType());
- assertEquals(ChangeTrackingType.AUTO, ormContextEmbeddable.getChangeTracking().getType());
- assertEquals(ChangeTrackingType.AUTO, ormContextEmbeddable.getChangeTracking().getDefaultType());
- assertNull(ormContextEmbeddable.getChangeTracking().getSpecifiedType());
-
- // set xml type to ATTRIBUTE, check context
-
- resourceEmbeddable.setChangeTracking(EclipseLinkOrmFactory.eINSTANCE.createXmlChangeTracking());
- resourceEmbeddable.getChangeTracking().setType(XmlChangeTrackingType.ATTRIBUTE);
-
- assertEquals(XmlChangeTrackingType.ATTRIBUTE, resourceEmbeddable.getChangeTracking().getType());
- assertEquals(ChangeTrackingType.AUTO, javaContextEmbeddable.getChangeTracking().getType());
- assertEquals(ChangeTrackingType.ATTRIBUTE, ormContextEmbeddable.getChangeTracking().getType());
- assertEquals(ChangeTrackingType.AUTO, ormContextEmbeddable.getChangeTracking().getDefaultType());
- assertEquals(ChangeTrackingType.ATTRIBUTE, ormContextEmbeddable.getChangeTracking().getSpecifiedType());
-
- // set xml type to OBJECT, check context
-
- resourceEmbeddable.getChangeTracking().setType(XmlChangeTrackingType.OBJECT);
-
- assertEquals(XmlChangeTrackingType.OBJECT, resourceEmbeddable.getChangeTracking().getType());
- assertEquals(ChangeTrackingType.AUTO, javaContextEmbeddable.getChangeTracking().getType());
- assertEquals(ChangeTrackingType.OBJECT, ormContextEmbeddable.getChangeTracking().getType());
- assertEquals(ChangeTrackingType.AUTO, ormContextEmbeddable.getChangeTracking().getDefaultType());
- assertEquals(ChangeTrackingType.OBJECT, ormContextEmbeddable.getChangeTracking().getSpecifiedType());
-
- // set xml type to DEFERRED, check context
-
- resourceEmbeddable.getChangeTracking().setType(XmlChangeTrackingType.DEFERRED);
-
- assertEquals(XmlChangeTrackingType.DEFERRED, resourceEmbeddable.getChangeTracking().getType());
- assertEquals(ChangeTrackingType.AUTO, javaContextEmbeddable.getChangeTracking().getType());
- assertEquals(ChangeTrackingType.DEFERRED, ormContextEmbeddable.getChangeTracking().getType());
- assertEquals(ChangeTrackingType.AUTO, ormContextEmbeddable.getChangeTracking().getDefaultType());
- assertEquals(ChangeTrackingType.DEFERRED, ormContextEmbeddable.getChangeTracking().getSpecifiedType());
-
- // set xml type to AUTO, check context
-
- resourceEmbeddable.getChangeTracking().setType(XmlChangeTrackingType.AUTO);
-
- assertEquals(XmlChangeTrackingType.AUTO, resourceEmbeddable.getChangeTracking().getType());
- assertEquals(ChangeTrackingType.AUTO, javaContextEmbeddable.getChangeTracking().getType());
- assertEquals(ChangeTrackingType.AUTO, ormContextEmbeddable.getChangeTracking().getType());
- assertEquals(ChangeTrackingType.AUTO, ormContextEmbeddable.getChangeTracking().getDefaultType());
- assertEquals(ChangeTrackingType.AUTO, ormContextEmbeddable.getChangeTracking().getSpecifiedType());
-
- // clear xml change tracking, set java change tracking, check defaults
-
- resourceEmbeddable.setChangeTracking(null);
- javaContextEmbeddable.getChangeTracking().setSpecifiedType(ChangeTrackingType.ATTRIBUTE);
-
- assertNull(resourceEmbeddable.getChangeTracking());
- assertEquals(ChangeTrackingType.ATTRIBUTE, javaContextEmbeddable.getChangeTracking().getType());
- assertEquals(ChangeTrackingType.ATTRIBUTE, ormContextEmbeddable.getChangeTracking().getType());
- assertEquals(ChangeTrackingType.ATTRIBUTE, ormContextEmbeddable.getChangeTracking().getDefaultType());
- assertNull(ormContextEmbeddable.getChangeTracking().getSpecifiedType());
-
- // set metadataComplete to True, check defaults not from java
-
- ormContextEmbeddable.setSpecifiedMetadataComplete(Boolean.TRUE);
-
- assertNull(resourceEmbeddable.getChangeTracking());
- assertEquals(ChangeTrackingType.ATTRIBUTE, javaContextEmbeddable.getChangeTracking().getType());
- assertEquals(ChangeTrackingType.AUTO, ormContextEmbeddable.getChangeTracking().getType());
- assertEquals(ChangeTrackingType.AUTO, ormContextEmbeddable.getChangeTracking().getDefaultType());
- assertNull(ormContextEmbeddable.getChangeTracking().getSpecifiedType());
-
- // unset metadataComplete, set xml change tracking to OBJECT, check context
-
- ormContextEmbeddable.setSpecifiedMetadataComplete(null);
- resourceEmbeddable.setChangeTracking(EclipseLinkOrmFactory.eINSTANCE.createXmlChangeTracking());
- resourceEmbeddable.getChangeTracking().setType(XmlChangeTrackingType.OBJECT);
-
- assertEquals(XmlChangeTrackingType.OBJECT, resourceEmbeddable.getChangeTracking().getType());
- assertEquals(ChangeTrackingType.ATTRIBUTE, javaContextEmbeddable.getChangeTracking().getType());
- assertEquals(ChangeTrackingType.OBJECT, ormContextEmbeddable.getChangeTracking().getType());
- assertEquals(ChangeTrackingType.ATTRIBUTE, ormContextEmbeddable.getChangeTracking().getDefaultType());
- assertEquals(ChangeTrackingType.OBJECT, ormContextEmbeddable.getChangeTracking().getSpecifiedType());
- }
-
- public void testModifyChangeTracking() throws Exception {
- createTestEmbeddableForChangeTracking();
- OrmPersistentType ormPersistentType = getEntityMappings().addPersistentType(MappingKeys.EMBEDDABLE_TYPE_MAPPING_KEY, FULLY_QUALIFIED_TYPE_NAME);
- EclipseLinkOrmEmbeddable ormContextEmbeddable = (EclipseLinkOrmEmbeddable) ormPersistentType.getMapping();
- XmlEmbeddable resourceEmbeddable = (XmlEmbeddable) getXmlEntityMappings().getEmbeddables().get(0);
-
- // check defaults
-
- assertNull(resourceEmbeddable.getChangeTracking());
- assertEquals(ChangeTrackingType.AUTO, ormContextEmbeddable.getChangeTracking().getType());
- assertEquals(ChangeTrackingType.AUTO, ormContextEmbeddable.getChangeTracking().getDefaultType());
- assertNull(ormContextEmbeddable.getChangeTracking().getSpecifiedType());
-
- // set context change tracking to ATTRIBUTE, check resource
-
- ormContextEmbeddable.getChangeTracking().setSpecifiedType(ChangeTrackingType.ATTRIBUTE);
-
- assertEquals(XmlChangeTrackingType.ATTRIBUTE, resourceEmbeddable.getChangeTracking().getType());
- assertEquals(ChangeTrackingType.ATTRIBUTE, ormContextEmbeddable.getChangeTracking().getType());
- assertEquals(ChangeTrackingType.AUTO, ormContextEmbeddable.getChangeTracking().getDefaultType());
- assertEquals(ChangeTrackingType.ATTRIBUTE, ormContextEmbeddable.getChangeTracking().getSpecifiedType());
-
- // set context change tracking to OBJECT, check resource
-
- ormContextEmbeddable.getChangeTracking().setSpecifiedType(ChangeTrackingType.OBJECT);
-
- assertEquals(XmlChangeTrackingType.OBJECT, resourceEmbeddable.getChangeTracking().getType());
- assertEquals(ChangeTrackingType.OBJECT, ormContextEmbeddable.getChangeTracking().getType());
- assertEquals(ChangeTrackingType.AUTO, ormContextEmbeddable.getChangeTracking().getDefaultType());
- assertEquals(ChangeTrackingType.OBJECT, ormContextEmbeddable.getChangeTracking().getSpecifiedType());
-
- // set context change tracking to DEFERRED, check resource
-
- ormContextEmbeddable.getChangeTracking().setSpecifiedType(ChangeTrackingType.DEFERRED);
-
- assertEquals(XmlChangeTrackingType.DEFERRED, resourceEmbeddable.getChangeTracking().getType());
- assertEquals(ChangeTrackingType.DEFERRED, ormContextEmbeddable.getChangeTracking().getType());
- assertEquals(ChangeTrackingType.AUTO, ormContextEmbeddable.getChangeTracking().getDefaultType());
- assertEquals(ChangeTrackingType.DEFERRED, ormContextEmbeddable.getChangeTracking().getSpecifiedType());
-
- // set context change tracking to AUTO, check resource
-
- ormContextEmbeddable.getChangeTracking().setSpecifiedType(ChangeTrackingType.AUTO);
-
- assertEquals(XmlChangeTrackingType.AUTO, resourceEmbeddable.getChangeTracking().getType());
- assertEquals(ChangeTrackingType.AUTO, ormContextEmbeddable.getChangeTracking().getType());
- assertEquals(ChangeTrackingType.AUTO, ormContextEmbeddable.getChangeTracking().getDefaultType());
- assertEquals(ChangeTrackingType.AUTO, ormContextEmbeddable.getChangeTracking().getSpecifiedType());
-
- // set context change tracking to null, check resource
-
- ormContextEmbeddable.getChangeTracking().setSpecifiedType(null);
-
- assertNull(resourceEmbeddable.getChangeTracking());
- assertEquals(ChangeTrackingType.AUTO, ormContextEmbeddable.getChangeTracking().getType());
- assertEquals(ChangeTrackingType.AUTO, ormContextEmbeddable.getChangeTracking().getDefaultType());
- assertNull(ormContextEmbeddable.getChangeTracking().getSpecifiedType());
- }
-
- public void testUpdateCustomConverters() throws Exception {
- createTestEmbeddableForCustomConverters();
- EclipseLinkPersistenceUnit persistenceUnit = getPersistenceUnit();
- OrmPersistentType ormPersistentType = getEntityMappings().addPersistentType(MappingKeys.EMBEDDABLE_TYPE_MAPPING_KEY, FULLY_QUALIFIED_TYPE_NAME);
- EclipseLinkOrmEmbeddable ormContextEmbeddable = (EclipseLinkOrmEmbeddable) ormPersistentType.getMapping();
- ConverterHolder ormContextConverterHolder = ormContextEmbeddable.getConverterHolder();
- XmlEmbeddable resourceEmbeddable = (XmlEmbeddable) getXmlEntityMappings().getEmbeddables().get(0);
-
- assertEquals(0, ormContextConverterHolder.customConvertersSize());
- assertEquals(0, resourceEmbeddable.getConverters().size());
- assertEquals(0, CollectionTools.size(persistenceUnit.allConverters()));
-
- //add a converter to the resource model, check context model
- XmlConverter resourceConverter = EclipseLinkOrmFactory.eINSTANCE.createXmlConverter();
- resourceEmbeddable.getConverters().add(resourceConverter);
- resourceConverter.setClassName("Foo");
- resourceConverter.setName("myConverter");
-
- assertEquals(1, ormContextConverterHolder.customConvertersSize());
- ListIterator<CustomConverter> ormContextConverters = ormContextConverterHolder.customConverters();
- CustomConverter ormContextConverter = ormContextConverters.next();
- assertEquals("Foo", ormContextConverter.getConverterClass());
- assertEquals("myConverter", ormContextConverter.getName());
- assertEquals(1, resourceEmbeddable.getConverters().size());
- assertEquals(1, CollectionTools.size(persistenceUnit.allConverters()));
-
- //add another converter to the resource model, check context model
- XmlConverter resourceConverter2 = EclipseLinkOrmFactory.eINSTANCE.createXmlConverter();
- resourceEmbeddable.getConverters().add(0, resourceConverter2);
- resourceConverter2.setClassName("Foo2");
- resourceConverter2.setName("myConverter2");
-
- assertEquals(2, ormContextConverterHolder.customConvertersSize());
- ormContextConverters = ormContextConverterHolder.customConverters();
- ormContextConverter = ormContextConverters.next();
- assertEquals("Foo2", ormContextConverter.getConverterClass());
- assertEquals("myConverter2", ormContextConverter.getName());
- ormContextConverter = ormContextConverters.next();
- assertEquals("Foo", ormContextConverter.getConverterClass());
- assertEquals("myConverter", ormContextConverter.getName());
- assertEquals(2, resourceEmbeddable.getConverters().size());
- assertEquals(2, CollectionTools.size(persistenceUnit.allConverters()));
-
- //move a converter in the resource model, check context model
- resourceEmbeddable.getConverters().move(0, 1);
-
- assertEquals(2, ormContextConverterHolder.customConvertersSize());
- ormContextConverters = ormContextConverterHolder.customConverters();
- ormContextConverter = ormContextConverters.next();
- assertEquals("Foo", ormContextConverter.getConverterClass());
- assertEquals("myConverter", ormContextConverter.getName());
- ormContextConverter = ormContextConverters.next();
- assertEquals("Foo2", ormContextConverter.getConverterClass());
- assertEquals("myConverter2", ormContextConverter.getName());
- assertEquals(2, resourceEmbeddable.getConverters().size());
- assertEquals(2, CollectionTools.size(persistenceUnit.allConverters()));
-
- //remove a converter from the resource model, check context model
- resourceEmbeddable.getConverters().remove(0);
-
- assertEquals(1, ormContextConverterHolder.customConvertersSize());
- ormContextConverters = ormContextConverterHolder.customConverters();
- ormContextConverter = ormContextConverters.next();
- assertEquals("Foo2", ormContextConverter.getConverterClass());
- assertEquals("myConverter2", ormContextConverter.getName());
- assertEquals(1, resourceEmbeddable.getConverters().size());
- assertEquals(1, CollectionTools.size(persistenceUnit.allConverters()));
-
- //remove a converter from the resource model, check context model
- resourceEmbeddable.getConverters().remove(resourceConverter2);
-
- assertEquals(0, ormContextConverterHolder.customConvertersSize());
- assertFalse(ormContextConverterHolder.customConverters().hasNext());
- assertEquals(0, resourceEmbeddable.getConverters().size());
- assertEquals(0, CollectionTools.size(persistenceUnit.allConverters()));
- }
-
- public void testModifyCustomConverters() throws Exception {
- createTestEmbeddableForCustomConverters();
- OrmPersistentType ormPersistentType = getEntityMappings().addPersistentType(MappingKeys.EMBEDDABLE_TYPE_MAPPING_KEY, FULLY_QUALIFIED_TYPE_NAME);
- EclipseLinkOrmEmbeddable ormContextEmbeddable = (EclipseLinkOrmEmbeddable) ormPersistentType.getMapping();
- ConverterHolder ormContextConverterHolder = ormContextEmbeddable.getConverterHolder();
- XmlEmbeddable resourceEmbeddable = (XmlEmbeddable) getXmlEntityMappings().getEmbeddables().get(0);
-
- assertEquals(0, ormContextConverterHolder.customConvertersSize());
- assertEquals(0, resourceEmbeddable.getConverters().size());
-
- //add a converter to the context model, check resource model
- CustomConverter contextConverter = ormContextConverterHolder.addCustomConverter(0);
- contextConverter.setConverterClass("Foo");
- contextConverter.setName("myConverter");
-
- assertEquals(1, resourceEmbeddable.getConverters().size());
- assertEquals("Foo", resourceEmbeddable.getConverters().get(0).getClassName());
- assertEquals("myConverter", resourceEmbeddable.getConverters().get(0).getName());
- assertEquals(1, ormContextConverterHolder.customConvertersSize());
- ListIterator<CustomConverter> ormContextConverters = ormContextConverterHolder.customConverters();
- CustomConverter ormContextConverter = ormContextConverters.next();
- assertEquals("Foo", ormContextConverter.getConverterClass());
- assertEquals("myConverter", ormContextConverter.getName());
-
- //add another converter to the context model, check resource model
- CustomConverter contextConverter2 = ormContextConverterHolder.addCustomConverter(0);
- contextConverter2.setConverterClass("Foo2");
- contextConverter2.setName("myConverter2");
-
- assertEquals(2, resourceEmbeddable.getConverters().size());
- assertEquals("Foo2", resourceEmbeddable.getConverters().get(0).getClassName());
- assertEquals("myConverter2", resourceEmbeddable.getConverters().get(0).getName());
- assertEquals("Foo", resourceEmbeddable.getConverters().get(1).getClassName());
- assertEquals("myConverter", resourceEmbeddable.getConverters().get(1).getName());
- assertEquals(2, ormContextConverterHolder.customConvertersSize());
- ormContextConverters = ormContextConverterHolder.customConverters();
- ormContextConverter = ormContextConverters.next();
- assertEquals("Foo2", ormContextConverter.getConverterClass());
- assertEquals("myConverter2", ormContextConverter.getName());
- ormContextConverter = ormContextConverters.next();
- assertEquals("Foo", ormContextConverter.getConverterClass());
- assertEquals("myConverter", ormContextConverter.getName());
-
- //move a converter in the context model, check resource model
- ormContextConverterHolder.moveCustomConverter(0, 1);
-
- assertEquals(2, resourceEmbeddable.getConverters().size());
- assertEquals("Foo", resourceEmbeddable.getConverters().get(0).getClassName());
- assertEquals("myConverter", resourceEmbeddable.getConverters().get(0).getName());
- assertEquals("Foo2", resourceEmbeddable.getConverters().get(1).getClassName());
- assertEquals("myConverter2", resourceEmbeddable.getConverters().get(1).getName());
- assertEquals(2, ormContextConverterHolder.customConvertersSize());
- ormContextConverters = ormContextConverterHolder.customConverters();
- ormContextConverter = ormContextConverters.next();
- assertEquals("Foo", ormContextConverter.getConverterClass());
- assertEquals("myConverter", ormContextConverter.getName());
- ormContextConverter = ormContextConverters.next();
- assertEquals("Foo2", ormContextConverter.getConverterClass());
- assertEquals("myConverter2", ormContextConverter.getName());
-
- //remove a converter from the context model, check resource model
- ormContextConverterHolder.removeCustomConverter(0);
-
- assertEquals(1, resourceEmbeddable.getConverters().size());
- assertEquals("Foo2", resourceEmbeddable.getConverters().get(0).getClassName());
- assertEquals("myConverter2", resourceEmbeddable.getConverters().get(0).getName());
- assertEquals(1, ormContextConverterHolder.customConvertersSize());
- ormContextConverters = ormContextConverterHolder.customConverters();
- ormContextConverter = ormContextConverters.next();
- assertEquals("Foo2", ormContextConverter.getConverterClass());
- assertEquals("myConverter2", ormContextConverter.getName());
-
-
- //remove a converter from the context model, check resource model
- ormContextConverterHolder.removeCustomConverter(contextConverter2);
-
- assertEquals(0, ormContextConverterHolder.customConvertersSize());
- assertFalse(ormContextConverterHolder.customConverters().hasNext());
- assertEquals(0, resourceEmbeddable.getConverters().size());
- }
-
- public void testUpdateTypeConverters() throws Exception {
- createTestEmbeddableForTypeConverters();
- EclipseLinkPersistenceUnit persistenceUnit = getPersistenceUnit();
- OrmPersistentType ormPersistentType = getEntityMappings().addPersistentType(MappingKeys.EMBEDDABLE_TYPE_MAPPING_KEY, FULLY_QUALIFIED_TYPE_NAME);
- EclipseLinkOrmEmbeddable ormContextEmbeddable = (EclipseLinkOrmEmbeddable) ormPersistentType.getMapping();
- ConverterHolder ormContextConverterHolder = ormContextEmbeddable.getConverterHolder();
- XmlEmbeddable resourceEmbeddable = (XmlEmbeddable) getXmlEntityMappings().getEmbeddables().get(0);
-
- assertEquals(0, ormContextConverterHolder.typeConvertersSize());
- assertEquals(0, resourceEmbeddable.getTypeConverters().size());
- assertEquals(0, CollectionTools.size(persistenceUnit.allConverters()));
-
- //add a converter to the resource model, check context model
- XmlTypeConverter resourceTypeConverter = EclipseLinkOrmFactory.eINSTANCE.createXmlTypeConverter();
- resourceEmbeddable.getTypeConverters().add(resourceTypeConverter);
- resourceTypeConverter.setDataType("Foo");
- resourceTypeConverter.setName("myTypeConverter");
-
- assertEquals(1, ormContextConverterHolder.typeConvertersSize());
- ListIterator<TypeConverter> ormContextTypeConverters = ormContextConverterHolder.typeConverters();
- TypeConverter ormContextTypeConverter = ormContextTypeConverters.next();
- assertEquals("Foo", ormContextTypeConverter.getDataType());
- assertEquals("myTypeConverter", ormContextTypeConverter.getName());
- assertEquals(1, resourceEmbeddable.getTypeConverters().size());
- assertEquals(1, CollectionTools.size(persistenceUnit.allConverters()));
-
- //add another converter to the resource model, check context model
- XmlTypeConverter resourceTypeConverter2 = EclipseLinkOrmFactory.eINSTANCE.createXmlTypeConverter();
- resourceEmbeddable.getTypeConverters().add(0, resourceTypeConverter2);
- resourceTypeConverter2.setDataType("Foo2");
- resourceTypeConverter2.setName("myTypeConverter2");
-
- assertEquals(2, ormContextConverterHolder.typeConvertersSize());
- ormContextTypeConverters = ormContextConverterHolder.typeConverters();
- ormContextTypeConverter = ormContextTypeConverters.next();
- assertEquals("Foo2", ormContextTypeConverter.getDataType());
- assertEquals("myTypeConverter2", ormContextTypeConverter.getName());
- ormContextTypeConverter = ormContextTypeConverters.next();
- assertEquals("Foo", ormContextTypeConverter.getDataType());
- assertEquals("myTypeConverter", ormContextTypeConverter.getName());
- assertEquals(2, resourceEmbeddable.getTypeConverters().size());
- assertEquals(2, CollectionTools.size(persistenceUnit.allConverters()));
-
- //move a converter in the resource model, check context model
- resourceEmbeddable.getTypeConverters().move(0, 1);
-
- assertEquals(2, ormContextConverterHolder.typeConvertersSize());
- ormContextTypeConverters = ormContextConverterHolder.typeConverters();
- ormContextTypeConverter = ormContextTypeConverters.next();
- assertEquals("Foo", ormContextTypeConverter.getDataType());
- assertEquals("myTypeConverter", ormContextTypeConverter.getName());
- ormContextTypeConverter = ormContextTypeConverters.next();
- assertEquals("Foo2", ormContextTypeConverter.getDataType());
- assertEquals("myTypeConverter2", ormContextTypeConverter.getName());
- assertEquals(2, resourceEmbeddable.getTypeConverters().size());
- assertEquals(2, CollectionTools.size(persistenceUnit.allConverters()));
-
- //remove a converter from the resource model, check context model
- resourceEmbeddable.getTypeConverters().remove(0);
-
- assertEquals(1, ormContextConverterHolder.typeConvertersSize());
- ormContextTypeConverters = ormContextConverterHolder.typeConverters();
- ormContextTypeConverter = ormContextTypeConverters.next();
- assertEquals("Foo2", ormContextTypeConverter.getDataType());
- assertEquals("myTypeConverter2", ormContextTypeConverter.getName());
- assertEquals(1, resourceEmbeddable.getTypeConverters().size());
- assertEquals(1, CollectionTools.size(persistenceUnit.allConverters()));
-
- //remove a converter from the resource model, check context model
- resourceEmbeddable.getTypeConverters().remove(resourceTypeConverter2);
-
- assertEquals(0, ormContextConverterHolder.typeConvertersSize());
- assertFalse(ormContextConverterHolder.typeConverters().hasNext());
- assertEquals(0, resourceEmbeddable.getTypeConverters().size());
- assertEquals(0, CollectionTools.size(persistenceUnit.allConverters()));
- }
-
- public void testModifyTypeConverters() throws Exception {
- createTestEmbeddableForTypeConverters();
- EclipseLinkPersistenceUnit persistenceUnit = getPersistenceUnit();
- OrmPersistentType ormPersistentType = getEntityMappings().addPersistentType(MappingKeys.EMBEDDABLE_TYPE_MAPPING_KEY, FULLY_QUALIFIED_TYPE_NAME);
- EclipseLinkOrmEmbeddable ormContextEmbeddable = (EclipseLinkOrmEmbeddable) ormPersistentType.getMapping();
- ConverterHolder ormContextConverterHolder = ormContextEmbeddable.getConverterHolder();
- XmlEmbeddable resourceEmbeddable = (XmlEmbeddable) getXmlEntityMappings().getEmbeddables().get(0);
-
- assertEquals(0, ormContextConverterHolder.typeConvertersSize());
- assertEquals(0, resourceEmbeddable.getTypeConverters().size());
- assertEquals(0, CollectionTools.size(persistenceUnit.allConverters()));
-
- //add a converter to the context model, check resource model
- TypeConverter contextTypeConverter = ormContextConverterHolder.addTypeConverter(0);
- contextTypeConverter.setDataType("Foo");
- contextTypeConverter.setName("myTypeConverter");
-
- assertEquals(1, resourceEmbeddable.getTypeConverters().size());
- assertEquals("Foo", resourceEmbeddable.getTypeConverters().get(0).getDataType());
- assertEquals("myTypeConverter", resourceEmbeddable.getTypeConverters().get(0).getName());
- assertEquals(1, ormContextConverterHolder.typeConvertersSize());
- ListIterator<TypeConverter> ormContextTypeConverters = ormContextConverterHolder.typeConverters();
- TypeConverter ormContextTypeConverter = ormContextTypeConverters.next();
- assertEquals("Foo", ormContextTypeConverter.getDataType());
- assertEquals("myTypeConverter", ormContextTypeConverter.getName());
- assertEquals(1, CollectionTools.size(persistenceUnit.allConverters()));
-
- //add another converter to the context model, check resource model
- TypeConverter contextTypeConverter2 = ormContextConverterHolder.addTypeConverter(0);
- contextTypeConverter2.setDataType("Foo2");
- contextTypeConverter2.setName("myTypeConverter2");
-
- assertEquals(2, resourceEmbeddable.getTypeConverters().size());
- assertEquals("Foo2", resourceEmbeddable.getTypeConverters().get(0).getDataType());
- assertEquals("myTypeConverter2", resourceEmbeddable.getTypeConverters().get(0).getName());
- assertEquals("Foo", resourceEmbeddable.getTypeConverters().get(1).getDataType());
- assertEquals("myTypeConverter", resourceEmbeddable.getTypeConverters().get(1).getName());
- assertEquals(2, ormContextConverterHolder.typeConvertersSize());
- ormContextTypeConverters = ormContextConverterHolder.typeConverters();
- ormContextTypeConverter = ormContextTypeConverters.next();
- assertEquals("Foo2", ormContextTypeConverter.getDataType());
- assertEquals("myTypeConverter2", ormContextTypeConverter.getName());
- ormContextTypeConverter = ormContextTypeConverters.next();
- assertEquals("Foo", ormContextTypeConverter.getDataType());
- assertEquals("myTypeConverter", ormContextTypeConverter.getName());
- assertEquals(2, CollectionTools.size(persistenceUnit.allConverters()));
-
- //move a converter in the context model, check resource model
- ormContextConverterHolder.moveTypeConverter(0, 1);
-
- assertEquals(2, resourceEmbeddable.getTypeConverters().size());
- assertEquals("Foo", resourceEmbeddable.getTypeConverters().get(0).getDataType());
- assertEquals("myTypeConverter", resourceEmbeddable.getTypeConverters().get(0).getName());
- assertEquals("Foo2", resourceEmbeddable.getTypeConverters().get(1).getDataType());
- assertEquals("myTypeConverter2", resourceEmbeddable.getTypeConverters().get(1).getName());
- assertEquals(2, ormContextConverterHolder.typeConvertersSize());
- ormContextTypeConverters = ormContextConverterHolder.typeConverters();
- ormContextTypeConverter = ormContextTypeConverters.next();
- assertEquals("Foo", ormContextTypeConverter.getDataType());
- assertEquals("myTypeConverter", ormContextTypeConverter.getName());
- ormContextTypeConverter = ormContextTypeConverters.next();
- assertEquals("Foo2", ormContextTypeConverter.getDataType());
- assertEquals("myTypeConverter2", ormContextTypeConverter.getName());
- assertEquals(2, CollectionTools.size(persistenceUnit.allConverters()));
-
- //remove a converter from the context model, check resource model
- ormContextConverterHolder.removeTypeConverter(0);
-
- assertEquals(1, resourceEmbeddable.getTypeConverters().size());
- assertEquals("Foo2", resourceEmbeddable.getTypeConverters().get(0).getDataType());
- assertEquals("myTypeConverter2", resourceEmbeddable.getTypeConverters().get(0).getName());
- assertEquals(1, ormContextConverterHolder.typeConvertersSize());
- ormContextTypeConverters = ormContextConverterHolder.typeConverters();
- ormContextTypeConverter = ormContextTypeConverters.next();
- assertEquals("Foo2", ormContextTypeConverter.getDataType());
- assertEquals("myTypeConverter2", ormContextTypeConverter.getName());
- assertEquals(1, CollectionTools.size(persistenceUnit.allConverters()));
-
- //remove a converter from the context model, check resource model
- ormContextConverterHolder.removeTypeConverter(contextTypeConverter2);
-
- assertEquals(0, ormContextConverterHolder.typeConvertersSize());
- assertFalse(ormContextConverterHolder.typeConverters().hasNext());
- assertEquals(0, resourceEmbeddable.getTypeConverters().size());
- assertEquals(0, CollectionTools.size(persistenceUnit.allConverters()));
- }
-
- public void testUpdateObjectTypeConverters() throws Exception {
- createTestEmbeddableForObjectTypeConverters();
- EclipseLinkPersistenceUnit persistenceUnit = getPersistenceUnit();
- OrmPersistentType ormPersistentType = getEntityMappings().addPersistentType(MappingKeys.EMBEDDABLE_TYPE_MAPPING_KEY, FULLY_QUALIFIED_TYPE_NAME);
- EclipseLinkOrmEmbeddable ormContextEmbeddable = (EclipseLinkOrmEmbeddable) ormPersistentType.getMapping();
- ConverterHolder ormContextConverterHolder = ormContextEmbeddable.getConverterHolder();
- XmlEmbeddable resourceEmbeddable = (XmlEmbeddable) getXmlEntityMappings().getEmbeddables().get(0);
-
- assertEquals(0, ormContextConverterHolder.objectTypeConvertersSize());
- assertEquals(0, resourceEmbeddable.getObjectTypeConverters().size());
- assertEquals(0, CollectionTools.size(persistenceUnit.allConverters()));
-
- //add a converter to the resource model, check context model
- XmlObjectTypeConverter resourceObjectTypeConverter = EclipseLinkOrmFactory.eINSTANCE.createXmlObjectTypeConverter();
- resourceEmbeddable.getObjectTypeConverters().add(resourceObjectTypeConverter);
- resourceObjectTypeConverter.setDataType("Foo");
- resourceObjectTypeConverter.setName("myObjectTypeConverter");
-
- assertEquals(1, ormContextConverterHolder.objectTypeConvertersSize());
- ListIterator<ObjectTypeConverter> ormContextObjectTypeConverters = ormContextConverterHolder.objectTypeConverters();
- ObjectTypeConverter ormContextObjectTypeConverter = ormContextObjectTypeConverters.next();
- assertEquals("Foo", ormContextObjectTypeConverter.getDataType());
- assertEquals("myObjectTypeConverter", ormContextObjectTypeConverter.getName());
- assertEquals(1, resourceEmbeddable.getObjectTypeConverters().size());
- assertEquals(1, CollectionTools.size(persistenceUnit.allConverters()));
-
- //add another converter to the resource model, check context model
- XmlObjectTypeConverter resourceObjectTypeConverter2 = EclipseLinkOrmFactory.eINSTANCE.createXmlObjectTypeConverter();
- resourceEmbeddable.getObjectTypeConverters().add(0, resourceObjectTypeConverter2);
- resourceObjectTypeConverter2.setDataType("Foo2");
- resourceObjectTypeConverter2.setName("myObjectTypeConverter2");
-
- assertEquals(2, ormContextConverterHolder.objectTypeConvertersSize());
- ormContextObjectTypeConverters = ormContextConverterHolder.objectTypeConverters();
- ormContextObjectTypeConverter = ormContextObjectTypeConverters.next();
- assertEquals("Foo2", ormContextObjectTypeConverter.getDataType());
- assertEquals("myObjectTypeConverter2", ormContextObjectTypeConverter.getName());
- ormContextObjectTypeConverter = ormContextObjectTypeConverters.next();
- assertEquals("Foo", ormContextObjectTypeConverter.getDataType());
- assertEquals("myObjectTypeConverter", ormContextObjectTypeConverter.getName());
- assertEquals(2, resourceEmbeddable.getObjectTypeConverters().size());
- assertEquals(2, CollectionTools.size(persistenceUnit.allConverters()));
-
- //move a converter in the resource model, check context model
- resourceEmbeddable.getObjectTypeConverters().move(0, 1);
-
- assertEquals(2, ormContextConverterHolder.objectTypeConvertersSize());
- ormContextObjectTypeConverters = ormContextConverterHolder.objectTypeConverters();
- ormContextObjectTypeConverter = ormContextObjectTypeConverters.next();
- assertEquals("Foo", ormContextObjectTypeConverter.getDataType());
- assertEquals("myObjectTypeConverter", ormContextObjectTypeConverter.getName());
- ormContextObjectTypeConverter = ormContextObjectTypeConverters.next();
- assertEquals("Foo2", ormContextObjectTypeConverter.getDataType());
- assertEquals("myObjectTypeConverter2", ormContextObjectTypeConverter.getName());
- assertEquals(2, resourceEmbeddable.getObjectTypeConverters().size());
- assertEquals(2, CollectionTools.size(persistenceUnit.allConverters()));
-
- //remove a converter from the resource model, check context model
- resourceEmbeddable.getObjectTypeConverters().remove(0);
-
- assertEquals(1, ormContextConverterHolder.objectTypeConvertersSize());
- ormContextObjectTypeConverters = ormContextConverterHolder.objectTypeConverters();
- ormContextObjectTypeConverter = ormContextObjectTypeConverters.next();
- assertEquals("Foo2", ormContextObjectTypeConverter.getDataType());
- assertEquals("myObjectTypeConverter2", ormContextObjectTypeConverter.getName());
- assertEquals(1, resourceEmbeddable.getObjectTypeConverters().size());
- assertEquals(1, CollectionTools.size(persistenceUnit.allConverters()));
-
- //remove a converter from the resource model, check context model
- resourceEmbeddable.getObjectTypeConverters().remove(resourceObjectTypeConverter2);
-
- assertEquals(0, ormContextConverterHolder.objectTypeConvertersSize());
- assertFalse(ormContextConverterHolder.objectTypeConverters().hasNext());
- assertEquals(0, resourceEmbeddable.getObjectTypeConverters().size());
- assertEquals(0, CollectionTools.size(persistenceUnit.allConverters()));
- }
-
- public void testModifyObjectTypeConverters() throws Exception {
- createTestEmbeddableForObjectTypeConverters();
- EclipseLinkPersistenceUnit persistenceUnit = getPersistenceUnit();
- OrmPersistentType ormPersistentType = getEntityMappings().addPersistentType(MappingKeys.EMBEDDABLE_TYPE_MAPPING_KEY, FULLY_QUALIFIED_TYPE_NAME);
- EclipseLinkOrmEmbeddable ormContextEmbeddable = (EclipseLinkOrmEmbeddable) ormPersistentType.getMapping();
- ConverterHolder ormContextConverterHolder = ormContextEmbeddable.getConverterHolder();
- XmlEmbeddable resourceEmbeddable = (XmlEmbeddable) getXmlEntityMappings().getEmbeddables().get(0);
-
- assertEquals(0, ormContextConverterHolder.objectTypeConvertersSize());
- assertEquals(0, resourceEmbeddable.getObjectTypeConverters().size());
- assertEquals(0, CollectionTools.size(persistenceUnit.allConverters()));
-
- //add a converter to the context model, check resource model
- ObjectTypeConverter contextObjectTypeConverter = ormContextConverterHolder.addObjectTypeConverter(0);
- contextObjectTypeConverter.setDataType("Foo");
- contextObjectTypeConverter.setName("myObjectTypeConverter");
-
- assertEquals(1, resourceEmbeddable.getObjectTypeConverters().size());
- assertEquals("Foo", resourceEmbeddable.getObjectTypeConverters().get(0).getDataType());
- assertEquals("myObjectTypeConverter", resourceEmbeddable.getObjectTypeConverters().get(0).getName());
- assertEquals(1, ormContextConverterHolder.objectTypeConvertersSize());
- ListIterator<ObjectTypeConverter> ormContextObjectTypeConverters = ormContextConverterHolder.objectTypeConverters();
- ObjectTypeConverter ormContextObjectTypeConverter = ormContextObjectTypeConverters.next();
- assertEquals("Foo", ormContextObjectTypeConverter.getDataType());
- assertEquals("myObjectTypeConverter", ormContextObjectTypeConverter.getName());
- assertEquals(1, CollectionTools.size(persistenceUnit.allConverters()));
-
- //add another converter to the context model, check resource model
- ObjectTypeConverter contextObjectTypeConverter2 = ormContextConverterHolder.addObjectTypeConverter(0);
- contextObjectTypeConverter2.setDataType("Foo2");
- contextObjectTypeConverter2.setName("myObjectTypeConverter2");
-
- assertEquals(2, resourceEmbeddable.getObjectTypeConverters().size());
- assertEquals("Foo2", resourceEmbeddable.getObjectTypeConverters().get(0).getDataType());
- assertEquals("myObjectTypeConverter2", resourceEmbeddable.getObjectTypeConverters().get(0).getName());
- assertEquals("Foo", resourceEmbeddable.getObjectTypeConverters().get(1).getDataType());
- assertEquals("myObjectTypeConverter", resourceEmbeddable.getObjectTypeConverters().get(1).getName());
- assertEquals(2, ormContextConverterHolder.objectTypeConvertersSize());
- ormContextObjectTypeConverters = ormContextConverterHolder.objectTypeConverters();
- ormContextObjectTypeConverter = ormContextObjectTypeConverters.next();
- assertEquals("Foo2", ormContextObjectTypeConverter.getDataType());
- assertEquals("myObjectTypeConverter2", ormContextObjectTypeConverter.getName());
- ormContextObjectTypeConverter = ormContextObjectTypeConverters.next();
- assertEquals("Foo", ormContextObjectTypeConverter.getDataType());
- assertEquals("myObjectTypeConverter", ormContextObjectTypeConverter.getName());
- assertEquals(2, CollectionTools.size(persistenceUnit.allConverters()));
-
- //move a converter in the context model, check resource model
- ormContextConverterHolder.moveObjectTypeConverter(0, 1);
-
- assertEquals(2, resourceEmbeddable.getObjectTypeConverters().size());
- assertEquals("Foo", resourceEmbeddable.getObjectTypeConverters().get(0).getDataType());
- assertEquals("myObjectTypeConverter", resourceEmbeddable.getObjectTypeConverters().get(0).getName());
- assertEquals("Foo2", resourceEmbeddable.getObjectTypeConverters().get(1).getDataType());
- assertEquals("myObjectTypeConverter2", resourceEmbeddable.getObjectTypeConverters().get(1).getName());
- assertEquals(2, ormContextConverterHolder.objectTypeConvertersSize());
- ormContextObjectTypeConverters = ormContextConverterHolder.objectTypeConverters();
- ormContextObjectTypeConverter = ormContextObjectTypeConverters.next();
- assertEquals("Foo", ormContextObjectTypeConverter.getDataType());
- assertEquals("myObjectTypeConverter", ormContextObjectTypeConverter.getName());
- ormContextObjectTypeConverter = ormContextObjectTypeConverters.next();
- assertEquals("Foo2", ormContextObjectTypeConverter.getDataType());
- assertEquals("myObjectTypeConverter2", ormContextObjectTypeConverter.getName());
- assertEquals(2, CollectionTools.size(persistenceUnit.allConverters()));
-
- //remove a converter from the context model, check resource model
- ormContextConverterHolder.removeObjectTypeConverter(0);
-
- assertEquals(1, resourceEmbeddable.getObjectTypeConverters().size());
- assertEquals("Foo2", resourceEmbeddable.getObjectTypeConverters().get(0).getDataType());
- assertEquals("myObjectTypeConverter2", resourceEmbeddable.getObjectTypeConverters().get(0).getName());
- assertEquals(1, ormContextConverterHolder.objectTypeConvertersSize());
- ormContextObjectTypeConverters = ormContextConverterHolder.objectTypeConverters();
- ormContextObjectTypeConverter = ormContextObjectTypeConverters.next();
- assertEquals("Foo2", ormContextObjectTypeConverter.getDataType());
- assertEquals("myObjectTypeConverter2", ormContextObjectTypeConverter.getName());
- assertEquals(1, CollectionTools.size(persistenceUnit.allConverters()));
-
- //remove a converter from the context model, check resource model
- ormContextConverterHolder.removeObjectTypeConverter(contextObjectTypeConverter2);
-
- assertEquals(0, ormContextConverterHolder.objectTypeConvertersSize());
- assertFalse(ormContextConverterHolder.objectTypeConverters().hasNext());
- assertEquals(0, resourceEmbeddable.getObjectTypeConverters().size());
- assertEquals(0, CollectionTools.size(persistenceUnit.allConverters()));
- }
-
- public void testUpdateStructConverters() throws Exception {
- createTestEmbeddableForStructConverters();
- EclipseLinkPersistenceUnit persistenceUnit = getPersistenceUnit();
- OrmPersistentType ormPersistentType = getEntityMappings().addPersistentType(MappingKeys.EMBEDDABLE_TYPE_MAPPING_KEY, FULLY_QUALIFIED_TYPE_NAME);
- EclipseLinkOrmEmbeddable ormContextEmbeddable = (EclipseLinkOrmEmbeddable) ormPersistentType.getMapping();
- ConverterHolder ormContextConverterHolder = ormContextEmbeddable.getConverterHolder();
- XmlEmbeddable resourceEmbeddable = (XmlEmbeddable) getXmlEntityMappings().getEmbeddables().get(0);
-
- assertEquals(0, ormContextConverterHolder.structConvertersSize());
- assertEquals(0, resourceEmbeddable.getStructConverters().size());
- assertEquals(0, CollectionTools.size(persistenceUnit.allConverters()));
-
- //add a converter to the resource model, check context model
- XmlStructConverter resourceStructConverter = EclipseLinkOrmFactory.eINSTANCE.createXmlStructConverter();
- resourceEmbeddable.getStructConverters().add(resourceStructConverter);
- resourceStructConverter.setConverter("Foo");
- resourceStructConverter.setName("myStructConverter");
-
- assertEquals(1, ormContextConverterHolder.structConvertersSize());
- ListIterator<StructConverter> ormContextStructConverters = ormContextConverterHolder.structConverters();
- StructConverter ormContextStructConverter = ormContextStructConverters.next();
- assertEquals("Foo", ormContextStructConverter.getConverterClass());
- assertEquals("myStructConverter", ormContextStructConverter.getName());
- assertEquals(1, resourceEmbeddable.getStructConverters().size());
- assertEquals(1, CollectionTools.size(persistenceUnit.allConverters()));
-
- //add another converter to the resource model, check context model
- XmlStructConverter resourceStructConverter2 = EclipseLinkOrmFactory.eINSTANCE.createXmlStructConverter();
- resourceEmbeddable.getStructConverters().add(0, resourceStructConverter2);
- resourceStructConverter2.setConverter("Foo2");
- resourceStructConverter2.setName("myStructConverter2");
-
- assertEquals(2, ormContextConverterHolder.structConvertersSize());
- ormContextStructConverters = ormContextConverterHolder.structConverters();
- ormContextStructConverter = ormContextStructConverters.next();
- assertEquals("Foo2", ormContextStructConverter.getConverterClass());
- assertEquals("myStructConverter2", ormContextStructConverter.getName());
- ormContextStructConverter = ormContextStructConverters.next();
- assertEquals("Foo", ormContextStructConverter.getConverterClass());
- assertEquals("myStructConverter", ormContextStructConverter.getName());
- assertEquals(2, resourceEmbeddable.getStructConverters().size());
- assertEquals(2, CollectionTools.size(persistenceUnit.allConverters()));
-
- //move a converter in the resource model, check context model
- resourceEmbeddable.getStructConverters().move(0, 1);
-
- assertEquals(2, ormContextConverterHolder.structConvertersSize());
- ormContextStructConverters = ormContextConverterHolder.structConverters();
- ormContextStructConverter = ormContextStructConverters.next();
- assertEquals("Foo", ormContextStructConverter.getConverterClass());
- assertEquals("myStructConverter", ormContextStructConverter.getName());
- ormContextStructConverter = ormContextStructConverters.next();
- assertEquals("Foo2", ormContextStructConverter.getConverterClass());
- assertEquals("myStructConverter2", ormContextStructConverter.getName());
- assertEquals(2, resourceEmbeddable.getStructConverters().size());
- assertEquals(2, CollectionTools.size(persistenceUnit.allConverters()));
-
- //remove a converter from the resource model, check context model
- resourceEmbeddable.getStructConverters().remove(0);
-
- assertEquals(1, ormContextConverterHolder.structConvertersSize());
- ormContextStructConverters = ormContextConverterHolder.structConverters();
- ormContextStructConverter = ormContextStructConverters.next();
- assertEquals("Foo2", ormContextStructConverter.getConverterClass());
- assertEquals("myStructConverter2", ormContextStructConverter.getName());
- assertEquals(1, resourceEmbeddable.getStructConverters().size());
- assertEquals(1, CollectionTools.size(persistenceUnit.allConverters()));
-
- //remove a converter from the resource model, check context model
- resourceEmbeddable.getStructConverters().remove(resourceStructConverter2);
-
- assertEquals(0, ormContextConverterHolder.structConvertersSize());
- assertFalse(ormContextConverterHolder.structConverters().hasNext());
- assertEquals(0, resourceEmbeddable.getStructConverters().size());
- assertEquals(0, CollectionTools.size(persistenceUnit.allConverters()));
- }
-
- public void testModifyStructConverters() throws Exception {
- createTestEmbeddableForStructConverters();
- EclipseLinkPersistenceUnit persistenceUnit = getPersistenceUnit();
- OrmPersistentType ormPersistentType = getEntityMappings().addPersistentType(MappingKeys.EMBEDDABLE_TYPE_MAPPING_KEY, FULLY_QUALIFIED_TYPE_NAME);
- EclipseLinkOrmEmbeddable ormContextEmbeddable = (EclipseLinkOrmEmbeddable) ormPersistentType.getMapping();
- ConverterHolder ormContextConverterHolder = ormContextEmbeddable.getConverterHolder();
- XmlEmbeddable resourceEmbeddable = (XmlEmbeddable) getXmlEntityMappings().getEmbeddables().get(0);
-
- assertEquals(0, ormContextConverterHolder.structConvertersSize());
- assertEquals(0, resourceEmbeddable.getStructConverters().size());
- assertEquals(0, CollectionTools.size(persistenceUnit.allConverters()));
-
- //add a converter to the context model, check resource model
- StructConverter contextStructConverter = ormContextConverterHolder.addStructConverter(0);
- contextStructConverter.setConverterClass("Foo");
- contextStructConverter.setName("myStructConverter");
-
- assertEquals(1, resourceEmbeddable.getStructConverters().size());
- assertEquals("Foo", resourceEmbeddable.getStructConverters().get(0).getConverter());
- assertEquals("myStructConverter", resourceEmbeddable.getStructConverters().get(0).getName());
- assertEquals(1, ormContextConverterHolder.structConvertersSize());
- ListIterator<StructConverter> ormContextStructConverters = ormContextConverterHolder.structConverters();
- StructConverter ormContextStructConverter = ormContextStructConverters.next();
- assertEquals("Foo", ormContextStructConverter.getConverterClass());
- assertEquals("myStructConverter", ormContextStructConverter.getName());
- assertEquals(1, CollectionTools.size(persistenceUnit.allConverters()));
-
- //add another converter to the context model, check resource model
- StructConverter contextStructConverter2 = ormContextConverterHolder.addStructConverter(0);
- contextStructConverter2.setConverterClass("Foo2");
- contextStructConverter2.setName("myStructConverter2");
-
- assertEquals(2, resourceEmbeddable.getStructConverters().size());
- assertEquals("Foo2", resourceEmbeddable.getStructConverters().get(0).getConverter());
- assertEquals("myStructConverter2", resourceEmbeddable.getStructConverters().get(0).getName());
- assertEquals("Foo", resourceEmbeddable.getStructConverters().get(1).getConverter());
- assertEquals("myStructConverter", resourceEmbeddable.getStructConverters().get(1).getName());
- assertEquals(2, ormContextConverterHolder.structConvertersSize());
- ormContextStructConverters = ormContextConverterHolder.structConverters();
- ormContextStructConverter = ormContextStructConverters.next();
- assertEquals("Foo2", ormContextStructConverter.getConverterClass());
- assertEquals("myStructConverter2", ormContextStructConverter.getName());
- ormContextStructConverter = ormContextStructConverters.next();
- assertEquals("Foo", ormContextStructConverter.getConverterClass());
- assertEquals("myStructConverter", ormContextStructConverter.getName());
- assertEquals(2, CollectionTools.size(persistenceUnit.allConverters()));
-
- //move a converter in the context model, check resource model
- ormContextConverterHolder.moveStructConverter(0, 1);
-
- assertEquals(2, resourceEmbeddable.getStructConverters().size());
- assertEquals("Foo", resourceEmbeddable.getStructConverters().get(0).getConverter());
- assertEquals("myStructConverter", resourceEmbeddable.getStructConverters().get(0).getName());
- assertEquals("Foo2", resourceEmbeddable.getStructConverters().get(1).getConverter());
- assertEquals("myStructConverter2", resourceEmbeddable.getStructConverters().get(1).getName());
- assertEquals(2, ormContextConverterHolder.structConvertersSize());
- ormContextStructConverters = ormContextConverterHolder.structConverters();
- ormContextStructConverter = ormContextStructConverters.next();
- assertEquals("Foo", ormContextStructConverter.getConverterClass());
- assertEquals("myStructConverter", ormContextStructConverter.getName());
- ormContextStructConverter = ormContextStructConverters.next();
- assertEquals("Foo2", ormContextStructConverter.getConverterClass());
- assertEquals("myStructConverter2", ormContextStructConverter.getName());
- assertEquals(2, CollectionTools.size(persistenceUnit.allConverters()));
-
- //remove a converter from the context model, check resource model
- ormContextConverterHolder.removeStructConverter(0);
-
- assertEquals(1, resourceEmbeddable.getStructConverters().size());
- assertEquals("Foo2", resourceEmbeddable.getStructConverters().get(0).getConverter());
- assertEquals("myStructConverter2", resourceEmbeddable.getStructConverters().get(0).getName());
- assertEquals(1, ormContextConverterHolder.structConvertersSize());
- ormContextStructConverters = ormContextConverterHolder.structConverters();
- ormContextStructConverter = ormContextStructConverters.next();
- assertEquals("Foo2", ormContextStructConverter.getConverterClass());
- assertEquals("myStructConverter2", ormContextStructConverter.getName());
- assertEquals(1, CollectionTools.size(persistenceUnit.allConverters()));
-
- //remove a converter from the context model, check resource model
- ormContextConverterHolder.removeStructConverter(contextStructConverter2);
-
- assertEquals(0, ormContextConverterHolder.structConvertersSize());
- assertFalse(ormContextConverterHolder.structConverters().hasNext());
- assertEquals(0, resourceEmbeddable.getStructConverters().size());
- assertEquals(0, CollectionTools.size(persistenceUnit.allConverters()));
- }
-} \ No newline at end of file
diff --git a/jpa/tests/org.eclipse.jpt.eclipselink.core.tests/src/org/eclipse/jpt/eclipselink/core/tests/internal/context/orm/EclipseLinkOrmEntityTests.java b/jpa/tests/org.eclipse.jpt.eclipselink.core.tests/src/org/eclipse/jpt/eclipselink/core/tests/internal/context/orm/EclipseLinkOrmEntityTests.java
deleted file mode 100644
index 213f841730..0000000000
--- a/jpa/tests/org.eclipse.jpt.eclipselink.core.tests/src/org/eclipse/jpt/eclipselink/core/tests/internal/context/orm/EclipseLinkOrmEntityTests.java
+++ /dev/null
@@ -1,2393 +0,0 @@
-/*******************************************************************************
- * Copyright (c) 2008, 2009 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.
- *
- * Contributors:
- * Oracle - initial API and implementation
- *******************************************************************************/
-package org.eclipse.jpt.eclipselink.core.tests.internal.context.orm;
-
-import java.util.Iterator;
-import java.util.ListIterator;
-import org.eclipse.jdt.core.ICompilationUnit;
-import org.eclipse.jpt.core.MappingKeys;
-import org.eclipse.jpt.core.context.orm.OrmPersistentType;
-import org.eclipse.jpt.core.resource.java.JPA;
-import org.eclipse.jpt.eclipselink.core.context.CacheCoordinationType;
-import org.eclipse.jpt.eclipselink.core.context.CacheType;
-import org.eclipse.jpt.eclipselink.core.context.Caching;
-import org.eclipse.jpt.eclipselink.core.context.ChangeTrackingType;
-import org.eclipse.jpt.eclipselink.core.context.CustomConverter;
-import org.eclipse.jpt.eclipselink.core.context.ExistenceType;
-import org.eclipse.jpt.eclipselink.core.context.ExpiryTimeOfDay;
-import org.eclipse.jpt.eclipselink.core.context.ObjectTypeConverter;
-import org.eclipse.jpt.eclipselink.core.context.StructConverter;
-import org.eclipse.jpt.eclipselink.core.context.TypeConverter;
-import org.eclipse.jpt.eclipselink.core.context.java.EclipseLinkJavaEntity;
-import org.eclipse.jpt.eclipselink.core.context.java.JavaCaching;
-import org.eclipse.jpt.eclipselink.core.internal.context.orm.ConverterHolder;
-import org.eclipse.jpt.eclipselink.core.internal.context.orm.EclipseLinkOrmEntity;
-import org.eclipse.jpt.eclipselink.core.internal.context.persistence.EclipseLinkPersistenceUnit;
-import org.eclipse.jpt.eclipselink.core.resource.java.EclipseLinkJPA;
-import org.eclipse.jpt.eclipselink.core.resource.orm.EclipseLinkOrmFactory;
-import org.eclipse.jpt.eclipselink.core.resource.orm.XmlChangeTrackingType;
-import org.eclipse.jpt.eclipselink.core.resource.orm.XmlConverter;
-import org.eclipse.jpt.eclipselink.core.resource.orm.XmlEntity;
-import org.eclipse.jpt.eclipselink.core.resource.orm.XmlObjectTypeConverter;
-import org.eclipse.jpt.eclipselink.core.resource.orm.XmlStructConverter;
-import org.eclipse.jpt.eclipselink.core.resource.orm.XmlTypeConverter;
-import org.eclipse.jpt.utility.internal.CollectionTools;
-import org.eclipse.jpt.utility.internal.iterators.ArrayIterator;
-
-@SuppressWarnings("nls")
-public class EclipseLinkOrmEntityTests extends EclipseLinkOrmContextModelTestCase
-{
-
-
- public EclipseLinkOrmEntityTests(String name) {
- super(name);
- }
-
- private ICompilationUnit createTestEntityForReadOnly() throws Exception {
- return this.createTestType(new DefaultAnnotationWriter() {
- @Override
- public Iterator<String> imports() {
- return new ArrayIterator<String>(JPA.ENTITY, EclipseLinkJPA.READ_ONLY);
- }
- @Override
- public void appendTypeAnnotationTo(StringBuilder sb) {
- sb.append("@Entity").append(CR);
- }
- });
- }
-
- private ICompilationUnit createTestEntityForCustomizer() throws Exception {
- return this.createTestType(new DefaultAnnotationWriter() {
- @Override
- public Iterator<String> imports() {
- return new ArrayIterator<String>(JPA.ENTITY, EclipseLinkJPA.CUSTOMIZER);
- }
- @Override
- public void appendTypeAnnotationTo(StringBuilder sb) {
- sb.append("@Entity").append(CR);
- }
- });
- }
-
- private ICompilationUnit createTestEntityForChangeTracking() throws Exception {
- return this.createTestType(new DefaultAnnotationWriter() {
- @Override
- public Iterator<String> imports() {
- return new ArrayIterator<String>(JPA.ENTITY, EclipseLinkJPA.CHANGE_TRACKING);
- }
-
- @Override
- public void appendTypeAnnotationTo(StringBuilder sb) {
- sb.append("@Entity").append(CR);
- }
- });
- }
-
- private ICompilationUnit createTestEntityForCaching() 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").append(CR);
- }
- });
- }
-
- private ICompilationUnit createTestEntityForConverters() 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").append(CR);
- }
- });
- }
-
- private ICompilationUnit createTestEntityForTypeConverters() 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").append(CR);
- }
- });
- }
-
- private ICompilationUnit createTestEntityForObjectTypeConverters() 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").append(CR);
- }
- });
- }
-
- private ICompilationUnit createTestEntityForStructConverters() 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").append(CR);
- }
- });
- }
-
- public void testUpdateReadOnly() throws Exception {
- createTestEntityForReadOnly();
- OrmPersistentType ormPersistentType = getEntityMappings().addPersistentType(MappingKeys.ENTITY_TYPE_MAPPING_KEY, FULLY_QUALIFIED_TYPE_NAME);
- EclipseLinkJavaEntity javaContextEntity = (EclipseLinkJavaEntity) ormPersistentType.getJavaPersistentType().getMapping();
- EclipseLinkOrmEntity ormContextEntity = (EclipseLinkOrmEntity) ormPersistentType.getMapping();
- XmlEntity resourceEntity = (XmlEntity) getXmlEntityMappings().getEntities().get(0);
-
- // check defaults
-
- assertNull(resourceEntity.getReadOnly());
- assertFalse(javaContextEntity.getReadOnly().isReadOnly());
- assertFalse(ormContextEntity.getReadOnly().isReadOnly());
- assertFalse(ormContextEntity.getReadOnly().isDefaultReadOnly());
- assertNull(ormContextEntity.getReadOnly().getSpecifiedReadOnly());
-
- // set xml read only to false, check override
-
- resourceEntity.setReadOnly(Boolean.FALSE);
-
- assertEquals(Boolean.FALSE, resourceEntity.getReadOnly());
- assertFalse(javaContextEntity.getReadOnly().isReadOnly());
- assertFalse(ormContextEntity.getReadOnly().isReadOnly());
- assertFalse(ormContextEntity.getReadOnly().isDefaultReadOnly());
- assertEquals(Boolean.FALSE, ormContextEntity.getReadOnly().getSpecifiedReadOnly());
-
- // set xml read only to true, check override
-
- resourceEntity.setReadOnly(Boolean.TRUE);
-
- assertEquals(Boolean.TRUE, resourceEntity.getReadOnly());
- assertFalse(javaContextEntity.getReadOnly().isReadOnly());
- assertTrue(ormContextEntity.getReadOnly().isReadOnly());
- assertFalse(ormContextEntity.getReadOnly().isDefaultReadOnly());
- assertEquals(Boolean.TRUE, ormContextEntity.getReadOnly().getSpecifiedReadOnly());
-
- // clear xml read only, set java read only to true, check defaults
-
- resourceEntity.setReadOnly(null);
- javaContextEntity.getReadOnly().setSpecifiedReadOnly(Boolean.TRUE);
-
- assertNull(resourceEntity.getReadOnly());
- assertTrue(javaContextEntity.getReadOnly().isReadOnly());
- assertTrue(ormContextEntity.getReadOnly().isReadOnly());
- assertTrue(ormContextEntity.getReadOnly().isDefaultReadOnly());
- assertNull(ormContextEntity.getReadOnly().getSpecifiedReadOnly());
-
- // set metadataComplete to True, check defaults not from java
-
- ormContextEntity.setSpecifiedMetadataComplete(Boolean.TRUE);
-
- assertNull(resourceEntity.getReadOnly());
- assertTrue(javaContextEntity.getReadOnly().isReadOnly());
- assertFalse(ormContextEntity.getReadOnly().isReadOnly());
- assertFalse(ormContextEntity.getReadOnly().isDefaultReadOnly());
- assertNull(ormContextEntity.getReadOnly().getSpecifiedReadOnly());
-
- ormContextEntity.setSpecifiedMetadataComplete(null);
-
- // set xml read only to false, check override
-
- resourceEntity.setReadOnly(Boolean.FALSE);
-
- assertEquals(Boolean.FALSE, resourceEntity.getReadOnly());
- assertTrue(javaContextEntity.getReadOnly().isReadOnly());
- assertFalse(ormContextEntity.getReadOnly().isReadOnly());
- assertTrue(ormContextEntity.getReadOnly().isDefaultReadOnly());
- assertEquals(Boolean.FALSE, ormContextEntity.getReadOnly().getSpecifiedReadOnly());
-
- // set xml read only to true, check override
-
- resourceEntity.setReadOnly(Boolean.TRUE);
-
- assertEquals(Boolean.TRUE, resourceEntity.getReadOnly());
- assertTrue(javaContextEntity.getReadOnly().isReadOnly());
- assertTrue(ormContextEntity.getReadOnly().isReadOnly());
- assertTrue(ormContextEntity.getReadOnly().isDefaultReadOnly());
- assertEquals(Boolean.TRUE, ormContextEntity.getReadOnly().getSpecifiedReadOnly());
-
- // clear xml read only, set java read only to false, check defaults
-
- resourceEntity.setReadOnly(null);
- javaContextEntity.getReadOnly().setSpecifiedReadOnly(Boolean.FALSE);
-
- assertNull(resourceEntity.getReadOnly());
- assertFalse(javaContextEntity.getReadOnly().isReadOnly());
- assertFalse(ormContextEntity.getReadOnly().isReadOnly());
- assertFalse(ormContextEntity.getReadOnly().isDefaultReadOnly());
- assertNull(ormContextEntity.getReadOnly().getSpecifiedReadOnly());
-
-
-
- // set xml read only to false, check override
-
- resourceEntity.setReadOnly(Boolean.FALSE);
-
- assertEquals(Boolean.FALSE, resourceEntity.getReadOnly());
- assertFalse(javaContextEntity.getReadOnly().isReadOnly());
- assertFalse(ormContextEntity.getReadOnly().isReadOnly());
- assertFalse(ormContextEntity.getReadOnly().isDefaultReadOnly());
- assertEquals(Boolean.FALSE, ormContextEntity.getReadOnly().getSpecifiedReadOnly());
-
- // set xml read only to true, check override
-
- resourceEntity.setReadOnly(Boolean.TRUE);
-
- assertEquals(Boolean.TRUE, resourceEntity.getReadOnly());
- assertFalse(javaContextEntity.getReadOnly().isReadOnly());
- assertTrue(ormContextEntity.getReadOnly().isReadOnly());
- assertFalse(ormContextEntity.getReadOnly().isDefaultReadOnly());
- assertEquals(Boolean.TRUE, ormContextEntity.getReadOnly().getSpecifiedReadOnly());
- }
-
- public void testModifyReadOnly() throws Exception {
- createTestEntityForReadOnly();
- OrmPersistentType ormPersistentType = getEntityMappings().addPersistentType(MappingKeys.ENTITY_TYPE_MAPPING_KEY, FULLY_QUALIFIED_TYPE_NAME);
- EclipseLinkOrmEntity ormContextEntity = (EclipseLinkOrmEntity) ormPersistentType.getMapping();
- XmlEntity resourceEntity = (XmlEntity) getXmlEntityMappings().getEntities().get(0);
-
- // check defaults
-
- assertNull(resourceEntity.getReadOnly());
- assertFalse(ormContextEntity.getReadOnly().isReadOnly());
- assertFalse(ormContextEntity.getReadOnly().isDefaultReadOnly());
- assertNull(ormContextEntity.getReadOnly().getSpecifiedReadOnly());
-
- // set context read only to true, check resource
-
- ormContextEntity.getReadOnly().setSpecifiedReadOnly(Boolean.TRUE);
-
- assertEquals(Boolean.TRUE, resourceEntity.getReadOnly());
- assertTrue(ormContextEntity.getReadOnly().isReadOnly());
- assertFalse(ormContextEntity.getReadOnly().isDefaultReadOnly());
- assertEquals(Boolean.TRUE, ormContextEntity.getReadOnly().getSpecifiedReadOnly());
-
- // set context read only to false, check resource
-
- ormContextEntity.getReadOnly().setSpecifiedReadOnly(Boolean.FALSE);
-
- assertEquals(Boolean.FALSE, resourceEntity.getReadOnly());
- assertFalse(ormContextEntity.getReadOnly().isReadOnly());
- assertFalse(ormContextEntity.getReadOnly().isDefaultReadOnly());
- assertEquals(Boolean.FALSE, ormContextEntity.getReadOnly().getSpecifiedReadOnly());
-
- // set context read only to null, check resource
-
- ormContextEntity.getReadOnly().setSpecifiedReadOnly(null);
-
- assertNull(resourceEntity.getReadOnly());
- assertFalse(ormContextEntity.getReadOnly().isReadOnly());
- assertFalse(ormContextEntity.getReadOnly().isDefaultReadOnly());
- assertNull(ormContextEntity.getReadOnly().getSpecifiedReadOnly());
- }
-
-
- public void testUpdateCustomizerClass() throws Exception {
- createTestEntityForCustomizer();
- OrmPersistentType ormPersistentType = getEntityMappings().addPersistentType(MappingKeys.ENTITY_TYPE_MAPPING_KEY, FULLY_QUALIFIED_TYPE_NAME);
- EclipseLinkJavaEntity javaContextEntity = (EclipseLinkJavaEntity) ormPersistentType.getJavaPersistentType().getMapping();
- EclipseLinkOrmEntity ormContextEntity = (EclipseLinkOrmEntity) ormPersistentType.getMapping();
- XmlEntity resourceEntity = (XmlEntity) getXmlEntityMappings().getEntities().get(0);
-
-
- // check defaults
-
- assertNull(resourceEntity.getCustomizer());
- assertNull(javaContextEntity.getCustomizer().getCustomizerClass());
- assertNull(ormContextEntity.getCustomizer().getCustomizerClass());
- assertNull(ormContextEntity.getCustomizer().getDefaultCustomizerClass());
- assertNull(ormContextEntity.getCustomizer().getSpecifiedCustomizerClass());
-
- // set xml customizer, check defaults
- resourceEntity.setCustomizer(EclipseLinkOrmFactory.eINSTANCE.createXmlCustomizer());
- assertNull(resourceEntity.getCustomizer().getCustomizerClassName());
- assertNull(javaContextEntity.getCustomizer().getCustomizerClass());
- assertNull(ormContextEntity.getCustomizer().getCustomizerClass());
- assertNull(ormContextEntity.getCustomizer().getDefaultCustomizerClass());
- assertNull(ormContextEntity.getCustomizer().getSpecifiedCustomizerClass());
-
-
- // set xml customizer class, check override
-
- resourceEntity.getCustomizer().setCustomizerClassName("foo");
-
- assertEquals("foo", resourceEntity.getCustomizer().getCustomizerClassName());
- assertNull(javaContextEntity.getCustomizer().getCustomizerClass());
- assertEquals("foo", ormContextEntity.getCustomizer().getCustomizerClass());
- assertNull(ormContextEntity.getCustomizer().getDefaultCustomizerClass());
- assertEquals("foo", ormContextEntity.getCustomizer().getSpecifiedCustomizerClass());
-
- // clear xml customizer class, set java customizer class, check defaults
-
- resourceEntity.getCustomizer().setCustomizerClassName(null);
- javaContextEntity.getCustomizer().setSpecifiedCustomizerClass("bar");
-
- assertNull(resourceEntity.getCustomizer().getCustomizerClassName());
- assertEquals("bar", javaContextEntity.getCustomizer().getCustomizerClass());
- assertEquals("bar", ormContextEntity.getCustomizer().getCustomizerClass());
- assertEquals("bar", ormContextEntity.getCustomizer().getDefaultCustomizerClass());
- assertNull(ormContextEntity.getCustomizer().getSpecifiedCustomizerClass());
-
- // set metadataComplete to True, check defaults not from java
-
- ormContextEntity.setSpecifiedMetadataComplete(Boolean.TRUE);
-
- assertNull(resourceEntity.getCustomizer().getCustomizerClassName());
- assertEquals("bar", javaContextEntity.getCustomizer().getCustomizerClass());
- assertNull(ormContextEntity.getCustomizer().getCustomizerClass());
- assertNull(ormContextEntity.getCustomizer().getDefaultCustomizerClass());
- assertNull(ormContextEntity.getCustomizer().getSpecifiedCustomizerClass());
-
- ormContextEntity.setSpecifiedMetadataComplete(null);
-
- // set xml customizer class, check override
-
- resourceEntity.getCustomizer().setCustomizerClassName("foo");
-
- assertEquals("foo", resourceEntity.getCustomizer().getCustomizerClassName());
- assertEquals("bar", javaContextEntity.getCustomizer().getCustomizerClass());
- assertEquals("foo", ormContextEntity.getCustomizer().getCustomizerClass());
- assertEquals("bar", ormContextEntity.getCustomizer().getDefaultCustomizerClass());
- assertEquals("foo", ormContextEntity.getCustomizer().getSpecifiedCustomizerClass());
-
- //set xml customizer null
- javaContextEntity.getCustomizer().setSpecifiedCustomizerClass(null);
- resourceEntity.setCustomizer(null);
- assertNull(resourceEntity.getCustomizer());
- assertNull(javaContextEntity.getCustomizer().getCustomizerClass());
- assertNull(ormContextEntity.getCustomizer().getCustomizerClass());
- assertNull(ormContextEntity.getCustomizer().getDefaultCustomizerClass());
- assertNull(ormContextEntity.getCustomizer().getSpecifiedCustomizerClass());
-
- }
-
- public void testModifyCustomizerClass() throws Exception {
- createTestEntityForCustomizer();
- OrmPersistentType ormPersistentType = getEntityMappings().addPersistentType(MappingKeys.ENTITY_TYPE_MAPPING_KEY, FULLY_QUALIFIED_TYPE_NAME);
- EclipseLinkOrmEntity ormContextEntity = (EclipseLinkOrmEntity) ormPersistentType.getMapping();
- XmlEntity resourceEntity = (XmlEntity) getXmlEntityMappings().getEntities().get(0);
-
- // check defaults
-
- assertNull(resourceEntity.getCustomizer());
- assertNull(ormContextEntity.getCustomizer().getCustomizerClass());
- assertNull(ormContextEntity.getCustomizer().getDefaultCustomizerClass());
- assertNull(ormContextEntity.getCustomizer().getSpecifiedCustomizerClass());
-
- // set context customizer, check resource
-
- ormContextEntity.getCustomizer().setSpecifiedCustomizerClass("foo");
-
- assertEquals("foo", resourceEntity.getCustomizer().getCustomizerClassName());
- assertEquals("foo", ormContextEntity.getCustomizer().getCustomizerClass());
- assertNull(ormContextEntity.getCustomizer().getDefaultCustomizerClass());
- assertEquals("foo", ormContextEntity.getCustomizer().getSpecifiedCustomizerClass());
-
- // set context customizer to null, check resource
-
- ormContextEntity.getCustomizer().setSpecifiedCustomizerClass(null);
-
- assertNull(resourceEntity.getCustomizer());
- assertNull(ormContextEntity.getCustomizer().getCustomizerClass());
- assertNull(ormContextEntity.getCustomizer().getDefaultCustomizerClass());
- assertNull(ormContextEntity.getCustomizer().getSpecifiedCustomizerClass());
- }
-
- public void testUpdateChangeTracking() throws Exception {
- createTestEntityForChangeTracking();
- OrmPersistentType ormPersistentType = getEntityMappings().addPersistentType(MappingKeys.ENTITY_TYPE_MAPPING_KEY, FULLY_QUALIFIED_TYPE_NAME);
- EclipseLinkJavaEntity javaContextEntity = (EclipseLinkJavaEntity) ormPersistentType.getJavaPersistentType().getMapping();
- EclipseLinkOrmEntity ormContextEntity = (EclipseLinkOrmEntity) ormPersistentType.getMapping();
- XmlEntity resourceEntity = (XmlEntity) getXmlEntityMappings().getEntities().get(0);
-
- // check defaults
-
- assertNull(resourceEntity.getChangeTracking());
- assertEquals(ChangeTrackingType.AUTO, javaContextEntity.getChangeTracking().getType());
- assertEquals(ChangeTrackingType.AUTO, ormContextEntity.getChangeTracking().getType());
- assertEquals(ChangeTrackingType.AUTO, ormContextEntity.getChangeTracking().getDefaultType());
- assertNull(ormContextEntity.getChangeTracking().getSpecifiedType());
-
- // set xml type to ATTRIBUTE, check context
-
- resourceEntity.setChangeTracking(EclipseLinkOrmFactory.eINSTANCE.createXmlChangeTracking());
- resourceEntity.getChangeTracking().setType(XmlChangeTrackingType.ATTRIBUTE);
-
- assertEquals(XmlChangeTrackingType.ATTRIBUTE, resourceEntity.getChangeTracking().getType());
- assertEquals(ChangeTrackingType.AUTO, javaContextEntity.getChangeTracking().getType());
- assertEquals(ChangeTrackingType.ATTRIBUTE, ormContextEntity.getChangeTracking().getType());
- assertEquals(ChangeTrackingType.AUTO, ormContextEntity.getChangeTracking().getDefaultType());
- assertEquals(ChangeTrackingType.ATTRIBUTE, ormContextEntity.getChangeTracking().getSpecifiedType());
-
- // set xml type to OBJECT, check context
-
- resourceEntity.getChangeTracking().setType(XmlChangeTrackingType.OBJECT);
-
- assertEquals(XmlChangeTrackingType.OBJECT, resourceEntity.getChangeTracking().getType());
- assertEquals(ChangeTrackingType.AUTO, javaContextEntity.getChangeTracking().getType());
- assertEquals(ChangeTrackingType.OBJECT, ormContextEntity.getChangeTracking().getType());
- assertEquals(ChangeTrackingType.AUTO, ormContextEntity.getChangeTracking().getDefaultType());
- assertEquals(ChangeTrackingType.OBJECT, ormContextEntity.getChangeTracking().getSpecifiedType());
-
- // set xml type to DEFERRED, check context
-
- resourceEntity.getChangeTracking().setType(XmlChangeTrackingType.DEFERRED);
-
- assertEquals(XmlChangeTrackingType.DEFERRED, resourceEntity.getChangeTracking().getType());
- assertEquals(ChangeTrackingType.AUTO, javaContextEntity.getChangeTracking().getType());
- assertEquals(ChangeTrackingType.DEFERRED, ormContextEntity.getChangeTracking().getType());
- assertEquals(ChangeTrackingType.AUTO, ormContextEntity.getChangeTracking().getDefaultType());
- assertEquals(ChangeTrackingType.DEFERRED, ormContextEntity.getChangeTracking().getSpecifiedType());
-
- // set xml type to AUTO, check context
-
- resourceEntity.getChangeTracking().setType(XmlChangeTrackingType.AUTO);
-
- assertEquals(XmlChangeTrackingType.AUTO, resourceEntity.getChangeTracking().getType());
- assertEquals(ChangeTrackingType.AUTO, javaContextEntity.getChangeTracking().getType());
- assertEquals(ChangeTrackingType.AUTO, ormContextEntity.getChangeTracking().getType());
- assertEquals(ChangeTrackingType.AUTO, ormContextEntity.getChangeTracking().getDefaultType());
- assertEquals(ChangeTrackingType.AUTO, ormContextEntity.getChangeTracking().getSpecifiedType());
-
- // clear xml change tracking, set java change tracking, check defaults
-
- resourceEntity.setChangeTracking(null);
- javaContextEntity.getChangeTracking().setSpecifiedType(ChangeTrackingType.ATTRIBUTE);
-
- assertNull(resourceEntity.getChangeTracking());
- assertEquals(ChangeTrackingType.ATTRIBUTE, javaContextEntity.getChangeTracking().getType());
- assertEquals(ChangeTrackingType.ATTRIBUTE, ormContextEntity.getChangeTracking().getType());
- assertEquals(ChangeTrackingType.ATTRIBUTE, ormContextEntity.getChangeTracking().getDefaultType());
- assertNull(ormContextEntity.getChangeTracking().getSpecifiedType());
-
- // set metadataComplete to True, check defaults not from java
-
- ormContextEntity.setSpecifiedMetadataComplete(Boolean.TRUE);
-
- assertNull(resourceEntity.getChangeTracking());
- assertEquals(ChangeTrackingType.ATTRIBUTE, javaContextEntity.getChangeTracking().getType());
- assertEquals(ChangeTrackingType.AUTO, ormContextEntity.getChangeTracking().getType());
- assertEquals(ChangeTrackingType.AUTO, ormContextEntity.getChangeTracking().getDefaultType());
- assertNull(ormContextEntity.getChangeTracking().getSpecifiedType());
-
- // unset metadataComplete, set xml change tracking to OBJECT, check context
-
- ormContextEntity.setSpecifiedMetadataComplete(null);
- resourceEntity.setChangeTracking(EclipseLinkOrmFactory.eINSTANCE.createXmlChangeTracking());
- resourceEntity.getChangeTracking().setType(XmlChangeTrackingType.OBJECT);
-
- assertEquals(XmlChangeTrackingType.OBJECT, resourceEntity.getChangeTracking().getType());
- assertEquals(ChangeTrackingType.ATTRIBUTE, javaContextEntity.getChangeTracking().getType());
- assertEquals(ChangeTrackingType.OBJECT, ormContextEntity.getChangeTracking().getType());
- assertEquals(ChangeTrackingType.ATTRIBUTE, ormContextEntity.getChangeTracking().getDefaultType());
- assertEquals(ChangeTrackingType.OBJECT, ormContextEntity.getChangeTracking().getSpecifiedType());
- }
-
- public void testModifyChangeTracking() throws Exception {
- createTestEntityForChangeTracking();
- OrmPersistentType ormPersistentType = getEntityMappings().addPersistentType(MappingKeys.ENTITY_TYPE_MAPPING_KEY, FULLY_QUALIFIED_TYPE_NAME);
- EclipseLinkOrmEntity ormContextEntity = (EclipseLinkOrmEntity) ormPersistentType.getMapping();
- XmlEntity resourceEntity = (XmlEntity) getXmlEntityMappings().getEntities().get(0);
-
- // check defaults
-
- assertNull(resourceEntity.getChangeTracking());
- assertEquals(ChangeTrackingType.AUTO, ormContextEntity.getChangeTracking().getType());
- assertEquals(ChangeTrackingType.AUTO, ormContextEntity.getChangeTracking().getDefaultType());
- assertNull(ormContextEntity.getChangeTracking().getSpecifiedType());
-
- // set context change tracking to ATTRIBUTE, check resource
-
- ormContextEntity.getChangeTracking().setSpecifiedType(ChangeTrackingType.ATTRIBUTE);
-
- assertEquals(XmlChangeTrackingType.ATTRIBUTE, resourceEntity.getChangeTracking().getType());
- assertEquals(ChangeTrackingType.ATTRIBUTE, ormContextEntity.getChangeTracking().getType());
- assertEquals(ChangeTrackingType.AUTO, ormContextEntity.getChangeTracking().getDefaultType());
- assertEquals(ChangeTrackingType.ATTRIBUTE, ormContextEntity.getChangeTracking().getSpecifiedType());
-
- // set context change tracking to OBJECT, check resource
-
- ormContextEntity.getChangeTracking().setSpecifiedType(ChangeTrackingType.OBJECT);
-
- assertEquals(XmlChangeTrackingType.OBJECT, resourceEntity.getChangeTracking().getType());
- assertEquals(ChangeTrackingType.OBJECT, ormContextEntity.getChangeTracking().getType());
- assertEquals(ChangeTrackingType.AUTO, ormContextEntity.getChangeTracking().getDefaultType());
- assertEquals(ChangeTrackingType.OBJECT, ormContextEntity.getChangeTracking().getSpecifiedType());
-
- // set context change tracking to DEFERRED, check resource
-
- ormContextEntity.getChangeTracking().setSpecifiedType(ChangeTrackingType.DEFERRED);
-
- assertEquals(XmlChangeTrackingType.DEFERRED, resourceEntity.getChangeTracking().getType());
- assertEquals(ChangeTrackingType.DEFERRED, ormContextEntity.getChangeTracking().getType());
- assertEquals(ChangeTrackingType.AUTO, ormContextEntity.getChangeTracking().getDefaultType());
- assertEquals(ChangeTrackingType.DEFERRED, ormContextEntity.getChangeTracking().getSpecifiedType());
-
- // set context change tracking to AUTO, check resource
-
- ormContextEntity.getChangeTracking().setSpecifiedType(ChangeTrackingType.AUTO);
-
- assertEquals(XmlChangeTrackingType.AUTO, resourceEntity.getChangeTracking().getType());
- assertEquals(ChangeTrackingType.AUTO, ormContextEntity.getChangeTracking().getType());
- assertEquals(ChangeTrackingType.AUTO, ormContextEntity.getChangeTracking().getDefaultType());
- assertEquals(ChangeTrackingType.AUTO, ormContextEntity.getChangeTracking().getSpecifiedType());
-
- // set context change tracking to null, check resource
-
- ormContextEntity.getChangeTracking().setSpecifiedType(null);
-
- assertNull(resourceEntity.getChangeTracking());
- assertEquals(ChangeTrackingType.AUTO, ormContextEntity.getChangeTracking().getType());
- assertEquals(ChangeTrackingType.AUTO, ormContextEntity.getChangeTracking().getDefaultType());
- assertNull(ormContextEntity.getChangeTracking().getSpecifiedType());
- }
-
- public void testUpdateCacheType() throws Exception {
- createTestEntityForCaching();
- OrmPersistentType ormPersistentType = getEntityMappings().addPersistentType(MappingKeys.ENTITY_TYPE_MAPPING_KEY, FULLY_QUALIFIED_TYPE_NAME);
- JavaCaching javaContextCaching = ((EclipseLinkJavaEntity) ormPersistentType.getJavaPersistentType().getMapping()).getCaching();
- EclipseLinkOrmEntity ormContextEntity = (EclipseLinkOrmEntity) ormPersistentType.getMapping();
- Caching ormContextCaching = ormContextEntity.getCaching();
- XmlEntity resourceEntity = (XmlEntity) getXmlEntityMappings().getEntities().get(0);
-
-
- // check defaults
-
- assertEquals(null, resourceEntity.getCache());
- assertEquals(CacheType.SOFT_WEAK, javaContextCaching.getType());
- assertEquals(CacheType.SOFT_WEAK, ormContextCaching.getType());
- assertEquals(CacheType.SOFT_WEAK, ormContextCaching.getDefaultType());
- assertEquals(null, ormContextCaching.getSpecifiedType());
-
- // set xml cache, check defaults
- resourceEntity.setCache(EclipseLinkOrmFactory.eINSTANCE.createXmlCache());
- assertEquals(null, resourceEntity.getCache().getType());
- assertEquals(CacheType.SOFT_WEAK, javaContextCaching.getType());
- assertEquals(CacheType.SOFT_WEAK, ormContextCaching.getType());
- assertEquals(CacheType.SOFT_WEAK, ormContextCaching.getDefaultType());
- assertEquals(null, ormContextCaching.getSpecifiedType());
-
-
- // set xml cache type, check settings
- resourceEntity.getCache().setType(org.eclipse.jpt.eclipselink.core.resource.orm.CacheType.FULL);
- assertEquals(org.eclipse.jpt.eclipselink.core.resource.orm.CacheType.FULL, resourceEntity.getCache().getType());
- assertEquals(CacheType.SOFT_WEAK, javaContextCaching.getType());
- assertEquals(CacheType.FULL, ormContextCaching.getType());
- assertEquals(CacheType.SOFT_WEAK, ormContextCaching.getDefaultType());
- assertEquals(CacheType.FULL, ormContextCaching.getSpecifiedType());
-
-
- // set java cache type, check defaults
-
- javaContextCaching.setSpecifiedType(CacheType.WEAK);
-
- assertEquals(org.eclipse.jpt.eclipselink.core.resource.orm.CacheType.FULL, resourceEntity.getCache().getType());
- assertEquals(CacheType.WEAK, javaContextCaching.getType());
- assertEquals(CacheType.FULL, ormContextCaching.getType());
- assertEquals(CacheType.SOFT_WEAK, ormContextCaching.getDefaultType());
- assertEquals(CacheType.FULL, ormContextCaching.getSpecifiedType());
-
- // clear xml cache type, check defaults
- resourceEntity.getCache().setType(null);
-
- assertEquals(null, resourceEntity.getCache().getType());
- assertEquals(CacheType.WEAK, javaContextCaching.getType());
- assertEquals(CacheType.SOFT_WEAK, ormContextCaching.getType());
- assertEquals(CacheType.SOFT_WEAK, ormContextCaching.getDefaultType());
- assertEquals(null, ormContextCaching.getSpecifiedType());
-
-
- // clear xml cache, check defaults
- resourceEntity.setCache(null);
-
- assertEquals(null, resourceEntity.getCache());
- assertEquals(CacheType.WEAK, javaContextCaching.getType());
- assertEquals(CacheType.WEAK, ormContextCaching.getType());
- assertEquals(CacheType.WEAK, ormContextCaching.getDefaultType());
- assertEquals(null, ormContextCaching.getSpecifiedType());
-
-
- // set metadataComplete to True, check defaults not from java
-
- ormContextEntity.setSpecifiedMetadataComplete(Boolean.TRUE);
-
- assertEquals(null, resourceEntity.getCache());
- assertEquals(CacheType.WEAK, javaContextCaching.getType());
- assertEquals(CacheType.SOFT_WEAK, ormContextCaching.getType());
- assertEquals(CacheType.SOFT_WEAK, ormContextCaching.getDefaultType());
- assertEquals(null, ormContextCaching.getSpecifiedType());
-
- ormContextEntity.setSpecifiedMetadataComplete(null);
- }
-
- public void testModifyCacheType() throws Exception {
- createTestEntityForCaching();
- OrmPersistentType ormPersistentType = getEntityMappings().addPersistentType(MappingKeys.ENTITY_TYPE_MAPPING_KEY, FULLY_QUALIFIED_TYPE_NAME);
- EclipseLinkOrmEntity ormContextEntity = (EclipseLinkOrmEntity) ormPersistentType.getMapping();
- Caching ormContextCaching = ormContextEntity.getCaching();
- XmlEntity resourceEntity = (XmlEntity) getXmlEntityMappings().getEntities().get(0);
-
- // check defaults
-
- assertEquals(null, resourceEntity.getCache());
- assertEquals(CacheType.SOFT_WEAK, ormContextCaching.getType());
- assertEquals(CacheType.SOFT_WEAK, ormContextCaching.getDefaultType());
- assertEquals(null, ormContextCaching.getSpecifiedType());
-
- // set context cache type, check resource
-
- ormContextEntity.getCaching().setSpecifiedType(CacheType.HARD_WEAK);
- assertEquals(org.eclipse.jpt.eclipselink.core.resource.orm.CacheType.HARD_WEAK, resourceEntity.getCache().getType());
- assertEquals(CacheType.HARD_WEAK, ormContextCaching.getType());
- assertEquals(CacheType.SOFT_WEAK, ormContextCaching.getDefaultType());
- assertEquals(CacheType.HARD_WEAK, ormContextCaching.getSpecifiedType());
-
- // set context customizer to null, check resource
-
- ormContextEntity.getCaching().setSpecifiedType(null);
-
- assertEquals(null, resourceEntity.getCache());
- assertEquals(CacheType.SOFT_WEAK, ormContextCaching.getType());
- assertEquals(CacheType.SOFT_WEAK, ormContextCaching.getDefaultType());
- assertEquals(null, ormContextCaching.getSpecifiedType());
- }
-
- public void testUpdateCacheCoordinationType() throws Exception {
- createTestEntityForCaching();
- OrmPersistentType ormPersistentType = getEntityMappings().addPersistentType(MappingKeys.ENTITY_TYPE_MAPPING_KEY, FULLY_QUALIFIED_TYPE_NAME);
- JavaCaching javaContextCaching = ((EclipseLinkJavaEntity) ormPersistentType.getJavaPersistentType().getMapping()).getCaching();
- EclipseLinkOrmEntity ormContextEntity = (EclipseLinkOrmEntity) ormPersistentType.getMapping();
- Caching ormContextCaching = ormContextEntity.getCaching();
- XmlEntity resourceEntity = (XmlEntity) getXmlEntityMappings().getEntities().get(0);
-
-
- // check defaults
-
- assertEquals(null, resourceEntity.getCache());
- assertEquals(CacheCoordinationType.SEND_OBJECT_CHANGES, javaContextCaching.getCoordinationType());
- assertEquals(CacheCoordinationType.SEND_OBJECT_CHANGES, ormContextCaching.getCoordinationType());
- assertEquals(CacheCoordinationType.SEND_OBJECT_CHANGES, ormContextCaching.getDefaultCoordinationType());
- assertEquals(null, ormContextCaching.getSpecifiedCoordinationType());
-
- // set xml cache, check defaults
- resourceEntity.setCache(EclipseLinkOrmFactory.eINSTANCE.createXmlCache());
- assertEquals(null, resourceEntity.getCache().getCoordinationType());
- assertEquals(CacheCoordinationType.SEND_OBJECT_CHANGES, javaContextCaching.getCoordinationType());
- assertEquals(CacheCoordinationType.SEND_OBJECT_CHANGES, ormContextCaching.getCoordinationType());
- assertEquals(CacheCoordinationType.SEND_OBJECT_CHANGES, ormContextCaching.getDefaultCoordinationType());
- assertEquals(null, ormContextCaching.getSpecifiedCoordinationType());
-
-
- // set xml cache type, check settings
- resourceEntity.getCache().setCoordinationType(org.eclipse.jpt.eclipselink.core.resource.orm.CacheCoordinationType.INVALIDATE_CHANGED_OBJECTS);
- assertEquals(org.eclipse.jpt.eclipselink.core.resource.orm.CacheCoordinationType.INVALIDATE_CHANGED_OBJECTS, resourceEntity.getCache().getCoordinationType());
- assertEquals(CacheCoordinationType.SEND_OBJECT_CHANGES, javaContextCaching.getCoordinationType());
- assertEquals(CacheCoordinationType.INVALIDATE_CHANGED_OBJECTS, ormContextCaching.getCoordinationType());
- assertEquals(CacheCoordinationType.SEND_OBJECT_CHANGES, ormContextCaching.getDefaultCoordinationType());
- assertEquals(CacheCoordinationType.INVALIDATE_CHANGED_OBJECTS, ormContextCaching.getSpecifiedCoordinationType());
-
-
- // set java cache type, check defaults
-
- javaContextCaching.setSpecifiedCoordinationType(CacheCoordinationType.SEND_NEW_OBJECTS_WITH_CHANGES);
-
- assertEquals(org.eclipse.jpt.eclipselink.core.resource.orm.CacheCoordinationType.INVALIDATE_CHANGED_OBJECTS, resourceEntity.getCache().getCoordinationType());
- assertEquals(CacheCoordinationType.SEND_NEW_OBJECTS_WITH_CHANGES, javaContextCaching.getCoordinationType());
- assertEquals(CacheCoordinationType.INVALIDATE_CHANGED_OBJECTS, ormContextCaching.getCoordinationType());
- assertEquals(CacheCoordinationType.SEND_OBJECT_CHANGES, ormContextCaching.getDefaultCoordinationType());
- assertEquals(CacheCoordinationType.INVALIDATE_CHANGED_OBJECTS, ormContextCaching.getSpecifiedCoordinationType());
-
- // clear xml cache type, check defaults
- resourceEntity.getCache().setCoordinationType(null);
-
- assertEquals(null, resourceEntity.getCache().getCoordinationType());
- assertEquals(CacheCoordinationType.SEND_NEW_OBJECTS_WITH_CHANGES, javaContextCaching.getCoordinationType());
- assertEquals(CacheCoordinationType.SEND_OBJECT_CHANGES, ormContextCaching.getCoordinationType());
- assertEquals(CacheCoordinationType.SEND_OBJECT_CHANGES, ormContextCaching.getDefaultCoordinationType());
- assertEquals(null, ormContextCaching.getSpecifiedCoordinationType());
-
-
- // clear xml cache, check defaults
- resourceEntity.setCache(null);
-
- assertEquals(null, resourceEntity.getCache());
- assertEquals(CacheCoordinationType.SEND_NEW_OBJECTS_WITH_CHANGES, javaContextCaching.getCoordinationType());
- assertEquals(CacheCoordinationType.SEND_NEW_OBJECTS_WITH_CHANGES, ormContextCaching.getCoordinationType());
- assertEquals(CacheCoordinationType.SEND_NEW_OBJECTS_WITH_CHANGES, ormContextCaching.getDefaultCoordinationType());
- assertEquals(null, ormContextCaching.getSpecifiedCoordinationType());
-
-
- // set metadataComplete to True, check defaults not from java
-
- ormContextEntity.setSpecifiedMetadataComplete(Boolean.TRUE);
-
- assertEquals(null, resourceEntity.getCache());
- assertEquals(CacheCoordinationType.SEND_NEW_OBJECTS_WITH_CHANGES, javaContextCaching.getCoordinationType());
- assertEquals(CacheCoordinationType.SEND_OBJECT_CHANGES, ormContextCaching.getCoordinationType());
- assertEquals(CacheCoordinationType.SEND_OBJECT_CHANGES, ormContextCaching.getDefaultCoordinationType());
- assertEquals(null, ormContextCaching.getSpecifiedCoordinationType());
-
- ormContextEntity.setSpecifiedMetadataComplete(null);
- }
-
- public void testModifyCacheCoordinationType() throws Exception {
- createTestEntityForCaching();
- OrmPersistentType ormPersistentType = getEntityMappings().addPersistentType(MappingKeys.ENTITY_TYPE_MAPPING_KEY, FULLY_QUALIFIED_TYPE_NAME);
- EclipseLinkOrmEntity ormContextEntity = (EclipseLinkOrmEntity) ormPersistentType.getMapping();
- Caching ormContextCaching = ormContextEntity.getCaching();
- XmlEntity resourceEntity = (XmlEntity) getXmlEntityMappings().getEntities().get(0);
-
- // check defaults
-
- assertEquals(null, resourceEntity.getCache());
- assertEquals(CacheCoordinationType.SEND_OBJECT_CHANGES, ormContextCaching.getCoordinationType());
- assertEquals(CacheCoordinationType.SEND_OBJECT_CHANGES, ormContextCaching.getDefaultCoordinationType());
- assertEquals(null, ormContextCaching.getSpecifiedCoordinationType());
-
- // set context cache coordination type, check resource
-
- ormContextEntity.getCaching().setSpecifiedCoordinationType(CacheCoordinationType.SEND_NEW_OBJECTS_WITH_CHANGES);
- assertEquals(org.eclipse.jpt.eclipselink.core.resource.orm.CacheCoordinationType.SEND_NEW_OBJECTS_WITH_CHANGES, resourceEntity.getCache().getCoordinationType());
- assertEquals(CacheCoordinationType.SEND_NEW_OBJECTS_WITH_CHANGES, ormContextCaching.getCoordinationType());
- assertEquals(CacheCoordinationType.SEND_OBJECT_CHANGES, ormContextCaching.getDefaultCoordinationType());
- assertEquals(CacheCoordinationType.SEND_NEW_OBJECTS_WITH_CHANGES, ormContextCaching.getSpecifiedCoordinationType());
-
- // set context coordination type to null, check resource
-
- ormContextEntity.getCaching().setSpecifiedCoordinationType(null);
-
- assertEquals(null, resourceEntity.getCache());
- assertEquals(CacheCoordinationType.SEND_OBJECT_CHANGES, ormContextCaching.getCoordinationType());
- assertEquals(CacheCoordinationType.SEND_OBJECT_CHANGES, ormContextCaching.getDefaultCoordinationType());
- assertEquals(null, ormContextCaching.getSpecifiedCoordinationType());
- }
-
-
- public void testUpdateCacheSize() throws Exception {
- createTestEntityForCaching();
- OrmPersistentType ormPersistentType = getEntityMappings().addPersistentType(MappingKeys.ENTITY_TYPE_MAPPING_KEY, FULLY_QUALIFIED_TYPE_NAME);
- JavaCaching javaContextCaching = ((EclipseLinkJavaEntity) ormPersistentType.getJavaPersistentType().getMapping()).getCaching();
- EclipseLinkOrmEntity ormContextEntity = (EclipseLinkOrmEntity) ormPersistentType.getMapping();
- Caching ormContextCaching = ormContextEntity.getCaching();
- XmlEntity resourceEntity = (XmlEntity) getXmlEntityMappings().getEntities().get(0);
-
-
- // check defaults
-
- assertEquals(null, resourceEntity.getCache());
- assertEquals(100, javaContextCaching.getSize());
- assertEquals(100, ormContextCaching.getSize());
- assertEquals(100, ormContextCaching.getDefaultSize());
- assertEquals(null, ormContextCaching.getSpecifiedSize());
-
- // set xml cache, check defaults
- resourceEntity.setCache(EclipseLinkOrmFactory.eINSTANCE.createXmlCache());
- assertEquals(null, resourceEntity.getCache().getSize());
- assertEquals(100, javaContextCaching.getSize());
- assertEquals(100, ormContextCaching.getSize());
- assertEquals(100, ormContextCaching.getDefaultSize());
- assertEquals(null, ormContextCaching.getSpecifiedSize());
-
-
- // set xml cache size, check settings
- resourceEntity.getCache().setSize(new Integer(105));
- assertEquals(new Integer(105), resourceEntity.getCache().getSize());
- assertEquals(100, javaContextCaching.getSize());
- assertEquals(105, ormContextCaching.getSize());
- assertEquals(100, ormContextCaching.getDefaultSize());
- assertEquals(new Integer(105), ormContextCaching.getSpecifiedSize());
-
-
- // set java cache size, check defaults
-
- javaContextCaching.setSpecifiedSize(new Integer(50));
-
- assertEquals(new Integer(105), resourceEntity.getCache().getSize());
- assertEquals(50, javaContextCaching.getSize());
- assertEquals(105, ormContextCaching.getSize());
- assertEquals(50, ormContextCaching.getDefaultSize());
- assertEquals(new Integer(105), ormContextCaching.getSpecifiedSize());
-
- // clear xml cache size, check defaults
- resourceEntity.getCache().setSize(null);
-
- assertEquals(null, resourceEntity.getCache().getSize());
- assertEquals(50, javaContextCaching.getSize());
- assertEquals(50, ormContextCaching.getSize());
- assertEquals(50, ormContextCaching.getDefaultSize());
- assertEquals(null, ormContextCaching.getSpecifiedSize());
-
-
- // clear xml cache, check defaults
- resourceEntity.setCache(null);
-
- assertEquals(null, resourceEntity.getCache());
- assertEquals(50, javaContextCaching.getSize());
- assertEquals(50, ormContextCaching.getSize());
- assertEquals(50, ormContextCaching.getDefaultSize());
- assertEquals(null, ormContextCaching.getSpecifiedSize());
-
-
- // set metadataComplete to True, check defaults not from java
-
- ormContextEntity.setSpecifiedMetadataComplete(Boolean.TRUE);
-
- assertEquals(null, resourceEntity.getCache());
- assertEquals(50, javaContextCaching.getSize());
- assertEquals(100, ormContextCaching.getSize());
- assertEquals(100, ormContextCaching.getDefaultSize());
- assertEquals(null, ormContextCaching.getSpecifiedSize());
-
- ormContextEntity.setSpecifiedMetadataComplete(null);
- }
-
- public void testModifyCacheSize() throws Exception {
- createTestEntityForCaching();
- OrmPersistentType ormPersistentType = getEntityMappings().addPersistentType(MappingKeys.ENTITY_TYPE_MAPPING_KEY, FULLY_QUALIFIED_TYPE_NAME);
- EclipseLinkOrmEntity ormContextEntity = (EclipseLinkOrmEntity) ormPersistentType.getMapping();
- Caching ormContextCaching = ormContextEntity.getCaching();
- XmlEntity resourceEntity = (XmlEntity) getXmlEntityMappings().getEntities().get(0);
-
- // check defaults
-
- assertEquals(null, resourceEntity.getCache());
- assertEquals(100, ormContextCaching.getSize());
- assertEquals(100, ormContextCaching.getDefaultSize());
- assertEquals(null, ormContextCaching.getSpecifiedSize());
-
- // set context cache size, check resource
-
- ormContextEntity.getCaching().setSpecifiedSize(new Integer(50));
- assertEquals(new Integer(50), resourceEntity.getCache().getSize());
- assertEquals(50, ormContextCaching.getSize());
- assertEquals(100, ormContextCaching.getDefaultSize());
- assertEquals(new Integer(50), ormContextCaching.getSpecifiedSize());
-
- // set context cache size to null, check resource
-
- ormContextEntity.getCaching().setSpecifiedSize(null);
-
- assertEquals(null, resourceEntity.getCache());
- assertEquals(100, ormContextCaching.getSize());
- assertEquals(100, ormContextCaching.getDefaultSize());
- assertEquals(null, ormContextCaching.getSpecifiedSize());
- }
-
- public void testUpdateCacheAlwaysRefresh() throws Exception {
- createTestEntityForCaching();
- OrmPersistentType ormPersistentType = getEntityMappings().addPersistentType(MappingKeys.ENTITY_TYPE_MAPPING_KEY, FULLY_QUALIFIED_TYPE_NAME);
- JavaCaching javaContextCaching = ((EclipseLinkJavaEntity) ormPersistentType.getJavaPersistentType().getMapping()).getCaching();
- EclipseLinkOrmEntity ormContextEntity = (EclipseLinkOrmEntity) ormPersistentType.getMapping();
- Caching ormContextCaching = ormContextEntity.getCaching();
- XmlEntity resourceEntity = (XmlEntity) getXmlEntityMappings().getEntities().get(0);
-
-
- // check defaults
-
- assertEquals(null, resourceEntity.getCache());
- assertEquals(false, javaContextCaching.isAlwaysRefresh());
- assertEquals(false, ormContextCaching.isAlwaysRefresh());
- assertEquals(false, ormContextCaching.isDefaultAlwaysRefresh());
- assertEquals(null, ormContextCaching.getSpecifiedAlwaysRefresh());
-
- // set xml cache, check defaults
- resourceEntity.setCache(EclipseLinkOrmFactory.eINSTANCE.createXmlCache());
- assertEquals(null, resourceEntity.getCache().getAlwaysRefresh());
- assertEquals(false, javaContextCaching.isAlwaysRefresh());
- assertEquals(false, ormContextCaching.isAlwaysRefresh());
- assertEquals(false, ormContextCaching.isDefaultAlwaysRefresh());
- assertEquals(null, ormContextCaching.getSpecifiedAlwaysRefresh());
-
-
- // set xml cache always refresh, check settings
- resourceEntity.getCache().setAlwaysRefresh(Boolean.TRUE);
- assertEquals(Boolean.TRUE, resourceEntity.getCache().getAlwaysRefresh());
- assertEquals(false, javaContextCaching.isAlwaysRefresh());
- assertEquals(true, ormContextCaching.isAlwaysRefresh());
- assertEquals(false, ormContextCaching.isDefaultAlwaysRefresh());
- assertEquals(Boolean.TRUE, ormContextCaching.getSpecifiedAlwaysRefresh());
-
-
- // set java cache always refresh, check defaults
-
- javaContextCaching.setSpecifiedAlwaysRefresh(Boolean.TRUE);
-
- assertEquals(Boolean.TRUE, resourceEntity.getCache().getAlwaysRefresh());
- assertEquals(true, javaContextCaching.isAlwaysRefresh());
- assertEquals(true, ormContextCaching.isAlwaysRefresh());
- assertEquals(false, ormContextCaching.isDefaultAlwaysRefresh());
- assertEquals(Boolean.TRUE, ormContextCaching.getSpecifiedAlwaysRefresh());
-
- // set xml cache always refresh to false
- resourceEntity.getCache().setAlwaysRefresh(Boolean.FALSE);
- assertEquals(Boolean.FALSE, resourceEntity.getCache().getAlwaysRefresh());
- assertEquals(true, javaContextCaching.isAlwaysRefresh());
- assertEquals(false, ormContextCaching.isAlwaysRefresh());
- assertEquals(false, ormContextCaching.isDefaultAlwaysRefresh());
- assertEquals(Boolean.FALSE, ormContextCaching.getSpecifiedAlwaysRefresh());
-
- // clear xml cache always refresh, check defaults
- resourceEntity.getCache().setAlwaysRefresh(null);
-
- assertEquals(null, resourceEntity.getCache().getAlwaysRefresh());
- assertEquals(true, javaContextCaching.isAlwaysRefresh());
- assertEquals(false, ormContextCaching.isAlwaysRefresh());
- assertEquals(false, ormContextCaching.isDefaultAlwaysRefresh());
- assertEquals(null, ormContextCaching.getSpecifiedAlwaysRefresh());
-
-
- // clear xml cache, check defaults
- resourceEntity.setCache(null);
-
- assertEquals(null, resourceEntity.getCache());
- assertEquals(true, javaContextCaching.isAlwaysRefresh());
- assertEquals(true, ormContextCaching.isAlwaysRefresh());
- assertEquals(true, ormContextCaching.isDefaultAlwaysRefresh());
- assertEquals(null, ormContextCaching.getSpecifiedAlwaysRefresh());
-
-
- // set metadataComplete to True, check defaults not from java
-
- ormContextEntity.setSpecifiedMetadataComplete(Boolean.TRUE);
-
- assertEquals(null, resourceEntity.getCache());
- assertEquals(true, javaContextCaching.isAlwaysRefresh());
- assertEquals(false, ormContextCaching.isAlwaysRefresh());
- assertEquals(false, ormContextCaching.isDefaultAlwaysRefresh());
- assertEquals(null, ormContextCaching.getSpecifiedAlwaysRefresh());
-
-
- // set metadataComplete back to null, check defaults from java
- ormContextEntity.setSpecifiedMetadataComplete(null);
-
- assertEquals(null, resourceEntity.getCache());
- assertEquals(true, javaContextCaching.isAlwaysRefresh());
- assertEquals(true, ormContextCaching.isAlwaysRefresh());
- assertEquals(true, ormContextCaching.isDefaultAlwaysRefresh());
- assertEquals(null, ormContextCaching.getSpecifiedAlwaysRefresh());
- }
-
- public void testModifyCacheAlwaysRefresh() throws Exception {
- createTestEntityForCaching();
- OrmPersistentType ormPersistentType = getEntityMappings().addPersistentType(MappingKeys.ENTITY_TYPE_MAPPING_KEY, FULLY_QUALIFIED_TYPE_NAME);
- EclipseLinkOrmEntity ormContextEntity = (EclipseLinkOrmEntity) ormPersistentType.getMapping();
- Caching ormContextCaching = ormContextEntity.getCaching();
- XmlEntity resourceEntity = (XmlEntity) getXmlEntityMappings().getEntities().get(0);
-
- // check defaults
-
- assertEquals(null, resourceEntity.getCache());
- assertEquals(false, ormContextCaching.isAlwaysRefresh());
- assertEquals(false, ormContextCaching.isDefaultAlwaysRefresh());
- assertEquals(null, ormContextCaching.getSpecifiedAlwaysRefresh());
-
- // set context cache size, check resource
-
- ormContextEntity.getCaching().setSpecifiedAlwaysRefresh(Boolean.TRUE);
- assertEquals(Boolean.TRUE, resourceEntity.getCache().getAlwaysRefresh());
- assertEquals(true, ormContextCaching.isAlwaysRefresh());
- assertEquals(false, ormContextCaching.isDefaultAlwaysRefresh());
- assertEquals(Boolean.TRUE, ormContextCaching.getSpecifiedAlwaysRefresh());
-
- // set context cache size to null, check resource
-
- ormContextEntity.getCaching().setSpecifiedAlwaysRefresh(null);
-
- assertEquals(null, resourceEntity.getCache());
- assertEquals(false, ormContextCaching.isAlwaysRefresh());
- assertEquals(false, ormContextCaching.isDefaultAlwaysRefresh());
- assertEquals(null, ormContextCaching.getSpecifiedAlwaysRefresh());
- }
-
- public void testUpdateCacheRefreshOnlyIfNewer() throws Exception {
- createTestEntityForCaching();
- OrmPersistentType ormPersistentType = getEntityMappings().addPersistentType(MappingKeys.ENTITY_TYPE_MAPPING_KEY, FULLY_QUALIFIED_TYPE_NAME);
- JavaCaching javaContextCaching = ((EclipseLinkJavaEntity) ormPersistentType.getJavaPersistentType().getMapping()).getCaching();
- EclipseLinkOrmEntity ormContextEntity = (EclipseLinkOrmEntity) ormPersistentType.getMapping();
- Caching ormContextCaching = ormContextEntity.getCaching();
- XmlEntity resourceEntity = (XmlEntity) getXmlEntityMappings().getEntities().get(0);
-
-
- // check defaults
-
- assertEquals(null, resourceEntity.getCache());
- assertEquals(false, javaContextCaching.isRefreshOnlyIfNewer());
- assertEquals(false, ormContextCaching.isRefreshOnlyIfNewer());
- assertEquals(false, ormContextCaching.isDefaultRefreshOnlyIfNewer());
- assertEquals(null, ormContextCaching.getSpecifiedRefreshOnlyIfNewer());
-
- // set xml cache, check defaults
- resourceEntity.setCache(EclipseLinkOrmFactory.eINSTANCE.createXmlCache());
- assertEquals(null, resourceEntity.getCache().getRefreshOnlyIfNewer());
- assertEquals(false, javaContextCaching.isRefreshOnlyIfNewer());
- assertEquals(false, ormContextCaching.isRefreshOnlyIfNewer());
- assertEquals(false, ormContextCaching.isDefaultRefreshOnlyIfNewer());
- assertEquals(null, ormContextCaching.getSpecifiedRefreshOnlyIfNewer());
-
-
- // set xml cache size, check settings
- resourceEntity.getCache().setRefreshOnlyIfNewer(Boolean.TRUE);
- assertEquals(Boolean.TRUE, resourceEntity.getCache().getRefreshOnlyIfNewer());
- assertEquals(false, javaContextCaching.isRefreshOnlyIfNewer());
- assertEquals(true, ormContextCaching.isRefreshOnlyIfNewer());
- assertEquals(false, ormContextCaching.isDefaultRefreshOnlyIfNewer());
- assertEquals(Boolean.TRUE, ormContextCaching.getSpecifiedRefreshOnlyIfNewer());
-
-
- // set java cache size, check defaults
-
- javaContextCaching.setSpecifiedRefreshOnlyIfNewer(Boolean.TRUE);
-
- assertEquals(Boolean.TRUE, resourceEntity.getCache().getRefreshOnlyIfNewer());
- assertEquals(true, javaContextCaching.isRefreshOnlyIfNewer());
- assertEquals(true, ormContextCaching.isRefreshOnlyIfNewer());
- assertEquals(false, ormContextCaching.isDefaultRefreshOnlyIfNewer());
- assertEquals(Boolean.TRUE, ormContextCaching.getSpecifiedRefreshOnlyIfNewer());
-
- // set xml cache always refresh to false
- resourceEntity.getCache().setRefreshOnlyIfNewer(Boolean.FALSE);
- assertEquals(Boolean.FALSE, resourceEntity.getCache().getRefreshOnlyIfNewer());
- assertEquals(true, javaContextCaching.isRefreshOnlyIfNewer());
- assertEquals(false, ormContextCaching.isRefreshOnlyIfNewer());
- assertEquals(false, ormContextCaching.isDefaultRefreshOnlyIfNewer());
- assertEquals(Boolean.FALSE, ormContextCaching.getSpecifiedRefreshOnlyIfNewer());
-
- // clear xml cache always refresh, check defaults
- resourceEntity.getCache().setRefreshOnlyIfNewer(null);
-
- assertEquals(null, resourceEntity.getCache().getRefreshOnlyIfNewer());
- assertEquals(true, javaContextCaching.isRefreshOnlyIfNewer());
- assertEquals(false, ormContextCaching.isRefreshOnlyIfNewer());
- assertEquals(false, ormContextCaching.isDefaultRefreshOnlyIfNewer());
- assertEquals(null, ormContextCaching.getSpecifiedRefreshOnlyIfNewer());
-
-
- // clear xml cache, check defaults
- resourceEntity.setCache(null);
-
- assertEquals(null, resourceEntity.getCache());
- assertEquals(true, javaContextCaching.isRefreshOnlyIfNewer());
- assertEquals(true, ormContextCaching.isRefreshOnlyIfNewer());
- assertEquals(true, ormContextCaching.isDefaultRefreshOnlyIfNewer());
- assertEquals(null, ormContextCaching.getSpecifiedRefreshOnlyIfNewer());
-
-
- // set metadataComplete to True, check defaults not from java
-
- ormContextEntity.setSpecifiedMetadataComplete(Boolean.TRUE);
-
- assertEquals(null, resourceEntity.getCache());
- assertEquals(true, javaContextCaching.isRefreshOnlyIfNewer());
- assertEquals(false, ormContextCaching.isRefreshOnlyIfNewer());
- assertEquals(false, ormContextCaching.isDefaultRefreshOnlyIfNewer());
- assertEquals(null, ormContextCaching.getSpecifiedRefreshOnlyIfNewer());
-
-
- // set metadataComplete back to null, check defaults from java
- ormContextEntity.setSpecifiedMetadataComplete(null);
-
- assertEquals(null, resourceEntity.getCache());
- assertEquals(true, javaContextCaching.isRefreshOnlyIfNewer());
- assertEquals(true, ormContextCaching.isRefreshOnlyIfNewer());
- assertEquals(true, ormContextCaching.isDefaultRefreshOnlyIfNewer());
- assertEquals(null, ormContextCaching.getSpecifiedRefreshOnlyIfNewer());
- }
-
- public void testModifyCacheRefreshOnlyIfNewer() throws Exception {
- createTestEntityForCaching();
- OrmPersistentType ormPersistentType = getEntityMappings().addPersistentType(MappingKeys.ENTITY_TYPE_MAPPING_KEY, FULLY_QUALIFIED_TYPE_NAME);
- EclipseLinkOrmEntity ormContextEntity = (EclipseLinkOrmEntity) ormPersistentType.getMapping();
- Caching ormContextCaching = ormContextEntity.getCaching();
- XmlEntity resourceEntity = (XmlEntity) getXmlEntityMappings().getEntities().get(0);
-
- // check defaults
-
- assertEquals(null, resourceEntity.getCache());
- assertEquals(false, ormContextCaching.isRefreshOnlyIfNewer());
- assertEquals(false, ormContextCaching.isDefaultRefreshOnlyIfNewer());
- assertEquals(null, ormContextCaching.getSpecifiedRefreshOnlyIfNewer());
-
- // set context cache size, check resource
-
- ormContextEntity.getCaching().setSpecifiedRefreshOnlyIfNewer(Boolean.TRUE);
- assertEquals(Boolean.TRUE, resourceEntity.getCache().getRefreshOnlyIfNewer());
- assertEquals(true, ormContextCaching.isRefreshOnlyIfNewer());
- assertEquals(false, ormContextCaching.isDefaultRefreshOnlyIfNewer());
- assertEquals(Boolean.TRUE, ormContextCaching.getSpecifiedRefreshOnlyIfNewer());
-
- // set context cache size to null, check resource
-
- ormContextEntity.getCaching().setSpecifiedRefreshOnlyIfNewer(null);
-
- assertEquals(null, resourceEntity.getCache());
- assertEquals(false, ormContextCaching.isRefreshOnlyIfNewer());
- assertEquals(false, ormContextCaching.isDefaultRefreshOnlyIfNewer());
- assertEquals(null, ormContextCaching.getSpecifiedRefreshOnlyIfNewer());
- }
-
- public void testUpdateCacheDisableHits() throws Exception {
- createTestEntityForCaching();
- OrmPersistentType ormPersistentType = getEntityMappings().addPersistentType(MappingKeys.ENTITY_TYPE_MAPPING_KEY, FULLY_QUALIFIED_TYPE_NAME);
- JavaCaching javaContextCaching = ((EclipseLinkJavaEntity) ormPersistentType.getJavaPersistentType().getMapping()).getCaching();
- EclipseLinkOrmEntity ormContextEntity = (EclipseLinkOrmEntity) ormPersistentType.getMapping();
- Caching ormContextCaching = ormContextEntity.getCaching();
- XmlEntity resourceEntity = (XmlEntity) getXmlEntityMappings().getEntities().get(0);
-
-
- // check defaults
-
- assertEquals(null, resourceEntity.getCache());
- assertEquals(false, javaContextCaching.isDisableHits());
- assertEquals(false, ormContextCaching.isDisableHits());
- assertEquals(false, ormContextCaching.isDefaultDisableHits());
- assertEquals(null, ormContextCaching.getSpecifiedDisableHits());
-
- // set xml cache, check defaults
- resourceEntity.setCache(EclipseLinkOrmFactory.eINSTANCE.createXmlCache());
- assertEquals(null, resourceEntity.getCache().getDisableHits());
- assertEquals(false, javaContextCaching.isDisableHits());
- assertEquals(false, ormContextCaching.isDisableHits());
- assertEquals(false, ormContextCaching.isDefaultDisableHits());
- assertEquals(null, ormContextCaching.getSpecifiedDisableHits());
-
-
- // set xml cache size, check settings
- resourceEntity.getCache().setDisableHits(Boolean.TRUE);
- assertEquals(Boolean.TRUE, resourceEntity.getCache().getDisableHits());
- assertEquals(false, javaContextCaching.isDisableHits());
- assertEquals(true, ormContextCaching.isDisableHits());
- assertEquals(false, ormContextCaching.isDefaultDisableHits());
- assertEquals(Boolean.TRUE, ormContextCaching.getSpecifiedDisableHits());
-
-
- // set java cache size, check defaults
-
- javaContextCaching.setSpecifiedDisableHits(Boolean.TRUE);
-
- assertEquals(Boolean.TRUE, resourceEntity.getCache().getDisableHits());
- assertEquals(true, javaContextCaching.isDisableHits());
- assertEquals(true, ormContextCaching.isDisableHits());
- assertEquals(false, ormContextCaching.isDefaultDisableHits());
- assertEquals(Boolean.TRUE, ormContextCaching.getSpecifiedDisableHits());
-
- // set xml cache always refresh to false
- resourceEntity.getCache().setDisableHits(Boolean.FALSE);
- assertEquals(Boolean.FALSE, resourceEntity.getCache().getDisableHits());
- assertEquals(true, javaContextCaching.isDisableHits());
- assertEquals(false, ormContextCaching.isDisableHits());
- assertEquals(false, ormContextCaching.isDefaultDisableHits());
- assertEquals(Boolean.FALSE, ormContextCaching.getSpecifiedDisableHits());
-
- // clear xml cache always refresh, check defaults
- resourceEntity.getCache().setDisableHits(null);
-
- assertEquals(null, resourceEntity.getCache().getDisableHits());
- assertEquals(true, javaContextCaching.isDisableHits());
- assertEquals(false, ormContextCaching.isDisableHits());
- assertEquals(false, ormContextCaching.isDefaultDisableHits());
- assertEquals(null, ormContextCaching.getSpecifiedDisableHits());
-
-
- // clear xml cache, check defaults
- resourceEntity.setCache(null);
-
- assertEquals(null, resourceEntity.getCache());
- assertEquals(true, javaContextCaching.isDisableHits());
- assertEquals(true, ormContextCaching.isDisableHits());
- assertEquals(true, ormContextCaching.isDefaultDisableHits());
- assertEquals(null, ormContextCaching.getSpecifiedDisableHits());
-
-
- // set metadataComplete to True, check defaults not from java
-
- ormContextEntity.setSpecifiedMetadataComplete(Boolean.TRUE);
-
- assertEquals(null, resourceEntity.getCache());
- assertEquals(true, javaContextCaching.isDisableHits());
- assertEquals(false, ormContextCaching.isDisableHits());
- assertEquals(false, ormContextCaching.isDefaultDisableHits());
- assertEquals(null, ormContextCaching.getSpecifiedDisableHits());
-
-
- // set metadataComplete back to null, check defaults from java
- ormContextEntity.setSpecifiedMetadataComplete(null);
-
- assertEquals(null, resourceEntity.getCache());
- assertEquals(true, javaContextCaching.isDisableHits());
- assertEquals(true, ormContextCaching.isDisableHits());
- assertEquals(true, ormContextCaching.isDefaultDisableHits());
- assertEquals(null, ormContextCaching.getSpecifiedDisableHits());
- }
-
- public void testModifyCacheDisableHits() throws Exception {
- createTestEntityForCaching();
- OrmPersistentType ormPersistentType = getEntityMappings().addPersistentType(MappingKeys.ENTITY_TYPE_MAPPING_KEY, FULLY_QUALIFIED_TYPE_NAME);
- EclipseLinkOrmEntity ormContextEntity = (EclipseLinkOrmEntity) ormPersistentType.getMapping();
- Caching ormContextCaching = ormContextEntity.getCaching();
- XmlEntity resourceEntity = (XmlEntity) getXmlEntityMappings().getEntities().get(0);
-
- // check defaults
-
- assertEquals(null, resourceEntity.getCache());
- assertEquals(false, ormContextCaching.isDisableHits());
- assertEquals(false, ormContextCaching.isDefaultDisableHits());
- assertEquals(null, ormContextCaching.getSpecifiedDisableHits());
-
- // set context cache size, check resource
-
- ormContextEntity.getCaching().setSpecifiedDisableHits(Boolean.TRUE);
- assertEquals(Boolean.TRUE, resourceEntity.getCache().getDisableHits());
- assertEquals(true, ormContextCaching.isDisableHits());
- assertEquals(false, ormContextCaching.isDefaultDisableHits());
- assertEquals(Boolean.TRUE, ormContextCaching.getSpecifiedDisableHits());
-
- // set context cache size to null, check resource
-
- ormContextEntity.getCaching().setSpecifiedDisableHits(null);
-
- assertEquals(null, resourceEntity.getCache());
- assertEquals(false, ormContextCaching.isDisableHits());
- assertEquals(false, ormContextCaching.isDefaultDisableHits());
- assertEquals(null, ormContextCaching.getSpecifiedDisableHits());
- }
-
- public void testUpdateCacheShared() throws Exception {
- createTestEntityForCaching();
- OrmPersistentType ormPersistentType = getEntityMappings().addPersistentType(MappingKeys.ENTITY_TYPE_MAPPING_KEY, FULLY_QUALIFIED_TYPE_NAME);
- JavaCaching javaContextCaching = ((EclipseLinkJavaEntity) ormPersistentType.getJavaPersistentType().getMapping()).getCaching();
- EclipseLinkOrmEntity ormContextEntity = (EclipseLinkOrmEntity) ormPersistentType.getMapping();
- Caching ormContextCaching = ormContextEntity.getCaching();
- XmlEntity resourceEntity = (XmlEntity) getXmlEntityMappings().getEntities().get(0);
-
-
- // check defaults
-
- assertEquals(null, resourceEntity.getCache());
- assertEquals(true, javaContextCaching.isShared());
- assertEquals(true, ormContextCaching.isShared());
- assertEquals(true, ormContextCaching.isDefaultShared());
- assertEquals(null, ormContextCaching.getSpecifiedShared());
-
- // set xml cache, check defaults
- resourceEntity.setCache(EclipseLinkOrmFactory.eINSTANCE.createXmlCache());
- assertEquals(null, resourceEntity.getCache().getShared());
- assertEquals(true, javaContextCaching.isShared());
- assertEquals(true, ormContextCaching.isShared());
- assertEquals(true, ormContextCaching.isDefaultShared());
- assertEquals(null, ormContextCaching.getSpecifiedShared());
-
-
- // set xml cache size, check settings
- resourceEntity.getCache().setShared(Boolean.FALSE);
- assertEquals(Boolean.FALSE, resourceEntity.getCache().getShared());
- assertEquals(true, javaContextCaching.isShared());
- assertEquals(false, ormContextCaching.isShared());
- assertEquals(true, ormContextCaching.isDefaultShared());
- assertEquals(Boolean.FALSE, ormContextCaching.getSpecifiedShared());
-
-
- // set java cache size, check defaults
-
- javaContextCaching.setSpecifiedShared(Boolean.FALSE);
-
- assertEquals(Boolean.FALSE, resourceEntity.getCache().getShared());
- assertEquals(false, javaContextCaching.isShared());
- assertEquals(false, ormContextCaching.isShared());
- assertEquals(true, ormContextCaching.isDefaultShared());
- assertEquals(Boolean.FALSE, ormContextCaching.getSpecifiedShared());
-
- // set xml cache always refresh to false
- resourceEntity.getCache().setShared(Boolean.TRUE);
- assertEquals(Boolean.TRUE, resourceEntity.getCache().getShared());
- assertEquals(false, javaContextCaching.isShared());
- assertEquals(true, ormContextCaching.isShared());
- assertEquals(true, ormContextCaching.isDefaultShared());
- assertEquals(Boolean.TRUE, ormContextCaching.getSpecifiedShared());
-
- // clear xml cache always refresh, check defaults
- resourceEntity.getCache().setShared(null);
-
- assertEquals(null, resourceEntity.getCache().getShared());
- assertEquals(false, javaContextCaching.isShared());
- assertEquals(true, ormContextCaching.isShared());
- assertEquals(true, ormContextCaching.isDefaultShared());
- assertEquals(null, ormContextCaching.getSpecifiedShared());
-
-
- // clear xml cache, check defaults
- resourceEntity.setCache(null);
-
- assertEquals(null, resourceEntity.getCache());
- assertEquals(false, javaContextCaching.isShared());
- assertEquals(false, ormContextCaching.isShared());
- assertEquals(false, ormContextCaching.isDefaultShared());
- assertEquals(null, ormContextCaching.getSpecifiedShared());
-
-
- // set metadataComplete to True, check defaults not from java
-
- ormContextEntity.setSpecifiedMetadataComplete(Boolean.TRUE);
-
- assertEquals(null, resourceEntity.getCache());
- assertEquals(false, javaContextCaching.isShared());
- assertEquals(true, ormContextCaching.isShared());
- assertEquals(true, ormContextCaching.isDefaultShared());
- assertEquals(null, ormContextCaching.getSpecifiedShared());
-
-
- // set metadataComplete back to null, check defaults from java
- ormContextEntity.setSpecifiedMetadataComplete(null);
-
- assertEquals(null, resourceEntity.getCache());
- assertEquals(false, javaContextCaching.isShared());
- assertEquals(false, ormContextCaching.isShared());
- assertEquals(false, ormContextCaching.isDefaultShared());
- assertEquals(null, ormContextCaching.getSpecifiedShared());
- }
-
- public void testModifyCacheShared() throws Exception {
- createTestEntityForCaching();
- OrmPersistentType ormPersistentType = getEntityMappings().addPersistentType(MappingKeys.ENTITY_TYPE_MAPPING_KEY, FULLY_QUALIFIED_TYPE_NAME);
- EclipseLinkOrmEntity ormContextEntity = (EclipseLinkOrmEntity) ormPersistentType.getMapping();
- Caching ormContextCaching = ormContextEntity.getCaching();
- XmlEntity resourceEntity = (XmlEntity) getXmlEntityMappings().getEntities().get(0);
-
- // check defaults
-
- assertEquals(null, resourceEntity.getCache());
- assertEquals(true, ormContextCaching.isShared());
- assertEquals(true, ormContextCaching.isDefaultShared());
- assertEquals(null, ormContextCaching.getSpecifiedShared());
-
- // set context cache size, check resource
-
- ormContextEntity.getCaching().setSpecifiedShared(Boolean.FALSE);
- assertEquals(Boolean.FALSE, resourceEntity.getCache().getShared());
- assertEquals(false, ormContextCaching.isShared());
- assertEquals(true, ormContextCaching.isDefaultShared());
- assertEquals(Boolean.FALSE, ormContextCaching.getSpecifiedShared());
-
- // set context cache size to null, check resource
-
- ormContextEntity.getCaching().setSpecifiedShared(null);
-
- assertEquals(null, resourceEntity.getCache());
- assertEquals(true, ormContextCaching.isShared());
- assertEquals(true, ormContextCaching.isDefaultShared());
- assertEquals(null, ormContextCaching.getSpecifiedShared());
- }
- public void testSetSpecifiedSharedFalseUnsetsOtherCacheSettings() throws Exception {
- createTestEntityForCaching();
- OrmPersistentType ormPersistentType = getEntityMappings().addPersistentType(MappingKeys.ENTITY_TYPE_MAPPING_KEY, FULLY_QUALIFIED_TYPE_NAME);
- EclipseLinkOrmEntity ormContextEntity = (EclipseLinkOrmEntity) ormPersistentType.getMapping();
- Caching ormContextCaching = ormContextEntity.getCaching();
- XmlEntity resourceEntity = (XmlEntity) getXmlEntityMappings().getEntities().get(0);
-
- ormContextCaching.setSpecifiedType(CacheType.HARD_WEAK);
- ormContextCaching.setSpecifiedSize(Integer.valueOf(500));
- ormContextCaching.setSpecifiedAlwaysRefresh(Boolean.FALSE);
- ormContextCaching.setSpecifiedRefreshOnlyIfNewer(Boolean.FALSE);
- ormContextCaching.setSpecifiedDisableHits(Boolean.FALSE);
- ormContextCaching.setSpecifiedCoordinationType(CacheCoordinationType.INVALIDATE_CHANGED_OBJECTS);
- ormContextCaching.setSpecifiedExistenceType(ExistenceType.ASSUME_NON_EXISTENCE);
- ormContextCaching.setExpiry(Integer.valueOf(8000));
-
- ormContextCaching.setSpecifiedShared(Boolean.FALSE);
-
- assertEquals(null, ormContextCaching.getSpecifiedType());
- assertEquals(null, ormContextCaching.getSpecifiedSize());
- assertEquals(null, ormContextCaching.getSpecifiedAlwaysRefresh());
- assertEquals(null, ormContextCaching.getSpecifiedRefreshOnlyIfNewer());
- assertEquals(null, ormContextCaching.getSpecifiedDisableHits());
- assertEquals(null, ormContextCaching.getSpecifiedCoordinationType());
- assertEquals(null, ormContextCaching.getExpiry());
-
-
- //existence checking is the only thing that isn't unset when shared is set to false
- assertEquals(ExistenceType.ASSUME_NON_EXISTENCE, ormContextCaching.getSpecifiedExistenceType());
-
- ormContextCaching.setSpecifiedShared(null);
- ExpiryTimeOfDay timeOfDayExpiry = ormContextCaching.addExpiryTimeOfDay();
- timeOfDayExpiry.setHour(Integer.valueOf(5));
-
- ormContextCaching.setSpecifiedShared(Boolean.FALSE);
- assertNull(ormContextCaching.getExpiryTimeOfDay());
- assertEquals(Boolean.FALSE, resourceEntity.getCache().getShared());
- assertNull(resourceEntity.getCache().getExpiryTimeOfDay());
- }
-
- public void testUpdateExistenceChecking() throws Exception {
- createTestEntityForCaching();
- OrmPersistentType ormPersistentType = getEntityMappings().addPersistentType(MappingKeys.ENTITY_TYPE_MAPPING_KEY, FULLY_QUALIFIED_TYPE_NAME);
- JavaCaching javaContextCaching = ((EclipseLinkJavaEntity) ormPersistentType.getJavaPersistentType().getMapping()).getCaching();
- EclipseLinkOrmEntity ormContextEntity = (EclipseLinkOrmEntity) ormPersistentType.getMapping();
- Caching ormContextCaching = ormContextEntity.getCaching();
- XmlEntity resourceEntity = (XmlEntity) getXmlEntityMappings().getEntities().get(0);
-
-
- // check defaults
-
- assertEquals(null, resourceEntity.getExistenceChecking());
- assertEquals(ExistenceType.CHECK_DATABASE, javaContextCaching.getExistenceType());
- assertEquals(ExistenceType.CHECK_DATABASE, ormContextCaching.getExistenceType());
- assertEquals(ExistenceType.CHECK_DATABASE, ormContextCaching.getDefaultExistenceType());
- assertEquals(null, ormContextCaching.getSpecifiedExistenceType());
-
- // set xml existence checking, check settings
- resourceEntity.setExistenceChecking(org.eclipse.jpt.eclipselink.core.resource.orm.ExistenceType.ASSUME_EXISTENCE);
- assertEquals(org.eclipse.jpt.eclipselink.core.resource.orm.ExistenceType.ASSUME_EXISTENCE, resourceEntity.getExistenceChecking());
- assertEquals(ExistenceType.CHECK_DATABASE, javaContextCaching.getExistenceType());
- assertEquals(ExistenceType.ASSUME_EXISTENCE, ormContextCaching.getExistenceType());
- assertEquals(ExistenceType.CHECK_DATABASE, ormContextCaching.getDefaultExistenceType());
- assertEquals(ExistenceType.ASSUME_EXISTENCE, ormContextCaching.getSpecifiedExistenceType());
-
-
- // set java cache existence checking, check defaults
-
- javaContextCaching.setSpecifiedExistenceType(ExistenceType.ASSUME_NON_EXISTENCE);
-
- assertEquals(org.eclipse.jpt.eclipselink.core.resource.orm.ExistenceType.ASSUME_EXISTENCE, resourceEntity.getExistenceChecking());
- assertEquals(ExistenceType.ASSUME_NON_EXISTENCE, javaContextCaching.getExistenceType());
- assertEquals(ExistenceType.ASSUME_EXISTENCE, ormContextCaching.getExistenceType());
- assertEquals(ExistenceType.ASSUME_NON_EXISTENCE, ormContextCaching.getDefaultExistenceType());
- assertEquals(ExistenceType.ASSUME_EXISTENCE, ormContextCaching.getSpecifiedExistenceType());
-
- // clear xml existence checking, check defaults
- resourceEntity.setExistenceChecking(null);
-
- assertEquals(null, resourceEntity.getExistenceChecking());
- assertEquals(ExistenceType.ASSUME_NON_EXISTENCE, javaContextCaching.getExistenceType());
- assertEquals(ExistenceType.ASSUME_NON_EXISTENCE, ormContextCaching.getExistenceType());
- assertEquals(ExistenceType.ASSUME_NON_EXISTENCE, ormContextCaching.getDefaultExistenceType());
- assertEquals(null, ormContextCaching.getSpecifiedExistenceType());
-
- // set metadataComplete to True, check defaults not from java
-
- ormContextEntity.setSpecifiedMetadataComplete(Boolean.TRUE);
-
- assertEquals(null, resourceEntity.getExistenceChecking());
- assertEquals(ExistenceType.ASSUME_NON_EXISTENCE, javaContextCaching.getExistenceType());
- assertEquals(ExistenceType.CHECK_DATABASE, ormContextCaching.getExistenceType());
- assertEquals(ExistenceType.CHECK_DATABASE, ormContextCaching.getDefaultExistenceType());
- assertEquals(null, ormContextCaching.getSpecifiedExistenceType());
-
- ormContextEntity.setSpecifiedMetadataComplete(null);
- }
-
- public void testModifyExistenceChecking() throws Exception {
- createTestEntityForCaching();
- OrmPersistentType ormPersistentType = getEntityMappings().addPersistentType(MappingKeys.ENTITY_TYPE_MAPPING_KEY, FULLY_QUALIFIED_TYPE_NAME);
- EclipseLinkOrmEntity ormContextEntity = (EclipseLinkOrmEntity) ormPersistentType.getMapping();
- Caching ormContextCaching = ormContextEntity.getCaching();
- XmlEntity resourceEntity = (XmlEntity) getXmlEntityMappings().getEntities().get(0);
-
- // check defaults
-
- assertEquals(null, resourceEntity.getExistenceChecking());
- assertEquals(ExistenceType.CHECK_DATABASE, ormContextCaching.getExistenceType());
- assertEquals(ExistenceType.CHECK_DATABASE, ormContextCaching.getDefaultExistenceType());
- assertEquals(null, ormContextCaching.getSpecifiedExistenceType());
-
- // set context cache existence checking, check resource
-
- ormContextEntity.getCaching().setSpecifiedExistenceType(ExistenceType.ASSUME_EXISTENCE);
- assertEquals(org.eclipse.jpt.eclipselink.core.resource.orm.ExistenceType.ASSUME_EXISTENCE, resourceEntity.getExistenceChecking());
- assertEquals(ExistenceType.ASSUME_EXISTENCE, ormContextCaching.getExistenceType());
- assertEquals(ExistenceType.CHECK_DATABASE, ormContextCaching.getDefaultExistenceType());
- assertEquals(ExistenceType.ASSUME_EXISTENCE, ormContextCaching.getSpecifiedExistenceType());
-
- // set context existence checking to null, check resource
-
- ormContextEntity.getCaching().setSpecifiedExistenceType(null);
-
- assertEquals(null, resourceEntity.getExistenceChecking());
- assertEquals(ExistenceType.CHECK_DATABASE, ormContextCaching.getExistenceType());
- assertEquals(ExistenceType.CHECK_DATABASE, ormContextCaching.getDefaultExistenceType());
- assertEquals(null, ormContextCaching.getSpecifiedExistenceType());
- }
-
- public void testUpdateCacheExpiry() throws Exception {
- createTestEntityForCaching();
- OrmPersistentType ormPersistentType = getEntityMappings().addPersistentType(MappingKeys.ENTITY_TYPE_MAPPING_KEY, FULLY_QUALIFIED_TYPE_NAME);
- JavaCaching javaContextCaching = ((EclipseLinkJavaEntity) ormPersistentType.getJavaPersistentType().getMapping()).getCaching();
- EclipseLinkOrmEntity ormContextEntity = (EclipseLinkOrmEntity) ormPersistentType.getMapping();
- Caching ormContextCaching = ormContextEntity.getCaching();
- XmlEntity resourceEntity = (XmlEntity) getXmlEntityMappings().getEntities().get(0);
-
-
- // check defaults
-
- assertEquals(null, resourceEntity.getCache());
- assertEquals(null, javaContextCaching.getExpiry());
- assertEquals(null, ormContextCaching.getExpiry());
-
- // set xml cache, check defaults
- resourceEntity.setCache(EclipseLinkOrmFactory.eINSTANCE.createXmlCache());
- assertEquals(null, resourceEntity.getCache().getExpiry());
- assertEquals(null, javaContextCaching.getExpiry());
- assertEquals(null, ormContextCaching.getExpiry());
-
-
- // set xml cache expiry, check settings
- resourceEntity.getCache().setExpiry(new Integer(45));
- assertEquals(new Integer(45), resourceEntity.getCache().getExpiry());
- assertEquals(null, javaContextCaching.getExpiry());
- assertEquals(new Integer(45), ormContextCaching.getExpiry());
-
-
- // set java cache expiry, check defaults
-
- javaContextCaching.setExpiry(new Integer(55));
-
- assertEquals(new Integer(45), resourceEntity.getCache().getExpiry());
- assertEquals(new Integer(55), javaContextCaching.getExpiry());
- assertEquals(new Integer(45), ormContextCaching.getExpiry());
-
- // clear xml cache expiry to null, check defaults
- resourceEntity.getCache().setExpiry(null);
-
- assertEquals(null, resourceEntity.getCache().getExpiry());
- assertEquals(new Integer(55), javaContextCaching.getExpiry());
- assertEquals(null, ormContextCaching.getExpiry());
-
-
- // clear xml cache, check defaults
- resourceEntity.setCache(null);
-
- assertEquals(null, resourceEntity.getCache());
- assertEquals(new Integer(55), javaContextCaching.getExpiry());
- assertEquals(null, ormContextCaching.getExpiry());
-
-
- // set metadataComplete to True, check defaults not from java
-
- ormContextEntity.setSpecifiedMetadataComplete(Boolean.TRUE);
-
- assertEquals(null, resourceEntity.getCache());
- assertEquals(new Integer(55), javaContextCaching.getExpiry());
- assertEquals(null, ormContextCaching.getExpiry());
-
-
- // set metadataComplete back to null, check defaults from java
- ormContextEntity.setSpecifiedMetadataComplete(null);
-
- assertEquals(null, resourceEntity.getCache());
- assertEquals(new Integer(55), javaContextCaching.getExpiry());
- assertEquals(null, ormContextCaching.getExpiry());
- }
-
- public void testModifyCacheExpiry() throws Exception {
- createTestEntityForCaching();
- OrmPersistentType ormPersistentType = getEntityMappings().addPersistentType(MappingKeys.ENTITY_TYPE_MAPPING_KEY, FULLY_QUALIFIED_TYPE_NAME);
- EclipseLinkOrmEntity ormContextEntity = (EclipseLinkOrmEntity) ormPersistentType.getMapping();
- Caching ormContextCaching = ormContextEntity.getCaching();
- XmlEntity resourceEntity = (XmlEntity) getXmlEntityMappings().getEntities().get(0);
-
- // check defaults
-
- assertEquals(null, resourceEntity.getCache());
- assertEquals(null, ormContextCaching.getExpiry());
-
- // set context cache expiry, check resource
-
- ormContextEntity.getCaching().setExpiry(new Integer(60));
- assertEquals(new Integer(60), resourceEntity.getCache().getExpiry());
- assertEquals(new Integer(60), ormContextCaching.getExpiry());
-
- // set context cache size to null, check resource
-
- ormContextEntity.getCaching().setExpiry(null);
-
- assertEquals(null, resourceEntity.getCache());
- assertEquals(null, ormContextCaching.getExpiry());
- }
-
- public void testUpdateCacheExpiryTimeOfDay() throws Exception {
- createTestEntityForCaching();
- OrmPersistentType ormPersistentType = getEntityMappings().addPersistentType(MappingKeys.ENTITY_TYPE_MAPPING_KEY, FULLY_QUALIFIED_TYPE_NAME);
- JavaCaching javaContextCaching = ((EclipseLinkJavaEntity) ormPersistentType.getJavaPersistentType().getMapping()).getCaching();
- EclipseLinkOrmEntity ormContextEntity = (EclipseLinkOrmEntity) ormPersistentType.getMapping();
- Caching ormContextCaching = ormContextEntity.getCaching();
- XmlEntity resourceEntity = (XmlEntity) getXmlEntityMappings().getEntities().get(0);
-
-
- // check defaults
-
- assertEquals(null, resourceEntity.getCache());
- assertEquals(null, javaContextCaching.getExpiryTimeOfDay());
- assertEquals(null, ormContextCaching.getExpiryTimeOfDay());
-
- // set xml cache, check defaults
- resourceEntity.setCache(EclipseLinkOrmFactory.eINSTANCE.createXmlCache());
- assertEquals(null, resourceEntity.getCache().getExpiryTimeOfDay());
- assertEquals(null, javaContextCaching.getExpiryTimeOfDay());
- assertEquals(null, ormContextCaching.getExpiryTimeOfDay());
-
-
- // set xml cache expiry, check settings
- resourceEntity.getCache().setExpiryTimeOfDay(EclipseLinkOrmFactory.eINSTANCE.createXmlTimeOfDay());
- resourceEntity.getCache().getExpiryTimeOfDay().setHour(new Integer(10));
- assertEquals(new Integer(10), resourceEntity.getCache().getExpiryTimeOfDay().getHour());
- assertEquals(null, javaContextCaching.getExpiryTimeOfDay());
- assertEquals(new Integer(10), ormContextCaching.getExpiryTimeOfDay().getHour());
-
-
- // set java cache expiry, check defaults
-
- javaContextCaching.addExpiryTimeOfDay();
- javaContextCaching.getExpiryTimeOfDay().setHour(new Integer(12));
-
- assertEquals(new Integer(10), resourceEntity.getCache().getExpiryTimeOfDay().getHour());
- assertEquals(new Integer(12), javaContextCaching.getExpiryTimeOfDay().getHour());
- assertEquals(new Integer(10), ormContextCaching.getExpiryTimeOfDay().getHour());
-
- // clear xml cache expiry to null, check defaults
- resourceEntity.getCache().setExpiryTimeOfDay(null);
-
- assertEquals(null, resourceEntity.getCache().getExpiryTimeOfDay());
- assertEquals(new Integer(12), javaContextCaching.getExpiryTimeOfDay().getHour());
- assertEquals(null, ormContextCaching.getExpiryTimeOfDay());
-
-
- // clear xml cache, check defaults
- resourceEntity.setCache(null);
-
- assertEquals(null, resourceEntity.getCache());
- assertEquals(new Integer(12), javaContextCaching.getExpiryTimeOfDay().getHour());
- assertEquals(null, ormContextCaching.getExpiryTimeOfDay());
-
-
- // set metadataComplete to True, check defaults not from java
-
- ormContextEntity.setSpecifiedMetadataComplete(Boolean.TRUE);
-
- assertEquals(null, resourceEntity.getCache());
- assertEquals(new Integer(12), javaContextCaching.getExpiryTimeOfDay().getHour());
- assertEquals(null, ormContextCaching.getExpiryTimeOfDay());
-
-
- // set metadataComplete back to null, check defaults from java
- ormContextEntity.setSpecifiedMetadataComplete(null);
-
- assertEquals(null, resourceEntity.getCache());
- assertEquals(new Integer(12), javaContextCaching.getExpiryTimeOfDay().getHour());
- assertEquals(null, ormContextCaching.getExpiryTimeOfDay());
- }
-
- public void testModifyCacheExpiryTimeOfDay() throws Exception {
- createTestEntityForCaching();
- OrmPersistentType ormPersistentType = getEntityMappings().addPersistentType(MappingKeys.ENTITY_TYPE_MAPPING_KEY, FULLY_QUALIFIED_TYPE_NAME);
- EclipseLinkOrmEntity ormContextEntity = (EclipseLinkOrmEntity) ormPersistentType.getMapping();
- Caching ormContextCaching = ormContextEntity.getCaching();
- XmlEntity resourceEntity = (XmlEntity) getXmlEntityMappings().getEntities().get(0);
-
- // check defaults
-
- assertEquals(null, resourceEntity.getCache());
- assertEquals(null, ormContextCaching.getExpiryTimeOfDay());
-
- // set context cache expiry, check resource
-
- ormContextEntity.getCaching().addExpiryTimeOfDay().setHour(new Integer(12));
- assertEquals(new Integer(12), resourceEntity.getCache().getExpiryTimeOfDay().getHour());
- assertEquals(new Integer(12), ormContextCaching.getExpiryTimeOfDay().getHour());
-
- // set context expiry time of day minute, check resource
-
- ormContextEntity.getCaching().getExpiryTimeOfDay().setMinute(new Integer(35));
-
- assertEquals(new Integer(12), resourceEntity.getCache().getExpiryTimeOfDay().getHour());
- assertEquals(new Integer(12), ormContextCaching.getExpiryTimeOfDay().getHour());
- assertEquals(new Integer(35), resourceEntity.getCache().getExpiryTimeOfDay().getMinute());
- assertEquals(new Integer(35), ormContextCaching.getExpiryTimeOfDay().getMinute());
-
- // set context expiry time of day null, check resource
-
- ormContextEntity.getCaching().removeExpiryTimeOfDay();
- assertEquals(null, resourceEntity.getCache());
- assertEquals(null, ormContextCaching.getExpiryTimeOfDay());
- }
-
- public void testUpdateCustomConverters() throws Exception {
- createTestEntityForConverters();
- EclipseLinkPersistenceUnit persistenceUnit = getPersistenceUnit();
- OrmPersistentType ormPersistentType = getEntityMappings().addPersistentType(MappingKeys.ENTITY_TYPE_MAPPING_KEY, FULLY_QUALIFIED_TYPE_NAME);
- EclipseLinkOrmEntity ormContextEntity = (EclipseLinkOrmEntity) ormPersistentType.getMapping();
- ConverterHolder ormContextConverterHolder = ormContextEntity.getConverterHolder();
- XmlEntity resourceEntity = (XmlEntity) getXmlEntityMappings().getEntities().get(0);
-
- assertEquals(0, ormContextConverterHolder.customConvertersSize());
- assertEquals(0, resourceEntity.getConverters().size());
- assertEquals(0, CollectionTools.size(persistenceUnit.allConverters()));
-
- //add a converter to the resource model, check context model
- XmlConverter resourceConverter = EclipseLinkOrmFactory.eINSTANCE.createXmlConverter();
- resourceEntity.getConverters().add(resourceConverter);
- resourceConverter.setClassName("Foo");
- resourceConverter.setName("myConverter");
-
- assertEquals(1, ormContextConverterHolder.customConvertersSize());
- ListIterator<CustomConverter> ormContextConverters = ormContextConverterHolder.customConverters();
- CustomConverter ormContextConverter = ormContextConverters.next();
- assertEquals("Foo", ormContextConverter.getConverterClass());
- assertEquals("myConverter", ormContextConverter.getName());
- assertEquals(1, resourceEntity.getConverters().size());
- assertEquals(1, CollectionTools.size(persistenceUnit.allConverters()));
-
- //add another converter to the resource model, check context model
- XmlConverter resourceConverter2 = EclipseLinkOrmFactory.eINSTANCE.createXmlConverter();
- resourceEntity.getConverters().add(0, resourceConverter2);
- resourceConverter2.setClassName("Foo2");
- resourceConverter2.setName("myConverter2");
-
- assertEquals(2, ormContextConverterHolder.customConvertersSize());
- ormContextConverters = ormContextConverterHolder.customConverters();
- ormContextConverter = ormContextConverters.next();
- assertEquals("Foo2", ormContextConverter.getConverterClass());
- assertEquals("myConverter2", ormContextConverter.getName());
- ormContextConverter = ormContextConverters.next();
- assertEquals("Foo", ormContextConverter.getConverterClass());
- assertEquals("myConverter", ormContextConverter.getName());
- assertEquals(2, resourceEntity.getConverters().size());
- assertEquals(2, CollectionTools.size(persistenceUnit.allConverters()));
-
- //move a converter in the resource model, check context model
- resourceEntity.getConverters().move(0, 1);
-
- assertEquals(2, ormContextConverterHolder.customConvertersSize());
- ormContextConverters = ormContextConverterHolder.customConverters();
- ormContextConverter = ormContextConverters.next();
- assertEquals("Foo", ormContextConverter.getConverterClass());
- assertEquals("myConverter", ormContextConverter.getName());
- ormContextConverter = ormContextConverters.next();
- assertEquals("Foo2", ormContextConverter.getConverterClass());
- assertEquals("myConverter2", ormContextConverter.getName());
- assertEquals(2, resourceEntity.getConverters().size());
- assertEquals(2, CollectionTools.size(persistenceUnit.allConverters()));
-
- //remove a converter from the resource model, check context model
- resourceEntity.getConverters().remove(0);
-
- assertEquals(1, ormContextConverterHolder.customConvertersSize());
- ormContextConverters = ormContextConverterHolder.customConverters();
- ormContextConverter = ormContextConverters.next();
- assertEquals("Foo2", ormContextConverter.getConverterClass());
- assertEquals("myConverter2", ormContextConverter.getName());
- assertEquals(1, resourceEntity.getConverters().size());
- assertEquals(1, CollectionTools.size(persistenceUnit.allConverters()));
-
- //remove a converter from the resource model, check context model
- resourceEntity.getConverters().remove(resourceConverter2);
-
- assertEquals(0, ormContextConverterHolder.customConvertersSize());
- assertFalse(ormContextConverterHolder.customConverters().hasNext());
- assertEquals(0, resourceEntity.getConverters().size());
- assertEquals(0, CollectionTools.size(persistenceUnit.allConverters()));
- }
-
- public void testModifyCustomConverters() throws Exception {
- createTestEntityForConverters();
- EclipseLinkPersistenceUnit persistenceUnit = getPersistenceUnit();
- OrmPersistentType ormPersistentType = getEntityMappings().addPersistentType(MappingKeys.ENTITY_TYPE_MAPPING_KEY, FULLY_QUALIFIED_TYPE_NAME);
- EclipseLinkOrmEntity ormContextEntity = (EclipseLinkOrmEntity) ormPersistentType.getMapping();
- ConverterHolder ormContextConverterHolder = ormContextEntity.getConverterHolder();
- XmlEntity resourceEntity = (XmlEntity) getXmlEntityMappings().getEntities().get(0);
-
- assertEquals(0, ormContextConverterHolder.customConvertersSize());
- assertEquals(0, resourceEntity.getConverters().size());
- assertEquals(0, CollectionTools.size(persistenceUnit.allConverters()));
-
- //add a converter to the context model, check resource model
- CustomConverter contextConverter = ormContextConverterHolder.addCustomConverter(0);
- contextConverter.setConverterClass("Foo");
- contextConverter.setName("myConverter");
-
- assertEquals(1, resourceEntity.getConverters().size());
- assertEquals("Foo", resourceEntity.getConverters().get(0).getClassName());
- assertEquals("myConverter", resourceEntity.getConverters().get(0).getName());
- assertEquals(1, ormContextConverterHolder.customConvertersSize());
- ListIterator<CustomConverter> ormContextConverters = ormContextConverterHolder.customConverters();
- CustomConverter ormContextConverter = ormContextConverters.next();
- assertEquals("Foo", ormContextConverter.getConverterClass());
- assertEquals("myConverter", ormContextConverter.getName());
- assertEquals(1, CollectionTools.size(persistenceUnit.allConverters()));
-
- //add another converter to the context model, check resource model
- CustomConverter contextConverter2 = ormContextConverterHolder.addCustomConverter(0);
- contextConverter2.setConverterClass("Foo2");
- contextConverter2.setName("myConverter2");
-
- assertEquals(2, resourceEntity.getConverters().size());
- assertEquals("Foo2", resourceEntity.getConverters().get(0).getClassName());
- assertEquals("myConverter2", resourceEntity.getConverters().get(0).getName());
- assertEquals("Foo", resourceEntity.getConverters().get(1).getClassName());
- assertEquals("myConverter", resourceEntity.getConverters().get(1).getName());
- assertEquals(2, ormContextConverterHolder.customConvertersSize());
- ormContextConverters = ormContextConverterHolder.customConverters();
- ormContextConverter = ormContextConverters.next();
- assertEquals("Foo2", ormContextConverter.getConverterClass());
- assertEquals("myConverter2", ormContextConverter.getName());
- ormContextConverter = ormContextConverters.next();
- assertEquals("Foo", ormContextConverter.getConverterClass());
- assertEquals("myConverter", ormContextConverter.getName());
- assertEquals(2, CollectionTools.size(persistenceUnit.allConverters()));
-
- //move a converter in the context model, check resource model
- ormContextConverterHolder.moveCustomConverter(0, 1);
-
- assertEquals(2, resourceEntity.getConverters().size());
- assertEquals("Foo", resourceEntity.getConverters().get(0).getClassName());
- assertEquals("myConverter", resourceEntity.getConverters().get(0).getName());
- assertEquals("Foo2", resourceEntity.getConverters().get(1).getClassName());
- assertEquals("myConverter2", resourceEntity.getConverters().get(1).getName());
- assertEquals(2, ormContextConverterHolder.customConvertersSize());
- ormContextConverters = ormContextConverterHolder.customConverters();
- ormContextConverter = ormContextConverters.next();
- assertEquals("Foo", ormContextConverter.getConverterClass());
- assertEquals("myConverter", ormContextConverter.getName());
- ormContextConverter = ormContextConverters.next();
- assertEquals("Foo2", ormContextConverter.getConverterClass());
- assertEquals("myConverter2", ormContextConverter.getName());
- assertEquals(2, CollectionTools.size(persistenceUnit.allConverters()));
-
- //remove a converter from the context model, check resource model
- ormContextConverterHolder.removeCustomConverter(0);
-
- assertEquals(1, resourceEntity.getConverters().size());
- assertEquals("Foo2", resourceEntity.getConverters().get(0).getClassName());
- assertEquals("myConverter2", resourceEntity.getConverters().get(0).getName());
- assertEquals(1, ormContextConverterHolder.customConvertersSize());
- ormContextConverters = ormContextConverterHolder.customConverters();
- ormContextConverter = ormContextConverters.next();
- assertEquals("Foo2", ormContextConverter.getConverterClass());
- assertEquals("myConverter2", ormContextConverter.getName());
- assertEquals(1, CollectionTools.size(persistenceUnit.allConverters()));
-
- //remove a converter from the context model, check resource model
- ormContextConverterHolder.removeCustomConverter(contextConverter2);
-
- assertEquals(0, ormContextConverterHolder.customConvertersSize());
- assertFalse(ormContextConverterHolder.customConverters().hasNext());
- assertEquals(0, resourceEntity.getConverters().size());
- assertEquals(0, CollectionTools.size(persistenceUnit.allConverters()));
- }
-
- public void testUpdateTypeConverters() throws Exception {
- createTestEntityForTypeConverters();
- EclipseLinkPersistenceUnit persistenceUnit = getPersistenceUnit();
- OrmPersistentType ormPersistentType = getEntityMappings().addPersistentType(MappingKeys.ENTITY_TYPE_MAPPING_KEY, FULLY_QUALIFIED_TYPE_NAME);
- EclipseLinkOrmEntity ormContextEntity = (EclipseLinkOrmEntity) ormPersistentType.getMapping();
- ConverterHolder ormContextConverterHolder = ormContextEntity.getConverterHolder();
- XmlEntity resourceEntity = (XmlEntity) getXmlEntityMappings().getEntities().get(0);
-
- assertEquals(0, ormContextConverterHolder.typeConvertersSize());
- assertEquals(0, resourceEntity.getTypeConverters().size());
- assertEquals(0, CollectionTools.size(persistenceUnit.allConverters()));
-
- //add a converter to the resource model, check context model
- XmlTypeConverter resourceTypeConverter = EclipseLinkOrmFactory.eINSTANCE.createXmlTypeConverter();
- resourceEntity.getTypeConverters().add(resourceTypeConverter);
- resourceTypeConverter.setDataType("Foo");
- resourceTypeConverter.setName("myTypeConverter");
-
- assertEquals(1, ormContextConverterHolder.typeConvertersSize());
- ListIterator<TypeConverter> ormContextTypeConverters = ormContextConverterHolder.typeConverters();
- TypeConverter ormContextTypeConverter = ormContextTypeConverters.next();
- assertEquals("Foo", ormContextTypeConverter.getDataType());
- assertEquals("myTypeConverter", ormContextTypeConverter.getName());
- assertEquals(1, resourceEntity.getTypeConverters().size());
- assertEquals(1, CollectionTools.size(persistenceUnit.allConverters()));
-
- //add another converter to the resource model, check context model
- XmlTypeConverter resourceTypeConverter2 = EclipseLinkOrmFactory.eINSTANCE.createXmlTypeConverter();
- resourceEntity.getTypeConverters().add(0, resourceTypeConverter2);
- resourceTypeConverter2.setDataType("Foo2");
- resourceTypeConverter2.setName("myTypeConverter2");
-
- assertEquals(2, ormContextConverterHolder.typeConvertersSize());
- ormContextTypeConverters = ormContextConverterHolder.typeConverters();
- ormContextTypeConverter = ormContextTypeConverters.next();
- assertEquals("Foo2", ormContextTypeConverter.getDataType());
- assertEquals("myTypeConverter2", ormContextTypeConverter.getName());
- ormContextTypeConverter = ormContextTypeConverters.next();
- assertEquals("Foo", ormContextTypeConverter.getDataType());
- assertEquals("myTypeConverter", ormContextTypeConverter.getName());
- assertEquals(2, resourceEntity.getTypeConverters().size());
- assertEquals(2, CollectionTools.size(persistenceUnit.allConverters()));
-
- //move a converter in the resource model, check context model
- resourceEntity.getTypeConverters().move(0, 1);
-
- assertEquals(2, ormContextConverterHolder.typeConvertersSize());
- ormContextTypeConverters = ormContextConverterHolder.typeConverters();
- ormContextTypeConverter = ormContextTypeConverters.next();
- assertEquals("Foo", ormContextTypeConverter.getDataType());
- assertEquals("myTypeConverter", ormContextTypeConverter.getName());
- ormContextTypeConverter = ormContextTypeConverters.next();
- assertEquals("Foo2", ormContextTypeConverter.getDataType());
- assertEquals("myTypeConverter2", ormContextTypeConverter.getName());
- assertEquals(2, resourceEntity.getTypeConverters().size());
- assertEquals(2, CollectionTools.size(persistenceUnit.allConverters()));
-
- //remove a converter from the resource model, check context model
- resourceEntity.getTypeConverters().remove(0);
-
- assertEquals(1, ormContextConverterHolder.typeConvertersSize());
- ormContextTypeConverters = ormContextConverterHolder.typeConverters();
- ormContextTypeConverter = ormContextTypeConverters.next();
- assertEquals("Foo2", ormContextTypeConverter.getDataType());
- assertEquals("myTypeConverter2", ormContextTypeConverter.getName());
- assertEquals(1, resourceEntity.getTypeConverters().size());
- assertEquals(1, CollectionTools.size(persistenceUnit.allConverters()));
-
- //remove a converter from the resource model, check context model
- resourceEntity.getTypeConverters().remove(resourceTypeConverter2);
-
- assertEquals(0, ormContextConverterHolder.typeConvertersSize());
- assertFalse(ormContextConverterHolder.typeConverters().hasNext());
- assertEquals(0, resourceEntity.getTypeConverters().size());
- assertEquals(0, CollectionTools.size(persistenceUnit.allConverters()));
- }
-
- public void testModifyTypeConverters() throws Exception {
- createTestEntityForTypeConverters();
- EclipseLinkPersistenceUnit persistenceUnit = getPersistenceUnit();
- OrmPersistentType ormPersistentType = getEntityMappings().addPersistentType(MappingKeys.ENTITY_TYPE_MAPPING_KEY, FULLY_QUALIFIED_TYPE_NAME);
- EclipseLinkOrmEntity ormContextEntity = (EclipseLinkOrmEntity) ormPersistentType.getMapping();
- ConverterHolder ormContextConverterHolder = ormContextEntity.getConverterHolder();
- XmlEntity resourceEntity = (XmlEntity) getXmlEntityMappings().getEntities().get(0);
-
- assertEquals(0, ormContextConverterHolder.typeConvertersSize());
- assertEquals(0, resourceEntity.getTypeConverters().size());
- assertEquals(0, CollectionTools.size(persistenceUnit.allConverters()));
-
- //add a converter to the context model, check resource model
- TypeConverter contextTypeConverter = ormContextConverterHolder.addTypeConverter(0);
- contextTypeConverter.setDataType("Foo");
- contextTypeConverter.setName("myTypeConverter");
-
- assertEquals(1, resourceEntity.getTypeConverters().size());
- assertEquals("Foo", resourceEntity.getTypeConverters().get(0).getDataType());
- assertEquals("myTypeConverter", resourceEntity.getTypeConverters().get(0).getName());
- assertEquals(1, ormContextConverterHolder.typeConvertersSize());
- ListIterator<TypeConverter> ormContextTypeConverters = ormContextConverterHolder.typeConverters();
- TypeConverter ormContextTypeConverter = ormContextTypeConverters.next();
- assertEquals("Foo", ormContextTypeConverter.getDataType());
- assertEquals("myTypeConverter", ormContextTypeConverter.getName());
- assertEquals(1, CollectionTools.size(persistenceUnit.allConverters()));
-
- //add another converter to the context model, check resource model
- TypeConverter contextTypeConverter2 = ormContextConverterHolder.addTypeConverter(0);
- contextTypeConverter2.setDataType("Foo2");
- contextTypeConverter2.setName("myTypeConverter2");
-
- assertEquals(2, resourceEntity.getTypeConverters().size());
- assertEquals("Foo2", resourceEntity.getTypeConverters().get(0).getDataType());
- assertEquals("myTypeConverter2", resourceEntity.getTypeConverters().get(0).getName());
- assertEquals("Foo", resourceEntity.getTypeConverters().get(1).getDataType());
- assertEquals("myTypeConverter", resourceEntity.getTypeConverters().get(1).getName());
- assertEquals(2, ormContextConverterHolder.typeConvertersSize());
- ormContextTypeConverters = ormContextConverterHolder.typeConverters();
- ormContextTypeConverter = ormContextTypeConverters.next();
- assertEquals("Foo2", ormContextTypeConverter.getDataType());
- assertEquals("myTypeConverter2", ormContextTypeConverter.getName());
- ormContextTypeConverter = ormContextTypeConverters.next();
- assertEquals("Foo", ormContextTypeConverter.getDataType());
- assertEquals("myTypeConverter", ormContextTypeConverter.getName());
- assertEquals(2, CollectionTools.size(persistenceUnit.allConverters()));
-
- //move a converter in the context model, check resource model
- ormContextConverterHolder.moveTypeConverter(0, 1);
-
- assertEquals(2, resourceEntity.getTypeConverters().size());
- assertEquals("Foo", resourceEntity.getTypeConverters().get(0).getDataType());
- assertEquals("myTypeConverter", resourceEntity.getTypeConverters().get(0).getName());
- assertEquals("Foo2", resourceEntity.getTypeConverters().get(1).getDataType());
- assertEquals("myTypeConverter2", resourceEntity.getTypeConverters().get(1).getName());
- assertEquals(2, ormContextConverterHolder.typeConvertersSize());
- ormContextTypeConverters = ormContextConverterHolder.typeConverters();
- ormContextTypeConverter = ormContextTypeConverters.next();
- assertEquals("Foo", ormContextTypeConverter.getDataType());
- assertEquals("myTypeConverter", ormContextTypeConverter.getName());
- ormContextTypeConverter = ormContextTypeConverters.next();
- assertEquals("Foo2", ormContextTypeConverter.getDataType());
- assertEquals("myTypeConverter2", ormContextTypeConverter.getName());
- assertEquals(2, CollectionTools.size(persistenceUnit.allConverters()));
-
- //remove a converter from the context model, check resource model
- ormContextConverterHolder.removeTypeConverter(0);
-
- assertEquals(1, resourceEntity.getTypeConverters().size());
- assertEquals("Foo2", resourceEntity.getTypeConverters().get(0).getDataType());
- assertEquals("myTypeConverter2", resourceEntity.getTypeConverters().get(0).getName());
- assertEquals(1, ormContextConverterHolder.typeConvertersSize());
- ormContextTypeConverters = ormContextConverterHolder.typeConverters();
- ormContextTypeConverter = ormContextTypeConverters.next();
- assertEquals("Foo2", ormContextTypeConverter.getDataType());
- assertEquals("myTypeConverter2", ormContextTypeConverter.getName());
- assertEquals(1, CollectionTools.size(persistenceUnit.allConverters()));
-
- //remove a converter from the context model, check resource model
- ormContextConverterHolder.removeTypeConverter(contextTypeConverter2);
-
- assertEquals(0, ormContextConverterHolder.typeConvertersSize());
- assertFalse(ormContextConverterHolder.typeConverters().hasNext());
- assertEquals(0, resourceEntity.getTypeConverters().size());
- assertEquals(0, CollectionTools.size(persistenceUnit.allConverters()));
- }
-
- public void testUpdateObjectTypeConverters() throws Exception {
- createTestEntityForObjectTypeConverters();
- EclipseLinkPersistenceUnit persistenceUnit = getPersistenceUnit();
- OrmPersistentType ormPersistentType = getEntityMappings().addPersistentType(MappingKeys.ENTITY_TYPE_MAPPING_KEY, FULLY_QUALIFIED_TYPE_NAME);
- EclipseLinkOrmEntity ormContextEntity = (EclipseLinkOrmEntity) ormPersistentType.getMapping();
- ConverterHolder ormContextConverterHolder = ormContextEntity.getConverterHolder();
- XmlEntity resourceEntity = (XmlEntity) getXmlEntityMappings().getEntities().get(0);
-
- assertEquals(0, ormContextConverterHolder.objectTypeConvertersSize());
- assertEquals(0, resourceEntity.getObjectTypeConverters().size());
- assertEquals(0, CollectionTools.size(persistenceUnit.allConverters()));
-
- //add a converter to the resource model, check context model
- XmlObjectTypeConverter resourceObjectTypeConverter = EclipseLinkOrmFactory.eINSTANCE.createXmlObjectTypeConverter();
- resourceEntity.getObjectTypeConverters().add(resourceObjectTypeConverter);
- resourceObjectTypeConverter.setDataType("Foo");
- resourceObjectTypeConverter.setName("myObjectTypeConverter");
-
- assertEquals(1, ormContextConverterHolder.objectTypeConvertersSize());
- ListIterator<ObjectTypeConverter> ormContextObjectTypeConverters = ormContextConverterHolder.objectTypeConverters();
- ObjectTypeConverter ormContextObjectTypeConverter = ormContextObjectTypeConverters.next();
- assertEquals("Foo", ormContextObjectTypeConverter.getDataType());
- assertEquals("myObjectTypeConverter", ormContextObjectTypeConverter.getName());
- assertEquals(1, resourceEntity.getObjectTypeConverters().size());
- assertEquals(1, CollectionTools.size(persistenceUnit.allConverters()));
-
- //add another converter to the resource model, check context model
- XmlObjectTypeConverter resourceObjectTypeConverter2 = EclipseLinkOrmFactory.eINSTANCE.createXmlObjectTypeConverter();
- resourceEntity.getObjectTypeConverters().add(0, resourceObjectTypeConverter2);
- resourceObjectTypeConverter2.setDataType("Foo2");
- resourceObjectTypeConverter2.setName("myObjectTypeConverter2");
-
- assertEquals(2, ormContextConverterHolder.objectTypeConvertersSize());
- ormContextObjectTypeConverters = ormContextConverterHolder.objectTypeConverters();
- ormContextObjectTypeConverter = ormContextObjectTypeConverters.next();
- assertEquals("Foo2", ormContextObjectTypeConverter.getDataType());
- assertEquals("myObjectTypeConverter2", ormContextObjectTypeConverter.getName());
- ormContextObjectTypeConverter = ormContextObjectTypeConverters.next();
- assertEquals("Foo", ormContextObjectTypeConverter.getDataType());
- assertEquals("myObjectTypeConverter", ormContextObjectTypeConverter.getName());
- assertEquals(2, resourceEntity.getObjectTypeConverters().size());
- assertEquals(2, CollectionTools.size(persistenceUnit.allConverters()));
-
- //move a converter in the resource model, check context model
- resourceEntity.getObjectTypeConverters().move(0, 1);
-
- assertEquals(2, ormContextConverterHolder.objectTypeConvertersSize());
- ormContextObjectTypeConverters = ormContextConverterHolder.objectTypeConverters();
- ormContextObjectTypeConverter = ormContextObjectTypeConverters.next();
- assertEquals("Foo", ormContextObjectTypeConverter.getDataType());
- assertEquals("myObjectTypeConverter", ormContextObjectTypeConverter.getName());
- ormContextObjectTypeConverter = ormContextObjectTypeConverters.next();
- assertEquals("Foo2", ormContextObjectTypeConverter.getDataType());
- assertEquals("myObjectTypeConverter2", ormContextObjectTypeConverter.getName());
- assertEquals(2, resourceEntity.getObjectTypeConverters().size());
- assertEquals(2, CollectionTools.size(persistenceUnit.allConverters()));
-
- //remove a converter from the resource model, check context model
- resourceEntity.getObjectTypeConverters().remove(0);
-
- assertEquals(1, ormContextConverterHolder.objectTypeConvertersSize());
- ormContextObjectTypeConverters = ormContextConverterHolder.objectTypeConverters();
- ormContextObjectTypeConverter = ormContextObjectTypeConverters.next();
- assertEquals("Foo2", ormContextObjectTypeConverter.getDataType());
- assertEquals("myObjectTypeConverter2", ormContextObjectTypeConverter.getName());
- assertEquals(1, resourceEntity.getObjectTypeConverters().size());
- assertEquals(1, CollectionTools.size(persistenceUnit.allConverters()));
-
- //remove a converter from the resource model, check context model
- resourceEntity.getObjectTypeConverters().remove(resourceObjectTypeConverter2);
-
- assertEquals(0, ormContextConverterHolder.objectTypeConvertersSize());
- assertFalse(ormContextConverterHolder.objectTypeConverters().hasNext());
- assertEquals(0, resourceEntity.getObjectTypeConverters().size());
- assertEquals(0, CollectionTools.size(persistenceUnit.allConverters()));
- }
-
- public void testModifyObjectTypeConverters() throws Exception {
- createTestEntityForObjectTypeConverters();
- EclipseLinkPersistenceUnit persistenceUnit = getPersistenceUnit();
- OrmPersistentType ormPersistentType = getEntityMappings().addPersistentType(MappingKeys.ENTITY_TYPE_MAPPING_KEY, FULLY_QUALIFIED_TYPE_NAME);
- EclipseLinkOrmEntity ormContextEntity = (EclipseLinkOrmEntity) ormPersistentType.getMapping();
- ConverterHolder ormContextConverterHolder = ormContextEntity.getConverterHolder();
- XmlEntity resourceEntity = (XmlEntity) getXmlEntityMappings().getEntities().get(0);
-
- assertEquals(0, ormContextConverterHolder.objectTypeConvertersSize());
- assertEquals(0, resourceEntity.getObjectTypeConverters().size());
- assertEquals(0, CollectionTools.size(persistenceUnit.allConverters()));
-
- //add a converter to the context model, check resource model
- ObjectTypeConverter contextObjectTypeConverter = ormContextConverterHolder.addObjectTypeConverter(0);
- contextObjectTypeConverter.setDataType("Foo");
- contextObjectTypeConverter.setName("myObjectTypeConverter");
-
- assertEquals(1, resourceEntity.getObjectTypeConverters().size());
- assertEquals("Foo", resourceEntity.getObjectTypeConverters().get(0).getDataType());
- assertEquals("myObjectTypeConverter", resourceEntity.getObjectTypeConverters().get(0).getName());
- assertEquals(1, ormContextConverterHolder.objectTypeConvertersSize());
- ListIterator<ObjectTypeConverter> ormContextObjectTypeConverters = ormContextConverterHolder.objectTypeConverters();
- ObjectTypeConverter ormContextObjectTypeConverter = ormContextObjectTypeConverters.next();
- assertEquals("Foo", ormContextObjectTypeConverter.getDataType());
- assertEquals("myObjectTypeConverter", ormContextObjectTypeConverter.getName());
- assertEquals(1, CollectionTools.size(persistenceUnit.allConverters()));
-
- //add another converter to the context model, check resource model
- ObjectTypeConverter contextObjectTypeConverter2 = ormContextConverterHolder.addObjectTypeConverter(0);
- contextObjectTypeConverter2.setDataType("Foo2");
- contextObjectTypeConverter2.setName("myObjectTypeConverter2");
-
- assertEquals(2, resourceEntity.getObjectTypeConverters().size());
- assertEquals("Foo2", resourceEntity.getObjectTypeConverters().get(0).getDataType());
- assertEquals("myObjectTypeConverter2", resourceEntity.getObjectTypeConverters().get(0).getName());
- assertEquals("Foo", resourceEntity.getObjectTypeConverters().get(1).getDataType());
- assertEquals("myObjectTypeConverter", resourceEntity.getObjectTypeConverters().get(1).getName());
- assertEquals(2, ormContextConverterHolder.objectTypeConvertersSize());
- ormContextObjectTypeConverters = ormContextConverterHolder.objectTypeConverters();
- ormContextObjectTypeConverter = ormContextObjectTypeConverters.next();
- assertEquals("Foo2", ormContextObjectTypeConverter.getDataType());
- assertEquals("myObjectTypeConverter2", ormContextObjectTypeConverter.getName());
- ormContextObjectTypeConverter = ormContextObjectTypeConverters.next();
- assertEquals("Foo", ormContextObjectTypeConverter.getDataType());
- assertEquals("myObjectTypeConverter", ormContextObjectTypeConverter.getName());
- assertEquals(2, CollectionTools.size(persistenceUnit.allConverters()));
-
- //move a converter in the context model, check resource model
- ormContextConverterHolder.moveObjectTypeConverter(0, 1);
-
- assertEquals(2, resourceEntity.getObjectTypeConverters().size());
- assertEquals("Foo", resourceEntity.getObjectTypeConverters().get(0).getDataType());
- assertEquals("myObjectTypeConverter", resourceEntity.getObjectTypeConverters().get(0).getName());
- assertEquals("Foo2", resourceEntity.getObjectTypeConverters().get(1).getDataType());
- assertEquals("myObjectTypeConverter2", resourceEntity.getObjectTypeConverters().get(1).getName());
- assertEquals(2, ormContextConverterHolder.objectTypeConvertersSize());
- ormContextObjectTypeConverters = ormContextConverterHolder.objectTypeConverters();
- ormContextObjectTypeConverter = ormContextObjectTypeConverters.next();
- assertEquals("Foo", ormContextObjectTypeConverter.getDataType());
- assertEquals("myObjectTypeConverter", ormContextObjectTypeConverter.getName());
- ormContextObjectTypeConverter = ormContextObjectTypeConverters.next();
- assertEquals("Foo2", ormContextObjectTypeConverter.getDataType());
- assertEquals("myObjectTypeConverter2", ormContextObjectTypeConverter.getName());
- assertEquals(2, CollectionTools.size(persistenceUnit.allConverters()));
-
- //remove a converter from the context model, check resource model
- ormContextConverterHolder.removeObjectTypeConverter(0);
-
- assertEquals(1, resourceEntity.getObjectTypeConverters().size());
- assertEquals("Foo2", resourceEntity.getObjectTypeConverters().get(0).getDataType());
- assertEquals("myObjectTypeConverter2", resourceEntity.getObjectTypeConverters().get(0).getName());
- assertEquals(1, ormContextConverterHolder.objectTypeConvertersSize());
- ormContextObjectTypeConverters = ormContextConverterHolder.objectTypeConverters();
- ormContextObjectTypeConverter = ormContextObjectTypeConverters.next();
- assertEquals("Foo2", ormContextObjectTypeConverter.getDataType());
- assertEquals("myObjectTypeConverter2", ormContextObjectTypeConverter.getName());
- assertEquals(1, CollectionTools.size(persistenceUnit.allConverters()));
-
- //remove a converter from the context model, check resource model
- ormContextConverterHolder.removeObjectTypeConverter(contextObjectTypeConverter2);
-
- assertEquals(0, ormContextConverterHolder.objectTypeConvertersSize());
- assertFalse(ormContextConverterHolder.objectTypeConverters().hasNext());
- assertEquals(0, resourceEntity.getObjectTypeConverters().size());
- assertEquals(0, CollectionTools.size(persistenceUnit.allConverters()));
- }
-
- public void testUpdateStructConverters() throws Exception {
- createTestEntityForStructConverters();
- EclipseLinkPersistenceUnit persistenceUnit = getPersistenceUnit();
- OrmPersistentType ormPersistentType = getEntityMappings().addPersistentType(MappingKeys.ENTITY_TYPE_MAPPING_KEY, FULLY_QUALIFIED_TYPE_NAME);
- EclipseLinkOrmEntity ormContextEntity = (EclipseLinkOrmEntity) ormPersistentType.getMapping();
- ConverterHolder ormContextConverterHolder = ormContextEntity.getConverterHolder();
- XmlEntity resourceEntity = (XmlEntity) getXmlEntityMappings().getEntities().get(0);
-
- assertEquals(0, ormContextConverterHolder.structConvertersSize());
- assertEquals(0, resourceEntity.getStructConverters().size());
- assertEquals(0, CollectionTools.size(persistenceUnit.allConverters()));
-
- //add a converter to the resource model, check context model
- XmlStructConverter resourceStructConverter = EclipseLinkOrmFactory.eINSTANCE.createXmlStructConverter();
- resourceEntity.getStructConverters().add(resourceStructConverter);
- resourceStructConverter.setConverter("Foo");
- resourceStructConverter.setName("myStructConverter");
-
- assertEquals(1, ormContextConverterHolder.structConvertersSize());
- ListIterator<StructConverter> ormContextStructConverters = ormContextConverterHolder.structConverters();
- StructConverter ormContextStructConverter = ormContextStructConverters.next();
- assertEquals("Foo", ormContextStructConverter.getConverterClass());
- assertEquals("myStructConverter", ormContextStructConverter.getName());
- assertEquals(1, resourceEntity.getStructConverters().size());
- assertEquals(1, CollectionTools.size(persistenceUnit.allConverters()));
-
- //add another converter to the resource model, check context model
- XmlStructConverter resourceStructConverter2 = EclipseLinkOrmFactory.eINSTANCE.createXmlStructConverter();
- resourceEntity.getStructConverters().add(0, resourceStructConverter2);
- resourceStructConverter2.setConverter("Foo2");
- resourceStructConverter2.setName("myStructConverter2");
-
- assertEquals(2, ormContextConverterHolder.structConvertersSize());
- ormContextStructConverters = ormContextConverterHolder.structConverters();
- ormContextStructConverter = ormContextStructConverters.next();
- assertEquals("Foo2", ormContextStructConverter.getConverterClass());
- assertEquals("myStructConverter2", ormContextStructConverter.getName());
- ormContextStructConverter = ormContextStructConverters.next();
- assertEquals("Foo", ormContextStructConverter.getConverterClass());
- assertEquals("myStructConverter", ormContextStructConverter.getName());
- assertEquals(2, resourceEntity.getStructConverters().size());
- assertEquals(2, CollectionTools.size(persistenceUnit.allConverters()));
-
- //move a converter in the resource model, check context model
- resourceEntity.getStructConverters().move(0, 1);
-
- assertEquals(2, ormContextConverterHolder.structConvertersSize());
- ormContextStructConverters = ormContextConverterHolder.structConverters();
- ormContextStructConverter = ormContextStructConverters.next();
- assertEquals("Foo", ormContextStructConverter.getConverterClass());
- assertEquals("myStructConverter", ormContextStructConverter.getName());
- ormContextStructConverter = ormContextStructConverters.next();
- assertEquals("Foo2", ormContextStructConverter.getConverterClass());
- assertEquals("myStructConverter2", ormContextStructConverter.getName());
- assertEquals(2, resourceEntity.getStructConverters().size());
- assertEquals(2, CollectionTools.size(persistenceUnit.allConverters()));
-
- //remove a converter from the resource model, check context model
- resourceEntity.getStructConverters().remove(0);
-
- assertEquals(1, ormContextConverterHolder.structConvertersSize());
- ormContextStructConverters = ormContextConverterHolder.structConverters();
- ormContextStructConverter = ormContextStructConverters.next();
- assertEquals("Foo2", ormContextStructConverter.getConverterClass());
- assertEquals("myStructConverter2", ormContextStructConverter.getName());
- assertEquals(1, resourceEntity.getStructConverters().size());
- assertEquals(1, CollectionTools.size(persistenceUnit.allConverters()));
-
- //remove a converter from the resource model, check context model
- resourceEntity.getStructConverters().remove(resourceStructConverter2);
-
- assertEquals(0, ormContextConverterHolder.structConvertersSize());
- assertFalse(ormContextConverterHolder.structConverters().hasNext());
- assertEquals(0, resourceEntity.getStructConverters().size());
- assertEquals(0, CollectionTools.size(persistenceUnit.allConverters()));
- }
-
- public void testModifyStructConverters() throws Exception {
- createTestEntityForStructConverters();
- EclipseLinkPersistenceUnit persistenceUnit = getPersistenceUnit();
- OrmPersistentType ormPersistentType = getEntityMappings().addPersistentType(MappingKeys.ENTITY_TYPE_MAPPING_KEY, FULLY_QUALIFIED_TYPE_NAME);
- EclipseLinkOrmEntity ormContextEntity = (EclipseLinkOrmEntity) ormPersistentType.getMapping();
- ConverterHolder ormContextConverterHolder = ormContextEntity.getConverterHolder();
- XmlEntity resourceEntity = (XmlEntity) getXmlEntityMappings().getEntities().get(0);
-
- assertEquals(0, ormContextConverterHolder.structConvertersSize());
- assertEquals(0, resourceEntity.getStructConverters().size());
- assertEquals(0, CollectionTools.size(persistenceUnit.allConverters()));
-
- //add a converter to the context model, check resource model
- StructConverter contextStructConverter = ormContextConverterHolder.addStructConverter(0);
- contextStructConverter.setConverterClass("Foo");
- contextStructConverter.setName("myStructConverter");
-
- assertEquals(1, resourceEntity.getStructConverters().size());
- assertEquals("Foo", resourceEntity.getStructConverters().get(0).getConverter());
- assertEquals("myStructConverter", resourceEntity.getStructConverters().get(0).getName());
- assertEquals(1, ormContextConverterHolder.structConvertersSize());
- ListIterator<StructConverter> ormContextStructConverters = ormContextConverterHolder.structConverters();
- StructConverter ormContextStructConverter = ormContextStructConverters.next();
- assertEquals("Foo", ormContextStructConverter.getConverterClass());
- assertEquals("myStructConverter", ormContextStructConverter.getName());
- assertEquals(1, CollectionTools.size(persistenceUnit.allConverters()));
-
- //add another converter to the context model, check resource model
- StructConverter contextStructConverter2 = ormContextConverterHolder.addStructConverter(0);
- contextStructConverter2.setConverterClass("Foo2");
- contextStructConverter2.setName("myStructConverter2");
-
- assertEquals(2, resourceEntity.getStructConverters().size());
- assertEquals("Foo2", resourceEntity.getStructConverters().get(0).getConverter());
- assertEquals("myStructConverter2", resourceEntity.getStructConverters().get(0).getName());
- assertEquals("Foo", resourceEntity.getStructConverters().get(1).getConverter());
- assertEquals("myStructConverter", resourceEntity.getStructConverters().get(1).getName());
- assertEquals(2, ormContextConverterHolder.structConvertersSize());
- ormContextStructConverters = ormContextConverterHolder.structConverters();
- ormContextStructConverter = ormContextStructConverters.next();
- assertEquals("Foo2", ormContextStructConverter.getConverterClass());
- assertEquals("myStructConverter2", ormContextStructConverter.getName());
- ormContextStructConverter = ormContextStructConverters.next();
- assertEquals("Foo", ormContextStructConverter.getConverterClass());
- assertEquals("myStructConverter", ormContextStructConverter.getName());
- assertEquals(2, CollectionTools.size(persistenceUnit.allConverters()));
-
- //move a converter in the context model, check resource model
- ormContextConverterHolder.moveStructConverter(0, 1);
-
- assertEquals(2, resourceEntity.getStructConverters().size());
- assertEquals("Foo", resourceEntity.getStructConverters().get(0).getConverter());
- assertEquals("myStructConverter", resourceEntity.getStructConverters().get(0).getName());
- assertEquals("Foo2", resourceEntity.getStructConverters().get(1).getConverter());
- assertEquals("myStructConverter2", resourceEntity.getStructConverters().get(1).getName());
- assertEquals(2, ormContextConverterHolder.structConvertersSize());
- ormContextStructConverters = ormContextConverterHolder.structConverters();
- ormContextStructConverter = ormContextStructConverters.next();
- assertEquals("Foo", ormContextStructConverter.getConverterClass());
- assertEquals("myStructConverter", ormContextStructConverter.getName());
- ormContextStructConverter = ormContextStructConverters.next();
- assertEquals("Foo2", ormContextStructConverter.getConverterClass());
- assertEquals("myStructConverter2", ormContextStructConverter.getName());
- assertEquals(2, CollectionTools.size(persistenceUnit.allConverters()));
-
- //remove a converter from the context model, check resource model
- ormContextConverterHolder.removeStructConverter(0);
-
- assertEquals(1, resourceEntity.getStructConverters().size());
- assertEquals("Foo2", resourceEntity.getStructConverters().get(0).getConverter());
- assertEquals("myStructConverter2", resourceEntity.getStructConverters().get(0).getName());
- assertEquals(1, ormContextConverterHolder.structConvertersSize());
- ormContextStructConverters = ormContextConverterHolder.structConverters();
- ormContextStructConverter = ormContextStructConverters.next();
- assertEquals("Foo2", ormContextStructConverter.getConverterClass());
- assertEquals("myStructConverter2", ormContextStructConverter.getName());
- assertEquals(1, CollectionTools.size(persistenceUnit.allConverters()));
-
- //remove a converter from the context model, check resource model
- ormContextConverterHolder.removeStructConverter(contextStructConverter2);
-
- assertEquals(0, ormContextConverterHolder.structConvertersSize());
- assertFalse(ormContextConverterHolder.structConverters().hasNext());
- assertEquals(0, resourceEntity.getStructConverters().size());
- assertEquals(0, CollectionTools.size(persistenceUnit.allConverters()));
- }
-}
diff --git a/jpa/tests/org.eclipse.jpt.eclipselink.core.tests/src/org/eclipse/jpt/eclipselink/core/tests/internal/context/orm/EclipseLinkOrmIdMappingTests.java b/jpa/tests/org.eclipse.jpt.eclipselink.core.tests/src/org/eclipse/jpt/eclipselink/core/tests/internal/context/orm/EclipseLinkOrmIdMappingTests.java
deleted file mode 100644
index 0c6cf5be0c..0000000000
--- a/jpa/tests/org.eclipse.jpt.eclipselink.core.tests/src/org/eclipse/jpt/eclipselink/core/tests/internal/context/orm/EclipseLinkOrmIdMappingTests.java
+++ /dev/null
@@ -1,388 +0,0 @@
-/*******************************************************************************
- * Copyright (c) 2008, 2009 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.
- *
- * Contributors:
- * Oracle - initial API and implementation
- *******************************************************************************/
-package org.eclipse.jpt.eclipselink.core.tests.internal.context.orm;
-
-import java.util.Iterator;
-import org.eclipse.jdt.core.ICompilationUnit;
-import org.eclipse.jpt.core.MappingKeys;
-import org.eclipse.jpt.core.context.Converter;
-import org.eclipse.jpt.core.context.java.JavaIdMapping;
-import org.eclipse.jpt.core.context.orm.OrmIdMapping;
-import org.eclipse.jpt.core.context.orm.OrmPersistentAttribute;
-import org.eclipse.jpt.core.context.orm.OrmPersistentType;
-import org.eclipse.jpt.core.resource.java.JPA;
-import org.eclipse.jpt.eclipselink.core.context.Convert;
-import org.eclipse.jpt.eclipselink.core.context.EclipseLinkIdMapping;
-import org.eclipse.jpt.eclipselink.core.internal.context.orm.EclipseLinkOrmBasicMapping;
-import org.eclipse.jpt.eclipselink.core.internal.context.orm.EclipseLinkOrmIdMapping;
-import org.eclipse.jpt.eclipselink.core.resource.java.EclipseLinkJPA;
-import org.eclipse.jpt.eclipselink.core.resource.orm.XmlEntity;
-import org.eclipse.jpt.eclipselink.core.resource.orm.XmlId;
-import org.eclipse.jpt.utility.internal.iterators.ArrayIterator;
-
-@SuppressWarnings("nls")
-public class EclipseLinkOrmIdMappingTests
- extends EclipseLinkOrmContextModelTestCase
-{
- public EclipseLinkOrmIdMappingTests(String name) {
- super(name);
- }
-
- private ICompilationUnit createTestEntityWithIdMapping() 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").append(CR);
- }
-
- @Override
- public void appendIdFieldAnnotationTo(StringBuilder sb) {
- sb.append("@Id").append(CR);
- }
- });
- }
-
- private ICompilationUnit createTestEntityWithMutableIdDate() throws Exception {
- return this.createTestType(new DefaultAnnotationWriter() {
- @Override
- public Iterator<String> imports() {
- return new ArrayIterator<String>(JPA.ENTITY, JPA.ID, EclipseLinkJPA.MUTABLE, "java.util.Date");
- }
- @Override
- public void appendTypeAnnotationTo(StringBuilder sb) {
- sb.append("@Entity").append(CR);
- }
-
- @Override
- public void appendIdFieldAnnotationTo(StringBuilder sb) {
- sb.append("@Id").append(CR);
- sb.append(" @Mutable").append(CR);
- sb.append(" private Date myDate;").append(CR);
- sb.append(CR);
- sb.append(" ");
- }
- });
- }
-
- public void testUpdateMutable() throws Exception {
- createTestEntityWithIdMapping();
- OrmPersistentType ormPersistentType =
- getEntityMappings().addPersistentType(MappingKeys.ENTITY_TYPE_MAPPING_KEY, FULLY_QUALIFIED_TYPE_NAME);
- OrmPersistentAttribute ormPersistentAttribute =
- ormPersistentType.addSpecifiedPersistentAttribute(MappingKeys.ID_ATTRIBUTE_MAPPING_KEY, "id");
- EclipseLinkOrmIdMapping contextId =
- (EclipseLinkOrmIdMapping) ormPersistentAttribute.getMapping();
- XmlEntity resourceEntity =
- (XmlEntity)getXmlEntityMappings().getEntities().get(0);
- XmlId resourceId =
- (XmlId) resourceEntity.getAttributes().getIds().get(0);
- EclipseLinkIdMapping javaIdMapping = (EclipseLinkIdMapping) ormPersistentType.getJavaPersistentType().getAttributeNamed("id").getMapping();
-
- // check defaults
-
- assertNull(resourceId.getMutable());
- assertTrue(contextId.getMutable().isDefaultMutable());
- assertNull(contextId.getMutable().getSpecifiedMutable());
- assertTrue(contextId.getMutable().isMutable());
-
- // set xml mutable to false, check context
-
- resourceId.setMutable(Boolean.FALSE);
-
- assertEquals(Boolean.FALSE, resourceId.getMutable());
- assertTrue(contextId.getMutable().isDefaultMutable());
- assertEquals(Boolean.FALSE, contextId.getMutable().getSpecifiedMutable());
- assertFalse(contextId.getMutable().isMutable());
-
- // set xml mutable to true, check context
-
- resourceId.setMutable(Boolean.TRUE);
-
- assertEquals(Boolean.TRUE, resourceId.getMutable());
- assertTrue(contextId.getMutable().isDefaultMutable());
- assertEquals(Boolean.TRUE, contextId.getMutable().getSpecifiedMutable());
- assertTrue(contextId.getMutable().isMutable());
-
- // clear xml mutable, check context
-
- resourceId.setMutable(null);
-
- assertNull(resourceId.getMutable());
- assertTrue(contextId.getMutable().isDefaultMutable());
- assertNull(contextId.getMutable().getSpecifiedMutable());
- assertTrue(contextId.getMutable().isMutable());
-
- // TODO - test defaults for java serializable and date/time types,
- // with and without persistence property
-
- // set mutable on java basic mapping
-
- javaIdMapping.getMutable().setSpecifiedMutable(Boolean.FALSE);
- assertNull(resourceId.getMutable());
- assertTrue(contextId.getMutable().isDefaultMutable());
- assertNull(contextId.getMutable().getSpecifiedMutable());
- assertTrue(contextId.getMutable().isMutable());
- assertFalse(javaIdMapping.getMutable().isMutable());
-
- // remove attribute from xml, test default mutable from java
-
- ormPersistentType.removeSpecifiedPersistentAttribute(ormPersistentAttribute);
- ormPersistentAttribute = ormPersistentType.virtualAttributes().next();
- contextId = (EclipseLinkOrmIdMapping) ormPersistentAttribute.getMapping();
-
- assertNull(resourceId.getMutable());
- assertTrue(contextId.getMutable().isDefaultMutable());
- assertEquals(Boolean.FALSE, contextId.getMutable().getSpecifiedMutable());
- assertFalse(contextId.getMutable().isMutable());
- assertFalse(javaIdMapping.getMutable().isMutable());
-
- // set metadata complete
- ormPersistentType.getMapping().setSpecifiedMetadataComplete(Boolean.TRUE);
- ormPersistentAttribute = ormPersistentType.virtualAttributes().next();
- EclipseLinkOrmBasicMapping contextBasic = (EclipseLinkOrmBasicMapping) ormPersistentAttribute.getMapping();
- assertNull(resourceId.getMutable());
- assertTrue(contextBasic.getMutable().isDefaultMutable());
- assertEquals(Boolean.TRUE, contextBasic.getMutable().getSpecifiedMutable());
- assertTrue(contextBasic.getMutable().isMutable());
- assertFalse(javaIdMapping.getMutable().isMutable());
- }
-
- public void testUpdateMutableDate() throws Exception {
- createTestEntityWithMutableIdDate();
- OrmPersistentType ormPersistentType =
- getEntityMappings().addPersistentType(MappingKeys.ENTITY_TYPE_MAPPING_KEY, FULLY_QUALIFIED_TYPE_NAME);
- OrmPersistentAttribute ormPersistentAttribute =
- ormPersistentType.addSpecifiedPersistentAttribute(MappingKeys.ID_ATTRIBUTE_MAPPING_KEY, "myDate");
- EclipseLinkOrmIdMapping contextId =
- (EclipseLinkOrmIdMapping) ormPersistentAttribute.getMapping();
- XmlEntity resourceEntity =
- (XmlEntity)getXmlEntityMappings().getEntities().get(0);
- XmlId resourceId =
- (XmlId) resourceEntity.getAttributes().getIds().get(0);
- EclipseLinkIdMapping javaIdMapping = (EclipseLinkIdMapping) ormPersistentType.getJavaPersistentType().getAttributeNamed("myDate").getMapping();
-
- // check defaults
-
- assertNull(resourceId.getMutable());
- assertFalse(contextId.getMutable().isDefaultMutable());
- assertNull(contextId.getMutable().getSpecifiedMutable());
- assertFalse(contextId.getMutable().isMutable());
-
- // set xml mutable to false, check context
-
- resourceId.setMutable(Boolean.FALSE);
-
- assertEquals(Boolean.FALSE, resourceId.getMutable());
- assertFalse(contextId.getMutable().isDefaultMutable());
- assertEquals(Boolean.FALSE, contextId.getMutable().getSpecifiedMutable());
- assertFalse(contextId.getMutable().isMutable());
-
- // set xml mutable to true, check context
-
- resourceId.setMutable(Boolean.TRUE);
-
- assertEquals(Boolean.TRUE, resourceId.getMutable());
- assertFalse(contextId.getMutable().isDefaultMutable());
- assertEquals(Boolean.TRUE, contextId.getMutable().getSpecifiedMutable());
- assertTrue(contextId.getMutable().isMutable());
-
- // clear xml mutable, check context
-
- resourceId.setMutable(null);
-
- assertNull(resourceId.getMutable());
- assertFalse(contextId.getMutable().isDefaultMutable());
- assertNull(contextId.getMutable().getSpecifiedMutable());
- assertFalse(contextId.getMutable().isMutable());
-
-
- getPersistenceUnit().getOptions().setTemporalMutable(Boolean.TRUE);
- assertNull(resourceId.getMutable());
- assertTrue(contextId.getMutable().isDefaultMutable());
- assertNull(contextId.getMutable().getSpecifiedMutable());
- assertTrue(contextId.getMutable().isMutable());
-
- getPersistenceUnit().getOptions().setTemporalMutable(Boolean.FALSE);
- assertNull(resourceId.getMutable());
- assertFalse(contextId.getMutable().isDefaultMutable());
- assertNull(contextId.getMutable().getSpecifiedMutable());
- assertFalse(contextId.getMutable().isMutable());
-
- getPersistenceUnit().getOptions().setTemporalMutable(null);
- assertNull(resourceId.getMutable());
- assertFalse(contextId.getMutable().isDefaultMutable());
- assertNull(contextId.getMutable().getSpecifiedMutable());
- assertFalse(contextId.getMutable().isMutable());
-
- // set mutable on java id mapping
-
- javaIdMapping.getMutable().setSpecifiedMutable(Boolean.TRUE);
- assertNull(resourceId.getMutable());
- assertFalse(contextId.getMutable().isDefaultMutable());
- assertNull(contextId.getMutable().getSpecifiedMutable());
- assertFalse(contextId.getMutable().isMutable());
- assertTrue(javaIdMapping.getMutable().isMutable());
-
- // remove attribute from xml, test default mutable from java
-
- ormPersistentType.removeSpecifiedPersistentAttribute(ormPersistentAttribute);
- ormPersistentAttribute = ormPersistentType.virtualAttributes().next();
- contextId = (EclipseLinkOrmIdMapping) ormPersistentAttribute.getMapping();
-
- assertNull(resourceId.getMutable());
- assertFalse(contextId.getMutable().isDefaultMutable());
- assertEquals(Boolean.TRUE, contextId.getMutable().getSpecifiedMutable());
- assertTrue(contextId.getMutable().isMutable());
- assertTrue(javaIdMapping.getMutable().isMutable());
-
- // set metadata complete
- ormPersistentType.getMapping().setSpecifiedMetadataComplete(Boolean.TRUE);
- ormPersistentAttribute = ormPersistentType.virtualAttributes().next();
- EclipseLinkOrmBasicMapping contextBasic = (EclipseLinkOrmBasicMapping) ormPersistentAttribute.getMapping();
- assertNull(resourceId.getMutable());
- assertFalse(contextBasic.getMutable().isDefaultMutable());
- assertEquals(Boolean.FALSE, contextBasic.getMutable().getSpecifiedMutable());
- assertFalse(contextBasic.getMutable().isMutable());
- assertTrue(javaIdMapping.getMutable().isMutable());
- }
-
- public void testModifyMutable() throws Exception {
- OrmPersistentType ormPersistentType =
- getEntityMappings().addPersistentType(MappingKeys.ENTITY_TYPE_MAPPING_KEY, FULLY_QUALIFIED_TYPE_NAME);
- OrmPersistentAttribute ormPersistentAttribute =
- ormPersistentType.addSpecifiedPersistentAttribute(MappingKeys.ID_ATTRIBUTE_MAPPING_KEY, "basic");
- EclipseLinkOrmIdMapping contextId =
- (EclipseLinkOrmIdMapping) ormPersistentAttribute.getMapping();
- XmlEntity resourceEntity =
- (XmlEntity)getXmlEntityMappings().getEntities().get(0);
- XmlId resourceId =
- (XmlId) resourceEntity.getAttributes().getIds().get(0);
-
- // check defaults
-
- assertNull(resourceId.getMutable());
- assertFalse(contextId.getMutable().isDefaultMutable());
- assertNull(contextId.getMutable().getSpecifiedMutable());
- assertFalse(contextId.getMutable().isMutable());
-
- // set context mutable to true, check resource
-
- contextId.getMutable().setSpecifiedMutable(Boolean.TRUE);
-
- assertEquals(Boolean.TRUE, resourceId.getMutable());
- assertFalse(contextId.getMutable().isDefaultMutable());
- assertEquals(Boolean.TRUE, contextId.getMutable().getSpecifiedMutable());
- assertTrue(contextId.getMutable().isMutable());
-
- // set context mutable to false, check resource
-
- contextId.getMutable().setSpecifiedMutable(Boolean.FALSE);
-
- assertEquals(Boolean.FALSE, resourceId.getMutable());
- assertFalse(contextId.getMutable().isDefaultMutable());
- assertEquals(Boolean.FALSE, contextId.getMutable().getSpecifiedMutable());
- assertFalse(contextId.getMutable().isMutable());
-
- // set context read only to null, check resource
-
- contextId.getMutable().setSpecifiedMutable(null);
-
- assertNull(resourceId.getMutable());
- assertFalse(contextId.getMutable().isDefaultMutable());
- assertNull(contextId.getMutable().getSpecifiedMutable());
- assertFalse(contextId.getMutable().isMutable());
- }
-
- public void testUpdateConvert() throws Exception {
- createTestEntityWithIdMapping();
-
- OrmPersistentType ormPersistentType = getEntityMappings().addPersistentType(MappingKeys.ENTITY_TYPE_MAPPING_KEY, FULLY_QUALIFIED_TYPE_NAME);
- OrmPersistentAttribute ormPersistentAttribute = ormPersistentType.addSpecifiedPersistentAttribute(MappingKeys.ID_ATTRIBUTE_MAPPING_KEY, "id");
- OrmIdMapping ormIdMapping = (OrmIdMapping) ormPersistentAttribute.getMapping();
- XmlId basicResource = (XmlId) getXmlEntityMappings().getEntities().get(0).getAttributes().getIds().get(0);
- JavaIdMapping javaIdMapping = (JavaIdMapping) ormPersistentType.getJavaPersistentType().getAttributeNamed("id").getMapping();
-
- assertEquals(null, ormIdMapping.getSpecifiedConverter());
- assertEquals(null, basicResource.getConvert());
-
- //set lob in the resource model, verify context model updated
- basicResource.setConvert("myConvert");
- assertEquals(Convert.ECLIPSE_LINK_CONVERTER, ormIdMapping.getConverter().getType());
- assertEquals("myConvert", basicResource.getConvert());
-
- //set lob to null in the resource model
- basicResource.setConvert(null);
- assertEquals(null, ormIdMapping.getSpecifiedConverter());
- assertEquals(null, basicResource.getConvert());
-
-
- javaIdMapping.setSpecifiedConverter(Convert.ECLIPSE_LINK_CONVERTER);
- ((Convert) javaIdMapping.getSpecifiedConverter()).setSpecifiedConverterName("foo");
-
- assertEquals(null, ormIdMapping.getSpecifiedConverter());
- assertEquals(null, basicResource.getConvert());
- assertEquals("foo", ((Convert) javaIdMapping.getSpecifiedConverter()).getSpecifiedConverterName());
-
-
- ormPersistentType.removeSpecifiedPersistentAttribute(ormPersistentAttribute);
- ormPersistentAttribute = ormPersistentType.virtualAttributes().next();
- ormIdMapping = (OrmIdMapping) ormPersistentAttribute.getMapping();
-
- assertEquals(Convert.ECLIPSE_LINK_CONVERTER, ormIdMapping.getSpecifiedConverter().getType());
- assertEquals("foo", ((Convert) ormIdMapping.getSpecifiedConverter()).getSpecifiedConverterName());
- assertEquals(null, basicResource.getConvert());
- assertEquals("foo", ((Convert) javaIdMapping.getSpecifiedConverter()).getSpecifiedConverterName());
-
- ((Convert) javaIdMapping.getSpecifiedConverter()).setSpecifiedConverterName("bar");
- assertEquals(Convert.ECLIPSE_LINK_CONVERTER, ormIdMapping.getSpecifiedConverter().getType());
- assertEquals("bar", ((Convert) ormIdMapping.getSpecifiedConverter()).getSpecifiedConverterName());
- assertEquals(null, basicResource.getConvert());
- assertEquals("bar", ((Convert) javaIdMapping.getSpecifiedConverter()).getSpecifiedConverterName());
-
- javaIdMapping.setSpecifiedConverter(Converter.NO_CONVERTER);
- assertEquals(null, ormIdMapping.getSpecifiedConverter());
- assertEquals(null, basicResource.getConvert());
- assertEquals(null, javaIdMapping.getSpecifiedConverter());
- }
-
- public void testModifyConvert() throws Exception {
- OrmPersistentType ormPersistentType = getEntityMappings().addPersistentType(MappingKeys.ENTITY_TYPE_MAPPING_KEY, "model.Foo");
- OrmPersistentAttribute ormPersistentAttribute = ormPersistentType.addSpecifiedPersistentAttribute(MappingKeys.ID_ATTRIBUTE_MAPPING_KEY, "basicMapping");
- OrmIdMapping ormIdMapping = (OrmIdMapping) ormPersistentAttribute.getMapping();
- XmlId basicResource = (XmlId) getXmlEntityMappings().getEntities().get(0).getAttributes().getIds().get(0);
-
- assertEquals(null, ormIdMapping.getSpecifiedConverter());
- assertEquals(null, basicResource.getConvert());
-
- //set lob in the context model, verify resource model updated
- ormIdMapping.setSpecifiedConverter(Convert.ECLIPSE_LINK_CONVERTER);
- assertEquals("", basicResource.getConvert());
- assertEquals(Convert.ECLIPSE_LINK_CONVERTER, ormIdMapping.getConverter().getType());
-
- ((Convert) ormIdMapping.getSpecifiedConverter()).setSpecifiedConverterName("bar");
- assertEquals("bar", basicResource.getConvert());
- assertEquals(Convert.ECLIPSE_LINK_CONVERTER, ormIdMapping.getConverter().getType());
- assertEquals("bar", ((Convert) ormIdMapping.getConverter()).getSpecifiedConverterName());
-
- ((Convert) ormIdMapping.getSpecifiedConverter()).setSpecifiedConverterName(null);
-
- assertEquals(null, ormIdMapping.getSpecifiedConverter());
- assertEquals(null, basicResource.getConvert());
-
- //set lob to false in the context model
- ormIdMapping.setSpecifiedConverter(null);
- assertEquals(null, ormIdMapping.getSpecifiedConverter());
- assertEquals(null, basicResource.getConvert());
- }
-}
diff --git a/jpa/tests/org.eclipse.jpt.eclipselink.core.tests/src/org/eclipse/jpt/eclipselink/core/tests/internal/context/orm/EclipseLinkOrmManyToManyMappingTests.java b/jpa/tests/org.eclipse.jpt.eclipselink.core.tests/src/org/eclipse/jpt/eclipselink/core/tests/internal/context/orm/EclipseLinkOrmManyToManyMappingTests.java
deleted file mode 100644
index 6e4a8ac523..0000000000
--- a/jpa/tests/org.eclipse.jpt.eclipselink.core.tests/src/org/eclipse/jpt/eclipselink/core/tests/internal/context/orm/EclipseLinkOrmManyToManyMappingTests.java
+++ /dev/null
@@ -1,248 +0,0 @@
-/*******************************************************************************
- * Copyright (c) 2008, 2009 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.
- *
- * Contributors:
- * Oracle - initial API and implementation
- *******************************************************************************/
-package org.eclipse.jpt.eclipselink.core.tests.internal.context.orm;
-
-import org.eclipse.jpt.core.MappingKeys;
-import org.eclipse.jpt.core.context.orm.OrmJoinTable;
-import org.eclipse.jpt.core.context.orm.OrmManyToManyMapping;
-import org.eclipse.jpt.core.context.orm.OrmOneToManyMapping;
-import org.eclipse.jpt.core.context.orm.OrmPersistentAttribute;
-import org.eclipse.jpt.core.context.orm.OrmPersistentType;
-import org.eclipse.jpt.core.resource.java.JPA;
-import org.eclipse.jpt.core.tests.internal.projects.TestJavaProject.SourceWriter;
-import org.eclipse.jpt.eclipselink.core.context.EclipseLinkRelationshipMapping;
-import org.eclipse.jpt.eclipselink.core.context.JoinFetchType;
-import org.eclipse.jpt.eclipselink.core.internal.context.orm.EclipseLinkOrmManyToManyMapping;
-import org.eclipse.jpt.eclipselink.core.internal.context.orm.EclipseLinkOrmOneToManyMapping;
-import org.eclipse.jpt.eclipselink.core.resource.orm.XmlEntity;
-import org.eclipse.jpt.eclipselink.core.resource.orm.XmlJoinFetchType;
-import org.eclipse.jpt.eclipselink.core.resource.orm.XmlManyToMany;
-
-@SuppressWarnings("nls")
-public class EclipseLinkOrmManyToManyMappingTests
- extends EclipseLinkOrmContextModelTestCase
-{
- public EclipseLinkOrmManyToManyMappingTests(String name) {
- super(name);
- }
-
- private void createTestDepartment() throws Exception {
- SourceWriter sourceWriter = new SourceWriter() {
- public void appendSourceTo(StringBuilder sb) {
- sb.append(CR);
- sb.append("import ").append(JPA.ENTITY).append(";");
- sb.append(CR);
- sb.append("import ").append(JPA.ID).append(";");
- sb.append(CR);
- sb.append("import java.util.Collection;");
- sb.append(CR);
- sb.append("import ").append(JPA.MANY_TO_MANY).append(";");
- sb.append(CR);
- sb.append("import ").append(JPA.JOIN_TABLE).append(";");
- sb.append(CR);
- sb.append("import ").append(JPA.JOIN_COLUMN).append(";");
- sb.append("@Entity");
- sb.append(CR);
- sb.append("public class ").append("Department").append(" ");
- sb.append("{").append(CR);
- sb.append(CR);
- sb.append(" @Id").append(CR);
- sb.append(" private int id;").append(CR);
- sb.append(CR);
- sb.append(" @ManyToMany").append(CR);
- sb.append(" @JoinTable(name=\"DEP_EMP\", joinColumns=@JoinColumn(name=\"DEPT_ID\"), inverseJoinColumns=@JoinColumn(name=\"EMP_ID\"))").append(CR);
- sb.append(" private Collection<Employee> employees;").append(CR);
- sb.append(CR);
- sb.append("}").append(CR);
- }
- };
- this.javaProject.createCompilationUnit(PACKAGE_NAME, "Department.java", sourceWriter);
- }
-
- private void createTestEmployee() throws Exception {
- SourceWriter sourceWriter = new SourceWriter() {
- public void appendSourceTo(StringBuilder sb) {
- sb.append(CR);
- sb.append("import ").append(JPA.ENTITY).append(";");
- sb.append(CR);
- sb.append("import ").append(JPA.ID).append(";");
- sb.append(CR);
- sb.append("@Entity");
- sb.append(CR);
- sb.append("public class ").append("Employee").append(" ");
- sb.append("{").append(CR);
- sb.append(CR);
- sb.append(" @Id").append(CR);
- sb.append(" private int empId;").append(CR);
- sb.append(CR);
- sb.append("}").append(CR);
- }
- };
- this.javaProject.createCompilationUnit(PACKAGE_NAME, "Employee.java", sourceWriter);
- }
- public void testUpdateJoinFetch() throws Exception {
- OrmPersistentType ormPersistentType =
- getEntityMappings().addPersistentType(MappingKeys.ENTITY_TYPE_MAPPING_KEY, FULLY_QUALIFIED_TYPE_NAME);
- OrmPersistentAttribute ormPersistentAttribute =
- ormPersistentType.addSpecifiedPersistentAttribute(MappingKeys.MANY_TO_MANY_ATTRIBUTE_MAPPING_KEY, "manyToMany");
- EclipseLinkRelationshipMapping contextManyToMany =
- (EclipseLinkRelationshipMapping) ormPersistentAttribute.getMapping();
- XmlEntity resourceEntity =
- (XmlEntity) getXmlEntityMappings().getEntities().get(0);
- XmlManyToMany resourceManyToMany =
- (XmlManyToMany) resourceEntity.getAttributes().getManyToManys().get(0);
-
- // check defaults
-
- assertNull(resourceManyToMany.getJoinFetch());
- assertNull(contextManyToMany.getJoinFetch().getValue());
-
- // set xml join fetch to INNER, check context
-
- resourceManyToMany.setJoinFetch(XmlJoinFetchType.INNER);
-
- assertEquals(XmlJoinFetchType.INNER, resourceManyToMany.getJoinFetch());
- assertEquals(JoinFetchType.INNER, contextManyToMany.getJoinFetch().getValue());
-
- // set xml join fetch to OUTER, check context
-
- resourceManyToMany.setJoinFetch(XmlJoinFetchType.OUTER);
-
- assertEquals(XmlJoinFetchType.OUTER, resourceManyToMany.getJoinFetch());
- assertEquals(JoinFetchType.OUTER, contextManyToMany.getJoinFetch().getValue());
-
- // set xml join fetch to null, check context
-
- resourceManyToMany.setJoinFetch(null);
-
- assertNull(resourceManyToMany.getJoinFetch());
- assertNull(contextManyToMany.getJoinFetch().getValue());
- }
-
- public void testModifyJoinFetch() throws Exception {
- OrmPersistentType ormPersistentType =
- getEntityMappings().addPersistentType(MappingKeys.ENTITY_TYPE_MAPPING_KEY, FULLY_QUALIFIED_TYPE_NAME);
- OrmPersistentAttribute ormPersistentAttribute =
- ormPersistentType.addSpecifiedPersistentAttribute(MappingKeys.MANY_TO_MANY_ATTRIBUTE_MAPPING_KEY, "manyToMany");
- EclipseLinkRelationshipMapping contextManyToMany =
- (EclipseLinkRelationshipMapping) ormPersistentAttribute.getMapping();
- XmlEntity resourceEntity =
- (XmlEntity)getXmlEntityMappings().getEntities().get(0);
- XmlManyToMany resourceManyToMany =
- (XmlManyToMany) resourceEntity.getAttributes().getManyToManys().get(0);
-
- // check defaults
-
- assertNull(resourceManyToMany.getJoinFetch());
- assertNull(contextManyToMany.getJoinFetch().getValue());
-
- // set context join fetch to INNER, check resource
-
- contextManyToMany.getJoinFetch().setValue(JoinFetchType.INNER);
-
- assertEquals(XmlJoinFetchType.INNER, resourceManyToMany.getJoinFetch());
- assertEquals(JoinFetchType.INNER, contextManyToMany.getJoinFetch().getValue());
-
- // set context join fetch to OUTER, check resource
-
- contextManyToMany.getJoinFetch().setValue(JoinFetchType.OUTER);
-
- assertEquals(XmlJoinFetchType.OUTER, resourceManyToMany.getJoinFetch());
- assertEquals(JoinFetchType.OUTER, contextManyToMany.getJoinFetch().getValue());
-
- // set context join fetch to null, check resource
-
- contextManyToMany.getJoinFetch().setValue(null);
-
- assertNull(resourceManyToMany.getJoinFetch());
- assertNull(contextManyToMany.getJoinFetch().getValue());
- }
-
- public void testJoinFetchDefault() throws Exception {
- createTestEmployee();
- createTestDepartment();
- getEntityMappings().addPersistentType(MappingKeys.ENTITY_TYPE_MAPPING_KEY, PACKAGE_NAME + ".Department");
- getEntityMappings().addPersistentType(MappingKeys.ENTITY_TYPE_MAPPING_KEY, PACKAGE_NAME + ".Employee");
-
- OrmPersistentType departmentPersistentType = getEntityMappings().persistentTypes().next();
- EclipseLinkOrmManyToManyMapping manyToMany = (EclipseLinkOrmManyToManyMapping) departmentPersistentType.getAttributeNamed("employees").getMapping();
-
- assertNull(manyToMany.getJoinFetch().getValue());
-
- getEntityMappings().getPersistenceUnitMetadata().setXmlMappingMetadataComplete(true);
- EclipseLinkOrmOneToManyMapping oneToMany = (EclipseLinkOrmOneToManyMapping) departmentPersistentType.getAttributeNamed("employees").getMapping();
- assertNull(oneToMany.getJoinFetch().getValue());
-
-
- EclipseLinkRelationshipMapping javaRelationshipMapping = (EclipseLinkRelationshipMapping) departmentPersistentType.getJavaPersistentType().getAttributeNamed("employees").getMapping();
- javaRelationshipMapping.getJoinFetch().setValue(JoinFetchType.OUTER);
- assertNull(oneToMany.getJoinFetch().getValue());
-
- getEntityMappings().getPersistenceUnitMetadata().setXmlMappingMetadataComplete(false);
- manyToMany = (EclipseLinkOrmManyToManyMapping) departmentPersistentType.getAttributeNamed("employees").getMapping();
- assertEquals(JoinFetchType.OUTER, manyToMany.getJoinFetch().getValue());
- }
-
- public void testDefaultJoinTable() throws Exception {
- createTestEmployee();
- createTestDepartment();
- getEntityMappings().addPersistentType(MappingKeys.ENTITY_TYPE_MAPPING_KEY, PACKAGE_NAME + ".Department");
- getEntityMappings().addPersistentType(MappingKeys.ENTITY_TYPE_MAPPING_KEY, PACKAGE_NAME + ".Employee");
-
- OrmPersistentType departmentPersistentType = getEntityMappings().persistentTypes().next();
- OrmManyToManyMapping manyToMany = (OrmManyToManyMapping) departmentPersistentType.getAttributeNamed("employees").getMapping();
-
- assertEquals(true, manyToMany.getPersistentAttribute().isVirtual());
- OrmJoinTable ormJoinTable = manyToMany.getRelationshipReference().getJoinTableJoiningStrategy().getJoinTable();
- assertEquals("DEP_EMP", ormJoinTable.getName());
- assertEquals("DEPT_ID", ormJoinTable.specifiedJoinColumns().next().getName());
- assertEquals("id", ormJoinTable.specifiedJoinColumns().next().getReferencedColumnName());
- assertEquals("EMP_ID", ormJoinTable.specifiedInverseJoinColumns().next().getName());
- assertEquals("empId", ormJoinTable.specifiedInverseJoinColumns().next().getReferencedColumnName());
-
- //set metadata-complete and verify JoinTable info is not taken from the java
- departmentPersistentType.getMapping().setSpecifiedMetadataComplete(Boolean.TRUE);
- departmentPersistentType.addSpecifiedPersistentAttribute(MappingKeys.ID_ATTRIBUTE_MAPPING_KEY, "id");
- OrmOneToManyMapping oneToMany = (OrmOneToManyMapping) departmentPersistentType.getAttributeNamed("employees").getMapping();
-
- assertEquals(true, oneToMany.getPersistentAttribute().isVirtual());
- ormJoinTable = oneToMany.getRelationshipReference().getJoinTableJoiningStrategy().getJoinTable();
- assertEquals("Department_Employee", ormJoinTable.getName());
- assertEquals("Department_id", ormJoinTable.specifiedJoinColumns().next().getName());
- assertEquals("id", ormJoinTable.specifiedJoinColumns().next().getReferencedColumnName());
- assertEquals("employees_empId", ormJoinTable.specifiedInverseJoinColumns().next().getName());
- assertEquals("empId", ormJoinTable.specifiedInverseJoinColumns().next().getReferencedColumnName());
-
- //set metadata-complete to false, add mapping to orm.xml verify JoinTable info is not taken from the java
- departmentPersistentType.getMapping().setSpecifiedMetadataComplete(Boolean.FALSE);
- manyToMany = (OrmManyToManyMapping) departmentPersistentType.getAttributeNamed("employees").getMapping();
- assertEquals(true, manyToMany.getPersistentAttribute().isVirtual());
- ormJoinTable = manyToMany.getRelationshipReference().getJoinTableJoiningStrategy().getJoinTable();
- assertEquals("DEP_EMP", ormJoinTable.getName());
- assertEquals("DEPT_ID", ormJoinTable.specifiedJoinColumns().next().getName());
- assertEquals("id", ormJoinTable.specifiedJoinColumns().next().getReferencedColumnName());
- assertEquals("EMP_ID", ormJoinTable.specifiedInverseJoinColumns().next().getName());
- assertEquals("empId", ormJoinTable.specifiedInverseJoinColumns().next().getReferencedColumnName());
-
-
- departmentPersistentType.addSpecifiedPersistentAttribute(MappingKeys.MANY_TO_MANY_ATTRIBUTE_MAPPING_KEY, "employees");
- manyToMany = (OrmManyToManyMapping) departmentPersistentType.getAttributeNamed("employees").getMapping();
- assertEquals(false, manyToMany.getPersistentAttribute().isVirtual());
- ormJoinTable = manyToMany.getRelationshipReference().getJoinTableJoiningStrategy().getJoinTable();
- assertEquals("Department_Employee", ormJoinTable.getName());
- assertEquals(0, ormJoinTable.specifiedJoinColumnsSize());
- assertEquals("Department_id", ormJoinTable.getDefaultJoinColumn().getName());
- assertEquals("id", ormJoinTable.getDefaultJoinColumn().getReferencedColumnName());
- assertEquals(0, ormJoinTable.specifiedInverseJoinColumnsSize());
- assertEquals("employees_empId", ormJoinTable.getDefaultInverseJoinColumn().getName());
- assertEquals("empId", ormJoinTable.getDefaultInverseJoinColumn().getReferencedColumnName());
-
- }
-}
diff --git a/jpa/tests/org.eclipse.jpt.eclipselink.core.tests/src/org/eclipse/jpt/eclipselink/core/tests/internal/context/orm/EclipseLinkOrmManyToOneMappingTests.java b/jpa/tests/org.eclipse.jpt.eclipselink.core.tests/src/org/eclipse/jpt/eclipselink/core/tests/internal/context/orm/EclipseLinkOrmManyToOneMappingTests.java
deleted file mode 100644
index 0120d01057..0000000000
--- a/jpa/tests/org.eclipse.jpt.eclipselink.core.tests/src/org/eclipse/jpt/eclipselink/core/tests/internal/context/orm/EclipseLinkOrmManyToOneMappingTests.java
+++ /dev/null
@@ -1,185 +0,0 @@
-/*******************************************************************************
- * Copyright (c) 2008, 2009 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.
- *
- * Contributors:
- * Oracle - initial API and implementation
- *******************************************************************************/
-package org.eclipse.jpt.eclipselink.core.tests.internal.context.orm;
-
-import org.eclipse.jpt.core.MappingKeys;
-import org.eclipse.jpt.core.context.orm.OrmPersistentAttribute;
-import org.eclipse.jpt.core.context.orm.OrmPersistentType;
-import org.eclipse.jpt.core.resource.java.JPA;
-import org.eclipse.jpt.core.tests.internal.projects.TestJavaProject.SourceWriter;
-import org.eclipse.jpt.eclipselink.core.context.EclipseLinkRelationshipMapping;
-import org.eclipse.jpt.eclipselink.core.context.JoinFetchType;
-import org.eclipse.jpt.eclipselink.core.internal.context.orm.EclipseLinkOrmManyToOneMapping;
-import org.eclipse.jpt.eclipselink.core.internal.context.orm.EclipseLinkOrmOneToOneMapping;
-import org.eclipse.jpt.eclipselink.core.resource.orm.XmlEntity;
-import org.eclipse.jpt.eclipselink.core.resource.orm.XmlJoinFetchType;
-import org.eclipse.jpt.eclipselink.core.resource.orm.XmlManyToOne;
-
-@SuppressWarnings("nls")
-public class EclipseLinkOrmManyToOneMappingTests
- extends EclipseLinkOrmContextModelTestCase
-{
- public EclipseLinkOrmManyToOneMappingTests(String name) {
- super(name);
- }
-
- private void createTestDepartment() throws Exception {
- SourceWriter sourceWriter = new SourceWriter() {
- public void appendSourceTo(StringBuilder sb) {
- sb.append(CR);
- sb.append("import ").append(JPA.ENTITY).append(";");
- sb.append(CR);
- sb.append("import ").append(JPA.ID).append(";");
- sb.append(CR);
- sb.append(CR);
- sb.append("import ").append(JPA.MANY_TO_ONE).append(";");
- sb.append("@Entity");
- sb.append(CR);
- sb.append("public class ").append("Department").append(" ");
- sb.append("{").append(CR);
- sb.append(CR);
- sb.append(" @Id").append(CR);
- sb.append(" private int id;").append(CR);
- sb.append(CR);
- sb.append(" @ManyToOne").append(CR);
- sb.append(" private Employee employee;").append(CR);
- sb.append(CR);
- sb.append("}").append(CR);
- }
- };
- this.javaProject.createCompilationUnit(PACKAGE_NAME, "Department.java", sourceWriter);
- }
-
- private void createTestEmployee() throws Exception {
- SourceWriter sourceWriter = new SourceWriter() {
- public void appendSourceTo(StringBuilder sb) {
- sb.append(CR);
- sb.append("import ").append(JPA.ENTITY).append(";");
- sb.append(CR);
- sb.append("import ").append(JPA.ID).append(";");
- sb.append(CR);
- sb.append("@Entity");
- sb.append(CR);
- sb.append("public class ").append("Employee").append(" ");
- sb.append("{").append(CR);
- sb.append(CR);
- sb.append(" @Id").append(CR);
- sb.append(" private int empId;").append(CR);
- sb.append(CR);
- sb.append("}").append(CR);
- }
- };
- this.javaProject.createCompilationUnit(PACKAGE_NAME, "Employee.java", sourceWriter);
- }
-
- public void testUpdateJoinFetch() throws Exception {
- OrmPersistentType ormPersistentType =
- getEntityMappings().addPersistentType(MappingKeys.ENTITY_TYPE_MAPPING_KEY, FULLY_QUALIFIED_TYPE_NAME);
- OrmPersistentAttribute ormPersistentAttribute =
- ormPersistentType.addSpecifiedPersistentAttribute(MappingKeys.MANY_TO_ONE_ATTRIBUTE_MAPPING_KEY, "manyToOne");
- EclipseLinkRelationshipMapping contextManyToOne =
- (EclipseLinkRelationshipMapping) ormPersistentAttribute.getMapping();
- XmlEntity resourceEntity =
- (XmlEntity) getXmlEntityMappings().getEntities().get(0);
- XmlManyToOne resourceManyToOne =
- (XmlManyToOne) resourceEntity.getAttributes().getManyToOnes().get(0);
-
- // check defaults
-
- assertNull(resourceManyToOne.getJoinFetch());
- assertNull(contextManyToOne.getJoinFetch().getValue());
-
- // set xml join fetch to INNER, check context
-
- resourceManyToOne.setJoinFetch(XmlJoinFetchType.INNER);
-
- assertEquals(XmlJoinFetchType.INNER, resourceManyToOne.getJoinFetch());
- assertEquals(JoinFetchType.INNER, contextManyToOne.getJoinFetch().getValue());
-
- // set xml join fetch to OUTER, check context
-
- resourceManyToOne.setJoinFetch(XmlJoinFetchType.OUTER);
-
- assertEquals(XmlJoinFetchType.OUTER, resourceManyToOne.getJoinFetch());
- assertEquals(JoinFetchType.OUTER, contextManyToOne.getJoinFetch().getValue());
-
- // set xml join fetch to null, check context
-
- resourceManyToOne.setJoinFetch(null);
-
- assertNull(resourceManyToOne.getJoinFetch());
- assertNull(contextManyToOne.getJoinFetch().getValue());
- }
-
- public void testModifyJoinFetch() throws Exception {
- OrmPersistentType ormPersistentType =
- getEntityMappings().addPersistentType(MappingKeys.ENTITY_TYPE_MAPPING_KEY, FULLY_QUALIFIED_TYPE_NAME);
- OrmPersistentAttribute ormPersistentAttribute =
- ormPersistentType.addSpecifiedPersistentAttribute(MappingKeys.MANY_TO_ONE_ATTRIBUTE_MAPPING_KEY, "manyToOne");
- EclipseLinkRelationshipMapping contextManyToOne =
- (EclipseLinkRelationshipMapping) ormPersistentAttribute.getMapping();
- XmlEntity resourceEntity =
- (XmlEntity)getXmlEntityMappings().getEntities().get(0);
- XmlManyToOne resourceManyToOne =
- (XmlManyToOne) resourceEntity.getAttributes().getManyToOnes().get(0);
-
- // check defaults
-
- assertNull(resourceManyToOne.getJoinFetch());
- assertNull(contextManyToOne.getJoinFetch().getValue());
-
- // set context join fetch to INNER, check resource
-
- contextManyToOne.getJoinFetch().setValue(JoinFetchType.INNER);
-
- assertEquals(XmlJoinFetchType.INNER, resourceManyToOne.getJoinFetch());
- assertEquals(JoinFetchType.INNER, contextManyToOne.getJoinFetch().getValue());
-
- // set context join fetch to OUTER, check resource
-
- contextManyToOne.getJoinFetch().setValue(JoinFetchType.OUTER);
-
- assertEquals(XmlJoinFetchType.OUTER, resourceManyToOne.getJoinFetch());
- assertEquals(JoinFetchType.OUTER, contextManyToOne.getJoinFetch().getValue());
-
- // set context join fetch to null, check resource
-
- contextManyToOne.getJoinFetch().setValue(null);
-
- assertNull(resourceManyToOne.getJoinFetch());
- assertNull(contextManyToOne.getJoinFetch().getValue());
- }
-
- public void testJoinFetchDefaultFromJava() throws Exception {
- createTestEmployee();
- createTestDepartment();
- getEntityMappings().addPersistentType(MappingKeys.ENTITY_TYPE_MAPPING_KEY, PACKAGE_NAME + ".Department");
- getEntityMappings().addPersistentType(MappingKeys.ENTITY_TYPE_MAPPING_KEY, PACKAGE_NAME + ".Employee");
-
- OrmPersistentType departmentPersistentType = getEntityMappings().persistentTypes().next();
- EclipseLinkOrmManyToOneMapping manyToOne = (EclipseLinkOrmManyToOneMapping) departmentPersistentType.getAttributeNamed("employee").getMapping();
-
- assertNull(manyToOne.getJoinFetch().getValue());
-
- getEntityMappings().getPersistenceUnitMetadata().setXmlMappingMetadataComplete(true);
- EclipseLinkOrmOneToOneMapping oneToOne = (EclipseLinkOrmOneToOneMapping) departmentPersistentType.getAttributeNamed("employee").getMapping();
- assertNull(oneToOne.getJoinFetch().getValue());
-
-
- EclipseLinkRelationshipMapping javaRelationshipMapping = (EclipseLinkRelationshipMapping) departmentPersistentType.getJavaPersistentType().getAttributeNamed("employee").getMapping();
- javaRelationshipMapping.getJoinFetch().setValue(JoinFetchType.OUTER);
- assertNull(manyToOne.getJoinFetch().getValue());
-
- getEntityMappings().getPersistenceUnitMetadata().setXmlMappingMetadataComplete(false);
- manyToOne = (EclipseLinkOrmManyToOneMapping) departmentPersistentType.getAttributeNamed("employee").getMapping();
- assertEquals(JoinFetchType.OUTER, manyToOne.getJoinFetch().getValue());
- }
-
-}
diff --git a/jpa/tests/org.eclipse.jpt.eclipselink.core.tests/src/org/eclipse/jpt/eclipselink/core/tests/internal/context/orm/EclipseLinkOrmMappedSuperclassTests.java b/jpa/tests/org.eclipse.jpt.eclipselink.core.tests/src/org/eclipse/jpt/eclipselink/core/tests/internal/context/orm/EclipseLinkOrmMappedSuperclassTests.java
deleted file mode 100644
index 1e8c9dece8..0000000000
--- a/jpa/tests/org.eclipse.jpt.eclipselink.core.tests/src/org/eclipse/jpt/eclipselink/core/tests/internal/context/orm/EclipseLinkOrmMappedSuperclassTests.java
+++ /dev/null
@@ -1,2146 +0,0 @@
-/*******************************************************************************
- * Copyright (c) 2008, 2009 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.
- *
- * Contributors:
- * Oracle - initial API and implementation
- *******************************************************************************/
-package org.eclipse.jpt.eclipselink.core.tests.internal.context.orm;
-
-import java.util.Iterator;
-import java.util.ListIterator;
-import org.eclipse.jdt.core.ICompilationUnit;
-import org.eclipse.jpt.core.MappingKeys;
-import org.eclipse.jpt.core.context.orm.OrmPersistentType;
-import org.eclipse.jpt.core.resource.java.JPA;
-import org.eclipse.jpt.eclipselink.core.context.CacheCoordinationType;
-import org.eclipse.jpt.eclipselink.core.context.CacheType;
-import org.eclipse.jpt.eclipselink.core.context.Caching;
-import org.eclipse.jpt.eclipselink.core.context.ChangeTrackingType;
-import org.eclipse.jpt.eclipselink.core.context.CustomConverter;
-import org.eclipse.jpt.eclipselink.core.context.ExistenceType;
-import org.eclipse.jpt.eclipselink.core.context.ObjectTypeConverter;
-import org.eclipse.jpt.eclipselink.core.context.StructConverter;
-import org.eclipse.jpt.eclipselink.core.context.TypeConverter;
-import org.eclipse.jpt.eclipselink.core.context.java.EclipseLinkJavaMappedSuperclass;
-import org.eclipse.jpt.eclipselink.core.context.java.JavaCaching;
-import org.eclipse.jpt.eclipselink.core.internal.context.orm.ConverterHolder;
-import org.eclipse.jpt.eclipselink.core.internal.context.orm.EclipseLinkOrmMappedSuperclass;
-import org.eclipse.jpt.eclipselink.core.internal.context.persistence.EclipseLinkPersistenceUnit;
-import org.eclipse.jpt.eclipselink.core.resource.java.EclipseLinkJPA;
-import org.eclipse.jpt.eclipselink.core.resource.orm.EclipseLinkOrmFactory;
-import org.eclipse.jpt.eclipselink.core.resource.orm.XmlChangeTrackingType;
-import org.eclipse.jpt.eclipselink.core.resource.orm.XmlConverter;
-import org.eclipse.jpt.eclipselink.core.resource.orm.XmlMappedSuperclass;
-import org.eclipse.jpt.eclipselink.core.resource.orm.XmlObjectTypeConverter;
-import org.eclipse.jpt.eclipselink.core.resource.orm.XmlStructConverter;
-import org.eclipse.jpt.eclipselink.core.resource.orm.XmlTypeConverter;
-import org.eclipse.jpt.utility.internal.CollectionTools;
-import org.eclipse.jpt.utility.internal.iterators.ArrayIterator;
-
-@SuppressWarnings("nls")
-public class EclipseLinkOrmMappedSuperclassTests extends EclipseLinkOrmContextModelTestCase
-{
- public EclipseLinkOrmMappedSuperclassTests(String name) {
- super(name);
- }
-
-
- private ICompilationUnit createTestMappedSuperclassForReadOnly() throws Exception {
- return this.createTestType(new DefaultAnnotationWriter() {
- @Override
- public Iterator<String> imports() {
- return new ArrayIterator<String>(JPA.MAPPED_SUPERCLASS, EclipseLinkJPA.READ_ONLY);
- }
- @Override
- public void appendTypeAnnotationTo(StringBuilder sb) {
- sb.append("@MappedSuperclass").append(CR);
- }
- });
- }
-
- private ICompilationUnit createTestMappedSuperclassForCustomizer() throws Exception {
- return this.createTestType(new DefaultAnnotationWriter() {
- @Override
- public Iterator<String> imports() {
- return new ArrayIterator<String>(JPA.MAPPED_SUPERCLASS, EclipseLinkJPA.CUSTOMIZER);
- }
- @Override
- public void appendTypeAnnotationTo(StringBuilder sb) {
- sb.append("@MappedSuperclass").append(CR);
- }
- });
- }
-
- private ICompilationUnit createTestMappedSuperclassForChangeTracking() throws Exception {
- return this.createTestType(new DefaultAnnotationWriter() {
- @Override
- public Iterator<String> imports() {
- return new ArrayIterator<String>(JPA.MAPPED_SUPERCLASS, EclipseLinkJPA.CHANGE_TRACKING);
- }
-
- @Override
- public void appendTypeAnnotationTo(StringBuilder sb) {
- sb.append("@MappedSuperclass").append(CR);
- }
- });
- }
-
- private ICompilationUnit createTestMappedSuperclassForCaching() throws Exception {
- return this.createTestType(new DefaultAnnotationWriter() {
- @Override
- public Iterator<String> imports() {
- return new ArrayIterator<String>(JPA.MAPPED_SUPERCLASS);
- }
- @Override
- public void appendTypeAnnotationTo(StringBuilder sb) {
- sb.append("@MappedSuperclass").append(CR);
- }
- });
- }
-
- private ICompilationUnit createTestMappedSuperclassForConverters() throws Exception {
- return this.createTestType(new DefaultAnnotationWriter() {
- @Override
- public Iterator<String> imports() {
- return new ArrayIterator<String>(JPA.MAPPED_SUPERCLASS);
- }
- @Override
- public void appendTypeAnnotationTo(StringBuilder sb) {
- sb.append("@MappedSuperclass").append(CR);
- }
- });
- }
-
- private ICompilationUnit createTestMappedSuperclassForTypeConverters() throws Exception {
- return this.createTestType(new DefaultAnnotationWriter() {
- @Override
- public Iterator<String> imports() {
- return new ArrayIterator<String>(JPA.MAPPED_SUPERCLASS);
- }
- @Override
- public void appendTypeAnnotationTo(StringBuilder sb) {
- sb.append("@MappedSuperclass").append(CR);
- }
- });
- }
-
- private ICompilationUnit createTestMappedSuperclassForObjectTypeConverters() throws Exception {
- return this.createTestType(new DefaultAnnotationWriter() {
- @Override
- public Iterator<String> imports() {
- return new ArrayIterator<String>(JPA.MAPPED_SUPERCLASS);
- }
- @Override
- public void appendTypeAnnotationTo(StringBuilder sb) {
- sb.append("@MappedSuperclass").append(CR);
- }
- });
- }
-
- private ICompilationUnit createTestMappedSuperclassForStructConverters() throws Exception {
- return this.createTestType(new DefaultAnnotationWriter() {
- @Override
- public Iterator<String> imports() {
- return new ArrayIterator<String>(JPA.MAPPED_SUPERCLASS);
- }
- @Override
- public void appendTypeAnnotationTo(StringBuilder sb) {
- sb.append("@MappedSuperclass").append(CR);
- }
- });
- }
-
- public void testUpdateReadOnly() throws Exception {
- createTestMappedSuperclassForReadOnly();
- OrmPersistentType ormPersistentType = getEntityMappings().addPersistentType(MappingKeys.MAPPED_SUPERCLASS_TYPE_MAPPING_KEY, FULLY_QUALIFIED_TYPE_NAME);
- EclipseLinkJavaMappedSuperclass javaContextMappedSuperclass = (EclipseLinkJavaMappedSuperclass) ormPersistentType.getJavaPersistentType().getMapping();
- EclipseLinkOrmMappedSuperclass ormContextMappedSuperclass = (EclipseLinkOrmMappedSuperclass) ormPersistentType.getMapping();
- XmlMappedSuperclass resourceMappedSuperclass = (XmlMappedSuperclass) getXmlEntityMappings().getMappedSuperclasses().get(0);
-
- // check defaults
-
- assertNull(resourceMappedSuperclass.getReadOnly());
- assertFalse(javaContextMappedSuperclass.getReadOnly().isReadOnly());
- assertFalse(ormContextMappedSuperclass.getReadOnly().isReadOnly());
- assertFalse(ormContextMappedSuperclass.getReadOnly().isDefaultReadOnly());
- assertNull(ormContextMappedSuperclass.getReadOnly().getSpecifiedReadOnly());
-
- // set xml read only to false, check override
-
- resourceMappedSuperclass.setReadOnly(Boolean.FALSE);
-
- assertEquals(Boolean.FALSE, resourceMappedSuperclass.getReadOnly());
- assertFalse(javaContextMappedSuperclass.getReadOnly().isReadOnly());
- assertFalse(ormContextMappedSuperclass.getReadOnly().isReadOnly());
- assertFalse(ormContextMappedSuperclass.getReadOnly().isDefaultReadOnly());
- assertEquals(Boolean.FALSE, ormContextMappedSuperclass.getReadOnly().getSpecifiedReadOnly());
-
- // set xml read only to true, check override
-
- resourceMappedSuperclass.setReadOnly(Boolean.TRUE);
-
- assertEquals(Boolean.TRUE, resourceMappedSuperclass.getReadOnly());
- assertFalse(javaContextMappedSuperclass.getReadOnly().isReadOnly());
- assertTrue(ormContextMappedSuperclass.getReadOnly().isReadOnly());
- assertFalse(ormContextMappedSuperclass.getReadOnly().isDefaultReadOnly());
- assertEquals(Boolean.TRUE, ormContextMappedSuperclass.getReadOnly().getSpecifiedReadOnly());
-
- // clear xml read only, set java read only to true, check defaults
-
- resourceMappedSuperclass.setReadOnly(null);
- javaContextMappedSuperclass.getReadOnly().setSpecifiedReadOnly(Boolean.TRUE);
-
- assertNull(resourceMappedSuperclass.getReadOnly());
- assertTrue(javaContextMappedSuperclass.getReadOnly().isReadOnly());
- assertTrue(ormContextMappedSuperclass.getReadOnly().isReadOnly());
- assertTrue(ormContextMappedSuperclass.getReadOnly().isDefaultReadOnly());
- assertNull(ormContextMappedSuperclass.getReadOnly().getSpecifiedReadOnly());
-
- // set metadataComplete to True, check defaults not from java
-
- ormContextMappedSuperclass.setSpecifiedMetadataComplete(Boolean.TRUE);
-
- assertNull(resourceMappedSuperclass.getReadOnly());
- assertTrue(javaContextMappedSuperclass.getReadOnly().isReadOnly());
- assertFalse(ormContextMappedSuperclass.getReadOnly().isReadOnly());
- assertFalse(ormContextMappedSuperclass.getReadOnly().isDefaultReadOnly());
- assertNull(ormContextMappedSuperclass.getReadOnly().getSpecifiedReadOnly());
-
- ormContextMappedSuperclass.setSpecifiedMetadataComplete(null);
-
- // set xml read only to false, check override
-
- resourceMappedSuperclass.setReadOnly(Boolean.FALSE);
-
- assertEquals(Boolean.FALSE, resourceMappedSuperclass.getReadOnly());
- assertTrue(javaContextMappedSuperclass.getReadOnly().isReadOnly());
- assertFalse(ormContextMappedSuperclass.getReadOnly().isReadOnly());
- assertTrue(ormContextMappedSuperclass.getReadOnly().isDefaultReadOnly());
- assertEquals(Boolean.FALSE, ormContextMappedSuperclass.getReadOnly().getSpecifiedReadOnly());
-
- // set xml read only to true, check override
-
- resourceMappedSuperclass.setReadOnly(Boolean.TRUE);
-
- assertEquals(Boolean.TRUE, resourceMappedSuperclass.getReadOnly());
- assertTrue(javaContextMappedSuperclass.getReadOnly().isReadOnly());
- assertTrue(ormContextMappedSuperclass.getReadOnly().isReadOnly());
- assertTrue(ormContextMappedSuperclass.getReadOnly().isDefaultReadOnly());
- assertEquals(Boolean.TRUE, ormContextMappedSuperclass.getReadOnly().getSpecifiedReadOnly());
-
- // clear xml read only, set java read only to false, check defaults
-
- resourceMappedSuperclass.setReadOnly(null);
- javaContextMappedSuperclass.getReadOnly().setSpecifiedReadOnly(Boolean.FALSE);
-
- assertNull(resourceMappedSuperclass.getReadOnly());
- assertFalse(javaContextMappedSuperclass.getReadOnly().isReadOnly());
- assertFalse(ormContextMappedSuperclass.getReadOnly().isReadOnly());
- assertFalse(ormContextMappedSuperclass.getReadOnly().isDefaultReadOnly());
- assertNull(ormContextMappedSuperclass.getReadOnly().getSpecifiedReadOnly());
-
- // set xml read only to false, check override
-
- resourceMappedSuperclass.setReadOnly(Boolean.FALSE);
-
- assertEquals(Boolean.FALSE, resourceMappedSuperclass.getReadOnly());
- assertFalse(javaContextMappedSuperclass.getReadOnly().isReadOnly());
- assertFalse(ormContextMappedSuperclass.getReadOnly().isReadOnly());
- assertFalse(ormContextMappedSuperclass.getReadOnly().isDefaultReadOnly());
- assertEquals(Boolean.FALSE, ormContextMappedSuperclass.getReadOnly().getSpecifiedReadOnly());
-
- // set xml read only to true, check override
-
- resourceMappedSuperclass.setReadOnly(Boolean.TRUE);
-
- assertEquals(Boolean.TRUE, resourceMappedSuperclass.getReadOnly());
- assertFalse(javaContextMappedSuperclass.getReadOnly().isReadOnly());
- assertTrue(ormContextMappedSuperclass.getReadOnly().isReadOnly());
- assertFalse(ormContextMappedSuperclass.getReadOnly().isDefaultReadOnly());
- assertEquals(Boolean.TRUE, ormContextMappedSuperclass.getReadOnly().getSpecifiedReadOnly());
- }
-
- public void testModifyReadOnly() throws Exception {
- createTestMappedSuperclassForReadOnly();
- OrmPersistentType ormPersistentType = getEntityMappings().addPersistentType(MappingKeys.MAPPED_SUPERCLASS_TYPE_MAPPING_KEY, FULLY_QUALIFIED_TYPE_NAME);
- EclipseLinkOrmMappedSuperclass ormContextMappedSuperclass = (EclipseLinkOrmMappedSuperclass) ormPersistentType.getMapping();
- XmlMappedSuperclass resourceMappedSuperclass = (XmlMappedSuperclass) getXmlEntityMappings().getMappedSuperclasses().get(0);
-
- // check defaults
-
- assertNull(resourceMappedSuperclass.getReadOnly());
- assertFalse(ormContextMappedSuperclass.getReadOnly().isReadOnly());
- assertFalse(ormContextMappedSuperclass.getReadOnly().isDefaultReadOnly());
- assertNull(ormContextMappedSuperclass.getReadOnly().getSpecifiedReadOnly());
-
- // set context read only to true, check resource
-
- ormContextMappedSuperclass.getReadOnly().setSpecifiedReadOnly(Boolean.TRUE);
-
- assertEquals(Boolean.TRUE, resourceMappedSuperclass.getReadOnly());
- assertTrue(ormContextMappedSuperclass.getReadOnly().isReadOnly());
- assertFalse(ormContextMappedSuperclass.getReadOnly().isDefaultReadOnly());
- assertEquals(Boolean.TRUE, ormContextMappedSuperclass.getReadOnly().getSpecifiedReadOnly());
-
- // set context read only to false, check resource
-
- ormContextMappedSuperclass.getReadOnly().setSpecifiedReadOnly(Boolean.FALSE);
-
- assertEquals(Boolean.FALSE, resourceMappedSuperclass.getReadOnly());
- assertFalse(ormContextMappedSuperclass.getReadOnly().isReadOnly());
- assertFalse(ormContextMappedSuperclass.getReadOnly().isDefaultReadOnly());
- assertEquals(Boolean.FALSE, ormContextMappedSuperclass.getReadOnly().getSpecifiedReadOnly());
-
- // set context read only to null, check resource
-
- ormContextMappedSuperclass.getReadOnly().setSpecifiedReadOnly(null);
-
- assertNull(resourceMappedSuperclass.getReadOnly());
- assertFalse(ormContextMappedSuperclass.getReadOnly().isReadOnly());
- assertFalse(ormContextMappedSuperclass.getReadOnly().isDefaultReadOnly());
- assertNull(ormContextMappedSuperclass.getReadOnly().getSpecifiedReadOnly());
- }
-
- public void testUpdateCustomizerClass() throws Exception {
- createTestMappedSuperclassForCustomizer();
- OrmPersistentType ormPersistentType = getEntityMappings().addPersistentType(MappingKeys.MAPPED_SUPERCLASS_TYPE_MAPPING_KEY, FULLY_QUALIFIED_TYPE_NAME);
- EclipseLinkJavaMappedSuperclass javaContextMappedSuperclass = (EclipseLinkJavaMappedSuperclass) ormPersistentType.getJavaPersistentType().getMapping();
- EclipseLinkOrmMappedSuperclass ormContextMappedSuperclass = (EclipseLinkOrmMappedSuperclass) ormPersistentType.getMapping();
- XmlMappedSuperclass resourceMappedSuperclass = (XmlMappedSuperclass) getXmlEntityMappings().getMappedSuperclasses().get(0);
-
-
- // check defaults
-
- assertNull(resourceMappedSuperclass.getCustomizer());
- assertNull(javaContextMappedSuperclass.getCustomizer().getCustomizerClass());
- assertNull(ormContextMappedSuperclass.getCustomizer().getCustomizerClass());
- assertNull(ormContextMappedSuperclass.getCustomizer().getDefaultCustomizerClass());
- assertNull(ormContextMappedSuperclass.getCustomizer().getSpecifiedCustomizerClass());
-
- // set xml customizer, check defaults
- resourceMappedSuperclass.setCustomizer(EclipseLinkOrmFactory.eINSTANCE.createXmlCustomizer());
- assertNull(resourceMappedSuperclass.getCustomizer().getCustomizerClassName());
- assertNull(javaContextMappedSuperclass.getCustomizer().getCustomizerClass());
- assertNull(ormContextMappedSuperclass.getCustomizer().getCustomizerClass());
- assertNull(ormContextMappedSuperclass.getCustomizer().getDefaultCustomizerClass());
- assertNull(ormContextMappedSuperclass.getCustomizer().getSpecifiedCustomizerClass());
-
-
- // set xml customizer class, check override
-
- resourceMappedSuperclass.getCustomizer().setCustomizerClassName("foo");
-
- assertEquals("foo", resourceMappedSuperclass.getCustomizer().getCustomizerClassName());
- assertNull(javaContextMappedSuperclass.getCustomizer().getCustomizerClass());
- assertEquals("foo", ormContextMappedSuperclass.getCustomizer().getCustomizerClass());
- assertNull(ormContextMappedSuperclass.getCustomizer().getDefaultCustomizerClass());
- assertEquals("foo", ormContextMappedSuperclass.getCustomizer().getSpecifiedCustomizerClass());
-
- // clear xml customizer class, set java customizer class, check defaults
-
- resourceMappedSuperclass.getCustomizer().setCustomizerClassName(null);
- javaContextMappedSuperclass.getCustomizer().setSpecifiedCustomizerClass("bar");
-
- assertNull(resourceMappedSuperclass.getCustomizer().getCustomizerClassName());
- assertEquals("bar", javaContextMappedSuperclass.getCustomizer().getCustomizerClass());
- assertEquals("bar", ormContextMappedSuperclass.getCustomizer().getCustomizerClass());
- assertEquals("bar", ormContextMappedSuperclass.getCustomizer().getDefaultCustomizerClass());
- assertNull(ormContextMappedSuperclass.getCustomizer().getSpecifiedCustomizerClass());
-
- // set metadataComplete to True, check defaults not from java
-
- ormContextMappedSuperclass.setSpecifiedMetadataComplete(Boolean.TRUE);
-
- assertNull(resourceMappedSuperclass.getCustomizer().getCustomizerClassName());
- assertEquals("bar", javaContextMappedSuperclass.getCustomizer().getCustomizerClass());
- assertNull(ormContextMappedSuperclass.getCustomizer().getCustomizerClass());
- assertNull(ormContextMappedSuperclass.getCustomizer().getDefaultCustomizerClass());
- assertNull(ormContextMappedSuperclass.getCustomizer().getSpecifiedCustomizerClass());
-
- ormContextMappedSuperclass.setSpecifiedMetadataComplete(null);
-
- // set xml customizer class, check override
-
- resourceMappedSuperclass.getCustomizer().setCustomizerClassName("foo");
-
- assertEquals("foo", resourceMappedSuperclass.getCustomizer().getCustomizerClassName());
- assertEquals("bar", javaContextMappedSuperclass.getCustomizer().getCustomizerClass());
- assertEquals("foo", ormContextMappedSuperclass.getCustomizer().getCustomizerClass());
- assertEquals("bar", ormContextMappedSuperclass.getCustomizer().getDefaultCustomizerClass());
- assertEquals("foo", ormContextMappedSuperclass.getCustomizer().getSpecifiedCustomizerClass());
-
- //set xml customizer null
- javaContextMappedSuperclass.getCustomizer().setSpecifiedCustomizerClass(null);
- resourceMappedSuperclass.setCustomizer(null);
- assertNull(resourceMappedSuperclass.getCustomizer());
- assertNull(javaContextMappedSuperclass.getCustomizer().getCustomizerClass());
- assertNull(ormContextMappedSuperclass.getCustomizer().getCustomizerClass());
- assertNull(ormContextMappedSuperclass.getCustomizer().getDefaultCustomizerClass());
- assertNull(ormContextMappedSuperclass.getCustomizer().getSpecifiedCustomizerClass());
-
- }
-
- public void testModifyCustomizerClass() throws Exception {
- createTestMappedSuperclassForCustomizer();
- OrmPersistentType ormPersistentType = getEntityMappings().addPersistentType(MappingKeys.MAPPED_SUPERCLASS_TYPE_MAPPING_KEY, FULLY_QUALIFIED_TYPE_NAME);
- EclipseLinkOrmMappedSuperclass ormContextMappedSuperclass = (EclipseLinkOrmMappedSuperclass) ormPersistentType.getMapping();
- XmlMappedSuperclass resourceMappedSuperclass = (XmlMappedSuperclass) getXmlEntityMappings().getMappedSuperclasses().get(0);
-
- // check defaults
-
- assertNull(resourceMappedSuperclass.getCustomizer());
- assertNull(ormContextMappedSuperclass.getCustomizer().getCustomizerClass());
- assertNull(ormContextMappedSuperclass.getCustomizer().getDefaultCustomizerClass());
- assertNull(ormContextMappedSuperclass.getCustomizer().getSpecifiedCustomizerClass());
-
- // set context customizer, check resource
-
- ormContextMappedSuperclass.getCustomizer().setSpecifiedCustomizerClass("foo");
-
- assertEquals("foo", resourceMappedSuperclass.getCustomizer().getCustomizerClassName());
- assertEquals("foo", ormContextMappedSuperclass.getCustomizer().getCustomizerClass());
- assertNull(ormContextMappedSuperclass.getCustomizer().getDefaultCustomizerClass());
- assertEquals("foo", ormContextMappedSuperclass.getCustomizer().getSpecifiedCustomizerClass());
-
- // set context customizer to null, check resource
-
- ormContextMappedSuperclass.getCustomizer().setSpecifiedCustomizerClass(null);
-
- assertNull(resourceMappedSuperclass.getCustomizer());
- assertNull(ormContextMappedSuperclass.getCustomizer().getCustomizerClass());
- assertNull(ormContextMappedSuperclass.getCustomizer().getDefaultCustomizerClass());
- assertNull(ormContextMappedSuperclass.getCustomizer().getSpecifiedCustomizerClass());
- }
-
- public void testUpdateChangeTracking() throws Exception {
- createTestMappedSuperclassForChangeTracking();
- OrmPersistentType ormPersistentType = getEntityMappings().addPersistentType(MappingKeys.MAPPED_SUPERCLASS_TYPE_MAPPING_KEY, FULLY_QUALIFIED_TYPE_NAME);
- EclipseLinkJavaMappedSuperclass javaContextMappedSuperclass = (EclipseLinkJavaMappedSuperclass) ormPersistentType.getJavaPersistentType().getMapping();
- EclipseLinkOrmMappedSuperclass ormContextMappedSuperclass = (EclipseLinkOrmMappedSuperclass) ormPersistentType.getMapping();
- XmlMappedSuperclass resourceMappedSuperclass = (XmlMappedSuperclass) getXmlEntityMappings().getMappedSuperclasses().get(0);
-
- // check defaults
-
- assertNull(resourceMappedSuperclass.getChangeTracking());
- assertEquals(ChangeTrackingType.AUTO, javaContextMappedSuperclass.getChangeTracking().getType());
- assertEquals(ChangeTrackingType.AUTO, ormContextMappedSuperclass.getChangeTracking().getType());
- assertEquals(ChangeTrackingType.AUTO, ormContextMappedSuperclass.getChangeTracking().getDefaultType());
- assertNull(ormContextMappedSuperclass.getChangeTracking().getSpecifiedType());
-
- // set xml type to ATTRIBUTE, check context
-
- resourceMappedSuperclass.setChangeTracking(EclipseLinkOrmFactory.eINSTANCE.createXmlChangeTracking());
- resourceMappedSuperclass.getChangeTracking().setType(XmlChangeTrackingType.ATTRIBUTE);
-
- assertEquals(XmlChangeTrackingType.ATTRIBUTE, resourceMappedSuperclass.getChangeTracking().getType());
- assertEquals(ChangeTrackingType.AUTO, javaContextMappedSuperclass.getChangeTracking().getType());
- assertEquals(ChangeTrackingType.ATTRIBUTE, ormContextMappedSuperclass.getChangeTracking().getType());
- assertEquals(ChangeTrackingType.AUTO, ormContextMappedSuperclass.getChangeTracking().getDefaultType());
- assertEquals(ChangeTrackingType.ATTRIBUTE, ormContextMappedSuperclass.getChangeTracking().getSpecifiedType());
-
- // set xml type to OBJECT, check context
-
- resourceMappedSuperclass.getChangeTracking().setType(XmlChangeTrackingType.OBJECT);
-
- assertEquals(XmlChangeTrackingType.OBJECT, resourceMappedSuperclass.getChangeTracking().getType());
- assertEquals(ChangeTrackingType.AUTO, javaContextMappedSuperclass.getChangeTracking().getType());
- assertEquals(ChangeTrackingType.OBJECT, ormContextMappedSuperclass.getChangeTracking().getType());
- assertEquals(ChangeTrackingType.AUTO, ormContextMappedSuperclass.getChangeTracking().getDefaultType());
- assertEquals(ChangeTrackingType.OBJECT, ormContextMappedSuperclass.getChangeTracking().getSpecifiedType());
-
- // set xml type to DEFERRED, check context
-
- resourceMappedSuperclass.getChangeTracking().setType(XmlChangeTrackingType.DEFERRED);
-
- assertEquals(XmlChangeTrackingType.DEFERRED, resourceMappedSuperclass.getChangeTracking().getType());
- assertEquals(ChangeTrackingType.AUTO, javaContextMappedSuperclass.getChangeTracking().getType());
- assertEquals(ChangeTrackingType.DEFERRED, ormContextMappedSuperclass.getChangeTracking().getType());
- assertEquals(ChangeTrackingType.AUTO, ormContextMappedSuperclass.getChangeTracking().getDefaultType());
- assertEquals(ChangeTrackingType.DEFERRED, ormContextMappedSuperclass.getChangeTracking().getSpecifiedType());
-
- // set xml type to AUTO, check context
-
- resourceMappedSuperclass.getChangeTracking().setType(XmlChangeTrackingType.AUTO);
-
- assertEquals(XmlChangeTrackingType.AUTO, resourceMappedSuperclass.getChangeTracking().getType());
- assertEquals(ChangeTrackingType.AUTO, javaContextMappedSuperclass.getChangeTracking().getType());
- assertEquals(ChangeTrackingType.AUTO, ormContextMappedSuperclass.getChangeTracking().getType());
- assertEquals(ChangeTrackingType.AUTO, ormContextMappedSuperclass.getChangeTracking().getDefaultType());
- assertEquals(ChangeTrackingType.AUTO, ormContextMappedSuperclass.getChangeTracking().getSpecifiedType());
-
- // clear xml change tracking, set java change tracking, check defaults
-
- resourceMappedSuperclass.setChangeTracking(null);
- javaContextMappedSuperclass.getChangeTracking().setSpecifiedType(ChangeTrackingType.ATTRIBUTE);
-
- assertNull(resourceMappedSuperclass.getChangeTracking());
- assertEquals(ChangeTrackingType.ATTRIBUTE, javaContextMappedSuperclass.getChangeTracking().getType());
- assertEquals(ChangeTrackingType.ATTRIBUTE, ormContextMappedSuperclass.getChangeTracking().getType());
- assertEquals(ChangeTrackingType.ATTRIBUTE, ormContextMappedSuperclass.getChangeTracking().getDefaultType());
- assertNull(ormContextMappedSuperclass.getChangeTracking().getSpecifiedType());
-
- // set metadataComplete to True, check defaults not from java
-
- ormContextMappedSuperclass.setSpecifiedMetadataComplete(Boolean.TRUE);
-
- assertNull(resourceMappedSuperclass.getChangeTracking());
- assertEquals(ChangeTrackingType.ATTRIBUTE, javaContextMappedSuperclass.getChangeTracking().getType());
- assertEquals(ChangeTrackingType.AUTO, ormContextMappedSuperclass.getChangeTracking().getType());
- assertEquals(ChangeTrackingType.AUTO, ormContextMappedSuperclass.getChangeTracking().getDefaultType());
- assertNull(ormContextMappedSuperclass.getChangeTracking().getSpecifiedType());
-
- // unset metadataComplete, set xml change tracking to OBJECT, check context
-
- ormContextMappedSuperclass.setSpecifiedMetadataComplete(null);
- resourceMappedSuperclass.setChangeTracking(EclipseLinkOrmFactory.eINSTANCE.createXmlChangeTracking());
- resourceMappedSuperclass.getChangeTracking().setType(XmlChangeTrackingType.OBJECT);
-
- assertEquals(XmlChangeTrackingType.OBJECT, resourceMappedSuperclass.getChangeTracking().getType());
- assertEquals(ChangeTrackingType.ATTRIBUTE, javaContextMappedSuperclass.getChangeTracking().getType());
- assertEquals(ChangeTrackingType.OBJECT, ormContextMappedSuperclass.getChangeTracking().getType());
- assertEquals(ChangeTrackingType.ATTRIBUTE, ormContextMappedSuperclass.getChangeTracking().getDefaultType());
- assertEquals(ChangeTrackingType.OBJECT, ormContextMappedSuperclass.getChangeTracking().getSpecifiedType());
- }
-
- public void testModifyChangeTracking() throws Exception {
- createTestMappedSuperclassForChangeTracking();
- OrmPersistentType ormPersistentType = getEntityMappings().addPersistentType(MappingKeys.MAPPED_SUPERCLASS_TYPE_MAPPING_KEY, FULLY_QUALIFIED_TYPE_NAME);
- EclipseLinkOrmMappedSuperclass ormContextMappedSuperclass = (EclipseLinkOrmMappedSuperclass) ormPersistentType.getMapping();
- XmlMappedSuperclass resourceMappedSuperclass = (XmlMappedSuperclass) getXmlEntityMappings().getMappedSuperclasses().get(0);
-
- // check defaults
-
- assertNull(resourceMappedSuperclass.getChangeTracking());
- assertEquals(ChangeTrackingType.AUTO, ormContextMappedSuperclass.getChangeTracking().getType());
- assertEquals(ChangeTrackingType.AUTO, ormContextMappedSuperclass.getChangeTracking().getDefaultType());
- assertNull(ormContextMappedSuperclass.getChangeTracking().getSpecifiedType());
-
- // set context change tracking to ATTRIBUTE, check resource
-
- ormContextMappedSuperclass.getChangeTracking().setSpecifiedType(ChangeTrackingType.ATTRIBUTE);
-
- assertEquals(XmlChangeTrackingType.ATTRIBUTE, resourceMappedSuperclass.getChangeTracking().getType());
- assertEquals(ChangeTrackingType.ATTRIBUTE, ormContextMappedSuperclass.getChangeTracking().getType());
- assertEquals(ChangeTrackingType.AUTO, ormContextMappedSuperclass.getChangeTracking().getDefaultType());
- assertEquals(ChangeTrackingType.ATTRIBUTE, ormContextMappedSuperclass.getChangeTracking().getSpecifiedType());
-
- // set context change tracking to OBJECT, check resource
-
- ormContextMappedSuperclass.getChangeTracking().setSpecifiedType(ChangeTrackingType.OBJECT);
-
- assertEquals(XmlChangeTrackingType.OBJECT, resourceMappedSuperclass.getChangeTracking().getType());
- assertEquals(ChangeTrackingType.OBJECT, ormContextMappedSuperclass.getChangeTracking().getType());
- assertEquals(ChangeTrackingType.AUTO, ormContextMappedSuperclass.getChangeTracking().getDefaultType());
- assertEquals(ChangeTrackingType.OBJECT, ormContextMappedSuperclass.getChangeTracking().getSpecifiedType());
-
- // set context change tracking to DEFERRED, check resource
-
- ormContextMappedSuperclass.getChangeTracking().setSpecifiedType(ChangeTrackingType.DEFERRED);
-
- assertEquals(XmlChangeTrackingType.DEFERRED, resourceMappedSuperclass.getChangeTracking().getType());
- assertEquals(ChangeTrackingType.DEFERRED, ormContextMappedSuperclass.getChangeTracking().getType());
- assertEquals(ChangeTrackingType.AUTO, ormContextMappedSuperclass.getChangeTracking().getDefaultType());
- assertEquals(ChangeTrackingType.DEFERRED, ormContextMappedSuperclass.getChangeTracking().getSpecifiedType());
-
- // set context change tracking to AUTO, check resource
-
- ormContextMappedSuperclass.getChangeTracking().setSpecifiedType(ChangeTrackingType.AUTO);
-
- assertEquals(XmlChangeTrackingType.AUTO, resourceMappedSuperclass.getChangeTracking().getType());
- assertEquals(ChangeTrackingType.AUTO, ormContextMappedSuperclass.getChangeTracking().getType());
- assertEquals(ChangeTrackingType.AUTO, ormContextMappedSuperclass.getChangeTracking().getDefaultType());
- assertEquals(ChangeTrackingType.AUTO, ormContextMappedSuperclass.getChangeTracking().getSpecifiedType());
-
- // set context change tracking to null, check resource
-
- ormContextMappedSuperclass.getChangeTracking().setSpecifiedType(null);
-
- assertNull(resourceMappedSuperclass.getChangeTracking());
- assertEquals(ChangeTrackingType.AUTO, ormContextMappedSuperclass.getChangeTracking().getType());
- assertEquals(ChangeTrackingType.AUTO, ormContextMappedSuperclass.getChangeTracking().getDefaultType());
- assertNull(ormContextMappedSuperclass.getChangeTracking().getSpecifiedType());
- }
-
- public void testUpdateCacheType() throws Exception {
- createTestMappedSuperclassForCaching();
- OrmPersistentType ormPersistentType = getEntityMappings().addPersistentType(MappingKeys.MAPPED_SUPERCLASS_TYPE_MAPPING_KEY, FULLY_QUALIFIED_TYPE_NAME);
- JavaCaching javaContextCaching = ((EclipseLinkJavaMappedSuperclass) ormPersistentType.getJavaPersistentType().getMapping()).getCaching();
- EclipseLinkOrmMappedSuperclass ormContextMappedSuperclass = (EclipseLinkOrmMappedSuperclass) ormPersistentType.getMapping();
- Caching ormContextCaching = ormContextMappedSuperclass.getCaching();
- XmlMappedSuperclass resourceMappedSuperclass = (XmlMappedSuperclass) getXmlEntityMappings().getMappedSuperclasses().get(0);
-
-
- // check defaults
-
- assertEquals(null, resourceMappedSuperclass.getCache());
- assertEquals(CacheType.SOFT_WEAK, javaContextCaching.getType());
- assertEquals(CacheType.SOFT_WEAK, ormContextCaching.getType());
- assertEquals(CacheType.SOFT_WEAK, ormContextCaching.getDefaultType());
- assertEquals(null, ormContextCaching.getSpecifiedType());
-
- // set xml cache, check defaults
- resourceMappedSuperclass.setCache(EclipseLinkOrmFactory.eINSTANCE.createXmlCache());
- assertEquals(null, resourceMappedSuperclass.getCache().getType());
- assertEquals(CacheType.SOFT_WEAK, javaContextCaching.getType());
- assertEquals(CacheType.SOFT_WEAK, ormContextCaching.getType());
- assertEquals(CacheType.SOFT_WEAK, ormContextCaching.getDefaultType());
- assertEquals(null, ormContextCaching.getSpecifiedType());
-
-
- // set xml cache type, check settings
- resourceMappedSuperclass.getCache().setType(org.eclipse.jpt.eclipselink.core.resource.orm.CacheType.FULL);
- assertEquals(org.eclipse.jpt.eclipselink.core.resource.orm.CacheType.FULL, resourceMappedSuperclass.getCache().getType());
- assertEquals(CacheType.SOFT_WEAK, javaContextCaching.getType());
- assertEquals(CacheType.FULL, ormContextCaching.getType());
- assertEquals(CacheType.SOFT_WEAK, ormContextCaching.getDefaultType());
- assertEquals(CacheType.FULL, ormContextCaching.getSpecifiedType());
-
-
- // set java cache type, check defaults
-
- javaContextCaching.setSpecifiedType(CacheType.WEAK);
-
- assertEquals(org.eclipse.jpt.eclipselink.core.resource.orm.CacheType.FULL, resourceMappedSuperclass.getCache().getType());
- assertEquals(CacheType.WEAK, javaContextCaching.getType());
- assertEquals(CacheType.FULL, ormContextCaching.getType());
- assertEquals(CacheType.SOFT_WEAK, ormContextCaching.getDefaultType());
- assertEquals(CacheType.FULL, ormContextCaching.getSpecifiedType());
-
- // clear xml cache type, check defaults
- resourceMappedSuperclass.getCache().setType(null);
-
- assertEquals(null, resourceMappedSuperclass.getCache().getType());
- assertEquals(CacheType.WEAK, javaContextCaching.getType());
- assertEquals(CacheType.SOFT_WEAK, ormContextCaching.getType());
- assertEquals(CacheType.SOFT_WEAK, ormContextCaching.getDefaultType());
- assertEquals(null, ormContextCaching.getSpecifiedType());
-
-
- // clear xml cache, check defaults
- resourceMappedSuperclass.setCache(null);
-
- assertEquals(null, resourceMappedSuperclass.getCache());
- assertEquals(CacheType.WEAK, javaContextCaching.getType());
- assertEquals(CacheType.WEAK, ormContextCaching.getType());
- assertEquals(CacheType.WEAK, ormContextCaching.getDefaultType());
- assertEquals(null, ormContextCaching.getSpecifiedType());
-
-
- // set metadataComplete to True, check defaults not from java
-
- ormContextMappedSuperclass.setSpecifiedMetadataComplete(Boolean.TRUE);
-
- assertEquals(null, resourceMappedSuperclass.getCache());
- assertEquals(CacheType.WEAK, javaContextCaching.getType());
- assertEquals(CacheType.SOFT_WEAK, ormContextCaching.getType());
- assertEquals(CacheType.SOFT_WEAK, ormContextCaching.getDefaultType());
- assertEquals(null, ormContextCaching.getSpecifiedType());
-
- ormContextMappedSuperclass.setSpecifiedMetadataComplete(null);
- }
-
- public void testModifyCacheType() throws Exception {
- createTestMappedSuperclassForCaching();
- OrmPersistentType ormPersistentType = getEntityMappings().addPersistentType(MappingKeys.MAPPED_SUPERCLASS_TYPE_MAPPING_KEY, FULLY_QUALIFIED_TYPE_NAME);
- EclipseLinkOrmMappedSuperclass ormContextMappedSuperclass = (EclipseLinkOrmMappedSuperclass) ormPersistentType.getMapping();
- Caching ormContextCaching = ormContextMappedSuperclass.getCaching();
- XmlMappedSuperclass resourceMappedSuperclass = (XmlMappedSuperclass) getXmlEntityMappings().getMappedSuperclasses().get(0);
-
- // check defaults
-
- assertEquals(null, resourceMappedSuperclass.getCache());
- assertEquals(CacheType.SOFT_WEAK, ormContextCaching.getType());
- assertEquals(CacheType.SOFT_WEAK, ormContextCaching.getDefaultType());
- assertEquals(null, ormContextCaching.getSpecifiedType());
-
- // set context cache type, check resource
-
- ormContextMappedSuperclass.getCaching().setSpecifiedType(CacheType.HARD_WEAK);
- assertEquals(org.eclipse.jpt.eclipselink.core.resource.orm.CacheType.HARD_WEAK, resourceMappedSuperclass.getCache().getType());
- assertEquals(CacheType.HARD_WEAK, ormContextCaching.getType());
- assertEquals(CacheType.SOFT_WEAK, ormContextCaching.getDefaultType());
- assertEquals(CacheType.HARD_WEAK, ormContextCaching.getSpecifiedType());
-
- // set context customizer to null, check resource
-
- ormContextMappedSuperclass.getCaching().setSpecifiedType(null);
-
- assertEquals(null, resourceMappedSuperclass.getCache());
- assertEquals(CacheType.SOFT_WEAK, ormContextCaching.getType());
- assertEquals(CacheType.SOFT_WEAK, ormContextCaching.getDefaultType());
- assertEquals(null, ormContextCaching.getSpecifiedType());
- }
-
- public void testUpdateCacheCoordinationType() throws Exception {
- createTestMappedSuperclassForCaching();
- OrmPersistentType ormPersistentType = getEntityMappings().addPersistentType(MappingKeys.MAPPED_SUPERCLASS_TYPE_MAPPING_KEY, FULLY_QUALIFIED_TYPE_NAME);
- JavaCaching javaContextCaching = ((EclipseLinkJavaMappedSuperclass) ormPersistentType.getJavaPersistentType().getMapping()).getCaching();
- EclipseLinkOrmMappedSuperclass ormContextMappedSuperclass = (EclipseLinkOrmMappedSuperclass) ormPersistentType.getMapping();
- Caching ormContextCaching = ormContextMappedSuperclass.getCaching();
- XmlMappedSuperclass resourceMappedSuperclass = (XmlMappedSuperclass) getXmlEntityMappings().getMappedSuperclasses().get(0);
-
-
- // check defaults
-
- assertEquals(null, resourceMappedSuperclass.getCache());
- assertEquals(CacheCoordinationType.SEND_OBJECT_CHANGES, javaContextCaching.getCoordinationType());
- assertEquals(CacheCoordinationType.SEND_OBJECT_CHANGES, ormContextCaching.getCoordinationType());
- assertEquals(CacheCoordinationType.SEND_OBJECT_CHANGES, ormContextCaching.getDefaultCoordinationType());
- assertEquals(null, ormContextCaching.getSpecifiedCoordinationType());
-
- // set xml cache, check defaults
- resourceMappedSuperclass.setCache(EclipseLinkOrmFactory.eINSTANCE.createXmlCache());
- assertEquals(null, resourceMappedSuperclass.getCache().getCoordinationType());
- assertEquals(CacheCoordinationType.SEND_OBJECT_CHANGES, javaContextCaching.getCoordinationType());
- assertEquals(CacheCoordinationType.SEND_OBJECT_CHANGES, ormContextCaching.getCoordinationType());
- assertEquals(CacheCoordinationType.SEND_OBJECT_CHANGES, ormContextCaching.getDefaultCoordinationType());
- assertEquals(null, ormContextCaching.getSpecifiedCoordinationType());
-
-
- // set xml cache type, check settings
- resourceMappedSuperclass.getCache().setCoordinationType(org.eclipse.jpt.eclipselink.core.resource.orm.CacheCoordinationType.INVALIDATE_CHANGED_OBJECTS);
- assertEquals(org.eclipse.jpt.eclipselink.core.resource.orm.CacheCoordinationType.INVALIDATE_CHANGED_OBJECTS, resourceMappedSuperclass.getCache().getCoordinationType());
- assertEquals(CacheCoordinationType.SEND_OBJECT_CHANGES, javaContextCaching.getCoordinationType());
- assertEquals(CacheCoordinationType.INVALIDATE_CHANGED_OBJECTS, ormContextCaching.getCoordinationType());
- assertEquals(CacheCoordinationType.SEND_OBJECT_CHANGES, ormContextCaching.getDefaultCoordinationType());
- assertEquals(CacheCoordinationType.INVALIDATE_CHANGED_OBJECTS, ormContextCaching.getSpecifiedCoordinationType());
-
-
- // set java cache type, check defaults
-
- javaContextCaching.setSpecifiedCoordinationType(CacheCoordinationType.SEND_NEW_OBJECTS_WITH_CHANGES);
-
- assertEquals(org.eclipse.jpt.eclipselink.core.resource.orm.CacheCoordinationType.INVALIDATE_CHANGED_OBJECTS, resourceMappedSuperclass.getCache().getCoordinationType());
- assertEquals(CacheCoordinationType.SEND_NEW_OBJECTS_WITH_CHANGES, javaContextCaching.getCoordinationType());
- assertEquals(CacheCoordinationType.INVALIDATE_CHANGED_OBJECTS, ormContextCaching.getCoordinationType());
- assertEquals(CacheCoordinationType.SEND_OBJECT_CHANGES, ormContextCaching.getDefaultCoordinationType());
- assertEquals(CacheCoordinationType.INVALIDATE_CHANGED_OBJECTS, ormContextCaching.getSpecifiedCoordinationType());
-
- // clear xml cache type, check defaults
- resourceMappedSuperclass.getCache().setCoordinationType(null);
-
- assertEquals(null, resourceMappedSuperclass.getCache().getCoordinationType());
- assertEquals(CacheCoordinationType.SEND_NEW_OBJECTS_WITH_CHANGES, javaContextCaching.getCoordinationType());
- assertEquals(CacheCoordinationType.SEND_OBJECT_CHANGES, ormContextCaching.getCoordinationType());
- assertEquals(CacheCoordinationType.SEND_OBJECT_CHANGES, ormContextCaching.getDefaultCoordinationType());
- assertEquals(null, ormContextCaching.getSpecifiedCoordinationType());
-
-
- // clear xml cache, check defaults
- resourceMappedSuperclass.setCache(null);
-
- assertEquals(null, resourceMappedSuperclass.getCache());
- assertEquals(CacheCoordinationType.SEND_NEW_OBJECTS_WITH_CHANGES, javaContextCaching.getCoordinationType());
- assertEquals(CacheCoordinationType.SEND_NEW_OBJECTS_WITH_CHANGES, ormContextCaching.getCoordinationType());
- assertEquals(CacheCoordinationType.SEND_NEW_OBJECTS_WITH_CHANGES, ormContextCaching.getDefaultCoordinationType());
- assertEquals(null, ormContextCaching.getSpecifiedCoordinationType());
-
-
- // set metadataComplete to True, check defaults not from java
-
- ormContextMappedSuperclass.setSpecifiedMetadataComplete(Boolean.TRUE);
-
- assertEquals(null, resourceMappedSuperclass.getCache());
- assertEquals(CacheCoordinationType.SEND_NEW_OBJECTS_WITH_CHANGES, javaContextCaching.getCoordinationType());
- assertEquals(CacheCoordinationType.SEND_OBJECT_CHANGES, ormContextCaching.getCoordinationType());
- assertEquals(CacheCoordinationType.SEND_OBJECT_CHANGES, ormContextCaching.getDefaultCoordinationType());
- assertEquals(null, ormContextCaching.getSpecifiedCoordinationType());
-
- ormContextMappedSuperclass.setSpecifiedMetadataComplete(null);
- }
-
- public void testModifyCacheCoordinationType() throws Exception {
- createTestMappedSuperclassForCaching();
- OrmPersistentType ormPersistentType = getEntityMappings().addPersistentType(MappingKeys.MAPPED_SUPERCLASS_TYPE_MAPPING_KEY, FULLY_QUALIFIED_TYPE_NAME);
- EclipseLinkOrmMappedSuperclass ormContextMappedSuperclass = (EclipseLinkOrmMappedSuperclass) ormPersistentType.getMapping();
- Caching ormContextCaching = ormContextMappedSuperclass.getCaching();
- XmlMappedSuperclass resourceMappedSuperclass = (XmlMappedSuperclass) getXmlEntityMappings().getMappedSuperclasses().get(0);
-
- // check defaults
-
- assertEquals(null, resourceMappedSuperclass.getCache());
- assertEquals(CacheCoordinationType.SEND_OBJECT_CHANGES, ormContextCaching.getCoordinationType());
- assertEquals(CacheCoordinationType.SEND_OBJECT_CHANGES, ormContextCaching.getDefaultCoordinationType());
- assertEquals(null, ormContextCaching.getSpecifiedCoordinationType());
-
- // set context cache coordination type, check resource
-
- ormContextMappedSuperclass.getCaching().setSpecifiedCoordinationType(CacheCoordinationType.SEND_NEW_OBJECTS_WITH_CHANGES);
- assertEquals(org.eclipse.jpt.eclipselink.core.resource.orm.CacheCoordinationType.SEND_NEW_OBJECTS_WITH_CHANGES, resourceMappedSuperclass.getCache().getCoordinationType());
- assertEquals(CacheCoordinationType.SEND_NEW_OBJECTS_WITH_CHANGES, ormContextCaching.getCoordinationType());
- assertEquals(CacheCoordinationType.SEND_OBJECT_CHANGES, ormContextCaching.getDefaultCoordinationType());
- assertEquals(CacheCoordinationType.SEND_NEW_OBJECTS_WITH_CHANGES, ormContextCaching.getSpecifiedCoordinationType());
-
- // set context coordination type to null, check resource
-
- ormContextMappedSuperclass.getCaching().setSpecifiedCoordinationType(null);
-
- assertEquals(null, resourceMappedSuperclass.getCache());
- assertEquals(CacheCoordinationType.SEND_OBJECT_CHANGES, ormContextCaching.getCoordinationType());
- assertEquals(CacheCoordinationType.SEND_OBJECT_CHANGES, ormContextCaching.getDefaultCoordinationType());
- assertEquals(null, ormContextCaching.getSpecifiedCoordinationType());
- }
-
-
- public void testUpdateCacheSize() throws Exception {
- createTestMappedSuperclassForCaching();
- OrmPersistentType ormPersistentType = getEntityMappings().addPersistentType(MappingKeys.MAPPED_SUPERCLASS_TYPE_MAPPING_KEY, FULLY_QUALIFIED_TYPE_NAME);
- JavaCaching javaContextCaching = ((EclipseLinkJavaMappedSuperclass) ormPersistentType.getJavaPersistentType().getMapping()).getCaching();
- EclipseLinkOrmMappedSuperclass ormContextMappedSuperclass = (EclipseLinkOrmMappedSuperclass) ormPersistentType.getMapping();
- Caching ormContextCaching = ormContextMappedSuperclass.getCaching();
- XmlMappedSuperclass resourceMappedSuperclass = (XmlMappedSuperclass) getXmlEntityMappings().getMappedSuperclasses().get(0);
-
-
- // check defaults
-
- assertEquals(null, resourceMappedSuperclass.getCache());
- assertEquals(100, javaContextCaching.getSize());
- assertEquals(100, ormContextCaching.getSize());
- assertEquals(100, ormContextCaching.getDefaultSize());
- assertEquals(null, ormContextCaching.getSpecifiedSize());
-
- // set xml cache, check defaults
- resourceMappedSuperclass.setCache(EclipseLinkOrmFactory.eINSTANCE.createXmlCache());
- assertEquals(null, resourceMappedSuperclass.getCache().getSize());
- assertEquals(100, javaContextCaching.getSize());
- assertEquals(100, ormContextCaching.getSize());
- assertEquals(100, ormContextCaching.getDefaultSize());
- assertEquals(null, ormContextCaching.getSpecifiedSize());
-
-
- // set xml cache size, check settings
- resourceMappedSuperclass.getCache().setSize(new Integer(105));
- assertEquals(new Integer(105), resourceMappedSuperclass.getCache().getSize());
- assertEquals(100, javaContextCaching.getSize());
- assertEquals(105, ormContextCaching.getSize());
- assertEquals(100, ormContextCaching.getDefaultSize());
- assertEquals(new Integer(105), ormContextCaching.getSpecifiedSize());
-
-
- // set java cache size, check defaults
-
- javaContextCaching.setSpecifiedSize(new Integer(50));
-
- assertEquals(new Integer(105), resourceMappedSuperclass.getCache().getSize());
- assertEquals(50, javaContextCaching.getSize());
- assertEquals(105, ormContextCaching.getSize());
- assertEquals(50, ormContextCaching.getDefaultSize());
- assertEquals(new Integer(105), ormContextCaching.getSpecifiedSize());
-
- // clear xml cache size, check defaults
- resourceMappedSuperclass.getCache().setSize(null);
-
- assertEquals(null, resourceMappedSuperclass.getCache().getSize());
- assertEquals(50, javaContextCaching.getSize());
- assertEquals(50, ormContextCaching.getSize());
- assertEquals(50, ormContextCaching.getDefaultSize());
- assertEquals(null, ormContextCaching.getSpecifiedSize());
-
-
- // clear xml cache, check defaults
- resourceMappedSuperclass.setCache(null);
-
- assertEquals(null, resourceMappedSuperclass.getCache());
- assertEquals(50, javaContextCaching.getSize());
- assertEquals(50, ormContextCaching.getSize());
- assertEquals(50, ormContextCaching.getDefaultSize());
- assertEquals(null, ormContextCaching.getSpecifiedSize());
-
-
- // set metadataComplete to True, check defaults not from java
-
- ormContextMappedSuperclass.setSpecifiedMetadataComplete(Boolean.TRUE);
-
- assertEquals(null, resourceMappedSuperclass.getCache());
- assertEquals(50, javaContextCaching.getSize());
- assertEquals(100, ormContextCaching.getSize());
- assertEquals(100, ormContextCaching.getDefaultSize());
- assertEquals(null, ormContextCaching.getSpecifiedSize());
-
- ormContextMappedSuperclass.setSpecifiedMetadataComplete(null);
- }
-
- public void testModifyCacheSize() throws Exception {
- createTestMappedSuperclassForCaching();
- OrmPersistentType ormPersistentType = getEntityMappings().addPersistentType(MappingKeys.MAPPED_SUPERCLASS_TYPE_MAPPING_KEY, FULLY_QUALIFIED_TYPE_NAME);
- EclipseLinkOrmMappedSuperclass ormContextMappedSuperclass = (EclipseLinkOrmMappedSuperclass) ormPersistentType.getMapping();
- Caching ormContextCaching = ormContextMappedSuperclass.getCaching();
- XmlMappedSuperclass resourceMappedSuperclass = (XmlMappedSuperclass) getXmlEntityMappings().getMappedSuperclasses().get(0);
-
- // check defaults
-
- assertEquals(null, resourceMappedSuperclass.getCache());
- assertEquals(100, ormContextCaching.getSize());
- assertEquals(100, ormContextCaching.getDefaultSize());
- assertEquals(null, ormContextCaching.getSpecifiedSize());
-
- // set context cache size, check resource
-
- ormContextMappedSuperclass.getCaching().setSpecifiedSize(new Integer(50));
- assertEquals(new Integer(50), resourceMappedSuperclass.getCache().getSize());
- assertEquals(50, ormContextCaching.getSize());
- assertEquals(100, ormContextCaching.getDefaultSize());
- assertEquals(new Integer(50), ormContextCaching.getSpecifiedSize());
-
- // set context cache size to null, check resource
-
- ormContextMappedSuperclass.getCaching().setSpecifiedSize(null);
-
- assertEquals(null, resourceMappedSuperclass.getCache());
- assertEquals(100, ormContextCaching.getSize());
- assertEquals(100, ormContextCaching.getDefaultSize());
- assertEquals(null, ormContextCaching.getSpecifiedSize());
- }
-
- public void testUpdateCacheAlwaysRefresh() throws Exception {
- createTestMappedSuperclassForCaching();
- OrmPersistentType ormPersistentType = getEntityMappings().addPersistentType(MappingKeys.MAPPED_SUPERCLASS_TYPE_MAPPING_KEY, FULLY_QUALIFIED_TYPE_NAME);
- JavaCaching javaContextCaching = ((EclipseLinkJavaMappedSuperclass) ormPersistentType.getJavaPersistentType().getMapping()).getCaching();
- EclipseLinkOrmMappedSuperclass ormContextMappedSuperclass = (EclipseLinkOrmMappedSuperclass) ormPersistentType.getMapping();
- Caching ormContextCaching = ormContextMappedSuperclass.getCaching();
- XmlMappedSuperclass resourceMappedSuperclass = (XmlMappedSuperclass) getXmlEntityMappings().getMappedSuperclasses().get(0);
-
-
- // check defaults
-
- assertEquals(null, resourceMappedSuperclass.getCache());
- assertEquals(false, javaContextCaching.isAlwaysRefresh());
- assertEquals(false, ormContextCaching.isAlwaysRefresh());
- assertEquals(false, ormContextCaching.isDefaultAlwaysRefresh());
- assertEquals(null, ormContextCaching.getSpecifiedAlwaysRefresh());
-
- // set xml cache, check defaults
- resourceMappedSuperclass.setCache(EclipseLinkOrmFactory.eINSTANCE.createXmlCache());
- assertEquals(null, resourceMappedSuperclass.getCache().getAlwaysRefresh());
- assertEquals(false, javaContextCaching.isAlwaysRefresh());
- assertEquals(false, ormContextCaching.isAlwaysRefresh());
- assertEquals(false, ormContextCaching.isDefaultAlwaysRefresh());
- assertEquals(null, ormContextCaching.getSpecifiedAlwaysRefresh());
-
-
- // set xml cache always refresh, check settings
- resourceMappedSuperclass.getCache().setAlwaysRefresh(Boolean.TRUE);
- assertEquals(Boolean.TRUE, resourceMappedSuperclass.getCache().getAlwaysRefresh());
- assertEquals(false, javaContextCaching.isAlwaysRefresh());
- assertEquals(true, ormContextCaching.isAlwaysRefresh());
- assertEquals(false, ormContextCaching.isDefaultAlwaysRefresh());
- assertEquals(Boolean.TRUE, ormContextCaching.getSpecifiedAlwaysRefresh());
-
-
- // set java cache always refresh, check defaults
-
- javaContextCaching.setSpecifiedAlwaysRefresh(Boolean.TRUE);
-
- assertEquals(Boolean.TRUE, resourceMappedSuperclass.getCache().getAlwaysRefresh());
- assertEquals(true, javaContextCaching.isAlwaysRefresh());
- assertEquals(true, ormContextCaching.isAlwaysRefresh());
- assertEquals(false, ormContextCaching.isDefaultAlwaysRefresh());
- assertEquals(Boolean.TRUE, ormContextCaching.getSpecifiedAlwaysRefresh());
-
- // set xml cache always refresh to false
- resourceMappedSuperclass.getCache().setAlwaysRefresh(Boolean.FALSE);
- assertEquals(Boolean.FALSE, resourceMappedSuperclass.getCache().getAlwaysRefresh());
- assertEquals(true, javaContextCaching.isAlwaysRefresh());
- assertEquals(false, ormContextCaching.isAlwaysRefresh());
- assertEquals(false, ormContextCaching.isDefaultAlwaysRefresh());
- assertEquals(Boolean.FALSE, ormContextCaching.getSpecifiedAlwaysRefresh());
-
- // clear xml cache always refresh, check defaults
- resourceMappedSuperclass.getCache().setAlwaysRefresh(null);
-
- assertEquals(null, resourceMappedSuperclass.getCache().getAlwaysRefresh());
- assertEquals(true, javaContextCaching.isAlwaysRefresh());
- assertEquals(false, ormContextCaching.isAlwaysRefresh());
- assertEquals(false, ormContextCaching.isDefaultAlwaysRefresh());
- assertEquals(null, ormContextCaching.getSpecifiedAlwaysRefresh());
-
-
- // clear xml cache, check defaults
- resourceMappedSuperclass.setCache(null);
-
- assertEquals(null, resourceMappedSuperclass.getCache());
- assertEquals(true, javaContextCaching.isAlwaysRefresh());
- assertEquals(true, ormContextCaching.isAlwaysRefresh());
- assertEquals(true, ormContextCaching.isDefaultAlwaysRefresh());
- assertEquals(null, ormContextCaching.getSpecifiedAlwaysRefresh());
-
-
- // set metadataComplete to True, check defaults not from java
-
- ormContextMappedSuperclass.setSpecifiedMetadataComplete(Boolean.TRUE);
-
- assertEquals(null, resourceMappedSuperclass.getCache());
- assertEquals(true, javaContextCaching.isAlwaysRefresh());
- assertEquals(false, ormContextCaching.isAlwaysRefresh());
- assertEquals(false, ormContextCaching.isDefaultAlwaysRefresh());
- assertEquals(null, ormContextCaching.getSpecifiedAlwaysRefresh());
-
-
- // set metadataComplete back to null, check defaults from java
- ormContextMappedSuperclass.setSpecifiedMetadataComplete(null);
-
- assertEquals(null, resourceMappedSuperclass.getCache());
- assertEquals(true, javaContextCaching.isAlwaysRefresh());
- assertEquals(true, ormContextCaching.isAlwaysRefresh());
- assertEquals(true, ormContextCaching.isDefaultAlwaysRefresh());
- assertEquals(null, ormContextCaching.getSpecifiedAlwaysRefresh());
- }
-
- public void testModifyCacheAlwaysRefresh() throws Exception {
- createTestMappedSuperclassForCaching();
- OrmPersistentType ormPersistentType = getEntityMappings().addPersistentType(MappingKeys.MAPPED_SUPERCLASS_TYPE_MAPPING_KEY, FULLY_QUALIFIED_TYPE_NAME);
- EclipseLinkOrmMappedSuperclass ormContextMappedSuperclass = (EclipseLinkOrmMappedSuperclass) ormPersistentType.getMapping();
- Caching ormContextCaching = ormContextMappedSuperclass.getCaching();
- XmlMappedSuperclass resourceMappedSuperclass = (XmlMappedSuperclass) getXmlEntityMappings().getMappedSuperclasses().get(0);
-
- // check defaults
-
- assertEquals(null, resourceMappedSuperclass.getCache());
- assertEquals(false, ormContextCaching.isAlwaysRefresh());
- assertEquals(false, ormContextCaching.isDefaultAlwaysRefresh());
- assertEquals(null, ormContextCaching.getSpecifiedAlwaysRefresh());
-
- // set context cache size, check resource
-
- ormContextMappedSuperclass.getCaching().setSpecifiedAlwaysRefresh(Boolean.TRUE);
- assertEquals(Boolean.TRUE, resourceMappedSuperclass.getCache().getAlwaysRefresh());
- assertEquals(true, ormContextCaching.isAlwaysRefresh());
- assertEquals(false, ormContextCaching.isDefaultAlwaysRefresh());
- assertEquals(Boolean.TRUE, ormContextCaching.getSpecifiedAlwaysRefresh());
-
- // set context cache size to null, check resource
-
- ormContextMappedSuperclass.getCaching().setSpecifiedAlwaysRefresh(null);
-
- assertEquals(null, resourceMappedSuperclass.getCache());
- assertEquals(false, ormContextCaching.isAlwaysRefresh());
- assertEquals(false, ormContextCaching.isDefaultAlwaysRefresh());
- assertEquals(null, ormContextCaching.getSpecifiedAlwaysRefresh());
- }
-
- public void testUpdateCacheRefreshOnlyIfNewer() throws Exception {
- createTestMappedSuperclassForCaching();
- OrmPersistentType ormPersistentType = getEntityMappings().addPersistentType(MappingKeys.MAPPED_SUPERCLASS_TYPE_MAPPING_KEY, FULLY_QUALIFIED_TYPE_NAME);
- JavaCaching javaContextCaching = ((EclipseLinkJavaMappedSuperclass) ormPersistentType.getJavaPersistentType().getMapping()).getCaching();
- EclipseLinkOrmMappedSuperclass ormContextMappedSuperclass = (EclipseLinkOrmMappedSuperclass) ormPersistentType.getMapping();
- Caching ormContextCaching = ormContextMappedSuperclass.getCaching();
- XmlMappedSuperclass resourceMappedSuperclass = (XmlMappedSuperclass) getXmlEntityMappings().getMappedSuperclasses().get(0);
-
-
- // check defaults
-
- assertEquals(null, resourceMappedSuperclass.getCache());
- assertEquals(false, javaContextCaching.isRefreshOnlyIfNewer());
- assertEquals(false, ormContextCaching.isRefreshOnlyIfNewer());
- assertEquals(false, ormContextCaching.isDefaultRefreshOnlyIfNewer());
- assertEquals(null, ormContextCaching.getSpecifiedRefreshOnlyIfNewer());
-
- // set xml cache, check defaults
- resourceMappedSuperclass.setCache(EclipseLinkOrmFactory.eINSTANCE.createXmlCache());
- assertEquals(null, resourceMappedSuperclass.getCache().getRefreshOnlyIfNewer());
- assertEquals(false, javaContextCaching.isRefreshOnlyIfNewer());
- assertEquals(false, ormContextCaching.isRefreshOnlyIfNewer());
- assertEquals(false, ormContextCaching.isDefaultRefreshOnlyIfNewer());
- assertEquals(null, ormContextCaching.getSpecifiedRefreshOnlyIfNewer());
-
-
- // set xml cache size, check settings
- resourceMappedSuperclass.getCache().setRefreshOnlyIfNewer(Boolean.TRUE);
- assertEquals(Boolean.TRUE, resourceMappedSuperclass.getCache().getRefreshOnlyIfNewer());
- assertEquals(false, javaContextCaching.isRefreshOnlyIfNewer());
- assertEquals(true, ormContextCaching.isRefreshOnlyIfNewer());
- assertEquals(false, ormContextCaching.isDefaultRefreshOnlyIfNewer());
- assertEquals(Boolean.TRUE, ormContextCaching.getSpecifiedRefreshOnlyIfNewer());
-
-
- // set java cache size, check defaults
-
- javaContextCaching.setSpecifiedRefreshOnlyIfNewer(Boolean.TRUE);
-
- assertEquals(Boolean.TRUE, resourceMappedSuperclass.getCache().getRefreshOnlyIfNewer());
- assertEquals(true, javaContextCaching.isRefreshOnlyIfNewer());
- assertEquals(true, ormContextCaching.isRefreshOnlyIfNewer());
- assertEquals(false, ormContextCaching.isDefaultRefreshOnlyIfNewer());
- assertEquals(Boolean.TRUE, ormContextCaching.getSpecifiedRefreshOnlyIfNewer());
-
- // set xml cache always refresh to false
- resourceMappedSuperclass.getCache().setRefreshOnlyIfNewer(Boolean.FALSE);
- assertEquals(Boolean.FALSE, resourceMappedSuperclass.getCache().getRefreshOnlyIfNewer());
- assertEquals(true, javaContextCaching.isRefreshOnlyIfNewer());
- assertEquals(false, ormContextCaching.isRefreshOnlyIfNewer());
- assertEquals(false, ormContextCaching.isDefaultRefreshOnlyIfNewer());
- assertEquals(Boolean.FALSE, ormContextCaching.getSpecifiedRefreshOnlyIfNewer());
-
- // clear xml cache always refresh, check defaults
- resourceMappedSuperclass.getCache().setRefreshOnlyIfNewer(null);
-
- assertEquals(null, resourceMappedSuperclass.getCache().getRefreshOnlyIfNewer());
- assertEquals(true, javaContextCaching.isRefreshOnlyIfNewer());
- assertEquals(false, ormContextCaching.isRefreshOnlyIfNewer());
- assertEquals(false, ormContextCaching.isDefaultRefreshOnlyIfNewer());
- assertEquals(null, ormContextCaching.getSpecifiedRefreshOnlyIfNewer());
-
-
- // clear xml cache, check defaults
- resourceMappedSuperclass.setCache(null);
-
- assertEquals(null, resourceMappedSuperclass.getCache());
- assertEquals(true, javaContextCaching.isRefreshOnlyIfNewer());
- assertEquals(true, ormContextCaching.isRefreshOnlyIfNewer());
- assertEquals(true, ormContextCaching.isDefaultRefreshOnlyIfNewer());
- assertEquals(null, ormContextCaching.getSpecifiedRefreshOnlyIfNewer());
-
-
- // set metadataComplete to True, check defaults not from java
-
- ormContextMappedSuperclass.setSpecifiedMetadataComplete(Boolean.TRUE);
-
- assertEquals(null, resourceMappedSuperclass.getCache());
- assertEquals(true, javaContextCaching.isRefreshOnlyIfNewer());
- assertEquals(false, ormContextCaching.isRefreshOnlyIfNewer());
- assertEquals(false, ormContextCaching.isDefaultRefreshOnlyIfNewer());
- assertEquals(null, ormContextCaching.getSpecifiedRefreshOnlyIfNewer());
-
-
- // set metadataComplete back to null, check defaults from java
- ormContextMappedSuperclass.setSpecifiedMetadataComplete(null);
-
- assertEquals(null, resourceMappedSuperclass.getCache());
- assertEquals(true, javaContextCaching.isRefreshOnlyIfNewer());
- assertEquals(true, ormContextCaching.isRefreshOnlyIfNewer());
- assertEquals(true, ormContextCaching.isDefaultRefreshOnlyIfNewer());
- assertEquals(null, ormContextCaching.getSpecifiedRefreshOnlyIfNewer());
- }
-
- public void testModifyCacheRefreshOnlyIfNewer() throws Exception {
- createTestMappedSuperclassForCaching();
- OrmPersistentType ormPersistentType = getEntityMappings().addPersistentType(MappingKeys.MAPPED_SUPERCLASS_TYPE_MAPPING_KEY, FULLY_QUALIFIED_TYPE_NAME);
- EclipseLinkOrmMappedSuperclass ormContextMappedSuperclass = (EclipseLinkOrmMappedSuperclass) ormPersistentType.getMapping();
- Caching ormContextCaching = ormContextMappedSuperclass.getCaching();
- XmlMappedSuperclass resourceMappedSuperclass = (XmlMappedSuperclass) getXmlEntityMappings().getMappedSuperclasses().get(0);
-
- // check defaults
-
- assertEquals(null, resourceMappedSuperclass.getCache());
- assertEquals(false, ormContextCaching.isRefreshOnlyIfNewer());
- assertEquals(false, ormContextCaching.isDefaultRefreshOnlyIfNewer());
- assertEquals(null, ormContextCaching.getSpecifiedRefreshOnlyIfNewer());
-
- // set context cache size, check resource
-
- ormContextMappedSuperclass.getCaching().setSpecifiedRefreshOnlyIfNewer(Boolean.TRUE);
- assertEquals(Boolean.TRUE, resourceMappedSuperclass.getCache().getRefreshOnlyIfNewer());
- assertEquals(true, ormContextCaching.isRefreshOnlyIfNewer());
- assertEquals(false, ormContextCaching.isDefaultRefreshOnlyIfNewer());
- assertEquals(Boolean.TRUE, ormContextCaching.getSpecifiedRefreshOnlyIfNewer());
-
- // set context cache size to null, check resource
-
- ormContextMappedSuperclass.getCaching().setSpecifiedRefreshOnlyIfNewer(null);
-
- assertEquals(null, resourceMappedSuperclass.getCache());
- assertEquals(false, ormContextCaching.isRefreshOnlyIfNewer());
- assertEquals(false, ormContextCaching.isDefaultRefreshOnlyIfNewer());
- assertEquals(null, ormContextCaching.getSpecifiedRefreshOnlyIfNewer());
- }
-
- public void testUpdateCacheDisableHits() throws Exception {
- createTestMappedSuperclassForCaching();
- OrmPersistentType ormPersistentType = getEntityMappings().addPersistentType(MappingKeys.MAPPED_SUPERCLASS_TYPE_MAPPING_KEY, FULLY_QUALIFIED_TYPE_NAME);
- JavaCaching javaContextCaching = ((EclipseLinkJavaMappedSuperclass) ormPersistentType.getJavaPersistentType().getMapping()).getCaching();
- EclipseLinkOrmMappedSuperclass ormContextMappedSuperclass = (EclipseLinkOrmMappedSuperclass) ormPersistentType.getMapping();
- Caching ormContextCaching = ormContextMappedSuperclass.getCaching();
- XmlMappedSuperclass resourceMappedSuperclass = (XmlMappedSuperclass) getXmlEntityMappings().getMappedSuperclasses().get(0);
-
-
- // check defaults
-
- assertEquals(null, resourceMappedSuperclass.getCache());
- assertEquals(false, javaContextCaching.isDisableHits());
- assertEquals(false, ormContextCaching.isDisableHits());
- assertEquals(false, ormContextCaching.isDefaultDisableHits());
- assertEquals(null, ormContextCaching.getSpecifiedDisableHits());
-
- // set xml cache, check defaults
- resourceMappedSuperclass.setCache(EclipseLinkOrmFactory.eINSTANCE.createXmlCache());
- assertEquals(null, resourceMappedSuperclass.getCache().getDisableHits());
- assertEquals(false, javaContextCaching.isDisableHits());
- assertEquals(false, ormContextCaching.isDisableHits());
- assertEquals(false, ormContextCaching.isDefaultDisableHits());
- assertEquals(null, ormContextCaching.getSpecifiedDisableHits());
-
-
- // set xml cache size, check settings
- resourceMappedSuperclass.getCache().setDisableHits(Boolean.TRUE);
- assertEquals(Boolean.TRUE, resourceMappedSuperclass.getCache().getDisableHits());
- assertEquals(false, javaContextCaching.isDisableHits());
- assertEquals(true, ormContextCaching.isDisableHits());
- assertEquals(false, ormContextCaching.isDefaultDisableHits());
- assertEquals(Boolean.TRUE, ormContextCaching.getSpecifiedDisableHits());
-
-
- // set java cache size, check defaults
-
- javaContextCaching.setSpecifiedDisableHits(Boolean.TRUE);
-
- assertEquals(Boolean.TRUE, resourceMappedSuperclass.getCache().getDisableHits());
- assertEquals(true, javaContextCaching.isDisableHits());
- assertEquals(true, ormContextCaching.isDisableHits());
- assertEquals(false, ormContextCaching.isDefaultDisableHits());
- assertEquals(Boolean.TRUE, ormContextCaching.getSpecifiedDisableHits());
-
- // set xml cache always refresh to false
- resourceMappedSuperclass.getCache().setDisableHits(Boolean.FALSE);
- assertEquals(Boolean.FALSE, resourceMappedSuperclass.getCache().getDisableHits());
- assertEquals(true, javaContextCaching.isDisableHits());
- assertEquals(false, ormContextCaching.isDisableHits());
- assertEquals(false, ormContextCaching.isDefaultDisableHits());
- assertEquals(Boolean.FALSE, ormContextCaching.getSpecifiedDisableHits());
-
- // clear xml cache always refresh, check defaults
- resourceMappedSuperclass.getCache().setDisableHits(null);
-
- assertEquals(null, resourceMappedSuperclass.getCache().getDisableHits());
- assertEquals(true, javaContextCaching.isDisableHits());
- assertEquals(false, ormContextCaching.isDisableHits());
- assertEquals(false, ormContextCaching.isDefaultDisableHits());
- assertEquals(null, ormContextCaching.getSpecifiedDisableHits());
-
-
- // clear xml cache, check defaults
- resourceMappedSuperclass.setCache(null);
-
- assertEquals(null, resourceMappedSuperclass.getCache());
- assertEquals(true, javaContextCaching.isDisableHits());
- assertEquals(true, ormContextCaching.isDisableHits());
- assertEquals(true, ormContextCaching.isDefaultDisableHits());
- assertEquals(null, ormContextCaching.getSpecifiedDisableHits());
-
-
- // set metadataComplete to True, check defaults not from java
-
- ormContextMappedSuperclass.setSpecifiedMetadataComplete(Boolean.TRUE);
-
- assertEquals(null, resourceMappedSuperclass.getCache());
- assertEquals(true, javaContextCaching.isDisableHits());
- assertEquals(false, ormContextCaching.isDisableHits());
- assertEquals(false, ormContextCaching.isDefaultDisableHits());
- assertEquals(null, ormContextCaching.getSpecifiedDisableHits());
-
-
- // set metadataComplete back to null, check defaults from java
- ormContextMappedSuperclass.setSpecifiedMetadataComplete(null);
-
- assertEquals(null, resourceMappedSuperclass.getCache());
- assertEquals(true, javaContextCaching.isDisableHits());
- assertEquals(true, ormContextCaching.isDisableHits());
- assertEquals(true, ormContextCaching.isDefaultDisableHits());
- assertEquals(null, ormContextCaching.getSpecifiedDisableHits());
- }
-
- public void testModifyCacheDisableHits() throws Exception {
- createTestMappedSuperclassForCaching();
- OrmPersistentType ormPersistentType = getEntityMappings().addPersistentType(MappingKeys.MAPPED_SUPERCLASS_TYPE_MAPPING_KEY, FULLY_QUALIFIED_TYPE_NAME);
- EclipseLinkOrmMappedSuperclass ormContextMappedSuperclass = (EclipseLinkOrmMappedSuperclass) ormPersistentType.getMapping();
- Caching ormContextCaching = ormContextMappedSuperclass.getCaching();
- XmlMappedSuperclass resourceMappedSuperclass = (XmlMappedSuperclass) getXmlEntityMappings().getMappedSuperclasses().get(0);
-
- // check defaults
-
- assertEquals(null, resourceMappedSuperclass.getCache());
- assertEquals(false, ormContextCaching.isDisableHits());
- assertEquals(false, ormContextCaching.isDefaultDisableHits());
- assertEquals(null, ormContextCaching.getSpecifiedDisableHits());
-
- // set context cache size, check resource
-
- ormContextMappedSuperclass.getCaching().setSpecifiedDisableHits(Boolean.TRUE);
- assertEquals(Boolean.TRUE, resourceMappedSuperclass.getCache().getDisableHits());
- assertEquals(true, ormContextCaching.isDisableHits());
- assertEquals(false, ormContextCaching.isDefaultDisableHits());
- assertEquals(Boolean.TRUE, ormContextCaching.getSpecifiedDisableHits());
-
- // set context cache size to null, check resource
-
- ormContextMappedSuperclass.getCaching().setSpecifiedDisableHits(null);
-
- assertEquals(null, resourceMappedSuperclass.getCache());
- assertEquals(false, ormContextCaching.isDisableHits());
- assertEquals(false, ormContextCaching.isDefaultDisableHits());
- assertEquals(null, ormContextCaching.getSpecifiedDisableHits());
- }
-
- public void testUpdateCacheShared() throws Exception {
- createTestMappedSuperclassForCaching();
- OrmPersistentType ormPersistentType = getEntityMappings().addPersistentType(MappingKeys.MAPPED_SUPERCLASS_TYPE_MAPPING_KEY, FULLY_QUALIFIED_TYPE_NAME);
- JavaCaching javaContextCaching = ((EclipseLinkJavaMappedSuperclass) ormPersistentType.getJavaPersistentType().getMapping()).getCaching();
- EclipseLinkOrmMappedSuperclass ormContextMappedSuperclass = (EclipseLinkOrmMappedSuperclass) ormPersistentType.getMapping();
- Caching ormContextCaching = ormContextMappedSuperclass.getCaching();
- XmlMappedSuperclass resourceMappedSuperclass = (XmlMappedSuperclass) getXmlEntityMappings().getMappedSuperclasses().get(0);
-
-
- // check defaults
-
- assertEquals(null, resourceMappedSuperclass.getCache());
- assertEquals(true, javaContextCaching.isShared());
- assertEquals(true, ormContextCaching.isShared());
- assertEquals(true, ormContextCaching.isDefaultShared());
- assertEquals(null, ormContextCaching.getSpecifiedShared());
-
- // set xml cache, check defaults
- resourceMappedSuperclass.setCache(EclipseLinkOrmFactory.eINSTANCE.createXmlCache());
- assertEquals(null, resourceMappedSuperclass.getCache().getShared());
- assertEquals(true, javaContextCaching.isShared());
- assertEquals(true, ormContextCaching.isShared());
- assertEquals(true, ormContextCaching.isDefaultShared());
- assertEquals(null, ormContextCaching.getSpecifiedShared());
-
-
- // set xml cache size, check settings
- resourceMappedSuperclass.getCache().setShared(Boolean.FALSE);
- assertEquals(Boolean.FALSE, resourceMappedSuperclass.getCache().getShared());
- assertEquals(true, javaContextCaching.isShared());
- assertEquals(false, ormContextCaching.isShared());
- assertEquals(true, ormContextCaching.isDefaultShared());
- assertEquals(Boolean.FALSE, ormContextCaching.getSpecifiedShared());
-
-
- // set java cache size, check defaults
-
- javaContextCaching.setSpecifiedShared(Boolean.FALSE);
-
- assertEquals(Boolean.FALSE, resourceMappedSuperclass.getCache().getShared());
- assertEquals(false, javaContextCaching.isShared());
- assertEquals(false, ormContextCaching.isShared());
- assertEquals(true, ormContextCaching.isDefaultShared());
- assertEquals(Boolean.FALSE, ormContextCaching.getSpecifiedShared());
-
- // set xml cache always refresh to false
- resourceMappedSuperclass.getCache().setShared(Boolean.TRUE);
- assertEquals(Boolean.TRUE, resourceMappedSuperclass.getCache().getShared());
- assertEquals(false, javaContextCaching.isShared());
- assertEquals(true, ormContextCaching.isShared());
- assertEquals(true, ormContextCaching.isDefaultShared());
- assertEquals(Boolean.TRUE, ormContextCaching.getSpecifiedShared());
-
- // clear xml cache always refresh, check defaults
- resourceMappedSuperclass.getCache().setShared(null);
-
- assertEquals(null, resourceMappedSuperclass.getCache().getShared());
- assertEquals(false, javaContextCaching.isShared());
- assertEquals(true, ormContextCaching.isShared());
- assertEquals(true, ormContextCaching.isDefaultShared());
- assertEquals(null, ormContextCaching.getSpecifiedShared());
-
-
- // clear xml cache, check defaults
- resourceMappedSuperclass.setCache(null);
-
- assertEquals(null, resourceMappedSuperclass.getCache());
- assertEquals(false, javaContextCaching.isShared());
- assertEquals(false, ormContextCaching.isShared());
- assertEquals(false, ormContextCaching.isDefaultShared());
- assertEquals(null, ormContextCaching.getSpecifiedShared());
-
-
- // set metadataComplete to True, check defaults not from java
-
- ormContextMappedSuperclass.setSpecifiedMetadataComplete(Boolean.TRUE);
-
- assertEquals(null, resourceMappedSuperclass.getCache());
- assertEquals(false, javaContextCaching.isShared());
- assertEquals(true, ormContextCaching.isShared());
- assertEquals(true, ormContextCaching.isDefaultShared());
- assertEquals(null, ormContextCaching.getSpecifiedShared());
-
-
- // set metadataComplete back to null, check defaults from java
- ormContextMappedSuperclass.setSpecifiedMetadataComplete(null);
-
- assertEquals(null, resourceMappedSuperclass.getCache());
- assertEquals(false, javaContextCaching.isShared());
- assertEquals(false, ormContextCaching.isShared());
- assertEquals(false, ormContextCaching.isDefaultShared());
- assertEquals(null, ormContextCaching.getSpecifiedShared());
- }
-
- public void testModifyCacheShared() throws Exception {
- createTestMappedSuperclassForCaching();
- OrmPersistentType ormPersistentType = getEntityMappings().addPersistentType(MappingKeys.MAPPED_SUPERCLASS_TYPE_MAPPING_KEY, FULLY_QUALIFIED_TYPE_NAME);
- EclipseLinkOrmMappedSuperclass ormContextMappedSuperclass = (EclipseLinkOrmMappedSuperclass) ormPersistentType.getMapping();
- Caching ormContextCaching = ormContextMappedSuperclass.getCaching();
- XmlMappedSuperclass resourceMappedSuperclass = (XmlMappedSuperclass) getXmlEntityMappings().getMappedSuperclasses().get(0);
-
- // check defaults
-
- assertEquals(null, resourceMappedSuperclass.getCache());
- assertEquals(true, ormContextCaching.isShared());
- assertEquals(true, ormContextCaching.isDefaultShared());
- assertEquals(null, ormContextCaching.getSpecifiedShared());
-
- // set context cache size, check resource
-
- ormContextMappedSuperclass.getCaching().setSpecifiedShared(Boolean.FALSE);
- assertEquals(Boolean.FALSE, resourceMappedSuperclass.getCache().getShared());
- assertEquals(false, ormContextCaching.isShared());
- assertEquals(true, ormContextCaching.isDefaultShared());
- assertEquals(Boolean.FALSE, ormContextCaching.getSpecifiedShared());
-
- // set context cache size to null, check resource
-
- ormContextMappedSuperclass.getCaching().setSpecifiedShared(null);
-
- assertEquals(null, resourceMappedSuperclass.getCache());
- assertEquals(true, ormContextCaching.isShared());
- assertEquals(true, ormContextCaching.isDefaultShared());
- assertEquals(null, ormContextCaching.getSpecifiedShared());
- }
-
- public void testUpdateExistenceChecking() throws Exception {
- createTestMappedSuperclassForCaching();
- OrmPersistentType ormPersistentType = getEntityMappings().addPersistentType(MappingKeys.MAPPED_SUPERCLASS_TYPE_MAPPING_KEY, FULLY_QUALIFIED_TYPE_NAME);
- JavaCaching javaContextCaching = ((EclipseLinkJavaMappedSuperclass) ormPersistentType.getJavaPersistentType().getMapping()).getCaching();
- EclipseLinkOrmMappedSuperclass ormContextMappedSuperclass = (EclipseLinkOrmMappedSuperclass) ormPersistentType.getMapping();
- Caching ormContextCaching = ormContextMappedSuperclass.getCaching();
- XmlMappedSuperclass resourceMappedSuperclass = (XmlMappedSuperclass) getXmlEntityMappings().getMappedSuperclasses().get(0);
-
-
- // check defaults
-
- assertEquals(null, resourceMappedSuperclass.getExistenceChecking());
- assertEquals(ExistenceType.CHECK_DATABASE, javaContextCaching.getExistenceType());
- assertEquals(ExistenceType.CHECK_DATABASE, ormContextCaching.getExistenceType());
- assertEquals(ExistenceType.CHECK_DATABASE, ormContextCaching.getDefaultExistenceType());
- assertEquals(null, ormContextCaching.getSpecifiedExistenceType());
-
- // set xml existence checking, check settings
- resourceMappedSuperclass.setExistenceChecking(org.eclipse.jpt.eclipselink.core.resource.orm.ExistenceType.ASSUME_EXISTENCE);
- assertEquals(org.eclipse.jpt.eclipselink.core.resource.orm.ExistenceType.ASSUME_EXISTENCE, resourceMappedSuperclass.getExistenceChecking());
- assertEquals(ExistenceType.CHECK_DATABASE, javaContextCaching.getExistenceType());
- assertEquals(ExistenceType.ASSUME_EXISTENCE, ormContextCaching.getExistenceType());
- assertEquals(ExistenceType.CHECK_DATABASE, ormContextCaching.getDefaultExistenceType());
- assertEquals(ExistenceType.ASSUME_EXISTENCE, ormContextCaching.getSpecifiedExistenceType());
-
-
- // set java cache existence checking, check defaults
-
- javaContextCaching.setSpecifiedExistenceType(ExistenceType.ASSUME_NON_EXISTENCE);
-
- assertEquals(org.eclipse.jpt.eclipselink.core.resource.orm.ExistenceType.ASSUME_EXISTENCE, resourceMappedSuperclass.getExistenceChecking());
- assertEquals(ExistenceType.ASSUME_NON_EXISTENCE, javaContextCaching.getExistenceType());
- assertEquals(ExistenceType.ASSUME_EXISTENCE, ormContextCaching.getExistenceType());
- assertEquals(ExistenceType.ASSUME_NON_EXISTENCE, ormContextCaching.getDefaultExistenceType());
- assertEquals(ExistenceType.ASSUME_EXISTENCE, ormContextCaching.getSpecifiedExistenceType());
-
- // clear xml existence checking, check defaults
- resourceMappedSuperclass.setExistenceChecking(null);
-
- assertEquals(null, resourceMappedSuperclass.getExistenceChecking());
- assertEquals(ExistenceType.ASSUME_NON_EXISTENCE, javaContextCaching.getExistenceType());
- assertEquals(ExistenceType.ASSUME_NON_EXISTENCE, ormContextCaching.getExistenceType());
- assertEquals(ExistenceType.ASSUME_NON_EXISTENCE, ormContextCaching.getDefaultExistenceType());
- assertEquals(null, ormContextCaching.getSpecifiedExistenceType());
-
- // set metadataComplete to True, check defaults not from java
-
- ormContextMappedSuperclass.setSpecifiedMetadataComplete(Boolean.TRUE);
-
- assertEquals(null, resourceMappedSuperclass.getExistenceChecking());
- assertEquals(ExistenceType.ASSUME_NON_EXISTENCE, javaContextCaching.getExistenceType());
- assertEquals(ExistenceType.CHECK_DATABASE, ormContextCaching.getExistenceType());
- assertEquals(ExistenceType.CHECK_DATABASE, ormContextCaching.getDefaultExistenceType());
- assertEquals(null, ormContextCaching.getSpecifiedExistenceType());
-
- ormContextMappedSuperclass.setSpecifiedMetadataComplete(null);
- }
-
- public void testModifyExistenceChecking() throws Exception {
- createTestMappedSuperclassForCaching();
- OrmPersistentType ormPersistentType = getEntityMappings().addPersistentType(MappingKeys.MAPPED_SUPERCLASS_TYPE_MAPPING_KEY, FULLY_QUALIFIED_TYPE_NAME);
- EclipseLinkOrmMappedSuperclass ormContextMappedSuperclass = (EclipseLinkOrmMappedSuperclass) ormPersistentType.getMapping();
- Caching ormContextCaching = ormContextMappedSuperclass.getCaching();
- XmlMappedSuperclass resourceMappedSuperclass = (XmlMappedSuperclass) getXmlEntityMappings().getMappedSuperclasses().get(0);
-
- // check defaults
-
- assertEquals(null, resourceMappedSuperclass.getExistenceChecking());
- assertEquals(ExistenceType.CHECK_DATABASE, ormContextCaching.getExistenceType());
- assertEquals(ExistenceType.CHECK_DATABASE, ormContextCaching.getDefaultExistenceType());
- assertEquals(null, ormContextCaching.getSpecifiedExistenceType());
-
- // set context cache existence checking, check resource
-
- ormContextMappedSuperclass.getCaching().setSpecifiedExistenceType(ExistenceType.ASSUME_EXISTENCE);
- assertEquals(org.eclipse.jpt.eclipselink.core.resource.orm.ExistenceType.ASSUME_EXISTENCE, resourceMappedSuperclass.getExistenceChecking());
- assertEquals(ExistenceType.ASSUME_EXISTENCE, ormContextCaching.getExistenceType());
- assertEquals(ExistenceType.CHECK_DATABASE, ormContextCaching.getDefaultExistenceType());
- assertEquals(ExistenceType.ASSUME_EXISTENCE, ormContextCaching.getSpecifiedExistenceType());
-
- // set context existence checking to null, check resource
-
- ormContextMappedSuperclass.getCaching().setSpecifiedExistenceType(null);
-
- assertEquals(null, resourceMappedSuperclass.getExistenceChecking());
- assertEquals(ExistenceType.CHECK_DATABASE, ormContextCaching.getExistenceType());
- assertEquals(ExistenceType.CHECK_DATABASE, ormContextCaching.getDefaultExistenceType());
- assertEquals(null, ormContextCaching.getSpecifiedExistenceType());
- }
- public void testUpdateCustomConverters() throws Exception {
- createTestMappedSuperclassForConverters();
- EclipseLinkPersistenceUnit persistenceUnit = getPersistenceUnit();
- OrmPersistentType ormPersistentType = getEntityMappings().addPersistentType(MappingKeys.MAPPED_SUPERCLASS_TYPE_MAPPING_KEY, FULLY_QUALIFIED_TYPE_NAME);
- EclipseLinkOrmMappedSuperclass ormContextMappedSuperclass = (EclipseLinkOrmMappedSuperclass) ormPersistentType.getMapping();
- ConverterHolder ormContextConverterHolder = ormContextMappedSuperclass.getConverterHolder();
- XmlMappedSuperclass resourceMappedSuperclass = (XmlMappedSuperclass) getXmlEntityMappings().getMappedSuperclasses().get(0);
-
- assertEquals(0, ormContextConverterHolder.customConvertersSize());
- assertEquals(0, resourceMappedSuperclass.getConverters().size());
- assertEquals(0, CollectionTools.size(persistenceUnit.allConverters()));
-
- //add a converter to the resource model, check context model
- XmlConverter resourceConverter = EclipseLinkOrmFactory.eINSTANCE.createXmlConverter();
- resourceMappedSuperclass.getConverters().add(resourceConverter);
- resourceConverter.setClassName("Foo");
- resourceConverter.setName("myConverter");
-
- assertEquals(1, ormContextConverterHolder.customConvertersSize());
- ListIterator<CustomConverter> ormContextConverters = ormContextConverterHolder.customConverters();
- CustomConverter ormContextConverter = ormContextConverters.next();
- assertEquals("Foo", ormContextConverter.getConverterClass());
- assertEquals("myConverter", ormContextConverter.getName());
- assertEquals(1, resourceMappedSuperclass.getConverters().size());
- assertEquals(1, CollectionTools.size(persistenceUnit.allConverters()));
-
- //add another converter to the resource model, check context model
- XmlConverter resourceConverter2 = EclipseLinkOrmFactory.eINSTANCE.createXmlConverter();
- resourceMappedSuperclass.getConverters().add(0, resourceConverter2);
- resourceConverter2.setClassName("Foo2");
- resourceConverter2.setName("myConverter2");
-
- assertEquals(2, ormContextConverterHolder.customConvertersSize());
- ormContextConverters = ormContextConverterHolder.customConverters();
- ormContextConverter = ormContextConverters.next();
- assertEquals("Foo2", ormContextConverter.getConverterClass());
- assertEquals("myConverter2", ormContextConverter.getName());
- ormContextConverter = ormContextConverters.next();
- assertEquals("Foo", ormContextConverter.getConverterClass());
- assertEquals("myConverter", ormContextConverter.getName());
- assertEquals(2, resourceMappedSuperclass.getConverters().size());
- assertEquals(2, CollectionTools.size(persistenceUnit.allConverters()));
-
- //move a converter in the resource model, check context model
- resourceMappedSuperclass.getConverters().move(0, 1);
-
- assertEquals(2, ormContextConverterHolder.customConvertersSize());
- ormContextConverters = ormContextConverterHolder.customConverters();
- ormContextConverter = ormContextConverters.next();
- assertEquals("Foo", ormContextConverter.getConverterClass());
- assertEquals("myConverter", ormContextConverter.getName());
- ormContextConverter = ormContextConverters.next();
- assertEquals("Foo2", ormContextConverter.getConverterClass());
- assertEquals("myConverter2", ormContextConverter.getName());
- assertEquals(2, resourceMappedSuperclass.getConverters().size());
- assertEquals(2, CollectionTools.size(persistenceUnit.allConverters()));
-
- //remove a converter from the resource model, check context model
- resourceMappedSuperclass.getConverters().remove(0);
-
- assertEquals(1, ormContextConverterHolder.customConvertersSize());
- ormContextConverters = ormContextConverterHolder.customConverters();
- ormContextConverter = ormContextConverters.next();
- assertEquals("Foo2", ormContextConverter.getConverterClass());
- assertEquals("myConverter2", ormContextConverter.getName());
- assertEquals(1, resourceMappedSuperclass.getConverters().size());
- assertEquals(1, CollectionTools.size(persistenceUnit.allConverters()));
-
- //remove a converter from the resource model, check context model
- resourceMappedSuperclass.getConverters().remove(resourceConverter2);
-
- assertEquals(0, ormContextConverterHolder.customConvertersSize());
- assertFalse(ormContextConverterHolder.customConverters().hasNext());
- assertEquals(0, resourceMappedSuperclass.getConverters().size());
- assertEquals(0, CollectionTools.size(persistenceUnit.allConverters()));
- }
-
- public void testModifyCustomConverters() throws Exception {
- createTestMappedSuperclassForConverters();
- EclipseLinkPersistenceUnit persistenceUnit = getPersistenceUnit();
- OrmPersistentType ormPersistentType = getEntityMappings().addPersistentType(MappingKeys.MAPPED_SUPERCLASS_TYPE_MAPPING_KEY, FULLY_QUALIFIED_TYPE_NAME);
- EclipseLinkOrmMappedSuperclass ormContextMappedSuperclass = (EclipseLinkOrmMappedSuperclass) ormPersistentType.getMapping();
- ConverterHolder ormContextConverterHolder = ormContextMappedSuperclass.getConverterHolder();
- XmlMappedSuperclass resourceMappedSuperclass = (XmlMappedSuperclass) getXmlEntityMappings().getMappedSuperclasses().get(0);
-
- assertEquals(0, ormContextConverterHolder.customConvertersSize());
- assertEquals(0, resourceMappedSuperclass.getConverters().size());
- assertEquals(0, CollectionTools.size(persistenceUnit.allConverters()));
-
- //add a converter to the context model, check resource model
- CustomConverter contextConverter = ormContextConverterHolder.addCustomConverter(0);
- contextConverter.setConverterClass("Foo");
- contextConverter.setName("myConverter");
-
- assertEquals(1, resourceMappedSuperclass.getConverters().size());
- assertEquals("Foo", resourceMappedSuperclass.getConverters().get(0).getClassName());
- assertEquals("myConverter", resourceMappedSuperclass.getConverters().get(0).getName());
- assertEquals(1, ormContextConverterHolder.customConvertersSize());
- ListIterator<CustomConverter> ormContextConverters = ormContextConverterHolder.customConverters();
- CustomConverter ormContextConverter = ormContextConverters.next();
- assertEquals("Foo", ormContextConverter.getConverterClass());
- assertEquals("myConverter", ormContextConverter.getName());
- assertEquals(1, CollectionTools.size(persistenceUnit.allConverters()));
-
- //add another converter to the context model, check resource model
- CustomConverter contextConverter2 = ormContextConverterHolder.addCustomConverter(0);
- contextConverter2.setConverterClass("Foo2");
- contextConverter2.setName("myConverter2");
-
- assertEquals(2, resourceMappedSuperclass.getConverters().size());
- assertEquals("Foo2", resourceMappedSuperclass.getConverters().get(0).getClassName());
- assertEquals("myConverter2", resourceMappedSuperclass.getConverters().get(0).getName());
- assertEquals("Foo", resourceMappedSuperclass.getConverters().get(1).getClassName());
- assertEquals("myConverter", resourceMappedSuperclass.getConverters().get(1).getName());
- assertEquals(2, ormContextConverterHolder.customConvertersSize());
- ormContextConverters = ormContextConverterHolder.customConverters();
- ormContextConverter = ormContextConverters.next();
- assertEquals("Foo2", ormContextConverter.getConverterClass());
- assertEquals("myConverter2", ormContextConverter.getName());
- ormContextConverter = ormContextConverters.next();
- assertEquals("Foo", ormContextConverter.getConverterClass());
- assertEquals("myConverter", ormContextConverter.getName());
- assertEquals(2, CollectionTools.size(persistenceUnit.allConverters()));
-
- //move a converter in the context model, check resource model
- ormContextConverterHolder.moveCustomConverter(0, 1);
-
- assertEquals(2, resourceMappedSuperclass.getConverters().size());
- assertEquals("Foo", resourceMappedSuperclass.getConverters().get(0).getClassName());
- assertEquals("myConverter", resourceMappedSuperclass.getConverters().get(0).getName());
- assertEquals("Foo2", resourceMappedSuperclass.getConverters().get(1).getClassName());
- assertEquals("myConverter2", resourceMappedSuperclass.getConverters().get(1).getName());
- assertEquals(2, ormContextConverterHolder.customConvertersSize());
- ormContextConverters = ormContextConverterHolder.customConverters();
- ormContextConverter = ormContextConverters.next();
- assertEquals("Foo", ormContextConverter.getConverterClass());
- assertEquals("myConverter", ormContextConverter.getName());
- ormContextConverter = ormContextConverters.next();
- assertEquals("Foo2", ormContextConverter.getConverterClass());
- assertEquals("myConverter2", ormContextConverter.getName());
- assertEquals(2, CollectionTools.size(persistenceUnit.allConverters()));
-
- //remove a converter from the context model, check resource model
- ormContextConverterHolder.removeCustomConverter(0);
-
- assertEquals(1, resourceMappedSuperclass.getConverters().size());
- assertEquals("Foo2", resourceMappedSuperclass.getConverters().get(0).getClassName());
- assertEquals("myConverter2", resourceMappedSuperclass.getConverters().get(0).getName());
- assertEquals(1, ormContextConverterHolder.customConvertersSize());
- ormContextConverters = ormContextConverterHolder.customConverters();
- ormContextConverter = ormContextConverters.next();
- assertEquals("Foo2", ormContextConverter.getConverterClass());
- assertEquals("myConverter2", ormContextConverter.getName());
- assertEquals(1, CollectionTools.size(persistenceUnit.allConverters()));
-
- //remove a converter from the context model, check resource model
- ormContextConverterHolder.removeCustomConverter(contextConverter2);
-
- assertEquals(0, ormContextConverterHolder.customConvertersSize());
- assertFalse(ormContextConverterHolder.customConverters().hasNext());
- assertEquals(0, resourceMappedSuperclass.getConverters().size());
- assertEquals(0, CollectionTools.size(persistenceUnit.allConverters()));
- }
-
- public void testUpdateTypeConverters() throws Exception {
- createTestMappedSuperclassForTypeConverters();
- EclipseLinkPersistenceUnit persistenceUnit = getPersistenceUnit();
- OrmPersistentType ormPersistentType = getEntityMappings().addPersistentType(MappingKeys.MAPPED_SUPERCLASS_TYPE_MAPPING_KEY, FULLY_QUALIFIED_TYPE_NAME);
- EclipseLinkOrmMappedSuperclass ormContextMappedSuperclass = (EclipseLinkOrmMappedSuperclass) ormPersistentType.getMapping();
- ConverterHolder ormContextConverterHolder = ormContextMappedSuperclass.getConverterHolder();
- XmlMappedSuperclass resourceMappedSuperclass = (XmlMappedSuperclass) getXmlEntityMappings().getMappedSuperclasses().get(0);
-
- assertEquals(0, ormContextConverterHolder.typeConvertersSize());
- assertEquals(0, resourceMappedSuperclass.getTypeConverters().size());
- assertEquals(0, CollectionTools.size(persistenceUnit.allConverters()));
-
- //add a converter to the resource model, check context model
- XmlTypeConverter resourceTypeConverter = EclipseLinkOrmFactory.eINSTANCE.createXmlTypeConverter();
- resourceMappedSuperclass.getTypeConverters().add(resourceTypeConverter);
- resourceTypeConverter.setDataType("Foo");
- resourceTypeConverter.setName("myTypeConverter");
-
- assertEquals(1, ormContextConverterHolder.typeConvertersSize());
- ListIterator<TypeConverter> ormContextTypeConverters = ormContextConverterHolder.typeConverters();
- TypeConverter ormContextTypeConverter = ormContextTypeConverters.next();
- assertEquals("Foo", ormContextTypeConverter.getDataType());
- assertEquals("myTypeConverter", ormContextTypeConverter.getName());
- assertEquals(1, resourceMappedSuperclass.getTypeConverters().size());
- assertEquals(1, CollectionTools.size(persistenceUnit.allConverters()));
-
- //add another converter to the resource model, check context model
- XmlTypeConverter resourceTypeConverter2 = EclipseLinkOrmFactory.eINSTANCE.createXmlTypeConverter();
- resourceMappedSuperclass.getTypeConverters().add(0, resourceTypeConverter2);
- resourceTypeConverter2.setDataType("Foo2");
- resourceTypeConverter2.setName("myTypeConverter2");
-
- assertEquals(2, ormContextConverterHolder.typeConvertersSize());
- ormContextTypeConverters = ormContextConverterHolder.typeConverters();
- ormContextTypeConverter = ormContextTypeConverters.next();
- assertEquals("Foo2", ormContextTypeConverter.getDataType());
- assertEquals("myTypeConverter2", ormContextTypeConverter.getName());
- ormContextTypeConverter = ormContextTypeConverters.next();
- assertEquals("Foo", ormContextTypeConverter.getDataType());
- assertEquals("myTypeConverter", ormContextTypeConverter.getName());
- assertEquals(2, resourceMappedSuperclass.getTypeConverters().size());
- assertEquals(2, CollectionTools.size(persistenceUnit.allConverters()));
-
- //move a converter in the resource model, check context model
- resourceMappedSuperclass.getTypeConverters().move(0, 1);
-
- assertEquals(2, ormContextConverterHolder.typeConvertersSize());
- ormContextTypeConverters = ormContextConverterHolder.typeConverters();
- ormContextTypeConverter = ormContextTypeConverters.next();
- assertEquals("Foo", ormContextTypeConverter.getDataType());
- assertEquals("myTypeConverter", ormContextTypeConverter.getName());
- ormContextTypeConverter = ormContextTypeConverters.next();
- assertEquals("Foo2", ormContextTypeConverter.getDataType());
- assertEquals("myTypeConverter2", ormContextTypeConverter.getName());
- assertEquals(2, resourceMappedSuperclass.getTypeConverters().size());
- assertEquals(2, CollectionTools.size(persistenceUnit.allConverters()));
-
- //remove a converter from the resource model, check context model
- resourceMappedSuperclass.getTypeConverters().remove(0);
-
- assertEquals(1, ormContextConverterHolder.typeConvertersSize());
- ormContextTypeConverters = ormContextConverterHolder.typeConverters();
- ormContextTypeConverter = ormContextTypeConverters.next();
- assertEquals("Foo2", ormContextTypeConverter.getDataType());
- assertEquals("myTypeConverter2", ormContextTypeConverter.getName());
- assertEquals(1, resourceMappedSuperclass.getTypeConverters().size());
- assertEquals(1, CollectionTools.size(persistenceUnit.allConverters()));
-
- //remove a converter from the resource model, check context model
- resourceMappedSuperclass.getTypeConverters().remove(resourceTypeConverter2);
-
- assertEquals(0, ormContextConverterHolder.typeConvertersSize());
- assertFalse(ormContextConverterHolder.typeConverters().hasNext());
- assertEquals(0, resourceMappedSuperclass.getTypeConverters().size());
- assertEquals(0, CollectionTools.size(persistenceUnit.allConverters()));
- }
-
- public void testModifyTypeConverters() throws Exception {
- createTestMappedSuperclassForTypeConverters();
- EclipseLinkPersistenceUnit persistenceUnit = getPersistenceUnit();
- OrmPersistentType ormPersistentType = getEntityMappings().addPersistentType(MappingKeys.MAPPED_SUPERCLASS_TYPE_MAPPING_KEY, FULLY_QUALIFIED_TYPE_NAME);
- EclipseLinkOrmMappedSuperclass ormContextMappedSuperclass = (EclipseLinkOrmMappedSuperclass) ormPersistentType.getMapping();
- ConverterHolder ormContextConverterHolder = ormContextMappedSuperclass.getConverterHolder();
- XmlMappedSuperclass resourceMappedSuperclass = (XmlMappedSuperclass) getXmlEntityMappings().getMappedSuperclasses().get(0);
-
- assertEquals(0, ormContextConverterHolder.typeConvertersSize());
- assertEquals(0, resourceMappedSuperclass.getTypeConverters().size());
- assertEquals(0, CollectionTools.size(persistenceUnit.allConverters()));
-
- //add a converter to the context model, check resource model
- TypeConverter contextTypeConverter = ormContextConverterHolder.addTypeConverter(0);
- contextTypeConverter.setDataType("Foo");
- contextTypeConverter.setName("myTypeConverter");
-
- assertEquals(1, resourceMappedSuperclass.getTypeConverters().size());
- assertEquals("Foo", resourceMappedSuperclass.getTypeConverters().get(0).getDataType());
- assertEquals("myTypeConverter", resourceMappedSuperclass.getTypeConverters().get(0).getName());
- assertEquals(1, ormContextConverterHolder.typeConvertersSize());
- ListIterator<TypeConverter> ormContextTypeConverters = ormContextConverterHolder.typeConverters();
- TypeConverter ormContextTypeConverter = ormContextTypeConverters.next();
- assertEquals("Foo", ormContextTypeConverter.getDataType());
- assertEquals("myTypeConverter", ormContextTypeConverter.getName());
- assertEquals(1, CollectionTools.size(persistenceUnit.allConverters()));
-
- //add another converter to the context model, check resource model
- TypeConverter contextTypeConverter2 = ormContextConverterHolder.addTypeConverter(0);
- contextTypeConverter2.setDataType("Foo2");
- contextTypeConverter2.setName("myTypeConverter2");
-
- assertEquals(2, resourceMappedSuperclass.getTypeConverters().size());
- assertEquals("Foo2", resourceMappedSuperclass.getTypeConverters().get(0).getDataType());
- assertEquals("myTypeConverter2", resourceMappedSuperclass.getTypeConverters().get(0).getName());
- assertEquals("Foo", resourceMappedSuperclass.getTypeConverters().get(1).getDataType());
- assertEquals("myTypeConverter", resourceMappedSuperclass.getTypeConverters().get(1).getName());
- assertEquals(2, ormContextConverterHolder.typeConvertersSize());
- ormContextTypeConverters = ormContextConverterHolder.typeConverters();
- ormContextTypeConverter = ormContextTypeConverters.next();
- assertEquals("Foo2", ormContextTypeConverter.getDataType());
- assertEquals("myTypeConverter2", ormContextTypeConverter.getName());
- ormContextTypeConverter = ormContextTypeConverters.next();
- assertEquals("Foo", ormContextTypeConverter.getDataType());
- assertEquals("myTypeConverter", ormContextTypeConverter.getName());
- assertEquals(2, CollectionTools.size(persistenceUnit.allConverters()));
-
- //move a converter in the context model, check resource model
- ormContextConverterHolder.moveTypeConverter(0, 1);
-
- assertEquals(2, resourceMappedSuperclass.getTypeConverters().size());
- assertEquals("Foo", resourceMappedSuperclass.getTypeConverters().get(0).getDataType());
- assertEquals("myTypeConverter", resourceMappedSuperclass.getTypeConverters().get(0).getName());
- assertEquals("Foo2", resourceMappedSuperclass.getTypeConverters().get(1).getDataType());
- assertEquals("myTypeConverter2", resourceMappedSuperclass.getTypeConverters().get(1).getName());
- assertEquals(2, ormContextConverterHolder.typeConvertersSize());
- ormContextTypeConverters = ormContextConverterHolder.typeConverters();
- ormContextTypeConverter = ormContextTypeConverters.next();
- assertEquals("Foo", ormContextTypeConverter.getDataType());
- assertEquals("myTypeConverter", ormContextTypeConverter.getName());
- ormContextTypeConverter = ormContextTypeConverters.next();
- assertEquals("Foo2", ormContextTypeConverter.getDataType());
- assertEquals("myTypeConverter2", ormContextTypeConverter.getName());
- assertEquals(2, CollectionTools.size(persistenceUnit.allConverters()));
-
- //remove a converter from the context model, check resource model
- ormContextConverterHolder.removeTypeConverter(0);
-
- assertEquals(1, resourceMappedSuperclass.getTypeConverters().size());
- assertEquals("Foo2", resourceMappedSuperclass.getTypeConverters().get(0).getDataType());
- assertEquals("myTypeConverter2", resourceMappedSuperclass.getTypeConverters().get(0).getName());
- assertEquals(1, ormContextConverterHolder.typeConvertersSize());
- ormContextTypeConverters = ormContextConverterHolder.typeConverters();
- ormContextTypeConverter = ormContextTypeConverters.next();
- assertEquals("Foo2", ormContextTypeConverter.getDataType());
- assertEquals("myTypeConverter2", ormContextTypeConverter.getName());
- assertEquals(1, CollectionTools.size(persistenceUnit.allConverters()));
-
- //remove a converter from the context model, check resource model
- ormContextConverterHolder.removeTypeConverter(contextTypeConverter2);
-
- assertEquals(0, ormContextConverterHolder.typeConvertersSize());
- assertFalse(ormContextConverterHolder.typeConverters().hasNext());
- assertEquals(0, resourceMappedSuperclass.getTypeConverters().size());
- assertEquals(0, CollectionTools.size(persistenceUnit.allConverters()));
- }
-
- public void testUpdateObjectTypeConverters() throws Exception {
- createTestMappedSuperclassForObjectTypeConverters();
- EclipseLinkPersistenceUnit persistenceUnit = getPersistenceUnit();
- OrmPersistentType ormPersistentType = getEntityMappings().addPersistentType(MappingKeys.MAPPED_SUPERCLASS_TYPE_MAPPING_KEY, FULLY_QUALIFIED_TYPE_NAME);
- EclipseLinkOrmMappedSuperclass ormContextMappedSuperclass = (EclipseLinkOrmMappedSuperclass) ormPersistentType.getMapping();
- ConverterHolder ormContextConverterHolder = ormContextMappedSuperclass.getConverterHolder();
- XmlMappedSuperclass resourceMappedSuperclass = (XmlMappedSuperclass) getXmlEntityMappings().getMappedSuperclasses().get(0);
-
- assertEquals(0, ormContextConverterHolder.objectTypeConvertersSize());
- assertEquals(0, resourceMappedSuperclass.getObjectTypeConverters().size());
- assertEquals(0, CollectionTools.size(persistenceUnit.allConverters()));
-
- //add a converter to the resource model, check context model
- XmlObjectTypeConverter resourceObjectTypeConverter = EclipseLinkOrmFactory.eINSTANCE.createXmlObjectTypeConverter();
- resourceMappedSuperclass.getObjectTypeConverters().add(resourceObjectTypeConverter);
- resourceObjectTypeConverter.setDataType("Foo");
- resourceObjectTypeConverter.setName("myObjectTypeConverter");
-
- assertEquals(1, ormContextConverterHolder.objectTypeConvertersSize());
- ListIterator<ObjectTypeConverter> ormContextObjectTypeConverters = ormContextConverterHolder.objectTypeConverters();
- ObjectTypeConverter ormContextObjectTypeConverter = ormContextObjectTypeConverters.next();
- assertEquals("Foo", ormContextObjectTypeConverter.getDataType());
- assertEquals("myObjectTypeConverter", ormContextObjectTypeConverter.getName());
- assertEquals(1, resourceMappedSuperclass.getObjectTypeConverters().size());
- assertEquals(1, CollectionTools.size(persistenceUnit.allConverters()));
-
- //add another converter to the resource model, check context model
- XmlObjectTypeConverter resourceObjectTypeConverter2 = EclipseLinkOrmFactory.eINSTANCE.createXmlObjectTypeConverter();
- resourceMappedSuperclass.getObjectTypeConverters().add(0, resourceObjectTypeConverter2);
- resourceObjectTypeConverter2.setDataType("Foo2");
- resourceObjectTypeConverter2.setName("myObjectTypeConverter2");
-
- assertEquals(2, ormContextConverterHolder.objectTypeConvertersSize());
- ormContextObjectTypeConverters = ormContextConverterHolder.objectTypeConverters();
- ormContextObjectTypeConverter = ormContextObjectTypeConverters.next();
- assertEquals("Foo2", ormContextObjectTypeConverter.getDataType());
- assertEquals("myObjectTypeConverter2", ormContextObjectTypeConverter.getName());
- ormContextObjectTypeConverter = ormContextObjectTypeConverters.next();
- assertEquals("Foo", ormContextObjectTypeConverter.getDataType());
- assertEquals("myObjectTypeConverter", ormContextObjectTypeConverter.getName());
- assertEquals(2, resourceMappedSuperclass.getObjectTypeConverters().size());
- assertEquals(2, CollectionTools.size(persistenceUnit.allConverters()));
-
- //move a converter in the resource model, check context model
- resourceMappedSuperclass.getObjectTypeConverters().move(0, 1);
-
- assertEquals(2, ormContextConverterHolder.objectTypeConvertersSize());
- ormContextObjectTypeConverters = ormContextConverterHolder.objectTypeConverters();
- ormContextObjectTypeConverter = ormContextObjectTypeConverters.next();
- assertEquals("Foo", ormContextObjectTypeConverter.getDataType());
- assertEquals("myObjectTypeConverter", ormContextObjectTypeConverter.getName());
- ormContextObjectTypeConverter = ormContextObjectTypeConverters.next();
- assertEquals("Foo2", ormContextObjectTypeConverter.getDataType());
- assertEquals("myObjectTypeConverter2", ormContextObjectTypeConverter.getName());
- assertEquals(2, resourceMappedSuperclass.getObjectTypeConverters().size());
- assertEquals(2, CollectionTools.size(persistenceUnit.allConverters()));
-
- //remove a converter from the resource model, check context model
- resourceMappedSuperclass.getObjectTypeConverters().remove(0);
-
- assertEquals(1, ormContextConverterHolder.objectTypeConvertersSize());
- ormContextObjectTypeConverters = ormContextConverterHolder.objectTypeConverters();
- ormContextObjectTypeConverter = ormContextObjectTypeConverters.next();
- assertEquals("Foo2", ormContextObjectTypeConverter.getDataType());
- assertEquals("myObjectTypeConverter2", ormContextObjectTypeConverter.getName());
- assertEquals(1, resourceMappedSuperclass.getObjectTypeConverters().size());
- assertEquals(1, CollectionTools.size(persistenceUnit.allConverters()));
-
- //remove a converter from the resource model, check context model
- resourceMappedSuperclass.getObjectTypeConverters().remove(resourceObjectTypeConverter2);
-
- assertEquals(0, ormContextConverterHolder.objectTypeConvertersSize());
- assertFalse(ormContextConverterHolder.objectTypeConverters().hasNext());
- assertEquals(0, resourceMappedSuperclass.getObjectTypeConverters().size());
- assertEquals(0, CollectionTools.size(persistenceUnit.allConverters()));
- }
-
- public void testModifyObjectTypeConverters() throws Exception {
- createTestMappedSuperclassForObjectTypeConverters();
- EclipseLinkPersistenceUnit persistenceUnit = getPersistenceUnit();
- OrmPersistentType ormPersistentType = getEntityMappings().addPersistentType(MappingKeys.MAPPED_SUPERCLASS_TYPE_MAPPING_KEY, FULLY_QUALIFIED_TYPE_NAME);
- EclipseLinkOrmMappedSuperclass ormContextMappedSuperclass = (EclipseLinkOrmMappedSuperclass) ormPersistentType.getMapping();
- ConverterHolder ormContextConverterHolder = ormContextMappedSuperclass.getConverterHolder();
- XmlMappedSuperclass resourceMappedSuperclass = (XmlMappedSuperclass) getXmlEntityMappings().getMappedSuperclasses().get(0);
-
- assertEquals(0, ormContextConverterHolder.objectTypeConvertersSize());
- assertEquals(0, resourceMappedSuperclass.getObjectTypeConverters().size());
- assertEquals(0, CollectionTools.size(persistenceUnit.allConverters()));
-
- //add a converter to the context model, check resource model
- ObjectTypeConverter contextObjectTypeConverter = ormContextConverterHolder.addObjectTypeConverter(0);
- contextObjectTypeConverter.setDataType("Foo");
- contextObjectTypeConverter.setName("myObjectTypeConverter");
-
- assertEquals(1, resourceMappedSuperclass.getObjectTypeConverters().size());
- assertEquals("Foo", resourceMappedSuperclass.getObjectTypeConverters().get(0).getDataType());
- assertEquals("myObjectTypeConverter", resourceMappedSuperclass.getObjectTypeConverters().get(0).getName());
- assertEquals(1, ormContextConverterHolder.objectTypeConvertersSize());
- ListIterator<ObjectTypeConverter> ormContextObjectTypeConverters = ormContextConverterHolder.objectTypeConverters();
- ObjectTypeConverter ormContextObjectTypeConverter = ormContextObjectTypeConverters.next();
- assertEquals("Foo", ormContextObjectTypeConverter.getDataType());
- assertEquals("myObjectTypeConverter", ormContextObjectTypeConverter.getName());
- assertEquals(1, CollectionTools.size(persistenceUnit.allConverters()));
-
- //add another converter to the context model, check resource model
- ObjectTypeConverter contextObjectTypeConverter2 = ormContextConverterHolder.addObjectTypeConverter(0);
- contextObjectTypeConverter2.setDataType("Foo2");
- contextObjectTypeConverter2.setName("myObjectTypeConverter2");
-
- assertEquals(2, resourceMappedSuperclass.getObjectTypeConverters().size());
- assertEquals("Foo2", resourceMappedSuperclass.getObjectTypeConverters().get(0).getDataType());
- assertEquals("myObjectTypeConverter2", resourceMappedSuperclass.getObjectTypeConverters().get(0).getName());
- assertEquals("Foo", resourceMappedSuperclass.getObjectTypeConverters().get(1).getDataType());
- assertEquals("myObjectTypeConverter", resourceMappedSuperclass.getObjectTypeConverters().get(1).getName());
- assertEquals(2, ormContextConverterHolder.objectTypeConvertersSize());
- ormContextObjectTypeConverters = ormContextConverterHolder.objectTypeConverters();
- ormContextObjectTypeConverter = ormContextObjectTypeConverters.next();
- assertEquals("Foo2", ormContextObjectTypeConverter.getDataType());
- assertEquals("myObjectTypeConverter2", ormContextObjectTypeConverter.getName());
- ormContextObjectTypeConverter = ormContextObjectTypeConverters.next();
- assertEquals("Foo", ormContextObjectTypeConverter.getDataType());
- assertEquals("myObjectTypeConverter", ormContextObjectTypeConverter.getName());
- assertEquals(2, CollectionTools.size(persistenceUnit.allConverters()));
-
- //move a converter in the context model, check resource model
- ormContextConverterHolder.moveObjectTypeConverter(0, 1);
-
- assertEquals(2, resourceMappedSuperclass.getObjectTypeConverters().size());
- assertEquals("Foo", resourceMappedSuperclass.getObjectTypeConverters().get(0).getDataType());
- assertEquals("myObjectTypeConverter", resourceMappedSuperclass.getObjectTypeConverters().get(0).getName());
- assertEquals("Foo2", resourceMappedSuperclass.getObjectTypeConverters().get(1).getDataType());
- assertEquals("myObjectTypeConverter2", resourceMappedSuperclass.getObjectTypeConverters().get(1).getName());
- assertEquals(2, ormContextConverterHolder.objectTypeConvertersSize());
- ormContextObjectTypeConverters = ormContextConverterHolder.objectTypeConverters();
- ormContextObjectTypeConverter = ormContextObjectTypeConverters.next();
- assertEquals("Foo", ormContextObjectTypeConverter.getDataType());
- assertEquals("myObjectTypeConverter", ormContextObjectTypeConverter.getName());
- ormContextObjectTypeConverter = ormContextObjectTypeConverters.next();
- assertEquals("Foo2", ormContextObjectTypeConverter.getDataType());
- assertEquals("myObjectTypeConverter2", ormContextObjectTypeConverter.getName());
- assertEquals(2, CollectionTools.size(persistenceUnit.allConverters()));
-
- //remove a converter from the context model, check resource model
- ormContextConverterHolder.removeObjectTypeConverter(0);
-
- assertEquals(1, resourceMappedSuperclass.getObjectTypeConverters().size());
- assertEquals("Foo2", resourceMappedSuperclass.getObjectTypeConverters().get(0).getDataType());
- assertEquals("myObjectTypeConverter2", resourceMappedSuperclass.getObjectTypeConverters().get(0).getName());
- assertEquals(1, ormContextConverterHolder.objectTypeConvertersSize());
- ormContextObjectTypeConverters = ormContextConverterHolder.objectTypeConverters();
- ormContextObjectTypeConverter = ormContextObjectTypeConverters.next();
- assertEquals("Foo2", ormContextObjectTypeConverter.getDataType());
- assertEquals("myObjectTypeConverter2", ormContextObjectTypeConverter.getName());
- assertEquals(1, CollectionTools.size(persistenceUnit.allConverters()));
-
- //remove a converter from the context model, check resource model
- ormContextConverterHolder.removeObjectTypeConverter(contextObjectTypeConverter2);
-
- assertEquals(0, ormContextConverterHolder.objectTypeConvertersSize());
- assertFalse(ormContextConverterHolder.objectTypeConverters().hasNext());
- assertEquals(0, resourceMappedSuperclass.getObjectTypeConverters().size());
- assertEquals(0, CollectionTools.size(persistenceUnit.allConverters()));
- }
-
- public void testUpdateStructConverters() throws Exception {
- createTestMappedSuperclassForStructConverters();
- EclipseLinkPersistenceUnit persistenceUnit = getPersistenceUnit();
- OrmPersistentType ormPersistentType = getEntityMappings().addPersistentType(MappingKeys.MAPPED_SUPERCLASS_TYPE_MAPPING_KEY, FULLY_QUALIFIED_TYPE_NAME);
- EclipseLinkOrmMappedSuperclass ormContextMappedSuperclass = (EclipseLinkOrmMappedSuperclass) ormPersistentType.getMapping();
- ConverterHolder ormContextConverterHolder = ormContextMappedSuperclass.getConverterHolder();
- XmlMappedSuperclass resourceMappedSuperclass = (XmlMappedSuperclass) getXmlEntityMappings().getMappedSuperclasses().get(0);
-
- assertEquals(0, ormContextConverterHolder.structConvertersSize());
- assertEquals(0, resourceMappedSuperclass.getStructConverters().size());
- assertEquals(0, CollectionTools.size(persistenceUnit.allConverters()));
-
- //add a converter to the resource model, check context model
- XmlStructConverter resourceStructConverter = EclipseLinkOrmFactory.eINSTANCE.createXmlStructConverter();
- resourceMappedSuperclass.getStructConverters().add(resourceStructConverter);
- resourceStructConverter.setConverter("Foo");
- resourceStructConverter.setName("myStructConverter");
-
- assertEquals(1, ormContextConverterHolder.structConvertersSize());
- ListIterator<StructConverter> ormContextStructConverters = ormContextConverterHolder.structConverters();
- StructConverter ormContextStructConverter = ormContextStructConverters.next();
- assertEquals("Foo", ormContextStructConverter.getConverterClass());
- assertEquals("myStructConverter", ormContextStructConverter.getName());
- assertEquals(1, resourceMappedSuperclass.getStructConverters().size());
- assertEquals(1, CollectionTools.size(persistenceUnit.allConverters()));
-
- //add another converter to the resource model, check context model
- XmlStructConverter resourceStructConverter2 = EclipseLinkOrmFactory.eINSTANCE.createXmlStructConverter();
- resourceMappedSuperclass.getStructConverters().add(0, resourceStructConverter2);
- resourceStructConverter2.setConverter("Foo2");
- resourceStructConverter2.setName("myStructConverter2");
-
- assertEquals(2, ormContextConverterHolder.structConvertersSize());
- ormContextStructConverters = ormContextConverterHolder.structConverters();
- ormContextStructConverter = ormContextStructConverters.next();
- assertEquals("Foo2", ormContextStructConverter.getConverterClass());
- assertEquals("myStructConverter2", ormContextStructConverter.getName());
- ormContextStructConverter = ormContextStructConverters.next();
- assertEquals("Foo", ormContextStructConverter.getConverterClass());
- assertEquals("myStructConverter", ormContextStructConverter.getName());
- assertEquals(2, resourceMappedSuperclass.getStructConverters().size());
- assertEquals(2, CollectionTools.size(persistenceUnit.allConverters()));
-
- //move a converter in the resource model, check context model
- resourceMappedSuperclass.getStructConverters().move(0, 1);
-
- assertEquals(2, ormContextConverterHolder.structConvertersSize());
- ormContextStructConverters = ormContextConverterHolder.structConverters();
- ormContextStructConverter = ormContextStructConverters.next();
- assertEquals("Foo", ormContextStructConverter.getConverterClass());
- assertEquals("myStructConverter", ormContextStructConverter.getName());
- ormContextStructConverter = ormContextStructConverters.next();
- assertEquals("Foo2", ormContextStructConverter.getConverterClass());
- assertEquals("myStructConverter2", ormContextStructConverter.getName());
- assertEquals(2, resourceMappedSuperclass.getStructConverters().size());
- assertEquals(2, CollectionTools.size(persistenceUnit.allConverters()));
-
- //remove a converter from the resource model, check context model
- resourceMappedSuperclass.getStructConverters().remove(0);
-
- assertEquals(1, ormContextConverterHolder.structConvertersSize());
- ormContextStructConverters = ormContextConverterHolder.structConverters();
- ormContextStructConverter = ormContextStructConverters.next();
- assertEquals("Foo2", ormContextStructConverter.getConverterClass());
- assertEquals("myStructConverter2", ormContextStructConverter.getName());
- assertEquals(1, resourceMappedSuperclass.getStructConverters().size());
- assertEquals(1, CollectionTools.size(persistenceUnit.allConverters()));
-
- //remove a converter from the resource model, check context model
- resourceMappedSuperclass.getStructConverters().remove(resourceStructConverter2);
-
- assertEquals(0, ormContextConverterHolder.structConvertersSize());
- assertFalse(ormContextConverterHolder.structConverters().hasNext());
- assertEquals(0, resourceMappedSuperclass.getStructConverters().size());
- assertEquals(0, CollectionTools.size(persistenceUnit.allConverters()));
- }
-
- public void testModifyStructConverters() throws Exception {
- createTestMappedSuperclassForStructConverters();
- EclipseLinkPersistenceUnit persistenceUnit = getPersistenceUnit();
- OrmPersistentType ormPersistentType = getEntityMappings().addPersistentType(MappingKeys.MAPPED_SUPERCLASS_TYPE_MAPPING_KEY, FULLY_QUALIFIED_TYPE_NAME);
- EclipseLinkOrmMappedSuperclass ormContextMappedSuperclass = (EclipseLinkOrmMappedSuperclass) ormPersistentType.getMapping();
- ConverterHolder ormContextConverterHolder = ormContextMappedSuperclass.getConverterHolder();
- XmlMappedSuperclass resourceMappedSuperclass = (XmlMappedSuperclass) getXmlEntityMappings().getMappedSuperclasses().get(0);
-
- assertEquals(0, ormContextConverterHolder.structConvertersSize());
- assertEquals(0, resourceMappedSuperclass.getStructConverters().size());
- assertEquals(0, CollectionTools.size(persistenceUnit.allConverters()));
-
- //add a converter to the context model, check resource model
- StructConverter contextStructConverter = ormContextConverterHolder.addStructConverter(0);
- contextStructConverter.setConverterClass("Foo");
- contextStructConverter.setName("myStructConverter");
-
- assertEquals(1, resourceMappedSuperclass.getStructConverters().size());
- assertEquals("Foo", resourceMappedSuperclass.getStructConverters().get(0).getConverter());
- assertEquals("myStructConverter", resourceMappedSuperclass.getStructConverters().get(0).getName());
- assertEquals(1, ormContextConverterHolder.structConvertersSize());
- ListIterator<StructConverter> ormContextStructConverters = ormContextConverterHolder.structConverters();
- StructConverter ormContextStructConverter = ormContextStructConverters.next();
- assertEquals("Foo", ormContextStructConverter.getConverterClass());
- assertEquals("myStructConverter", ormContextStructConverter.getName());
- assertEquals(1, CollectionTools.size(persistenceUnit.allConverters()));
-
- //add another converter to the context model, check resource model
- StructConverter contextStructConverter2 = ormContextConverterHolder.addStructConverter(0);
- contextStructConverter2.setConverterClass("Foo2");
- contextStructConverter2.setName("myStructConverter2");
-
- assertEquals(2, resourceMappedSuperclass.getStructConverters().size());
- assertEquals("Foo2", resourceMappedSuperclass.getStructConverters().get(0).getConverter());
- assertEquals("myStructConverter2", resourceMappedSuperclass.getStructConverters().get(0).getName());
- assertEquals("Foo", resourceMappedSuperclass.getStructConverters().get(1).getConverter());
- assertEquals("myStructConverter", resourceMappedSuperclass.getStructConverters().get(1).getName());
- assertEquals(2, ormContextConverterHolder.structConvertersSize());
- ormContextStructConverters = ormContextConverterHolder.structConverters();
- ormContextStructConverter = ormContextStructConverters.next();
- assertEquals("Foo2", ormContextStructConverter.getConverterClass());
- assertEquals("myStructConverter2", ormContextStructConverter.getName());
- ormContextStructConverter = ormContextStructConverters.next();
- assertEquals("Foo", ormContextStructConverter.getConverterClass());
- assertEquals("myStructConverter", ormContextStructConverter.getName());
- assertEquals(2, CollectionTools.size(persistenceUnit.allConverters()));
-
- //move a converter in the context model, check resource model
- ormContextConverterHolder.moveStructConverter(0, 1);
-
- assertEquals(2, resourceMappedSuperclass.getStructConverters().size());
- assertEquals("Foo", resourceMappedSuperclass.getStructConverters().get(0).getConverter());
- assertEquals("myStructConverter", resourceMappedSuperclass.getStructConverters().get(0).getName());
- assertEquals("Foo2", resourceMappedSuperclass.getStructConverters().get(1).getConverter());
- assertEquals("myStructConverter2", resourceMappedSuperclass.getStructConverters().get(1).getName());
- assertEquals(2, ormContextConverterHolder.structConvertersSize());
- ormContextStructConverters = ormContextConverterHolder.structConverters();
- ormContextStructConverter = ormContextStructConverters.next();
- assertEquals("Foo", ormContextStructConverter.getConverterClass());
- assertEquals("myStructConverter", ormContextStructConverter.getName());
- ormContextStructConverter = ormContextStructConverters.next();
- assertEquals("Foo2", ormContextStructConverter.getConverterClass());
- assertEquals("myStructConverter2", ormContextStructConverter.getName());
- assertEquals(2, CollectionTools.size(persistenceUnit.allConverters()));
-
- //remove a converter from the context model, check resource model
- ormContextConverterHolder.removeStructConverter(0);
-
- assertEquals(1, resourceMappedSuperclass.getStructConverters().size());
- assertEquals("Foo2", resourceMappedSuperclass.getStructConverters().get(0).getConverter());
- assertEquals("myStructConverter2", resourceMappedSuperclass.getStructConverters().get(0).getName());
- assertEquals(1, ormContextConverterHolder.structConvertersSize());
- ormContextStructConverters = ormContextConverterHolder.structConverters();
- ormContextStructConverter = ormContextStructConverters.next();
- assertEquals("Foo2", ormContextStructConverter.getConverterClass());
- assertEquals("myStructConverter2", ormContextStructConverter.getName());
- assertEquals(1, CollectionTools.size(persistenceUnit.allConverters()));
-
- //remove a converter from the context model, check resource model
- ormContextConverterHolder.removeStructConverter(contextStructConverter2);
-
- assertEquals(0, ormContextConverterHolder.structConvertersSize());
- assertFalse(ormContextConverterHolder.structConverters().hasNext());
- assertEquals(0, resourceMappedSuperclass.getStructConverters().size());
- assertEquals(0, CollectionTools.size(persistenceUnit.allConverters()));
- }
-}
diff --git a/jpa/tests/org.eclipse.jpt.eclipselink.core.tests/src/org/eclipse/jpt/eclipselink/core/tests/internal/context/orm/EclipseLinkOrmObjectTypeConverterTests.java b/jpa/tests/org.eclipse.jpt.eclipselink.core.tests/src/org/eclipse/jpt/eclipselink/core/tests/internal/context/orm/EclipseLinkOrmObjectTypeConverterTests.java
deleted file mode 100644
index 3553c13685..0000000000
--- a/jpa/tests/org.eclipse.jpt.eclipselink.core.tests/src/org/eclipse/jpt/eclipselink/core/tests/internal/context/orm/EclipseLinkOrmObjectTypeConverterTests.java
+++ /dev/null
@@ -1,572 +0,0 @@
-/*******************************************************************************
- * Copyright (c) 2008, 2009 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.
- *
- * Contributors:
- * Oracle - initial API and implementation
- *******************************************************************************/
-package org.eclipse.jpt.eclipselink.core.tests.internal.context.orm;
-
-import java.util.Iterator;
-import java.util.ListIterator;
-import org.eclipse.jdt.core.ICompilationUnit;
-import org.eclipse.jpt.core.MappingKeys;
-import org.eclipse.jpt.core.context.java.JavaBasicMapping;
-import org.eclipse.jpt.core.context.orm.OrmBasicMapping;
-import org.eclipse.jpt.core.context.orm.OrmPersistentAttribute;
-import org.eclipse.jpt.core.context.orm.OrmPersistentType;
-import org.eclipse.jpt.core.resource.java.JPA;
-import org.eclipse.jpt.eclipselink.core.context.ConversionValue;
-import org.eclipse.jpt.eclipselink.core.context.Convert;
-import org.eclipse.jpt.eclipselink.core.context.EclipseLinkConverter;
-import org.eclipse.jpt.eclipselink.core.context.ObjectTypeConverter;
-import org.eclipse.jpt.eclipselink.core.internal.context.java.EclipseLinkJavaConvert;
-import org.eclipse.jpt.eclipselink.core.internal.context.orm.EclipseLinkOrmObjectTypeConverter;
-import org.eclipse.jpt.eclipselink.core.resource.java.EclipseLinkJPA;
-import org.eclipse.jpt.eclipselink.core.resource.orm.EclipseLinkOrmFactory;
-import org.eclipse.jpt.eclipselink.core.resource.orm.XmlBasic;
-import org.eclipse.jpt.eclipselink.core.resource.orm.XmlConversionValue;
-import org.eclipse.jpt.eclipselink.core.resource.orm.XmlObjectTypeConverter;
-import org.eclipse.jpt.utility.internal.iterators.ArrayIterator;
-
-@SuppressWarnings("nls")
-public class EclipseLinkOrmObjectTypeConverterTests
- extends EclipseLinkOrmContextModelTestCase
-{
-
- private ICompilationUnit createTestEntityWithBasicMapping() throws Exception {
- return this.createTestType(new DefaultAnnotationWriter() {
- @Override
- public Iterator<String> imports() {
- return new ArrayIterator<String>(JPA.ENTITY, JPA.BASIC, EclipseLinkJPA.CONVERT, EclipseLinkJPA.OBJECT_TYPE_CONVERTER);
- }
- @Override
- public void appendTypeAnnotationTo(StringBuilder sb) {
- sb.append("@Entity").append(CR);
- }
-
- @Override
- public void appendIdFieldAnnotationTo(StringBuilder sb) {
- sb.append("@Basic").append(CR);
- sb.append(" @Convert(name=\"foo\")").append(CR);
- sb.append(" @ObjectTypeConverter");
- }
- });
- }
-
-
- private ICompilationUnit createTestEntityWithConvertAndObjectTypeConverterConversionValue() throws Exception {
- return this.createTestType(new DefaultAnnotationWriter() {
- @Override
- public Iterator<String> imports() {
- return new ArrayIterator<String>(JPA.ENTITY, EclipseLinkJPA.CONVERT, EclipseLinkJPA.OBJECT_TYPE_CONVERTER, EclipseLinkJPA.CONVERSION_VALUE);
- }
- @Override
- public void appendTypeAnnotationTo(StringBuilder sb) {
- sb.append("@Entity");
- }
-
- @Override
- public void appendIdFieldAnnotationTo(StringBuilder sb) {
- sb.append("@Convert(\"foo\")").append(CR);
- sb.append(" @ObjectTypeConverter(name=\"foo\", defaultObjectValue=\"bar\", conversionValues = @ConversionValue(dataValue=\"f\", objectValue=\"female\"))");
- }
- });
- }
-
- public EclipseLinkOrmObjectTypeConverterTests(String name) {
- super(name);
- }
-
-
- public void testUpdateDataType() throws Exception {
- createTestEntityWithBasicMapping();
-
- OrmPersistentType ormPersistentType = getEntityMappings().addPersistentType(MappingKeys.ENTITY_TYPE_MAPPING_KEY, FULLY_QUALIFIED_TYPE_NAME);
- OrmPersistentAttribute ormPersistentAttribute = ormPersistentType.addSpecifiedPersistentAttribute(MappingKeys.BASIC_ATTRIBUTE_MAPPING_KEY, "id");
- OrmBasicMapping ormBasicMapping = (OrmBasicMapping) ormPersistentAttribute.getMapping();
- ormBasicMapping.setSpecifiedConverter(Convert.ECLIPSE_LINK_CONVERTER);
- ((Convert) ormBasicMapping.getConverter()).setConverter(EclipseLinkConverter.OBJECT_TYPE_CONVERTER);
- ObjectTypeConverter ormConverter = (ObjectTypeConverter) ((Convert) ormBasicMapping.getConverter()).getConverter();
- XmlObjectTypeConverter converterResource = ((XmlBasic) getXmlEntityMappings().getEntities().get(0).getAttributes().getBasics().get(0)).getObjectTypeConverter();
- JavaBasicMapping javaBasicMapping = (JavaBasicMapping) ormPersistentType.getJavaPersistentType().getAttributeNamed("id").getMapping();
-
- assertEquals(null, ormConverter.getDataType());
- assertEquals(null, converterResource.getDataType());
-
- //set converter class name in the resource model, verify context model updated
- converterResource.setDataType("myConvert");
- assertEquals("myConvert", ormConverter.getDataType());
- assertEquals("myConvert", converterResource.getDataType());
-
- //set converter class name to null in the resource model
- converterResource.setDataType(null);
- assertEquals(null, ormConverter.getDataType());
- assertEquals(null, converterResource.getDataType());
-
-
- //remove the specified persistent attribute, test virtual mapping
- ormPersistentType.removeSpecifiedPersistentAttribute(ormPersistentAttribute);
-
- ormPersistentAttribute = ormPersistentType.virtualAttributes().next();
- ormBasicMapping = (OrmBasicMapping) ormPersistentAttribute.getMapping();
- ormConverter = (ObjectTypeConverter) ((Convert) ormBasicMapping.getSpecifiedConverter()).getConverter();
-
- ObjectTypeConverter javaConverter = ((ObjectTypeConverter) ((Convert) javaBasicMapping.getSpecifiedConverter()).getConverter());
- javaConverter.setDataType("bar");
- assertEquals("bar", ormConverter.getDataType());
- assertEquals("bar", javaConverter.getDataType());
-
- //set metadata-complete, test virtual mapping
- ormPersistentType.getMapping().setSpecifiedMetadataComplete(Boolean.TRUE);
- ormPersistentAttribute = ormPersistentType.virtualAttributes().next();
- ormBasicMapping = (OrmBasicMapping) ormPersistentAttribute.getMapping();
- assertEquals(null, ormBasicMapping.getSpecifiedConverter());
- assertEquals(org.eclipse.jpt.core.context.Converter.NO_CONVERTER, ormBasicMapping.getConverter().getType());
- assertEquals("bar", javaConverter.getDataType());
- }
-
- public void testModifyDataType() throws Exception {
- OrmPersistentType ormPersistentType = getEntityMappings().addPersistentType(MappingKeys.ENTITY_TYPE_MAPPING_KEY, "model.Foo");
- OrmPersistentAttribute ormPersistentAttribute = ormPersistentType.addSpecifiedPersistentAttribute(MappingKeys.BASIC_ATTRIBUTE_MAPPING_KEY, "basicMapping");
- OrmBasicMapping ormBasicMapping = ((OrmBasicMapping) ormPersistentAttribute.getMapping());
- ormBasicMapping.setSpecifiedConverter(Convert.ECLIPSE_LINK_CONVERTER);
- ((Convert) ormBasicMapping.getConverter()).setConverter(EclipseLinkConverter.OBJECT_TYPE_CONVERTER);
- ObjectTypeConverter ormConverter = (ObjectTypeConverter) ((Convert) ormBasicMapping.getConverter()).getConverter();
- XmlObjectTypeConverter converterResource = ((XmlBasic) getXmlEntityMappings().getEntities().get(0).getAttributes().getBasics().get(0)).getObjectTypeConverter();
-
- assertEquals(null, ormConverter.getDataType());
- assertEquals(null, converterResource.getDataType());
-
- //set converter class in the context model, verify resource model updated
- ormConverter.setDataType("foo");
- assertEquals("foo", ormConverter.getDataType());
- assertEquals("foo", converterResource.getDataType());
-
- ormConverter.setDataType(null);
- assertEquals(null, ormConverter.getDataType());
- assertEquals(null, converterResource.getDataType());
- }
-
- public void testUpdateObjectType() throws Exception {
- createTestEntityWithBasicMapping();
-
- OrmPersistentType ormPersistentType = getEntityMappings().addPersistentType(MappingKeys.ENTITY_TYPE_MAPPING_KEY, FULLY_QUALIFIED_TYPE_NAME);
- OrmPersistentAttribute ormPersistentAttribute = ormPersistentType.addSpecifiedPersistentAttribute(MappingKeys.BASIC_ATTRIBUTE_MAPPING_KEY, "id");
- OrmBasicMapping ormBasicMapping = (OrmBasicMapping) ormPersistentAttribute.getMapping();
- ormBasicMapping.setSpecifiedConverter(Convert.ECLIPSE_LINK_CONVERTER);
- ((Convert) ormBasicMapping.getConverter()).setConverter(EclipseLinkConverter.OBJECT_TYPE_CONVERTER);
- ObjectTypeConverter ormConverter = (ObjectTypeConverter) ((Convert) ormBasicMapping.getConverter()).getConverter();
- XmlObjectTypeConverter converterResource = ((XmlBasic) getXmlEntityMappings().getEntities().get(0).getAttributes().getBasics().get(0)).getObjectTypeConverter();
- JavaBasicMapping javaBasicMapping = (JavaBasicMapping) ormPersistentType.getJavaPersistentType().getAttributeNamed("id").getMapping();
-
- assertEquals(null, ormConverter.getObjectType());
- assertEquals(null, converterResource.getObjectType());
-
- //set converter class name in the resource model, verify context model updated
- converterResource.setObjectType("myConvert");
- assertEquals("myConvert", ormConverter.getObjectType());
- assertEquals("myConvert", converterResource.getObjectType());
-
- //set converter class name to null in the resource model
- converterResource.setObjectType(null);
- assertEquals(null, ormConverter.getObjectType());
- assertEquals(null, converterResource.getObjectType());
-
-
- //remove the specified persistent attribute, test virtual mapping
- ormPersistentType.removeSpecifiedPersistentAttribute(ormPersistentAttribute);
-
- ormPersistentAttribute = ormPersistentType.virtualAttributes().next();
- ormBasicMapping = (OrmBasicMapping) ormPersistentAttribute.getMapping();
- ormConverter = (ObjectTypeConverter) ((Convert) ormBasicMapping.getSpecifiedConverter()).getConverter();
-
- ObjectTypeConverter javaConverter = ((ObjectTypeConverter) ((Convert) javaBasicMapping.getSpecifiedConverter()).getConverter());
- javaConverter.setObjectType("bar");
- assertEquals("bar", ormConverter.getObjectType());
- assertEquals("bar", javaConverter.getObjectType());
-
- //set metadata-complete, test virtual mapping
- ormPersistentType.getMapping().setSpecifiedMetadataComplete(Boolean.TRUE);
- ormPersistentAttribute = ormPersistentType.virtualAttributes().next();
- ormBasicMapping = (OrmBasicMapping) ormPersistentAttribute.getMapping();
- assertEquals(null, ormBasicMapping.getSpecifiedConverter());
- assertEquals(org.eclipse.jpt.core.context.Converter.NO_CONVERTER, ormBasicMapping.getConverter().getType());
- assertEquals("bar", javaConverter.getObjectType());
- }
-
- public void testModifyObjectType() throws Exception {
- OrmPersistentType ormPersistentType = getEntityMappings().addPersistentType(MappingKeys.ENTITY_TYPE_MAPPING_KEY, "model.Foo");
- OrmPersistentAttribute ormPersistentAttribute = ormPersistentType.addSpecifiedPersistentAttribute(MappingKeys.BASIC_ATTRIBUTE_MAPPING_KEY, "basicMapping");
- OrmBasicMapping ormBasicMapping = ((OrmBasicMapping) ormPersistentAttribute.getMapping());
- ormBasicMapping.setSpecifiedConverter(Convert.ECLIPSE_LINK_CONVERTER);
- ((Convert) ormBasicMapping.getConverter()).setConverter(EclipseLinkConverter.OBJECT_TYPE_CONVERTER);
- ObjectTypeConverter ormConverter = (ObjectTypeConverter) ((Convert) ormBasicMapping.getConverter()).getConverter();
- XmlObjectTypeConverter converterResource = ((XmlBasic) getXmlEntityMappings().getEntities().get(0).getAttributes().getBasics().get(0)).getObjectTypeConverter();
-
- assertEquals(null, ormConverter.getObjectType());
- assertEquals(null, converterResource.getObjectType());
-
- //set converter class in the context model, verify resource model updated
- ormConverter.setObjectType("foo");
- assertEquals("foo", ormConverter.getObjectType());
- assertEquals("foo", converterResource.getObjectType());
-
- ormConverter.setObjectType(null);
- assertEquals(null, ormConverter.getObjectType());
- assertEquals(null, converterResource.getObjectType());
- }
-
- public void testUpdateName() throws Exception {
- createTestEntityWithBasicMapping();
-
- OrmPersistentType ormPersistentType = getEntityMappings().addPersistentType(MappingKeys.ENTITY_TYPE_MAPPING_KEY, FULLY_QUALIFIED_TYPE_NAME);
- OrmPersistentAttribute ormPersistentAttribute = ormPersistentType.addSpecifiedPersistentAttribute(MappingKeys.BASIC_ATTRIBUTE_MAPPING_KEY, "id");
- OrmBasicMapping ormBasicMapping = ((OrmBasicMapping) ormPersistentAttribute.getMapping());
- ormBasicMapping.setSpecifiedConverter(Convert.ECLIPSE_LINK_CONVERTER);
- ((Convert) ormBasicMapping.getConverter()).setConverter(EclipseLinkConverter.OBJECT_TYPE_CONVERTER);
- EclipseLinkOrmObjectTypeConverter ormConverter = (EclipseLinkOrmObjectTypeConverter) ((Convert) ormBasicMapping.getConverter()).getConverter();
- XmlObjectTypeConverter converterResource = ((XmlBasic) getXmlEntityMappings().getEntities().get(0).getAttributes().getBasics().get(0)).getObjectTypeConverter();
- JavaBasicMapping javaBasicMapping = (JavaBasicMapping) ormPersistentType.getJavaPersistentType().getAttributeNamed("id").getMapping();
-
- assertEquals(null, ormConverter.getName());
- assertEquals(null, converterResource.getName());
-
- //set converter class name in the resource model, verify context model updated
- converterResource.setName("myConvert");
- assertEquals("myConvert", ormConverter.getName());
- assertEquals("myConvert", converterResource.getName());
-
- //set converter class name to null in the resource model
- converterResource.setName(null);
- assertEquals(null, ormConverter.getName());
- assertEquals(null, converterResource.getName());
-
-
- //remove the specified persistent attribute, test virtual mapping
-
- ormPersistentType.removeSpecifiedPersistentAttribute(ormPersistentAttribute);
-
- ormPersistentAttribute = ormPersistentType.virtualAttributes().next();
- ormBasicMapping = (OrmBasicMapping) ormPersistentAttribute.getMapping();
- ormConverter = (EclipseLinkOrmObjectTypeConverter) ((Convert) ormBasicMapping.getSpecifiedConverter()).getConverter();
-
- ObjectTypeConverter javaConverter = ((ObjectTypeConverter) ((Convert) javaBasicMapping.getSpecifiedConverter()).getConverter());
- javaConverter.setName("bar");
- assertEquals("bar", ormConverter.getName());
- assertEquals("bar", javaConverter.getName());
-
-
- //set metadata-complete, test virtual mapping
-
- ormPersistentType.getMapping().setSpecifiedMetadataComplete(Boolean.TRUE);
- ormPersistentAttribute = ormPersistentType.virtualAttributes().next();
- ormBasicMapping = (OrmBasicMapping) ormPersistentAttribute.getMapping();
- assertEquals(null, ormBasicMapping.getSpecifiedConverter());
- assertEquals(org.eclipse.jpt.core.context.Converter.NO_CONVERTER, ormBasicMapping.getConverter().getType());
- assertEquals("bar", javaConverter.getName());
- }
-
- public void testModifyName() throws Exception {
- OrmPersistentType ormPersistentType = getEntityMappings().addPersistentType(MappingKeys.ENTITY_TYPE_MAPPING_KEY, "model.Foo");
- OrmPersistentAttribute ormPersistentAttribute = ormPersistentType.addSpecifiedPersistentAttribute(MappingKeys.BASIC_ATTRIBUTE_MAPPING_KEY, "basicMapping");
- OrmBasicMapping ormBasicMapping = ((OrmBasicMapping) ormPersistentAttribute.getMapping());
- ormBasicMapping.setSpecifiedConverter(Convert.ECLIPSE_LINK_CONVERTER);
- ((Convert) ormBasicMapping.getConverter()).setConverter(EclipseLinkConverter.OBJECT_TYPE_CONVERTER);
- EclipseLinkOrmObjectTypeConverter ormConverter = (EclipseLinkOrmObjectTypeConverter) ((Convert) ormBasicMapping.getConverter()).getConverter();
- XmlObjectTypeConverter converterResource = ((XmlBasic) getXmlEntityMappings().getEntities().get(0).getAttributes().getBasics().get(0)).getObjectTypeConverter();
-
- assertEquals(null, ormConverter.getName());
- assertEquals(null, converterResource.getName());
-
- //set converter class in the context model, verify resource model updated
- ormConverter.setName("foo");
- assertEquals("foo", ormConverter.getName());
- assertEquals("foo", converterResource.getName());
-
- ormConverter.setName(null);
- assertEquals(null, ormConverter.getName());
- assertEquals(null, converterResource.getName());
- }
-
- public void testUpdateDefaultObjectValue() throws Exception {
- createTestEntityWithBasicMapping();
-
- OrmPersistentType ormPersistentType = getEntityMappings().addPersistentType(MappingKeys.ENTITY_TYPE_MAPPING_KEY, FULLY_QUALIFIED_TYPE_NAME);
- OrmPersistentAttribute ormPersistentAttribute = ormPersistentType.addSpecifiedPersistentAttribute(MappingKeys.BASIC_ATTRIBUTE_MAPPING_KEY, "id");
- OrmBasicMapping ormBasicMapping = (OrmBasicMapping) ormPersistentAttribute.getMapping();
- ormBasicMapping.setSpecifiedConverter(Convert.ECLIPSE_LINK_CONVERTER);
- ((Convert) ormBasicMapping.getConverter()).setConverter(EclipseLinkConverter.OBJECT_TYPE_CONVERTER);
- ObjectTypeConverter ormConverter = (ObjectTypeConverter) ((Convert) ormBasicMapping.getConverter()).getConverter();
- XmlObjectTypeConverter converterResource = ((XmlBasic) getXmlEntityMappings().getEntities().get(0).getAttributes().getBasics().get(0)).getObjectTypeConverter();
- JavaBasicMapping javaBasicMapping = (JavaBasicMapping) ormPersistentType.getJavaPersistentType().getAttributeNamed("id").getMapping();
-
- assertEquals(null, ormConverter.getDefaultObjectValue());
- assertEquals(null, converterResource.getDefaultObjectValue());
-
- //set converter class name in the resource model, verify context model updated
- converterResource.setDefaultObjectValue("myConvert");
- assertEquals("myConvert", ormConverter.getDefaultObjectValue());
- assertEquals("myConvert", converterResource.getDefaultObjectValue());
-
- //set converter class name to null in the resource model
- converterResource.setDefaultObjectValue(null);
- assertEquals(null, ormConverter.getDefaultObjectValue());
- assertEquals(null, converterResource.getDefaultObjectValue());
-
-
- //remove the specified persistent attribute, test virtual mapping
- ormPersistentType.removeSpecifiedPersistentAttribute(ormPersistentAttribute);
-
- ormPersistentAttribute = ormPersistentType.virtualAttributes().next();
- ormBasicMapping = (OrmBasicMapping) ormPersistentAttribute.getMapping();
- ormConverter = (ObjectTypeConverter) ((Convert) ormBasicMapping.getSpecifiedConverter()).getConverter();
-
- ObjectTypeConverter javaConverter = ((ObjectTypeConverter) ((Convert) javaBasicMapping.getSpecifiedConverter()).getConverter());
- javaConverter.setDefaultObjectValue("bar");
- assertEquals("bar", ormConverter.getDefaultObjectValue());
- assertEquals("bar", javaConverter.getDefaultObjectValue());
-
- //set metadata-complete, test virtual mapping
- ormPersistentType.getMapping().setSpecifiedMetadataComplete(Boolean.TRUE);
- ormPersistentAttribute = ormPersistentType.virtualAttributes().next();
- ormBasicMapping = (OrmBasicMapping) ormPersistentAttribute.getMapping();
- assertEquals(null, ormBasicMapping.getSpecifiedConverter());
- assertEquals(org.eclipse.jpt.core.context.Converter.NO_CONVERTER, ormBasicMapping.getConverter().getType());
- assertEquals("bar", javaConverter.getDefaultObjectValue());
- }
-
- public void testModifyDefaultObjectValue() throws Exception {
- OrmPersistentType ormPersistentType = getEntityMappings().addPersistentType(MappingKeys.ENTITY_TYPE_MAPPING_KEY, "model.Foo");
- OrmPersistentAttribute ormPersistentAttribute = ormPersistentType.addSpecifiedPersistentAttribute(MappingKeys.BASIC_ATTRIBUTE_MAPPING_KEY, "basicMapping");
- OrmBasicMapping ormBasicMapping = ((OrmBasicMapping) ormPersistentAttribute.getMapping());
- ormBasicMapping.setSpecifiedConverter(Convert.ECLIPSE_LINK_CONVERTER);
- ((Convert) ormBasicMapping.getConverter()).setConverter(EclipseLinkConverter.OBJECT_TYPE_CONVERTER);
- ObjectTypeConverter ormConverter = (ObjectTypeConverter) ((Convert) ormBasicMapping.getConverter()).getConverter();
- XmlObjectTypeConverter converterResource = ((XmlBasic) getXmlEntityMappings().getEntities().get(0).getAttributes().getBasics().get(0)).getObjectTypeConverter();
-
- assertEquals(null, ormConverter.getDefaultObjectValue());
- assertEquals(null, converterResource.getDefaultObjectValue());
-
- //set converter class in the context model, verify resource model updated
- ormConverter.setDefaultObjectValue("foo");
- assertEquals("foo", ormConverter.getDefaultObjectValue());
- assertEquals("foo", converterResource.getDefaultObjectValue());
-
- ormConverter.setDefaultObjectValue(null);
- assertEquals(null, ormConverter.getDefaultObjectValue());
- assertEquals(null, converterResource.getDefaultObjectValue());
- }
-
-
- public void testUpdateConversionValues() throws Exception {
- createTestEntityWithBasicMapping();
-
- OrmPersistentType ormPersistentType = getEntityMappings().addPersistentType(MappingKeys.ENTITY_TYPE_MAPPING_KEY, FULLY_QUALIFIED_TYPE_NAME);
- OrmPersistentAttribute ormPersistentAttribute = ormPersistentType.addSpecifiedPersistentAttribute(MappingKeys.BASIC_ATTRIBUTE_MAPPING_KEY, "id");
- OrmBasicMapping ormBasicMapping = (OrmBasicMapping) ormPersistentAttribute.getMapping();
- ormBasicMapping.setSpecifiedConverter(Convert.ECLIPSE_LINK_CONVERTER);
- ((Convert) ormBasicMapping.getConverter()).setConverter(EclipseLinkConverter.OBJECT_TYPE_CONVERTER);
- ObjectTypeConverter ormConverter = (ObjectTypeConverter) ((Convert) ormBasicMapping.getConverter()).getConverter();
- XmlObjectTypeConverter converterResource = ((XmlBasic) getXmlEntityMappings().getEntities().get(0).getAttributes().getBasics().get(0)).getObjectTypeConverter();
- JavaBasicMapping javaBasicMapping = (JavaBasicMapping) ormPersistentType.getJavaPersistentType().getAttributeNamed("id").getMapping();
-
- assertEquals(0, ormConverter.conversionValuesSize());
- assertEquals(0, converterResource.getConversionValues().size());
-
- //add conversion value to resource model, check context model
- XmlConversionValue resourceConversionValue = EclipseLinkOrmFactory.eINSTANCE.createXmlConversionValue();
- converterResource.getConversionValues().add(resourceConversionValue);
- resourceConversionValue.setDataValue("foo");
- resourceConversionValue.setObjectValue("bar");
-
- assertEquals(1, ormConverter.conversionValuesSize());
- ListIterator<ConversionValue> contextConversionValues = ormConverter.conversionValues();
- ConversionValue contextConversionValue = contextConversionValues.next();
- assertEquals("foo", contextConversionValue.getDataValue());
- assertEquals("bar", contextConversionValue.getObjectValue());
- assertEquals(1, converterResource.getConversionValues().size());
- assertEquals("foo", converterResource.getConversionValues().get(0).getDataValue());
- assertEquals("bar", converterResource.getConversionValues().get(0).getObjectValue());
-
- //add a conversion to the beginning of the resource model list
- XmlConversionValue xmlConversionValue2 = EclipseLinkOrmFactory.eINSTANCE.createXmlConversionValue();
- converterResource.getConversionValues().add(0, xmlConversionValue2);
- xmlConversionValue2.setDataValue("foo2");
- xmlConversionValue2.setObjectValue("bar2");
-
- assertEquals(2, ormConverter.conversionValuesSize());
- contextConversionValues = ormConverter.conversionValues();
- contextConversionValue = contextConversionValues.next();
- assertEquals("foo2", contextConversionValue.getDataValue());
- assertEquals("bar2", contextConversionValue.getObjectValue());
- contextConversionValue = contextConversionValues.next();
- assertEquals("foo", contextConversionValue.getDataValue());
- assertEquals("bar", contextConversionValue.getObjectValue());
- assertEquals(2, converterResource.getConversionValues().size());
- assertEquals("foo2", converterResource.getConversionValues().get(0).getDataValue());
- assertEquals("bar2", converterResource.getConversionValues().get(0).getObjectValue());
- assertEquals("foo", converterResource.getConversionValues().get(1).getDataValue());
- assertEquals("bar", converterResource.getConversionValues().get(1).getObjectValue());
-
- //move a conversion value in the resource model list
-
- converterResource.getConversionValues().move(0, 1);
- assertEquals(2, ormConverter.conversionValuesSize());
- contextConversionValues = ormConverter.conversionValues();
- contextConversionValue = contextConversionValues.next();
- assertEquals("foo", contextConversionValue.getDataValue());
- assertEquals("bar", contextConversionValue.getObjectValue());
- contextConversionValue = contextConversionValues.next();
- assertEquals("foo2", contextConversionValue.getDataValue());
- assertEquals("bar2", contextConversionValue.getObjectValue());
- assertEquals(2, converterResource.getConversionValues().size());
- assertEquals("foo", converterResource.getConversionValues().get(0).getDataValue());
- assertEquals("bar", converterResource.getConversionValues().get(0).getObjectValue());
- assertEquals("foo2", converterResource.getConversionValues().get(1).getDataValue());
- assertEquals("bar2", converterResource.getConversionValues().get(1).getObjectValue());
-
- //remove a conversion value from the resource model list
-
- converterResource.getConversionValues().remove(0);
- assertEquals(1, ormConverter.conversionValuesSize());
- contextConversionValues = ormConverter.conversionValues();
- contextConversionValue = contextConversionValues.next();
- assertEquals("foo2", contextConversionValue.getDataValue());
- assertEquals("bar2", contextConversionValue.getObjectValue());
- assertEquals(1, converterResource.getConversionValues().size());
- assertEquals("foo2", converterResource.getConversionValues().get(0).getDataValue());
- assertEquals("bar2", converterResource.getConversionValues().get(0).getObjectValue());
-
- //clear the conversion value resource model list
- converterResource.getConversionValues().clear();
- assertEquals(0, ormConverter.conversionValuesSize());
- assertEquals(0, converterResource.getConversionValues().size());
-
- //add conversion value to java context model, verify does not affect orm context model
-
- ObjectTypeConverter javaConverter = (ObjectTypeConverter) ((EclipseLinkJavaConvert) javaBasicMapping.getConverter()).getConverter();
- ConversionValue javaConversionValue = javaConverter.addConversionValue();
- javaConversionValue.setDataValue("baz");
-
- assertEquals(0, ormConverter.conversionValuesSize());
- assertEquals(0, converterResource.getConversionValues().size());
- assertEquals(1, javaConverter.conversionValuesSize());
-
- //remove orm attribute mapping, verify virtual mapping has conversion values from java
-
- ormPersistentType.removeSpecifiedPersistentAttribute(ormPersistentAttribute);
- ormPersistentAttribute = ormPersistentType.virtualAttributes().next();
- ormBasicMapping = (OrmBasicMapping) ormPersistentAttribute.getMapping();
- ormConverter = (ObjectTypeConverter) ((Convert) ormBasicMapping.getConverter()).getConverter();
-
- assertEquals(1, ormConverter.conversionValuesSize());
- contextConversionValues = ormConverter.conversionValues();
- contextConversionValue = contextConversionValues.next();
- assertEquals("baz", contextConversionValue.getDataValue());
- assertEquals(0, converterResource.getConversionValues().size());
- assertEquals(1, javaConverter.conversionValuesSize());
-
- //set metadata-complete to true, verify virtual mapping ignores the conversion values from java
-
- ormPersistentType.getMapping().setSpecifiedMetadataComplete(Boolean.TRUE);
- ormPersistentAttribute = ormPersistentType.virtualAttributes().next();
- ormBasicMapping = (OrmBasicMapping) ormPersistentAttribute.getMapping();
- assertEquals(EclipseLinkConverter.NO_CONVERTER, ormBasicMapping.getConverter().getType());
- }
-
- public void testModifyConversionValues() throws Exception {
- OrmPersistentType ormPersistentType = getEntityMappings().addPersistentType(MappingKeys.ENTITY_TYPE_MAPPING_KEY, FULLY_QUALIFIED_TYPE_NAME);
- OrmPersistentAttribute ormPersistentAttribute = ormPersistentType.addSpecifiedPersistentAttribute(MappingKeys.BASIC_ATTRIBUTE_MAPPING_KEY, "id");
- OrmBasicMapping ormBasicMapping = (OrmBasicMapping) ormPersistentAttribute.getMapping();
- ormBasicMapping.setSpecifiedConverter(Convert.ECLIPSE_LINK_CONVERTER);
- ((Convert) ormBasicMapping.getConverter()).setConverter(EclipseLinkConverter.OBJECT_TYPE_CONVERTER);
- ObjectTypeConverter ormConverter = (ObjectTypeConverter) ((Convert) ormBasicMapping.getConverter()).getConverter();
- XmlObjectTypeConverter converterResource = ((XmlBasic) getXmlEntityMappings().getEntities().get(0).getAttributes().getBasics().get(0)).getObjectTypeConverter();
-
- assertEquals(0, ormConverter.conversionValuesSize());
- assertEquals(0, converterResource.getConversionValues().size());
-
- //add conversion value to context model, check resource model
- ConversionValue contextConversionValue = ormConverter.addConversionValue();
- contextConversionValue.setDataValue("foo");
- contextConversionValue.setObjectValue("bar");
-
- assertEquals(1, ormConverter.conversionValuesSize());
- ListIterator<ConversionValue> contextConversionValues = ormConverter.conversionValues();
- contextConversionValue = contextConversionValues.next();
- assertEquals("foo", contextConversionValue.getDataValue());
- assertEquals("bar", contextConversionValue.getObjectValue());
- assertEquals(1, converterResource.getConversionValues().size());
- assertEquals("foo", converterResource.getConversionValues().get(0).getDataValue());
- assertEquals("bar", converterResource.getConversionValues().get(0).getObjectValue());
-
- //add a conversion to the beginning of the context model list
- ConversionValue contextConversionValue2 = ormConverter.addConversionValue(0);
- contextConversionValue2.setDataValue("foo2");
- contextConversionValue2.setObjectValue("bar2");
-
- assertEquals(2, ormConverter.conversionValuesSize());
- contextConversionValues = ormConverter.conversionValues();
- contextConversionValue = contextConversionValues.next();
- assertEquals("foo2", contextConversionValue.getDataValue());
- assertEquals("bar2", contextConversionValue.getObjectValue());
- contextConversionValue = contextConversionValues.next();
- assertEquals("foo", contextConversionValue.getDataValue());
- assertEquals("bar", contextConversionValue.getObjectValue());
- assertEquals(2, converterResource.getConversionValues().size());
- assertEquals("foo2", converterResource.getConversionValues().get(0).getDataValue());
- assertEquals("bar2", converterResource.getConversionValues().get(0).getObjectValue());
- assertEquals("foo", converterResource.getConversionValues().get(1).getDataValue());
- assertEquals("bar", converterResource.getConversionValues().get(1).getObjectValue());
-
- //move a conversion value in the context model list
-
- ormConverter.moveConversionValue(0, 1);
- assertEquals(2, ormConverter.conversionValuesSize());
- contextConversionValues = ormConverter.conversionValues();
- contextConversionValue = contextConversionValues.next();
- assertEquals("foo", contextConversionValue.getDataValue());
- assertEquals("bar", contextConversionValue.getObjectValue());
- contextConversionValue = contextConversionValues.next();
- assertEquals("foo2", contextConversionValue.getDataValue());
- assertEquals("bar2", contextConversionValue.getObjectValue());
- assertEquals(2, converterResource.getConversionValues().size());
- assertEquals("foo", converterResource.getConversionValues().get(0).getDataValue());
- assertEquals("bar", converterResource.getConversionValues().get(0).getObjectValue());
- assertEquals("foo2", converterResource.getConversionValues().get(1).getDataValue());
- assertEquals("bar2", converterResource.getConversionValues().get(1).getObjectValue());
-
- //remove a conversion value from the context model list
-
- ormConverter.removeConversionValue(0);
- assertEquals(1, ormConverter.conversionValuesSize());
- contextConversionValues = ormConverter.conversionValues();
- contextConversionValue = contextConversionValues.next();
- assertEquals("foo2", contextConversionValue.getDataValue());
- assertEquals("bar2", contextConversionValue.getObjectValue());
- assertEquals(1, converterResource.getConversionValues().size());
- assertEquals("foo2", converterResource.getConversionValues().get(0).getDataValue());
- assertEquals("bar2", converterResource.getConversionValues().get(0).getObjectValue());
-
- //clear the conversion value resource model list
- ormConverter.removeConversionValue(0);
- assertEquals(0, ormConverter.conversionValuesSize());
- assertEquals(0, converterResource.getConversionValues().size());
- }
-
- public void testInitializeConversionValues() throws Exception {
- createTestEntityWithConvertAndObjectTypeConverterConversionValue();
- OrmPersistentType ormPersistentType = getEntityMappings().addPersistentType(MappingKeys.ENTITY_TYPE_MAPPING_KEY, FULLY_QUALIFIED_TYPE_NAME);
- OrmPersistentAttribute ormPersistentAttribute = ormPersistentType.getAttributeNamed("id");
- OrmBasicMapping ormBasicMapping = (OrmBasicMapping) ormPersistentAttribute.getMapping();
- Convert eclipseLinkConvert = (Convert) ormBasicMapping.getConverter();
- ObjectTypeConverter converter = (ObjectTypeConverter) eclipseLinkConvert.getConverter();
-
- assertEquals(1, converter.conversionValuesSize());
- assertEquals("f", converter.conversionValues().next().getDataValue());
- assertEquals("female", converter.conversionValues().next().getObjectValue());
- }
-}
diff --git a/jpa/tests/org.eclipse.jpt.eclipselink.core.tests/src/org/eclipse/jpt/eclipselink/core/tests/internal/context/orm/EclipseLinkOrmOneToManyMappingTests.java b/jpa/tests/org.eclipse.jpt.eclipselink.core.tests/src/org/eclipse/jpt/eclipselink/core/tests/internal/context/orm/EclipseLinkOrmOneToManyMappingTests.java
deleted file mode 100644
index 1adf33b7e0..0000000000
--- a/jpa/tests/org.eclipse.jpt.eclipselink.core.tests/src/org/eclipse/jpt/eclipselink/core/tests/internal/context/orm/EclipseLinkOrmOneToManyMappingTests.java
+++ /dev/null
@@ -1,308 +0,0 @@
-/*******************************************************************************
- * Copyright (c) 2008, 2009 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.
- *
- * Contributors:
- * Oracle - initial API and implementation
- *******************************************************************************/
-package org.eclipse.jpt.eclipselink.core.tests.internal.context.orm;
-
-import org.eclipse.jpt.core.MappingKeys;
-import org.eclipse.jpt.core.context.orm.OrmJoinTable;
-import org.eclipse.jpt.core.context.orm.OrmOneToManyMapping;
-import org.eclipse.jpt.core.context.orm.OrmPersistentAttribute;
-import org.eclipse.jpt.core.context.orm.OrmPersistentType;
-import org.eclipse.jpt.core.resource.java.JPA;
-import org.eclipse.jpt.core.tests.internal.projects.TestJavaProject.SourceWriter;
-import org.eclipse.jpt.eclipselink.core.context.EclipseLinkOneToManyMapping;
-import org.eclipse.jpt.eclipselink.core.context.EclipseLinkRelationshipMapping;
-import org.eclipse.jpt.eclipselink.core.context.JoinFetchType;
-import org.eclipse.jpt.eclipselink.core.internal.context.orm.EclipseLinkOrmOneToManyMapping;
-import org.eclipse.jpt.eclipselink.core.resource.orm.XmlEntity;
-import org.eclipse.jpt.eclipselink.core.resource.orm.XmlJoinFetchType;
-import org.eclipse.jpt.eclipselink.core.resource.orm.XmlOneToMany;
-
-@SuppressWarnings("nls")
-public class EclipseLinkOrmOneToManyMappingTests
- extends EclipseLinkOrmContextModelTestCase
-{
- public EclipseLinkOrmOneToManyMappingTests(String name) {
- super(name);
- }
-
- private void createTestDepartment() throws Exception {
- SourceWriter sourceWriter = new SourceWriter() {
- public void appendSourceTo(StringBuilder sb) {
- sb.append(CR);
- sb.append("import ").append(JPA.ENTITY).append(";");
- sb.append(CR);
- sb.append("import ").append(JPA.ID).append(";");
- sb.append(CR);
- sb.append("import java.util.Collection;");
- sb.append(CR);
- sb.append("import ").append(JPA.JOIN_TABLE).append(";");
- sb.append(CR);
- sb.append("import ").append(JPA.JOIN_COLUMN).append(";");
- sb.append("@Entity");
- sb.append(CR);
- sb.append("public class ").append("Department").append(" ");
- sb.append("{").append(CR);
- sb.append(CR);
- sb.append(" @Id").append(CR);
- sb.append(" private int id;").append(CR);
- sb.append(CR);
- sb.append(" @JoinTable(name=\"DEP_EMP\", joinColumns=@JoinColumn(name=\"DEPT_ID\"), inverseJoinColumns=@JoinColumn(name=\"EMP_ID\"))").append(CR);
- sb.append(" private Collection<Employee> employees;").append(CR);
- sb.append(CR);
- sb.append("}").append(CR);
- }
- };
- this.javaProject.createCompilationUnit(PACKAGE_NAME, "Department.java", sourceWriter);
- }
-
- private void createTestEmployee() throws Exception {
- SourceWriter sourceWriter = new SourceWriter() {
- public void appendSourceTo(StringBuilder sb) {
- sb.append(CR);
- sb.append("import ").append(JPA.ENTITY).append(";");
- sb.append(CR);
- sb.append("import ").append(JPA.ID).append(";");
- sb.append(CR);
- sb.append("@Entity");
- sb.append(CR);
- sb.append("public class ").append("Employee").append(" ");
- sb.append("{").append(CR);
- sb.append(CR);
- sb.append(" @Id").append(CR);
- sb.append(" private int empId;").append(CR);
- sb.append(CR);
- sb.append("}").append(CR);
- }
- };
- this.javaProject.createCompilationUnit(PACKAGE_NAME, "Employee.java", sourceWriter);
- }
-
-
- public void testUpdatePrivateOwned() throws Exception {
- OrmPersistentType ormPersistentType =
- getEntityMappings().addPersistentType(MappingKeys.ENTITY_TYPE_MAPPING_KEY, FULLY_QUALIFIED_TYPE_NAME);
- OrmPersistentAttribute ormPersistentAttribute =
- ormPersistentType.addSpecifiedPersistentAttribute(MappingKeys.ONE_TO_MANY_ATTRIBUTE_MAPPING_KEY, "oneToMany");
- EclipseLinkOneToManyMapping contextOneToMany =
- (EclipseLinkOneToManyMapping) ormPersistentAttribute.getMapping();
- XmlEntity resourceEntity =
- (XmlEntity) getXmlEntityMappings().getEntities().get(0);
- XmlOneToMany resourceOneToMany =
- (XmlOneToMany) resourceEntity.getAttributes().getOneToManys().get(0);
-
- // check defaults
-
- assertFalse(resourceOneToMany.isPrivateOwned());
- assertFalse(contextOneToMany.getPrivateOwned().isPrivateOwned());
-
- // set xml private owned to true, check context
-
- resourceOneToMany.setPrivateOwned(true);
-
- assertTrue(resourceOneToMany.isPrivateOwned());
- assertTrue(contextOneToMany.getPrivateOwned().isPrivateOwned());
-
- // set xml private owned back to false, check context
-
- resourceOneToMany.setPrivateOwned(false);
-
- assertFalse(resourceOneToMany.isPrivateOwned());
- assertFalse(contextOneToMany.getPrivateOwned().isPrivateOwned());
- }
-
- public void testModifyPrivateOwned() throws Exception {
- OrmPersistentType ormPersistentType =
- getEntityMappings().addPersistentType(MappingKeys.ENTITY_TYPE_MAPPING_KEY, FULLY_QUALIFIED_TYPE_NAME);
- OrmPersistentAttribute ormPersistentAttribute =
- ormPersistentType.addSpecifiedPersistentAttribute(MappingKeys.ONE_TO_MANY_ATTRIBUTE_MAPPING_KEY, "oneToMany");
- EclipseLinkOneToManyMapping contextOneToMany =
- (EclipseLinkOneToManyMapping) ormPersistentAttribute.getMapping();
- XmlEntity resourceEntity =
- (XmlEntity)getXmlEntityMappings().getEntities().get(0);
- XmlOneToMany resourceOneToMany =
- (XmlOneToMany) resourceEntity.getAttributes().getOneToManys().get(0);
-
- // check defaults
-
- assertFalse(resourceOneToMany.isPrivateOwned());
- assertFalse(contextOneToMany.getPrivateOwned().isPrivateOwned());
-
- // set context private owned to true, check resource
-
- contextOneToMany.getPrivateOwned().setPrivateOwned(true);
-
- assertTrue(resourceOneToMany.isPrivateOwned());
- assertTrue(contextOneToMany.getPrivateOwned().isPrivateOwned());
-
- // set context private owned back to false, check resource
-
- contextOneToMany.getPrivateOwned().setPrivateOwned(false);
-
- assertFalse(resourceOneToMany.isPrivateOwned());
- assertFalse(contextOneToMany.getPrivateOwned().isPrivateOwned());
- }
-
- public void testUpdateJoinFetch() throws Exception {
- OrmPersistentType ormPersistentType =
- getEntityMappings().addPersistentType(MappingKeys.ENTITY_TYPE_MAPPING_KEY, FULLY_QUALIFIED_TYPE_NAME);
- OrmPersistentAttribute ormPersistentAttribute =
- ormPersistentType.addSpecifiedPersistentAttribute(MappingKeys.ONE_TO_MANY_ATTRIBUTE_MAPPING_KEY, "oneToMany");
- EclipseLinkOneToManyMapping contextOneToMany =
- (EclipseLinkOneToManyMapping) ormPersistentAttribute.getMapping();
- XmlEntity resourceEntity =
- (XmlEntity) getXmlEntityMappings().getEntities().get(0);
- XmlOneToMany resourceOneToMany =
- (XmlOneToMany) resourceEntity.getAttributes().getOneToManys().get(0);
-
- // check defaults
-
- assertNull(resourceOneToMany.getJoinFetch());
- assertNull(contextOneToMany.getJoinFetch().getValue());
-
- // set xml join fetch to INNER, check context
-
- resourceOneToMany.setJoinFetch(XmlJoinFetchType.INNER);
-
- assertEquals(XmlJoinFetchType.INNER, resourceOneToMany.getJoinFetch());
- assertEquals(JoinFetchType.INNER, contextOneToMany.getJoinFetch().getValue());
-
- // set xml join fetch to OUTER, check context
-
- resourceOneToMany.setJoinFetch(XmlJoinFetchType.OUTER);
-
- assertEquals(XmlJoinFetchType.OUTER, resourceOneToMany.getJoinFetch());
- assertEquals(JoinFetchType.OUTER, contextOneToMany.getJoinFetch().getValue());
-
- // set xml join fetch to null, check context
-
- resourceOneToMany.setJoinFetch(null);
-
- assertNull(resourceOneToMany.getJoinFetch());
- assertNull(contextOneToMany.getJoinFetch().getValue());
- }
-
- public void testModifyJoinFetch() throws Exception {
- OrmPersistentType ormPersistentType =
- getEntityMappings().addPersistentType(MappingKeys.ENTITY_TYPE_MAPPING_KEY, FULLY_QUALIFIED_TYPE_NAME);
- OrmPersistentAttribute ormPersistentAttribute =
- ormPersistentType.addSpecifiedPersistentAttribute(MappingKeys.ONE_TO_MANY_ATTRIBUTE_MAPPING_KEY, "oneToMany");
- EclipseLinkOneToManyMapping contextOneToMany =
- (EclipseLinkOneToManyMapping) ormPersistentAttribute.getMapping();
- XmlEntity resourceEntity =
- (XmlEntity)getXmlEntityMappings().getEntities().get(0);
- XmlOneToMany resourceOneToMany =
- (XmlOneToMany) resourceEntity.getAttributes().getOneToManys().get(0);
-
- // check defaults
-
- assertNull(resourceOneToMany.getJoinFetch());
- assertNull(contextOneToMany.getJoinFetch().getValue());
-
- // set context join fetch to INNER, check resource
-
- contextOneToMany.getJoinFetch().setValue(JoinFetchType.INNER);
-
- assertEquals(XmlJoinFetchType.INNER, resourceOneToMany.getJoinFetch());
- assertEquals(JoinFetchType.INNER, contextOneToMany.getJoinFetch().getValue());
-
- // set context join fetch to OUTER, check resource
-
- contextOneToMany.getJoinFetch().setValue(JoinFetchType.OUTER);
-
- assertEquals(XmlJoinFetchType.OUTER, resourceOneToMany.getJoinFetch());
- assertEquals(JoinFetchType.OUTER, contextOneToMany.getJoinFetch().getValue());
-
- // set context join fetch to null, check resource
-
- contextOneToMany.getJoinFetch().setValue(null);
-
- assertNull(resourceOneToMany.getJoinFetch());
- assertNull(contextOneToMany.getJoinFetch().getValue());
- }
-
- public void testJoinFetchDefault() throws Exception {
- createTestEmployee();
- createTestDepartment();
- getEntityMappings().addPersistentType(MappingKeys.ENTITY_TYPE_MAPPING_KEY, PACKAGE_NAME + ".Department");
- getEntityMappings().addPersistentType(MappingKeys.ENTITY_TYPE_MAPPING_KEY, PACKAGE_NAME + ".Employee");
-
- OrmPersistentType departmentPersistentType = getEntityMappings().persistentTypes().next();
- EclipseLinkOrmOneToManyMapping oneToMany = (EclipseLinkOrmOneToManyMapping) departmentPersistentType.getAttributeNamed("employees").getMapping();
-
- assertNull(oneToMany.getJoinFetch().getValue());
-
- getEntityMappings().getPersistenceUnitMetadata().setXmlMappingMetadataComplete(true);
- oneToMany = (EclipseLinkOrmOneToManyMapping) departmentPersistentType.getAttributeNamed("employees").getMapping();
- assertNull(oneToMany.getJoinFetch().getValue());
-
- EclipseLinkRelationshipMapping javaRelationshipMapping = (EclipseLinkRelationshipMapping) departmentPersistentType.getJavaPersistentType().getAttributeNamed("employees").getMapping();
- javaRelationshipMapping.getJoinFetch().setValue(JoinFetchType.OUTER);
- assertNull(oneToMany.getJoinFetch().getValue());
-
- getEntityMappings().getPersistenceUnitMetadata().setXmlMappingMetadataComplete(false);
- oneToMany = (EclipseLinkOrmOneToManyMapping) departmentPersistentType.getAttributeNamed("employees").getMapping();
- assertEquals(JoinFetchType.OUTER, oneToMany.getJoinFetch().getValue());
- }
-
- public void testDefaultJoinTable() throws Exception {
- createTestEmployee();
- createTestDepartment();
- getEntityMappings().addPersistentType(MappingKeys.ENTITY_TYPE_MAPPING_KEY, PACKAGE_NAME + ".Department");
- getEntityMappings().addPersistentType(MappingKeys.ENTITY_TYPE_MAPPING_KEY, PACKAGE_NAME + ".Employee");
-
- OrmPersistentType departmentPersistentType = getEntityMappings().persistentTypes().next();
- OrmOneToManyMapping oneToMany = (OrmOneToManyMapping) departmentPersistentType.getAttributeNamed("employees").getMapping();
-
- assertEquals(true, oneToMany.getPersistentAttribute().isVirtual());
- OrmJoinTable ormJoinTable = oneToMany.getRelationshipReference().getJoinTableJoiningStrategy().getJoinTable();
- assertEquals("DEP_EMP", ormJoinTable.getName());
- assertEquals("DEPT_ID", ormJoinTable.specifiedJoinColumns().next().getName());
- assertEquals("id", ormJoinTable.specifiedJoinColumns().next().getReferencedColumnName());
- assertEquals("EMP_ID", ormJoinTable.specifiedInverseJoinColumns().next().getName());
- assertEquals("empId", ormJoinTable.specifiedInverseJoinColumns().next().getReferencedColumnName());
-
- //set metadata-complete and verify JoinTable info is not taken from the java
- departmentPersistentType.getMapping().setSpecifiedMetadataComplete(Boolean.TRUE);
- departmentPersistentType.addSpecifiedPersistentAttribute(MappingKeys.ID_ATTRIBUTE_MAPPING_KEY, "id");
- oneToMany = (OrmOneToManyMapping) departmentPersistentType.getAttributeNamed("employees").getMapping();
-
- assertEquals(true, oneToMany.getPersistentAttribute().isVirtual());
- ormJoinTable = oneToMany.getRelationshipReference().getJoinTableJoiningStrategy().getJoinTable();
- assertEquals("Department_Employee", ormJoinTable.getName());
- assertEquals("Department_id", ormJoinTable.specifiedJoinColumns().next().getName());
- assertEquals("id", ormJoinTable.specifiedJoinColumns().next().getReferencedColumnName());
- assertEquals("employees_empId", ormJoinTable.specifiedInverseJoinColumns().next().getName());
- assertEquals("empId", ormJoinTable.specifiedInverseJoinColumns().next().getReferencedColumnName());
-
- //set metadata-complete to false, add mapping to orm.xml verify JoinTable info is not taken from the java
- departmentPersistentType.getMapping().setSpecifiedMetadataComplete(Boolean.FALSE);
- oneToMany = (OrmOneToManyMapping) departmentPersistentType.getAttributeNamed("employees").getMapping();
- assertEquals(true, oneToMany.getPersistentAttribute().isVirtual());
- ormJoinTable = oneToMany.getRelationshipReference().getJoinTableJoiningStrategy().getJoinTable();
- assertEquals("DEP_EMP", ormJoinTable.getName());
- assertEquals("DEPT_ID", ormJoinTable.specifiedJoinColumns().next().getName());
- assertEquals("id", ormJoinTable.specifiedJoinColumns().next().getReferencedColumnName());
- assertEquals("EMP_ID", ormJoinTable.specifiedInverseJoinColumns().next().getName());
- assertEquals("empId", ormJoinTable.specifiedInverseJoinColumns().next().getReferencedColumnName());
-
-
- departmentPersistentType.addSpecifiedPersistentAttribute(MappingKeys.ONE_TO_MANY_ATTRIBUTE_MAPPING_KEY, "employees");
- oneToMany = (OrmOneToManyMapping) departmentPersistentType.getAttributeNamed("employees").getMapping();
- assertEquals(false, oneToMany.getPersistentAttribute().isVirtual());
- ormJoinTable = oneToMany.getRelationshipReference().getJoinTableJoiningStrategy().getJoinTable();
- assertEquals("Department_Employee", ormJoinTable.getName());
- assertEquals(0, ormJoinTable.specifiedJoinColumnsSize());
- assertEquals("Department_id", ormJoinTable.getDefaultJoinColumn().getName());
- assertEquals("id", ormJoinTable.getDefaultJoinColumn().getReferencedColumnName());
- assertEquals(0, ormJoinTable.specifiedInverseJoinColumnsSize());
- assertEquals("employees_empId", ormJoinTable.getDefaultInverseJoinColumn().getName());
- assertEquals("empId", ormJoinTable.getDefaultInverseJoinColumn().getReferencedColumnName());
- }
-}
diff --git a/jpa/tests/org.eclipse.jpt.eclipselink.core.tests/src/org/eclipse/jpt/eclipselink/core/tests/internal/context/orm/EclipseLinkOrmOneToOneMappingTests.java b/jpa/tests/org.eclipse.jpt.eclipselink.core.tests/src/org/eclipse/jpt/eclipselink/core/tests/internal/context/orm/EclipseLinkOrmOneToOneMappingTests.java
deleted file mode 100644
index bc416e2c73..0000000000
--- a/jpa/tests/org.eclipse.jpt.eclipselink.core.tests/src/org/eclipse/jpt/eclipselink/core/tests/internal/context/orm/EclipseLinkOrmOneToOneMappingTests.java
+++ /dev/null
@@ -1,244 +0,0 @@
-/*******************************************************************************
- * Copyright (c) 2008, 2009 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.
- *
- * Contributors:
- * Oracle - initial API and implementation
- *******************************************************************************/
-package org.eclipse.jpt.eclipselink.core.tests.internal.context.orm;
-
-import org.eclipse.jpt.core.MappingKeys;
-import org.eclipse.jpt.core.context.orm.OrmPersistentAttribute;
-import org.eclipse.jpt.core.context.orm.OrmPersistentType;
-import org.eclipse.jpt.core.resource.java.JPA;
-import org.eclipse.jpt.core.tests.internal.projects.TestJavaProject.SourceWriter;
-import org.eclipse.jpt.eclipselink.core.context.EclipseLinkOneToOneMapping;
-import org.eclipse.jpt.eclipselink.core.context.EclipseLinkRelationshipMapping;
-import org.eclipse.jpt.eclipselink.core.context.JoinFetchType;
-import org.eclipse.jpt.eclipselink.core.internal.context.orm.EclipseLinkOrmOneToOneMapping;
-import org.eclipse.jpt.eclipselink.core.resource.orm.XmlEntity;
-import org.eclipse.jpt.eclipselink.core.resource.orm.XmlJoinFetchType;
-import org.eclipse.jpt.eclipselink.core.resource.orm.XmlOneToOne;
-
-@SuppressWarnings("nls")
-public class EclipseLinkOrmOneToOneMappingTests
- extends EclipseLinkOrmContextModelTestCase
-{
- public EclipseLinkOrmOneToOneMappingTests(String name) {
- super(name);
- }
-
- private void createTestDepartment() throws Exception {
- SourceWriter sourceWriter = new SourceWriter() {
- public void appendSourceTo(StringBuilder sb) {
- sb.append(CR);
- sb.append("import ").append(JPA.ENTITY).append(";");
- sb.append(CR);
- sb.append("import ").append(JPA.ID).append(";");
- sb.append(CR);
- sb.append(CR);
- sb.append("import ").append(JPA.ONE_TO_ONE).append(";");
- sb.append("@Entity");
- sb.append(CR);
- sb.append("public class ").append("Department").append(" ");
- sb.append("{").append(CR);
- sb.append(CR);
- sb.append(" @Id").append(CR);
- sb.append(" private int id;").append(CR);
- sb.append(CR);
- sb.append(" @OneToOne").append(CR);
- sb.append(" private Employee employee;").append(CR);
- sb.append(CR);
- sb.append("}").append(CR);
- }
- };
- this.javaProject.createCompilationUnit(PACKAGE_NAME, "Department.java", sourceWriter);
- }
-
- private void createTestEmployee() throws Exception {
- SourceWriter sourceWriter = new SourceWriter() {
- public void appendSourceTo(StringBuilder sb) {
- sb.append(CR);
- sb.append("import ").append(JPA.ENTITY).append(";");
- sb.append(CR);
- sb.append("import ").append(JPA.ID).append(";");
- sb.append(CR);
- sb.append("@Entity");
- sb.append(CR);
- sb.append("public class ").append("Employee").append(" ");
- sb.append("{").append(CR);
- sb.append(CR);
- sb.append(" @Id").append(CR);
- sb.append(" private int empId;").append(CR);
- sb.append(CR);
- sb.append("}").append(CR);
- }
- };
- this.javaProject.createCompilationUnit(PACKAGE_NAME, "Employee.java", sourceWriter);
- }
-
- public void testUpdatePrivateOwned() throws Exception {
- OrmPersistentType ormPersistentType =
- getEntityMappings().addPersistentType(MappingKeys.ENTITY_TYPE_MAPPING_KEY, FULLY_QUALIFIED_TYPE_NAME);
- OrmPersistentAttribute ormPersistentAttribute =
- ormPersistentType.addSpecifiedPersistentAttribute(MappingKeys.ONE_TO_ONE_ATTRIBUTE_MAPPING_KEY, "oneToOne");
- EclipseLinkOneToOneMapping contextOneToOne =
- (EclipseLinkOneToOneMapping) ormPersistentAttribute.getMapping();
- XmlEntity resourceEntity =
- (XmlEntity)getXmlEntityMappings().getEntities().get(0);
- XmlOneToOne resourceOneToOne =
- (XmlOneToOne) resourceEntity.getAttributes().getOneToOnes().get(0);
-
- // check defaults
-
- assertFalse(resourceOneToOne.isPrivateOwned());
- assertFalse(contextOneToOne.getPrivateOwned().isPrivateOwned());
-
- // set xml private owned to true, check context
-
- resourceOneToOne.setPrivateOwned(true);
-
- assertTrue(resourceOneToOne.isPrivateOwned());
- assertTrue(contextOneToOne.getPrivateOwned().isPrivateOwned());
-
- // set xml private owned back to false, check context
-
- resourceOneToOne.setPrivateOwned(false);
-
- assertFalse(resourceOneToOne.isPrivateOwned());
- assertFalse(contextOneToOne.getPrivateOwned().isPrivateOwned());
- }
-
- public void testModifyPrivateOwned() throws Exception {
- OrmPersistentType ormPersistentType =
- getEntityMappings().addPersistentType(MappingKeys.ENTITY_TYPE_MAPPING_KEY, FULLY_QUALIFIED_TYPE_NAME);
- OrmPersistentAttribute ormPersistentAttribute =
- ormPersistentType.addSpecifiedPersistentAttribute(MappingKeys.ONE_TO_ONE_ATTRIBUTE_MAPPING_KEY, "oneToOne");
- EclipseLinkOneToOneMapping contextOneToOne =
- (EclipseLinkOneToOneMapping) ormPersistentAttribute.getMapping();
- XmlEntity resourceEntity =
- (XmlEntity)getXmlEntityMappings().getEntities().get(0);
- XmlOneToOne resourceOneToOne =
- (XmlOneToOne) resourceEntity.getAttributes().getOneToOnes().get(0);
-
- // check defaults
-
- assertFalse(resourceOneToOne.isPrivateOwned());
- assertFalse(contextOneToOne.getPrivateOwned().isPrivateOwned());
-
- // set context private owned to true, check resource
-
- contextOneToOne.getPrivateOwned().setPrivateOwned(true);
-
- assertTrue(resourceOneToOne.isPrivateOwned());
- assertTrue(contextOneToOne.getPrivateOwned().isPrivateOwned());
-
- // set context private owned back to false, check resource
-
- contextOneToOne.getPrivateOwned().setPrivateOwned(false);
- }
-
- public void testUpdateJoinFetch() throws Exception {
- OrmPersistentType ormPersistentType =
- getEntityMappings().addPersistentType(MappingKeys.ENTITY_TYPE_MAPPING_KEY, FULLY_QUALIFIED_TYPE_NAME);
- OrmPersistentAttribute ormPersistentAttribute =
- ormPersistentType.addSpecifiedPersistentAttribute(MappingKeys.ONE_TO_ONE_ATTRIBUTE_MAPPING_KEY, "oneToOne");
- EclipseLinkOneToOneMapping contextOneToOne =
- (EclipseLinkOneToOneMapping) ormPersistentAttribute.getMapping();
- XmlEntity resourceEntity =
- (XmlEntity) getXmlEntityMappings().getEntities().get(0);
- XmlOneToOne resourceOneToOne =
- (XmlOneToOne) resourceEntity.getAttributes().getOneToOnes().get(0);
-
- // check defaults
-
- assertNull(resourceOneToOne.getJoinFetch());
- assertNull(contextOneToOne.getJoinFetch().getValue());
-
- // set xml join fetch to INNER, check context
-
- resourceOneToOne.setJoinFetch(XmlJoinFetchType.INNER);
-
- assertEquals(XmlJoinFetchType.INNER, resourceOneToOne.getJoinFetch());
- assertEquals(JoinFetchType.INNER, contextOneToOne.getJoinFetch().getValue());
-
- // set xml join fetch to OUTER, check context
-
- resourceOneToOne.setJoinFetch(XmlJoinFetchType.OUTER);
-
- assertEquals(XmlJoinFetchType.OUTER, resourceOneToOne.getJoinFetch());
- assertEquals(JoinFetchType.OUTER, contextOneToOne.getJoinFetch().getValue());
-
- // set xml join fetch to null, check context
-
- resourceOneToOne.setJoinFetch(null);
-
- assertNull(resourceOneToOne.getJoinFetch());
- assertNull(contextOneToOne.getJoinFetch().getValue());
- }
-
- public void testModifyJoinFetch() throws Exception {
- OrmPersistentType ormPersistentType =
- getEntityMappings().addPersistentType(MappingKeys.ENTITY_TYPE_MAPPING_KEY, FULLY_QUALIFIED_TYPE_NAME);
- OrmPersistentAttribute ormPersistentAttribute =
- ormPersistentType.addSpecifiedPersistentAttribute(MappingKeys.ONE_TO_ONE_ATTRIBUTE_MAPPING_KEY, "oneToOne");
- EclipseLinkOneToOneMapping contextOneToOne =
- (EclipseLinkOneToOneMapping) ormPersistentAttribute.getMapping();
- XmlEntity resourceEntity =
- (XmlEntity)getXmlEntityMappings().getEntities().get(0);
- XmlOneToOne resourceOneToOne =
- (XmlOneToOne) resourceEntity.getAttributes().getOneToOnes().get(0);
-
- // check defaults
-
- assertNull(resourceOneToOne.getJoinFetch());
- assertNull(contextOneToOne.getJoinFetch().getValue());
-
- // set context join fetch to INNER, check resource
-
- contextOneToOne.getJoinFetch().setValue(JoinFetchType.INNER);
-
- assertEquals(XmlJoinFetchType.INNER, resourceOneToOne.getJoinFetch());
- assertEquals(JoinFetchType.INNER, contextOneToOne.getJoinFetch().getValue());
-
- // set context join fetch to OUTER, check resource
-
- contextOneToOne.getJoinFetch().setValue(JoinFetchType.OUTER);
-
- assertEquals(XmlJoinFetchType.OUTER, resourceOneToOne.getJoinFetch());
- assertEquals(JoinFetchType.OUTER, contextOneToOne.getJoinFetch().getValue());
-
- // set context join fetch to null, check resource
-
- contextOneToOne.getJoinFetch().setValue(null);
-
- assertNull(resourceOneToOne.getJoinFetch());
- assertNull(contextOneToOne.getJoinFetch().getValue());
- }
-
- public void testJoinFetchDefaultFromJava() throws Exception {
- createTestEmployee();
- createTestDepartment();
- getEntityMappings().addPersistentType(MappingKeys.ENTITY_TYPE_MAPPING_KEY, PACKAGE_NAME + ".Department");
- getEntityMappings().addPersistentType(MappingKeys.ENTITY_TYPE_MAPPING_KEY, PACKAGE_NAME + ".Employee");
-
- OrmPersistentType departmentPersistentType = getEntityMappings().persistentTypes().next();
- EclipseLinkOrmOneToOneMapping oneToOne = (EclipseLinkOrmOneToOneMapping) departmentPersistentType.getAttributeNamed("employee").getMapping();
-
- assertNull(oneToOne.getJoinFetch().getValue());
-
- getEntityMappings().getPersistenceUnitMetadata().setXmlMappingMetadataComplete(true);
- oneToOne = (EclipseLinkOrmOneToOneMapping) departmentPersistentType.getAttributeNamed("employee").getMapping();
- assertNull(oneToOne.getJoinFetch().getValue());
-
- EclipseLinkRelationshipMapping javaRelationshipMapping = (EclipseLinkRelationshipMapping) departmentPersistentType.getJavaPersistentType().getAttributeNamed("employee").getMapping();
- javaRelationshipMapping.getJoinFetch().setValue(JoinFetchType.OUTER);
- assertNull(oneToOne.getJoinFetch().getValue());
-
- getEntityMappings().getPersistenceUnitMetadata().setXmlMappingMetadataComplete(false);
- oneToOne = (EclipseLinkOrmOneToOneMapping) departmentPersistentType.getAttributeNamed("employee").getMapping();
- assertEquals(JoinFetchType.OUTER, oneToOne.getJoinFetch().getValue());
- }
-} \ No newline at end of file
diff --git a/jpa/tests/org.eclipse.jpt.eclipselink.core.tests/src/org/eclipse/jpt/eclipselink/core/tests/internal/context/orm/EclipseLinkOrmPersistentAttributeTests.java b/jpa/tests/org.eclipse.jpt.eclipselink.core.tests/src/org/eclipse/jpt/eclipselink/core/tests/internal/context/orm/EclipseLinkOrmPersistentAttributeTests.java
deleted file mode 100644
index 6f8c498dcd..0000000000
--- a/jpa/tests/org.eclipse.jpt.eclipselink.core.tests/src/org/eclipse/jpt/eclipselink/core/tests/internal/context/orm/EclipseLinkOrmPersistentAttributeTests.java
+++ /dev/null
@@ -1,314 +0,0 @@
-/*******************************************************************************
- * Copyright (c) 2008, 2009 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.
- *
- * Contributors:
- * Oracle - initial API and implementation
- *******************************************************************************/
-package org.eclipse.jpt.eclipselink.core.tests.internal.context.orm;
-
-import java.util.Iterator;
-import java.util.ListIterator;
-import org.eclipse.jdt.core.ICompilationUnit;
-import org.eclipse.jpt.core.JptCorePlugin;
-import org.eclipse.jpt.core.MappingKeys;
-import org.eclipse.jpt.core.context.AccessType;
-import org.eclipse.jpt.core.context.BasicMapping;
-import org.eclipse.jpt.core.context.IdMapping;
-import org.eclipse.jpt.core.context.java.JavaPersistentAttribute;
-import org.eclipse.jpt.core.context.java.JavaPersistentType;
-import org.eclipse.jpt.core.context.orm.OrmPersistentAttribute;
-import org.eclipse.jpt.core.context.orm.OrmPersistentType;
-import org.eclipse.jpt.core.internal.context.orm.GenericOrmIdMapping;
-import org.eclipse.jpt.core.internal.context.orm.GenericOrmNullAttributeMapping;
-import org.eclipse.jpt.core.internal.context.orm.GenericOrmOneToOneMapping;
-import org.eclipse.jpt.core.resource.java.JPA;
-import org.eclipse.jpt.core.resource.java.JavaResourcePersistentAttribute;
-import org.eclipse.jpt.core.resource.persistence.PersistenceFactory;
-import org.eclipse.jpt.core.resource.persistence.XmlMappingFileRef;
-import org.eclipse.jpt.core.tests.internal.context.ContextModelTestCase;
-import org.eclipse.jpt.utility.internal.iterators.ArrayIterator;
-
-@SuppressWarnings("nls")
-public class EclipseLinkOrmPersistentAttributeTests extends ContextModelTestCase
-{
- public EclipseLinkOrmPersistentAttributeTests(String name) {
- super(name);
- }
-
- @Override
- protected void setUp() throws Exception {
- super.setUp();
- XmlMappingFileRef mappingFileRef = PersistenceFactory.eINSTANCE.createXmlMappingFileRef();
- mappingFileRef.setFileName(JptCorePlugin.DEFAULT_ORM_XML_FILE_PATH);
- getXmlPersistenceUnit().getMappingFiles().add(mappingFileRef);
- getPersistenceXmlResource().save(null);
- }
-
- private ICompilationUnit createTestTypeNullAttributeMapping() throws Exception {
-
- return this.createTestType(new DefaultAnnotationWriter() {
- @Override
- public void appendIdFieldAnnotationTo(StringBuilder sb) {
- sb.append(CR);
- sb.append(" private Address address;").append(CR);
- sb.append(CR);
- }
- });
- }
-
- private ICompilationUnit createTestEntityIdMapping() throws Exception {
- return this.createTestType(new DefaultAnnotationWriter() {
- @Override
- public Iterator<String> imports() {
- return new ArrayIterator<String>(JPA.ENTITY, JPA.ID, JPA.COLUMN);
- }
- @Override
- public void appendTypeAnnotationTo(StringBuilder sb) {
- sb.append("@Entity");
- }
- @Override
- public void appendIdFieldAnnotationTo(StringBuilder sb) {
- sb.append("@Id");
- sb.append("@Column(name=\"FOO\")");
- }
- });
- }
-
- private ICompilationUnit createTestEntityOneToOneMapping() throws Exception {
- return this.createTestType(new DefaultAnnotationWriter() {
- @Override
- public Iterator<String> imports() {
- return new ArrayIterator<String>(JPA.ENTITY, JPA.ONE_TO_ONE);
- }
- @Override
- public void appendTypeAnnotationTo(StringBuilder sb) {
- sb.append("@Entity");
- }
- @Override
- public void appendIdFieldAnnotationTo(StringBuilder sb) {
- sb.append("@OneToOne");
- sb.append(" private Address address;");
- }
- });
- }
-
- public void testMakeSpecified() throws Exception {
- createTestType();
- OrmPersistentType ormPersistentType = getEntityMappings().addPersistentType(MappingKeys.ENTITY_TYPE_MAPPING_KEY, FULLY_QUALIFIED_TYPE_NAME);
-
- assertEquals(2, ormPersistentType.virtualAttributesSize());
-
- OrmPersistentAttribute ormPersistentAttribute = ormPersistentType.virtualAttributes().next();
- assertEquals("id", ormPersistentAttribute.getName());
- assertTrue(ormPersistentAttribute.isVirtual());
- ormPersistentAttribute.makeSpecified();
-
- assertEquals(1, ormPersistentType.virtualAttributesSize());
- assertEquals(1, ormPersistentType.specifiedAttributesSize());
- OrmPersistentAttribute specifiedOrmPersistentAttribute = ormPersistentType.specifiedAttributes().next();
- assertEquals("id", specifiedOrmPersistentAttribute.getName());
- assertFalse(specifiedOrmPersistentAttribute.isVirtual());
-
- ormPersistentAttribute = ormPersistentType.virtualAttributes().next();
- ormPersistentAttribute.makeSpecified();
-
- assertEquals(0, ormPersistentType.virtualAttributesSize());
- assertEquals(2, ormPersistentType.specifiedAttributesSize());
- ListIterator<OrmPersistentAttribute> specifiedAttributes = ormPersistentType.specifiedAttributes();
- specifiedOrmPersistentAttribute = specifiedAttributes.next();
- assertEquals("id", specifiedOrmPersistentAttribute.getName());
- assertFalse(specifiedOrmPersistentAttribute.isVirtual());
-
- specifiedOrmPersistentAttribute = specifiedAttributes.next();
- assertEquals("name", specifiedOrmPersistentAttribute.getName());
- assertFalse(specifiedOrmPersistentAttribute.isVirtual());
- }
-
- public void testMakeSpecifiedMappingKey() throws Exception {
- createTestTypeNullAttributeMapping();
- OrmPersistentType ormPersistentType = getEntityMappings().addPersistentType(MappingKeys.ENTITY_TYPE_MAPPING_KEY, FULLY_QUALIFIED_TYPE_NAME);
-
- assertEquals(3, ormPersistentType.virtualAttributesSize());
-
- //take a virtual mapping with a mapping type and make it specified
- OrmPersistentAttribute ormPersistentAttribute = ormPersistentType.virtualAttributes().next();
- assertEquals("address", ormPersistentAttribute.getName());
- assertTrue(ormPersistentAttribute.isVirtual());
- assertTrue(ormPersistentAttribute.getMapping() instanceof GenericOrmNullAttributeMapping);
- ormPersistentAttribute.makeSpecified(MappingKeys.ONE_TO_ONE_ATTRIBUTE_MAPPING_KEY);
-
- assertEquals(2, ormPersistentType.virtualAttributesSize());
- assertEquals(1, ormPersistentType.specifiedAttributesSize());
- OrmPersistentAttribute specifiedOrmPersistentAttribute = ormPersistentType.specifiedAttributes().next();
- assertEquals("address", specifiedOrmPersistentAttribute.getName());
- assertFalse(specifiedOrmPersistentAttribute.isVirtual());
- assertTrue(specifiedOrmPersistentAttribute.getMapping() instanceof GenericOrmOneToOneMapping);
-
-
- ormPersistentAttribute = ormPersistentType.virtualAttributes().next();
- ormPersistentAttribute.makeSpecified(MappingKeys.ID_ATTRIBUTE_MAPPING_KEY);
-
- assertEquals(1, ormPersistentType.virtualAttributesSize());
- assertEquals(2, ormPersistentType.specifiedAttributesSize());
- ListIterator<OrmPersistentAttribute> specifiedAttributes = ormPersistentType.specifiedAttributes();
-
- specifiedOrmPersistentAttribute = specifiedAttributes.next();
- assertEquals("id", specifiedOrmPersistentAttribute.getName());
- assertFalse(specifiedOrmPersistentAttribute.isVirtual());
- assertTrue(specifiedOrmPersistentAttribute.getMapping() instanceof GenericOrmIdMapping);
-
- specifiedOrmPersistentAttribute = specifiedAttributes.next();
- assertEquals("address", specifiedOrmPersistentAttribute.getName());
- assertFalse(specifiedOrmPersistentAttribute.isVirtual());
- }
-
- public void testMakeVirtual() throws Exception {
- createTestType();
- OrmPersistentType ormPersistentType = getEntityMappings().addPersistentType(MappingKeys.ENTITY_TYPE_MAPPING_KEY, FULLY_QUALIFIED_TYPE_NAME);
-
- assertEquals(2, ormPersistentType.virtualAttributesSize());
-
- ormPersistentType.virtualAttributes().next().makeSpecified();
- ormPersistentType.virtualAttributes().next().makeSpecified();
-
- assertEquals(0, ormPersistentType.virtualAttributesSize());
- assertEquals(2, ormPersistentType.specifiedAttributesSize());
- OrmPersistentAttribute specifiedOrmPersistentAttribute = ormPersistentType.specifiedAttributes().next();
- assertEquals("id", specifiedOrmPersistentAttribute.getName());
- assertFalse(specifiedOrmPersistentAttribute.isVirtual());
-
- specifiedOrmPersistentAttribute.makeVirtual();
- assertEquals(1, ormPersistentType.virtualAttributesSize());
- assertEquals(1, ormPersistentType.specifiedAttributesSize());
-
- specifiedOrmPersistentAttribute = ormPersistentType.specifiedAttributes().next();
- specifiedOrmPersistentAttribute.makeVirtual();
- assertEquals(2, ormPersistentType.virtualAttributesSize());
- assertEquals(0, ormPersistentType.specifiedAttributesSize());
-
- ListIterator<OrmPersistentAttribute> virtualAttributes = ormPersistentType.virtualAttributes();
- OrmPersistentAttribute virtualAttribute = virtualAttributes.next();
- assertEquals("id", virtualAttribute.getName());
- virtualAttribute = virtualAttributes.next();
- assertEquals("name", virtualAttribute.getName());
- }
-
- public void testMakeVirtualNoUnderlyingJavaAttribute() throws Exception {
- createTestType();
- OrmPersistentType ormPersistentType = getEntityMappings().addPersistentType(MappingKeys.ENTITY_TYPE_MAPPING_KEY, FULLY_QUALIFIED_TYPE_NAME);
-
- assertEquals(2, ormPersistentType.virtualAttributesSize());
-
- ormPersistentType.virtualAttributes().next().makeSpecified();
- ormPersistentType.virtualAttributes().next().makeSpecified();
-
-
- ormPersistentType.specifiedAttributes().next().getMapping().setName("noJavaAttribute");
- assertEquals(1, ormPersistentType.virtualAttributesSize());
- assertEquals(2, ormPersistentType.specifiedAttributesSize());
-
-
- OrmPersistentAttribute specifiedOrmPersistentAttribute = ormPersistentType.specifiedAttributes().next();
- specifiedOrmPersistentAttribute.makeVirtual();
- assertEquals(1, ormPersistentType.virtualAttributesSize());
- assertEquals(1, ormPersistentType.specifiedAttributesSize());
-
- assertEquals("id", ormPersistentType.virtualAttributes().next().getName());
- assertEquals("name", ormPersistentType.specifiedAttributes().next().getName());
- }
-
- public void testVirtualMappingTypeWhenMetadataComplete() throws Exception {
- createTestEntityIdMapping();
- OrmPersistentType ormPersistentType = getEntityMappings().addPersistentType(MappingKeys.ENTITY_TYPE_MAPPING_KEY, FULLY_QUALIFIED_TYPE_NAME);
-
- OrmPersistentAttribute ormPersistentAttribute = ormPersistentType.virtualAttributes().next();
- assertEquals("id", ormPersistentAttribute.getName());
- assertEquals(MappingKeys.ID_ATTRIBUTE_MAPPING_KEY, ormPersistentAttribute.getMappingKey());
- assertEquals("FOO", ((IdMapping) ormPersistentAttribute.getMapping()).getColumn().getName());
-
-
- ormPersistentType.getMapping().setSpecifiedMetadataComplete(Boolean.TRUE);
-
- ormPersistentAttribute = ormPersistentType.virtualAttributes().next();
- assertEquals("id", ormPersistentAttribute.getName());
- assertEquals(MappingKeys.BASIC_ATTRIBUTE_MAPPING_KEY, ormPersistentAttribute.getMappingKey());
- assertEquals("id", ((BasicMapping) ormPersistentAttribute.getMapping()).getColumn().getName());
- }
-
- public void testVirtualMappingTypeWhenMetadataComplete2() throws Exception {
- createTestEntityOneToOneMapping();
- OrmPersistentType ormPersistentType = getEntityMappings().addPersistentType(MappingKeys.ENTITY_TYPE_MAPPING_KEY, FULLY_QUALIFIED_TYPE_NAME);
-
- OrmPersistentAttribute ormPersistentAttribute = ormPersistentType.virtualAttributes().next();
- assertEquals("address", ormPersistentAttribute.getName());
- assertEquals(MappingKeys.ONE_TO_ONE_ATTRIBUTE_MAPPING_KEY, ormPersistentAttribute.getMappingKey());
-
-
- ormPersistentType.getMapping().setSpecifiedMetadataComplete(Boolean.TRUE);
-
- ormPersistentAttribute = ormPersistentType.virtualAttributes().next();
- assertEquals("address", ormPersistentAttribute.getName());
- assertEquals(MappingKeys.NULL_ATTRIBUTE_MAPPING_KEY, ormPersistentAttribute.getMappingKey());
- }
-
- public void testGetJavaPersistentAttribute() throws Exception {
- createTestEntityIdMapping();
- OrmPersistentType ormPersistentType = getEntityMappings().addPersistentType(MappingKeys.ENTITY_TYPE_MAPPING_KEY, FULLY_QUALIFIED_TYPE_NAME);
- JavaPersistentType javaPersistentType = ormPersistentType.getJavaPersistentType();
-
- OrmPersistentAttribute ormPersistentAttribute = ormPersistentType.getAttributeNamed("id");
- JavaPersistentAttribute javaPersistentAttribute = javaPersistentType.getAttributeNamed("id");
-
- //virtual orm attribute, access type matches java : FIELD, name matches java
- assertTrue(ormPersistentAttribute.isVirtual());
- assertNotSame(javaPersistentAttribute, ormPersistentAttribute.getJavaPersistentAttribute());
- JavaResourcePersistentAttribute javaResourcePersistentAttribute = ormPersistentAttribute.getJavaPersistentAttribute().getResourcePersistentAttribute();
- assertTrue(javaResourcePersistentAttribute.isField());
- assertEquals("id", javaResourcePersistentAttribute.getName());
- assertEquals(javaPersistentType.getResourcePersistentType().persistableFields().next(), javaResourcePersistentAttribute);
-
-
- //specified orm attribute, access type matches java : FIELD, name matches java
- //javaPersistentAttribute should be == to java context model object
- ormPersistentAttribute.makeSpecified();
- ormPersistentAttribute = ormPersistentType.getAttributeNamed("id");
- assertFalse(ormPersistentAttribute.isVirtual());
- assertEquals(javaPersistentAttribute, ormPersistentAttribute.getJavaPersistentAttribute());
-
-
- //virtual orm attribute, java access type FIELD, orm access type PROPERTY, name matches java
- //verify the property java resource persistent attribute is used in orm.
- ormPersistentAttribute.makeVirtual();
- ormPersistentAttribute = ormPersistentType.getAttributeNamed("id");
- ormPersistentType.setSpecifiedAccess(AccessType.PROPERTY);
- assertNotSame(ormPersistentAttribute, ormPersistentType.getAttributeNamed("id"));
- ormPersistentAttribute = ormPersistentType.getAttributeNamed("id");
- assertNotSame(javaPersistentAttribute, ormPersistentAttribute.getJavaPersistentAttribute());
- javaResourcePersistentAttribute = ormPersistentAttribute.getJavaPersistentAttribute().getResourcePersistentAttribute();
- assertTrue(javaResourcePersistentAttribute.isProperty());
- assertEquals("id", javaResourcePersistentAttribute.getName());
- assertEquals(javaPersistentType.getResourcePersistentType().persistableProperties().next(), javaResourcePersistentAttribute);
-
-
- ormPersistentType.setSpecifiedAccess(null);//default access will be field
- ormPersistentAttribute = ormPersistentType.getAttributeNamed("id");
- ormPersistentAttribute.makeSpecified();
- ormPersistentAttribute = ormPersistentType.getAttributeNamed("id");
- ormPersistentAttribute.getMapping().setName("id2");
- assertEquals(null, ormPersistentAttribute.getJavaPersistentAttribute());
-
- ormPersistentAttribute.getMapping().setName(null);
- assertEquals(null, ormPersistentAttribute.getJavaPersistentAttribute());
-
- ormPersistentAttribute.getMapping().setName("id");
- assertEquals(javaPersistentAttribute, ormPersistentAttribute.getJavaPersistentAttribute());
-
-
- ormPersistentType.getMapping().setSpecifiedMetadataComplete(Boolean.TRUE);
- assertEquals(javaPersistentAttribute, ormPersistentAttribute.getJavaPersistentAttribute());
- }
-
-} \ No newline at end of file
diff --git a/jpa/tests/org.eclipse.jpt.eclipselink.core.tests/src/org/eclipse/jpt/eclipselink/core/tests/internal/context/orm/EclipseLinkOrmStructConverterTests.java b/jpa/tests/org.eclipse.jpt.eclipselink.core.tests/src/org/eclipse/jpt/eclipselink/core/tests/internal/context/orm/EclipseLinkOrmStructConverterTests.java
deleted file mode 100644
index 2c9379e229..0000000000
--- a/jpa/tests/org.eclipse.jpt.eclipselink.core.tests/src/org/eclipse/jpt/eclipselink/core/tests/internal/context/orm/EclipseLinkOrmStructConverterTests.java
+++ /dev/null
@@ -1,200 +0,0 @@
-/*******************************************************************************
- * Copyright (c) 2008, 2009 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.
- *
- * Contributors:
- * Oracle - initial API and implementation
- *******************************************************************************/
-package org.eclipse.jpt.eclipselink.core.tests.internal.context.orm;
-
-import java.util.Iterator;
-import org.eclipse.jdt.core.ICompilationUnit;
-import org.eclipse.jpt.core.MappingKeys;
-import org.eclipse.jpt.core.context.java.JavaBasicMapping;
-import org.eclipse.jpt.core.context.orm.OrmBasicMapping;
-import org.eclipse.jpt.core.context.orm.OrmPersistentAttribute;
-import org.eclipse.jpt.core.context.orm.OrmPersistentType;
-import org.eclipse.jpt.core.resource.java.JPA;
-import org.eclipse.jpt.eclipselink.core.context.Convert;
-import org.eclipse.jpt.eclipselink.core.context.EclipseLinkConverter;
-import org.eclipse.jpt.eclipselink.core.context.StructConverter;
-import org.eclipse.jpt.eclipselink.core.internal.context.orm.EclipseLinkOrmStructConverter;
-import org.eclipse.jpt.eclipselink.core.resource.java.EclipseLinkJPA;
-import org.eclipse.jpt.eclipselink.core.resource.orm.XmlBasic;
-import org.eclipse.jpt.eclipselink.core.resource.orm.XmlStructConverter;
-import org.eclipse.jpt.utility.internal.iterators.ArrayIterator;
-
-@SuppressWarnings("nls")
-public class EclipseLinkOrmStructConverterTests
- extends EclipseLinkOrmContextModelTestCase
-{
-
- private ICompilationUnit createTestEntityWithBasicMapping() throws Exception {
- return this.createTestType(new DefaultAnnotationWriter() {
- @Override
- public Iterator<String> imports() {
- return new ArrayIterator<String>(JPA.ENTITY, JPA.BASIC, EclipseLinkJPA.CONVERT, EclipseLinkJPA.STRUCT_CONVERTER);
- }
- @Override
- public void appendTypeAnnotationTo(StringBuilder sb) {
- sb.append("@Entity").append(CR);
- }
-
- @Override
- public void appendIdFieldAnnotationTo(StringBuilder sb) {
- sb.append("@Basic").append(CR);
- sb.append(" @Convert(name=\"foo\")").append(CR);
- sb.append(" @StructConverter");
- }
- });
- }
-
-
- public EclipseLinkOrmStructConverterTests(String name) {
- super(name);
- }
-
-
- public void testUpdateConverter() throws Exception {
- createTestEntityWithBasicMapping();
-
- OrmPersistentType ormPersistentType = getEntityMappings().addPersistentType(MappingKeys.ENTITY_TYPE_MAPPING_KEY, FULLY_QUALIFIED_TYPE_NAME);
- OrmPersistentAttribute ormPersistentAttribute = ormPersistentType.addSpecifiedPersistentAttribute(MappingKeys.BASIC_ATTRIBUTE_MAPPING_KEY, "id");
- OrmBasicMapping ormBasicMapping = (OrmBasicMapping) ormPersistentAttribute.getMapping();
- ormBasicMapping.setSpecifiedConverter(Convert.ECLIPSE_LINK_CONVERTER);
- ((Convert) ormBasicMapping.getConverter()).setConverter(EclipseLinkConverter.STRUCT_CONVERTER);
- StructConverter ormConverter = (StructConverter) ((Convert) ormBasicMapping.getConverter()).getConverter();
- XmlStructConverter converterResource = ((XmlBasic) getXmlEntityMappings().getEntities().get(0).getAttributes().getBasics().get(0)).getStructConverter();
- JavaBasicMapping javaBasicMapping = (JavaBasicMapping) ormPersistentType.getJavaPersistentType().getAttributeNamed("id").getMapping();
-
- assertEquals(null, ormConverter.getConverterClass());
- assertEquals(null, converterResource.getConverter());
-
- //set converter class name in the resource model, verify context model updated
- converterResource.setConverter("myConvert");
- assertEquals("myConvert", ormConverter.getConverterClass());
- assertEquals("myConvert", converterResource.getConverter());
-
- //set converter class name to null in the resource model
- converterResource.setConverter(null);
- assertEquals(null, ormConverter.getConverterClass());
- assertEquals(null, converterResource.getConverter());
-
-
- //remove the specified persistent attribute, test virtual mapping
- ormPersistentType.removeSpecifiedPersistentAttribute(ormPersistentAttribute);
-
- ormPersistentAttribute = ormPersistentType.virtualAttributes().next();
- ormBasicMapping = (OrmBasicMapping) ormPersistentAttribute.getMapping();
- ormConverter = (StructConverter) ((Convert) ormBasicMapping.getSpecifiedConverter()).getConverter();
-
- StructConverter javaConverter = ((StructConverter) ((Convert) javaBasicMapping.getSpecifiedConverter()).getConverter());
- javaConverter.setConverterClass("bar");
- assertEquals("bar", ormConverter.getConverterClass());
- assertEquals("bar", javaConverter.getConverterClass());
-
- //set metadata-complete, test virtual mapping
- ormPersistentType.getMapping().setSpecifiedMetadataComplete(Boolean.TRUE);
- ormPersistentAttribute = ormPersistentType.virtualAttributes().next();
- ormBasicMapping = (OrmBasicMapping) ormPersistentAttribute.getMapping();
- assertEquals(null, ormBasicMapping.getSpecifiedConverter());
- assertEquals(org.eclipse.jpt.core.context.Converter.NO_CONVERTER, ormBasicMapping.getConverter().getType());
- assertEquals("bar", javaConverter.getConverterClass());
- }
-
- public void testModifyConverter() throws Exception {
- OrmPersistentType ormPersistentType = getEntityMappings().addPersistentType(MappingKeys.ENTITY_TYPE_MAPPING_KEY, "model.Foo");
- OrmPersistentAttribute ormPersistentAttribute = ormPersistentType.addSpecifiedPersistentAttribute(MappingKeys.BASIC_ATTRIBUTE_MAPPING_KEY, "basicMapping");
- OrmBasicMapping ormBasicMapping = ((OrmBasicMapping) ormPersistentAttribute.getMapping());
- ormBasicMapping.setSpecifiedConverter(Convert.ECLIPSE_LINK_CONVERTER);
- ((Convert) ormBasicMapping.getConverter()).setConverter(EclipseLinkConverter.STRUCT_CONVERTER);
- StructConverter ormConverter = (StructConverter) ((Convert) ormBasicMapping.getConverter()).getConverter();
- XmlStructConverter converterResource = ((XmlBasic) getXmlEntityMappings().getEntities().get(0).getAttributes().getBasics().get(0)).getStructConverter();
-
- assertEquals(null, ormConverter.getConverterClass());
- assertEquals(null, converterResource.getConverter());
-
- //set converter class in the context model, verify resource model updated
- ormConverter.setConverterClass("foo");
- assertEquals("foo", ormConverter.getConverterClass());
- assertEquals("foo", converterResource.getConverter());
-
- ormConverter.setConverterClass(null);
- assertEquals(null, ormConverter.getConverterClass());
- assertEquals(null, converterResource.getConverter());
- }
-
- public void testUpdateName() throws Exception {
- createTestEntityWithBasicMapping();
-
- OrmPersistentType ormPersistentType = getEntityMappings().addPersistentType(MappingKeys.ENTITY_TYPE_MAPPING_KEY, FULLY_QUALIFIED_TYPE_NAME);
- OrmPersistentAttribute ormPersistentAttribute = ormPersistentType.addSpecifiedPersistentAttribute(MappingKeys.BASIC_ATTRIBUTE_MAPPING_KEY, "id");
- OrmBasicMapping ormBasicMapping = ((OrmBasicMapping) ormPersistentAttribute.getMapping());
- ormBasicMapping.setSpecifiedConverter(Convert.ECLIPSE_LINK_CONVERTER);
- ((Convert) ormBasicMapping.getConverter()).setConverter(EclipseLinkConverter.STRUCT_CONVERTER);
- EclipseLinkOrmStructConverter ormConverter = (EclipseLinkOrmStructConverter) ((Convert) ormBasicMapping.getConverter()).getConverter();
- XmlStructConverter converterResource = ((XmlBasic) getXmlEntityMappings().getEntities().get(0).getAttributes().getBasics().get(0)).getStructConverter();
- JavaBasicMapping javaBasicMapping = (JavaBasicMapping) ormPersistentType.getJavaPersistentType().getAttributeNamed("id").getMapping();
-
- assertEquals(null, ormConverter.getName());
- assertEquals(null, converterResource.getName());
-
- //set converter class name in the resource model, verify context model updated
- converterResource.setName("myConvert");
- assertEquals("myConvert", ormConverter.getName());
- assertEquals("myConvert", converterResource.getName());
-
- //set converter class name to null in the resource model
- converterResource.setName(null);
- assertEquals(null, ormConverter.getName());
- assertEquals(null, converterResource.getName());
-
-
- //remove the specified persistent attribute, test virtual mapping
-
- ormPersistentType.removeSpecifiedPersistentAttribute(ormPersistentAttribute);
-
- ormPersistentAttribute = ormPersistentType.virtualAttributes().next();
- ormBasicMapping = (OrmBasicMapping) ormPersistentAttribute.getMapping();
- ormConverter = (EclipseLinkOrmStructConverter) ((Convert) ormBasicMapping.getSpecifiedConverter()).getConverter();
-
- StructConverter javaConverter = ((StructConverter) ((Convert) javaBasicMapping.getSpecifiedConverter()).getConverter());
- javaConverter.setName("bar");
- assertEquals("bar", ormConverter.getName());
- assertEquals("bar", javaConverter.getName());
-
-
- //set metadata-complete, test virtual mapping
-
- ormPersistentType.getMapping().setSpecifiedMetadataComplete(Boolean.TRUE);
- ormPersistentAttribute = ormPersistentType.virtualAttributes().next();
- ormBasicMapping = (OrmBasicMapping) ormPersistentAttribute.getMapping();
- assertEquals(null, ormBasicMapping.getSpecifiedConverter());
- assertEquals(org.eclipse.jpt.core.context.Converter.NO_CONVERTER, ormBasicMapping.getConverter().getType());
- assertEquals("bar", javaConverter.getName());
- }
-
- public void testModifyName() throws Exception {
- OrmPersistentType ormPersistentType = getEntityMappings().addPersistentType(MappingKeys.ENTITY_TYPE_MAPPING_KEY, "model.Foo");
- OrmPersistentAttribute ormPersistentAttribute = ormPersistentType.addSpecifiedPersistentAttribute(MappingKeys.BASIC_ATTRIBUTE_MAPPING_KEY, "basicMapping");
- OrmBasicMapping ormBasicMapping = ((OrmBasicMapping) ormPersistentAttribute.getMapping());
- ormBasicMapping.setSpecifiedConverter(Convert.ECLIPSE_LINK_CONVERTER);
- ((Convert) ormBasicMapping.getConverter()).setConverter(EclipseLinkConverter.STRUCT_CONVERTER);
- EclipseLinkOrmStructConverter ormConverter = (EclipseLinkOrmStructConverter) ((Convert) ormBasicMapping.getConverter()).getConverter();
- XmlStructConverter converterResource = ((XmlBasic) getXmlEntityMappings().getEntities().get(0).getAttributes().getBasics().get(0)).getStructConverter();
-
- assertEquals(null, ormConverter.getName());
- assertEquals(null, converterResource.getName());
-
- //set converter class in the context model, verify resource model updated
- ormConverter.setName("foo");
- assertEquals("foo", ormConverter.getName());
- assertEquals("foo", converterResource.getName());
-
- ormConverter.setName(null);
- assertEquals(null, ormConverter.getName());
- assertEquals(null, converterResource.getName());
- }
-}
diff --git a/jpa/tests/org.eclipse.jpt.eclipselink.core.tests/src/org/eclipse/jpt/eclipselink/core/tests/internal/context/orm/EclipseLinkOrmTransientMappingTests.java b/jpa/tests/org.eclipse.jpt.eclipselink.core.tests/src/org/eclipse/jpt/eclipselink/core/tests/internal/context/orm/EclipseLinkOrmTransientMappingTests.java
deleted file mode 100644
index 582e7757e6..0000000000
--- a/jpa/tests/org.eclipse.jpt.eclipselink.core.tests/src/org/eclipse/jpt/eclipselink/core/tests/internal/context/orm/EclipseLinkOrmTransientMappingTests.java
+++ /dev/null
@@ -1,63 +0,0 @@
-/*******************************************************************************
- * Copyright (c) 2009 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.
- *
- * Contributors:
- * Oracle - initial API and implementation
- *******************************************************************************/
-package org.eclipse.jpt.eclipselink.core.tests.internal.context.orm;
-
-import java.util.Iterator;
-import org.eclipse.jdt.core.ICompilationUnit;
-import org.eclipse.jpt.core.MappingKeys;
-import org.eclipse.jpt.core.context.orm.OrmPersistentAttribute;
-import org.eclipse.jpt.core.context.orm.OrmPersistentType;
-import org.eclipse.jpt.core.resource.java.JPA;
-import org.eclipse.jpt.utility.internal.iterators.ArrayIterator;
-
-@SuppressWarnings("nls")
-public class EclipseLinkOrmTransientMappingTests
- extends EclipseLinkOrmContextModelTestCase
-{
- public EclipseLinkOrmTransientMappingTests(String name) {
- super(name);
- }
-
- private ICompilationUnit createTestEntityWithTransientMapping() throws Exception {
- return this.createTestType(new DefaultAnnotationWriter() {
- @Override
- public Iterator<String> imports() {
- return new ArrayIterator<String>(JPA.ENTITY, JPA.TRANSIENT);
- }
- @Override
- public void appendTypeAnnotationTo(StringBuilder sb) {
- sb.append("@Entity").append(CR);
- }
-
- @Override
- public void appendIdFieldAnnotationTo(StringBuilder sb) {
- sb.append("@Transient").append(CR);
- }
- });
- }
-
- public void testCreateTransientMapping() throws Exception {
- createTestEntityWithTransientMapping();
- OrmPersistentType ormPersistentType =
- getEntityMappings().addPersistentType(MappingKeys.ENTITY_TYPE_MAPPING_KEY, FULLY_QUALIFIED_TYPE_NAME);
-
- OrmPersistentAttribute persistentAttribute = ormPersistentType.getAttributeNamed("id");
- assertTrue(persistentAttribute.isVirtual());
- assertEquals(MappingKeys.TRANSIENT_ATTRIBUTE_MAPPING_KEY, persistentAttribute.getMappingKey());
-
- ormPersistentType.addSpecifiedPersistentAttribute(MappingKeys.TRANSIENT_ATTRIBUTE_MAPPING_KEY, "id");
-
- persistentAttribute = ormPersistentType.getAttributeNamed("id");
- assertFalse(persistentAttribute.isVirtual());
- assertEquals(MappingKeys.TRANSIENT_ATTRIBUTE_MAPPING_KEY, persistentAttribute.getMappingKey());
- assertEquals(MappingKeys.TRANSIENT_ATTRIBUTE_MAPPING_KEY, persistentAttribute.getSpecifiedMapping().getKey());
- }
-
-}
diff --git a/jpa/tests/org.eclipse.jpt.eclipselink.core.tests/src/org/eclipse/jpt/eclipselink/core/tests/internal/context/orm/EclipseLinkOrmTypeConverterTests.java b/jpa/tests/org.eclipse.jpt.eclipselink.core.tests/src/org/eclipse/jpt/eclipselink/core/tests/internal/context/orm/EclipseLinkOrmTypeConverterTests.java
deleted file mode 100644
index 0d7560f44f..0000000000
--- a/jpa/tests/org.eclipse.jpt.eclipselink.core.tests/src/org/eclipse/jpt/eclipselink/core/tests/internal/context/orm/EclipseLinkOrmTypeConverterTests.java
+++ /dev/null
@@ -1,269 +0,0 @@
-/*******************************************************************************
- * Copyright (c) 2008, 2009 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.
- *
- * Contributors:
- * Oracle - initial API and implementation
- *******************************************************************************/
-package org.eclipse.jpt.eclipselink.core.tests.internal.context.orm;
-
-import java.util.Iterator;
-import org.eclipse.jdt.core.ICompilationUnit;
-import org.eclipse.jpt.core.MappingKeys;
-import org.eclipse.jpt.core.context.java.JavaBasicMapping;
-import org.eclipse.jpt.core.context.orm.OrmBasicMapping;
-import org.eclipse.jpt.core.context.orm.OrmPersistentAttribute;
-import org.eclipse.jpt.core.context.orm.OrmPersistentType;
-import org.eclipse.jpt.core.resource.java.JPA;
-import org.eclipse.jpt.eclipselink.core.context.Convert;
-import org.eclipse.jpt.eclipselink.core.context.EclipseLinkConverter;
-import org.eclipse.jpt.eclipselink.core.context.TypeConverter;
-import org.eclipse.jpt.eclipselink.core.internal.context.orm.EclipseLinkOrmTypeConverter;
-import org.eclipse.jpt.eclipselink.core.resource.java.EclipseLinkJPA;
-import org.eclipse.jpt.eclipselink.core.resource.orm.XmlBasic;
-import org.eclipse.jpt.eclipselink.core.resource.orm.XmlTypeConverter;
-import org.eclipse.jpt.utility.internal.iterators.ArrayIterator;
-
-@SuppressWarnings("nls")
-public class EclipseLinkOrmTypeConverterTests
- extends EclipseLinkOrmContextModelTestCase
-{
-
- private ICompilationUnit createTestEntityWithBasicMapping() throws Exception {
- return this.createTestType(new DefaultAnnotationWriter() {
- @Override
- public Iterator<String> imports() {
- return new ArrayIterator<String>(JPA.ENTITY, JPA.BASIC, EclipseLinkJPA.CONVERT, EclipseLinkJPA.TYPE_CONVERTER);
- }
- @Override
- public void appendTypeAnnotationTo(StringBuilder sb) {
- sb.append("@Entity").append(CR);
- }
-
- @Override
- public void appendIdFieldAnnotationTo(StringBuilder sb) {
- sb.append("@Basic").append(CR);
- sb.append(" @Convert(name=\"foo\")").append(CR);
- sb.append(" @TypeConverter");
- }
- });
- }
-
-
- public EclipseLinkOrmTypeConverterTests(String name) {
- super(name);
- }
-
-
- public void testUpdateDataType() throws Exception {
- createTestEntityWithBasicMapping();
-
- OrmPersistentType ormPersistentType = getEntityMappings().addPersistentType(MappingKeys.ENTITY_TYPE_MAPPING_KEY, FULLY_QUALIFIED_TYPE_NAME);
- OrmPersistentAttribute ormPersistentAttribute = ormPersistentType.addSpecifiedPersistentAttribute(MappingKeys.BASIC_ATTRIBUTE_MAPPING_KEY, "id");
- OrmBasicMapping ormBasicMapping = (OrmBasicMapping) ormPersistentAttribute.getMapping();
- ormBasicMapping.setSpecifiedConverter(Convert.ECLIPSE_LINK_CONVERTER);
- ((Convert) ormBasicMapping.getConverter()).setConverter(EclipseLinkConverter.TYPE_CONVERTER);
- TypeConverter ormConverter = (TypeConverter) ((Convert) ormBasicMapping.getConverter()).getConverter();
- XmlTypeConverter converterResource = ((XmlBasic) getXmlEntityMappings().getEntities().get(0).getAttributes().getBasics().get(0)).getTypeConverter();
- JavaBasicMapping javaBasicMapping = (JavaBasicMapping) ormPersistentType.getJavaPersistentType().getAttributeNamed("id").getMapping();
-
- assertEquals(null, ormConverter.getDataType());
- assertEquals(null, converterResource.getDataType());
-
- //set converter class name in the resource model, verify context model updated
- converterResource.setDataType("myConvert");
- assertEquals("myConvert", ormConverter.getDataType());
- assertEquals("myConvert", converterResource.getDataType());
-
- //set converter class name to null in the resource model
- converterResource.setDataType(null);
- assertEquals(null, ormConverter.getDataType());
- assertEquals(null, converterResource.getDataType());
-
-
- //remove the specified persistent attribute, test virtual mapping
- ormPersistentType.removeSpecifiedPersistentAttribute(ormPersistentAttribute);
-
- ormPersistentAttribute = ormPersistentType.virtualAttributes().next();
- ormBasicMapping = (OrmBasicMapping) ormPersistentAttribute.getMapping();
- ormConverter = (TypeConverter) ((Convert) ormBasicMapping.getSpecifiedConverter()).getConverter();
-
- TypeConverter javaConverter = ((TypeConverter) ((Convert) javaBasicMapping.getSpecifiedConverter()).getConverter());
- javaConverter.setDataType("bar");
- assertEquals("bar", ormConverter.getDataType());
- assertEquals("bar", javaConverter.getDataType());
-
- //set metadata-complete, test virtual mapping
- ormPersistentType.getMapping().setSpecifiedMetadataComplete(Boolean.TRUE);
- ormPersistentAttribute = ormPersistentType.virtualAttributes().next();
- ormBasicMapping = (OrmBasicMapping) ormPersistentAttribute.getMapping();
- assertEquals(null, ormBasicMapping.getSpecifiedConverter());
- assertEquals(org.eclipse.jpt.core.context.Converter.NO_CONVERTER, ormBasicMapping.getConverter().getType());
- assertEquals("bar", javaConverter.getDataType());
- }
-
- public void testModifyDataType() throws Exception {
- OrmPersistentType ormPersistentType = getEntityMappings().addPersistentType(MappingKeys.ENTITY_TYPE_MAPPING_KEY, "model.Foo");
- OrmPersistentAttribute ormPersistentAttribute = ormPersistentType.addSpecifiedPersistentAttribute(MappingKeys.BASIC_ATTRIBUTE_MAPPING_KEY, "basicMapping");
- OrmBasicMapping ormBasicMapping = ((OrmBasicMapping) ormPersistentAttribute.getMapping());
- ormBasicMapping.setSpecifiedConverter(Convert.ECLIPSE_LINK_CONVERTER);
- ((Convert) ormBasicMapping.getConverter()).setConverter(EclipseLinkConverter.TYPE_CONVERTER);
- TypeConverter ormConverter = (TypeConverter) ((Convert) ormBasicMapping.getConverter()).getConverter();
- XmlTypeConverter converterResource = ((XmlBasic) getXmlEntityMappings().getEntities().get(0).getAttributes().getBasics().get(0)).getTypeConverter();
-
- assertEquals(null, ormConverter.getDataType());
- assertEquals(null, converterResource.getDataType());
-
- //set converter class in the context model, verify resource model updated
- ormConverter.setDataType("foo");
- assertEquals("foo", ormConverter.getDataType());
- assertEquals("foo", converterResource.getDataType());
-
- ormConverter.setDataType(null);
- assertEquals(null, ormConverter.getDataType());
- assertEquals(null, converterResource.getDataType());
- }
-
- public void testUpdateObjectType() throws Exception {
- createTestEntityWithBasicMapping();
-
- OrmPersistentType ormPersistentType = getEntityMappings().addPersistentType(MappingKeys.ENTITY_TYPE_MAPPING_KEY, FULLY_QUALIFIED_TYPE_NAME);
- OrmPersistentAttribute ormPersistentAttribute = ormPersistentType.addSpecifiedPersistentAttribute(MappingKeys.BASIC_ATTRIBUTE_MAPPING_KEY, "id");
- OrmBasicMapping ormBasicMapping = (OrmBasicMapping) ormPersistentAttribute.getMapping();
- ormBasicMapping.setSpecifiedConverter(Convert.ECLIPSE_LINK_CONVERTER);
- ((Convert) ormBasicMapping.getConverter()).setConverter(EclipseLinkConverter.TYPE_CONVERTER);
- TypeConverter ormConverter = (TypeConverter) ((Convert) ormBasicMapping.getConverter()).getConverter();
- XmlTypeConverter converterResource = ((XmlBasic) getXmlEntityMappings().getEntities().get(0).getAttributes().getBasics().get(0)).getTypeConverter();
- JavaBasicMapping javaBasicMapping = (JavaBasicMapping) ormPersistentType.getJavaPersistentType().getAttributeNamed("id").getMapping();
-
- assertEquals(null, ormConverter.getObjectType());
- assertEquals(null, converterResource.getObjectType());
-
- //set converter class name in the resource model, verify context model updated
- converterResource.setObjectType("myConvert");
- assertEquals("myConvert", ormConverter.getObjectType());
- assertEquals("myConvert", converterResource.getObjectType());
-
- //set converter class name to null in the resource model
- converterResource.setObjectType(null);
- assertEquals(null, ormConverter.getObjectType());
- assertEquals(null, converterResource.getObjectType());
-
-
- //remove the specified persistent attribute, test virtual mapping
- ormPersistentType.removeSpecifiedPersistentAttribute(ormPersistentAttribute);
-
- ormPersistentAttribute = ormPersistentType.virtualAttributes().next();
- ormBasicMapping = (OrmBasicMapping) ormPersistentAttribute.getMapping();
- ormConverter = (TypeConverter) ((Convert) ormBasicMapping.getSpecifiedConverter()).getConverter();
-
- TypeConverter javaConverter = ((TypeConverter) ((Convert) javaBasicMapping.getSpecifiedConverter()).getConverter());
- javaConverter.setObjectType("bar");
- assertEquals("bar", ormConverter.getObjectType());
- assertEquals("bar", javaConverter.getObjectType());
-
- //set metadata-complete, test virtual mapping
- ormPersistentType.getMapping().setSpecifiedMetadataComplete(Boolean.TRUE);
- ormPersistentAttribute = ormPersistentType.virtualAttributes().next();
- ormBasicMapping = (OrmBasicMapping) ormPersistentAttribute.getMapping();
- assertEquals(null, ormBasicMapping.getSpecifiedConverter());
- assertEquals(org.eclipse.jpt.core.context.Converter.NO_CONVERTER, ormBasicMapping.getConverter().getType());
- assertEquals("bar", javaConverter.getObjectType());
- }
-
- public void testModifyObjectType() throws Exception {
- OrmPersistentType ormPersistentType = getEntityMappings().addPersistentType(MappingKeys.ENTITY_TYPE_MAPPING_KEY, "model.Foo");
- OrmPersistentAttribute ormPersistentAttribute = ormPersistentType.addSpecifiedPersistentAttribute(MappingKeys.BASIC_ATTRIBUTE_MAPPING_KEY, "basicMapping");
- OrmBasicMapping ormBasicMapping = ((OrmBasicMapping) ormPersistentAttribute.getMapping());
- ormBasicMapping.setSpecifiedConverter(Convert.ECLIPSE_LINK_CONVERTER);
- ((Convert) ormBasicMapping.getConverter()).setConverter(EclipseLinkConverter.TYPE_CONVERTER);
- TypeConverter ormConverter = (TypeConverter) ((Convert) ormBasicMapping.getConverter()).getConverter();
- XmlTypeConverter converterResource = ((XmlBasic) getXmlEntityMappings().getEntities().get(0).getAttributes().getBasics().get(0)).getTypeConverter();
-
- assertEquals(null, ormConverter.getObjectType());
- assertEquals(null, converterResource.getObjectType());
-
- //set converter class in the context model, verify resource model updated
- ormConverter.setObjectType("foo");
- assertEquals("foo", ormConverter.getObjectType());
- assertEquals("foo", converterResource.getObjectType());
-
- ormConverter.setObjectType(null);
- assertEquals(null, ormConverter.getObjectType());
- assertEquals(null, converterResource.getObjectType());
- }
-
- public void testUpdateName() throws Exception {
- createTestEntityWithBasicMapping();
-
- OrmPersistentType ormPersistentType = getEntityMappings().addPersistentType(MappingKeys.ENTITY_TYPE_MAPPING_KEY, FULLY_QUALIFIED_TYPE_NAME);
- OrmPersistentAttribute ormPersistentAttribute = ormPersistentType.addSpecifiedPersistentAttribute(MappingKeys.BASIC_ATTRIBUTE_MAPPING_KEY, "id");
- OrmBasicMapping ormBasicMapping = ((OrmBasicMapping) ormPersistentAttribute.getMapping());
- ormBasicMapping.setSpecifiedConverter(Convert.ECLIPSE_LINK_CONVERTER);
- ((Convert) ormBasicMapping.getConverter()).setConverter(EclipseLinkConverter.TYPE_CONVERTER);
- EclipseLinkOrmTypeConverter ormConverter = (EclipseLinkOrmTypeConverter) ((Convert) ormBasicMapping.getConverter()).getConverter();
- XmlTypeConverter converterResource = ((XmlBasic) getXmlEntityMappings().getEntities().get(0).getAttributes().getBasics().get(0)).getTypeConverter();
- JavaBasicMapping javaBasicMapping = (JavaBasicMapping) ormPersistentType.getJavaPersistentType().getAttributeNamed("id").getMapping();
-
- assertEquals(null, ormConverter.getName());
- assertEquals(null, converterResource.getName());
-
- //set converter class name in the resource model, verify context model updated
- converterResource.setName("myConvert");
- assertEquals("myConvert", ormConverter.getName());
- assertEquals("myConvert", converterResource.getName());
-
- //set converter class name to null in the resource model
- converterResource.setName(null);
- assertEquals(null, ormConverter.getName());
- assertEquals(null, converterResource.getName());
-
-
- //remove the specified persistent attribute, test virtual mapping
-
- ormPersistentType.removeSpecifiedPersistentAttribute(ormPersistentAttribute);
-
- ormPersistentAttribute = ormPersistentType.virtualAttributes().next();
- ormBasicMapping = (OrmBasicMapping) ormPersistentAttribute.getMapping();
- ormConverter = (EclipseLinkOrmTypeConverter) ((Convert) ormBasicMapping.getSpecifiedConverter()).getConverter();
-
- TypeConverter javaConverter = ((TypeConverter) ((Convert) javaBasicMapping.getSpecifiedConverter()).getConverter());
- javaConverter.setName("bar");
- assertEquals("bar", ormConverter.getName());
- assertEquals("bar", javaConverter.getName());
-
-
- //set metadata-complete, test virtual mapping
-
- ormPersistentType.getMapping().setSpecifiedMetadataComplete(Boolean.TRUE);
- ormPersistentAttribute = ormPersistentType.virtualAttributes().next();
- ormBasicMapping = (OrmBasicMapping) ormPersistentAttribute.getMapping();
- assertEquals(null, ormBasicMapping.getSpecifiedConverter());
- assertEquals(org.eclipse.jpt.core.context.Converter.NO_CONVERTER, ormBasicMapping.getConverter().getType());
- assertEquals("bar", javaConverter.getName());
- }
-
- public void testModifyName() throws Exception {
- OrmPersistentType ormPersistentType = getEntityMappings().addPersistentType(MappingKeys.ENTITY_TYPE_MAPPING_KEY, "model.Foo");
- OrmPersistentAttribute ormPersistentAttribute = ormPersistentType.addSpecifiedPersistentAttribute(MappingKeys.BASIC_ATTRIBUTE_MAPPING_KEY, "basicMapping");
- OrmBasicMapping ormBasicMapping = ((OrmBasicMapping) ormPersistentAttribute.getMapping());
- ormBasicMapping.setSpecifiedConverter(Convert.ECLIPSE_LINK_CONVERTER);
- ((Convert) ormBasicMapping.getConverter()).setConverter(EclipseLinkConverter.TYPE_CONVERTER);
- EclipseLinkOrmTypeConverter ormConverter = (EclipseLinkOrmTypeConverter) ((Convert) ormBasicMapping.getConverter()).getConverter();
- XmlTypeConverter converterResource = ((XmlBasic) getXmlEntityMappings().getEntities().get(0).getAttributes().getBasics().get(0)).getTypeConverter();
-
- assertEquals(null, ormConverter.getName());
- assertEquals(null, converterResource.getName());
-
- //set converter class in the context model, verify resource model updated
- ormConverter.setName("foo");
- assertEquals("foo", ormConverter.getName());
- assertEquals("foo", converterResource.getName());
-
- ormConverter.setName(null);
- assertEquals(null, ormConverter.getName());
- assertEquals(null, converterResource.getName());
- }
-}
diff --git a/jpa/tests/org.eclipse.jpt.eclipselink.core.tests/src/org/eclipse/jpt/eclipselink/core/tests/internal/context/orm/EclipseLinkOrmVersionMappingTests.java b/jpa/tests/org.eclipse.jpt.eclipselink.core.tests/src/org/eclipse/jpt/eclipselink/core/tests/internal/context/orm/EclipseLinkOrmVersionMappingTests.java
deleted file mode 100644
index f21ca8ca6d..0000000000
--- a/jpa/tests/org.eclipse.jpt.eclipselink.core.tests/src/org/eclipse/jpt/eclipselink/core/tests/internal/context/orm/EclipseLinkOrmVersionMappingTests.java
+++ /dev/null
@@ -1,388 +0,0 @@
-/*******************************************************************************
- * Copyright (c) 2008, 2009 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.
- *
- * Contributors:
- * Oracle - initial API and implementation
- *******************************************************************************/
-package org.eclipse.jpt.eclipselink.core.tests.internal.context.orm;
-
-import java.util.Iterator;
-import org.eclipse.jdt.core.ICompilationUnit;
-import org.eclipse.jpt.core.MappingKeys;
-import org.eclipse.jpt.core.context.Converter;
-import org.eclipse.jpt.core.context.java.JavaVersionMapping;
-import org.eclipse.jpt.core.context.orm.OrmPersistentAttribute;
-import org.eclipse.jpt.core.context.orm.OrmPersistentType;
-import org.eclipse.jpt.core.context.orm.OrmVersionMapping;
-import org.eclipse.jpt.core.resource.java.JPA;
-import org.eclipse.jpt.eclipselink.core.context.Convert;
-import org.eclipse.jpt.eclipselink.core.context.EclipseLinkVersionMapping;
-import org.eclipse.jpt.eclipselink.core.internal.context.orm.EclipseLinkOrmBasicMapping;
-import org.eclipse.jpt.eclipselink.core.internal.context.orm.EclipseLinkOrmVersionMapping;
-import org.eclipse.jpt.eclipselink.core.resource.java.EclipseLinkJPA;
-import org.eclipse.jpt.eclipselink.core.resource.orm.XmlEntity;
-import org.eclipse.jpt.eclipselink.core.resource.orm.XmlVersion;
-import org.eclipse.jpt.utility.internal.iterators.ArrayIterator;
-
-@SuppressWarnings("nls")
-public class EclipseLinkOrmVersionMappingTests
- extends EclipseLinkOrmContextModelTestCase
-{
- public EclipseLinkOrmVersionMappingTests(String name) {
- super(name);
- }
-
- private ICompilationUnit createTestEntityWithVersionMapping() throws Exception {
- return this.createTestType(new DefaultAnnotationWriter() {
- @Override
- public Iterator<String> imports() {
- return new ArrayIterator<String>(JPA.ENTITY, JPA.VERSION);
- }
- @Override
- public void appendTypeAnnotationTo(StringBuilder sb) {
- sb.append("@Entity").append(CR);
- }
-
- @Override
- public void appendIdFieldAnnotationTo(StringBuilder sb) {
- sb.append("@Version").append(CR);
- }
- });
- }
-
- private ICompilationUnit createTestEntityWithMutableVersionDate() throws Exception {
- return this.createTestType(new DefaultAnnotationWriter() {
- @Override
- public Iterator<String> imports() {
- return new ArrayIterator<String>(JPA.ENTITY, JPA.VERSION, EclipseLinkJPA.MUTABLE, "java.util.Date");
- }
- @Override
- public void appendTypeAnnotationTo(StringBuilder sb) {
- sb.append("@Entity").append(CR);
- }
-
- @Override
- public void appendIdFieldAnnotationTo(StringBuilder sb) {
- sb.append("@Version").append(CR);
- sb.append(" @Mutable").append(CR);
- sb.append(" private Date myDate;").append(CR);
- sb.append(CR);
- sb.append(" ");
- }
- });
- }
-
- public void testUpdateMutable() throws Exception {
- createTestEntityWithVersionMapping();
- OrmPersistentType ormPersistentType =
- getEntityMappings().addPersistentType(MappingKeys.ENTITY_TYPE_MAPPING_KEY, FULLY_QUALIFIED_TYPE_NAME);
- OrmPersistentAttribute ormPersistentAttribute =
- ormPersistentType.addSpecifiedPersistentAttribute(MappingKeys.VERSION_ATTRIBUTE_MAPPING_KEY, "id");
- EclipseLinkOrmVersionMapping contextVersion =
- (EclipseLinkOrmVersionMapping) ormPersistentAttribute.getMapping();
- XmlEntity resourceEntity =
- (XmlEntity)getXmlEntityMappings().getEntities().get(0);
- XmlVersion resourceVersion =
- (XmlVersion) resourceEntity.getAttributes().getVersions().get(0);
- EclipseLinkVersionMapping javaVersionMapping = (EclipseLinkVersionMapping) ormPersistentType.getJavaPersistentType().getAttributeNamed("id").getMapping();
-
- // check defaults
-
- assertNull(resourceVersion.getMutable());
- assertTrue(contextVersion.getMutable().isDefaultMutable());
- assertNull(contextVersion.getMutable().getSpecifiedMutable());
- assertTrue(contextVersion.getMutable().isMutable());
-
- // set xml mutable to false, check context
-
- resourceVersion.setMutable(Boolean.FALSE);
-
- assertEquals(Boolean.FALSE, resourceVersion.getMutable());
- assertTrue(contextVersion.getMutable().isDefaultMutable());
- assertEquals(Boolean.FALSE, contextVersion.getMutable().getSpecifiedMutable());
- assertFalse(contextVersion.getMutable().isMutable());
-
- // set xml mutable to true, check context
-
- resourceVersion.setMutable(Boolean.TRUE);
-
- assertEquals(Boolean.TRUE, resourceVersion.getMutable());
- assertTrue(contextVersion.getMutable().isDefaultMutable());
- assertEquals(Boolean.TRUE, contextVersion.getMutable().getSpecifiedMutable());
- assertTrue(contextVersion.getMutable().isMutable());
-
- // clear xml mutable, check context
-
- resourceVersion.setMutable(null);
-
- assertNull(resourceVersion.getMutable());
- assertTrue(contextVersion.getMutable().isDefaultMutable());
- assertNull(contextVersion.getMutable().getSpecifiedMutable());
- assertTrue(contextVersion.getMutable().isMutable());
-
- // TODO - test defaults for java serializable and date/time types,
- // with and without persistence property
-
- // set mutable on java basic mapping
-
- javaVersionMapping.getMutable().setSpecifiedMutable(Boolean.FALSE);
- assertNull(resourceVersion.getMutable());
- assertTrue(contextVersion.getMutable().isDefaultMutable());
- assertNull(contextVersion.getMutable().getSpecifiedMutable());
- assertTrue(contextVersion.getMutable().isMutable());
- assertFalse(javaVersionMapping.getMutable().isMutable());
-
- // remove attribute from xml, test default mutable from java
-
- ormPersistentType.removeSpecifiedPersistentAttribute(ormPersistentAttribute);
- ormPersistentAttribute = ormPersistentType.virtualAttributes().next();
- contextVersion = (EclipseLinkOrmVersionMapping) ormPersistentAttribute.getMapping();
-
- assertNull(resourceVersion.getMutable());
- assertTrue(contextVersion.getMutable().isDefaultMutable());
- assertEquals(Boolean.FALSE, contextVersion.getMutable().getSpecifiedMutable());
- assertFalse(contextVersion.getMutable().isMutable());
- assertFalse(javaVersionMapping.getMutable().isMutable());
-
- // set metadata complete
- ormPersistentType.getMapping().setSpecifiedMetadataComplete(Boolean.TRUE);
- ormPersistentAttribute = ormPersistentType.virtualAttributes().next();
- EclipseLinkOrmBasicMapping contextBasic = (EclipseLinkOrmBasicMapping) ormPersistentAttribute.getMapping();
- assertNull(resourceVersion.getMutable());
- assertTrue(contextBasic.getMutable().isDefaultMutable());
- assertEquals(Boolean.TRUE, contextBasic.getMutable().getSpecifiedMutable());
- assertTrue(contextBasic.getMutable().isMutable());
- assertFalse(javaVersionMapping.getMutable().isMutable());
- }
-
- public void testUpdateMutableDate() throws Exception {
- createTestEntityWithMutableVersionDate();
- OrmPersistentType ormPersistentType =
- getEntityMappings().addPersistentType(MappingKeys.ENTITY_TYPE_MAPPING_KEY, FULLY_QUALIFIED_TYPE_NAME);
- OrmPersistentAttribute ormPersistentAttribute =
- ormPersistentType.addSpecifiedPersistentAttribute(MappingKeys.VERSION_ATTRIBUTE_MAPPING_KEY, "myDate");
- EclipseLinkOrmVersionMapping contextVersion =
- (EclipseLinkOrmVersionMapping) ormPersistentAttribute.getMapping();
- XmlEntity resourceEntity =
- (XmlEntity)getXmlEntityMappings().getEntities().get(0);
- XmlVersion resourceVersion =
- (XmlVersion) resourceEntity.getAttributes().getVersions().get(0);
- EclipseLinkVersionMapping javaVersionMapping = (EclipseLinkVersionMapping) ormPersistentType.getJavaPersistentType().getAttributeNamed("myDate").getMapping();
-
- // check defaults
-
- assertNull(resourceVersion.getMutable());
- assertFalse(contextVersion.getMutable().isDefaultMutable());
- assertNull(contextVersion.getMutable().getSpecifiedMutable());
- assertFalse(contextVersion.getMutable().isMutable());
-
- // set xml mutable to false, check context
-
- resourceVersion.setMutable(Boolean.FALSE);
-
- assertEquals(Boolean.FALSE, resourceVersion.getMutable());
- assertFalse(contextVersion.getMutable().isDefaultMutable());
- assertEquals(Boolean.FALSE, contextVersion.getMutable().getSpecifiedMutable());
- assertFalse(contextVersion.getMutable().isMutable());
-
- // set xml mutable to true, check context
-
- resourceVersion.setMutable(Boolean.TRUE);
-
- assertEquals(Boolean.TRUE, resourceVersion.getMutable());
- assertFalse(contextVersion.getMutable().isDefaultMutable());
- assertEquals(Boolean.TRUE, contextVersion.getMutable().getSpecifiedMutable());
- assertTrue(contextVersion.getMutable().isMutable());
-
- // clear xml mutable, check context
-
- resourceVersion.setMutable(null);
-
- assertNull(resourceVersion.getMutable());
- assertFalse(contextVersion.getMutable().isDefaultMutable());
- assertNull(contextVersion.getMutable().getSpecifiedMutable());
- assertFalse(contextVersion.getMutable().isMutable());
-
-
- getPersistenceUnit().getOptions().setTemporalMutable(Boolean.TRUE);
- assertNull(resourceVersion.getMutable());
- assertTrue(contextVersion.getMutable().isDefaultMutable());
- assertNull(contextVersion.getMutable().getSpecifiedMutable());
- assertTrue(contextVersion.getMutable().isMutable());
-
- getPersistenceUnit().getOptions().setTemporalMutable(Boolean.FALSE);
- assertNull(resourceVersion.getMutable());
- assertFalse(contextVersion.getMutable().isDefaultMutable());
- assertNull(contextVersion.getMutable().getSpecifiedMutable());
- assertFalse(contextVersion.getMutable().isMutable());
-
- getPersistenceUnit().getOptions().setTemporalMutable(null);
- assertNull(resourceVersion.getMutable());
- assertFalse(contextVersion.getMutable().isDefaultMutable());
- assertNull(contextVersion.getMutable().getSpecifiedMutable());
- assertFalse(contextVersion.getMutable().isMutable());
-
- // set mutable on java version mapping
-
- javaVersionMapping.getMutable().setSpecifiedMutable(Boolean.TRUE);
- assertNull(resourceVersion.getMutable());
- assertFalse(contextVersion.getMutable().isDefaultMutable());
- assertNull(contextVersion.getMutable().getSpecifiedMutable());
- assertFalse(contextVersion.getMutable().isMutable());
- assertTrue(javaVersionMapping.getMutable().isMutable());
-
- // remove attribute from xml, test default mutable from java
-
- ormPersistentType.removeSpecifiedPersistentAttribute(ormPersistentAttribute);
- ormPersistentAttribute = ormPersistentType.virtualAttributes().next();
- contextVersion = (EclipseLinkOrmVersionMapping) ormPersistentAttribute.getMapping();
-
- assertNull(resourceVersion.getMutable());
- assertFalse(contextVersion.getMutable().isDefaultMutable());
- assertEquals(Boolean.TRUE, contextVersion.getMutable().getSpecifiedMutable());
- assertTrue(contextVersion.getMutable().isMutable());
- assertTrue(javaVersionMapping.getMutable().isMutable());
-
- // set metadata complete
- ormPersistentType.getMapping().setSpecifiedMetadataComplete(Boolean.TRUE);
- ormPersistentAttribute = ormPersistentType.virtualAttributes().next();
- EclipseLinkOrmBasicMapping contextBasic = (EclipseLinkOrmBasicMapping) ormPersistentAttribute.getMapping();
- assertNull(resourceVersion.getMutable());
- assertFalse(contextBasic.getMutable().isDefaultMutable());
- assertEquals(Boolean.FALSE, contextBasic.getMutable().getSpecifiedMutable());
- assertFalse(contextBasic.getMutable().isMutable());
- assertTrue(javaVersionMapping.getMutable().isMutable());
- }
-
- public void testModifyMutable() throws Exception {
- OrmPersistentType ormPersistentType =
- getEntityMappings().addPersistentType(MappingKeys.ENTITY_TYPE_MAPPING_KEY, FULLY_QUALIFIED_TYPE_NAME);
- OrmPersistentAttribute ormPersistentAttribute =
- ormPersistentType.addSpecifiedPersistentAttribute(MappingKeys.VERSION_ATTRIBUTE_MAPPING_KEY, "basic");
- EclipseLinkOrmVersionMapping contextVersion =
- (EclipseLinkOrmVersionMapping) ormPersistentAttribute.getMapping();
- XmlEntity resourceEntity =
- (XmlEntity)getXmlEntityMappings().getEntities().get(0);
- XmlVersion resourceVersion =
- (XmlVersion) resourceEntity.getAttributes().getVersions().get(0);
-
- // check defaults
-
- assertNull(resourceVersion.getMutable());
- assertFalse(contextVersion.getMutable().isDefaultMutable());
- assertNull(contextVersion.getMutable().getSpecifiedMutable());
- assertFalse(contextVersion.getMutable().isMutable());
-
- // set context mutable to true, check resource
-
- contextVersion.getMutable().setSpecifiedMutable(Boolean.TRUE);
-
- assertEquals(Boolean.TRUE, resourceVersion.getMutable());
- assertFalse(contextVersion.getMutable().isDefaultMutable());
- assertEquals(Boolean.TRUE, contextVersion.getMutable().getSpecifiedMutable());
- assertTrue(contextVersion.getMutable().isMutable());
-
- // set context mutable to false, check resource
-
- contextVersion.getMutable().setSpecifiedMutable(Boolean.FALSE);
-
- assertEquals(Boolean.FALSE, resourceVersion.getMutable());
- assertFalse(contextVersion.getMutable().isDefaultMutable());
- assertEquals(Boolean.FALSE, contextVersion.getMutable().getSpecifiedMutable());
- assertFalse(contextVersion.getMutable().isMutable());
-
- // set context read only to null, check resource
-
- contextVersion.getMutable().setSpecifiedMutable(null);
-
- assertNull(resourceVersion.getMutable());
- assertFalse(contextVersion.getMutable().isDefaultMutable());
- assertNull(contextVersion.getMutable().getSpecifiedMutable());
- assertFalse(contextVersion.getMutable().isMutable());
- }
-
- public void testUpdateConvert() throws Exception {
- createTestEntityWithVersionMapping();
-
- OrmPersistentType ormPersistentType = getEntityMappings().addPersistentType(MappingKeys.ENTITY_TYPE_MAPPING_KEY, FULLY_QUALIFIED_TYPE_NAME);
- OrmPersistentAttribute ormPersistentAttribute = ormPersistentType.addSpecifiedPersistentAttribute(MappingKeys.VERSION_ATTRIBUTE_MAPPING_KEY, "id");
- OrmVersionMapping ormVersionMapping = (OrmVersionMapping) ormPersistentAttribute.getMapping();
- XmlVersion basicResource = (XmlVersion) getXmlEntityMappings().getEntities().get(0).getAttributes().getVersions().get(0);
- JavaVersionMapping javaVersionMapping = (JavaVersionMapping) ormPersistentType.getJavaPersistentType().getAttributeNamed("id").getMapping();
-
- assertEquals(null, ormVersionMapping.getSpecifiedConverter());
- assertEquals(null, basicResource.getConvert());
-
- //set lob in the resource model, verify context model updated
- basicResource.setConvert("myConvert");
- assertEquals(Convert.ECLIPSE_LINK_CONVERTER, ormVersionMapping.getConverter().getType());
- assertEquals("myConvert", basicResource.getConvert());
-
- //set lob to null in the resource model
- basicResource.setConvert(null);
- assertEquals(null, ormVersionMapping.getSpecifiedConverter());
- assertEquals(null, basicResource.getConvert());
-
-
- javaVersionMapping.setSpecifiedConverter(Convert.ECLIPSE_LINK_CONVERTER);
- ((Convert) javaVersionMapping.getSpecifiedConverter()).setSpecifiedConverterName("foo");
-
- assertEquals(null, ormVersionMapping.getSpecifiedConverter());
- assertEquals(null, basicResource.getConvert());
- assertEquals("foo", ((Convert) javaVersionMapping.getSpecifiedConverter()).getSpecifiedConverterName());
-
-
- ormPersistentType.removeSpecifiedPersistentAttribute(ormPersistentAttribute);
- ormPersistentAttribute = ormPersistentType.virtualAttributes().next();
- ormVersionMapping = (OrmVersionMapping) ormPersistentAttribute.getMapping();
-
- assertEquals(Convert.ECLIPSE_LINK_CONVERTER, ormVersionMapping.getSpecifiedConverter().getType());
- assertEquals("foo", ((Convert) ormVersionMapping.getSpecifiedConverter()).getSpecifiedConverterName());
- assertEquals(null, basicResource.getConvert());
- assertEquals("foo", ((Convert) javaVersionMapping.getSpecifiedConverter()).getSpecifiedConverterName());
-
- ((Convert) javaVersionMapping.getSpecifiedConverter()).setSpecifiedConverterName("bar");
- assertEquals(Convert.ECLIPSE_LINK_CONVERTER, ormVersionMapping.getSpecifiedConverter().getType());
- assertEquals("bar", ((Convert) ormVersionMapping.getSpecifiedConverter()).getSpecifiedConverterName());
- assertEquals(null, basicResource.getConvert());
- assertEquals("bar", ((Convert) javaVersionMapping.getSpecifiedConverter()).getSpecifiedConverterName());
-
- javaVersionMapping.setSpecifiedConverter(Converter.NO_CONVERTER);
- assertEquals(null, ormVersionMapping.getSpecifiedConverter());
- assertEquals(null, basicResource.getConvert());
- assertEquals(null, javaVersionMapping.getSpecifiedConverter());
- }
-
- public void testModifyConvert() throws Exception {
- OrmPersistentType ormPersistentType = getEntityMappings().addPersistentType(MappingKeys.ENTITY_TYPE_MAPPING_KEY, "model.Foo");
- OrmPersistentAttribute ormPersistentAttribute = ormPersistentType.addSpecifiedPersistentAttribute(MappingKeys.VERSION_ATTRIBUTE_MAPPING_KEY, "basicMapping");
- OrmVersionMapping ormVersionMapping = (OrmVersionMapping) ormPersistentAttribute.getMapping();
- XmlVersion basicResource = (XmlVersion) getXmlEntityMappings().getEntities().get(0).getAttributes().getVersions().get(0);
-
- assertEquals(null, ormVersionMapping.getSpecifiedConverter());
- assertEquals(null, basicResource.getConvert());
-
- //set lob in the context model, verify resource model updated
- ormVersionMapping.setSpecifiedConverter(Convert.ECLIPSE_LINK_CONVERTER);
- assertEquals("", basicResource.getConvert());
- assertEquals(Convert.ECLIPSE_LINK_CONVERTER, ormVersionMapping.getConverter().getType());
-
- ((Convert) ormVersionMapping.getSpecifiedConverter()).setSpecifiedConverterName("bar");
- assertEquals("bar", basicResource.getConvert());
- assertEquals(Convert.ECLIPSE_LINK_CONVERTER, ormVersionMapping.getConverter().getType());
- assertEquals("bar", ((Convert) ormVersionMapping.getConverter()).getSpecifiedConverterName());
-
- ((Convert) ormVersionMapping.getSpecifiedConverter()).setSpecifiedConverterName(null);
-
- assertEquals(null, ormVersionMapping.getSpecifiedConverter());
- assertEquals(null, basicResource.getConvert());
-
- //set lob to false in the context model
- ormVersionMapping.setSpecifiedConverter(null);
- assertEquals(null, ormVersionMapping.getSpecifiedConverter());
- assertEquals(null, basicResource.getConvert());
- }
-}
diff --git a/jpa/tests/org.eclipse.jpt.eclipselink.core.tests/src/org/eclipse/jpt/eclipselink/core/tests/internal/context/orm/EclipseLinkPersistenceUnitDefaultsTests.java b/jpa/tests/org.eclipse.jpt.eclipselink.core.tests/src/org/eclipse/jpt/eclipselink/core/tests/internal/context/orm/EclipseLinkPersistenceUnitDefaultsTests.java
deleted file mode 100644
index a867a06352..0000000000
--- a/jpa/tests/org.eclipse.jpt.eclipselink.core.tests/src/org/eclipse/jpt/eclipselink/core/tests/internal/context/orm/EclipseLinkPersistenceUnitDefaultsTests.java
+++ /dev/null
@@ -1,369 +0,0 @@
-/*******************************************************************************
- * Copyright (c) 2007, 2009 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.
- *
- * Contributors:
- * Oracle - initial API and implementation
- ******************************************************************************/
-package org.eclipse.jpt.eclipselink.core.tests.internal.context.orm;
-
-import org.eclipse.jpt.core.context.AccessType;
-import org.eclipse.jpt.core.context.orm.OrmPersistenceUnitDefaults;
-import org.eclipse.jpt.core.resource.orm.OrmFactory;
-import org.eclipse.jpt.core.resource.orm.XmlPersistenceUnitMetadata;
-import org.eclipse.jpt.core.resource.persistence.PersistenceFactory;
-import org.eclipse.jpt.core.resource.persistence.XmlMappingFileRef;
-import org.eclipse.jpt.eclipselink.core.internal.JptEclipseLinkCorePlugin;
-import org.eclipse.jpt.eclipselink.core.resource.orm.EclipseLinkOrmFactory;
-
-@SuppressWarnings("nls")
-public class EclipseLinkPersistenceUnitDefaultsTests extends EclipseLinkOrmContextModelTestCase
-{
- public EclipseLinkPersistenceUnitDefaultsTests(String name) {
- super(name);
- }
-
-
- @Override
- protected void setUp() throws Exception {
- super.setUp();
- XmlMappingFileRef mappingFileRef = PersistenceFactory.eINSTANCE.createXmlMappingFileRef();
- mappingFileRef.setFileName(JptEclipseLinkCorePlugin.DEFAULT_ECLIPSELINK_ORM_XML_FILE_PATH);
- getXmlPersistenceUnit().getMappingFiles().add(mappingFileRef);
- getPersistenceXmlResource().save(null);
- }
-
- protected OrmPersistenceUnitDefaults persistenceUnitDefaults() {
- return getEntityMappings().getPersistenceUnitMetadata().getPersistenceUnitDefaults();
- }
-
- public void testIsAllFeaturesUnset() throws Exception {
- OrmPersistenceUnitDefaults persistenceUnitDefaults = persistenceUnitDefaults();
- assertNull(persistenceUnitDefaults.getAccess());
- assertNull(getXmlEntityMappings().getPersistenceUnitMetadata());
-
- XmlPersistenceUnitMetadata persistenceUnitMetadata = EclipseLinkOrmFactory.eINSTANCE.createXmlPersistenceUnitMetadata();
- getXmlEntityMappings().setPersistenceUnitMetadata(persistenceUnitMetadata);
- assertTrue(persistenceUnitMetadata.isUnset());
-
- org.eclipse.jpt.core.resource.orm.XmlPersistenceUnitDefaults persistenceUnitDefaultsResource = OrmFactory.eINSTANCE.createXmlPersistenceUnitDefaults();
- persistenceUnitMetadata.setPersistenceUnitDefaults(persistenceUnitDefaultsResource);
- assertTrue(persistenceUnitDefaultsResource.isUnset());
-
- persistenceUnitDefaultsResource.setCascadePersist(true);
- assertFalse(persistenceUnitDefaultsResource.isUnset());
-
- persistenceUnitDefaultsResource.setCascadePersist(false);
- assertTrue(persistenceUnitDefaultsResource.isUnset());
-
- persistenceUnitDefaultsResource.setSchema("asdf");
- assertFalse(persistenceUnitDefaultsResource.isUnset());
-
- persistenceUnitDefaultsResource.setSchema(null);
- assertTrue(persistenceUnitDefaultsResource.isUnset());
-
- persistenceUnitDefaultsResource.setCatalog("asdf");
- assertFalse(persistenceUnitDefaultsResource.isUnset());
-
- persistenceUnitDefaultsResource.setCatalog(null);
- assertTrue(persistenceUnitDefaultsResource.isUnset());
-
-
- persistenceUnitDefaultsResource.setAccess(org.eclipse.jpt.core.resource.orm.AccessType.PROPERTY);
- assertFalse(persistenceUnitDefaultsResource.isUnset());
-
- persistenceUnitDefaultsResource.setAccess(org.eclipse.jpt.core.resource.orm.AccessType.FIELD);
- assertFalse(persistenceUnitDefaultsResource.isUnset());
-
- persistenceUnitDefaultsResource.setAccess(null);
- assertTrue(persistenceUnitDefaultsResource.isUnset());
- }
-
- public void testUpdateSchema() throws Exception {
- OrmPersistenceUnitDefaults persistenceUnitDefaults = persistenceUnitDefaults();
- assertNull(persistenceUnitDefaults.getSchema());
- assertNull(getXmlEntityMappings().getPersistenceUnitMetadata());
-
- //set schema in the resource model, verify context model updated
- getXmlEntityMappings().setPersistenceUnitMetadata(EclipseLinkOrmFactory.eINSTANCE.createXmlPersistenceUnitMetadata());
- getXmlEntityMappings().getPersistenceUnitMetadata().setPersistenceUnitDefaults(OrmFactory.eINSTANCE.createXmlPersistenceUnitDefaults());
- getXmlEntityMappings().getPersistenceUnitMetadata().getPersistenceUnitDefaults().setSchema("MY_SCHEMA");
- assertEquals("MY_SCHEMA", persistenceUnitDefaults.getSchema());
- assertEquals("MY_SCHEMA", getXmlEntityMappings().getPersistenceUnitMetadata().getPersistenceUnitDefaults().getSchema());
-
- //set schema to null in the resource model
- getXmlEntityMappings().getPersistenceUnitMetadata().getPersistenceUnitDefaults().setSchema(null);
- assertNull(persistenceUnitDefaults.getSchema());
- assertNull(getXmlEntityMappings().getPersistenceUnitMetadata().getPersistenceUnitDefaults().getSchema());
- }
-
- public void testModifySchema() throws Exception {
- OrmPersistenceUnitDefaults persistenceUnitDefaults = persistenceUnitDefaults();
- assertNull(persistenceUnitDefaults.getSchema());
- assertNull(getXmlEntityMappings().getPersistenceUnitMetadata());
-
- //set schema in the context model, verify resource model modified
- persistenceUnitDefaults.setSpecifiedSchema("MY_SCHEMA");
- assertEquals("MY_SCHEMA", persistenceUnitDefaults.getSchema());
- assertEquals("MY_SCHEMA", getXmlEntityMappings().getPersistenceUnitMetadata().getPersistenceUnitDefaults().getSchema());
-
- //set schema to null in the context model
- persistenceUnitDefaults.setSpecifiedSchema(null);
- assertNull(persistenceUnitDefaults.getSchema());
- assertNull(getXmlEntityMappings().getPersistenceUnitMetadata());
- }
-
- public void testModifySchema2() throws Exception {
- OrmPersistenceUnitDefaults persistenceUnitDefaults = persistenceUnitDefaults();
- assertNull(persistenceUnitDefaults.getSchema());
- assertNull(getXmlEntityMappings().getPersistenceUnitMetadata());
-
- //set schema in the context model, verify resource model modified
- persistenceUnitDefaults.setSpecifiedSchema("MY_SCHEMA");
- assertEquals("MY_SCHEMA", persistenceUnitDefaults.getSchema());
- assertEquals("MY_SCHEMA", getXmlEntityMappings().getPersistenceUnitMetadata().getPersistenceUnitDefaults().getSchema());
-
- //set another element on the persistence-unit-defaults element so it doesn't get removed
- getXmlEntityMappings().getPersistenceUnitMetadata().getPersistenceUnitDefaults().setCatalog("MY_CATALOG");
- //set schema to null in the context model
- persistenceUnitDefaults.setSpecifiedSchema(null);
- assertNull(persistenceUnitDefaults.getSchema());
- assertNull(getXmlEntityMappings().getPersistenceUnitMetadata().getPersistenceUnitDefaults().getSchema());
- }
-
- public void testModifySchema3() throws Exception {
- OrmPersistenceUnitDefaults persistenceUnitDefaults = persistenceUnitDefaults();
- assertNull(persistenceUnitDefaults.getSchema());
- assertNull(getXmlEntityMappings().getPersistenceUnitMetadata());
- //set another element on the persistence-unit-metadata element so only persistence-unit-defaults element gets removed
- getXmlEntityMappings().setPersistenceUnitMetadata(EclipseLinkOrmFactory.eINSTANCE.createXmlPersistenceUnitMetadata());
- getXmlEntityMappings().getPersistenceUnitMetadata().setXmlMappingMetadataComplete(true);
-
- //set schema in the context model, verify resource model modified
- persistenceUnitDefaults.setSpecifiedSchema("MY_SCHEMA");
- assertEquals("MY_SCHEMA", persistenceUnitDefaults.getSchema());
- assertEquals("MY_SCHEMA", getXmlEntityMappings().getPersistenceUnitMetadata().getPersistenceUnitDefaults().getSchema());
-
- //set schema to null in the context model
- persistenceUnitDefaults.setSpecifiedSchema(null);
- assertNull(persistenceUnitDefaults.getSchema());
- assertNull(getXmlEntityMappings().getPersistenceUnitMetadata().getPersistenceUnitDefaults());
- }
-
- public void testUpdateCatalog() throws Exception {
- OrmPersistenceUnitDefaults persistenceUnitDefaults = persistenceUnitDefaults();
- assertNull(persistenceUnitDefaults.getCatalog());
- assertNull(getXmlEntityMappings().getPersistenceUnitMetadata());
-
- //set catalog in the resource model, verify context model updated
- getXmlEntityMappings().setPersistenceUnitMetadata(EclipseLinkOrmFactory.eINSTANCE.createXmlPersistenceUnitMetadata());
- getXmlEntityMappings().getPersistenceUnitMetadata().setPersistenceUnitDefaults(OrmFactory.eINSTANCE.createXmlPersistenceUnitDefaults());
- getXmlEntityMappings().getPersistenceUnitMetadata().getPersistenceUnitDefaults().setCatalog("MY_CATALOG");
- assertEquals("MY_CATALOG", persistenceUnitDefaults.getCatalog());
- assertEquals("MY_CATALOG", getXmlEntityMappings().getPersistenceUnitMetadata().getPersistenceUnitDefaults().getCatalog());
-
- //set catalog to null in the resource model
- getXmlEntityMappings().getPersistenceUnitMetadata().getPersistenceUnitDefaults().setCatalog(null);
- assertNull(persistenceUnitDefaults.getCatalog());
- assertNull(getXmlEntityMappings().getPersistenceUnitMetadata().getPersistenceUnitDefaults().getCatalog());
- }
-
- public void testModifyCatalog() throws Exception {
- OrmPersistenceUnitDefaults persistenceUnitDefaults = persistenceUnitDefaults();
- assertNull(persistenceUnitDefaults.getCatalog());
- assertNull(getXmlEntityMappings().getPersistenceUnitMetadata());
-
- //set catalog in the context model, verify resource model modified
- persistenceUnitDefaults.setSpecifiedCatalog("MY_CATALOG");
- assertEquals("MY_CATALOG", persistenceUnitDefaults.getCatalog());
- assertEquals("MY_CATALOG", getXmlEntityMappings().getPersistenceUnitMetadata().getPersistenceUnitDefaults().getCatalog());
-
- //set catalog to null in the context model
- persistenceUnitDefaults.setSpecifiedCatalog(null);
- assertNull(persistenceUnitDefaults.getCatalog());
- assertNull(getXmlEntityMappings().getPersistenceUnitMetadata());
- }
-
- public void testModifyCatalog2() throws Exception {
- OrmPersistenceUnitDefaults persistenceUnitDefaults = persistenceUnitDefaults();
- assertNull(persistenceUnitDefaults.getCatalog());
- assertNull(getXmlEntityMappings().getPersistenceUnitMetadata());
-
- //set catalog in the context model, verify resource model modified
- persistenceUnitDefaults.setSpecifiedCatalog("MY_CATALOG");
- assertEquals("MY_CATALOG", persistenceUnitDefaults.getCatalog());
- assertEquals("MY_CATALOG", getXmlEntityMappings().getPersistenceUnitMetadata().getPersistenceUnitDefaults().getCatalog());
-
- //set another element on the persistence-unit-defaults element so it doesn't get removed
- getXmlEntityMappings().getPersistenceUnitMetadata().getPersistenceUnitDefaults().setSchema("MY_SCHEMA");
- //set catalog to null in the context model
- persistenceUnitDefaults.setSpecifiedCatalog(null);
- assertNull(persistenceUnitDefaults.getCatalog());
- assertNull(getXmlEntityMappings().getPersistenceUnitMetadata().getPersistenceUnitDefaults().getCatalog());
- }
-
- public void testModifyCatalog3() throws Exception {
- OrmPersistenceUnitDefaults persistenceUnitDefaults = persistenceUnitDefaults();
- assertNull(persistenceUnitDefaults.getCatalog());
- assertNull(getXmlEntityMappings().getPersistenceUnitMetadata());
- //set another element on the persistence-unit-metadata element so only persistence-unit-defaults element gets removed
- getXmlEntityMappings().setPersistenceUnitMetadata(EclipseLinkOrmFactory.eINSTANCE.createXmlPersistenceUnitMetadata());
- getXmlEntityMappings().getPersistenceUnitMetadata().setXmlMappingMetadataComplete(true);
-
- //set catalog in the context model, verify resource model modified
- persistenceUnitDefaults.setSpecifiedCatalog("MY_CATALOG");
- assertEquals("MY_CATALOG", persistenceUnitDefaults.getCatalog());
- assertEquals("MY_CATALOG", getXmlEntityMappings().getPersistenceUnitMetadata().getPersistenceUnitDefaults().getCatalog());
-
- //set catalog to null in the context model
- persistenceUnitDefaults.setSpecifiedCatalog(null);
- assertNull(persistenceUnitDefaults.getCatalog());
- assertNull(getXmlEntityMappings().getPersistenceUnitMetadata().getPersistenceUnitDefaults());
- }
-
- public void testUpdateCascadePersist() throws Exception {
- OrmPersistenceUnitDefaults persistenceUnitDefaults = persistenceUnitDefaults();
- assertFalse(persistenceUnitDefaults.isCascadePersist());
- assertNull(getXmlEntityMappings().getPersistenceUnitMetadata());
-
- //set cascadePersist in the resource model, verify context model updated
- getXmlEntityMappings().setPersistenceUnitMetadata(EclipseLinkOrmFactory.eINSTANCE.createXmlPersistenceUnitMetadata());
- getXmlEntityMappings().getPersistenceUnitMetadata().setPersistenceUnitDefaults(OrmFactory.eINSTANCE.createXmlPersistenceUnitDefaults());
- getXmlEntityMappings().getPersistenceUnitMetadata().getPersistenceUnitDefaults().setCascadePersist(true);
- assertTrue(persistenceUnitDefaults.isCascadePersist());
- assertTrue(getXmlEntityMappings().getPersistenceUnitMetadata().getPersistenceUnitDefaults().isCascadePersist());
-
- //set cascadePersist to null in the resource model, persistence-unit-defaults tag not removed
- getXmlEntityMappings().getPersistenceUnitMetadata().getPersistenceUnitDefaults().setCascadePersist(false);
- assertFalse(persistenceUnitDefaults.isCascadePersist());
- assertFalse(getXmlEntityMappings().getPersistenceUnitMetadata().getPersistenceUnitDefaults().isCascadePersist());
- }
-
- public void testModifyCascadePersist() throws Exception {
- OrmPersistenceUnitDefaults persistenceUnitDefaults = persistenceUnitDefaults();
- assertFalse(persistenceUnitDefaults.isCascadePersist());
- assertNull(getXmlEntityMappings().getPersistenceUnitMetadata());
-
- //set cascadePersist in the context model, verify resource model modified
- persistenceUnitDefaults.setCascadePersist(true);
- assertTrue(persistenceUnitDefaults.isCascadePersist());
- assertTrue(getXmlEntityMappings().getPersistenceUnitMetadata().getPersistenceUnitDefaults().isCascadePersist());
-
- //set cascadePersist to null in the context model
- persistenceUnitDefaults.setCascadePersist(false);
- assertFalse(persistenceUnitDefaults.isCascadePersist());
- assertNull(getXmlEntityMappings().getPersistenceUnitMetadata());
- }
-
- public void testModifyCascadePersist2() throws Exception {
- OrmPersistenceUnitDefaults persistenceUnitDefaults = persistenceUnitDefaults();
- assertFalse(persistenceUnitDefaults.isCascadePersist());
- assertNull(getXmlEntityMappings().getPersistenceUnitMetadata());
-
- //set cascadePersist in the context model, verify resource model modified
- persistenceUnitDefaults.setCascadePersist(true);
- assertTrue(persistenceUnitDefaults.isCascadePersist());
- assertTrue(getXmlEntityMappings().getPersistenceUnitMetadata().getPersistenceUnitDefaults().isCascadePersist());
-
- //set another element on the persistence-unit-defaults element so it doesn't get removed
- getXmlEntityMappings().getPersistenceUnitMetadata().getPersistenceUnitDefaults().setCatalog("MY_CATALOG");
- //set cascadePersist to null in the context model
- persistenceUnitDefaults.setCascadePersist(false);
- assertFalse(persistenceUnitDefaults.isCascadePersist());
- assertFalse(getXmlEntityMappings().getPersistenceUnitMetadata().getPersistenceUnitDefaults().isCascadePersist());
- }
-
- public void testModifyCascadePersist3() throws Exception {
- OrmPersistenceUnitDefaults persistenceUnitDefaults = persistenceUnitDefaults();
- assertFalse(persistenceUnitDefaults.isCascadePersist());
- assertNull(getXmlEntityMappings().getPersistenceUnitMetadata());
- //set another element on the persistence-unit-metadata element so only persistence-unit-defaults element gets removed
- getXmlEntityMappings().setPersistenceUnitMetadata(EclipseLinkOrmFactory.eINSTANCE.createXmlPersistenceUnitMetadata());
- getXmlEntityMappings().getPersistenceUnitMetadata().setXmlMappingMetadataComplete(true);
-
- //set cascadePersist in the context model, verify resource model modified
- persistenceUnitDefaults.setCascadePersist(true);
- assertTrue(persistenceUnitDefaults.isCascadePersist());
- assertTrue(getXmlEntityMappings().getPersistenceUnitMetadata().getPersistenceUnitDefaults().isCascadePersist());
-
- //set cascadePersist to null in the context model
- persistenceUnitDefaults.setCascadePersist(false);
- assertFalse(persistenceUnitDefaults.isCascadePersist());
- assertNull(getXmlEntityMappings().getPersistenceUnitMetadata().getPersistenceUnitDefaults());
- }
-
-
- public void testUpdateAccess() throws Exception {
- OrmPersistenceUnitDefaults persistenceUnitDefaults = persistenceUnitDefaults();
- assertNull(persistenceUnitDefaults.getAccess());
- assertNull(getXmlEntityMappings().getPersistenceUnitMetadata());
-
- //set access in the resource model, verify context model updated
- getXmlEntityMappings().setPersistenceUnitMetadata(EclipseLinkOrmFactory.eINSTANCE.createXmlPersistenceUnitMetadata());
- getXmlEntityMappings().getPersistenceUnitMetadata().setPersistenceUnitDefaults(OrmFactory.eINSTANCE.createXmlPersistenceUnitDefaults());
- getXmlEntityMappings().getPersistenceUnitMetadata().getPersistenceUnitDefaults().setAccess(org.eclipse.jpt.core.resource.orm.AccessType.FIELD);
- assertEquals(AccessType.FIELD, persistenceUnitDefaults.getAccess());
- assertEquals(org.eclipse.jpt.core.resource.orm.AccessType.FIELD, getXmlEntityMappings().getPersistenceUnitMetadata().getPersistenceUnitDefaults().getAccess());
-
- //set access to null in the resource model
- getXmlEntityMappings().getPersistenceUnitMetadata().getPersistenceUnitDefaults().setAccess(null);
- assertNull(persistenceUnitDefaults.getAccess());
- assertNull(getXmlEntityMappings().getPersistenceUnitMetadata().getPersistenceUnitDefaults().getAccess());
- }
-
- public void testModifyAccess() throws Exception {
- OrmPersistenceUnitDefaults persistenceUnitDefaults = persistenceUnitDefaults();
- assertNull(persistenceUnitDefaults.getAccess());
- assertNull(getXmlEntityMappings().getPersistenceUnitMetadata());
-
- //set access in the context model, verify resource model modified
- persistenceUnitDefaults.setAccess(AccessType.PROPERTY);
- assertEquals(AccessType.PROPERTY, persistenceUnitDefaults.getAccess());
- assertEquals(org.eclipse.jpt.core.resource.orm.AccessType.PROPERTY, getXmlEntityMappings().getPersistenceUnitMetadata().getPersistenceUnitDefaults().getAccess());
-
- //set access to null in the context model
- persistenceUnitDefaults.setAccess(null);
- assertNull(persistenceUnitDefaults.getAccess());
- assertNull(getXmlEntityMappings().getPersistenceUnitMetadata());
- }
-
- public void testModifyAccess2() throws Exception {
- OrmPersistenceUnitDefaults persistenceUnitDefaults = persistenceUnitDefaults();
- assertNull(persistenceUnitDefaults.getAccess());
- assertNull(getXmlEntityMappings().getPersistenceUnitMetadata());
-
- //set access in the context model, verify resource model modified
- persistenceUnitDefaults.setAccess(AccessType.FIELD);
- assertEquals(AccessType.FIELD, persistenceUnitDefaults.getAccess());
- assertEquals(org.eclipse.jpt.core.resource.orm.AccessType.FIELD, getXmlEntityMappings().getPersistenceUnitMetadata().getPersistenceUnitDefaults().getAccess());
-
- //set another element on the persistence-unit-defaults element so it doesn't get removed
- getXmlEntityMappings().getPersistenceUnitMetadata().getPersistenceUnitDefaults().setCascadePersist(true);
- //set access to null in the context model
- persistenceUnitDefaults.setAccess(null);
- assertNull(persistenceUnitDefaults.getAccess());
- assertNull(getXmlEntityMappings().getPersistenceUnitMetadata().getPersistenceUnitDefaults().getAccess());
- }
-
- public void testModifyAccess3() throws Exception {
- OrmPersistenceUnitDefaults persistenceUnitDefaults = persistenceUnitDefaults();
- assertNull(persistenceUnitDefaults.getAccess());
- assertNull(getXmlEntityMappings().getPersistenceUnitMetadata());
- //set another element on the persistence-unit-metadata element so only persistence-unit-defaults element gets removed
- getXmlEntityMappings().setPersistenceUnitMetadata(EclipseLinkOrmFactory.eINSTANCE.createXmlPersistenceUnitMetadata());
- getXmlEntityMappings().getPersistenceUnitMetadata().setXmlMappingMetadataComplete(true);
-
- //set access in the context model, verify resource model modified
- persistenceUnitDefaults.setAccess(AccessType.FIELD);
- assertEquals(AccessType.FIELD, persistenceUnitDefaults.getAccess());
- assertEquals(org.eclipse.jpt.core.resource.orm.AccessType.FIELD, getXmlEntityMappings().getPersistenceUnitMetadata().getPersistenceUnitDefaults().getAccess());
-
- //set access to null in the context model
- persistenceUnitDefaults.setAccess(null);
- assertNull(persistenceUnitDefaults.getAccess());
- assertNull(getXmlEntityMappings().getPersistenceUnitMetadata().getPersistenceUnitDefaults());
- }
-
-} \ No newline at end of file
diff --git a/jpa/tests/org.eclipse.jpt.eclipselink.core.tests/src/org/eclipse/jpt/eclipselink/core/tests/internal/context/orm/EclipseLinkPersistenceUnitMetadataTests.java b/jpa/tests/org.eclipse.jpt.eclipselink.core.tests/src/org/eclipse/jpt/eclipselink/core/tests/internal/context/orm/EclipseLinkPersistenceUnitMetadataTests.java
deleted file mode 100644
index 9a75e3731d..0000000000
--- a/jpa/tests/org.eclipse.jpt.eclipselink.core.tests/src/org/eclipse/jpt/eclipselink/core/tests/internal/context/orm/EclipseLinkPersistenceUnitMetadataTests.java
+++ /dev/null
@@ -1,105 +0,0 @@
-/*******************************************************************************
- * Copyright (c) 2007, 2009 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.
- *
- * Contributors:
- * Oracle - initial API and implementation
- ******************************************************************************/
-package org.eclipse.jpt.eclipselink.core.tests.internal.context.orm;
-
-import org.eclipse.jpt.core.context.orm.PersistenceUnitMetadata;
-import org.eclipse.jpt.core.resource.orm.OrmFactory;
-import org.eclipse.jpt.core.resource.persistence.PersistenceFactory;
-import org.eclipse.jpt.core.resource.persistence.XmlMappingFileRef;
-import org.eclipse.jpt.eclipselink.core.internal.JptEclipseLinkCorePlugin;
-import org.eclipse.jpt.eclipselink.core.resource.orm.EclipseLinkOrmFactory;
-import org.eclipse.jpt.eclipselink.core.resource.orm.XmlPersistenceUnitMetadata;
-
-public class EclipseLinkPersistenceUnitMetadataTests extends EclipseLinkOrmContextModelTestCase
-{
- public EclipseLinkPersistenceUnitMetadataTests(String name) {
- super(name);
- }
-
-
- @Override
- protected void setUp() throws Exception {
- super.setUp();
- XmlMappingFileRef mappingFileRef = PersistenceFactory.eINSTANCE.createXmlMappingFileRef();
- mappingFileRef.setFileName(JptEclipseLinkCorePlugin.DEFAULT_ECLIPSELINK_ORM_XML_FILE_PATH);
- getXmlPersistenceUnit().getMappingFiles().add(mappingFileRef);
- getPersistenceXmlResource().save(null);
- }
-
- protected PersistenceUnitMetadata persistenceUnitMetadata() {
- return getEntityMappings().getPersistenceUnitMetadata();
- }
-
- public void testIsAllFeaturesUnset() throws Exception {
- XmlPersistenceUnitMetadata persistenceUnitMetadata = EclipseLinkOrmFactory.eINSTANCE.createXmlPersistenceUnitMetadata();
- getXmlEntityMappings().setPersistenceUnitMetadata(persistenceUnitMetadata);
- assertTrue(persistenceUnitMetadata.isUnset());
-
- persistenceUnitMetadata.setXmlMappingMetadataComplete(true);
- assertFalse(persistenceUnitMetadata.isUnset());
-
- persistenceUnitMetadata.setXmlMappingMetadataComplete(false);
- assertTrue(persistenceUnitMetadata.isUnset());
-
- persistenceUnitMetadata.setPersistenceUnitDefaults(OrmFactory.eINSTANCE.createXmlPersistenceUnitDefaults());
- assertFalse(persistenceUnitMetadata.isUnset());
- }
-
- public void testUpdateXmlMappingMetadataComplete() throws Exception {
- PersistenceUnitMetadata persistenceUnitMetadata = getEntityMappings().getPersistenceUnitMetadata();
- assertFalse(persistenceUnitMetadata.isXmlMappingMetadataComplete());
- assertNull(getXmlEntityMappings().getPersistenceUnitMetadata());
-
- //set xmlMappingMetadataComplete in the resource model, verify context model updated
- getXmlEntityMappings().setPersistenceUnitMetadata(EclipseLinkOrmFactory.eINSTANCE.createXmlPersistenceUnitMetadata());
- getXmlEntityMappings().getPersistenceUnitMetadata().setXmlMappingMetadataComplete(true);
- assertTrue(persistenceUnitMetadata.isXmlMappingMetadataComplete());
- assertTrue(getXmlEntityMappings().getPersistenceUnitMetadata().isXmlMappingMetadataComplete());
-
- //set xmlMappingMetadataComplete to null in the resource model
- getXmlEntityMappings().getPersistenceUnitMetadata().setXmlMappingMetadataComplete(false);
- assertFalse(persistenceUnitMetadata.isXmlMappingMetadataComplete());
- assertFalse(getXmlEntityMappings().getPersistenceUnitMetadata().isXmlMappingMetadataComplete());
- }
-
- public void testModifyXmlMappingMetadataComplete() throws Exception {
- PersistenceUnitMetadata persistenceUnitMetadata = getEntityMappings().getPersistenceUnitMetadata();
- assertFalse(persistenceUnitMetadata.isXmlMappingMetadataComplete());
- assertNull(getXmlEntityMappings().getPersistenceUnitMetadata());
-
- //set xmlMappingMetadataComplete in the context model, verify resource model modified
- persistenceUnitMetadata.setXmlMappingMetadataComplete(true);
- assertTrue(persistenceUnitMetadata.isXmlMappingMetadataComplete());
- assertTrue(getXmlEntityMappings().getPersistenceUnitMetadata().isXmlMappingMetadataComplete());
-
- //set xmlMappingMetadataComplete to null in the context model
- persistenceUnitMetadata.setXmlMappingMetadataComplete(false);
- assertFalse(persistenceUnitMetadata.isXmlMappingMetadataComplete());
- assertNull(getXmlEntityMappings().getPersistenceUnitMetadata());
- }
-
- public void testModifyXmlMappingMetadataComplete2() throws Exception {
- PersistenceUnitMetadata persistenceUnitMetadata = getEntityMappings().getPersistenceUnitMetadata();
- assertFalse(persistenceUnitMetadata.isXmlMappingMetadataComplete());
- assertNull(getXmlEntityMappings().getPersistenceUnitMetadata());
-
- //set xmlMappingMetadataComplete in the context model, verify resource model modified
- persistenceUnitMetadata.setXmlMappingMetadataComplete(true);
- assertTrue(persistenceUnitMetadata.isXmlMappingMetadataComplete());
- assertTrue(getXmlEntityMappings().getPersistenceUnitMetadata().isXmlMappingMetadataComplete());
-
- //set xmlMappingMetadataComplete to null in the context model
- //set another element on the persistence-unit-metadata element so it doesn't get removed
- getXmlEntityMappings().getPersistenceUnitMetadata().setPersistenceUnitDefaults(OrmFactory.eINSTANCE.createXmlPersistenceUnitDefaults());
- persistenceUnitMetadata.setXmlMappingMetadataComplete(false);
- assertFalse(persistenceUnitMetadata.isXmlMappingMetadataComplete());
- assertFalse(getXmlEntityMappings().getPersistenceUnitMetadata().isXmlMappingMetadataComplete());
- }
-} \ No newline at end of file
diff --git a/jpa/tests/org.eclipse.jpt.eclipselink.core.tests/src/org/eclipse/jpt/eclipselink/core/tests/internal/context/orm/JptEclipseLinkCoreOrmContextModelTests.java b/jpa/tests/org.eclipse.jpt.eclipselink.core.tests/src/org/eclipse/jpt/eclipselink/core/tests/internal/context/orm/JptEclipseLinkCoreOrmContextModelTests.java
deleted file mode 100644
index d27ac12012..0000000000
--- a/jpa/tests/org.eclipse.jpt.eclipselink.core.tests/src/org/eclipse/jpt/eclipselink/core/tests/internal/context/orm/JptEclipseLinkCoreOrmContextModelTests.java
+++ /dev/null
@@ -1,51 +0,0 @@
-/*******************************************************************************
- * Copyright (c) 2007, 2009 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
- *
- * Contributors:
- * Oracle - initial API and implementation
- *******************************************************************************/
-package org.eclipse.jpt.eclipselink.core.tests.internal.context.orm;
-
-import junit.framework.Test;
-import junit.framework.TestCase;
-import junit.framework.TestSuite;
-
-public class JptEclipseLinkCoreOrmContextModelTests extends TestCase
-{
- public static Test suite() {
- return suite(true);
- }
-
- public static Test suite(boolean all) {
- TestSuite suite = new TestSuite(JptEclipseLinkCoreOrmContextModelTests.class.getName());
- suite.addTestSuite(EclipseLinkEntityMappingsTests.class);
- suite.addTestSuite(EclipseLinkPersistenceUnitMetadataTests.class);
- suite.addTestSuite(EclipseLinkPersistenceUnitDefaultsTests.class);
- suite.addTestSuite(EclipseLinkOrmEmbeddableTests.class);
- suite.addTestSuite(EclipseLinkOrmEntityTests.class);
- suite.addTestSuite(EclipseLinkOrmMappedSuperclassTests.class);
- suite.addTestSuite(EclipseLinkOrmBasicMappingTests.class);
- suite.addTestSuite(EclipseLinkOrmIdMappingTests.class);
- suite.addTestSuite(EclipseLinkOrmManyToManyMappingTests.class);
- suite.addTestSuite(EclipseLinkOrmManyToOneMappingTests.class);
- suite.addTestSuite(EclipseLinkOrmOneToManyMappingTests.class);
- suite.addTestSuite(EclipseLinkOrmOneToOneMappingTests.class);
- suite.addTestSuite(EclipseLinkOrmPersistentAttributeTests.class);
- suite.addTestSuite(EclipseLinkOrmVersionMappingTests.class);
- suite.addTestSuite(EclipseLinkOrmTransientMappingTests.class);
- suite.addTestSuite(EclipseLinkOrmConverterTests.class);
- suite.addTestSuite(EclipseLinkOrmObjectTypeConverterTests.class);
- suite.addTestSuite(EclipseLinkOrmStructConverterTests.class);
- suite.addTestSuite(EclipseLinkOrmTypeConverterTests.class);
- return suite;
- }
-
-
- private JptEclipseLinkCoreOrmContextModelTests() {
- throw new UnsupportedOperationException();
- }
-}
diff --git a/jpa/tests/org.eclipse.jpt.eclipselink.core.tests/src/org/eclipse/jpt/eclipselink/core/tests/internal/context/persistence/EclipseLinkPersistenceUnitTests.java b/jpa/tests/org.eclipse.jpt.eclipselink.core.tests/src/org/eclipse/jpt/eclipselink/core/tests/internal/context/persistence/EclipseLinkPersistenceUnitTests.java
deleted file mode 100644
index f61c85b54f..0000000000
--- a/jpa/tests/org.eclipse.jpt.eclipselink.core.tests/src/org/eclipse/jpt/eclipselink/core/tests/internal/context/persistence/EclipseLinkPersistenceUnitTests.java
+++ /dev/null
@@ -1,109 +0,0 @@
-/*******************************************************************************
- * Copyright (c) 2008, 2009 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.
- *
- * Contributors:
- * Oracle - initial API and implementation
- *******************************************************************************/
-package org.eclipse.jpt.eclipselink.core.tests.internal.context.persistence;
-
-import org.eclipse.jpt.core.internal.facet.JpaFacetDataModelProperties;
-import org.eclipse.jpt.core.internal.facet.JpaFacetDataModelProvider;
-import org.eclipse.jpt.core.internal.operations.OrmFileCreationDataModelProperties;
-import org.eclipse.jpt.core.resource.persistence.PersistenceFactory;
-import org.eclipse.jpt.core.resource.persistence.XmlMappingFileRef;
-import org.eclipse.jpt.core.resource.persistence.XmlPersistenceUnit;
-import org.eclipse.jpt.core.resource.xml.JpaXmlResource;
-import org.eclipse.jpt.core.tests.internal.projects.TestJpaProject;
-import org.eclipse.jpt.eclipselink.core.internal.EclipseLinkJpaPlatformProvider;
-import org.eclipse.jpt.eclipselink.core.internal.context.persistence.EclipseLinkPersistenceUnit;
-import org.eclipse.jpt.eclipselink.core.internal.operations.EclipseLinkOrmFileCreationDataModelProvider;
-import org.eclipse.jpt.eclipselink.core.tests.internal.context.orm.EclipseLinkOrmContextModelTestCase;
-import org.eclipse.jpt.utility.internal.CollectionTools;
-import org.eclipse.wst.common.frameworks.datamodel.DataModelFactory;
-import org.eclipse.wst.common.frameworks.datamodel.IDataModel;
-
-public class EclipseLinkPersistenceUnitTests
- extends EclipseLinkOrmContextModelTestCase
-{
- public EclipseLinkPersistenceUnitTests(String name) {
- super(name);
- }
-
-
- @Override
- protected IDataModel buildJpaConfigDataModel() {
- IDataModel dataModel = DataModelFactory.createDataModel(new JpaFacetDataModelProvider());
- dataModel.setProperty(JpaFacetDataModelProperties.PLATFORM_ID, EclipseLinkJpaPlatformProvider.ID);
- dataModel.setProperty(JpaFacetDataModelProperties.CREATE_ORM_XML, Boolean.TRUE);
- return dataModel;
- }
-
- @Override
- protected IDataModel buildEclipseLinkOrmConfig(TestJpaProject testJpaProject) {
- IDataModel dataModel =
- DataModelFactory.createDataModel(new EclipseLinkOrmFileCreationDataModelProvider());
- dataModel.setProperty(OrmFileCreationDataModelProperties.PROJECT_NAME, testJpaProject.getProject().getName());
- dataModel.setProperty(OrmFileCreationDataModelProperties.ADD_TO_PERSISTENCE_UNIT, Boolean.FALSE);
- return dataModel;
- }
-
-
- public void testUpdateEclipseLinkImpliedMappingFileRef1() throws Exception {
- EclipseLinkPersistenceUnit persistenceUnit = getPersistenceUnit();
-
- // test that there is one initially
- JpaXmlResource eclipseLinkOrmResource = getOrmXmlResource();
- assertTrue(eclipseLinkOrmResource.fileExists());
- assertNotNull(persistenceUnit.getImpliedMappingFileRef());
- assertNotNull(persistenceUnit.getImpliedEclipseLinkMappingFileRef());
-
- // remove eclipselink-orm.xml
- deleteResource(eclipseLinkOrmResource);
-
- assertFalse(eclipseLinkOrmResource.fileExists());
- assertNotNull(persistenceUnit.getImpliedMappingFileRef());
- assertNull(persistenceUnit.getImpliedEclipseLinkMappingFileRef());
- }
-
- public void testUpdateEclipseLinkImpliedMappingFileRef2() {
- XmlPersistenceUnit xmlPersistenceUnit = getXmlPersistenceUnit();
- EclipseLinkPersistenceUnit persistenceUnit = getPersistenceUnit();
-
- // test that there is one initially
- JpaXmlResource eclipseLinkOrmResource = getOrmXmlResource();
- assertTrue(eclipseLinkOrmResource.fileExists());
- assertNotNull(persistenceUnit.getImpliedMappingFileRef());
- assertNotNull(persistenceUnit.getImpliedEclipseLinkMappingFileRef());
-
- // add specified eclipselink-orm.xml
- XmlMappingFileRef xmlMappingFileRef = PersistenceFactory.eINSTANCE.createXmlMappingFileRef();
- xmlMappingFileRef.setFileName("META-INF/eclipselink-orm.xml");
- xmlPersistenceUnit.getMappingFiles().add(xmlMappingFileRef);
-
- assertEquals(1, CollectionTools.size(persistenceUnit.specifiedMappingFileRefs()));
-
- assertTrue(eclipseLinkOrmResource.fileExists());
- assertNotNull(persistenceUnit.getImpliedMappingFileRef());
- assertNull(persistenceUnit.getImpliedEclipseLinkMappingFileRef());
- }
-
- public void testUpdateEclipseLinkImpliedMappingFileRef3() {
- EclipseLinkPersistenceUnit persistenceUnit = getPersistenceUnit();
-
- // test that there is one initially
- JpaXmlResource eclipseLinkOrmResource = getOrmXmlResource();
- assertTrue(eclipseLinkOrmResource.fileExists());
- assertNotNull(persistenceUnit.getImpliedMappingFileRef());
- assertNotNull(persistenceUnit.getImpliedEclipseLinkMappingFileRef());
-
- // ignore in persistence unit
- persistenceUnit.getGeneralProperties().setExcludeEclipselinkOrm(Boolean.TRUE);
-
- assertTrue(eclipseLinkOrmResource.fileExists());
- assertNotNull(persistenceUnit.getImpliedMappingFileRef());
- assertNull(persistenceUnit.getImpliedEclipseLinkMappingFileRef());
- }
-}
diff --git a/jpa/tests/org.eclipse.jpt.eclipselink.core.tests/src/org/eclipse/jpt/eclipselink/core/tests/internal/context/persistence/JptEclipseLinkCorePersistenceContextModelTests.java b/jpa/tests/org.eclipse.jpt.eclipselink.core.tests/src/org/eclipse/jpt/eclipselink/core/tests/internal/context/persistence/JptEclipseLinkCorePersistenceContextModelTests.java
deleted file mode 100644
index 59bb0a6173..0000000000
--- a/jpa/tests/org.eclipse.jpt.eclipselink.core.tests/src/org/eclipse/jpt/eclipselink/core/tests/internal/context/persistence/JptEclipseLinkCorePersistenceContextModelTests.java
+++ /dev/null
@@ -1,37 +0,0 @@
-package org.eclipse.jpt.eclipselink.core.tests.internal.context.persistence;
-
-import junit.framework.Test;
-import junit.framework.TestCase;
-import junit.framework.TestSuite;
-import org.eclipse.jpt.eclipselink.core.tests.internal.context.persistence.caching.JptEclipseLinkPersistenceCachingTests;
-import org.eclipse.jpt.eclipselink.core.tests.internal.context.persistence.connection.JptEclipseLinkPersistenceConnectionTests;
-import org.eclipse.jpt.eclipselink.core.tests.internal.context.persistence.customization.JptEclipseLinkPersistenceCustomizationTests;
-import org.eclipse.jpt.eclipselink.core.tests.internal.context.persistence.general.JptEclipseLinkPersistenceGeneralTests;
-import org.eclipse.jpt.eclipselink.core.tests.internal.context.persistence.logging.JptEclipseLinkPersistenceLoggingTests;
-import org.eclipse.jpt.eclipselink.core.tests.internal.context.persistence.options.JptEclipseLinkPersistenceOptionsTests;
-import org.eclipse.jpt.eclipselink.core.tests.internal.context.persistence.schema.generation.JptEclipseLinkPersistenceSchemaGenerationTests;
-
-public class JptEclipseLinkCorePersistenceContextModelTests extends TestCase
-{
- public static Test suite() {
- return suite(true);
- }
-
- public static Test suite(boolean all) {
- TestSuite suite = new TestSuite(JptEclipseLinkCorePersistenceContextModelTests.class.getName());
- suite.addTestSuite(EclipseLinkPersistenceUnitTests.class);
- suite.addTest(JptEclipseLinkPersistenceGeneralTests.suite());
- suite.addTest(JptEclipseLinkPersistenceConnectionTests.suite());
- suite.addTest(JptEclipseLinkPersistenceCustomizationTests.suite());
- suite.addTest(JptEclipseLinkPersistenceCachingTests.suite());
- suite.addTest(JptEclipseLinkPersistenceLoggingTests.suite());
- suite.addTest(JptEclipseLinkPersistenceOptionsTests.suite());
- suite.addTest(JptEclipseLinkPersistenceSchemaGenerationTests.suite());
- return suite;
- }
-
- private JptEclipseLinkCorePersistenceContextModelTests() {
- super();
- throw new UnsupportedOperationException();
- }
-}
diff --git a/jpa/tests/org.eclipse.jpt.eclipselink.core.tests/src/org/eclipse/jpt/eclipselink/core/tests/internal/context/persistence/PersistenceUnitTestCase.java b/jpa/tests/org.eclipse.jpt.eclipselink.core.tests/src/org/eclipse/jpt/eclipselink/core/tests/internal/context/persistence/PersistenceUnitTestCase.java
deleted file mode 100644
index 3ffb6fff7c..0000000000
--- a/jpa/tests/org.eclipse.jpt.eclipselink.core.tests/src/org/eclipse/jpt/eclipselink/core/tests/internal/context/persistence/PersistenceUnitTestCase.java
+++ /dev/null
@@ -1,373 +0,0 @@
-/*******************************************************************************
- * Copyright (c) 2008, 2009 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.
- *
- * Contributors:
- * Oracle - initial API and implementation
- *******************************************************************************/
-package org.eclipse.jpt.eclipselink.core.tests.internal.context.persistence;
-
-import org.eclipse.jpt.core.context.persistence.PersistenceUnit;
-import org.eclipse.jpt.core.internal.facet.JpaFacetDataModelProperties;
-import org.eclipse.jpt.core.internal.facet.JpaFacetDataModelProvider;
-import org.eclipse.jpt.core.tests.internal.context.ContextModelTestCase;
-import org.eclipse.jpt.eclipselink.core.internal.EclipseLinkJpaPlatformProvider;
-import org.eclipse.jpt.eclipselink.core.internal.context.persistence.EclipseLinkPersistenceUnit;
-import org.eclipse.jpt.eclipselink.core.internal.context.persistence.EclipseLinkPersistenceUnitProperties;
-import org.eclipse.jpt.eclipselink.core.internal.context.persistence.PersistenceUnitProperties;
-import org.eclipse.jpt.utility.internal.model.AbstractModel;
-import org.eclipse.jpt.utility.internal.model.value.SimplePropertyValueModel;
-import org.eclipse.jpt.utility.model.event.ListChangeEvent;
-import org.eclipse.jpt.utility.model.event.ListEvent;
-import org.eclipse.jpt.utility.model.event.PropertyChangeEvent;
-import org.eclipse.jpt.utility.model.listener.PropertyChangeListener;
-import org.eclipse.jpt.utility.model.value.ListValueModel;
-import org.eclipse.jpt.utility.model.value.PropertyValueModel;
-import org.eclipse.wst.common.frameworks.datamodel.DataModelFactory;
-import org.eclipse.wst.common.frameworks.datamodel.IDataModel;
-
-/**
- * PersistenceUnitTestCase
- */
-@SuppressWarnings("nls")
-public abstract class PersistenceUnitTestCase extends ContextModelTestCase
-{
- protected EclipseLinkPersistenceUnit subject;
-
- protected PropertyValueModel<EclipseLinkPersistenceUnit> subjectHolder;
-
- protected PropertyChangeEvent propertyChangedEvent;
-
- protected int propertyChangedEventCount;
-
- protected int propertiesTotal;
-
- protected int modelPropertiesSizeOriginal;
-
- protected int modelPropertiesSize;
-
- protected PersistenceUnitTestCase(String name) {
- super(name);
- }
-
- @Override
- protected void setUp() throws Exception {
- super.setUp();
- this.subject = this.getPersistenceUnit();
- this.subjectHolder = new SimplePropertyValueModel<EclipseLinkPersistenceUnit>(this.subject);
- this.populatePu();
- }
-
- @Override
- protected IDataModel buildJpaConfigDataModel() {
- IDataModel dataModel = DataModelFactory.createDataModel(new JpaFacetDataModelProvider());
- dataModel.setProperty(JpaFacetDataModelProperties.PLATFORM_ID, EclipseLinkJpaPlatformProvider.ID);
- dataModel.setProperty(JpaFacetDataModelProperties.CREATE_ORM_XML, Boolean.FALSE);
- return dataModel;
- }
-
- @Override
- protected EclipseLinkPersistenceUnit getPersistenceUnit() {
- return (EclipseLinkPersistenceUnit) super.getPersistenceUnit();
- }
-
- // ****** abstract methods *******
- protected abstract PersistenceUnitProperties getModel();
-
- /**
- * Initializes directly the PU properties before testing. Cannot use
- * Property Holder to initialize because it is not created yet
- */
- protected abstract void populatePu();
-
- /**
- * Gets the model's property identified by the given propertyName.
- *
- * @param propertyName
- * name of property to get
- * @throws Exception
- */
- protected abstract Object getProperty(String propertyName) throws Exception;
-
-
- /**
- * Sets the model's property identified by the given propertyName.
- * Used in verifySetProperty()
- *
- * @param propertyName
- * name of property to be set
- * @param newValue
- * value of property
- * @throws Exception
- */
- protected abstract void setProperty(String propertyName, Object newValue) throws Exception;
-
-
- // ****** convenience test methods *******
-
- protected String getEclipseLinkStringValueOf(Object value) {
- return EclipseLinkPersistenceUnitProperties.getEclipseLinkStringValueOf(value);
- }
-
- /**
- * Put into persistenceUnit properties. Do not allows to put duplicate entry.
- *
- * @param key -
- * EclipseLink Key
- * @param value -
- * property value
- */
- protected void persistenceUnitSetProperty(String key, Object value) {
-
- this.persistenceUnitSetProperty( key, value, false);
- }
-
- protected void persistenceUnitSetProperty(String key, Object value, boolean allowDuplicates) {
- if (key == null) {
- throw new IllegalArgumentException("EclipseLink Key cannot be null");
- }
- if (value == null)
- this.setNullProperty(key);
- else
- this.putProperty_(key, value, allowDuplicates);
- }
-
- private void putProperty_(String elKey, Object value, boolean allowDuplicates) {
- this.clearEvent();
- this.getPersistenceUnit().setProperty(elKey, this.getEclipseLinkStringValueOf(value), allowDuplicates);
- }
-
- protected void setNullProperty(String elKey) {
- this.clearEvent();
- this.getPersistenceUnit().setProperty(elKey, null, false);
- }
-
- protected void clearEvent() {
- this.propertyChangedEvent = null;
- this.propertyChangedEventCount = 0;
- }
-
- protected void throwMissingDefinition(String methodName, String propertyName) throws NoSuchFieldException {
- throw new NoSuchFieldException("Missing Definition for: " + methodName + "( " + propertyName + ")");
- }
-
- public void throwUnsupportedOperationException(ListEvent e) {
- throw new UnsupportedOperationException(e.getListName());
- }
-
- protected PropertyChangeListener buildPropertyChangeListener() {
- return new PropertyChangeListener() {
- public void propertyChanged(PropertyChangeEvent event) {
- PersistenceUnitTestCase.this.propertyChangedEvent = event;
- PersistenceUnitTestCase.this.propertyChangedEventCount++;
- }
-
- @Override
- public String toString() {
- return "PersistenceUnit listener";
- }
- };
- }
-
- // ****** verify EclipseLink properties *******
- /**
- * Performs three value tests:<br>
- * 1. subject value<br>
- * 2. aspect adapter value<br>
- * 3. persistenceUnit property value<br>
- */
- protected void verifyAAValue(Boolean expectedValue, Boolean subjectValue, PropertyValueModel<Boolean> aa, String persistenceXmlKey) {
- assertEquals(expectedValue, subjectValue);
- assertEquals(expectedValue, aa.getValue());
- if (expectedValue != null) {
- assertEquals(expectedValue.toString(), this.getPersistenceUnit().getProperty(persistenceXmlKey).getValue());
- }
- }
-
- /**
- * Performs three value tests:<br>
- * 1. subject value<br>
- * 2. aspect adapter value<br>
- * 3. persistenceUnit property value<br>
- */
- protected <T extends Enum<T>> void verifyAAValue(T expectedValue, T subjectValue, PropertyValueModel<? extends Enum<T>> aa, String elKey) {
- assertEquals(expectedValue, subjectValue);
- assertEquals(expectedValue, aa.getValue());
- if (expectedValue != null) {
- assertEquals(this.getEclipseLinkStringValueOf(expectedValue), this.getPersistenceUnit().getProperty(elKey).getValue());
- }
- }
-
- /**
- * Performs the following tests:<br>
- * 1. verify total number of EclipseLink properties<br>
- * 2. verify PU has the given propertyName<br>
- * 3. verify listening to propertyListAdapter<br>
- * 4. verify that the model can identify propertyName<br>
- */
- protected void verifyInitialState(String propertyName, String elKey, ListValueModel<PersistenceUnit.Property> propertyListAdapter) throws Exception {
- assertEquals("Total not updated in populatePu(): ", propertyListAdapter.size(), this.propertiesTotal);
- this.verifyPuHasProperty(elKey, "Property not added to populatePu()");
- this.verifyHasListeners(propertyListAdapter);
- this.verifyHasListeners(this.getModel(), propertyName);
-
- PersistenceUnit.Property property = this.getPersistenceUnit().getProperty(elKey);
- assertTrue("model.itemIsProperty() is false: ", getModel().itemIsProperty(property));
- assertEquals("propertyIdFor() not updated: ", propertyName, getModel().propertyIdOf(property));
- }
-
- /**
- * Verifies that the persistence unit is populated, and that the model for
- * the tested Property is initialized with the value from the persistence
- * unit.
- * @throws Exception
- */
- protected void verifyModelInitialized(String elKey, Object expectedValue) throws Exception {
- PersistenceUnit.Property property = this.getPersistenceUnit().getProperty(elKey);
- assertTrue("model.itemIsProperty() is false: ", getModel().itemIsProperty(property));
-
- assertEquals("PersistenceUnit not populated - populatedPu()", this.getEclipseLinkStringValueOf(expectedValue), property.getValue());
- String propertyName = this.getModel().propertyIdOf(property);
- Object modelValue = this.getProperty(propertyName);
- assertEquals(
- "Model not initialized - model.initializeProperties() - modelValue = " + modelValue,
- expectedValue,
- modelValue);
- }
-
- /**
- * Performs the following operations with the property:<br>
- * 1. verifies the initial state<br>
- * 2. persistenceUnit putProperty<br>
- * 3. adapter setProperty<br>
- */
- protected void verifySetProperty(String elKey, Object testValue1, Object testValue2) throws Exception {
- PersistenceUnit.Property property = this.getPersistenceUnit().getProperty(elKey);
- String propertyName = this.getModel().propertyIdOf(property);
-
- // Replace
- this.persistenceUnitSetProperty(elKey, testValue2);
- this.verifyPutProperty(propertyName, testValue2);
-
- // Replace by setting model object
- this.clearEvent();
- this.setProperty(propertyName, testValue1);
- this.verifyPutProperty(propertyName, testValue1);
- }
-
- /**
- * Performs the following operations with the property:<br>
- * 1. performs a remove on the PU<br>
- * 2. performs a add with putProperty<br>
- * 3. performs a replace with putProperty<br>
- */
- protected void verifyAddRemoveProperty(String elKey, Object testValue1, Object testValue2) throws Exception {
- PersistenceUnit.Property property = this.getPersistenceUnit().getProperty(elKey);
- String propertyName = this.getModel().propertyIdOf(property);
-
- // Remove
- this.clearEvent();
- --this.propertiesTotal;
- --this.modelPropertiesSize;
- assertNotNull("persistenceUnit.properties doesn't contains: " + elKey, this.getPersistenceUnit().getProperty(elKey));
- this.getPersistenceUnit().removeProperty(elKey);
- assertNull(this.getPersistenceUnit().getProperty(elKey));
- assertEquals(this.modelPropertiesSize, this.modelPropertiesSizeOriginal - 1);
- this.verifyPutProperty(propertyName, null);
-
- // Add original CacheTypeDefault
- ++this.propertiesTotal;
- ++this.modelPropertiesSize;
- this.persistenceUnitSetProperty(elKey, testValue1);
- this.verifyPutProperty(propertyName, testValue1);
-
- // Replace
- this.persistenceUnitSetProperty(elKey, testValue2);
- this.verifyPutProperty(propertyName, testValue2);
- }
-
- /**
- * Verifies the model's property identified by the given propertyName
- * Used in verifySetProperty() and verifyAddRemoveProperty
- *
- * @param propertyName
- * name of property to be verified
- * @param expectedValue
- * @throws Exception
- */
- protected void verifyPutProperty(String propertyName, Object expectedValue) throws Exception {
-
- this.verifyPutEvent(propertyName, this.getProperty(propertyName), expectedValue);
- }
-
- /**
- * Verifies the event of the put() action.
- *
- * @param propertyName
- * name of property to be verified
- * @param propertyValue
- * value of property
- * @param expectedValue
- * @throws Exception
- */
- protected void verifyPutEvent(String propertyName, Object propertyValue, Object expectedValue) {
-
- this.verifyEvent(propertyName);
- this.verifyEventValue(propertyValue, expectedValue);
- }
-
- /**
- * Performs the following tests:<br>
- * 1. verifies the new value of this.propertyChangedEvent<br>
- * 2. verifies the given value<br>
- */
- protected void verifyEventValue(Object value, Object expectedValue) {
- // verify event value
- assertEquals(expectedValue, this.propertyChangedEvent.getNewValue());
- assertEquals(expectedValue, value);
- }
-
- /**
- * Performs the following tests:<br>
- * 1. verifies that an event is fired<br>
- * 2. verifies that it is the correct event<br>
- * 3. verifies that a single event is fired<br>
- */
- protected void verifyEvent(String propertyName) {
- // verify event received
- assertNotNull("No Event Fired.", this.propertyChangedEvent);
- // verify event for the expected property
- assertEquals("Wrong Event.", this.propertyChangedEvent.getPropertyName(), propertyName);
- // verify event occurrence
- assertTrue("No Event Received.", this.propertyChangedEventCount > 0);
- assertTrue("Multiple Event Received (" + this.propertyChangedEventCount + ")",
- this.propertyChangedEventCount < 2);
- }
-
- protected void verifyHasNoListeners(ListValueModel<?> listValueModel) throws Exception {
- assertTrue(((AbstractModel) listValueModel).hasNoListChangeListeners(ListValueModel.LIST_VALUES));
- }
-
- protected void verifyHasListeners(ListValueModel<?> listValueModel) throws Exception {
- assertTrue(((AbstractModel) listValueModel).hasAnyListChangeListeners(ListValueModel.LIST_VALUES));
- }
-
- protected void verifyHasListeners(PersistenceUnitProperties model, String propertyName) throws Exception {
- assertTrue("Listener not added in setUp() - " + propertyName, ((AbstractModel) model).hasAnyPropertyChangeListeners(propertyName));
- }
-
- protected void verifyHasListeners(PropertyValueModel<?> pvm, String propertyName) throws Exception {
- assertTrue(((AbstractModel) pvm).hasAnyPropertyChangeListeners(propertyName));
- }
-
- protected void verifyPuHasProperty(String eclipseLinkPropertyName, String msg) {
- assertNotNull(msg + " - " + eclipseLinkPropertyName, this.getPersistenceUnit().getProperty(eclipseLinkPropertyName));
- }
-
- protected void verifyPuHasNotProperty(String eclipseLinkPropertyName, String msg) {
- assertNull(msg + " - " + eclipseLinkPropertyName, this.getPersistenceUnit().getProperty(eclipseLinkPropertyName));
- }
-
-}
diff --git a/jpa/tests/org.eclipse.jpt.eclipselink.core.tests/src/org/eclipse/jpt/eclipselink/core/tests/internal/context/persistence/caching/CachingAdapterTests.java b/jpa/tests/org.eclipse.jpt.eclipselink.core.tests/src/org/eclipse/jpt/eclipselink/core/tests/internal/context/persistence/caching/CachingAdapterTests.java
deleted file mode 100644
index 626b355717..0000000000
--- a/jpa/tests/org.eclipse.jpt.eclipselink.core.tests/src/org/eclipse/jpt/eclipselink/core/tests/internal/context/persistence/caching/CachingAdapterTests.java
+++ /dev/null
@@ -1,444 +0,0 @@
-/*******************************************************************************
- * Copyright (c) 2007, 2009 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.
- *
- * Contributors:
- * Oracle - initial API and implementation
- ******************************************************************************/
-package org.eclipse.jpt.eclipselink.core.tests.internal.context.persistence.caching;
-
-import org.eclipse.jpt.eclipselink.core.internal.context.persistence.PersistenceUnitProperties;
-import org.eclipse.jpt.eclipselink.core.internal.context.persistence.caching.CacheType;
-import org.eclipse.jpt.eclipselink.core.internal.context.persistence.caching.Caching;
-import org.eclipse.jpt.eclipselink.core.internal.context.persistence.caching.Entity;
-import org.eclipse.jpt.eclipselink.core.internal.context.persistence.caching.FlushClearCache;
-import org.eclipse.jpt.eclipselink.core.tests.internal.context.persistence.PersistenceUnitTestCase;
-import org.eclipse.jpt.utility.model.event.ListAddEvent;
-import org.eclipse.jpt.utility.model.event.ListChangeEvent;
-import org.eclipse.jpt.utility.model.event.ListClearEvent;
-import org.eclipse.jpt.utility.model.event.ListMoveEvent;
-import org.eclipse.jpt.utility.model.event.ListRemoveEvent;
-import org.eclipse.jpt.utility.model.event.ListReplaceEvent;
-import org.eclipse.jpt.utility.model.listener.ListChangeListener;
-import org.eclipse.jpt.utility.model.listener.PropertyChangeListener;
-
-/**
- * Tests the update of model objects by the Caching adapter when the
- * PersistenceUnit changes.
- */
-@SuppressWarnings("nls")
-public class CachingAdapterTests extends PersistenceUnitTestCase
-{
- private Caching caching;
- private ListChangeEvent entitiesEvent;
-
- public static final String ENTITY_TEST = "Employee";
- public static final String ENTITY_TEST_2 = "Address";
-
- public static final String CACHE_TYPE_DEFAULT_KEY = Caching.ECLIPSELINK_CACHE_TYPE_DEFAULT;
- public static final CacheType CACHE_TYPE_DEFAULT_TEST_VALUE = CacheType.soft_weak;
- public static final CacheType CACHE_TYPE_DEFAULT_TEST_VALUE_2 = CacheType.full;
-
- public static final String CACHE_SIZE_DEFAULT_KEY = Caching.ECLIPSELINK_CACHE_SIZE_DEFAULT;
- public static final Integer CACHE_SIZE_DEFAULT_TEST_VALUE = 12345;
- public static final Integer CACHE_SIZE_DEFAULT_TEST_VALUE_2 = 67890;
-
- public static final String SHARED_CACHE_DEFAULT_KEY = Caching.ECLIPSELINK_CACHE_SHARED_DEFAULT;
- public static final Boolean SHARED_CACHE_DEFAULT_TEST_VALUE = false;
- public static final Boolean SHARED_CACHE_DEFAULT_TEST_VALUE_2 = true;
-
- public static final String CACHE_TYPE_KEY = Caching.ECLIPSELINK_CACHE_TYPE + ENTITY_TEST;
- public static final CacheType CACHE_TYPE_TEST_VALUE = CacheType.soft_weak;
- public static final CacheType CACHE_TYPE_TEST_VALUE_2 = CacheType.full;
-
- public static final String SHARED_CACHE_KEY = Caching.ECLIPSELINK_SHARED_CACHE + ENTITY_TEST;
- public static final Boolean SHARED_CACHE_TEST_VALUE = false;
- public static final Boolean SHARED_CACHE_TEST_VALUE_2 = true;
-
- public static final String CACHE_SIZE_KEY = Caching.ECLIPSELINK_CACHE_SIZE + ENTITY_TEST;
- public static final Integer CACHE_SIZE_TEST_VALUE = 12345;
- public static final Integer CACHE_SIZE_TEST_VALUE_2 = 67890;
-
- public static final String FLUSH_CLEAR_CACHE_KEY = Caching.ECLIPSELINK_FLUSH_CLEAR_CACHE;
- public static final FlushClearCache FLUSH_CLEAR_CACHE_TEST_VALUE = FlushClearCache.drop;
- public static final FlushClearCache FLUSH_CLEAR_CACHE_TEST_VALUE_2 = FlushClearCache.merge;
-
- public CachingAdapterTests(String name) {
- super(name);
- }
-
- @Override
- protected void setUp() throws Exception {
- super.setUp();
- this.caching = this.getPersistenceUnit().getCaching();
- PropertyChangeListener propertyChangeListener = this.buildPropertyChangeListener();
-
- this.caching.addPropertyChangeListener(Caching.CACHE_TYPE_DEFAULT_PROPERTY, propertyChangeListener);
- this.caching.addPropertyChangeListener(Caching.CACHE_SIZE_DEFAULT_PROPERTY, propertyChangeListener);
- this.caching.addPropertyChangeListener(Caching.SHARED_CACHE_DEFAULT_PROPERTY, propertyChangeListener);
- this.caching.addPropertyChangeListener(Entity.CACHE_TYPE_PROPERTY, propertyChangeListener);
- this.caching.addPropertyChangeListener(Entity.CACHE_SIZE_PROPERTY, propertyChangeListener);
- this.caching.addPropertyChangeListener(Entity.SHARED_CACHE_PROPERTY, propertyChangeListener);
- this.caching.addPropertyChangeListener(Caching.FLUSH_CLEAR_CACHE_PROPERTY, propertyChangeListener);
-
- ListChangeListener entitiesChangeListener = this.buildEntitiesChangeListener();
- this.caching.addListChangeListener(Caching.ENTITIES_LIST, entitiesChangeListener);
- this.clearEvent();
- }
-
- /**
- * Initializes directly the PU properties before testing.
- */
- @Override
- protected void populatePu() {
- this.modelPropertiesSizeOriginal = 7;
- this.propertiesTotal = this.modelPropertiesSizeOriginal + 4; // 4 misc properties
- this.modelPropertiesSize = this.modelPropertiesSizeOriginal;
-
- this.persistenceUnitSetProperty("misc.property.1", "value.1");
- this.persistenceUnitSetProperty(CACHE_TYPE_DEFAULT_KEY, CACHE_TYPE_DEFAULT_TEST_VALUE);
- this.persistenceUnitSetProperty("misc.property.2", "value.2");
- this.persistenceUnitSetProperty(CACHE_SIZE_DEFAULT_KEY, CACHE_SIZE_DEFAULT_TEST_VALUE);
- this.persistenceUnitSetProperty(SHARED_CACHE_DEFAULT_KEY, SHARED_CACHE_DEFAULT_TEST_VALUE);
- this.persistenceUnitSetProperty("misc.property.3", "value.3");
- this.persistenceUnitSetProperty("misc.property.4", "value.4");
- this.persistenceUnitSetProperty(CACHE_SIZE_KEY, CACHE_SIZE_TEST_VALUE);
- this.persistenceUnitSetProperty(CACHE_TYPE_KEY, CACHE_TYPE_TEST_VALUE);
- this.persistenceUnitSetProperty(SHARED_CACHE_KEY, SHARED_CACHE_TEST_VALUE);
- this.persistenceUnitSetProperty(FLUSH_CLEAR_CACHE_KEY, FLUSH_CLEAR_CACHE_TEST_VALUE);
- return;
- }
-
- // ********** Listeners **********
- private ListChangeListener buildEntitiesChangeListener() {
- return new ListChangeListener() {
- public void itemsAdded(ListAddEvent e) {
- CachingAdapterTests.this.throwUnsupportedOperationException(e);
- }
-
- public void itemsRemoved(ListRemoveEvent e) {
- CachingAdapterTests.this.throwUnsupportedOperationException(e);
- }
-
- public void itemsReplaced(ListReplaceEvent e) {
- CachingAdapterTests.this.throwUnsupportedOperationException(e);
- }
-
- public void itemsMoved(ListMoveEvent e) {
- CachingAdapterTests.this.throwUnsupportedOperationException(e);
- }
-
- public void listCleared(ListClearEvent e) {
- CachingAdapterTests.this.throwUnsupportedOperationException(e);
- }
-
- public void listChanged(ListChangeEvent e) {
- CachingAdapterTests.this.entityChanged(e);
- }
- };
- }
-
- @Override
- protected void clearEvent() {
- super.clearEvent();
- this.entitiesEvent = null;
- }
-
- void entityChanged(ListChangeEvent e) {
- this.entitiesEvent = e;
- }
-
- // ********** entities list **********
- public void testEntitiesList() throws Exception {
- // add
- this.clearEvent();
- int originalNumberOfEntities = this.caching.entitiesSize();
-
- this.caching.addEntity(ENTITY_TEST_2);
- assertEquals("Entity not added", this.caching.entitiesSize(), originalNumberOfEntities + 1);
-
- // verify event received
- assertNotNull("No Event Fired.", this.entitiesEvent);
- // verify event for the expected property
- assertEquals("Wrong Event.", this.entitiesEvent.getListName(), Caching.ENTITIES_LIST);
-
- // remove
- this.clearEvent();
- this.caching.removeEntity(ENTITY_TEST_2);
- assertEquals("Entity not removed", this.caching.entitiesSize(), originalNumberOfEntities);
-
- // verify event received
- assertNotNull("No Event Fired.", this.entitiesEvent);
- // verify event for the expected property
- assertEquals("Wrong Event.", this.entitiesEvent.getListName(), Caching.ENTITIES_LIST);
- }
-
- // ********** CacheTypeDefault **********
- /**
- * Tests the update of CacheTypeDefault property by the Caching adapter when
- * the PU or the model changes.
- */
- public void testSetCacheTypeDefault() throws Exception {
- this.verifyModelInitialized(
- CACHE_TYPE_DEFAULT_KEY,
- CACHE_TYPE_DEFAULT_TEST_VALUE);
- this.verifySetProperty(
- CACHE_TYPE_DEFAULT_KEY,
- CACHE_TYPE_DEFAULT_TEST_VALUE,
- CACHE_TYPE_DEFAULT_TEST_VALUE_2);
- }
-
- public void testAddRemoveCacheTypeDefault() throws Exception {
- this.verifyAddRemoveProperty(
- CACHE_TYPE_DEFAULT_KEY,
- CACHE_TYPE_DEFAULT_TEST_VALUE,
- CACHE_TYPE_DEFAULT_TEST_VALUE_2);
- }
-
- // ********** CacheSizeDefault **********
- /**
- * Tests the update of CacheSizeDefault property by the Caching adapter when
- * the PU or the model changes.
- */
- public void testSetCacheSizeDefault() throws Exception {
- this.verifyModelInitialized(
- CACHE_SIZE_DEFAULT_KEY,
- CACHE_SIZE_DEFAULT_TEST_VALUE);
- this.verifySetProperty(
- CACHE_SIZE_DEFAULT_KEY,
- CACHE_SIZE_DEFAULT_TEST_VALUE,
- CACHE_SIZE_DEFAULT_TEST_VALUE_2);
- }
-
- public void testAddRemoveCacheSizeDefault() throws Exception {
- this.verifyAddRemoveProperty(
- CACHE_SIZE_DEFAULT_KEY,
- CACHE_SIZE_DEFAULT_TEST_VALUE,
- CACHE_SIZE_DEFAULT_TEST_VALUE_2);
- }
-
- // ********** SharedCacheDefault **********
- public void testSetSharedCacheDefault() throws Exception {
- this.verifyModelInitialized(
- SHARED_CACHE_DEFAULT_KEY,
- SHARED_CACHE_DEFAULT_TEST_VALUE);
- this.verifySetProperty(
- SHARED_CACHE_DEFAULT_KEY,
- SHARED_CACHE_DEFAULT_TEST_VALUE,
- SHARED_CACHE_DEFAULT_TEST_VALUE_2);
- }
-
- public void testAddRemoveSharedCacheDefault() throws Exception {
- this.verifyAddRemoveProperty(
- SHARED_CACHE_DEFAULT_KEY,
- SHARED_CACHE_DEFAULT_TEST_VALUE,
- SHARED_CACHE_DEFAULT_TEST_VALUE_2);
- }
-
- // ********** CacheType **********
- /**
- * Tests the update of CacheType property by the Caching adapter when the PU
- * or the model changes.
- */
- public void testSetCacheType() throws Exception {
- this.verifyModelInitialized(
- CACHE_TYPE_KEY,
- CACHE_TYPE_TEST_VALUE);
- this.verifySetCachingProperty(
- Entity.CACHE_TYPE_PROPERTY,
- CACHE_TYPE_KEY,
- CACHE_TYPE_TEST_VALUE,
- CACHE_TYPE_TEST_VALUE_2);
- }
-
- public void testAddRemoveCacheType() throws Exception {
- this.verifyAddRemoveCachingProperty(
- Entity.CACHE_TYPE_PROPERTY,
- CACHE_TYPE_KEY,
- CACHE_TYPE_TEST_VALUE,
- CACHE_TYPE_TEST_VALUE_2);
- }
-
- // ********** CacheSize **********
- /**
- * Tests the update of CacheSize property by the Caching adapter when the PU
- * or the model changes.
- */
- public void testSetCacheSize() throws Exception {
- this.verifyModelInitialized(
- CACHE_SIZE_KEY,
- CACHE_SIZE_TEST_VALUE);
- this.verifySetCachingProperty(
- Entity.CACHE_SIZE_PROPERTY,
- CACHE_SIZE_KEY,
- CACHE_SIZE_TEST_VALUE,
- CACHE_SIZE_TEST_VALUE_2);
- }
-
- public void testAddRemoveCacheSize() throws Exception {
- this.verifyAddRemoveCachingProperty(
- Entity.CACHE_SIZE_PROPERTY,
- CACHE_SIZE_KEY,
- CACHE_SIZE_TEST_VALUE,
- CACHE_SIZE_TEST_VALUE_2);
- }
-
- // ********** SharedCache **********
- /**
- * Tests the update of SharedCache property by the Caching adapter when the
- * PU or the model changes.
- */
- public void testSetSharedCache() throws Exception {
- this.verifyModelInitialized(
- SHARED_CACHE_KEY,
- SHARED_CACHE_TEST_VALUE);
- this.verifySetCachingProperty(
- Entity.SHARED_CACHE_PROPERTY,
- SHARED_CACHE_KEY,
- SHARED_CACHE_TEST_VALUE,
- SHARED_CACHE_TEST_VALUE_2);
- }
-
- public void testAddRemoveSharedCache() throws Exception {
- this.verifyAddRemoveCachingProperty(
- Entity.SHARED_CACHE_PROPERTY,
- SHARED_CACHE_KEY,
- SHARED_CACHE_TEST_VALUE,
- SHARED_CACHE_TEST_VALUE_2);
- }
-
- // ********** FlushClearCache tests **********
- public void testSetFlushClearCache() throws Exception {
- this.verifyModelInitialized(
- FLUSH_CLEAR_CACHE_KEY,
- FLUSH_CLEAR_CACHE_TEST_VALUE);
- this.verifySetProperty(
- FLUSH_CLEAR_CACHE_KEY,
- FLUSH_CLEAR_CACHE_TEST_VALUE,
- FLUSH_CLEAR_CACHE_TEST_VALUE_2);
- }
-
- public void testAddRemoveFlushClearCache() throws Exception {
- this.verifyAddRemoveProperty(
- FLUSH_CLEAR_CACHE_KEY,
- FLUSH_CLEAR_CACHE_TEST_VALUE,
- FLUSH_CLEAR_CACHE_TEST_VALUE_2);
- }
-
- // ****** convenience methods *******
- @Override
- protected PersistenceUnitProperties getModel() {
- return this.caching;
- }
-
- protected void verifySetCachingProperty(String propertyName, String key, Object testValue1, Object testValue2) throws Exception {
- // Replace
- this.persistenceUnitSetProperty(key, testValue2);
- this.verifyPutCachingProperty(propertyName, ENTITY_TEST, testValue2);
-
- // Replace by setting model object
- this.clearEvent();
- this.setCachingProperty(propertyName, ENTITY_TEST, testValue1);
- this.verifyPutCachingProperty(propertyName, ENTITY_TEST, testValue1);
- }
-
- protected void verifyAddRemoveCachingProperty(String propertyName, String key, Object testValue1, Object testValue2) throws Exception {
- // Remove
- this.clearEvent();
- --this.propertiesTotal;
- --this.modelPropertiesSize;
- this.getPersistenceUnit().removeProperty(key);
- assertNull(this.getPersistenceUnit().getProperty(key));
- assertEquals(this.modelPropertiesSize, this.modelPropertiesSizeOriginal - 1);
- this.verifyPutCachingProperty(propertyName, ENTITY_TEST, null);
-
- // Add original Property
- ++this.propertiesTotal;
- ++this.modelPropertiesSize;
- this.persistenceUnitSetProperty(key, testValue1);
- this.verifyPutCachingProperty(propertyName, ENTITY_TEST, testValue1);
-
- // Set to null
- this.persistenceUnitSetProperty(key, null);
- this.verifyPutCachingProperty(propertyName, ENTITY_TEST, null);
-
- // Replace
- this.persistenceUnitSetProperty(key, testValue2);
- this.verifyPutCachingProperty(propertyName, ENTITY_TEST, testValue2);
- }
-
- protected void verifyPutCachingProperty(String propertyName, String entityName, Object expectedValue) throws Exception {
- this.verifyEvent(propertyName);
- this.verifyCachingEvent(propertyName, entityName, expectedValue);
- }
-
- protected void verifyCachingEvent(String propertyName, String entityName, Object expectedValue) throws Exception {
- // verify event value
- Entity entity = (Entity) this.propertyChangedEvent.getNewValue();
- if (propertyName.equals(Entity.CACHE_TYPE_PROPERTY)) {
- assertEquals(expectedValue, entity.getParent().getCacheTypeOf(entityName));
- assertEquals(expectedValue, this.caching.getCacheTypeOf(entityName));
- }
- else if (propertyName.equals(Entity.CACHE_SIZE_PROPERTY)) {
- assertEquals(expectedValue, entity.getParent().getCacheSizeOf(entityName));
- assertEquals(expectedValue, this.caching.getCacheSizeOf(entityName));
- }
- else if (propertyName.equals(Entity.SHARED_CACHE_PROPERTY)) {
- assertEquals(expectedValue, entity.getParent().getSharedCacheOf(entityName));
- assertEquals(expectedValue, this.caching.getSharedCacheOf(entityName));
- }
- else {
- this.throwMissingDefinition("verifyCachingEvent", propertyName);
- }
- }
-
- // ********** get/set property **********
- @Override
- protected void setProperty(String propertyName, Object newValue) throws Exception {
- if (propertyName.equals(Caching.CACHE_TYPE_DEFAULT_PROPERTY))
- this.caching.setCacheTypeDefault((CacheType) newValue);
- else if (propertyName.equals(Caching.CACHE_SIZE_DEFAULT_PROPERTY))
- this.caching.setCacheSizeDefault((Integer) newValue);
- else if (propertyName.equals(Caching.SHARED_CACHE_DEFAULT_PROPERTY))
- this.caching.setSharedCacheDefault((Boolean) newValue);
- else if (propertyName.equals(Caching.FLUSH_CLEAR_CACHE_PROPERTY))
- this.caching.setFlushClearCache((FlushClearCache) newValue);
- else
- this.throwMissingDefinition("setProperty", propertyName);
- }
-
- protected void setCachingProperty(String propertyName, String entityName, Object newValue) throws NoSuchFieldException {
- if (propertyName.equals(Entity.CACHE_TYPE_PROPERTY))
- this.caching.setCacheTypeOf(entityName, (CacheType) newValue);
- else if (propertyName.equals(Entity.CACHE_SIZE_PROPERTY))
- this.caching.setCacheSizeOf(entityName, (Integer) newValue);
- else if (propertyName.equals(Entity.SHARED_CACHE_PROPERTY))
- this.caching.setSharedCacheOf(entityName, (Boolean) newValue);
- else
- this.throwMissingDefinition("setCachingProperty", propertyName);
- }
-
- @Override
- protected Object getProperty(String propertyName) throws NoSuchFieldException {
- Object modelValue = null;
- if (propertyName.equals(Caching.CACHE_TYPE_DEFAULT_PROPERTY))
- modelValue = this.caching.getCacheTypeDefault();
- else if (propertyName.equals(Caching.CACHE_SIZE_DEFAULT_PROPERTY))
- modelValue = this.caching.getCacheSizeDefault();
- else if (propertyName.equals(Caching.SHARED_CACHE_DEFAULT_PROPERTY))
- modelValue = this.caching.getSharedCacheDefault();
- else if (propertyName.equals(Entity.CACHE_SIZE_PROPERTY))
- modelValue = this.caching.getCacheSizeOf(ENTITY_TEST);
- else if (propertyName.equals(Entity.CACHE_TYPE_PROPERTY))
- modelValue = this.caching.getCacheTypeOf(ENTITY_TEST);
- else if (propertyName.equals(Entity.SHARED_CACHE_PROPERTY))
- modelValue = this.caching.getSharedCacheOf(ENTITY_TEST);
- else if (propertyName.equals(Caching.FLUSH_CLEAR_CACHE_PROPERTY))
- modelValue = this.caching.getFlushClearCache();
- else
- this.throwMissingDefinition("getProperty", propertyName);
- return modelValue;
- }
-}
diff --git a/jpa/tests/org.eclipse.jpt.eclipselink.core.tests/src/org/eclipse/jpt/eclipselink/core/tests/internal/context/persistence/caching/CachingValueModelTests.java b/jpa/tests/org.eclipse.jpt.eclipselink.core.tests/src/org/eclipse/jpt/eclipselink/core/tests/internal/context/persistence/caching/CachingValueModelTests.java
deleted file mode 100644
index 4012ebb662..0000000000
--- a/jpa/tests/org.eclipse.jpt.eclipselink.core.tests/src/org/eclipse/jpt/eclipselink/core/tests/internal/context/persistence/caching/CachingValueModelTests.java
+++ /dev/null
@@ -1,444 +0,0 @@
-/*******************************************************************************
- * Copyright (c) 2008, 2009 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.
- *
- * Contributors:
- * Oracle - initial API and implementation
- *******************************************************************************/
-package org.eclipse.jpt.eclipselink.core.tests.internal.context.persistence.caching;
-
-import org.eclipse.jpt.eclipselink.core.internal.context.persistence.PersistenceUnitProperties;
-import org.eclipse.jpt.eclipselink.core.internal.context.persistence.caching.CacheType;
-import org.eclipse.jpt.eclipselink.core.internal.context.persistence.caching.Caching;
-import org.eclipse.jpt.eclipselink.core.internal.context.persistence.caching.Entity;
-import org.eclipse.jpt.eclipselink.core.tests.internal.context.persistence.PersistenceUnitTestCase;
-import org.eclipse.jpt.utility.internal.model.AbstractModel;
-import org.eclipse.jpt.utility.internal.model.value.PropertyAspectAdapter;
-import org.eclipse.jpt.utility.internal.model.value.SimplePropertyValueModel;
-import org.eclipse.jpt.utility.model.event.PropertyChangeEvent;
-import org.eclipse.jpt.utility.model.listener.PropertyChangeListener;
-import org.eclipse.jpt.utility.model.value.PropertyValueModel;
-import org.eclipse.jpt.utility.model.value.WritablePropertyValueModel;
-
-/**
- * CachingValueModelTests
- */
-@SuppressWarnings("nls")
-public class CachingValueModelTests extends PersistenceUnitTestCase
-{
- private Caching caching;
- private PropertyValueModel<Caching> cachingHolder;
-
- private WritablePropertyValueModel<CacheType> cacheTypeHolder;
- private PropertyChangeListener cacheTypeListener;
- private PropertyChangeEvent cacheTypeEvent;
-
- private WritablePropertyValueModel<Boolean> sharedCacheHolder;
- private PropertyChangeListener sharedCacheListener;
- private PropertyChangeEvent sharedCacheEvent;
-
- private WritablePropertyValueModel<CacheType> cacheTypeDefaultHolder;
- private PropertyChangeListener cacheTypeDefaultListener;
- private PropertyChangeEvent cacheTypeDefaultEvent;
-
- private WritablePropertyValueModel<Boolean> sharedCacheDefaultHolder;
- private PropertyChangeListener sharedCacheDefaultListener;
- private PropertyChangeEvent sharedCacheDefaultEvent;
-
- public static final String ENTITY_NAME_TEST_VALUE = "Employee";
- public static final CacheType CACHE_TYPE_TEST_VALUE = CacheType.hard_weak;
- public static final Boolean SHARED_CACHE_TEST_VALUE = Boolean.FALSE;
- public static final CacheType CACHE_TYPE_DEFAULT_TEST_VALUE = CacheType.weak;
- public static final Boolean SHARED_CACHE_DEFAULT_TEST_VALUE = Boolean.FALSE;
-
- public CachingValueModelTests(String name) {
- super(name);
- }
-
- @Override
- protected void setUp() throws Exception {
- super.setUp();
- this.caching = this.subject.getCaching(); // Subject
- this.cachingHolder = new SimplePropertyValueModel<Caching>(this.caching);
-
- this.cacheTypeHolder = this.buildCacheTypeAA(this.cachingHolder);
- this.cacheTypeListener = this.buildCacheTypeChangeListener();
- this.cacheTypeHolder.addPropertyChangeListener(PropertyValueModel.VALUE, this.cacheTypeListener);
- this.cacheTypeEvent = null;
-
- this.sharedCacheHolder = this.buildSharedCacheAA(this.cachingHolder);
- this.sharedCacheListener = this.buildSharedCacheChangeListener();
- this.sharedCacheHolder.addPropertyChangeListener(PropertyValueModel.VALUE, this.sharedCacheListener);
- this.sharedCacheEvent = null;
-
- this.cacheTypeDefaultHolder = this.buildCacheTypeDefaultAA(this.cachingHolder);
- this.cacheTypeDefaultListener = this.buildCacheTypeDefaultChangeListener();
- this.cacheTypeDefaultHolder.addPropertyChangeListener(PropertyValueModel.VALUE, this.cacheTypeDefaultListener);
- this.cacheTypeDefaultEvent = null;
-
- this.sharedCacheDefaultHolder = this.buildSharedCacheDefaultAA(this.cachingHolder);
- this.sharedCacheDefaultListener = this.buildSharedCacheDefaultChangeListener();
- this.sharedCacheDefaultHolder.addPropertyChangeListener(PropertyValueModel.VALUE, this.sharedCacheDefaultListener);
- this.sharedCacheDefaultEvent = null;
- }
-
- public void testHasListeners() {
- AbstractModel subjectCaching = (AbstractModel) this.caching; // Subject
- PropertyAspectAdapter<Caching, CacheType> cacheTypeAA =
- (PropertyAspectAdapter<Caching, CacheType>) this.cacheTypeHolder;
- assertTrue(cacheTypeAA.hasAnyPropertyChangeListeners(PropertyValueModel.VALUE));
- assertTrue(subjectCaching.hasAnyPropertyChangeListeners(Caching.CACHE_TYPE_PROPERTY));
-
- cacheTypeAA.removePropertyChangeListener(PropertyValueModel.VALUE, this.cacheTypeListener);
- assertFalse(subjectCaching.hasAnyPropertyChangeListeners(Caching.CACHE_TYPE_PROPERTY));
- assertFalse(cacheTypeAA.hasAnyPropertyChangeListeners(PropertyValueModel.VALUE));
-
- PropertyAspectAdapter<Caching, Boolean> sharedCacheAA =
- (PropertyAspectAdapter<Caching, Boolean>) this.sharedCacheHolder;
- assertTrue(sharedCacheAA.hasAnyPropertyChangeListeners(PropertyValueModel.VALUE));
- assertTrue(subjectCaching.hasAnyPropertyChangeListeners(Caching.SHARED_CACHE_PROPERTY));
-
- sharedCacheAA.removePropertyChangeListener(PropertyValueModel.VALUE, this.sharedCacheListener);
- assertFalse(subjectCaching.hasAnyPropertyChangeListeners(Caching.SHARED_CACHE_PROPERTY));
- assertFalse(sharedCacheAA.hasAnyPropertyChangeListeners(PropertyValueModel.VALUE));
-
- PropertyAspectAdapter<Caching, CacheType> cacheTypeDefaultAA =
- (PropertyAspectAdapter<Caching, CacheType>) this.cacheTypeDefaultHolder;
- assertTrue(cacheTypeDefaultAA.hasAnyPropertyChangeListeners(PropertyValueModel.VALUE));
- assertTrue(subjectCaching.hasAnyPropertyChangeListeners(Caching.CACHE_TYPE_DEFAULT_PROPERTY));
-
- cacheTypeDefaultAA.removePropertyChangeListener(PropertyValueModel.VALUE, this.cacheTypeDefaultListener);
- assertFalse(subjectCaching.hasAnyPropertyChangeListeners(Caching.CACHE_TYPE_DEFAULT_PROPERTY));
- assertFalse(cacheTypeDefaultAA.hasAnyPropertyChangeListeners(PropertyValueModel.VALUE));
-
- PropertyAspectAdapter<Caching, Boolean> sharedCacheDefaultAA =
- (PropertyAspectAdapter<Caching, Boolean>) this.sharedCacheDefaultHolder;
- assertTrue(sharedCacheDefaultAA.hasAnyPropertyChangeListeners(PropertyValueModel.VALUE));
- assertTrue(subjectCaching.hasAnyPropertyChangeListeners(Caching.SHARED_CACHE_DEFAULT_PROPERTY));
-
- sharedCacheDefaultAA.removePropertyChangeListener(PropertyValueModel.VALUE, this.sharedCacheDefaultListener);
- assertFalse(subjectCaching.hasAnyPropertyChangeListeners(Caching.SHARED_CACHE_DEFAULT_PROPERTY));
- assertFalse(sharedCacheDefaultAA.hasAnyPropertyChangeListeners(PropertyValueModel.VALUE));
- }
-
- /**
- * Initializes directly the PU properties before testing.
- */
- @Override
- protected void populatePu() {
- this.persistenceUnitSetProperty(
- Caching.ECLIPSELINK_CACHE_TYPE + ENTITY_NAME_TEST_VALUE,
- CACHE_TYPE_TEST_VALUE);
- this.persistenceUnitSetProperty(
- Caching.ECLIPSELINK_SHARED_CACHE + ENTITY_NAME_TEST_VALUE,
- SHARED_CACHE_TEST_VALUE);
- this.persistenceUnitSetProperty(
- Caching.ECLIPSELINK_CACHE_TYPE_DEFAULT,
- CACHE_TYPE_DEFAULT_TEST_VALUE);
- this.persistenceUnitSetProperty(
- Caching.ECLIPSELINK_CACHE_SHARED_DEFAULT,
- SHARED_CACHE_DEFAULT_TEST_VALUE);
- return;
- }
-
- @Override
- protected PersistenceUnitProperties getModel() {
- return this.caching;
- }
-
- /** ****** CacheType ******* */
- private WritablePropertyValueModel<CacheType> buildCacheTypeAA(PropertyValueModel<Caching> subjectHolder) {
- return new PropertyAspectAdapter<Caching, CacheType>(subjectHolder, Caching.CACHE_TYPE_PROPERTY) {
- @Override
- protected CacheType buildValue_() {
- return this.subject.getCacheTypeOf(ENTITY_NAME_TEST_VALUE);
- }
-
- @Override
- protected void setValue_(CacheType enumValue) {
- this.subject.setCacheTypeOf(ENTITY_NAME_TEST_VALUE, enumValue);
- }
- };
- }
-
- private PropertyChangeListener buildCacheTypeChangeListener() {
- return new PropertyChangeListener() {
- public void propertyChanged(PropertyChangeEvent e) {
- CachingValueModelTests.this.cacheTypeEvent = e;
- }
- };
- }
-
- /** ****** SharedCache ******* */
- private WritablePropertyValueModel<Boolean> buildSharedCacheAA(PropertyValueModel<Caching> subjectHolder) {
- return new PropertyAspectAdapter<Caching, Boolean>(subjectHolder, Caching.SHARED_CACHE_PROPERTY) {
- @Override
- protected Boolean buildValue_() {
- return this.subject.getSharedCacheOf(ENTITY_NAME_TEST_VALUE);
- }
-
- @Override
- protected void setValue_(Boolean enumValue) {
- this.subject.setSharedCacheOf(ENTITY_NAME_TEST_VALUE, enumValue);
- }
- };
- }
-
- private PropertyChangeListener buildSharedCacheChangeListener() {
- return new PropertyChangeListener() {
- public void propertyChanged(PropertyChangeEvent e) {
- CachingValueModelTests.this.sharedCacheEvent = e;
- }
- };
- }
-
- /** ****** CacheTypeDefault ******* */
- private WritablePropertyValueModel<CacheType> buildCacheTypeDefaultAA(PropertyValueModel<Caching> subjectHolder) {
- return new PropertyAspectAdapter<Caching, CacheType>(subjectHolder, Caching.CACHE_TYPE_DEFAULT_PROPERTY) {
- @Override
- protected CacheType buildValue_() {
- return this.subject.getCacheTypeDefault();
- }
-
- @Override
- protected void setValue_(CacheType enumValue) {
- this.subject.setCacheTypeDefault(enumValue);
- }
- };
- }
-
- private PropertyChangeListener buildCacheTypeDefaultChangeListener() {
- return new PropertyChangeListener() {
- public void propertyChanged(PropertyChangeEvent e) {
- CachingValueModelTests.this.cacheTypeDefaultEvent = e;
- }
- };
- }
-
- /** ****** SharedCacheDefault ******* */
- private WritablePropertyValueModel<Boolean> buildSharedCacheDefaultAA(PropertyValueModel<Caching> subjectHolder) {
- return new PropertyAspectAdapter<Caching, Boolean>(subjectHolder, Caching.SHARED_CACHE_DEFAULT_PROPERTY) {
- @Override
- protected Boolean buildValue_() {
- return this.subject.getSharedCacheDefault();
- }
-
- @Override
- protected void setValue_(Boolean enumValue) {
- this.subject.setSharedCacheDefault(enumValue);
- }
- };
- }
-
- private PropertyChangeListener buildSharedCacheDefaultChangeListener() {
- return new PropertyChangeListener() {
- public void propertyChanged(PropertyChangeEvent e) {
- CachingValueModelTests.this.sharedCacheDefaultEvent = e;
- }
- };
- }
-
- /** ****** Basic Entity's Properties Tests ******* */
-
- public void testClone() {
- Entity entity = this.buildEntity("TestEntity", CacheType.full, 100, true);
-
- this.verifyClone(entity, entity.clone());
- }
-
- public void testEquals() {
- Entity entity1 = this.buildEntity("TestEntityA", CacheType.full, 100, true);
- Entity entity2 = this.buildEntity("TestEntityB", CacheType.full, 100, true);
- assertEquals(entity1, entity2);
- Entity entity3 = this.buildEntity("TestEntityC", CacheType.full, 100, true);
- assertEquals(entity1, entity3);
- assertEquals(entity2, entity3);
- }
-
- public void testIsEmpty() {
- Entity entity = this.buildEntity("TestEntity");
- assertTrue(entity.isEmpty());
- this.caching.setCacheSizeOf(entity.getName(), 100);
- assertFalse(entity.isEmpty());
- }
-
- private void verifyClone(Entity original, Entity clone) {
- assertNotSame(original, clone);
- assertEquals(original, original);
- assertEquals(original, clone);
- }
-
- private Entity buildEntity(String name) {
- return this.caching.addEntity(name);
- }
-
- private Entity buildEntity(String name, CacheType cacheType, Integer size, Boolean isShared) {
- Entity entity = this.caching.addEntity(name);
- this.caching.setCacheTypeOf(entity.getName(), cacheType);
- this.caching.setCacheSizeOf(entity.getName(), size);
- this.caching.setSharedCacheOf(entity.getName(), isShared);
- return entity;
- }
-
- /** ****** Caching Tests ******* */
- public void testValue() {
- /** ****** CacheType - defaults for entity level caching are equal to the persistence unit settings ******* */
- this.verifyCacheTypeAAValue(CACHE_TYPE_TEST_VALUE);
- assertEquals(this.caching.getCacheTypeDefault(), this.caching.getDefaultCacheType());
- /** ****** SharedCache - defaults for entity level caching are equal to the persistence unit settings ******* */
- this.verifySharedCacheAAValue(SHARED_CACHE_TEST_VALUE);
- assertEquals(this.caching.getSharedCacheDefault(), this.caching.getDefaultSharedCache());
- /** ****** CacheTypeDefault ******* */
- this.verifyCacheTypeDefaultAAValue(CACHE_TYPE_DEFAULT_TEST_VALUE);
- assertEquals(Caching.DEFAULT_CACHE_TYPE_DEFAULT, this.caching.getDefaultCacheTypeDefault());
- /** ****** SharedCacheDefault ******* */
- this.verifySharedCacheDefaultAAValue(SHARED_CACHE_DEFAULT_TEST_VALUE);
- assertEquals(Caching.DEFAULT_SHARED_CACHE_DEFAULT, this.caching.getDefaultSharedCacheDefault());
- }
-
- public void testSetValue() throws Exception {
- /** ****** CacheType ******* */
- this.cacheTypeEvent = null;
- this.verifyHasListeners(this.cacheTypeHolder, PropertyValueModel.VALUE);
- CacheType newCacheType = CacheType.full;
- // Modify the property holder
- this.cacheTypeHolder.setValue(newCacheType);
- this.verifyCacheTypeAAValue(newCacheType);
- assertNotNull(this.cacheTypeEvent);
- /** ****** SharedCache ******* */
- this.sharedCacheEvent = null;
- this.verifyHasListeners(this.sharedCacheHolder, PropertyValueModel.VALUE);
- Boolean newSharedCache = !SHARED_CACHE_TEST_VALUE;
- // Modify the property holder
- this.sharedCacheHolder.setValue(newSharedCache);
- this.verifySharedCacheAAValue(newSharedCache);
- assertNotNull(this.sharedCacheEvent);
- /** ****** CacheTypeDefault ******* */
- this.cacheTypeDefaultEvent = null;
- this.verifyHasListeners(this.cacheTypeDefaultHolder, PropertyValueModel.VALUE);
- CacheType newCacheTypeDefault = CacheType.none;
- // Modify the property holder
- this.cacheTypeDefaultHolder.setValue(newCacheTypeDefault);
- this.verifyCacheTypeDefaultAAValue(newCacheTypeDefault);
- assertNotNull(this.cacheTypeDefaultEvent);
- /** ****** SharedCacheDefault ******* */
- this.sharedCacheDefaultEvent = null;
- this.verifyHasListeners(this.sharedCacheDefaultHolder, PropertyValueModel.VALUE);
- Boolean newSharedCacheDefault = !SHARED_CACHE_DEFAULT_TEST_VALUE;
- // Modify the property holder
- this.sharedCacheDefaultHolder.setValue(newSharedCacheDefault);
- this.verifySharedCacheDefaultAAValue(newSharedCacheDefault);
- assertNotNull(this.sharedCacheDefaultEvent);
- }
-
- public void testSetNullValue() {
- String notDeleted = "Property not deleted";
- /** ****** CacheType ******* */
- this.cacheTypeEvent = null;
- // Setting the property holder
- this.cacheTypeHolder.setValue(null);
- // testing Holder
- this.verifyCacheTypeAAValue(null);
- assertNotNull(this.cacheTypeEvent);
- // testing PU properties
- this.verifyPuHasNotProperty(Caching.ECLIPSELINK_CACHE_TYPE + ENTITY_NAME_TEST_VALUE, notDeleted);
- /** ****** SharedCache ******* */
- this.sharedCacheEvent = null;
- // Setting the property holder
- this.sharedCacheHolder.setValue(null);
- // testing Holder
- this.verifySharedCacheAAValue(null);
- assertNotNull(this.sharedCacheEvent);
- // testing PU properties
- this.verifyPuHasNotProperty(Caching.ECLIPSELINK_SHARED_CACHE + ENTITY_NAME_TEST_VALUE, notDeleted);
- /** ****** CacheTypeDefault ******* */
- this.cacheTypeDefaultEvent = null;
- // Setting the property holder
- this.cacheTypeDefaultHolder.setValue(null);
- // testing Holder
- this.verifyCacheTypeDefaultAAValue(null);
- assertNotNull(this.cacheTypeDefaultEvent);
- // testing PU properties
- this.verifyPuHasNotProperty(Caching.ECLIPSELINK_CACHE_TYPE_DEFAULT, notDeleted);
- /** ****** SharedCacheDefault ******* */
- this.sharedCacheDefaultEvent = null;
- // Setting the property holder
- this.sharedCacheDefaultHolder.setValue(null);
- // testing Holder
- this.verifySharedCacheDefaultAAValue(null);
- assertNotNull(this.sharedCacheDefaultEvent);
- // testing PU properties
- this.verifyPuHasNotProperty(Caching.ECLIPSELINK_CACHE_SHARED_DEFAULT, notDeleted);
- }
-
- /** ****** convenience methods ******* */
- /**
- * Performs three value tests:<br>
- * 1. subject value<br>
- * 2. aspect adapter value<br>
- * 3. persistenceUnit property value<br>
- */
- protected void verifyCacheTypeAAValue(CacheType testValue) {
- this.verifyAAValue(
- testValue,
- this.caching.getCacheTypeOf(ENTITY_NAME_TEST_VALUE),
- this.cacheTypeHolder,
- Caching.ECLIPSELINK_CACHE_TYPE + ENTITY_NAME_TEST_VALUE);
- }
-
- /**
- * Performs three value tests:<br>
- * 1. subject value<br>
- * 2. aspect adapter value<br>
- * 3. persistenceUnit property value<br>
- */
- protected void verifySharedCacheAAValue(Boolean testValue) {
- this.verifyAAValue(
- testValue,
- this.caching.getSharedCacheOf(ENTITY_NAME_TEST_VALUE),
- this.sharedCacheHolder,
- Caching.ECLIPSELINK_SHARED_CACHE + ENTITY_NAME_TEST_VALUE);
- }
-
- /**
- * Performs three value tests:<br>
- * 1. subject value<br>
- * 2. aspect adapter value<br>
- * 3. persistenceUnit property value<br>
- */
- protected void verifyCacheTypeDefaultAAValue(CacheType testValue) {
- this.verifyAAValue(
- testValue,
- this.caching.getCacheTypeDefault(),
- this.cacheTypeDefaultHolder,
- Caching.ECLIPSELINK_CACHE_TYPE_DEFAULT);
- }
-
- /**
- * Performs three value tests:<br>
- * 1. subject value<br>
- * 2. aspect adapter value<br>
- * 3. persistenceUnit property value<br>
- */
- protected void verifySharedCacheDefaultAAValue(Boolean testValue) {
- this.verifyAAValue(
- testValue,
- this.caching.getSharedCacheDefault(),
- this.sharedCacheDefaultHolder,
- Caching.ECLIPSELINK_CACHE_SHARED_DEFAULT);
- }
-
-
- // ********** get/set property **********
- @Override
- protected void setProperty(String propertyName, Object newValue) throws Exception {
- throw new UnsupportedOperationException();
- }
-
- @Override
- protected Object getProperty(String propertyName) throws NoSuchFieldException {
- throw new UnsupportedOperationException();
- }
-}
diff --git a/jpa/tests/org.eclipse.jpt.eclipselink.core.tests/src/org/eclipse/jpt/eclipselink/core/tests/internal/context/persistence/caching/JptEclipseLinkPersistenceCachingTests.java b/jpa/tests/org.eclipse.jpt.eclipselink.core.tests/src/org/eclipse/jpt/eclipselink/core/tests/internal/context/persistence/caching/JptEclipseLinkPersistenceCachingTests.java
deleted file mode 100644
index 42da1ba956..0000000000
--- a/jpa/tests/org.eclipse.jpt.eclipselink.core.tests/src/org/eclipse/jpt/eclipselink/core/tests/internal/context/persistence/caching/JptEclipseLinkPersistenceCachingTests.java
+++ /dev/null
@@ -1,33 +0,0 @@
-/*******************************************************************************
- * Copyright (c) 2008 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.
- *
- * Contributors:
- * Oracle - initial API and implementation
- ******************************************************************************/
-package org.eclipse.jpt.eclipselink.core.tests.internal.context.persistence.caching;
-
-import junit.framework.Test;
-import junit.framework.TestSuite;
-
-/**
- * decentralize test creation code
- */
-public class JptEclipseLinkPersistenceCachingTests
-{
- public static Test suite() {
- TestSuite suite = new TestSuite(JptEclipseLinkPersistenceCachingTests.class.getPackage().getName());
-
- suite.addTestSuite(CachingValueModelTests.class);
- suite.addTestSuite(CachingAdapterTests.class);
-
- return suite;
- }
-
- private JptEclipseLinkPersistenceCachingTests() {
- super();
- throw new UnsupportedOperationException();
- }
-}
diff --git a/jpa/tests/org.eclipse.jpt.eclipselink.core.tests/src/org/eclipse/jpt/eclipselink/core/tests/internal/context/persistence/connection/ConnectionAdapterTests.java b/jpa/tests/org.eclipse.jpt.eclipselink.core.tests/src/org/eclipse/jpt/eclipselink/core/tests/internal/context/persistence/connection/ConnectionAdapterTests.java
deleted file mode 100644
index 2cc33c5014..0000000000
--- a/jpa/tests/org.eclipse.jpt.eclipselink.core.tests/src/org/eclipse/jpt/eclipselink/core/tests/internal/context/persistence/connection/ConnectionAdapterTests.java
+++ /dev/null
@@ -1,485 +0,0 @@
-/*******************************************************************************
-* Copyright (c) 2008, 2009 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.
-*
-* Contributors:
-* Oracle - initial API and implementation
-*******************************************************************************/
-package org.eclipse.jpt.eclipselink.core.tests.internal.context.persistence.connection;
-
-import org.eclipse.jpt.core.context.persistence.PersistenceUnitTransactionType;
-import org.eclipse.jpt.eclipselink.core.internal.context.persistence.PersistenceUnitProperties;
-import org.eclipse.jpt.eclipselink.core.internal.context.persistence.connection.BatchWriting;
-import org.eclipse.jpt.eclipselink.core.internal.context.persistence.connection.Connection;
-import org.eclipse.jpt.eclipselink.core.tests.internal.context.persistence.PersistenceUnitTestCase;
-import org.eclipse.jpt.utility.model.listener.PropertyChangeListener;
-
-/**
- * ConnectionAdapterTests
- */
-@SuppressWarnings("nls")
-public class ConnectionAdapterTests extends PersistenceUnitTestCase
-{
- private Connection connection;
-
- public static final PersistenceUnitTransactionType TRANSACTION_TYPE_TEST_VALUE = PersistenceUnitTransactionType.RESOURCE_LOCAL;
- public static final PersistenceUnitTransactionType TRANSACTION_TYPE_TEST_VALUE_2 = PersistenceUnitTransactionType.JTA;
-
- public static final String JTA_DATA_SOURCE_TEST_VALUE = "Test_JTA";
- public static final String JTA_DATA_SOURCE_TEST_VALUE_2 = "Test_JTA_2";
-
- public static final String NON_JTA_DATA_SOURCE_TEST_VALUE = "Test_Non_JTA";
- public static final String NON_JTA_DATA_SOURCE_TEST_VALUE_2 = "Test_Non_JTA_2";
-
- public static final String NATIVE_SQL_KEY = Connection.ECLIPSELINK_NATIVE_SQL;
- public static final Boolean NATIVE_SQL_TEST_VALUE = false;
- public static final Boolean NATIVE_SQL_TEST_VALUE_2 = ! NATIVE_SQL_TEST_VALUE;
-
- public static final String BATCH_WRITING_KEY = Connection.ECLIPSELINK_BATCH_WRITING;
- public static final BatchWriting BATCH_WRITING_TEST_VALUE = BatchWriting.oracle_jdbc;
- public static final BatchWriting BATCH_WRITING_TEST_VALUE_2 = BatchWriting.buffered;
-
- public static final String CACHE_STATEMENTS_KEY = Connection.ECLIPSELINK_CACHE_STATEMENTS;
- public static final Boolean CACHE_STATEMENTS_TEST_VALUE = false;
- public static final Boolean CACHE_STATEMENTS_TEST_VALUE_2 = ! CACHE_STATEMENTS_TEST_VALUE;
-
- public static final String CACHE_STATEMENTS_SIZE_KEY = Connection.ECLIPSELINK_CACHE_STATEMENTS_SIZE;
- public static final Integer CACHE_STATEMENTS_SIZE_TEST_VALUE = 100;
- public static final Integer CACHE_STATEMENTS_SIZE_TEST_VALUE_2 = 200;
-
- public static final String DRIVER_KEY = Connection.ECLIPSELINK_DRIVER;
- public static final String DRIVER_TEST_VALUE = "test";
- public static final String DRIVER_TEST_VALUE_2 = "test_2";
-
- public static final String URL_KEY = Connection.ECLIPSELINK_URL;
- public static final String URL_TEST_VALUE = "test";
- public static final String URL_TEST_VALUE_2 = "test_2";
-
- public static final String USER_KEY = Connection.ECLIPSELINK_USER;
- public static final String USER_TEST_VALUE = "test";
- public static final String USER_TEST_VALUE_2 = "test_2";
-
- public static final String PASSWORD_KEY = Connection.ECLIPSELINK_PASSWORD;
- public static final String PASSWORD_TEST_VALUE = "test";
- public static final String PASSWORD_TEST_VALUE_2 = "test_2";
-
- public static final String BIND_PARAMETERS_KEY = Connection.ECLIPSELINK_BIND_PARAMETERS;
- public static final Boolean BIND_PARAMETERS_TEST_VALUE = false;
- public static final Boolean BIND_PARAMETERS_TEST_VALUE_2 = ! BIND_PARAMETERS_TEST_VALUE;
-
- public static final String READ_CONNECTIONS_SHARED_KEY = Connection.ECLIPSELINK_READ_CONNECTIONS_SHARED;
- public static final Boolean READ_CONNECTIONS_SHARED_TEST_VALUE = false;
- public static final Boolean READ_CONNECTIONS_SHARED_TEST_VALUE_2 = ! READ_CONNECTIONS_SHARED_TEST_VALUE;
-
- public static final String READ_CONNECTIONS_MIN_KEY = Connection.ECLIPSELINK_READ_CONNECTIONS_MIN;
- public static final Integer READ_CONNECTIONS_MIN_TEST_VALUE = 100;
- public static final Integer READ_CONNECTIONS_MIN_TEST_VALUE_2 = 200;
-
- public static final String READ_CONNECTIONS_MAX_KEY = Connection.ECLIPSELINK_READ_CONNECTIONS_MAX;
- public static final Integer READ_CONNECTIONS_MAX_TEST_VALUE = 100;
- public static final Integer READ_CONNECTIONS_MAX_TEST_VALUE_2 = 200;
-
- public static final String WRITE_CONNECTIONS_MIN_KEY = Connection.ECLIPSELINK_WRITE_CONNECTIONS_MIN;
- public static final Integer WRITE_CONNECTIONS_MIN_TEST_VALUE = 100;
- public static final Integer WRITE_CONNECTIONS_MIN_TEST_VALUE_2 = 200;
-
- public static final String WRITE_CONNECTIONS_MAX_KEY = Connection.ECLIPSELINK_WRITE_CONNECTIONS_MAX;
- public static final Integer WRITE_CONNECTIONS_MAX_TEST_VALUE = 100;
- public static final Integer WRITE_CONNECTIONS_MAX_TEST_VALUE_2 = 200;
-
- public ConnectionAdapterTests(String name) {
- super(name);
- }
-
- @Override
- protected void setUp() throws Exception {
- super.setUp();
- this.connection = this.subject.getConnection();
- PropertyChangeListener propertyChangeListener = this.buildPropertyChangeListener();
-
- this.connection.addPropertyChangeListener(Connection.NATIVE_SQL_PROPERTY, propertyChangeListener);
- this.connection.addPropertyChangeListener(Connection.BATCH_WRITING_PROPERTY, propertyChangeListener);
- this.connection.addPropertyChangeListener(Connection.CACHE_STATEMENTS_PROPERTY, propertyChangeListener);
- this.connection.addPropertyChangeListener(Connection.CACHE_STATEMENTS_SIZE_PROPERTY, propertyChangeListener);
- this.connection.addPropertyChangeListener(Connection.DRIVER_PROPERTY, propertyChangeListener);
- this.connection.addPropertyChangeListener(Connection.URL_PROPERTY, propertyChangeListener);
- this.connection.addPropertyChangeListener(Connection.USER_PROPERTY, propertyChangeListener);
- this.connection.addPropertyChangeListener(Connection.PASSWORD_PROPERTY, propertyChangeListener);
- this.connection.addPropertyChangeListener(Connection.BIND_PARAMETERS_PROPERTY, propertyChangeListener);
- this.connection.addPropertyChangeListener(Connection.READ_CONNECTIONS_SHARED_PROPERTY, propertyChangeListener);
- this.connection.addPropertyChangeListener(Connection.READ_CONNECTIONS_MIN_PROPERTY, propertyChangeListener);
- this.connection.addPropertyChangeListener(Connection.READ_CONNECTIONS_MAX_PROPERTY, propertyChangeListener);
- this.connection.addPropertyChangeListener(Connection.WRITE_CONNECTIONS_MIN_PROPERTY, propertyChangeListener);
- this.connection.addPropertyChangeListener(Connection.WRITE_CONNECTIONS_MAX_PROPERTY, propertyChangeListener);
-
- this.clearEvent();
- }
-
- /**
- * Initializes directly the PU properties before testing.
- */
- @Override
- protected void populatePu() {
- this.modelPropertiesSizeOriginal = 14; // EclipseLink properties
- this.propertiesTotal = this.modelPropertiesSizeOriginal + 4; // 4 misc properties
- this.modelPropertiesSize = this.modelPropertiesSizeOriginal;
-
- // Initializes EclipseLink properties
- this.persistenceUnitSetProperty("misc.property.1", "value.1");
- this.persistenceUnitSetProperty(NATIVE_SQL_KEY, NATIVE_SQL_TEST_VALUE.toString());
- this.persistenceUnitSetProperty(BATCH_WRITING_KEY, BATCH_WRITING_TEST_VALUE);
- this.persistenceUnitSetProperty(CACHE_STATEMENTS_KEY, CACHE_STATEMENTS_TEST_VALUE.toString());
- this.persistenceUnitSetProperty(CACHE_STATEMENTS_SIZE_KEY, CACHE_STATEMENTS_SIZE_TEST_VALUE.toString());
- this.persistenceUnitSetProperty(DRIVER_KEY, DRIVER_TEST_VALUE.toString());
- this.persistenceUnitSetProperty(URL_KEY, URL_TEST_VALUE.toString());
- this.persistenceUnitSetProperty(USER_KEY, USER_TEST_VALUE.toString());
- this.persistenceUnitSetProperty(PASSWORD_KEY, PASSWORD_TEST_VALUE.toString());
- this.persistenceUnitSetProperty(BIND_PARAMETERS_KEY, BIND_PARAMETERS_TEST_VALUE.toString());
- this.persistenceUnitSetProperty("misc.property.2", "value.2");
- this.persistenceUnitSetProperty("misc.property.3", "value.3");
- this.persistenceUnitSetProperty(READ_CONNECTIONS_SHARED_KEY, READ_CONNECTIONS_SHARED_TEST_VALUE.toString());
- this.persistenceUnitSetProperty(READ_CONNECTIONS_MIN_KEY, READ_CONNECTIONS_MIN_TEST_VALUE.toString());
- this.persistenceUnitSetProperty(READ_CONNECTIONS_MAX_KEY, READ_CONNECTIONS_MAX_TEST_VALUE.toString());
- this.persistenceUnitSetProperty(WRITE_CONNECTIONS_MIN_KEY, WRITE_CONNECTIONS_MIN_TEST_VALUE.toString());
- this.persistenceUnitSetProperty(WRITE_CONNECTIONS_MAX_KEY, WRITE_CONNECTIONS_MAX_TEST_VALUE.toString());
- this.persistenceUnitSetProperty("misc.property.4", "value.4");
-
- // Initializes PU property TransactionType
- this.getPersistenceUnit().setSpecifiedTransactionType(TRANSACTION_TYPE_TEST_VALUE);
- this.getPersistenceUnit().setJtaDataSource(JTA_DATA_SOURCE_TEST_VALUE);
- this.getPersistenceUnit().setNonJtaDataSource(NON_JTA_DATA_SOURCE_TEST_VALUE);
- return;
- }
-
-
- // ********** NativeSql tests **********
- public void testSetNativeSql() throws Exception {
- this.verifyModelInitialized(
- NATIVE_SQL_KEY,
- NATIVE_SQL_TEST_VALUE);
- this.verifySetProperty(
- NATIVE_SQL_KEY,
- NATIVE_SQL_TEST_VALUE,
- NATIVE_SQL_TEST_VALUE_2);
- }
-
- public void testAddRemoveNativeSql() throws Exception {
- this.verifyAddRemoveProperty(
- NATIVE_SQL_KEY,
- NATIVE_SQL_TEST_VALUE,
- NATIVE_SQL_TEST_VALUE_2);
- }
-
- // ********** BatchWriting tests **********
- public void testSetBatchWriting() throws Exception {
- this.verifyModelInitialized(
- BATCH_WRITING_KEY,
- BATCH_WRITING_TEST_VALUE);
- this.verifySetProperty(
- BATCH_WRITING_KEY,
- BATCH_WRITING_TEST_VALUE,
- BATCH_WRITING_TEST_VALUE_2);
- }
-
- public void testAddRemoveBatchWriting() throws Exception {
- this.verifyAddRemoveProperty(
- BATCH_WRITING_KEY,
- BATCH_WRITING_TEST_VALUE,
- BATCH_WRITING_TEST_VALUE_2);
- }
-
- // ********** CacheStatements tests **********
- public void testSetCacheStatements() throws Exception {
- this.verifyModelInitialized(
- CACHE_STATEMENTS_KEY,
- CACHE_STATEMENTS_TEST_VALUE);
- this.verifySetProperty(
- CACHE_STATEMENTS_KEY,
- CACHE_STATEMENTS_TEST_VALUE,
- CACHE_STATEMENTS_TEST_VALUE_2);
- }
-
- public void testAddRemoveCacheStatements() throws Exception {
- this.verifyAddRemoveProperty(
- CACHE_STATEMENTS_KEY,
- CACHE_STATEMENTS_TEST_VALUE,
- CACHE_STATEMENTS_TEST_VALUE_2);
- }
-
- // ********** CacheStatementsSize tests **********
- public void testSetCacheStatementsSize() throws Exception {
- this.verifyModelInitialized(
- CACHE_STATEMENTS_SIZE_KEY,
- CACHE_STATEMENTS_SIZE_TEST_VALUE);
- this.verifySetProperty(
- CACHE_STATEMENTS_SIZE_KEY,
- CACHE_STATEMENTS_SIZE_TEST_VALUE,
- CACHE_STATEMENTS_SIZE_TEST_VALUE_2);
- }
-
- public void testAddRemoveCacheStatementsSize() throws Exception {
- this.verifyAddRemoveProperty(
- CACHE_STATEMENTS_SIZE_KEY,
- CACHE_STATEMENTS_SIZE_TEST_VALUE,
- CACHE_STATEMENTS_SIZE_TEST_VALUE_2);
- }
-
- // ********** Driver tests **********
- public void testSetDriver() throws Exception {
- this.verifyModelInitialized(
- DRIVER_KEY,
- DRIVER_TEST_VALUE);
- this.verifySetProperty(
- DRIVER_KEY,
- DRIVER_TEST_VALUE,
- DRIVER_TEST_VALUE_2);
- }
-
- public void testAddRemoveDriver() throws Exception {
- this.verifyAddRemoveProperty(
- DRIVER_KEY,
- DRIVER_TEST_VALUE,
- DRIVER_TEST_VALUE_2);
- }
-
- // ********** Url tests **********
- public void testSetUrl() throws Exception {
- this.verifyModelInitialized(
- URL_KEY,
- URL_TEST_VALUE);
- this.verifySetProperty(
- URL_KEY,
- URL_TEST_VALUE,
- URL_TEST_VALUE_2);
- }
-
- public void testAddRemoveUrl() throws Exception {
- this.verifyAddRemoveProperty(
- URL_KEY,
- URL_TEST_VALUE,
- URL_TEST_VALUE_2);
- }
-
- // ********** User tests **********
- public void testSetUser() throws Exception {
- this.verifyModelInitialized(
- USER_KEY,
- USER_TEST_VALUE);
- this.verifySetProperty(
- USER_KEY,
- USER_TEST_VALUE,
- USER_TEST_VALUE_2);
- }
-
- public void testAddRemoveUser() throws Exception {
- this.verifyAddRemoveProperty(
- USER_KEY,
- USER_TEST_VALUE,
- USER_TEST_VALUE_2);
- }
-
- // ********** Password tests **********
- public void testSetPassword() throws Exception {
- this.verifyModelInitialized(
- PASSWORD_KEY,
- PASSWORD_TEST_VALUE);
- this.verifySetProperty(
- PASSWORD_KEY,
- PASSWORD_TEST_VALUE,
- PASSWORD_TEST_VALUE_2);
- }
-
- public void testAddRemovePassword() throws Exception {
- this.verifyAddRemoveProperty(
- PASSWORD_KEY,
- PASSWORD_TEST_VALUE,
- PASSWORD_TEST_VALUE_2);
- }
-
- // ********** BindParameters tests **********
- public void testSetBindParameters() throws Exception {
- this.verifyModelInitialized(
- BIND_PARAMETERS_KEY,
- BIND_PARAMETERS_TEST_VALUE);
- this.verifySetProperty(
- BIND_PARAMETERS_KEY,
- BIND_PARAMETERS_TEST_VALUE,
- BIND_PARAMETERS_TEST_VALUE_2);
- }
-
- public void testAddRemoveBindParameters() throws Exception {
- this.verifyAddRemoveProperty(
- BIND_PARAMETERS_KEY,
- BIND_PARAMETERS_TEST_VALUE,
- BIND_PARAMETERS_TEST_VALUE_2);
- }
-
- // ********** ReadConnectionsShared tests **********
- public void testSetReadConnectionsShared() throws Exception {
- this.verifyModelInitialized(
- READ_CONNECTIONS_SHARED_KEY,
- READ_CONNECTIONS_SHARED_TEST_VALUE);
- this.verifySetProperty(
- READ_CONNECTIONS_SHARED_KEY,
- READ_CONNECTIONS_SHARED_TEST_VALUE,
- READ_CONNECTIONS_SHARED_TEST_VALUE_2);
- }
-
- public void testAddRemoveReadConnectionsShared() throws Exception {
- this.verifyAddRemoveProperty(
- READ_CONNECTIONS_SHARED_KEY,
- READ_CONNECTIONS_SHARED_TEST_VALUE,
- READ_CONNECTIONS_SHARED_TEST_VALUE_2);
- }
-
- // ********** ReadConnectionsMin tests **********
- public void testSetReadConnectionsMin() throws Exception {
- this.verifyModelInitialized(
- READ_CONNECTIONS_MIN_KEY,
- READ_CONNECTIONS_MIN_TEST_VALUE);
- this.verifySetProperty(
- READ_CONNECTIONS_MIN_KEY,
- READ_CONNECTIONS_MIN_TEST_VALUE,
- READ_CONNECTIONS_MIN_TEST_VALUE_2);
- }
-
- public void testAddRemoveReadConnectionsMin() throws Exception {
- this.verifyAddRemoveProperty(
- READ_CONNECTIONS_MIN_KEY,
- READ_CONNECTIONS_MIN_TEST_VALUE,
- READ_CONNECTIONS_MIN_TEST_VALUE_2);
- }
-
- // ********** ReadConnectionsMax tests **********
- public void testSetReadConnectionsMax() throws Exception {
- this.verifyModelInitialized(
- READ_CONNECTIONS_MAX_KEY,
- READ_CONNECTIONS_MAX_TEST_VALUE);
- this.verifySetProperty(
- READ_CONNECTIONS_MAX_KEY,
- READ_CONNECTIONS_MAX_TEST_VALUE,
- READ_CONNECTIONS_MAX_TEST_VALUE_2);
- }
-
- public void testAddRemoveReadConnectionsMax() throws Exception {
- this.verifyAddRemoveProperty(
- READ_CONNECTIONS_MAX_KEY,
- READ_CONNECTIONS_MAX_TEST_VALUE,
- READ_CONNECTIONS_MAX_TEST_VALUE_2);
- }
-
- // ********** WriteConnectionsMin tests **********
- public void testSetWriteConnectionsMin() throws Exception {
- this.verifyModelInitialized(
- WRITE_CONNECTIONS_MIN_KEY,
- WRITE_CONNECTIONS_MIN_TEST_VALUE);
- this.verifySetProperty(
- WRITE_CONNECTIONS_MIN_KEY,
- WRITE_CONNECTIONS_MIN_TEST_VALUE,
- WRITE_CONNECTIONS_MIN_TEST_VALUE_2);
- }
-
- public void testAddRemoveWriteConnectionsMin() throws Exception {
- this.verifyAddRemoveProperty(
- WRITE_CONNECTIONS_MIN_KEY,
- WRITE_CONNECTIONS_MIN_TEST_VALUE,
- WRITE_CONNECTIONS_MIN_TEST_VALUE_2);
- }
-
- // ********** WriteConnectionsMax tests **********
- public void testSetWriteConnectionsMax() throws Exception {
- this.verifyModelInitialized(
- WRITE_CONNECTIONS_MAX_KEY,
- WRITE_CONNECTIONS_MAX_TEST_VALUE);
- this.verifySetProperty(
- WRITE_CONNECTIONS_MAX_KEY,
- WRITE_CONNECTIONS_MAX_TEST_VALUE,
- WRITE_CONNECTIONS_MAX_TEST_VALUE_2);
- }
-
- public void testAddRemoveWriteConnectionsMax() throws Exception {
- this.verifyAddRemoveProperty(
- WRITE_CONNECTIONS_MAX_KEY,
- WRITE_CONNECTIONS_MAX_TEST_VALUE,
- WRITE_CONNECTIONS_MAX_TEST_VALUE_2);
- }
-
- // ********** get/set property **********
- @Override
- protected void setProperty(String propertyName, Object newValue) throws Exception {
- if (propertyName.equals(Connection.NATIVE_SQL_PROPERTY))
- this.connection.setNativeSql((Boolean) newValue);
- else if (propertyName.equals(Connection.BATCH_WRITING_PROPERTY))
- this.connection.setBatchWriting((BatchWriting) newValue);
- else if (propertyName.equals(Connection.CACHE_STATEMENTS_PROPERTY))
- this.connection.setCacheStatements((Boolean) newValue);
- else if (propertyName.equals(Connection.CACHE_STATEMENTS_SIZE_PROPERTY))
- this.connection.setCacheStatementsSize((Integer) newValue);
- else if (propertyName.equals(Connection.DRIVER_PROPERTY))
- this.connection.setDriver((String) newValue);
- else if (propertyName.equals(Connection.URL_PROPERTY))
- this.connection.setUrl((String) newValue);
- else if (propertyName.equals(Connection.USER_PROPERTY))
- this.connection.setUser((String) newValue);
- else if (propertyName.equals(Connection.PASSWORD_PROPERTY))
- this.connection.setPassword((String) newValue);
- else if (propertyName.equals(Connection.BIND_PARAMETERS_PROPERTY))
- this.connection.setBindParameters((Boolean) newValue);
- else if (propertyName.equals(Connection.READ_CONNECTIONS_SHARED_PROPERTY))
- this.connection.setReadConnectionsShared((Boolean) newValue);
- else if (propertyName.equals(Connection.READ_CONNECTIONS_MIN_PROPERTY))
- this.connection.setReadConnectionsMin((Integer) newValue);
- else if (propertyName.equals(Connection.READ_CONNECTIONS_MAX_PROPERTY))
- this.connection.setReadConnectionsMax((Integer) newValue);
- else if (propertyName.equals(Connection.WRITE_CONNECTIONS_MIN_PROPERTY))
- this.connection.setWriteConnectionsMin((Integer) newValue);
- else if (propertyName.equals(Connection.WRITE_CONNECTIONS_MAX_PROPERTY))
- this.connection.setWriteConnectionsMax((Integer) newValue);
- else
- this.throwMissingDefinition("setProperty", propertyName);
- }
-
- @Override
- protected Object getProperty(String propertyName) throws NoSuchFieldException {
- Object modelValue = null;
- if (propertyName.equals(Connection.NATIVE_SQL_PROPERTY))
- modelValue = this.connection.getNativeSql();
- else if (propertyName.equals(Connection.BATCH_WRITING_PROPERTY))
- modelValue = this.connection.getBatchWriting();
- else if (propertyName.equals(Connection.CACHE_STATEMENTS_PROPERTY))
- modelValue = this.connection.getCacheStatements();
- else if (propertyName.equals(Connection.CACHE_STATEMENTS_SIZE_PROPERTY))
- modelValue = this.connection.getCacheStatementsSize();
- else if (propertyName.equals(Connection.DRIVER_PROPERTY))
- modelValue = this.connection.getDriver();
- else if (propertyName.equals(Connection.URL_PROPERTY))
- modelValue = this.connection.getUrl();
- else if (propertyName.equals(Connection.USER_PROPERTY))
- modelValue = this.connection.getUser();
- else if (propertyName.equals(Connection.PASSWORD_PROPERTY))
- modelValue = this.connection.getPassword();
- else if (propertyName.equals(Connection.BIND_PARAMETERS_PROPERTY))
- modelValue = this.connection.getBindParameters();
- else if (propertyName.equals(Connection.READ_CONNECTIONS_SHARED_PROPERTY))
- modelValue = this.connection.getReadConnectionsShared();
- else if (propertyName.equals(Connection.READ_CONNECTIONS_MIN_PROPERTY))
- modelValue = this.connection.getReadConnectionsMin();
- else if (propertyName.equals(Connection.READ_CONNECTIONS_MAX_PROPERTY))
- modelValue = this.connection.getReadConnectionsMax();
- else if (propertyName.equals(Connection.WRITE_CONNECTIONS_MIN_PROPERTY))
- modelValue = this.connection.getWriteConnectionsMin();
- else if (propertyName.equals(Connection.WRITE_CONNECTIONS_MAX_PROPERTY))
- modelValue = this.connection.getWriteConnectionsMax();
- else
- this.throwMissingDefinition("getProperty", propertyName);
- return modelValue;
- }
-
-
- @Override
- protected PersistenceUnitProperties getModel() {
- return this.connection;
- }
-}
diff --git a/jpa/tests/org.eclipse.jpt.eclipselink.core.tests/src/org/eclipse/jpt/eclipselink/core/tests/internal/context/persistence/connection/JptEclipseLinkPersistenceConnectionTests.java b/jpa/tests/org.eclipse.jpt.eclipselink.core.tests/src/org/eclipse/jpt/eclipselink/core/tests/internal/context/persistence/connection/JptEclipseLinkPersistenceConnectionTests.java
deleted file mode 100644
index 1829a234c7..0000000000
--- a/jpa/tests/org.eclipse.jpt.eclipselink.core.tests/src/org/eclipse/jpt/eclipselink/core/tests/internal/context/persistence/connection/JptEclipseLinkPersistenceConnectionTests.java
+++ /dev/null
@@ -1,33 +0,0 @@
-/*******************************************************************************
- * Copyright (c) 2008 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.
- *
- * Contributors:
- * Oracle - initial API and implementation
- ******************************************************************************/
-package org.eclipse.jpt.eclipselink.core.tests.internal.context.persistence.connection;
-
-import junit.framework.Test;
-import junit.framework.TestSuite;
-
-/**
- * decentralize test creation code
- */
-public class JptEclipseLinkPersistenceConnectionTests
-{
- public static Test suite() {
- TestSuite suite = new TestSuite(JptEclipseLinkPersistenceConnectionTests.class.getPackage().getName());
-
-// suite.addTestSuite(ConnectionValueModelTests.class);
- suite.addTestSuite(ConnectionAdapterTests.class);
-
- return suite;
- }
-
- private JptEclipseLinkPersistenceConnectionTests() {
- super();
- throw new UnsupportedOperationException();
- }
-}
diff --git a/jpa/tests/org.eclipse.jpt.eclipselink.core.tests/src/org/eclipse/jpt/eclipselink/core/tests/internal/context/persistence/customization/CustomizationAdapterTests.java b/jpa/tests/org.eclipse.jpt.eclipselink.core.tests/src/org/eclipse/jpt/eclipselink/core/tests/internal/context/persistence/customization/CustomizationAdapterTests.java
deleted file mode 100644
index 190042f85d..0000000000
--- a/jpa/tests/org.eclipse.jpt.eclipselink.core.tests/src/org/eclipse/jpt/eclipselink/core/tests/internal/context/persistence/customization/CustomizationAdapterTests.java
+++ /dev/null
@@ -1,713 +0,0 @@
-/*******************************************************************************
- * Copyright (c) 2007, 2009 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.
- *
- * Contributors:
- * Oracle - initial API and implementation
- ******************************************************************************/
-package org.eclipse.jpt.eclipselink.core.tests.internal.context.persistence.customization;
-
-import java.util.ListIterator;
-
-import org.eclipse.jpt.core.context.persistence.PersistenceUnit;
-import org.eclipse.jpt.eclipselink.core.internal.context.persistence.PersistenceUnitProperties;
-import org.eclipse.jpt.eclipselink.core.internal.context.persistence.customization.Customization;
-import org.eclipse.jpt.eclipselink.core.internal.context.persistence.customization.EclipseLinkCustomization;
-import org.eclipse.jpt.eclipselink.core.internal.context.persistence.customization.Entity;
-import org.eclipse.jpt.eclipselink.core.internal.context.persistence.customization.Profiler;
-import org.eclipse.jpt.eclipselink.core.internal.context.persistence.customization.Weaving;
-import org.eclipse.jpt.eclipselink.core.tests.internal.context.persistence.PersistenceUnitTestCase;
-import org.eclipse.jpt.utility.model.event.ListAddEvent;
-import org.eclipse.jpt.utility.model.event.ListChangeEvent;
-import org.eclipse.jpt.utility.model.event.ListClearEvent;
-import org.eclipse.jpt.utility.model.event.ListMoveEvent;
-import org.eclipse.jpt.utility.model.event.ListRemoveEvent;
-import org.eclipse.jpt.utility.model.event.ListReplaceEvent;
-import org.eclipse.jpt.utility.model.listener.ListChangeListener;
-import org.eclipse.jpt.utility.model.listener.PropertyChangeListener;
-
-/**
- * Tests the update of model objects by the Customization adapter when the
- * PersistenceUnit changes.
- */
-@SuppressWarnings("nls")
-public class CustomizationAdapterTests extends PersistenceUnitTestCase
-{
- private Customization customization;
- private ListChangeEvent entitiesEvent;
- private ListChangeEvent sessionCustomizersEvent;
-
- public static final String ENTITY_TEST = "Employee";
- public static final String ENTITY_TEST_2 = "Address";
-
- public static final String THROW_EXCEPTIONS_KEY = Customization.ECLIPSELINK_THROW_EXCEPTIONS;
- public static final Boolean THROW_EXCEPTIONS_TEST_VALUE = false;
- public static final Boolean THROW_EXCEPTIONS_TEST_VALUE_2 = ! THROW_EXCEPTIONS_TEST_VALUE;
-
- public static final String WEAVING_LAZY_KEY = Customization.ECLIPSELINK_WEAVING_LAZY;
- public static final Boolean WEAVING_LAZY_TEST_VALUE = false;
- public static final Boolean WEAVING_LAZY_TEST_VALUE_2 = ! WEAVING_LAZY_TEST_VALUE;
-
- public static final String WEAVING_CHANGE_TRACKING_KEY = Customization.ECLIPSELINK_WEAVING_CHANGE_TRACKING;
- public static final Boolean WEAVING_CHANGE_TRACKING_TEST_VALUE = false;
- public static final Boolean WEAVING_CHANGE_TRACKING_TEST_VALUE_2 = ! WEAVING_CHANGE_TRACKING_TEST_VALUE;
-
- public static final String WEAVING_FETCH_GROUPS_KEY = Customization.ECLIPSELINK_WEAVING_FETCH_GROUPS;
- public static final Boolean WEAVING_FETCH_GROUPS_TEST_VALUE = false;
- public static final Boolean WEAVING_FETCH_GROUPS_TEST_VALUE_2 = ! WEAVING_FETCH_GROUPS_TEST_VALUE;
-
- public static final String WEAVING_INTERNAL_KEY = Customization.ECLIPSELINK_WEAVING_INTERNAL;
- public static final Boolean WEAVING_INTERNAL_TEST_VALUE = false;
- public static final Boolean WEAVING_INTERNAL_TEST_VALUE_2 = ! WEAVING_INTERNAL_TEST_VALUE;
-
- public static final String WEAVING_EAGER_KEY = Customization.ECLIPSELINK_WEAVING_EAGER;
- public static final Boolean WEAVING_EAGER_TEST_VALUE = true;
- public static final Boolean WEAVING_EAGER_TEST_VALUE_2 = ! WEAVING_EAGER_TEST_VALUE;
-
- public static final String VALIDATION_ONLY_KEY = Customization.ECLIPSELINK_VALIDATION_ONLY;
- public static final Boolean VALIDATION_ONLY_TEST_VALUE = false;
- public static final Boolean VALIDATION_ONLY_TEST_VALUE_2 = ! VALIDATION_ONLY_TEST_VALUE;
-
- private static final String SESSION_CUSTOMIZER_KEY = Customization.ECLIPSELINK_SESSION_CUSTOMIZER;
- private static final String SESSION_CUSTOMIZER_TEST_VALUE = "java.lang.String";
- private static final String SESSION_CUSTOMIZER_TEST_VALUE_2 = "java.lang.Boolean";
-
- public static final String WEAVING_KEY = Customization.ECLIPSELINK_WEAVING;
- public static final Weaving WEAVING_TEST_VALUE = Weaving.false_;
- public static final Weaving WEAVING_TEST_VALUE_2 = Weaving.static_;
-
- public static final String CUSTOMIZER_KEY = Customization.ECLIPSELINK_DESCRIPTOR_CUSTOMIZER + ENTITY_TEST;
- public static final String CUSTOMIZER_TEST_VALUE = "acme.sessions.DescriptorCustomizer";
- public static final String CUSTOMIZER_TEST_VALUE_2 = "acme.sessions.Customizer";
-
- private static final String PROFILER_KEY = Customization.ECLIPSELINK_PROFILER;
- private static final Profiler PROFILER_TEST_VALUE = Profiler.query_monitor;
- private static final String PROFILER_TEST_VALUE_2 = "custom.profiler.test";
-
- public static final String EXCEPTION_HANDLER_KEY = Customization.ECLIPSELINK_EXCEPTION_HANDLER;
- public static final String EXCEPTION_HANDLER_TEST_VALUE = "acme.CustomSessionEventListener";
- public static final String EXCEPTION_HANDLER_TEST_VALUE_2 = "oracle.sessions.CustomSessionEventListener";
-
- public CustomizationAdapterTests(String name) {
- super(name);
- }
-
- @Override
- protected void setUp() throws Exception {
- super.setUp();
- this.customization = this.subject.getCustomization();
- PropertyChangeListener propertyChangeListener = this.buildPropertyChangeListener();
-
- this.customization.addPropertyChangeListener(Customization.THROW_EXCEPTIONS_PROPERTY, propertyChangeListener);
- this.customization.addPropertyChangeListener(Customization.WEAVING_LAZY_PROPERTY, propertyChangeListener);
- this.customization.addPropertyChangeListener(Customization.WEAVING_CHANGE_TRACKING_PROPERTY, propertyChangeListener);
- this.customization.addPropertyChangeListener(Customization.WEAVING_FETCH_GROUPS_PROPERTY, propertyChangeListener);
- this.customization.addPropertyChangeListener(Customization.WEAVING_INTERNAL_PROPERTY, propertyChangeListener);
- this.customization.addPropertyChangeListener(Customization.WEAVING_EAGER_PROPERTY, propertyChangeListener);
- this.customization.addPropertyChangeListener(Customization.WEAVING_PROPERTY, propertyChangeListener);
- this.customization.addPropertyChangeListener(Customization.VALIDATION_ONLY_PROPERTY, propertyChangeListener);
- this.customization.addPropertyChangeListener(Entity.DESCRIPTOR_CUSTOMIZER_PROPERTY, propertyChangeListener);
- this.customization.addPropertyChangeListener(Customization.SESSION_CUSTOMIZER_PROPERTY, propertyChangeListener);
- this.customization.addPropertyChangeListener(Customization.PROFILER_PROPERTY, propertyChangeListener);
- this.customization.addPropertyChangeListener(Customization.EXCEPTION_HANDLER_PROPERTY, propertyChangeListener);
-
- ListChangeListener sessionCustomizersChangeListener = this.buildSessionCustomizersChangeListener();
- this.customization.addListChangeListener(Customization.SESSION_CUSTOMIZER_LIST, sessionCustomizersChangeListener);
-
- ListChangeListener entitiesChangeListener = this.buildEntitiesChangeListener();
- this.customization.addListChangeListener(Customization.ENTITIES_LIST, entitiesChangeListener);
- this.clearEvent();
- }
-
- /**
- * Initializes directly the PU properties before testing.
- */
- @Override
- protected void populatePu() {
- this.modelPropertiesSizeOriginal = 12;
- this.propertiesTotal = this.modelPropertiesSizeOriginal + 4; // 4 misc properties
- this.modelPropertiesSize = this.modelPropertiesSizeOriginal;
-
- this.persistenceUnitSetProperty("misc.property.1", "value.1");
- this.persistenceUnitSetProperty(THROW_EXCEPTIONS_KEY, THROW_EXCEPTIONS_TEST_VALUE.toString());
- this.persistenceUnitSetProperty(WEAVING_LAZY_KEY, WEAVING_LAZY_TEST_VALUE.toString());
- this.persistenceUnitSetProperty(WEAVING_CHANGE_TRACKING_KEY, WEAVING_CHANGE_TRACKING_TEST_VALUE.toString());
- this.persistenceUnitSetProperty(WEAVING_FETCH_GROUPS_KEY, WEAVING_FETCH_GROUPS_TEST_VALUE.toString());
- this.persistenceUnitSetProperty(WEAVING_INTERNAL_KEY, WEAVING_INTERNAL_TEST_VALUE.toString());
- this.persistenceUnitSetProperty(WEAVING_EAGER_KEY, WEAVING_EAGER_TEST_VALUE.toString());
- this.persistenceUnitSetProperty(VALIDATION_ONLY_KEY, VALIDATION_ONLY_TEST_VALUE.toString());
- this.persistenceUnitSetProperty("misc.property.2", "value.2");
- this.persistenceUnitSetProperty(SESSION_CUSTOMIZER_KEY, SESSION_CUSTOMIZER_TEST_VALUE.toString());
- this.persistenceUnitSetProperty(WEAVING_KEY, WEAVING_TEST_VALUE);
- this.persistenceUnitSetProperty("misc.property.3", "value.3");
- this.persistenceUnitSetProperty("misc.property.4", "value.4");
- this.persistenceUnitSetProperty(CUSTOMIZER_KEY, CUSTOMIZER_TEST_VALUE);
- this.persistenceUnitSetProperty(PROFILER_KEY, PROFILER_TEST_VALUE);
- this.persistenceUnitSetProperty(EXCEPTION_HANDLER_KEY, EXCEPTION_HANDLER_TEST_VALUE);
- return;
- }
-
- // ********** Listeners **********
- private ListChangeListener buildEntitiesChangeListener() {
- return new ListChangeListener() {
- public void itemsAdded(ListAddEvent e) {
- CustomizationAdapterTests.this.throwUnsupportedOperationException(e);
- }
-
- public void itemsRemoved(ListRemoveEvent e) {
- CustomizationAdapterTests.this.throwUnsupportedOperationException(e);
- }
-
- public void itemsReplaced(ListReplaceEvent e) {
- CustomizationAdapterTests.this.throwUnsupportedOperationException(e);
- }
-
- public void itemsMoved(ListMoveEvent e) {
- CustomizationAdapterTests.this.throwUnsupportedOperationException(e);
- }
-
- public void listCleared(ListClearEvent e) {
- CustomizationAdapterTests.this.throwUnsupportedOperationException(e);
- }
-
- public void listChanged(ListChangeEvent e) {
- CustomizationAdapterTests.this.entityChanged(e);
- }
- };
- }
-
- private ListChangeListener buildSessionCustomizersChangeListener() {
- return new ListChangeListener() {
- public void itemsAdded(ListAddEvent e) {
- CustomizationAdapterTests.this.throwUnsupportedOperationException(e);
- }
-
- public void itemsRemoved(ListRemoveEvent e) {
- CustomizationAdapterTests.this.throwUnsupportedOperationException(e);
- }
-
- public void itemsReplaced(ListReplaceEvent e) {
- CustomizationAdapterTests.this.throwUnsupportedOperationException(e);
- }
-
- public void itemsMoved(ListMoveEvent e) {
- CustomizationAdapterTests.this.throwUnsupportedOperationException(e);
- }
-
- public void listCleared(ListClearEvent e) {
- CustomizationAdapterTests.this.throwUnsupportedOperationException(e);
- }
-
- public void listChanged(ListChangeEvent e) {
- CustomizationAdapterTests.this.sessionCustomizerChanged(e);
- }
- };
- }
-
- @Override
- protected void clearEvent() {
- super.clearEvent();
- this.entitiesEvent = null;
- this.sessionCustomizersEvent = null;
- }
-
- void entityChanged(ListChangeEvent e) {
- this.entitiesEvent = e;
- }
-
- void sessionCustomizerChanged(ListChangeEvent e) {
- this.sessionCustomizersEvent = e;
- }
-
- // ********** entities list **********
- public void testEntitiesList() throws Exception {
- // add
- this.clearEvent();
- this.customization.addEntity(ENTITY_TEST_2);
-
- // verify event received
- assertNotNull("No Event Fired.", this.entitiesEvent);
- // verify event for the expected property
- assertEquals("Wrong Event.", this.entitiesEvent.getListName(), Customization.ENTITIES_LIST);
-
- // remove
- this.clearEvent();
- this.customization.removeEntity(ENTITY_TEST_2);
-
- // verify event received
- assertNotNull("No Event Fired.", this.entitiesEvent);
- // verify event for the expected property
- assertEquals("Wrong Event.", this.entitiesEvent.getListName(), Customization.ENTITIES_LIST);
- }
-
- // ********** sessionCustomizers list **********
- public void testSessionCustomizersList() throws Exception {
- // add
- this.clearEvent();
- String className = this.customization.addSessionCustomizer(SESSION_CUSTOMIZER_TEST_VALUE_2);
-
- // verify event received
- assertNotNull("No Event Fired.", this.sessionCustomizersEvent);
- // verify event for the expected property
- assertEquals("Wrong Event.", this.sessionCustomizersEvent.getListName(), Customization.SESSION_CUSTOMIZER_LIST);
-
- // remove
- this.clearEvent();
-
- this.customization.removeSessionCustomizer(className);
- // verify event received
- assertNotNull("No Event Fired.", this.sessionCustomizersEvent);
- // verify event for the expected property
- assertEquals("Wrong Event.", this.sessionCustomizersEvent.getListName(), Customization.SESSION_CUSTOMIZER_LIST);
- }
-
- // ********** ThrowExceptions tests **********
- public void testSetThrowExceptions() throws Exception {
- this.verifyModelInitialized(
- THROW_EXCEPTIONS_KEY,
- THROW_EXCEPTIONS_TEST_VALUE);
- this.verifySetProperty(
- THROW_EXCEPTIONS_KEY,
- THROW_EXCEPTIONS_TEST_VALUE,
- THROW_EXCEPTIONS_TEST_VALUE_2);
- }
-
- public void testAddRemoveThrowExceptions() throws Exception {
- this.verifyAddRemoveProperty(
- THROW_EXCEPTIONS_KEY,
- THROW_EXCEPTIONS_TEST_VALUE,
- THROW_EXCEPTIONS_TEST_VALUE_2);
- }
-
- // ********** WeavingLazy tests **********
- public void testSetWeavingLazy() throws Exception {
- this.verifyModelInitialized(
- WEAVING_LAZY_KEY,
- WEAVING_LAZY_TEST_VALUE);
- this.verifySetProperty(
- WEAVING_LAZY_KEY,
- WEAVING_LAZY_TEST_VALUE,
- WEAVING_LAZY_TEST_VALUE_2);
- }
-
- public void testAddRemoveWeavingLazy() throws Exception {
- this.verifyAddRemoveProperty(
- WEAVING_LAZY_KEY,
- WEAVING_LAZY_TEST_VALUE,
- WEAVING_LAZY_TEST_VALUE_2);
- }
-
- // ********** WeavingChangeTracking tests **********
- public void testSetWeavingChangeTracking() throws Exception {
- this.verifyModelInitialized(
- WEAVING_CHANGE_TRACKING_KEY,
- WEAVING_CHANGE_TRACKING_TEST_VALUE);
- this.verifySetProperty(
- WEAVING_CHANGE_TRACKING_KEY,
- WEAVING_CHANGE_TRACKING_TEST_VALUE,
- WEAVING_CHANGE_TRACKING_TEST_VALUE_2);
- }
-
- public void testAddRemoveWeavingChangeTracking() throws Exception {
- this.verifyAddRemoveProperty(
- WEAVING_CHANGE_TRACKING_KEY,
- WEAVING_CHANGE_TRACKING_TEST_VALUE,
- WEAVING_CHANGE_TRACKING_TEST_VALUE_2);
- }
-
- // ********** WeavingFetchGroups tests **********
- public void testSetWeavingFetchGroups() throws Exception {
- this.verifyModelInitialized(
- WEAVING_FETCH_GROUPS_KEY,
- WEAVING_FETCH_GROUPS_TEST_VALUE);
- this.verifySetProperty(
- WEAVING_FETCH_GROUPS_KEY,
- WEAVING_FETCH_GROUPS_TEST_VALUE,
- WEAVING_FETCH_GROUPS_TEST_VALUE_2);
- }
-
- public void testAddRemoveWeavingFetchGroups() throws Exception {
- this.verifyAddRemoveProperty(
- WEAVING_FETCH_GROUPS_KEY,
- WEAVING_FETCH_GROUPS_TEST_VALUE,
- WEAVING_FETCH_GROUPS_TEST_VALUE_2);
- }
-
- // ********** WeavingInternal tests **********
- public void testSetWeavingInternal() throws Exception {
- this.verifyModelInitialized(
- WEAVING_INTERNAL_KEY,
- WEAVING_INTERNAL_TEST_VALUE);
- this.verifySetProperty(
- WEAVING_INTERNAL_KEY,
- WEAVING_INTERNAL_TEST_VALUE,
- WEAVING_INTERNAL_TEST_VALUE_2);
- }
-
- public void testAddRemoveWeavingInternal() throws Exception {
- this.verifyAddRemoveProperty(
- WEAVING_INTERNAL_KEY,
- WEAVING_INTERNAL_TEST_VALUE,
- WEAVING_INTERNAL_TEST_VALUE_2);
- }
-
- // ********** WeavingEager tests **********
- public void testSetWeavingEager() throws Exception {
- this.verifyModelInitialized(
- WEAVING_EAGER_KEY,
- WEAVING_EAGER_TEST_VALUE);
- this.verifySetProperty(
- WEAVING_EAGER_KEY,
- WEAVING_EAGER_TEST_VALUE,
- WEAVING_EAGER_TEST_VALUE_2);
- }
-
- public void testAddRemoveWeavingEager() throws Exception {
- this.verifyAddRemoveProperty(
- WEAVING_EAGER_KEY,
- WEAVING_EAGER_TEST_VALUE,
- WEAVING_EAGER_TEST_VALUE_2);
- }
-
- // ********** SessionCustomizer tests **********
- public void testSetSessionCustomizer() throws Exception {
- this.verifyModelInitialized(
- SESSION_CUSTOMIZER_KEY,
- SESSION_CUSTOMIZER_TEST_VALUE);
- this.verifySetSessionCustomizationProperty(
- Customization.SESSION_CUSTOMIZER_PROPERTY,
- SESSION_CUSTOMIZER_KEY,
- SESSION_CUSTOMIZER_TEST_VALUE,
- SESSION_CUSTOMIZER_TEST_VALUE_2);
- }
-
- public void testAddRemoveSessionCustomizer() throws Exception {
- this.verifyAddRemoveSessionCustomizationProperty(
- Customization.SESSION_CUSTOMIZER_PROPERTY,
- SESSION_CUSTOMIZER_KEY,
- SESSION_CUSTOMIZER_TEST_VALUE,
- SESSION_CUSTOMIZER_TEST_VALUE_2);
- }
-
- // ********** Weaving tests **********
- /**
- * Tests the update of Weaving property by the Customization adapter when
- * the PU or the model changes.
- */
- public void testSetWeaving() throws Exception {
- this.verifyModelInitialized(
- WEAVING_KEY,
- WEAVING_TEST_VALUE);
- this.verifySetProperty(
- WEAVING_KEY,
- WEAVING_TEST_VALUE,
- WEAVING_TEST_VALUE_2);
- }
-
- public void testAddRemoveWeaving() throws Exception {
- this.verifyAddRemoveProperty(
- WEAVING_KEY,
- WEAVING_TEST_VALUE,
- WEAVING_TEST_VALUE_2);
- }
-
- // ********** ValidationOnly tests **********
- public void testSetValidationOnly() throws Exception {
- this.verifyModelInitialized(
- VALIDATION_ONLY_KEY,
- VALIDATION_ONLY_TEST_VALUE);
- this.verifySetProperty(
- VALIDATION_ONLY_KEY,
- VALIDATION_ONLY_TEST_VALUE,
- VALIDATION_ONLY_TEST_VALUE_2);
- }
-
- public void testAddRemoveValidationOnly() throws Exception {
- this.verifyAddRemoveProperty(
- VALIDATION_ONLY_KEY,
- VALIDATION_ONLY_TEST_VALUE,
- VALIDATION_ONLY_TEST_VALUE_2);
- }
-
- // ********** ExceptionHandler tests **********
- public void testSetExceptionHandler() throws Exception {
- this.verifyModelInitialized(
- EXCEPTION_HANDLER_KEY,
- EXCEPTION_HANDLER_TEST_VALUE);
- this.verifySetProperty(
- EXCEPTION_HANDLER_KEY,
- EXCEPTION_HANDLER_TEST_VALUE,
- EXCEPTION_HANDLER_TEST_VALUE_2);
- }
-
- public void testAddRemoveExceptionHandler() throws Exception {
- this.verifyAddRemoveProperty(
- EXCEPTION_HANDLER_KEY,
- EXCEPTION_HANDLER_TEST_VALUE,
- EXCEPTION_HANDLER_TEST_VALUE_2);
- }
-
- // ********** Customization class **********
- /**
- * Tests the update of Customization property by the Customization adapter when the
- * PU or the model changes.
- */
- public void testSetCustomization() throws Exception {
- this.verifyModelInitialized(
- CUSTOMIZER_KEY,
- CUSTOMIZER_TEST_VALUE);
- this.verifySetCustomizationProperty(
- Entity.DESCRIPTOR_CUSTOMIZER_PROPERTY,
- CUSTOMIZER_KEY,
- CUSTOMIZER_TEST_VALUE,
- CUSTOMIZER_TEST_VALUE_2);
- }
-
- public void testAddRemoveCustomization() throws Exception {
- this.verifyAddRemoveCustomizationProperty(
- Entity.DESCRIPTOR_CUSTOMIZER_PROPERTY,
- CUSTOMIZER_KEY,
- CUSTOMIZER_TEST_VALUE,
- CUSTOMIZER_TEST_VALUE_2);
- }
-
- // ********** Profiler tests **********
- public void testSetProfiler() throws Exception {
- this.verifyModelInitialized(
- PROFILER_KEY,
- this.getEclipseLinkStringValueOf(PROFILER_TEST_VALUE)); // model is storing EclipseLinkStringValue
- // verify set enum value
- this.verifySetProperty(
- PROFILER_KEY,
- PROFILER_TEST_VALUE,
- PROFILER_TEST_VALUE_2);
- // verify set custom and literal value
- this.verifySetProfiler(
- PROFILER_KEY,
- PROFILER_TEST_VALUE,
- PROFILER_TEST_VALUE_2);
- }
-
- public void testAddRemoveProfiler() throws Exception {
- this.verifyAddRemoveProperty(
- PROFILER_KEY,
- PROFILER_TEST_VALUE,
- PROFILER_TEST_VALUE_2);
- }
-
- /**
- * Verifies setting custom profiler and literals.
- */
- protected void verifySetProfiler(String elKey, Object testValue1, Object testValue2) throws Exception {
- PersistenceUnit.Property property = this.getPersistenceUnit().getProperty(elKey);
- String propertyName = this.getModel().propertyIdOf(property);
- // test set custom profiler.
- this.clearEvent();
- this.setProperty(propertyName, testValue2);
- this.verifyPutProperty(propertyName, testValue2);
-
- // test set (Profiler) null
- this.clearEvent();
- this.customization.setProfiler((Profiler) null);
- assertNull(this.getPersistenceUnit().getProperty(elKey));
- this.verifyPutProperty(propertyName, null);
-
- // test set enum literal
- this.clearEvent();
- this.setProperty(propertyName, testValue1.toString());
- assertNotNull(this.getPersistenceUnit().getProperty(elKey));
- this.verifyPutProperty(propertyName, this.getEclipseLinkStringValueOf(testValue1));
-
- // test set (String) null
- this.clearEvent();
- this.customization.setProfiler((String) null);
- assertNull(this.getPersistenceUnit().getProperty(elKey));
- this.verifyPutProperty(propertyName, null);
- }
-
-
-
- // ****** convenience methods *******
-
- // ********** verify SessionCustomizer property **********
- protected void verifySetSessionCustomizationProperty(String propertyName, String key, Object testValue1, Object testValue2) throws Exception {
- // Replace
- this.persistenceUnitSetProperty(key, testValue2, true);
- this.propertiesTotal++;
- this.verifyPutSessionCustomizerProperty(propertyName, testValue1);
- }
-
- protected void verifyAddRemoveSessionCustomizationProperty(String propertyName, String key, Object testValue1, Object testValue2) throws Exception {
- // Remove
- this.clearEvent();
- --this.propertiesTotal;
- --this.modelPropertiesSize;
- this.getPersistenceUnit().removeProperty(key, (String) testValue1);
- assertFalse(this.customization.sessionCustomizerExists(key));
- assertEquals(this.modelPropertiesSize, this.modelPropertiesSizeOriginal - 1);
-
- // Add original Property
- ++this.propertiesTotal;
- ++this.modelPropertiesSize;
- this.persistenceUnitSetProperty(key, testValue1, true);
- this.verifyPutSessionCustomizerProperty(propertyName, testValue1);
- }
-
- protected void verifyPutSessionCustomizerProperty(String propertyName, Object expectedValue) throws Exception {
- // verify event received
- assertNotNull("No Event Fired.", this.sessionCustomizersEvent);
- this.verifySessionCustomizerEvent(propertyName, expectedValue);
- }
-
- protected void verifySessionCustomizerEvent(String propertyName, Object expectedValue) throws Exception {
- // verify event value
- EclipseLinkCustomization customization = (EclipseLinkCustomization) this.sessionCustomizersEvent.getSource();
- assertTrue(customization.sessionCustomizerExists((String) expectedValue));
- return;
- }
-
- // ********** verify entity property **********
- protected void verifySetCustomizationProperty(String propertyName, String key, Object testValue1, Object testValue2) throws Exception {
- // Replace
- this.persistenceUnitSetProperty(key, testValue2);
- this.verifyPutCustomizationProperty(propertyName, ENTITY_TEST, testValue2);
-
- // Replace by setting model object
- this.clearEvent();
- this.setCustomizationProperty(propertyName, ENTITY_TEST, testValue1);
- this.verifyPutCustomizationProperty(propertyName, ENTITY_TEST, testValue1);
- }
-
- protected void verifyAddRemoveCustomizationProperty(String propertyName, String key, Object testValue1, Object testValue2) throws Exception {
- // Remove
- this.clearEvent();
- --this.propertiesTotal;
- --this.modelPropertiesSize;
- this.getPersistenceUnit().removeProperty(key);
- assertNull(this.getPersistenceUnit().getProperty(key));
- assertEquals(this.modelPropertiesSize, this.modelPropertiesSizeOriginal - 1);
- this.verifyPutCustomizationProperty(propertyName, ENTITY_TEST, null);
-
- // Add original Property
- ++this.propertiesTotal;
- ++this.modelPropertiesSize;
- this.persistenceUnitSetProperty(key, testValue1);
- this.verifyPutCustomizationProperty(propertyName, ENTITY_TEST, testValue1);
-
- // Replace
- this.persistenceUnitSetProperty(key, testValue2);
- this.verifyPutCustomizationProperty(propertyName, ENTITY_TEST, testValue2);
- }
-
- protected void verifyPutCustomizationProperty(String propertyName, String entityName, Object expectedValue) throws Exception {
- this.verifyEvent(propertyName);
- this.verifyCustomizationEvent(propertyName, entityName, expectedValue);
- }
-
- protected void verifyCustomizationEvent(String propertyName, String entityName, Object expectedValue) throws Exception {
- // verify event value
- Entity entity = (Entity) this.propertyChangedEvent.getNewValue();
- if (propertyName.equals(Entity.DESCRIPTOR_CUSTOMIZER_PROPERTY)) {
- assertEquals(expectedValue, entity.getParent().getDescriptorCustomizerOf(entityName));
- assertEquals(expectedValue, this.customization.getDescriptorCustomizerOf(entityName));
- }
- else {
- this.throwMissingDefinition("verifyCustomizationEvent", propertyName);
- }
- }
-
- protected void setCustomizationProperty(String propertyName, String entityName, Object newValue) throws NoSuchFieldException {
- if (propertyName.equals(Entity.DESCRIPTOR_CUSTOMIZER_PROPERTY))
- this.customization.setDescriptorCustomizerOf(entityName, (String) newValue);
- else
- this.throwMissingDefinition("setCustomizationProperty", propertyName);
- }
-
- // ********** get/set property **********
- @Override
- protected void setProperty(String propertyName, Object newValue) throws Exception {
- if (propertyName.equals(Customization.THROW_EXCEPTIONS_PROPERTY))
- this.customization.setThrowExceptions((Boolean) newValue);
- else if (propertyName.equals(Customization.WEAVING_LAZY_PROPERTY))
- this.customization.setWeavingLazy((Boolean) newValue);
- else if (propertyName.equals(Customization.WEAVING_CHANGE_TRACKING_PROPERTY))
- this.customization.setWeavingChangeTracking((Boolean) newValue);
- else if (propertyName.equals(Customization.WEAVING_FETCH_GROUPS_PROPERTY))
- this.customization.setWeavingFetchGroups((Boolean) newValue);
- else if (propertyName.equals(Customization.WEAVING_INTERNAL_PROPERTY))
- this.customization.setWeavingInternal((Boolean) newValue);
- else if (propertyName.equals(Customization.WEAVING_EAGER_PROPERTY))
- this.customization.setWeavingEager((Boolean) newValue);
- else if (propertyName.equals(Customization.VALIDATION_ONLY_PROPERTY))
- this.customization.setValidationOnly((Boolean) newValue);
- else if (propertyName.equals(Customization.EXCEPTION_HANDLER_PROPERTY))
- this.customization.setExceptionHandler((String) newValue);
- else if (propertyName.equals(Customization.SESSION_CUSTOMIZER_PROPERTY))
- this.customization.addSessionCustomizer((String) newValue);
- else if (propertyName.equals(Customization.WEAVING_PROPERTY))
- this.customization.setWeaving((Weaving) newValue);
- else if (propertyName.equals(Customization.PROFILER_PROPERTY)) {
- if (newValue.getClass().isEnum())
- this.customization.setProfiler((Profiler) newValue);
- else
- this.customization.setProfiler((String) newValue);
- }
- else
- this.throwMissingDefinition("setProperty", propertyName);
- }
-
- @Override
- protected Object getProperty(String propertyName) throws NoSuchFieldException {
- Object modelValue = null;
- if (propertyName.equals(Customization.THROW_EXCEPTIONS_PROPERTY))
- modelValue = this.customization.getThrowExceptions();
- else if (propertyName.equals(Customization.WEAVING_PROPERTY))
- modelValue = this.customization.getWeaving();
- else if (propertyName.equals(Customization.WEAVING_LAZY_PROPERTY))
- modelValue = this.customization.getWeavingLazy();
- else if (propertyName.equals(Customization.WEAVING_CHANGE_TRACKING_PROPERTY))
- modelValue = this.customization.getWeavingChangeTracking();
- else if (propertyName.equals(Customization.WEAVING_FETCH_GROUPS_PROPERTY))
- modelValue = this.customization.getWeavingFetchGroups();
- else if (propertyName.equals(Customization.WEAVING_INTERNAL_PROPERTY))
- modelValue = this.customization.getWeavingInternal();
- else if (propertyName.equals(Customization.WEAVING_EAGER_PROPERTY))
- modelValue = this.customization.getWeavingEager();
- else if (propertyName.equals(Customization.VALIDATION_ONLY_PROPERTY))
- modelValue = this.customization.getValidationOnly();
- else if (propertyName.equals(Customization.EXCEPTION_HANDLER_PROPERTY))
- modelValue = this.customization.getExceptionHandler();
- else if (propertyName.equals(Customization.PROFILER_PROPERTY))
- modelValue = this.customization.getProfiler();
- else if (propertyName.equals(Customization.SESSION_CUSTOMIZER_PROPERTY)) {
- ListIterator<String> iterator = this.customization.sessionCustomizers();
- if(iterator.hasNext()) {
- modelValue = iterator.next();
- }
- }
- else if (propertyName.equals(Entity.DESCRIPTOR_CUSTOMIZER_PROPERTY))
- modelValue = this.customization.getDescriptorCustomizerOf(ENTITY_TEST);
- else
- this.throwMissingDefinition("getProperty", propertyName);
- return modelValue;
- }
-
- @Override
- protected void verifyPutProperty(String propertyName, Object expectedValue) throws Exception {
- Object expectedValue_ = expectedValue;
- if (propertyName.equals(Customization.PROFILER_PROPERTY)) {
-
- expectedValue_ = (expectedValue != null && expectedValue.getClass().isEnum()) ?
- this.getEclipseLinkStringValueOf(PROFILER_TEST_VALUE) : // model is storing EclipseLinkStringValue
- expectedValue;
- }
- super.verifyPutProperty(propertyName, expectedValue_);
- }
-
- @Override
- protected PersistenceUnitProperties getModel() {
- return this.customization;
- }
-}
diff --git a/jpa/tests/org.eclipse.jpt.eclipselink.core.tests/src/org/eclipse/jpt/eclipselink/core/tests/internal/context/persistence/customization/CustomizationValueModelTests.java b/jpa/tests/org.eclipse.jpt.eclipselink.core.tests/src/org/eclipse/jpt/eclipselink/core/tests/internal/context/persistence/customization/CustomizationValueModelTests.java
deleted file mode 100644
index 00a41bed0e..0000000000
--- a/jpa/tests/org.eclipse.jpt.eclipselink.core.tests/src/org/eclipse/jpt/eclipselink/core/tests/internal/context/persistence/customization/CustomizationValueModelTests.java
+++ /dev/null
@@ -1,204 +0,0 @@
-/*******************************************************************************
- * Copyright (c) 2008, 2009 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.
- *
- * Contributors:
- * Oracle - initial API and implementation
- *******************************************************************************/
-package org.eclipse.jpt.eclipselink.core.tests.internal.context.persistence.customization;
-
-import org.eclipse.jpt.eclipselink.core.internal.context.persistence.PersistenceUnitProperties;
-import org.eclipse.jpt.eclipselink.core.internal.context.persistence.customization.Customization;
-import org.eclipse.jpt.eclipselink.core.internal.context.persistence.customization.Entity;
-import org.eclipse.jpt.eclipselink.core.tests.internal.context.persistence.PersistenceUnitTestCase;
-import org.eclipse.jpt.utility.internal.model.AbstractModel;
-import org.eclipse.jpt.utility.internal.model.value.PropertyAspectAdapter;
-import org.eclipse.jpt.utility.internal.model.value.SimplePropertyValueModel;
-import org.eclipse.jpt.utility.model.event.PropertyChangeEvent;
-import org.eclipse.jpt.utility.model.listener.PropertyChangeListener;
-import org.eclipse.jpt.utility.model.value.PropertyValueModel;
-import org.eclipse.jpt.utility.model.value.WritablePropertyValueModel;
-
-/**
- * CustomizationValueModelTests
- */
-public class CustomizationValueModelTests extends PersistenceUnitTestCase
-{
- private Customization customization;
-
- private WritablePropertyValueModel<Boolean> throwExceptionsHolder;
- private PropertyChangeListener throwExceptionsListener;
- private PropertyChangeEvent throwExceptionsEvent;
-
- public static final String ENTITY_NAME_TEST_VALUE = "Employee";
- public static final Boolean THROW_EXCEPTIONS_TEST_VALUE = Boolean.FALSE;
- public static final String CUSTOMIZER_TEST_VALUE = "acme.sessions.Customizer";
-
- public CustomizationValueModelTests(String name) {
- super(name);
- }
-
- @Override
- protected void setUp() throws Exception {
- super.setUp();
- this.customization = this.subject.getCustomization(); // Subject
- PropertyValueModel<Customization> customizationHolder = new SimplePropertyValueModel<Customization>(this.customization);
-
- this.throwExceptionsHolder = this.buildThrowExceptionsAA(customizationHolder);
- this.throwExceptionsListener = this.buildThrowExceptionsChangeListener();
- this.throwExceptionsHolder.addPropertyChangeListener(PropertyValueModel.VALUE, this.throwExceptionsListener);
- this.throwExceptionsEvent = null;
- }
-
- public void testHasListeners() {
- AbstractModel subjectCustomization = (AbstractModel) this.customization; // Subject
-
- PropertyAspectAdapter<Customization, Boolean> throwExceptionsAA =
- (PropertyAspectAdapter<Customization, Boolean>) this.throwExceptionsHolder;
- assertTrue(throwExceptionsAA.hasAnyPropertyChangeListeners(PropertyValueModel.VALUE));
- assertTrue(subjectCustomization.hasAnyPropertyChangeListeners(Customization.THROW_EXCEPTIONS_PROPERTY));
-
- throwExceptionsAA.removePropertyChangeListener(PropertyValueModel.VALUE, this.throwExceptionsListener);
- assertFalse(subjectCustomization.hasAnyPropertyChangeListeners(Customization.THROW_EXCEPTIONS_PROPERTY));
- assertFalse(throwExceptionsAA.hasAnyPropertyChangeListeners(PropertyValueModel.VALUE));
- }
-
- /**
- * Initializes directly the PU properties before testing.
- */
- @Override
- protected void populatePu() {
- this.persistenceUnitSetProperty(
- Customization.ECLIPSELINK_THROW_EXCEPTIONS,
- THROW_EXCEPTIONS_TEST_VALUE);
- return;
- }
-
- @Override
- protected PersistenceUnitProperties getModel() {
- return this.customization;
- }
-
- // ****** ThrowExceptions *******
- private WritablePropertyValueModel<Boolean> buildThrowExceptionsAA(PropertyValueModel<Customization> subjectHolder) {
- return new PropertyAspectAdapter<Customization, Boolean>(subjectHolder, Customization.THROW_EXCEPTIONS_PROPERTY) {
- @Override
- protected Boolean buildValue_() {
- return this.subject.getThrowExceptions();
- }
-
- @Override
- protected void setValue_(Boolean enumValue) {
- this.subject.setThrowExceptions(enumValue);
- }
- };
- }
-
- private PropertyChangeListener buildThrowExceptionsChangeListener() {
- return new PropertyChangeListener() {
- public void propertyChanged(PropertyChangeEvent e) {
- CustomizationValueModelTests.this.throwExceptionsEvent = e;
- }
- };
- }
-
- /** ****** Basic Entity's Properties Tests ******* */
-
- public void testClone() {
- Entity entity = this.buildEntity("TestEntity", CUSTOMIZER_TEST_VALUE);
-
- this.verifyClone(entity, entity.clone());
- }
-
- public void testEquals() {
- Entity entity1 = this.buildEntity("TestEntityA", CUSTOMIZER_TEST_VALUE);
- Entity entity2 = this.buildEntity("TestEntityB", CUSTOMIZER_TEST_VALUE);
- assertEquals(entity1, entity2);
- Entity entity3 = this.buildEntity("TestEntityC", CUSTOMIZER_TEST_VALUE);
- assertEquals(entity1, entity3);
- assertEquals(entity2, entity3);
- }
-
- public void testIsEmpty() {
- Entity entity = this.buildEntity("TestEntity");
- assertTrue(entity.isEmpty());
- this.customization.setDescriptorCustomizerOf(entity.getName(), CUSTOMIZER_TEST_VALUE);
- assertFalse(entity.isEmpty());
- }
-
- private void verifyClone(Entity original, Entity clone) {
- assertNotSame(original, clone);
- assertEquals(original, original);
- assertEquals(original, clone);
- }
-
- private Entity buildEntity(String name) {
- return this.customization.addEntity(name);
- }
-
- private Entity buildEntity(String name, String aClassName) {
- Entity entity = this.customization.addEntity(name);
- this.customization.setDescriptorCustomizerOf(entity.getName(), aClassName);
- return entity;
- }
-
- // ****** Tests *******
- public void testValue() {
- // ****** ThrowExceptions *******
- this.verifyThrowExceptionsAAValue(THROW_EXCEPTIONS_TEST_VALUE);
- assertEquals(Customization.DEFAULT_THROW_EXCEPTIONS, this.customization.getDefaultThrowExceptions());
- }
-
- public void testSetValue() throws Exception {
- // ****** ThrowExceptions *******
- this.throwExceptionsEvent = null;
- this.verifyHasListeners(this.throwExceptionsHolder, PropertyValueModel.VALUE);
- Boolean newThrowExceptions = !THROW_EXCEPTIONS_TEST_VALUE;
- // Modify the property holder
- this.throwExceptionsHolder.setValue(newThrowExceptions);
- this.verifyThrowExceptionsAAValue(newThrowExceptions);
- assertNotNull(this.throwExceptionsEvent);
- }
-
- public void testSetNullValue() {
- String notDeleted = "Property not deleted";
- // ****** ThrowExceptions *******
- this.throwExceptionsEvent = null;
- // Setting the property holder
- this.throwExceptionsHolder.setValue(null);
- // testing Holder
- this.verifyThrowExceptionsAAValue(null);
- assertNotNull(this.throwExceptionsEvent);
- // testing PU properties
- this.verifyPuHasNotProperty(Customization.ECLIPSELINK_THROW_EXCEPTIONS, notDeleted);
- }
-
- // ****** convenience methods *******
-
- /**
- * Performs three value tests:<br>
- * 1. subject value<br>
- * 2. aspect adapter value<br>
- * 3. persistenceUnit property value<br>
- */
- protected void verifyThrowExceptionsAAValue(Boolean testValue) {
- this.verifyAAValue(
- testValue,
- this.customization.getThrowExceptions(),
- this.throwExceptionsHolder,
- Customization.ECLIPSELINK_THROW_EXCEPTIONS);
- }
-
- // ********** get/set property **********
- @Override
- protected void setProperty(String propertyName, Object newValue) throws Exception {
- throw new UnsupportedOperationException();
- }
-
- @Override
- protected Object getProperty(String propertyName) throws NoSuchFieldException {
- throw new UnsupportedOperationException();
- }
-}
diff --git a/jpa/tests/org.eclipse.jpt.eclipselink.core.tests/src/org/eclipse/jpt/eclipselink/core/tests/internal/context/persistence/customization/JptEclipseLinkPersistenceCustomizationTests.java b/jpa/tests/org.eclipse.jpt.eclipselink.core.tests/src/org/eclipse/jpt/eclipselink/core/tests/internal/context/persistence/customization/JptEclipseLinkPersistenceCustomizationTests.java
deleted file mode 100644
index 9e64cf3b77..0000000000
--- a/jpa/tests/org.eclipse.jpt.eclipselink.core.tests/src/org/eclipse/jpt/eclipselink/core/tests/internal/context/persistence/customization/JptEclipseLinkPersistenceCustomizationTests.java
+++ /dev/null
@@ -1,33 +0,0 @@
-/*******************************************************************************
- * Copyright (c) 2008 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.
- *
- * Contributors:
- * Oracle - initial API and implementation
- ******************************************************************************/
-package org.eclipse.jpt.eclipselink.core.tests.internal.context.persistence.customization;
-
-import junit.framework.Test;
-import junit.framework.TestSuite;
-
-/**
- * decentralize test creation code
- */
-public class JptEclipseLinkPersistenceCustomizationTests
-{
- public static Test suite() {
- TestSuite suite = new TestSuite(JptEclipseLinkPersistenceCustomizationTests.class.getPackage().getName());
-
- suite.addTestSuite(CustomizationValueModelTests.class);
- suite.addTestSuite(CustomizationAdapterTests.class);
-
- return suite;
- }
-
- private JptEclipseLinkPersistenceCustomizationTests() {
- super();
- throw new UnsupportedOperationException();
- }
-}
diff --git a/jpa/tests/org.eclipse.jpt.eclipselink.core.tests/src/org/eclipse/jpt/eclipselink/core/tests/internal/context/persistence/general/GeneralPropertiesAdapterTests.java b/jpa/tests/org.eclipse.jpt.eclipselink.core.tests/src/org/eclipse/jpt/eclipselink/core/tests/internal/context/persistence/general/GeneralPropertiesAdapterTests.java
deleted file mode 100644
index 38dfea7f9a..0000000000
--- a/jpa/tests/org.eclipse.jpt.eclipselink.core.tests/src/org/eclipse/jpt/eclipselink/core/tests/internal/context/persistence/general/GeneralPropertiesAdapterTests.java
+++ /dev/null
@@ -1,105 +0,0 @@
-/*******************************************************************************
-* Copyright (c) 2008, 2009 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.
-*
-* Contributors:
-* Oracle - initial API and implementation
-*******************************************************************************/
-package org.eclipse.jpt.eclipselink.core.tests.internal.context.persistence.general;
-
-import org.eclipse.jpt.eclipselink.core.internal.context.persistence.PersistenceUnitProperties;
-import org.eclipse.jpt.eclipselink.core.internal.context.persistence.general.GeneralProperties;
-import org.eclipse.jpt.eclipselink.core.tests.internal.context.persistence.PersistenceUnitTestCase;
-import org.eclipse.jpt.utility.model.listener.PropertyChangeListener;
-
-/**
- * GeneralAdapterTests
- */
-@SuppressWarnings("nls")
-public class GeneralPropertiesAdapterTests extends PersistenceUnitTestCase
-{
- private GeneralProperties generalProperties;
-
- public static final String EXCLUDE_ECLIPSELINK_ORM_KEY = GeneralProperties.ECLIPSELINK_EXCLUDE_ECLIPSELINK_ORM;
- public static final Boolean EXCLUDE_ECLIPSELINK_ORM_TEST_VALUE = false;
- public static final Boolean EXCLUDE_ECLIPSELINK_ORM_TEST_VALUE_2 = ! EXCLUDE_ECLIPSELINK_ORM_TEST_VALUE;
-
-
- public GeneralPropertiesAdapterTests(String name) {
- super(name);
- }
-
- @Override
- protected void setUp() throws Exception {
- super.setUp();
- this.generalProperties = this.subject.getGeneralProperties();
- PropertyChangeListener propertyChangeListener = this.buildPropertyChangeListener();
-
- this.generalProperties.addPropertyChangeListener(GeneralProperties.EXCLUDE_ECLIPSELINK_ORM_PROPERTY, propertyChangeListener);
-
- this.clearEvent();
- }
-
- /**
- * Initializes directly the PU properties before testing.
- */
- @Override
- protected void populatePu() {
- this.modelPropertiesSizeOriginal = 1;
- this.propertiesTotal = this.modelPropertiesSizeOriginal + 2; // misc properties
- this.modelPropertiesSize = this.modelPropertiesSizeOriginal;
-
- this.persistenceUnitSetProperty("misc.property.1", "value.1");
- this.persistenceUnitSetProperty(EXCLUDE_ECLIPSELINK_ORM_KEY, EXCLUDE_ECLIPSELINK_ORM_TEST_VALUE.toString());
- this.persistenceUnitSetProperty("misc.property.2", "value.2");
-
- return;
- }
-
-
- // ********** ExcludeEclipselinkOrm tests **********
- public void testSetExcludeEclipselinkOrm() throws Exception {
- this.verifyModelInitialized(
- EXCLUDE_ECLIPSELINK_ORM_KEY,
- EXCLUDE_ECLIPSELINK_ORM_TEST_VALUE);
- this.verifySetProperty(
- EXCLUDE_ECLIPSELINK_ORM_KEY,
- EXCLUDE_ECLIPSELINK_ORM_TEST_VALUE,
- EXCLUDE_ECLIPSELINK_ORM_TEST_VALUE_2);
- }
-
- public void testAddRemoveExcludeEclipselinkOrm() throws Exception {
- this.verifyAddRemoveProperty(
- EXCLUDE_ECLIPSELINK_ORM_KEY,
- EXCLUDE_ECLIPSELINK_ORM_TEST_VALUE,
- EXCLUDE_ECLIPSELINK_ORM_TEST_VALUE_2);
- }
-
-
-
- // ********** get/set property **********
- @Override
- protected Object getProperty(String propertyName) throws NoSuchFieldException {
- Object modelValue = null;
- if (propertyName.equals(GeneralProperties.EXCLUDE_ECLIPSELINK_ORM_PROPERTY))
- modelValue = this.generalProperties.getExcludeEclipselinkOrm();
- else
- this.throwMissingDefinition("getProperty", propertyName);
- return modelValue;
- }
-
- @Override
- protected void setProperty(String propertyName, Object newValue) throws Exception {
- if (propertyName.equals(GeneralProperties.EXCLUDE_ECLIPSELINK_ORM_PROPERTY))
- this.generalProperties.setExcludeEclipselinkOrm((Boolean) newValue);
- else
- this.throwMissingDefinition("setProperty", propertyName);
- }
-
- @Override
- protected PersistenceUnitProperties getModel() {
- return this.generalProperties;
- }
-}
diff --git a/jpa/tests/org.eclipse.jpt.eclipselink.core.tests/src/org/eclipse/jpt/eclipselink/core/tests/internal/context/persistence/general/GeneralPropertiesValueModelTests.java b/jpa/tests/org.eclipse.jpt.eclipselink.core.tests/src/org/eclipse/jpt/eclipselink/core/tests/internal/context/persistence/general/GeneralPropertiesValueModelTests.java
deleted file mode 100644
index 7b0cd069d5..0000000000
--- a/jpa/tests/org.eclipse.jpt.eclipselink.core.tests/src/org/eclipse/jpt/eclipselink/core/tests/internal/context/persistence/general/GeneralPropertiesValueModelTests.java
+++ /dev/null
@@ -1,162 +0,0 @@
-/*******************************************************************************
- * Copyright (c) 2008, 2009 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.
- *
- * Contributors:
- * Oracle - initial API and implementation
- *******************************************************************************/
-package org.eclipse.jpt.eclipselink.core.tests.internal.context.persistence.general;
-
-import org.eclipse.jpt.eclipselink.core.internal.context.persistence.PersistenceUnitProperties;
-import org.eclipse.jpt.eclipselink.core.internal.context.persistence.general.GeneralProperties;
-import org.eclipse.jpt.eclipselink.core.tests.internal.context.persistence.PersistenceUnitTestCase;
-import org.eclipse.jpt.utility.internal.model.AbstractModel;
-import org.eclipse.jpt.utility.internal.model.value.PropertyAspectAdapter;
-import org.eclipse.jpt.utility.internal.model.value.SimplePropertyValueModel;
-import org.eclipse.jpt.utility.model.event.PropertyChangeEvent;
-import org.eclipse.jpt.utility.model.listener.PropertyChangeListener;
-import org.eclipse.jpt.utility.model.value.PropertyValueModel;
-import org.eclipse.jpt.utility.model.value.WritablePropertyValueModel;
-
-/**
- * GeneralPropertyValueModelTests
- */
-@SuppressWarnings("nls")
-public class GeneralPropertiesValueModelTests extends PersistenceUnitTestCase
-{
- private GeneralProperties generalProperty;
-
- private WritablePropertyValueModel<Boolean> excludeEclipselinkOrmHolder;
- private PropertyChangeListener excludeEclipselinkOrmListener;
- private PropertyChangeEvent excludeEclipselinkOrmEvent;
-
- public static final Boolean EXCLUDE_ECLIPSELINK_ORM_TEST_VALUE = Boolean.FALSE;
-
- public GeneralPropertiesValueModelTests(String name) {
- super(name);
- }
-
- @Override
- protected void setUp() throws Exception {
- super.setUp();
- this.generalProperty = this.subject.getGeneralProperties(); // Subject
- PropertyValueModel<GeneralProperties> generalPropertyHolder = new SimplePropertyValueModel<GeneralProperties>(this.generalProperty);
-
- this.excludeEclipselinkOrmHolder = this.buildExcludeEclipselinkOrmAA(generalPropertyHolder);
- this.excludeEclipselinkOrmListener = this.buildExcludeEclipselinkOrmChangeListener();
- this.excludeEclipselinkOrmHolder.addPropertyChangeListener(PropertyValueModel.VALUE, this.excludeEclipselinkOrmListener);
- this.excludeEclipselinkOrmEvent = null;
- }
-
- public void testHasListeners() {
- AbstractModel subjectGeneralProperty = (AbstractModel) this.generalProperty; // Subject
-
- PropertyAspectAdapter<GeneralProperties, Boolean> excludeEclipselinkOrmAA =
- (PropertyAspectAdapter<GeneralProperties, Boolean>) this.excludeEclipselinkOrmHolder;
- assertTrue(excludeEclipselinkOrmAA.hasAnyPropertyChangeListeners(PropertyValueModel.VALUE));
- assertTrue(subjectGeneralProperty.hasAnyPropertyChangeListeners(GeneralProperties.EXCLUDE_ECLIPSELINK_ORM_PROPERTY));
-
- excludeEclipselinkOrmAA.removePropertyChangeListener(PropertyValueModel.VALUE, this.excludeEclipselinkOrmListener);
- assertFalse(subjectGeneralProperty.hasAnyPropertyChangeListeners(GeneralProperties.EXCLUDE_ECLIPSELINK_ORM_PROPERTY));
- assertFalse(excludeEclipselinkOrmAA.hasAnyPropertyChangeListeners(PropertyValueModel.VALUE));
- }
-
- /**
- * Initializes directly the PU properties before testing.
- */
- @Override
- protected void populatePu() {
- this.persistenceUnitSetProperty(
- GeneralProperties.ECLIPSELINK_EXCLUDE_ECLIPSELINK_ORM,
- EXCLUDE_ECLIPSELINK_ORM_TEST_VALUE);
- return;
- }
-
- @Override
- protected PersistenceUnitProperties getModel() {
- return this.generalProperty;
- }
-
- // ****** ExcludeEclipselinkOrm *******
- private WritablePropertyValueModel<Boolean> buildExcludeEclipselinkOrmAA(PropertyValueModel<GeneralProperties> subjectHolder) {
- return new PropertyAspectAdapter<GeneralProperties, Boolean>(subjectHolder, GeneralProperties.EXCLUDE_ECLIPSELINK_ORM_PROPERTY) {
- @Override
- protected Boolean buildValue_() {
- return this.subject.getExcludeEclipselinkOrm();
- }
-
- @Override
- protected void setValue_(Boolean enumValue) {
- this.subject.setExcludeEclipselinkOrm(enumValue);
- }
- };
- }
-
- private PropertyChangeListener buildExcludeEclipselinkOrmChangeListener() {
- return new PropertyChangeListener() {
- public void propertyChanged(PropertyChangeEvent e) {
- GeneralPropertiesValueModelTests.this.excludeEclipselinkOrmEvent = e;
- }
- };
- }
-
- // ****** Tests *******
- public void testValue() {
- // ****** ExcludeEclipselinkOrm *******
- this.verifyExcludeEclipselinkOrmAAValue(EXCLUDE_ECLIPSELINK_ORM_TEST_VALUE);
- assertEquals(GeneralProperties.DEFAULT_EXCLUDE_ECLIPSELINK_ORM, this.generalProperty.getDefaultExcludeEclipselinkOrm());
- }
-
- public void testSetValue() throws Exception {
- // ****** ExcludeEclipselinkOrm *******
- this.excludeEclipselinkOrmEvent = null;
- this.verifyHasListeners(this.excludeEclipselinkOrmHolder, PropertyValueModel.VALUE);
- Boolean newExcludeEclipselinkOrm = !EXCLUDE_ECLIPSELINK_ORM_TEST_VALUE;
- // Modify the property holder
- this.excludeEclipselinkOrmHolder.setValue(newExcludeEclipselinkOrm);
- this.verifyExcludeEclipselinkOrmAAValue(newExcludeEclipselinkOrm);
- assertNotNull(this.excludeEclipselinkOrmEvent);
- }
-
- public void testSetNullValue() {
- String notDeleted = "Property not deleted";
- // ****** ExcludeEclipselinkOrm *******
- this.excludeEclipselinkOrmEvent = null;
- // Setting the property holder
- this.excludeEclipselinkOrmHolder.setValue(null);
- // testing Holder
- this.verifyExcludeEclipselinkOrmAAValue(null);
- assertNotNull(this.excludeEclipselinkOrmEvent);
- // testing PU properties
- this.verifyPuHasNotProperty(GeneralProperties.ECLIPSELINK_EXCLUDE_ECLIPSELINK_ORM, notDeleted);
- }
-
- // ****** convenience methods *******
-
- /**
- * Performs three value tests:<br>
- * 1. subject value<br>
- * 2. aspect adapter value<br>
- * 3. persistenceUnit property value<br>
- */
- protected void verifyExcludeEclipselinkOrmAAValue(Boolean testValue) {
- this.verifyAAValue(
- testValue,
- this.generalProperty.getExcludeEclipselinkOrm(),
- this.excludeEclipselinkOrmHolder,
- GeneralProperties.ECLIPSELINK_EXCLUDE_ECLIPSELINK_ORM);
- }
-
- // ********** get/set property **********
- @Override
- protected void setProperty(String propertyName, Object newValue) throws Exception {
- throw new UnsupportedOperationException();
- }
-
- @Override
- protected Object getProperty(String propertyName) throws NoSuchFieldException {
- throw new UnsupportedOperationException();
- }
-}
diff --git a/jpa/tests/org.eclipse.jpt.eclipselink.core.tests/src/org/eclipse/jpt/eclipselink/core/tests/internal/context/persistence/general/JptEclipseLinkPersistenceGeneralTests.java b/jpa/tests/org.eclipse.jpt.eclipselink.core.tests/src/org/eclipse/jpt/eclipselink/core/tests/internal/context/persistence/general/JptEclipseLinkPersistenceGeneralTests.java
deleted file mode 100644
index 2ba84831d4..0000000000
--- a/jpa/tests/org.eclipse.jpt.eclipselink.core.tests/src/org/eclipse/jpt/eclipselink/core/tests/internal/context/persistence/general/JptEclipseLinkPersistenceGeneralTests.java
+++ /dev/null
@@ -1,33 +0,0 @@
-/*******************************************************************************
- * Copyright (c) 2008 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.
- *
- * Contributors:
- * Oracle - initial API and implementation
- ******************************************************************************/
-package org.eclipse.jpt.eclipselink.core.tests.internal.context.persistence.general;
-
-import junit.framework.Test;
-import junit.framework.TestSuite;
-
-/**
- * decentralize test creation code
- */
-public class JptEclipseLinkPersistenceGeneralTests
-{
- public static Test suite() {
- TestSuite suite = new TestSuite(JptEclipseLinkPersistenceGeneralTests.class.getPackage().getName());
-
- suite.addTestSuite(GeneralPropertiesValueModelTests.class);
- suite.addTestSuite(GeneralPropertiesAdapterTests.class);
-
- return suite;
- }
-
- private JptEclipseLinkPersistenceGeneralTests() {
- super();
- throw new UnsupportedOperationException();
- }
-}
diff --git a/jpa/tests/org.eclipse.jpt.eclipselink.core.tests/src/org/eclipse/jpt/eclipselink/core/tests/internal/context/persistence/logging/JptEclipseLinkPersistenceLoggingTests.java b/jpa/tests/org.eclipse.jpt.eclipselink.core.tests/src/org/eclipse/jpt/eclipselink/core/tests/internal/context/persistence/logging/JptEclipseLinkPersistenceLoggingTests.java
deleted file mode 100644
index 51dc7e4f3a..0000000000
--- a/jpa/tests/org.eclipse.jpt.eclipselink.core.tests/src/org/eclipse/jpt/eclipselink/core/tests/internal/context/persistence/logging/JptEclipseLinkPersistenceLoggingTests.java
+++ /dev/null
@@ -1,33 +0,0 @@
-/*******************************************************************************
- * Copyright (c) 2008 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.
- *
- * Contributors:
- * Oracle - initial API and implementation
- ******************************************************************************/
-package org.eclipse.jpt.eclipselink.core.tests.internal.context.persistence.logging;
-
-import junit.framework.Test;
-import junit.framework.TestSuite;
-
-/**
- * decentralize test creation code
- */
-public class JptEclipseLinkPersistenceLoggingTests
-{
- public static Test suite() {
- TestSuite suite = new TestSuite(JptEclipseLinkPersistenceLoggingTests.class.getPackage().getName());
-
- suite.addTestSuite(LoggingValueModelTests.class);
- suite.addTestSuite(LoggingAdapterTests.class);
-
- return suite;
- }
-
- private JptEclipseLinkPersistenceLoggingTests() {
- super();
- throw new UnsupportedOperationException();
- }
-}
diff --git a/jpa/tests/org.eclipse.jpt.eclipselink.core.tests/src/org/eclipse/jpt/eclipselink/core/tests/internal/context/persistence/logging/LoggingAdapterTests.java b/jpa/tests/org.eclipse.jpt.eclipselink.core.tests/src/org/eclipse/jpt/eclipselink/core/tests/internal/context/persistence/logging/LoggingAdapterTests.java
deleted file mode 100644
index 9e490617bd..0000000000
--- a/jpa/tests/org.eclipse.jpt.eclipselink.core.tests/src/org/eclipse/jpt/eclipselink/core/tests/internal/context/persistence/logging/LoggingAdapterTests.java
+++ /dev/null
@@ -1,325 +0,0 @@
-/*******************************************************************************
-* Copyright (c) 2008, 2009 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.
-*
-* Contributors:
-* Oracle - initial API and implementation
-*******************************************************************************/
-package org.eclipse.jpt.eclipselink.core.tests.internal.context.persistence.logging;
-
-import org.eclipse.jpt.core.context.persistence.PersistenceUnit;
-import org.eclipse.jpt.eclipselink.core.internal.context.persistence.PersistenceUnitProperties;
-import org.eclipse.jpt.eclipselink.core.internal.context.persistence.logging.Logger;
-import org.eclipse.jpt.eclipselink.core.internal.context.persistence.logging.Logging;
-import org.eclipse.jpt.eclipselink.core.internal.context.persistence.logging.LoggingLevel;
-import org.eclipse.jpt.eclipselink.core.tests.internal.context.persistence.PersistenceUnitTestCase;
-import org.eclipse.jpt.utility.model.listener.PropertyChangeListener;
-
-/**
- * Tests the update of model objects by the Logging adapter when the
- * PersistenceUnit changes.
- */
-public class LoggingAdapterTests extends PersistenceUnitTestCase
-{
- private Logging logging;
-
- public static final String LEVEL_KEY = Logging.ECLIPSELINK_LEVEL;
- public static final LoggingLevel LEVEL_TEST_VALUE = LoggingLevel.fine;
- public static final LoggingLevel LEVEL_TEST_VALUE_2 = LoggingLevel.finest;
-
- public static final String TIMESTAMP_KEY = Logging.ECLIPSELINK_TIMESTAMP;
- public static final Boolean TIMESTAMP_TEST_VALUE = false;
- public static final Boolean TIMESTAMP_TEST_VALUE_2 = ! TIMESTAMP_TEST_VALUE;
-
- public static final String THREAD_KEY = Logging.ECLIPSELINK_THREAD;
- public static final Boolean THREAD_TEST_VALUE = false;
- public static final Boolean THREAD_TEST_VALUE_2 = ! THREAD_TEST_VALUE;
-
- public static final String SESSION_KEY = Logging.ECLIPSELINK_SESSION;
- public static final Boolean SESSION_TEST_VALUE = false;
- public static final Boolean SESSION_TEST_VALUE_2 = ! SESSION_TEST_VALUE;
-
- public static final String EXCEPTIONS_KEY = Logging.ECLIPSELINK_EXCEPTIONS;
- public static final Boolean EXCEPTIONS_TEST_VALUE = false;
- public static final Boolean EXCEPTIONS_TEST_VALUE_2 = ! EXCEPTIONS_TEST_VALUE;
-
- private static final String LOG_FILE_LOCATION_KEY = Logging.ECLIPSELINK_LOG_FILE_LOCATION;
- private static final String LOG_FILE_LOCATION_TEST_VALUE = "C:/temp";
- private static final String LOG_FILE_LOCATION_TEST_VALUE_2 = "C:/tmp";
-
- private static final String LOGGER_KEY = Logging.ECLIPSELINK_LOGGER;
- private static final Logger LOGGER_TEST_VALUE = Logger.java_logger;
- private static final String LOGGER_TEST_VALUE_2 = "custom.logger.test";
-
- public LoggingAdapterTests(String name) {
- super(name);
- }
-
- @Override
- protected void setUp() throws Exception {
- super.setUp();
- this.logging = this.subject.getLogging();
- PropertyChangeListener propertyChangeListener = this.buildPropertyChangeListener();
-
- this.logging.addPropertyChangeListener(Logging.LEVEL_PROPERTY, propertyChangeListener);
- this.logging.addPropertyChangeListener(Logging.TIMESTAMP_PROPERTY, propertyChangeListener);
- this.logging.addPropertyChangeListener(Logging.THREAD_PROPERTY, propertyChangeListener);
- this.logging.addPropertyChangeListener(Logging.SESSION_PROPERTY, propertyChangeListener);
- this.logging.addPropertyChangeListener(Logging.EXCEPTIONS_PROPERTY, propertyChangeListener);
- this.logging.addPropertyChangeListener(Logging.LOG_FILE_LOCATION_PROPERTY, propertyChangeListener);
- this.logging.addPropertyChangeListener(Logging.LOGGER_PROPERTY, propertyChangeListener);
-
- this.clearEvent();
- }
-
- /**
- * Initializes directly the PU properties before testing.
- */
- @Override
- protected void populatePu() {
- this.modelPropertiesSizeOriginal = 7;
- this.propertiesTotal = this.modelPropertiesSizeOriginal + 4; // 4 misc properties
- this.modelPropertiesSize = this.modelPropertiesSizeOriginal;
-
- this.persistenceUnitSetProperty("misc.property.1", "value.1");
- this.persistenceUnitSetProperty(TIMESTAMP_KEY, TIMESTAMP_TEST_VALUE.toString());
- this.persistenceUnitSetProperty("misc.property.2", "value.2");
- this.persistenceUnitSetProperty(LEVEL_KEY, LEVEL_TEST_VALUE);
- this.persistenceUnitSetProperty("misc.property.3", "value.3");
- this.persistenceUnitSetProperty(THREAD_KEY, THREAD_TEST_VALUE.toString());
- this.persistenceUnitSetProperty(SESSION_KEY, SESSION_TEST_VALUE.toString());
- this.persistenceUnitSetProperty(EXCEPTIONS_KEY, EXCEPTIONS_TEST_VALUE.toString());
- this.persistenceUnitSetProperty("misc.property.4", "value.4");
- this.persistenceUnitSetProperty(LOG_FILE_LOCATION_KEY, LOG_FILE_LOCATION_TEST_VALUE);
- this.persistenceUnitSetProperty(LOGGER_KEY, LOGGER_TEST_VALUE);
- return;
- }
-
- // ********** Level tests **********
- public void testSetLevel() throws Exception {
- this.verifyModelInitialized(
- LEVEL_KEY,
- LEVEL_TEST_VALUE);
- this.verifySetProperty(
- LEVEL_KEY,
- LEVEL_TEST_VALUE,
- LEVEL_TEST_VALUE_2);
- }
-
- public void testAddRemoveLevel() throws Exception {
- this.verifyAddRemoveProperty(
- LEVEL_KEY,
- LEVEL_TEST_VALUE,
- LEVEL_TEST_VALUE_2);
- }
-
- // ********** Timestamp tests **********
- public void testSetTimestamp() throws Exception {
- this.verifyModelInitialized(
- TIMESTAMP_KEY,
- TIMESTAMP_TEST_VALUE);
- this.verifySetProperty(
- TIMESTAMP_KEY,
- TIMESTAMP_TEST_VALUE,
- TIMESTAMP_TEST_VALUE_2);
- }
-
- public void testAddRemoveTimestamp() throws Exception {
- this.verifyAddRemoveProperty(
- TIMESTAMP_KEY,
- TIMESTAMP_TEST_VALUE,
- TIMESTAMP_TEST_VALUE_2);
- }
-
- // ********** Thread tests **********
- public void testSetThread() throws Exception {
- this.verifyModelInitialized(
- THREAD_KEY,
- THREAD_TEST_VALUE);
- this.verifySetProperty(
- THREAD_KEY,
- THREAD_TEST_VALUE,
- THREAD_TEST_VALUE_2);
- }
-
- public void testAddRemoveThread() throws Exception {
- this.verifyAddRemoveProperty(
- THREAD_KEY,
- THREAD_TEST_VALUE,
- THREAD_TEST_VALUE_2);
- }
-
- // ********** Session tests **********
- public void testSetSession() throws Exception {
- this.verifyModelInitialized(
- SESSION_KEY,
- SESSION_TEST_VALUE);
- this.verifySetProperty(
- SESSION_KEY,
- SESSION_TEST_VALUE,
- SESSION_TEST_VALUE_2);
- }
-
- public void testAddRemoveSession() throws Exception {
- this.verifyAddRemoveProperty(
- SESSION_KEY,
- SESSION_TEST_VALUE,
- SESSION_TEST_VALUE_2);
- }
-
- // ********** Exceptions tests **********
- public void testSetExceptions() throws Exception {
- this.verifyModelInitialized(
- EXCEPTIONS_KEY,
- EXCEPTIONS_TEST_VALUE);
- this.verifySetProperty(
- EXCEPTIONS_KEY,
- EXCEPTIONS_TEST_VALUE,
- EXCEPTIONS_TEST_VALUE_2);
- }
-
- public void testAddRemoveExceptions() throws Exception {
- this.verifyAddRemoveProperty(
- EXCEPTIONS_KEY,
- EXCEPTIONS_TEST_VALUE,
- EXCEPTIONS_TEST_VALUE_2);
- }
-
- // ********** LogFileLocation **********
- public void testSetLogFileLocation() throws Exception {
- this.verifyModelInitialized(
- LOG_FILE_LOCATION_KEY,
- LOG_FILE_LOCATION_TEST_VALUE);
- this.verifySetProperty(
- LOG_FILE_LOCATION_KEY,
- LOG_FILE_LOCATION_TEST_VALUE,
- LOG_FILE_LOCATION_TEST_VALUE_2);
- }
-
- public void testAddRemoveLogFileLocation() throws Exception {
- this.verifyAddRemoveProperty(
- LOG_FILE_LOCATION_KEY,
- LOG_FILE_LOCATION_TEST_VALUE,
- LOG_FILE_LOCATION_TEST_VALUE_2);
- }
-
- // ********** Logger tests **********
- public void testSetLogger() throws Exception {
- this.verifyModelInitialized(
- LOGGER_KEY,
- this.getEclipseLinkStringValueOf(LOGGER_TEST_VALUE)); // model is storing EclipseLinkStringValue
- // verify set enum value
- this.verifySetProperty(
- LOGGER_KEY,
- LOGGER_TEST_VALUE,
- LOGGER_TEST_VALUE_2);
- // verify set custom and literal value
- this.verifySetLogger(
- LOGGER_KEY,
- LOGGER_TEST_VALUE,
- LOGGER_TEST_VALUE_2);
- }
-
- public void testAddRemoveLogger() throws Exception {
- this.verifyAddRemoveProperty(
- LOGGER_KEY,
- LOGGER_TEST_VALUE,
- LOGGER_TEST_VALUE_2);
- }
-
- /**
- * Verifies setting custom logger and literals.
- */
- protected void verifySetLogger(String elKey, Object testValue1, Object testValue2) throws Exception {
- PersistenceUnit.Property property = this.getPersistenceUnit().getProperty(elKey);
- String propertyName = this.getModel().propertyIdOf(property);
- // test set custom logger.
- this.clearEvent();
- this.setProperty(propertyName, testValue2);
- this.verifyPutProperty(propertyName, testValue2);
-
- // test set (Logger) null
- this.clearEvent();
- this.logging.setLogger((Logger) null);
- assertNull(this.getPersistenceUnit().getProperty(elKey));
- this.verifyPutProperty(propertyName, null);
-
- // test set enum literal
- this.clearEvent();
- this.setProperty(propertyName, testValue1.toString());
- assertNotNull(this.getPersistenceUnit().getProperty(elKey));
- this.verifyPutProperty(propertyName, this.getEclipseLinkStringValueOf(testValue1));
-
- // test set (String) null
- this.clearEvent();
- this.logging.setLogger((String) null);
- assertNull(this.getPersistenceUnit().getProperty(elKey));
- this.verifyPutProperty(propertyName, null);
- }
-
- // ********** get/set property **********
- @Override
- protected void setProperty(String propertyName, Object newValue) throws Exception {
- if (propertyName.equals(Logging.LEVEL_PROPERTY))
- this.logging.setLevel((LoggingLevel) newValue);
- else if (propertyName.equals(Logging.TIMESTAMP_PROPERTY))
- this.logging.setTimestamp((Boolean) newValue);
- else if (propertyName.equals(Logging.THREAD_PROPERTY))
- this.logging.setThread((Boolean) newValue);
- else if (propertyName.equals(Logging.SESSION_PROPERTY))
- this.logging.setSession((Boolean) newValue);
- else if (propertyName.equals(Logging.EXCEPTIONS_PROPERTY))
- this.logging.setExceptions((Boolean) newValue);
- else if (propertyName.equals(Logging.LOG_FILE_LOCATION_PROPERTY))
- this.logging.setLogFileLocation((String) newValue);
- else if (propertyName.equals(Logging.LOGGER_PROPERTY)) {
- if (newValue.getClass().isEnum())
- this.logging.setLogger((Logger) newValue);
- else
- this.logging.setLogger((String) newValue);
- }
- else
- this.throwMissingDefinition("setProperty", propertyName);
- }
-
- @Override
- protected Object getProperty(String propertyName) throws NoSuchFieldException {
- Object modelValue = null;
- if (propertyName.equals(Logging.LEVEL_PROPERTY))
- modelValue = this.logging.getLevel();
- else if (propertyName.equals(Logging.TIMESTAMP_PROPERTY))
- modelValue = this.logging.getTimestamp();
- else if (propertyName.equals(Logging.THREAD_PROPERTY))
- modelValue = this.logging.getThread();
- else if (propertyName.equals(Logging.SESSION_PROPERTY))
- modelValue = this.logging.getSession();
- else if (propertyName.equals(Logging.EXCEPTIONS_PROPERTY))
- modelValue = this.logging.getExceptions();
- else if (propertyName.equals(Logging.LOG_FILE_LOCATION_PROPERTY))
- modelValue = this.logging.getLogFileLocation();
- else if (propertyName.equals(Logging.LOGGER_PROPERTY))
- modelValue = this.logging.getLogger();
- else
- this.throwMissingDefinition("getProperty", propertyName);
- return modelValue;
- }
-
- @Override
- protected void verifyPutProperty(String propertyName, Object expectedValue) throws Exception {
- Object expectedValue_ = expectedValue;
- if (propertyName.equals(Logging.LOGGER_PROPERTY)) {
-
- expectedValue_ = (expectedValue != null && expectedValue.getClass().isEnum()) ?
- this.getEclipseLinkStringValueOf(LOGGER_TEST_VALUE) : // model is storing EclipseLinkStringValue
- expectedValue;
- }
- super.verifyPutProperty(propertyName, expectedValue_);
- }
-
- @Override
- protected PersistenceUnitProperties getModel() {
- return this.logging;
- }
-}
diff --git a/jpa/tests/org.eclipse.jpt.eclipselink.core.tests/src/org/eclipse/jpt/eclipselink/core/tests/internal/context/persistence/logging/LoggingValueModelTests.java b/jpa/tests/org.eclipse.jpt.eclipselink.core.tests/src/org/eclipse/jpt/eclipselink/core/tests/internal/context/persistence/logging/LoggingValueModelTests.java
deleted file mode 100644
index 4a9c8b91d1..0000000000
--- a/jpa/tests/org.eclipse.jpt.eclipselink.core.tests/src/org/eclipse/jpt/eclipselink/core/tests/internal/context/persistence/logging/LoggingValueModelTests.java
+++ /dev/null
@@ -1,162 +0,0 @@
-/*******************************************************************************
- * Copyright (c) 2008, 2009 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.
- *
- * Contributors:
- * Oracle - initial API and implementation
- *******************************************************************************/
-package org.eclipse.jpt.eclipselink.core.tests.internal.context.persistence.logging;
-
-import org.eclipse.jpt.eclipselink.core.internal.context.persistence.PersistenceUnitProperties;
-import org.eclipse.jpt.eclipselink.core.internal.context.persistence.logging.Logging;
-import org.eclipse.jpt.eclipselink.core.tests.internal.context.persistence.PersistenceUnitTestCase;
-import org.eclipse.jpt.utility.internal.model.AbstractModel;
-import org.eclipse.jpt.utility.internal.model.value.PropertyAspectAdapter;
-import org.eclipse.jpt.utility.internal.model.value.SimplePropertyValueModel;
-import org.eclipse.jpt.utility.model.event.PropertyChangeEvent;
-import org.eclipse.jpt.utility.model.listener.PropertyChangeListener;
-import org.eclipse.jpt.utility.model.value.PropertyValueModel;
-import org.eclipse.jpt.utility.model.value.WritablePropertyValueModel;
-
-/**
- * LoggingValueModelTests
- */
-@SuppressWarnings("nls")
-public class LoggingValueModelTests extends PersistenceUnitTestCase
-{
- private Logging logging;
-
- private WritablePropertyValueModel<Boolean> timestampHolder;
- private PropertyChangeListener timestampListener;
- private PropertyChangeEvent timestampEvent;
-
- public static final Boolean TIMESTAMP_TEST_VALUE = Boolean.FALSE;
-
- public LoggingValueModelTests(String name) {
- super(name);
- }
-
- @Override
- protected void setUp() throws Exception {
- super.setUp();
- this.logging = this.subject.getLogging(); // Subject
- PropertyValueModel<Logging> loggingHolder = new SimplePropertyValueModel<Logging>(this.logging);
-
- this.timestampHolder = this.buildTimestampAA(loggingHolder);
- this.timestampListener = this.buildTimestampChangeListener();
- this.timestampHolder.addPropertyChangeListener(PropertyValueModel.VALUE, this.timestampListener);
- this.timestampEvent = null;
- }
-
- public void testHasListeners() {
- AbstractModel subjectLogging = (AbstractModel) this.logging; // Subject
-
- PropertyAspectAdapter<Logging, Boolean> timestampAA =
- (PropertyAspectAdapter<Logging, Boolean>) this.timestampHolder;
- assertTrue(timestampAA.hasAnyPropertyChangeListeners(PropertyValueModel.VALUE));
- assertTrue(subjectLogging.hasAnyPropertyChangeListeners(Logging.TIMESTAMP_PROPERTY));
-
- timestampAA.removePropertyChangeListener(PropertyValueModel.VALUE, this.timestampListener);
- assertFalse(subjectLogging.hasAnyPropertyChangeListeners(Logging.TIMESTAMP_PROPERTY));
- assertFalse(timestampAA.hasAnyPropertyChangeListeners(PropertyValueModel.VALUE));
- }
-
- /**
- * Initializes directly the PU properties before testing.
- */
- @Override
- protected void populatePu() {
- this.persistenceUnitSetProperty(
- Logging.ECLIPSELINK_TIMESTAMP,
- TIMESTAMP_TEST_VALUE);
- return;
- }
-
- @Override
- protected PersistenceUnitProperties getModel() {
- return this.logging;
- }
-
- // ****** Timestamp *******
- private WritablePropertyValueModel<Boolean> buildTimestampAA(PropertyValueModel<Logging> subjectHolder) {
- return new PropertyAspectAdapter<Logging, Boolean>(subjectHolder, Logging.TIMESTAMP_PROPERTY) {
- @Override
- protected Boolean buildValue_() {
- return this.subject.getTimestamp();
- }
-
- @Override
- protected void setValue_(Boolean enumValue) {
- this.subject.setTimestamp(enumValue);
- }
- };
- }
-
- private PropertyChangeListener buildTimestampChangeListener() {
- return new PropertyChangeListener() {
- public void propertyChanged(PropertyChangeEvent e) {
- LoggingValueModelTests.this.timestampEvent = e;
- }
- };
- }
-
- // ****** Tests *******
- public void testValue() {
- // ****** Timestamp *******
- this.verifyTimestampAAValue(TIMESTAMP_TEST_VALUE);
- assertEquals(Logging.DEFAULT_TIMESTAMP, this.logging.getDefaultTimestamp());
- }
-
- public void testSetValue() throws Exception {
- // ****** Timestamp *******
- this.timestampEvent = null;
- this.verifyHasListeners(this.timestampHolder, PropertyValueModel.VALUE);
- Boolean newTimestamp = !TIMESTAMP_TEST_VALUE;
- // Modify the property holder
- this.timestampHolder.setValue(newTimestamp);
- this.verifyTimestampAAValue(newTimestamp);
- assertNotNull(this.timestampEvent);
- }
-
- public void testSetNullValue() {
- String notDeleted = "Property not deleted";
- // ****** Timestamp *******
- this.timestampEvent = null;
- // Setting the property holder
- this.timestampHolder.setValue(null);
- // testing Holder
- this.verifyTimestampAAValue(null);
- assertNotNull(this.timestampEvent);
- // testing PU properties
- this.verifyPuHasNotProperty(Logging.ECLIPSELINK_TIMESTAMP, notDeleted);
- }
-
- // ****** convenience methods *******
-
- /**
- * Performs three value tests:<br>
- * 1. subject value<br>
- * 2. aspect adapter value<br>
- * 3. persistenceUnit property value<br>
- */
- protected void verifyTimestampAAValue(Boolean testValue) {
- this.verifyAAValue(
- testValue,
- this.logging.getTimestamp(),
- this.timestampHolder,
- Logging.ECLIPSELINK_TIMESTAMP);
- }
-
- // ********** get/set property **********
- @Override
- protected void setProperty(String propertyName, Object newValue) throws Exception {
- throw new UnsupportedOperationException();
- }
-
- @Override
- protected Object getProperty(String propertyName) throws NoSuchFieldException {
- throw new UnsupportedOperationException();
- }
-}
diff --git a/jpa/tests/org.eclipse.jpt.eclipselink.core.tests/src/org/eclipse/jpt/eclipselink/core/tests/internal/context/persistence/options/JptEclipseLinkPersistenceOptionsTests.java b/jpa/tests/org.eclipse.jpt.eclipselink.core.tests/src/org/eclipse/jpt/eclipselink/core/tests/internal/context/persistence/options/JptEclipseLinkPersistenceOptionsTests.java
deleted file mode 100644
index 5ce21dea5e..0000000000
--- a/jpa/tests/org.eclipse.jpt.eclipselink.core.tests/src/org/eclipse/jpt/eclipselink/core/tests/internal/context/persistence/options/JptEclipseLinkPersistenceOptionsTests.java
+++ /dev/null
@@ -1,33 +0,0 @@
-/*******************************************************************************
- * Copyright (c) 2008 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.
- *
- * Contributors:
- * Oracle - initial API and implementation
- ******************************************************************************/
-package org.eclipse.jpt.eclipselink.core.tests.internal.context.persistence.options;
-
-import junit.framework.Test;
-import junit.framework.TestSuite;
-
-/**
- * decentralize test creation code
- */
-public class JptEclipseLinkPersistenceOptionsTests
-{
- public static Test suite() {
- TestSuite suite = new TestSuite(JptEclipseLinkPersistenceOptionsTests.class.getPackage().getName());
-
- suite.addTestSuite(OptionsValueModelTests.class);
- suite.addTestSuite(OptionsAdapterTests.class);
-
- return suite;
- }
-
- private JptEclipseLinkPersistenceOptionsTests() {
- super();
- throw new UnsupportedOperationException();
- }
-}
diff --git a/jpa/tests/org.eclipse.jpt.eclipselink.core.tests/src/org/eclipse/jpt/eclipselink/core/tests/internal/context/persistence/options/OptionsAdapterTests.java b/jpa/tests/org.eclipse.jpt.eclipselink.core.tests/src/org/eclipse/jpt/eclipselink/core/tests/internal/context/persistence/options/OptionsAdapterTests.java
deleted file mode 100644
index cca9f8b905..0000000000
--- a/jpa/tests/org.eclipse.jpt.eclipselink.core.tests/src/org/eclipse/jpt/eclipselink/core/tests/internal/context/persistence/options/OptionsAdapterTests.java
+++ /dev/null
@@ -1,379 +0,0 @@
-/*******************************************************************************
-* Copyright (c) 2008, 2009 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.
-*
-* Contributors:
-* Oracle - initial API and implementation
-*******************************************************************************/
-package org.eclipse.jpt.eclipselink.core.tests.internal.context.persistence.options;
-
-import org.eclipse.jpt.core.context.persistence.PersistenceUnit;
-import org.eclipse.jpt.eclipselink.core.internal.context.persistence.PersistenceUnitProperties;
-import org.eclipse.jpt.eclipselink.core.internal.context.persistence.options.Options;
-import org.eclipse.jpt.eclipselink.core.internal.context.persistence.options.TargetDatabase;
-import org.eclipse.jpt.eclipselink.core.internal.context.persistence.options.TargetServer;
-import org.eclipse.jpt.eclipselink.core.tests.internal.context.persistence.PersistenceUnitTestCase;
-import org.eclipse.jpt.utility.model.listener.PropertyChangeListener;
-
-/**
- * Tests the update of model objects by the Option adapter when the
- * PersistenceUnit changes.
- */
-public class OptionsAdapterTests extends PersistenceUnitTestCase
-{
- private Options options;
-
- private static final String SESSION_NAME_KEY = Options.ECLIPSELINK_SESSION_NAME;
- private static final String SESSION_NAME_TEST_VALUE = "session-name.test";
- private static final String SESSION_NAME_TEST_VALUE_2 = "session-name-2.test";
-
- private static final String SESSIONS_XML_KEY = Options.ECLIPSELINK_SESSIONS_XML;
- private static final String SESSIONS_XML_TEST_VALUE = "sessions-xml.test";
- private static final String SESSIONS_XML_TEST_VALUE_2 = "sessions-xml-2.test";
-
- public static final String TARGET_DATABASE_KEY = Options.ECLIPSELINK_TARGET_DATABASE;
- public static final TargetDatabase TARGET_DATABASE_TEST_VALUE = TargetDatabase.cloudscape;
- public static final String TARGET_DATABASE_TEST_VALUE_2 = "custom.targetDatabase.test";
-
- private static final String TARGET_SERVER_KEY = Options.ECLIPSELINK_TARGET_SERVER;
- private static final TargetServer TARGET_SERVER_TEST_VALUE = TargetServer.weblogic_9;
- private static final String TARGET_SERVER_TEST_VALUE_2 = "custom.targetServer.test";
-
- public static final String INCLUDE_DESCRIPTOR_QUERIES_KEY = Options.ECLIPSELINK_SESSION_INCLUDE_DESCRIPTOR_QUERIES;
- public static final Boolean INCLUDE_DESCRIPTOR_QUERIES_TEST_VALUE = false;
- public static final Boolean INCLUDE_DESCRIPTOR_QUERIES_TEST_VALUE_2 = ! INCLUDE_DESCRIPTOR_QUERIES_TEST_VALUE;
-
- public static final String SESSION_EVENT_LISTENER_KEY = Options.ECLIPSELINK_SESSION_EVENT_LISTENER;
- public static final String SESSION_EVENT_LISTENER_TEST_VALUE = "acme.CustomSessionEventListener";
- public static final String SESSION_EVENT_LISTENER_TEST_VALUE_2 = "oracle.sessions.CustomSessionEventListener";
-
- public static final String TEMPORAL_MUTABLE_KEY = Options.ECLIPSELINK_TEMPORAL_MUTABLE;
- public static final Boolean TEMPORAL_MUTABLE_TEST_VALUE = true;
- public static final Boolean TEMPORAL_MUTABLE_TEST_VALUE_2 = ! TEMPORAL_MUTABLE_TEST_VALUE;
-
- public OptionsAdapterTests(String name) {
- super(name);
- }
-
- @Override
- protected void setUp() throws Exception {
- super.setUp();
- this.options = this.subject.getOptions();
- PropertyChangeListener propertyChangeListener = this.buildPropertyChangeListener();
-
- this.options.addPropertyChangeListener(Options.SESSION_NAME_PROPERTY, propertyChangeListener);
- this.options.addPropertyChangeListener(Options.SESSIONS_XML_PROPERTY, propertyChangeListener);
- this.options.addPropertyChangeListener(Options.TARGET_DATABASE_PROPERTY, propertyChangeListener);
- this.options.addPropertyChangeListener(Options.TARGET_SERVER_PROPERTY, propertyChangeListener);
- this.options.addPropertyChangeListener(Options.SESSION_EVENT_LISTENER_PROPERTY, propertyChangeListener);
- this.options.addPropertyChangeListener(
- Options.SESSION_INCLUDE_DESCRIPTOR_QUERIES_PROPERTY, propertyChangeListener);
- this.options.addPropertyChangeListener(Options.TEMPORAL_MUTABLE_PROPERTY, propertyChangeListener);
-
- this.clearEvent();
- }
-
- /**
- * Initializes directly the PU properties before testing.
- */
- @Override
- protected void populatePu() {
- this.modelPropertiesSizeOriginal = 7;
- this.propertiesTotal = this.modelPropertiesSizeOriginal + 4; // 4 misc properties
- this.modelPropertiesSize = this.modelPropertiesSizeOriginal;
-
- this.persistenceUnitSetProperty(SESSION_NAME_KEY, SESSION_NAME_TEST_VALUE);
- this.persistenceUnitSetProperty(SESSIONS_XML_KEY, SESSIONS_XML_TEST_VALUE);
- this.persistenceUnitSetProperty("misc.property.1", "value.1");
- this.persistenceUnitSetProperty(INCLUDE_DESCRIPTOR_QUERIES_KEY, INCLUDE_DESCRIPTOR_QUERIES_TEST_VALUE.toString());
- this.persistenceUnitSetProperty("misc.property.2", "value.2");
- this.persistenceUnitSetProperty("misc.property.3", "value.3");
- this.persistenceUnitSetProperty(TARGET_DATABASE_KEY, TARGET_DATABASE_TEST_VALUE);
- this.persistenceUnitSetProperty(TARGET_SERVER_KEY, TARGET_SERVER_TEST_VALUE);
- this.persistenceUnitSetProperty(SESSION_EVENT_LISTENER_KEY, SESSION_EVENT_LISTENER_TEST_VALUE);
- this.persistenceUnitSetProperty("misc.property.4", "value.4");
- this.persistenceUnitSetProperty(TEMPORAL_MUTABLE_KEY, TEMPORAL_MUTABLE_TEST_VALUE.toString());
- return;
- }
-
- // ********** Listeners **********
-
- // ********** SessionName tests **********
- public void testSetSessionName() throws Exception {
- this.verifyModelInitialized(
- SESSION_NAME_KEY,
- SESSION_NAME_TEST_VALUE);
- this.verifySetProperty(
- SESSION_NAME_KEY,
- SESSION_NAME_TEST_VALUE,
- SESSION_NAME_TEST_VALUE_2);
- }
-
- public void testAddRemoveSessionName() throws Exception {
- this.verifyAddRemoveProperty(
- SESSION_NAME_KEY,
- SESSION_NAME_TEST_VALUE,
- SESSION_NAME_TEST_VALUE_2);
- }
-
- // ********** SessionsXml tests **********
- public void testSetSessionsXml() throws Exception {
- this.verifyModelInitialized(
- SESSIONS_XML_KEY,
- SESSIONS_XML_TEST_VALUE);
- this.verifySetProperty(
- SESSIONS_XML_KEY,
- SESSIONS_XML_TEST_VALUE,
- SESSIONS_XML_TEST_VALUE_2);
- }
-
- public void testAddRemoveSessionsXml() throws Exception {
- this.verifyAddRemoveProperty(
- SESSIONS_XML_KEY,
- SESSIONS_XML_TEST_VALUE,
- SESSIONS_XML_TEST_VALUE_2);
- }
-
- // ********** IncludeDescriptorQueries tests **********
- public void testSetIncludeDescriptorQueries() throws Exception {
- this.verifyModelInitialized(
- INCLUDE_DESCRIPTOR_QUERIES_KEY,
- INCLUDE_DESCRIPTOR_QUERIES_TEST_VALUE);
- this.verifySetProperty(
- INCLUDE_DESCRIPTOR_QUERIES_KEY,
- INCLUDE_DESCRIPTOR_QUERIES_TEST_VALUE,
- INCLUDE_DESCRIPTOR_QUERIES_TEST_VALUE_2);
- }
-
- public void testAddRemoveIncludeDescriptorQueries() throws Exception {
- this.verifyAddRemoveProperty(
- INCLUDE_DESCRIPTOR_QUERIES_KEY,
- INCLUDE_DESCRIPTOR_QUERIES_TEST_VALUE,
- INCLUDE_DESCRIPTOR_QUERIES_TEST_VALUE_2);
- }
-
- // ********** TargetDatabase tests **********
- public void testSetTargetDatabase() throws Exception {
- this.verifyModelInitialized(
- TARGET_DATABASE_KEY,
- this.getEclipseLinkStringValueOf(TARGET_DATABASE_TEST_VALUE)); // model is storing EclipseLinkStringValue
- this.verifySetProperty(
- TARGET_DATABASE_KEY,
- TARGET_DATABASE_TEST_VALUE,
- TARGET_DATABASE_TEST_VALUE_2);
- // verify set custom and literal value
- this.verifySetTargetDatabase(
- TARGET_DATABASE_KEY,
- TARGET_DATABASE_TEST_VALUE,
- TARGET_DATABASE_TEST_VALUE_2);
- }
-
- public void testAddRemoveTargetDatabase() throws Exception {
- this.verifyAddRemoveProperty(
- TARGET_DATABASE_KEY,
- TARGET_DATABASE_TEST_VALUE,
- TARGET_DATABASE_TEST_VALUE_2);
- }
-
- /**
- * Verifies setting custom targetDatabase and literals.
- */
- protected void verifySetTargetDatabase(String elKey, Object testValue1, Object testValue2) throws Exception {
- PersistenceUnit.Property property = this.getPersistenceUnit().getProperty(elKey);
- String propertyName = this.getModel().propertyIdOf(property);
- // test set custom targetDatabase.
- this.clearEvent();
- this.setProperty(propertyName, testValue2);
- this.verifyPutProperty(propertyName, testValue2);
-
- // test set (TargetDatabase) null
- this.clearEvent();
- this.options.setTargetDatabase((TargetDatabase) null);
- assertNull(this.getPersistenceUnit().getProperty(elKey));
- this.verifyPutProperty(propertyName, null);
-
- // test set enum literal
- this.clearEvent();
- this.setProperty(propertyName, testValue1.toString());
- assertNotNull(this.getPersistenceUnit().getProperty(elKey));
- this.verifyPutProperty(propertyName, this.getEclipseLinkStringValueOf(testValue1));
-
- // test set (String) null
- this.clearEvent();
- this.options.setTargetDatabase((String) null);
- assertNull(this.getPersistenceUnit().getProperty(elKey));
- this.verifyPutProperty(propertyName, null);
- }
-
- // ********** TargetServer tests **********
- public void testSetTargetServer() throws Exception {
- this.verifyModelInitialized(
- TARGET_SERVER_KEY,
- this.getEclipseLinkStringValueOf(TARGET_SERVER_TEST_VALUE)); // model is storing EclipseLinkStringValue
- // verify set enum value
- this.verifySetProperty(
- TARGET_SERVER_KEY,
- TARGET_SERVER_TEST_VALUE,
- TARGET_SERVER_TEST_VALUE_2);
- // verify set custom and literal value
- this.verifySetTargetServer(
- TARGET_SERVER_KEY,
- TARGET_SERVER_TEST_VALUE,
- TARGET_SERVER_TEST_VALUE_2);
- }
-
- public void testAddRemoveTargetServer() throws Exception {
- this.verifyAddRemoveProperty(
- TARGET_SERVER_KEY,
- TARGET_SERVER_TEST_VALUE,
- TARGET_SERVER_TEST_VALUE_2);
- }
-
- /**
- * Verifies setting custom targetServer and literals.
- */
- protected void verifySetTargetServer(String elKey, Object testValue1, Object testValue2) throws Exception {
- PersistenceUnit.Property property = this.getPersistenceUnit().getProperty(elKey);
- String propertyName = this.getModel().propertyIdOf(property);
- // test set custom targetServer.
- this.clearEvent();
- this.setProperty(propertyName, testValue2);
- this.verifyPutProperty(propertyName, testValue2);
-
- // test set (TargetServer) null
- this.clearEvent();
- this.options.setTargetServer((TargetServer) null);
- assertNull(this.getPersistenceUnit().getProperty(elKey));
- this.verifyPutProperty(propertyName, null);
-
- // test set enum literal
- this.clearEvent();
- this.setProperty(propertyName, testValue1.toString());
- assertNotNull(this.getPersistenceUnit().getProperty(elKey));
- this.verifyPutProperty(propertyName, this.getEclipseLinkStringValueOf(testValue1));
-
- // test set (String) null
- this.clearEvent();
- this.options.setTargetServer((String) null);
- assertNull(this.getPersistenceUnit().getProperty(elKey));
- this.verifyPutProperty(propertyName, null);
- }
-
- // ********** EventListener tests **********
- public void testSetEventListener() throws Exception {
- this.verifyModelInitialized(
- SESSION_EVENT_LISTENER_KEY,
- SESSION_EVENT_LISTENER_TEST_VALUE);
- this.verifySetProperty(
- SESSION_EVENT_LISTENER_KEY,
- SESSION_EVENT_LISTENER_TEST_VALUE,
- SESSION_EVENT_LISTENER_TEST_VALUE_2);
- }
-
- public void testAddRemoveEventListener() throws Exception {
- this.verifyAddRemoveProperty(
- SESSION_EVENT_LISTENER_KEY,
- SESSION_EVENT_LISTENER_TEST_VALUE,
- SESSION_EVENT_LISTENER_TEST_VALUE_2);
- }
-
- // ********** TemporalMutable tests **********
- public void testSetTemporalMutable() throws Exception {
- this.verifyModelInitialized(
- TEMPORAL_MUTABLE_KEY,
- TEMPORAL_MUTABLE_TEST_VALUE);
- this.verifySetProperty(
- TEMPORAL_MUTABLE_KEY,
- TEMPORAL_MUTABLE_TEST_VALUE,
- TEMPORAL_MUTABLE_TEST_VALUE_2);
- }
-
- public void testAddRemoveTemporalMutable() throws Exception {
- this.verifyAddRemoveProperty(
- TEMPORAL_MUTABLE_KEY,
- TEMPORAL_MUTABLE_TEST_VALUE,
- TEMPORAL_MUTABLE_TEST_VALUE_2);
- }
-
- // ********** get/set property **********
- @Override
- protected void setProperty(String propertyName, Object newValue) throws Exception {
- if (propertyName.equals(Options.SESSION_NAME_PROPERTY))
- this.options.setSessionName((String) newValue);
- else if (propertyName.equals(Options.SESSIONS_XML_PROPERTY))
- this.options.setSessionsXml((String) newValue);
- else if (propertyName.equals(Options.SESSION_INCLUDE_DESCRIPTOR_QUERIES_PROPERTY))
- this.options.setIncludeDescriptorQueries((Boolean) newValue);
- else if (propertyName.equals(Options.TARGET_DATABASE_PROPERTY))
- this.setTargetDatabaseProperty(newValue);
- else if (propertyName.equals(Options.TARGET_SERVER_PROPERTY))
- this.setTargetServerProperty(newValue);
- else if (propertyName.equals(Options.SESSION_EVENT_LISTENER_PROPERTY))
- this.options.setEventListener((String) newValue);
- else if (propertyName.equals(Options.TEMPORAL_MUTABLE_PROPERTY))
- this.options.setTemporalMutable((Boolean) newValue);
- else
- this.throwMissingDefinition("setProperty", propertyName);
- }
-
- private void setTargetDatabaseProperty(Object newValue) {
- if (newValue.getClass().isEnum())
- this.options.setTargetDatabase((TargetDatabase) newValue);
- else
- this.options.setTargetDatabase((String) newValue);
- }
-
- private void setTargetServerProperty(Object newValue) {
- if (newValue.getClass().isEnum())
- this.options.setTargetServer((TargetServer) newValue);
- else
- this.options.setTargetServer((String) newValue);
- }
-
- @Override
- protected Object getProperty(String propertyName) throws NoSuchFieldException {
- Object modelValue = null;
- if (propertyName.equals(Options.SESSION_NAME_PROPERTY))
- modelValue = this.options.getSessionName();
- else if (propertyName.equals(Options.SESSIONS_XML_PROPERTY))
- modelValue = this.options.getSessionsXml();
- else if (propertyName.equals(Options.SESSION_INCLUDE_DESCRIPTOR_QUERIES_PROPERTY))
- modelValue = this.options.getIncludeDescriptorQueries();
- else if (propertyName.equals(Options.TARGET_DATABASE_PROPERTY))
- modelValue = this.options.getTargetDatabase();
- else if (propertyName.equals(Options.TARGET_SERVER_PROPERTY))
- modelValue = this.options.getTargetServer();
- else if (propertyName.equals(Options.SESSION_EVENT_LISTENER_PROPERTY))
- modelValue = this.options.getEventListener();
- else if (propertyName.equals(Options.TEMPORAL_MUTABLE_PROPERTY))
- modelValue = this.options.getTemporalMutable();
- else
- this.throwMissingDefinition("getProperty", propertyName);
- return modelValue;
- }
-
- @Override
- protected void verifyPutProperty(String propertyName, Object expectedValue) throws Exception {
- Object expectedValue_ = expectedValue;
- if (propertyName.equals(Options.TARGET_DATABASE_PROPERTY) ||
- propertyName.equals(Options.TARGET_SERVER_PROPERTY)) {
-
- expectedValue_ = this.convertToEclipseLinkStringValue(expectedValue);
- }
-
- super.verifyPutProperty(propertyName, expectedValue_);
- }
-
- private String convertToEclipseLinkStringValue(Object expectedValue) {
- return (String) ((expectedValue != null && expectedValue.getClass().isEnum()) ?
- this.getEclipseLinkStringValueOf(expectedValue) : // model is storing EclipseLinkStringValue
- expectedValue); // already a EclipseLinkStringValue
- }
-
- @Override
- protected PersistenceUnitProperties getModel() {
- return this.options;
- }
-}
diff --git a/jpa/tests/org.eclipse.jpt.eclipselink.core.tests/src/org/eclipse/jpt/eclipselink/core/tests/internal/context/persistence/options/OptionsValueModelTests.java b/jpa/tests/org.eclipse.jpt.eclipselink.core.tests/src/org/eclipse/jpt/eclipselink/core/tests/internal/context/persistence/options/OptionsValueModelTests.java
deleted file mode 100644
index ce33a48a8d..0000000000
--- a/jpa/tests/org.eclipse.jpt.eclipselink.core.tests/src/org/eclipse/jpt/eclipselink/core/tests/internal/context/persistence/options/OptionsValueModelTests.java
+++ /dev/null
@@ -1,161 +0,0 @@
-/*******************************************************************************
- * Copyright (c) 2008, 2009 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.
- *
- * Contributors:
- * Oracle - initial API and implementation
- *******************************************************************************/
-package org.eclipse.jpt.eclipselink.core.tests.internal.context.persistence.options;
-
-import org.eclipse.jpt.eclipselink.core.internal.context.persistence.PersistenceUnitProperties;
-import org.eclipse.jpt.eclipselink.core.internal.context.persistence.options.Options;
-import org.eclipse.jpt.eclipselink.core.tests.internal.context.persistence.PersistenceUnitTestCase;
-import org.eclipse.jpt.utility.internal.model.AbstractModel;
-import org.eclipse.jpt.utility.internal.model.value.PropertyAspectAdapter;
-import org.eclipse.jpt.utility.internal.model.value.SimplePropertyValueModel;
-import org.eclipse.jpt.utility.model.event.PropertyChangeEvent;
-import org.eclipse.jpt.utility.model.listener.PropertyChangeListener;
-import org.eclipse.jpt.utility.model.value.PropertyValueModel;
-import org.eclipse.jpt.utility.model.value.WritablePropertyValueModel;
-
-/**
- * OptionsValueModelTests
- */
-public class OptionsValueModelTests extends PersistenceUnitTestCase
-{
- private Options options;
-
- private WritablePropertyValueModel<Boolean> includeDescriptorQueriesHolder;
- private PropertyChangeListener includeDescriptorQueriesListener;
- private PropertyChangeEvent includeDescriptorQueriesEvent;
-
- public static final Boolean INCLUDE_DESCRIPTOR_QUERIES_TEST_VALUE = Boolean.FALSE;
-
- public OptionsValueModelTests(String name) {
- super(name);
- }
-
- @Override
- protected void setUp() throws Exception {
- super.setUp();
- this.options = this.subject.getOptions(); // Subject
- PropertyValueModel<Options> optionsHolder = new SimplePropertyValueModel<Options>(this.options);
-
- this.includeDescriptorQueriesHolder = this.buildIncludeDescriptorQueriesAA(optionsHolder);
- this.includeDescriptorQueriesListener = this.buildIncludeDescriptorQueriesChangeListener();
- this.includeDescriptorQueriesHolder.addPropertyChangeListener(PropertyValueModel.VALUE, this.includeDescriptorQueriesListener);
- this.includeDescriptorQueriesEvent = null;
- }
-
- public void testHasListeners() {
- AbstractModel subjectOptions = (AbstractModel) this.options; // Subject
-
- PropertyAspectAdapter<Options, Boolean> includeDescriptorQueriesAA =
- (PropertyAspectAdapter<Options, Boolean>) this.includeDescriptorQueriesHolder;
- assertTrue(includeDescriptorQueriesAA.hasAnyPropertyChangeListeners(PropertyValueModel.VALUE));
- assertTrue(subjectOptions.hasAnyPropertyChangeListeners(Options.SESSION_INCLUDE_DESCRIPTOR_QUERIES_PROPERTY));
-
- includeDescriptorQueriesAA.removePropertyChangeListener(PropertyValueModel.VALUE, this.includeDescriptorQueriesListener);
- assertFalse(subjectOptions.hasAnyPropertyChangeListeners(Options.SESSION_INCLUDE_DESCRIPTOR_QUERIES_PROPERTY));
- assertFalse(includeDescriptorQueriesAA.hasAnyPropertyChangeListeners(PropertyValueModel.VALUE));
- }
-
- /**
- * Initializes directly the PU properties before testing.
- */
- @Override
- protected void populatePu() {
- this.persistenceUnitSetProperty(
- Options.ECLIPSELINK_SESSION_INCLUDE_DESCRIPTOR_QUERIES,
- INCLUDE_DESCRIPTOR_QUERIES_TEST_VALUE);
- return;
- }
-
- @Override
- protected PersistenceUnitProperties getModel() {
- return this.options;
- }
-
- // ****** IncludeDescriptorQueries *******
- private WritablePropertyValueModel<Boolean> buildIncludeDescriptorQueriesAA(PropertyValueModel<Options> subjectHolder) {
- return new PropertyAspectAdapter<Options, Boolean>(subjectHolder, Options.SESSION_INCLUDE_DESCRIPTOR_QUERIES_PROPERTY) {
- @Override
- protected Boolean buildValue_() {
- return this.subject.getIncludeDescriptorQueries();
- }
-
- @Override
- protected void setValue_(Boolean enumValue) {
- this.subject.setIncludeDescriptorQueries(enumValue);
- }
- };
- }
-
- private PropertyChangeListener buildIncludeDescriptorQueriesChangeListener() {
- return new PropertyChangeListener() {
- public void propertyChanged(PropertyChangeEvent e) {
- OptionsValueModelTests.this.includeDescriptorQueriesEvent = e;
- }
- };
- }
-
- // ****** Tests *******
- public void testValue() {
- // ****** IncludeDescriptorQueries *******
- this.verifyIncludeDescriptorQueriesAAValue(INCLUDE_DESCRIPTOR_QUERIES_TEST_VALUE);
- assertEquals(Options.DEFAULT_SESSION_INCLUDE_DESCRIPTOR_QUERIES, this.options.getDefaultIncludeDescriptorQueries());
- }
-
- public void testSetValue() throws Exception {
- // ****** IncludeDescriptorQueries *******
- this.includeDescriptorQueriesEvent = null;
- this.verifyHasListeners(this.includeDescriptorQueriesHolder, PropertyValueModel.VALUE);
- Boolean newIncludeDescriptorQueries = !INCLUDE_DESCRIPTOR_QUERIES_TEST_VALUE;
- // Modify the property holder
- this.includeDescriptorQueriesHolder.setValue(newIncludeDescriptorQueries);
- this.verifyIncludeDescriptorQueriesAAValue(newIncludeDescriptorQueries);
- assertNotNull(this.includeDescriptorQueriesEvent);
- }
-
- public void testSetNullValue() {
- String notDeleted = "Property not deleted";
- // ****** IncludeDescriptorQueries *******
- this.includeDescriptorQueriesEvent = null;
- // Setting the property holder
- this.includeDescriptorQueriesHolder.setValue(null);
- // testing Holder
- this.verifyIncludeDescriptorQueriesAAValue(null);
- assertNotNull(this.includeDescriptorQueriesEvent);
- // testing PU properties
- this.verifyPuHasNotProperty(Options.ECLIPSELINK_SESSION_INCLUDE_DESCRIPTOR_QUERIES, notDeleted);
- }
-
- // ****** convenience methods *******
-
- /**
- * Performs three value tests:<br>
- * 1. subject value<br>
- * 2. aspect adapter value<br>
- * 3. persistenceUnit property value<br>
- */
- protected void verifyIncludeDescriptorQueriesAAValue(Boolean testValue) {
- this.verifyAAValue(
- testValue,
- this.options.getIncludeDescriptorQueries(),
- this.includeDescriptorQueriesHolder,
- Options.ECLIPSELINK_SESSION_INCLUDE_DESCRIPTOR_QUERIES);
- }
-
- // ********** get/set property **********
- @Override
- protected void setProperty(String propertyName, Object newValue) throws Exception {
- throw new UnsupportedOperationException();
- }
-
- @Override
- protected Object getProperty(String propertyName) throws NoSuchFieldException {
- throw new UnsupportedOperationException();
- }
-}
diff --git a/jpa/tests/org.eclipse.jpt.eclipselink.core.tests/src/org/eclipse/jpt/eclipselink/core/tests/internal/context/persistence/schema/generation/JptEclipseLinkPersistenceSchemaGenerationTests.java b/jpa/tests/org.eclipse.jpt.eclipselink.core.tests/src/org/eclipse/jpt/eclipselink/core/tests/internal/context/persistence/schema/generation/JptEclipseLinkPersistenceSchemaGenerationTests.java
deleted file mode 100644
index 8ae6c55d11..0000000000
--- a/jpa/tests/org.eclipse.jpt.eclipselink.core.tests/src/org/eclipse/jpt/eclipselink/core/tests/internal/context/persistence/schema/generation/JptEclipseLinkPersistenceSchemaGenerationTests.java
+++ /dev/null
@@ -1,35 +0,0 @@
-/*******************************************************************************
- * Copyright (c) 2008 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.
- *
- * Contributors:
- * Oracle - initial API and implementation
- ******************************************************************************/
-package org.eclipse.jpt.eclipselink.core.tests.internal.context.persistence.schema.generation;
-
-import junit.framework.Test;
-import junit.framework.TestSuite;
-
-/**
- * decentralize test creation code
- */
-public class JptEclipseLinkPersistenceSchemaGenerationTests {
-
- public static Test suite() {
- TestSuite suite = new TestSuite(JptEclipseLinkPersistenceSchemaGenerationTests.class.getPackage().getName());
-
- suite.addTestSuite(SchemaGenerationValueModelTests.class);
- suite.addTestSuite(SchemaGenerationBasicAdapterTests.class);
- suite.addTestSuite(SchemaGenerationAdapterTests.class);
-
- return suite;
- }
-
- private JptEclipseLinkPersistenceSchemaGenerationTests() {
- super();
- throw new UnsupportedOperationException();
- }
-
-}
diff --git a/jpa/tests/org.eclipse.jpt.eclipselink.core.tests/src/org/eclipse/jpt/eclipselink/core/tests/internal/context/persistence/schema/generation/SchemaGenerationAdapterTests.java b/jpa/tests/org.eclipse.jpt.eclipselink.core.tests/src/org/eclipse/jpt/eclipselink/core/tests/internal/context/persistence/schema/generation/SchemaGenerationAdapterTests.java
deleted file mode 100644
index 97c05c2b27..0000000000
--- a/jpa/tests/org.eclipse.jpt.eclipselink.core.tests/src/org/eclipse/jpt/eclipselink/core/tests/internal/context/persistence/schema/generation/SchemaGenerationAdapterTests.java
+++ /dev/null
@@ -1,239 +0,0 @@
-/*******************************************************************************
- * Copyright (c) 2008, 2009 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.
- *
- * Contributors:
- * Oracle - initial API and implementation
- ******************************************************************************/
-package org.eclipse.jpt.eclipselink.core.tests.internal.context.persistence.schema.generation;
-
-import org.eclipse.jpt.eclipselink.core.internal.context.persistence.PersistenceUnitProperties;
-import org.eclipse.jpt.eclipselink.core.internal.context.persistence.schema.generation.DdlGenerationType;
-import org.eclipse.jpt.eclipselink.core.internal.context.persistence.schema.generation.OutputMode;
-import org.eclipse.jpt.eclipselink.core.internal.context.persistence.schema.generation.SchemaGeneration;
-import org.eclipse.jpt.eclipselink.core.tests.internal.context.persistence.PersistenceUnitTestCase;
-import org.eclipse.jpt.utility.model.listener.PropertyChangeListener;
-
-/**
- * Tests the update of OutputMode model object by the SchemaGeneration adapter
- * when the PersistenceUnit changes.
- */
-@SuppressWarnings("nls")
-public class SchemaGenerationAdapterTests extends PersistenceUnitTestCase
-{
- private SchemaGeneration schemaGeneration;
-
- public static final String DDL_GENERATION_TYPE_KEY = SchemaGeneration.ECLIPSELINK_DDL_GENERATION_TYPE;
- public static final DdlGenerationType DDL_GENERATION_TYPE_TEST_VALUE = DdlGenerationType.drop_and_create_tables;
- public static final DdlGenerationType DDL_GENERATION_TYPE_TEST_VALUE_2 = DdlGenerationType.none;
-
- public static final String OUTPUT_MODE_KEY = SchemaGeneration.ECLIPSELINK_DDL_GENERATION_OUTPUT_MODE;
- public static final OutputMode OUTPUT_MODE_TEST_VALUE = OutputMode.sql_script;
- public static final OutputMode OUTPUT_MODE_TEST_VALUE_2 = OutputMode.database;
-
- private static final String CREATE_FILE_NAME_KEY = SchemaGeneration.ECLIPSELINK_CREATE_FILE_NAME;
- private static final String CREATE_FILE_NAME_TEST_VALUE = "create-file-name.test";
- private static final String CREATE_FILE_NAME_TEST_VALUE_2 = "create-file-name-2.test";
-
- private static final String DROP_FILE_NAME_KEY = SchemaGeneration.ECLIPSELINK_DROP_FILE_NAME;
- private static final String DROP_FILE_NAME_TEST_VALUE = "drop-file-name.test";
- private static final String DROP_FILE_NAME_TEST_VALUE_2 = "drop-file-name-2.test";
-
- private static final String APPLICATION_LOCATION_KEY = SchemaGeneration.ECLIPSELINK_APPLICATION_LOCATION;
- private static final String APPLICATION_LOCATION_TEST_VALUE = "C:/temp";
- private static final String APPLICATION_LOCATION_TEST_VALUE_2 = "C:/tmp";
-
- public SchemaGenerationAdapterTests(String name) {
- super(name);
- }
-
- @Override
- protected void setUp() throws Exception {
- super.setUp();
- this.schemaGeneration = this.subject.getSchemaGeneration();
-
- PropertyChangeListener propertyChangeListener = this.buildPropertyChangeListener();
- this.schemaGeneration.addPropertyChangeListener(SchemaGeneration.OUTPUT_MODE_PROPERTY, propertyChangeListener);
- this.schemaGeneration.addPropertyChangeListener(SchemaGeneration.DDL_GENERATION_TYPE_PROPERTY, propertyChangeListener);
- this.schemaGeneration.addPropertyChangeListener(SchemaGeneration.CREATE_FILE_NAME_PROPERTY, propertyChangeListener);
- this.schemaGeneration.addPropertyChangeListener(SchemaGeneration.DROP_FILE_NAME_PROPERTY, propertyChangeListener);
- this.schemaGeneration.addPropertyChangeListener(SchemaGeneration.APPLICATION_LOCATION_PROPERTY, propertyChangeListener);
- this.clearEvent();
- }
-
- /**
- * Initializes directly the PU properties before testing. Cannot use
- * Property Holder to initialize because it is not created yet
- */
- @Override
- protected void populatePu() {
- this.propertiesTotal = 9;
- this.modelPropertiesSizeOriginal = 5;
- this.modelPropertiesSize = this.modelPropertiesSizeOriginal;
-
- this.persistenceUnitSetProperty("property.0", "value.0");
- this.persistenceUnitSetProperty(OUTPUT_MODE_KEY, this.getEclipseLinkStringValueOf(OUTPUT_MODE_TEST_VALUE));
- this.persistenceUnitSetProperty("property.2", "value.2");
- this.persistenceUnitSetProperty("property.3", "value.3");
- this.persistenceUnitSetProperty("property.4", "value.4");
- this.persistenceUnitSetProperty(DDL_GENERATION_TYPE_KEY, this.getEclipseLinkStringValueOf(DDL_GENERATION_TYPE_TEST_VALUE));
- this.persistenceUnitSetProperty(CREATE_FILE_NAME_KEY, CREATE_FILE_NAME_TEST_VALUE);
- this.persistenceUnitSetProperty(DROP_FILE_NAME_KEY, DROP_FILE_NAME_TEST_VALUE);
- this.persistenceUnitSetProperty(APPLICATION_LOCATION_KEY, APPLICATION_LOCATION_TEST_VALUE);
- return;
- }
-
- // ********** CreateFileName **********
- /**
- * Tests the update of CreateFileName property by the SchemaGeneration
- * adapter when the PU or the model changes.
- */
- public void testSetCreateFileName() throws Exception {
- this.verifyModelInitialized(
- CREATE_FILE_NAME_KEY,
- CREATE_FILE_NAME_TEST_VALUE);
- this.verifySetProperty(
- CREATE_FILE_NAME_KEY,
- CREATE_FILE_NAME_TEST_VALUE,
- CREATE_FILE_NAME_TEST_VALUE_2);
- }
-
- public void testAddRemoveCreateFileName() throws Exception {
- this.verifyAddRemoveProperty(
- CREATE_FILE_NAME_KEY,
- CREATE_FILE_NAME_TEST_VALUE,
- CREATE_FILE_NAME_TEST_VALUE_2);
- }
-
- // ********** DropFileName **********
- /**
- * Tests the update of DropFileName property by the SchemaGeneration adapter
- * when the PU or the model changes.
- */
- public void testSetDropFileName() throws Exception {
- this.verifyModelInitialized(
- DROP_FILE_NAME_KEY,
- DROP_FILE_NAME_TEST_VALUE);
- this.verifySetProperty(
- DROP_FILE_NAME_KEY,
- DROP_FILE_NAME_TEST_VALUE,
- DROP_FILE_NAME_TEST_VALUE_2);
- }
-
- public void testAddRemoveDropFileName() throws Exception {
- this.verifyAddRemoveProperty(
- DROP_FILE_NAME_KEY,
- DROP_FILE_NAME_TEST_VALUE,
- DROP_FILE_NAME_TEST_VALUE_2);
- }
-
- // ********** ApplicationLocation **********
- /**
- * Tests the update of ApplicationLocation property by the SchemaGeneration
- * adapter when the PU or the model changes.
- */
- public void testSetApplicationLocation() throws Exception {
- this.verifyModelInitialized(
- APPLICATION_LOCATION_KEY,
- APPLICATION_LOCATION_TEST_VALUE);
- this.verifySetProperty(
- APPLICATION_LOCATION_KEY,
- APPLICATION_LOCATION_TEST_VALUE,
- APPLICATION_LOCATION_TEST_VALUE_2);
- }
-
- public void testAddRemoveApplicationLocation() throws Exception {
- this.verifyAddRemoveProperty(
- APPLICATION_LOCATION_KEY,
- APPLICATION_LOCATION_TEST_VALUE,
- APPLICATION_LOCATION_TEST_VALUE_2);
- }
-
- // ********** OutputMode **********
- /**
- * Tests the update of OutputMode property by the SchemaGeneration adapter
- * when the PU or the model changes.
- */
- public void testSetOutputMode() throws Exception {
- this.verifyModelInitialized(
- OUTPUT_MODE_KEY,
- OUTPUT_MODE_TEST_VALUE);
- this.verifySetProperty(
- OUTPUT_MODE_KEY,
- OUTPUT_MODE_TEST_VALUE,
- OUTPUT_MODE_TEST_VALUE_2);
- }
-
- public void testAddRemoveOutputMode() throws Exception {
- this.verifyAddRemoveProperty(
- OUTPUT_MODE_KEY,
- OUTPUT_MODE_TEST_VALUE,
- OUTPUT_MODE_TEST_VALUE_2);
- }
-
- // ********** DdlGenerationType **********
- /**
- * Tests the update of DdlGenerationType property by the SchemaGeneration
- * adapter when the PU or the model changes.
- */
- public void testSetDdlGenerationType() throws Exception {
- this.verifyModelInitialized(
- DDL_GENERATION_TYPE_KEY,
- DDL_GENERATION_TYPE_TEST_VALUE);
- this.verifySetProperty(
- DDL_GENERATION_TYPE_KEY,
- DDL_GENERATION_TYPE_TEST_VALUE,
- DDL_GENERATION_TYPE_TEST_VALUE_2);
- }
-
- public void testAddRemoveDdlGenerationType() throws Exception {
- this.verifyAddRemoveProperty(
- DDL_GENERATION_TYPE_KEY,
- DDL_GENERATION_TYPE_TEST_VALUE,
- DDL_GENERATION_TYPE_TEST_VALUE_2);
- }
-
- // ********** get/set property **********
- @Override
- protected void setProperty(String propertyName, Object newValue) throws NoSuchFieldException {
- if (propertyName.equals(SchemaGeneration.OUTPUT_MODE_PROPERTY))
- this.schemaGeneration.setOutputMode((OutputMode) newValue);
- // else if( propertyName.equals( Caching.CACHE_SIZE_PROPERTY))
- // TODO
- else if (propertyName.equals(SchemaGeneration.DDL_GENERATION_TYPE_PROPERTY))
- this.schemaGeneration.setDdlGenerationType((DdlGenerationType) newValue);
- else if (propertyName.equals(SchemaGeneration.APPLICATION_LOCATION_PROPERTY))
- this.schemaGeneration.setApplicationLocation((String) newValue);
- else if (propertyName.equals(SchemaGeneration.CREATE_FILE_NAME_PROPERTY))
- this.schemaGeneration.setCreateFileName((String) newValue);
- else if (propertyName.equals(SchemaGeneration.DROP_FILE_NAME_PROPERTY))
- this.schemaGeneration.setDropFileName((String) newValue);
- else
- this.throwMissingDefinition("setProperty", propertyName);
- }
-
- @Override
- protected Object getProperty(String propertyName) throws NoSuchFieldException {
- Object modelValue = null;
- if (propertyName.equals(SchemaGeneration.OUTPUT_MODE_PROPERTY))
- modelValue = this.schemaGeneration.getOutputMode();
- else if (propertyName.equals(SchemaGeneration.DDL_GENERATION_TYPE_PROPERTY))
- modelValue = this.schemaGeneration.getDdlGenerationType();
- else if (propertyName.equals(SchemaGeneration.APPLICATION_LOCATION_PROPERTY))
- modelValue = this.schemaGeneration.getApplicationLocation();
- else if (propertyName.equals(SchemaGeneration.CREATE_FILE_NAME_PROPERTY))
- modelValue = this.schemaGeneration.getCreateFileName();
- else if (propertyName.equals(SchemaGeneration.DROP_FILE_NAME_PROPERTY))
- modelValue = this.schemaGeneration.getDropFileName();
- else
- this.throwMissingDefinition("getProperty", propertyName);
- return modelValue;
- }
-
- @Override
- protected PersistenceUnitProperties getModel() {
- return this.schemaGeneration;
- }
-}
diff --git a/jpa/tests/org.eclipse.jpt.eclipselink.core.tests/src/org/eclipse/jpt/eclipselink/core/tests/internal/context/persistence/schema/generation/SchemaGenerationBasicAdapterTests.java b/jpa/tests/org.eclipse.jpt.eclipselink.core.tests/src/org/eclipse/jpt/eclipselink/core/tests/internal/context/persistence/schema/generation/SchemaGenerationBasicAdapterTests.java
deleted file mode 100644
index 9557750c2c..0000000000
--- a/jpa/tests/org.eclipse.jpt.eclipselink.core.tests/src/org/eclipse/jpt/eclipselink/core/tests/internal/context/persistence/schema/generation/SchemaGenerationBasicAdapterTests.java
+++ /dev/null
@@ -1,153 +0,0 @@
-/*******************************************************************************
- * Copyright (c) 2008, 2009 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.
- *
- * Contributors:
- * Oracle - initial API and implementation
- ******************************************************************************/
-package org.eclipse.jpt.eclipselink.core.tests.internal.context.persistence.schema.generation;
-
-import java.util.ListIterator;
-import org.eclipse.jpt.core.context.persistence.PersistenceUnit;
-import org.eclipse.jpt.eclipselink.core.internal.context.persistence.EclipseLinkPersistenceUnit;
-import org.eclipse.jpt.eclipselink.core.internal.context.persistence.PersistenceUnitProperties;
-import org.eclipse.jpt.eclipselink.core.internal.context.persistence.schema.generation.DdlGenerationType;
-import org.eclipse.jpt.eclipselink.core.internal.context.persistence.schema.generation.OutputMode;
-import org.eclipse.jpt.eclipselink.core.internal.context.persistence.schema.generation.SchemaGeneration;
-import org.eclipse.jpt.eclipselink.core.tests.internal.context.persistence.PersistenceUnitTestCase;
-import org.eclipse.jpt.utility.internal.model.value.ItemPropertyListValueModelAdapter;
-import org.eclipse.jpt.utility.internal.model.value.ListAspectAdapter;
-import org.eclipse.jpt.utility.model.listener.PropertyChangeListener;
-import org.eclipse.jpt.utility.model.value.ListValueModel;
-import org.eclipse.jpt.utility.model.value.PropertyValueModel;
-
-/**
- * Tests the update of OutputMode model object by the SchemaGeneration adapter
- * when the PersistenceUnit changes.
- */
-public class SchemaGenerationBasicAdapterTests extends PersistenceUnitTestCase
-{
- private SchemaGeneration schemaGeneration;
-
- public static final String outputModeKey = SchemaGeneration.ECLIPSELINK_DDL_GENERATION_OUTPUT_MODE;
- public static final String ddlGenTypeKey = SchemaGeneration.ECLIPSELINK_DDL_GENERATION_TYPE;
-
- public static final OutputMode OUTPUT_MODE_TEST_VALUE = OutputMode.sql_script;
- public static final OutputMode OUTPUT_MODE_TEST_VALUE_2 = OutputMode.database;
-
- public static final DdlGenerationType DDL_GENERATION_TYPE_TEST_VALUE = DdlGenerationType.drop_and_create_tables;
- public static final DdlGenerationType DDL_GENERATION_TYPE_TEST_VALUE_2 = DdlGenerationType.none;
-
- public SchemaGenerationBasicAdapterTests(String name) {
- super(name);
- }
-
- @Override
- protected void setUp() throws Exception {
- super.setUp();
-
- this.schemaGeneration = this.subject.getSchemaGeneration();
- PropertyChangeListener propertyChangeListener = this.buildPropertyChangeListener();
- this.schemaGeneration.addPropertyChangeListener(SchemaGeneration.OUTPUT_MODE_PROPERTY, propertyChangeListener);
- this.schemaGeneration.addPropertyChangeListener(SchemaGeneration.DDL_GENERATION_TYPE_PROPERTY, propertyChangeListener);
- this.clearEvent();
- }
-
- /**
- * Initializes directly the PU properties before testing. Cannot use
- * Property Holder to initialize because it is not created yet
- */
- @Override
- protected void populatePu() {
- this.propertiesTotal = 6;
- this.modelPropertiesSizeOriginal = 2;
- this.modelPropertiesSize = this.modelPropertiesSizeOriginal;
-
- this.persistenceUnitSetProperty("property.0", "value.0");
- this.persistenceUnitSetProperty(outputModeKey, this.getEclipseLinkStringValueOf(OUTPUT_MODE_TEST_VALUE));
- this.persistenceUnitSetProperty("property.2", "value.2");
- this.persistenceUnitSetProperty("property.3", "value.3");
- this.persistenceUnitSetProperty("property.4", "value.4");
- this.persistenceUnitSetProperty(ddlGenTypeKey, this.getEclipseLinkStringValueOf(DDL_GENERATION_TYPE_TEST_VALUE));
- return;
- }
-
- /** ****** test methods ******* */
-
- /**
- * Tests the update of OutputMode property by the SchemaGeneration adapter
- * when the PU changes.
- */
- public void testOutputModeUpdate() throws Exception {
- ListValueModel<PersistenceUnit.Property> propertiesAdapter = this.buildPropertiesAdapter(this.subjectHolder);
- ListValueModel<PersistenceUnit.Property> propertyListAdapter = new ItemPropertyListValueModelAdapter<PersistenceUnit.Property>(propertiesAdapter, PersistenceUnit.Property.VALUE_PROPERTY);
-
- this.verifyHasListeners(this.schemaGeneration, SchemaGeneration.OUTPUT_MODE_PROPERTY);
-
- // Basic
- assertTrue(schemaGeneration.itemIsProperty(this.getPersistenceUnit().getProperty(outputModeKey)));
- assertEquals(OUTPUT_MODE_TEST_VALUE, this.schemaGeneration.getOutputMode());
-
- // Replace
- this.persistenceUnitSetProperty(outputModeKey, OUTPUT_MODE_TEST_VALUE_2);
- this.verifyPutEvent(SchemaGeneration.OUTPUT_MODE_PROPERTY, OUTPUT_MODE_TEST_VALUE_2, this.schemaGeneration.getOutputMode());
-
- // Remove
- this.clearEvent();
- --this.propertiesTotal;
- --this.modelPropertiesSize;
- this.getPersistenceUnit().removeProperty(outputModeKey);
- assertNull(this.getPersistenceUnit().getProperty(outputModeKey));
- assertEquals(this.modelPropertiesSize, this.modelPropertiesSizeOriginal - 1);
- assertNotNull(this.propertyChangedEvent);
- assertNull(this.propertyChangedEvent.getNewValue());
-
- // Add original OutputMode
- ++this.propertiesTotal;
- ++this.modelPropertiesSize;
- this.persistenceUnitSetProperty(outputModeKey, OUTPUT_MODE_TEST_VALUE);
- this.verifyPutEvent(SchemaGeneration.OUTPUT_MODE_PROPERTY, OUTPUT_MODE_TEST_VALUE, this.schemaGeneration.getOutputMode());
-
- // Replace again
- this.persistenceUnitSetProperty(outputModeKey, OUTPUT_MODE_TEST_VALUE_2);
- this.verifyPutEvent(SchemaGeneration.OUTPUT_MODE_PROPERTY, OUTPUT_MODE_TEST_VALUE_2, this.schemaGeneration.getOutputMode());
-
- // Replace by setting model object
- this.clearEvent();
- this.schemaGeneration.setOutputMode(OUTPUT_MODE_TEST_VALUE);
- this.verifyPutEvent(SchemaGeneration.OUTPUT_MODE_PROPERTY, OUTPUT_MODE_TEST_VALUE, this.schemaGeneration.getOutputMode());
- }
-
- // ****** convenience methods *******
- @Override
- protected PersistenceUnitProperties getModel() {
- return this.schemaGeneration;
- }
-
- private ListValueModel<PersistenceUnit.Property> buildPropertiesAdapter(PropertyValueModel<EclipseLinkPersistenceUnit> subjectHolder) {
- return new ListAspectAdapter<EclipseLinkPersistenceUnit, PersistenceUnit.Property>(subjectHolder, PersistenceUnit.PROPERTIES_LIST) {
- @Override
- protected ListIterator<PersistenceUnit.Property> listIterator_() {
- return this.subject.properties();
- }
-
- @Override
- protected int size_() {
- return this.subject.propertiesSize();
- }
- };
- }
-
- // ********** get/set property **********
- @Override
- protected void setProperty(String propertyName, Object newValue) throws Exception {
- throw new UnsupportedOperationException();
- }
-
- @Override
- protected Object getProperty(String propertyName) throws NoSuchFieldException {
- throw new UnsupportedOperationException();
- }
-}
diff --git a/jpa/tests/org.eclipse.jpt.eclipselink.core.tests/src/org/eclipse/jpt/eclipselink/core/tests/internal/context/persistence/schema/generation/SchemaGenerationValueModelTests.java b/jpa/tests/org.eclipse.jpt.eclipselink.core.tests/src/org/eclipse/jpt/eclipselink/core/tests/internal/context/persistence/schema/generation/SchemaGenerationValueModelTests.java
deleted file mode 100644
index ec96d8e284..0000000000
--- a/jpa/tests/org.eclipse.jpt.eclipselink.core.tests/src/org/eclipse/jpt/eclipselink/core/tests/internal/context/persistence/schema/generation/SchemaGenerationValueModelTests.java
+++ /dev/null
@@ -1,232 +0,0 @@
-/*******************************************************************************
- * Copyright (c) 2008, 2009 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.
- *
- * Contributors:
- * Oracle - initial API and implementation
- *******************************************************************************/
-package org.eclipse.jpt.eclipselink.core.tests.internal.context.persistence.schema.generation;
-
-import org.eclipse.jpt.core.context.persistence.PersistenceUnit;
-import org.eclipse.jpt.eclipselink.core.internal.context.persistence.PersistenceUnitProperties;
-import org.eclipse.jpt.eclipselink.core.internal.context.persistence.schema.generation.DdlGenerationType;
-import org.eclipse.jpt.eclipselink.core.internal.context.persistence.schema.generation.OutputMode;
-import org.eclipse.jpt.eclipselink.core.internal.context.persistence.schema.generation.SchemaGeneration;
-import org.eclipse.jpt.eclipselink.core.tests.internal.context.persistence.PersistenceUnitTestCase;
-import org.eclipse.jpt.utility.internal.model.value.PropertyAspectAdapter;
-import org.eclipse.jpt.utility.internal.model.value.SimplePropertyValueModel;
-import org.eclipse.jpt.utility.model.event.PropertyChangeEvent;
-import org.eclipse.jpt.utility.model.listener.PropertyChangeListener;
-import org.eclipse.jpt.utility.model.value.PropertyValueModel;
-import org.eclipse.jpt.utility.model.value.WritablePropertyValueModel;
-
-/**
- * SchemaGenerationValueModelTests
- *
- * Tests the PropertyValueModel of SchemaGeneration model and the update of the
- * PersistenceUnit.
- */
-public class SchemaGenerationValueModelTests extends PersistenceUnitTestCase
-{
- private SchemaGeneration schemaGen;
- private PropertyValueModel<SchemaGeneration> schemaGenHolder;
-
- private WritablePropertyValueModel<DdlGenerationType> ddlGenerationTypeHolder;
- private PropertyChangeEvent ddlGenerationTypeEvent;
-
- private WritablePropertyValueModel<OutputMode> outputModeHolder;
- private PropertyChangeEvent outputModeEvent;
-
- public static final DdlGenerationType DDL_GENERATION_TYPE_TEST_VALUE = DdlGenerationType.drop_and_create_tables;
- public static final OutputMode OUTPUT_MODE_TEST_VALUE = OutputMode.sql_script;
-
- public SchemaGenerationValueModelTests(String name) {
- super(name);
- }
-
- @Override
- protected void setUp() throws Exception {
- super.setUp();
- this.schemaGen = this.subject.getSchemaGeneration(); // Subject
- this.schemaGenHolder = new SimplePropertyValueModel<SchemaGeneration>(this.schemaGen);
-
- this.ddlGenerationTypeHolder = this.buildDdlGenerationTypeAA(this.schemaGenHolder);
- PropertyChangeListener ddlGenerationTypeListener = this.buildDdlGenerationTypeChangeListener();
- this.ddlGenerationTypeHolder.addPropertyChangeListener(PropertyValueModel.VALUE, ddlGenerationTypeListener);
- this.ddlGenerationTypeEvent = null;
-
- this.outputModeHolder = this.buildOutputModeAA(this.schemaGenHolder);
- PropertyChangeListener outputModeListener = this.buildOutputModeChangeListener();
- this.outputModeHolder.addPropertyChangeListener(PropertyValueModel.VALUE, outputModeListener);
- this.outputModeEvent = null;
- }
-
- /**
- * Initializes directly the PU properties before testing. Cannot use
- * Property Holder to initialize because it is not created yet
- */
- @Override
- protected void populatePu() {
- this.persistenceUnitSetProperty(
- SchemaGeneration.ECLIPSELINK_DDL_GENERATION_TYPE,
- DDL_GENERATION_TYPE_TEST_VALUE);
- this.persistenceUnitSetProperty(
- SchemaGeneration.ECLIPSELINK_DDL_GENERATION_OUTPUT_MODE,
- OUTPUT_MODE_TEST_VALUE);
- return;
- }
-
- @Override
- protected PersistenceUnitProperties getModel() {
- return this.schemaGen;
- }
-
- /** ****** DdlGenerationType ******* */
- private WritablePropertyValueModel<DdlGenerationType> buildDdlGenerationTypeAA(PropertyValueModel<SchemaGeneration> subjectHolder) {
- return new PropertyAspectAdapter<SchemaGeneration, DdlGenerationType>(subjectHolder, SchemaGeneration.DDL_GENERATION_TYPE_PROPERTY) {
- @Override
- protected DdlGenerationType buildValue_() {
- return this.subject.getDdlGenerationType();
- }
-
- @Override
- protected void setValue_(DdlGenerationType enumValue) {
- this.subject.setDdlGenerationType(enumValue);
- }
- };
- }
-
- private PropertyChangeListener buildDdlGenerationTypeChangeListener() {
- return new PropertyChangeListener() {
- public void propertyChanged(PropertyChangeEvent e) {
- SchemaGenerationValueModelTests.this.ddlGenerationTypeEvent = e;
- }
- };
- }
-
- /** ****** OutputMode ******* */
- private WritablePropertyValueModel<OutputMode> buildOutputModeAA(PropertyValueModel<SchemaGeneration> subjectHolder) {
- return new PropertyAspectAdapter<SchemaGeneration, OutputMode>(subjectHolder, SchemaGeneration.OUTPUT_MODE_PROPERTY) {
- @Override
- protected OutputMode buildValue_() {
- return this.subject.getOutputMode();
- }
-
- @Override
- protected void setValue_(OutputMode enumValue) {
- this.subject.setOutputMode(enumValue);
- }
- };
- }
-
- private PropertyChangeListener buildOutputModeChangeListener() {
- return new PropertyChangeListener() {
- public void propertyChanged(PropertyChangeEvent e) {
- SchemaGenerationValueModelTests.this.outputModeEvent = e;
- }
- };
- }
-
- public void testValue() {
- /** ****** DdlGenerationType ******* */
- this.verifyDdlGenerationTypeAAValue(DDL_GENERATION_TYPE_TEST_VALUE);
- assertEquals(
- SchemaGeneration.DEFAULT_SCHEMA_GENERATION_DDL_GENERATION_TYPE,
- this.schemaGen.getDefaultDdlGenerationType());
- /** ****** OutputMode ******* */
- this.verifyOutputModeAAValue(OUTPUT_MODE_TEST_VALUE);
- assertEquals(
- SchemaGeneration.DEFAULT_SCHEMA_GENERATION_OUTPUT_MODE,
- this.schemaGen.getDefaultOutputMode());
- }
-
- public void testSetValue() throws Exception {
- /** ****** DdlGenerationType ******* */
- this.ddlGenerationTypeEvent = null;
- this.verifyHasListeners(this.ddlGenerationTypeHolder, PropertyValueModel.VALUE);
- DdlGenerationType newDdlGenerationType = DdlGenerationType.create_tables;
- // Modify the persistenceUnit directly
- this.subject.setProperty(
- SchemaGeneration.ECLIPSELINK_DDL_GENERATION_TYPE,
- this.getEclipseLinkStringValueOf(newDdlGenerationType),
- false);
- this.verifyDdlGenerationTypeAAValue(newDdlGenerationType);
- assertNotNull(this.ddlGenerationTypeEvent);
-
- /** ****** OutputMode ******* */
- this.outputModeEvent = null;
- this.verifyHasListeners(this.outputModeHolder, PropertyValueModel.VALUE);
- OutputMode newOutputMode = OutputMode.database;
- // Modify the property holder
- this.outputModeHolder.setValue(newOutputMode);
- this.verifyOutputModeAAValue(newOutputMode);
- assertNotNull(this.outputModeEvent);
- }
-
- public void testSetNullValue() {
- /** ****** DdlGenerationType ******* */
- this.ddlGenerationTypeEvent = null;
- // Setting the persistenceUnit directly
- this.subject.setProperty(SchemaGeneration.ECLIPSELINK_DDL_GENERATION_TYPE, null, false);
- this.ddlGenerationTypeHolder.setValue(null);
- // testing Holder
- this.verifyDdlGenerationTypeAAValue(null);
- assertNotNull(this.ddlGenerationTypeEvent);
- // testing PU properties
- PersistenceUnit.Property property = this.getPersistenceUnit().getProperty(SchemaGeneration.ECLIPSELINK_DDL_GENERATION_TYPE);
- assertNull(property);
-
- /** ****** OutputMode ******* */
- this.outputModeEvent = null;
- // Setting the property holder
- this.outputModeHolder.setValue(null);
- // testing Holder
- this.verifyOutputModeAAValue(null);
- assertNotNull(this.outputModeEvent);
- // testing PU properties
- property = this.getPersistenceUnit().getProperty(SchemaGeneration.ECLIPSELINK_DDL_GENERATION_OUTPUT_MODE);
- assertNull(property);
- }
-
- /** ****** convenience methods ******* */
- /**
- * Performs three value tests:<br>
- * 1. subject value<br>
- * 2. aspect adapter value<br>
- * 3. persistenceUnit property value<br>
- */
- protected void verifyDdlGenerationTypeAAValue(DdlGenerationType testValue) {
- this.verifyAAValue(
- testValue,
- this.schemaGen.getDdlGenerationType(),
- this.ddlGenerationTypeHolder,
- SchemaGeneration.ECLIPSELINK_DDL_GENERATION_TYPE);
- }
-
- /**
- * Performs three value tests:<br>
- * 1. subject value<br>
- * 2. aspect adapter value<br>
- * 3. persistenceUnit property value<br>
- */
- protected void verifyOutputModeAAValue(OutputMode testValue) {
- this.verifyAAValue(
- testValue,
- this.schemaGen.getOutputMode(),
- this.outputModeHolder,
- SchemaGeneration.ECLIPSELINK_DDL_GENERATION_OUTPUT_MODE);
- }
-
- // ********** get/set property **********
- @Override
- protected void setProperty(String propertyName, Object newValue) throws Exception {
- throw new UnsupportedOperationException();
- }
-
- @Override
- protected Object getProperty(String propertyName) throws NoSuchFieldException {
- throw new UnsupportedOperationException();
- }
-}
diff --git a/jpa/tests/org.eclipse.jpt.eclipselink.core.tests/src/org/eclipse/jpt/eclipselink/core/tests/internal/resource/JptEclipselinkCoreResourceModelTests.java b/jpa/tests/org.eclipse.jpt.eclipselink.core.tests/src/org/eclipse/jpt/eclipselink/core/tests/internal/resource/JptEclipselinkCoreResourceModelTests.java
deleted file mode 100644
index 9003ccf6a2..0000000000
--- a/jpa/tests/org.eclipse.jpt.eclipselink.core.tests/src/org/eclipse/jpt/eclipselink/core/tests/internal/resource/JptEclipselinkCoreResourceModelTests.java
+++ /dev/null
@@ -1,34 +0,0 @@
-/*******************************************************************************
- * Copyright (c) 2007, 2009 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
- *
- * Contributors:
- * Oracle - initial API and implementation
- *******************************************************************************/
-package org.eclipse.jpt.eclipselink.core.tests.internal.resource;
-
-import junit.framework.Test;
-import junit.framework.TestCase;
-import junit.framework.TestSuite;
-import org.eclipse.jpt.eclipselink.core.tests.internal.resource.java.JptEclipseLinkCoreJavaResourceModelTests;
-
-public class JptEclipselinkCoreResourceModelTests extends TestCase
-{
- public static Test suite() {
- return suite(true);
- }
-
- public static Test suite(boolean all) {
- TestSuite suite = new TestSuite(JptEclipselinkCoreResourceModelTests.class.getName());
- suite.addTest(JptEclipseLinkCoreJavaResourceModelTests.suite(all));
- return suite;
- }
-
- private JptEclipselinkCoreResourceModelTests() {
- super();
- throw new UnsupportedOperationException();
- }
-}
diff --git a/jpa/tests/org.eclipse.jpt.eclipselink.core.tests/src/org/eclipse/jpt/eclipselink/core/tests/internal/resource/java/CacheTests.java b/jpa/tests/org.eclipse.jpt.eclipselink.core.tests/src/org/eclipse/jpt/eclipselink/core/tests/internal/resource/java/CacheTests.java
deleted file mode 100644
index c657a0d060..0000000000
--- a/jpa/tests/org.eclipse.jpt.eclipselink.core.tests/src/org/eclipse/jpt/eclipselink/core/tests/internal/resource/java/CacheTests.java
+++ /dev/null
@@ -1,447 +0,0 @@
-/*******************************************************************************
- * Copyright (c) 2007, 2009 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.
- *
- * Contributors:
- * Oracle - initial API and implementation
- ******************************************************************************/
-package org.eclipse.jpt.eclipselink.core.tests.internal.resource.java;
-
-import java.util.Iterator;
-import org.eclipse.jdt.core.ICompilationUnit;
-import org.eclipse.jpt.core.resource.java.JavaResourcePersistentType;
-import org.eclipse.jpt.eclipselink.core.resource.java.CacheAnnotation;
-import org.eclipse.jpt.eclipselink.core.resource.java.CacheCoordinationType;
-import org.eclipse.jpt.eclipselink.core.resource.java.CacheType;
-import org.eclipse.jpt.eclipselink.core.resource.java.EclipseLinkJPA;
-import org.eclipse.jpt.eclipselink.core.resource.java.TimeOfDayAnnotation;
-import org.eclipse.jpt.utility.internal.iterators.ArrayIterator;
-
-@SuppressWarnings("nls")
-public class CacheTests extends EclipseLinkJavaResourceModelTestCase {
-
- public CacheTests(String name) {
- super(name);
- }
-
- private ICompilationUnit createTestCache() throws Exception {
- return this.createTestType(new DefaultAnnotationWriter() {
- @Override
- public Iterator<String> imports() {
- return new ArrayIterator<String>(EclipseLinkJPA.CACHE, EclipseLinkJPA.CACHE_TYPE);
- }
- @Override
- public void appendTypeAnnotationTo(StringBuilder sb) {
- sb.append("@Cache");
- }
- });
- }
-
- private ICompilationUnit createTestCacheWithCacheType() throws Exception {
- return this.createTestType(new DefaultAnnotationWriter() {
- @Override
- public Iterator<String> imports() {
- return new ArrayIterator<String>(EclipseLinkJPA.CACHE, EclipseLinkJPA.CACHE_TYPE);
- }
- @Override
- public void appendTypeAnnotationTo(StringBuilder sb) {
- sb.append("@Cache(type = CacheType.SOFT)");
- }
- });
- }
-
- private ICompilationUnit createTestCacheWithSize() throws Exception {
- return this.createTestType(new DefaultAnnotationWriter() {
- @Override
- public Iterator<String> imports() {
- return new ArrayIterator<String>(EclipseLinkJPA.CACHE);
- }
- @Override
- public void appendTypeAnnotationTo(StringBuilder sb) {
- sb.append("@Cache(size = 50)");
- }
- });
- }
-
- private ICompilationUnit createTestCacheWithExpiry() throws Exception {
- return this.createTestType(new DefaultAnnotationWriter() {
- @Override
- public Iterator<String> imports() {
- return new ArrayIterator<String>(EclipseLinkJPA.CACHE);
- }
- @Override
- public void appendTypeAnnotationTo(StringBuilder sb) {
- sb.append("@Cache(expiry = 50)");
- }
- });
- }
-
- private ICompilationUnit createTestCacheWithExpiryTimeOfDay() throws Exception {
- return this.createTestType(new DefaultAnnotationWriter() {
- @Override
- public Iterator<String> imports() {
- return new ArrayIterator<String>(EclipseLinkJPA.CACHE, EclipseLinkJPA.TIME_OF_DAY);
- }
- @Override
- public void appendTypeAnnotationTo(StringBuilder sb) {
- sb.append("@Cache(expiryTimeOfDay = @TimeOfDay)");
- }
- });
- }
-
- private ICompilationUnit createTestCacheWithShared() throws Exception {
- return this.createTestType(new DefaultAnnotationWriter() {
- @Override
- public Iterator<String> imports() {
- return new ArrayIterator<String>(EclipseLinkJPA.CACHE);
- }
- @Override
- public void appendTypeAnnotationTo(StringBuilder sb) {
- sb.append("@Cache(shared=true)");
- }
- });
- }
-
- private ICompilationUnit createTestCacheWithAlwaysRefresh() throws Exception {
- return this.createTestType(new DefaultAnnotationWriter() {
- @Override
- public Iterator<String> imports() {
- return new ArrayIterator<String>(EclipseLinkJPA.CACHE);
- }
- @Override
- public void appendTypeAnnotationTo(StringBuilder sb) {
- sb.append("@Cache(alwaysRefresh=true)");
- }
- });
- }
-
- private ICompilationUnit createTestCacheWithRefreshOnlyIfNewer() throws Exception {
- return this.createTestType(new DefaultAnnotationWriter() {
- @Override
- public Iterator<String> imports() {
- return new ArrayIterator<String>(EclipseLinkJPA.CACHE);
- }
- @Override
- public void appendTypeAnnotationTo(StringBuilder sb) {
- sb.append("@Cache(refreshOnlyIfNewer=true)");
- }
- });
- }
-
- private ICompilationUnit createTestCacheWithDisableHits() throws Exception {
- return this.createTestType(new DefaultAnnotationWriter() {
- @Override
- public Iterator<String> imports() {
- return new ArrayIterator<String>(EclipseLinkJPA.CACHE);
- }
- @Override
- public void appendTypeAnnotationTo(StringBuilder sb) {
- sb.append("@Cache(disableHits=true)");
- }
- });
- }
-
- private ICompilationUnit createTestExistenceCheckingWithCoordinationType() throws Exception {
- return this.createTestType(new DefaultAnnotationWriter() {
- @Override
- public Iterator<String> imports() {
- return new ArrayIterator<String>(EclipseLinkJPA.CACHE, EclipseLinkJPA.CACHE_COORDINATION_TYPE);
- }
- @Override
- public void appendTypeAnnotationTo(StringBuilder sb) {
- sb.append("@Cache(coordinationType = CacheCoordinationType.INVALIDATE_CHANGED_OBJECTS)");
- }
- });
- }
-
- public void testCache() throws Exception {
- ICompilationUnit cu = this.createTestCache();
- JavaResourcePersistentType typeResource = buildJavaTypeResource(cu);
-
- CacheAnnotation cache = (CacheAnnotation) typeResource.getSupportingAnnotation(EclipseLinkJPA.CACHE);
- assertNotNull(cache);
- }
-
- public void testGetType() throws Exception {
- ICompilationUnit cu = this.createTestCacheWithCacheType();
- JavaResourcePersistentType typeResource = buildJavaTypeResource(cu);
-
- CacheAnnotation cache = (CacheAnnotation) typeResource.getSupportingAnnotation(EclipseLinkJPA.CACHE);
- assertEquals(CacheType.SOFT, cache.getType());
- }
-
- public void testSetType() throws Exception {
- ICompilationUnit cu = this.createTestCacheWithCacheType();
- JavaResourcePersistentType typeResource = buildJavaTypeResource(cu);
-
- CacheAnnotation cache = (CacheAnnotation) typeResource.getSupportingAnnotation(EclipseLinkJPA.CACHE);
- assertEquals(CacheType.SOFT, cache.getType());
-
- cache.setType(CacheType.WEAK);
- assertEquals(CacheType.WEAK, cache.getType());
-
- assertSourceContains("@Cache(type = WEAK)", cu);
-
- cache.setType(null);
- assertNull(cache.getType());
-
- assertSourceDoesNotContain("(type = WEAK)", cu);
- assertSourceDoesNotContain("@Cache", cu);
- }
-
- public void testGetSize() throws Exception {
- ICompilationUnit cu = this.createTestCacheWithSize();
- JavaResourcePersistentType typeResource = buildJavaTypeResource(cu);
-
- CacheAnnotation cache = (CacheAnnotation) typeResource.getSupportingAnnotation(EclipseLinkJPA.CACHE);
- assertEquals(Integer.valueOf(50), cache.getSize());
- }
-
- public void testSetSize() throws Exception {
- ICompilationUnit cu = this.createTestCacheWithSize();
- JavaResourcePersistentType typeResource = buildJavaTypeResource(cu);
-
- CacheAnnotation cache = (CacheAnnotation) typeResource.getSupportingAnnotation(EclipseLinkJPA.CACHE);
- assertEquals(Integer.valueOf(50), cache.getSize());
-
- cache.setSize(Integer.valueOf(80));
- assertEquals(Integer.valueOf(80), cache.getSize());
-
- assertSourceContains("@Cache(size = 80)", cu);
-
- cache.setSize(null);
- assertNull(cache.getSize());
-
- assertSourceDoesNotContain("(size = 80)", cu);
- assertSourceDoesNotContain("@Cache", cu);
- }
-
- public void testGetShared() throws Exception {
- ICompilationUnit cu = this.createTestCacheWithShared();
- JavaResourcePersistentType typeResource = buildJavaTypeResource(cu);
-
- CacheAnnotation cache = (CacheAnnotation) typeResource.getSupportingAnnotation(EclipseLinkJPA.CACHE);
- assertEquals(Boolean.TRUE, cache.getShared());
- }
-
- public void testSetShared() throws Exception {
- ICompilationUnit cu = this.createTestCacheWithShared();
- JavaResourcePersistentType typeResource = buildJavaTypeResource(cu);
-
- CacheAnnotation cache = (CacheAnnotation) typeResource.getSupportingAnnotation(EclipseLinkJPA.CACHE);
- assertEquals(Boolean.TRUE, cache.getShared());
-
- cache.setShared(Boolean.FALSE);
- assertEquals(Boolean.FALSE, cache.getShared());
-
- assertSourceContains("@Cache(shared=false)", cu);
- }
-
- public void testSetSharedNull() throws Exception {
- ICompilationUnit cu = this.createTestCacheWithShared();
- JavaResourcePersistentType typeResource = buildJavaTypeResource(cu);
-
- CacheAnnotation cache = (CacheAnnotation) typeResource.getSupportingAnnotation(EclipseLinkJPA.CACHE);
- assertEquals(Boolean.TRUE, cache.getShared());
-
- cache.setShared(null);
- assertNull(typeResource.getSupportingAnnotation(EclipseLinkJPA.CACHE));
-
- assertSourceDoesNotContain("@Cache", cu);
- }
-
- public void testGetExpiry() throws Exception {
- ICompilationUnit cu = this.createTestCacheWithExpiry();
- JavaResourcePersistentType typeResource = buildJavaTypeResource(cu);
-
- CacheAnnotation cache = (CacheAnnotation) typeResource.getSupportingAnnotation(EclipseLinkJPA.CACHE);
- assertEquals(Integer.valueOf(50), cache.getExpiry());
- }
-
- public void testSetExpiry() throws Exception {
- ICompilationUnit cu = this.createTestCacheWithExpiry();
- JavaResourcePersistentType typeResource = buildJavaTypeResource(cu);
-
- CacheAnnotation cache = (CacheAnnotation) typeResource.getSupportingAnnotation(EclipseLinkJPA.CACHE);
- assertEquals(Integer.valueOf(50), cache.getExpiry());
-
- cache.setExpiry(Integer.valueOf(80));
- assertEquals(Integer.valueOf(80), cache.getExpiry());
-
- assertSourceContains("@Cache(expiry = 80)", cu);
-
- cache.setExpiry(null);
- assertNull(cache.getExpiry());
-
- assertSourceDoesNotContain("(expiry = 80)", cu);
- assertSourceDoesNotContain("@Cache", cu);
- }
-
- public void testGetExpiryTimeOfDay() throws Exception {
- ICompilationUnit cu = this.createTestCacheWithExpiryTimeOfDay();
- JavaResourcePersistentType typeResource = buildJavaTypeResource(cu);
-
- CacheAnnotation cache = (CacheAnnotation) typeResource.getSupportingAnnotation(EclipseLinkJPA.CACHE);
- TimeOfDayAnnotation timeOfDay = cache.getExpiryTimeOfDay();
- assertNotNull(timeOfDay);
- }
-
- public void testAddExpiryTimeOfDay() throws Exception {
- ICompilationUnit cu = this.createTestCache();
- JavaResourcePersistentType typeResource = buildJavaTypeResource(cu);
-
- CacheAnnotation cache = (CacheAnnotation) typeResource.getSupportingAnnotation(EclipseLinkJPA.CACHE);
- cache.addExpiryTimeOfDay();
-
- assertNotNull(cache.getExpiryTimeOfDay());
-
- assertSourceContains("@Cache(expiryTimeOfDay = @TimeOfDay)", cu);
- }
-
- public void testRemoveExpiryTimeOfDay() throws Exception {
- ICompilationUnit cu = this.createTestCacheWithExpiryTimeOfDay();
- JavaResourcePersistentType typeResource = buildJavaTypeResource(cu);
-
- CacheAnnotation cache = (CacheAnnotation) typeResource.getSupportingAnnotation(EclipseLinkJPA.CACHE);
-
- assertNotNull(cache.getExpiryTimeOfDay());
-
- cache.removeExpiryTimeOfDay();
- assertNull(cache.getExpiryTimeOfDay());
- assertSourceDoesNotContain("@Cache(expiryTimeOfDay = @TimeOfDay)", cu);
- }
-
- public void testGetAlwaysRefresh() throws Exception {
- ICompilationUnit cu = this.createTestCacheWithAlwaysRefresh();
- JavaResourcePersistentType typeResource = buildJavaTypeResource(cu);
-
- CacheAnnotation cache = (CacheAnnotation) typeResource.getSupportingAnnotation(EclipseLinkJPA.CACHE);
- assertEquals(Boolean.TRUE, cache.getAlwaysRefresh());
- }
-
- public void testSetAlwaysRefresh() throws Exception {
- ICompilationUnit cu = this.createTestCacheWithAlwaysRefresh();
- JavaResourcePersistentType typeResource = buildJavaTypeResource(cu);
-
- CacheAnnotation cache = (CacheAnnotation) typeResource.getSupportingAnnotation(EclipseLinkJPA.CACHE);
- assertEquals(Boolean.TRUE, cache.getAlwaysRefresh());
-
- cache.setAlwaysRefresh(Boolean.FALSE);
- assertEquals(Boolean.FALSE, cache.getAlwaysRefresh());
-
- assertSourceContains("@Cache(alwaysRefresh=false)", cu);
- }
-
- public void testSetAlwaysRefreshNull() throws Exception {
- ICompilationUnit cu = this.createTestCacheWithAlwaysRefresh();
- JavaResourcePersistentType typeResource = buildJavaTypeResource(cu);
-
- CacheAnnotation cache = (CacheAnnotation) typeResource.getSupportingAnnotation(EclipseLinkJPA.CACHE);
- assertEquals(Boolean.TRUE, cache.getAlwaysRefresh());
-
- cache.setAlwaysRefresh(null);
- assertNull(typeResource.getSupportingAnnotation(EclipseLinkJPA.CACHE));
-
- assertSourceDoesNotContain("@Cache", cu);
- }
-
- public void testGetRefreshOnlyIfNewer() throws Exception {
- ICompilationUnit cu = this.createTestCacheWithRefreshOnlyIfNewer();
- JavaResourcePersistentType typeResource = buildJavaTypeResource(cu);
-
- CacheAnnotation cache = (CacheAnnotation) typeResource.getSupportingAnnotation(EclipseLinkJPA.CACHE);
- assertEquals(Boolean.TRUE, cache.getRefreshOnlyIfNewer());
- }
-
- public void testSetRefreshOnlyIfNewer() throws Exception {
- ICompilationUnit cu = this.createTestCacheWithRefreshOnlyIfNewer();
- JavaResourcePersistentType typeResource = buildJavaTypeResource(cu);
-
- CacheAnnotation cache = (CacheAnnotation) typeResource.getSupportingAnnotation(EclipseLinkJPA.CACHE);
- assertEquals(Boolean.TRUE, cache.getRefreshOnlyIfNewer());
-
- cache.setRefreshOnlyIfNewer(Boolean.FALSE);
- assertEquals(Boolean.FALSE, cache.getRefreshOnlyIfNewer());
-
- assertSourceContains("@Cache(refreshOnlyIfNewer=false)", cu);
- }
-
- public void testSetRefreshOnlyIfNewerNull() throws Exception {
- ICompilationUnit cu = this.createTestCacheWithRefreshOnlyIfNewer();
- JavaResourcePersistentType typeResource = buildJavaTypeResource(cu);
-
- CacheAnnotation cache = (CacheAnnotation) typeResource.getSupportingAnnotation(EclipseLinkJPA.CACHE);
- assertEquals(Boolean.TRUE, cache.getRefreshOnlyIfNewer());
-
- cache.setRefreshOnlyIfNewer(null);
- assertNull(typeResource.getSupportingAnnotation(EclipseLinkJPA.CACHE));
-
- assertSourceDoesNotContain("@Cache", cu);
- }
-
- public void testGetDisableHits() throws Exception {
- ICompilationUnit cu = this.createTestCacheWithDisableHits();
- JavaResourcePersistentType typeResource = buildJavaTypeResource(cu);
-
- CacheAnnotation cache = (CacheAnnotation) typeResource.getSupportingAnnotation(EclipseLinkJPA.CACHE);
- assertEquals(Boolean.TRUE, cache.getDisableHits());
- }
-
- public void testSetDisableHits() throws Exception {
- ICompilationUnit cu = this.createTestCacheWithDisableHits();
- JavaResourcePersistentType typeResource = buildJavaTypeResource(cu);
-
- CacheAnnotation cache = (CacheAnnotation) typeResource.getSupportingAnnotation(EclipseLinkJPA.CACHE);
- assertEquals(Boolean.TRUE, cache.getDisableHits());
-
- cache.setDisableHits(Boolean.FALSE);
- assertEquals(Boolean.FALSE, cache.getDisableHits());
-
- assertSourceContains("@Cache(disableHits=false)", cu);
- }
-
- public void testSetDisableHitsNull() throws Exception {
- ICompilationUnit cu = this.createTestCacheWithDisableHits();
- JavaResourcePersistentType typeResource = buildJavaTypeResource(cu);
-
- CacheAnnotation cache = (CacheAnnotation) typeResource.getSupportingAnnotation(EclipseLinkJPA.CACHE);
- assertEquals(Boolean.TRUE, cache.getDisableHits());
-
- cache.setDisableHits(null);
- assertNull(typeResource.getSupportingAnnotation(EclipseLinkJPA.CACHE));
-
- assertSourceDoesNotContain("@Cache", cu);
- }
-
-
- public void testGetCoordinationType() throws Exception {
- ICompilationUnit cu = this.createTestExistenceCheckingWithCoordinationType();
- JavaResourcePersistentType typeResource = buildJavaTypeResource(cu);
-
- CacheAnnotation cache = (CacheAnnotation) typeResource.getSupportingAnnotation(EclipseLinkJPA.CACHE);
- assertEquals(CacheCoordinationType.INVALIDATE_CHANGED_OBJECTS, cache.getCoordinationType());
- }
-
- public void testSetCoordinationType() throws Exception {
- ICompilationUnit cu = this.createTestExistenceCheckingWithCoordinationType();
- JavaResourcePersistentType typeResource = buildJavaTypeResource(cu);
-
- CacheAnnotation cache = (CacheAnnotation) typeResource.getSupportingAnnotation(EclipseLinkJPA.CACHE);
- assertEquals(CacheCoordinationType.INVALIDATE_CHANGED_OBJECTS, cache.getCoordinationType());
-
- cache.setCoordinationType(CacheCoordinationType.SEND_NEW_OBJECTS_WITH_CHANGES);
- assertEquals(CacheCoordinationType.SEND_NEW_OBJECTS_WITH_CHANGES, cache.getCoordinationType());
-
- assertSourceContains("@Cache(coordinationType = SEND_NEW_OBJECTS_WITH_CHANGES)", cu);
-
- cache.setCoordinationType(null);
- assertNull(cache.getCoordinationType());
-
- assertSourceDoesNotContain("(coordinationType = SEND_NEW_OBJECTS_WITH_CHANGES)", cu);
- assertSourceDoesNotContain("@Cache", cu);
- }
-
-
-}
diff --git a/jpa/tests/org.eclipse.jpt.eclipselink.core.tests/src/org/eclipse/jpt/eclipselink/core/tests/internal/resource/java/ChangeTrackingTests.java b/jpa/tests/org.eclipse.jpt.eclipselink.core.tests/src/org/eclipse/jpt/eclipselink/core/tests/internal/resource/java/ChangeTrackingTests.java
deleted file mode 100644
index e4b660cfdb..0000000000
--- a/jpa/tests/org.eclipse.jpt.eclipselink.core.tests/src/org/eclipse/jpt/eclipselink/core/tests/internal/resource/java/ChangeTrackingTests.java
+++ /dev/null
@@ -1,88 +0,0 @@
-/*******************************************************************************
- * Copyright (c) 2007, 2008 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.
- *
- * Contributors:
- * Oracle - initial API and implementation
- ******************************************************************************/
-package org.eclipse.jpt.eclipselink.core.tests.internal.resource.java;
-
-import java.util.Iterator;
-import org.eclipse.jdt.core.ICompilationUnit;
-import org.eclipse.jpt.core.resource.java.JavaResourcePersistentType;
-import org.eclipse.jpt.eclipselink.core.resource.java.ChangeTrackingAnnotation;
-import org.eclipse.jpt.eclipselink.core.resource.java.ChangeTrackingType;
-import org.eclipse.jpt.eclipselink.core.resource.java.EclipseLinkJPA;
-import org.eclipse.jpt.utility.internal.iterators.ArrayIterator;
-
-@SuppressWarnings("nls")
-public class ChangeTrackingTests extends EclipseLinkJavaResourceModelTestCase {
-
- public ChangeTrackingTests(String name) {
- super(name);
- }
-
- private ICompilationUnit createTestChangeTracking() throws Exception {
- return this.createTestType(new DefaultAnnotationWriter() {
- @Override
- public Iterator<String> imports() {
- return new ArrayIterator<String>(EclipseLinkJPA.CHANGE_TRACKING, EclipseLinkJPA.CHANGE_TRACKING_TYPE);
- }
- @Override
- public void appendTypeAnnotationTo(StringBuilder sb) {
- sb.append("@ChangeTracking");
- }
- });
- }
-
- private ICompilationUnit createTestChangeTrackingWithValue() throws Exception {
- return this.createTestType(new DefaultAnnotationWriter() {
- @Override
- public Iterator<String> imports() {
- return new ArrayIterator<String>(EclipseLinkJPA.CHANGE_TRACKING, EclipseLinkJPA.CHANGE_TRACKING_TYPE);
- }
- @Override
- public void appendTypeAnnotationTo(StringBuilder sb) {
- sb.append("@ChangeTracking(ChangeTrackingType.DEFERRED)");
- }
- });
- }
-
- public void testChangeTracking() throws Exception {
- ICompilationUnit cu = this.createTestChangeTracking();
- JavaResourcePersistentType typeResource = buildJavaTypeResource(cu);
-
- ChangeTrackingAnnotation existenceChecking = (ChangeTrackingAnnotation) typeResource.getSupportingAnnotation(EclipseLinkJPA.CHANGE_TRACKING);
- assertNotNull(existenceChecking);
- }
-
- public void testGetValue() throws Exception {
- ICompilationUnit cu = this.createTestChangeTrackingWithValue();
- JavaResourcePersistentType typeResource = buildJavaTypeResource(cu);
-
- ChangeTrackingAnnotation existenceChecking = (ChangeTrackingAnnotation) typeResource.getSupportingAnnotation(EclipseLinkJPA.CHANGE_TRACKING);
- assertEquals(ChangeTrackingType.DEFERRED, existenceChecking.getValue());
- }
-
- public void testSetValue() throws Exception {
- ICompilationUnit cu = this.createTestChangeTrackingWithValue();
- JavaResourcePersistentType typeResource = buildJavaTypeResource(cu);
-
- ChangeTrackingAnnotation existenceChecking = (ChangeTrackingAnnotation) typeResource.getSupportingAnnotation(EclipseLinkJPA.CHANGE_TRACKING);
- assertEquals(ChangeTrackingType.DEFERRED, existenceChecking.getValue());
-
- existenceChecking.setValue(ChangeTrackingType.ATTRIBUTE);
- assertEquals(ChangeTrackingType.ATTRIBUTE, existenceChecking.getValue());
-
- assertSourceContains("@ChangeTracking(ATTRIBUTE)", cu);
-
- existenceChecking.setValue(null);
- assertNull(existenceChecking.getValue());
-
- assertSourceDoesNotContain("(ATTRIBUTE)", cu);
- assertSourceContains("@ChangeTracking", cu);
- assertSourceDoesNotContain("@ChangeTracking(", cu);
- }
-}
diff --git a/jpa/tests/org.eclipse.jpt.eclipselink.core.tests/src/org/eclipse/jpt/eclipselink/core/tests/internal/resource/java/ConversionValueAnnotationTests.java b/jpa/tests/org.eclipse.jpt.eclipselink.core.tests/src/org/eclipse/jpt/eclipselink/core/tests/internal/resource/java/ConversionValueAnnotationTests.java
deleted file mode 100644
index d97b64e41d..0000000000
--- a/jpa/tests/org.eclipse.jpt.eclipselink.core.tests/src/org/eclipse/jpt/eclipselink/core/tests/internal/resource/java/ConversionValueAnnotationTests.java
+++ /dev/null
@@ -1,131 +0,0 @@
-/*******************************************************************************
- * Copyright (c) 2008, 2009 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.
- *
- * Contributors:
- * Oracle - initial API and implementation
- ******************************************************************************/
-package org.eclipse.jpt.eclipselink.core.tests.internal.resource.java;
-
-import java.util.Iterator;
-import org.eclipse.jdt.core.ICompilationUnit;
-import org.eclipse.jpt.core.resource.java.JavaResourcePersistentAttribute;
-import org.eclipse.jpt.core.resource.java.JavaResourcePersistentType;
-import org.eclipse.jpt.eclipselink.core.resource.java.EclipseLinkJPA;
-import org.eclipse.jpt.eclipselink.core.resource.java.ObjectTypeConverterAnnotation;
-import org.eclipse.jpt.utility.internal.iterators.ArrayIterator;
-
-@SuppressWarnings("nls")
-public class ConversionValueAnnotationTests extends EclipseLinkJavaResourceModelTestCase {
-
- public ConversionValueAnnotationTests(String name) {
- super(name);
- }
-
- private ICompilationUnit createTestObjectTypeConverter() throws Exception {
- return this.createTestType(new DefaultAnnotationWriter() {
- @Override
- public Iterator<String> imports() {
- return new ArrayIterator<String>(EclipseLinkJPA.OBJECT_TYPE_CONVERTER);
- }
- @Override
- public void appendIdFieldAnnotationTo(StringBuilder sb) {
- sb.append("@ObjectTypeConverter");
- }
- });
- }
-
- private ICompilationUnit createTestObjectTypeConverterWithConversionValues() throws Exception {
- return this.createTestType(new DefaultAnnotationWriter() {
- @Override
- public Iterator<String> imports() {
- return new ArrayIterator<String>(EclipseLinkJPA.OBJECT_TYPE_CONVERTER, EclipseLinkJPA.CONVERSION_VALUE);
- }
- @Override
- public void appendIdFieldAnnotationTo(StringBuilder sb) {
- sb.append("@ObjectTypeConverter(conversionValues = {@ConversionValue(dataValue = \"F\", objectValue = \"Female\"), @ConversionValue(dataValue = \"M\", objectValue = \"Male\")})");
- }
- });
- }
-
-
- public void testGetDataValue() throws Exception {
- ICompilationUnit cu = this.createTestObjectTypeConverterWithConversionValues();
- JavaResourcePersistentType typeResource = buildJavaTypeResource(cu);
- JavaResourcePersistentAttribute attributeResource = typeResource.fields().next();
-
- ObjectTypeConverterAnnotation converter = (ObjectTypeConverterAnnotation) attributeResource.getSupportingAnnotation(EclipseLinkJPA.OBJECT_TYPE_CONVERTER);
- assertEquals("F", converter.conversionValueAt(0).getDataValue());
- }
-
- public void testSetDataValue() throws Exception {
- ICompilationUnit cu = this.createTestObjectTypeConverterWithConversionValues();
- JavaResourcePersistentType typeResource = buildJavaTypeResource(cu);
- JavaResourcePersistentAttribute attributeResource = typeResource.fields().next();
-
- ObjectTypeConverterAnnotation converter = (ObjectTypeConverterAnnotation) attributeResource.getSupportingAnnotation(EclipseLinkJPA.OBJECT_TYPE_CONVERTER);
- assertEquals("F", converter.conversionValueAt(0).getDataValue());
-
- converter.conversionValueAt(0).setDataValue("FOO");
- assertEquals("FOO", converter.conversionValueAt(0).getDataValue());
-
- assertSourceContains("@ObjectTypeConverter(conversionValues = {@ConversionValue(dataValue = \"FOO\", objectValue = \"Female\"), @ConversionValue(dataValue = \"M\", objectValue = \"Male\")})", cu);
- }
-
- public void testSetDataValueNull() throws Exception {
- ICompilationUnit cu = this.createTestObjectTypeConverter();
- JavaResourcePersistentType typeResource = buildJavaTypeResource(cu);
- JavaResourcePersistentAttribute attributeResource = typeResource.fields().next();
-
- ObjectTypeConverterAnnotation converter = (ObjectTypeConverterAnnotation) attributeResource.getSupportingAnnotation(EclipseLinkJPA.OBJECT_TYPE_CONVERTER);
- assertEquals(0, converter.conversionValuesSize());
-
- converter.addConversionValue(0).setDataValue("FOO");
- assertSourceContains("@ObjectTypeConverter(conversionValues = @ConversionValue(dataValue = \"FOO\"))", cu);
-
- converter.conversionValueAt(0).setDataValue(null);
- assertSourceContains("@ObjectTypeConverter(conversionValues = @ConversionValue)", cu);
- assertEquals(1, converter.conversionValuesSize());
- }
-
- public void testGetObjectValue() throws Exception {
- ICompilationUnit cu = this.createTestObjectTypeConverterWithConversionValues();
- JavaResourcePersistentType typeResource = buildJavaTypeResource(cu);
- JavaResourcePersistentAttribute attributeResource = typeResource.fields().next();
-
- ObjectTypeConverterAnnotation converter = (ObjectTypeConverterAnnotation) attributeResource.getSupportingAnnotation(EclipseLinkJPA.OBJECT_TYPE_CONVERTER);
- assertEquals("Female", converter.conversionValueAt(0).getObjectValue());
- }
-
- public void testSetObjectValue() throws Exception {
- ICompilationUnit cu = this.createTestObjectTypeConverterWithConversionValues();
- JavaResourcePersistentType typeResource = buildJavaTypeResource(cu);
- JavaResourcePersistentAttribute attributeResource = typeResource.fields().next();
-
- ObjectTypeConverterAnnotation converter = (ObjectTypeConverterAnnotation) attributeResource.getSupportingAnnotation(EclipseLinkJPA.OBJECT_TYPE_CONVERTER);
- assertEquals("Female", converter.conversionValueAt(0).getObjectValue());
-
- converter.conversionValueAt(0).setObjectValue("FOO");
- assertEquals("FOO", converter.conversionValueAt(0).getObjectValue());
-
- assertSourceContains("@ObjectTypeConverter(conversionValues = {@ConversionValue(dataValue = \"F\", objectValue = \"FOO\"), @ConversionValue(dataValue = \"M\", objectValue = \"Male\")})", cu);
- }
-
- public void testSetObjectValueNull() throws Exception {
- ICompilationUnit cu = this.createTestObjectTypeConverter();
- JavaResourcePersistentType typeResource = buildJavaTypeResource(cu);
- JavaResourcePersistentAttribute attributeResource = typeResource.fields().next();
-
- ObjectTypeConverterAnnotation converter = (ObjectTypeConverterAnnotation) attributeResource.getSupportingAnnotation(EclipseLinkJPA.OBJECT_TYPE_CONVERTER);
- assertEquals(0, converter.conversionValuesSize());
-
- converter.addConversionValue(0).setObjectValue("FOO");
- assertSourceContains("@ObjectTypeConverter(conversionValues = @ConversionValue(objectValue = \"FOO\"))", cu);
-
- converter.conversionValueAt(0).setObjectValue(null);
- assertSourceContains("@ObjectTypeConverter(conversionValues = @ConversionValue)", cu);
- assertEquals(1, converter.conversionValuesSize());
- }
-}
diff --git a/jpa/tests/org.eclipse.jpt.eclipselink.core.tests/src/org/eclipse/jpt/eclipselink/core/tests/internal/resource/java/ConvertAnnotationTests.java b/jpa/tests/org.eclipse.jpt.eclipselink.core.tests/src/org/eclipse/jpt/eclipselink/core/tests/internal/resource/java/ConvertAnnotationTests.java
deleted file mode 100644
index 3018587927..0000000000
--- a/jpa/tests/org.eclipse.jpt.eclipselink.core.tests/src/org/eclipse/jpt/eclipselink/core/tests/internal/resource/java/ConvertAnnotationTests.java
+++ /dev/null
@@ -1,105 +0,0 @@
-/*******************************************************************************
- * Copyright (c) 2008 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.
- *
- * Contributors:
- * Oracle - initial API and implementation
- ******************************************************************************/
-package org.eclipse.jpt.eclipselink.core.tests.internal.resource.java;
-
-import java.util.Iterator;
-import org.eclipse.jdt.core.ICompilationUnit;
-import org.eclipse.jpt.core.resource.java.JavaResourcePersistentAttribute;
-import org.eclipse.jpt.core.resource.java.JavaResourcePersistentType;
-import org.eclipse.jpt.eclipselink.core.resource.java.ConvertAnnotation;
-import org.eclipse.jpt.eclipselink.core.resource.java.EclipseLinkJPA;
-import org.eclipse.jpt.utility.internal.iterators.ArrayIterator;
-
-@SuppressWarnings("nls")
-public class ConvertAnnotationTests extends EclipseLinkJavaResourceModelTestCase {
-
- public ConvertAnnotationTests(String name) {
- super(name);
- }
-
- private ICompilationUnit createTestConvert() throws Exception {
- return this.createTestType(new DefaultAnnotationWriter() {
- @Override
- public Iterator<String> imports() {
- return new ArrayIterator<String>(EclipseLinkJPA.CONVERT);
- }
- @Override
- public void appendIdFieldAnnotationTo(StringBuilder sb) {
- sb.append("@Convert");
- }
- });
- }
-
- private ICompilationUnit createTestConverterWithValue() throws Exception {
- return this.createTestType(new DefaultAnnotationWriter() {
- @Override
- public Iterator<String> imports() {
- return new ArrayIterator<String>(EclipseLinkJPA.CONVERT);
- }
- @Override
- public void appendIdFieldAnnotationTo(StringBuilder sb) {
- sb.append("@Convert(value=\"myConverter\")");
- }
- });
- }
-
- public void testConvertAnnotation() throws Exception {
- ICompilationUnit cu = this.createTestConvert();
- JavaResourcePersistentType typeResource = buildJavaTypeResource(cu);
- JavaResourcePersistentAttribute attributeResource = typeResource.fields().next();
-
- assertNotNull(attributeResource.getSupportingAnnotation(EclipseLinkJPA.CONVERT));
-
- attributeResource.removeSupportingAnnotation(EclipseLinkJPA.CONVERT);
- assertNull(attributeResource.getSupportingAnnotation(EclipseLinkJPA.CONVERT));
-
- attributeResource.addSupportingAnnotation(EclipseLinkJPA.CONVERT);
- assertNotNull(attributeResource.getSupportingAnnotation(EclipseLinkJPA.CONVERT));
- }
-
- public void testGetValue() throws Exception {
- ICompilationUnit cu = this.createTestConverterWithValue();
- JavaResourcePersistentType typeResource = buildJavaTypeResource(cu);
- JavaResourcePersistentAttribute attributeResource = typeResource.fields().next();
-
- ConvertAnnotation convert = (ConvertAnnotation) attributeResource.getSupportingAnnotation(EclipseLinkJPA.CONVERT);
- assertEquals("myConverter", convert.getValue());
- }
-
- public void testSetValue() throws Exception {
- ICompilationUnit cu = this.createTestConverterWithValue();
- JavaResourcePersistentType typeResource = buildJavaTypeResource(cu);
- JavaResourcePersistentAttribute attributeResource = typeResource.fields().next();
-
- ConvertAnnotation convert = (ConvertAnnotation) attributeResource.getSupportingAnnotation(EclipseLinkJPA.CONVERT);
- assertEquals("myConverter", convert.getValue());
-
- convert.setValue("Bar");
- assertEquals("Bar", convert.getValue());
-
- assertSourceContains("@Convert(value=\"Bar\")", cu);
- }
-
- public void testSetValueNull() throws Exception {
- ICompilationUnit cu = this.createTestConverterWithValue();
- JavaResourcePersistentType typeResource = buildJavaTypeResource(cu);
- JavaResourcePersistentAttribute attributeResource = typeResource.fields().next();
-
- ConvertAnnotation convert = (ConvertAnnotation) attributeResource.getSupportingAnnotation(EclipseLinkJPA.CONVERT);
- assertEquals("myConverter", convert.getValue());
-
- convert.setValue(null);
- assertNull(convert.getValue());
-
- assertSourceContains("@Convert", cu);
- assertSourceDoesNotContain("value", cu);
- }
-
-}
diff --git a/jpa/tests/org.eclipse.jpt.eclipselink.core.tests/src/org/eclipse/jpt/eclipselink/core/tests/internal/resource/java/ConverterAnnotationTests.java b/jpa/tests/org.eclipse.jpt.eclipselink.core.tests/src/org/eclipse/jpt/eclipselink/core/tests/internal/resource/java/ConverterAnnotationTests.java
deleted file mode 100644
index 4231243ba0..0000000000
--- a/jpa/tests/org.eclipse.jpt.eclipselink.core.tests/src/org/eclipse/jpt/eclipselink/core/tests/internal/resource/java/ConverterAnnotationTests.java
+++ /dev/null
@@ -1,155 +0,0 @@
-/*******************************************************************************
- * Copyright (c) 2008 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.
- *
- * Contributors:
- * Oracle - initial API and implementation
- ******************************************************************************/
-package org.eclipse.jpt.eclipselink.core.tests.internal.resource.java;
-
-import java.util.Iterator;
-import org.eclipse.jdt.core.ICompilationUnit;
-import org.eclipse.jpt.core.resource.java.JavaResourcePersistentAttribute;
-import org.eclipse.jpt.core.resource.java.JavaResourcePersistentType;
-import org.eclipse.jpt.eclipselink.core.resource.java.ConverterAnnotation;
-import org.eclipse.jpt.eclipselink.core.resource.java.EclipseLinkJPA;
-import org.eclipse.jpt.utility.internal.iterators.ArrayIterator;
-
-@SuppressWarnings("nls")
-public class ConverterAnnotationTests extends EclipseLinkJavaResourceModelTestCase {
-
- public ConverterAnnotationTests(String name) {
- super(name);
- }
-
- private ICompilationUnit createTestConverter() throws Exception {
- return this.createTestType(new DefaultAnnotationWriter() {
- @Override
- public Iterator<String> imports() {
- return new ArrayIterator<String>(EclipseLinkJPA.CONVERTER);
- }
- @Override
- public void appendIdFieldAnnotationTo(StringBuilder sb) {
- sb.append("@Converter");
- }
- });
- }
-
- private ICompilationUnit createTestConverterWithConverterClass() throws Exception {
- return this.createTestType(new DefaultAnnotationWriter() {
- @Override
- public Iterator<String> imports() {
- return new ArrayIterator<String>(EclipseLinkJPA.CONVERTER);
- }
- @Override
- public void appendIdFieldAnnotationTo(StringBuilder sb) {
- sb.append("@Converter(converterClass=Foo.class)");
- }
- });
- }
-
- private ICompilationUnit createTestConverterWithName() throws Exception {
- return this.createTestType(new DefaultAnnotationWriter() {
- @Override
- public Iterator<String> imports() {
- return new ArrayIterator<String>(EclipseLinkJPA.CONVERTER);
- }
- @Override
- public void appendIdFieldAnnotationTo(StringBuilder sb) {
- sb.append("@Converter(name=\"bar\")");
- }
- });
- }
-
- public void testConverterAnnotation() throws Exception {
- ICompilationUnit cu = this.createTestConverter();
- JavaResourcePersistentType typeResource = buildJavaTypeResource(cu);
- JavaResourcePersistentAttribute attributeResource = typeResource.fields().next();
-
- assertNotNull(attributeResource.getSupportingAnnotation(EclipseLinkJPA.CONVERTER));
-
- attributeResource.removeSupportingAnnotation(EclipseLinkJPA.CONVERTER);
- assertNull(attributeResource.getSupportingAnnotation(EclipseLinkJPA.CONVERTER));
-
- attributeResource.addSupportingAnnotation(EclipseLinkJPA.CONVERTER);
- assertNotNull(attributeResource.getSupportingAnnotation(EclipseLinkJPA.CONVERTER));
- }
-
- public void testGetConverterClass() throws Exception {
- ICompilationUnit cu = this.createTestConverterWithConverterClass();
- JavaResourcePersistentType typeResource = buildJavaTypeResource(cu);
- JavaResourcePersistentAttribute attributeResource = typeResource.fields().next();
-
- ConverterAnnotation converter = (ConverterAnnotation) attributeResource.getSupportingAnnotation(EclipseLinkJPA.CONVERTER);
- assertEquals("Foo", converter.getConverterClass());
- }
-
- public void testSetConverterClass() throws Exception {
- ICompilationUnit cu = this.createTestConverterWithConverterClass();
- JavaResourcePersistentType typeResource = buildJavaTypeResource(cu);
- JavaResourcePersistentAttribute attributeResource = typeResource.fields().next();
-
- ConverterAnnotation converter = (ConverterAnnotation) attributeResource.getSupportingAnnotation(EclipseLinkJPA.CONVERTER);
- assertEquals("Foo", converter.getConverterClass());
-
- converter.setConverterClass("Bar");
- assertEquals("Bar", converter.getConverterClass());
-
- assertSourceContains("@Converter(converterClass=Bar.class)", cu);
- }
-
- public void testSetConverterClassNull() throws Exception {
- ICompilationUnit cu = this.createTestConverterWithConverterClass();
- JavaResourcePersistentType typeResource = buildJavaTypeResource(cu);
- JavaResourcePersistentAttribute attributeResource = typeResource.fields().next();
-
- ConverterAnnotation converter = (ConverterAnnotation) attributeResource.getSupportingAnnotation(EclipseLinkJPA.CONVERTER);
- assertEquals("Foo", converter.getConverterClass());
-
- converter.setConverterClass(null);
- assertNull(converter.getConverterClass());
-
- assertSourceContains("@Converter", cu);
- assertSourceDoesNotContain("converterClass", cu);
- }
-
- public void testGetName() throws Exception {
- ICompilationUnit cu = this.createTestConverterWithName();
- JavaResourcePersistentType typeResource = buildJavaTypeResource(cu);
- JavaResourcePersistentAttribute attributeResource = typeResource.fields().next();
-
- ConverterAnnotation converter = (ConverterAnnotation) attributeResource.getSupportingAnnotation(EclipseLinkJPA.CONVERTER);
- assertEquals("bar", converter.getName());
- }
-
- public void testSetName() throws Exception {
- ICompilationUnit cu = this.createTestConverterWithName();
- JavaResourcePersistentType typeResource = buildJavaTypeResource(cu);
- JavaResourcePersistentAttribute attributeResource = typeResource.fields().next();
-
- ConverterAnnotation converter = (ConverterAnnotation) attributeResource.getSupportingAnnotation(EclipseLinkJPA.CONVERTER);
- assertEquals("bar", converter.getName());
-
- converter.setName("foo");
- assertEquals("foo", converter.getName());
-
- assertSourceContains("@Converter(name=\"foo\")", cu);
- }
-
- public void testSetNameNull() throws Exception {
- ICompilationUnit cu = this.createTestConverterWithName();
- JavaResourcePersistentType typeResource = buildJavaTypeResource(cu);
- JavaResourcePersistentAttribute attributeResource = typeResource.fields().next();
-
- ConverterAnnotation converter = (ConverterAnnotation) attributeResource.getSupportingAnnotation(EclipseLinkJPA.CONVERTER);
- assertEquals("bar", converter.getName());
-
- converter.setName(null);
- assertNull(converter.getName());
-
- assertSourceContains("@Converter", cu);
- assertSourceDoesNotContain("name=", cu);
- }
-}
diff --git a/jpa/tests/org.eclipse.jpt.eclipselink.core.tests/src/org/eclipse/jpt/eclipselink/core/tests/internal/resource/java/CustomizerAnnotationTests.java b/jpa/tests/org.eclipse.jpt.eclipselink.core.tests/src/org/eclipse/jpt/eclipselink/core/tests/internal/resource/java/CustomizerAnnotationTests.java
deleted file mode 100644
index 82d4eeb534..0000000000
--- a/jpa/tests/org.eclipse.jpt.eclipselink.core.tests/src/org/eclipse/jpt/eclipselink/core/tests/internal/resource/java/CustomizerAnnotationTests.java
+++ /dev/null
@@ -1,99 +0,0 @@
-/*******************************************************************************
- * Copyright (c) 2008 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.
- *
- * Contributors:
- * Oracle - initial API and implementation
- ******************************************************************************/
-package org.eclipse.jpt.eclipselink.core.tests.internal.resource.java;
-
-import java.util.Iterator;
-import org.eclipse.jdt.core.ICompilationUnit;
-import org.eclipse.jpt.core.resource.java.JavaResourcePersistentType;
-import org.eclipse.jpt.eclipselink.core.resource.java.CustomizerAnnotation;
-import org.eclipse.jpt.eclipselink.core.resource.java.EclipseLinkJPA;
-import org.eclipse.jpt.utility.internal.iterators.ArrayIterator;
-
-@SuppressWarnings("nls")
-public class CustomizerAnnotationTests extends EclipseLinkJavaResourceModelTestCase {
-
- public CustomizerAnnotationTests(String name) {
- super(name);
- }
-
- private ICompilationUnit createTestCustomizer() throws Exception {
- return this.createTestType(new DefaultAnnotationWriter() {
- @Override
- public Iterator<String> imports() {
- return new ArrayIterator<String>(EclipseLinkJPA.CUSTOMIZER);
- }
- @Override
- public void appendTypeAnnotationTo(StringBuilder sb) {
- sb.append("@Customizer");
- }
- });
- }
-
- private ICompilationUnit createTestCustomizerWithValue() throws Exception {
- return this.createTestType(new DefaultAnnotationWriter() {
- @Override
- public Iterator<String> imports() {
- return new ArrayIterator<String>(EclipseLinkJPA.CUSTOMIZER);
- }
- @Override
- public void appendTypeAnnotationTo(StringBuilder sb) {
- sb.append("@Customizer(Foo.class)");
- }
- });
- }
-
- public void testCustomizerAnnotation() throws Exception {
- ICompilationUnit cu = this.createTestCustomizer();
- JavaResourcePersistentType typeResource = buildJavaTypeResource(cu);
-
- assertNotNull(typeResource.getSupportingAnnotation(EclipseLinkJPA.CUSTOMIZER));
-
- typeResource.removeSupportingAnnotation(EclipseLinkJPA.CUSTOMIZER);
- assertNull(typeResource.getSupportingAnnotation(EclipseLinkJPA.CUSTOMIZER));
-
- typeResource.addSupportingAnnotation(EclipseLinkJPA.CUSTOMIZER);
- assertNotNull(typeResource.getSupportingAnnotation(EclipseLinkJPA.CUSTOMIZER));
- }
-
- public void testGetConverterClass() throws Exception {
- ICompilationUnit cu = this.createTestCustomizerWithValue();
- JavaResourcePersistentType typeResource = buildJavaTypeResource(cu);
-
- CustomizerAnnotation converter = (CustomizerAnnotation) typeResource.getSupportingAnnotation(EclipseLinkJPA.CUSTOMIZER);
- assertEquals("Foo", converter.getValue());
- }
-
- public void testSetConverterClass() throws Exception {
- ICompilationUnit cu = this.createTestCustomizerWithValue();
- JavaResourcePersistentType typeResource = buildJavaTypeResource(cu);
-
- CustomizerAnnotation converter = (CustomizerAnnotation) typeResource.getSupportingAnnotation(EclipseLinkJPA.CUSTOMIZER);
- assertEquals("Foo", converter.getValue());
-
- converter.setValue("Bar");
- assertEquals("Bar", converter.getValue());
-
- assertSourceContains("@Customizer(Bar.class)", cu);
- }
-
- public void testSetConverterClassNull() throws Exception {
- ICompilationUnit cu = this.createTestCustomizerWithValue();
- JavaResourcePersistentType typeResource = buildJavaTypeResource(cu);
-
- CustomizerAnnotation converter = (CustomizerAnnotation) typeResource.getSupportingAnnotation(EclipseLinkJPA.CUSTOMIZER);
- assertEquals("Foo", converter.getValue());
-
- converter.setValue(null);
- assertNull(converter.getValue());
-
- assertSourceContains("@Customizer", cu);
- assertSourceDoesNotContain("Foo.class", cu);
- }
-}
diff --git a/jpa/tests/org.eclipse.jpt.eclipselink.core.tests/src/org/eclipse/jpt/eclipselink/core/tests/internal/resource/java/EclipseLinkJavaResourceModelTestCase.java b/jpa/tests/org.eclipse.jpt.eclipselink.core.tests/src/org/eclipse/jpt/eclipselink/core/tests/internal/resource/java/EclipseLinkJavaResourceModelTestCase.java
deleted file mode 100644
index 2f7a9d0318..0000000000
--- a/jpa/tests/org.eclipse.jpt.eclipselink.core.tests/src/org/eclipse/jpt/eclipselink/core/tests/internal/resource/java/EclipseLinkJavaResourceModelTestCase.java
+++ /dev/null
@@ -1,34 +0,0 @@
-/*******************************************************************************
- * Copyright (c) 2007, 2009 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.
- *
- * Contributors:
- * Oracle - initial API and implementation
- ******************************************************************************/
-package org.eclipse.jpt.eclipselink.core.tests.internal.resource.java;
-
-import org.eclipse.jpt.core.JpaAnnotationProvider;
-import org.eclipse.jpt.core.internal.platform.GenericJpaAnnotationDefinitionProvider;
-import org.eclipse.jpt.core.internal.platform.GenericJpaAnnotationProvider;
-import org.eclipse.jpt.core.tests.internal.resource.java.JavaResourceModelTestCase;
-import org.eclipse.jpt.eclipselink.core.internal.EclipseLinkJpaAnnotationDefinitionProvider;
-
-public class EclipseLinkJavaResourceModelTestCase extends JavaResourceModelTestCase
-{
-
- public static final String ECLIPSELINK_ANNOTATIONS_PACKAGE_NAME = "org.eclipse.persistence.annotations"; //$NON-NLS-1$
-
- public EclipseLinkJavaResourceModelTestCase(String name) {
- super(name);
- }
-
- @Override
- protected JpaAnnotationProvider buildAnnotationProvider() {
- return new GenericJpaAnnotationProvider(
- GenericJpaAnnotationDefinitionProvider.instance(),
- EclipseLinkJpaAnnotationDefinitionProvider.instance());
- }
-
-}
diff --git a/jpa/tests/org.eclipse.jpt.eclipselink.core.tests/src/org/eclipse/jpt/eclipselink/core/tests/internal/resource/java/ExistenceCheckingTests.java b/jpa/tests/org.eclipse.jpt.eclipselink.core.tests/src/org/eclipse/jpt/eclipselink/core/tests/internal/resource/java/ExistenceCheckingTests.java
deleted file mode 100644
index 0cb22601f9..0000000000
--- a/jpa/tests/org.eclipse.jpt.eclipselink.core.tests/src/org/eclipse/jpt/eclipselink/core/tests/internal/resource/java/ExistenceCheckingTests.java
+++ /dev/null
@@ -1,88 +0,0 @@
-/*******************************************************************************
- * Copyright (c) 2007, 2008 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.
- *
- * Contributors:
- * Oracle - initial API and implementation
- ******************************************************************************/
-package org.eclipse.jpt.eclipselink.core.tests.internal.resource.java;
-
-import java.util.Iterator;
-import org.eclipse.jdt.core.ICompilationUnit;
-import org.eclipse.jpt.core.resource.java.JavaResourcePersistentType;
-import org.eclipse.jpt.eclipselink.core.resource.java.EclipseLinkJPA;
-import org.eclipse.jpt.eclipselink.core.resource.java.ExistenceCheckingAnnotation;
-import org.eclipse.jpt.eclipselink.core.resource.java.ExistenceType;
-import org.eclipse.jpt.utility.internal.iterators.ArrayIterator;
-
-@SuppressWarnings("nls")
-public class ExistenceCheckingTests extends EclipseLinkJavaResourceModelTestCase {
-
- public ExistenceCheckingTests(String name) {
- super(name);
- }
-
- private ICompilationUnit createTestExistenceChecking() throws Exception {
- return this.createTestType(new DefaultAnnotationWriter() {
- @Override
- public Iterator<String> imports() {
- return new ArrayIterator<String>(EclipseLinkJPA.EXISTENCE_CHECKING, EclipseLinkJPA.EXISTENCE_TYPE);
- }
- @Override
- public void appendTypeAnnotationTo(StringBuilder sb) {
- sb.append("@ExistenceChecking");
- }
- });
- }
-
- private ICompilationUnit createTestExistenceCheckingWithValue() throws Exception {
- return this.createTestType(new DefaultAnnotationWriter() {
- @Override
- public Iterator<String> imports() {
- return new ArrayIterator<String>(EclipseLinkJPA.EXISTENCE_CHECKING, EclipseLinkJPA.EXISTENCE_TYPE);
- }
- @Override
- public void appendTypeAnnotationTo(StringBuilder sb) {
- sb.append("@ExistenceChecking(ExistenceType.ASSUME_EXISTENCE)");
- }
- });
- }
-
- public void testExistenceChecking() throws Exception {
- ICompilationUnit cu = this.createTestExistenceChecking();
- JavaResourcePersistentType typeResource = buildJavaTypeResource(cu);
-
- ExistenceCheckingAnnotation existenceChecking = (ExistenceCheckingAnnotation) typeResource.getSupportingAnnotation(EclipseLinkJPA.EXISTENCE_CHECKING);
- assertNotNull(existenceChecking);
- }
-
- public void testGetValue() throws Exception {
- ICompilationUnit cu = this.createTestExistenceCheckingWithValue();
- JavaResourcePersistentType typeResource = buildJavaTypeResource(cu);
-
- ExistenceCheckingAnnotation existenceChecking = (ExistenceCheckingAnnotation) typeResource.getSupportingAnnotation(EclipseLinkJPA.EXISTENCE_CHECKING);
- assertEquals(ExistenceType.ASSUME_EXISTENCE, existenceChecking.getValue());
- }
-
- public void testSetValue() throws Exception {
- ICompilationUnit cu = this.createTestExistenceCheckingWithValue();
- JavaResourcePersistentType typeResource = buildJavaTypeResource(cu);
-
- ExistenceCheckingAnnotation existenceChecking = (ExistenceCheckingAnnotation) typeResource.getSupportingAnnotation(EclipseLinkJPA.EXISTENCE_CHECKING);
- assertEquals(ExistenceType.ASSUME_EXISTENCE, existenceChecking.getValue());
-
- existenceChecking.setValue(ExistenceType.ASSUME_NON_EXISTENCE);
- assertEquals(ExistenceType.ASSUME_NON_EXISTENCE, existenceChecking.getValue());
-
- assertSourceContains("@ExistenceChecking(ASSUME_NON_EXISTENCE)", cu);
-
- existenceChecking.setValue(null);
- assertNull(existenceChecking.getValue());
-
- assertSourceDoesNotContain("(ASSUME_NON_EXISTENCE)", cu);
- assertSourceContains("@ExistenceChecking", cu);
- assertSourceDoesNotContain("@ExistenceChecking(", cu);
- }
-}
diff --git a/jpa/tests/org.eclipse.jpt.eclipselink.core.tests/src/org/eclipse/jpt/eclipselink/core/tests/internal/resource/java/JoinFetchTests.java b/jpa/tests/org.eclipse.jpt.eclipselink.core.tests/src/org/eclipse/jpt/eclipselink/core/tests/internal/resource/java/JoinFetchTests.java
deleted file mode 100644
index 68ab2bc035..0000000000
--- a/jpa/tests/org.eclipse.jpt.eclipselink.core.tests/src/org/eclipse/jpt/eclipselink/core/tests/internal/resource/java/JoinFetchTests.java
+++ /dev/null
@@ -1,92 +0,0 @@
-/*******************************************************************************
- * Copyright (c) 2008 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.
- *
- * Contributors:
- * Oracle - initial API and implementation
- ******************************************************************************/
-package org.eclipse.jpt.eclipselink.core.tests.internal.resource.java;
-
-import java.util.Iterator;
-import org.eclipse.jdt.core.ICompilationUnit;
-import org.eclipse.jpt.core.resource.java.JavaResourcePersistentAttribute;
-import org.eclipse.jpt.core.resource.java.JavaResourcePersistentType;
-import org.eclipse.jpt.eclipselink.core.resource.java.EclipseLinkJPA;
-import org.eclipse.jpt.eclipselink.core.resource.java.JoinFetchAnnotation;
-import org.eclipse.jpt.eclipselink.core.resource.java.JoinFetchType;
-import org.eclipse.jpt.utility.internal.iterators.ArrayIterator;
-
-@SuppressWarnings("nls")
-public class JoinFetchTests extends EclipseLinkJavaResourceModelTestCase {
-
- public JoinFetchTests(String name) {
- super(name);
- }
-
- private ICompilationUnit createTestJoinFetch() throws Exception {
- return this.createTestType(new DefaultAnnotationWriter() {
- @Override
- public Iterator<String> imports() {
- return new ArrayIterator<String>(EclipseLinkJPA.JOIN_FETCH, EclipseLinkJPA.JOIN_FETCH_TYPE);
- }
- @Override
- public void appendIdFieldAnnotationTo(StringBuilder sb) {
- sb.append("@JoinFetch");
- }
- });
- }
-
- private ICompilationUnit createTestJoinFetchWithValue() throws Exception {
- return this.createTestType(new DefaultAnnotationWriter() {
- @Override
- public Iterator<String> imports() {
- return new ArrayIterator<String>(EclipseLinkJPA.JOIN_FETCH, EclipseLinkJPA.JOIN_FETCH_TYPE);
- }
- @Override
- public void appendIdFieldAnnotationTo(StringBuilder sb) {
- sb.append("@JoinFetch(JoinFetchType.OUTER)");
- }
- });
- }
-
- public void testJoinFetch() throws Exception {
- ICompilationUnit cu = this.createTestJoinFetch();
- JavaResourcePersistentType typeResource = buildJavaTypeResource(cu);
- JavaResourcePersistentAttribute attributeResource = typeResource.fields().next();
-
- JoinFetchAnnotation joinFetch = (JoinFetchAnnotation) attributeResource.getSupportingAnnotation(EclipseLinkJPA.JOIN_FETCH);
- assertNotNull(joinFetch);
- }
-
- public void testGetValue() throws Exception {
- ICompilationUnit cu = this.createTestJoinFetchWithValue();
- JavaResourcePersistentType typeResource = buildJavaTypeResource(cu);
- JavaResourcePersistentAttribute attributeResource = typeResource.fields().next();
-
- JoinFetchAnnotation joinFetch = (JoinFetchAnnotation) attributeResource.getSupportingAnnotation(EclipseLinkJPA.JOIN_FETCH);
- assertEquals(JoinFetchType.OUTER, joinFetch.getValue());
- }
-
- public void testSetValue() throws Exception {
- ICompilationUnit cu = this.createTestJoinFetchWithValue();
- JavaResourcePersistentType typeResource = buildJavaTypeResource(cu);
- JavaResourcePersistentAttribute attributeResource = typeResource.fields().next();
-
- JoinFetchAnnotation joinFetch = (JoinFetchAnnotation) attributeResource.getSupportingAnnotation(EclipseLinkJPA.JOIN_FETCH);
- assertEquals(JoinFetchType.OUTER, joinFetch.getValue());
-
- joinFetch.setValue(JoinFetchType.INNER);
- assertEquals(JoinFetchType.INNER, joinFetch.getValue());
-
- assertSourceContains("@JoinFetch(INNER)", cu);
-
- joinFetch.setValue(null);
- assertNull(joinFetch.getValue());
-
- assertSourceDoesNotContain("(INNER)", cu);
- assertSourceContains("@JoinFetch", cu);
- assertSourceDoesNotContain("@JoinFetch(", cu);
- }
-}
diff --git a/jpa/tests/org.eclipse.jpt.eclipselink.core.tests/src/org/eclipse/jpt/eclipselink/core/tests/internal/resource/java/JptEclipseLinkCoreJavaResourceModelTests.java b/jpa/tests/org.eclipse.jpt.eclipselink.core.tests/src/org/eclipse/jpt/eclipselink/core/tests/internal/resource/java/JptEclipseLinkCoreJavaResourceModelTests.java
deleted file mode 100644
index dd33147cd2..0000000000
--- a/jpa/tests/org.eclipse.jpt.eclipselink.core.tests/src/org/eclipse/jpt/eclipselink/core/tests/internal/resource/java/JptEclipseLinkCoreJavaResourceModelTests.java
+++ /dev/null
@@ -1,50 +0,0 @@
-/*******************************************************************************
- * Copyright (c) 2007, 2009 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.
- *
- * Contributors:
- * Oracle - initial API and implementation
- ******************************************************************************/
-package org.eclipse.jpt.eclipselink.core.tests.internal.resource.java;
-
-import junit.framework.Test;
-import junit.framework.TestSuite;
-
-public class JptEclipseLinkCoreJavaResourceModelTests {
-
- public static Test suite() {
- return suite(true);
- }
-
- public static Test suite(boolean all) {
- TestSuite suite = new TestSuite(JptEclipseLinkCoreJavaResourceModelTests.class.getName());
- suite.addTestSuite(CacheTests.class);
- suite.addTestSuite(ChangeTrackingTests.class);
- suite.addTestSuite(ConversionValueAnnotationTests.class);
- suite.addTestSuite(ConvertAnnotationTests.class);
- suite.addTestSuite(ConverterAnnotationTests.class);
- suite.addTestSuite(CustomizerAnnotationTests.class);
- suite.addTestSuite(ExistenceCheckingTests.class);
- suite.addTestSuite(JoinFetchTests.class);
- suite.addTestSuite(MutableAnnotationTests.class);
- suite.addTestSuite(ObjectTypeConverterAnnotationTests.class);
- suite.addTestSuite(PrivateOwnedTests.class);
- suite.addTestSuite(ReadOnlyTests.class);
- suite.addTestSuite(ReadTransformerAnnotationTests.class);
- suite.addTestSuite(StructConverterAnnotationTests.class);
- suite.addTestSuite(TimeOfDayTests.class);
- suite.addTestSuite(TransformationAnnotationTests.class);
- suite.addTestSuite(TypeConverterAnnotationTests.class);
- suite.addTestSuite(WriteTransformerAnnotationTests.class);
-
- return suite;
- }
-
- private JptEclipseLinkCoreJavaResourceModelTests() {
- super();
- throw new UnsupportedOperationException();
- }
-
-}
diff --git a/jpa/tests/org.eclipse.jpt.eclipselink.core.tests/src/org/eclipse/jpt/eclipselink/core/tests/internal/resource/java/MutableAnnotationTests.java b/jpa/tests/org.eclipse.jpt.eclipselink.core.tests/src/org/eclipse/jpt/eclipselink/core/tests/internal/resource/java/MutableAnnotationTests.java
deleted file mode 100644
index eca671042f..0000000000
--- a/jpa/tests/org.eclipse.jpt.eclipselink.core.tests/src/org/eclipse/jpt/eclipselink/core/tests/internal/resource/java/MutableAnnotationTests.java
+++ /dev/null
@@ -1,111 +0,0 @@
-/*******************************************************************************
- * Copyright (c) 2008 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.
- *
- * Contributors:
- * Oracle - initial API and implementation
- ******************************************************************************/
-package org.eclipse.jpt.eclipselink.core.tests.internal.resource.java;
-
-import java.util.Iterator;
-import org.eclipse.jdt.core.ICompilationUnit;
-import org.eclipse.jpt.core.resource.java.JavaResourcePersistentAttribute;
-import org.eclipse.jpt.core.resource.java.JavaResourcePersistentType;
-import org.eclipse.jpt.eclipselink.core.resource.java.EclipseLinkJPA;
-import org.eclipse.jpt.eclipselink.core.resource.java.MutableAnnotation;
-import org.eclipse.jpt.utility.internal.iterators.ArrayIterator;
-
-@SuppressWarnings("nls")
-public class MutableAnnotationTests extends EclipseLinkJavaResourceModelTestCase {
-
- public MutableAnnotationTests(String name) {
- super(name);
- }
-
- private ICompilationUnit createTestMutable() throws Exception {
- return this.createTestType(new DefaultAnnotationWriter() {
- @Override
- public Iterator<String> imports() {
- return new ArrayIterator<String>(EclipseLinkJPA.MUTABLE);
- }
- @Override
- public void appendIdFieldAnnotationTo(StringBuilder sb) {
- sb.append("@Mutable");
- }
- });
- }
-
- private ICompilationUnit createTestMutableWithValue() throws Exception {
- return this.createTestType(new DefaultAnnotationWriter() {
- @Override
- public Iterator<String> imports() {
- return new ArrayIterator<String>(EclipseLinkJPA.MUTABLE);
- }
- @Override
- public void appendIdFieldAnnotationTo(StringBuilder sb) {
- sb.append("@Mutable(value=true)");
- }
- });
- }
-
-
-
- public void testMutableAnnotation() throws Exception {
- ICompilationUnit cu = this.createTestMutable();
- JavaResourcePersistentType typeResource = buildJavaTypeResource(cu);
- JavaResourcePersistentAttribute attributeResource = typeResource.fields().next();
-
- assertNotNull(attributeResource.getSupportingAnnotation(EclipseLinkJPA.MUTABLE));
-
- attributeResource.removeSupportingAnnotation(EclipseLinkJPA.MUTABLE);
- assertNull(attributeResource.getSupportingAnnotation(EclipseLinkJPA.MUTABLE));
-
- attributeResource.addSupportingAnnotation(EclipseLinkJPA.MUTABLE);
- assertNotNull(attributeResource.getSupportingAnnotation(EclipseLinkJPA.MUTABLE));
- }
-
- public void testGetValue() throws Exception {
- ICompilationUnit cu = this.createTestMutableWithValue();
- JavaResourcePersistentType typeResource = buildJavaTypeResource(cu);
- JavaResourcePersistentAttribute attributeResource = typeResource.fields().next();
-
- MutableAnnotation mutableAnnotation = (MutableAnnotation) attributeResource.getSupportingAnnotation(EclipseLinkJPA.MUTABLE);
- assertEquals(Boolean.TRUE, mutableAnnotation.getValue());
- }
-
- public void testSetValue() throws Exception {
- ICompilationUnit cu = this.createTestMutableWithValue();
- JavaResourcePersistentType typeResource = buildJavaTypeResource(cu);
- JavaResourcePersistentAttribute attributeResource = typeResource.fields().next();
-
- MutableAnnotation mutableAnnotation = (MutableAnnotation) attributeResource.getSupportingAnnotation(EclipseLinkJPA.MUTABLE);
- assertEquals(Boolean.TRUE, mutableAnnotation.getValue());
-
- mutableAnnotation.setValue(Boolean.FALSE);
- assertEquals(Boolean.FALSE, mutableAnnotation.getValue());
-
- assertSourceContains("@Mutable(value=false)", cu);
-
- mutableAnnotation.setValue(null);
- mutableAnnotation.setValue(Boolean.FALSE);
- assertSourceContains("@Mutable(false)", cu);
- }
-
- public void testSetValueNull() throws Exception {
- ICompilationUnit cu = this.createTestMutableWithValue();
- JavaResourcePersistentType typeResource = buildJavaTypeResource(cu);
- JavaResourcePersistentAttribute attributeResource = typeResource.fields().next();
-
- MutableAnnotation mutableAnnotation = (MutableAnnotation) attributeResource.getSupportingAnnotation(EclipseLinkJPA.MUTABLE);
- assertEquals(Boolean.TRUE, mutableAnnotation.getValue());
-
- mutableAnnotation.setValue(null);
- assertNull(mutableAnnotation.getValue());
-
- assertSourceContains("@Mutable", cu);
- assertSourceDoesNotContain("value", cu);
- }
-
-}
diff --git a/jpa/tests/org.eclipse.jpt.eclipselink.core.tests/src/org/eclipse/jpt/eclipselink/core/tests/internal/resource/java/ObjectTypeConverterAnnotationTests.java b/jpa/tests/org.eclipse.jpt.eclipselink.core.tests/src/org/eclipse/jpt/eclipselink/core/tests/internal/resource/java/ObjectTypeConverterAnnotationTests.java
deleted file mode 100644
index 1bed450ad5..0000000000
--- a/jpa/tests/org.eclipse.jpt.eclipselink.core.tests/src/org/eclipse/jpt/eclipselink/core/tests/internal/resource/java/ObjectTypeConverterAnnotationTests.java
+++ /dev/null
@@ -1,426 +0,0 @@
-/*******************************************************************************
- * Copyright (c) 2008, 2009 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.
- *
- * Contributors:
- * Oracle - initial API and implementation
- ******************************************************************************/
-package org.eclipse.jpt.eclipselink.core.tests.internal.resource.java;
-
-import java.util.Iterator;
-import java.util.ListIterator;
-import org.eclipse.jdt.core.ICompilationUnit;
-import org.eclipse.jpt.core.resource.java.JavaResourcePersistentAttribute;
-import org.eclipse.jpt.core.resource.java.JavaResourcePersistentType;
-import org.eclipse.jpt.eclipselink.core.resource.java.ConversionValueAnnotation;
-import org.eclipse.jpt.eclipselink.core.resource.java.EclipseLinkJPA;
-import org.eclipse.jpt.eclipselink.core.resource.java.ObjectTypeConverterAnnotation;
-import org.eclipse.jpt.utility.internal.iterators.ArrayIterator;
-
-@SuppressWarnings("nls")
-public class ObjectTypeConverterAnnotationTests extends EclipseLinkJavaResourceModelTestCase {
-
- public ObjectTypeConverterAnnotationTests(String name) {
- super(name);
- }
-
- private ICompilationUnit createTestObjectTypeConverter() throws Exception {
- return this.createTestType(new DefaultAnnotationWriter() {
- @Override
- public Iterator<String> imports() {
- return new ArrayIterator<String>(EclipseLinkJPA.OBJECT_TYPE_CONVERTER);
- }
- @Override
- public void appendIdFieldAnnotationTo(StringBuilder sb) {
- sb.append("@ObjectTypeConverter");
- }
- });
- }
-
- private ICompilationUnit createTestObjectTypeConverterWithDataType() throws Exception {
- return this.createTestType(new DefaultAnnotationWriter() {
- @Override
- public Iterator<String> imports() {
- return new ArrayIterator<String>(EclipseLinkJPA.OBJECT_TYPE_CONVERTER);
- }
- @Override
- public void appendIdFieldAnnotationTo(StringBuilder sb) {
- sb.append("@ObjectTypeConverter(dataType=Foo.class)");
- }
- });
- }
-
- private ICompilationUnit createTestObjectTypeConverterWithObjectType() throws Exception {
- return this.createTestType(new DefaultAnnotationWriter() {
- @Override
- public Iterator<String> imports() {
- return new ArrayIterator<String>(EclipseLinkJPA.OBJECT_TYPE_CONVERTER);
- }
- @Override
- public void appendIdFieldAnnotationTo(StringBuilder sb) {
- sb.append("@ObjectTypeConverter(objectType=Foo.class)");
- }
- });
- }
-
- private ICompilationUnit createTestObjectTypeConverterWithName() throws Exception {
- return this.createTestType(new DefaultAnnotationWriter() {
- @Override
- public Iterator<String> imports() {
- return new ArrayIterator<String>(EclipseLinkJPA.OBJECT_TYPE_CONVERTER);
- }
- @Override
- public void appendIdFieldAnnotationTo(StringBuilder sb) {
- sb.append("@ObjectTypeConverter(name = \"bar\")");
- }
- });
- }
-
- private ICompilationUnit createTestObjectTypeConverterWithDefaultObjectValue() throws Exception {
- return this.createTestType(new DefaultAnnotationWriter() {
- @Override
- public Iterator<String> imports() {
- return new ArrayIterator<String>(EclipseLinkJPA.OBJECT_TYPE_CONVERTER);
- }
- @Override
- public void appendIdFieldAnnotationTo(StringBuilder sb) {
- sb.append("@ObjectTypeConverter(defaultObjectValue = \"f\")");
- }
- });
- }
-
- private ICompilationUnit createTestObjectTypeConverterWithConversionValues() throws Exception {
- return this.createTestType(new DefaultAnnotationWriter() {
- @Override
- public Iterator<String> imports() {
- return new ArrayIterator<String>(EclipseLinkJPA.OBJECT_TYPE_CONVERTER, EclipseLinkJPA.CONVERSION_VALUE);
- }
- @Override
- public void appendIdFieldAnnotationTo(StringBuilder sb) {
- sb.append("@ObjectTypeConverter(conversionValues = {@ConversionValue(dataValue = \"F\", objectValue = \"Female\"), @ConversionValue(dataValue = \"M\", objectValue = \"Male\")})");
- }
- });
- }
-
- public void testObjectTypeConverterAnnotation() throws Exception {
- ICompilationUnit cu = this.createTestObjectTypeConverter();
- JavaResourcePersistentType typeResource = buildJavaTypeResource(cu);
- JavaResourcePersistentAttribute attributeResource = typeResource.fields().next();
-
- assertNotNull(attributeResource.getSupportingAnnotation(EclipseLinkJPA.OBJECT_TYPE_CONVERTER));
-
- attributeResource.removeSupportingAnnotation(EclipseLinkJPA.OBJECT_TYPE_CONVERTER);
- assertNull(attributeResource.getSupportingAnnotation(EclipseLinkJPA.OBJECT_TYPE_CONVERTER));
-
- attributeResource.addSupportingAnnotation(EclipseLinkJPA.OBJECT_TYPE_CONVERTER);
- assertNotNull(attributeResource.getSupportingAnnotation(EclipseLinkJPA.OBJECT_TYPE_CONVERTER));
- }
-
- public void testGetDataType() throws Exception {
- ICompilationUnit cu = this.createTestObjectTypeConverterWithDataType();
- JavaResourcePersistentType typeResource = buildJavaTypeResource(cu);
- JavaResourcePersistentAttribute attributeResource = typeResource.fields().next();
-
- ObjectTypeConverterAnnotation converter = (ObjectTypeConverterAnnotation) attributeResource.getSupportingAnnotation(EclipseLinkJPA.OBJECT_TYPE_CONVERTER);
- assertEquals("Foo", converter.getDataType());
- }
-
- public void testSetDataType() throws Exception {
- ICompilationUnit cu = this.createTestObjectTypeConverterWithDataType();
- JavaResourcePersistentType typeResource = buildJavaTypeResource(cu);
- JavaResourcePersistentAttribute attributeResource = typeResource.fields().next();
-
- ObjectTypeConverterAnnotation converter = (ObjectTypeConverterAnnotation) attributeResource.getSupportingAnnotation(EclipseLinkJPA.OBJECT_TYPE_CONVERTER);
- assertEquals("Foo", converter.getDataType());
-
- converter.setDataType("Bar");
- assertEquals("Bar", converter.getDataType());
-
- assertSourceContains("@ObjectTypeConverter(dataType=Bar.class)", cu);
-
- converter.setDataType("int");
- assertEquals("int", converter.getDataType());
- assertSourceContains("@ObjectTypeConverter(dataType=int.class)", cu);
- }
-
- public void testSetDataTypeNull() throws Exception {
- ICompilationUnit cu = this.createTestObjectTypeConverterWithDataType();
- JavaResourcePersistentType typeResource = buildJavaTypeResource(cu);
- JavaResourcePersistentAttribute attributeResource = typeResource.fields().next();
-
- ObjectTypeConverterAnnotation converter = (ObjectTypeConverterAnnotation) attributeResource.getSupportingAnnotation(EclipseLinkJPA.OBJECT_TYPE_CONVERTER);
- assertEquals("Foo", converter.getDataType());
-
- converter.setDataType(null);
- assertNull(converter.getDataType());
-
- assertSourceContains("@ObjectTypeConverter", cu);
- assertSourceDoesNotContain("dataType", cu);
- }
-
- public void testGetObjectType() throws Exception {
- ICompilationUnit cu = this.createTestObjectTypeConverterWithObjectType();
- JavaResourcePersistentType typeResource = buildJavaTypeResource(cu);
- JavaResourcePersistentAttribute attributeResource = typeResource.fields().next();
-
- ObjectTypeConverterAnnotation converter = (ObjectTypeConverterAnnotation) attributeResource.getSupportingAnnotation(EclipseLinkJPA.OBJECT_TYPE_CONVERTER);
- assertEquals("Foo", converter.getObjectType());
- }
-
- public void testSetObjectType() throws Exception {
- ICompilationUnit cu = this.createTestObjectTypeConverterWithObjectType();
- JavaResourcePersistentType typeResource = buildJavaTypeResource(cu);
- JavaResourcePersistentAttribute attributeResource = typeResource.fields().next();
-
- ObjectTypeConverterAnnotation converter = (ObjectTypeConverterAnnotation) attributeResource.getSupportingAnnotation(EclipseLinkJPA.OBJECT_TYPE_CONVERTER);
- assertEquals("Foo", converter.getObjectType());
-
- converter.setObjectType("Bar");
- assertEquals("Bar", converter.getObjectType());
-
- assertSourceContains("@ObjectTypeConverter(objectType=Bar.class)", cu);
-
- converter.setObjectType("int");
- assertEquals("int", converter.getObjectType());
- assertSourceContains("@ObjectTypeConverter(objectType=int.class)", cu);
- }
-
- public void testSetObjectTypeNull() throws Exception {
- ICompilationUnit cu = this.createTestObjectTypeConverterWithObjectType();
- JavaResourcePersistentType typeResource = buildJavaTypeResource(cu);
- JavaResourcePersistentAttribute attributeResource = typeResource.fields().next();
-
- ObjectTypeConverterAnnotation converter = (ObjectTypeConverterAnnotation) attributeResource.getSupportingAnnotation(EclipseLinkJPA.OBJECT_TYPE_CONVERTER);
- assertEquals("Foo", converter.getObjectType());
-
- converter.setObjectType(null);
- assertNull(converter.getObjectType());
-
- assertSourceContains("@ObjectTypeConverter", cu);
- assertSourceDoesNotContain("objectType", cu);
- }
-
- public void testGetName() throws Exception {
- ICompilationUnit cu = this.createTestObjectTypeConverterWithName();
- JavaResourcePersistentType typeResource = buildJavaTypeResource(cu);
- JavaResourcePersistentAttribute attributeResource = typeResource.fields().next();
-
- ObjectTypeConverterAnnotation converter = (ObjectTypeConverterAnnotation) attributeResource.getSupportingAnnotation(EclipseLinkJPA.OBJECT_TYPE_CONVERTER);
- assertEquals("bar", converter.getName());
- }
-
- public void testSetName() throws Exception {
- ICompilationUnit cu = this.createTestObjectTypeConverterWithName();
- JavaResourcePersistentType typeResource = buildJavaTypeResource(cu);
- JavaResourcePersistentAttribute attributeResource = typeResource.fields().next();
-
- ObjectTypeConverterAnnotation converter = (ObjectTypeConverterAnnotation) attributeResource.getSupportingAnnotation(EclipseLinkJPA.OBJECT_TYPE_CONVERTER);
- assertEquals("bar", converter.getName());
-
- converter.setName("foo");
- assertEquals("foo", converter.getName());
-
- assertSourceContains("@ObjectTypeConverter(name = \"foo\")", cu);
- }
-
- public void testSetNameNull() throws Exception {
- ICompilationUnit cu = this.createTestObjectTypeConverterWithName();
- JavaResourcePersistentType typeResource = buildJavaTypeResource(cu);
- JavaResourcePersistentAttribute attributeResource = typeResource.fields().next();
-
- ObjectTypeConverterAnnotation converter = (ObjectTypeConverterAnnotation) attributeResource.getSupportingAnnotation(EclipseLinkJPA.OBJECT_TYPE_CONVERTER);
- assertEquals("bar", converter.getName());
-
- converter.setName(null);
- assertNull(converter.getName());
-
- assertSourceContains("@ObjectTypeConverter", cu);
- assertSourceDoesNotContain("name=", cu);
- }
-
-
- public void testGetDefaultObjectValue() throws Exception {
- ICompilationUnit cu = this.createTestObjectTypeConverterWithDefaultObjectValue();
- JavaResourcePersistentType typeResource = buildJavaTypeResource(cu);
- JavaResourcePersistentAttribute attributeResource = typeResource.fields().next();
-
- ObjectTypeConverterAnnotation converter = (ObjectTypeConverterAnnotation) attributeResource.getSupportingAnnotation(EclipseLinkJPA.OBJECT_TYPE_CONVERTER);
- assertEquals("f", converter.getDefaultObjectValue());
- }
-
- public void testSetDefaultObjectValue() throws Exception {
- ICompilationUnit cu = this.createTestObjectTypeConverterWithDefaultObjectValue();
- JavaResourcePersistentType typeResource = buildJavaTypeResource(cu);
- JavaResourcePersistentAttribute attributeResource = typeResource.fields().next();
-
- ObjectTypeConverterAnnotation converter = (ObjectTypeConverterAnnotation) attributeResource.getSupportingAnnotation(EclipseLinkJPA.OBJECT_TYPE_CONVERTER);
- assertEquals("f", converter.getDefaultObjectValue());
-
- converter.setDefaultObjectValue("foo");
- assertEquals("foo", converter.getDefaultObjectValue());
-
- assertSourceContains("@ObjectTypeConverter(defaultObjectValue = \"foo\")", cu);
- }
-
- public void testSetDefaultObjectValueNull() throws Exception {
- ICompilationUnit cu = this.createTestObjectTypeConverterWithDefaultObjectValue();
- JavaResourcePersistentType typeResource = buildJavaTypeResource(cu);
- JavaResourcePersistentAttribute attributeResource = typeResource.fields().next();
-
- ObjectTypeConverterAnnotation converter = (ObjectTypeConverterAnnotation) attributeResource.getSupportingAnnotation(EclipseLinkJPA.OBJECT_TYPE_CONVERTER);
- assertEquals("f", converter.getDefaultObjectValue());
-
- converter.setDefaultObjectValue(null);
- assertNull(converter.getDefaultObjectValue());
-
- assertSourceContains("@ObjectTypeConverter", cu);
- assertSourceDoesNotContain("defaultObjectValue", cu);
- }
-
- public void testConversionValues() throws Exception {
- ICompilationUnit cu = this.createTestObjectTypeConverterWithName();
- JavaResourcePersistentType typeResource = buildJavaTypeResource(cu);
- JavaResourcePersistentAttribute attributeResource = typeResource.fields().next();
-
- ObjectTypeConverterAnnotation converter = (ObjectTypeConverterAnnotation) attributeResource.getSupportingAnnotation(EclipseLinkJPA.OBJECT_TYPE_CONVERTER);
-
- assertEquals(0, converter.conversionValuesSize());
- assertFalse(converter.conversionValues().hasNext());
- }
-
- public void testConversionValues2() throws Exception {
- ICompilationUnit cu = this.createTestObjectTypeConverterWithName();
- JavaResourcePersistentType typeResource = buildJavaTypeResource(cu);
- JavaResourcePersistentAttribute attributeResource = typeResource.fields().next();
-
- ObjectTypeConverterAnnotation converter = (ObjectTypeConverterAnnotation) attributeResource.getSupportingAnnotation(EclipseLinkJPA.OBJECT_TYPE_CONVERTER);
-
-
- converter.addConversionValue(0);
- converter.addConversionValue(1);
-
- assertEquals(2, converter.conversionValuesSize());
- ListIterator<ConversionValueAnnotation> conversionValues = converter.conversionValues();
- assertTrue(conversionValues.hasNext());
- assertNotNull(conversionValues.next());
- assertNotNull(conversionValues.next());
- assertFalse(conversionValues.hasNext());
- }
-
- public void testConversionValues3() throws Exception {
- ICompilationUnit cu = this.createTestObjectTypeConverterWithConversionValues();
- JavaResourcePersistentType typeResource = buildJavaTypeResource(cu);
- JavaResourcePersistentAttribute attributeResource = typeResource.fields().next();
-
- ObjectTypeConverterAnnotation converter = (ObjectTypeConverterAnnotation) attributeResource.getSupportingAnnotation(EclipseLinkJPA.OBJECT_TYPE_CONVERTER);
-
- assertEquals(2, converter.conversionValuesSize());
- ListIterator<ConversionValueAnnotation> conversionValues = converter.conversionValues();
- ConversionValueAnnotation conversionValue = conversionValues.next();
- assertEquals("F", conversionValue.getDataValue());
- assertEquals("Female", conversionValue.getObjectValue());
- conversionValue = conversionValues.next();
- assertEquals("M", conversionValue.getDataValue());
- assertEquals("Male", conversionValue.getObjectValue());
- assertFalse(conversionValues.hasNext());
- }
-
- public void testAddConversionValue() throws Exception {
- ICompilationUnit cu = this.createTestObjectTypeConverterWithName();
- JavaResourcePersistentType typeResource = buildJavaTypeResource(cu);
- JavaResourcePersistentAttribute attributeResource = typeResource.fields().next();
-
- ObjectTypeConverterAnnotation converter = (ObjectTypeConverterAnnotation) attributeResource.getSupportingAnnotation(EclipseLinkJPA.OBJECT_TYPE_CONVERTER);
-
- converter.addConversionValue(0).setObjectValue("FOO");
- converter.addConversionValue(1);
- converter.addConversionValue(0).setDataValue("BAR");
-
- assertEquals("BAR", converter.conversionValueAt(0).getDataValue());
- assertNull(converter.conversionValueAt(0).getObjectValue());
- assertEquals("FOO", converter.conversionValueAt(1).getObjectValue());
- assertNull(converter.conversionValueAt(1).getDataValue());
- assertNull(converter.conversionValueAt(2).getDataValue());
- assertNull(converter.conversionValueAt(2).getObjectValue());
-
- assertSourceContains("@ObjectTypeConverter(name = \"bar\", conversionValues = {@ConversionValue(dataValue = \"BAR\"),@ConversionValue(objectValue = \"FOO\"), @ConversionValue})", cu);
- }
-
- public void testRemoveConversionValue() throws Exception {
- ICompilationUnit cu = this.createTestObjectTypeConverterWithConversionValues();
- JavaResourcePersistentType typeResource = buildJavaTypeResource(cu);
- JavaResourcePersistentAttribute attributeResource = typeResource.fields().next();
-
- ObjectTypeConverterAnnotation converter = (ObjectTypeConverterAnnotation) attributeResource.getSupportingAnnotation(EclipseLinkJPA.OBJECT_TYPE_CONVERTER);
- converter.addConversionValue(0).setObjectValue("FOO");
-
- Iterator<ConversionValueAnnotation> conversionValues = converter.conversionValues();
- assertEquals("FOO", conversionValues.next().getObjectValue());
- assertEquals("Female", conversionValues.next().getObjectValue());
- assertEquals("Male", conversionValues.next().getObjectValue());
- assertFalse(conversionValues.hasNext());
- assertSourceContains("@ObjectTypeConverter(conversionValues = {@ConversionValue(objectValue = \"FOO\"), @ConversionValue(dataValue = \"F\", objectValue = \"Female\"), @ConversionValue(dataValue = \"M\", objectValue = \"Male\")})", cu);
-
- converter.removeConversionValue(1);
- conversionValues = converter.conversionValues();
- assertEquals("FOO", conversionValues.next().getObjectValue());
- assertEquals("Male", conversionValues.next().getObjectValue());
- assertFalse(conversionValues.hasNext());
- assertSourceContains("@ObjectTypeConverter(conversionValues = {@ConversionValue(objectValue = \"FOO\"), @ConversionValue(dataValue = \"M\", objectValue = \"Male\")})", cu);
-
- converter.removeConversionValue(0);
- conversionValues = converter.conversionValues();
- assertEquals("Male", conversionValues.next().getObjectValue());
- assertFalse(conversionValues.hasNext());
- assertSourceContains("@ObjectTypeConverter(conversionValues = @ConversionValue(dataValue = \"M\", objectValue = \"Male\"))", cu);
-
-
- converter.removeConversionValue(0);
- assertSourceDoesNotContain("@conversionValues", cu);
- assertSourceContains("@ObjectTypeConverter", cu);
- }
-
- public void testMoveConversionValue() throws Exception {
- ICompilationUnit cu = this.createTestObjectTypeConverterWithConversionValues();
- JavaResourcePersistentType typeResource = buildJavaTypeResource(cu);
- JavaResourcePersistentAttribute attributeResource = typeResource.fields().next();
-
- ObjectTypeConverterAnnotation converter = (ObjectTypeConverterAnnotation) attributeResource.getSupportingAnnotation(EclipseLinkJPA.OBJECT_TYPE_CONVERTER);
- converter.addConversionValue(0).setObjectValue("FOO");
-
- assertSourceContains("@ObjectTypeConverter(conversionValues = {@ConversionValue(objectValue = \"FOO\"), @ConversionValue(dataValue = \"F\", objectValue = \"Female\"), @ConversionValue(dataValue = \"M\", objectValue = \"Male\")})", cu);
-
- converter.moveConversionValue(2, 0);
- assertEquals("Female", converter.conversionValueAt(0).getObjectValue());
- assertEquals("F", converter.conversionValueAt(0).getDataValue());
- assertEquals("Male", converter.conversionValueAt(1).getObjectValue());
- assertEquals("M", converter.conversionValueAt(1).getDataValue());
- assertEquals("FOO", converter.conversionValueAt(2).getObjectValue());
- assertEquals(null, converter.conversionValueAt(2).getDataValue());
- assertEquals(3, converter.conversionValuesSize());
- assertSourceContains("@ObjectTypeConverter(conversionValues = {@ConversionValue(dataValue = \"F\", objectValue = \"Female\"), @ConversionValue(dataValue = \"M\", objectValue = \"Male\"), @ConversionValue(objectValue = \"FOO\")})", cu);
- }
-
- public void testMoveConversionValue2() throws Exception {
- ICompilationUnit cu = this.createTestObjectTypeConverterWithConversionValues();
- JavaResourcePersistentType typeResource = buildJavaTypeResource(cu);
- JavaResourcePersistentAttribute attributeResource = typeResource.fields().next();
-
- ObjectTypeConverterAnnotation converter = (ObjectTypeConverterAnnotation) attributeResource.getSupportingAnnotation(EclipseLinkJPA.OBJECT_TYPE_CONVERTER);
- converter.addConversionValue(0).setObjectValue("FOO");
-
- assertSourceContains("@ObjectTypeConverter(conversionValues = {@ConversionValue(objectValue = \"FOO\"), @ConversionValue(dataValue = \"F\", objectValue = \"Female\"), @ConversionValue(dataValue = \"M\", objectValue = \"Male\")})", cu);
-
- converter.moveConversionValue(0, 2);
- assertEquals("Male", converter.conversionValueAt(0).getObjectValue());
- assertEquals("M", converter.conversionValueAt(0).getDataValue());
- assertEquals("FOO", converter.conversionValueAt(1).getObjectValue());
- assertEquals(null, converter.conversionValueAt(1).getDataValue());
- assertEquals("Female", converter.conversionValueAt(2).getObjectValue());
- assertEquals("F", converter.conversionValueAt(2).getDataValue());
- assertEquals(3, converter.conversionValuesSize());
- assertSourceContains("@ObjectTypeConverter(conversionValues = {@ConversionValue(dataValue = \"M\", objectValue = \"Male\"), @ConversionValue(objectValue = \"FOO\"), @ConversionValue(dataValue = \"F\", objectValue = \"Female\")})", cu);
- }
-}
diff --git a/jpa/tests/org.eclipse.jpt.eclipselink.core.tests/src/org/eclipse/jpt/eclipselink/core/tests/internal/resource/java/PrivateOwnedTests.java b/jpa/tests/org.eclipse.jpt.eclipselink.core.tests/src/org/eclipse/jpt/eclipselink/core/tests/internal/resource/java/PrivateOwnedTests.java
deleted file mode 100644
index 15f9ec6b82..0000000000
--- a/jpa/tests/org.eclipse.jpt.eclipselink.core.tests/src/org/eclipse/jpt/eclipselink/core/tests/internal/resource/java/PrivateOwnedTests.java
+++ /dev/null
@@ -1,49 +0,0 @@
-/*******************************************************************************
- * Copyright (c) 2008 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.
- *
- * Contributors:
- * Oracle - initial API and implementation
- ******************************************************************************/
-package org.eclipse.jpt.eclipselink.core.tests.internal.resource.java;
-
-import java.util.Iterator;
-import org.eclipse.jdt.core.ICompilationUnit;
-import org.eclipse.jpt.core.resource.java.JavaResourcePersistentAttribute;
-import org.eclipse.jpt.core.resource.java.JavaResourcePersistentType;
-import org.eclipse.jpt.eclipselink.core.resource.java.EclipseLinkJPA;
-import org.eclipse.jpt.eclipselink.core.resource.java.PrivateOwnedAnnotation;
-import org.eclipse.jpt.utility.internal.iterators.ArrayIterator;
-
-@SuppressWarnings("nls")
-public class PrivateOwnedTests extends EclipseLinkJavaResourceModelTestCase {
-
- public PrivateOwnedTests(String name) {
- super(name);
- }
-
- private ICompilationUnit createTestPrivateOwned() throws Exception {
- return this.createTestType(new DefaultAnnotationWriter() {
- @Override
- public Iterator<String> imports() {
- return new ArrayIterator<String>(EclipseLinkJPA.PRIVATE_OWNED);
- }
- @Override
- public void appendIdFieldAnnotationTo(StringBuilder sb) {
- sb.append("@PrivateOwned");
- }
- });
- }
-
- public void testPrivateOwned() throws Exception {
- ICompilationUnit cu = this.createTestPrivateOwned();
- JavaResourcePersistentType typeResource = buildJavaTypeResource(cu);
- JavaResourcePersistentAttribute attributeResource = typeResource.fields().next();
-
- PrivateOwnedAnnotation privateOwned = (PrivateOwnedAnnotation) attributeResource.getSupportingAnnotation(EclipseLinkJPA.PRIVATE_OWNED);
- assertNotNull(privateOwned);
- }
-
-}
diff --git a/jpa/tests/org.eclipse.jpt.eclipselink.core.tests/src/org/eclipse/jpt/eclipselink/core/tests/internal/resource/java/ReadOnlyTests.java b/jpa/tests/org.eclipse.jpt.eclipselink.core.tests/src/org/eclipse/jpt/eclipselink/core/tests/internal/resource/java/ReadOnlyTests.java
deleted file mode 100644
index 7aca02e9d2..0000000000
--- a/jpa/tests/org.eclipse.jpt.eclipselink.core.tests/src/org/eclipse/jpt/eclipselink/core/tests/internal/resource/java/ReadOnlyTests.java
+++ /dev/null
@@ -1,47 +0,0 @@
-/*******************************************************************************
- * Copyright (c) 2008 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.
- *
- * Contributors:
- * Oracle - initial API and implementation
- ******************************************************************************/
-package org.eclipse.jpt.eclipselink.core.tests.internal.resource.java;
-
-import java.util.Iterator;
-import org.eclipse.jdt.core.ICompilationUnit;
-import org.eclipse.jpt.core.resource.java.JavaResourcePersistentType;
-import org.eclipse.jpt.eclipselink.core.resource.java.EclipseLinkJPA;
-import org.eclipse.jpt.eclipselink.core.resource.java.ReadOnlyAnnotation;
-import org.eclipse.jpt.utility.internal.iterators.ArrayIterator;
-
-@SuppressWarnings("nls")
-public class ReadOnlyTests extends EclipseLinkJavaResourceModelTestCase {
-
- public ReadOnlyTests(String name) {
- super(name);
- }
-
- private ICompilationUnit createTestReadOnly() throws Exception {
- return this.createTestType(new DefaultAnnotationWriter() {
- @Override
- public Iterator<String> imports() {
- return new ArrayIterator<String>(EclipseLinkJPA.READ_ONLY);
- }
- @Override
- public void appendTypeAnnotationTo(StringBuilder sb) {
- sb.append("@ReadOnly");
- }
- });
- }
-
- public void testReadOnly() throws Exception {
- ICompilationUnit cu = this.createTestReadOnly();
- JavaResourcePersistentType typeResource = buildJavaTypeResource(cu);
-
- ReadOnlyAnnotation readOnly = (ReadOnlyAnnotation) typeResource.getSupportingAnnotation(EclipseLinkJPA.READ_ONLY);
- assertNotNull(readOnly);
- }
-
-}
diff --git a/jpa/tests/org.eclipse.jpt.eclipselink.core.tests/src/org/eclipse/jpt/eclipselink/core/tests/internal/resource/java/ReadTransformerAnnotationTests.java b/jpa/tests/org.eclipse.jpt.eclipselink.core.tests/src/org/eclipse/jpt/eclipselink/core/tests/internal/resource/java/ReadTransformerAnnotationTests.java
deleted file mode 100644
index 4e04513cd7..0000000000
--- a/jpa/tests/org.eclipse.jpt.eclipselink.core.tests/src/org/eclipse/jpt/eclipselink/core/tests/internal/resource/java/ReadTransformerAnnotationTests.java
+++ /dev/null
@@ -1,155 +0,0 @@
-/*******************************************************************************
- * Copyright (c) 2008 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.
- *
- * Contributors:
- * Oracle - initial API and implementation
- ******************************************************************************/
-package org.eclipse.jpt.eclipselink.core.tests.internal.resource.java;
-
-import java.util.Iterator;
-import org.eclipse.jdt.core.ICompilationUnit;
-import org.eclipse.jpt.core.resource.java.JavaResourcePersistentAttribute;
-import org.eclipse.jpt.core.resource.java.JavaResourcePersistentType;
-import org.eclipse.jpt.eclipselink.core.resource.java.EclipseLinkJPA;
-import org.eclipse.jpt.eclipselink.core.resource.java.ReadTransformerAnnotation;
-import org.eclipse.jpt.utility.internal.iterators.ArrayIterator;
-
-@SuppressWarnings("nls")
-public class ReadTransformerAnnotationTests extends EclipseLinkJavaResourceModelTestCase {
-
- public ReadTransformerAnnotationTests(String name) {
- super(name);
- }
-
- private ICompilationUnit createTestReadTransformer() throws Exception {
- return this.createTestType(new DefaultAnnotationWriter() {
- @Override
- public Iterator<String> imports() {
- return new ArrayIterator<String>(EclipseLinkJPA.READ_TRANSFORMER);
- }
- @Override
- public void appendIdFieldAnnotationTo(StringBuilder sb) {
- sb.append("@ReadTransformer");
- }
- });
- }
-
- private ICompilationUnit createTestReadTransformerWithTransformerClass() throws Exception {
- return this.createTestType(new DefaultAnnotationWriter() {
- @Override
- public Iterator<String> imports() {
- return new ArrayIterator<String>(EclipseLinkJPA.READ_TRANSFORMER);
- }
- @Override
- public void appendIdFieldAnnotationTo(StringBuilder sb) {
- sb.append("@ReadTransformer(transformerClass=Foo.class)");
- }
- });
- }
-
- private ICompilationUnit createTestReadTransformerWithMethod() throws Exception {
- return this.createTestType(new DefaultAnnotationWriter() {
- @Override
- public Iterator<String> imports() {
- return new ArrayIterator<String>(EclipseLinkJPA.READ_TRANSFORMER);
- }
- @Override
- public void appendIdFieldAnnotationTo(StringBuilder sb) {
- sb.append("@ReadTransformer(method=\"transformerMethod\")");
- }
- });
- }
-
- public void testReadTransformerAnnotation() throws Exception {
- ICompilationUnit cu = this.createTestReadTransformer();
- JavaResourcePersistentType typeResource = buildJavaTypeResource(cu);
- JavaResourcePersistentAttribute attributeResource = typeResource.fields().next();
-
- assertNotNull(attributeResource.getSupportingAnnotation(EclipseLinkJPA.READ_TRANSFORMER));
-
- attributeResource.removeSupportingAnnotation(EclipseLinkJPA.READ_TRANSFORMER) ;
- assertNull(attributeResource.getSupportingAnnotation(EclipseLinkJPA.READ_TRANSFORMER));
-
- attributeResource.addSupportingAnnotation(EclipseLinkJPA.READ_TRANSFORMER);
- assertNotNull(attributeResource.getSupportingAnnotation(EclipseLinkJPA.READ_TRANSFORMER));
- }
-
- public void testGetTransformerClass() throws Exception {
- ICompilationUnit cu = this.createTestReadTransformerWithTransformerClass();
- JavaResourcePersistentType typeResource = buildJavaTypeResource(cu);
- JavaResourcePersistentAttribute attributeResource = typeResource.fields().next();
-
- ReadTransformerAnnotation readTransformer = (ReadTransformerAnnotation) attributeResource.getSupportingAnnotation(EclipseLinkJPA.READ_TRANSFORMER);
- assertEquals("Foo", readTransformer.getTransformerClass());
- }
-
- public void testSetTransformerClass() throws Exception {
- ICompilationUnit cu = this.createTestReadTransformerWithTransformerClass();
- JavaResourcePersistentType typeResource = buildJavaTypeResource(cu);
- JavaResourcePersistentAttribute attributeResource = typeResource.fields().next();
-
- ReadTransformerAnnotation readTransformer = (ReadTransformerAnnotation) attributeResource.getSupportingAnnotation(EclipseLinkJPA.READ_TRANSFORMER);
- assertEquals("Foo", readTransformer.getTransformerClass());
-
- readTransformer.setTransformerClass("Bar");
- assertEquals("Bar", readTransformer.getTransformerClass());
-
- assertSourceContains("@ReadTransformer(transformerClass=Bar.class)", cu);
- }
-
- public void testSetTransformerClassNull() throws Exception {
- ICompilationUnit cu = this.createTestReadTransformerWithTransformerClass();
- JavaResourcePersistentType typeResource = buildJavaTypeResource(cu);
- JavaResourcePersistentAttribute attributeResource = typeResource.fields().next();
-
- ReadTransformerAnnotation readTransformer = (ReadTransformerAnnotation) attributeResource.getSupportingAnnotation(EclipseLinkJPA.READ_TRANSFORMER);
- assertEquals("Foo", readTransformer.getTransformerClass());
-
- readTransformer.setTransformerClass(null);
- assertNull(readTransformer.getTransformerClass());
-
- assertSourceContains("@ReadTransformer", cu);
- assertSourceDoesNotContain("transformerClass", cu);
- }
-
- public void testGetMethod() throws Exception {
- ICompilationUnit cu = this.createTestReadTransformerWithMethod();
- JavaResourcePersistentType typeResource = buildJavaTypeResource(cu);
- JavaResourcePersistentAttribute attributeResource = typeResource.fields().next();
-
- ReadTransformerAnnotation readTransformer = (ReadTransformerAnnotation) attributeResource.getSupportingAnnotation(EclipseLinkJPA.READ_TRANSFORMER);
- assertEquals("transformerMethod", readTransformer.getMethod());
- }
-
- public void testSetMethod() throws Exception {
- ICompilationUnit cu = this.createTestReadTransformerWithMethod();
- JavaResourcePersistentType typeResource = buildJavaTypeResource(cu);
- JavaResourcePersistentAttribute attributeResource = typeResource.fields().next();
-
- ReadTransformerAnnotation readTransformer = (ReadTransformerAnnotation) attributeResource.getSupportingAnnotation(EclipseLinkJPA.READ_TRANSFORMER);
- assertEquals("transformerMethod", readTransformer.getMethod());
-
- readTransformer.setMethod("foo");
- assertEquals("foo", readTransformer.getMethod());
-
- assertSourceContains("@ReadTransformer(method=\"foo\")", cu);
- }
-
- public void testSetMethodNull() throws Exception {
- ICompilationUnit cu = this.createTestReadTransformerWithMethod();
- JavaResourcePersistentType typeResource = buildJavaTypeResource(cu);
- JavaResourcePersistentAttribute attributeResource = typeResource.fields().next();
-
- ReadTransformerAnnotation readTransformer = (ReadTransformerAnnotation) attributeResource.getSupportingAnnotation(EclipseLinkJPA.READ_TRANSFORMER);
- assertEquals("transformerMethod", readTransformer.getMethod());
-
- readTransformer.setMethod(null);
- assertNull(readTransformer.getMethod());
-
- assertSourceContains("@ReadTransformer", cu);
- assertSourceDoesNotContain("method", cu);
- }
-}
diff --git a/jpa/tests/org.eclipse.jpt.eclipselink.core.tests/src/org/eclipse/jpt/eclipselink/core/tests/internal/resource/java/StructConverterAnnotationTests.java b/jpa/tests/org.eclipse.jpt.eclipselink.core.tests/src/org/eclipse/jpt/eclipselink/core/tests/internal/resource/java/StructConverterAnnotationTests.java
deleted file mode 100644
index 7cdb2eeb6c..0000000000
--- a/jpa/tests/org.eclipse.jpt.eclipselink.core.tests/src/org/eclipse/jpt/eclipselink/core/tests/internal/resource/java/StructConverterAnnotationTests.java
+++ /dev/null
@@ -1,155 +0,0 @@
-/*******************************************************************************
- * Copyright (c) 2008 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.
- *
- * Contributors:
- * Oracle - initial API and implementation
- ******************************************************************************/
-package org.eclipse.jpt.eclipselink.core.tests.internal.resource.java;
-
-import java.util.Iterator;
-import org.eclipse.jdt.core.ICompilationUnit;
-import org.eclipse.jpt.core.resource.java.JavaResourcePersistentAttribute;
-import org.eclipse.jpt.core.resource.java.JavaResourcePersistentType;
-import org.eclipse.jpt.eclipselink.core.resource.java.EclipseLinkJPA;
-import org.eclipse.jpt.eclipselink.core.resource.java.StructConverterAnnotation;
-import org.eclipse.jpt.utility.internal.iterators.ArrayIterator;
-
-@SuppressWarnings("nls")
-public class StructConverterAnnotationTests extends EclipseLinkJavaResourceModelTestCase {
-
- public StructConverterAnnotationTests(String name) {
- super(name);
- }
-
- private ICompilationUnit createTestStructConverter() throws Exception {
- return this.createTestType(new DefaultAnnotationWriter() {
- @Override
- public Iterator<String> imports() {
- return new ArrayIterator<String>(EclipseLinkJPA.STRUCT_CONVERTER);
- }
- @Override
- public void appendIdFieldAnnotationTo(StringBuilder sb) {
- sb.append("@StructConverter");
- }
- });
- }
-
- private ICompilationUnit createTestStructConverterWithConverter() throws Exception {
- return this.createTestType(new DefaultAnnotationWriter() {
- @Override
- public Iterator<String> imports() {
- return new ArrayIterator<String>(EclipseLinkJPA.STRUCT_CONVERTER);
- }
- @Override
- public void appendIdFieldAnnotationTo(StringBuilder sb) {
- sb.append("@StructConverter(converter=\"Foo\")");
- }
- });
- }
-
- private ICompilationUnit createTestStructConverterWithName() throws Exception {
- return this.createTestType(new DefaultAnnotationWriter() {
- @Override
- public Iterator<String> imports() {
- return new ArrayIterator<String>(EclipseLinkJPA.STRUCT_CONVERTER);
- }
- @Override
- public void appendIdFieldAnnotationTo(StringBuilder sb) {
- sb.append("@StructConverter(name=\"bar\")");
- }
- });
- }
-
- public void testStructConverterAnnotation() throws Exception {
- ICompilationUnit cu = this.createTestStructConverter();
- JavaResourcePersistentType typeResource = buildJavaTypeResource(cu);
- JavaResourcePersistentAttribute attributeResource = typeResource.fields().next();
-
- assertNotNull(attributeResource.getSupportingAnnotation(EclipseLinkJPA.STRUCT_CONVERTER));
-
- attributeResource.removeSupportingAnnotation(EclipseLinkJPA.STRUCT_CONVERTER);
- assertNull(attributeResource.getSupportingAnnotation(EclipseLinkJPA.STRUCT_CONVERTER));
-
- attributeResource.addSupportingAnnotation(EclipseLinkJPA.STRUCT_CONVERTER);
- assertNotNull(attributeResource.getSupportingAnnotation(EclipseLinkJPA.STRUCT_CONVERTER));
- }
-
- public void testGetConverter() throws Exception {
- ICompilationUnit cu = this.createTestStructConverterWithConverter();
- JavaResourcePersistentType typeResource = buildJavaTypeResource(cu);
- JavaResourcePersistentAttribute attributeResource = typeResource.fields().next();
-
- StructConverterAnnotation converter = (StructConverterAnnotation) attributeResource.getSupportingAnnotation(EclipseLinkJPA.STRUCT_CONVERTER);
- assertEquals("Foo", converter.getConverter());
- }
-
- public void testSetConverter() throws Exception {
- ICompilationUnit cu = this.createTestStructConverterWithConverter();
- JavaResourcePersistentType typeResource = buildJavaTypeResource(cu);
- JavaResourcePersistentAttribute attributeResource = typeResource.fields().next();
-
- StructConverterAnnotation converter = (StructConverterAnnotation) attributeResource.getSupportingAnnotation(EclipseLinkJPA.STRUCT_CONVERTER);
- assertEquals("Foo", converter.getConverter());
-
- converter.setConverter("Bar");
- assertEquals("Bar", converter.getConverter());
-
- assertSourceContains("@StructConverter(converter=\"Bar\")", cu);
- }
-
- public void testSetConverterNull() throws Exception {
- ICompilationUnit cu = this.createTestStructConverterWithConverter();
- JavaResourcePersistentType typeResource = buildJavaTypeResource(cu);
- JavaResourcePersistentAttribute attributeResource = typeResource.fields().next();
-
- StructConverterAnnotation converter = (StructConverterAnnotation) attributeResource.getSupportingAnnotation(EclipseLinkJPA.STRUCT_CONVERTER);
- assertEquals("Foo", converter.getConverter());
-
- converter.setConverter(null);
- assertNull(converter.getConverter());
-
- assertSourceContains("@StructConverter", cu);
- assertSourceDoesNotContain("converter", cu);
- }
-
- public void testGetName() throws Exception {
- ICompilationUnit cu = this.createTestStructConverterWithName();
- JavaResourcePersistentType typeResource = buildJavaTypeResource(cu);
- JavaResourcePersistentAttribute attributeResource = typeResource.fields().next();
-
- StructConverterAnnotation converter = (StructConverterAnnotation) attributeResource.getSupportingAnnotation(EclipseLinkJPA.STRUCT_CONVERTER);
- assertEquals("bar", converter.getName());
- }
-
- public void testSetName() throws Exception {
- ICompilationUnit cu = this.createTestStructConverterWithName();
- JavaResourcePersistentType typeResource = buildJavaTypeResource(cu);
- JavaResourcePersistentAttribute attributeResource = typeResource.fields().next();
-
- StructConverterAnnotation converter = (StructConverterAnnotation) attributeResource.getSupportingAnnotation(EclipseLinkJPA.STRUCT_CONVERTER);
- assertEquals("bar", converter.getName());
-
- converter.setName("foo");
- assertEquals("foo", converter.getName());
-
- assertSourceContains("@StructConverter(name=\"foo\")", cu);
- }
-
- public void testSetNameNull() throws Exception {
- ICompilationUnit cu = this.createTestStructConverterWithName();
- JavaResourcePersistentType typeResource = buildJavaTypeResource(cu);
- JavaResourcePersistentAttribute attributeResource = typeResource.fields().next();
-
- StructConverterAnnotation converter = (StructConverterAnnotation) attributeResource.getSupportingAnnotation(EclipseLinkJPA.STRUCT_CONVERTER);
- assertEquals("bar", converter.getName());
-
- converter.setName(null);
- assertNull(converter.getName());
-
- assertSourceContains("@StructConverter", cu);
- assertSourceDoesNotContain("name=", cu);
- }
-}
diff --git a/jpa/tests/org.eclipse.jpt.eclipselink.core.tests/src/org/eclipse/jpt/eclipselink/core/tests/internal/resource/java/TimeOfDayTests.java b/jpa/tests/org.eclipse.jpt.eclipselink.core.tests/src/org/eclipse/jpt/eclipselink/core/tests/internal/resource/java/TimeOfDayTests.java
deleted file mode 100644
index 1c5697d17d..0000000000
--- a/jpa/tests/org.eclipse.jpt.eclipselink.core.tests/src/org/eclipse/jpt/eclipselink/core/tests/internal/resource/java/TimeOfDayTests.java
+++ /dev/null
@@ -1,220 +0,0 @@
-/*******************************************************************************
- * Copyright (c) 2007, 2008 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.
- *
- * Contributors:
- * Oracle - initial API and implementation
- ******************************************************************************/
-package org.eclipse.jpt.eclipselink.core.tests.internal.resource.java;
-
-import java.util.Iterator;
-import org.eclipse.jdt.core.ICompilationUnit;
-import org.eclipse.jpt.core.resource.java.JavaResourcePersistentType;
-import org.eclipse.jpt.eclipselink.core.resource.java.CacheAnnotation;
-import org.eclipse.jpt.eclipselink.core.resource.java.EclipseLinkJPA;
-import org.eclipse.jpt.eclipselink.core.resource.java.TimeOfDayAnnotation;
-import org.eclipse.jpt.utility.internal.iterators.ArrayIterator;
-
-@SuppressWarnings("nls")
-public class TimeOfDayTests extends EclipseLinkJavaResourceModelTestCase {
-
- public TimeOfDayTests(String name) {
- super(name);
- }
-
- private ICompilationUnit createTestTimeOfDay() throws Exception {
- return this.createTestType(new DefaultAnnotationWriter() {
- @Override
- public Iterator<String> imports() {
- return new ArrayIterator<String>(EclipseLinkJPA.CACHE, EclipseLinkJPA.TIME_OF_DAY);
- }
- @Override
- public void appendTypeAnnotationTo(StringBuilder sb) {
- sb.append("@Cache(expiryTimeOfDay = @TimeOfDay)");
- }
- });
- }
-
- private ICompilationUnit createTestTimeOfDayWithHour() throws Exception {
- return this.createTestType(new DefaultAnnotationWriter() {
- @Override
- public Iterator<String> imports() {
- return new ArrayIterator<String>(EclipseLinkJPA.CACHE, EclipseLinkJPA.TIME_OF_DAY);
- }
- @Override
- public void appendTypeAnnotationTo(StringBuilder sb) {
- sb.append("@Cache(expiryTimeOfDay = @TimeOfDay(hour=5))");
- }
- });
- }
-
- private ICompilationUnit createTestTimeOfDayWithMinute() throws Exception {
- return this.createTestType(new DefaultAnnotationWriter() {
- @Override
- public Iterator<String> imports() {
- return new ArrayIterator<String>(EclipseLinkJPA.CACHE, EclipseLinkJPA.TIME_OF_DAY);
- }
- @Override
- public void appendTypeAnnotationTo(StringBuilder sb) {
- sb.append("@Cache(expiryTimeOfDay = @TimeOfDay(minute=5))");
- }
- });
- }
-
- private ICompilationUnit createTestTimeOfDayWithSecond() throws Exception {
- return this.createTestType(new DefaultAnnotationWriter() {
- @Override
- public Iterator<String> imports() {
- return new ArrayIterator<String>(EclipseLinkJPA.CACHE, EclipseLinkJPA.TIME_OF_DAY);
- }
- @Override
- public void appendTypeAnnotationTo(StringBuilder sb) {
- sb.append("@Cache(expiryTimeOfDay = @TimeOfDay(second=5))");
- }
- });
- }
-
- private ICompilationUnit createTestTimeOfDayWithMillisecond() throws Exception {
- return this.createTestType(new DefaultAnnotationWriter() {
- @Override
- public Iterator<String> imports() {
- return new ArrayIterator<String>(EclipseLinkJPA.CACHE, EclipseLinkJPA.TIME_OF_DAY);
- }
- @Override
- public void appendTypeAnnotationTo(StringBuilder sb) {
- sb.append("@Cache(expiryTimeOfDay = @TimeOfDay(millisecond=5))");
- }
- });
- }
-
- public void testExpiryTimeOfDay() throws Exception {
- ICompilationUnit cu = this.createTestTimeOfDay();
- JavaResourcePersistentType typeResource = buildJavaTypeResource(cu);
-
- CacheAnnotation cache = (CacheAnnotation) typeResource.getSupportingAnnotation(EclipseLinkJPA.CACHE);
-
- TimeOfDayAnnotation timeOfDay = cache.getExpiryTimeOfDay();
-
- assertNotNull(timeOfDay);
- }
-
- public void testGetHour() throws Exception {
- ICompilationUnit cu = this.createTestTimeOfDayWithHour();
- JavaResourcePersistentType typeResource = buildJavaTypeResource(cu);
-
- CacheAnnotation cache = (CacheAnnotation) typeResource.getSupportingAnnotation(EclipseLinkJPA.CACHE);
- TimeOfDayAnnotation timeOfDay = cache.getExpiryTimeOfDay();
- assertEquals(Integer.valueOf(5), timeOfDay.getHour());
- }
-
- public void testSetHour() throws Exception {
- ICompilationUnit cu = this.createTestTimeOfDayWithHour();
- JavaResourcePersistentType typeResource = buildJavaTypeResource(cu);
-
- CacheAnnotation cache = (CacheAnnotation) typeResource.getSupportingAnnotation(EclipseLinkJPA.CACHE);
- TimeOfDayAnnotation timeOfDay = cache.getExpiryTimeOfDay();
- assertEquals(Integer.valueOf(5), timeOfDay.getHour());
-
- timeOfDay.setHour(Integer.valueOf(80));
- assertEquals(Integer.valueOf(80), timeOfDay.getHour());
-
- assertSourceContains("@TimeOfDay(hour=80)", cu);
-
- timeOfDay.setHour(null);
- assertNull(timeOfDay.getHour());
-
- assertSourceDoesNotContain("(hour=80)", cu);
- assertSourceContains("@TimeOfDay", cu);
- }
-
- public void testGetMinute() throws Exception {
- ICompilationUnit cu = this.createTestTimeOfDayWithMinute();
- JavaResourcePersistentType typeResource = buildJavaTypeResource(cu);
-
- CacheAnnotation cache = (CacheAnnotation) typeResource.getSupportingAnnotation(EclipseLinkJPA.CACHE);
- TimeOfDayAnnotation timeOfDay = cache.getExpiryTimeOfDay();
- assertEquals(Integer.valueOf(5), timeOfDay.getMinute());
- }
-
- public void testSetMinute() throws Exception {
- ICompilationUnit cu = this.createTestTimeOfDayWithMinute();
- JavaResourcePersistentType typeResource = buildJavaTypeResource(cu);
-
- CacheAnnotation cache = (CacheAnnotation) typeResource.getSupportingAnnotation(EclipseLinkJPA.CACHE);
- TimeOfDayAnnotation timeOfDay = cache.getExpiryTimeOfDay();
- assertEquals(Integer.valueOf(5), timeOfDay.getMinute());
-
- timeOfDay.setMinute(Integer.valueOf(80));
- assertEquals(Integer.valueOf(80), timeOfDay.getMinute());
-
- assertSourceContains("@TimeOfDay(minute=80)", cu);
-
- timeOfDay.setMinute(null);
- assertNull(timeOfDay.getMinute());
-
- assertSourceDoesNotContain("(minute=80)", cu);
- assertSourceContains("@TimeOfDay", cu);
- }
-
- public void testGetSecond() throws Exception {
- ICompilationUnit cu = this.createTestTimeOfDayWithSecond();
- JavaResourcePersistentType typeResource = buildJavaTypeResource(cu);
-
- CacheAnnotation cache = (CacheAnnotation) typeResource.getSupportingAnnotation(EclipseLinkJPA.CACHE);
- TimeOfDayAnnotation timeOfDay = cache.getExpiryTimeOfDay();
- assertEquals(Integer.valueOf(5), timeOfDay.getSecond());
- }
-
- public void testSetSecond() throws Exception {
- ICompilationUnit cu = this.createTestTimeOfDayWithSecond();
- JavaResourcePersistentType typeResource = buildJavaTypeResource(cu);
-
- CacheAnnotation cache = (CacheAnnotation) typeResource.getSupportingAnnotation(EclipseLinkJPA.CACHE);
- TimeOfDayAnnotation timeOfDay = cache.getExpiryTimeOfDay();
- assertEquals(Integer.valueOf(5), timeOfDay.getSecond());
-
- timeOfDay.setSecond(Integer.valueOf(80));
- assertEquals(Integer.valueOf(80), timeOfDay.getSecond());
-
- assertSourceContains("@TimeOfDay(second=80)", cu);
-
- timeOfDay.setSecond(null);
- assertNull(timeOfDay.getSecond());
-
- assertSourceDoesNotContain("(second=80)", cu);
- assertSourceContains("@TimeOfDay", cu);
- }
-
- public void testGetMillisecond() throws Exception {
- ICompilationUnit cu = this.createTestTimeOfDayWithMillisecond();
- JavaResourcePersistentType typeResource = buildJavaTypeResource(cu);
-
- CacheAnnotation cache = (CacheAnnotation) typeResource.getSupportingAnnotation(EclipseLinkJPA.CACHE);
- TimeOfDayAnnotation timeOfDay = cache.getExpiryTimeOfDay();
- assertEquals(Integer.valueOf(5), timeOfDay.getMillisecond());
- }
-
- public void testSetMillisecond() throws Exception {
- ICompilationUnit cu = this.createTestTimeOfDayWithMillisecond();
- JavaResourcePersistentType typeResource = buildJavaTypeResource(cu);
-
- CacheAnnotation cache = (CacheAnnotation) typeResource.getSupportingAnnotation(EclipseLinkJPA.CACHE);
- TimeOfDayAnnotation timeOfDay = cache.getExpiryTimeOfDay();
- assertEquals(Integer.valueOf(5), timeOfDay.getMillisecond());
-
- timeOfDay.setMillisecond(Integer.valueOf(80));
- assertEquals(Integer.valueOf(80), timeOfDay.getMillisecond());
-
- assertSourceContains("@TimeOfDay(millisecond=80)", cu);
-
- timeOfDay.setMillisecond(null);
- assertNull(timeOfDay.getMillisecond());
-
- assertSourceDoesNotContain("(millisecond=80)", cu);
- assertSourceContains("@TimeOfDay", cu);
- }
-
-
-}
diff --git a/jpa/tests/org.eclipse.jpt.eclipselink.core.tests/src/org/eclipse/jpt/eclipselink/core/tests/internal/resource/java/TransformationAnnotationTests.java b/jpa/tests/org.eclipse.jpt.eclipselink.core.tests/src/org/eclipse/jpt/eclipselink/core/tests/internal/resource/java/TransformationAnnotationTests.java
deleted file mode 100644
index 9f19dd32bb..0000000000
--- a/jpa/tests/org.eclipse.jpt.eclipselink.core.tests/src/org/eclipse/jpt/eclipselink/core/tests/internal/resource/java/TransformationAnnotationTests.java
+++ /dev/null
@@ -1,157 +0,0 @@
-/*******************************************************************************
- * Copyright (c) 2008, 2009 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.
- *
- * Contributors:
- * Oracle - initial API and implementation
- ******************************************************************************/
-package org.eclipse.jpt.eclipselink.core.tests.internal.resource.java;
-
-import java.util.Iterator;
-import org.eclipse.jdt.core.ICompilationUnit;
-import org.eclipse.jpt.core.resource.java.FetchType;
-import org.eclipse.jpt.core.resource.java.JPA;
-import org.eclipse.jpt.core.resource.java.JavaResourcePersistentAttribute;
-import org.eclipse.jpt.core.resource.java.JavaResourcePersistentType;
-import org.eclipse.jpt.eclipselink.core.resource.java.EclipseLinkJPA;
-import org.eclipse.jpt.eclipselink.core.resource.java.TransformationAnnotation;
-import org.eclipse.jpt.utility.internal.iterators.ArrayIterator;
-
-@SuppressWarnings("nls")
-public class TransformationAnnotationTests extends EclipseLinkJavaResourceModelTestCase {
-
- public TransformationAnnotationTests(String name) {
- super(name);
- }
-
- private ICompilationUnit createTestTransformation() throws Exception {
- return this.createTestType(new DefaultAnnotationWriter() {
- @Override
- public Iterator<String> imports() {
- return new ArrayIterator<String>(EclipseLinkJPA.TRANSFORMATION);
- }
- @Override
- public void appendIdFieldAnnotationTo(StringBuilder sb) {
- sb.append("@Transformation");
- }
- });
- }
-
- private ICompilationUnit createTestTransformationWithOptional() throws Exception {
- return this.createTestType(new DefaultAnnotationWriter() {
- @Override
- public Iterator<String> imports() {
- return new ArrayIterator<String>(EclipseLinkJPA.TRANSFORMATION);
- }
- @Override
- public void appendIdFieldAnnotationTo(StringBuilder sb) {
- sb.append("@Transformation(optional = true)");
- }
- });
- }
-
- private ICompilationUnit createTestTransformationWithFetch() throws Exception {
- return this.createTestType(new DefaultAnnotationWriter() {
- @Override
- public Iterator<String> imports() {
- return new ArrayIterator<String>(EclipseLinkJPA.TRANSFORMATION, JPA.FETCH_TYPE);
- }
- @Override
- public void appendIdFieldAnnotationTo(StringBuilder sb) {
- sb.append("@Transformation(fetch = FetchType.EAGER)");
- }
- });
- }
-
- public void testTransformationAnnotation() throws Exception {
- ICompilationUnit cu = this.createTestTransformation();
- JavaResourcePersistentType typeResource = buildJavaTypeResource(cu);
- JavaResourcePersistentAttribute attributeResource = typeResource.fields().next();
-
- assertNotNull(attributeResource.getMappingAnnotation(EclipseLinkJPA.TRANSFORMATION));
-
- attributeResource.setMappingAnnotation(null);
- assertNull(attributeResource.getMappingAnnotation(EclipseLinkJPA.TRANSFORMATION));
-
- attributeResource.setMappingAnnotation(EclipseLinkJPA.TRANSFORMATION);
- assertNotNull(attributeResource.getMappingAnnotation(EclipseLinkJPA.TRANSFORMATION));
- }
-
- public void testGetOptional() throws Exception {
- ICompilationUnit cu = this.createTestTransformationWithOptional();
- JavaResourcePersistentType typeResource = buildJavaTypeResource(cu);
- JavaResourcePersistentAttribute attributeResource = typeResource.fields().next();
-
- TransformationAnnotation transformation = (TransformationAnnotation) attributeResource.getMappingAnnotation(EclipseLinkJPA.TRANSFORMATION);
- assertEquals(Boolean.TRUE, transformation.getOptional());
- }
-
- public void testSetOptional() throws Exception {
- ICompilationUnit cu = this.createTestTransformationWithOptional();
- JavaResourcePersistentType typeResource = buildJavaTypeResource(cu);
- JavaResourcePersistentAttribute attributeResource = typeResource.fields().next();
-
- TransformationAnnotation transformation = (TransformationAnnotation) attributeResource.getMappingAnnotation(EclipseLinkJPA.TRANSFORMATION);
- assertEquals(Boolean.TRUE, transformation.getOptional());
-
- transformation.setOptional(Boolean.FALSE);
- assertEquals(Boolean.FALSE, transformation.getOptional());
-
- assertSourceContains("@Transformation(optional = false)", cu);
- }
-
- public void testSetOptionalNull() throws Exception {
- ICompilationUnit cu = this.createTestTransformationWithOptional();
- JavaResourcePersistentType typeResource = buildJavaTypeResource(cu);
- JavaResourcePersistentAttribute attributeResource = typeResource.fields().next();
-
- TransformationAnnotation transformation = (TransformationAnnotation) attributeResource.getMappingAnnotation(EclipseLinkJPA.TRANSFORMATION);
- assertEquals(Boolean.TRUE, transformation.getOptional());
-
- transformation.setOptional(null);
- assertNull(transformation.getOptional());
-
- assertSourceContains("@Transformation", cu);
- assertSourceDoesNotContain("optional", cu);
- }
-
- public void testGetFetch() throws Exception {
- ICompilationUnit cu = this.createTestTransformationWithFetch();
- JavaResourcePersistentType typeResource = buildJavaTypeResource(cu);
- JavaResourcePersistentAttribute attributeResource = typeResource.fields().next();
-
- TransformationAnnotation transformation = (TransformationAnnotation) attributeResource.getMappingAnnotation(EclipseLinkJPA.TRANSFORMATION);
- assertEquals(FetchType.EAGER, transformation.getFetch());
- }
-
- public void testSetFetch() throws Exception {
- ICompilationUnit cu = this.createTestTransformationWithFetch();
- JavaResourcePersistentType typeResource = buildJavaTypeResource(cu);
- JavaResourcePersistentAttribute attributeResource = typeResource.fields().next();
-
- TransformationAnnotation transformation = (TransformationAnnotation) attributeResource.getMappingAnnotation(EclipseLinkJPA.TRANSFORMATION);
- assertEquals(FetchType.EAGER, transformation.getFetch());
-
- transformation.setFetch(FetchType.LAZY);
- assertEquals(FetchType.LAZY, transformation.getFetch());
-
- assertSourceContains("@Transformation(fetch = LAZY)", cu);
- }
-
- public void testSetFetchNull() throws Exception {
- ICompilationUnit cu = this.createTestTransformationWithFetch();
- JavaResourcePersistentType typeResource = buildJavaTypeResource(cu);
- JavaResourcePersistentAttribute attributeResource = typeResource.fields().next();
-
- TransformationAnnotation transformation = (TransformationAnnotation) attributeResource.getMappingAnnotation(EclipseLinkJPA.TRANSFORMATION);
- assertEquals(FetchType.EAGER, transformation.getFetch());
-
- transformation.setFetch(null);
- assertNull(transformation.getFetch());
-
- assertSourceContains("@Transformation", cu);
- assertSourceDoesNotContain("fetch", cu);
- }
-}
diff --git a/jpa/tests/org.eclipse.jpt.eclipselink.core.tests/src/org/eclipse/jpt/eclipselink/core/tests/internal/resource/java/TypeConverterAnnotationTests.java b/jpa/tests/org.eclipse.jpt.eclipselink.core.tests/src/org/eclipse/jpt/eclipselink/core/tests/internal/resource/java/TypeConverterAnnotationTests.java
deleted file mode 100644
index 7bcff4fffd..0000000000
--- a/jpa/tests/org.eclipse.jpt.eclipselink.core.tests/src/org/eclipse/jpt/eclipselink/core/tests/internal/resource/java/TypeConverterAnnotationTests.java
+++ /dev/null
@@ -1,214 +0,0 @@
-/*******************************************************************************
- * Copyright (c) 2008, 2009 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.
- *
- * Contributors:
- * Oracle - initial API and implementation
- ******************************************************************************/
-package org.eclipse.jpt.eclipselink.core.tests.internal.resource.java;
-
-import java.util.Iterator;
-import org.eclipse.jdt.core.ICompilationUnit;
-import org.eclipse.jpt.core.resource.java.JavaResourcePersistentAttribute;
-import org.eclipse.jpt.core.resource.java.JavaResourcePersistentType;
-import org.eclipse.jpt.eclipselink.core.resource.java.EclipseLinkJPA;
-import org.eclipse.jpt.eclipselink.core.resource.java.TypeConverterAnnotation;
-import org.eclipse.jpt.utility.internal.iterators.ArrayIterator;
-
-@SuppressWarnings("nls")
-public class TypeConverterAnnotationTests extends EclipseLinkJavaResourceModelTestCase {
-
- public TypeConverterAnnotationTests(String name) {
- super(name);
- }
-
- private ICompilationUnit createTestTypeConverter() throws Exception {
- return this.createTestType(new DefaultAnnotationWriter() {
- @Override
- public Iterator<String> imports() {
- return new ArrayIterator<String>(EclipseLinkJPA.TYPE_CONVERTER);
- }
- @Override
- public void appendIdFieldAnnotationTo(StringBuilder sb) {
- sb.append("@TypeConverter");
- }
- });
- }
-
- private ICompilationUnit createTestTypeConverterWithDataType() throws Exception {
- return this.createTestType(new DefaultAnnotationWriter() {
- @Override
- public Iterator<String> imports() {
- return new ArrayIterator<String>(EclipseLinkJPA.TYPE_CONVERTER);
- }
- @Override
- public void appendIdFieldAnnotationTo(StringBuilder sb) {
- sb.append("@TypeConverter(dataType = Foo.class)");
- }
- });
- }
-
- private ICompilationUnit createTestTypeConverterWithObjectType() throws Exception {
- return this.createTestType(new DefaultAnnotationWriter() {
- @Override
- public Iterator<String> imports() {
- return new ArrayIterator<String>(EclipseLinkJPA.TYPE_CONVERTER);
- }
- @Override
- public void appendIdFieldAnnotationTo(StringBuilder sb) {
- sb.append("@TypeConverter(objectType = Foo.class)");
- }
- });
- }
-
- private ICompilationUnit createTestTypeConverterWithName() throws Exception {
- return this.createTestType(new DefaultAnnotationWriter() {
- @Override
- public Iterator<String> imports() {
- return new ArrayIterator<String>(EclipseLinkJPA.TYPE_CONVERTER);
- }
- @Override
- public void appendIdFieldAnnotationTo(StringBuilder sb) {
- sb.append("@TypeConverter(name = \"bar\")");
- }
- });
- }
-
- public void testTypeConverterAnnotation() throws Exception {
- ICompilationUnit cu = this.createTestTypeConverter();
- JavaResourcePersistentType typeResource = buildJavaTypeResource(cu);
- JavaResourcePersistentAttribute attributeResource = typeResource.fields().next();
-
- assertNotNull(attributeResource.getSupportingAnnotation(EclipseLinkJPA.TYPE_CONVERTER));
-
- attributeResource.removeSupportingAnnotation(EclipseLinkJPA.TYPE_CONVERTER);
- assertNull(attributeResource.getSupportingAnnotation(EclipseLinkJPA.TYPE_CONVERTER));
-
- attributeResource.addSupportingAnnotation(EclipseLinkJPA.TYPE_CONVERTER);
- assertNotNull(attributeResource.getSupportingAnnotation(EclipseLinkJPA.TYPE_CONVERTER));
- }
-
- public void testGetTypeDataType() throws Exception {
- ICompilationUnit cu = this.createTestTypeConverterWithDataType();
- JavaResourcePersistentType typeResource = buildJavaTypeResource(cu);
- JavaResourcePersistentAttribute attributeResource = typeResource.fields().next();
-
- TypeConverterAnnotation converter = (TypeConverterAnnotation) attributeResource.getSupportingAnnotation(EclipseLinkJPA.TYPE_CONVERTER);
- assertEquals("Foo", converter.getDataType());
- }
-
- public void testSetDataType() throws Exception {
- ICompilationUnit cu = this.createTestTypeConverterWithDataType();
- JavaResourcePersistentType typeResource = buildJavaTypeResource(cu);
- JavaResourcePersistentAttribute attributeResource = typeResource.fields().next();
-
- TypeConverterAnnotation converter = (TypeConverterAnnotation) attributeResource.getSupportingAnnotation(EclipseLinkJPA.TYPE_CONVERTER);
- assertEquals("Foo", converter.getDataType());
-
- converter.setDataType("Bar");
- assertEquals("Bar", converter.getDataType());
-
- assertSourceContains("@TypeConverter(dataType = Bar.class)", cu);
-
- converter.setDataType("int");
- assertEquals("int", converter.getDataType());
- assertSourceContains("@TypeConverter(dataType = int.class)", cu);
- }
-
- public void testSetDataTypeNull() throws Exception {
- ICompilationUnit cu = this.createTestTypeConverterWithDataType();
- JavaResourcePersistentType typeResource = buildJavaTypeResource(cu);
- JavaResourcePersistentAttribute attributeResource = typeResource.fields().next();
-
- TypeConverterAnnotation converter = (TypeConverterAnnotation) attributeResource.getSupportingAnnotation(EclipseLinkJPA.TYPE_CONVERTER);
- assertEquals("Foo", converter.getDataType());
-
- converter.setDataType(null);
- assertNull(converter.getDataType());
-
- assertSourceContains("@TypeConverter", cu);
- assertSourceDoesNotContain("dataType", cu);
- }
-
- public void testGetTypeObjectType() throws Exception {
- ICompilationUnit cu = this.createTestTypeConverterWithObjectType();
- JavaResourcePersistentType typeResource = buildJavaTypeResource(cu);
- JavaResourcePersistentAttribute attributeResource = typeResource.fields().next();
-
- TypeConverterAnnotation converter = (TypeConverterAnnotation) attributeResource.getSupportingAnnotation(EclipseLinkJPA.TYPE_CONVERTER);
- assertEquals("Foo", converter.getObjectType());
- }
-
- public void testSetObjectType() throws Exception {
- ICompilationUnit cu = this.createTestTypeConverterWithObjectType();
- JavaResourcePersistentType typeResource = buildJavaTypeResource(cu);
- JavaResourcePersistentAttribute attributeResource = typeResource.fields().next();
-
- TypeConverterAnnotation converter = (TypeConverterAnnotation) attributeResource.getSupportingAnnotation(EclipseLinkJPA.TYPE_CONVERTER);
- assertEquals("Foo", converter.getObjectType());
-
- converter.setObjectType("Bar");
- assertEquals("Bar", converter.getObjectType());
-
- assertSourceContains("@TypeConverter(objectType = Bar.class)", cu);
-
- converter.setObjectType("int");
- assertEquals("int", converter.getObjectType());
- assertSourceContains("@TypeConverter(objectType = int.class)", cu);
- }
-
- public void testSetObjectTypeNull() throws Exception {
- ICompilationUnit cu = this.createTestTypeConverterWithObjectType();
- JavaResourcePersistentType typeResource = buildJavaTypeResource(cu);
- JavaResourcePersistentAttribute attributeResource = typeResource.fields().next();
-
- TypeConverterAnnotation converter = (TypeConverterAnnotation) attributeResource.getSupportingAnnotation(EclipseLinkJPA.TYPE_CONVERTER);
- assertEquals("Foo", converter.getObjectType());
-
- converter.setObjectType(null);
- assertNull(converter.getObjectType());
-
- assertSourceContains("@TypeConverter", cu);
- assertSourceDoesNotContain("objectType", cu);
- }
-
- public void testGetName() throws Exception {
- ICompilationUnit cu = this.createTestTypeConverterWithName();
- JavaResourcePersistentType typeResource = buildJavaTypeResource(cu);
- JavaResourcePersistentAttribute attributeResource = typeResource.fields().next();
-
- TypeConverterAnnotation converter = (TypeConverterAnnotation) attributeResource.getSupportingAnnotation(EclipseLinkJPA.TYPE_CONVERTER);
- assertEquals("bar", converter.getName());
- }
-
- public void testSetName() throws Exception {
- ICompilationUnit cu = this.createTestTypeConverterWithName();
- JavaResourcePersistentType typeResource = buildJavaTypeResource(cu);
- JavaResourcePersistentAttribute attributeResource = typeResource.fields().next();
-
- TypeConverterAnnotation converter = (TypeConverterAnnotation) attributeResource.getSupportingAnnotation(EclipseLinkJPA.TYPE_CONVERTER);
- assertEquals("bar", converter.getName());
-
- converter.setName("foo");
- assertEquals("foo", converter.getName());
-
- assertSourceContains("@TypeConverter(name = \"foo\")", cu);
- }
-
- public void testSetNameNull() throws Exception {
- ICompilationUnit cu = this.createTestTypeConverterWithName();
- JavaResourcePersistentType typeResource = buildJavaTypeResource(cu);
- JavaResourcePersistentAttribute attributeResource = typeResource.fields().next();
-
- TypeConverterAnnotation converter = (TypeConverterAnnotation) attributeResource.getSupportingAnnotation(EclipseLinkJPA.TYPE_CONVERTER);
- assertEquals("bar", converter.getName());
-
- converter.setName(null);
- assertNull(converter.getName());
-
- assertSourceContains("@TypeConverter", cu);
- assertSourceDoesNotContain("name=", cu);
- }
-}
diff --git a/jpa/tests/org.eclipse.jpt.eclipselink.core.tests/src/org/eclipse/jpt/eclipselink/core/tests/internal/resource/java/WriteTransformerAnnotationTests.java b/jpa/tests/org.eclipse.jpt.eclipselink.core.tests/src/org/eclipse/jpt/eclipselink/core/tests/internal/resource/java/WriteTransformerAnnotationTests.java
deleted file mode 100644
index a349cb75e4..0000000000
--- a/jpa/tests/org.eclipse.jpt.eclipselink.core.tests/src/org/eclipse/jpt/eclipselink/core/tests/internal/resource/java/WriteTransformerAnnotationTests.java
+++ /dev/null
@@ -1,219 +0,0 @@
-/*******************************************************************************
- * Copyright (c) 2008, 2009 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.
- *
- * Contributors:
- * Oracle - initial API and implementation
- ******************************************************************************/
-package org.eclipse.jpt.eclipselink.core.tests.internal.resource.java;
-
-import java.util.Iterator;
-import org.eclipse.jdt.core.ICompilationUnit;
-import org.eclipse.jpt.core.resource.java.JPA;
-import org.eclipse.jpt.core.resource.java.JavaResourcePersistentAttribute;
-import org.eclipse.jpt.core.resource.java.JavaResourcePersistentType;
-import org.eclipse.jpt.eclipselink.core.resource.java.EclipseLinkJPA;
-import org.eclipse.jpt.eclipselink.core.resource.java.WriteTransformerAnnotation;
-import org.eclipse.jpt.utility.internal.iterators.ArrayIterator;
-
-@SuppressWarnings("nls")
-public class WriteTransformerAnnotationTests extends EclipseLinkJavaResourceModelTestCase {
-
- public WriteTransformerAnnotationTests(String name) {
- super(name);
- }
-
- private ICompilationUnit createTestWriteTransformer() throws Exception {
- return this.createTestType(new DefaultAnnotationWriter() {
- @Override
- public Iterator<String> imports() {
- return new ArrayIterator<String>(EclipseLinkJPA.WRITE_TRANSFORMER);
- }
- @Override
- public void appendIdFieldAnnotationTo(StringBuilder sb) {
- sb.append("@WriteTransformer");
- }
- });
- }
-
- private ICompilationUnit createTestWriteTransformerWithTransformerClass() throws Exception {
- return this.createTestType(new DefaultAnnotationWriter() {
- @Override
- public Iterator<String> imports() {
- return new ArrayIterator<String>(EclipseLinkJPA.WRITE_TRANSFORMER);
- }
- @Override
- public void appendIdFieldAnnotationTo(StringBuilder sb) {
- sb.append("@WriteTransformer(transformerClass = Foo.class)");
- }
- });
- }
-
- private ICompilationUnit createTestWriteTransformerWithMethod() throws Exception {
- return this.createTestType(new DefaultAnnotationWriter() {
- @Override
- public Iterator<String> imports() {
- return new ArrayIterator<String>(EclipseLinkJPA.WRITE_TRANSFORMER);
- }
- @Override
- public void appendIdFieldAnnotationTo(StringBuilder sb) {
- sb.append("@WriteTransformer(method = \"transformerMethod\")");
- }
- });
- }
-
- private ICompilationUnit createTestWriteTransformerWithColumn() throws Exception {
- return this.createTestType(new DefaultAnnotationWriter() {
- @Override
- public Iterator<String> imports() {
- return new ArrayIterator<String>(EclipseLinkJPA.WRITE_TRANSFORMER, JPA.COLUMN);
- }
- @Override
- public void appendIdFieldAnnotationTo(StringBuilder sb) {
- sb.append("@WriteTransformer(column = @Column(name = \"FOO\"))");
- }
- });
- }
-
-
- public void testWriteTransformerAnnotation() throws Exception {
- ICompilationUnit cu = this.createTestWriteTransformer();
- JavaResourcePersistentType typeResource = buildJavaTypeResource(cu);
- JavaResourcePersistentAttribute attributeResource = typeResource.fields().next();
-
- assertNotNull(attributeResource.getSupportingAnnotation(EclipseLinkJPA.WRITE_TRANSFORMER));
-
- attributeResource.removeSupportingAnnotation(EclipseLinkJPA.WRITE_TRANSFORMER) ;
- assertNull(attributeResource.getSupportingAnnotation(EclipseLinkJPA.WRITE_TRANSFORMER));
-
- attributeResource.addSupportingAnnotation(EclipseLinkJPA.WRITE_TRANSFORMER);
- assertNotNull(attributeResource.getSupportingAnnotation(EclipseLinkJPA.WRITE_TRANSFORMER));
- }
-
- public void testGetTransformerClass() throws Exception {
- ICompilationUnit cu = this.createTestWriteTransformerWithTransformerClass();
- JavaResourcePersistentType typeResource = buildJavaTypeResource(cu);
- JavaResourcePersistentAttribute attributeResource = typeResource.fields().next();
-
- WriteTransformerAnnotation writeTransformer = (WriteTransformerAnnotation) attributeResource.getSupportingAnnotation(EclipseLinkJPA.WRITE_TRANSFORMER);
- assertEquals("Foo", writeTransformer.getTransformerClass());
- }
-
- public void testSetTransformerClass() throws Exception {
- ICompilationUnit cu = this.createTestWriteTransformerWithTransformerClass();
- JavaResourcePersistentType typeResource = buildJavaTypeResource(cu);
- JavaResourcePersistentAttribute attributeResource = typeResource.fields().next();
-
- WriteTransformerAnnotation writeTransformer = (WriteTransformerAnnotation) attributeResource.getSupportingAnnotation(EclipseLinkJPA.WRITE_TRANSFORMER);
- assertEquals("Foo", writeTransformer.getTransformerClass());
-
- writeTransformer.setTransformerClass("Bar");
- assertEquals("Bar", writeTransformer.getTransformerClass());
-
- assertSourceContains("@WriteTransformer(transformerClass = Bar.class)", cu);
- }
-
- public void testSetTransformerClassNull() throws Exception {
- ICompilationUnit cu = this.createTestWriteTransformerWithTransformerClass();
- JavaResourcePersistentType typeResource = buildJavaTypeResource(cu);
- JavaResourcePersistentAttribute attributeResource = typeResource.fields().next();
-
- WriteTransformerAnnotation writeTransformer = (WriteTransformerAnnotation) attributeResource.getSupportingAnnotation(EclipseLinkJPA.WRITE_TRANSFORMER);
- assertEquals("Foo", writeTransformer.getTransformerClass());
-
- writeTransformer.setTransformerClass(null);
- assertNull(writeTransformer.getTransformerClass());
-
- assertSourceContains("@WriteTransformer", cu);
- assertSourceDoesNotContain("transformerClass", cu);
- }
-
- public void testGetMethod() throws Exception {
- ICompilationUnit cu = this.createTestWriteTransformerWithMethod();
- JavaResourcePersistentType typeResource = buildJavaTypeResource(cu);
- JavaResourcePersistentAttribute attributeResource = typeResource.fields().next();
-
- WriteTransformerAnnotation writeTransformer = (WriteTransformerAnnotation) attributeResource.getSupportingAnnotation(EclipseLinkJPA.WRITE_TRANSFORMER);
- assertEquals("transformerMethod", writeTransformer.getMethod());
- }
-
- public void testSetMethod() throws Exception {
- ICompilationUnit cu = this.createTestWriteTransformerWithMethod();
- JavaResourcePersistentType typeResource = buildJavaTypeResource(cu);
- JavaResourcePersistentAttribute attributeResource = typeResource.fields().next();
-
- WriteTransformerAnnotation writeTransformer = (WriteTransformerAnnotation) attributeResource.getSupportingAnnotation(EclipseLinkJPA.WRITE_TRANSFORMER);
- assertEquals("transformerMethod", writeTransformer.getMethod());
-
- writeTransformer.setMethod("foo");
- assertEquals("foo", writeTransformer.getMethod());
-
- assertSourceContains("@WriteTransformer(method = \"foo\")", cu);
- }
-
- public void testSetMethodNull() throws Exception {
- ICompilationUnit cu = this.createTestWriteTransformerWithMethod();
- JavaResourcePersistentType typeResource = buildJavaTypeResource(cu);
- JavaResourcePersistentAttribute attributeResource = typeResource.fields().next();
-
- WriteTransformerAnnotation writeTransformer = (WriteTransformerAnnotation) attributeResource.getSupportingAnnotation(EclipseLinkJPA.WRITE_TRANSFORMER);
- assertEquals("transformerMethod", writeTransformer.getMethod());
-
- writeTransformer.setMethod(null);
- assertNull(writeTransformer.getMethod());
-
- assertSourceContains("@WriteTransformer", cu);
- assertSourceDoesNotContain("method", cu);
- }
-
-
- public void testGetColumn() throws Exception {
- ICompilationUnit cu = this.createTestWriteTransformerWithColumn();
- JavaResourcePersistentType typeResource = buildJavaTypeResource(cu);
- JavaResourcePersistentAttribute attributeResource = typeResource.fields().next();
-
- WriteTransformerAnnotation writeTransformer = (WriteTransformerAnnotation) attributeResource.getSupportingAnnotation(EclipseLinkJPA.WRITE_TRANSFORMER);
- assertNotNull(writeTransformer.getColumn());
- assertEquals("FOO", writeTransformer.getColumn().getName());
- }
-
- public void testAddColumn() throws Exception {
- ICompilationUnit cu = this.createTestWriteTransformerWithMethod();
- JavaResourcePersistentType typeResource = buildJavaTypeResource(cu);
- JavaResourcePersistentAttribute attributeResource = typeResource.fields().next();
-
- WriteTransformerAnnotation writeTransformer = (WriteTransformerAnnotation) attributeResource.getSupportingAnnotation(EclipseLinkJPA.WRITE_TRANSFORMER);
- assertNull(writeTransformer.getColumn());
-
- writeTransformer.addColumn();
-
- assertNotNull(writeTransformer.getColumn());
- assertSourceContains("@WriteTransformer(method = \"transformerMethod\", column = @Column)", cu);
-
- writeTransformer.getColumn().setName("BAR");
- assertSourceContains("@WriteTransformer(method = \"transformerMethod\", column = @Column(name = \"BAR\"))", cu);
-
- }
-
- public void testRemoveColumn() throws Exception {
- ICompilationUnit cu = this.createTestWriteTransformerWithColumn();
- JavaResourcePersistentType typeResource = buildJavaTypeResource(cu);
- JavaResourcePersistentAttribute attributeResource = typeResource.fields().next();
-
- WriteTransformerAnnotation writeTransformer = (WriteTransformerAnnotation) attributeResource.getSupportingAnnotation(EclipseLinkJPA.WRITE_TRANSFORMER);
- assertNotNull(writeTransformer.getColumn());
- assertEquals("FOO", writeTransformer.getColumn().getName());
-
- writeTransformer.removeColumn();
- assertNull(writeTransformer.getColumn());
-
- assertSourceContains("@WriteTransformer", cu);
- assertSourceDoesNotContain("column", cu);
- }
-
- public void getNonNullColumn() throws Exception {
-
- }
-}
diff --git a/jpa/tests/org.eclipse.jpt.eclipselink.core.tests/src/org/eclipse/jpt/eclipselink1_1/core/tests/internal/context/EclipseLink1_1ContextModelTestCase.java b/jpa/tests/org.eclipse.jpt.eclipselink.core.tests/src/org/eclipse/jpt/eclipselink1_1/core/tests/internal/context/EclipseLink1_1ContextModelTestCase.java
deleted file mode 100644
index 6df2674974..0000000000
--- a/jpa/tests/org.eclipse.jpt.eclipselink.core.tests/src/org/eclipse/jpt/eclipselink1_1/core/tests/internal/context/EclipseLink1_1ContextModelTestCase.java
+++ /dev/null
@@ -1,35 +0,0 @@
-/*******************************************************************************
- * Copyright (c) 2009 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
- *
- * Contributors:
- * Oracle - initial API and implementation
- *******************************************************************************/
-package org.eclipse.jpt.eclipselink1_1.core.tests.internal.context;
-
-import org.eclipse.jpt.core.internal.facet.JpaFacetDataModelProperties;
-import org.eclipse.jpt.core.internal.facet.JpaFacetDataModelProvider;
-import org.eclipse.jpt.eclipselink.core.tests.internal.context.EclipseLinkContextModelTestCase;
-import org.eclipse.jpt.eclipselink1_1.core.internal.EclipseLink1_1JpaPlatformProvider;
-import org.eclipse.wst.common.frameworks.datamodel.DataModelFactory;
-import org.eclipse.wst.common.frameworks.datamodel.IDataModel;
-
-public abstract class EclipseLink1_1ContextModelTestCase extends EclipseLinkContextModelTestCase
-{
- public static final String JPA_ANNOTATIONS_PACKAGE_NAME = "javax.persistence"; //$NON-NLS-1$
-
- protected EclipseLink1_1ContextModelTestCase(String name) {
- super(name);
- }
-
- @Override
- protected IDataModel buildJpaConfigDataModel() {
- IDataModel dataModel = DataModelFactory.createDataModel(new JpaFacetDataModelProvider());
- dataModel.setProperty(JpaFacetDataModelProperties.PLATFORM_ID, EclipseLink1_1JpaPlatformProvider.ID);
- dataModel.setProperty(JpaFacetDataModelProperties.CREATE_ORM_XML, Boolean.TRUE);
- return dataModel;
- }
-}
diff --git a/jpa/tests/org.eclipse.jpt.eclipselink.core.tests/src/org/eclipse/jpt/eclipselink1_1/core/tests/internal/context/EclipseLink1_1JpaProjectTests.java b/jpa/tests/org.eclipse.jpt.eclipselink.core.tests/src/org/eclipse/jpt/eclipselink1_1/core/tests/internal/context/EclipseLink1_1JpaProjectTests.java
deleted file mode 100644
index a19519ef48..0000000000
--- a/jpa/tests/org.eclipse.jpt.eclipselink.core.tests/src/org/eclipse/jpt/eclipselink1_1/core/tests/internal/context/EclipseLink1_1JpaProjectTests.java
+++ /dev/null
@@ -1,164 +0,0 @@
-/*******************************************************************************
- * Copyright (c) 2009 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.
- *
- * Contributors:
- * Oracle - initial API and implementation
- ******************************************************************************/
-package org.eclipse.jpt.eclipselink1_1.core.tests.internal.context;
-
-import org.eclipse.jpt.core.JptCorePlugin;
-import org.eclipse.jpt.core.internal.resource.orm.OrmXmlResourceProvider;
-import org.eclipse.jpt.core.resource.xml.JpaXmlResource;
-import org.eclipse.jpt.eclipselink.core.internal.JptEclipseLinkCorePlugin;
-import org.eclipse.jpt.eclipselink.core.internal.resource.orm.EclipseLinkOrmXmlResourceProvider;
-import org.eclipse.jpt.eclipselink1_1.core.internal.resource.orm.EclipseLink1_1OrmXmlResourceProvider;
-
-@SuppressWarnings("nls")
-public class EclipseLink1_1JpaProjectTests extends EclipseLink1_1ContextModelTestCase
-{
-
- public EclipseLink1_1JpaProjectTests(String name) {
- super(name);
- }
-
- public void testGetDefaultOrmXmlResource() throws Exception {
- JpaXmlResource resource = this.getJpaProject().getDefaultOrmXmlResource();
- assertNotNull(resource);
- assertEquals(JptCorePlugin.ORM_XML_CONTENT_TYPE, resource.getContentType());
- assertEquals("src/META-INF/orm.xml", resource.getFile().getProjectRelativePath().toString());
-
-
- //delete the orm.xml file and verify it is not returned from getDefaultOrmXmlResource()
- resource.delete(null);
- resource = this.getJpaProject().getDefaultOrmXmlResource();
- assertNull(resource);
-
-
- //add the orm.xml file with eclipselink 1.1 orm content type
- createDefaultOrmXmlFileWithEclipseLink1_1ContentType();
- resource = this.getJpaProject().getDefaultOrmXmlResource();
- assertNotNull(resource);
- assertEquals(JptEclipseLinkCorePlugin.ECLIPSELINK1_1_ORM_XML_CONTENT_TYPE, resource.getContentType());
- assertEquals("src/META-INF/orm.xml", resource.getFile().getProjectRelativePath().toString());
-
-
- //delete the orm.xml file and verify it is not returned from getDefaultOrmXmlResource()
- resource.delete(null);
- resource = this.getJpaProject().getDefaultOrmXmlResource();
- assertNull(resource);
-
-
- //add the orm.xml file with eclipselink orm content type
- createDefaultOrmXmlFileWithEclipseLinkContentType();
- resource = this.getJpaProject().getDefaultOrmXmlResource();
- assertNotNull(resource);
- assertEquals(JptEclipseLinkCorePlugin.ECLIPSELINK_ORM_XML_CONTENT_TYPE, resource.getContentType());
- assertEquals("src/META-INF/orm.xml", resource.getFile().getProjectRelativePath().toString());
-
-
- //delete the orm.xml file and verify it is not returned from getDefaultOrmXmlResource()
- resource.delete(null);
- resource = this.getJpaProject().getDefaultOrmXmlResource();
- assertNull(resource);
-
-
- //add the orm.xml file this time with orm content type
- createDefaultOrmXmlFile();
- resource = this.getJpaProject().getDefaultOrmXmlResource();
- assertNotNull(resource);
- assertEquals(JptCorePlugin.ORM_XML_CONTENT_TYPE, resource.getContentType());
- assertEquals("src/META-INF/orm.xml", resource.getFile().getProjectRelativePath().toString());
- }
-
- public void testGetDefaultEclipseLinkOrmXmlResource() throws Exception {
- JpaXmlResource resource = this.getJpaProject().getDefaultEclipseLinkOrmXmlResource();
- assertNull(resource);
-
- //add the eclipselink-orm.xml 1.1 file
- createDefaultEclipseLink1_1OrmXmlFile();
- resource = this.getJpaProject().getDefaultEclipseLinkOrmXmlResource();
- assertNotNull(resource);
- assertEquals(JptEclipseLinkCorePlugin.ECLIPSELINK1_1_ORM_XML_CONTENT_TYPE, resource.getContentType());
- assertEquals("src/META-INF/eclipselink-orm.xml", resource.getFile().getProjectRelativePath().toString());
-
-
- //delete the eclipselink-orm.xml file and verify it is not returned from getDefaultOrmXmlResource()
- resource.delete(null);
- resource = this.getJpaProject().getDefaultEclipseLinkOrmXmlResource();
- assertNull(resource);
- }
-
- private void createDefaultOrmXmlFileWithEclipseLinkContentType() throws Exception {
- EclipseLinkOrmXmlResourceProvider resourceProvider =
- EclipseLinkOrmXmlResourceProvider.getXmlResourceProvider(this.getJavaProject().getProject(), JptCorePlugin.DEFAULT_ORM_XML_FILE_PATH);
- resourceProvider.createFileAndResource();
- }
-
- private void createDefaultOrmXmlFileWithEclipseLink1_1ContentType() throws Exception {
- EclipseLink1_1OrmXmlResourceProvider resourceProvider =
- EclipseLink1_1OrmXmlResourceProvider.getXmlResourceProvider(this.getJavaProject().getProject(), JptCorePlugin.DEFAULT_ORM_XML_FILE_PATH);
- resourceProvider.createFileAndResource();
- }
-
- private void createDefaultOrmXmlFile() throws Exception {
- OrmXmlResourceProvider resourceProvider =
- OrmXmlResourceProvider.getDefaultXmlResourceProvider(this.getJavaProject().getProject());
- resourceProvider.createFileAndResource();
- }
-
- private void createDefaultEclipseLink1_1OrmXmlFile() throws Exception {
- EclipseLink1_1OrmXmlResourceProvider resourceProvider =
- EclipseLink1_1OrmXmlResourceProvider.getDefaultXmlResourceProvider(this.getJavaProject().getProject());
- resourceProvider.createFileAndResource();
- }
-
- private void createEclipseLink1_1OrmXmlFile(String filePath) throws Exception {
- EclipseLink1_1OrmXmlResourceProvider resourceProvider =
- EclipseLink1_1OrmXmlResourceProvider.getXmlResourceProvider(this.getJavaProject().getProject(), filePath);
- resourceProvider.createFileAndResource();
- }
-
- public void testGetMappingFileResource() throws Exception {
- JpaXmlResource resource = this.getJpaProject().getMappingFileXmlResource(JptEclipseLinkCorePlugin.DEFAULT_ECLIPSELINK_ORM_XML_FILE_PATH);
- assertNull(resource);
-
- //add the eclipselink-orm.xml 1.1 file
- createDefaultEclipseLink1_1OrmXmlFile();
- resource = this.getJpaProject().getMappingFileXmlResource(JptEclipseLinkCorePlugin.DEFAULT_ECLIPSELINK_ORM_XML_FILE_PATH);
- assertNotNull(resource);
- assertEquals(JptEclipseLinkCorePlugin.ECLIPSELINK1_1_ORM_XML_CONTENT_TYPE, resource.getContentType());
- assertEquals("src/META-INF/eclipselink-orm.xml", resource.getFile().getProjectRelativePath().toString());
-
- //delete the eclipselink-orm.xml file and verify it is not returned from getMappingFileResource()
- resource.delete(null);
- resource = this.getJpaProject().getMappingFileXmlResource(JptEclipseLinkCorePlugin.DEFAULT_ECLIPSELINK_ORM_XML_FILE_PATH);
- assertNull(resource);
- }
-
- public void testGetDifferentlyNamedMappingFileResource() throws Exception {
- JpaXmlResource resource = this.getJpaProject().getMappingFileXmlResource("META-INF/orm2.xml");
- assertNull(resource);
-
- //create the orm2.xml file
- createEclipseLink1_1OrmXmlFile("META-INF/orm2.xml");
- resource = this.getJpaProject().getMappingFileXmlResource("META-INF/orm2.xml");
- assertNotNull(resource);
- assertEquals(JptEclipseLinkCorePlugin.ECLIPSELINK1_1_ORM_XML_CONTENT_TYPE, resource.getContentType());
- assertEquals("src/META-INF/orm2.xml", resource.getFile().getProjectRelativePath().toString());
-
- //delete the orm2.xml file and verify it is not returned from getMappingFileResource()
- resource.delete(null);
- resource = this.getJpaProject().getMappingFileXmlResource("META-INF/orm2.xml");
- assertNull(resource);
-
- //add the orm2.xml file back
- createEclipseLink1_1OrmXmlFile("META-INF/orm2.xml");
- resource = this.getJpaProject().getMappingFileXmlResource("META-INF/orm2.xml");
- assertNotNull(resource);
- assertEquals(JptEclipseLinkCorePlugin.ECLIPSELINK1_1_ORM_XML_CONTENT_TYPE, resource.getContentType());
- assertEquals("src/META-INF/orm2.xml", resource.getFile().getProjectRelativePath().toString());
- }
-}
diff --git a/jpa/tests/org.eclipse.jpt.eclipselink.core.tests/src/org/eclipse/jpt/eclipselink1_1/core/tests/internal/context/JptEclipseLink1_1CoreContextModelTests.java b/jpa/tests/org.eclipse.jpt.eclipselink.core.tests/src/org/eclipse/jpt/eclipselink1_1/core/tests/internal/context/JptEclipseLink1_1CoreContextModelTests.java
deleted file mode 100644
index 491f6c908e..0000000000
--- a/jpa/tests/org.eclipse.jpt.eclipselink.core.tests/src/org/eclipse/jpt/eclipselink1_1/core/tests/internal/context/JptEclipseLink1_1CoreContextModelTests.java
+++ /dev/null
@@ -1,36 +0,0 @@
-/*******************************************************************************
- * Copyright (c) 2007, 2009 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
- *
- * Contributors:
- * Oracle - initial API and implementation
- *******************************************************************************/
-package org.eclipse.jpt.eclipselink1_1.core.tests.internal.context;
-
-import junit.framework.Test;
-import junit.framework.TestCase;
-import junit.framework.TestSuite;
-import org.eclipse.jpt.eclipselink1_1.core.tests.internal.context.EclipseLink1_1JpaProjectTests;
-import org.eclipse.jpt.eclipselink1_1.core.tests.internal.context.orm.JptEclipseLink1_1CoreOrmContextModelTests;
-
-public class JptEclipseLink1_1CoreContextModelTests extends TestCase
-{
- public static Test suite() {
- return suite(true);
- }
-
- public static Test suite(boolean all) {
- TestSuite suite = new TestSuite(JptEclipseLink1_1CoreContextModelTests.class.getName());
- suite.addTestSuite(EclipseLink1_1JpaProjectTests.class);
- suite.addTest(JptEclipseLink1_1CoreOrmContextModelTests.suite(all));
- return suite;
- }
-
- private JptEclipseLink1_1CoreContextModelTests() {
- super();
- throw new UnsupportedOperationException();
- }
-}
diff --git a/jpa/tests/org.eclipse.jpt.eclipselink.core.tests/src/org/eclipse/jpt/eclipselink1_1/core/tests/internal/context/orm/EclipseLink1_1OrmContextModelTestCase.java b/jpa/tests/org.eclipse.jpt.eclipselink.core.tests/src/org/eclipse/jpt/eclipselink1_1/core/tests/internal/context/orm/EclipseLink1_1OrmContextModelTestCase.java
deleted file mode 100644
index 306a55c541..0000000000
--- a/jpa/tests/org.eclipse.jpt.eclipselink.core.tests/src/org/eclipse/jpt/eclipselink1_1/core/tests/internal/context/orm/EclipseLink1_1OrmContextModelTestCase.java
+++ /dev/null
@@ -1,88 +0,0 @@
-/*******************************************************************************
- * Copyright (c) 2009 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.
- *
- * Contributors:
- * Oracle - initial API and implementation
- *******************************************************************************/
-package org.eclipse.jpt.eclipselink1_1.core.tests.internal.context.orm;
-
-import org.eclipse.jpt.core.internal.facet.JpaFacetDataModelProperties;
-import org.eclipse.jpt.core.internal.facet.JpaFacetDataModelProvider;
-import org.eclipse.jpt.core.internal.operations.OrmFileCreationDataModelProperties;
-import org.eclipse.jpt.core.resource.xml.JpaXmlResource;
-import org.eclipse.jpt.core.tests.internal.projects.TestJpaProject;
-import org.eclipse.jpt.eclipselink.core.internal.context.orm.EclipseLinkEntityMappings;
-import org.eclipse.jpt.eclipselink.core.resource.orm.XmlEntityMappings;
-import org.eclipse.jpt.eclipselink1_1.core.internal.EclipseLink1_1JpaPlatformProvider;
-import org.eclipse.jpt.eclipselink1_1.core.internal.operations.EclipseLink1_1OrmFileCreationDataModelProvider;
-import org.eclipse.jpt.eclipselink1_1.core.internal.operations.EclipseLink1_1OrmFileCreationOperation;
-import org.eclipse.jpt.eclipselink1_1.core.tests.internal.context.EclipseLink1_1ContextModelTestCase;
-import org.eclipse.wst.common.frameworks.datamodel.DataModelFactory;
-import org.eclipse.wst.common.frameworks.datamodel.IDataModel;
-
-public abstract class EclipseLink1_1OrmContextModelTestCase
- extends EclipseLink1_1ContextModelTestCase
-{
- protected JpaXmlResource eclipseLink1_1OrmXmlResource;
-
-
- protected EclipseLink1_1OrmContextModelTestCase(String name) {
- super(name);
- }
-
- @Override
- protected void setUp() throws Exception {
- super.setUp();
- this.eclipseLink1_1OrmXmlResource = getJpaProject().getDefaultEclipseLinkOrmXmlResource();
- }
- @Override
- protected IDataModel buildJpaConfigDataModel() {
- IDataModel dataModel = DataModelFactory.createDataModel(new JpaFacetDataModelProvider());
- dataModel.setProperty(JpaFacetDataModelProperties.PLATFORM_ID, EclipseLink1_1JpaPlatformProvider.ID);
- dataModel.setProperty(JpaFacetDataModelProperties.CREATE_ORM_XML, Boolean.FALSE);
- return dataModel;
- }
-
- @Override
- protected TestJpaProject buildJpaProject(String projectName, boolean autoBuild, IDataModel jpaConfig) throws Exception {
- TestJpaProject testJpaProject = super.buildJpaProject(projectName, autoBuild, jpaConfig);
-
- EclipseLink1_1OrmFileCreationOperation operation =
- new EclipseLink1_1OrmFileCreationOperation(buildEclipseLinkOrmConfig(testJpaProject));
- operation.execute(null, null);
-
- return testJpaProject;
- }
-
- protected IDataModel buildEclipseLinkOrmConfig(TestJpaProject testJpaProject) {
- IDataModel dataModel =
- DataModelFactory.createDataModel(new EclipseLink1_1OrmFileCreationDataModelProvider());
- dataModel.setProperty(OrmFileCreationDataModelProperties.PROJECT_NAME, testJpaProject.getProject().getName());
- dataModel.setProperty(OrmFileCreationDataModelProperties.ADD_TO_PERSISTENCE_UNIT, Boolean.TRUE);
- return dataModel;
- }
-
- @Override
- protected void tearDown() throws Exception {
- this.eclipseLink1_1OrmXmlResource = null;
- super.tearDown();
- }
-
- @Override
- protected JpaXmlResource getOrmXmlResource() {
- return this.eclipseLink1_1OrmXmlResource;
- }
-
- @Override
- protected XmlEntityMappings getXmlEntityMappings() {
- return (XmlEntityMappings) super.getXmlEntityMappings();
- }
-
- @Override
- protected EclipseLinkEntityMappings getEntityMappings() {
- return (EclipseLinkEntityMappings) super.getEntityMappings();
- }
-}
diff --git a/jpa/tests/org.eclipse.jpt.eclipselink.core.tests/src/org/eclipse/jpt/eclipselink1_1/core/tests/internal/context/orm/EclipseLink1_1OrmPersistentAttributeTests.java b/jpa/tests/org.eclipse.jpt.eclipselink.core.tests/src/org/eclipse/jpt/eclipselink1_1/core/tests/internal/context/orm/EclipseLink1_1OrmPersistentAttributeTests.java
deleted file mode 100644
index e9d343f809..0000000000
--- a/jpa/tests/org.eclipse.jpt.eclipselink.core.tests/src/org/eclipse/jpt/eclipselink1_1/core/tests/internal/context/orm/EclipseLink1_1OrmPersistentAttributeTests.java
+++ /dev/null
@@ -1,435 +0,0 @@
-/*******************************************************************************
- * Copyright (c) 2009 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.
- *
- * Contributors:
- * Oracle - initial API and implementation
- *******************************************************************************/
-package org.eclipse.jpt.eclipselink1_1.core.tests.internal.context.orm;
-
-import java.util.Iterator;
-import java.util.ListIterator;
-import org.eclipse.jdt.core.ICompilationUnit;
-import org.eclipse.jpt.core.MappingKeys;
-import org.eclipse.jpt.core.context.AccessType;
-import org.eclipse.jpt.core.context.BasicMapping;
-import org.eclipse.jpt.core.context.IdMapping;
-import org.eclipse.jpt.core.context.java.JavaPersistentAttribute;
-import org.eclipse.jpt.core.context.java.JavaPersistentType;
-import org.eclipse.jpt.core.context.orm.OrmPersistentAttribute;
-import org.eclipse.jpt.core.context.orm.OrmPersistentType;
-import org.eclipse.jpt.core.internal.context.orm.GenericOrmNullAttributeMapping;
-import org.eclipse.jpt.core.internal.facet.JpaFacetDataModelProperties;
-import org.eclipse.jpt.core.internal.facet.JpaFacetDataModelProvider;
-import org.eclipse.jpt.core.resource.java.JPA;
-import org.eclipse.jpt.core.resource.java.JavaResourcePersistentAttribute;
-import org.eclipse.jpt.eclipselink.core.internal.context.orm.EclipseLinkOrmIdMapping;
-import org.eclipse.jpt.eclipselink.core.internal.context.orm.EclipseLinkOrmOneToOneMapping;
-import org.eclipse.jpt.eclipselink1_1.core.internal.EclipseLink1_1JpaPlatformProvider;
-import org.eclipse.jpt.utility.internal.iterators.ArrayIterator;
-import org.eclipse.wst.common.frameworks.datamodel.DataModelFactory;
-import org.eclipse.wst.common.frameworks.datamodel.IDataModel;
-
-@SuppressWarnings("nls")
-public class EclipseLink1_1OrmPersistentAttributeTests extends EclipseLink1_1OrmContextModelTestCase
-{
-
- @Override
- protected IDataModel buildJpaConfigDataModel() {
- IDataModel dataModel = DataModelFactory.createDataModel(new JpaFacetDataModelProvider());
- dataModel.setProperty(JpaFacetDataModelProperties.PLATFORM_ID, EclipseLink1_1JpaPlatformProvider.ID);
- dataModel.setProperty(JpaFacetDataModelProperties.CREATE_ORM_XML, Boolean.TRUE);
- return dataModel;
- }
-
-
- public EclipseLink1_1OrmPersistentAttributeTests(String name) {
- super(name);
- }
-
-
- private ICompilationUnit createTestTypeNullAttributeMapping() throws Exception {
-
- return this.createTestType(new DefaultAnnotationWriter() {
- @Override
- public void appendIdFieldAnnotationTo(StringBuilder sb) {
- sb.append(CR);
- sb.append(" private Address address;").append(CR);
- sb.append(CR);
- }
- });
- }
-
- private ICompilationUnit createTestEntityIdMapping() throws Exception {
- return this.createTestType(new DefaultAnnotationWriter() {
- @Override
- public Iterator<String> imports() {
- return new ArrayIterator<String>(JPA.ENTITY, JPA.ID, JPA.COLUMN);
- }
- @Override
- public void appendTypeAnnotationTo(StringBuilder sb) {
- sb.append("@Entity");
- }
- @Override
- public void appendIdFieldAnnotationTo(StringBuilder sb) {
- sb.append("@Id");
- sb.append("@Column(name=\"FOO\")");
- }
- });
- }
-
- private ICompilationUnit createTestEntityIdMappingPropertyAccess() throws Exception {
- return this.createTestType(new DefaultAnnotationWriter() {
- @Override
- public Iterator<String> imports() {
- return new ArrayIterator<String>(JPA.ENTITY, JPA.ID, JPA.COLUMN);
- }
- @Override
- public void appendTypeAnnotationTo(StringBuilder sb) {
- sb.append("@Entity");
- }
- @Override
- public void appendGetIdMethodAnnotationTo(StringBuilder sb) {
- sb.append("@Id");
- sb.append("@Column(name=\"FOO\")");
- }
- });
- }
-
- private ICompilationUnit createTestEntityOneToOneMapping() throws Exception {
- return this.createTestType(new DefaultAnnotationWriter() {
- @Override
- public Iterator<String> imports() {
- return new ArrayIterator<String>(JPA.ENTITY, JPA.ONE_TO_ONE);
- }
- @Override
- public void appendTypeAnnotationTo(StringBuilder sb) {
- sb.append("@Entity");
- }
- @Override
- public void appendIdFieldAnnotationTo(StringBuilder sb) {
- sb.append("@OneToOne");
- sb.append(" private Address address;");
- }
- });
- }
-
- public void testMakeSpecified() throws Exception {
- createTestType();
- OrmPersistentType ormPersistentType = getEntityMappings().addPersistentType(MappingKeys.ENTITY_TYPE_MAPPING_KEY, FULLY_QUALIFIED_TYPE_NAME);
-
- assertEquals(2, ormPersistentType.virtualAttributesSize());
-
- OrmPersistentAttribute ormPersistentAttribute = ormPersistentType.virtualAttributes().next();
- assertEquals("id", ormPersistentAttribute.getName());
- assertTrue(ormPersistentAttribute.isVirtual());
- ormPersistentAttribute.makeSpecified();
-
- assertEquals(1, ormPersistentType.virtualAttributesSize());
- assertEquals(1, ormPersistentType.specifiedAttributesSize());
- OrmPersistentAttribute specifiedOrmPersistentAttribute = ormPersistentType.specifiedAttributes().next();
- assertEquals("id", specifiedOrmPersistentAttribute.getName());
- assertFalse(specifiedOrmPersistentAttribute.isVirtual());
-
- ormPersistentAttribute = ormPersistentType.virtualAttributes().next();
- ormPersistentAttribute.makeSpecified();
-
- assertEquals(0, ormPersistentType.virtualAttributesSize());
- assertEquals(2, ormPersistentType.specifiedAttributesSize());
- ListIterator<OrmPersistentAttribute> specifiedAttributes = ormPersistentType.specifiedAttributes();
- specifiedOrmPersistentAttribute = specifiedAttributes.next();
- assertEquals("id", specifiedOrmPersistentAttribute.getName());
- assertFalse(specifiedOrmPersistentAttribute.isVirtual());
-
- specifiedOrmPersistentAttribute = specifiedAttributes.next();
- assertEquals("name", specifiedOrmPersistentAttribute.getName());
- assertFalse(specifiedOrmPersistentAttribute.isVirtual());
- }
-
- public void testMakeSpecifiedMappingKey() throws Exception {
- createTestTypeNullAttributeMapping();
- OrmPersistentType ormPersistentType = getEntityMappings().addPersistentType(MappingKeys.ENTITY_TYPE_MAPPING_KEY, FULLY_QUALIFIED_TYPE_NAME);
-
- assertEquals(3, ormPersistentType.virtualAttributesSize());
-
- //take a virtual mapping with a mapping type and make it specified
- OrmPersistentAttribute ormPersistentAttribute = ormPersistentType.virtualAttributes().next();
- assertEquals("address", ormPersistentAttribute.getName());
- assertTrue(ormPersistentAttribute.isVirtual());
- assertTrue(ormPersistentAttribute.getMapping() instanceof GenericOrmNullAttributeMapping);
- ormPersistentAttribute.makeSpecified(MappingKeys.ONE_TO_ONE_ATTRIBUTE_MAPPING_KEY);
-
- assertEquals(2, ormPersistentType.virtualAttributesSize());
- assertEquals(1, ormPersistentType.specifiedAttributesSize());
- OrmPersistentAttribute specifiedOrmPersistentAttribute = ormPersistentType.specifiedAttributes().next();
- assertEquals("address", specifiedOrmPersistentAttribute.getName());
- assertFalse(specifiedOrmPersistentAttribute.isVirtual());
- assertTrue(specifiedOrmPersistentAttribute.getMapping() instanceof EclipseLinkOrmOneToOneMapping);
-
-
- ormPersistentAttribute = ormPersistentType.virtualAttributes().next();
- ormPersistentAttribute.makeSpecified(MappingKeys.ID_ATTRIBUTE_MAPPING_KEY);
-
- assertEquals(1, ormPersistentType.virtualAttributesSize());
- assertEquals(2, ormPersistentType.specifiedAttributesSize());
- ListIterator<OrmPersistentAttribute> specifiedAttributes = ormPersistentType.specifiedAttributes();
-
- specifiedOrmPersistentAttribute = specifiedAttributes.next();
- assertEquals("id", specifiedOrmPersistentAttribute.getName());
- assertFalse(specifiedOrmPersistentAttribute.isVirtual());
- assertTrue(specifiedOrmPersistentAttribute.getMapping() instanceof EclipseLinkOrmIdMapping);
-
- specifiedOrmPersistentAttribute = specifiedAttributes.next();
- assertEquals("address", specifiedOrmPersistentAttribute.getName());
- assertFalse(specifiedOrmPersistentAttribute.isVirtual());
- }
-
- public void testMakeVirtual() throws Exception {
- createTestType();
- OrmPersistentType ormPersistentType = getEntityMappings().addPersistentType(MappingKeys.ENTITY_TYPE_MAPPING_KEY, FULLY_QUALIFIED_TYPE_NAME);
-
- assertEquals(2, ormPersistentType.virtualAttributesSize());
-
- ormPersistentType.virtualAttributes().next().makeSpecified();
- ormPersistentType.virtualAttributes().next().makeSpecified();
-
- assertEquals(0, ormPersistentType.virtualAttributesSize());
- assertEquals(2, ormPersistentType.specifiedAttributesSize());
- OrmPersistentAttribute specifiedOrmPersistentAttribute = ormPersistentType.specifiedAttributes().next();
- assertEquals("id", specifiedOrmPersistentAttribute.getName());
- assertFalse(specifiedOrmPersistentAttribute.isVirtual());
-
- specifiedOrmPersistentAttribute.makeVirtual();
- assertEquals(1, ormPersistentType.virtualAttributesSize());
- assertEquals(1, ormPersistentType.specifiedAttributesSize());
-
- specifiedOrmPersistentAttribute = ormPersistentType.specifiedAttributes().next();
- specifiedOrmPersistentAttribute.makeVirtual();
- assertEquals(2, ormPersistentType.virtualAttributesSize());
- assertEquals(0, ormPersistentType.specifiedAttributesSize());
-
- ListIterator<OrmPersistentAttribute> virtualAttributes = ormPersistentType.virtualAttributes();
- OrmPersistentAttribute virtualAttribute = virtualAttributes.next();
- assertEquals("id", virtualAttribute.getName());
- virtualAttribute = virtualAttributes.next();
- assertEquals("name", virtualAttribute.getName());
- }
-
- public void testMakeVirtualNoUnderlyingJavaAttribute() throws Exception {
- createTestType();
- OrmPersistentType ormPersistentType = getEntityMappings().addPersistentType(MappingKeys.ENTITY_TYPE_MAPPING_KEY, FULLY_QUALIFIED_TYPE_NAME);
-
- assertEquals(2, ormPersistentType.virtualAttributesSize());
-
- ormPersistentType.virtualAttributes().next().makeSpecified();
- ormPersistentType.virtualAttributes().next().makeSpecified();
-
-
- ormPersistentType.specifiedAttributes().next().getMapping().setName("noJavaAttribute");
- assertEquals(1, ormPersistentType.virtualAttributesSize());
- assertEquals(2, ormPersistentType.specifiedAttributesSize());
-
-
- OrmPersistentAttribute specifiedOrmPersistentAttribute = ormPersistentType.specifiedAttributes().next();
- specifiedOrmPersistentAttribute.makeVirtual();
- assertEquals(1, ormPersistentType.virtualAttributesSize());
- assertEquals(1, ormPersistentType.specifiedAttributesSize());
-
- assertEquals("id", ormPersistentType.virtualAttributes().next().getName());
- assertEquals("name", ormPersistentType.specifiedAttributes().next().getName());
- }
-
- public void testVirtualMappingTypeWhenMetadataComplete() throws Exception {
- createTestEntityIdMapping();
- OrmPersistentType ormPersistentType = getEntityMappings().addPersistentType(MappingKeys.ENTITY_TYPE_MAPPING_KEY, FULLY_QUALIFIED_TYPE_NAME);
-
- OrmPersistentAttribute ormPersistentAttribute = ormPersistentType.virtualAttributes().next();
- assertEquals("id", ormPersistentAttribute.getName());
- assertEquals(MappingKeys.ID_ATTRIBUTE_MAPPING_KEY, ormPersistentAttribute.getMappingKey());
- assertEquals("FOO", ((IdMapping) ormPersistentAttribute.getMapping()).getColumn().getName());
-
-
- ormPersistentType.getMapping().setSpecifiedMetadataComplete(Boolean.TRUE);
-
- ormPersistentAttribute = ormPersistentType.virtualAttributes().next();
- assertEquals("id", ormPersistentAttribute.getName());
- assertEquals(MappingKeys.BASIC_ATTRIBUTE_MAPPING_KEY, ormPersistentAttribute.getMappingKey());
- assertEquals("id", ((BasicMapping) ormPersistentAttribute.getMapping()).getColumn().getName());
- }
-
- public void testVirtualMappingTypeWhenMetadataComplete2() throws Exception {
- createTestEntityOneToOneMapping();
- OrmPersistentType ormPersistentType = getEntityMappings().addPersistentType(MappingKeys.ENTITY_TYPE_MAPPING_KEY, FULLY_QUALIFIED_TYPE_NAME);
-
- OrmPersistentAttribute ormPersistentAttribute = ormPersistentType.virtualAttributes().next();
- assertEquals("address", ormPersistentAttribute.getName());
- assertEquals(MappingKeys.ONE_TO_ONE_ATTRIBUTE_MAPPING_KEY, ormPersistentAttribute.getMappingKey());
-
-
- ormPersistentType.getMapping().setSpecifiedMetadataComplete(Boolean.TRUE);
-
- ormPersistentAttribute = ormPersistentType.virtualAttributes().next();
- assertEquals("address", ormPersistentAttribute.getName());
- assertEquals(MappingKeys.NULL_ATTRIBUTE_MAPPING_KEY, ormPersistentAttribute.getMappingKey());
- }
-
- public void testGetJavaPersistentAttribute() throws Exception {
- createTestEntityIdMapping();
- OrmPersistentType ormPersistentType = getEntityMappings().addPersistentType(MappingKeys.ENTITY_TYPE_MAPPING_KEY, FULLY_QUALIFIED_TYPE_NAME);
- JavaPersistentType javaPersistentType = ormPersistentType.getJavaPersistentType();
-
- OrmPersistentAttribute ormPersistentAttribute = ormPersistentType.getAttributeNamed("id");
- JavaPersistentAttribute javaPersistentAttribute = javaPersistentType.getAttributeNamed("id");
-
- //virtual orm attribute, access type matches java : FIELD, name matches java
- assertTrue(ormPersistentAttribute.isVirtual());
- assertNotSame(javaPersistentAttribute, ormPersistentAttribute.getJavaPersistentAttribute());
- JavaResourcePersistentAttribute javaResourcePersistentAttribute = ormPersistentAttribute.getJavaPersistentAttribute().getResourcePersistentAttribute();
- assertTrue(javaResourcePersistentAttribute.isField());
- assertEquals("id", javaResourcePersistentAttribute.getName());
- assertEquals(javaPersistentType.getResourcePersistentType().persistableFields().next(), javaResourcePersistentAttribute);
-
-
- //specified orm attribute, access type matches java : FIELD, name matches java
- //javaPersistentAttribute should be == to java context model object
- ormPersistentAttribute.makeSpecified();
- ormPersistentAttribute = ormPersistentType.getAttributeNamed("id");
- assertFalse(ormPersistentAttribute.isVirtual());
- assertEquals(javaPersistentAttribute, ormPersistentAttribute.getJavaPersistentAttribute());
-
-
- //virtual orm attribute, java access type FIELD, orm access type PROPERTY, name matches java
- //verify the property java resource persistent attribute is used in orm.
- ormPersistentAttribute.makeVirtual();
- ormPersistentAttribute = ormPersistentType.getAttributeNamed("id");
- ormPersistentType.setSpecifiedAccess(AccessType.PROPERTY);
- assertNotSame(ormPersistentAttribute, ormPersistentType.getAttributeNamed("id"));
- ormPersistentAttribute = ormPersistentType.getAttributeNamed("id");
- assertNotSame(javaPersistentAttribute, ormPersistentAttribute.getJavaPersistentAttribute());
- javaResourcePersistentAttribute = ormPersistentAttribute.getJavaPersistentAttribute().getResourcePersistentAttribute();
- assertTrue(javaResourcePersistentAttribute.isProperty());
- assertEquals("id", javaResourcePersistentAttribute.getName());
- assertEquals(javaPersistentType.getResourcePersistentType().persistableProperties().next(), javaResourcePersistentAttribute);
-
-
- ormPersistentType.setSpecifiedAccess(null);//default access will be field
- ormPersistentAttribute = ormPersistentType.getAttributeNamed("id");
- ormPersistentAttribute.makeSpecified();
- ormPersistentAttribute = ormPersistentType.getAttributeNamed("id");
- ormPersistentAttribute.getMapping().setName("id2");
- assertEquals(null, ormPersistentAttribute.getJavaPersistentAttribute());
-
- ormPersistentAttribute.getMapping().setName(null);
- assertEquals(null, ormPersistentAttribute.getJavaPersistentAttribute());
-
- ormPersistentAttribute.getMapping().setName("id");
- assertEquals(javaPersistentAttribute, ormPersistentAttribute.getJavaPersistentAttribute());
-
-
- ormPersistentType.getMapping().setSpecifiedMetadataComplete(Boolean.TRUE);
- assertEquals(javaPersistentAttribute, ormPersistentAttribute.getJavaPersistentAttribute());
- }
-
- public void testGetJavaPersistentAttributeMixedAccess() throws Exception {
- createTestEntityIdMapping();
- OrmPersistentType ormPersistentType = getEntityMappings().addPersistentType(MappingKeys.ENTITY_TYPE_MAPPING_KEY, FULLY_QUALIFIED_TYPE_NAME);
- ormPersistentType.setSpecifiedAccess(AccessType.PROPERTY);
- JavaPersistentType javaPersistentType = ormPersistentType.getJavaPersistentType();
-
- OrmPersistentAttribute ormPersistentAttribute = ormPersistentType.getAttributeNamed("id");
- JavaPersistentAttribute javaPersistentAttribute = javaPersistentType.getAttributeNamed("id");
-
- assertEquals(AccessType.PROPERTY, ormPersistentAttribute.getAccess());
- assertEquals(AccessType.FIELD, javaPersistentAttribute.getPersistentType().getAccess());
- assertTrue(ormPersistentAttribute.isVirtual());
- assertNotSame(javaPersistentAttribute, ormPersistentAttribute.getJavaPersistentAttribute());
- assertEquals(MappingKeys.BASIC_ATTRIBUTE_MAPPING_KEY, ormPersistentAttribute.getMappingKey());
- assertEquals(MappingKeys.ID_ATTRIBUTE_MAPPING_KEY, javaPersistentAttribute.getMappingKey());
-
-
- ormPersistentAttribute.makeSpecified();
- ormPersistentAttribute = ormPersistentType.getAttributeNamed("id");
- assertFalse(ormPersistentAttribute.isVirtual());
- assertEquals(AccessType.PROPERTY, ormPersistentAttribute.getAccess());
- assertNotSame(javaPersistentAttribute, ormPersistentAttribute.getJavaPersistentAttribute());
- assertTrue(ormPersistentAttribute.getJavaPersistentAttribute().getResourcePersistentAttribute().isProperty());
- assertTrue(javaPersistentAttribute.getResourcePersistentAttribute().isField());
-
- ormPersistentAttribute.setSpecifiedAccess(AccessType.FIELD);
- ormPersistentAttribute = ormPersistentType.getAttributeNamed("id");
- assertFalse(ormPersistentAttribute.isVirtual());
- assertEquals(AccessType.FIELD, ormPersistentAttribute.getAccess());
- assertEquals(javaPersistentAttribute, ormPersistentAttribute.getJavaPersistentAttribute());
- assertTrue(ormPersistentAttribute.getJavaPersistentAttribute().getResourcePersistentAttribute().isField());
- assertTrue(javaPersistentAttribute.getResourcePersistentAttribute().isField());
- }
-
- public void testGetAccess() throws Exception {
- createTestEntityIdMapping();
- OrmPersistentType ormPersistentType = getEntityMappings().addPersistentType(MappingKeys.ENTITY_TYPE_MAPPING_KEY, FULLY_QUALIFIED_TYPE_NAME);
- JavaPersistentType javaPersistentType = ormPersistentType.getJavaPersistentType();
-
- OrmPersistentAttribute ormPersistentAttribute = ormPersistentType.getAttributeNamed("id");
- JavaPersistentAttribute javaPersistentAttribute = javaPersistentType.getAttributeNamed("id");
-
- assertTrue(ormPersistentAttribute.isVirtual());
- assertEquals(AccessType.FIELD, ormPersistentAttribute.getAccess());
- assertTrue(ormPersistentAttribute.getJavaPersistentAttribute().getResourcePersistentAttribute().isField());
- assertEquals(AccessType.FIELD, javaPersistentAttribute.getAccess());
- assertTrue(javaPersistentAttribute.getResourcePersistentAttribute().isField());
-
-
- ormPersistentAttribute.makeSpecified();
- ormPersistentAttribute = ormPersistentType.getAttributeNamed("id");
- assertFalse(ormPersistentAttribute.isVirtual());
- assertEquals(AccessType.FIELD, ormPersistentAttribute.getAccess());
- assertTrue(ormPersistentAttribute.getJavaPersistentAttribute().getResourcePersistentAttribute().isField());
- assertEquals(AccessType.FIELD, javaPersistentAttribute.getAccess());
- assertTrue(javaPersistentAttribute.getResourcePersistentAttribute().isField());
-
-
- ormPersistentType.getMapping().setSpecifiedMetadataComplete(Boolean.TRUE);
- assertFalse(ormPersistentAttribute.isVirtual());
- assertEquals(AccessType.FIELD, ormPersistentAttribute.getAccess());
- assertEquals(javaPersistentAttribute, ormPersistentAttribute.getJavaPersistentAttribute());
- assertEquals(AccessType.FIELD, ormPersistentAttribute.getJavaPersistentAttribute().getAccess());
- assertEquals(AccessType.FIELD, javaPersistentAttribute.getAccess());
- assertTrue(javaPersistentAttribute.getResourcePersistentAttribute().isField());
- }
-
- public void testGetAccessPropertyInJava() throws Exception {
- createTestEntityIdMappingPropertyAccess();
- OrmPersistentType ormPersistentType = getEntityMappings().addPersistentType(MappingKeys.ENTITY_TYPE_MAPPING_KEY, FULLY_QUALIFIED_TYPE_NAME);
- JavaPersistentType javaPersistentType = ormPersistentType.getJavaPersistentType();
-
- OrmPersistentAttribute ormPersistentAttribute = ormPersistentType.getAttributeNamed("id");
- JavaPersistentAttribute javaPersistentAttribute = javaPersistentType.getAttributeNamed("id");
-
- assertTrue(ormPersistentAttribute.isVirtual());
- assertEquals(AccessType.PROPERTY, ormPersistentAttribute.getAccess());
- assertTrue(ormPersistentAttribute.getJavaPersistentAttribute().getResourcePersistentAttribute().isProperty());
- assertEquals(AccessType.PROPERTY, javaPersistentAttribute.getAccess());
- assertTrue(javaPersistentAttribute.getResourcePersistentAttribute().isProperty());
-
-
- ormPersistentAttribute.makeSpecified();
- ormPersistentAttribute = ormPersistentType.getAttributeNamed("id");
- assertFalse(ormPersistentAttribute.isVirtual());
- assertEquals(AccessType.PROPERTY, ormPersistentAttribute.getAccess());
- assertTrue(ormPersistentAttribute.getJavaPersistentAttribute().getResourcePersistentAttribute().isProperty());
- assertEquals(AccessType.PROPERTY, javaPersistentAttribute.getAccess());
- assertTrue(javaPersistentAttribute.getResourcePersistentAttribute().isProperty());
-
-
- ormPersistentType.getMapping().setSpecifiedMetadataComplete(Boolean.TRUE);
- assertFalse(ormPersistentAttribute.isVirtual());
- assertEquals(AccessType.FIELD, ormPersistentAttribute.getAccess());
- assertNotSame(javaPersistentAttribute, ormPersistentAttribute.getJavaPersistentAttribute());
- assertEquals(AccessType.FIELD, ormPersistentAttribute.getJavaPersistentAttribute().getAccess());
- assertEquals(AccessType.PROPERTY, javaPersistentAttribute.getAccess());
- assertTrue(javaPersistentAttribute.getResourcePersistentAttribute().isProperty());
- }
-
-} \ No newline at end of file
diff --git a/jpa/tests/org.eclipse.jpt.eclipselink.core.tests/src/org/eclipse/jpt/eclipselink1_1/core/tests/internal/context/orm/EclipseLink1_1OrmPersistentTypeTests.java b/jpa/tests/org.eclipse.jpt.eclipselink.core.tests/src/org/eclipse/jpt/eclipselink1_1/core/tests/internal/context/orm/EclipseLink1_1OrmPersistentTypeTests.java
deleted file mode 100644
index b84ff48f39..0000000000
--- a/jpa/tests/org.eclipse.jpt.eclipselink.core.tests/src/org/eclipse/jpt/eclipselink1_1/core/tests/internal/context/orm/EclipseLink1_1OrmPersistentTypeTests.java
+++ /dev/null
@@ -1,306 +0,0 @@
-/*******************************************************************************
- * Copyright (c) 2009 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.
- *
- * Contributors:
- * Oracle - initial API and implementation
- *******************************************************************************/
-package org.eclipse.jpt.eclipselink1_1.core.tests.internal.context.orm;
-
-import java.util.Iterator;
-import org.eclipse.jdt.core.ICompilationUnit;
-import org.eclipse.jpt.core.MappingKeys;
-import org.eclipse.jpt.core.context.AccessType;
-import org.eclipse.jpt.core.context.java.JavaPersistentType;
-import org.eclipse.jpt.core.context.orm.OrmPersistentAttribute;
-import org.eclipse.jpt.core.context.orm.OrmPersistentType;
-import org.eclipse.jpt.core.internal.facet.JpaFacetDataModelProperties;
-import org.eclipse.jpt.core.internal.facet.JpaFacetDataModelProvider;
-import org.eclipse.jpt.core.resource.java.JPA;
-import org.eclipse.jpt.eclipselink1_1.core.internal.EclipseLink1_1JpaPlatformProvider;
-import org.eclipse.jpt.utility.internal.iterators.ArrayIterator;
-import org.eclipse.wst.common.frameworks.datamodel.DataModelFactory;
-import org.eclipse.wst.common.frameworks.datamodel.IDataModel;
-
-@SuppressWarnings("nls")
-public class EclipseLink1_1OrmPersistentTypeTests extends EclipseLink1_1OrmContextModelTestCase
-{
-
- @Override
- protected IDataModel buildJpaConfigDataModel() {
- IDataModel dataModel = DataModelFactory.createDataModel(new JpaFacetDataModelProvider());
- dataModel.setProperty(JpaFacetDataModelProperties.PLATFORM_ID, EclipseLink1_1JpaPlatformProvider.ID);
- dataModel.setProperty(JpaFacetDataModelProperties.CREATE_ORM_XML, Boolean.TRUE);
- return dataModel;
- }
-
-
- public EclipseLink1_1OrmPersistentTypeTests(String name) {
- super(name);
- }
-
-
- private ICompilationUnit createTestEntityIdMapping() throws Exception {
- return this.createTestType(new DefaultAnnotationWriter() {
- @Override
- public Iterator<String> imports() {
- return new ArrayIterator<String>(JPA.ENTITY, JPA.ID, JPA.COLUMN);
- }
- @Override
- public void appendTypeAnnotationTo(StringBuilder sb) {
- sb.append("@Entity");
- }
- @Override
- public void appendIdFieldAnnotationTo(StringBuilder sb) {
- sb.append("@Id");
- sb.append("@Column(name=\"FOO\")");
- }
- });
- }
-//
-// private void createAccessTypeEnum() throws Exception {
-// this.createEnumAndMembers(JPA_ANNOTATIONS_PACKAGE_NAME, "AccessType", "FIELD, PROPERTY;");
-// }
-//
-// private void createAccessAnnotation() throws Exception {
-// this.createAnnotationAndMembers(JPA_ANNOTATIONS_PACKAGE_NAME, "Access", "AccessType value();");
-// createAccessTypeEnum();
-// }
-//
-// private ICompilationUnit createTestEntityAnnotatedFieldPropertySpecified() throws Exception {
-// createAccessAnnotation();
-// return this.createTestType(new DefaultAnnotationWriter() {
-// @Override
-// public Iterator<String> imports() {
-// return new ArrayIterator<String>(JPA.ENTITY, JPA.BASIC, JPA.ID, JPA.ACCESS, JPA.ACCESS_TYPE);
-// }
-// @Override
-// public void appendTypeAnnotationTo(StringBuilder sb) {
-// sb.append("@Entity");
-// sb.append("@Access(AccessType.PROPERTY)");
-// }
-//
-// @Override
-// public void appendNameFieldAnnotationTo(StringBuilder sb) {
-// sb.append("@Basic");
-// sb.append("@Access(AccessType.FIELD)");
-// }
-//
-// @Override
-// public void appendGetIdMethodAnnotationTo(StringBuilder sb) {
-// sb.append("@Id");
-// }
-// });
-// }
-//
-// private ICompilationUnit createTestEntityFieldSpecifiedPropertyAnnotated() throws Exception {
-// createAccessAnnotation();
-// return this.createTestType(new DefaultAnnotationWriter() {
-// @Override
-// public Iterator<String> imports() {
-// return new ArrayIterator<String>(JPA.ENTITY, JPA.BASIC, JPA.ID, JPA.ACCESS, JPA.ACCESS_TYPE);
-// }
-// @Override
-// public void appendTypeAnnotationTo(StringBuilder sb) {
-// sb.append("@Entity");
-// sb.append("@Access(AccessType.FIELD)");
-// }
-//
-// @Override
-// public void appendGetIdMethodAnnotationTo(StringBuilder sb) {
-// sb.append("@Id");
-// sb.append("@Access(AccessType.PROPERTY)");
-// }
-// });
-// }
-//
-// private ICompilationUnit createTestEntityPropertySpecified() throws Exception {
-// createAccessAnnotation();
-// return this.createTestType(new DefaultAnnotationWriter() {
-// @Override
-// public Iterator<String> imports() {
-// return new ArrayIterator<String>(JPA.ENTITY, JPA.ACCESS, JPA.ACCESS_TYPE);
-// }
-// @Override
-// public void appendTypeAnnotationTo(StringBuilder sb) {
-// sb.append("@Entity");
-// sb.append("@Access(AccessType.PROPERTY)");
-// }
-// });
-// }
-
- public void testGetAccessWithJavaAnnotations() throws Exception {
- createTestEntityIdMapping();
- OrmPersistentType ormPersistentType = getEntityMappings().addPersistentType(MappingKeys.ENTITY_TYPE_MAPPING_KEY, FULLY_QUALIFIED_TYPE_NAME);
- JavaPersistentType javaPersistentType = ormPersistentType.getJavaPersistentType();
-
- assertEquals(AccessType.FIELD, ormPersistentType.getAccess());
- assertEquals(AccessType.FIELD, javaPersistentType.getAccess());
- assertEquals(null, javaPersistentType.getSpecifiedAccess());
-
-
- OrmPersistentAttribute ormPersistentAttribute = ormPersistentType.getAttributeNamed("id");
- ormPersistentAttribute.makeSpecified();
- assertEquals(AccessType.FIELD, ormPersistentType.getAccess());
- assertEquals(AccessType.FIELD, javaPersistentType.getAccess());
- assertEquals(null, javaPersistentType.getSpecifiedAccess());
-
- ormPersistentType.getMapping().setSpecifiedMetadataComplete(Boolean.TRUE);
- assertEquals(AccessType.FIELD, ormPersistentType.getAccess());
- assertEquals(AccessType.FIELD, javaPersistentType.getAccess());
- }
-
-//TODO Access annotation test
-// public void testGetAccessWithJavaAnnotationsProperty() throws Exception {
-// createTestEntityAnnotatedFieldPropertySpecified();
-// OrmPersistentType ormPersistentType = getEntityMappings().addPersistentType(MappingKeys.ENTITY_TYPE_MAPPING_KEY, FULLY_QUALIFIED_TYPE_NAME);
-// JavaPersistentType javaPersistentType = ormPersistentType.getJavaPersistentType();
-//
-// assertEquals(AccessType.PROPERTY, ormPersistentType.getAccess());
-// assertEquals(AccessType.PROPERTY, javaPersistentType.getAccess());
-// assertEquals(AccessType.PROPERTY, javaPersistentType.getSpecifiedAccess());
-//
-//
-// OrmPersistentAttribute ormPersistentAttribute = ormPersistentType.getAttributeNamed("id");
-// ormPersistentAttribute.makeSpecified();
-// assertEquals(AccessType.PROPERTY, ormPersistentType.getAccess());
-// assertEquals(AccessType.PROPERTY, javaPersistentType.getAccess());
-// assertEquals(AccessType.PROPERTY, javaPersistentType.getSpecifiedAccess());
-//
-// ormPersistentType.getMapping().setSpecifiedMetadataComplete(Boolean.TRUE);
-// assertEquals(AccessType.FIELD, ormPersistentType.getAccess());
-// assertEquals(AccessType.PROPERTY, javaPersistentType.getAccess());
-// }
-//
-// public void testVirtualAttributes() throws Exception {
-// createTestEntityAnnotatedFieldPropertySpecified();
-// OrmPersistentType ormPersistentType = getEntityMappings().addPersistentType(MappingKeys.ENTITY_TYPE_MAPPING_KEY, FULLY_QUALIFIED_TYPE_NAME);
-//
-// ListIterator<OrmPersistentAttribute> virtualAttributes = ormPersistentType.virtualAttributes();
-// OrmPersistentAttribute ormPersistentAttribute = virtualAttributes.next();
-// assertEquals("id", ormPersistentAttribute.getName());
-// assertEquals(AccessType.PROPERTY, ormPersistentAttribute.getAccess());
-//
-//
-// ormPersistentAttribute = virtualAttributes.next();
-// assertEquals("name", ormPersistentAttribute.getName());
-// assertEquals(AccessType.FIELD, ormPersistentAttribute.getAccess());
-//
-// assertFalse(virtualAttributes.hasNext());
-//
-// ormPersistentType.getMapping().setSpecifiedMetadataComplete(Boolean.TRUE);
-// virtualAttributes = ormPersistentType.virtualAttributes();
-// ormPersistentAttribute = virtualAttributes.next();
-// assertEquals("id", ormPersistentAttribute.getName());
-// assertEquals(AccessType.FIELD, ormPersistentAttribute.getAccess());
-//
-//
-// ormPersistentAttribute = virtualAttributes.next();
-// assertEquals("name", ormPersistentAttribute.getName());
-// assertEquals(AccessType.FIELD, ormPersistentAttribute.getAccess());
-//
-// assertFalse(virtualAttributes.hasNext());
-// }
-//
-// public void testVirtualAttributes2() throws Exception {
-// createTestEntityPropertySpecified();
-// OrmPersistentType ormPersistentType = getEntityMappings().addPersistentType(MappingKeys.ENTITY_TYPE_MAPPING_KEY, FULLY_QUALIFIED_TYPE_NAME);
-//
-// ListIterator<OrmPersistentAttribute> virtualAttributes = ormPersistentType.virtualAttributes();
-// OrmPersistentAttribute ormPersistentAttribute = virtualAttributes.next();
-// assertEquals("id", ormPersistentAttribute.getName());
-// assertEquals(AccessType.PROPERTY, ormPersistentAttribute.getAccess());
-//
-// assertFalse(virtualAttributes.hasNext());
-//
-// ormPersistentType.getMapping().setSpecifiedMetadataComplete(Boolean.TRUE);
-// virtualAttributes = ormPersistentType.virtualAttributes();
-// ormPersistentAttribute = virtualAttributes.next();
-// assertEquals("id", ormPersistentAttribute.getName());
-// assertEquals(AccessType.FIELD, ormPersistentAttribute.getAccess());
-//
-//
-// ormPersistentAttribute = virtualAttributes.next();
-// assertEquals("name", ormPersistentAttribute.getName());
-// assertEquals(AccessType.FIELD, ormPersistentAttribute.getAccess());
-//
-// assertFalse(virtualAttributes.hasNext());
-//
-// ormPersistentType.getMapping().setSpecifiedMetadataComplete(Boolean.FALSE);
-// virtualAttributes = ormPersistentType.virtualAttributes();
-// ormPersistentAttribute = virtualAttributes.next();
-// assertEquals("id", ormPersistentAttribute.getName());
-// assertEquals(AccessType.PROPERTY, ormPersistentAttribute.getAccess());
-//
-// assertFalse(virtualAttributes.hasNext());
-// }
-//
-// public void testVirtualAttributes3() throws Exception {
-// createTestEntityFieldSpecifiedPropertyAnnotated();
-// OrmPersistentType ormPersistentType = getEntityMappings().addPersistentType(MappingKeys.ENTITY_TYPE_MAPPING_KEY, FULLY_QUALIFIED_TYPE_NAME);
-//
-// ListIterator<OrmPersistentAttribute> virtualAttributes = ormPersistentType.virtualAttributes();
-// OrmPersistentAttribute ormPersistentAttribute = virtualAttributes.next();
-// assertEquals("id", ormPersistentAttribute.getName());
-// assertEquals(AccessType.FIELD, ormPersistentAttribute.getAccess());
-//
-// ormPersistentAttribute = virtualAttributes.next();
-// assertEquals("name", ormPersistentAttribute.getName());
-// assertEquals(AccessType.FIELD, ormPersistentAttribute.getAccess());
-//
-// ormPersistentAttribute = virtualAttributes.next();
-// assertEquals("id", ormPersistentAttribute.getName());
-// assertEquals(AccessType.PROPERTY, ormPersistentAttribute.getAccess());
-//
-// assertFalse(virtualAttributes.hasNext());
-//
-//
-// ormPersistentAttribute.makeSpecified();
-//
-// virtualAttributes = ormPersistentType.virtualAttributes();
-// ormPersistentAttribute = virtualAttributes.next();
-// assertEquals("id", ormPersistentAttribute.getName());
-// assertEquals(AccessType.FIELD, ormPersistentAttribute.getAccess());
-//
-// ormPersistentAttribute = virtualAttributes.next();
-// assertEquals("name", ormPersistentAttribute.getName());
-// assertEquals(AccessType.FIELD, ormPersistentAttribute.getAccess());
-//
-// assertFalse(virtualAttributes.hasNext());
-//
-//
-// OrmPersistentAttribute specifiedPersistentAttribute = ormPersistentType.specifiedAttributes().next();
-// assertEquals("id", specifiedPersistentAttribute.getName());
-// assertEquals(AccessType.PROPERTY, specifiedPersistentAttribute.getSpecifiedAccess());
-//
-//
-// ormPersistentType.virtualAttributes().next().makeSpecified();
-// virtualAttributes = ormPersistentType.virtualAttributes();
-// ormPersistentAttribute = virtualAttributes.next();
-// assertEquals("name", ormPersistentAttribute.getName());
-// assertEquals(AccessType.FIELD, ormPersistentAttribute.getAccess());
-//
-// assertFalse(virtualAttributes.hasNext());
-// }
-//
-// public void testGetDefaultAccess() throws Exception {
-// createTestEntityPropertySpecified();
-// OrmPersistentType ormPersistentType = getEntityMappings().addPersistentType(MappingKeys.ENTITY_TYPE_MAPPING_KEY, FULLY_QUALIFIED_TYPE_NAME);
-// JavaPersistentType javaPersistentType = ormPersistentType.getJavaPersistentType();
-//
-// assertEquals(AccessType.PROPERTY, ormPersistentType.getDefaultAccess());
-//
-// javaPersistentType.setSpecifiedAccess(AccessType.FIELD);
-// assertEquals(AccessType.FIELD, ormPersistentType.getDefaultAccess());
-//
-// javaPersistentType.setSpecifiedAccess(AccessType.PROPERTY);
-// assertEquals(AccessType.PROPERTY, ormPersistentType.getDefaultAccess());
-//
-//
-// ormPersistentType.getMapping().setSpecifiedMetadataComplete(Boolean.TRUE);
-// assertEquals(AccessType.FIELD, ormPersistentType.getDefaultAccess());
-// }
-
-} \ No newline at end of file
diff --git a/jpa/tests/org.eclipse.jpt.eclipselink.core.tests/src/org/eclipse/jpt/eclipselink1_1/core/tests/internal/context/orm/EclipseLink1_1OrmTransientMappingTests.java b/jpa/tests/org.eclipse.jpt.eclipselink.core.tests/src/org/eclipse/jpt/eclipselink1_1/core/tests/internal/context/orm/EclipseLink1_1OrmTransientMappingTests.java
deleted file mode 100644
index e2efb6aad2..0000000000
--- a/jpa/tests/org.eclipse.jpt.eclipselink.core.tests/src/org/eclipse/jpt/eclipselink1_1/core/tests/internal/context/orm/EclipseLink1_1OrmTransientMappingTests.java
+++ /dev/null
@@ -1,63 +0,0 @@
-/*******************************************************************************
- * Copyright (c) 2009 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.
- *
- * Contributors:
- * Oracle - initial API and implementation
- *******************************************************************************/
-package org.eclipse.jpt.eclipselink1_1.core.tests.internal.context.orm;
-
-import java.util.Iterator;
-import org.eclipse.jdt.core.ICompilationUnit;
-import org.eclipse.jpt.core.MappingKeys;
-import org.eclipse.jpt.core.context.orm.OrmPersistentAttribute;
-import org.eclipse.jpt.core.context.orm.OrmPersistentType;
-import org.eclipse.jpt.core.resource.java.JPA;
-import org.eclipse.jpt.utility.internal.iterators.ArrayIterator;
-
-@SuppressWarnings("nls")
-public class EclipseLink1_1OrmTransientMappingTests
- extends EclipseLink1_1OrmContextModelTestCase
-{
- public EclipseLink1_1OrmTransientMappingTests(String name) {
- super(name);
- }
-
- private ICompilationUnit createTestEntityWithTransientMapping() throws Exception {
- return this.createTestType(new DefaultAnnotationWriter() {
- @Override
- public Iterator<String> imports() {
- return new ArrayIterator<String>(JPA.ENTITY, JPA.TRANSIENT);
- }
- @Override
- public void appendTypeAnnotationTo(StringBuilder sb) {
- sb.append("@Entity").append(CR);
- }
-
- @Override
- public void appendIdFieldAnnotationTo(StringBuilder sb) {
- sb.append("@Transient").append(CR);
- }
- });
- }
-
- public void testCreateTransientMapping() throws Exception {
- createTestEntityWithTransientMapping();
- OrmPersistentType ormPersistentType =
- getEntityMappings().addPersistentType(MappingKeys.ENTITY_TYPE_MAPPING_KEY, FULLY_QUALIFIED_TYPE_NAME);
-
- OrmPersistentAttribute persistentAttribute = ormPersistentType.getAttributeNamed("id");
- assertTrue(persistentAttribute.isVirtual());
- assertEquals(MappingKeys.TRANSIENT_ATTRIBUTE_MAPPING_KEY, persistentAttribute.getMappingKey());
-
- ormPersistentType.addSpecifiedPersistentAttribute(MappingKeys.TRANSIENT_ATTRIBUTE_MAPPING_KEY, "id");
-
- persistentAttribute = ormPersistentType.getAttributeNamed("id");
- assertFalse(persistentAttribute.isVirtual());
- assertEquals(MappingKeys.TRANSIENT_ATTRIBUTE_MAPPING_KEY, persistentAttribute.getMappingKey());
- assertEquals(MappingKeys.TRANSIENT_ATTRIBUTE_MAPPING_KEY, persistentAttribute.getSpecifiedMapping().getKey());
- }
-
-}
diff --git a/jpa/tests/org.eclipse.jpt.eclipselink.core.tests/src/org/eclipse/jpt/eclipselink1_1/core/tests/internal/context/orm/JptEclipseLink1_1CoreOrmContextModelTests.java b/jpa/tests/org.eclipse.jpt.eclipselink.core.tests/src/org/eclipse/jpt/eclipselink1_1/core/tests/internal/context/orm/JptEclipseLink1_1CoreOrmContextModelTests.java
deleted file mode 100644
index b0cb3c3956..0000000000
--- a/jpa/tests/org.eclipse.jpt.eclipselink.core.tests/src/org/eclipse/jpt/eclipselink1_1/core/tests/internal/context/orm/JptEclipseLink1_1CoreOrmContextModelTests.java
+++ /dev/null
@@ -1,37 +0,0 @@
-/*******************************************************************************
- * Copyright (c) 2007, 2009 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
- *
- * Contributors:
- * Oracle - initial API and implementation
- *******************************************************************************/
-package org.eclipse.jpt.eclipselink1_1.core.tests.internal.context.orm;
-
-import junit.framework.Test;
-import junit.framework.TestCase;
-import junit.framework.TestSuite;
-
-public class JptEclipseLink1_1CoreOrmContextModelTests extends TestCase
-{
- public static Test suite() {
- return suite(true);
- }
-
- public static Test suite(boolean all) {
- TestSuite suite = new TestSuite(JptEclipseLink1_1CoreOrmContextModelTests.class.getName());
-
- suite.addTestSuite(EclipseLink1_1OrmPersistentAttributeTests.class);
- suite.addTestSuite(EclipseLink1_1OrmPersistentTypeTests.class);
- suite.addTestSuite(EclipseLink1_1OrmTransientMappingTests.class);
-
- return suite;
- }
-
-
- private JptEclipseLink1_1CoreOrmContextModelTests() {
- throw new UnsupportedOperationException();
- }
-}
diff --git a/jpa/tests/org.eclipse.jpt.eclipselink.core.tests/test.xml b/jpa/tests/org.eclipse.jpt.eclipselink.core.tests/test.xml
deleted file mode 100644
index c9b0c61971..0000000000
--- a/jpa/tests/org.eclipse.jpt.eclipselink.core.tests/test.xml
+++ /dev/null
@@ -1,47 +0,0 @@
-<?xml version="1.0"?>
-<project name="testsuite" default="run" basedir=".">
- <!-- The property ${eclipse-home} should be passed into this script -->
- <!-- Set a meaningful default value for when it is not. -->
- <echo message="basedir ${basedir}" />
- <echo message="eclipse place ${eclipse-home}" />
- <!-- sets the properties plugin-name -->
- <property name="plugin-name" value="org.eclipse.jpt.eclipselink.core.tests"/>
- <echo level="debug" message="testRoot: ${testRoot}" />
- <fail message="testRoot must be set" unless="testRoot" />
-
- <!-- This target holds all initialization code that needs to be done for -->
- <!-- all tests that are to be run. Initialization for individual tests -->
- <!-- should be done within the body of the suite target. -->
- <target name="init">
- <tstamp/>
- <delete>
- <fileset dir="${eclipse-home}" includes="org*.xml"/>
- </delete>
- </target>
-
- <!-- This target defines the tests that need to be run. -->
- <target name="suite">
- <property file="${testRoot}/testServer.properties"/>
- <property name="jpt-folder" value="${eclipse-home}/jpt_folder"/>
- <delete dir="${jpt-folder}" quiet="true"/>
-
- <ant target="core-test" antfile="${library-file}" dir="${eclipse-home}">
- <property name="data-dir" value="${jpt-folder}"/>
- <property name="plugin-name" value="${plugin-name}"/>
- <property name="classname" value="org.eclipse.jpt.eclipselink.core.tests.internal.JptEclipseLinkCoreTests" />
- <property name="plugin-path" value="${eclipse-home}/plugins/${plugin-name}"/>
- <property name="extraVMargs" value="-Dorg.eclipse.jpt.jpa.jar=${testDir}/${jpt-persistence-jar} -Dorg.eclipse.jpt.eclipselink.jar=${testDir}/${jpt-eclipselink-jar}"/>
- </ant>
- </target>
-
- <!-- This target holds code to cleanup the testing environment after -->
- <!-- after all of the tests have been run. You can use this target to -->
- <!-- delete temporary files that have been created. -->
- <target name="cleanup">
- </target>
-
- <!-- This target runs the test suite. Any actions that need to happen -->
- <!-- after all the tests have been run should go here. -->
- <target name="run" depends="init, suite, cleanup">
- </target>
-</project> \ No newline at end of file
diff --git a/jpa/tests/org.eclipse.jpt.gen.tests/.classpath b/jpa/tests/org.eclipse.jpt.gen.tests/.classpath
deleted file mode 100644
index 84744e7e8a..0000000000
--- a/jpa/tests/org.eclipse.jpt.gen.tests/.classpath
+++ /dev/null
@@ -1,11 +0,0 @@
-<?xml version="1.0" encoding="UTF-8"?>
-<classpath>
- <classpathentry kind="con" path="org.eclipse.jdt.launching.JRE_CONTAINER/org.eclipse.jdt.internal.debug.ui.launcher.StandardVMType/J2SE-1.5"/>
- <classpathentry kind="con" path="org.eclipse.pde.core.requiredPlugins">
- <accessrules>
- <accessrule kind="accessible" pattern="org/eclipse/jpt/gen/**"/>
- </accessrules>
- </classpathentry>
- <classpathentry kind="src" path="src"/>
- <classpathentry kind="output" path="bin"/>
-</classpath>
diff --git a/jpa/tests/org.eclipse.jpt.gen.tests/.project b/jpa/tests/org.eclipse.jpt.gen.tests/.project
deleted file mode 100644
index 2159feb5ef..0000000000
--- a/jpa/tests/org.eclipse.jpt.gen.tests/.project
+++ /dev/null
@@ -1,28 +0,0 @@
-<?xml version="1.0" encoding="UTF-8"?>
-<projectDescription>
- <name>org.eclipse.jpt.gen.tests</name>
- <comment></comment>
- <projects>
- </projects>
- <buildSpec>
- <buildCommand>
- <name>org.eclipse.jdt.core.javabuilder</name>
- <arguments>
- </arguments>
- </buildCommand>
- <buildCommand>
- <name>org.eclipse.pde.ManifestBuilder</name>
- <arguments>
- </arguments>
- </buildCommand>
- <buildCommand>
- <name>org.eclipse.pde.SchemaBuilder</name>
- <arguments>
- </arguments>
- </buildCommand>
- </buildSpec>
- <natures>
- <nature>org.eclipse.pde.PluginNature</nature>
- <nature>org.eclipse.jdt.core.javanature</nature>
- </natures>
-</projectDescription>
diff --git a/jpa/tests/org.eclipse.jpt.gen.tests/.settings/org.eclipse.jdt.core.prefs b/jpa/tests/org.eclipse.jpt.gen.tests/.settings/org.eclipse.jdt.core.prefs
deleted file mode 100644
index 8bab913c29..0000000000
--- a/jpa/tests/org.eclipse.jpt.gen.tests/.settings/org.eclipse.jdt.core.prefs
+++ /dev/null
@@ -1,7 +0,0 @@
-#Mon Jul 07 20:13:24 EDT 2008
-eclipse.preferences.version=1
-org.eclipse.jdt.core.compiler.codegen.targetPlatform=1.5
-org.eclipse.jdt.core.compiler.compliance=1.5
-org.eclipse.jdt.core.compiler.problem.assertIdentifier=error
-org.eclipse.jdt.core.compiler.problem.enumIdentifier=error
-org.eclipse.jdt.core.compiler.source=1.5
diff --git a/jpa/tests/org.eclipse.jpt.gen.tests/META-INF/MANIFEST.MF b/jpa/tests/org.eclipse.jpt.gen.tests/META-INF/MANIFEST.MF
deleted file mode 100644
index 5fe445a1de..0000000000
--- a/jpa/tests/org.eclipse.jpt.gen.tests/META-INF/MANIFEST.MF
+++ /dev/null
@@ -1,14 +0,0 @@
-Manifest-Version: 1.0
-Bundle-ManifestVersion: 2
-Bundle-Name: %pluginName
-Bundle-SymbolicName: org.eclipse.jpt.gen.tests
-Bundle-Version: 2.0.0
-Bundle-RequiredExecutionEnvironment: J2SE-1.5
-Bundle-Vendor: %providerName
-Require-Bundle: org.eclipse.core.runtime;bundle-version="3.4.0",
- org.eclipse.jdt.core;bundle-version="3.4.0",
- org.eclipse.jpt.utility;bundle-version="1.2.0",
- org.eclipse.jpt.db;bundle-version="1.1.1",
- org.eclipse.jpt.gen;bundle-version="1.1.0",
- org.junit;bundle-version="3.8.2"
-Export-Package: org.eclipse.jpt.gen.tests.internal;x-internal:=true
diff --git a/jpa/tests/org.eclipse.jpt.gen.tests/about.html b/jpa/tests/org.eclipse.jpt.gen.tests/about.html
deleted file mode 100644
index be534ba44f..0000000000
--- a/jpa/tests/org.eclipse.jpt.gen.tests/about.html
+++ /dev/null
@@ -1,34 +0,0 @@
-<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.0//EN">
-<HTML>
-
-<head>
-<title>About</title>
-<meta http-equiv=Content-Type content="text/html; charset=ISO-8859-1">
-</head>
-
-<BODY lang="EN-US">
-
-<H3>About This Content</H3>
-
-<P>May 02, 2008</P>
-
-<H3>License</H3>
-
-<P>The Eclipse Foundation makes available all content in this plug-in
-("Content"). Unless otherwise indicated below, the Content is provided to you
-under the terms and conditions of the Eclipse Public License Version 1.0
-("EPL"). A copy of the EPL is available at
-<A href="http://www.eclipse.org/org/documents/epl-v10.php">http://www.eclipse.org/org/documents/epl-v10.php</A>.
-For purposes of the EPL, "Program" will mean the Content.</P>
-
-<P>If you did not receive this Content directly from the Eclipse Foundation, the
-Content is being redistributed by another party ("Redistributor") and different
-terms and conditions may apply to your use of any object code in the Content.
-Check the Redistributor's license that was provided with the Content. If no such
-license exists, contact the Redistributor. Unless otherwise indicated below, the
-terms and conditions of the EPL still apply to any source code in the Content
-and such source code may be obtained at
-<A href="http://www.eclipse.org/">http://www.eclipse.org/</A>.</P>
-
-</BODY>
-</HTML>
diff --git a/jpa/tests/org.eclipse.jpt.gen.tests/build.properties b/jpa/tests/org.eclipse.jpt.gen.tests/build.properties
deleted file mode 100644
index e68d4bf9e4..0000000000
--- a/jpa/tests/org.eclipse.jpt.gen.tests/build.properties
+++ /dev/null
@@ -1,18 +0,0 @@
-################################################################################
-# Copyright (c) 2008 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.
-#
-# Contributors:
-# Oracle - initial API and implementation
-################################################################################
-javacSource = 1.5
-javacTarget = 1.5
-bin.includes = .,\
- META-INF/,\
- about.html,\
- test.xml,\
- plugin.properties
-source.. = src/
-output.. = bin/
diff --git a/jpa/tests/org.eclipse.jpt.gen.tests/plugin.properties b/jpa/tests/org.eclipse.jpt.gen.tests/plugin.properties
deleted file mode 100644
index 269a5dc154..0000000000
--- a/jpa/tests/org.eclipse.jpt.gen.tests/plugin.properties
+++ /dev/null
@@ -1,22 +0,0 @@
-###############################################################################
-# Copyright (c) 2006, 2007 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
-#
-# Contributors: Oracle. - initial API and implementation
-###############################################################################
-# ====================================================================
-# To code developer:
-# Do NOT change the properties between this line and the
-# "%%% END OF TRANSLATED PROPERTIES %%%" line.
-# Make a new property name, append to the end of the file and change
-# the code to use the new property.
-# ====================================================================
-
-# ====================================================================
-# %%% END OF TRANSLATED PROPERTIES %%%
-# ====================================================================
-
-pluginName=Java Persistence Tools Entity Generation Tests
-providerName=Eclipse.org
diff --git a/jpa/tests/org.eclipse.jpt.gen.tests/src/org/eclipse/jpt/gen/tests/internal/EntityGenToolsTests.java b/jpa/tests/org.eclipse.jpt.gen.tests/src/org/eclipse/jpt/gen/tests/internal/EntityGenToolsTests.java
deleted file mode 100644
index 9ff221c28f..0000000000
--- a/jpa/tests/org.eclipse.jpt.gen.tests/src/org/eclipse/jpt/gen/tests/internal/EntityGenToolsTests.java
+++ /dev/null
@@ -1,144 +0,0 @@
-/*******************************************************************************
- * Copyright (c) 2008 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.
- *
- * Contributors:
- * Oracle - initial API and implementation
- ******************************************************************************/
-package org.eclipse.jpt.gen.tests.internal;
-
-import java.util.HashSet;
-
-import org.eclipse.jpt.gen.internal.EntityGenTools;
-
-import junit.framework.TestCase;
-
-/**
- *
- */
-@SuppressWarnings("nls")
-public class EntityGenToolsTests extends TestCase {
-
- public EntityGenToolsTests(String name) {
- super(name);
- }
-
- public void testConvertToUniqueJavaStyleClassName1() {
- HashSet<String> names = new HashSet<String>();
- assertEquals("Foo", EntityGenTools.convertToUniqueJavaStyleClassName("Foo", names));
- assertEquals("Foo", EntityGenTools.convertToUniqueJavaStyleClassName("foo", names));
- assertEquals("Foo", EntityGenTools.convertToUniqueJavaStyleClassName("FOO", names));
- assertEquals("Foo", EntityGenTools.convertToUniqueJavaStyleClassName("FOO_", names));
- assertEquals("Foo", EntityGenTools.convertToUniqueJavaStyleClassName("_FOO", names));
- assertEquals("Foo_", EntityGenTools.convertToUniqueJavaStyleClassName("FOO*", names));
- assertEquals("_oo", EntityGenTools.convertToUniqueJavaStyleClassName("5oo", names));
- }
-
- public void testConvertToUniqueJavaStyleClassName2() {
- HashSet<String> names = new HashSet<String>();
- names.add("Foo");
- assertEquals("Foo2", EntityGenTools.convertToUniqueJavaStyleClassName("Foo", names));
- assertEquals("Foo2", EntityGenTools.convertToUniqueJavaStyleClassName("foo", names));
- assertEquals("Foo2", EntityGenTools.convertToUniqueJavaStyleClassName("FOO", names));
- assertEquals("Foo2", EntityGenTools.convertToUniqueJavaStyleClassName("FOO_", names));
- assertEquals("Foo2", EntityGenTools.convertToUniqueJavaStyleClassName("_FOO", names));
- assertEquals("Foo_", EntityGenTools.convertToUniqueJavaStyleClassName("FOO*", names));
- assertEquals("_oo", EntityGenTools.convertToUniqueJavaStyleClassName("5OO", names));
- }
-
- public void testConvertToUniqueJavaStyleClassName3() {
- HashSet<String> names = new HashSet<String>();
- names.add("foo");
- assertEquals("Foo2", EntityGenTools.convertToUniqueJavaStyleClassName("Foo", names));
- assertEquals("Foo2", EntityGenTools.convertToUniqueJavaStyleClassName("foo", names));
- assertEquals("Foo2", EntityGenTools.convertToUniqueJavaStyleClassName("FOO", names));
- assertEquals("Foo2", EntityGenTools.convertToUniqueJavaStyleClassName("FOO_", names));
- assertEquals("Foo2", EntityGenTools.convertToUniqueJavaStyleClassName("_FOO", names));
- assertEquals("Foo_", EntityGenTools.convertToUniqueJavaStyleClassName("FOO*", names));
- assertEquals("_oo", EntityGenTools.convertToUniqueJavaStyleClassName("5OO", names));
- }
-
- public void testConvertToUniqueJavaStyleClassName4() {
- HashSet<String> names = new HashSet<String>();
- assertEquals("FooBar", EntityGenTools.convertToUniqueJavaStyleClassName("FooBar", names));
- assertEquals("Foo_bar", EntityGenTools.convertToUniqueJavaStyleClassName("foo_bar", names));
- assertEquals("FooBar", EntityGenTools.convertToUniqueJavaStyleClassName("FOO_BAR", names));
- assertEquals("FooBar", EntityGenTools.convertToUniqueJavaStyleClassName("_FOO_BAR", names));
- assertEquals("FooBar", EntityGenTools.convertToUniqueJavaStyleClassName("FOO_BAR_", names));
- assertEquals("FooBar_", EntityGenTools.convertToUniqueJavaStyleClassName("FOO_BAR_*", names));
- assertEquals("_fooBar", EntityGenTools.convertToUniqueJavaStyleClassName("4FOO_BAR", names));
- }
-
- public void testConvertToUniqueJavaStyleClassName5() {
- HashSet<String> names = new HashSet<String>();
- names.add("FooBar");
- assertEquals("FooBar2", EntityGenTools.convertToUniqueJavaStyleClassName("FooBar", names));
- assertEquals("Foo_bar", EntityGenTools.convertToUniqueJavaStyleClassName("foo_bar", names));
- assertEquals("FooBar2", EntityGenTools.convertToUniqueJavaStyleClassName("FOO_BAR", names));
- assertEquals("FooBar2", EntityGenTools.convertToUniqueJavaStyleClassName("_FOO_BAR", names));
- assertEquals("FooBar2", EntityGenTools.convertToUniqueJavaStyleClassName("FOO_BAR_", names));
- assertEquals("FooBar_", EntityGenTools.convertToUniqueJavaStyleClassName("FOO_BAR_*", names));
- assertEquals("_fooBar", EntityGenTools.convertToUniqueJavaStyleClassName("4FOO_BAR", names));
- }
-
- public void testConvertToUniqueJavaStyleAttributeName1() {
- HashSet<String> names = new HashSet<String>();
- assertEquals("foo", EntityGenTools.convertToUniqueJavaStyleAttributeName("Foo", names));
- assertEquals("foo", EntityGenTools.convertToUniqueJavaStyleAttributeName("foo", names));
- assertEquals("foo", EntityGenTools.convertToUniqueJavaStyleAttributeName("FOO", names));
- assertEquals("foo", EntityGenTools.convertToUniqueJavaStyleAttributeName("FOO_", names));
- assertEquals("foo", EntityGenTools.convertToUniqueJavaStyleAttributeName("_FOO", names));
- assertEquals("foo_", EntityGenTools.convertToUniqueJavaStyleAttributeName("FOO*", names));
- assertEquals("_oo", EntityGenTools.convertToUniqueJavaStyleAttributeName("5oo", names));
- }
-
- public void testConvertToUniqueJavaStyleAttributeName2() {
- HashSet<String> names = new HashSet<String>();
- names.add("Foo");
- assertEquals("foo2", EntityGenTools.convertToUniqueJavaStyleAttributeName("Foo", names));
- assertEquals("foo2", EntityGenTools.convertToUniqueJavaStyleAttributeName("foo", names));
- assertEquals("foo2", EntityGenTools.convertToUniqueJavaStyleAttributeName("FOO", names));
- assertEquals("foo2", EntityGenTools.convertToUniqueJavaStyleAttributeName("FOO_", names));
- assertEquals("foo2", EntityGenTools.convertToUniqueJavaStyleAttributeName("_FOO", names));
- assertEquals("foo_", EntityGenTools.convertToUniqueJavaStyleAttributeName("FOO*", names));
- assertEquals("_oo", EntityGenTools.convertToUniqueJavaStyleAttributeName("5OO", names));
- }
-
- public void testConvertToUniqueJavaStyleAttributeName3() {
- HashSet<String> names = new HashSet<String>();
- names.add("foo");
- assertEquals("foo2", EntityGenTools.convertToUniqueJavaStyleAttributeName("Foo", names));
- assertEquals("foo2", EntityGenTools.convertToUniqueJavaStyleAttributeName("foo", names));
- assertEquals("foo2", EntityGenTools.convertToUniqueJavaStyleAttributeName("FOO", names));
- assertEquals("foo2", EntityGenTools.convertToUniqueJavaStyleAttributeName("FOO_", names));
- assertEquals("foo2", EntityGenTools.convertToUniqueJavaStyleAttributeName("_FOO", names));
- assertEquals("foo_", EntityGenTools.convertToUniqueJavaStyleAttributeName("FOO*", names));
- assertEquals("_oo", EntityGenTools.convertToUniqueJavaStyleAttributeName("5OO", names));
- }
-
- public void testConvertToUniqueJavaStyleAttributeName4() {
- HashSet<String> names = new HashSet<String>();
- assertEquals("fooBar", EntityGenTools.convertToUniqueJavaStyleAttributeName("FooBar", names));
- assertEquals("foo_bar", EntityGenTools.convertToUniqueJavaStyleAttributeName("foo_bar", names));
- assertEquals("fooBar", EntityGenTools.convertToUniqueJavaStyleAttributeName("FOO_BAR", names));
- assertEquals("fooBar", EntityGenTools.convertToUniqueJavaStyleAttributeName("_FOO_BAR", names));
- assertEquals("fooBar", EntityGenTools.convertToUniqueJavaStyleAttributeName("FOO_BAR_", names));
- assertEquals("fooBar_", EntityGenTools.convertToUniqueJavaStyleAttributeName("FOO_BAR_*", names));
- assertEquals("_fooBar", EntityGenTools.convertToUniqueJavaStyleAttributeName("4FOO_BAR", names));
- }
-
- public void testConvertToUniqueJavaStyleAttributeName5() {
- HashSet<String> names = new HashSet<String>();
- names.add("FooBar");
- assertEquals("fooBar2", EntityGenTools.convertToUniqueJavaStyleAttributeName("FooBar", names));
- assertEquals("foo_bar", EntityGenTools.convertToUniqueJavaStyleAttributeName("foo_bar", names));
- assertEquals("fooBar2", EntityGenTools.convertToUniqueJavaStyleAttributeName("FOO_BAR", names));
- assertEquals("fooBar2", EntityGenTools.convertToUniqueJavaStyleAttributeName("_FOO_BAR", names));
- assertEquals("fooBar2", EntityGenTools.convertToUniqueJavaStyleAttributeName("FOO_BAR_", names));
- assertEquals("fooBar_", EntityGenTools.convertToUniqueJavaStyleAttributeName("FOO_BAR_*", names));
- assertEquals("_fooBar", EntityGenTools.convertToUniqueJavaStyleAttributeName("4FOO_BAR", names));
- }
-
-}
diff --git a/jpa/tests/org.eclipse.jpt.gen.tests/src/org/eclipse/jpt/gen/tests/internal/JptGenTests.java b/jpa/tests/org.eclipse.jpt.gen.tests/src/org/eclipse/jpt/gen/tests/internal/JptGenTests.java
deleted file mode 100644
index 1e79d7d032..0000000000
--- a/jpa/tests/org.eclipse.jpt.gen.tests/src/org/eclipse/jpt/gen/tests/internal/JptGenTests.java
+++ /dev/null
@@ -1,32 +0,0 @@
-/*******************************************************************************
- * Copyright (c) 2008 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.
- *
- * Contributors:
- * Oracle - initial API and implementation
- ******************************************************************************/
-package org.eclipse.jpt.gen.tests.internal;
-
-import junit.framework.Test;
-import junit.framework.TestSuite;
-import org.eclipse.jpt.gen.tests.internal.EntityGenToolsTests;
-
-/**
- *
- */
-public class JptGenTests {
-
- public static Test suite() {
- TestSuite suite = new TestSuite("JPT Entity Generation Tests"); //$NON-NLS-1$
- suite.addTestSuite(EntityGenToolsTests.class);
- return suite;
- }
-
- private JptGenTests() {
- super();
- throw new UnsupportedOperationException();
- }
-
-}
diff --git a/jpa/tests/org.eclipse.jpt.gen.tests/test.xml b/jpa/tests/org.eclipse.jpt.gen.tests/test.xml
deleted file mode 100644
index 11d311ae85..0000000000
--- a/jpa/tests/org.eclipse.jpt.gen.tests/test.xml
+++ /dev/null
@@ -1,40 +0,0 @@
-<?xml version="1.0"?>
-<project name="testsuite" default="run" basedir=".">
- <!-- The property ${eclipse-home} should be passed into this script -->
- <!-- Set a meaningful default value for when it is not. -->
- <echo message="basedir ${basedir}" />
- <echo message="eclipse place ${eclipse-home}" />
- <!-- sets the properties plugin-name -->
- <property name="plugin-name" value="org.eclipse.jpt.gen.tests"/>
-
- <!-- This target holds all initialization code that needs to be done for -->
- <!-- all tests that are to be run. Initialization for individual tests -->
- <!-- should be done within the body of the suite target. -->
- <target name="init">
- <tstamp/>
- <delete>
- <fileset dir="${eclipse-home}" includes="org*.xml"/>
- </delete>
- </target>
-
- <!-- This target defines the tests that need to be run. -->
- <target name="suite">
- <ant target="gen-test" antfile="${library-file}" dir="${eclipse-home}">
- <property name="plugin-name" value="${plugin-name}"/>
- <property name="classname" value="org.eclipse.jpt.gen.tests.internal.JptGenTests" />
- <property name="plugin-path" value="${eclipse-home}/plugins/${plugin-name}"/>
- <property name="extraVMargs" value=""/>
- </ant>
- </target>
-
- <!-- This target holds code to cleanup the testing environment after -->
- <!-- after all of the tests have been run. You can use this target to -->
- <!-- delete temporary files that have been created. -->
- <target name="cleanup">
- </target>
-
- <!-- This target runs the test suite. Any actions that need to happen -->
- <!-- after all the tests have been run should go here. -->
- <target name="run" depends="init, suite, cleanup">
- </target>
-</project> \ No newline at end of file
diff --git a/jpa/tests/org.eclipse.jpt.ui.tests/.classpath b/jpa/tests/org.eclipse.jpt.ui.tests/.classpath
deleted file mode 100644
index 370877baf6..0000000000
--- a/jpa/tests/org.eclipse.jpt.ui.tests/.classpath
+++ /dev/null
@@ -1,13 +0,0 @@
-<?xml version="1.0" encoding="UTF-8"?>
-<classpath>
- <classpathentry kind="src" path="src"/>
- <classpathentry kind="con" path="org.eclipse.jdt.launching.JRE_CONTAINER"/>
- <classpathentry kind="con" path="org.eclipse.pde.core.requiredPlugins">
- <accessrules>
- <accessrule kind="accessible" pattern="org/eclipse/jpt/ui/**"/>
- <accessrule kind="accessible" pattern="org/eclipse/jpt/core/**"/>
- <accessrule kind="accessible" pattern="org/eclipse/jpt/utility/**"/>
- </accessrules>
- </classpathentry>
- <classpathentry kind="output" path="bin"/>
-</classpath>
diff --git a/jpa/tests/org.eclipse.jpt.ui.tests/.project b/jpa/tests/org.eclipse.jpt.ui.tests/.project
deleted file mode 100644
index 0240774761..0000000000
--- a/jpa/tests/org.eclipse.jpt.ui.tests/.project
+++ /dev/null
@@ -1,28 +0,0 @@
-<?xml version="1.0" encoding="UTF-8"?>
-<projectDescription>
- <name>org.eclipse.jpt.ui.tests</name>
- <comment></comment>
- <projects>
- </projects>
- <buildSpec>
- <buildCommand>
- <name>org.eclipse.jdt.core.javabuilder</name>
- <arguments>
- </arguments>
- </buildCommand>
- <buildCommand>
- <name>org.eclipse.pde.ManifestBuilder</name>
- <arguments>
- </arguments>
- </buildCommand>
- <buildCommand>
- <name>org.eclipse.pde.SchemaBuilder</name>
- <arguments>
- </arguments>
- </buildCommand>
- </buildSpec>
- <natures>
- <nature>org.eclipse.pde.PluginNature</nature>
- <nature>org.eclipse.jdt.core.javanature</nature>
- </natures>
-</projectDescription>
diff --git a/jpa/tests/org.eclipse.jpt.ui.tests/.settings/org.eclipse.core.resources.prefs b/jpa/tests/org.eclipse.jpt.ui.tests/.settings/org.eclipse.core.resources.prefs
deleted file mode 100644
index d364a0f24e..0000000000
--- a/jpa/tests/org.eclipse.jpt.ui.tests/.settings/org.eclipse.core.resources.prefs
+++ /dev/null
@@ -1,3 +0,0 @@
-#Mon Apr 07 14:27:16 EDT 2008
-eclipse.preferences.version=1
-encoding/<project>=ISO-8859-1
diff --git a/jpa/tests/org.eclipse.jpt.ui.tests/META-INF/MANIFEST.MF b/jpa/tests/org.eclipse.jpt.ui.tests/META-INF/MANIFEST.MF
deleted file mode 100644
index efef310b02..0000000000
--- a/jpa/tests/org.eclipse.jpt.ui.tests/META-INF/MANIFEST.MF
+++ /dev/null
@@ -1,24 +0,0 @@
-Manifest-Version: 1.0
-Bundle-ManifestVersion: 2
-Bundle-Name: %pluginName
-Bundle-Vendor: %providerName
-Bundle-SymbolicName: org.eclipse.jpt.ui.tests
-Bundle-Version: 1.0.1
-Require-Bundle:
- org.junit4;bundle-version="4.3.1",
- org.eclipse.core.resources,
- org.eclipse.core.runtime,
- org.eclipse.jface,
- org.eclipse.jpt.core.tests,
- org.eclipse.jpt.core.tests.extension.resource,
- org.eclipse.jpt.utility,
- org.eclipse.jpt.core,
- org.eclipse.jpt.ui,
- org.eclipse.ui.navigator;bundle-version="3.4.0",
- org.eclipse.ui.forms;bundle-version="3.3.100",
- org.eclipse.ui.workbench;bundle-version="3.4.0"
-Export-Package: org.eclipse.jpt.ui.tests;x-internal:=true,
- org.eclipse.jpt.ui.tests.internal.jface;x-internal:=true,
- org.eclipse.jpt.ui.tests.internal.platform;x-internal:=true,
- org.eclipse.jpt.ui.tests.internal.swt;x-internal:=true,
- org.eclipse.jpt.ui.tests.internal.util;x-internal:=true
diff --git a/jpa/tests/org.eclipse.jpt.ui.tests/build.properties b/jpa/tests/org.eclipse.jpt.ui.tests/build.properties
deleted file mode 100644
index 34d2e4d2da..0000000000
--- a/jpa/tests/org.eclipse.jpt.ui.tests/build.properties
+++ /dev/null
@@ -1,4 +0,0 @@
-source.. = src/
-output.. = bin/
-bin.includes = META-INF/,\
- .
diff --git a/jpa/tests/org.eclipse.jpt.ui.tests/plugin.properties b/jpa/tests/org.eclipse.jpt.ui.tests/plugin.properties
deleted file mode 100644
index ca8ab879ff..0000000000
--- a/jpa/tests/org.eclipse.jpt.ui.tests/plugin.properties
+++ /dev/null
@@ -1,22 +0,0 @@
-###############################################################################
-# Copyright (c) 2006, 2007 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
-#
-# Contributors: Oracle. - initial API and implementation
-###############################################################################
-# ====================================================================
-# To code developer:
-# Do NOT change the properties between this line and the
-# "%%% END OF TRANSLATED PROPERTIES %%%" line.
-# Make a new property name, append to the end of the file and change
-# the code to use the new property.
-# ====================================================================
-
-# ====================================================================
-# %%% END OF TRANSLATED PROPERTIES %%%
-# ====================================================================
-
-pluginName=Java Persistence API UI Tests
-providerName=Eclipse.org
diff --git a/jpa/tests/org.eclipse.jpt.ui.tests/src/org/eclipse/jpt/ui/tests/JptUiTests.java b/jpa/tests/org.eclipse.jpt.ui.tests/src/org/eclipse/jpt/ui/tests/JptUiTests.java
deleted file mode 100644
index 310abb7607..0000000000
--- a/jpa/tests/org.eclipse.jpt.ui.tests/src/org/eclipse/jpt/ui/tests/JptUiTests.java
+++ /dev/null
@@ -1,36 +0,0 @@
-/*******************************************************************************
- * Copyright (c) 2006, 2008 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.
- *
- * Contributors:
- * Oracle - initial API and implementation
- ******************************************************************************/
-package org.eclipse.jpt.ui.tests;
-
-import junit.framework.Test;
-import junit.framework.TestSuite;
-import org.eclipse.jpt.ui.tests.internal.platform.JptUiPlatformTests;
-import org.eclipse.jpt.ui.tests.internal.swt.JptUiSWTTests;
-import org.eclipse.jpt.ui.tests.internal.util.JptUiUtilTests;
-
-/**
- * Runs all JPT UI Tests
- */
-public class JptUiTests {
-
- public static Test suite() {
- TestSuite suite = new TestSuite(JptUiTests.class.getPackage().getName());
- suite.addTest(JptUiPlatformTests.suite());
- suite.addTest(JptUiSWTTests.suite());
- suite.addTest(JptUiUtilTests.suite());
- return suite;
- }
-
- private JptUiTests() {
- super();
- throw new UnsupportedOperationException();
- }
-
-}
diff --git a/jpa/tests/org.eclipse.jpt.ui.tests/src/org/eclipse/jpt/ui/tests/internal/jface/DelegatingLabelProviderUiTest.java b/jpa/tests/org.eclipse.jpt.ui.tests/src/org/eclipse/jpt/ui/tests/internal/jface/DelegatingLabelProviderUiTest.java
deleted file mode 100644
index d0ace3e69a..0000000000
--- a/jpa/tests/org.eclipse.jpt.ui.tests/src/org/eclipse/jpt/ui/tests/internal/jface/DelegatingLabelProviderUiTest.java
+++ /dev/null
@@ -1,603 +0,0 @@
-/*******************************************************************************
- * Copyright (c) 2008, 2009 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.
- *
- * Contributors:
- * Oracle - initial API and implementation
- ******************************************************************************/
-package org.eclipse.jpt.ui.tests.internal.jface;
-
-import org.eclipse.jface.action.Action;
-import org.eclipse.jface.action.ActionContributionItem;
-import org.eclipse.jface.action.IAction;
-import org.eclipse.jface.viewers.ArrayContentProvider;
-import org.eclipse.jface.viewers.BaseLabelProvider;
-import org.eclipse.jface.viewers.ComboViewer;
-import org.eclipse.jface.viewers.ILabelProvider;
-import org.eclipse.jface.viewers.ISelectionChangedListener;
-import org.eclipse.jface.viewers.IStructuredSelection;
-import org.eclipse.jface.viewers.SelectionChangedEvent;
-import org.eclipse.jface.viewers.StructuredSelection;
-import org.eclipse.jface.viewers.TreeViewer;
-import org.eclipse.jface.window.ApplicationWindow;
-import org.eclipse.jface.window.Window;
-import org.eclipse.jpt.ui.internal.jface.AbstractItemLabelProvider;
-import org.eclipse.jpt.ui.internal.jface.AbstractTreeItemContentProvider;
-import org.eclipse.jpt.ui.internal.jface.DelegatingTreeContentAndLabelProvider;
-import org.eclipse.jpt.ui.jface.DelegatingContentAndLabelProvider;
-import org.eclipse.jpt.ui.jface.ItemLabelProvider;
-import org.eclipse.jpt.ui.jface.ItemLabelProviderFactory;
-import org.eclipse.jpt.ui.jface.TreeItemContentProvider;
-import org.eclipse.jpt.ui.jface.TreeItemContentProviderFactory;
-import org.eclipse.jpt.utility.internal.ClassTools;
-import org.eclipse.jpt.utility.internal.model.AbstractModel;
-import org.eclipse.jpt.utility.internal.model.value.NullCollectionValueModel;
-import org.eclipse.jpt.utility.internal.model.value.PropertyAspectAdapter;
-import org.eclipse.jpt.utility.internal.model.value.SimplePropertyValueModel;
-import org.eclipse.jpt.utility.internal.model.value.StaticCollectionValueModel;
-import org.eclipse.jpt.utility.internal.model.value.StaticPropertyValueModel;
-import org.eclipse.jpt.utility.model.event.PropertyChangeEvent;
-import org.eclipse.jpt.utility.model.listener.PropertyChangeListener;
-import org.eclipse.jpt.utility.model.value.CollectionValueModel;
-import org.eclipse.jpt.utility.model.value.PropertyValueModel;
-import org.eclipse.jpt.utility.model.value.WritablePropertyValueModel;
-import org.eclipse.swt.SWT;
-import org.eclipse.swt.events.SelectionAdapter;
-import org.eclipse.swt.events.SelectionEvent;
-import org.eclipse.swt.graphics.Image;
-import org.eclipse.swt.graphics.ImageData;
-import org.eclipse.swt.graphics.PaletteData;
-import org.eclipse.swt.graphics.RGB;
-import org.eclipse.swt.layout.GridData;
-import org.eclipse.swt.layout.GridLayout;
-import org.eclipse.swt.widgets.Button;
-import org.eclipse.swt.widgets.Composite;
-import org.eclipse.swt.widgets.Control;
-import org.eclipse.swt.widgets.Display;
-import org.eclipse.swt.widgets.Label;
-import org.eclipse.swt.widgets.Shell;
-
-public class DelegatingLabelProviderUiTest extends ApplicationWindow
-{
- private TreeViewer tree;
-
- private WritablePropertyValueModel<Vehicle> selectedVehicle;
-
-
- public static void main(String[] args) {
- Window window = new DelegatingLabelProviderUiTest(args);
- window.setBlockOnOpen(true);
- window.open();
- Display.getCurrent().dispose();
- System.exit(0);
- }
-
-
- private DelegatingLabelProviderUiTest(String[] args) {
- super(null);
- this.selectedVehicle = new SimplePropertyValueModel<Vehicle>();
- }
-
-
- @Override
- protected Control createContents(Composite parent) {
- ((Shell) parent).setText(ClassTools.shortClassNameForObject(this));
- parent.setSize(400, 400);
- parent.setLayout(new GridLayout());
- Composite mainPanel = new Composite(parent, SWT.NONE);
- mainPanel.setLayoutData(new GridData(GridData.FILL_BOTH));
- mainPanel.setLayout(new GridLayout());
- buildTreePanel(mainPanel);
- buildControlPanel(mainPanel);
- return mainPanel;
- }
-
- private void buildTreePanel(Composite parent) {
- Composite panel = new Composite(parent, SWT.NONE);
- panel.setLayoutData(new GridData(GridData.FILL_BOTH));
- panel.setLayout(new GridLayout());
-
- Label label = new Label(panel, SWT.NONE);
- label.setLayoutData(new GridData(GridData.BEGINNING, GridData.CENTER, false, false));
- label.setText("My Vehicles");
-
- tree = new TreeViewer(panel, SWT.SINGLE | SWT.H_SCROLL | SWT.V_SCROLL | SWT.BORDER);
- tree.getTree().setLayoutData(new GridData(GridData.FILL, GridData.FILL, true, true));
- DelegatingContentAndLabelProvider contentAndLabelProvider =
- new DelegatingTreeContentAndLabelProvider(
- new VehicleContentProviderFactory(),
- new VehicleLabelProviderFactory());
- tree.setContentProvider(contentAndLabelProvider);
- tree.setLabelProvider(contentAndLabelProvider);
- tree.setInput(new Root());
- tree.addSelectionChangedListener(buildTreeSelectionChangedListener());
- }
-
- private ISelectionChangedListener buildTreeSelectionChangedListener() {
- return new ISelectionChangedListener() {
- public void selectionChanged(SelectionChangedEvent event) {
- selectedVehicle.setValue((Vehicle) ((IStructuredSelection) event.getSelection()).getFirstElement());
- }
- };
- }
-
- private void buildControlPanel(Composite parent) {
- Composite panel = new Composite(parent, SWT.NONE);
- panel.setLayoutData(new GridData(GridData.FILL, GridData.CENTER, true, false));
- panel.setLayout(new GridLayout());
- buildUpperControlPanel(panel);
- buildLowerControlPanel(panel);
- }
-
- private void buildUpperControlPanel(Composite parent) {
- Composite panel = new Composite(parent, SWT.NONE);
- panel.setLayoutData(new GridData(GridData.FILL, GridData.CENTER, true, false));
- panel.setLayout(new GridLayout(2, true));
- buildVehicleCombo(panel);
- buildColorCombo(panel);
- }
-
- private void buildVehicleCombo(Composite parent) {
- final ComboViewer combo = new ComboViewer(parent, SWT.READ_ONLY);
- combo.getCombo().setLayoutData(new GridData(GridData.FILL, GridData.CENTER, true, false));
- combo.setContentProvider(new ArrayContentProvider());
- combo.setLabelProvider(new VehicleTypeLabelProvider());
- combo.setInput(
- new VehicleType[] {
- VehicleType.BICYCLE, VehicleType.CAR,
- VehicleType.TRUCK, VehicleType.BOAT
- });
- combo.getCombo().setEnabled(false);
- combo.addSelectionChangedListener(
- new ISelectionChangedListener() {
- public void selectionChanged(SelectionChangedEvent event) {
- selectedVehicle().setVehicleType((VehicleType) ((StructuredSelection) event.getSelection()).getFirstElement());
- }
- });
- selectedVehicle.addPropertyChangeListener(
- PropertyValueModel.VALUE,
- new PropertyChangeListener() {
- public void propertyChanged(PropertyChangeEvent event) {
- Vehicle vehicle = selectedVehicle();
- combo.getCombo().setEnabled(vehicle != null);
- combo.setSelection(new StructuredSelection((vehicle == null) ? null : vehicle.vehicleType()));
- }
- });
- }
-
- private void buildColorCombo(Composite parent) {
- final ComboViewer combo = new ComboViewer(parent, SWT.READ_ONLY);
- combo.getCombo().setLayoutData(new GridData(GridData.FILL, GridData.CENTER, true, false));
- combo.setContentProvider(new ArrayContentProvider());
- combo.setLabelProvider(new ColorLabelProvider());
- combo.setInput(new Color[] {Color.RED, Color.BLUE, Color.YELLOW, Color.GREEN});
- combo.addSelectionChangedListener(
- new ISelectionChangedListener() {
- public void selectionChanged(SelectionChangedEvent event) {
- selectedVehicle().setColor((Color) ((StructuredSelection) event.getSelection()).getFirstElement());
- }
- });
- selectedVehicle.addPropertyChangeListener(
- PropertyValueModel.VALUE,
- new PropertyChangeListener() {
- public void propertyChanged(PropertyChangeEvent event) {
- Vehicle vehicle = selectedVehicle();
- combo.getCombo().setEnabled(vehicle != null);
- combo.setSelection(new StructuredSelection((vehicle == null) ? null : vehicle.color()));
- }
- });
- }
-
- private void buildLowerControlPanel(Composite parent) {
- Composite panel = new Composite(parent, SWT.NONE);
- panel.setLayoutData(new GridData(GridData.FILL, GridData.CENTER, true, false));
- panel.setLayout(new GridLayout(3, false));
- buildEffectsLabel(panel);
- buildGreyedCheckBox(panel);
- buildTranslucentCheckBox(panel);
- buildActionPanel(panel);
- }
-
- private void buildEffectsLabel(Composite parent) {
- Label label = new Label(parent, SWT.LEFT);
- label.setText("Color effects: ");
- label.setLayoutData(new GridData(GridData.BEGINNING, GridData.CENTER, false, false, 3, 1));
- }
-
- private void buildGreyedCheckBox(Composite parent) {
- final Button button = new Button(parent, SWT.CHECK);
- button.setLayoutData(new GridData(GridData.BEGINNING, GridData.CENTER, false, false));
- button.setText("greyed");
- button.setEnabled(false);
- button.addSelectionListener(
- new SelectionAdapter() {
- @Override
- public void widgetSelected(SelectionEvent e) {
- selectedVehicle().setGreyed(button.getSelection());
- }
- });
- selectedVehicle.addPropertyChangeListener(
- PropertyValueModel.VALUE,
- new PropertyChangeListener() {
- public void propertyChanged(PropertyChangeEvent event) {
- Vehicle vehicle = selectedVehicle();
- button.setEnabled(vehicle != null);
- button.setSelection(vehicle != null && vehicle.isGreyed());
- }
- });
- }
-
- private void buildTranslucentCheckBox(Composite parent) {
- final Button button = new Button(parent, SWT.CHECK);
- button.setLayoutData(new GridData(GridData.BEGINNING, GridData.CENTER, true, false));
- button.setText("translucent");
- button.setEnabled(false);
- button.addSelectionListener(
- new SelectionAdapter() {
- @Override
- public void widgetSelected(SelectionEvent e) {
- selectedVehicle().setTranslucent(button.getSelection());
- }
- });
- selectedVehicle.addPropertyChangeListener(
- PropertyValueModel.VALUE,
- new PropertyChangeListener() {
- public void propertyChanged(PropertyChangeEvent event) {
- Vehicle vehicle = selectedVehicle();
- button.setEnabled(vehicle != null);
- button.setSelection(vehicle != null && vehicle.isTranslucent());
- }
- });
- }
-
- private void buildActionPanel(Composite parent) {
- Composite panel = new Composite(parent, SWT.NONE);
- panel.setLayoutData(new GridData(GridData.END, GridData.FILL, false, false));
- panel.setLayout(new GridLayout());
- buildRefreshTreeACI().fill(panel);
- }
-
- private ActionContributionItem buildRefreshTreeACI() {
- Action action = new Action("Refresh tree", IAction.AS_PUSH_BUTTON) {
- @Override
- public void run() {
- refreshTree();
- }
- };
- action.setToolTipText("Refresh the tree's labels");
- return new ActionContributionItem(action);
- }
-
- void refreshTree() {
- tree.refresh();
- }
-
- private Vehicle selectedVehicle() {
- return selectedVehicle.getValue();
- }
-
-
- private static class VehicleTypeLabelProvider extends BaseLabelProvider
- implements ILabelProvider
- {
- public Image getImage(Object element) {
- return null;
- }
-
- public String getText(Object element) {
- return ((VehicleType) element).description();
- }
- }
-
-
- private static class ColorLabelProvider extends BaseLabelProvider
- implements ILabelProvider
- {
- public Image getImage(Object element) {
- return null;
- }
-
- public String getText(Object element) {
- return ((Color) element).description();
- }
- }
-
-
- private static class VehicleContentProviderFactory
- implements TreeItemContentProviderFactory
- {
- public TreeItemContentProvider buildItemContentProvider(Object item, DelegatingContentAndLabelProvider contentAndLabelProvider) {
- if (item instanceof Root) {
- return new RootContentProvider(
- (Root) item, (DelegatingTreeContentAndLabelProvider) contentAndLabelProvider);
- }
- return new VehicleContentProvider(
- (Vehicle) item, (DelegatingTreeContentAndLabelProvider) contentAndLabelProvider);
- }
- }
-
-
- private static class RootContentProvider extends AbstractTreeItemContentProvider<Vehicle>
- {
- public RootContentProvider(Root item, DelegatingTreeContentAndLabelProvider contentAndLabelProvider) {
- super(item, contentAndLabelProvider);
- }
-
- @Override
- public Root getModel() {
- return (Root) super.getModel();
- }
-
- @Override
- public Object getParent() {
- return null;
- }
-
- @Override
- protected CollectionValueModel<Vehicle> buildChildrenModel() {
- return new StaticCollectionValueModel<Vehicle>(this.getModel().vehicles());
- }
- }
-
- @SuppressWarnings("unchecked")
- private static class VehicleContentProvider extends AbstractTreeItemContentProvider
- {
- public VehicleContentProvider(Vehicle item, DelegatingTreeContentAndLabelProvider contentAndLabelProvider) {
- super(item, contentAndLabelProvider);
- }
-
- @Override
- public Vehicle getModel() {
- return (Vehicle) super.getModel();
- }
-
- @Override
- public Object getParent() {
- return getModel().parent();
- }
-
- @Override
- protected CollectionValueModel buildChildrenModel() {
- return new NullCollectionValueModel();
- }
- }
-
-
- private static class VehicleLabelProviderFactory
- implements ItemLabelProviderFactory
- {
- public ItemLabelProvider buildItemLabelProvider(Object element, DelegatingContentAndLabelProvider labelProvider) {
- return new VehicleLabelProvider((Vehicle) element, labelProvider);
- }
- }
-
-
- private static class VehicleLabelProvider extends AbstractItemLabelProvider
- {
- public VehicleLabelProvider(Vehicle vehicle, DelegatingContentAndLabelProvider labelProvider) {
- super(vehicle, labelProvider);
- }
-
- @Override
- protected PropertyValueModel<Image> buildImageModel() {
- return new PropertyAspectAdapter<Vehicle, Image>(
- new StaticPropertyValueModel<Vehicle>((Vehicle) model()),
- Vehicle.COLOR_PROPERTY, Vehicle.GREYED_PROPERTY, Vehicle.TRANSLUCENT_PROPERTY) {
- @Override
- protected Image buildValue_() {
- return subject.image();
- }
- };
- }
-
- @Override
- protected PropertyValueModel<String> buildTextModel() {
- return new PropertyAspectAdapter<Vehicle, String>(
- new StaticPropertyValueModel<Vehicle>((Vehicle) model()),
- Vehicle.VEHICLE_TYPE_PROPERTY, Vehicle.COLOR_PROPERTY) {
- @Override
- protected String buildValue_() {
- return subject.color().description() + ' ' + subject.vehicleType().description();
- }
- };
- }
-
- @Override
- protected PropertyValueModel<String> buildDescriptionModel() {
- return buildTextModel();
- }
- }
-
-
- private static abstract class TreeNode extends AbstractModel
- {
- private TreeNode parent;
-
-
- public TreeNode(TreeNode parent) {
- this.parent = parent;
- }
-
-
- public TreeNode parent() {
- return parent;
- }
- }
-
-
- private static class Root extends TreeNode
- {
- protected final Vehicle[] vehicles;
-
-
- public Root() {
- super(null);
- vehicles = new Vehicle[] {
- new Vehicle(this, VehicleType.BICYCLE, Color.BLUE),
- new Vehicle(this, VehicleType.CAR, Color.YELLOW),
- new Vehicle(this, VehicleType.TRUCK, Color.RED),
- new Vehicle(this, VehicleType.BOAT, Color.GREEN)};
- }
-
- public Vehicle[] vehicles() {
- return vehicles;
- }
- }
-
-
- private static class Vehicle extends TreeNode
- {
- private VehicleType vehicleType;
- public final static String VEHICLE_TYPE_PROPERTY = "vehicleType";
-
- private Color color;
- public final static String COLOR_PROPERTY = "color";
-
- private boolean greyed = false;
- public final static String GREYED_PROPERTY = "greyed";
-
- private boolean translucent = false;
- public final static String TRANSLUCENT_PROPERTY = "translucent";
-
- private Image image;
-
-
- public Vehicle(TreeNode parent, VehicleType vehicleType, Color color) {
- super(parent);
- this.vehicleType = vehicleType;
- this.color = color;
- }
-
- public VehicleType vehicleType() {
- return vehicleType;
- }
-
- public void setVehicleType(VehicleType newVehicleType) {
- VehicleType oldVehicleType = vehicleType;
- vehicleType = newVehicleType;
- firePropertyChanged(VEHICLE_TYPE_PROPERTY, oldVehicleType, newVehicleType);
- }
-
- public Color color() {
- return color;
- }
-
- public void setColor(Color newColor) {
- Color oldColor = color;
- color = newColor;
- firePropertyChanged(COLOR_PROPERTY, oldColor, newColor);
- }
-
- public boolean isGreyed() {
- return greyed;
- }
-
- public void setGreyed(boolean newGreyed) {
- boolean oldGreyed = greyed;
- greyed = newGreyed;
- firePropertyChanged(GREYED_PROPERTY, oldGreyed, newGreyed);
- }
-
- public boolean isTranslucent() {
- return translucent;
- }
-
- public void setTranslucent(boolean newTranslucent) {
- boolean oldTranslucent = translucent;
- translucent = newTranslucent;
- firePropertyChanged(TRANSLUCENT_PROPERTY, oldTranslucent, newTranslucent);
- }
-
- public Image image() {
- if (image != null) {
- image.dispose();
- }
-
- return ImageFactory.image(color(), greyed, translucent);
- }
- }
-
-
- private static enum VehicleType
- {
- BICYCLE("bicycle"),
- CAR("car"),
- TRUCK("truck"),
- BOAT("boat");
-
- private final String description;
-
- private VehicleType(String description) {
- this.description = description;
- }
-
- public String description() {
- return description;
- }
-
- @Override
- public String toString() {
- return description();
- }
- }
-
-
- private static enum Color
- {
- RED("red", new RGB(255, 0, 0)),
- BLUE("blue", new RGB(0, 0, 255)),
- YELLOW("yellow", new RGB(255, 255, 0)),
- GREEN("green", new RGB(0, 255, 0));
-
- private final String description;
-
- private final RGB rgb;
-
- private Color(String description, RGB rgb) {
- this.description = description;
- this.rgb = rgb;
- }
-
- public String description() {
- return description;
- }
-
- public RGB rgb() {
- return rgb;
- }
-
- @Override
- public String toString() {
- return description();
- }
- }
-
-
- private static class ImageFactory
- {
- private static RGB rgb(Color color, boolean greyed, boolean translucent) {
- RGB rgb = (greyed) ? new RGB(127, 127, 127) : color.rgb();
- if (translucent) {
- rgb = new RGB(translucify(rgb.red), translucify(rgb.green), translucify(rgb.blue));
- }
- return rgb;
- }
-
- private static int translucify(int color) {
- return 255 - (int) ((255 - color) * 0.3);
- }
-
- public static Image image(Color color, boolean greyed, boolean translucent) {
- PaletteData pd = new PaletteData(new RGB[] {rgb(color, greyed, translucent)});
- ImageData id = new ImageData(20, 20, 1, pd);
- for (int x = 0; x < 20; x ++) {
- for (int y = 0; y < 20; y ++) {
- id.setPixel(x, y, 0);
- }
- }
- return new Image(Display.getCurrent(), id);
- }
- }
-}
diff --git a/jpa/tests/org.eclipse.jpt.ui.tests/src/org/eclipse/jpt/ui/tests/internal/jface/DelegatingTreeContentProviderUiTest.java b/jpa/tests/org.eclipse.jpt.ui.tests/src/org/eclipse/jpt/ui/tests/internal/jface/DelegatingTreeContentProviderUiTest.java
deleted file mode 100644
index 19ac671230..0000000000
--- a/jpa/tests/org.eclipse.jpt.ui.tests/src/org/eclipse/jpt/ui/tests/internal/jface/DelegatingTreeContentProviderUiTest.java
+++ /dev/null
@@ -1,566 +0,0 @@
-/*******************************************************************************
- * Copyright (c) 2008, 2009 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.
- *
- * Contributors:
- * Oracle - initial API and implementation
- ******************************************************************************/
-package org.eclipse.jpt.ui.tests.internal.jface;
-
-import java.util.ArrayList;
-import java.util.Iterator;
-import java.util.List;
-import java.util.ListIterator;
-import org.eclipse.jface.action.Action;
-import org.eclipse.jface.action.ActionContributionItem;
-import org.eclipse.jface.action.IAction;
-import org.eclipse.jface.viewers.BaseLabelProvider;
-import org.eclipse.jface.viewers.ILabelProvider;
-import org.eclipse.jface.viewers.ISelectionChangedListener;
-import org.eclipse.jface.viewers.IStructuredSelection;
-import org.eclipse.jface.viewers.ITreeContentProvider;
-import org.eclipse.jface.viewers.SelectionChangedEvent;
-import org.eclipse.jface.viewers.StructuredSelection;
-import org.eclipse.jface.viewers.TreeViewer;
-import org.eclipse.jface.window.ApplicationWindow;
-import org.eclipse.jface.window.Window;
-import org.eclipse.jpt.ui.internal.jface.AbstractTreeItemContentProvider;
-import org.eclipse.jpt.ui.internal.jface.DelegatingTreeContentAndLabelProvider;
-import org.eclipse.jpt.ui.jface.DelegatingContentAndLabelProvider;
-import org.eclipse.jpt.ui.jface.TreeItemContentProvider;
-import org.eclipse.jpt.ui.jface.TreeItemContentProviderFactory;
-import org.eclipse.jpt.utility.internal.ClassTools;
-import org.eclipse.jpt.utility.internal.CollectionTools;
-import org.eclipse.jpt.utility.internal.iterators.FilteringIterator;
-import org.eclipse.jpt.utility.internal.iterators.ReadOnlyListIterator;
-import org.eclipse.jpt.utility.internal.iterators.TransformationIterator;
-import org.eclipse.jpt.utility.internal.model.AbstractModel;
-import org.eclipse.jpt.utility.internal.model.value.CompositeCollectionValueModel;
-import org.eclipse.jpt.utility.internal.model.value.ListAspectAdapter;
-import org.eclipse.jpt.utility.internal.model.value.ListCollectionValueModelAdapter;
-import org.eclipse.jpt.utility.internal.model.value.SimplePropertyValueModel;
-import org.eclipse.jpt.utility.internal.model.value.StaticCollectionValueModel;
-import org.eclipse.jpt.utility.model.event.PropertyChangeEvent;
-import org.eclipse.jpt.utility.model.listener.PropertyChangeListener;
-import org.eclipse.jpt.utility.model.value.CollectionValueModel;
-import org.eclipse.jpt.utility.model.value.ListValueModel;
-import org.eclipse.jpt.utility.model.value.PropertyValueModel;
-import org.eclipse.jpt.utility.model.value.WritablePropertyValueModel;
-import org.eclipse.swt.SWT;
-import org.eclipse.swt.graphics.Image;
-import org.eclipse.swt.layout.GridData;
-import org.eclipse.swt.layout.GridLayout;
-import org.eclipse.swt.widgets.Composite;
-import org.eclipse.swt.widgets.Control;
-import org.eclipse.swt.widgets.Display;
-import org.eclipse.swt.widgets.Label;
-import org.eclipse.swt.widgets.Shell;
-import org.eclipse.swt.widgets.Text;
-
-public class DelegatingTreeContentProviderUiTest extends ApplicationWindow
-{
- private final Root root;
-
- private WritablePropertyValueModel<TreeNode> selectedNode;
-
- private TreeViewer controlTree;
-
- private TreeViewer viewTree;
-
- private Text nodeNameText;
-
-
- public static void main(String[] args) {
- Window window = new DelegatingTreeContentProviderUiTest(args);
- window.setBlockOnOpen(true);
- window.open();
- Display.getCurrent().dispose();
- System.exit(0);
- }
-
- private DelegatingTreeContentProviderUiTest(String[] args) {
- super(null);
- this.root = new Root();
- this.root.addChild("Parent_1");
- this.selectedNode = new SimplePropertyValueModel<TreeNode>(this.root);
- }
-
- @Override
- protected Control createContents(Composite parent) {
- ((Shell) parent).setText(ClassTools.shortClassNameForObject(this));
- parent.setSize(800, 400);
- parent.setLayout(new GridLayout());
- Composite mainPanel = new Composite(parent, SWT.NONE);
- mainPanel.setLayoutData(new GridData(GridData.FILL_BOTH));
- mainPanel.setLayout(new GridLayout());
- buildTreePanel(mainPanel);
- buildControlPanel(mainPanel);
- return mainPanel;
- }
-
- private void buildTreePanel(Composite parent) {
- Composite panel = new Composite(parent, SWT.NONE);
- panel.setLayoutData(new GridData(GridData.FILL_BOTH));
- panel.setLayout(new GridLayout(2, true));
- buildControlTreePanel(panel);
- buildViewTreePanel(panel);
- }
-
- private void buildControlTreePanel(Composite parent) {
- controlTree = buildTreePanel(
- parent, "Control tree",
- new DelegatingTreeContentAndLabelProvider(new ControlTreeItemContentProviderFactory()),
- new LabelProvider());
- controlTree.addSelectionChangedListener(buildTreeSelectionChangedListener());
- selectedNode.addPropertyChangeListener(
- PropertyValueModel.VALUE,
- new PropertyChangeListener() {
- public void propertyChanged(PropertyChangeEvent event) {
- controlTree.setSelection(new StructuredSelection(event.getNewValue()));
- }
- }
- );
- }
-
- private void buildViewTreePanel(Composite parent) {
- viewTree = buildTreePanel(
- parent, "View tree",
- new DelegatingTreeContentAndLabelProvider(new ViewTreeItemContentProviderFactory()),
- new LabelProvider());
- }
-
- private TreeViewer buildTreePanel(Composite parent, String labelText, ITreeContentProvider contentProvider, ILabelProvider labelProvider) {
- Composite panel = new Composite(parent, SWT.NONE);
- panel.setLayoutData(new GridData(GridData.FILL_BOTH));
- panel.setLayout(new GridLayout());
-
- Label label = new Label(panel, SWT.LEFT);
- label.setLayoutData(new GridData(GridData.BEGINNING, GridData.CENTER, false, false));
- label.setText(labelText);
-
- final TreeViewer tree = new TreeViewer(panel, SWT.SINGLE | SWT.H_SCROLL | SWT.V_SCROLL | SWT.BORDER);
- tree.getTree().setLayoutData(new GridData(GridData.FILL, GridData.FILL, true, true));
- tree.setContentProvider(contentProvider);
- tree.setLabelProvider(labelProvider);
- tree.setInput(root);
-
- return tree;
- }
-
- private ISelectionChangedListener buildTreeSelectionChangedListener() {
- return new ISelectionChangedListener() {
- public void selectionChanged(SelectionChangedEvent event) {
- TreeNode selection = (TreeNode) ((IStructuredSelection) event.getSelection()).getFirstElement();
- selectedNode.setValue((selection == null) ? root : selection);
- }
- };
- }
-
- private void buildControlPanel(Composite parent) {
- Composite panel = new Composite(parent, SWT.NONE);
- panel.setLayoutData(new GridData(GridData.FILL, GridData.FILL, true, false));
- panel.setLayout(new GridLayout(6, false));
- buildNodeNameText(panel);
- buildAddChildACI().fill(panel);
- buildAddNestedChildACI().fill(panel);
- buildRemoveACI().fill(panel);
- buildClearModelACI().fill(panel);
- buildRestoreModelACI().fill(panel);
- }
-
- private void buildNodeNameText(Composite parent) {
- nodeNameText = new Text(parent, SWT.SINGLE | SWT.BORDER);
- nodeNameText.setLayoutData(new GridData(GridData.FILL, GridData.CENTER, true, false));
- }
-
- private ActionContributionItem buildAddChildACI() {
- final Action action = new Action("Add child", IAction.AS_PUSH_BUTTON) {
- @Override
- public void run() {
- addChild();
- }
- };
- action.setToolTipText("Add a child with the given name");
- selectedNode.addPropertyChangeListener(
- PropertyValueModel.VALUE,
- new PropertyChangeListener() {
- public void propertyChanged(PropertyChangeEvent event) {
- action.setEnabled(((TreeNode) event.getNewValue()).canHaveChildren());
- }
- }
- );
- return new ActionContributionItem(action);
- }
-
- private ActionContributionItem buildAddNestedChildACI() {
- final Action action = new Action("Add nested child", IAction.AS_PUSH_BUTTON) {
- @Override
- public void run() {
- addNestedChild();
- }
- };
- action.setToolTipText("Add a nested child with the given name");
- action.setEnabled(false);
- selectedNode.addPropertyChangeListener(
- PropertyValueModel.VALUE,
- new PropertyChangeListener() {
- public void propertyChanged(PropertyChangeEvent event) {
- action.setEnabled(((TreeNode) event.getNewValue()).canHaveNestedChildren());
- }
- }
- );
- return new ActionContributionItem(action);
- }
-
- private ActionContributionItem buildRemoveACI() {
- final Action action = new Action("Remove", IAction.AS_PUSH_BUTTON) {
- @Override
- public void run() {
- remove();
- }
- };
- action.setToolTipText("Remove the selected node");
- action.setEnabled(false);
- selectedNode.addPropertyChangeListener(
- PropertyValueModel.VALUE,
- new PropertyChangeListener() {
- public void propertyChanged(PropertyChangeEvent event) {
- action.setEnabled(event.getNewValue() != root);
- }
- }
- );
- return new ActionContributionItem(action);
- }
-
- private ActionContributionItem buildClearModelACI() {
- Action action = new Action("Clear model", IAction.AS_PUSH_BUTTON) {
- @Override
- public void run() {
- clearModel();
- }
- };
- action.setToolTipText("Clear the model");
- return new ActionContributionItem(action);
- }
-
- private ActionContributionItem buildRestoreModelACI() {
- Action action = new Action("Restore model", IAction.AS_PUSH_BUTTON) {
- @Override
- public void run() {
- restoreModel();
- }
- };
- action.setToolTipText("Restore the model");
- return new ActionContributionItem(action);
- }
-
- void addChild() {
- String nodeName = nodeNameText.getText();
- if (nodeName.length() != 0) {
- selectedNode.getValue().addChild(nodeName);
- }
- }
-
- void addNestedChild() {
- String nodeName = nodeNameText.getText();
- if (nodeName.length() != 0) {
- selectedNode.getValue().addNestedChild(nodeName);
- }
- }
-
- void remove() {
- TreeNode node = selectedNode.getValue();
- node.parent().removeChild(node);
- }
-
- void clearModel() {
- controlTree.setInput(null);
- viewTree.setInput(null);
- }
-
- void restoreModel() {
- controlTree.setInput(root);
- viewTree.setInput(root);
- }
-
-
- private static abstract class AbstractTreeItemContentProviderFactory
- implements TreeItemContentProviderFactory
- {
- public TreeItemContentProvider buildItemContentProvider(
- Object item, DelegatingContentAndLabelProvider contentAndLabelProvider) {
- return new GenericTreeItemContentProvider(
- (TreeNode) item, (DelegatingTreeContentAndLabelProvider) contentAndLabelProvider);
- }
- }
-
-
- private static class ControlTreeItemContentProviderFactory extends AbstractTreeItemContentProviderFactory
- {
-
- }
-
-
- private static class ViewTreeItemContentProviderFactory
- extends AbstractTreeItemContentProviderFactory
- {
- @Override
- public TreeItemContentProvider buildItemContentProvider(
- Object item, DelegatingContentAndLabelProvider contentAndLabelProvider) {
- if (item instanceof Parent) {
- return new ViewTreeParentItemContentProvider(
- (Parent) item, (DelegatingTreeContentAndLabelProvider) contentAndLabelProvider);
- }
- return super.buildItemContentProvider(item, contentAndLabelProvider);
- }
- }
-
-
- private static class GenericTreeItemContentProvider extends AbstractTreeItemContentProvider<TreeNode>
- {
- public GenericTreeItemContentProvider(
- TreeNode treeNode, DelegatingTreeContentAndLabelProvider treeContentAndLabelProvider) {
- super(treeNode, treeContentAndLabelProvider);
- }
-
- protected TreeNode treeNode() {
- return (TreeNode) getModel();
- }
-
- @Override
- public TreeNode getParent() {
- return treeNode().parent();
- }
-
- @Override
- protected CollectionValueModel<TreeNode> buildChildrenModel() {
- return new ListCollectionValueModelAdapter<TreeNode>(
- new ListAspectAdapter<TreeNode, TreeNode>(TreeNode.CHILDREN_LIST, treeNode()) {
- @Override
- protected ListIterator<TreeNode> listIterator_() {
- return treeNode().children();
- }
- });
- }
- }
-
- private static class ViewTreeParentItemContentProvider extends GenericTreeItemContentProvider
- {
- public ViewTreeParentItemContentProvider(
- TreeNode treeNode, DelegatingTreeContentAndLabelProvider treeContentAndLabelProvider) {
- super(treeNode, treeContentAndLabelProvider);
- }
-
- @Override
- public TreeNode getParent() {
- TreeNode parent = super.getParent();
- if (parent instanceof Nest) {
- parent = parent.parent();
- }
- return parent;
- }
-
- @Override
- protected CollectionValueModel<TreeNode> buildChildrenModel() {
- return new CompositeCollectionValueModel<TreeNode, TreeNode>(super.buildChildrenModel()) {
- @Override
- protected CollectionValueModel<TreeNode> transform(TreeNode value) {
- if (value instanceof Nest) {
- final Nest nest = (Nest) value;
- return new ListCollectionValueModelAdapter<TreeNode>(
- new ListAspectAdapter<TreeNode, TreeNode>(TreeNode.CHILDREN_LIST, nest) {
- @Override
- protected ListIterator<TreeNode> listIterator_() {
- return nest.children();
- }
- }
- );
- }
- return new StaticCollectionValueModel<TreeNode>(CollectionTools.collection(value));
- }
- };
- }
- }
-
-
- private static class LabelProvider extends BaseLabelProvider
- implements ILabelProvider
- {
- public Image getImage(Object element) {
- return null;
- }
-
- public String getText(Object element) {
- return ((TreeNode) element).getName();
- }
- }
-
-
- private static abstract class TreeNode extends AbstractModel
- {
- private TreeNode parent;
-
- protected final List<TreeNode> children;
- public final static String CHILDREN_LIST = "children";
-
- protected String name;
- public final static String NAME_PROPERTY = "name";
-
-
- public TreeNode(TreeNode parent, String name) {
- this.parent = parent;
- this.children = new ArrayList<TreeNode>();
- this.name = name;
- }
-
- public TreeNode parent() {
- return parent;
- }
-
- public ListIterator<TreeNode> children() {
- return new ReadOnlyListIterator<TreeNode>(children);
- }
-
- protected void addChild(TreeNode child) {
- addItemToList(child, children, CHILDREN_LIST);
- }
-
- public void removeChild(TreeNode child) {
- removeItemFromList(child, children, CHILDREN_LIST);
- }
-
- public void removeChild(int index) {
- removeItemFromList(index, children, CHILDREN_LIST);
- }
-
- public String getName() {
- return name;
- }
-
- public void setName(String newName) {
- String oldName = name;
- name = newName;
- firePropertyChanged(NAME_PROPERTY, oldName, newName);
- }
-
- public boolean canHaveChildren() {
- return false;
- }
-
- public void addChild(String name) {
- throw new UnsupportedOperationException();
- }
-
- public boolean canHaveNestedChildren() {
- return false;
- }
-
- public void addNestedChild(String name) {
- throw new UnsupportedOperationException();
- }
-
- @Override
- public void toString(StringBuilder sb) {
- sb.append(getName());
- }
- }
-
-
- private static class Root extends TreeNode
- {
- public Root() {
- super(null, null);
- }
-
- @Override
- public boolean canHaveChildren() {
- return true;
- }
-
- @Override
- public void addChild(String name) {
- addChild(new Parent(this, name));
- }
- }
-
-
- private static class Parent extends TreeNode
- {
- public Parent(TreeNode parent, String name) {
- super(parent, name);
- }
-
- @Override
- public boolean canHaveChildren() {
- return true;
- }
-
- @Override
- public void addChild(String name) {
- addChild(new Child(this, name));
- }
-
- @Override
- public boolean canHaveNestedChildren() {
- return true;
- }
-
- @Override
- public void addNestedChild(String name) {
- TreeNode nest = new Nest(this);
- addChild(nest);
- nest.addChild(name);
- }
-
- public Iterator<Child> nestlessChildren() {
- return new FilteringIterator<Child, Child>(
- new TransformationIterator<TreeNode, Child>(children()) {
- @Override
- protected Child transform(TreeNode next) {
- if (next instanceof Nest) {
- return ((Nest) next).child();
- }
- return (Child) next;
- }
- }) {
- @Override
- protected boolean accept(Child c) {
- return c != null;
- }
- };
- }
- }
-
-
- private static class Nest extends TreeNode
- {
- public Nest(TreeNode parent) {
- super(parent, "nest");
- }
-
- @Override
- public boolean canHaveChildren() {
- return children.size() == 0;
- }
-
- @Override
- public void addChild(String name) {
- addChild(new Child(this, name));
- }
-
- /* can only have one child */
- public Child child() {
- return (children.isEmpty()) ? null : (Child) children.get(0);
- }
- }
-
-
- private static class Child extends TreeNode
- {
- public Child(TreeNode parent, String name) {
- super(parent, name);
- }
- }
-}
diff --git a/jpa/tests/org.eclipse.jpt.ui.tests/src/org/eclipse/jpt/ui/tests/internal/platform/JpaPlatformUiExtensionTests.java b/jpa/tests/org.eclipse.jpt.ui.tests/src/org/eclipse/jpt/ui/tests/internal/platform/JpaPlatformUiExtensionTests.java
deleted file mode 100644
index 7071c53e69..0000000000
--- a/jpa/tests/org.eclipse.jpt.ui.tests/src/org/eclipse/jpt/ui/tests/internal/platform/JpaPlatformUiExtensionTests.java
+++ /dev/null
@@ -1,56 +0,0 @@
-package org.eclipse.jpt.ui.tests.internal.platform;
-
-import junit.framework.TestCase;
-import org.eclipse.jpt.core.JpaProject;
-import org.eclipse.jpt.core.internal.platform.JpaPlatformRegistry;
-import org.eclipse.jpt.core.tests.extension.resource.ExtensionTestPlugin;
-import org.eclipse.jpt.core.tests.extension.resource.TestJpaPlatformProvider;
-import org.eclipse.jpt.core.tests.internal.projects.TestJpaProject;
-
-@SuppressWarnings("nls")
-public class JpaPlatformUiExtensionTests extends TestCase
-{
- protected TestJpaProject testProject;
-
- protected static final String PROJECT_NAME = "ExtensionTestProject";
- protected static final String PACKAGE_NAME = "extension.test";
-
- public static final String TEST_PLUGIN_CLASS = ExtensionTestPlugin.class.getName();
- public static final String TEST_PLUGIN_ID = ExtensionTestPlugin.PLUGIN_ID;
-
- public static final String TEST_PLATFORM_ID = TestJpaPlatformProvider.ID;
- public static final String TEST_PLATFORM_CLASS = TestJpaPlatformProvider.class.getName();
- public static final String TEST_PLATFORM_LABEL = "Test Jpa Platform";
-
- public static final String TEST_UI_PLATFORM_ID = TEST_PLATFORM_ID;
-
- public JpaPlatformUiExtensionTests(String name) {
- super(name);
- }
-
- @Override
- protected void setUp() throws Exception {
- super.setUp();
- this.testProject = this.buildJpaProject(PROJECT_NAME, false); // false = no auto-build
- }
-
- protected TestJpaProject buildJpaProject(String projectName, boolean autoBuild) throws Exception {
- return new TestJpaProject(projectName, autoBuild); // false = no auto-build
- }
-
- @Override
- protected void tearDown() throws Exception {
- this.testProject.getProject().delete(true, true, null);
- this.testProject = null;
- super.tearDown();
- }
-
- protected JpaProject jpaProject() {
- return this.testProject.getJpaProject();
- }
-
- public void testJpaPlatform() {
- assertNotNull(JpaPlatformRegistry.instance().getJpaPlatform(this.testProject.getProject()));
- }
-
-}
diff --git a/jpa/tests/org.eclipse.jpt.ui.tests/src/org/eclipse/jpt/ui/tests/internal/platform/JptUiPlatformTests.java b/jpa/tests/org.eclipse.jpt.ui.tests/src/org/eclipse/jpt/ui/tests/internal/platform/JptUiPlatformTests.java
deleted file mode 100644
index 50bcc99cfc..0000000000
--- a/jpa/tests/org.eclipse.jpt.ui.tests/src/org/eclipse/jpt/ui/tests/internal/platform/JptUiPlatformTests.java
+++ /dev/null
@@ -1,27 +0,0 @@
-/*******************************************************************************
- * Copyright (c) 2007 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.
- *
- * Contributors:
- * Oracle - initial API and implementation
- ******************************************************************************/
-package org.eclipse.jpt.ui.tests.internal.platform;
-
-import junit.framework.Test;
-import junit.framework.TestSuite;
-
-public class JptUiPlatformTests
-{
- public static Test suite() {
- TestSuite suite = new TestSuite(JptUiPlatformTests.class.getPackage().getName());
- suite.addTestSuite(JpaPlatformUiExtensionTests.class);
- return suite;
- }
-
- private JptUiPlatformTests() {
- super();
- throw new UnsupportedOperationException();
- }
-}
diff --git a/jpa/tests/org.eclipse.jpt.ui.tests/src/org/eclipse/jpt/ui/tests/internal/swt/AbstractComboModelAdapterTest.java b/jpa/tests/org.eclipse.jpt.ui.tests/src/org/eclipse/jpt/ui/tests/internal/swt/AbstractComboModelAdapterTest.java
deleted file mode 100644
index d6d12ea579..0000000000
--- a/jpa/tests/org.eclipse.jpt.ui.tests/src/org/eclipse/jpt/ui/tests/internal/swt/AbstractComboModelAdapterTest.java
+++ /dev/null
@@ -1,773 +0,0 @@
-/*******************************************************************************
- * Copyright (c) 2008 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.
- *
- * Contributors:
- * Oracle - initial API and implementation
- ******************************************************************************/
-package org.eclipse.jpt.ui.tests.internal.swt;
-
-import static org.junit.Assert.*;
-import java.util.ArrayList;
-import java.util.Collection;
-import java.util.Iterator;
-import java.util.List;
-import java.util.ListIterator;
-import org.eclipse.jpt.ui.internal.swt.AbstractComboModelAdapter;
-import org.eclipse.jpt.ui.internal.swt.AbstractComboModelAdapter.SelectionChangeEvent;
-import org.eclipse.jpt.ui.internal.swt.AbstractComboModelAdapter.SelectionChangeListener;
-import org.eclipse.jpt.utility.internal.StringConverter;
-import org.eclipse.jpt.utility.internal.model.AbstractModel;
-import org.eclipse.jpt.utility.internal.model.value.ListAspectAdapter;
-import org.eclipse.jpt.utility.internal.model.value.PropertyAspectAdapter;
-import org.eclipse.jpt.utility.internal.model.value.SimpleListValueModel;
-import org.eclipse.jpt.utility.internal.model.value.SimplePropertyValueModel;
-import org.eclipse.jpt.utility.internal.swing.SimpleDisplayable;
-import org.eclipse.jpt.utility.model.value.ListValueModel;
-import org.eclipse.jpt.utility.model.value.WritablePropertyValueModel;
-import org.eclipse.swt.widgets.Display;
-import org.eclipse.swt.widgets.Shell;
-import org.junit.After;
-import org.junit.Before;
-import org.junit.Test;
-
-@SuppressWarnings("nls")
-public abstract class AbstractComboModelAdapterTest {
-
- private Model model;
- private WritablePropertyValueModel<SimpleDisplayable> selectedItemHolder;
- private Shell shell;
- private WritablePropertyValueModel<Model> subjectHolder;
-
- protected abstract AbstractComboModelAdapter<SimpleDisplayable> buildEditableComboModelAdapter();
-
- protected final ListValueModel<SimpleDisplayable> buildEmptyListHolder() {
- return new SimpleListValueModel<SimpleDisplayable>();
- }
-
- private List<SimpleDisplayable> buildList() {
- List<SimpleDisplayable> list = new ArrayList<SimpleDisplayable>();
- populateCollection(list);
- return list;
- }
-
- protected final ListValueModel<SimpleDisplayable> buildListHolder() {
- return new ListAspectAdapter<Model, SimpleDisplayable>(subjectHolder, Model.ITEMS_LIST) {
- @Override
- protected ListIterator<SimpleDisplayable> listIterator_() {
- return subject.items();
- }
-
- @Override
- protected int size_() {
- return subject.itemsSize();
- }
- };
- }
-
- protected abstract AbstractComboModelAdapter<SimpleDisplayable> buildReadOnlyComboModelAdapter();
-
- private SimpleDisplayable buildSelectedItem() {
- return new SimpleDisplayable("baz");
- }
-
- private WritablePropertyValueModel<SimpleDisplayable> buildSelectedItemHolder() {
- return new PropertyAspectAdapter<Model, SimpleDisplayable>(subjectHolder, Model.ITEM_PROPERTY) {
- @Override
- protected SimpleDisplayable buildValue_() {
- return subject.getItem();
- }
-
- @Override
- protected void setValue_(SimpleDisplayable value) {
- subject.setItem(value);
- }
- };
- }
-
- protected final StringConverter<SimpleDisplayable> buildStringConverter() {
- return new StringConverter<SimpleDisplayable>() {
- public String convertToString(SimpleDisplayable value) {
- return (value == null) ? "" : value.displayString();
- }
- };
- }
-
- private WritablePropertyValueModel<Model> buildSubjectHolder() {
- return new SimplePropertyValueModel<Model>();
- }
-
- public abstract String comboSelectedItem();
-
- protected abstract boolean emptyComboCanHaveSelectedValue();
-
- protected abstract String itemAt(int index);
-
- protected abstract int itemCounts();
-
- private void populateCollection(Collection<SimpleDisplayable> c) {
- c.add(new SimpleDisplayable("foo"));
- c.add(new SimpleDisplayable("bar"));
- c.add(new SimpleDisplayable("baz"));
- c.add(new SimpleDisplayable("joo"));
- c.add(new SimpleDisplayable("jar"));
- c.add(new SimpleDisplayable("jaz"));
- }
-
- protected final WritablePropertyValueModel<SimpleDisplayable> selectedItemHolder() {
- return selectedItemHolder;
- }
-
- @Before
- public void setUp() throws Exception {
-
- shell = new Shell(Display.getCurrent());
- model = new Model();
- subjectHolder = buildSubjectHolder();
- selectedItemHolder = buildSelectedItemHolder();
- }
-
- protected final Shell shell() {
- return shell;
- }
-
- protected final WritablePropertyValueModel<Model> subjectHolder() {
- return subjectHolder;
- }
-
- @After
- public void tearDown() throws Exception {
-
- if (!shell.isDisposed()) {
- shell.dispose();
- }
-
- shell = null;
- subjectHolder = null;
- selectedItemHolder = null;
- }
-
- private void testItems() {
-
- assertEquals(
- "The count of items is not in sync with the model",
- model.itemsSize(),
- itemCounts()
- );
-
- for (int index = 0; index < model.itemsSize(); index++) {
- assertEquals(
- "The item at index " + index + " is not the same between the model and the combo",
- model.itemAt(index).displayString(),
- itemAt(index)
- );
- }
- }
-
- @Test
- public void testNonNullSubjectAfter_AddedAfter_ReadOnly() throws Exception {
-
- buildReadOnlyComboModelAdapter();
- testRemoveItems_AddedAfter();
- }
-
- @Test
- public void testNonNullSubjectAfter_AddedAfter_RemoveItems_Editable() throws Exception {
-
- buildEditableComboModelAdapter();
- testRemoveItems_AddedAfter();
- }
-
- @Test
- public void testNonNullSubjectAfter_AddedBefore_RemoveItems_Editable() throws Exception {
-
- subjectHolder.setValue(model);
- model.addItems(buildList());
-
- buildEditableComboModelAdapter();
- testSelectedItem(null);
- testItems();
-
- ArrayList<SimpleDisplayable> items = new ArrayList<SimpleDisplayable>();
- items.add(model.itemAt(0));
- items.add(model.itemAt(3));
- model.removeItems(items.iterator());
- testItems();
- }
-
- @Test
- public void testNonNullSubjectAfter_AddedBefore_RemoveItems_ReadOnly() throws Exception {
-
- subjectHolder.setValue(model);
- model.addItems(buildList());
-
- buildReadOnlyComboModelAdapter();
- testSelectedItem(null);
- testItems();
-
- ArrayList<SimpleDisplayable> items = new ArrayList<SimpleDisplayable>();
- items.add(model.itemAt(0));
- items.add(model.itemAt(3));
- model.removeItems(items.iterator());
- testItems();
- }
-
- @Test
- public void testNonNullSubjectAfter_NullSelectedItem_ItemsAfterAfter_Editable() throws Exception {
-
- buildEditableComboModelAdapter();
-
- subjectHolder.setValue(model);
- model.addItems(buildList());
-
- testSelectedItem(null);
- testItems();
- }
-
- @Test
- public void testNonNullSubjectAfter_NullSelectedItem_ItemsAfterAfter_ReadOnly() throws Exception {
-
- buildReadOnlyComboModelAdapter();
-
- subjectHolder.setValue(model);
- model.addItems(buildList());
-
- testSelectedItem(null);
- testItems();
- }
-
- @Test
- public void testNonNullSubjectAfter_NullSelectedItem_ItemsAfterBefore_Editable() throws Exception {
-
- buildEditableComboModelAdapter();
-
- model.addItems(buildList());
- subjectHolder.setValue(model);
-
- testSelectedItem(null);
- testItems();
- }
-
- @Test
- public void testNonNullSubjectAfter_NullSelectedItem_ItemsAfterBefore_ReadOnly() throws Exception {
-
- buildReadOnlyComboModelAdapter();
-
- model.addItems(buildList());
- subjectHolder.setValue(model);
-
- testSelectedItem(null);
- testItems();
- }
-
- @Test
- public void testNonNullSubjectAfter_NullSelectedItem_ItemsBefore_Editable() throws Exception {
-
- model.addItems(buildList());
- buildEditableComboModelAdapter();
-
- subjectHolder.setValue(model);
- testSelectedItem(null);
- testItems();
- }
-
- @Test
- public void testNonNullSubjectAfter_NullSelectedItem_ItemsBefore_ReadOnly() throws Exception {
-
- model.addItems(buildList());
- buildReadOnlyComboModelAdapter();
-
- subjectHolder.setValue(model);
- testSelectedItem(null);
- testItems();
- }
-
- @Test
- public void testNonNullSubjectAfter_NullSelectedItem_NoItems_Editable() throws Exception {
-
- buildEditableComboModelAdapter();
-
- subjectHolder.setValue(model);
- testSelectedItem(null);
- testItems();
- }
-
- @Test
- public void testNonNullSubjectAfter_NullSelectedItem_NoItems_ReadOnly() throws Exception {
-
- buildReadOnlyComboModelAdapter();
-
- subjectHolder.setValue(model);
- testSelectedItem(null);
- testItems();
- }
-
- @Test
- public void testNonNullSubjectAfter_SelectedItemChanged_ReadOnly() throws Exception {
-
- subjectHolder.setValue(model);
- model.addItems(buildList());
-
- SimpleDisplayable selectedItem = model.itemAt(0);
-
- AbstractComboModelAdapter<SimpleDisplayable> adapter = buildEditableComboModelAdapter();
- SelectionListener selectionListener = new SelectionListener();
- adapter.addSelectionChangeListener(selectionListener);
-
- assertFalse("The selected item wasn't supposed to be modified", model.isSetItemCalled());
- testSelectedItem(null);
-
- testSelectedItemChanged(selectedItem, selectionListener);
- }
-
- @Test
- public void testNonNullSubjectBefore_NonNullSelectedItemAfter_Editable() throws Exception {
-
- SimpleDisplayable selectedItem = buildSelectedItem();
- subjectHolder.setValue(model);
-
- buildEditableComboModelAdapter();
- assertFalse("The selected item wasn't supposed to be modified", model.isSetItemCalled());
-
- model.setItem(selectedItem);
- assertTrue("The selected item was supposed to be modified", model.isSetItemCalled());
- assertSame("The selected item wasn't set properly", selectedItem, model.getItem());
-
- testSelectedItem(selectedItem);
- testItems();
- }
-
- @Test
- public void testNonNullSubjectBefore_NonNullSelectedItemAfter_Items_Editable() throws Exception {
-
- SimpleDisplayable selectedItem = buildSelectedItem();
- subjectHolder.setValue(model);
-
- buildEditableComboModelAdapter();
- assertFalse("The selected item wasn't supposed to be modified", model.isSetItemCalled());
-
- model.setItem(selectedItem);
- assertTrue("The selected item was supposed to be modified", model.isSetItemCalled());
- assertSame("The selected item wasn't set properly", selectedItem, model.getItem());
-
- testSelectedItem(selectedItem);
- testItems();
- }
-
- @Test
- public void testNonNullSubjectBefore_NonNullSelectedItemAfter_Items_ReadOnly() throws Exception {
-
- List<SimpleDisplayable> list = buildList();
- SimpleDisplayable selectedItem = list.get(0);
- subjectHolder.setValue(model);
-
- buildReadOnlyComboModelAdapter();
- assertFalse("The selected item wasn't supposed to be modified", model.isSetItemCalled());
-
- model.setItem(selectedItem);
- assertTrue("The selected item was supposed to be modified", model.isSetItemCalled());
- assertSame("The selected item wasn't set properly", selectedItem, model.getItem());
-
- testSelectedItem(selectedItem);
- testItems();
- }
-
- @Test
- public void testNonNullSubjectBefore_NonNullSelectedItemAfter_ReadOnly() throws Exception {
-
- List<SimpleDisplayable> list = buildList();
- SimpleDisplayable selectedItem = list.get(0);
- subjectHolder.setValue(model);
-
- buildReadOnlyComboModelAdapter();
- assertFalse("The selected item wasn't supposed to be modified", model.isSetItemCalled());
-
- model.setItem(selectedItem);
- assertTrue("The selected item was supposed to be modified", model.isSetItemCalled());
- assertSame("The selected item wasn't set properly", selectedItem, model.getItem());
-
- testSelectedItem(selectedItem);
- testItems();
- }
-
- @Test
- public void testNonNullSubjectBefore_NonNullSelectedItemBefore_Editable() throws Exception {
-
- model.addItems(buildList());
- SimpleDisplayable selectedItem = model.itemAt(0);
- subjectHolder.setValue(model);
-
- model.setItem(selectedItem);
- assertTrue("The selected item was supposed to be modified", model.isSetItemCalled());
- assertSame("The selected item wasn't set properly", selectedItem, model.getItem());
-
- model.clearItemCalledFlag();
- buildEditableComboModelAdapter();
- assertFalse("The selected item wasn't supposed to be modified", model.isSetItemCalled());
-
- testSelectedItem(selectedItem);
- testItems();
- }
-
- @Test
- public void testNonNullSubjectBefore_NonNullSelectedItemBefore_Items_Editable() throws Exception {
-
- model.addItems(buildList());
- SimpleDisplayable selectedItem = model.itemAt(0);
- subjectHolder.setValue(model);
-
- model.setItem(selectedItem);
- assertTrue("The selected item was supposed to be modified", model.isSetItemCalled());
- assertSame("The selected item wasn't set properly", selectedItem, model.getItem());
-
- model.clearItemCalledFlag();
- buildEditableComboModelAdapter();
- assertFalse("The selected item wasn't supposed to be modified", model.isSetItemCalled());
-
- testSelectedItem(selectedItem);
- testItems();
- }
-
- @Test
- public void testNonNullSubjectBefore_NonNullSelectedItemBefore_Items_ReadOnly() throws Exception {
-
- List<SimpleDisplayable> list = buildList();
- SimpleDisplayable selectedItem = list.get(0);
- subjectHolder.setValue(model);
-
- model.setItem(selectedItem);
- assertTrue("The selected item was supposed to be modified", model.isSetItemCalled());
- assertSame("The selected item wasn't set properly", selectedItem, model.getItem());
-
- model.clearItemCalledFlag();
- buildReadOnlyComboModelAdapter();
- assertFalse("The selected item wasn't supposed to be modified", model.isSetItemCalled());
-
- testSelectedItem(selectedItem);
- testItems();
- }
-
- @Test
- public void testNonNullSubjectBefore_NonNullSelectedItemBefore_ReadOnly() throws Exception {
-
- List<SimpleDisplayable> list = buildList();
- SimpleDisplayable selectedItem = list.get(0);
- subjectHolder.setValue(model);
-
- model.setItem(selectedItem);
- assertTrue("The selected item was supposed to be modified", model.isSetItemCalled());
- assertSame("The selected item wasn't set properly", selectedItem, model.getItem());
-
- model.clearItemCalledFlag();
- buildReadOnlyComboModelAdapter();
- assertFalse("The selected item wasn't supposed to be modified", model.isSetItemCalled());
-
- testSelectedItem(selectedItem);
- testItems();
- }
-
- @Test
- public void testNonNullSubjectBefore_NullSelectedItem_Items_Editable() throws Exception {
-
- subjectHolder.setValue(model);
-
- buildEditableComboModelAdapter();
-
- assertFalse("The item wasn't supposed to be modified", model.isSetItemCalled());
- assertNull("The selected item is supposed to remain null", model.getItem());
- testSelectedItem(null);
- testItems();
- }
-
- @Test
- public void testNonNullSubjectBefore_NullSelectedItem_Items_ReadOnly() throws Exception {
-
- subjectHolder.setValue(model);
-
- buildEditableComboModelAdapter();
-
- assertFalse("The item wasn't supposed to be modified", model.isSetItemCalled());
- assertNull("The selected item is supposed to remain null", model.getItem());
- testSelectedItem(null);
- testItems();
- }
-
- @Test
- public void testNonNullSubjectBefore_NullSelectedItem_NoItems_Editable() throws Exception {
-
- subjectHolder.setValue(model);
-
- buildEditableComboModelAdapter();
-
- assertFalse("The item wasn't supposed to be modified", model.isSetItemCalled());
- assertNull("The selected item is supposed to remain null", model.getItem());
- testSelectedItem(null);
- testItems();
- }
-
- @Test
- public void testNonNullSubjectBefore_NullSelectedItem_NoItems_ReadOnly() throws Exception {
-
- subjectHolder.setValue(model);
-
- buildEditableComboModelAdapter();
-
- assertFalse("The item wasn't supposed to be modified", model.isSetItemCalled());
- assertNull("The selected item is supposed to remain null", model.getItem());
- testSelectedItem(null);
- testItems();
- }
-
- @Test
- public void testNonNullSubjectBefore_SelectedItemChanged_Editable() throws Exception {
-
- model.addItems(buildList());
-
- SimpleDisplayable selectedItem = model.itemAt(3);
- subjectHolder.setValue(model);
-
- AbstractComboModelAdapter<SimpleDisplayable> adapter = buildEditableComboModelAdapter();
- SelectionListener selectionListener = new SelectionListener();
- adapter.addSelectionChangeListener(selectionListener);
-
- assertFalse("The selected item wasn't supposed to be modified", model.isSetItemCalled());
- testSelectedItem(null);
-
- testSelectedItemChanged(selectedItem, selectionListener);
- }
-
- private void testNullSubject() throws Exception {
-
- assertNull("The selected item should be null", selectedItemHolder.getValue());
-
- selectedItemHolder.setValue(buildSelectedItem());
- assertFalse("The item wasn't supposed to be modified", model.isSetItemCalled());
-
- // Null because the subject holder doesn't have the subject set
- testSelectedItem(null);
- testItems();
- }
-
- @Test
- public void testNullSubject_NullSelectedItem_Items_Editable() throws Exception {
- buildEditableComboModelAdapter();
- testNullSubject();
- testItems();
- testSelectedItem(null);
- }
-
- @Test
- public void testNullSubject_NullSelectedItem_Items_ReadOnly() throws Exception {
- buildReadOnlyComboModelAdapter();
- testNullSubject();
- testItems();
- testSelectedItem(null);
- }
-
- @Test
- public void testNullSubject_NullSelectedItem_NoItems_Editable() throws Exception {
- buildEditableComboModelAdapter();
- testNullSubject();
- testItems();
- testSelectedItem(null);
- }
-
- @Test
- public void testNullSubject_NullSelectedItem_NoItems_ReadOnly() throws Exception {
- buildReadOnlyComboModelAdapter();
- testNullSubject();
- testItems();
- testSelectedItem(null);
- }
-
- private void testRemoveItems_AddedAfter() {
-
- subjectHolder.setValue(model);
- model.addItems(buildList());
-
- testSelectedItem(null);
- testItems();
- testSelectedItem(null);
-
- ArrayList<SimpleDisplayable> items = new ArrayList<SimpleDisplayable>();
- items.add(model.itemAt(0));
- items.add(model.itemAt(3));
- model.removeItems(items.iterator());
-
- testItems();
- testSelectedItem(null);
- }
-
- private void testSelectedItem(SimpleDisplayable selectedItem) {
-
- if (selectedItem == null) {
-
- assertNull(
- "The selected item is supposed to be null",
- model.getItem()
- );
-
- assertEquals(
- "The combo's selected item should be null",
- "",
- comboSelectedItem()
- );
- }
- else if (!emptyComboCanHaveSelectedValue()) {
-
- assertEquals(
- "The selected item wasn't set correctly",
- selectedItem,
- model.getItem()
- );
-
- assertEquals(
- "The combo's selected item should be null",
- "",
- comboSelectedItem()
- );
- }
- else {
-
- assertEquals(
- "The selected item wasn't set correctly",
- selectedItem,
- model.getItem()
- );
-
- assertEquals(
- "The selected item wasn't set correctly",
- selectedItem.displayString(),
- comboSelectedItem()
- );
- }
- }
-
- private void testSelectedItemChanged(SimpleDisplayable selectedItem,
- SelectionListener selectionListener) {
-
- // Test 1
- model.setItem(selectedItem);
- assertTrue("The selected item was supposed to be modified", model.isSetItemCalled());
- assertSame("The selected item wasn't set properly", selectedItem, model.getItem());
- assertTrue("The SelectionListener was supposed to be notified", selectionListener.isListenerNotified());
- assertSame("The SelectionListener was supposed to be notified", selectedItem, selectionListener.getItem());
- testSelectedItem(selectedItem);
-
- // Test 2
- selectedItem = model.itemAt(1);
- model.clearItemCalledFlag();
- selectionListener.clearInfo();
-
- model.setItem(selectedItem);
- assertTrue("The selected item was supposed to be modified", model.isSetItemCalled());
- assertSame("The selected item wasn't set properly", selectedItem, model.getItem());
- assertTrue("The SelectionListener was supposed to be notified", selectionListener.isListenerNotified());
- assertSame("The SelectionListener was supposed to be notified", selectedItem, selectionListener.getItem());
- testSelectedItem(selectedItem);
-
- // Test 3
- selectedItem = null;
- model.clearItemCalledFlag();
- selectionListener.clearInfo();
-
- model.setItem(selectedItem);
- assertTrue("The selected item was supposed to be modified", model.isSetItemCalled());
- assertNull("The selected item wasn't set properly", model.getItem());
- assertTrue("The SelectionListener was supposed to be notified", selectionListener.isListenerNotified());
- assertSame("The SelectionListener was supposed to be notified", selectedItem, selectionListener.getItem());
- testSelectedItem(selectedItem);
-
- // Test 3
- selectedItem = model.itemAt(2);
- model.clearItemCalledFlag();
- selectionListener.clearInfo();
-
- model.setItem(selectedItem);
- assertTrue("The selected item was supposed to be modified", model.isSetItemCalled());
- assertSame("The selected item wasn't set properly", selectedItem, model.getItem());
- assertTrue("The SelectionListener was supposed to be notified", selectionListener.isListenerNotified());
- assertSame("The SelectionListener was supposed to be notified", selectedItem, selectionListener.getItem());
- testSelectedItem(selectedItem);
- }
-
- private static class Model extends AbstractModel {
-
- private SimpleDisplayable item;
- private List<SimpleDisplayable> items = new ArrayList<SimpleDisplayable>();
- private boolean setItemCalled;
-
- static final String ITEM_PROPERTY = "item";
- static final String ITEMS_LIST = "items";
-
- void addItems(Iterator<SimpleDisplayable> items) {
- addItemsToList(items, this.items, ITEMS_LIST);
- }
-
- void addItems(List<SimpleDisplayable> items) {
- addItemsToList(items, this.items, ITEMS_LIST);
- }
-
- void clearItemCalledFlag() {
- setItemCalled = false;
- }
-
- SimpleDisplayable getItem() {
- return item;
- }
-
- boolean isSetItemCalled() {
- return setItemCalled;
- }
-
- SimpleDisplayable itemAt(int index) {
- return this.items.get(index);
- }
-
- ListIterator<SimpleDisplayable> items() {
- return items.listIterator();
- }
-
- int itemsSize() {
- return items.size();
- }
-
- void removeItems(Iterator<SimpleDisplayable> items) {
- removeItemsFromList(items, this.items, ITEMS_LIST);
- }
-
- void setItem(SimpleDisplayable item) {
- setItemCalled = true;
-
- SimpleDisplayable oldItem = this.item;
- this.item = item;
- firePropertyChanged(ITEM_PROPERTY, oldItem, item);
- }
- }
-
- private class SelectionListener implements SelectionChangeListener<SimpleDisplayable> {
-
- private SimpleDisplayable item;
- private boolean listenerNotified;
-
- void clearInfo() {
- this.listenerNotified = false;
- this.item = null;
- }
-
- SimpleDisplayable getItem() {
- return item;
- }
-
- public boolean isListenerNotified() {
- return listenerNotified;
- }
-
- public void selectionChanged(SelectionChangeEvent<SimpleDisplayable> e) {
- listenerNotified = true;
- item = e.selectedItem();
- }
- }
-}
diff --git a/jpa/tests/org.eclipse.jpt.ui.tests/src/org/eclipse/jpt/ui/tests/internal/swt/CComboModelAdapterTest.java b/jpa/tests/org.eclipse.jpt.ui.tests/src/org/eclipse/jpt/ui/tests/internal/swt/CComboModelAdapterTest.java
deleted file mode 100644
index 4cf143eb90..0000000000
--- a/jpa/tests/org.eclipse.jpt.ui.tests/src/org/eclipse/jpt/ui/tests/internal/swt/CComboModelAdapterTest.java
+++ /dev/null
@@ -1,75 +0,0 @@
-/*******************************************************************************
- * Copyright (c) 2008 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.
- *
- * Contributors:
- * Oracle - initial API and implementation
- ******************************************************************************/
-package org.eclipse.jpt.ui.tests.internal.swt;
-
-import org.eclipse.jpt.ui.internal.swt.AbstractComboModelAdapter;
-import org.eclipse.jpt.ui.internal.swt.CComboModelAdapter;
-import org.eclipse.jpt.utility.internal.swing.SimpleDisplayable;
-import org.eclipse.swt.SWT;
-import org.eclipse.swt.custom.CCombo;
-import org.junit.After;
-
-public class CComboModelAdapterTest extends AbstractComboModelAdapterTest {
-
- private CCombo combo;
-
- @Override
- protected AbstractComboModelAdapter<SimpleDisplayable> buildEditableComboModelAdapter() {
-
- combo = new CCombo(shell(), SWT.NULL);
-
- return CComboModelAdapter.adapt(
- buildListHolder(),
- selectedItemHolder(),
- combo,
- buildStringConverter()
- );
- }
-
- @Override
- protected AbstractComboModelAdapter<SimpleDisplayable> buildReadOnlyComboModelAdapter() {
-
- combo = new CCombo(shell(), SWT.READ_ONLY);
-
- return CComboModelAdapter.adapt(
- buildListHolder(),
- selectedItemHolder(),
- combo,
- buildStringConverter()
- );
- }
-
- @Override
- public String comboSelectedItem() {
- return combo.getText();
- }
-
- @Override
- protected boolean emptyComboCanHaveSelectedValue() {
- return true;
- }
-
- @Override
- protected String itemAt(int index) {
- return this.combo.getItem(index);
- }
-
- @Override
- protected int itemCounts() {
- return combo.getItemCount();
- }
-
- @After
- @Override
- public void tearDown() throws Exception {
- super.tearDown();
- combo = null;
- }
-}
diff --git a/jpa/tests/org.eclipse.jpt.ui.tests/src/org/eclipse/jpt/ui/tests/internal/swt/CheckBoxModelAdapterUITest.java b/jpa/tests/org.eclipse.jpt.ui.tests/src/org/eclipse/jpt/ui/tests/internal/swt/CheckBoxModelAdapterUITest.java
deleted file mode 100644
index d2cf139f45..0000000000
--- a/jpa/tests/org.eclipse.jpt.ui.tests/src/org/eclipse/jpt/ui/tests/internal/swt/CheckBoxModelAdapterUITest.java
+++ /dev/null
@@ -1,318 +0,0 @@
-/*******************************************************************************
- * Copyright (c) 2007, 2008 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.
- *
- * Contributors:
- * Oracle - initial API and implementation
- ******************************************************************************/
-package org.eclipse.jpt.ui.tests.internal.swt;
-
-import org.eclipse.jface.action.Action;
-import org.eclipse.jface.action.ActionContributionItem;
-import org.eclipse.jface.action.IAction;
-import org.eclipse.jface.window.ApplicationWindow;
-import org.eclipse.jface.window.Window;
-import org.eclipse.jpt.ui.internal.swt.BooleanButtonModelAdapter;
-import org.eclipse.jpt.utility.internal.ClassTools;
-import org.eclipse.jpt.utility.internal.model.AbstractModel;
-import org.eclipse.jpt.utility.internal.model.value.PropertyAspectAdapter;
-import org.eclipse.jpt.utility.internal.model.value.SimplePropertyValueModel;
-import org.eclipse.jpt.utility.model.value.PropertyValueModel;
-import org.eclipse.jpt.utility.model.value.WritablePropertyValueModel;
-import org.eclipse.swt.SWT;
-import org.eclipse.swt.events.SelectionEvent;
-import org.eclipse.swt.events.SelectionListener;
-import org.eclipse.swt.layout.FillLayout;
-import org.eclipse.swt.layout.FormAttachment;
-import org.eclipse.swt.layout.FormData;
-import org.eclipse.swt.layout.FormLayout;
-import org.eclipse.swt.widgets.Button;
-import org.eclipse.swt.widgets.Composite;
-import org.eclipse.swt.widgets.Control;
-import org.eclipse.swt.widgets.Display;
-import org.eclipse.swt.widgets.Shell;
-
-/**
- * Play around with a set of check boxes.
- */
-public class CheckBoxModelAdapterUITest
- extends ApplicationWindow
-{
- private final TestModel testModel;
- private final WritablePropertyValueModel<TestModel> testModelHolder;
- private final WritablePropertyValueModel<Boolean> flag1Holder;
- private final WritablePropertyValueModel<Boolean> flag2Holder;
- private final WritablePropertyValueModel<Boolean> notFlag2Holder;
-
- public static void main(String[] args) throws Exception {
- Window window = new CheckBoxModelAdapterUITest(args);
- window.setBlockOnOpen(true);
- window.open();
- Display.getCurrent().dispose();
- System.exit(0);
- }
-
- private CheckBoxModelAdapterUITest(String[] args) {
- super(null);
- this.testModel = new TestModel(true, true);
- this.testModelHolder = new SimplePropertyValueModel<TestModel>(this.testModel);
- this.flag1Holder = this.buildFlag1Holder(this.testModelHolder);
- this.flag2Holder = this.buildFlag2Holder(this.testModelHolder);
- this.notFlag2Holder = this.buildNotFlag2Holder(this.testModelHolder);
- }
-
- private WritablePropertyValueModel<Boolean> buildFlag1Holder(PropertyValueModel<TestModel> subjectHolder) {
- return new PropertyAspectAdapter<TestModel, Boolean>(subjectHolder, TestModel.FLAG1_PROPERTY) {
- @Override
- protected Boolean buildValue_() {
- return Boolean.valueOf(this.subject.isFlag1());
- }
- @Override
- protected void setValue_(Boolean value) {
- this.subject.setFlag1(value.booleanValue());
- }
- };
- }
-
- private WritablePropertyValueModel<Boolean> buildFlag2Holder(PropertyValueModel<TestModel> subjectHolder) {
- return new PropertyAspectAdapter<TestModel, Boolean>(subjectHolder, TestModel.FLAG2_PROPERTY) {
- @Override
- protected Boolean buildValue_() {
- return Boolean.valueOf(this.subject.isFlag2());
- }
- @Override
- protected void setValue_(Boolean value) {
- this.subject.setFlag2(value.booleanValue());
- }
- };
- }
-
- private WritablePropertyValueModel<Boolean> buildNotFlag2Holder(PropertyValueModel<TestModel> subjectHolder) {
- return new PropertyAspectAdapter<TestModel, Boolean>(subjectHolder, TestModel.NOT_FLAG2_PROPERTY) {
- @Override
- protected Boolean buildValue_() {
- return Boolean.valueOf(this.subject.isNotFlag2());
- }
- @Override
- protected void setValue_(Boolean value) {
- this.subject.setNotFlag2(value.booleanValue());
- }
- };
- }
-
- @Override
- protected Control createContents(Composite parent) {
- ((Shell) parent).setText(ClassTools.shortClassNameForObject(this));
- parent.setSize(400, 100);
- Composite mainPanel = new Composite(parent, SWT.NONE);
- mainPanel.setLayout(new FormLayout());
- Control checkBoxPanel = this.buildCheckBoxPanel(mainPanel);
- this.buildControlPanel(mainPanel, checkBoxPanel);
- return mainPanel;
- }
-
- private Control buildCheckBoxPanel(Composite parent) {
- Composite panel = new Composite(parent, SWT.NONE);
-
- FormData fd = new FormData();
- fd.top = new FormAttachment(0);
- fd.bottom = new FormAttachment(100, -35);
- fd.left = new FormAttachment(0);
- fd.right = new FormAttachment(100);
- panel.setLayoutData(fd);
-
- panel.setLayout(new FillLayout());
- this.buildFlag1CheckBox(panel);
- this.buildFlag2CheckBox(panel);
- this.buildNotFlag2CheckBox(panel);
- this.buildUnattachedCheckBox(panel);
-
- return panel;
- }
-
- private void buildFlag1CheckBox(Composite parent) {
- Button checkBox = new Button(parent, SWT.CHECK);
- checkBox.setText("flag 1");
- BooleanButtonModelAdapter.adapt(this.flag1Holder, checkBox);
- }
-
- private void buildFlag2CheckBox(Composite parent) {
- Button checkBox = new Button(parent, SWT.CHECK);
- checkBox.setText("flag 2");
- BooleanButtonModelAdapter.adapt(this.flag2Holder, checkBox);
- }
-
- private void buildNotFlag2CheckBox(Composite parent) {
- Button checkBox = new Button(parent, SWT.CHECK);
- checkBox.setText("not flag 2");
- BooleanButtonModelAdapter.adapt(this.notFlag2Holder, checkBox);
- }
-
- private void buildUnattachedCheckBox(Composite parent) {
- Button checkBox = new Button(parent, SWT.CHECK);
- checkBox.setText("unattached");
- checkBox.addSelectionListener(this.buildUnattachedSelectionListener());
- }
-
- private SelectionListener buildUnattachedSelectionListener() {
- return new SelectionListener() {
- public void widgetDefaultSelected(SelectionEvent e) {
- System.out.println("unattached default selected: " + e);
- }
- public void widgetSelected(SelectionEvent e) {
- System.out.println("unattached selected: " + e);
- }
- };
- }
-
- private void buildControlPanel(Composite parent, Control checkBoxPanel) {
- Composite panel = new Composite(parent, SWT.NONE);
- FormData fd = new FormData();
- fd.top = new FormAttachment(checkBoxPanel);
- fd.bottom = new FormAttachment(100);
- fd.left = new FormAttachment(0);
- fd.right = new FormAttachment(100);
- panel.setLayoutData(fd);
-
- panel.setLayout(new FillLayout());
- this.buildFlipFlag1Button(panel);
- this.buildNotFlag2ToggleButton(panel);
- this.buildClearModelButton(panel);
- this.buildRestoreModelButton(panel);
- this.buildPrintModelButton(panel);
- }
-
- private void buildFlipFlag1Button(Composite parent) {
- this.buildFlipFlag1ACI().fill(parent);
- }
-
- private ActionContributionItem buildFlipFlag1ACI() {
- Action action = new Action("flip flag 1", IAction.AS_PUSH_BUTTON) {
- @Override
- public void run() {
- CheckBoxModelAdapterUITest.this.flipFlag1();
- }
- };
- action.setToolTipText("flip flag 1");
- return new ActionContributionItem(action);
- }
-
- void flipFlag1() {
- this.testModel.setFlag1( ! this.testModel.isFlag1());
- }
-
- private void buildNotFlag2ToggleButton(Composite parent) {
- Button checkBox = new Button(parent, SWT.TOGGLE);
- checkBox.setText("not flag 2");
- BooleanButtonModelAdapter.adapt(this.notFlag2Holder, checkBox);
- }
-
- private void buildClearModelButton(Composite parent) {
- this.buildClearModelACI().fill(parent);
- }
-
- private ActionContributionItem buildClearModelACI() {
- Action action = new Action("clear model", IAction.AS_PUSH_BUTTON) {
- @Override
- public void run() {
- CheckBoxModelAdapterUITest.this.clearModel();
- }
- };
- action.setToolTipText("clear model");
- return new ActionContributionItem(action);
- }
-
- void clearModel() {
- this.testModelHolder.setValue(null);
- }
-
- private void buildRestoreModelButton(Composite parent) {
- this.buildRestoreModelACI().fill(parent);
- }
-
- private ActionContributionItem buildRestoreModelACI() {
- Action action = new Action("restore model", IAction.AS_PUSH_BUTTON) {
- @Override
- public void run() {
- CheckBoxModelAdapterUITest.this.restoreModel();
- }
- };
- action.setToolTipText("restore model");
- return new ActionContributionItem(action);
- }
-
- void restoreModel() {
- this.testModelHolder.setValue(this.testModel);
- }
-
- private void buildPrintModelButton(Composite parent) {
- this.buildPrintModelACI().fill(parent);
- }
-
- private ActionContributionItem buildPrintModelACI() {
- Action action = new Action("print model", IAction.AS_PUSH_BUTTON) {
- @Override
- public void run() {
- CheckBoxModelAdapterUITest.this.printModel();
- }
- };
- action.setToolTipText("print model");
- return new ActionContributionItem(action);
- }
-
- void printModel() {
- System.out.println("flag 1: " + this.testModel.isFlag1());
- System.out.println("flag 2: " + this.testModel.isFlag2());
- System.out.println("not flag 2: " + this.testModel.isNotFlag2());
- System.out.println("***");
- }
-
-
- private class TestModel extends AbstractModel {
- private boolean flag1;
- public static final String FLAG1_PROPERTY = "flag1";
- private boolean flag2;
- public static final String FLAG2_PROPERTY = "flag2";
- private boolean notFlag2;
- public static final String NOT_FLAG2_PROPERTY = "notFlag2";
-
- public TestModel(boolean flag1, boolean flag2) {
- this.flag1 = flag1;
- this.flag2 = flag2;
- this.notFlag2 = ! flag2;
- }
- public boolean isFlag1() {
- return this.flag1;
- }
- public void setFlag1(boolean flag1) {
- boolean old = this.flag1;
- this.flag1 = flag1;
- this.firePropertyChanged(FLAG1_PROPERTY, old, flag1);
- }
- public boolean isFlag2() {
- return this.flag2;
- }
- public void setFlag2(boolean flag2) {
- boolean old = this.flag2;
- this.flag2 = flag2;
- this.firePropertyChanged(FLAG2_PROPERTY, old, flag2);
-
- old = this.notFlag2;
- this.notFlag2 = ! flag2;
- this.firePropertyChanged(NOT_FLAG2_PROPERTY, old, this.notFlag2);
- }
- public boolean isNotFlag2() {
- return this.notFlag2;
- }
- public void setNotFlag2(boolean notFlag2) {
- this.setFlag2( ! notFlag2);
- }
- @Override
- public String toString() {
- return "TestModel(" + this.isFlag1() + " - " + this.isFlag2() + ")";
- }
- }
-
-}
diff --git a/jpa/tests/org.eclipse.jpt.ui.tests/src/org/eclipse/jpt/ui/tests/internal/swt/ComboModelAdapterTest.java b/jpa/tests/org.eclipse.jpt.ui.tests/src/org/eclipse/jpt/ui/tests/internal/swt/ComboModelAdapterTest.java
deleted file mode 100644
index 0fb152a17f..0000000000
--- a/jpa/tests/org.eclipse.jpt.ui.tests/src/org/eclipse/jpt/ui/tests/internal/swt/ComboModelAdapterTest.java
+++ /dev/null
@@ -1,78 +0,0 @@
-/*******************************************************************************
- * Copyright (c) 2008 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.
- *
- * Contributors:
- * Oracle - initial API and implementation
- ******************************************************************************/
-package org.eclipse.jpt.ui.tests.internal.swt;
-
-import org.eclipse.jpt.ui.internal.swt.AbstractComboModelAdapter;
-import org.eclipse.jpt.ui.internal.swt.ComboModelAdapter;
-import org.eclipse.jpt.utility.internal.swing.SimpleDisplayable;
-import org.eclipse.swt.SWT;
-import org.eclipse.swt.widgets.Combo;
-import org.junit.After;
-
-public class ComboModelAdapterTest extends AbstractComboModelAdapterTest {
-
- private Combo combo;
- private boolean editable;
-
- @Override
- protected AbstractComboModelAdapter<SimpleDisplayable> buildEditableComboModelAdapter() {
-
- combo = new Combo(shell(), SWT.NULL);
- editable = true;
-
- return ComboModelAdapter.adapt(
- buildListHolder(),
- selectedItemHolder(),
- combo,
- buildStringConverter()
- );
- }
-
- @Override
- protected AbstractComboModelAdapter<SimpleDisplayable> buildReadOnlyComboModelAdapter() {
-
- combo = new Combo(shell(), SWT.READ_ONLY);
- editable = false;
-
- return ComboModelAdapter.adapt(
- buildListHolder(),
- selectedItemHolder(),
- combo,
- buildStringConverter()
- );
- }
-
- @Override
- public String comboSelectedItem() {
- return combo.getText();
- }
-
- @Override
- protected boolean emptyComboCanHaveSelectedValue() {
- return editable;
- }
-
- @Override
- protected String itemAt(int index) {
- return this.combo.getItem(index);
- }
-
- @Override
- protected int itemCounts() {
- return combo.getItemCount();
- }
-
- @After
- @Override
- public void tearDown() throws Exception {
- super.tearDown();
- combo = null;
- }
-}
diff --git a/jpa/tests/org.eclipse.jpt.ui.tests/src/org/eclipse/jpt/ui/tests/internal/swt/JptUiSWTTests.java b/jpa/tests/org.eclipse.jpt.ui.tests/src/org/eclipse/jpt/ui/tests/internal/swt/JptUiSWTTests.java
deleted file mode 100644
index 12a8c2fbce..0000000000
--- a/jpa/tests/org.eclipse.jpt.ui.tests/src/org/eclipse/jpt/ui/tests/internal/swt/JptUiSWTTests.java
+++ /dev/null
@@ -1,39 +0,0 @@
-/*******************************************************************************
- * Copyright (c) 2008 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.
- *
- * Contributors:
- * Oracle - initial API and implementation
- ******************************************************************************/
-package org.eclipse.jpt.ui.tests.internal.swt;
-
-import junit.framework.JUnit4TestAdapter;
-import junit.framework.Test;
-import junit.framework.TestSuite;
-import org.junit.runner.RunWith;
-import org.junit.runners.Suite;
-import org.junit.runners.Suite.SuiteClasses;
-
-@SuiteClasses
-({
- CComboModelAdapterTest.class,
- ComboModelAdapterTest.class,
- SpinnerModelAdapterTest.class,
- TableModelAdapterTest.class
-})
-@RunWith(Suite.class)
-public final class JptUiSWTTests {
-
- private JptUiSWTTests() {
- super();
- throw new UnsupportedOperationException();
- }
-
- public static Test suite() {
- TestSuite suite = new TestSuite();
- suite.addTest(new JUnit4TestAdapter(JptUiSWTTests.class));
- return suite;
- }
-}
diff --git a/jpa/tests/org.eclipse.jpt.ui.tests/src/org/eclipse/jpt/ui/tests/internal/swt/ListBoxModelAdapterUITest.java b/jpa/tests/org.eclipse.jpt.ui.tests/src/org/eclipse/jpt/ui/tests/internal/swt/ListBoxModelAdapterUITest.java
deleted file mode 100644
index 900dd8769c..0000000000
--- a/jpa/tests/org.eclipse.jpt.ui.tests/src/org/eclipse/jpt/ui/tests/internal/swt/ListBoxModelAdapterUITest.java
+++ /dev/null
@@ -1,640 +0,0 @@
-/*******************************************************************************
- * Copyright (c) 2007, 2009 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.
- *
- * Contributors:
- * Oracle - initial API and implementation
- ******************************************************************************/
-package org.eclipse.jpt.ui.tests.internal.swt;
-
-import java.text.Collator;
-import java.util.ArrayList;
-import java.util.Collection;
-import java.util.Comparator;
-import java.util.Date;
-import java.util.HashSet;
-import java.util.Iterator;
-import java.util.List;
-import java.util.ListIterator;
-import org.eclipse.jface.action.Action;
-import org.eclipse.jface.action.ActionContributionItem;
-import org.eclipse.jface.action.IAction;
-import org.eclipse.jface.window.ApplicationWindow;
-import org.eclipse.jface.window.Window;
-import org.eclipse.jpt.ui.internal.swt.ListBoxModelAdapter;
-import org.eclipse.jpt.ui.internal.swt.ListBoxModelAdapter.SelectionChangeEvent;
-import org.eclipse.jpt.utility.internal.ClassTools;
-import org.eclipse.jpt.utility.internal.model.AbstractModel;
-import org.eclipse.jpt.utility.internal.model.value.CollectionAspectAdapter;
-import org.eclipse.jpt.utility.internal.model.value.ListAspectAdapter;
-import org.eclipse.jpt.utility.internal.model.value.SimpleCollectionValueModel;
-import org.eclipse.jpt.utility.internal.model.value.SimplePropertyValueModel;
-import org.eclipse.jpt.utility.internal.model.value.SortedListValueModelAdapter;
-import org.eclipse.jpt.utility.model.Model;
-import org.eclipse.jpt.utility.model.value.CollectionValueModel;
-import org.eclipse.jpt.utility.model.value.ListValueModel;
-import org.eclipse.jpt.utility.model.value.WritablePropertyValueModel;
-import org.eclipse.swt.SWT;
-import org.eclipse.swt.layout.FillLayout;
-import org.eclipse.swt.layout.FormAttachment;
-import org.eclipse.swt.layout.FormData;
-import org.eclipse.swt.layout.FormLayout;
-import org.eclipse.swt.widgets.Composite;
-import org.eclipse.swt.widgets.Control;
-import org.eclipse.swt.widgets.Display;
-import org.eclipse.swt.widgets.Label;
-import org.eclipse.swt.widgets.Shell;
-import org.eclipse.swt.widgets.Text;
-
-/**
- * an example UI for testing various permutations of the
- * StructuredContentProviderAdapter
- */
-public class ListBoxModelAdapterUITest
- extends ApplicationWindow
-{
- final TaskList taskList;
- private final WritablePropertyValueModel<TaskList> taskListHolder;
- private Text taskTextField;
-
- public static void main(String[] args) throws Exception {
- Window window = new ListBoxModelAdapterUITest(args);
- window.setBlockOnOpen(true);
- window.open();
- Display.getCurrent().dispose();
- System.exit(0);
- }
-
- private ListBoxModelAdapterUITest(String[] args) {
- super(null);
- this.taskList = new TaskList();
- this.taskListHolder = new SimplePropertyValueModel<TaskList>(this.taskList);
- this.taskList.addTask("swim");
- this.taskList.addTask("bike");
- this.taskList.addTask("run");
- Task rest = this.taskList.addTask("rest");
- this.taskList.addPriorityTask(rest);
- Task repeat = this.taskList.addTask("repeat");
- this.taskList.addPriorityTask(repeat);
- }
-
- @Override
- protected Control createContents(Composite parent) {
- ((Shell) parent).setText(ClassTools.shortClassNameForObject(this));
- parent.setSize(800, 400);
- Composite mainPanel = new Composite(parent, SWT.NONE);
- mainPanel.setLayout(new FormLayout());
- Control taskListPanel = this.buildTaskListPanel(mainPanel);
- this.buildControlPanel(mainPanel, taskListPanel);
- return mainPanel;
- }
-
- private Control buildTaskListPanel(Composite parent) {
- Composite panel = new Composite(parent, SWT.NONE);
-
- FormData fd = new FormData();
- fd.top = new FormAttachment(0);
- fd.bottom = new FormAttachment(100, -30);
- fd.left = new FormAttachment(0);
- fd.right = new FormAttachment(100);
- panel.setLayoutData(fd);
-
- panel.setLayout(new FormLayout());
- this.buildPrimitiveTaskListPanel(panel);
- this.buildObjectTaskListPanel(panel);
-
- return panel;
- }
-
- private void buildPrimitiveTaskListPanel(Composite parent) {
- Composite panel = new Composite(parent, SWT.NONE);
-
- FormData fd = new FormData();
- fd.top = new FormAttachment(0);
- fd.bottom = new FormAttachment(50);
- fd.left = new FormAttachment(0);
- fd.right = new FormAttachment(100);
- panel.setLayoutData(fd);
-
- panel.setLayout(new FillLayout());
- this.buildUnsortedPrimitiveListPanel(panel);
- this.buildStandardSortedPrimitiveListPanel(panel);
- this.buildCustomSortedPrimitiveListPanel(panel);
- }
-
- private void buildObjectTaskListPanel(Composite parent) {
- Composite panel = new Composite(parent, SWT.NONE);
-
- FormData fd = new FormData();
- fd.top = new FormAttachment(50);
- fd.bottom = new FormAttachment(100);
- fd.left = new FormAttachment(0);
- fd.right = new FormAttachment(100);
- panel.setLayoutData(fd);
-
- panel.setLayout(new FillLayout());
- this.buildUnsortedObjectListPanel(panel);
- this.buildStandardSortedObjectListPanel(panel);
- this.buildCustomSortedObjectListPanel(panel);
- }
-
- private void buildUnsortedPrimitiveListPanel(Composite parent) {
- this.buildListPanel(parent, "primitive unsorted", this.buildUnsortedPrimitiveListModel(), new SimpleCollectionValueModel<String>());
- }
-
- private void buildStandardSortedPrimitiveListPanel(Composite parent) {
- this.buildListPanel(parent, "primitive sorted", this.buildStandardSortedPrimitiveListModel(), new SimpleCollectionValueModel<String>());
- }
-
- private void buildCustomSortedPrimitiveListPanel(Composite parent) {
- this.buildListPanel(parent, "primitive reverse sorted", this.buildCustomSortedPrimitiveListModel(), new SimpleCollectionValueModel<String>());
- }
-
- private void buildUnsortedObjectListPanel(Composite parent) {
- this.buildListPanel2(parent, "object unsorted", this.buildUnsortedObjectListModel(), this.buildPriorityTaskListAdapter());
- }
-
- private void buildStandardSortedObjectListPanel(Composite parent) {
- this.buildListPanel2(parent, "object sorted", this.buildStandardSortedObjectListModel(), this.buildPriorityTaskListAdapter());
- }
-
- private void buildCustomSortedObjectListPanel(Composite parent) {
- this.buildListPanel2(parent, "object reverse sorted", this.buildCustomSortedObjectListModel(), this.buildPriorityTaskListAdapter());
- }
-
- private ListValueModel<String> buildUnsortedPrimitiveListModel() {
- return this.buildPrimitiveTaskListAdapter();
- }
-
- private ListValueModel<String> buildStandardSortedPrimitiveListModel() {
- return new SortedListValueModelAdapter<String>(this.buildPrimitiveTaskListAdapter());
- }
-
- private ListValueModel<String> buildCustomSortedPrimitiveListModel() {
- return new SortedListValueModelAdapter<String>(this.buildPrimitiveTaskListAdapter(), this.buildCustomStringComparator());
- }
-
- private ListValueModel<Task> buildUnsortedObjectListModel() {
- return this.buildObjectTaskListAdapter();
- }
-
- private ListValueModel<Task> buildStandardSortedObjectListModel() {
- return new SortedListValueModelAdapter<Task>(this.buildObjectTaskListAdapter());
- }
-
- private ListValueModel<Task> buildCustomSortedObjectListModel() {
- return new SortedListValueModelAdapter<Task>(this.buildObjectTaskListAdapter(), this.buildCustomTaskComparator());
- }
-
- private <E> ListBoxModelAdapter<E> buildListPanel(Composite parent, String label, ListValueModel<E> model, CollectionValueModel<E> selectedItemsModel) {
- Composite panel = new Composite(parent, SWT.NONE);
- panel.setLayout(new FormLayout());
-
- Label listLabel = new Label(panel, SWT.LEFT | SWT.VERTICAL);
- listLabel.setText(label);
- FormData fd = new FormData();
- fd.top = new FormAttachment(0, 3);
- fd.bottom = new FormAttachment(0, 20);
- fd.left = new FormAttachment(0, 5);
- fd.right = new FormAttachment(100);
- listLabel.setLayoutData(fd);
-
- org.eclipse.swt.widgets.List listBox = new org.eclipse.swt.widgets.List(panel, SWT.MULTI | SWT.BORDER);
- fd = new FormData();
- fd.top = new FormAttachment(listLabel);
- fd.bottom = new FormAttachment(100);
- fd.left = new FormAttachment(0);
- fd.right = new FormAttachment(100);
- listBox.setLayoutData(fd);
- return ListBoxModelAdapter.adapt(model, selectedItemsModel, listBox); // use #toString()
- }
-
- private void buildListPanel2(Composite parent, String label, ListValueModel<Task> model, CollectionValueModel<Task> selectedItemsModel) {
- ListBoxModelAdapter<Task> adapter = this.buildListPanel(parent, label, model, selectedItemsModel);
- adapter.addDoubleClickListener(this.buildDoubleClickListener());
- adapter.addSelectionChangeListener(this.buildSelectionChangeListener());
- }
-
- private ListBoxModelAdapter.DoubleClickListener<Task> buildDoubleClickListener() {
- return new ListBoxModelAdapter.DoubleClickListener<Task>() {
- public void doubleClick(ListBoxModelAdapter.DoubleClickEvent<Task> event) {
- System.out.println("double-click: " + event.selection());
- }
- };
- }
-
- private ListBoxModelAdapter.SelectionChangeListener<Task> buildSelectionChangeListener() {
- return new ListBoxModelAdapter.SelectionChangeListener<Task>() {
- public void selectionChanged(SelectionChangeEvent<Task> event) {
- ListBoxModelAdapterUITest.this.taskList.setPriorityTasks(event.selection());
- }
- };
- }
-
- private Comparator<String> buildCustomStringComparator() {
- return new Comparator<String>() {
- public int compare(String s1, String s2) {
- return s2.compareTo(s1);
- }
- };
- }
-
- private Comparator<Task> buildCustomTaskComparator() {
- return new Comparator<Task>() {
- public int compare(Task to1, Task to2) {
- return to2.compareTo(to1);
- }
- };
- }
-
- private ListValueModel<String> buildPrimitiveTaskListAdapter() {
- return new ListAspectAdapter<TaskList, String>(this.taskListHolder, TaskList.TASK_NAMES_LIST) {
- @Override
- protected ListIterator<String> listIterator_() {
- return this.subject.taskNames();
- }
- };
- }
-
- private ListValueModel<Task> buildObjectTaskListAdapter() {
- return new ListAspectAdapter<TaskList, Task>(this.taskListHolder, TaskList.TASKS_LIST) {
- @Override
- protected ListIterator<Task> listIterator_() {
- return this.subject.tasks();
- }
- };
- }
-
- private CollectionValueModel<Task> buildPriorityTaskListAdapter() {
- return new CollectionAspectAdapter<TaskList, Task>(this.taskListHolder, TaskList.PRIORITY_TASKS_COLLECTION) {
- @Override
- protected Iterator<Task> iterator_() {
- return this.subject.priorityTasks();
- }
- };
- }
-
- private void buildControlPanel(Composite parent, Control taskListPanel) {
- Composite panel = new Composite(parent, SWT.NONE);
- FormData fd = new FormData();
- fd.top = new FormAttachment(taskListPanel);
- fd.bottom = new FormAttachment(100);
- fd.left = new FormAttachment(0);
- fd.right = new FormAttachment(100);
- panel.setLayoutData(fd);
-
- panel.setLayout(new FormLayout());
- Control misc = this.buildMiscTaskPanel(panel);
- this.buildAddRemoveTaskPanel(panel, misc);
- }
-
- // is there a better way to associate an ACI with form data?
- private Control buildMiscTaskPanel(Composite parent) {
- Composite panel = new Composite(parent, SWT.NONE);
- FormData fd = new FormData();
- fd.top = new FormAttachment(0);
- fd.bottom = new FormAttachment(100);
- fd.left = new FormAttachment(100, -400);
- fd.right = new FormAttachment(100);
- panel.setLayoutData(fd);
-
- panel.setLayout(new FillLayout());
- this.buildClearListACI().fill(panel);
- this.buildClearModelACI().fill(panel);
- this.buildRestoreModelACI().fill(panel);
- this.buildAddPriorityTaskACI().fill(panel);
- this.buildRemovePriorityTaskACI().fill(panel);
- this.buildClearPriorityTasksACI().fill(panel);
- return panel;
- }
-
- private ActionContributionItem buildClearListACI() {
- Action action = new Action("clear list", IAction.AS_PUSH_BUTTON) {
- @Override
- public void run() {
- ListBoxModelAdapterUITest.this.clearTasks();
- }
- };
- action.setToolTipText("clear all the tasks");
- return new ActionContributionItem(action);
- }
-
- private ActionContributionItem buildClearModelACI() {
- Action action = new Action("clear model", IAction.AS_PUSH_BUTTON) {
- @Override
- public void run() {
- ListBoxModelAdapterUITest.this.clearModel();
- }
- };
- action.setToolTipText("clear the task list model");
- return new ActionContributionItem(action);
- }
-
- private ActionContributionItem buildRestoreModelACI() {
- Action action = new Action("restore model", IAction.AS_PUSH_BUTTON) {
- @Override
- public void run() {
- ListBoxModelAdapterUITest.this.restoreModel();
- }
- };
- action.setToolTipText("restore the task list model");
- return new ActionContributionItem(action);
- }
-
- private ActionContributionItem buildAddPriorityTaskACI() {
- Action action = new Action("add priority", IAction.AS_PUSH_BUTTON) {
- @Override
- public void run() {
- ListBoxModelAdapterUITest.this.addPriorityTask();
- }
- };
- action.setToolTipText("add a task to the priority tasks");
- return new ActionContributionItem(action);
- }
-
- private ActionContributionItem buildRemovePriorityTaskACI() {
- Action action = new Action("remove priority", IAction.AS_PUSH_BUTTON) {
- @Override
- public void run() {
- ListBoxModelAdapterUITest.this.removePriorityTask();
- }
- };
- action.setToolTipText("remove a task from the priority tasks");
- return new ActionContributionItem(action);
- }
-
- private ActionContributionItem buildClearPriorityTasksACI() {
- Action action = new Action("clear priority", IAction.AS_PUSH_BUTTON) {
- @Override
- public void run() {
- ListBoxModelAdapterUITest.this.clearPriorityTasks();
- }
- };
- action.setToolTipText("clear the priority tasks");
- return new ActionContributionItem(action);
- }
-
- private void buildAddRemoveTaskPanel(Composite parent, Control clearButton) {
- Composite panel = new Composite(parent, SWT.NONE);
- FormData fd = new FormData();
- fd.top = new FormAttachment(0);
- fd.bottom = new FormAttachment(100);
- fd.left = new FormAttachment(0);
- fd.right = new FormAttachment(clearButton);
- panel.setLayoutData(fd);
-
- panel.setLayout(new FormLayout());
- Control addButton = this.buildAddButton(panel);
- Control removeButton = this.buildRemoveButton(panel);
- this.buildTaskTextField(panel, addButton, removeButton);
- }
-
- // is there a better way to associate an ACI with form data?
- private Control buildAddButton(Composite parent) {
- Composite panel = new Composite(parent, SWT.NONE);
- FormData fd = new FormData();
- fd.top = new FormAttachment(0);
- fd.bottom = new FormAttachment(100);
- fd.left = new FormAttachment(0);
- fd.right = new FormAttachment(0, 50);
- panel.setLayoutData(fd);
-
- panel.setLayout(new FillLayout());
- this.buildAddACI().fill(panel);
- return panel;
- }
-
- private ActionContributionItem buildAddACI() {
- Action action = new Action("add", IAction.AS_PUSH_BUTTON) {
- @Override
- public void run() {
- ListBoxModelAdapterUITest.this.addTask();
- }
- };
- action.setToolTipText("add a task with the name in the entry field");
- return new ActionContributionItem(action);
- }
-
- // is there a better way to associate an ACI with form data?
- private Control buildRemoveButton(Composite parent) {
- Composite panel = new Composite(parent, SWT.NONE);
- FormData fd = new FormData();
- fd.top = new FormAttachment(0);
- fd.bottom = new FormAttachment(100);
- fd.left = new FormAttachment(100, -50);
- fd.right = new FormAttachment(100);
- panel.setLayoutData(fd);
-
- panel.setLayout(new FillLayout());
- this.buildRemoveACI().fill(panel);
- return panel;
- }
-
- private ActionContributionItem buildRemoveACI() {
- Action action = new Action("remove", IAction.AS_PUSH_BUTTON) {
- @Override
- public void run() {
- ListBoxModelAdapterUITest.this.removeTask();
- }
- };
- action.setToolTipText("remove the task with the name in the entry field");
- return new ActionContributionItem(action);
- }
-
- private void buildTaskTextField(Composite parent, Control addButton, Control removeButton) {
- this.taskTextField = new Text(parent, SWT.SINGLE | SWT.BORDER);
- FormData fd = new FormData();
- fd.top = new FormAttachment(0);
- fd.bottom = new FormAttachment(100);
- fd.left = new FormAttachment(addButton);
- fd.right = new FormAttachment(removeButton);
- this.taskTextField.setLayoutData(fd);
- }
-
- private String taskTextFieldText() {
- return this.taskTextField.getText();
- }
-
- void addTask() {
- String taskText = this.taskTextFieldText();
- if (taskText.length() != 0) {
- this.taskList.addTask(taskText);
- }
- }
-
- void removeTask() {
- String task = this.taskTextFieldText();
- if (task.length() != 0) {
- this.taskList.removeTask(task);
- }
- }
-
- void clearTasks() {
- this.taskList.clearTasks();
- }
-
- void clearModel() {
- this.taskListHolder.setValue(null);
- }
-
- void restoreModel() {
- this.taskListHolder.setValue(this.taskList);
- }
-
- void addPriorityTask() {
- Iterator<Task> tasks = this.taskList.tasks();
- while (tasks.hasNext()) {
- if (this.taskList.addPriorityTask(tasks.next())) {
- return;
- }
- }
- }
-
- void removePriorityTask() {
- Iterator<Task> pTasks = this.taskList.priorityTasks();
- if (pTasks.hasNext()) {
- this.taskList.removePriorityTask(pTasks.next());
- }
- }
-
- void clearPriorityTasks() {
- this.taskList.clearPriorityTasks();
- }
-
-
- // ********** TaskList **********
-
- // note absence of validation...
- private class TaskList extends AbstractModel {
- private final List<String> taskNames = new ArrayList<String>();
- public static final String TASK_NAMES_LIST = "taskNames";
- private final List<Task> tasks = new ArrayList<Task>();
- public static final String TASKS_LIST = "tasks";
- private final Collection<Task> priorityTasks = new HashSet<Task>();
- public static final String PRIORITY_TASKS_COLLECTION = "priorityTasks";
- TaskList() {
- super();
- }
- public ListIterator<String> taskNames() {
- return this.taskNames.listIterator();
- }
- public ListIterator<Task> tasks() {
- return this.tasks.listIterator();
- }
- public Iterator<Task> priorityTasks() {
- return this.priorityTasks.iterator();
- }
- public Task addTask(String taskName) {
- this.addItemToList(taskName, this.taskNames, TASK_NAMES_LIST);
- Task task = new Task(taskName);
- this.addItemToList(task, this.tasks, TASKS_LIST);
- return task;
- }
- public void removeTask(String taskName) {
- int index = this.taskNames.indexOf(taskName);
- if (index != -1) {
- this.removeItemFromList(index, this.taskNames, TASK_NAMES_LIST);
- // assume the indexes match...
- Task removedTask = this.removeItemFromList(index, this.tasks, TASKS_LIST);
- this.removeItemFromCollection(removedTask, this.priorityTasks, PRIORITY_TASKS_COLLECTION);
- }
- }
- public void clearTasks() {
- this.taskNames.clear();
- this.fireListCleared(TASK_NAMES_LIST);
- this.tasks.clear();
- this.fireListCleared(TASKS_LIST);
- }
- public boolean addPriorityTask(Task task) {
- return this.addItemToCollection(task, this.priorityTasks, PRIORITY_TASKS_COLLECTION);
- }
- public void removePriorityTask(Task task) {
- this.removeItemFromCollection(task, this.priorityTasks, PRIORITY_TASKS_COLLECTION);
- }
- public void clearPriorityTasks() {
- this.clearCollection(this.priorityTasks, PRIORITY_TASKS_COLLECTION);
- }
- public void setPriorityTasks(Iterator<Task> tasks) {
- this.priorityTasks.clear();
- while (tasks.hasNext()) {
- this.priorityTasks.add(tasks.next());
- }
- this.fireCollectionChanged(PRIORITY_TASKS_COLLECTION, this.priorityTasks);
- }
- }
-
-
- // ********** Task **********
-
- private class Task extends AbstractModel implements Displayable {
- private String name;
- private Date creationTimeStamp;
- public Task(String name) {
- this.name = name;
- this.creationTimeStamp = new Date();
- }
- public String displayString() {
- return this.name + ": " + this.creationTimeStamp.getTime();
- }
- public int compareTo(Displayable o) {
- return DEFAULT_COMPARATOR.compare(this, o);
- }
- public String getName() {
- return this.name;
- }
- public void setName(String name) {
- Object old = this.name;
- this.name = name;
- this.firePropertyChanged(DISPLAY_STRING_PROPERTY, old, name);
- }
- @Override
- public String toString() {
- return this.displayString();
- }
- }
-
- public interface Displayable extends Model, Comparable<Displayable> {
-
- String displayString();
- String DISPLAY_STRING_PROPERTY = "displayString";
-
-
- // ********** helper implementations **********
-
- Collator DEFAULT_COLLATOR = Collator.getInstance();
-
- Comparator<Displayable> DEFAULT_COMPARATOR =
- new Comparator<Displayable>() {
- public int compare(Displayable d1, Displayable d2) {
- // disallow duplicates based on object identity
- if (d1 == d2) {
- return 0;
- }
-
- // first compare display strings using the default collator
- int result = DEFAULT_COLLATOR.compare(d1.displayString(), d2.displayString());
- if (result != 0) {
- return result;
- }
-
- // then compare using object-id
- result = System.identityHashCode(d1) - System.identityHashCode(d2);
- if (result != 0) {
- return result;
- }
-
- // It's unlikely that we get to this point; but, just in case, we will return -1.
- // Unfortunately, this introduces some mild unpredictability to the sort order
- // (unless the objects are always passed into this method in the same order).
- return -1; // if all else fails, indicate that o1 < o2
- }
- @Override
- public String toString() {
- return "Displayable.DEFAULT_COMPARATOR";
- }
- };
-
- }
-}
diff --git a/jpa/tests/org.eclipse.jpt.ui.tests/src/org/eclipse/jpt/ui/tests/internal/swt/SpinnerModelAdapterTest.java b/jpa/tests/org.eclipse.jpt.ui.tests/src/org/eclipse/jpt/ui/tests/internal/swt/SpinnerModelAdapterTest.java
deleted file mode 100644
index cf1629fb2d..0000000000
--- a/jpa/tests/org.eclipse.jpt.ui.tests/src/org/eclipse/jpt/ui/tests/internal/swt/SpinnerModelAdapterTest.java
+++ /dev/null
@@ -1,340 +0,0 @@
-/*******************************************************************************
- * Copyright (c) 2008 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.
- *
- * Contributors:
- * Oracle - initial API and implementation
- ******************************************************************************/
-package org.eclipse.jpt.ui.tests.internal.swt;
-
-import static org.junit.Assert.*;
-import org.eclipse.jpt.ui.internal.swt.SpinnerModelAdapter;
-import org.eclipse.jpt.utility.internal.model.AbstractModel;
-import org.eclipse.jpt.utility.internal.model.value.PropertyAspectAdapter;
-import org.eclipse.jpt.utility.internal.model.value.SimplePropertyValueModel;
-import org.eclipse.jpt.utility.model.value.WritablePropertyValueModel;
-import org.eclipse.swt.SWT;
-import org.eclipse.swt.widgets.Display;
-import org.eclipse.swt.widgets.Shell;
-import org.eclipse.swt.widgets.Spinner;
-import org.junit.After;
-import org.junit.Before;
-import org.junit.Test;
-
-@SuppressWarnings("nls")
-public class SpinnerModelAdapterTest {
-
- private Model model;
- private Shell shell;
- private WritablePropertyValueModel<Model> subjectHolder;
-
- private WritablePropertyValueModel<Model> buildSubjectHolder() {
- return new SimplePropertyValueModel<Model>();
- }
-
- private WritablePropertyValueModel<Integer> buildValueHolder() {
- return new PropertyAspectAdapter<Model, Integer>(subjectHolder, Model.VALUE_PROPERTY) {
- @Override
- protected Integer buildValue_() {
- return subject.getValue();
- }
-
- @Override
- protected void setValue_(Integer value) {
- subject.setValue(value);
- }
- };
- }
-
- @Before
- public void setUp() throws Exception {
-
- shell = new Shell(Display.getCurrent());
- model = new Model();
- subjectHolder = buildSubjectHolder();
- }
-
- @After
- public void tearDown() throws Exception {
-
- if (!shell.isDisposed()) {
- shell.dispose();
- }
-
- shell = null;
- subjectHolder = null;
- }
-
- @Test
- public void testDisposed() {
-
- int value = 2;
- model.setValue(value);
- model.clearSetValueCalledFlag();
- subjectHolder.setValue(model);
-
- Spinner spinner = new Spinner(shell, SWT.NULL);
- WritablePropertyValueModel<Integer> numberHolder = buildValueHolder();
- int defaultValue = 1;
-
- SpinnerModelAdapter.adapt(
- numberHolder,
- spinner,
- defaultValue
- );
-
- assertEquals(
- "The spinner's value should be coming from the model",
- value,
- spinner.getSelection()
- );
-
- assertEquals(
- "The number holder's value should be the model's value",
- model.getValue(),
- numberHolder.getValue()
- );
-
- assertFalse(
- "The model should not have received the value during initialization",
- model.isSetValueCalled()
- );
-
- // Change the value in the model
- spinner.dispose();
-
- value = 4;
- model.setValue(value);
-
- assertEquals(
- "The model's value was somehow changed",
- Integer.valueOf(value),
- model.getValue()
- );
- }
-
- @Test
- public void testInitialization_1() {
-
- Spinner spinner = new Spinner(shell, SWT.NULL);
- WritablePropertyValueModel<Integer> numberHolder = new SimplePropertyValueModel<Integer>();
- int defaultValue = 1;
-
- SpinnerModelAdapter.adapt(
- numberHolder,
- spinner,
- defaultValue
- );
-
- assertEquals(
- "The spinner's value should be the default value",
- defaultValue,
- spinner.getSelection()
- );
-
- assertNull(
- "The number holder's value should be null",
- numberHolder.getValue()
- );
- }
-
- @Test
- public void testInitialization_2() {
-
- Spinner spinner = new Spinner(shell, SWT.NULL);
- WritablePropertyValueModel<Integer> numberHolder = buildValueHolder();
- int defaultValue = 1;
-
- SpinnerModelAdapter.adapt(
- numberHolder,
- spinner,
- defaultValue
- );
-
- assertEquals(
- "The spinner's value should be the default value",
- defaultValue,
- spinner.getSelection()
- );
-
- assertNull(
- "The number holder's value should be null",
- numberHolder.getValue()
- );
- }
-
- @Test
- public void testInitialization_3() {
-
- subjectHolder.setValue(model);
-
- Spinner spinner = new Spinner(shell, SWT.NULL);
- WritablePropertyValueModel<Integer> numberHolder = buildValueHolder();
- int defaultValue = 1;
-
- SpinnerModelAdapter.adapt(
- numberHolder,
- spinner,
- defaultValue
- );
-
- assertEquals(
- "The spinner's value should be the default value",
- defaultValue,
- spinner.getSelection()
- );
-
- assertNull(
- "The number holder's value should be null",
- numberHolder.getValue()
- );
-
- assertFalse(
- "The model should not have received the value during initialization",
- model.isSetValueCalled()
- );
- }
-
- @Test
- public void testInitialization_4() {
-
- int value = 2;
- model.setValue(value);
- model.clearSetValueCalledFlag();
- subjectHolder.setValue(model);
-
- Spinner spinner = new Spinner(shell, SWT.NULL);
- WritablePropertyValueModel<Integer> numberHolder = buildValueHolder();
- int defaultValue = 1;
-
- SpinnerModelAdapter.adapt(
- numberHolder,
- spinner,
- defaultValue
- );
-
- assertEquals(
- "The spinner's value should be the value coming from the model",
- value,
- spinner.getSelection()
- );
-
- assertEquals(
- "The number holder's value should be " + value,
- Integer.valueOf(value),
- numberHolder.getValue()
- );
-
- assertFalse(
- "The model should not have received the value during initialization",
- model.isSetValueCalled()
- );
- }
-
- @Test
- public void testValueChanged() {
-
- int value = 2;
- model.setValue(value);
- model.clearSetValueCalledFlag();
- subjectHolder.setValue(model);
-
- Spinner spinner = new Spinner(shell, SWT.NULL);
- WritablePropertyValueModel<Integer> numberHolder = buildValueHolder();
- int defaultValue = 1;
-
- SpinnerModelAdapter.adapt(
- numberHolder,
- spinner,
- defaultValue
- );
-
- assertEquals(
- "The spinner's value should be coming from the model",
- value,
- spinner.getSelection()
- );
-
- assertEquals(
- "The number holder's value should be the model's value",
- model.getValue(),
- numberHolder.getValue()
- );
-
- assertFalse(
- "The model should not have received the value during initialization",
- model.isSetValueCalled()
- );
-
- // Change the value in the model
- value = 4;
- model.setValue(value);
-
- assertEquals(
- "The spinner's value should be coming from the model",
- value,
- spinner.getSelection()
- );
-
- assertEquals(
- "The model's value was somehow changed",
- Integer.valueOf(value),
- model.getValue()
- );
-
- // Change the value from the spinner
- value = 6;
- spinner.setSelection(value);
-
- assertEquals(
- "The spinner's value should be the new value set",
- value,
- spinner.getSelection()
- );
-
- assertEquals(
- "The model's value was supposed to be updated",
- Integer.valueOf(value),
- model.getValue()
- );
-
- // Disconnect from model
- subjectHolder.setValue(null);
-
- assertEquals(
- "The spinner's value should be the default value",
- defaultValue,
- spinner.getSelection()
- );
- }
-
- private static class Model extends AbstractModel {
-
- private boolean setValueCalled;
- private Integer value;
-
- static final String VALUE_PROPERTY = "value";
-
- void clearSetValueCalledFlag() {
- setValueCalled = false;
- }
-
- Integer getValue() {
- return value;
- }
-
- boolean isSetValueCalled() {
- return setValueCalled;
- }
-
- void setValue(Integer value) {
- setValueCalled = true;
-
- Integer oldValue = this.value;
- this.value = value;
- firePropertyChanged(VALUE_PROPERTY, oldValue, value);
- }
- }
-}
diff --git a/jpa/tests/org.eclipse.jpt.ui.tests/src/org/eclipse/jpt/ui/tests/internal/swt/TableModelAdapterTest.java b/jpa/tests/org.eclipse.jpt.ui.tests/src/org/eclipse/jpt/ui/tests/internal/swt/TableModelAdapterTest.java
deleted file mode 100644
index 057b8b4f3a..0000000000
--- a/jpa/tests/org.eclipse.jpt.ui.tests/src/org/eclipse/jpt/ui/tests/internal/swt/TableModelAdapterTest.java
+++ /dev/null
@@ -1,1203 +0,0 @@
-/*******************************************************************************
- * Copyright (c) 2008, 2009 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.
- *
- * Contributors:
- * Oracle - initial API and implementation
- ******************************************************************************/
-package org.eclipse.jpt.ui.tests.internal.swt;
-
-import java.util.ArrayList;
-import java.util.Collection;
-import java.util.List;
-import java.util.ListIterator;
-import org.eclipse.jface.viewers.ITableLabelProvider;
-import org.eclipse.jface.viewers.LabelProvider;
-import org.eclipse.jpt.ui.internal.swt.ColumnAdapter;
-import org.eclipse.jpt.ui.internal.swt.TableModelAdapter;
-import org.eclipse.jpt.ui.internal.swt.TableModelAdapter.SelectionChangeEvent;
-import org.eclipse.jpt.ui.internal.swt.TableModelAdapter.SelectionChangeListener;
-import org.eclipse.jpt.utility.internal.CollectionTools;
-import org.eclipse.jpt.utility.internal.iterators.CloneListIterator;
-import org.eclipse.jpt.utility.internal.model.AbstractModel;
-import org.eclipse.jpt.utility.internal.model.value.ListAspectAdapter;
-import org.eclipse.jpt.utility.internal.model.value.PropertyAspectAdapter;
-import org.eclipse.jpt.utility.internal.model.value.PropertyCollectionValueModelAdapter;
-import org.eclipse.jpt.utility.internal.model.value.SimpleCollectionValueModel;
-import org.eclipse.jpt.utility.internal.model.value.SimplePropertyValueModel;
-import org.eclipse.jpt.utility.model.value.CollectionValueModel;
-import org.eclipse.jpt.utility.model.value.ListValueModel;
-import org.eclipse.jpt.utility.model.value.WritablePropertyValueModel;
-import org.eclipse.swt.SWT;
-import org.eclipse.swt.events.SelectionEvent;
-import org.eclipse.swt.graphics.Image;
-import org.eclipse.swt.widgets.Display;
-import org.eclipse.swt.widgets.Shell;
-import org.eclipse.swt.widgets.Table;
-import org.eclipse.swt.widgets.TableItem;
-import org.junit.After;
-import org.junit.Assert;
-import org.junit.Before;
-import org.junit.Test;
-
-@SuppressWarnings("nls")
-public class TableModelAdapterTest {
-
- private Shell shell;
- private WritablePropertyValueModel<Manager> subjectHolder;
-
- private ColumnAdapter<Employee> buildColumnAdapter() {
- return new TableColumnAdapter();
- }
-
- private WritablePropertyValueModel<Employee> buildEmployeeHolder() {
- return new SimplePropertyValueModel<Employee>();
- }
-
- private SimpleCollectionValueModel<Employee> buildEmployeeHolders() {
- return new SimpleCollectionValueModel<Employee>();
- }
-
- private ListValueModel<Employee> buildEmployeeListHolder() {
- return new ListAspectAdapter<Manager, Employee>(subjectHolder, Manager.EMPLOYEES_LIST) {
- @Override
- protected ListIterator<Employee> listIterator_() {
- return subject.employees();
- }
-
- @Override
- protected int size_() {
- return subject.employeesSize();
- }
- };
- }
-
- private ITableLabelProvider buildLabelProvider() {
- return new TableLabelProvider();
- }
-
- private SelectionChangeListener<Employee> buildSelectionChangeListener(final Collection<Employee> employees) {
- return new SelectionChangeListener<Employee>() {
- public void selectionChanged(SelectionChangeEvent<Employee> e) {
- employees.clear();
- CollectionTools.addAll(employees, e.selection());
- }
- };
- }
-
- private WritablePropertyValueModel<Manager> buildSubjectHolder() {
- return new SimplePropertyValueModel<Manager>();
- }
-
- @Before
- public void setUp() throws Exception {
-
- shell = new Shell(Display.getCurrent());
- subjectHolder = buildSubjectHolder();
- }
-
- @After
- public void tearDown() throws Exception {
-
- if (!shell.isDisposed()) {
- shell.dispose();
- }
-
- shell = null;
- subjectHolder = null;
- }
-
- @Test
- public void testChanged() {
-
- Table table = new Table(shell, SWT.V_SCROLL | SWT.H_SCROLL | SWT.FULL_SELECTION | SWT.MULTI);
-
- ListValueModel<Employee> listHolder = buildEmployeeListHolder();
- WritablePropertyValueModel<Employee> selectedItemHolder = buildEmployeeHolder();
-
- Manager manager = new Manager();
- subjectHolder.setValue(manager);
-
- new TableModel(
- listHolder,
- selectedItemHolder,
- table,
- buildColumnAdapter(),
- buildLabelProvider()
- );
-
- // Create Employees
- String expectedName1 = "Dali_1";
- String expectedManager1 = "WTP_1";
- String expectedTitle1 = "plug-in_1";
-
- String expectedName2 = "Dali_2";
- String expectedManager2 = "WTP_2";
- String expectedTitle2 = "plug-in_2";
-
- String expectedName3 = "Dali_3";
- String expectedManager3 = "WTP_3";
- String expectedTitle3 = "plug-in_3";
-
- Employee employee1 = new Employee(expectedName1, expectedTitle1, expectedManager1);
- Employee employee2 = new Employee(expectedName2, expectedTitle2, expectedManager2);
- Employee employee3 = new Employee(expectedName3, expectedTitle3, expectedManager3);
-
- manager.addEmployee(employee1);
- manager.addEmployee(employee2);
- manager.addEmployee(employee3);
-
- // Make sure the Table was populated
- Assert.assertEquals("The number of TableItems should be 3", 3, table.getItemCount());
-
- // Change the list of Employees
- ArrayList<Employee> employees = new ArrayList<Employee>(3);
- employees.add(employee3);
- employees.add(employee2);
- employees.add(employee1);
- manager.changeEmployees(employees);
-
- Assert.assertEquals("The number of TableItems should be 3", 3, table.getItemCount());
-
- testTableItemProperties(table, 0, expectedName3, expectedManager3, expectedTitle3);
- testTableItemProperties(table, 1, expectedName2, expectedManager2, expectedTitle2);
- testTableItemProperties(table, 2, expectedName1, expectedManager1, expectedTitle1);
- }
-
- @Test
- public void testCleared() {
-
- Table table = new Table(shell, SWT.V_SCROLL | SWT.H_SCROLL | SWT.FULL_SELECTION | SWT.MULTI);
-
- ListValueModel<Employee> listHolder = buildEmployeeListHolder();
- WritablePropertyValueModel<Employee> selectedItemHolder = buildEmployeeHolder();
-
- Manager manager = new Manager();
- subjectHolder.setValue(manager);
-
- new TableModel(
- listHolder,
- selectedItemHolder,
- table,
- buildColumnAdapter(),
- buildLabelProvider()
- );
-
- // Create Employees
- String expectedName1 = "Dali_1";
- String expectedManager1 = "WTP_1";
- String expectedTitle1 = "plug-in_1";
-
- String expectedName2 = "Dali_2";
- String expectedManager2 = "WTP_2";
- String expectedTitle2 = "plug-in_2";
-
- String expectedName3 = "Dali_3";
- String expectedManager3 = "WTP_3";
- String expectedTitle3 = "plug-in_3";
-
- Employee employee1 = new Employee(expectedName1, expectedTitle1, expectedManager1);
- Employee employee2 = new Employee(expectedName2, expectedTitle2, expectedManager2);
- Employee employee3 = new Employee(expectedName3, expectedTitle3, expectedManager3);
-
- manager.addEmployee(employee1);
- manager.addEmployee(employee2);
- manager.addEmployee(employee3);
-
- // Make sure the Table was populated
- Assert.assertEquals("The number of TableItems should be 3", 3, table.getItemCount());
-
- // Test removing them all
- manager.removeAllEmployees();
-
- Assert.assertEquals("The list holder should have been cleared", 0, listHolder.size());
- Assert.assertEquals("The Table should have been cleared", 0, table.getItemCount());
- }
-
- @Test
- public void testItemAdded() {
-
- Table table = new Table(shell, SWT.V_SCROLL | SWT.H_SCROLL | SWT.FULL_SELECTION | SWT.MULTI);
-
- ListValueModel<Employee> listHolder = buildEmployeeListHolder();
- WritablePropertyValueModel<Employee> selectedItemHolder = buildEmployeeHolder();
-
- Manager manager = new Manager();
- subjectHolder.setValue(manager);
-
- TableModel tableModel = new TableModel(
- listHolder,
- selectedItemHolder,
- table,
- buildColumnAdapter(),
- buildLabelProvider()
- );
-
- // Create a new Employee
- String expectedName = "Dali";
- String expectedManager = "WTP";
- String expectedTitle = "plug-in";
-
- Employee employee = manager.addEmployee(expectedName, expectedTitle, expectedManager);
- Assert.assertNotNull("The new Employee was not created", employee);
-
- // Retrieve the TableItem representing the new Employee
- int index = tableModel.indexOf(employee);
- Assert.assertEquals("The new Employee was not added to the table model", 0, index);
- Assert.assertEquals("The number of TableItem should be 1", 1, table.getItemCount());
-
- testTableItemProperties(table, index, expectedName, expectedManager, expectedTitle);
- }
-
- @Test
- public void testItemMoved() {
-
- Table table = new Table(shell, SWT.V_SCROLL | SWT.H_SCROLL | SWT.FULL_SELECTION | SWT.MULTI);
-
- ListValueModel<Employee> listHolder = buildEmployeeListHolder();
- WritablePropertyValueModel<Employee> selectedItemHolder = buildEmployeeHolder();
-
- Manager manager = new Manager();
- subjectHolder.setValue(manager);
-
- TableModel tableModel = new TableModel(
- listHolder,
- selectedItemHolder,
- table,
- buildColumnAdapter(),
- buildLabelProvider()
- );
-
- // Create Employees
- String expectedName1 = "Dali_1";
- String expectedManager1 = "WTP_1";
- String expectedTitle1 = "plug-in_1";
-
- String expectedName2 = "Dali_2";
- String expectedManager2 = "WTP_2";
- String expectedTitle2 = "plug-in_2";
-
- String expectedName3 = "Dali_3";
- String expectedManager3 = "WTP_3";
- String expectedTitle3 = "plug-in_3";
-
- Employee employee1 = new Employee(expectedName1, expectedTitle1, expectedManager1);
- Employee employee2 = new Employee(expectedName2, expectedTitle2, expectedManager2);
- Employee employee3 = new Employee(expectedName3, expectedTitle3, expectedManager3);
-
- manager.addEmployee(employee1);
- manager.addEmployee(employee2);
- manager.addEmployee(employee3);
-
- // Make sure the Employees were added to the Table
- Assert.assertEquals("The number of TableItem should be 3", 3, table.getItemCount());
-
- // Move an Employee up the list
- manager.moveEmployeeUp(employee2);
-
- int index1 = tableModel.indexOf(employee1);
- Assert.assertEquals("The Employee 1 was not moved in the table model", 1, index1);
-
- int index2 = tableModel.indexOf(employee2);
- Assert.assertEquals("The Employee 2 was not moved in the table model", 0, index2);
-
- int index3 = tableModel.indexOf(employee3);
- Assert.assertEquals("The Employee 3 should not have been moved in the table model", 2, index3);
-
- testTableItemProperties(table, index1, expectedName1, expectedManager1, expectedTitle1);
- testTableItemProperties(table, index2, expectedName2, expectedManager2, expectedTitle2);
- testTableItemProperties(table, index3, expectedName3, expectedManager3, expectedTitle3);
-
- // Move an Employee down the list
- manager.moveEmployeeDown(employee1);
-
- index1 = tableModel.indexOf(employee1);
- Assert.assertEquals("The Employee 1 should not have been moved in the table model", 2, index1);
-
- index2 = tableModel.indexOf(employee2);
- Assert.assertEquals("The Employee 2 was not moved in the table model", 0, index2);
-
- index3 = tableModel.indexOf(employee3);
- Assert.assertEquals("The Employee 3 was not moved in the table model", 1, index3);
-
- testTableItemProperties(table, index1, expectedName1, expectedManager1, expectedTitle1);
- testTableItemProperties(table, index2, expectedName2, expectedManager2, expectedTitle2);
- testTableItemProperties(table, index3, expectedName3, expectedManager3, expectedTitle3);
- }
-
- @Test
- public void testItemRemoved() {
-
- Table table = new Table(shell, SWT.V_SCROLL | SWT.H_SCROLL | SWT.FULL_SELECTION | SWT.MULTI);
-
- ListValueModel<Employee> listHolder = buildEmployeeListHolder();
- WritablePropertyValueModel<Employee> selectedItemHolder = buildEmployeeHolder();
-
- Manager manager = new Manager();
- subjectHolder.setValue(manager);
-
- TableModel tableModel = new TableModel(
- listHolder,
- selectedItemHolder,
- table,
- buildColumnAdapter(),
- buildLabelProvider()
- );
-
- // Create a new Employee
- String expectedName = "Dali";
- String expectedManager = "WTP";
- String expectedTitle = "plug-in";
-
- Employee employee = manager.addEmployee(expectedName, expectedTitle, expectedManager);
- Assert.assertNotNull("The new Employee was not created", employee);
- Assert.assertEquals("The number of TableItem should be 1", 1, table.getItemCount());
-
- // Make sure it was added to the model
- int index = tableModel.indexOf(employee);
- Assert.assertEquals("The new Employee was not added to the table model", 0, index);
- testTableItemProperties(table, index, expectedName, expectedManager, expectedTitle);
-
- // Retrieve the TableItem representing the new Employee
- TableItem tableItem = table.getItem(index);
- Assert.assertNotNull("No TableItem was found for the new Employee", tableItem);
-
- // Now test the item being removed
- manager.removeEmployee(employee);
- index = tableModel.indexOf(employee);
- Assert.assertEquals("The Employee was not removed from the table model", -1, index);
- Assert.assertEquals("The number of TableItem should be 0", 0, table.getItemCount());
- }
-
- @Test
- public void testItemReplaced() {
-
- Table table = new Table(shell, SWT.V_SCROLL | SWT.H_SCROLL | SWT.FULL_SELECTION | SWT.MULTI);
-
- ListValueModel<Employee> listHolder = buildEmployeeListHolder();
- WritablePropertyValueModel<Employee> selectedItemHolder = buildEmployeeHolder();
-
- Manager manager = new Manager();
- subjectHolder.setValue(manager);
-
- TableModel tableModel = new TableModel(
- listHolder,
- selectedItemHolder,
- table,
- buildColumnAdapter(),
- buildLabelProvider()
- );
-
- // Create a new Employee
- String expectedName1 = "Dali_1";
- String expectedManager1 = "WTP_1";
- String expectedTitle1 = "plug-in_1";
-
- Employee employee1 = manager.addEmployee(expectedName1, expectedTitle1, expectedManager1);
- Assert.assertNotNull("The new Employee was not created", employee1);
-
- // Make sure it was added to the model
- int index1 = tableModel.indexOf(employee1);
- Assert.assertEquals("The new Employee was not added to the table model", 0, index1);
- Assert.assertEquals("The number of TableItem should be 1", 1, table.getItemCount());
-
- // Retrieve the TableItem representing the new Employee
- TableItem tableItem = table.getItem(index1);
- Assert.assertNotNull("No TableItem was found for the new Employee", tableItem);
-
- testTableItemProperties(table, index1, expectedName1, expectedManager1, expectedTitle1);
-
- // Replace the Employee
- String expectedName2 = "Dali_2";
- String expectedManager2 = "WTP_2";
- String expectedTitle2 = "plug-in_2";
-
- Employee employee2 = new Employee(expectedName2, expectedTitle2, expectedManager2);
- manager.replace(employee1, employee2);
-
- int index2 = tableModel.indexOf(employee2);
- Assert.assertSame("The Employee that got replaced should be at index " + index1, index1, index2);
- Assert.assertEquals("The number of TableItem should be 1", 1, table.getItemCount());
-
- testTableItemProperties(table, index2, expectedName2, expectedManager2, expectedTitle2);
- }
-
- @Test
- public void testItemsAdded() {
-
- Table table = new Table(shell, SWT.V_SCROLL | SWT.H_SCROLL | SWT.FULL_SELECTION | SWT.MULTI);
-
- ListValueModel<Employee> listHolder = buildEmployeeListHolder();
- WritablePropertyValueModel<Employee> selectedItemHolder = buildEmployeeHolder();
-
- Manager manager = new Manager();
- subjectHolder.setValue(manager);
-
- TableModel tableModel = new TableModel(
- listHolder,
- selectedItemHolder,
- table,
- buildColumnAdapter(),
- buildLabelProvider()
- );
-
- // Create Employees
- String expectedName1 = "Dali_1";
- String expectedManager1 = "WTP_1";
- String expectedTitle1 = "plug-in_1";
-
- String expectedName2 = "Dali_2";
- String expectedManager2 = "WTP_2";
- String expectedTitle2 = "plug-in_2";
-
- String expectedName3 = "Dali_3";
- String expectedManager3 = "WTP_3";
- String expectedTitle3 = "plug-in_3";
-
- Employee employee1 = new Employee(expectedName1, expectedTitle1, expectedManager1);
- Employee employee2 = new Employee(expectedName2, expectedTitle2, expectedManager2);
- Employee employee3 = new Employee(expectedName3, expectedTitle3, expectedManager3);
-
- manager.addEmployee(employee1);
- manager.addEmployee(employee2);
- manager.addEmployee(employee3);
-
- // Retrieve the TableItems representing the employees
- Assert.assertEquals("The number of TableItem should be 3", 3, table.getItemCount());
-
- int index = tableModel.indexOf(employee1);
- Assert.assertEquals("The Employee 1 was not added to the table model", 0, index);
-
- index = tableModel.indexOf(employee2);
- Assert.assertEquals("The Employee 2 was not added to the table model", 1, index);
-
- index = tableModel.indexOf(employee3);
- Assert.assertEquals("The Employee 3 was not added to the table model", 2, index);
-
- // Make sure the TableItem was correctly populated
- testTableItemProperties(table, 0, expectedName1, expectedManager1, expectedTitle1);
- testTableItemProperties(table, 1, expectedName2, expectedManager2, expectedTitle2);
- testTableItemProperties(table, 2, expectedName3, expectedManager3, expectedTitle3);
- }
-
- @Test
- public void testItemsMoved() {
-
- Table table = new Table(shell, SWT.V_SCROLL | SWT.H_SCROLL | SWT.FULL_SELECTION | SWT.MULTI);
-
- ListValueModel<Employee> listHolder = buildEmployeeListHolder();
- WritablePropertyValueModel<Employee> selectedItemHolder = buildEmployeeHolder();
-
- Manager manager = new Manager();
- subjectHolder.setValue(manager);
-
- TableModel tableModel = new TableModel(
- listHolder,
- selectedItemHolder,
- table,
- buildColumnAdapter(),
- buildLabelProvider()
- );
-
- // Create Employees
- String expectedName1 = "Dali_1";
- String expectedManager1 = "WTP_1";
- String expectedTitle1 = "plug-in_1";
-
- String expectedName2 = "Dali_2";
- String expectedManager2 = "WTP_2";
- String expectedTitle2 = "plug-in_2";
-
- String expectedName3 = "Dali_3";
- String expectedManager3 = "WTP_3";
- String expectedTitle3 = "plug-in_3";
-
- String expectedName4 = "Dali_4";
- String expectedManager4 = "WTP_4";
- String expectedTitle4 = "plug-in_4";
-
- String expectedName5 = "Dali_5";
- String expectedManager5 = "WTP_5";
- String expectedTitle5 = "plug-in_5";
-
- String expectedName6 = "Dali_6";
- String expectedManager6 = "WTP_6";
- String expectedTitle6 = "plug-in_6";
-
- Employee employee1 = new Employee(expectedName1, expectedTitle1, expectedManager1);
- Employee employee2 = new Employee(expectedName2, expectedTitle2, expectedManager2);
- Employee employee3 = new Employee(expectedName3, expectedTitle3, expectedManager3);
- Employee employee4 = new Employee(expectedName4, expectedTitle4, expectedManager4);
- Employee employee5 = new Employee(expectedName5, expectedTitle5, expectedManager5);
- Employee employee6 = new Employee(expectedName6, expectedTitle6, expectedManager6);
-
- manager.addEmployee(employee1);
- manager.addEmployee(employee2);
- manager.addEmployee(employee3);
- manager.addEmployee(employee4);
- manager.addEmployee(employee5);
- manager.addEmployee(employee6);
-
- // Make sure the Employees were added to the Table
- Assert.assertEquals("The number of TableItem should be 6", 6, table.getItemCount());
-
- // Move an Employee up the list
- ArrayList<Employee> employees = new ArrayList<Employee>(3);
- employees.add(employee3);
- employees.add(employee4);
- employees.add(employee5);
- manager.moveEmployees(employees, 0);
-
- int index1 = tableModel.indexOf(employee1);
- int index2 = tableModel.indexOf(employee2);
- int index3 = tableModel.indexOf(employee3);
- int index4 = tableModel.indexOf(employee4);
- int index5 = tableModel.indexOf(employee5);
- int index6 = tableModel.indexOf(employee6);
-
- Assert.assertEquals("The Employee 1 is not at the right index", 3, index1);
- Assert.assertEquals("The Employee 2 is not at the right index", 4, index2);
- Assert.assertEquals("The Employee 3 is not at the right index", 0, index3);
- Assert.assertEquals("The Employee 4 is not at the right index", 1, index4);
- Assert.assertEquals("The Employee 5 is not at the right index", 2, index5);
- Assert.assertEquals("The Employee 6 is not at the right index", 5, index6);
-
- testTableItemProperties(table, index1, expectedName1, expectedManager1, expectedTitle1);
- testTableItemProperties(table, index2, expectedName2, expectedManager2, expectedTitle2);
- testTableItemProperties(table, index3, expectedName3, expectedManager3, expectedTitle3);
- testTableItemProperties(table, index4, expectedName4, expectedManager4, expectedTitle4);
- testTableItemProperties(table, index5, expectedName5, expectedManager5, expectedTitle5);
- testTableItemProperties(table, index6, expectedName6, expectedManager6, expectedTitle6);
-
- // Move an Employee down the list
- employees = new ArrayList<Employee>(2);
- employees.add(employee1);
- employees.add(employee2);
- manager.moveEmployees(employees, 4);
-
- index1 = tableModel.indexOf(employee1);
- index2 = tableModel.indexOf(employee2);
- index3 = tableModel.indexOf(employee3);
- index4 = tableModel.indexOf(employee4);
- index5 = tableModel.indexOf(employee5);
- index6 = tableModel.indexOf(employee6);
-
- Assert.assertEquals("The Employee 1 is not at the right index", 4, index1);
- Assert.assertEquals("The Employee 2 is not at the right index", 5, index2);
- Assert.assertEquals("The Employee 3 is not at the right index", 0, index3);
- Assert.assertEquals("The Employee 4 is not at the right index", 1, index4);
- Assert.assertEquals("The Employee 5 is not at the right index", 2, index5);
- Assert.assertEquals("The Employee 6 is not at the right index", 3, index6);
-
- testTableItemProperties(table, index1, expectedName1, expectedManager1, expectedTitle1);
- testTableItemProperties(table, index2, expectedName2, expectedManager2, expectedTitle2);
- testTableItemProperties(table, index3, expectedName3, expectedManager3, expectedTitle3);
- testTableItemProperties(table, index4, expectedName4, expectedManager4, expectedTitle4);
- testTableItemProperties(table, index5, expectedName5, expectedManager5, expectedTitle5);
- testTableItemProperties(table, index6, expectedName6, expectedManager6, expectedTitle6);
- }
-
- @Test
- public void testItemsRemoved() {
-
- Table table = new Table(shell, SWT.V_SCROLL | SWT.H_SCROLL | SWT.FULL_SELECTION | SWT.MULTI);
-
- ListValueModel<Employee> listHolder = buildEmployeeListHolder();
- WritablePropertyValueModel<Employee> selectedItemHolder = buildEmployeeHolder();
-
- Manager manager = new Manager();
- subjectHolder.setValue(manager);
-
- TableModel tableModel = new TableModel(
- listHolder,
- selectedItemHolder,
- table,
- buildColumnAdapter(),
- buildLabelProvider()
- );
-
- // Create Employees
- String expectedName1 = "Dali_1";
- String expectedManager1 = "WTP_1";
- String expectedTitle1 = "plug-in_1";
-
- String expectedName2 = "Dali_2";
- String expectedManager2 = "WTP_2";
- String expectedTitle2 = "plug-in_2";
-
- String expectedName3 = "Dali_3";
- String expectedManager3 = "WTP_3";
- String expectedTitle3 = "plug-in_3";
-
- Employee employee1 = new Employee(expectedName1, expectedTitle1, expectedManager1);
- Employee employee2 = new Employee(expectedName2, expectedTitle2, expectedManager2);
- Employee employee3 = new Employee(expectedName3, expectedTitle3, expectedManager3);
-
- manager.addEmployee(employee1);
- manager.addEmployee(employee2);
- manager.addEmployee(employee3);
-
- // Retrieve the TableItems representing the employees
- Assert.assertEquals("The number of TableItem should be 3", 3, table.getItemCount());
-
- int index = tableModel.indexOf(employee1);
- Assert.assertEquals("The Employee 1 was not added to the table model", 0, index);
-
- index = tableModel.indexOf(employee2);
- Assert.assertEquals("The Employee 2 was not added to the table model", 1, index);
-
- index = tableModel.indexOf(employee3);
- Assert.assertEquals("The Employee 3 was not added to the table model", 2, index);
-
- // Remove 2 items
- ArrayList<Employee> employees = new ArrayList<Employee>(2);
- employees.add(employee1);
- employees.add(employee3);
- manager.removeEmployees(employees);
-
- Assert.assertEquals("The number of TableItem should be 1", 1, table.getItemCount());
- }
-
- @Test
- public void testPropertyChanged() {
-
- Table table = new Table(shell, SWT.V_SCROLL | SWT.H_SCROLL | SWT.FULL_SELECTION | SWT.MULTI);
-
- ListValueModel<Employee> listHolder = buildEmployeeListHolder();
- WritablePropertyValueModel<Employee> selectedItemHolder = buildEmployeeHolder();
-
- Manager manager = new Manager();
- subjectHolder.setValue(manager);
-
- TableModel tableModel = new TableModel(
- listHolder,
- selectedItemHolder,
- table,
- buildColumnAdapter(),
- buildLabelProvider()
- );
-
- // Create a new Employee
- String expectedName = "Dali";
- String expectedManager = "WTP";
- String expectedTitle = "plug-in";
-
- Employee employee = manager.addEmployee(expectedName, expectedTitle, expectedManager);
- Assert.assertNotNull("The new Employee was not created", employee);
-
- // Make sure it was added to the model
- int index = tableModel.indexOf(employee);
- Assert.assertEquals("The new Employee was not added to the table model", 0, index);
- Assert.assertEquals("The number of TableItem should be 1", 1, table.getItemCount());
-
- // Retrieve the TableItem representing the new Employee
- TableItem tableItem = table.getItem(index);
- Assert.assertNotNull("No TableItem was found for the new Employee", tableItem);
-
- // Name property
- String actualName = tableItem.getText(TableColumnAdapter.NAME_COLUMN);
- Assert.assertEquals("TableItem[NAME_COLUMN] was not set correctly", expectedName, actualName);
-
- expectedName = "Jpt";
- employee.setName(expectedName);
-
- actualName = tableItem.getText(TableColumnAdapter.NAME_COLUMN);
- Assert.assertEquals("TableItem[NAME_COLUMN] was not set correctly", expectedName, actualName);
-
- // Manager property
- String actualManager = tableItem.getText(TableColumnAdapter.MANAGER_COLUMN);
- Assert.assertEquals("TableItem[MANAGER_COLUMN] was not set correctly", expectedManager, actualManager);
-
- expectedManager = "boss";
- employee.setManager(expectedManager);
-
- actualManager = tableItem.getText(TableColumnAdapter.MANAGER_COLUMN);
- Assert.assertEquals("TableItem[MANAGER_COLUMN] was not set correctly", expectedManager, actualManager);
-
- // Title property
- String actualTitle = tableItem.getText(TableColumnAdapter.TITLE_COLUMN);
- Assert.assertEquals("TableItem[TITLE_COLUMN] was not set correctly", expectedTitle, actualTitle);
-
- expectedTitle = "EclipseLink";
- employee.setTitle(expectedTitle);
-
- actualTitle = tableItem.getText(TableColumnAdapter.TITLE_COLUMN);
- Assert.assertEquals("TableItem[TITLE_COLUMN] was not set correctly", expectedTitle, actualTitle);
- }
-
- @Test
- public void testSelectedItemsAddedRemoved() {
-
- Table table = new Table(shell, SWT.V_SCROLL | SWT.H_SCROLL | SWT.FULL_SELECTION | SWT.MULTI);
-
- ListValueModel<Employee> listHolder = buildEmployeeListHolder();
- SimpleCollectionValueModel<Employee> selectedItemsHolder = buildEmployeeHolders();
-
- Manager manager = new Manager();
- subjectHolder.setValue(manager);
-
- TableModel tableModel = new TableModel(
- listHolder,
- selectedItemsHolder,
- table,
- buildColumnAdapter(),
- buildLabelProvider()
- );
-
- // Create Employees
- String expectedName1 = "Dali_1";
- String expectedManager1 = "WTP_1";
- String expectedTitle1 = "plug-in_1";
-
- String expectedName2 = "Dali_2";
- String expectedManager2 = "WTP_2";
- String expectedTitle2 = "plug-in_2";
-
- String expectedName3 = "Dali_3";
- String expectedManager3 = "WTP_3";
- String expectedTitle3 = "plug-in_3";
-
- Employee employee1 = new Employee(expectedName1, expectedTitle1, expectedManager1);
- Employee employee2 = new Employee(expectedName2, expectedTitle2, expectedManager2);
- Employee employee3 = new Employee(expectedName3, expectedTitle3, expectedManager3);
-
- manager.addEmployee(employee1);
- manager.addEmployee(employee2);
- manager.addEmployee(employee3);
-
- // Test adding selected items
- ArrayList<Employee> employees = new ArrayList<Employee>(2);
- employees.add(employee1);
- employees.add(employee3);
- selectedItemsHolder.addAll(employees);
-
- Collection<Employee> actualEmployees = tableModel.selectedItems();
- Assert.assertNotNull("The collection of selected items can't be null", actualEmployees);
- Assert.assertEquals("The count of selected items should be 2", 2, actualEmployees.size());
-
- actualEmployees.remove(employee1);
- actualEmployees.remove(employee3);
-
- Assert.assertTrue("The selected items was not retrieved correctly", actualEmployees.isEmpty());
-
- // Test removing selected items
- selectedItemsHolder.remove(employee1);
-
- actualEmployees = tableModel.selectedItems();
- Assert.assertNotNull("The collection of selected items can't be null", actualEmployees);
- Assert.assertEquals("The count of selected items should be 1", 1, actualEmployees.size());
-
- actualEmployees.remove(employee3);
-
- Assert.assertTrue("The selected items was not retrieved correctly", actualEmployees.isEmpty());
- }
-
- @Test
- public void testSelectedItemsCleared() {
-
- Table table = new Table(shell, SWT.V_SCROLL | SWT.H_SCROLL | SWT.FULL_SELECTION | SWT.MULTI);
-
- ListValueModel<Employee> listHolder = buildEmployeeListHolder();
- SimpleCollectionValueModel<Employee> selectedItemsHolder = buildEmployeeHolders();
-
- Manager manager = new Manager();
- subjectHolder.setValue(manager);
-
- TableModel tableModel = new TableModel(
- listHolder,
- selectedItemsHolder,
- table,
- buildColumnAdapter(),
- buildLabelProvider()
- );
-
- // Create Employees
- String expectedName1 = "Dali_1";
- String expectedManager1 = "WTP_1";
- String expectedTitle1 = "plug-in_1";
-
- String expectedName2 = "Dali_2";
- String expectedManager2 = "WTP_2";
- String expectedTitle2 = "plug-in_2";
-
- String expectedName3 = "Dali_3";
- String expectedManager3 = "WTP_3";
- String expectedTitle3 = "plug-in_3";
-
- Employee employee1 = new Employee(expectedName1, expectedTitle1, expectedManager1);
- Employee employee2 = new Employee(expectedName2, expectedTitle2, expectedManager2);
- Employee employee3 = new Employee(expectedName3, expectedTitle3, expectedManager3);
-
- manager.addEmployee(employee1);
- manager.addEmployee(employee2);
- manager.addEmployee(employee3);
-
- // Test adding selected items
- ArrayList<Employee> employees = new ArrayList<Employee>(2);
- employees.add(employee1);
- employees.add(employee3);
- selectedItemsHolder.addAll(employees);
-
- Collection<Employee> actualEmployees = tableModel.selectedItems();
- Assert.assertNotNull("The collection of selected items can't be null", actualEmployees);
- Assert.assertEquals("The count of selected items should be 2", 2, actualEmployees.size());
-
- actualEmployees.remove(employee1);
- actualEmployees.remove(employee3);
- Assert.assertTrue("The selected items was not retrieved correctly", actualEmployees.isEmpty());
-
- // Test removing selected items
- selectedItemsHolder.clear();
-
- actualEmployees = tableModel.selectedItems();
- Assert.assertNotNull("The collection of selected items can't be null", actualEmployees);
- Assert.assertEquals("The count of selected items should be ", 0, actualEmployees.size());
- }
-
- @Test
- public void testSelectionChangeListener() {
-
- Table table = new Table(shell, SWT.V_SCROLL | SWT.H_SCROLL | SWT.FULL_SELECTION | SWT.MULTI);
-
- Manager manager = new Manager();
- subjectHolder.setValue(manager);
-
- TableModel tableModel = new TableModel(
- buildEmployeeListHolder(),
- buildEmployeeHolder(),
- table,
- buildColumnAdapter(),
- buildLabelProvider()
- );
-
- Collection<Employee> employees = new ArrayList<Employee>();
- tableModel.addSelectionChangeListener(buildSelectionChangeListener(employees));
-
- // Create Employees
- String expectedName1 = "Dali_1";
- String expectedManager1 = "WTP_1";
- String expectedTitle1 = "plug-in_1";
-
- String expectedName2 = "Dali_2";
- String expectedManager2 = "WTP_2";
- String expectedTitle2 = "plug-in_2";
-
- String expectedName3 = "Dali_3";
- String expectedManager3 = "WTP_3";
- String expectedTitle3 = "plug-in_3";
-
- Employee employee1 = new Employee(expectedName1, expectedTitle1, expectedManager1);
- Employee employee2 = new Employee(expectedName2, expectedTitle2, expectedManager2);
- Employee employee3 = new Employee(expectedName3, expectedTitle3, expectedManager3);
-
- manager.addEmployee(employee1);
- manager.addEmployee(employee2);
- manager.addEmployee(employee3);
-
- // Test adding selected items
- table.setSelection(new int[] { 0, 2 });
-
- // It seems a manual selection doesn't send any selection event
- tableModel.tableSelectionChanged(null);
-
- Assert.assertNotNull("The collection of selected items can't be null", employees);
- Assert.assertEquals("The count of selected items should be 2", 2, employees.size());
-
- employees.remove(employee1);
- employees.remove(employee3);
- Assert.assertTrue("The selected items was not retrieved correctly", employees.isEmpty());
-
- // Test adding selected items
- employees.add(employee1);
- employees.add(employee3);
- table.deselectAll();
-
- // It seems a manual selection doesn't send any selection event
- tableModel.tableSelectionChanged(null);
-
- Assert.assertNotNull("The collection of selected items can't be null", employees);
- Assert.assertEquals("The count of selected items should be 0", 0, employees.size());
- }
-
- private void testTableItemProperties(Table table,
- int index,
- String expectedName,
- String expectedManager,
- String expectedTitle)
- {
- TableItem tableItem = table.getItem(index);
- Assert.assertNotNull("No TableItem was found for the Employee", tableItem);
-
- String actualName = tableItem.getText(TableColumnAdapter.NAME_COLUMN);
- Assert.assertEquals("TableItem[NAME_COLUMN] was not set correctly", expectedName, actualName);
-
- String actualTitle = tableItem.getText(TableColumnAdapter.TITLE_COLUMN);
- Assert.assertEquals("TableItem[TITLE_COLUMN] was not set correctly", expectedTitle, actualTitle);
-
- String actualManager = tableItem.getText(TableColumnAdapter.MANAGER_COLUMN);
- Assert.assertEquals("TableItem[MANAGER_COLUMN] was not set correctly", expectedManager, actualManager);
- }
-
- private class Employee extends AbstractModel {
-
- private String manager;
- private String name;
- private String title;
-
- static final String MANAGER_PROPERTY = "manager";
- static final String NAME_PROPERTY = "name";
- static final String TITLE_PROPERTY = "title";
-
- Employee(String name, String title, String manager) {
- super();
-
- this.name = name;
- this.title = title;
- this.manager = manager;
- }
-
- String getManager() {
- return manager;
- }
-
- String getName() {
- return name;
- }
-
- String getTitle() {
- return title;
- }
-
- void setManager(String manager) {
- String oldManager = this.manager;
- this.manager = manager;
- firePropertyChanged(MANAGER_PROPERTY, oldManager, manager);
- }
-
- void setName(String name) {
- String oldName = this.name;
- this.name = name;
- firePropertyChanged(NAME_PROPERTY, oldName, name);
- }
-
- void setTitle(String title) {
- String oldTitle = this.title;
- this.title = title;
- firePropertyChanged(TITLE_PROPERTY, oldTitle, title);
- }
- }
-
- private class Manager extends AbstractModel {
-
- private List<Employee> employees;
-
- static final String EMPLOYEES_LIST = "employees";
-
- Manager() {
- super();
- employees = new ArrayList<Employee>();
- }
-
- Employee addEmployee(Employee employee) {
- addItemToList(employee, employees, EMPLOYEES_LIST);
- return employee;
- }
-
- Employee addEmployee(String name, String title, String manager) {
- Employee employee = new Employee(name, title, manager);
- return addEmployee(employee);
- }
-
- void changeEmployees(List<Employee> employees) {
- this.employees.clear();
- this.employees.addAll(employees);
- fireListChanged(EMPLOYEES_LIST, employees);
- }
-
- ListIterator<Employee> employees() {
- return new CloneListIterator<Employee>(employees);
- }
-
- int employeesSize() {
- return employees.size();
- }
-
- void moveEmployeeDown(Employee employee) {
- int index = employees.indexOf(employee);
- moveItemInList(index + 1, index, employees, EMPLOYEES_LIST);
- }
-
- void moveEmployees(Collection<Employee> employees, int targetIndex) {
-
- int sourceIndex = Integer.MAX_VALUE;
-
- for (Employee employee : employees) {
- sourceIndex = Math.min(sourceIndex, this.employees.indexOf(employee));
- }
-
- moveItemsInList(
- targetIndex,
- sourceIndex,
- employees.size(),
- this.employees,
- EMPLOYEES_LIST
- );
- }
-
- void moveEmployeeUp(Employee employee) {
- int index = employees.indexOf(employee);
- moveItemInList(index - 1, index, employees, EMPLOYEES_LIST);
- }
-
- void removeAllEmployees() {
- clearList(employees, EMPLOYEES_LIST);
- }
-
- void removeEmployee(Employee employee) {
- removeItemFromList(employee, employees, EMPLOYEES_LIST);
- }
-
- void removeEmployees(Collection<Employee> employees) {
- removeItemsFromList(employees.iterator(), this.employees, EMPLOYEES_LIST);
- }
-
- void replace(Employee oldEmployee, Employee newEmployee) {
- replaceItemInList(oldEmployee, newEmployee, employees, EMPLOYEES_LIST);
- }
- }
-
- private class TableColumnAdapter implements ColumnAdapter<Employee> {
-
- static final int COLUMN_COUNT = 3;
- static final int MANAGER_COLUMN = 2;
- static final int NAME_COLUMN = 0;
- static final int TITLE_COLUMN = 1;
-
- private WritablePropertyValueModel<String> buildManagerHolder(Employee subject) {
- return new PropertyAspectAdapter<Employee, String>(Employee.MANAGER_PROPERTY, subject) {
- @Override
- protected String buildValue_() {
- return subject.getManager();
- }
-
- @Override
- protected void setValue_(String value) {
- subject.setManager(value);
- }
- };
- }
-
- private WritablePropertyValueModel<String> buildNameHolder(Employee subject) {
- return new PropertyAspectAdapter<Employee, String>(Employee.NAME_PROPERTY, subject) {
- @Override
- protected String buildValue_() {
- return subject.getName();
- }
-
- @Override
- protected void setValue_(String value) {
- subject.setName(value);
- }
- };
- }
-
- private WritablePropertyValueModel<String> buildTitleHolder(Employee subject) {
- return new PropertyAspectAdapter<Employee, String>(Employee.TITLE_PROPERTY, subject) {
- @Override
- protected String buildValue_() {
- return subject.getTitle();
- }
-
- @Override
- protected void setValue_(String value) {
- subject.setTitle(value);
- }
- };
- }
-
- public WritablePropertyValueModel<?>[] cellModels(Employee subject) {
- WritablePropertyValueModel<?>[] holders = new WritablePropertyValueModel<?>[3];
- holders[NAME_COLUMN] = buildNameHolder(subject);
- holders[TITLE_COLUMN] = buildTitleHolder(subject);
- holders[MANAGER_COLUMN] = buildManagerHolder(subject);
- return holders;
- }
-
- public int columnCount() {
- return COLUMN_COUNT;
- }
-
- public String columnName(int columnIndex) {
- return String.valueOf(columnIndex);
- }
- }
-
- private class TableLabelProvider extends LabelProvider
- implements ITableLabelProvider {
-
-
- public Image getColumnImage(Object element, int columnIndex) {
- return null;
- }
-
- public String getColumnText(Object element, int columnIndex) {
- Employee employee = (Employee) element;
-
- if (columnIndex == TableColumnAdapter.NAME_COLUMN) {
- return employee.getName();
- }
-
- if (columnIndex == TableColumnAdapter.TITLE_COLUMN) {
- return employee.getTitle();
- }
-
- return employee.getManager();
- }
- }
-
- private class TableModel extends TableModelAdapter<Employee> {
-
- TableModel(ListValueModel<Employee> listHolder,
- CollectionValueModel<Employee> selectedItemsHolder,
- Table table,
- ColumnAdapter<Employee> columnAdapter,
- ITableLabelProvider labelProvider) {
-
- super(listHolder,
- selectedItemsHolder,
- table,
- columnAdapter,
- labelProvider);
- }
-
- TableModel(ListValueModel<Employee> listHolder,
- WritablePropertyValueModel<Employee> selectedItemHolder,
- Table table,
- ColumnAdapter<Employee> columnAdapter,
- ITableLabelProvider labelProvider) {
-
- super(listHolder,
- new PropertyCollectionValueModelAdapter<Employee>(selectedItemHolder),
- table,
- columnAdapter,
- labelProvider);
- }
-
- @Override
- protected int indexOf(Employee item) {
- return super.indexOf(item);
- }
-
- @Override
- protected Collection<Employee> selectedItems() {
- return super.selectedItems();
- }
-
- @Override
- protected void tableSelectionChanged(SelectionEvent event) {
- super.tableSelectionChanged(event);
- }
- }
-}
diff --git a/jpa/tests/org.eclipse.jpt.ui.tests/src/org/eclipse/jpt/ui/tests/internal/swt/TextFieldModelAdapterUITest.java b/jpa/tests/org.eclipse.jpt.ui.tests/src/org/eclipse/jpt/ui/tests/internal/swt/TextFieldModelAdapterUITest.java
deleted file mode 100644
index 6f812805de..0000000000
--- a/jpa/tests/org.eclipse.jpt.ui.tests/src/org/eclipse/jpt/ui/tests/internal/swt/TextFieldModelAdapterUITest.java
+++ /dev/null
@@ -1,252 +0,0 @@
-/*******************************************************************************
- * Copyright (c) 2008 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.
- *
- * Contributors:
- * Oracle - initial API and implementation
- ******************************************************************************/
-package org.eclipse.jpt.ui.tests.internal.swt;
-
-import org.eclipse.jface.action.Action;
-import org.eclipse.jface.action.ActionContributionItem;
-import org.eclipse.jface.action.IAction;
-import org.eclipse.jface.window.ApplicationWindow;
-import org.eclipse.jface.window.Window;
-import org.eclipse.jpt.ui.internal.swt.TextFieldModelAdapter;
-import org.eclipse.jpt.utility.internal.ClassTools;
-import org.eclipse.jpt.utility.internal.model.AbstractModel;
-import org.eclipse.jpt.utility.internal.model.value.PropertyAspectAdapter;
-import org.eclipse.jpt.utility.internal.model.value.SimplePropertyValueModel;
-import org.eclipse.jpt.utility.model.value.PropertyValueModel;
-import org.eclipse.jpt.utility.model.value.WritablePropertyValueModel;
-import org.eclipse.swt.SWT;
-import org.eclipse.swt.layout.FillLayout;
-import org.eclipse.swt.layout.FormAttachment;
-import org.eclipse.swt.layout.FormData;
-import org.eclipse.swt.layout.FormLayout;
-import org.eclipse.swt.widgets.Composite;
-import org.eclipse.swt.widgets.Control;
-import org.eclipse.swt.widgets.Display;
-import org.eclipse.swt.widgets.Shell;
-import org.eclipse.swt.widgets.Text;
-
-/**
- * Play around with a set of entry fields.
- */
-public class TextFieldModelAdapterUITest
- extends ApplicationWindow
-{
- private final TestModel testModel;
- private static final String DEFAULT_NAME = "Scooby Doo";
- private final WritablePropertyValueModel<TestModel> testModelHolder;
- private final WritablePropertyValueModel<String> nameHolder;
- private final WritablePropertyValueModel<String> allCapsNameHolder;
-
-
- public static void main(String[] args) throws Exception {
- Window window = new TextFieldModelAdapterUITest(args);
- window.setBlockOnOpen(true);
- window.open();
- Display.getCurrent().dispose();
- System.exit(0);
- }
-
- private TextFieldModelAdapterUITest(String[] args) {
- super(null);
- this.testModel = new TestModel(DEFAULT_NAME);
- this.testModelHolder = new SimplePropertyValueModel<TestModel>(this.testModel);
- this.nameHolder = this.buildNameHolder(this.testModelHolder);
- this.allCapsNameHolder = this.buildAllCapsNameHolder(this.testModelHolder);
- }
-
- private WritablePropertyValueModel<String> buildNameHolder(PropertyValueModel<TestModel> vm) {
- return new PropertyAspectAdapter<TestModel, String>(vm, TestModel.NAME_PROPERTY) {
- @Override
- protected String buildValue_() {
- return this.subject.name();
- }
- @Override
- protected void setValue_(String value) {
- this.subject.setName(value);
- }
- };
- }
-
- private WritablePropertyValueModel<String> buildAllCapsNameHolder(PropertyValueModel<TestModel> vm) {
- return new PropertyAspectAdapter<TestModel, String>(vm, TestModel.NAME_PROPERTY) {
- @Override
- protected String buildValue_() {
- return this.subject.name().toUpperCase();
- }
- @Override
- protected void setValue_(String value) {
- // do nothing
- }
- };
- }
-
- @Override
- protected Control createContents(Composite parent) {
- ((Shell) parent).setText(ClassTools.shortClassNameForObject(this));
- parent.setSize(400, 100);
- Composite mainPanel = new Composite(parent, SWT.NONE);
- mainPanel.setLayout(new FormLayout());
- Control textFieldPanel = this.buildTextFieldPanel(mainPanel);
- this.buildControlPanel(mainPanel, textFieldPanel);
- return mainPanel;
- }
-
- private Control buildTextFieldPanel(Composite parent) {
- Composite panel = new Composite(parent, SWT.NONE);
-
- FormData fd = new FormData();
- fd.top = new FormAttachment(0);
- fd.bottom = new FormAttachment(100, -35);
- fd.left = new FormAttachment(0);
- fd.right = new FormAttachment(100);
- panel.setLayoutData(fd);
-
- panel.setLayout(new FillLayout());
- this.buildNameTextField(panel);
- this.buildReadOnlyNameTextField(panel);
- this.buildAllCapsNameTextField(panel);
-
- return panel;
- }
-
- private void buildNameTextField(Composite parent) {
- Text textField = new Text(parent, SWT.SINGLE);
- TextFieldModelAdapter.adapt(this.nameHolder, textField);
- }
-
- private void buildReadOnlyNameTextField(Composite parent) {
- Text textField = new Text(parent, SWT.SINGLE);
- textField.setEnabled(false);
- TextFieldModelAdapter.adapt(this.nameHolder, textField);
- }
-
- private void buildAllCapsNameTextField(Composite parent) {
- Text textField = new Text(parent, SWT.SINGLE);
- textField.setEnabled(false);
- TextFieldModelAdapter.adapt(this.allCapsNameHolder, textField);
- }
-
- private void buildControlPanel(Composite parent, Control checkBoxPanel) {
- Composite panel = new Composite(parent, SWT.NONE);
- FormData fd = new FormData();
- fd.top = new FormAttachment(checkBoxPanel);
- fd.bottom = new FormAttachment(100);
- fd.left = new FormAttachment(0);
- fd.right = new FormAttachment(100);
- panel.setLayoutData(fd);
-
- panel.setLayout(new FillLayout());
- this.buildResetNameButton(panel);
- this.buildClearModelButton(panel);
- this.buildRestoreModelButton(panel);
- this.buildPrintModelButton(panel);
- }
-
- private void buildResetNameButton(Composite parent) {
- this.buildResetNameACI().fill(parent);
- }
-
- private ActionContributionItem buildResetNameACI() {
- Action action = new Action("reset name", IAction.AS_PUSH_BUTTON) {
- @Override
- public void run() {
- TextFieldModelAdapterUITest.this.resetName();
- }
- };
- action.setToolTipText("reset name");
- return new ActionContributionItem(action);
- }
-
- void resetName() {
- this.testModel.setName(DEFAULT_NAME);
- }
-
- private void buildClearModelButton(Composite parent) {
- this.buildClearModelACI().fill(parent);
- }
-
- private ActionContributionItem buildClearModelACI() {
- Action action = new Action("clear model", IAction.AS_PUSH_BUTTON) {
- @Override
- public void run() {
- TextFieldModelAdapterUITest.this.clearModel();
- }
- };
- action.setToolTipText("clear model");
- return new ActionContributionItem(action);
- }
-
- void clearModel() {
- this.testModelHolder.setValue(null);
- }
-
- private void buildRestoreModelButton(Composite parent) {
- this.buildRestoreModelACI().fill(parent);
- }
-
- private ActionContributionItem buildRestoreModelACI() {
- Action action = new Action("restore model", IAction.AS_PUSH_BUTTON) {
- @Override
- public void run() {
- TextFieldModelAdapterUITest.this.restoreModel();
- }
- };
- action.setToolTipText("restore model");
- return new ActionContributionItem(action);
- }
-
- void restoreModel() {
- this.testModelHolder.setValue(this.testModel);
- }
-
- private void buildPrintModelButton(Composite parent) {
- this.buildPrintModelACI().fill(parent);
- }
-
- private ActionContributionItem buildPrintModelACI() {
- Action action = new Action("print model", IAction.AS_PUSH_BUTTON) {
- @Override
- public void run() {
- TextFieldModelAdapterUITest.this.printModel();
- }
- };
- action.setToolTipText("print model");
- return new ActionContributionItem(action);
- }
-
- void printModel() {
- System.out.println("name: " + this.testModel.name());
- }
-
-
- // ********** model class **********
-
- class TestModel extends AbstractModel {
- private String name;
- public static final String NAME_PROPERTY = "name";
-
- public TestModel(String name) {
- this.name = name;
- }
- public String name() {
- return this.name;
- }
- public void setName(String name) {
- Object old = this.name;
- this.name = name;
- this.firePropertyChanged(NAME_PROPERTY, old, name);
- }
- @Override
- public String toString() {
- return "TestModel(" + this.name + ")";
- }
- }
-
-}
diff --git a/jpa/tests/org.eclipse.jpt.ui.tests/src/org/eclipse/jpt/ui/tests/internal/swt/TriStateCheckBoxModelAdapterUITest.java b/jpa/tests/org.eclipse.jpt.ui.tests/src/org/eclipse/jpt/ui/tests/internal/swt/TriStateCheckBoxModelAdapterUITest.java
deleted file mode 100644
index 80b8840a85..0000000000
--- a/jpa/tests/org.eclipse.jpt.ui.tests/src/org/eclipse/jpt/ui/tests/internal/swt/TriStateCheckBoxModelAdapterUITest.java
+++ /dev/null
@@ -1,320 +0,0 @@
-/*******************************************************************************
- * Copyright (c) 2008 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.
- *
- * Contributors:
- * Oracle - initial API and implementation
- ******************************************************************************/
-package org.eclipse.jpt.ui.tests.internal.swt;
-
-import org.eclipse.jface.action.Action;
-import org.eclipse.jface.action.ActionContributionItem;
-import org.eclipse.jface.action.IAction;
-import org.eclipse.jface.window.ApplicationWindow;
-import org.eclipse.jface.window.Window;
-import org.eclipse.jpt.ui.internal.swt.TriStateCheckBoxModelAdapter;
-import org.eclipse.jpt.ui.internal.widgets.DefaultWidgetFactory;
-import org.eclipse.jpt.ui.internal.widgets.TriStateCheckBox;
-import org.eclipse.jpt.utility.internal.ClassTools;
-import org.eclipse.jpt.utility.internal.model.AbstractModel;
-import org.eclipse.jpt.utility.internal.model.value.PropertyAspectAdapter;
-import org.eclipse.jpt.utility.internal.model.value.SimplePropertyValueModel;
-import org.eclipse.jpt.utility.model.value.PropertyValueModel;
-import org.eclipse.jpt.utility.model.value.WritablePropertyValueModel;
-import org.eclipse.swt.SWT;
-import org.eclipse.swt.events.SelectionEvent;
-import org.eclipse.swt.events.SelectionListener;
-import org.eclipse.swt.layout.FillLayout;
-import org.eclipse.swt.layout.FormAttachment;
-import org.eclipse.swt.layout.FormData;
-import org.eclipse.swt.layout.FormLayout;
-import org.eclipse.swt.widgets.Composite;
-import org.eclipse.swt.widgets.Control;
-import org.eclipse.swt.widgets.Display;
-import org.eclipse.swt.widgets.Shell;
-
-/**
- * Play around with a set of tri-state check boxes.
- */
-public class TriStateCheckBoxModelAdapterUITest
- extends ApplicationWindow
-{
- private final TestModel testModel;
- private final WritablePropertyValueModel<TestModel> testModelHolder;
- private final WritablePropertyValueModel<Boolean> flag1Holder;
- private final WritablePropertyValueModel<Boolean> flag2Holder;
- private final WritablePropertyValueModel<Boolean> notFlag2Holder;
-
- public static void main(String[] args) throws Exception {
- Window window = new TriStateCheckBoxModelAdapterUITest(args);
- window.setBlockOnOpen(true);
- window.open();
- Display.getCurrent().dispose();
- System.exit(0);
- }
-
- private TriStateCheckBoxModelAdapterUITest(String[] args) {
- super(null);
- this.testModel = new TestModel(Boolean.TRUE, Boolean.FALSE);
- this.testModelHolder = new SimplePropertyValueModel<TestModel>(this.testModel);
- this.flag1Holder = this.buildFlag1Holder(this.testModelHolder);
- this.flag2Holder = this.buildFlag2Holder(this.testModelHolder);
- this.notFlag2Holder = this.buildNotFlag2Holder(this.testModelHolder);
- }
-
- private WritablePropertyValueModel<Boolean> buildFlag1Holder(PropertyValueModel<TestModel> subjectHolder) {
- return new PropertyAspectAdapter<TestModel, Boolean>(subjectHolder, TestModel.FLAG1_PROPERTY) {
- @Override
- protected Boolean buildValue_() {
- return this.subject.isFlag1();
- }
- @Override
- protected void setValue_(Boolean value) {
- this.subject.setFlag1(value);
- }
- };
- }
-
- private WritablePropertyValueModel<Boolean> buildFlag2Holder(PropertyValueModel<TestModel> subjectHolder) {
- return new PropertyAspectAdapter<TestModel, Boolean>(subjectHolder, TestModel.FLAG2_PROPERTY) {
- @Override
- protected Boolean buildValue_() {
- return this.subject.isFlag2();
- }
- @Override
- protected void setValue_(Boolean value) {
- this.subject.setFlag2(value);
- }
- };
- }
-
- private WritablePropertyValueModel<Boolean> buildNotFlag2Holder(PropertyValueModel<TestModel> subjectHolder) {
- return new PropertyAspectAdapter<TestModel, Boolean>(subjectHolder, TestModel.NOT_FLAG2_PROPERTY) {
- @Override
- protected Boolean buildValue_() {
- return this.subject.isNotFlag2();
- }
- @Override
- protected void setValue_(Boolean value) {
- this.subject.setNotFlag2(value);
- }
- };
- }
-
- @Override
- protected Control createContents(Composite parent) {
- ((Shell) parent).setText(ClassTools.shortClassNameForObject(this));
- parent.setSize(400, 100);
- Composite mainPanel = new Composite(parent, SWT.NONE);
- mainPanel.setLayout(new FormLayout());
- Control checkBoxPanel = this.buildCheckBoxPanel(mainPanel);
- this.buildControlPanel(mainPanel, checkBoxPanel);
- return mainPanel;
- }
-
- private Control buildCheckBoxPanel(Composite parent) {
- Composite panel = new Composite(parent, SWT.NONE);
-
- FormData fd = new FormData();
- fd.top = new FormAttachment(0);
- fd.bottom = new FormAttachment(100, -35);
- fd.left = new FormAttachment(0);
- fd.right = new FormAttachment(100);
- panel.setLayoutData(fd);
-
- panel.setLayout(new FillLayout());
- this.buildFlag1CheckBox(panel);
- this.buildFlag2CheckBox(panel);
- this.buildNotFlag2CheckBox(panel);
- this.buildUnattachedCheckBox(panel);
-
- return panel;
- }
-
- private void buildFlag1CheckBox(Composite parent) {
- TriStateCheckBox checkBox = new TriStateCheckBox(parent, "flag 1", DefaultWidgetFactory.instance());
- TriStateCheckBoxModelAdapter.adapt(this.flag1Holder, checkBox);
- }
-
- private void buildFlag2CheckBox(Composite parent) {
- TriStateCheckBox checkBox = new TriStateCheckBox(parent, "flag 2", DefaultWidgetFactory.instance());
- TriStateCheckBoxModelAdapter.adapt(this.flag2Holder, checkBox);
- }
-
- private void buildNotFlag2CheckBox(Composite parent) {
- TriStateCheckBox checkBox = new TriStateCheckBox(parent, "next flag 2", DefaultWidgetFactory.instance());
- TriStateCheckBoxModelAdapter.adapt(this.notFlag2Holder, checkBox);
- }
-
- private void buildUnattachedCheckBox(Composite parent) {
- TriStateCheckBox checkBox = new TriStateCheckBox(parent, "unattached", DefaultWidgetFactory.instance());
- checkBox.addSelectionListener(this.buildUnattachedSelectionListener());
- }
-
- private SelectionListener buildUnattachedSelectionListener() {
- return new SelectionListener() {
- public void widgetDefaultSelected(SelectionEvent e) {
- System.out.println("unattached default selected: " + e);
- }
- public void widgetSelected(SelectionEvent e) {
- System.out.println("unattached selected: " + e);
- }
- };
- }
-
- private void buildControlPanel(Composite parent, Control checkBoxPanel) {
- Composite panel = new Composite(parent, SWT.NONE);
- FormData fd = new FormData();
- fd.top = new FormAttachment(checkBoxPanel);
- fd.bottom = new FormAttachment(100);
- fd.left = new FormAttachment(0);
- fd.right = new FormAttachment(100);
- panel.setLayoutData(fd);
-
- panel.setLayout(new FillLayout());
- this.buildFlipFlag1Button(panel);
- this.buildClearModelButton(panel);
- this.buildRestoreModelButton(panel);
- this.buildPrintModelButton(panel);
- }
-
- private void buildFlipFlag1Button(Composite parent) {
- this.buildFlipFlag1ACI().fill(parent);
- }
-
- private ActionContributionItem buildFlipFlag1ACI() {
- Action action = new Action("next flag 1", IAction.AS_PUSH_BUTTON) {
- @Override
- public void run() {
- TriStateCheckBoxModelAdapterUITest.this.nextFlag1();
- }
- };
- action.setToolTipText("next flag 1");
- return new ActionContributionItem(action);
- }
-
- void nextFlag1() {
- this.testModel.nextFlag1();
- }
-
- private void buildClearModelButton(Composite parent) {
- this.buildClearModelACI().fill(parent);
- }
-
- private ActionContributionItem buildClearModelACI() {
- Action action = new Action("clear model", IAction.AS_PUSH_BUTTON) {
- @Override
- public void run() {
- TriStateCheckBoxModelAdapterUITest.this.clearModel();
- }
- };
- action.setToolTipText("clear model");
- return new ActionContributionItem(action);
- }
-
- void clearModel() {
- this.testModelHolder.setValue(null);
- }
-
- private void buildRestoreModelButton(Composite parent) {
- this.buildRestoreModelACI().fill(parent);
- }
-
- private ActionContributionItem buildRestoreModelACI() {
- Action action = new Action("restore model", IAction.AS_PUSH_BUTTON) {
- @Override
- public void run() {
- TriStateCheckBoxModelAdapterUITest.this.restoreModel();
- }
- };
- action.setToolTipText("restore model");
- return new ActionContributionItem(action);
- }
-
- void restoreModel() {
- this.testModelHolder.setValue(this.testModel);
- }
-
- private void buildPrintModelButton(Composite parent) {
- this.buildPrintModelACI().fill(parent);
- }
-
- private ActionContributionItem buildPrintModelACI() {
- Action action = new Action("print model", IAction.AS_PUSH_BUTTON) {
- @Override
- public void run() {
- TriStateCheckBoxModelAdapterUITest.this.printModel();
- }
- };
- action.setToolTipText("print model");
- return new ActionContributionItem(action);
- }
-
- void printModel() {
- System.out.println("flag 1: " + this.testModel.isFlag1());
- System.out.println("flag 2: " + this.testModel.isFlag2());
- System.out.println("not flag 2: " + this.testModel.isNotFlag2());
- System.out.println("***");
- }
-
-
- private class TestModel extends AbstractModel {
- private Boolean flag1;
- public static final String FLAG1_PROPERTY = "flag1";
- private Boolean flag2;
- public static final String FLAG2_PROPERTY = "flag2";
- private Boolean notFlag2;
- public static final String NOT_FLAG2_PROPERTY = "notFlag2";
-
- public TestModel(Boolean flag1, Boolean flag2) {
- this.flag1 = flag1;
- this.flag2 = flag2;
- this.notFlag2 = this.next(flag2);
- }
- private Boolean next(Boolean b) {
- return (b == null) ? Boolean.TRUE : b.booleanValue() ? Boolean.FALSE : null;
- }
- public Boolean isFlag1() {
- return this.flag1;
- }
- public void setFlag1(Boolean flag1) {
- Boolean old = this.flag1;
- this.flag1 = flag1;
- this.firePropertyChanged(FLAG1_PROPERTY, old, flag1);
- }
- public void nextFlag1() {
- this.setFlag1(this.next(this.flag1));
- }
- public Boolean isFlag2() {
- return this.flag2;
- }
- public void setFlag2(Boolean flag2) {
- Boolean old = this.flag2;
- this.flag2 = flag2;
- this.firePropertyChanged(FLAG2_PROPERTY, old, flag2);
-
- old = this.notFlag2;
- this.notFlag2 = this.next(flag2);
- this.firePropertyChanged(NOT_FLAG2_PROPERTY, old, this.notFlag2);
- }
- public void nextFlag2() {
- this.setFlag2(this.next(this.flag2));
- }
- public Boolean isNotFlag2() {
- return this.notFlag2;
- }
- public void setNotFlag2(Boolean notFlag2) {
- this.setFlag2(this.next(flag2));
- }
- public void nextNotFlag2() {
- this.setNotFlag2(this.next(this.notFlag2));
- }
- @Override
- public String toString() {
- return "TestModel(" + this.isFlag1() + " - " + this.isFlag2() + ")";
- }
- }
-
-}
diff --git a/jpa/tests/org.eclipse.jpt.ui.tests/src/org/eclipse/jpt/ui/tests/internal/util/ControlAlignerTest.java b/jpa/tests/org.eclipse.jpt.ui.tests/src/org/eclipse/jpt/ui/tests/internal/util/ControlAlignerTest.java
deleted file mode 100644
index eccd44e811..0000000000
--- a/jpa/tests/org.eclipse.jpt.ui.tests/src/org/eclipse/jpt/ui/tests/internal/util/ControlAlignerTest.java
+++ /dev/null
@@ -1,800 +0,0 @@
-/*******************************************************************************
- * Copyright (c) 2008 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.
- *
- * Contributors:
- * Oracle - initial API and implementation
- ******************************************************************************/
-package org.eclipse.jpt.ui.tests.internal.util;
-
-import static org.junit.Assert.*;
-import org.eclipse.jface.dialogs.TitleAreaDialog;
-import org.eclipse.jpt.ui.internal.util.ControlAligner;
-import org.eclipse.jpt.ui.internal.util.SWTUtil;
-import org.eclipse.jpt.utility.internal.ClassTools;
-import org.eclipse.swt.SWT;
-import org.eclipse.swt.graphics.Point;
-import org.eclipse.swt.layout.GridData;
-import org.eclipse.swt.layout.GridLayout;
-import org.eclipse.swt.widgets.Button;
-import org.eclipse.swt.widgets.Composite;
-import org.eclipse.swt.widgets.Control;
-import org.eclipse.swt.widgets.Display;
-import org.eclipse.swt.widgets.Event;
-import org.eclipse.swt.widgets.Label;
-import org.eclipse.swt.widgets.Layout;
-import org.eclipse.swt.widgets.Shell;
-import org.junit.After;
-import org.junit.Before;
-import org.junit.Test;
-
-@SuppressWarnings("nls")
-public final class ControlAlignerTest {
-
- private ControlAligner controlAligner;
- private Composite parent;
- private Shell shell;
-
- private Layout buildSpacerLayout() {
- return new Layout() {
- @Override
- protected Point computeSize(Composite composite,
- int widthHint,
- int heightHint,
- boolean flushCache) {
-
- return new Point(widthHint, heightHint);
- }
-
- @Override
- protected void layout(Composite composite, boolean flushCache) {
- GridData data = (GridData) composite.getLayoutData();
- composite.setBounds(0, 0, data.widthHint, data.heightHint);
- }
- };
- }
-
- @Before
- public void setUp() {
-
- controlAligner = new ControlAligner();
-
- shell = new Shell(Display.getCurrent());
- shell.setLayout(new GridLayout(1, false));
-
- parent = new Composite(shell, SWT.NONE);
- parent.setLayout(new GridLayout(1, false));
- parent.setLayoutData(new GridData(GridData.HORIZONTAL_ALIGN_BEGINNING));
- }
-
- @After
- public void tearDown() {
-
- if (controlAligner != null) {
- controlAligner.dispose();
- controlAligner = null;
- }
-
- if (shell != null) {
- shell.dispose();
- shell = null;
- }
- }
-
- @Test
- public void testAddControl1() throws Exception {
-
- Composite pane = new Composite(parent, SWT.NULL);
- pane.setLayout(new GridLayout(3, false));
- pane.setLayoutData(new GridData(GridData.FILL_HORIZONTAL));
-
- Label label = new Label(pane, SWT.NULL);
- updateGridData(label);
-
- controlAligner.add(label);
-
- assertEquals(
- "The maximum width should be 0,",
- 0,
- controlAligner.getMaximumWidth()
- );
-
- label.setText("This is a ControlAligner");
-// parent.layout(true, true);
-
- Point size = label.getSize();
-
- assertEquals(
- "The width should be " + size.x + ",",
- size.x,
- controlAligner.getMaximumWidth()
- );
- }
-
- @Test
- public void testAddControl2() throws Exception {
-
- Composite pane = new Composite(parent, SWT.NULL);
- pane.setLayout(new GridLayout(3, false));
- pane.setLayoutData(new GridData(GridData.FILL_HORIZONTAL));
-
- Button button = new Button(pane, SWT.NULL);
- button.setText("This is a ControlAligner");
- updateGridData(button);
-
- controlAligner.add(button);
- parent.layout(true, true);
-
- Point size = button.getSize();
-
- assertEquals(
- "The width should be " + size.x + ",",
- size.x,
- controlAligner.getMaximumWidth()
- );
- }
-
- @Test
- public void testAddControl3() throws Exception {
-
- Composite pane = new Composite(parent, SWT.NULL);
- pane.setLayout(new GridLayout(3, false));
- pane.setLayoutData(new GridData(GridData.FILL_HORIZONTAL));
-
- Label label = new Label(pane, SWT.NULL);
- label.setText("This is very long text");
- updateGridData(label);
-
- Button button = new Button(pane, SWT.NULL);
- button.setText("Short text");
- updateGridData(button);
-
-// parent.layout(true, true);
-
- controlAligner.add(label);
- controlAligner.add(button);
-
- Point labelSize = label.getSize();
- Point buttonSize = button.getSize();
- int max = Math.max(labelSize.x, buttonSize.x);
-
- assertEquals(
- "The width should be " + max + ",",
- max,
- controlAligner.getMaximumWidth()
- );
- }
-
- @Test
- public void testAddControlAligner1() throws Exception {
-
- Label label1 = new Label(parent, SWT.NULL);
- Label label2 = new Label(parent, SWT.NULL);
-
- updateGridData(label1);
- updateGridData(label2);
-
- controlAligner.add(label1);
-
- ControlAligner controlAligner2 = new ControlAligner();
- controlAligner.add(controlAligner2);
- controlAligner2.add(label2);
-
- label1.setText("This is a ControlAligner");
- label2.setText("This is a very long ControlAligner");
-// parent.layout(true, true);
-
- Point size1 = label1.getSize();
- Point size2 = label2.getSize();
- int width = Math.max(size1.x, size2.x);
-
- assertEquals(
- "The width should be " + width + ",",
- width,
- controlAligner.getMaximumWidth()
- );
-
- assertEquals(
- "The width should be " + width + ",",
- width,
- controlAligner2.getMaximumWidth()
- );
- }
-
- @Test
- public void testAddControlAligner2() throws Exception {
-
- Label label1 = new Label(parent, SWT.NULL);
- Label label2 = new Label(parent, SWT.NULL);
-
- updateGridData(label1);
- updateGridData(label2);
-
- controlAligner.add(label1);
-
- ControlAligner controlAligner2 = new ControlAligner();
- controlAligner2.add(label2);
-
- label1.setText("This is a ControlAligner");
- label2.setText("This is a very long ControlAligner");
-
- controlAligner.add(controlAligner2);
-// parent.layout(true, true);
-
- Point size1 = label1.getSize();
- Point size2 = label2.getSize();
- int width = Math.max(size1.x, size2.x);
-
- assertEquals(
- "The width should be " + width + ",",
- width,
- controlAligner.getMaximumWidth()
- );
-
- assertEquals(
- "The width should be " + width + ",",
- width,
- controlAligner2.getMaximumWidth()
- );
- }
-
- @Test(expected=IllegalArgumentException.class)
- public void testAddControlAlignerToItself() throws Exception {
- controlAligner.add(controlAligner);
- fail("A ControlAligner can't be added to itself");
- }
-
- @Test
- public void testDialog_AddControl1() throws Exception {
-
- final int[] maximumWidth = new int[1];
- final int[] size = new int[1];
-
- TitleAreaDialog dialog = new TitleAreaDialog(SWTUtil.getShell()) {
-
- private Label label;
-
- @Override
- protected Control createDialogArea(Composite parent) {
-
- Composite pane = new Composite(parent, SWT.NULL);
- pane.setLayout(new GridLayout(3, false));
- pane.setLayoutData(new GridData(GridData.FILL_HORIZONTAL));
-
- label = new Label(pane, SWT.LEFT);
- label.setText("This is a ControlAligner");
- updateGridData(label);
-
- controlAligner.add(label);
-
- return parent;
- }
-
- @Override
- protected void initializeBounds() {
- super.initializeBounds();
- size[0] = label.getSize().x;
- maximumWidth[0] = controlAligner.getMaximumWidth();
- }
- };
-
- dialog.create();
- dialog.close();
-
- assertEquals(
- "The width should be " + size[0] + ",",
- size[0],
- maximumWidth[0]
- );
- }
-
- @Test
- public void testDialog_AddControl2() throws Exception {
-
- final int[] maximumWidth = new int[1];
- final int[] sizes = new int[2];
-
- TitleAreaDialog dialog = new TitleAreaDialog(SWTUtil.getShell()) {
-
- private Button button;
- private Label label;
-
- @Override
- protected Control createDialogArea(Composite parent) {
-
- Composite pane = new Composite(parent, SWT.NULL);
- pane.setLayout(new GridLayout(3, false));
- pane.setLayoutData(new GridData(GridData.FILL_HORIZONTAL));
-
- label = new Label(pane, SWT.NULL);
- label.setText("This is a ControlAligner");
- updateGridData(label);
-
- controlAligner.add(label);
-
- button = new Button(pane, SWT.NULL);
- button.setText("Short text");
- updateGridData(button);
-
- controlAligner.add(button);
-
- return parent;
- }
-
- @Override
- protected void initializeBounds() {
- super.initializeBounds();
- sizes[0] = label.getSize().x;
- sizes[1] = button.getSize().x;
- maximumWidth[0] = controlAligner.getMaximumWidth();
- }
- };
-
- dialog.create();
- dialog.close();
-
- int labelSize = sizes[0];
- int buttonSize = sizes[1];
- int max = Math.max(labelSize, buttonSize);
-
- assertEquals(
- "The width should be " + max + ",",
- max,
- maximumWidth[0]
- );
- }
-
- @Test
- public void testDispose() throws Exception {
-
- Composite pane = new Composite(parent, SWT.NULL);
- pane.setLayout(new GridLayout(3, false));
- pane.setLayoutData(new GridData(GridData.FILL_HORIZONTAL));
-
- Label label = new Label(pane, SWT.NULL);
- label.setText("This is very long text");
- updateGridData(label);
-
- Button button = new Button(pane, SWT.NULL);
- button.setText("Short text");
- updateGridData(button);
-
- controlAligner.add(label);
- controlAligner.add(button);
-
- Point labelSize = label.getSize();
- Point buttonSize = button.getSize();
- int max = Math.max(labelSize.x, buttonSize.x);
-
- assertEquals(
- "The width should be " + max + ",",
- max,
- controlAligner.getMaximumWidth()
- );
-
- label.dispose();
-
- Point newButtonSize = button.getSize();
-
- assertNotSame(
- "The old max and new max should not be the same",
- max,
- newButtonSize.x
- );
-
- assertEquals(
- "The ControlAligner doesn't have the right maximum width",
- newButtonSize.x,
- controlAligner.getMaximumWidth()
- );
- }
-
- @Test
- public void testHierarchyOfControlAligners() throws Exception {
-
- // Aligner1
- // ^
- // |-Aligner2
- // ^
- // |-Aligner3
- ControlAligner controlAligner2 = new ControlAligner();
- controlAligner.add(controlAligner2);
-
- ControlAligner controlAligner3 = new ControlAligner();
- controlAligner2.add(controlAligner3);
-
- // Test 1
- Label label1 = new Label(parent, SWT.NULL);
- label1.setText("This is a label widget");
- parent.layout(true, true);
-
- int labelWidth1 = label1.getSize().x;
- controlAligner3.add(label1);
-
- assertEquals(controlAligner3.getMaximumWidth(), labelWidth1);
- assertEquals(controlAligner2.getMaximumWidth(), labelWidth1);
- assertEquals(controlAligner.getMaximumWidth(), labelWidth1);
-
- // Test 2
- Label label2 = new Label(parent, SWT.NULL);
- label2.setText("ShortLabel");
- controlAligner2.add(label2);
- parent.layout(true);
-
- int newLabelWidth1 = label1.getSize().x;
- int newLabelWidth2 = label2.getSize().x;
-
- assertEquals(controlAligner3.getMaximumWidth(), controlAligner2.getMaximumWidth());
- assertEquals(controlAligner2.getMaximumWidth(), controlAligner.getMaximumWidth());
- assertEquals(newLabelWidth1, newLabelWidth2);
- assertEquals(newLabelWidth1, controlAligner.getMaximumWidth());
-
- // Test 3
- Label label3 = new Label(parent, SWT.NULL);
- label3.setText("A very long label that takes a lot of horizontal space");
-// parent.layout(true);
- controlAligner.add(label3);
-
- newLabelWidth1 = label1.getSize().x;
- newLabelWidth2 = label2.getSize().x;
- int newLabelWidth3 = label3.getSize().x;
-
- assertEquals(controlAligner3.getMaximumWidth(), controlAligner2.getMaximumWidth());
- assertEquals(controlAligner2.getMaximumWidth(), controlAligner.getMaximumWidth());
- assertEquals(newLabelWidth1, newLabelWidth2);
- assertEquals(newLabelWidth2, newLabelWidth3);
- assertEquals(newLabelWidth1, controlAligner.getMaximumWidth());
-
- // Make sure all the locked are removed
- assertEquals(ClassTools.attemptToGetFieldValue(controlAligner, "locked"), Boolean.FALSE);
- assertEquals(ClassTools.attemptToGetFieldValue(controlAligner2, "locked"), Boolean.FALSE);
- assertEquals(ClassTools.attemptToGetFieldValue(controlAligner3, "locked"), Boolean.FALSE);
-
- // Change the text of label2
- label2.setText("mm");
-// parent.layout(true);
-
- newLabelWidth1 = label1.getSize().x;
- newLabelWidth2 = label2.getSize().x;
- newLabelWidth3 = label3.getSize().x;
-
- assertEquals(controlAligner3.getMaximumWidth(), controlAligner2.getMaximumWidth());
- assertEquals(controlAligner2.getMaximumWidth(), controlAligner.getMaximumWidth());
- assertEquals(newLabelWidth1, newLabelWidth2);
- assertEquals(newLabelWidth2, newLabelWidth3);
- assertEquals(newLabelWidth1, controlAligner.getMaximumWidth());
-
- assertEquals(ClassTools.attemptToGetFieldValue(controlAligner, "locked"), Boolean.FALSE);
- assertEquals(ClassTools.attemptToGetFieldValue(controlAligner2, "locked"), Boolean.FALSE);
- assertEquals(ClassTools.attemptToGetFieldValue(controlAligner3, "locked"), Boolean.FALSE);
-
- // Change the text of label1
- label1.setText("a");
-// parent.layout(true);
-
- Composite parent1 = new Composite(SWTUtil.getShell(), SWT.NULL);
- parent1.setLayout(new GridLayout());
-
- Label tempLabel = new Label(parent1, SWT.NULL);
- tempLabel.setText("a");
-// parent1.layout(true);
-
- int realWidth = tempLabel.getSize().x;
-
- newLabelWidth1 = label1.getSize().x;
- newLabelWidth2 = label2.getSize().x;
- newLabelWidth3 = label3.getSize().x;
-
- assertEquals(controlAligner3.getMaximumWidth(), controlAligner2.getMaximumWidth());
- assertEquals(controlAligner2.getMaximumWidth(), controlAligner.getMaximumWidth());
- assertEquals(newLabelWidth1, newLabelWidth2);
- assertEquals(newLabelWidth2, newLabelWidth3);
- assertEquals(newLabelWidth1, controlAligner.getMaximumWidth());
- assertFalse(newLabelWidth1 == realWidth);
-
- assertEquals(ClassTools.attemptToGetFieldValue(controlAligner, "locked"), Boolean.FALSE);
- assertEquals(ClassTools.attemptToGetFieldValue(controlAligner2, "locked"), Boolean.FALSE);
- assertEquals(ClassTools.attemptToGetFieldValue(controlAligner3, "locked"), Boolean.FALSE);
-
- // Change the text of label1
- label1.setText("Yes another big long long text so that all the labels will have to take the size of this label to make sure ControlAligner works correctly");
-// parent.layout(true);
-
- // Weird: It seems no notification is sent, fire one manually
- Event event = new Event();
- event.widget = label1;
- event.type = SWT.Resize;
- label1.notifyListeners(SWT.Resize, event);
-
- Composite parent2 = new Composite(SWTUtil.getShell(), SWT.NULL);
- parent2.setLayout(new GridLayout());
-
- tempLabel = new Label(parent2, SWT.NULL);
- tempLabel.setText(label1.getText());
- parent2.layout(true);
-
- realWidth = tempLabel.getSize().x;
-
- newLabelWidth1 = label1.getSize().x;
- newLabelWidth2 = label2.getSize().x;
- newLabelWidth3 = label3.getSize().x;
-
- assertEquals(controlAligner3.getMaximumWidth(), controlAligner2.getMaximumWidth());
- assertEquals(controlAligner2.getMaximumWidth(), controlAligner.getMaximumWidth());
- assertEquals(newLabelWidth1, newLabelWidth2);
- assertEquals(newLabelWidth2, newLabelWidth3);
- assertEquals(controlAligner.getMaximumWidth(), newLabelWidth1);
- assertEquals(realWidth, newLabelWidth1);
-
- assertEquals(ClassTools.attemptToGetFieldValue(controlAligner, "locked"), Boolean.FALSE);
- assertEquals(ClassTools.attemptToGetFieldValue(controlAligner2, "locked"), Boolean.FALSE);
- assertEquals(ClassTools.attemptToGetFieldValue(controlAligner3, "locked"), Boolean.FALSE);
- }
-
- @Test
- public void testRemoveControl1() throws Exception {
-
- Composite pane = new Composite(parent, SWT.NULL);
- pane.setLayout(new GridLayout(3, false));
- pane.setLayoutData(new GridData(GridData.FILL_HORIZONTAL));
-
- Button button = new Button(pane, SWT.NULL);
- button.setText("This is a ControlAligner");
- updateGridData(button);
-
- controlAligner.add(button);
- parent.layout(true, true);
-
- Point size = button.getSize();
-
- assertEquals(
- "The width should be " + size.x + ",",
- size.x,
- controlAligner.getMaximumWidth()
- );
-
- controlAligner.remove(button);
-
- assertEquals(
- "The width should be 0, ",
- 0,
- controlAligner.getMaximumWidth()
- );
- }
-
- @Test
- public void testRemoveControl2() throws Exception {
-
- Composite pane = new Composite(parent, SWT.NULL);
- pane.setLayout(new GridLayout(3, false));
- pane.setLayoutData(new GridData(GridData.FILL_HORIZONTAL));
-
- Label label = new Label(pane, SWT.NULL);
- label.setText("This is very long text");
- updateGridData(label);
-
- Button button = new Button(pane, SWT.NULL);
- button.setText("Short text");
- updateGridData(button);
-// parent.layout(true, true);
-
- controlAligner.add(label);
- controlAligner.add(button);
-
- Point labelSize = label.getSize();
- Point buttonSize = button.getSize();
- int max = Math.max(labelSize.x, buttonSize.x);
-
- assertEquals(
- "The width should be " + max + ",",
- max,
- controlAligner.getMaximumWidth()
- );
-
- controlAligner.remove(label);
-
- Point newButtonSize = button.getSize();
-
- assertNotSame(
- "The old max and new max should not be the same",
- max,
- newButtonSize.x
- );
-
- assertEquals(
- "The ControlAligner doesn't have the right maximum width",
- newButtonSize.x,
- controlAligner.getMaximumWidth()
- );
- }
-
- @Test
- public void testRemoveControl4() throws Exception {
-
- Composite pane = new Composite(parent, SWT.NULL);
- pane.setLayout(new GridLayout(3, false));
- pane.setLayoutData(new GridData(GridData.FILL_HORIZONTAL));
-
- // Widget 1
- Label label = new Label(pane, SWT.NULL);
- label.setText("This is very long text");
- updateGridData(label);
- controlAligner.add(label);
-
- // Widget 2
- Composite spacer = new Composite(pane, SWT.NULL);
- spacer.setLayout(buildSpacerLayout());
- updateGridData(spacer);
- controlAligner.add(spacer);
-
- // Widget 3
- Button button = new Button(pane, SWT.NULL);
- button.setText("Short text");
- updateGridData(button);
- controlAligner.add(button);
-
-// parent.layout(true, true);
-
- // Make sure the 3 widgets have the same width
- Point labelSize = label.getSize();
- Point spacerSize = spacer.getSize();
- Point buttonSize = button.getSize();
- int max = Math.max(labelSize.x, buttonSize.x);
- max = Math.max(max, spacerSize.x);
-
- assertEquals(
- "The width should be " + max + ",",
- max,
- controlAligner.getMaximumWidth()
- );
-
- assertEquals(
- "The spacer's width should be " + max + ",",
- max,
- spacerSize.x
- );
-
- // Remove the label (the widest widget) and make sure the width was
- // correctly calculated
- controlAligner.remove(label);
-
- spacerSize = spacer.getSize();
- buttonSize = button.getSize();
- int max2 = Math.max(spacerSize.x, buttonSize.x);
-
- assertNotSame(
- "The old max and new max should not be the same",
- max,
- max2
- );
-
- assertEquals(
- "The ControlAligner doesn't have the right maximum width",
- max2,
- controlAligner.getMaximumWidth()
- );
-
- assertEquals(
- "The spacer's width should have been adjusted",
- max2,
- spacerSize.x
- );
- }
-
- @Test
- public void testRemoveControlAligner1() throws Exception {
-
- Label label1 = new Label(parent, SWT.NULL);
- Label label2 = new Label(parent, SWT.NULL);
-
- updateGridData(label1);
- updateGridData(label2);
-
- controlAligner.add(label1);
-
- ControlAligner controlAligner2 = new ControlAligner();
- controlAligner.add(controlAligner2);
- controlAligner2.add(label2);
-
- label1.setText("This is a ControlAligner");
- label2.setText("This is a very long ControlAligner");
-// parent.layout(true, true);
-
- Point size1 = label1.getSize();
- Point size2 = label2.getSize();
- int width = Math.max(size1.x, size2.x);
-
- // Test 1
- assertEquals(
- "The width should be " + width + ",",
- width,
- controlAligner.getMaximumWidth()
- );
-
- assertEquals(
- "The width should be " + width + ",",
- width,
- controlAligner2.getMaximumWidth()
- );
-
- // Test 2
- controlAligner.remove(label1);
-
- width = label2.getSize().x;
-
- assertEquals(
- "The width should be " + width + ",",
- width,
- controlAligner.getMaximumWidth()
- );
-
- assertEquals(
- "The width should be " + width + ",",
- width,
- controlAligner2.getMaximumWidth()
- );
- }
-
- @Test
- public void testRemoveControlAligner2() throws Exception {
-
- Label label1 = new Label(parent, SWT.NULL);
- Label label2 = new Label(parent, SWT.NULL);
-
- updateGridData(label1);
- updateGridData(label2);
-
- controlAligner.add(label1);
-
- ControlAligner controlAligner2 = new ControlAligner();
- controlAligner.add(controlAligner2);
- controlAligner2.add(label2);
-
- label1.setText("This is a ControlAligner");
- label2.setText("This is a very long ControlAligner");
-// parent.layout(true, true);
-
- Point size1 = label1.getSize();
- Point size2 = label2.getSize();
- int width = Math.max(size1.x, size2.x);
-
- // Test 1
- assertEquals(
- "The width should be " + width + ",",
- width,
- controlAligner.getMaximumWidth()
- );
-
- assertEquals(
- "The width should be " + width + ",",
- width,
- controlAligner2.getMaximumWidth()
- );
-
- // Test 2
- controlAligner2.remove(label2);
-
- width = label1.getSize().x;
-
- assertEquals(
- "The width should be " + width + ",",
- width,
- controlAligner.getMaximumWidth()
- );
-
- assertEquals(
- "The width should be " + width + ",",
- width,
- controlAligner2.getMaximumWidth()
- );
- }
-
- private void updateGridData(Control control) {
- GridData data = new GridData();
- data.horizontalAlignment = GridData.FILL;
- data.grabExcessHorizontalSpace = false;
- control.setLayoutData(data);
- }
-} \ No newline at end of file
diff --git a/jpa/tests/org.eclipse.jpt.ui.tests/src/org/eclipse/jpt/ui/tests/internal/util/ControlEnablerTest.java b/jpa/tests/org.eclipse.jpt.ui.tests/src/org/eclipse/jpt/ui/tests/internal/util/ControlEnablerTest.java
deleted file mode 100644
index 58e8e6739c..0000000000
--- a/jpa/tests/org.eclipse.jpt.ui.tests/src/org/eclipse/jpt/ui/tests/internal/util/ControlEnablerTest.java
+++ /dev/null
@@ -1,84 +0,0 @@
-/*******************************************************************************
- * Copyright (c) 2008 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.
- *
- * Contributors:
- * Oracle - initial API and implementation
- ******************************************************************************/
-package org.eclipse.jpt.ui.tests.internal.util;
-
-import static org.junit.Assert.*;
-import org.eclipse.jpt.ui.internal.util.ControlEnabler;
-import org.eclipse.jpt.ui.internal.util.SWTUtil;
-import org.eclipse.jpt.utility.internal.model.value.SimplePropertyValueModel;
-import org.eclipse.swt.SWT;
-import org.eclipse.swt.layout.GridLayout;
-import org.eclipse.swt.widgets.Combo;
-import org.eclipse.swt.widgets.Composite;
-import org.junit.After;
-import org.junit.Before;
-import org.junit.Test;
-
-@SuppressWarnings("nls")
-public final class ControlEnablerTest {
- private Composite parent;
-
- @Before
- public void setUp() {
- parent = new Composite(SWTUtil.getShell(), SWT.NONE);
- parent.setLayout(new GridLayout());
- }
-
- @After
- public void tearDown() {
- if (parent != null) {
- parent.dispose();
- }
- }
-
- @Test
- public void testSwitchState() {
-
- SimplePropertyValueModel<Boolean> booleanHolder =
- new SimplePropertyValueModel<Boolean>(true);
-
- Combo combo = new Combo(parent, SWT.BORDER);
-
- new ControlEnabler(booleanHolder, combo);
-
- assertTrue(
- "The Combo should be enabled",
- combo.isEnabled()
- );
-
- // Change state (null)
- booleanHolder.setValue(null);
-
- assertFalse(
- "The Combo should not be enabled",
- combo.isEnabled()
- );
-
- // Change state (true)
- booleanHolder.setValue(true);
-
- assertTrue(
- "The Combo should be enabled",
- combo.isEnabled()
- );
-
- // Change state (false)
- booleanHolder.setValue(false);
-
- assertFalse(
- "The Combo should not be enabled",
- combo.isEnabled()
- );
-
- // Dispose
- combo.dispose();
- booleanHolder.setValue(true);
- }
-}
diff --git a/jpa/tests/org.eclipse.jpt.ui.tests/src/org/eclipse/jpt/ui/tests/internal/util/ControlSwitcherTest.java b/jpa/tests/org.eclipse.jpt.ui.tests/src/org/eclipse/jpt/ui/tests/internal/util/ControlSwitcherTest.java
deleted file mode 100644
index 658ce0b09d..0000000000
--- a/jpa/tests/org.eclipse.jpt.ui.tests/src/org/eclipse/jpt/ui/tests/internal/util/ControlSwitcherTest.java
+++ /dev/null
@@ -1,187 +0,0 @@
-/*******************************************************************************
- * Copyright (c) 2008 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.
- *
- * Contributors:
- * Oracle - initial API and implementation
- ******************************************************************************/
-package org.eclipse.jpt.ui.tests.internal.util;
-
-import static org.junit.Assert.*;
-import org.eclipse.jpt.ui.internal.util.ControlSwitcher;
-import org.eclipse.jpt.ui.internal.util.SWTUtil;
-import org.eclipse.jpt.utility.internal.ClassTools;
-import org.eclipse.jpt.utility.internal.Transformer;
-import org.eclipse.jpt.utility.internal.model.value.SimplePropertyValueModel;
-import org.eclipse.swt.SWT;
-import org.eclipse.swt.graphics.Point;
-import org.eclipse.swt.layout.GridData;
-import org.eclipse.swt.layout.GridLayout;
-import org.eclipse.swt.widgets.Combo;
-import org.eclipse.swt.widgets.Composite;
-import org.eclipse.swt.widgets.Control;
-import org.eclipse.swt.widgets.Label;
-import org.eclipse.swt.widgets.Text;
-import org.eclipse.ui.part.PageBook;
-import org.junit.After;
-import org.junit.Before;
-import org.junit.Test;
-
-@SuppressWarnings("nls")
-public final class ControlSwitcherTest {
-
- private PageBook pageBook;
- private Composite pane1;
- private Composite pane2;
- private Composite parent;
-
- private Composite buildPane1() {
-
- if (pane1 == null) {
-
- pane1 = new Composite(pageBook, SWT.NULL);
- pane1.setLayout(new GridLayout(2, false));
-
- Label label = new Label(pane1, SWT.NULL);
- label.setText("&Test2:");
-
- Text text = new Text(pane1, SWT.BORDER);
- text.setLayoutData(new GridData(GridData.FILL_HORIZONTAL));
-
- Combo combo = new Combo(pane1, SWT.BORDER);
-
- GridData data = new GridData(GridData.FILL_HORIZONTAL);
- data.horizontalSpan = 2;
- combo.setLayoutData(data);
- }
-
- return pane1;
- }
-
- private Composite buildPane2() {
-
- if (pane2 == null) {
-
- pane2 = new Composite(pageBook, SWT.NULL);
- pane2.setLayout(new GridLayout(2, false));
-
- Label label = new Label(pane2, SWT.NULL);
- label.setText("&Test1:");
-
- Text text = new Text(pane2, SWT.BORDER);
- text.setLayoutData(new GridData(GridData.FILL_HORIZONTAL));
- }
-
- return pane2;
- }
-
- private Transformer<Boolean, Control> buildTransformer() {
- return new Transformer<Boolean, Control>() {
- public Control transform(Boolean value) {
- return (value == null) ? null : (value ? pane1 : pane2);
- }
- };
- }
-
- @Before
- public void setUp() {
- parent = new Composite(SWTUtil.getShell(), SWT.NONE);
- parent.setLayout(new GridLayout());
-
- pageBook = new PageBook(parent, SWT.NULL);
- pageBook.setLayoutData(new GridData());
- }
-
- @After
- public void tearDown() {
-
- if (parent != null) {
-
- parent.dispose();
-
- parent = null;
- pageBook = null;
- }
- }
-
- @Test
- public void testSwitch() {
-
- SimplePropertyValueModel<Boolean> switchHolder = new SimplePropertyValueModel<Boolean>();
- Transformer<Boolean, Control> transformer = buildTransformer();
-
- pane1 = buildPane1();
- pane1.setVisible(false);
-
- pane2 = buildPane2();
- pane2.setVisible(false);
-
- new ControlSwitcher(
- switchHolder,
- transformer,
- pageBook
- );
-
- // Test 1
- switchHolder.setValue(true);
- Control control = (Control) ClassTools.fieldValue(pageBook, "currentPage");
-
- assertNotNull(
- "The page book's page shouldn't be null",
- control
- );
-
- assertSame(
- "The current pane should be pane1",
- pane1,
- control
- );
-
- Point pane1Size = pane1.computeSize(SWT.DEFAULT, SWT.DEFAULT);
- Point pageBookSize = pageBook.computeSize(SWT.DEFAULT, SWT.DEFAULT);
-
- assertEquals(
- "The width of the PageBook should be the same as the width of pane1",
- pane1Size.x,
- pageBookSize.x
- );
-
- assertEquals(
- "The height of the PageBook should be the same as the height of pane1",
- pane1Size.y,
- pageBookSize.y
- );
-
- // Test 2
- switchHolder.setValue(false);
- control = (Control) ClassTools.fieldValue(pageBook, "currentPage");
-
- assertNotNull(
- "The page book's page shouldn't be null",
- control
- );
-
- assertSame(
- "The current pane should be pane2",
- pane2,
- control
- );
-
- Point pane2Size = pane2.computeSize(SWT.DEFAULT, SWT.DEFAULT);
- pageBookSize = pageBook.computeSize(SWT.DEFAULT, SWT.DEFAULT);
-
- assertEquals(
- "The width of the PageBook should be the same as the width of pane2",
- pane2Size.x,
- pageBookSize.x
- );
-
- assertEquals(
- "The height of the PageBook should be the same as the height of pane2",
- pane2Size.y,
- pageBookSize.y
- );
- }
-}
diff --git a/jpa/tests/org.eclipse.jpt.ui.tests/src/org/eclipse/jpt/ui/tests/internal/util/ControlVisibilityEnablerTest.java b/jpa/tests/org.eclipse.jpt.ui.tests/src/org/eclipse/jpt/ui/tests/internal/util/ControlVisibilityEnablerTest.java
deleted file mode 100644
index c0cd39c02a..0000000000
--- a/jpa/tests/org.eclipse.jpt.ui.tests/src/org/eclipse/jpt/ui/tests/internal/util/ControlVisibilityEnablerTest.java
+++ /dev/null
@@ -1,84 +0,0 @@
-/*******************************************************************************
- * Copyright (c) 2008 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.
- *
- * Contributors:
- * Oracle - initial API and implementation
- ******************************************************************************/
-package org.eclipse.jpt.ui.tests.internal.util;
-
-import static org.junit.Assert.*;
-import org.eclipse.jpt.ui.internal.util.ControlVisibilityEnabler;
-import org.eclipse.jpt.ui.internal.util.SWTUtil;
-import org.eclipse.jpt.utility.internal.model.value.SimplePropertyValueModel;
-import org.eclipse.swt.SWT;
-import org.eclipse.swt.layout.GridLayout;
-import org.eclipse.swt.widgets.Combo;
-import org.eclipse.swt.widgets.Composite;
-import org.junit.After;
-import org.junit.Before;
-import org.junit.Test;
-
-@SuppressWarnings("nls")
-public final class ControlVisibilityEnablerTest {
- private Composite parent;
-
- @Before
- public void setUp() {
- parent = new Composite(SWTUtil.getShell(), SWT.NONE);
- parent.setLayout(new GridLayout());
- }
-
- @After
- public void tearDown() {
- if (parent != null) {
- parent.dispose();
- }
- }
-
- @Test
- public void testSwitchState() {
-
- SimplePropertyValueModel<Boolean> booleanHolder =
- new SimplePropertyValueModel<Boolean>(true);
-
- Combo combo = new Combo(parent, SWT.BORDER);
-
- new ControlVisibilityEnabler(booleanHolder, combo);
-
- assertTrue(
- "The Combo should be visible",
- combo.isVisible()
- );
-
- // Change state (null)
- booleanHolder.setValue(null);
-
- assertFalse(
- "The Combo should not be visible",
- combo.isVisible()
- );
-
- // Change state (true)
- booleanHolder.setValue(true);
-
- assertTrue(
- "The Combo should be visible",
- combo.isVisible()
- );
-
- // Change state (false)
- booleanHolder.setValue(false);
-
- assertFalse(
- "The Combo should not be visible",
- combo.isVisible()
- );
-
- // Dispose
- combo.dispose();
- booleanHolder.setValue(true);
- }
-}
diff --git a/jpa/tests/org.eclipse.jpt.ui.tests/src/org/eclipse/jpt/ui/tests/internal/util/JptUiUtilTests.java b/jpa/tests/org.eclipse.jpt.ui.tests/src/org/eclipse/jpt/ui/tests/internal/util/JptUiUtilTests.java
deleted file mode 100644
index 81cfb08253..0000000000
--- a/jpa/tests/org.eclipse.jpt.ui.tests/src/org/eclipse/jpt/ui/tests/internal/util/JptUiUtilTests.java
+++ /dev/null
@@ -1,44 +0,0 @@
-/*******************************************************************************
- * Copyright (c) 2008 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.
- *
- * Contributors:
- * Oracle - initial API and implementation
- ******************************************************************************/
-package org.eclipse.jpt.ui.tests.internal.util;
-
-import junit.framework.JUnit4TestAdapter;
-import junit.framework.Test;
-import junit.framework.TestSuite;
-import org.junit.runner.RunWith;
-import org.junit.runners.Suite;
-import org.junit.runners.Suite.SuiteClasses;
-
-@SuiteClasses
-({
- ControlAlignerTest.class,
- ControlSwitcherTest.class,
- ControlEnablerTest.class,
- ControlVisibilityEnablerTest.class,
- LabeledButtonTest.class,
- LabeledLabelTest.class,
- LabeledControlUpdaterTest.class,
- PaneEnablerTest.class,
- PaneVisibilityEnablerTest.class,
-})
-@RunWith(Suite.class)
-public final class JptUiUtilTests {
-
- private JptUiUtilTests() {
- super();
- throw new UnsupportedOperationException();
- }
-
- public static Test suite() {
- TestSuite suite = new TestSuite();
- suite.addTest(new JUnit4TestAdapter(JptUiUtilTests.class));
- return suite;
- }
-}
diff --git a/jpa/tests/org.eclipse.jpt.ui.tests/src/org/eclipse/jpt/ui/tests/internal/util/LabeledButtonTest.java b/jpa/tests/org.eclipse.jpt.ui.tests/src/org/eclipse/jpt/ui/tests/internal/util/LabeledButtonTest.java
deleted file mode 100644
index dde3031a3b..0000000000
--- a/jpa/tests/org.eclipse.jpt.ui.tests/src/org/eclipse/jpt/ui/tests/internal/util/LabeledButtonTest.java
+++ /dev/null
@@ -1,122 +0,0 @@
-/*******************************************************************************
- * Copyright (c) 2008 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.
- *
- * Contributors:
- * Oracle - initial API and implementation
- ******************************************************************************/
-package org.eclipse.jpt.ui.tests.internal.util;
-
-import static org.junit.Assert.assertEquals;
-import org.eclipse.core.runtime.AssertionFailedException;
-import org.eclipse.jpt.ui.internal.util.LabeledButton;
-import org.eclipse.jpt.ui.internal.util.SWTUtil;
-import org.eclipse.swt.SWT;
-import org.eclipse.swt.graphics.Image;
-import org.eclipse.swt.layout.GridLayout;
-import org.eclipse.swt.widgets.Button;
-import org.eclipse.swt.widgets.Composite;
-import org.junit.After;
-import org.junit.Before;
-import org.junit.Test;
-
-@SuppressWarnings("nls")
-public final class LabeledButtonTest {
-
- private Composite parent;
-
- @Before
- public void setUp() {
- parent = new Composite(SWTUtil.getShell(), SWT.NONE);
- parent.setLayout(new GridLayout());
- }
-
- @After
- public void tearDown() {
- if (parent != null) {
- parent.dispose();
- parent = null;
- }
- }
-
- @Test
- public void testLabeledButton1() {
- Button button = new Button(parent, SWT.NULL);
- new LabeledButton(button);
- }
-
- @Test(expected=AssertionFailedException.class)
- public void testLabeledButton2() {
- new LabeledButton(null);
- }
-
- @Test
- public void testSetImage() {
-
- Image expected = new Image(parent.getDisplay(), 16, 16);
-
- try {
- Button button = new Button(parent, SWT.NULL);
- LabeledButton labeledButton = new LabeledButton(button);
-
- labeledButton.setImage(expected);
-
- assertEquals(
- "The Button didn't receive the Image",
- expected,
- button.getImage()
- );
- }
- finally {
- expected.dispose();
- }
- }
-
- @Test
- public void testSetImageDispose() {
-
- Image expected = new Image(parent.getDisplay(), 16, 16);
-
- try {
- Button button = new Button(parent, SWT.NULL);
- LabeledButton labeledButton = new LabeledButton(button);
-
- button.dispose();
-
- // This should not fail but simply do nothing
- labeledButton.setImage(expected);
- }
- finally {
- expected.dispose();
- }
- }
-
- @Test
- public void testSetText() {
- Button button = new Button(parent, SWT.NULL);
- LabeledButton labeledButton = new LabeledButton(button);
-
- String expected = "This is a test";
- labeledButton.setText(expected);
-
- assertEquals(
- "The Button didn't receive the text",
- expected,
- button.getText()
- );
- }
-
- @Test
- public void testSetTextDispose() {
- Button button = new Button(parent, SWT.NULL);
- LabeledButton labeledButton = new LabeledButton(button);
-
- button.dispose();
-
- // This should not fail but simply do nothing
- String expected = "This is a test";
- labeledButton.setText(expected);
- }
-}
diff --git a/jpa/tests/org.eclipse.jpt.ui.tests/src/org/eclipse/jpt/ui/tests/internal/util/LabeledControlUpdaterTest.java b/jpa/tests/org.eclipse.jpt.ui.tests/src/org/eclipse/jpt/ui/tests/internal/util/LabeledControlUpdaterTest.java
deleted file mode 100644
index bd2ce50228..0000000000
--- a/jpa/tests/org.eclipse.jpt.ui.tests/src/org/eclipse/jpt/ui/tests/internal/util/LabeledControlUpdaterTest.java
+++ /dev/null
@@ -1,124 +0,0 @@
-/*******************************************************************************
- * Copyright (c) 2008 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.
- *
- * Contributors:
- * Oracle - initial API and implementation
- ******************************************************************************/
-package org.eclipse.jpt.ui.tests.internal.util;
-
-import static org.junit.Assert.assertEquals;
-import org.eclipse.jpt.ui.internal.util.LabeledControlUpdater;
-import org.eclipse.jpt.ui.internal.util.LabeledLabel;
-import org.eclipse.jpt.ui.internal.util.SWTUtil;
-import org.eclipse.jpt.utility.internal.model.value.SimplePropertyValueModel;
-import org.eclipse.jpt.utility.model.value.WritablePropertyValueModel;
-import org.eclipse.swt.SWT;
-import org.eclipse.swt.graphics.Image;
-import org.eclipse.swt.layout.GridLayout;
-import org.eclipse.swt.widgets.Composite;
-import org.eclipse.swt.widgets.Label;
-import org.junit.After;
-import org.junit.Before;
-import org.junit.Test;
-
-@SuppressWarnings("nls")
-public final class LabeledControlUpdaterTest {
-
- private Composite parent;
-
- @Before
- public void setUp() {
- parent = new Composite(SWTUtil.getShell(), SWT.NONE);
- parent.setLayout(new GridLayout());
- }
-
- @After
- public void tearDown() {
- if (parent != null) {
- parent.dispose();
- parent = null;
- }
- }
-
- @Test
- public void testSetImage() {
-
- Image expected = new Image(parent.getDisplay(), 16, 16);
-
- try {
- Label label = new Label(parent, SWT.NULL);
- LabeledLabel labeledLabel = new LabeledLabel(label);
-
- WritablePropertyValueModel<Image> imageHolder = new SimplePropertyValueModel<Image>();
- new LabeledControlUpdater(labeledLabel, null, imageHolder);
-
- labeledLabel.setImage(expected);
-
- assertEquals(
- "The Label didn't receive the Image",
- expected,
- label.getImage()
- );
- }
- finally {
- expected.dispose();
- }
- }
-
- @Test
- public void testSetImageDispose() {
-
- Image expected = new Image(parent.getDisplay(), 16, 16);
-
- try {
- Label label = new Label(parent, SWT.NULL);
- LabeledLabel labeledLabel = new LabeledLabel(label);
-
- WritablePropertyValueModel<Image> imageHolder = new SimplePropertyValueModel<Image>();
- new LabeledControlUpdater(labeledLabel, null, imageHolder);
-
- label.dispose();
- labeledLabel.setImage(expected);
- }
- finally {
- expected.dispose();
- }
- }
-
- @Test
- public void testSetText() {
-
- Label label = new Label(parent, SWT.NULL);
- LabeledLabel labeledLabel = new LabeledLabel(label);
-
- WritablePropertyValueModel<String> textHolder = new SimplePropertyValueModel<String>();
- new LabeledControlUpdater(labeledLabel, textHolder);
-
- String expected = "This is a test";
- textHolder.setValue(expected);
-
- assertEquals(
- "The Label didn't receive the text",
- expected,
- label.getText()
- );
- }
-
- @Test
- public void testSetTextDispose() {
-
- Label label = new Label(parent, SWT.NULL);
- LabeledLabel labeledLabel = new LabeledLabel(label);
-
- WritablePropertyValueModel<String> textHolder = new SimplePropertyValueModel<String>();
- new LabeledControlUpdater(labeledLabel, textHolder);
-
- label.dispose();
-
- String expected = "This is a test";
- textHolder.setValue(expected);
- }
-}
diff --git a/jpa/tests/org.eclipse.jpt.ui.tests/src/org/eclipse/jpt/ui/tests/internal/util/LabeledLabelTest.java b/jpa/tests/org.eclipse.jpt.ui.tests/src/org/eclipse/jpt/ui/tests/internal/util/LabeledLabelTest.java
deleted file mode 100644
index f962284dae..0000000000
--- a/jpa/tests/org.eclipse.jpt.ui.tests/src/org/eclipse/jpt/ui/tests/internal/util/LabeledLabelTest.java
+++ /dev/null
@@ -1,122 +0,0 @@
-/*******************************************************************************
- * Copyright (c) 2008 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.
- *
- * Contributors:
- * Oracle - initial API and implementation
- ******************************************************************************/
-package org.eclipse.jpt.ui.tests.internal.util;
-
-import static org.junit.Assert.assertEquals;
-import org.eclipse.core.runtime.AssertionFailedException;
-import org.eclipse.jpt.ui.internal.util.LabeledLabel;
-import org.eclipse.jpt.ui.internal.util.SWTUtil;
-import org.eclipse.swt.SWT;
-import org.eclipse.swt.graphics.Image;
-import org.eclipse.swt.layout.GridLayout;
-import org.eclipse.swt.widgets.Composite;
-import org.eclipse.swt.widgets.Label;
-import org.junit.After;
-import org.junit.Before;
-import org.junit.Test;
-
-@SuppressWarnings("nls")
-public final class LabeledLabelTest {
-
- private Composite parent;
-
- @Before
- public void setUp() {
- parent = new Composite(SWTUtil.getShell(), SWT.NONE);
- parent.setLayout(new GridLayout());
- }
-
- @After
- public void tearDown() {
- if (parent != null) {
- parent.dispose();
- parent = null;
- }
- }
-
- @Test
- public void testLabeledButton1() {
- Label label = new Label(parent, SWT.NULL);
- new LabeledLabel(label);
- }
-
- @Test(expected=AssertionFailedException.class)
- public void testLabeledButton2() {
- new LabeledLabel(null);
- }
-
- @Test
- public void testSetImage() {
-
- Image expected = new Image(parent.getDisplay(), 16, 16);
-
- try {
- Label label = new Label(parent, SWT.NULL);
- LabeledLabel labeledLabel = new LabeledLabel(label);
-
- labeledLabel.setImage(expected);
-
- assertEquals(
- "The Label didn't receive the Image",
- expected,
- label.getImage()
- );
- }
- finally {
- expected.dispose();
- }
- }
-
- @Test
- public void testSetImageDispose() {
-
- Image expected = new Image(parent.getDisplay(), 16, 16);
-
- try {
- Label label = new Label(parent, SWT.NULL);
- LabeledLabel labeledLabel = new LabeledLabel(label);
-
- label.dispose();
-
- // This should not fail but simply do nothing
- labeledLabel.setImage(expected);
- }
- finally {
- expected.dispose();
- }
- }
-
- @Test
- public void testSetText() {
- Label label = new Label(parent, SWT.NULL);
- LabeledLabel labeledLabel = new LabeledLabel(label);
-
- String expected = "This is a test";
- labeledLabel.setText(expected);
-
- assertEquals(
- "The Label didn't receive the text",
- expected,
- label.getText()
- );
- }
-
- @Test
- public void testSetTextDispose() {
- Label label = new Label(parent, SWT.NULL);
- LabeledLabel labeledLabel = new LabeledLabel(label);
-
- label.dispose();
-
- // This should not fail but simply do nothing
- String expected = "This is a test";
- labeledLabel.setText(expected);
- }
-}
diff --git a/jpa/tests/org.eclipse.jpt.ui.tests/src/org/eclipse/jpt/ui/tests/internal/util/PaneEnablerTest.java b/jpa/tests/org.eclipse.jpt.ui.tests/src/org/eclipse/jpt/ui/tests/internal/util/PaneEnablerTest.java
deleted file mode 100644
index 072686a307..0000000000
--- a/jpa/tests/org.eclipse.jpt.ui.tests/src/org/eclipse/jpt/ui/tests/internal/util/PaneEnablerTest.java
+++ /dev/null
@@ -1,93 +0,0 @@
-/*******************************************************************************
- * Copyright (c) 2008 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.
- *
- * Contributors:
- * Oracle - initial API and implementation
- ******************************************************************************/
-package org.eclipse.jpt.ui.tests.internal.util;
-
-import static org.junit.Assert.*;
-import org.eclipse.jpt.ui.internal.util.PaneEnabler;
-import org.eclipse.jpt.ui.internal.util.SWTUtil;
-import org.eclipse.jpt.ui.internal.widgets.DialogPane;
-import org.eclipse.jpt.utility.internal.model.value.SimplePropertyValueModel;
-import org.eclipse.jpt.utility.internal.node.Node;
-import org.eclipse.swt.SWT;
-import org.eclipse.swt.layout.GridLayout;
-import org.eclipse.swt.widgets.Composite;
-import org.junit.After;
-import org.junit.Before;
-import org.junit.Test;
-
-@SuppressWarnings("nls")
-public final class PaneEnablerTest {
- private Composite parent;
-
- @Before
- public void setUp() {
- parent = new Composite(SWTUtil.getShell(), SWT.NONE);
- parent.setLayout(new GridLayout());
- }
-
- @After
- public void tearDown() {
- if (parent != null) {
- parent.dispose();
- }
- }
-
- @Test
- public void testSwitchState() {
-
- SimplePropertyValueModel<Boolean> booleanHolder =
- new SimplePropertyValueModel<Boolean>(true);
-
- DialogPane<Node> pane = new DialogPane<Node>(
- new SimplePropertyValueModel<Node>(),
- parent)
- {
- @Override
- protected void initializeLayout(Composite container) {
- }
- };
-
- pane.populate();
- new PaneEnabler(booleanHolder, pane);
-
- assertTrue(
- "The pane should be enabled",
- pane.getControl().isEnabled()
- );
-
- // Change state (null)
- booleanHolder.setValue(null);
-
- assertFalse(
- "The pane should not be enabled",
- pane.getControl().isEnabled()
- );
-
- // Change state (true)
- booleanHolder.setValue(true);
-
- assertTrue(
- "The pane should be enabled",
- pane.getControl().isEnabled()
- );
-
- // Change state (false)
- booleanHolder.setValue(false);
-
- assertFalse(
- "The pane should not be enabled",
- pane.getControl().isEnabled()
- );
-
- // Dispose
- pane.dispose();
- booleanHolder.setValue(true);
- }
-}
diff --git a/jpa/tests/org.eclipse.jpt.ui.tests/src/org/eclipse/jpt/ui/tests/internal/util/PaneVisibilityEnablerTest.java b/jpa/tests/org.eclipse.jpt.ui.tests/src/org/eclipse/jpt/ui/tests/internal/util/PaneVisibilityEnablerTest.java
deleted file mode 100644
index 644acfc1b2..0000000000
--- a/jpa/tests/org.eclipse.jpt.ui.tests/src/org/eclipse/jpt/ui/tests/internal/util/PaneVisibilityEnablerTest.java
+++ /dev/null
@@ -1,93 +0,0 @@
-/*******************************************************************************
- * Copyright (c) 2008 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.
- *
- * Contributors:
- * Oracle - initial API and implementation
- ******************************************************************************/
-package org.eclipse.jpt.ui.tests.internal.util;
-
-import static org.junit.Assert.*;
-import org.eclipse.jpt.ui.internal.util.PaneVisibilityEnabler;
-import org.eclipse.jpt.ui.internal.util.SWTUtil;
-import org.eclipse.jpt.ui.internal.widgets.DialogPane;
-import org.eclipse.jpt.utility.internal.model.value.SimplePropertyValueModel;
-import org.eclipse.jpt.utility.internal.node.Node;
-import org.eclipse.swt.SWT;
-import org.eclipse.swt.layout.GridLayout;
-import org.eclipse.swt.widgets.Composite;
-import org.junit.After;
-import org.junit.Before;
-import org.junit.Test;
-
-@SuppressWarnings("nls")
-public final class PaneVisibilityEnablerTest {
- private Composite parent;
-
- @Before
- public void setUp() {
- parent = new Composite(SWTUtil.getShell(), SWT.NONE);
- parent.setLayout(new GridLayout());
- }
-
- @After
- public void tearDown() {
- if (parent != null) {
- parent.dispose();
- }
- }
-
- @Test
- public void testSwitchState() {
-
- SimplePropertyValueModel<Boolean> booleanHolder =
- new SimplePropertyValueModel<Boolean>(true);
-
- DialogPane<Node> pane = new DialogPane<Node>(
- new SimplePropertyValueModel<Node>(),
- parent)
- {
- @Override
- protected void initializeLayout(Composite container) {
- }
- };
-
- pane.populate();
- new PaneVisibilityEnabler(booleanHolder, pane);
-
- assertTrue(
- "The pane should be visible",
- pane.getControl().isVisible()
- );
-
- // Change state (null)
- booleanHolder.setValue(null);
-
- assertFalse(
- "The pane should not be visible",
- pane.getControl().isVisible()
- );
-
- // Change state (true)
- booleanHolder.setValue(true);
-
- assertTrue(
- "The pane should be visible",
- pane.getControl().isVisible()
- );
-
- // Change state (false)
- booleanHolder.setValue(false);
-
- assertFalse(
- "The pane should not be visible",
- pane.getControl().isVisible()
- );
-
- // Dispose
- pane.dispose();
- booleanHolder.setValue(true);
- }
-}

Back to the top